QCAD
Open Source 2D CAD
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RSpatialIndexSimple Class Reference

Copyright (c) 2011-2014 by Andrew Mustun. More...

#include <RSpatialIndexSimple.h>

Inheritance diagram for RSpatialIndexSimple:
RSpatialIndex RRequireHeap

List of all members.

Public Member Functions

virtual void addToIndex (int id, int pos, double x1, double y1, double z1, double x2, double y2, double z2)
virtual void clear ()
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.
virtual QMap< int, QSet< int > > queryIntersected (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 or intersect with the given box x1,y1,z1,x2,y2,z2.
virtual QMap< int, QSet< int > > queryNearestNeighbor (uint k, double x, double y, double z, RSpatialIndexVisitor *dataVisitor=NULL)
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.
virtual bool removeFromIndex (int id, const QList< RBox > &bb)
 Removes the entry with the given ID from this spatial index.
 RSpatialIndexSimple ()
 Copyright (c) 2011-2014 by Andrew Mustun.
virtual ~RSpatialIndexSimple ()
- Public Member Functions inherited from RSpatialIndex
virtual void addToIndex (int id, int pos, const RBox &bb)
 Adds a new entry into this spatial index.
virtual void addToIndex (int id, const QList< RBox > &bbs)
 Adds a new entry at multiple positions into this spatial index.
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.
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.
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.
virtual QPair< int, int > queryNearestNeighbor (double x, double y, double z)
 Convenience implementation for scripts.
virtual bool removeFromIndex (int id, int pos, const RBox &bb)
 Removes the entry with the given ID from this spatial index.
 RSpatialIndex ()
virtual ~RSpatialIndex ()
- Public Member Functions inherited from RRequireHeap
void doDelete ()

Protected Attributes

QMap< int, QList< RBox > > si
- 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

Copyright (c) 2011-2014 by Andrew Mustun.

All rights reserved.

This file is part of the QCAD project.

QCAD is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

QCAD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with QCAD. Simple spatial index implementation.

Scriptable:
This class is wrapped for script environments.

Constructor & Destructor Documentation

RSpatialIndexSimple::RSpatialIndexSimple ( )

Copyright (c) 2011-2014 by Andrew Mustun.

All rights reserved.

This file is part of the QCAD project.

QCAD is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

QCAD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with QCAD.

RSpatialIndexSimple::~RSpatialIndexSimple ( )
virtual

Member Function Documentation

void RSpatialIndexSimple::addToIndex ( int  id,
int  pos,
double  x1,
double  y1,
double  z1,
double  x2,
double  y2,
double  z2 
)
virtual
   \par Non-Scriptable:

This function is not available in script environments.

Implements RSpatialIndex.

void RSpatialIndexSimple::clear ( )
virtual

Implements RSpatialIndex.

QMap< int, QSet< int > > RSpatialIndexSimple::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.

QMap< int, QSet< int > > RSpatialIndexSimple::queryIntersected ( 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 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

Implements RSpatialIndex.

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

bool RSpatialIndexSimple::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.


Member Data Documentation

QMap<int, QList<RBox> > RSpatialIndexSimple::si
protected

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