QGIS API Documentation  2.0.1-Dufour
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
QgsSVGFillSymbolLayer Class Reference

A class for svg fill patterns. More...

#include <qgsfillsymbollayerv2.h>

Inheritance diagram for QgsSVGFillSymbolLayer:
Inheritance graph
[legend]
Collaboration diagram for QgsSVGFillSymbolLayer:
Collaboration graph
[legend]

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 ()
QString layerType () const
void startRender (QgsSymbolV2RenderContext &context)
void stopRender (QgsSymbolV2RenderContext &context)
QgsStringMap properties () const
QgsSymbolLayerV2clone () const
void toSld (QDomDocument &doc, QDomElement &element, QgsStringMap props) const
void setSvgFilePath (const QString &svgPath)
QString svgFilePath () const
void setPatternWidth (double width)
double patternWidth () const
void setSvgFillColor (const QColor &c)
QColor svgFillColor () const
void setSvgOutlineColor (const QColor &c)
QColor svgOutlineColor () const
void setSvgOutlineWidth (double w)
double svgOutlineWidth () const
void setPatternWidthUnit (QgsSymbolV2::OutputUnit unit)
QgsSymbolV2::OutputUnit patternWidthUnit () const
void setSvgOutlineWidthUnit (QgsSymbolV2::OutputUnit unit)
QgsSymbolV2::OutputUnit svgOutlineWidthUnit () const
void setOutputUnit (QgsSymbolV2::OutputUnit unit)
QgsSymbolV2::OutputUnit outputUnit () const
- Public Member Functions inherited from QgsImageFillSymbolLayer
 QgsImageFillSymbolLayer ()
virtual ~QgsImageFillSymbolLayer ()
void renderPolygon (const QPolygonF &points, QList< QPolygonF > *rings, QgsSymbolV2RenderContext &context)
virtual QgsSymbolV2subSymbol ()
virtual bool setSubSymbol (QgsSymbolV2 *symbol)
void setOutlineWidthUnit (QgsSymbolV2::OutputUnit unit)
QgsSymbolV2::OutputUnit outlineWidthUnit () const
- Public Member Functions inherited from QgsFillSymbolLayerV2
void drawPreviewIcon (QgsSymbolV2RenderContext &context, QSize size)
void setAngle (double angle)
double angle () const
- Public Member Functions inherited from QgsSymbolLayerV2
virtual void setColor (const QColor &color)
virtual QColor color () const
virtual ~QgsSymbolLayerV2 ()
virtual QString ogrFeatureStyle (double mmScaleFactor, double mapUnitScaleFactor) const
QgsSymbolV2::SymbolType type () const
void setLocked (bool locked)
bool isLocked () const
void setRenderingPass (int renderingPass)
int renderingPass () const
virtual QSet< QString > usedAttributes () const
virtual const QgsExpressiondataDefinedProperty (const QString &property) const
virtual QString dataDefinedPropertyString (const QString &property) const
virtual void setDataDefinedProperty (const QString &property, const QString &expressionString)
virtual void removeDataDefinedProperty (const QString &property)
virtual void removeDataDefinedProperties ()

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)
QRectF mSvgViewBox
 SVG view box (to keep the aspect ratio.
QImage * mSvgPattern
 SVG pattern image.
QColor mSvgFillColor
QColor mSvgOutlineColor
double mSvgOutlineWidth
QgsSymbolV2::OutputUnit mSvgOutlineWidthUnit
- Protected Attributes inherited from QgsImageFillSymbolLayer
QBrush mBrush
double mNextAngle
double mOutlineWidth
 Outline width.
QgsSymbolV2::OutputUnit mOutlineWidthUnit
QgsLineSymbolV2mOutline
 Custom outline.
- Protected Attributes inherited from QgsFillSymbolLayerV2
double mAngle
- Protected Attributes inherited from QgsSymbolLayerV2
QgsSymbolV2::SymbolType mType
bool mLocked
QColor mColor
int mRenderingPass
QMap< QString, QgsExpression * > mDataDefinedProperties

Private Member Functions

void storeViewBox ()
 Helper function that gets the view box from the byte array.
void setDefaultSvgParams ()
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.

Additional Inherited Members

- Static Protected Attributes inherited from QgsSymbolLayerV2
static const bool selectionIsOpaque = true
static const bool selectFillBorder = false
static const bool selectFillStyle = false

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 135 of file qgsfillsymbollayerv2.h.

Constructor & Destructor Documentation

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

Definition at line 396 of file qgsfillsymbollayerv2.cpp.

References QgsImageFillSymbolLayer::mOutline, and mSvgPattern.

Member Function Documentation

void QgsSVGFillSymbolLayer::applyDataDefinedSettings ( const QgsSymbolV2RenderContext context)
protectedvirtual
void QgsSVGFillSymbolLayer::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 
)
private
QgsSymbolLayerV2 * QgsSVGFillSymbolLayer::clone ( ) const
virtual
QgsSymbolLayerV2 * QgsSVGFillSymbolLayer::create ( const QgsStringMap properties = QgsStringMap())
static
QgsSymbolLayerV2 * QgsSVGFillSymbolLayer::createFromSld ( QDomElement &  element)
static
QString QgsSVGFillSymbolLayer::layerType ( ) const
virtual

Implements QgsSymbolLayerV2.

