Skip to content
Permalink
Browse files

layer crs instead of provider crs in raster save dialog

  • Loading branch information
blazek committed Aug 21, 2012
1 parent 953c4e0 commit a205034999d606c8d3f47fd62dff4ea2e6a38b64
Showing with 11 additions and 8 deletions.
  1. +1 −1 src/app/qgisapp.cpp
  2. +8 −6 src/gui/qgsrasterlayersaveasdialog.cpp
  3. +2 −1 src/gui/qgsrasterlayersaveasdialog.h
@@ -3924,7 +3924,7 @@ void QgisApp::saveAsRasterFile()
return;
}

QgsRasterLayerSaveAsDialog d( rasterLayer->dataProvider(), mMapCanvas->extent(), mMapCanvas->mapRenderer()->destinationCrs() );
QgsRasterLayerSaveAsDialog d( rasterLayer->dataProvider(), mMapCanvas->extent(), rasterLayer->crs(), mMapCanvas->mapRenderer()->destinationCrs() );
if ( d.exec() == QDialog::Accepted )
{
QgsRasterFileWriter fileWriter( d.outputFileName() );
@@ -9,11 +9,13 @@
#include <QSettings>

QgsRasterLayerSaveAsDialog::QgsRasterLayerSaveAsDialog( QgsRasterDataProvider* sourceProvider, const QgsRectangle& currentExtent,
const QgsCoordinateReferenceSystem& layerCrs,
const QgsCoordinateReferenceSystem& currentCrs,
QWidget* parent, Qt::WindowFlags f ):
QDialog( parent, f )
, mDataProvider( sourceProvider )
, mCurrentExtent( currentExtent )
, mLayerCrs( layerCrs )
, mCurrentCrs( currentCrs )
, mExtentState( OriginalExtent )
, mResolutionState( OriginalResolution )
@@ -40,7 +42,7 @@ QgsRasterLayerSaveAsDialog::QgsRasterLayerSaveAsDialog( QgsRasterDataProvider* s
if ( mDataProvider )
{
//extent
setOutputExtent( mDataProvider->extent(), mDataProvider->crs(), OriginalExtent );
setOutputExtent( mDataProvider->extent(), mLayerCrs, OriginalExtent );

if ( mDataProvider->capabilities() & QgsRasterDataProvider::ExactResolution )
{
@@ -130,7 +132,7 @@ void QgsRasterLayerSaveAsDialog::on_mOriginalExtentButton_clicked()
{
if ( mDataProvider )
{
setOutputExtent( mDataProvider->extent(), mDataProvider->crs(), OriginalExtent );
setOutputExtent( mDataProvider->extent(), mLayerCrs, OriginalExtent );
}
}

@@ -266,7 +268,7 @@ void QgsRasterLayerSaveAsDialog::setOriginalResolution()
// Init to something if no original resolution is available
xRes = yRes = mDataProvider->extent().width() / 100;
}
setResolution( xRes, yRes, mDataProvider->crs() );
setResolution( xRes, yRes, mLayerCrs );
mResolutionState = OriginalResolution;
recalcSize();
}
@@ -414,7 +416,7 @@ void QgsRasterLayerSaveAsDialog::crsChanged()
if ( mExtentState == OriginalExtent )
{
previousExtent = mDataProvider->extent();
previousCrs = mDataProvider->crs();
previousCrs = mLayerCrs;
}
else if ( mExtentState == CurrentExtent )
{
@@ -456,7 +458,7 @@ void QgsRasterLayerSaveAsDialog::updateCrsGroup()
QgsDebugMsg( "Entered" );

mCrsComboBox->setItemText( mCrsComboBox->findData( OriginalCrs ),
tr( "Layer" ) + " (" + mDataProvider->crs().description() + ", " + mDataProvider->crs().authid() + ")" );
tr( "Layer" ) + " (" + mLayerCrs.description() + ", " + mLayerCrs.authid() + ")" );

mCrsComboBox->setItemText( mCrsComboBox->findData( CurrentCrs ),
tr( "Project" ) + " (" + mCurrentCrs.description() + ", " + mCurrentCrs.authid() + ")" );
@@ -470,7 +472,7 @@ QgsCoordinateReferenceSystem QgsRasterLayerSaveAsDialog::outputCrs()
int state = mCrsComboBox->itemData( mCrsComboBox->currentIndex() ).toInt();
if ( state == OriginalCrs )
{
return mDataProvider->crs();
return mLayerCrs;
}
else if ( state == CurrentCrs )
{
@@ -35,7 +35,7 @@ class GUI_EXPORT QgsRasterLayerSaveAsDialog: public QDialog, private Ui::QgsRast
UserResolution
};

QgsRasterLayerSaveAsDialog( QgsRasterDataProvider* sourceProvider, const QgsRectangle& currentExtent, const QgsCoordinateReferenceSystem& currentCrs, QWidget* parent = 0, Qt::WindowFlags f = 0 );
QgsRasterLayerSaveAsDialog( QgsRasterDataProvider* sourceProvider, const QgsRectangle& currentExtent, const QgsCoordinateReferenceSystem& layerCrs, const QgsCoordinateReferenceSystem& currentCrs, QWidget* parent = 0, Qt::WindowFlags f = 0 );
~QgsRasterLayerSaveAsDialog();

Mode mode() const;
@@ -82,6 +82,7 @@ class GUI_EXPORT QgsRasterLayerSaveAsDialog: public QDialog, private Ui::QgsRast
private:
QgsRasterDataProvider* mDataProvider;
QgsRectangle mCurrentExtent;
QgsCoordinateReferenceSystem mLayerCrs; // may differ from provider CRS
QgsCoordinateReferenceSystem mCurrentCrs;
QgsCoordinateReferenceSystem mUserCrs;
QgsCoordinateReferenceSystem mPreviousCrs;

0 comments on commit a205034

Please sign in to comment.
You can’t perform that action at this time.