QGIS API Documentation  2.18.3-Las Palmas (77b8c3d)
Classes | Public Types | Public Member Functions | Protected Slots | Protected Member Functions | Friends | List of all members
QgsPointLocator Class Reference

The class defines interface for querying point location: More...

#include <qgspointlocator.h>

Inheritance diagram for QgsPointLocator:
Inheritance graph
[legend]

Classes

struct  Match
 
struct  MatchFilter
 Interface that allows rejection of some matches in intersection queries (e.g. More...
 

Public Types

typedef class QList< MatchMatchList
 
enum  Type {
  Invalid = 0, Vertex = 1, Edge = 2, Area = 4,
  All = Vertex | Edge | Area
}
 The type of a snap result or the filter type for a snap request. More...
 

Public Member Functions

 QgsPointLocator (QgsVectorLayer *layer, const QgsCoordinateReferenceSystem *destCRS=nullptr, const QgsRectangle *extent=nullptr)
 Construct point locator for a layer. More...
 
 ~QgsPointLocator ()
 
int cachedGeometryCount () const
 Return how many geometries are cached in the index. More...
 
const QgsCoordinateReferenceSystemdestCRS () const
 Get destination CRS - may be null if not doing OTF reprojection. More...
 
MatchList edgesInRect (const QgsRectangle &rect, MatchFilter *filter=nullptr)
 Find edges within a specified recangle Optional filter may discard unwanted matches. More...
 
MatchList edgesInRect (const QgsPoint &point, double tolerance, MatchFilter *filter=nullptr)
 Override of edgesInRect that construct rectangle from a center point and tolerance. More...
 
const QgsRectangleextent () const
 Get extent of the area point locator covers - if null then it caches the whole layer. More...
 
bool hasIndex () const
 Indicate whether the data have been already indexed. More...
 
bool init (int maxFeaturesToIndex=-1)
 Prepare the index for queries. More...
 
QgsVectorLayerlayer () const
 Get associated layer. More...
 
Match nearestEdge (const QgsPoint &point, double tolerance, MatchFilter *filter=nullptr)
 Find nearest edges to the specified point - up to distance specified by tolerance Optional filter may discard unwanted matches. More...
 
Match nearestVertex (const QgsPoint &point, double tolerance, MatchFilter *filter=nullptr)
 Find nearest vertex to the specified point - up to distance specified by tolerance Optional filter may discard unwanted matches. More...
 
MatchList pointInPolygon (const QgsPoint &point)
 find out if the point is in any polygons More...
 
void setExtent (const QgsRectangle *extent)
 Configure extent - if not null, it will index only that area. More...
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
 QObject (QObject *parent, const char *name)
 
virtual  ~QObject ()
 
bool blockSignals (bool block)
 
QObjectchild (const char *objName, const char *inheritsClass, bool recursiveSearch) const
 
const QObjectList & children () const
 
const char * className () const
 
bool connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const QObject *receiver, const char *method)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method)
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QByteArraydynamicPropertyNames () const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name) const
 
QList< T > findChildren (const QRegExp &regExp) const
 
QList< T > findChildren (const QString &name) const
 
bool inherits (const char *className) const
 
void insertChild (QObject *object)
 
void installEventFilter (QObject *filterObj)
 
bool isA (const char *className) const
 
bool isWidgetType () const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const
 
void moveToThread (QThread *targetThread)
 
const char * name () const
 
const char * name (const char *defaultName) const
 
QString objectName () const
 
QObjectparent () const
 
QVariant property (const char *name) const
 
void removeChild (QObject *object)
 
void removeEventFilter (QObject *obj)
 
void setName (const char *name)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval)
 
QThreadthread () const
 

Protected Slots

void destroyIndex ()
 

Protected Member Functions

bool rebuildIndex (int maxFeaturesToIndex=-1)
 
- Protected Member Functions inherited from QObject
bool checkConnectArgs (const char *signal, const QObject *object, const char *method)
 
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const char *signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const char *signal)
 
int receivers (const char *signal) const
 
QObjectsender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 

Friends

class QgsPointLocator_VisitorArea
 
class QgsPointLocator_VisitorEdgesInRect
 
class QgsPointLocator_VisitorNearestEdge
 
class QgsPointLocator_VisitorNearestVertex
 

Additional Inherited Members

- Static Public Member Functions inherited from QObject
bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- Static Protected Member Functions inherited from QObject
QByteArray normalizeSignalSlot (const char *signalSlot)
 
- Properties inherited from QObject
 objectName
 

Detailed Description

The class defines interface for querying point location:

Works with one layer.

Note
added in 2.8

Definition at line 50 of file qgspointlocator.h.

Member Typedef Documentation

