QCAD
Open Source 2D CAD
RSpatialIndex Class Referenceabstract

Abstract base class for spatial index implementations. More...

#include <RSpatialIndex.h>

Inheritance diagram for RSpatialIndex:
RRequireHeap RSpatialIndexNavel RSpatialIndexSimple

Public Member Functions

virtual void addToIndex (int id, const QList< RBox > &bbs)
 Adds a new entry at multiple positions into this spatial index. More...
 
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)=0
 Adds a new entry into this spatial index. More...
 
virtual void bulkLoad (const QList< int > &ids, const QList< QList< RBox > > &bbs)
 
virtual void bulkLoadSimple (const QList< int > &ids, const QList< RBox > &bbs)
 
virtual void clear ()=0
 
virtual RSpatialIndexcreate ()=0
 
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 > > queryContained (double x1, double y1, double z1, double x2, double y2, double z2, RSpatialIndexVisitor *dataVisitor=NULL)=0
 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 (const RBox &b, RSpatialIndexVisitor *dataVisitor=NULL)
 Queries the index for all items that are completely inside or intersect with the given box. More...
 
virtual QMap< int, QSet< int > > queryIntersected (double x1, double y1, double z1, double x2, double y2, double z2, RSpatialIndexVisitor *dataVisitor=NULL)=0
 Queries the index for all items that are completely inside or intersect with the given box x1,y1,z1,x2,y2,z2. More...
 
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)=0
 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)=0
 Removes the entry with the given ID from this spatial index. More...
 
 RSpatialIndex ()
 
virtual ~RSpatialIndex ()
 
- Public Member Functions inherited from RRequireHeap
void doDelete ()
 

Static Public Member Functions

static int getId (qint64 siid)
 
static int getPos (qint64 siid)
 
static qint64 getSIId (int id, int pos)
 

Protected Attributes

int idCounter
 

Additional Inherited Members

- Protected Member Functions inherited from RRequireHeap
virtual ~RRequireHeap ()
 

Detailed Description

Abstract base class for spatial index implementations.

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

Constructor & Destructor Documentation

◆ RSpatialIndex()

RSpatialIndex::RSpatialIndex ( )
inline

◆ ~RSpatialIndex()

virtual RSpatialIndex::~RSpatialIndex ( )
inlinevirtual

Member Function Documentation

◆ addToIndex() [1/3]

void RSpatialIndex::addToIndex ( int  id,
const QList< RBox > &  bbs 
)
virtual

Adds a new entry at multiple positions into this spatial index.

◆ addToIndex() [2/3]

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

Adds a new entry into this spatial index.

Reimplemented in RSpatialIndexNavel.

◆ addToIndex() [3/3]

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

Adds a new entry into this spatial index.

Implemented in RSpatialIndexNavel, and RSpatialIndexSimple.

◆ bulkLoad()

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

Reimplemented in RSpatialIndexNavel.

◆ bulkLoadSimple()

void RSpatialIndex::bulkLoadSimple ( const QList< int > &  ids,
const QList< RBox > &  bbs 
)
virtual

◆ clear()

virtual void RSpatialIndex::clear ( )
pure virtual

◆ create()

virtual RSpatialIndex* RSpatialIndex::create ( )
pure virtual

◆ getId()

int RSpatialIndex::getId ( qint64  siid)
static

◆ getPos()

int RSpatialIndex::getPos ( qint64  siid)
static

◆ getSIId()

qint64 RSpatialIndex::getSIId ( int  id,
int  pos 
)
static

◆ queryContained() [1/2]

QMap< int, QSet< int > > RSpatialIndex::queryContained ( const RBox b,
RSpatialIndexVisitor dataVisitor = NULL 
)
virtual

Queries the index for all items that are completely inside the given box.

◆ queryContained() [2/2]

virtual QMap<int, QSet<int> > RSpatialIndex::queryContained ( double  x1,
double  y1,
double  z1,
double  x2,
double  y2,
double  z2,
RSpatialIndexVisitor dataVisitor = NULL 
)
pure 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).

Implemented in RSpatialIndexNavel, and RSpatialIndexSimple.

◆ queryIntersected() [1/2]

QMap< int, QSet< int > > RSpatialIndex::queryIntersected ( const RBox b,
RSpatialIndexVisitor dataVisitor = NULL 
)
virtual

Queries the index for all items that are completely inside or intersect with the given box.

◆ queryIntersected() [2/2]

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

Queries the index for all items that are completely inside or intersect with 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).
Returns
map with IDs as keys and positions as values

Implemented in RSpatialIndexNavel, and RSpatialIndexSimple.

◆ queryNearestNeighbor() [1/2]

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

Convenience implementation for scripts.

Reimplemented in RSpatialIndexNavel.

◆ queryNearestNeighbor() [2/2]

virtual QMap<int, QSet<int> > RSpatialIndex::queryNearestNeighbor ( unsigned int  k,
double  x,
double  y,
double  z,
RSpatialIndexVisitor dataVisitor = NULL 
)
pure 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).

Implemented in RSpatialIndexNavel.

◆ removeFromIndex() [1/3]

bool RSpatialIndex::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 in RSpatialIndexNavel, and RSpatialIndexSimple.

◆ removeFromIndex() [2/3]

bool RSpatialIndex::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 in RSpatialIndexNavel.

◆ removeFromIndex() [3/3]

virtual bool RSpatialIndex::removeFromIndex ( int  id,
int  pos,
double  x1,
double  y1,
double  z1,
double  x2,
double  y2,
double  z2 
)
pure 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.

Implemented in RSpatialIndexNavel, and RSpatialIndexSimple.

Member Data Documentation

◆ idCounter

int RSpatialIndex::idCounter
protected

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