Quellcode durchsuchen

vlib: add GRASS_VECTOR_EXTERNAL_IGNORE variable
update v.external to use this variable


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@56476 15284696-431f-4ddb-bdfa-cd5b030d7da7

Martin Landa vor 12 Jahren
Ursprung
Commit
8e3e0168e6
4 geänderte Dateien mit 12 neuen und 7 gelöschten Zeilen
  1. 6 0
      lib/init/variables.html
  2. 2 1
      lib/vector/Vlib/copy.c
  3. 3 6
      lib/vector/Vlib/open.c
  4. 1 0
      vector/v.external/main.c

+ 6 - 0
lib/init/variables.html

@@ -253,6 +253,12 @@ PERMANENT
     format, then the vector library writes features immediately to output
     database (in this case GRASS_VECTOR_EXTERNAL_IMMEDIATE is ignored).</dd>
 
+  <dt>GRASS_VECTOR_EXTERNAL_IGNORE</dt>
+  <dd>[vectorlib]<br> If the environment variable
+    GRASS_VECTOR_EXTERNAL_IGNORE exists, output vector format defined
+    by <em><a href="v.external.out.html">v.external.out</a></em> is
+    ignored. The format is always native.</dd>
+
   <dt>GRASS_WXBUNDLED</dt>
   <dd>[wxGUI]<br>
     set to tell wxGUI that a bundled wxPython will be used.<br>

+ 2 - 1
lib/vector/Vlib/copy.c

@@ -474,7 +474,8 @@ int copy_areas(const struct Map_info *In, int field, struct Map_info *Out)
     /* copy areas */
     nskipped = 0;
     nareas = Vect_get_num_areas(In);
-    G_message(_("Exporting areas..."));
+    if (nareas > 0)
+        G_message(_("Exporting areas..."));
     for (area = 1; area <= nareas; area++) {
         G_debug(3, "area = %d", area);
         G_percent(area, nareas, 3);

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

@@ -725,11 +725,8 @@ int open_new(struct Map_info *Map, const char *name, int with_z, int is_tmp)
     Map->temporary = is_tmp;
     
     /* determine output format */
-    if (strcmp(G_program_name(), "v.external") != 0)
-        Map->format = map_format(Map);
-    else
-        Map->format = GV_FORMAT_NATIVE;
-
+    Map->format = map_format(Map);
+    
     if (Map->format != GV_FORMAT_OGR_DIRECT &&
         getenv("GRASS_VECTOR_PGFILE") == NULL) { /* GRASS_VECTOR_PGFILE defined by v.out.postgis */
         char *path;
@@ -1214,7 +1211,7 @@ int map_format(struct Map_info *Map)
     
     format = GV_FORMAT_NATIVE;
     /* temporary maps can be stored only in native format */
-    if (Map->temporary)
+    if (Map->temporary || getenv("GRASS_VECTOR_EXTERNAL_IGNORE"))
         return format;
     
     if (G_find_file2("", "OGR", G_mapset())) {

+ 1 - 0
vector/v.external/main.c

@@ -142,6 +142,7 @@ int main(int argc, char *argv[])
     }
     
     /* create new vector map */
+    putenv("GRASS_VECTOR_EXTERNAL_IGNORE=1");
     Vect_open_new(&Map, output, WITHOUT_Z); /* dimension is set later from data source */
     Vect_set_error_handler_io(NULL, &Map);