GRASS GIS 8 Programmer's Manual
8.5.0dev(2024)-d6dec75dd4
|
OGSF library - loading surfaces (lower level functions) More...
#include <stdlib.h>
#include <string.h>
#include <grass/gis.h>
#include <grass/raster.h>
#include <grass/glocale.h>
#include <grass/bitmap.h>
#include <grass/ogsf.h>
#include "gsget.h"
Go to the source code of this file.
Macros | |
#define | INIT_MINMAX(p, nm, size, min, max, found) |
Used in the function Gs_update_attrange() More... | |
#define | SET_MINMAX(p, nm, size, min, max) |
Used in the function Gs_update_attrange() More... | |
#define | NO_DATA_COL 0xffffff |
Typedefs | |
typedef int | FILEDESC |
Functions | |
double | Gs_distance (double *from, double *to) |
Calculates distance in METERS between two points in current projection (2D) More... | |
int | Gs_loadmap_as_float (struct Cell_head *wind, const char *map_name, float *buff, struct BM *nullmap, int *has_null) |
Load raster map as floating point map. More... | |
int | Gs_loadmap_as_int (struct Cell_head *wind, const char *map_name, int *buff, struct BM *nullmap, int *has_null) |
Load raster map as integer map. More... | |
int | Gs_numtype (const char *filename, int *negflag) |
Get map data type. More... | |
int | Gs_loadmap_as_short (struct Cell_head *wind, const char *map_name, short *buff, struct BM *nullmap, int *has_null) |
Load raster map as integer map. More... | |
int | Gs_loadmap_as_char (struct Cell_head *wind, const char *map_name, unsigned char *buff, struct BM *nullmap, int *has_null) |
Load raster map as integer map. More... | |
int | Gs_loadmap_as_bitmap (struct Cell_head *wind, const char *map_name, struct BM *buff) |
Load raster map as integer map. More... | |
int | Gs_build_256lookup (const char *filename, int *buff) |
Build color table (256) More... | |
void | Gs_pack_colors (const char *filename, int *buff, int rows, int cols) |
Pack color table. More... | |
void | Gs_pack_colors_float (const char *filename, float *fbuf, int *ibuf, int rows, int cols) |
Pack color table (floating-point map) More... | |
int | Gs_get_cat_label (const char *filename, int drow, int dcol, char *catstr) |
Get categories/labels. More... | |
int | Gs_save_3dview (const char *vname, geoview *gv, geodisplay *gd UNUSED, struct Cell_head *w, geosurf *defsurf) |
Save 3dview. More... | |
int | Gs_load_3dview (const char *vname, geoview *gv, geodisplay *gd UNUSED, struct Cell_head *w, const geosurf *defsurf) |
Load 3dview. More... | |
int | Gs_update_attrange (geosurf *gs, int desc) |
Update no_zero ranges for attribute (actually no_null now) More... | |
OGSF library - loading surfaces (lower level functions)
GRASS OpenGL gsurf OGSF Library
(C) 1999-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.
Definition in file gs3.c.
Used in the function Gs_update_attrange()
Used in the function Gs_update_attrange()
int Gs_build_256lookup | ( | const char * | filename, |
int * | buff | ||
) |
double Gs_distance | ( | double * | from, |
double * | to | ||
) |
Calculates distance in METERS between two points in current projection (2D)
Uses G_distance().
from | 'from' point (X, Y) |
to | 'to' point (X, Y) |
Definition at line 79 of file gs3.c.
Referenced by GS_geodistance().
int Gs_get_cat_label | ( | const char * | filename, |
int | drow, | ||
int | dcol, | ||
char * | catstr | ||
) |
Get categories/labels.
Formats label as in d.what.rast -> (catval) catlabel
filename | raster map name |
drow | |
dcol | |
catstr | category string |
Definition at line 770 of file gs3.c.
Referenced by GS_get_cat_at_xy().
int Gs_load_3dview | ( | const char * | vname, |
geoview * | gv, | ||
geodisplay *gd | UNUSED, | ||
struct Cell_head * | w, | ||
const geosurf * | defsurf | ||
) |
Load 3dview.
vname | view name |
gv | pointer to geoview struct |
gd | pointer to geodisplay struct (unused) |
w | current window |
defsurf | default geosurf struct |
Definition at line 945 of file gs3.c.
References _, G_3dview::ambient, lightdefs::ambient, lightdefs::color, G_3dview::colorgrid, G_3dview::display_type, DM_COL_WIRE, DM_GOURAUD, DM_POLY, DM_WIRE, DM_WIRE_POLY, Cell_head::ew_res, G_3dview::exag, G_3dview::fov, FROM, G_3dview::from_to, G_find_file2(), G_get_3dview(), G_warning(), GS_alldraw_wire(), GS_moveto_real(), GS_set_focus(), GS_set_fov(), GS_set_global_exag(), GS_set_twist(), GS_setall_drawmode(), GS_setall_drawres(), G_3dview::lightcol, G_3dview::lightpos, geoview::lights, G_3dview::lightson, G_3dview::mesh_freq, Cell_head::ns_res, NULL, G_3dview::pgm_id, G_3dview::poly_freq, lightdefs::position, G_3dview::shading, G_3dview::shine, lightdefs::shine, Cell_head::south, TO, G_3dview::twist, G_3dview::vwin, Cell_head::west, X, Y, and Z.
Load raster map as integer map.
Calling function must have already allocated space in buff for struct BM of wind->rows & wind->cols.
This routine simply loads the map into the bitmap by repetitve calls to get_map_row. Any value other than 0 in the map will set the bitmap. (may want to change later to allow specific value to set)
Changed to use null.
wind | current window | |
map_name | raster map name | |
[out] | buff | data buffer |
int Gs_loadmap_as_char | ( | struct Cell_head * | wind, |
const char * | map_name, | ||
unsigned char * | buff, | ||
struct BM * | nullmap, | ||
int * | has_null | ||
) |
Load raster map as integer map.
Calling function must have already allocated space in buff for wind->rows * wind->cols unsigned chars.
This routine simply loads the map into a 2d array by repetitve calls to get_map_row.
Since signs of chars can be tricky, we only load positive chars between 0-255.
wind | current window | |
map_name | raster map name | |
[out] | buff | data buffer |
[out] | nullmap | null map buffer |
[out] | has_null | indicates if raster map contains null-data |
int Gs_loadmap_as_float | ( | struct Cell_head * | wind, |
const char * | map_name, | ||
float * | buff, | ||
struct BM * | nullmap, | ||
int * | has_null | ||
) |
Load raster map as floating point map.
Calling function must have already allocated space in buff for wind->rows * wind->cols floats.
This routine simply loads the map into a 2d array by repetitve calls to get_f_raster_row.
wind | current window | |
map_name | raster map name | |
[out] | buff | data buffer |
[out] | nullmap | null map buffer |
[out] | has_null | indicates if raster map contains null-data |
int Gs_loadmap_as_int | ( | struct Cell_head * | wind, |
const char * | map_name, | ||
int * | buff, | ||
struct BM * | nullmap, | ||
int * | has_null | ||
) |
Load raster map as integer map.
Calling function must have already allocated space in buff for wind->rows * wind->cols floats.
This routine simply loads the map into a 2d array by repetitve calls to get_f_raster_row.
wind | current window | |
map_name | raster map name | |
[out] | buff | data buffer |
[out] | nullmap | null map buffer |
[out] | has_null | indicates if raster map contains null-data |
int Gs_loadmap_as_short | ( | struct Cell_head * | wind, |
const char * | map_name, | ||
short * | buff, | ||
struct BM * | nullmap, | ||
int * | has_null | ||
) |
Load raster map as integer map.
Calling function must have already allocated space in buff for wind->rows * wind->cols shorts.
This routine simply loads the map into a 2d array by repetitve calls to get_map_row.
wind | current window | |
map_name | raster map name | |
[out] | buff | data buffer |
[out] | nullmap | null map buffer |
[out] | has_null | indicates if raster map contains null-data |
int Gs_numtype | ( | const char * | filename, |
int * | negflag | ||
) |
Get map data type.
filename | raster map name |
negflag |
void Gs_pack_colors | ( | const char * | filename, |
int * | buff, | ||
int | rows, | ||
int | cols | ||
) |
void Gs_pack_colors_float | ( | const char * | filename, |
float * | fbuf, | ||
int * | ibuf, | ||
int | rows, | ||
int | cols | ||
) |
Pack color table (floating-point map)
Passed a array of floats that will be converted from cell values to packed colors (0xbbggrr) and float to int Floating point data not freed here, use: gsds_free_data_buff(id, ATTY_FLOAT)
filename | raster map name |
fbuf | |
ibuf | |
rows | number of rows |
cols | number of cols |
int Gs_save_3dview | ( | const char * | vname, |
geoview * | gv, | ||
geodisplay *gd | UNUSED, | ||
struct Cell_head * | w, | ||
geosurf * | defsurf | ||
) |
Save 3dview.
vname | view name |
gv | pointer to geoview struct |
gd | pointer to geodisplay struct (unused) |
w | current window |
defsurf | default geosurf struct |
Definition at line 846 of file gs3.c.
References G_3dview::ambient, lightdefs::ambient, lightdefs::color, G_3dview::colorgrid, G_3dview::display_type, DM_COL_WIRE, DM_GOURAUD, DM_POLY, DM_WIRE, DM_WIRE_POLY, G_3dview::dozero, g_surf::draw_mode, G_3dview::exag, G_3dview::fov, geoview::fov, G_3dview::fringe, FROM, G_3dview::from_to, geoview::from_to, G_get_3dview_defaults(), G_mapset(), G_put_3dview(), GS_get_zrange(), GS_v3eq(), GS_v3mult(), gsd_model2real(), geoview::infocus, G_3dview::lightcol, G_3dview::lightpos, geoview::lights, G_3dview::lightson, G_3dview::mesh_freq, NULL, g_surf::nz_topo, G_3dview::pgm_id, G_3dview::poly_freq, lightdefs::position, geoview::real_to, geoview::scale, G_3dview::shading, G_3dview::shine, lightdefs::shine, strcpy, G_3dview::surfonly, TO, G_3dview::twist, geoview::twist, geoview::vert_exag, W, X, g_surf::x_mod, g_surf::x_modw, Y, and Z.
int Gs_update_attrange | ( | geosurf * | gs, |
int | desc | ||
) |
Update no_zero ranges for attribute (actually no_null now)
gs | pointer to geosurf struct |
desc | attribute id (descriptor) |
Definition at line 1078 of file gs3.c.
References g_surf::att, ATT_TOPO, typbuff::cb, CF_COLOR_PACKED, g_surf::cols, CONST_ATT, gsurf_att::constant, typbuff::fb, G_debug(), gs_get_att_src(), gsds_get_changed(), gsds_get_typbuff(), gsurf_att::hdata, typbuff::ib, INIT_MINMAX, max, gsurf_att::max_nz, min, gsurf_att::min_nz, typbuff::nm, NULL, gsurf_att::range_nz, g_surf::rows, typbuff::sb, SET_MINMAX, g_surf::zmax, g_surf::zmax_nz, g_surf::zmin, g_surf::zmin_nz, g_surf::zminmasked, g_surf::zrange, and g_surf::zrange_nz.
Referenced by gs_set_att_const(), and GS_set_att_const().