16 #ifndef QGSPOINTLOCATOR_H 17 #define QGSPOINTLOCATOR_H 36 class IStorageManager;
81 All = Vertex | Edge | Area
84 Q_DECLARE_FLAGS( Types,
Type )
90 bool init(
int maxFeaturesToIndex = -1 );
93 bool hasIndex() const;
98 Match() : mType( Invalid ), mDist( 0 ), mPoint(), mLayer( nullptr ), mFid( 0 ), mVertexIndex( 0 ) {}
101 : mType( t ), mDist( dist ), mPoint( pt ), mLayer( vl ), mFid( fid ), mVertexIndex( vertexIndex )
105 mEdgePoints[0] = edgePoints[0];
106 mEdgePoints[1] = edgePoints[1];
112 bool isValid()
const {
return mType != Invalid; }
114 bool hasEdge()
const {
return mType == Edge; }
115 bool hasArea()
const {
return mType == Area; }
136 pt1 = mEdgePoints[0];
137 pt2 = mEdgePoints[1];
158 virtual bool acceptMatch(
const Match& match ) = 0;
188 bool rebuildIndex(
int maxFeaturesToIndex = -1 );
198 SpatialIndex::IStorageManager* mStorage;
201 SpatialIndex::ISpatialIndex* mRTree;
218 #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=nullptr)
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.
const QgsRectangle * extent() const
Get extent of the area point locator covers - if null then it caches the whole layer.
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.
int cachedGeometryCount() const
Return how many geometries are cached in the index.
Represents a vector layer which manages a vector based data sets.
QgsVectorLayer * layer() const
Get associated layer.