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;
672 if ( transparencyPixel.percentTransparent == 100 )
674 addNoDataRow( transparencyPixel.min, transparencyPixel.max );
675 if ( transparencyPixel.min != transparencyPixel.max )
677 setNoDataToEdited( mNoDataTableWidget->rowCount() - 1 );
683 void QgsRasterLayerSaveAsDialog::mRemoveSelectedNoDataToolButton_clicked()
685 mNoDataTableWidget->removeRow( mNoDataTableWidget->currentRow() );
688 void QgsRasterLayerSaveAsDialog::mRemoveAllNoDataToolButton_clicked()
690 while ( mNoDataTableWidget->rowCount() > 0 )
692 mNoDataTableWidget->removeRow( 0 );
696 void QgsRasterLayerSaveAsDialog::addNoDataRow(
double min,
double max )
698 mNoDataTableWidget->insertRow( mNoDataTableWidget->rowCount() );
699 for (
int i = 0; i < 2; i++ )
701 double value = i == 0 ? min : max;
702 QLineEdit *lineEdit =
new QLineEdit();
703 lineEdit->setFrame(
false );
704 lineEdit->setContentsMargins( 1, 1, 1, 1 );
710 lineEdit->setValidator(
new QDoubleValidator(
nullptr ) );
711 if ( !std::isnan( value ) )
717 lineEdit->setValidator(
new QIntValidator(
nullptr ) );
718 if ( !std::isnan( value ) )
720 valueString = QString::number( static_cast<int>( value ) );
724 lineEdit->setText( valueString );
725 mNoDataTableWidget->setCellWidget( mNoDataTableWidget->rowCount() - 1, i, lineEdit );
727 adjustNoDataCellWidth( mNoDataTableWidget->rowCount() - 1, i );
729 connect( lineEdit, &QLineEdit::textEdited,
this, &QgsRasterLayerSaveAsDialog::noDataCellTextEdited );
731 mNoDataTableWidget->resizeColumnsToContents();
732 mNoDataTableWidget->resizeRowsToContents();
735 void QgsRasterLayerSaveAsDialog::noDataCellTextEdited(
const QString &text )
739 QLineEdit *lineEdit = qobject_cast<QLineEdit *>( sender() );
740 if ( !lineEdit )
return;
743 for (
int r = 0; r < mNoDataTableWidget->rowCount(); r++ )
745 for (
int c = 0;
c < mNoDataTableWidget->columnCount();
c++ )
747 if ( mNoDataTableWidget->cellWidget( r,
c ) == sender() )
754 if ( row != -1 )
break;
756 QgsDebugMsg( QStringLiteral(
"row = %1 column =%2" ).arg( row ).arg( column ) );
760 QLineEdit *toLineEdit =
dynamic_cast<QLineEdit *
>( mNoDataTableWidget->cellWidget( row, 1 ) );
761 if ( !toLineEdit )
return;
762 bool toChanged = mNoDataToEdited.value( row );
763 QgsDebugMsg( QStringLiteral(
"toChanged = %1" ).arg( toChanged ) );
766 toLineEdit->setText( lineEdit->text() );
769 else if ( column == 1 )
771 setNoDataToEdited( row );
775 void QgsRasterLayerSaveAsDialog::mTileModeCheckBox_toggled(
bool toggled )
794 mTilesGroupBox->show();
796 mFilename->setDialogTitle( tr(
"Select Output Directory" ) );
800 mTilesGroupBox->hide();
802 mFilename->setDialogTitle( tr(
"Save Layer As" ) );
806 void QgsRasterLayerSaveAsDialog::mPyramidsGroupBox_toggled(
bool toggled )
809 populatePyramidsLevels();
812 void QgsRasterLayerSaveAsDialog::populatePyramidsLevels()
816 if ( mPyramidsGroupBox->isChecked() )
818 QList<QgsRasterPyramid> myPyramidList;
821 if ( mPyramidsUseExistingCheckBox->isChecked() )
827 if ( ! mPyramidsOptionsWidget->overviewList().isEmpty() )
828 myPyramidList = mDataProvider->
buildPyramidList( mPyramidsOptionsWidget->overviewList() );
830 QList<QgsRasterPyramid>::iterator myRasterPyramidIterator;
831 for ( myRasterPyramidIterator = myPyramidList.begin();
832 myRasterPyramidIterator != myPyramidList.end();
833 ++myRasterPyramidIterator )
835 if ( ! mPyramidsUseExistingCheckBox->isChecked() || myRasterPyramidIterator->exists )
837 text += QString::number( myRasterPyramidIterator->xDim ) + QStringLiteral(
"x" ) +
838 QString::number( myRasterPyramidIterator->yDim ) +
' ';
843 mPyramidResolutionsLineEdit->setText( text.trimmed() );
846 void QgsRasterLayerSaveAsDialog::setNoDataToEdited(
int row )
848 if ( row >= mNoDataToEdited.size() )
850 mNoDataToEdited.resize( row + 1 );
852 mNoDataToEdited[row] =
true;
855 double QgsRasterLayerSaveAsDialog::noDataCellValue(
int row,
int column )
const 857 QLineEdit *lineEdit =
dynamic_cast<QLineEdit *
>( mNoDataTableWidget->cellWidget( row, column ) );
858 if ( !lineEdit || lineEdit->text().isEmpty() )
860 std::numeric_limits<double>::quiet_NaN();
862 return lineEdit->text().toDouble();
865 void QgsRasterLayerSaveAsDialog::adjustNoDataCellWidth(
int row,
int column )
867 QLineEdit *lineEdit =
dynamic_cast<QLineEdit *
>( mNoDataTableWidget->cellWidget( row, column ) );
868 if ( !lineEdit )
return;
870 int width = std::max( lineEdit->fontMetrics().width( lineEdit->text() ) + 10, 100 );
871 width = std::max( width, mNoDataTableWidget->columnWidth( column ) );
873 lineEdit->setFixedWidth( width );
879 if ( ! mNoDataGroupBox->isChecked() )
882 int rows = mNoDataTableWidget->rowCount();
883 noDataList.reserve( rows );
884 for (
int r = 0; r < rows; r++ )
887 noDataList.append( noData );
895 return mPyramidsGroupBox->isChecked() ? mPyramidsOptionsWidget->overviewList() : QList<int>();
900 if ( ! mPyramidsGroupBox->isChecked() )
902 else if ( mPyramidsUseExistingCheckBox->isChecked() )
908 bool QgsRasterLayerSaveAsDialog::validate()
const 910 if ( mCreateOptionsGroupBox->isChecked() )
912 QString message = mCreateOptionsWidget->validateOptions(
true,
false );
913 if ( !message.isNull() )
916 if ( mPyramidsGroupBox->isChecked() )
918 QString message = mPyramidsOptionsWidget->createOptionsWidget()->validateOptions(
true,
false );
919 if ( !message.isNull() )
925 bool QgsRasterLayerSaveAsDialog::outputLayerExists()
const 939 QgsRasterLayer rasterLayer( rasterUri, QString( ), QStringLiteral(
"gdal" ) );
940 if ( !vectorUri.isEmpty() )
942 QgsVectorLayer vectorLayer( vectorUri, QString( ), QStringLiteral(
"ogr" ) );
958 if (
outputFormat() == QStringLiteral(
"GPKG" ) && outputLayerExists() &&
959 QMessageBox::warning(
this, tr(
"Save Raster Layer" ),
960 tr(
"The layer %1 already exists in the target file, and overwriting layers in GeoPackage is not supported. " 962 QMessageBox::Yes | QMessageBox::No ) == QMessageBox::No )
970 void QgsRasterLayerSaveAsDialog::showHelp()
972 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
bool isValid() const
Returns the status of the layer.
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 nullptr.
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 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.