|
QGIS API Documentation 4.1.0-Master (3b8ef1f72a3)
|
An abstract base class for converting between QgsSymbol objects and QVariant representations. More...
#include <qgssymbolconverter.h>

Public Member Functions | |
| virtual | ~QgsAbstractSymbolConverter () |
| virtual Qgis::SymbolConverterCapabilities | capabilities () const =0 |
| Returns the capabilities of the converter. | |
| virtual std::unique_ptr< QgsSymbol > | createSymbol (const QVariant &variant, QgsSymbolConverterContext &context) const =0 |
| Creates a new QgsSymbol from a QVariant representation. | |
| virtual QString | formatName () const =0 |
| Returns a translated, user-friendly name for the converter's data format. | |
| virtual QString | name () const =0 |
| Returns the unique name for the converter. | |
| virtual QVariant | toVariant (const QgsSymbol *symbol, QgsSymbolConverterContext &context) const =0 |
| Converts a symbol into a QVariant representation. | |
An abstract base class for converting between QgsSymbol objects and QVariant representations.
This interface provides a standard mechanism for serializing QGIS symbols to a generic data container (based on QVariant) and deserializing them back into native QgsSymbol objects.
Concrete implementations of this class are intended to handle specific external styling formats, such as SLD (Styled Layer Descriptor) or Mapbox GL styles.
Definition at line 121 of file qgssymbolconverter.h.
|
virtualdefault |
|
pure virtual |
Returns the capabilities of the converter.
Implemented in QgsSymbolConverterEsriRest, QgsSymbolConverterMapBoxGl, QgsSymbolConverterOgrStyle, QgsSymbolConverterQml, and QgsSymbolConverterSld.
|
pure virtual |
Creates a new QgsSymbol from a QVariant representation.
| variant | The QVariant containing the serialized symbol data. |
| context | conversion context |
nullptr if the variant cannot be converted or parsed.| QgsNotSupportedException | if the converter does not support deserialization of symbols. |
Implemented in QgsSymbolConverterEsriRest, QgsSymbolConverterMapBoxGl, QgsSymbolConverterOgrStyle, QgsSymbolConverterQml, and QgsSymbolConverterSld.
|
pure virtual |
Returns a translated, user-friendly name for the converter's data format.
E.g. "Styled Layer Descriptor (SLD)" for a converter which handles the SLD format.
Implemented in QgsSymbolConverterEsriRest, QgsSymbolConverterMapBoxGl, QgsSymbolConverterOgrStyle, QgsSymbolConverterQml, and QgsSymbolConverterSld.
|
pure virtual |
Returns the unique name for the converter.
This should be an untranslated string identifying the converter.
Implemented in QgsSymbolConverterEsriRest, QgsSymbolConverterMapBoxGl, QgsSymbolConverterOgrStyle, QgsSymbolConverterQml, and QgsSymbolConverterSld.
|
pure virtual |
Converts a symbol into a QVariant representation.
The resulting QVariant may be a dictionary (QVariantMap), a JSON string, an XML representation of the symbol, or some binary QByteArray value, depending on the concrete implementation (e.g., SLD vs. Mapbox GL).
Returns an invalid variant if the symbol could not be converted, or if serialization of symbols is not supported for this converter.
| QgsNotSupportedException | if the converter does not support serialization of symbols. |
Implemented in QgsSymbolConverterEsriRest, QgsSymbolConverterMapBoxGl, QgsSymbolConverterOgrStyle, QgsSymbolConverterQml, and QgsSymbolConverterSld.