QgsExtentGroupBox::QgsExtentGroupBox( QWidget* parent ) : QgsCollapsibleGroupBox( parent ) , mTitleBase( tr( "Extent" ) ) , mExtentState( OriginalExtent ) { 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() ) ); connect( this, SIGNAL( clicked( bool ) ), this, SLOT( groupBoxClicked() ) ); }
void QgsExtentGroupBox::setOutputCrs( const QgsCoordinateReferenceSystem &outputCrs ) { if ( mOutputCrs != outputCrs ) { switch ( mExtentState ) { case CurrentExtent: mOutputCrs = outputCrs; setOutputExtentFromCurrent(); break; case OriginalExtent: mOutputCrs = outputCrs; setOutputExtentFromOriginal(); break; case ProjectLayerExtent: mOutputCrs = outputCrs; setOutputExtentFromLayer( mExtentLayer.data() ); break; case DrawOnCanvas: mOutputCrs = outputCrs; extentDrawn( outputExtent() ); break; case UserExtent: try { QgsCoordinateTransform ct( mOutputCrs, outputCrs ); QgsRectangle extent = ct.transformBoundingBox( outputExtent() ); mOutputCrs = outputCrs; setOutputExtentFromUser( extent, outputCrs ); } catch ( QgsCsException & ) { // can't reproject mOutputCrs = outputCrs; } break; } } }