Functions

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.
void Vect_spatial_index_destroy (SPATIAL_INDEX *si)
 Destroy existing spatial index.
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)
 Create spatial index if necessary.
int Vect_build_sidx_from_topo (struct Map_info *Map)
 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.

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  ) 

Create spatial index from topo if necessary.

Parameters:
Map pointer to vector map
Returns:
0 OK
1 error

Definition at line 144 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  ) 

Create spatial index if necessary.

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

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

Definition at line 124 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
Returns:
void

Definition at line 66 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
Returns:
void

Definition at line 89 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
Returns:
void

Definition at line 50 of file sindex.c.

References RTreeDestroyNode().

void Vect_spatial_index_init ( SPATIAL_INDEX *  si  ) 

Init spatial index.

Parameters:
si pointer to spatial index structure
Returns:
void

Definition at line 34 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.

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

Definition at line 255 of file sindex.c.

References Rect::boundary, and RTreeSearch().