QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
qgsannotationitemeditoperation.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsannotationitemeditoperation.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 QGSANNOTATIONITEMEDITOPERATION_H
18 #define QGSANNOTATIONITEMEDITOPERATION_H
19 
20 #include "qgis_core.h"
21 #include "qgis_sip.h"
22 #include "qgis.h"
23 #include "qgspointxy.h"
24 #include "qgsvertexid.h"
25 #include "qgsgeometry.h"
26 
33 {
34  public:
35 
39  enum class Type : int
40  {
41  MoveNode,
42  DeleteNode,
43  AddNode,
44  TranslateItem,
45  };
46 
50  QgsAbstractAnnotationItemEditOperation( const QString &itemId );
51 
53 
57  virtual Type type() const = 0;
58 
62  QString itemId() const { return mItemId; }
63 
64  protected:
65 
66  QString mItemId;
67 
68 };
69 
76 {
77  public:
78 
83  QgsAnnotationItemEditOperationMoveNode( const QString &itemId, QgsVertexId nodeId, const QgsPoint &before, const QgsPoint &after );
84 
85  Type type() const override;
86 
90  QgsVertexId nodeId() const { return mNodeId; }
91 
97  QgsPoint before() const { return mBefore; }
98 
104  QgsPoint after() const { return mAfter; }
105 
106  private:
107 
108  QgsVertexId mNodeId;
109  QgsPoint mBefore;
110  QgsPoint mAfter;
111 
112 };
113 
114 
121 {
122  public:
123 
128  QgsAnnotationItemEditOperationDeleteNode( const QString &itemId, QgsVertexId nodeId, const QgsPoint &before );
129 
130  Type type() const override;
131 
135  QgsVertexId nodeId() const { return mNodeId; }
136 
140  QgsPoint before() const { return mBefore; }
141 
142  private:
143 
144  QgsVertexId mNodeId;
145  QgsPoint mBefore;
146 
147 };
148 
155 {
156  public:
157 
161  QgsAnnotationItemEditOperationAddNode( const QString &itemId, const QgsPoint &point );
162 
163  Type type() const override;
164 
168  QgsPoint point() const { return mPoint; }
169 
170  private:
171 
172  QgsPoint mPoint;
173 
174 };
175 
176 
183 {
184  public:
185 
190  QgsAnnotationItemEditOperationTranslateItem( const QString &itemId, double translateX, double translateY );
191 
192  Type type() const override;
193 
197  QgsVertexId nodeId() const { return mNodeId; }
198 
204  double translationX() const { return mTranslateX; }
205 
211  double translationY() const { return mTranslateY; }
212 
213  private:
214 
215  QgsVertexId mNodeId;
216  double mTranslateX = 0;
217  double mTranslateY = 0;
218 
219 };
220 
227 {
228  public:
229 
238  : mRepresentativeGeometry( representativeGeometry )
239  {}
240 
246  QgsGeometry representativeGeometry() const { return mRepresentativeGeometry; }
247 
248  private:
249 
250  QgsGeometry mRepresentativeGeometry;
251 
252 };
253 
254 #endif // QGSANNOTATIONITEMEDITOPERATION_H
qgsvertexid.h
QgsPoint
Point geometry type, with support for z-dimension and m-values.
Definition: qgspoint.h:48
QgsAnnotationItemEditOperationTranslateItem
Annotation item edit operation consisting of translating (moving) an item.
Definition: qgsannotationitemeditoperation.h:182
QgsAnnotationItemEditOperationDeleteNode
Annotation item edit operation consisting of deleting a node.
Definition: qgsannotationitemeditoperation.h:120
QgsAbstractAnnotationItemEditOperation::type
virtual Type type() const =0
Returns the operation type.
QgsAnnotationItemEditOperationTranslateItem::nodeId
QgsVertexId nodeId() const
Returns the deleted node ID.
Definition: qgsannotationitemeditoperation.h:197
qgis.h
QgsAbstractAnnotationItemEditOperation::Type
Type
Operation type.
Definition: qgsannotationitemeditoperation.h:51
QgsAnnotationItemEditOperationAddNode::point
QgsPoint point() const
Returns the node position (in layer coordinates).
Definition: qgsannotationitemeditoperation.h:168
QgsAnnotationItemEditOperationMoveNode::nodeId
QgsVertexId nodeId() const
Returns the associated node ID.
Definition: qgsannotationitemeditoperation.h:90
qgis_sip.h
QgsAnnotationItemEditOperationDeleteNode::nodeId
QgsVertexId nodeId() const
Returns the deleted node ID.
Definition: qgsannotationitemeditoperation.h:135
QgsAnnotationItemEditOperationMoveNode
Annotation item edit operation consisting of moving a node.
Definition: qgsannotationitemeditoperation.h:75
QgsAbstractAnnotationItemEditOperation
Abstract base class for annotation item edit operations.
Definition: qgsannotationitemeditoperation.h:32
QgsAnnotationItemEditOperationMoveNode::after
QgsPoint after() const
Returns the node position after the move occurred (in layer coordinates).
Definition: qgsannotationitemeditoperation.h:104
QgsAnnotationItemEditOperationDeleteNode::before
QgsPoint before() const
Returns the node position before the delete occurred (in layer coordinates).
Definition: qgsannotationitemeditoperation.h:140
qgsgeometry.h
QgsGeometry
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:124
QgsAnnotationItemEditOperationMoveNode::before
QgsPoint before() const
Returns the node position before the move occurred (in layer coordinates).
Definition: qgsannotationitemeditoperation.h:97
QgsVertexId
Utility class for identifying a unique vertex within a geometry.
Definition: qgsvertexid.h:30
QgsAnnotationItemEditOperationTransientResults::QgsAnnotationItemEditOperationTransientResults
QgsAnnotationItemEditOperationTransientResults(const QgsGeometry &representativeGeometry)
Constructor for QgsAnnotationItemEditOperationTransientResults.
Definition: qgsannotationitemeditoperation.h:237
QgsAnnotationItemEditOperationAddNode
Annotation item edit operation consisting of adding a node.
Definition: qgsannotationitemeditoperation.h:154
QgsAnnotationItemEditOperationTranslateItem::translationY
double translationY() const
Returns the y-axis translation, in layer units.
Definition: qgsannotationitemeditoperation.h:211
QgsAnnotationItemEditOperationTranslateItem::translationX
double translationX() const
Returns the x-axis translation, in layer units.
Definition: qgsannotationitemeditoperation.h:204
QgsAnnotationItemEditOperationTransientResults
Encapsulates the transient results of an in-progress annotation edit operation.
Definition: qgsannotationitemeditoperation.h:226
QgsAnnotationItemEditOperationTransientResults::representativeGeometry
QgsGeometry representativeGeometry() const
Returns the geometry (in layer CRS) which represents the shape of the item if the operation were to b...
Definition: qgsannotationitemeditoperation.h:246
qgspointxy.h