-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #8898 (optional filter extent for vector save as)
- Loading branch information
Showing
11 changed files
with
454 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
#include "qgsextentgroupbox.h" | ||
|
||
#include "qgscoordinatetransform.h" | ||
#include "qgsrasterblock.h" | ||
|
||
QgsExtentGroupBox::QgsExtentGroupBox( QWidget* parent ) | ||
: QgsCollapsibleGroupBox( parent ) | ||
{ | ||
setupUi( this ); | ||
|
||
mXMinLineEdit->setValidator( new QDoubleValidator( this ) ); | ||
mXMaxLineEdit->setValidator( new QDoubleValidator( this ) ); | ||
mYMinLineEdit->setValidator( new QDoubleValidator( this ) ); | ||
mYMaxLineEdit->setValidator( new QDoubleValidator( this ) ); | ||
|
||
connect( mCurrentExtentButton, SIGNAL( clicked() ), this, SLOT( setOutputExtentFromCurrent() ) ); | ||
connect( mOriginalExtentButton, SIGNAL( clicked() ), this, SLOT( setOutputExtentFromOriginal() ) ); | ||
} | ||
|
||
|
||
void QgsExtentGroupBox::setOriginalExtent( const QgsRectangle& originalExtent, const QgsCoordinateReferenceSystem& originalCrs ) | ||
{ | ||
mOriginalExtent = originalExtent; | ||
mOriginalCrs = originalCrs; | ||
} | ||
|
||
|
||
void QgsExtentGroupBox::setCurrentExtent( const QgsRectangle& currentExtent, const QgsCoordinateReferenceSystem& currentCrs ) | ||
{ | ||
mCurrentExtent = currentExtent; | ||
mCurrentCrs = currentCrs; | ||
} | ||
|
||
void QgsExtentGroupBox::setOutputCrs( const QgsCoordinateReferenceSystem& outputCrs ) | ||
{ | ||
mOutputCrs = outputCrs; | ||
} | ||
|
||
|
||
void QgsExtentGroupBox::setOutputExtent( const QgsRectangle& r, const QgsCoordinateReferenceSystem& srcCrs, ExtentState state ) | ||
{ | ||
QgsRectangle extent; | ||
if ( mOutputCrs == srcCrs ) | ||
{ | ||
extent = r; | ||
} | ||
else | ||
{ | ||
QgsCoordinateTransform ct( srcCrs, mOutputCrs ); | ||
extent = ct.transformBoundingBox( r ); | ||
} | ||
|
||
mXMinLineEdit->setText( QgsRasterBlock::printValue( extent.xMinimum() ) ); | ||
mXMaxLineEdit->setText( QgsRasterBlock::printValue( extent.xMaximum() ) ); | ||
mYMinLineEdit->setText( QgsRasterBlock::printValue( extent.yMinimum() ) ); | ||
mYMaxLineEdit->setText( QgsRasterBlock::printValue( extent.yMaximum() ) ); | ||
|
||
mExtentState = state; | ||
|
||
updateExtentStateMsg(); | ||
|
||
emit extentChanged( extent ); | ||
} | ||
|
||
|
||
void QgsExtentGroupBox::updateExtentStateMsg() | ||
{ | ||
QString msg; | ||
switch ( mExtentState ) | ||
{ | ||
case OriginalExtent: | ||
msg = tr( "layer" ); | ||
break; | ||
case CurrentExtent: | ||
msg = tr( "map view" ); | ||
break; | ||
case UserExtent: | ||
msg = tr( "user defined" ); | ||
break; | ||
default: | ||
break; | ||
} | ||
msg = tr( "Extent (current: %1)" ).arg( msg ); | ||
|
||
setTitle( msg ); | ||
} | ||
|
||
|
||
void QgsExtentGroupBox::setOutputExtentFromCurrent() | ||
{ | ||
setOutputExtent( mCurrentExtent, mCurrentCrs, CurrentExtent ); | ||
} | ||
|
||
|
||
void QgsExtentGroupBox::setOutputExtentFromOriginal() | ||
{ | ||
setOutputExtent( mOriginalExtent, mOriginalCrs, OriginalExtent ); | ||
} | ||
|
||
|
||
QgsRectangle QgsExtentGroupBox::outputExtent() const | ||
{ | ||
return QgsRectangle( mXMinLineEdit->text().toDouble(), mYMinLineEdit->text().toDouble(), | ||
mXMaxLineEdit->text().toDouble(), mYMaxLineEdit->text().toDouble() ); | ||
} |
Oops, something went wrong.