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 );
153 mHelpButtonBox->setVisible(
false );
154 mButtonBox->addButton( QDialogButtonBox::Help );
155 connect( mButtonBox, &QDialogButtonBox::helpRequested,
this, &QgsRasterLayerSaveAsDialog::showHelp );
157 connect( mHelpButtonBox, &QDialogButtonBox::helpRequested,
this, &QgsRasterLayerSaveAsDialog::showHelp );
160 connect( mButtonBox, &QDialogButtonBox::rejected,
this, &QgsRasterLayerSaveAsDialog::reject );
162 mExtentGroupBox->setOutputCrs(
outputCrs() );
163 mExtentGroupBox->setOriginalExtent( mDataProvider->
extent(), mLayerCrs );
164 mExtentGroupBox->setCurrentExtent( mCurrentExtent, mCurrentCrs );
165 mExtentGroupBox->setOutputExtentFromOriginal();
168 recalcResolutionSize();
171 restoreGeometry( settings.
value( QStringLiteral(
"Windows/RasterLayerSaveAs/geometry" ) ).toByteArray() );
173 if ( mTileModeCheckBox->isChecked() )
175 mTilesGroupBox->show();
177 mFilename->setDialogTitle( tr(
"Select Output Directory" ) );
181 mTilesGroupBox->hide();
183 mFilename->setDialogTitle( tr(
"Save Layer As" ) );
186 mFilename->setDefaultRoot( settings.
value( QStringLiteral(
"UI/lastRasterFileDir" ), QDir::homePath() ).toString() );
190 QFileInfo tmplFileInfo( filePath );
191 settings.
setValue( QStringLiteral(
"UI/lastRasterFileDir" ), tmplFileInfo.absolutePath() );
193 if ( !filePath.isEmpty() && mLayerName->isEnabled() )
195 QFileInfo fileInfo( filePath );
196 mLayerName->setText( fileInfo.baseName() );
199 if ( mTileModeCheckBox->isChecked() )
201 QString fileName = filePath;
206 if ( fileName.isEmpty() )
210 QDir dir( fileName );
211 QString baseName = QFileInfo( fileName ).baseName();
213 filters << QStringLiteral(
"%1.*" ).arg( baseName );
214 QStringList files = dir.entryList( filters );
215 if ( files.isEmpty() )
218 if ( QMessageBox::warning(
this, tr(
"Save Raster Layer" ),
219 tr(
"The directory %1 contains files which will be overwritten: %2" ).arg( dir.absolutePath(), files.join( QStringLiteral(
", " ) ) ),
220 QMessageBox::Ok | QMessageBox::Cancel ) == QMessageBox::Ok )
223 fileName = QFileDialog::getExistingDirectory(
this, tr(
"Select output directory" ), tmplFileInfo.absolutePath() );
227 QPushButton *okButton = mButtonBox->button( QDialogButtonBox::Ok );
232 okButton->setEnabled( tmplFileInfo.absoluteDir().exists() );
242 void QgsRasterLayerSaveAsDialog::insertAvailableOutputFormats()
246 int nDrivers = GDALGetDriverCount();
247 QMap< int, QPair< QString, QString > > topPriorityDrivers;
248 QMap< QString, QString > lowPriorityDrivers;
250 for (
int i = 0; i < nDrivers; ++i )
252 GDALDriverH driver = GDALGetDriver( i );
257 QString driverShortName = GDALGetDriverShortName( driver );
258 QString driverLongName = GDALGetDriverLongName( driver );
259 if ( driverShortName == QLatin1String(
"MEM" ) )
266 else if ( driverShortName == QLatin1String(
"VRT" ) )
271 else if ( driverShortName == QStringLiteral(
"GTiff" ) )
274 topPriorityDrivers.insert( 1, qMakePair( driverLongName, driverShortName ) );
276 else if ( driverShortName == QStringLiteral(
"GPKG" ) )
279 topPriorityDrivers.insert( 2, qMakePair( driverLongName, driverShortName ) );
283 lowPriorityDrivers.insert( driverLongName, driverShortName );
290 for (
auto priorityDriversIt = topPriorityDrivers.constBegin(); priorityDriversIt != topPriorityDrivers.constEnd(); ++priorityDriversIt )
292 mFormatComboBox->addItem( priorityDriversIt.value().first, priorityDriversIt.value().second );
295 for (
auto lowPriorityDriversIt = lowPriorityDrivers.constBegin(); lowPriorityDriversIt != lowPriorityDrivers.constEnd(); ++lowPriorityDriversIt )
297 mFormatComboBox->addItem( lowPriorityDriversIt.key(), lowPriorityDriversIt.value() );
302 void QgsRasterLayerSaveAsDialog::setValidators()
304 mXResolutionLineEdit->setValidator(
new QDoubleValidator(
this ) );
305 mYResolutionLineEdit->setValidator(
new QDoubleValidator(
this ) );
306 mColumnsLineEdit->setValidator(
new QIntValidator(
this ) );
307 mRowsLineEdit->setValidator(
new QIntValidator(
this ) );
308 mMaximumSizeXLineEdit->setValidator(
new QIntValidator(
this ) );
309 mMaximumSizeYLineEdit->setValidator(
new QIntValidator(
this ) );
312 void QgsRasterLayerSaveAsDialog::mFormatComboBox_currentIndexChanged(
const QString & )
315 if ( mDataProvider && mDataProvider->
name() == QLatin1String(
"gdal" ) )
318 mCreateOptionsWidget->update();
323 if ( extensions.empty() )
324 filter = tr(
"All files (*.*)" );
327 filter = QStringLiteral(
"%1 (*.%2);;%3" ).arg( mFormatComboBox->currentText(),
328 extensions.join( QStringLiteral(
" *." ) ),
329 tr(
"All files (*.*)" ) );
331 mFilename->setFilter( filter );
334 mTileModeCheckBox->setEnabled(
outputFormat() != QStringLiteral(
"GPKG" ) );
335 mFilename->setConfirmOverwrite(
outputFormat() != QStringLiteral(
"GPKG" ) );
336 mLayerName->setEnabled(
outputFormat() == QStringLiteral(
"GPKG" ) );
337 if ( mLayerName->isEnabled() )
339 QString layerName = QFileInfo( mFilename->filePath() ).baseName();
340 mLayerName->setText( layerName );
341 mTileModeCheckBox->setChecked(
false );
345 mLayerName->setText( QString() );
351 return mColumnsLineEdit->text().toInt();
356 return mRowsLineEdit->text().toInt();
361 return mXResolutionLineEdit->text().toDouble();
366 return mYResolutionLineEdit->text().toDouble();
371 return mMaximumSizeXLineEdit->text().toInt();
376 return mMaximumSizeYLineEdit->text().toInt();
381 return mTileModeCheckBox->isChecked();
386 return mAddToCanvas->isChecked();
391 mAddToCanvas->setChecked( checked );
396 QString fileName = mFilename->filePath();
402 if ( !extensions.empty() )
404 defaultExt = extensions.at( 0 );
408 QFileInfo fi( fileName );
409 if ( !fileName.isEmpty() && fi.suffix().isEmpty() )
411 fileName +=
'.' + defaultExt;
420 if ( mLayerName->text().isEmpty() &&
outputFormat() == QStringLiteral(
"GPKG" ) && !mTileModeCheckBox->isChecked() )
423 return QFileInfo( mFilename->filePath() ).baseName();
427 return mLayerName->text();
433 return mFormatComboBox->currentData().toString();
438 QStringList options = mCreateOptionsGroupBox->isChecked() ? mCreateOptionsWidget->options() : QStringList();
442 int indx = options.indexOf( QRegularExpression(
"^RASTER_TABLE=.*", QRegularExpression::CaseInsensitiveOption | QRegularExpression::MultilineOption ) );
445 options.replace( indx, QStringLiteral(
"RASTER_TABLE=%1" ).arg(
outputLayerName() ) );
449 options.append( QStringLiteral(
"RASTER_TABLE=%1" ).arg(
outputLayerName() ) );
453 if ( !outputLayerExists() )
455 indx = options.indexOf( QRegularExpression(
"^APPEND_SUBDATASET=.*", QRegularExpression::CaseInsensitiveOption | QRegularExpression::MultilineOption ) );
458 options.replace( indx, QStringLiteral(
"APPEND_SUBDATASET=YES" ) );
462 options.append( QStringLiteral(
"APPEND_SUBDATASET=YES" ) );
471 return mExtentGroupBox->outputExtent();
476 mFormatLabel->hide();
477 mFormatComboBox->hide();
482 mSaveAsLabel->hide();
484 QPushButton *okButton = mButtonBox->button( QDialogButtonBox::Ok );
487 okButton->setEnabled(
true );
491 void QgsRasterLayerSaveAsDialog::toggleResolutionSize()
495 bool on = mResolutionRadioButton->isChecked();
496 mXResolutionLineEdit->setEnabled( on );
497 mYResolutionLineEdit->setEnabled( on );
498 mOriginalResolutionPushButton->setEnabled( on && hasResolution );
499 mColumnsLineEdit->setEnabled( !on );
500 mRowsLineEdit->setEnabled( !on );
501 mOriginalSizePushButton->setEnabled( !on && hasResolution );
504 void QgsRasterLayerSaveAsDialog::setOriginalResolution()
516 xRes = yRes = mDataProvider->
extent().
width() / 100;
518 setResolution( xRes, yRes, mLayerCrs );
536 QgsRectangle srcExtent( srsCenter.
x() - xRes / 2, srsCenter.
y() - yRes / 2, srsCenter.
x() + xRes / 2, srsCenter.
y() + yRes / 2 );
539 xRes = extent.width();
540 yRes = extent.height();
542 mXResolutionLineEdit->setText( QString::number( xRes ) );
543 mYResolutionLineEdit->setText( QString::number( yRes ) );
546 void QgsRasterLayerSaveAsDialog::recalcSize()
551 mColumnsLineEdit->setText( QString::number( xSize ) );
552 mRowsLineEdit->setText( QString::number( ySize ) );
553 updateResolutionStateMsg();
556 void QgsRasterLayerSaveAsDialog::setOriginalSize()
558 mColumnsLineEdit->setText( QString::number( mDataProvider->
xSize() ) );
559 mRowsLineEdit->setText( QString::number( mDataProvider->
ySize() ) );
563 void QgsRasterLayerSaveAsDialog::recalcResolution()
568 mXResolutionLineEdit->setText( QString::number( xRes ) );
569 mYResolutionLineEdit->setText( QString::number( yRes ) );
570 updateResolutionStateMsg();
573 void QgsRasterLayerSaveAsDialog::recalcResolutionSize()
575 if ( mResolutionRadioButton->isChecked() )
586 void QgsRasterLayerSaveAsDialog::updateResolutionStateMsg()
589 switch ( mResolutionState )
595 msg = tr(
"user defined" );
600 msg = tr(
"Resolution (current: %1)" ).arg( msg );
601 mResolutionGroupBox->setTitle( msg );
604 void QgsRasterLayerSaveAsDialog::extentChanged()
607 if ( mSizeRadioButton->isChecked() )
611 recalcResolutionSize();
614 void QgsRasterLayerSaveAsDialog::crsChanged()
618 mExtentGroupBox->setOutputCrs(
outputCrs() );
621 if ( mResolutionRadioButton->isChecked() )
625 setOriginalResolution();
644 return mCrsSelector->crs();
653 void QgsRasterLayerSaveAsDialog::mRawModeRadioButton_toggled(
bool checked )
655 mNoDataGroupBox->setEnabled( checked && mDataProvider->
bandCount() == 1 );
658 void QgsRasterLayerSaveAsDialog::mAddNoDataManuallyToolButton_clicked()
660 addNoDataRow( std::numeric_limits<double>::quiet_NaN(), std::numeric_limits<double>::quiet_NaN() );
663 void QgsRasterLayerSaveAsDialog::mLoadTransparentNoDataToolButton_clicked()
665 if ( !mRasterLayer->
renderer() )
return;
667 if ( !rasterTransparency )
return;
673 addNoDataRow( transparencyPixel.
min, transparencyPixel.
max );
674 if ( transparencyPixel.
min != transparencyPixel.
max )
676 setNoDataToEdited( mNoDataTableWidget->rowCount() - 1 );
682 void QgsRasterLayerSaveAsDialog::mRemoveSelectedNoDataToolButton_clicked()
684 mNoDataTableWidget->removeRow( mNoDataTableWidget->currentRow() );
687 void QgsRasterLayerSaveAsDialog::mRemoveAllNoDataToolButton_clicked()
689 while ( mNoDataTableWidget->rowCount() > 0 )
691 mNoDataTableWidget->removeRow( 0 );
695 void QgsRasterLayerSaveAsDialog::addNoDataRow(
double min,
double max )
697 mNoDataTableWidget->insertRow( mNoDataTableWidget->rowCount() );
698 for (
int i = 0; i < 2; i++ )
700 double value = i == 0 ? min : max;
701 QLineEdit *lineEdit =
new QLineEdit();
702 lineEdit->setFrame(
false );
703 lineEdit->setContentsMargins( 1, 1, 1, 1 );
709 lineEdit->setValidator(
new QDoubleValidator(
nullptr ) );
710 if ( !std::isnan( value ) )
716 lineEdit->setValidator(
new QIntValidator(
nullptr ) );
717 if ( !std::isnan( value ) )
719 valueString = QString::number( static_cast<int>( value ) );
723 lineEdit->setText( valueString );
724 mNoDataTableWidget->setCellWidget( mNoDataTableWidget->rowCount() - 1, i, lineEdit );
726 adjustNoDataCellWidth( mNoDataTableWidget->rowCount() - 1, i );
728 connect( lineEdit, &QLineEdit::textEdited,
this, &QgsRasterLayerSaveAsDialog::noDataCellTextEdited );
730 mNoDataTableWidget->resizeColumnsToContents();
731 mNoDataTableWidget->resizeRowsToContents();
734 void QgsRasterLayerSaveAsDialog::noDataCellTextEdited(
const QString &text )
738 QLineEdit *lineEdit =
dynamic_cast<QLineEdit *
>( sender() );
739 if ( !lineEdit )
return;
742 for (
int r = 0; r < mNoDataTableWidget->rowCount(); r++ )
744 for (
int c = 0;
c < mNoDataTableWidget->columnCount();
c++ )
746 if ( mNoDataTableWidget->cellWidget( r,
c ) == sender() )
753 if ( row != -1 )
break;
755 QgsDebugMsg( QStringLiteral(
"row = %1 column =%2" ).arg( row ).arg( column ) );
759 QLineEdit *toLineEdit =
dynamic_cast<QLineEdit *
>( mNoDataTableWidget->cellWidget( row, 1 ) );
760 if ( !toLineEdit )
return;
761 bool toChanged = mNoDataToEdited.value( row );
762 QgsDebugMsg( QStringLiteral(
"toChanged = %1" ).arg( toChanged ) );
765 toLineEdit->setText( lineEdit->text() );
768 else if ( column == 1 )
770 setNoDataToEdited( row );
774 void QgsRasterLayerSaveAsDialog::mTileModeCheckBox_toggled(
bool toggled )
793 mTilesGroupBox->show();
795 mFilename->setDialogTitle( tr(
"Select Output Directory" ) );
799 mTilesGroupBox->hide();
801 mFilename->setDialogTitle( tr(
"Save Layer As" ) );
805 void QgsRasterLayerSaveAsDialog::mPyramidsGroupBox_toggled(
bool toggled )
808 populatePyramidsLevels();
811 void QgsRasterLayerSaveAsDialog::populatePyramidsLevels()
815 if ( mPyramidsGroupBox->isChecked() )
817 QList<QgsRasterPyramid> myPyramidList;
820 if ( mPyramidsUseExistingCheckBox->isChecked() )
826 if ( ! mPyramidsOptionsWidget->overviewList().isEmpty() )
827 myPyramidList = mDataProvider->
buildPyramidList( mPyramidsOptionsWidget->overviewList() );
829 QList<QgsRasterPyramid>::iterator myRasterPyramidIterator;
830 for ( myRasterPyramidIterator = myPyramidList.begin();
831 myRasterPyramidIterator != myPyramidList.end();
832 ++myRasterPyramidIterator )
834 if ( ! mPyramidsUseExistingCheckBox->isChecked() || myRasterPyramidIterator->exists )
836 text += QString::number( myRasterPyramidIterator->xDim ) + QStringLiteral(
"x" ) +
837 QString::number( myRasterPyramidIterator->yDim ) +
' ';
842 mPyramidResolutionsLineEdit->setText( text.trimmed() );
845 void QgsRasterLayerSaveAsDialog::setNoDataToEdited(
int row )
847 if ( row >= mNoDataToEdited.size() )
849 mNoDataToEdited.resize( row + 1 );
851 mNoDataToEdited[row] =
true;
854 double QgsRasterLayerSaveAsDialog::noDataCellValue(
int row,
int column )
const 856 QLineEdit *lineEdit =
dynamic_cast<QLineEdit *
>( mNoDataTableWidget->cellWidget( row, column ) );
857 if ( !lineEdit || lineEdit->text().isEmpty() )
859 std::numeric_limits<double>::quiet_NaN();
861 return lineEdit->text().toDouble();
864 void QgsRasterLayerSaveAsDialog::adjustNoDataCellWidth(
int row,
int column )
866 QLineEdit *lineEdit =
dynamic_cast<QLineEdit *
>( mNoDataTableWidget->cellWidget( row, column ) );
867 if ( !lineEdit )
return;
869 int width = std::max( lineEdit->fontMetrics().width( lineEdit->text() ) + 10, 100 );
870 width = std::max( width, mNoDataTableWidget->columnWidth( column ) );
872 lineEdit->setFixedWidth( width );
878 if ( ! mNoDataGroupBox->isChecked() )
881 int rows = mNoDataTableWidget->rowCount();
882 noDataList.reserve( rows );
883 for (
int r = 0; r < rows; r++ )
886 noDataList.append( noData );
894 return mPyramidsGroupBox->isChecked() ? mPyramidsOptionsWidget->overviewList() : QList<int>();
899 if ( ! mPyramidsGroupBox->isChecked() )
901 else if ( mPyramidsUseExistingCheckBox->isChecked() )
907 bool QgsRasterLayerSaveAsDialog::validate()
const 909 if ( mCreateOptionsGroupBox->isChecked() )
911 QString message = mCreateOptionsWidget->validateOptions(
true,
false );
912 if ( !message.isNull() )
915 if ( mPyramidsGroupBox->isChecked() )
917 QString message = mPyramidsOptionsWidget->createOptionsWidget()->validateOptions(
true,
false );
918 if ( !message.isNull() )
924 bool QgsRasterLayerSaveAsDialog::outputLayerExists()
const 936 std::unique_ptr< QgsRasterLayer > rastLayer(
new QgsRasterLayer( uri,
"", QStringLiteral(
"gdal" ) ) );
937 std::unique_ptr< QgsVectorLayer > vectLayer(
new QgsVectorLayer( uri,
"", QStringLiteral(
"ogr" ) ) );
938 return ( rastLayer->isValid() || vectLayer->isValid() );
948 if (
outputFormat() == QStringLiteral(
"GPKG" ) && outputLayerExists() &&
949 QMessageBox::warning(
this, tr(
"Save Raster Layer" ),
950 tr(
"The layer %1 already exists in the target file, and overwriting layers in GeoPackage is not supported. " 952 QMessageBox::Yes | QMessageBox::No ) == QMessageBox::No )
960 void QgsRasterLayerSaveAsDialog::showHelp()
962 QgsHelp::openHelp( QStringLiteral(
"managing_data_source/create_layers.html#save-layer-from-an-existing-file" ) );
QList< int > pyramidsList() const
virtual int bandCount() const =0
Gets number of bands.
A rectangle specified with double values.
QString outputLayerName() const
Name of the output layer within GeoPackage file.
static QString printValue(double value)
Print double value with all necessary significant digits.
QgsRaster::RasterBuildPyramids buildPyramidsFlag() const
void extentChanged(const QgsRectangle &r)
Emitted when the widget's extent is changed.
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.
This class provides qgis with the ability to render raster datasets onto the mapcanvas.
A class to represent a 2D point.
virtual int ySize() const
double yResolution() const
static QStringList extensionsForFormat(const QString &format)
Returns a list of known file extensions for the given GDAL driver format.
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()
QgsRasterRenderer * renderer() const
Thirty two bit floating point (float)
QString outputFileName() const
int maximumTileSizeY() const
static bool supportsRasterCreate(GDALDriverH driver)
Reads whether a driver supports GDALCreate() for raster purposes.
const QgsRasterTransparency * rasterTransparency() const
virtual QString name() const =0
Returns a provider name.
Sixty four bit floating point (double)
void saveGeometry(QWidget *widget, const QString &keyName)
Save the wigget geometry into settings.
QgsRectangle outputRectangle() 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, it may be null.
virtual QList< QgsRasterPyramid > buildPyramidList(QList< int > overviewList=QList< int >())
Returns the raster layers pyramid list.
QStringList createOptions() const
virtual int capabilities() const
Returns a bitmask containing the supported capabilities.
QgsRectangle extent() const override=0
Returns the extent of the layer.
double percentTransparent
double width() const
Returns the width of the rectangle.
double xResolution() const
bool addToCanvas() const
Returns true if the "add to canvas" checkbox is checked.
QList< QgsRasterTransparency::TransparentSingleValuePixel > transparentSingleValuePixelList() const
Returns the transparent single value pixel list.
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
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.
QString outputFormat() const
Defines the list of pixel values to be considered as transparent or semi transparent when rendering r...
QgsPointXY center() const
Returns the center point of the rectangle.
Represents a vector layer which manages a vector based data sets.
virtual int xSize() const
Gets raster size.
QgsRasterRangeList noData() const
~QgsRasterLayerSaveAsDialog() override
double height() const
Returns the height of the rectangle.
void setAddToCanvas(bool checked)
Sets whether the "add to canvas" checkbox should be checked.
Base class for raster data providers.