GRASS GIS 8 Programmer's Manual  8.2.2dev(2023)-3d2c704037
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

◆ NUMSIDES

#define NUMSIDES   6

Definition at line 29 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 1274 of file spindex_rw.c.

References RTree::fd, and Plus_head::Node_spidx.

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

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

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

References dig_rewind(), dig_set_cur_port(), dig_Wr_spidx_head(), G_debug(), Plus_head::Node_spidx_offset, and Plus_head::spidx_port.

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

References assert, dig_set_cur_port(), and Plus_head::spidx_port.