GRASS GIS 7 Programmer's Manual  7.5.svn(2018)-r72272
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
spindex_rw.c File Reference
#include <sys/types.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <assert.h>
#include <grass/vector.h>
#include <grass/glocale.h>
#include <grass/version.h>
Include dependency graph for spindex_rw.c:

Go to the source code of this file.

Macros

#define NUMSIDES   6
 

Functions

int dig_Wr_spidx_head (struct gvfile *fp, struct Plus_head *ptr)
 Write spatial index header to file. More...
 
int dig_Rd_spidx_head (struct gvfile *fp, struct Plus_head *ptr)
 Read spatial index header from sidx file. More...
 
int dig_Wr_spidx (struct gvfile *fp, struct Plus_head *Plus)
 Write spatial index to file. More...
 
int dig_Rd_spidx (struct gvfile *fp, struct Plus_head *Plus)
 Read spatial index from sidx file Only needed when old vector is opened in update mode. More...
 
int dig_dump_spidx (FILE *fp, const struct Plus_head *Plus)
 Dump spatial index. More...
 
int rtree_search (struct RTree *t, struct RTree_Rect *r, SearchHitCallback shcb, void *cbarg, struct Plus_head *Plus)
 Search spatial index file Can't use regular RTreeSearch() here because sidx must be read with dig__fread_port_*() functions. More...
 

Macro Definition Documentation

#define NUMSIDES   6

Definition at line 29 of file spindex_rw.c.

Referenced by rtree_search().

Function Documentation

int dig_dump_spidx ( FILE *  fp,
const struct Plus_head Plus 
)

Dump spatial index.

Parameters
[out]fppointer to FILE
Pluspointer to Plus_head structure
Returns
0

Definition at line 1272 of file spindex_rw.c.

References Plus_head::Area_spidx, RTree::fd, Plus_head::Isle_spidx, Plus_head::Line_spidx, Plus_head::Node_spidx, RTree::root, RTree::rootpos, RTreeFlushBuffer(), and Plus_head::with_z.

Referenced by Vect_sidx_dump().

int dig_Rd_spidx ( struct gvfile fp,
struct Plus_head Plus 
)

Read spatial index from sidx file Only needed when old vector is opened in update mode.

Parameters
fppointer to struct gvfile
[in,out]Pluspointer to Plus_head structure
Returns
0

Definition at line 1228 of file spindex_rw.c.

References Plus_head::Area_spidx, Plus_head::Area_spidx_offset, dig_Rd_spidx_head(), dig_rewind(), dig_set_cur_port(), dig_spidx_free(), dig_spidx_init(), G_debug(), Plus_head::Isle_spidx, Plus_head::Isle_spidx_offset, Plus_head::Line_spidx, Plus_head::Line_spidx_offset, Plus_head::Node_spidx, Plus_head::Node_spidx_offset, Port_info::off_t_size, and Plus_head::spidx_port.

Referenced by Vect_open_sidx().

int dig_Wr_spidx ( struct gvfile fp,
struct Plus_head Plus 
)
int rtree_search ( struct RTree t,
struct RTree_Rect r,
SearchHitCallback  shcb,
void *  cbarg,
struct Plus_head Plus 
)

Search spatial index file Can't use regular RTreeSearch() here because sidx must be read with dig__fread_port_*() functions.

Parameters
tpointer to RTree
rsearch rectangle
shcbuser-provided callback
cbargargument for shcb
Pluspointer to Plus_head structure
Returns
number of qualifying rectangles

Definition at line 1396 of file spindex_rw.c.

References dig__fread_port_D(), dig__fread_port_I(), dig__fread_port_O(), dig_fseek(), dig_set_cur_port(), int, RTree::leafcard, RTree::nodecard, NUMSIDES, Port_info::off_t_size, RTree::rootlevel, RTree::rootpos, RTreeOverlap(), Plus_head::spidx_fp, and Plus_head::spidx_port.

Referenced by dig_find_area_box(), dig_find_isle_box(), dig_find_line_box(), dig_find_node(), dig_select_areas(), dig_select_isles(), dig_select_lines(), and dig_select_nodes().