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)
63 char xname[GNAME_MAX], xmapset[GMAPSET_MAX];
65 if (windowName ==
NULL) {
70 while (*windowName ==
' ')
73 if (strchr(windowName, GRASS_DIRSEP) || strchr(windowName, HOST_DIRSEP)) {
74 sprintf(path, windowName);
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",