Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -0,0 +1,62 @@
|
||||
/**
|
||||
* Helper Class for handling (Participant) Positions
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Malte Diers, NLE, 2019-07-11
|
||||
*/
|
||||
|
||||
#include "participantposition.h"
|
||||
#include <LtsCoordTrans/lts_coord_trans.h>
|
||||
|
||||
namespace HighLevelArchitecture
|
||||
{
|
||||
|
||||
//
|
||||
// ParticipantPosition
|
||||
//
|
||||
rpr2::WorldLocationStruct ParticipantPosition::toWorldLocation() const
|
||||
{
|
||||
rpr2::WorldLocationStruct wl;
|
||||
|
||||
LtsCoordTrans::lonLatAltToGeocentric(lon, lat, -z, wl.X, wl.Y, wl.Z);
|
||||
|
||||
return wl;
|
||||
}
|
||||
|
||||
QString ParticipantPosition::toString(bool mgrs) const
|
||||
{
|
||||
if (!mgrs)
|
||||
return QStringLiteral("lon: %1, lat: %2, z: %3").arg(lon).arg(lat).arg(z);
|
||||
|
||||
const LtsCoordTrans::UtmCoordinate c1(LtsCoordTrans::UtmCoordinate::fromGeographic(lon, lat));
|
||||
return QStringLiteral("MGRS: %1, Z: %2").arg(c1.mgrs()).arg(z);
|
||||
}
|
||||
|
||||
bool ParticipantPosition::hasMoved(const ParticipantPosition &other) const
|
||||
{
|
||||
const LtsCoordTrans::UtmCoordinate c1(LtsCoordTrans::UtmCoordinate::fromGeographic(lon, lat));
|
||||
const LtsCoordTrans::UtmCoordinate c2(LtsCoordTrans::UtmCoordinate::fromGeographic(other.lon, other.lat));
|
||||
|
||||
if (c1.zone != c2.zone)
|
||||
return true;
|
||||
if (std::abs(c1.x - c2.x) > 1)
|
||||
return true;
|
||||
if (std::abs(c1.y - c2.y) > 1)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ParticipantPosition::isNull() const
|
||||
{
|
||||
return (qFuzzyIsNull(lon) && qFuzzyIsNull(lat));
|
||||
}
|
||||
|
||||
ParticipantPosition::ParticipantPosition(const rpr2::WorldLocationStruct &wl)
|
||||
{
|
||||
LtsCoordTrans::geocentric2LonLatAlt(wl.X, wl.Y, wl.Z, lon, lat, z);
|
||||
z *= -1;
|
||||
}
|
||||
|
||||
} // Namespace
|
||||
|
||||
Reference in new issue
Block a user