16 #ifndef QGSPOINTLOCATOR_H 17 #define QGSPOINTLOCATOR_H 36 class IStorageManager;
84 All = Vertex | Edge | Area
87 Q_DECLARE_FLAGS( Types,
Type )
93 bool init(
int maxFeaturesToIndex = -1 );
96 bool hasIndex()
const;
116 , mVertexIndex( vertexIndex )
120 mEdgePoints[0] = edgePoints[0];
121 mEdgePoints[1] = edgePoints[1];
127 bool isValid()
const {
return mType != Invalid; }
129 bool hasEdge()
const {
return mType == Edge; }
130 bool hasArea()
const {
return mType == Area; }
157 pt1 = mEdgePoints[0];
158 pt2 = mEdgePoints[1];
179 virtual bool acceptMatch(
const Match& match ) = 0;
209 bool rebuildIndex(
int maxFeaturesToIndex = -1 );
219 SpatialIndex::IStorageManager* mStorage;
222 SpatialIndex::ISpatialIndex* mRTree;
239 #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)
QgsVectorLayer * layer() const
The vector layer where the snap occurred.
Match()
construct 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.
Interface that allows rejection of some matches in intersection queries (e.g.
Helper class used when traversing the index with areas - builds a list of matches.
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.
const QgsRectangle * extent() const
Get extent of the area point locator covers - if null then it caches the whole layer.
int cachedGeometryCount() const
Return how many geometries are cached in the index.
int vertexIndex() const
for vertex / edge match (first vertex of the edge)
Class for storing a coordinate reference system (CRS)
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 edges - builds a list of matches.
void edgePoints(QgsPoint &pt1, QgsPoint &pt2) const
Only for a valid edge match - obtain endpoints of the edge.
QgsFeatureId featureId() const
The id of the feature to which the snapped geometry belongs.
QgsPoint point() const
for vertex / edge match coords depending on what class returns it (geom.cache: layer coords...
Represents a vector layer which manages a vector based data sets.
QgsVectorLayer * layer() const
Get associated layer.
Type
The type of a snap result or the filter type for a snap request.