29 #include "cpl_string.h"
36 #include <QFileDialog>
37 #include <QMessageBox>
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();
119 mPyramidsOptionsWidget->createOptionsWidget()->setRasterLayer( mRasterLayer );
124 mPyramidsUseExistingCheckBox->setEnabled(
false );
125 mPyramidsUseExistingCheckBox->setVisible(
false );
127 populatePyramidsLevels();
129 this, &QgsRasterLayerSaveAsDialog::populatePyramidsLevels );
133 mPyramidsGroupBox->setEnabled(
false );
138 mCreateOptionsGroupBox->setSaveCheckedState(
true );
143 mCrsSelector->setLayerCrs( mLayerCrs );
145 mCrsSelector->setCrs( mLayerCrs );
148 this, &QgsRasterLayerSaveAsDialog::crsChanged );
150 QPushButton *okButton = mButtonBox->button( QDialogButtonBox::Ok );
153 okButton->setEnabled(
false );
157 mHelpButtonBox->setVisible(
false );
158 mButtonBox->addButton( QDialogButtonBox::Help );
159 connect( mButtonBox, &QDialogButtonBox::helpRequested,
this, &QgsRasterLayerSaveAsDialog::showHelp );
161 connect( mHelpButtonBox, &QDialogButtonBox::helpRequested,
this, &QgsRasterLayerSaveAsDialog::showHelp );
164 connect( mButtonBox, &QDialogButtonBox::rejected,
this, &QgsRasterLayerSaveAsDialog::reject );
166 mExtentGroupBox->setOutputCrs(
outputCrs() );
167 mExtentGroupBox->setOriginalExtent( mDataProvider->
extent(), mLayerCrs );
168 mExtentGroupBox->setCurrentExtent( mCurrentExtent, mCurrentCrs );
169 mExtentGroupBox->setOutputExtentFromOriginal();
172 recalcResolutionSize();
176 if ( mTileModeCheckBox->isChecked() )
178 mTilesGroupBox->show();
180 mFilename->setDialogTitle( tr(
"Select Output Directory" ) );
184 mTilesGroupBox->hide();
186 mFilename->setDialogTitle( tr(
"Save Layer As" ) );
189 mFilename->setDefaultRoot( settings.
value( QStringLiteral(
"UI/lastRasterFileDir" ), QDir::homePath() ).toString() );
193 QFileInfo tmplFileInfo( filePath );
194 settings.
setValue( QStringLiteral(
"UI/lastRasterFileDir" ), tmplFileInfo.absolutePath() );
196 if ( !filePath.isEmpty() && mLayerName->isEnabled() )
198 QFileInfo fileInfo( filePath );
199 mLayerName->setText( fileInfo.baseName() );
202 if ( mTileModeCheckBox->isChecked() )
204 QString fileName = filePath;
209 if ( fileName.isEmpty() )
213 QDir dir( fileName );
214 QString baseName = QFileInfo( fileName ).baseName();
216 filters << QStringLiteral(
"%1.*" ).arg( baseName );
217 QStringList files = dir.entryList( filters );
218 if ( files.isEmpty() )
221 if ( QMessageBox::warning(
this, tr(
"Save Raster Layer" ),
222 tr(
"The directory %1 contains files which will be overwritten: %2" ).arg( dir.absolutePath(), files.join( QLatin1String(
", " ) ) ),
223 QMessageBox::Ok | QMessageBox::Cancel ) == QMessageBox::Ok )
226 fileName = QFileDialog::getExistingDirectory(
this, tr(
"Select output directory" ), tmplFileInfo.absolutePath() );
230 QPushButton *okButton = mButtonBox->button( QDialogButtonBox::Ok );
235 okButton->setEnabled( tmplFileInfo.absoluteDir().exists() );
239 void QgsRasterLayerSaveAsDialog::insertAvailableOutputFormats()
243 int nDrivers = GDALGetDriverCount();
244 QMap< int, QPair< QString, QString > > topPriorityDrivers;
245 QMap< QString, QString > lowPriorityDrivers;
247 for (
int i = 0; i < nDrivers; ++i )
249 GDALDriverH driver = GDALGetDriver( i );
254 QString driverShortName = GDALGetDriverShortName( driver );
255 QString driverLongName = GDALGetDriverLongName( driver );
256 if ( driverShortName == QLatin1String(
"MEM" ) )
263 else if ( driverShortName == QLatin1String(
"VRT" ) )
268 else if ( driverShortName == QLatin1String(
"GTiff" ) )
271 topPriorityDrivers.insert( 1, qMakePair( driverLongName, driverShortName ) );
273 else if ( driverShortName == QLatin1String(
"GPKG" ) )
276 topPriorityDrivers.insert( 2, qMakePair( driverLongName, driverShortName ) );
280 lowPriorityDrivers.insert( driverLongName, driverShortName );
287 for (
auto priorityDriversIt = topPriorityDrivers.constBegin(); priorityDriversIt != topPriorityDrivers.constEnd(); ++priorityDriversIt )
289 mFormatComboBox->addItem( priorityDriversIt.value().first, priorityDriversIt.value().second );
292 for (
auto lowPriorityDriversIt = lowPriorityDrivers.constBegin(); lowPriorityDriversIt != lowPriorityDrivers.constEnd(); ++lowPriorityDriversIt )
294 mFormatComboBox->addItem( lowPriorityDriversIt.key(), lowPriorityDriversIt.value() );
299 void QgsRasterLayerSaveAsDialog::setValidators()
303 mColumnsLineEdit->setValidator(
new QIntValidator(
this ) );
304 mRowsLineEdit->setValidator(
new QIntValidator(
this ) );
305 mMaximumSizeXLineEdit->setValidator(
new QIntValidator(
this ) );
306 mMaximumSizeYLineEdit->setValidator(
new QIntValidator(
this ) );
309 void QgsRasterLayerSaveAsDialog::mFormatComboBox_currentIndexChanged(
const QString & )
312 if ( mDataProvider && mDataProvider->
name() == QLatin1String(
"gdal" ) )
315 mCreateOptionsWidget->update();
320 if ( extensions.empty() )
321 filter = tr(
"All files (*.*)" );
324 filter = QStringLiteral(
"%1 (*.%2);;%3" ).arg( mFormatComboBox->currentText(),
325 extensions.join( QLatin1String(
" *." ) ),
326 tr(
"All files (*.*)" ) );
328 mFilename->setFilter( filter );
331 mTileModeCheckBox->setEnabled(
outputFormat() != QLatin1String(
"GPKG" ) );
332 mFilename->setConfirmOverwrite(
outputFormat() != QLatin1String(
"GPKG" ) );
333 mLayerName->setEnabled(
outputFormat() == QLatin1String(
"GPKG" ) );
334 if ( mLayerName->isEnabled() )
336 QString layerName = QFileInfo( mFilename->filePath() ).baseName();
337 mLayerName->setText( layerName );
338 mTileModeCheckBox->setChecked(
false );
342 mLayerName->setText( QString() );
348 return mColumnsLineEdit->text().toInt();
353 return mRowsLineEdit->text().toInt();
368 return mMaximumSizeXLineEdit->text().toInt();
373 return mMaximumSizeYLineEdit->text().toInt();
378 return mTileModeCheckBox->isChecked();
383 return mAddToCanvas->isChecked();
388 mAddToCanvas->setChecked( checked );
393 QString fileName = mFilename->filePath();
399 if ( !extensions.empty() )
401 defaultExt = extensions.at( 0 );
405 QFileInfo fi( fileName );
406 if ( !fileName.isEmpty() && fi.suffix().isEmpty() )
408 fileName +=
'.' + defaultExt;
417 if ( mLayerName->text().isEmpty() &&
outputFormat() == QLatin1String(
"GPKG" ) && !mTileModeCheckBox->isChecked() )
420 return QFileInfo( mFilename->filePath() ).baseName();
424 return mLayerName->text();
430 return mFormatComboBox->currentData().toString();
435 QStringList options = mCreateOptionsGroupBox->isChecked() ? mCreateOptionsWidget->options() : QStringList();
439 int indx = options.indexOf( QRegularExpression(
"^RASTER_TABLE=.*", QRegularExpression::CaseInsensitiveOption | QRegularExpression::MultilineOption ) );
442 options.replace( indx, QStringLiteral(
"RASTER_TABLE=%1" ).arg(
outputLayerName() ) );
446 options.append( QStringLiteral(
"RASTER_TABLE=%1" ).arg(
outputLayerName() ) );
450 if ( !outputLayerExists() )
452 indx = options.indexOf( QRegularExpression(
"^APPEND_SUBDATASET=.*", QRegularExpression::CaseInsensitiveOption | QRegularExpression::MultilineOption ) );
455 options.replace( indx, QStringLiteral(
"APPEND_SUBDATASET=YES" ) );
459 options.append( QStringLiteral(
"APPEND_SUBDATASET=YES" ) );
468 return mExtentGroupBox->outputExtent();
473 mFormatLabel->hide();
474 mFormatComboBox->hide();
479 mSaveAsLabel->hide();
481 QPushButton *okButton = mButtonBox->button( QDialogButtonBox::Ok );
484 okButton->setEnabled(
true );
488 void QgsRasterLayerSaveAsDialog::toggleResolutionSize()
492 bool on = mResolutionRadioButton->isChecked();
493 mXResolutionLineEdit->setEnabled( on );
494 mYResolutionLineEdit->setEnabled( on );
495 mOriginalResolutionPushButton->setEnabled( on && hasResolution );
496 mColumnsLineEdit->setEnabled( !on );
497 mRowsLineEdit->setEnabled( !on );
498 mOriginalSizePushButton->setEnabled( !on && hasResolution );
501 void QgsRasterLayerSaveAsDialog::setOriginalResolution()
513 xRes = yRes = mDataProvider->
extent().
width() / 100;
515 setResolution( xRes, yRes, mLayerCrs );
533 QgsRectangle srcExtent( srsCenter.
x() - xRes / 2, srsCenter.
y() - yRes / 2, srsCenter.
x() + xRes / 2, srsCenter.
y() + yRes / 2 );
536 xRes = extent.
width();
539 mXResolutionLineEdit->setText( QLocale().toString( xRes ) );
540 mYResolutionLineEdit->setText( QLocale().toString( yRes ) );
543 void QgsRasterLayerSaveAsDialog::recalcSize()
548 mColumnsLineEdit->setText( QString::number( xSize ) );
549 mRowsLineEdit->setText( QString::number( ySize ) );
550 updateResolutionStateMsg();
553 void QgsRasterLayerSaveAsDialog::setOriginalSize()
555 mColumnsLineEdit->setText( QString::number( mDataProvider->
xSize() ) );
556 mRowsLineEdit->setText( QString::number( mDataProvider->
ySize() ) );
560 void QgsRasterLayerSaveAsDialog::recalcResolution()
565 mXResolutionLineEdit->setText( QLocale().toString( xRes ) );
566 mYResolutionLineEdit->setText( QLocale().toString( yRes ) );
567 updateResolutionStateMsg();
570 void QgsRasterLayerSaveAsDialog::recalcResolutionSize()
572 if ( mResolutionRadioButton->isChecked() )
583 void QgsRasterLayerSaveAsDialog::updateResolutionStateMsg()
586 switch ( mResolutionState )
592 msg = tr(
"user defined" );
597 msg = tr(
"Resolution (current: %1)" ).arg( msg );
598 mResolutionGroupBox->setTitle( msg );
601 void QgsRasterLayerSaveAsDialog::extentChanged()
604 if ( mSizeRadioButton->isChecked() )
608 recalcResolutionSize();
611 void QgsRasterLayerSaveAsDialog::crsChanged()
615 mExtentGroupBox->setOutputCrs(
outputCrs() );
618 if ( mResolutionRadioButton->isChecked() )
622 setOriginalResolution();
641 return mCrsSelector->crs();
650 void QgsRasterLayerSaveAsDialog::mRawModeRadioButton_toggled(
bool checked )
652 mNoDataGroupBox->setEnabled( checked && mDataProvider->
bandCount() == 1 );
655 void QgsRasterLayerSaveAsDialog::mAddNoDataManuallyToolButton_clicked()
657 addNoDataRow( std::numeric_limits<double>::quiet_NaN(), std::numeric_limits<double>::quiet_NaN() );
660 void QgsRasterLayerSaveAsDialog::mLoadTransparentNoDataToolButton_clicked()
662 if ( !mRasterLayer->
renderer() )
return;
664 if ( !rasterTransparency )
return;
669 if ( transparencyPixel.percentTransparent == 100 )
671 addNoDataRow( transparencyPixel.min, transparencyPixel.max );
672 if ( transparencyPixel.min != transparencyPixel.max )
674 setNoDataToEdited( mNoDataTableWidget->rowCount() - 1 );
680 void QgsRasterLayerSaveAsDialog::mRemoveSelectedNoDataToolButton_clicked()
682 mNoDataTableWidget->removeRow( mNoDataTableWidget->currentRow() );
685 void QgsRasterLayerSaveAsDialog::mRemoveAllNoDataToolButton_clicked()
687 while ( mNoDataTableWidget->rowCount() > 0 )
689 mNoDataTableWidget->removeRow( 0 );
693 void QgsRasterLayerSaveAsDialog::addNoDataRow(
double min,
double max )
695 mNoDataTableWidget->insertRow( mNoDataTableWidget->rowCount() );
696 for (
int i = 0; i < 2; i++ )
698 double value = i == 0 ? min : max;
699 QLineEdit *lineEdit =
new QLineEdit();
700 lineEdit->setFrame(
false );
701 lineEdit->setContentsMargins( 1, 1, 1, 1 );
708 if ( !std::isnan( value ) )
714 lineEdit->setValidator(
new QIntValidator(
nullptr ) );
715 if ( !std::isnan( value ) )
717 valueString = QLocale().toString(
static_cast<int>( value ) );
721 lineEdit->setText( valueString );
722 mNoDataTableWidget->setCellWidget( mNoDataTableWidget->rowCount() - 1, i, lineEdit );
724 adjustNoDataCellWidth( mNoDataTableWidget->rowCount() - 1, i );
726 connect( lineEdit, &QLineEdit::textEdited,
this, &QgsRasterLayerSaveAsDialog::noDataCellTextEdited );
728 mNoDataTableWidget->resizeColumnsToContents();
729 mNoDataTableWidget->resizeRowsToContents();
732 void QgsRasterLayerSaveAsDialog::noDataCellTextEdited(
const QString &text )
736 QLineEdit *lineEdit = qobject_cast<QLineEdit *>( sender() );
737 if ( !lineEdit )
return;
740 for (
int r = 0; r < mNoDataTableWidget->rowCount(); r++ )
742 for (
int c = 0;
c < mNoDataTableWidget->columnCount();
c++ )
744 if ( mNoDataTableWidget->cellWidget( r,
c ) == sender() )
751 if ( row != -1 )
break;
753 QgsDebugMsg( QStringLiteral(
"row = %1 column =%2" ).arg( row ).arg( column ) );
757 QLineEdit *toLineEdit =
dynamic_cast<QLineEdit *
>( mNoDataTableWidget->cellWidget( row, 1 ) );
758 if ( !toLineEdit )
return;
759 bool toChanged = mNoDataToEdited.value( row );
760 QgsDebugMsg( QStringLiteral(
"toChanged = %1" ).arg( toChanged ) );
763 toLineEdit->setText( lineEdit->text() );
766 else if ( column == 1 )
768 setNoDataToEdited( row );
772 void QgsRasterLayerSaveAsDialog::mTileModeCheckBox_toggled(
bool toggled )
791 mTilesGroupBox->show();
793 mFilename->setDialogTitle( tr(
"Select Output Directory" ) );
797 mTilesGroupBox->hide();
799 mFilename->setDialogTitle( tr(
"Save Layer As" ) );
803 void QgsRasterLayerSaveAsDialog::mPyramidsGroupBox_toggled(
bool toggled )
806 populatePyramidsLevels();
809 void QgsRasterLayerSaveAsDialog::populatePyramidsLevels()
813 if ( mPyramidsGroupBox->isChecked() )
815 QList<QgsRasterPyramid> myPyramidList;
818 if ( mPyramidsUseExistingCheckBox->isChecked() )
824 if ( ! mPyramidsOptionsWidget->overviewList().isEmpty() )
825 myPyramidList = mDataProvider->
buildPyramidList( mPyramidsOptionsWidget->overviewList() );
827 QList<QgsRasterPyramid>::iterator myRasterPyramidIterator;
828 for ( myRasterPyramidIterator = myPyramidList.begin();
829 myRasterPyramidIterator != myPyramidList.end();
830 ++myRasterPyramidIterator )
832 if ( ! mPyramidsUseExistingCheckBox->isChecked() || myRasterPyramidIterator->exists )
834 text += QString::number( myRasterPyramidIterator->xDim ) + QStringLiteral(
"x" ) +
835 QString::number( myRasterPyramidIterator->yDim ) +
' ';
840 mPyramidResolutionsLineEdit->setText( text.trimmed() );
843 void QgsRasterLayerSaveAsDialog::setNoDataToEdited(
int row )
845 if ( row >= mNoDataToEdited.size() )
847 mNoDataToEdited.resize( row + 1 );
849 mNoDataToEdited[row] =
true;
852 double QgsRasterLayerSaveAsDialog::noDataCellValue(
int row,
int column )
const
854 QLineEdit *lineEdit =
dynamic_cast<QLineEdit *
>( mNoDataTableWidget->cellWidget( row, column ) );
855 if ( !lineEdit || lineEdit->text().isEmpty() )
857 return std::numeric_limits<double>::quiet_NaN();
862 void QgsRasterLayerSaveAsDialog::adjustNoDataCellWidth(
int row,
int column )
864 QLineEdit *lineEdit =
dynamic_cast<QLineEdit *
>( mNoDataTableWidget->cellWidget( row, column ) );
865 if ( !lineEdit )
return;
867 int width = std::max( lineEdit->fontMetrics().boundingRect( lineEdit->text() ).width() + 10, 100 );
868 width = std::max( width, mNoDataTableWidget->columnWidth( column ) );
870 lineEdit->setFixedWidth( width );
876 if ( ! mNoDataGroupBox->isChecked() )
879 int rows = mNoDataTableWidget->rowCount();
880 noDataList.reserve( rows );
881 for (
int r = 0; r < rows; r++ )
884 noDataList.append(
noData );
892 return mPyramidsGroupBox->isChecked() ? mPyramidsOptionsWidget->overviewList() : QList<int>();
897 if ( ! mPyramidsGroupBox->isChecked() )
899 else if ( mPyramidsUseExistingCheckBox->isChecked() )
905 bool QgsRasterLayerSaveAsDialog::validate()
const
907 if ( mCreateOptionsGroupBox->isChecked() )
909 QString message = mCreateOptionsWidget->validateOptions(
true,
false );
910 if ( !message.isNull() )
913 if ( mPyramidsGroupBox->isChecked() )
915 QString message = mPyramidsOptionsWidget->createOptionsWidget()->validateOptions(
true,
false );
916 if ( !message.isNull() )
922 bool QgsRasterLayerSaveAsDialog::outputLayerExists()
const
936 QgsRasterLayer rasterLayer( rasterUri, QString( ), QStringLiteral(
"gdal" ) );
937 if ( !vectorUri.isEmpty() )
939 QgsVectorLayer vectorLayer( vectorUri, QString( ), QStringLiteral(
"ogr" ) );
940 return rasterLayer.isValid() || vectorLayer.isValid();
944 return rasterLayer.isValid();
955 if (
outputFormat() == QLatin1String(
"GPKG" ) && outputLayerExists() &&
956 QMessageBox::warning(
this, tr(
"Save Raster Layer" ),
957 tr(
"The layer %1 already exists in the target file, and overwriting layers in GeoPackage is not supported. "
959 QMessageBox::Yes | QMessageBox::No ) == QMessageBox::No )
967 void QgsRasterLayerSaveAsDialog::showHelp()
969 QgsHelp::openHelp( QStringLiteral(
"managing_data_source/create_layers.html#save-layer-from-an-existing-file" ) );
@ Float32
Thirty two bit floating point (float)
@ Float64
Sixty four bit floating point (double)
static QIcon getThemeIcon(const QString &name)
Helper to get a theme icon.
This class represents a coordinate reference system (CRS).
virtual QString name() const =0
Returns a provider name.
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 QgsGui * instance()
Returns a pointer to the singleton instance.
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.
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.
virtual QList< QgsRasterPyramid > buildPyramidList(QList< int > overviewList=QList< int >())
Returns the raster layers pyramid list.
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.
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
QString outputFormat() const
QgsRectangle outputRectangle() const
QgsRasterLayerSaveAsDialog(QgsRasterLayer *rasterLayer, QgsRasterDataProvider *sourceProvider, const QgsRectangle ¤tExtent, const QgsCoordinateReferenceSystem &layerCrs, const QgsCoordinateReferenceSystem ¤tCrs, QWidget *parent=nullptr, Qt::WindowFlags f=Qt::WindowFlags())
Constructor for QgsRasterLayerSaveAsDialog.
QgsRaster::RasterBuildPyramids buildPyramidsFlag() const
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.
QgsRasterDataProvider * dataProvider() override
Returns the source data provider.
QgsRasterRenderer * renderer() const
Returns the raster's renderer.
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