23static int get_bool(
const char *);
24static void pr_winerr(
int,
const char *);
25static void edge_sort(
float sides[4]);
28static const int vers_major = 4;
29static const int vers_minor = 1;
31static int Suppress_warn = 0;
44 Suppress_warn =
b ? 0 : 1;
164 G_warning(
_(
"Unable to open %s for writing"), fname);
168 fprintf(fp,
"# %01d.%02d\n", vers_major, vers_minor);
188 fprintf(fp,
"TO_EASTING: %f\n",
View->from_to[1][0]);
189 fprintf(fp,
"TO_NORTHING: %f\n",
View->from_to[1][1]);
190 fprintf(fp,
"TO_HEIGHT: %f\n",
View->from_to[1][2]);
191 fprintf(fp,
"FROM_EASTING: %f\n",
View->from_to[0][0]);
192 fprintf(fp,
"FROM_NORTHING: %f\n",
View->from_to[0][1]);
193 fprintf(fp,
"FROM_HEIGHT: %f\n",
View->from_to[0][2]);
200 fprintf(fp,
"DISPLAY_TYPE: %d\n",
View->display_type);
211 fprintf(fp,
"LIGHTPOS: %f %f %f %f\n",
View->lightpos[0],
View->lightpos[1],
212 View->lightpos[2],
View->lightpos[3]);
213 fprintf(fp,
"LIGHTCOL: %f %f %f\n",
View->lightcol[0],
View->lightcol[1],
246 if (mapset !=
NULL) {
248 G_warning(
_(
"Unable to open %s for reading"), fname);
256 if (buffer[0] !=
'#') {
258 if (0 <= read_old_format(
View, fp))
265 if (
v_maj == vers_major &&
v_min == vers_minor)
271 if (buffer[0] !=
'#') {
280 sscanf(buffer,
"%*s%lf", &(
View->vwin.north));
285 sscanf(buffer,
"%*s%lf", &(
View->vwin.south));
310 sscanf(buffer,
"%*s%f", &(
View->from_to[1][0]));
315 sscanf(buffer,
"%*s%f", &(
View->from_to[1][1]));
320 sscanf(buffer,
"%*s%f", &(
View->from_to[1][2]));
325 sscanf(buffer,
"%*s%f", &(
View->from_to[0][0]));
330 sscanf(buffer,
"%*s%f", &(
View->from_to[0][1]));
335 sscanf(buffer,
"%*s%f", &(
View->from_to[0][2]));
376 View->colorgrid = get_bool(
boo);
403 View->surfonly = get_bool(
boo);
408 View->lightson = get_bool(
boo);
412 sscanf(buffer,
"%*s%f%f%f%f", &(
View->lightpos[0]),
413 &(
View->lightpos[1]), &(
View->lightpos[2]),
414 &(
View->lightpos[3]));
418 sscanf(buffer,
"%*s%f%f%f", &(
View->lightcol[0]),
419 &(
View->lightcol[1]), &(
View->lightcol[2]));
443 (
View->vwin.north -
View->vwin.south) /
View->vwin.rows;
448 if (!Suppress_warn) {
460 pr_winerr(
lap, fname);
465 G_warning(
_(
"Unable to open %s for reading"), fname);
513static int get_bool(
const char *str)
515 if (str[0] ==
'y' || str[0] ==
'Y')
517 if (str[0] ==
'n' || str[0] ==
'N')
520 return (
atoi(str) ? 1 : 0);
529 G_warning(
_(
" Window saved in \"%s\" is completely outside of current "
534 G_warning(
_(
" Only %d%% of window saved in \"%s\" overlaps with "
535 "current GRASS window."),
544static void edge_sort(
float sides[4])
549 for (i = 0; i < 4; ++i) {
550 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.