QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
Go to the documentation of this file.
34 return QStringLiteral(
"marker" );
42 double x = mPoint.
x();
43 double y = mPoint.
y();
53 mSymbol->startRender( context );
54 mSymbol->renderPoint( pt,
nullptr, context );
55 mSymbol->stopRender( context );
62 element.setAttribute( QStringLiteral(
"zIndex" ),
zIndex() );
76 const double x = element.attribute( QStringLiteral(
"x" ) ).toDouble();
77 const double y = element.attribute( QStringLiteral(
"y" ) ).toDouble();
80 setZIndex( element.attribute( QStringLiteral(
"zIndex" ) ).toInt() );
82 const QDomElement symbolElem = element.firstChildElement( QStringLiteral(
"symbol" ) );
83 if ( !symbolElem.isNull() )
84 setSymbol( QgsSymbolLayerUtils::loadSymbol< QgsMarkerSymbol >( symbolElem, context ) );
91 std::unique_ptr< QgsAnnotationMarkerItem > item = qgis::make_unique< QgsAnnotationMarkerItem >( mPoint );
92 item->setSymbol( mSymbol->clone() );
93 item->setZIndex(
zIndex() );
94 return item.release();
104 return mSymbol.get();
const QgsMapToPixel & mapToPixel() const
Returns the context's map to pixel transform, which transforms between map coordinates and device coo...
The class is used as a container of context for various read/write operations on other objects.
Point geometry type, with support for z-dimension and m-values.
QgsAnnotationMarkerItem(const QgsPoint &point)
Constructor for QgsAnnotationMarkerItem, at the specified point.
QString type() const override
Returns a unique (untranslated) string identifying the type of item.
Contains information about the context of a rendering operation.
void render(QgsRenderContext &context, QgsFeedback *feedback) override
Renders the item to the specified render context.
A rectangle specified with double values.
QString qgsDoubleToString(double a, int precision=17)
Returns a string representation of a double.
An annotation item which renders a marker symbol at a point location.
QgsRectangle boundingBox() const override
Returns the bounding box of the item's geographic location, in the parent layer's coordinate referenc...
QgsCoordinateTransform coordinateTransform() const
Returns the current coordinate transform for the context.
QgsAnnotationMarkerItem * clone() override
Returns a clone of the item.
QPointF toQPointF() const SIP_HOLDGIL
Returns the point as a QPointF.
A marker symbol type, for rendering Point and MultiPoint geometries.
Base class for feedback objects to be used for cancellation of something running in a worker thread.
const QgsMarkerSymbol * symbol() const
Returns the symbol used to render the marker item.
~QgsAnnotationMarkerItem() override
int zIndex() const
Returns the item's z index, which controls the order in which annotation items are rendered in the la...
void transformInPlace(double &x, double &y) const
Transform device coordinates to map coordinates.
static QgsAnnotationMarkerItem * create()
Creates a new marker annotation item.
bool writeXml(QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context) const override
Writes the item's state into an XML element.
bool readXml(const QDomElement &element, const QgsReadWriteContext &context) override
Reads the item's state from the given DOM element.
static QDomElement saveSymbol(const QString &symbolName, const QgsSymbol *symbol, QDomDocument &doc, const QgsReadWriteContext &context)
Writes a symbol definition to XML.
void setZIndex(int index)
Sets the item's z index, which controls the order in which annotation items are rendered in the layer...
Abstract base class for annotation items which are drawn with QgsAnnotationLayers.
void setSymbol(QgsMarkerSymbol *symbol)
Sets the symbol used to render the marker item.