[GRASS-SVN] r39171 - grass/trunk/lib/vector/Vlib
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Sep 13 06:58:15 EDT 2009
Author: mmetz
Date: 2009-09-13 06:58:15 -0400 (Sun, 13 Sep 2009)
New Revision: 39171
Modified:
grass/trunk/lib/vector/Vlib/open.c
Log:
3D initialization
Modified: grass/trunk/lib/vector/Vlib/open.c
===================================================================
--- grass/trunk/lib/vector/Vlib/open.c 2009-09-13 09:16:16 UTC (rev 39170)
+++ grass/trunk/lib/vector/Vlib/open.c 2009-09-13 10:58:15 UTC (rev 39171)
@@ -150,6 +150,8 @@
/* initialize Map->head */
Vect__init_head(Map);
+ /* initialize support structures for 2D, update to 3D when reading support files */
+ Map->plus.spidx_with_z = Map->plus.with_z = Map->head.with_z = 0;
/* initialize Map->plus */
dig_init_plus(&(Map->plus));
@@ -293,6 +295,14 @@
G_fatal_error(_("Unable to open spatial index file for vector map <%s>"),
Vect_get_full_name(Map));
}
+ /* check with_z consistency */
+ if ((Map->plus.with_z != 0 && Map->plus.spidx_with_z == 0) ||
+ (Map->plus.with_z == 0 && Map->plus.spidx_with_z != 0)) {
+ G_warning("Vector map <%s>: topology is %s, but spatial index is %s",
+ Vect_get_full_name(Map), (Map->plus.with_z != 0 ? "3D" : "2D"),
+ (Map->plus.spidx_with_z != 0 ? "3D" : "2D"));
+ level = 1;
+ }
}
/* open category index */
if (level == 2) {
@@ -630,6 +640,9 @@
Map->format = GV_FORMAT_NATIVE;
+ /* set 2D/3D */
+ Map->plus.spidx_with_z = Map->plus.with_z = Map->head.with_z = (with_z != 0);
+
if (V1_open_new_nat(Map, name, with_z) < 0) {
sprintf(errmsg, _("Unable to create vector map <%s>"),
Vect_get_full_name(Map));
@@ -652,7 +665,7 @@
/* initialize topo */
dig_init_plus(&(Map->plus));
- /* initialize spatial index */
+ /* open new spatial index */
Vect_open_sidx(Map, 2);
Map->open = VECT_OPEN_CODE;
@@ -663,7 +676,6 @@
Map->mode = GV_MODE_RW;
Map->Constraint_region_flag = 0;
Map->Constraint_type_flag = 0;
- Map->head.with_z = with_z;
Map->plus.do_uplist = 0;
Vect_set_proj(Map, G_projection());
More information about the grass-commit
mailing list