38#include <QRegularExpression>
43 QWidget *parent, Qt::WindowFlags f )
44 : QDialog( parent, f )
45 , mRasterLayer( rasterLayer )
46 , mDataProvider( sourceProvider )
47 , mCurrentExtent( currentExtent )
48 , mLayerCrs( layerCrs )
49 , mCurrentCrs( currentCrs )
50 , mResolutionState( OriginalResolution )
54 connect( mRawModeRadioButton, &QRadioButton::toggled,
this, &QgsRasterLayerSaveAsDialog::mRawModeRadioButton_toggled );
55 connect( mFormatComboBox, &QComboBox::currentTextChanged,
this, &QgsRasterLayerSaveAsDialog::mFormatComboBox_currentIndexChanged );
56 connect( mResolutionRadioButton, &QRadioButton::toggled,
this, &QgsRasterLayerSaveAsDialog::mResolutionRadioButton_toggled );
57 connect( mOriginalResolutionPushButton, &QPushButton::clicked,
this, &QgsRasterLayerSaveAsDialog::mOriginalResolutionPushButton_clicked );
58 connect( mXResolutionLineEdit, &QLineEdit::textEdited,
this, &QgsRasterLayerSaveAsDialog::mXResolutionLineEdit_textEdited );
59 connect( mYResolutionLineEdit, &QLineEdit::textEdited,
this, &QgsRasterLayerSaveAsDialog::mYResolutionLineEdit_textEdited );
60 connect( mOriginalSizePushButton, &QPushButton::clicked,
this, &QgsRasterLayerSaveAsDialog::mOriginalSizePushButton_clicked );
61 connect( mColumnsLineEdit, &QLineEdit::textEdited,
this, &QgsRasterLayerSaveAsDialog::mColumnsLineEdit_textEdited );
62 connect( mRowsLineEdit, &QLineEdit::textEdited,
this, &QgsRasterLayerSaveAsDialog::mRowsLineEdit_textEdited );
63 connect( mAddNoDataManuallyToolButton, &QPushButton::clicked,
this, &QgsRasterLayerSaveAsDialog::mAddNoDataManuallyToolButton_clicked );
64 connect( mLoadTransparentNoDataToolButton, &QPushButton::clicked,
this, &QgsRasterLayerSaveAsDialog::mLoadTransparentNoDataToolButton_clicked );
65 connect( mRemoveSelectedNoDataToolButton, &QPushButton::clicked,
this, &QgsRasterLayerSaveAsDialog::mRemoveSelectedNoDataToolButton_clicked );
66 connect( mRemoveAllNoDataToolButton, &QPushButton::clicked,
this, &QgsRasterLayerSaveAsDialog::mRemoveAllNoDataToolButton_clicked );
67 connect( mTileModeCheckBox, &QCheckBox::toggled,
this, &QgsRasterLayerSaveAsDialog::mTileModeCheckBox_toggled );
68 connect( mPyramidsGroupBox, &QgsCollapsibleGroupBox::toggled,
this, &QgsRasterLayerSaveAsDialog::mPyramidsGroupBox_toggled );
74 mNoDataTableWidget->setColumnCount( 2 );
75 mNoDataTableWidget->setHorizontalHeaderItem( 0,
new QTableWidgetItem( tr(
"From" ) ) );
76 mNoDataTableWidget->setHorizontalHeaderItem( 1,
new QTableWidgetItem( tr(
"To" ) ) );
78 mRawModeRadioButton_toggled(
true );
82 toggleResolutionSize();
84 insertAvailableOutputFormats();
91 setOriginalResolution();
92 int xSize = mDataProvider->
xSize();
93 int ySize = mDataProvider->
ySize();
94 mMaximumSizeXLineEdit->setText( QString::number( xSize ) );
95 mMaximumSizeYLineEdit->setText( QString::number( ySize ) );
99 mTileModeCheckBox->setChecked(
true );
100 mMaximumSizeXLineEdit->setText( QString::number( 2000 ) );
101 mMaximumSizeYLineEdit->setText( QString::number( 2000 ) );
105 mCreateOptionsWidget->setProvider( mDataProvider->
name() );
106 if ( mDataProvider->
name() == QLatin1String(
"gdal" ) )
108 mCreateOptionsWidget->setFormat( mFormatComboBox->currentData().toString() );
110 mCreateOptionsWidget->setRasterLayer( mRasterLayer );
111 mCreateOptionsWidget->update();
120 mPyramidsOptionsWidget->createOptionsWidget()->setRasterLayer( mRasterLayer );
125 mPyramidsUseExistingCheckBox->setEnabled(
false );
126 mPyramidsUseExistingCheckBox->setVisible(
false );
128 populatePyramidsLevels();
130 this, &QgsRasterLayerSaveAsDialog::populatePyramidsLevels );
134 mPyramidsGroupBox->setEnabled(
false );
135 mPyramidsGroupBox->setCollapsed(
true );
140 mCreateOptionsGroupBox->setSaveCheckedState(
true );
150 mCrsSelector->setSourceEnsemble( ensemble.
name() );
156 mCrsSelector->setShowAccuracyWarnings(
true );
158 mCrsSelector->setLayerCrs( mLayerCrs );
160 mCrsSelector->setCrs( mLayerCrs );
163 this, &QgsRasterLayerSaveAsDialog::crsChanged );
165 QPushButton *okButton = mButtonBox->button( QDialogButtonBox::Ok );
168 okButton->setEnabled(
false );
172 mHelpButtonBox->setVisible(
false );
173 mButtonBox->addButton( QDialogButtonBox::Help );
174 connect( mButtonBox, &QDialogButtonBox::helpRequested,
this, &QgsRasterLayerSaveAsDialog::showHelp );
176 connect( mHelpButtonBox, &QDialogButtonBox::helpRequested,
this, &QgsRasterLayerSaveAsDialog::showHelp );
179 connect( mButtonBox, &QDialogButtonBox::rejected,
this, &QgsRasterLayerSaveAsDialog::reject );
181 mExtentGroupBox->setOutputCrs(
outputCrs() );
182 mExtentGroupBox->setOriginalExtent( mDataProvider->
extent(), mLayerCrs );
183 mExtentGroupBox->setCurrentExtent( mCurrentExtent, mCurrentCrs );
184 mExtentGroupBox->setOutputExtentFromOriginal();
187 recalcResolutionSize();
191 if ( mTileModeCheckBox->isChecked() )
193 mTilesGroupBox->show();
195 mFilename->setDialogTitle( tr(
"Select Output Directory" ) );
199 mTilesGroupBox->hide();
201 mFilename->setDialogTitle( tr(
"Save Layer As" ) );
204 mFilename->setDefaultRoot( settings.
value( QStringLiteral(
"UI/lastRasterFileDir" ), QDir::homePath() ).toString() );
208 QFileInfo tmplFileInfo( filePath );
209 settings.
setValue( QStringLiteral(
"UI/lastRasterFileDir" ), tmplFileInfo.absolutePath() );
211 if ( !filePath.isEmpty() && mLayerName->isEnabled() )
213 QFileInfo fileInfo( filePath );
214 mLayerName->setText( fileInfo.baseName() );
217 if ( mTileModeCheckBox->isChecked() )
219 QString fileName = filePath;
224 if ( fileName.isEmpty() )
228 QDir dir( fileName );
229 QString baseName = QFileInfo( fileName ).baseName();
231 filters << QStringLiteral(
"%1.*" ).arg( baseName );
232 QStringList files = dir.entryList( filters );
233 if ( files.isEmpty() )
236 if ( QMessageBox::warning(
this, tr(
"Save Raster Layer" ),
237 tr(
"The directory %1 contains files which will be overwritten: %2" ).arg( dir.absolutePath(), files.join( QLatin1String(
", " ) ) ),
238 QMessageBox::Ok | QMessageBox::Cancel ) == QMessageBox::Ok )
241 fileName = QFileDialog::getExistingDirectory(
this, tr(
"Select output directory" ), tmplFileInfo.absolutePath() );
245 QPushButton *okButton = mButtonBox->button( QDialogButtonBox::Ok );
250 okButton->setEnabled( tmplFileInfo.absoluteDir().exists() );
254void QgsRasterLayerSaveAsDialog::insertAvailableOutputFormats()
258 int nDrivers = GDALGetDriverCount();
259 QMap< int, QPair< QString, QString > > topPriorityDrivers;
260 QMap< QString, QString > lowPriorityDrivers;
262 for (
int i = 0; i < nDrivers; ++i )
264 GDALDriverH driver = GDALGetDriver( i );
269 QString driverShortName = GDALGetDriverShortName( driver );
270 QString driverLongName = GDALGetDriverLongName( driver );
271 if ( driverShortName == QLatin1String(
"MEM" ) )
278 else if ( driverShortName == QLatin1String(
"VRT" ) )
283 else if ( driverShortName == QLatin1String(
"GTiff" ) )
286 topPriorityDrivers.insert( 1, qMakePair( driverLongName, driverShortName ) );
288 else if ( driverShortName == QLatin1String(
"GPKG" ) )
291 topPriorityDrivers.insert( 2, qMakePair( driverLongName, driverShortName ) );
295 lowPriorityDrivers.insert( driverLongName, driverShortName );
302 for (
auto priorityDriversIt = topPriorityDrivers.constBegin(); priorityDriversIt != topPriorityDrivers.constEnd(); ++priorityDriversIt )
304 mFormatComboBox->addItem( priorityDriversIt.value().first, priorityDriversIt.value().second );
307 for (
auto lowPriorityDriversIt = lowPriorityDrivers.constBegin(); lowPriorityDriversIt != lowPriorityDrivers.constEnd(); ++lowPriorityDriversIt )
309 mFormatComboBox->addItem( lowPriorityDriversIt.key(), lowPriorityDriversIt.value() );
314void QgsRasterLayerSaveAsDialog::setValidators()
318 mColumnsLineEdit->setValidator(
new QIntValidator(
this ) );
319 mRowsLineEdit->setValidator(
new QIntValidator(
this ) );
320 mMaximumSizeXLineEdit->setValidator(
new QIntValidator(
this ) );
321 mMaximumSizeYLineEdit->setValidator(
new QIntValidator(
this ) );
324void QgsRasterLayerSaveAsDialog::mFormatComboBox_currentIndexChanged(
const QString & )
327 if ( mDataProvider && mDataProvider->
name() == QLatin1String(
"gdal" ) )
330 mCreateOptionsWidget->update();
335 if ( extensions.empty() )
336 filter = tr(
"All files (*.*)" );
339 filter = QStringLiteral(
"%1 (*.%2);;%3" ).arg( mFormatComboBox->currentText(),
340 extensions.join( QLatin1String(
" *." ) ),
341 tr(
"All files (*.*)" ) );
343 mFilename->setFilter( filter );
346 mTileModeCheckBox->setEnabled(
outputFormat() != QLatin1String(
"GPKG" ) );
347 mFilename->setConfirmOverwrite(
outputFormat() != QLatin1String(
"GPKG" ) );
348 mLayerName->setEnabled(
outputFormat() == QLatin1String(
"GPKG" ) );
349 if ( mLayerName->isEnabled() )
351 QString layerName = QFileInfo( mFilename->filePath() ).baseName();
352 mLayerName->setText( layerName );
353 mTileModeCheckBox->setChecked(
false );
357 mLayerName->setText( QString() );
363 return mColumnsLineEdit->text().toInt();
368 return mRowsLineEdit->text().toInt();
383 return mMaximumSizeXLineEdit->text().toInt();
388 return mMaximumSizeYLineEdit->text().toInt();
393 return mTileModeCheckBox->isChecked();
398 return mAddToCanvas->isChecked();
403 mAddToCanvas->setChecked( checked );
408 QString fileName = mFilename->filePath();
414 if ( !extensions.empty() )
416 defaultExt = extensions.at( 0 );
420 QFileInfo fi( fileName );
421 if ( !fileName.isEmpty() && fi.suffix().isEmpty() && !defaultExt.isEmpty() )
423 fileName +=
'.' + defaultExt;
432 if ( mLayerName->text().isEmpty() &&
outputFormat() == QLatin1String(
"GPKG" ) && !mTileModeCheckBox->isChecked() )
435 return QFileInfo( mFilename->filePath() ).baseName();
439 return mLayerName->text();
445 return mFormatComboBox->currentData().toString();
450 QStringList options = mCreateOptionsGroupBox->isChecked() ? mCreateOptionsWidget->options() : QStringList();
454 int indx = options.indexOf( QRegularExpression(
"^RASTER_TABLE=.*", QRegularExpression::CaseInsensitiveOption | QRegularExpression::MultilineOption ) );
457 options.replace( indx, QStringLiteral(
"RASTER_TABLE=%1" ).arg(
outputLayerName() ) );
461 options.append( QStringLiteral(
"RASTER_TABLE=%1" ).arg(
outputLayerName() ) );
465 if ( !outputLayerExists() )
467 indx = options.indexOf( QRegularExpression(
"^APPEND_SUBDATASET=.*", QRegularExpression::CaseInsensitiveOption | QRegularExpression::MultilineOption ) );
470 options.replace( indx, QStringLiteral(
"APPEND_SUBDATASET=YES" ) );
474 options.append( QStringLiteral(
"APPEND_SUBDATASET=YES" ) );
483 return mExtentGroupBox->outputExtent();
488 mFormatLabel->hide();
489 mFormatComboBox->hide();
494 mSaveAsLabel->hide();
496 QPushButton *okButton = mButtonBox->button( QDialogButtonBox::Ok );
499 okButton->setEnabled(
true );
503void QgsRasterLayerSaveAsDialog::toggleResolutionSize()
507 bool on = mResolutionRadioButton->isChecked();
508 mXResolutionLineEdit->setEnabled( on );
509 mYResolutionLineEdit->setEnabled( on );
510 mOriginalResolutionPushButton->setEnabled( on && hasResolution );
511 mColumnsLineEdit->setEnabled( !on );
512 mRowsLineEdit->setEnabled( !on );
513 mOriginalSizePushButton->setEnabled( !on && hasResolution );
516void QgsRasterLayerSaveAsDialog::setOriginalResolution()
528 xRes = yRes = mDataProvider->
extent().
width() / 100;
530 setResolution( xRes, yRes, mLayerCrs );
548 QgsRectangle srcExtent( srsCenter.
x() - xRes / 2, srsCenter.
y() - yRes / 2, srsCenter.
x() + xRes / 2, srsCenter.
y() + yRes / 2 );
551 xRes = extent.
width();
554 mXResolutionLineEdit->setText( QLocale().toString( xRes ) );
555 mYResolutionLineEdit->setText( QLocale().toString( yRes ) );
558void QgsRasterLayerSaveAsDialog::recalcSize()
563 mColumnsLineEdit->setText( QString::number( xSize ) );
564 mRowsLineEdit->setText( QString::number( ySize ) );
565 updateResolutionStateMsg();
568void QgsRasterLayerSaveAsDialog::setOriginalSize()
570 mColumnsLineEdit->setText( QString::number( mDataProvider->
xSize() ) );
571 mRowsLineEdit->setText( QString::number( mDataProvider->
ySize() ) );
575void QgsRasterLayerSaveAsDialog::recalcResolution()
580 mXResolutionLineEdit->setText( QLocale().toString( xRes ) );
581 mYResolutionLineEdit->setText( QLocale().toString( yRes ) );
582 updateResolutionStateMsg();
585void QgsRasterLayerSaveAsDialog::recalcResolutionSize()
587 if ( mResolutionRadioButton->isChecked() )
598void QgsRasterLayerSaveAsDialog::updateResolutionStateMsg()
601 switch ( mResolutionState )
607 msg = tr(
"user defined" );
612 msg = tr(
"Resolution (current: %1)" ).arg( msg );
613 mResolutionGroupBox->setTitle( msg );
616void QgsRasterLayerSaveAsDialog::extentChanged()
619 if ( mSizeRadioButton->isChecked() )
623 recalcResolutionSize();
626void QgsRasterLayerSaveAsDialog::crsChanged()
630 mExtentGroupBox->setOutputCrs(
outputCrs() );
633 if ( mResolutionRadioButton->isChecked() )
637 setOriginalResolution();
656 return mCrsSelector->crs();
665void QgsRasterLayerSaveAsDialog::mRawModeRadioButton_toggled(
bool checked )
667 mNoDataGroupBox->setEnabled( checked && mDataProvider->
bandCount() == 1 );
668 mNoDataGroupBox->setCollapsed( !mNoDataGroupBox->isEnabled() );
671void QgsRasterLayerSaveAsDialog::mAddNoDataManuallyToolButton_clicked()
673 addNoDataRow( std::numeric_limits<double>::quiet_NaN(), std::numeric_limits<double>::quiet_NaN() );
676void QgsRasterLayerSaveAsDialog::mLoadTransparentNoDataToolButton_clicked()
678 if ( !mRasterLayer->
renderer() )
return;
680 if ( !rasterTransparency )
return;
687 addNoDataRow( transparencyPixel.min, transparencyPixel.max );
688 if ( transparencyPixel.min != transparencyPixel.max )
690 setNoDataToEdited( mNoDataTableWidget->rowCount() - 1 );
696void QgsRasterLayerSaveAsDialog::mRemoveSelectedNoDataToolButton_clicked()
698 mNoDataTableWidget->removeRow( mNoDataTableWidget->currentRow() );
701void QgsRasterLayerSaveAsDialog::mRemoveAllNoDataToolButton_clicked()
703 while ( mNoDataTableWidget->rowCount() > 0 )
705 mNoDataTableWidget->removeRow( 0 );
709void QgsRasterLayerSaveAsDialog::addNoDataRow(
double min,
double max )
711 mNoDataTableWidget->insertRow( mNoDataTableWidget->rowCount() );
712 for (
int i = 0; i < 2; i++ )
714 double value = i == 0 ? min : max;
715 QLineEdit *lineEdit =
new QLineEdit();
716 lineEdit->setFrame(
false );
717 lineEdit->setContentsMargins( 1, 1, 1, 1 );
724 if ( !std::isnan( value ) )
730 lineEdit->setValidator(
new QIntValidator(
nullptr ) );
731 if ( !std::isnan( value ) )
733 valueString = QLocale().toString(
static_cast<int>( value ) );
737 lineEdit->setText( valueString );
738 mNoDataTableWidget->setCellWidget( mNoDataTableWidget->rowCount() - 1, i, lineEdit );
740 adjustNoDataCellWidth( mNoDataTableWidget->rowCount() - 1, i );
742 connect( lineEdit, &QLineEdit::textEdited,
this, &QgsRasterLayerSaveAsDialog::noDataCellTextEdited );
744 mNoDataTableWidget->resizeColumnsToContents();
745 mNoDataTableWidget->resizeRowsToContents();
748void QgsRasterLayerSaveAsDialog::noDataCellTextEdited(
const QString &text )
752 QLineEdit *lineEdit = qobject_cast<QLineEdit *>( sender() );
753 if ( !lineEdit )
return;
756 for (
int r = 0; r < mNoDataTableWidget->rowCount(); r++ )
758 for (
int c = 0;
c < mNoDataTableWidget->columnCount();
c++ )
760 if ( mNoDataTableWidget->cellWidget( r,
c ) == sender() )
767 if ( row != -1 )
break;
769 QgsDebugMsgLevel( QStringLiteral(
"row = %1 column =%2" ).arg( row ).arg( column ), 2 );
773 QLineEdit *toLineEdit =
dynamic_cast<QLineEdit *
>( mNoDataTableWidget->cellWidget( row, 1 ) );
774 if ( !toLineEdit )
return;
775 bool toChanged = mNoDataToEdited.value( row );
779 toLineEdit->setText( lineEdit->text() );
782 else if ( column == 1 )
784 setNoDataToEdited( row );
788void QgsRasterLayerSaveAsDialog::mTileModeCheckBox_toggled(
bool toggled )
807 mTilesGroupBox->show();
809 mFilename->setDialogTitle( tr(
"Select Output Directory" ) );
813 mTilesGroupBox->hide();
815 mFilename->setDialogTitle( tr(
"Save Layer As" ) );
819void QgsRasterLayerSaveAsDialog::mPyramidsGroupBox_toggled(
bool toggled )
822 populatePyramidsLevels();
825void QgsRasterLayerSaveAsDialog::populatePyramidsLevels()
829 if ( mPyramidsGroupBox->isChecked() )
831 QList<QgsRasterPyramid> myPyramidList;
834 if ( mPyramidsUseExistingCheckBox->isChecked() )
840 if ( ! mPyramidsOptionsWidget->overviewList().isEmpty() )
841 myPyramidList = mDataProvider->
buildPyramidList( mPyramidsOptionsWidget->overviewList() );
845 if ( ! mPyramidsUseExistingCheckBox->isChecked() || pyramid.getExists() )
847 text += QString::number( pyramid.getXDim() ) + QStringLiteral(
"x" ) +
848 QString::number( pyramid.getYDim() ) +
' ';
853 mPyramidResolutionsLineEdit->setText( text.trimmed() );
856void QgsRasterLayerSaveAsDialog::setNoDataToEdited(
int row )
858 if ( row >= mNoDataToEdited.size() )
860 mNoDataToEdited.resize( row + 1 );
862 mNoDataToEdited[row] =
true;
865double QgsRasterLayerSaveAsDialog::noDataCellValue(
int row,
int column )
const
867 QLineEdit *lineEdit =
dynamic_cast<QLineEdit *
>( mNoDataTableWidget->cellWidget( row, column ) );
868 if ( !lineEdit || lineEdit->text().isEmpty() )
870 return std::numeric_limits<double>::quiet_NaN();
875void QgsRasterLayerSaveAsDialog::adjustNoDataCellWidth(
int row,
int column )
877 QLineEdit *lineEdit =
dynamic_cast<QLineEdit *
>( mNoDataTableWidget->cellWidget( row, column ) );
878 if ( !lineEdit )
return;
880 int width = std::max( lineEdit->fontMetrics().boundingRect( lineEdit->text() ).width() + 10, 100 );
881 width = std::max( width, mNoDataTableWidget->columnWidth( column ) );
883 lineEdit->setFixedWidth( width );
889 if ( ! mNoDataGroupBox->isChecked() )
892 int rows = mNoDataTableWidget->rowCount();
893 noDataList.reserve( rows );
894 for (
int r = 0; r < rows; r++ )
897 noDataList.append(
noData );
905 return mPyramidsGroupBox->isChecked() ? mPyramidsOptionsWidget->overviewList() : QList<int>();
910 if ( ! mPyramidsGroupBox->isChecked() )
912 else if ( mPyramidsUseExistingCheckBox->isChecked() )
918bool QgsRasterLayerSaveAsDialog::validate()
const
920 if ( mCreateOptionsGroupBox->isChecked() )
922 QString message = mCreateOptionsWidget->validateOptions(
true,
false );
923 if ( !message.isNull() )
926 if ( mPyramidsGroupBox->isChecked() )
928 QString message = mPyramidsOptionsWidget->createOptionsWidget()->validateOptions(
true,
false );
929 if ( !message.isNull() )
935bool QgsRasterLayerSaveAsDialog::outputLayerExists()
const
949 QgsRasterLayer rasterLayer( rasterUri, QString( ), QStringLiteral(
"gdal" ) );
950 if ( !vectorUri.isEmpty() )
952 QgsVectorLayer vectorLayer( vectorUri, QString( ), QStringLiteral(
"ogr" ) );
953 return rasterLayer.isValid() || vectorLayer.isValid();
957 return rasterLayer.isValid();
970 const int nbTilesWidth = std::ceil(
nColumns() / 256 );
971 const int nbTilesHeight = std::ceil(
nRows() / 256 );
972 int64_t totalTiles =
static_cast<int64_t
>( nbTilesWidth ) * nbTilesHeight;
976 QMessageBox::warning(
this, tr(
"Save Raster Layer" ),
977 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>" ) ),
983 if (
outputFormat() == QLatin1String(
"GPKG" ) && outputLayerExists() &&
984 QMessageBox::warning(
this, tr(
"Save Raster Layer" ),
985 tr(
"The layer %1 already exists in the target file, and overwriting layers in GeoPackage is not supported. "
987 QMessageBox::Yes | QMessageBox::No ) == QMessageBox::No )
995void QgsRasterLayerSaveAsDialog::showHelp()
997 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.
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)
#define MAXIMUM_OPENSTREETMAP_TILES_FETCH
QList< QgsRasterRange > QgsRasterRangeList
Defines the transparency for a range of single-band pixel values.