29 #include "cpl_string.h" 34 #include <QFileDialog> 35 #include <QMessageBox> 40 QWidget *parent, Qt::WindowFlags f )
41 : QDialog( parent, f )
42 , mRasterLayer( rasterLayer )
43 , mDataProvider( sourceProvider )
44 , mCurrentExtent( currentExtent )
45 , mLayerCrs( layerCrs )
46 , mCurrentCrs( currentCrs )
47 , mResolutionState( OriginalResolution )
50 connect( mRawModeRadioButton, &QRadioButton::toggled,
this, &QgsRasterLayerSaveAsDialog::mRawModeRadioButton_toggled );
51 connect( mFormatComboBox,
static_cast<void ( QComboBox::* )(
const QString & )
>( &QComboBox::currentIndexChanged ),
this, &QgsRasterLayerSaveAsDialog::mFormatComboBox_currentIndexChanged );
52 connect( mResolutionRadioButton, &QRadioButton::toggled,
this, &QgsRasterLayerSaveAsDialog::mResolutionRadioButton_toggled );
53 connect( mOriginalResolutionPushButton, &QPushButton::clicked,
this, &QgsRasterLayerSaveAsDialog::mOriginalResolutionPushButton_clicked );
54 connect( mXResolutionLineEdit, &QLineEdit::textEdited,
this, &QgsRasterLayerSaveAsDialog::mXResolutionLineEdit_textEdited );
55 connect( mYResolutionLineEdit, &QLineEdit::textEdited,
this, &QgsRasterLayerSaveAsDialog::mYResolutionLineEdit_textEdited );
56 connect( mOriginalSizePushButton, &QPushButton::clicked,
this, &QgsRasterLayerSaveAsDialog::mOriginalSizePushButton_clicked );
57 connect( mColumnsLineEdit, &QLineEdit::textEdited,
this, &QgsRasterLayerSaveAsDialog::mColumnsLineEdit_textEdited );
58 connect( mRowsLineEdit, &QLineEdit::textEdited,
this, &QgsRasterLayerSaveAsDialog::mRowsLineEdit_textEdited );
59 connect( mAddNoDataManuallyToolButton, &QPushButton::clicked,
this, &QgsRasterLayerSaveAsDialog::mAddNoDataManuallyToolButton_clicked );
60 connect( mLoadTransparentNoDataToolButton, &QPushButton::clicked,
this, &QgsRasterLayerSaveAsDialog::mLoadTransparentNoDataToolButton_clicked );
61 connect( mRemoveSelectedNoDataToolButton, &QPushButton::clicked,
this, &QgsRasterLayerSaveAsDialog::mRemoveSelectedNoDataToolButton_clicked );
62 connect( mRemoveAllNoDataToolButton, &QPushButton::clicked,
this, &QgsRasterLayerSaveAsDialog::mRemoveAllNoDataToolButton_clicked );
63 connect( mTileModeCheckBox, &QCheckBox::toggled,
this, &QgsRasterLayerSaveAsDialog::mTileModeCheckBox_toggled );
64 connect( mPyramidsGroupBox, &QgsCollapsibleGroupBox::toggled,
this, &QgsRasterLayerSaveAsDialog::mPyramidsGroupBox_toggled );
70 mNoDataTableWidget->setColumnCount( 2 );
71 mNoDataTableWidget->setHorizontalHeaderItem( 0,
new QTableWidgetItem( tr(
"From" ) ) );
72 mNoDataTableWidget->setHorizontalHeaderItem( 1,
new QTableWidgetItem( tr(
"To" ) ) );
74 mRawModeRadioButton_toggled(
true );
78 toggleResolutionSize();
80 insertAvailableOutputFormats();
87 setOriginalResolution();
88 int xSize = mDataProvider->
xSize();
89 int ySize = mDataProvider->
ySize();
90 mMaximumSizeXLineEdit->setText( QString::number( xSize ) );
91 mMaximumSizeYLineEdit->setText( QString::number( ySize ) );
95 mTileModeCheckBox->setChecked(
true );
96 mMaximumSizeXLineEdit->setText( QString::number( 2000 ) );
97 mMaximumSizeYLineEdit->setText( QString::number( 2000 ) );
101 mCreateOptionsWidget->setProvider( mDataProvider->
name() );
102 if ( mDataProvider->
name() == QLatin1String(
"gdal" ) )
104 mCreateOptionsWidget->setFormat( mFormatComboBox->currentData().toString() );
106 mCreateOptionsWidget->setRasterLayer( mRasterLayer );
107 mCreateOptionsWidget->update();
115 mPyramidsOptionsWidget->createOptionsWidget()->setRasterLayer( mRasterLayer );
120 mPyramidsUseExistingCheckBox->setEnabled(
false );
121 mPyramidsUseExistingCheckBox->setVisible(
false );
123 populatePyramidsLevels();
125 this, &QgsRasterLayerSaveAsDialog::populatePyramidsLevels );
129 mPyramidsGroupBox->setEnabled(
false );
134 mCreateOptionsGroupBox->setSaveCheckedState(
true );
139 mCrsSelector->setLayerCrs( mLayerCrs );
141 mCrsSelector->setCrs( mLayerCrs );
144 this, &QgsRasterLayerSaveAsDialog::crsChanged );
146 QPushButton *okButton = mButtonBox->button( QDialogButtonBox::Ok );
149 okButton->setEnabled(
false );
152 connect( mButtonBox, &QDialogButtonBox::helpRequested,
this, &QgsRasterLayerSaveAsDialog::showHelp );
154 connect( mButtonBox, &QDialogButtonBox::rejected,
this, &QgsRasterLayerSaveAsDialog::reject );
156 mExtentGroupBox->setOutputCrs(
outputCrs() );
157 mExtentGroupBox->setOriginalExtent( mDataProvider->
extent(), mLayerCrs );
158 mExtentGroupBox->setCurrentExtent( mCurrentExtent, mCurrentCrs );
159 mExtentGroupBox->setOutputExtentFromOriginal();
162 recalcResolutionSize();
165 restoreGeometry( settings.
value( QStringLiteral(
"Windows/RasterLayerSaveAs/geometry" ) ).toByteArray() );
167 if ( mTileModeCheckBox->isChecked() )
169 mTilesGroupBox->show();
171 mFilename->setDialogTitle( tr(
"Select Output Directory" ) );
175 mTilesGroupBox->hide();
177 mFilename->setDialogTitle( tr(
"Save Layer As" ) );
180 mFilename->setDefaultRoot( settings.
value( QStringLiteral(
"UI/lastRasterFileDir" ), QDir::homePath() ).toString() );
184 QFileInfo tmplFileInfo( filePath );
185 settings.
setValue( QStringLiteral(
"UI/lastRasterFileDir" ), tmplFileInfo.absolutePath() );
187 if ( !filePath.isEmpty() && mLayerName->isEnabled() )
189 QFileInfo fileInfo( filePath );
190 mLayerName->setText( fileInfo.baseName() );
193 if ( mTileModeCheckBox->isChecked() )
195 QString fileName = filePath;
200 if ( fileName.isEmpty() )
204 QDir dir( fileName );
205 QString baseName = QFileInfo( fileName ).baseName();
207 filters << QStringLiteral(
"%1.*" ).arg( baseName );
208 QStringList files = dir.entryList( filters );
209 if ( files.isEmpty() )
212 if ( QMessageBox::warning(
this, tr(
"Save Raster Layer" ),
213 tr(
"The directory %1 contains files which will be overwritten: %2" ).arg( dir.absolutePath(), files.join( QStringLiteral(
", " ) ) ),
214 QMessageBox::Ok | QMessageBox::Cancel ) == QMessageBox::Ok )
217 fileName = QFileDialog::getExistingDirectory(
this, tr(
"Select output directory" ), tmplFileInfo.absolutePath() );
221 QPushButton *okButton = mButtonBox->button( QDialogButtonBox::Ok );
226 okButton->setEnabled( tmplFileInfo.absoluteDir().exists() );
236 void QgsRasterLayerSaveAsDialog::insertAvailableOutputFormats()
240 int nDrivers = GDALGetDriverCount();
241 QMap< int, QPair< QString, QString > > topPriorityDrivers;
242 QMap< QString, QString > lowPriorityDrivers;
244 for (
int i = 0; i < nDrivers; ++i )
246 GDALDriverH driver = GDALGetDriver( i );
251 QString driverShortName = GDALGetDriverShortName( driver );
252 QString driverLongName = GDALGetDriverLongName( driver );
253 if ( driverShortName == QLatin1String(
"MEM" ) )
260 else if ( driverShortName == QLatin1String(
"VRT" ) )
265 else if ( driverShortName == QStringLiteral(
"GTiff" ) )
268 topPriorityDrivers.insert( 1, qMakePair( driverLongName, driverShortName ) );
270 else if ( driverShortName == QStringLiteral(
"GPKG" ) )
273 topPriorityDrivers.insert( 2, qMakePair( driverLongName, driverShortName ) );
277 lowPriorityDrivers.insert( driverLongName, driverShortName );
284 for (
auto priorityDriversIt = topPriorityDrivers.constBegin(); priorityDriversIt != topPriorityDrivers.constEnd(); ++priorityDriversIt )
286 mFormatComboBox->addItem( priorityDriversIt.value().first, priorityDriversIt.value().second );
289 for (
auto lowPriorityDriversIt = lowPriorityDrivers.constBegin(); lowPriorityDriversIt != lowPriorityDrivers.constEnd(); ++lowPriorityDriversIt )
291 mFormatComboBox->addItem( lowPriorityDriversIt.key(), lowPriorityDriversIt.value() );
296 void QgsRasterLayerSaveAsDialog::setValidators()
298 mXResolutionLineEdit->setValidator(
new QDoubleValidator(
this ) );
299 mYResolutionLineEdit->setValidator(
new QDoubleValidator(
this ) );
300 mColumnsLineEdit->setValidator(
new QIntValidator(
this ) );
301 mRowsLineEdit->setValidator(
new QIntValidator(
this ) );
302 mMaximumSizeXLineEdit->setValidator(
new QIntValidator(
this ) );
303 mMaximumSizeYLineEdit->setValidator(
new QIntValidator(
this ) );
306 void QgsRasterLayerSaveAsDialog::mFormatComboBox_currentIndexChanged(
const QString & )
309 if ( mDataProvider && mDataProvider->
name() == QLatin1String(
"gdal" ) )
312 mCreateOptionsWidget->update();
317 if ( extensions.empty() )
318 filter = tr(
"All files (*.*)" );
321 filter = QStringLiteral(
"%1 (*.%2);;%3" ).arg( mFormatComboBox->currentText(),
322 extensions.join( QStringLiteral(
" *." ) ),
323 tr(
"All files (*.*)" ) );
325 mFilename->setFilter( filter );
328 mTileModeCheckBox->setEnabled(
outputFormat() != QStringLiteral(
"GPKG" ) );
329 mFilename->setConfirmOverwrite(
outputFormat() != QStringLiteral(
"GPKG" ) );
330 mLayerName->setEnabled(
outputFormat() == QStringLiteral(
"GPKG" ) );
331 if ( mLayerName->isEnabled() )
333 QString layerName = QFileInfo( mFilename->filePath() ).baseName();
334 mLayerName->setText( layerName );
335 mTileModeCheckBox->setChecked(
false );
339 mLayerName->setText( QString() );
345 return mColumnsLineEdit->text().toInt();
350 return mRowsLineEdit->text().toInt();
355 return mXResolutionLineEdit->text().toDouble();
360 return mYResolutionLineEdit->text().toDouble();
365 return mMaximumSizeXLineEdit->text().toInt();
370 return mMaximumSizeYLineEdit->text().toInt();
375 return mTileModeCheckBox->isChecked();
380 return mAddToCanvas->isChecked();
385 QString fileName = mFilename->filePath();
391 if ( !extensions.empty() )
393 defaultExt = extensions.at( 0 );
397 QFileInfo fi( fileName );
398 if ( !fileName.isEmpty() && fi.suffix().isEmpty() )
400 fileName +=
'.' + defaultExt;
409 if ( mLayerName->text().isEmpty() &&
outputFormat() == QStringLiteral(
"GPKG" ) && !mTileModeCheckBox->isChecked() )
412 return QFileInfo( mFilename->filePath() ).baseName();
416 return mLayerName->text();
422 return mFormatComboBox->currentData().toString();
427 QStringList options = mCreateOptionsGroupBox->isChecked() ? mCreateOptionsWidget->options() : QStringList();
431 int indx = options.indexOf( QRegularExpression(
"^RASTER_TABLE=.*", QRegularExpression::CaseInsensitiveOption | QRegularExpression::MultilineOption ) );
434 options.replace( indx, QStringLiteral(
"RASTER_TABLE=%1" ).arg(
outputLayerName() ) );
438 options.append( QStringLiteral(
"RASTER_TABLE=%1" ).arg(
outputLayerName() ) );
442 if ( !outputLayerExists() )
444 indx = options.indexOf( QRegularExpression(
"^APPEND_SUBDATASET=.*", QRegularExpression::CaseInsensitiveOption | QRegularExpression::MultilineOption ) );
447 options.replace( indx, QStringLiteral(
"APPEND_SUBDATASET=YES" ) );
451 options.append( QStringLiteral(
"APPEND_SUBDATASET=YES" ) );
460 return mExtentGroupBox->outputExtent();
465 mFormatLabel->hide();
466 mFormatComboBox->hide();
471 mSaveAsLabel->hide();
473 QPushButton *okButton = mButtonBox->button( QDialogButtonBox::Ok );
476 okButton->setEnabled(
true );
480 void QgsRasterLayerSaveAsDialog::toggleResolutionSize()
484 bool on = mResolutionRadioButton->isChecked();
485 mXResolutionLineEdit->setEnabled( on );
486 mYResolutionLineEdit->setEnabled( on );
487 mOriginalResolutionPushButton->setEnabled( on && hasResolution );
488 mColumnsLineEdit->setEnabled( !on );
489 mRowsLineEdit->setEnabled( !on );
490 mOriginalSizePushButton->setEnabled( !on && hasResolution );
493 void QgsRasterLayerSaveAsDialog::setOriginalResolution()
505 xRes = yRes = mDataProvider->
extent().
width() / 100;
507 setResolution( xRes, yRes, mLayerCrs );
525 QgsRectangle srcExtent( srsCenter.
x() - xRes / 2, srsCenter.
y() - yRes / 2, srsCenter.
x() + xRes / 2, srsCenter.
y() + yRes / 2 );
528 xRes = extent.width();
529 yRes = extent.height();
531 mXResolutionLineEdit->setText( QString::number( xRes ) );
532 mYResolutionLineEdit->setText( QString::number( yRes ) );
535 void QgsRasterLayerSaveAsDialog::recalcSize()
540 mColumnsLineEdit->setText( QString::number( xSize ) );
541 mRowsLineEdit->setText( QString::number( ySize ) );
542 updateResolutionStateMsg();
545 void QgsRasterLayerSaveAsDialog::setOriginalSize()
547 mColumnsLineEdit->setText( QString::number( mDataProvider->
xSize() ) );
548 mRowsLineEdit->setText( QString::number( mDataProvider->
ySize() ) );
552 void QgsRasterLayerSaveAsDialog::recalcResolution()
557 mXResolutionLineEdit->setText( QString::number( xRes ) );
558 mYResolutionLineEdit->setText( QString::number( yRes ) );
559 updateResolutionStateMsg();
562 void QgsRasterLayerSaveAsDialog::recalcResolutionSize()
564 if ( mResolutionRadioButton->isChecked() )
575 void QgsRasterLayerSaveAsDialog::updateResolutionStateMsg()
578 switch ( mResolutionState )
584 msg = tr(
"user defined" );
589 msg = tr(
"Resolution (current: %1)" ).arg( msg );
590 mResolutionGroupBox->setTitle( msg );
593 void QgsRasterLayerSaveAsDialog::extentChanged()
596 if ( mSizeRadioButton->isChecked() )
600 recalcResolutionSize();
603 void QgsRasterLayerSaveAsDialog::crsChanged()
607 mExtentGroupBox->setOutputCrs(
outputCrs() );
610 if ( mResolutionRadioButton->isChecked() )
614 setOriginalResolution();
633 return mCrsSelector->crs();
642 void QgsRasterLayerSaveAsDialog::mRawModeRadioButton_toggled(
bool checked )
644 mNoDataGroupBox->setEnabled( checked && mDataProvider->
bandCount() == 1 );
647 void QgsRasterLayerSaveAsDialog::mAddNoDataManuallyToolButton_clicked()
649 addNoDataRow( std::numeric_limits<double>::quiet_NaN(), std::numeric_limits<double>::quiet_NaN() );
652 void QgsRasterLayerSaveAsDialog::mLoadTransparentNoDataToolButton_clicked()
654 if ( !mRasterLayer->
renderer() )
return;
656 if ( !rasterTransparency )
return;
662 addNoDataRow( transparencyPixel.
min, transparencyPixel.
max );
663 if ( transparencyPixel.
min != transparencyPixel.
max )
665 setNoDataToEdited( mNoDataTableWidget->rowCount() - 1 );
671 void QgsRasterLayerSaveAsDialog::mRemoveSelectedNoDataToolButton_clicked()
673 mNoDataTableWidget->removeRow( mNoDataTableWidget->currentRow() );
676 void QgsRasterLayerSaveAsDialog::mRemoveAllNoDataToolButton_clicked()
678 while ( mNoDataTableWidget->rowCount() > 0 )
680 mNoDataTableWidget->removeRow( 0 );
684 void QgsRasterLayerSaveAsDialog::addNoDataRow(
double min,
double max )
686 mNoDataTableWidget->insertRow( mNoDataTableWidget->rowCount() );
687 for (
int i = 0; i < 2; i++ )
689 double value = i == 0 ? min : max;
690 QLineEdit *lineEdit =
new QLineEdit();
691 lineEdit->setFrame(
false );
692 lineEdit->setContentsMargins( 1, 1, 1, 1 );
698 lineEdit->setValidator(
new QDoubleValidator(
nullptr ) );
699 if ( !std::isnan( value ) )
705 lineEdit->setValidator(
new QIntValidator(
nullptr ) );
706 if ( !std::isnan( value ) )
708 valueString = QString::number( static_cast<int>( value ) );
712 lineEdit->setText( valueString );
713 mNoDataTableWidget->setCellWidget( mNoDataTableWidget->rowCount() - 1, i, lineEdit );
715 adjustNoDataCellWidth( mNoDataTableWidget->rowCount() - 1, i );
717 connect( lineEdit, &QLineEdit::textEdited,
this, &QgsRasterLayerSaveAsDialog::noDataCellTextEdited );
719 mNoDataTableWidget->resizeColumnsToContents();
720 mNoDataTableWidget->resizeRowsToContents();
723 void QgsRasterLayerSaveAsDialog::noDataCellTextEdited(
const QString &text )
727 QLineEdit *lineEdit =
dynamic_cast<QLineEdit *
>( sender() );
728 if ( !lineEdit )
return;
731 for (
int r = 0; r < mNoDataTableWidget->rowCount(); r++ )
733 for (
int c = 0;
c < mNoDataTableWidget->columnCount();
c++ )
735 if ( mNoDataTableWidget->cellWidget( r,
c ) == sender() )
742 if ( row != -1 )
break;
744 QgsDebugMsg( QStringLiteral(
"row = %1 column =%2" ).arg( row ).arg( column ) );
748 QLineEdit *toLineEdit =
dynamic_cast<QLineEdit *
>( mNoDataTableWidget->cellWidget( row, 1 ) );
749 if ( !toLineEdit )
return;
750 bool toChanged = mNoDataToEdited.value( row );
751 QgsDebugMsg( QStringLiteral(
"toChanged = %1" ).arg( toChanged ) );
754 toLineEdit->setText( lineEdit->text() );
757 else if ( column == 1 )
759 setNoDataToEdited( row );
763 void QgsRasterLayerSaveAsDialog::mTileModeCheckBox_toggled(
bool toggled )
782 mTilesGroupBox->show();
784 mFilename->setDialogTitle( tr(
"Select Output Directory" ) );
788 mTilesGroupBox->hide();
790 mFilename->setDialogTitle( tr(
"Save Layer As" ) );
794 void QgsRasterLayerSaveAsDialog::mPyramidsGroupBox_toggled(
bool toggled )
797 populatePyramidsLevels();
800 void QgsRasterLayerSaveAsDialog::populatePyramidsLevels()
804 if ( mPyramidsGroupBox->isChecked() )
806 QList<QgsRasterPyramid> myPyramidList;
809 if ( mPyramidsUseExistingCheckBox->isChecked() )
815 if ( ! mPyramidsOptionsWidget->overviewList().isEmpty() )
816 myPyramidList = mDataProvider->
buildPyramidList( mPyramidsOptionsWidget->overviewList() );
818 QList<QgsRasterPyramid>::iterator myRasterPyramidIterator;
819 for ( myRasterPyramidIterator = myPyramidList.begin();
820 myRasterPyramidIterator != myPyramidList.end();
821 ++myRasterPyramidIterator )
823 if ( ! mPyramidsUseExistingCheckBox->isChecked() || myRasterPyramidIterator->exists )
825 text += QString::number( myRasterPyramidIterator->xDim ) + QStringLiteral(
"x" ) +
826 QString::number( myRasterPyramidIterator->yDim ) +
' ';
831 mPyramidResolutionsLineEdit->setText( text.trimmed() );
834 void QgsRasterLayerSaveAsDialog::setNoDataToEdited(
int row )
836 if ( row >= mNoDataToEdited.size() )
838 mNoDataToEdited.resize( row + 1 );
840 mNoDataToEdited[row] =
true;
843 double QgsRasterLayerSaveAsDialog::noDataCellValue(
int row,
int column )
const 845 QLineEdit *lineEdit =
dynamic_cast<QLineEdit *
>( mNoDataTableWidget->cellWidget( row, column ) );
846 if ( !lineEdit || lineEdit->text().isEmpty() )
848 std::numeric_limits<double>::quiet_NaN();
850 return lineEdit->text().toDouble();
853 void QgsRasterLayerSaveAsDialog::adjustNoDataCellWidth(
int row,
int column )
855 QLineEdit *lineEdit =
dynamic_cast<QLineEdit *
>( mNoDataTableWidget->cellWidget( row, column ) );
856 if ( !lineEdit )
return;
858 int width = std::max( lineEdit->fontMetrics().width( lineEdit->text() ) + 10, 100 );
859 width = std::max( width, mNoDataTableWidget->columnWidth( column ) );
861 lineEdit->setFixedWidth( width );
867 if ( ! mNoDataGroupBox->isChecked() )
870 int rows = mNoDataTableWidget->rowCount();
871 noDataList.reserve( rows );
872 for (
int r = 0; r < rows; r++ )
875 noDataList.append( noData );
883 return mPyramidsGroupBox->isChecked() ? mPyramidsOptionsWidget->overviewList() : QList<int>();
888 if ( ! mPyramidsGroupBox->isChecked() )
890 else if ( mPyramidsUseExistingCheckBox->isChecked() )
896 bool QgsRasterLayerSaveAsDialog::validate()
const 898 if ( mCreateOptionsGroupBox->isChecked() )
900 QString message = mCreateOptionsWidget->validateOptions(
true,
false );
901 if ( !message.isNull() )
904 if ( mPyramidsGroupBox->isChecked() )
906 QString message = mPyramidsOptionsWidget->createOptionsWidget()->validateOptions(
true,
false );
907 if ( !message.isNull() )
913 bool QgsRasterLayerSaveAsDialog::outputLayerExists()
const 927 QgsRasterLayer rasterLayer( rasterUri, QString( ), QStringLiteral(
"gdal" ) );
928 if ( !vectorUri.isEmpty() )
930 QgsVectorLayer vectorLayer( vectorUri, QString( ), QStringLiteral(
"ogr" ) );
946 if (
outputFormat() == QStringLiteral(
"GPKG" ) && outputLayerExists() &&
947 QMessageBox::warning(
this, tr(
"Save Raster Layer" ),
948 tr(
"The layer %1 already exists in the target file, and overwriting layers in GeoPackage is not supported. " 950 QMessageBox::Yes | QMessageBox::No ) == QMessageBox::No )
958 void QgsRasterLayerSaveAsDialog::showHelp()
960 QgsHelp::openHelp( QStringLiteral(
"managing_data_source/create_layers.html#save-layer-from-an-existing-file" ) );
virtual int bandCount() const =0
Gets number of bands.
QList< QgsRasterTransparency::TransparentSingleValuePixel > transparentSingleValuePixelList() const
Returns the transparent single value pixel list.
A rectangle specified with double values.
static QString printValue(double value)
Print double value with all necessary significant digits.
bool isValid() const
Returns the status of the layer.
void extentChanged(const QgsRectangle &r)
Emitted when the widget's extent is changed.
This class is a composition of two QSettings instances:
This class provides qgis with the ability to render raster datasets onto the mapcanvas.
A class to represent a 2D point.
static QStringList extensionsForFormat(const QString &format)
Returns a list of known file extensions for the given GDAL driver format.
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.
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.
Raster values range container.
QgsCoordinateReferenceSystem outputCrs()
Thirty two bit floating point (float)
QList< int > pyramidsList() const
static bool supportsRasterCreate(GDALDriverH driver)
Reads whether a driver supports GDALCreate() for raster purposes.
virtual QString name() const =0
Returns a provider name.
virtual int ySize() const
Sixty four bit floating point (double)
void saveGeometry(QWidget *widget, const QString &keyName)
Save the wigget geometry into settings.
const QgsRasterTransparency * rasterTransparency() const
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
bool restoreGeometry(QWidget *widget, const QString &keyName)
Restore the wigget geometry from settings.
QgsRasterDataProvider * dataProvider() override
Returns the layer's data provider.
QgsRasterRenderer * renderer() const
virtual QList< QgsRasterPyramid > buildPyramidList(QList< int > overviewList=QList< int >())
Returns the raster layers pyramid list.
QgsRectangle extent() const override=0
Returns the extent of the layer.
double percentTransparent
QgsRaster::RasterBuildPyramids buildPyramidsFlag() const
QgsRectangle outputRectangle() const
QgsPointXY center() const
Returns the center point of the rectangle.
double xResolution() const
double yResolution() const
virtual int capabilities() const
Returns a bitmask containing the supported capabilities.
QgsRasterRangeList noData() const
int maximumTileSizeX() const
QgsRasterLayerSaveAsDialog(QgsRasterLayer *rasterLayer, QgsRasterDataProvider *sourceProvider, const QgsRectangle ¤tExtent, const QgsCoordinateReferenceSystem &layerCrs, const QgsCoordinateReferenceSystem ¤tCrs, QWidget *parent=nullptr, Qt::WindowFlags f=nullptr)
Constructor for QgsRasterLayerSaveAsDialog.
QList< QgsRasterRange > QgsRasterRangeList
virtual int xSize() const
Gets raster size.
void setValue(const QString &key, const QVariant &value, QgsSettings::Section section=QgsSettings::NoSection)
Sets the value of setting key to value.
static QgsProject * instance()
Returns the QgsProject singleton instance.
This class represents a coordinate reference system (CRS).
static void openHelp(const QString &key)
Opens help topic for the given help key using default system web browser.
Defines the list of pixel values to be considered as transparent or semi transparent when rendering r...
QStringList createOptions() const
double width() const
Returns the width of the rectangle.
Represents a vector layer which manages a vector based data sets.
~QgsRasterLayerSaveAsDialog() override
int maximumTileSizeY() const
QString outputLayerName() const
Name of the output layer within GeoPackage file.
double height() const
Returns the height of the rectangle.
QString outputFormat() const
Base class for raster data providers.
QString outputFileName() const