31#define INIT_MINMAX(p, nm, size, min, max, found) \
35 if (!BM_GET_BYOFFSET(nm, size)) { \
46#define SET_MINMAX(p, nm, size, min, max) \
49 if (!BM_GET_BYOFFSET(nm, size)) { \
53 else if (*p > max) { \
62#define NO_DATA_COL 0xffffff
84 return G_distance(from[0], from[1], to[0], to[1]);
110 int offset, row,
col;
112 G_debug(3,
"Gs_loadmap_as_float(): name=%s", map_name);
116 G_warning(
_(
"Raster map <%s> not found"), map_name);
126 for (row = 0; row < wind->
rows; row++) {
127 offset = row * wind->
cols;
175 int offset, row,
col;
177 G_debug(3,
"Gs_loadmap_as_int");
181 G_warning(
_(
"Raster map <%s> not found"), map_name);
191 for (row = 0; row < wind->
rows; row++) {
192 offset = row * wind->
cols;
230 static int first = 1;
257 G_warning(
_(
"Raster map <%s> not found"), filename);
262 G_debug(3,
"Gs_numtype(): fp map detected");
314 G_debug(3,
"Gs_loadmap_as_short");
329 G_warning(
_(
"Raster map <%s> not found"), map_name);
344 for (row = 0; row < wind->
rows; row++) {
345 offset = row * wind->
cols;
350 ts = &(buff[offset]);
382 return (overflow ? -2 : 1);
420 G_debug(3,
"Gs_loadmap_as_char");
436 G_warning(
_(
"Raster map <%s> not found"), map_name);
451 for (row = 0; row < wind->
rows; row++) {
452 offset = row * wind->
cols;
454 tc = (
unsigned char *)&(buff[offset]);
490 return (overflow ? -2 : 1);
520 G_debug(3,
"Gs_loadmap_as_bitmap");
524 G_warning(
_(
"Raster map <%s> not found"), map_name);
538 for (row = 0; row < wind->
rows; row++) {
578 unsigned char r[256],
g[256],
b[256], set[256];
580 G_debug(3,
"building color table");
584 G_warning(
_(
"Raster map <%s> not found"), filename);
593 _(
"Color table range doesn't match data (mincol=%d, maxcol=%d"),
602 for (i =
min; i <=
max; i++) {
608 for (i = 0; i < 256; i++) {
612 (
r[i] & 0xff) | ((
g[i] & 0xff) << 8) | ((
b[i] & 0xff) << 16);
637 unsigned char *
r, *
g, *
b, *set;
642 G_warning(
_(
"Raster map <%s> not found"), filename);
649 set = (
unsigned char *)
G_malloc(cols);
658 for (i = 0; i < rows; i++) {
662 for (
j = 0;
j < cols;
j++) {
664 cur[
j] = (
r[
j] & 0xff) | ((
g[
j] & 0xff) << 8) |
665 ((
b[
j] & 0xff) << 16);
706 unsigned char *
r, *
g, *
b, *set;
712 G_warning(
_(
"Raster map <%s> not found"), filename);
719 set = (
unsigned char *)
G_malloc(cols);
729 for (i = 0; i < rows; i++) {
733 for (
j = 0;
j < cols;
j++) {
735 icur[
j] = (
r[
j] & 0xff) | ((
g[
j] & 0xff) << 8) |
736 ((
b[
j] & 0xff) << 16);
782 G_warning(
_(
"Raster map <%s> not found"), filename);
860 if (mapset !=
NULL) {
896 v.
fov =
gv->fov / 10.;
902 if (
gv->lights[0].position[
W] == 1) {
921 v.
ambient = (
gv->lights[0].ambient[0] +
gv->lights[0].ambient[1] +
922 gv->lights[0].ambient[2]) /
956 if (mapset !=
NULL) {
963 "there may be some inconsistencies"));
1031 (
int)(v.
fov > 0 ? v.
fov * 10. + 0.5 : v.
fov * 10. - 0.5));
1057 gv->lights[0].shine = v.
shine;
1060 gv->lights[0].ambient[0] =
gv->lights[0].ambient[1] =
1061 gv->lights[0].ambient[2] = v.
ambient * 3.;
1089 gs->att[desc].max_nz =
gs->att[desc].min_nz =
gs->att[desc].range_nz = 0.0;
1092 gs->att[desc].max_nz =
gs->att[desc].min_nz =
gs->att[desc].constant;
1093 min =
max =
gs->att[desc].constant;
1094 gs->att[desc].range_nz = 0.0;
1097 gs->att[desc].max_nz = 0xFFFFFF;
1098 gs->att[desc].min_nz = 0x010101;
1099 gs->att[desc].range_nz = 0xFFFFFF;
1173 gs->att[desc].max_nz =
max;
1174 gs->att[desc].min_nz =
min;
1175 gs->att[desc].range_nz =
gs->att[desc].max_nz -
gs->att[desc].min_nz;
1181 gs->zrange =
gs->zmax -
gs->zmin;
1182 gs->zminmasked =
gs->zmin;
1183 gs->zmax_nz =
gs->zmax;
1184 gs->zmin_nz =
gs->zmin;
1185 gs->zrange_nz =
gs->zmax_nz -
gs->zmin_nz;
1188 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 G_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)