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

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

`#include <stdio.h>`
`#include <stdlib.h>`
`#include <grass/ogsf.h>`
`#include "gsget.h"`
Include dependency graph for gv.c:

Go to the source code of this file.

## Macros

#define | FIRST_VECT_ID 20656

## Functions

geovect * | gv_get_vect (int id)
| Get vector set.
geovect * | gv_get_prev_vect (int id)
| Get previous vector set.
int | gv_num_vects (void)
| Get number of loaded vector sets.
geovect * | gv_get_last_vect (void)
| Get last loaded vector set.
geovect * | gv_get_new_vect (void)
| Allocate memory for new vector set.
void | gv_update_drapesurfs (void)
| Update drape surfaces.
int | gv_set_defaults (geovect *gv)
| Set attributes of vector set to default values.
int | gv_init_vect (geovect *gv)
| Initialize geovect struct.
void | gv_delete_vect (int id)
| Delete vector set (unload).
int | gv_free_vect (geovect *fv)
| Free allocated memory for geovect struct.
void | gv_free_vectmem (geovect *fv)
| Free allocated memory.
void | gv_set_drapesurfs (geovect *gv, int *hsurfs, int nsurfs)
| Set drape surfaces for vector set.

## Detailed Description

OGSF library - loading and manipulating vector sets (lower 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 (November 1993)
  Doxygenized by Martin Landa (June 2008)

Definition in file gv.c.

## Macro Definition Documentation

## FIRST_VECT_ID

#define FIRST_VECT_ID 20656

Definition at line 22 of file gv.c.

Referenced by gv_get_new_vect().

## Function Documentation

## gv_delete_vect()

void gv_delete_vect | ( | int | id | ) |

Delete vector set (unload).

Parameters

  id | vector set id

Definition at line 242 of file gv.c.

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

Referenced by GV_delete_vector().

## gv_free_vect()

int gv_free_vect | ( | geovect * | fv | ) |

Free allocated memory for geovect struct.

Parameters

  fv | pointer to geovect struct

Returns
  -1 on failure
  1 on success

Definition at line 265 of file gv.c.

References G_debug(), G_free(), gv_free_vectmem(), and NULL.

Referenced by gv_delete_vect().

## gv_free_vectmem()

void gv_free_vectmem | ( | geovect * | fv | ) |

Free allocated memory.

Parameters

  fv | pointer to geovect struct

Definition at line 313 of file gv.c.

References G_free(), NULL, and sub_Vectmem().

Referenced by gv_free_vect(), and GV_load_vector().

## gv_get_last_vect()

geovect * gv_get_last_vect | ( | void |  | ) |

Get last loaded vector set.

Returns
  pointer to geovect struct
  NULL on failure (no vector set available)

Definition at line 96 of file gv.c.

References G_debug(), and NULL.

Referenced by gv_get_new_vect().

## gv_get_new_vect()

geovect * gv_get_new_vect | ( | void |  | ) |

Allocate memory for new vector set.

Returns
  pointer to geovect struct
  NULL on failure

Definition at line 118 of file gv.c.

References FIRST_VECT_ID, G_debug(), G_zero(), gv_get_last_vect(), and NULL.

Referenced by GV_new_vector().

## gv_get_prev_vect()

geovect * gv_get_prev_vect | ( | int | id | ) |

Get previous vector set.

Parameters

  id | vector set id

Returns
  pointer to geovect struct
  NULL on failure

Definition at line 57 of file gv.c.

References G_debug(), and NULL.

## gv_get_vect()

geovect * gv_get_vect | ( | int | id | ) |

Get vector set.

Parameters

  id | vector set id

Returns
  pointer to geovect struct
  NULL on failure

Definition at line 34 of file gv.c.

References G_debug(), and NULL.

Referenced by gv_delete_vect(), GV_draw_fastvect(), GV_draw_vect(), GV_Get_ClientData(), GV_get_style(), GV_get_trans(), GV_get_vectname(), GV_load_vector(), GV_select_surf(), GV_Set_ClientData(), GV_set_style(), GV_set_style_thematic(), GV_set_trans(), GV_surf_is_selected(), GV_unselect_surf(), GV_unset_style_thematic(), and GV_vect_exists().

## gv_init_vect()

int gv_init_vect | ( | geovect * | gv | ) |

Initialize geovect struct.

Parameters

  gv | pointer to geovect struct

Returns
  -1 on failure
  0 on success

Definition at line 226 of file gv.c.

References G_debug().

## gv_num_vects()

int gv_num_vects | ( | void |  | ) |

Get number of loaded vector sets.

Returns
  number of vector sets

Definition at line 77 of file gv.c.

References G_debug().

Referenced by GV_num_vects().

## gv_set_defaults()

int gv_set_defaults | ( | geovect * | gv | ) |

Set attributes of vector set to default values.

Parameters

  gv | pointer to geovect struct

Returns
  -1 on error
  0 on success

Definition at line 187 of file gv.c.

References G_debug(), and NULL.

Referenced by GV_new_vector().

## gv_set_drapesurfs()

void gv_set_drapesurfs | ( | geovect * | gv,
|  | int * | hsurfs,
|  | int | nsurfs )

Set drape surfaces for vector set.

Parameters

  gv | pointer to geovect struct
  hsurfs | array of surfaces (id)
  nsurfs | number of surfaces

Definition at line 364 of file gv.c.

## gv_update_drapesurfs()

void gv_update_drapesurfs | ( | void |  | ) |

Update drape surfaces.

Call after surface is deleted

Definition at line 157 of file gv.c.

References gs_get_surf(), and NULL.

Referenced by GS_delete_surface().