GRASS 8 Programmer's Manual 8.6.0dev(2026)-f6f2c534ea
Loading...
Searching...
No Matches
spindex_rw.c File Reference
#include <inttypes.h>
#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.
 
int dig_Rd_spidx_head (struct gvfile *fp, struct Plus_head *ptr)
 Read spatial index header from sidx file.
 
int dig_Wr_spidx (struct gvfile *fp, struct Plus_head *Plus)
 Write spatial index to file.
 
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.
 
int dig_dump_spidx (FILE *fp, const struct Plus_head *Plus)
 Dump spatial index.
 
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.
 

Macro Definition Documentation

◆ NUMSIDES

#define NUMSIDES   6

Definition at line 30 of file spindex_rw.c.

Function Documentation

◆ dig_dump_spidx()

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 1263 of file spindex_rw.c.

References RTreeFlushBuffer().

Referenced by Vect_sidx_dump().

◆ dig_Rd_spidx()

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 1219 of file spindex_rw.c.

References dig_Rd_spidx_head(), dig_rewind(), dig_set_cur_port(), dig_spidx_free(), dig_spidx_init(), and G_debug().

Referenced by Vect_open_sidx().

◆ dig_Rd_spidx_head()

◆ dig_Wr_spidx()

int dig_Wr_spidx ( struct gvfile fp,
struct Plus_head Plus 
)

Write spatial index to file.

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

Definition at line 1173 of file spindex_rw.c.

References dig_fflush(), dig_ftell(), dig_rewind(), dig_set_cur_port(), dig_Wr_spidx_head(), and G_debug().

Referenced by Vect_save_sidx().

◆ dig_Wr_spidx_head()

◆ rtree_search()

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 1383 of file spindex_rw.c.

References assert, dig__fread_port_D(), dig__fread_port_I(), dig__fread_port_O(), dig_fseek(), dig_set_cur_port(), MAXLEVEL, NUMSIDES, r, RTreeOverlap(), and t.

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().