QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
37 return QStringLiteral(
"marker" );
45 double x = mPoint.
x();
46 double y = mPoint.
y();
56 mSymbol->startRender( context );
57 mSymbol->renderPoint( pt,
nullptr, context );
58 mSymbol->stopRender( context );
85 switch ( operation->
type() )
116 switch ( operation->
type() )
144 const double x = element.attribute( QStringLiteral(
"x" ) ).toDouble();
145 const double y = element.attribute( QStringLiteral(
"y" ) ).toDouble();
148 const QDomElement symbolElem = element.firstChildElement( QStringLiteral(
"symbol" ) );
149 if ( !symbolElem.isNull() )
150 setSymbol( QgsSymbolLayerUtils::loadSymbol< QgsMarkerSymbol >( symbolElem, context ) );
158 std::unique_ptr< QgsAnnotationMarkerItem > item = std::make_unique< QgsAnnotationMarkerItem >( mPoint );
159 item->setSymbol( mSymbol->clone() );
160 item->copyCommonProperties(
this );
161 return item.release();
174 double x = mPoint.
x();
175 double y = mPoint.
y();
178 pt = QPointF( x, y );
185 mSymbol->startRender( context );
186 const QRectF boundsInPixels = mSymbol->bounds( pt, context );
187 mSymbol->stopRender( context );
200 return mSymbol.get();
QgsAnnotationItemEditOperationTransientResults * transientEditResults(QgsAbstractAnnotationItemEditOperation *operation) override
Retrieves the results of a transient (in progress) edit operation on the item.
@ DeleteNode
Delete a node.
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.
Annotation item edit operation consisting of translating (moving) an item.
virtual Type type() const =0
Returns the operation type.
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.
QgsPointXY toMapCoordinates(int x, int y) const
Transforms device coordinates to map (world) coordinates.
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.
QgsPoint * clone() const override
Clones the geometry by performing a deep copy.
AnnotationItemEditOperationResult
Results from an edit operation on an annotation item.
@ ItemCleared
The operation results in the item being cleared, and the item should be removed from the layer as a r...
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.
Qgis::AnnotationItemFlags flags() const override
Returns item flags.
QgsAnnotationMarkerItem * clone() override
Returns a clone of the item.
Qgis::AnnotationItemEditOperationResult applyEdit(QgsAbstractAnnotationItemEditOperation *operation) override
Applies an edit operation to the item.
QPointF toQPointF() const SIP_HOLDGIL
Returns the point as a QPointF.
@ TranslateItem
Translate (move) an item.
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.
bool writeCommonProperties(QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context) const
Writes common properties from the base class into an XML element.
void setX(double x) SIP_HOLDGIL
Sets the point's x-coordinate.
bool readCommonProperties(const QDomElement &element, const QgsReadWriteContext &context)
Reads common properties from the base class from the given DOM element.
Annotation item edit operation consisting of moving a node.
Abstract base class for annotation item edit operations.
A class to represent a 2D point.
QgsPoint after() const
Returns the node position after the move occurred (in layer coordinates).
~QgsAnnotationMarkerItem() override
@ VertexHandle
Node is a handle for manipulating vertices.
void transformInPlace(double &x, double &y) const
Transforms device coordinates to map coordinates.
@ Success
Item was modified successfully.
QList< QgsAnnotationItemNode > nodes() const override
Returns the nodes for the item, used for editing the item.
Contains information about a node used for editing an annotation item.
static QgsAnnotationMarkerItem * create()
Creates a new marker annotation item.
A geometry is the spatial representation of a feature.
Utility class for identifying a unique vertex within a geometry.
void setY(double y) SIP_HOLDGIL
Sets the point's y-coordinate.
@ ScaleDependentBoundingBox
Item's bounding box will vary depending on map scale.
bool writeXml(QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context) const override
Writes the item's state into an XML element.
double translationY() const
Returns the y-axis translation, in layer units.
double translationX() const
Returns the x-axis translation, in layer units.
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.
Abstract base class for annotation items which are drawn with QgsAnnotationLayers.
Encapsulates the transient results of an in-progress annotation edit operation.
void setSymbol(QgsMarkerSymbol *symbol)
Sets the symbol used to render the marker item.
@ Invalid
Operation has invalid parameters for the item, no change occurred.