29 : mUseContinuousLegend( other.mUseContinuousLegend )
30 , mMinimumLabel( other.mMinimumLabel )
31 , mMaximumLabel( other.mMaximumLabel )
32 , mPrefix( other.mPrefix )
33 , mSuffix( other.mSuffix )
34 , mDirection( other.mDirection )
35 , mNumericFormat( other.numericFormat()->clone() )
36 , mTextFormat( other.textFormat() )
37 , mOrientation( other.mOrientation )
44 mUseContinuousLegend = other.mUseContinuousLegend;
45 mMinimumLabel = other.mMinimumLabel;
46 mMaximumLabel = other.mMaximumLabel;
47 mPrefix = other.mPrefix;
48 mSuffix = other.mSuffix;
49 mDirection = other.mDirection;
51 mTextFormat = other.mTextFormat;
52 mOrientation = other.mOrientation;
75 mMinimumLabel = label;
85 mMaximumLabel = label;
90 return mNumericFormat.get();
95 mNumericFormat.reset( format );
100 QDomElement settingsElement = doc.createElement( QStringLiteral(
"rampLegendSettings" ) );
102 settingsElement.setAttribute( QStringLiteral(
"useContinuousLegend" ), mUseContinuousLegend );
103 settingsElement.setAttribute( QStringLiteral(
"minimumLabel" ), mMinimumLabel );
104 settingsElement.setAttribute( QStringLiteral(
"maximumLabel" ), mMaximumLabel );
105 settingsElement.setAttribute( QStringLiteral(
"prefix" ), mPrefix );
106 settingsElement.setAttribute( QStringLiteral(
"suffix" ), mSuffix );
107 settingsElement.setAttribute( QStringLiteral(
"direction" ),
static_cast< int >( mDirection ) );
108 settingsElement.setAttribute( QStringLiteral(
"orientation" ),
static_cast< int >( mOrientation ) );
110 QDomElement numericFormatElem = doc.createElement( QStringLiteral(
"numericFormat" ) );
111 mNumericFormat->writeXml( numericFormatElem, doc, context );
112 settingsElement.appendChild( numericFormatElem );
116 settingsElement.appendChild( mTextFormat.
writeXml( doc, context ) );
119 element.appendChild( settingsElement );
124 const QDomElement settingsElement = element.firstChildElement( QStringLiteral(
"rampLegendSettings" ) );
125 if ( !settingsElement.isNull() )
127 mUseContinuousLegend = settingsElement.attribute( QStringLiteral(
"useContinuousLegend" ), QStringLiteral(
"1" ) ).toInt( );
128 mMinimumLabel = settingsElement.attribute( QStringLiteral(
"minimumLabel" ) );
129 mMaximumLabel = settingsElement.attribute( QStringLiteral(
"maximumLabel" ) );
130 mPrefix = settingsElement.attribute( QStringLiteral(
"prefix" ) );
131 mSuffix = settingsElement.attribute( QStringLiteral(
"suffix" ) );
133 mOrientation =
static_cast< Qt::Orientation
>( settingsElement.attribute( QStringLiteral(
"orientation" ), QString::number( Qt::Vertical ) ).toInt() );
135 QDomNodeList numericFormatNodeList = settingsElement.elementsByTagName( QStringLiteral(
"numericFormat" ) );
136 if ( !numericFormatNodeList.isEmpty() )
138 QDomElement numericFormatElem = numericFormatNodeList.at( 0 ).toElement();
142 if ( !settingsElement.firstChildElement( QStringLiteral(
"text-style" ) ).isNull() )
144 mTextFormat.
readXml( settingsElement, context );
180 mTextFormat = format;
195 return mUseContinuousLegend;
static QgsNumericFormatRegistry * numericFormatRegistry()
Gets the registry of available numeric formats.
Settings for a color ramp legend node.
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 continuos 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.
The class is used as a container of context for various read/write operations on other objects.
Container for all settings relating to text rendering.
void readXml(const QDomElement &elem, const QgsReadWriteContext &context)
Read settings from a DOM element.
bool isValid() const
Returns true if the format is valid.
QDomElement writeXml(QDomDocument &doc, const QgsReadWriteContext &context) const
Write settings into a DOM element.