Definition at line 171 of file qgspointlocator.h.

Member Enumeration Documentation

The type of a snap result or the filter type for a snap request.

Enumerator
Invalid 

Invalid.

Vertex 

Snapped to a vertex. Can be a vertex of the geometry or an intersection.

Edge 

Snapped to an edge.

Area 

Snapped to an area.

All 

Combination of vertex, edge and area.

Definition at line 78 of file qgspointlocator.h.

Constructor & Destructor Documentation

QgsPointLocator::QgsPointLocator ( QgsVectorLayer layer,
const QgsCoordinateReferenceSystem destCRS = nullptr,
const QgsRectangle extent = nullptr 
)
explicit

Construct point locator for a layer.

  • destCRS if not null, will do the searches on data reprojected to the given CRS
  • extent if not null, will index only a subset of the layer

Definition at line 613 of file qgspointlocator.cpp.

QgsPointLocator::~QgsPointLocator ( )

Definition at line 637 of file qgspointlocator.cpp.

Member Function Documentation

int QgsPointLocator::cachedGeometryCount ( ) const
inline

Return how many geometries are cached in the index.

Note
added in QGIS 2.14

Definition at line 206 of file qgspointlocator.h.

const QgsCoordinateReferenceSystem * QgsPointLocator::destCRS ( ) const

Get destination CRS - may be null if not doing OTF reprojection.

Note
added in QGIS 2.14

Definition at line 645 of file qgspointlocator.cpp.

void QgsPointLocator::destroyIndex ( )
protectedslot

Definition at line 762 of file qgspointlocator.cpp.

QgsPointLocator::MatchList QgsPointLocator::edgesInRect ( const QgsRectangle rect,
QgsPointLocator::MatchFilter filter = nullptr 
)

Find edges within a specified recangle Optional filter may discard unwanted matches.

Definition at line 877 of file qgspointlocator.cpp.

QgsPointLocator::MatchList QgsPointLocator::edgesInRect ( const QgsPoint point,
double  tolerance,
QgsPointLocator::MatchFilter filter = nullptr 
)

Override of edgesInRect that construct rectangle from a center point and tolerance.

Definition at line 897 of file qgspointlocator.cpp.

const QgsRectangle* QgsPointLocator::extent ( ) const
inline

Get extent of the area point locator covers - if null then it caches the whole layer.

Note
added in QGIS 2.14

Definition at line 70 of file qgspointlocator.h.

bool QgsPointLocator::hasIndex ( ) const

Indicate whether the data have been already indexed.

Definition at line 667 of file qgspointlocator.cpp.

bool QgsPointLocator::init ( int  maxFeaturesToIndex = -1)

Prepare the index for queries.

Does nothing if the index already exists. If the number of features is greater than the value of maxFeaturesToIndex, creation of index is stopped to make sure we do not run out of memory. If maxFeaturesToIndex is -1, no limits are used. Returns false if the creation of index has been prematurely stopped due to the limit of features, otherwise true

Definition at line 661 of file qgspointlocator.cpp.

QgsVectorLayer* QgsPointLocator::layer ( ) const
inline

Get associated layer.

Note
added in QGIS 2.14

Definition at line 64 of file qgspointlocator.h.

QgsPointLocator::Match QgsPointLocator::nearestEdge ( const QgsPoint point,
double  tolerance,
MatchFilter filter = nullptr 
)

Find nearest edges to the specified point - up to distance specified by tolerance Optional filter may discard unwanted matches.

Definition at line 855 of file qgspointlocator.cpp.

QgsPointLocator::Match QgsPointLocator::nearestVertex ( const QgsPoint point,
double  tolerance,
MatchFilter filter = nullptr 
)

Find nearest vertex to the specified point - up to distance specified by tolerance Optional filter may discard unwanted matches.

Definition at line 837 of file qgspointlocator.cpp.

QgsPointLocator::MatchList QgsPointLocator::pointInPolygon ( const QgsPoint point)

find out if the point is in any polygons

Definition at line 904 of file qgspointlocator.cpp.

bool QgsPointLocator::rebuildIndex ( int  maxFeaturesToIndex = -1)
protected

Definition at line 673 of file qgspointlocator.cpp.

void QgsPointLocator::setExtent ( const QgsRectangle extent)

Configure extent - if not null, it will index only that area.

Note
added in QGIS 2.14

Definition at line 650 of file qgspointlocator.cpp.

Friends And Related Function Documentation

friend class QgsPointLocator_VisitorArea
friend

Definition at line 234 of file qgspointlocator.h.

Definition at line 235 of file qgspointlocator.h.

Definition at line 233 of file qgspointlocator.h.

Definition at line 232 of file qgspointlocator.h.


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