GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
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

int 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-2008 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

#define REQ_KEYS   8

Definition at line 24 of file view.c.

Referenced by G_get_3dview().

Function Documentation

int 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
always returns 0

Definition at line 47 of file view.c.

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 252 of file view.c.

References fclose(), G_find_file2(), G_fopen_old(), G_format_easting(), G_format_northing(), G_get_3dview_defaults(), G_get_set_window(), G_projection(), G_warning(), NULL, and REQ_KEYS.

Referenced by Gs_load_3dview().

int G_get_3dview_defaults ( struct G_3dview *  v,
struct Cell_head *  w 
)

Sets default for v based on w.

Parameters
[in,out]v
[in]w
Returns
always returns 1

Definition at line 63 of file view.c.

Referenced by G_get_3dview(), and Gs_save_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 171 of file view.c.

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

Referenced by Gs_save_3dview().