QGIS API Documentation 3.39.0-Master (3aed037ce22)
Loading...
Searching...
No Matches
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_core.h"
21#include "qgis_sip.h"
22#include "qgspointxy.h"
23#include "qgsvertexid.h"
24#include "qgis.h"
25
31class CORE_EXPORT QgsAnnotationItemNode
32{
33 public:
34
36
41 : mId( id )
42 , mPoint( point )
43 , mType( type )
44 {}
45
46#ifdef SIP_RUN
47 SIP_PYOBJECT __repr__();
48 % MethodCode
49 QString str = QStringLiteral( "<QgsAnnotationItemNode: %1 - %2 (%3, %4)>" ).arg( sipCpp->id().vertex )
50 .arg( qgsEnumValueToKey( sipCpp->type() ) )
51 .arg( sipCpp->point().x() )
52 .arg( sipCpp->point().y() );
53 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
54 % End
55#endif
56
60 QgsVertexId id() const { return mId; }
61
69 QgsPointXY point() const { return mPoint; }
70
78 void setPoint( QgsPointXY point ) { mPoint = point; }
79
85 Qgis::AnnotationItemNodeType type() const { return mType; }
86
92 void setType( Qgis::AnnotationItemNodeType type ) { mType = type; }
93
94 // TODO c++20 - replace with = default
95 bool operator==( const QgsAnnotationItemNode &other ) const
96 {
97 return mId == other.mId && mType == other.mType && mPoint == other.mPoint;
98 }
99
100 bool operator!=( const QgsAnnotationItemNode &other ) const
101 {
102 return !( *this == other );
103 }
104
105 private:
106
107 QgsVertexId mId;
108 QgsPointXY mPoint;
110
111};
112
113#endif // QGSANNOTATIONITEMEDITNODE_H
AnnotationItemNodeType
Annotation item node types.
Definition qgis.h:2207
@ VertexHandle
Node is a handle for manipulating vertices.
Contains information about a node used for editing an annotation item.
QgsAnnotationItemNode(const QgsVertexId &id, const QgsPointXY &point, Qgis::AnnotationItemNodeType type)
Constructor for QgsAnnotationItemNode, with the specified id, point and type.
void setPoint(QgsPointXY point)
Sets the node's position, in geographic coordinates.
Qgis::AnnotationItemNodeType type() const
Returns the node type.
QgsPointXY point() const
Returns the node's position, in geographic coordinates.
void setType(Qgis::AnnotationItemNodeType type)
Sets the node type.
bool operator==(const QgsAnnotationItemNode &other) const
QgsAnnotationItemNode()=default
bool operator!=(const QgsAnnotationItemNode &other) const
QgsVertexId id() const
Returns the ID number of the node, used for uniquely identifying the node in the item.
A class to represent a 2D point.
Definition qgspointxy.h:60
#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:5843
Utility class for identifying a unique vertex within a geometry.
Definition qgsvertexid.h:30