GRASS GIS 8 Programmer's Manual  8.2.2dev(2023)-3d2c704037
nviz.c File Reference

Nviz library – Data management. More...

#include <grass/colors.h>
#include <grass/raster.h>
#include <grass/glocale.h>
#include <grass/nviz.h>
Include dependency graph for nviz.c:

Go to the source code of this file.

Functions

void Nviz_init_data (nv_data *data)
 Initialize Nviz data. More...
 
void Nviz_destroy_data (nv_data *data)
 Free allocated space by nv_data struct. More...
 
void Nviz_set_bgcolor (nv_data *data, int color)
 Set background color. More...
 
int Nviz_get_bgcolor (nv_data *data)
 Get background color. More...
 
int Nviz_color_from_str (const char *color_str)
 Get color value from color string (name or RGB triplet) More...
 
struct fringe_dataNviz_new_fringe (nv_data *data, int id, unsigned long color, double elev, int nw, int ne, int sw, int se)
 
struct fringe_dataNviz_set_fringe (nv_data *data, int id, unsigned long color, double elev, int nw, int ne, int sw, int se)
 
void Nviz_draw_fringe (nv_data *data)
 
int Nviz_set_arrow (nv_data *data, int sx, int sy, float size, unsigned int color)
 Sets the North Arrow position and return world coords. More...
 
int Nviz_draw_arrow (nv_data *data)
 Draws the North Arrow. More...
 
void Nviz_delete_arrow (nv_data *data)
 Deletes the North Arrow. More...
 
struct scalebar_dataNviz_new_scalebar (nv_data *data, int bar_id, float *coords, float size, unsigned int color)
 
struct scalebar_dataNviz_set_scalebar (nv_data *data, int bar_id, int sx, int sy, float size, unsigned int color)
 Sets the scale bar position and return world coords. More...
 
void Nviz_draw_scalebar (nv_data *data)
 Draws the Scale bar. More...
 
void Nviz_delete_scalebar (nv_data *data, int bar_id)
 Deletes scale bar. More...
 

Detailed Description

Nviz library – Data management.

Based on visualization/nviz/src/

(C) 2008, 2010 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
Updated/modified by Martin Landa <landa.martin gmail.com> (Google SoC 2008/2010)

Definition in file nviz.c.

Function Documentation

◆ Nviz_color_from_str()

int Nviz_color_from_str ( const char *  color_str)

Get color value from color string (name or RGB triplet)

Parameters
color_strcolor string
Returns
color value

Definition at line 123 of file nviz.c.

References _, BLU_MASK, G_str_to_color(), G_warning(), GRN_MASK, and RED_MASK.

◆ Nviz_delete_arrow()

void Nviz_delete_arrow ( nv_data data)

Deletes the North Arrow.

Parameters
datanviz data

Definition at line 315 of file nviz.c.

◆ Nviz_delete_scalebar()

void Nviz_delete_scalebar ( nv_data data,
int  bar_id 
)

Deletes scale bar.

When scalebar is freed, array then contains NULL, which must be tested during drawing.

Parameters
datanviz data

Definition at line 436 of file nviz.c.

◆ Nviz_destroy_data()

void Nviz_destroy_data ( nv_data data)

Free allocated space by nv_data struct.

Parameters
datanviz data

Definition at line 67 of file nviz.c.

◆ Nviz_draw_arrow()

int Nviz_draw_arrow ( nv_data data)

Draws the North Arrow.

Parameters
datanviz data

Definition at line 298 of file nviz.c.

◆ Nviz_draw_fringe()

void Nviz_draw_fringe ( nv_data data)

Draw fringe

Parameters
datanviz data

Definition at line 233 of file nviz.c.

◆ Nviz_draw_scalebar()

void Nviz_draw_scalebar ( nv_data data)

Draws the Scale bar.

Parameters
datanviz data

Definition at line 413 of file nviz.c.

◆ Nviz_get_bgcolor()

int Nviz_get_bgcolor ( nv_data data)

Get background color.

Parameters
datanviz data
Returns
color color value

Definition at line 111 of file nviz.c.

◆ Nviz_init_data()

void Nviz_init_data ( nv_data data)

Initialize Nviz data.

Parameters
datanviz data

Definition at line 25 of file nviz.c.

◆ Nviz_new_fringe()

struct fringe_data* Nviz_new_fringe ( nv_data data,
int  id,
unsigned long  color,
double  elev,
int  nw,
int  ne,
int  sw,
int  se 
)

Add new fringe

Parameters
datanviz data
idsurface id
colorcolor
elevfringe elevation
nw,ne,sw,se1 (turn on) 0 (turn off)
Returns
pointer to allocated fringe_data structure
NULL on error

Definition at line 148 of file nviz.c.

◆ Nviz_new_scalebar()

struct scalebar_data* Nviz_new_scalebar ( nv_data data,
int  bar_id,
float *  coords,
float  size,
unsigned int  color 
)

Add new scalebar

Parameters
datanviz data
bar_idscale bar id
coordsreal(?) coordinates
sizescale bar length
colorscalebar/text color
Returns
pointer to allocated scalebar_data structure
NULL on error

Definition at line 334 of file nviz.c.

◆ Nviz_set_arrow()

int Nviz_set_arrow ( nv_data data,
int  sx,
int  sy,
float  size,
unsigned int  color 
)

Sets the North Arrow position and return world coords.

Parameters
datanviz data
sx,syscreen coordinates
sizearrow length
colorarrow/text color

Definition at line 251 of file nviz.c.

◆ Nviz_set_bgcolor()

void Nviz_set_bgcolor ( nv_data data,
int  color 
)

Set background color.

Parameters
datanviz data
colorcolor value

Definition at line 97 of file nviz.c.

◆ Nviz_set_fringe()

struct fringe_data* Nviz_set_fringe ( nv_data data,
int  id,
unsigned long  color,
double  elev,
int  nw,
int  ne,
int  sw,
int  se 
)

Set fringe

Parameters
datanviz data
idsurface id
colorcolor
elevfringe elevation
nw,ne,sw,se1 (turn on) 0 (turn off)
Returns
pointer to allocated fringe_data structure
NULL on error

Definition at line 192 of file nviz.c.

◆ Nviz_set_scalebar()

struct scalebar_data* Nviz_set_scalebar ( nv_data data,
int  bar_id,
int  sx,
int  sy,
float  size,
unsigned int  color 
)

Sets the scale bar position and return world coords.

Parameters
datanviz data
bar_idscale bar id
sx,syscreen coordinates
sizescale bar length
colorscalebar/text color
Returns
pointer to allocated scalebar_data structure
NULL when there's no surface

Definition at line 368 of file nviz.c.