29#define FIRST_SURF_ID 110658
69 for (
gs = Surf_top;
gs;
gs =
gs->next) {
70 if (
gs->gsurf_id ==
id) {
91 G_debug(5,
"gs_get_prev_surface");
93 for (
ps = Surf_top;
ps;
ps =
ps->next) {
94 if (
ps->gsurf_id ==
id - 1) {
114 for (i = 0,
gs = Surf_top;
gs;
gs =
gs->next, i++) {
118 G_debug(5,
"gs_num_surfaces(): num=%d", i);
133 for (i = 0,
gs = Surf_top;
gs;
gs =
gs->next, i++)
136 G_debug(5,
"gs_num_surfaces(): num=%d", i);
159 for (
gs = Surf_top;
gs;
gs =
gs->next) {
181 for (
ls = Surf_top;
ls->next;
ls =
ls->next)
184 G_debug(5,
"gs_get_last_surface(): last surface id=%d",
ls->gsurf_id);
235 double xres,
double yres)
244 G_debug(5,
"gs_init_surf() id=%d",
gs->gsurf_id);
250 gs->att[i].hdata = -1;
251 gs->att[i].user_func =
NULL;
252 gs->att[i].constant = 0.;
254 gs->att[i].min_nz =
gs->att[i].max_nz =
gs->att[i].range_nz = 0;
255 gs->att[i].default_null = 0.;
267 gs->x_modw = rows / 30;
268 gs->y_modw = rows / 30;
270 gs->xmax = ox + (cols - 1) * xres;
271 gs->xrange =
gs->xmax -
gs->xmin;
273 gs->ymax = oy + (rows - 1) * yres;
274 gs->yrange =
gs->ymax -
gs->ymin;
275 gs->zmin =
gs->zmin_nz =
gs->zminmasked = 0;
276 gs->zmax =
gs->zmax_nz = 0;
277 gs->zrange =
gs->zrange_nz = 0;
278 gs->wire_color = 0x00888888;
279 gs->x_trans =
gs->y_trans =
gs->z_trans = 0.0;
280 gs->nz_topo =
gs->nz_color = 0;
281 gs->norm_needupdate = 1;
282 gs->mask_needupdate = 1;
294 gs->z_exag =
ps->z_exag;
320 size =
gs->rows *
gs->cols *
sizeof(
unsigned long);
327 gs->norm_needupdate = 1;
373 for (i = 0; i < 256; i++) {
445 G_debug(5,
"gs_set_defaults(): id=%d",
gs->gsurf_id);
448 gs->att[i].constant =
defs[i];
451 gs->att[i].hdata = -1;
495 if (
fs == Surf_top) {
496 if (Surf_top->next) {
519 if (
gs->next ==
fs) {
563 G_debug(5,
"gs_free_unshared_buffs");
573 for (
gs = Surf_top;
gs;
gs =
gs->next) {
602 G_debug(5,
"gs_num_datah_reused");
610 for (
gs = Surf_top;
gs;
gs =
gs->next) {
612 if (
dh ==
gs->att[
j].hdata) {
640 return (
gs->att[desc].att_type);
659 G_debug(5,
"gs_get_att_src(): id=%d, desc=%d",
gs->gsurf_id, desc);
665 return (
gs->att[desc].att_src);
687 G_debug(5,
"gs_get_att_typbuff(): id=%d desc=%d to_write=%d",
719 int hdata, dims[2], ndims;
721 G_debug(5,
"gs_malloc_att_buff");
724 if (0 < (hdata =
gs->att[desc].hdata)) {
750 G_debug(5,
"gs_malloc_lookup");
753 if (
gs->att[desc].lookup) {
755 gs->att[desc].lookup =
NULL;
758 switch (
gs->att[desc].att_type) {
760 size = 32768 *
sizeof(
int);
764 if (!
gs->att[desc].lookup) {
770 size = 256 *
sizeof(
int);
774 if (!
gs->att[desc].lookup) {
784 if (
gs->att[desc].lookup) {
805 G_debug(5,
"gs_set_att_type(): desc=%d, type=%d", desc, type);
808 gs->att[desc].att_type = type;
829 G_debug(5,
"gs_set_att_src(): id=%d desc=%d src=%d",
gs->gsurf_id, desc,
836 G_debug(5,
"gs_set_att_src(): replacing existing map");
846 gs->norm_needupdate = 0;
851 gs->att[desc].att_src = src;
875 G_debug(5,
"gs_set_att_const(): id=%d, desc=%d, const=%f",
gs->gsurf_id,
877 gs->att[desc].constant = constant;
880 gs->mask_needupdate = 1;
942 ret =
tb->cb[offset];
945 ret =
tb->sb[offset];
948 ret =
tb->ib[offset];
951 ret =
tb->fb[offset];
954 return (Invertmask ?
ret : !
ret);
976 return (
cobuff->ib[offset]);
1000 *
max =
gs->zmax +
gs->z_trans;
1017 *
min =
gs->xmin +
gs->x_trans;
1018 *
max =
gs->xmax +
gs->x_trans;
1034 *
min =
gs->ymin +
gs->y_trans;
1035 *
max =
gs->ymax +
gs->y_trans;
1057 *
min = Surf_top->zmin;
1058 *
max = Surf_top->zmax;
1064 for (
gs = Surf_top->next;
gs;
gs =
gs->next) {
1065 if (
gs->zmin < *
min) {
1069 if (
gs->zmax > *
max) {
1100 for (
gs = Surf_top->next;
gs;
gs =
gs->next) {
1138 for (
gs = Surf_top->next;
gs;
gs =
gs->next) {
1176 for (
gs = Surf_top->next;
gs;
gs =
gs->next) {
1207 zmax = *
azmax = 0.0;
1210 for (i = 0,
gs = Surf_top;
gs; i++,
gs =
gs->next) {
1211 zmax += (
gs->zmax +
gs->z_trans);
1232 float zmin, zmax, ymin, ymax, xmin, xmax;
1236 zmin = Surf_top->zmin;
1237 zmax = Surf_top->zmax;
1238 ymin = Surf_top->ymin;
1239 ymax = Surf_top->ymax;
1240 xmin = Surf_top->xmin;
1241 xmax = Surf_top->xmax;
1243 for (
gs = Surf_top->next;
gs;
gs =
gs->next) {
1244 if (
gs->zmin < zmin) {
1248 if (
gs->zmax > zmax) {
1252 if (
gs->ymin < ymin) {
1256 if (
gs->ymax > ymax) {
1260 if (
gs->xmin < xmin) {
1264 if (
gs->xmax > xmax) {
1269 cen[
X] = (xmin + xmax) / 2. - xmin;
1270 cen[
Y] = (ymin + ymax) / 2. - ymin;
1271 cen[
Z] = (zmin + zmax) / 2.;
1292 Surf_top->norm_needupdate = 1;
1298 for (
gs = Surf_top->next;
gs;
gs =
gs->next) {
1299 gs->norm_needupdate = 1;
1432 for (i = 0; i < (np - 1); i++) {
1433 tmp[i + 1][
Z] *= exag;
1438 for (i = 0; i < (np - 1); i++) {
int BM_get(struct BM *, int, int)
Gets 'val' from the bitmap.
void G_free(void *)
Free allocated memory.
void G_warning(const char *,...) __attribute__((format(printf
int G_debug(int, const char *,...) __attribute__((format(printf
int gsds_free_datah(int)
Free allocated dataset.
int Gs_update_attrange(geosurf *, int)
Update no_zero ranges for attribute (actually no_null now)
size_t gsds_alloc_typbuff(int, int *, int, int)
Allocates correct buffer according to type, keeps track of total mem.
int in_vregion(geosurf *, float *)
ADD.
Point3 * gsdrape_get_segments(geosurf *, float *, float *, int *)
ADD.
float gsdiff_do_SD(float, int)
ADD.
typbuff * gsds_get_typbuff(int, IFLAG)
float GS_distance(float *, float *)
Calculate distance.
geosurf * gsdiff_get_SDref(void)
ADD.
float GS_global_exag(void)
Get global z-exag value.
int gs_get_xextents(geosurf *gs, float *min, float *max)
Get x-extent values.
int gs_masked(typbuff *tb, int col, int row, int offset)
Should only be called when setting up the current mask (gs_bm.c)
void print_view_fields(geoview *gv)
Debugging, print geoview fields to stderr.
int gs_get_datacenter(float *cen)
Get data center point.
int gs_get_zextents(geosurf *gs, float *min, float *max, float *mid)
Get z-extent values.
int gs_get_zrange(float *min, float *max)
Get z-range.
size_t gs_malloc_att_buff(geosurf *gs, int desc, int type)
Allocate attribute buffer.
int gs_set_att_src(geosurf *gs, int desc, int src)
Set attribute source.
int gs_get_yextents(geosurf *gs, float *min, float *max)
Get y-extent values.
int gs_mapcolor(typbuff *cobuff, gsurf_att *coloratt, int offset)
Call this one when you already know att_src is MAP_ATT.
void gs_free_unshared_buffs(geosurf *fs)
Free unshared buffers of geosurf struct.
void gs_err(const char *msg)
int gs_get_xrange(float *min, float *max)
Get x-range.
int gs_att_is_set(geosurf *surf, unsigned int att)
Check if attribute is set.
geosurf * gs_get_surf(int id)
Get geosurf struct.
geosurf * gs_get_last_surface(void)
Get last allocated geosurf struct from list.
int gs_set_att_const(geosurf *gs, int desc, float constant)
Set attribute constant value.
int gs_malloc_lookup(geosurf *gs, int desc)
Allocate attribute lookup.
int gs_get_yrange(float *min, float *max)
Get y-range.
void gs_delete_surf(int id)
Remove geosurf struct from list.
int gs_set_att_type(geosurf *gs, int desc, int type)
Set attribute type.
void print_surf_fields(geosurf *s)
Debugging, print geosurf fields to stderr.
int gs_getall_surfaces(geosurf **gsurfs)
Get array of geosurf structs.
int gs_setall_norm_needupdate(void)
Set for geosurf need-to-update mark.
void print_256lookup(int *buff)
Debugging, 256 integer values from buffer.
int gs_init_surf(geosurf *gs, double ox, double oy, int rows, int cols, double xres, double yres)
Initialize allocated geosurf struct.
void gs_init(void)
Initialize library.
void gs_set_maskmode(int invert)
Set geosurf mask mode.
geosurf * gs_get_new_surface(void)
Allocate new geosurf struct.
int gs_free_surf(geosurf *fs)
Free geosurf struct.
int gs_get_att_type(geosurf *gs, int desc)
Get attribute type.
int gs_distance_onsurf(geosurf *gs, float *p1, float *p2, float *dist, int use_exag)
Calculate distance on surface.
geosurf * gs_get_prev_surface(int id)
Get previous geosurf struct.
int gs_num_surfaces(void)
Get number of surfaces.
int gs_init_normbuff(geosurf *gs)
Init geosurf normbuff.
typbuff * gs_get_att_typbuff(geosurf *gs, int desc, int to_write)
Get attribute data buffer.
int gs_num_datah_reused(int dh)
Get number of reused values.
void print_frto(float(*ft)[4])
Debugging, print 'from/to' model coordinates to stderr.
int gs_mask_defined(geosurf *gs)
Check if mask is defined.
int gs_get_zrange0(float *min, float *max)
Get z-range.
int gs_point_is_masked(geosurf *gs, float *pt)
Check if point is masked.
int gs_get_data_avg_zmax(float *azmax)
Get average z-max value.
int gs_get_att_src(geosurf *gs, int desc)
Get attribute source.
void gs_set_defaults(geosurf *gs, float *defs, float *null_defs)
Set default attribute values.
void print_realto(float *rt)
Debugging, print 'to' real coordinates to stderr.
OGSF header file (structures)
#define VROW2DROW(gs, vrow)
#define VCOL2DCOL(gs, vcol)
double ox
real world origin (i.e., SW corner)
unsigned int draw_mode
DM_GOURAUD | DM_FRINGE | DM_POLY, DM_WIRE, DM_WIRE_POLY.
long wire_color
0xBBGGRR or WC_COLOR_ATT
int x_mod
cells per viewcell, per wire viewcell