|
@@ -1,20 +1,20 @@
|
|
|
|
|
|
/****************************************************************************
|
|
|
-*
|
|
|
-* MODULE: r3.to.rast
|
|
|
-*
|
|
|
-* AUTHOR(S): Original author
|
|
|
-* Soeren Gebbert soerengebbert@gmx.de
|
|
|
-* 08 01 2005 Berlin
|
|
|
-* PURPOSE: Converts 3D raster maps to 2D raster maps
|
|
|
-*
|
|
|
-* COPYRIGHT: (C) 2005 by the GRASS Development Team
|
|
|
-*
|
|
|
-* This program is free software under the GNU General Public
|
|
|
-* License (>=v2). Read the file COPYING that comes with GRASS
|
|
|
-* for details.
|
|
|
-*
|
|
|
-*****************************************************************************/
|
|
|
+ *
|
|
|
+ * MODULE: r3.to.rast
|
|
|
+ *
|
|
|
+ * AUTHOR(S): Original author
|
|
|
+ * Soeren Gebbert soerengebbert@gmx.de
|
|
|
+ * 08 01 2005 Berlin
|
|
|
+ * PURPOSE: Converts 3D raster maps to 2D raster maps
|
|
|
+ *
|
|
|
+ * COPYRIGHT: (C) 2005 by the GRASS Development Team
|
|
|
+ *
|
|
|
+ * This program is free software under the GNU General Public
|
|
|
+ * License (>=v2). Read the file COPYING that comes with GRASS
|
|
|
+ * for details.
|
|
|
+ *
|
|
|
+ *****************************************************************************/
|
|
|
#include <stdio.h>
|
|
|
#include <stdlib.h>
|
|
|
#include <string.h>
|
|
@@ -23,28 +23,27 @@
|
|
|
#include <grass/G3d.h>
|
|
|
#include <grass/glocale.h>
|
|
|
|
|
|
-
|
|
|
/*- Parameters and global variables -----------------------------------------*/
|
|
|
-typedef struct
|
|
|
-{
|
|
|
+typedef struct {
|
|
|
struct Option *input, *output;
|
|
|
struct Flag *mask;
|
|
|
- struct Flag *res; /*If set, use the same resolution as the input map */
|
|
|
+ struct Flag *res; /*If set, use the same resolution as the input map */
|
|
|
} paramType;
|
|
|
|
|
|
-paramType param; /*Parameters */
|
|
|
+paramType param; /*Parameters */
|
|
|
|
|
|
/*- prototypes --------------------------------------------------------------*/
|
|
|
-void fatal_error(void *map, int *fd, int depths, char *errorMsg); /*Simple Error message */
|
|
|
-void set_params(); /*Fill the paramType structure */
|
|
|
-void g3d_to_raster(void *map, G3D_Region region, int *fd); /*Write the raster */
|
|
|
-int open_output_map(const char *name, int res_type); /*opens the outputmap */
|
|
|
-void close_output_map(int fd); /*close the map */
|
|
|
+void fatal_error(void *map, int *fd, int depths, char *errorMsg); /*Simple Error message */
|
|
|
+void set_params(); /*Fill the paramType structure */
|
|
|
+void g3d_to_raster(void *map, G3D_Region region, int *fd); /*Write the raster */
|
|
|
+int open_output_map(const char *name, int res_type); /*opens the outputmap */
|
|
|
+void close_output_map(int fd); /*close the map */
|
|
|
|
|
|
|
|
|
|
|
|
/* ************************************************************************* */
|
|
|
/* Error handling ********************************************************** */
|
|
|
+
|
|
|
/* ************************************************************************* */
|
|
|
void fatal_error(void *map, int *fd, int depths, char *errorMsg)
|
|
|
{
|
|
@@ -52,13 +51,13 @@ void fatal_error(void *map, int *fd, int depths, char *errorMsg)
|
|
|
|
|
|
/* Close files and exit */
|
|
|
if (map != NULL) {
|
|
|
- if (!G3d_closeCell(map))
|
|
|
- G3d_fatalError(_("Unable to close the 3d raster map"));
|
|
|
+ if (!G3d_closeCell(map))
|
|
|
+ G3d_fatalError(_("Unable to close the 3d raster map"));
|
|
|
}
|
|
|
|
|
|
if (fd != NULL) {
|
|
|
- for (i = 0; i < depths; i++)
|
|
|
- Rast_unopen(fd[i]);
|
|
|
+ for (i = 0; i < depths; i++)
|
|
|
+ Rast_unopen(fd[i]);
|
|
|
}
|
|
|
|
|
|
G3d_fatalError(errorMsg);
|
|
@@ -68,6 +67,7 @@ void fatal_error(void *map, int *fd, int depths, char *errorMsg)
|
|
|
|
|
|
/* ************************************************************************* */
|
|
|
/* Set up the arguments we are expecting ********************************** */
|
|
|
+
|
|
|
/* ************************************************************************* */
|
|
|
void set_params()
|
|
|
{
|
|
@@ -77,7 +77,7 @@ void set_params()
|
|
|
param.input->required = YES;
|
|
|
param.input->gisprompt = "old,grid3,3d-raster";
|
|
|
param.input->description =
|
|
|
- _("3d raster map(s) to be converted to 2D raster slices");
|
|
|
+ _("3d raster map(s) to be converted to 2D raster slices");
|
|
|
|
|
|
param.output = G_define_option();
|
|
|
param.output->key = "output";
|
|
@@ -93,12 +93,13 @@ void set_params()
|
|
|
param.res = G_define_flag();
|
|
|
param.res->key = 'r';
|
|
|
param.res->description =
|
|
|
- _("Use the same resolution as the input G3D map for the 2d output "
|
|
|
- "maps, independent of the current region settings");
|
|
|
+ _("Use the same resolution as the input G3D map for the 2d output "
|
|
|
+ "maps, independent of the current region settings");
|
|
|
}
|
|
|
|
|
|
/* ************************************************************************* */
|
|
|
/* Write the slices to seperate raster maps ******************************** */
|
|
|
+
|
|
|
/* ************************************************************************* */
|
|
|
void g3d_to_raster(void *map, G3D_Region region, int *fd)
|
|
|
{
|
|
@@ -114,62 +115,62 @@ void g3d_to_raster(void *map, G3D_Region region, int *fd)
|
|
|
|
|
|
|
|
|
G_debug(2, "g3d_to_raster: Writing %i raster maps with %i rows %i cols.",
|
|
|
- depths, rows, cols);
|
|
|
+ depths, rows, cols);
|
|
|
|
|
|
typeIntern = G3d_tileTypeMap(map);
|
|
|
|
|
|
if (typeIntern == FCELL_TYPE)
|
|
|
- fcell = Rast_allocate_f_buf();
|
|
|
+ fcell = Rast_allocate_f_buf();
|
|
|
else if (typeIntern == DCELL_TYPE)
|
|
|
- dcell = Rast_allocate_d_buf();
|
|
|
+ dcell = Rast_allocate_d_buf();
|
|
|
|
|
|
pos = 0;
|
|
|
/*Every Rastermap */
|
|
|
- for (z = 0; z < depths; z++) { /*From the bottom to the top */
|
|
|
- G_debug(2, "Writing raster map %d of %d", z + 1, depths);
|
|
|
- for (y = 0; y < rows; y++) {
|
|
|
- G_percent(y, rows - 1, 10);
|
|
|
-
|
|
|
- for (x = 0; x < cols; x++) {
|
|
|
- /* Because we write raster rows from north to south, but the coordinate system
|
|
|
- of the g3d cube read from south to north we need to adjust the
|
|
|
- Cube coordinates row = rows - y - 1.
|
|
|
- */
|
|
|
- if (typeIntern == FCELL_TYPE) {
|
|
|
- G3d_getValue(map, x, rows - y - 1, z, &f1, typeIntern);
|
|
|
- if (G3d_isNullValueNum(&f1, FCELL_TYPE))
|
|
|
- Rast_set_null_value(&fcell[x], 1, FCELL_TYPE);
|
|
|
- else
|
|
|
- fcell[x] = (FCELL) f1;
|
|
|
- }
|
|
|
- else {
|
|
|
- G3d_getValue(map, x, rows - y - 1, z, &d1, typeIntern);
|
|
|
- if (G3d_isNullValueNum(&d1, DCELL_TYPE))
|
|
|
- Rast_set_null_value(&dcell[x], 1, DCELL_TYPE);
|
|
|
- else
|
|
|
- dcell[x] = (DCELL) d1;
|
|
|
- }
|
|
|
- }
|
|
|
- if (typeIntern == FCELL_TYPE)
|
|
|
- Rast_put_f_row(fd[pos], fcell);
|
|
|
-
|
|
|
- if (typeIntern == DCELL_TYPE)
|
|
|
- Rast_put_d_row(fd[pos], dcell);
|
|
|
- }
|
|
|
- G_debug(2, "Finished writing map %d.", z + 1);
|
|
|
- pos++;
|
|
|
+ for (z = 0; z < depths; z++) { /*From the bottom to the top */
|
|
|
+ G_debug(2, "Writing raster map %d of %d", z + 1, depths);
|
|
|
+ for (y = 0; y < rows; y++) {
|
|
|
+ G_percent(y, rows - 1, 10);
|
|
|
+
|
|
|
+ for (x = 0; x < cols; x++) {
|
|
|
+ /* Because we write raster rows from north to south, but the coordinate system
|
|
|
+ of the g3d cube read from south to north we need to adjust the
|
|
|
+ Cube coordinates row = rows - y - 1.
|
|
|
+ */
|
|
|
+ if (typeIntern == FCELL_TYPE) {
|
|
|
+ G3d_getValue(map, x, rows - y - 1, z, &f1, typeIntern);
|
|
|
+ if (G3d_isNullValueNum(&f1, FCELL_TYPE))
|
|
|
+ Rast_set_null_value(&fcell[x], 1, FCELL_TYPE);
|
|
|
+ else
|
|
|
+ fcell[x] = (FCELL) f1;
|
|
|
+ } else {
|
|
|
+ G3d_getValue(map, x, rows - y - 1, z, &d1, typeIntern);
|
|
|
+ if (G3d_isNullValueNum(&d1, DCELL_TYPE))
|
|
|
+ Rast_set_null_value(&dcell[x], 1, DCELL_TYPE);
|
|
|
+ else
|
|
|
+ dcell[x] = (DCELL) d1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (typeIntern == FCELL_TYPE)
|
|
|
+ Rast_put_f_row(fd[pos], fcell);
|
|
|
+
|
|
|
+ if (typeIntern == DCELL_TYPE)
|
|
|
+ Rast_put_d_row(fd[pos], dcell);
|
|
|
+ }
|
|
|
+ G_debug(2, "Finished writing map %d.", z + 1);
|
|
|
+ pos++;
|
|
|
}
|
|
|
|
|
|
|
|
|
if (dcell)
|
|
|
- G_free(dcell);
|
|
|
+ G_free(dcell);
|
|
|
if (fcell)
|
|
|
- G_free(fcell);
|
|
|
+ G_free(fcell);
|
|
|
|
|
|
}
|
|
|
|
|
|
/* ************************************************************************* */
|
|
|
/* Open the raster output map ********************************************** */
|
|
|
+
|
|
|
/* ************************************************************************* */
|
|
|
int open_output_map(const char *name, int res_type)
|
|
|
{
|
|
@@ -178,6 +179,7 @@ int open_output_map(const char *name, int res_type)
|
|
|
|
|
|
/* ************************************************************************* */
|
|
|
/* Close the raster output map ********************************************* */
|
|
|
+
|
|
|
/* ************************************************************************* */
|
|
|
void close_output_map(int fd)
|
|
|
{
|
|
@@ -186,6 +188,7 @@ void close_output_map(int fd)
|
|
|
|
|
|
/* ************************************************************************* */
|
|
|
/* Main function, open the G3D map and create the raster maps ************** */
|
|
|
+
|
|
|
/* ************************************************************************* */
|
|
|
int main(int argc, char *argv[])
|
|
|
{
|
|
@@ -193,7 +196,7 @@ int main(int argc, char *argv[])
|
|
|
struct Cell_head region2d;
|
|
|
struct GModule *module;
|
|
|
struct History history;
|
|
|
- void *map = NULL; /*The 3D Rastermap */
|
|
|
+ void *map = NULL; /*The 3D Rastermap */
|
|
|
int i = 0, changemask = 0;
|
|
|
int *fd = NULL, output_type, cols, rows;
|
|
|
char *RasterFileName;
|
|
@@ -212,13 +215,13 @@ int main(int argc, char *argv[])
|
|
|
|
|
|
/* Have GRASS get inputs */
|
|
|
if (G_parser(argc, argv))
|
|
|
- exit(EXIT_FAILURE);
|
|
|
+ exit(EXIT_FAILURE);
|
|
|
|
|
|
G_debug(3, _("Open 3d raster map <%s>"), param.input->answer);
|
|
|
|
|
|
if (NULL == G_find_grid3(param.input->answer, ""))
|
|
|
- G3d_fatalError(_("3d raster map <%s> not found"),
|
|
|
- param.input->answer);
|
|
|
+ G3d_fatalError(_("3d raster map <%s> not found"),
|
|
|
+ param.input->answer);
|
|
|
|
|
|
/*Set the defaults */
|
|
|
G3d_initDefaults();
|
|
@@ -226,55 +229,57 @@ int main(int argc, char *argv[])
|
|
|
/*Set the resolution of the output maps */
|
|
|
if (param.res->answer) {
|
|
|
|
|
|
- /*Open the map with current region */
|
|
|
- map = G3d_openCellOld(param.input->answer,
|
|
|
- G_find_grid3(param.input->answer, ""),
|
|
|
- G3D_DEFAULT_WINDOW, G3D_TILE_SAME_AS_FILE,
|
|
|
- G3D_USE_CACHE_DEFAULT);
|
|
|
- if (map == NULL)
|
|
|
- G3d_fatalError(_("Error opening 3d raster map <%s>"),
|
|
|
- param.input->answer);
|
|
|
-
|
|
|
-
|
|
|
- /*Get the region of the map */
|
|
|
- G3d_getRegionStructMap(map, ®ion);
|
|
|
- /*set this region as current 3d window for map */
|
|
|
- G3d_setWindowMap(map, ®ion);
|
|
|
- /*Set the 2d region appropriate */
|
|
|
- G3d_extract2dRegion(®ion, ®ion2d);
|
|
|
- /*Make the new 2d region the default */
|
|
|
- Rast_set_window(®ion2d);
|
|
|
-
|
|
|
+ /*Open the map with current region */
|
|
|
+ map = G3d_openCellOld(param.input->answer,
|
|
|
+ G_find_grid3(param.input->answer, ""),
|
|
|
+ G3D_DEFAULT_WINDOW, G3D_TILE_SAME_AS_FILE,
|
|
|
+ G3D_USE_CACHE_DEFAULT);
|
|
|
+ if (map == NULL)
|
|
|
+ G3d_fatalError(_("Error opening 3d raster map <%s>"),
|
|
|
+ param.input->answer);
|
|
|
+
|
|
|
+
|
|
|
+ /*Get the region of the map */
|
|
|
+ G3d_getRegionStructMap(map, ®ion);
|
|
|
+ /*set this region as current 3d window for map */
|
|
|
+ G3d_setWindowMap(map, ®ion);
|
|
|
+ /*Set the 2d region appropriate */
|
|
|
+ G3d_extract2dRegion(®ion, ®ion2d);
|
|
|
+ /*Make the new 2d region the default */
|
|
|
+ Rast_set_window(®ion2d);
|
|
|
+
|
|
|
+ } else {
|
|
|
+ /* Figure out the region from the map */
|
|
|
+ G3d_getWindow(®ion);
|
|
|
+
|
|
|
+ /*Open the 3d raster map */
|
|
|
+ map = G3d_openCellOld(param.input->answer,
|
|
|
+ G_find_grid3(param.input->answer, ""),
|
|
|
+ ®ion, G3D_TILE_SAME_AS_FILE,
|
|
|
+ G3D_USE_CACHE_DEFAULT);
|
|
|
+
|
|
|
+ if (map == NULL)
|
|
|
+ G3d_fatalError(_("Error opening 3d raster map <%s>"),
|
|
|
+ param.input->answer);
|
|
|
}
|
|
|
- else {
|
|
|
- /* Figure out the region from the map */
|
|
|
- G3d_getWindow(®ion);
|
|
|
-
|
|
|
- /*Check if the g3d-region is equal to the 2d rows and cols */
|
|
|
- rows = Rast_window_rows();
|
|
|
- cols = Rast_window_cols();
|
|
|
-
|
|
|
- /*If not equal, set the 3D window correct */
|
|
|
- if (rows != region.rows || cols != region.cols) {
|
|
|
- G_message(_("The 2d and 3d region settings are different. "
|
|
|
- "Using the 2D window settings to adjust the 2D part of the 3D region."));
|
|
|
- G_get_set_window(®ion2d);
|
|
|
- region.ns_res = region2d.ns_res;
|
|
|
- region.ew_res = region2d.ew_res;
|
|
|
- region.rows = region2d.rows;
|
|
|
- region.cols = region2d.cols;
|
|
|
- G3d_setWindow(®ion);
|
|
|
- }
|
|
|
-
|
|
|
- /*Open the 3d raster map */
|
|
|
- map = G3d_openCellOld(param.input->answer,
|
|
|
- G_find_grid3(param.input->answer, ""),
|
|
|
- ®ion, G3D_TILE_SAME_AS_FILE,
|
|
|
- G3D_USE_CACHE_DEFAULT);
|
|
|
-
|
|
|
- if (map == NULL)
|
|
|
- G3d_fatalError(_("Error opening 3d raster map <%s>"),
|
|
|
- param.input->answer);
|
|
|
+
|
|
|
+ /*Check if the g3d-region is equal to the 2d rows and cols */
|
|
|
+ rows = Rast_window_rows();
|
|
|
+ cols = Rast_window_cols();
|
|
|
+
|
|
|
+ /*If not equal, set the 3D window correct */
|
|
|
+ if (rows != region.rows || cols != region.cols) {
|
|
|
+ G_message(_("The 2d and 3d region settings are different. "
|
|
|
+ "Using the 2D window settings to adjust the 2D part of the 3D region."));
|
|
|
+ G_get_set_window(®ion2d);
|
|
|
+ region.ns_res = region2d.ns_res;
|
|
|
+ region.ew_res = region2d.ew_res;
|
|
|
+ region.rows = region2d.rows;
|
|
|
+ region.cols = region2d.cols;
|
|
|
+
|
|
|
+ G3d_adjustRegion(®ion);
|
|
|
+
|
|
|
+ G3d_setWindowMap(map, ®ion);
|
|
|
}
|
|
|
|
|
|
/* save the input map region for later use (history meta-data) */
|
|
@@ -285,39 +290,39 @@ int main(int argc, char *argv[])
|
|
|
|
|
|
|
|
|
/*prepare the filehandler */
|
|
|
- fd = (int *)G_malloc(region.depths * sizeof(int));
|
|
|
+ fd = (int *) G_malloc(region.depths * sizeof (int));
|
|
|
|
|
|
if (fd == NULL)
|
|
|
- fatal_error(map, NULL, 0, _("Out of memory"));
|
|
|
+ fatal_error(map, NULL, 0, _("Out of memory"));
|
|
|
|
|
|
G_message(_("Creating %i raster maps"), region.depths);
|
|
|
|
|
|
/*Loop over all output maps! open */
|
|
|
for (i = 0; i < region.depths; i++) {
|
|
|
- /*Create the outputmaps */
|
|
|
- G_asprintf(&RasterFileName, "%s_%05d", param.output->answer, i + 1);
|
|
|
- G_message(_("Raster map %i Filename: %s"), i + 1, RasterFileName);
|
|
|
+ /*Create the outputmaps */
|
|
|
+ G_asprintf(&RasterFileName, "%s_%05d", param.output->answer, i + 1);
|
|
|
+ G_message(_("Raster map %i Filename: %s"), i + 1, RasterFileName);
|
|
|
|
|
|
- if (G_find_raster2(RasterFileName, ""))
|
|
|
- G_message(_("Raster map %d Filename: %s already exists. Will be overwritten!"),
|
|
|
- i + 1, RasterFileName);
|
|
|
+ if (G_find_raster2(RasterFileName, ""))
|
|
|
+ G_message(_("Raster map %d Filename: %s already exists. Will be overwritten!"),
|
|
|
+ i + 1, RasterFileName);
|
|
|
|
|
|
- if (output_type == FCELL_TYPE)
|
|
|
- fd[i] = open_output_map(RasterFileName, FCELL_TYPE);
|
|
|
- else if (output_type == DCELL_TYPE)
|
|
|
- fd[i] = open_output_map(RasterFileName, DCELL_TYPE);
|
|
|
+ if (output_type == FCELL_TYPE)
|
|
|
+ fd[i] = open_output_map(RasterFileName, FCELL_TYPE);
|
|
|
+ else if (output_type == DCELL_TYPE)
|
|
|
+ fd[i] = open_output_map(RasterFileName, DCELL_TYPE);
|
|
|
|
|
|
}
|
|
|
|
|
|
/*if requested set the Mask on */
|
|
|
if (param.mask->answer) {
|
|
|
- if (G3d_maskFileExists()) {
|
|
|
- changemask = 0;
|
|
|
- if (G3d_maskIsOff(map)) {
|
|
|
- G3d_maskOn(map);
|
|
|
- changemask = 1;
|
|
|
- }
|
|
|
- }
|
|
|
+ if (G3d_maskFileExists()) {
|
|
|
+ changemask = 0;
|
|
|
+ if (G3d_maskIsOff(map)) {
|
|
|
+ G3d_maskOn(map);
|
|
|
+ changemask = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/*Create the Rastermaps */
|
|
@@ -326,55 +331,55 @@ int main(int argc, char *argv[])
|
|
|
|
|
|
/*Loop over all output maps! close */
|
|
|
for (i = 0; i < region.depths; i++) {
|
|
|
- close_output_map(fd[i]);
|
|
|
-
|
|
|
- /* write history */
|
|
|
- G_asprintf(&RasterFileName, "%s_%i", param.output->answer, i + 1);
|
|
|
- G_debug(4, "Raster map %d Filename: %s", i + 1, RasterFileName);
|
|
|
- Rast_short_history(RasterFileName, "raster", &history);
|
|
|
-
|
|
|
- Rast_set_history(&history, HIST_DATSRC_1, "3D Raster map:");
|
|
|
- Rast_set_history(&history, HIST_DATSRC_2, param.input->answer);
|
|
|
-
|
|
|
- Rast_append_format_history(&history, "Level %d of %d", i + 1, region.depths);
|
|
|
- Rast_append_format_history(&history, "Level z-range: %f to %f",
|
|
|
- region.bottom + (i * region.tb_res),
|
|
|
- region.bottom + (i + 1 * region.tb_res));
|
|
|
-
|
|
|
- Rast_append_format_history(&history, "Input map full z-range: %f to %f",
|
|
|
- inputmap_bounds.bottom, inputmap_bounds.top);
|
|
|
- Rast_append_format_history(&history, "Input map z-resolution: %f",
|
|
|
- inputmap_bounds.tb_res);
|
|
|
-
|
|
|
- if (!param.res->answer) {
|
|
|
- Rast_append_format_history(&history, "GIS region full z-range: %f to %f",
|
|
|
- region.bottom, region.top);
|
|
|
- Rast_append_format_history(&history, "GIS region z-resolution: %f",
|
|
|
- region.tb_res);
|
|
|
- }
|
|
|
-
|
|
|
- Rast_command_history(&history);
|
|
|
- Rast_write_history(RasterFileName, &history);
|
|
|
+ close_output_map(fd[i]);
|
|
|
+
|
|
|
+ /* write history */
|
|
|
+ G_asprintf(&RasterFileName, "%s_%i", param.output->answer, i + 1);
|
|
|
+ G_debug(4, "Raster map %d Filename: %s", i + 1, RasterFileName);
|
|
|
+ Rast_short_history(RasterFileName, "raster", &history);
|
|
|
+
|
|
|
+ Rast_set_history(&history, HIST_DATSRC_1, "3D Raster map:");
|
|
|
+ Rast_set_history(&history, HIST_DATSRC_2, param.input->answer);
|
|
|
+
|
|
|
+ Rast_append_format_history(&history, "Level %d of %d", i + 1, region.depths);
|
|
|
+ Rast_append_format_history(&history, "Level z-range: %f to %f",
|
|
|
+ region.bottom + (i * region.tb_res),
|
|
|
+ region.bottom + (i + 1 * region.tb_res));
|
|
|
+
|
|
|
+ Rast_append_format_history(&history, "Input map full z-range: %f to %f",
|
|
|
+ inputmap_bounds.bottom, inputmap_bounds.top);
|
|
|
+ Rast_append_format_history(&history, "Input map z-resolution: %f",
|
|
|
+ inputmap_bounds.tb_res);
|
|
|
+
|
|
|
+ if (!param.res->answer) {
|
|
|
+ Rast_append_format_history(&history, "GIS region full z-range: %f to %f",
|
|
|
+ region.bottom, region.top);
|
|
|
+ Rast_append_format_history(&history, "GIS region z-resolution: %f",
|
|
|
+ region.tb_res);
|
|
|
+ }
|
|
|
+
|
|
|
+ Rast_command_history(&history);
|
|
|
+ Rast_write_history(RasterFileName, &history);
|
|
|
}
|
|
|
|
|
|
/*We set the Mask off, if it was off before */
|
|
|
if (param.mask->answer) {
|
|
|
- if (G3d_maskFileExists())
|
|
|
- if (G3d_maskIsOn(map) && changemask)
|
|
|
- G3d_maskOff(map);
|
|
|
+ if (G3d_maskFileExists())
|
|
|
+ if (G3d_maskIsOn(map) && changemask)
|
|
|
+ G3d_maskOff(map);
|
|
|
}
|
|
|
|
|
|
|
|
|
/*Cleaning */
|
|
|
if (RasterFileName)
|
|
|
- G_free(RasterFileName);
|
|
|
+ G_free(RasterFileName);
|
|
|
|
|
|
if (fd)
|
|
|
- G_free(fd);
|
|
|
+ G_free(fd);
|
|
|
|
|
|
/* Close files and exit */
|
|
|
if (!G3d_closeCell(map))
|
|
|
- fatal_error(map, NULL, 0, _("Error closing 3d raster map"));
|
|
|
+ fatal_error(map, NULL, 0, _("Error closing 3d raster map"));
|
|
|
|
|
|
map = NULL;
|
|
|
|