[GRASS-SVN] r51757 - grass/trunk/lib/vector/Vlib

svn_grass at osgeo.org svn_grass at osgeo.org
Fri May 25 10:59:56 EDT 2012


Author: mmetz
Date: 2012-05-25 07:59:56 -0700 (Fri, 25 May 2012)
New Revision: 51757

Modified:
   grass/trunk/lib/vector/Vlib/open.c
Log:
Vlib: fix 2D/3D topo initialization

Modified: grass/trunk/lib/vector/Vlib/open.c
===================================================================
--- grass/trunk/lib/vector/Vlib/open.c	2012-05-25 14:51:51 UTC (rev 51756)
+++ grass/trunk/lib/vector/Vlib/open.c	2012-05-25 14:59:56 UTC (rev 51757)
@@ -400,9 +400,19 @@
 	      G_fatal_error(_("Unable to open vector map <%s> on level %d"),
 			    Map->fInfo.ogr.layer_name, level_request);
 	}
+	if (level < 2 && Map->head.with_z) {
+	    /* topo has been initialized as 2D, update to 3D */
+	    dig_free_plus(&(Map->plus));
+	    dig_spidx_free(&(Map->plus));
+	    dig_cidx_free(&(Map->plus));
+	    
+	    Map->plus.with_z = Map->head.with_z;
+	    dig_init_plus(&(Map->plus));
+	}
     }
-    else {
-	Map->head.with_z = Map->plus.with_z;	/* take dimension from topo */
+    else if (level > 1) {
+	/* take dimension from topo if topo is available */
+	Map->head.with_z = Map->plus.with_z;
     }
 
     /* set status */



More information about the grass-commit mailing list