16 #ifndef QGSPOINTLOCATOR_H
17 #define QGSPOINTLOCATOR_H
27 #include <spatialindex/SpatialIndex.h>
60 enum Type { Invalid = 0, Vertex = 1, Edge = 2, Area = 4, All = Vertex | Edge | Area };
66 bool init(
int maxFeaturesToIndex = -1 );
69 bool hasIndex()
const;
74 Match() : mType( Invalid ), mDist( 0 ), mPoint(), mLayer( 0 ), mFid( 0 ), mVertexIndex( 0 ) {}
77 : mType( t ), mDist( dist ), mPoint( pt ), mLayer( vl ), mFid( fid ), mVertexIndex( vertexIndex )
81 mEdgePoints[0] = edgePoints[0];
82 mEdgePoints[1] = edgePoints[1];
88 bool isValid()
const {
return mType != Invalid; }
90 bool hasEdge()
const {
return mType == Edge; }
91 bool hasArea()
const {
return mType == Area; }
112 pt1 = mEdgePoints[0];
113 pt2 = mEdgePoints[1];
133 virtual bool acceptMatch(
const Match& match ) = 0;
158 bool rebuildIndex(
int maxFeaturesToIndex = -1 );
168 SpatialIndex::IStorageManager* mStorage;
171 SpatialIndex::ISpatialIndex* mRTree;
188 #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.