64 lines
1.5 KiB
C++
Executable File
64 lines
1.5 KiB
C++
Executable File
/**
|
|
* Converting positions relative to the training area
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Philipp Dassow, NLST, 21-04-2018
|
|
*/
|
|
#pragma once
|
|
|
|
#include <LtsCoordTrans/lts_coord_trans.h>
|
|
#include <Core/core.hpp>
|
|
#include "main_handler.h"
|
|
#include "logger.h"
|
|
|
|
namespace AssetManagement
|
|
{
|
|
namespace Interface
|
|
{
|
|
class Dtc;
|
|
}
|
|
}
|
|
namespace ExerciseManagement
|
|
{
|
|
namespace Interface
|
|
{
|
|
class Dtc;
|
|
}
|
|
}
|
|
|
|
namespace OcSituationServer
|
|
{
|
|
|
|
class DdsHandler;
|
|
class PositionConverter
|
|
{
|
|
public:
|
|
explicit PositionConverter(MainHandler *m_mainHandler);
|
|
|
|
LtsCoordTrans::UtmCoordinate baseCoordinate();
|
|
inline QPointF relativeFromGeographic(const Core::GeoPosition2D &pos)
|
|
{
|
|
return relativeFromGeographic(pos, baseCoordinate());
|
|
}
|
|
inline static QPointF relativeFromGeographic(const Core::GeoPosition2D &pos,
|
|
const LtsCoordTrans::UtmCoordinate &baseCoord)
|
|
{
|
|
// convert lon/lat to utm with the given zone from the center point
|
|
const LtsCoordTrans::UtmCoordinate point(LtsCoordTrans::UtmCoordinate::fromGeographic(pos.lon(), pos.lat(), baseCoord.zone));
|
|
// now calc distance from point to base point == relative position
|
|
return QPointF(point.x - baseCoord.x, point.y - baseCoord.y);
|
|
}
|
|
private:
|
|
bool initCoordConversion();
|
|
|
|
MainHandler *m_mainHandler;
|
|
LtsCoordTrans::UtmCoordinate m_baseCoord;
|
|
std::shared_ptr<AssetManagement::Interface::Dtc> m_asmDtc;
|
|
std::shared_ptr<ExerciseManagement::Interface::Dtc> m_exmDtc;
|
|
|
|
LOGGER_T &m_logger;
|
|
};
|
|
|
|
} // namespace OcSituationServer
|