QGIS API Documentation  3.37.0-Master (a5b4d9743e8)
Public Member Functions | Protected Attributes | List of all members
QgsPointLocator::Match Struct Reference

#include <qgspointlocator.h>

Public Member Functions

 Match ()=default
 construct invalid match More...
 
 Match (QgsPointLocator::Type t, QgsVectorLayer *vl, QgsFeatureId fid, double dist, const QgsPointXY &pt, int vertexIndex=0, QgsPointXY *edgePoints=nullptr)
 
double distance () const
 for vertex / edge match units depending on what class returns it (geom.cache: layer units, map canvas snapper: dest crs units) More...
 
void edgePoints (QgsPointXY &pt1, QgsPointXY &pt2) const
 Only for a valid edge match - obtain endpoints of the edge. More...
 
QgsFeatureId featureId () const
 The id of the feature to which the snapped geometry belongs. More...
 
bool hasArea () const
 Returns true if the Match is an area. More...
 
bool hasCentroid () const
 Returns true if the Match is a centroid. More...
 
bool hasEdge () const
 Returns true if the Match is an edge. More...
 
bool hasLineEndpoint () const
 Returns true if the Match is a line endpoint (start or end vertex). More...
 
bool hasMiddleSegment () const
 Returns true if the Match is the middle of a segment. More...
 
bool hasVertex () const
 Returns true if the Match is a vertex. More...
 
QgsPoint interpolatedPoint (const QgsCoordinateReferenceSystem &destinationCrs=QgsCoordinateReferenceSystem()) const
 Convenient method to return a point on an edge with linear interpolation of the Z value. More...
 
bool isValid () const
 
QgsVectorLayerlayer () const
 The vector layer where the snap occurred. More...
 
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, map canvas snapper: dest coords) More...
 
QgsPointLocator::Type type () const
 
int vertexIndex () const
 for vertex / edge match (first vertex of the edge) More...
 

Protected Attributes

QgsPointXY mCentroid
 
double mDist = 0
 
QgsPointXY mEdgePoints [2]
 
QgsFeatureId mFid = 0
 
QgsVectorLayermLayer = nullptr
 
QgsPointXY mMiddleOfSegment
 
QgsPointXY mPoint
 
Type mType = Invalid
 
int mVertexIndex = 0
 

Detailed Description

Definition at line 182 of file qgspointlocator.h.

Constructor & Destructor Documentation

◆ Match() [1/2]

QgsPointLocator::Match::Match ( )
default

construct invalid match

◆ Match() [2/2]

QgsPointLocator::Match::Match ( QgsPointLocator::Type  t,
QgsVectorLayer vl,
QgsFeatureId  fid,
double  dist,
const QgsPointXY pt,
int  vertexIndex = 0,
QgsPointXY edgePoints = nullptr 
)
inline

Definition at line 187 of file qgspointlocator.h.

Member Function Documentation

◆ distance()

double QgsPointLocator::Match::distance ( ) const
inline

for vertex / edge match units depending on what class returns it (geom.cache: layer units, map canvas snapper: dest crs units)

Definition at line 227 of file qgspointlocator.h.

◆ edgePoints()

void QgsPointLocator::Match::edgePoints ( QgsPointXY pt1,
QgsPointXY pt2 
) const
inline

Only for a valid edge match - obtain endpoints of the edge.

Definition at line 250 of file qgspointlocator.h.

◆ featureId()

QgsFeatureId QgsPointLocator::Match::featureId ( ) const
inline

The id of the feature to which the snapped geometry belongs.

Definition at line 247 of file qgspointlocator.h.

◆ hasArea()

bool QgsPointLocator::Match::hasArea ( ) const
inline

Returns true if the Match is an area.

Definition at line 212 of file qgspointlocator.h.

◆ hasCentroid()

bool QgsPointLocator::Match::hasCentroid ( ) const
inline

Returns true if the Match is a centroid.

