ソースを参照

v.edit/v.out.postgis: remove V2_open_new_ogr|pg()
new OGR/PG layer is created by Vect_write_line()


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

Martin Landa 12 年 前
コミット
7dc726919b
2 ファイル変更13 行追加15 行削除
  1. 12 14
      vector/v.edit/main.c
  2. 1 1
      vector/v.out.postgis/create.c

+ 12 - 14
vector/v.edit/main.c

@@ -3,13 +3,13 @@
  *
  * MODULE:     v.edit
  *
- * PURPOSE:    Editing vector map.
+ * PURPOSE:    Non-interactive editing vector map.
  *
  * AUTHOR(S):  Wolf Bergenheim
  *             Jachym Cepicky
- *             Update for GRASS 7 by Martin Landa <landa.martin gmail.com>
+ *             Major updates by Martin Landa <landa.martin gmail.com>
  *
- * COPYRIGHT:  (C) 2006-2011 by the GRASS Development Team
+ * COPYRIGHT:  (C) 2006-2011, 2013 by the GRASS Development Team
  *
  *             This program is free software under the GNU General
  *             Public License (>=v2). Read the file COPYING that comes
@@ -96,27 +96,25 @@ int main(int argc, char *argv[])
 	}
 
 	/* 3D vector maps? */
+        putenv("GRASS_VECTOR_EXTERNAL_IMMEDIATE=1");
 	ret = Vect_open_new(&Map, params.map->answer, WITHOUT_Z);
 	if (ret == -1) {
 	    G_fatal_error(_("Unable to create vector map <%s>"),
 			  params.map->answer);
 	}
-	
+	Vect_set_error_handler_io(NULL, &Map);
+
 	/* native or external data source ? */
 	map_type = Vect_maptype(&Map);
 	if (map_type != GV_FORMAT_NATIVE) {
 	    int type;
 	    type = Vect_option_to_types(params.type);
-	    if (type != GV_POINT && type != GV_LINE &&
-		type != GV_BOUNDARY)
-		G_fatal_error(_("Supported feature type for OGR layer: "
-				"%s, %s or %s"), "point", "line", "boundary");
-	    if (map_type == GV_FORMAT_POSTGIS)
-		ret = V2_open_new_pg(&Map, type);
-	    else
-		ret = V2_open_new_ogr(&Map, type);
-	    if (ret != 0)
-		G_fatal_error(_("Unable to create vector map <%s>"),
+	    if (type != GV_POINT && !(type & GV_LINES))
+		G_fatal_error("%s: point,line,boundary",
+                              _("Supported feature types for non-native formats:"));
+            /* create OGR or PostGIS layer */
+            if (Vect_write_line(&Map, type, NULL, NULL) < 0)
+                G_fatal_error(_("Unable to create vector map <%s>"),
 			      params.map->answer);
 	}
 	

+ 1 - 1
vector/v.out.postgis/create.c

@@ -23,7 +23,7 @@ void create_table(struct Map_info *In, struct Map_info *Out)
     type = Vect_read_next_line(In, NULL, NULL);
     Vect_rewind(In);
     
-    if (V2_open_new_pg(Out, type) < 0)
+    if (Vect_write_line(Out, type, NULL, NULL) < 0)
         G_fatal_error(_("Unable to create PostGIS layer <%s>"),
                       Vect_get_finfo_layer_name(Out));
 }