QGIS API Documentation 4.1.0-Master (60fea48833c)
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 // clang-format off
39 explicit QgsVertexId( int _part = -1, int _ring = -1, int _vertex = -1, Qgis::VertexType _type = Qgis::VertexType::Segment ) SIP_HOLDGIL
40 // clang-format on
41: part( _part )
42 , ring( _ring )
43 , vertex( _vertex )
44 , type( _type )
45 {}
46
50 bool isValid() const SIP_HOLDGIL { return part >= 0 && ring >= 0 && vertex >= 0; }
51
53 {
54 return part == other.part && ring == other.ring && vertex == other.vertex;
55 }
57 {
58 return part != other.part || ring != other.ring || vertex != other.vertex;
59 }
60
65 {
66 return part >= 0 && o.part == part;
67 }
68
74 {
75 return partEqual( o ) && ( ring >= 0 && o.ring == ring );
76 }
77
83 {
84 return ringEqual( o ) && ( vertex >= 0 && o.vertex == vertex );
85 }
86
90 bool isValid( const QgsAbstractGeometry *geom ) const SIP_HOLDGIL;
91
93 int part = -1;
94
96 int ring = -1;
97
99 int vertex = -1;
100
103
104#ifdef SIP_RUN
105// clang-format off
106 SIP_PYOBJECT __repr__();
107 % MethodCode
108 QString str = u"<QgsVertexId: %1,%2,%3 %4>"_s.arg( sipCpp->part ).arg( sipCpp->ring ).arg( sipCpp->vertex ).arg( qgsEnumValueToKey( sipCpp->type ) );
109 sipRes = PyUnicode_FromString( str.toUtf8().data() );
110 % End
111// clang-format on
112#endif
113
114};
115
116#endif //QGSVERTEXID_H
VertexType
Types of vertex.
Definition qgis.h:3179
@ Segment
The actual start or end point of a segment.
Definition qgis.h:3180
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:7157
#define SIP_HOLDGIL
Definition qgis_sip.h:178
int vertex
Vertex number.
Definition qgsvertexid.h:99
bool isValid() const
Returns true if the vertex id is valid.
Definition qgsvertexid.h:50
int part
Part number.
Definition qgsvertexid.h:93
bool vertexEqual(QgsVertexId o) const
Returns true if this vertex ID corresponds to the same vertex as another vertex ID (i....
Definition qgsvertexid.h:82
bool operator==(QgsVertexId other) const
Definition qgsvertexid.h:52
bool operator!=(QgsVertexId other) const
Definition qgsvertexid.h:56
Qgis::VertexType type
Vertex type.
int ring
Ring number.
Definition qgsvertexid.h:96
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:73
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:64