Przeglądaj źródła

GV_FORMAT_OGR_DIRECT added

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@39546 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 15 lat temu
rodzic
commit
c1b6bf85ad
3 zmienionych plików z 12 dodań i 7 usunięć
  1. 5 3
      include/vect/dig_defines.h
  2. 4 3
      lib/vector/Vlib/close.c
  3. 3 1
      lib/vector/Vlib/open.c

+ 5 - 3
include/vect/dig_defines.h

@@ -91,9 +91,11 @@
   Don't change GV_FORMAT_* values, this order is hardcoded in lib
 */
 /*! \brief GRASS native format */
-#define GV_FORMAT_NATIVE   0
-/*! \brief OGR format */
-#define GV_FORMAT_OGR      1
+#define GV_FORMAT_NATIVE     0
+/*! \brief OGR format (for layers linked via v.external) */
+#define GV_FORMAT_OGR        1
+/*! \brief OGR format (direct access) */
+#define GV_FORMAT_OGR_DIRECT 2
 
 /*! \brief One table linked to vector map */
 #define GV_1TABLE  0

+ 4 - 3
lib/vector/Vlib/close.c

@@ -106,9 +106,10 @@ int Vect_close(struct Map_info *Map)
     else {
 	/* spatial index must also be closed when opened with topo but not modified */
 	/* NOTE: also close sidx for GV_FORMAT_OGR if not direct OGR access */
-	if (Map->plus.Spidx_built == 1 && Map->plus.built == GV_BUILD_ALL)
-	    if (strcasecmp(Map->mapset, "ogr") != 0)
-		Vect_save_sidx(Map);
+	if (Map->format != GV_FORMAT_OGR_DIRECT &&
+	    Map->plus.Spidx_built == 1 &&
+	    Map->plus.built == GV_BUILD_ALL)
+	    Vect_save_sidx(Map);
     }
 
     if (Map->level == 2 && Map->plus.release_support) {

+ 3 - 1
lib/vector/Vlib/open.c

@@ -216,7 +216,7 @@ int Vect__open_old(struct Map_info *Map, const char *name, const char *mapset, c
 
     /* Read vector format information */
     if (ogr_mapset) {
-	format = GV_FORMAT_OGR;
+	format = GV_FORMAT_OGR_DIRECT;
     }
     else {
 	format = 0;
@@ -733,6 +733,7 @@ int Vect_coor_info(const struct Map_info *Map, struct Coor_info *Info)
 #endif
 	break;
     case GV_FORMAT_OGR:
+    case GV_FORMAT_OGR_DIRECT:
 	Info->size = 0L;
 	Info->mtime = 0L;
 	break;
@@ -767,6 +768,7 @@ const char *Vect_maptype_info(const struct Map_info *Map)
 	sprintf(maptype, "native");
 	break;
     case GV_FORMAT_OGR:
+    case GV_FORMAT_OGR_DIRECT:
 	sprintf(maptype, "ogr");
 	break;
     default: