[GRASS-SVN] r69542 - grass-addons/grass7/raster/r.stream.order

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Sep 21 02:02:50 PDT 2016


Author: mmetz
Date: 2016-09-21 02:02:49 -0700 (Wed, 21 Sep 2016)
New Revision: 69542

Modified:
   grass-addons/grass7/raster/r.stream.order/stream_vector.c
Log:
r.stream.order: fix outlet

Modified: grass-addons/grass7/raster/r.stream.order/stream_vector.c
===================================================================
--- grass-addons/grass7/raster/r.stream.order/stream_vector.c	2016-09-20 14:54:38 UTC (rev 69541)
+++ grass-addons/grass7/raster/r.stream.order/stream_vector.c	2016-09-21 09:02:49 UTC (rev 69542)
@@ -46,14 +46,15 @@
 	    next_r = NR(d);
 	    next_c = NC(d);
 
+	    if (d < 1 || NOT_IN_REGION(d) || !streams[next_r][next_c]) {
+		add_outlet = 1;
+		break;
+	    }
+
 	    easting = window.west + (next_c + .5) * window.ew_res;
 	    northing = window.north - (next_r + .5) * window.ns_res;
 	    Vect_append_point(Segments, easting, northing, 0);
 
-	    if (d < 1 || NOT_IN_REGION(d) || !streams[next_r][next_c]) {
-		add_outlet = 1;
-		break;
-	    }
 	    r = next_r;
 	    c = next_c;
 	}			/* end while */
@@ -132,10 +133,6 @@
 	    next_r = NR(d);
 	    next_c = NC(d);
 
-	    easting = window.west + (next_c + .5) * window.ew_res;
-	    northing = window.north - (next_r + .5) * window.ns_res;
-	    Vect_append_point(Segments, easting, northing, 0);
-
 	    if (NOT_IN_REGION(d))
 		Rast_set_c_null_value(&next_stream, 1);
 	    else
@@ -145,6 +142,11 @@
 		add_outlet = 1;
 		break;
 	    }
+
+	    easting = window.west + (next_c + .5) * window.ew_res;
+	    northing = window.north - (next_r + .5) * window.ns_res;
+	    Vect_append_point(Segments, easting, northing, 0);
+
 	    r = next_r;
 	    c = next_c;
 	    Segment_get(streams, &streams_cell, r, c);



More information about the grass-commit mailing list