24 : mLowerValue( range.lowerBound() )
25 , mUpperValue( range.upperBound() )
27 , mLabel( range.label() )
33 : mLowerValue( lowerValue )
34 , mUpperValue( upperValue )
41 : mLowerValue( range.mLowerValue )
42 , mUpperValue( range.mUpperValue )
43 , mSymbol( range.mSymbol ? range.mSymbol->clone() : nullptr )
44 , mLabel( range.mLabel )
45 , mRender( range.mRender )
131 if ( !
mSymbol || props.value( QStringLiteral(
"attribute" ), QString() ).toString().isEmpty() )
134 QString attrName = props[ QStringLiteral(
"attribute" )].toString();
136 QDomElement ruleElem = doc.createElement( QStringLiteral(
"se:Rule" ) );
137 element.appendChild( ruleElem );
139 QDomElement nameElem = doc.createElement( QStringLiteral(
"se:Name" ) );
140 nameElem.appendChild( doc.createTextNode(
mLabel ) );
141 ruleElem.appendChild( nameElem );
143 QDomElement descrElem = doc.createElement( QStringLiteral(
"se:Description" ) );
144 QDomElement titleElem = doc.createElement( QStringLiteral(
"se:Title" ) );
146 titleElem.appendChild( doc.createTextNode( !
mLabel.isEmpty() ?
mLabel : descrStr ) );
147 descrElem.appendChild( titleElem );
148 ruleElem.appendChild( descrElem );
151 QString filterFunc = QStringLiteral(
"\"%1\" %2 %3 AND \"%1\" <= %4" )
152 .arg( attrName.replace(
'\"', QLatin1String(
"\"\"" ) ),
153 firstRange ? QStringLiteral(
">=" ) : QStringLiteral(
">" ),
158 mSymbol->toSld( doc, ruleElem, props );
168 : mFormat( QStringLiteral(
"%1 - %2" ) )
169 , mReTrailingZeroes(
"[.,]?0*$" )
170 , mReNegativeZero(
"^\\-0(?:[.,]0*)?$" )
175 : mReTrailingZeroes(
"[.,]?0*$" )
176 , mReNegativeZero(
"^\\-0(?:[.,]0*)?$" )
194 return !( *
this == other );
221 QString valueStr = QLocale().toString( value,
'f',
mPrecision );
225 valueStr = valueStr.mid( 1 );
230 QString valueStr = QLocale().toString( value *
mNumberScale,
'f', 0 );
231 if ( valueStr == QLatin1String(
"-0" ) )
233 if ( valueStr != QLatin1String(
"0" ) )
245 return legend.replace( QLatin1String(
"%1" ), lowerStr ).replace( QLatin1String(
"%2" ), upperStr );
250 mFormat = element.attribute( QStringLiteral(
"format" ),
251 element.attribute( QStringLiteral(
"prefix" ), QStringLiteral(
" " ) ) +
"%1" +
252 element.attribute( QStringLiteral(
"separator" ), QStringLiteral(
" - " ) ) +
"%2" +
253 element.attribute( QStringLiteral(
"suffix" ), QStringLiteral(
" " ) )
255 setPrecision( element.attribute( QStringLiteral(
"decimalplaces" ), QStringLiteral(
"4" ) ).toInt() );
256 mTrimTrailingZeroes = element.attribute( QStringLiteral(
"trimtrailingzeroes" ), QStringLiteral(
"false" ) ) == QLatin1String(
"true" );
261 element.setAttribute( QStringLiteral(
"format" ),
mFormat );
262 element.setAttribute( QStringLiteral(
"decimalplaces" ),
mPrecision );
263 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)