Loading...
Searching...
No Matches
gp2.c File Reference

OGSF library - loading and manipulating point sets (higher level functions). More...

`#include <stdlib.h>`
`#include <string.h>`
`#include <grass/gis.h>`
`#include <grass/ogsf.h>`
`#include <grass/glocale.h>`
`#include "gsget.h"`
Include dependency graph for gp2.c:

Go to the source code of this file.

## Functions

int | GP_site_exists (int id)
| Check if point set exists.
int | GP_new_site (void)
| Create new point set.
int | GP_num_sites (void)
| Get number of loaded point sets.
int * | GP_get_site_list (int *numsites)
| Get list of point sets.
int | GP_delete_site (int id)
| Delete registered point set.
int | GP_load_site (int id, const char *filename)
| Load point set from file.
int | GP_get_sitename (int id, char **filename)
| Get point set filename.
int | GP_get_style (int id, int *color, int *width, float *size, int *symbol)
| Get point set style.
int | GP_set_style (int id, int color, int width, float size, int symbol)
| Set point style.
int | GP_set_style_thematic (int id, int layer, const char *color, const char *width, const char *size, const char *symbol, struct Colors *color_rules)
| Set point set style for thematic mapping.
int | GP_unset_style_thematic (int id)
| Make style for thematic mapping inactive.
int | GP_set_zmode (int id, int use_z)
| Set z mode for point set.
int | GP_get_zmode (int id, int *use_z)
| Get z-mode.
void | GP_set_trans (int id, float xtrans, float ytrans, float ztrans)
| Set transformation params.
void | GP_get_trans (int id, float *xtrans, float *ytrans, float *ztrans)
| Get transformation params.
int | GP_select_surf (int hp, int hs)
| Select surface for given point set.
int | GP_unselect_surf (int hp, int hs)
| Unselect surface.
int | GP_surf_is_selected (int hp, int hs)
| Check if surface is selected.
void | GP_draw_site (int id)
| Draw point set.
void | GP_alldraw_site (void)
| Draw all available point sets.
int | GP_Set_ClientData (int id, void *clientd)
| Set client data.
void * | GP_Get_ClientData (int id)
| Get client data.
int | GP_str_to_marker (const char *str)
| Determine point marker symbol for string.

## Detailed Description

OGSF library - loading and manipulating point sets (higher level functions).

(C) 1999-2008, 2011 by the GRASS Development Team

This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.

Author
  Bill Brown USACERL (January 1994)
  Updated by Martin landa <landa.martin gmail.com> (doxygenized in May 2008, thematic mapping in June 2011)

Definition in file gp2.c.

## Function Documentation

## GP_alldraw_site()

void GP_alldraw_site | ( | void |  | ) |

Draw all available point sets.

Definition at line 615 of file gp2.c.

References GP_draw_site().

Referenced by gk_follow_frames(), GK_show_site(), and Nviz_draw_quick().

## GP_delete_site()

int GP_delete_site | ( | int | id | ) |

Delete registered point set.

Parameters

  id | point set id

Returns
  1 on success
  -1 on error (point sets not available)

Definition at line 132 of file gp2.c.

References G_debug(), gp_delete_site(), and GP_site_exists().

Referenced by Nviz_new_map_obj().

## GP_draw_site()

void GP_draw_site | ( | int | id | ) |

Draw point set.

Parameters

  id | point set id

Definition at line 581 of file gp2.c.

References G_debug(), gp_get_site(), gpd_2dsite(), gpd_3dsite(), GS_get_region(), and gs_get_surf().

Referenced by GP_alldraw_site(), and Nviz_draw_all_site().

## GP_Get_ClientData()

void * GP_Get_ClientData | ( | int | id | ) |

Get client data.

Parameters

  id | point set id

Returns
  pointer to client data
  NULL on error

Definition at line 657 of file gp2.c.

References gp_get_site(), and NULL.

## GP_get_site_list()

