浏览代码

v.edit: fix creating new OGR layers

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@47856 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 13 年之前
父节点
当前提交
ff1c057e34
共有 2 个文件被更改,包括 16 次插入31 次删除
  1. 0 22
      vector/v.edit/args.c
  2. 16 9
      vector/v.edit/main.c

+ 0 - 22
vector/v.edit/args.c

@@ -1,23 +1,3 @@
-
-/****************************************************************
- *
- * MODULE:     v.edit
- *
- * PURPOSE:    Editing vector map.
- *
- * AUTHOR(S):  GRASS Development Team
- *             Wolf Bergenheim, Jachym Cepicky, Martin Landa
- *
- * COPYRIGHT:  (C) 2006-2008 by the GRASS Development Team
- *
- *             This program is free software under the
- *             GNU General Public License (>=v2).
- *             Read the file COPYING that comes with GRASS
- *             for details.
- *
- * TODO:       3D support (done for move and vertexmove)
- ****************************************************************/
-
 #include "global.h"
 #include "global.h"
 
 
 /**
 /**
@@ -42,8 +22,6 @@ int parser(int argc, char *argv[], struct GParams *params,
     params->fld->guisection = _("Selection");
     params->fld->guisection = _("Selection");
 
 
     params->type = G_define_standard_option(G_OPT_V_TYPE);
     params->type = G_define_standard_option(G_OPT_V_TYPE);
-    params->type->answer = "point,line,boundary,centroid";
-    params->type->options = "point,line,boundary,centroid";
     params->type->guisection = _("Selection");
     params->type->guisection = _("Selection");
 
 
     params->tool = G_define_option();
     params->tool = G_define_option();

+ 16 - 9
vector/v.edit/main.c

@@ -6,13 +6,15 @@
  * PURPOSE:    Editing vector map.
  * PURPOSE:    Editing vector map.
  *
  *
  * AUTHOR(S):  GRASS Development Team
  * AUTHOR(S):  GRASS Development Team
- *             Wolf Bergenheim, Jachym Cepicky, Martin Landa
+ *             Wolf Bergenheim
+ *             Jachym Cepicky
+ *             Update for GRASS 7 by Martin Landa <landa.martin gmail.com>
  *
  *
- * COPYRIGHT:  (C) 2006-2010 by the GRASS Development Team
+ * COPYRIGHT:  (C) 2006-2011 by the GRASS Development Team
  *
  *
  *             This program is free software under the GNU General
  *             This program is free software under the GNU General
- *             Public License (>=v2).  Read the file COPYING that
- *             comes with GRASS for details.
+ *             Public License (>=v2). Read the file COPYING that comes
+ *             with GRASS for details.
  *
  *
  * TODO:       3D support (done for move and vertexmove)
  * TODO:       3D support (done for move and vertexmove)
  ****************************************************************/
  ****************************************************************/
@@ -31,7 +33,7 @@ int main(int argc, char *argv[])
 
 
     int i;
     int i;
     int move_first, snap;
     int move_first, snap;
-    int ret, print, layer;
+    int ret, layer;
     double move_x, move_y, move_z, thresh[3];
     double move_x, move_y, move_z, thresh[3];
 
 
     struct line_pnts *coord;
     struct line_pnts *coord;
@@ -91,6 +93,15 @@ int main(int argc, char *argv[])
 
 
 	/* 3D vector maps? */
 	/* 3D vector maps? */
 	ret = Vect_open_new(&Map, params.map->answer, WITHOUT_Z);
 	ret = Vect_open_new(&Map, params.map->answer, WITHOUT_Z);
+	if (Vect_maptype(&Map) == GV_FORMAT_OGR_DIRECT) {
+	    int type;
+	    type = Vect_option_to_types(params.type);
+	    if (type != GV_POINT && type != GV_LINE &&
+		type != GV_AREA)
+		G_fatal_error(_("Supported feature type for OGR layer: "
+				"%s, %s or %s"), "point", "line", "area");
+	    V2_open_new_ogr(&Map, type);
+	}
 	if (ret == -1) {
 	if (ret == -1) {
 	    G_fatal_error(_("Unable to create vector map <%s>"),
 	    G_fatal_error(_("Unable to create vector map <%s>"),
 			  params.map->answer);
 			  params.map->answer);
@@ -227,10 +238,8 @@ int main(int argc, char *argv[])
     /* perform requested editation */
     /* perform requested editation */
     switch (action_mode) {
     switch (action_mode) {
     case MODE_CREATE:
     case MODE_CREATE:
-	print = 0;		/* do not print id's */
 	break;
 	break;
     case MODE_ADD:
     case MODE_ADD:
-	print = 0;
 	if (!params.header->answer)
 	if (!params.header->answer)
 	    Vect_read_ascii_head(ascii, &Map);
 	    Vect_read_ascii_head(ascii, &Map);
 	int num_lines;
 	int num_lines;
@@ -311,7 +320,6 @@ int main(int argc, char *argv[])
 	G_message(_("%d lines merged"), ret);
 	G_message(_("%d lines merged"), ret);
 	break;
 	break;
     case MODE_SELECT:
     case MODE_SELECT:
-	print = 1;
 	ret = print_selected(List);
 	ret = print_selected(List);
 	break;
 	break;
     case MODE_CATADD:
     case MODE_CATADD:
@@ -347,7 +355,6 @@ int main(int argc, char *argv[])
 	G_message(_("%d lines flipped"), ret);
 	G_message(_("%d lines flipped"), ret);
 	break;
 	break;
     case MODE_NONE:
     case MODE_NONE:
-	print = 0;
 	break;
 	break;
     case MODE_ZBULK:{
     case MODE_ZBULK:{
 	    double start, step;
 	    double start, step;