mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-14 08:45:36 +08:00
committed by
Mathew Sutcliffe
parent
229d7c6068
commit
978f3c88e5
@@ -11,196 +11,196 @@
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
namespace Geo
|
||||
{
|
||||
/*!
|
||||
* \brief North, East, Down
|
||||
*/
|
||||
class CCoordinateNed : public BlackMisc::Math::CVector3DBase<CCoordinateNed>
|
||||
{
|
||||
private:
|
||||
CCoordinateGeodetic m_referencePosition; //!< geodetic reference position
|
||||
bool m_hasReferencePosition; //!< valid reference position?
|
||||
|
||||
protected:
|
||||
/*!
|
||||
* \brief String for converter
|
||||
* \return
|
||||
*/
|
||||
virtual QString convertToQString() const
|
||||
namespace Geo
|
||||
{
|
||||
QString s = "NED: {N %1, E %2, D %3}";
|
||||
s = s.arg(QString::number(this->north(), 'f', 6)).
|
||||
arg(QString::number(this->east(), 'f', 6)).
|
||||
arg(QString::number(this->down(), 'f', 6));
|
||||
return s;
|
||||
}
|
||||
/*!
|
||||
* \brief North, East, Down
|
||||
*/
|
||||
class CCoordinateNed : public BlackMisc::Math::CVector3DBase<CCoordinateNed>
|
||||
{
|
||||
private:
|
||||
CCoordinateGeodetic m_referencePosition; //!< geodetic reference position
|
||||
bool m_hasReferencePosition; //!< valid reference position?
|
||||
|
||||
public:
|
||||
/*!
|
||||
* \brief Default constructor
|
||||
*/
|
||||
CCoordinateNed() : CVector3DBase(), m_referencePosition(), m_hasReferencePosition(false) {}
|
||||
protected:
|
||||
/*!
|
||||
* \brief String for converter
|
||||
* \return
|
||||
*/
|
||||
virtual QString convertToQString() const
|
||||
{
|
||||
QString s = "NED: {N %1, E %2, D %3}";
|
||||
s = s.arg(QString::number(this->north(), 'f', 6)).
|
||||
arg(QString::number(this->east(), 'f', 6)).
|
||||
arg(QString::number(this->down(), 'f', 6));
|
||||
return s;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Constructor with reference position
|
||||
* \param referencePosition
|
||||
*/
|
||||
CCoordinateNed(const CCoordinateGeodetic &referencePosition) : CVector3DBase(), m_referencePosition(referencePosition), m_hasReferencePosition(true) {}
|
||||
public:
|
||||
/*!
|
||||
* \brief Default constructor
|
||||
*/
|
||||
CCoordinateNed() : CVector3DBase(), m_referencePosition(), m_hasReferencePosition(false) {}
|
||||
|
||||
/*!
|
||||
* \brief Constructor by values
|
||||
* \param referencePosition
|
||||
* \param north
|
||||
* \param east
|
||||
* \param down
|
||||
*/
|
||||
CCoordinateNed(const CCoordinateGeodetic &referencePosition, double north, double east, double down) : CVector3DBase(north, east, down), m_referencePosition(referencePosition), m_hasReferencePosition(true) {}
|
||||
/*!
|
||||
* \brief Constructor with reference position
|
||||
* \param referencePosition
|
||||
*/
|
||||
CCoordinateNed(const CCoordinateGeodetic &referencePosition) : CVector3DBase(), m_referencePosition(referencePosition), m_hasReferencePosition(true) {}
|
||||
|
||||
/*!
|
||||
* \brief Constructor by values
|
||||
* \param north
|
||||
* \param east
|
||||
* \param down
|
||||
*/
|
||||
CCoordinateNed(double north, double east, double down) : CVector3DBase(north, east, down), m_referencePosition(), m_hasReferencePosition(false) {}
|
||||
/*!
|
||||
* \brief Constructor by values
|
||||
* \param referencePosition
|
||||
* \param north
|
||||
* \param east
|
||||
* \param down
|
||||
*/
|
||||
CCoordinateNed(const CCoordinateGeodetic &referencePosition, double north, double east, double down) : CVector3DBase(north, east, down), m_referencePosition(referencePosition), m_hasReferencePosition(true) {}
|
||||
|
||||
/*!
|
||||
* \brief Copy constructor
|
||||
* \param otherNed
|
||||
*/
|
||||
CCoordinateNed(const CCoordinateNed &other) :
|
||||
CVector3DBase(other), m_referencePosition(other.m_referencePosition), m_hasReferencePosition(other.m_hasReferencePosition) {}
|
||||
/*!
|
||||
* \brief Constructor by values
|
||||
* \param north
|
||||
* \param east
|
||||
* \param down
|
||||
*/
|
||||
CCoordinateNed(double north, double east, double down) : CVector3DBase(north, east, down), m_referencePosition(), m_hasReferencePosition(false) {}
|
||||
|
||||
/*!
|
||||
* \brief Constructor by math vector
|
||||
* \param vector
|
||||
*/
|
||||
explicit CCoordinateNed(const BlackMisc::Math::CVector3D &vector) : CVector3DBase(vector.i(), vector.j(), vector.k()), m_referencePosition(), m_hasReferencePosition(false) {}
|
||||
/*!
|
||||
* \brief Copy constructor
|
||||
* \param otherNed
|
||||
*/
|
||||
CCoordinateNed(const CCoordinateNed &other) :
|
||||
CVector3DBase(other), m_referencePosition(other.m_referencePosition), m_hasReferencePosition(other.m_hasReferencePosition) {}
|
||||
|
||||
/*!
|
||||
* \brief Constructor by math vector and reference position
|
||||
* \param referencePosition
|
||||
* \param vector
|
||||
*/
|
||||
CCoordinateNed(const CCoordinateGeodetic &referencePosition, const BlackMisc::Math::CVector3D &vector) : CVector3DBase(vector.i(), vector.j(), vector.k()), m_referencePosition(referencePosition), m_hasReferencePosition(true) {}
|
||||
/*!
|
||||
* \brief Constructor by math vector
|
||||
* \param vector
|
||||
*/
|
||||
explicit CCoordinateNed(const BlackMisc::Math::CVector3D &vector) : CVector3DBase(vector.i(), vector.j(), vector.k()), m_referencePosition(), m_hasReferencePosition(false) {}
|
||||
|
||||
/*!
|
||||
* \brief Equal operator ==
|
||||
* \param other
|
||||
* \return
|
||||
*/
|
||||
bool operator ==(const CCoordinateNed &other) const
|
||||
{
|
||||
if (this == &other) return true;
|
||||
return this->m_hasReferencePosition == other.m_hasReferencePosition &&
|
||||
this->m_referencePosition == other.m_referencePosition &&
|
||||
this->CVector3DBase::operator== (other);
|
||||
}
|
||||
/*!
|
||||
* \brief Constructor by math vector and reference position
|
||||
* \param referencePosition
|
||||
* \param vector
|
||||
*/
|
||||
CCoordinateNed(const CCoordinateGeodetic &referencePosition, const BlackMisc::Math::CVector3D &vector) : CVector3DBase(vector.i(), vector.j(), vector.k()), m_referencePosition(referencePosition), m_hasReferencePosition(true) {}
|
||||
|
||||
/*!
|
||||
* \brief Unequal operator !=
|
||||
* \param other
|
||||
* \return
|
||||
*/
|
||||
bool operator !=(const CCoordinateNed &other) const
|
||||
{
|
||||
return !((*this) == other);
|
||||
}
|
||||
/*!
|
||||
* \brief Equal operator ==
|
||||
* \param other
|
||||
* \return
|
||||
*/
|
||||
bool operator ==(const CCoordinateNed &other) const
|
||||
{
|
||||
if (this == &other) return true;
|
||||
return this->m_hasReferencePosition == other.m_hasReferencePosition &&
|
||||
this->m_referencePosition == other.m_referencePosition &&
|
||||
this->CVector3DBase::operator== (other);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Corresponding reference position
|
||||
* \return
|
||||
*/
|
||||
CCoordinateGeodetic referencePosition() const
|
||||
{
|
||||
return this->m_referencePosition;
|
||||
}
|
||||
/*!
|
||||
* \brief Unequal operator !=
|
||||
* \param other
|
||||
* \return
|
||||
*/
|
||||
bool operator !=(const CCoordinateNed &other) const
|
||||
{
|
||||
return !((*this) == other);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Corresponding reference position
|
||||
* \return
|
||||
*/
|
||||
bool hasReferencePosition() const
|
||||
{
|
||||
return this->m_hasReferencePosition;
|
||||
}
|
||||
/*!
|
||||
* \brief Corresponding reference position
|
||||
* \return
|
||||
*/
|
||||
CCoordinateGeodetic referencePosition() const
|
||||
{
|
||||
return this->m_referencePosition;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief North
|
||||
* \return
|
||||
*/
|
||||
double north() const
|
||||
{
|
||||
return this->m_i;
|
||||
}
|
||||
/*!
|
||||
* \brief Corresponding reference position
|
||||
* \return
|
||||
*/
|
||||
bool hasReferencePosition() const
|
||||
{
|
||||
return this->m_hasReferencePosition;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief East
|
||||
* \return
|
||||
*/
|
||||
double east() const
|
||||
{
|
||||
return this->m_j;
|
||||
}
|
||||
/*!
|
||||
* \brief North
|
||||
* \return
|
||||
*/
|
||||
double north() const
|
||||
{
|
||||
return this->m_i;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Down
|
||||
* \return
|
||||
*/
|
||||
double down() const
|
||||
{
|
||||
return this->m_k;
|
||||
}
|
||||
/*!
|
||||
* \brief East
|
||||
* \return
|
||||
*/
|
||||
double east() const
|
||||
{
|
||||
return this->m_j;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Set north
|
||||
* \param north
|
||||
*/
|
||||
void setNorth(double north)
|
||||
{
|
||||
this->m_i = north;
|
||||
}
|
||||
/*!
|
||||
* \brief Down
|
||||
* \return
|
||||
*/
|
||||
double down() const
|
||||
{
|
||||
return this->m_k;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Set east
|
||||
* \param east
|
||||
*/
|
||||
void setEast(double east)
|
||||
{
|
||||
this->m_j = east;
|
||||
}
|
||||
/*!
|
||||
* \brief Set north
|
||||
* \param north
|
||||
*/
|
||||
void setNorth(double north)
|
||||
{
|
||||
this->m_i = north;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Set down
|
||||
* \param down
|
||||
*/
|
||||
void setDown(double down)
|
||||
{
|
||||
this->m_k = down;
|
||||
}
|
||||
/*!
|
||||
* \brief Set east
|
||||
* \param east
|
||||
*/
|
||||
void setEast(double east)
|
||||
{
|
||||
this->m_j = east;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Corresponding reference position
|
||||
* \param referencePosition
|
||||
*/
|
||||
void setReferencePosition(const CCoordinateGeodetic &referencePosition)
|
||||
{
|
||||
this->m_referencePosition = referencePosition;
|
||||
this->m_hasReferencePosition = true;
|
||||
}
|
||||
/*!
|
||||
* \brief Set down
|
||||
* \param down
|
||||
*/
|
||||
void setDown(double down)
|
||||
{
|
||||
this->m_k = down;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Concrete implementation of a 3D vector
|
||||
* \return
|
||||
*/
|
||||
BlackMisc::Math::CVector3D toMathVector() const
|
||||
{
|
||||
return BlackMisc::Math::CVector3D(this->north(), this->east(), this->down());
|
||||
}
|
||||
};
|
||||
/*!
|
||||
* \brief Corresponding reference position
|
||||
* \param referencePosition
|
||||
*/
|
||||
void setReferencePosition(const CCoordinateGeodetic &referencePosition)
|
||||
{
|
||||
this->m_referencePosition = referencePosition;
|
||||
this->m_hasReferencePosition = true;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
/*!
|
||||
* \brief Concrete implementation of a 3D vector
|
||||
* \return
|
||||
*/
|
||||
BlackMisc::Math::CVector3D toMathVector() const
|
||||
{
|
||||
return BlackMisc::Math::CVector3D(this->north(), this->east(), this->down());
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
Q_DECLARE_METATYPE(BlackMisc::Geo::CCoordinateNed)
|
||||
|
||||
Reference in New Issue
Block a user