28using namespace Qt::StringLiterals;
48 double x = mPoint.x();
49 double y = mPoint.y();
55 pt = mPoint.toQPointF();
59 mSymbol->startRender( context );
60 mSymbol->renderPoint( pt,
nullptr, context );
61 mSymbol->stopRender( context );
88 switch ( operation->
type() )
105 mPoint.setX( mPoint.x() + moveOperation->
translationX() );
106 mPoint.setY( mPoint.y() + moveOperation->
translationY() );
115 mSymbol->setAngle( std::fmod( mSymbol->angle() + rotateOperation->
angle(), 360.0 ) );
130 switch ( operation->
type() )
159 const double x = element.attribute( u
"x"_s ).toDouble();
160 const double y = element.attribute( u
"y"_s ).toDouble();
163 const QDomElement symbolElem = element.firstChildElement( u
"symbol"_s );
164 if ( !symbolElem.isNull() )
173 auto item = std::make_unique< QgsAnnotationMarkerItem >( mPoint );
174 item->setSymbol( mSymbol->clone() );
175 item->copyCommonProperties(
this );
176 return item.release();
181 return QgsRectangle( mPoint.x(), mPoint.y(), mPoint.x(), mPoint.y() );
189 double x = mPoint.x();
190 double y = mPoint.y();
193 pt = QPointF( x, y );
196 pt = mPoint.toQPointF();
200 mSymbol->startRender( context );
201 const QRectF boundsInPixels = mSymbol->bounds( pt, context );
202 mSymbol->stopRender( context );
215 return mSymbol.get();
@ VertexHandle
Node is a handle for manipulating vertices.
@ ScaleDependentBoundingBox
Item's bounding box will vary depending on map scale.
@ SupportsReferenceScale
Item supports reference scale based rendering.
AnnotationItemEditOperationResult
Results from an edit operation on an annotation item.
@ Invalid
Operation has invalid parameters for the item, no change occurred.
@ Success
Item was modified successfully.
@ ItemCleared
The operation results in the item being cleared, and the item should be removed from the layer as a r...
QFlags< AnnotationItemFlag > AnnotationItemFlags
Annotation item flags.
@ Reverse
Reverse/inverse transform (from destination to source).
Abstract base class for annotation item edit operations.
@ RotateItem
Rotate an item.
@ DeleteNode
Delete a node.
@ TranslateItem
Translate (move) an item.
virtual Type type() const =0
Returns the operation type.
Encapsulates the context for an annotation item edit operation.
Annotation item edit operation consisting of moving a node.
QgsPoint after() const
Returns the node position after the move occurred (in layer coordinates).
Annotation item edit operation consisting of rotating an item.
double angle() const
Returns the rotation angle value (in degrees clockwise).
Encapsulates the transient results of an in-progress annotation edit operation.
Annotation item edit operation consisting of translating (moving) an item.
double translationY() const
Returns the y-axis translation, in layer units.
double translationX() const
Returns the x-axis translation, in layer units.
Contains information about a node used for editing an annotation item.
virtual bool writeCommonProperties(QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context) const
Writes common properties from the base class into an XML element.
virtual bool readCommonProperties(const QDomElement &element, const QgsReadWriteContext &context)
Reads common properties from the base class from the given DOM element.
QgsAnnotationItemEditOperationTransientResults * transientEditResultsV2(QgsAbstractAnnotationItemEditOperation *operation, const QgsAnnotationItemEditContext &context) override
Retrieves the results of a transient (in progress) edit operation on the item.
Qgis::AnnotationItemFlags flags() const override
Returns item flags.
const QgsMarkerSymbol * symbol() const
Returns the symbol used to render the marker item.
QgsAnnotationMarkerItem(const QgsPoint &point)
Constructor for QgsAnnotationMarkerItem, at the specified point.
void render(QgsRenderContext &context, QgsFeedback *feedback) override
Renders the item to the specified render context.
~QgsAnnotationMarkerItem() override
QList< QgsAnnotationItemNode > nodesV2(const QgsAnnotationItemEditContext &context) const override
Returns the nodes for the item, used for editing the item.
QgsRectangle boundingBox() const override
Returns the bounding box of the item's geographic location, in the parent layer's coordinate referenc...
bool writeXml(QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context) const override
Writes the item's state into an XML element.
static QgsAnnotationMarkerItem * create()
Creates a new marker annotation item.
QString type() const override
Returns a unique (untranslated) string identifying the type of item.
void setSymbol(QgsMarkerSymbol *symbol)
Sets the symbol used to render the marker item.
bool readXml(const QDomElement &element, const QgsReadWriteContext &context) override
Reads the item's state from the given DOM element.
Qgis::AnnotationItemEditOperationResult applyEditV2(QgsAbstractAnnotationItemEditOperation *operation, const QgsAnnotationItemEditContext &context) override
Applies an edit operation to the item.
QgsAnnotationMarkerItem * clone() const override
Returns a clone of the item.
Base class for feedback objects to be used for cancellation of something running in a worker thread.
A geometry is the spatial representation of a feature.
QgsPointXY toMapCoordinates(int x, int y) const
Transforms device coordinates to map (world) coordinates.
void transformInPlace(double &x, double &y) const
Transforms map coordinates to device coordinates.
A marker symbol type, for rendering Point and MultiPoint geometries.
Point geometry type, with support for z-dimension and m-values.
QgsPoint * clone() const override
Clones the geometry by performing a deep copy.
A container for the context for various read/write operations on objects.
A rectangle specified with double values.
Contains information about the context of a rendering operation.
const QgsMapToPixel & mapToPixel() const
Returns the context's map to pixel transform, which transforms between map coordinates and device coo...
QgsCoordinateTransform coordinateTransform() const
Returns the current coordinate transform for the context.
static std::unique_ptr< QgsSymbol > loadSymbol(const QDomElement &element, const QgsReadWriteContext &context)
Attempts to load a symbol from a DOM element.
static QDomElement saveSymbol(const QString &symbolName, const QgsSymbol *symbol, QDomDocument &doc, const QgsReadWriteContext &context)
Writes a symbol definition to XML.
QString qgsDoubleToString(double a, int precision=17)
Returns a string representation of a double.
Utility class for identifying a unique vertex within a geometry.