QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
qgsvertexid.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsvertexid.h
3 -------------------------------------------------------------------
4Date : 04 Sept 2014
5Copyright : (C) 2014 by Marco Hugentobler
6email : marco.hugentobler at sourcepole dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#ifndef QGSVERTEXID_H
17#define QGSVERTEXID_H
18
19#include "qgis_core.h"
20#include "qgis.h"
21
23
30struct CORE_EXPORT QgsVertexId
31{
32
36 explicit QgsVertexId( int _part = -1, int _ring = -1, int _vertex = -1, Qgis::VertexType _type = Qgis::VertexType::Segment ) SIP_HOLDGIL
37: part( _part )
38 , ring( _ring )
39 , vertex( _vertex )
40 , type( _type )
41 {}
42
46 bool isValid() const SIP_HOLDGIL { return part >= 0 && ring >= 0 && vertex >= 0; }
47
49 {
50 return part == other.part && ring == other.ring && vertex == other.vertex;
51 }
53 {
54 return part != other.part || ring != other.ring || vertex != other.vertex;
55 }
56
61 {
62 return part >= 0 && o.part == part;
63 }
64
70 {
71 return partEqual( o ) && ( ring >= 0 && o.ring == ring );
72 }
73
79 {
80 return ringEqual( o ) && ( vertex >= 0 && o.ring == ring );
81 }
82
86 bool isValid( const QgsAbstractGeometry *geom ) const SIP_HOLDGIL;
87
89 int part = -1;
90
92 int ring = -1;
93
95 int vertex = -1;
96
98 Qgis::VertexType type = Qgis::VertexType::Segment;
99
100#ifdef SIP_RUN
101 SIP_PYOBJECT __repr__();
102 % MethodCode
103 QString str = QStringLiteral( "<QgsVertexId: %1,%2,%3 %4>" ).arg( sipCpp->part ).arg( sipCpp->ring ).arg( sipCpp->vertex ).arg( qgsEnumValueToKey( sipCpp->type ) );
104 sipRes = PyUnicode_FromString( str.toUtf8().data() );
105 % End
106#endif
107
108};
109
110#endif //QGSVERTEXID_H
VertexType
Types of vertex.
Definition: qgis.h:1518
Abstract base class for all geometries.
#define str(x)
Definition: qgis.cpp:37
QString qgsEnumValueToKey(const T &value, bool *returnOk=nullptr)
Returns the value for the given key of an enum.
Definition: qgis.h:2681
#define SIP_HOLDGIL
Definition: qgis_sip.h:166
Utility class for identifying a unique vertex within a geometry.
Definition: qgsvertexid.h:31
bool operator!=(QgsVertexId other) const SIP_HOLDGIL
Definition: qgsvertexid.h:52
bool ringEqual(QgsVertexId o) const SIP_HOLDGIL
Returns true if this vertex ID belongs to the same ring as another vertex ID (i.e.
Definition: qgsvertexid.h:69
bool partEqual(QgsVertexId o) const SIP_HOLDGIL
Returns true if this vertex ID belongs to the same part as another vertex ID.
Definition: qgsvertexid.h:60
QgsVertexId(int _part=-1, int _ring=-1, int _vertex=-1, Qgis::VertexType _type=Qgis::VertexType::Segment) SIP_HOLDGIL
Constructor for QgsVertexId.
Definition: qgsvertexid.h:36
bool isValid() const SIP_HOLDGIL
Returns true if the vertex id is valid.
Definition: qgsvertexid.h:46
bool vertexEqual(QgsVertexId o) const SIP_HOLDGIL
Returns true if this vertex ID corresponds to the same vertex as another vertex ID (i....
Definition: qgsvertexid.h:78
bool operator==(QgsVertexId other) const SIP_HOLDGIL
Definition: qgsvertexid.h:48