Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
drop QgsSymbolLayerUitls::readSerializedProperties and serializePrope…
- Loading branch information
|
@@ -875,37 +875,6 @@ Creates a new symbol with size restricted to min/max size if original size is ou |
|
|
%Docstring |
|
|
Evaluates a map of properties using the given ``context`` and returns a variant map with evaluated expressions from the properties. |
|
|
|
|
|
.. versionadded:: 3.18 |
|
|
%End |
|
|
|
|
|
static QMap<QString, QString> serializeProperties( const QMap<QString, QgsProperty> &propertiesMap ); |
|
|
%Docstring |
|
|
Serialize a map of properties |
|
|
{"key1": "value1", "key2": "value2"} |
|
|
becomes |
|
|
{ |
|
|
"properties_0_name": "key1", "properties_0_value": "value1", |
|
|
"properties_1_name": "key2", "properties_1_value": "value2", |
|
|
} |
|
|
|
|
|
.. seealso:: :py:func:`readSerializedProperties` |
|
|
|
|
|
.. versionadded:: 3.18 |
|
|
%End |
|
|
|
|
|
static QMap<QString, QgsProperty> readSerializedProperties( const QMap<QString, QString> &serializedProperties ); |
|
|
%Docstring |
|
|
Reads a serialized map of properties |
|
|
It expects |
|
|
{ |
|
|
"properties_0_name": "key1", "properties_0_value": "value1", |
|
|
"properties_1_name": "key2", "properties_1_value": "value2", |
|
|
} |
|
|
which will return |
|
|
{"key1": "value1", "key2": "value2"} |
|
|
|
|
|
.. seealso:: :py:func:`serializeProperties` |
|
|
|
|
|
.. versionadded:: 3.18 |
|
|
%End |
|
|
}; |
|
|
|
@@ -4761,32 +4761,3 @@ QgsStringMap QgsSymbolLayerUtils::evaluatePropertiesMap( const QMap<QString, Qgs |
|
|
return properties; |
|
|
} |
|
|
|
|
|
QMap<QString, QString> QgsSymbolLayerUtils::serializeProperties( const QMap<QString, QgsProperty> &propertiesMap ) |
|
|
{ |
|
|
QMap<QString, QString> serialized; |
|
|
QMap<QString, QgsProperty>::const_iterator paramIt = propertiesMap.constBegin(); |
|
|
int i = 0; |
|
|
for ( ; paramIt != propertiesMap.constEnd(); ++paramIt ) |
|
|
{ |
|
|
serialized[QString( QStringLiteral( "properties_%1_name" ) ).arg( i )] = paramIt.key(); |
|
|
serialized[QString( QStringLiteral( "properties_%1_value" ) ).arg( i )] = paramIt.value().expressionString(); |
|
|
i++; |
|
|
} |
|
|
return serialized; |
|
|
} |
|
|
|
|
|
QMap<QString, QgsProperty> QgsSymbolLayerUtils::readSerializedProperties( const QMap<QString, QString> &serializedProperties ) |
|
|
{ |
|
|
QMap<QString, QgsProperty> properties; |
|
|
int i = 0; |
|
|
while ( true ) |
|
|
{ |
|
|
if ( !serializedProperties.contains( QString( QStringLiteral( "properties_%1_name" ) ).arg( i ) ) ) |
|
|
break; |
|
|
|
|
|
properties.insert( serializedProperties.value( QString( QStringLiteral( "properties_%1_name" ) ).arg( i ) ), |
|
|
QgsProperty::fromExpression( serializedProperties.value( QString( QStringLiteral( "properties_%1_value" ) ).arg( i ) ) ) ); |
|
|
i++; |
|
|
} |
|
|
return properties; |
|
|
} |
|
@@ -786,33 +786,6 @@ class CORE_EXPORT QgsSymbolLayerUtils |
|
|
* \since QGIS 3.18 |
|
|
*/ |
|
|
static QgsStringMap evaluatePropertiesMap( const QMap<QString, QgsProperty> &propertiesMap, const QgsExpressionContext &context ); |
|
|
|
|
|
/** |
|
|
* Serialize a map of properties |
|
|
* {"key1": "value1", "key2": "value2"} |
|
|
* becomes |
|
|
* { |
|
|
* "properties_0_name": "key1", "properties_0_value": "value1", |
|
|
* "properties_1_name": "key2", "properties_1_value": "value2", |
|
|
* } |
|
|
* \see readSerializedProperties |
|
|
* \since QGIS 3.18 |
|
|
*/ |
|
|
static QMap<QString, QString> serializeProperties( const QMap<QString, QgsProperty> &propertiesMap ); |
|
|
|
|
|
/** |
|
|
* Reads a serialized map of properties |
|
|
* It expects |
|
|
* { |
|
|
* "properties_0_name": "key1", "properties_0_value": "value1", |
|
|
* "properties_1_name": "key2", "properties_1_value": "value2", |
|
|
* } |
|
|
* which will return |
|
|
* {"key1": "value1", "key2": "value2"} |
|
|
* \see serializeProperties |
|
|
* \since QGIS 3.18 |
|
|
*/ |
|
|
static QMap<QString, QgsProperty> readSerializedProperties( const QMap<QString, QString> &serializedProperties ); |
|
|
}; |
|
|
|
|
|
class QPolygonF; |
|
|