QGIS API Documentation  3.20.0-Odense (decaadbb31)
qgslegendpatchshape.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgslegendpatchshape.h
3  -------------------
4 begin : April 2020
5 copyright : (C) 2020 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 #ifndef QGSLEGENDPATCHSHAPE_H
18 #define QGSLEGENDPATCHSHAPE_H
19 
20 #include "qgis_core.h"
21 #include "qgis_sip.h"
22 #include "qgis.h"
23 #include "qgsgeometry.h"
24 
31 class CORE_EXPORT QgsLegendPatchShape
32 {
33  public:
34 
41  QgsLegendPatchShape() = default;
42 
55  const QgsGeometry &geometry,
56  bool preserveAspectRatio = true );
57 
62  bool isNull() const;
63 
69  Qgis::SymbolType symbolType() const;
70 
76  void setSymbolType( Qgis::SymbolType type );
77 
83  QgsGeometry geometry() const;
84 
103  void setGeometry( const QgsGeometry &geometry );
104 
111  bool preserveAspectRatio() const;
112 
121  void setPreserveAspectRatio( bool preserve );
122 
128  QList< QList< QPolygonF > > toQPolygonF( Qgis::SymbolType type, QSizeF size ) const;
129 
134  void readXml( const QDomElement &element, const QgsReadWriteContext &context );
135 
140  void writeXml( QDomElement &element, QDomDocument &doc, const QgsReadWriteContext &context ) const;
141 
142  private:
144  QgsGeometry mGeometry;
145  bool mPreserveAspectRatio = true;
146 
147 };
148 
149 #endif // QGSLEGENDPATCHSHAPE_H
SymbolType
Symbol types.
Definition: qgis.h:168
@ Fill
Fill symbol.
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:124
Represents a patch shape for use in map legends.
QgsLegendPatchShape()=default
Constructor for a null QgsLegendPatchShape.
The class is used as a container of context for various read/write operations on other objects.