[GRASS-SVN] r55791 - grass/trunk/lib/vector/Vlib
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Apr 14 04:22:54 PDT 2013
Author: mmetz
Date: 2013-04-14 04:22:54 -0700 (Sun, 14 Apr 2013)
New Revision: 55791
Modified:
grass/trunk/lib/vector/Vlib/break_lines.c
Log:
Vlib: Vect_break_lines() avoid bug in Vect_line_intersection()
Modified: grass/trunk/lib/vector/Vlib/break_lines.c
===================================================================
--- grass/trunk/lib/vector/Vlib/break_lines.c 2013-04-14 11:21:25 UTC (rev 55790)
+++ grass/trunk/lib/vector/Vlib/break_lines.c 2013-04-14 11:22:54 UTC (rev 55791)
@@ -284,11 +284,22 @@
Vect_select_lines_by_box(Map, &ABox, type, List);
G_debug(3, " %d lines selected by box", List->n_values);
- for (j = 0; j < List->n_values; j++) {
+ for (j = -1; j < List->n_values; j++) {
/* bline: line to break */
- bline = List->id[j];
+ if (j == -1) {
+ if (aline <= nlines_org)
+ bline = aline;
+ else
+ continue;
+ }
+ else {
+ bline = List->id[j];
+ if (bline == aline)
+ continue;
+ }
+
b_is_ref = 0;
break_b = 1;
if (List_ref &&
@@ -309,7 +320,10 @@
continue;
/* check intersection of aline with bline only once */
- if (break_a && break_b && aline < bline && (!List_ref || b_is_ref)) {
+ /* disable to debug the bug in Vect_line_intersection() */
+ if (break_a && break_b &&
+ aline > bline &&
+ (!List_ref || b_is_ref)) {
continue;
}
@@ -408,6 +422,10 @@
}
nx = 0; /* number of intersections to be written to Err */
if (naxlines > 0) { /* intersection -> write out */
+
+ G_debug(3, " aline = %d, bline = %d, naxlines = %d",
+ aline, bline, naxlines);
+
if (!check && break_a)
Vect_delete_line(Map, aline);
for (k = 0; k < naxlines; k++) {
@@ -428,6 +446,8 @@
}
}
}
+ else
+ G_debug(3, "axline %d has zero length", k);
/* Write intersection points */
if (Err) {
@@ -447,6 +467,10 @@
if (nbxlines > 0) {
if (aline != bline) { /* Self intersection, do not write twice, TODO: is it OK? */
+
+ G_debug(3, " aline = %d, bline = %d, nbxlines = %d",
+ aline, bline, nbxlines);
+
if (!check && break_b)
Vect_delete_line(Map, bline);
for (k = 0; k < nbxlines; k++) {
@@ -467,6 +491,8 @@
}
}
}
+ else
+ G_debug(3, "bxline %d has zero length", k);
/* Write intersection points */
if (Err) {
More information about the grass-commit
mailing list