[GRASS5] v.report length fix

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 :slight_smile:

Thanks,

Markus

On Wed, Oct 09, 2002 at 06:02:48PM +0200, grass@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@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass-commit

Markus Neteler wrote:

It's a slight nightmare that nobody realized this bug for years...

And nobody realised that G_get_map_row() ignored the mask for years
(see the "i.pca and masks" thread), which is, IMHO, an even bigger
nightmare.

This is inevitable when you have more code than XFree86 but several
orders of magnitude fewer users (i.e. testers).

BTW: Is the submission to below branch correct?

Yes.

What about "release_30_08_2002_grass5_0_0"?

That's a non-branch tag, which records the exact versions which
comprise the 5.0.0 release.

Is the page
  http://grass.itc.it/grasscvstags.html
correct?

To avoid another branch nightmare, can we delete all unused branches?

There are only four branches (including the head):

  releasebranch_26_april_2002_5_0_0
  releasebranch_14_august_2001_5_0_0
  grassreleasebranch_5_0_0
  grass

Of these, the following can safely be deleted:

  releasebranch_14_august_2001_5_0_0
  grassreleasebranch_5_0_0

That just leaves the head (grass5) and the release branch
(releasebranch_26_april_2002_5_0_0).

Some of the older "internal" non-branch tags could be deleted, but any
tag which corresponds to a "published" version (e.g. the "betaX" and
"preX" tags) should remain, so that we make sense of comments such as
"it worked in pre3 but not in pre4".

--
Glynn Clements <glynn.clements@virgin.net>

On Wed, Oct 09, 2002 at 06:46:06PM +0200, Markus Neteler wrote:

Is the page
  http://grass.itc.it/grasscvstags.html
correct?

Haven't checked.

To avoid another branch nightmare, can we delete all unused branches?
Then at least I understand where to commit :slight_smile:

No, we need them.

On Wed, Oct 09, 2002 at 07:45:13PM +0200, Bernhard Reiter wrote:

On Wed, Oct 09, 2002 at 06:46:06PM +0200, Markus Neteler wrote:
> Is the page
> http://grass.itc.it/grasscvstags.html
> correct?

Haven't checked.

please do... Also the others: It's a long-term project to have
this page clear to everybody.
I have the impression that it is still not correct (according
to Glynn's recent mail).

> To avoid another branch nightmare, can we delete all unused branches?
> Then at least I understand where to commit :slight_smile:

For what do we need them?

Markus

Markus Neteler wrote:

> > Is the page
> > http://grass.itc.it/grasscvstags.html
> > correct?
>
> Haven't checked.

please do... Also the others: It's a long-term project to have
this page clear to everybody.
I have the impression that it is still not correct (according
to Glynn's recent mail).

That page is incorrect.

> > To avoid another branch nightmare, can we delete all unused branches?
> > Then at least I understand where to commit :slight_smile:
>
For what do we need them?

We don't need the two unused branches:

  releasebranch_14_august_2001_5_0_0
  grassreleasebranch_5_0_0

The first tag was created after the CVS repository got screwed up due
to a non-branch tag with the same name as the branch. Since that
situation was successfully recoverd from, that tag is redundant.

AFAIK, the second tag was a first attempt at a branch, but was never
actually used.

--
Glynn Clements <glynn.clements@virgin.net>