35#define INIT_MINMAX(p, nm, size, min, max, found) \
39 if (!BM_GET_BYOFFSET(nm, size)) { \
50#define SET_MINMAX(p, nm, size, min, max) \
53 if (!BM_GET_BYOFFSET(nm, size)) { \
57 else if (*p > max) { \
66#define NO_DATA_COL 0xffffff
88 return G_distance(from[0], from[1], to[0], to[1]);
114 int offset, row,
col;
116 G_debug(3,
"Gs_loadmap_as_float(): name=%s", map_name);
120 G_warning(
_(
"Raster map <%s> not found"), map_name);
130 for (row = 0; row < wind->
rows; row++) {
131 offset = row * wind->
cols;
179 int offset, row,
col;
181 G_debug(3,
"Gs_loadmap_as_int");
185 G_warning(
_(
"Raster map <%s> not found"), map_name);
195 for (row = 0; row < wind->
rows; row++) {
196 offset = row * wind->
cols;
234 static int first = 1;
261 G_warning(
_(
"Raster map <%s> not found"), filename);
266 G_debug(3,
"Gs_numtype(): fp map detected");
318 G_debug(3,
"Gs_loadmap_as_short");
333 G_warning(
_(
"Raster map <%s> not found"), map_name);
348 for (row = 0; row < wind->
rows; row++) {
349 offset = row * wind->
cols;
354 ts = &(buff[offset]);
386 return (overflow ? -2 : 1);
424 G_debug(3,
"Gs_loadmap_as_char");
440 G_warning(
_(
"Raster map <%s> not found"), map_name);
455 for (row = 0; row < wind->
rows; row++) {
456 offset = row * wind->
cols;
458 tc = (
unsigned char *)&(buff[offset]);
494 return (overflow ? -2 : 1);
524 G_debug(3,
"Gs_loadmap_as_bitmap");
528 G_warning(
_(
"Raster map <%s> not found"), map_name);
542 for (row = 0; row < wind->
rows; row++) {
582 unsigned char r[256],
g[256],
b[256], set[256];
584 G_debug(3,
"building color table");
588 G_warning(
_(
"Raster map <%s> not found"), filename);
597 _(
"Color table range doesn't match data (mincol=%d, maxcol=%d"),
606 for (i =
min; i <=
max; i++) {
612 for (i = 0; i < 256; i++) {
616 (
r[i] & 0xff) | ((
g[i] & 0xff) << 8) | ((
b[i] & 0xff) << 16);
641 unsigned char *
r, *
g, *
b, *set;
646 G_warning(
_(
"Raster map <%s> not found"), filename);
653 set = (
unsigned char *)
G_malloc(cols);
662 for (i = 0; i < rows; i++) {
666 for (
j = 0;
j < cols;
j++) {
668 cur[
j] = (
r[
j] & 0xff) | ((
g[
j] & 0xff) << 8) |
669 ((
b[
j] & 0xff) << 16);
710 unsigned char *
r, *
g, *
b, *set;
716 G_warning(
_(
"Raster map <%s> not found"), filename);
723 set = (
unsigned char *)
G_malloc(cols);
733 for (i = 0; i < rows; i++) {
737 for (
j = 0;
j < cols;
j++) {
739 icur[
j] = (
r[
j] & 0xff) | ((
g[
j] & 0xff) << 8) |
740 ((
b[
j] & 0xff) << 16);
786 G_warning(
_(
"Raster map <%s> not found"), filename);
864 if (mapset !=
NULL) {
900 v.
fov =
gv->fov / 10.;
906 if (
gv->lights[0].position[
W] == 1) {
925 v.
ambient = (
gv->lights[0].ambient[0] +
gv->lights[0].ambient[1] +
926 gv->lights[0].ambient[2]) /
960 if (mapset !=
NULL) {
967 "there may be some inconsistencies"));
1035 (
int)(v.
fov > 0 ? v.
fov * 10. + 0.5 : v.
fov * 10. - 0.5));
1061 gv->lights[0].shine = v.
shine;
1064 gv->lights[0].ambient[0] =
gv->lights[0].ambient[1] =
1065 gv->lights[0].ambient[2] = v.
ambient * 3.;
1093 gs->att[desc].max_nz =
gs->att[desc].min_nz =
gs->att[desc].range_nz = 0.0;
1096 gs->att[desc].max_nz =
gs->att[desc].min_nz =
gs->att[desc].constant;
1097 min =
max =
gs->att[desc].constant;
1098 gs->att[desc].range_nz = 0.0;
1101 gs->att[desc].max_nz = 0xFFFFFF;
1102 gs->att[desc].min_nz = 0x010101;
1103 gs->att[desc].range_nz = 0xFFFFFF;
1177 gs->att[desc].max_nz =
max;
1178 gs->att[desc].min_nz =
min;
1179 gs->att[desc].range_nz =
gs->att[desc].max_nz -
gs->att[desc].min_nz;
1185 gs->zrange =
gs->zmax -
gs->zmin;
1186 gs->zminmasked =
gs->zmin;
1187 gs->zmax_nz =
gs->zmax;
1188 gs->zmin_nz =
gs->zmin;
1189 gs->zrange_nz =
gs->zmax_nz -
gs->zmin_nz;
1192 G_debug(3,
"Gs_update_attrange(): min=%f max=%f",
gs->zmin,
gs->zmax);
int BM_set(struct BM *, int, int, int)
Sets bitmap value to 'val' at location 'x' 'y'.
void G_percent(long, long, int)
Print percent complete messages.
void G_zero(void *, int)
Zero out a buffer, buf, of length i.
void G_free(void *)
Free allocated memory.
void G_warning(const char *,...) __attribute__((format(printf
int G_get_3dview(const char *, const char *, struct G_3dview *)
Gets a 3D View.
const char * G_find_file2(const char *, const char *, const char *)
Searches for a file from the mapset search list or in a specified mapset. (look but don't touch)
char * G_fully_qualified_name(const char *, const char *)
Get fully qualified element name.
int G_put_3dview(const char *, const struct G_3dview *, const struct Cell_head *)
Saves info to a 3d.view file in the current mapset.
double G_distance(double, double, double, double)
Returns distance in meters.
void G_message(const char *,...) __attribute__((format(printf
int G_debug(int, const char *,...) __attribute__((format(printf
const char * G_find_raster2(const char *, const char *)
Find a raster map (look but don't touch)
int G_get_3dview_defaults(struct G_3dview *, struct Cell_head *)
Sets default for v based on w.
const char * G_mapset(void)
Get current mapset name.
int int G_begin_distance_calculations(void)
Begin distance calculations.
void GS_v3mult(float *, float)
Multiple vectors.
void GS_set_fov(int)
Set field of view.
void GS_alldraw_wire(void)
Draw all wires.
int GS_get_zrange(float *, float *, int)
Get z-extent for all loaded surfaces.
int GS_setall_drawmode(int)
Set all draw-modes.
int gs_get_att_src(geosurf *, int)
Get attribute source.
void GS_set_focus(float *)
Set focus.
void GS_set_twist(int)
Set viewpoint twist value.
void GS_v3eq(float *, float *)
Copy vector values.
int GS_setall_drawres(int, int, int, int)
Set all draw resolutions.
void GS_set_global_exag(float)
Set global z-exag value.
void GS_moveto_real(float *)
Move position to (real)
int gsds_get_changed(int)
ADD.
void gsd_model2real(Point3)
Convert model to real coordinates.
typbuff * gsds_get_typbuff(int, IFLAG)
void Rast_free_cats(struct Categories *)
Free category structure memory.
CELL * Rast_allocate_c_buf(void)
Allocate memory for a CELL type raster map.
DCELL * Rast_allocate_d_buf(void)
Allocates memory for a raster map of type DCELL.
int Rast_read_colors(const char *, const char *, struct Colors *)
Read color table of raster map.
int Rast_read_cats(const char *, const char *, struct Categories *)
Read raster category file.
#define Rast_is_f_null_value(fcellVal)
void Rast_lookup_f_colors(const FCELL *, unsigned char *, unsigned char *, unsigned char *, unsigned char *, int, struct Colors *)
Lookup an array of colors (FCELL)
void Rast_close(int)
Close a raster map.
int Rast_open_old(const char *, const char *)
Open an existing integer raster map (cell)
void Rast_free_colors(struct Colors *)
Free color structure memory.
char * Rast_get_c_cat(CELL *, struct Categories *)
Get a raster category label (CELL)
void Rast_get_c_row(int, CELL *, int)
Get raster row (CELL type)
void Rast_get_f_row(int, FCELL *, int)
Get raster row (FCELL type)
void Rast_get_d_row(int, DCELL *, int)
Get raster row (DCELL type)
void Rast_get_c_color_range(CELL *, CELL *, const struct Colors *)
Get color range values (CELL)
void Rast_get_range_min_max(const struct Range *, CELL *, CELL *)
Get range min and max.
int Rast_read_range(const char *, const char *, struct Range *)
Read raster range (CELL)
int Rast_map_is_fp(const char *, const char *)
Check if raster map is floating-point.
#define Rast_is_d_null_value(dcellVal)
#define Rast_is_c_null_value(cellVal)
void Rast_lookup_c_colors(const CELL *, unsigned char *, unsigned char *, unsigned char *, unsigned char *, int, struct Colors *)
Lookup an array of colors.
char * Rast_get_d_cat(DCELL *, struct Categories *)
Get a raster category label (DCELL)
RASTER_MAP_TYPE Rast_get_map_type(int)
Determine raster type from descriptor.
#define UNUSED
A macro for an attribute, if attached to a variable, indicating that the variable is not used.
int Gs_load_3dview(const char *vname, geoview *gv, geodisplay *gd, struct Cell_head *w, const geosurf *defsurf)
Load 3dview.
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.
int Gs_loadmap_as_bitmap(struct Cell_head *wind, const char *map_name, struct BM *buff)
Load raster map as integer map.
int Gs_numtype(const char *filename, int *negflag)
Get map data type.
void Gs_pack_colors(const char *filename, int *buff, int rows, int cols)
Pack color table.
void Gs_pack_colors_float(const char *filename, float *fbuf, int *ibuf, int rows, int cols)
Pack color table (floating-point map)
#define INIT_MINMAX(p, nm, size, min, max, found)
Used in the function Gs_update_attrange()
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.
int Gs_save_3dview(const char *vname, geoview *gv, geodisplay *gd, struct Cell_head *w, geosurf *defsurf)
Save 3dview.
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.
int Gs_get_cat_label(const char *filename, int drow, int dcol, char *catstr)
Get categories/labels.
#define SET_MINMAX(p, nm, size, min, max)
Used in the function Gs_update_attrange()
double Gs_distance(double *from, double *to)
Calculates distance in METERS between two points in current projection (2D)
int Gs_build_256lookup(const char *filename, int *buff)
Build color table (256)
int Gs_update_attrange(geosurf *gs, int desc)
Update no_zero ranges for attribute (actually no_null now)
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.
OGSF header file (structures)
2D/3D raster map header (used also for region)
double ew_res
Resolution - east to west cell size for 2D data.
double ns_res
Resolution - north to south cell size for 2D data.
int rows
Number of rows for 2D data.
int cols
Number of columns for 2D data.
double south
Extent coordinates (south)
double west
Extent coordinates (west)