GRASS Programmer's Manual
6.5.svn(2014)-r66266
|
#include <stdlib.h>
#include <string.h>
#include <grass/gis.h>
#include <grass/ogsf_proto.h>
#include <grass/gstypes.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) |
ADD. 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 octohedron More... | |
float | OctoN [8][3] |
normals for flat-shaded octohedron 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 92 of file gsd_objs.c.
Referenced by gsd_arrow_onsurf(), and primitive_cylinder().
#define ONORM .57445626 |
Definition at line 44 of file gsd_objs.c.
#define ORIGIN origin |
Definition at line 93 of file gsd_objs.c.
Referenced by gsd_arrow(), and primitive_cylinder().
#define UP_NORM Octo[2] |
Definition at line 91 of file gsd_objs.c.
Referenced by gsd_arrow(), gsd_arrow_onsurf(), primitive_cone(), and primitive_cylinder().
void dir_to_slope_aspect | ( | float * | dir, |
float * | slope, | ||
float * | aspect, | ||
int | degrees | ||
) |
ADD.
dir | |
slope | |
ascpect | |
degrees |
Definition at line 756 of file gsd_objs.c.
Referenced by gsd_3darrow(), and gsd_arrow().
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 1081 of file gsd_objs.c.
References dir_to_slope_aspect(), first, G_debug(), GS_v3norm(), gsd_backface(), gsd_bgnlist(), gsd_calllist(), gsd_color_func(), gsd_endlist(), gsd_getshademodel(), gsd_makelist(), gsd_popmatrix(), gsd_pushmatrix(), gsd_rot(), gsd_scale(), gsd_shademodel(), gsd_translate(), primitive_cone(), primitive_cylinder(), X, and Y.
Referenced by gsd_norm_arrows().
void gsd_3dcursor | ( | float * | pt | ) |
Draw 3d cursor.
pt | point |
Definition at line 712 of file gsd_objs.c.
References gsd_bgnline(), gsd_endline(), gsd_vert_func(), X, and Y.
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 922 of file gsd_objs.c.
References dir_to_slope_aspect(), first, GS_P2distance(), GS_v3norm(), gsd_arrow_onsurf(), gsd_bgnline(), gsd_color_func(), gsd_endline(), gsd_popmatrix(), gsd_pushmatrix(), gsd_rot(), gsd_scale(), gsd_translate(), gsd_vert_func(), NULL, ORIGIN, UP_NORM, X, and Y.
Referenced by gsd_norm_arrows(), and gsd_wire_arrows().
Draw north arrow on surface.
base | |
tip | |
colr | |
wid | |
gs | surface (geosurf) |
Definition at line 994 of file gsd_objs.c.
References DOWN_NORM, first, G_debug(), GS_v3add(), GS_v3cross(), GS_v3dir(), GS_v3eq(), GS_v3mag(), GS_v3mult(), gsd_color_func(), gsd_disc(), gsd_line_onsurf(), gsd_linewidth(), UP_NORM, X, and Y.
Referenced by gsd_arrow().
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, and Y.
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 430 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, and Y.
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 328 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, and Y.
Referenced by gpd_obj().
void gsd_diamond_lines | ( | void | ) |
Draw diamond lines.
Definition at line 578 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 605 of file gsd_objs.c.
References gsd_color_func(), gsd_diamond_lines(), gsd_popmatrix(), gsd_pushmatrix(), gsd_rot(), gsd_scale(), gsd_translate(), X, and Y.
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 507 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, and Y.
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 660 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, and Y.
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 566 of file gsd_objs.c.
References gsd_color_func(), and gsd_sphere().
Referenced by GS_draw_lighting_model(), and GS_draw_lighting_model1().
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 190 of file gsd_objs.c.
References gsd_bgnline(), gsd_endline(), gsd_vert_func(), and gsdrape_get_segments().
Referenced by GS_draw_line_onsurf(), gsd_arrow_onsurf(), and gsd_x().
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 236 of file gsd_objs.c.
References gsd_bgnline(), gsd_endline(), gsd_vert_func(), gsdrape_get_segments(), X, and Y.
Referenced by GS_draw_nline_onsurf().
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 826 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_get_txtheight(), gsd_get_txtwidth(), gsd_popmatrix(), gsd_pushmatrix(), Ntop, X, and Y.
Referenced by Nviz_draw_all(), and Nviz_draw_arrow().
void gsd_plus | ( | float * | center, |
int | colr, | ||
float | siz | ||
) |
ADD.
center | center point |
colr | color value |
siz | size value |
Definition at line 153 of file gsd_objs.c.
References gsd_bgnline(), gsd_color_func(), gsd_endline(), gsd_vert_func(), X, and Y.
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 1160 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_get_txtheight(), gsd_get_txtwidth(), gsd_popmatrix(), gsd_pushmatrix(), Ntop, sprintf(), TRUE, X, and Y.
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 1248 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_linewidth(), gsd_popmatrix(), gsd_pushmatrix(), gsd_vert_func(), Ntop, X, and Y.
Referenced by Nviz_draw_all(), and Nviz_draw_scalebar().
void gsd_x | ( | geosurf * | gs, |
float * | center, | ||
int | colr, | ||
float | siz | ||
) |
ADD.
Note gs: NULL if flat
gs | surface (geosurf) |
center | |
colr | color value |
siz | size value |
Definition at line 279 of file gsd_objs.c.
References gsd_bgnline(), gsd_color_func(), gsd_endline(), gsd_line_onsurf(), gsd_vert_func(), X, and Y.
Referenced by gk_draw_path(), and 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 1311 of file gsd_objs.c.
References first, gsd_bgntfan(), gsd_endtfan(), gsd_litvert_func2(), ogverts, UP_NORM, X, and Y.
Referenced by gsd_3darrow().
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 1348 of file gsd_objs.c.
References DOWN_NORM, first, gsd_bgnqstrip(), gsd_bgntfan(), gsd_endqstrip(), gsd_endtfan(), gsd_litvert_func2(), ogverts, ogvertsplus, ORIGIN, and UP_NORM.
Referenced by gsd_3darrow().
float Box[8][3] |
Vertices for box.
Definition at line 1420 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 72 of file gsd_objs.c.
Referenced by gsd_cube().
float CubeVertices[8][3] |
Definition at line 78 of file gsd_objs.c.
Referenced by gsd_cube(), and gsd_draw_box().
float Octo[6][3] |
vertices for octohedron
Definition at line 35 of file gsd_objs.c.
Referenced by gsd_diamond(), gsd_diamond_lines(), and gsd_draw_gyro().
float OctoN[8][3] |
normals for flat-shaded octohedron
Definition at line 49 of file gsd_objs.c.
Referenced by gsd_diamond().
float ogverts[8][3] |
vertices & normals for octagon in xy plane
Definition at line 98 of file gsd_objs.c.
Referenced by primitive_cone(), and primitive_cylinder().
float ogvertsplus[8][3] |
vertices for octagon in xy plane, z=1
Definition at line 103 of file gsd_objs.c.
Referenced by primitive_cylinder().
float origin[3] = { 0.0, 0.0, 0.0 } |
Definition at line 89 of file gsd_objs.c.
float Pi |
Definition at line 105 of file gsd_objs.c.
Referenced by dir_to_slope_aspect().