QGIS API Documentation 4.0.0-Norrköping (1ddcee3d0e4)
Loading...
Searching...
No Matches
qgslayoutitempolygon.h
Go to the documentation of this file.
1/***************************************************************************
2 qgslayoutitempolygon.h
3 begin : March 2016
4 copyright : (C) 2016 Paul Blottiere, Oslandia
5 email : paul dot blottiere at oslandia dot com
6 ***************************************************************************/
7
8/***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17#ifndef QGSLAYOUTITEMPOLYGON_H
18#define QGSLAYOUTITEMPOLYGON_H
19
20#include "qgis_core.h"
22
23class QgsFillSymbol;
24
29class CORE_EXPORT QgsLayoutItemPolygon : public QgsLayoutNodesItem
30{
31 Q_OBJECT
32
33 public:
38
43 QgsLayoutItemPolygon( const QPolygonF &polygon, QgsLayout *layout );
44
46
53
54 int type() const override;
55 QIcon icon() const override;
56 QString displayName() const override;
57 bool accept( QgsStyleEntityVisitorInterface *visitor ) const override;
58 QgsLayoutItem::Flags itemFlags() const override;
59 QgsGeometry clipPath() const override;
60 bool isValid() const override;
61
67
74
75 protected:
76 bool _addNode( int indexPoint, QPointF newPoint, double radius ) override;
77 bool _removeNode( int nodeIndex ) override;
78 void _draw( QgsLayoutItemRenderContext &context, const QStyleOptionGraphicsItem *itemStyle = nullptr ) override;
79 void _readXmlStyle( const QDomElement &elmt, const QgsReadWriteContext &context ) override;
80 void _writeXmlStyle( QDomDocument &doc, QDomElement &elmt, const QgsReadWriteContext &context ) const override;
81
82 private:
84 std::unique_ptr<QgsFillSymbol> mPolygonStyleSymbol;
86 void createDefaultPolygonStyleSymbol();
87
92 void refreshSymbol();
93};
94
95#endif // QGSLAYOUTITEMPOLYGON_H
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
A geometry is the spatial representation of a feature.
static QgsLayoutItemPolygon * create(QgsLayout *layout)
Returns a new polygon item for the specified layout.
QgsLayoutItemPolygon(QgsLayout *layout)
Constructor for QgsLayoutItemPolygon for the specified layout.
void setSymbol(QgsFillSymbol *symbol)
Sets the symbol used to draw the shape.
QgsFillSymbol * symbol()
Returns the fill symbol used to draw the shape.
~QgsLayoutItemPolygon() override
Contains settings and helpers relating to a render of a QgsLayoutItem.
friend class QgsLayout
virtual QgsGeometry clipPath() const
Returns the clipping path generated by this item, in layout coordinates.
virtual bool accept(QgsStyleEntityVisitorInterface *visitor) const
Accepts the specified style entity visitor, causing it to visit all style entities associated with th...
virtual QIcon icon() const
Returns the item's icon.
int type() const override
Returns a unique graphics item type identifier.
virtual QString displayName() const
Gets item display name.
QFlags< Flag > Flags
QgsLayoutItem::Flags itemFlags() const override
Returns the item's flags, which indicate how the item behaves.
virtual bool _removeNode(int nodeIndex)=0
Method called in removeNode.
virtual void _writeXmlStyle(QDomDocument &doc, QDomElement &elmt, const QgsReadWriteContext &context) const =0
Method called in writeXml.
virtual void _readXmlStyle(const QDomElement &elmt, const QgsReadWriteContext &context)=0
Method called in readXml.
virtual bool isValid() const =0
Must be reimplemented in subclasses.
virtual void _draw(QgsLayoutItemRenderContext &context, const QStyleOptionGraphicsItem *itemStyle=nullptr)=0
Method called in paint.
QgsLayoutNodesItem(QgsLayout *layout)
Constructor for QgsLayoutNodesItem, attached to the specified layout.
virtual bool _addNode(int nodeIndex, QPointF newNode, double radius)=0
Method called in addNode.
const QgsLayout * layout() const
Returns the layout the object is attached to.
A container for the context for various read/write operations on objects.
An interface for classes which can visit style entity (e.g.
#define SIP_FACTORY
Definition qgis_sip.h:83