36#include <QRegularExpression>
41 QWidget *parent, Qt::WindowFlags f )
42 : QDialog( parent, f )
43 , mRasterLayer( rasterLayer )
44 , mDataProvider( sourceProvider )
45 , mCurrentExtent( currentExtent )
46 , mLayerCrs( layerCrs )
47 , mCurrentCrs( currentCrs )
48 , mResolutionState( OriginalResolution )
52 connect( mRawModeRadioButton, &QRadioButton::toggled,
this, &QgsRasterLayerSaveAsDialog::mRawModeRadioButton_toggled );
53 connect( mFormatComboBox, &QComboBox::currentTextChanged,
this, &QgsRasterLayerSaveAsDialog::mFormatComboBox_currentIndexChanged );
54 connect( mResolutionRadioButton, &QRadioButton::toggled,
this, &QgsRasterLayerSaveAsDialog::mResolutionRadioButton_toggled );
55 connect( mOriginalResolutionPushButton, &QPushButton::clicked,
this, &QgsRasterLayerSaveAsDialog::mOriginalResolutionPushButton_clicked );
56 connect( mXResolutionLineEdit, &QLineEdit::textEdited,
this, &QgsRasterLayerSaveAsDialog::mXResolutionLineEdit_textEdited );
57 connect( mYResolutionLineEdit, &QLineEdit::textEdited,
this, &QgsRasterLayerSaveAsDialog::mYResolutionLineEdit_textEdited );
58 connect( mOriginalSizePushButton, &QPushButton::clicked,
this, &QgsRasterLayerSaveAsDialog::mOriginalSizePushButton_clicked );
59 connect( mColumnsLineEdit, &QLineEdit::textEdited,
this, &QgsRasterLayerSaveAsDialog::mColumnsLineEdit_textEdited );
60 connect( mRowsLineEdit, &QLineEdit::textEdited,
this, &QgsRasterLayerSaveAsDialog::mRowsLineEdit_textEdited );
61 connect( mAddNoDataManuallyToolButton, &QPushButton::clicked,
this, &QgsRasterLayerSaveAsDialog::mAddNoDataManuallyToolButton_clicked );
62 connect( mLoadTransparentNoDataToolButton, &QPushButton::clicked,
this, &QgsRasterLayerSaveAsDialog::mLoadTransparentNoDataToolButton_clicked );
63 connect( mRemoveSelectedNoDataToolButton, &QPushButton::clicked,
this, &QgsRasterLayerSaveAsDialog::mRemoveSelectedNoDataToolButton_clicked );
64 connect( mRemoveAllNoDataToolButton, &QPushButton::clicked,
this, &QgsRasterLayerSaveAsDialog::mRemoveAllNoDataToolButton_clicked );
65 connect( mTileModeCheckBox, &QCheckBox::toggled,
this, &QgsRasterLayerSaveAsDialog::mTileModeCheckBox_toggled );
66 connect( mPyramidsGroupBox, &QgsCollapsibleGroupBox::toggled,
this, &QgsRasterLayerSaveAsDialog::mPyramidsGroupBox_toggled );
72 mNoDataTableWidget->setColumnCount( 2 );
73 mNoDataTableWidget->setHorizontalHeaderItem( 0,
new QTableWidgetItem( tr(
"From" ) ) );
74 mNoDataTableWidget->setHorizontalHeaderItem( 1,
new QTableWidgetItem( tr(
"To" ) ) );
76 mRawModeRadioButton_toggled(
true );
80 toggleResolutionSize();
82 insertAvailableOutputFormats();
89 setOriginalResolution();
90 int xSize = mDataProvider->
xSize();
91 int ySize = mDataProvider->
ySize();
92 mMaximumSizeXLineEdit->setText( QString::number( xSize ) );
93 mMaximumSizeYLineEdit->setText( QString::number( ySize ) );
97 mTileModeCheckBox->setChecked(
true );
98 mMaximumSizeXLineEdit->setText( QString::number( 2000 ) );
99 mMaximumSizeYLineEdit->setText( QString::number( 2000 ) );
103 mCreateOptionsWidget->setProvider( mDataProvider->
name() );
104 if ( mDataProvider->
name() == QLatin1String(
"gdal" ) )
106 mCreateOptionsWidget->setFormat( mFormatComboBox->currentData().toString() );
108 mCreateOptionsWidget->setRasterLayer( mRasterLayer );
109 mCreateOptionsWidget->update();
117 mPyramidsOptionsWidget->createOptionsWidget()->setRasterLayer( mRasterLayer );
122 mPyramidsUseExistingCheckBox->setEnabled(
false );
123 mPyramidsUseExistingCheckBox->setVisible(
false );
125 populatePyramidsLevels();
127 this, &QgsRasterLayerSaveAsDialog::populatePyramidsLevels );
131 mPyramidsGroupBox->setEnabled(
false );
136 mCreateOptionsGroupBox->setSaveCheckedState(
true );
146 mCrsSelector->setSourceEnsemble( ensemble.
name() );
152 mCrsSelector->setShowAccuracyWarnings(
true );
154 mCrsSelector->setLayerCrs( mLayerCrs );
156 mCrsSelector->setCrs( mLayerCrs );
159 this, &QgsRasterLayerSaveAsDialog::crsChanged );
161 QPushButton *okButton = mButtonBox->button( QDialogButtonBox::Ok );
164 okButton->setEnabled(
false );
168 mHelpButtonBox->setVisible(
false );
169 mButtonBox->addButton( QDialogButtonBox::Help );
170 connect( mButtonBox, &QDialogButtonBox::helpRequested,
this, &QgsRasterLayerSaveAsDialog::showHelp );
172 connect( mHelpButtonBox, &QDialogButtonBox::helpRequested,
this, &QgsRasterLayerSaveAsDialog::showHelp );
175 connect( mButtonBox, &QDialogButtonBox::rejected,
this, &QgsRasterLayerSaveAsDialog::reject );
177 mExtentGroupBox->setOutputCrs(
outputCrs() );
178 mExtentGroupBox->setOriginalExtent( mDataProvider->
extent(), mLayerCrs );
179 mExtentGroupBox->setCurrentExtent( mCurrentExtent, mCurrentCrs );
180 mExtentGroupBox->setOutputExtentFromOriginal();
183 recalcResolutionSize();
187 if ( mTileModeCheckBox->isChecked() )
189 mTilesGroupBox->show();
191 mFilename->setDialogTitle( tr(
"Select Output Directory" ) );
195 mTilesGroupBox->hide();
197 mFilename->setDialogTitle( tr(
"Save Layer As" ) );
200 mFilename->setDefaultRoot( settings.
value( QStringLiteral(
"UI/lastRasterFileDir" ), QDir::homePath() ).toString() );
204 QFileInfo tmplFileInfo( filePath );
205 settings.
setValue( QStringLiteral(
"UI/lastRasterFileDir" ), tmplFileInfo.absolutePath() );
207 if ( !filePath.isEmpty() && mLayerName->isEnabled() )
209 QFileInfo fileInfo( filePath );
210 mLayerName->setText( fileInfo.baseName() );
213 if ( mTileModeCheckBox->isChecked() )
215 QString fileName = filePath;
220 if ( fileName.isEmpty() )
224 QDir dir( fileName );
225 QString baseName = QFileInfo( fileName ).baseName();
227 filters << QStringLiteral(
"%1.*" ).arg( baseName );
228 QStringList files = dir.entryList( filters );
229 if ( files.isEmpty() )
232 if ( QMessageBox::warning(
this, tr(
"Save Raster Layer" ),
233 tr(
"The directory %1 contains files which will be overwritten: %2" ).arg( dir.absolutePath(), files.join( QLatin1String(
", " ) ) ),
234 QMessageBox::Ok | QMessageBox::Cancel ) == QMessageBox::Ok )
237 fileName = QFileDialog::getExistingDirectory(
this, tr(
"Select output directory" ), tmplFileInfo.absolutePath() );
241 QPushButton *okButton = mButtonBox->button( QDialogButtonBox::Ok );
246 okButton->setEnabled( tmplFileInfo.absoluteDir().exists() );
250void QgsRasterLayerSaveAsDialog::insertAvailableOutputFormats()
254 int nDrivers = GDALGetDriverCount();
255 QMap< int, QPair< QString, QString > > topPriorityDrivers;
256 QMap< QString, QString > lowPriorityDrivers;
258 for (
int i = 0; i < nDrivers; ++i )
260 GDALDriverH driver = GDALGetDriver( i );
265 QString driverShortName = GDALGetDriverShortName( driver );
266 QString driverLongName = GDALGetDriverLongName( driver );
267 if ( driverShortName == QLatin1String(
"MEM" ) )
274 else if ( driverShortName == QLatin1String(
"VRT" ) )
279 else if ( driverShortName == QLatin1String(
"GTiff" ) )
282 topPriorityDrivers.insert( 1, qMakePair( driverLongName, driverShortName ) );
284 else if ( driverShortName == QLatin1String(
"GPKG" ) )
287 topPriorityDrivers.insert( 2, qMakePair( driverLongName, driverShortName ) );
291 lowPriorityDrivers.insert( driverLongName, driverShortName );
298 for (
auto priorityDriversIt = topPriorityDrivers.constBegin(); priorityDriversIt != topPriorityDrivers.constEnd(); ++priorityDriversIt )
300 mFormatComboBox->addItem( priorityDriversIt.value().first, priorityDriversIt.value().second );
303 for (
auto lowPriorityDriversIt = lowPriorityDrivers.constBegin(); lowPriorityDriversIt != lowPriorityDrivers.constEnd(); ++lowPriorityDriversIt )
305 mFormatComboBox->addItem( lowPriorityDriversIt.key(), lowPriorityDriversIt.value() );
310void QgsRasterLayerSaveAsDialog::setValidators()
314 mColumnsLineEdit->setValidator(
new QIntValidator(
this ) );
315 mRowsLineEdit->setValidator(
new QIntValidator(
this ) );
316 mMaximumSizeXLineEdit->setValidator(
new QIntValidator(
this ) );
317 mMaximumSizeYLineEdit->setValidator(
new QIntValidator(
this ) );
320void QgsRasterLayerSaveAsDialog::mFormatComboBox_currentIndexChanged(
const QString & )
323 if ( mDataProvider && mDataProvider->
name() == QLatin1String(
"gdal" ) )
326 mCreateOptionsWidget->update();
331 if ( extensions.empty() )
332 filter = tr(
"All files (*.*)" );
335 filter = QStringLiteral(
"%1 (*.%2);;%3" ).arg( mFormatComboBox->currentText(),
336 extensions.join( QLatin1String(
" *." ) ),
337 tr(
"All files (*.*)" ) );
339 mFilename->setFilter( filter );
342 mTileModeCheckBox->setEnabled(
outputFormat() != QLatin1String(
"GPKG" ) );
343 mFilename->setConfirmOverwrite(
outputFormat() != QLatin1String(
"GPKG" ) );
344 mLayerName->setEnabled(
outputFormat() == QLatin1String(
"GPKG" ) );
345 if ( mLayerName->isEnabled() )
347 QString layerName = QFileInfo( mFilename->filePath() ).baseName();
348 mLayerName->setText( layerName );
349 mTileModeCheckBox->setChecked(
false );
353 mLayerName->setText( QString() );
359 return mColumnsLineEdit->text().toInt();
364 return mRowsLineEdit->text().toInt();
379 return mMaximumSizeXLineEdit->text().toInt();
384 return mMaximumSizeYLineEdit->text().toInt();
389 return mTileModeCheckBox->isChecked();
394 return mAddToCanvas->isChecked();
399 mAddToCanvas->setChecked( checked );
404 QString fileName = mFilename->filePath();
410 if ( !extensions.empty() )
412 defaultExt = extensions.at( 0 );
416 QFileInfo fi( fileName );
417 if ( !fileName.isEmpty() && fi.suffix().isEmpty() && !defaultExt.isEmpty() )
419 fileName +=
'.' + defaultExt;
428 if ( mLayerName->text().isEmpty() &&
outputFormat() == QLatin1String(
"GPKG" ) && !mTileModeCheckBox->isChecked() )
431 return QFileInfo( mFilename->filePath() ).baseName();
435 return mLayerName->text();
441 return mFormatComboBox->currentData().toString();
446 QStringList options = mCreateOptionsGroupBox->isChecked() ? mCreateOptionsWidget->options() : QStringList();
450 int indx = options.indexOf( QRegularExpression(
"^RASTER_TABLE=.*", QRegularExpression::CaseInsensitiveOption | QRegularExpression::MultilineOption ) );
453 options.replace( indx, QStringLiteral(
"RASTER_TABLE=%1" ).arg(
outputLayerName() ) );
457 options.append( QStringLiteral(
"RASTER_TABLE=%1" ).arg(
outputLayerName() ) );
461 if ( !outputLayerExists() )
463 indx = options.indexOf( QRegularExpression(
"^APPEND_SUBDATASET=.*", QRegularExpression::CaseInsensitiveOption | QRegularExpression::MultilineOption ) );
466 options.replace( indx, QStringLiteral(
"APPEND_SUBDATASET=YES" ) );
470 options.append( QStringLiteral(
"APPEND_SUBDATASET=YES" ) );
479 return mExtentGroupBox->outputExtent();
484 mFormatLabel->hide();
485 mFormatComboBox->hide();
490 mSaveAsLabel->hide();
492 QPushButton *okButton = mButtonBox->button( QDialogButtonBox::Ok );
495 okButton->setEnabled(
true );
499void QgsRasterLayerSaveAsDialog::toggleResolutionSize()
503 bool on = mResolutionRadioButton->isChecked();
504 mXResolutionLineEdit->setEnabled( on );
505 mYResolutionLineEdit->setEnabled( on );
506 mOriginalResolutionPushButton->setEnabled( on && hasResolution );
507 mColumnsLineEdit->setEnabled( !on );
508 mRowsLineEdit->setEnabled( !on );
509 mOriginalSizePushButton->setEnabled( !on && hasResolution );
512void QgsRasterLayerSaveAsDialog::setOriginalResolution()
524 xRes = yRes = mDataProvider->
extent().
width() / 100;
526 setResolution( xRes, yRes, mLayerCrs );
542 QgsPointXY srsCenter = ct.transform( center, Qgis::TransformDirection::Reverse );
544 QgsRectangle srcExtent( srsCenter.
x() - xRes / 2, srsCenter.
y() - yRes / 2, srsCenter.
x() + xRes / 2, srsCenter.
y() + yRes / 2 );
547 xRes = extent.
width();
550 mXResolutionLineEdit->setText( QLocale().toString( xRes ) );
551 mYResolutionLineEdit->setText( QLocale().toString( yRes ) );
554void QgsRasterLayerSaveAsDialog::recalcSize()
559 mColumnsLineEdit->setText( QString::number( xSize ) );
560 mRowsLineEdit->setText( QString::number( ySize ) );
561 updateResolutionStateMsg();
564void QgsRasterLayerSaveAsDialog::setOriginalSize()
566 mColumnsLineEdit->setText( QString::number( mDataProvider->
xSize() ) );
567 mRowsLineEdit->setText( QString::number( mDataProvider->
ySize() ) );
571void QgsRasterLayerSaveAsDialog::recalcResolution()
576 mXResolutionLineEdit->setText( QLocale().toString( xRes ) );
577 mYResolutionLineEdit->setText( QLocale().toString( yRes ) );
578 updateResolutionStateMsg();
581void QgsRasterLayerSaveAsDialog::recalcResolutionSize()
583 if ( mResolutionRadioButton->isChecked() )
594void QgsRasterLayerSaveAsDialog::updateResolutionStateMsg()
597 switch ( mResolutionState )
603 msg = tr(
"user defined" );
608 msg = tr(
"Resolution (current: %1)" ).arg( msg );
609 mResolutionGroupBox->setTitle( msg );
612void QgsRasterLayerSaveAsDialog::extentChanged()
615 if ( mSizeRadioButton->isChecked() )
619 recalcResolutionSize();
622void QgsRasterLayerSaveAsDialog::crsChanged()
626 mExtentGroupBox->setOutputCrs(
outputCrs() );
629 if ( mResolutionRadioButton->isChecked() )
633 setOriginalResolution();
652 return mCrsSelector->crs();
661void QgsRasterLayerSaveAsDialog::mRawModeRadioButton_toggled(
bool checked )
663 mNoDataGroupBox->setEnabled( checked && mDataProvider->
bandCount() == 1 );
666void QgsRasterLayerSaveAsDialog::mAddNoDataManuallyToolButton_clicked()
668 addNoDataRow( std::numeric_limits<double>::quiet_NaN(), std::numeric_limits<double>::quiet_NaN() );
671void QgsRasterLayerSaveAsDialog::mLoadTransparentNoDataToolButton_clicked()
673 if ( !mRasterLayer->
renderer() )
return;
675 if ( !rasterTransparency )
return;
680 if ( transparencyPixel.percentTransparent == 100 )
682 addNoDataRow( transparencyPixel.min, transparencyPixel.max );
683 if ( transparencyPixel.min != transparencyPixel.max )
685 setNoDataToEdited( mNoDataTableWidget->rowCount() - 1 );
691void QgsRasterLayerSaveAsDialog::mRemoveSelectedNoDataToolButton_clicked()
693 mNoDataTableWidget->removeRow( mNoDataTableWidget->currentRow() );
696void QgsRasterLayerSaveAsDialog::mRemoveAllNoDataToolButton_clicked()
698 while ( mNoDataTableWidget->rowCount() > 0 )
700 mNoDataTableWidget->removeRow( 0 );
704void QgsRasterLayerSaveAsDialog::addNoDataRow(
double min,
double max )
706 mNoDataTableWidget->insertRow( mNoDataTableWidget->rowCount() );
707 for (
int i = 0; i < 2; i++ )
709 double value = i == 0 ? min : max;
710 QLineEdit *lineEdit =
new QLineEdit();
711 lineEdit->setFrame(
false );
712 lineEdit->setContentsMargins( 1, 1, 1, 1 );
719 if ( !std::isnan( value ) )
725 lineEdit->setValidator(
new QIntValidator(
nullptr ) );
726 if ( !std::isnan( value ) )
728 valueString = QLocale().toString(
static_cast<int>( value ) );
732 lineEdit->setText( valueString );
733 mNoDataTableWidget->setCellWidget( mNoDataTableWidget->rowCount() - 1, i, lineEdit );
735 adjustNoDataCellWidth( mNoDataTableWidget->rowCount() - 1, i );
737 connect( lineEdit, &QLineEdit::textEdited,
this, &QgsRasterLayerSaveAsDialog::noDataCellTextEdited );
739 mNoDataTableWidget->resizeColumnsToContents();
740 mNoDataTableWidget->resizeRowsToContents();
743void QgsRasterLayerSaveAsDialog::noDataCellTextEdited(
const QString &text )
747 QLineEdit *lineEdit = qobject_cast<QLineEdit *>( sender() );
748 if ( !lineEdit )
return;
751 for (
int r = 0; r < mNoDataTableWidget->rowCount(); r++ )
753 for (
int c = 0;
c < mNoDataTableWidget->columnCount();
c++ )
755 if ( mNoDataTableWidget->cellWidget( r,
c ) == sender() )
762 if ( row != -1 )
break;
764 QgsDebugMsg( QStringLiteral(
"row = %1 column =%2" ).arg( row ).arg( column ) );
768 QLineEdit *toLineEdit =
dynamic_cast<QLineEdit *
>( mNoDataTableWidget->cellWidget( row, 1 ) );
769 if ( !toLineEdit )
return;
770 bool toChanged = mNoDataToEdited.value( row );
771 QgsDebugMsg( QStringLiteral(
"toChanged = %1" ).arg( toChanged ) );
774 toLineEdit->setText( lineEdit->text() );
777 else if ( column == 1 )
779 setNoDataToEdited( row );
783void QgsRasterLayerSaveAsDialog::mTileModeCheckBox_toggled(
bool toggled )
802 mTilesGroupBox->show();
804 mFilename->setDialogTitle( tr(
"Select Output Directory" ) );
808 mTilesGroupBox->hide();
810 mFilename->setDialogTitle( tr(
"Save Layer As" ) );
814void QgsRasterLayerSaveAsDialog::mPyramidsGroupBox_toggled(
bool toggled )
817 populatePyramidsLevels();
820void QgsRasterLayerSaveAsDialog::populatePyramidsLevels()
824 if ( mPyramidsGroupBox->isChecked() )
826 QList<QgsRasterPyramid> myPyramidList;
829 if ( mPyramidsUseExistingCheckBox->isChecked() )
835 if ( ! mPyramidsOptionsWidget->overviewList().isEmpty() )
836 myPyramidList = mDataProvider->
buildPyramidList( mPyramidsOptionsWidget->overviewList() );
840 if ( ! mPyramidsUseExistingCheckBox->isChecked() || pyramid.getExists() )
842 text += QString::number( pyramid.getXDim() ) + QStringLiteral(
"x" ) +
843 QString::number( pyramid.getYDim() ) +
' ';
848 mPyramidResolutionsLineEdit->setText( text.trimmed() );
851void QgsRasterLayerSaveAsDialog::setNoDataToEdited(
int row )
853 if ( row >= mNoDataToEdited.size() )
855 mNoDataToEdited.resize( row + 1 );
857 mNoDataToEdited[row] =
true;
860double QgsRasterLayerSaveAsDialog::noDataCellValue(
int row,
int column )
const
862 QLineEdit *lineEdit =
dynamic_cast<QLineEdit *
>( mNoDataTableWidget->cellWidget( row, column ) );
863 if ( !lineEdit || lineEdit->text().isEmpty() )
865 return std::numeric_limits<double>::quiet_NaN();
870void QgsRasterLayerSaveAsDialog::adjustNoDataCellWidth(
int row,
int column )
872 QLineEdit *lineEdit =
dynamic_cast<QLineEdit *
>( mNoDataTableWidget->cellWidget( row, column ) );
873 if ( !lineEdit )
return;
875 int width = std::max( lineEdit->fontMetrics().boundingRect( lineEdit->text() ).width() + 10, 100 );
876 width = std::max( width, mNoDataTableWidget->columnWidth( column ) );
878 lineEdit->setFixedWidth( width );
884 if ( ! mNoDataGroupBox->isChecked() )
887 int rows = mNoDataTableWidget->rowCount();
888 noDataList.reserve( rows );
889 for (
int r = 0; r < rows; r++ )
892 noDataList.append(
noData );
900 return mPyramidsGroupBox->isChecked() ? mPyramidsOptionsWidget->overviewList() : QList<int>();
905 if ( ! mPyramidsGroupBox->isChecked() )
906 return Qgis::RasterBuildPyramidOption::No;
907 else if ( mPyramidsUseExistingCheckBox->isChecked() )
908 return Qgis::RasterBuildPyramidOption::CopyExisting;
910 return Qgis::RasterBuildPyramidOption::Yes;
913bool QgsRasterLayerSaveAsDialog::validate()
const
915 if ( mCreateOptionsGroupBox->isChecked() )
917 QString message = mCreateOptionsWidget->validateOptions(
true,
false );
918 if ( !message.isNull() )
921 if ( mPyramidsGroupBox->isChecked() )
923 QString message = mPyramidsOptionsWidget->createOptionsWidget()->validateOptions(
true,
false );
924 if ( !message.isNull() )
930bool QgsRasterLayerSaveAsDialog::outputLayerExists()
const
944 QgsRasterLayer rasterLayer( rasterUri, QString( ), QStringLiteral(
"gdal" ) );
945 if ( !vectorUri.isEmpty() )
947 QgsVectorLayer vectorLayer( vectorUri, QString( ), QStringLiteral(
"ogr" ) );
948 return rasterLayer.isValid() || vectorLayer.isValid();
952 return rasterLayer.isValid();
963 if (
outputFormat() == QLatin1String(
"GPKG" ) && outputLayerExists() &&
964 QMessageBox::warning(
this, tr(
"Save Raster Layer" ),
965 tr(
"The layer %1 already exists in the target file, and overwriting layers in GeoPackage is not supported. "
967 QMessageBox::Yes | QMessageBox::No ) == QMessageBox::No )
975void QgsRasterLayerSaveAsDialog::showHelp()
977 QgsHelp::openHelp( QStringLiteral(
"managing_data_source/create_layers.html#creating-new-layers-from-an-existing-layer" ) );
@ Float32
Thirty two bit floating point (float)
@ Float64
Sixty four bit floating point (double)
RasterBuildPyramidOption
Raster pyramid building options.
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
This class represents a coordinate reference system (CRS).
QgsDatumEnsemble datumEnsemble() const SIP_THROW(QgsNotSupportedException)
Attempts to retrieve datum ensemble details from the CRS.
virtual QString name() const =0
Returns a provider name.
Contains information about a datum ensemble.
bool isValid() const
Returns true if the datum ensemble is a valid object, or false if it is a null/invalid object.
QString name() const
Display name of datum ensemble.
QgsDoubleValidator is a QLineEdit Validator that combines QDoubleValidator and QRegularExpressionVali...
static double toDouble(const QString &input, bool *ok)
Converts input string to double value.
void extentChanged(const QgsRectangle &r)
Emitted when the widget's extent is changed.
static bool supportsRasterCreate(GDALDriverH driver)
Reads whether a driver supports GDALCreate() for raster purposes.
static void enableAutoGeometryRestore(QWidget *widget, const QString &key=QString())
Register the widget to allow its position to be automatically saved and restored when open and closed...
static void openHelp(const QString &key)
Opens help topic for the given help key using default system web browser.
Custom exception class which is raised when an operation is not supported.
A class to represent a 2D point.
static QgsProject * instance()
Returns the QgsProject singleton instance.
static QString printValue(double value)
Print double value with all necessary significant digits.
Base class for raster data providers.
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...
QgsRectangle extent() const override=0
Returns the extent of the layer.
virtual QList< QgsRasterPyramid > buildPyramidList(const QList< int > &overviewList=QList< int >())
Returns the raster layers pyramid list.
static QStringList extensionsForFormat(const QString &format)
Returns a list of known file extensions for the given GDAL driver format.
@ BuildPyramids
Supports building of pyramids (overviews)
@ Size
Original data source size (and thus resolution) is known, it is not always available,...
virtual int xSize() const
Gets raster size.
virtual int bandCount() const =0
Gets number of bands.
virtual int capabilities() const
Returns a bitmask containing the supported capabilities.
virtual int ySize() const
double xResolution() const
double yResolution() const
QgsRasterRangeList noData() const
int maximumTileSizeX() const
QString outputLayerName() const
Name of the output layer within GeoPackage file.
QList< int > pyramidsList() const
Qgis::RasterBuildPyramidOption buildPyramidsFlag() const
Returns the pyramid building option.
QString outputFormat() const
QgsRectangle outputRectangle() const
QgsRasterLayerSaveAsDialog(QgsRasterLayer *rasterLayer, QgsRasterDataProvider *sourceProvider, const QgsRectangle ¤tExtent, const QgsCoordinateReferenceSystem &layerCrs, const QgsCoordinateReferenceSystem ¤tCrs, QWidget *parent SIP_TRANSFERTHIS=nullptr, Qt::WindowFlags f=Qt::WindowFlags())
Constructor for QgsRasterLayerSaveAsDialog.
bool addToCanvas() const
Returns true if the "add to canvas" checkbox is checked.
QStringList createOptions() const
int maximumTileSizeY() const
void setAddToCanvas(bool checked)
Sets whether the "add to canvas" checkbox should be checked.
QgsCoordinateReferenceSystem outputCrs()
QString outputFileName() const
Represents a raster layer.
QgsRasterRenderer * renderer() const
Returns the raster's renderer.
QgsRasterDataProvider * dataProvider() override
Returns the source data provider.
This struct is used to store pyramid info for the raster layer.
Raster values range container.
const QgsRasterTransparency * rasterTransparency() const
Defines the list of pixel values to be considered as transparent or semi transparent when rendering r...
QList< QgsRasterTransparency::TransparentSingleValuePixel > transparentSingleValuePixelList() const
Returns the transparent single value pixel list.
A rectangle specified with double values.
double height() const SIP_HOLDGIL
Returns the height of the rectangle.
double width() const SIP_HOLDGIL
Returns the width of the rectangle.
QgsPointXY center() const SIP_HOLDGIL
Returns the center point of the rectangle.
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.
void setValue(const QString &key, const QVariant &value, QgsSettings::Section section=QgsSettings::NoSection)
Sets the value of setting key to value.
Represents a vector layer which manages a vector based data sets.
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
QList< QgsRasterRange > QgsRasterRangeList