QGIS API Documentation  2.2.0-Valmiera
 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
virtual double estimateMaxBleed () const
 Returns the estimated maximum distance which the layer style will bleed outside the drawn shape.
virtual double dxfWidth (const QgsDxfExport &e, const QgsSymbolV2RenderContext &context) const
virtual QColor dxfColor (const QgsSymbolV2RenderContext &context) const
virtual Qt::PenStyle dxfPenStyle () 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 QColor color () const
virtual void setColor (const QColor &color)
virtual void setOutlineColor (const QColor &color)
 Set outline color.
virtual QColor outlineColor () const
 Get outline color.
virtual void setFillColor (const QColor &color)
 Set fill color.
virtual QColor fillColor () const
 Get fill color.
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 ()
bool hasDataDefinedProperties () const
virtual bool writeDxf (QgsDxfExport &e, double mmMapUnitScaleFactor, const QString &layerName, const QgsSymbolV2RenderContext *context, const QgsFeature *f, const QPointF &shift=QPointF(0.0, 0.0)) const
virtual QVector< qreal > dxfCustomDashPattern (QgsSymbolV2::OutputUnit &unit) 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)
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 310 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 942 of file qgsfillsymbollayerv2.cpp.

References 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 1053 of file qgsfillsymbollayerv2.cpp.

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

Definition at line 337 of file qgsfillsymbollayerv2.h.

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

Definition at line 347 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 336 of file qgsfillsymbollayerv2.h.

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

Definition at line 346 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 339 of file qgsfillsymbollayerv2.h.

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

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

Definition at line 341 of file qgsfillsymbollayerv2.h.

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

void QgsSVGFillSymbolLayer::setSvgOutlineWidth ( double  w)
inline

Definition at line 343 of file qgsfillsymbollayerv2.h.

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

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

Definition at line 349 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 1356 of file qgsfillsymbollayerv2.cpp.

References mSvgData, and mSvgViewBox.

Referenced by QgsSVGFillSymbolLayer(), and setSvgFilePath().

QString QgsSVGFillSymbolLayer::svgFilePath ( ) const
inline

Definition at line 335 of file qgsfillsymbollayerv2.h.

Referenced by create().

QColor QgsSVGFillSymbolLayer::svgFillColor ( ) const
inline

Definition at line 340 of file qgsfillsymbollayerv2.h.

Referenced by applyDataDefinedSettings().

QColor QgsSVGFillSymbolLayer::svgOutlineColor ( ) const
inline

Definition at line 342 of file qgsfillsymbollayerv2.h.

Referenced by applyDataDefinedSettings().

double QgsSVGFillSymbolLayer::svgOutlineWidth ( ) const
inline

Definition at line 344 of file qgsfillsymbollayerv2.h.

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

Definition at line 350 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 357 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 361 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 363 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 368 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 365 of file qgsfillsymbollayerv2.h.

Referenced by applyPattern(), and storeViewBox().


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