QGIS API Documentation  2.5.0-Master
 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
Collaboration diagram for QgsSVGFillSymbolLayer:
Collaboration graph

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 setPatternWidthMapUnitScale (const QgsMapUnitScale &scale)
const QgsMapUnitScalepatternWidthMapUnitScale () const
void setSvgOutlineWidthUnit (QgsSymbolV2::OutputUnit unit)
QgsSymbolV2::OutputUnit svgOutlineWidthUnit () const
void setSvgOutlineWidthMapUnitScale (const QgsMapUnitScale &scale)
const QgsMapUnitScalesvgOutlineWidthMapUnitScale () const
void setOutputUnit (QgsSymbolV2::OutputUnit unit)
QgsSymbolV2::OutputUnit outputUnit () const
void setMapUnitScale (const QgsMapUnitScale &scale)
QgsMapUnitScale mapUnitScale () 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
void setOutlineWidthMapUnitScale (const QgsMapUnitScale &scale)
const QgsMapUnitScaleoutlineWidthMapUnitScale () const
virtual double estimateMaxBleed () const
 Returns the estimated maximum distance which the layer style will bleed outside the drawn shape. More...
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. More...
virtual QColor outlineColor () const
 Get outline color. More...
virtual void setFillColor (const QColor &color)
 Set fill color. More...
virtual QColor fillColor () const
 Get fill color. More...
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 Member Functions inherited from QgsFillSymbolLayerV2
 QgsFillSymbolLayerV2 (bool locked=false)
void _renderPolygon (QPainter *p, const QPolygonF &points, const QList< QPolygonF > *rings, QgsSymbolV2RenderContext &context)
 Default method to render polygon. More...
- Protected Member Functions inherited from QgsSymbolLayerV2
 QgsSymbolLayerV2 (QgsSymbolV2::SymbolType type, bool locked=false)
virtual void prepareExpressions (const QgsFields *fields, double scale=-1.0)
virtual QgsExpressionexpression (const QString &property) const
void saveDataDefinedProperties (QgsStringMap &stringMap) const
 Saves data defined properties to string map. More...
void copyDataDefinedProperties (QgsSymbolLayerV2 *destLayer) const
 Copies data defined properties of this layer to another symbol layer. More...

Protected Attributes

double mPatternWidth
 Width of the pattern (in output units) More...
QgsSymbolV2::OutputUnit mPatternWidthUnit
QgsMapUnitScale mPatternWidthMapUnitScale
QByteArray mSvgData
 SVG data. More...
QString mSvgFilePath
 Path to the svg file (or empty if constructed directly from data) More...
QRectF mSvgViewBox
 SVG view box (to keep the aspect ratio. More...
QImage * mSvgPattern
 SVG pattern image. More...
QColor mSvgFillColor
QColor mSvgOutlineColor
double mSvgOutlineWidth
QgsSymbolV2::OutputUnit mSvgOutlineWidthUnit
QgsMapUnitScale mSvgOutlineWidthMapUnitScale
- Protected Attributes inherited from QgsImageFillSymbolLayer
QBrush mBrush
double mNextAngle
double mOutlineWidth
 Outline width. More...
QgsSymbolV2::OutputUnit mOutlineWidthUnit
QgsMapUnitScale mOutlineWidthMapUnitScale
 Custom outline. More...
- 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. More...
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, const QgsMapUnitScale &patternWidthMapUnitScale, const QgsMapUnitScale &svgOutlineWidthMapUnitScale)
 Applies the svg pattern to the brush. More...

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 593 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 1590 of file qgsfillsymbollayerv2.cpp.

References mSvgPattern.

Member Function Documentation

void QgsSVGFillSymbolLayer::applyDataDefinedSettings ( const QgsSymbolV2RenderContext context)
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,
const QgsMapUnitScale patternWidthMapUnitScale,
const QgsMapUnitScale svgOutlineWidthMapUnitScale 
QgsSymbolLayerV2 * QgsSVGFillSymbolLayer::clone ( ) const
QgsSymbolLayerV2 * QgsSVGFillSymbolLayer::create ( const QgsStringMap properties = QgsStringMap())
QgsSymbolLayerV2 * QgsSVGFillSymbolLayer::createFromSld ( QDomElement &  element)
QString QgsSVGFillSymbolLayer::layerType ( ) const

Implements QgsSymbolLayerV2.

Definition at line 1733 of file qgsfillsymbollayerv2.cpp.

