QGIS API Documentation 3.35.0-Master (f6e073f0eed)
Loading...
Searching...
No Matches
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
29struct CORE_EXPORT QgsVertexId
30{
31
35 explicit QgsVertexId( int _part = -1, int _ring = -1, int _vertex = -1, Qgis::VertexType _type = Qgis::VertexType::Segment ) SIP_HOLDGIL
36: part( _part )
37 , ring( _ring )
38 , vertex( _vertex )
39 , type( _type )
40 {}
41
45 bool isValid() const SIP_HOLDGIL { return part >= 0 && ring >= 0 && vertex >= 0; }
46
48 {
49 return part == other.part && ring == other.ring && vertex == other.vertex;
50 }
52 {
53 return part != other.part || ring != other.ring || vertex != other.vertex;
54 }
55
60 {
61 return part >= 0 && o.part == part;
62 }
63
69 {
70 return partEqual( o ) && ( ring >= 0 && o.ring == ring );
71 }
72
78 {
79 return ringEqual( o ) && ( vertex >= 0 && o.ring == ring );
80 }
81
85 bool isValid( const QgsAbstractGeometry *geom ) const SIP_HOLDGIL;
86
88 int part = -1;
89
91 int ring = -1;
92
94 int vertex = -1;
95
98
99#ifdef SIP_RUN
100 SIP_PYOBJECT __repr__();
101 % MethodCode
102 QString str = QStringLiteral( "<QgsVertexId: %1,%2,%3 %4>" ).arg( sipCpp->part ).arg( sipCpp->ring ).arg( sipCpp->vertex ).arg( qgsEnumValueToKey( sipCpp->type ) );
103 sipRes = PyUnicode_FromString( str.toUtf8().data() );
104 % End
105#endif
106
107};
108
109#endif //QGSVERTEXID_H
VertexType
Types of vertex.
Definition qgis.h:2455
@ Segment
The actual start or end point of a segment.
Abstract base class for all geometries.
#define str(x)
Definition qgis.cpp:38
QString qgsEnumValueToKey(const T &value, bool *returnOk=nullptr)
Returns the value for the given key of an enum.
Definition qgis.h:5335
#define SIP_HOLDGIL
Definition qgis_sip.h:171
Utility class for identifying a unique vertex within a geometry.
Definition qgsvertexid.h:30
bool isValid() const
Returns true if the vertex id is valid.
Definition qgsvertexid.h:45
bool vertexEqual(QgsVertexId o) const
Returns true if this vertex ID corresponds to the same vertex as another vertex ID (i....
Definition qgsvertexid.h:77
bool operator==(QgsVertexId other) const
Definition qgsvertexid.h:47
bool operator!=(QgsVertexId other) const
Definition qgsvertexid.h:51
bool ringEqual(QgsVertexId o) const
Returns true if this vertex ID belongs to the same ring as another vertex ID (i.e.
Definition qgsvertexid.h:68
QgsVertexId(int _part=-1, int _ring=-1, int _vertex=-1, Qgis::VertexType _type=Qgis::VertexType::Segment)
Constructor for QgsVertexId.
Definition qgsvertexid.h:35
bool partEqual(QgsVertexId o) const
Returns true if this vertex ID belongs to the same part as another vertex ID.
Definition qgsvertexid.h:59