Migrates AreaEffectSimulation to generated rtiddsgen API
Converts accessor calls to plain member access across aes service and plugin.
This commit is contained in:
102 files changed
+3307
-3313
No files matched your search
+179
-179
@@ -80,7 +80,7 @@ Trajectory:
|
||||
#define DUMP() dump(__FILE__, __LINE__)
|
||||
|
||||
// ToDo: mark the end of aes enum and update following (check Endemarke)
|
||||
static_assert((int)AreaEffectSimulation::AesType_def::AtExplosionClusterGunToTargetLine < 100, "id may overlap at runtime");
|
||||
static_assert((int)AreaEffectSimulation::AesType::AtExplosionClusterGunToTargetLine < 100, "id may overlap at runtime");
|
||||
|
||||
// Aufteilung der ids:
|
||||
// ExplosionCluster ddsData(m_data.id,
|
||||
@@ -204,7 +204,7 @@ Core::FunctionReplyObject ObjectExplosionCluster::createObject(const Database::A
|
||||
// external (externalId==0) -> claim required
|
||||
// NASAT: AirSupport -> no claim required
|
||||
const bool bDoClaimPlannedCharge
|
||||
= (data.id == 0) && (data.externalId <= 0) && (m_mainHandler->gearClassOfChargeTypeId(data.chargeTypeId) != ProjectDataManagement::GearClass_def::AirSupport);
|
||||
= (data.id == 0) && (data.externalId <= 0) && (m_mainHandler->gearClassOfChargeTypeId(data.chargeTypeId) != ProjectDataManagement::GearClass::GearClass_AirSupport);
|
||||
|
||||
if (bDoClaimPlannedCharge) // new, not read from db
|
||||
ret = m_mainHandler->chargeAdministrationHandler()->claimPlannedCharge(data.chargeTypeId, data.partyId, data.impactCount);
|
||||
@@ -392,7 +392,7 @@ Core::FunctionReplyObject ObjectExplosionCluster::updateObject(const Database::A
|
||||
return Core::FunctionReplyObject(data.id, tr_lts("dds", "Error updating explosion cluster with id %1 in database.")).arg(m_data.id);
|
||||
}
|
||||
|
||||
if ((data.externalId <= 0) && m_mainHandler->gearClassOfChargeTypeId(m_data.chargeTypeId) != ProjectDataManagement::GearClass_def::AirSupport) // internal
|
||||
if ((data.externalId <= 0) && m_mainHandler->gearClassOfChargeTypeId(m_data.chargeTypeId) != ProjectDataManagement::GearClass::GearClass_AirSupport) // internal
|
||||
{
|
||||
// this is for party change or charge type change
|
||||
if (data.partyId != m_data.partyId || data.chargeTypeId != m_data.chargeTypeId)
|
||||
@@ -422,9 +422,9 @@ Core::FunctionReplyObject ObjectExplosionCluster::updateObject(const Database::A
|
||||
// m_lastSentTriggeredExplosionNumber = -1;
|
||||
|
||||
// reset some data:
|
||||
m_aiv2.form().clear(); // enforce recalculation
|
||||
m_effects.singleEffects().clear();
|
||||
m_aivGunToTargetTrajectory.form().clear(); // enforce recalculation
|
||||
m_aiv2.form.clear(); // enforce recalculation
|
||||
m_effects.singleEffects.clear();
|
||||
m_aivGunToTargetTrajectory.form.clear(); // enforce recalculation
|
||||
m_temporaryData.reset(); // estimatedMaxFlightDurationMSec, mhPoints, mhWidth...
|
||||
|
||||
// keep in mind: if no participantId is provided: no gunToTargetLine will be calculated
|
||||
@@ -495,7 +495,7 @@ bool ObjectExplosionCluster::initialCalculations(QString *reasonOut)
|
||||
|
||||
QVector<QPointF> mtps_asUtm;
|
||||
|
||||
if (m_data.explosionGeometryId.underlying() == AreaEffectSimulation::AesExplosionGeometry_def::EgRadial)
|
||||
if (m_data.explosionGeometryId == AreaEffectSimulation::AesExplosionGeometry::EgRadial)
|
||||
mtps_asUtm = explosionClusterRadialToMtps(areaBlWithTla, m_data.mhpCountRequest, firingOriginUtm, centerUtm, &singleWidthOut, &singleHeightOut);
|
||||
else
|
||||
mtps_asUtm = explosionClusterAreaToMtps(areaBlWithTla, m_data.mhpCountRequest, &singleWidthOut, &singleHeightOut);
|
||||
@@ -561,17 +561,17 @@ bool ObjectExplosionCluster::initialCalculations(QString *reasonOut)
|
||||
// ... and retrieve the duration:
|
||||
const TracjectoryData &tdRefGTL = m_trajectoryCont[-1];
|
||||
const TrajectoryTimeAware &trajTimeAwareGTL = tdRefGTL.trajectoryTimeAware;
|
||||
const Core::GeoPositionRelativeTime &geoPosRelTimeRef = trajTimeAwareGTL.geometry().back();
|
||||
const Core::GeoPositionRelativeTime &geoPosRelTimeRef = trajTimeAwareGTL.geometry.back();
|
||||
|
||||
m_temporaryData.calculatedFlightDurationMsec = geoPosRelTimeRef.relativeTime();
|
||||
m_temporaryData.estimatedMaxFlightDurationMSec = (geoPosRelTimeRef.relativeTime() * 1.1) + 5 * 1000; // ( *1.1) + (10 *1000)
|
||||
m_temporaryData.calculatedFlightDurationMsec = geoPosRelTimeRef.relativeTime;
|
||||
m_temporaryData.estimatedMaxFlightDurationMSec = (geoPosRelTimeRef.relativeTime * 1.1) + 5 * 1000; // ( *1.1) + (10 *1000)
|
||||
|
||||
m_temporaryData.calculatedFiringSpeed = TrajectoryGeneratorVulcano::defaultv0();
|
||||
m_temporaryData.calculatedPeakHeightAbs = tdRefGTL.peakHeightAbs;
|
||||
|
||||
// to avoid re-calculation, store that at m_aivGunToTargetTrajectory.
|
||||
// At publishAiv the new calculation will be skipped:
|
||||
m_aivGunToTargetTrajectory.form(tdRefGTL.trajectoryGeometry);
|
||||
m_aivGunToTargetTrajectory.form = tdRefGTL.trajectoryGeometry;
|
||||
m_aivGunToTargetTrajectoryDirty = true;
|
||||
}
|
||||
else
|
||||
@@ -649,11 +649,11 @@ Core::FunctionReplyObject ObjectExplosionCluster::checkObjectData(const Database
|
||||
|
||||
using geoType = AreaEffectSimulation::AesExplosionGeometry_def;
|
||||
const geoType::type curExGeoType = data.explosionGeometryId.underlying();
|
||||
static const QVector<geoType::type> ecValidGeos = {AreaEffectSimulation::AesExplosionGeometry_def::EgAimPoint, // 0 -> default
|
||||
AreaEffectSimulation::AesExplosionGeometry_def::EgPoint,
|
||||
AreaEffectSimulation::AesExplosionGeometry_def::EgArea,
|
||||
AreaEffectSimulation::AesExplosionGeometry_def::EgRadial,
|
||||
AreaEffectSimulation::AesExplosionGeometry_def::EgLine};
|
||||
static const QVector<geoType::type> ecValidGeos = {AreaEffectSimulation::AesExplosionGeometry::EgAimPoint, // 0 -> default
|
||||
AreaEffectSimulation::AesExplosionGeometry::EgPoint,
|
||||
AreaEffectSimulation::AesExplosionGeometry::EgArea,
|
||||
AreaEffectSimulation::AesExplosionGeometry::EgRadial,
|
||||
AreaEffectSimulation::AesExplosionGeometry::EgLine};
|
||||
|
||||
QString reason;
|
||||
|
||||
@@ -707,7 +707,7 @@ bool ObjectExplosionCluster::removeObjectFromDb() { return m_mainHandler->db()->
|
||||
Core::FunctionReplyObject ObjectExplosionCluster::resumePause(const ExplosionClusterPauseResumeRequest &req)
|
||||
{
|
||||
Core::FunctionReplyObject ret;
|
||||
if (req.resumeExecution())
|
||||
if (req.resumeExecution)
|
||||
{
|
||||
// resume
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " " << m_data.id << " RESUME" << " ... ";
|
||||
@@ -743,13 +743,13 @@ Core::FunctionReplyObject ObjectExplosionCluster::resumePause(const ExplosionClu
|
||||
// if (req.resumeExecution())
|
||||
// {
|
||||
// // resume
|
||||
// if (req.timeToResume().is_set())
|
||||
// m_data.effectStart = QDateTime::fromMSecsSinceEpoch(req.timeToResume().get());
|
||||
// if (req.timeToResume.is_set())
|
||||
// m_data.effectStart = QDateTime::fromMSecsSinceEpoch(req.timeToResume.get());
|
||||
// else
|
||||
// m_data.effectStart = partitionTime();
|
||||
|
||||
// if (req.remainingDuration().is_set())
|
||||
// m_data.effectDuration = req.remainingDuration().get();
|
||||
// if (req.remainingDuration.is_set())
|
||||
// m_data.effectDuration = req.remainingDuration.get();
|
||||
|
||||
// // req.resumeSeed() currently not used, as it is calculated internaly. maybe in the future
|
||||
|
||||
@@ -772,16 +772,16 @@ Core::FunctionReplyObject ObjectExplosionCluster::targetPositionsModify(const Ta
|
||||
const qint64 now = partitionTimeMSec();
|
||||
const qint64 remainingMsec = m_data.effectStart.toMSecsSinceEpoch() - now;
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " " << m_data.id << " START"
|
||||
<< " TargetPositionsModifyRequest = " << req << ", s_counter = " << s_counter++ << ", current state = " << m_data.effectStateId.underlying()
|
||||
<< " TargetPositionsModifyRequest = " << req << ", s_counter = " << s_counter++ << ", current state = " << m_data.effectStateId
|
||||
<< ", now = " << now << ", effectStart = " << m_data.effectStart.toMSecsSinceEpoch() << ", remainingMsec = " << remainingMsec;
|
||||
|
||||
DUMP();
|
||||
|
||||
const std::vector<Core::GeoPosition> &positions = req.positions();
|
||||
const std::vector<Core::GeoPosition> &positions = req.positions;
|
||||
|
||||
Core::FunctionReplyObject ret;
|
||||
|
||||
if (m_data.effectStateId.underlying() == AreaEffectSimulation::AesEffectState_def::EsExpired)
|
||||
if (m_data.effectStateId == AreaEffectSimulation::AesEffectState::EsExpired)
|
||||
{
|
||||
ret = Core::FunctionReplyObject(m_data.id, tr_lts("dds", "Error modifying explosion cluster with id %1 since object is already expired")).arg(m_data.id);
|
||||
ERROR_LOG(m_logger) << LOGFUNCTION << " " << m_data.id << " Error: " << ret.str();
|
||||
@@ -815,11 +815,11 @@ Core::FunctionReplyObject ObjectExplosionCluster::targetPositionsModify(const Ta
|
||||
return ret;
|
||||
}
|
||||
|
||||
const Core::GeoPosition &newTargetPos = req.positions().front();
|
||||
const Core::GeoPosition &newTargetPos = req.positions.front();
|
||||
const int explosionIndex = 0;
|
||||
TracjectoryData &tdRef = m_trajectoryCont[explosionIndex];
|
||||
TrajectoryTimeAware &trajTimeAwareRef = tdRef.trajectoryTimeAware;
|
||||
std::vector<Core::GeoPositionRelativeTime> &trajectoryTimeAwareGeometry = trajTimeAwareRef.geometry();
|
||||
std::vector<Core::GeoPositionRelativeTime> &trajectoryTimeAwareGeometry = trajTimeAwareRef.geometry;
|
||||
|
||||
if (trajectoryTimeAwareGeometry.empty())
|
||||
{
|
||||
@@ -860,17 +860,17 @@ Core::FunctionReplyObject ObjectExplosionCluster::targetPositionsModify(const Ta
|
||||
|
||||
// m_aiv2 CHANGES HERE
|
||||
//
|
||||
std::vector<Core::GeoPosition> &formRef = m_aiv2.form();
|
||||
std::vector<Core::GeoPosition> &formRef = m_aiv2.form;
|
||||
|
||||
// compare former and updated ImpactPos: context targetModify
|
||||
if (m_logger.isDebugEnabled())
|
||||
{
|
||||
Core::GeoPosition &curImpactPosRef = formRef[explosionIndex];
|
||||
LtsCoordTrans::UtmCoordinate utm1 = LtsCoordTrans::UtmCoordinate::fromGeographic(curImpactPosRef.lon(), curImpactPosRef.lat());
|
||||
const QVector3D u1Vec(utm1.x, utm1.y, curImpactPosRef.z());
|
||||
LtsCoordTrans::UtmCoordinate utm1 = LtsCoordTrans::UtmCoordinate::fromGeographic(curImpactPosRef.lon, curImpactPosRef.lat);
|
||||
const QVector3D u1Vec(utm1.x, utm1.y, curImpactPosRef.z);
|
||||
|
||||
LtsCoordTrans::UtmCoordinate utm2 = LtsCoordTrans::UtmCoordinate::fromGeographic(newTargetPos.lon(), newTargetPos.lat(), utm1.zone);
|
||||
const QVector3D u2Vec(utm2.x, utm2.y, newTargetPos.z());
|
||||
LtsCoordTrans::UtmCoordinate utm2 = LtsCoordTrans::UtmCoordinate::fromGeographic(newTargetPos.lon, newTargetPos.lat, utm1.zone);
|
||||
const QVector3D u2Vec(utm2.x, utm2.y, newTargetPos.z);
|
||||
|
||||
const QVector3D diff = u2Vec - u1Vec;
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " " << m_data.id << " for explosionIndex " << explosionIndex << ", curImpactPosRef " << curImpactPosRef << ", utm1 " << utm1
|
||||
@@ -882,10 +882,10 @@ Core::FunctionReplyObject ObjectExplosionCluster::targetPositionsModify(const Ta
|
||||
curImpactPosRef = newTargetPos;
|
||||
|
||||
// Effects:
|
||||
std::vector<AreaEffectSimulation::SingleEffect> &singleEffectsRef = m_effects.singleEffects();
|
||||
std::vector<AreaEffectSimulation::SingleEffect> &singleEffectsRef = m_effects.singleEffects;
|
||||
SingleEffect &ref = singleEffectsRef[explosionIndex];
|
||||
ref.position(newTargetPos);
|
||||
ref.zPlacement(AesZPlacement_def::ZpAbsolute); // intersection: change from draped to absolute
|
||||
ref.position = newTargetPos;
|
||||
ref.zPlacement = AesZPlacement::ZpAbsolute; // intersection: change from draped to absolute
|
||||
|
||||
// Trajectory
|
||||
publishTrajectory(explosionIndex);
|
||||
@@ -937,7 +937,7 @@ Core::FunctionReplyObject ObjectExplosionCluster::checkPreConditionsComplete()
|
||||
|
||||
// keep start of svc in mind:
|
||||
Core::FunctionReplyObject ret;
|
||||
if (m_data.effectStateId.underlying() != AreaEffectSimulation::AesEffectState_def::EsExpired)
|
||||
if (m_data.effectStateId != AreaEffectSimulation::AesEffectState::EsExpired)
|
||||
ret = checkPreConditions();
|
||||
|
||||
DUMP();
|
||||
@@ -1109,20 +1109,20 @@ void ObjectExplosionCluster::onPublishData()
|
||||
m_temporaryData.calculatedFlightDurationMsec,
|
||||
m_data.peakHeight,
|
||||
m_data.flightDuration);
|
||||
ddsData.flightCurve(toOptional(fc));
|
||||
ddsData.flightCurve = toOptional(fc);
|
||||
}
|
||||
|
||||
if (isVulcano())
|
||||
{
|
||||
LaserGuiding lg(m_data.lcPrf, m_data.lcTermination, m_data.tapTimepoint, m_data.cloudBase);
|
||||
ddsData.laserGuiding(toOptional(lg));
|
||||
ddsData.laserGuiding = toOptional(lg);
|
||||
}
|
||||
|
||||
// publish only on real changes:
|
||||
if (m_explosionCluster != ddsData)
|
||||
{
|
||||
m_explosionCluster = ddsData;
|
||||
ddsData.sampleTime(partitionTimeMSec()); // publish sampleTime, but do not store
|
||||
ddsData.sampleTime = partitionTimeMSec(); // publish sampleTime, but do not store
|
||||
m_mainHandler->dds()->dts()->publish(ddsData);
|
||||
}
|
||||
|
||||
@@ -1138,14 +1138,14 @@ void ObjectExplosionCluster::onDetonationLocationReply(const DetonationLocationR
|
||||
// int32_t explosionIndex, // explosionIndex
|
||||
// const Core::GeoPosition& position);
|
||||
|
||||
if (reply.id() != m_data.id) // aesItemId
|
||||
if (reply.id != m_data.id) // aesItemId
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "ID mismatch: " << reply.id() << " != " << m_data.id;
|
||||
DEBUG_LOG(m_logger) << "ID mismatch: " << reply.id << " != " << m_data.id;
|
||||
return;
|
||||
}
|
||||
|
||||
// do we have the initial geometry?
|
||||
const int explosionIndex = reply.index();
|
||||
const int explosionIndex = reply.index;
|
||||
if (!m_trajectoryCont.contains(explosionIndex))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " " << m_data.id << "unknown explosionIndex "
|
||||
@@ -1153,8 +1153,8 @@ void ObjectExplosionCluster::onDetonationLocationReply(const DetonationLocationR
|
||||
return;
|
||||
}
|
||||
|
||||
const Core::GeoPosition &replyPos = reply.position();
|
||||
if ((replyPos.lon() < 0.00001) || (replyPos.lat() < 0.00001))
|
||||
const Core::GeoPosition &replyPos = reply.position;
|
||||
if ((replyPos.lon < 0.00001) || (replyPos.lat < 0.00001))
|
||||
{
|
||||
// no intersection
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " " << m_data.id << " got DetonationLocationReply"
|
||||
@@ -1167,7 +1167,7 @@ void ObjectExplosionCluster::onDetonationLocationReply(const DetonationLocationR
|
||||
<< " : INTERSECTION - reply.position is: "
|
||||
<< ", reply.index() = " << explosionIndex << ", reply.position() " << replyPos;
|
||||
|
||||
adjustTrajectoryToDetonationLocation(explosionIndex, replyPos, reply.buildingId());
|
||||
adjustTrajectoryToDetonationLocation(explosionIndex, replyPos, reply.buildingId);
|
||||
}
|
||||
|
||||
// publish new triggered explosions data here
|
||||
@@ -1178,7 +1178,7 @@ void ObjectExplosionCluster::onDetonationLocationReply(const DetonationLocationR
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " " << m_data.id << " Publishing AesItemView (AtExplosionClusterSingleExplosions) for TriggeredExplosions, explosionIndex "
|
||||
<< explosionIndex;
|
||||
|
||||
m_aiv2.sampleTime(partitionTimeMSec());
|
||||
m_aiv2.sampleTime = partitionTimeMSec();
|
||||
// // m_mainHandler->dds()->dts()->publish(m_aiv2); // does anyone needs this topic???
|
||||
m_aiv2HasChanged = false;
|
||||
emit newAiv(m_aiv2);
|
||||
@@ -1226,16 +1226,16 @@ void ObjectExplosionCluster::adjustTrajectoryToDetonationLocation(int explosionI
|
||||
}
|
||||
|
||||
const Core::GeoPosition &trajFront = trajectoryGeometry.front();
|
||||
const double distToOriginSquared = LtsCoordTrans::squareDistance(trajFront.lon(), trajFront.lat(), intersectionLocation.lon(), intersectionLocation.lat());
|
||||
const double distToOriginSquared = LtsCoordTrans::squareDistance(trajFront.lon, trajFront.lat, intersectionLocation.lon, intersectionLocation.lat);
|
||||
|
||||
ProjectDataManagement::IgniterFunctionBase ignFunctionBase
|
||||
= m_mainHandler->dds()
|
||||
->pdmDtc()
|
||||
->getChargeTypeIgniterTypeIgniterFunction(m_data.chargeTypeId, m_data.igniterTypeId, m_data.igniterFunctionId)
|
||||
.igniterFunctionBaseId();
|
||||
.igniterFunctionBaseId;
|
||||
if ((ignFunctionBase == ProjectDataManagement::IgniterFunctionBase::IfbProximity) || (ignFunctionBase == ProjectDataManagement::IgniterFunctionBase::IfbImpact))
|
||||
{
|
||||
const double distTrajectorySquared = LtsCoordTrans::squareDistance(trajFront.lon(), trajFront.lat(), trajBack.lon(), trajBack.lat());
|
||||
const double distTrajectorySquared = LtsCoordTrans::squareDistance(trajFront.lon, trajFront.lat, trajBack.lon, trajBack.lat);
|
||||
if (distToOriginSquared > distTrajectorySquared)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "adjustTrajectoryToDetonationLocation " << m_data.id << "Detonation location is outside of trajectory for ID: " << m_data.id
|
||||
@@ -1252,7 +1252,7 @@ void ObjectExplosionCluster::adjustTrajectoryToDetonationLocation(int explosionI
|
||||
{
|
||||
const Core::GeoPosition &curItem_geo = trajectoryGeometry[i - 1];
|
||||
|
||||
const double distStartSegmentSquared = LtsCoordTrans::squareDistance(curItem_geo.lon(), curItem_geo.lat(), trajectoryOrigin_geo.lon(), trajectoryOrigin_geo.lat());
|
||||
const double distStartSegmentSquared = LtsCoordTrans::squareDistance(curItem_geo.lon, curItem_geo.lat, trajectoryOrigin_geo.lon, trajectoryOrigin_geo.lat);
|
||||
// remove...
|
||||
if (distStartSegmentSquared > distToOriginSquared)
|
||||
{
|
||||
@@ -1273,17 +1273,17 @@ void ObjectExplosionCluster::adjustTrajectoryToDetonationLocation(int explosionI
|
||||
//
|
||||
// m_aiv2 CHANGES HERE
|
||||
//
|
||||
std::vector<Core::GeoPosition> &formRef = m_aiv2.form();
|
||||
std::vector<Core::GeoPosition> &formRef = m_aiv2.form;
|
||||
Core::GeoPosition &curImpactPosRef = formRef[explosionIndex];
|
||||
|
||||
// compare former and updated ImpactPos: context intersection
|
||||
if (m_logger.isDebugEnabled())
|
||||
{
|
||||
LtsCoordTrans::UtmCoordinate utm1 = LtsCoordTrans::UtmCoordinate::fromGeographic(curImpactPosRef.lon(), curImpactPosRef.lat());
|
||||
const QVector3D u1Vec(utm1.x, utm1.y, curImpactPosRef.z());
|
||||
LtsCoordTrans::UtmCoordinate utm1 = LtsCoordTrans::UtmCoordinate::fromGeographic(curImpactPosRef.lon, curImpactPosRef.lat);
|
||||
const QVector3D u1Vec(utm1.x, utm1.y, curImpactPosRef.z);
|
||||
|
||||
LtsCoordTrans::UtmCoordinate utm2 = LtsCoordTrans::UtmCoordinate::fromGeographic(intersectionLocation.lon(), intersectionLocation.lat(), utm1.zone);
|
||||
const QVector3D u2Vec(utm2.x, utm2.y, intersectionLocation.z());
|
||||
LtsCoordTrans::UtmCoordinate utm2 = LtsCoordTrans::UtmCoordinate::fromGeographic(intersectionLocation.lon, intersectionLocation.lat, utm1.zone);
|
||||
const QVector3D u2Vec(utm2.x, utm2.y, intersectionLocation.z);
|
||||
|
||||
const QVector3D diff = u2Vec - u1Vec;
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " " << m_data.id << " for explosionIndex " << explosionIndex << ", curImpactPosRef " << curImpactPosRef << ", utm1 " << utm1
|
||||
@@ -1295,11 +1295,11 @@ void ObjectExplosionCluster::adjustTrajectoryToDetonationLocation(int explosionI
|
||||
m_aiv2HasChanged = true;
|
||||
|
||||
// Effects:
|
||||
std::vector<AreaEffectSimulation::SingleEffect> &singleEffectsRef = m_effects.singleEffects();
|
||||
std::vector<AreaEffectSimulation::SingleEffect> &singleEffectsRef = m_effects.singleEffects;
|
||||
SingleEffect &ref = singleEffectsRef[explosionIndex];
|
||||
// ref.effectState(AesSingleEffectState_def::SesScheduled);
|
||||
ref.position(intersectionLocation);
|
||||
ref.zPlacement(AesZPlacement_def::ZpAbsolute); // intersection: change from draped to relative
|
||||
ref.position = intersectionLocation;
|
||||
ref.zPlacement = AesZPlacement::ZpAbsolute; // intersection: change from draped to relative
|
||||
// m_effectsHaveChanged = true;
|
||||
|
||||
if (explosionIndex == m_data.impactCount - 1)
|
||||
@@ -1392,7 +1392,7 @@ void ObjectExplosionCluster::publishAiv()
|
||||
if (bIsPoint && (m_lastSentTriggeredExplosionNumber == 1)) // 'move' only AFTER impact
|
||||
{
|
||||
// on svcRestart, m_aiv2 may not been set. To avoid crash:
|
||||
const std::vector<Core::GeoPosition> &formRef = m_aiv2.form();
|
||||
const std::vector<Core::GeoPosition> &formRef = m_aiv2.form;
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " " << m_data.id << " since isPointSimilar==true form has to be updated"
|
||||
<< ", m_data.effectStateId = " << m_data.effectStateId << ", m_data.impactWidth = " << m_data.impactWidth
|
||||
<< ", m_lastSentTriggeredExplosionNumber = " << m_lastSentTriggeredExplosionNumber << ", formRef.size() = " << formRef.size();
|
||||
@@ -1406,7 +1406,7 @@ void ObjectExplosionCluster::publishAiv()
|
||||
else
|
||||
{
|
||||
const Core::GeoPosition &impactPosition_geo3D = formRef[0];
|
||||
centerGeo = QPointF(impactPosition_geo3D.lon(), impactPosition_geo3D.lat());
|
||||
centerGeo = QPointF(impactPosition_geo3D.lon, impactPosition_geo3D.lat);
|
||||
}
|
||||
// ... and now take zog into account:
|
||||
double radius = m_data.impactWidth / 2.0;
|
||||
@@ -1425,22 +1425,22 @@ void ObjectExplosionCluster::publishAiv()
|
||||
// Major
|
||||
//
|
||||
AesItemView aiv(m_aiv);
|
||||
aiv.aesItemId(m_data.id);
|
||||
aiv.chargeStruct().chargeTypeId(m_data.chargeTypeId);
|
||||
aiv.effectStart(toMSec(m_data.effectStart));
|
||||
ddsVecFromPoly(poly, aiv.form());
|
||||
aiv.boundingBoxBottomLeft(Core::GeoPosition2D(bounds.topLeft().x(), bounds.topLeft().y())); // QRectF's bigger values are at bottom
|
||||
aiv.boundingBoxTopRight(Core::GeoPosition2D(bounds.bottomRight().x(), bounds.bottomRight().y()));
|
||||
aiv.aesTypeId(AesType::AtExplosionCluster);
|
||||
aiv.effectStateId(effectState());
|
||||
aiv.id(1000 * m_data.id + AesType::AtExplosionCluster);
|
||||
aiv.aesItemId = m_data.id;
|
||||
aiv.chargeStruct.chargeTypeId = m_data.chargeTypeId;
|
||||
aiv.effectStart = toMSec(m_data.effectStart);
|
||||
ddsVecFromPoly(poly, aiv.form);
|
||||
aiv.boundingBoxBottomLeft = Core::GeoPosition2D(bounds.topLeft().x(), bounds.topLeft().y()); // QRectF's bigger values are at bottom
|
||||
aiv.boundingBoxTopRight = Core::GeoPosition2D(bounds.bottomRight().x(), bounds.bottomRight().y());
|
||||
aiv.aesTypeId = AesType::AtExplosionCluster;
|
||||
aiv.effectStateId = effectState();
|
||||
aiv.id = 1000 * m_data.id + static_cast<int>(AesType::AtExplosionCluster);
|
||||
if (m_data.partyId != 0)
|
||||
aiv.partyId(m_data.partyId);
|
||||
aiv.partyId = m_data.partyId;
|
||||
|
||||
// ObjectBaseTmpl::checkIsCentral honors pdm->isLaserGuidable
|
||||
// and therefore isCentral is set to true; )
|
||||
|
||||
checkIsCentralAndPublish(aiv.form(), m_aiv.form(), m_data.isCentral);
|
||||
checkIsCentralAndPublish(aiv.form, m_aiv.form, m_data.isCentral);
|
||||
|
||||
//
|
||||
// SingleExplosions
|
||||
@@ -1449,33 +1449,33 @@ void ObjectExplosionCluster::publishAiv()
|
||||
if (isEcValid)
|
||||
{
|
||||
AesItemView aiv2(m_aiv2);
|
||||
aiv2.aesItemId(m_data.id);
|
||||
aiv2.chargeStruct().chargeTypeId(m_data.chargeTypeId);
|
||||
aiv2.effectStart(toMSec(m_data.effectStart));
|
||||
aiv2.aesItemId = m_data.id;
|
||||
aiv2.chargeStruct.chargeTypeId = m_data.chargeTypeId;
|
||||
aiv2.effectStart = toMSec(m_data.effectStart);
|
||||
|
||||
// calculate just one time.
|
||||
// maybe intersections of trajectories with building will 'adjust' some impact positions later.
|
||||
if (aiv2.form().empty())
|
||||
if (aiv2.form.empty())
|
||||
{
|
||||
if (isVulcano() || (m_data.externalId > 0)) // m_data.externalId > 0 -> HLA / SingleFire / PointGeometry
|
||||
{
|
||||
const QPointF &impactPointGeo
|
||||
= AreaEffectSimulation::Polygons::bottomLeft2CenterPoint(m_data.impactPosition, m_data.impactWidth, m_data.impactLength, m_data.rotationAngle);
|
||||
ddsVecFromPoly(QVector<QPointF>() << impactPointGeo, aiv2.form());
|
||||
ddsVecFromPoly(QVector<QPointF>() << impactPointGeo, aiv2.form);
|
||||
}
|
||||
else
|
||||
{
|
||||
const QVector<QPointF> &singleExplosions = Polygons::explosionClusterSingleExplosionsGAUSS_Mtp(m_data, m_temporaryData.calculatedMhpRotationNorthDeg);
|
||||
ddsVecFromPoly(singleExplosions, aiv2.form());
|
||||
ddsVecFromPoly(singleExplosions, aiv2.form);
|
||||
}
|
||||
}
|
||||
aiv2.boundingBoxBottomLeft(aiv.boundingBoxBottomLeft());
|
||||
aiv2.boundingBoxTopRight(aiv.boundingBoxTopRight());
|
||||
aiv2.aesTypeId(AesType::AtExplosionClusterSingleExplosions);
|
||||
aiv2.id(1000 * m_data.id + AesType::AtExplosionClusterSingleExplosions);
|
||||
aiv2.effectStateId(effectState());
|
||||
aiv2.boundingBoxBottomLeft = aiv.boundingBoxBottomLeft;
|
||||
aiv2.boundingBoxTopRight = aiv.boundingBoxTopRight;
|
||||
aiv2.aesTypeId = AesType::AtExplosionClusterSingleExplosions;
|
||||
aiv2.id = 1000 * m_data.id + static_cast<int>(AesType::AtExplosionClusterSingleExplosions);
|
||||
aiv2.effectStateId = effectState();
|
||||
if (m_data.partyId != 0)
|
||||
aiv2.partyId(m_data.partyId);
|
||||
aiv2.partyId = m_data.partyId;
|
||||
|
||||
//
|
||||
// m_aiv2 CHANGES HERE
|
||||
@@ -1489,25 +1489,25 @@ void ObjectExplosionCluster::publishAiv()
|
||||
// emit newAiv(aiv2);
|
||||
// }
|
||||
|
||||
m_effects.id(1000 * m_data.id + AesType::AtExplosionClusterSingleExplosions);
|
||||
m_effects.aesItemId(m_data.id);
|
||||
m_effects.aesTypeId(AesType::AtExplosionClusterSingleExplosions);
|
||||
std::vector<AreaEffectSimulation::SingleEffect> &singleEffectsRef = m_effects.singleEffects();
|
||||
m_effects.id = 1000 * m_data.id + static_cast<int>(AesType::AtExplosionClusterSingleExplosions);
|
||||
m_effects.aesItemId = m_data.id;
|
||||
m_effects.aesTypeId = AesType::AtExplosionClusterSingleExplosions;
|
||||
std::vector<AreaEffectSimulation::SingleEffect> &singleEffectsRef = m_effects.singleEffects;
|
||||
if (singleEffectsRef.empty())
|
||||
{
|
||||
if (isVulcano() || (m_data.externalId > 0)) // m_data.externalId > 0 -> HLA / SingleFire / PointGeometry
|
||||
{
|
||||
singleEffectsRef.resize(1);
|
||||
SingleEffect &seRef = singleEffectsRef.front();
|
||||
seRef.singleEffectState(AesSingleEffectState_def::SesScheduled);
|
||||
seRef.singleEffectState = AesSingleEffectState::SesScheduled;
|
||||
const QPointF &impactPointGeo
|
||||
= AreaEffectSimulation::Polygons::bottomLeft2CenterPoint(m_data.impactPosition, m_data.impactWidth, m_data.impactLength, m_data.rotationAngle);
|
||||
|
||||
// seRef.position(Core::GeoPosition(impactPointGeo.x(), impactPointGeo.y(), 0.0));
|
||||
const double elevation = getElevationFor(impactPointGeo, QStringLiteral("getElevationForSingleImpactVulcano"));
|
||||
seRef.position(Core::GeoPosition(impactPointGeo.x(), impactPointGeo.y(), elevation));
|
||||
seRef.position = Core::GeoPosition(impactPointGeo.x(), impactPointGeo.y(), elevation);
|
||||
|
||||
seRef.zPlacement(AesZPlacement_def::ZpDraped);
|
||||
seRef.zPlacement = AesZPlacement::ZpDraped;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1518,13 +1518,13 @@ void ObjectExplosionCluster::publishAiv()
|
||||
for (const QPointF &singleExplosion : qAsConst(singleExplosions))
|
||||
{
|
||||
SingleEffect se;
|
||||
se.singleEffectState(AesSingleEffectState_def::SesScheduled);
|
||||
se.singleEffectState = AesSingleEffectState::SesScheduled;
|
||||
|
||||
// se.position(Core::GeoPosition(singleExplosion.x(), singleExplosion.y(), 0.0));
|
||||
const double elevation = getElevationFor(singleExplosion, QStringLiteral("getElevationForSingleEffect"));
|
||||
se.position(Core::GeoPosition(singleExplosion.x(), singleExplosion.y(), elevation));
|
||||
se.position = Core::GeoPosition(singleExplosion.x(), singleExplosion.y(), elevation);
|
||||
|
||||
se.zPlacement(AesZPlacement_def::ZpDraped);
|
||||
se.zPlacement = AesZPlacement::ZpDraped;
|
||||
// // se.effectTime();
|
||||
singleEffectsRef.push_back(se);
|
||||
++explosionIndex;
|
||||
@@ -1535,11 +1535,11 @@ void ObjectExplosionCluster::publishAiv()
|
||||
else
|
||||
{
|
||||
auto dts = m_mainHandler->dds()->dts();
|
||||
dts->removeAesItemViewByKey(1000 * m_data.id + AesType::AtExplosionClusterSingleExplosions);
|
||||
dts->removeAesItemViewByKey(1000 * m_data.id + static_cast<int>(AesType::AtExplosionClusterSingleExplosions));
|
||||
|
||||
// up to s_maxTrajectoriesPerExplosionCluster are supported. One sample per trajectory.
|
||||
const bool errorMsgIfSampleDoesNotExists = false;
|
||||
dts->removeEffectsByKey(1000 * m_data.id + AesType::AtExplosionClusterSingleExplosions, errorMsgIfSampleDoesNotExists);
|
||||
dts->removeEffectsByKey(1000 * m_data.id + static_cast<int>(AesType::AtExplosionClusterSingleExplosions), errorMsgIfSampleDoesNotExists);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1558,49 +1558,49 @@ void ObjectExplosionCluster::publishAiv()
|
||||
// AtExplosionClusterGunToTargetLine is suppressed at map display, when main object changes to EsActivated
|
||||
// So it does not have to be changed/published anymore.
|
||||
// Especially helpful while restarting scvAes!
|
||||
static QVector<AesEffectState_def::type> relevantEffStates = {
|
||||
AesEffectState_def::EsCreated,
|
||||
AesEffectState_def::EsPrepared,
|
||||
AesEffectState_def::EsActivated, // 2026-05-27, N.Thoden: E01562-393: GTL auch bei EsFired anzeigen, daher auch bei EsActivated
|
||||
AesEffectState_def::EsFired, // 2026-05-27, N.Thoden: E01562-393: GTL auch bei EsFired anzeigen
|
||||
static QVector<AesEffectState::type> relevantEffStates = {
|
||||
AesEffectState::EsCreated,
|
||||
AesEffectState::EsPrepared,
|
||||
AesEffectState::EsActivated, // 2026-05-27, N.Thoden: E01562-393: GTL auch bei EsFired anzeigen, daher auch bei EsActivated
|
||||
AesEffectState::EsFired, // 2026-05-27, N.Thoden: E01562-393: GTL auch bei EsFired anzeigen
|
||||
};
|
||||
DEBUG_LOG(m_logger) << " AtExplosionClusterGunToTargetLine RELEVANT " << relevantEffStates.contains(effectState().underlying()) << ", id " << m_data.id;
|
||||
DEBUG_LOG(m_logger) << " AtExplosionClusterGunToTargetLine RELEVANT " << relevantEffStates.contains(effectState()) << ", id " << m_data.id;
|
||||
|
||||
if (isEcValid && isOriginatorParticipantIdProvided() && // no Originator -> no curve
|
||||
relevantEffStates.contains(effectState().underlying()))
|
||||
relevantEffStates.contains(effectState()))
|
||||
{
|
||||
AesItemView aiv3(m_aivGunToTargetTrajectory);
|
||||
aiv3.aesItemId(m_data.id);
|
||||
aiv3.chargeStruct().chargeTypeId(m_data.chargeTypeId);
|
||||
aiv3.aesItemId = m_data.id;
|
||||
aiv3.chargeStruct.chargeTypeId = m_data.chargeTypeId;
|
||||
// aiv3.effectStart(0);
|
||||
|
||||
if (aiv3.form().empty())
|
||||
if (aiv3.form.empty())
|
||||
{
|
||||
const std::vector<Core::GeoPosition> &form = ObjectExplosionCluster::generateGunToTargetForm();
|
||||
aiv3.form(form);
|
||||
aiv3.form = form;
|
||||
if (form.size() > 2)
|
||||
{
|
||||
QPolygonF polyGTL;
|
||||
polyGTL.reserve(2);
|
||||
polyGTL.push_back(QPointF(form.front().lon(), form.front().lat()));
|
||||
polyGTL.push_back(QPointF(form.back().lon(), form.back().lat()));
|
||||
polyGTL.push_back(QPointF(form.front().lon, form.front().lat));
|
||||
polyGTL.push_back(QPointF(form.back().lon, form.back().lat));
|
||||
const QRectF boundsGTL(polyGTL.boundingRect());
|
||||
aiv3.boundingBoxBottomLeft(Core::GeoPosition2D(boundsGTL.topLeft().x(), boundsGTL.topLeft().y())); // QRectF's bigger values are at bottom
|
||||
aiv3.boundingBoxTopRight(Core::GeoPosition2D(boundsGTL.bottomRight().x(), boundsGTL.bottomRight().y()));
|
||||
aiv3.boundingBoxBottomLeft = Core::GeoPosition2D(boundsGTL.topLeft().x(), boundsGTL.topLeft().y()); // QRectF's bigger values are at bottom
|
||||
aiv3.boundingBoxTopRight = Core::GeoPosition2D(boundsGTL.bottomRight().x(), boundsGTL.bottomRight().y());
|
||||
}
|
||||
}
|
||||
|
||||
aiv3.aesTypeId(AesType::AtExplosionClusterGunToTargetLine);
|
||||
aiv3.id(1000 * m_data.id + AesType::AtExplosionClusterGunToTargetLine);
|
||||
aiv3.aesTypeId = AesType::AtExplosionClusterGunToTargetLine;
|
||||
aiv3.id = 1000 * m_data.id + static_cast<int>(AesType::AtExplosionClusterGunToTargetLine);
|
||||
// aiv3.effectStateId(effectState());
|
||||
if (m_data.partyId != 0)
|
||||
aiv3.partyId(m_data.partyId);
|
||||
aiv3.partyId = m_data.partyId;
|
||||
|
||||
if (m_aivGunToTargetTrajectoryDirty || (aiv3 != m_aivGunToTargetTrajectory))
|
||||
{
|
||||
m_aivGunToTargetTrajectoryDirty = false;
|
||||
m_aivGunToTargetTrajectory = aiv3;
|
||||
aiv3.sampleTime(partitionTimeMSec()); // publish sampleTime, but do not store
|
||||
aiv3.sampleTime = partitionTimeMSec(); // publish sampleTime, but do not store
|
||||
m_mainHandler->dds()->dts()->publish(aiv3);
|
||||
emit newAiv(aiv3);
|
||||
}
|
||||
@@ -1609,7 +1609,7 @@ void ObjectExplosionCluster::publishAiv()
|
||||
{
|
||||
auto dts = m_mainHandler->dds()->dts();
|
||||
const bool errorMsgIfSampleDoesNotExists = false;
|
||||
dts->removeAesItemViewByKey(1000 * m_data.id + AesType::AtExplosionClusterGunToTargetLine, errorMsgIfSampleDoesNotExists);
|
||||
dts->removeAesItemViewByKey(1000 * m_data.id + static_cast<int>(AesType::AtExplosionClusterGunToTargetLine), errorMsgIfSampleDoesNotExists);
|
||||
}
|
||||
|
||||
// if (!setupParticipantOrigin())
|
||||
@@ -1620,7 +1620,7 @@ void ObjectExplosionCluster::publishAiv()
|
||||
if (aiv != m_aiv)
|
||||
{
|
||||
m_aiv = aiv;
|
||||
aiv.sampleTime(partitionTimeMSec()); // publish sampleTime, but do not store
|
||||
aiv.sampleTime = partitionTimeMSec(); // publish sampleTime, but do not store
|
||||
m_mainHandler->dds()->dts()->publish(aiv);
|
||||
emit newAiv(aiv);
|
||||
}
|
||||
@@ -1642,12 +1642,12 @@ void ObjectExplosionCluster::removeTopics()
|
||||
|
||||
dts->removeExplosionClusterByKey(m_data.id, errorMsgIfSampleDoesNotExists);
|
||||
|
||||
dts->removeAesItemViewByKey(1000 * m_data.id + AesType::AtExplosionCluster, errorMsgIfSampleDoesNotExists);
|
||||
dts->removeAesItemViewByKey(1000 * m_data.id + AesType::AtExplosionClusterSingleExplosions, errorMsgIfSampleDoesNotExists);
|
||||
dts->removeAesItemViewByKey(1000 * m_data.id + AesType::AtExplosionClusterGunToTargetLine, errorMsgIfSampleDoesNotExists);
|
||||
dts->removeAesItemViewByKey(1000 * m_data.id + static_cast<int>(AesType::AtExplosionCluster), errorMsgIfSampleDoesNotExists);
|
||||
dts->removeAesItemViewByKey(1000 * m_data.id + static_cast<int>(AesType::AtExplosionClusterSingleExplosions), errorMsgIfSampleDoesNotExists);
|
||||
dts->removeAesItemViewByKey(1000 * m_data.id + static_cast<int>(AesType::AtExplosionClusterGunToTargetLine), errorMsgIfSampleDoesNotExists);
|
||||
|
||||
// ti.id(1000 * m_data.id + AesType::AtExplosionClusterSingleExplosions);
|
||||
dts->removeTriggeredImpactsByKey(1000 * m_data.id + AesType::AtExplosionClusterSingleExplosions, errorMsgIfSampleDoesNotExists);
|
||||
dts->removeTriggeredImpactsByKey(1000 * m_data.id + static_cast<int>(AesType::AtExplosionClusterSingleExplosions), errorMsgIfSampleDoesNotExists);
|
||||
|
||||
#ifdef USE_TRAJECTORY_VIA_HANDLER
|
||||
// remove TrajectoryTimeAware created via Handler:
|
||||
@@ -1666,7 +1666,7 @@ void ObjectExplosionCluster::removeTopics()
|
||||
|
||||
// Effects / Impacts
|
||||
// m_effects.id (1000 * m_data.id + AesType::AtExplosionClusterSingleExplosions)
|
||||
dts->removeEffectsByKey(1000 * m_data.id + AesType::AtExplosionClusterSingleExplosions, errorMsgIfSampleDoesNotExists);
|
||||
dts->removeEffectsByKey(1000 * m_data.id + static_cast<int>(AesType::AtExplosionClusterSingleExplosions), errorMsgIfSampleDoesNotExists);
|
||||
|
||||
emit removeAiv(m_data.id);
|
||||
}
|
||||
@@ -1694,7 +1694,7 @@ void ObjectExplosionCluster::removeTopics()
|
||||
//{
|
||||
// m_singleExplosionTriggerTimer->stop();
|
||||
|
||||
// if (m_data.effectStateId != AesEffectState_def::EsActivated)
|
||||
// if (m_data.effectStateId != AesEffectState::EsActivated)
|
||||
// return;
|
||||
|
||||
// // int chargeCountUntilLastStart = lrint((m_data.originalEffectDuration - m_data.effectDuration) / impactDeltaMSec());
|
||||
@@ -1752,7 +1752,7 @@ void ObjectExplosionCluster::checkNextFire()
|
||||
// if (m_data.name.startsWith(QStringLiteral("SAAB")))
|
||||
// return;
|
||||
|
||||
if (m_data.effectStateId == AreaEffectSimulation::AesEffectState_def::EsCreated)
|
||||
if (m_data.effectStateId == AreaEffectSimulation::AesEffectState::EsCreated)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " " << m_data.id << " OBJECT IS EsCreated, RETURN;";
|
||||
return;
|
||||
@@ -1923,7 +1923,7 @@ void ObjectExplosionCluster::onFiringTimerImpact(int currentExplosionNumber, int
|
||||
const int curExplosionIndex = currentExplosionNumber - 1;
|
||||
|
||||
// Effects:
|
||||
std::vector<AreaEffectSimulation::SingleEffect> &singleEffectsRef = m_effects.singleEffects();
|
||||
std::vector<AreaEffectSimulation::SingleEffect> &singleEffectsRef = m_effects.singleEffects;
|
||||
if (singleEffectsRef.empty())
|
||||
{
|
||||
WARNING_LOG(m_logger) << LOGFUNCTION << " " << m_data.id << " singleEffectsRef empty, currentExplosionNumber" << currentExplosionNumber;
|
||||
@@ -1938,16 +1938,16 @@ void ObjectExplosionCluster::onFiringTimerImpact(int currentExplosionNumber, int
|
||||
continue;
|
||||
|
||||
SingleEffect &ref = singleEffectsRef[idx];
|
||||
if (ref.singleEffectState().underlying() != AesSingleEffectState_def::SesTriggered)
|
||||
if (ref.singleEffectState != AesSingleEffectState::SesTriggered)
|
||||
{
|
||||
ref.singleEffectState(AesSingleEffectState_def::SesTriggered);
|
||||
ref.singleEffectTime(curPartTime);
|
||||
ref.singleEffectState = AesSingleEffectState::SesTriggered;
|
||||
ref.singleEffectTime = curPartTime;
|
||||
bChanged = true;
|
||||
}
|
||||
} // for
|
||||
if (bChanged)
|
||||
{
|
||||
m_effects.sampleTime(curPartTime);
|
||||
m_effects.sampleTime = curPartTime;
|
||||
m_mainHandler->dds()->dts()->publish(m_effects);
|
||||
}
|
||||
} // if (singleEffectsRef.empty())
|
||||
@@ -1976,18 +1976,18 @@ void ObjectExplosionCluster::onFiringTimerStateChangeDelayedCommandAsInt(int cmd
|
||||
// setEffectState(AesEffectState::EsActivated);
|
||||
// return true;
|
||||
|
||||
AesEffectState newState = AesEffectState_def::EsUnknown;
|
||||
AesEffectState newState = AesEffectState::EsUnknown;
|
||||
|
||||
switch (cmd)
|
||||
{
|
||||
case FiringTimer::CMD::CMD_START:
|
||||
case FiringTimer::CMD::CMD_RESUME:
|
||||
newState = AesEffectState_def::EsActivated;
|
||||
newState = AesEffectState::EsActivated;
|
||||
m_data.effectStart = partitionTime();
|
||||
break;
|
||||
case FiringTimer::CMD::CMD_PAUSE:
|
||||
{
|
||||
newState = AesEffectState_def::EsPaused;
|
||||
newState = AesEffectState::EsPaused;
|
||||
m_data.effectStart = QDateTime(); // Invalid QDateTime to mark it paused
|
||||
|
||||
//
|
||||
@@ -2015,7 +2015,7 @@ void ObjectExplosionCluster::onFiringTimerStateChangeDelayedCommandAsInt(int cmd
|
||||
}
|
||||
break;
|
||||
case FiringTimer::CMD::CMD_EXPIRED_PLUS:
|
||||
newState = AesEffectState_def::EsExpired;
|
||||
newState = AesEffectState::EsExpired;
|
||||
DEBUG_LOG(m_logger) << "Expired!";
|
||||
m_data.effectDuration = m_data.originalEffectDuration;
|
||||
m_data.effectStart = m_data.originalEffectStart;
|
||||
@@ -2029,7 +2029,7 @@ void ObjectExplosionCluster::onFiringTimerStateChangeDelayedCommandAsInt(int cmd
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " " << m_data.id << " got signal stateChangeDelayed, setNewState " << newState
|
||||
<< ", m_data.effectDuration = " << m_data.effectDuration << ", m_data.remainExplosionNumber (nextExplosion) = " << m_data.remainExplosionNumber;
|
||||
|
||||
if (newState != AesEffectState_def::EsUnknown)
|
||||
if (newState != AesEffectState::EsUnknown)
|
||||
setEffectState(newState);
|
||||
}
|
||||
|
||||
@@ -2084,12 +2084,12 @@ bool ObjectExplosionCluster::generateTrajectory(int explosionNumber, bool startD
|
||||
else
|
||||
{
|
||||
// take impactPosition from form:
|
||||
const std::vector<Core::GeoPosition> &formRef = m_aiv2.form();
|
||||
const std::vector<Core::GeoPosition> &formRef = m_aiv2.form;
|
||||
Q_ASSERT(formRef.size() > 0);
|
||||
Q_ASSERT(explosionIndex >= 0);
|
||||
|
||||
const Core::GeoPosition &impactPosition_geo3D = formRef[explosionIndex];
|
||||
endPosition_geo2D = QPointF(impactPosition_geo3D.lon(), impactPosition_geo3D.lat());
|
||||
endPosition_geo2D = QPointF(impactPosition_geo3D.lon, impactPosition_geo3D.lat);
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " " << m_data.id << " *** generateTrajectory to: explosionIndex=" << explosionIndex
|
||||
<< ", endPosition_geo2D = " << endPosition_geo2D;
|
||||
}
|
||||
@@ -2276,8 +2276,8 @@ bool ObjectExplosionCluster::generateTrajectory(int explosionNumber, bool startD
|
||||
else
|
||||
{
|
||||
DetonationLocationReply reply;
|
||||
reply.id(m_data.id);
|
||||
reply.index(explosionIndex);
|
||||
reply.id = m_data.id;
|
||||
reply.index = explosionIndex;
|
||||
// reply.position(); // leave on default :-)
|
||||
onDetonationLocationReply(reply);
|
||||
}
|
||||
@@ -2373,7 +2373,7 @@ bool ObjectExplosionCluster::generateTrajectoryVulcanoSpecific(int explosionNumb
|
||||
alphaRad,
|
||||
tapTime,
|
||||
options,
|
||||
tdRef.trajectoryTimeAware.geometry(),
|
||||
tdRef.trajectoryTimeAware.geometry,
|
||||
idealTapAbsoluteGeoOut,
|
||||
&localReasonOut);
|
||||
if (!localReasonOut.isEmpty())
|
||||
@@ -2399,7 +2399,7 @@ bool ObjectExplosionCluster::generateTrajectoryVulcanoSpecific(int explosionNumb
|
||||
if (m_data.cloudBase > std::numeric_limits<int>::min())
|
||||
{
|
||||
// get access to point tapT:
|
||||
std::vector<Core::GeoPositionRelativeTime> &geometryRef = tdRef.trajectoryTimeAware.geometry();
|
||||
std::vector<Core::GeoPositionRelativeTime> &geometryRef = tdRef.trajectoryTimeAware.geometry;
|
||||
std::vector<Core::GeoPositionRelativeTime>::reverse_iterator rit = geometryRef.rbegin();
|
||||
|
||||
const Core::GeoPositionRelativeTime impact = *rit;
|
||||
@@ -2407,7 +2407,7 @@ bool ObjectExplosionCluster::generateTrajectoryVulcanoSpecific(int explosionNumb
|
||||
++rit;
|
||||
const Core::GeoPositionRelativeTime tapT = *rit;
|
||||
|
||||
const bool bTapT_strichRequested = (m_data.cloudBase < tapT.z()) && (impact.z() < m_data.cloudBase);
|
||||
const bool bTapT_strichRequested = (m_data.cloudBase < tapT.z) && (impact.z < m_data.cloudBase);
|
||||
|
||||
ERROR_LOG(m_logger) << " XXX cloudBase modification: "
|
||||
<< ", tapT = " << tapT << ", m_data.cloudBase = " << m_data.cloudBase << ", impact = " << impact
|
||||
@@ -2415,11 +2415,11 @@ bool ObjectExplosionCluster::generateTrajectoryVulcanoSpecific(int explosionNumb
|
||||
|
||||
if (bTapT_strichRequested)
|
||||
{
|
||||
const LtsCoordTrans::UtmCoordinate impactUtm = LtsCoordTrans::UtmCoordinate::fromGeographic(impact.lon(), impact.lat());
|
||||
const LtsCoordTrans::UtmCoordinate tapTUtm = LtsCoordTrans::UtmCoordinate::fromGeographic(tapT.lon(), tapT.lat(), impactUtm.zone);
|
||||
const LtsCoordTrans::UtmCoordinate impactUtm = LtsCoordTrans::UtmCoordinate::fromGeographic(impact.lon, impact.lat);
|
||||
const LtsCoordTrans::UtmCoordinate tapTUtm = LtsCoordTrans::UtmCoordinate::fromGeographic(tapT.lon, tapT.lat, impactUtm.zone);
|
||||
|
||||
const QVector3D impactVec3D(impactUtm.x, impactUtm.y, impact.z());
|
||||
const QVector3D tapTVec3D(tapTUtm.x, tapTUtm.y, tapT.z());
|
||||
const QVector3D impactVec3D(impactUtm.x, impactUtm.y, impact.z);
|
||||
const QVector3D tapTVec3D(tapTUtm.x, tapTUtm.y, tapT.z);
|
||||
|
||||
/* x | Tap (aka TapT)
|
||||
// \ |
|
||||
@@ -2457,14 +2457,14 @@ bool ObjectExplosionCluster::generateTrajectoryVulcanoSpecific(int explosionNumb
|
||||
const QPointF &tapT_strichGeo = tapT_strichUtm.geographic();
|
||||
|
||||
// Time
|
||||
double timeOffset = impact.relativeTime() - tapT.relativeTime();
|
||||
double timeOffset = impact.relativeTime - tapT.relativeTime;
|
||||
timeOffset *= scaleFactor;
|
||||
|
||||
Core::GeoPositionRelativeTime tapT_strichRelTime;
|
||||
tapT_strichRelTime.lon() = tapT_strichGeo.x();
|
||||
tapT_strichRelTime.lat() = tapT_strichGeo.y();
|
||||
tapT_strichRelTime.z() = tapT_strich.z();
|
||||
tapT_strichRelTime.relativeTime(impact.relativeTime() - timeOffset);
|
||||
tapT_strichRelTime.lon = tapT_strichGeo.x();
|
||||
tapT_strichRelTime.lat = tapT_strichGeo.y();
|
||||
tapT_strichRelTime.z = tapT_strich.z();
|
||||
tapT_strichRelTime.relativeTime = impact.relativeTime - timeOffset;
|
||||
|
||||
DEBUG_LOG(m_logger) << " tapT_strichRelTime " << tapT_strichRelTime;
|
||||
|
||||
@@ -2478,7 +2478,7 @@ bool ObjectExplosionCluster::generateTrajectoryVulcanoSpecific(int explosionNumb
|
||||
|
||||
// "convert" from time-aware curve 'back' to time-unaware trajectoryGeometry
|
||||
tdRef.trajectoryGeometry.clear();
|
||||
for (const Core::GeoPositionRelativeTime &geoPosRelTime : qAsConst(tdRef.trajectoryTimeAware.geometry()))
|
||||
for (const Core::GeoPositionRelativeTime &geoPosRelTime : qAsConst(tdRef.trajectoryTimeAware.geometry))
|
||||
tdRef.trajectoryGeometry.emplace_back(geoPosRelTime); // implicit // downcast
|
||||
|
||||
tdRef.peakHeightAbs = peakHeightRelToOrigin + originatorPosition_geo.z();
|
||||
@@ -2523,17 +2523,17 @@ bool ObjectExplosionCluster::getFiringUnitOrigin(const int firingParticipantId,
|
||||
return false;
|
||||
}
|
||||
|
||||
const bool isLeaf = ppmDtc->participant(firingParticipantId).inferiorIds().empty(); // isLeaf means single (Participant and not a Unit)
|
||||
const bool isLeaf = ppmDtc->participant(firingParticipantId).inferiorIds.empty(); // isLeaf means single (Participant and not a Unit)
|
||||
if (isLeaf)
|
||||
{
|
||||
const ParticipantManagement::ParticipantPosition &partPos = ppmDtc->participantPosition(firingParticipantId);
|
||||
if (partPos.participantId() != firingParticipantId)
|
||||
if (partPos.participantId != firingParticipantId)
|
||||
return false;
|
||||
|
||||
// relative zValue -> absolute zValue:
|
||||
// Keep NASAT in mind sending 'height' via NasatPosition (normally, 'height' is relative to ground)
|
||||
const double zValue = getElevationFor({partPos.pos().lon(), partPos.pos().lat()}, QString(QStringLiteral("participantPosition_partId=%1")).arg(firingParticipantId));
|
||||
firingOriginOut = LtsUtils::QPoint3D(partPos.pos().lon(), partPos.pos().lat(), partPos.pos().z() + zValue);
|
||||
const double zValue = getElevationFor({partPos.pos.lon, partPos.pos.lat}, QString(QStringLiteral("participantPosition_partId=%1")).arg(firingParticipantId));
|
||||
firingOriginOut = LtsUtils::QPoint3D(partPos.pos.lon, partPos.pos.lat, partPos.pos.z + zValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2552,8 +2552,8 @@ bool ObjectExplosionCluster::getFiringUnitOrigin(const int firingParticipantId,
|
||||
int idx = 0;
|
||||
for (Core::GeoPosition &geoPosRef : m_temporaryData.singleFiringPositions)
|
||||
{
|
||||
const double zValue = getElevationFor({geoPosRef.lon(), geoPosRef.lat()}, QString(QStringLiteral("firingCannonPosition_index_%1")).arg(idx++));
|
||||
geoPosRef.z(zValue);
|
||||
const double zValue = getElevationFor({geoPosRef.lon, geoPosRef.lat}, QString(QStringLiteral("firingCannonPosition_index_%1")).arg(idx++));
|
||||
geoPosRef.z = zValue;
|
||||
}
|
||||
if (m_logger.isDebugEnabled())
|
||||
for (const Core::GeoPosition geoPosRef : m_temporaryData.singleFiringPositions)
|
||||
@@ -2632,10 +2632,10 @@ LtsUtils::QPoint3D ObjectExplosionCluster::getFiringCannonGeoPosition(int explos
|
||||
Core::GeoPosition geoPos = m_temporaryData.getFiringCannonGeoPosition(explosionIndex);
|
||||
|
||||
// in case of missing coordinates for single cannons (or ModuleTest):
|
||||
if (std::isnan(geoPos.lon()) || std::isnan(geoPos.lat()) || std::isnan(geoPos.z()))
|
||||
if (std::isnan(geoPos.lon) || std::isnan(geoPos.lat) || std::isnan(geoPos.z))
|
||||
return m_data.firingCenterPosition;
|
||||
|
||||
return LtsUtils::QPoint3D(geoPos.lon(), geoPos.lat(), geoPos.z());
|
||||
return LtsUtils::QPoint3D(geoPos.lon, geoPos.lat, geoPos.z);
|
||||
}
|
||||
|
||||
LtsUtils::QPoint3D ObjectExplosionCluster::getFiringCannonUtmPosition(int explosionIndex, int zoneToUse) const
|
||||
@@ -2703,19 +2703,19 @@ void ObjectExplosionCluster::publishTrajectory(int explosionIndex)
|
||||
// enable access to TracjectoryData and add time-awarenes
|
||||
TracjectoryData &tdRef = m_trajectoryCont[explosionIndex];
|
||||
TrajectoryTimeAware &trajectoryTimeAwareRef = tdRef.trajectoryTimeAware;
|
||||
trajectoryTimeAwareRef.id(1000 * m_data.id + 100 + explosionIndex);
|
||||
trajectoryTimeAwareRef.sampleTime(partitionTimeMSec());
|
||||
trajectoryTimeAwareRef.id = 1000 * m_data.id + 100 + explosionIndex;
|
||||
trajectoryTimeAwareRef.sampleTime = partitionTimeMSec();
|
||||
|
||||
// [E01562-259] use originatorId, originatorTypeId (instead of aesItemId, aesTypeId)
|
||||
// trajectoryTimeAwareRef.aesItemId(m_data.id);
|
||||
// trajectoryTimeAwareRef.aesTypeId(AesType::AtExplosionClusterSingleTrajectory);
|
||||
|
||||
trajectoryTimeAwareRef.index(explosionIndex);
|
||||
trajectoryTimeAwareRef.index = explosionIndex;
|
||||
|
||||
if (isVulcano())
|
||||
{
|
||||
// Time:
|
||||
trajectoryTimeAwareRef.trajectoryStartTime(m_data.effectStart.toMSecsSinceEpoch() - m_temporaryData.calculatedFlightDurationMsec);
|
||||
trajectoryTimeAwareRef.trajectoryStartTime = m_data.effectStart.toMSecsSinceEpoch() - m_temporaryData.calculatedFlightDurationMsec;
|
||||
|
||||
#ifdef USE_TRAJECTORY_VIA_HANDLER
|
||||
publishTrajectoryViaHandler(trajectoryTimeAwareRef);
|
||||
@@ -2731,7 +2731,7 @@ void ObjectExplosionCluster::publishTrajectory(int explosionIndex)
|
||||
{
|
||||
// Time:
|
||||
// use sample time since FiringTimer is initiates trajectory calculation
|
||||
trajectoryTimeAwareRef.trajectoryStartTime(trajectoryTimeAwareRef.sampleTime());
|
||||
trajectoryTimeAwareRef.trajectoryStartTime = trajectoryTimeAwareRef.sampleTime;
|
||||
|
||||
const std::vector<Core::GeoPosition> &trajectoryGeometry = tdRef.trajectoryGeometry;
|
||||
Core::GeoPosition first;
|
||||
@@ -2740,7 +2740,7 @@ void ObjectExplosionCluster::publishTrajectory(int explosionIndex)
|
||||
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " " << m_data.id << " trajectoryGeometry=" << trajectoryGeometry.size() << ", first = " << first;
|
||||
|
||||
std::vector<Core::GeoPositionRelativeTime> &geometryRef = trajectoryTimeAwareRef.geometry();
|
||||
std::vector<Core::GeoPositionRelativeTime> &geometryRef = trajectoryTimeAwareRef.geometry;
|
||||
geometryRef.clear();
|
||||
geometryRef.reserve(trajectoryGeometry.size());
|
||||
int idx = 0;
|
||||
@@ -2772,7 +2772,7 @@ void ObjectExplosionCluster::publishTrajectory(int explosionIndex)
|
||||
} // if ((trajSize > 20) && (idx>1))
|
||||
} // if (!m_isAirSupportSource)
|
||||
|
||||
geometryRef.emplace_back(Core::GeoPositionRelativeTime(pos3D.lon(), pos3D.lat(), pos3D.z(), idx * flightDurationMSecSeg));
|
||||
geometryRef.emplace_back(Core::GeoPositionRelativeTime(pos3D.lon, pos3D.lat, pos3D.z, idx * flightDurationMSecSeg));
|
||||
++idx;
|
||||
} // for
|
||||
|
||||
@@ -2785,7 +2785,7 @@ void ObjectExplosionCluster::publishTrajectory(int explosionIndex)
|
||||
#endif
|
||||
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " " << m_data.id << " explosionIndex=" << explosionIndex << " has flightDurationMSecSeg=" << flightDurationMSecSeg
|
||||
<< ", startTime = " << trajectoryTimeAwareRef.trajectoryStartTime() << ", geometry().size() = " << trajectoryTimeAwareRef.geometry().size();
|
||||
<< ", startTime = " << trajectoryTimeAwareRef.trajectoryStartTime << ", geometry().size() = " << trajectoryTimeAwareRef.geometry.size();
|
||||
|
||||
#ifdef USE_TRAJECTORY_VIA_HANDLER
|
||||
publishTrajectoryViaHandler(trajectoryTimeAwareRef);
|
||||
@@ -2801,20 +2801,20 @@ void ObjectExplosionCluster::publishTrajectory(int explosionIndex)
|
||||
m_publisedTrajectoriesForDebug[explosionIndex] = QString(QStringLiteral("trajectoryPublished m_data.id=%1 - explosionIndex=%2 - trajectoryStarttime=%3 - size=%4"))
|
||||
.arg(m_data.id)
|
||||
.arg(explosionIndex)
|
||||
.arg(trajectoryTimeAwareRef.trajectoryStartTime())
|
||||
.arg(trajectoryTimeAwareRef.geometry().size());
|
||||
.arg(trajectoryTimeAwareRef.trajectoryStartTime)
|
||||
.arg(trajectoryTimeAwareRef.geometry.size());
|
||||
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " " << m_data.id << " add to m_publisedTrajectoriesForDebug " << m_publisedTrajectoriesForDebug[explosionIndex];
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " " << m_data.id << " add to m_publisedTrajectoriesForDebug.size = " << m_publisedTrajectoriesForDebug.size();
|
||||
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " " << m_data.id << " XXXX 4 trajectoryTimeAware.geometry().size() = " << trajectoryTimeAwareRef.geometry().size()
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " " << m_data.id << " XXXX 4 trajectoryTimeAware.geometry().size() = " << trajectoryTimeAwareRef.geometry.size()
|
||||
// << ", bPublished=" << bPublished
|
||||
;
|
||||
}
|
||||
|
||||
void ObjectExplosionCluster::publishTrajectoryViaHandler(const TrajectoryTimeAware &trajectoryTimeAwareRef)
|
||||
{
|
||||
const int explosionIndex = trajectoryTimeAwareRef.index();
|
||||
const int explosionIndex = trajectoryTimeAwareRef.index;
|
||||
|
||||
TrajectoryData trajData;
|
||||
trajData.id = m_trajectoryHandlerExplosionIndexToTopicId.value(explosionIndex, -1); // default value of -1 mean, create
|
||||
@@ -2824,17 +2824,17 @@ void ObjectExplosionCluster::publishTrajectoryViaHandler(const TrajectoryTimeAwa
|
||||
// trajData.aesTypeId = AesType::AtExplosionClusterSingleTrajectory;
|
||||
trajData.index = explosionIndex;
|
||||
trajData.originatorId = m_data.id; // m_data.id == aesItemId
|
||||
trajData.originatorTypeId = ProjectDataManagement::StateChangeOriginator::AreaEffectSimulation;
|
||||
trajData.originatorTypeId = ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_AreaEffectSimulation;
|
||||
|
||||
trajData.startTime = trajectoryTimeAwareRef.trajectoryStartTime();
|
||||
trajData.geometry = trajectoryTimeAwareRef.geometry();
|
||||
trajData.startTime = trajectoryTimeAwareRef.trajectoryStartTime;
|
||||
trajData.geometry = trajectoryTimeAwareRef.geometry;
|
||||
|
||||
const int id = m_mainHandler->trajectoryHandler()->createUpdate(trajData);
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << "trajectoryHandler::createUpdate with id= " << id;
|
||||
if (id < 0)
|
||||
{
|
||||
ERROR_LOG(m_logger) << LOGFUNCTION << " ERROR, publish failed" << m_data.id << " explosionIndex=" << explosionIndex
|
||||
<< ", startTime = " << trajectoryTimeAwareRef.trajectoryStartTime() << ", geometry().size() = " << trajectoryTimeAwareRef.geometry().size();
|
||||
<< ", startTime = " << trajectoryTimeAwareRef.trajectoryStartTime << ", geometry().size() = " << trajectoryTimeAwareRef.geometry.size();
|
||||
}
|
||||
|
||||
// update internal lookup table:
|
||||
@@ -2995,12 +2995,12 @@ void ObjectExplosionCluster::dump(const char *file, int lineNo) const
|
||||
DetonationLocationRequest ObjectExplosionCluster::detonationLocationRequest(int explosionIndex) const
|
||||
{
|
||||
DetonationLocationRequest req;
|
||||
req.id(m_data.id); // m_data.id == AesItemId
|
||||
req.index(explosionIndex);
|
||||
req.chargeTypeId(m_data.chargeTypeId);
|
||||
req.igniterTypeId(m_data.igniterTypeId);
|
||||
req.igniterFunctionId(m_data.igniterFunctionId);
|
||||
req.trajectory(m_trajectoryCont[explosionIndex].trajectoryGeometry);
|
||||
req.id = m_data.id; // m_data.id == AesItemId
|
||||
req.index = explosionIndex;
|
||||
req.chargeTypeId = m_data.chargeTypeId;
|
||||
req.igniterTypeId = m_data.igniterTypeId;
|
||||
req.igniterFunctionId = m_data.igniterFunctionId;
|
||||
req.trajectory = m_trajectoryCont[explosionIndex].trajectoryGeometry;
|
||||
|
||||
return req;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user