16 #ifndef QGSPOINTLOCATOR_H 17 #define QGSPOINTLOCATOR_H 24 #include "qgis_core.h" 38 class IStorageManager;
113 All = Vertex | Edge | Area
116 Q_DECLARE_FLAGS( Types,
Type )
123 bool init(
int maxFeaturesToIndex = -1 );
126 bool hasIndex()
const;
139 , mVertexIndex( vertexIndex )
143 mEdgePoints[0] = edgePoints[0];
144 mEdgePoints[1] = edgePoints[1];
150 bool isValid()
const {
return mType != Invalid; }
152 bool hasEdge()
const {
return mType == Edge; }
153 bool hasArea()
const {
return mType == Area; }
184 pt1 = mEdgePoints[0];
185 pt2 = mEdgePoints[1];
190 return mType == other.
mType &&
191 mDist == other.
mDist &&
194 mFid == other.
mFid &&
205 int mVertexIndex = 0;
212 typedef QList<QgsPointLocator::Match>
MatchList;
270 bool rebuildIndex(
int maxFeaturesToIndex = -1 );
277 void onAttributeValueChanged(
QgsFeatureId fid,
int idx,
const QVariant &value );
281 SpatialIndex::IStorageManager *mStorage =
nullptr;
283 QHash<QgsFeatureId, QgsGeometry *> mGeoms;
284 SpatialIndex::ISpatialIndex *mRTree =
nullptr;
295 std::unique_ptr<QgsRenderContext> mContext;
304 #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 null 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).
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.