QGIS API Documentation
2.2.0-Valmiera
|
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 |
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 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 () |
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 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 310 of file qgsfillsymbollayerv2.h.
QgsSVGFillSymbolLayer::QgsSVGFillSymbolLayer | ( | const QString & | svgFilePath = "" , |
double | width = 20 , |
||
double | rotation = 0.0 |
||
) |
Definition at line 921 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 931 of file qgsfillsymbollayerv2.cpp.
References QgsFillSymbolLayerV2::angle(), QgsFillSymbolLayerV2::mAngle, QgsImageFillSymbolLayer::mOutlineWidth, mSvgPattern, setDefaultSvgParams(), QgsImageFillSymbolLayer::setSubSymbol(), and storeViewBox().
QgsSVGFillSymbolLayer::~QgsSVGFillSymbolLayer | ( | ) |
Definition at line 942 of file qgsfillsymbollayerv2.cpp.
References mSvgPattern.
|
protectedvirtual |
Reimplemented from QgsImageFillSymbolLayer.
Definition at line 1308 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 1058 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 1164 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 973 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 1248 of file qgsfillsymbollayerv2.cpp.
References QgsFillSymbolLayerV2::angle(), QgsSymbolLayerV2Utils::createLineLayerFromSld(), QgsSymbolLayerV2Utils::externalGraphicFromSld(), QgsSymbolLayerV2::fillColor(), QgsSymbolLayerV2Utils::lineFromSld(), QgsDebugMsg, QgsSVGFillSymbolLayer(), QgsSymbolLayerV2Utils::rotationFromSldElement(), QgsImageFillSymbolLayer::setSubSymbol(), setSvgFillColor(), setSvgOutlineColor(), setSvgOutlineWidth(), and size.
Referenced by QgsSymbolLayerV2Registry::QgsSymbolLayerV2Registry().
|
virtual |
Implements QgsSymbolLayerV2.
Definition at line 1053 of file qgsfillsymbollayerv2.cpp.
|
virtual |
Reimplemented from QgsSymbolLayerV2.
Definition at line 954 of file qgsfillsymbollayerv2.cpp.
References QgsSymbolV2::Mixed, QgsImageFillSymbolLayer::mOutlineWidthUnit, mPatternWidthUnit, and mSvgOutlineWidthUnit.
|
inline |
Definition at line 337 of file qgsfillsymbollayerv2.h.
|
inline |
Definition at line 347 of file qgsfillsymbollayerv2.h.
Referenced by applyPattern().
|
virtual |
Implements QgsSymbolLayerV2.
Definition at line 1135 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 1372 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 947 of file qgsfillsymbollayerv2.cpp.
References QgsImageFillSymbolLayer::mOutlineWidthUnit, mPatternWidthUnit, and mSvgOutlineWidthUnit.
|
inline |
Definition at line 336 of file qgsfillsymbollayerv2.h.
|
inline |
Definition at line 346 of file qgsfillsymbollayerv2.h.
void QgsSVGFillSymbolLayer::setSvgFilePath | ( | const QString & | svgPath | ) |
Definition at line 964 of file qgsfillsymbollayerv2.cpp.
References QgsSvgCache::getImageData(), QgsSvgCache::instance(), mSvgData, mSvgFilePath, setDefaultSvgParams(), and storeViewBox().
Referenced by QgsSVGFillSymbolLayer().
|
inline |
Definition at line 339 of file qgsfillsymbollayerv2.h.
Referenced by clone(), create(), and createFromSld().
|
inline |
Definition at line 341 of file qgsfillsymbollayerv2.h.
Referenced by clone(), create(), and createFromSld().
|
inline |
Definition at line 343 of file qgsfillsymbollayerv2.h.
Referenced by clone(), create(), and createFromSld().
|
inline |
Definition at line 349 of file qgsfillsymbollayerv2.h.
|
virtual |
Implements QgsSymbolLayerV2.
Definition at line 1114 of file qgsfillsymbollayerv2.cpp.
References applyPattern(), QgsSymbolV2RenderContext::layer(), QgsImageFillSymbolLayer::mBrush, QgsImageFillSymbolLayer::mOutline, mPatternWidth, mPatternWidthUnit, mSvgFilePath, mSvgFillColor, mSvgOutlineColor, mSvgOutlineWidth, mSvgOutlineWidthUnit, QgsSymbolLayerV2::prepareExpressions(), QgsSymbolV2RenderContext::renderContext(), QgsRenderContext::rendererScale(), and QgsSymbolV2::startRender().
|
virtual |
Implements QgsSymbolLayerV2.
Definition at line 1127 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 1356 of file qgsfillsymbollayerv2.cpp.
References mSvgData, and mSvgViewBox.
Referenced by QgsSVGFillSymbolLayer(), and setSvgFilePath().
|
inline |
Definition at line 335 of file qgsfillsymbollayerv2.h.
Referenced by create().
|
inline |
Definition at line 340 of file qgsfillsymbollayerv2.h.
Referenced by applyDataDefinedSettings().
|
inline |
Definition at line 342 of file qgsfillsymbollayerv2.h.
Referenced by applyDataDefinedSettings().
|
inline |
Definition at line 344 of file qgsfillsymbollayerv2.h.
|
inline |
Definition at line 350 of file qgsfillsymbollayerv2.h.
Referenced by applyPattern().
|
virtual |
Reimplemented from QgsSymbolLayerV2.
Definition at line 1191 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 357 of file qgsfillsymbollayerv2.h.
Referenced by applyDataDefinedSettings(), clone(), properties(), startRender(), and toSld().
|
protected |
Definition at line 358 of file qgsfillsymbollayerv2.h.
Referenced by applyDataDefinedSettings(), clone(), outputUnit(), properties(), setOutputUnit(), and startRender().
|
protected |
SVG data.
Definition at line 361 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 363 of file qgsfillsymbollayerv2.h.
Referenced by applyDataDefinedSettings(), clone(), properties(), setDefaultSvgParams(), setSvgFilePath(), startRender(), and toSld().
|
protected |
Definition at line 372 of file qgsfillsymbollayerv2.h.
Referenced by applyDataDefinedSettings(), clone(), properties(), setDefaultSvgParams(), startRender(), and toSld().
|
protected |
Definition at line 373 of file qgsfillsymbollayerv2.h.
Referenced by applyDataDefinedSettings(), clone(), properties(), setDefaultSvgParams(), startRender(), and toSld().
|
protected |
Definition at line 374 of file qgsfillsymbollayerv2.h.
Referenced by applyDataDefinedSettings(), clone(), properties(), setDefaultSvgParams(), startRender(), and toSld().
|
protected |
Definition at line 375 of file qgsfillsymbollayerv2.h.
Referenced by applyDataDefinedSettings(), clone(), outputUnit(), properties(), setOutputUnit(), and startRender().
|
protected |
SVG pattern image.
Definition at line 368 of file qgsfillsymbollayerv2.h.
Referenced by applyPattern(), QgsSVGFillSymbolLayer(), and ~QgsSVGFillSymbolLayer().
|
protected |
SVG view box (to keep the aspect ratio.
Definition at line 365 of file qgsfillsymbollayerv2.h.
Referenced by applyPattern(), and storeViewBox().