21#include "moc_qgscolorrampshaderwidget.cpp" 
   36#include <QInputDialog> 
   50  mLoadFromBandButton->setVisible( 
false ); 
 
   52  connect( mAddEntryButton, &QPushButton::clicked, 
this, &QgsColorRampShaderWidget::mAddEntryButton_clicked );
 
   53  connect( mDeleteEntryButton, &QPushButton::clicked, 
this, &QgsColorRampShaderWidget::mDeleteEntryButton_clicked );
 
   54  connect( mLoadFromBandButton, &QPushButton::clicked, 
this, &QgsColorRampShaderWidget::mLoadFromBandButton_clicked );
 
   55  connect( mLoadFromFileButton, &QPushButton::clicked, 
this, &QgsColorRampShaderWidget::mLoadFromFileButton_clicked );
 
   56  connect( mExportToFileButton, &QPushButton::clicked, 
this, &QgsColorRampShaderWidget::mExportToFileButton_clicked );
 
   57  connect( mUnitLineEdit, &QLineEdit::textEdited, 
this, &QgsColorRampShaderWidget::mUnitLineEdit_textEdited );
 
   58  connect( mColormapTreeWidget, &QTreeWidget::itemDoubleClicked, 
this, &QgsColorRampShaderWidget::mColormapTreeWidget_itemDoubleClicked );
 
   59  connect( mColorInterpolationComboBox, 
static_cast<void ( QComboBox::* )( 
int )
>( &QComboBox::currentIndexChanged ), 
this, &QgsColorRampShaderWidget::mColorInterpolationComboBox_currentIndexChanged );
 
   60  connect( mClassificationModeComboBox, 
static_cast<void ( QComboBox::* )( 
int )
>( &QComboBox::currentIndexChanged ), 
this, &QgsColorRampShaderWidget::mClassificationModeComboBox_currentIndexChanged );
 
   62  connect( mLegendSettingsButton, &QPushButton::clicked, 
this, &QgsColorRampShaderWidget::showLegendSettings );
 
   64  contextMenu = 
new QMenu( tr( 
"Options" ), 
this );
 
   65  contextMenu->addAction( tr( 
"Change Color…" ), 
this, SLOT( changeColor() ) );
 
   66  contextMenu->addAction( tr( 
"Change Opacity…" ), 
this, SLOT( changeOpacity() ) );
 
   70  mColormapTreeWidget->setItemDelegateForColumn( ValueColumn, mValueDelegate );
 
   72  mColormapTreeWidget->setColumnWidth( ColorColumn, 
Qgis::UI_SCALE_FACTOR * fontMetrics().horizontalAdvance( 
'X' ) * 6.6 );
 
   74  mColormapTreeWidget->setContextMenuPolicy( Qt::CustomContextMenu );
 
   75  mColormapTreeWidget->setSelectionMode( QAbstractItemView::ExtendedSelection );
 
   76  connect( mColormapTreeWidget, &QTreeView::customContextMenuRequested, 
this, [
this]( QPoint ) { contextMenu->exec( QCursor::pos() ); } );
 
   78  QString defaultPalette = settings.
