14 int depths,
int xRedundant,
int yRedundant,
15 int zRedundant,
int nofNum,
int type)
18 struct FPRange *
range;
20 range = &(map->range);
23 if (nofNum == map->tileSize) {
29 for (z = 0; z < depths; z++) {
30 for (y = 0; y < rows; y++) {
37 map->tileX * yRedundant *
44 for (z = 0; z < depths; z++) {
57 G3d_readRange(
const char *
name,
const char *mapset,
struct FPRange *
drange)
62 char buf[GNAME_MAX +
sizeof(G3D_DIRECTORY) + 2],
63 buf2[GMAPSET_MAX +
sizeof(G3D_RANGE_ELEMENT) + 2];
73 sprintf(buf,
"%s/%s", G3D_DIRECTORY, xname);
77 sprintf(buf,
"%s/%s", G3D_DIRECTORY, name);
94 if (!xdr_double(&xdr_str, &dcell1) || !xdr_double(&xdr_str, &dcell2))
106 G_warning(
"can't read range file for [%s in %s]", name, mapset);
127 if (G3d_readRange(map->fileName, map->mapset, &(map->range)) == -1) {
156 static int writeRange(
const char *name,
struct FPRange *
range)
159 char xname[GNAME_MAX], xmapset[GMAPSET_MAX];
160 char buf[GNAME_MAX +
sizeof(G3D_DIRECTORY) + 2],
161 buf2[GMAPSET_MAX +
sizeof(G3D_RANGE_ELEMENT) + 2];
167 sprintf(buf,
"%s/%s", G3D_DIRECTORY, xname);
168 sprintf(
buf2,
"%s@%s", G3D_RANGE_ELEMENT, xmapset);
171 sprintf(buf,
"%s/%s", G3D_DIRECTORY, name);
179 if (range->first_time) {
188 if (!xdr_double(&xdr_str, &(range->min)))
190 if (!xdr_double(&xdr_str, &(range->max)))
199 sprintf(buf,
"can't write range file for [%s in %s]", name,
G_mapset());
220 char path[GPATH_MAX];
222 G3d_filename(path, G3D_RANGE_ELEMENT, map->fileName, map->mapset);
225 if (writeRange(map->fileName, &(map->range)) == -1) {
226 G3d_error(
"G3d_closeCellNew: error in writeRange");
char * G_mapset(void)
current mapset name
sprintf(buf2,"%s", G3D_CATS_ELEMENT)
int G3d_range_init(G3D_Map *map)
int G3d_g3dType2cellType(int g3dType)
void G3d_error(const char *msg,...)
int G3d_range_write(G3D_Map *map)
Writes the range which is stored in the range structure of map. (This function is invoked automatical...
void G3d_filename(char *path, const char *elementName, const char *mapName, const char *mapset)
def error
Display an error message using g.message -e
void * G_incr_void_ptr(const void *ptr, const size_t size)
Advance void pointer.
int G_row_update_fp_range(const void *rast, int n, struct FPRange *range, RASTER_MAP_TYPE data_type)
int G_update_fp_range(DCELL val, struct FPRange *range)
void G3d_range_min_max(G3D_Map *map, double *min, double *max)
Returns in min and max the minimum and maximum values of the range.
int G3d_range_load(G3D_Map *map)
Loads the range into the range structure of map.
int G_remove(const char *element, const char *name)
Remove a database file.
int G_open_old(const char *element, const char *name, const char *mapset)
Open a database file for reading.
char buf[GNAME_MAX+sizeof(G3D_DIRECTORY)+2]
char * G_find_file2(const char *element, const char *name, const char *mapset)
searches for a file from the mapset search list or in a specified mapset. (look but don't touch) retu...
G_warning("category support for [%s] in mapset [%s] %s", name, mapset, type)
int G_get_fp_range_min_max(const struct FPRange *range, DCELL *min, DCELL *max)
Extract the min/max from the range structure r. If the range structure has no defined min/max (first!...
int G_open_new(const char *element, const char *name)
Open a new database file.
#define G3D_XDR_DOUBLE_LENGTH
void G3d_range_updateFromTile(G3D_Map *map, const void *tile, int rows, int cols, int depths, int xRedundant, int yRedundant, int zRedundant, int nofNum, int type)
int G__name_is_fully_qualified(const char *fullname, char *name, char *mapset)
Check if map name is fully qualified (map @ mapset)