25#define FIRST_SURF_ID 110658
65 for (
gs = Surf_top;
gs;
gs =
gs->next) {
66 if (
gs->gsurf_id ==
id) {
87 G_debug(5,
"gs_get_prev_surface");
89 for (
ps = Surf_top;
ps;
ps =
ps->next) {
90 if (
ps->gsurf_id ==
id - 1) {
110 for (i = 0,
gs = Surf_top;
gs;
gs =
gs->next, i++) {
114 G_debug(5,
"gs_num_surfaces(): num=%d", i);
129 for (i = 0,
gs = Surf_top;
gs;
gs =
gs->next, i++)
132 G_debug(5,
"gs_num_surfaces(): num=%d", i);
155 for (
gs = Surf_top;
gs;
gs =
gs->next) {
177 for (
ls = Surf_top;
ls->next;
ls =
ls->next)
180 G_debug(5,
"gs_get_last_surface(): last surface id=%d",
ls->gsurf_id);
231 double xres,
double yres)
240 G_debug(5,
"gs_init_surf() id=%d",
gs->gsurf_id);
246 gs->att[i].hdata = -1;
247 gs->att[i].user_func =
NULL;
248 gs->att[i].constant = 0.;
250 gs->att[i].min_nz =
gs->att[i].max_nz =
gs->att[i].range_nz = 0;
251 gs->att[i].default_null = 0.;
263 gs->x_modw = rows / 30;
264 gs->y_modw = rows / 30;
266 gs->xmax = ox + (cols - 1) * xres;
267 gs->xrange =
gs->xmax -
gs->xmin;
269 gs->ymax = oy + (rows - 1) * yres;
270 gs->yrange =
gs->ymax -
gs->ymin;
271 gs->zmin =
gs->zmin_nz =
gs->zminmasked = 0;
272 gs->zmax =
gs->zmax_nz = 0;
273 gs->zrange =
gs->zrange_nz = 0;
274 gs->wire_color = 0x00888888;
275 gs->x_trans =
gs->y_trans =
gs->z_trans = 0.0;
276 gs->nz_topo =
gs->nz_color = 0;
277 gs->norm_needupdate = 1;
278 gs->mask_needupdate = 1;
290 gs->z_exag =
ps->z_exag;
316 size = (
long)
gs->rows *
gs->cols *
sizeof(
unsigned long);
323 gs->norm_needupdate = 1;
369 for (i = 0; i < 256; i++) {
441 G_debug(5,
"gs_set_defaults(): id=%d",
gs->gsurf_id);
444 gs->att[i].constant =
defs[i];
447 gs->att[i].hdata = -1;
491 if (
fs == Surf_top) {
492 if (Surf_top->next) {
515 if (
gs->next ==
fs) {
559 G_debug(5,
"gs_free_unshared_buffs");
569 for (
gs = Surf_top;
gs;
gs =
gs->next) {
598 G_debug(5,
"gs_num_datah_reused");
606 for (
gs = Surf_top;
gs;
gs =
gs->next) {
608 if (
dh ==
gs->att[
j].hdata) {
636 return (
gs->att[desc].att_type);
655 G_debug(5,
"gs_get_att_src(): id=%d, desc=%d",
gs->gsurf_id, desc);
661 return (
gs->att[desc].att_src);
683 G_debug(5,
"gs_get_att_typbuff(): id=%d desc=%d to_write=%d",
715 int hdata, dims[2], ndims;
717 G_debug(5,
"gs_malloc_att_buff");
720 if (0 < (hdata =
gs->att[desc].hdata)) {
746 G_debug(5,
"gs_malloc_lookup");
749 if (
gs->att[desc].lookup) {
751 gs->att[desc].lookup =
NULL;
754 switch (
gs->att[desc].att_type) {
756 size = 32768 *
sizeof(
int);
760 if (!
gs->att[desc].lookup) {
766 size = 256 *
sizeof(
int);
770 if (!
gs->att[desc].lookup) {
780 if (
gs->att[desc].lookup) {
801 G_debug(5,
"gs_set_att_type(): desc=%d, type=%d", desc, type);
804 gs->att[desc].att_type = type;
825 G_debug(5,
"gs_set_att_src(): id=%d desc=%d src=%d",
gs->gsurf_id, desc,
832 G_debug(5,
"gs_set_att_src(): replacing existing map");
842 gs->norm_needupdate = 0;
847 gs->att[desc].att_src = src;
871 G_debug(5,
"gs_set_att_const(): id=%d, desc=%d, const=%f",
gs->gsurf_id,
873 gs->att[desc].constant = constant;
876 gs->mask_needupdate = 1;
938 ret =
tb->cb[offset];
941 ret =
tb->sb[offset];
944 ret =
tb->ib[offset];
947 ret =
tb->fb[offset];
950 return (Invertmask ?
ret : !
ret);
972 return (
cobuff->ib[offset]);
1013 *
min =
gs->xmin +
gs->x_trans;
1014 *
max =
gs->xmax +
gs->x_trans;
1030 *
min =
gs->ymin +
gs->y_trans;
1031 *
max =
gs->ymax +
gs->y_trans;
1053 *
min = Surf_top->zmin;
1054 *
max = Surf_top->zmax;
1060 for (
gs = Surf_top->next;
gs;
gs =
gs->next) {
1061 if (
gs->zmin < *
min) {
1065 if (
gs->zmax > *
max) {
1096 for (
gs = Surf_top->next;
gs;
gs =
gs->next) {
1134 for (
gs = Surf_top->next;
gs;
gs =
gs->next) {
1172 for (
gs = Surf_top->next;
gs;
gs =
gs->next) {
1203 zmax = *
azmax = 0.0;
1206 for (i = 0,
gs = Surf_top;
gs; i++,
gs =
gs->next) {
1207 zmax += (
gs->zmax +
gs->z_trans);
1228 float zmin, zmax, ymin, ymax, xmin, xmax;
1232 zmin = Surf_top->zmin;
1233 zmax = Surf_top->zmax;
1234 ymin = Surf_top->ymin;
1235 ymax = Surf_top->ymax;
1236 xmin = Surf_top->xmin;
1237 xmax = Surf_top->xmax;
1239 for (
gs = Surf_top->next;
gs;
gs =
gs->next) {
1240 if (
gs->zmin < zmin) {
1244 if (
gs->zmax > zmax) {
1248 if (
gs->ymin < ymin) {
1252 if (
gs->ymax > ymax) {
1256 if (
gs->xmin < xmin) {
1260 if (
gs->xmax > xmax) {
1265 cen[
X] = (xmin + xmax) / 2. - xmin;
1266 cen[
Y] = (ymin + ymax) / 2. - ymin;
1267 cen[
Z] = (zmin + zmax) / 2.;
1288 Surf_top->norm_needupdate = 1;
1294 for (
gs = Surf_top->next;
gs;
gs =
gs->next) {
1295 gs->norm_needupdate = 1;
1428 for (i = 0; i < (np - 1); i++) {
1429 tmp[i + 1][
Z] *= exag;
1434 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