[GRASS-SVN] r65174 - grass/branches/releasebranch_6_4/raster/r.carve
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat May 2 14:19:02 PDT 2015
Author: hcho
Date: 2015-05-02 14:19:02 -0700 (Sat, 02 May 2015)
New Revision: 65174
Modified:
grass/branches/releasebranch_6_4/raster/r.carve/enforce_ds.c
Log:
r.carve: Backport r65165, r65165, r65166
Modified: grass/branches/releasebranch_6_4/raster/r.carve/enforce_ds.c
===================================================================
--- grass/branches/releasebranch_6_4/raster/r.carve/enforce_ds.c 2015-05-01 10:27:34 UTC (rev 65173)
+++ grass/branches/releasebranch_6_4/raster/r.carve/enforce_ds.c 2015-05-02 21:19:02 UTC (rev 65174)
@@ -468,6 +468,8 @@
cy = G_row_to_northing(r + 0.5, &wind);
for (c = col1; c < col2; c++) {
+ double distance;
+
cellx = G_col_to_easting(c + 0.5, &wind);
celly = cy; /* gets written over in distance2... */
@@ -478,38 +480,36 @@
* Here we use a bitmap and only change cells once
* on the way down */
- if (dig_distance2_point_to_line(cellx, celly, 0,
+ distance = sqrt(dig_distance2_point_to_line(cellx, celly, 0,
pgxypts[i - 1][0],
pgxypts[i - 1][1], 0,
pgxypts[i][0], pgxypts[i][1],
0, 0, &cellx, &celly, NULL,
- NULL, NULL)) {
- if (!BM_get(bm, c, r)) {
- double dist, elev;
+ NULL, NULL));
- Vect_reset_line(points);
+ if (distance <= parm->swidth && !BM_get(bm, c, r)) {
+ double dist, elev;
- dist = G_distance(pgxypts[i][0], pgxypts[i][1],
- cellx, celly);
+ Vect_reset_line(points);
- elev = LINTERP(pgpts[i][1], pgpts[i - 1][1],
- (dist /
- (pgpts[i][0] - pgpts[i - 1][0])));
+ dist = G_distance(pgxypts[i][0], pgxypts[i][1],
+ cellx, celly);
- BM_set(bm, c, r, 1);
+ elev = LINTERP(pgpts[i][1], pgpts[i - 1][1],
+ (dist / (pgpts[i][0] - pgpts[i - 1][0])));
- /* TODO - may want to use a function for the
- * cross section of stream */
- set_min_point(rbuf, c, r, elev, parm->sdepth,
- parm->raster_type);
+ BM_set(bm, c, r, 1);
- /* Add point to output vector map */
- if (parm->outvect->answer) {
- Vect_append_point(points, pgxypts[i][0],
- pgxypts[i][1],
- elev - parm->sdepth);
- Vect_write_line(outMap, GV_POINT, points, cats);
- }
+ /* TODO - may want to use a function for the
+ * cross section of stream */
+ set_min_point(rbuf, c, r, elev, parm->sdepth,
+ parm->raster_type);
+
+ /* Add point to output vector map */
+ if (parm->outvect->answer) {
+ Vect_append_point(points, cellx, celly,
+ elev - parm->sdepth);
+ Vect_write_line(outMap, GV_POINT, points, cats);
}
}
}
More information about the grass-commit
mailing list