QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
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 
31 class CORE_EXPORT QgsAnnotationItemNode
32 {
33  public:
34 
38  QgsAnnotationItemNode() = default;
39 
44  : mId( id )
45  , mPoint( point )
46  , mType( type )
47  {}
48 
49 #ifdef SIP_RUN
50  SIP_PYOBJECT __repr__();
51  % MethodCode
52  QString str = QStringLiteral( "<QgsAnnotationItemNode: %1 - %2 (%3, %4)>" ).arg( sipCpp->id().vertex )
53  .arg( qgsEnumValueToKey( sipCpp->type() ) )
54  .arg( sipCpp->point().x() )
55  .arg( sipCpp->point().y() );
56  sipRes = PyUnicode_FromString( str.toUtf8().constData() );
57  % End
58 #endif
59 
63  QgsVertexId id() const { return mId; }
64 
72  QgsPointXY point() const { return mPoint; }
73 
81  void setPoint( QgsPointXY point ) { mPoint = point; }
82 
88  Qgis::AnnotationItemNodeType type() const { return mType; }
89 
95  void setType( Qgis::AnnotationItemNodeType type ) { mType = type; }
96 
97  // TODO c++20 - replace with = default
98  bool operator==( const QgsAnnotationItemNode &other ) const
99  {
100  return mId == other.mId && mType == other.mType && mPoint == other.mPoint;
101  }
102 
103  bool operator!=( const QgsAnnotationItemNode &other ) const
104  {
105  return !( *this == other );
106  }
107 
108  private:
109 
111  QgsPointXY mPoint;
113 
114 };
115 
116 #endif // QGSANNOTATIONITEMEDITNODE_H
qgsvertexid.h
qgsEnumValueToKey
QString qgsEnumValueToKey(const T &value, bool *returnOk=nullptr)
Returns the value for the given key of an enum.
Definition: qgis.h:2440
operator==
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
Definition: qgsfeatureiterator.h:425
qgis.h
Qgis::AnnotationItemNodeType
AnnotationItemNodeType
Annotation item GUI flags.
Definition: qgis.h:1142
operator!=
bool operator!=(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
Definition: qgsfeatureiterator.h:430
qgis_sip.h
QgsPointXY
A class to represent a 2D point.
Definition: qgspointxy.h:58
Qgis::AnnotationItemNodeType::VertexHandle
@ VertexHandle
Node is a handle for manipulating vertices.
QgsAnnotationItemNode
Contains information about a node used for editing an annotation item.
Definition: qgsannotationitemnode.h:31
str
#define str(x)
Definition: qgis.cpp:37
QgsVertexId
Utility class for identifying a unique vertex within a geometry.
Definition: qgsvertexid.h:30
qgspointxy.h