QGIS API Documentation 3.99.0-Master (d270888f95f)
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.h"
20#include "qgis_core.h"
21
22#include <QString>
23
24using namespace Qt::StringLiterals;
25
27
33struct CORE_EXPORT QgsVertexId
34{
35
39 explicit QgsVertexId( int _part = -1, int _ring = -1, int _vertex = -1, Qgis::VertexType _type = Qgis::VertexType::Segment ) SIP_HOLDGIL
40: part( _part )
41 , ring( _ring )
42 , vertex( _vertex )
43 , type( _type )
44 {}
45
49 bool isValid() const SIP_HOLDGIL { return part >= 0 && ring >= 0 && vertex >= 0; }
50
52 {
53 return part == other.part && ring == other.ring && vertex == other.vertex;
54 }
56 {
57 return part != other.part || ring != other.ring || vertex != other.vertex;
58 }
59
64 {
65 return part >= 0 && o.part == part;
66 }
67
73 {
74 return partEqual( o ) && ( ring >= 0 && o.ring == ring );
75 }
76
82 {
83 return ringEqual( o ) && ( vertex >= 0 && o.vertex == vertex );
84 }
85
89 bool isValid( const QgsAbstractGeometry *geom ) const SIP_HOLDGIL;
90
92 int part = -1;
93
95 int ring = -1;
96
98 int vertex = -1;
99
102
103#ifdef SIP_RUN
104 SIP_PYOBJECT __repr__();
105 % MethodCode
106 QString str = u"<QgsVertexId: %1,%2,%3 %4>"_s.arg( sipCpp->part ).arg( sipCpp->ring ).arg( sipCpp->vertex ).arg( qgsEnumValueToKey( sipCpp->type ) );
107 sipRes = PyUnicode_FromString( str.toUtf8().data() );
108 % End
109#endif
110
111};
112
113#endif //QGSVERTEXID_H
VertexType
Types of vertex.
Definition qgis.h:3124
@ Segment
The actual start or end point of a segment.
Definition qgis.h:3125
Abstract base class for all geometries.
QString qgsEnumValueToKey(const T &value, bool *returnOk=nullptr)
Returns the value for the given key of an enum.
Definition qgis.h:7091
#define SIP_HOLDGIL
Definition qgis_sip.h:179
int vertex
Vertex number.
Definition qgsvertexid.h:98
bool isValid() const
Returns true if the vertex id is valid.
Definition qgsvertexid.h:49
int part
Part number.
Definition qgsvertexid.h:92
bool vertexEqual(QgsVertexId o) const
Returns true if this vertex ID corresponds to the same vertex as another vertex ID (i....
Definition qgsvertexid.h:81
bool operator==(QgsVertexId other) const
Definition qgsvertexid.h:51
bool operator!=(QgsVertexId other) const
Definition qgsvertexid.h:55
Qgis::VertexType type
Vertex type.
int ring
Ring number.
Definition qgsvertexid.h:95
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:72
QgsVertexId(int _part=-1, int _ring=-1, int _vertex=-1, Qgis::VertexType _type=Qgis::VertexType::Segment)
Constructor for QgsVertexId.
Definition qgsvertexid.h:39
bool partEqual(QgsVertexId o) const
Returns true if this vertex ID belongs to the same part as another vertex ID.
Definition qgsvertexid.h:63