QGIS API Documentation 3.99.0-Master (26c88405ac0)
Loading...
Searching...
No Matches
qgslegendpatchshape.h
Go to the documentation of this file.
1/***************************************************************************
2 qgslegendpatchshape.h
3 -------------------
4begin : April 2020
5copyright : (C) 2020 by Nyall Dawson
6email : 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.h"
21#include "qgis_core.h"
22#include "qgis_sip.h"
23#include "qgsgeometry.h"
24
26
33class CORE_EXPORT QgsLegendPatchShape
34{
35 public:
36
44
57 const QgsGeometry &geometry,
58 bool preserveAspectRatio = true );
59
64 bool isNull() const;
65
72
79
85 QgsGeometry geometry() const;
86
105 void setGeometry( const QgsGeometry &geometry );
106
113 bool preserveAspectRatio() const;
114
123 void setPreserveAspectRatio( bool preserve );
124
134 bool scaleToOutputSize() const;
135
145 void setScaleToOutputSize( bool scale );
146
154 QgsGeometry scaledGeometry( QSizeF size ) const;
155
161 QList< QList< QPolygonF > > toQPolygonF( Qgis::SymbolType type, QSizeF size ) const;
162
167 void readXml( const QDomElement &element, const QgsReadWriteContext &context );
168
173 void writeXml( QDomElement &element, QDomDocument &doc, const QgsReadWriteContext &context ) const;
174
175 private:
177 QgsGeometry mGeometry;
178 bool mPreserveAspectRatio = true;
179 bool mScaleToTargetSize = true;
180
181};
182
183#endif // QGSLEGENDPATCHSHAPE_H
SymbolType
Symbol types.
Definition qgis.h:610
@ Fill
Fill symbol.
Definition qgis.h:613
A geometry is the spatial representation of a feature.
bool scaleToOutputSize() const
Returns true if the patch shape should by resized to the desired target size when rendering.
void setSymbolType(Qgis::SymbolType type)
Sets the symbol type associated with this patch.
void readXml(const QDomElement &element, const QgsReadWriteContext &context)
Read settings from a DOM element.
QList< QList< QPolygonF > > toQPolygonF(Qgis::SymbolType type, QSizeF size) const
Converts the patch shape to a set of QPolygonF objects representing how the patch should be drawn for...
QgsGeometry scaledGeometry(QSizeF size) const
Returns the patch shape's geometry, scaled to the given size.
void setGeometry(const QgsGeometry &geometry)
Sets the geometry for the patch shape.
bool preserveAspectRatio() const
Returns true if the patch shape should preserve its aspect ratio when it is resized to fit a desired ...
bool isNull() const
Returns true if the patch shape is a null QgsLegendPatchShape, which indicates that the default legen...
QgsLegendPatchShape()=default
Constructor for a null QgsLegendPatchShape.
void setPreserveAspectRatio(bool preserve)
Sets whether the patch shape should preserve its aspect ratio when it is resized to fit a desired leg...
void writeXml(QDomElement &element, QDomDocument &doc, const QgsReadWriteContext &context) const
Write settings into a DOM element.
QgsGeometry geometry() const
Returns the geometry for the patch shape.
void setScaleToOutputSize(bool scale)
Sets whether the patch shape should by resized to the desired target size when rendering.
Qgis::SymbolType symbolType() const
Returns the symbol type associated with this patch.
A container for the context for various read/write operations on objects.