[GRASS-dev] [GRASS GIS] #3244: Vect_get_map_box() and level1

GRASS GIS trac at osgeo.org
Sat Jan 14 07:43:29 PST 2017

#3244: Vect_get_map_box() and level1
  Reporter:  martinl      |      Owner:  grass-dev@…
      Type:  task         |     Status:  new
  Priority:  normal       |  Milestone:  7.2.1
 Component:  Vector       |    Version:  unspecified
Resolution:               |   Keywords:  vlib, map bbox, level1
       CPU:  Unspecified  |   Platform:  Unspecified

Comment (by martinl):

 Replying to [comment:1 martinl]:
 > Patch attached attachment:get_map_box.diff. Unfortunately it requires
 change in function definition (`const struct Map_info *` -> `struct
 Map_into *`) since `Vect_rewind()` is called.

 Touching `plus_head` structure on level1 is not good idea since this
 structure is designed for topological level 2. I modified patch by
 introducing `Vect_get_map_box1()` which works on level1. On level 1
 `Vect_get_map_box()` returns error code. Example of usage (which fixes
 `d.vect zcolor=elevation` for maps open on level 1):

 --- display/d.vect/shape.c      (revision 70370)
 +++ display/d.vect/shape.c      (working copy)
 @@ -188,7 +188,10 @@
             z_style = NULL;
         else {
 -           Vect_get_map_box(Map, &box);
 +            if (Vect_level(Map) > 1)
 +                Vect_get_map_box(Map, &box);
 +            else
 +                Vect_get_map_box1(Map, &box);
             Rast_make_fp_colors(&zcolors, z_style, box.B, box.T);

 This approach could be used by other modules which works on level 1 like
 `g.region` with `vector` option. Anyway the map features will be read
 mostly twice(*) (by module itself and by `Vect_get_map_box1()`), so
 probably it make better sense to modify each module which works on level1
 and requires map bbox to fill bound_box structure locally when reading
 features by the module.

 (*) Not the case of `g.region`, so at least for this module
 `Vect_get_map_box1()` make sense.

Ticket URL: <https://trac.osgeo.org/grass/ticket/3244#comment:3>
GRASS GIS <https://grass.osgeo.org>

More information about the grass-dev mailing list