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();
118 mPyramidsOptionsWidget->createOptionsWidget()->setRasterLayer( mRasterLayer );
123 mPyramidsUseExistingCheckBox->setEnabled(
false );
124 mPyramidsUseExistingCheckBox->setVisible(
false );
126 populatePyramidsLevels();
128 this, &QgsRasterLayerSaveAsDialog::populatePyramidsLevels );
132 mPyramidsGroupBox->setEnabled(
false );
133 mPyramidsGroupBox->setCollapsed(
true );
138 mCreateOptionsGroupBox->setSaveCheckedState(
true );
148 mCrsSelector->setSourceEnsemble( ensemble.
name() );
154 mCrsSelector->setShowAccuracyWarnings(
true );
156 mCrsSelector->setLayerCrs( mLayerCrs );
158 mCrsSelector->setCrs( mLayerCrs );
161 this, &QgsRasterLayerSaveAsDialog::crsChanged );
163 QPushButton *okButton = mButtonBox->button( QDialogButtonBox::Ok );
166 okButton->setEnabled(
false );
170 mHelpButtonBox->setVisible(
false );
171 mButtonBox->addButton( QDialogButtonBox::Help );
172 connect( mButtonBox, &QDialogButtonBox::helpRequested,
this, &QgsRasterLayerSaveAsDialog::showHelp );
174 connect( mHelpButtonBox, &QDialogButtonBox::helpRequested,
this, &QgsRasterLayerSaveAsDialog::showHelp );
177 connect( mButtonBox, &QDialogButtonBox::rejected,
this, &QgsRasterLayerSaveAsDialog::reject );
179 mExtentGroupBox->setOutputCrs(
outputCrs() );
180 mExtentGroupBox->setOriginalExtent( mDataProvider->
extent(), mLayerCrs );
181 mExtentGroupBox->setCurrentExtent( mCurrentExtent, mCurrentCrs );
182 mExtentGroupBox->setOutputExtentFromOriginal();
185 recalcResolutionSize();
189 if ( mTileModeCheckBox->isChecked() )
191 mTilesGroupBox->show();
193 mFilename->setDialogTitle( tr(
"Select Output Directory" ) );
197 mTilesGroupBox->hide();
199 mFilename->setDialogTitle( tr(
"Save Layer As" ) );
202 mFilename->setDefaultRoot( settings.
value( QStringLiteral(
"UI/lastRasterFileDir" ), QDir::homePath() ).toString() );
206 QFileInfo tmplFileInfo( filePath );
207 settings.
setValue( QStringLiteral(
"UI/lastRasterFileDir" ), tmplFileInfo.absolutePath() );
209 if ( !filePath.isEmpty() && mLayerName->isEnabled() )
211 QFileInfo fileInfo( filePath );
212 mLayerName->setText( fileInfo.baseName() );
215 if ( mTileModeCheckBox->isChecked() )
217 QString fileName = filePath;
222 if ( fileName.isEmpty() )
226 QDir dir( fileName );
227 QString baseName = QFileInfo( fileName ).baseName();
229 filters << QStringLiteral(
"%1.*" ).arg( baseName );
230 QStringList files = dir.entryList( filters );
231 if ( files.isEmpty() )
234 if ( QMessageBox::warning(
this, tr(
"Save Raster Layer" ),
235 tr(
"The directory %1 contains files which will be overwritten: %2" ).arg( dir.absolutePath(), files.join( QLatin1String(
", " ) ) ),
236 QMessageBox::Ok | QMessageBox::Cancel ) == QMessageBox::Ok )
239 fileName = QFileDialog::getExistingDirectory(
this, tr(
"Select output directory" ), tmplFileInfo.absolutePath() );
243 QPushButton *okButton = mButtonBox->button( QDialogButtonBox::Ok );
248 okButton->setEnabled( tmplFileInfo.absoluteDir().exists() );
252void QgsRasterLayerSaveAsDialog::insertAvailableOutputFormats()
256 int nDrivers = GDALGetDriverCount();
257 QMap< int, QPair< QString, QString > > topPriorityDrivers;
258 QMap< QString, QString > lowPriorityDrivers;
260 for (
int i = 0; i < nDrivers; ++i )
262 GDALDriverH driver = GDALGetDriver( i );
267 QString driverShortName = GDALGetDriverShortName( driver );
268 QString driverLongName = GDALGetDriverLongName( driver );
269 if ( driverShortName == QLatin1String(
"MEM" ) )
276 else if ( driverShortName == QLatin1String(
"VRT" ) )
281 else if ( driverShortName == QLatin1String(
"GTiff" ) )
284 topPriorityDrivers.insert( 1, qMakePair( driverLongName, driverShortName ) );
286 else if ( driverShortName == QLatin1String(
"GPKG" ) )
289 topPriorityDrivers.insert( 2, qMakePair( driverLongName, driverShortName ) );
293 lowPriorityDrivers.insert( driverLongName, driverShortName );
300 for (
auto priorityDriversIt = topPriorityDrivers.constBegin(); priorityDriversIt != topPriorityDrivers.constEnd(); ++priorityDriversIt )
302 mFormatComboBox->addItem( priorityDriversIt.value().first, priorityDriversIt.value().second );
305 for (
auto lowPriorityDriversIt = lowPriorityDrivers.constBegin(); lowPriorityDriversIt != lowPriorityDrivers.constEnd(); ++lowPriorityDriversIt )
307 mFormatComboBox->addItem( lowPriorityDriversIt.key(), lowPriorityDriversIt.value() );
312void QgsRasterLayerSaveAsDialog::setValidators()
316 mColumnsLineEdit->setValidator(
new QIntValidator(
this ) );
317 mRowsLineEdit->setValidator(
new QIntValidator(
this ) );
318 mMaximumSizeXLineEdit->setValidator(
new QIntValidator(
this ) );
319 mMaximumSizeYLineEdit->setValidator(
new QIntValidator(
this ) );
322void QgsRasterLayerSaveAsDialog::mFormatComboBox_currentIndexChanged(
const QString & )
325 if ( mDataProvider && mDataProvider->
name() == QLatin1String(
"gdal" ) )
328 mCreateOptionsWidget->update();
333 if ( extensions.empty() )
334 filter = tr(
"All files (*.*)" );
337 filter = QStringLiteral(
"%1 (*.%2);;%3" ).arg( mFormatComboBox->currentText(),
338 extensions.join( QLatin1String(
" *." ) ),
339 tr(
"All files (*.*)" ) );
341 mFilename->setFilter( filter );
344 mTileModeCheckBox->setEnabled(
outputFormat() != QLatin1String(
"GPKG" ) );
345 mFilename->setConfirmOverwrite(
outputFormat() != QLatin1String(
"GPKG" ) );
346 mLayerName->setEnabled(
outputFormat() == QLatin1String(
"GPKG" ) );
347 if ( mLayerName->isEnabled() )
349 QString layerName = QFileInfo( mFilename->filePath() ).baseName();
350 mLayerName->setText( layerName );
351 mTileModeCheckBox->setChecked(
false );
355 mLayerName->setText( QString() );
361 return mColumnsLineEdit->text().toInt();
366 return mRowsLineEdit->text().toInt();
381 return mMaximumSizeXLineEdit->text().toInt();
386 return mMaximumSizeYLineEdit->text().toInt();
391 return mTileModeCheckBox->isChecked();
396 return mAddToCanvas->isChecked();
401 mAddToCanvas->setChecked( checked );
406 QString fileName = mFilename->filePath();
412 if ( !extensions.empty() )
414 defaultExt = extensions.at( 0 );
418 QFileInfo fi( fileName );
419 if ( !fileName.isEmpty() && fi.suffix().isEmpty() && !defaultExt.isEmpty() )
421 fileName +=
'.' + defaultExt;
430 if ( mLayerName->text().isEmpty() &&
outputFormat() == QLatin1String(
"GPKG" ) && !mTileModeCheckBox->isChecked() )
433 return QFileInfo( mFilename->filePath() ).baseName();
437 return mLayerName->text();
443 return mFormatComboBox->currentData().toString();
448 QStringList options = mCreateOptionsGroupBox->isChecked() ? mCreateOptionsWidget->options() : QStringList();
452 int indx = options.indexOf( QRegularExpression(
"^RASTER_TABLE=.*", QRegularExpression::CaseInsensitiveOption | QRegularExpression::MultilineOption ) );
455 options.replace( indx, QStringLiteral(
"RASTER_TABLE=%1" ).arg(
outputLayerName() ) );
459 options.append( QStringLiteral(
"RASTER_TABLE=%1" ).arg(
outputLayerName() ) );
463 if ( !outputLayerExists() )
465 indx = options.indexOf( QRegularExpression(
"^APPEND_SUBDATASET=.*", QRegularExpression::CaseInsensitiveOption | QRegularExpression::MultilineOption ) );
468 options.replace( indx, QStringLiteral(
"APPEND_SUBDATASET=YES" ) );
472 options.append( QStringLiteral(
"APPEND_SUBDATASET=YES" ) );
481 return mExtentGroupBox->outputExtent();
486 mFormatLabel->hide();
487 mFormatComboBox->hide();
492 mSaveAsLabel->hide();
494 QPushButton *okButton = mButtonBox->button( QDialogButtonBox::Ok );
497 okButton->setEnabled(
true );
501void QgsRasterLayerSaveAsDialog::toggleResolutionSize()
505 bool on = mResolutionRadioButton->isChecked();
506 mXResolutionLineEdit->setEnabled( on );
507 mYResolutionLineEdit->setEnabled( on );
508 mOriginalResolutionPushButton->setEnabled( on && hasResolution );
509 mColumnsLineEdit->setEnabled( !on );
510 mRowsLineEdit->setEnabled( !on );
511 mOriginalSizePushButton->setEnabled( !on && hasResolution );
514void QgsRasterLayerSaveAsDialog::setOriginalResolution()
526 xRes = yRes = mDataProvider->
extent().
width() / 100;
528 setResolution( xRes, yRes, mLayerCrs );
546 QgsRectangle srcExtent( srsCenter.
x() - xRes / 2, srsCenter.
y() - yRes / 2, srsCenter.
x() + xRes / 2, srsCenter.
y() + yRes / 2 );
549 xRes = extent.
width();
552 mXResolutionLineEdit->setText( QLocale().toString( xRes ) );
553 mYResolutionLineEdit->setText( QLocale().toString( yRes ) );
556void QgsRasterLayerSaveAsDialog::recalcSize()
561 mColumnsLineEdit->setText( QString::number( xSize ) );
562 mRowsLineEdit->setText( QString::number( ySize ) );
563 updateResolutionStateMsg();
566void QgsRasterLayerSaveAsDialog::setOriginalSize()
568 mColumnsLineEdit->setText( QString::number( mDataProvider->
xSize() ) );
569 mRowsLineEdit->setText( QString::number( mDataProvider->
ySize() ) );
573void QgsRasterLayerSaveAsDialog::recalcResolution()
578 mXResolutionLineEdit->setText( QLocale().toString( xRes ) );
579 mYResolutionLineEdit->setText( QLocale().toString( yRes ) );
580 updateResolutionStateMsg();
583void QgsRasterLayerSaveAsDialog::recalcResolutionSize()
585 if ( mResolutionRadioButton->isChecked() )
596void QgsRasterLayerSaveAsDialog::updateResolutionStateMsg()
599 switch ( mResolutionState )
605 msg = tr(
"user defined" );
610 msg = tr(
"Resolution (current: %1)" ).arg( msg );
611 mResolutionGroupBox->setTitle( msg );
614void QgsRasterLayerSaveAsDialog::extentChanged()
617 if ( mSizeRadioButton->isChecked() )
621 recalcResolutionSize();
624void QgsRasterLayerSaveAsDialog::crsChanged()
628 mExtentGroupBox->setOutputCrs(
outputCrs() );
631 if ( mResolutionRadioButton->isChecked() )
635 setOriginalResolution();
654 return mCrsSelector->crs();
663void QgsRasterLayerSaveAsDialog::mRawModeRadioButton_toggled(
bool checked )
665 mNoDataGroupBox->setEnabled( checked && mDataProvider->
bandCount() == 1 );
666 mNoDataGroupBox->setCollapsed( !mNoDataGroupBox->isEnabled() );
669void QgsRasterLayerSaveAsDialog::mAddNoDataManuallyToolButton_clicked()
671 addNoDataRow( std::numeric_limits<double>::quiet_NaN(), std::numeric_limits<double>::quiet_NaN() );
674void QgsRasterLayerSaveAsDialog::mLoadTransparentNoDataToolButton_clicked()
676 if ( !mRasterLayer->
renderer() )
return;
678 if ( !rasterTransparency )
return;
685 addNoDataRow( transparencyPixel.min, transparencyPixel.max );
686 if ( transparencyPixel.min != transparencyPixel.max )
688 setNoDataToEdited( mNoDataTableWidget->rowCount() - 1 );
694void QgsRasterLayerSaveAsDialog::mRemoveSelectedNoDataToolButton_clicked()
696 mNoDataTableWidget->removeRow( mNoDataTableWidget->currentRow() );
699void QgsRasterLayerSaveAsDialog::mRemoveAllNoDataToolButton_clicked()
701 while ( mNoDataTableWidget->rowCount() > 0 )
703 mNoDataTableWidget->removeRow( 0 );
707void QgsRasterLayerSaveAsDialog::addNoDataRow(
double min,
double max )
709 mNoDataTableWidget->insertRow( mNoDataTableWidget->rowCount() );
710 for (
int i = 0; i < 2; i++ )
712 double value = i == 0 ? min : max;
713 QLineEdit *lineEdit =
new QLineEdit();
714 lineEdit->setFrame(
false );
715 lineEdit->setContentsMargins( 1, 1, 1, 1 );
722 if ( !std::isnan( value ) )
728 lineEdit->setValidator(
new QIntValidator(
nullptr ) );
729 if ( !std::isnan( value ) )
731 valueString = QLocale().toString(
static_cast<int>( value ) );
735 lineEdit->setText( valueString );
736 mNoDataTableWidget->setCellWidget( mNoDataTableWidget->rowCount() - 1, i, lineEdit );
738 adjustNoDataCellWidth( mNoDataTableWidget->rowCount() - 1, i );
740 connect( lineEdit, &QLineEdit::textEdited,
this, &QgsRasterLayerSaveAsDialog::noDataCellTextEdited );
742 mNoDataTableWidget->resizeColumnsToContents();
743 mNoDataTableWidget->resizeRowsToContents();
746void QgsRasterLayerSaveAsDialog::noDataCellTextEdited(
const QString &text )
750 QLineEdit *lineEdit = qobject_cast<QLineEdit *>( sender() );
751 if ( !lineEdit )
return;
754 for (
int r = 0; r < mNoDataTableWidget->rowCount(); r++ )
756 for (
int c = 0;
c < mNoDataTableWidget->columnCount();
c++ )
758 if ( mNoDataTableWidget->cellWidget( r,
c ) == sender() )
765 if ( row != -1 )
break;
767 QgsDebugMsgLevel( QStringLiteral(
"row = %1 column =%2" ).arg( row ).arg( column ), 2 );
771 QLineEdit *toLineEdit =
dynamic_cast<QLineEdit *
>( mNoDataTableWidget->cellWidget( row, 1 ) );
772 if ( !toLineEdit )
return;
773 bool toChanged = mNoDataToEdited.value( row );
777 toLineEdit->setText( lineEdit->text() );
780 else if ( column == 1 )
782 setNoDataToEdited( row );
786void QgsRasterLayerSaveAsDialog::mTileModeCheckBox_toggled(
bool toggled )
805 mTilesGroupBox->show();
807 mFilename->setDialogTitle( tr(
"Select Output Directory" ) );
811 mTilesGroupBox->hide();
813 mFilename->setDialogTitle( tr(
"Save Layer As" ) );
817void QgsRasterLayerSaveAsDialog::mPyramidsGroupBox_toggled(
bool toggled )
820 populatePyramidsLevels();
823void QgsRasterLayerSaveAsDialog::populatePyramidsLevels()
827 if ( mPyramidsGroupBox->isChecked() )
829 QList<QgsRasterPyramid> myPyramidList;
832 if ( mPyramidsUseExistingCheckBox->isChecked() )
838 if ( ! mPyramidsOptionsWidget->overviewList().isEmpty() )
839 myPyramidList = mDataProvider->
buildPyramidList( mPyramidsOptionsWidget->overviewList() );
843 if ( ! mPyramidsUseExistingCheckBox->isChecked() || pyramid.getExists() )
845 text += QString::number( pyramid.getXDim() ) + QStringLiteral(
"x" ) +
846 QString::number( pyramid.getYDim() ) +
' ';
851 mPyramidResolutionsLineEdit->setText( text.trimmed() );
854void QgsRasterLayerSaveAsDialog::setNoDataToEdited(
int row )
856 if ( row >= mNoDataToEdited.size() )
858 mNoDataToEdited.resize( row + 1 );
860 mNoDataToEdited[row] =
true;
863double QgsRasterLayerSaveAsDialog::noDataCellValue(
int row,
int column )
const
865 QLineEdit *lineEdit =
dynamic_cast<QLineEdit *
>( mNoDataTableWidget->cellWidget( row, column ) );
866 if ( !lineEdit || lineEdit->text().isEmpty() )
868 return std::numeric_limits<double>::quiet_NaN();
873void QgsRasterLayerSaveAsDialog::adjustNoDataCellWidth(
int row,
int column )
875 QLineEdit *lineEdit =
dynamic_cast<QLineEdit *
>( mNoDataTableWidget->cellWidget( row, column ) );
876 if ( !lineEdit )
return;
878 int width = std::max( lineEdit->fontMetrics().boundingRect( lineEdit->text() ).width() + 10, 100 );
879 width = std::max( width, mNoDataTableWidget->columnWidth( column ) );
881 lineEdit->setFixedWidth( width );
887 if ( ! mNoDataGroupBox->isChecked() )
890 int rows = mNoDataTableWidget->rowCount();
891 noDataList.reserve( rows );
892 for (
int r = 0; r < rows; r++ )
895 noDataList.append(
noData );
903 return mPyramidsGroupBox->isChecked() ? mPyramidsOptionsWidget->overviewList() : QList<int>();
908 if ( ! mPyramidsGroupBox->isChecked() )
910 else if ( mPyramidsUseExistingCheckBox->isChecked() )
916bool QgsRasterLayerSaveAsDialog::validate()
const
918 if ( mCreateOptionsGroupBox->isChecked() )
920 QString message = mCreateOptionsWidget->validateOptions(
true,
false );
921 if ( !message.isNull() )
924 if ( mPyramidsGroupBox->isChecked() )
926 QString message = mPyramidsOptionsWidget->createOptionsWidget()->validateOptions(
true,
false );
927 if ( !message.isNull() )
933bool QgsRasterLayerSaveAsDialog::outputLayerExists()
const
947 QgsRasterLayer rasterLayer( rasterUri, QString( ), QStringLiteral(
"gdal" ) );
948 if ( !vectorUri.isEmpty() )
950 QgsVectorLayer vectorLayer( vectorUri, QString( ), QStringLiteral(
"ogr" ) );
951 return rasterLayer.isValid() || vectorLayer.isValid();
955 return rasterLayer.isValid();
966 if (
outputFormat() == QLatin1String(
"GPKG" ) && outputLayerExists() &&
967 QMessageBox::warning(
this, tr(
"Save Raster Layer" ),
968 tr(
"The layer %1 already exists in the target file, and overwriting layers in GeoPackage is not supported. "
970 QMessageBox::Yes | QMessageBox::No ) == QMessageBox::No )
978void QgsRasterLayerSaveAsDialog::showHelp()
980 QgsHelp::openHelp( QStringLiteral(
"managing_data_source/create_layers.html#creating-new-layers-from-an-existing-layer" ) );
@ BuildPyramids
Supports building of pyramids (overviews) (since QGIS 3.38 – this is a replacement for RasterInterfac...
@ BuildPyramids
Supports building of pyramids (overviews) (Deprecated since QGIS 3.38 – use RasterProviderCapability:...
@ Size
Original data source size (and thus resolution) is known, it is not always available,...
@ Float32
Thirty two bit floating point (float)
@ Float64
Sixty four bit floating point (double)
RasterBuildPyramidOption
Raster pyramid building options.
@ CopyExisting
Copy existing.
@ Reverse
Reverse/inverse transform (from destination to source)
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
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, bool localized=false)
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 Qgis::RasterProviderCapabilities providerCapabilities() const
Returns flags containing the supported capabilities of the data provider.
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.
virtual Qgis::RasterInterfaceCapabilities capabilities() const
Returns the capabilities supported by the interface.
virtual int xSize() const
Gets raster size.
virtual int bandCount() const =0
Gets number of bands.
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...
QVector< QgsRasterTransparency::TransparentSingleValuePixel > transparentSingleValuePixelList() const
Returns the transparent single value pixel list.
A rectangle specified with double values.
double width() const
Returns the width of the rectangle.
QgsPointXY center() const
Returns the center point of the rectangle.
double height() const
Returns the height 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
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
#define QgsDebugMsgLevel(str, level)
QList< QgsRasterRange > QgsRasterRangeList
Defines the transparency for a range of single-band pixel values.