QGIS API Documentation
2.0.1-Dufour
|
A class for svg fill patterns. More...
#include <qgsfillsymbollayerv2.h>
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 |
QgsSymbolLayerV2 * | clone () 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 QgsSymbolV2 * | subSymbol () |
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 QgsExpression * | dataDefinedProperty (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 QgsSymbolLayerV2 * | create (const QgsStringMap &properties=QgsStringMap()) |
static QgsSymbolLayerV2 * | createFromSld (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 |
QgsLineSymbolV2 * | mOutline |
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 |
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.
QgsSVGFillSymbolLayer::QgsSVGFillSymbolLayer | ( | const QString & | svgFilePath = "" , |
double | width = 20 , |
||
double | rotation = 0.0 |
||
) |
Definition at line 375 of file qgsfillsymbollayerv2.cpp.
References QgsFillSymbolLayerV2::angle(), QgsFillSymbolLayerV2::mAngle, QgsImageFillSymbolLayer::mOutlineWidth, mSvgPattern, setDefaultSvgParams(), and setSvgFilePath().
Referenced by clone(), create(), and createFromSld().
QgsSVGFillSymbolLayer::QgsSVGFillSymbolLayer | ( | const QByteArray & | svgData, |
double | width = 20 , |
||
double | rotation = 0.0 |
||
) |
Definition at line 385 of file qgsfillsymbollayerv2.cpp.
References QgsFillSymbolLayerV2::angle(), QgsFillSymbolLayerV2::mAngle, QgsImageFillSymbolLayer::mOutlineWidth, mSvgPattern, setDefaultSvgParams(), QgsImageFillSymbolLayer::setSubSymbol(), and storeViewBox().
QgsSVGFillSymbolLayer::~QgsSVGFillSymbolLayer | ( | ) |
Definition at line 396 of file qgsfillsymbollayerv2.cpp.
References QgsImageFillSymbolLayer::mOutline, and mSvgPattern.
|
protectedvirtual |
Reimplemented from QgsImageFillSymbolLayer.
Definition at line 763 of file qgsfillsymbollayerv2.cpp.
References applyPattern(), QgsSymbolLayerV2Utils::decodeColor(), QgsExpression::evaluate(), QgsSymbolLayerV2::expression(), QgsSymbolV2RenderContext::feature(), QgsImageFillSymbolLayer::mBrush, QgsImageFillSymbolLayer::mNextAngle, mPatternWidth, mPatternWidthUnit, mSvgFilePath, mSvgFillColor, mSvgOutlineColor, mSvgOutlineWidth, mSvgOutlineWidthUnit, outlineWidth, svgFillColor(), and svgOutlineColor().
|
private |
Applies the svg pattern to the brush.
Definition at line 513 of file qgsfillsymbollayerv2.cpp.
References QgsSymbolV2RenderContext::alpha(), QgsSvgCache::instance(), QgsSymbolLayerV2Utils::lineWidthScaleFactor(), mSvgPattern, mSvgViewBox, QgsSymbolLayerV2Utils::multiplyImageOpacity(), outlineWidth, patternWidthUnit(), QgsSymbolLayerV2Utils::pixelSizeScaleFactor(), qgsDoubleNear(), QgsRenderContext::rasterScaleFactor(), QgsSymbolV2RenderContext::renderContext(), QgsRenderContext::scaleFactor(), size, QgsSvgCache::svgAsImage(), QgsSvgCache::svgAsPicture(), and svgOutlineWidthUnit().
Referenced by applyDataDefinedSettings(), and startRender().
|
virtual |
Implements QgsSymbolLayerV2.
Definition at line 619 of file qgsfillsymbollayerv2.cpp.
References QgsLineSymbolV2::clone(), QgsSymbolLayerV2::copyDataDefinedProperties(), QgsFillSymbolLayerV2::mAngle, QgsImageFillSymbolLayer::mOutline, QgsImageFillSymbolLayer::mOutlineWidthUnit, mPatternWidth, mPatternWidthUnit, mSvgData, mSvgFilePath, mSvgFillColor, mSvgOutlineColor, mSvgOutlineWidth, mSvgOutlineWidthUnit, QgsSVGFillSymbolLayer(), QgsImageFillSymbolLayer::setOutlineWidthUnit(), setPatternWidthUnit(), QgsImageFillSymbolLayer::setSubSymbol(), setSvgFillColor(), setSvgOutlineColor(), setSvgOutlineWidth(), and setSvgOutlineWidthUnit().
|
static |
Definition at line 428 of file qgsfillsymbollayerv2.cpp.
References QgsFillSymbolLayerV2::angle(), QgsSymbolLayerV2Utils::decodeOutputUnit(), QgsSVGFillSymbolLayer(), QgsSymbolLayerV2::setDataDefinedProperty(), QgsImageFillSymbolLayer::setOutlineWidthUnit(), setPatternWidthUnit(), setSvgFillColor(), setSvgOutlineColor(), setSvgOutlineWidth(), setSvgOutlineWidthUnit(), svgFilePath(), and QgsSymbolLayerV2Utils::symbolNameToPath().
Referenced by QgsSymbolLayerV2Registry::QgsSymbolLayerV2Registry().
|
static |
Definition at line 703 of file qgsfillsymbollayerv2.cpp.
References QgsFillSymbolLayerV2::angle(), QgsSymbolLayerV2Utils::createLineLayerFromSld(), QgsSymbolLayerV2Utils::externalGraphicFromSld(), QgsSymbolLayerV2Utils::lineFromSld(), QgsDebugMsg, QgsSVGFillSymbolLayer(), QgsSymbolLayerV2Utils::rotationFromSldElement(), QgsImageFillSymbolLayer::setSubSymbol(), setSvgFillColor(), setSvgOutlineColor(), setSvgOutlineWidth(), and size.
Referenced by QgsSymbolLayerV2Registry::QgsSymbolLayerV2Registry().
|
virtual |
Implements QgsSymbolLayerV2.
Definition at line 508 of file qgsfillsymbollayerv2.cpp.
|
virtual |
Reimplemented from QgsSymbolLayerV2.
Definition at line 409 of file qgsfillsymbollayerv2.cpp.
References QgsSymbolV2::Mixed, QgsImageFillSymbolLayer::mOutlineWidthUnit, mPatternWidthUnit, and mSvgOutlineWidthUnit.
|
inline |
Definition at line 162 of file qgsfillsymbollayerv2.h.
|
inline |
Definition at line 172 of file qgsfillsymbollayerv2.h.
Referenced by applyPattern().
|
virtual |
Implements QgsSymbolLayerV2.
Definition at line 590 of file qgsfillsymbollayerv2.cpp.
References QgsSymbolLayerV2Utils::encodeOutputUnit(), QgsFillSymbolLayerV2::mAngle, QgsImageFillSymbolLayer::mOutlineWidthUnit, mPatternWidth, mPatternWidthUnit, mSvgData, mSvgFilePath, mSvgFillColor, mSvgOutlineColor, mSvgOutlineWidth, mSvgOutlineWidthUnit, QgsSymbolLayerV2::saveDataDefinedProperties(), and QgsSymbolLayerV2Utils::symbolPathToName().
|
private |
Definition at line 827 of file qgsfillsymbollayerv2.cpp.
References QgsSvgCache::containsParams(), QgsSvgCache::instance(), mSvgFilePath, mSvgFillColor, mSvgOutlineColor, and mSvgOutlineWidth.
Referenced by QgsSVGFillSymbolLayer(), and setSvgFilePath().
|
virtual |
Reimplemented from QgsSymbolLayerV2.
Definition at line 402 of file qgsfillsymbollayerv2.cpp.
References QgsImageFillSymbolLayer::mOutlineWidthUnit, mPatternWidthUnit, and mSvgOutlineWidthUnit.
|
inline |
Definition at line 161 of file qgsfillsymbollayerv2.h.
|
inline |
Definition at line 171 of file qgsfillsymbollayerv2.h.
void QgsSVGFillSymbolLayer::setSvgFilePath | ( | const QString & | svgPath | ) |
Definition at line 419 of file qgsfillsymbollayerv2.cpp.
References QgsSvgCache::getImageData(), QgsSvgCache::instance(), mSvgData, mSvgFilePath, setDefaultSvgParams(), and storeViewBox().
Referenced by QgsSVGFillSymbolLayer().
|
inline |
Definition at line 164 of file qgsfillsymbollayerv2.h.
Referenced by clone(), create(), and createFromSld().
|
inline |
Definition at line 166 of file qgsfillsymbollayerv2.h.
Referenced by clone(), create(), and createFromSld().
|
inline |
Definition at line 168 of file qgsfillsymbollayerv2.h.
Referenced by clone(), create(), and createFromSld().
|
inline |
Definition at line 174 of file qgsfillsymbollayerv2.h.
|
virtual |
Implements QgsSymbolLayerV2.
Definition at line 569 of file qgsfillsymbollayerv2.cpp.
References applyPattern(), QgsSymbolV2RenderContext::layer(), QgsImageFillSymbolLayer::mBrush, QgsImageFillSymbolLayer::mOutline, mPatternWidth, mPatternWidthUnit, mSvgFilePath, mSvgFillColor, mSvgOutlineColor, mSvgOutlineWidth, mSvgOutlineWidthUnit, QgsSymbolLayerV2::prepareExpressions(), QgsSymbolV2RenderContext::renderContext(), and QgsSymbolV2::startRender().
|
virtual |
Implements QgsSymbolLayerV2.
Definition at line 582 of file qgsfillsymbollayerv2.cpp.
References QgsImageFillSymbolLayer::mOutline, QgsSymbolV2RenderContext::renderContext(), and QgsSymbolV2::stopRender().
|
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().
|
inline |
Definition at line 160 of file qgsfillsymbollayerv2.h.
Referenced by create().
|
inline |
Definition at line 165 of file qgsfillsymbollayerv2.h.
Referenced by applyDataDefinedSettings().
|
inline |
Definition at line 167 of file qgsfillsymbollayerv2.h.
Referenced by applyDataDefinedSettings().
|
inline |
Definition at line 169 of file qgsfillsymbollayerv2.h.
|
inline |
Definition at line 175 of file qgsfillsymbollayerv2.h.
Referenced by applyPattern().
|
virtual |
Reimplemented from QgsSymbolLayerV2.
Definition at line 646 of file qgsfillsymbollayerv2.cpp.
References QgsFillSymbolLayerV2::angle(), QgsSymbolLayerV2Utils::createGeometryElement(), QgsSymbolLayerV2Utils::createRotationElement(), QgsSymbolLayerV2Utils::externalGraphicToSld(), QgsSymbolLayerV2Utils::lineToSld(), QgsFillSymbolLayerV2::mAngle, QgsImageFillSymbolLayer::mOutline, mPatternWidth, mSvgFilePath, mSvgFillColor, mSvgOutlineColor, mSvgOutlineWidth, and QgsSymbolV2::toSld().
|
protected |
Width of the pattern (in output units)
Definition at line 182 of file qgsfillsymbollayerv2.h.
Referenced by applyDataDefinedSettings(), clone(), properties(), startRender(), and toSld().
|
protected |
Definition at line 183 of file qgsfillsymbollayerv2.h.
Referenced by applyDataDefinedSettings(), clone(), outputUnit(), properties(), setOutputUnit(), and startRender().
|
protected |
SVG data.
Definition at line 186 of file qgsfillsymbollayerv2.h.
Referenced by clone(), properties(), setSvgFilePath(), and storeViewBox().
|
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().
|
protected |
Definition at line 197 of file qgsfillsymbollayerv2.h.
Referenced by applyDataDefinedSettings(), clone(), properties(), setDefaultSvgParams(), startRender(), and toSld().
|
protected |
Definition at line 198 of file qgsfillsymbollayerv2.h.
Referenced by applyDataDefinedSettings(), clone(), properties(), setDefaultSvgParams(), startRender(), and toSld().
|
protected |
Definition at line 199 of file qgsfillsymbollayerv2.h.
Referenced by applyDataDefinedSettings(), clone(), properties(), setDefaultSvgParams(), startRender(), and toSld().
|
protected |
Definition at line 200 of file qgsfillsymbollayerv2.h.
Referenced by applyDataDefinedSettings(), clone(), outputUnit(), properties(), setOutputUnit(), and startRender().
|
protected |
SVG pattern image.
Definition at line 193 of file qgsfillsymbollayerv2.h.
Referenced by applyPattern(), QgsSVGFillSymbolLayer(), and ~QgsSVGFillSymbolLayer().
|
protected |
SVG view box (to keep the aspect ratio.
Definition at line 190 of file qgsfillsymbollayerv2.h.
Referenced by applyPattern(), and storeViewBox().