QGIS API Documentation  2.3.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
[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. 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
 
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
 
- Protected Attributes inherited from QgsImageFillSymbolLayer
QBrush mBrush
 
double mNextAngle
 
double mOutlineWidth
 Outline width. More...
 
QgsSymbolV2::OutputUnit mOutlineWidthUnit
 
QgsLineSymbolV2mOutline
 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)
 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 548 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 1487 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 1598 of file qgsfillsymbollayerv2.cpp.

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

Definition at line 575 of file qgsfillsymbollayerv2.h.

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

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

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

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

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

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

Definition at line 579 of file qgsfillsymbollayerv2.h.

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

void QgsSVGFillSymbolLayer::setSvgOutlineWidth ( double  w)
inline

Definition at line 581 of file qgsfillsymbollayerv2.h.

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

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

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

References mSvgData, and mSvgViewBox.

Referenced by QgsSVGFillSymbolLayer(), and setSvgFilePath().

QString QgsSVGFillSymbolLayer::svgFilePath ( ) const
inline

Definition at line 573 of file qgsfillsymbollayerv2.h.

Referenced by create().

QColor QgsSVGFillSymbolLayer::svgFillColor ( ) const
inline

Definition at line 578 of file qgsfillsymbollayerv2.h.

Referenced by applyDataDefinedSettings().

QColor QgsSVGFillSymbolLayer::svgOutlineColor ( ) const
inline

Definition at line 580 of file qgsfillsymbollayerv2.h.

Referenced by applyDataDefinedSettings().

double QgsSVGFillSymbolLayer::svgOutlineWidth ( ) const
inline

Definition at line 582 of file qgsfillsymbollayerv2.h.

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

Definition at line 588 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 595 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 599 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 601 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 606 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 603 of file qgsfillsymbollayerv2.h.

Referenced by applyPattern(), and storeViewBox().


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