QGIS API Documentation  2.8.2-Wien
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Public Types | Public Member Functions | Protected Member Functions | Friends | List of all members
QgsPointLocator Class Reference

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

#include <qgspointlocator.h>

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
}

Public Member Functions

 QgsPointLocator (QgsVectorLayer *layer, const QgsCoordinateReferenceSystem *destCRS=0, const QgsRectangle *extent=0)
 Construct point locator for a layer.
 ~QgsPointLocator ()
MatchList edgesInRect (const QgsRectangle &rect, MatchFilter *filter=0)
 Find edges within a specified recangle Optional filter may discard unwanted matches.
MatchList edgesInRect (const QgsPoint &point, double tolerance, MatchFilter *filter=0)
 Override of edgesInRect that construct rectangle from a center point and tolerance.
bool hasIndex () const
 Indicate whether the data have been already indexed.
bool init (int maxFeaturesToIndex=-1)
 Prepare the index for queries.
Match nearestEdge (const QgsPoint &point, double tolerance, MatchFilter *filter=0)
 Find nearest edges to the specified point - up to distance specified by tolerance Optional filter may discard unwanted matches.
Match nearestVertex (const QgsPoint &point, double tolerance, MatchFilter *filter=0)
 Find nearest vertex to the specified point - up to distance specified by tolerance Optional filter may discard unwanted matches.
MatchList pointInPolygon (const QgsPoint &point)
 find out if the point is in any polygons

Protected Member Functions

void destroyIndex ()
bool rebuildIndex (int maxFeaturesToIndex=-1)

Friends

class QgsPointLocator_VisitorArea
class QgsPointLocator_VisitorEdgesInRect
class QgsPointLocator_VisitorNearestEdge
class QgsPointLocator_VisitorNearestVertex

Detailed Description

The class defines interface for querying point location:

Works with one layer.

Note
added in 2.8

Definition at line 48 of file qgspointlocator.h.

Member Typedef Documentation

typedef class QList< Match > QgsPointLocator::MatchList

Definition at line 126 of file qgspointlocator.h.

Member Enumeration Documentation

Enumerator:
Invalid 
Vertex 
Edge 
Area 
All 

Definition at line 60 of file qgspointlocator.h.

Constructor & Destructor Documentation

QgsPointLocator::QgsPointLocator ( QgsVectorLayer layer,
const QgsCoordinateReferenceSystem destCRS = 0,
const QgsRectangle extent = 0 
)
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 571 of file qgspointlocator.cpp.

QgsPointLocator::~QgsPointLocator ( )

Definition at line 597 of file qgspointlocator.cpp.

Member Function Documentation

void QgsPointLocator::destroyIndex ( )
protected

Definition at line 696 of file qgspointlocator.cpp.

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

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

Definition at line 796 of file qgspointlocator.cpp.

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

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

Definition at line 812 of file qgspointlocator.cpp.

bool QgsPointLocator::hasIndex ( ) const

Indicate whether the data have been already indexed.

Definition at line 611 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 606 of file qgspointlocator.cpp.

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

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

Definition at line 778 of file qgspointlocator.cpp.

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

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

Definition at line 760 of file qgspointlocator.cpp.

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

find out if the point is in any polygons

Definition at line 819 of file qgspointlocator.cpp.

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

Definition at line 618 of file qgspointlocator.cpp.

Friends And Related Function Documentation

friend class QgsPointLocator_VisitorArea
friend

Definition at line 183 of file qgspointlocator.h.

Definition at line 184 of file qgspointlocator.h.

Definition at line 182 of file qgspointlocator.h.

Definition at line 181 of file qgspointlocator.h.


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