16 #ifndef QGSPOINTLOCATOR_H
17 #define QGSPOINTLOCATOR_H
27 #include <spatialindex/SpatialIndex.h>
66 All = Vertex | Edge | Area
69 Q_DECLARE_FLAGS( Types, Type )
75 bool init(
int maxFeaturesToIndex = -1 );
78 bool hasIndex() const;
83 Match() : mType( Invalid ), mDist( 0 ), mPoint(), mLayer( 0 ), mFid( 0 ), mVertexIndex( 0 ) {}
86 : mType( t ), mDist( dist ), mPoint( pt ), mLayer( vl ), mFid( fid ), mVertexIndex( vertexIndex )
90 mEdgePoints[0] = edgePoints[0];
91 mEdgePoints[1] = edgePoints[1];
97 bool isValid()
const {
return mType != Invalid; }
99 bool hasEdge()
const {
return mType == Edge; }
100 bool hasArea()
const {
return mType == Area; }
121 pt1 = mEdgePoints[0];
122 pt2 = mEdgePoints[1];
142 virtual bool acceptMatch(
const Match& match ) = 0;
167 bool rebuildIndex(
int maxFeaturesToIndex = -1 );
177 SpatialIndex::IStorageManager* mStorage;
180 SpatialIndex::ISpatialIndex* mRTree;
197 #endif // QGSPOINTLOCATOR_H
The class defines interface for querying point location:
A rectangle specified with double values.
Match(Type t, QgsVectorLayer *vl, QgsFeatureId fid, double dist, const QgsPoint &pt, int vertexIndex=0, QgsPoint *edgePoints=0)
Match()
consruct invalid match
Helper class used when traversing the index looking for edges - builds a list of matches.
A geometry is the spatial representation of a feature.
QgsFeatureId featureId() const
Interface that allows rejection of some matches in intersection queries (e.g.
int vertexIndex() const
for vertex / edge match (first vertex of the edge)
Helper class used when traversing the index with areas - builds a list of matches.
double distance() const
for vertex / edge match units depending on what class returns it (geom.cache: layer units...
Helper class used when traversing the index looking for vertices - builds a list of matches...
class QList< Match > MatchList
A class to represent a point.
QgsVectorLayer * layer() const
reference vector layer
Class for storing a coordinate reference system (CRS)
void edgePoints(QgsPoint &pt1, QgsPoint &pt2) const
Only for a valid edge match - obtain endpoints of the edge.
QgsPoint point() const
for vertex / edge match coords depending on what class returns it (geom.cache: layer coords...
Helper class used when traversing the index looking for edges - builds a list of matches.
Represents a vector layer which manages a vector based data sets.