فهرست منبع

Vlib: fix 2D/3D topo initialization

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@51757 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Metz 13 سال پیش
والد
کامیت
baf51cdc8b
1فایلهای تغییر یافته به همراه12 افزوده شده و 2 حذف شده
  1. 12 2
      lib/vector/Vlib/open.c

+ 12 - 2
lib/vector/Vlib/open.c

@@ -400,9 +400,19 @@ int open_old(struct Map_info *Map, const char *name, const char *mapset,
 	      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 */