QGIS API Documentation
4.3.0-Master (4ecdf0f3f59)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
geometry
qgsvertexid.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsvertexid.h
3
-------------------------------------------------------------------
4
Date : 04 Sept 2014
5
Copyright : (C) 2014 by Marco Hugentobler
6
email : 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 <QHash>
23
#include <QString>
24
25
using namespace
Qt::StringLiterals;
26
27
class
QgsAbstractGeometry
;
28
34
struct
CORE_EXPORT
QgsVertexId
35
{
36
// clang-format off
40
explicit
QgsVertexId
(
int
_part = -1,
int
_ring = -1,
int
_vertex = -1,
Qgis::VertexType
_type =
Qgis::VertexType::Segment
)
SIP_HOLDGIL
41
// clang-format on
42
:
part
( _part )
43
,
ring
( _ring )
44
,
vertex
( _vertex )
45
,
type
( _type )
46
{}
47
51
bool
isValid
() const
SIP_HOLDGIL
{
return
part
>= 0 &&
ring
>= 0 &&
vertex
>= 0; }
52
53
bool
operator==
(
QgsVertexId
other )
const
SIP_HOLDGIL
54
{
55
return
part
== other.part &&
ring
== other.ring &&
vertex
== other.vertex;
56
}
57
bool
operator!=
(
QgsVertexId
other )
const
SIP_HOLDGIL
58
{
59
return
part
!= other.part ||
ring
!= other.ring ||
vertex
!= other.vertex;
60
}
61
65
bool
partEqual
(
QgsVertexId
o )
const
SIP_HOLDGIL
66
{
67
return
part
>= 0 && o.part ==
part
;
68
}
69
74
bool
ringEqual
(
QgsVertexId
o )
const
SIP_HOLDGIL
75
{
76
return
partEqual
( o ) && (
ring
>= 0 && o.ring ==
ring
);
77
}
78
83
bool
vertexEqual
(
QgsVertexId
o )
const
SIP_HOLDGIL
84
{
85
return
ringEqual
( o ) && (
vertex
>= 0 && o.vertex ==
vertex
);
86
}
87
93
Q_DECL_DEPRECATED
bool
isValid(
const
QgsAbstractGeometry
*geom )
const
SIP_HOLDGIL
SIP_DEPRECATED
;
94
96
int
part
= -1;
97
99
int
ring
= -1;
100
102
int
vertex
= -1;
103
105
Qgis::VertexType
type
=
Qgis::VertexType::Segment
;
106
107
#ifdef SIP_RUN
108
// clang-format off
109
SIP_PYOBJECT __repr__();
110
% MethodCode
111
QString str = u
"<QgsVertexId: %1,%2,%3 %4>"
_s.arg( sipCpp->part ).arg( sipCpp->ring ).arg( sipCpp->vertex ).arg(
qgsEnumValueToKey
( sipCpp->type ) );
112
sipRes = PyUnicode_FromString( str.toUtf8().data() );
113
% End
114
// clang-format on
115
#endif
116
117
};
118
119
#ifndef SIP_RUN
120
inline
size_t
qHash
(
QgsVertexId
id
,
size_t
seed = 0 ) noexcept
121
{
122
return
qHashMulti( seed,
id
.part,
id
.ring,
id
.vertex );
123
}
124
#endif
125
126
#endif
//QGSVERTEXID_H
Qgis::VertexType
VertexType
Types of vertex.
Definition
qgis.h:3303
Qgis::VertexType::Segment
@ Segment
The actual start or end point of a segment.
Definition
qgis.h:3304
QgsAbstractGeometry
Abstract base class for all geometries.
Definition
qgsabstractgeometry.h:82
qgis.h
qgsEnumValueToKey
QString qgsEnumValueToKey(const T &value, bool *returnOk=nullptr)
Returns the value for the given key of an enum.
Definition
qgis.h:8045
SIP_DEPRECATED
#define SIP_DEPRECATED
Definition
qgis_sip.h:113
SIP_HOLDGIL
#define SIP_HOLDGIL
Definition
qgis_sip.h:183
qHash
size_t qHash(QgsVertexId id, size_t seed=0) noexcept
Definition
qgsvertexid.h:120
QgsVertexId
Utility class for identifying a unique vertex within a geometry.
Definition
qgsvertexid.h:35
QgsVertexId::vertex
int vertex
Vertex number.
Definition
qgsvertexid.h:102
QgsVertexId::isValid
bool isValid() const
Returns true if the vertex id is valid.
Definition
qgsvertexid.h:51
QgsVertexId::part
int part
Part number.
Definition
qgsvertexid.h:96
QgsVertexId::vertexEqual
bool vertexEqual(QgsVertexId o) const
Returns true if this vertex ID corresponds to the same vertex as another vertex ID (i....
Definition
qgsvertexid.h:83
QgsVertexId::operator==
bool operator==(QgsVertexId other) const
Definition
qgsvertexid.h:53
QgsVertexId::operator!=
bool operator!=(QgsVertexId other) const
Definition
qgsvertexid.h:57
QgsVertexId::type
Qgis::VertexType type
Vertex type.
Definition
qgsvertexid.h:105
QgsVertexId::ring
int ring
Ring number.
Definition
qgsvertexid.h:99
QgsVertexId::ringEqual
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:74
QgsVertexId::QgsVertexId
QgsVertexId(int _part=-1, int _ring=-1, int _vertex=-1, Qgis::VertexType _type=Qgis::VertexType::Segment)
Constructor for QgsVertexId.
Definition
qgsvertexid.h:40
QgsVertexId::partEqual
bool partEqual(QgsVertexId o) const
Returns true if this vertex ID belongs to the same part as another vertex ID.
Definition
qgsvertexid.h:65
Generated on
for QGIS API Documentation by
1.17.0