QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
Go to the documentation of this file.
17 #ifndef QGSLAYOUTITEMNODEITEM_H
18 #define QGSLAYOUTITEMNODEITEM_H
20 #include "qgis_core.h"
39 void setNodes(
const QPolygonF &nodes );
45 QPolygonF
nodes()
const {
return mPolygon; }
55 bool addNode( QPointF point,
bool checkArea =
true,
double radius = 10 );
67 bool moveNode(
int index, QPointF node );
77 int nodeAtPosition( QPointF point,
bool searchInRadius =
true,
double radius = 10 )
const;
85 bool nodePosition(
int index, QPointF &position )
const;
90 bool removeNode(
int index );
98 bool setSelectedNode(
int index );
111 QRectF boundingRect()
const override;
138 double mMaxSymbolBleed = 0.0;
141 virtual bool _addNode(
int nodeIndex, QPointF newNode,
double radius ) = 0;
159 void rescaleToFitBoundingBox();
162 double computeDistance( QPointF pt1, QPointF pt2 )
const;
165 void updateSceneRect();
176 virtual void updateBoundingRect();
183 int mSelectedNode = -1;
189 bool mDrawNodes =
false;
197 #endif // QGSLAYOUTITEMNODEITEM_H
virtual bool writePropertiesToElement(QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context) const
Stores item state within an XML DOM element.
The class is used as a container of context for various read/write operations on other objects.
Contains settings and helpers relating to a render of a QgsLayoutItem.
virtual bool _removeNode(int nodeIndex)=0
Method called in removeNode.
QRectF mCurrentRectangle
Current bounding rectangle of shape.
virtual bool readPropertiesFromElement(const QDomElement &element, const QDomDocument &document, const QgsReadWriteContext &context)
Sets item state from a DOM element.
virtual void draw(QgsLayoutItemRenderContext &context)=0
Draws the item's contents using the specified item render context.
QPolygonF mPolygon
Shape's nodes.
virtual void _draw(QgsLayoutItemRenderContext &context, const QStyleOptionGraphicsItem *itemStyle=nullptr)=0
Method called in paint.
virtual double estimatedFrameBleed() const
Returns the estimated amount the item's frame bleeds outside the item's actual rectangle.
int selectedNode() const
Returns the currently selected node, or -1 if no node is selected.
QPolygonF nodes() const
Returns the nodes the shape consists of.
Base class for graphical items within a QgsLayout.
void setDisplayNodes(bool display=true)
Set whether the item's nodes should be displayed.
virtual void _readXmlStyle(const QDomElement &elmt, const QgsReadWriteContext &context)=0
Method called in readXml.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
An abstract layout item that provides generic methods for node based shapes such as polygon or polyli...
int nodesSize() const
Returns the number of nodes in the shape.
virtual void _writeXmlStyle(QDomDocument &doc, QDomElement &elmt, const QgsReadWriteContext &context) const =0
Method called in writeXml.
virtual bool _addNode(int nodeIndex, QPointF newNode, double radius)=0
Method called in addNode.
void deselectNode()
Deselects any selected nodes.