value( QStringLiteral( 
"Raster/defaultPalette" ), 
"" ).toString();
 
   79  btnColorRamp->setColorRampFromName( defaultPalette );
 
   91  mNumberOfEntriesSpinBox->setValue( 5 ); 
 
   93  mClassificationModeComboBox_currentIndexChanged( 0 );
 
   95  resetClassifyButton();
 
  103  connect( mLabelPrecisionSpinBox, qOverload<int>( &QSpinBox::valueChanged ), 
this, [
this]( 
int ) {
 
  106    if ( !mBlockChanges )
 
 
  121  mRasterDataProvider = dp;
 
  122  mLoadFromBandButton->setVisible( 
static_cast<bool>( mRasterDataProvider ) ); 
 
 
  133  mLabelPrecisionSpinBox->setMaximum( maxDigits );
 
  134  mValueDelegate->setDataType( dataType );
 
 
  148  colorRampShader.
setClip( mClipCheckBox->isChecked() );
 
  151  QList<QgsColorRampShader::ColorRampItem> colorRampItems;
 
  152  int topLevelItemCount = mColormapTreeWidget->topLevelItemCount();
 
  153  QTreeWidgetItem *currentItem = 
nullptr;
 
  154  for ( 
int i = 0; i < topLevelItemCount; ++i )
 
  156    currentItem = mColormapTreeWidget->topLevelItem( i );
 
  162    newColorRampItem.
value = currentItem->data( ValueColumn, Qt::ItemDataRole::DisplayRole ).toDouble();
 
  163    newColorRampItem.
color = currentItem->data( ColorColumn, Qt::ItemDataRole::EditRole ).value<QColor>();
 
  164    newColorRampItem.
label = currentItem->text( LabelColumn );
 
  165    colorRampItems.append( newColorRampItem );
 
  168  std::sort( colorRampItems.begin(), colorRampItems.end() );
 
  171  if ( !btnColorRamp->isNull() )
 
  177  return colorRampShader;
 
 
  180void QgsColorRampShaderWidget::autoLabel()
 
  182  mColormapTreeWidget->sortItems( ValueColumn, Qt::AscendingOrder );
 
  188  const QString unit = mUnitLineEdit->text();
 
  189  int topLevelItemCount = mColormapTreeWidget->topLevelItemCount();
 
  191  QTreeWidgetItem *currentItem = 
nullptr;
 
  192  for ( 
int i = 0; i < topLevelItemCount; ++i )
 
  194    currentItem = mColormapTreeWidget->topLevelItem( i );
 
  196    if ( !currentItem || currentItem->data( ValueColumn, Qt::ItemDataRole::DisplayRole ).toString().isEmpty() )
 
  201    const QString lbl = createLabel( currentItem, i, unit );
 
  203    if ( currentItem->text( LabelColumn ).isEmpty() || currentItem->text( LabelColumn ) == lbl || currentItem->foreground( LabelColumn ).color() == QColor( Qt::gray ) )
 
  205      currentItem->setText( LabelColumn, lbl );
 
  206      currentItem->setForeground( LabelColumn, QBrush( QColor( Qt::gray ) ) );
 
  211void QgsColorRampShaderWidget::setUnitFromLabels()
 
  213  QStringList allSuffixes;
 
  215  int topLevelItemCount = mColormapTreeWidget->topLevelItemCount();
 
  216  QTreeWidgetItem *currentItem = 
nullptr;
 
  217  for ( 
int i = 0; i < topLevelItemCount; ++i )
 
  219    currentItem = mColormapTreeWidget->topLevelItem( i );
 
  221    if ( !currentItem || currentItem->text( ValueColumn ).isEmpty() )
 
  226    label = createLabel( currentItem, i, QString() );
 
  228    if ( currentItem->text( LabelColumn ).startsWith( label ) )
 
  230      allSuffixes.append( currentItem->text( LabelColumn ).mid( label.length() ) );
 
  234  QStringList suffixes = QStringList( allSuffixes );
 
  235  suffixes.removeDuplicates();
 
  238  for ( 
int i = 0; i < suffixes.count(); ++i )
 
  240    int n = allSuffixes.count( suffixes[i] );
 
  250    mUnitLineEdit->setText( unit );
 
  255void QgsColorRampShaderWidget::dumpClasses()
 
  257  for ( 
int row = 0; row < mColormapTreeWidget->model()->rowCount(); ++row )
 
  259    const auto labelData { mColormapTreeWidget->model()->itemData( mColormapTreeWidget->model()->index( row, LabelColumn ) ) };
 
  260    const auto valueData { mColormapTreeWidget->model()->itemData( mColormapTreeWidget->model()->index( row, ValueColumn ) ) };
 
  261    QgsDebugMsgLevel( QStringLiteral( 
"Class %1 : %2 %3" ).arg( row ).arg( labelData[Qt::ItemDataRole::DisplayRole].toString(), valueData[Qt::ItemDataRole::DisplayRole].toString() ), 2 );
 
  266void QgsColorRampShaderWidget::mAddEntryButton_clicked()
 
  269  newItem->
setData( ValueColumn, Qt::ItemDataRole::DisplayRole, 0 );
 
  270  newItem->
setData( ColorColumn, Qt::ItemDataRole::EditRole, QColor( Qt::magenta ) );
 
  271  newItem->setText( LabelColumn, QString() );
 
  272  newItem->setFlags( Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsSelectable );
 
  281void QgsColorRampShaderWidget::mDeleteEntryButton_clicked()
 
  283  QList<QTreeWidgetItem *> itemList;
 
  284  itemList = mColormapTreeWidget->selectedItems();
 
  285  if ( itemList.isEmpty() )
 
  290  const auto constItemList = itemList;
 
  291  for ( QTreeWidgetItem *item : constItemList )
 
  303  std::unique_ptr<QgsColorRamp> ramp( btnColorRamp->colorRamp() );
 
  304  if ( !ramp || std::isnan( mMin ) || std::isnan( mMax ) )
 
  318  colorRampShader->classifyColorRamp( mNumberOfEntriesSpinBox->value(), mBand, mExtent, mRasterDataProvider );
 
  319  colorRampShader->setClip( mClipCheckBox->isChecked() );
 
  321  mColormapTreeWidget->clear();
 
  323  const QList<QgsColorRampShader::ColorRampItem> colorRampItemList = colorRampShader->colorRampItemList();
 
  324  QList<QgsColorRampShader::ColorRampItem>::const_iterator it = colorRampItemList.constBegin();
 
  325  for ( ; it != colorRampItemList.end(); ++it )
 
  328    newItem->
setData( ValueColumn, Qt::ItemDataRole::DisplayRole, it->value );
 
  329    newItem->
setData( ColorColumn, Qt::ItemDataRole::EditRole, it->color );
 
  330    newItem->setText( LabelColumn, QString() ); 
 
  331    newItem->setFlags( Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsSelectable );
 
  335  mClipCheckBox->setChecked( colorRampShader->clip() );
 
 
  341void QgsColorRampShaderWidget::mClassificationModeComboBox_currentIndexChanged( 
int index )
 
  348void QgsColorRampShaderWidget::updateColorRamp()
 
  350  std::unique_ptr<QgsColorRamp> ramp( 
shader().createColorRamp() );
 
  354void QgsColorRampShaderWidget::applyColorRamp()
 
  356  std::unique_ptr<QgsColorRamp> ramp( btnColorRamp->colorRamp() );
 
  362  if ( !btnColorRamp->colorRampName().isEmpty() )
 
  366    settings.
setValue( QStringLiteral( 
"Raster/defaultPalette" ), btnColorRamp->colorRampName() );
 
  369  bool enableContinuous = ( ramp->count() > 0 );
 
  370  mClassificationModeComboBox->setEnabled( enableContinuous );
 
  371  if ( !enableContinuous )
 
  376  int topLevelItemCount = mColormapTreeWidget->topLevelItemCount();
 
  377  if ( topLevelItemCount > 0 )
 
  381    if ( std::isnan( mMin ) || std::isnan( mMax ) )
 
  383      colormapMinMax( min, max );
 
  392    QTreeWidgetItem *currentItem = 
nullptr;
 
  393    for ( 
int i = 0; i < topLevelItemCount; ++i )
 
  395      currentItem = mColormapTreeWidget->topLevelItem( i );
 
  401      double value = currentItem->data( ValueColumn, Qt::ItemDataRole::EditRole ).toDouble();
 
  402      double position = ( value - min ) / ( max - min );
 
  416  mColormapTreeWidget->clear();
 
  417  QList<QgsColorRampShader::ColorRampItem>::const_iterator it = colorRampItems.constBegin();
 
  419  for ( ; it != colorRampItems.constEnd(); ++it )
 
  422    newItem->
setData( ValueColumn, Qt::ItemDataRole::DisplayRole, it->value );
 
  423    newItem->
setData( ColorColumn, Qt::ItemDataRole::EditRole, it->color );
 
  424    newItem->setText( LabelColumn, it->label );
 
  425    newItem->setFlags( Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsSelectable );
 
  437  const QString unit = mUnitLineEdit->text();
 
  438  for ( i = 0; i < mColormapTreeWidget->topLevelItemCount(); i++ )
 
  441    QString lbl { createLabel( currentItem, i, unit ) };
 
  442    if ( currentItem->text( LabelColumn ).isEmpty() || currentItem->text( LabelColumn ) == lbl || currentItem->foreground( LabelColumn ).color() == QColor( Qt::gray ) )
 
  444      currentItem->setText( LabelColumn, lbl );
 
  445      currentItem->setForeground( LabelColumn, QBrush( QColor( Qt::gray ) ) );
 
 
  450void QgsColorRampShaderWidget::mLoadFromBandButton_clicked()
 
  452  if ( !mRasterDataProvider )
 
  455  QList<QgsColorRampShader::ColorRampItem> colorRampList = mRasterDataProvider->colorTable( mBand );
 
  456  if ( !colorRampList.isEmpty() )
 
  463    QMessageBox::warning( 
this, tr( 
"Load Color Map" ), tr( 
"The color map for band %1 has no entries." ).arg( mBand ) );
 
  469void QgsColorRampShaderWidget::mLoadFromFileButton_clicked()
 
  472  QString lastDir = settings.
value( QStringLiteral( 
"lastColorMapDir" ), QDir::homePath() ).toString();
 
  473  const QString fileName = QFileDialog::getOpenFileName( 
this, tr( 
"Load Color Map from File" ), lastDir, tr( 
"Textfile (*.txt)" ) );
 
  474  if ( fileName.isEmpty() )
 
  477  QList<QgsColorRampShader::ColorRampItem> colorRampItems;
 
  483    mColormapTreeWidget->clear();
 
  485    mColorInterpolationComboBox->setCurrentIndex( mColorInterpolationComboBox->findData( QVariant::fromValue( type ) ) );
 
  489    if ( !errors.empty() )
 
  491      QMessageBox::warning( 
this, tr( 
"Load Color Map from File" ), tr( 
"The following lines contained errors\n\n" ) + errors.join( 
'\n' ) );
 
  496    const QString error = tr( 
"An error occurred while reading the color map\n\n" ) + errors.join( 
'\n' );
 
  497    QMessageBox::warning( 
this, tr( 
"Load Color Map from File" ), error );
 
  500  QFileInfo fileInfo( fileName );
 
  501  settings.
setValue( QStringLiteral( 
"lastColorMapDir" ), fileInfo.absoluteDir().absolutePath() );
 
  508void QgsColorRampShaderWidget::mExportToFileButton_clicked()
 
  511  QString lastDir = settings.
value( QStringLiteral( 
"lastColorMapDir" ), QDir::homePath() ).toString();
 
  512  QString fileName = QFileDialog::getSaveFileName( 
this, tr( 
"Save Color Map as File" ), lastDir, tr( 
"Textfile (*.txt)" ) );
 
  513  if ( fileName.isEmpty() )
 
  518  QList<QgsColorRampShader::ColorRampItem> colorRampItems;
 
  519  int topLevelItemCount = mColormapTreeWidget->topLevelItemCount();
 
  520  for ( 
int i = 0; i < topLevelItemCount; ++i )
 
  522    QTreeWidgetItem *currentItem = mColormapTreeWidget->topLevelItem( i );
 
  529    item.
value = currentItem->data( ValueColumn, Qt::ItemDataRole::DisplayRole ).toDouble();
 
  530    item.
color = currentItem->data( ColorColumn, Qt::ItemDataRole::EditRole ).value<QColor>();
 
  531    item.
label = currentItem->text( LabelColumn );
 
  532    colorRampItems << item;
 
  537    QMessageBox::warning( 
this, tr( 
"Save Color Map as File" ), tr( 
"Write access denied. Adjust the file permissions and try again.\n\n" ) );
 
  540  QFileInfo fileInfo( fileName );
 
  541  settings.
setValue( QStringLiteral( 
"lastColorMapDir" ), fileInfo.absoluteDir().absolutePath() );
 
  544void QgsColorRampShaderWidget::mUnitLineEdit_textEdited( 
const QString & )
 
  548  if ( !mBlockChanges )
 
  552void QgsColorRampShaderWidget::mColormapTreeWidget_itemDoubleClicked( QTreeWidgetItem *item, 
int column )
 
  559  if ( column == LabelColumn )
 
  562    item->setForeground( LabelColumn, QBrush() );
 
  566void QgsColorRampShaderWidget::mColormapTreeWidget_itemEdited( QTreeWidgetItem *item, 
int column )
 
  606  whileBlocking( mColorInterpolationComboBox )->setCurrentIndex( mColorInterpolationComboBox->findData( QVariant::fromValue( colorRampShader.
colorRampType() ) ) );
 
  607  mColorInterpolationComboBox_currentIndexChanged( mColorInterpolationComboBox->currentIndex() );
 
  608  whileBlocking( mClassificationModeComboBox )->setCurrentIndex( mClassificationModeComboBox->findData( QVariant::fromValue( colorRampShader.
classificationMode() ) ) );
 
  609  mClassificationModeComboBox_currentIndexChanged( mClassificationModeComboBox->currentIndex() );
 
  619    QString defaultPalette = settings.
value( QStringLiteral( 
"/Raster/defaultPalette" ), 
"Spectral" ).toString();
 
  620    btnColorRamp->setColorRampFromName( defaultPalette );
 
  623  mLabelPrecisionSpinBox->setValue( colorRampShader.
labelPrecision() );
 
 
  634void QgsColorRampShaderWidget::mColorInterpolationComboBox_currentIndexChanged( 
int index )
 
  641  QString valueToolTip;
 
  642  switch ( interpolation )
 
  645      valueLabel = tr( 
"Value" );
 
  646      valueToolTip = tr( 
"Value for color stop" );
 
  647      mLegendSettingsButton->setEnabled( 
true );
 
  650      valueLabel = tr( 
"Value <=" );
 
  651      valueToolTip = tr( 
"Maximum value for class" );
 
  652      mLegendSettingsButton->setEnabled( 
false );
 
  655      valueLabel = tr( 
"Value =" );
 
  656      valueToolTip = tr( 
"Value for color" );
 
  657      mLegendSettingsButton->setEnabled( 
false );
 
  661  QTreeWidgetItem *header = mColormapTreeWidget->headerItem();
 
  662  header->setText( ValueColumn, valueLabel );
 
  663  header->setToolTip( ValueColumn, valueToolTip );
 
  682  resetClassifyButton();
 
 
  695bool QgsColorRampShaderWidget::colormapMinMax( 
double &min, 
double &max )
 const 
  697  QTreeWidgetItem *item = mColormapTreeWidget->topLevelItem( 0 );
 
  712    min = item->data( ValueColumn, Qt::ItemDataRole::DisplayRole ).toDouble();
 
  713    item = mColormapTreeWidget->topLevelItem( mColormapTreeWidget->topLevelItemCount() - 1 );
 
  714    max = item->data( ValueColumn, Qt::ItemDataRole::DisplayRole ).toDouble();
 
  721  double min = 0, max = 0;
 
  722  if ( !colormapMinMax( min, max ) )
 
 
  735void QgsColorRampShaderWidget::resetClassifyButton()
 
  737  mClassifyButton->setEnabled( 
true );
 
  738  if ( std::isnan( mMin ) || std::isnan( mMax ) || mMin >= mMax )
 
  740    mClassifyButton->setEnabled( 
false );
 
  744QString QgsColorRampShaderWidget::createLabel( QTreeWidgetItem *currentItem, 
int row, 
const QString unit )
 
  746  auto applyPrecision = [
this]( 
const QString &value ) {
 
  747    double val { value.toDouble() };
 
  762        return QLocale().toString( std::round( val ), 
'f', 0 );
 
  767        if ( mLabelPrecisionSpinBox->value() < 0 )
 
  769          const double factor = std::pow( 10, -mLabelPrecisionSpinBox->value() );
 
  770          val = 
static_cast<qlonglong
>( val / factor ) * factor;
 
  771          return QLocale().toString( val, 
'f', 0 );
 
  773        return QLocale().toString( val, 
'f', mLabelPrecisionSpinBox->value() );
 
  779        if ( mLabelPrecisionSpinBox->value() < 0 )
 
  781          const double factor = std::pow( 10, -mLabelPrecisionSpinBox->value() );
 
  782          val = 
static_cast<qlonglong
>( val / factor ) * factor;
 
  783          return QLocale().toString( val, 
'f', 0 );
 
  785        return QLocale().toString( val, 
'f', mLabelPrecisionSpinBox->value() );
 
  799      lbl = 
"<= " + applyPrecision( currentItem->data( ValueColumn, Qt::ItemDataRole::DisplayRole ).toString() ) + unit;
 
  801    else if ( currentItem->data( ValueColumn, Qt::ItemDataRole::DisplayRole ).toDouble() == std::numeric_limits<double>::infinity() )
 
  803      lbl = 
"> " + applyPrecision( mColormapTreeWidget->topLevelItem( row - 1 )->data( ValueColumn, Qt::ItemDataRole::DisplayRole ).toString() ) + unit;
 
  807      lbl = applyPrecision( mColormapTreeWidget->topLevelItem( row - 1 )->data( ValueColumn, Qt::ItemDataRole::DisplayRole ).toString() ) + 
" - " + applyPrecision( currentItem->data( ValueColumn, Qt::ItemDataRole::DisplayRole ).toString() ) + unit;
 
  812    lbl = applyPrecision( currentItem->data( ValueColumn, Qt::ItemDataRole::DisplayRole ).toString() ) + unit;
 
  818void QgsColorRampShaderWidget::changeColor()
 
  820  QList<QTreeWidgetItem *> itemList;
 
  821  itemList = mColormapTreeWidget->selectedItems();
 
  822  if ( itemList.isEmpty() )
 
  826  QTreeWidgetItem *firstItem = itemList.first();
 
  828  QColor currentColor = firstItem->data( ColorColumn, Qt::ItemDataRole::EditRole ).value<QColor>();
 
  830  if ( panel && panel->dockMode() )
 
  836      for ( QTreeWidgetItem *item : std::as_const( itemList ) )
 
  838        item->setData( ColorColumn, Qt::ItemDataRole::EditRole, newColor );
 
  844    panel->openPanel( colorWidget );
 
  850    if ( newColor.isValid() )
 
  852      for ( QTreeWidgetItem *item : std::as_const( itemList ) )
 
  854        item->setData( ColorColumn, Qt::ItemDataRole::EditRole, newColor );
 
  863void QgsColorRampShaderWidget::changeOpacity()
 
  865  QList<QTreeWidgetItem *> itemList;
 
  866  itemList = mColormapTreeWidget->selectedItems();
 
  867  if ( itemList.isEmpty() )
 
  871  QTreeWidgetItem *firstItem = itemList.first();
 
  874  double oldOpacity = firstItem->data( ColorColumn, Qt::ItemDataRole::EditRole ).value<QColor>().alpha() / 255 * 100;
 
  875  double opacity = QInputDialog::getDouble( 
this, tr( 
"Opacity" ), tr( 
"Change color opacity [%]" ), oldOpacity, 0.0, 100.0, 0, &ok );
 
  878    int newOpacity = 
static_cast<int>( opacity / 100 * 255 );
 
  879    const auto constItemList = itemList;
 
  880    for ( QTreeWidgetItem *item : constItemList )
 
  882      QColor newColor = item->data( ColorColumn, Qt::ItemDataRole::EditRole ).value<QColor>();
 
  883      newColor.setAlpha( newOpacity );
 
  884      item->setData( ColorColumn, Qt::ItemDataRole::EditRole, newColor );
 
  892void QgsColorRampShaderWidget::showLegendSettings()
 
  901      mLegendSettings = legendPanel->
settings();
 
  909    dialog.setWindowTitle( tr( 
"Legend Settings" ) );
 
  912      mLegendSettings = dialog.settings();
 
ShaderInterpolationMethod
Color ramp shader interpolation methods.
 
@ Exact
Assigns the color of the exact matching value in the color ramp item list.
 
@ Linear
Interpolates the color between two class breaks linearly.
 
@ Discrete
Assigns the color of the higher class for every pixel between two class breaks.
 
ShaderClassificationMethod
Color ramp shader classification methods.
 
@ Continuous
Uses breaks from color palette.
 
@ Quantile
Uses quantile (i.e. equal pixel) count.
 
@ EqualInterval
Uses equal interval.
 
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.
 
Qgis::ShaderClassificationMethod classificationMode() const
Returns the classification mode.
 
Qgis::ShaderInterpolationMethod colorRampType() const
Returns the color ramp interpolation method.
 
const QgsColorRampLegendNodeSettings * legendSettings() const
Returns the color ramp shader legend settings.
 
void setSourceColorRamp(QgsColorRamp *colorramp)
Set the source color ramp.
 
void setClassificationMode(Qgis::ShaderClassificationMethod classificationMode)
Sets the classification mode.
 
QList< QgsColorRampShader::ColorRampItem > colorRampItemList() const
Returns the custom color map.
 
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.
 
void setColorRampType(Qgis::ShaderInterpolationMethod colorRampType)
Sets the color ramp interpolation method.
 
void setColorRampItemList(const QList< QgsColorRampShader::ColorRampItem > &list)
Sets a custom color map.
 
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 saveColorMapFile(const QString &path, const QList< QgsColorRampShader::ColorRampItem > &items, Qgis::ShaderInterpolationMethod type)
Exports a list of color ramp items and ramp shader type to a color map file at the specified path.
 
static bool parseColorMapFile(const QString &path, QList< QgsColorRampShader::ColorRampItem > &items, Qgis::ShaderInterpolationMethod &type, QStringList &errors)
Parses an exported color map file at the specified path and extracts the stored color ramp items and ...
 
void setLabelPrecision(int labelPrecision)
Sets label precision to labelPrecision.
 
int labelPrecision() const
Returns label precision.
 
A rectangle specified with double values.
 
Stores settings for use within QGIS.
 
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)