22 #include <grass/gis.h>
23 #include <grass/gstypes.h>
27 static int Site_ID[MAX_SITES];
28 static int Next_site = 0;
46 for (i = 0; i < Next_site && !found; i++) {
47 if (Site_ID[i] ==
id) {
52 G_debug(3,
"GP_site_exists(): found=%d", found);
67 if (Next_site < MAX_SITES) {
70 Site_ID[Next_site] = np->gsite_id;
73 G_debug(3,
"GP_new_site() id=%d", np->gsite_id);
75 return (np->gsite_id);
105 *numsites = Next_site;
108 ret = (
int *)G_malloc(Next_site *
sizeof(
int));
113 for (i = 0; i < Next_site; i++) {
135 G_debug(3,
"GP_delete_site(): id=%d",
id);
140 for (i = 0; i < Next_site && !found; i++) {
141 if (Site_ID[i] ==
id) {
143 for (j = i; j < Next_site; j++) {
144 Site_ID[j] = Site_ID[j + 1];
185 gp->filename =
G_store(filename);
188 &(gp->has_z), &(gp->has_att));
216 *filename =
G_store(gp->filename);
233 *atmod = gp->attr_mode;
236 *marker = gp->marker;
263 gp->attr_mode = atmod;
297 gp->attr_mode = ST_ATT_COLOR;
320 gp->attr_mode = ST_ATT_NONE;
387 G_debug(3,
"GP_set_trans(): id=%d trans=%f,%f,%f",
388 id, xtrans, ytrans, ztrans);
392 gp->x_trans = xtrans;
393 gp->y_trans = ytrans;
394 gp->z_trans = ztrans;
413 *xtrans = gp->x_trans;
414 *ytrans = gp->y_trans;
415 *ztrans = gp->z_trans;
418 G_debug(3,
"GP_get_trans(): id=%d, trans=%f,%f,%f",
419 id, *xtrans, *ytrans, *ztrans);
444 gp->drape_surf_id[gp->n_surfs] = hs;
473 for (i = 0; i < gp->n_surfs; i++) {
474 if (gp->drape_surf_id[i] == hs) {
475 for (j = i; j < gp->n_surfs - 1; j++) {
476 gp->drape_surf_id[j] = gp->drape_surf_id[j + 1];
505 for (i = 0; i < gp->n_surfs; i++) {
506 if (hs == gp->drape_surf_id[i]) {
532 if (gp->use_z && gp->has_z) {
536 for (i = 0; i < gp->n_surfs; i++) {
541 #ifdef TRACE_GP_FUNCS
542 G_debug(3,
"Drawing site %d on Surf %d",
id,
543 gp->drape_surf_id[i]);
561 for (
id = 0;
id < Next_site;
id++) {
584 gp->clientdata = clientd;
605 return (gp->clientdata);
int * GP_get_site_list(int *numsites)
Get list of point sets.
int gp_set_defaults(geosite *gp)
Set default value for geosite struct.
int GP_Set_ClientData(int id, void *clientd)
Set client data.
void GP_draw_site(int id)
Draw point set.
int gpd_3dsite(geosite *gp, float xo, float yo, int do_fast)
ADD.
char * G_store(const char *s)
Copy string to allocated memory.
int GP_unselect_surf(int hp, int hs)
Unselect surface.
int GP_site_exists(int id)
Check if point set exists.
int GS_surf_exists(int id)
int gpd_2dsite(geosite *gp, geosurf *gs, int do_fast)
ADD.
int gp_num_sites(void)
Get number of loaded point sets.
int GP_get_zmode(int id, int *use_z)
Get z-mode.
void * GP_Get_ClientData(int id)
Get client data.
int Gp_set_color(const char *grassname, geopoint *gp)
Set color for point set.
int GS_get_region(float *n, float *s, float *w, float *e)
Get 2D region extent.
int GP_attmode_color(int id, const char *filename)
Set attribute mode color.
void GP_alldraw_site(void)
Draw all available point sets.
int GP_set_sitemode(int id, int atmod, int color, int width, float size, int marker)
Set point set mode.
void GP_set_trans(int id, float xtrans, float ytrans, float ztrans)
Set trans ?
geosite * gp_get_site(int id)
Get geosite struct.
int GP_new_site(void)
Create new point set.
geosite * gp_get_new_site(void)
Create new geosite instance and add it to list.
int GP_get_sitename(int id, char **filename)
Get point set filename.
int GP_attmode_none(int id)
Set attribute mode to none.
int GP_set_zmode(int id, int use_z)
Set z-mode.
geopoint * Gp_load_sites(const char *grassname, int *nsites, int *has_z, int *has_att)
Load to points to memory.
int GP_get_sitemode(int id, int *atmod, int *color, int *width, float *size, int *marker)
Get point set mode.
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.
int GP_delete_site(int id)
Delete registrated point set.
void gp_free_sitemem(geosite *fp)
Free geosite.
int GP_surf_is_selected(int hp, int hs)
Check if surface is selected.
void gp_delete_site(int id)
Delete point set and remove from list.
int GP_num_sites(void)
Get number of loaded point sets.
int GP_select_surf(int hp, int hs)
Select surface.
void GP_get_trans(int id, float *xtrans, float *ytrans, float *ztrans)
Get trans.
int GP_load_site(int id, const char *filename)
Load point set from file.