21 region2d->proj = region3d->proj;
22 region2d->zone = region3d->zone;
24 region2d->north = region3d->north;
25 region2d->south = region3d->south;
26 region2d->east = region3d->east;
27 region2d->west = region3d->west;
29 region2d->rows = region3d->rows;
30 region2d->cols = region3d->cols;
32 region2d->ns_res = region3d->ns_res;
33 region2d->ew_res = region3d->ew_res;
48 region2d->proj = region3d->proj;
49 region2d->zone = region3d->zone;
51 region2d->north = region3d->north;
52 region2d->south = region3d->south;
53 region2d->east = region3d->east;
54 region2d->west = region3d->west;
55 region2d->top = region3d->top;
56 region2d->bottom = region3d->bottom;
58 region2d->rows = region3d->rows;
59 region2d->rows3 = region3d->rows;
60 region2d->cols = region3d->cols;
61 region2d->cols3 = region3d->cols;
62 region2d->depths = region3d->depths;
64 region2d->ns_res = region3d->ns_res;
65 region2d->ns_res3 = region3d->ns_res;
66 region2d->ew_res = region3d->ew_res;
67 region2d->ew_res3 = region3d->ew_res;
68 region2d->tb_res = region3d->tb_res;
88 region3d->proj = region2d->proj;
89 region3d->zone = region2d->zone;
91 region3d->north = region2d->north;
92 region3d->south = region2d->south;
93 region3d->east = region2d->east;
94 region3d->west = region2d->west;
96 region3d->rows = region2d->rows;
97 region3d->cols = region2d->cols;
99 region3d->ns_res = region2d->ns_res;
100 region3d->ew_res = region2d->ew_res;
117 region3d->proj = region2d->proj;
118 region3d->zone = region2d->zone;
120 region3d->north = region2d->north;
121 region3d->south = region2d->south;
122 region3d->east = region2d->east;
123 region3d->west = region2d->west;
124 region3d->top = region2d->top;
125 region3d->bottom = region2d->bottom;
127 region3d->rows = region2d->rows3;
128 region3d->cols = region2d->cols3;
129 region3d->depths = region2d->depths;
131 region3d->ns_res = region2d->ns_res3;
132 region3d->ew_res = region2d->ew_res3;
133 region3d->tb_res = region2d->tb_res;
151 struct Cell_head region2d;
160 if (region->depths <= 0)
162 region->tb_res = (region->top - region->bottom) / region->depths;
180 struct Cell_head region2d;
189 if (region->tb_res <= 0)
192 region->depths = (region->top - region->bottom + region->tb_res / 2.0) /
194 if (region->depths == 0)
215 G_copy(regionDest, regionSrc,
sizeof(G3D_Region));
246 row = map->region.rows -
247 (north - map->region.south) / (map->region.north -
248 map->region.south) * map->region.rows;
250 (east - map->region.west) / (map->region.east -
251 map->region.west) * map->region.cols;
253 (top - map->region.bottom) / (map->region.top -
254 map->region.bottom) *
258 if ((row < 0) || (row >= map->region.rows) ||
259 (col < 0) || (col >= map->region.cols) ||
260 (depth < 0) || (depth >= map->region.depths)) {
266 map->resampleFun(map, row, col, depth, value, type);
274 char fullName[GPATH_MAX];
278 G3d_filename(fullName, G3D_HEADER_ELEMENT, xname, xmapset);
280 if (!mapset || !*mapset)
282 G3d_filename(fullName, G3D_HEADER_ELEMENT, name, mapset);
void G3d_extract2dRegion(G3D_Region *region3d, struct Cell_head *region2d)
Returns in region2d the 2d portion of region3d.
void G3d_getRegionValue(G3D_Map *map, double north, double east, double top, void *value, int type)
Returns in value the value of the map which corresponds to region coordinates (north, east, top). The value is resampled using the resampling function specified for map. The value is of type.
void G3d_setNullValue(void *c, int nofElts, int type)
Fills the vector pointed to by c with nofElts NULL-values of type.
int G_copy(void *a, const void *b, int n)
Copies n bytes starting at address b into address a.
void G3d_regionToCellHead(G3D_Region *region3d, struct Cell_head *region2d)
Returns in region2d the 2d portion of region3d.
char * G_adjust_Cell_head3(struct Cell_head *cellhd, int row_flag, int col_flag, int depth_flag)
Adjust cell header for 3D values.
void G3d_filename(char *path, const char *elementName, const char *mapName, const char *mapset)
void G3d_regionFromToCellHead(struct Cell_head *region2d, G3D_Region *region3d)
Replaces the 2d portion of region3d with the values stored in region2d.
int G3d_readWindow(G3D_Region *window, const char *windowName)
Reads window from the file specified by windowName. The name is converted by the rules defined in win...
void G3d_incorporate2dRegion(struct Cell_head *region2d, G3D_Region *region3d)
Replaces the 2d portion of region3d with the values stored in region2d.
char * G_find_grid3(const char *name, const char *mapset)
void G3d_adjustRegionRes(G3D_Region *region)
Computes an adjusts the number of cells per dimension in the region structure from the region boundar...
void G3d_adjustRegion(G3D_Region *region)
Computes an adjusts the resolutions in the region structure from the region boundaries and number of ...
int G_fatal_error(const char *msg,...)
Print a fatal error message to stderr.
void G3d_regionCopy(G3D_Region *regionDest, G3D_Region *regionSrc)
Copies the values of regionSrc into regionDst. (The unfortunate order of parameters was chosen in ord...
int G3d_readRegionMap(const char *name, const char *mapset, G3D_Region *region)
void G3d_fatalError(const char *,...)
This function prints the error message msg, and terminates the program with an error status...
int G__name_is_fully_qualified(const char *fullname, char *name, char *mapset)
Check if map name is fully qualified (map @ mapset)