[GRASS-SVN] r54541 - in grass/trunk/raster: r.cost r.walk
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Jan 5 14:17:07 PST 2013
Author: martinl
Date: 2013-01-05 14:17:07 -0800 (Sat, 05 Jan 2013)
New Revision: 54541
Modified:
grass/trunk/raster/r.cost/main.c
grass/trunk/raster/r.walk/main.c
Log:
r.cost/r.walk: fix bug introduced in r54538
Modified: grass/trunk/raster/r.cost/main.c
===================================================================
--- grass/trunk/raster/r.cost/main.c 2013-01-05 21:58:40 UTC (rev 54540)
+++ grass/trunk/raster/r.cost/main.c 2013-01-05 22:17:07 UTC (rev 54541)
@@ -674,13 +674,15 @@
cellval = Rast_get_d_value(ptr2, data_type2);
if (start_with_raster_vals == 1) {
+ insert(cellval, row, col);
costs.cost_out = cellval;
costs.nearest = cellval;
segment_put(&cost_seg, &costs, row, col);
}
else {
value = &zero;
- costs.cost_out = *value;
+ insert(zero, row, col);
+ costs.cost_out = *value;
costs.nearest = cellval;
segment_put(&cost_seg, &costs, row, col);
}
@@ -710,6 +712,7 @@
if (top_start_pt->row < 0 || top_start_pt->row >= nrows
|| top_start_pt->col < 0 || top_start_pt->col >= ncols)
G_fatal_error(_("Specified starting location outside database window"));
+ insert(zero, top_start_pt->row, top_start_pt->col);
segment_get(&cost_seg, &costs, top_start_pt->row,
top_start_pt->col);
@@ -979,6 +982,7 @@
costs.cost_out = min_cost;
costs.nearest = nearest;
segment_put(&cost_seg, &costs, row, col);
+ insert(min_cost, row, col);
if (dir == TRUE) {
segment_put(&dir_seg, &cur_dir, row, col);
}
@@ -988,6 +992,7 @@
costs.cost_out = min_cost;
costs.nearest = nearest;
segment_put(&cost_seg, &costs, row, col);
+ insert(min_cost, row, col);
if (dir == TRUE) {
segment_put(&dir_seg, &cur_dir, row, col);
}
Modified: grass/trunk/raster/r.walk/main.c
===================================================================
--- grass/trunk/raster/r.walk/main.c 2013-01-05 21:58:40 UTC (rev 54540)
+++ grass/trunk/raster/r.walk/main.c 2013-01-05 22:17:07 UTC (rev 54541)
@@ -870,11 +870,13 @@
if (start_with_raster_vals == 1) {
cellval = Rast_get_d_value(ptr2, data_type2);
+ insert(cellval, row, col);
costs.cost_out = cellval;
segment_put(&cost_seg, &costs, row, col);
}
else {
value = &zero;
+ insert(zero, row, col);
costs.cost_out = *value;
segment_put(&cost_seg, &costs, row, col);
}
@@ -905,6 +907,7 @@
if (top_start_pt->row < 0 || top_start_pt->row >= nrows
|| top_start_pt->col < 0 || top_start_pt->col >= ncols)
G_fatal_error(_("Specified starting location outside database window"));
+ insert(zero, top_start_pt->row, top_start_pt->col);
segment_get(&cost_seg, &costs, top_start_pt->row,
top_start_pt->col);
costs.cost_out = *value;
@@ -1372,12 +1375,14 @@
if (Rast_is_d_null_value(&old_min_cost)) {
costs.cost_out = min_cost;
segment_put(&cost_seg, &costs, row, col);
+ insert(min_cost, row, col);
if (dir == 1)
segment_put(&dir_seg, &cur_dir, row, col);
}
else if (old_min_cost > min_cost) {
costs.cost_out = min_cost;
segment_put(&cost_seg, &costs, row, col);
+ insert(min_cost, row, col);
if (dir == 1)
segment_put(&dir_seg, &cur_dir, row, col);
}
More information about the grass-commit
mailing list