[GRASS-SVN] r69556 - grass/trunk/lib/vector/vedit

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Sep 23 05:57:02 PDT 2016


Author: mmetz
Date: 2016-09-23 05:57:02 -0700 (Fri, 23 Sep 2016)
New Revision: 69556

Modified:
   grass/trunk/lib/vector/vedit/merge.c
Log:
v.edit tool=merge: skip zero length lines; a single point is not a polygon

Modified: grass/trunk/lib/vector/vedit/merge.c
===================================================================
--- grass/trunk/lib/vector/vedit/merge.c	2016-09-23 11:04:45 UTC (rev 69555)
+++ grass/trunk/lib/vector/vedit/merge.c	2016-09-23 12:57:02 UTC (rev 69556)
@@ -64,6 +64,8 @@
 	return 0;
     }
 
+    G_debug(1, "Vedit_merge_lines(): merging %d lines", List->n_values);
+
     Points1 = Vect_new_line_struct();
     Cats1 = Vect_new_cats_struct();
     Points2 = Vect_new_line_struct();
@@ -86,6 +88,14 @@
 	if (!(type1 & GV_LINES))
 	    continue;
 
+	/* remove duplicate points */
+	Vect_line_prune(Points1);
+
+	if (Points1->n_points == 1) {
+	    G_debug(3, "Vedit_merge_lines(): skipping zero length line");
+	    continue;
+	}
+
 	Vect_reset_line(Points);
 
 	for (i = 0; i < Points1->n_points; i += Points1->n_points - 1) {
@@ -110,8 +120,9 @@
 	     * merge lines only if two lines found in the region
 	     * i.e. the current line and an adjacent line
 	     */
-	    if (1 < Vect_select_lines_by_polygon(Map, Points2, 0, NULL,
-						 GV_LINES, List_in_box)) {
+	    if (0 < Vect_find_line_list(Map, Points1->x[i], Points1->y[i],
+	                                Points1->z[i], GV_LINES, 0, 0,
+					NULL, List_in_box)) {
 		do_merge = 1;
 		line2 = -1;
 		for (j = 0; do_merge && j < List->n_values; j++) {



More information about the grass-commit mailing list