GRASS GIS 7 Programmer's Manual  7.9.dev(2021)-e5379bbd7
view.c File Reference

GIS Library - 3D View functions. More...

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <grass/gis.h>
#include <grass/glocale.h>
Include dependency graph for view.c:

Go to the source code of this file.

Macros

#define REQ_KEYS   8
 

Functions

void G_3dview_warning (int b)
 Turns 3D View warnings on and off. More...
 
int G_get_3dview_defaults (struct G_3dview *v, struct Cell_head *w)
 Sets default for v based on w. More...
 
int G_put_3dview (const char *fname, const char *mapset, const struct G_3dview *View, const struct Cell_head *Win)
 Saves info to a 3d.view file. More...
 
int G_get_3dview (const char *fname, const char *mapset, struct G_3dview *View)
 Gets a 3D View. More...
 

Detailed Description

GIS Library - 3D View functions.

(C) 2001-2014 by the GRASS Development Team

This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.

Author
Bill Brown - US Army CERL
Date
1992-2008

Definition in file view.c.

Macro Definition Documentation

◆ REQ_KEYS

#define REQ_KEYS   8

Definition at line 24 of file view.c.

Function Documentation

◆ G_3dview_warning()

void G_3dview_warning ( int  b)

Turns 3D View warnings on and off.

If Suppress_warn is 0, a warning will be printed if less than 95% of the window when the view was saved overlaps the current window.

Parameters
[in]b
Returns

Definition at line 48 of file view.c.

◆ G_get_3dview()

int G_get_3dview ( const char *  fname,
const char *  mapset,
struct G_3dview View 
)

Gets a 3D View.

If reading an old format, the window boundaries are not checked against the current window since boundaries weren't saved.

Parameters
[in]fname
[in]mapset
[in,out]View
Returns
-1 on error
1 on success
2 if fname was written with this version of routine
0 if is older format (through 4.0)

Definition at line 251 of file view.c.

Referenced by Gs_load_3dview().

◆ G_get_3dview_defaults()

◆ G_put_3dview()

int G_put_3dview ( const char *  fname,
const char *  mapset,
const struct G_3dview View,
const struct Cell_head Win 
)

Saves info to a 3d.view file.

The address of a window (struct Cell_head *) may be passed, or if NULL is passed, the Cell_head structure inside the G_3dview struct will be used. e.g., if you called G_get_3dview_defaults with the Cell_head you want saved, the G_3dview returned already contains the new Cell_head. But if you're using all the keywords, so didn't need defaults, pass this routine the address of a Cell_head.

User should call G_get_3dview_defaults before filling a G_3dview struct to be written if not using all of the optional keywords.

These keywords are constant in all 3d.view files:
PGM_ID
cell keywords:
north
south
east
west
rows
cols
required keywords:
TO_EASTING
TO_NORTHING
TO_HEIGHT
FROM_EASTING
FROM_NORTHING
FROM_HEIGHT
Z_EXAG
FIELD_VIEW
optional keywords: (defaults provided when reading)
TWIST
MESH_FREQ
POLY_RES
DOAVG
DISPLAY_TYPE
DOZERO
COLORGRID
SHADING
FRINGE
BG_COL
GRID_COL
OTHER_COL
LIGHTS_ON
LIGHTPOS
LIGHTCOL
LIGHTAMBIENT
SHINE
SURFACEONLY

Parameters
[in]fnamefile name
[in]mapset
[in]View
[in]Win
Returns
1 on success
-1 on error

Definition at line 170 of file view.c.

References _, G_fopen_new(), G_warning(), and NULL.

Referenced by Gs_save_3dview().