mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-25 02:05:43 +08:00
Issue #77 All classes propertyindex methods use CPropertyIndexRef and QVariant
This commit is contained in:
@@ -127,13 +127,13 @@ namespace BlackMisc
|
||||
return Geo::calculateBearing((*this), otherCoordinate);
|
||||
}
|
||||
|
||||
bool ICoordinateGeodetic::canHandleIndex(const CPropertyIndex &index)
|
||||
bool ICoordinateGeodetic::canHandleIndex(CPropertyIndexRef index)
|
||||
{
|
||||
const int i = index.frontCasted<int>();
|
||||
return (i >= static_cast<int>(IndexLatitude)) && (i <= static_cast<int>(IndexNormalVector));
|
||||
}
|
||||
|
||||
CVariant ICoordinateGeodetic::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
QVariant ICoordinateGeodetic::propertyByIndex(BlackMisc::CPropertyIndexRef index) const
|
||||
{
|
||||
if (!index.isMyself())
|
||||
{
|
||||
@@ -142,21 +142,21 @@ namespace BlackMisc
|
||||
{
|
||||
case IndexLatitude: return this->latitude().propertyByIndex(index.copyFrontRemoved());
|
||||
case IndexLongitude: return this->longitude().propertyByIndex(index.copyFrontRemoved());
|
||||
case IndexLatitudeAsString: return CVariant(this->latitudeAsString());
|
||||
case IndexLongitudeAsString: return CVariant(this->longitudeAsString());
|
||||
case IndexLatitudeAsString: return QVariant(this->latitudeAsString());
|
||||
case IndexLongitudeAsString: return QVariant(this->longitudeAsString());
|
||||
case IndexGeodeticHeight: return this->geodeticHeight().propertyByIndex(index.copyFrontRemoved());
|
||||
case IndexGeodeticHeightAsString: return CVariant(this->geodeticHeightAsString());
|
||||
case IndexNormalVector: return CVariant::fromValue(this->normalVector());
|
||||
case IndexGeodeticHeightAsString: return QVariant(this->geodeticHeightAsString());
|
||||
case IndexNormalVector: return QVariant::fromValue(this->normalVector());
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
const QString m = QString("no property, index ").append(index.toQString());
|
||||
BLACK_VERIFY_X(false, Q_FUNC_INFO, qUtf8Printable(m));
|
||||
return CVariant::fromValue(m);
|
||||
return QVariant::fromValue(m);
|
||||
}
|
||||
|
||||
int ICoordinateGeodetic::comparePropertyByIndex(const CPropertyIndex &index, const ICoordinateGeodetic &compareValue) const
|
||||
int ICoordinateGeodetic::comparePropertyByIndex(CPropertyIndexRef index, const ICoordinateGeodetic &compareValue) const
|
||||
{
|
||||
if (!index.isMyself())
|
||||
{
|
||||
@@ -238,32 +238,32 @@ namespace BlackMisc
|
||||
return c;
|
||||
}
|
||||
|
||||
CVariant CCoordinateGeodetic::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
QVariant CCoordinateGeodetic::propertyByIndex(BlackMisc::CPropertyIndexRef index) const
|
||||
{
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
if (index.isMyself()) { return QVariant::fromValue(*this); }
|
||||
return (ICoordinateGeodetic::canHandleIndex(index)) ?
|
||||
ICoordinateGeodetic::propertyByIndex(index) :
|
||||
CValueObject::propertyByIndex(index);
|
||||
}
|
||||
|
||||
void CCoordinateGeodetic::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
|
||||
void CCoordinateGeodetic::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
|
||||
{
|
||||
if (index.isMyself()) { (*this) = variant.to<CCoordinateGeodetic>(); return; }
|
||||
if (index.isMyself()) { (*this) = variant.value<CCoordinateGeodetic>(); return; }
|
||||
const ICoordinateGeodetic::ColumnIndex i = index.frontCasted<ICoordinateGeodetic::ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexGeodeticHeight: m_geodeticHeight.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
|
||||
case IndexLatitude: this->setLatitude(variant.value<CLatitude>()); break;
|
||||
case IndexLongitude: this->setLongitude(variant.value<CLongitude>()); break;
|
||||
case IndexLatitudeAsString: this->setLatitude(CLatitude::fromWgs84(variant.toQString())); break;
|
||||
case IndexLongitudeAsString: this->setLongitude(CLongitude::fromWgs84(variant.toQString())); break;
|
||||
case IndexGeodeticHeightAsString: m_geodeticHeight.parseFromString(variant.toQString()); break;
|
||||
case IndexLatitudeAsString: this->setLatitude(CLatitude::fromWgs84(variant.toString())); break;
|
||||
case IndexLongitudeAsString: this->setLongitude(CLongitude::fromWgs84(variant.toString())); break;
|
||||
case IndexGeodeticHeightAsString: m_geodeticHeight.parseFromString(variant.toString()); break;
|
||||
case IndexNormalVector: this->setNormalVector(variant.value<QVector3D>()); break;
|
||||
default: CValueObject::setPropertyByIndex(index, variant); break;
|
||||
}
|
||||
}
|
||||
|
||||
int CCoordinateGeodetic::comparePropertyByIndex(const CPropertyIndex &index, const CCoordinateGeodetic &compareValue) const
|
||||
int CCoordinateGeodetic::comparePropertyByIndex(CPropertyIndexRef index, const CCoordinateGeodetic &compareValue) const
|
||||
{
|
||||
return ICoordinateGeodetic::canHandleIndex(index) ?
|
||||
ICoordinateGeodetic::comparePropertyByIndex(index, compareValue) :
|
||||
@@ -425,7 +425,7 @@ namespace BlackMisc
|
||||
return m_relativeDistance;
|
||||
}
|
||||
|
||||
CVariant ICoordinateWithRelativePosition::propertyByIndex(const CPropertyIndex &index) const
|
||||
QVariant ICoordinateWithRelativePosition::propertyByIndex(CPropertyIndexRef index) const
|
||||
{
|
||||
if (ICoordinateGeodetic::canHandleIndex(index)) { return ICoordinateGeodetic::propertyByIndex(index); }
|
||||
if (!index.isMyself())
|
||||
@@ -440,10 +440,10 @@ namespace BlackMisc
|
||||
}
|
||||
const QString m = QString("no property, index ").append(index.toQString());
|
||||
BLACK_VERIFY_X(false, Q_FUNC_INFO, qUtf8Printable(m));
|
||||
return CVariant::fromValue(m);
|
||||
return QVariant::fromValue(m);
|
||||
}
|
||||
|
||||
void ICoordinateWithRelativePosition::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
|
||||
void ICoordinateWithRelativePosition::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
|
||||
{
|
||||
if (ICoordinateGeodetic::canHandleIndex(index)) { return; }
|
||||
if (!index.isMyself())
|
||||
@@ -461,7 +461,7 @@ namespace BlackMisc
|
||||
}
|
||||
}
|
||||
|
||||
int ICoordinateWithRelativePosition::comparePropertyByIndex(const CPropertyIndex &index, const ICoordinateWithRelativePosition &compareValue) const
|
||||
int ICoordinateWithRelativePosition::comparePropertyByIndex(CPropertyIndexRef index, const ICoordinateWithRelativePosition &compareValue) const
|
||||
{
|
||||
if (ICoordinateGeodetic::canHandleIndex(index)) { return ICoordinateGeodetic::comparePropertyByIndex(index, compareValue); }
|
||||
if (!index.isMyself())
|
||||
@@ -491,7 +491,7 @@ namespace BlackMisc
|
||||
ICoordinateWithRelativePosition::ICoordinateWithRelativePosition()
|
||||
{ }
|
||||
|
||||
bool ICoordinateWithRelativePosition::canHandleIndex(const CPropertyIndex &index)
|
||||
bool ICoordinateWithRelativePosition::canHandleIndex(CPropertyIndexRef index)
|
||||
{
|
||||
if (ICoordinateGeodetic::canHandleIndex(index)) { return true; }
|
||||
const int i = index.frontCasted<int>();
|
||||
|
||||
@@ -129,10 +129,10 @@ namespace BlackMisc
|
||||
PhysicalQuantities::CAngle calculateBearing(const ICoordinateGeodetic &otherCoordinate) const;
|
||||
|
||||
//! \copydoc Mixin::Index::propertyByIndex
|
||||
CVariant propertyByIndex(const CPropertyIndex &index) const;
|
||||
QVariant propertyByIndex(CPropertyIndexRef index) const;
|
||||
|
||||
//! \copydoc Mixin::Index::comparePropertyByIndex
|
||||
int comparePropertyByIndex(const CPropertyIndex &index, const ICoordinateGeodetic &compareValue) const;
|
||||
int comparePropertyByIndex(CPropertyIndexRef index, const ICoordinateGeodetic &compareValue) const;
|
||||
|
||||
//! \copydoc Mixin::String::toQString
|
||||
QString convertToQString(bool i18n = false) const;
|
||||
@@ -149,7 +149,7 @@ namespace BlackMisc
|
||||
|
||||
protected:
|
||||
//! Can given index be handled?
|
||||
static bool canHandleIndex(const CPropertyIndex &index);
|
||||
static bool canHandleIndex(CPropertyIndexRef index);
|
||||
};
|
||||
|
||||
//! Great circle distance between points
|
||||
@@ -200,13 +200,13 @@ namespace BlackMisc
|
||||
PhysicalQuantities::CLength calculcateAndUpdateRelativeDistanceAndBearing(const Geo::ICoordinateGeodetic &position);
|
||||
|
||||
//! \copydoc Mixin::Index::propertyByIndex
|
||||
CVariant propertyByIndex(const CPropertyIndex &index) const;
|
||||
QVariant propertyByIndex(CPropertyIndexRef index) const;
|
||||
|
||||
//! \copydoc Mixin::Index::setPropertyByIndex
|
||||
void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant);
|
||||
void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant);
|
||||
|
||||
//! \copydoc Mixin::Index::comparePropertyByIndex
|
||||
int comparePropertyByIndex(const CPropertyIndex &index, const ICoordinateWithRelativePosition &compareValue) const;
|
||||
int comparePropertyByIndex(CPropertyIndexRef index, const ICoordinateWithRelativePosition &compareValue) const;
|
||||
|
||||
//! \copydoc Mixin::String::toQString
|
||||
QString convertToQString(bool i18n = false) const;
|
||||
@@ -216,7 +216,7 @@ namespace BlackMisc
|
||||
ICoordinateWithRelativePosition();
|
||||
|
||||
//! Can given index be handled?
|
||||
static bool canHandleIndex(const CPropertyIndex &index);
|
||||
static bool canHandleIndex(CPropertyIndexRef index);
|
||||
|
||||
PhysicalQuantities::CAngle m_relativeBearing { 0, nullptr }; //!< temporary stored value
|
||||
PhysicalQuantities::CLength m_relativeDistance { 0, nullptr }; //!< temporary stored value
|
||||
@@ -269,13 +269,13 @@ namespace BlackMisc
|
||||
virtual std::array<double, 3> normalVectorDouble() const override;
|
||||
|
||||
//! \copydoc Mixin::Index::propertyByIndex
|
||||
CVariant propertyByIndex(const CPropertyIndex &index) const;
|
||||
QVariant propertyByIndex(CPropertyIndexRef index) const;
|
||||
|
||||
//! \copydoc Mixin::Index::setPropertyByIndex
|
||||
void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant);
|
||||
void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant);
|
||||
|
||||
//! \copydoc Mixin::Index::setPropertyByIndex
|
||||
int comparePropertyByIndex(const CPropertyIndex &index, const CCoordinateGeodetic &compareValue) const;
|
||||
int comparePropertyByIndex(CPropertyIndexRef index, const CCoordinateGeodetic &compareValue) const;
|
||||
|
||||
//! Switch unit of height
|
||||
CCoordinateGeodetic &switchUnit(const PhysicalQuantities::CLengthUnit &unit);
|
||||
|
||||
@@ -147,9 +147,9 @@ namespace BlackMisc
|
||||
m_radius = majorAirportRadius();
|
||||
}
|
||||
|
||||
CVariant CElevationPlane::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
QVariant CElevationPlane::propertyByIndex(BlackMisc::CPropertyIndexRef index) const
|
||||
{
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
if (index.isMyself()) { return QVariant::fromValue(*this); }
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
@@ -159,9 +159,9 @@ namespace BlackMisc
|
||||
return CCoordinateGeodetic::propertyByIndex(index);
|
||||
}
|
||||
|
||||
void CElevationPlane::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
|
||||
void CElevationPlane::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
|
||||
{
|
||||
if (index.isMyself()) { (*this) = variant.to<CElevationPlane>(); return; }
|
||||
if (index.isMyself()) { (*this) = variant.value<CElevationPlane>(); return; }
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
@@ -170,7 +170,7 @@ namespace BlackMisc
|
||||
}
|
||||
}
|
||||
|
||||
int CElevationPlane::comparePropertyByIndex(const CPropertyIndex &index, const CElevationPlane &elevationPlane) const
|
||||
int CElevationPlane::comparePropertyByIndex(CPropertyIndexRef index, const CElevationPlane &elevationPlane) const
|
||||
{
|
||||
Q_UNUSED(index)
|
||||
return this->getAltitude().compare(elevationPlane.getAltitude());
|
||||
|
||||
@@ -119,13 +119,13 @@ namespace BlackMisc
|
||||
void setMajorAirportRadius();
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
|
||||
CVariant propertyByIndex(const CPropertyIndex &index) const;
|
||||
QVariant propertyByIndex(CPropertyIndexRef index) const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
|
||||
void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant);
|
||||
void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant);
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::comparePropertyByIndex
|
||||
int comparePropertyByIndex(const CPropertyIndex &index, const CElevationPlane &elevationPlane) const;
|
||||
int comparePropertyByIndex(CPropertyIndexRef index, const CElevationPlane &elevationPlane) const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::String::toQString
|
||||
QString convertToQString(bool i18n = false) const;
|
||||
|
||||
Reference in New Issue
Block a user