Definition at line 508 of file qgsfillsymbollayerv2.cpp.

QgsSymbolV2::OutputUnit QgsSVGFillSymbolLayer::outputUnit ( ) const
virtual
double QgsSVGFillSymbolLayer::patternWidth ( ) const
inline

Definition at line 162 of file qgsfillsymbollayerv2.h.

QgsSymbolV2::OutputUnit QgsSVGFillSymbolLayer::patternWidthUnit ( ) const
inline

Definition at line 172 of file qgsfillsymbollayerv2.h.

Referenced by applyPattern().

QgsStringMap QgsSVGFillSymbolLayer::properties ( ) const
virtual
void QgsSVGFillSymbolLayer::setDefaultSvgParams ( )
private
void QgsSVGFillSymbolLayer::setOutputUnit ( QgsSymbolV2::OutputUnit  unit)
virtual
void QgsSVGFillSymbolLayer::setPatternWidth ( double  width)
inline

Definition at line 161 of file qgsfillsymbollayerv2.h.

void QgsSVGFillSymbolLayer::setPatternWidthUnit ( QgsSymbolV2::OutputUnit  unit)
inline

Definition at line 171 of file qgsfillsymbollayerv2.h.

Referenced by clone(), and create().

void QgsSVGFillSymbolLayer::setSvgFilePath ( const QString &  svgPath)
void QgsSVGFillSymbolLayer::setSvgFillColor ( const QColor &  c)
inline

Definition at line 164 of file qgsfillsymbollayerv2.h.

Referenced by clone(), create(), and createFromSld().

void QgsSVGFillSymbolLayer::setSvgOutlineColor ( const QColor &  c)
inline

Definition at line 166 of file qgsfillsymbollayerv2.h.

Referenced by clone(), create(), and createFromSld().

void QgsSVGFillSymbolLayer::setSvgOutlineWidth ( double  w)
inline

Definition at line 168 of file qgsfillsymbollayerv2.h.

Referenced by clone(), create(), and createFromSld().

void QgsSVGFillSymbolLayer::setSvgOutlineWidthUnit ( QgsSymbolV2::OutputUnit  unit)
inline

Definition at line 174 of file qgsfillsymbollayerv2.h.

Referenced by clone(), and create().

void QgsSVGFillSymbolLayer::startRender ( QgsSymbolV2RenderContext context)
virtual
void QgsSVGFillSymbolLayer::stopRender ( QgsSymbolV2RenderContext context)
virtual
void QgsSVGFillSymbolLayer::storeViewBox ( )
private

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

Definition at line 811 of file qgsfillsymbollayerv2.cpp.

References mSvgData, and mSvgViewBox.

Referenced by QgsSVGFillSymbolLayer(), and setSvgFilePath().

QString QgsSVGFillSymbolLayer::svgFilePath ( ) const
inline

Definition at line 160 of file qgsfillsymbollayerv2.h.

Referenced by create().

QColor QgsSVGFillSymbolLayer::svgFillColor ( ) const
inline

Definition at line 165 of file qgsfillsymbollayerv2.h.

Referenced by applyDataDefinedSettings().

QColor QgsSVGFillSymbolLayer::svgOutlineColor ( ) const
inline

Definition at line 167 of file qgsfillsymbollayerv2.h.

Referenced by applyDataDefinedSettings().

double QgsSVGFillSymbolLayer::svgOutlineWidth ( ) const
inline

Definition at line 169 of file qgsfillsymbollayerv2.h.

QgsSymbolV2::OutputUnit QgsSVGFillSymbolLayer::svgOutlineWidthUnit ( ) const
inline

Definition at line 175 of file qgsfillsymbollayerv2.h.

Referenced by applyPattern().

void QgsSVGFillSymbolLayer::toSld ( QDomDocument &  doc,
QDomElement &  element,
QgsStringMap  props 
) const
virtual

Member Data Documentation

double QgsSVGFillSymbolLayer::mPatternWidth
protected

Width of the pattern (in output units)

Definition at line 182 of file qgsfillsymbollayerv2.h.

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

QgsSymbolV2::OutputUnit QgsSVGFillSymbolLayer::mPatternWidthUnit
protected
QByteArray QgsSVGFillSymbolLayer::mSvgData
protected

SVG data.

Definition at line 186 of file qgsfillsymbollayerv2.h.

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

QString QgsSVGFillSymbolLayer::mSvgFilePath
protected

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

Definition at line 188 of file qgsfillsymbollayerv2.h.

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

QColor QgsSVGFillSymbolLayer::mSvgFillColor
protected
QColor QgsSVGFillSymbolLayer::mSvgOutlineColor
protected
double QgsSVGFillSymbolLayer::mSvgOutlineWidth
protected
QgsSymbolV2::OutputUnit QgsSVGFillSymbolLayer::mSvgOutlineWidthUnit
protected
QImage* QgsSVGFillSymbolLayer::mSvgPattern
protected

SVG pattern image.

Note
added in 1.9

Definition at line 193 of file qgsfillsymbollayerv2.h.

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

QRectF QgsSVGFillSymbolLayer::mSvgViewBox
protected

SVG view box (to keep the aspect ratio.

Definition at line 190 of file qgsfillsymbollayerv2.h.

Referenced by applyPattern(), and storeViewBox().


The documentation for this class was generated from the following files: