GRASS 8 Programmer's Manual  8.5.0dev(2025)-c070206eb1
view.c
Go to the documentation of this file.
1 /*!
2  * \file lib/gis/view.c
3  *
4  * \brief GIS Library - 3D View functions.
5  *
6  * (C) 2001-2014 by the GRASS Development Team
7  *
8  * This program is free software under the GNU General Public License
9  * (>=v2). Read the file COPYING that comes with GRASS for details.
10  *
11  * \author Bill Brown - US Army CERL
12  *
13  * \date 1992-2008
14  */
15 
16 #include <stdio.h>
17 #include <string.h>
18 #include <stdlib.h>
19 #include <grass/gis.h>
20 #include <grass/glocale.h>
21 
22 #define REQ_KEYS 8
23 
24 static int compare_wind(const struct Cell_head *, const struct Cell_head *);
25 static int get_bool(const char *);
26 static void pr_winerr(int, const char *);
27 static void edge_sort(float sides[4]);
28 static int read_old_format(struct G_3dview *, FILE *);
29 
30 static const int vers_major = 4;
31 static const int vers_minor = 1;
32 
33 static int Suppress_warn = 0;
34 
35 /**
36  * \brief Turns 3D View warnings on and off.
37  *
38  * If Suppress_warn is 0, a warning will be printed if less than 95% of
39  * the window when the view was saved overlaps the current window.
40  *
41  * \param[in] b
42  * \return
43  */
45 {
46  Suppress_warn = b ? 0 : 1;
47 }
48 
49 /**
50  * \brief Sets default for <b>v</b> based on <b>w</b>.
51  *
52  * \param[in,out] v
53  * \param[in] w
54  * \return always returns 1
55  */
56 int G_get_3dview_defaults(struct G_3dview *v, struct Cell_head *w)
57 {
58  if (!v || !w)
59  return (-1);
60 
61  v->exag = 1.0;
62  v->fov = 40.0;
63  v->from_to[0][0] = (w->east + w->west) / 2.0;
64  v->from_to[0][1] = w->south - (w->north - w->south);
65  v->from_to[0][2] = w->north - w->south;
66  v->from_to[1][0] = (w->east + w->west) / 2.0;
67  v->from_to[1][1] = (w->north + w->south) / 2.0;
68  v->from_to[1][2] = 0.0;
69 
70  v->twist = 0.0;
71  v->mesh_freq = 15;
72  v->poly_freq = 1;
73  v->display_type = 2;
74  v->colorgrid = v->fringe = v->surfonly = v->lightson = v->doavg = 0;
75  v->dozero = v->shading = 1;
76  strcpy(v->bg_col, "black");
77  strcpy(v->grid_col, "white");
78  strcpy(v->other_col, "red");
79  v->ambient = v->shine = 0.3;
80  v->lightcol[0] = v->lightcol[1] = v->lightcol[2] = 0.8;
81  v->lightpos[0] = w->west;
82  v->lightpos[1] = w->north;
83  v->lightpos[2] = (w->east - w->west) / 2.0;
84  v->lightpos[3] = 1.0; /* local source */
85 
86  v->vwin.north = w->north;
87  v->vwin.south = w->south;
88  v->vwin.east = w->east;
89  v->vwin.west = w->west;
90  v->vwin.format = w->format;
91  v->vwin.compressed = w->compressed;
92  v->vwin.proj = w->proj;
93  v->vwin.zone = w->zone;
94  v->vwin.ew_res = w->ew_res;
95  v->vwin.ns_res = w->ns_res;
96  v->vwin.cols = w->cols;
97  v->vwin.rows = w->rows;
98 
99  return (1);
100 }
101 
102 /**
103  * \brief Saves info to a 3d.view file in the current mapset.
104  *
105  * The address of a window (struct Cell_head *) may be passed, or if
106  * NULL is passed, the Cell_head structure inside the G_3dview struct
107  * will be used. e.g., if you called <i>G_get_3dview_defaults</i> with
108  * the Cell_head you want saved, the G_3dview returned already contains
109  * the new Cell_head. But if you're using all the keywords, so didn't
110  * need defaults, pass this routine the address of a Cell_head.<br>
111  *
112  * User should call <i>G_get_3dview_defaults</i> before filling a
113  * G_3dview struct to be written if not using all of the optional
114  * keywords.<br>
115  *
116  * These keywords are constant in all 3d.view files:<br>
117  * PGM_ID<br>
118  * <b>cell keywords:</b><br>
119  * north<br>
120  * south<br>
121  * east<br>
122  * west<br>
123  * rows<br>
124  * cols<br>
125  * <b>required keywords:</b><br>
126  * TO_EASTING<br>
127  * TO_NORTHING<br>
128  * TO_HEIGHT<br>
129  * FROM_EASTING<br>
130  * FROM_NORTHING<br>
131  * FROM_HEIGHT<br>
132  * Z_EXAG<br>
133  * FIELD_VIEW<br>
134  * <b>optional keywords:</b> (defaults provided when reading)<br>
135  * TWIST<br>
136  * MESH_FREQ<br>
137  * POLY_RES<br>
138  * DOAVG<br>
139  * DISPLAY_TYPE<br>
140  * DOZERO<br>
141  * COLORGRID<br>
142  * SHADING<br>
143  * FRINGE<br>
144  * BG_COL<br>
145  * GRID_COL<br>
146  * OTHER_COL<br>
147  * LIGHTS_ON<br>
148  * LIGHTPOS<br>
149  * LIGHTCOL<br>
150  * LIGHTAMBIENT<br>
151  * SHINE<br>
152  * SURFACEONLY<br>
153  *
154  * \param[in] fname file name
155  * \param[in] View
156  * \param[in] Win
157  * \return 1 on success
158  * \return -1 on error
159  */
160 int G_put_3dview(const char *fname, const struct G_3dview *View,
161  const struct Cell_head *Win)
162 {
163  FILE *fp;
164 
165  if (NULL == (fp = G_fopen_new("3d.view", fname))) {
166  G_warning(_("Unable to open %s for writing"), fname);
167  return (-1);
168  }
169 
170  fprintf(fp, "# %01d.%02d\n", vers_major, vers_minor);
171  fprintf(fp, "PGM_ID: %s\n", View->pgm_id);
172 
173  if (Win) {
174  fprintf(fp, "north: %f\n", Win->north);
175  fprintf(fp, "south: %f\n", Win->south);
176  fprintf(fp, "east: %f\n", Win->east);
177  fprintf(fp, "west: %f\n", Win->west);
178  fprintf(fp, "rows: %d\n", Win->rows);
179  fprintf(fp, "cols: %d\n", Win->cols);
180  }
181  else {
182  fprintf(fp, "north: %f\n", View->vwin.north);
183  fprintf(fp, "south: %f\n", View->vwin.south);
184  fprintf(fp, "east: %f\n", View->vwin.east);
185  fprintf(fp, "west: %f\n", View->vwin.west);
186  fprintf(fp, "rows: %d\n", View->vwin.rows);
187  fprintf(fp, "cols: %d\n", View->vwin.cols);
188  }
189 
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]);
196  fprintf(fp, "Z_EXAG: %f\n", View->exag);
197  fprintf(fp, "TWIST: %f\n", View->twist);
198  fprintf(fp, "FIELD_VIEW: %f\n", View->fov);
199  fprintf(fp, "MESH_FREQ: %d\n", View->mesh_freq);
200  fprintf(fp, "POLY_RES: %d\n", View->poly_freq);
201  fprintf(fp, "DOAVG: %d\n", View->doavg);
202  fprintf(fp, "DISPLAY_TYPE: %d\n", View->display_type);
203  fprintf(fp, "DOZERO: %d\n", View->dozero);
204 
205  fprintf(fp, "COLORGRID: %d\n", View->colorgrid); /* 1 = use color */
206  fprintf(fp, "SHADING: %d\n", View->shading);
207  fprintf(fp, "FRINGE: %d\n", View->fringe);
208  fprintf(fp, "BG_COL: %s\n", View->bg_col);
209  fprintf(fp, "GRID_COL: %s\n", View->grid_col);
210  fprintf(fp, "OTHER_COL: %s\n", View->other_col);
211  fprintf(fp, "SURFACEONLY: %d\n", View->surfonly);
212  fprintf(fp, "LIGHTS_ON: %d\n", View->lightson);
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],
216  View->lightcol[2]);
217  fprintf(fp, "LIGHTAMBIENT: %f\n", View->ambient);
218  fprintf(fp, "SHINE: %f\n", View->shine);
219 
220  fclose(fp);
221 
222  return (1);
223 }
224 
225 /**
226  * \brief Gets a 3D View.
227  *
228  * If reading an old format, the window boundaries are not checked
229  * against the current window since boundaries weren't saved.
230  *
231  * \param[in] fname
232  * \param[in] mapset
233  * \param[in,out] View
234  * \return -1 on error
235  * \return 1 on success
236  * \return 2 if <b>fname</b> was written with this version of routine
237  * \return 0 if is older format (through 4.0)
238  */
239 int G_get_3dview(const char *fname, const char *mapset, struct G_3dview *View)
240 {
241  struct Cell_head curwin;
242  FILE *fp;
243  char buffer[80], keystring[24], boo[8], nbuf[128], ebuf[128];
244  int lap, v_maj, v_min, wind_keys = 0, reqkeys = 0;
245  int current = 0; /* current version flag */
246 
247  mapset = G_find_file2("3d.view", fname, mapset);
248  if (mapset != NULL) {
249  if (NULL == (fp = G_fopen_old("3d.view", fname, mapset))) {
250  G_warning(_("Unable to open %s for reading"), fname);
251  return (-1);
252  }
253 
254  G_get_set_window(&curwin);
255  G_get_3dview_defaults(View, &curwin);
256 
257  if (NULL != fgets(buffer, 80, fp)) {
258  if (buffer[0] != '#') { /* old d.3d format */
259  rewind(fp);
260  if (0 <= read_old_format(View, fp))
261  return (0);
262  else
263  return (-1);
264  }
265  else {
266  sscanf(buffer, "#%d.%d\n", &v_maj, &v_min);
267  if (v_maj == vers_major && v_min == vers_minor)
268  current = 1; /* same version */
269  }
270  }
271 
272  while (NULL != fgets(buffer, 75, fp)) {
273  if (buffer[0] != '#') {
274 
275  sscanf(buffer, "%[^:]:", keystring);
276 
277  if (!strcmp(keystring, "PGM_ID")) {
278  sscanf(buffer, "%*s%s", (View->pgm_id));
279  continue;
280  }
281  if (!strcmp(keystring, "north")) {
282  sscanf(buffer, "%*s%lf", &(View->vwin.north));
283  ++wind_keys;
284  continue;
285  }
286  if (!strcmp(keystring, "south")) {
287  sscanf(buffer, "%*s%lf", &(View->vwin.south));
288  ++wind_keys;
289  continue;
290  }
291  if (!strcmp(keystring, "east")) {
292  sscanf(buffer, "%*s%lf", &(View->vwin.east));
293  ++wind_keys;
294  continue;
295  }
296  if (!strcmp(keystring, "west")) {
297  sscanf(buffer, "%*s%lf", &(View->vwin.west));
298  ++wind_keys;
299  continue;
300  }
301  if (!strcmp(keystring, "rows")) {
302  sscanf(buffer, "%*s%d", &(View->vwin.rows));
303  ++wind_keys;
304  continue;
305  }
306  if (!strcmp(keystring, "cols")) {
307  sscanf(buffer, "%*s%d", &(View->vwin.cols));
308  ++wind_keys;
309  continue;
310  }
311  if (!strcmp(keystring, "TO_EASTING")) {
312  sscanf(buffer, "%*s%f", &(View->from_to[1][0]));
313  ++reqkeys;
314  continue;
315  }
316  if (!strcmp(keystring, "TO_NORTHING")) {
317  sscanf(buffer, "%*s%f", &(View->from_to[1][1]));
318  ++reqkeys;
319  continue;
320  }
321  if (!strcmp(keystring, "TO_HEIGHT")) {
322  sscanf(buffer, "%*s%f", &(View->from_to[1][2]));
323  ++reqkeys;
324  continue;
325  }
326  if (!strcmp(keystring, "FROM_EASTING")) {
327  sscanf(buffer, "%*s%f", &(View->from_to[0][0]));
328  ++reqkeys;
329  continue;
330  }
331  if (!strcmp(keystring, "FROM_NORTHING")) {
332  sscanf(buffer, "%*s%f", &(View->from_to[0][1]));
333  ++reqkeys;
334  continue;
335  }
336  if (!strcmp(keystring, "FROM_HEIGHT")) {
337  sscanf(buffer, "%*s%f", &(View->from_to[0][2]));
338  ++reqkeys;
339  continue;
340  }
341  if (!strcmp(keystring, "Z_EXAG")) {
342  sscanf(buffer, "%*s%f", &(View->exag));
343  ++reqkeys;
344  continue;
345  }
346  if (!strcmp(keystring, "MESH_FREQ")) {
347  sscanf(buffer, "%*s%d", &(View->mesh_freq));
348  continue;
349  }
350  if (!strcmp(keystring, "POLY_RES")) {
351  sscanf(buffer, "%*s%d", &(View->poly_freq));
352  continue;
353  }
354  if (!strcmp(keystring, "DOAVG")) {
355  sscanf(buffer, "%*s%d", &(View->doavg));
356  continue;
357  }
358  if (!strcmp(keystring, "FIELD_VIEW")) {
359  sscanf(buffer, "%*s%f", &(View->fov));
360  ++reqkeys;
361  continue;
362  }
363  if (!strcmp(keystring, "TWIST")) {
364  sscanf(buffer, "%*s%f", &(View->twist));
365  continue;
366  }
367  if (!strcmp(keystring, "DISPLAY_TYPE")) {
368  sscanf(buffer, "%*s%d", &View->display_type);
369  continue;
370  }
371  if (!strcmp(keystring, "DOZERO")) {
372  sscanf(buffer, "%*s%s", boo);
373  View->dozero = get_bool(boo);
374  continue;
375  }
376  if (!strcmp(keystring, "COLORGRID")) {
377  sscanf(buffer, "%*s%s", boo);
378  View->colorgrid = get_bool(boo);
379  continue;
380  }
381  if (!strcmp(keystring, "FRINGE")) {
382  sscanf(buffer, "%*s%s", boo);
383  View->fringe = get_bool(boo);
384  continue;
385  }
386  if (!strcmp(keystring, "SHADING")) {
387  sscanf(buffer, "%*s%s", boo);
388  View->shading = get_bool(boo);
389  continue;
390  }
391  if (!strcmp(keystring, "BG_COL")) {
392  sscanf(buffer, "%*s%s", View->bg_col);
393  continue;
394  }
395  if (!strcmp(keystring, "GRID_COL")) {
396  sscanf(buffer, "%*s%s", View->grid_col);
397  continue;
398  }
399  if (!strcmp(keystring, "OTHER_COL")) {
400  sscanf(buffer, "%*s%s", View->other_col);
401  continue;
402  }
403  if (!strcmp(keystring, "SURFACEONLY")) {
404  sscanf(buffer, "%*s%s", boo);
405  View->surfonly = get_bool(boo);
406  continue;
407  }
408  if (!strcmp(keystring, "LIGHTS_ON")) {
409  sscanf(buffer, "%*s%s", boo);
410  View->lightson = get_bool(boo);
411  continue;
412  }
413  if (!strcmp(keystring, "LIGHTPOS")) {
414  sscanf(buffer, "%*s%f%f%f%f", &(View->lightpos[0]),
415  &(View->lightpos[1]), &(View->lightpos[2]),
416  &(View->lightpos[3]));
417  continue;
418  }
419  if (!strcmp(keystring, "LIGHTCOL")) {
420  sscanf(buffer, "%*s%f%f%f", &(View->lightcol[0]),
421  &(View->lightcol[1]), &(View->lightcol[2]));
422  continue;
423  }
424  if (!strcmp(keystring, "LIGHTAMBIENT")) {
425  sscanf(buffer, "%*s%f", &(View->ambient));
426  continue;
427  }
428  if (!strcmp(keystring, "SHINE")) {
429  sscanf(buffer, "%*s%f", &(View->shine));
430  continue;
431  }
432  }
433  }
434 
435  fclose(fp);
436 
437  if (reqkeys != REQ_KEYS) /* required keys not found */
438  return (-1);
439 
440  /* fill rest of View->vwin */
441  if (wind_keys == 6) {
442  View->vwin.ew_res =
443  (View->vwin.east - View->vwin.west) / View->vwin.cols;
444  View->vwin.ns_res =
445  (View->vwin.north - View->vwin.south) / View->vwin.rows;
446  }
447  else
448  return (0); /* older format */
449 
450  if (!Suppress_warn) {
451  if (95 > (lap = compare_wind(&(View->vwin), &curwin))) {
452 
453  fprintf(stderr, _("GRASS window when view was saved:\n"));
454  G_format_northing(View->vwin.north, nbuf, G_projection());
455  fprintf(stderr, "north: %s\n", nbuf);
456  G_format_northing(View->vwin.south, nbuf, G_projection());
457  fprintf(stderr, "south: %s\n", nbuf);
458  G_format_easting(View->vwin.east, ebuf, G_projection());
459  fprintf(stderr, "east: %s\n", ebuf);
460  G_format_easting(View->vwin.west, ebuf, G_projection());
461  fprintf(stderr, "west: %s\n", ebuf);
462  pr_winerr(lap, fname);
463  }
464  }
465  }
466  else {
467  G_warning(_("Unable to open %s for reading"), fname);
468  return (-1);
469  }
470 
471  if (current)
472  return (2);
473 
474  return (1);
475 }
476 
477 /* returns the percentage of savedwin that overlaps curwin */
478 
479 static int compare_wind(const struct Cell_head *savedwin,
480  const struct Cell_head *curwin)
481 {
482  float e_ings[4], n_ings[4], area_lap, area_saved;
483  int outside = 0;
484 
485  if (savedwin->north < curwin->south)
486  outside = 1;
487  if (savedwin->south > curwin->north)
488  outside = 1;
489  if (savedwin->east < curwin->west)
490  outside = 1;
491  if (savedwin->west > curwin->east)
492  outside = 1;
493  if (outside)
494  return (0);
495 
496  e_ings[0] = savedwin->west;
497  e_ings[1] = savedwin->east;
498  e_ings[2] = curwin->west;
499  e_ings[3] = curwin->east;
500  edge_sort(e_ings);
501 
502  n_ings[0] = savedwin->south;
503  n_ings[1] = savedwin->north;
504  n_ings[2] = curwin->south;
505  n_ings[3] = curwin->north;
506  edge_sort(n_ings);
507 
508  area_lap = (e_ings[2] - e_ings[1]) * (n_ings[2] - n_ings[1]);
509  area_saved =
510  (savedwin->east - savedwin->west) * (savedwin->north - savedwin->south);
511 
512  return ((int)(area_lap * 100.0 / area_saved));
513 }
514 
515 static int get_bool(const char *str)
516 {
517  if (str[0] == 'y' || str[0] == 'Y')
518  return (1);
519  if (str[0] == 'n' || str[0] == 'N')
520  return (0);
521 
522  return (atoi(str) ? 1 : 0);
523 }
524 
525 static void
526 pr_winerr(int vis, /* % of saved window overlapping current window */
527  const char *viewname)
528 {
529  switch (vis) {
530  case 0:
531  G_warning(_(" Window saved in \"%s\" is completely outside of current "
532  "GRASS window."),
533  viewname);
534  break;
535  default:
536  G_warning(_(" Only %d%% of window saved in \"%s\" overlaps with "
537  "current GRASS window."),
538  vis, viewname);
539  break;
540  }
541 }
542 
543 /*********************************************************************/
544 /* sorts 4 floats from lowest to highest */
545 
546 static void edge_sort(float sides[4])
547 {
548  int i, j;
549  float temp;
550 
551  for (i = 0; i < 4; ++i) {
552  for (j = i + 1; j < 4; ++j) {
553  if (sides[j] < sides[i]) { /* then swap */
554  temp = sides[i];
555  sides[i] = sides[j];
556  sides[j] = temp;
557  }
558  }
559  }
560 }
561 
562 static int read_old_format(struct G_3dview *v, FILE *fp)
563 {
564  char buffer[80];
565  int req_keys = 0;
566  double td;
567  char boo[8];
568 
569  strcpy((v->pgm_id), "d.3d");
570  if (1 == sscanf(fgets(buffer, 80, fp), "%f", &(v->from_to[1][0])))
571  ++req_keys;
572  if (1 == sscanf(fgets(buffer, 80, fp), "%f", &(v->from_to[1][1])))
573  ++req_keys;
574  if (1 == sscanf(fgets(buffer, 80, fp), "%f", &(v->from_to[1][2])))
575  ++req_keys;
576  if (1 == sscanf(fgets(buffer, 80, fp), "%f", &(v->from_to[0][0])))
577  ++req_keys;
578  if (1 == sscanf(fgets(buffer, 80, fp), "%f", &(v->from_to[0][1])))
579  ++req_keys;
580  if (1 == sscanf(fgets(buffer, 80, fp), "%f", &(v->from_to[0][2])))
581  ++req_keys;
582  if (1 == sscanf(fgets(buffer, 80, fp), "%f", &(v->exag)))
583  ++req_keys;
584  sscanf(fgets(buffer, 80, fp), "%d", &(v->mesh_freq));
585  if (1 == sscanf(fgets(buffer, 80, fp), "%f", &(v->fov)))
586  ++req_keys;
587  if (1 == sscanf(fgets(buffer, 80, fp), "%lf", &td)) { /* resolution */
588  v->vwin.rows = (v->vwin.north - v->vwin.south) / td;
589  v->vwin.cols = (v->vwin.east - v->vwin.west) / td;
590  v->vwin.ew_res = v->vwin.ns_res = td;
591  }
592 
593  sscanf(fgets(buffer, 80, fp), "%s", boo); /* linesonly */
594  v->display_type = get_bool(boo) ? 1 : 3;
595  sscanf(fgets(buffer, 80, fp), "%s", boo);
596  v->dozero = get_bool(boo);
597  sscanf(fgets(buffer, 80, fp), "%s", v->grid_col);
598  if (!strcmp(v->grid_col, "color"))
599  v->colorgrid = 1;
600 
601  sscanf(fgets(buffer, 80, fp), "%s", v->other_col);
602  sscanf(fgets(buffer, 80, fp), "%s", v->bg_col);
603  sscanf(fgets(buffer, 80, fp), "%s", boo);
604  v->doavg = get_bool(boo);
605 
606  if (v->exag) { /* old 3d.view files saved height with no exag */
607  v->from_to[0][2] /= v->exag;
608  v->from_to[1][2] /= v->exag;
609  }
610 
611  fclose(fp);
612  if (req_keys == REQ_KEYS)
613  return (1);
614  else
615  return (-1);
616 }
#define NULL
Definition: ccmath.h:32
FILE * G_fopen_old(const char *, const char *, const char *)
Open a database file for reading.
Definition: gis/open.c:248
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)
Definition: find_file.c:234
void G_warning(const char *,...) __attribute__((format(printf
void G_get_set_window(struct Cell_head *)
Get the current working window (region)
void G_format_easting(double, char *, int)
Easting to ASCII.
Definition: wind_format.c:49
FILE * G_fopen_new(const char *, const char *)
Open a new database file.
Definition: gis/open.c:216
int G_projection(void)
Query cartographic projection.
Definition: proj1.c:32
void G_format_northing(double, char *, int)
Northing to ASCII.
Definition: wind_format.c:29
#define _(str)
Definition: glocale.h:10
#define strcpy
Definition: parson.c:62
double b
Definition: r_raster.c:39
2D/3D raster map header (used also for region)
Definition: gis.h:446
double ew_res
Resolution - east to west cell size for 2D data.
Definition: gis.h:482
double north
Extent coordinates (north)
Definition: gis.h:492
int compressed
Compression mode (raster header only)
Definition: gis.h:459
int format
Max number of bytes per raster data value minus 1 (raster header only)
Definition: gis.h:452
int zone
Projection zone (UTM)
Definition: gis.h:480
double east
Extent coordinates (east)
Definition: gis.h:496
double ns_res
Resolution - north to south cell size for 2D data.
Definition: gis.h:486
int rows
Number of rows for 2D data.
Definition: gis.h:461
int cols
Number of columns for 2D data.
Definition: gis.h:465
int proj
Projection code.
Definition: gis.h:478
double south
Extent coordinates (south)
Definition: gis.h:494
double west
Extent coordinates (west)
Definition: gis.h:498
Definition: gis.h:508
struct Cell_head vwin
Definition: gis.h:531
int mesh_freq
Definition: gis.h:514
float from_to[2][3]
Definition: gis.h:510
float fov
Definition: gis.h:511
char pgm_id[40]
Definition: gis.h:509
char other_col[40]
Definition: gis.h:526
int colorgrid
Definition: gis.h:519
char bg_col[40]
Definition: gis.h:525
char grid_col[40]
Definition: gis.h:524
float lightcol[3]
Definition: gis.h:528
int shading
Definition: gis.h:520
int dozero
Definition: gis.h:518
int lightson
Definition: gis.h:517
float shine
Definition: gis.h:530
int display_type
Definition: gis.h:516
int poly_freq
Definition: gis.h:515
float ambient
Definition: gis.h:529
float exag
Definition: gis.h:513
float twist
Definition: gis.h:512
int fringe
Definition: gis.h:521
float lightpos[4]
Definition: gis.h:527
int surfonly
Definition: gis.h:522
int doavg
Definition: gis.h:523
int G_get_3dview(const char *fname, const char *mapset, struct G_3dview *View)
Gets a 3D View.
Definition: view.c:239
void G_3dview_warning(int b)
Turns 3D View warnings on and off.
Definition: view.c:44
int G_get_3dview_defaults(struct G_3dview *v, struct Cell_head *w)
Sets default for v based on w.
Definition: view.c:56
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.
Definition: view.c:160
#define REQ_KEYS
Definition: view.c:22