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 ) );
210 mRasterTransparencyWidget->pbnAddValuesFromDisplay->setIcon(
QgsApplication::getThemeIcon( QStringLiteral(
"/mActionContextHelp.png" ) ) );
213 mRasterTransparencyWidget->pbnImportTransparentPixelValues->setIcon(
QgsApplication::getThemeIcon( QStringLiteral(
"/mActionFileOpen.svg" ) ) );
214 mRasterTransparencyWidget->pbnExportTransparentPixelValues->setIcon(
QgsApplication::getThemeIcon( QStringLiteral(
"/mActionFileSave.svg" ) ) );
222 connect( mEnableMapTips, &QAbstractButton::toggled, mHtmlMapTipGroupBox, &QWidget::setEnabled );
225 updateRasterAttributeTableOptionsPage();
229 connect( mCreateRasterAttributeTableButton, &QPushButton::clicked,
this, [ = ]
234 QgsCreateRasterAttributeTableDialog dlg { mRasterLayer };
235 dlg.setOpenWhenDoneVisible(
false );
236 if ( dlg.exec() == QDialog::Accepted )
238 updateRasterAttributeTableOptionsPage();
243 connect( mLoadRasterAttributeTableFromFileButton, &QPushButton::clicked,
this, [ = ]
248 if ( dlg.exec() == QDialog::Accepted )
250 updateRasterAttributeTableOptionsPage();
254 mBackupCrs = mRasterLayer->crs();
257 if ( mCanvas && mRasterTransparencyWidget->pixelSelectorTool() )
269 connect( mRasterTransparencyWidget->pbnAddValuesFromDisplay, &QPushButton::clicked,
this, [ = ]
275 mCanvas->window()->raise();
276 mCanvas->window()->activateWindow();
277 mCanvas->window()->setFocus();
294 connect( mInsertExpressionButton, &QAbstractButton::clicked,
this, [ = ]
297 int selectionStart = mMapTipWidget->selectionStart();
298 int selectionEnd = mMapTipWidget->selectionEnd();
302 exprDlg.setWindowTitle( tr(
"Insert Expression" ) );
303 if ( exprDlg.exec() == QDialog::Accepted && !exprDlg.expressionText().trimmed().isEmpty() )
304 mMapTipWidget->insertText(
"[%" + exprDlg.expressionText().trimmed() +
"%]" );
306 mMapTipWidget->setLinearSelection( selectionStart, selectionEnd );
317 cboResamplingMethod->clear();
320 for (
const QPair<QString, QString> &method : std::as_const( constProviderType ) )
322 cboResamplingMethod->addItem( method.second, method.first );
326 QString prefix = provider->name() +
"/driverOptions/_pyramids/";
328 QString defaultMethod = mySettings.
value( prefix +
"resampling",
"AVERAGE" ).toString();
329 int idx = cboResamplingMethod->findData( defaultMethod );
331 cboResamplingMethod->setCurrentIndex( idx );
335 const QList< QgsRasterPyramid > myPyramidList = provider->buildPyramidList();
339 if ( pyramid.getExists() )
341 lbxPyramidResolutions->addItem(
new QListWidgetItem( myPyramidPixmap,
342 QString::number( pyramid.getXDim() ) + QStringLiteral(
" x " ) +
343 QString::number( pyramid.getYDim() ) ) );
347 lbxPyramidResolutions->addItem(
new QListWidgetItem( myNoPyramidPixmap,
348 QString::number( pyramid.getXDim() ) + QStringLiteral(
" x " ) +
349 QString::number( pyramid.getYDim() ) ) );
356 mOptsPage_Pyramids->setEnabled(
false );
365 mOptsPage_Histogram->setEnabled(
false );
368 QVBoxLayout *layout =
new QVBoxLayout( metadataFrame );
369 layout->setContentsMargins( 0, 0, 0, 0 );
371 mMetadataWidget->layout()->setContentsMargins( 0, 0, 0, 0 );
372 mMetadataWidget->setMapCanvas( mCanvas );
373 layout->addWidget( mMetadataWidget );
374 metadataFrame->setLayout( layout );
376 QVBoxLayout *temporalLayout =
new QVBoxLayout( temporalFrame );
377 temporalLayout->setContentsMargins( 0, 0, 0, 0 );
379 temporalLayout->addWidget( mTemporalWidget );
382 QgsDebugMsgLevel(
"Setting crs to " + mRasterLayer->crs().userFriendlyIdentifier(), 2 );
383 mCrsSelector->setCrs( mRasterLayer->crs() );
386 QString pyramidFormat( QStringLiteral(
"<h2>%1</h2><p>%2 %3 %4</p><b><font color='red'><p>%5</p><p>%6</p>" ) );
387 QString pyramidHeader = tr(
"Description" );
388 QString pyramidSentence1 = tr(
"Large resolution raster layers can slow navigation in QGIS." );
389 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." );
390 QString pyramidSentence3 = tr(
"You must have write access in the directory where the original data is stored to build pyramids." );
391 QString pyramidSentence4 = tr(
"Please note that building internal pyramids may alter the original data file and once created they cannot be removed!" );
392 QString pyramidSentence5 = tr(
"Please note that building internal pyramids could corrupt your image - always make a backup of your data first!" );
394 tePyramidDescription->setHtml( pyramidFormat.arg( pyramidHeader,
399 pyramidSentence5 ) );
402 mResamplingGroupBox->setSaveCheckedState(
true );
403 mResamplingUtils.initWidgets( mRasterLayer, mZoomedInResamplingComboBox, mZoomedOutResamplingComboBox, mMaximumOversamplingSpinBox, mCbEarlyResampling );
404 mResamplingUtils.refreshWidgetsFromLayer();
408 btnColorizeColor->setColorDialogTitle( tr(
"Select Color" ) );
409 btnColorizeColor->setContext( QStringLiteral(
"symbology" ) );
414 if ( hueSaturationFilter )
416 sliderSaturation->setValue( hueSaturationFilter->
saturation() );
417 comboGrayscale->setCurrentIndex( (
int ) hueSaturationFilter->
grayscaleMode() );
420 toggleSaturationControls(
static_cast<int>( hueSaturationFilter->
grayscaleMode() ) );
423 mColorizeCheck->setChecked( hueSaturationFilter->
colorizeOn() );
424 btnColorizeColor->setColor( hueSaturationFilter->
colorizeColor() );
425 toggleColorizeControls( hueSaturationFilter->
colorizeOn() );
426 sliderColorizeStrength->setValue( hueSaturationFilter->
colorizeStrength() );
427 mInvertColorsCheck->setChecked( hueSaturationFilter->
invertColors() );
432 mBlendModeComboBox->setBlendMode( mRasterLayer->blendMode() );
437 mRasterTransparencyWidget->cboxTransparencyBand->setShowNotSetOption(
true, tr(
"None" ) );
438 mRasterTransparencyWidget->cboxTransparencyBand->setLayer( mRasterLayer );
447 cboxTransparencyBand->setCurrentIndex( cboxTransparencyBand->findData( renderer->
alphaBand() ) );
454 mHistogramWidget =
nullptr;
455 if ( mOptsPage_Histogram->isEnabled() )
458 mHistogramStackedWidget->addWidget( mHistogramWidget );
472 mDisableRenderTypeComboBoxCurrentIndexChanged =
true;
474 for (
const QString &name : constRenderersList )
485 mDisableRenderTypeComboBoxCurrentIndexChanged =
false;
490 QString rendererType = renderer->
type();
491 widgetIndex = mRenderTypeComboBox->findData( rendererType );
492 if ( widgetIndex != -1 )
494 mDisableRenderTypeComboBoxCurrentIndexChanged =
true;
495 mRenderTypeComboBox->setCurrentIndex( widgetIndex );
496 mDisableRenderTypeComboBoxCurrentIndexChanged =
false;
499 if ( rendererType == QLatin1String(
"singlebandcolordata" ) && mRenderTypeComboBox->count() == 1 )
502 QSizePolicy sizep = mBandRenderingGrpBx->sizePolicy();
503 sizep.setVerticalStretch( 0 );
504 sizep.setVerticalPolicy( QSizePolicy::Maximum );
505 mBandRenderingGrpBx->setSizePolicy( sizep );
506 mBandRenderingGrpBx->updateGeometry();
509 if ( mRasterLayer->providerType() != QLatin1String(
"wms" ) )
511 mWMSPrintGroupBox->hide();
512 mPublishDataSourceUrlCheckBox->hide();
513 mBackgroundLayerCheckBox->hide();
520 const int horizontalDpi = logicalDpiX();
523 if ( horizontalDpi > 96 )
525 mMetadataViewer->setZoomFactor( mMetadataViewer->zoomFactor() * 0.9 );
527 mMetadataViewer->page()->setLinkDelegationPolicy( QWebPage::LinkDelegationPolicy::DelegateAllLinks );
529 mMetadataViewer->page()->settings()->setAttribute( QWebSettings::DeveloperExtrasEnabled,
true );
530 mMetadataViewer->page()->settings()->setAttribute( QWebSettings::JavascriptEnabled,
true );
536 mRenderTypeComboBox_currentIndexChanged( widgetIndex );
538 setMetadataWidget( mMetadataWidget, mOptsPage_Metadata );
540 QMenu *menuStyle =
new QMenu(
this );
543 menuStyle->addSeparator();
546 mBtnStyle->setMenu( menuStyle );
547 connect( menuStyle, &QMenu::aboutToShow,
this, &QgsRasterLayerProperties::aboutToShowStyleMenu );
549 mBtnMetadata =
new QPushButton( tr(
"Metadata" ),
this );
550 QMenu *menuMetadata =
new QMenu(
this );
553 menuMetadata->addSeparator();
556 mBtnMetadata->setMenu( menuMetadata );
557 buttonBox->addButton( mBtnMetadata, QDialogButtonBox::ResetRole );
565 if ( !settings.
contains( QStringLiteral(
"/Windows/RasterLayerProperties/tab" ) ) )
567 settings.
setValue( QStringLiteral(
"Windows/RasterLayerProperties/tab" ),
568 mOptStackedWidget->indexOf( mOptsPage_Style ) );
573 optionsStackedWidget_CurrentChanged( mOptionsStackedWidget->currentIndex() );
576 mOptsPage_Information->setProperty(
"helpPage", QStringLiteral(
"working_with_raster/raster_properties.html#information-properties" ) );
577 mOptsPage_Source->setProperty(
"helpPage", QStringLiteral(
"working_with_raster/raster_properties.html#source-properties" ) );
578 mOptsPage_Style->setProperty(
"helpPage", QStringLiteral(
"working_with_raster/raster_properties.html#symbology-properties" ) );
579 mOptsPage_Transparency->setProperty(
"helpPage", QStringLiteral(
"working_with_raster/raster_properties.html#transparency-properties" ) );
581 if ( mOptsPage_Histogram )
582 mOptsPage_Histogram->setProperty(
"helpPage", QStringLiteral(
"working_with_raster/raster_properties.html#histogram-properties" ) );
584 mOptsPage_Rendering->setProperty(
"helpPage", QStringLiteral(
"working_with_raster/raster_properties.html#rendering-properties" ) );
585 mOptsPage_Temporal->setProperty(
"helpPage", QStringLiteral(
"working_with_raster/raster_properties.html#temporal-properties" ) );
587 if ( mOptsPage_Pyramids )
588 mOptsPage_Pyramids->setProperty(
"helpPage", QStringLiteral(
"working_with_raster/raster_properties.html#pyramids-properties" ) );
590 if ( mOptsPage_Display )
591 mOptsPage_Display->setProperty(
"helpPage", QStringLiteral(
"working_with_raster/raster_properties.html#display-properties" ) );
593 mOptsPage_Metadata->setProperty(
"helpPage", QStringLiteral(
"working_with_raster/raster_properties.html#metadata-properties" ) );
594 mOptsPage_Legend->setProperty(
"helpPage", QStringLiteral(
"working_with_raster/raster_properties.html#legend-properties" ) );
595 mOptsPage_Server->setProperty(
"helpPage", QStringLiteral(
"working_with_raster/raster_properties.html#server-properties" ) );
615 if ( beforePage.isEmpty() )
633void QgsRasterLayerProperties::updateRasterAttributeTableOptionsPage( )
635 if ( mRasterAttributeTableWidget )
637 mOptsPage_RasterAttributeTable->layout()->removeWidget( mRasterAttributeTableWidget );
638 mRasterAttributeTableWidget =
nullptr;
644 mRasterAttributeTableWidget =
new QgsRasterAttributeTableWidget(
this, mRasterLayer );
645 mOptsPage_RasterAttributeTable->layout()->addWidget( mRasterAttributeTableWidget );
647 connect( mRasterAttributeTableWidget, &QgsRasterAttributeTableWidget::rendererChanged,
this, &QgsRasterLayerProperties::syncToLayer );
648 mNoRasterAttributeTableWidget->hide();
652 mNoRasterAttributeTableWidget->show();
657void QgsRasterLayerProperties::setRendererWidget(
const QString &rendererName )
666 const QList<int> oldBands = oldRenderer ? oldRenderer->
usesBands() : QList<int>();
671 opacity = oldRenderer->
opacity();
680 QgsDebugMsgLevel( QStringLiteral(
"renderer has widgetCreateFunction" ), 3 );
683 if ( oldWidget && ( !oldRenderer || rendererName != oldRenderer->
type() ) )
685 if ( rendererName == QLatin1String(
"singlebandgray" ) )
688 whileBlocking( mRasterLayer )->setDefaultContrastEnhancement();
690 else if ( rendererName == QLatin1String(
"multibandcolor" ) )
693 whileBlocking( mRasterLayer )->setDefaultContrastEnhancement();
701 mRendererStackedWidget->addWidget( mRendererWidget );
705 std::unique_ptr<QgsRasterRenderer> newRenderer;
706 newRenderer.reset( mRendererWidget->
renderer() );
707 const QList<int> newBands = newRenderer->usesBands();
708 if ( oldBands != newBands )
716 const int widgetIndex = mRenderTypeComboBox->findData( rendererName );
717 if ( widgetIndex != -1 )
719 mDisableRenderTypeComboBoxCurrentIndexChanged =
true;
720 mRenderTypeComboBox->setCurrentIndex( widgetIndex );
721 mDisableRenderTypeComboBoxCurrentIndexChanged =
false;
724 if ( mRendererWidget != oldWidget )
727 if ( mHistogramWidget )
733void QgsRasterLayerProperties::sync()
737 if ( !mSourceWidget )
742 QHBoxLayout *layout =
new QHBoxLayout();
743 layout->addWidget( mSourceWidget );
744 mSourceGroupBox->setLayout( layout );
746 mSourceGroupBox->setTitle( mSourceWidget->
groupTitle() );
747 mSourceGroupBox->show();
751 buttonBox->button( QDialogButtonBox::Apply )->setEnabled( isValid );
752 buttonBox->button( QDialogButtonBox::Ok )->setEnabled( isValid );
772 mRasterTransparencyWidget->gboxNoDataValue->setEnabled(
false );
773 mRasterTransparencyWidget->gboxCustomTransparency->setEnabled(
false );
774 mOptionsStackedWidget->setCurrentWidget( mOptsPage_Server );
781 if ( mOptsPage_Pyramids )
783 delete mOptsPage_Pyramids;
784 mOptsPage_Pyramids =
nullptr;
790 if ( mOptsPage_Histogram )
792 delete mOptsPage_Histogram;
793 mOptsPage_Histogram =
nullptr;
794 delete mHistogramWidget;
795 mHistogramWidget =
nullptr;
807 if ( brightnessFilter )
809 mSliderBrightness->setValue( brightnessFilter->
brightness() );
810 mSliderContrast->setValue( brightnessFilter->
contrast() );
811 mGammaSpinBox->setValue( brightnessFilter->
gamma() );
817 if ( hueSaturationFilter )
819 sliderSaturation->setValue( hueSaturationFilter->
saturation() );
820 comboGrayscale->setCurrentIndex( (
int ) hueSaturationFilter->
grayscaleMode() );
823 toggleSaturationControls(
static_cast<int>( hueSaturationFilter->
grayscaleMode() ) );
826 mColorizeCheck->setChecked( hueSaturationFilter->
colorizeOn() );
827 btnColorizeColor->setColor( hueSaturationFilter->
colorizeColor() );
828 toggleColorizeControls( hueSaturationFilter->
colorizeOn() );
829 sliderColorizeStrength->setValue( hueSaturationFilter->
colorizeStrength() );
830 mInvertColorsCheck->setChecked( hueSaturationFilter->
invertColors() );
833 mRefreshSettingsWidget->syncToLayer();
840 mLayerOrigNameLineEd->setText( mRasterLayer->
name() );
847 updateInformationContent();
853 mLayerShortNameLineEdit->setValidator( shortNameValidator );
860 mLayerDataUrlFormatComboBox->setCurrentIndex(
861 mLayerDataUrlFormatComboBox->findText(
874 const int row = mMetadataUrlModel->rowCount();
875 mMetadataUrlModel->setItem( row, 0,
new QStandardItem( metaUrl.url ) );
876 mMetadataUrlModel->setItem( row, 1,
new QStandardItem( metaUrl.type ) );
877 mMetadataUrlModel->setItem( row, 2,
new QStandardItem( metaUrl.format ) );
881 mLayerLegendUrlLineEdit->setText( mRasterLayer->
legendUrl() );
882 mLayerLegendUrlFormatComboBox->setCurrentIndex( mLayerLegendUrlFormatComboBox->findText( mRasterLayer->
legendUrlFormat() ) );
888 QVariant wmsPrintLayer = mRasterLayer->
customProperty( QStringLiteral(
"WMSPrintLayer" ) );
889 if ( wmsPrintLayer.isValid() )
891 mWMSPrintLayerLineEdit->setText( wmsPrintLayer.toString() );
894 QVariant wmsPublishDataSourceUrl = mRasterLayer->
customProperty( QStringLiteral(
"WMSPublishDataSourceUrl" ),
false );
895 mPublishDataSourceUrlCheckBox->setChecked( wmsPublishDataSourceUrl.toBool() );
897 QVariant wmsBackgroundLayer = mRasterLayer->
customProperty( QStringLiteral(
"WMSBackgroundLayer" ),
false );
898 mBackgroundLayerCheckBox->setChecked( wmsBackgroundLayer.toBool() );
900 mLegendPlaceholderWidget->setLastPathSettingsKey( QStringLiteral(
"lastLegendPlaceholderDir" ) );
902 mLegendConfigEmbeddedWidget->setLayer( mRasterLayer );
907 updateDataDefinedButtons();
911 page->syncToLayer( mRasterLayer );
920 const QString newSource = mSourceWidget->
sourceUri();
921 if ( newSource != mRasterLayer->
source() )
928 if ( !mRasterLayer->
isValid() )
942 mLegendConfigEmbeddedWidget->applyToLayer();
963 if (
"" != mRasterTransparencyWidget->leNoDataValue->text() )
965 bool myDoubleOk =
false;
970 myNoDataRangeList << myNoDataRange;
973 for (
int bandNo = 1; bandNo <= mRasterLayer->
dataProvider()->bandCount(); bandNo++ )
981 if ( rendererWidget )
988 mBackupCrs = mRasterLayer->
crs();
990 mMetadataFilled =
false;
994 if ( rasterRenderer )
996 rasterRenderer->
setAlphaBand( mRasterTransparencyWidget->cboxTransparencyBand->currentBand() );
997 rasterRenderer->
setNodataColor( mRasterTransparencyWidget->mNodataColorButton->color() );
1001 if ( mRasterTransparencyWidget->tableTransparency->columnCount() == 4 )
1003 QVector<QgsRasterTransparency::TransparentThreeValuePixel> myTransparentThreeValuePixelList;
1004 for (
int myListRunner = 0; myListRunner < mRasterTransparencyWidget->tableTransparency->rowCount(); myListRunner++ )
1006 const double red = transparencyCellValue( myListRunner, 0 );
1007 const double green = transparencyCellValue( myListRunner, 1 );
1008 const double blue = transparencyCellValue( myListRunner, 2 );
1009 const double opacity = 1.0 - transparencyCellValue( myListRunner, 3 ) / 100.0;
1010 myTransparentThreeValuePixelList.append(
1016 else if ( mRasterTransparencyWidget->tableTransparency->columnCount() == 3 )
1018 QVector<QgsRasterTransparency::TransparentSingleValuePixel> myTransparentSingleValuePixelList;
1019 for (
int myListRunner = 0; myListRunner < mRasterTransparencyWidget->tableTransparency->rowCount(); myListRunner++ )
1021 const double min = transparencyCellValue( myListRunner, 0 );
1022 const double max = transparencyCellValue( myListRunner, 1 );
1023 const double opacity = 1.0 - transparencyCellValue( myListRunner, 2 ) / 100.0;
1025 myTransparentSingleValuePixelList.append(
1038 rasterRenderer->
setOpacity( mRasterTransparencyWidget->mOpacityWidget->opacity() );
1045 mRasterLayer->
setName( mLayerOrigNameLineEd->text() );
1052 mRefreshSettingsWidget->saveToLayer();
1059 mResamplingUtils.refreshLayerFromWidgets();
1063 if ( hueSaturationFilter )
1065 hueSaturationFilter->
setSaturation( sliderSaturation->value() );
1067 hueSaturationFilter->
setColorizeOn( mColorizeCheck->checkState() );
1070 hueSaturationFilter->
setInvertColors( mInvertColorsCheck->isChecked() );
1074 mRasterLayer->
setBlendMode( mBlendModeComboBox->blendMode() );
1079 mRasterLayer->
setCrs( mCrsSelector->crs() );
1082 mMetadataFilled =
false;
1086 mMetadataFilled =
false;
1090 mMetadataFilled =
false;
1094 mMetadataFilled =
false;
1098 mMetadataFilled =
false;
1102 mMetadataFilled =
false;
1107 mMetadataFilled =
false;
1111 mMetadataFilled =
false;
1115 QList<QgsMapLayerServerProperties::MetadataUrl> metaUrls;
1116 for (
int row = 0; row < mMetadataUrlModel->rowCount() ; row++ )
1119 metaUrl.
url = mMetadataUrlModel->item( row, 0 )->text();
1120 metaUrl.
type = mMetadataUrlModel->item( row, 1 )->text();
1121 metaUrl.
format = mMetadataUrlModel->item( row, 2 )->text();
1122 metaUrls.append( metaUrl );
1123 mMetadataFilled =
false;
1127 if ( mRasterLayer->
legendUrl() != mLayerLegendUrlLineEdit->text() )
1128 mMetadataFilled =
false;
1129 mRasterLayer->
setLegendUrl( mLayerLegendUrlLineEdit->text() );
1131 if ( mRasterLayer->
legendUrlFormat() != mLayerLegendUrlFormatComboBox->currentText() )
1132 mMetadataFilled =
false;
1135 if ( !mWMSPrintLayerLineEdit->text().isEmpty() )
1137 mRasterLayer->
setCustomProperty( QStringLiteral(
"WMSPrintLayer" ), mWMSPrintLayerLineEdit->text() );
1140 mRasterLayer->
setCustomProperty(
"WMSPublishDataSourceUrl", mPublishDataSourceUrlCheckBox->isChecked() );
1141 mRasterLayer->
setCustomProperty(
"WMSBackgroundLayer", mBackgroundLayerCheckBox->isChecked() );
1158void QgsRasterLayerProperties::buttonBuildPyramids_clicked()
1170 for (
int myCounterInt = 0; myCounterInt < lbxPyramidResolutions->count(); myCounterInt++ )
1172 QListWidgetItem *myItem = lbxPyramidResolutions->item( myCounterInt );
1174 myPyramidList[myCounterInt].setBuild( myItem->isSelected() || myPyramidList[myCounterInt].getExists() );
1178 QString prefix = provider->
name() +
"/driverOptions/_pyramids/";
1180 QString resamplingMethod( cboResamplingMethod->currentData().toString() );
1181 mySettings.
setValue( prefix +
"resampling", resamplingMethod );
1188 QApplication::setOverrideCursor( Qt::WaitCursor );
1195 QApplication::restoreOverrideCursor();
1196 mPyramidProgress->setValue( 0 );
1197 buttonBuildPyramids->setEnabled(
false );
1198 if ( !res.isNull() )
1200 if ( res == QLatin1String(
"CANCELED" ) )
1204 else if ( res == QLatin1String(
"ERROR_WRITE_ACCESS" ) )
1206 QMessageBox::warning(
this, tr(
"Building Pyramids" ),
1207 tr(
"Write access denied. Adjust the file permissions and try again." ) );
1209 else if ( res == QLatin1String(
"ERROR_WRITE_FORMAT" ) )
1211 QMessageBox::warning(
this, tr(
"Building Pyramids" ),
1212 tr(
"The file was not writable. Some formats do not "
1213 "support pyramid overviews. Consult the GDAL documentation if in doubt." ) );
1215 else if ( res == QLatin1String(
"FAILED_NOT_SUPPORTED" ) )
1217 QMessageBox::warning(
this, tr(
"Building Pyramids" ),
1218 tr(
"Building pyramid overviews is not supported on this type of raster." ) );
1220 else if ( res == QLatin1String(
"ERROR_JPEG_COMPRESSION" ) )
1222 QMessageBox::warning(
this, tr(
"Building Pyramids" ),
1223 tr(
"Building internal pyramid overviews is not supported on raster layers with JPEG compression and your current libtiff library." ) );
1225 else if ( res == QLatin1String(
"ERROR_VIRTUAL" ) )
1227 QMessageBox::warning(
this, tr(
"Building Pyramids" ),
1228 tr(
"Building pyramid overviews is not supported on this type of raster." ) );
1236 lbxPyramidResolutions->clear();
1244 if ( pyramid.getExists() )
1246 lbxPyramidResolutions->addItem(
new QListWidgetItem( myPyramidPixmap,
1247 QString::number( pyramid.getXDim() ) + QStringLiteral(
" x " ) +
1248 QString::number( pyramid.getYDim() ) ) );
1252 lbxPyramidResolutions->addItem(
new QListWidgetItem( myNoPyramidPixmap,
1253 QString::number( pyramid.getXDim() ) + QStringLiteral(
" x " ) +
1254 QString::number( pyramid.getYDim() ) ) );
1263 updateInformationContent();
1266void QgsRasterLayerProperties::mRenderTypeComboBox_currentIndexChanged(
int index )
1268 if ( index < 0 || mDisableRenderTypeComboBoxCurrentIndexChanged || ! mRasterLayer->renderer() )
1273 QString rendererName = mRenderTypeComboBox->itemData( index ).toString();
1274 setRendererWidget( rendererName );
1284void QgsRasterLayerProperties::setTransparencyCell(
int row,
int column,
double value )
1286 QgsDebugMsgLevel( QStringLiteral(
"value = %1" ).arg( value, 0,
'g', 17 ), 3 );
1288 if ( !provider )
return;
1291 if ( !renderer )
return;
1292 int nBands = renderer->
usesBands().size();
1294 QLineEdit *lineEdit =
new QLineEdit();
1295 lineEdit->setFrame(
false );
1297 lineEdit->setContentsMargins( 1, 1, 1, 1 );
1299 if ( column == mRasterTransparencyWidget->tableTransparency->columnCount() - 1 )
1303 lineEdit->setValidator(
new QIntValidator(
nullptr ) );
1304 lineEdit->setText( QString::number(
static_cast<int>( value ) ) );
1309 QString valueString;
1315 if ( !std::isnan( value ) )
1318 valueString = QLocale().toString( v,
'g' ) ;
1322 lineEdit->setValidator(
new QIntValidator(
nullptr ) );
1323 if ( !std::isnan( value ) )
1325 valueString = QLocale().toString(
static_cast<int>( value ) );
1329 lineEdit->setText( valueString );
1331 mRasterTransparencyWidget->tableTransparency->setCellWidget( row, column, lineEdit );
1332 adjustTransparencyCellWidth( row, column );
1334 if ( nBands == 1 && ( column == 0 || column == 1 ) )
1336 connect( lineEdit, &QLineEdit::textEdited,
this, &QgsRasterLayerProperties::transparencyCellTextEdited );
1338 mRasterTransparencyWidget->tableTransparency->resizeColumnsToContents();
1341void QgsRasterLayerProperties::setTransparencyCellValue(
int row,
int column,
double value )
1343 QLineEdit *lineEdit =
dynamic_cast<QLineEdit *
>( mRasterTransparencyWidget->tableTransparency->cellWidget( row, column ) );
1344 if ( !lineEdit )
return;
1346 lineEdit->setText( QLocale().toString( v,
'g' ) );
1347 lineEdit->adjustSize();
1348 adjustTransparencyCellWidth( row, column );
1349 mRasterTransparencyWidget->tableTransparency->resizeColumnsToContents();
1352double QgsRasterLayerProperties::transparencyCellValue(
int row,
int column )
1354 QLineEdit *lineEdit =
dynamic_cast<QLineEdit *
>( mRasterTransparencyWidget->tableTransparency->cellWidget( row, column ) );
1355 if ( !lineEdit || lineEdit->text().isEmpty() )
1357 return std::numeric_limits<double>::quiet_NaN();
1359 return QLocale().toDouble( lineEdit->text() );
1362void QgsRasterLayerProperties::adjustTransparencyCellWidth(
int row,
int column )
1364 QLineEdit *lineEdit =
dynamic_cast<QLineEdit *
>( mRasterTransparencyWidget->tableTransparency->cellWidget( row, column ) );
1365 if ( !lineEdit )
return;
1367 int width = std::max( lineEdit->fontMetrics().boundingRect( lineEdit->text() ).width() + 10, 100 );
1368 width = std::max( width, mRasterTransparencyWidget->tableTransparency->columnWidth( column ) );
1370 lineEdit->setFixedWidth( width );
1373void QgsRasterLayerProperties::transparencyCellTextEdited(
const QString &text )
1382 int nBands = renderer->
usesBands().size();
1385 QLineEdit *lineEdit = qobject_cast<QLineEdit *>( sender() );
1386 if ( !lineEdit )
return;
1389 for (
int r = 0; r < mRasterTransparencyWidget->tableTransparency->rowCount(); r++ )
1391 for (
int c = 0;
c < mRasterTransparencyWidget->tableTransparency->columnCount();
c++ )
1393 if ( mRasterTransparencyWidget->tableTransparency->cellWidget( r,
c ) == sender() )
1400 if ( row != -1 )
break;
1402 QgsDebugMsgLevel( QStringLiteral(
"row = %1 column =%2" ).arg( row ).arg( column ), 3 );
1406 QLineEdit *toLineEdit =
dynamic_cast<QLineEdit *
>( mRasterTransparencyWidget->tableTransparency->cellWidget( row, 1 ) );
1407 if ( !toLineEdit )
return;
1408 bool toChanged = mTransparencyToEdited.value( row );
1409 QgsDebugMsgLevel( QStringLiteral(
"toChanged = %1" ).arg( toChanged ), 3 );
1412 toLineEdit->setText( lineEdit->text() );
1415 else if ( column == 1 )
1417 setTransparencyToEdited( row );
1422void QgsRasterLayerProperties::aboutToShowStyleMenu()
1426 QMenu *m = qobject_cast<QMenu *>( sender() );
1434void QgsRasterLayerProperties::syncToLayer()
1439 setRendererWidget( renderer->
type() );
1445void QgsRasterLayerProperties::setTransparencyToEdited(
int row )
1447 if ( row >= mTransparencyToEdited.size() )
1449 mTransparencyToEdited.resize( row + 1 );
1451 mTransparencyToEdited[row] =
true;
1458 if ( !mHistogramWidget )
1470 if ( index ==
mOptStackedWidget->indexOf( mOptsPage_Information ) || !mMetadataFilled )
1473 updateInformationContent();
1479 button->blockSignals(
true );
1483 button->blockSignals(
false );
1486void QgsRasterLayerProperties::updateDataDefinedButtons()
1488 const auto propertyOverrideButtons { findChildren< QgsPropertyOverrideButton * >() };
1491 updateDataDefinedButton( button );
1507void QgsRasterLayerProperties::updateProperty()
1514void QgsRasterLayerProperties::toggleSaturationControls(
int grayscaleMode )
1517 if ( grayscaleMode == 0 )
1519 sliderSaturation->setEnabled(
true );
1520 spinBoxSaturation->setEnabled(
true );
1524 sliderSaturation->setEnabled(
false );
1525 spinBoxSaturation->setEnabled(
false );
1529void QgsRasterLayerProperties::toggleColorizeControls(
bool colorizeEnabled )
1532 btnColorizeColor->setEnabled( colorizeEnabled );
1533 sliderColorizeStrength->setEnabled( colorizeEnabled );
1534 spinColorizeStrength->setEnabled( colorizeEnabled );
1538QLinearGradient QgsRasterLayerProperties::redGradient()
1542 QLinearGradient myGradient = QLinearGradient( mGradientWidth, 0, mGradientWidth, mGradientHeight );
1543 myGradient.setColorAt( 0.0, QColor( 242, 14, 25, 190 ) );
1544 myGradient.setColorAt( 0.5, QColor( 175, 29, 37, 190 ) );
1545 myGradient.setColorAt( 1.0, QColor( 114, 17, 22, 190 ) );
1548QLinearGradient QgsRasterLayerProperties::greenGradient()
1552 QLinearGradient myGradient = QLinearGradient( mGradientWidth, 0, mGradientWidth, mGradientHeight );
1553 myGradient.setColorAt( 0.0, QColor( 48, 168, 5, 190 ) );
1554 myGradient.setColorAt( 0.8, QColor( 36, 122, 4, 190 ) );
1555 myGradient.setColorAt( 1.0, QColor( 21, 71, 2, 190 ) );
1558QLinearGradient QgsRasterLayerProperties::blueGradient()
1562 QLinearGradient myGradient = QLinearGradient( mGradientWidth, 0, mGradientWidth, mGradientHeight );
1563 myGradient.setColorAt( 0.0, QColor( 30, 0, 106, 190 ) );
1564 myGradient.setColorAt( 0.2, QColor( 30, 72, 128, 190 ) );
1565 myGradient.setColorAt( 1.0, QColor( 30, 223, 196, 190 ) );
1568QLinearGradient QgsRasterLayerProperties::grayGradient()
1572 QLinearGradient myGradient = QLinearGradient( mGradientWidth, 0, mGradientWidth, mGradientHeight );
1573 myGradient.setColorAt( 0.0, QColor( 5, 5, 5, 190 ) );
1574 myGradient.setColorAt( 0.8, QColor( 122, 122, 122, 190 ) );
1575 myGradient.setColorAt( 1.0, QColor( 220, 220, 220, 190 ) );
1578QLinearGradient QgsRasterLayerProperties::highlightGradient()
1582 QLinearGradient myGradient = QLinearGradient( mGradientWidth, 0, mGradientWidth, mGradientHeight );
1583 myGradient.setColorAt( 1.0, QColor( 255, 255, 255, 50 ) );
1584 myGradient.setColorAt( 0.5, QColor( 255, 255, 255, 100 ) );
1585 myGradient.setColorAt( 0.0, QColor( 255, 255, 255, 150 ) );
1589void QgsRasterLayerProperties::addMetadataUrl()
1591 const int row = mMetadataUrlModel->rowCount();
1592 mMetadataUrlModel->setItem( row, 0,
new QStandardItem( QLatin1String() ) );
1593 mMetadataUrlModel->setItem( row, 1,
new QStandardItem( QLatin1String() ) );
1594 mMetadataUrlModel->setItem( row, 2,
new QStandardItem( QLatin1String() ) );
1597void QgsRasterLayerProperties::removeSelectedMetadataUrl()
1599 const QModelIndexList selectedRows = tableViewMetadataUrl->selectionModel()->selectedRows();
1600 if ( selectedRows.empty() )
1602 mMetadataUrlModel->removeRow( selectedRows[0].row() );
1617void QgsRasterLayerProperties::restoreWindowModality()
1626void QgsRasterLayerProperties::toggleBuildPyramidsButton()
1628 if ( lbxPyramidResolutions->selectedItems().empty() )
1630 buttonBuildPyramids->setEnabled(
false );
1634 buttonBuildPyramids->setEnabled(
true );
1638void QgsRasterLayerProperties::mResetColorRenderingBtn_clicked()
1640 mBlendModeComboBox->setBlendMode( QPainter::CompositionMode_SourceOver );
1641 mSliderBrightness->setValue( 0 );
1642 mSliderContrast->setValue( 0 );
1643 mGammaSpinBox->setValue( 1.0 );
1644 sliderSaturation->setValue( 0 );
1646 mColorizeCheck->setChecked(
false );
1647 sliderColorizeStrength->setValue( 100 );
1648 mInvertColorsCheck->setChecked(
false );
1651bool QgsRasterLayerProperties::rasterIsMultiBandColor()
1656void QgsRasterLayerProperties::updateInformationContent()
1660 const QString html { mRasterLayer->
htmlMetadata().replace( QLatin1String(
"<head>" ), QStringLiteral( R
"raw(<head><style type="text/css">%1</style>)raw" ) ).arg( myStyle ) };
1661 mMetadataViewer->setHtml( html );
1662 mMetadataFilled = true;
1668 if ( mRasterAttributeTableWidget && mRasterAttributeTableWidget->isDirty() )
1670 mRasterAttributeTableWidget->setEditable(
false,
false );
1674 if ( mBackupCrs != mRasterLayer->
crs() )
1675 mRasterLayer->
setCrs( mBackupCrs );
1678void QgsRasterLayerProperties::showHelp()
1680 const QVariant helpPage = mOptionsStackedWidget->currentWidget()->property(
"helpPage" );
1682 if ( helpPage.isValid() )
1688 QgsHelp::openHelp( QStringLiteral(
"working_with_raster/raster_properties.html" ) );
1692void QgsRasterLayerProperties::updateGammaSpinBox(
int value )
1697void QgsRasterLayerProperties::updateGammaSlider(
double value )
1706 if ( obj == mMapTipPreviewContainer && ev->type() == QEvent::Resize )
1710 return QgsOptionsDialogBase::eventFilter( obj, ev );
1713void QgsRasterLayerProperties::initMapTipPreview()
1716 mMapTipSplitter->setSizes( { 400, 200 } );
1718 mMapTipPreviewContainer->installEventFilter(
this );
1722 mMapTipPreview =
new QgsWebView( mMapTipPreviewContainer );
1725 mMapTipPreview->page()->setLinkDelegationPolicy( QWebPage::DelegateAllLinks );
1726 mMapTipPreview->setContextMenuPolicy( Qt::NoContextMenu );
1727 connect( mMapTipPreview, &QWebView::loadFinished,
this, &QgsRasterLayerProperties::resizeMapTip );
1730 mMapTipPreview->page()->settings()->setAttribute( QWebSettings::DeveloperExtrasEnabled,
true );
1731 mMapTipPreview->page()->settings()->setAttribute( QWebSettings::JavascriptEnabled,
true );
1732 mMapTipPreview->page()->settings()->setAttribute( QWebSettings::LocalStorageEnabled,
true );
1735 mMapTipPreview->page()->mainFrame()->setScrollBarPolicy( Qt::Horizontal, Qt::ScrollBarAlwaysOff );
1736 mMapTipPreview->page()->mainFrame()->setScrollBarPolicy( Qt::Vertical, Qt::ScrollBarAlwaysOff );
1740 connect( mMapTipWidget, &QgsCodeEditorHTML::textChanged,
this, &QgsRasterLayerProperties::updateMapTipPreview );
1743void QgsRasterLayerProperties::updateMapTipPreview()
1745 mMapTipPreview->setMaximumSize( mMapTipPreviewContainer->width(), mMapTipPreviewContainer->height() );
1747 mMapTipPreview->setHtml( htmlContent );
1750void QgsRasterLayerProperties::resizeMapTip()
1753 mMapTipPreview->setMaximumSize( mMapTipPreviewContainer->width(), mMapTipPreviewContainer->height() );
1756 const QWebElement container = mMapTipPreview->page()->mainFrame()->findFirstElement(
1757 QStringLiteral(
"#QgsWebViewContainer" ) );
1758 const int width = container.geometry().width();
1759 const int height = container.geometry().height();
1760 mMapTipPreview->resize( width, height );
1763 mMapTipPreview->move( ( mMapTipPreviewContainer->width() - mMapTipPreview->width() ) / 2,
1764 ( mMapTipPreviewContainer->height() - mMapTipPreview->height() ) / 2 );
1767 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,...
@ Float32
Thirty two bit floating point (float)
@ ARGB32_Premultiplied
Color, alpha, red, green, blue, 4 bytes the same as QImage::Format_ARGB32_Premultiplied.
@ ARGB32
Color, alpha, red, green, blue, 4 bytes the same as QImage::Format_ARGB32.
@ Float64
Sixty four bit floating point (double)
@ 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 Qt GUI widgets (based on QLabel or QTextBrowser), supports basic CSS and Qt extensions...
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.
QgsDoubleValidator is a QLineEdit Validator that combines QDoubleValidator and QRegularExpressionVali...
static double toDouble(const QString &input, bool *ok)
Converts input string to double value.
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.
static QString printValue(double value, bool localized=false)
Print double value with all necessary significant digits.
Base class for raster data providers.
virtual QString buildPyramids(const QList< QgsRasterPyramid > &pyramidList, const QString &resamplingMethod="NEAREST", Qgis::RasterPyramidFormat format=Qgis::RasterPyramidFormat::GeoTiff, const QStringList &configOptions=QStringList(), QgsRasterBlockFeedback *feedback=nullptr)
Creates pyramid overviews.
Qgis::DataType sourceDataType(int bandNo) const override=0
Returns source data type for the band specified by number, source data type may be shorter than dataT...
virtual void setUseSourceNoDataValue(int bandNo, bool use)
Sets the source nodata value usage.
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 void setUserNoDataValue(int bandNo, const QgsRasterRangeList &noData)
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.
Raster values range container.
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 setRasterTransparency(QgsRasterTransparency *t)
void setNodataColor(const QColor &color)
Sets the color to use for shading nodata pixels.
Defines the list of pixel values to be considered as transparent or semi transparent when rendering r...
void setTransparentSingleValuePixelList(const QVector< QgsRasterTransparency::TransparentSingleValuePixel > &newList)
Sets the transparent single value pixel list, replacing the whole existing list.
void setTransparentThreeValuePixelList(const QVector< QgsRasterTransparency::TransparentThreeValuePixel > &newList)
Sets the transparent three value pixel list, replacing the whole existing list.
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 ...
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
QgsSignalBlocker< Object > whileBlocking(Object *object)
Temporarily blocks signals from a QObject while calling a single method from the object.
#define QgsDebugMsgLevel(str, level)
QList< QgsRasterRange > QgsRasterRangeList
const QgsCoordinateReferenceSystem & crs
Setting options for creating vector data providers.
Registry for raster renderer entries.
QgsRasterRendererWidgetCreateFunc widgetCreateFunction
Defines the transparency for a range of single-band pixel values.
Defines the transparency for a RGB pixel value.