QgsMapUnitScale QgsSVGFillSymbolLayer::mapUnitScale ( ) const
QgsSymbolV2::OutputUnit QgsSVGFillSymbolLayer::outputUnit ( ) const
double QgsSVGFillSymbolLayer::patternWidth ( ) const

Definition at line 620 of file qgsfillsymbollayerv2.h.

Referenced by QgsSVGFillSymbolLayerWidget::setSymbolLayer().

const QgsMapUnitScale& QgsSVGFillSymbolLayer::patternWidthMapUnitScale ( ) const
QgsSymbolV2::OutputUnit QgsSVGFillSymbolLayer::patternWidthUnit ( ) const
QgsStringMap QgsSVGFillSymbolLayer::properties ( ) const
void QgsSVGFillSymbolLayer::setDefaultSvgParams ( )
void QgsSVGFillSymbolLayer::setMapUnitScale ( const QgsMapUnitScale scale)
void QgsSVGFillSymbolLayer::setOutputUnit ( QgsSymbolV2::OutputUnit  unit)
void QgsSVGFillSymbolLayer::setPatternWidth ( double  width)
void QgsSVGFillSymbolLayer::setPatternWidthMapUnitScale ( const QgsMapUnitScale scale)
void QgsSVGFillSymbolLayer::setPatternWidthUnit ( QgsSymbolV2::OutputUnit  unit)
void QgsSVGFillSymbolLayer::setSvgFilePath ( const QString &  svgPath)
void QgsSVGFillSymbolLayer::setSvgFillColor ( const QColor &  c)
void QgsSVGFillSymbolLayer::setSvgOutlineColor ( const QColor &  c)
void QgsSVGFillSymbolLayer::setSvgOutlineWidth ( double  w)
void QgsSVGFillSymbolLayer::setSvgOutlineWidthMapUnitScale ( const QgsMapUnitScale scale)
void QgsSVGFillSymbolLayer::setSvgOutlineWidthUnit ( QgsSymbolV2::OutputUnit  unit)
void QgsSVGFillSymbolLayer::startRender ( QgsSymbolV2RenderContext context)
void QgsSVGFillSymbolLayer::stopRender ( QgsSymbolV2RenderContext context)
void QgsSVGFillSymbolLayer::storeViewBox ( )

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

Definition at line 2043 of file qgsfillsymbollayerv2.cpp.

References mSvgData, and mSvgViewBox.

Referenced by QgsSVGFillSymbolLayer(), and setSvgFilePath().

QString QgsSVGFillSymbolLayer::svgFilePath ( ) const

Definition at line 618 of file qgsfillsymbollayerv2.h.

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

QColor QgsSVGFillSymbolLayer::svgFillColor ( ) const
QColor QgsSVGFillSymbolLayer::svgOutlineColor ( ) const
double QgsSVGFillSymbolLayer::svgOutlineWidth ( ) const

Definition at line 627 of file qgsfillsymbollayerv2.h.

Referenced by QgsSVGFillSymbolLayerWidget::setSymbolLayer().

const QgsMapUnitScale& QgsSVGFillSymbolLayer::svgOutlineWidthMapUnitScale ( ) const
QgsSymbolV2::OutputUnit QgsSVGFillSymbolLayer::svgOutlineWidthUnit ( ) const
void QgsSVGFillSymbolLayer::toSld ( QDomDocument &  doc,
QDomElement &  element,
QgsStringMap  props 
) const

Member Data Documentation

double QgsSVGFillSymbolLayer::mPatternWidth

Width of the pattern (in output units)

Definition at line 649 of file qgsfillsymbollayerv2.h.

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

QgsMapUnitScale QgsSVGFillSymbolLayer::mPatternWidthMapUnitScale
QgsSymbolV2::OutputUnit QgsSVGFillSymbolLayer::mPatternWidthUnit
QByteArray QgsSVGFillSymbolLayer::mSvgData

SVG data.

Definition at line 654 of file qgsfillsymbollayerv2.h.

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

QString QgsSVGFillSymbolLayer::mSvgFilePath

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

Definition at line 656 of file qgsfillsymbollayerv2.h.

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

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

SVG pattern image.

added in 1.9

Definition at line 661 of file qgsfillsymbollayerv2.h.

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

QRectF QgsSVGFillSymbolLayer::mSvgViewBox

SVG view box (to keep the aspect ratio.

Definition at line 658 of file qgsfillsymbollayerv2.h.

Referenced by applyPattern(), and storeViewBox().

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