31 : mUseContinuousLegend( other.mUseContinuousLegend )
32 , mMinimumLabel( other.mMinimumLabel )
33 , mMaximumLabel( other.mMaximumLabel )
34 , mPrefix( other.mPrefix )
35 , mSuffix( other.mSuffix )
36 , mDirection( other.mDirection )
39 , mOrientation( other.mOrientation )
46 : mUseContinuousLegend( other.mUseContinuousLegend )
47 , mMinimumLabel( std::move( other.mMinimumLabel ) )
48 , mMaximumLabel( std::move( other.mMaximumLabel ) )
49 , mPrefix( std::move( other.mPrefix ) )
50 , mSuffix( std::move( other.mSuffix ) )
51 , mDirection( other.mDirection )
52 , mNumericFormat( std::move( other.mNumericFormat ) )
53 , mTextFormat( std::move( other.mTextFormat ) )
54 , mOrientation( other.mOrientation )
65 mUseContinuousLegend = other.mUseContinuousLegend;
66 mMinimumLabel = other.mMinimumLabel;
67 mMaximumLabel = other.mMaximumLabel;
68 mPrefix = other.mPrefix;
69 mSuffix = other.mSuffix;
70 mDirection = other.mDirection;
72 mTextFormat = other.mTextFormat;
73 mOrientation = other.mOrientation;
83 mUseContinuousLegend = other.mUseContinuousLegend;
84 mMinimumLabel = std::move( other.mMinimumLabel );
85 mMaximumLabel = std::move( other.mMaximumLabel );
86 mPrefix = std::move( other.mPrefix );
87 mSuffix = std::move( other.mSuffix );
88 mDirection = other.mDirection;
89 mNumericFormat = std::move( other.mNumericFormat );
90 mTextFormat = std::move( other.mTextFormat );
91 mOrientation = other.mOrientation;
109 return mMinimumLabel;
114 mMinimumLabel = label;
119 return mMaximumLabel;
124 mMaximumLabel = label;
129 return mNumericFormat.get();
134 mNumericFormat.reset( format );
139 QDomElement settingsElement = doc.createElement( QStringLiteral(
"rampLegendSettings" ) );
141 settingsElement.setAttribute( QStringLiteral(
"useContinuousLegend" ), mUseContinuousLegend );
142 settingsElement.setAttribute( QStringLiteral(
"minimumLabel" ), mMinimumLabel );
143 settingsElement.setAttribute( QStringLiteral(
"maximumLabel" ), mMaximumLabel );
144 settingsElement.setAttribute( QStringLiteral(
"prefix" ), mPrefix );
145 settingsElement.setAttribute( QStringLiteral(
"suffix" ), mSuffix );
146 settingsElement.setAttribute( QStringLiteral(
"direction" ),
static_cast< int >( mDirection ) );
147 settingsElement.setAttribute( QStringLiteral(
"orientation" ),
static_cast< int >( mOrientation ) );
149 QDomElement numericFormatElem = doc.createElement( QStringLiteral(
"numericFormat" ) );
150 mNumericFormat->
writeXml( numericFormatElem, doc, context );
151 settingsElement.appendChild( numericFormatElem );
153 if ( mTextFormat.isValid() )
155 settingsElement.appendChild( mTextFormat.writeXml( doc, context ) );
158 element.appendChild( settingsElement );
163 const QDomElement settingsElement = element.firstChildElement( QStringLiteral(
"rampLegendSettings" ) );
164 if ( !settingsElement.isNull() )
166 mUseContinuousLegend = settingsElement.attribute( QStringLiteral(
"useContinuousLegend" ), QStringLiteral(
"1" ) ).toInt( );
167 mMinimumLabel = settingsElement.attribute( QStringLiteral(
"minimumLabel" ) );
168 mMaximumLabel = settingsElement.attribute( QStringLiteral(
"maximumLabel" ) );
169 mPrefix = settingsElement.attribute( QStringLiteral(
"prefix" ) );
170 mSuffix = settingsElement.attribute( QStringLiteral(
"suffix" ) );
172 mOrientation =
static_cast< Qt::Orientation
>( settingsElement.attribute( QStringLiteral(
"orientation" ), QString::number( Qt::Vertical ) ).toInt() );
174 const QDomNodeList numericFormatNodeList = settingsElement.elementsByTagName( QStringLiteral(
"numericFormat" ) );
175 if ( !numericFormatNodeList.isEmpty() )
177 const QDomElement numericFormatElem = numericFormatNodeList.at( 0 ).toElement();
181 if ( !settingsElement.firstChildElement( QStringLiteral(
"text-style" ) ).isNull() )
183 mTextFormat.readXml( settingsElement, context );
219 mTextFormat = format;
234 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.