45#include "moc_qgsrasterlayerproperties.cpp"
78#include <QDesktopServices>
79#include <QTableWidgetItem>
86#include <QLinearGradient>
87#include <QPainterPath>
89#include <QColorDialog>
96#include <QRegularExpressionValidator>
97#include <QRegularExpression>
102 , TRSTRING_NOT_SET( tr(
"Not Set" ) )
103 , mDefaultStandardDeviation( 0 )
104 , mDefaultRedBand( 0 )
105 , mDefaultGreenBand( 0 )
106 , mDefaultBlueBand( 0 )
108 , mGradientHeight( 0.0 )
109 , mGradientWidth( 0.0 )
110 , mMetadataFilled( false )
112 mGrayMinimumMaximumEstimated =
true;
113 mRGBMinimumMaximumEstimated =
true;
118 mOptsPage_Information->layout()->addWidget( mMetadataViewer );
122 transparencyScrollArea->setWidget( mRasterTransparencyWidget );
125 QVBoxLayout *vl =
new QVBoxLayout();
126 vl->setContentsMargins( 0, 0, 0, 0 );
127 vl->addWidget( mLabelingWidget );
128 mOptsPage_Labeling->setLayout( vl );
130 connect( buttonBuildPyramids, &QPushButton::clicked,
this, &QgsRasterLayerProperties::buttonBuildPyramids_clicked );
132 connect( mRenderTypeComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRasterLayerProperties::mRenderTypeComboBox_currentIndexChanged );
133 connect( mResetColorRenderingBtn, &QToolButton::clicked,
this, &QgsRasterLayerProperties::mResetColorRenderingBtn_clicked );
134 connect( buttonRemoveMetadataUrl, &QPushButton::clicked,
this, &QgsRasterLayerProperties::removeSelectedMetadataUrl );
135 connect( buttonAddMetadataUrl, &QPushButton::clicked,
this, &QgsRasterLayerProperties::addMetadataUrl );
140 connect( buttonBox, &QDialogButtonBox::helpRequested,
this, &QgsRasterLayerProperties::showHelp );
142 mSourceGroupBox->hide();
144 mBtnStyle =
new QPushButton( tr(
"Style" ) );
145 buttonBox->addButton(
mBtnStyle, QDialogButtonBox::ResetRole );
159 connect( mSliderBrightness, &QAbstractSlider::valueChanged, mBrightnessSpinBox, &QSpinBox::setValue );
160 connect( mBrightnessSpinBox,
static_cast<void ( QSpinBox::* )(
int )
>( &QSpinBox::valueChanged ), mSliderBrightness, &QAbstractSlider::setValue );
161 mBrightnessSpinBox->setClearValue( 0 );
163 connect( mSliderContrast, &QAbstractSlider::valueChanged, mContrastSpinBox, &QSpinBox::setValue );
164 connect( mContrastSpinBox,
static_cast<void ( QSpinBox::* )(
int )
>( &QSpinBox::valueChanged ), mSliderContrast, &QAbstractSlider::setValue );
165 mContrastSpinBox->setClearValue( 0 );
168 connect( mSliderGamma, &QAbstractSlider::valueChanged,
this, &QgsRasterLayerProperties::updateGammaSpinBox );
169 connect( mGammaSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterLayerProperties::updateGammaSlider );
170 mGammaSpinBox->setClearValue( 1.0 );
173 connect( sliderSaturation, &QAbstractSlider::valueChanged, spinBoxSaturation, &QSpinBox::setValue );
174 connect( spinBoxSaturation,
static_cast<void ( QSpinBox::* )(
int )
>( &QSpinBox::valueChanged ), sliderSaturation, &QAbstractSlider::setValue );
175 spinBoxSaturation->setClearValue( 0 );
178 connect( sliderColorizeStrength, &QAbstractSlider::valueChanged, spinColorizeStrength, &QSpinBox::setValue );
179 connect( spinColorizeStrength,
static_cast<void ( QSpinBox::* )(
int )
>( &QSpinBox::valueChanged ), sliderColorizeStrength, &QAbstractSlider::setValue );
180 spinColorizeStrength->setClearValue( 100 );
183 connect( comboGrayscale,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRasterLayerProperties::toggleSaturationControls );
186 connect( mColorizeCheck, &QAbstractButton::toggled,
this, &QgsRasterLayerProperties::toggleColorizeControls );
189 connect( lbxPyramidResolutions, &QListWidget::itemSelectionChanged,
this, &QgsRasterLayerProperties::toggleBuildPyramidsButton );
191 mRefreshSettingsWidget->setLayer( mRasterLayer );
194 mScaleRangeWidget->setMapCanvas(
mCanvas );
199 tableViewMetadataUrl->setSelectionMode( QAbstractItemView::SingleSelection );
200 tableViewMetadataUrl->setSelectionBehavior( QAbstractItemView::SelectRows );
201 tableViewMetadataUrl->horizontalHeader()->setStretchLastSection(
true );
202 tableViewMetadataUrl->horizontalHeader()->setSectionResizeMode( QHeaderView::Stretch );
204 mMetadataUrlModel =
new QStandardItemModel( tableViewMetadataUrl );
205 mMetadataUrlModel->clear();
206 mMetadataUrlModel->setColumnCount( 3 );
207 QStringList metadataUrlHeaders;
208 metadataUrlHeaders << tr(
"URL" ) << tr(
"Type" ) << tr(
"Format" );
209 mMetadataUrlModel->setHorizontalHeaderLabels( metadataUrlHeaders );
210 tableViewMetadataUrl->setModel( mMetadataUrlModel );
211 tableViewMetadataUrl->setItemDelegate(
new MetadataUrlItemDelegate(
this ) );
224 connect( mEnableMapTips, &QAbstractButton::toggled, mHtmlMapTipGroupBox, &QWidget::setEnabled );
227 updateRasterAttributeTableOptionsPage();
231 connect( mCreateRasterAttributeTableButton, &QPushButton::clicked,
this, [=] {
235 QgsCreateRasterAttributeTableDialog dlg { mRasterLayer };
236 dlg.setOpenWhenDoneVisible(
false );
237 if ( dlg.exec() == QDialog::Accepted )
239 updateRasterAttributeTableOptionsPage();
244 connect( mLoadRasterAttributeTableFromFileButton, &QPushButton::clicked,
this, [=] {
248 if ( dlg.exec() == QDialog::Accepted )
250 updateRasterAttributeTableOptionsPage();
254 mBackupCrs = mRasterLayer->crs();
257 if ( mCanvas && mRasterTransparencyWidget->pixelSelectorTool() )
267 connect( mRasterTransparencyWidget->pbnAddValuesFromDisplay, &QPushButton::clicked,
this, [=] {
272 mCanvas->window()->raise();
273 mCanvas->window()->activateWindow();
274 mCanvas->window()->setFocus();
280 mContext = mCanvas->createExpressionContext();
294 connect( mInsertExpressionButton, &QAbstractButton::clicked,
this, [=] {
296 int selectionStart = mMapTipWidget->selectionStart();
297 int selectionEnd = mMapTipWidget->selectionEnd();
301 exprDlg.setWindowTitle( tr(
"Insert Expression" ) );
302 if ( exprDlg.exec() == QDialog::Accepted && !exprDlg.expressionText().trimmed().isEmpty() )
303 mMapTipWidget->insertText(
"[%" + exprDlg.expressionText().trimmed() +
"%]" );
305 mMapTipWidget->setLinearSelection( selectionStart, selectionEnd );
314 cboResamplingMethod->clear();
317 for (
const QPair<QString, QString> &method : std::as_const( constProviderType ) )
319 cboResamplingMethod->addItem( method.second, method.first );
323 QString prefix = provider->name() +
"/driverOptions/_pyramids/";
325 QString defaultMethod = mySettings.
value( prefix +
"resampling",
"AVERAGE" ).toString();
326 int idx = cboResamplingMethod->findData( defaultMethod );
328 cboResamplingMethod->setCurrentIndex( idx );
332 const QList<QgsRasterPyramid> myPyramidList = provider->buildPyramidList();
336 if ( pyramid.getExists() )
338 lbxPyramidResolutions->addItem(
new QListWidgetItem( myPyramidPixmap, QString::number( pyramid.getXDim() ) + QStringLiteral(
" x " ) + QString::number( pyramid.getYDim() ) ) );
342 lbxPyramidResolutions->addItem(
new QListWidgetItem( myNoPyramidPixmap, QString::number( pyramid.getXDim() ) + QStringLiteral(
" x " ) + QString::number( pyramid.getYDim() ) ) );
349 mOptsPage_Pyramids->setEnabled(
false );
358 mOptsPage_Histogram->setEnabled(
false );
361 QVBoxLayout *layout =
new QVBoxLayout( metadataFrame );
362 layout->setContentsMargins( 0, 0, 0, 0 );
364 mMetadataWidget->layout()->setContentsMargins( 0, 0, 0, 0 );
365 mMetadataWidget->setMapCanvas( mCanvas );
366 layout->addWidget( mMetadataWidget );
367 metadataFrame->setLayout( layout );
369 QVBoxLayout *temporalLayout =
new QVBoxLayout( temporalFrame );
370 temporalLayout->setContentsMargins( 0, 0, 0, 0 );
372 temporalLayout->addWidget( mTemporalWidget );
375 QgsDebugMsgLevel(
"Setting crs to " + mRasterLayer->crs().userFriendlyIdentifier(), 2 );
376 mCrsSelector->setCrs( mRasterLayer->crs() );
379 QString pyramidFormat( QStringLiteral(
"<h2>%1</h2><p>%2 %3 %4</p><b><font color='red'><p>%5</p><p>%6</p>" ) );
380 QString pyramidHeader = tr(
"Description" );
381 QString pyramidSentence1 = tr(
"Large resolution raster layers can slow navigation in QGIS." );
382 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." );
383 QString pyramidSentence3 = tr(
"You must have write access in the directory where the original data is stored to build pyramids." );
384 QString pyramidSentence4 = tr(
"Please note that building internal pyramids may alter the original data file and once created they cannot be removed!" );
385 QString pyramidSentence5 = tr(
"Please note that building internal pyramids could corrupt your image - always make a backup of your data first!" );
387 tePyramidDescription->setHtml( pyramidFormat.arg( pyramidHeader, pyramidSentence1, pyramidSentence2, pyramidSentence3, pyramidSentence4, pyramidSentence5 ) );
390 mResamplingGroupBox->setSaveCheckedState(
true );
391 mResamplingUtils.initWidgets( mRasterLayer, mZoomedInResamplingComboBox, mZoomedOutResamplingComboBox, mMaximumOversamplingSpinBox, mCbEarlyResampling );
392 mResamplingUtils.refreshWidgetsFromLayer();
396 btnColorizeColor->setColorDialogTitle( tr(
"Select Color" ) );
397 btnColorizeColor->setContext( QStringLiteral(
"symbology" ) );
402 if ( hueSaturationFilter )
404 sliderSaturation->setValue( hueSaturationFilter->
saturation() );
405 comboGrayscale->setCurrentIndex( (
int ) hueSaturationFilter->
grayscaleMode() );
408 toggleSaturationControls(
static_cast<int>( hueSaturationFilter->
grayscaleMode() ) );
411 mColorizeCheck->setChecked( hueSaturationFilter->
colorizeOn() );
412 btnColorizeColor->setColor( hueSaturationFilter->
colorizeColor() );
413 toggleColorizeControls( hueSaturationFilter->
colorizeOn() );
414 sliderColorizeStrength->setValue( hueSaturationFilter->
colorizeStrength() );
415 mInvertColorsCheck->setChecked( hueSaturationFilter->
invertColors() );
420 mBlendModeComboBox->setBlendMode( mRasterLayer->blendMode() );
425 mRasterTransparencyWidget->cboxTransparencyBand->setShowNotSetOption(
true, tr(
"None" ) );
426 mRasterTransparencyWidget->cboxTransparencyBand->setLayer( mRasterLayer );
435 cboxTransparencyBand->setCurrentIndex( cboxTransparencyBand->findData( renderer->
alphaBand() ) );
442 mHistogramWidget =
nullptr;
443 if ( mOptsPage_Histogram->isEnabled() )
446 mHistogramStackedWidget->addWidget( mHistogramWidget );
460 mDisableRenderTypeComboBoxCurrentIndexChanged =
true;
462 for (
const QString &name : constRenderersList )
472 mDisableRenderTypeComboBoxCurrentIndexChanged =
false;
477 QString rendererType = renderer->
type();
478 widgetIndex = mRenderTypeComboBox->findData( rendererType );
479 if ( widgetIndex != -1 )
481 mDisableRenderTypeComboBoxCurrentIndexChanged =
true;
482 mRenderTypeComboBox->setCurrentIndex( widgetIndex );
483 mDisableRenderTypeComboBoxCurrentIndexChanged =
false;
486 if ( rendererType == QLatin1String(
"singlebandcolordata" ) && mRenderTypeComboBox->count() == 1 )
489 QSizePolicy sizep = mBandRenderingGrpBx->sizePolicy();
490 sizep.setVerticalStretch( 0 );
491 sizep.setVerticalPolicy( QSizePolicy::Maximum );
492 mBandRenderingGrpBx->setSizePolicy( sizep );
493 mBandRenderingGrpBx->updateGeometry();
496 if ( mRasterLayer->providerType() != QLatin1String(
"wms" ) )
498 mWMSPrintGroupBox->hide();
499 mPublishDataSourceUrlCheckBox->hide();
500 mBackgroundLayerCheckBox->hide();
507 const int horizontalDpi = logicalDpiX();
510 if ( horizontalDpi > 96 )
512 mMetadataViewer->setZoomFactor( mMetadataViewer->zoomFactor() * 0.9 );
514 mMetadataViewer->page()->setLinkDelegationPolicy( QWebPage::LinkDelegationPolicy::DelegateAllLinks );
516 mMetadataViewer->page()->settings()->setAttribute( QWebSettings::DeveloperExtrasEnabled,
true );
517 mMetadataViewer->page()->settings()->setAttribute( QWebSettings::JavascriptEnabled,
true );
523 mRenderTypeComboBox_currentIndexChanged( widgetIndex );
525 setMetadataWidget( mMetadataWidget, mOptsPage_Metadata );
527 QMenu *menuStyle =
new QMenu(
this );
530 menuStyle->addSeparator();
533 mBtnStyle->setMenu( menuStyle );
534 connect( menuStyle, &QMenu::aboutToShow,
this, &QgsRasterLayerProperties::aboutToShowStyleMenu );
536 mBtnMetadata =
new QPushButton( tr(
"Metadata" ),
this );
537 QMenu *menuMetadata =
new QMenu(
this );
540 menuMetadata->addSeparator();
543 mBtnMetadata->setMenu( menuMetadata );
544 buttonBox->addButton( mBtnMetadata, QDialogButtonBox::ResetRole );
552 if ( !settings.
contains( QStringLiteral(
"/Windows/RasterLayerProperties/tab" ) ) )
554 settings.
setValue( QStringLiteral(
"Windows/RasterLayerProperties/tab" ), mOptStackedWidget->indexOf( mOptsPage_Style ) );
559 optionsStackedWidget_CurrentChanged( mOptionsStackedWidget->currentIndex() );
562 mOptsPage_Information->setProperty(
"helpPage", QStringLiteral(
"working_with_raster/raster_properties.html#information-properties" ) );
563 mOptsPage_Source->setProperty(
"helpPage", QStringLiteral(
"working_with_raster/raster_properties.html#source-properties" ) );
564 mOptsPage_Style->setProperty(
"helpPage", QStringLiteral(
"working_with_raster/raster_properties.html#symbology-properties" ) );
565 mOptsPage_Transparency->setProperty(
"helpPage", QStringLiteral(
"working_with_raster/raster_properties.html#transparency-properties" ) );
567 if ( mOptsPage_Histogram )
568 mOptsPage_Histogram->setProperty(
"helpPage", QStringLiteral(
"working_with_raster/raster_properties.html#histogram-properties" ) );
570 mOptsPage_Rendering->setProperty(
"helpPage", QStringLiteral(
"working_with_raster/raster_properties.html#rendering-properties" ) );
571 mOptsPage_Temporal->setProperty(
"helpPage", QStringLiteral(
"working_with_raster/raster_properties.html#temporal-properties" ) );
573 if ( mOptsPage_Pyramids )
574 mOptsPage_Pyramids->setProperty(
"helpPage", QStringLiteral(
"working_with_raster/raster_properties.html#pyramids-properties" ) );
576 if ( mOptsPage_Display )
577 mOptsPage_Display->setProperty(
"helpPage", QStringLiteral(
"working_with_raster/raster_properties.html#display-properties" ) );
579 mOptsPage_Metadata->setProperty(
"helpPage", QStringLiteral(
"working_with_raster/raster_properties.html#metadata-properties" ) );
580 mOptsPage_Legend->setProperty(
"helpPage", QStringLiteral(
"working_with_raster/raster_properties.html#legend-properties" ) );
581 mOptsPage_Server->setProperty(
"helpPage", QStringLiteral(
"working_with_raster/raster_properties.html#server-properties" ) );
601 if ( beforePage.isEmpty() )
619void QgsRasterLayerProperties::updateRasterAttributeTableOptionsPage()
621 if ( mRasterAttributeTableWidget )
623 mOptsPage_RasterAttributeTable->layout()->removeWidget( mRasterAttributeTableWidget );
624 mRasterAttributeTableWidget =
nullptr;
630 mRasterAttributeTableWidget =
new QgsRasterAttributeTableWidget(
this, mRasterLayer );
631 mOptsPage_RasterAttributeTable->layout()->addWidget( mRasterAttributeTableWidget );
633 connect( mRasterAttributeTableWidget, &QgsRasterAttributeTableWidget::rendererChanged,
this, &QgsRasterLayerProperties::syncToLayer );
634 mNoRasterAttributeTableWidget->hide();
638 mNoRasterAttributeTableWidget->show();
643void QgsRasterLayerProperties::setRendererWidget(
const QString &rendererName )
652 const QList<int> oldBands = oldRenderer ? oldRenderer->
usesBands() : QList<int>();
657 opacity = oldRenderer->
opacity();
666 QgsDebugMsgLevel( QStringLiteral(
"renderer has widgetCreateFunction" ), 3 );
669 if ( oldWidget && ( !oldRenderer || rendererName != oldRenderer->
type() ) )
671 if ( rendererName == QLatin1String(
"singlebandgray" ) )
674 whileBlocking( mRasterLayer )->setDefaultContrastEnhancement();
676 else if ( rendererName == QLatin1String(
"multibandcolor" ) )
679 whileBlocking( mRasterLayer )->setDefaultContrastEnhancement();
687 mRendererStackedWidget->addWidget( mRendererWidget );
691 std::unique_ptr<QgsRasterRenderer> newRenderer;
692 newRenderer.reset( mRendererWidget->
renderer() );
693 const QList<int> newBands = newRenderer->usesBands();
694 if ( oldBands != newBands )
702 const int widgetIndex = mRenderTypeComboBox->findData( rendererName );
703 if ( widgetIndex != -1 )
705 mDisableRenderTypeComboBoxCurrentIndexChanged =
true;
706 mRenderTypeComboBox->setCurrentIndex( widgetIndex );
707 mDisableRenderTypeComboBoxCurrentIndexChanged =
false;
710 if ( mRendererWidget != oldWidget )
713 if ( mHistogramWidget )
719void QgsRasterLayerProperties::sync()
723 if ( !mSourceWidget )
728 QHBoxLayout *layout =
new QHBoxLayout();
729 layout->addWidget( mSourceWidget );
730 mSourceGroupBox->setLayout( layout );
732 mSourceGroupBox->setTitle( mSourceWidget->
groupTitle() );
733 mSourceGroupBox->show();
736 buttonBox->button( QDialogButtonBox::Apply )->setEnabled( isValid );
737 buttonBox->button( QDialogButtonBox::Ok )->setEnabled( isValid );
758 mRasterTransparencyWidget->gboxNoDataValue->setEnabled(
false );
759 mRasterTransparencyWidget->gboxCustomTransparency->setEnabled(
false );
760 mOptionsStackedWidget->setCurrentWidget( mOptsPage_Server );
767 if ( mOptsPage_Pyramids )
769 delete mOptsPage_Pyramids;
770 mOptsPage_Pyramids =
nullptr;
776 if ( mOptsPage_Histogram )
778 delete mOptsPage_Histogram;
779 mOptsPage_Histogram =
nullptr;
780 delete mHistogramWidget;
781 mHistogramWidget =
nullptr;
793 if ( brightnessFilter )
795 mSliderBrightness->setValue( brightnessFilter->
brightness() );
796 mSliderContrast->setValue( brightnessFilter->
contrast() );
797 mGammaSpinBox->setValue( brightnessFilter->
gamma() );
803 if ( hueSaturationFilter )
805 sliderSaturation->setValue( hueSaturationFilter->
saturation() );
806 comboGrayscale->setCurrentIndex( (
int ) hueSaturationFilter->
grayscaleMode() );
809 toggleSaturationControls(
static_cast<int>( hueSaturationFilter->
grayscaleMode() ) );
812 mColorizeCheck->setChecked( hueSaturationFilter->
colorizeOn() );
813 btnColorizeColor->setColor( hueSaturationFilter->
colorizeColor() );
814 toggleColorizeControls( hueSaturationFilter->
colorizeOn() );
815 sliderColorizeStrength->setValue( hueSaturationFilter->
colorizeStrength() );
816 mInvertColorsCheck->setChecked( hueSaturationFilter->
invertColors() );
819 mRefreshSettingsWidget->syncToLayer();
826 mLayerOrigNameLineEd->setText( mRasterLayer->
name() );
833 updateInformationContent();
839 mLayerShortNameLineEdit->setValidator( shortNameValidator );
846 mLayerDataUrlFormatComboBox->setCurrentIndex(
847 mLayerDataUrlFormatComboBox->findText(
860 const int row = mMetadataUrlModel->rowCount();
861 mMetadataUrlModel->setItem( row, 0,
new QStandardItem( metaUrl.url ) );
862 mMetadataUrlModel->setItem( row, 1,
new QStandardItem( metaUrl.type ) );
863 mMetadataUrlModel->setItem( row, 2,
new QStandardItem( metaUrl.format ) );
867 mLayerLegendUrlLineEdit->setText( mRasterLayer->
legendUrl() );
868 mLayerLegendUrlFormatComboBox->setCurrentIndex( mLayerLegendUrlFormatComboBox->findText( mRasterLayer->
legendUrlFormat() ) );
874 QVariant wmsPrintLayer = mRasterLayer->
customProperty( QStringLiteral(
"WMSPrintLayer" ) );
875 if ( wmsPrintLayer.isValid() )
877 mWMSPrintLayerLineEdit->setText( wmsPrintLayer.toString() );
880 QVariant wmsPublishDataSourceUrl = mRasterLayer->
customProperty( QStringLiteral(
"WMSPublishDataSourceUrl" ),
false );
881 mPublishDataSourceUrlCheckBox->setChecked( wmsPublishDataSourceUrl.toBool() );
883 QVariant wmsBackgroundLayer = mRasterLayer->
customProperty( QStringLiteral(
"WMSBackgroundLayer" ),
false );
884 mBackgroundLayerCheckBox->setChecked( wmsBackgroundLayer.toBool() );
886 mLegendPlaceholderWidget->setLastPathSettingsKey( QStringLiteral(
"lastLegendPlaceholderDir" ) );
888 mLegendConfigEmbeddedWidget->setLayer( mRasterLayer );
893 updateDataDefinedButtons();
897 page->syncToLayer( mRasterLayer );
905 const QString newSource = mSourceWidget->
sourceUri();
906 if ( newSource != mRasterLayer->
source() )
913 if ( !mRasterLayer->
isValid() )
927 mLegendConfigEmbeddedWidget->applyToLayer();
950 if ( rendererWidget )
957 mBackupCrs = mRasterLayer->
crs();
959 mMetadataFilled =
false;
965 mLabelingWidget->
apply();
967 if ( rasterRenderer )
977 mRasterLayer->
setName( mLayerOrigNameLineEd->text() );
984 mRefreshSettingsWidget->saveToLayer();
991 mResamplingUtils.refreshLayerFromWidgets();
995 if ( hueSaturationFilter )
997 hueSaturationFilter->
setSaturation( sliderSaturation->value() );
999 hueSaturationFilter->
setColorizeOn( mColorizeCheck->checkState() );
1002 hueSaturationFilter->
setInvertColors( mInvertColorsCheck->isChecked() );
1006 mRasterLayer->
setBlendMode( mBlendModeComboBox->blendMode() );
1011 mRasterLayer->
setCrs( mCrsSelector->crs() );
1014 mMetadataFilled =
false;
1018 mMetadataFilled =
false;
1022 mMetadataFilled =
false;
1026 mMetadataFilled =
false;
1030 mMetadataFilled =
false;
1034 mMetadataFilled =
false;
1039 mMetadataFilled =
false;
1043 mMetadataFilled =
false;
1047 QList<QgsMapLayerServerProperties::MetadataUrl> metaUrls;
1048 for (
int row = 0; row < mMetadataUrlModel->rowCount(); row++ )
1051 metaUrl.
url = mMetadataUrlModel->item( row, 0 )->text();
1052 metaUrl.
type = mMetadataUrlModel->item( row, 1 )->text();
1053 metaUrl.
format = mMetadataUrlModel->item( row, 2 )->text();
1054 metaUrls.append( metaUrl );
1055 mMetadataFilled =
false;
1059 if ( mRasterLayer->
legendUrl() != mLayerLegendUrlLineEdit->text() )
1060 mMetadataFilled =
false;
1061 mRasterLayer->
setLegendUrl( mLayerLegendUrlLineEdit->text() );
1063 if ( mRasterLayer->
legendUrlFormat() != mLayerLegendUrlFormatComboBox->currentText() )
1064 mMetadataFilled =
false;
1067 if ( !mWMSPrintLayerLineEdit->text().isEmpty() )
1069 mRasterLayer->
setCustomProperty( QStringLiteral(
"WMSPrintLayer" ), mWMSPrintLayerLineEdit->text() );
1072 mRasterLayer->
setCustomProperty(
"WMSPublishDataSourceUrl", mPublishDataSourceUrlCheckBox->isChecked() );
1073 mRasterLayer->
setCustomProperty(
"WMSBackgroundLayer", mBackgroundLayerCheckBox->isChecked() );
1090void QgsRasterLayerProperties::buttonBuildPyramids_clicked()
1102 for (
int myCounterInt = 0; myCounterInt < lbxPyramidResolutions->count(); myCounterInt++ )
1104 QListWidgetItem *myItem = lbxPyramidResolutions->item( myCounterInt );
1106 myPyramidList[myCounterInt].setBuild( myItem->isSelected() || myPyramidList[myCounterInt].getExists() );
1110 QString prefix = provider->
name() +
"/driverOptions/_pyramids/";
1112 QString resamplingMethod( cboResamplingMethod->currentData().toString() );
1113 mySettings.
setValue( prefix +
"resampling", resamplingMethod );
1120 QApplication::setOverrideCursor( Qt::WaitCursor );
1128 QApplication::restoreOverrideCursor();
1129 mPyramidProgress->setValue( 0 );
1130 buttonBuildPyramids->setEnabled(
false );
1131 if ( !res.isNull() )
1133 if ( res == QLatin1String(
"CANCELED" ) )
1137 else if ( res == QLatin1String(
"ERROR_WRITE_ACCESS" ) )
1139 QMessageBox::warning(
this, tr(
"Building Pyramids" ), tr(
"Write access denied. Adjust the file permissions and try again." ) );
1141 else if ( res == QLatin1String(
"ERROR_WRITE_FORMAT" ) )
1143 QMessageBox::warning(
this, tr(
"Building Pyramids" ), tr(
"The file was not writable. Some formats do not "
1144 "support pyramid overviews. Consult the GDAL documentation if in doubt." ) );
1146 else if ( res == QLatin1String(
"FAILED_NOT_SUPPORTED" ) )
1148 QMessageBox::warning(
this, tr(
"Building Pyramids" ), tr(
"Building pyramid overviews is not supported on this type of raster." ) );
1150 else if ( res == QLatin1String(
"ERROR_JPEG_COMPRESSION" ) )
1152 QMessageBox::warning(
this, tr(
"Building Pyramids" ), tr(
"Building internal pyramid overviews is not supported on raster layers with JPEG compression and your current libtiff library." ) );
1154 else if ( res == QLatin1String(
"ERROR_VIRTUAL" ) )
1156 QMessageBox::warning(
this, tr(
"Building Pyramids" ), tr(
"Building pyramid overviews is not supported on this type of raster." ) );
1163 lbxPyramidResolutions->clear();
1171 if ( pyramid.getExists() )
1173 lbxPyramidResolutions->addItem(
new QListWidgetItem( myPyramidPixmap, QString::number( pyramid.getXDim() ) + QStringLiteral(
" x " ) + QString::number( pyramid.getYDim() ) ) );
1177 lbxPyramidResolutions->addItem(
new QListWidgetItem( myNoPyramidPixmap, QString::number( pyramid.getXDim() ) + QStringLiteral(
" x " ) + QString::number( pyramid.getYDim() ) ) );
1186 updateInformationContent();
1189void QgsRasterLayerProperties::mRenderTypeComboBox_currentIndexChanged(
int index )
1191 if ( index < 0 || mDisableRenderTypeComboBoxCurrentIndexChanged || !mRasterLayer->renderer() )
1196 QString rendererName = mRenderTypeComboBox->itemData( index ).toString();
1197 setRendererWidget( rendererName );
1207void QgsRasterLayerProperties::aboutToShowStyleMenu()
1211 QMenu *m = qobject_cast<QMenu *>( sender() );
1219void QgsRasterLayerProperties::syncToLayer()
1224 setRendererWidget( renderer->
type() );
1234 if ( !mHistogramWidget )
1246 if ( index ==
mOptStackedWidget->indexOf( mOptsPage_Information ) || !mMetadataFilled )
1249 updateInformationContent();
1255 button->blockSignals(
true );
1259 button->blockSignals(
false );
1262void QgsRasterLayerProperties::updateDataDefinedButtons()
1264 const auto propertyOverrideButtons { findChildren<QgsPropertyOverrideButton *>() };
1267 updateDataDefinedButton( button );
1283void QgsRasterLayerProperties::updateProperty()
1290void QgsRasterLayerProperties::toggleSaturationControls(
int grayscaleMode )
1293 if ( grayscaleMode == 0 )
1295 sliderSaturation->setEnabled(
true );
1296 spinBoxSaturation->setEnabled(
true );
1300 sliderSaturation->setEnabled(
false );
1301 spinBoxSaturation->setEnabled(
false );
1305void QgsRasterLayerProperties::toggleColorizeControls(
bool colorizeEnabled )
1308 btnColorizeColor->setEnabled( colorizeEnabled );
1309 sliderColorizeStrength->setEnabled( colorizeEnabled );
1310 spinColorizeStrength->setEnabled( colorizeEnabled );
1314QLinearGradient QgsRasterLayerProperties::redGradient()
1318 QLinearGradient myGradient = QLinearGradient( mGradientWidth, 0, mGradientWidth, mGradientHeight );
1319 myGradient.setColorAt( 0.0, QColor( 242, 14, 25, 190 ) );
1320 myGradient.setColorAt( 0.5, QColor( 175, 29, 37, 190 ) );
1321 myGradient.setColorAt( 1.0, QColor( 114, 17, 22, 190 ) );
1324QLinearGradient QgsRasterLayerProperties::greenGradient()
1328 QLinearGradient myGradient = QLinearGradient( mGradientWidth, 0, mGradientWidth, mGradientHeight );
1329 myGradient.setColorAt( 0.0, QColor( 48, 168, 5, 190 ) );
1330 myGradient.setColorAt( 0.8, QColor( 36, 122, 4, 190 ) );
1331 myGradient.setColorAt( 1.0, QColor( 21, 71, 2, 190 ) );
1334QLinearGradient QgsRasterLayerProperties::blueGradient()
1338 QLinearGradient myGradient = QLinearGradient( mGradientWidth, 0, mGradientWidth, mGradientHeight );
1339 myGradient.setColorAt( 0.0, QColor( 30, 0, 106, 190 ) );
1340 myGradient.setColorAt( 0.2, QColor( 30, 72, 128, 190 ) );
1341 myGradient.setColorAt( 1.0, QColor( 30, 223, 196, 190 ) );
1344QLinearGradient QgsRasterLayerProperties::grayGradient()
1348 QLinearGradient myGradient = QLinearGradient( mGradientWidth, 0, mGradientWidth, mGradientHeight );
1349 myGradient.setColorAt( 0.0, QColor( 5, 5, 5, 190 ) );
1350 myGradient.setColorAt( 0.8, QColor( 122, 122, 122, 190 ) );
1351 myGradient.setColorAt( 1.0, QColor( 220, 220, 220, 190 ) );
1354QLinearGradient QgsRasterLayerProperties::highlightGradient()
1358 QLinearGradient myGradient = QLinearGradient( mGradientWidth, 0, mGradientWidth, mGradientHeight );
1359 myGradient.setColorAt( 1.0, QColor( 255, 255, 255, 50 ) );
1360 myGradient.setColorAt( 0.5, QColor( 255, 255, 255, 100 ) );
1361 myGradient.setColorAt( 0.0, QColor( 255, 255, 255, 150 ) );
1365void QgsRasterLayerProperties::addMetadataUrl()
1367 const int row = mMetadataUrlModel->rowCount();
1368 mMetadataUrlModel->setItem( row, 0,
new QStandardItem( QLatin1String() ) );
1369 mMetadataUrlModel->setItem( row, 1,
new QStandardItem( QLatin1String() ) );
1370 mMetadataUrlModel->setItem( row, 2,
new QStandardItem( QLatin1String() ) );
1373void QgsRasterLayerProperties::removeSelectedMetadataUrl()
1375 const QModelIndexList selectedRows = tableViewMetadataUrl->selectionModel()->selectedRows();
1376 if ( selectedRows.empty() )
1378 mMetadataUrlModel->removeRow( selectedRows[0].row() );
1393void QgsRasterLayerProperties::restoreWindowModality()
1402void QgsRasterLayerProperties::toggleBuildPyramidsButton()
1404 if ( lbxPyramidResolutions->selectedItems().empty() )
1406 buttonBuildPyramids->setEnabled(
false );
1410 buttonBuildPyramids->setEnabled(
true );
1414void QgsRasterLayerProperties::mResetColorRenderingBtn_clicked()
1416 mBlendModeComboBox->setBlendMode( QPainter::CompositionMode_SourceOver );
1417 mSliderBrightness->setValue( 0 );
1418 mSliderContrast->setValue( 0 );
1419 mGammaSpinBox->setValue( 1.0 );
1420 sliderSaturation->setValue( 0 );
1422 mColorizeCheck->setChecked(
false );
1423 sliderColorizeStrength->setValue( 100 );
1424 mInvertColorsCheck->setChecked(
false );
1427bool QgsRasterLayerProperties::rasterIsMultiBandColor()
1432void QgsRasterLayerProperties::updateInformationContent()
1436 const QString html { mRasterLayer->
htmlMetadata().replace( QLatin1String(
"<head>" ), QStringLiteral( R
"raw(<head><style type="text/css">%1</style>)raw" ) ).arg( myStyle ) };
1437 mMetadataViewer->setHtml( html );
1438 mMetadataFilled = true;
1444 if ( mRasterAttributeTableWidget && mRasterAttributeTableWidget->isDirty() )
1446 mRasterAttributeTableWidget->setEditable(
false,
false );
1450 if ( mBackupCrs != mRasterLayer->
crs() )
1451 mRasterLayer->
setCrs( mBackupCrs );
1454void QgsRasterLayerProperties::showHelp()
1456 const QVariant helpPage = mOptionsStackedWidget->currentWidget()->property(
"helpPage" );
1458 if ( helpPage.isValid() )
1464 QgsHelp::openHelp( QStringLiteral(
"working_with_raster/raster_properties.html" ) );
1468void QgsRasterLayerProperties::updateGammaSpinBox(
int value )
1473void QgsRasterLayerProperties::updateGammaSlider(
double value )
1482 if ( obj == mMapTipPreviewContainer && ev->type() == QEvent::Resize )
1486 return QgsOptionsDialogBase::eventFilter( obj, ev );
1489void QgsRasterLayerProperties::initMapTipPreview()
1492 mMapTipSplitter->setSizes( { 400, 200 } );
1494 mMapTipPreviewContainer->installEventFilter(
this );
1498 mMapTipPreview =
new QgsWebView( mMapTipPreviewContainer );
1501 mMapTipPreview->page()->setLinkDelegationPolicy( QWebPage::DelegateAllLinks );
1502 mMapTipPreview->setContextMenuPolicy( Qt::NoContextMenu );
1503 connect( mMapTipPreview, &QWebView::loadFinished,
this, &QgsRasterLayerProperties::resizeMapTip );
1506 mMapTipPreview->page()->settings()->setAttribute( QWebSettings::DeveloperExtrasEnabled,
true );
1507 mMapTipPreview->page()->settings()->setAttribute( QWebSettings::JavascriptEnabled,
true );
1508 mMapTipPreview->page()->settings()->setAttribute( QWebSettings::LocalStorageEnabled,
true );
1511 mMapTipPreview->page()->mainFrame()->setScrollBarPolicy( Qt::Horizontal, Qt::ScrollBarAlwaysOff );
1512 mMapTipPreview->page()->mainFrame()->setScrollBarPolicy( Qt::Vertical, Qt::ScrollBarAlwaysOff );
1516 connect( mMapTipWidget, &QgsCodeEditorHTML::textChanged,
this, &QgsRasterLayerProperties::updateMapTipPreview );
1519void QgsRasterLayerProperties::updateMapTipPreview()
1521 mMapTipPreview->setMaximumSize( mMapTipPreviewContainer->width(), mMapTipPreviewContainer->height() );
1523 mMapTipPreview->setHtml( htmlContent );
1526void QgsRasterLayerProperties::resizeMapTip()
1529 mMapTipPreview->setMaximumSize( mMapTipPreviewContainer->width(), mMapTipPreviewContainer->height() );
1532 const QWebElement container = mMapTipPreview->page()->mainFrame()->findFirstElement(
1533 QStringLiteral(
"#QgsWebViewContainer" )
1535 const int width = container.geometry().width();
1536 const int height = container.geometry().height();
1537 mMapTipPreview->resize( width, height );
1540 mMapTipPreview->move( ( mMapTipPreviewContainer->width() - mMapTipPreview->width() ) / 2, ( mMapTipPreviewContainer->height() - mMapTipPreview->height() ) / 2 );
1543 mMapTipPreview->adjustSize();
@ BuildPyramids
Supports building of pyramids (overviews) (since QGIS 3.38 – this is a replacement for RasterInterfac...
@ SingleBandColorData
Single band containing color data.
RasterPyramidFormat
Raster pyramid formats.
@ GeoTiff
Geotiff .ovr (external)
@ Erdas
Erdas Image .aux (external)
@ SingleBandGray
A single band image drawn as a range of gray colors.
@ MultiBandColor
A layer containing 2 or more bands, mapped to RGB color space. In the case of a multiband with only t...
@ BuildPyramids
Supports building of pyramids (overviews) (Deprecated since QGIS 3.38 – use RasterProviderCapability:...
@ Size
Original data source size (and thus resolution) is known, it is not always available,...
@ 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.
@ Preferred
Preferred format, matching the most recent WKT ISO standard. Currently an alias to WKT2_2019,...
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.
@ WebBrowser
StyleSheet for embedded browsers (QtWebKit), supports full standard CSS.
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
static QRegularExpression shortNameRegularExpression()
Returns the short name regular expression for line edit validator.
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).
virtual QString name() const =0
Returns a provider name.
A generic dialog for building expression strings.
static QgsExpressionContextScope * projectScope(const QgsProject *project)
Creates a new scope which contains variables and functions relating to a QGIS project.
static QgsExpressionContextScope * atlasScope(const QgsLayoutAtlas *atlas)
Creates a new scope which contains variables and functions relating to a QgsLayoutAtlas.
static QgsExpressionContextScope * mapLayerPositionScope(const QgsPointXY &position)
Sets the expression context variables which are available for expressions triggered by moving the mou...
static QgsExpressionContextScope * mapSettingsScope(const QgsMapSettings &mapSettings)
Creates a new scope which contains variables and functions relating to a QgsMapSettings object.
static QgsExpressionContextScope * layerScope(const QgsMapLayer *layer)
Creates a new scope which contains variables and functions relating to a QgsMapLayer.
static QgsExpressionContextScope * globalScope()
Creates a new scope which contains variables and functions relating to the global QGIS context.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
static QString findAndSelectActiveExpression(QgsCodeEditor *editor, const QString &pattern=QString())
Find the expression under the cursor in the given editor and select it.
void progressChanged(double progress)
Emitted when the feedback object reports a progress change.
static QgsProviderSourceWidgetProviderRegistry * sourceWidgetProviderRegistry()
Returns the registry of provider source widget providers.
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
bool invertColors() const
Returns true if the filter inverts colors.
void setGrayscaleMode(QgsHueSaturationFilter::GrayscaleMode grayscaleMode)
void setInvertColors(bool invertColors)
Sets whether the filter will invert colors.
QgsHueSaturationFilter::GrayscaleMode grayscaleMode() const
void setColorizeColor(const QColor &colorizeColor)
void setColorizeStrength(int colorizeStrength)
QColor colorizeColor() const
Base class for "layer properties" dialogs, containing common utilities for handling functionality in ...
QPushButton * mBtnStyle
Style button.
void saveMetadataToFile()
Allows the user to save the layer's metadata as a file.
virtual void rollback()
Rolls back changes made to the layer.
void optionsStackedWidget_CurrentChanged(int index) override
void saveStyleAsDefault()
Saves the current layer style as the default for the layer.
QList< QgsMapLayerConfigWidget * > mConfigWidgets
Layer config widgets.
void loadDefaultStyle()
Reloads the default style for the layer.
void saveStyleAs()
Saves a style when appriate button is pressed.
void loadStyle()
Triggers a dialog to load a saved style.
QgsMapCanvas * mCanvas
Associated map canvas.
void loadDefaultMetadata()
Reloads the default layer metadata for the layer.
void loadMetadataFromFile()
Allows the user to load layer metadata from a file.
void saveMetadataAsDefault()
Saves the current layer metadata as the default for the layer.
void openUrl(const QUrl &url)
Handles opening a url from the dialog.
The QgsLoadRasterAttributeTableDialog dialog let the user select a VAT.DBF file and associate the res...
void setOpenWhenDoneVisible(bool visible)
Sets the visibility of the "Open newly created raster attribute table" option to visible,...
Map canvas is a class for displaying all GIS data types on a 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 setDataUrl(const QString &dataUrl)
Sets the DataUrl of the layer used by QGIS Server in GetCapabilities request.
void setAbstract(const QString &abstract)
Sets the abstract of the layer used by QGIS Server in GetCapabilities request.
void setDataUrlFormat(const QString &dataUrlFormat)
Sets the DataUrl format of the layerused by QGIS Server in GetCapabilities request.
QString attribution() const
Returns the attribution of the layer used by QGIS Server in GetCapabilities request.
void setAttributionUrl(const QString &url)
Sets the attribution url 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.
void setAttribution(const QString &attrib)
Sets the attribution of the layer used by QGIS Server in GetCapabilities request.
void setShortName(const QString &name)
Sets the short name of the layer used by QGIS Server to identify the layer.
QString title() const
Returns the title of the layer used by QGIS Server in GetCapabilities request.
QString dataUrl() const
Returns the DataUrl of the layer used by QGIS Server in GetCapabilities request.
QString keywordList() const
Returns the keyword list of the layerused by QGIS Server in GetCapabilities request.
QString shortName() const
Returns the short name of the layer used by QGIS Server to identify the layer.
void setTitle(const QString &title)
Sets the title of the layer used by QGIS Server in GetCapabilities request.
void setKeywordList(const QString &keywords)
Sets the keywords list of the layerused by QGIS Server in GetCapabilities request.
QString attributionUrl() const
Returns the attribution URL of the layer used by QGIS Server in GetCapabilities request.
QString abstract() const
Returns the abstract of the layerused by QGIS Server in GetCapabilities request.
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
void currentStyleChanged(const QString ¤tName)
Emitted when the current style has been changed.
Base class for all map layer types.
QString legendUrlFormat() const
Returns the format for a URL based layer legend.
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 legendPlaceholderImage() const
Returns path to the placeholder image or an empty string if a generated legend is shown.
QgsMapLayerServerProperties * serverProperties()
Returns QGIS Server Properties for the map layer.
void setDataSource(const QString &dataSource, const QString &baseName=QString(), const QString &provider=QString(), bool loadDefaultStyleFlag=false)
Updates the data source of 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 setMaximumScale(double scale)
Sets the maximum map scale (i.e.
Q_INVOKABLE void setCustomProperty(const QString &key, const QVariant &value)
Set a custom property for layer.
void rendererChanged()
Signal emitted when renderer is changed.
void setScaleBasedVisibility(bool enabled)
Sets whether scale based visibility is enabled for the layer.
bool hasScaleBasedVisibility() const
Returns whether scale based visibility is enabled for the layer.
void emitStyleChanged()
Triggers an emission of the styleChanged() signal.
void setName(const QString &name)
Set the display name of the layer.
void setLegendPlaceholderImage(const QString &imgPath)
Set placeholder image for legend.
void setMapTipsEnabled(bool enabled)
Enable or disable map tips for this 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.
void setMapTipTemplate(const QString &mapTipTemplate)
The mapTip is a pretty, html representation for feature information.
void setLegend(QgsMapLayerLegend *legend)
Assign a legend controller to the map layer.
double maximumScale() const
Returns the maximum map scale (i.e.
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
static QString rasterMapTipPreviewText(QgsMapLayer *layer, QgsMapCanvas *mapCanvas, const QString &mapTemplate)
Returns the html that would be displayed in a maptip for a given layer.
Renderer for multiband images with the color components.
void addPage(const QString &title, const QString &tooltip, const QIcon &icon, QWidget *widget, const QStringList &path=QStringList(), const QString &key=QString())
Adds a new page to the dialog pages.
QStackedWidget * mOptStackedWidget
void initOptionsBase(bool restoreUi=true, const QString &title=QString())
Set up the base ui connections for vertical tabs.
void insertPage(const QString &title, const QString &tooltip, const QIcon &icon, QWidget *widget, const QString &before, const QStringList &path=QStringList(), const QString &key=QString())
Inserts a new page into the dialog pages.
static bool layerIsContainedInGroupLayer(QgsProject *project, QgsMapLayer *layer)
Returns true if the specified layer is a child layer from any QgsGroupLayer in the given project.
static QgsProject * instance()
Returns the QgsProject singleton instance.
void setDirty(bool b=true)
Flag the project as dirty (modified).
void setProperty(int key, const QgsProperty &property)
Adds a property to the collection and takes ownership of it.
QgsProperty property(int key) const final
Returns a matching property from the collection, if one exists.
Feedback object tailored for raster block reading.
Base class for raster data providers.
virtual QString buildPyramids(const QList< QgsRasterPyramid > &pyramidList, const QString &resamplingMethod="NEAREST", Qgis::RasterPyramidFormat format=Qgis::RasterPyramidFormat::GeoTiff, const QStringList &configOptions=QStringList(), QgsRasterBlockFeedback *feedback=nullptr)
Creates pyramid overviews.
Qgis::DataType dataType(int bandNo) const override=0
Returns data type for the band specified by number.
virtual Qgis::RasterProviderCapabilities providerCapabilities() const
Returns flags containing the supported capabilities of the data provider.
static QList< QPair< QString, QString > > pyramidResamplingMethods(const QString &providerKey)
Returns a list of pyramid resampling method name and label pairs for given provider.
virtual QList< QgsRasterPyramid > buildPyramidList(const QList< int > &overviewList=QList< int >())
Returns the raster layers pyramid list.
virtual Qgis::RasterInterfaceCapabilities capabilities() const
Returns the capabilities supported by the interface.
Q_DECL_DEPRECATED void saveDefaultStyle()
Saves the default style when appropriate button is pressed.
QgsRasterLayerProperties(QgsMapLayer *lyr, QgsMapCanvas *canvas, QWidget *parent=nullptr, Qt::WindowFlags=QgsGuiUtils::ModalDialogFlags)
Constructor.
bool eventFilter(QObject *obj, QEvent *ev) override
QgsExpressionContext createExpressionContext() const override
This method needs to be reimplemented in all classes which implement this interface and return an exp...
void optionsStackedWidget_CurrentChanged(int index) FINAL
void addPropertiesPageFactory(const QgsMapLayerConfigWidgetFactory *factory) FINAL
Adds properties page from a factory.
Represents a raster layer.
QString htmlMetadata() const override
Obtain a formatted HTML string containing assorted metadata for this layer.
bool canCreateRasterAttributeTable()
Returns true if the raster renderer is suitable for creation of a raster attribute table.
int attributeTableCount() const
Returns the number of attribute tables for the raster by counting the number of bands that have an as...
QgsRasterPipe * pipe()
Returns the raster pipe.
QgsBrightnessContrastFilter * brightnessFilter() const
Returns the raster's brightness/contrast filter.
QgsRasterRenderer * renderer() const
Returns the raster's renderer.
QgsRasterDataProvider * dataProvider() override
Returns the source data provider.
QString providerType() const
[ data provider interface ] Which provider is being used for this Raster Layer?
void setRenderer(QgsRasterRenderer *renderer)
Sets the raster's renderer.
QgsHueSaturationFilter * hueSaturationFilter() const
Returns the raster's hue/saturation filter.
QgsPropertyCollection & dataDefinedProperties()
Returns a reference to the pipe's property collection, used for data defined overrides.
Property
Data definable properties.
@ RendererOpacity
Raster renderer global opacity.
static QgsPropertiesDefinition propertyDefinitions()
Returns the definitions for data defined properties available for use in raster pipes.
void setDataDefinedProperties(const QgsPropertyCollection &collection)
Sets the pipe's property collection, used for data defined overrides.
This struct is used to store pyramid info for the raster layer.
void insertWidgetFunction(const QString &rendererName, QgsRasterRendererWidgetCreateFunc func)
Sets the widget creation function for a renderer.
QStringList renderersList() const
Returns a list of the names of registered renderers.
Raster renderer pipe that applies colors to a raster.
QColor nodataColor() const
Returns the color to use for shading nodata pixels.
virtual QString type() const
Returns a unique string representation of the renderer type.
double opacity() const
Returns the opacity for the renderer, where opacity is a value between 0 (totally transparent) and 1....
virtual QList< int > usesBands() const
Returns a list of band numbers used by the renderer.
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 setNodataColor(const QColor &color)
Sets the color to use for shading nodata pixels.
A rectangle specified with double values.
This class is a composition of two QSettings instances:
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.
bool contains(const QString &key, QgsSettings::Section section=QgsSettings::NoSection) const
Returns true if there exists a setting called key; returns false otherwise.
void setValue(const QString &key, const QVariant &value, QgsSettings::Section section=QgsSettings::NoSection)
Sets the value of setting key to value.
The QgsWebView class is a collection of stubs to mimic the API of QWebView on systems where the real ...
QgsSignalBlocker< Object > whileBlocking(Object *object)
Temporarily blocks signals from a QObject while calling a single method from the object.
#define QgsDebugMsgLevel(str, level)
const QgsCoordinateReferenceSystem & crs
Setting options for creating vector data providers.
Registry for raster renderer entries.
QgsRasterRendererWidgetCreateFunc widgetCreateFunction