116 lines
3.7 KiB
C++
Executable File
116 lines
3.7 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* TrajectoryGenerator
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Norbert Thoden, SLTE, 2023-11-08
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "../logger.h"
|
|
#include "trajectory_generator_vulcano.h"
|
|
#include <Core/core.hpp> // Lts/DDS/Core/core.hpp for Core::GeoPosition
|
|
#include <LtsElevation/lts_elevation_manager.h>
|
|
#include <LtsUtilsCore/qpoint3d.h>
|
|
#include <Trajectory/trajectory_export.h>
|
|
|
|
#include <QObject>
|
|
#include <QPair>
|
|
#include <QPolygonF>
|
|
|
|
#include <vector>
|
|
|
|
// forward
|
|
namespace ExerciseManagement
|
|
{
|
|
namespace Interface
|
|
{
|
|
class Dtc;
|
|
}
|
|
} // namespace ExerciseManagement
|
|
|
|
namespace AssetManagement
|
|
{
|
|
namespace Interface
|
|
{
|
|
class Dtc;
|
|
}
|
|
} // namespace AssetManagement
|
|
|
|
namespace AreaEffectSimulation
|
|
{
|
|
|
|
// version 1
|
|
using TrajectoryGeoPosition = std::vector<Core::GeoPosition>;
|
|
// version 2
|
|
using TrajectoryGeoPositionRelTime = std::vector<Core::GeoPositionRelativeTime>;
|
|
|
|
using QPoint3D = LtsUtils::QPoint3D;
|
|
|
|
//
|
|
// class TrajectoryGenerator
|
|
//
|
|
class TRAJECTORY_EXPORT TrajectoryGenerator : public QObject
|
|
{
|
|
public:
|
|
/*QT_DEPRECATED*/ static TrajectoryGenerator *getInstance(int exerciseId,
|
|
const std::shared_ptr<ExerciseManagement::Interface::Dtc> &exmDtc,
|
|
const std::shared_ptr<AssetManagement::Interface::Dtc> &asmDtc);
|
|
|
|
static TrajectoryGenerator *getInstance();
|
|
|
|
static void cleanup();
|
|
|
|
void initElevation(LtsElevation::LtsElevationManager *ltsElevationManager);
|
|
LtsElevation::LtsElevationManager *getElevationManager();
|
|
bool hasElevationManager() const;
|
|
|
|
~TrajectoryGenerator() = default;
|
|
|
|
/*! \name Ideal trajectory using Core::GeoPosition at return trajectory ... */
|
|
//@{
|
|
bool generateTrajectoryBiedziak(const LtsUtils::QPoint3D &originatorPosition_geo,
|
|
const LtsUtils::QPoint3D &idealHit_geo,
|
|
double elevation_angle_degree, // aka beta
|
|
TrajectoryGeoPosition &trajectoryOut);
|
|
//@}
|
|
|
|
static bool generateTrajectoryVulcano(const QPoint3D &originatorPosition_geo,
|
|
const QPoint3D &idealHit_geo,
|
|
double v0,
|
|
double betaRad, // Abschussgeschwindigkeit, -winkel ( betaRad ~ elevation_angle_degree
|
|
double alphaRad,
|
|
double tapTimeSec, // Fallwinkel, -geschwindigkeit, -zeit
|
|
TrajectoryGeneratorVulcano::Options options,
|
|
TrajectoryGeoPositionRelTime &trajectoryTimeAwareOut,
|
|
Core::GeoPosition &idealTapAbsoluteGeoOut,
|
|
QString *reasonOut);
|
|
|
|
protected:
|
|
/*! \name Ideal trajectory */
|
|
template <typename CONT_T>
|
|
bool generateTrajectoryBiedziak(const LtsUtils::QPoint3D &originatorPosition_geo,
|
|
const LtsUtils::QPoint3D &impactPosition_geo,
|
|
double elevation_angle_degree,
|
|
CONT_T &trajectoryOut);
|
|
|
|
protected:
|
|
explicit TrajectoryGenerator();
|
|
|
|
public:
|
|
// For UnitTest:
|
|
friend class UnitTestTrajectoryHelper;
|
|
|
|
// calculate the z-Values of the trajectory:
|
|
static QVector<double> trajectoryBiedziak(const double &distance, const double &heightOffset, double elevation_angle_degree, int steps = 72);
|
|
|
|
static const QString string4poly(const QPair<QPolygonF, QVector<double>> &pair);
|
|
|
|
LtsElevation::LtsElevationManager *m_ltsElevationManager{nullptr};
|
|
LOGGER_T m_logger;
|
|
};
|
|
|
|
} // namespace AreaEffectSimulation
|