76#include <QDesktopServices>
77#include <QTableWidgetItem>
84#include <QLinearGradient>
85#include <QPainterPath>
87#include <QColorDialog>
94#include <QRegularExpressionValidator>
95#include <QRegularExpression>
100 , TRSTRING_NOT_SET( tr(
"Not Set" ) )
101 , mDefaultStandardDeviation( 0 )
102 , mDefaultRedBand( 0 )
103 , mDefaultGreenBand( 0 )
104 , mDefaultBlueBand( 0 )
106 , mGradientHeight( 0.0 )
107 , mGradientWidth( 0.0 )
108 , mMetadataFilled( false )
110 mGrayMinimumMaximumEstimated =
true;
111 mRGBMinimumMaximumEstimated =
true;
116 mOptsPage_Information->layout()->addWidget( mMetadataViewer );
120 transparencyScrollArea->setWidget( mRasterTransparencyWidget );
122 connect( buttonBuildPyramids, &QPushButton::clicked,
this, &QgsRasterLayerProperties::buttonBuildPyramids_clicked );
124 connect( mRenderTypeComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRasterLayerProperties::mRenderTypeComboBox_currentIndexChanged );
125 connect( mResetColorRenderingBtn, &QToolButton::clicked,
this, &QgsRasterLayerProperties::mResetColorRenderingBtn_clicked );
126 connect( buttonRemoveMetadataUrl, &QPushButton::clicked,
this, &QgsRasterLayerProperties::removeSelectedMetadataUrl );
127 connect( buttonAddMetadataUrl, &QPushButton::clicked,
this, &QgsRasterLayerProperties::addMetadataUrl );
132 connect( buttonBox, &QDialogButtonBox::helpRequested,
this, &QgsRasterLayerProperties::showHelp );
134 mSourceGroupBox->hide();
136 mBtnStyle =
new QPushButton( tr(
"Style" ) );
137 buttonBox->addButton(
mBtnStyle, QDialogButtonBox::ResetRole );
151 connect( mSliderBrightness, &QAbstractSlider::valueChanged, mBrightnessSpinBox, &QSpinBox::setValue );
152 connect( mBrightnessSpinBox,
static_cast < void ( QSpinBox::* )(
int )
> ( &QSpinBox::valueChanged ), mSliderBrightness, &QAbstractSlider::setValue );
153 mBrightnessSpinBox->setClearValue( 0 );
155 connect( mSliderContrast, &QAbstractSlider::valueChanged, mContrastSpinBox, &QSpinBox::setValue );
156 connect( mContrastSpinBox,
static_cast < void ( QSpinBox::* )(
int )
> ( &QSpinBox::valueChanged ), mSliderContrast, &QAbstractSlider::setValue );
157 mContrastSpinBox->setClearValue( 0 );
160 connect( mSliderGamma, &QAbstractSlider::valueChanged,
this, &QgsRasterLayerProperties::updateGammaSpinBox );
161 connect( mGammaSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterLayerProperties::updateGammaSlider );
162 mGammaSpinBox->setClearValue( 1.0 );
165 connect( sliderSaturation, &QAbstractSlider::valueChanged, spinBoxSaturation, &QSpinBox::setValue );
166 connect( spinBoxSaturation,
static_cast < void ( QSpinBox::* )(
int )
> ( &QSpinBox::valueChanged ), sliderSaturation, &QAbstractSlider::setValue );
167 spinBoxSaturation->setClearValue( 0 );
170 connect( sliderColorizeStrength, &QAbstractSlider::valueChanged, spinColorizeStrength, &QSpinBox::setValue );
171 connect( spinColorizeStrength,
static_cast < void ( QSpinBox::* )(
int )
> ( &QSpinBox::valueChanged ), sliderColorizeStrength, &QAbstractSlider::setValue );
172 spinColorizeStrength->setClearValue( 100 );
175 connect( comboGrayscale,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRasterLayerProperties::toggleSaturationControls );
178 connect( mColorizeCheck, &QAbstractButton::toggled,
this, &QgsRasterLayerProperties::toggleColorizeControls );
181 connect( lbxPyramidResolutions, &QListWidget::itemSelectionChanged,
this, &QgsRasterLayerProperties::toggleBuildPyramidsButton );
183 mRefreshSettingsWidget->setLayer( mRasterLayer );
186 mScaleRangeWidget->setMapCanvas(
mCanvas );
191 tableViewMetadataUrl->setSelectionMode( QAbstractItemView::SingleSelection );
192 tableViewMetadataUrl->setSelectionBehavior( QAbstractItemView::SelectRows );
193 tableViewMetadataUrl->horizontalHeader()->setStretchLastSection(
true );
194 tableViewMetadataUrl->horizontalHeader()->setSectionResizeMode( QHeaderView::Stretch );
196 mMetadataUrlModel =
new QStandardItemModel( tableViewMetadataUrl );
197 mMetadataUrlModel->clear();
198 mMetadataUrlModel->setColumnCount( 3 );
199 QStringList metadataUrlHeaders;
200 metadataUrlHeaders << tr(
"URL" ) << tr(
"Type" ) << tr(
"Format" );
201 mMetadataUrlModel->setHorizontalHeaderLabels( metadataUrlHeaders );
202 tableViewMetadataUrl->setModel( mMetadataUrlModel );
203 tableViewMetadataUrl->setItemDelegate(
new MetadataUrlItemDelegate(
this ) );
216 connect( mEnableMapTips, &QAbstractButton::toggled, mHtmlMapTipGroupBox, &QWidget::setEnabled );
219 updateRasterAttributeTableOptionsPage();
223 connect( mCreateRasterAttributeTableButton, &QPushButton::clicked,
this, [ = ]
228 QgsCreateRasterAttributeTableDialog dlg { mRasterLayer };
229 dlg.setOpenWhenDoneVisible(
false );
230 if ( dlg.exec() == QDialog::Accepted )
232 updateRasterAttributeTableOptionsPage();
237 connect( mLoadRasterAttributeTableFromFileButton, &QPushButton::clicked,
this, [ = ]
242 if ( dlg.exec() == QDialog::Accepted )
244 updateRasterAttributeTableOptionsPage();
248 mBackupCrs = mRasterLayer->crs();
251 if ( mCanvas && mRasterTransparencyWidget->pixelSelectorTool() )
263 connect( mRasterTransparencyWidget->pbnAddValuesFromDisplay, &QPushButton::clicked,
this, [ = ]
269 mCanvas->window()->raise();
270 mCanvas->window()->activateWindow();
271 mCanvas->window()->setFocus();
288 connect( mInsertExpressionButton, &QAbstractButton::clicked,
this, [ = ]
291 int selectionStart = mMapTipWidget->selectionStart();
292 int selectionEnd = mMapTipWidget->selectionEnd();
296 exprDlg.setWindowTitle( tr(
"Insert Expression" ) );
297 if ( exprDlg.exec() == QDialog::Accepted && !exprDlg.expressionText().trimmed().isEmpty() )
298 mMapTipWidget->insertText(
"[%" + exprDlg.expressionText().trimmed() +
"%]" );
300 mMapTipWidget->setLinearSelection( selectionStart, selectionEnd );
311 cboResamplingMethod->clear();
314 for (
const QPair<QString, QString> &method : std::as_const( constProviderType ) )
316 cboResamplingMethod->addItem( method.second, method.first );
320 QString prefix = provider->name() +
"/driverOptions/_pyramids/";
322 QString defaultMethod = mySettings.
value( prefix +
"resampling",
"AVERAGE" ).toString();
323 int idx = cboResamplingMethod->findData( defaultMethod );
325 cboResamplingMethod->setCurrentIndex( idx );
329 const QList< QgsRasterPyramid > myPyramidList = provider->buildPyramidList();
333 if ( pyramid.getExists() )
335 lbxPyramidResolutions->addItem(
new QListWidgetItem( myPyramidPixmap,
336 QString::number( pyramid.getXDim() ) + QStringLiteral(
" x " ) +
337 QString::number( pyramid.getYDim() ) ) );
341 lbxPyramidResolutions->addItem(
new QListWidgetItem( myNoPyramidPixmap,
342 QString::number( pyramid.getXDim() ) + QStringLiteral(
" x " ) +
343 QString::number( pyramid.getYDim() ) ) );
350 mOptsPage_Pyramids->setEnabled(
false );
359 mOptsPage_Histogram->setEnabled(
false );
362 QVBoxLayout *layout =
new QVBoxLayout( metadataFrame );
363 layout->setContentsMargins( 0, 0, 0, 0 );
365 mMetadataWidget->layout()->setContentsMargins( 0, 0, 0, 0 );
366 mMetadataWidget->setMapCanvas( mCanvas );
367 layout->addWidget( mMetadataWidget );
368 metadataFrame->setLayout( layout );
370 QVBoxLayout *temporalLayout =
new QVBoxLayout( temporalFrame );
371 temporalLayout->setContentsMargins( 0, 0, 0, 0 );
373 temporalLayout->addWidget( mTemporalWidget );
376 QgsDebugMsgLevel(
"Setting crs to " + mRasterLayer->crs().userFriendlyIdentifier(), 2 );
377 mCrsSelector->setCrs( mRasterLayer->crs() );
380 QString pyramidFormat( QStringLiteral(
"<h2>%1</h2><p>%2 %3 %4</p><b><font color='red'><p>%5</p><p>%6</p>" ) );
381 QString pyramidHeader = tr(
"Description" );
382 QString pyramidSentence1 = tr(
"Large resolution raster layers can slow navigation in QGIS." );
383 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." );
384 QString pyramidSentence3 = tr(
"You must have write access in the directory where the original data is stored to build pyramids." );
385 QString pyramidSentence4 = tr(
"Please note that building internal pyramids may alter the original data file and once created they cannot be removed!" );
386 QString pyramidSentence5 = tr(
"Please note that building internal pyramids could corrupt your image - always make a backup of your data first!" );
388 tePyramidDescription->setHtml( pyramidFormat.arg( pyramidHeader,
393 pyramidSentence5 ) );
396 mResamplingGroupBox->setSaveCheckedState(
true );
397 mResamplingUtils.initWidgets( mRasterLayer, mZoomedInResamplingComboBox, mZoomedOutResamplingComboBox, mMaximumOversamplingSpinBox, mCbEarlyResampling );
398 mResamplingUtils.refreshWidgetsFromLayer();
402 btnColorizeColor->setColorDialogTitle( tr(
"Select Color" ) );
403 btnColorizeColor->setContext( QStringLiteral(
"symbology" ) );
408 if ( hueSaturationFilter )
410 sliderSaturation->setValue( hueSaturationFilter->
saturation() );
411 comboGrayscale->setCurrentIndex( (
int ) hueSaturationFilter->
grayscaleMode() );
414 toggleSaturationControls(
static_cast<int>( hueSaturationFilter->
grayscaleMode() ) );
417 mColorizeCheck->setChecked( hueSaturationFilter->
colorizeOn() );
418 btnColorizeColor->setColor( hueSaturationFilter->
colorizeColor() );
419 toggleColorizeControls( hueSaturationFilter->
colorizeOn() );
420 sliderColorizeStrength->setValue( hueSaturationFilter->
colorizeStrength() );
421 mInvertColorsCheck->setChecked( hueSaturationFilter->
invertColors() );
426 mBlendModeComboBox->setBlendMode( mRasterLayer->blendMode() );
431 mRasterTransparencyWidget->cboxTransparencyBand->setShowNotSetOption(
true, tr(
"None" ) );
432 mRasterTransparencyWidget->cboxTransparencyBand->setLayer( mRasterLayer );
441 cboxTransparencyBand->setCurrentIndex( cboxTransparencyBand->findData( renderer->
alphaBand() ) );
448 mHistogramWidget =
nullptr;
449 if ( mOptsPage_Histogram->isEnabled() )
452 mHistogramStackedWidget->addWidget( mHistogramWidget );
466 mDisableRenderTypeComboBoxCurrentIndexChanged =
true;
468 for (
const QString &name : constRenderersList )
479 mDisableRenderTypeComboBoxCurrentIndexChanged =
false;
484 QString rendererType = renderer->
type();
485 widgetIndex = mRenderTypeComboBox->findData( rendererType );
486 if ( widgetIndex != -1 )
488 mDisableRenderTypeComboBoxCurrentIndexChanged =
true;
489 mRenderTypeComboBox->setCurrentIndex( widgetIndex );
490 mDisableRenderTypeComboBoxCurrentIndexChanged =
false;
493 if ( rendererType == QLatin1String(
"singlebandcolordata" ) && mRenderTypeComboBox->count() == 1 )
496 QSizePolicy sizep = mBandRenderingGrpBx->sizePolicy();
497 sizep.setVerticalStretch( 0 );
498 sizep.setVerticalPolicy( QSizePolicy::Maximum );
499 mBandRenderingGrpBx->setSizePolicy( sizep );
500 mBandRenderingGrpBx->updateGeometry();
503 if ( mRasterLayer->providerType() != QLatin1String(
"wms" ) )
505 mWMSPrintGroupBox->hide();
506 mPublishDataSourceUrlCheckBox->hide();
507 mBackgroundLayerCheckBox->hide();
514 const int horizontalDpi = logicalDpiX();
517 if ( horizontalDpi > 96 )
519 mMetadataViewer->setZoomFactor( mMetadataViewer->zoomFactor() * 0.9 );
521 mMetadataViewer->page()->setLinkDelegationPolicy( QWebPage::LinkDelegationPolicy::DelegateAllLinks );
523 mMetadataViewer->page()->settings()->setAttribute( QWebSettings::DeveloperExtrasEnabled,
true );
524 mMetadataViewer->page()->settings()->setAttribute( QWebSettings::JavascriptEnabled,
true );
530 mRenderTypeComboBox_currentIndexChanged( widgetIndex );
532 setMetadataWidget( mMetadataWidget, mOptsPage_Metadata );
534 QMenu *menuStyle =
new QMenu(
this );
537 menuStyle->addSeparator();
540 mBtnStyle->setMenu( menuStyle );
541 connect( menuStyle, &QMenu::aboutToShow,
this, &QgsRasterLayerProperties::aboutToShowStyleMenu );
543 mBtnMetadata =
new QPushButton( tr(
"Metadata" ),
this );
544 QMenu *menuMetadata =
new QMenu(
this );
547 menuMetadata->addSeparator();
550 mBtnMetadata->setMenu( menuMetadata );
551 buttonBox->addButton( mBtnMetadata, QDialogButtonBox::ResetRole );
559 if ( !settings.
contains( QStringLiteral(
"/Windows/RasterLayerProperties/tab" ) ) )
561 settings.
setValue( QStringLiteral(
"Windows/RasterLayerProperties/tab" ),
562 mOptStackedWidget->indexOf( mOptsPage_Style ) );
567 optionsStackedWidget_CurrentChanged( mOptionsStackedWidget->currentIndex() );
570 mOptsPage_Information->setProperty(
"helpPage", QStringLiteral(
"working_with_raster/raster_properties.html#information-properties" ) );
571 mOptsPage_Source->setProperty(
"helpPage", QStringLiteral(
"working_with_raster/raster_properties.html#source-properties" ) );
572 mOptsPage_Style->setProperty(
"helpPage", QStringLiteral(
"working_with_raster/raster_properties.html#symbology-properties" ) );
573 mOptsPage_Transparency->setProperty(
"helpPage", QStringLiteral(
"working_with_raster/raster_properties.html#transparency-properties" ) );
575 if ( mOptsPage_Histogram )
576 mOptsPage_Histogram->setProperty(
"helpPage", QStringLiteral(
"working_with_raster/raster_properties.html#histogram-properties" ) );
578 mOptsPage_Rendering->setProperty(
"helpPage", QStringLiteral(
"working_with_raster/raster_properties.html#rendering-properties" ) );
579 mOptsPage_Temporal->setProperty(
"helpPage", QStringLiteral(
"working_with_raster/raster_properties.html#temporal-properties" ) );
581 if ( mOptsPage_Pyramids )
582 mOptsPage_Pyramids->setProperty(
"helpPage", QStringLiteral(
"working_with_raster/raster_properties.html#pyramids-properties" ) );
584 if ( mOptsPage_Display )
585 mOptsPage_Display->setProperty(
"helpPage", QStringLiteral(
"working_with_raster/raster_properties.html#display-properties" ) );
587 mOptsPage_Metadata->setProperty(
"helpPage", QStringLiteral(
"working_with_raster/raster_properties.html#metadata-properties" ) );
588 mOptsPage_Legend->setProperty(
"helpPage", QStringLiteral(
"working_with_raster/raster_properties.html#legend-properties" ) );
589 mOptsPage_Server->setProperty(
"helpPage", QStringLiteral(
"working_with_raster/raster_properties.html#server-properties" ) );
609 if ( beforePage.isEmpty() )
627void QgsRasterLayerProperties::updateRasterAttributeTableOptionsPage( )
629 if ( mRasterAttributeTableWidget )
631 mOptsPage_RasterAttributeTable->layout()->removeWidget( mRasterAttributeTableWidget );
632 mRasterAttributeTableWidget =
nullptr;
638 mRasterAttributeTableWidget =
new QgsRasterAttributeTableWidget(
this, mRasterLayer );
639 mOptsPage_RasterAttributeTable->layout()->addWidget( mRasterAttributeTableWidget );
641 connect( mRasterAttributeTableWidget, &QgsRasterAttributeTableWidget::rendererChanged,
this, &QgsRasterLayerProperties::syncToLayer );
642 mNoRasterAttributeTableWidget->hide();
646 mNoRasterAttributeTableWidget->show();
651void QgsRasterLayerProperties::setRendererWidget(
const QString &rendererName )
660 const QList<int> oldBands = oldRenderer ? oldRenderer->
usesBands() : QList<int>();
665 opacity = oldRenderer->
opacity();
674 QgsDebugMsgLevel( QStringLiteral(
"renderer has widgetCreateFunction" ), 3 );
677 if ( oldWidget && ( !oldRenderer || rendererName != oldRenderer->
type() ) )
679 if ( rendererName == QLatin1String(
"singlebandgray" ) )
682 whileBlocking( mRasterLayer )->setDefaultContrastEnhancement();
684 else if ( rendererName == QLatin1String(
"multibandcolor" ) )
687 whileBlocking( mRasterLayer )->setDefaultContrastEnhancement();
695 mRendererStackedWidget->addWidget( mRendererWidget );
699 std::unique_ptr<QgsRasterRenderer> newRenderer;
700 newRenderer.reset( mRendererWidget->
renderer() );
701 const QList<int> newBands = newRenderer->usesBands();
702 if ( oldBands != newBands )
710 const int widgetIndex = mRenderTypeComboBox->findData( rendererName );
711 if ( widgetIndex != -1 )
713 mDisableRenderTypeComboBoxCurrentIndexChanged =
true;
714 mRenderTypeComboBox->setCurrentIndex( widgetIndex );
715 mDisableRenderTypeComboBoxCurrentIndexChanged =
false;
718 if ( mRendererWidget != oldWidget )
721 if ( mHistogramWidget )
727void QgsRasterLayerProperties::sync()
731 if ( !mSourceWidget )
736 QHBoxLayout *layout =
new QHBoxLayout();
737 layout->addWidget( mSourceWidget );
738 mSourceGroupBox->setLayout( layout );
740 mSourceGroupBox->setTitle( mSourceWidget->
groupTitle() );
741 mSourceGroupBox->show();
745 buttonBox->button( QDialogButtonBox::Apply )->setEnabled( isValid );
746 buttonBox->button( QDialogButtonBox::Ok )->setEnabled( isValid );
766 mRasterTransparencyWidget->gboxNoDataValue->setEnabled(
false );
767 mRasterTransparencyWidget->gboxCustomTransparency->setEnabled(
false );
768 mOptionsStackedWidget->setCurrentWidget( mOptsPage_Server );
775 if ( mOptsPage_Pyramids )
777 delete mOptsPage_Pyramids;
778 mOptsPage_Pyramids =
nullptr;
784 if ( mOptsPage_Histogram )
786 delete mOptsPage_Histogram;
787 mOptsPage_Histogram =
nullptr;
788 delete mHistogramWidget;
789 mHistogramWidget =
nullptr;
801 if ( brightnessFilter )
803 mSliderBrightness->setValue( brightnessFilter->
brightness() );
804 mSliderContrast->setValue( brightnessFilter->
contrast() );
805 mGammaSpinBox->setValue( brightnessFilter->
gamma() );
811 if ( hueSaturationFilter )
813 sliderSaturation->setValue( hueSaturationFilter->
saturation() );
814 comboGrayscale->setCurrentIndex( (
int ) hueSaturationFilter->
grayscaleMode() );
817 toggleSaturationControls(
static_cast<int>( hueSaturationFilter->
grayscaleMode() ) );
820 mColorizeCheck->setChecked( hueSaturationFilter->
colorizeOn() );
821 btnColorizeColor->setColor( hueSaturationFilter->
colorizeColor() );
822 toggleColorizeControls( hueSaturationFilter->
colorizeOn() );
823 sliderColorizeStrength->setValue( hueSaturationFilter->
colorizeStrength() );
824 mInvertColorsCheck->setChecked( hueSaturationFilter->
invertColors() );
827 mRefreshSettingsWidget->syncToLayer();
834 mLayerOrigNameLineEd->setText( mRasterLayer->
name() );
841 updateInformationContent();
847 mLayerShortNameLineEdit->setValidator( shortNameValidator );
854 mLayerDataUrlFormatComboBox->setCurrentIndex(
855 mLayerDataUrlFormatComboBox->findText(
868 const int row = mMetadataUrlModel->rowCount();
869 mMetadataUrlModel->setItem( row, 0,
new QStandardItem( metaUrl.url ) );
870 mMetadataUrlModel->setItem( row, 1,
new QStandardItem( metaUrl.type ) );
871 mMetadataUrlModel->setItem( row, 2,
new QStandardItem( metaUrl.format ) );
875 mLayerLegendUrlLineEdit->setText( mRasterLayer->
legendUrl() );
876 mLayerLegendUrlFormatComboBox->setCurrentIndex( mLayerLegendUrlFormatComboBox->findText( mRasterLayer->
legendUrlFormat() ) );
882 QVariant wmsPrintLayer = mRasterLayer->
customProperty( QStringLiteral(
"WMSPrintLayer" ) );
883 if ( wmsPrintLayer.isValid() )
885 mWMSPrintLayerLineEdit->setText( wmsPrintLayer.toString() );
888 QVariant wmsPublishDataSourceUrl = mRasterLayer->
customProperty( QStringLiteral(
"WMSPublishDataSourceUrl" ),
false );
889 mPublishDataSourceUrlCheckBox->setChecked( wmsPublishDataSourceUrl.toBool() );
891 QVariant wmsBackgroundLayer = mRasterLayer->
customProperty( QStringLiteral(
"WMSBackgroundLayer" ),
false );
892 mBackgroundLayerCheckBox->setChecked( wmsBackgroundLayer.toBool() );
894 mLegendPlaceholderWidget->setLastPathSettingsKey( QStringLiteral(
"lastLegendPlaceholderDir" ) );
896 mLegendConfigEmbeddedWidget->setLayer( mRasterLayer );
901 updateDataDefinedButtons();
905 page->syncToLayer( mRasterLayer );
914 const QString newSource = mSourceWidget->
sourceUri();
915 if ( newSource != mRasterLayer->
source() )
922 if ( !mRasterLayer->
isValid() )
936 mLegendConfigEmbeddedWidget->applyToLayer();
959 if ( rendererWidget )
966 mBackupCrs = mRasterLayer->
crs();
968 mMetadataFilled =
false;
974 if ( rasterRenderer )
984 mRasterLayer->
setName( mLayerOrigNameLineEd->text() );
991 mRefreshSettingsWidget->saveToLayer();
998 mResamplingUtils.refreshLayerFromWidgets();
1002 if ( hueSaturationFilter )
1004 hueSaturationFilter->
setSaturation( sliderSaturation->value() );
1006 hueSaturationFilter->
setColorizeOn( mColorizeCheck->checkState() );
1009 hueSaturationFilter->
setInvertColors( mInvertColorsCheck->isChecked() );
1013 mRasterLayer->
setBlendMode( mBlendModeComboBox->blendMode() );
1018 mRasterLayer->
setCrs( mCrsSelector->crs() );
1021 mMetadataFilled =
false;
1025 mMetadataFilled =
false;
1029 mMetadataFilled =
false;
1033 mMetadataFilled =
false;
1037 mMetadataFilled =
false;
1041 mMetadataFilled =
false;
1046 mMetadataFilled =
false;
1050 mMetadataFilled =
false;
1054 QList<QgsMapLayerServerProperties::MetadataUrl> metaUrls;
1055 for (
int row = 0; row < mMetadataUrlModel->rowCount() ; row++ )
1058 metaUrl.
url = mMetadataUrlModel->item( row, 0 )->text();
1059 metaUrl.
type = mMetadataUrlModel->item( row, 1 )->text();
1060 metaUrl.
format = mMetadataUrlModel->item( row, 2 )->text();
1061 metaUrls.append( metaUrl );
1062 mMetadataFilled =
false;
1066 if ( mRasterLayer->
legendUrl() != mLayerLegendUrlLineEdit->text() )
1067 mMetadataFilled =
false;
1068 mRasterLayer->
setLegendUrl( mLayerLegendUrlLineEdit->text() );
1070 if ( mRasterLayer->
legendUrlFormat() != mLayerLegendUrlFormatComboBox->currentText() )
1071 mMetadataFilled =
false;
1074 if ( !mWMSPrintLayerLineEdit->text().isEmpty() )
1076 mRasterLayer->
setCustomProperty( QStringLiteral(
"WMSPrintLayer" ), mWMSPrintLayerLineEdit->text() );
1079 mRasterLayer->
setCustomProperty(
"WMSPublishDataSourceUrl", mPublishDataSourceUrlCheckBox->isChecked() );
1080 mRasterLayer->
setCustomProperty(
"WMSBackgroundLayer", mBackgroundLayerCheckBox->isChecked() );
1097void QgsRasterLayerProperties::buttonBuildPyramids_clicked()
1109 for (
int myCounterInt = 0; myCounterInt < lbxPyramidResolutions->count(); myCounterInt++ )
1111 QListWidgetItem *myItem = lbxPyramidResolutions->item( myCounterInt );
1113 myPyramidList[myCounterInt].setBuild( myItem->isSelected() || myPyramidList[myCounterInt].getExists() );
1117 QString prefix = provider->
name() +
"/driverOptions/_pyramids/";
1119 QString resamplingMethod( cboResamplingMethod->currentData().toString() );
1120 mySettings.
setValue( prefix +
"resampling", resamplingMethod );
1127 QApplication::setOverrideCursor( Qt::WaitCursor );
1134 QApplication::restoreOverrideCursor();
1135 mPyramidProgress->setValue( 0 );
1136 buttonBuildPyramids->setEnabled(
false );
1137 if ( !res.isNull() )
1139 if ( res == QLatin1String(
"CANCELED" ) )
1143 else if ( res == QLatin1String(
"ERROR_WRITE_ACCESS" ) )
1145 QMessageBox::warning(
this, tr(
"Building Pyramids" ),
1146 tr(
"Write access denied. Adjust the file permissions and try again." ) );
1148 else if ( res == QLatin1String(
"ERROR_WRITE_FORMAT" ) )
1150 QMessageBox::warning(
this, tr(
"Building Pyramids" ),
1151 tr(
"The file was not writable. Some formats do not "
1152 "support pyramid overviews. Consult the GDAL documentation if in doubt." ) );
1154 else if ( res == QLatin1String(
"FAILED_NOT_SUPPORTED" ) )
1156 QMessageBox::warning(
this, tr(
"Building Pyramids" ),
1157 tr(
"Building pyramid overviews is not supported on this type of raster." ) );
1159 else if ( res == QLatin1String(
"ERROR_JPEG_COMPRESSION" ) )
1161 QMessageBox::warning(
this, tr(
"Building Pyramids" ),
1162 tr(
"Building internal pyramid overviews is not supported on raster layers with JPEG compression and your current libtiff library." ) );
1164 else if ( res == QLatin1String(
"ERROR_VIRTUAL" ) )
1166 QMessageBox::warning(
this, tr(
"Building Pyramids" ),
1167 tr(
"Building pyramid overviews is not supported on this type of raster." ) );
1175 lbxPyramidResolutions->clear();
1183 if ( pyramid.getExists() )
1185 lbxPyramidResolutions->addItem(
new QListWidgetItem( myPyramidPixmap,
1186 QString::number( pyramid.getXDim() ) + QStringLiteral(
" x " ) +
1187 QString::number( pyramid.getYDim() ) ) );
1191 lbxPyramidResolutions->addItem(
new QListWidgetItem( myNoPyramidPixmap,
1192 QString::number( pyramid.getXDim() ) + QStringLiteral(
" x " ) +
1193 QString::number( pyramid.getYDim() ) ) );
1202 updateInformationContent();
1205void QgsRasterLayerProperties::mRenderTypeComboBox_currentIndexChanged(
int index )
1207 if ( index < 0 || mDisableRenderTypeComboBoxCurrentIndexChanged || ! mRasterLayer->renderer() )
1212 QString rendererName = mRenderTypeComboBox->itemData( index ).toString();
1213 setRendererWidget( rendererName );
1223void QgsRasterLayerProperties::aboutToShowStyleMenu()
1227 QMenu *m = qobject_cast<QMenu *>( sender() );
1235void QgsRasterLayerProperties::syncToLayer()
1240 setRendererWidget( renderer->
type() );
1250 if ( !mHistogramWidget )
1262 if ( index ==
mOptStackedWidget->indexOf( mOptsPage_Information ) || !mMetadataFilled )
1265 updateInformationContent();
1271 button->blockSignals(
true );
1275 button->blockSignals(
false );
1278void QgsRasterLayerProperties::updateDataDefinedButtons()
1280 const auto propertyOverrideButtons { findChildren< QgsPropertyOverrideButton * >() };
1283 updateDataDefinedButton( button );
1299void QgsRasterLayerProperties::updateProperty()
1306void QgsRasterLayerProperties::toggleSaturationControls(
int grayscaleMode )
1309 if ( grayscaleMode == 0 )
1311 sliderSaturation->setEnabled(
true );
1312 spinBoxSaturation->setEnabled(
true );
1316 sliderSaturation->setEnabled(
false );
1317 spinBoxSaturation->setEnabled(
false );
1321void QgsRasterLayerProperties::toggleColorizeControls(
bool colorizeEnabled )
1324 btnColorizeColor->setEnabled( colorizeEnabled );
1325 sliderColorizeStrength->setEnabled( colorizeEnabled );
1326 spinColorizeStrength->setEnabled( colorizeEnabled );
1330QLinearGradient QgsRasterLayerProperties::redGradient()
1334 QLinearGradient myGradient = QLinearGradient( mGradientWidth, 0, mGradientWidth, mGradientHeight );
1335 myGradient.setColorAt( 0.0, QColor( 242, 14, 25, 190 ) );
1336 myGradient.setColorAt( 0.5, QColor( 175, 29, 37, 190 ) );
1337 myGradient.setColorAt( 1.0, QColor( 114, 17, 22, 190 ) );
1340QLinearGradient QgsRasterLayerProperties::greenGradient()
1344 QLinearGradient myGradient = QLinearGradient( mGradientWidth, 0, mGradientWidth, mGradientHeight );
1345 myGradient.setColorAt( 0.0, QColor( 48, 168, 5, 190 ) );
1346 myGradient.setColorAt( 0.8, QColor( 36, 122, 4, 190 ) );
1347 myGradient.setColorAt( 1.0, QColor( 21, 71, 2, 190 ) );
1350QLinearGradient QgsRasterLayerProperties::blueGradient()
1354 QLinearGradient myGradient = QLinearGradient( mGradientWidth, 0, mGradientWidth, mGradientHeight );
1355 myGradient.setColorAt( 0.0, QColor( 30, 0, 106, 190 ) );
1356 myGradient.setColorAt( 0.2, QColor( 30, 72, 128, 190 ) );
1357 myGradient.setColorAt( 1.0, QColor( 30, 223, 196, 190 ) );
1360QLinearGradient QgsRasterLayerProperties::grayGradient()
1364 QLinearGradient myGradient = QLinearGradient( mGradientWidth, 0, mGradientWidth, mGradientHeight );
1365 myGradient.setColorAt( 0.0, QColor( 5, 5, 5, 190 ) );
1366 myGradient.setColorAt( 0.8, QColor( 122, 122, 122, 190 ) );
1367 myGradient.setColorAt( 1.0, QColor( 220, 220, 220, 190 ) );
1370QLinearGradient QgsRasterLayerProperties::highlightGradient()
1374 QLinearGradient myGradient = QLinearGradient( mGradientWidth, 0, mGradientWidth, mGradientHeight );
1375 myGradient.setColorAt( 1.0, QColor( 255, 255, 255, 50 ) );
1376 myGradient.setColorAt( 0.5, QColor( 255, 255, 255, 100 ) );
1377 myGradient.setColorAt( 0.0, QColor( 255, 255, 255, 150 ) );
1381void QgsRasterLayerProperties::addMetadataUrl()
1383 const int row = mMetadataUrlModel->rowCount();
1384 mMetadataUrlModel->setItem( row, 0,
new QStandardItem( QLatin1String() ) );
1385 mMetadataUrlModel->setItem( row, 1,
new QStandardItem( QLatin1String() ) );
1386 mMetadataUrlModel->setItem( row, 2,
new QStandardItem( QLatin1String() ) );
1389void QgsRasterLayerProperties::removeSelectedMetadataUrl()
1391 const QModelIndexList selectedRows = tableViewMetadataUrl->selectionModel()->selectedRows();
1392 if ( selectedRows.empty() )
1394 mMetadataUrlModel->removeRow( selectedRows[0].row() );
1409void QgsRasterLayerProperties::restoreWindowModality()
1418void QgsRasterLayerProperties::toggleBuildPyramidsButton()
1420 if ( lbxPyramidResolutions->selectedItems().empty() )
1422 buttonBuildPyramids->setEnabled(
false );
1426 buttonBuildPyramids->setEnabled(
true );
1430void QgsRasterLayerProperties::mResetColorRenderingBtn_clicked()
1432 mBlendModeComboBox->setBlendMode( QPainter::CompositionMode_SourceOver );
1433 mSliderBrightness->setValue( 0 );
1434 mSliderContrast->setValue( 0 );
1435 mGammaSpinBox->setValue( 1.0 );
1436 sliderSaturation->setValue( 0 );
1438 mColorizeCheck->setChecked(
false );
1439 sliderColorizeStrength->setValue( 100 );
1440 mInvertColorsCheck->setChecked(
false );
1443bool QgsRasterLayerProperties::rasterIsMultiBandColor()
1448void QgsRasterLayerProperties::updateInformationContent()
1452 const QString html { mRasterLayer->
htmlMetadata().replace( QLatin1String(
"<head>" ), QStringLiteral( R
"raw(<head><style type="text/css">%1</style>)raw" ) ).arg( myStyle ) };
1453 mMetadataViewer->setHtml( html );
1454 mMetadataFilled = true;
1460 if ( mRasterAttributeTableWidget && mRasterAttributeTableWidget->isDirty() )
1462 mRasterAttributeTableWidget->setEditable(
false,
false );
1466 if ( mBackupCrs != mRasterLayer->
crs() )
1467 mRasterLayer->
setCrs( mBackupCrs );
1470void QgsRasterLayerProperties::showHelp()
1472 const QVariant helpPage = mOptionsStackedWidget->currentWidget()->property(
"helpPage" );
1474 if ( helpPage.isValid() )
1480 QgsHelp::openHelp( QStringLiteral(
"working_with_raster/raster_properties.html" ) );
1484void QgsRasterLayerProperties::updateGammaSpinBox(
int value )
1489void QgsRasterLayerProperties::updateGammaSlider(
double value )
1498 if ( obj == mMapTipPreviewContainer && ev->type() == QEvent::Resize )
1502 return QgsOptionsDialogBase::eventFilter( obj, ev );
1505void QgsRasterLayerProperties::initMapTipPreview()
1508 mMapTipSplitter->setSizes( { 400, 200 } );
1510 mMapTipPreviewContainer->installEventFilter(
this );
1514 mMapTipPreview =
new QgsWebView( mMapTipPreviewContainer );
1517 mMapTipPreview->page()->setLinkDelegationPolicy( QWebPage::DelegateAllLinks );
1518 mMapTipPreview->setContextMenuPolicy( Qt::NoContextMenu );
1519 connect( mMapTipPreview, &QWebView::loadFinished,
this, &QgsRasterLayerProperties::resizeMapTip );
1522 mMapTipPreview->page()->settings()->setAttribute( QWebSettings::DeveloperExtrasEnabled,
true );
1523 mMapTipPreview->page()->settings()->setAttribute( QWebSettings::JavascriptEnabled,
true );
1524 mMapTipPreview->page()->settings()->setAttribute( QWebSettings::LocalStorageEnabled,
true );
1527 mMapTipPreview->page()->mainFrame()->setScrollBarPolicy( Qt::Horizontal, Qt::ScrollBarAlwaysOff );
1528 mMapTipPreview->page()->mainFrame()->setScrollBarPolicy( Qt::Vertical, Qt::ScrollBarAlwaysOff );
1532 connect( mMapTipWidget, &QgsCodeEditorHTML::textChanged,
this, &QgsRasterLayerProperties::updateMapTipPreview );
1535void QgsRasterLayerProperties::updateMapTipPreview()
1537 mMapTipPreview->setMaximumSize( mMapTipPreviewContainer->width(), mMapTipPreviewContainer->height() );
1539 mMapTipPreview->setHtml( htmlContent );
1542void QgsRasterLayerProperties::resizeMapTip()
1545 mMapTipPreview->setMaximumSize( mMapTipPreviewContainer->width(), mMapTipPreviewContainer->height() );
1548 const QWebElement container = mMapTipPreview->page()->mainFrame()->findFirstElement(
1549 QStringLiteral(
"#QgsWebViewContainer" ) );
1550 const int width = container.geometry().width();
1551 const int height = container.geometry().height();
1552 mMapTipPreview->resize( width, height );
1555 mMapTipPreview->move( ( mMapTipPreviewContainer->width() - mMapTipPreview->width() ) / 2,
1556 ( mMapTipPreviewContainer->height() - mMapTipPreview->height() ) / 2 );
1559 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 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.
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.
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.
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