GRASS GIS 7 Programmer's Manual  7.5.svn(2018)-r72651
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
vector/Vlib/select.c File Reference

Vector library - spatial index. More...

#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
#include <string.h>
#include <grass/vector.h>
#include <grass/glocale.h>
Include dependency graph for vector/Vlib/select.c:

Go to the source code of this file.

Functions

void Vect_spatial_index_init (struct spatial_index *si, int with_z)
 Initialize spatial index structure. More...
 
void Vect_spatial_index_destroy (struct spatial_index *si)
 Destroy existing spatial index. More...
 
void Vect_spatial_index_add_item (struct spatial_index *si, int id, const struct bound_box *box)
 Add a new item to spatial index structure. More...
 
void Vect_spatial_index_del_item (struct spatial_index *si, int id, const struct bound_box *box)
 Delete item from spatial index structure. More...
 
int Vect_spatial_index_select (const struct spatial_index *si, const struct bound_box *box, struct ilist *list)
 Select items by bounding box to list. More...
 

Detailed Description

Vector library - spatial index.

Higher level functions for a custom spatial index.

(C) 2001-2009 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

Definition in file vector/Vlib/select.c.

Function Documentation

void Vect_spatial_index_add_item ( struct spatial_index si,
int  id,
const struct bound_box box 
)

Add a new item to spatial index structure.

Parameters
[in,out]sipointer to spatial index structure
iditem identifier
boxpointer to item bounding box
Returns
void

Definition at line 62 of file vector/Vlib/select.c.

References bound_box::B, RTree_Rect::boundary, bound_box::E, G_debug(), bound_box::N, RTree::nsides_alloc, RTreeInsertRect(), bound_box::S, spatial_index::si_tree, bound_box::T, and bound_box::W.

void Vect_spatial_index_del_item ( struct spatial_index si,
int  id,
const struct bound_box box 
)

Delete item from spatial index structure.

Parameters
[in,out]sipointer to spatial index structure
iditem identifier
Returns
void

Definition at line 92 of file vector/Vlib/select.c.

References _, bound_box::B, RTree_Rect::boundary, bound_box::E, G_debug(), G_fatal_error(), bound_box::N, RTree::nsides_alloc, RTreeDeleteRect(), bound_box::S, spatial_index::si_tree, bound_box::T, and bound_box::W.

void Vect_spatial_index_destroy ( struct 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 46 of file vector/Vlib/select.c.

References G_debug(), RTreeDestroyTree(), and spatial_index::si_tree.

void Vect_spatial_index_init ( struct spatial_index si,
int  with_z 
)

Initialize spatial index structure.

Parameters
sipointer to spatial index structure
Returns
void

Definition at line 30 of file vector/Vlib/select.c.

References G_debug(), RTreeCreateTree(), and spatial_index::si_tree.

int Vect_spatial_index_select ( const struct spatial_index si,
const struct bound_box box,
struct ilist list 
)

Select items by bounding box to list.

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

Definition at line 136 of file vector/Vlib/select.c.

References bound_box::B, RTree_Rect::boundary, bound_box::E, G_debug(), bound_box::N, ilist::n_values, RTree::nsides_alloc, RTreeSearch(), bound_box::S, spatial_index::si_tree, bound_box::T, Vect_reset_list(), and bound_box::W.