30   connect( mRedMinLineEdit, &QLineEdit::textChanged, 
this, &QgsPointCloudRgbRendererWidget::mRedMinLineEdit_textChanged );
 
   31   connect( mRedMaxLineEdit, &QLineEdit::textChanged, 
this, &QgsPointCloudRgbRendererWidget::mRedMaxLineEdit_textChanged );
 
   32   connect( mGreenMinLineEdit, &QLineEdit::textChanged, 
this, &QgsPointCloudRgbRendererWidget::mGreenMinLineEdit_textChanged );
 
   33   connect( mGreenMaxLineEdit, &QLineEdit::textChanged, 
this, &QgsPointCloudRgbRendererWidget::mGreenMaxLineEdit_textChanged );
 
   34   connect( mBlueMinLineEdit, &QLineEdit::textChanged, 
this, &QgsPointCloudRgbRendererWidget::mBlueMinLineEdit_textChanged );
 
   35   connect( mBlueMaxLineEdit, &QLineEdit::textChanged, 
this, &QgsPointCloudRgbRendererWidget::mBlueMaxLineEdit_textChanged );
 
   38   mRedAttributeComboBox->setAllowEmptyAttributeName( 
true );
 
   39   mGreenAttributeComboBox->setAllowEmptyAttributeName( 
true );
 
   40   mBlueAttributeComboBox->setAllowEmptyAttributeName( 
true );
 
   50     mRedAttributeComboBox->setLayer( layer );
 
   51     mGreenAttributeComboBox->setLayer( layer );
 
   52     mBlueAttributeComboBox->setLayer( layer );
 
   54     setFromRenderer( layer->
renderer() );
 
   58            this, &QgsPointCloudRgbRendererWidget::redAttributeChanged );
 
   60            this, &QgsPointCloudRgbRendererWidget::greenAttributeChanged );
 
   62            this, &QgsPointCloudRgbRendererWidget::blueAttributeChanged );
 
   63   connect( mContrastEnhancementAlgorithmComboBox, 
static_cast<void ( QComboBox::* )( 
int )
>( &QComboBox::currentIndexChanged ), 
this, &QgsPointCloudRgbRendererWidget::emitWidgetChanged );
 
   68     redAttributeChanged();
 
   69     greenAttributeChanged();
 
   70     blueAttributeChanged();
 
   76   return new QgsPointCloudRgbRendererWidget( layer, style );
 
   86   std::unique_ptr< QgsPointCloudRgbRenderer > renderer = qgis::make_unique< QgsPointCloudRgbRenderer >();
 
   87   renderer->setRedAttribute( mRedAttributeComboBox->currentAttribute() );
 
   88   renderer->setGreenAttribute( mGreenAttributeComboBox->currentAttribute() );
 
   89   renderer->setBlueAttribute( mBlueAttributeComboBox->currentAttribute() );
 
   91   setCustomMinMaxValues( renderer.get() );
 
   92   return renderer.release();
 
   95 void QgsPointCloudRgbRendererWidget::createValidators()
 
  112   if ( mContrastEnhancementAlgorithmComboBox->currentData().toInt() ==
 
  125   bool redMinOk, redMaxOk;
 
  128   if ( redMinOk && redMaxOk && !mRedAttributeComboBox->currentAttribute().isEmpty() )
 
  135   bool greenMinOk, greenMaxOk;
 
  138   if ( greenMinOk && greenMaxOk && !mGreenAttributeComboBox->currentAttribute().isEmpty() )
 
  145   bool blueMinOk, blueMaxOk;
 
  148   if ( blueMinOk && blueMaxOk && !mBlueAttributeComboBox->currentAttribute().isEmpty() )
 
  155   if ( redEnhancement )
 
  158           ( mContrastEnhancementAlgorithmComboBox->currentData().toInt() ) ) );
 
  160   if ( greenEnhancement )
 
  163           ( mContrastEnhancementAlgorithmComboBox->currentData().toInt() ) ) );
 
  165   if ( blueEnhancement )
 
  168           ( mContrastEnhancementAlgorithmComboBox->currentData().toInt() ) ) );
 
  175 void QgsPointCloudRgbRendererWidget::mRedMinLineEdit_textChanged( 
const QString & )
 
  180 void QgsPointCloudRgbRendererWidget::mRedMaxLineEdit_textChanged( 
const QString & )
 
  185 void QgsPointCloudRgbRendererWidget::mGreenMinLineEdit_textChanged( 
const QString & )
 
  190 void QgsPointCloudRgbRendererWidget::mGreenMaxLineEdit_textChanged( 
const QString & )
 
  195 void QgsPointCloudRgbRendererWidget::mBlueMinLineEdit_textChanged( 
const QString & )
 
  200 void QgsPointCloudRgbRendererWidget::mBlueMaxLineEdit_textChanged( 
const QString & )
 
  205 void QgsPointCloudRgbRendererWidget::emitWidgetChanged()
 
  207   if ( !mBlockChangedSignal )
 
  208     emit widgetChanged();
 
  211 void QgsPointCloudRgbRendererWidget::redAttributeChanged()
 
  213   if ( mLayer && mLayer->dataProvider() )
 
  215     const QVariant max = mLayer->dataProvider()->metadataStatistic( mRedAttributeComboBox->currentAttribute(), 
QgsStatisticalSummary::Max );
 
  218       const int maxValue = max.toInt();
 
  219       mDisableMinMaxWidgetRefresh++;
 
  220       mRedMinLineEdit->setText( QLocale().toString( 0 ) );
 
  224       mRedMaxLineEdit->setText( QLocale().toString( maxValue > 255 ? 65535 : 255 ) );
 
  225       mDisableMinMaxWidgetRefresh--;
 
  231 void QgsPointCloudRgbRendererWidget::greenAttributeChanged()
 
  233   if ( mLayer && mLayer->dataProvider() )
 
  235     const QVariant max = mLayer->dataProvider()->metadataStatistic( mGreenAttributeComboBox->currentAttribute(), 
QgsStatisticalSummary::Max );
 
  238       const int maxValue = max.toInt();
 
  239       mDisableMinMaxWidgetRefresh++;
 
  240       mGreenMinLineEdit->setText( QLocale().toString( 0 ) );
 
  244       mGreenMaxLineEdit->setText( QLocale().toString( maxValue > 255 ? 65535 : 255 ) );
 
  245       mDisableMinMaxWidgetRefresh--;
 
  251 void QgsPointCloudRgbRendererWidget::blueAttributeChanged()
 
  253   if ( mLayer && mLayer->dataProvider() )
 
  255     const QVariant max = mLayer->dataProvider()->metadataStatistic( mBlueAttributeComboBox->currentAttribute(), 
QgsStatisticalSummary::Max );
 
  258       const int maxValue = max.toInt();
 
  259       mDisableMinMaxWidgetRefresh++;
 
  260       mBlueMinLineEdit->setText( QLocale().toString( 0 ) );
 
  264       mBlueMaxLineEdit->setText( QLocale().toString( maxValue > 255 ? 65535 : 255 ) );
 
  265       mDisableMinMaxWidgetRefresh--;
 
  271 void QgsPointCloudRgbRendererWidget::minMaxModified()
 
  273   if ( !mDisableMinMaxWidgetRefresh )
 
  277       mContrastEnhancementAlgorithmComboBox->setCurrentIndex(
 
  284 void QgsPointCloudRgbRendererWidget::setMinMaxValue( 
const QgsContrastEnhancement *ce, QLineEdit *minEdit, QLineEdit *maxEdit )
 
  286   if ( !minEdit || !maxEdit )
 
  298   minEdit->setText( QLocale().toString( ce->
minimumValue() ) );
 
  299   maxEdit->setText( QLocale().toString( ce->
maximumValue() ) );
 
  303   mContrastEnhancementAlgorithmComboBox->setCurrentIndex( mContrastEnhancementAlgorithmComboBox->findData(
 
  309   mBlockChangedSignal = 
true;
 
  313     mRedAttributeComboBox->setAttribute( mbcr->
redAttribute() );
 
  315     mBlueAttributeComboBox->setAttribute( mbcr->
blueAttribute() );
 
  317     mDisableMinMaxWidgetRefresh++;
 
  321     mDisableMinMaxWidgetRefresh--;
 
  325     if ( mRedAttributeComboBox->findText( QStringLiteral( 
"Red" ) ) > -1 && mRedAttributeComboBox->findText( QStringLiteral( 
"Green" ) ) > -1 &&
 
  326          mRedAttributeComboBox->findText( QStringLiteral( 
"Blue" ) ) > -1 )
 
  328       mRedAttributeComboBox->setAttribute( QStringLiteral( 
"Red" ) );
 
  329       mGreenAttributeComboBox->setAttribute( QStringLiteral( 
"Green" ) );
 
  330       mBlueAttributeComboBox->setAttribute( QStringLiteral( 
"Blue" ) );
 
  334       mRedAttributeComboBox->setCurrentIndex( mRedAttributeComboBox->count() > 1 ? 1 : 0 );
 
  335       mGreenAttributeComboBox->setCurrentIndex( mGreenAttributeComboBox->count() > 2 ? 2 : 0 );
 
  336       mBlueAttributeComboBox->setCurrentIndex( mBlueAttributeComboBox->count() > 3 ? 3 : 0 );
 
  339   mBlockChangedSignal = 
false;
 
@ UnknownDataType
Unknown or unspecified type.
Manipulates raster or point cloud pixel values so that they enhanceContrast or clip into a specified ...
ContrastEnhancementAlgorithm
This enumerator describes the types of contrast enhancement algorithms that can be used.
@ StretchToMinimumMaximum
Linear histogram.
@ StretchAndClipToMinimumMaximum
@ NoEnhancement
Default color scaling algorithm, no scaling is applied.
void setMinimumValue(double value, bool generateTable=true)
Sets the minimum value for the contrast enhancement range.
void setContrastEnhancementAlgorithm(ContrastEnhancementAlgorithm algorithm, bool generateTable=true)
Sets the contrast enhancement algorithm.
double minimumValue() const
Returns the minimum value for the contrast enhancement range.
ContrastEnhancementAlgorithm contrastEnhancementAlgorithm() const
void setMaximumValue(double value, bool generateTable=true)
Sets the maximum value for the contrast enhancement range.
double maximumValue() const
Returns the maximum value for the contrast enhancement range.
QgsDoubleValidator is a QLineEdit Validator that combines QDoubleValidator and QRegularExpressionVali...
static double toDouble(const QString &input, bool *ok)
Converts input string to double value.
void attributeChanged(const QString &name)
Emitted when the currently selected attribute changes.
Represents a map layer supporting display of point clouds.
QgsPointCloudRenderer * renderer()
Returns the 2D renderer for the point cloud.
Abstract base class for 2d point cloud renderers.
An RGB renderer for 2d visualisation of point clouds using embedded red, green and blue attributes.
void setRedContrastEnhancement(QgsContrastEnhancement *enhancement)
Sets the contrast enhancement to use for the red channel.
QString redAttribute() const
Returns the attribute to use for the red channel.
QString greenAttribute() const
Returns the attribute to use for the green channel.
void setBlueContrastEnhancement(QgsContrastEnhancement *enhancement)
Sets the contrast enhancement to use for the blue channel.
const QgsContrastEnhancement * greenContrastEnhancement() const
Returns the contrast enhancement to use for the green channel.
QString blueAttribute() const
Returns the attribute to use for the blue channel.
void setGreenContrastEnhancement(QgsContrastEnhancement *enhancement)
Sets the contrast enhancement to use for the green channel.
const QgsContrastEnhancement * blueContrastEnhancement() const
Returns the contrast enhancement to use for the blue channel.
const QgsContrastEnhancement * redContrastEnhancement() const
Returns the contrast enhancement to use for the red channel.