Removed CEarthAngle::toAngle, because implicit conversion already works.

Applied a different workaround to resolve the hiding of an inherited name in CEarthAngle, same as was done in CAltitude.
refs #84
This commit is contained in:
Mathew Sutcliffe
2014-01-12 01:47:18 +00:00
parent 5ffe3dc759
commit e40c93fe1b
2 changed files with 11 additions and 11 deletions

View File

@@ -79,9 +79,9 @@ namespace BlackMisc
Q_ASSERT(qv.canConvert<LATorLON>() || qv.canConvert<CAngle>());
Q_ASSERT(qv.isValid() && !qv.isNull());
if (qv.canConvert<LATorLON>())
return this->toAngle().compare(qv.value<LATorLON>().toAngle());
return this->compare(qv.value<LATorLON>());
else
return this->toAngle().compare(qv.value<CAngle>());
return this->compare(qv.value<CAngle>());
}
// see here for the reason of thess forward instantiations

View File

@@ -175,20 +175,20 @@ namespace BlackMisc
return l;
}
/*!
* \brief To angle
* \return
*/
BlackMisc::PhysicalQuantities::CAngle toAngle() const
{
return BlackMisc::PhysicalQuantities::CAngle(static_cast<BlackMisc::PhysicalQuantities::CAngle>(*this));
}
/*!
* Compare
*/
int compare(const QVariant &qv) const;
/*!
* \todo this is a hack, to avoid hiding inherited names in CPhysicalQuantity
* (see Effective C++ item 33) CPhysicalQuantity::compare is the real culprit
*/
int compare(const CEarthAngle &other) const
{
return static_cast<const CPhysicalQuantity<BlackMisc::PhysicalQuantities::CAngleUnit, BlackMisc::PhysicalQuantities::CAngle> *>(this)->compare(other);
}
/*!
* Register metadata
*/