21 #include <grass/gis.h>
22 #include <grass/gstypes.h>
24 #define FIRST_SITE_ID 21720
26 static geosite *Site_top =
NULL;
42 for (gp = Site_top; gp; gp = gp->next) {
43 if (gp->gsite_id ==
id) {
65 for (pp = Site_top; pp; pp = pp->next) {
66 if (pp->gsite_id ==
id - 1) {
84 for (i = 0, gp = Site_top; gp; gp = gp->next, i++) ;
86 G_debug(5,
"gp_num_sites(): n=%d", i);
101 G_debug(5,
"gp_get_last_site");
107 for (lp = Site_top; lp->next; lp = lp->next) ;
109 G_debug(5,
" last site id: %d", lp->gsite_id);
126 np = (geosite *) G_malloc(
sizeof(geosite));
134 np->gsite_id = lp->gsite_id + 1;
156 for (gp = Site_top; gp; gp = gp->next) {
158 for (i = 0; i < gp->n_surfs; i++) {
159 if (gp->drape_surf_id[i]) {
161 for (j = i; j < gp->n_surfs - 1; j++) {
162 gp->drape_surf_id[j] = gp->drape_surf_id[j + 1];
165 gp->n_surfs = gp->n_surfs - 1;
197 gp->n_sites = gp->use_z = gp->n_surfs = gp->use_mem = 0;
198 gp->x_trans = gp->y_trans = gp->z_trans = 0.0;
199 gp->size = dim / 100.;
202 gp->color = 0xFFFFFF;
204 gp->has_z = gp->has_att = 0;
205 gp->attr_mode = ST_ATT_NONE;
207 for (i = 0; i < MAX_SURFS; i++) {
208 gp->drape_surf_id[i] = 0;
223 fprintf(stderr,
"n_sites=%d use_z=%d n_surfs=%d use_mem=%d\n",
224 gp->n_sites, gp->use_z, gp->n_surfs, gp->use_mem);
225 fprintf(stderr,
"x_trans=%.2f x_trans=%.2f x_trans=%.2f\n",
226 gp->x_trans, gp->y_trans, gp->z_trans);
227 fprintf(stderr,
"size = %.2f\n", gp->size);
228 fprintf(stderr,
"points = %lx\n", (
unsigned long)gp->points);
229 fprintf(stderr,
"width = %d\n", gp->width);
230 fprintf(stderr,
"color = %x\n", gp->color);
231 fprintf(stderr,
"marker = %d\n", gp->marker);
232 fprintf(stderr,
"has_z = %d, has_att = %d\n", gp->has_z, gp->has_att);
233 fprintf(stderr,
"attr_mode = %d\n", gp->attr_mode);
235 for (i = 0; i < MAX_SURFS; i++) {
236 fprintf(stderr,
"drape_surf_id[%d] = %d\n", i, gp->drape_surf_id[i]);
297 if (fp == Site_top) {
298 if (Site_top->next) {
310 for (gp = Site_top; gp && !found; gp = gp->next) {
313 if (gp->next == fp) {
342 G_free((
void *)fp->filename);
345 for (gpt = fp->points; gpt;) {
373 for (i = 0; i < nsurfs && i < MAX_SURFS; i++) {
374 gp->drape_surf_id[i] = hsurfs[i];
int gp_free_site(geosite *fp)
Free geosite struct.
int gp_set_defaults(geosite *gp)
Set default value for geosite struct.
void G_free(void *buf)
Free allocated memory.
geosite * gp_get_last_site(void)
Get last point set.
int gp_num_sites(void)
Get number of loaded point sets.
void gp_set_drapesurfs(geosite *gp, int hsurfs[], int nsurfs)
Set drape surfaces.
geosite * gp_get_site(int id)
Get geosite struct.
void gp_update_drapesurfs(void)
Update drape surfaces.
geosite * gp_get_new_site(void)
Create new geosite instance and add it to list.
geosite * gp_get_prev_site(int id)
Get previous geosite struct from list.
void print_site_fields(geosite *gp)
Print point set fields, debugging.
geosurf * gs_get_surf(int id)
Get geosurf struct.
int G_debug(int level, const char *msg,...)
Print debugging message.
void gp_free_sitemem(geosite *fp)
Free geosite.
int gp_init_site(geosite *gp)
Initialize geosite struct.
int GS_get_longdim(float *dim)
Get largest dimension.
void gp_delete_site(int id)
Delete point set and remove from list.