26using namespace Qt::StringLiterals;
34 : mUseContinuousLegend( other.mUseContinuousLegend )
35 , mMinimumLabel( other.mMinimumLabel )
36 , mMaximumLabel( other.mMaximumLabel )
37 , mPrefix( other.mPrefix )
38 , mSuffix( other.mSuffix )
39 , mDirection( other.mDirection )
42 , mOrientation( other.mOrientation )
47 : mUseContinuousLegend( other.mUseContinuousLegend )
48 , mMinimumLabel( std::move( other.mMinimumLabel ) )
49 , mMaximumLabel( std::move( other.mMaximumLabel ) )
50 , mPrefix( std::move( other.mPrefix ) )
51 , mSuffix( std::move( other.mSuffix ) )
52 , mDirection( other.mDirection )
53 , mNumericFormat( std::move( other.mNumericFormat ) )
54 , mTextFormat( std::move( other.mTextFormat ) )
55 , mOrientation( other.mOrientation )
64 mUseContinuousLegend = other.mUseContinuousLegend;
65 mMinimumLabel = other.mMinimumLabel;
66 mMaximumLabel = other.mMaximumLabel;
67 mPrefix = other.mPrefix;
68 mSuffix = other.mSuffix;
69 mDirection = other.mDirection;
71 mTextFormat = other.mTextFormat;
72 mOrientation = other.mOrientation;
82 mUseContinuousLegend = other.mUseContinuousLegend;
83 mMinimumLabel = std::move( other.mMinimumLabel );
84 mMaximumLabel = std::move( other.mMaximumLabel );
85 mPrefix = std::move( other.mPrefix );
86 mSuffix = std::move( other.mSuffix );
87 mDirection = other.mDirection;
88 mNumericFormat = std::move( other.mNumericFormat );
89 mTextFormat = std::move( other.mTextFormat );
90 mOrientation = other.mOrientation;
108 return mMinimumLabel;
113 mMinimumLabel = label;
118 return mMaximumLabel;
123 mMaximumLabel = label;
128 return mNumericFormat.get();
133 mNumericFormat.reset( format );
138 QDomElement settingsElement = doc.createElement( u
"rampLegendSettings"_s );
140 settingsElement.setAttribute( u
"useContinuousLegend"_s, mUseContinuousLegend );
141 settingsElement.setAttribute( u
"minimumLabel"_s, mMinimumLabel );
142 settingsElement.setAttribute( u
"maximumLabel"_s, mMaximumLabel );
143 settingsElement.setAttribute( u
"prefix"_s, mPrefix );
144 settingsElement.setAttribute( u
"suffix"_s, mSuffix );
145 settingsElement.setAttribute( u
"direction"_s,
static_cast< int >( mDirection ) );
146 settingsElement.setAttribute( u
"orientation"_s,
static_cast< int >( mOrientation ) );
148 QDomElement numericFormatElem = doc.createElement( u
"numericFormat"_s );
149 mNumericFormat->
writeXml( numericFormatElem, doc, context );
150 settingsElement.appendChild( numericFormatElem );
152 if ( mTextFormat.isValid() )
154 settingsElement.appendChild( mTextFormat.writeXml( doc, context ) );
157 element.appendChild( settingsElement );
162 const QDomElement settingsElement = element.firstChildElement( u
"rampLegendSettings"_s );
163 if ( !settingsElement.isNull() )
165 mUseContinuousLegend = settingsElement.attribute( u
"useContinuousLegend"_s, u
"1"_s ).toInt();
166 mMinimumLabel = settingsElement.attribute( u
"minimumLabel"_s );
167 mMaximumLabel = settingsElement.attribute( u
"maximumLabel"_s );
168 mPrefix = settingsElement.attribute( u
"prefix"_s );
169 mSuffix = settingsElement.attribute( u
"suffix"_s );
171 mOrientation =
static_cast< Qt::Orientation
>( settingsElement.attribute( u
"orientation"_s, QString::number( Qt::Vertical ) ).toInt() );
173 const QDomNodeList numericFormatNodeList = settingsElement.elementsByTagName( u
"numericFormat"_s );
174 if ( !numericFormatNodeList.isEmpty() )
176 const QDomElement numericFormatElem = numericFormatNodeList.at( 0 ).toElement();
180 if ( !settingsElement.firstChildElement( u
"text-style"_s ).isNull() )
182 mTextFormat.readXml( settingsElement, context );
218 mTextFormat = format;
233 return mUseContinuousLegend;
static QgsNumericFormatRegistry * numericFormatRegistry()
Gets the registry of available numeric formats.
void setDirection(QgsColorRampLegendNodeSettings::Direction direction)
Sets the direction of the ramp.
QgsColorRampLegendNodeSettings & operator=(const QgsColorRampLegendNodeSettings &other)
void setMaximumLabel(const QString &label)
Sets the label for the maximum value on the ramp.
void setNumericFormat(QgsNumericFormat *format)
Sets the numeric format used for numbers in the scalebar.
bool useContinuousLegend() const
Returns true if a continuous gradient legend will be used.
void readXml(const QDomElement &element, const QgsReadWriteContext &context)
Reads settings from an XML element.
void writeXml(QDomDocument &doc, QDomElement &element, const QgsReadWriteContext &context) const
Writes settings to an XML element.
const QgsNumericFormat * numericFormat() const
Returns the numeric format used for numbers in the scalebar.
QString maximumLabel() const
Returns the label for the maximum value on the ramp.
QString suffix() const
Returns the suffix to show after legend text.
void setPrefix(const QString &prefix)
Sets the prefix to show before legend text.
QgsColorRampLegendNodeSettings()
void setUseContinuousLegend(bool useContinuousLegend)
Sets the flag to use a continuous gradient legend to useContinuousLegend.
void setOrientation(Qt::Orientation orientation)
Sets the ramp orientation (i.e.
Direction
Ramp directions.
void setSuffix(const QString &suffix)
Sets the suffix to show after legend text.
QString prefix() const
Returns the prefix to show before legend text.
Qt::Orientation orientation() const
Returns the ramp orientation (i.e.
QgsColorRampLegendNodeSettings::Direction direction() const
Returns the direction of the ramp.
QgsTextFormat textFormat() const
Returns the text format used to render text in the legend item.
~QgsColorRampLegendNodeSettings()
void setMinimumLabel(const QString &label)
Sets the label for the minimum value on the ramp.
void setTextFormat(const QgsTextFormat &format)
Sets the text format used to render text in the legend item.
QString minimumLabel() const
Returns the label for the minimum value on the ramp.
A container for the context for various read/write operations on objects.
Container for all settings relating to text rendering.