QGIS API Documentation
3.14.0-Pi (9f7028fd23)
|
Go to the documentation of this file.
30 #include <spatialindex/SpatialIndex.h>
32 #include <QLinkedListIterator>
33 #include <QtConcurrent>
39 static SpatialIndex::Point point2point(
const QgsPointXY &point )
41 double plow[2] = { point.
x(), point.
y() };
42 return Point( plow, 2 );
46 static SpatialIndex::Region rect2region(
const QgsRectangle &rect )
50 return SpatialIndex::Region( pLow, pHigh, 2 );
58 static const double POINT_LOC_EPSILON = 1e-12;
72 : mDataList( dataList )
76 IData *
getNext()
override {
return mIt.next(); }
77 bool hasNext()
override {
return mIt.hasNext(); }
79 uint32_t
size()
override { Q_ASSERT(
false &&
"not available" );
return 0; }
80 void rewind()
override { Q_ASSERT(
false &&
"not available" ); }
83 QLinkedList<RTree::Data *> mDataList;
84 QLinkedListIterator<RTree::Data *> mIt;
102 , mSrcPoint( srcPoint )
106 void visitNode(
const INode &n )
override { Q_UNUSED( n ) }
107 void visitData( std::vector<const IData *> &v )
override { Q_UNUSED( v ) }
113 int vertexIndex, beforeVertex, afterVertex;
122 if ( mFilter && !mFilter->acceptMatch( m ) )
125 if ( !mBest.isValid() || m.
distance() < mBest.distance() )
157 , mSrcPoint( srcPoint )
161 void visitNode(
const INode &n )
override { Q_UNUSED( n ); }
162 void visitData( std::vector<const IData *> &v )
override { Q_UNUSED( v ); }
173 if ( mFilter && !mFilter->acceptMatch( m ) )
176 if ( !mBest.isValid() || m.
distance() < mBest.distance() )
209 , mSrcPoint( srcPoint )
213 void visitNode(
const INode &n )
override { Q_UNUSED( n ); }
214 void visitData( std::vector<const IData *> &v )
override { Q_UNUSED( v ); }
227 edgePoints[0] = geom->
vertexAt( afterVertex - 1 );
228 edgePoints[1] = geom->
vertexAt( afterVertex );
229 pt =
QgsPointXY( ( edgePoints[0].x() + edgePoints[1].x() ) / 2.0, ( edgePoints[0].y() + edgePoints[1].y() ) / 2.0 );
233 if ( mFilter && !mFilter->acceptMatch( m ) )
236 if ( !mBest.isValid() || m.
distance() < mBest.distance() )
262 , mSrcPoint( srcPoint )
266 void visitNode(
const INode &n )
override { Q_UNUSED( n ) }
267 void visitData( std::vector<const IData *> &v )
override { Q_UNUSED( v ) }
280 edgePoints[0] = geom->
vertexAt( afterVertex - 1 );
281 edgePoints[1] = geom->
vertexAt( afterVertex );
284 if ( mFilter && !mFilter->acceptMatch( m ) )
287 if ( !mBest.isValid() || m.
distance() < mBest.distance() )
316 void visitNode(
const INode &n )
override { Q_UNUSED( n ) }
317 void visitData( std::vector<const IData *> &v )
override { Q_UNUSED( v ) }
343 static const int INSIDE = 0;
346 static const int BOTTOM = 4;
347 static const int TOP = 8;
368 OutCode outcode0 = computeOutCode( x0, y0 );
369 OutCode outcode1 = computeOutCode( x1, y1 );
374 if ( !( outcode0 | outcode1 ) )
380 else if ( outcode0 & outcode1 )
392 OutCode outcodeOut = outcode0 ? outcode0 : outcode1;
396 if ( outcodeOut & TOP )
399 x = x0 + ( x1 - x0 ) * ( mRect.
yMaximum() - y0 ) / ( y1 - y0 );
402 else if ( outcodeOut & BOTTOM )
405 x = x0 + ( x1 - x0 ) * ( mRect.
yMinimum() - y0 ) / ( y1 - y0 );
408 else if ( outcodeOut &
RIGHT )
411 y = y0 + ( y1 - y0 ) * ( mRect.
xMaximum() - x0 ) / ( x1 - x0 );
414 else if ( outcodeOut &
LEFT )
417 y = y0 + ( y1 - y0 ) * ( mRect.
xMinimum() - x0 ) / ( x1 - x0 );
425 if ( outcodeOut == outcode0 )
429 outcode0 = computeOutCode( x0, y0 );
435 outcode1 = computeOutCode( x1, y1 );
470 if ( qgsgeometry_cast<QgsLineString *>( *part )->numPoints() < 2 )
476 while ( it != ( *part )->vertices_end() )
479 if ( cs.isSegmentInRect( prevPoint.x(), prevPoint.y(), thisPoint.x(), thisPoint.y() ) )
482 edgePoints[0] = prevPoint;
483 edgePoints[1] = thisPoint;
506 , mSrcRect( srcRect )
510 void visitNode(
const INode &n )
override { Q_UNUSED( n ) }
511 void visitData( std::vector<const IData *> &v )
override { Q_UNUSED( v ) }
518 const auto segmentsInRect {_geometrySegmentsInRect( geom, mSrcRect, mLocator->mLayer,
id )};
522 if ( mFilter && !mFilter->acceptMatch( m ) )
551 , mSrcRect( srcRect )
555 void visitNode(
const INode &n )
override { Q_UNUSED( n ) }
556 void visitData( std::vector<const IData *> &v )
override { Q_UNUSED( v ) }
561 const QgsGeometry *geom = mLocator->mGeoms.value(
id );
565 if ( mSrcRect.contains( *it ) )
570 if ( mFilter && !mFilter->acceptMatch( m ) )
598 , mSrcRect( srcRect )
602 void visitNode(
const INode &n )
override { Q_UNUSED( n ); }
603 void visitData( std::vector<const IData *> &v )
override { Q_UNUSED( v ); }
608 const QgsGeometry *geom = mLocator->mGeoms.value(
id );
610 if ( mSrcRect.contains( centroid ) )
615 if ( !( mFilter && !mFilter->acceptMatch( m ) ) )
640 , mSrcRect( srcRect )
644 void visitNode(
const INode &n )
override { Q_UNUSED( n ); }
645 void visitData( std::vector<const IData *> &v )
override { Q_UNUSED( v ); }
650 const QgsGeometry *geom = mLocator->mGeoms.value(
id );
657 for ( ; it != geom->
vertices_end(); ++it, ++itPrevious )
659 QgsPointXY pt( ( ( *itPrevious ).x() + ( *it ).x() ) / 2.0, ( ( *itPrevious ).y() + ( *it ).y() ) / 2.0 );
660 if ( mSrcRect.contains( pt ) )
665 if ( mFilter && !mFilter->acceptMatch( m ) )
696 void getNextEntry(
const IEntry &entry, id_type &nextEntry,
bool &hasNext )
override
698 const INode *n =
dynamic_cast<const INode *
>( &entry );
702 QgsDebugMsgLevel( QStringLiteral(
"NODE: %1" ).arg( n->getIdentifier() ), 4 );
703 if ( n->getLevel() > 0 )
706 for ( uint32_t cChild = 0; cChild < n->getChildrenCount(); cChild++ )
708 QgsDebugMsgLevel( QStringLiteral(
"- CH: %1" ).arg( n->getChildIdentifier( cChild ) ), 4 );
709 ids.push( n->getChildIdentifier( cChild ) );
715 for ( uint32_t cChild = 0; cChild < n->getChildrenCount(); cChild++ )
717 QgsDebugMsgLevel( QStringLiteral(
"- L: %1" ).arg( n->getChildIdentifier( cChild ) ), 4 );
723 nextEntry = ids.back();
745 mStorage.reset( StorageManager::createNewMemoryStorageManager() );
758 mIsDestroying =
true;
790 mContext.reset(
nullptr );
794 mContext = std::unique_ptr<QgsRenderContext>(
new QgsRenderContext( *context ) );
800 void QgsPointLocator::onInitTaskFinished()
816 onFeatureAdded( fid );
817 mAddedFeatures.clear();
820 onFeatureDeleted( fid );
821 mDeletedFeatures.clear();
847 connect( mInitTask, &QgsPointLocatorInitTask::taskTerminated,
this, &QgsPointLocator::onInitTaskFinished );
848 connect( mInitTask, &QgsPointLocatorInitTask::taskCompleted,
this, &QgsPointLocator::onInitTaskFinished );
863 mInitTask->waitForFinished();
865 if ( !mIsDestroying )
866 onInitTaskFinished();
871 return mIsIndexing || mRTree || mIsEmptyLayer;
874 bool QgsPointLocator::prepare(
bool relaxed )
887 if ( ( relaxed && mIsIndexing ) || !mRTree )
899 QgsDebugMsgLevel( QStringLiteral(
"RebuildIndex start : %1" ).arg( mSource->id() ), 2 );
903 QLinkedList<RTree::Data *> dataList;
922 QgsDebugMsg( QStringLiteral(
"could not transform bounding box to map, skipping the snap filter (%1)" ).arg( e.
what() ) );
932 ctx = mContext.get();
936 mRenderer->startRender( *ctx, mSource->fields() );
943 int indexedCount = 0;
950 if ( filter && ctx && mRenderer )
953 if ( !mRenderer->willRenderFeature( f, *ctx ) )
964 transformedGeometry.
transform( mTransform );
971 QgsDebugMsg( QStringLiteral(
"could not transform geometry to map, skipping the snap for it (%1)" ).arg( e.
what() ) );
979 SpatialIndex::Region r( rect2region( bbox ) );
980 dataList <<
new RTree::Data( 0,
nullptr, r, f.
id() );
982 if ( mGeoms.contains( f.
id() ) )
983 delete mGeoms.take( f.
id() );
988 if ( maxFeaturesToIndex != -1 && indexedCount > maxFeaturesToIndex )
990 qDeleteAll( dataList );
997 double fillFactor = 0.7;
998 unsigned long indexCapacity = 10;
999 unsigned long leafCapacity = 10;
1000 unsigned long dimension = 2;
1001 RTree::RTreeVariant variant = RTree::RV_RSTAR;
1002 SpatialIndex::id_type indexId;
1004 if ( dataList.isEmpty() )
1006 mIsEmptyLayer =
true;
1011 mRTree.reset( RTree::createAndBulkLoadNewRTree( RTree::BLM_STR, stream, *mStorage, fillFactor, indexCapacity,
1012 leafCapacity, dimension, variant, indexId ) );
1014 if ( ctx && mRenderer )
1016 mRenderer->stopRender( *ctx );
1019 QgsDebugMsgLevel( QStringLiteral(
"RebuildIndex end : %1 ms (%2)" ).arg( t.elapsed() ).arg( mSource->id() ), 2 );
1029 mIsEmptyLayer =
false;
1031 qDeleteAll( mGeoms );
1036 void QgsPointLocator::onFeatureAdded(
QgsFeatureId fid )
1041 mAddedFeatures << fid;
1047 if ( mIsEmptyLayer )
1050 mIsEmptyLayer =
false;
1064 std::unique_ptr< QgsFeatureRenderer > renderer( mLayer->
renderer() ? mLayer->
renderer()->
clone() :
nullptr );
1068 ctx = mContext.get();
1069 if ( renderer && ctx )
1072 renderer->startRender( *ctx, mLayer->
fields() );
1075 if ( !renderer->willRenderFeature( f, *ctx ) )
1080 renderer->stopRender( *ctx );
1091 transformedGeom.
transform( mTransform );
1098 QgsDebugMsg( QStringLiteral(
"could not transform geometry to map, skipping the snap for it (%1)" ).arg( e.
what() ) );
1106 SpatialIndex::Region r( rect2region( bbox ) );
1107 mRTree->insertData( 0,
nullptr, r, f.
id() );
1109 if ( mGeoms.contains( f.
id() ) )
1110 delete mGeoms.take( f.
id() );
1116 void QgsPointLocator::onFeatureDeleted(
QgsFeatureId fid )
1120 if ( mAddedFeatures.contains( fid ) )
1122 mAddedFeatures.remove( fid );
1127 mDeletedFeatures << fid;
1135 if ( mGeoms.contains( fid ) )
1137 mRTree->deleteData( rect2region( mGeoms[fid]->boundingBox() ), fid );
1138 delete mGeoms.take( fid );
1146 onFeatureDeleted( fid );
1147 onFeatureAdded( fid );
1150 void QgsPointLocator::onAttributeValueChanged(
QgsFeatureId fid,
int idx,
const QVariant &value )
1156 onFeatureDeleted( fid );
1157 onFeatureAdded( fid );
1164 if ( !prepare( relaxed ) )
1169 QgsRectangle rect( point.
x() - tolerance, point.
y() - tolerance, point.
x() + tolerance, point.
y() + tolerance );
1170 mRTree->intersectsWithQuery( rect2region( rect ), visitor );
1178 if ( !prepare( relaxed ) )
1184 QgsRectangle rect( point.
x() - tolerance, point.
y() - tolerance, point.
x() + tolerance, point.
y() + tolerance );
1185 mRTree->intersectsWithQuery( rect2region( rect ), visitor );
1193 if ( !prepare( relaxed ) )
1199 QgsRectangle rect( point.
x() - tolerance, point.
y() - tolerance, point.
x() + tolerance, point.
y() + tolerance );
1200 mRTree->intersectsWithQuery( rect2region( rect ), visitor );
1208 if ( !prepare( relaxed ) )
1217 QgsRectangle rect( point.
x() - tolerance, point.
y() - tolerance, point.
x() + tolerance, point.
y() + tolerance );
1218 mRTree->intersectsWithQuery( rect2region( rect ), visitor );
1226 if ( !prepare( relaxed ) )
1230 if ( !mlist.isEmpty() && mlist.at( 0 ).isValid() )
1232 return mlist.at( 0 );
1235 if ( tolerance == 0 )
1256 if ( !prepare( relaxed ) )
1265 mRTree->intersectsWithQuery( rect2region( rect ), visitor );
1272 QgsRectangle rect( point.
x() - tolerance, point.
y() - tolerance, point.
x() + tolerance, point.
y() + tolerance );
1278 if ( !prepare( relaxed ) )
1283 mRTree->intersectsWithQuery( rect2region( rect ), visitor );
1290 QgsRectangle rect( point.
x() - tolerance, point.
y() - tolerance, point.
x() + tolerance, point.
y() + tolerance );
1296 if ( !prepare( relaxed ) )
1305 mRTree->intersectsWithQuery( point2point( point ), visitor );
void visitData(std::vector< const IData * > &v) override
QgsFeatureIterator getFeatures(const QgsFeatureRequest &request=QgsFeatureRequest()) const FINAL
Queries the layer for features specified in request.
QgsCoordinateReferenceSystem crs
@ Filter
Features may be filtered, i.e. some features may not be rendered (categorized, rule based ....
bool isFinite() const
Returns true if the rectangle has finite boundaries.
void visitData(std::vector< const IData * > &v) override
OperationResult transform(const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection direction=QgsCoordinateTransform::ForwardTransform, bool transformZ=false) SIP_THROW(QgsCsException)
Transforms this geometry as described by the coordinate transform ct.
void visitData(std::vector< const IData * > &v) override
QgsExpressionContext & expressionContext()
Gets the expression context.
QgsAbstractGeometry::const_part_iterator const_parts_end() const
Returns STL-style iterator pointing to the imaginary part after the last part of the geometry.
#define QgsDebugMsgLevel(str, level)
void setRenderContext(const QgsRenderContext *context)
Configure render context - if not nullptr, it will use to index only visible feature.
bool isMultipart() const
Returns true if WKB of the geometry is of WKBMulti* type.
Match nearestArea(const QgsPointXY &point, double tolerance, QgsPointLocator::MatchFilter *filter=nullptr, bool relaxed=false)
Find nearest area to the specified point - up to distance specified by tolerance Optional filter may ...
double xMaximum() const
Returns the x maximum value (right side of rectangle).
static QgsExpressionContextScope * layerScope(const QgsMapLayer *layer)
Creates a new scope which contains variables and functions relating to a QgsMapLayer.
QgsGeometry centroid() const
Returns the center of mass of a geometry.
void visitData(std::vector< const IData * > &v) override
QgsPointLocator_VisitorCentroidsInRect(QgsPointLocator *pl, QgsPointLocator::MatchList &lst, const QgsRectangle &srcRect, QgsPointLocator::MatchFilter *filter=nullptr)
Constructs the visitor.
void visitData(std::vector< const IData * > &v) override
QgsAbstractGeometry::const_part_iterator const_parts_begin() const
Returns STL-style const iterator pointing to the first part of the geometry.
~QgsPointLocator() override
void featureDeleted(QgsFeatureId fid)
Emitted when a feature has been deleted.
QgsFeatureRequest & setSubsetOfAttributes(const QgsAttributeList &attrs)
Set a subset of attributes that will be fetched.
QgsPointXY point() const
for vertex / edge match coords depending on what class returns it (geom.cache: layer coords,...
void getNextEntry(const IEntry &entry, id_type &nextEntry, bool &hasNext) override
void visitData(const IData &d) override
void visitData(const IData &d) override
MatchList edgesInRect(const QgsRectangle &rect, QgsPointLocator::MatchFilter *filter=nullptr, bool relaxed=false)
Find edges within a specified rectangle Optional filter may discard unwanted matches.
QgsPointXY closestVertex(const QgsPointXY &point, int &atVertex, int &beforeVertex, int &afterVertex, double &sqrDist) const
Returns the vertex closest to the given point, the corresponding vertex index, squared distance snap ...
void visitNode(const INode &n) override
bool init(int maxFeaturesToIndex=-1, bool relaxed=false)
Prepare the index for queries.
long addTask(QgsTask *task, int priority=0)
Adds a task to the manager.
Match nearestVertex(const QgsPointXY &point, double tolerance, QgsPointLocator::MatchFilter *filter=nullptr, bool relaxed=false)
Find nearest vertex to the specified point - up to distance specified by tolerance Optional filter ma...
void visitNode(const INode &n) override
void convertToStraightSegment(double tolerance=M_PI/180., QgsAbstractGeometry::SegmentationToleranceType toleranceType=QgsAbstractGeometry::MaximumAngle)
Converts the geometry to straight line segments, if it is a curved geometry type.
QgsFeatureRequest & setFilterRect(const QgsRectangle &rectangle)
Sets the rectangle from which features will be taken.
QgsFields fields() const FINAL
Returns the list of fields of this layer.
bool rebuildIndex(int maxFeaturesToIndex=-1)
void visitData(std::vector< const IData * > &v) override
void visitNode(const INode &n) override
bool intersects(const QgsRectangle &rectangle) const
Returns true if this geometry exactly intersects with a rectangle.
bool isSegmentInRect(double x0, double y0, double x1, double y1)
void visitData(const IData &d) override
void setGeometry(const QgsGeometry &geometry)
Set the feature's geometry.
MatchList verticesInRect(const QgsRectangle &rect, QgsPointLocator::MatchFilter *filter=nullptr, bool relaxed=false)
Find vertices within a specified rectangle This method is either blocking or non blocking according t...
OutCode computeOutCode(double x, double y)
void visitNode(const INode &n) override
class QList< QgsPointLocator::Match > MatchList
void styleChanged()
Signal emitted whenever a change affects the layer's style.
virtual QgsFeatureRenderer * clone() const =0
Create a deep copy of this renderer.
void visitNode(const INode &n) override
Match nearestMiddleOfSegment(const QgsPointXY &point, double tolerance, QgsPointLocator::MatchFilter *filter=nullptr, bool relaxed=false)
Find nearest middle of segment to the specified point - up to distance specified by tolerance Optiona...
void attributeValueChanged(QgsFeatureId fid, int idx, const QVariant &value)
Emitted whenever an attribute value change is done in the edit buffer.
bool hasIndex() const
Indicate whether the data have been already indexed.
QgsPointLocator_VisitorVerticesInRect(QgsPointLocator *pl, QgsPointLocator::MatchList &lst, const QgsRectangle &srcRect, QgsPointLocator::MatchFilter *filter=nullptr)
Constructs the visitor.
static QgsTaskManager * taskManager()
Returns the application's task manager, used for managing application wide background task handling.
bool isValid() const
Returns whether this CRS is correctly initialized and usable.
void setExtent(const QgsRectangle *extent)
Configure extent - if not nullptr, it will index only that area.
@ Centroid
Snapped to a centroid.
void visitData(const IData &d) override
void visitData(std::vector< const IData * > &v) override
bool isEmpty() const
Returns true if the geometry is empty (eg a linestring with no vertices, or a collection with no geom...
void visitData(const IData &d) override
QgsVectorLayer * layer() const
The vector layer where the snap occurred.
void visitData(const IData &d) override
const QgsRectangle * extent() const
Gets extent of the area point locator covers - if nullptr then it caches the whole layer.
QgsVertexId vertexId() const
Returns vertex ID of the current item.
QgsFeatureRequest & setNoAttributes()
Set that no attributes will be fetched.
@ Vertex
Snapped to a vertex. Can be a vertex of the geometry or an intersection.
double yMaximum() const
Returns the y maximum value (top side of rectangle).
QgsPointLocator_VisitorNearestEdge(QgsPointLocator *pl, QgsPointLocator::Match &m, const QgsPointXY &srcPoint, QgsPointLocator::MatchFilter *filter=nullptr)
QgsPoint vertexAt(int atVertex) const
Returns coordinates of a vertex.
QgsCoordinateReferenceSystem destinationCrs() const
Gets destination CRS - may be an invalid QgsCoordinateReferenceSystem if not doing OTF reprojection.
void dataChanged()
Data of layer changed.
QgsPointXY asPoint() const
Returns the contents of the geometry as a 2-dimensional point.
void visitData(std::vector< const IData * > &v) override
_CohenSutherland(const QgsRectangle &rect)
void visitNode(const INode &n) override
QgsFeatureId featureId() const
The id of the feature to which the snapped geometry belongs.
QgsPointLocator_VisitorNearestCentroid(QgsPointLocator *pl, QgsPointLocator::Match &m, const QgsPointXY &srcPoint, QgsPointLocator::MatchFilter *filter=nullptr)
GeometryType
The geometry types are used to group QgsWkbTypes::Type in a coarse way.
bool nextFeature(QgsFeature &f)
@ Edge
Snapped to an edge.
QgsPointLocator_Stream(const QLinkedList< RTree::Data * > &dataList)
bool hasGeometry() const
Returns true if the feature has an associated geometry.
void geometryChanged(QgsFeatureId fid, const QgsGeometry &geometry)
Emitted whenever a geometry change is done in the edit buffer.
MatchList pointInPolygon(const QgsPointXY &point, bool relaxed=false)
find out if the point is in any polygons This method is either blocking or non blocking according to ...
The class defines interface for querying point location:
QgsPointLocator(QgsVectorLayer *layer, const QgsCoordinateReferenceSystem &destinationCrs=QgsCoordinateReferenceSystem(), const QgsCoordinateTransformContext &transformContext=QgsCoordinateTransformContext(), const QgsRectangle *extent=nullptr)
Construct point locator for a layer.
QgsGeometry convertToType(QgsWkbTypes::GeometryType destType, bool destMultipart=false) const
Try to convert the geometry to the requested type.
void visitData(const IData &d) override
int vertexNrFromVertexId(QgsVertexId id) const
Returns the vertex number corresponding to a vertex id.
void visitData(std::vector< const IData * > &v) override
void visitNode(const INode &n) override
double yMinimum() const
Returns the y minimum value (bottom side of rectangle).
QgsVectorLayer * layer() const
Gets associated layer.
friend class QgsPointLocatorInitTask
Match nearestCentroid(const QgsPointXY &point, double tolerance, QgsPointLocator::MatchFilter *filter=nullptr, bool relaxed=false)
Find nearest centroid to the specified point - up to distance specified by tolerance Optional filter ...
Interface that allows rejection of some matches in intersection queries (e.g.
QgsRectangle boundingBox() const
Returns the bounding box of the geometry.
QgsPointLocator_VisitorNearestMiddleOfSegment(QgsPointLocator *pl, QgsPointLocator::Match &m, const QgsPointXY &srcPoint, QgsPointLocator::MatchFilter *filter=nullptr)
Match nearestEdge(const QgsPointXY &point, double tolerance, QgsPointLocator::MatchFilter *filter=nullptr, bool relaxed=false)
Find nearest edge to the specified point - up to distance specified by tolerance Optional filter may ...
QgsPointLocator_VisitorMiddlesInRect(QgsPointLocator *pl, QgsPointLocator::MatchList &lst, const QgsRectangle &srcRect, QgsPointLocator::MatchFilter *filter=nullptr)
Constructs the visitor.
QgsAbstractGeometry::vertex_iterator vertices_end() const
Returns STL-style iterator pointing to the imaginary vertex after the last vertex of the geometry.
@ MiddleOfSegment
Snapped to the middle of a segment.
void visitNode(const INode &n) override
QgsAbstractGeometry::vertex_iterator vertices_begin() const
Returns STL-style iterator pointing to the first vertex of the geometry.
QgsPointLocator_VisitorArea(QgsPointLocator *pl, const QgsPointXY &origPt, QgsPointLocator::MatchList &list)
constructor
void initFinished(bool ok)
Emitted whenever index has been built and initialization is finished.
QgsWkbTypes::GeometryType type
Q_INVOKABLE QgsWkbTypes::GeometryType geometryType() const
Returns point, line or polygon.
IData * getNext() override
void visitData(const IData &d) override
void visitNode(const INode &n) override
QgsPointLocator_VisitorNearestVertex(QgsPointLocator *pl, QgsPointLocator::Match &m, const QgsPointXY &srcPoint, QgsPointLocator::MatchFilter *filter=nullptr)
void waitForIndexingFinished()
If the point locator has been initialized relaxedly and is currently indexing, this methods waits for...
double xMinimum() const
Returns the x minimum value (left side of rectangle).
double closestSegmentWithContext(const QgsPointXY &point, QgsPointXY &minDistPoint, int &afterVertex, int *leftOf=nullptr, double epsilon=DEFAULT_SEGMENT_EPSILON) const
Searches for the closest segment of geometry to the given point.
void visitData(const IData &d) override
@ Area
Snapped to an area.
QgsPointLocator_VisitorEdgesInRect(QgsPointLocator *pl, QgsPointLocator::MatchList &lst, const QgsRectangle &srcRect, QgsPointLocator::MatchFilter *filter=nullptr)
void setFeature(const QgsFeature &feature)
Convenience function for setting a feature for the context.
double distance() const
for vertex / edge match units depending on what class returns it (geom.cache: layer units,...
QgsFeatureRenderer * renderer()
Returns renderer.
void featureAdded(QgsFeatureId fid)
Emitted when a new feature has been added to the layer.