37 #include "qgsnative.h" 62 #include <QDesktopServices> 63 #include <QTableWidgetItem> 64 #include <QHeaderView> 65 #include <QTextStream> 67 #include <QFileDialog> 68 #include <QMessageBox> 70 #include <QLinearGradient> 71 #include <QPainterPath> 73 #include <QColorDialog> 75 #include <QMouseEvent> 84 , TRSTRING_NOT_SET( tr(
"Not Set" ) )
85 , mDefaultStandardDeviation( 0 )
86 , mDefaultRedBand( 0 )
87 , mDefaultGreenBand( 0 )
88 , mDefaultBlueBand( 0 )
90 , mGradientHeight( 0.0 )
91 , mGradientWidth( 0.0 )
92 , mMapCanvas( canvas )
93 , mMetadataFilled( false )
95 mGrayMinimumMaximumEstimated =
true;
96 mRGBMinimumMaximumEstimated =
true;
99 connect( mLayerOrigNameLineEd, &QLineEdit::textEdited,
this, &QgsRasterLayerProperties::mLayerOrigNameLineEd_textEdited );
100 connect( buttonBuildPyramids, &QPushButton::clicked,
this, &QgsRasterLayerProperties::buttonBuildPyramids_clicked );
101 connect( pbnAddValuesFromDisplay, &QToolButton::clicked,
this, &QgsRasterLayerProperties::pbnAddValuesFromDisplay_clicked );
102 connect( pbnAddValuesManually, &QToolButton::clicked,
this, &QgsRasterLayerProperties::pbnAddValuesManually_clicked );
104 connect( pbnDefaultValues, &QToolButton::clicked,
this, &QgsRasterLayerProperties::pbnDefaultValues_clicked );
105 connect( pbnExportTransparentPixelValues, &QToolButton::clicked,
this, &QgsRasterLayerProperties::pbnExportTransparentPixelValues_clicked );
106 connect( pbnImportTransparentPixelValues, &QToolButton::clicked,
this, &QgsRasterLayerProperties::pbnImportTransparentPixelValues_clicked );
107 connect( pbnRemoveSelectedRow, &QToolButton::clicked,
this, &QgsRasterLayerProperties::pbnRemoveSelectedRow_clicked );
108 connect( mRenderTypeComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRasterLayerProperties::mRenderTypeComboBox_currentIndexChanged );
109 connect( mResetColorRenderingBtn, &QToolButton::clicked,
this, &QgsRasterLayerProperties::mResetColorRenderingBtn_clicked );
114 connect( buttonBox, &QDialogButtonBox::helpRequested,
this, &QgsRasterLayerProperties::showHelp );
116 mBtnStyle =
new QPushButton( tr(
"Style" ) );
117 QMenu *menuStyle =
new QMenu(
this );
118 menuStyle->addAction( tr(
"Load Style…" ),
this, &QgsRasterLayerProperties::loadStyle_clicked );
119 menuStyle->addAction( tr(
"Save Style…" ),
this, &QgsRasterLayerProperties::saveStyleAs_clicked );
120 menuStyle->addSeparator();
121 menuStyle->addAction( tr(
"Save as Default" ),
this, &QgsRasterLayerProperties::saveDefaultStyle_clicked );
122 menuStyle->addAction( tr(
"Restore Default" ),
this, &QgsRasterLayerProperties::loadDefaultStyle_clicked );
123 mBtnStyle->setMenu( menuStyle );
124 connect( menuStyle, &QMenu::aboutToShow,
this, &QgsRasterLayerProperties::aboutToShowStyleMenu );
125 buttonBox->addButton( mBtnStyle, QDialogButtonBox::ResetRole );
127 mBtnMetadata =
new QPushButton( tr(
"Metadata" ),
this );
128 QMenu *menuMetadata =
new QMenu(
this );
129 mActionLoadMetadata = menuMetadata->addAction( tr(
"Load Metadata…" ),
this, &QgsRasterLayerProperties::loadMetadata );
130 mActionSaveMetadataAs = menuMetadata->addAction( tr(
"Save Metadata…" ),
this, &QgsRasterLayerProperties::saveMetadataAs );
131 menuMetadata->addSeparator();
132 menuMetadata->addAction( tr(
"Save as Default" ),
this, &QgsRasterLayerProperties::saveDefaultMetadata );
133 menuMetadata->addAction( tr(
"Restore Default" ),
this, &QgsRasterLayerProperties::loadDefaultMetadata );
134 mBtnMetadata->setMenu( menuMetadata );
135 buttonBox->addButton( mBtnMetadata, QDialogButtonBox::ResetRole );
139 connect(
this, &QDialog::accepted,
this, &QgsRasterLayerProperties::apply );
140 connect(
this, &QDialog::rejected,
this, &QgsRasterLayerProperties::onCancel );
142 connect( buttonBox->button( QDialogButtonBox::Apply ), &QAbstractButton::clicked,
this, &QgsRasterLayerProperties::apply );
145 connect( mSliderBrightness, &QAbstractSlider::valueChanged, mBrightnessSpinBox, &QSpinBox::setValue );
146 connect( mBrightnessSpinBox, static_cast <
void ( QSpinBox::* )(
int ) > ( &QSpinBox::valueChanged ), mSliderBrightness, &QAbstractSlider::setValue );
148 connect( mSliderContrast, &QAbstractSlider::valueChanged, mContrastSpinBox, &QSpinBox::setValue );
149 connect( mContrastSpinBox, static_cast <
void ( QSpinBox::* )(
int ) > ( &QSpinBox::valueChanged ), mSliderContrast, &QAbstractSlider::setValue );
152 connect( sliderSaturation, &QAbstractSlider::valueChanged, spinBoxSaturation, &QSpinBox::setValue );
153 connect( spinBoxSaturation, static_cast <
void ( QSpinBox::* )(
int ) > ( &QSpinBox::valueChanged ), sliderSaturation, &QAbstractSlider::setValue );
156 connect( sliderColorizeStrength, &QAbstractSlider::valueChanged, spinColorizeStrength, &QSpinBox::setValue );
157 connect( spinColorizeStrength, static_cast <
void ( QSpinBox::* )(
int ) > ( &QSpinBox::valueChanged ), sliderColorizeStrength, &QAbstractSlider::setValue );
160 connect( comboGrayscale,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRasterLayerProperties::toggleSaturationControls );
163 connect( mColorizeCheck, &QAbstractButton::toggled,
this, &QgsRasterLayerProperties::toggleColorizeControls );
166 connect( lbxPyramidResolutions, &QListWidget::itemSelectionChanged,
this, &QgsRasterLayerProperties::toggleBuildPyramidsButton );
168 connect( mRefreshLayerCheckBox, &QCheckBox::toggled, mRefreshLayerIntervalSpinBox, &QDoubleSpinBox::setEnabled );
171 mScaleRangeWidget->setMapCanvas( mMapCanvas );
175 leNoDataValue->setValidator(
new QDoubleValidator( -std::numeric_limits<double>::max(), std::numeric_limits<double>::max(), 1000,
this ) );
190 mPixelSelectorTool = qgis::make_unique<QgsMapToolEmitPoint>( canvas );
196 pbnAddValuesFromDisplay->setEnabled(
false );
210 cboResamplingMethod->clear();
213 for ( QPair<QString, QString> method : constProviderType )
215 cboResamplingMethod->addItem( method.second, method.first );
219 QString prefix = provider->
name() +
"/driverOptions/_pyramids/";
221 QString defaultMethod = mySettings.
value( prefix +
"resampling",
"AVERAGE" ).toString();
222 int idx = cboResamplingMethod->findData( defaultMethod );
224 cboResamplingMethod->setCurrentIndex( idx );
229 QList< QgsRasterPyramid >::iterator myRasterPyramidIterator;
231 for ( myRasterPyramidIterator = myPyramidList.begin();
232 myRasterPyramidIterator != myPyramidList.end();
233 ++myRasterPyramidIterator )
235 if ( myRasterPyramidIterator->exists )
237 lbxPyramidResolutions->addItem(
new QListWidgetItem( myPyramidPixmap,
238 QString::number( myRasterPyramidIterator->xDim ) + QStringLiteral(
" x " ) +
239 QString::number( myRasterPyramidIterator->yDim ) ) );
243 lbxPyramidResolutions->addItem(
new QListWidgetItem( myNoPyramidPixmap,
244 QString::number( myRasterPyramidIterator->xDim ) + QStringLiteral(
" x " ) +
245 QString::number( myRasterPyramidIterator->yDim ) ) );
252 mOptsPage_Pyramids->setEnabled(
false );
261 mOptsPage_Histogram->setEnabled(
false );
264 QVBoxLayout *layout =
new QVBoxLayout( metadataFrame );
265 layout->setMargin( 0 );
267 mMetadataWidget->layout()->setContentsMargins( -1, 0, -1, 0 );
269 layout->addWidget( mMetadataWidget );
270 metadataFrame->setLayout( layout );
274 mCrsSelector->setCrs( mRasterLayer->
crs() );
277 QString pyramidFormat( QStringLiteral(
"<h2>%1</h2><p>%2 %3 %4</p><b><font color='red'><p>%5</p><p>%6</p>" ) );
278 QString pyramidHeader = tr(
"Description" );
279 QString pyramidSentence1 = tr(
"Large resolution raster layers can slow navigation in QGIS." );
280 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." );
281 QString pyramidSentence3 = tr(
"You must have write access in the directory where the original data is stored to build pyramids." );
282 QString pyramidSentence4 = tr(
"Please note that building internal pyramids may alter the original data file and once created they cannot be removed!" );
283 QString pyramidSentence5 = tr(
"Please note that building internal pyramids could corrupt your image - always make a backup of your data first!" );
285 tePyramidDescription->setHtml( pyramidFormat.arg( pyramidHeader,
290 pyramidSentence5 ) );
293 mResamplingGroupBox->setSaveCheckedState(
true );
295 mZoomedInResamplingComboBox->insertItem( 0, tr(
"Nearest neighbour" ) );
296 mZoomedInResamplingComboBox->insertItem( 1, tr(
"Bilinear" ) );
297 mZoomedInResamplingComboBox->insertItem( 2, tr(
"Cubic" ) );
298 mZoomedOutResamplingComboBox->insertItem( 0, tr(
"Nearest neighbour" ) );
299 mZoomedOutResamplingComboBox->insertItem( 1, tr(
"Average" ) );
303 if ( resampleFilter )
306 if ( zoomedInResampler )
308 if ( zoomedInResampler->
type() == QLatin1String(
"bilinear" ) )
310 mZoomedInResamplingComboBox->setCurrentIndex( 1 );
312 else if ( zoomedInResampler->
type() == QLatin1String(
"cubic" ) )
314 mZoomedInResamplingComboBox->setCurrentIndex( 2 );
319 mZoomedInResamplingComboBox->setCurrentIndex( 0 );
323 if ( zoomedOutResampler )
325 if ( zoomedOutResampler->
type() == QLatin1String(
"bilinear" ) )
327 mZoomedOutResamplingComboBox->setCurrentIndex( 1 );
332 mZoomedOutResamplingComboBox->setCurrentIndex( 0 );
334 mMaximumOversamplingSpinBox->setValue( resampleFilter->
maxOversampling() );
337 btnColorizeColor->setColorDialogTitle( tr(
"Select Color" ) );
338 btnColorizeColor->setContext( QStringLiteral(
"symbology" ) );
343 if ( hueSaturationFilter )
345 sliderSaturation->setValue( hueSaturationFilter->
saturation() );
346 comboGrayscale->setCurrentIndex( (
int ) hueSaturationFilter->
grayscaleMode() );
349 toggleSaturationControls( static_cast<int>( hueSaturationFilter->
grayscaleMode() ) );
352 mColorizeCheck->setChecked( hueSaturationFilter->
colorizeOn() );
353 btnColorizeColor->setColor( hueSaturationFilter->
colorizeColor() );
354 toggleColorizeControls( hueSaturationFilter->
colorizeOn() );
355 sliderColorizeStrength->setValue( hueSaturationFilter->
colorizeStrength() );
359 mBlendModeComboBox->setBlendMode( mRasterLayer->
blendMode() );
364 cboxTransparencyBand->setShowNotSetOption(
true, tr(
"None" ) );
365 cboxTransparencyBand->setLayer( mRasterLayer );
374 cboxTransparencyBand->setCurrentIndex( cboxTransparencyBand->findData( renderer->
alphaBand() ) );
381 mHistogramWidget =
nullptr;
382 if ( mOptsPage_Histogram->isEnabled() )
385 mHistogramStackedWidget->addWidget( mHistogramWidget );
397 mDisableRenderTypeComboBoxCurrentIndexChanged =
true;
399 for (
const QString &name : constRenderersList )
410 mDisableRenderTypeComboBoxCurrentIndexChanged =
false;
415 QString rendererType = renderer->
type();
416 widgetIndex = mRenderTypeComboBox->findData( rendererType );
417 if ( widgetIndex != -1 )
419 mDisableRenderTypeComboBoxCurrentIndexChanged =
true;
420 mRenderTypeComboBox->setCurrentIndex( widgetIndex );
421 mDisableRenderTypeComboBoxCurrentIndexChanged =
false;
424 if ( rendererType == QLatin1String(
"singlebandcolordata" ) && mRenderTypeComboBox->count() == 1 )
427 QSizePolicy sizep = mBandRenderingGrpBx->sizePolicy();
428 sizep.setVerticalStretch( 0 );
429 sizep.setVerticalPolicy( QSizePolicy::Maximum );
430 mBandRenderingGrpBx->setSizePolicy( sizep );
431 mBandRenderingGrpBx->updateGeometry();
434 if ( mRasterLayer->
providerType() != QStringLiteral(
"wms" ) )
436 mWMSPrintGroupBox->hide();
437 mPublishDataSourceUrlCheckBox->hide();
438 mBackgroundLayerCheckBox->hide();
445 #if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) 446 const int horizontalDpi = qApp->desktop()->screen()->logicalDpiX();
448 const int horizontalDpi = logicalDpiX();
452 if ( horizontalDpi > 96 )
454 mMetadataViewer->setZoomFactor( mMetadataViewer->zoomFactor() * 0.9 );
456 mMetadataViewer->page()->setLinkDelegationPolicy( QWebPage::LinkDelegationPolicy::DelegateAllLinks );
457 connect( mMetadataViewer->page(), &QWebPage::linkClicked,
this, &QgsRasterLayerProperties::urlClicked );
458 mMetadataViewer->page()->settings()->setAttribute( QWebSettings::DeveloperExtrasEnabled,
true );
459 mMetadataViewer->page()->settings()->setAttribute( QWebSettings::JavascriptEnabled,
true );
463 mRenderTypeComboBox_currentIndexChanged( widgetIndex );
471 if ( !settings.
contains( QStringLiteral(
"/Windows/RasterLayerProperties/tab" ) ) )
473 settings.
setValue( QStringLiteral(
"Windows/RasterLayerProperties/tab" ),
479 QString title = QString( tr(
"Layer Properties - %1" ) ).arg( lyr->
name() );
487 void QgsRasterLayerProperties::setupTransparencyTable(
int nBands )
489 tableTransparency->clear();
490 tableTransparency->setColumnCount( 0 );
491 tableTransparency->setRowCount( 0 );
492 mTransparencyToEdited.clear();
496 tableTransparency->setColumnCount( 4 );
497 tableTransparency->setHorizontalHeaderItem( 0,
new QTableWidgetItem( tr(
"Red" ) ) );
498 tableTransparency->setHorizontalHeaderItem( 1,
new QTableWidgetItem( tr(
"Green" ) ) );
499 tableTransparency->setHorizontalHeaderItem( 2,
new QTableWidgetItem( tr(
"Blue" ) ) );
500 tableTransparency->setHorizontalHeaderItem( 3,
new QTableWidgetItem( tr(
"Percent Transparent" ) ) );
504 tableTransparency->setColumnCount( 3 );
507 if ( QgsRasterLayer::PalettedColor != mRasterLayer->drawingStyle() &&
508 QgsRasterLayer::PalettedSingleBandGray != mRasterLayer->drawingStyle() &&
509 QgsRasterLayer::PalettedSingleBandPseudoColor != mRasterLayer->drawingStyle() &&
510 QgsRasterLayer::PalettedMultiBandColor != mRasterLayer->drawingStyle() )
512 tableTransparency->setHorizontalHeaderItem( 0,
new QTableWidgetItem( tr(
"Gray" ) ) );
516 tableTransparency->setHorizontalHeaderItem( 0,
new QTableWidgetItem( tr(
"Indexed Value" ) ) );
519 tableTransparency->setHorizontalHeaderItem( 0,
new QTableWidgetItem( tr(
"From" ) ) );
520 tableTransparency->setHorizontalHeaderItem( 1,
new QTableWidgetItem( tr(
"To" ) ) );
521 tableTransparency->setHorizontalHeaderItem( 2,
new QTableWidgetItem( tr(
"Percent Transparent" ) ) );
524 tableTransparency->horizontalHeader()->setSectionResizeMode( 0, QHeaderView::Stretch );
525 tableTransparency->horizontalHeader()->setSectionResizeMode( 1, QHeaderView::Stretch );
528 void QgsRasterLayerProperties::populateTransparencyTable(
QgsRasterRenderer *renderer )
540 int nBands = renderer->
usesBands().size();
541 setupTransparencyTable( nBands );
544 if ( !rasterTransparency )
552 for (
int i = 0; i < pixelList.size(); ++i )
554 tableTransparency->insertRow( i );
555 setTransparencyCell( i, 0, pixelList[i].min );
556 setTransparencyCell( i, 1, pixelList[i].max );
557 setTransparencyCell( i, 2, pixelList[i].percentTransparent );
559 if ( pixelList[i].min != pixelList[i].max )
561 setTransparencyToEdited( i );
565 else if ( nBands == 3 )
568 for (
int i = 0; i < pixelList.size(); ++i )
570 tableTransparency->insertRow( i );
571 setTransparencyCell( i, 0, pixelList[i].red );
572 setTransparencyCell( i, 1, pixelList[i].green );
573 setTransparencyCell( i, 2, pixelList[i].blue );
574 setTransparencyCell( i, 3, pixelList[i].percentTransparent );
578 tableTransparency->resizeColumnsToContents();
579 tableTransparency->resizeRowsToContents();
582 void QgsRasterLayerProperties::setRendererWidget(
const QString &rendererName )
595 opacity = oldRenderer->
opacity();
604 QgsDebugMsg( QStringLiteral(
"renderer has widgetCreateFunction" ) );
607 if ( oldWidget && ( !oldRenderer || rendererName != oldRenderer->
type() ) )
609 if ( rendererName == QLatin1String(
"singlebandgray" ) )
612 whileBlocking( mRasterLayer )->setDefaultContrastEnhancement();
614 else if ( rendererName == QLatin1String(
"multibandcolor" ) )
617 whileBlocking( mRasterLayer )->setDefaultContrastEnhancement();
625 mRendererStackedWidget->addWidget( mRendererWidget );
631 QList<int> oldBands = oldRenderer->
usesBands();
632 QList<int> newBands = newRenderer->
usesBands();
633 if ( oldBands != newBands )
635 populateTransparencyTable( newRenderer );
643 const int widgetIndex = mRenderTypeComboBox->findData( rendererName );
644 if ( widgetIndex != -1 )
646 mDisableRenderTypeComboBoxCurrentIndexChanged =
true;
647 mRenderTypeComboBox->setCurrentIndex( widgetIndex );
648 mDisableRenderTypeComboBoxCurrentIndexChanged =
false;
651 if ( mRendererWidget != oldWidget )
654 if ( mHistogramWidget )
669 void QgsRasterLayerProperties::sync()
680 gboxNoDataValue->setEnabled(
false );
681 gboxCustomTransparency->setEnabled(
false );
682 mOptionsStackedWidget->setCurrentWidget( mOptsPage_Server );
688 if ( mOptsPage_Pyramids )
690 delete mOptsPage_Pyramids;
691 mOptsPage_Pyramids =
nullptr;
697 if ( mOptsPage_Histogram )
699 delete mOptsPage_Histogram;
700 mOptsPage_Histogram =
nullptr;
701 delete mHistogramWidget;
702 mHistogramWidget =
nullptr;
706 QgsDebugMsg( QStringLiteral(
"populate transparency tab" ) );
713 if ( brightnessFilter )
715 mSliderBrightness->setValue( brightnessFilter->
brightness() );
716 mSliderContrast->setValue( brightnessFilter->
contrast() );
730 cboxTransparencyBand->setBand( renderer->
alphaBand() );
742 lblSrcNoDataValue->setText( tr(
"not defined" ) );
749 mSrcNoDataValueCheckBox->setEnabled( enableSrcNoData );
750 lblSrcNoDataValue->setEnabled( enableSrcNoData );
753 QgsDebugMsg( QStringLiteral(
"noDataRangeList.size = %1" ).arg( noDataRangeList.size() ) );
754 if ( !noDataRangeList.isEmpty() )
760 leNoDataValue->insert( QString() );
767 populateTransparencyTable( mRasterLayer->
renderer() );
769 QgsDebugMsg( QStringLiteral(
"populate colormap tab" ) );
774 QgsDebugMsg( QStringLiteral(
"populate general tab" ) );
780 mLayerOrigNameLineEd->setText( mRasterLayer->
name() );
781 leDisplayName->setText( mRasterLayer->
name() );
784 QPixmap thumbnail = QPixmap::fromImage( mRasterLayer->
previewAsImage( pixmapThumbnail->size() ) );
785 pixmapThumbnail->setPixmap( thumbnail );
791 pixmapLegend->setPixmap( mRasterLayer->legendAsPixmap() );
792 pixmapLegend->setScaledContents(
true );
793 pixmapLegend->repaint();
796 pixmapPalette->setPixmap( mRasterLayer->
paletteAsPixmap( mRasterLayer->bandNumber( mRasterLayer->grayBandName() ) ) );
797 pixmapPalette->setScaledContents(
true );
798 pixmapPalette->repaint();
801 QgsDebugMsg( QStringLiteral(
"populate metadata tab" ) );
806 updateInformationContent();
809 mLayerShortNameLineEdit->setText( mRasterLayer->
shortName() );
812 mLayerShortNameLineEdit->setValidator( shortNameValidator );
815 mLayerTitleLineEdit->setText( mRasterLayer->
title() );
816 mLayerAbstractTextEdit->setPlainText( mRasterLayer->
abstract() );
817 mLayerKeywordListLineEdit->setText( mRasterLayer->
keywordList() );
818 mLayerDataUrlLineEdit->setText( mRasterLayer->
dataUrl() );
819 mLayerDataUrlFormatComboBox->setCurrentIndex(
820 mLayerDataUrlFormatComboBox->findText(
826 mLayerAttributionLineEdit->setText( mRasterLayer->
attribution() );
827 mLayerAttributionUrlLineEdit->setText( mRasterLayer->
attributionUrl() );
828 mLayerMetadataUrlLineEdit->setText( mRasterLayer->
metadataUrl() );
829 mLayerMetadataUrlTypeComboBox->setCurrentIndex(
830 mLayerMetadataUrlTypeComboBox->findText(
834 mLayerMetadataUrlFormatComboBox->setCurrentIndex(
835 mLayerMetadataUrlFormatComboBox->findText(
840 mLayerLegendUrlLineEdit->setText( mRasterLayer->
legendUrl() );
841 mLayerLegendUrlFormatComboBox->setCurrentIndex( mLayerLegendUrlFormatComboBox->findText( mRasterLayer->
legendUrlFormat() ) );
844 QVariant wmsPrintLayer = mRasterLayer->
customProperty( QStringLiteral(
"WMSPrintLayer" ) );
845 if ( wmsPrintLayer.isValid() )
847 mWMSPrintLayerLineEdit->setText( wmsPrintLayer.toString() );
850 QVariant wmsPublishDataSourceUrl = mRasterLayer->
customProperty( QStringLiteral(
"WMSPublishDataSourceUrl" ),
false );
851 mPublishDataSourceUrlCheckBox->setChecked( wmsPublishDataSourceUrl.toBool() );
853 QVariant wmsBackgroundLayer = mRasterLayer->
customProperty( QStringLiteral(
"WMSBackgroundLayer" ),
false );
854 mBackgroundLayerCheckBox->setChecked( wmsBackgroundLayer.toBool() );
859 mLegendConfigEmbeddedWidget->setLayer( mRasterLayer );
868 void QgsRasterLayerProperties::apply()
872 if ( !mRasterLayer->
isValid() )
878 mLegendConfigEmbeddedWidget->applyToLayer();
880 QgsDebugMsg( QStringLiteral(
"apply processing symbology tab" ) );
891 QgsDebugMsg( QStringLiteral(
"processing transparency tab" ) );
898 if (
"" != leNoDataValue->text() )
900 bool myDoubleOk =
false;
901 double myNoDataValue = leNoDataValue->text().toDouble( &myDoubleOk );
905 myNoDataRangeList << myNoDataRange;
916 if ( rendererWidget )
924 mMetadataFilled =
false;
928 if ( rasterRenderer )
930 rasterRenderer->
setAlphaBand( cboxTransparencyBand->currentBand() );
934 if ( tableTransparency->columnCount() == 4 )
937 QList<QgsRasterTransparency::TransparentThreeValuePixel> myTransparentThreeValuePixelList;
938 for (
int myListRunner = 0; myListRunner < tableTransparency->rowCount(); myListRunner++ )
940 myTransparentPixel.
red = transparencyCellValue( myListRunner, 0 );
941 myTransparentPixel.
green = transparencyCellValue( myListRunner, 1 );
942 myTransparentPixel.
blue = transparencyCellValue( myListRunner, 2 );
944 myTransparentThreeValuePixelList.append( myTransparentPixel );
948 else if ( tableTransparency->columnCount() == 3 )
951 QList<QgsRasterTransparency::TransparentSingleValuePixel> myTransparentSingleValuePixelList;
952 for (
int myListRunner = 0; myListRunner < tableTransparency->rowCount(); myListRunner++ )
954 myTransparentPixel.
min = transparencyCellValue( myListRunner, 0 );
955 myTransparentPixel.
max = transparencyCellValue( myListRunner, 1 );
958 myTransparentSingleValuePixelList.append( myTransparentPixel );
966 rasterRenderer->
setOpacity( mOpacityWidget->opacity() );
969 QgsDebugMsg( QStringLiteral(
"processing general tab" ) );
973 mRasterLayer->
setName( mLayerOrigNameLineEd->text() );
989 if ( resampleFilter )
992 QString zoomedInResamplingMethod = mZoomedInResamplingComboBox->currentText();
993 if ( zoomedInResamplingMethod == tr(
"Bilinear" ) )
997 else if ( zoomedInResamplingMethod == tr(
"Cubic" ) )
1006 QString zoomedOutResamplingMethod = mZoomedOutResamplingComboBox->currentText();
1007 if ( zoomedOutResamplingMethod == tr(
"Average" ) )
1019 if ( hueSaturationFilter )
1021 hueSaturationFilter->
setSaturation( sliderSaturation->value() );
1023 hueSaturationFilter->
setColorizeOn( mColorizeCheck->checkState() );
1029 mRasterLayer->
setBlendMode( mBlendModeComboBox->blendMode() );
1032 QPixmap thumbnail = QPixmap::fromImage( mRasterLayer->
previewAsImage( pixmapThumbnail->size() ) );
1033 pixmapThumbnail->setPixmap( thumbnail );
1035 if ( mRasterLayer->
shortName() != mLayerShortNameLineEdit->text() )
1036 mMetadataFilled =
false;
1037 mRasterLayer->
setShortName( mLayerShortNameLineEdit->text() );
1039 if ( mRasterLayer->
title() != mLayerTitleLineEdit->text() )
1040 mMetadataFilled =
false;
1041 mRasterLayer->
setTitle( mLayerTitleLineEdit->text() );
1043 if ( mRasterLayer->
abstract() != mLayerAbstractTextEdit->toPlainText() )
1044 mMetadataFilled =
false;
1045 mRasterLayer->
setAbstract( mLayerAbstractTextEdit->toPlainText() );
1047 if ( mRasterLayer->
keywordList() != mLayerKeywordListLineEdit->text() )
1048 mMetadataFilled =
false;
1049 mRasterLayer->
setKeywordList( mLayerKeywordListLineEdit->text() );
1051 if ( mRasterLayer->
dataUrl() != mLayerDataUrlLineEdit->text() )
1052 mMetadataFilled =
false;
1053 mRasterLayer->
setDataUrl( mLayerDataUrlLineEdit->text() );
1055 if ( mRasterLayer->
dataUrlFormat() != mLayerDataUrlFormatComboBox->currentText() )
1056 mMetadataFilled =
false;
1057 mRasterLayer->
setDataUrlFormat( mLayerDataUrlFormatComboBox->currentText() );
1060 if ( mRasterLayer->
attribution() != mLayerAttributionLineEdit->text() )
1061 mMetadataFilled =
false;
1062 mRasterLayer->
setAttribution( mLayerAttributionLineEdit->text() );
1064 if ( mRasterLayer->
attributionUrl() != mLayerAttributionUrlLineEdit->text() )
1065 mMetadataFilled =
false;
1068 if ( mRasterLayer->
metadataUrl() != mLayerMetadataUrlLineEdit->text() )
1069 mMetadataFilled =
false;
1070 mRasterLayer->
setMetadataUrl( mLayerMetadataUrlLineEdit->text() );
1072 if ( mRasterLayer->
metadataUrlType() != mLayerMetadataUrlTypeComboBox->currentText() )
1073 mMetadataFilled =
false;
1076 if ( mRasterLayer->
metadataUrlFormat() != mLayerMetadataUrlFormatComboBox->currentText() )
1077 mMetadataFilled =
false;
1080 if ( mRasterLayer->
legendUrl() != mLayerLegendUrlLineEdit->text() )
1081 mMetadataFilled =
false;
1082 mRasterLayer->
setLegendUrl( mLayerLegendUrlLineEdit->text() );
1084 if ( mRasterLayer->
legendUrlFormat() != mLayerLegendUrlFormatComboBox->currentText() )
1085 mMetadataFilled =
false;
1088 if ( !mWMSPrintLayerLineEdit->text().isEmpty() )
1090 mRasterLayer->
setCustomProperty( QStringLiteral(
"WMSPrintLayer" ), mWMSPrintLayerLineEdit->text() );
1093 mRasterLayer->
setCustomProperty(
"WMSPublishDataSourceUrl", mPublishDataSourceUrlCheckBox->isChecked() );
1094 mRasterLayer->
setCustomProperty(
"WMSBackgroundLayer", mBackgroundLayerCheckBox->isChecked() );
1106 void QgsRasterLayerProperties::mLayerOrigNameLineEd_textEdited(
const QString &text )
1111 void QgsRasterLayerProperties::buttonBuildPyramids_clicked()
1123 for (
int myCounterInt = 0; myCounterInt < lbxPyramidResolutions->count(); myCounterInt++ )
1125 QListWidgetItem *myItem = lbxPyramidResolutions->item( myCounterInt );
1127 myPyramidList[myCounterInt].build = myItem->isSelected() || myPyramidList[myCounterInt].exists;
1131 QString prefix = provider->
name() +
"/driverOptions/_pyramids/";
1133 QString resamplingMethod( cboResamplingMethod->currentData().toString() );
1134 mySettings.
setValue( prefix +
"resampling", resamplingMethod );
1141 QApplication::setOverrideCursor( Qt::WaitCursor );
1148 QApplication::restoreOverrideCursor();
1149 mPyramidProgress->setValue( 0 );
1150 buttonBuildPyramids->setEnabled(
false );
1151 if ( !res.isNull() )
1153 if ( res == QLatin1String(
"CANCELED" ) )
1157 else if ( res == QLatin1String(
"ERROR_WRITE_ACCESS" ) )
1159 QMessageBox::warning(
this, tr(
"Building Pyramids" ),
1160 tr(
"Write access denied. Adjust the file permissions and try again." ) );
1162 else if ( res == QLatin1String(
"ERROR_WRITE_FORMAT" ) )
1164 QMessageBox::warning(
this, tr(
"Building Pyramids" ),
1165 tr(
"The file was not writable. Some formats do not " 1166 "support pyramid overviews. Consult the GDAL documentation if in doubt." ) );
1168 else if ( res == QLatin1String(
"FAILED_NOT_SUPPORTED" ) )
1170 QMessageBox::warning(
this, tr(
"Building Pyramids" ),
1171 tr(
"Building pyramid overviews is not supported on this type of raster." ) );
1173 else if ( res == QLatin1String(
"ERROR_JPEG_COMPRESSION" ) )
1175 QMessageBox::warning(
this, tr(
"Building Pyramids" ),
1176 tr(
"Building internal pyramid overviews is not supported on raster layers with JPEG compression and your current libtiff library." ) );
1178 else if ( res == QLatin1String(
"ERROR_VIRTUAL" ) )
1180 QMessageBox::warning(
this, tr(
"Building Pyramids" ),
1181 tr(
"Building pyramid overviews is not supported on this type of raster." ) );
1189 lbxPyramidResolutions->clear();
1195 QList< QgsRasterPyramid >::iterator myRasterPyramidIterator;
1196 for ( myRasterPyramidIterator = myPyramidList.begin();
1197 myRasterPyramidIterator != myPyramidList.end();
1198 ++myRasterPyramidIterator )
1200 if ( myRasterPyramidIterator->exists )
1202 lbxPyramidResolutions->addItem(
new QListWidgetItem( myPyramidPixmap,
1203 QString::number( myRasterPyramidIterator->xDim ) + QStringLiteral(
" x " ) +
1204 QString::number( myRasterPyramidIterator->yDim ) ) );
1208 lbxPyramidResolutions->addItem(
new QListWidgetItem( myNoPyramidPixmap,
1209 QString::number( myRasterPyramidIterator->xDim ) + QStringLiteral(
" x " ) +
1210 QString::number( myRasterPyramidIterator->yDim ) ) );
1219 updateInformationContent();
1222 void QgsRasterLayerProperties::urlClicked(
const QUrl &url )
1224 QFileInfo file( url.toLocalFile() );
1225 if ( file.exists() && !file.isDir() )
1228 QDesktopServices::openUrl( url );
1231 void QgsRasterLayerProperties::mRenderTypeComboBox_currentIndexChanged(
int index )
1233 if ( index < 0 || mDisableRenderTypeComboBoxCurrentIndexChanged || ! mRasterLayer->renderer() )
1238 QString rendererName = mRenderTypeComboBox->itemData( index ).toString();
1239 setRendererWidget( rendererName );
1242 void QgsRasterLayerProperties::pbnAddValuesFromDisplay_clicked()
1244 if ( mMapCanvas && mPixelSelectorTool )
1253 mMapCanvas->window()->raise();
1254 mMapCanvas->window()->activateWindow();
1255 mMapCanvas->window()->setFocus();
1256 mMapCanvas->
setMapTool( mPixelSelectorTool.get() );
1261 void QgsRasterLayerProperties::pbnAddValuesManually_clicked()
1269 tableTransparency->insertRow( tableTransparency->rowCount() );
1274 for (
int i = 0; i < n; i++ )
1276 setTransparencyCell( tableTransparency->rowCount() - 1, i, std::numeric_limits<double>::quiet_NaN() );
1279 setTransparencyCell( tableTransparency->rowCount() - 1, n, 100 );
1281 tableTransparency->resizeColumnsToContents();
1282 tableTransparency->resizeRowsToContents();
1288 mRasterLayer->
setCrs( crs );
1292 void QgsRasterLayerProperties::pbnDefaultValues_clicked()
1294 if ( !mRendererWidget )
1308 setupTransparencyTable( nBands );
1310 tableTransparency->resizeColumnsToContents();
1311 tableTransparency->resizeRowsToContents();
1314 void QgsRasterLayerProperties::setTransparencyCell(
int row,
int column,
double value )
1316 QgsDebugMsg( QStringLiteral(
"value = %1" ).arg( value, 0,
'g', 17 ) );
1318 if ( !provider )
return;
1321 if ( !renderer )
return;
1322 int nBands = renderer->
usesBands().size();
1324 QLineEdit *lineEdit =
new QLineEdit();
1325 lineEdit->setFrame(
false );
1327 lineEdit->setContentsMargins( 1, 1, 1, 1 );
1329 if ( column == tableTransparency->columnCount() - 1 )
1333 lineEdit->setValidator(
new QIntValidator(
nullptr ) );
1334 lineEdit->setText( QString::number( static_cast<int>( value ) ) );
1339 QString valueString;
1344 lineEdit->setValidator(
new QDoubleValidator(
nullptr ) );
1345 if ( !std::isnan( value ) )
1351 lineEdit->setValidator(
new QIntValidator(
nullptr ) );
1352 if ( !std::isnan( value ) )
1354 valueString = QString::number( static_cast<int>( value ) );
1358 lineEdit->setText( valueString );
1360 tableTransparency->setCellWidget( row, column, lineEdit );
1361 adjustTransparencyCellWidth( row, column );
1363 if ( nBands == 1 && ( column == 0 || column == 1 ) )
1365 connect( lineEdit, &QLineEdit::textEdited,
this, &QgsRasterLayerProperties::transparencyCellTextEdited );
1367 tableTransparency->resizeColumnsToContents();
1370 void QgsRasterLayerProperties::setTransparencyCellValue(
int row,
int column,
double value )
1372 QLineEdit *lineEdit =
dynamic_cast<QLineEdit *
>( tableTransparency->cellWidget( row, column ) );
1373 if ( !lineEdit )
return;
1375 lineEdit->adjustSize();
1376 adjustTransparencyCellWidth( row, column );
1377 tableTransparency->resizeColumnsToContents();
1380 double QgsRasterLayerProperties::transparencyCellValue(
int row,
int column )
1382 QLineEdit *lineEdit =
dynamic_cast<QLineEdit *
>( tableTransparency->cellWidget( row, column ) );
1383 if ( !lineEdit || lineEdit->text().isEmpty() )
1385 std::numeric_limits<double>::quiet_NaN();
1387 return lineEdit->text().toDouble();
1390 void QgsRasterLayerProperties::adjustTransparencyCellWidth(
int row,
int column )
1392 QLineEdit *lineEdit =
dynamic_cast<QLineEdit *
>( tableTransparency->cellWidget( row, column ) );
1393 if ( !lineEdit )
return;
1395 int width = std::max( lineEdit->fontMetrics().boundingRect( lineEdit->text() ).width() + 10, 100 );
1396 width = std::max( width, tableTransparency->columnWidth( column ) );
1398 lineEdit->setFixedWidth( width );
1401 void QgsRasterLayerProperties::pbnExportTransparentPixelValues_clicked()
1404 QString myLastDir = myQSettings.
value( QStringLiteral(
"lastRasterFileFilterDir" ), QDir::homePath() ).toString();
1405 QString myFileName = QFileDialog::getSaveFileName(
this, tr(
"Save File" ), myLastDir, tr(
"Textfile" ) +
" (*.txt)" );
1406 if ( !myFileName.isEmpty() )
1408 if ( !myFileName.endsWith( QLatin1String(
".txt" ), Qt::CaseInsensitive ) )
1410 myFileName = myFileName +
".txt";
1413 QFile myOutputFile( myFileName );
1414 if ( myOutputFile.open( QFile::WriteOnly | QIODevice::Truncate ) )
1416 QTextStream myOutputStream( &myOutputFile );
1417 myOutputStream <<
"# " << tr(
"QGIS Generated Transparent Pixel Value Export File" ) <<
'\n';
1418 if ( rasterIsMultiBandColor() )
1420 myOutputStream <<
"#\n#\n# " << tr(
"Red" ) <<
"\t" << tr(
"Green" ) <<
"\t" << tr(
"Blue" ) <<
"\t" << tr(
"Percent Transparent" );
1421 for (
int myTableRunner = 0; myTableRunner < tableTransparency->rowCount(); myTableRunner++ )
1423 myOutputStream <<
'\n' << QString::number( transparencyCellValue( myTableRunner, 0 ) ) <<
"\t" 1424 << QString::number( transparencyCellValue( myTableRunner, 1 ) ) <<
"\t" 1425 << QString::number( transparencyCellValue( myTableRunner, 2 ) ) <<
"\t" 1426 << QString::number( transparencyCellValue( myTableRunner, 3 ) );
1431 myOutputStream <<
"#\n#\n# " << tr(
"Value" ) <<
"\t" << tr(
"Percent Transparent" );
1433 for (
int myTableRunner = 0; myTableRunner < tableTransparency->rowCount(); myTableRunner++ )
1435 myOutputStream <<
'\n' << QString::number( transparencyCellValue( myTableRunner, 0 ) ) <<
"\t" 1436 << QString::number( transparencyCellValue( myTableRunner, 1 ) ) <<
"\t" 1437 << QString::number( transparencyCellValue( myTableRunner, 2 ) );
1443 QMessageBox::warning(
this, tr(
"Export Transparent Pixels" ), tr(
"Write access denied. Adjust the file permissions and try again.\n\n" ) );
1448 void QgsRasterLayerProperties::transparencyCellTextEdited(
const QString &text )
1451 QgsDebugMsg( QStringLiteral(
"text = %1" ).arg( text ) );
1457 int nBands = renderer->
usesBands().size();
1460 QLineEdit *lineEdit = qobject_cast<QLineEdit *>( sender() );
1461 if ( !lineEdit )
return;
1464 for (
int r = 0; r < tableTransparency->rowCount(); r++ )
1466 for (
int c = 0;
c < tableTransparency->columnCount();
c++ )
1468 if ( tableTransparency->cellWidget( r,
c ) == sender() )
1475 if ( row != -1 )
break;
1477 QgsDebugMsg( QStringLiteral(
"row = %1 column =%2" ).arg( row ).arg( column ) );
1481 QLineEdit *toLineEdit =
dynamic_cast<QLineEdit *
>( tableTransparency->cellWidget( row, 1 ) );
1482 if ( !toLineEdit )
return;
1483 bool toChanged = mTransparencyToEdited.value( row );
1484 QgsDebugMsg( QStringLiteral(
"toChanged = %1" ).arg( toChanged ) );
1487 toLineEdit->setText( lineEdit->text() );
1490 else if ( column == 1 )
1492 setTransparencyToEdited( row );
1497 void QgsRasterLayerProperties::aboutToShowStyleMenu()
1501 QMenu *m = qobject_cast<QMenu *>( sender() );
1506 bool gotFirstSeparator =
false;
1507 QList<QAction *> actions = m->actions();
1508 for (
int i = 0; i < actions.count(); ++i )
1510 if ( actions[i]->isSeparator() )
1512 if ( gotFirstSeparator )
1515 while ( actions.count() != i )
1516 delete actions.takeAt( i );
1520 gotFirstSeparator =
true;
1529 void QgsRasterLayerProperties::syncToLayer()
1534 setRendererWidget( renderer->
type() );
1540 void QgsRasterLayerProperties::setTransparencyToEdited(
int row )
1542 if ( row >= mTransparencyToEdited.size() )
1544 mTransparencyToEdited.resize( row + 1 );
1546 mTransparencyToEdited[row] =
true;
1553 bool isMetadataPanel = ( index ==
mOptStackedWidget->indexOf( mOptsPage_Metadata ) );
1554 mBtnStyle->setVisible( ! isMetadataPanel );
1555 mBtnMetadata->setVisible( isMetadataPanel );
1557 if ( !mHistogramWidget )
1569 if ( index ==
mOptStackedWidget->indexOf( mOptsPage_Information ) || !mMetadataFilled )
1572 updateInformationContent();
1576 void QgsRasterLayerProperties::pbnImportTransparentPixelValues_clicked()
1578 int myLineCounter = 0;
1579 bool myImportError =
false;
1582 QString myLastDir = myQSettings.
value( QStringLiteral(
"lastRasterFileFilterDir" ), QDir::homePath() ).toString();
1583 QString myFileName = QFileDialog::getOpenFileName(
this, tr(
"Open file" ), myLastDir, tr(
"Textfile" ) +
" (*.txt)" );
1584 QFile myInputFile( myFileName );
1585 if ( myInputFile.open( QFile::ReadOnly ) )
1587 QTextStream myInputStream( &myInputFile );
1588 QString myInputLine;
1589 if ( rasterIsMultiBandColor() )
1591 for (
int myTableRunner = tableTransparency->rowCount() - 1; myTableRunner >= 0; myTableRunner-- )
1593 tableTransparency->removeRow( myTableRunner );
1596 while ( !myInputStream.atEnd() )
1599 myInputLine = myInputStream.readLine();
1600 if ( !myInputLine.isEmpty() )
1602 if ( !myInputLine.simplified().startsWith(
'#' ) )
1604 QStringList myTokens = myInputLine.split( QRegExp(
"\\s+" ), QString::SkipEmptyParts );
1605 if ( myTokens.count() != 4 )
1607 myImportError =
true;
1608 myBadLines = myBadLines + QString::number( myLineCounter ) +
":\t[" + myInputLine +
"]\n";
1612 tableTransparency->insertRow( tableTransparency->rowCount() );
1613 for (
int col = 0; col < 4; col++ )
1615 setTransparencyCell( tableTransparency->rowCount() - 1, col, myTokens[col].toDouble() );
1624 for (
int myTableRunner = tableTransparency->rowCount() - 1; myTableRunner >= 0; myTableRunner-- )
1626 tableTransparency->removeRow( myTableRunner );
1629 while ( !myInputStream.atEnd() )
1632 myInputLine = myInputStream.readLine();
1633 if ( !myInputLine.isEmpty() )
1635 if ( !myInputLine.simplified().startsWith(
'#' ) )
1637 QStringList myTokens = myInputLine.split( QRegExp(
"\\s+" ), QString::SkipEmptyParts );
1638 if ( myTokens.count() != 3 && myTokens.count() != 2 )
1640 myImportError =
true;
1641 myBadLines = myBadLines + QString::number( myLineCounter ) +
":\t[" + myInputLine +
"]\n";
1645 if ( myTokens.count() == 2 )
1647 myTokens.insert( 1, myTokens[0] );
1649 tableTransparency->insertRow( tableTransparency->rowCount() );
1650 for (
int col = 0; col < 3; col++ )
1652 setTransparencyCell( tableTransparency->rowCount() - 1, col, myTokens[col].toDouble() );
1660 if ( myImportError )
1662 QMessageBox::warning(
this, tr(
"Import Transparent Pixels" ), tr(
"The following lines contained errors\n\n%1" ).arg( myBadLines ) );
1665 else if ( !myFileName.isEmpty() )
1667 QMessageBox::warning(
this, tr(
"Import Transparent Pixels" ), tr(
"Read access denied. Adjust the file permissions and try again.\n\n" ) );
1669 tableTransparency->resizeColumnsToContents();
1670 tableTransparency->resizeRowsToContents();
1673 void QgsRasterLayerProperties::pbnRemoveSelectedRow_clicked()
1675 if ( 0 < tableTransparency->rowCount() )
1677 tableTransparency->removeRow( tableTransparency->currentRow() );
1681 void QgsRasterLayerProperties::pixelSelected(
const QgsPointXY &canvasPoint,
const Qt::MouseButton &btn )
1691 if ( mMapCanvas && mPixelSelectorTool )
1700 int myWidth = mMapCanvas->
extent().
width() / mapUnitsPerPixel;
1701 int myHeight = mMapCanvas->
extent().
height() / mapUnitsPerPixel;
1705 QList<int> bands = renderer->
usesBands();
1707 QList<double> values;
1708 for (
int i = 0; i < bands.size(); ++i )
1710 int bandNo = bands.value( i );
1711 if ( myPixelMap.count( bandNo ) == 1 )
1713 if ( myPixelMap.value( bandNo ).isNull() )
1717 double value = myPixelMap.value( bandNo ).toDouble();
1718 QgsDebugMsg( QStringLiteral(
"value = %1" ).arg( value, 0,
'g', 17 ) );
1719 values.append( value );
1722 if ( bands.size() == 1 )
1725 values.insert( 1, values.value( 0 ) );
1727 tableTransparency->insertRow( tableTransparency->rowCount() );
1728 for (
int i = 0; i < values.size(); i++ )
1730 setTransparencyCell( tableTransparency->rowCount() - 1, i, values.value( i ) );
1732 setTransparencyCell( tableTransparency->rowCount() - 1, tableTransparency->columnCount() - 1, 100 );
1736 tableTransparency->resizeColumnsToContents();
1737 tableTransparency->resizeRowsToContents();
1740 void QgsRasterLayerProperties::toggleSaturationControls(
int grayscaleMode )
1743 if ( grayscaleMode == 0 )
1745 sliderSaturation->setEnabled(
true );
1746 spinBoxSaturation->setEnabled(
true );
1750 sliderSaturation->setEnabled(
false );
1751 spinBoxSaturation->setEnabled(
false );
1755 void QgsRasterLayerProperties::toggleColorizeControls(
bool colorizeEnabled )
1758 btnColorizeColor->setEnabled( colorizeEnabled );
1759 sliderColorizeStrength->setEnabled( colorizeEnabled );
1760 spinColorizeStrength->setEnabled( colorizeEnabled );
1764 QLinearGradient QgsRasterLayerProperties::redGradient()
1768 QLinearGradient myGradient = QLinearGradient( mGradientWidth, 0, mGradientWidth, mGradientHeight );
1769 myGradient.setColorAt( 0.0, QColor( 242, 14, 25, 190 ) );
1770 myGradient.setColorAt( 0.5, QColor( 175, 29, 37, 190 ) );
1771 myGradient.setColorAt( 1.0, QColor( 114, 17, 22, 190 ) );
1774 QLinearGradient QgsRasterLayerProperties::greenGradient()
1778 QLinearGradient myGradient = QLinearGradient( mGradientWidth, 0, mGradientWidth, mGradientHeight );
1779 myGradient.setColorAt( 0.0, QColor( 48, 168, 5, 190 ) );
1780 myGradient.setColorAt( 0.8, QColor( 36, 122, 4, 190 ) );
1781 myGradient.setColorAt( 1.0, QColor( 21, 71, 2, 190 ) );
1784 QLinearGradient QgsRasterLayerProperties::blueGradient()
1788 QLinearGradient myGradient = QLinearGradient( mGradientWidth, 0, mGradientWidth, mGradientHeight );
1789 myGradient.setColorAt( 0.0, QColor( 30, 0, 106, 190 ) );
1790 myGradient.setColorAt( 0.2, QColor( 30, 72, 128, 190 ) );
1791 myGradient.setColorAt( 1.0, QColor( 30, 223, 196, 190 ) );
1794 QLinearGradient QgsRasterLayerProperties::grayGradient()
1798 QLinearGradient myGradient = QLinearGradient( mGradientWidth, 0, mGradientWidth, mGradientHeight );
1799 myGradient.setColorAt( 0.0, QColor( 5, 5, 5, 190 ) );
1800 myGradient.setColorAt( 0.8, QColor( 122, 122, 122, 190 ) );
1801 myGradient.setColorAt( 1.0, QColor( 220, 220, 220, 190 ) );
1804 QLinearGradient QgsRasterLayerProperties::highlightGradient()
1808 QLinearGradient myGradient = QLinearGradient( mGradientWidth, 0, mGradientWidth, mGradientHeight );
1809 myGradient.setColorAt( 1.0, QColor( 255, 255, 255, 50 ) );
1810 myGradient.setColorAt( 0.5, QColor( 255, 255, 255, 100 ) );
1811 myGradient.setColorAt( 0.0, QColor( 255, 255, 255, 150 ) );
1822 void QgsRasterLayerProperties::loadDefaultStyle_clicked()
1824 bool defaultLoadedFlag =
false;
1827 if ( defaultLoadedFlag )
1834 QMessageBox::information(
this,
1835 tr(
"Default Style" ),
1841 void QgsRasterLayerProperties::saveDefaultStyle_clicked()
1847 bool defaultSavedFlag =
false;
1851 if ( !defaultSavedFlag )
1854 QMessageBox::information(
this,
1855 tr(
"Default Style" ),
1862 void QgsRasterLayerProperties::loadStyle_clicked()
1865 QString lastUsedDir = settings.
value( QStringLiteral(
"style/lastStyleDir" ), QDir::homePath() ).toString();
1867 QString fileName = QFileDialog::getOpenFileName(
1869 tr(
"Load layer properties from style file" ),
1871 tr(
"QGIS Layer Style File" ) +
" (*.qml)" );
1872 if ( fileName.isEmpty() )
1876 if ( !fileName.endsWith( QLatin1String(
".qml" ), Qt::CaseInsensitive ) )
1877 fileName += QLatin1String(
".qml" );
1881 bool defaultLoadedFlag =
false;
1882 QString message = mRasterLayer->
loadNamedStyle( fileName, defaultLoadedFlag );
1883 if ( defaultLoadedFlag )
1885 settings.
setValue( QStringLiteral(
"style/lastStyleDir" ), QFileInfo( fileName ).absolutePath() );
1890 QMessageBox::information(
this, tr(
"Save Style" ), message );
1895 void QgsRasterLayerProperties::saveStyleAs_clicked()
1898 QString lastUsedDir = settings.
value( QStringLiteral(
"style/lastStyleDir" ), QDir::homePath() ).toString();
1900 QString outputFileName = QFileDialog::getSaveFileName(
1902 tr(
"Save layer properties as style file" ),
1904 tr(
"QGIS Layer Style File" ) +
" (*.qml)" +
";;" + tr(
"Styled Layer Descriptor" ) +
" (*.sld)" );
1905 if ( outputFileName.isEmpty() )
1910 if ( outputFileName.endsWith( QLatin1String(
".sld" ), Qt::CaseInsensitive ) )
1911 type = StyleType::SLD;
1919 bool defaultLoadedFlag =
false;
1925 message = mRasterLayer->
saveNamedStyle( outputFileName, defaultLoadedFlag );
1930 message = mRasterLayer->
saveSldStyle( outputFileName, defaultLoadedFlag );
1934 if ( defaultLoadedFlag )
1936 settings.
setValue( QStringLiteral(
"style/lastStyleDir" ), QFileInfo( outputFileName ).absolutePath() );
1940 QMessageBox::information(
this, tr(
"Save Style" ), message );
1943 void QgsRasterLayerProperties::restoreWindowModality()
1958 void QgsRasterLayerProperties::loadMetadata()
1961 QString myLastUsedDir = myQSettings.
value( QStringLiteral(
"style/lastStyleDir" ), QDir::homePath() ).toString();
1963 QString myFileName = QFileDialog::getOpenFileName(
this, tr(
"Load layer metadata from metadata file" ), myLastUsedDir,
1964 tr(
"QGIS Layer Metadata File" ) +
" (*.qmd)" );
1965 if ( myFileName.isNull() )
1971 bool defaultLoadedFlag =
false;
1975 if ( defaultLoadedFlag )
1982 QMessageBox::warning(
this, tr(
"Load Metadata" ), myMessage );
1985 QFileInfo myFI( myFileName );
1986 QString myPath = myFI.path();
1987 myQSettings.
setValue( QStringLiteral(
"style/lastStyleDir" ), myPath );
1992 void QgsRasterLayerProperties::saveMetadataAs()
1995 QString myLastUsedDir = myQSettings.
value( QStringLiteral(
"style/lastStyleDir" ), QDir::homePath() ).toString();
1997 QString myOutputFileName = QFileDialog::getSaveFileName(
this, tr(
"Save Layer Metadata as QMD" ),
1998 myLastUsedDir, tr(
"QMD File" ) +
" (*.qmd)" );
1999 if ( myOutputFileName.isNull() )
2012 bool defaultLoadedFlag =
false;
2013 QString message = mRasterLayer->
saveNamedMetadata( myOutputFileName, defaultLoadedFlag );
2014 if ( defaultLoadedFlag )
2015 myQSettings.
setValue( QStringLiteral(
"style/lastStyleDir" ), QFileInfo( myOutputFileName ).absolutePath() );
2017 QMessageBox::information(
this, tr(
"Save Metadata" ), message );
2020 void QgsRasterLayerProperties::saveDefaultMetadata()
2024 bool defaultSavedFlag =
false;
2026 if ( !defaultSavedFlag )
2028 QMessageBox::warning(
this, tr(
"Default Metadata" ), errorMsg );
2032 void QgsRasterLayerProperties::loadDefaultMetadata()
2034 bool defaultLoadedFlag =
false;
2037 if ( defaultLoadedFlag )
2043 QMessageBox::information(
this, tr(
"Default Metadata" ), myMessage );
2048 void QgsRasterLayerProperties::toggleBuildPyramidsButton()
2050 if ( lbxPyramidResolutions->selectedItems().empty() )
2052 buttonBuildPyramids->setEnabled(
false );
2056 buttonBuildPyramids->setEnabled(
true );
2060 void QgsRasterLayerProperties::mResetColorRenderingBtn_clicked()
2062 mBlendModeComboBox->setBlendMode( QPainter::CompositionMode_SourceOver );
2063 mSliderBrightness->setValue( 0 );
2064 mSliderContrast->setValue( 0 );
2065 sliderSaturation->setValue( 0 );
2067 mColorizeCheck->setChecked(
false );
2068 sliderColorizeStrength->setValue( 100 );
2071 bool QgsRasterLayerProperties::rasterIsMultiBandColor()
2076 void QgsRasterLayerProperties::updateInformationContent()
2080 const QString html { mRasterLayer->
htmlMetadata().replace( QStringLiteral(
"<head>" ), QStringLiteral( R
"raw(<head><style type="text/css">%1</style>)raw" ) ).arg( myStyle ) }; 2081 mMetadataViewer->setHtml( html ); 2082 mMetadataFilled = true;
2085 void QgsRasterLayerProperties::onCancel()
2091 QDomDocument doc( QStringLiteral(
"qgis" ) );
2092 int errorLine, errorColumn;
2093 doc.setContent( mOldStyle.
xmlData(),
false, &myMessage, &errorLine, &errorColumn );
2099 void QgsRasterLayerProperties::showHelp()
2101 QgsHelp::openHelp( QStringLiteral(
"working_with_raster/raster_properties.html" ) );
void unsetMapTool(QgsMapTool *mapTool)
Unset the current map tool or last non zoom tool.
QString attributionUrl() const
Returns the attribution URL of the layer used by QGIS Server in GetCapabilities request.
void setDirty(bool b=true)
Flag the project as dirty (modified).
virtual int bandCount() const =0
Gets number of bands.
void setMetadataUrl(const QString &metaUrl)
Sets the metadata 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.
A rectangle specified with double values.
Base class for all map layer types.
static QString formatLayerName(const QString &name)
A convenience function to capitalize and format a layer name.
static QgsMapLayerStyleGuiUtils * instance()
returns a singleton instance of this class
void currentStyleChanged(const QString ¤tName)
Emitted when the current style has been changed.
void setShortName(const QString &shortName)
Sets the short name of the layer used by QGIS Server to identify the layer.
static QString printValue(double value)
Print double value with all necessary significant digits.
virtual void setUseSourceNoDataValue(int bandNo, bool use)
Sets the source nodata value usage.
void setMaxOversampling(double os)
void setTransparentThreeValuePixelList(const QList< QgsRasterTransparency::TransparentThreeValuePixel > &newList)
Sets the transparent three value pixel list, replacing the whole existing list.
QString htmlMetadata() const override
Obtain a formatted HTML string containing assorted metadata for this layer.
virtual QString saveNamedStyle(const QString &uri, bool &resultFlag, StyleCategories categories=AllStyleCategories)
Save the properties of this layer as a named style (either as a .qml file on disk or as a record in t...
Interface for resampling rasters (e.g.
virtual bool importNamedStyle(QDomDocument &doc, QString &errorMsg, QgsMapLayer::StyleCategories categories=QgsMapLayer::AllStyleCategories)
Import the properties of this layer from a QDomDocument.
This class is a composition of two QSettings instances:
QgsHueSaturationFilter * hueSaturationFilter() const
Returns the raster's hue/saturation filter.
QColor nodataColor() const
Returns the color to use for shading nodata pixels.
QString shortName() const
Returns the short name of the layer used by QGIS Server to identify the layer.
static QString ensureFileNameHasExtension(const QString &fileName, const QStringList &extensions)
Ensures that a fileName ends with an extension from the provided list of extensions.
QString xmlData() const
Returns XML content of the style.
static QgsNative * nativePlatformInterface()
Returns the global native interface, which offers abstraction to the host OS's underlying public inte...
virtual QList< int > usesBands() const
Returns a list of band numbers used by the renderer.
double opacity() const
Returns the opacity for the renderer, where opacity is a value between 0 (totally transparent) and 1...
QgsRasterRendererWidgetCreateFunc widgetCreateFunction
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.
void setColorizeColor(const QColor &colorizeColor)
void setRenderer(QgsRasterRenderer *renderer)
Sets the raster's renderer.
Represents a raster layer.
QString dataUrl() const
Returns the DataUrl of the layer used by QGIS Server in GetCapabilities request.
A class to represent a 2D point.
QString abstract() const
Returns the abstract of the layer used by QGIS Server in GetCapabilities request. ...
QgsRectangle outputExtentToLayerExtent(const QgsMapLayer *layer, QgsRectangle extent) const
transform bounding box from output CRS to layer's CRS
void initOptionsBase(bool restoreUi=true, const QString &title=QString())
Set up the base ui connections for vertical tabs.
Q_INVOKABLE void setCustomProperty(const QString &key, const QVariant &value)
Set a custom property for layer.
virtual QString type() const
int colorizeStrength() const
virtual QString saveSldStyle(const QString &uri, bool &resultFlag) const
Saves the properties of this layer to an SLD format file.
static QString reportStyleSheet(QgsApplication::StyleSheetType styleSheetType=QgsApplication::StyleSheetType::Qt)
Returns a css style sheet for reports, the styleSheetType argument determines what type of stylesheet...
void restoreOptionsBaseUi(const QString &title=QString())
Restore the base ui.
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...
static QIcon getThemeIcon(const QString &name)
Helper to get a theme icon.
void setMetadataUrlType(const QString &metaUrlType)
Set the metadata type of the layer used by QGIS Server in GetCapabilities request MetadataUrlType ind...
Raster values range container.
QgsLayerMetadata metadata
Resample filter pipe for rasters.
QgsRasterRenderer * renderer() const
Returns the raster's renderer.
Thirty two bit floating point (float)
StyleType
enumeration for the different types of style
QString saveNamedMetadata(const QString &uri, bool &resultFlag)
Save the current metadata of this layer as a named metadata (either as a .qmd file on disk or as a re...
const QgsCoordinateReferenceSystem & crs
static QgsGui * instance()
Returns a pointer to the singleton instance.
bool isValid() const
Returns the status of the layer.
virtual QString buildPyramids(const QList< QgsRasterPyramid > &pyramidList, const QString &resamplingMethod="NEAREST", QgsRaster::RasterPyramidsFormat format=QgsRaster::PyramidsGTiff, const QStringList &configOptions=QStringList(), QgsRasterBlockFeedback *feedback=nullptr)
Create pyramid overviews.
void setBlendMode(QPainter::CompositionMode blendMode)
Set the blending mode used for rendering a layer.
QgsRasterLayerProperties(QgsMapLayer *lyr, QgsMapCanvas *canvas, QWidget *parent=nullptr, Qt::WindowFlags=QgsGuiUtils::ModalDialogFlags)
Constructor.
QPixmap paletteAsPixmap(int bandNumber=1)
Returns a 100x100 pixmap of the color palette.
virtual double sourceNoDataValue(int bandNo) const
Value representing no data value.
Map canvas is a class for displaying all GIS data types on a canvas.
const QgsRasterTransparency * rasterTransparency() const
virtual QString name() const =0
Returns a provider name.
Sixty four bit floating point (double)
QgsBrightnessContrastFilter * brightnessFilter() const
Returns the raster's brightness/contrast filter.
The QgsMapSettings class contains configuration for rendering of the map.
void setMaximumScale(double scale)
Sets the maximum map scale (i.e.
QgsMapLayerStyleManager * styleManager() const
Gets access to the layer's style manager.
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
Color, alpha, red, green, blue, 4 bytes the same as QImage::Format_ARGB32_Premultiplied.
QgsRasterDataProvider * dataProvider() override
Returns the source data provider.
void setLegendUrlFormat(const QString &legendUrlFormat)
Sets the format for a URL based layer legend.
QString metadataUrlFormat() const
Returns the metadata format of the layer used by QGIS Server in GetCapabilities request.
void setBrightness(int brightness)
void setMapTool(QgsMapTool *mapTool, bool clean=false)
Sets the map tool currently being used on the canvas.
void setKeywordList(const QString &keywords)
Sets the keyword list of the layer used by QGIS Server in GetCapabilities request.
double mapUnitsPerPixel() const
Returns the mapUnitsPerPixel (map units per pixel) for the canvas.
void setContrast(int contrast)
void progressChanged(double progress)
Emitted when the feedback object reports a progress change.
void setTitle(const QString &title)
Sets the title of the layer used by QGIS Server in GetCapabilities request.
void triggerRepaint(bool deferredUpdate=false)
Will advise the map canvas (and any other interested party) that this layer requires to be repainted...
virtual QString type() const =0
Gets a descriptive type identifier for this raster resampler.
virtual QList< QgsRasterPyramid > buildPyramidList(QList< int > overviewList=QList< int >())
Returns the raster layers pyramid list.
void setCrs(const QgsCoordinateReferenceSystem &srs, bool emitSignal=true)
Sets layer's spatial reference system.
virtual int capabilities() const
Returns a bitmask containing the supported capabilities.
double percentTransparent
QString providerType() const
[ data provider interface ] Which provider is being used for this Raster Layer?
double width() const
Returns the width of the rectangle.
QString keywordList() const
Returns the keyword list of the layer used by QGIS Server in GetCapabilities request.
QgsRectangle extent() const
Returns the current zoom extent of the map canvas.
virtual QString saveDefaultMetadata(bool &resultFlag)
Save the current metadata of this layer as the default metadata (either as a .qmd file on disk or as ...
QString legendUrl() const
Returns the URL for the layer's legend.
double maxOversampling() const
LayerType rasterType()
Returns the raster layer type (which is a read only property).
A base dialog for options and properties dialogs that offers vertical tabs.
QgsMapLayerStyle style(const QString &name) const
Returns data of a stored style - accessed by its unique name.
static QString extensionPropertyType(PropertyType type)
Returns the extension of a Property.
QString userFriendlyIdentifier(IdentifierType type=MediumString) const
Returns a user friendly identifier for the CRS.
double minimumScale() const
Returns the minimum map scale (i.e.
void setAlphaBand(int band)
double maximumScale() const
Returns the maximum map scale (i.e.
void setColorizeOn(bool colorizeOn)
void setName(const QString &name)
Set the display name of the layer.
void setDataUrlFormat(const QString &dataUrlFormat)
Sets the DataUrl format of the layer used by QGIS Server in GetCapabilities request.
QString legendUrlFormat() const
Returns the format for a URL based layer legend.
void setLegendUrl(const QString &legendUrl)
Sets the URL for the layer's legend.
virtual bool sourceHasNoDataValue(int bandNo) const
Returns true if source band has no data value.
void setMetadataUrlFormat(const QString &metaUrlFormat)
Sets the metadata format of the layer used by QGIS Server in GetCapabilities request.
QString title() const
Returns the title of the layer used by QGIS Server in GetCapabilities request.
Full WKT2 string, conforming to ISO 19162:2018 / OGC 18-010, with all possible nodes and new keyword ...
QList< QgsRasterTransparency::TransparentSingleValuePixel > transparentSingleValuePixelList() const
Returns the transparent single value pixel list.
QMap< int, QVariant > results() const
Returns the identify results.
QStringList renderersList() const
void setTransparentSingleValuePixelList(const QList< QgsRasterTransparency::TransparentSingleValuePixel > &newList)
Sets the transparent single value pixel list, replacing the whole existing list.
bool isDefault(const QString &styleName) const
Returns true if this is the default style.
static QList< QPair< QString, QString > > pyramidResamplingMethods(const QString &providerKey)
Returns a list of pyramid resampling method name and label pairs for given provider.
void setScaleBasedVisibility(bool enabled)
Sets whether scale based visibility is enabled for the layer.
const QgsMapSettings & mapSettings() const
Gets access to properties used for map rendering.
Registry for raster renderer entries.
QString currentStyle() const
Returns name of the current style.
static QRegExp shortNameRegExp()
Returns the short name regular expression for line edit validator.
QImage previewAsImage(QSize size, const QColor &bgColor=Qt::white, QImage::Format format=QImage::Format_ARGB32_Premultiplied)
Draws a preview of the rasterlayer into a QImage.
void setNodataColor(const QColor &color)
Sets the color to use for shading nodata pixels.
virtual QString loadDefaultStyle(bool &resultFlag)
Retrieve the default style for this layer if one exists (either as a .qml file on disk or as a record...
virtual QString saveDefaultStyle(bool &resultFlag)
Save the properties of this layer as the default style (either as a .qml file on disk or as a record ...
QgsHueSaturationFilter::GrayscaleMode grayscaleMode() const
QgsSignalBlocker< Object > whileBlocking(Object *object)
Temporarily blocks signals from a QObject while calling a single method from the object.
static QgsMapLayerLegend * defaultRasterLegend(QgsRasterLayer *rl)
Create new legend implementation for raster layer.
void setZoomedInResampler(QgsRasterResampler *r)
Sets resampler for zoomed in scales. Takes ownership of the object.
QgsRasterResampleFilter * resampleFilter() const
Returns the raster's resample filter.
QList< QgsRasterRange > QgsRasterRangeList
void setValue(const QString &key, const QVariant &value, QgsSettings::Section section=QgsSettings::NoSection)
Sets the value of setting key to value.
bool hasScaleBasedVisibility() const
Returns whether scale based visibility is enabled for the layer.
void setMinimumScale(double scale)
Sets the minimum map scale (i.e.
static QgsProject * instance()
Returns the QgsProject singleton instance.
virtual QString loadNamedStyle(const QString &uri, bool &resultFlag, QgsMapLayer::StyleCategories categories=QgsMapLayer::AllStyleCategories)
Retrieve a named style for this layer if one exists (either as a .qml file on disk or as a record in ...
Brightness/contrast filter pipe for rasters.
Bilinear Raster Resampler.
const QgsRasterResampler * zoomedOutResampler() const
This class represents a coordinate reference system (CRS).
Color and saturation filter pipe for rasters.
virtual QgsRasterIdentifyResult identify(const QgsPointXY &point, QgsRaster::IdentifyFormat format, const QgsRectangle &boundingBox=QgsRectangle(), int width=0, int height=0, int dpi=96)
Identify raster value(s) found on the point position.
static void openHelp(const QString &key)
Opens help topic for the given help key using default system web browser.
void setZoomedOutResampler(QgsRasterResampler *r)
Sets resampler for zoomed out scales. Takes ownership of the object.
void optionsStackedWidget_CurrentChanged(int index) override
auto slot executed when the active page in the main widget stack is changed
void setAutoRefreshInterval(int interval)
Sets the auto refresh interval (in milliseconds) for the layer.
QColor colorizeColor() const
Renderer for multiband images with the color components.
void setAttributionUrl(const QString &attribUrl)
Sets the attribution URL of the layer used by QGIS Server in GetCapabilities request.
virtual QgsRasterRangeList userNoDataValues(int bandNo) const
Returns a list of user no data value ranges.
QStackedWidget * mOptStackedWidget
QString metadataUrl() const
Returns the metadata URL of the layer used by QGIS Server in GetCapabilities request.
void setAutoRefreshEnabled(bool enabled)
Sets whether auto refresh is enabled for the layer.
Defines the list of pixel values to be considered as transparent or semi transparent when rendering r...
void setColorizeStrength(int colorizeStrength)
void setOpacity(double opacity)
Sets the opacity for the renderer, where opacity is a value between 0 (totally transparent) and 1...
Q_INVOKABLE QVariant customProperty(const QString &value, const QVariant &defaultValue=QVariant()) const
Read a custom property from layer.
virtual bool useSourceNoDataValue(int bandNo) const
Returns the source nodata value usage.
void setAttribution(const QString &attrib)
Sets the attribution of the layer used by QGIS Server in GetCapabilities request. ...
virtual QString loadNamedMetadata(const QString &uri, bool &resultFlag)
Retrieve a named metadata for this layer if one exists (either as a .qmd file on disk or as a record ...
bool hasAutoRefreshEnabled() const
Returns true if auto refresh is enabled for the layer.
bool contains(const QString &key, QgsSettings::Section section=QgsSettings::NoSection) const
Returns true if there exists a setting called key; returns false otherwise.
QList< QgsRasterTransparency::TransparentThreeValuePixel > transparentThreeValuePixelList() const
Returns the transparent three value pixel list.
void setLegend(QgsMapLayerLegend *legend)
Assign a legend controller to the map layer.
void addStyleManagerActions(QMenu *m, QgsMapLayer *layer)
adds actions to the menu in accordance to the layer
virtual void setUserNoDataValue(int bandNo, const QgsRasterRangeList &noData)
QgsPointXY mapToLayerCoordinates(const QgsMapLayer *layer, QgsPointXY point) const
transform point coordinates from output CRS to layer's CRS
void setRasterTransparency(QgsRasterTransparency *t)
Feedback object tailored for raster block reading.
double percentTransparent
virtual void optionsStackedWidget_CurrentChanged(int index)
Select relevant tab on current page change.
void setDataUrl(const QString &dataUrl)
Sets the DataUrl of the layer used by QGIS Server in GetCapabilities request.
void insertWidgetFunction(const QString &rendererName, QgsRasterRendererWidgetCreateFunc func)
static QgsRasterRendererRegistry * rasterRendererRegistry()
Returns the application's raster renderer registry, used for managing raster layer renderers...
Raster renderer pipe that applies colors to a raster.
void setAbstract(const QString &abstract)
Sets the abstract of the layer used by QGIS Server in GetCapabilities request.
Qgis::DataType dataType(int bandNo) const override=0
Returns data type for the band specified by number.
QgsCoordinateReferenceSystem crs
QString attribution() const
Returns the attribution of the layer used by QGIS Server in GetCapabilities request.
Color, alpha, red, green, blue, 4 bytes the same as QImage::Format_ARGB32.
QString toWkt(WktVariant variant=WKT1_GDAL, bool multiline=false, int indentationWidth=4) const
Returns a WKT representation of this CRS.
QString metadataUrlType() const
Returns the metadata type of the layer used by QGIS Server in GetCapabilities request.
QPainter::CompositionMode blendMode() const
Returns the current blending mode for a layer.
double height() const
Returns the height of the rectangle.
void setGrayscaleMode(QgsHueSaturationFilter::GrayscaleMode grayscaleMode)
void setSaturation(int saturation)
const QgsRasterResampler * zoomedInResampler() const
Base class for raster data providers.
virtual QString metadataUri() const
Retrieve the metadata URI for this layer (either as a .qmd file on disk or as a record in the users s...