Navigation Menu

Skip to content

Commit

Permalink
- fix #7441
Browse files Browse the repository at this point in the history
- 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 Sep 3, 2013
1 parent fef175b commit 5329ad5
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/app/qgsmeasuredialog.cpp
Expand Up @@ -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
{
Expand All @@ -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 ) )
Expand Down
29 changes: 26 additions & 3 deletions src/app/qgsprojectproperties.cpp
Expand Up @@ -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" ) ) );
}
Expand Down Expand Up @@ -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 ) );
Expand All @@ -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.