23#include "moc_qgsrasterlayersaveasdialog.cpp"
39#include <QRegularExpression>
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();
130 mPyramidsGroupBox->setEnabled(
false );
131 mPyramidsGroupBox->setCollapsed(
true );
136 mCreateOptionsGroupBox->setSaveCheckedState(
true );
146 mCrsSelector->setSourceEnsemble( ensemble.
name() );
152 mCrsSelector->setShowAccuracyWarnings(
true );
154 mCrsSelector->setLayerCrs( mLayerCrs );
156 mCrsSelector->setCrs( mLayerCrs );
160 QPushButton *okButton = mButtonBox->button( QDialogButtonBox::Ok );
163 okButton->setEnabled(
false );
167 mHelpButtonBox->setVisible(
false );
168 mButtonBox->addButton( QDialogButtonBox::Help );
169 connect( mButtonBox, &QDialogButtonBox::helpRequested,
this, &QgsRasterLayerSaveAsDialog::showHelp );
171 connect( mHelpButtonBox, &QDialogButtonBox::helpRequested,
this, &QgsRasterLayerSaveAsDialog::showHelp );
174 connect( mButtonBox, &QDialogButtonBox::rejected,
this, &QgsRasterLayerSaveAsDialog::reject );
176 mExtentGroupBox->setOutputCrs(
outputCrs() );
177 mExtentGroupBox->setOriginalExtent( mDataProvider->
extent(), mLayerCrs );
178 mExtentGroupBox->setCurrentExtent( mCurrentExtent, mCurrentCrs );
179 mExtentGroupBox->setOutputExtentFromOriginal();
182 recalcResolutionSize();
186 if ( mTileModeCheckBox->isChecked() )
188 mTilesGroupBox->show();
190 mFilename->setDialogTitle( tr(
"Select Output Directory" ) );
194 mTilesGroupBox->hide();
196 mFilename->setDialogTitle( tr(
"Save Layer As" ) );
199 mFilename->setDefaultRoot( settings.
value( QStringLiteral(
"UI/lastRasterFileDir" ), QDir::homePath() ).toString() );
202 QFileInfo tmplFileInfo( filePath );
203 settings.
setValue( QStringLiteral(
"UI/lastRasterFileDir" ), tmplFileInfo.absolutePath() );
205 if ( !filePath.isEmpty() && mLayerName->isEnabled() )
207 QFileInfo fileInfo( filePath );
208 mLayerName->setText( fileInfo.baseName() );
211 if ( mTileModeCheckBox->isChecked() )
213 QString fileName = filePath;
218 if ( fileName.isEmpty() )
222 QDir dir( fileName );
223 QString baseName = QFileInfo( fileName ).baseName();
225 filters << QStringLiteral(
"%1.*" ).arg( baseName );
226 QStringList files = dir.entryList( filters );
227 if ( files.isEmpty() )
230 if ( QMessageBox::warning(
this, tr(
"Save Raster Layer" ), tr(
"The directory %1 contains files which will be overwritten: %2" ).arg( dir.absolutePath(), files.join( QLatin1String(
", " ) ) ), QMessageBox::Ok | QMessageBox::Cancel ) == QMessageBox::Ok )
233 fileName = QFileDialog::getExistingDirectory(
this, tr(
"Select output directory" ), tmplFileInfo.absolutePath() );
237 QPushButton *okButton = mButtonBox->button( QDialogButtonBox::Ok );
242 okButton->setEnabled( tmplFileInfo.absoluteDir().exists() );
246void QgsRasterLayerSaveAsDialog::insertAvailableOutputFormats()
250 int nDrivers = GDALGetDriverCount();
251 QMap<int, QPair<QString, QString>> topPriorityDrivers;
252 QMap<QString, QString> lowPriorityDrivers;
254 for (
int i = 0; i < nDrivers; ++i )
256 GDALDriverH driver = GDALGetDriver( i );
261 QString driverShortName = GDALGetDriverShortName( driver );
262 QString driverLongName = GDALGetDriverLongName( driver );
263 if ( driverShortName == QLatin1String(
"MEM" ) )
270 else if ( driverShortName == QLatin1String(
"VRT" ) )
275 else if ( driverShortName == QLatin1String(
"GTiff" ) )
278 topPriorityDrivers.insert( 1, qMakePair( driverLongName, driverShortName ) );
280 else if ( driverShortName == QLatin1String(
"GPKG" ) )
283 topPriorityDrivers.insert( 2, qMakePair( driverLongName, driverShortName ) );
287 lowPriorityDrivers.insert( driverLongName, driverShortName );
294 for (
auto priorityDriversIt = topPriorityDrivers.constBegin(); priorityDriversIt != topPriorityDrivers.constEnd(); ++priorityDriversIt )
296 mFormatComboBox->addItem( priorityDriversIt.value().first, priorityDriversIt.value().second );
299 for (
auto lowPriorityDriversIt = lowPriorityDrivers.constBegin(); lowPriorityDriversIt != lowPriorityDrivers.constEnd(); ++lowPriorityDriversIt )
301 mFormatComboBox->addItem( lowPriorityDriversIt.key(), lowPriorityDriversIt.value() );
305void QgsRasterLayerSaveAsDialog::setValidators()
309 mColumnsLineEdit->setValidator(
new QIntValidator(
this ) );
310 mRowsLineEdit->setValidator(
new QIntValidator(
this ) );
311 mMaximumSizeXLineEdit->setValidator(
new QIntValidator(
this ) );
312 mMaximumSizeYLineEdit->setValidator(
new QIntValidator(
this ) );
315void QgsRasterLayerSaveAsDialog::mFormatComboBox_currentIndexChanged(
const QString & )
318 if ( mDataProvider && mDataProvider->
name() == QLatin1String(
"gdal" ) )
321 mCreateOptionsWidget->update();
326 if ( extensions.empty() )
327 filter = tr(
"All files (*.*)" );
330 filter = QStringLiteral(
"%1 (*.%2);;%3" ).arg( mFormatComboBox->currentText(), extensions.join( QLatin1String(
" *." ) ), tr(
"All files (*.*)" ) );
332 mFilename->setFilter( filter );
335 mTileModeCheckBox->setEnabled(
outputFormat() != QLatin1String(
"GPKG" ) );
336 mFilename->setConfirmOverwrite(
outputFormat() != QLatin1String(
"GPKG" ) );
337 mLayerName->setEnabled(
outputFormat() == QLatin1String(
"GPKG" ) );
338 if ( mLayerName->isEnabled() )
340 QString layerName = QFileInfo( mFilename->filePath() ).baseName();
341 mLayerName->setText( layerName );
342 mTileModeCheckBox->setChecked(
false );
346 mLayerName->setText( QString() );
352 return mColumnsLineEdit->text().toInt();
357 return mRowsLineEdit->text().toInt();
372 return mMaximumSizeXLineEdit->text().toInt();
377 return mMaximumSizeYLineEdit->text().toInt();
382 return mTileModeCheckBox->isChecked();
387 return mAddToCanvas->isChecked();
392 mAddToCanvas->setChecked( checked );
397 QString fileName = mFilename->filePath();
403 if ( !extensions.empty() )
405 defaultExt = extensions.at( 0 );
409 QFileInfo fi( fileName );
410 if ( !fileName.isEmpty() && fi.suffix().isEmpty() && !defaultExt.isEmpty() )
412 fileName +=
'.' + defaultExt;
421 if ( mLayerName->text().isEmpty() &&
outputFormat() == QLatin1String(
"GPKG" ) && !mTileModeCheckBox->isChecked() )
424 return QFileInfo( mFilename->filePath() ).baseName();
428 return mLayerName->text();
434 return mFormatComboBox->currentData().toString();
439 QStringList options = mCreateOptionsGroupBox->isChecked() ? mCreateOptionsWidget->options() : QStringList();
443 int indx = options.indexOf( QRegularExpression(
"^RASTER_TABLE=.*", QRegularExpression::CaseInsensitiveOption | QRegularExpression::MultilineOption ) );
446 options.replace( indx, QStringLiteral(
"RASTER_TABLE=%1" ).arg(
outputLayerName() ) );
450 options.append( QStringLiteral(
"RASTER_TABLE=%1" ).arg(
outputLayerName() ) );
454 if ( !outputLayerExists() )
456 indx = options.indexOf( QRegularExpression(
"^APPEND_SUBDATASET=.*", QRegularExpression::CaseInsensitiveOption | QRegularExpression::MultilineOption ) );
459 options.replace( indx, QStringLiteral(
"APPEND_SUBDATASET=YES" ) );
463 options.append( QStringLiteral(
"APPEND_SUBDATASET=YES" ) );
472 return mExtentGroupBox->outputExtent();
477 mFormatLabel->hide();
478 mFormatComboBox->hide();
483 mSaveAsLabel->hide();
485 QPushButton *okButton = mButtonBox->button( QDialogButtonBox::Ok );
488 okButton->setEnabled(
true );
492void QgsRasterLayerSaveAsDialog::toggleResolutionSize()
496 bool on = mResolutionRadioButton->isChecked();
497 mXResolutionLineEdit->setEnabled( on );
498 mYResolutionLineEdit->setEnabled( on );
499 mOriginalResolutionPushButton->setEnabled( on && hasResolution );
500 mColumnsLineEdit->setEnabled( !on );
501 mRowsLineEdit->setEnabled( !on );
502 mOriginalSizePushButton->setEnabled( !on && hasResolution );
505void QgsRasterLayerSaveAsDialog::setOriginalResolution()
517 xRes = yRes = mDataProvider->
extent().
width() / 100;
519 setResolution( xRes, yRes, mLayerCrs );
537 QgsRectangle srcExtent( srsCenter.
x() - xRes / 2, srsCenter.
y() - yRes / 2, srsCenter.
x() + xRes / 2, srsCenter.
y() + yRes / 2 );
540 xRes = extent.
width();
543 mXResolutionLineEdit->setText( QLocale().toString( xRes ) );
544 mYResolutionLineEdit->setText( QLocale().toString( yRes ) );
547void QgsRasterLayerSaveAsDialog::recalcSize()
552 mColumnsLineEdit->setText( QString::number( xSize ) );
553 mRowsLineEdit->setText( QString::number( ySize ) );
554 updateResolutionStateMsg();
557void QgsRasterLayerSaveAsDialog::setOriginalSize()
559 mColumnsLineEdit->setText( QString::number( mDataProvider->
xSize() ) );
560 mRowsLineEdit->setText( QString::number( mDataProvider->
ySize() ) );
564void QgsRasterLayerSaveAsDialog::recalcResolution()
569 mXResolutionLineEdit->setText( QLocale().toString( xRes ) );
570 mYResolutionLineEdit->setText( QLocale().toString( yRes ) );
571 updateResolutionStateMsg();
574void QgsRasterLayerSaveAsDialog::recalcResolutionSize()
576 if ( mResolutionRadioButton->isChecked() )
587void QgsRasterLayerSaveAsDialog::updateResolutionStateMsg()
590 switch ( mResolutionState )
596 msg = tr(
"user defined" );
601 msg = tr(
"Resolution (current: %1)" ).arg( msg );
602 mResolutionGroupBox->setTitle( msg );
605void QgsRasterLayerSaveAsDialog::extentChanged()
608 if ( mSizeRadioButton->isChecked() )
612 recalcResolutionSize();
615void QgsRasterLayerSaveAsDialog::crsChanged()
619 mExtentGroupBox->setOutputCrs(
outputCrs() );
622 if ( mResolutionRadioButton->isChecked() )
626 setOriginalResolution();
645 return mCrsSelector->crs();
650 if ( mRenderedModeRadioButton->isChecked() )
655void QgsRasterLayerSaveAsDialog::mRawModeRadioButton_toggled(
bool checked )
657 mNoDataGroupBox->setEnabled( checked && mDataProvider->
bandCount() == 1 );
658 mNoDataGroupBox->setCollapsed( !mNoDataGroupBox->isEnabled() );
661void QgsRasterLayerSaveAsDialog::mAddNoDataManuallyToolButton_clicked()
663 addNoDataRow( std::numeric_limits<double>::quiet_NaN(), std::numeric_limits<double>::quiet_NaN() );
666void QgsRasterLayerSaveAsDialog::mLoadTransparentNoDataToolButton_clicked()
671 if ( !rasterTransparency )
679 addNoDataRow( transparencyPixel.min, transparencyPixel.max );
680 if ( transparencyPixel.min != transparencyPixel.max )
682 setNoDataToEdited( mNoDataTableWidget->rowCount() - 1 );
688void QgsRasterLayerSaveAsDialog::mRemoveSelectedNoDataToolButton_clicked()
690 mNoDataTableWidget->removeRow( mNoDataTableWidget->currentRow() );
693void QgsRasterLayerSaveAsDialog::mRemoveAllNoDataToolButton_clicked()
695 while ( mNoDataTableWidget->rowCount() > 0 )
697 mNoDataTableWidget->removeRow( 0 );
701void QgsRasterLayerSaveAsDialog::addNoDataRow(
double min,
double max )
703 mNoDataTableWidget->insertRow( mNoDataTableWidget->rowCount() );
704 for (
int i = 0; i < 2; i++ )
706 double value = i == 0 ? min : max;
707 QLineEdit *lineEdit =
new QLineEdit();
708 lineEdit->setFrame(
false );
709 lineEdit->setContentsMargins( 1, 1, 1, 1 );
716 if ( !std::isnan( value ) )
722 lineEdit->setValidator(
new QIntValidator(
nullptr ) );
723 if ( !std::isnan( value ) )
725 valueString = QLocale().toString(
static_cast<int>( value ) );
729 lineEdit->setText( valueString );
730 mNoDataTableWidget->setCellWidget( mNoDataTableWidget->rowCount() - 1, i, lineEdit );
732 adjustNoDataCellWidth( mNoDataTableWidget->rowCount() - 1, i );
734 connect( lineEdit, &QLineEdit::textEdited,
this, &QgsRasterLayerSaveAsDialog::noDataCellTextEdited );
736 mNoDataTableWidget->resizeColumnsToContents();
737 mNoDataTableWidget->resizeRowsToContents();
740void QgsRasterLayerSaveAsDialog::noDataCellTextEdited(
const QString &text )
744 QLineEdit *lineEdit = qobject_cast<QLineEdit *>( sender() );
749 for (
int r = 0; r < mNoDataTableWidget->rowCount(); r++ )
751 for (
int c = 0;
c < mNoDataTableWidget->columnCount();
c++ )
753 if ( mNoDataTableWidget->cellWidget( r,
c ) == sender() )
763 QgsDebugMsgLevel( QStringLiteral(
"row = %1 column =%2" ).arg( row ).arg( column ), 2 );
767 QLineEdit *toLineEdit =
dynamic_cast<QLineEdit *
>( mNoDataTableWidget->cellWidget( row, 1 ) );
770 bool toChanged = mNoDataToEdited.value( row );
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" ) + QString::number( pyramid.getYDim() ) +
' ';
847 mPyramidResolutionsLineEdit->setText( text.trimmed() );
850void QgsRasterLayerSaveAsDialog::setNoDataToEdited(
int row )
852 if ( row >= mNoDataToEdited.size() )
854 mNoDataToEdited.resize( row + 1 );
856 mNoDataToEdited[row] =
true;
859double QgsRasterLayerSaveAsDialog::noDataCellValue(
int row,
int column )
const
861 QLineEdit *lineEdit =
dynamic_cast<QLineEdit *
>( mNoDataTableWidget->cellWidget( row, column ) );
862 if ( !lineEdit || lineEdit->text().isEmpty() )
864 return std::numeric_limits<double>::quiet_NaN();
869void QgsRasterLayerSaveAsDialog::adjustNoDataCellWidth(
int row,
int column )
871 QLineEdit *lineEdit =
dynamic_cast<QLineEdit *
>( mNoDataTableWidget->cellWidget( row, column ) );
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 );
899 return mPyramidsGroupBox->isChecked() ? mPyramidsOptionsWidget->overviewList() : QList<int>();
904 if ( !mPyramidsGroupBox->isChecked() )
906 else if ( mPyramidsUseExistingCheckBox->isChecked() )
912bool QgsRasterLayerSaveAsDialog::validate()
const
914 if ( mCreateOptionsGroupBox->isChecked() )
916 QString message = mCreateOptionsWidget->validateOptions(
true,
false );
917 if ( !message.isNull() )
920 if ( mPyramidsGroupBox->isChecked() )
922 QString message = mPyramidsOptionsWidget->createOptionsWidget()->validateOptions(
true,
false );
923 if ( !message.isNull() )
929bool QgsRasterLayerSaveAsDialog::outputLayerExists()
const
943 QgsRasterLayer rasterLayer( rasterUri, QString(), QStringLiteral(
"gdal" ) );
944 if ( !vectorUri.isEmpty() )
946 QgsVectorLayer vectorLayer( vectorUri, QString(), QStringLiteral(
"ogr" ) );
947 return rasterLayer.isValid() || vectorLayer.isValid();
951 return rasterLayer.isValid();
964 const int nbTilesWidth = std::ceil(
nColumns() / 256 );
965 const int nbTilesHeight = std::ceil(
nRows() / 256 );
966 int64_t totalTiles =
static_cast<int64_t
>( nbTilesWidth ) * nbTilesHeight;
970 QMessageBox::warning(
this, tr(
"Save Raster Layer" ), tr(
"The number of OpenStreetMap tiles needed to produce the raster layer is too large and will lead to bulk downloading behavior which is prohibited by the %1OpenStreetMap Foundation tile usage policy%2." ).arg( QStringLiteral(
"<a href=\"https://operations.osmfoundation.org/policies/tiles/\">" ), QStringLiteral(
"</a>" ) ), QMessageBox::Ok );
975 if (
outputFormat() == QLatin1String(
"GPKG" ) && outputLayerExists() && QMessageBox::warning(
this, tr(
"Save Raster Layer" ), tr(
"The layer %1 already exists in the target file, and overwriting layers in GeoPackage is not supported. "
976 "Do you want to overwrite the whole file?" )
978 QMessageBox::Yes | QMessageBox::No )
987void QgsRasterLayerSaveAsDialog::showHelp()
989 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.
static bool isOpenStreetMapLayer(QgsMapLayer *layer)
Returns true if the layer is served by OpenStreetMap server.
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.
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)
#define MAXIMUM_OPENSTREETMAP_TILES_FETCH
QList< QgsRasterRange > QgsRasterRangeList
Defines the transparency for a range of single-band pixel values.