35 #include "qgsnative.h"
56 #include "qgssettings.h"
71 #include <QDesktopServices>
72 #include <QTableWidgetItem>
73 #include <QHeaderView>
74 #include <QTextStream>
76 #include <QFileDialog>
77 #include <QMessageBox>
79 #include <QLinearGradient>
80 #include <QPainterPath>
82 #include <QColorDialog>
84 #include <QMouseEvent>
93 , TRSTRING_NOT_SET( tr(
"Not Set" ) )
94 , mDefaultStandardDeviation( 0 )
95 , mDefaultRedBand( 0 )
96 , mDefaultGreenBand( 0 )
97 , mDefaultBlueBand( 0 )
99 , mGradientHeight( 0.0 )
100 , mGradientWidth( 0.0 )
101 , mMapCanvas( canvas )
102 , mMetadataFilled( false )
104 mGrayMinimumMaximumEstimated =
true;
105 mRGBMinimumMaximumEstimated =
true;
108 connect( mLayerOrigNameLineEd, &QLineEdit::textEdited,
this, &QgsRasterLayerProperties::mLayerOrigNameLineEd_textEdited );
109 connect( buttonBuildPyramids, &QPushButton::clicked,
this, &QgsRasterLayerProperties::buttonBuildPyramids_clicked );
110 connect( pbnAddValuesFromDisplay, &QToolButton::clicked,
this, &QgsRasterLayerProperties::pbnAddValuesFromDisplay_clicked );
111 connect( pbnAddValuesManually, &QToolButton::clicked,
this, &QgsRasterLayerProperties::pbnAddValuesManually_clicked );
113 connect( pbnDefaultValues, &QToolButton::clicked,
this, &QgsRasterLayerProperties::pbnDefaultValues_clicked );
114 connect( pbnExportTransparentPixelValues, &QToolButton::clicked,
this, &QgsRasterLayerProperties::pbnExportTransparentPixelValues_clicked );
115 connect( pbnImportTransparentPixelValues, &QToolButton::clicked,
this, &QgsRasterLayerProperties::pbnImportTransparentPixelValues_clicked );
116 connect( pbnRemoveSelectedRow, &QToolButton::clicked,
this, &QgsRasterLayerProperties::pbnRemoveSelectedRow_clicked );
117 connect( mRenderTypeComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRasterLayerProperties::mRenderTypeComboBox_currentIndexChanged );
118 connect( mResetColorRenderingBtn, &QToolButton::clicked,
this, &QgsRasterLayerProperties::mResetColorRenderingBtn_clicked );
123 connect( buttonBox, &QDialogButtonBox::helpRequested,
this, &QgsRasterLayerProperties::showHelp );
125 mSourceGroupBox->hide();
127 mBtnStyle =
new QPushButton( tr(
"Style" ) );
128 QMenu *menuStyle =
new QMenu(
this );
129 menuStyle->addAction( tr(
"Load Style…" ),
this, &QgsRasterLayerProperties::loadStyle_clicked );
130 menuStyle->addAction( tr(
"Save Style…" ),
this, &QgsRasterLayerProperties::saveStyleAs_clicked );
131 menuStyle->addSeparator();
132 menuStyle->addAction( tr(
"Save as Default" ),
this, &QgsRasterLayerProperties::saveDefaultStyle_clicked );
133 menuStyle->addAction( tr(
"Restore Default" ),
this, &QgsRasterLayerProperties::loadDefaultStyle_clicked );
134 mBtnStyle->setMenu( menuStyle );
135 connect( menuStyle, &QMenu::aboutToShow,
this, &QgsRasterLayerProperties::aboutToShowStyleMenu );
136 buttonBox->addButton( mBtnStyle, QDialogButtonBox::ResetRole );
138 mBtnMetadata =
new QPushButton( tr(
"Metadata" ),
this );
139 QMenu *menuMetadata =
new QMenu(
this );
140 mActionLoadMetadata = menuMetadata->addAction( tr(
"Load Metadata…" ),
this, &QgsRasterLayerProperties::loadMetadata );
141 mActionSaveMetadataAs = menuMetadata->addAction( tr(
"Save Metadata…" ),
this, &QgsRasterLayerProperties::saveMetadataAs );
142 menuMetadata->addSeparator();
143 menuMetadata->addAction( tr(
"Save as Default" ),
this, &QgsRasterLayerProperties::saveDefaultMetadata );
144 menuMetadata->addAction( tr(
"Restore Default" ),
this, &QgsRasterLayerProperties::loadDefaultMetadata );
145 mBtnMetadata->setMenu( menuMetadata );
146 buttonBox->addButton( mBtnMetadata, QDialogButtonBox::ResetRole );
150 connect(
this, &QDialog::accepted,
this, &QgsRasterLayerProperties::apply );
151 connect(
this, &QDialog::rejected,
this, &QgsRasterLayerProperties::onCancel );
153 connect( buttonBox->button( QDialogButtonBox::Apply ), &QAbstractButton::clicked,
this, &QgsRasterLayerProperties::apply );
156 connect( mSliderBrightness, &QAbstractSlider::valueChanged, mBrightnessSpinBox, &QSpinBox::setValue );
157 connect( mBrightnessSpinBox,
static_cast < void ( QSpinBox::* )(
int )
> ( &QSpinBox::valueChanged ), mSliderBrightness, &QAbstractSlider::setValue );
158 mBrightnessSpinBox->setClearValue( 0 );
160 connect( mSliderContrast, &QAbstractSlider::valueChanged, mContrastSpinBox, &QSpinBox::setValue );
161 connect( mContrastSpinBox,
static_cast < void ( QSpinBox::* )(
int )
> ( &QSpinBox::valueChanged ), mSliderContrast, &QAbstractSlider::setValue );
162 mContrastSpinBox->setClearValue( 0 );
165 connect( mSliderGamma, &QAbstractSlider::valueChanged,
this, &QgsRasterLayerProperties::updateGammaSpinBox );
166 connect( mGammaSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterLayerProperties::updateGammaSlider );
167 mGammaSpinBox->setClearValue( 1.0 );
170 connect( sliderSaturation, &QAbstractSlider::valueChanged, spinBoxSaturation, &QSpinBox::setValue );
171 connect( spinBoxSaturation,
static_cast < void ( QSpinBox::* )(
int )
> ( &QSpinBox::valueChanged ), sliderSaturation, &QAbstractSlider::setValue );
172 spinBoxSaturation->setClearValue( 0 );
175 connect( sliderColorizeStrength, &QAbstractSlider::valueChanged, spinColorizeStrength, &QSpinBox::setValue );
176 connect( spinColorizeStrength,
static_cast < void ( QSpinBox::* )(
int )
> ( &QSpinBox::valueChanged ), sliderColorizeStrength, &QAbstractSlider::setValue );
177 spinColorizeStrength->setClearValue( 100 );
180 connect( comboGrayscale,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRasterLayerProperties::toggleSaturationControls );
183 connect( mColorizeCheck, &QAbstractButton::toggled,
this, &QgsRasterLayerProperties::toggleColorizeControls );
186 connect( lbxPyramidResolutions, &QListWidget::itemSelectionChanged,
this, &QgsRasterLayerProperties::toggleBuildPyramidsButton );
188 connect( mRefreshLayerCheckBox, &QCheckBox::toggled, mRefreshLayerIntervalSpinBox, &QDoubleSpinBox::setEnabled );
191 mScaleRangeWidget->setMapCanvas( mMapCanvas );
195 leNoDataValue->setValidator(
new QgsDoubleValidator( -std::numeric_limits<double>::max(), std::numeric_limits<double>::max(), 1000,
this ) );
210 mPixelSelectorTool = std::make_unique<QgsMapToolEmitPoint>( canvas );
216 pbnAddValuesFromDisplay->setEnabled(
false );
230 cboResamplingMethod->clear();
233 for ( QPair<QString, QString> method : constProviderType )
235 cboResamplingMethod->addItem( method.second, method.first );
239 QString prefix = provider->
name() +
"/driverOptions/_pyramids/";
240 QgsSettings mySettings;
241 QString defaultMethod = mySettings.value( prefix +
"resampling",
"AVERAGE" ).toString();
242 int idx = cboResamplingMethod->findData( defaultMethod );
244 cboResamplingMethod->setCurrentIndex( idx );
248 const QList< QgsRasterPyramid > myPyramidList = provider->
buildPyramidList();
252 if ( pyramid.getExists() )
254 lbxPyramidResolutions->addItem(
new QListWidgetItem( myPyramidPixmap,
255 QString::number( pyramid.getXDim() ) + QStringLiteral(
" x " ) +
256 QString::number( pyramid.getYDim() ) ) );
260 lbxPyramidResolutions->addItem(
new QListWidgetItem( myNoPyramidPixmap,
261 QString::number( pyramid.getXDim() ) + QStringLiteral(
" x " ) +
262 QString::number( pyramid.getYDim() ) ) );
269 mOptsPage_Pyramids->setEnabled(
false );
278 mOptsPage_Histogram->setEnabled(
false );
281 QVBoxLayout *layout =
new QVBoxLayout( metadataFrame );
282 layout->setContentsMargins( 0, 0, 0, 0 );
284 mMetadataWidget->layout()->setContentsMargins( 0, 0, 0, 0 );
286 layout->addWidget( mMetadataWidget );
287 metadataFrame->setLayout( layout );
289 QVBoxLayout *temporalLayout =
new QVBoxLayout( temporalFrame );
290 temporalLayout->setContentsMargins( 0, 0, 0, 0 );
292 temporalLayout->addWidget( mTemporalWidget );
296 mCrsSelector->setCrs( mRasterLayer->
crs() );
299 QString pyramidFormat( QStringLiteral(
"<h2>%1</h2><p>%2 %3 %4</p><b><font color='red'><p>%5</p><p>%6</p>" ) );
300 QString pyramidHeader = tr(
"Description" );
301 QString pyramidSentence1 = tr(
"Large resolution raster layers can slow navigation in QGIS." );
302 QString pyramidSentence2 = tr(
"By creating lower resolution copies of the data (pyramids) performance can be considerably improved as QGIS selects the most suitable resolution to use depending on the level of zoom." );
303 QString pyramidSentence3 = tr(
"You must have write access in the directory where the original data is stored to build pyramids." );
304 QString pyramidSentence4 = tr(
"Please note that building internal pyramids may alter the original data file and once created they cannot be removed!" );
305 QString pyramidSentence5 = tr(
"Please note that building internal pyramids could corrupt your image - always make a backup of your data first!" );
307 tePyramidDescription->setHtml( pyramidFormat.arg( pyramidHeader,
312 pyramidSentence5 ) );
315 mResamplingGroupBox->setSaveCheckedState(
true );
316 mResamplingUtils.initWidgets( mRasterLayer, mZoomedInResamplingComboBox, mZoomedOutResamplingComboBox, mMaximumOversamplingSpinBox, mCbEarlyResampling );
317 mResamplingUtils.refreshWidgetsFromLayer();
321 btnColorizeColor->setColorDialogTitle( tr(
"Select Color" ) );
322 btnColorizeColor->setContext( QStringLiteral(
"symbology" ) );
327 if ( hueSaturationFilter )
329 sliderSaturation->setValue( hueSaturationFilter->
saturation() );
330 comboGrayscale->setCurrentIndex( (
int ) hueSaturationFilter->
grayscaleMode() );
333 toggleSaturationControls(
static_cast<int>( hueSaturationFilter->
grayscaleMode() ) );
336 mColorizeCheck->setChecked( hueSaturationFilter->
colorizeOn() );
337 btnColorizeColor->setColor( hueSaturationFilter->
colorizeColor() );
338 toggleColorizeControls( hueSaturationFilter->
colorizeOn() );
339 sliderColorizeStrength->setValue( hueSaturationFilter->
colorizeStrength() );
343 mBlendModeComboBox->setBlendMode( mRasterLayer->
blendMode() );
348 cboxTransparencyBand->setShowNotSetOption(
true, tr(
"None" ) );
349 cboxTransparencyBand->setLayer( mRasterLayer );
358 cboxTransparencyBand->setCurrentIndex( cboxTransparencyBand->findData( renderer->
alphaBand() ) );
365 mHistogramWidget =
nullptr;
366 if ( mOptsPage_Histogram->isEnabled() )
369 mHistogramStackedWidget->addWidget( mHistogramWidget );
382 mDisableRenderTypeComboBoxCurrentIndexChanged =
true;
384 for (
const QString &name : constRenderersList )
395 mDisableRenderTypeComboBoxCurrentIndexChanged =
false;
400 QString rendererType = renderer->
type();
401 widgetIndex = mRenderTypeComboBox->findData( rendererType );
402 if ( widgetIndex != -1 )
404 mDisableRenderTypeComboBoxCurrentIndexChanged =
true;
405 mRenderTypeComboBox->setCurrentIndex( widgetIndex );
406 mDisableRenderTypeComboBoxCurrentIndexChanged =
false;
409 if ( rendererType == QLatin1String(
"singlebandcolordata" ) && mRenderTypeComboBox->count() == 1 )
412 QSizePolicy sizep = mBandRenderingGrpBx->sizePolicy();
413 sizep.setVerticalStretch( 0 );
414 sizep.setVerticalPolicy( QSizePolicy::Maximum );
415 mBandRenderingGrpBx->setSizePolicy( sizep );
416 mBandRenderingGrpBx->updateGeometry();
419 if ( mRasterLayer->
providerType() != QLatin1String(
"wms" ) )
421 mWMSPrintGroupBox->hide();
422 mPublishDataSourceUrlCheckBox->hide();
423 mBackgroundLayerCheckBox->hide();
430 const int horizontalDpi = logicalDpiX();
433 if ( horizontalDpi > 96 )
435 mMetadataViewer->setZoomFactor( mMetadataViewer->zoomFactor() * 0.9 );
437 mMetadataViewer->page()->setLinkDelegationPolicy( QWebPage::LinkDelegationPolicy::DelegateAllLinks );
438 connect( mMetadataViewer->page(), &QWebPage::linkClicked,
this, &QgsRasterLayerProperties::urlClicked );
439 mMetadataViewer->page()->settings()->setAttribute( QWebSettings::DeveloperExtrasEnabled,
true );
440 mMetadataViewer->page()->settings()->setAttribute( QWebSettings::JavascriptEnabled,
true );
444 mRenderTypeComboBox_currentIndexChanged( widgetIndex );
449 QgsSettings settings;
452 if ( !settings.contains( QStringLiteral(
"/Windows/RasterLayerProperties/tab" ) ) )
454 settings.setValue( QStringLiteral(
"Windows/RasterLayerProperties/tab" ),
460 QString title = tr(
"Layer Properties — %1" ).arg( lyr->
name() );
468 mOptsPage_Information->setProperty(
"helpPage", QStringLiteral(
"working_with_raster/raster_properties.html#information-properties" ) );
469 mOptsPage_Source->setProperty(
"helpPage", QStringLiteral(
"working_with_raster/raster_properties.html#source-properties" ) );
470 mOptsPage_Style->setProperty(
"helpPage", QStringLiteral(
"working_with_raster/raster_properties.html#symbology-properties" ) );
471 mOptsPage_Transparency->setProperty(
"helpPage", QStringLiteral(
"working_with_raster/raster_properties.html#transparency-properties" ) );
473 if ( mOptsPage_Histogram )
474 mOptsPage_Histogram->setProperty(
"helpPage", QStringLiteral(
"working_with_raster/raster_properties.html#histogram-properties" ) );
476 mOptsPage_Rendering->setProperty(
"helpPage", QStringLiteral(
"working_with_raster/raster_properties.html#rendering-properties" ) );
478 if ( mOptsPage_Pyramids )
479 mOptsPage_Pyramids->setProperty(
"helpPage", QStringLiteral(
"working_with_raster/raster_properties.html#pyramids-properties" ) );
481 mOptsPage_Metadata->setProperty(
"helpPage", QStringLiteral(
"working_with_raster/raster_properties.html#metadata-properties" ) );
482 mOptsPage_Legend->setProperty(
"helpPage", QStringLiteral(
"working_with_raster/raster_properties.html#legend-properties" ) );
483 mOptsPage_Server->setProperty(
"helpPage", QStringLiteral(
"working_with_raster/raster_properties.html#server-properties" ) );
498 mLayerPropertiesPages << page;
501 if ( beforePage.isEmpty() )
514 void QgsRasterLayerProperties::setupTransparencyTable(
int nBands )
516 tableTransparency->clear();
517 tableTransparency->setColumnCount( 0 );
518 tableTransparency->setRowCount( 0 );
519 mTransparencyToEdited.clear();
523 tableTransparency->setColumnCount( 4 );
524 tableTransparency->setHorizontalHeaderItem( 0,
new QTableWidgetItem( tr(
"Red" ) ) );
525 tableTransparency->setHorizontalHeaderItem( 1,
new QTableWidgetItem( tr(
"Green" ) ) );
526 tableTransparency->setHorizontalHeaderItem( 2,
new QTableWidgetItem( tr(
"Blue" ) ) );
527 tableTransparency->setHorizontalHeaderItem( 3,
new QTableWidgetItem( tr(
"Percent Transparent" ) ) );
531 tableTransparency->setColumnCount( 3 );
534 if ( QgsRasterLayer::PalettedColor != mRasterLayer->drawingStyle() &&
535 QgsRasterLayer::PalettedSingleBandGray != mRasterLayer->drawingStyle() &&
536 QgsRasterLayer::PalettedSingleBandPseudoColor != mRasterLayer->drawingStyle() &&
537 QgsRasterLayer::PalettedMultiBandColor != mRasterLayer->drawingStyle() )
539 tableTransparency->setHorizontalHeaderItem( 0,
new QTableWidgetItem( tr(
"Gray" ) ) );
543 tableTransparency->setHorizontalHeaderItem( 0,
new QTableWidgetItem( tr(
"Indexed Value" ) ) );
546 tableTransparency->setHorizontalHeaderItem( 0,
new QTableWidgetItem( tr(
"From" ) ) );
547 tableTransparency->setHorizontalHeaderItem( 1,
new QTableWidgetItem( tr(
"To" ) ) );
548 tableTransparency->setHorizontalHeaderItem( 2,
new QTableWidgetItem( tr(
"Percent Transparent" ) ) );
551 tableTransparency->horizontalHeader()->setSectionResizeMode( 0, QHeaderView::Stretch );
552 tableTransparency->horizontalHeader()->setSectionResizeMode( 1, QHeaderView::Stretch );
555 void QgsRasterLayerProperties::populateTransparencyTable(
QgsRasterRenderer *renderer )
567 int nBands = renderer->
usesBands().size();
568 setupTransparencyTable( nBands );
571 if ( !rasterTransparency )
579 for (
int i = 0; i < pixelList.size(); ++i )
581 tableTransparency->insertRow( i );
582 setTransparencyCell( i, 0, pixelList[i].min );
583 setTransparencyCell( i, 1, pixelList[i].max );
584 setTransparencyCell( i, 2, pixelList[i].percentTransparent );
586 if ( pixelList[i].min != pixelList[i].max )
588 setTransparencyToEdited( i );
592 else if ( nBands == 3 )
595 for (
int i = 0; i < pixelList.size(); ++i )
597 tableTransparency->insertRow( i );
598 setTransparencyCell( i, 0, pixelList[i].red );
599 setTransparencyCell( i, 1, pixelList[i].green );
600 setTransparencyCell( i, 2, pixelList[i].blue );
601 setTransparencyCell( i, 3, pixelList[i].percentTransparent );
605 tableTransparency->resizeColumnsToContents();
606 tableTransparency->resizeRowsToContents();
609 void QgsRasterLayerProperties::setRendererWidget(
const QString &rendererName )
622 opacity = oldRenderer->
opacity();
631 QgsDebugMsgLevel( QStringLiteral(
"renderer has widgetCreateFunction" ), 3 );
634 if ( oldWidget && ( !oldRenderer || rendererName != oldRenderer->
type() ) )
636 if ( rendererName == QLatin1String(
"singlebandgray" ) )
639 whileBlocking( mRasterLayer )->setDefaultContrastEnhancement();
641 else if ( rendererName == QLatin1String(
"multibandcolor" ) )
644 whileBlocking( mRasterLayer )->setDefaultContrastEnhancement();
652 mRendererStackedWidget->addWidget( mRendererWidget );
658 QList<int> oldBands = oldRenderer->
usesBands();
659 QList<int> newBands = newRenderer->
usesBands();
660 if ( oldBands != newBands )
662 populateTransparencyTable( newRenderer );
670 const int widgetIndex = mRenderTypeComboBox->findData( rendererName );
671 if ( widgetIndex != -1 )
673 mDisableRenderTypeComboBoxCurrentIndexChanged =
true;
674 mRenderTypeComboBox->setCurrentIndex( widgetIndex );
675 mDisableRenderTypeComboBoxCurrentIndexChanged =
false;
678 if ( mRendererWidget != oldWidget )
681 if ( mHistogramWidget )
687 void QgsRasterLayerProperties::sync()
689 QgsSettings myQSettings;
691 if ( !mSourceWidget )
696 QHBoxLayout *layout =
new QHBoxLayout();
697 layout->addWidget( mSourceWidget );
698 mSourceGroupBox->setLayout( layout );
699 mSourceGroupBox->show();
703 buttonBox->button( QDialogButtonBox::Apply )->setEnabled( isValid );
704 buttonBox->button( QDialogButtonBox::Ok )->setEnabled( isValid );
719 gboxNoDataValue->setEnabled(
false );
720 gboxCustomTransparency->setEnabled(
false );
721 mOptionsStackedWidget->setCurrentWidget( mOptsPage_Server );
727 if ( mOptsPage_Pyramids )
729 delete mOptsPage_Pyramids;
730 mOptsPage_Pyramids =
nullptr;
736 if ( mOptsPage_Histogram )
738 delete mOptsPage_Histogram;
739 mOptsPage_Histogram =
nullptr;
740 delete mHistogramWidget;
741 mHistogramWidget =
nullptr;
753 if ( brightnessFilter )
755 mSliderBrightness->setValue( brightnessFilter->
brightness() );
756 mSliderContrast->setValue( brightnessFilter->
contrast() );
757 mGammaSpinBox->setValue( brightnessFilter->
gamma() );
763 if ( hueSaturationFilter )
765 sliderSaturation->setValue( hueSaturationFilter->
saturation() );
766 comboGrayscale->setCurrentIndex( (
int ) hueSaturationFilter->
grayscaleMode() );
769 toggleSaturationControls(
static_cast<int>( hueSaturationFilter->
grayscaleMode() ) );
772 mColorizeCheck->setChecked( hueSaturationFilter->
colorizeOn() );
773 btnColorizeColor->setColor( hueSaturationFilter->
colorizeColor() );
774 toggleColorizeControls( hueSaturationFilter->
colorizeOn() );
775 sliderColorizeStrength->setValue( hueSaturationFilter->
colorizeStrength() );
787 cboxTransparencyBand->setBand( renderer->
alphaBand() );
796 lblSrcNoDataValue->setText( QLocale().toString( v,
'g' ) );
800 lblSrcNoDataValue->setText( tr(
"not defined" ) );
807 mSrcNoDataValueCheckBox->setEnabled( enableSrcNoData );
808 lblSrcNoDataValue->setEnabled( enableSrcNoData );
811 QgsDebugMsgLevel( QStringLiteral(
"noDataRangeList.size = %1" ).arg( noDataRangeList.size() ), 3 );
812 if ( !noDataRangeList.isEmpty() )
818 leNoDataValue->insert( QString() );
825 populateTransparencyTable( mRasterLayer->
renderer() );
838 mLayerOrigNameLineEd->setText( mRasterLayer->
name() );
839 leDisplayName->setText( mRasterLayer->
name() );
846 updateInformationContent();
849 mLayerShortNameLineEdit->setText( mRasterLayer->
shortName() );
852 mLayerShortNameLineEdit->setValidator( shortNameValidator );
855 mLayerTitleLineEdit->setText( mRasterLayer->
title() );
856 mLayerAbstractTextEdit->setPlainText( mRasterLayer->
abstract() );
857 mLayerKeywordListLineEdit->setText( mRasterLayer->
keywordList() );
858 mLayerDataUrlLineEdit->setText( mRasterLayer->
dataUrl() );
859 mLayerDataUrlFormatComboBox->setCurrentIndex(
860 mLayerDataUrlFormatComboBox->findText(
866 mLayerAttributionLineEdit->setText( mRasterLayer->
attribution() );
867 mLayerAttributionUrlLineEdit->setText( mRasterLayer->
attributionUrl() );
868 mLayerMetadataUrlLineEdit->setText( mRasterLayer->
metadataUrl() );
869 mLayerMetadataUrlTypeComboBox->setCurrentIndex(
870 mLayerMetadataUrlTypeComboBox->findText(
874 mLayerMetadataUrlFormatComboBox->setCurrentIndex(
875 mLayerMetadataUrlFormatComboBox->findText(
880 mLayerLegendUrlLineEdit->setText( mRasterLayer->
legendUrl() );
881 mLayerLegendUrlFormatComboBox->setCurrentIndex( mLayerLegendUrlFormatComboBox->findText( mRasterLayer->
legendUrlFormat() ) );
884 QVariant wmsPrintLayer = mRasterLayer->
customProperty( QStringLiteral(
"WMSPrintLayer" ) );
885 if ( wmsPrintLayer.isValid() )
887 mWMSPrintLayerLineEdit->setText( wmsPrintLayer.toString() );
890 QVariant wmsPublishDataSourceUrl = mRasterLayer->
customProperty( QStringLiteral(
"WMSPublishDataSourceUrl" ),
false );
891 mPublishDataSourceUrlCheckBox->setChecked( wmsPublishDataSourceUrl.toBool() );
893 QVariant wmsBackgroundLayer = mRasterLayer->
customProperty( QStringLiteral(
"WMSBackgroundLayer" ),
false );
894 mBackgroundLayerCheckBox->setChecked( wmsBackgroundLayer.toBool() );
896 mLegendConfigEmbeddedWidget->setLayer( mRasterLayer );
902 page->syncToLayer( mRasterLayer );
907 void QgsRasterLayerProperties::apply()
911 const QString newSource = mSourceWidget->
sourceUri();
912 if ( newSource != mRasterLayer->
source() )
919 if ( !mRasterLayer->
isValid() )
925 mLegendConfigEmbeddedWidget->applyToLayer();
946 if (
"" != leNoDataValue->text() )
948 bool myDoubleOk =
false;
953 myNoDataRangeList << myNoDataRange;
956 for (
int bandNo = 1; bandNo <= mRasterLayer->
dataProvider()->bandCount(); bandNo++ )
964 if ( rendererWidget )
972 mMetadataFilled =
false;
976 if ( rasterRenderer )
978 rasterRenderer->
setAlphaBand( cboxTransparencyBand->currentBand() );
982 if ( tableTransparency->columnCount() == 4 )
985 QList<QgsRasterTransparency::TransparentThreeValuePixel> myTransparentThreeValuePixelList;
986 for (
int myListRunner = 0; myListRunner < tableTransparency->rowCount(); myListRunner++ )
988 myTransparentPixel.
red = transparencyCellValue( myListRunner, 0 );
989 myTransparentPixel.
green = transparencyCellValue( myListRunner, 1 );
990 myTransparentPixel.
blue = transparencyCellValue( myListRunner, 2 );
992 myTransparentThreeValuePixelList.append( myTransparentPixel );
996 else if ( tableTransparency->columnCount() == 3 )
999 QList<QgsRasterTransparency::TransparentSingleValuePixel> myTransparentSingleValuePixelList;
1000 for (
int myListRunner = 0; myListRunner < tableTransparency->rowCount(); myListRunner++ )
1002 myTransparentPixel.
min = transparencyCellValue( myListRunner, 0 );
1003 myTransparentPixel.
max = transparencyCellValue( myListRunner, 1 );
1006 myTransparentSingleValuePixelList.append( myTransparentPixel );
1014 rasterRenderer->
setOpacity( mOpacityWidget->opacity() );
1021 mRasterLayer->
setName( mLayerOrigNameLineEd->text() );
1036 mResamplingUtils.refreshLayerFromWidgets();
1040 if ( hueSaturationFilter )
1042 hueSaturationFilter->
setSaturation( sliderSaturation->value() );
1044 hueSaturationFilter->
setColorizeOn( mColorizeCheck->checkState() );
1050 mRasterLayer->
setBlendMode( mBlendModeComboBox->blendMode() );
1055 mRasterLayer->
setCrs( mCrsSelector->crs() );
1057 if ( mRasterLayer->
shortName() != mLayerShortNameLineEdit->text() )
1058 mMetadataFilled =
false;
1059 mRasterLayer->
setShortName( mLayerShortNameLineEdit->text() );
1061 if ( mRasterLayer->
title() != mLayerTitleLineEdit->text() )
1062 mMetadataFilled =
false;
1063 mRasterLayer->
setTitle( mLayerTitleLineEdit->text() );
1065 if ( mRasterLayer->
abstract() != mLayerAbstractTextEdit->toPlainText() )
1066 mMetadataFilled =
false;
1067 mRasterLayer->
setAbstract( mLayerAbstractTextEdit->toPlainText() );
1069 if ( mRasterLayer->
keywordList() != mLayerKeywordListLineEdit->text() )
1070 mMetadataFilled =
false;
1071 mRasterLayer->
setKeywordList( mLayerKeywordListLineEdit->text() );
1073 if ( mRasterLayer->
dataUrl() != mLayerDataUrlLineEdit->text() )
1074 mMetadataFilled =
false;
1075 mRasterLayer->
setDataUrl( mLayerDataUrlLineEdit->text() );
1077 if ( mRasterLayer->
dataUrlFormat() != mLayerDataUrlFormatComboBox->currentText() )
1078 mMetadataFilled =
false;
1079 mRasterLayer->
setDataUrlFormat( mLayerDataUrlFormatComboBox->currentText() );
1082 if ( mRasterLayer->
attribution() != mLayerAttributionLineEdit->text() )
1083 mMetadataFilled =
false;
1084 mRasterLayer->
setAttribution( mLayerAttributionLineEdit->text() );
1086 if ( mRasterLayer->
attributionUrl() != mLayerAttributionUrlLineEdit->text() )
1087 mMetadataFilled =
false;
1090 if ( mRasterLayer->
metadataUrl() != mLayerMetadataUrlLineEdit->text() )
1091 mMetadataFilled =
false;
1092 mRasterLayer->
setMetadataUrl( mLayerMetadataUrlLineEdit->text() );
1094 if ( mRasterLayer->
metadataUrlType() != mLayerMetadataUrlTypeComboBox->currentText() )
1095 mMetadataFilled =
false;
1098 if ( mRasterLayer->
metadataUrlFormat() != mLayerMetadataUrlFormatComboBox->currentText() )
1099 mMetadataFilled =
false;
1102 if ( mRasterLayer->
legendUrl() != mLayerLegendUrlLineEdit->text() )
1103 mMetadataFilled =
false;
1104 mRasterLayer->
setLegendUrl( mLayerLegendUrlLineEdit->text() );
1106 if ( mRasterLayer->
legendUrlFormat() != mLayerLegendUrlFormatComboBox->currentText() )
1107 mMetadataFilled =
false;
1110 if ( !mWMSPrintLayerLineEdit->text().isEmpty() )
1112 mRasterLayer->
setCustomProperty( QStringLiteral(
"WMSPrintLayer" ), mWMSPrintLayerLineEdit->text() );
1115 mRasterLayer->
setCustomProperty(
"WMSPublishDataSourceUrl", mPublishDataSourceUrlCheckBox->isChecked() );
1116 mRasterLayer->
setCustomProperty(
"WMSBackgroundLayer", mBackgroundLayerCheckBox->isChecked() );
1128 void QgsRasterLayerProperties::mLayerOrigNameLineEd_textEdited(
const QString &text )
1133 void QgsRasterLayerProperties::buttonBuildPyramids_clicked()
1145 for (
int myCounterInt = 0; myCounterInt < lbxPyramidResolutions->count(); myCounterInt++ )
1147 QListWidgetItem *myItem = lbxPyramidResolutions->item( myCounterInt );
1149 myPyramidList[myCounterInt].setBuild( myItem->isSelected() || myPyramidList[myCounterInt].getExists() );
1153 QString prefix = provider->
name() +
"/driverOptions/_pyramids/";
1154 QgsSettings mySettings;
1155 QString resamplingMethod( cboResamplingMethod->currentData().toString() );
1156 mySettings.setValue( prefix +
"resampling", resamplingMethod );
1163 QApplication::setOverrideCursor( Qt::WaitCursor );
1170 QApplication::restoreOverrideCursor();
1171 mPyramidProgress->setValue( 0 );
1172 buttonBuildPyramids->setEnabled(
false );
1173 if ( !res.isNull() )
1175 if ( res == QLatin1String(
"CANCELED" ) )
1179 else if ( res == QLatin1String(
"ERROR_WRITE_ACCESS" ) )
1181 QMessageBox::warning(
this, tr(
"Building Pyramids" ),
1182 tr(
"Write access denied. Adjust the file permissions and try again." ) );
1184 else if ( res == QLatin1String(
"ERROR_WRITE_FORMAT" ) )
1186 QMessageBox::warning(
this, tr(
"Building Pyramids" ),
1187 tr(
"The file was not writable. Some formats do not "
1188 "support pyramid overviews. Consult the GDAL documentation if in doubt." ) );
1190 else if ( res == QLatin1String(
"FAILED_NOT_SUPPORTED" ) )
1192 QMessageBox::warning(
this, tr(
"Building Pyramids" ),
1193 tr(
"Building pyramid overviews is not supported on this type of raster." ) );
1195 else if ( res == QLatin1String(
"ERROR_JPEG_COMPRESSION" ) )
1197 QMessageBox::warning(
this, tr(
"Building Pyramids" ),
1198 tr(
"Building internal pyramid overviews is not supported on raster layers with JPEG compression and your current libtiff library." ) );
1200 else if ( res == QLatin1String(
"ERROR_VIRTUAL" ) )
1202 QMessageBox::warning(
this, tr(
"Building Pyramids" ),
1203 tr(
"Building pyramid overviews is not supported on this type of raster." ) );
1211 lbxPyramidResolutions->clear();
1217 QList< QgsRasterPyramid >::iterator myRasterPyramidIterator;
1220 if ( pyramid.getExists() )
1222 lbxPyramidResolutions->addItem(
new QListWidgetItem( myPyramidPixmap,
1223 QString::number( pyramid.getXDim() ) + QStringLiteral(
" x " ) +
1224 QString::number( pyramid.getYDim() ) ) );
1228 lbxPyramidResolutions->addItem(
new QListWidgetItem( myNoPyramidPixmap,
1229 QString::number( pyramid.getXDim() ) + QStringLiteral(
" x " ) +
1230 QString::number( pyramid.getYDim() ) ) );
1239 updateInformationContent();
1242 void QgsRasterLayerProperties::urlClicked(
const QUrl &url )
1244 QFileInfo file( url.toLocalFile() );
1245 if ( file.exists() && !file.isDir() )
1248 QDesktopServices::openUrl( url );
1251 void QgsRasterLayerProperties::mRenderTypeComboBox_currentIndexChanged(
int index )
1253 if ( index < 0 || mDisableRenderTypeComboBoxCurrentIndexChanged || ! mRasterLayer->renderer() )
1258 QString rendererName = mRenderTypeComboBox->itemData( index ).toString();
1259 setRendererWidget( rendererName );
1262 void QgsRasterLayerProperties::pbnAddValuesFromDisplay_clicked()
1264 if ( mMapCanvas && mPixelSelectorTool )
1273 mMapCanvas->window()->raise();
1274 mMapCanvas->window()->activateWindow();
1275 mMapCanvas->window()->setFocus();
1276 mMapCanvas->
setMapTool( mPixelSelectorTool.get() );
1281 void QgsRasterLayerProperties::pbnAddValuesManually_clicked()
1289 tableTransparency->insertRow( tableTransparency->rowCount() );
1294 for (
int i = 0; i < n; i++ )
1296 setTransparencyCell( tableTransparency->rowCount() - 1, i, std::numeric_limits<double>::quiet_NaN() );
1299 setTransparencyCell( tableTransparency->rowCount() - 1, n, 100 );
1301 tableTransparency->resizeColumnsToContents();
1302 tableTransparency->resizeRowsToContents();
1312 void QgsRasterLayerProperties::pbnDefaultValues_clicked()
1314 if ( !mRendererWidget )
1328 setupTransparencyTable( nBands );
1330 tableTransparency->resizeColumnsToContents();
1331 tableTransparency->resizeRowsToContents();
1334 void QgsRasterLayerProperties::setTransparencyCell(
int row,
int column,
double value )
1336 QgsDebugMsgLevel( QStringLiteral(
"value = %1" ).arg( value, 0,
'g', 17 ), 3 );
1338 if ( !provider )
return;
1341 if ( !renderer )
return;
1342 int nBands = renderer->
usesBands().size();
1344 QLineEdit *lineEdit =
new QLineEdit();
1345 lineEdit->setFrame(
false );
1347 lineEdit->setContentsMargins( 1, 1, 1, 1 );
1349 if ( column == tableTransparency->columnCount() - 1 )
1353 lineEdit->setValidator(
new QIntValidator(
nullptr ) );
1354 lineEdit->setText( QString::number(
static_cast<int>( value ) ) );
1359 QString valueString;
1365 if ( !std::isnan( value ) )
1368 valueString = QLocale().toString( v,
'g' ) ;
1372 lineEdit->setValidator(
new QIntValidator(
nullptr ) );
1373 if ( !std::isnan( value ) )
1375 valueString = QLocale().toString(
static_cast<int>( value ) );
1379 lineEdit->setText( valueString );
1381 tableTransparency->setCellWidget( row, column, lineEdit );
1382 adjustTransparencyCellWidth( row, column );
1384 if ( nBands == 1 && ( column == 0 || column == 1 ) )
1386 connect( lineEdit, &QLineEdit::textEdited,
this, &QgsRasterLayerProperties::transparencyCellTextEdited );
1388 tableTransparency->resizeColumnsToContents();
1391 void QgsRasterLayerProperties::setTransparencyCellValue(
int row,
int column,
double value )
1393 QLineEdit *lineEdit =
dynamic_cast<QLineEdit *
>( tableTransparency->cellWidget( row, column ) );
1394 if ( !lineEdit )
return;
1396 lineEdit->setText( QLocale().toString( v,
'g' ) );
1397 lineEdit->adjustSize();
1398 adjustTransparencyCellWidth( row, column );
1399 tableTransparency->resizeColumnsToContents();
1402 double QgsRasterLayerProperties::transparencyCellValue(
int row,
int column )
1404 QLineEdit *lineEdit =
dynamic_cast<QLineEdit *
>( tableTransparency->cellWidget( row, column ) );
1405 if ( !lineEdit || lineEdit->text().isEmpty() )
1407 return std::numeric_limits<double>::quiet_NaN();
1409 return lineEdit->text().toDouble();
1412 void QgsRasterLayerProperties::adjustTransparencyCellWidth(
int row,
int column )
1414 QLineEdit *lineEdit =
dynamic_cast<QLineEdit *
>( tableTransparency->cellWidget( row, column ) );
1415 if ( !lineEdit )
return;
1417 int width = std::max( lineEdit->fontMetrics().boundingRect( lineEdit->text() ).width() + 10, 100 );
1418 width = std::max( width, tableTransparency->columnWidth( column ) );
1420 lineEdit->setFixedWidth( width );
1423 void QgsRasterLayerProperties::pbnExportTransparentPixelValues_clicked()
1425 QgsSettings myQSettings;
1426 QString myLastDir = myQSettings.value( QStringLiteral(
"lastRasterFileFilterDir" ), QDir::homePath() ).toString();
1427 QString myFileName = QFileDialog::getSaveFileName(
this, tr(
"Save File" ), myLastDir, tr(
"Textfile" ) +
" (*.txt)" );
1428 if ( !myFileName.isEmpty() )
1430 if ( !myFileName.endsWith( QLatin1String(
".txt" ), Qt::CaseInsensitive ) )
1432 myFileName = myFileName +
".txt";
1435 QFile myOutputFile( myFileName );
1436 if ( myOutputFile.open( QFile::WriteOnly | QIODevice::Truncate ) )
1438 QTextStream myOutputStream( &myOutputFile );
1439 myOutputStream <<
"# " << tr(
"QGIS Generated Transparent Pixel Value Export File" ) <<
'\n';
1440 if ( rasterIsMultiBandColor() )
1442 myOutputStream <<
"#\n#\n# " << tr(
"Red" ) <<
"\t" << tr(
"Green" ) <<
"\t" << tr(
"Blue" ) <<
"\t" << tr(
"Percent Transparent" );
1443 for (
int myTableRunner = 0; myTableRunner < tableTransparency->rowCount(); myTableRunner++ )
1445 myOutputStream <<
'\n' << QString::number( transparencyCellValue( myTableRunner, 0 ) ) <<
"\t"
1446 << QString::number( transparencyCellValue( myTableRunner, 1 ) ) <<
"\t"
1447 << QString::number( transparencyCellValue( myTableRunner, 2 ) ) <<
"\t"
1448 << QString::number( transparencyCellValue( myTableRunner, 3 ) );
1453 myOutputStream <<
"#\n#\n# " << tr(
"Value" ) <<
"\t" << tr(
"Percent Transparent" );
1455 for (
int myTableRunner = 0; myTableRunner < tableTransparency->rowCount(); myTableRunner++ )
1457 myOutputStream <<
'\n' << QString::number( transparencyCellValue( myTableRunner, 0 ) ) <<
"\t"
1458 << QString::number( transparencyCellValue( myTableRunner, 1 ) ) <<
"\t"
1459 << QString::number( transparencyCellValue( myTableRunner, 2 ) );
1465 QMessageBox::warning(
this, tr(
"Export Transparent Pixels" ), tr(
"Write access denied. Adjust the file permissions and try again.\n\n" ) );
1470 void QgsRasterLayerProperties::transparencyCellTextEdited(
const QString &text )
1479 int nBands = renderer->
usesBands().size();
1482 QLineEdit *lineEdit = qobject_cast<QLineEdit *>( sender() );
1483 if ( !lineEdit )
return;
1486 for (
int r = 0; r < tableTransparency->rowCount(); r++ )
1488 for (
int c = 0;
c < tableTransparency->columnCount();
c++ )
1490 if ( tableTransparency->cellWidget( r,
c ) == sender() )
1497 if ( row != -1 )
break;
1499 QgsDebugMsgLevel( QStringLiteral(
"row = %1 column =%2" ).arg( row ).arg( column ), 3 );
1503 QLineEdit *toLineEdit =
dynamic_cast<QLineEdit *
>( tableTransparency->cellWidget( row, 1 ) );
1504 if ( !toLineEdit )
return;
1505 bool toChanged = mTransparencyToEdited.value( row );
1506 QgsDebugMsgLevel( QStringLiteral(
"toChanged = %1" ).arg( toChanged ), 3 );
1509 toLineEdit->setText( lineEdit->text() );
1512 else if ( column == 1 )
1514 setTransparencyToEdited( row );
1519 void QgsRasterLayerProperties::aboutToShowStyleMenu()
1523 QMenu *m = qobject_cast<QMenu *>( sender() );
1531 void QgsRasterLayerProperties::syncToLayer()
1536 setRendererWidget( renderer->
type() );
1542 void QgsRasterLayerProperties::setTransparencyToEdited(
int row )
1544 if ( row >= mTransparencyToEdited.size() )
1546 mTransparencyToEdited.resize( row + 1 );
1548 mTransparencyToEdited[row] =
true;
1555 bool isMetadataPanel = ( index ==
mOptStackedWidget->indexOf( mOptsPage_Metadata ) );
1556 mBtnStyle->setVisible( ! isMetadataPanel );
1557 mBtnMetadata->setVisible( isMetadataPanel );
1559 if ( !mHistogramWidget )
1571 if ( index ==
mOptStackedWidget->indexOf( mOptsPage_Information ) || !mMetadataFilled )
1574 updateInformationContent();
1578 void QgsRasterLayerProperties::pbnImportTransparentPixelValues_clicked()
1580 int myLineCounter = 0;
1581 bool myImportError =
false;
1583 QgsSettings myQSettings;
1584 QString myLastDir = myQSettings.value( QStringLiteral(
"lastRasterFileFilterDir" ), QDir::homePath() ).toString();
1585 QString myFileName = QFileDialog::getOpenFileName(
this, tr(
"Open file" ), myLastDir, tr(
"Textfile" ) +
" (*.txt)" );
1586 QFile myInputFile( myFileName );
1587 if ( myInputFile.open( QFile::ReadOnly ) )
1589 QTextStream myInputStream( &myInputFile );
1590 QString myInputLine;
1591 if ( rasterIsMultiBandColor() )
1593 for (
int myTableRunner = tableTransparency->rowCount() - 1; myTableRunner >= 0; myTableRunner-- )
1595 tableTransparency->removeRow( myTableRunner );
1598 while ( !myInputStream.atEnd() )
1601 myInputLine = myInputStream.readLine();
1602 if ( !myInputLine.isEmpty() )
1604 if ( !myInputLine.simplified().startsWith(
'#' ) )
1606 #if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
1607 QStringList myTokens = myInputLine.split( QRegExp(
"\\s+" ), QString::SkipEmptyParts );
1609 QStringList myTokens = myInputLine.split( QRegExp(
"\\s+" ), Qt::SkipEmptyParts );
1611 if ( myTokens.count() != 4 )
1613 myImportError =
true;
1614 myBadLines = myBadLines + QString::number( myLineCounter ) +
":\t[" + myInputLine +
"]\n";
1618 tableTransparency->insertRow( tableTransparency->rowCount() );
1619 for (
int col = 0; col < 4; col++ )
1621 setTransparencyCell( tableTransparency->rowCount() - 1, col, myTokens[col].toDouble() );
1630 for (
int myTableRunner = tableTransparency->rowCount() - 1; myTableRunner >= 0; myTableRunner-- )
1632 tableTransparency->removeRow( myTableRunner );
1635 while ( !myInputStream.atEnd() )
1638 myInputLine = myInputStream.readLine();
1639 if ( !myInputLine.isEmpty() )
1641 if ( !myInputLine.simplified().startsWith(
'#' ) )
1643 #if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
1644 QStringList myTokens = myInputLine.split( QRegExp(
"\\s+" ), QString::SkipEmptyParts );
1646 QStringList myTokens = myInputLine.split( QRegExp(
"\\s+" ), Qt::SkipEmptyParts );
1648 if ( myTokens.count() != 3 && myTokens.count() != 2 )
1650 myImportError =
true;
1651 myBadLines = myBadLines + QString::number( myLineCounter ) +
":\t[" + myInputLine +
"]\n";
1655 if ( myTokens.count() == 2 )
1657 myTokens.insert( 1, myTokens[0] );
1659 tableTransparency->insertRow( tableTransparency->rowCount() );
1660 for (
int col = 0; col < 3; col++ )
1662 setTransparencyCell( tableTransparency->rowCount() - 1, col, myTokens[col].toDouble() );
1670 if ( myImportError )
1672 QMessageBox::warning(
this, tr(
"Import Transparent Pixels" ), tr(
"The following lines contained errors\n\n%1" ).arg( myBadLines ) );
1675 else if ( !myFileName.isEmpty() )
1677 QMessageBox::warning(
this, tr(
"Import Transparent Pixels" ), tr(
"Read access denied. Adjust the file permissions and try again.\n\n" ) );
1679 tableTransparency->resizeColumnsToContents();
1680 tableTransparency->resizeRowsToContents();
1683 void QgsRasterLayerProperties::pbnRemoveSelectedRow_clicked()
1685 if ( 0 < tableTransparency->rowCount() )
1687 tableTransparency->removeRow( tableTransparency->currentRow() );
1691 void QgsRasterLayerProperties::pixelSelected(
const QgsPointXY &canvasPoint,
const Qt::MouseButton &btn )
1701 if ( mMapCanvas && mPixelSelectorTool )
1710 int myWidth = mMapCanvas->
extent().
width() / mapUnitsPerPixel;
1711 int myHeight = mMapCanvas->
extent().
height() / mapUnitsPerPixel;
1715 QList<int> bands = renderer->
usesBands();
1717 QList<double> values;
1718 for (
int i = 0; i < bands.size(); ++i )
1720 int bandNo = bands.value( i );
1721 if ( myPixelMap.count( bandNo ) == 1 )
1723 if ( myPixelMap.value( bandNo ).isNull() )
1727 double value = myPixelMap.value( bandNo ).toDouble();
1728 QgsDebugMsgLevel( QStringLiteral(
"value = %1" ).arg( value, 0,
'g', 17 ), 3 );
1729 values.append( value );
1732 if ( bands.size() == 1 )
1735 values.insert( 1, values.value( 0 ) );
1737 tableTransparency->insertRow( tableTransparency->rowCount() );
1738 for (
int i = 0; i < values.size(); i++ )
1740 setTransparencyCell( tableTransparency->rowCount() - 1, i, values.value( i ) );
1742 setTransparencyCell( tableTransparency->rowCount() - 1, tableTransparency->columnCount() - 1, 100 );
1746 tableTransparency->resizeColumnsToContents();
1747 tableTransparency->resizeRowsToContents();
1750 void QgsRasterLayerProperties::toggleSaturationControls(
int grayscaleMode )
1753 if ( grayscaleMode == 0 )
1755 sliderSaturation->setEnabled(
true );
1756 spinBoxSaturation->setEnabled(
true );
1760 sliderSaturation->setEnabled(
false );
1761 spinBoxSaturation->setEnabled(
false );
1765 void QgsRasterLayerProperties::toggleColorizeControls(
bool colorizeEnabled )
1768 btnColorizeColor->setEnabled( colorizeEnabled );
1769 sliderColorizeStrength->setEnabled( colorizeEnabled );
1770 spinColorizeStrength->setEnabled( colorizeEnabled );
1774 QLinearGradient QgsRasterLayerProperties::redGradient()
1778 QLinearGradient myGradient = QLinearGradient( mGradientWidth, 0, mGradientWidth, mGradientHeight );
1779 myGradient.setColorAt( 0.0, QColor( 242, 14, 25, 190 ) );
1780 myGradient.setColorAt( 0.5, QColor( 175, 29, 37, 190 ) );
1781 myGradient.setColorAt( 1.0, QColor( 114, 17, 22, 190 ) );
1784 QLinearGradient QgsRasterLayerProperties::greenGradient()
1788 QLinearGradient myGradient = QLinearGradient( mGradientWidth, 0, mGradientWidth, mGradientHeight );
1789 myGradient.setColorAt( 0.0, QColor( 48, 168, 5, 190 ) );
1790 myGradient.setColorAt( 0.8, QColor( 36, 122, 4, 190 ) );
1791 myGradient.setColorAt( 1.0, QColor( 21, 71, 2, 190 ) );
1794 QLinearGradient QgsRasterLayerProperties::blueGradient()
1798 QLinearGradient myGradient = QLinearGradient( mGradientWidth, 0, mGradientWidth, mGradientHeight );
1799 myGradient.setColorAt( 0.0, QColor( 30, 0, 106, 190 ) );
1800 myGradient.setColorAt( 0.2, QColor( 30, 72, 128, 190 ) );
1801 myGradient.setColorAt( 1.0, QColor( 30, 223, 196, 190 ) );
1804 QLinearGradient QgsRasterLayerProperties::grayGradient()
1808 QLinearGradient myGradient = QLinearGradient( mGradientWidth, 0, mGradientWidth, mGradientHeight );
1809 myGradient.setColorAt( 0.0, QColor( 5, 5, 5, 190 ) );
1810 myGradient.setColorAt( 0.8, QColor( 122, 122, 122, 190 ) );
1811 myGradient.setColorAt( 1.0, QColor( 220, 220, 220, 190 ) );
1814 QLinearGradient QgsRasterLayerProperties::highlightGradient()
1818 QLinearGradient myGradient = QLinearGradient( mGradientWidth, 0, mGradientWidth, mGradientHeight );
1819 myGradient.setColorAt( 1.0, QColor( 255, 255, 255, 50 ) );
1820 myGradient.setColorAt( 0.5, QColor( 255, 255, 255, 100 ) );
1821 myGradient.setColorAt( 0.0, QColor( 255, 255, 255, 150 ) );
1832 void QgsRasterLayerProperties::loadDefaultStyle_clicked()
1834 bool defaultLoadedFlag =
false;
1837 if ( defaultLoadedFlag )
1844 QMessageBox::information(
this,
1845 tr(
"Default Style" ),
1851 void QgsRasterLayerProperties::saveDefaultStyle_clicked()
1857 bool defaultSavedFlag =
false;
1861 if ( !defaultSavedFlag )
1864 QMessageBox::information(
this,
1865 tr(
"Default Style" ),
1872 void QgsRasterLayerProperties::loadStyle_clicked()
1874 QgsSettings settings;
1875 QString lastUsedDir = settings.value( QStringLiteral(
"style/lastStyleDir" ), QDir::homePath() ).toString();
1877 QString fileName = QFileDialog::getOpenFileName(
1879 tr(
"Load layer properties from style file" ),
1881 tr(
"QGIS Layer Style File" ) +
" (*.qml)" );
1882 if ( fileName.isEmpty() )
1886 if ( !fileName.endsWith( QLatin1String(
".qml" ), Qt::CaseInsensitive ) )
1887 fileName += QLatin1String(
".qml" );
1891 bool defaultLoadedFlag =
false;
1892 QString message = mRasterLayer->
loadNamedStyle( fileName, defaultLoadedFlag );
1893 if ( defaultLoadedFlag )
1895 settings.setValue( QStringLiteral(
"style/lastStyleDir" ), QFileInfo( fileName ).absolutePath() );
1900 QMessageBox::information(
this, tr(
"Save Style" ), message );
1905 void QgsRasterLayerProperties::saveStyleAs_clicked()
1907 QgsSettings settings;
1908 QString lastUsedDir = settings.value( QStringLiteral(
"style/lastStyleDir" ), QDir::homePath() ).toString();
1910 QString selectedFilter;
1911 QString outputFileName = QFileDialog::getSaveFileName(
1913 tr(
"Save layer properties as style file" ),
1915 tr(
"QGIS Layer Style File" ) +
" (*.qml)" +
";;" + tr(
"Styled Layer Descriptor" ) +
" (*.sld)",
1917 if ( outputFileName.isEmpty() )
1922 if ( selectedFilter.contains( QStringLiteral(
".qml" ), Qt::CaseInsensitive ) )
1925 type = StyleType::QML;
1930 type = StyleType::SLD;
1936 bool defaultLoadedFlag =
false;
1942 message = mRasterLayer->
saveNamedStyle( outputFileName, defaultLoadedFlag );
1947 message = mRasterLayer->
saveSldStyle( outputFileName, defaultLoadedFlag );
1951 if ( defaultLoadedFlag )
1953 settings.setValue( QStringLiteral(
"style/lastStyleDir" ), QFileInfo( outputFileName ).absolutePath() );
1957 QMessageBox::information(
this, tr(
"Save Style" ), message );
1960 void QgsRasterLayerProperties::restoreWindowModality()
1975 void QgsRasterLayerProperties::loadMetadata()
1977 QgsSettings myQSettings;
1978 QString myLastUsedDir = myQSettings.value( QStringLiteral(
"style/lastStyleDir" ), QDir::homePath() ).toString();
1980 QString myFileName = QFileDialog::getOpenFileName(
this, tr(
"Load layer metadata from metadata file" ), myLastUsedDir,
1981 tr(
"QGIS Layer Metadata File" ) +
" (*.qmd)" );
1982 if ( myFileName.isNull() )
1988 bool defaultLoadedFlag =
false;
1992 if ( defaultLoadedFlag )
1999 QMessageBox::warning(
this, tr(
"Load Metadata" ), myMessage );
2002 QFileInfo myFI( myFileName );
2003 QString myPath = myFI.path();
2004 myQSettings.setValue( QStringLiteral(
"style/lastStyleDir" ), myPath );
2009 void QgsRasterLayerProperties::saveMetadataAs()
2011 QgsSettings myQSettings;
2012 QString myLastUsedDir = myQSettings.value( QStringLiteral(
"style/lastStyleDir" ), QDir::homePath() ).toString();
2014 QString myOutputFileName = QFileDialog::getSaveFileName(
this, tr(
"Save Layer Metadata as QMD" ),
2015 myLastUsedDir, tr(
"QMD File" ) +
" (*.qmd)" );
2016 if ( myOutputFileName.isNull() )
2029 bool defaultLoadedFlag =
false;
2030 QString message = mRasterLayer->
saveNamedMetadata( myOutputFileName, defaultLoadedFlag );
2031 if ( defaultLoadedFlag )
2032 myQSettings.setValue( QStringLiteral(
"style/lastStyleDir" ), QFileInfo( myOutputFileName ).absolutePath() );
2034 QMessageBox::information(
this, tr(
"Save Metadata" ), message );
2037 void QgsRasterLayerProperties::saveDefaultMetadata()
2041 bool defaultSavedFlag =
false;
2043 if ( !defaultSavedFlag )
2045 QMessageBox::warning(
this, tr(
"Default Metadata" ), errorMsg );
2049 void QgsRasterLayerProperties::loadDefaultMetadata()
2051 bool defaultLoadedFlag =
false;
2054 if ( defaultLoadedFlag )
2060 QMessageBox::information(
this, tr(
"Default Metadata" ), myMessage );
2065 void QgsRasterLayerProperties::toggleBuildPyramidsButton()
2067 if ( lbxPyramidResolutions->selectedItems().empty() )
2069 buttonBuildPyramids->setEnabled(
false );
2073 buttonBuildPyramids->setEnabled(
true );
2077 void QgsRasterLayerProperties::mResetColorRenderingBtn_clicked()
2079 mBlendModeComboBox->setBlendMode( QPainter::CompositionMode_SourceOver );
2080 mSliderBrightness->setValue( 0 );
2081 mSliderContrast->setValue( 0 );
2082 mGammaSpinBox->setValue( 1.0 );
2083 sliderSaturation->setValue( 0 );
2085 mColorizeCheck->setChecked(
false );
2086 sliderColorizeStrength->setValue( 100 );
2089 bool QgsRasterLayerProperties::rasterIsMultiBandColor()
2094 void QgsRasterLayerProperties::updateInformationContent()
2098 const QString html { mRasterLayer->
htmlMetadata().replace( QLatin1String(
"<head>" ), QStringLiteral( R
"raw(<head><style type="text/css">%1</style>)raw" ) ).arg( myStyle ) };
2099 mMetadataViewer->setHtml( html );
2100 mMetadataFilled = true;
2103 void QgsRasterLayerProperties::onCancel()
2109 QDomDocument doc( QStringLiteral(
"qgis" ) );
2110 int errorLine, errorColumn;
2111 doc.setContent( mOldStyle.
xmlData(),
false, &myMessage, &errorLine, &errorColumn );
2117 void QgsRasterLayerProperties::showHelp()
2119 const QVariant helpPage = mOptionsStackedWidget->currentWidget()->property(
"helpPage" );
2121 if ( helpPage.isValid() )
2127 QgsHelp::openHelp( QStringLiteral(
"working_with_raster/raster_properties.html" ) );
2131 void QgsRasterLayerProperties::updateGammaSpinBox(
int value )
2136 void QgsRasterLayerProperties::updateGammaSlider(
double value )
@ Float32
Thirty two bit floating point (float)
@ ARGB32_Premultiplied
Color, alpha, red, green, blue, 4 bytes the same as QImage::Format_ARGB32_Premultiplied.
@ ARGB32
Color, alpha, red, green, blue, 4 bytes the same as QImage::Format_ARGB32.
@ Float64
Sixty four bit floating point (double)
static QString reportStyleSheet(QgsApplication::StyleSheetType styleSheetType=QgsApplication::StyleSheetType::Qt)
Returns a css style sheet for reports, the styleSheetType argument determines what type of stylesheet...
static QgsRasterRendererRegistry * rasterRendererRegistry()
Returns the application's raster renderer registry, used for managing raster layer renderers.
static QRegExp shortNameRegExp()
Returns the short name regular expression for line edit validator.
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
Brightness/contrast and gamma correction filter pipe for rasters.
int contrast() const
Returns current contrast level.
int brightness() const
Returns current brightness level.
double gamma() const
Returns current gamma value.
void setGamma(double gamma)
Set gamma value.
void setContrast(int contrast)
Set contrast level.
void setBrightness(int brightness)
Set brightness level.
This class represents a coordinate reference system (CRS).
QString userFriendlyIdentifier(IdentifierType type=MediumString) const
Returns a user friendly identifier for the CRS.
@ WKT_PREFERRED
Preferred format, matching the most recent WKT ISO standard. Currently an alias to WKT2_2019,...
QString toWkt(WktVariant variant=WKT1_GDAL, bool multiline=false, int indentationWidth=4) const
Returns a WKT representation of this CRS.
virtual QString name() const =0
Returns a provider name.
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 progressChanged(double progress)
Emitted when the feedback object reports a progress change.
static QString ensureFileNameHasExtension(const QString &fileName, const QStringList &extensions)
Ensures that a fileName ends with an extension from the provided list of extensions.
static QgsProviderSourceWidgetProviderRegistry * sourceWidgetProviderRegistry()
Returns the registry of provider source widget providers.
static QgsGui * instance()
Returns a pointer to the singleton instance.
static QgsNative * nativePlatformInterface()
Returns the global native interface, which offers abstraction to the host OS's underlying public inte...
static void openHelp(const QString &key)
Opens help topic for the given help key using default system web browser.
Color and saturation filter pipe for rasters.
void setColorizeOn(bool colorizeOn)
void setSaturation(int saturation)
int colorizeStrength() const
void setGrayscaleMode(QgsHueSaturationFilter::GrayscaleMode grayscaleMode)
QgsHueSaturationFilter::GrayscaleMode grayscaleMode() const
void setColorizeColor(const QColor &colorizeColor)
void setColorizeStrength(int colorizeStrength)
QColor colorizeColor() const
Map canvas is a class for displaying all GIS data types on a canvas.
void unsetMapTool(QgsMapTool *mapTool)
Unset the current map tool or last non zoom tool.
void setMapTool(QgsMapTool *mapTool, bool clean=false)
Sets the map tool currently being used on the canvas.
double mapUnitsPerPixel() const
Returns the mapUnitsPerPixel (map units per pixel) for the canvas.
const QgsMapSettings & mapSettings() const
Gets access to properties used for map rendering.
QgsRectangle extent() const
Returns the current zoom extent of the map canvas.
static QgsMapLayerLegend * defaultRasterLegend(QgsRasterLayer *rl)
Create new legend implementation for raster layer.
void removesExtraMenuSeparators(QMenu *m)
removes extra separators from the menu
void addStyleManagerActions(QMenu *m, QgsMapLayer *layer)
adds actions to the menu in accordance to the layer
static QgsMapLayerStyleGuiUtils * instance()
returns a singleton instance of this class
QString currentStyle() const
Returns name of the current style.
bool isDefault(const QString &styleName) const
Returns true if this is the default style.
QgsMapLayerStyle style(const QString &name) const
Returns data of a stored style - accessed by its unique name.
void currentStyleChanged(const QString ¤tName)
Emitted when the current style has been changed.
QString xmlData() const
Returns XML content of the style.
Base class for all map layer types.
void setShortName(const QString &shortName)
Sets the short name of the layer used by QGIS Server to identify the layer.
QString legendUrlFormat() const
Returns the format for a URL based layer legend.
virtual bool importNamedStyle(QDomDocument &doc, QString &errorMsg, QgsMapLayer::StyleCategories categories=QgsMapLayer::AllStyleCategories)
Import the properties of this layer from a QDomDocument.
void setAbstract(const QString &abstract)
Sets the abstract of the layer used by QGIS Server in GetCapabilities request.
virtual QString saveSldStyle(const QString &uri, bool &resultFlag) const
Saves the properties of this layer to an SLD format file.
QString source() const
Returns the source for the layer.
void setLegendUrl(const QString &legendUrl)
Sets the URL for the layer's legend.
Q_INVOKABLE QVariant customProperty(const QString &value, const QVariant &defaultValue=QVariant()) const
Read a custom property from layer.
void setBlendMode(QPainter::CompositionMode blendMode)
Set the blending mode used for rendering a layer.
void setMinimumScale(double scale)
Sets the minimum map scale (i.e.
QgsCoordinateReferenceSystem crs
QString attribution() const
Returns the attribution of the layer used by QGIS Server in GetCapabilities request.
virtual QString loadDefaultStyle(bool &resultFlag)
Retrieve the default style for this layer if one exists (either as a .qml file on disk or as a record...
virtual QString loadNamedMetadata(const QString &uri, bool &resultFlag)
Retrieve a named metadata for this layer if one exists (either as a .qmd file on disk or as a record ...
bool hasAutoRefreshEnabled() const
Returns true if auto refresh is enabled for the layer.
void triggerRepaint(bool deferredUpdate=false)
Will advise the map canvas (and any other interested party) that this layer requires to be repainted.
void setAttributionUrl(const QString &attribUrl)
Sets the attribution URL of the layer used by QGIS Server in GetCapabilities request.
void setAutoRefreshEnabled(bool enabled)
Sets whether auto refresh is enabled for the layer.
void setMaximumScale(double scale)
Sets the maximum map scale (i.e.
QgsLayerMetadata metadata
static QString formatLayerName(const QString &name)
A convenience function to capitalize and format a layer name.
QString abstract() const
Returns the abstract of the layer used by QGIS Server in GetCapabilities request.
QString dataUrlFormat() const
Returns the DataUrl format of the layer used by QGIS Server in GetCapabilities request.
QPainter::CompositionMode blendMode() const
Returns the current blending mode for a layer.
void setDataUrl(const QString &dataUrl)
Sets the DataUrl of the layer used by QGIS Server in GetCapabilities request.
virtual QString saveDefaultStyle(bool &resultFlag)
Save the properties of this layer as the default style (either as a .qml file on disk or as a record ...
void setKeywordList(const QString &keywords)
Sets the keyword list of the layer used by QGIS Server in GetCapabilities request.
void setAttribution(const QString &attrib)
Sets the attribution of the layer used by QGIS Server in GetCapabilities request.
QString shortName() const
Returns the short name of the layer used by QGIS Server to identify the layer.
virtual QString saveDefaultMetadata(bool &resultFlag)
Save the current metadata of this layer as the default metadata (either as a .qmd file on disk or as ...
void setDataUrlFormat(const QString &dataUrlFormat)
Sets the DataUrl format of the layer used by QGIS Server in GetCapabilities request.
Q_INVOKABLE void setCustomProperty(const QString &key, const QVariant &value)
Set a custom property for layer.
QString title() const
Returns the title of the layer used by QGIS Server in GetCapabilities request.
void setScaleBasedVisibility(bool enabled)
Sets whether scale based visibility is enabled for the layer.
QString dataUrl() const
Returns the DataUrl of the layer used by QGIS Server in GetCapabilities request.
bool hasScaleBasedVisibility() const
Returns whether scale based visibility is enabled for the layer.
virtual QString loadNamedStyle(const QString &uri, bool &resultFlag, QgsMapLayer::StyleCategories categories=QgsMapLayer::AllStyleCategories)
Retrieve a named style for this layer if one exists (either as a .qml file on disk or as a record in ...
QString metadataUrlFormat() const
Returns the metadata format of the layer used by QGIS Server in GetCapabilities request.
void setMetadataUrlFormat(const QString &metaUrlFormat)
Sets the metadata format of the layer used by QGIS Server in GetCapabilities request.
static QString extensionPropertyType(PropertyType type)
Returns the extension of a Property.
void setName(const QString &name)
Set the display name of the layer.
void setAutoRefreshInterval(int interval)
Sets the auto refresh interval (in milliseconds) for the layer.
QString metadataUrl() const
Returns the metadata URL of the layer used by QGIS Server in GetCapabilities request.
QString saveNamedMetadata(const QString &uri, bool &resultFlag)
Save the current metadata of this layer as a named metadata (either as a .qmd file on disk or as a re...
QString attributionUrl() const
Returns the attribution URL of the layer used by QGIS Server in GetCapabilities request.
void setDataSource(const QString &dataSource, const QString &baseName, const QString &provider, bool loadDefaultStyleFlag=false)
Updates the data source of the layer.
double minimumScale() const
Returns the minimum map scale (i.e.
QgsMapLayerStyleManager * styleManager() const
Gets access to the layer's style manager.
QString legendUrl() const
Returns the URL for the layer's legend.
void setLegendUrlFormat(const QString &legendUrlFormat)
Sets the format for a URL based layer legend.
virtual QString saveNamedStyle(const QString &uri, bool &resultFlag, StyleCategories categories=AllStyleCategories)
Save the properties of this layer as a named style (either as a .qml file on disk or as a record in t...
void setMetadataUrl(const QString &metaUrl)
Sets the metadata URL of the layer used by QGIS Server in GetCapabilities request.
void setMetadataUrlType(const QString &metaUrlType)
Set the metadata type of the layer used by QGIS Server in GetCapabilities request MetadataUrlType ind...
void setLegend(QgsMapLayerLegend *legend)
Assign a legend controller to the map layer.
virtual QString metadataUri() const
Retrieve the metadata URI for this layer (either as a .qmd file on disk or as a record in the users s...
QString metadataUrlType() const
Returns the metadata type of the layer used by QGIS Server in GetCapabilities request.
double maximumScale() const
Returns the maximum map scale (i.e.
QString keywordList() const
Returns the keyword list of the layer used by QGIS Server in GetCapabilities request.
void setTitle(const QString &title)
Sets the title of the layer used by QGIS Server in GetCapabilities request.
void setCrs(const QgsCoordinateReferenceSystem &srs, bool emitSignal=true)
Sets layer's spatial reference system.
The QgsMapSettings class contains configuration for rendering of the map.
QgsRectangle outputExtentToLayerExtent(const QgsMapLayer *layer, QgsRectangle extent) const
transform bounding box from output CRS to layer's CRS
QgsPointXY mapToLayerCoordinates(const QgsMapLayer *layer, QgsPointXY point) const
transform point coordinates from output CRS to layer's CRS
Renderer for multiband images with the color components.
A base dialog for options and properties dialogs that offers vertical tabs.
void insertPage(const QString &title, const QString &tooltip, const QIcon &icon, QWidget *widget, const QString &before)
Inserts a new page into the dialog pages.
virtual void optionsStackedWidget_CurrentChanged(int index)
Select relevant tab on current page change.
void addPage(const QString &title, const QString &tooltip, const QIcon &icon, QWidget *widget)
Adds a new page to the dialog pages.
void restoreOptionsBaseUi(const QString &title=QString())
Restore the base ui.
QStackedWidget * mOptStackedWidget
void initOptionsBase(bool restoreUi=true, const QString &title=QString())
Set up the base ui connections for vertical tabs.
A class to represent a 2D point.
static QgsProject * instance()
Returns the QgsProject singleton instance.
void setDirty(bool b=true)
Flag the project as dirty (modified).
Feedback object tailored for raster block reading.
static QString printValue(double value)
Print double value with all necessary significant digits.
Base class for raster data providers.
virtual QString buildPyramids(const QList< QgsRasterPyramid > &pyramidList, const QString &resamplingMethod="NEAREST", QgsRaster::RasterPyramidsFormat format=QgsRaster::PyramidsGTiff, const QStringList &configOptions=QStringList(), QgsRasterBlockFeedback *feedback=nullptr)
Creates pyramid overviews.
virtual bool sourceHasNoDataValue(int bandNo) const
Returns true if source band has no data value.
virtual bool useSourceNoDataValue(int bandNo) const
Returns the source nodata value usage.
virtual QList< QgsRasterPyramid > buildPyramidList(const QList< int > &overviewList=QList< int >())
Returns the raster layers pyramid list.
Qgis::DataType sourceDataType(int bandNo) const override=0
Returns source data type for the band specified by number, source data type may be shorter than dataT...
virtual void setUseSourceNoDataValue(int bandNo, bool use)
Sets the source nodata value usage.
virtual double sourceNoDataValue(int bandNo) const
Value representing no data value.
virtual QgsRasterIdentifyResult identify(const QgsPointXY &point, QgsRaster::IdentifyFormat format, const QgsRectangle &boundingBox=QgsRectangle(), int width=0, int height=0, int dpi=96)
Identify raster value(s) found on the point position.
Qgis::DataType dataType(int bandNo) const override=0
Returns data type for the band specified by number.
virtual QgsRasterRangeList userNoDataValues(int bandNo) const
Returns a list of user no data value ranges.
static QList< QPair< QString, QString > > pyramidResamplingMethods(const QString &providerKey)
Returns a list of pyramid resampling method name and label pairs for given provider.
virtual void setUserNoDataValue(int bandNo, const QgsRasterRangeList &noData)
QMap< int, QVariant > results() const
Returns the identify results.
@ BuildPyramids
Supports building of pyramids (overviews)
@ Size
Original data source size (and thus resolution) is known, it is not always available,...
virtual int capabilities() const
Returns a bitmask containing the supported capabilities.
StyleType
enumeration for the different types of style
void addPropertiesPageFactory(const QgsMapLayerConfigWidgetFactory *factory)
Adds a properties page factory to the raster layer properties dialog.
QgsRasterLayerProperties(QgsMapLayer *lyr, QgsMapCanvas *canvas, QWidget *parent=nullptr, Qt::WindowFlags=QgsGuiUtils::ModalDialogFlags)
Constructor.
void optionsStackedWidget_CurrentChanged(int index) override
auto slot executed when the active page in the main widget stack is changed
Represents a raster layer.
QString htmlMetadata() const override
Obtain a formatted HTML string containing assorted metadata for this layer.
QgsHueSaturationFilter * hueSaturationFilter() const
Returns the raster's hue/saturation filter.
LayerType rasterType()
Returns the raster layer type (which is a read only property).
QgsRasterDataProvider * dataProvider() override
Returns the source data provider.
QString providerType() const
[ data provider interface ] Which provider is being used for this Raster Layer?
QgsBrightnessContrastFilter * brightnessFilter() const
Returns the raster's brightness/contrast filter.
QgsRasterRenderer * renderer() const
Returns the raster's renderer.
void setRenderer(QgsRasterRenderer *renderer)
Sets the raster's renderer.
This struct is used to store pyramid info for the raster layer.
Raster values range container.
void insertWidgetFunction(const QString &rendererName, QgsRasterRendererWidgetCreateFunc func)
QStringList renderersList() const
Raster renderer pipe that applies colors to a raster.
QColor nodataColor() const
Returns the color to use for shading nodata pixels.
const QgsRasterTransparency * rasterTransparency() const
virtual QString type() const
double opacity() const
Returns the opacity for the renderer, where opacity is a value between 0 (totally transparent) and 1....
void setAlphaBand(int band)
void setOpacity(double opacity)
Sets the opacity for the renderer, where opacity is a value between 0 (totally transparent) and 1....
void setRasterTransparency(QgsRasterTransparency *t)
virtual QList< int > usesBands() const
Returns a list of band numbers used by the renderer.
void setNodataColor(const QColor &color)
Sets the color to use for shading nodata pixels.
Defines the list of pixel values to be considered as transparent or semi transparent when rendering r...
void setTransparentSingleValuePixelList(const QList< QgsRasterTransparency::TransparentSingleValuePixel > &newList)
Sets the transparent single value pixel list, replacing the whole existing list.
QList< QgsRasterTransparency::TransparentThreeValuePixel > transparentThreeValuePixelList() const
Returns the transparent three value pixel list.
void setTransparentThreeValuePixelList(const QList< QgsRasterTransparency::TransparentThreeValuePixel > &newList)
Sets the transparent three value pixel list, replacing the whole existing list.
QList< QgsRasterTransparency::TransparentSingleValuePixel > transparentSingleValuePixelList() const
Returns the transparent single value pixel list.
A rectangle specified with double values.
double height() const SIP_HOLDGIL
Returns the height of the rectangle.
double width() const SIP_HOLDGIL
Returns the width of the rectangle.
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
QgsSignalBlocker< Object > whileBlocking(Object *object)
Temporarily blocks signals from a QObject while calling a single method from the object.
#define QgsDebugMsgLevel(str, level)
QList< QgsRasterRange > QgsRasterRangeList
const QgsCoordinateReferenceSystem & crs
Setting options for creating vector data providers.
Registry for raster renderer entries.
QgsRasterRendererWidgetCreateFunc widgetCreateFunction
double percentTransparent
double percentTransparent