Class: QgsMapBoxGlStyleConversionContext

class qgis.core.QgsMapBoxGlStyleConversionContext

Bases: sip.wrapper

Context for a MapBox GL style conversion operation.

Warning

This is private API only, and may change in future QGIS versions

New in version 3.16:

Methods

clearWarnings

Clears the list of warning messages.

layerId

Returns the layer ID of the layer currently being converted.

pixelSizeConversionFactor

Returns the pixel size conversion factor, used to scale the original pixel sizes when converting styles.

pushWarning

Pushes a warning message generated during the conversion.

setLayerId

Sets the layer ID of the layer currently being converted.

setPixelSizeConversionFactor

Sets the pixel size conversion factor, used to scale the original pixel sizes when converting styles.

setSprites

Sets the sprite image and definitions JSON to use during conversion.

setTargetUnit

Sets the target unit type.

spriteDefinitions

Returns the sprite definitions to use during conversion.

spriteImage

Returns the sprite image to use during conversion, or an invalid image if this is not set.

targetUnit

Returns the target unit type.

warnings

Returns a list of warning messages generated during the conversion.

clearWarnings(self)

Clears the list of warning messages.

layerId(self) str

Returns the layer ID of the layer currently being converted.

See also

setLayerId()

Return type

str

pixelSizeConversionFactor(self) float

Returns the pixel size conversion factor, used to scale the original pixel sizes when converting styles.

Return type

float

pushWarning(self, warning: str)

Pushes a warning message generated during the conversion.

Parameters

warning (str) –

setLayerId(self, value: str)

Sets the layer ID of the layer currently being converted.

See also

layerId()

Parameters

value (str) –

setPixelSizeConversionFactor(self, sizeConversionFactor: float)

Sets the pixel size conversion factor, used to scale the original pixel sizes when converting styles.

Parameters

sizeConversionFactor (float) –

setSprites(self, image: QImage, definitions: Dict[str, Any])

Sets the sprite image and definitions JSON to use during conversion.

See also

spriteImage()

setSprites(self, image: QImage, definitions: str) Sets the sprite image and definitions JSON string to use during conversion.

See also

spriteImage()

Parameters
  • image (QImage) –

  • definitions (Dict[str) –

setTargetUnit(self, targetUnit: QgsUnitTypes.RenderUnit)

Sets the target unit type.

By default this is QgsUnitTypes.RenderPixels in order to exactly match the original style rendering. But rendering in pixels can cause issues on hidpi displays or with print layouts, so setting a target unit of QgsUnitTypes.Millimeters or another real-world unit type is often more appropriate.

If setting to a non-pixel unit, be sure to call setPixelSizeConversionFactor() in order to setup an appropriate pixel-to-unit conversion factor to scale converted sizes using. E.g. if the target unit is millimeters, the size conversion factor should be set to a pixel-to-millimeter value.

See also

targetUnit()

Parameters

targetUnit (QgsUnitTypes.RenderUnit) –

spriteDefinitions(self) Dict[str, Any]

Returns the sprite definitions to use during conversion.

See also

spriteImage()

See also

setSprites()

Return type

Dict[str, Any]

spriteImage(self) QImage

Returns the sprite image to use during conversion, or an invalid image if this is not set.

See also

setSprites()

Return type

QImage

targetUnit(self) QgsUnitTypes.RenderUnit

Returns the target unit type.

By default this is QgsUnitTypes.RenderPixels in order to exactly match the original style rendering. But rendering in pixels can cause issues on hidpi displays or with print layouts, so setting a target unit of QgsUnitTypes.Millimeters or another real-world unit type is often more appropriate.

See also

setTargetUnit()

Return type

QgsUnitTypes.RenderUnit

warnings(self) List[str]

Returns a list of warning messages generated during the conversion.

Return type

List[str]