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

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

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

Go to the source code of this file.

## Functions

int | GV_vect_exists (int id)
| Check if vector set exists.
int | GV_new_vector (void)
| Register new vector set.
int | GV_num_vects (void)
| Get number of available vector sets.
int * | GV_get_vect_list (int *numvects)
| Get list of vector sets.
int | GV_delete_vector (int id)
| Delete vector set from list.
int | GV_load_vector (int id, const char *filename)
| Load vector set.
int | GV_get_vectname (int id, char **filename)
| Get vector map name.
int | GV_set_style (int id, int mem, int color, int width, int use_z)
| Set vector style.
int | GV_get_style (int id, int *mem, int *color, int *width, int *use_z)
| Get vector style.
int | GV_set_style_thematic (int id, int layer, const char *color, const char *width, struct Colors *color_rules)
| Set vector set style for thematic mapping.
int | GV_unset_style_thematic (int id)
| Make style for thematic mapping inactive.
void | GV_set_trans (int id, float xtrans, float ytrans, float ztrans)
| Set trans ?
int | GV_get_trans (int id, float *xtrans, float *ytrans, float *ztrans)
| Get trans ?
int | GV_select_surf (int hv, int hs)
| Select surface identified by hs to have vector identified by hv draped over it.
int | GV_unselect_surf (int hv, int hs)
| Unselect surface.
int | GV_surf_is_selected (int hv, int hs)
| Check if surface is selected.
void | GV_draw_vect (int vid)
| Draw vector set.
void | GV_alldraw_vect (void)
| Draw all loaded vector sets.
void | GV_draw_fastvect (int vid)
| Draw vector set (fast mode).
void | GV_alldraw_fastvect (void)
| Draw all loaded vector sets (fast mode).
int | GV_Set_ClientData (int id, void *clientd)
| Set client data.
void * | GV_Get_ClientData (int id)
| Get client data.

## Detailed Description

OGSF library - loading and manipulating vector 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, GMSL/University of Illinois
  Updated by Martin landa <landa.martin gmail.com> (doxygenized in May 2008, thematic mapping in June 2011)

Definition in file gv2.c.

## Function Documentation

## GV_alldraw_fastvect()

void GV_alldraw_fastvect | ( | void |  | ) |

Draw all loaded vector sets (fast mode).

Definition at line 548 of file gv2.c.

References GV_draw_fastvect().

## GV_alldraw_vect()

void GV_alldraw_vect | ( | void |  | ) |

Draw all loaded vector sets.

Definition at line 506 of file gv2.c.

References GV_draw_vect().

Referenced by gk_follow_frames(), GK_show_vect(), Nviz_draw_all_vect(), and Nviz_draw_quick().

## GV_delete_vector()

int GV_delete_vector | ( | int | id | ) |

Delete vector set from list.

Parameters

  id | vector set id

Returns
  1 on success
  -1 on error

Definition at line 129 of file gv2.c.

References G_debug(), gv_delete_vect(), and GV_vect_exists().

Referenced by Nviz_new_map_obj().

## GV_draw_fastvect()

void GV_draw_fastvect | ( | int | vid | ) |

Draw vector set (fast mode).

Todo
  Seems to be broken, nothing is drawn

Parameters

  vid | vector set id

Definition at line 524 of file gv2.c.

References gs_get_surf(), gv_get_vect(), and gvd_vect().

Referenced by GV_alldraw_fastvect().

## GV_draw_vect()

void GV_draw_vect | ( | int | vid | ) |

Draw vector set.

Parameters

  vid | vector set id

Definition at line 482 of file gv2.c.

References gs_get_surf(), gv_get_vect(), and gvd_vect().

Referenced by GV_alldraw_vect().

## GV_Get_ClientData()

void * GV_Get_ClientData | ( | int | id | ) |

Get client data.

Parameters

  id | vector set id

Returns
  pointer to client data
  NULL on error

Definition at line 590 of file gv2.c.

References gv_get_vect(), and NULL.

## GV_get_style()

int GV_get_style | ( | int | id,
|  | int * | mem,
|  | int * | color,
|  | int * | width,
|  | int * | use_z )

Get vector style.

Parameters

  | id | vector set id
  [out] | mem | non-zero for use memory
  [out] | color | color value
  [out] | width | line width
  [out] | use_z | non-zero for 3d mode

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

Definition at line 257 of file gv2.c.

References gv_get_vect(), and NULL.

## GV_get_trans()

int GV_get_trans | ( | int | id,
|  | float * | xtrans,
|  | float * | ytrans,
|  | float * | ztrans )

