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

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Oct 31 13:02:44 PDT 2012


Author: mmetz
Date: 2012-10-31 13:02:43 -0700 (Wed, 31 Oct 2012)
New Revision: 53628

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

Modified: grass/trunk/lib/vector/Vlib/remove_duplicates.c
===================================================================
--- grass/trunk/lib/vector/Vlib/remove_duplicates.c	2012-10-31 19:55:18 UTC (rev 53627)
+++ grass/trunk/lib/vector/Vlib/remove_duplicates.c	2012-10-31 20:02:43 UTC (rev 53628)
@@ -36,7 +36,7 @@
     struct line_pnts *APoints, *BPoints;
     struct line_cats *ACats, *BCats;
     int i, j, c, atype, btype, bline;
-    int nlines, nbcats_orig;
+    int nlines, nbcats_orig, npoints;
     struct bound_box ABox;
     struct boxlist *List;
     int ndupl;
@@ -66,6 +66,15 @@
 	atype = Vect_read_line(Map, APoints, ACats, i);
 	if (!(atype & type))
 	    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);
@@ -78,6 +87,7 @@
 		continue;
 
 	    btype = Vect_read_line(Map, BPoints, BCats, bline);
+	    Vect_line_prune(BPoints);
 
 	    /* check for duplicates */
 	    if (!Vect_line_check_duplicate(APoints, BPoints, Vect_is_3d(Map)))
@@ -114,6 +124,9 @@
 
 /*!
    \brief Check for duplicate lines
+   
+   Note that lines must be pruned with Vect_line_prune() before passed 
+   to Vect_line_check_duplicate()
 
    \param APoints first line geometry
    \param BPoints second line geometry



More information about the grass-commit mailing list