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 )
125 bool init(
int maxFeaturesToIndex = -1 );
128 bool hasIndex() const;
141 , mVertexIndex( vertexIndex )
145 mEdgePoints[0] = edgePoints[0];
146 mEdgePoints[1] = edgePoints[1];
152 bool isValid()
const {
return mType != Invalid; }
154 bool hasEdge()
const {
return mType == Edge; }
155 bool hasArea()
const {
return mType == Area; }
186 pt1 = mEdgePoints[0];
187 pt2 = mEdgePoints[1];
192 return mType == other.
mType &&
193 mDist == other.
mDist &&
196 mFid == other.
mFid &&
207 int mVertexIndex = 0;
214 typedef QList<QgsPointLocator::Match>
MatchList;
285 bool rebuildIndex(
int maxFeaturesToIndex = -1 );
292 void onAttributeValueChanged(
QgsFeatureId fid,
int idx,
const QVariant &value );
296 std::unique_ptr< SpatialIndex::IStorageManager > mStorage;
298 QHash<QgsFeatureId, QgsGeometry *> mGeoms;
299 std::unique_ptr< SpatialIndex::ISpatialIndex > mRTree;
302 bool mIsEmptyLayer =
false;
308 std::unique_ptr< QgsRectangle > mExtent;
310 std::unique_ptr<QgsRenderContext> mContext;
320 #endif // QGSPOINTLOCATOR_H
The class defines interface for querying point location:
A rectangle specified with double values.
bool operator==(const QgsPointLocator::Match &other) const
QgsPointXY point() const
for vertex / edge match coords depending on what class returns it (geom.cache: layer coords...
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.
QgsFeatureId featureId() const
The id of the feature to which the snapped geometry belongs.
Interface that allows rejection of some matches in intersection queries (e.g.
const QgsRectangle * extent() const
Gets extent of the area point locator covers - if null then it caches the whole layer.
QgsPointXY mEdgePoints[2]
void edgePoints(QgsPointXY &pt1, QgsPointXY &pt2) const
Only for a valid edge match - obtain endpoints of the edge.
int vertexIndex() const
for vertex / edge match (first vertex 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.
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...
QgsVectorLayer * layer() const
The vector layer where the snap occurred.
Contains information about the context of a rendering operation.
QgsPointLocator::Type type() const
This class represents a coordinate reference system (CRS).
Helper class used when traversing the index looking for vertices - builds a list of matches...
Helper class used when traversing the index looking for edges - builds a list of matches.
int cachedGeometryCount() const
Returns how many geometries are cached in the index.
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.