GRASS GIS 7 Programmer's Manual
7.9.dev(2021)-e5379bbd7
|
#include <stdlib.h>
#include <string.h>
#include <grass/gis.h>
#include <grass/ogsf.h>
#include "gsget.h"
#include "math.h"
#include "rowcol.h"
Go to the source code of this file.
Macros | |
#define | ONORM .57445626 |
#define | UP_NORM Octo[2] |
#define | DOWN_NORM Octo[5] |
#define | ORIGIN origin |
Functions | |
void | gsd_plus (float *center, int colr, float siz) |
ADD. More... | |
void | gsd_line_onsurf (geosurf *gs, float *v1, float *v2) |
Line on surface, fix z-values. More... | |
int | gsd_nline_onsurf (geosurf *gs, float *v1, float *v2, float *pt, int n) |
Multiline on surface, fix z-values. More... | |
void | gsd_x (geosurf *gs, float *center, int colr, float siz) |
Draw X symbol. More... | |
void | gsd_diamond (float *center, unsigned long colr, float siz) |
Draw diamond symbol. More... | |
void | gsd_cube (float *center, unsigned long colr, float siz) |
Draw cube. More... | |
void | gsd_draw_box (float *center, unsigned long colr, float siz) |
Draw box. More... | |
void | gsd_drawsphere (float *center, unsigned long colr, float siz) |
Draw sphere. More... | |
void | gsd_diamond_lines (void) |
Draw diamond lines. More... | |
void | gsd_draw_asterisk (float *center, unsigned long colr, float siz) |
Draw asterisk. More... | |
void | gsd_draw_gyro (float *center, unsigned long colr, float siz) |
Draw gyro. More... | |
void | gsd_3dcursor (float *pt) |
Draw 3d cursor. More... | |
void | dir_to_slope_aspect (float *dir, float *slope, float *aspect, int degrees) |
ADD. More... | |
int | gsd_north_arrow (float *pos2, float len, GLuint fontbase, unsigned long arw_clr, unsigned long text_clr) |
Draw North Arrow takes OpenGL coords and size. More... | |
int | gsd_arrow (float *center, unsigned long colr, float siz, float *dir, float sz, geosurf *onsurf) |
ADD. More... | |
int | gsd_arrow_onsurf (float *base, float *tip, unsigned long colr, int wid, geosurf *gs) |
Draw north arrow on surface. More... | |
void | gsd_3darrow (float *center, unsigned long colr, float siz1, float siz2, float *dir, float sz) |
Draw 3d north arrow. More... | |
int | gsd_scalebar (float *pos2, float len, GLuint fontbase, unsigned long bar_clr, unsigned long text_clr) |
Draw Scalebar takes OpenGL coords and size. More... | |
int | gsd_scalebar_v2 (float *pos, float len, GLuint fontbase, unsigned long bar_clr, unsigned long text_clr) |
Draw Scalebar (as lines) More... | |
void | primitive_cone (unsigned long col) |
Primitives only called after transforms. More... | |
void | primitive_cylinder (unsigned long col, int caps) |
Primitives only called after transforms. More... | |
void | gsd_box (float *center, int colr, float *siz) |
Draw box. More... | |
Variables | |
float | Octo [6][3] |
vertices for octahedron More... | |
float | OctoN [8][3] |
normals for flat-shaded octahedron More... | |
float | CubeNormals [3][3] |
float | CubeVertices [8][3] |
float | origin [3] = { 0.0, 0.0, 0.0 } |
float | ogverts [8][3] |
vertices & normals for octagon in xy plane More... | |
float | ogvertsplus [8][3] |
vertices for octagon in xy plane, z=1 More... | |
float | Pi |
float | Box [8][3] |
Vertices for box. More... | |
float | BoxN [6][3] |
#define DOWN_NORM Octo[5] |
Definition at line 91 of file gsd_objs.c.
#define ONORM .57445626 |
Definition at line 43 of file gsd_objs.c.
#define ORIGIN origin |
Definition at line 92 of file gsd_objs.c.
#define UP_NORM Octo[2] |
Definition at line 90 of file gsd_objs.c.
void dir_to_slope_aspect | ( | float * | dir, |
float * | slope, | ||
float * | aspect, | ||
int | degrees | ||
) |
void gsd_3darrow | ( | float * | center, |
unsigned long | colr, | ||
float | siz1, | ||
float | siz2, | ||
float * | dir, | ||
float | sz | ||
) |
Draw 3d north arrow.
center | center point |
colr | color value |
siz1 | height |
siz2 | is diameter |
dir | |
sz |
Definition at line 1082 of file gsd_objs.c.
void gsd_3dcursor | ( | float * | pt | ) |
Draw 3d cursor.
pt | point |
Definition at line 711 of file gsd_objs.c.
References gsd_bgnline(), gsd_endline(), gsd_vert_func(), X, Y, and Z.
int gsd_arrow | ( | float * | center, |
unsigned long | colr, | ||
float | siz, | ||
float * | dir, | ||
float | sz, | ||
geosurf * | onsurf | ||
) |
ADD.
siz is height, sz is global exag to correct for.
If onsurf in non-null, z component of dir is dropped and line-on-suf is used, resulting in length of arrow being proportional to slope
center | center point |
colr | color value |
siz | size value |
dir | |
sz | |
onsurf | surface (geosurf) |
Definition at line 923 of file gsd_objs.c.
Referenced by gsd_wire_arrows().
int gsd_arrow_onsurf | ( | float * | base, |
float * | tip, | ||
unsigned long | colr, | ||
int | wid, | ||
geosurf * | gs | ||
) |
Draw north arrow on surface.
base | |
tip | |
colr | |
wid | |
gs | surface (geosurf) |
Definition at line 995 of file gsd_objs.c.
void gsd_box | ( | float * | center, |
int | colr, | ||
float * | siz | ||
) |
Draw box.
Warning siz is an array (we need it for scale only Z in histograms)
center | center point |
colr | color value |
siz | size value |
Definition at line 1440 of file gsd_objs.c.
References Box, BoxN, gsd_bgnpolygon(), gsd_endpolygon(), gsd_getshademodel(), gsd_litvert_func(), gsd_popmatrix(), gsd_pushmatrix(), gsd_scale(), gsd_shademodel(), gsd_translate(), X, Y, and Z.
Referenced by gpd_obj().
void gsd_cube | ( | float * | center, |
unsigned long | colr, | ||
float | siz | ||
) |
Draw cube.
Added by Hamish Bowman Nov 2005
center | center point |
colr | color value |
siz | size value |
Definition at line 429 of file gsd_objs.c.
References CubeNormals, CubeVertices, gsd_bgnpolygon(), gsd_endpolygon(), gsd_getshademodel(), gsd_litvert_func(), gsd_popmatrix(), gsd_pushmatrix(), gsd_scale(), gsd_shademodel(), gsd_translate(), X, Y, and Z.
Referenced by gpd_obj().
void gsd_diamond | ( | float * | center, |
unsigned long | colr, | ||
float | siz | ||
) |
Draw diamond symbol.
center | center point |
colr | color value |
size | size value |
Definition at line 327 of file gsd_objs.c.
References gsd_bgnpolygon(), gsd_bgntmesh(), gsd_endpolygon(), gsd_endtmesh(), gsd_getshademodel(), gsd_litvert_func(), gsd_popmatrix(), gsd_pushmatrix(), gsd_scale(), gsd_shademodel(), gsd_swaptmesh(), gsd_translate(), Octo, OctoN, X, Y, and Z.
Referenced by gpd_obj().
void gsd_diamond_lines | ( | void | ) |
Draw diamond lines.
Definition at line 577 of file gsd_objs.c.
References gsd_bgnline(), gsd_endline(), gsd_vert_func(), and Octo.
Referenced by gsd_draw_asterisk().
void gsd_draw_asterisk | ( | float * | center, |
unsigned long | colr, | ||
float | siz | ||
) |
Draw asterisk.
center | center point |
colr | color value |
siz | size value |
Definition at line 604 of file gsd_objs.c.
References gsd_color_func(), gsd_diamond_lines(), gsd_popmatrix(), gsd_pushmatrix(), gsd_rot(), gsd_scale(), gsd_translate(), X, Y, and Z.
Referenced by gpd_obj().
void gsd_draw_box | ( | float * | center, |
unsigned long | colr, | ||
float | siz | ||
) |
Draw box.
Added by Hamish Bowman Nov 2005
center | center point |
colr | color value |
siz | size value |
Definition at line 506 of file gsd_objs.c.
References CubeVertices, gsd_bgnline(), gsd_color_func(), gsd_endline(), gsd_popmatrix(), gsd_pushmatrix(), gsd_scale(), gsd_translate(), gsd_vert_func(), X, Y, and Z.
Referenced by gpd_obj().
void gsd_draw_gyro | ( | float * | center, |
unsigned long | colr, | ||
float | siz | ||
) |
Draw gyro.
center | center point |
colr | color value |
siz | size value |
Definition at line 659 of file gsd_objs.c.
References gsd_bgnline(), gsd_circ(), gsd_color_func(), gsd_endline(), gsd_popmatrix(), gsd_pushmatrix(), gsd_rot(), gsd_scale(), gsd_translate(), gsd_vert_func(), Octo, X, Y, and Z.
Referenced by gpd_obj().
void gsd_drawsphere | ( | float * | center, |
unsigned long | colr, | ||
float | siz | ||
) |
Draw sphere.
center | center point |
colr | color value |
size | size value |
Definition at line 565 of file gsd_objs.c.
References gsd_color_func(), and gsd_sphere().
void gsd_line_onsurf | ( | geosurf * | gs, |
float * | v1, | ||
float * | v2 | ||
) |
Line on surface, fix z-values.
gs | surface (geosurf) |
v1 | first point |
v2 | second point |
Definition at line 189 of file gsd_objs.c.
References FUDGE, gsd_bgnline(), gsd_endline(), gsd_vert_func(), gsdrape_get_segments(), and Z.
Referenced by gsd_x().
int gsd_nline_onsurf | ( | geosurf * | gs, |
float * | v1, | ||
float * | v2, | ||
float * | pt, | ||
int | n | ||
) |
Multiline on surface, fix z-values.
Like above, except only draws first n points of line, or np, whichever is less. Returns number of points used. Fills pt with last pt drawn.
gs | surface (geosurf) |
v1 | first point |
v2 | second point |
pt | |
n | number of segments |
number | of vertices |
Definition at line 235 of file gsd_objs.c.
References FUDGE, gsd_bgnline(), gsd_endline(), gsd_vert_func(), gsdrape_get_segments(), X, Y, and Z.
int gsd_north_arrow | ( | float * | pos2, |
float | len, | ||
GLuint | fontbase, | ||
unsigned long | arw_clr, | ||
unsigned long | text_clr | ||
) |
Draw North Arrow takes OpenGL coords and size.
pos2 | |
len | |
fontbase | |
arw_clr | north arrow color |
text_clr | text color |
Definition at line 827 of file gsd_objs.c.
References GS_done_draw(), GS_set_draw(), gsd_bgnpolygon(), gsd_color_func(), gsd_do_scale(), gsd_endpolygon(), gsd_flush(), GSD_FRONT, gsd_get_txtheight(), gsd_get_txtwidth(), gsd_popmatrix(), gsd_pushmatrix(), Ntop, X, Y, and Z.
void gsd_plus | ( | float * | center, |
int | colr, | ||
float | siz | ||
) |
ADD.
center | center point |
colr | color value |
siz | size value |
Definition at line 152 of file gsd_objs.c.
References gsd_bgnline(), gsd_color_func(), gsd_endline(), gsd_vert_func(), X, Y, and Z.
int gsd_scalebar | ( | float * | pos2, |
float | len, | ||
GLuint | fontbase, | ||
unsigned long | bar_clr, | ||
unsigned long | text_clr | ||
) |
Draw Scalebar takes OpenGL coords and size.
Adapted from gsd_north_arrow Hamish Bowman Dec 2006
pos2 | |
fontbase | font-base |
bar_clr | barscale color |
text_clr | text color |
Definition at line 1161 of file gsd_objs.c.
References G_database_unit_name(), GS_done_draw(), GS_set_draw(), gsd_bgnpolygon(), gsd_color_func(), gsd_do_scale(), gsd_endpolygon(), gsd_flush(), GSD_FRONT, gsd_get_txtheight(), gsd_get_txtwidth(), gsd_popmatrix(), gsd_pushmatrix(), Ntop, TRUE, X, Y, and Z.
int gsd_scalebar_v2 | ( | float * | pos, |
float | len, | ||
GLuint | fontbase, | ||
unsigned long | bar_clr, | ||
unsigned long | text_clr | ||
) |
Draw Scalebar (as lines)
Adapted from gsd_scalebar A.Kratochvilova 2011
pos2 | scalebar position |
fontbase | font-base (unused) |
bar_clr | barscale color |
text_clr | text color (unused) |
Definition at line 1249 of file gsd_objs.c.
References GS_done_draw(), GS_set_draw(), gsd_bgnline(), gsd_color_func(), gsd_do_scale(), gsd_endline(), gsd_flush(), GSD_FRONT, gsd_linewidth(), gsd_popmatrix(), gsd_pushmatrix(), gsd_vert_func(), Ntop, X, Y, and Z.
void gsd_x | ( | geosurf * | gs, |
float * | center, | ||
int | colr, | ||
float | siz | ||
) |
Draw X symbol.
Note gs: NULL if flat
gs | surface (geosurf) |
center | |
colr | color value |
siz | size value |
Definition at line 278 of file gsd_objs.c.
References gsd_bgnline(), gsd_color_func(), gsd_endline(), gsd_line_onsurf(), gsd_vert_func(), X, Y, and Z.
Referenced by gpd_obj().
void primitive_cone | ( | unsigned long | col | ) |
Primitives only called after transforms.
Center is actually center at base of 8 sided cone
col | color value |
Definition at line 1312 of file gsd_objs.c.
void primitive_cylinder | ( | unsigned long | col, |
int | caps | ||
) |
Primitives only called after transforms.
Center is actually center at base of 8 sided cylinder
col | color value |
caps |
Definition at line 1349 of file gsd_objs.c.
float Box[8][3] |
Vertices for box.
Definition at line 1421 of file gsd_objs.c.
Referenced by gsd_box().
float BoxN[6][3] |
float CubeNormals[3][3] |
???? not sure if any of these are needed for correct lighting. float CubeNormals[6][3] = { {ONORM, 0, 0}, {-ONORM, 0, 0}, {0, ONORM, 0}, {0, -ONORM, 0}, {0, 0, ONORM}, {0, 0, -ONORM} };
Definition at line 71 of file gsd_objs.c.
Referenced by gsd_cube().
float CubeVertices[8][3] |
Definition at line 77 of file gsd_objs.c.
Referenced by gsd_cube(), and gsd_draw_box().
float Octo[6][3] |
vertices for octahedron
Definition at line 34 of file gsd_objs.c.
Referenced by gsd_diamond(), gsd_diamond_lines(), and gsd_draw_gyro().
float OctoN[8][3] |
normals for flat-shaded octahedron
Definition at line 48 of file gsd_objs.c.
Referenced by gsd_diamond().
float ogverts[8][3] |
vertices & normals for octagon in xy plane
Definition at line 97 of file gsd_objs.c.
float ogvertsplus[8][3] |
vertices for octagon in xy plane, z=1
Definition at line 102 of file gsd_objs.c.
float origin[3] = { 0.0, 0.0, 0.0 } |
Definition at line 88 of file gsd_objs.c.
float Pi |
Definition at line 104 of file gsd_objs.c.
Referenced by dir_to_slope_aspect().