Get trans ?

Parameters

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

Definition at line 366 of file gv2.c.

References gv_get_vect().

## GV_get_vect_list()

int * GV_get_vect_list | ( | int * | numvects | ) |

Get list of vector sets.

Must free when no longer needed!

Parameters

  numvects | number of vector sets

Returns
  pointer to list of point sets
  NULL on error

Definition at line 99 of file gv2.c.

References NULL.

## GV_get_vectname()

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

Get vector map name.

Note: char array is allocated by G_store()

Parameters

  id | vector set id
  filename | &filename

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

Definition at line 204 of file gv2.c.

References G_store(), gv_get_vect(), and NULL.

## GV_load_vector()

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

Load vector set.

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 | vector set id
  filename | filename

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

Definition at line 172 of file gv2.c.

References G_store(), gv_free_vectmem(), gv_get_vect(), Gv_load_vect(), and NULL.

Referenced by Nviz_new_map_obj().

## GV_new_vector()

int GV_new_vector | ( | void |  | ) |

Register new vector set.

Returns
  vector set id
  -1 on error

Definition at line 61 of file gv2.c.

References G_debug(), gv_get_new_vect(), and gv_set_defaults().

Referenced by Nviz_new_map_obj().

## GV_num_vects()

int GV_num_vects | ( | void |  | ) |

Get number of available vector sets.

Returns
  number of vector sets

Definition at line 84 of file gv2.c.

References gv_num_vects().

Referenced by Nviz_new_map_obj().

## GV_select_surf()

int GV_select_surf | ( | int | hv,
|  | int | hs )

Select surface identified by hs to have vector identified by hv draped over it.

Parameters

  hv | vector set id
  hs | surface id

Returns
  1 on success
  -1 on error

Definition at line 393 of file gv2.c.

References GS_surf_exists(), gv_get_vect(), and GV_surf_is_selected().

Referenced by Nviz_new_map_obj().

## GV_Set_ClientData()

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

Set client data.

Parameters

  id | vector set id
  clientd | pointer to client data

Returns
  1 on success
  -1 on error

Definition at line 568 of file gv2.c.

References gv_get_vect().

## GV_set_style()

int GV_set_style | ( | int | id,
|  | int | mem,
|  | int | color,
|  | int | width,
|  | int | use_z )

Set vector style.

Parameters

  id | vector set id
  mem | non-zero for use memory
  color | color value
  width | line width
  use_z | non-zero for 3d mode

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

Definition at line 229 of file gv2.c.

References gv_get_vect(), and NULL.

Referenced by Nviz_new_map_obj().

## GV_set_style_thematic()

int GV_set_style_thematic | ( | int | id,
|  | int | layer,
|  | const char * | color,
|  | const char * | width,
|  | struct Colors * | color_rules )

Set vector set style for thematic mapping.

Updates also style for each geoline.

Parameters

  id | vector set id
  layer | layer number for thematic mapping
  color | color column name
  width | width column name
  color_rules | pointer to Colors structure or NULL

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

Definition at line 287 of file gv2.c.

References G_store(), G_zero(), gv_get_vect(), Gv_load_vect_thematic(), and NULL.

## GV_set_trans()

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

Set trans ?

Parameters

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

Definition at line 343 of file gv2.c.

References G_debug(), and gv_get_vect().

## GV_surf_is_selected()

int GV_surf_is_selected | ( | int | hv,
|  | int | hs )

Check if surface is selected.

Parameters

  hv | vector set id
  hs | surface id

Returns
  1 selected
  0 not selected

Definition at line 459 of file gv2.c.

References gv_get_vect().

Referenced by GV_select_surf(), and GV_unselect_surf().

## GV_unselect_surf()

int GV_unselect_surf | ( | int | hv,
|  | int | hs )

Unselect surface.

Parameters

  hv | vector set id
  hs | surface id

Returns
  1 on success
  -1 on error

Definition at line 422 of file gv2.c.

References gv_get_vect(), and GV_surf_is_selected().

## GV_unset_style_thematic()

int GV_unset_style_thematic | ( | int | id | ) |

Make style for thematic mapping inactive.

Parameters

  id | vector set id

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

Definition at line 320 of file gv2.c.

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

## GV_vect_exists()

int GV_vect_exists | ( | int | id | ) |

Check if vector set exists.

Parameters

  id | vector set id

Returns
  0 not found
  1 found

Definition at line 36 of file gv2.c.

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

Referenced by GV_delete_vector().