/** * Exercise object * $Id$ * $HeadURL$ * $Author$ */ #pragma once #include "logger.h" #include "handler_pdm_data.h" #include #include #include namespace EffectShowManagement { /** * @brief Creates the Effect Show data from the Area Effect Simulation data for Explosion Clusters. * * For the Effect Show data to be created see ICD GUEZSB60_ICD-0046C. * For calculations the mathematical x-axis is mapped to east; the y-axis is mapped to north.\n * * List of features:\n * (1)The area effect is limited to one effect show located at the center of the cluster.\n * (2) Only specific charge types create more than one effect show as configured in the charge type * (3)The number of volleys depends on the number of shots by the explosion cluster as follows:\n * Number of shot <= 25 : 3 volleys\n * Number of shot <= 50 : 6 volleys\n * Number of shot <= 100 : 9 volleys\n * Number of shot <= 150 : 12 volleys\n * Number of shot <= 200 : 15 volleys\n * else : 18 volleys\n * (4)The start time for the effect show is overtaken from the start time of the explosion cluster.\n * (5)The duration for the effect show is overtaken from the duration of the explosion cluster.\n * (6)The type of ammunition is determined by the chargeType of the explosion cluster and the * "tas code indirect" of the Project Data Management.\n * */ class EffectShowExplosionCluster { public: explicit EffectShowExplosionCluster(const AreaEffectSimulation::ExplosionCluster &explosionCluster, const std::shared_ptr &handlerPdmData); /** * @brief Returns the number of Effect Shows resulting from Area Effect Simulation. * @return The number of effect shows */ int getNumOfEffectShows(); /** * @brief Returns the Effect Show with the provided index. * @param[in] idx The index of the Effect Show [0..@see geNumOfEffectShows()-1] * @return The Effect Show with the provided index */ Database::EsmEffectShow getEffectShow(int idx); /** * @brief Updates the following data: startTime, duration, volley, typeOfAmmunition. * @param[in] data The Effect Show to be updated * @param[out] data The updated Effect Show */ void updateEffectShow(Database::EsmEffectShow &data); int getShotsPerArea(int areas) const; static int getNumberOfVolley(int v); /** * @brief Returns the number of volley. * @return The number of volley. */ int getNumberOfVolley() const; int getShotsPerArea() const; private: /** * @brief Calculates the square of the each effect area. */ void calculateSquare(); /** * @brief Turns position p arround position c. * @param[in] p Point to be rotated * @param[in] c Center point of rotation * @param[in] angle Angle of rotation * @return Depth of the effect area. The resolution of the value is 50m. (Max: 300m) */ static LtsCoordTrans::UtmCoordinate rotate(const LtsCoordTrans::UtmCoordinate &p, const LtsCoordTrans::UtmCoordinate &c, double angle); struct areas_t { int side(int i) const { return (i < numSideLength1) ? sideLength1 : sideLength2; } int numSideLength1 = 0; // number of areas with the side length "sideLength1" int sideLength1 = 0; // side length of the areas 1 int numSideLength2 = 0; // number of areas with the side length "sideLength2" int sideLength2 = 0; // side length of the areas 2 int numOfAreas = 0; // number of areas along the side at all }; /** @brief Calculates the side length of effect shows. * The side length shall be rounded to a resolution of 50m. * The maximum side length shall be 300m. If the side length is > 300m, a split into * more side length shall be made. In this case uniform side length of <= 300m shall be * calculated. For the rest, a last side length shall be provided. * @param[in] sideLength Side length of Area Effect Simuilation * @return Side length of the effect shows */ static areas_t getAreasSideLength(double sideLength); double rotationRad() const; private: AreaEffectSimulation::ExplosionCluster const m_explosionCluster; std::shared_ptr m_handlerPdmData; int m_numOfEffectShows; areas_t m_areasWidth; // squares in x-direction areas_t m_areasDepth; // squares in y-direction LtsCoordTrans::UtmCoordinate m_lowerLeftPos; NGL::INGLLogger &m_logger; }; }