[GRASS-SVN] r34756 - grass/branches/develbranch_6/vector/v.select

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Dec 6 14:57:16 EST 2008


Author: martinl
Date: 2008-12-06 14:57:15 -0500 (Sat, 06 Dec 2008)
New Revision: 34756

Modified:
   grass/branches/develbranch_6/vector/v.select/main.c
Log:
v.select: 'reverse selection' flag added
	  don't check intersection for points
	  more guisections


Modified: grass/branches/develbranch_6/vector/v.select/main.c
===================================================================
--- grass/branches/develbranch_6/vector/v.select/main.c	2008-12-06 19:01:34 UTC (rev 34755)
+++ grass/branches/develbranch_6/vector/v.select/main.c	2008-12-06 19:57:15 UTC (rev 34756)
@@ -81,6 +81,10 @@
 	}
     }
 
+    /* Skip points */
+    if (LPoints->n_points < 2)
+	return 0;
+    
     /* Try intersections of line with area/isles boundary */
     /* Outer boundary */
     Vect_get_area_points(AMap, area, APoints);
@@ -115,7 +119,7 @@
     struct GModule *module;
     struct Option *in_opt[2], *out_opt, *type_opt[2], *field_opt[2],
 	*operator_opt;
-    struct Flag *table_flag;
+    struct Flag *table_flag, *r_flag;
     struct Map_info In[2], Out;
     struct field_info *IFi, *OFi;
     struct line_pnts *APoints, *BPoints;
@@ -140,10 +144,12 @@
     type_opt[0] = G_define_standard_option(G_OPT_V_TYPE);
     type_opt[0]->label = _("Feature type (vector map A)");
     type_opt[0]->key = "atype";
+    type_opt[0]->guisection = _("Selection");
 
     field_opt[0] = G_define_standard_option(G_OPT_V_FIELD);
     field_opt[0]->label = _("Layer number (vector map A)");
     field_opt[0]->key = "alayer";
+    field_opt[0]->guisection = _("Selection");
 
     in_opt[1] = G_define_standard_option(G_OPT_V_INPUT);
     in_opt[1]->description = _("Name of input vector map (B)");
@@ -152,11 +158,13 @@
     type_opt[1] = G_define_standard_option(G_OPT_V_TYPE);
     type_opt[1]->label = _("Feature type (vector map B)");
     type_opt[1]->key = "btype";
-
+    type_opt[1]->guisection = _("Selection");
+    
     field_opt[1] = G_define_standard_option(G_OPT_V_FIELD);
     field_opt[1]->label = _("Layer number (vector map B)");
     field_opt[1]->key = "blayer";
-
+    field_opt[1]->guisection = _("Selection");
+    
     out_opt = G_define_standard_option(G_OPT_V_OUTPUT);
 
     operator_opt = G_define_option();
@@ -177,6 +185,11 @@
     table_flag->key = 't';
     table_flag->description = _("Do not create attribute table");
 
+    r_flag = G_define_flag();
+    r_flag->key = 'r';
+    r_flag->description = _("Reverse selection");
+    r_flag->guisection = _("Selection");
+
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
 
@@ -434,7 +447,8 @@
 	G_debug(4, "aline = %d ALines[aline] = %d", aline, ALines[aline]);
 	G_percent(aline, nalines, 2);
 	
-	if (!(ALines[aline]))
+	if ((!r_flag->answer && !(ALines[aline])) ||
+	    (r_flag->answer && ALines[aline]))
 	    continue;
 
 	atype = Vect_read_line(&(In[0]), APoints, ACats, aline);



More information about the grass-commit mailing list