[GRASS5] d.vect -a|c for all types ver2

Martin Landa landa.martin at gmail.com
Sun Jan 15 08:21:59 EST 2006


Hi Markus,

I think it should be more tested, the last think what I want is to make
d.vect buggy (or more buggy;-). In the attachment you can find the
last version of the patch
(slightly modified version from 2005-11). So if you can, please test it.

for grassdev list: This patch allows to display colored lines and
points based on GRASSRGB column (not only areas).

Best regards, Martin

PS: Has anyone tested the similar patch for ps.map, see

http://grass.fsv.cvut.cz/~martin/grass/patches/ps_map-grassrgb-2005-10-02.diff.gz

2006/1/12, Markus Neteler <neteler at itc.it>:
> Hi Martin,
>
> I lost track on this somehow, sorry. What do you think,
> should I submit what I have from you to CVS?
> Then you compare and, if needed, send final updates?
>
> Markus
>
> On Mon, Nov 07, 2005 at 09:56:11AM +0100, Martin Landa wrote:
> > Hi Markus,
> >
> > 2005/10/28, Markus Neteler <neteler at itc.it>:
> >
> > > Testing the patch I got the idea that it may be useful/important
> > > to exclude the color equal to the monitor background color to
> > > avoid, that objects become invisible. This may be a simple if
> > > statement using a function which fetches the current background
> > > color.
> > >
> >
> > I am not sure if I understood well. Did you mean this??
> >
> > $ d.vect mapa col=white fcol=white
> > WARNING: Line color and background color are the same!
> > WARNING: Area fill color and background color are the same!
> >
> > or
> >
> > cat |  grassrgb   | vel
> > -----+-------------+-----
> >    2 | 255:255:255 |  15
> >
> > $ d.vect mapa -a
> > WARNING: Category <2>: Area fill color and background color are the same!
> > WARNING: Category <2>: Line color and background color are the same!
> >
> > > While all types of vector are well displayed with color now
> > > (no more error!), there is a small bug remaining:
> > >
> > > #spearfish
> > > d.vect fields disp=attr attrcol=label
> > >
> > > should only display the labels (and also centroids?) but not
> > > the areas. Hopefully also easy to fix...
> >
> > Yes, I am wondering if it is possible to determine correctly all isles by:
> >
> >     /* initialize isles - needed? */
> >     isles = Vect_new_list ();
> >     for ( area = 1; area <= num; area++ ) {
> >       n_isles = Vect_get_area_num_isles ( Map, area );
> >       for ( i = 0; i < n_isles; i++) {
> >        isle = Vect_get_area_isle ( Map, area, i );
> >        if (isle > 0) {
> >          Vect_list_append (isles, isle);
> >        }
> >       }
> >     }
> >
> > when I try to build topology of map 'fields' I see in report 11
> > isles!! I don't know why so many isles...
> >
> > Number of areas     :   65
> > Number of isles     :   11
> > Number of areas without centroid :   2
> >
> > Attached patch for d.vect behaves in "old way":
> >
> > * area without centroid is not displayed (as "isle").
> >
> > I am not sure how to solve it better ... but hope it works now...
> >
> > Best regards,
> >
> >  Martin
> >
> > > On Thu, Oct 27, 2005 at 06:36:06PM +0200, Martin Landa wrote:
> > > > Hi Markus,
> > > >
> > > > there is the last patch for d.vect (against the current CVS). Sorry
> > > > for this complication.
> > > >
> > > > Best regards, Martin
> > > >
> > > > 2005/10/27, Markus Neteler <neteler at itc.it>:
> > > > > Hi Martin,
> > > > >
> > > > > I have already deleted all patch files to reduce (my) confusion.
> > > > > Can you send the changes again to me? For me it's best to only
> > > > > have it against current CVS.
> > > > >
> > > > > Thanks
> > > > >
> > > > >  Markus
> > > > >
> > > > >
> > > > > Martin Landa wrote:
> > > > >
> > > > > >Hi Markus,
> > > > > >
> > > > > >it is my fault, a little bit confusing I think, sorry for that:
> > > > > >
> > > > > >d_vect_rgb_column-2005-10-23.diff.gz is against the current CVS,
> > > > > >please use this patch.
> > > > > >
> > > > > >area.diff is against d_vect_rgb_column-2005-10-18.diff
> > > > > >
> > > > > >Martin
> > > > > >
> > > > > >2005/10/26, Markus Neteler <neteler at itc.it>:
> > > > > >
> > > > > >
> > > > > >>Martin,
> > > > > >>
> > > > > >>the patch doesn't work, apparently it's not against the
> > > > > >>current CVS?
> > > > > >>
> > > > > >>patch -p0 < ~/area.diff
> > > > > >>patching file d.vect/area.c
> > > > > >>Hunk #1 succeeded at 44 with fuzz 2 (offset 24 lines).
> > > > > >>Hunk #2 succeeded at 54 (offset -19 lines).
> > > > > >>Hunk #3 succeeded at 173 with fuzz 2 (offset 24 lines).
> > > > > >>Hunk #4 FAILED at 233.
> > > > > >>Hunk #5 succeeded at 205 with fuzz 1 (offset -42 lines).
> > > > > >>1 out of 5 hunks FAILED -- saving rejects to file d.vect/area.c.rej
> > > > > >>
> > > > > >>Can you please recreate it against CVS?
> > > > > >>
> > > > > >>Thanks
> > > > > >>
> > > > > >> Markus
> > > > > >>
> > > > > >>On Mon, Oct 24, 2005 at 12:27:12AM +0200, Martin Landa wrote:
> > > > > >>
> > > > > >>
> > > > > >>>Hi,
> > > > > >>>
> > > > > >>>I have tried to solve this problem - I am really not sure, maybe I
> > > > > >>>don't understand correctly areas and isles...
> > > > > >>>
> > > > > >>>There is a new patch for d.vect... I hope without any huge bugs;-)
> > > > > >>>Please test it ... I am ready for your comments.
> > > > > >>>
> > > > > >>>Best regards,
> > > > > >>>
> > > > > >>>Martin
> > > > > >>>
> > > > > >>>2005/10/20, Markus Neteler <neteler at itc.it>:
> > > > > >>>
> > > > > >>>
> > > > > >>>>On Tue, Oct 18, 2005 at 07:12:38PM +0200, Markus Neteler wrote:
> > > > > >>>>
> > > > > >>>>
> > > > > >>>>>On Thu, Oct 06, 2005 at 09:18:33AM +0000, Martin Landa wrote:
> > > > > >>>>>
> > > > > >>>>>
> > > > > >>>>>>Hi all,
> > > > > >>>>>>
> > > > > >>>>>>I have rewritten the patch for d.vect which enables to use flags -a
> > > > > >>>>>>and -c for all vector types (not only for areas). I hope I did it
> > > > > >>>>>>better this time (for previous patch see
> > > > > >>>>>>http://grass.itc.it/pipermail/grass5/2005-September/019563.html).
> > > > > >>>>>>
> > > > > >>>>>>
> > > > > >>>>Hi Martin,
> > > > > >>>>
> > > > > >>>>I tested the new d.vect code (the Vlib/area.c fix is in CVS),
> > > > > >>>>but there is a bug in d.vect/area.c:
> > > > > >>>>
> > > > > >>>>d.vect delauney
> > > > > >>>>ERROR: Attempt to read topo for dead isle (2)
> > > > > >>>>
> > > > > >>>>The problem is the line:
> > > > > >>>>
> > > > > >>>>  if (Vect_get_isle_area(Map, area))
> > > > > >>>>
> > > > > >>>>Since this function ends with a fatal error for non-island
> > > > > >>>>areas, it must be used in a different way.
> > > > > >>>>However, for details better ask Radim...
> > > > > >>>>
> > > > > >>>>I am sure that you'll iron out this missing piece!
> > > > > >>>>
> > > > > >>>>Markus
> > > > > >>>>
> > > > > >>>>
> > > > > >>>>
> > > > > >>>>
> > > > > >>
> > > > > >>
> > > > > >>>--- d.vect.18/area.c  2005-10-24 00:03:10.000000000 +0200
> > > > > >>>+++ d.vect/area.c     2005-10-24 00:18:39.000000000 +0200
> > > > > >>>@@ -20,8 +20,9 @@
> > > > > >>>     struct line_cats *Cats;
> > > > > >>>     int cat, centroid = 0;
> > > > > >>>     int red, grn, blu;
> > > > > >>>+    struct ilist *isles = NULL;
> > > > > >>>
> > > > > >>>-    struct field_info *fi=NULL;
> > > > > >>>+    struct field_info *fi = NULL;
> > > > > >>>     dbDriver *driver = NULL;
> > > > > >>>     dbCatValArray cvarr;
> > > > > >>>     dbCatVal *cv_rgb = NULL;
> > > > > >>>@@ -72,14 +73,26 @@
> > > > > >>>
> > > > > >>>     num = Vect_get_num_areas(Map);
> > > > > >>>     G_debug (2, "n_areas = %d", num);
> > > > > >>>-
> > > > > >>>+
> > > > > >>>+    /* initialize isles - needed? */
> > > > > >>>+    isles = Vect_new_list ();
> > > > > >>>+    for ( area = 1; area <= num; area++ ) {
> > > > > >>>+      n_isles = Vect_get_area_num_isles ( Map, area );
> > > > > >>>+      for ( i = 0; i < n_isles; i++) {
> > > > > >>>+     isle = Vect_get_area_isle ( Map, area, i );
> > > > > >>>+     if (isle > 0) {
> > > > > >>>+       Vect_list_append (isles, isle);
> > > > > >>>+     }
> > > > > >>>+      }
> > > > > >>>+    }
> > > > > >>>+
> > > > > >>>     for ( area = 1; area <= num; area++ ) {
> > > > > >>>      int i;
> > > > > >>>      BOUND_BOX box;
> > > > > >>>         G_debug (3, "area = %d", area);
> > > > > >>>
> > > > > >>>-     if ( !Vect_area_alive (Map, area) ) continue;
> > > > > >>>-
> > > > > >>>+     if ( !Vect_area_alive (Map, area) || Vect_val_in_list(isles, area)) continue;
> > > > > >>>+
> > > > > >>>      /* Check box */
> > > > > >>>      Vect_get_area_box (Map, area, &box);
> > > > > >>>      if ( box.N < window->south || box.S > window->north ||
> > > > > >>>@@ -136,7 +149,7 @@
> > > > > >>>          Vect_append_points ( Points, IPoints, GV_FORWARD);
> > > > > >>>          Vect_append_point ( Points, xl, yl, 0.0 ); /* ??? */
> > > > > >>>      }
> > > > > >>>-
> > > > > >>>+
> > > > > >>>      if( table_colors_flag ) {
> > > > > >>>        cat=Vect_get_area_cat ( Map, area , Clist -> field );
> > > > > >>>        centroid = Vect_get_area_centroid ( Map, area );
> > > > > >>>@@ -196,20 +209,15 @@
> > > > > >>>      }
> > > > > >>>
> > > > > >>>      if ( fcolor > -1 ) {
> > > > > >>>-       if (Vect_get_isle_area (Map, area)) { /* isle ? */
> > > > > >>>-         R_RGB_color (255, 255, 255);
> > > > > >>>-         }
> > > > > >>>+       if (!table_colors_flag && !cats_color_flag) {
> > > > > >>>+         R_color(fcolor) ;
> > > > > >>>+       }
> > > > > >>>        else {
> > > > > >>>-         if (!table_colors_flag && !cats_color_flag) {
> > > > > >>>-           R_color(fcolor) ;
> > > > > >>>+         if (rgb) {
> > > > > >>>+           R_RGB_color ((unsigned char) red, (unsigned char) grn, (unsigned char) blu);
> > > > > >>>          }
> > > > > >>>          else {
> > > > > >>>-           if (rgb) {
> > > > > >>>-             R_RGB_color ((unsigned char) red, (unsigned char) grn, (unsigned char) blu);
> > > > > >>>-           }
> > > > > >>>-           else {
> > > > > >>>            R_color (fcolor);
> > > > > >>>-           }
> > > > > >>>          }
> > > > > >>>        }
> > > > > >>>        G_plot_polygon ( Points->x, Points->y, Points->n_points);
> > > > > >>>@@ -239,8 +247,10 @@
> > > > > >>>     } /* end for */
> > > > > >>>
> > > > > >>>     Vect_destroy_line_struct (Points);
> > > > > >>>+    Vect_destroy_line_struct (IPoints);
> > > > > >>>     Vect_destroy_cats_struct (Cats);
> > > > > >>>-
> > > > > >>>+    Vect_destroy_list (isles);
> > > > > >>>+
> > > > > >>>     return 0;
> > > > > >>> }
> > > > > >>>
> > > > > >>>
> > > > > >>>
> > > > > >>
> > > > > >>--
> > > > > >>Markus Neteler     <neteler itc it>       http://mpa.itc.it
> > > > > >>ITC-irst -  Centro per la Ricerca Scientifica e Tecnologica
> > > > > >>MPBA - Predictive Models for Biol. & Environ. Data Analysis
> > > > > >>Via Sommarive, 18        -       38050 Povo (Trento), Italy
> > > > > >>
> > > > > >>
> > > > > >>
> > > > >
> > > > >
> > >
> > >
> > >
> > > --
> > > Markus Neteler     <neteler itc it>       http://mpa.itc.it
> > > ITC-irst -  Centro per la Ricerca Scientifica e Tecnologica
> > > MPBA - Predictive Models for Biol. & Environ. Data Analysis
> > > Via Sommarive, 18        -       38050 Povo (Trento), Italy
> > >
>
>
>
> --
> Markus Neteler     <neteler itc it>       http://mpa.itc.it
> ITC-irst -  Centro per la Ricerca Scientifica e Tecnologica
> MPBA - Predictive Models for Biol. & Environ. Data Analysis
> Via Sommarive, 18        -       38050 Povo (Trento), Italy
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: d_vect_rgb_column-2006-01-14.diff.gz
Type: application/x-gzip
Size: 5677 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-dev/attachments/20060115/3b6e4af6/d_vect_rgb_column-2006-01-14.diff.gz


More information about the grass-dev mailing list