QGIS API Documentation 3.38.0-Grenoble (exported)
Loading...
Searching...
No Matches
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
Abstract base class for annotation item edit operations.
virtual Type type() const =0
Returns the operation type.
QString itemId() const
Returns the associated item ID.
Annotation item edit operation consisting of adding a node.
QgsPoint point() const
Returns the node position (in layer coordinates).
Annotation item edit operation consisting of deleting a node.
QgsPoint before() const
Returns the node position before the delete occurred (in layer coordinates).
QgsVertexId nodeId() const
Returns the deleted node ID.
Annotation item edit operation consisting of moving a node.
QgsPoint before() const
Returns the node position before the move occurred (in layer coordinates).
QgsPoint after() const
Returns the node position after the move occurred (in layer coordinates).
QgsVertexId nodeId() const
Returns the associated node ID.
Encapsulates the transient results of an in-progress annotation edit operation.
QgsAnnotationItemEditOperationTransientResults(const QgsGeometry &representativeGeometry)
Constructor for QgsAnnotationItemEditOperationTransientResults.
QgsGeometry representativeGeometry() const
Returns the geometry (in layer CRS) which represents the shape of the item if the operation were to b...
Annotation item edit operation consisting of translating (moving) an item.
double translationY() const
Returns the y-axis translation, in layer units.
QgsVertexId nodeId() const
Returns the deleted node ID.
double translationX() const
Returns the x-axis translation, in layer units.
A geometry is the spatial representation of a feature.
Point geometry type, with support for z-dimension and m-values.
Definition qgspoint.h:49
Utility class for identifying a unique vertex within a geometry.
Definition qgsvertexid.h:30