Class: QgsMapBoxGlStyleConversionContext¶
Context for a MapBox GL style conversion operation.
Warning
This is private API only, and may change in future QGIS versions
Added in version 3.16.
Methods
Clears the list of warning messages. |
|
Returns the layer ID of the layer currently being converted. |
|
Returns the pixel size conversion factor, used to scale the original pixel sizes when converting styles. |
|
Pushes a warning message generated during the conversion. |
|
Sets the layer ID of the layer currently being converted. |
|
Sets the pixel size conversion factor, used to scale the original pixel sizes when converting styles. |
|
Sets the sprite image and definitions JSON for a given category to use during conversion. |
|
Sets the target unit type. |
|
Returns the list of sprite categories to use during conversion, or an empty list of none is set. |
|
Returns the sprite definitions for a given category to use during conversion. |
|
Returns the sprite image for a given category to use during conversion, or an invalid image if this is not set. |
|
Returns the target unit type. |
|
Returns a list of warning messages generated during the conversion. |
- class qgis.core.QgsMapBoxGlStyleConversionContext[source]¶
Bases:
object
- layerId(self) str [source]¶
Returns the layer ID of the layer currently being converted.
See also
- Return type:
str
- pixelSizeConversionFactor(self) float [source]¶
Returns the pixel size conversion factor, used to scale the original pixel sizes when converting styles.
See also
- Return type:
float
- pushWarning(self, warning: str | None)[source]¶
Pushes a
warning
message generated during the conversion.- Parameters:
warning (Optional[str])
- setLayerId(self, value: str | None)[source]¶
Sets the layer ID of the layer currently being converted.
See also
- Parameters:
value (Optional[str])
- setPixelSizeConversionFactor(self, sizeConversionFactor: float)[source]¶
Sets the pixel size conversion factor, used to scale the original pixel sizes when converting styles.
See also
- Parameters:
sizeConversionFactor (float)
- setSprites(self, image: QImage, definitions: Dict[str, Any], category: str | None = '')[source]¶
Sets the sprite
image
anddefinitions
JSON for a givencategory
to use during conversion.See also
See also
- Parameters:
image (QImage)
definitions (Dict[str, Any])
category (Optional[str] = '')
- setSprites(self, image: QImage, definitions: str | None, category: str | None = '')[source]
Sets the sprite
image
anddefinitions
JSON string for a givencategory
to use during conversion.See also
See also
- Parameters:
image (QImage)
definitions (Optional[str])
category (Optional[str] = '')
- setTargetUnit(self, targetUnit: Qgis.RenderUnit)[source]¶
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 ofQgsUnitTypes
.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
- Parameters:
targetUnit (Qgis.RenderUnit)
- spriteCategories(self) List[str] [source]¶
Returns the list of sprite categories to use during conversion, or an empty list of none is set.
See also
See also
Added in version 3.44.
- Return type:
List[str]
- spriteDefinitions(self, category: str | None = '') Dict[str, Any] [source]¶
Returns the sprite definitions for a given
category
to use during conversion.See also
See also
- Parameters:
category (Optional[str] = '')
- Return type:
Dict[str, Any]
- spriteImage(self, category: str | None = '') QImage [source]¶
Returns the sprite image for a given
category
to use during conversion, or an invalid image if this is not set.See also
See also
See also
- Parameters:
category (Optional[str] = '')
- Return type:
QImage
- targetUnit(self) Qgis.RenderUnit [source]¶
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 ofQgsUnitTypes
.Millimeters or another real-world unit type is often more appropriate.See also
- Return type: