16 #ifndef QGSPOINTLOCATOR_H 17 #define QGSPOINTLOCATOR_H 25 #include "qgis_core.h" 40 class IStorageManager;
115 All = Vertex | Edge | Area
118 Q_DECLARE_FLAGS( Types,
Type )
126 bool init(
int maxFeaturesToIndex = -1 );
129 bool hasIndex()
const;
142 , mVertexIndex( vertexIndex )
146 mEdgePoints[0] = edgePoints[0];
147 mEdgePoints[1] = edgePoints[1];
153 bool isValid()
const {
return mType != Invalid; }
155 bool hasEdge()
const {
return mType == Edge; }
156 bool hasArea()
const {
return mType == Area; }
187 pt1 = mEdgePoints[0];
188 pt2 = mEdgePoints[1];
193 return mType == other.
mType &&
194 mDist == other.
mDist &&
197 mFid == other.
mFid &&
208 int mVertexIndex = 0;
215 typedef QList<QgsPointLocator::Match>
MatchList;
286 bool rebuildIndex(
int maxFeaturesToIndex = -1 );
293 void onAttributeValueChanged(
QgsFeatureId fid,
int idx,
const QVariant &value );
297 std::unique_ptr< SpatialIndex::IStorageManager > mStorage;
299 QHash<QgsFeatureId, QgsGeometry *> mGeoms;
300 std::unique_ptr< SpatialIndex::ISpatialIndex > mRTree;
303 bool mIsEmptyLayer =
false;
309 std::unique_ptr< QgsRectangle > mExtent;
311 std::unique_ptr<QgsRenderContext> mContext;
321 #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
Gets extent of the area point locator covers - if nullptr then it caches the whole layer...
int cachedGeometryCount() const
Returns 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...
Contains information about the context of a rendering operation.
int vertexIndex() const
for vertex / edge match (first vertex of the edge)
This class represents a coordinate reference system (CRS).
Helper class used when traversing the index looking for vertices - 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 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
Gets associated layer.
Type
The type of a snap result or the filter type for a snap request.