QgsRasterFillSymbolLayer class
A class for filling symbols with a repeated raster image.
Contents
Base classes
- class QgsImageFillSymbolLayer
- Base class for polygon renderers generating texture images.
Public types
- enum FillCoordinateMode { Feature, Viewport }
- Fill coordinate modes, dictates fill tiling behavior.
Public static functions
- static auto create(const QgsStringMap& properties = QgsStringMap()) -> QgsSymbolLayer*
- Creates a new QgsRasterFillSymbolLayer from a properties map.
- 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
- QgsRasterFillSymbolLayer(const QString& imageFilePath = QString())
- Constructor for QgsRasterFillSymbolLayer, using a raster fill from the specified imageFilePath.
Public functions
- auto clone() const -> QgsRasterFillSymbolLayer* override
- Shall be reimplemented by subclasses to create a deep copy of the instance.
- auto coordinateMode() const -> FillCoordinateMode
- Coordinate mode for fill.
- auto estimateMaxBleed(const QgsRenderContext& context) const -> double override
- Returns the estimated maximum distance which the layer style will bleed outside the drawn shape when drawn in the specified /a context.
- auto imageFilePath() const -> QString
- The path to the raster image used for the fill.
- auto layerType() const -> QString override
- Returns a string that represents this layer type.
- auto offset() const -> QPointF
- Returns the offset for the fill.
- auto offsetMapUnitScale() const -> const QgsMapUnitScale&
- Returns the map unit scale for the fill's offset.
-
auto offsetUnit() const -> QgsUnitTypes::
RenderUnit - Returns the units for the fill's offset.
- auto opacity() const -> double
- Returns the opacity for the raster image used in the fill.
- 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 setCoordinateMode(FillCoordinateMode mode)
- Set the coordinate mode for fill.
- void setImageFilePath(const QString& imagePath)
- Sets the path to the raster image used for the fill.
- void setOffset(QPointF offset)
- Sets the offset for the fill.
- void setOffsetMapUnitScale(const QgsMapUnitScale& scale)
- Sets the map unit scale for the fill's offset.
-
void setOffsetUnit(const QgsUnitTypes::
RenderUnit unit) - Sets the units for the fill's offset.
- void setOpacity(double opacity)
- Sets the opacity for the raster image used in the fill.
- auto setSubSymbol(QgsSymbol* symbol) -> bool override
- Sets layer's subsymbol. takes ownership of the passed symbol.
- void setWidth(const double width)
- Sets the width for scaling the image used in the fill.
- void setWidthMapUnitScale(const QgsMapUnitScale& scale)
- Sets the map unit scale for the image's width.
-
void setWidthUnit(const QgsUnitTypes::
RenderUnit unit) - Sets the units for the image's width.
- auto subSymbol() -> QgsSymbol* override
- Returns the symbol's sub symbol, if present.
- auto width() const -> double
- Returns the width used for scaling the image used in the fill.
- auto widthMapUnitScale() const -> const QgsMapUnitScale&
- Returns the map unit scale for the image's width.
-
auto widthUnit() const -> QgsUnitTypes::
RenderUnit - Returns the units for the image's width.
Enum documentation
enum QgsRasterFillSymbolLayer:: FillCoordinateMode
Fill coordinate modes, dictates fill tiling behavior.
| Enumerators | |
|---|---|
| Feature |
Tiling is based on feature bounding box. |
| Viewport |
Tiling is based on complete map viewport. |
Function documentation
static QgsSymbolLayer* QgsRasterFillSymbolLayer:: create(const QgsStringMap& properties = QgsStringMap())
Creates a new QgsRasterFillSymbolLayer from a properties map.
The caller takes ownership of the returned object.
static void QgsRasterFillSymbolLayer:: 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.
FillCoordinateMode QgsRasterFillSymbolLayer:: coordinateMode() const
Coordinate mode for fill.
| Returns | coordinate mode |
|---|
Controls how the top left corner of the image fill is positioned relative to the feature.
double QgsRasterFillSymbolLayer:: estimateMaxBleed(const QgsRenderContext& context) const override
Returns the estimated maximum distance which the layer style will bleed outside the drawn shape when drawn in the specified /a context.
For example, polygons drawn with an stroke will draw half the width of the stroke outside of the polygon. This amount is estimated, since it may be affected by data defined symbology rules.
QString QgsRasterFillSymbolLayer:: imageFilePath() const
The path to the raster image used for the fill.
| Returns | path to image file |
|---|
QString QgsRasterFillSymbolLayer:: 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.
QPointF QgsRasterFillSymbolLayer:: offset() const
Returns the offset for the fill.
| Returns | offset for fill |
|---|
const QgsMapUnitScale& QgsRasterFillSymbolLayer:: offsetMapUnitScale() const
Returns the map unit scale for the fill's offset.
| Returns | map unit scale for offset |
|---|
QgsUnitTypes:: RenderUnit QgsRasterFillSymbolLayer:: offsetUnit() const
Returns the units for the fill's offset.
| Returns | units for offset |
|---|
double QgsRasterFillSymbolLayer:: opacity() const
Returns the opacity for the raster image used in the fill.
| Returns | opacity value between 0 (fully transparent) and 1 (fully opaque) |
|---|
QgsStringMap QgsRasterFillSymbolLayer:: 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 QgsRasterFillSymbolLayer:: setCoordinateMode(FillCoordinateMode mode)
Set the coordinate mode for fill.
| Parameters | |
|---|---|
| mode | coordinate mode |
Controls how the top left corner of the image fill is positioned relative to the feature.
void QgsRasterFillSymbolLayer:: setImageFilePath(const QString& imagePath)
Sets the path to the raster image used for the fill.
| Parameters | |
|---|---|
| imagePath | path to image file |
void QgsRasterFillSymbolLayer:: setOffset(QPointF offset)
Sets the offset for the fill.
| Parameters | |
|---|---|
| offset | offset for fill |
void QgsRasterFillSymbolLayer:: setOffsetMapUnitScale(const QgsMapUnitScale& scale)
Sets the map unit scale for the fill's offset.
| Parameters | |
|---|---|
| scale | map unit scale for offset |
void QgsRasterFillSymbolLayer:: setOffsetUnit(const QgsUnitTypes:: RenderUnit unit)
Sets the units for the fill's offset.
| Parameters | |
|---|---|
| unit | units for offset |
void QgsRasterFillSymbolLayer:: setOpacity(double opacity)
Sets the opacity for the raster image used in the fill.
| Parameters | |
|---|---|
| opacity | opacity value between 0 (fully transparent) and 1 (fully opaque) |
void QgsRasterFillSymbolLayer:: setWidth(const double width)
Sets the width for scaling the image used in the fill.
| Parameters | |
|---|---|
| width | width for scaling the image |
The image's height will also be scaled to maintain the image's aspect ratio.
void QgsRasterFillSymbolLayer:: setWidthMapUnitScale(const QgsMapUnitScale& scale)
Sets the map unit scale for the image's width.
| Parameters | |
|---|---|
| scale | map unit scale for width |
void QgsRasterFillSymbolLayer:: setWidthUnit(const QgsUnitTypes:: RenderUnit unit)
Sets the units for the image's width.
| Parameters | |
|---|---|
| unit | units for width |
double QgsRasterFillSymbolLayer:: width() const
Returns the width used for scaling the image used in the fill.
| Returns | width used for scaling the image |
|---|
The image's height is scaled to maintain the image's aspect ratio.
const QgsMapUnitScale& QgsRasterFillSymbolLayer:: widthMapUnitScale() const
Returns the map unit scale for the image's width.
| Returns | map unit scale for width |
|---|
QgsUnitTypes:: RenderUnit QgsRasterFillSymbolLayer:: widthUnit() const
Returns the units for the image's width.
| Returns | units for width |
|---|