16 #ifndef QGSPOINTLOCATOR_H 17 #define QGSPOINTLOCATOR_H 22 #include "qgis_core.h" 35 class IStorageManager;
104 All = Vertex | Edge | Area
107 Q_DECLARE_FLAGS( Types,
Type )
114 bool init(
int maxFeaturesToIndex = -1 );
117 bool hasIndex()
const;
130 , mVertexIndex( vertexIndex )
134 mEdgePoints[0] = edgePoints[0];
135 mEdgePoints[1] = edgePoints[1];
141 bool isValid()
const {
return mType != Invalid; }
143 bool hasEdge()
const {
return mType == Edge; }
144 bool hasArea()
const {
return mType == Area; }
175 pt1 = mEdgePoints[0];
176 pt2 = mEdgePoints[1];
181 return mType == other.
mType &&
182 mDist == other.
mDist &&
185 mFid == other.
mFid &&
196 int mVertexIndex = 0;
203 typedef QList<QgsPointLocator::Match>
MatchList;
263 bool rebuildIndex(
int maxFeaturesToIndex = -1 );
273 SpatialIndex::IStorageManager *mStorage =
nullptr;
275 QHash<QgsFeatureId, QgsGeometry *> mGeoms;
276 SpatialIndex::ISpatialIndex *mRTree =
nullptr;
293 #endif // QGSPOINTLOCATOR_H
The class defines interface for querying point location:
A rectangle specified with double values.
QgsVectorLayer * layer() const
The vector layer where the snap occurred.
QgsPointLocator::Type type() const
A class to represent a 2D point.
class QList< QgsPointLocator::Match > MatchList
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.
bool operator==(const QgsPointLocator::Match &other) const
QgsPointXY mEdgePoints[2]
void edgePoints(QgsPointXY &pt1, QgsPointXY &pt2) const
Only for a valid edge match - obtain endpoints of the edge.
Match(QgsPointLocator::Type t, QgsVectorLayer *vl, QgsFeatureId fid, double dist, const QgsPointXY &pt, int vertexIndex=0, QgsPointXY *edgePoints=nullptr)
Helper class used when traversing the index with areas - builds a list of matches.
Contains information about the context in which a coordinate transform is executed.
Helper class used when traversing the index looking for vertices - builds a list of matches...
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.
QgsPointXY point() const
for vertex / edge match coords depending on what class returns it (geom.cache: layer coords...
int vertexIndex() const
for vertex / edge match (first vertex of the edge)
This class represents 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.
QgsFeatureId featureId() const
The id of the feature to which the snapped geometry belongs.
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.