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 ) ),
|
connect( mcbProjectionEnabled, SIGNAL( stateChanged( int ) ),
|
||||||
this, SLOT( changeProjectionEnabledState() ) );
|
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();
|
updateUi();
|
||||||
}
|
}
|
||||||
@ -215,7 +221,63 @@ QString QgsMeasureDialog::formatArea( double area, int decimalPlaces )
|
|||||||
|
|
||||||
void QgsMeasureDialog::updateUi()
|
void QgsMeasureDialog::updateUi()
|
||||||
{
|
{
|
||||||
|
// Only enable checkbox when project wide transformation is on
|
||||||
|
mcbProjectionEnabled->setEnabled( mTool->canvas()->hasCrsTransformEnabled() );
|
||||||
|
|
||||||
|
configureDistanceArea();
|
||||||
|
|
||||||
QSettings settings;
|
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();
|
int decimalPlaces = settings.value( "/qgis/measure/decimalplaces", "3" ).toInt();
|
||||||
|
|
||||||
double dummy = 1.0;
|
double dummy = 1.0;
|
||||||
@ -248,8 +310,6 @@ void QgsMeasureDialog::updateUi()
|
|||||||
mTable->show();
|
mTable->show();
|
||||||
editTotal->setText( formatDistance( 0, decimalPlaces ) );
|
editTotal->setText( formatDistance( 0, decimalPlaces ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
configureDistanceArea();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsMeasureDialog::convertMeasurement( double &measure, QGis::UnitType &u, bool isArea )
|
void QgsMeasureDialog::convertMeasurement( double &measure, QGis::UnitType &u, bool isArea )
|
||||||
@ -284,9 +344,13 @@ void QgsMeasureDialog::changeProjectionEnabledState()
|
|||||||
// store value
|
// store value
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
if ( mcbProjectionEnabled->isChecked() )
|
if ( mcbProjectionEnabled->isChecked() )
|
||||||
|
{
|
||||||
settings.setValue( "/qgis/measure/projectionEnabled", 2 );
|
settings.setValue( "/qgis/measure/projectionEnabled", 2 );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
settings.setValue( "/qgis/measure/projectionEnabled", 0 );
|
settings.setValue( "/qgis/measure/projectionEnabled", 0 );
|
||||||
|
}
|
||||||
|
|
||||||
// clear interface
|
// clear interface
|
||||||
mTable->clear();
|
mTable->clear();
|
||||||
@ -345,5 +409,6 @@ void QgsMeasureDialog::configureDistanceArea()
|
|||||||
QString ellipsoidId = settings.value( "/qgis/measure/ellipsoid", "WGS84" ).toString();
|
QString ellipsoidId = settings.value( "/qgis/measure/ellipsoid", "WGS84" ).toString();
|
||||||
mDa.setSourceCrs( mTool->canvas()->mapRenderer()->destinationCrs().srsid() );
|
mDa.setSourceCrs( mTool->canvas()->mapRenderer()->destinationCrs().srsid() );
|
||||||
mDa.setEllipsoid( ellipsoidId );
|
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
|
//! Show the help for the dialog
|
||||||
void on_buttonBox_helpRequested() { QgsContextHelp::run( metaObject()->className() ); }
|
void on_buttonBox_helpRequested() { QgsContextHelp::run( metaObject()->className() ); }
|
||||||
private slots:
|
|
||||||
//! on change state projection enable
|
//! on change state projection/ellipsoid enable
|
||||||
void changeProjectionEnabledState();
|
void changeProjectionEnabledState();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -193,8 +193,15 @@
|
|||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QGroupBox" name="btnGrpMapUnits">
|
<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">
|
<property name="title">
|
||||||
<string>Layer units</string>
|
<string>Canvas units</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_27">
|
<layout class="QGridLayout" name="gridLayout_27">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
@ -780,8 +787,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>660</width>
|
<width>583</width>
|
||||||
<height>792</height>
|
<height>671</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
@ -1156,6 +1163,7 @@
|
|||||||
</tabstops>
|
</tabstops>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../../images/images.qrc"/>
|
<include location="../../images/images.qrc"/>
|
||||||
|
<include location="../../images/images.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
<connections>
|
<connections>
|
||||||
<connection>
|
<connection>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user