QGIS API Documentation 4.3.0-Master (01f22706ec5)
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:
37
44
50 void setCurrentItemBounds( const QgsRectangle &bounds );
51
58
64 void setRenderContext( const QgsRenderContext &context );
65
66 private:
67 QgsRectangle mCurrentItemBounds;
68 QgsRenderContext mRenderContext;
69};
70
77{
78 public:
82 enum class Type : int
83 {
84 MoveNode,
85 DeleteNode,
86 AddNode,
87 TranslateItem,
88 RotateItem,
89 SetItemBounds,
90 };
91
95 QgsAbstractAnnotationItemEditOperation( const QString &itemId );
96
98
102 virtual Type type() const = 0;
103
107 QString itemId() const { return mItemId; }
108
109 protected:
110 QString mItemId;
111};
112
119{
120 public:
127 QgsAnnotationItemEditOperationMoveNode( const QString &itemId, QgsVertexId nodeId, const QgsPoint &before, const QgsPoint &after, double translatePixelsX = 0, double translatePixelsY = 0 );
128
129 Type type() const override;
130
134 QgsVertexId nodeId() const { return mNodeId; }
135
141 QgsPoint before() const { return mBefore; }
142
148 QgsPoint after() const { return mAfter; }
149
156 double translationXPixels() const { return mTranslatePixelsX; }
157
164 double translationYPixels() const { return mTranslatePixelsY; }
165
166 private:
167 QgsVertexId mNodeId;
168 QgsPoint mBefore;
169 QgsPoint mAfter;
170
171 double mTranslatePixelsX = 0;
172 double mTranslatePixelsY = 0;
173};
174
175
182{
183 public:
189
190 Type type() const override;
191
195 QgsVertexId nodeId() const { return mNodeId; }
196
200 QgsPoint before() const { return mBefore; }
201
202 private:
203 QgsVertexId mNodeId;
204 QgsPoint mBefore;
205};
206
213{
214 public:
219
220 Type type() const override;
221
225 QgsPoint point() const { return mPoint; }
226
227 private:
228 QgsPoint mPoint;
229};
230
231
238{
239 public:
246 QgsAnnotationItemEditOperationTranslateItem( const QString &itemId, double translateX, double translateY, double translatePixelsX = 0, double translatePixelsY = 0 );
247
248 Type type() const override;
249
253 QgsVertexId nodeId() const { return mNodeId; }
254
260 double translationX() const { return mTranslateX; }
261
267 double translationY() const { return mTranslateY; }
268
275 double translationXPixels() const { return mTranslatePixelsX; }
276
283 double translationYPixels() const { return mTranslatePixelsY; }
284
285 private:
286 QgsVertexId mNodeId;
287 double mTranslateX = 0;
288 double mTranslateY = 0;
289 double mTranslatePixelsX = 0;
290 double mTranslatePixelsY = 0;
291};
292
293
300{
301 public:
306 QgsAnnotationItemEditOperationRotateItem( const QString &itemId, double angle );
307
308 Type type() const override;
309
313 double angle() const { return mAngle; }
314
315 private:
316 double mAngle = 0;
317};
318
319
326{
327 public:
333
334 Type type() const override;
335
339 QgsRectangle bounds() const { return mBounds; }
340
341 private:
342 QgsRectangle mBounds;
343};
344
345
352{
353 public:
364
370 QgsGeometry representativeGeometry() const { return mRepresentativeGeometry; }
371
372 private:
373 QgsGeometry mRepresentativeGeometry;
374};
375
376#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.
QgsAnnotationItemEditOperationSetItemBounds(const QString &itemId, const QgsRectangle &bounds)
Constructor for QgsAnnotationItemEditOperationSetItemBounds, setting the item with the specified item...
QgsRectangle bounds() const
Returns the new item bounds (in the annotation layer's CRS).
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:53
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:35