29 #define FIRST_SURF_ID 110658
32 static int Invertmask;
69 for (gs = Surf_top; gs; gs = gs->
next) {
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)
235 double xres,
double yres)
270 gs->
xmax = ox + (cols - 1) * xres;
273 gs->
ymax = oy + (rows - 1) * yres;
320 size = gs->
rows * gs->
cols *
sizeof(
unsigned long);
341 fprintf(stderr,
"FROM: %f, %f, %f\n", ft[
FROM][
X], ft[
FROM][
Y],
343 fprintf(stderr,
"TO: %f, %f, %f\n", ft[
TO][
X], ft[
TO][
Y], ft[
TO][
Z]);
357 fprintf(stderr,
"REAL TO: %f, %f, %f\n", rt[
X], rt[
Y], rt[
Z]);
373 for (i = 0; i < 256; i++) {
375 fprintf(stderr,
"\n");
378 fprintf(stderr,
"%x ", buff[i]);
381 fprintf(stderr,
"\n");
395 fprintf(stderr,
"ID: %d\n", s->
gsurf_id);
396 fprintf(stderr,
"rows: %d cols: %d\n", s->
rows, s->
cols);
397 fprintf(stderr,
"draw_mode: %x\n", s->
draw_mode);
398 fprintf(stderr,
"wire_color: %lx\n", s->
wire_color);
399 fprintf(stderr,
"ox: %lf oy: %lf\n", s->
ox, s->
oy);
400 fprintf(stderr,
"xres: %lf yres: %lf\n", s->
xres, s->
yres);
401 fprintf(stderr,
"z_exag: %f \n", s->
z_exag);
402 fprintf(stderr,
"x_trans: %f y_trans: %f z_trans: %f\n", s->
x_trans,
404 fprintf(stderr,
"xmin: %f ymin: %f zmin: %f\n", s->
xmin, s->
ymin, s->
zmin);
405 fprintf(stderr,
"xmax: %f ymax: %f zmax: %f\n", s->
xmax, s->
ymax, s->
zmax);
406 fprintf(stderr,
"x_mod: %d y_mod: %d x_modw: %d y_modw: %d\n", s->
x_mod,
421 fprintf(stderr,
"coord_sys: %d\n", gv->
coord_sys);
422 fprintf(stderr,
"view_proj: %d\n", gv->
view_proj);
423 fprintf(stderr,
"infocus: %d\n", gv->
infocus);
425 fprintf(stderr,
"twist: %d fov: %d\n", gv->
twist, gv->
fov);
426 fprintf(stderr,
"incl: %d look: %d\n", gv->
incl, gv->
look);
429 fprintf(stderr,
"vert_exag: %f scale: %f \n", gv->
vert_exag, gv->
scale);
495 if (fs == Surf_top) {
496 if (Surf_top->
next) {
517 for (gs = Surf_top; gs && !found; gs = gs->
next) {
519 if (gs->
next == fs) {
563 G_debug(5,
"gs_free_unshared_buffs");
571 if (0 < (old_datah = fs->
att[i].
hdata)) {
573 for (gs = Surf_top; gs; gs = gs->
next) {
575 if ((old_datah == gs->
att[j].
hdata) && (fs != gs)) {
602 G_debug(5,
"gs_num_datah_reused");
610 for (gs = Surf_top; gs; gs = gs->
next) {
687 G_debug(5,
"gs_get_att_typbuff(): id=%d desc=%d to_write=%d",
695 if (gsref && gsref != gs) {
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");
760 size = 32768 *
sizeof(int);
770 size = 256 *
sizeof(int);
805 G_debug(5,
"gs_set_att_type(): desc=%d, type=%d", desc, 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");
875 G_debug(5,
"gs_set_att_const(): id=%d, desc=%d, const=%f", gs->
gsurf_id,
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);
973 return (coloratt->
lookup[cobuff->
cb[offset]]);
976 return (cobuff->
ib[offset]);
1001 *mid = (*
max + *
min) / 2.;
1064 for (gs = Surf_top->
next; gs; gs = gs->
next) {
1089 float tmin, tmax, tmid;
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.;
1276 cen[
X] = cen[
Y] = cen[
Z] = 0.0;
1298 for (gs = Surf_top->
next; gs; gs = gs->
next) {
1316 int vrow, vcol, drow, dcol;
1317 int retmask = 0, npts = 0;
1369 return (retmask | npts);
1382 return (retmask | npts);
1385 return (retmask | npts);
1387 if ((pt[
X] - p2[
X]) /
VXRES(gs) <= (pt[
Y] - p2[
Y]) /
VYRES(gs)) {
1392 return (retmask | npts);
1395 return (retmask | npts);
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.
typbuff * gsds_get_typbuff(int, IFLAG)
Get data buffer.
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.
geosurf * gsdiff_get_SDref(void)
ADD.
float gsdiff_do_SD(float, int)
ADD.
float GS_distance(float *, float *)
Calculate distance.
float GS_global_exag(void)
Get global z-exag value.
geosurf * gs_get_prev_surface(int id)
Get previous geosurf struct.
geosurf * gs_get_new_surface(void)
Allocate new geosurf struct.
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.
geosurf * gs_get_surf(int id)
Get geosurf struct.
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.
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.
int gs_num_surfaces(void)
Get number of surfaces.
geosurf * gs_get_last_surface(void)
Get last allocated geosurf struct from list.
int gs_init_normbuff(geosurf *gs)
Init geosurf normbuff.
int gs_num_datah_reused(int dh)
Get number of reused values.
typbuff * gs_get_att_typbuff(geosurf *gs, int desc, int to_write)
Get attribute data buffer.
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_att_is_set(geosurf *surf, IFLAG att)
Check if attribute is set.
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.
#define VROW2DROW(gs, vrow)
#define VCOL2DCOL(gs, vcol)
float(* tfunc)(float, int)