13 G3d_readWriteWindow(
struct Key_Value *windowKeys,
int doRead,
int *proj,
14 int *zone,
double *north,
double *south,
double *east,
15 double *west,
double *top,
double *bottom,
int *rows,
16 int *
cols,
int *depths,
double *ew_res,
double *ns_res,
20 int (*windowInt) (), (*windowDouble) ();
53 G3d_error(
"G3d_readWriteWindow: error writing window");
61 static void G3d_getFullWindowPath(
char *path,
const char *windowName)
65 if (windowName ==
NULL) {
70 while (*windowName ==
' ')
73 if (strchr(windowName, GRASS_DIRSEP) || strchr(windowName, HOST_DIRSEP)) {
141 struct Cell_head win;
142 struct Key_Value *windowKeys;
143 char path[GPATH_MAX];
147 if (windowName ==
NULL) {
150 window->proj = win.proj;
151 window->zone = win.zone;
152 window->north = win.north;
153 window->south = win.south;
154 window->east = win.east;
155 window->west = win.west;
156 window->top = win.top;
157 window->bottom = win.bottom;
158 window->rows = win.rows3;
159 window->cols = win.cols3;
160 window->depths = win.depths;
161 window->ns_res = win.ns_res3;
162 window->ew_res = win.ew_res3;
163 window->tb_res = win.tb_res;
166 G3d_getFullWindowPath(path, windowName);
168 if (access(path,
R_OK) != 0) {
169 G_warning(
"G3d_readWindow: unable to find [%s].", path);
175 G3d_error(
"G3d_readWindow: Unable to open %s", path);
179 if (!G3d_readWriteWindow(windowKeys, 1,
180 &(window->proj), &(window->zone),
181 &(window->north), &(window->south),
182 &(window->east), &(window->west),
183 &(window->top), &(window->bottom),
184 &(window->rows), &(window->cols),
185 &(window->depths), &(window->ew_res),
186 &(window->ns_res), &(window->tb_res))) {
188 (
"G3d_readWindow: error extracting window key(s) of file %s",
char * G_mapset(void)
current mapset name
sprintf(buf2,"%s", G3D_CATS_ELEMENT)
void G3d_error(const char *msg,...)
int G3d_keyGetDouble(struct Key_Value *keys, const char *key, double *d)
int G3d_keySetInt(struct Key_Value *keys, const char *key, const int *i)
int G_free_key_value(struct Key_Value *kv)
Free allocated Key_Value structure.
#define G3D_REGION_DEPTHS
#define G3D_REGION_BOTTOM
char * G__file_name(char *path, const char *element, const char *name, const char *mapset)
Builds full path names to GIS data files.
struct Key_Value * G_read_key_value_file(const char *file, int *stat)
Read key/values pairs from file.
void G3d_useWindowParams(void)
Writes window to the file specified by windowName. The name is converted by the rules defined in wind...
int G_get_window(struct Cell_head *window)
read the database region
int G3d_keySetDouble(struct Key_Value *keys, const char *key, const double *d)
G_warning("category support for [%s] in mapset [%s] %s", name, mapset, type)
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_setWindowParams(void)
int G3d_keyGetInt(struct Key_Value *keys, const char *key, int *i)
int G__name_is_fully_qualified(const char *fullname, char *name, char *mapset)
Check if map name is fully qualified (map @ mapset)