QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
layertree
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.h
"
21
#include "qgis_core.h"
22
#include "
qgis_sip.h
"
23
#include "
qgsgeometry.h
"
24
25
class
QgsReadWriteContext
;
26
33
class
CORE_EXPORT
QgsLegendPatchShape
34
{
35
public
:
42
QgsLegendPatchShape
() =
default
;
43
55
QgsLegendPatchShape
(
Qgis::SymbolType
type,
const
QgsGeometry
&
geometry
,
bool
preserveAspectRatio
=
true
);
56
61
bool
isNull
()
const
;
62
68
Qgis::SymbolType
symbolType
()
const
;
69
75
void
setSymbolType
(
Qgis::SymbolType
type );
76
82
QgsGeometry
geometry
()
const
;
83
102
void
setGeometry
(
const
QgsGeometry
&
geometry
);
103
110
bool
preserveAspectRatio
()
const
;
111
120
void
setPreserveAspectRatio
(
bool
preserve );
121
131
bool
scaleToOutputSize
()
const
;
132
142
void
setScaleToOutputSize
(
bool
scale );
143
151
QgsGeometry
scaledGeometry
( QSizeF size )
const
;
152
158
QList< QList< QPolygonF > >
toQPolygonF
(
Qgis::SymbolType
type, QSizeF size )
const
;
159
164
void
readXml
(
const
QDomElement &element,
const
QgsReadWriteContext
&context );
165
170
void
writeXml
( QDomElement &element, QDomDocument &doc,
const
QgsReadWriteContext
&context )
const
;
171
172
private
:
173
Qgis::SymbolType
mSymbolType =
Qgis::SymbolType::Fill
;
174
QgsGeometry
mGeometry;
175
bool
mPreserveAspectRatio =
true
;
176
bool
mScaleToTargetSize =
true
;
177
};
178
179
#endif
// QGSLEGENDPATCHSHAPE_H
Qgis::SymbolType
SymbolType
Symbol types.
Definition
qgis.h:671
Qgis::SymbolType::Fill
@ Fill
Fill symbol.
Definition
qgis.h:674
QgsGeometry
A geometry is the spatial representation of a feature.
Definition
qgsgeometry.h:267
QgsLegendPatchShape::scaleToOutputSize
bool scaleToOutputSize() const
Returns true if the patch shape should by resized to the desired target size when rendering.
Definition
qgslegendpatchshape.cpp:57
QgsLegendPatchShape::setSymbolType
void setSymbolType(Qgis::SymbolType type)
Sets the symbol type associated with this patch.
Definition
qgslegendpatchshape.cpp:148
QgsLegendPatchShape::readXml
void readXml(const QDomElement &element, const QgsReadWriteContext &context)
Read settings from a DOM element.
Definition
qgslegendpatchshape.cpp:129
QgsLegendPatchShape::toQPolygonF
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...
Definition
qgslegendpatchshape.cpp:113
QgsLegendPatchShape::scaledGeometry
QgsGeometry scaledGeometry(QSizeF size) const
Returns the patch shape's geometry, scaled to the given size.
Definition
qgslegendpatchshape.cpp:67
QgsLegendPatchShape::setGeometry
void setGeometry(const QgsGeometry &geometry)
Sets the geometry for the patch shape.
Definition
qgslegendpatchshape.cpp:42
QgsLegendPatchShape::preserveAspectRatio
bool preserveAspectRatio() const
Returns true if the patch shape should preserve its aspect ratio when it is resized to fit a desired ...
Definition
qgslegendpatchshape.cpp:47
QgsLegendPatchShape::isNull
bool isNull() const
Returns true if the patch shape is a null QgsLegendPatchShape, which indicates that the default legen...
Definition
qgslegendpatchshape.cpp:32
QgsLegendPatchShape::QgsLegendPatchShape
QgsLegendPatchShape()=default
Constructor for a null QgsLegendPatchShape.
QgsLegendPatchShape::setPreserveAspectRatio
void setPreserveAspectRatio(bool preserve)
Sets whether the patch shape should preserve its aspect ratio when it is resized to fit a desired leg...
Definition
qgslegendpatchshape.cpp:52
QgsLegendPatchShape::writeXml
void writeXml(QDomElement &element, QDomDocument &doc, const QgsReadWriteContext &context) const
Write settings into a DOM element.
Definition
qgslegendpatchshape.cpp:136
QgsLegendPatchShape::geometry
QgsGeometry geometry() const
Returns the geometry for the patch shape.
Definition
qgslegendpatchshape.cpp:37
QgsLegendPatchShape::setScaleToOutputSize
void setScaleToOutputSize(bool scale)
Sets whether the patch shape should by resized to the desired target size when rendering.
Definition
qgslegendpatchshape.cpp:62
QgsLegendPatchShape::symbolType
Qgis::SymbolType symbolType() const
Returns the symbol type associated with this patch.
Definition
qgslegendpatchshape.cpp:143
QgsReadWriteContext
A container for the context for various read/write operations on objects.
Definition
qgsreadwritecontext.h:38
qgis.h
qgis_sip.h
qgsgeometry.h
Generated on
for QGIS API Documentation by
1.17.0