Skip to content

Class SnappingResult

ClassList > SnappingResult

Public Types

Type Name
enum Type

Public Properties

Type Name
property bool isValid
property QgsPoint point

Public Functions

Type Name
SnappingResult ()
construct invalid match
SnappingResult (Type t, QgsVectorLayer * vl, QgsFeatureId fid, double dist, const QgsPoint & pt, int vertexIndex=0, const QgsPoint * edgePoints=nullptr)
SnappingResult (const QgsPointLocator::Match & match)
double distance () const
void edgePoints (QgsPoint & pt1, QgsPoint & pt2) const
Only for a valid edge match - obtain endpoints of the edge.
QgsFeatureId featureId () const
bool hasArea () const
bool hasEdge () const
bool hasVertex () const
bool isValid () const
QgsVectorLayer * layer () const
bool operator!= (const SnappingResult & other) const
bool operator== (const SnappingResult & other) const
QgsPoint point () const
void setPoint (const QgsPoint point)
to set the point individually (e.g. after emmiting Z)
Type type () const
int vertexIndex () const
for vertex / edge match (first vertex of the edge)

Public Types Documentation

enum Type

enum SnappingResult::Type {
    Invalid = 0,
    Vertex = 1,
    Edge = 2,
    Area = 4,
    All = Vertex | Edge | Area
};

The type of a snap result or the filter type for a snap request.


Public Properties Documentation

property isValid [1/2]

bool SnappingResult::isValid;

property point [1/2]

QgsPoint SnappingResult::point;

Public Functions Documentation

function SnappingResult [1/3]

construct invalid match

SnappingResult::SnappingResult () 

function SnappingResult [2/3]

SnappingResult::SnappingResult (
    Type t,
    QgsVectorLayer * vl,
    QgsFeatureId fid,
    double dist,
    const QgsPoint & pt,
    int vertexIndex=0,
    const QgsPoint * edgePoints=nullptr
) 

function SnappingResult [3/3]

explicit SnappingResult::SnappingResult (
    const QgsPointLocator::Match & match
) 

function distance

double SnappingResult::distance () const

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


function edgePoints

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

void SnappingResult::edgePoints (
    QgsPoint & pt1,
    QgsPoint & pt2
) const

function featureId

QgsFeatureId SnappingResult::featureId () const

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


function hasArea

bool SnappingResult::hasArea () const

function hasEdge

bool SnappingResult::hasEdge () const

function hasVertex

bool SnappingResult::hasVertex () const

function isValid [2/2]

bool SnappingResult::isValid () const

function layer

QgsVectorLayer * SnappingResult::layer () const

The vector layer where the snap occurred. Will be null if the snap happened on an intersection.


function operator!=

inline bool SnappingResult::operator!= (
    const SnappingResult & other
) const

function operator==

bool SnappingResult::operator== (
    const SnappingResult & other
) const

function point [2/2]

QgsPoint SnappingResult::point () const

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


function setPoint

to set the point individually (e.g. after emmiting Z)

void SnappingResult::setPoint (
    const QgsPoint point
) 

function type

Type SnappingResult::type () const

function vertexIndex

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

int SnappingResult::vertexIndex () const


The documentation for this class was generated from the following file src/core/snappingresult.h