[GRASS-SVN] r71681 - grass/trunk/raster/r.viewshed
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Nov 12 03:02:39 PST 2017
Author: mmetz
Date: 2017-11-12 03:02:39 -0800 (Sun, 12 Nov 2017)
New Revision: 71681
Modified:
grass/trunk/raster/r.viewshed/grass.cpp
grass/trunk/raster/r.viewshed/grass.h
grass/trunk/raster/r.viewshed/visibility.cpp
Log:
r.viewshed: fix binary output for external memory mode (#1788)
Modified: grass/trunk/raster/r.viewshed/grass.cpp
===================================================================
--- grass/trunk/raster/r.viewshed/grass.cpp 2017-11-11 19:02:07 UTC (rev 71680)
+++ grass/trunk/raster/r.viewshed/grass.cpp 2017-11-12 11:02:39 UTC (rev 71681)
@@ -782,7 +782,6 @@
/* helper function to deal with GRASS writing to a row buffer */
void writeValue(void *bufrast, int j, double x, RASTER_MAP_TYPE data_type)
{
-
switch (data_type) {
case CELL_TYPE:
((CELL *) bufrast)[j] = (CELL) x;
@@ -824,7 +823,8 @@
void
save_io_visibilitygrid_to_GRASS(IOVisibilityGrid * visgrid,
char *fname, RASTER_MAP_TYPE type,
- float (*fun) (float))
+ float (*fun) (float),
+ OutputMode mode)
{
G_message(_("Saving grid to <%s>"), fname);
@@ -878,7 +878,10 @@
}
else {
/* this cell is not in stream, so it is invisible */
- writeNodataValue(visrast, j, type);
+ if (mode == OUTPUT_BOOL)
+ writeValue(visrast, j, BOOL_INVISIBLE, type);
+ else if (mode == OUTPUT_ANGLE)
+ writeNodataValue(visrast, j, type);
}
} /* for j */
Modified: grass/trunk/raster/r.viewshed/grass.h
===================================================================
--- grass/trunk/raster/r.viewshed/grass.h 2017-11-11 19:02:07 UTC (rev 71680)
+++ grass/trunk/raster/r.viewshed/grass.h 2017-11-12 11:02:39 UTC (rev 71681)
@@ -136,7 +136,8 @@
void
save_io_visibilitygrid_to_GRASS(IOVisibilityGrid * visgrid,
char *outfname, RASTER_MAP_TYPE type,
- float (*fun) (float));
+ float (*fun) (float),
+ OutputMode mode);
Modified: grass/trunk/raster/r.viewshed/visibility.cpp
===================================================================
--- grass/trunk/raster/r.viewshed/visibility.cpp 2017-11-11 19:02:07 UTC (rev 71680)
+++ grass/trunk/raster/r.viewshed/visibility.cpp 2017-11-12 11:02:39 UTC (rev 71681)
@@ -401,11 +401,13 @@
if (viewOptions.outputMode == OUTPUT_BOOL)
save_io_visibilitygrid_to_GRASS(visgrid, viewOptions.outputfname,
- CELL_TYPE, booleanVisibilityOutput);
+ CELL_TYPE, booleanVisibilityOutput,
+ OUTPUT_BOOL);
else if (viewOptions.outputMode == OUTPUT_ANGLE)
save_io_visibilitygrid_to_GRASS(visgrid, viewOptions.outputfname,
- FCELL_TYPE, angleVisibilityOutput);
+ FCELL_TYPE, angleVisibilityOutput,
+ OUTPUT_ANGLE);
else
/* elevation output */
save_io_vis_and_elev_to_GRASS(visgrid, viewOptions.inputfname,
More information about the grass-commit
mailing list