int * GP_get_site_list | ( | int * | numsites | ) |

Get list of point sets.

Must freed when no longer needed!

Parameters

  numsites | number of point sets

Returns
  pointer to list of points sets
  NULL on error

Definition at line 102 of file gp2.c.

References NULL.

Referenced by Nviz_draw_all_site().

## GP_get_sitename()

int GP_get_sitename | ( | int | id,
|  | char ** | filename )

Get point set filename.

Note: char array is allocated by G_store()

Parameters

  | id | point set id
  [out] | filename | point set filename

Returns
  -1 on error (point set not found)
  1 on success

Definition at line 209 of file gp2.c.

References G_debug(), G_store(), gp_get_site(), and NULL.

## GP_get_style()

int GP_get_style | ( | int | id,
|  | int * | color,
|  | int * | width,
|  | float * | size,
|  | int * | symbol )

Get point set style.

Parameters

  id | point set id
  color |
  width |
  size |
  symbol |

Returns
  1 on success
  -1 on error (point set not found)

Definition at line 236 of file gp2.c.

References G_debug(), gp_get_site(), and NULL.

## GP_get_trans()

void GP_get_trans | ( | int | id,
|  | float * | xtrans,
|  | float * | ytrans,
|  | float * | ztrans )

Get transformation params.

Parameters

  | id | point set id
  [out] | xtrans,ytrans,ztrans | x/y/z values

Definition at line 461 of file gp2.c.

References G_debug(), and gp_get_site().

## GP_get_zmode()

int GP_get_zmode | ( | int | id,
|  | int * | use_z )

Get z-mode.

Todo
  Who's using this?

Parameters

  | id | point set id
  [out] | use_z | non-zero code to use z

Returns
  -1 on error (invalid point set id)
  1 on success

Definition at line 418 of file gp2.c.

References G_debug(), gp_get_site(), and NULL.

## GP_load_site()

int GP_load_site | ( | int | id,
|  | const char * | filename )

Load point set from file.

Check to see if handle already loaded, if so - free before loading new for now, always load to memory.

Todo
  load file handle & ready for reading instead of using memory

Parameters

  id | point set id
  filename | point set filename

Returns
  -1 on error
  1 on success

Definition at line 173 of file gp2.c.

References G_debug(), G_store(), gp_free_sitemem(), gp_get_site(), Gp_load_sites(), and NULL.

Referenced by Nviz_new_map_obj().

## GP_new_site()

int GP_new_site | ( | void |  | ) |

Create new point set.

Returns
  point set id
  -1 on error (number of point sets exceeded)

Definition at line 64 of file gp2.c.

References G_debug(), gp_get_new_site(), and gp_set_defaults().

Referenced by Nviz_new_map_obj().

## GP_num_sites()

int GP_num_sites | ( | void |  | ) |

Get number of loaded point sets.

Returns
  number of point sets

Definition at line 87 of file gp2.c.

References gp_num_sites().

Referenced by Nviz_new_map_obj().

## GP_select_surf()

int GP_select_surf | ( | int | hp,
|  | int | hs )

Select surface for given point set.

Parameters

  hp | point set id
  hs | surface id

Returns
  1 surface selected
  -1 on error

Definition at line 488 of file gp2.c.

References G_debug(), gp_get_site(), GP_surf_is_selected(), and GS_surf_exists().

Referenced by Nviz_new_map_obj().

## GP_Set_ClientData()

int GP_Set_ClientData | ( | int | id,
|  | void * | clientd )

Set client data.

Parameters

  id | point set id
  clientd | client data

Returns
  1 on success
  -1 on error (invalid point set id)

Definition at line 635 of file gp2.c.

References gp_get_site().

## GP_set_style()

int GP_set_style | ( | int | id,
|  | int | color,
|  | int | width,
|  | float | size,
|  | int | symbol )

Set point style.

Supported icon symbols (markers):

