sindex.c File Reference

#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
void Vect_spatial_index_destroy (SPATIAL_INDEX *si)
 destroy existing spatial index, Vect_spatial_index_init() must be call before new use
void Vect_spatial_index_add_item (SPATIAL_INDEX *si, int id, BOUND_BOX *box)
 Add a new item to spatial index.
void Vect_spatial_index_del_item (SPATIAL_INDEX *si, int id)
 Delete item from spatial index.
int Vect_build_spatial_index (struct Map_info *Map, FILE *msgout)
 Create spatial index if necessary. To be used in modules. Map must be opened on level 2.
int Vect_build_sidx_from_topo (struct Map_info *Map, FILE *msgout)
 Create spatial index from topo if necessary.
int Vect_spatial_index_select (SPATIAL_INDEX *si, BOUND_BOX *box, struct ilist *list)
 Select items by bounding box to list.


Function Documentation

int Vect_build_sidx_from_topo ( struct Map_info *  Map,
FILE *  msgout 
)

Create spatial index from topo if necessary.

Parameters:
Map pointer to map
out print progress here
Returns:
0 OK

1 error

Definition at line 124 of file sindex.c.

References dig_spidx_add_area(), dig_spidx_add_isle(), dig_spidx_add_line(), dig_spidx_add_node(), and dig_spidx_init().

Referenced by Vect_build_spatial_index(), Vect_open_update(), Vect_select_areas_by_box(), Vect_select_isles_by_box(), Vect_select_lines_by_box(), Vect_select_nodes_by_box(), and Vect_spatial_index_dump().

int Vect_build_spatial_index ( struct Map_info *  Map,
FILE *  msgout 
)

Create spatial index if necessary. To be used in modules. Map must be opened on level 2.

Parameters:
Map pointer to map
out print progress here
Returns:
0 OK

1 error

Definition at line 105 of file sindex.c.

References 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:
si pointer to spatial index structure
id item identifier
box pointer to item bounding box

Definition at line 56 of file sindex.c.

References Rect::boundary, and RTreeInsertRect().

void Vect_spatial_index_del_item ( SPATIAL_INDEX *  si,
int  id 
)

Delete item from spatial index.

Parameters:
si pointer to spatial index structure
id item identifier

Definition at line 74 of file sindex.c.

References RTreeDeleteRect().

void Vect_spatial_index_destroy ( SPATIAL_INDEX *  si  ) 

destroy existing spatial index, Vect_spatial_index_init() must be call before new use

Parameters:
si pointer to spatial index structure

Definition at line 41 of file sindex.c.

References RTreeDestroyNode().

void Vect_spatial_index_init ( SPATIAL_INDEX *  si  ) 

init spatial index

Parameters:
si pointer to spatial index structure

Definition at line 28 of file sindex.c.

References RTreeNewIndex().

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

Select items by bounding box to list.

Returns:
number of selected items
Parameters:
si pointer to spatial index structure
box bounding box
list pointer to list where selected items are stored

Definition at line 230 of file sindex.c.

References Rect::boundary, and RTreeSearch().


Generated on Sun Apr 6 17:32:53 2008 for GRASS by  doxygen 1.5.5