21 : mLowerValue( range.lowerBound() )
22 , mUpperValue( range.upperBound() )
24 , mLabel( range.label() )
125 if ( !
mSymbol || props.value( QStringLiteral(
"attribute" ), QString() ).isEmpty() )
128 QString attrName = props[ QStringLiteral(
"attribute" )];
130 QDomElement ruleElem = doc.createElement( QStringLiteral(
"se:Rule" ) );
131 element.appendChild( ruleElem );
133 QDomElement nameElem = doc.createElement( QStringLiteral(
"se:Name" ) );
134 nameElem.appendChild( doc.createTextNode(
mLabel ) );
135 ruleElem.appendChild( nameElem );
137 QDomElement descrElem = doc.createElement( QStringLiteral(
"se:Description" ) );
138 QDomElement titleElem = doc.createElement( QStringLiteral(
"se:Title" ) );
140 titleElem.appendChild( doc.createTextNode( !
mLabel.isEmpty() ?
mLabel : descrStr ) );
141 descrElem.appendChild( titleElem );
142 ruleElem.appendChild( descrElem );
145 QString filterFunc = QStringLiteral(
"\"%1\" %2 %3 AND \"%1\" <= %4" )
146 .arg( attrName.replace(
'\"', QLatin1String(
"\"\"" ) ),
147 firstRange ? QStringLiteral(
">=" ) : QStringLiteral(
">" ),
152 mSymbol->toSld( doc, ruleElem, props );
162 : mFormat( QStringLiteral(
"%1 - %2" ) )
163 , mReTrailingZeroes(
"[.,]?0*$" )
164 , mReNegativeZero(
"^\\-0(?:[.,]0*)?$" )
188 return !( *
this == other );
198 while ( precision < 0 )
215 QString valueStr = QLocale().toString( value,
'f',
mPrecision );
219 valueStr = valueStr.mid( 1 );
224 QString valueStr = QLocale().toString( value *
mNumberScale,
'f', 0 );
225 if ( valueStr == QLatin1String(
"-0" ) )
227 if ( valueStr != QLatin1String(
"0" ) )
239 return legend.replace( QLatin1String(
"%1" ), lowerStr ).replace( QLatin1String(
"%2" ), upperStr );
244 mFormat = element.attribute( QStringLiteral(
"format" ),
245 element.attribute( QStringLiteral(
"prefix" ), QStringLiteral(
" " ) ) +
"%1" +
246 element.attribute( QStringLiteral(
"separator" ), QStringLiteral(
" - " ) ) +
"%2" +
247 element.attribute( QStringLiteral(
"suffix" ), QStringLiteral(
" " ) )
249 setPrecision( element.attribute( QStringLiteral(
"decimalplaces" ), QStringLiteral(
"4" ) ).toInt() );
250 mTrimTrailingZeroes = element.attribute( QStringLiteral(
"trimtrailingzeroes" ), QStringLiteral(
"false" ) ) == QLatin1String(
"true" );
255 element.setAttribute( QStringLiteral(
"format" ),
mFormat );
256 element.setAttribute( QStringLiteral(
"decimalplaces" ),
mPrecision );
257 element.setAttribute( QStringLiteral(
"trimtrailingzeroes" ),
mTrimTrailingZeroes ? QStringLiteral(
"true" ) : QStringLiteral(
"false" ) );
static bool createFunctionElement(QDomDocument &doc, QDomElement &element, const QString &function)
Abstract base class for all rendered symbols.
void setLabel(const QString &label)
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
QgsClassificationRange contains the information about a classification range.
void setRenderState(bool render)
QgsRendererRange & operator=(QgsRendererRange range)
bool operator<(const QgsRendererRange &other) const
void setUpperValue(double upperValue)
QMap< QString, QString > QgsStringMap
double lowerValue() const
void setLowerValue(double lowerValue)
QString qgsDoubleToString(double a, int precision=17)
Returns a string representation of a double.
QgsSymbol * symbol() const
void swap(QgsRendererRange &other)
QgsRendererRange()=default
Constructor for QgsRendererRange.
void setSymbol(QgsSymbol *s)
void toSld(QDomDocument &doc, QDomElement &element, QgsStringMap props, bool firstRange=false) const
Creates a DOM element representing the range in SLD format.
double upperValue() const
std::unique_ptr< QgsSymbol > mSymbol
int ANALYSIS_EXPORT lower(int n, int i)
Lower function.