#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
Keywords: vlib, map bbox, level1 | CPU: Unspecified
Platform: Unspecified |
------------------------------------+-------------------------
Recently I discovered that `g.region vector` does not work with vectors
with no topology (level 1). I fixed this issue similarly as `v.info` do
(level1.c) in r70302. Then I found similar issue when trying to colorize
points based on z-coord (`d.vect zcolor=elevation`). It uses
Vect_map_get_box() source:grass/trunk/display/d.vect/shape.c#L180 which
requires topology (1).
My suggestion would be to modify Vect_get_map_box() to work also on level
1 (fill bbox by reading features). I am not sure about consequences, any
opinion?
Patch attached attachment:get_map_box_level.diff. Unfortunately it
requires change in function definition (`const struct Map_info *` ->
`struct Map_into *`) since `Vect_rewind()` is called.
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):
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.
> 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. See
attachment:get_map_box_1.diff. On level 1 `Vect_get_map_box()` returns
error code.