QGIS API Documentation 3.99.0-Master (a8882ad4560)
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.h"
21#include "qgis_core.h"
22#include "qgis_sip.h"
23#include "qgsgeometry.h"
24#include "qgspointxy.h"
25#include "qgsrendercontext.h"
26#include "qgsvertexid.h"
27
34{
35 public:
36
38
45
51 void setCurrentItemBounds( const QgsRectangle &bounds );
52
59
65 void setRenderContext( const QgsRenderContext &context );
66
67 private:
68
69 QgsRectangle mCurrentItemBounds;
70 QgsRenderContext mRenderContext;
71
72};
73
80{
81 public:
82
86 enum class Type : int
87 {
88 MoveNode,
89 DeleteNode,
90 AddNode,
91 TranslateItem,
92 RotateItem,
93 };
94
98 QgsAbstractAnnotationItemEditOperation( const QString &itemId );
99
101
105 virtual Type type() const = 0;
106
110 QString itemId() const { return mItemId; }
111
112 protected:
113
114 QString mItemId;
115
116};
117
124{
125 public:
126
134 double translatePixelsX = 0, double translatePixelsY = 0 );
135
136 Type type() const override;
137
141 QgsVertexId nodeId() const { return mNodeId; }
142
148 QgsPoint before() const { return mBefore; }
149
155 QgsPoint after() const { return mAfter; }
156
163 double translationXPixels() const { return mTranslatePixelsX; }
164
171 double translationYPixels() const { return mTranslatePixelsY; }
172
173 private:
174
175 QgsVertexId mNodeId;
176 QgsPoint mBefore;
177 QgsPoint mAfter;
178
179 double mTranslatePixelsX = 0;
180 double mTranslatePixelsY = 0;
181};
182
183
190{
191 public:
192
198
199 Type type() const override;
200
204 QgsVertexId nodeId() const { return mNodeId; }
205
209 QgsPoint before() const { return mBefore; }
210
211 private:
212
213 QgsVertexId mNodeId;
214 QgsPoint mBefore;
215
216};
217
224{
225 public:
226
231
232 Type type() const override;
233
237 QgsPoint point() const { return mPoint; }
238
239 private:
240
241 QgsPoint mPoint;
242
243};
244
245
252{
253 public:
254
261 QgsAnnotationItemEditOperationTranslateItem( const QString &itemId, double translateX, double translateY,
262 double translatePixelsX = 0, double translatePixelsY = 0 );
263
264 Type type() const override;
265
269 QgsVertexId nodeId() const { return mNodeId; }
270
276 double translationX() const { return mTranslateX; }
277
283 double translationY() const { return mTranslateY; }
284
291 double translationXPixels() const { return mTranslatePixelsX; }
292
299 double translationYPixels() const { return mTranslatePixelsY; }
300
301 private:
302
303 QgsVertexId mNodeId;
304 double mTranslateX = 0;
305 double mTranslateY = 0;
306 double mTranslatePixelsX = 0;
307 double mTranslatePixelsY = 0;
308
309};
310
311
318{
319 public:
320
325 QgsAnnotationItemEditOperationRotateItem( const QString &itemId, double angle );
326
327 Type type() const override;
328
332 double angle() const { return mAngle; }
333
334 private:
335
336 double mAngle = 0;
337
338};
339
340
347{
348 public:
349
360
366 QgsGeometry representativeGeometry() const { return mRepresentativeGeometry; }
367
368 private:
369
370 QgsGeometry mRepresentativeGeometry;
371
372};
373
374#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.
QgsAbstractAnnotationItemEditOperation(const QString &itemId)
Constructor for QgsAbstractAnnotationItemEditOperation, for the specified item id.
void setCurrentItemBounds(const QgsRectangle &bounds)
Sets the current rendered bounds of the item, in the annotation layer's CRS.
QgsRectangle currentItemBounds() const
Returns the current rendered bounds of the item, in the annotation layer's CRS.
QgsRenderContext renderContext() const
Returns the render context associated with the edit operation.
void setRenderContext(const QgsRenderContext &context)
Sets the render context associated with the edit operation.
QgsAnnotationItemEditOperationAddNode(const QString &itemId, const QgsPoint &point)
Constructor for QgsAnnotationItemEditOperationAddNode at the specified point.
QgsPoint point() const
Returns the node position (in layer coordinates).
Type type() const override
Returns the operation type.
QgsPoint before() const
Returns the node position before the delete occurred (in layer coordinates).
QgsVertexId nodeId() const
Returns the deleted node ID.
QgsAnnotationItemEditOperationDeleteNode(const QString &itemId, QgsVertexId nodeId, const QgsPoint &before)
Constructor for QgsAnnotationItemEditOperationDeleteNode, where the node with the specified id and pr...
Type type() const override
Returns the operation type.
Type type() const override
Returns the operation type.
double translationYPixels() const
Returns the y-axis translation, in pixels.
QgsAnnotationItemEditOperationMoveNode(const QString &itemId, QgsVertexId nodeId, const QgsPoint &before, const QgsPoint &after, double translatePixelsX=0, double translatePixelsY=0)
Constructor for QgsAnnotationItemEditOperationMoveNode, where the node with the specified id moves fr...
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).
double translationXPixels() const
Returns the x-axis translation, in pixels.
QgsVertexId nodeId() const
Returns the associated node ID.
QgsAnnotationItemEditOperationRotateItem(const QString &itemId, double angle)
Constructor for QgsAnnotationItemEditOperationRotateItem, where the item with the specified itemId an...
double angle() const
Returns the rotation angle value (in degrees clockwise).
Type type() const override
Returns the operation type.
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...
double translationY() const
Returns the y-axis translation, in layer units.
QgsVertexId nodeId() const
Returns the deleted node ID.
Type type() const override
Returns the operation type.
double translationX() const
Returns the x-axis translation, in layer units.
double translationYPixels() const
Returns the y-axis translation, in pixels.
double translationXPixels() const
Returns the x-axis translation, in pixels.
QgsAnnotationItemEditOperationTranslateItem(const QString &itemId, double translateX, double translateY, double translatePixelsX=0, double translatePixelsY=0)
Constructor for QgsAnnotationItemEditOperationTranslateItem, where the node with the specified id and...
A geometry is the spatial representation of a feature.
Point geometry type, with support for z-dimension and m-values.
Definition qgspoint.h:49
A rectangle specified with double values.
Contains information about the context of a rendering operation.
Utility class for identifying a unique vertex within a geometry.
Definition qgsvertexid.h:30