35#include <QInputDialog>
49 mLoadFromBandButton->setVisible(
false );
51 connect( mAddEntryButton, &QPushButton::clicked,
this, &QgsColorRampShaderWidget::mAddEntryButton_clicked );
52 connect( mDeleteEntryButton, &QPushButton::clicked,
this, &QgsColorRampShaderWidget::mDeleteEntryButton_clicked );
53 connect( mLoadFromBandButton, &QPushButton::clicked,
this, &QgsColorRampShaderWidget::mLoadFromBandButton_clicked );
54 connect( mLoadFromFileButton, &QPushButton::clicked,
this, &QgsColorRampShaderWidget::mLoadFromFileButton_clicked );
55 connect( mExportToFileButton, &QPushButton::clicked,
this, &QgsColorRampShaderWidget::mExportToFileButton_clicked );
56 connect( mUnitLineEdit, &QLineEdit::textEdited,
this, &QgsColorRampShaderWidget::mUnitLineEdit_textEdited );
57 connect( mColormapTreeWidget, &QTreeWidget::itemDoubleClicked,
this, &QgsColorRampShaderWidget::mColormapTreeWidget_itemDoubleClicked );
58 connect( mColorInterpolationComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsColorRampShaderWidget::mColorInterpolationComboBox_currentIndexChanged );
59 connect( mClassificationModeComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsColorRampShaderWidget::mClassificationModeComboBox_currentIndexChanged );
61 connect( mLegendSettingsButton, &QPushButton::clicked,
this, &QgsColorRampShaderWidget::showLegendSettings );
63 contextMenu =
new QMenu( tr(
"Options" ),
this );
64 contextMenu->addAction( tr(
"Change Color…" ),
this, SLOT( changeColor() ) );
65 contextMenu->addAction( tr(
"Change Opacity…" ),
this, SLOT( changeOpacity() ) );
69 mColormapTreeWidget->setItemDelegateForColumn( ValueColumn, mValueDelegate );
71 mColormapTreeWidget->setColumnWidth( ColorColumn,
Qgis::UI_SCALE_FACTOR * fontMetrics().horizontalAdvance(
'X' ) * 6.6 );
73 mColormapTreeWidget->setContextMenuPolicy( Qt::CustomContextMenu );
74 mColormapTreeWidget->setSelectionMode( QAbstractItemView::ExtendedSelection );
75 connect( mColormapTreeWidget, &QTreeView::customContextMenuRequested,
this, [ = ]( QPoint ) { contextMenu->exec( QCursor::pos() ); } );
77 QString defaultPalette = settings.
value( QStringLiteral(
"Raster/defaultPalette" ),
"" ).toString();
78 btnColorRamp->setColorRampFromName( defaultPalette );
90 mNumberOfEntriesSpinBox->setValue( 5 );
92 mClassificationModeComboBox_currentIndexChanged( 0 );
94 resetClassifyButton();
102 connect( mLabelPrecisionSpinBox, qOverload<int>( &QSpinBox::valueChanged ),
this, [ = ](
int )
106 if ( !mBlockChanges )
119 mRasterDataProvider = dp;
120 mLoadFromBandButton->setVisible(
static_cast< bool>( mRasterDataProvider ) );
131 mLabelPrecisionSpinBox->setMaximum( maxDigits );
132 mValueDelegate->setDataType( dataType );
146 colorRampShader.
setClip( mClipCheckBox->isChecked() );
149 QList<QgsColorRampShader::ColorRampItem> colorRampItems;
150 int topLevelItemCount = mColormapTreeWidget->topLevelItemCount();
151 QTreeWidgetItem *currentItem =
nullptr;
152 for (
int i = 0; i < topLevelItemCount; ++i )
154 currentItem = mColormapTreeWidget->topLevelItem( i );
160 newColorRampItem.
value = currentItem->data( ValueColumn, Qt::ItemDataRole::DisplayRole ).toDouble();
161 newColorRampItem.
color = currentItem->data( ColorColumn, Qt::ItemDataRole::EditRole ).value<QColor>();
162 newColorRampItem.
label = currentItem->text( LabelColumn );
163 colorRampItems.append( newColorRampItem );
166 std::sort( colorRampItems.begin(), colorRampItems.end() );
169 if ( !btnColorRamp->isNull() )
175 return colorRampShader;
178void QgsColorRampShaderWidget::autoLabel()
180 mColormapTreeWidget->sortItems( ValueColumn, Qt::AscendingOrder );
186 const QString unit = mUnitLineEdit->text();
187 int topLevelItemCount = mColormapTreeWidget->topLevelItemCount();
189 QTreeWidgetItem *currentItem =
nullptr;
190 for (
int i = 0; i < topLevelItemCount; ++i )
192 currentItem = mColormapTreeWidget->topLevelItem( i );
194 if ( !currentItem || currentItem->data( ValueColumn, Qt::ItemDataRole::DisplayRole ).toString().isEmpty() )
199 const QString lbl = createLabel( currentItem, i, unit );
201 if ( currentItem->text( LabelColumn ).isEmpty() || currentItem->text( LabelColumn ) == lbl || currentItem->foreground( LabelColumn ).color() == QColor( Qt::gray ) )
203 currentItem->setText( LabelColumn, lbl );
204 currentItem->setForeground( LabelColumn, QBrush( QColor( Qt::gray ) ) );
210void QgsColorRampShaderWidget::setUnitFromLabels()
212 QStringList allSuffixes;
214 int topLevelItemCount = mColormapTreeWidget->topLevelItemCount();
215 QTreeWidgetItem *currentItem =
nullptr;
216 for (
int i = 0; i < topLevelItemCount; ++i )
218 currentItem = mColormapTreeWidget->topLevelItem( i );
220 if ( !currentItem || currentItem->text( ValueColumn ).isEmpty() )
225 label = createLabel( currentItem, i, QString() );
227 if ( currentItem->text( LabelColumn ).startsWith( label ) )
229 allSuffixes.append( currentItem->text( LabelColumn ).mid( label.length() ) );
233 QStringList suffixes = QStringList( allSuffixes );
234 suffixes.removeDuplicates();
237 for (
int i = 0; i < suffixes.count(); ++i )
239 int n = allSuffixes.count( suffixes[i] );
249 mUnitLineEdit->setText( unit );
254void QgsColorRampShaderWidget::dumpClasses()
256 for (
int row = 0; row < mColormapTreeWidget->model()->rowCount(); ++row )
258 const auto labelData { mColormapTreeWidget->model()->itemData( mColormapTreeWidget->model()->index( row, LabelColumn ) ) };
259 const auto valueData { mColormapTreeWidget->model()->itemData( mColormapTreeWidget->model()->index( row, ValueColumn ) ) };
261 .arg( labelData[ Qt::ItemDataRole::DisplayRole ].toString(),
262 valueData[ Qt::ItemDataRole::DisplayRole ].toString() ), 2 );
267void QgsColorRampShaderWidget::mAddEntryButton_clicked()
270 newItem->
setData( ValueColumn, Qt::ItemDataRole::DisplayRole, 0 );
271 newItem->
setData( ColorColumn, Qt::ItemDataRole::EditRole, QColor( Qt::magenta ) );
272 newItem->setText( LabelColumn, QString() );
273 newItem->setFlags( Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsSelectable );
275 this, &QgsColorRampShaderWidget::mColormapTreeWidget_itemEdited );
283void QgsColorRampShaderWidget::mDeleteEntryButton_clicked()
285 QList<QTreeWidgetItem *> itemList;
286 itemList = mColormapTreeWidget->selectedItems();
287 if ( itemList.isEmpty() )
292 const auto constItemList = itemList;
293 for ( QTreeWidgetItem *item : constItemList )
305 std::unique_ptr< QgsColorRamp > ramp( btnColorRamp->colorRamp() );
306 if ( !ramp || std::isnan( mMin ) || std::isnan( mMax ) )
319 colorRampShader->classifyColorRamp( mNumberOfEntriesSpinBox->value(),
322 mRasterDataProvider );
323 colorRampShader->setClip( mClipCheckBox->isChecked() );
325 mColormapTreeWidget->clear();
327 const QList<QgsColorRampShader::ColorRampItem> colorRampItemList = colorRampShader->colorRampItemList();
328 QList<QgsColorRampShader::ColorRampItem>::const_iterator it = colorRampItemList.constBegin();
329 for ( ; it != colorRampItemList.end(); ++it )
332 newItem->
setData( ValueColumn, Qt::ItemDataRole::DisplayRole, it->value );
333 newItem->
setData( ColorColumn, Qt::ItemDataRole::EditRole, it->color );
334 newItem->setText( LabelColumn, QString() );
335 newItem->setFlags( Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsSelectable );
337 this, &QgsColorRampShaderWidget::mColormapTreeWidget_itemEdited );
340 mClipCheckBox->setChecked( colorRampShader->clip() );
346void QgsColorRampShaderWidget::mClassificationModeComboBox_currentIndexChanged(
int index )
353void QgsColorRampShaderWidget::updateColorRamp()
355 std::unique_ptr< QgsColorRamp > ramp(
shader().createColorRamp() );
359void QgsColorRampShaderWidget::applyColorRamp()
361 std::unique_ptr< QgsColorRamp > ramp( btnColorRamp->colorRamp() );
367 if ( !btnColorRamp->colorRampName().isEmpty() )
371 settings.
setValue( QStringLiteral(
"Raster/defaultPalette" ), btnColorRamp->colorRampName() );
374 bool enableContinuous = ( ramp->count() > 0 );
375 mClassificationModeComboBox->setEnabled( enableContinuous );
376 if ( !enableContinuous )
381 int topLevelItemCount = mColormapTreeWidget->topLevelItemCount();
382 if ( topLevelItemCount > 0 )
386 if ( std::isnan( mMin ) || std::isnan( mMax ) )
388 colormapMinMax( min, max );
397 QTreeWidgetItem *currentItem =
nullptr;
398 for (
int i = 0; i < topLevelItemCount; ++i )
400 currentItem = mColormapTreeWidget->topLevelItem( i );
406 double value = currentItem->data( ValueColumn, Qt::ItemDataRole::EditRole ).toDouble( );
407 double position = ( value - min ) / ( max - min );
421 mColormapTreeWidget->clear();
422 QList<QgsColorRampShader::ColorRampItem>::const_iterator it = colorRampItems.constBegin();
424 for ( ; it != colorRampItems.constEnd(); ++it )
427 newItem->
setData( ValueColumn, Qt::ItemDataRole::DisplayRole, it->value );
428 newItem->
setData( ColorColumn, Qt::ItemDataRole::EditRole, it->color );
429 newItem->setText( LabelColumn, it->label );
430 newItem->setFlags( Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsSelectable );
432 this, &QgsColorRampShaderWidget::mColormapTreeWidget_itemEdited );
443 const QString unit = mUnitLineEdit->text();
444 for ( i = 0; i < mColormapTreeWidget->topLevelItemCount(); i++ )
447 QString lbl { createLabel( currentItem, i, unit )};
448 if ( currentItem->text( LabelColumn ).isEmpty() || currentItem->text( LabelColumn ) == lbl || currentItem->foreground( LabelColumn ).color() == QColor( Qt::gray ) )
450 currentItem->setText( LabelColumn, lbl );
451 currentItem->setForeground( LabelColumn, QBrush( QColor( Qt::gray ) ) );
457void QgsColorRampShaderWidget::mLoadFromBandButton_clicked()
459 if ( !mRasterDataProvider )
462 QList<QgsColorRampShader::ColorRampItem> colorRampList = mRasterDataProvider->colorTable( mBand );
463 if ( !colorRampList.isEmpty() )
470 QMessageBox::warning(
this, tr(
"Load Color Map" ), tr(
"The color map for band %1 has no entries." ).arg( mBand ) );
476void QgsColorRampShaderWidget::mLoadFromFileButton_clicked()
479 QString lastDir = settings.
value( QStringLiteral(
"lastColorMapDir" ), QDir::homePath() ).toString();
480 const QString fileName = QFileDialog::getOpenFileName(
this, tr(
"Load Color Map from File" ), lastDir, tr(
"Textfile (*.txt)" ) );
481 if ( fileName.isEmpty() )
484 QList<QgsColorRampShader::ColorRampItem> colorRampItems;
490 mColormapTreeWidget->clear();
492 mColorInterpolationComboBox->setCurrentIndex( mColorInterpolationComboBox->findData( type ) );
496 if ( !errors.empty() )
498 QMessageBox::warning(
this, tr(
"Load Color Map from File" ), tr(
"The following lines contained errors\n\n" ) + errors.join(
'\n' ) );
503 const QString error = tr(
"An error occurred while reading the color map\n\n" ) + errors.join(
'\n' );
504 QMessageBox::warning(
this, tr(
"Load Color Map from File" ), error );
507 QFileInfo fileInfo( fileName );
508 settings.
setValue( QStringLiteral(
"lastColorMapDir" ), fileInfo.absoluteDir().absolutePath() );
515void QgsColorRampShaderWidget::mExportToFileButton_clicked()
518 QString lastDir = settings.
value( QStringLiteral(
"lastColorMapDir" ), QDir::homePath() ).toString();
519 QString fileName = QFileDialog::getSaveFileName(
this, tr(
"Save Color Map as File" ), lastDir, tr(
"Textfile (*.txt)" ) );
520 if ( fileName.isEmpty() )
525 QList<QgsColorRampShader::ColorRampItem> colorRampItems;
526 int topLevelItemCount = mColormapTreeWidget->topLevelItemCount();
527 for (
int i = 0; i < topLevelItemCount; ++i )
529 QTreeWidgetItem *currentItem = mColormapTreeWidget->topLevelItem( i );
536 item.
value = currentItem->data( ValueColumn, Qt::ItemDataRole::DisplayRole ).toDouble( );
537 item.
color = currentItem->data( ColorColumn, Qt::ItemDataRole::EditRole ).value<QColor>();
538 item.
label = currentItem->text( LabelColumn );
539 colorRampItems << item;
544 QMessageBox::warning(
this, tr(
"Save Color Map as File" ), tr(
"Write access denied. Adjust the file permissions and try again.\n\n" ) );
547 QFileInfo fileInfo( fileName );
548 settings.
setValue( QStringLiteral(
"lastColorMapDir" ), fileInfo.absoluteDir().absolutePath() );
551void QgsColorRampShaderWidget::mUnitLineEdit_textEdited(
const QString & )
555 if ( !mBlockChanges )
559void QgsColorRampShaderWidget::mColormapTreeWidget_itemDoubleClicked( QTreeWidgetItem *item,
int column )
566 if ( column == LabelColumn )
569 item->setForeground( LabelColumn, QBrush() );
573void QgsColorRampShaderWidget::mColormapTreeWidget_itemEdited( QTreeWidgetItem *item,
int column )
613 whileBlocking( mColorInterpolationComboBox )->setCurrentIndex( mColorInterpolationComboBox->findData( colorRampShader.
colorRampType() ) );
614 mColorInterpolationComboBox_currentIndexChanged( mColorInterpolationComboBox->currentIndex() );
616 mClassificationModeComboBox_currentIndexChanged( mClassificationModeComboBox->currentIndex() );
626 QString defaultPalette = settings.
value( QStringLiteral(
"/Raster/defaultPalette" ),
"Spectral" ).toString();
627 btnColorRamp->setColorRampFromName( defaultPalette );
630 mLabelPrecisionSpinBox->setValue( colorRampShader.
labelPrecision() );
641void QgsColorRampShaderWidget::mColorInterpolationComboBox_currentIndexChanged(
int index )
648 QString valueToolTip;
649 switch ( interpolation )
652 valueLabel = tr(
"Value" );
653 valueToolTip = tr(
"Value for color stop" );
654 mLegendSettingsButton->setEnabled(
true );
657 valueLabel = tr(
"Value <=" );
658 valueToolTip = tr(
"Maximum value for class" );
659 mLegendSettingsButton->setEnabled(
false );
662 valueLabel = tr(
"Value =" );
663 valueToolTip = tr(
"Value for color" );
664 mLegendSettingsButton->setEnabled(
false );
668 QTreeWidgetItem *header = mColormapTreeWidget->headerItem();
669 header->setText( ValueColumn, valueLabel );
670 header->setToolTip( ValueColumn, valueToolTip );
689 resetClassifyButton();
702bool QgsColorRampShaderWidget::colormapMinMax(
double &min,
double &max )
const
704 QTreeWidgetItem *item = mColormapTreeWidget->topLevelItem( 0 );
719 min = item->data( ValueColumn, Qt::ItemDataRole::DisplayRole ).toDouble();
720 item = mColormapTreeWidget->topLevelItem( mColormapTreeWidget->topLevelItemCount() - 1 );
721 max = item->data( ValueColumn, Qt::ItemDataRole::DisplayRole ).toDouble();
728 double min = 0, max = 0;
729 if ( ! colormapMinMax( min, max ) )
742void QgsColorRampShaderWidget::resetClassifyButton()
744 mClassifyButton->setEnabled(
true );
745 if ( std::isnan( mMin ) || std::isnan( mMax ) || mMin >= mMax )
747 mClassifyButton->setEnabled(
false );
751QString QgsColorRampShaderWidget::createLabel( QTreeWidgetItem *currentItem,
int row,
const QString unit )
753 auto applyPrecision = [ = ](
const QString & value )
755 double val { value.toDouble( ) };
770 return QLocale().toString( std::round( val ),
'f', 0 );
775 if ( mLabelPrecisionSpinBox->value() < 0 )
777 const double factor = std::pow( 10, - mLabelPrecisionSpinBox->value() );
778 val =
static_cast<qlonglong
>( val / factor ) * factor;
779 return QLocale().toString( val,
'f', 0 );
781 return QLocale().toString( val,
'f', mLabelPrecisionSpinBox->value() );
787 if ( mLabelPrecisionSpinBox->value() < 0 )
789 const double factor = std::pow( 10, - mLabelPrecisionSpinBox->value() );
790 val =
static_cast<qlonglong
>( val / factor ) * factor;
791 return QLocale().toString( val,
'f', 0 );
793 return QLocale().toString( val,
'f', mLabelPrecisionSpinBox->value() );
807 lbl =
"<= " + applyPrecision( currentItem->data( ValueColumn, Qt::ItemDataRole::DisplayRole ).toString() ) + unit;
809 else if ( currentItem->data( ValueColumn, Qt::ItemDataRole::DisplayRole ).toDouble( ) == std::numeric_limits<double>::infinity() )
811 lbl =
"> " + applyPrecision( mColormapTreeWidget->topLevelItem( row - 1 )->data( ValueColumn, Qt::ItemDataRole::DisplayRole ).toString() ) + unit;
815 lbl = applyPrecision( mColormapTreeWidget->topLevelItem( row - 1 )->data( ValueColumn, Qt::ItemDataRole::DisplayRole ).toString() ) +
" - " + applyPrecision( currentItem->data( ValueColumn, Qt::ItemDataRole::DisplayRole ).toString() ) + unit;
820 lbl = applyPrecision( currentItem->data( ValueColumn, Qt::ItemDataRole::DisplayRole ).toString() ) + unit;
827void QgsColorRampShaderWidget::changeColor()
829 QList<QTreeWidgetItem *> itemList;
830 itemList = mColormapTreeWidget->selectedItems();
831 if ( itemList.isEmpty() )
835 QTreeWidgetItem *firstItem = itemList.first();
837 QColor currentColor = firstItem->data( ColorColumn, Qt::ItemDataRole::EditRole ).value<QColor>();
839 if ( panel && panel->dockMode() )
846 for ( QTreeWidgetItem *item : std::as_const( itemList ) )
848 item->setData( ColorColumn, Qt::ItemDataRole::EditRole, newColor );
854 panel->openPanel( colorWidget );
860 if ( newColor.isValid() )
862 for ( QTreeWidgetItem *item : std::as_const( itemList ) )
864 item->setData( ColorColumn, Qt::ItemDataRole::EditRole, newColor );
873void QgsColorRampShaderWidget::changeOpacity()
875 QList<QTreeWidgetItem *> itemList;
876 itemList = mColormapTreeWidget->selectedItems();
877 if ( itemList.isEmpty() )
881 QTreeWidgetItem *firstItem = itemList.first();
884 double oldOpacity = firstItem->data( ColorColumn, Qt::ItemDataRole::EditRole ).value<QColor>().alpha() / 255 * 100;
885 double opacity = QInputDialog::getDouble(
this, tr(
"Opacity" ), tr(
"Change color opacity [%]" ), oldOpacity, 0.0, 100.0, 0, &ok );
888 int newOpacity =
static_cast<int>( opacity / 100 * 255 );
889 const auto constItemList = itemList;
890 for ( QTreeWidgetItem *item : constItemList )
892 QColor newColor = item->data( ColorColumn, Qt::ItemDataRole::EditRole ).value<QColor>();
893 newColor.setAlpha( newOpacity );
894 item->setData( ColorColumn, Qt::ItemDataRole::EditRole, newColor );
902void QgsColorRampShaderWidget::showLegendSettings()
912 mLegendSettings = legendPanel->
settings();
920 dialog.setWindowTitle( tr(
"Legend Settings" ) );
923 mLegendSettings = dialog.settings();
DataType
Raster data types.
@ Float32
Thirty two bit floating point (float)
@ CFloat64
Complex Float64.
@ Int16
Sixteen bit signed integer (qint16)
@ ARGB32_Premultiplied
Color, alpha, red, green, blue, 4 bytes the same as QImage::Format_ARGB32_Premultiplied.
@ Int8
Eight bit signed integer (qint8) (added in QGIS 3.30)
@ UInt16
Sixteen bit unsigned integer (quint16)
@ Byte
Eight bit unsigned integer (quint8)
@ UnknownDataType
Unknown or unspecified type.
@ ARGB32
Color, alpha, red, green, blue, 4 bytes the same as QImage::Format_ARGB32.
@ Int32
Thirty two bit signed integer (qint32)
@ Float64
Sixty four bit floating point (double)
@ CFloat32
Complex Float32.
@ UInt32
Thirty two bit unsigned integer (quint32)
static const double UI_SCALE_FACTOR
UI scaling factor.
static QColor getColor(const QColor &initialColor, QWidget *parent, const QString &title=QString(), bool allowOpacity=false)
Returns a color selection from a color dialog.
A dialog for configuring a QgsColorRampLegendNode (QgsColorRampLegendNodeSettings).
Settings for a color ramp legend node.
A ramp shader will color a raster pixel based on a list of values ranges in a ramp.
ClassificationMode classificationMode() const
Returns the classification mode.
const QgsColorRampLegendNodeSettings * legendSettings() const
Returns the color ramp shader legend settings.
Type colorRampType() const
Returns the color ramp type.
void setSourceColorRamp(QgsColorRamp *colorramp)
Set the source color ramp.
QList< QgsColorRampShader::ColorRampItem > colorRampItemList() const
Returns the custom colormap.
ClassificationMode
Classification modes used to create the color ramp shader.
@ EqualInterval
Uses equal interval.
@ Quantile
Uses quantile (i.e. equal pixel) count.
@ Continuous
Uses breaks from color palette.
void setClip(bool clip)
Sets whether the shader should not render values out of range.
bool clip() const
Returns whether the shader will clip values which are out of range.
QgsColorRamp * sourceColorRamp() const
Returns the source color ramp.
Type
Supported methods for color interpolation.
@ Interpolated
Interpolates the color between two class breaks linearly.
@ Discrete
Assigns the color of the higher class for every pixel between two class breaks.
@ Exact
Assigns the color of the exact matching value in the color ramp item list.
void setClassificationMode(ClassificationMode classificationMode)
Sets classification mode.
void setColorRampItemList(const QList< QgsColorRampShader::ColorRampItem > &list)
Sets a custom colormap.
void setColorRampType(QgsColorRampShader::Type colorRampType)
Sets the color ramp type.
void setLegendSettings(QgsColorRampLegendNodeSettings *settings)
Sets the color ramp shader legend settings.
A delegate for showing a color swatch in a list.
static QString ensureFileNameHasExtension(const QString &fileName, const QStringList &extensions)
Ensures that a fileName ends with an extension from the provided list of extensions.
Base class for raster data providers.
static bool parseColorMapFile(const QString &path, QList< QgsColorRampShader::ColorRampItem > &items, QgsColorRampShader::Type &type, QStringList &errors)
Parses an exported color map file at the specified path and extracts the stored color ramp items and ...
static bool saveColorMapFile(const QString &path, const QList< QgsColorRampShader::ColorRampItem > &items, QgsColorRampShader::Type type)
Exports a list of color ramp items and ramp shader type to a color map file at the specified path.
void setLabelPrecision(int labelPrecision)
Sets label precision to labelPrecision.
int labelPrecision() const
Returns label precision.
A rectangle specified with double values.
This class is a composition of two QSettings instances:
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.
void setValue(const QString &key, const QVariant &value, QgsSettings::Section section=QgsSettings::NoSection)
Sets the value of setting key to value.
int significantDigits(const Qgis::DataType rasterDataType)
Returns the maximum number of significant digits a for the given rasterDataType.
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
QgsSignalBlocker< Object > whileBlocking(Object *object)
Temporarily blocks signals from a QObject while calling a single method from the object.
#define QgsDebugMsgLevel(str, level)