- ST_X
- ST_BOX
- ST_SPHERE
- ST_CUBE
- ST_DIAMOND
- ST_DEC_TREE
- ST_CON_TREE
- ST_ASTER
- ST_GYRO
- ST_HISTOGRAM

Parameters

  id | point set id
  color | icon color
  width | icon line width
  size | icon size
  symbol | icon symbol

Returns
  1 on success
  -1 on error (point set not found)

Definition at line 278 of file gp2.c.

References G_debug(), gp_get_site(), and NULL.

Referenced by Nviz_new_map_obj().

## GP_set_style_thematic()

int GP_set_style_thematic | ( | int | id,
|  | int | layer,
|  | const char * | color,
|  | const char * | width,
|  | const char * | size,
|  | const char * | symbol,
|  | struct Colors * | color_rules )

Set point set style for thematic mapping.

Updates also style for each geopoint.

Parameters

  id | point set id
  layer | layer number for thematic mapping (-1 for undefined)
  color | icon color column name
  width | icon line width column name
  size | icon size column name
  symbol | icon symbol column name
  color_rules | pointer to Colors structure or NULL

Returns
  1 on success
  -1 on error (point set not found)

Definition at line 313 of file gp2.c.

References G_debug(), G_store(), G_zero(), gp_get_site(), Gp_load_sites_thematic(), and NULL.

## GP_set_trans()

void GP_set_trans | ( | int | id,
|  | float | xtrans,
|  | float | ytrans,
|  | float | ztrans )

Set transformation params.

Parameters

  id | point set id
  xtrans,ytrans,ztrans | x/y/z values

Definition at line 438 of file gp2.c.

References G_debug(), and gp_get_site().

## GP_set_zmode()

int GP_set_zmode | ( | int | id,
|  | int | use_z )

Set z mode for point set.

Parameters

  id | point set id
  use_z | TRUE to use z-coordinaces when vector map is 3D

Returns
  1 on success
  0 vector map is not 3D
  -1 on error (invalid point set id)

Definition at line 384 of file gp2.c.

References G_debug(), gp_get_site(), and NULL.

## GP_site_exists()

int GP_site_exists | ( | int | id | ) |

Check if point set exists.

Parameters

  id | point set id

Returns
  1 found
  0 not found

Definition at line 37 of file gp2.c.

References G_debug(), gp_get_site(), and NULL.

Referenced by GP_delete_site().

## GP_str_to_marker()

int GP_str_to_marker | ( | const char * | str | ) |

Determine point marker symbol for string.

Supported markers:

- ST_X
- ST_BOX
- ST_SPHERE
- ST_CUBE
- ST_DIAMOND
- ST_DEC_TREE
- ST_CON_TREE
- ST_ASTER
- ST_GYRO
- ST_HISTOGRAM

Parameters

  str | string buffer

Returns
  marker code (default: ST_SPHERE)

Definition at line 688 of file gp2.c.

References G_warning().

Referenced by Gp_load_sites_thematic().

## GP_surf_is_selected()

int GP_surf_is_selected | ( | int | hp,
|  | int | hs )

Check if surface is selected.

Parameters

  hp | point set id
  hs | surface id

Returns
  1 selected
  0 not selected

Definition at line 556 of file gp2.c.

References G_debug(), and gp_get_site().

Referenced by GP_select_surf(), and GP_unselect_surf().

## GP_unselect_surf()

int GP_unselect_surf | ( | int | hp,
|  | int | hs )

Unselect surface.

Parameters

  hp | point set id
  hs | surface id

Returns
  1 surface unselected
  -1 on error

Definition at line 518 of file gp2.c.

References G_debug(), gp_get_site(), and GP_surf_is_selected().

## GP_unset_style_thematic()

int GP_unset_style_thematic | ( | int | id | ) |

Make style for thematic mapping inactive.

Parameters

  id | point set id

Returns
  1 on success
  -1 on error (point set not found)

Definition at line 356 of file gp2.c.

References G_debug(), gp_get_site(), and NULL.