Skip to content
Permalink
Browse files

- fix #7441

- reset unit settings to original ones when deactivating OTF projection

- added OTF status (on/off) to mesuredialog title

- resets prefered units and selected srs
- when OTF transfo is deselected, this resets the units value to the
  original ones
  • Loading branch information
vmora authored and m-kuhn committed Jul 30, 2013
1 parent fef175b commit 5329ad5896d5b23189f9603f11793c79fb147672
Showing with 28 additions and 3 deletions.
  1. +2 −0 src/app/qgsmeasuredialog.cpp
  2. +26 −3 src/app/qgsprojectproperties.cpp
@@ -222,6 +222,7 @@ void QgsMeasureDialog::updateUi()
toolTip += "<br> * " + tr( "Project CRS transformation is turned off." ) + " ";
toolTip += tr( "Canvas units setting is taken from project properties setting (%1)." ).arg( QGis::tr( mCanvasUnits ) );
toolTip += "<br> * " + tr( "Ellipsoidal calculation is not possible, as project CRS is undefined." );
setWindowTitle( tr("Measure (OTF off)"));
}
else
{
@@ -235,6 +236,7 @@ void QgsMeasureDialog::updateUi()
toolTip += "<br> * " + tr( "Project CRS transformation is turned on but ellipsoidal calculation is not selected." );
toolTip += "<br> * " + tr( "The canvas units setting is taken from the project CRS (%1)." ).arg( QGis::tr( mCanvasUnits ) );
}
setWindowTitle( tr("Measure (OTF on)"));
}

if (( mCanvasUnits == QGis::Meters && mDisplayUnits == QGis::Feet ) || ( mCanvasUnits == QGis::Feet && mDisplayUnits == QGis::Meters ) )
@@ -814,12 +814,35 @@ void QgsProjectProperties::on_cbxProjectionEnabled_toggled( bool onFlyEnabled )
QString unitsOnFlyState = tr( "Canvas units (CRS transformation: %1)" );
if ( !onFlyEnabled )
{
if ( !mProjectSrsId )
// reset projection to default
const QMap<QString, QgsMapLayer*> &mapLayers = QgsMapLayerRegistry::instance()->mapLayers();

if ( mMapCanvas->currentLayer() )
{
mLayerSrsId = mMapCanvas->currentLayer()->crs().srsid();
}
else if ( mapLayers.size() > 0 )
{
mProjectSrsId = projectionSelector->selectedCrsId();
mLayerSrsId = mapLayers.begin().value()->crs().srsid();
}
else
{
mLayerSrsId = mProjectSrsId;
}
mProjectSrsId = mLayerSrsId;
projectionSelector->setSelectedCrsId( mLayerSrsId );

QgsCoordinateReferenceSystem srs( mLayerSrsId, QgsCoordinateReferenceSystem::InternalCrsId );
//set radio button to crs map unit type
QGis::UnitType units = srs.mapUnits();

radMeters->setChecked( units == QGis::Meters );
radFeet->setChecked( units == QGis::Feet );
radDegrees->setChecked( units == QGis::Degrees );

// unset ellipsoid
mEllipsoidIndex = 0;

btnGrpMeasureEllipsoid->setTitle( measureOnFlyState.arg( tr( "OFF" ) ) );
btnGrpMapUnits->setTitle( unitsOnFlyState.arg( tr( "OFF" ) ) );
}
@@ -1452,7 +1475,6 @@ void QgsProjectProperties::updateEllipsoidUI( int newIndex )
leSemiMajor->setToolTip( tr( "Select %1 from pull-down menu to adjust radii" ).arg( tr( "Parameters:" ) ) );
leSemiMinor->setToolTip( tr( "Select %1 from pull-down menu to adjust radii" ).arg( tr( "Parameters:" ) ) );
}
cmbEllipsoid->setCurrentIndex( mEllipsoidIndex ); // Not always necessary
if ( mEllipsoidList[ mEllipsoidIndex ].acronym != GEO_NONE )
{
leSemiMajor->setText( QLocale::system().toString( myMajor, 'f', 3 ) );
@@ -1464,4 +1486,5 @@ void QgsProjectProperties::updateEllipsoidUI( int newIndex )
cmbEllipsoid->setEnabled( false );
cmbEllipsoid->setToolTip( tr( "Can only use ellipsoidal calculations when CRS transformation is enabled" ) );
}
cmbEllipsoid->setCurrentIndex( mEllipsoidIndex ); // Not always necessary
}

0 comments on commit 5329ad5

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