Index: src/app/qgsoptions.cpp =================================================================== --- src/app/qgsoptions.cpp (Revision 15531) +++ src/app/qgsoptions.cpp (Arbeitskopie) @@ -109,6 +109,17 @@ } } + //image creation options + QMap defaultImageCreationMap; + defaultImageCreationMap.insert( "COMPRESS", "PACKBITS" ); + defaultImageCreationMap.insert( "BIGTIFF", "IF_NEEDED" ); + QMap imageCreationOptions = settings.value( "/qgis/imageCreationOptions", QVariant( defaultImageCreationMap ) ).toMap(); + QMap::const_iterator creationIt = imageCreationOptions.constBegin(); + for ( ; creationIt != imageCreationOptions.constEnd(); ++creationIt ) + { + mImageCreationOptionsLineEdit->append( creationIt.key() + "=" + creationIt.value().toString() ); + } + //Network timeout mNetworkTimeoutSpinBox->setValue( settings.value( "/qgis/networkAndProxy/networkTimeout", "60000" ).toInt() ); @@ -401,35 +412,6 @@ groupBox_5->setEnabled( false ); #endif //Q_WS_MAC - //overlay placement algorithm - mOverlayAlgorithmComboBox->insertItem( 0, tr( "Central point (fastest)" ) ); - mOverlayAlgorithmComboBox->insertItem( 1, tr( "Chain (fast)" ) ); - mOverlayAlgorithmComboBox->insertItem( 2, tr( "Popmusic tabu chain (slow)" ) ); - mOverlayAlgorithmComboBox->insertItem( 3, tr( "Popmusic tabu (slow)" ) ); - mOverlayAlgorithmComboBox->insertItem( 4, tr( "Popmusic chain (very slow)" ) ); - - QString overlayAlgorithmString = settings.value( "qgis/overlayPlacementAlgorithm", "Central point" ).toString(); - if ( overlayAlgorithmString == "Chain" ) - { - mOverlayAlgorithmComboBox->setCurrentIndex( 1 ); - } - else if ( overlayAlgorithmString == "Popmusic tabu chain" ) - { - mOverlayAlgorithmComboBox->setCurrentIndex( 2 ); - } - else if ( overlayAlgorithmString == "Popmusic tabu" ) - { - mOverlayAlgorithmComboBox->setCurrentIndex( 3 ); - } - else if ( overlayAlgorithmString == "Popmusic chain" ) - { - mOverlayAlgorithmComboBox->setCurrentIndex( 4 ); - } - else - { - mOverlayAlgorithmComboBox->setCurrentIndex( 0 ); - } //default is central point - restoreGeometry( settings.value( "/Windows/Options/geometry" ).toByteArray() ); tabWidget->setCurrentIndex( settings.value( "/Windows/Options/row" ).toInt() ); } @@ -586,29 +568,6 @@ settings.setValue( "/qgis/warnOldProjectVersion", chbWarnOldProjectVersion->isChecked() ); settings.setValue( "/qgis/nullValue", leNullValue->text() ); - //overlay placement method - int overlayIndex = mOverlayAlgorithmComboBox->currentIndex(); - if ( overlayIndex == 1 ) - { - settings.setValue( "/qgis/overlayPlacementAlgorithm", "Chain" ); - } - else if ( overlayIndex == 2 ) - { - settings.setValue( "/qgis/overlayPlacementAlgorithm", "Popmusic tabu chain" ); - } - else if ( overlayIndex == 3 ) - { - settings.setValue( "/qgis/overlayPlacementAlgorithm", "Popmusic tabu" ); - } - else if ( overlayIndex == 4 ) - { - settings.setValue( "/qgis/overlayPlacementAlgorithm", "Popmusic chain" ); - } - else - { - settings.setValue( "/qgis/overlayPlacementAlgorithm", "Central point" ); - } - if ( cmbTheme->currentText().length() == 0 ) { settings.setValue( "/Themes", "default" ); @@ -618,6 +577,25 @@ settings.setValue( "/Themes", cmbTheme->currentText() ); } + //image creation options + QString imageCreationString = mImageCreationOptionsLineEdit->toPlainText(); + QStringList imageCreationOptions = imageCreationString.split( "\n" ); + + QMap< QString, QVariant > imageCreationMap; + QStringList::const_iterator optionIt = imageCreationOptions.constBegin(); + for ( ; optionIt != imageCreationOptions.constEnd(); ++optionIt ) + { + QStringList equalSplit = optionIt->split( "=" ); + if ( equalSplit.size() > 1 ) + { + QString option = equalSplit.at( 0 ).trimmed(); + QString value = equalSplit.at( 1 ).trimmed(); + imageCreationMap.insert( option, value ); + } + + } + settings.setValue( "/qgis/imageCreationOptions", imageCreationMap ); + settings.setValue( "/IconSize", cmbSize->currentText() ); settings.setValue( "/Map/updateThreshold", spinBoxUpdateThreshold->value() ); Index: src/app/qgisapp.cpp =================================================================== --- src/app/qgisapp.cpp (Revision 15531) +++ src/app/qgisapp.cpp (Arbeitskopie) @@ -2643,10 +2643,15 @@ QgsRasterCalcDialog d; if ( d.exec() == QDialog::Accepted ) { - //invoke analysis library - //extent and output resolution will come later... - QgsRasterCalculator rc( d.formulaString(), d.outputFile(), d.outputFormat(), d.outputRectangle(), d.numberOfColumns(), d.numberOfRows(), d.rasterEntries() ); + //read image creation options from settings + QSettings settings; + QMap defaultImageCreationMap; + defaultImageCreationMap.insert( "COMPRESS", "PACKBITS" ); + defaultImageCreationMap.insert( "BIGTIFF", "IF_NEEDED" ); + QMap imageCreationOptions = settings.value( "/qgis/imageCreationOptions", QVariant( defaultImageCreationMap ) ).toMap(); + QgsRasterCalculator rc( d.formulaString(), d.outputFile(), d.outputFormat(), d.outputRectangle(), d.numberOfColumns(), d.numberOfRows(), d.rasterEntries(), imageCreationOptions ); + QProgressDialog p( tr( "Calculating..." ), tr( "Abort..." ), 0, 0 ); p.setWindowModality( Qt::WindowModal ); if ( rc.processCalculation( &p ) == 0 ) Index: src/plugins/raster_terrain_analysis/qgsrasterterrainanalysisplugin.cpp =================================================================== --- src/plugins/raster_terrain_analysis/qgsrasterterrainanalysisplugin.cpp (Revision 15531) +++ src/plugins/raster_terrain_analysis/qgsrasterterrainanalysisplugin.cpp (Arbeitskopie) @@ -27,6 +27,7 @@ #include "qgsrasterterrainanalysisdialog.h" #include #include +#include static const QString name_ = QObject::tr( "Raster Terrain Analysis plugin" ); static const QString description_ = QObject::tr( "A plugin for raster based terrain analysis" ); @@ -84,22 +85,29 @@ QString outputFile = d.selectedOuputFilePath(); int returnValue; + //image creation options + QSettings settings; + QMap defaultImageCreationMap; + defaultImageCreationMap.insert( "COMPRESS", "PACKBITS" ); + defaultImageCreationMap.insert( "BIGTIFF", "IF_NEEDED" ); + QMap imageCreationOptions = settings.value( "/qgis/imageCreationOptions", QVariant( defaultImageCreationMap ) ).toMap(); + QgsNineCellFilter* filter = 0; if ( d.selectedAnalysisMethod() == tr( "Slope" ) ) { - filter = new QgsSlopeFilter( inputFilePath, outputFile, selectedFormat ); + filter = new QgsSlopeFilter( inputFilePath, outputFile, selectedFormat, imageCreationOptions ); } else if ( d.selectedAnalysisMethod() == tr( "Aspect" ) ) { - filter = new QgsAspectFilter( inputFilePath, outputFile, selectedFormat ); + filter = new QgsAspectFilter( inputFilePath, outputFile, selectedFormat, imageCreationOptions ); } else if ( d.selectedAnalysisMethod() == tr( "Ruggedness index" ) ) { - filter = new QgsRuggednessFilter( inputFilePath, outputFile, selectedFormat ); + filter = new QgsRuggednessFilter( inputFilePath, outputFile, selectedFormat, imageCreationOptions ); } else if ( d.selectedAnalysisMethod() == tr( "Total curvature" ) ) { - filter = new QgsTotalCurvatureFilter( inputFilePath, outputFile, selectedFormat ); + filter = new QgsTotalCurvatureFilter( inputFilePath, outputFile, selectedFormat, imageCreationOptions ); } if ( filter ) Index: src/analysis/raster/qgsaspectfilter.cpp =================================================================== --- src/analysis/raster/qgsaspectfilter.cpp (Revision 15531) +++ src/analysis/raster/qgsaspectfilter.cpp (Arbeitskopie) @@ -17,8 +17,8 @@ #include "qgsaspectfilter.h" -QgsAspectFilter::QgsAspectFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat ) : - QgsDerivativeFilter( inputFile, outputFile, outputFormat ) +QgsAspectFilter::QgsAspectFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat, const QMap< QString, QVariant >& creationOptionsMap ) : + QgsDerivativeFilter( inputFile, outputFile, outputFormat, creationOptionsMap ) { } Index: src/analysis/raster/qgsslopefilter.cpp =================================================================== --- src/analysis/raster/qgsslopefilter.cpp (Revision 15531) +++ src/analysis/raster/qgsslopefilter.cpp (Arbeitskopie) @@ -17,8 +17,8 @@ #include "qgsslopefilter.h" -QgsSlopeFilter::QgsSlopeFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat ): \ - QgsDerivativeFilter( inputFile, outputFile, outputFormat ) +QgsSlopeFilter::QgsSlopeFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat, const QMap< QString, QVariant >& creationOptionsMap ): \ + QgsDerivativeFilter( inputFile, outputFile, outputFormat, creationOptionsMap ) { } Index: src/analysis/raster/qgstotalcurvaturefilter.cpp =================================================================== --- src/analysis/raster/qgstotalcurvaturefilter.cpp (Revision 15531) +++ src/analysis/raster/qgstotalcurvaturefilter.cpp (Arbeitskopie) @@ -17,8 +17,8 @@ #include "qgstotalcurvaturefilter.h" -QgsTotalCurvatureFilter::QgsTotalCurvatureFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat ): \ - QgsNineCellFilter( inputFile, outputFile, outputFormat ) +QgsTotalCurvatureFilter::QgsTotalCurvatureFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat, const QMap< QString, QVariant >& creationOptionsMap ): \ + QgsNineCellFilter( inputFile, outputFile, outputFormat, creationOptionsMap ) { } Index: src/analysis/raster/qgsaspectfilter.h =================================================================== --- src/analysis/raster/qgsaspectfilter.h (Revision 15531) +++ src/analysis/raster/qgsaspectfilter.h (Arbeitskopie) @@ -24,7 +24,7 @@ class ANALYSIS_EXPORT QgsAspectFilter: public QgsDerivativeFilter { public: - QgsAspectFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat ); + QgsAspectFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat, const QMap< QString, QVariant >& creationOptionsMap ); ~QgsAspectFilter(); protected: Index: src/analysis/raster/qgsslopefilter.h =================================================================== --- src/analysis/raster/qgsslopefilter.h (Revision 15531) +++ src/analysis/raster/qgsslopefilter.h (Arbeitskopie) @@ -24,7 +24,7 @@ class ANALYSIS_EXPORT QgsSlopeFilter: public QgsDerivativeFilter { public: - QgsSlopeFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat ); + QgsSlopeFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat, const QMap< QString, QVariant >& creationOptionsMap ); ~QgsSlopeFilter(); protected: Index: src/analysis/raster/qgstotalcurvaturefilter.h =================================================================== --- src/analysis/raster/qgstotalcurvaturefilter.h (Revision 15531) +++ src/analysis/raster/qgstotalcurvaturefilter.h (Arbeitskopie) @@ -24,7 +24,7 @@ class ANALYSIS_EXPORT QgsTotalCurvatureFilter: public QgsNineCellFilter { public: - QgsTotalCurvatureFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat ); + QgsTotalCurvatureFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat, const QMap< QString, QVariant >& creationOptionsMap ); ~QgsTotalCurvatureFilter(); protected: Index: src/analysis/raster/qgsninecellfilter.cpp =================================================================== --- src/analysis/raster/qgsninecellfilter.cpp (Revision 15531) +++ src/analysis/raster/qgsninecellfilter.cpp (Arbeitskopie) @@ -25,8 +25,9 @@ #define TO8(x) (x).toLocal8Bit().constData() #endif -QgsNineCellFilter::QgsNineCellFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat ): \ - mInputFile( inputFile ), mOutputFile( outputFile ), mOutputFormat( outputFormat ), mCellSizeX( -1 ), mCellSizeY( -1 ), mInputNodataValue( -1 ), mOutputNodataValue( -1 ) +QgsNineCellFilter::QgsNineCellFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat, const QMap< QString, QVariant >& creationOptionsMap ): \ + mInputFile( inputFile ), mOutputFile( outputFile ), mOutputFormat( outputFormat ), mCellSizeX( -1 ), mCellSizeY( -1 ), mInputNodataValue( -1 ), mOutputNodataValue( -1 ), + mCreationOptionsMap( creationOptionsMap ) { } @@ -244,8 +245,13 @@ int ySize = GDALGetRasterYSize( inputDataset );; //open output file - char **papszOptions = NULL; - GDALDatasetH outputDataset = GDALCreate( outputDriver, mOutputFile.toLocal8Bit().data(), xSize, ySize, 1, GDT_Float32, papszOptions ); + char** rasterCreationOptions = 0; + QMap< QString, QVariant >::const_iterator optionIt = mCreationOptionsMap.constBegin(); + for ( ; optionIt != mCreationOptionsMap.constEnd(); ++optionIt ) + { + rasterCreationOptions = CSLSetNameValue( rasterCreationOptions, optionIt.key().toLocal8Bit().data(), optionIt.value().toString().toLocal8Bit().data() ); + } + GDALDatasetH outputDataset = GDALCreate( outputDriver, mOutputFile.toLocal8Bit().data(), xSize, ySize, 1, GDT_Float32, rasterCreationOptions ); if ( outputDataset == NULL ) { return outputDataset; Index: src/analysis/raster/qgsninecellfilter.h =================================================================== --- src/analysis/raster/qgsninecellfilter.h (Revision 15531) +++ src/analysis/raster/qgsninecellfilter.h (Arbeitskopie) @@ -18,7 +18,9 @@ #ifndef QGSNINECELLFILTER_H #define QGSNINECELLFILTER_H +#include #include +#include #include "gdal.h" class QProgressDialog; @@ -31,7 +33,7 @@ { public: /**Constructor that takes input file, output file and output format (GDAL string)*/ - QgsNineCellFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat ); + QgsNineCellFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat, const QMap< QString, QVariant >& creationOptionsMap = QMap< QString, QVariant>() ); virtual ~QgsNineCellFilter(); /**Starts the calculation, reads from mInputFile and stores the result in mOutputFile @param p progress dialog that receives update and that is checked for abort. 0 if no progress bar is needed. @@ -67,6 +69,8 @@ float mInputNodataValue; /**The nodata value of the output layer*/ float mOutputNodataValue; + /**Image creation options*/ + QMap< QString, QVariant > mCreationOptionsMap; }; #endif // QGSNINECELLFILTER_H Index: src/analysis/raster/qgsderivativefilter.cpp =================================================================== --- src/analysis/raster/qgsderivativefilter.cpp (Revision 15531) +++ src/analysis/raster/qgsderivativefilter.cpp (Arbeitskopie) @@ -17,8 +17,8 @@ #include "qgsderivativefilter.h" -QgsDerivativeFilter::QgsDerivativeFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat ): \ - QgsNineCellFilter( inputFile, outputFile, outputFormat ) +QgsDerivativeFilter::QgsDerivativeFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat, const QMap< QString, QVariant >& creationOptionsMap ): \ + QgsNineCellFilter( inputFile, outputFile, outputFormat, creationOptionsMap ) { } Index: src/analysis/raster/qgsrastercalculator.cpp =================================================================== --- src/analysis/raster/qgsrastercalculator.cpp (Revision 15531) +++ src/analysis/raster/qgsrastercalculator.cpp (Arbeitskopie) @@ -31,8 +31,10 @@ #endif QgsRasterCalculator::QgsRasterCalculator( const QString& formulaString, const QString& outputFile, const QString& outputFormat, - const QgsRectangle& outputExtent, int nOutputColumns, int nOutputRows, const QVector& rasterEntries ): mFormulaString( formulaString ), mOutputFile( outputFile ), mOutputFormat( outputFormat ), - mOutputRectangle( outputExtent ), mNumOutputColumns( nOutputColumns ), mNumOutputRows( nOutputRows ), mRasterEntries( rasterEntries ) + const QgsRectangle& outputExtent, int nOutputColumns, int nOutputRows, const QVector& rasterEntries, + const QMap< QString, QVariant >& rasterCreationOptions ): mFormulaString( formulaString ), mOutputFile( outputFile ), mOutputFormat( outputFormat ), + mOutputRectangle( outputExtent ), mNumOutputColumns( nOutputColumns ), mNumOutputRows( nOutputRows ), mRasterEntries( rasterEntries ), + mRasterCreationOptions( rasterCreationOptions ) { } @@ -247,9 +249,13 @@ GDALDatasetH QgsRasterCalculator::openOutputFile( GDALDriverH outputDriver ) { - //open output file - char **papszOptions = NULL; - GDALDatasetH outputDataset = GDALCreate( outputDriver, mOutputFile.toLocal8Bit().data(), mNumOutputColumns, mNumOutputRows, 1, GDT_Float32, papszOptions ); + char** rasterCreationOptions = 0; + QMap< QString, QVariant >::const_iterator optionIt = mRasterCreationOptions.constBegin(); + for ( ; optionIt != mRasterCreationOptions.constEnd(); ++optionIt ) + { + rasterCreationOptions = CSLSetNameValue( rasterCreationOptions, optionIt.key().toLocal8Bit().data(), optionIt.value().toString().toLocal8Bit().data() ); + } + GDALDatasetH outputDataset = GDALCreate( outputDriver, mOutputFile.toLocal8Bit().data(), mNumOutputColumns, mNumOutputRows, 1, GDT_Float32, rasterCreationOptions ); if ( outputDataset == NULL ) { return outputDataset; Index: src/analysis/raster/qgsruggednessfilter.cpp =================================================================== --- src/analysis/raster/qgsruggednessfilter.cpp (Revision 15531) +++ src/analysis/raster/qgsruggednessfilter.cpp (Arbeitskopie) @@ -17,7 +17,8 @@ #include "qgsruggednessfilter.h" -QgsRuggednessFilter::QgsRuggednessFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat ): QgsNineCellFilter( inputFile, outputFile, outputFormat ) +QgsRuggednessFilter::QgsRuggednessFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat, const QMap< QString, QVariant >& creationOptionsMap ): + QgsNineCellFilter( inputFile, outputFile, outputFormat, creationOptionsMap ) { } Index: src/analysis/raster/qgsderivativefilter.h =================================================================== --- src/analysis/raster/qgsderivativefilter.h (Revision 15531) +++ src/analysis/raster/qgsderivativefilter.h (Arbeitskopie) @@ -24,7 +24,7 @@ class QgsDerivativeFilter: public QgsNineCellFilter { public: - QgsDerivativeFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat ); + QgsDerivativeFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat, const QMap< QString, QVariant >& creationOptionsMap ); virtual ~QgsDerivativeFilter(); //to be implemented by subclasses virtual float processNineCellWindow( float* x11, float* x21, float* x31, float* x12, float* x22, \ Index: src/analysis/raster/qgsrastercalculator.h =================================================================== --- src/analysis/raster/qgsrastercalculator.h (Revision 15531) +++ src/analysis/raster/qgsrastercalculator.h (Arbeitskopie) @@ -40,7 +40,8 @@ { public: QgsRasterCalculator( const QString& formulaString, const QString& outputFile, const QString& outputFormat, - const QgsRectangle& outputExtent, int nOutputColumns, int nOutputRows, const QVector& rasterEntries ); + const QgsRectangle& outputExtent, int nOutputColumns, int nOutputRows, const QVector& rasterEntries, + const QMap< QString, QVariant >& rasterCreationOptions = QMap< QString, QVariant >() ); ~QgsRasterCalculator(); /**Starts the calculation and writes new raster @@ -98,6 +99,8 @@ /***/ QVector mRasterEntries; + + QMap< QString, QVariant > mRasterCreationOptions; }; #endif // QGSRASTERCALCULATOR_H Index: src/analysis/raster/qgsruggednessfilter.h =================================================================== --- src/analysis/raster/qgsruggednessfilter.h (Revision 15531) +++ src/analysis/raster/qgsruggednessfilter.h (Arbeitskopie) @@ -25,7 +25,7 @@ class ANALYSIS_EXPORT QgsRuggednessFilter: public QgsNineCellFilter { public: - QgsRuggednessFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat ); + QgsRuggednessFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat, const QMap< QString, QVariant >& creationOptionsMap ); ~QgsRuggednessFilter(); protected: Index: src/ui/qgsoptionsbase.ui =================================================================== --- src/ui/qgsoptionsbase.ui (Revision 15531) +++ src/ui/qgsoptionsbase.ui (Arbeitskopie) @@ -6,8 +6,8 @@ 0 0 - 825 - 503 + 775 + 513 @@ -33,7 +33,7 @@ - 0 + 2 @@ -60,8 +60,8 @@ 0 0 - 780 - 755 + 715 + 766 @@ -499,8 +499,8 @@ 0 0 - 780 - 433 + 731 + 475 @@ -659,7 +659,7 @@ Map tools - + @@ -669,12 +669,12 @@ 0 - 0 - 780 - 456 + -281 + 715 + 685 - + @@ -925,81 +925,18 @@ - - - - - - - - - - :/images/themes/default/propertyicons/overlay.png:/images/themes/default/propertyicons/overlay.png - - - Overlays - - - - - - true - - - - - 0 - 0 - 795 - 415 - - - - - + + - Position + Image creation options - - - - - Placement algorithm - - + + + - - - - Qt::Horizontal - - - - 221 - 20 - - - - - - - - - - - Qt::Vertical - - - - 20 - 461 - - - - @@ -1025,8 +962,8 @@ 0 0 - 795 - 415 + 731 + 422 @@ -1355,8 +1292,8 @@ 0 0 - 795 - 415 + 731 + 404 @@ -1523,8 +1460,8 @@ 0 0 - 780 - 527 + 731 + 546 @@ -1614,8 +1551,8 @@ 0 0 - 780 - 461 + 731 + 520 @@ -1894,8 +1831,6 @@ mGonRadioButton cmbWheelAction spinZoomFactor - scrollArea_4 - mOverlayAlgorithmComboBox scrollArea_5 mLineWidthSpinBox mLineColorToolButton