QGIS API Documentation  master-59fd5e0
QgsSVGFillSymbolLayer Class Reference

A class for svg fill patterns. More...

#include <qgsfillsymbollayerv2.h>

+ Inheritance diagram for QgsSVGFillSymbolLayer:
+ Collaboration diagram for QgsSVGFillSymbolLayer:

List of all members.

Public Member Functions

 QgsSVGFillSymbolLayer (const QString &svgFilePath="", double width=20, double rotation=0.0)
 QgsSVGFillSymbolLayer (const QByteArray &svgData, double width=20, double rotation=0.0)
 ~QgsSVGFillSymbolLayer ()
QgsSymbolLayerV2clone () const
QString layerType () const
QgsSymbolV2::OutputUnit outputUnit () const
double patternWidth () const
QgsSymbolV2::OutputUnit patternWidthUnit () const
QgsStringMap properties () const
void setOutputUnit (QgsSymbolV2::OutputUnit unit)
void setPatternWidth (double width)
void setPatternWidthUnit (QgsSymbolV2::OutputUnit unit)
void setSvgFilePath (const QString &svgPath)
void setSvgFillColor (const QColor &c)
void setSvgOutlineColor (const QColor &c)
void setSvgOutlineWidth (double w)
void setSvgOutlineWidthUnit (QgsSymbolV2::OutputUnit unit)
void startRender (QgsSymbolV2RenderContext &context)
void stopRender (QgsSymbolV2RenderContext &context)
QString svgFilePath () const
QColor svgFillColor () const
QColor svgOutlineColor () const
double svgOutlineWidth () const
QgsSymbolV2::OutputUnit svgOutlineWidthUnit () const
void toSld (QDomDocument &doc, QDomElement &element, QgsStringMap props) const

Static Public Member Functions

static QgsSymbolLayerV2create (const QgsStringMap &properties=QgsStringMap())
static QgsSymbolLayerV2createFromSld (QDomElement &element)

Protected Member Functions

void applyDataDefinedSettings (const QgsSymbolV2RenderContext &context)

Protected Attributes

double mPatternWidth
 Width of the pattern (in output units)
QgsSymbolV2::OutputUnit mPatternWidthUnit
QByteArray mSvgData
 SVG data.
QString mSvgFilePath
 Path to the svg file (or empty if constructed directly from data)
QColor mSvgFillColor
QColor mSvgOutlineColor
double mSvgOutlineWidth
QgsSymbolV2::OutputUnit mSvgOutlineWidthUnit
QImage * mSvgPattern
 SVG pattern image.
QRectF mSvgViewBox
 SVG view box (to keep the aspect ratio.

Private Member Functions

void applyPattern (QBrush &brush, const QString &svgFilePath, double patternWidth, QgsSymbolV2::OutputUnit patternWidthUnit, const QColor &svgFillColor, const QColor &svgOutlineColor, double svgOutlineWidth, QgsSymbolV2::OutputUnit svgOutlineWidthUnit, const QgsSymbolV2RenderContext &context)
 Applies the svg pattern to the brush.
void setDefaultSvgParams ()
void storeViewBox ()
 Helper function that gets the view box from the byte array.

Detailed Description

A class for svg fill patterns.

The class automatically scales the pattern to the appropriate pixel dimensions of the output device

Definition at line 134 of file qgsfillsymbollayerv2.h.


Constructor & Destructor Documentation

QgsSVGFillSymbolLayer::QgsSVGFillSymbolLayer ( const QString &  svgFilePath = "",
double  width = 20,
double  rotation = 0.0 
)

Member Function Documentation

QString QgsSVGFillSymbolLayer::layerType ( ) const [virtual]

Implements QgsSymbolLayerV2.

Definition at line 507 of file qgsfillsymbollayerv2.cpp.

double QgsSVGFillSymbolLayer::patternWidth ( ) const [inline]

Definition at line 161 of file qgsfillsymbollayerv2.h.

Referenced by QgsSVGFillSymbolLayerWidget::setSymbolLayer().

Helper function that gets the view box from the byte array.

Definition at line 804 of file qgsfillsymbollayerv2.cpp.

References mSvgData, and mSvgViewBox.

Referenced by QgsSVGFillSymbolLayer(), and setSvgFilePath().

QString QgsSVGFillSymbolLayer::svgFilePath ( ) const [inline]

Definition at line 159 of file qgsfillsymbollayerv2.h.

Referenced by create(), and QgsSVGFillSymbolLayerWidget::setSymbolLayer().

QColor QgsSVGFillSymbolLayer::svgFillColor ( ) const [inline]

Definition at line 164 of file qgsfillsymbollayerv2.h.

Referenced by applyDataDefinedSettings().

QColor QgsSVGFillSymbolLayer::svgOutlineColor ( ) const [inline]

Definition at line 166 of file qgsfillsymbollayerv2.h.

Referenced by applyDataDefinedSettings().

double QgsSVGFillSymbolLayer::svgOutlineWidth ( ) const [inline]

Definition at line 168 of file qgsfillsymbollayerv2.h.


Member Data Documentation

Width of the pattern (in output units)

Definition at line 181 of file qgsfillsymbollayerv2.h.

Referenced by applyDataDefinedSettings(), clone(), properties(), startRender(), and toSld().

QByteArray QgsSVGFillSymbolLayer::mSvgData [protected]

SVG data.

Definition at line 185 of file qgsfillsymbollayerv2.h.

Referenced by clone(), properties(), setSvgFilePath(), and storeViewBox().

Path to the svg file (or empty if constructed directly from data)

Definition at line 187 of file qgsfillsymbollayerv2.h.

Referenced by applyDataDefinedSettings(), clone(), properties(), setDefaultSvgParams(), setSvgFilePath(), startRender(), and toSld().

SVG pattern image.

Note:
added in 1.9

Definition at line 192 of file qgsfillsymbollayerv2.h.

Referenced by applyPattern(), QgsSVGFillSymbolLayer(), and ~QgsSVGFillSymbolLayer().

SVG view box (to keep the aspect ratio.

Definition at line 189 of file qgsfillsymbollayerv2.h.

Referenced by applyPattern(), and storeViewBox().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines