25static int get_bool(
const char *);
26static void pr_winerr(
int,
const char *);
27static void edge_sort(
float sides[4]);
30static const int vers_major = 4;
31static const int vers_minor = 1;
33static int Suppress_warn = 0;
46 Suppress_warn =
b ? 0 : 1;
166 G_warning(
_(
"Unable to open %s for writing"), fname);
170 fprintf(fp,
"# %01d.%02d\n", vers_major, vers_minor);
190 fprintf(fp,
"TO_EASTING: %f\n",
View->from_to[1][0]);
191 fprintf(fp,
"TO_NORTHING: %f\n",
View->from_to[1][1]);
192 fprintf(fp,
"TO_HEIGHT: %f\n",
View->from_to[1][2]);
193 fprintf(fp,
"FROM_EASTING: %f\n",
View->from_to[0][0]);
194 fprintf(fp,
"FROM_NORTHING: %f\n",
View->from_to[0][1]);
195 fprintf(fp,
"FROM_HEIGHT: %f\n",
View->from_to[0][2]);
202 fprintf(fp,
"DISPLAY_TYPE: %d\n",
View->display_type);
213 fprintf(fp,
"LIGHTPOS: %f %f %f %f\n",
View->lightpos[0],
View->lightpos[1],
214 View->lightpos[2],
View->lightpos[3]);
215 fprintf(fp,
"LIGHTCOL: %f %f %f\n",
View->lightcol[0],
View->lightcol[1],
248 if (mapset !=
NULL) {
250 G_warning(
_(
"Unable to open %s for reading"), fname);
258 if (buffer[0] !=
'#') {
260 if (0 <= read_old_format(
View, fp))
267 if (
v_maj == vers_major &&
v_min == vers_minor)
273 if (buffer[0] !=
'#') {
282 sscanf(buffer,
"%*s%lf", &(
View->vwin.north));
287 sscanf(buffer,
"%*s%lf", &(
View->vwin.south));
312 sscanf(buffer,
"%*s%f", &(
View->from_to[1][0]));
317 sscanf(buffer,
"%*s%f", &(
View->from_to[1][1]));
322 sscanf(buffer,
"%*s%f", &(
View->from_to[1][2]));
327 sscanf(buffer,
"%*s%f", &(
View->from_to[0][0]));
332 sscanf(buffer,
"%*s%f", &(
View->from_to[0][1]));
337 sscanf(buffer,
"%*s%f", &(
View->from_to[0][2]));
378 View->colorgrid = get_bool(
boo);
405 View->surfonly = get_bool(
boo);
410 View->lightson = get_bool(
boo);
414 sscanf(buffer,
"%*s%f%f%f%f", &(
View->lightpos[0]),
415 &(
View->lightpos[1]), &(
View->lightpos[2]),
416 &(
View->lightpos[3]));
420 sscanf(buffer,
"%*s%f%f%f", &(
View->lightcol[0]),
421 &(
View->lightcol[1]), &(
View->lightcol[2]));
445 (
View->vwin.north -
View->vwin.south) /
View->vwin.rows;
450 if (!Suppress_warn) {
462 pr_winerr(
lap, fname);
467 G_warning(
_(
"Unable to open %s for reading"), fname);
515static int get_bool(
const char *str)
517 if (str[0] ==
'y' || str[0] ==
'Y')
519 if (str[0] ==
'n' || str[0] ==
'N')
522 return (
atoi(str) ? 1 : 0);
531 G_warning(
_(
" Window saved in \"%s\" is completely outside of current "
536 G_warning(
_(
" Only %d%% of window saved in \"%s\" overlaps with "
537 "current GRASS window."),
546static void edge_sort(
float sides[4])
551 for (i = 0; i < 4; ++i) {
552 for (
j = i + 1;
j < 4; ++
j) {
void G_warning(const char *,...) __attribute__((format(printf
FILE * G_fopen_new(const char *, const char *)
Open a new database file.
void G_get_set_window(struct Cell_head *)
Get the current working window (region)
FILE * G_fopen_old(const char *, const char *, const char *)
Open a database file for reading.
const char * G_find_file2(const char *, const char *, const char *)
Searches for a file from the mapset search list or in a specified mapset. (look but don't touch)
void G_format_easting(double, char *, int)
Easting to ASCII.
int G_projection(void)
Query cartographic projection.
void G_format_northing(double, char *, int)
Northing to ASCII.
2D/3D raster map header (used also for region)
double ew_res
Resolution - east to west cell size for 2D data.
double north
Extent coordinates (north)
int compressed
Compression mode (raster header only)
int format
Max number of bytes per raster data value minus 1 (raster header only)
int zone
Projection zone (UTM)
double east
Extent coordinates (east)
double ns_res
Resolution - north to south cell size for 2D data.
int rows
Number of rows for 2D data.
int cols
Number of columns for 2D data.
double south
Extent coordinates (south)
double west
Extent coordinates (west)
int G_get_3dview(const char *fname, const char *mapset, struct G_3dview *View)
Gets a 3D View.
void G_3dview_warning(int b)
Turns 3D View warnings on and off.
int G_get_3dview_defaults(struct G_3dview *v, struct Cell_head *w)
Sets default for v based on w.
int G_put_3dview(const char *fname, const struct G_3dview *View, const struct Cell_head *Win)
Saves info to a 3d.view file in the current mapset.