QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
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"
21 #include "qgslayoutitemnodeitem.h"
22 
23 class QgsFillSymbol;
24 
30 class CORE_EXPORT QgsLayoutItemPolygon: public QgsLayoutNodesItem
31 {
32  Q_OBJECT
33 
34  public:
35 
40 
45  QgsLayoutItemPolygon( const QPolygonF &polygon, QgsLayout *layout );
46 
47  ~QgsLayoutItemPolygon() override;
48 
54  static QgsLayoutItemPolygon *create( QgsLayout *layout ) SIP_FACTORY;
55 
56  int type() const override;
57  QIcon icon() const override;
58  QString displayName() const override;
59  bool accept( QgsStyleEntityVisitorInterface *visitor ) const override;
60  QgsLayoutItem::Flags itemFlags() const override;
61  QgsGeometry clipPath() const override;
62 
67  QgsFillSymbol *symbol();
68 
74  void setSymbol( QgsFillSymbol *symbol );
75 
76  protected:
77  bool _addNode( int indexPoint, QPointF newPoint, double radius ) override;
78  bool _removeNode( int nodeIndex ) override;
79  void _draw( QgsLayoutItemRenderContext &context, const QStyleOptionGraphicsItem *itemStyle = nullptr ) override;
80  void _readXmlStyle( const QDomElement &elmt, const QgsReadWriteContext &context ) override;
81  void _writeXmlStyle( QDomDocument &doc, QDomElement &elmt, const QgsReadWriteContext &context ) const override;
82 
83  private:
84 
86  std::unique_ptr<QgsFillSymbol> mPolygonStyleSymbol;
88  void createDefaultPolygonStyleSymbol();
89 
94  void refreshSymbol();
95 };
96 
97 #endif // QGSLAYOUTITEMPOLYGON_H
QgsReadWriteContext
The class is used as a container of context for various read/write operations on other objects.
Definition: qgsreadwritecontext.h:34
QgsLayoutItem::icon
virtual QIcon icon() const
Returns the item's icon.
Definition: qgslayoutitem.h:336
QgsLayoutItemRenderContext
Contains settings and helpers relating to a render of a QgsLayoutItem.
Definition: qgslayoutitem.h:44
QgsLayoutNodesItem::_removeNode
virtual bool _removeNode(int nodeIndex)=0
Method called in removeNode.
QgsStyleEntityVisitorInterface
An interface for classes which can visit style entity (e.g. symbol) nodes (using the visitor pattern)...
Definition: qgsstyleentityvisitor.h:33
qgslayoutitemnodeitem.h
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
QgsLayoutItem::type
int type() const override
Returns a unique graphics item type identifier.
Definition: qgslayoutitem.cpp:124
QgsLayoutNodesItem::_draw
virtual void _draw(QgsLayoutItemRenderContext &context, const QStyleOptionGraphicsItem *itemStyle=nullptr)=0
Method called in paint.
QgsLayoutItem::clipPath
virtual QgsGeometry clipPath() const
Returns the clipping path generated by this item, in layout coordinates.
Definition: qgslayoutitem.cpp:1172
QgsLayoutItem::accept
virtual bool accept(QgsStyleEntityVisitorInterface *visitor) const
Accepts the specified style entity visitor, causing it to visit all style entities associated with th...
Definition: qgslayoutitem.cpp:1166
QgsLayoutNodesItem::_readXmlStyle
virtual void _readXmlStyle(const QDomElement &elmt, const QgsReadWriteContext &context)=0
Method called in readXml.
QgsLayoutItem::itemFlags
virtual Flags itemFlags() const
Returns the item's flags, which indicate how the item behaves.
Definition: qgslayoutitem.cpp:129
QgsGeometry
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:124
QgsLayout
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
Definition: qgslayout.h:50
QgsLayoutNodesItem
An abstract layout item that provides generic methods for node based shapes such as polygon or polyli...
Definition: qgslayoutitemnodeitem.h:29
QgsLayoutItem::displayName
virtual QString displayName() const
Gets item display name.
Definition: qgslayoutitem.cpp:107
QgsFillSymbol
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
Definition: qgsfillsymbol.h:29
QgsLayoutItemPolygon
Layout item for node based polygon shapes.
Definition: qgslayoutitempolygon.h:30
QgsLayoutNodesItem::_writeXmlStyle
virtual void _writeXmlStyle(QDomDocument &doc, QDomElement &elmt, const QgsReadWriteContext &context) const =0
Method called in writeXml.
QgsLayoutNodesItem::_addNode
virtual bool _addNode(int nodeIndex, QPointF newNode, double radius)=0
Method called in addNode.