QGIS API Documentation
4.3.0-Master (9dce731a7a1)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
annotations
qgsannotationitemnode.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsannotationitemnode.h
3
----------------
4
copyright : (C) 2021 by Nyall Dawson
5
email : nyall dot dawson at gmail dot com
6
***************************************************************************/
7
8
/***************************************************************************
9
* *
10
* This program is free software; you can redistribute it and/or modify *
11
* it under the terms of the GNU General Public License as published by *
12
* the Free Software Foundation; either version 2 of the License, or *
13
* (at your option) any later version. *
14
* *
15
***************************************************************************/
16
17
#ifndef QGSANNOTATIONITEMEDITNODE_H
18
#define QGSANNOTATIONITEMEDITNODE_H
19
20
#include "
qgis.h
"
21
#include "qgis_core.h"
22
#include "
qgis_sip.h
"
23
#include "
qgspointxy.h
"
24
#include "
qgsvertexid.h
"
25
26
#include <QString>
27
28
using namespace
Qt::StringLiterals;
29
35
class
CORE_EXPORT
QgsAnnotationItemNode
36
{
37
public
:
38
QgsAnnotationItemNode
() =
default
;
39
43
QgsAnnotationItemNode
(
const
QgsVertexId
&
id
,
const
QgsPointXY
&
point
,
Qgis::AnnotationItemNodeType
type
, Qt::CursorShape
cursor
= Qt::CursorShape::ArrowCursor )
44
: mId(
id
)
45
, mPoint(
point
)
46
, mType(
type
)
47
, mCursor(
cursor
)
48
{}
49
50
// clang-format off
51
#ifdef SIP_RUN
52
SIP_PYOBJECT __repr__();
53
% MethodCode
54
QString str = u
"<QgsAnnotationItemNode: %1 - %2 (%3, %4)>"
_s.arg( sipCpp->id().vertex )
55
.arg(
qgsEnumValueToKey
( sipCpp->type() ) )
56
.arg( sipCpp->point().x() )
57
.arg( sipCpp->point().y() );
58
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
59
% End
60
#endif
61
// clang-format on
62
66
QgsVertexId
id
()
const
67
{
68
return
mId;
69
}
70
78
QgsPointXY
point
()
const
{
return
mPoint; }
79
87
void
setPoint
(
QgsPointXY
point
) { mPoint =
point
; }
88
94
Qgis::AnnotationItemNodeType
type
()
const
{
return
mType; }
95
101
void
setType
(
Qgis::AnnotationItemNodeType
type
) { mType =
type
; }
102
109
Qt::CursorShape
cursor
()
const
{
return
mCursor; }
110
117
void
setCursor
( Qt::CursorShape shape ) { mCursor = shape; }
118
119
// TODO c++20 - replace with = default
120
bool
operator==
(
const
QgsAnnotationItemNode
&other )
const
{
return
mId == other.mId && mType == other.mType && mPoint == other.mPoint; }
121
122
bool
operator!=
(
const
QgsAnnotationItemNode
&other )
const
{
return
!( *
this
== other ); }
123
124
private
:
125
QgsVertexId
mId;
126
QgsPointXY
mPoint;
127
Qgis::AnnotationItemNodeType
mType =
Qgis::AnnotationItemNodeType::VertexHandle
;
128
Qt::CursorShape mCursor = Qt::CursorShape::ArrowCursor;
129
};
130
131
#endif
// QGSANNOTATIONITEMEDITNODE_H
Qgis::AnnotationItemNodeType
AnnotationItemNodeType
Annotation item node types.
Definition
qgis.h:2714
Qgis::AnnotationItemNodeType::VertexHandle
@ VertexHandle
Node is a handle for manipulating vertices.
Definition
qgis.h:2715
QgsAnnotationItemNode::setPoint
void setPoint(QgsPointXY point)
Sets the node's position, in geographic coordinates.
Definition
qgsannotationitemnode.h:87
QgsAnnotationItemNode::type
Qgis::AnnotationItemNodeType type() const
Returns the node type.
Definition
qgsannotationitemnode.h:94
QgsAnnotationItemNode::point
QgsPointXY point() const
Returns the node's position, in geographic coordinates.
Definition
qgsannotationitemnode.h:78
QgsAnnotationItemNode::QgsAnnotationItemNode
QgsAnnotationItemNode(const QgsVertexId &id, const QgsPointXY &point, Qgis::AnnotationItemNodeType type, Qt::CursorShape cursor=Qt::CursorShape::ArrowCursor)
Constructor for QgsAnnotationItemNode, with the specified id, point and type.
Definition
qgsannotationitemnode.h:43
QgsAnnotationItemNode::cursor
Qt::CursorShape cursor() const
Returns the mouse cursor shape to use when hovering the node.
Definition
qgsannotationitemnode.h:109
QgsAnnotationItemNode::setType
void setType(Qgis::AnnotationItemNodeType type)
Sets the node type.
Definition
qgsannotationitemnode.h:101
QgsAnnotationItemNode::operator==
bool operator==(const QgsAnnotationItemNode &other) const
Definition
qgsannotationitemnode.h:120
QgsAnnotationItemNode::setCursor
void setCursor(Qt::CursorShape shape)
Sets the mouse cursor shape to use when hovering the node.
Definition
qgsannotationitemnode.h:117
QgsAnnotationItemNode::QgsAnnotationItemNode
QgsAnnotationItemNode()=default
QgsAnnotationItemNode::operator!=
bool operator!=(const QgsAnnotationItemNode &other) const
Definition
qgsannotationitemnode.h:122
QgsAnnotationItemNode::id
QgsVertexId id() const
Returns the ID number of the node, used for uniquely identifying the node in the item.
Definition
qgsannotationitemnode.h:66
QgsPointXY
Represents a 2D point.
Definition
qgspointxy.h:62
qgis.h
qgsEnumValueToKey
QString qgsEnumValueToKey(const T &value, bool *returnOk=nullptr)
Returns the value for the given key of an enum.
Definition
qgis.h:8057
qgis_sip.h
qgspointxy.h
qgsvertexid.h
QgsVertexId
Utility class for identifying a unique vertex within a geometry.
Definition
qgsvertexid.h:35
Generated on
for QGIS API Documentation by
1.17.0