mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-01 00:46:20 -05:00
Changed UI and added tool tip
This commit is contained in:
parent
a1db95fc98
commit
95a032a75a
@ -59,6 +59,12 @@ QgsMeasureDialog::QgsMeasureDialog( QgsMeasureTool* tool, Qt::WFlags f )
|
||||
|
||||
connect( mcbProjectionEnabled, SIGNAL( stateChanged( int ) ),
|
||||
this, SLOT( changeProjectionEnabledState() ) );
|
||||
// Update when project wide transformation has changed
|
||||
connect( mTool->canvas()->mapRenderer(), SIGNAL( hasCrsTransformEnabled( bool ) ),
|
||||
this, SLOT( changeProjectionEnabledState() ) );
|
||||
// Update when project CRS has changed
|
||||
connect( mTool->canvas()->mapRenderer(), SIGNAL( destinationSrsChanged() ),
|
||||
this, SLOT( changeProjectionEnabledState() ) );
|
||||
|
||||
updateUi();
|
||||
}
|
||||
@ -215,7 +221,63 @@ QString QgsMeasureDialog::formatArea( double area, int decimalPlaces )
|
||||
|
||||
void QgsMeasureDialog::updateUi()
|
||||
{
|
||||
// Only enable checkbox when project wide transformation is on
|
||||
mcbProjectionEnabled->setEnabled( mTool->canvas()->hasCrsTransformEnabled() );
|
||||
|
||||
configureDistanceArea();
|
||||
|
||||
QSettings settings;
|
||||
|
||||
// Set tooltip to indicate how we calculate measurments
|
||||
QGis::UnitType mapUnits = mTool->canvas()->mapUnits();
|
||||
QString mapUnitsTxt;
|
||||
switch ( mapUnits )
|
||||
{
|
||||
case QGis::Meters:
|
||||
mapUnitsTxt = "meters";
|
||||
break;
|
||||
case QGis::Feet:
|
||||
mapUnitsTxt = "feet";
|
||||
break;
|
||||
case QGis::Degrees:
|
||||
mapUnitsTxt = "degrees";
|
||||
break;
|
||||
case QGis::UnknownUnit:
|
||||
mapUnitsTxt = "-";
|
||||
}
|
||||
|
||||
QString toolTip = QString( "The calculations are based on:" );
|
||||
if ( ! mTool->canvas()->hasCrsTransformEnabled() )
|
||||
{
|
||||
toolTip += QString( "%1 Project CRS transformation is turned off, canvas units setting" ).arg( "<br> *" );
|
||||
toolTip += QString( "is taken from project properties setting (%1)." ).arg( mapUnitsTxt );
|
||||
toolTip += QString( "%1 Ellipsoidal calculation is not possible, as project CRS is undefined." ).arg( "<br> *" );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( mDa.ellipsoidalEnabled() )
|
||||
{
|
||||
toolTip += QString( "%1 Project CRS transformation is turned on and ellipsoidal calculation is selected. " ).arg( "<br> *" );
|
||||
toolTip += QString( "The coordinates are transformed to the chosen ellipsoid (%1) and the result is in meters" ).arg( mDa.ellipsoid() );
|
||||
}
|
||||
else
|
||||
{
|
||||
toolTip += QString( "%1 Project CRS transformation is turned on but ellipsoidal calculation is not selected. " ).arg( "<br> *" );
|
||||
toolTip += QString( "The canvas units setting is taken from the project CRS (%1)." ).arg( mapUnitsTxt );
|
||||
}
|
||||
}
|
||||
if ( mapUnits == QGis::Meters && settings.value( "/qgis/measure/displayunits", "meters" ).toString() == "feet" )
|
||||
{
|
||||
toolTip += QString( "%1 Finally, the value is converted from meters to feet." ).arg( "<br> *" );
|
||||
}
|
||||
else if ( mapUnits == QGis::Feet && settings.value( "/qgis/measure/displayunits", "meters" ).toString() == "meters" )
|
||||
{
|
||||
toolTip += QString( "%1 Finally, the value is converted from feet to meters." ).arg( "<br> *" );
|
||||
}
|
||||
|
||||
editTotal->setToolTip( toolTip );
|
||||
mTable->setToolTip( toolTip );
|
||||
|
||||
int decimalPlaces = settings.value( "/qgis/measure/decimalplaces", "3" ).toInt();
|
||||
|
||||
double dummy = 1.0;
|
||||
@ -248,8 +310,6 @@ void QgsMeasureDialog::updateUi()
|
||||
mTable->show();
|
||||
editTotal->setText( formatDistance( 0, decimalPlaces ) );
|
||||
}
|
||||
|
||||
configureDistanceArea();
|
||||
}
|
||||
|
||||
void QgsMeasureDialog::convertMeasurement( double &measure, QGis::UnitType &u, bool isArea )
|
||||
@ -284,9 +344,13 @@ void QgsMeasureDialog::changeProjectionEnabledState()
|
||||
// store value
|
||||
QSettings settings;
|
||||
if ( mcbProjectionEnabled->isChecked() )
|
||||
{
|
||||
settings.setValue( "/qgis/measure/projectionEnabled", 2 );
|
||||
}
|
||||
else
|
||||
{
|
||||
settings.setValue( "/qgis/measure/projectionEnabled", 0 );
|
||||
}
|
||||
|
||||
// clear interface
|
||||
mTable->clear();
|
||||
@ -345,5 +409,6 @@ void QgsMeasureDialog::configureDistanceArea()
|
||||
QString ellipsoidId = settings.value( "/qgis/measure/ellipsoid", "WGS84" ).toString();
|
||||
mDa.setSourceCrs( mTool->canvas()->mapRenderer()->destinationCrs().srsid() );
|
||||
mDa.setEllipsoid( ellipsoidId );
|
||||
mDa.setEllipsoidalEnabled( mcbProjectionEnabled->isChecked() );
|
||||
// Only use ellipsoidal calculation when project wide transformation is enabled.
|
||||
mDa.setEllipsoidalEnabled( mcbProjectionEnabled->isChecked() && mTool->canvas()->hasCrsTransformEnabled() );
|
||||
}
|
||||
|
@ -62,8 +62,8 @@ class QgsMeasureDialog : public QDialog, private Ui::QgsMeasureBase
|
||||
|
||||
//! Show the help for the dialog
|
||||
void on_buttonBox_helpRequested() { QgsContextHelp::run( metaObject()->className() ); }
|
||||
private slots:
|
||||
//! on change state projection enable
|
||||
|
||||
//! on change state projection/ellipsoid enable
|
||||
void changeProjectionEnabledState();
|
||||
|
||||
private:
|
||||
|
@ -193,8 +193,15 @@
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="btnGrpMapUnits">
|
||||
<property name="toolTip">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Used when CRS transformation is turned off.</span></p></body></html></string>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Layer units</string>
|
||||
<string>Canvas units</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_27">
|
||||
<item row="0" column="0">
|
||||
@ -780,8 +787,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>660</width>
|
||||
<height>792</height>
|
||||
<width>583</width>
|
||||
<height>671</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
@ -1156,6 +1163,7 @@
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="../../images/images.qrc"/>
|
||||
<include location="../../images/images.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
|
Loading…
x
Reference in New Issue
Block a user