[GRASS-SVN] r44853 - grass/branches/develbranch_6/lib/vector/Vlib

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jan 4 04:23:48 EST 2011


Author: mmetz
Date: 2011-01-04 01:23:48 -0800 (Tue, 04 Jan 2011)
New Revision: 44853

Modified:
   grass/branches/develbranch_6/lib/vector/Vlib/break_polygons.c
Log:
write out break points only once

Modified: grass/branches/develbranch_6/lib/vector/Vlib/break_polygons.c
===================================================================
--- grass/branches/develbranch_6/lib/vector/Vlib/break_polygons.c	2011-01-04 03:57:53 UTC (rev 44852)
+++ grass/branches/develbranch_6/lib/vector/Vlib/break_polygons.c	2011-01-04 09:23:48 UTC (rev 44853)
@@ -54,6 +54,9 @@
 {
     double a1, a2;		/* angles */
     char cross;			/* 0 - do not break, 1 - break */
+    char used;			/* 0 - was not used to break line, 1 - was used to break line
+				 *   this is stored because points are automaticaly marked as cross, even if not used 
+				 *   later to break lines */
 } XPNT;
 
 static int fpoint;
@@ -214,6 +217,7 @@
 			(XPNT *) G_realloc(XPnts,
 					   (apoints + 1) * sizeof(XPNT));
 		}
+		XPnts[npoints].used = 0;
 		if (j == 0 || j == (Points->n_points - 1) ||
 		    Points->n_points < 3) {
 		    XPnts[npoints].a1 = 0;
@@ -306,11 +310,12 @@
 
 		/* Write points on breaks */
 		if (Err) {
-		    if (j < (Points->n_points - 1)) {
+		    if (XPnts[fpoint].cross && !XPnts[fpoint].used) {
 			Vect_reset_line(BPoints);
 			Vect_append_point(BPoints, Points->x[j], Points->y[j], 0);
 			Vect_write_line(Err, GV_POINT, BPoints, ErrCats);
 		    }
+		    XPnts[fpoint].used = 1;
 		}
 
 		last = j;



More information about the grass-commit mailing list