QgsSVGFillSymbolLayer class
A class for filling symbols with a repeated SVG file.
Contents
Base classes
- class QgsImageFillSymbolLayer
- Base class for polygon renderers generating texture images.
Public static functions
- static auto create(const QgsStringMap& properties = QgsStringMap()) -> QgsSymbolLayer*
- Creates a new QgsSVGFillSymbolLayer from a properties map.
- static auto createFromSld(QDomElement& element) -> QgsSymbolLayer*
- Creates a new QgsSVGFillSymbolLayer from a SLD element.
- static void resolvePaths(QgsStringMap& properties, const QgsPathResolver& pathResolver, bool saving)
- Turns relative paths in properties map to absolute when reading and vice versa when writing.
Constructors, destructors, conversion operators
- QgsSVGFillSymbolLayer(const QString& svgFilePath, double width = 20, double rotation = 0.0)
- Constructor for QgsSVGFillSymbolLayer, using the SVG picture at the specified absolute file path.
- QgsSVGFillSymbolLayer(const QByteArray& svgData, double width = 20, double rotation = 0.0)
- Constructor for QgsSVGFillSymbolLayer, using the specified SVG picture data.
Public functions
- auto clone() const -> QgsSVGFillSymbolLayer* override
- Shall be reimplemented by subclasses to create a deep copy of the instance.
- auto layerType() const -> QString override
- Returns a string that represents this layer type.
-
auto outputUnit() const -> QgsUnitTypes::
RenderUnit override - Returns the units to use for sizes and widths within the symbol layer.
- auto patternWidth() const -> double
- Returns the width of the rendered SVG content within the fill (i.e.
- auto patternWidthMapUnitScale() const -> const QgsMapUnitScale&
- Returns the map unit scale for the pattern's width.
-
auto patternWidthUnit() const -> QgsUnitTypes::
RenderUnit - Returns the units for the width of the SVG images in the pattern.
- auto properties() const -> QgsStringMap override
- Should be reimplemented by subclasses to return a string map that contains the configuration information for the symbol layer.
-
void setOutputUnit(QgsUnitTypes::
RenderUnit unit) override - Sets the units to use for sizes and widths within the symbol layer.
- void setPatternWidth(double width)
- Sets the width to render the SVG content as within the fill (i.e.
- void setPatternWidthMapUnitScale(const QgsMapUnitScale& scale)
- Sets the map unit scale for the pattern's width.
-
void setPatternWidthUnit(QgsUnitTypes::
RenderUnit unit) - Sets the unit for the width of the SVG images in the pattern.
- void setSvgFilePath(const QString& svgPath)
- Sets the path to the SVG file to render in the fill.
- void setSvgFillColor(const QColor& c)
- Sets the fill color used for rendering the SVG content.
- void setSvgStrokeColor(const QColor& c)
- Sets the stroke color used for rendering the SVG content.
- void setSvgStrokeWidth(double w)
- Sets the stroke width used for rendering the SVG content.
- void setSvgStrokeWidthMapUnitScale(const QgsMapUnitScale& scale)
- Sets the map unit scale for the pattern's stroke.
-
void setSvgStrokeWidthUnit(QgsUnitTypes::
RenderUnit unit) - Sets the unit for the stroke width.
- auto svgFilePath() const -> QString
- Returns the path to the SVG file used to render the fill.
- auto svgFillColor() const -> QColor
- Returns the fill color used for rendering the SVG content.
- auto svgStrokeColor() const -> QColor
- Returns the stroke color used for rendering the SVG content.
- auto svgStrokeWidth() const -> double
- Returns the stroke width used for rendering the SVG content.
- auto svgStrokeWidthMapUnitScale() const -> const QgsMapUnitScale&
- Returns the map unit scale for the pattern's stroke.
-
auto svgStrokeWidthUnit() const -> QgsUnitTypes::
RenderUnit - Returns the units for the stroke width.
Function documentation
static QgsSymbolLayer* QgsSVGFillSymbolLayer:: create(const QgsStringMap& properties = QgsStringMap())
Creates a new QgsSVGFillSymbolLayer from a properties map.
The caller takes ownership of the returned object.
static QgsSymbolLayer* QgsSVGFillSymbolLayer:: createFromSld(QDomElement& element)
Creates a new QgsSVGFillSymbolLayer from a SLD element.
The caller takes ownership of the returned object.
static void QgsSVGFillSymbolLayer:: resolvePaths(QgsStringMap& properties,
const QgsPathResolver& pathResolver,
bool saving)
Turns relative paths in properties map to absolute when reading and vice versa when writing.
Used internally when reading/writing symbols.
QString QgsSVGFillSymbolLayer:: layerType() const override
Returns a string that represents this layer type.
Used for serialization. Should match with the string used to register this symbol layer in the registry.
QgsUnitTypes:: RenderUnit QgsSVGFillSymbolLayer:: outputUnit() const override
Returns the units to use for sizes and widths within the symbol layer.
| Returns | output unit, or QgsUnitTypes:: |
|---|
Individual symbol layer subclasses will interpret this in different ways, e.g., a marker symbol layer may use it to specify the units for the marker size, while a line symbol layer may use it to specify the units for the line width.
double QgsSVGFillSymbolLayer:: patternWidth() const
Returns the width of the rendered SVG content within the fill (i.e.
the pattern repeat/tile size).
Units are retrieved by patternWidthUnit()
const QgsMapUnitScale& QgsSVGFillSymbolLayer:: patternWidthMapUnitScale() const
Returns the map unit scale for the pattern's width.
QgsUnitTypes:: RenderUnit QgsSVGFillSymbolLayer:: patternWidthUnit() const
Returns the units for the width of the SVG images in the pattern.
QgsStringMap QgsSVGFillSymbolLayer:: properties() const override
Should be reimplemented by subclasses to return a string map that contains the configuration information for the symbol layer.
This is used to serialize a symbol layer perstistently.
void QgsSVGFillSymbolLayer:: setOutputUnit(QgsUnitTypes:: RenderUnit unit) override
Sets the units to use for sizes and widths within the symbol layer.
| Parameters | |
|---|---|
| unit | output units |
Individual symbol layer subclasses will interpret this in different ways, e.g., a marker symbol layer may use it to specify the units for the marker size, while a line symbol layer may use it to specify the units for the line width.
void QgsSVGFillSymbolLayer:: setPatternWidth(double width)
Sets the width to render the SVG content as within the fill (i.e.
the pattern repeat/tile size).
Units are specified by setPatternWidthUnit()
void QgsSVGFillSymbolLayer:: setPatternWidthMapUnitScale(const QgsMapUnitScale& scale)
Sets the map unit scale for the pattern's width.
void QgsSVGFillSymbolLayer:: setPatternWidthUnit(QgsUnitTypes:: RenderUnit unit)
Sets the unit for the width of the SVG images in the pattern.
void QgsSVGFillSymbolLayer:: setSvgFilePath(const QString& svgPath)
Sets the path to the SVG file to render in the fill.
This is usually an absolute file path. Other supported options include
- relative paths to folders from the user's SVG search paths
- base64 encoded content, prefixed with a 'base64:' string
- http(s) paths
void QgsSVGFillSymbolLayer:: setSvgFillColor(const QColor& c)
Sets the fill color used for rendering the SVG content.
Fill color is only supported for parametrized SVG files. Color opacity is ignored if the SVG file does not support parametrized fill opacity.
void QgsSVGFillSymbolLayer:: setSvgStrokeColor(const QColor& c)
Sets the stroke color used for rendering the SVG content.
Stroke color is only supported for parametrized SVG files. Color opacity is ignored if the SVG file does not support parametrized outline opacity.
void QgsSVGFillSymbolLayer:: setSvgStrokeWidth(double w)
Sets the stroke width used for rendering the SVG content.
Stroke width is only supported for parametrized SVG files. Units are specified via setSvgStrokeWidthUnit()
void QgsSVGFillSymbolLayer:: setSvgStrokeWidthMapUnitScale(const QgsMapUnitScale& scale)
Sets the map unit scale for the pattern's stroke.
void QgsSVGFillSymbolLayer:: setSvgStrokeWidthUnit(QgsUnitTypes:: RenderUnit unit)
Sets the unit for the stroke width.
QString QgsSVGFillSymbolLayer:: svgFilePath() const
Returns the path to the SVG file used to render the fill.
QColor QgsSVGFillSymbolLayer:: svgFillColor() const
Returns the fill color used for rendering the SVG content.
Fill color is only supported for parametrized SVG files.
QColor QgsSVGFillSymbolLayer:: svgStrokeColor() const
Returns the stroke color used for rendering the SVG content.
Stroke color is only supported for parametrized SVG files.
double QgsSVGFillSymbolLayer:: svgStrokeWidth() const
Returns the stroke width used for rendering the SVG content.
Stroke width is only supported for parametrized SVG files. Units are retrieved via setSvgStrokeWidthUnit()
const QgsMapUnitScale& QgsSVGFillSymbolLayer:: svgStrokeWidthMapUnitScale() const
Returns the map unit scale for the pattern's stroke.
QgsUnitTypes:: RenderUnit QgsSVGFillSymbolLayer:: svgStrokeWidthUnit() const
Returns the units for the stroke width.