[GRASS-SVN] r70679 - grass/branches/releasebranch_7_0/lib/vector/Vlib

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Feb 26 05:25:38 PST 2017


Author: mmetz
Date: 2017-02-26 05:25:38 -0800 (Sun, 26 Feb 2017)
New Revision: 70679

Modified:
   grass/branches/releasebranch_7_0/lib/vector/Vlib/net.c
Log:
vectorlib, network analysis: fix shortcut, prune path (backport from trunk r70677)

Modified: grass/branches/releasebranch_7_0/lib/vector/Vlib/net.c
===================================================================
--- grass/branches/releasebranch_7_0/lib/vector/Vlib/net.c	2017-02-26 13:24:48 UTC (rev 70678)
+++ grass/branches/releasebranch_7_0/lib/vector/Vlib/net.c	2017-02-26 13:25:38 UTC (rev 70679)
@@ -1038,6 +1038,11 @@
 	Vect_reset_line(SPoints);
 	if (flen == tlen) {
 	    cur_cst = 0;
+
+	    Vect_append_point(SPoints, fx, fy, fz);
+	    Vect_append_point(SPoints, fcx, fcy, fcz);
+	    Vect_append_point(SPoints, tx, ty, tz);
+
 	    reachable = shortcut = 1;
 	}
 	else if (flen < tlen) {
@@ -1152,6 +1157,7 @@
 			Vect_append_points(Points, APoints, GV_FORWARD);
 		    else
 			Vect_append_points(Points, APoints, GV_BACKWARD);
+		    Points->n_points--;
 		}
                 if (NodesList) {
                     int node, node1, node2;
@@ -1170,8 +1176,11 @@
 		    Vect_list_append(List, line);
 	    }
 
-	    if (Points)
+	    if (Points) {
+		if (LList->n_values)
+		    Points->n_points++;
 		Vect_append_points(Points, tPoints[tn], GV_FORWARD);
+	    }
 
 	    if (TPoints)
 		Vect_append_points(TPoints, tPoints[tn], GV_FORWARD);
@@ -1185,6 +1194,8 @@
 
 	if (costs)
 	    *costs = cur_cst;
+	if (Points)
+	    Vect_line_prune(Points);
     }
 
     return reachable;



More information about the grass-commit mailing list