mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
Fix #10392 (ellipsoid for measurement keep getting reset)
This commit is contained in:
parent
42d14d72af
commit
aa09c8cbe6
@ -102,4 +102,7 @@ class QgsProjectionSelector : QWidget
|
||||
void refresh();
|
||||
//! Let listeners know if find has focus so they can adjust the default button
|
||||
void searchBoxHasFocus( bool );
|
||||
//! Notify others that the widget is now fully initialized, including deferred selection of projection
|
||||
//! @note added in 2.4
|
||||
void initialized();
|
||||
};
|
||||
|
@ -74,6 +74,7 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *pa
|
||||
connect( buttonBox->button( QDialogButtonBox::Apply ), SIGNAL( clicked() ), this, SLOT( apply() ) );
|
||||
connect( this, SIGNAL( accepted() ), this, SLOT( apply() ) );
|
||||
connect( projectionSelector, SIGNAL( sridSelected( QString ) ), this, SLOT( setMapUnitsToCurrentProjection() ) );
|
||||
connect( projectionSelector, SIGNAL( initialized() ), this, SLOT( projectionSelectorInitialized() ) );
|
||||
|
||||
connect( cmbEllipsoid, SIGNAL( currentIndexChanged( int ) ), this, SLOT( updateEllipsoidUI( int ) ) );
|
||||
|
||||
@ -123,33 +124,10 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *pa
|
||||
cbxAbsolutePath->setCurrentIndex( QgsProject::instance()->readBoolEntry( "Paths", "/Absolute", true ) ? 0 : 1 );
|
||||
|
||||
// populate combo box with ellipsoids
|
||||
|
||||
QgsDebugMsg( "Setting upp ellipsoid" );
|
||||
|
||||
// selection of the ellipsoid from settings is defferred to a later point, because it would
|
||||
// be overridden in the meanwhile by the projection selector
|
||||
populateEllipsoidList();
|
||||
|
||||
// Reading ellipsoid from setttings
|
||||
QStringList mySplitEllipsoid = QgsProject::instance()->readEntry( "Measure", "/Ellipsoid", GEO_NONE ).split( ':' );
|
||||
|
||||
int myIndex = 0;
|
||||
for ( int i = 0; i < mEllipsoidList.length(); i++ )
|
||||
{
|
||||
if ( mEllipsoidList[ i ].acronym.startsWith( mySplitEllipsoid[ 0 ] ) )
|
||||
{
|
||||
myIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Update paramaters if present.
|
||||
if ( mySplitEllipsoid.length() >= 3 )
|
||||
{
|
||||
mEllipsoidList[ myIndex ].semiMajor = mySplitEllipsoid[ 1 ].toDouble();
|
||||
mEllipsoidList[ myIndex ].semiMinor = mySplitEllipsoid[ 2 ].toDouble();
|
||||
}
|
||||
|
||||
updateEllipsoidUI( myIndex );
|
||||
|
||||
|
||||
int dp = QgsProject::instance()->readNumEntry( "PositionPrecision", "/DecimalPlaces" );
|
||||
spinBoxDP->setValue( dp );
|
||||
@ -1631,3 +1609,30 @@ void QgsProjectProperties::updateEllipsoidUI( int newIndex )
|
||||
}
|
||||
cmbEllipsoid->setCurrentIndex( mEllipsoidIndex ); // Not always necessary
|
||||
}
|
||||
|
||||
void QgsProjectProperties::projectionSelectorInitialized()
|
||||
{
|
||||
QgsDebugMsg( "Setting up ellipsoid" );
|
||||
|
||||
// Reading ellipsoid from setttings
|
||||
QStringList mySplitEllipsoid = QgsProject::instance()->readEntry( "Measure", "/Ellipsoid", GEO_NONE ).split( ':' );
|
||||
|
||||
int myIndex = 0;
|
||||
for ( int i = 0; i < mEllipsoidList.length(); i++ )
|
||||
{
|
||||
if ( mEllipsoidList[ i ].acronym.startsWith( mySplitEllipsoid[ 0 ] ) )
|
||||
{
|
||||
myIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Update paramaters if present.
|
||||
if ( mySplitEllipsoid.length() >= 3 )
|
||||
{
|
||||
mEllipsoidList[ myIndex ].semiMajor = mySplitEllipsoid[ 1 ].toDouble();
|
||||
mEllipsoidList[ myIndex ].semiMinor = mySplitEllipsoid[ 2 ].toDouble();
|
||||
}
|
||||
|
||||
updateEllipsoidUI( myIndex );
|
||||
}
|
||||
|
@ -163,6 +163,9 @@ class APP_EXPORT QgsProjectProperties : public QgsOptionsDialogBase, private Ui:
|
||||
*/
|
||||
void updateEllipsoidUI( int newIndex );
|
||||
|
||||
//! sets the right ellipsoid for measuring (from settings)
|
||||
void projectionSelectorInitialized();
|
||||
|
||||
signals:
|
||||
//! Signal used to inform listeners that the mouse display precision may have changed
|
||||
void displayPrecisionChanged();
|
||||
|
@ -171,6 +171,8 @@ void QgsProjectionSelector::showEvent( QShowEvent * theEvent )
|
||||
// apply deferred selection
|
||||
applySelection();
|
||||
|
||||
emit initialized();
|
||||
|
||||
// Pass up the inheritance hierarchy
|
||||
QWidget::showEvent( theEvent );
|
||||
}
|
||||
|
@ -205,6 +205,9 @@ class GUI_EXPORT QgsProjectionSelector : public QWidget, private Ui::QgsProjecti
|
||||
void refresh();
|
||||
//! Let listeners know if find has focus so they can adjust the default button
|
||||
void searchBoxHasFocus( bool );
|
||||
//! Notify others that the widget is now fully initialized, including deferred selection of projection
|
||||
//! @note added in 2.4
|
||||
void initialized();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user