Definition at line 210 of file qgspointlocator.h.

◆ hasEdge()

bool QgsPointLocator::Match::hasEdge ( ) const
inline

Returns true if the Match is an edge.

Definition at line 208 of file qgspointlocator.h.

◆ hasLineEndpoint()

bool QgsPointLocator::Match::hasLineEndpoint ( ) const
inline

Returns true if the Match is a line endpoint (start or end vertex).

Since
QGIS 3.20

Definition at line 221 of file qgspointlocator.h.

◆ hasMiddleSegment()

bool QgsPointLocator::Match::hasMiddleSegment ( ) const
inline

Returns true if the Match is the middle of a segment.

Definition at line 214 of file qgspointlocator.h.

◆ hasVertex()

bool QgsPointLocator::Match::hasVertex ( ) const
inline

Returns true if the Match is a vertex.

Definition at line 206 of file qgspointlocator.h.

◆ interpolatedPoint()

QgsPoint QgsPointLocator::Match::interpolatedPoint ( const QgsCoordinateReferenceSystem destinationCrs = QgsCoordinateReferenceSystem()) const
inline

Convenient method to return a point on an edge with linear interpolation of the Z value.

The parameter destinationCrs depends of where the instance of this Match is created (geom.cache: layer CRS, map canvas snapper: dest CRS)

Since
QGIS 3.10

Definition at line 262 of file qgspointlocator.h.

◆ isValid()

bool QgsPointLocator::Match::isValid ( ) const
inline

Definition at line 204 of file qgspointlocator.h.

◆ layer()

QgsVectorLayer* QgsPointLocator::Match::layer ( ) const
inline

The vector layer where the snap occurred.

Will be nullptr if the snap happened on an intersection.

Definition at line 242 of file qgspointlocator.h.

◆ operator==()

bool QgsPointLocator::Match::operator== ( const QgsPointLocator::Match other) const
inline

Definition at line 316 of file qgspointlocator.h.

◆ point()

QgsPointXY QgsPointLocator::Match::point ( ) const
inline

for vertex / edge match coords depending on what class returns it (geom.cache: layer coords, map canvas snapper: dest coords)

Definition at line 233 of file qgspointlocator.h.

◆ type()

QgsPointLocator::Type QgsPointLocator::Match::type ( ) const
inline

Definition at line 202 of file qgspointlocator.h.

◆ vertexIndex()

int QgsPointLocator::Match::vertexIndex ( ) const
inline

for vertex / edge match (first vertex of the edge)

Definition at line 236 of file qgspointlocator.h.

Member Data Documentation

◆ mCentroid

QgsPointXY QgsPointLocator::Match::mCentroid
protected

Definition at line 338 of file qgspointlocator.h.

◆ mDist

double QgsPointLocator::Match::mDist = 0
protected

Definition at line 332 of file qgspointlocator.h.

◆ mEdgePoints

QgsPointXY QgsPointLocator::Match::mEdgePoints[2]
protected

Definition at line 337 of file qgspointlocator.h.

◆ mFid

QgsFeatureId QgsPointLocator::Match::mFid = 0
protected

Definition at line 335 of file qgspointlocator.h.

◆ mLayer

QgsVectorLayer* QgsPointLocator::Match::mLayer = nullptr
protected

Definition at line 334 of file qgspointlocator.h.

◆ mMiddleOfSegment

QgsPointXY QgsPointLocator::Match::mMiddleOfSegment
protected

Definition at line 339 of file qgspointlocator.h.

◆ mPoint

QgsPointXY QgsPointLocator::Match::mPoint
protected

Definition at line 333 of file qgspointlocator.h.

◆ mType

Type QgsPointLocator::Match::mType = Invalid
protected

Definition at line 331 of file qgspointlocator.h.

◆ mVertexIndex

int QgsPointLocator::Match::mVertexIndex = 0
protected

Definition at line 336 of file qgspointlocator.h.


The documentation for this struct was generated from the following file: