[GRASS-SVN] r53699 - grass/trunk/lib/vector/Vlib

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Nov 6 05:32:17 PST 2012


Author: mmetz
Date: 2012-11-06 05:32:16 -0800 (Tue, 06 Nov 2012)
New Revision: 53699

Modified:
   grass/trunk/lib/vector/Vlib/remove_duplicates.c
Log:
Vlib: improve Vect_remove_duplicates()

Modified: grass/trunk/lib/vector/Vlib/remove_duplicates.c
===================================================================
--- grass/trunk/lib/vector/Vlib/remove_duplicates.c	2012-11-06 13:16:48 UTC (rev 53698)
+++ grass/trunk/lib/vector/Vlib/remove_duplicates.c	2012-11-06 13:32:16 UTC (rev 53699)
@@ -76,6 +76,14 @@
 	    continue;
 	}
 
+	npoints = APoints->n_points;
+	Vect_line_prune(APoints);
+	if (npoints != APoints->n_points) {
+	    Vect_rewrite_line(Map, i, atype, APoints, ACats);
+	    nlines = Vect_get_num_lines(Map);
+	    continue;
+	}
+
 	Vect_line_box(APoints, &ABox);
 	Vect_select_lines_by_box(Map, &ABox, type, List);
 	G_debug(3, "  %d lines selected by box", List->n_values);
@@ -83,7 +91,9 @@
 	for (j = 0; j < List->n_values; j++) {
 	    bline = List->id[j];
 	    G_debug(3, "  j = %d bline = %d", j, bline);
-	    if (i == bline)
+
+	    /* check duplicate of bline only once */
+	    if (i <= bline)
 		continue;
 
 	    btype = Vect_read_line(Map, BPoints, BCats, bline);



More information about the grass-commit mailing list