23 : mLowerValue( range.lowerBound() )
24 , mUpperValue( range.upperBound() )
26 , mLabel( range.label() )
32 : mLowerValue( lowerValue )
33 , mUpperValue( upperValue )
40 : mLowerValue( range.mLowerValue )
41 , mUpperValue( range.mUpperValue )
42 , mSymbol( range.mSymbol ? range.mSymbol->clone() : nullptr )
43 , mLabel( range.mLabel )
44 , mRender( range.mRender )
130 if ( !
mSymbol || props.value( QStringLiteral(
"attribute" ), QString() ).toString().isEmpty() )
133 QString attrName = props[ QStringLiteral(
"attribute" )].toString();
135 QDomElement ruleElem = doc.createElement( QStringLiteral(
"se:Rule" ) );
136 element.appendChild( ruleElem );
138 QDomElement nameElem = doc.createElement( QStringLiteral(
"se:Name" ) );
139 nameElem.appendChild( doc.createTextNode(
mLabel ) );
140 ruleElem.appendChild( nameElem );
142 QDomElement descrElem = doc.createElement( QStringLiteral(
"se:Description" ) );
143 QDomElement titleElem = doc.createElement( QStringLiteral(
"se:Title" ) );
145 titleElem.appendChild( doc.createTextNode( !
mLabel.isEmpty() ?
mLabel : descrStr ) );
146 descrElem.appendChild( titleElem );
147 ruleElem.appendChild( descrElem );
150 QString filterFunc = QStringLiteral(
"\"%1\" %2 %3 AND \"%1\" <= %4" )
151 .arg( attrName.replace(
'\"', QLatin1String(
"\"\"" ) ),
152 firstRange ? QStringLiteral(
">=" ) : QStringLiteral(
">" ),
157 mSymbol->toSld( doc, ruleElem, props );
167 : mFormat( QStringLiteral(
"%1 - %2" ) )
168 , mReTrailingZeroes(
"[.,]?0*$" )
169 , mReNegativeZero(
"^\\-0(?:[.,]0*)?$" )
174 : mReTrailingZeroes(
"[.,]?0*$" )
175 , mReNegativeZero(
"^\\-0(?:[.,]0*)?$" )
193 return !( *
this == other );
220 QString valueStr = QLocale().toString( value,
'f',
mPrecision );
224 valueStr = valueStr.mid( 1 );
229 QString valueStr = QLocale().toString( value *
mNumberScale,
'f', 0 );
230 if ( valueStr == QLatin1String(
"-0" ) )
232 if ( valueStr != QLatin1String(
"0" ) )
244 return legend.replace( QLatin1String(
"%1" ), lowerStr ).replace( QLatin1String(
"%2" ), upperStr );
249 mFormat = element.attribute( QStringLiteral(
"format" ),
250 element.attribute( QStringLiteral(
"prefix" ), QStringLiteral(
" " ) ) +
"%1" +
251 element.attribute( QStringLiteral(
"separator" ), QStringLiteral(
" - " ) ) +
"%2" +
252 element.attribute( QStringLiteral(
"suffix" ), QStringLiteral(
" " ) )
254 setPrecision( element.attribute( QStringLiteral(
"decimalplaces" ), QStringLiteral(
"4" ) ).toInt() );
255 mTrimTrailingZeroes = element.attribute( QStringLiteral(
"trimtrailingzeroes" ), QStringLiteral(
"false" ) ) == QLatin1String(
"true" );
260 element.setAttribute( QStringLiteral(
"format" ),
mFormat );
261 element.setAttribute( QStringLiteral(
"decimalplaces" ),
mPrecision );
262 element.setAttribute( QStringLiteral(
"trimtrailingzeroes" ),
mTrimTrailingZeroes ? QStringLiteral(
"true" ) : QStringLiteral(
"false" ) );
QgsClassificationRange contains the information about a classification range.
void setUpperValue(double upperValue)
QgsRendererRange()=default
Constructor for QgsRendererRange.
void setSymbol(QgsSymbol *s)
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
void setLabel(const QString &label)
void setRenderState(bool render)
double upperValue() const
void setLowerValue(double lowerValue)
double lowerValue() const
bool operator<(const QgsRendererRange &other) const
void swap(QgsRendererRange &other)
static bool createFunctionElement(QDomDocument &doc, QDomElement &element, const QString &function)
Abstract base class for all rendered symbols.
int ANALYSIS_EXPORT lower(int n, int i)
Lower function.
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)