25 : mLowerValue( range.lowerBound() )
26 , mUpperValue( range.upperBound() )
28 , mLabel( range.label() )
31 mUuid = !
uuid.isEmpty() ?
uuid : QUuid::createUuid().toString();
35 : mLowerValue( lowerValue )
36 , mUpperValue( upperValue )
41 mUuid = !
uuid.isEmpty() ?
uuid : QUuid::createUuid().toString();
45 : mLowerValue( range.mLowerValue )
46 , mUpperValue( range.mUpperValue )
47 , mSymbol( range.mSymbol ? range.mSymbol->clone() : nullptr )
48 , mLabel( range.mLabel )
49 , mRender( range.mRender )
50 , mUuid( range.mUuid )
135 if ( !
mSymbol || props.value( QStringLiteral(
"attribute" ), QString() ).toString().isEmpty() )
138 QString attrName = props[ QStringLiteral(
"attribute" )].toString();
140 QDomElement ruleElem = doc.createElement( QStringLiteral(
"se:Rule" ) );
141 element.appendChild( ruleElem );
143 QDomElement nameElem = doc.createElement( QStringLiteral(
"se:Name" ) );
144 nameElem.appendChild( doc.createTextNode(
mLabel ) );
145 ruleElem.appendChild( nameElem );
147 QDomElement descrElem = doc.createElement( QStringLiteral(
"se:Description" ) );
148 QDomElement titleElem = doc.createElement( QStringLiteral(
"se:Title" ) );
150 titleElem.appendChild( doc.createTextNode( !
mLabel.isEmpty() ?
mLabel : descrStr ) );
151 descrElem.appendChild( titleElem );
152 ruleElem.appendChild( descrElem );
155 QString filterFunc = QStringLiteral(
"\"%1\" %2 %3 AND \"%1\" <= %4" )
156 .arg( attrName.replace(
'\"', QLatin1String(
"\"\"" ) ),
157 firstRange ? QStringLiteral(
">=" ) : QStringLiteral(
">" ),
162 mSymbol->toSld( doc, ruleElem, props );
172 : mFormat( QStringLiteral(
"%1 - %2" ) )
173 , mReTrailingZeroes(
"[.,]?0*$" )
174 , mReNegativeZero(
"^\\-0(?:[.,]0*)?$" )
179 : mReTrailingZeroes(
"[.,]?0*$" )
180 , mReNegativeZero(
"^\\-0(?:[.,]0*)?$" )
198 return !( *
this == other );
225 QString valueStr = QLocale().toString( value,
'f',
mPrecision );
229 valueStr = valueStr.mid( 1 );
234 QString valueStr = QLocale().toString( value *
mNumberScale,
'f', 0 );
235 if ( valueStr == QLatin1String(
"-0" ) )
237 if ( valueStr != QLatin1String(
"0" ) )
249 return legend.replace( QLatin1String(
"%1" ), lowerStr ).replace( QLatin1String(
"%2" ), upperStr );
254 mFormat = element.attribute( QStringLiteral(
"format" ),
255 element.attribute( QStringLiteral(
"prefix" ), QStringLiteral(
" " ) ) +
"%1" +
256 element.attribute( QStringLiteral(
"separator" ), QStringLiteral(
" - " ) ) +
"%2" +
257 element.attribute( QStringLiteral(
"suffix" ), QStringLiteral(
" " ) )
259 setPrecision( element.attribute( QStringLiteral(
"decimalplaces" ), QStringLiteral(
"4" ) ).toInt() );
260 mTrimTrailingZeroes = element.attribute( QStringLiteral(
"trimtrailingzeroes" ), QStringLiteral(
"false" ) ) == QLatin1String(
"true" );
265 element.setAttribute( QStringLiteral(
"format" ),
mFormat );
266 element.setAttribute( QStringLiteral(
"decimalplaces" ),
mPrecision );
267 element.setAttribute( QStringLiteral(
"trimtrailingzeroes" ),
mTrimTrailingZeroes ? QStringLiteral(
"true" ) : QStringLiteral(
"false" ) );
QgsClassificationRange contains the information about a classification range.
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
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
static bool createFunctionElement(QDomDocument &doc, QDomElement &element, const QString &function)
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)