[GRASS5] v.report length fix
Markus Neteler
neteler at itc.it
Wed Oct 9 12:46:06 EDT 2002
Thanks, Radim, for fixing v.report.
It's a slight nightmare that nobody realized this bug for years...
BTW: Is the submission to below branch correct?
What about "release_30_08_2002_grass5_0_0"?
Is the page
http://grass.itc.it/grasscvstags.html
correct?
To avoid another branch nightmare, can we delete all unused branches?
Then at least I understand where to commit :-)
Thanks,
Markus
On Wed, Oct 09, 2002 at 06:02:48PM +0200, grass at intevation.de wrote:
> Author: radim
>
> Update of /grassrepository/grass/src.contrib/SCS/vector/v.report/cmd
> In directory doto:/tmp/cvs-serv27088
>
> Modified Files:
> Tag: releasebranch_26_april_2002_5_0_0
> Gmakefile do_v_stats.c
> Removed Files:
> Tag: releasebranch_26_april_2002_5_0_0
> perimeter.c
> Log Message:
> length calc fix
>
> Index: Gmakefile
> ===================================================================
> RCS file: /grassrepository/grass/src.contrib/SCS/vector/v.report/cmd/Gmakefile,v
> retrieving revision 1.4
> retrieving revision 1.4.2.1
> diff -u -d -r1.4 -r1.4.2.1
> --- Gmakefile 15 Apr 2002 13:28:34 -0000 1.4
> +++ Gmakefile 9 Oct 2002 16:02:46 -0000 1.4.2.1
> @@ -11,7 +11,6 @@
> prt_report.o\
> do_v_stats.o\
> prt_unit.o\
> - perimeter.o\
> report.o\
> stats.o\
> sums.o
>
> Index: do_v_stats.c
> ===================================================================
> RCS file: /grassrepository/grass/src.contrib/SCS/vector/v.report/cmd/do_v_stats.c,v
> retrieving revision 1.2
> retrieving revision 1.2.2.1
> diff -u -d -r1.2 -r1.2.2.1
> --- do_v_stats.c 22 Jan 2002 04:51:44 -0000 1.2
> +++ do_v_stats.c 9 Oct 2002 16:02:46 -0000 1.2.2.1
> @@ -40,13 +40,13 @@
> int cnt=0, line, linea, island;
> CELL cat_no;
> int first, tot_cats, n_points;
> - register int area_num, line_num, i, ii, jj, kk;
> + register int area_num, line_num, i, ii, jj, kk, p;
> char *label_name, null[1];
> char aline[80];
> char map_name[100], *mapset;
> long len, nalloc=1024;
> double xcent, ycent, *X, *Y;
> - double perim;
> + double length;
> double f_area;
> double ot_area;
> double tot_area;
> @@ -245,23 +245,26 @@
> sleep(2);
> return (-1);
> }
> - /* Calculate line length */
> + /* Calculate line length */
> n_points = Points->n_points;
> X = Points->x;
> Y = Points->y;
>
> - perim = perimeter(n_points,X,Y);
> + length = 0.0;
> + for ( p = 0; p < Points->n_points - 1; p++ ) {
> + length += G_distance( Points->x[p], Points->y[p], Points->x[p+1], Points->y[p+1]);
> + }
> }
> else
> {
> - perim = 0.0;
> + length = 0.0;
> }
>
> if (first)
> {
> vect[0].num = cat_no;
> vect[0].line_cnt = 1;
> - vect[0].length = perim;
> + vect[0].length = length;
> i = 0;
> cnt = 1;
> first = 0;
> @@ -273,7 +276,7 @@
> if (vect[i].num == cat_no)
> {
> vect[i].line_cnt = vect[i].line_cnt + 1;
> - vect[i].length = vect[i].length + perim;
> + vect[i].length = vect[i].length + length;
> break;
> }
> }
> @@ -282,7 +285,7 @@
> cnt++;
> vect[i].num = cat_no;
> vect[i].line_cnt = 1;
> - vect[i].length = perim;
> + vect[i].length = length;
> qsort (vect, cnt, sizeof (struct Line_List), cmp);
> if (cnt == nalloc)
> {
>
> --- perimeter.c DELETED ---
>
>
> _______________________________________________
> grass-commit mailing list
> grass-commit at grass.itc.it
> http://grass.itc.it/mailman/listinfo/grass-commit
More information about the grass-dev
mailing list