Class: QgsSymbolLayerRegistry¶
Registry of available symbol layer classes.
QgsSymbolLayerRegistry
is not usually directly created, but
rather accessed through QgsApplication.symbolLayerRegistry()
.
Methods
Registers a new symbol layer type. |
|
create a new instance of symbol layer given symbol layer name and properties |
|
create a new instance of symbol layer given symbol layer name and SLD |
|
Removes a symbol layer type |
|
Resolve fonts from the properties of a particular symbol layer. |
|
Resolve paths in properties of a particular symbol layer. |
|
Returns metadata for specified symbol layer. |
|
Returns a list of available symbol layers for a specified symbol type |
Static Methods
create a new instance of symbol layer for specified symbol type with default settings |
- class qgis.core.QgsSymbolLayerRegistry[source]¶
Bases:
object
- addSymbolLayerType(self, metadata: QgsSymbolLayerAbstractMetadata | None) bool [source]¶
Registers a new symbol layer type. Takes ownership of the metadata instance.
- Parameters:
metadata (Optional[QgsSymbolLayerAbstractMetadata])
- Return type:
bool
- createSymbolLayer(self, name: str | None, properties: Dict[str, Any] = {}) QgsSymbolLayer | None ¶
create a new instance of symbol layer given symbol layer name and properties
- Parameters:
name (Optional[str])
properties (Dict[str, Any] = {})
- Return type:
Optional[QgsSymbolLayer]
- createSymbolLayerFromSld(self, name: str | None, element: QDomElement) QgsSymbolLayer | None ¶
create a new instance of symbol layer given symbol layer name and SLD
- Parameters:
name (Optional[str])
element (QDomElement)
- Return type:
Optional[QgsSymbolLayer]
- static defaultSymbolLayer(type: Qgis.SymbolType) QgsSymbolLayer | None ¶
create a new instance of symbol layer for specified symbol type with default settings
- Parameters:
type (Qgis.SymbolType)
- Return type:
Optional[QgsSymbolLayer]
- removeSymbolLayerType(self, metadata: QgsSymbolLayerAbstractMetadata | None) bool [source]¶
Removes a symbol layer type
Added in version 3.22.2.
- Parameters:
metadata (Optional[QgsSymbolLayerAbstractMetadata])
- Return type:
bool
- resolveFonts(self, name: str | None, properties: Dict[str, Any], context: QgsReadWriteContext)[source]¶
Resolve fonts from the
properties
of a particular symbol layer.This tests whether the required fonts from the encoded
properties
are available on the system, and records warnings in thecontext
if not.Added in version 3.20.
- Parameters:
name (Optional[str])
properties (Dict[str, Any])
context (QgsReadWriteContext)
- resolvePaths(self, name: str | None, properties: Dict[str, Any], pathResolver: QgsPathResolver, saving: bool)[source]¶
Resolve paths in properties of a particular symbol layer. This normally means converting relative paths to absolute paths when loading and converting absolute paths to relative paths when saving.
- Parameters:
name (Optional[str])
properties (Dict[str, Any])
pathResolver (QgsPathResolver)
saving (bool)
- symbolLayerMetadata(self, name: str | None) QgsSymbolLayerAbstractMetadata | None [source]¶
Returns metadata for specified symbol layer. Returns
None
if not found- Parameters:
name (Optional[str])
- Return type:
Optional[QgsSymbolLayerAbstractMetadata]
- symbolLayersForType(self, type: Qgis.SymbolType) List[str] [source]¶
Returns a list of available symbol layers for a specified symbol type
- Parameters:
type (Qgis.SymbolType)
- Return type:
List[str]