QCAD
Open Source 2D CAD
RSpatialIndexNavel Class Reference

Spatial index class. More...

#include <RSpatialIndexNavel.h>

Inheritance diagram for RSpatialIndexNavel:
RSpatialIndex RRequireHeap

Classes

class  RSiPoint
 Internal representation of a point. More...
 
class  RSiRegion
 Internal representation of a rectangular region. More...
 
class  Visitor
 Internal node and data visitor. More...
 

Public Member Functions

virtual void addToIndex (int id, int pos, const RBox &bb)
 Adds a new entry into this spatial index. More...
 
virtual void addToIndex (int id, int pos, double x1, double y1, double z1, double x2, double y2, double z2)
 Adds an item to the index. More...
 
virtual void bulkLoad (const QList< int > &ids, const QList< QList< RBox > > &bbs)
 
virtual void clear ()
 
virtual RSpatialIndexcreate ()
 
virtual QMap< int, QSet< int > > queryContained (double x1, double y1, double z1, double x2, double y2, double z2, RSpatialIndexVisitor *dataVisitor=NULL)
 Queries the index for all items that are completely inside the given box x1,y1,z1,x2,y2,z2. More...
 
virtual QMap< int, QSet< int > > queryIntersected (double x1, double y1, double z1, double x2, double y2, double z2, RSpatialIndexVisitor *dataVisitor=NULL)
 Removes the item with the given ID from this spatial index. More...
 
QList< int > queryIntersectedSimple (const RBox &b)
 
virtual QPair< int, int > queryNearestNeighbor (double x, double y, double z)
 Convenience implementation for scripts. More...
 
virtual QMap< int, QSet< int > > queryNearestNeighbor (unsigned int k, double x, double y, double z, RSpatialIndexVisitor *dataVisitor=NULL)
 Queries the index for closest neighbor items. More...
 
virtual bool removeFromIndex (int id, const QList< RBox > &bb)
 Removes the entry with the given ID from this spatial index. More...
 
virtual bool removeFromIndex (int id, int pos, const RBox &bb)
 Removes the entry with the given ID from this spatial index. More...
 
virtual bool removeFromIndex (int id, int pos, double x1, double y1, double z1, double x2, double y2, double z2)
 Removes the entry with the given ID from this spatial index. More...
 
 RSpatialIndexNavel ()
 Creates a 2d spatial index in memory (r-tree, star shape). More...
 
 ~RSpatialIndexNavel ()
 
- Public Member Functions inherited from RSpatialIndex
virtual void addToIndex (int id, const QList< RBox > &bbs)
 Adds a new entry at multiple positions into this spatial index. More...
 
virtual void bulkLoadSimple (const QList< int > &ids, const QList< RBox > &bbs)
 
virtual QMap< int, QSet< int > > queryContained (const RBox &b, RSpatialIndexVisitor *dataVisitor=NULL)
 Queries the index for all items that are completely inside the given box. More...
 
virtual QMap< int, QSet< int > > queryIntersected (const RBox &b, RSpatialIndexVisitor *dataVisitor=NULL)
 Queries the index for all items that are completely inside or intersect with the given box. More...
 
 RSpatialIndex ()
 
virtual ~RSpatialIndex ()
 
- Public Member Functions inherited from RRequireHeap
void doDelete ()
 

Protected Member Functions

void addToIndex (int id, int pos, const RSiRegion &region, size_t dataLength=0, const uint8_t *data=NULL)
 Internal. More...
 
void init ()
 
QMap< int, QSet< int > > queryContained (const RSiRegion &region, RSpatialIndexVisitor *dataVisitor=NULL)
 Internal. More...
 
QMap< int, QSet< int > > queryIntersected (const RSiRegion &region, RSpatialIndexVisitor *dataVisitor=NULL)
 Internal. More...
 
QMap< int, QSet< int > > queryNearestNeighbor (unsigned int k, const RSiPoint &point, RSpatialIndexVisitor *dataVisitor=NULL)
 Internal. More...
 
void uninit ()
 
- Protected Member Functions inherited from RRequireHeap
virtual ~RRequireHeap ()
 

Protected Attributes

SpatialIndex::IStorageManager * buff
 
SpatialIndex::ISpatialIndex * tree
 
- Protected Attributes inherited from RSpatialIndex
int idCounter
 

Additional Inherited Members

- Static Public Member Functions inherited from RSpatialIndex
static int getId (qint64 siid)
 
static int getPos (qint64 siid)
 
static qint64 getSIId (int id, int pos)
 

Detailed Description

Spatial index class.

Each instance of this class offers a spatial index. This class wraps the API of the "spatial index" library.

Scriptable:\nThis class is available in script environments.\n

Constructor & Destructor Documentation

◆ RSpatialIndexNavel()

RSpatialIndexNavel::RSpatialIndexNavel ( )

Creates a 2d spatial index in memory (r-tree, star shape).

◆ ~RSpatialIndexNavel()

RSpatialIndexNavel::~RSpatialIndexNavel ( )

Member Function Documentation

◆ addToIndex() [1/3]

void RSpatialIndexNavel::addToIndex ( int  id,
int  pos,
const RBox bb 
)
virtual

Adds a new entry into this spatial index.

Reimplemented from RSpatialIndex.

◆ addToIndex() [2/3]

void RSpatialIndexNavel::addToIndex ( int  id,
int  pos,
const RSiRegion region,
size_t  dataLength = 0,
const uint8_t *  data = NULL 
)
protected

Internal.

Non-Scriptable:\nThis function is not available in script environments.\n

◆ addToIndex() [3/3]

void RSpatialIndexNavel::addToIndex ( int  id,
int  pos,
double  x1,
double  y1,
double  z1,
double  x2,
double  y2,
double  z2 
)
virtual

Adds an item to the index.

Parameters
idID of the item.
x1lower value of the first dimension.
y1lower value of the second dimension.
z1lower value of the third dimension.
x2higher value of the first dimension.
y2higher value of the second dimension.
z2higher value of the third dimension.
dataLengthLength of the data in bytes or 0.
dataPointer to the data associated with the item. The index makes a deep copy of the data, the caller is responsible for deleting the data. NULL indicates that the item data is stored externally (e.g. in a map or list).

Implements RSpatialIndex.

◆ bulkLoad()

void RSpatialIndexNavel::bulkLoad ( const QList< int > &  ids,
const QList< QList< RBox > > &  bbs 
)
virtual

Reimplemented from RSpatialIndex.

◆ clear()

void RSpatialIndexNavel::clear ( )
virtual

Implements RSpatialIndex.

◆ create()

RSpatialIndex * RSpatialIndexNavel::create ( )
virtual

Implements RSpatialIndex.

◆ init()

void RSpatialIndexNavel::init ( )
protected

◆ queryContained() [1/2]

QMap< int, QSet< int > > RSpatialIndexNavel::queryContained ( const RSiRegion region,
RSpatialIndexVisitor dataVisitor = NULL 
)
protected

Internal.

Non-Scriptable:\nThis function is not available in script environments.\n

◆ queryContained() [2/2]

QMap< int, QSet< int > > RSpatialIndexNavel::queryContained ( double  x1,
double  y1,
double  z1,
double  x2,
double  y2,
double  z2,
RSpatialIndexVisitor dataVisitor = NULL 
)
virtual

Queries the index for all items that are completely inside the given box x1,y1,z1,x2,y2,z2.

Parameters
x1lower region boundary of the first dimension.
y1lower region boundary of the second dimension.
z1lower region boundary of the third dimension.
x2higher region boundary of the first dimension.
y2higher region boundary of the second dimension.
z2higher region boundary of the third dimension.
dataVisitorThe item data is handed back to the caller over this object (visitor pattern).

Implements RSpatialIndex.

◆ queryIntersected() [1/2]

QMap< int, QSet< int > > RSpatialIndexNavel::queryIntersected ( const RSiRegion region,
RSpatialIndexVisitor dataVisitor = NULL 
)
protected

Internal.

Non-Scriptable:\nThis function is not available in script environments.\n

◆ queryIntersected() [2/2]

QMap< int, QSet< int > > RSpatialIndexNavel::queryIntersected ( double  x1,
double  y1,
double  z1,
double  x2,
double  y2,
double  z2,
RSpatialIndexVisitor dataVisitor = NULL 
)
virtual

Removes the item with the given ID from this spatial index.

Implements RSpatialIndex.

◆ queryIntersectedSimple()

QList<int> RSpatialIndexNavel::queryIntersectedSimple ( const RBox b)
inline

◆ queryNearestNeighbor() [1/3]

QPair< int, int > RSpatialIndexNavel::queryNearestNeighbor ( double  x,
double  y,
double  z 
)
virtual

Convenience implementation for scripts.

Reimplemented from RSpatialIndex.

◆ queryNearestNeighbor() [2/3]

QMap< int, QSet< int > > RSpatialIndexNavel::queryNearestNeighbor ( unsigned int  k,
const RSiPoint point,
RSpatialIndexVisitor dataVisitor = NULL 
)
protected

Internal.

Non-Scriptable:\nThis function is not available in script environments.\n

◆ queryNearestNeighbor() [3/3]

QMap< int, QSet< int > > RSpatialIndexNavel::queryNearestNeighbor ( unsigned int  k,
double  x,
double  y,
double  z,
RSpatialIndexVisitor dataVisitor = NULL 
)
virtual

Queries the index for closest neighbor items.

Parameters
x1position of the first dimension.
y1position of the second dimension.
z1position of the third dimension.
dataVisitorThe item data is handed back to the caller over this object (visitor pattern).

Implements RSpatialIndex.

◆ removeFromIndex() [1/3]

bool RSpatialIndexNavel::removeFromIndex ( int  id,
const QList< RBox > &  bb 
)
virtual

Removes the entry with the given ID from this spatial index.

the bounding boxes are provided for faster lookup.

Reimplemented from RSpatialIndex.

◆ removeFromIndex() [2/3]

bool RSpatialIndexNavel::removeFromIndex ( int  id,
int  pos,
const RBox bb 
)
virtual

Removes the entry with the given ID from this spatial index.

the bounding box is provided for faster lookup.

Reimplemented from RSpatialIndex.

◆ removeFromIndex() [3/3]

bool RSpatialIndexNavel::removeFromIndex ( int  id,
int  pos,
double  x1,
double  y1,
double  z1,
double  x2,
double  y2,
double  z2 
)
virtual

Removes the entry with the given ID from this spatial index.

Removes the entry with the given ID from this spatial index. the bounding box is provided for fast lookup.

Implements RSpatialIndex.

◆ uninit()

void RSpatialIndexNavel::uninit ( )
protected

Member Data Documentation

◆ buff

SpatialIndex::IStorageManager* RSpatialIndexNavel::buff
protected

◆ tree

SpatialIndex::ISpatialIndex* RSpatialIndexNavel::tree
protected

The documentation for this class was generated from the following files: