| 
    QGIS API Documentation
    3.26.3-Buenos Aires (65e4edfdad)
    
   | 
 
 
 
 
Go to the documentation of this file.
   37   return QStringLiteral( 
"linestring" );
 
   42   QPolygonF pts = mCurve->asQPolygonF();
 
   58   pts.erase( std::remove_if( pts.begin(), pts.end(),
 
   59                              []( 
const QPointF point )
 
   61     return !std::isfinite( point.x() ) || !std::isfinite( point.y() );
 
   64   QPointF *ptr = pts.data();
 
   65   for ( 
int i = 0; i < pts.size(); ++i, ++ptr )
 
   70   mSymbol->startRender( context );
 
   71   mSymbol->renderPolyline( pts, 
nullptr, context );
 
   72   mSymbol->stopRender( context );
 
   77   element.setAttribute( QStringLiteral( 
"wkt" ), mCurve->asWkt() );
 
   86   QList< QgsAnnotationItemNode > res;
 
   88   for ( 
auto it = mCurve->vertices_begin(); it != mCurve->vertices_end(); ++it, ++i )
 
   97   switch ( operation->
type() )
 
  110       if ( mCurve->deleteVertex( deleteOperation->
nodeId() ) )
 
  121       mCurve->closestSegment( addOperation->
point(), segmentPoint, endOfSegmentVertex );
 
  122       if ( mCurve->insertVertex( endOfSegmentVertex, segmentPoint ) )
 
  130       const QTransform transform = QTransform::fromTranslate( moveOperation->
translationX(), moveOperation->
translationY() );
 
  131       mCurve->transform( transform );
 
  141   switch ( operation->
type() )
 
  146       std::unique_ptr< QgsCurve > modifiedCurve( mCurve->clone() );
 
  147       if ( modifiedCurve->moveVertex( moveOperation->
nodeId(), 
QgsPoint( moveOperation->
after() ) ) )
 
  157       const QTransform transform = QTransform::fromTranslate( moveOperation->
translationX(), moveOperation->
translationY() );
 
  158       std::unique_ptr< QgsCurve > modifiedCurve( mCurve->clone() );
 
  159       modifiedCurve->transform( transform );
 
  177   const QString wkt = element.attribute( QStringLiteral( 
"wkt" ) );
 
  179   if ( 
const QgsCurve *curve = qgsgeometry_cast< const QgsCurve * >( 
geometry.constGet() ) )
 
  180     mCurve.reset( curve->clone() );
 
  182   const QDomElement symbolElem = element.firstChildElement( QStringLiteral( 
"symbol" ) );
 
  183   if ( !symbolElem.isNull() )
 
  184     setSymbol( QgsSymbolLayerUtils::loadSymbol< QgsLineSymbol >( symbolElem, context ) );
 
  193   return mCurve->boundingBox();
 
  198   std::unique_ptr< QgsAnnotationLineItem > item = std::make_unique< QgsAnnotationLineItem >( mCurve->clone() );
 
  199   item->setSymbol( mSymbol->clone() );
 
  200   item->copyCommonProperties( 
this );
 
  201   return item.release();
 
  206   return mSymbol.get();
 
  
Abstract base class for curved geometry type.
 
@ 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.
 
void render(QgsRenderContext &context, QgsFeedback *feedback) override
Renders the item to the specified render context.
 
Annotation item edit operation consisting of translating (moving) an item.
 
Annotation item edit operation consisting of deleting a node.
 
QgsRectangle boundingBox() const override
Returns the bounding box of the item's geographic location, in the parent layer's coordinate referenc...
 
static QgsGeometry fromWkt(const QString &wkt)
Creates a new geometry from a WKT string.
 
virtual Type type() const =0
Returns the operation type.
 
Contains information about the context of a rendering operation.
 
Line string geometry type, with support for z-dimension and m-values.
 
A rectangle specified with double values.
 
QgsAnnotationLineItem * clone() override
Returns a clone of the item.
 
QgsPoint point() const
Returns the node position (in layer coordinates).
 
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...
 
QgsCoordinateTransform coordinateTransform() const
Returns the current coordinate transform for the context.
 
QgsVertexId nodeId() const
Returns the associated node ID.
 
QgsAnnotationItemEditOperationTransientResults * transientEditResults(QgsAbstractAnnotationItemEditOperation *operation) override
Retrieves the results of a transient (in progress) edit operation on the item.
 
Custom exception class for Coordinate Reference System related exceptions.
 
bool readXml(const QDomElement &element, const QgsReadWriteContext &context) override
Reads the item's state from the given DOM element.
 
QString type() const override
Returns a unique (untranslated) string identifying the type of item.
 
@ TranslateItem
Translate (move) an item.
 
Base class for feedback objects to be used for cancellation of something running in a worker thread.
 
const QgsLineSymbol * symbol() const
Returns the symbol used to render the item.
 
bool writeCommonProperties(QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context) const
Writes common properties from the base class into an XML element.
 
A line symbol type, for rendering LineString and MultiLineString geometries.
 
bool readCommonProperties(const QDomElement &element, const QgsReadWriteContext &context)
Reads common properties from the base class from the given DOM element.
 
QgsVertexId nodeId() const
Returns the deleted node ID.
 
Annotation item edit operation consisting of moving a node.
 
Abstract base class for annotation item edit operations.
 
const QgsCurve * geometry() const
Returns the geometry of the item.
 
A class to represent a 2D point.
 
QgsPoint after() const
Returns the node position after the move occurred (in layer coordinates).
 
QList< QgsAnnotationItemNode > nodes() const override
Returns the nodes for the item, used for editing the item.
 
@ 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.
 
Contains information about a node used for editing an annotation item.
 
A geometry is the spatial representation of a feature.
 
void setSymbol(QgsLineSymbol *symbol)
Sets the symbol used to render the marker item.
 
Utility class for identifying a unique vertex within a geometry.
 
Qgis::AnnotationItemEditOperationResult applyEdit(QgsAbstractAnnotationItemEditOperation *operation) override
Applies an edit operation to the item.
 
~QgsAnnotationLineItem() override
 
An annotation item which renders a line symbol along a line geometry.
 
bool writeXml(QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context) const override
Writes the item's state into an XML element.
 
QgsAnnotationLineItem(QgsCurve *curve)
Constructor for QgsAnnotationLineItem, with the specified linestring.
 
static QgsAnnotationLineItem * create()
Creates a new linestring annotation item.
 
Annotation item edit operation consisting of adding a node.
 
double translationY() const
Returns the y-axis translation, in layer units.
 
double translationX() const
Returns the x-axis translation, in layer units.
 
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.
 
@ Invalid
Operation has invalid parameters for the item, no change occurred.