GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
sindex.c File Reference

Vector library - spatial index. More...

#include <stdlib.h>
#include <string.h>
#include <grass/glocale.h>
#include <grass/gis.h>
#include <grass/Vect.h>
Include dependency graph for sindex.c:

Go to the source code of this file.

Functions

void Vect_spatial_index_init (SPATIAL_INDEX *si)
 Init spatial index. More...
 
void Vect_spatial_index_destroy (SPATIAL_INDEX *si)
 Destroy existing spatial index. More...
 
void Vect_spatial_index_add_item (SPATIAL_INDEX *si, int id, BOUND_BOX *box)
 Add a new item to spatial index. More...
 
void Vect_spatial_index_del_item (SPATIAL_INDEX *si, int id)
 Delete item from spatial index. More...
 
int Vect_build_spatial_index (struct Map_info *Map)
 Create spatial index if necessary. More...
 
int Vect_build_sidx_from_topo (struct Map_info *Map)
 Create spatial index from topo if necessary. More...
 
int Vect_spatial_index_select (SPATIAL_INDEX *si, BOUND_BOX *box, struct ilist *list)
 Select items by bounding box to list. More...
 

Detailed Description

Vector library - spatial index.

Higher level functions for reading/writing/manipulating vectors.

(C) 2001-2008 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
Radim Blazek
Date
2001

Definition in file sindex.c.

Function Documentation

int Vect_build_sidx_from_topo ( struct Map_info *  Map)
int Vect_build_spatial_index ( struct Map_info *  Map)

Create spatial index if necessary.

To be used in modules. Map must be opened on level 2.

Parameters
Mappointer to vector map
outprint progress here
Returns
0 OK
1 error

Definition at line 124 of file sindex.c.

References G_fatal_error(), and Vect_build_sidx_from_topo().

void Vect_spatial_index_add_item ( SPATIAL_INDEX *  si,
int  id,
BOUND_BOX *  box 
)

Add a new item to spatial index.

Parameters
sipointer to spatial index structure
iditem identifier
boxpointer to item bounding box
Returns
void

Definition at line 66 of file sindex.c.

References Rect::boundary, G_debug(), and RTreeInsertRect().

void Vect_spatial_index_del_item ( SPATIAL_INDEX *  si,
int  id 
)

Delete item from spatial index.

Parameters
sipointer to spatial index structure
iditem identifier
Returns
void

Definition at line 89 of file sindex.c.

References G_debug(), G_fatal_error(), and RTreeDeleteRect().

void Vect_spatial_index_destroy ( SPATIAL_INDEX *  si)

Destroy existing spatial index.

Vect_spatial_index_init() must be call before new use.

Parameters
sipointer to spatial index structure
Returns
void

Definition at line 50 of file sindex.c.

References G_debug(), and RTreeDestroyNode().

void Vect_spatial_index_init ( SPATIAL_INDEX *  si)

Init spatial index.

Parameters
sipointer to spatial index structure
Returns
void

Definition at line 34 of file sindex.c.

References G_debug(), and RTreeNewIndex().

int Vect_spatial_index_select ( SPATIAL_INDEX *  si,
BOUND_BOX *  box,
struct ilist *  list 
)

Select items by bounding box to list.

Parameters
sipointer to spatial index structure
boxbounding box
listpointer to list where selected items are stored
Returns
number of selected items

Definition at line 255 of file sindex.c.

References Rect::boundary, G_debug(), and RTreeSearch().