32 mUuid = !
uuid.isEmpty() ?
uuid : QUuid::createUuid().toString();
42 mUuid = !
uuid.isEmpty() ?
uuid : QUuid::createUuid().toString();
141 toSld( doc, element, props.value( QStringLiteral(
"attribute" ), QString() ).toString(), context, firstRange );
146 if ( !
mSymbol || classAttribute.isEmpty() )
149 QString attrName = classAttribute;
151 QDomElement ruleElem = doc.createElement( QStringLiteral(
"se:Rule" ) );
153 QDomElement nameElem = doc.createElement( QStringLiteral(
"se:Name" ) );
154 nameElem.appendChild( doc.createTextNode(
mLabel ) );
155 ruleElem.appendChild( nameElem );
157 QDomElement descrElem = doc.createElement( QStringLiteral(
"se:Description" ) );
158 QDomElement titleElem = doc.createElement( QStringLiteral(
"se:Title" ) );
160 titleElem.appendChild( doc.createTextNode( !
mLabel.isEmpty() ?
mLabel : descrStr ) );
161 descrElem.appendChild( titleElem );
162 ruleElem.appendChild( descrElem );
165 QString filterFunc = QStringLiteral(
"\"%1\" %2 %3 AND \"%1\" <= %4" )
166 .arg( attrName.replace(
'\"', QLatin1String(
"\"\"" ) ),
167 firstRange ? QStringLiteral(
">=" ) : QStringLiteral(
">" ),
172 mSymbol->toSld( doc, ruleElem, context );
180 element.appendChild( ruleElem );
191 :
mFormat( QStringLiteral(
"%1 - %2" ) )
217 return !( *
this == other );
244 QString valueStr = QLocale().toString( value,
'f',
mPrecision );
248 valueStr = valueStr.mid( 1 );
253 QString valueStr = QLocale().toString( value *
mNumberScale,
'f', 0 );
254 if ( valueStr == QLatin1String(
"-0" ) )
256 if ( valueStr != QLatin1String(
"0" ) )
268 return legend.replace( QLatin1String(
"%1" ), lowerStr ).replace( QLatin1String(
"%2" ), upperStr );
273 mFormat = element.attribute( QStringLiteral(
"format" ),
274 element.attribute( QStringLiteral(
"prefix" ), QStringLiteral(
" " ) ) +
"%1" +
275 element.attribute( QStringLiteral(
"separator" ), QStringLiteral(
" - " ) ) +
"%2" +
276 element.attribute( QStringLiteral(
"suffix" ), QStringLiteral(
" " ) )
278 setPrecision( element.attribute( QStringLiteral(
"decimalplaces" ), QStringLiteral(
"4" ) ).toInt() );
279 mTrimTrailingZeroes = element.attribute( QStringLiteral(
"trimtrailingzeroes" ), QStringLiteral(
"false" ) ) == QLatin1String(
"true" );
284 element.setAttribute( QStringLiteral(
"format" ),
mFormat );
285 element.setAttribute( QStringLiteral(
"decimalplaces" ),
mPrecision );
286 element.setAttribute( QStringLiteral(
"trimtrailingzeroes" ),
mTrimTrailingZeroes ? QStringLiteral(
"true" ) : QStringLiteral(
"false" ) );
Contains the information about a classification range.
Represents a value range for a QgsGraduatedSymbolRenderer.
void setUpperValue(double upperValue)
Sets the upper bound of the range.
QgsRendererRange()=default
QString label() const
Returns the label used for the range.
void setSymbol(QgsSymbol *s)
Sets the symbol used for the range.
std::unique_ptr< QgsSymbol > mSymbol
Q_DECL_DEPRECATED void toSld(QDomDocument &doc, QDomElement &element, QVariantMap props, bool firstRange=false) const
Creates a DOM element representing the range in SLD format.
QgsRendererRange & operator=(QgsRendererRange range)
QgsSymbol * symbol() const
Returns the symbol used for the range.
void setLabel(const QString &label)
Sets the label used for the range.
bool renderState() const
Returns true if the range should be rendered.
void setRenderState(bool render)
Sets whether the range should be rendered.
QString dump() const
Dumps a string representation of the range.
double upperValue() const
Returns the upper bound of the range.
void setLowerValue(double lowerValue)
Sets the lower bound of the range.
QString uuid() const
Returns the unique identifier for this range.
double lowerValue() const
Returns the lower bound of the range.
bool operator<(const QgsRendererRange &other) const
Holds SLD export options and other information related to SLD export of a QGIS layer style.
void setExtraProperties(const QVariantMap &properties)
Sets the open ended set of properties that can drive/inform the SLD encoding.
static Q_DECL_DEPRECATED bool createFunctionElement(QDomDocument &doc, QDomElement &element, const QString &function)
Creates an OGC function element.
static bool hasSldSymbolizer(const QDomElement &element)
Returns true if a DOM element contains an SLD Symbolizer element.
Abstract base class for all rendered symbols.
QString qgsDoubleToString(double a, int precision=17)
Returns a string representation of a double.
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference).