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
-1
@@ -36,7 +36,6 @@ class AesInfoDialog : public LtsWidgets::LtsDialog,
|
||||
}
|
||||
|
||||
private:
|
||||
NGL::INGLLogger& m_logger;
|
||||
void retranslate() override;
|
||||
|
||||
void handleNContamination(const AesItemView& aesItemView);
|
||||
|
||||
+31
-31
@@ -57,9 +57,9 @@ bool AbstractFiringStrategy::calculateDispersionTrajectory()
|
||||
|
||||
LtsUtils::QPoint3D newTarget = intendendTrajectory.last().position;
|
||||
|
||||
const int scatterLength = qRound(m_effector->effectorData().mhpScatterLenght());
|
||||
const int scatterLength = qRound(m_effector->effectorData().mhpScatterLenght);
|
||||
const int randomValueX = QRandomGenerator::global()->bounded(-scatterLength, scatterLength + 1);
|
||||
const int scatterWidth = qRound(m_effector->effectorData().mhpScatterWidth());
|
||||
const int scatterWidth = qRound(m_effector->effectorData().mhpScatterWidth);
|
||||
const int randomValueY = QRandomGenerator::global()->bounded(-scatterWidth, scatterWidth + 1);
|
||||
newTarget.setX(newTarget.x() + randomValueX);
|
||||
newTarget.setY(newTarget.y() + randomValueY);
|
||||
@@ -90,7 +90,7 @@ std::vector<Core::GeoPositionRelativeTime> AbstractFiringStrategy::buildTrajecto
|
||||
|
||||
// setup some vars of effector, which is used as launch position:
|
||||
Core::GeoPosition effectorPositionGeo = participantPosition(m_effector->participantId());
|
||||
const LtsCoordTrans::UtmCoordinate &launchUtm = LtsCoordTrans::UtmCoordinate::fromGeographic(effectorPositionGeo.lon(), effectorPositionGeo.lat());
|
||||
const LtsCoordTrans::UtmCoordinate &launchUtm = LtsCoordTrans::UtmCoordinate::fromGeographic(effectorPositionGeo.lon, effectorPositionGeo.lat);
|
||||
|
||||
|
||||
std::vector<Core::GeoPositionRelativeTime> geometry;
|
||||
@@ -112,7 +112,7 @@ std::vector<Core::GeoPositionRelativeTime> AbstractFiringStrategy::buildTrajecto
|
||||
const QPointF &trajPntAbsGeo = trajPntAbsUtm.geographic();
|
||||
|
||||
// Position des Participants mit der m_participantId
|
||||
const double zValue = effectorPositionGeo.z() + trajPntRelPos.position.z(); // trajPntRelPos.position.z() ist die Hoehe
|
||||
const double zValue = effectorPositionGeo.z + trajPntRelPos.position.z(); // trajPntRelPos.position.z() ist die Hoehe
|
||||
|
||||
DEBUG_LOG(m_logger) << "trajPntAbsUtm :" << trajPntAbsUtm << ", trajPntAbsGeo :" << trajPntAbsGeo;
|
||||
geometry.emplace_back(Core::GeoPositionRelativeTime(trajPntAbsGeo.x(), trajPntAbsGeo.y(), zValue, trajPntRelPos.time));
|
||||
@@ -131,13 +131,13 @@ TrajectoryTimeAware AbstractFiringStrategy::buildTrajectoryTimeAware(const std::
|
||||
}
|
||||
|
||||
TrajectoryTimeAware trajectory;
|
||||
trajectory.trajectoryStartTime(trajectoryStartTime);
|
||||
trajectory.trajectoryStartTime = trajectoryStartTime;
|
||||
|
||||
trajectory.index(index); // see SituationMap : charge_effect_to_map ::updateSingleTrajectory()
|
||||
trajectory.index = index; // see SituationMap : charge_effect_to_map ::updateSingleTrajectory()
|
||||
// [E01562-259] use originatorId, originatorTypeId (instead of aesItemId, aesTypeId)
|
||||
trajectory.originatorId(m_effector->aesItemId());
|
||||
trajectory.originatorTypeId(ProjectDataManagement::StateChangeOriginator::ChargeEffect);
|
||||
trajectory.geometry(trajectoryGeometry);
|
||||
trajectory.originatorId = m_effector->aesItemId();
|
||||
trajectory.originatorTypeId = ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_ChargeEffect;
|
||||
trajectory.geometry = trajectoryGeometry;
|
||||
return trajectory;
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ int AbstractFiringStrategy::sendChargeEffect(const TrajectoryTimeAware &trajecto
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "sendChargeEffect";
|
||||
|
||||
const auto trajGeometry = trajectoryTimeAware.geometry();
|
||||
const auto trajGeometry = trajectoryTimeAware.geometry;
|
||||
|
||||
// sanity check:
|
||||
if (trajGeometry.size() < 2)
|
||||
@@ -155,24 +155,24 @@ int AbstractFiringStrategy::sendChargeEffect(const TrajectoryTimeAware &trajecto
|
||||
return -1;
|
||||
}
|
||||
|
||||
const qint64 trajectoryStartTime = trajectoryTimeAware.trajectoryStartTime();
|
||||
const qint64 trajectoryStartTime = trajectoryTimeAware.trajectoryStartTime;
|
||||
|
||||
ChargeEffectModifyRequest chargeEffect;
|
||||
chargeEffect.id(0);
|
||||
chargeEffect.effectDuration(3000);
|
||||
chargeEffect.name("Schuss");
|
||||
chargeEffect.chargeTypeId(m_effector->effectorData().chargeStruct().chargeTypeId());
|
||||
chargeEffect.effectStart(trajectoryStartTime + trajectoryTimeAware.geometry().back().relativeTime()); // Einschlag Zeit
|
||||
chargeEffect.igniterTypeId(m_effector->effectorData().chargeStruct().igniterTypeId());
|
||||
chargeEffect.gearTypeId(gearTypeId(m_effector->effectorData().chargeStruct().chargeTypeId(), m_effector->participantId()));
|
||||
chargeEffect.originatorId(m_effector->aesItemId());
|
||||
chargeEffect.originatorTypeId(ProjectDataManagement::StateChangeOriginator::AreaEffectSimulation);
|
||||
chargeEffect.properties(QJsonDocument(properties).toJson().toStdString());
|
||||
chargeEffect.id = 0;
|
||||
chargeEffect.effectDuration = 3000;
|
||||
chargeEffect.name = "Schuss";
|
||||
chargeEffect.chargeTypeId = m_effector->effectorData().chargeStruct.chargeTypeId;
|
||||
chargeEffect.effectStart = trajectoryStartTime + trajectoryTimeAware.geometry.back().relativeTime; // Einschlag Zeit
|
||||
chargeEffect.igniterTypeId = m_effector->effectorData().chargeStruct.igniterTypeId;
|
||||
chargeEffect.gearTypeId(gearTypeId(m_effector->effectorData().chargeStruct.chargeTypeId, m_effector->participantId()));
|
||||
chargeEffect.originatorId = m_effector->aesItemId();
|
||||
chargeEffect.originatorTypeId = ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_AreaEffectSimulation;
|
||||
chargeEffect.properties = QJsonDocument(properties).toJson().toStdString();
|
||||
|
||||
const Core::GeoPosition &impactPosition = trajGeometry.back();
|
||||
chargeEffect.position(impactPosition); // Impact Position
|
||||
chargeEffect.position = impactPosition; // Impact Position
|
||||
|
||||
chargeEffect.trajectoryTimeAware(trajectoryTimeAware);
|
||||
chargeEffect.trajectoryTimeAware = trajectoryTimeAware;
|
||||
|
||||
const auto &reply = m_effector->mainHandler()->chargeEffectHandler()->createChargeEffect(chargeEffect);
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " reply.id=" << reply.id() << ", str:" << reply.str() << ", uniqueId:" << reply.uniqueId();
|
||||
@@ -183,7 +183,7 @@ Core::GeoPosition AbstractFiringStrategy::participantPosition(int participantId)
|
||||
{
|
||||
m_effector->mainHandler()->dds()->ppmDtc()->enableParticipantPosition(true);
|
||||
const ParticipantManagement::ParticipantPosition &pos = m_effector->mainHandler()->dds()->ppmDtc()->participantPosition(participantId);
|
||||
return pos.pos();
|
||||
return pos.pos;
|
||||
}
|
||||
|
||||
int32_t AbstractFiringStrategy::gearTypeId(int chargeTypeId, int participantId)
|
||||
@@ -194,17 +194,17 @@ int32_t AbstractFiringStrategy::gearTypeId(int chargeTypeId, int participantId)
|
||||
m_effector->mainHandler()->dds()->ppmDtc()->enableDynamicParticipantData(true);
|
||||
m_effector->mainHandler()->dds()->ppmDtc()->waitForHistoricalDataDynamicParticipantData(1000);
|
||||
const ParticipantManagement::DynamicParticipantData &dynamicParticipantData = m_effector->mainHandler()->dds()->ppmDtc()->dynamicParticipantData(participantId);
|
||||
DEBUG_LOG(m_logger) << "gearSize " << dynamicParticipantData.gear().size();
|
||||
DEBUG_LOG(m_logger) << "gearSize " << dynamicParticipantData.gear.size();
|
||||
|
||||
const auto& participantData_gear = dynamicParticipantData.gear();
|
||||
const auto& participantData_gear = dynamicParticipantData.gear;
|
||||
for (const auto &gear : qAsConst(participantData_gear))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "gear.chargeTypeId(): " << gear.chargeTypeId() << ", chargeTypeId:" << chargeTypeId;
|
||||
if (gear.chargeTypeId() == chargeTypeId)
|
||||
DEBUG_LOG(m_logger) << "gear.chargeTypeId(): " << gear.chargeTypeId << ", chargeTypeId:" << chargeTypeId;
|
||||
if (gear.chargeTypeId == chargeTypeId)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "getGearTypeId return: " << gear.gearTypeId();
|
||||
if (gear.gearTypeId() != 0)
|
||||
return gear.gearTypeId();
|
||||
DEBUG_LOG(m_logger) << "getGearTypeId return: " << gear.gearTypeId;
|
||||
if (gear.gearTypeId != 0)
|
||||
return gear.gearTypeId;
|
||||
else
|
||||
return 701; // MALTE XKCD
|
||||
}
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ bool DefaultFiringStrategy::doFiring()
|
||||
// 3b: buildTrajectoryTimeAware
|
||||
const auto trajTimeAware = buildTrajectoryTimeAware(geometry, trajectoryStartTime);
|
||||
// to be bullet-proof:
|
||||
if (trajTimeAware.geometry().size() < 2)
|
||||
if (trajTimeAware.geometry.size() < 2)
|
||||
{
|
||||
ERROR_LOG(m_logger) << LOGFUNCTION << " trajTimeAware is empty";
|
||||
return false;
|
||||
|
||||
+7
-7
@@ -79,12 +79,12 @@ void Dm72FiringStrategy::init()
|
||||
bool bOk = false;
|
||||
WirkmittelFeuerkommandoRakete wirkmittel;
|
||||
|
||||
const std::string propertiesStdStr = m_effector->effectorData().properties();
|
||||
const std::string propertiesStdStr = m_effector->effectorData().properties;
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " START" << ", propertiesStdStr= '" << propertiesStdStr << "'";
|
||||
|
||||
const QJsonObject properties = QJsonDocument::fromJson(QByteArray::fromStdString(propertiesStdStr)).object();
|
||||
const Core::GeoPosition geoStartPos = participantPosition(m_effector->participantId());
|
||||
const UtmCoordinate utmStartPos = UtmCoordinate::fromGeographic(geoStartPos.lon(), geoStartPos.lat());
|
||||
const UtmCoordinate utmStartPos = UtmCoordinate::fromGeographic(geoStartPos.lon, geoStartPos.lat);
|
||||
|
||||
wirkmittelFeuerkommandoRaketeFromJson(properties, wirkmittel, bOk);
|
||||
|
||||
@@ -129,9 +129,9 @@ QVector<QPointF> Dm72FiringStrategy::mineLayingCentroids() const
|
||||
{
|
||||
using namespace LtsCoordTrans;
|
||||
|
||||
const int chargeTypeId = m_effector->effectorData().chargeStruct().chargeTypeId();
|
||||
const int chargeTypeId = m_effector->effectorData().chargeStruct.chargeTypeId;
|
||||
const ProjectDataManagement::ChargeType &chargeType = m_effector->mainHandler()->dds()->pdmDtc()->chargeType(chargeTypeId);
|
||||
const QJsonObject chargeTypeProperties = QJsonDocument::fromJson(QByteArray::fromStdString(chargeType.properties())).object();
|
||||
const QJsonObject chargeTypeProperties = QJsonDocument::fromJson(QByteArray::fromStdString(chargeType.properties)).object();
|
||||
const QJsonObject mineLaying = chargeTypeProperties.value(QStringLiteral("mineLaying")).toObject();
|
||||
const QJsonArray mineLayingPattern = mineLaying.value(QStringLiteral("pattern")).toArray();
|
||||
/* QMap is used here because it sort its entries by key.
|
||||
@@ -139,8 +139,8 @@ QVector<QPointF> Dm72FiringStrategy::mineLayingCentroids() const
|
||||
* automatically sorts the pattern.
|
||||
*/
|
||||
QMap<int, QPointF> centroidsMap;
|
||||
const UtmCoordinate mhpUtm = UtmCoordinate::fromGeographic(m_effector->effectorData().mhpPosition().lon(),
|
||||
m_effector->effectorData().mhpPosition().lat());
|
||||
const UtmCoordinate mhpUtm = UtmCoordinate::fromGeographic(m_effector->effectorData().mhpPosition.lon,
|
||||
m_effector->effectorData().mhpPosition.lat);
|
||||
const double rotationAngle = angleToMhpUtm(mhpUtm.toPoint());
|
||||
QTransform rotation;
|
||||
|
||||
@@ -193,7 +193,7 @@ QVector<QPointF> Dm72FiringStrategy::mineLayingCentroids() const
|
||||
double Dm72FiringStrategy::angleToMhpUtm(const QPointF &mhpUtm) const
|
||||
{
|
||||
const ParticipantManagement::ParticipantPosition &ownPosition = m_effector->mainHandler()->dds()->ppmDtc()->participantPosition(m_effector->participantId());
|
||||
const LtsCoordTrans::UtmCoordinate ownPositionUtm = LtsCoordTrans::UtmCoordinate::fromGeographic(ownPosition.pos().lon(), ownPosition.pos().lat());
|
||||
const LtsCoordTrans::UtmCoordinate ownPositionUtm = LtsCoordTrans::UtmCoordinate::fromGeographic(ownPosition.pos.lon, ownPosition.pos.lat);
|
||||
const double angle = QLineF(mhpUtm, ownPositionUtm.toPoint()).angle();
|
||||
double northAngle = 90 - angle;
|
||||
|
||||
|
||||
+4
-4
@@ -30,19 +30,19 @@ AbstractFiringStrategy *createFiringStrategy(ObjectEffector *parent)
|
||||
if (!parent)
|
||||
return nullptr;
|
||||
|
||||
const ChargeStruct &cs = parent->effectorData().chargeStruct();
|
||||
const ChargeStruct &cs = parent->effectorData().chargeStruct;
|
||||
|
||||
DEBUG_LOG(logger) << LOGFUNCTION << " ChargeStruct = " << cs;
|
||||
|
||||
// GMLRS
|
||||
if (parent->mainHandler()->dds()->pdmDtc()->isGmlrs(cs.chargeTypeId()))
|
||||
if (parent->mainHandler()->dds()->pdmDtc()->isGmlrs(cs.chargeTypeId))
|
||||
{
|
||||
TRACE_LOG(logger) << LOGFUNCTION << " END";
|
||||
return new GmlrsFiringStrategy(parent);
|
||||
}
|
||||
|
||||
// SMArt
|
||||
const bool bIsSmart = parent->mainHandler()->dds()->pdmDtc()->isSmart(cs.chargeTypeId(), cs.igniterTypeId(), cs.igniterFunctionId());
|
||||
const bool bIsSmart = parent->mainHandler()->dds()->pdmDtc()->isSmart(cs.chargeTypeId, cs.igniterTypeId, cs.igniterFunctionId);
|
||||
if (bIsSmart)
|
||||
{
|
||||
TRACE_LOG(logger) << LOGFUNCTION << " END";
|
||||
@@ -50,7 +50,7 @@ AbstractFiringStrategy *createFiringStrategy(ObjectEffector *parent)
|
||||
}
|
||||
|
||||
// DM72
|
||||
if (parent->mainHandler()->dds()->pdmDtc()->isDm72(cs.chargeTypeId()))
|
||||
if (parent->mainHandler()->dds()->pdmDtc()->isDm72(cs.chargeTypeId))
|
||||
{
|
||||
TRACE_LOG(logger) << LOGFUNCTION << " END";
|
||||
return new Dm72FiringStrategy(parent);
|
||||
|
||||
+2
-2
@@ -66,9 +66,9 @@ void GmlrsFiringStrategy::init()
|
||||
m_impactPointIndex = 0;
|
||||
m_impactPoints.clear();
|
||||
|
||||
const QJsonObject &properties = QJsonDocument::fromJson(QByteArray::fromStdString(m_effector->effectorData().properties())).object();
|
||||
const QJsonObject &properties = QJsonDocument::fromJson(QByteArray::fromStdString(m_effector->effectorData().properties)).object();
|
||||
const Core::GeoPosition &geoStartPos = participantPosition(m_effector->participantId());
|
||||
const LtsCoordTrans::UtmCoordinate &utmStartPos = LtsCoordTrans::UtmCoordinate::fromGeographic(geoStartPos.lon(), geoStartPos.lat());
|
||||
const LtsCoordTrans::UtmCoordinate &utmStartPos = LtsCoordTrans::UtmCoordinate::fromGeographic(geoStartPos.lon, geoStartPos.lat);
|
||||
|
||||
bool bOk = false;
|
||||
WirkmittelFeuerkommandoRakete wirkmittel;
|
||||
|
||||
+204
-204
@@ -61,13 +61,13 @@ double distanceMeter(const LtsCoordTrans::UtmCoordinate &utmCoord1, const LtsCoo
|
||||
|
||||
double distanceMeter(const Core::GeoPosition &geoPos, const LtsCoordTrans::UtmCoordinate &utmCoord)
|
||||
{
|
||||
const LtsCoordTrans::UtmCoordinate &utmPos = LtsCoordTrans::UtmCoordinate::fromGeographic(geoPos.lon(), geoPos.lat());
|
||||
const LtsCoordTrans::UtmCoordinate &utmPos = LtsCoordTrans::UtmCoordinate::fromGeographic(geoPos.lon, geoPos.lat);
|
||||
return distanceMeter(utmPos, utmCoord);
|
||||
}
|
||||
|
||||
double distanceMeter(const Core::GeoPosition2D &geoPos2D, const LtsCoordTrans::UtmCoordinate &utmCoord)
|
||||
{
|
||||
const LtsCoordTrans::UtmCoordinate &utmPos = LtsCoordTrans::UtmCoordinate::fromGeographic(geoPos2D.lon(), geoPos2D.lat());
|
||||
const LtsCoordTrans::UtmCoordinate &utmPos = LtsCoordTrans::UtmCoordinate::fromGeographic(geoPos2D.lon, geoPos2D.lat);
|
||||
return distanceMeter(utmPos, utmCoord);
|
||||
}
|
||||
|
||||
@@ -136,10 +136,10 @@ void ModuleTestEffectCluster::onModifyParticipantDataReply(const Core::FunctionR
|
||||
int participantId = it->toInt();
|
||||
DEBUG_LOG(m_logger) << "participantId=" << participantId;
|
||||
ParticipantManagement::Participant participant = m_ppmDtc->participant(participantId);
|
||||
if (m_ppmDtc->type(participant.typeId()).typeClass().underlying() != ParticipantManagement::TypeClass::Unit)
|
||||
if (m_ppmDtc->type(participant.typeId).typeClass != ParticipantManagement::TypeClass::Unit)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "m_participant1.id=" << participantId;
|
||||
m_participant1.id(participantId); // wichtig zum loeschen
|
||||
m_participant1.id = participantId; // wichtig zum loeschen
|
||||
DEBUG_LOG(m_logger) << "m_participantId keine Unit=" << participantId;
|
||||
setParticipantPos(participantId);
|
||||
setEquipmentGearCharge(participantId);
|
||||
@@ -151,7 +151,7 @@ void ModuleTestEffectCluster::onModifyParticipantDataReply(const Core::FunctionR
|
||||
else
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "m_participant0.id=" << participantId;
|
||||
m_participant0.id(participantId); // wichtig zum loeschen
|
||||
m_participant0.id = participantId; // wichtig zum loeschen
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -161,23 +161,23 @@ void ModuleTestEffectCluster::onAesItemViewChanged(const AesItemView &aesItemVie
|
||||
if (modType == DataModification::eRemoved)
|
||||
return;
|
||||
|
||||
AreaEffectSimulation::AesType_def::type aesType = aesItemView.aesTypeId().underlying();
|
||||
if (aesType != AreaEffectSimulation::AesType_def::AtEffectCluster)
|
||||
AreaEffectSimulation::AesType::type aesType = aesItemView.aesTypeId().underlying();
|
||||
if (aesType != AreaEffectSimulation::AesType::AtEffectCluster)
|
||||
return;
|
||||
|
||||
if (aesItemView.aesItemId() != m_aesItemId)
|
||||
if (aesItemView.aesItemId != m_aesItemId)
|
||||
return;
|
||||
|
||||
DEBUG_LOG(m_logger) << " got onAesItemViewChanged: "
|
||||
<< ", aesItemId=" << aesItemView.aesItemId() << ", aesType=" << aesType << ", effectStateId=" << aesItemView.effectStateId();
|
||||
<< ", aesItemId=" << aesItemView.aesItemId << ", aesType=" << aesType << ", effectStateId=" << aesItemView.effectStateId;
|
||||
|
||||
QCOMPARE(aesItemView.effectStateId(), m_effectStates[m_effectStateCounter]);
|
||||
QCOMPARE(aesItemView.effectStateId, m_effectStates[m_effectStateCounter]);
|
||||
m_effectStateCounter++;
|
||||
|
||||
if (aesItemView.effectStateId() == AreaEffectSimulation::AesEffectState::EsReceived)
|
||||
if (aesItemView.effectStateId == AreaEffectSimulation::AesEffectState::EsReceived)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "sendAcknowledgeExternalAesItemRequest aesItemId=" << aesItemView.aesItemId();
|
||||
sendAcknowledgeExternalAesItemRequest(aesItemView.aesItemId());
|
||||
DEBUG_LOG(m_logger) << "sendAcknowledgeExternalAesItemRequest aesItemId=" << aesItemView.aesItemId;
|
||||
sendAcknowledgeExternalAesItemRequest(aesItemView.aesItemId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,11 +185,11 @@ void ModuleTestEffectCluster::sendTabExFire()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "sendTabExFire";
|
||||
TrainingAreaBase::EX_Fire exFire;
|
||||
exFire.effectorId(m_effectorId); // Kenner z.B B1
|
||||
exFire.identifier(m_identifier.toStdString()); // Verein z.B 451100
|
||||
exFire.reference(m_reference.toStdString()); // UUID Feuerkampf
|
||||
exFire.equipmentNumber(m_participant1.id() * -1);
|
||||
exFire.sampleTime(QDateTime::currentMSecsSinceEpoch() + 500);
|
||||
exFire.effectorId = m_effectorId; // Kenner z.B B1
|
||||
exFire.identifier = m_identifier.toStdString(); // Verein z.B 451100
|
||||
exFire.reference = m_reference.toStdString(); // UUID Feuerkampf
|
||||
exFire.equipmentNumber = m_participant1.id * -1;
|
||||
exFire.sampleTime = QDateTime::currentMSecsSinceEpoch() + 500;
|
||||
|
||||
m_tabDts->publish(exFire);
|
||||
}
|
||||
@@ -198,8 +198,8 @@ void ModuleTestEffectCluster::onEffectsChanged(const Effects &effects, DataModif
|
||||
{
|
||||
if (modType == DataModification::eRemoved)
|
||||
return;
|
||||
AreaEffectSimulation::AesType_def::type aesType = effects.aesTypeId().underlying();
|
||||
DEBUG_LOG(m_logger) << " got onEffectsChanged - m_data: " << m_data.id() << ", aesType=" << aesType;
|
||||
AreaEffectSimulation::AesType::type aesType = effects.aesTypeId().underlying();
|
||||
DEBUG_LOG(m_logger) << " got onEffectsChanged - m_data: " << m_data.id << ", aesType=" << aesType;
|
||||
++m_counterDds.cntEffectClusterEffects;
|
||||
|
||||
m_effects = effects;
|
||||
@@ -208,22 +208,22 @@ void ModuleTestEffectCluster::onEffectsChanged(const Effects &effects, DataModif
|
||||
|
||||
void ModuleTestEffectCluster::onChargeEffectChanged(const ChargeEffect &chargeEffect, DataModification modType)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onChargeEffectChanged state=" << chargeEffect.state();
|
||||
DEBUG_LOG(m_logger) << "onChargeEffectChanged state=" << chargeEffect.state;
|
||||
if (modType == DataModification::eRemoved)
|
||||
return;
|
||||
if (chargeEffect.state() == AreaEffectSimulation::AesEffectState::EsActivated)
|
||||
if (chargeEffect.state == AreaEffectSimulation::AesEffectState::EsActivated)
|
||||
{
|
||||
// Compare Position
|
||||
// mhpPosition.lon(0.201958);
|
||||
// mhpPosition.lat(0.915263);
|
||||
// mhpPosition.z(88.0);
|
||||
double lon = qRound64(chargeEffect.position().lon() * 100000) / 100000.0; // Nur die ersten 5 Nachkommastellen beruecksichtigen
|
||||
double lat = qRound64(chargeEffect.position().lat() * 100000) / 100000.0;
|
||||
double lon = qRound64(chargeEffect.position.lon * 100000) / 100000.0; // Nur die ersten 5 Nachkommastellen beruecksichtigen
|
||||
double lat = qRound64(chargeEffect.position.lat * 100000) / 100000.0;
|
||||
QCOMPARE(lon, 0.20196);
|
||||
QCOMPARE(lat, 0.91526);
|
||||
QCOMPARE(chargeEffect.position().z(), 88.0);
|
||||
QCOMPARE(chargeEffect.position.z, 88.0);
|
||||
}
|
||||
else if (chargeEffect.state() == AreaEffectSimulation::AesEffectState::EsExpired)
|
||||
else if (chargeEffect.state == AreaEffectSimulation::AesEffectState::EsExpired)
|
||||
participantDeleteRequest();
|
||||
DEBUG_LOG(m_logger) << " got onEffectsChanged - m_effects: " << m_effects;
|
||||
}
|
||||
@@ -231,12 +231,12 @@ void ModuleTestEffectCluster::onChargeEffectChanged(const ChargeEffect &chargeEf
|
||||
void ModuleTestEffectCluster::onTrajectoryTimeAwareChanged(const TrajectoryTimeAware &data, DataModification modType)
|
||||
{
|
||||
Q_UNUSED(modType);
|
||||
if (data.id() == -1)
|
||||
if (data.id == -1)
|
||||
return;
|
||||
|
||||
++m_counterDds.cntTrajectory;
|
||||
|
||||
DEBUG_LOG(m_logger) << " got TrajectoryTimeAwareChanged - data: " << data.id() << ", cntTrajectory=" << m_counterDds.cntTrajectory;
|
||||
DEBUG_LOG(m_logger) << " got TrajectoryTimeAwareChanged - data: " << data.id << ", cntTrajectory=" << m_counterDds.cntTrajectory;
|
||||
}
|
||||
|
||||
void ModuleTestEffectCluster::dumpCnt()
|
||||
@@ -269,24 +269,24 @@ bool ModuleTestEffectCluster::waitForData(const std::function<bool()> &func, int
|
||||
EffectCluster ModuleTestEffectCluster::getEcForTneVerification(const QString &eaName, double rotation)
|
||||
{
|
||||
AreaEffectSimulation::EffectCluster eaData;
|
||||
eaData.id(0);
|
||||
eaData.id = 0;
|
||||
|
||||
eaData.effectStart((time(nullptr) + 30) * 1000); // msec
|
||||
eaData.effectStart = (time(nullptr) + 30) * 1000; // msec
|
||||
|
||||
QString name(eaName);
|
||||
name += QString::number(eaData.effectStart().get());
|
||||
eaData.name(name.toStdString());
|
||||
name += QString::number(eaData.effectStart.get());
|
||||
eaData.name = name.toStdString();
|
||||
|
||||
eaData.effectDuration(10000); // 10 seconds
|
||||
eaData.effectDuration = 10000; // 10 seconds
|
||||
// eaData.chargeStruct().chargeTypeId(s_ChargeTypeId1);
|
||||
// eaData.chargeStruct().igniterTypeId(s_IgniterTypeProximity);
|
||||
|
||||
eaData.partyId(2);
|
||||
eaData.participantId(7);
|
||||
eaData.partyId = 2;
|
||||
eaData.participantId = 7;
|
||||
|
||||
// SubStruct FlightCurve
|
||||
FlightCurve fc;
|
||||
fc.requestedRelativePeakHeight(100);
|
||||
fc.requestedRelativePeakHeight = 100;
|
||||
|
||||
// siehe auch: GUEZE-2311 Verifikation des Algorithmus bzgl. MTPs zw. TNE und EXCON.
|
||||
const double height = 100; // Y
|
||||
@@ -301,15 +301,15 @@ EffectCluster ModuleTestEffectCluster::getEcForTneVerification(const QString &ea
|
||||
|
||||
DEBUG_LOG(m_logger) << " bottomLeft" << bottomLeft;
|
||||
|
||||
eaData.area().cornerBottomLeft(Core::GeoPosition(bottomLeft.x(), bottomLeft.y(), 0.0));
|
||||
eaData.area().height(height);
|
||||
eaData.area().width(width);
|
||||
eaData.area().rotation(rot);
|
||||
eaData.area.cornerBottomLeft(Core::GeoPosition(bottomLeft.x(), bottomLeft.y(), 0.0));
|
||||
eaData.area.height = height;
|
||||
eaData.area.width = width;
|
||||
eaData.area.rotation = rot;
|
||||
|
||||
eaData.explosionGeometry(AreaEffectSimulation::AesExplosionGeometry_def::EgArea);
|
||||
eaData.tla(0); // aka zop
|
||||
eaData.explosionGeometry = AreaEffectSimulation::AesExplosionGeometry::EgArea;
|
||||
eaData.tla = 0; // aka zop
|
||||
|
||||
eaData.externalId(0);
|
||||
eaData.externalId = 0;
|
||||
|
||||
return eaData;
|
||||
}
|
||||
@@ -349,17 +349,17 @@ std::vector<Core::RelativePositionRelativeTime> ModuleTestEffectCluster::parseTr
|
||||
QString val = xml.readElementText();
|
||||
|
||||
if (name == QStringLiteral("lon"))
|
||||
p.offsetX(val.toDouble());
|
||||
p.offsetX = val.toDouble();
|
||||
else if (name == QStringLiteral("lat"))
|
||||
p.offsetY(val.toDouble());
|
||||
p.offsetY = val.toDouble();
|
||||
else if (name == QStringLiteral("z"))
|
||||
p.offsetZ(val.toDouble());
|
||||
p.offsetZ = val.toDouble();
|
||||
else if (name == QStringLiteral("relativeTime"))
|
||||
p.relativeTime(val.toDouble());
|
||||
p.relativeTime = val.toDouble();
|
||||
}
|
||||
}
|
||||
points.push_back(p);
|
||||
DEBUG_LOG(m_logger) << "Punkt gelesen: offsetY" << p.offsetX() << ", offsetY" << p.offsetY() << ", offsetZ" << p.offsetZ() << ", time=" << p.relativeTime();
|
||||
DEBUG_LOG(m_logger) << "Punkt gelesen: offsetY" << p.offsetX << ", offsetY" << p.offsetY << ", offsetZ" << p.offsetZ << ", time=" << p.relativeTime;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -386,14 +386,14 @@ int ModuleTestEffectCluster::doEffectClusterModifyRequest()
|
||||
QString dateTimeString = QDateTime::currentDateTime().toString(QStringLiteral("dd.MM.yyyy hh:mm"));
|
||||
m_reference = dateTimeString;
|
||||
|
||||
if (eaData.effectStart().is_set())
|
||||
INFO_LOG(m_logger) << " effectClusterModifyRequest with effectStart: " << QDateTime::fromMSecsSinceEpoch(eaData.effectStart().get()).toString();
|
||||
if (eaData.effectStart.is_set())
|
||||
INFO_LOG(m_logger) << " effectClusterModifyRequest with effectStart: " << QDateTime::fromMSecsSinceEpoch(eaData.effectStart.get()).toString();
|
||||
else
|
||||
INFO_LOG(m_logger) << " effectClusterModifyRequest with effectStart: not set ";
|
||||
|
||||
FlightCurve fc;
|
||||
// if (eaData.flightCurve().is_set())
|
||||
// fc = eaData.flightCurve().get();
|
||||
// if (eaData.flightCurve.is_set())
|
||||
// fc = eaData.flightCurve.get();
|
||||
|
||||
QJsonObject obj;
|
||||
obj[QStringLiteral("effectSource")] = 1;
|
||||
@@ -410,49 +410,49 @@ int ModuleTestEffectCluster::doEffectClusterModifyRequest()
|
||||
|
||||
QString propertiesStr = QString::fromStdString(QJsonDocument(obj).toJson(QJsonDocument::Compact).toStdString());
|
||||
|
||||
eaData.properties(propertiesStr.toStdString());
|
||||
eaData.properties = propertiesStr.toStdString();
|
||||
AreaEffectSimulation::ChargeStruct chargeStruct;
|
||||
chargeStruct.chargeTypeId(367);
|
||||
chargeStruct.igniterTypeId(1);
|
||||
chargeStruct.igniterFunctionId(2);
|
||||
chargeStruct.chargeTypeId = 367;
|
||||
chargeStruct.igniterTypeId = 1;
|
||||
chargeStruct.igniterFunctionId = 2;
|
||||
|
||||
Core::GeoPosition mhpPosition;
|
||||
mhpPosition.lon(0.201958);
|
||||
mhpPosition.lat(0.915263);
|
||||
mhpPosition.z(88.0);
|
||||
mhpPosition.lon = 0.201958;
|
||||
mhpPosition.lat = 0.915263;
|
||||
mhpPosition.z = 88.0;
|
||||
|
||||
Core::GeoPosition2D cornerBottomLeft;
|
||||
cornerBottomLeft.lon(0.201951);
|
||||
cornerBottomLeft.lat(0.915259);
|
||||
cornerBottomLeft.lon = 0.201951;
|
||||
cornerBottomLeft.lat = 0.915259;
|
||||
|
||||
AreaEffectSimulation::Area area;
|
||||
area.cornerBottomLeft(cornerBottomLeft);
|
||||
area.width(50);
|
||||
area.height(50);
|
||||
area.rotation(0);
|
||||
eaData.area(area);
|
||||
area.cornerBottomLeft = cornerBottomLeft;
|
||||
area.width = 50;
|
||||
area.height = 50;
|
||||
area.rotation = 0;
|
||||
eaData.area = area;
|
||||
|
||||
eaData.explosionGeometry(AreaEffectSimulation::AesExplosionGeometry::EgPoint);
|
||||
eaData.explosionGeometry = AreaEffectSimulation::AesExplosionGeometry::EgPoint;
|
||||
|
||||
std::vector<Core::RelativePositionRelativeTime> trajectory = parseTrajectory(s_REQUEST_SPL_FILE);
|
||||
|
||||
AreaEffectSimulation::EffectorData effector;
|
||||
effector.angleOfFall(0);
|
||||
effector.participantId(m_participant1.id()); // Participant
|
||||
DEBUG_LOG(m_logger) << "effector.participantId(m_participant1.id()=" << m_participant1.id();
|
||||
effector.angleOfFall = 0;
|
||||
effector.participantId = m_participant1.id; // Participant
|
||||
DEBUG_LOG(m_logger) << "effector.participantId(m_participant1.id()=" << m_participant1.id;
|
||||
|
||||
effector.flightTime(39526.3);
|
||||
effector.peakHeight(2002.0);
|
||||
effector.interval(0);
|
||||
effector.chargeStruct(chargeStruct);
|
||||
effector.chargeAmount(1);
|
||||
effector.mhpScatterLenght(3.08314e-316);
|
||||
effector.mhpScatterWidth(8.76302e-315);
|
||||
effector.mhpScatterLengthDetonationHeight(9.69057e-316);
|
||||
effector.mhpScatterWidthDetonationHeight(8.76638e-315);
|
||||
effector.mhpRotation(-45.4373);
|
||||
effector.mhpPosition(mhpPosition);
|
||||
effector.trajectoryRelative(trajectory);
|
||||
effector.flightTime = 39526.3;
|
||||
effector.peakHeight = 2002.0;
|
||||
effector.interval = 0;
|
||||
effector.chargeStruct = chargeStruct;
|
||||
effector.chargeAmount = 1;
|
||||
effector.mhpScatterLenght = 3.08314e-316;
|
||||
effector.mhpScatterWidth = 8.76302e-315;
|
||||
effector.mhpScatterLengthDetonationHeight = 9.69057e-316;
|
||||
effector.mhpScatterWidthDetonationHeight = 8.76638e-315;
|
||||
effector.mhpRotation = -45.4373;
|
||||
effector.mhpPosition = mhpPosition;
|
||||
effector.trajectoryRelative = trajectory;
|
||||
|
||||
DEBUG_LOG(m_logger) << "effector";
|
||||
|
||||
@@ -461,37 +461,37 @@ int ModuleTestEffectCluster::doEffectClusterModifyRequest()
|
||||
|
||||
DEBUG_LOG(m_logger) << "Nach effector";
|
||||
|
||||
eaData.id(0);
|
||||
eaData.effectSourceId(ProjectDataManagement::EffectSource::ES_ADLER);
|
||||
eaData.firePurposeId(2);
|
||||
eaData.partyId(4);
|
||||
eaData.participantId(m_participant0.id()); // Unit
|
||||
DEBUG_LOG(m_logger) << "eaData.participantId(m_participant0.id()=" << m_participant0.id();
|
||||
eaData.externalId(7);
|
||||
eaData.effectMarkingInTa(1);
|
||||
eaData.id = 0;
|
||||
eaData.effectSourceId = ProjectDataManagement::EffectSource::ES_ADLER;
|
||||
eaData.firePurposeId = 2;
|
||||
eaData.partyId = 4;
|
||||
eaData.participantId = m_participant0.id; // Unit
|
||||
DEBUG_LOG(m_logger) << "eaData.participantId(m_participant0.id()=" << m_participant0.id;
|
||||
eaData.externalId = 7;
|
||||
eaData.effectMarkingInTa = 1;
|
||||
|
||||
eaData.name(dateTimeString.toStdString());
|
||||
eaData.element(dateTimeString.toStdString());
|
||||
eaData.name = dateTimeString.toStdString();
|
||||
eaData.element = dateTimeString.toStdString();
|
||||
|
||||
DEBUG_LOG(m_logger) << "Vor send effectClusterModifyRequest";
|
||||
|
||||
int ret = m_aesFtc->effectClusterModifyRequest(EffectClusterModifyRequest(eaData.id(),
|
||||
eaData.name(),
|
||||
eaData.element(),
|
||||
eaData.effectStart(),
|
||||
eaData.effectDuration(),
|
||||
eaData.effectSourceId(),
|
||||
eaData.area(),
|
||||
eaData.explosionGeometry(), // AimPoint, Radial, Area, Line, Point
|
||||
eaData.tla(), // ZielOrtungsGenauigkeit
|
||||
int ret = m_aesFtc->effectClusterModifyRequest(EffectClusterModifyRequest(eaData.id,
|
||||
eaData.name,
|
||||
eaData.element,
|
||||
eaData.effectStart,
|
||||
eaData.effectDuration,
|
||||
eaData.effectSourceId,
|
||||
eaData.area,
|
||||
eaData.explosionGeometry, // AimPoint, Radial, Area, Line, Point
|
||||
eaData.tla, // ZielOrtungsGenauigkeit
|
||||
effectors,
|
||||
eaData.firePurposeId(), // FirePurpose: blenden, niederhalten, vernichten
|
||||
eaData.partyId(),
|
||||
eaData.participantId(),
|
||||
eaData.firePurposeId, // FirePurpose: blenden, niederhalten, vernichten
|
||||
eaData.partyId,
|
||||
eaData.participantId,
|
||||
{}, // esmParticipantIds
|
||||
eaData.externalId(),
|
||||
eaData.effectMarkingInTa(),
|
||||
eaData.properties()),
|
||||
eaData.externalId,
|
||||
eaData.effectMarkingInTa,
|
||||
eaData.properties),
|
||||
this);
|
||||
DEBUG_LOG(m_logger) << "send effectClusterModifyRequest ret=" << ret;
|
||||
return ret;
|
||||
@@ -508,25 +508,25 @@ void ModuleTestEffectCluster::waitForEffectStates(int lineNumber, int durPrep, i
|
||||
}
|
||||
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " waiting for EsPrepared...";
|
||||
if (!waitForData([this]() { return m_data.effectStateId() == AreaEffectSimulation::AesEffectState_def::EsPrepared; }, durPrep))
|
||||
if (!waitForData([this]() { return m_data.effectStateId == AreaEffectSimulation::AesEffectState::EsPrepared; }, durPrep))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Timeout waiting for EsPrepared of explosion cluster with id " << m_data.id() << ", lineNumber = " << lineNumber;
|
||||
ERROR_LOG(m_logger) << "Timeout waiting for EsPrepared of explosion cluster with id " << m_data.id << ", lineNumber = " << lineNumber;
|
||||
QVERIFY2(false, "ERROR, exit");
|
||||
return;
|
||||
}
|
||||
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " waiting for EsActivated...";
|
||||
if (!waitForData([this]() { return m_data.effectStateId() == AreaEffectSimulation::AesEffectState_def::EsActivated; }, durAct))
|
||||
if (!waitForData([this]() { return m_data.effectStateId == AreaEffectSimulation::AesEffectState::EsActivated; }, durAct))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Timeout waiting for EsActivated of explosion cluster with id " << m_data.id() << ", lineNumber = " << lineNumber;
|
||||
ERROR_LOG(m_logger) << "Timeout waiting for EsActivated of explosion cluster with id " << m_data.id << ", lineNumber = " << lineNumber;
|
||||
QVERIFY2(false, "ERROR, exit");
|
||||
return;
|
||||
}
|
||||
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " waiting for EsExpired...";
|
||||
if (!waitForData([this]() { return m_data.effectStateId() == AreaEffectSimulation::AesEffectState_def::EsExpired; }, durExp))
|
||||
if (!waitForData([this]() { return m_data.effectStateId == AreaEffectSimulation::AesEffectState::EsExpired; }, durExp))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Timeout waiting for EsExpired of explosion cluster with id " << m_data.id() << ", lineNumber = " << lineNumber;
|
||||
ERROR_LOG(m_logger) << "Timeout waiting for EsExpired of explosion cluster with id " << m_data.id << ", lineNumber = " << lineNumber;
|
||||
QVERIFY2(false, "ERROR, exit");
|
||||
return;
|
||||
}
|
||||
@@ -538,24 +538,24 @@ void ModuleTestEffectCluster::disconnectFromParty()
|
||||
|
||||
ParticipantManagement::Party party;
|
||||
|
||||
party.name("GREEN");
|
||||
party.role(ParticipantManagement::Role::Neutral);
|
||||
party.color(-16711936);
|
||||
party.fadingColor(-6553701);
|
||||
party.name = "GREEN";
|
||||
party.role = ParticipantManagement::Role::Neutral;
|
||||
party.color = -16711936;
|
||||
party.fadingColor = -6553701;
|
||||
|
||||
ModifyPartyDataRequest req;
|
||||
req.id(m_partyId);
|
||||
req.name(party.name());
|
||||
req.color(party.color());
|
||||
req.fadingColor(party.fadingColor());
|
||||
req.role(party.role());
|
||||
req.isUsedBy(true);
|
||||
req.sampleTime(QDateTime::currentMSecsSinceEpoch());
|
||||
req.id = m_partyId;
|
||||
req.name = party.name;
|
||||
req.color = party.color;
|
||||
req.fadingColor = party.fadingColor;
|
||||
req.role = party.role;
|
||||
req.isUsedBy = true;
|
||||
req.sampleTime = QDateTime::currentMSecsSinceEpoch();
|
||||
const HlaForceIdentifierEnum hlaId = HlaForceIdentifierEnum::Neutral_1;
|
||||
req.hlaForceIdentifier(hlaId);
|
||||
req.hlaForceIdentifier = hlaId;
|
||||
QString properties = QStringLiteral("{\"Adler\": {\"wsId\": 3, \"SaaName\": \"UI Test\", \"assetId\": -1, \"saaName\": \"SAA1@GUEZ.DE\", \"szenarName\": \"UI Test\", "
|
||||
"\"isSaaConnected\": 1, \"saaConnectedState\": 2}}");
|
||||
req.properties(properties.toStdString());
|
||||
req.properties = properties.toStdString();
|
||||
|
||||
if (!m_ppmFtc->modifyPartyDataRequest(req, this))
|
||||
{
|
||||
@@ -570,25 +570,25 @@ void ModuleTestEffectCluster::connectToParty()
|
||||
|
||||
ParticipantManagement::Party party;
|
||||
|
||||
party.name("GREEN");
|
||||
party.role(ParticipantManagement::Role::Neutral);
|
||||
party.color(-16711936);
|
||||
party.fadingColor(-6553701);
|
||||
party.name = "GREEN";
|
||||
party.role = ParticipantManagement::Role::Neutral;
|
||||
party.color = -16711936;
|
||||
party.fadingColor = -6553701;
|
||||
|
||||
ModifyPartyDataRequest req;
|
||||
req.id(m_partyId);
|
||||
req.name(party.name());
|
||||
req.color(party.color());
|
||||
req.fadingColor(party.fadingColor());
|
||||
req.role(party.role());
|
||||
req.isUsedBy(true);
|
||||
req.sampleTime(QDateTime::currentMSecsSinceEpoch());
|
||||
req.id = m_partyId;
|
||||
req.name = party.name;
|
||||
req.color = party.color;
|
||||
req.fadingColor = party.fadingColor;
|
||||
req.role = party.role;
|
||||
req.isUsedBy = true;
|
||||
req.sampleTime = QDateTime::currentMSecsSinceEpoch();
|
||||
const HlaForceIdentifierEnum hlaId = HlaForceIdentifierEnum::Neutral_1;
|
||||
req.hlaForceIdentifier(hlaId);
|
||||
req.hlaForceIdentifier = hlaId;
|
||||
QString properties = QStringLiteral("{\"Adler\": {\"wsId\": 3, \"SaaName\": \"UI Test\", \"assetId\": -1, \"saaName\": \"SAA1@GUEZ.DE\", \"szenarName\": \"UI Test\", "
|
||||
"\"isSaaConnected\": 2, \"isVerbund\": true, \"saaConnectedState\": 4}}");
|
||||
|
||||
req.properties(properties.toStdString());
|
||||
req.properties = properties.toStdString();
|
||||
|
||||
if (!m_ppmFtc->modifyPartyDataRequest(req, this))
|
||||
{
|
||||
@@ -601,46 +601,46 @@ void ModuleTestEffectCluster::participantChangeRequest()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "PPM::participantChangerequest";
|
||||
|
||||
m_participant0.id(0);
|
||||
m_participant0.partyId(4);
|
||||
m_participant0.hierarchyNumber(1);
|
||||
m_participant0.typeId(182);
|
||||
m_participant0.externalId(0);
|
||||
m_participant0.symbol(QStringLiteral("AP6D|CMPL|10011000001308000000").toStdString());
|
||||
m_participant0.name(QStringLiteral("451200").toStdString());
|
||||
m_participant0.identification(QStringLiteral("").toStdString());
|
||||
m_participant0.designator(QStringLiteral("451200").toStdString()), m_participant0.tacticalIdentifier(QStringLiteral("451200").toStdString());
|
||||
m_participant0.info(QStringLiteral("").toStdString());
|
||||
m_participant0.assignState(ParticipantManagement::ParticipantAssignState::NotAssigned);
|
||||
m_participant0.isSimulated(false);
|
||||
m_participant0.isDeleted(false);
|
||||
m_participant0.properties(QStringLiteral("").toStdString());
|
||||
m_participant0.modId(1138783559);
|
||||
m_participant0.superiorModId(0);
|
||||
m_participant0.id = 0;
|
||||
m_participant0.partyId = 4;
|
||||
m_participant0.hierarchyNumber = 1;
|
||||
m_participant0.typeId = 182;
|
||||
m_participant0.externalId = 0;
|
||||
m_participant0.symbol = QStringLiteral("AP6D|CMPL|10011000001308000000").toStdString();
|
||||
m_participant0.name = QStringLiteral("451200").toStdString();
|
||||
m_participant0.identification = QStringLiteral("").toStdString();
|
||||
m_participant0.designator = QStringLiteral("451200").toStdString(), m_participant0.tacticalIdentifier = QStringLiteral("451200").toStdString();
|
||||
m_participant0.info = QStringLiteral("").toStdString();
|
||||
m_participant0.assignState = ParticipantManagement::ParticipantAssignState::NotAssigned;
|
||||
m_participant0.isSimulated = false;
|
||||
m_participant0.isDeleted = false;
|
||||
m_participant0.properties = QStringLiteral("").toStdString();
|
||||
m_participant0.modId = 1138783559;
|
||||
m_participant0.superiorModId = 0;
|
||||
|
||||
m_participant1.id(0);
|
||||
m_participant1.partyId(4);
|
||||
m_participant1.hierarchyNumber(1);
|
||||
m_participant1.typeId(188);
|
||||
m_participant1.externalId(0);
|
||||
m_participant1.symbol(QStringLiteral("AP6D|CMPL|10011500001114020000").toStdString());
|
||||
m_participant1.name(QStringLiteral("C3").toStdString());
|
||||
m_participant1.identification(QStringLiteral("").toStdString());
|
||||
m_participant1.designator(QStringLiteral("C3").toStdString()), m_participant1.tacticalIdentifier(QStringLiteral("451200").toStdString());
|
||||
m_participant1.info(QStringLiteral("").toStdString());
|
||||
m_participant1.assignState(ParticipantManagement::ParticipantAssignState::NotAssigned);
|
||||
m_participant1.isSimulated(false);
|
||||
m_participant1.isDeleted(false);
|
||||
m_participant1.properties(QStringLiteral("").toStdString());
|
||||
m_participant1.modId(1390608527);
|
||||
m_participant1.superiorModId(1138783559);
|
||||
m_participant1.id = 0;
|
||||
m_participant1.partyId = 4;
|
||||
m_participant1.hierarchyNumber = 1;
|
||||
m_participant1.typeId = 188;
|
||||
m_participant1.externalId = 0;
|
||||
m_participant1.symbol = QStringLiteral("AP6D|CMPL|10011500001114020000").toStdString();
|
||||
m_participant1.name = QStringLiteral("C3").toStdString();
|
||||
m_participant1.identification = QStringLiteral("").toStdString();
|
||||
m_participant1.designator = QStringLiteral("C3").toStdString(), m_participant1.tacticalIdentifier = QStringLiteral("451200").toStdString();
|
||||
m_participant1.info = QStringLiteral("").toStdString();
|
||||
m_participant1.assignState = ParticipantManagement::ParticipantAssignState::NotAssigned;
|
||||
m_participant1.isSimulated = false;
|
||||
m_participant1.isDeleted = false;
|
||||
m_participant1.properties = QStringLiteral("").toStdString();
|
||||
m_participant1.modId = 1390608527;
|
||||
m_participant1.superiorModId = 1138783559;
|
||||
|
||||
ModifyParticipantDataRequest req;
|
||||
std::vector<ParticipantManagement::ParticipantData> data;
|
||||
data.push_back(m_participant0);
|
||||
data.push_back(m_participant1);
|
||||
req.requestId(548288706);
|
||||
req.data(data);
|
||||
req.requestId = 548288706;
|
||||
req.data = data;
|
||||
if (!m_ppmFtc->modifyParticipantDataRequest(req, this))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Error creating party data";
|
||||
@@ -652,16 +652,16 @@ void ModuleTestEffectCluster::participantDeleteRequest()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "PPM::participantDeleteRequest";
|
||||
|
||||
m_participant0.isDeleted(true);
|
||||
m_participant0.isDeleted = true;
|
||||
|
||||
m_participant1.isDeleted(true);
|
||||
m_participant1.isDeleted = true;
|
||||
|
||||
ModifyParticipantDataRequest req;
|
||||
std::vector<ParticipantManagement::ParticipantData> data;
|
||||
data.push_back(m_participant0);
|
||||
data.push_back(m_participant1);
|
||||
req.requestId(548288707);
|
||||
req.data(data);
|
||||
req.requestId = 548288707;
|
||||
req.data = data;
|
||||
if (!m_ppmFtc->modifyParticipantDataRequest(req, this))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Error creating party data";
|
||||
@@ -676,16 +676,16 @@ void ModuleTestEffectCluster::setParticipantPos(int participantId)
|
||||
Core::GeoPosition geoPos;
|
||||
TrainingAreaBase::EquipmentPosition pos;
|
||||
|
||||
geoPos.lon(0.20110363);
|
||||
geoPos.lat(0.91579597);
|
||||
geoPos.z(0.0);
|
||||
geoPos.lon = 0.20110363;
|
||||
geoPos.lat = 0.91579597;
|
||||
geoPos.z = 0.0;
|
||||
|
||||
DEBUG_LOG(m_logger) << " initTestCase_data1 ...";
|
||||
pos.equipmentNumber(participantId * -1); // ParticipantId
|
||||
pos.sampleTime(QDateTime::currentMSecsSinceEpoch());
|
||||
position.reportingSource(Core::PositionReportingSource::SetByOperator);
|
||||
position.position(geoPos);
|
||||
pos.position(position);
|
||||
pos.equipmentNumber = participantId * -1; // ParticipantId
|
||||
pos.sampleTime = QDateTime::currentMSecsSinceEpoch();
|
||||
position.reportingSource = Core::PositionReportingSource::SetByOperator;
|
||||
position.position = geoPos;
|
||||
pos.position = position;
|
||||
m_tabDts->publish(pos);
|
||||
}
|
||||
|
||||
@@ -696,34 +696,34 @@ void ModuleTestEffectCluster::setEquipmentGearCharge(int participantId)
|
||||
TrainingAreaBase::GearCharge charge;
|
||||
std::vector<TrainingAreaBase::GearCharge> charges;
|
||||
|
||||
egs.equipmentNumber(participantId * -1); // ParticipantId
|
||||
egs.sampleTime(QDateTime::currentMSecsSinceEpoch());
|
||||
egs.equipmentNumber = participantId * -1; // ParticipantId
|
||||
egs.sampleTime = QDateTime::currentMSecsSinceEpoch();
|
||||
charges.resize(7);
|
||||
charge.gearId(138);
|
||||
charge.gearTypeId(801);
|
||||
charge.chargeTypeId(367);
|
||||
charge.remain(50);
|
||||
charge.gearId = 138;
|
||||
charge.gearTypeId = 801;
|
||||
charge.chargeTypeId = 367;
|
||||
charge.remain = 50;
|
||||
charges.push_back(charge); // 0
|
||||
|
||||
charge.chargeTypeId(366);
|
||||
charge.chargeTypeId = 366;
|
||||
charges.push_back(charge); // 1
|
||||
|
||||
charge.chargeTypeId(361);
|
||||
charge.chargeTypeId = 361;
|
||||
charges.push_back(charge); // 2
|
||||
|
||||
charge.chargeTypeId(362);
|
||||
charge.chargeTypeId = 362;
|
||||
charges.push_back(charge); // 3
|
||||
|
||||
charge.chargeTypeId(363);
|
||||
charge.chargeTypeId = 363;
|
||||
charges.push_back(charge); // 4
|
||||
|
||||
charge.chargeTypeId(364);
|
||||
charge.chargeTypeId = 364;
|
||||
charges.push_back(charge); // 5
|
||||
|
||||
charge.chargeTypeId(365);
|
||||
charge.chargeTypeId = 365;
|
||||
charges.push_back(charge); // 6
|
||||
|
||||
egs.charge(charges);
|
||||
egs.charge = charges;
|
||||
m_tabDts->publish(egs);
|
||||
}
|
||||
|
||||
@@ -736,17 +736,17 @@ void ModuleTestEffectCluster::onPartyChanged(const ParticipantManagement::Party
|
||||
return;
|
||||
}
|
||||
|
||||
if (data.id() != m_partyId)
|
||||
if (data.id != m_partyId)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DEBUG_LOG(m_logger) << "onPartyChanged id= " << data.id();
|
||||
if (m_ppmDtc->saaConnectedState(data.id()) == ParticipantManagement::ConnectState::Connected)
|
||||
DEBUG_LOG(m_logger) << "onPartyChanged id= " << data.id;
|
||||
if (m_ppmDtc->saaConnectedState(data.id) == ParticipantManagement::ConnectState::Connected)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onPartyChanged saaConnectedState == connected";
|
||||
}
|
||||
else if (m_ppmDtc->saaConnectedState(data.id()) == ParticipantManagement::ConnectState::Disconnected)
|
||||
else if (m_ppmDtc->saaConnectedState(data.id) == ParticipantManagement::ConnectState::Disconnected)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onPartyChanged saaConnectedState == disconnected => connectToParty";
|
||||
connectToParty();
|
||||
@@ -835,8 +835,8 @@ void ModuleTestEffectCluster::initTestCase()
|
||||
DEBUG_LOG(m_logger) << " waitForHistoricalDataExercise... Done";
|
||||
|
||||
const ExerciseManagement::Exercise &exercise = m_exmDtc->exercise(m_exerciseId);
|
||||
QVERIFY2(exercise.id() == m_exerciseId, "ERROR, exercise failed!!");
|
||||
m_traingAreaId = exercise.trainingAreaId();
|
||||
QVERIFY2(exercise.id == m_exerciseId, "ERROR, exercise failed!!");
|
||||
m_traingAreaId = exercise.trainingAreaId;
|
||||
|
||||
DEBUG_LOG(m_logger) << " ExerciseManagement"
|
||||
<< ", m_traingAreaId = " << m_traingAreaId;
|
||||
|
||||
+453
-453
File diff suppressed because it is too large.
Load diff
+196
-196
@@ -59,7 +59,7 @@ void ModuleTestLimits::testExplosionClusterCentral()
|
||||
for (int i = 0; i < m_maxExplosionsCentral + s_offset; ++i)
|
||||
{
|
||||
QString name = QStringLiteral("TEST_EC") + QStringLiteral("_CEN_") + QString::number(i);
|
||||
explosionCluster.name(name.toStdString());
|
||||
explosionCluster.name = name.toStdString();
|
||||
QTest::qWait(50);
|
||||
int ret = m_aesFtc->explosionClusterModifyRequest(explosionCluster, this);
|
||||
if (i < m_maxExplosionsCentral)
|
||||
@@ -73,7 +73,7 @@ void ModuleTestLimits::testExplosionClusterCentral()
|
||||
const auto &items = m_aesDtc->explosionClusters();
|
||||
for (const auto &item : qAsConst(items))
|
||||
{
|
||||
if (item.effectStateId() == AesEffectState::EsPrepared && item.isCentral() == true)
|
||||
if (item.effectStateId == AesEffectState::EsPrepared && item.isCentral == true)
|
||||
++counter;
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ void ModuleTestLimits::testExplosionClusterDecentral()
|
||||
for (int i = 0; i < m_maxExplosionsDecentral + s_offset; ++i)
|
||||
{
|
||||
QString name = QStringLiteral("TEST_EC") + QStringLiteral("_DEC_") + QString::number(i);
|
||||
explosionCluster.name(name.toStdString());
|
||||
explosionCluster.name = name.toStdString();
|
||||
QTest::qWait(50);
|
||||
int ret = m_aesFtc->explosionClusterModifyRequest(explosionCluster, this);
|
||||
if (i < m_maxExplosionsDecentral)
|
||||
@@ -106,7 +106,7 @@ void ModuleTestLimits::testExplosionClusterDecentral()
|
||||
const auto &items = m_aesDtc->explosionClusters();
|
||||
for (const auto &item : qAsConst(items))
|
||||
{
|
||||
if ((item.effectStateId() == AesEffectState::EsPrepared) && (item.isCentral() == false))
|
||||
if ((item.effectStateId == AesEffectState::EsPrepared) && (item.isCentral == false))
|
||||
++counter;
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ void ModuleTestLimits::testAirSupports()
|
||||
for (int i = 0; i < m_maxAirSupports + s_offset; ++i)
|
||||
{
|
||||
QString name = QStringLiteral("TEST_AS") + QStringLiteral("_CEN_") + QString::number(i);
|
||||
airSupport.name(name.toStdString());
|
||||
airSupport.name = name.toStdString();
|
||||
QTest::qWait(50);
|
||||
int ret = m_aesFtc->explosionClusterModifyRequest(airSupport, this);
|
||||
if (i < m_maxAirSupports)
|
||||
@@ -142,7 +142,7 @@ void ModuleTestLimits::testAirSupports()
|
||||
const auto &items = m_aesDtc->explosionClusters();
|
||||
for (const auto &item : qAsConst(items))
|
||||
{
|
||||
if (item.effectStateId() == AesEffectState::EsPrepared && item.isCentral() && m_pdmDtc->gearClassFromChargeTypeId(item.chargeStruct().chargeTypeId()) == ProjectDataManagement::GearClass::AirSupport)
|
||||
if (item.effectStateId == AesEffectState::EsPrepared && item.isCentral && m_pdmDtc->gearClassFromChargeTypeId(item.chargeStruct.chargeTypeId) == ProjectDataManagement::GearClass::GearClass_AirSupport)
|
||||
++counter;
|
||||
}
|
||||
|
||||
@@ -158,11 +158,11 @@ void ModuleTestLimits::testMineAreaCentral()
|
||||
QVERIFY2(m_aesFtc, "ERROR, No Aes Ftc available!!");
|
||||
|
||||
auto mineArea = getMa();
|
||||
mineArea.segments(m_segmentsCentral);
|
||||
mineArea.segments = m_segmentsCentral;
|
||||
for (int i = 0; i < m_maxMineAreasCentral + s_offset; ++i)
|
||||
{
|
||||
QString name = QStringLiteral("TEST_MA") + QStringLiteral("_CEN_") + QString::number(i);
|
||||
mineArea.name(name.toStdString());
|
||||
mineArea.name = name.toStdString();
|
||||
QTest::qWait(50);
|
||||
int ret = m_aesFtc->mineAreaModifyRequest(mineArea, this);
|
||||
if (i < m_maxMineAreasCentral)
|
||||
@@ -175,7 +175,7 @@ void ModuleTestLimits::testMineAreaCentral()
|
||||
const auto &items = m_aesDtc->mineAreas();
|
||||
for (const auto &item : qAsConst(items))
|
||||
{
|
||||
if ((item.effectStateId() == AesEffectState::EsPrepared) && (item.isCentral() == true))
|
||||
if ((item.effectStateId == AesEffectState::EsPrepared) && (item.isCentral == true))
|
||||
++counter;
|
||||
}
|
||||
|
||||
@@ -191,11 +191,11 @@ void ModuleTestLimits::testMineAreaDecentral()
|
||||
QVERIFY2(m_aesFtc, "ERROR, No Aes Ftc available!!");
|
||||
|
||||
auto mineArea = getMa();
|
||||
mineArea.segments(m_segmentsDecentral);
|
||||
mineArea.segments = m_segmentsDecentral;
|
||||
for (int i = 0; i < m_maxMineAreasDecentral - m_maxSafePzAbwSafe + s_offset; ++i)
|
||||
{
|
||||
QString name = QStringLiteral("TEST_MA") + QStringLiteral("_DEC_") + QString::number(i);
|
||||
mineArea.name(name.toStdString());
|
||||
mineArea.name = name.toStdString();
|
||||
QTest::qWait(50);
|
||||
int ret = m_aesFtc->mineAreaModifyRequest(mineArea, this);
|
||||
if (i < (m_maxMineAreasDecentral - m_maxSafePzAbwSafe))
|
||||
@@ -209,7 +209,7 @@ void ModuleTestLimits::testMineAreaDecentral()
|
||||
const auto &items = m_aesDtc->mineAreas();
|
||||
for (const auto &curMineArea : qAsConst(items))
|
||||
{
|
||||
if ((curMineArea.effectStateId() == AesEffectState::EsPrepared) && (curMineArea.isCentral() == false))
|
||||
if ((curMineArea.effectStateId == AesEffectState::EsPrepared) && (curMineArea.isCentral == false))
|
||||
++counter;
|
||||
}
|
||||
|
||||
@@ -218,11 +218,11 @@ void ModuleTestLimits::testMineAreaDecentral()
|
||||
// QVERIFY2(counter == m_maxMineAreasDecentral, "Too few mine areas");
|
||||
|
||||
|
||||
mineArea.layingProcedureType(AreaEffectSimulation::AesMaLayingProcedureType_def::LptArtillery);
|
||||
mineArea.layingProcedureType = AreaEffectSimulation::AesMaLayingProcedureType::LptArtillery;
|
||||
for (int i = 0; i < m_maxSafePzAbwSafe + s_offset; ++i)
|
||||
{
|
||||
QString name = QStringLiteral("TEST_MA_ART") + QStringLiteral("_DEC_") + QString::number(i);
|
||||
mineArea.name(name.toStdString());
|
||||
mineArea.name = name.toStdString();
|
||||
QTest::qWait(50);
|
||||
int ret = m_aesFtc->mineAreaModifyRequest(mineArea, this);
|
||||
if (i < m_maxSafePzAbwSafe)
|
||||
@@ -236,9 +236,9 @@ void ModuleTestLimits::testMineAreaDecentral()
|
||||
const auto &mineAreas = m_aesDtc->mineAreas();
|
||||
for (const auto &item : qAsConst(mineAreas))
|
||||
{
|
||||
if ((item.effectStateId() == AesEffectState::EsPrepared) &&
|
||||
!item.isCentral() &&
|
||||
(item.layingProcedureType() == AreaEffectSimulation::AesMaLayingProcedureType_def::LptArtillery))
|
||||
if ((item.effectStateId == AesEffectState::EsPrepared) &&
|
||||
!item.isCentral &&
|
||||
(item.layingProcedureType == AreaEffectSimulation::AesMaLayingProcedureType::LptArtillery))
|
||||
++counter2;
|
||||
}
|
||||
|
||||
@@ -252,12 +252,12 @@ void ModuleTestLimits::testNBCCentral()
|
||||
QVERIFY2(m_aesFtc, "ERROR, No Aes Ftc available!!");
|
||||
|
||||
auto nbContamination = getNBC();
|
||||
nbContamination.impactPosition(m_centralPoint);
|
||||
nbContamination.impactPosition = m_centralPoint;
|
||||
|
||||
for (int i = 0; i < m_maxNBCCentral + s_offset; ++i)
|
||||
{
|
||||
QString name = QStringLiteral("TEST_NBC") + QStringLiteral("_CEN_") + QString::number(i);
|
||||
nbContamination.name(name.toStdString());
|
||||
nbContamination.name = name.toStdString();
|
||||
QTest::qWait(50);
|
||||
int ret = m_aesFtc->nContaminationModifyRequest(nbContamination, this);
|
||||
if (i < m_maxNBCCentral)
|
||||
@@ -272,7 +272,7 @@ void ModuleTestLimits::testNBCCentral()
|
||||
const auto &items = m_aesDtc->nContaminations();
|
||||
for (const auto &item : qAsConst(items))
|
||||
{
|
||||
if (item.effectStateId() == AesEffectState::EsPrepared && item.isCentral() == true)
|
||||
if (item.effectStateId == AesEffectState::EsPrepared && item.isCentral == true)
|
||||
++counter;
|
||||
}
|
||||
|
||||
@@ -288,12 +288,12 @@ void ModuleTestLimits::testNBCDecentral()
|
||||
QVERIFY2(m_aesFtc, "ERROR, No Aes Ftc available!!");
|
||||
|
||||
auto nbContamination = getNBC();
|
||||
nbContamination.impactPosition(m_decentralPoint);
|
||||
nbContamination.impactPosition = m_decentralPoint;
|
||||
|
||||
for (int i = 0; i < m_maxNBCDecentral + s_offset; ++i)
|
||||
{
|
||||
QString name = QStringLiteral("TEST_NBC") + QStringLiteral("_DEC_") + QString::number(i);
|
||||
nbContamination.name(name.toStdString());
|
||||
nbContamination.name = name.toStdString();
|
||||
QTest::qWait(50);
|
||||
int ret = m_aesFtc->nContaminationModifyRequest(nbContamination, this);
|
||||
if (i < m_maxNBCDecentral)
|
||||
@@ -307,7 +307,7 @@ void ModuleTestLimits::testNBCDecentral()
|
||||
const auto &items = m_aesDtc->nContaminations();
|
||||
for (const auto &item : qAsConst(items))
|
||||
{
|
||||
if (item.effectStateId() == AesEffectState::EsPrepared && item.isCentral() == false)
|
||||
if (item.effectStateId == AesEffectState::EsPrepared && item.isCentral == false)
|
||||
++counter;
|
||||
}
|
||||
|
||||
@@ -325,7 +325,7 @@ void ModuleTestLimits::testOffRouteMines()
|
||||
for (int i = 0; i < m_maxOffRouteMines + s_offset; ++i)
|
||||
{
|
||||
QString name = QStringLiteral("TEST_ORM") + QStringLiteral("_") + QString::number(i);
|
||||
offRouteMine.name(name.toStdString());
|
||||
offRouteMine.name = name.toStdString();
|
||||
QTest::qWait(50);
|
||||
int ret = m_aesFtc->offRouteMineModifyRequest(offRouteMine, this);
|
||||
if (i < m_maxOffRouteMines)
|
||||
@@ -339,7 +339,7 @@ void ModuleTestLimits::testOffRouteMines()
|
||||
const auto &items = m_aesDtc->offRouteMines();
|
||||
for (const auto &item : qAsConst(items))
|
||||
{
|
||||
if (item.effectStateId() == AesEffectState::EsPrepared && item.isCentral() == true)
|
||||
if (item.effectStateId == AesEffectState::EsPrepared && item.isCentral == true)
|
||||
++counter;
|
||||
}
|
||||
|
||||
@@ -358,7 +358,7 @@ void ModuleTestLimits::testBoobyTraps()
|
||||
for (int i = 0; i < m_maxBoobyTraps + s_offset; ++i)
|
||||
{
|
||||
QString name = QStringLiteral("TEST_BT") + QStringLiteral("_") + QString::number(i);
|
||||
boobyTrap.name(name.toStdString());
|
||||
boobyTrap.name = name.toStdString();
|
||||
QTest::qWait(50);
|
||||
int ret = m_aesFtc->boobyTrapModifyRequest(boobyTrap, this);
|
||||
if (i < m_maxBoobyTraps)
|
||||
@@ -371,7 +371,7 @@ void ModuleTestLimits::testBoobyTraps()
|
||||
const auto &items = m_aesDtc->boobyTraps();
|
||||
for (const auto &item : qAsConst(items))
|
||||
{
|
||||
if (item.effectStateId() == AesEffectState::EsPrepared && item.isCentral() == true)
|
||||
if (item.effectStateId == AesEffectState::EsPrepared && item.isCentral == true)
|
||||
++counter;
|
||||
}
|
||||
|
||||
@@ -386,12 +386,12 @@ void ModuleTestLimits::testBCCCentral()
|
||||
QVERIFY2(m_aesFtc, "ERROR, No Aes Ftc available!!");
|
||||
|
||||
auto bcContamination = getBCC();
|
||||
bcContamination.impactPosition(m_centralPoint);
|
||||
bcContamination.impactPosition = m_centralPoint;
|
||||
|
||||
for (int i = 0; i < m_maxNBCCentral + s_offset; ++i)
|
||||
{
|
||||
QString name = QStringLiteral("TEST_BCC") + QStringLiteral("_CEN_") + QString::number(i);
|
||||
bcContamination.name(name.toStdString());
|
||||
bcContamination.name = name.toStdString();
|
||||
QTest::qWait(50);
|
||||
int ret = m_aesFtc->bCContaminationModifyRequest(bcContamination, this);
|
||||
if (i < m_maxNBCCentral)
|
||||
@@ -406,7 +406,7 @@ void ModuleTestLimits::testBCCCentral()
|
||||
const auto &items = m_aesDtc->bCContaminations();
|
||||
for (const auto &item : qAsConst(items))
|
||||
{
|
||||
if (item.effectStateId() == AesEffectState::EsPrepared && item.isCentral() == true)
|
||||
if (item.effectStateId == AesEffectState::EsPrepared && item.isCentral == true)
|
||||
++counter;
|
||||
}
|
||||
|
||||
@@ -421,12 +421,12 @@ void ModuleTestLimits::testBCCDecentral()
|
||||
QVERIFY2(m_aesFtc, "ERROR, No Aes Ftc available!!");
|
||||
|
||||
auto bcContamination = getBCC();
|
||||
bcContamination.impactPosition(m_decentralPoint);
|
||||
bcContamination.impactPosition = m_decentralPoint;
|
||||
|
||||
for (int i = 0; i < m_maxNBCDecentral + s_offset; ++i)
|
||||
{
|
||||
QString name = QStringLiteral("TEST_BCC") + QStringLiteral("_DEC_") + QString::number(i);
|
||||
bcContamination.name(name.toStdString());
|
||||
bcContamination.name = name.toStdString();
|
||||
QTest::qWait(50);
|
||||
int ret = m_aesFtc->bCContaminationModifyRequest(bcContamination, this);
|
||||
if (i < m_maxNBCDecentral)
|
||||
@@ -441,7 +441,7 @@ void ModuleTestLimits::testBCCDecentral()
|
||||
const auto &items = m_aesDtc->bCContaminations();
|
||||
for (const auto &item : qAsConst(items))
|
||||
{
|
||||
if (item.effectStateId() == AesEffectState::EsPrepared && item.isCentral() == false)
|
||||
if (item.effectStateId == AesEffectState::EsPrepared && item.isCentral == false)
|
||||
++counter;
|
||||
}
|
||||
|
||||
@@ -456,12 +456,12 @@ void ModuleTestLimits::testFADecentral()
|
||||
QVERIFY2(m_aesFtc, "ERROR, No Aes Ftc available!!");
|
||||
|
||||
auto functionArea = getFA();
|
||||
functionArea.area().cornerBottomLeft(m_decentralPoint);
|
||||
functionArea.area.cornerBottomLeft = m_decentralPoint;
|
||||
|
||||
for (int i = 0; i < m_maxFunctionalAreaDec + s_offset; ++i)
|
||||
{
|
||||
QString name = QStringLiteral("TEST_FA") + QStringLiteral("_DEC_") + QString::number(i);
|
||||
functionArea.name(name.toStdString());
|
||||
functionArea.name = name.toStdString();
|
||||
QTest::qWait(50);
|
||||
int ret = m_aesFtc->functionalAreaModifyRequest(functionArea, this);
|
||||
if (i < m_maxFunctionalAreaDec)
|
||||
@@ -476,7 +476,7 @@ void ModuleTestLimits::testFADecentral()
|
||||
const auto &items = m_aesDtc->functionalAreas();
|
||||
for (const auto &item : qAsConst(items))
|
||||
{
|
||||
if (item.effectStateId() == AesEffectState::EsPrepared && item.isCentral() == false)
|
||||
if (item.effectStateId == AesEffectState::EsPrepared && item.isCentral == false)
|
||||
++counter;
|
||||
}
|
||||
|
||||
@@ -492,12 +492,12 @@ void ModuleTestLimits::testFACentral()
|
||||
QVERIFY2(m_aesFtc, "ERROR, No Aes Ftc available!!");
|
||||
|
||||
auto functionArea = getFA();
|
||||
functionArea.area().cornerBottomLeft(m_centralPoint);
|
||||
functionArea.area.cornerBottomLeft = m_centralPoint;
|
||||
|
||||
for (int i = 0; i < m_maxFunctionalAreaCentral + s_offset; ++i)
|
||||
{
|
||||
QString name = QStringLiteral("TEST_FA") + QStringLiteral("_CEN_") + QString::number(i);
|
||||
functionArea.name(name.toStdString());
|
||||
functionArea.name = name.toStdString();
|
||||
QTest::qWait(50);
|
||||
int ret = m_aesFtc->functionalAreaModifyRequest(functionArea, this);
|
||||
if (i < m_maxFunctionalAreaCentral)
|
||||
@@ -513,7 +513,7 @@ void ModuleTestLimits::testFACentral()
|
||||
|
||||
for (const auto &item : qAsConst(items))
|
||||
{
|
||||
if (item.effectStateId() == AesEffectState::EsPrepared && item.isCentral() == true)
|
||||
if (item.effectStateId == AesEffectState::EsPrepared && item.isCentral == true)
|
||||
++counter;
|
||||
}
|
||||
|
||||
@@ -608,26 +608,26 @@ ExplosionClusterModifyRequest ModuleTestLimits::getEc(const Core::GeoPosition2D
|
||||
{
|
||||
|
||||
AreaEffectSimulation::ExplosionClusterModifyRequest eaReq;
|
||||
eaReq.id(0);
|
||||
eaReq.id = 0;
|
||||
|
||||
eaReq.effectStart((time(nullptr) + 30) * 1000); // msec
|
||||
eaReq.effectStart = (time(nullptr) + 30) * 1000; // msec
|
||||
|
||||
QString name(QStringLiteral("Test_EC"));
|
||||
eaReq.name(name.toStdString());
|
||||
eaReq.effectDuration(100000); // 10 seconds
|
||||
eaReq.effectStart(QDateTime::currentMSecsSinceEpoch() + 3000000000);
|
||||
eaReq.chargeStruct().chargeTypeId(s_ChargeTypeId1);
|
||||
eaReq.chargeStruct().igniterTypeId(s_IgniterTypeId);
|
||||
eaReq.name = name.toStdString();
|
||||
eaReq.effectDuration = 100000; // 10 seconds
|
||||
eaReq.effectStart = QDateTime::currentMSecsSinceEpoch() + 3000000000;
|
||||
eaReq.chargeStruct.chargeTypeId = s_ChargeTypeId1;
|
||||
eaReq.chargeStruct.igniterTypeId = s_IgniterTypeId;
|
||||
|
||||
eaReq.partyId(2);
|
||||
eaReq.participantId(6);
|
||||
eaReq.partyId = 2;
|
||||
eaReq.participantId = 6;
|
||||
|
||||
eaReq.mhpCount(4);
|
||||
eaReq.impactCount(4);
|
||||
eaReq.mhpCount = 4;
|
||||
eaReq.impactCount = 4;
|
||||
|
||||
eaReq.peakHeight(500);
|
||||
eaReq.peakHeight = 500;
|
||||
|
||||
eaReq.firePurposeId(1); // 1=Blenden, 2=Blenden mit IR,
|
||||
eaReq.firePurposeId = 1; // 1=Blenden, 2=Blenden mit IR,
|
||||
|
||||
const double height = 10;
|
||||
const double width = 20;
|
||||
@@ -635,15 +635,15 @@ ExplosionClusterModifyRequest ModuleTestLimits::getEc(const Core::GeoPosition2D
|
||||
|
||||
// NOTICE_LOG(m_logger) << "getEc: default SpecicalArea Bottom Left" << m_specialArea.boundingBoxBottomLeft();
|
||||
// eaReq.area().cornerBottomLeft(m_specialArea.boundingBoxBottomLeft());
|
||||
eaReq.area().cornerBottomLeft(cornerBottomLeft);
|
||||
eaReq.area().height(height);
|
||||
eaReq.area().width(width);
|
||||
eaReq.area().rotation(rot);
|
||||
eaReq.area.cornerBottomLeft = cornerBottomLeft;
|
||||
eaReq.area.height = height;
|
||||
eaReq.area.width = width;
|
||||
eaReq.area.rotation = rot;
|
||||
|
||||
eaReq.explosionGeometry(AreaEffectSimulation::AesExplosionGeometry_def::EgArea);
|
||||
eaReq.tla(0); // aka zog / ZielOrtungsGenauigkeit
|
||||
eaReq.explosionGeometry = AreaEffectSimulation::AesExplosionGeometry::EgArea;
|
||||
eaReq.tla = 0; // aka zog / ZielOrtungsGenauigkeit
|
||||
|
||||
eaReq.externalId(0);
|
||||
eaReq.externalId = 0;
|
||||
|
||||
return eaReq;
|
||||
}
|
||||
@@ -651,26 +651,26 @@ ExplosionClusterModifyRequest ModuleTestLimits::getEc(const Core::GeoPosition2D
|
||||
ExplosionClusterModifyRequest ModuleTestLimits::getAs()
|
||||
{
|
||||
AreaEffectSimulation::ExplosionClusterModifyRequest eaReq;
|
||||
eaReq.id(0);
|
||||
eaReq.id = 0;
|
||||
|
||||
eaReq.effectStart((time(nullptr) + 30) * 1000); // msec
|
||||
eaReq.effectStart = (time(nullptr) + 30) * 1000; // msec
|
||||
|
||||
QString name(QStringLiteral("Test_EC"));
|
||||
eaReq.name(name.toStdString());
|
||||
eaReq.effectDuration(100000); // 10 seconds
|
||||
eaReq.effectStart(QDateTime::currentMSecsSinceEpoch() + 3000000000);
|
||||
eaReq.chargeStruct().chargeTypeId(450); //PGM GBU 31
|
||||
eaReq.chargeStruct().igniterTypeId(s_IgniterTypeId);
|
||||
eaReq.name = name.toStdString();
|
||||
eaReq.effectDuration = 100000; // 10 seconds
|
||||
eaReq.effectStart = QDateTime::currentMSecsSinceEpoch() + 3000000000;
|
||||
eaReq.chargeStruct.chargeTypeId = 450; //PGM GBU 31
|
||||
eaReq.chargeStruct.igniterTypeId = s_IgniterTypeId;
|
||||
|
||||
eaReq.partyId(2);
|
||||
eaReq.participantId(6);
|
||||
eaReq.partyId = 2;
|
||||
eaReq.participantId = 6;
|
||||
|
||||
eaReq.mhpCount(1);
|
||||
eaReq.impactCount(1);
|
||||
eaReq.mhpCount = 1;
|
||||
eaReq.impactCount = 1;
|
||||
|
||||
eaReq.peakHeight(500);
|
||||
eaReq.peakHeight = 500;
|
||||
|
||||
eaReq.firePurposeId(1); // 1=Blenden, 2=Blenden mit IR,
|
||||
eaReq.firePurposeId = 1; // 1=Blenden, 2=Blenden mit IR,
|
||||
|
||||
const double height = 10;
|
||||
const double width = 20;
|
||||
@@ -678,15 +678,15 @@ ExplosionClusterModifyRequest ModuleTestLimits::getAs()
|
||||
|
||||
// NOTICE_LOG(m_logger) << "getAs: Default is SpecialArea Bottom Left" << m_specialArea.boundingBoxBottomLeft();
|
||||
// eaReq.area().cornerBottomLeft(m_specialArea.boundingBoxBottomLeft());
|
||||
eaReq.area().cornerBottomLeft(m_centralPoint);
|
||||
eaReq.area().height(height);
|
||||
eaReq.area().width(width);
|
||||
eaReq.area().rotation(rot);
|
||||
eaReq.area.cornerBottomLeft = m_centralPoint;
|
||||
eaReq.area.height = height;
|
||||
eaReq.area.width = width;
|
||||
eaReq.area.rotation = rot;
|
||||
|
||||
eaReq.explosionGeometry(AreaEffectSimulation::AesExplosionGeometry_def::EgPoint); // AirSupport -> EgPoint
|
||||
eaReq.tla(0); // aka zog / ZielOrtungsGenauigkeit
|
||||
eaReq.explosionGeometry = AreaEffectSimulation::AesExplosionGeometry::EgPoint; // AirSupport -> EgPoint
|
||||
eaReq.tla = 0; // aka zog / ZielOrtungsGenauigkeit
|
||||
|
||||
eaReq.externalId(0);
|
||||
eaReq.externalId = 0;
|
||||
|
||||
return eaReq;
|
||||
}
|
||||
@@ -696,15 +696,15 @@ ExplosionAreaModifyRequest ModuleTestLimits::getEa()
|
||||
|
||||
auto ea = ExplosionAreaModifyRequest();
|
||||
ea.area(AreaEffectSimulation::Area(m_decentralPoint, 500, 600, 70));
|
||||
ea.name(QStringLiteral("Test_AE__").toStdString());
|
||||
ea.id(0);
|
||||
ea.cannonCount(10);
|
||||
ea.cannonRounds(10);
|
||||
ea.chargeTypeId(s_ChargeTypeId1);
|
||||
ea.effectDuration(400000);
|
||||
ea.effectStart(QDateTime::currentMSecsSinceEpoch() + 30000000);
|
||||
ea.partyId(2);
|
||||
ea.externalId(2);
|
||||
ea.name = QStringLiteral("Test_AE__").toStdString();
|
||||
ea.id = 0;
|
||||
ea.cannonCount = 10;
|
||||
ea.cannonRounds = 10;
|
||||
ea.chargeTypeId = s_ChargeTypeId1;
|
||||
ea.effectDuration = 400000;
|
||||
ea.effectStart = QDateTime::currentMSecsSinceEpoch() + 30000000;
|
||||
ea.partyId = 2;
|
||||
ea.externalId = 2;
|
||||
|
||||
return ea;
|
||||
}
|
||||
@@ -712,13 +712,13 @@ ExplosionAreaModifyRequest ModuleTestLimits::getEa()
|
||||
ExplosionSingleModifyRequest ModuleTestLimits::getEs()
|
||||
{
|
||||
auto es = ExplosionSingleModifyRequest();
|
||||
es.impactPosition(m_decentralPoint);
|
||||
es.name(QStringLiteral("Test_AE__").toStdString());
|
||||
es.id(0);
|
||||
es.chargeTypeId(s_ChargeTypeId1);
|
||||
es.effectStart(QDateTime::currentMSecsSinceEpoch() + 30000000);
|
||||
es.partyId(2);
|
||||
es.externalId(2);
|
||||
es.impactPosition = m_decentralPoint;
|
||||
es.name = QStringLiteral("Test_AE__").toStdString();
|
||||
es.id = 0;
|
||||
es.chargeTypeId = s_ChargeTypeId1;
|
||||
es.effectStart = QDateTime::currentMSecsSinceEpoch() + 30000000;
|
||||
es.partyId = 2;
|
||||
es.externalId = 2;
|
||||
|
||||
return es;
|
||||
}
|
||||
@@ -727,18 +727,18 @@ MineAreaModifyRequest ModuleTestLimits::getMa()
|
||||
{
|
||||
|
||||
auto ma = MineAreaModifyRequest();
|
||||
ma.id(0);
|
||||
ma.name(QStringLiteral("Test_MA_").toStdString());
|
||||
ma.effectStart(QDateTime::currentMSecsSinceEpoch() + 30000000);
|
||||
ma.effectDuration(400000);
|
||||
ma.density(0.5);
|
||||
ma.width(169.58);
|
||||
ma.partyId(2);
|
||||
ma.chargeStruct().chargeTypeId(216);
|
||||
ma.isCenterLine(false);
|
||||
ma.isLaidHidden(false);
|
||||
ma.distance(500.0);
|
||||
ma.layingProcedureType(AreaEffectSimulation::AesMaLayingProcedureType_def::LptPioneer);
|
||||
ma.id = 0;
|
||||
ma.name = QStringLiteral("Test_MA_").toStdString();
|
||||
ma.effectStart = QDateTime::currentMSecsSinceEpoch() + 30000000;
|
||||
ma.effectDuration = 400000;
|
||||
ma.density = 0.5;
|
||||
ma.width = 169.58;
|
||||
ma.partyId = 2;
|
||||
ma.chargeStruct.chargeTypeId = 216;
|
||||
ma.isCenterLine = false;
|
||||
ma.isLaidHidden = false;
|
||||
ma.distance = 500.0;
|
||||
ma.layingProcedureType = AreaEffectSimulation::AesMaLayingProcedureType::LptPioneer;
|
||||
return ma;
|
||||
|
||||
|
||||
@@ -747,20 +747,20 @@ MineAreaModifyRequest ModuleTestLimits::getMa()
|
||||
NContaminationModifyRequest ModuleTestLimits::getNBC()
|
||||
{
|
||||
auto nbc = NContaminationModifyRequest();
|
||||
nbc.id(0);
|
||||
nbc.name("Test_NBC_");
|
||||
nbc.effectStart(QDateTime::currentMSecsSinceEpoch() + 30000000); // msec
|
||||
nbc.effectDuration(10000); // 10 sec
|
||||
nbc.chargeTypeId(321);
|
||||
nbc.impactPosition(m_decentralPoint);
|
||||
nbc.borderLengthInner(1000); // 1km
|
||||
nbc.borderLengthOuter(2000); // 2km
|
||||
nbc.impactRadius(500); // 500m
|
||||
nbc.spanAngle(31);
|
||||
nbc.rotationAngle(57);
|
||||
nbc.detonationValue(1000); // kt, only cosmetical
|
||||
nbc.partyId(2);
|
||||
nbc.externalId(0);
|
||||
nbc.id = 0;
|
||||
nbc.name = "Test_NBC_";
|
||||
nbc.effectStart = QDateTime::currentMSecsSinceEpoch() + 30000000; // msec
|
||||
nbc.effectDuration = 10000; // 10 sec
|
||||
nbc.chargeTypeId = 321;
|
||||
nbc.impactPosition = m_decentralPoint;
|
||||
nbc.borderLengthInner = 1000; // 1km
|
||||
nbc.borderLengthOuter = 2000; // 2km
|
||||
nbc.impactRadius = 500; // 500m
|
||||
nbc.spanAngle = 31;
|
||||
nbc.rotationAngle = 57;
|
||||
nbc.detonationValue = 1000; // kt, only cosmetical
|
||||
nbc.partyId = 2;
|
||||
nbc.externalId = 0;
|
||||
return nbc;
|
||||
|
||||
}
|
||||
@@ -768,68 +768,68 @@ NContaminationModifyRequest ModuleTestLimits::getNBC()
|
||||
OffRouteMineModifyRequest ModuleTestLimits::getORM()
|
||||
{
|
||||
auto orm = OffRouteMineModifyRequest();
|
||||
orm.id(0);
|
||||
orm.effectStart(QDateTime::currentMSecsSinceEpoch() + 300000000); // msec
|
||||
orm.effectDuration(100000); // 10 sec
|
||||
orm.chargeTypeId(253);
|
||||
orm.name("Test_ORM_");
|
||||
orm.area().cornerBottomLeft(m_decentralPoint);
|
||||
orm.area().width(1000);//(20);
|
||||
orm.area().height(200);//(15);
|
||||
orm.area().rotation(0.0);//(20.5);
|
||||
orm.impactRadius(100); // 100m
|
||||
orm.partyId(2);
|
||||
orm.id = 0;
|
||||
orm.effectStart = QDateTime::currentMSecsSinceEpoch() + 300000000; // msec
|
||||
orm.effectDuration = 100000; // 10 sec
|
||||
orm.chargeTypeId = 253;
|
||||
orm.name = "Test_ORM_";
|
||||
orm.area.cornerBottomLeft = m_decentralPoint;
|
||||
orm.area.width = 1000;//(20);
|
||||
orm.area.height = 200;//(15);
|
||||
orm.area.rotation = 0.0;//(20.5);
|
||||
orm.impactRadius = 100; // 100m
|
||||
orm.partyId = 2;
|
||||
return orm;
|
||||
}
|
||||
|
||||
BoobyTrapModifyRequest ModuleTestLimits::getBT()
|
||||
{
|
||||
auto bt = BoobyTrapModifyRequest();
|
||||
bt.id(0);
|
||||
bt.effectStart(QDateTime::currentMSecsSinceEpoch() + 30000000); // msec
|
||||
bt.effectDuration(100000); // 10 sec
|
||||
bt.chargeTypeId(251);
|
||||
bt.name("Test_BT_");
|
||||
bt.impactPosition(m_decentralPoint);
|
||||
bt.centralAngle(90);
|
||||
bt.rotationAngle(120);
|
||||
bt.impactRadius(100); // 100m
|
||||
bt.triggerRadius(200);
|
||||
bt.partyId(2);
|
||||
bt.id = 0;
|
||||
bt.effectStart = QDateTime::currentMSecsSinceEpoch() + 30000000; // msec
|
||||
bt.effectDuration = 100000; // 10 sec
|
||||
bt.chargeTypeId = 251;
|
||||
bt.name = "Test_BT_";
|
||||
bt.impactPosition = m_decentralPoint;
|
||||
bt.centralAngle = 90;
|
||||
bt.rotationAngle = 120;
|
||||
bt.impactRadius = 100; // 100m
|
||||
bt.triggerRadius = 200;
|
||||
bt.partyId = 2;
|
||||
return bt;
|
||||
}
|
||||
|
||||
BCContaminationModifyRequest ModuleTestLimits::getBCC()
|
||||
{
|
||||
auto bcc = BCContaminationModifyRequest();
|
||||
bcc.id(0);
|
||||
bcc.effectStart(QDateTime::currentMSecsSinceEpoch() + 30000000); // msec
|
||||
bcc.effectDuration(100000); // 10 sec
|
||||
bcc.impactRadius(100); // 100m
|
||||
bcc.partyId(2);
|
||||
bcc.upperOffset(6.0);
|
||||
bcc.lowerOffset(-1000.0);
|
||||
bcc.impactPosition(m_decentralPoint);
|
||||
bcc.chargeTypeId(341);
|
||||
bcc.weatherSource(AesWeatherSource::AwsStatic);
|
||||
bcc.id = 0;
|
||||
bcc.effectStart = QDateTime::currentMSecsSinceEpoch() + 30000000; // msec
|
||||
bcc.effectDuration = 100000; // 10 sec
|
||||
bcc.impactRadius = 100; // 100m
|
||||
bcc.partyId = 2;
|
||||
bcc.upperOffset = 6.0;
|
||||
bcc.lowerOffset = -1000.0;
|
||||
bcc.impactPosition = m_decentralPoint;
|
||||
bcc.chargeTypeId = 341;
|
||||
bcc.weatherSource = AesWeatherSource::AwsStatic;
|
||||
return bcc;
|
||||
}
|
||||
|
||||
FunctionalAreaModifyRequest ModuleTestLimits::getFA()
|
||||
{
|
||||
auto fa = FunctionalAreaModifyRequest();
|
||||
fa.id(0);
|
||||
fa.effectStart(QDateTime::currentMSecsSinceEpoch() + 30000000);
|
||||
fa.effectDuration(100000);
|
||||
fa.id = 0;
|
||||
fa.effectStart = QDateTime::currentMSecsSinceEpoch() + 30000000;
|
||||
fa.effectDuration = 100000;
|
||||
fa.area(AreaEffectSimulation::Area(m_decentralPoint, 500, 600, 70));
|
||||
fa.chargeTypeId(311);
|
||||
fa.partyId(2);
|
||||
fa.deconMode(AreaEffectSimulation::AesOperatingMode::OmWaitingTime);
|
||||
fa.deconTime(200000);
|
||||
fa.maintMode(AreaEffectSimulation::AesOperatingMode::OmWaitingTime);
|
||||
fa.maintTime(200000);
|
||||
fa.medicMode(AreaEffectSimulation::AesOperatingMode::OmWaitingTime);
|
||||
fa.medicTime(200000);
|
||||
fa.chargeTypeId = 311;
|
||||
fa.partyId = 2;
|
||||
fa.deconMode = AreaEffectSimulation::AesOperatingMode::OmWaitingTime;
|
||||
fa.deconTime = 200000;
|
||||
fa.maintMode = AreaEffectSimulation::AesOperatingMode::OmWaitingTime;
|
||||
fa.maintTime = 200000;
|
||||
fa.medicMode = AreaEffectSimulation::AesOperatingMode::OmWaitingTime;
|
||||
fa.medicTime = 200000;
|
||||
return fa;
|
||||
|
||||
}
|
||||
@@ -837,9 +837,9 @@ FunctionalAreaModifyRequest ModuleTestLimits::getFA()
|
||||
TechnicalAreaModifyRequest ModuleTestLimits::getTA()
|
||||
{
|
||||
auto ta = TechnicalAreaModifyRequest();
|
||||
ta.id(0);
|
||||
ta.id = 0;
|
||||
ta.area(AreaEffectSimulation::Area(m_decentralPoint, 500, 600, 70));
|
||||
ta.type(AreaEffectSimulation::AesTechnicalAreaType::TatRestingAreaVehicle);
|
||||
ta.type = AreaEffectSimulation::AesTechnicalAreaType::TatRestingAreaVehicle;
|
||||
return ta;
|
||||
}
|
||||
|
||||
@@ -896,8 +896,8 @@ void ModuleTestLimits::initTestCase()
|
||||
std::cout << " waitForHistoricalDataExercise... Done" << std::endl;
|
||||
|
||||
const ExerciseManagement::Exercise &exercise = m_exmDtc->exercise(m_exerciseId);
|
||||
QVERIFY2(exercise.id() == m_exerciseId, "ERROR, exercise failed!!: ");
|
||||
m_traingAreaId = exercise.trainingAreaId();
|
||||
QVERIFY2(exercise.id == m_exerciseId, "ERROR, exercise failed!!: ");
|
||||
m_traingAreaId = exercise.trainingAreaId;
|
||||
|
||||
std::cout << " ExerciseManagement"
|
||||
<< ", m_traingAreaId = " << m_traingAreaId << std::endl;
|
||||
@@ -937,7 +937,7 @@ void ModuleTestLimits::initTestCase()
|
||||
m_ismDtc->waitForHistoricalDataSpecialArea(1000);
|
||||
|
||||
|
||||
if (m_exmDtc->exercise(m_exerciseId).trainingAreaId() == s_TraingAreaId_Altmark)
|
||||
if (m_exmDtc->exercise(m_exerciseId).trainingAreaId == s_TraingAreaId_Altmark)
|
||||
{
|
||||
m_centralPoint = m_centralAltmark;
|
||||
m_decentralPoint = m_decentralAltmark;
|
||||
@@ -1143,9 +1143,9 @@ void ModuleTestLimits::setupParticipant()
|
||||
|
||||
ParticipantManagement::SetSimulatedPosition req;
|
||||
|
||||
req.participantId(6); // according testDB
|
||||
req.onlyOutdatedParticipants(false);
|
||||
req.position(Core::GeoPosition(m_partPos.lon(), m_partPos.lat(), 0.0));
|
||||
req.participantId = 6; // according testDB
|
||||
req.onlyOutdatedParticipants = false;
|
||||
req.position(Core::GeoPosition(m_partPos.lon, m_partPos.lat, 0.0));
|
||||
|
||||
INFO_LOG(m_logger) << " setSimulatedPositionRequest ...";
|
||||
m_replyError = true;
|
||||
@@ -1169,10 +1169,10 @@ void ModuleTestLimits::setupCharges()
|
||||
{
|
||||
QVERIFY2(m_aesFtc, "ERROR, no m_aesFtc");
|
||||
ChargeAdministrationModifyRequest req;
|
||||
req.id(0);
|
||||
req.chargeTypeId(371);
|
||||
req.partyId(2);
|
||||
req.amount(9999999);
|
||||
req.id = 0;
|
||||
req.chargeTypeId = 371;
|
||||
req.partyId = 2;
|
||||
req.amount = 9999999;
|
||||
m_aesFtc->chargeAdministrationModifyRequest(req, this);
|
||||
|
||||
}
|
||||
@@ -1194,80 +1194,80 @@ void ModuleTestLimits::deleteAesAreas()
|
||||
auto clusters = m_aesDtc->explosionClusters();
|
||||
for (auto cluster : qAsConst(clusters))
|
||||
{
|
||||
if (!sts.contains(cluster.effectStateId().underlying()))
|
||||
if (!sts.contains(cluster.effectStateId))
|
||||
{
|
||||
auto removeReq = Core::RemoveElementRequest();
|
||||
removeReq.id(cluster.id());
|
||||
removeReq.id = cluster.id;
|
||||
m_aesFtc->explosionClusterRemoveRequest(removeReq, this);
|
||||
}
|
||||
}
|
||||
auto nbcs = m_aesDtc->nContaminations();
|
||||
for (auto nbc : qAsConst(nbcs))
|
||||
{
|
||||
if (!sts.contains(nbc.effectStateId().underlying()))
|
||||
if (!sts.contains(nbc.effectStateId))
|
||||
{
|
||||
auto removeReq = Core::RemoveElementRequest();
|
||||
removeReq.id(nbc.id());
|
||||
removeReq.id = nbc.id;
|
||||
m_aesFtc->nContaminationRemoveRequest(removeReq, this);
|
||||
}
|
||||
}
|
||||
auto orms = m_aesDtc->offRouteMines();
|
||||
for (auto orm : qAsConst(orms))
|
||||
{
|
||||
if (!sts.contains(orm.effectStateId().underlying()))
|
||||
if (!sts.contains(orm.effectStateId))
|
||||
{
|
||||
auto removeReq = Core::RemoveElementRequest();
|
||||
removeReq.id(orm.id());
|
||||
removeReq.id = orm.id;
|
||||
m_aesFtc->offRouteMineRemoveRequest(removeReq, this);
|
||||
}
|
||||
}
|
||||
auto bts = m_aesDtc->boobyTraps();
|
||||
for (auto bt : qAsConst(bts))
|
||||
{
|
||||
if (!sts.contains(bt.effectStateId().underlying()))
|
||||
if (!sts.contains(bt.effectStateId))
|
||||
{
|
||||
auto removeReq = Core::RemoveElementRequest();
|
||||
removeReq.id(bt.id());
|
||||
removeReq.id = bt.id;
|
||||
m_aesFtc->boobyTrapRemoveRequest(removeReq, this);
|
||||
}
|
||||
}
|
||||
auto mas = m_aesDtc->mineAreas();
|
||||
for (auto ma : qAsConst(mas))
|
||||
{
|
||||
if (!sts.contains(ma.effectStateId().underlying()))
|
||||
if (!sts.contains(ma.effectStateId))
|
||||
{
|
||||
auto removeReq = Core::RemoveElementRequest();
|
||||
removeReq.id(ma.id());
|
||||
removeReq.id = ma.id;
|
||||
m_aesFtc->mineAreaRemoveRequest(removeReq, this);
|
||||
}
|
||||
}
|
||||
auto bccs = m_aesDtc->bCContaminations();
|
||||
for (auto bcc : qAsConst(bccs))
|
||||
{
|
||||
if (!sts.contains(bcc.effectStateId().underlying()))
|
||||
if (!sts.contains(bcc.effectStateId))
|
||||
{
|
||||
auto removeReq = Core::RemoveElementRequest();
|
||||
removeReq.id(bcc.id());
|
||||
removeReq.id = bcc.id;
|
||||
m_aesFtc->bCContaminationRemoveRequest(removeReq, this);
|
||||
}
|
||||
}
|
||||
auto fas = m_aesDtc->functionalAreas();
|
||||
for (auto fa : qAsConst(fas))
|
||||
{
|
||||
if (!sts.contains(fa.effectStateId().underlying()))
|
||||
if (!sts.contains(fa.effectStateId))
|
||||
{
|
||||
auto removeReq = Core::RemoveElementRequest();
|
||||
removeReq.id(fa.id());
|
||||
removeReq.id = fa.id;
|
||||
m_aesFtc->functionalAreaRemoveRequest(removeReq, this);
|
||||
}
|
||||
}
|
||||
auto tas = m_aesDtc->technicalAreas();
|
||||
for (auto ta : qAsConst(tas))
|
||||
{
|
||||
if (!sts.contains(ta.effectStateId().underlying()))
|
||||
if (!sts.contains(ta.effectStateId))
|
||||
{
|
||||
auto removeReq = Core::RemoveElementRequest();
|
||||
removeReq.id(ta.id());
|
||||
removeReq.id = ta.id;
|
||||
m_aesFtc->technicalAreaRemoveRequest(removeReq, this);
|
||||
}
|
||||
}
|
||||
@@ -1275,10 +1275,10 @@ void ModuleTestLimits::deleteAesAreas()
|
||||
auto eas = m_aesDtc->explosionAreas();
|
||||
for (auto ea : qAsConst(eas))
|
||||
{
|
||||
if (!sts.contains(ea.effectStateId().underlying()))
|
||||
if (!sts.contains(ea.effectStateId))
|
||||
{
|
||||
auto removeReq = Core::RemoveElementRequest();
|
||||
removeReq.id(ea.id());
|
||||
removeReq.id = ea.id;
|
||||
m_aesFtc->explosionAreaRemoveRequest(removeReq, this);
|
||||
}
|
||||
}
|
||||
@@ -1286,10 +1286,10 @@ void ModuleTestLimits::deleteAesAreas()
|
||||
auto ess = m_aesDtc->explosionSingles();
|
||||
for (auto es : qAsConst(ess))
|
||||
{
|
||||
if (!sts.contains(es.effectStateId().underlying()))
|
||||
if (!sts.contains(es.effectStateId))
|
||||
{
|
||||
auto removeReq = Core::RemoveElementRequest();
|
||||
removeReq.id(es.id());
|
||||
removeReq.id = es.id;
|
||||
m_aesFtc->explosionSingleRemoveRequest(removeReq, this);
|
||||
}
|
||||
}
|
||||
|
||||
+96
-96
@@ -59,13 +59,13 @@ double distanceMeter(const LtsCoordTrans::UtmCoordinate &utmCoord1, const LtsCoo
|
||||
|
||||
double distanceMeter(const Core::GeoPosition &geoPos, const LtsCoordTrans::UtmCoordinate &utmCoord)
|
||||
{
|
||||
const LtsCoordTrans::UtmCoordinate &utmPos = LtsCoordTrans::UtmCoordinate::fromGeographic(geoPos.lon(), geoPos.lat());
|
||||
const LtsCoordTrans::UtmCoordinate &utmPos = LtsCoordTrans::UtmCoordinate::fromGeographic(geoPos.lon, geoPos.lat);
|
||||
return distanceMeter(utmPos, utmCoord);
|
||||
}
|
||||
|
||||
double distanceMeter(const Core::GeoPosition2D &geoPos2D, const LtsCoordTrans::UtmCoordinate &utmCoord)
|
||||
{
|
||||
const LtsCoordTrans::UtmCoordinate &utmPos = LtsCoordTrans::UtmCoordinate::fromGeographic(geoPos2D.lon(), geoPos2D.lat());
|
||||
const LtsCoordTrans::UtmCoordinate &utmPos = LtsCoordTrans::UtmCoordinate::fromGeographic(geoPos2D.lon, geoPos2D.lat);
|
||||
return distanceMeter(utmPos, utmCoord);
|
||||
}
|
||||
|
||||
@@ -118,17 +118,17 @@ void ModuleTestAesOthers::onOffRouteMineRemoveReply(const Core::FunctionReplyObj
|
||||
void ModuleTestAesOthers::boobyTrapChanged(const BoobyTrap &data, DataModification modType)
|
||||
{
|
||||
Q_UNUSED(modType);
|
||||
if (data.id() == -1)
|
||||
if (data.id == -1)
|
||||
return;
|
||||
|
||||
++m_counterDds.cntBoobyTrap;
|
||||
|
||||
m_dataBoobyTrap = data;
|
||||
qint64 startTimeMsec = -1;
|
||||
if (m_dataBoobyTrap.effectStart().is_set())
|
||||
startTimeMsec = m_dataBoobyTrap.effectStart().get();
|
||||
if (m_dataBoobyTrap.effectStart.is_set())
|
||||
startTimeMsec = m_dataBoobyTrap.effectStart.get();
|
||||
|
||||
DEBUG_LOG(m_logger) << " got changed - m_dataBoobyTrap: " << m_dataBoobyTrap.id() << ", state=" << m_dataBoobyTrap.effectStateId()
|
||||
DEBUG_LOG(m_logger) << " got changed - m_dataBoobyTrap: " << m_dataBoobyTrap.id << ", state=" << m_dataBoobyTrap.effectStateId
|
||||
<< ", startTimeMsec=" << startTimeMsec
|
||||
<< ", cntBoobyTrap=" << m_counterDds.cntBoobyTrap;
|
||||
TRACE_LOG(m_logger) << " got changed - m_dataBoobyTrap: " << m_dataBoobyTrap;
|
||||
@@ -137,17 +137,17 @@ void ModuleTestAesOthers::boobyTrapChanged(const BoobyTrap &data, DataModificati
|
||||
void ModuleTestAesOthers::offRouteMineChanged(const OffRouteMine &data, DataModification modType)
|
||||
{
|
||||
Q_UNUSED(modType);
|
||||
if (data.id() == -1)
|
||||
if (data.id == -1)
|
||||
return;
|
||||
|
||||
++m_counterDds.cntOffRouteMine;
|
||||
|
||||
m_dataOffRouteMine = data;
|
||||
qint64 startTimeMsec = -1;
|
||||
if (m_dataOffRouteMine.effectStart().is_set())
|
||||
startTimeMsec = m_dataOffRouteMine.effectStart().get();
|
||||
if (m_dataOffRouteMine.effectStart.is_set())
|
||||
startTimeMsec = m_dataOffRouteMine.effectStart.get();
|
||||
|
||||
DEBUG_LOG(m_logger) << " got changed - m_dataOffRouteMine: " << m_dataOffRouteMine.id() << ", state=" << m_dataOffRouteMine.effectStateId()
|
||||
DEBUG_LOG(m_logger) << " got changed - m_dataOffRouteMine: " << m_dataOffRouteMine.id << ", state=" << m_dataOffRouteMine.effectStateId
|
||||
<< ", startTimeMsec=" << startTimeMsec
|
||||
<< ", cntOffRouteMine=" << m_counterDds.cntOffRouteMine;
|
||||
TRACE_LOG(m_logger) << " got changed - m_dataOffRouteMine: " << m_dataOffRouteMine;
|
||||
@@ -159,15 +159,15 @@ void ModuleTestAesOthers::onAesItemViewChanged(const AesItemView &aesItemView, D
|
||||
if (modType == DataModification::eRemoved)
|
||||
return;
|
||||
|
||||
AreaEffectSimulation::AesType_def::type aesType = aesItemView.aesTypeId().underlying();
|
||||
AreaEffectSimulation::AesType::type aesType = aesItemView.aesTypeId().underlying();
|
||||
DEBUG_LOG(m_logger) << " got onAesItemViewChanged, aesType=" << aesType;
|
||||
|
||||
switch (aesType)
|
||||
{
|
||||
case AreaEffectSimulation::AesType_def::AtBoobyTrap:
|
||||
case AreaEffectSimulation::AesType_def::AtBoobyTrapSecondary:
|
||||
case AreaEffectSimulation::AesType_def::AtOffRouteMine:
|
||||
case AreaEffectSimulation::AesType_def::AtOffRouteMineSecondary:
|
||||
case AreaEffectSimulation::AesType::AtBoobyTrap:
|
||||
case AreaEffectSimulation::AesType::AtBoobyTrapSecondary:
|
||||
case AreaEffectSimulation::AesType::AtOffRouteMine:
|
||||
case AreaEffectSimulation::AesType::AtOffRouteMineSecondary:
|
||||
++m_counterDds.cntItemView;
|
||||
break;
|
||||
default:
|
||||
@@ -215,18 +215,18 @@ void ModuleTestAesOthers::waitForEffectStatesBT(int lineNumber, int durPrep, int
|
||||
}
|
||||
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " waiting for EsPrepared...";
|
||||
if (!waitForData([this]() { return m_dataBoobyTrap.effectStateId() == AreaEffectSimulation::AesEffectState_def::EsPrepared;}, durPrep))
|
||||
if (!waitForData([this]() { return m_dataBoobyTrap.effectStateId == AreaEffectSimulation::AesEffectState::EsPrepared;}, durPrep))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Timeout waiting for EsPrepared of m_dataBoobyTrap with id " << m_dataBoobyTrap.id()
|
||||
ERROR_LOG(m_logger) << "Timeout waiting for EsPrepared of m_dataBoobyTrap with id " << m_dataBoobyTrap.id
|
||||
<< ", lineNumber = " << lineNumber;
|
||||
QVERIFY2(false, "ERROR, exit");
|
||||
return;
|
||||
}
|
||||
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " waiting for EsActivated...";
|
||||
if (!waitForData([this]() { return m_dataBoobyTrap.effectStateId() == AreaEffectSimulation::AesEffectState_def::EsActivated;}, durAct))
|
||||
if (!waitForData([this]() { return m_dataBoobyTrap.effectStateId == AreaEffectSimulation::AesEffectState::EsActivated;}, durAct))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Timeout waiting for EsActivated of m_dataBoobyTrapr with id " << m_dataBoobyTrap.id()
|
||||
ERROR_LOG(m_logger) << "Timeout waiting for EsActivated of m_dataBoobyTrapr with id " << m_dataBoobyTrap.id
|
||||
<< ", lineNumber = " << lineNumber;
|
||||
QVERIFY2(false, "ERROR, exit");
|
||||
return;
|
||||
@@ -235,9 +235,9 @@ void ModuleTestAesOthers::waitForEffectStatesBT(int lineNumber, int durPrep, int
|
||||
if (durExp > 0)
|
||||
{
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " waiting for EsExpired...";
|
||||
if (!waitForData([this]() { return m_dataBoobyTrap.effectStateId() == AreaEffectSimulation::AesEffectState_def::EsExpired;}, durExp))
|
||||
if (!waitForData([this]() { return m_dataBoobyTrap.effectStateId == AreaEffectSimulation::AesEffectState::EsExpired;}, durExp))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Timeout waiting for EsExpired of m_dataBoobyTrap with id " << m_dataBoobyTrap.id()
|
||||
ERROR_LOG(m_logger) << "Timeout waiting for EsExpired of m_dataBoobyTrap with id " << m_dataBoobyTrap.id
|
||||
<< ", lineNumber = " << lineNumber;
|
||||
QVERIFY2(false, "ERROR, exit");
|
||||
return;
|
||||
@@ -255,18 +255,18 @@ void ModuleTestAesOthers::waitForEffectStatesORM(int lineNumber, int durPrep, in
|
||||
}
|
||||
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " waiting for EsPrepared...";
|
||||
if (!waitForData([this]() { return m_dataOffRouteMine.effectStateId() == AreaEffectSimulation::AesEffectState_def::EsPrepared;}, durPrep))
|
||||
if (!waitForData([this]() { return m_dataOffRouteMine.effectStateId == AreaEffectSimulation::AesEffectState::EsPrepared;}, durPrep))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Timeout waiting for EsPrepared of m_dataOffRouteMine with id " << m_dataOffRouteMine.id()
|
||||
ERROR_LOG(m_logger) << "Timeout waiting for EsPrepared of m_dataOffRouteMine with id " << m_dataOffRouteMine.id
|
||||
<< ", lineNumber = " << lineNumber;
|
||||
QVERIFY2(false, "ERROR, exit");
|
||||
return;
|
||||
}
|
||||
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " waiting for EsActivated...";
|
||||
if (!waitForData([this]() { return m_dataOffRouteMine.effectStateId() == AreaEffectSimulation::AesEffectState_def::EsActivated;}, durAct))
|
||||
if (!waitForData([this]() { return m_dataOffRouteMine.effectStateId == AreaEffectSimulation::AesEffectState::EsActivated;}, durAct))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Timeout waiting for EsActivated of m_dataOffRouteMine with id " << m_dataOffRouteMine.id()
|
||||
ERROR_LOG(m_logger) << "Timeout waiting for EsActivated of m_dataOffRouteMine with id " << m_dataOffRouteMine.id
|
||||
<< ", lineNumber = " << lineNumber;
|
||||
QVERIFY2(false, "ERROR, exit");
|
||||
return;
|
||||
@@ -275,9 +275,9 @@ void ModuleTestAesOthers::waitForEffectStatesORM(int lineNumber, int durPrep, in
|
||||
if (durExp > 0)
|
||||
{
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " waiting for EsExpired...";
|
||||
if (!waitForData([this]() { return m_dataOffRouteMine.effectStateId() == AreaEffectSimulation::AesEffectState_def::EsExpired;}, durExp))
|
||||
if (!waitForData([this]() { return m_dataOffRouteMine.effectStateId == AreaEffectSimulation::AesEffectState::EsExpired;}, durExp))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Timeout waiting for EsExpired of m_dataOffRouteMine with id " << m_dataOffRouteMine.id()
|
||||
ERROR_LOG(m_logger) << "Timeout waiting for EsExpired of m_dataOffRouteMine with id " << m_dataOffRouteMine.id
|
||||
<< ", lineNumber = " << lineNumber;
|
||||
QVERIFY2(false, "ERROR, exit");
|
||||
return;
|
||||
@@ -296,8 +296,8 @@ void ModuleTestAesOthers::setupParticipants()
|
||||
ParticipantManagement::SetSimulatedPosition req;
|
||||
|
||||
{
|
||||
req.participantId(18); // according testDB
|
||||
req.onlyOutdatedParticipants(false);
|
||||
req.participantId = 18; // according testDB
|
||||
req.onlyOutdatedParticipants = false;
|
||||
|
||||
const LtsCoordTrans::UtmCoordinate &utmPos =
|
||||
LtsCoordTrans::UtmCoordinate::fromMgrs(QStringLiteral("32UPD7690018100")); // 32U PD 76900 18100
|
||||
@@ -323,7 +323,7 @@ bool ModuleTestAesOthers::checkParticipant_18()
|
||||
// soll: QStringLiteral("32UPD7690018000")); // 32U PD 76900 18000
|
||||
const int partId = 18;
|
||||
const ParticipantManagement::ParticipantPosition &pos = m_ppmDtc->participantPosition(partId);
|
||||
QString mgrsStr = LtsCoordTrans::mgrsFromGeographic(pos.pos().lon(), pos.pos().lat());
|
||||
QString mgrsStr = LtsCoordTrans::mgrsFromGeographic(pos.pos.lon, pos.pos.lat);
|
||||
INFO_LOG(m_logger) << " for partId = '" << partId << "', we got position: " << mgrsStr;
|
||||
|
||||
return mgrsStr == QStringLiteral("32U PD 76900 18100");
|
||||
@@ -337,8 +337,8 @@ bool ModuleTestAesOthers::tryRemoveOldBoobyTraps()
|
||||
|
||||
for (const auto &bt : btMap)
|
||||
{
|
||||
qCritical() << " bt.name" << bt.name().c_str();
|
||||
int ret = m_aesFtc->boobyTrapRemoveRequest(Core::RemoveElementRequest(bt.id()));
|
||||
qCritical() << " bt.name" << bt.name.c_str();
|
||||
int ret = m_aesFtc->boobyTrapRemoveRequest(Core::RemoveElementRequest(bt.id));
|
||||
qCritical() << " bt.name -> " << ret;
|
||||
}
|
||||
return true;
|
||||
@@ -347,17 +347,17 @@ bool ModuleTestAesOthers::tryRemoveOldBoobyTraps()
|
||||
|
||||
int ModuleTestAesOthers::doBoobyTrapModifyRequest(const BoobyTrap &btData)
|
||||
{
|
||||
BoobyTrapModifyRequest req(btData.id(),
|
||||
btData.name(),
|
||||
btData.effectDuration(),
|
||||
btData.chargeStruct().chargeTypeId(),
|
||||
btData.impactPosition(),
|
||||
btData.impactRadius(),
|
||||
btData.triggerRadius(),
|
||||
btData.rotationAngle(),
|
||||
btData.centralAngle(),
|
||||
btData.effectStart(),
|
||||
btData.partyId()
|
||||
BoobyTrapModifyRequest req(btData.id,
|
||||
btData.name,
|
||||
btData.effectDuration,
|
||||
btData.chargeStruct.chargeTypeId,
|
||||
btData.impactPosition,
|
||||
btData.impactRadius,
|
||||
btData.triggerRadius,
|
||||
btData.rotationAngle,
|
||||
btData.centralAngle,
|
||||
btData.effectStart,
|
||||
btData.partyId
|
||||
);
|
||||
|
||||
int ret = m_aesFtc->boobyTrapModifyRequest(req, this);
|
||||
@@ -366,14 +366,14 @@ int ModuleTestAesOthers::doBoobyTrapModifyRequest(const BoobyTrap &btData)
|
||||
|
||||
int ModuleTestAesOthers::doOffRouteMineModifyRequest(const OffRouteMine &offRouteMine)
|
||||
{
|
||||
OffRouteMineModifyRequest req(offRouteMine.id(),
|
||||
offRouteMine.name(),
|
||||
offRouteMine.effectDuration(),
|
||||
offRouteMine.chargeStruct().chargeTypeId(),
|
||||
offRouteMine.area(),
|
||||
offRouteMine.impactRadius(),
|
||||
offRouteMine.effectStart(),
|
||||
offRouteMine.partyId()
|
||||
OffRouteMineModifyRequest req(offRouteMine.id,
|
||||
offRouteMine.name,
|
||||
offRouteMine.effectDuration,
|
||||
offRouteMine.chargeStruct.chargeTypeId,
|
||||
offRouteMine.area,
|
||||
offRouteMine.impactRadius,
|
||||
offRouteMine.effectStart,
|
||||
offRouteMine.partyId
|
||||
);
|
||||
|
||||
int ret = m_aesFtc->offRouteMineModifyRequest(req, this);
|
||||
@@ -384,8 +384,8 @@ int ModuleTestAesOthers::doMoveParticipant(int participantId, const QString &new
|
||||
{
|
||||
ParticipantManagement::SetSimulatedPosition req;
|
||||
{
|
||||
req.participantId(participantId); // according testDB
|
||||
req.onlyOutdatedParticipants(false);
|
||||
req.participantId = participantId; // according testDB
|
||||
req.onlyOutdatedParticipants = false;
|
||||
|
||||
const LtsCoordTrans::UtmCoordinate &utmPos =
|
||||
LtsCoordTrans::UtmCoordinate::fromMgrs(newPositionMGRS); // 32U PD 76900 18100
|
||||
@@ -481,8 +481,8 @@ void ModuleTestAesOthers::initTestCase()
|
||||
std::cout << " waitForHistoricalDataExercise... Done" << std::endl;
|
||||
|
||||
const ExerciseManagement::Exercise &exercise = m_exmDtc->exercise(m_exerciseId);
|
||||
QVERIFY2(exercise.id() == m_exerciseId, "ERROR, exercise failed!!");
|
||||
m_traingAreaId = exercise.trainingAreaId();
|
||||
QVERIFY2(exercise.id == m_exerciseId, "ERROR, exercise failed!!");
|
||||
m_traingAreaId = exercise.trainingAreaId;
|
||||
|
||||
std::cout << " ExerciseManagement"
|
||||
<< ", m_traingAreaId = " << m_traingAreaId << std::endl;
|
||||
@@ -549,22 +549,22 @@ void ModuleTestAesOthers::test_boobyTrap_01()
|
||||
QVERIFY2(checkParticipant_18(), "ERROR, checkParticipant_5 failed!!");
|
||||
|
||||
AreaEffectSimulation::BoobyTrap bt;
|
||||
bt.id(0);
|
||||
bt.name(QString(QStringLiteral("ModuleTest_BoobyTrap01")).toStdString());
|
||||
bt.chargeStruct().chargeTypeId(252);
|
||||
bt.effectDuration(60000);
|
||||
bt.partyId(2);
|
||||
bt.impactRadius(10);
|
||||
bt.triggerRadius(5);
|
||||
bt.id = 0;
|
||||
bt.name = QString(QStringLiteral("ModuleTest_BoobyTrap01")).toStdString();
|
||||
bt.chargeStruct.chargeTypeId = 252;
|
||||
bt.effectDuration = 60000;
|
||||
bt.partyId = 2;
|
||||
bt.impactRadius = 10;
|
||||
bt.triggerRadius = 5;
|
||||
|
||||
// Type1 == SchAbwMi ohne rotationAngle, centralAngle
|
||||
// Type2 == SchAbwRiMi mit rotationAngle, centralAngle
|
||||
|
||||
|
||||
LtsCoordinate lts = LtsCoordinate::fromUtmCoordinate(UtmCoordinate::fromMgrs(QStringLiteral("32U PD 77000 18100")), 0.0);
|
||||
bt.impactPosition(lts.geoPosition2D());
|
||||
bt.impactPosition = lts.geoPosition2D();
|
||||
|
||||
bt.effectStart((time(nullptr) + 10) * 1000); // msec
|
||||
bt.effectStart = (time(nullptr) + 10) * 1000; // msec
|
||||
|
||||
m_replyError = true;
|
||||
m_dataBoobyTrap = AreaEffectSimulation::BoobyTrap();
|
||||
@@ -573,7 +573,7 @@ void ModuleTestAesOthers::test_boobyTrap_01()
|
||||
QVERIFY2(ret != 0, "ERROR, doBoobyTrapModifyRequest failed!!");
|
||||
|
||||
waitForEffectStatesBT(__LINE__, 5, 15, 0); // do _not_ wait for expired!
|
||||
QVERIFY2(m_dataBoobyTrap.effectStateId() == AreaEffectSimulation::AesEffectState_def::EsActivated, "ERROR, effectStateId failed!!");
|
||||
QVERIFY2(m_dataBoobyTrap.effectStateId == AreaEffectSimulation::AesEffectState::EsActivated, "ERROR, effectStateId failed!!");
|
||||
dumpCnt();
|
||||
QVERIFY2(m_counterDds.cntBoobyTrap == 2, "ERROR, cnt failed!!"); // EsPrepared, EsActivated,
|
||||
QVERIFY2(m_counterDds.cntItemView == 4, "ERROR, cnt failed!!"); //
|
||||
@@ -588,9 +588,9 @@ void ModuleTestAesOthers::test_boobyTrap_01()
|
||||
doMoveParticipant(18, QStringLiteral("32U PD 77002 18103"));
|
||||
|
||||
// wait until expired:
|
||||
waitForData([this]() { return m_dataBoobyTrap.effectStateId() == AreaEffectSimulation::AesEffectState_def::EsExpired; }, 60);
|
||||
waitForData([this]() { return m_dataBoobyTrap.effectStateId == AreaEffectSimulation::AesEffectState::EsExpired; }, 60);
|
||||
|
||||
QVERIFY2(m_dataBoobyTrap.effectStateId() == AreaEffectSimulation::AesEffectState_def::EsExpired, "ERROR, effectStateId failed!!");
|
||||
QVERIFY2(m_dataBoobyTrap.effectStateId == AreaEffectSimulation::AesEffectState::EsExpired, "ERROR, effectStateId failed!!");
|
||||
|
||||
// wait to let it disappear:
|
||||
waitForData([]() { return false; }, 15);
|
||||
@@ -619,22 +619,22 @@ void ModuleTestAesOthers::test_boobyTrap_02_IMPL(const QString &name,
|
||||
QVERIFY2(checkParticipant_18(), "ERROR, checkParticipant_5 failed!!");
|
||||
|
||||
AreaEffectSimulation::BoobyTrap bt;
|
||||
bt.id(0);
|
||||
bt.name(name.toStdString());
|
||||
bt.chargeStruct().chargeTypeId(252);
|
||||
bt.effectDuration(600000);
|
||||
bt.partyId(2);
|
||||
bt.impactRadius(10);
|
||||
bt.triggerRadius(5);
|
||||
bt.id = 0;
|
||||
bt.name = name.toStdString();
|
||||
bt.chargeStruct.chargeTypeId = 252;
|
||||
bt.effectDuration = 600000;
|
||||
bt.partyId = 2;
|
||||
bt.impactRadius = 10;
|
||||
bt.triggerRadius = 5;
|
||||
|
||||
bt.impactPosition(impactCoord.geoPosition());
|
||||
bt.impactPosition = impactCoord.geoPosition();
|
||||
|
||||
// Type1 == SchAbwMi ohne rotationAngle, centralAngle
|
||||
// Type2 == SchAbwRiMi mit rotationAngle, centralAngle
|
||||
bt.rotationAngle(toOptional(rotationAngle)); // Q1: 30
|
||||
bt.centralAngle(toOptional(90.0));
|
||||
bt.rotationAngle = toOptional(rotationAngle); // Q1: 30
|
||||
bt.centralAngle = toOptional(90.0);
|
||||
|
||||
bt.effectStart((time(nullptr) + 10) * 1000); // msec
|
||||
bt.effectStart = (time(nullptr) + 10) * 1000; // msec
|
||||
|
||||
m_replyError = true;
|
||||
m_dataBoobyTrap = AreaEffectSimulation::BoobyTrap();
|
||||
@@ -643,7 +643,7 @@ void ModuleTestAesOthers::test_boobyTrap_02_IMPL(const QString &name,
|
||||
QVERIFY2(ret != 0, "ERROR, doBoobyTrapModifyRequest failed!!");
|
||||
|
||||
waitForEffectStatesBT(__LINE__, 5, 15, 0); // do _not_ wait for expired!
|
||||
QVERIFY2(m_dataBoobyTrap.effectStateId() == AreaEffectSimulation::AesEffectState_def::EsActivated, "ERROR, m_dataBoobyTrap effectStateId failed!!");
|
||||
QVERIFY2(m_dataBoobyTrap.effectStateId == AreaEffectSimulation::AesEffectState::EsActivated, "ERROR, m_dataBoobyTrap effectStateId failed!!");
|
||||
dumpCnt();
|
||||
QVERIFY2(m_counterDds.cntBoobyTrap == 2, "ERROR, cnt failed!!"); // EsPrepared, EsActivated,
|
||||
QVERIFY2(m_counterDds.cntItemView == 4, "ERROR, cnt failed!!"); //
|
||||
@@ -660,9 +660,9 @@ void ModuleTestAesOthers::test_boobyTrap_02_IMPL(const QString &name,
|
||||
doMoveParticipant(18, particpantCoord.mgrs());
|
||||
|
||||
// wait until expired:
|
||||
waitForData([this]() { return m_dataBoobyTrap.effectStateId() == AreaEffectSimulation::AesEffectState_def::EsExpired; }, 60);
|
||||
waitForData([this]() { return m_dataBoobyTrap.effectStateId == AreaEffectSimulation::AesEffectState::EsExpired; }, 60);
|
||||
|
||||
QVERIFY2(m_dataBoobyTrap.effectStateId() == AreaEffectSimulation::AesEffectState_def::EsExpired, "ERROR, effectStateId failed!!");
|
||||
QVERIFY2(m_dataBoobyTrap.effectStateId == AreaEffectSimulation::AesEffectState::EsExpired, "ERROR, effectStateId failed!!");
|
||||
|
||||
// wait to let it disappear:
|
||||
waitForData([]() { return false; }, 15);
|
||||
@@ -721,21 +721,21 @@ void ModuleTestAesOthers::test_offRouteMine_02()
|
||||
// offRouteMine2 = 254; // MIT impactRadius
|
||||
|
||||
AreaEffectSimulation::OffRouteMine orm;
|
||||
orm.id(0);
|
||||
orm.name(QString(QStringLiteral("test_offRouteMine_02")).toStdString());
|
||||
orm.chargeStruct().chargeTypeId(254);
|
||||
orm.effectDuration(600000);
|
||||
orm.partyId(2);
|
||||
orm.impactRadius(10); // 254 -> MIT impactRadius -> mit 3DSphere/Kugel
|
||||
orm.id = 0;
|
||||
orm.name = QString(QStringLiteral("test_offRouteMine_02")).toStdString();
|
||||
orm.chargeStruct.chargeTypeId = 254;
|
||||
orm.effectDuration = 600000;
|
||||
orm.partyId = 2;
|
||||
orm.impactRadius = 10; // 254 -> MIT impactRadius -> mit 3DSphere/Kugel
|
||||
|
||||
const LtsCoordinate &coord =
|
||||
LtsCoordinate::fromUtmCoordinate(UtmCoordinate::fromMgrs(QStringLiteral("32U PD 77000 18100")), 0.0);
|
||||
orm.area().cornerBottomLeft(coord.geoPosition());
|
||||
orm.area().height(50);
|
||||
orm.area().width(1);
|
||||
orm.area().rotation(85);
|
||||
orm.area.cornerBottomLeft = coord.geoPosition();
|
||||
orm.area.height = 50;
|
||||
orm.area.width = 1;
|
||||
orm.area.rotation = 85;
|
||||
|
||||
orm.effectStart((time(nullptr) + 10) * 1000); // msec
|
||||
orm.effectStart = (time(nullptr) + 10) * 1000; // msec
|
||||
|
||||
m_replyError = true;
|
||||
m_dataOffRouteMine = AreaEffectSimulation::OffRouteMine();
|
||||
@@ -744,7 +744,7 @@ void ModuleTestAesOthers::test_offRouteMine_02()
|
||||
QVERIFY2(ret != 0, "ERROR, doOffRouteMineModifyRequest failed!!");
|
||||
|
||||
waitForEffectStatesORM(__LINE__, 5, 15, 0); // do _not_ wait for expired!
|
||||
QVERIFY2(m_dataOffRouteMine.effectStateId() == AreaEffectSimulation::AesEffectState_def::EsActivated, "ERROR, effectStateId failed!!");
|
||||
QVERIFY2(m_dataOffRouteMine.effectStateId == AreaEffectSimulation::AesEffectState::EsActivated, "ERROR, effectStateId failed!!");
|
||||
dumpCnt();
|
||||
QVERIFY2(m_counterDds.cntOffRouteMine == 2, "ERROR, cnt failed!!"); // EsPrepared, EsActivated,
|
||||
QVERIFY2(m_counterDds.cntItemView == 4, "ERROR, cnt failed!!"); //
|
||||
@@ -761,13 +761,13 @@ void ModuleTestAesOthers::test_offRouteMine_02()
|
||||
doMoveParticipant(18, QStringLiteral("32U PD 77020 18095"));
|
||||
|
||||
// wait until expired:
|
||||
waitForData([this]() { return m_dataOffRouteMine.effectStateId() == AreaEffectSimulation::AesEffectState_def::EsExpired; }, 60);
|
||||
waitForData([this]() { return m_dataOffRouteMine.effectStateId == AreaEffectSimulation::AesEffectState::EsExpired; }, 60);
|
||||
|
||||
QVERIFY2(m_dataOffRouteMine.effectStateId() == AreaEffectSimulation::AesEffectState_def::EsExpired, "ERROR, m_dataOffRouteMine effectStateId failed!!");
|
||||
QVERIFY2(m_dataOffRouteMine.effectStateId == AreaEffectSimulation::AesEffectState::EsExpired, "ERROR, m_dataOffRouteMine effectStateId failed!!");
|
||||
|
||||
// wait to let it disappear:
|
||||
waitForData([]() { return false; }, 15);
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " END" << ", name =" << orm.name() << "'";
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " END" << ", name =" << orm.name << "'";
|
||||
}
|
||||
|
||||
void ModuleTestAesOthers::cleanupTestCase()
|
||||
|
||||
+1
-1
@@ -138,7 +138,7 @@ void TestAirSupportImpact::tryModify()
|
||||
{
|
||||
INFO_LOG(m_logger) << "trying to send modify request";
|
||||
m_asData.name("chris2");
|
||||
m_asData.effectStart(m_asData.effectStart().get() + 2000);
|
||||
m_asData.effectStart(m_asData.effectStart.get() + 2000);
|
||||
m_asData.chargeStruct().chargeTypeId(s_ChargeTypeId2);
|
||||
m_asData.impactPosition(Core::GeoPosition2D(0.15525, 0.92607));
|
||||
m_asData.partyId(8);
|
||||
|
||||
+11
-11
@@ -22,7 +22,7 @@ TestBase::TestBase(const char *loggerName, QObject *parent)
|
||||
, m_replyError(false)
|
||||
, m_bTestsSuccessful(true)
|
||||
, m_testId(0)
|
||||
, m_aesTypeName(QString::fromLatin1(loggerName).splitRef(QLatin1Char('.')).last().toString())
|
||||
, m_aesTypeName(QString::fromLatin1(loggerName).split(QLatin1Char('.')).last().toString())
|
||||
, m_logger(getLogger(loggerName))
|
||||
{}
|
||||
|
||||
@@ -65,29 +65,29 @@ bool TestBase::waitForData(const std::function<bool()> &func)
|
||||
bool TestBase::checkAesItem(const AreaEffectSimulation::AesItem &a,
|
||||
const AreaEffectSimulation::AesItem &b) const
|
||||
{
|
||||
if (a.name() != b.name())
|
||||
if (a.name != b.name)
|
||||
{
|
||||
WARNING_LOG(m_logger) << "name does not match: " << a.name() << " - " << b.name();
|
||||
WARNING_LOG(m_logger) << "name does not match: " << a.name << " - " << b.name;
|
||||
return false;
|
||||
}
|
||||
if (a.effectStart() != b.effectStart())
|
||||
if (a.effectStart != b.effectStart)
|
||||
{
|
||||
WARNING_LOG(m_logger) << "effectStart does not match: " << a.effectStart() << " - " << b.effectStart();
|
||||
WARNING_LOG(m_logger) << "effectStart does not match: " << a.effectStart << " - " << b.effectStart;
|
||||
return false;
|
||||
}
|
||||
if (a.chargeStruct().chargeTypeId() != b.chargeStruct().chargeTypeId())
|
||||
if (a.chargeStruct.chargeTypeId != b.chargeStruct.chargeTypeId)
|
||||
{
|
||||
WARNING_LOG(m_logger) << "chargeTypeId does not match: " << a.chargeStruct().chargeTypeId() << " - " << b.chargeStruct().chargeTypeId();
|
||||
WARNING_LOG(m_logger) << "chargeTypeId does not match: " << a.chargeStruct.chargeTypeId << " - " << b.chargeStruct.chargeTypeId;
|
||||
return false;
|
||||
}
|
||||
if (a.partyId() != b.partyId())
|
||||
if (a.partyId != b.partyId)
|
||||
{
|
||||
WARNING_LOG(m_logger) << "partyId does not match: " << a.partyId() << " - " << b.partyId();
|
||||
WARNING_LOG(m_logger) << "partyId does not match: " << a.partyId << " - " << b.partyId;
|
||||
return false;
|
||||
}
|
||||
if (a.participantId() != b.participantId())
|
||||
if (a.participantId != b.participantId)
|
||||
{
|
||||
WARNING_LOG(m_logger) << "participantId does not match: " << a.participantId() << " - " << b.participantId();
|
||||
WARNING_LOG(m_logger) << "participantId does not match: " << a.participantId << " - " << b.participantId;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
+1
-1
@@ -166,7 +166,7 @@ void TestBCContamination::tryModifyBCContamination()
|
||||
{
|
||||
INFO_LOG(m_logger) << "trying to send modify request";
|
||||
m_bcData.name("chris2");
|
||||
m_bcData.effectStart(m_bcData.effectStart().get() + 2000);
|
||||
m_bcData.effectStart(m_bcData.effectStart.get() + 2000);
|
||||
m_bcData.effectDuration(3200); // msec
|
||||
m_bcData.chargeStruct().chargeTypeId(s_ChargeTypeId2);
|
||||
m_bcData.impactPosition(Core::GeoPosition2D(0.17, 0.93));
|
||||
|
||||
+17
-17
@@ -89,10 +89,10 @@ void TestBoobyTrap::tryCreateBoobyTrap()
|
||||
btData.impactPosition(),
|
||||
btData.impactRadius(),
|
||||
btData.triggerRadius(),
|
||||
btData.rotationAngle().get(),
|
||||
btData.centralAngle().get(),
|
||||
btData.effectStart().get(),
|
||||
btData.partyId().get()),
|
||||
btData.rotationAngle.get(),
|
||||
btData.centralAngle.get(),
|
||||
btData.effectStart.get(),
|
||||
btData.partyId.get()),
|
||||
this))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Error during BoobyTrapCreateRequest()";
|
||||
@@ -122,10 +122,10 @@ void TestBoobyTrap::tryCreateBoobyTrap()
|
||||
btData.impactPosition(),
|
||||
btData.impactRadius(),
|
||||
btData.triggerRadius(),
|
||||
btData.rotationAngle().get(),
|
||||
btData.centralAngle().get(),
|
||||
btData.effectStart().get(),
|
||||
btData.partyId().get()),
|
||||
btData.rotationAngle.get(),
|
||||
btData.centralAngle.get(),
|
||||
btData.effectStart.get(),
|
||||
btData.partyId.get()),
|
||||
this))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Error during BoobyTrapCreateRequest()";
|
||||
@@ -153,7 +153,7 @@ void TestBoobyTrap::tryModifyBoobyTrap()
|
||||
{
|
||||
INFO_LOG(m_logger) << "trying to send modify request";
|
||||
m_btData.name("Booby Trap 2");
|
||||
m_btData.effectStart(m_btData.effectStart().get() + 2000);
|
||||
m_btData.effectStart(m_btData.effectStart.get() + 2000);
|
||||
m_btData.effectDuration(3200); // msec
|
||||
m_btData.chargeStruct().chargeTypeId(s_ChargeTypeId2);
|
||||
m_btData.impactPosition(Core::GeoPosition2D(0.1547, 0.926));
|
||||
@@ -173,10 +173,10 @@ void TestBoobyTrap::tryModifyBoobyTrap()
|
||||
btData.impactPosition(),
|
||||
btData.impactRadius(),
|
||||
btData.triggerRadius(),
|
||||
btData.rotationAngle().get(),
|
||||
btData.centralAngle().get(),
|
||||
btData.effectStart().get(),
|
||||
btData.partyId().get()),
|
||||
btData.rotationAngle.get(),
|
||||
btData.centralAngle.get(),
|
||||
btData.effectStart.get(),
|
||||
btData.partyId.get()),
|
||||
this))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Error requesting modify data";
|
||||
@@ -252,10 +252,10 @@ void TestBoobyTrap::tryRemoveBoobyTrap()
|
||||
btData.impactPosition(),
|
||||
btData.impactRadius(),
|
||||
btData.triggerRadius(),
|
||||
btData.rotationAngle().get(),
|
||||
btData.centralAngle().get(),
|
||||
btData.effectStart().get(),
|
||||
btData.partyId().get()),
|
||||
btData.rotationAngle.get(),
|
||||
btData.centralAngle.get(),
|
||||
btData.effectStart.get(),
|
||||
btData.partyId.get()),
|
||||
this))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Error during BoobyTrapModifyRequest()";
|
||||
|
||||
+1
-1
@@ -167,7 +167,7 @@ void TestExplosionArea::tryModifyExplosionArea()
|
||||
{
|
||||
INFO_LOG(m_logger) << "tryModifyExplosionArea start";
|
||||
m_eaData.name("af2");
|
||||
m_eaData.effectStart(m_eaData.effectStart().get() + 3000);
|
||||
m_eaData.effectStart(m_eaData.effectStart.get() + 3000);
|
||||
m_eaData.effectDuration(9000); // 9 sec
|
||||
m_eaData.chargeStruct().chargeTypeId(s_ChargeTypeId2);
|
||||
m_eaData.area(AreaEffectSimulation::Area(Core::GeoPosition2D(0.165, 0.921), 50, 60, 70));
|
||||
|
||||
+1
-1
@@ -148,7 +148,7 @@ void TestExplosionAreaBulk::tryModifyExplosionArea()
|
||||
{
|
||||
INFO_LOG(m_logger) << "tryModifyExplosionArea start";
|
||||
m_eaData.name("af2");
|
||||
m_eaData.effectStart(m_eaData.effectStart().get() + 3000);
|
||||
m_eaData.effectStart(m_eaData.effectStart.get() + 3000);
|
||||
m_eaData.effectDuration(9000); // 9 sec
|
||||
m_eaData.chargeStruct().chargeTypeId(s_ChargeTypeId2);
|
||||
m_eaData.area(AreaEffectSimulation::Area(Core::GeoPosition2D(0.165, 0.921), 50, 60, 70));
|
||||
|
||||
+2
-2
@@ -69,7 +69,7 @@ void TestExplosionCluster::tryCreateExplosionCluster()
|
||||
eaData.effectStart((time(nullptr) + 30) * 1000); // msec
|
||||
|
||||
QString name(QStringLiteral("ec__"));
|
||||
name += QString::number(eaData.effectStart().get());
|
||||
name += QString::number(eaData.effectStart.get());
|
||||
eaData.name(name.toStdString());
|
||||
|
||||
eaData.effectDuration(10000); // 10 seconds
|
||||
@@ -214,7 +214,7 @@ void TestExplosionCluster::tryModifyExplosionCluster()
|
||||
{
|
||||
INFO_LOG(m_logger) << "tryModifyExplosionCluster start";
|
||||
m_ecData.name("af2");
|
||||
m_ecData.effectStart(m_ecData.effectStart().get() + 3000);
|
||||
m_ecData.effectStart(m_ecData.effectStart.get() + 3000);
|
||||
m_ecData.effectDuration(9000); // 9 sec
|
||||
m_ecData.chargeTypeId(s_ChargeTypeId2);
|
||||
|
||||
|
||||
+1
-1
@@ -147,7 +147,7 @@ void TestExplosionSingle::tryModifyExplosionSingle()
|
||||
{
|
||||
INFO_LOG(m_logger) << "trying to send modify request";
|
||||
m_esData.name("chris2");
|
||||
m_esData.effectStart(m_esData.effectStart().get() + 2000);
|
||||
m_esData.effectStart(m_esData.effectStart.get() + 2000);
|
||||
m_esData.chargeStruct().chargeTypeId(s_ChargeTypeId2);
|
||||
m_esData.impactPosition(Core::GeoPosition2D(0.17, 0.93));
|
||||
m_esData.partyId(3);
|
||||
|
||||
+2
-2
@@ -433,7 +433,7 @@ void TestMineArea::tryModifyMineArea()
|
||||
{
|
||||
INFO_LOG(m_logger) << "trying to send modify request";
|
||||
m_maData.name("chris2");
|
||||
m_maData.effectStart(m_maData.effectStart().get() + 2000);
|
||||
m_maData.effectStart(m_maData.effectStart.get() + 2000);
|
||||
m_maData.chargeStruct().chargeTypeId(s_ChargeTypeId2);
|
||||
m_maData.effectDuration(4 * 1000);
|
||||
m_maData.density(0.2);
|
||||
@@ -645,7 +645,7 @@ void TestMineArea::tryTriggerDusMineInBoth()
|
||||
|
||||
INFO_LOG(m_logger) << "trying to send mineTriggeredRequest()";
|
||||
m_replyError = true;
|
||||
if (!m_ftc->mineTriggeredRequest(MineTriggeredRequest(mtr.mineAreaId(), mtr.mineId(), mtr.position().get(), mtr.chargeTypeId().get()), this))
|
||||
if (!m_ftc->mineTriggeredRequest(MineTriggeredRequest(mtr.mineAreaId(), mtr.mineId(), mtr.position.get(), mtr.chargeTypeId.get()), this))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Error during mineTriggeredRequest()";
|
||||
failExit();
|
||||
|
||||
+13
-13
@@ -87,9 +87,9 @@ void TestOffRouteMine::tryCreateOffRouteMine()
|
||||
ormData.effectDuration(),
|
||||
ormData.chargeStruct().chargeTypeId(),
|
||||
ormData.area(),
|
||||
ormData.impactRadius().get(),
|
||||
ormData.effectStart().get(),
|
||||
ormData.partyId().get()),
|
||||
ormData.impactRadius.get(),
|
||||
ormData.effectStart.get(),
|
||||
ormData.partyId.get()),
|
||||
this))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Error during OffRouteMineCreateRequest()";
|
||||
@@ -117,9 +117,9 @@ void TestOffRouteMine::tryCreateOffRouteMine()
|
||||
ormData.effectDuration(),
|
||||
ormData.chargeStruct().chargeTypeId(),
|
||||
ormData.area(),
|
||||
ormData.impactRadius().get(),
|
||||
ormData.effectStart().get(),
|
||||
ormData.partyId().get()),
|
||||
ormData.impactRadius.get(),
|
||||
ormData.effectStart.get(),
|
||||
ormData.partyId.get()),
|
||||
this))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Error during OffRouteMineCreateRequest()";
|
||||
@@ -147,7 +147,7 @@ void TestOffRouteMine::tryModifyOffRouteMine()
|
||||
{
|
||||
INFO_LOG(m_logger) << "trying to send modify request";
|
||||
m_ormData.name("OffRouteMine 2");
|
||||
m_ormData.effectStart(m_ormData.effectStart().get() + 2000);
|
||||
m_ormData.effectStart(m_ormData.effectStart.get() + 2000);
|
||||
m_ormData.effectDuration(3200); // msec
|
||||
m_ormData.chargeStruct().chargeTypeId(s_ChargeTypeId2);
|
||||
m_ormData.area().cornerBottomLeft(Core::GeoPosition2D(0.154, 0.926));
|
||||
@@ -168,9 +168,9 @@ void TestOffRouteMine::tryModifyOffRouteMine()
|
||||
ormData.effectDuration(),
|
||||
ormData.chargeStruct().chargeTypeId(),
|
||||
ormData.area(),
|
||||
ormData.impactRadius().get(),
|
||||
ormData.effectStart().get(),
|
||||
ormData.partyId().get()),
|
||||
ormData.impactRadius.get(),
|
||||
ormData.effectStart.get(),
|
||||
ormData.partyId.get()),
|
||||
this))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Error requesting modify data";
|
||||
@@ -243,9 +243,9 @@ void TestOffRouteMine::tryRemoveOffRouteMine()
|
||||
ormData.effectDuration(),
|
||||
ormData.chargeStruct().chargeTypeId(),
|
||||
ormData.area(),
|
||||
ormData.impactRadius().get(),
|
||||
ormData.effectStart().get(),
|
||||
ormData.partyId().get()),
|
||||
ormData.impactRadius.get(),
|
||||
ormData.effectStart.get(),
|
||||
ormData.partyId.get()),
|
||||
this))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Error during OffRouteMineModifyRequest()";
|
||||
|
||||
+18
-18
@@ -59,7 +59,7 @@ bool RecordReplayPluginCustom::setReplayStartTime(NSqlQuery &q, qint64 startTime
|
||||
{
|
||||
for (const auto &valie : copyTW.values(key))
|
||||
{
|
||||
if (valie.trajectoryStartTime() < startTime - 210*1000)
|
||||
if (valie.trajectoryStartTime < startTime - 210*1000)
|
||||
{
|
||||
m_trajectoryTimeAwareMap.remove(key, valie);
|
||||
}
|
||||
@@ -264,7 +264,7 @@ bool RecordReplayPluginCustom::setReplayStartTime(NSqlQuery &q, qint64 startTime
|
||||
{
|
||||
for (const auto &valie : copyTI.values(key))
|
||||
{
|
||||
if (valie.sampleTime() < startTime - 210*1000)
|
||||
if (valie.sampleTime < startTime - 210*1000)
|
||||
m_triggeredImpactsMap.remove(key, valie);
|
||||
}
|
||||
}
|
||||
@@ -295,7 +295,7 @@ bool RecordReplayPluginCustom::setReplayStartTime(NSqlQuery &q, qint64 startTime
|
||||
{
|
||||
for (const auto &valie : copy.values(key))
|
||||
{
|
||||
if( m_explosionClusterKeys.find(valie.aesItemId()) != m_explosionClusterKeys.end())
|
||||
if( m_explosionClusterKeys.find(valie.aesItemId) != m_explosionClusterKeys.end())
|
||||
{
|
||||
m_effectsMap.remove(key, valie);
|
||||
continue;
|
||||
@@ -316,34 +316,34 @@ bool RecordReplayPluginCustom::setReplayStartTime(NSqlQuery &q, qint64 startTime
|
||||
{
|
||||
for (const auto &value : copy.values(key))
|
||||
{
|
||||
if (value.effectStateId() == AreaEffectSimulation::AesEffectState_def::EsCreated
|
||||
|| value.effectStateId() == AreaEffectSimulation::AesEffectState_def::EsFired
|
||||
|| value.effectStateId() == AreaEffectSimulation::AesEffectState_def::EsReceived
|
||||
|| value.effectStateId() == AreaEffectSimulation::AesEffectState_def::EsPrepared
|
||||
|| value.effectStateId() == AreaEffectSimulation::AesEffectState_def::EsActivated
|
||||
if (value.effectStateId == AreaEffectSimulation::AesEffectState::EsCreated
|
||||
|| value.effectStateId == AreaEffectSimulation::AesEffectState::EsFired
|
||||
|| value.effectStateId == AreaEffectSimulation::AesEffectState::EsReceived
|
||||
|| value.effectStateId == AreaEffectSimulation::AesEffectState::EsPrepared
|
||||
|| value.effectStateId == AreaEffectSimulation::AesEffectState::EsActivated
|
||||
)
|
||||
continue;
|
||||
|
||||
// check regarding _Explosion_Cluster
|
||||
{
|
||||
static QVector<AesType_def::type> relavantAesTypeIds = {AesType_def::AtExplosionClusterGunToTargetLine, AesType_def::AtExplosionClusterSingleTrajectory};
|
||||
if (relavantAesTypeIds.contains(value.aesTypeId().underlying()))
|
||||
static QVector<AesType> relavantAesTypeIds = {AesType::AtExplosionClusterGunToTargetLine, AesType::AtExplosionClusterSingleTrajectory};
|
||||
if (relavantAesTypeIds.contains(value.aesTypeId))
|
||||
{
|
||||
if (m_explosionClusterKeys.find(value.aesItemId()) != m_explosionClusterKeys.end() ) //contains not available until cpp 20
|
||||
if (m_explosionClusterKeys.find(value.aesItemId) != m_explosionClusterKeys.end() ) //contains not available until cpp 20
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// E01562-E343 EffectCluster: GunToTargetLines fehlen im Replay&Snapshot
|
||||
{
|
||||
static QVector<AesType_def::type> relavantAesTypeIds = {AesType_def::AtEffectClusterGunToTargetLine, AesType_def::AtEffectClusterGunToTargetLine};
|
||||
if (relavantAesTypeIds.contains(value.aesTypeId().underlying()))
|
||||
static QVector<AesType> relavantAesTypeIds = {AesType::AtEffectClusterGunToTargetLine, AesType::AtEffectClusterGunToTargetLine};
|
||||
if (relavantAesTypeIds.contains(value.aesTypeId))
|
||||
{
|
||||
if (m_effectClusterKeys.find(value.aesItemId()) != m_effectClusterKeys.end() ) //contains not available until cpp 20
|
||||
if (m_effectClusterKeys.find(value.aesItemId) != m_effectClusterKeys.end() ) //contains not available until cpp 20
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (value.effectStateId() == AesEffectState_def::EsRemoved || value.effectStart() < startTime - 210*1000)
|
||||
if (value.effectStateId == AesEffectState::EsRemoved || value.effectStart < startTime - 210*1000)
|
||||
{
|
||||
m_aesItemViewMap.remove(key, value);
|
||||
}
|
||||
@@ -369,16 +369,16 @@ void RecordReplayPluginCustom::removeOld(QMultiMap<long long, T> &map, qint64 de
|
||||
for (const auto &inner : map.values(item))
|
||||
{
|
||||
// Remove delted ones
|
||||
if (inner.isDeleted())
|
||||
if (inner.isDeleted)
|
||||
{
|
||||
map.remove(item, inner);
|
||||
continue;
|
||||
}
|
||||
// keep planned
|
||||
if (!inner.effectStart().is_set())
|
||||
if (!inner.effectStart.is_set())
|
||||
continue;
|
||||
// Remove to old ones
|
||||
if (inner.effectStart().get()+inner.effectDuration() < desiredTime - 210*1000 )
|
||||
if (inner.effectStart.get()+inner.effectDuration < desiredTime - 210*1000 )
|
||||
map.remove(item, inner);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@
|
||||
#include <AreaEffectSimulation/aes_record_replay_plugin.h>
|
||||
#include <AreaEffectSimulation/aes_dts.h>
|
||||
// fixup include path on 42.3 -> missing interface
|
||||
#include <../../Common/PluginInterfaces/record_replay_plugin.h>
|
||||
#include <Common/PluginInterfaces/record_replay_plugin.h>
|
||||
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
|
||||
+8
-8
@@ -525,16 +525,16 @@ void UnitTestTrajectory::test_realStartPoint()
|
||||
bool myFuzzyCompare2D(const Core::GeoPosition& v1, const QPoint3D& v2)
|
||||
{
|
||||
return
|
||||
qFuzzyCompare(v1.lon(), v2.x()) &&
|
||||
qFuzzyCompare(v1.lat(), v2.y());
|
||||
qFuzzyCompare(v1.lon, v2.x()) &&
|
||||
qFuzzyCompare(v1.lat, v2.y());
|
||||
}
|
||||
|
||||
bool myFuzzyCompare3D(const Core::GeoPosition& v1, const QPoint3D& v2)
|
||||
{
|
||||
return
|
||||
qFuzzyCompare(v1.lon(), v2.x()) &&
|
||||
qFuzzyCompare(v1.lat(), v2.y()) &&
|
||||
qFuzzyCompare(v1.z(), v2.z());
|
||||
qFuzzyCompare(v1.lon, v2.x()) &&
|
||||
qFuzzyCompare(v1.lat, v2.y()) &&
|
||||
qFuzzyCompare(v1.z, v2.z());
|
||||
}
|
||||
|
||||
void UnitTestTrajectory::test_generateTrajectoryBiedziak()
|
||||
@@ -581,18 +581,18 @@ void UnitTestTrajectory::test_generateTrajectoryBiedziak()
|
||||
{
|
||||
const auto &item35 = trajectoryOut[35];
|
||||
INFO_LOG(m_logger) << "iqtem35 = " << item35;
|
||||
QVERIFY2(qFuzzyCompare(item35.z(), 148.044675655973), "TrajectoryGenerator::trajectoryOut failed");
|
||||
QVERIFY2(qFuzzyCompare(item35.z, 148.044675655973), "TrajectoryGenerator::trajectoryOut failed");
|
||||
}
|
||||
{
|
||||
// Hier ist der Scheitelpunkt:
|
||||
const auto &item36 = trajectoryOut[36];
|
||||
INFO_LOG(m_logger) << "item36 = " << item36;
|
||||
QVERIFY2(qFuzzyCompare(item36.z(), 148.087567297406), "TrajectoryGenerator::trajectoryOut failed");
|
||||
QVERIFY2(qFuzzyCompare(item36.z, 148.087567297406), "TrajectoryGenerator::trajectoryOut failed");
|
||||
}
|
||||
{
|
||||
const auto &item37 = trajectoryOut[37];
|
||||
INFO_LOG(m_logger) << "item37 = " << item37;
|
||||
QVERIFY2(qFuzzyCompare(item37.z(), 147.905786767084), "TrajectoryGenerator::trajectoryOut failed");
|
||||
QVERIFY2(qFuzzyCompare(item37.z, 147.905786767084), "TrajectoryGenerator::trajectoryOut failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
#include <LtsCoordTrans/lts_coord_trans.h>
|
||||
#include <LtsUtilsCore/qpoint3d.h>
|
||||
#include <QtCore/QVector>
|
||||
#include <Qt6GuiCore/QVector2D>
|
||||
#include <QtGui/QVector2D>
|
||||
|
||||
#include <cmath>
|
||||
#include <iomanip> // std::setprecision
|
||||
|
||||
+4
-4
@@ -125,7 +125,7 @@ protected:
|
||||
|
||||
for (const auto &posTimeAware : trajectory)
|
||||
{
|
||||
relativeTimes.append(posTimeAware.relativeTime());
|
||||
relativeTimes.append(posTimeAware.relativeTime);
|
||||
}
|
||||
|
||||
std::sort(relativeTimes.begin(), relativeTimes.end());
|
||||
@@ -154,7 +154,7 @@ protected:
|
||||
{
|
||||
for (const auto &posTimeAware : trajectory)
|
||||
{
|
||||
const qint64 currentTime = posTimeAware.relativeTime();
|
||||
const qint64 currentTime = posTimeAware.relativeTime;
|
||||
|
||||
if (duplicateRelativeTime == currentTime)
|
||||
{
|
||||
@@ -172,11 +172,11 @@ protected:
|
||||
qint64 currentTime = std::numeric_limits<qint64>::min();
|
||||
for (const auto &posTimeAware : trajectory)
|
||||
{
|
||||
if (posTimeAware.relativeTime() < currentTime)
|
||||
if (posTimeAware.relativeTime < currentTime)
|
||||
{
|
||||
break;
|
||||
}
|
||||
currentTime = posTimeAware.relativeTime();
|
||||
currentTime = posTimeAware.relativeTime;
|
||||
++idx;
|
||||
} // for
|
||||
}
|
||||
|
||||
+13
-13
@@ -61,8 +61,8 @@ void UnitTestBasics::test_operator_equal_1()
|
||||
AesItemView aesItem1, aesItem2;
|
||||
QVERIFY2(aesItem1 == aesItem2, "AesItemView::operator== failed");
|
||||
|
||||
aesItem1.id(1);
|
||||
aesItem2.id(1);
|
||||
aesItem1.id = 1;
|
||||
aesItem2.id = 1;
|
||||
QVERIFY2(aesItem1 == aesItem2, "AesItemView::operator== failed");
|
||||
|
||||
|
||||
@@ -71,18 +71,18 @@ void UnitTestBasics::test_operator_equal_1()
|
||||
for (int i=1; i< 100; ++i)
|
||||
formVec.emplace_back(Core::GeoPosition(i*0.001, 100/i, 100/i));
|
||||
|
||||
aesItem1.aesItemId(12);
|
||||
aesItem1.sampleTime(12345567);
|
||||
aesItem1.chargeStruct().chargeTypeId(123);
|
||||
aesItem1.effectStart(123456789);
|
||||
aesItem1.form(formVec);
|
||||
aesItem1.boundingBoxBottomLeft(Core::GeoPosition2D(0.1, 0.2));
|
||||
aesItem1.boundingBoxTopRight(Core::GeoPosition2D(1.1, 1.2));
|
||||
aesItem1.aesTypeId(AreaEffectSimulation::AesType_def::AtBoobyTrap);
|
||||
aesItem1.effectStateId(AreaEffectSimulation::AesEffectState_def::EsActivated);
|
||||
aesItem1.partyId(2);
|
||||
aesItem1.aesItemId = 12;
|
||||
aesItem1.sampleTime = 12345567;
|
||||
aesItem1.chargeStruct.chargeTypeId = 123;
|
||||
aesItem1.effectStart = 123456789;
|
||||
aesItem1.form = formVec;
|
||||
aesItem1.boundingBoxBottomLeft = Core::GeoPosition2D(0.1, 0.2);
|
||||
aesItem1.boundingBoxTopRight = Core::GeoPosition2D(1.1, 1.2);
|
||||
aesItem1.aesTypeId = AreaEffectSimulation::AesType::AtBoobyTrap;
|
||||
aesItem1.effectStateId = AreaEffectSimulation::AesEffectState::EsActivated;
|
||||
aesItem1.partyId = 2;
|
||||
|
||||
aesItem1.setId(2334);
|
||||
aesItem1.setId = 2334;
|
||||
|
||||
aesItem2 = aesItem1;
|
||||
QVERIFY2(aesItem1 == aesItem2, "AesItemView::operator== failed");
|
||||
|
||||
+9
-9
@@ -54,19 +54,19 @@ void StateMachineTest::staticTests()
|
||||
const time_t tNow = time(nullptr);
|
||||
|
||||
// newly created, nothing set -> checkEnterNewState() should switch to created
|
||||
QCOMPARE(m_dummyAesObject->checkEnterNewState().underlying(), AesEffectState::EsCreated);
|
||||
QCOMPARE(m_dummyAesObject->checkEnterNewState(), AesEffectState::EsCreated);
|
||||
|
||||
// now we set a activation time -> Prepared
|
||||
m_dummyAesObject->setActivationTime(tNow + 5);
|
||||
QCOMPARE(m_dummyAesObject->checkEnterNewState().underlying(), AesEffectState::EsPrepared);
|
||||
QCOMPARE(m_dummyAesObject->checkEnterNewState(), AesEffectState::EsPrepared);
|
||||
|
||||
// now back to created
|
||||
m_dummyAesObject->setActivationTime(0);
|
||||
QCOMPARE(m_dummyAesObject->checkEnterNewState().underlying(), AesEffectState::EsCreated);
|
||||
QCOMPARE(m_dummyAesObject->checkEnterNewState(), AesEffectState::EsCreated);
|
||||
|
||||
// directly to activated
|
||||
m_dummyAesObject->setActivationTime(tNow);
|
||||
QCOMPARE(m_dummyAesObject->checkEnterNewState().underlying(), AesEffectState::EsActivated);
|
||||
QCOMPARE(m_dummyAesObject->checkEnterNewState(), AesEffectState::EsActivated);
|
||||
|
||||
// pause not possible
|
||||
m_dummyAesObject->setSupportsPausing(false);
|
||||
@@ -89,7 +89,7 @@ void StateMachineTest::staticTests()
|
||||
{
|
||||
QTest::qWait(15);
|
||||
}
|
||||
QCOMPARE(m_dummyAesObject->checkEnterNewState().underlying(), AesEffectState::EsExpired);
|
||||
QCOMPARE(m_dummyAesObject->checkEnterNewState(), AesEffectState::EsExpired);
|
||||
|
||||
// try to delete it
|
||||
QCOMPARE(m_dummyAesObject->trySwitchToRemoved(), false);
|
||||
@@ -102,7 +102,7 @@ void StateMachineTest::staticTests()
|
||||
m_dummyAesObject->setAesEffectState(AesEffectState::EsPaused);
|
||||
QCOMPARE(m_dummyAesObject->trySwitchToRemoved(), true);
|
||||
// an active/paused object must not set to deleted but to expired
|
||||
QCOMPARE(m_dummyAesObject->effectState().underlying(), AesEffectState::EsExpired);
|
||||
QCOMPARE(m_dummyAesObject->effectState(), AesEffectState::EsExpired);
|
||||
QCOMPARE(m_dummyAesObject->trySwitchToCreated(), false);
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ void StateMachineTest::dynamicTests()
|
||||
m_dummyAesObject->setDurationSec(2);
|
||||
QCOMPARE(m_dummyAesObject->isEndTimeSet(), true);
|
||||
|
||||
QCOMPARE(m_dummyAesObject->checkEnterNewState().underlying(), AesEffectState::EsPrepared);
|
||||
QCOMPARE(m_dummyAesObject->checkEnterNewState(), AesEffectState::EsPrepared);
|
||||
QCOMPARE(spy.count(), 2); // Created, Prepared
|
||||
spy.clear();
|
||||
|
||||
@@ -132,7 +132,7 @@ void StateMachineTest::dynamicTests()
|
||||
if (m_dummyAesObject->effectState() == AesEffectState::EsActivated)
|
||||
break;
|
||||
}
|
||||
QCOMPARE(m_dummyAesObject->effectState().underlying(), AesEffectState::EsActivated);
|
||||
QCOMPARE(m_dummyAesObject->effectState(), AesEffectState::EsActivated);
|
||||
|
||||
qDebug() << "Waiting for end time";
|
||||
for (int i = 0; i < 200; ++i)
|
||||
@@ -142,7 +142,7 @@ void StateMachineTest::dynamicTests()
|
||||
break;
|
||||
}
|
||||
AreaEffectSimulation::AesEffectState state = m_dummyAesObject->effectState();
|
||||
QCOMPARE(state.underlying(), AesEffectState::EsExpired);
|
||||
QCOMPARE(state, AesEffectState::EsExpired);
|
||||
|
||||
QCOMPARE(spy.count(), 2); // Activated, Done
|
||||
spy.clear();
|
||||
|
||||
+10
-10
@@ -48,10 +48,10 @@ inline std::string toString(const std::vector<Core::RelativePositionRelativeTime
|
||||
for (const auto &coordinate : trajectoryRelative)
|
||||
{
|
||||
QJsonObject coordObj;
|
||||
coordObj[QStringLiteral("offsetX")] = coordinate.offsetX();
|
||||
coordObj[QStringLiteral("offsetY")] = coordinate.offsetY();
|
||||
coordObj[QStringLiteral("offsetZ")] = coordinate.offsetZ();
|
||||
coordObj[QStringLiteral("relativeTime")] = coordinate.relativeTime();
|
||||
coordObj[QStringLiteral("offsetX")] = coordinate.offsetX;
|
||||
coordObj[QStringLiteral("offsetY")] = coordinate.offsetY;
|
||||
coordObj[QStringLiteral("offsetZ")] = coordinate.offsetZ;
|
||||
coordObj[QStringLiteral("relativeTime")] = static_cast<qint64>(coordinate.relativeTime);
|
||||
arr.append(coordObj);
|
||||
}
|
||||
obj[TRAJECTORY_RELATIVE_KEYWORD] = arr;
|
||||
@@ -83,10 +83,10 @@ inline std::vector<Core::RelativePositionRelativeTime> fromString(const QString
|
||||
return {};
|
||||
|
||||
Core::RelativePositionRelativeTime coord;
|
||||
coord.offsetX() = coordinate[QStringLiteral("offsetX")].toDouble();
|
||||
coord.offsetY() = coordinate[QStringLiteral("offsetY")].toDouble();
|
||||
coord.offsetZ() = coordinate[QStringLiteral("offsetZ")].toDouble();
|
||||
coord.relativeTime() = coordinate[QStringLiteral("relativeTime")].toInt();
|
||||
coord.offsetX = coordinate[QStringLiteral("offsetX")].toDouble();
|
||||
coord.offsetY = coordinate[QStringLiteral("offsetY")].toDouble();
|
||||
coord.offsetZ = coordinate[QStringLiteral("offsetZ")].toDouble();
|
||||
coord.relativeTime = coordinate[QStringLiteral("relativeTime")].toInt();
|
||||
|
||||
ret.push_back(coord);
|
||||
}
|
||||
@@ -119,8 +119,8 @@ inline double getAngleDegreeNorth(const QPointF &p1, const QPointF &p2)
|
||||
|
||||
inline bool isPointSimilar(AreaEffectSimulation::AesExplosionGeometry geometry)
|
||||
{
|
||||
return (geometry.underlying() == AreaEffectSimulation::AesExplosionGeometry_def::EgAimPoint) ||
|
||||
(geometry.underlying() == AreaEffectSimulation::AesExplosionGeometry_def::EgPoint);
|
||||
return (geometry == AreaEffectSimulation::AesExplosionGeometry::EgAimPoint) ||
|
||||
(geometry == AreaEffectSimulation::AesExplosionGeometry::EgPoint);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+77
-77
@@ -18,22 +18,22 @@ namespace DdsDbConvert
|
||||
Database::AesNContamination nContamination(const AreaEffectSimulation::NContamination &src)
|
||||
{
|
||||
Database::AesNContamination dst;
|
||||
dst.id = src.id();
|
||||
dst.chargeTypeId = src.chargeStruct().chargeTypeId();
|
||||
dst.effectStateId = src.effectStateId();
|
||||
dst.partyId = src.partyId().is_set() ? src.partyId().get() : 0;
|
||||
dst.participantId = src.participantId().is_set() ? src.participantId().get() : 0;
|
||||
dst.effectDuration = src.effectDuration();
|
||||
dst.effectStart = src.effectStart().is_set() ? QDateTime::fromMSecsSinceEpoch(src.effectStart().get()) : QDateTime();
|
||||
dst.name = QString::fromStdString(src.name());
|
||||
dst.impactPosition.rx() = src.impactPosition().lon();
|
||||
dst.impactPosition.ry() = src.impactPosition().lat();
|
||||
dst.borderLengthInner = src.borderLengthInner();
|
||||
dst.borderLengthOuter = src.borderLengthOuter();
|
||||
dst.impactRadius = src.impactRadius();
|
||||
dst.spanAngle = src.spanAngle();
|
||||
dst.rotationAngle = src.rotationAngle();
|
||||
dst.detonationValue = src.detonationValue();
|
||||
dst.id = src.id;
|
||||
dst.chargeTypeId = src.chargeStruct.chargeTypeId;
|
||||
dst.effectStateId = src.effectStateId;
|
||||
dst.partyId = src.partyId.is_set() ? src.partyId.get() : 0;
|
||||
dst.participantId = src.participantId.is_set() ? src.participantId.get() : 0;
|
||||
dst.effectDuration = src.effectDuration;
|
||||
dst.effectStart = src.effectStart.is_set() ? QDateTime::fromMSecsSinceEpoch(src.effectStart.get()) : QDateTime();
|
||||
dst.name = QString::fromStdString(src.name);
|
||||
dst.impactPosition.rx() = src.impactPosition.lon;
|
||||
dst.impactPosition.ry() = src.impactPosition.lat;
|
||||
dst.borderLengthInner = src.borderLengthInner;
|
||||
dst.borderLengthOuter = src.borderLengthOuter;
|
||||
dst.impactRadius = src.impactRadius;
|
||||
dst.spanAngle = src.spanAngle;
|
||||
dst.rotationAngle = src.rotationAngle;
|
||||
dst.detonationValue = src.detonationValue;
|
||||
// dst.priv_entityId;
|
||||
// dst.privNContaminationId;
|
||||
return dst;
|
||||
@@ -42,23 +42,23 @@ Database::AesNContamination nContamination(const AreaEffectSimulation::NContamin
|
||||
Database::AesBCContamination bcContamination(const BCContamination &src)
|
||||
{
|
||||
Database::AesBCContamination dst;
|
||||
dst.id = src.id();
|
||||
dst.effectStateId = src.effectStateId();
|
||||
dst.partyId = src.partyId().is_set() ? src.partyId().get() : 0;
|
||||
dst.participantId = src.participantId().is_set() ? src.participantId().get() : 0;
|
||||
dst.effectDuration = src.effectDuration();
|
||||
dst.effectStart = src.effectStart().is_set() ? QDateTime::fromMSecsSinceEpoch(src.effectStart().get()) : QDateTime();
|
||||
dst.name = QString::fromStdString(src.name());
|
||||
dst.impactPosition.rx() = src.impactPosition().lon();
|
||||
dst.impactPosition.ry() = src.impactPosition().lat();
|
||||
dst.impactRadius = src.impactRadius();
|
||||
dst.chargeTypeId = src.chargeStruct().chargeTypeId();
|
||||
dst.windSpeed = src.windSpeed();
|
||||
dst.weatherTimestamp = QDateTime::fromMSecsSinceEpoch(src.weatherTimestamp());
|
||||
dst.propagationDirection = src.propagationDirection();
|
||||
dst.id = src.id;
|
||||
dst.effectStateId = src.effectStateId;
|
||||
dst.partyId = src.partyId.is_set() ? src.partyId.get() : 0;
|
||||
dst.participantId = src.participantId.is_set() ? src.participantId.get() : 0;
|
||||
dst.effectDuration = src.effectDuration;
|
||||
dst.effectStart = src.effectStart.is_set() ? QDateTime::fromMSecsSinceEpoch(src.effectStart.get()) : QDateTime();
|
||||
dst.name = QString::fromStdString(src.name);
|
||||
dst.impactPosition.rx() = src.impactPosition.lon;
|
||||
dst.impactPosition.ry() = src.impactPosition.lat;
|
||||
dst.impactRadius = src.impactRadius;
|
||||
dst.chargeTypeId = src.chargeStruct.chargeTypeId;
|
||||
dst.windSpeed = src.windSpeed;
|
||||
dst.weatherTimestamp = QDateTime::fromMSecsSinceEpoch(src.weatherTimestamp);
|
||||
dst.propagationDirection = src.propagationDirection;
|
||||
dst.weatherPosition = dst.impactPosition; // initial, is not used during update therefore it's ok here
|
||||
dst.upperOffset = src.upperOffset();
|
||||
dst.lowerOffset = src.lowerOffset();
|
||||
dst.upperOffset = src.upperOffset;
|
||||
dst.lowerOffset = src.lowerOffset;
|
||||
// dst.expansionFactor;
|
||||
// dst.isDynamicWeather;
|
||||
// dst.priv_entityId;
|
||||
@@ -69,24 +69,24 @@ Database::AesBCContamination bcContamination(const BCContamination &src)
|
||||
Database::AesExplosionArea explosionArea(const ExplosionArea &src)
|
||||
{
|
||||
Database::AesExplosionArea dst;
|
||||
dst.id = src.id();
|
||||
dst.effectStateId = src.effectStateId();
|
||||
dst.partyId = src.partyId().is_set() ? src.partyId().get() : 0;
|
||||
dst.participantId = src.participantId().is_set() ? src.participantId().get() : 0;
|
||||
dst.effectDuration = src.effectDuration();
|
||||
dst.effectStart = src.effectStart().is_set() && src.effectStart().get() > 0 ? QDateTime::fromMSecsSinceEpoch(src.effectStart().get()) : QDateTime();
|
||||
dst.name = QString::fromStdString(src.name());
|
||||
dst.impactPosition.rx() = src.area().cornerBottomLeft().lon();
|
||||
dst.impactPosition.ry() = src.area().cornerBottomLeft().lat();
|
||||
dst.impactLength = src.area().height();
|
||||
dst.impactWidth = src.area().width();
|
||||
dst.rotationAngle = src.area().rotation();
|
||||
dst.chargeTypeId = src.chargeStruct().chargeTypeId();
|
||||
dst.cannonCount = src.cannonCount();
|
||||
dst.cannonRounds = src.cannonRounds();
|
||||
dst.originalEffectStart = src.originalEffectStart() > 0 ? QDateTime::fromMSecsSinceEpoch(src.originalEffectStart()) : QDateTime();
|
||||
dst.originalEffectDuration = src.originalEffectDuration();
|
||||
dst.remainExplosionNumber = src.remainExplosionNumber();
|
||||
dst.id = src.id;
|
||||
dst.effectStateId = src.effectStateId;
|
||||
dst.partyId = src.partyId.is_set() ? src.partyId.get() : 0;
|
||||
dst.participantId = src.participantId.is_set() ? src.participantId.get() : 0;
|
||||
dst.effectDuration = src.effectDuration;
|
||||
dst.effectStart = src.effectStart.is_set() && src.effectStart.get() > 0 ? QDateTime::fromMSecsSinceEpoch(src.effectStart.get()) : QDateTime();
|
||||
dst.name = QString::fromStdString(src.name);
|
||||
dst.impactPosition.rx() = src.area.cornerBottomLeft.lon;
|
||||
dst.impactPosition.ry() = src.area.cornerBottomLeft.lat;
|
||||
dst.impactLength = src.area.height;
|
||||
dst.impactWidth = src.area.width;
|
||||
dst.rotationAngle = src.area.rotation;
|
||||
dst.chargeTypeId = src.chargeStruct.chargeTypeId;
|
||||
dst.cannonCount = src.cannonCount;
|
||||
dst.cannonRounds = src.cannonRounds;
|
||||
dst.originalEffectStart = src.originalEffectStart > 0 ? QDateTime::fromMSecsSinceEpoch(src.originalEffectStart) : QDateTime();
|
||||
dst.originalEffectDuration = src.originalEffectDuration;
|
||||
dst.remainExplosionNumber = src.remainExplosionNumber;
|
||||
// dst.firePurpose;
|
||||
// dst.fireRequestTime;
|
||||
// dst.priv_entityId;
|
||||
@@ -98,16 +98,16 @@ Database::AesExplosionArea explosionArea(const ExplosionArea &src)
|
||||
Database::AesExplosionSingle explosionSingle(const ExplosionSingle &src)
|
||||
{
|
||||
Database::AesExplosionSingle dst;
|
||||
dst.id = src.id();
|
||||
dst.effectStateId = src.effectStateId();
|
||||
dst.partyId = src.partyId().is_set() ? src.partyId().get() : 0;
|
||||
dst.participantId = src.participantId().is_set() ? src.participantId().get() : 0;
|
||||
dst.effectDuration = src.effectDuration();
|
||||
dst.effectStart = src.effectStart().is_set() && src.effectStart().get() > 0 ? QDateTime::fromMSecsSinceEpoch(src.effectStart().get()) : QDateTime();
|
||||
dst.name = QString::fromStdString(src.name());
|
||||
dst.impactPosition.rx() = src.impactPosition().lon();
|
||||
dst.impactPosition.ry() = src.impactPosition().lat();
|
||||
dst.chargeTypeId = src.chargeStruct().chargeTypeId();
|
||||
dst.id = src.id;
|
||||
dst.effectStateId = src.effectStateId;
|
||||
dst.partyId = src.partyId.is_set() ? src.partyId.get() : 0;
|
||||
dst.participantId = src.participantId.is_set() ? src.participantId.get() : 0;
|
||||
dst.effectDuration = src.effectDuration;
|
||||
dst.effectStart = src.effectStart.is_set() && src.effectStart.get() > 0 ? QDateTime::fromMSecsSinceEpoch(src.effectStart.get()) : QDateTime();
|
||||
dst.name = QString::fromStdString(src.name);
|
||||
dst.impactPosition.rx() = src.impactPosition.lon;
|
||||
dst.impactPosition.ry() = src.impactPosition.lat;
|
||||
dst.chargeTypeId = src.chargeStruct.chargeTypeId;
|
||||
// dst.priv_entityId;
|
||||
// dst.priv_explosionId;
|
||||
// dst.privExplosionSingleId;
|
||||
@@ -117,19 +117,19 @@ Database::AesExplosionSingle explosionSingle(const ExplosionSingle &src)
|
||||
Database::AesMineArea mineArea(const MineArea &src)
|
||||
{
|
||||
Database::AesMineArea dst;
|
||||
dst.id = src.id();
|
||||
dst.name = QString::fromStdString(src.name());
|
||||
dst.effectStart = src.effectStart().is_set() && src.effectStart().get() > 0 ? QDateTime::fromMSecsSinceEpoch(src.effectStart().get()) : QDateTime();
|
||||
dst.effectDuration = src.effectDuration();
|
||||
dst.partyId = src.partyId().is_set() ? src.partyId().get() : 0;
|
||||
dst.chargeTypeId = src.chargeStruct().chargeTypeId();
|
||||
dst.participantId = src.participantId().is_set() ? src.participantId().get() : 0;
|
||||
dst.density = src.density();
|
||||
dst.width = src.width();
|
||||
dst.layingProcedureTypeId = src.layingProcedureType();
|
||||
dst.isLaidHidden = src.isLaidHidden();
|
||||
dst.effectStateId = src.effectStateId();
|
||||
dst.isCenterLine = src.isCenterLine();
|
||||
dst.id = src.id;
|
||||
dst.name = QString::fromStdString(src.name);
|
||||
dst.effectStart = src.effectStart.is_set() && src.effectStart.get() > 0 ? QDateTime::fromMSecsSinceEpoch(src.effectStart.get()) : QDateTime();
|
||||
dst.effectDuration = src.effectDuration;
|
||||
dst.partyId = src.partyId.is_set() ? src.partyId.get() : 0;
|
||||
dst.chargeTypeId = src.chargeStruct.chargeTypeId;
|
||||
dst.participantId = src.participantId.is_set() ? src.participantId.get() : 0;
|
||||
dst.density = src.density;
|
||||
dst.width = src.width;
|
||||
dst.layingProcedureTypeId = src.layingProcedureType;
|
||||
dst.isLaidHidden = src.isLaidHidden;
|
||||
dst.effectStateId = src.effectStateId;
|
||||
dst.isCenterLine = src.isCenterLine;
|
||||
// qint32 priv_entityId;
|
||||
// qint32 priv_mineId;
|
||||
// qint32 privMineAreaId;
|
||||
@@ -138,17 +138,17 @@ Database::AesMineArea mineArea(const MineArea &src)
|
||||
|
||||
QVector<Database::AesMineAreaSegment> mineAreaSegments(const MineArea &src)
|
||||
{
|
||||
const std::vector<AreaEffectSimulation::MineSegment> &segments = src.segments();
|
||||
const std::vector<AreaEffectSimulation::MineSegment> &segments = src.segments;
|
||||
QVector<Database::AesMineAreaSegment> dbSegments;
|
||||
dbSegments.reserve(segments.size());
|
||||
for (size_t i = 0; i < segments.size(); ++i)
|
||||
{
|
||||
Database::AesMineAreaSegment newSegment;
|
||||
newSegment.elementNumber = i;
|
||||
newSegment.mineAreaId = src.id(); // Todo: korrekt?
|
||||
newSegment.mineAreaId = src.id; // Todo: korrekt?
|
||||
newSegment.id = 0;
|
||||
newSegment.startPosition = QPointF(segments[i].positionStart().lon(), segments[i].positionStart().lat());
|
||||
newSegment.endPosition = QPointF(segments[i].positionEnd().lon(), segments[i].positionEnd().lat());
|
||||
newSegment.startPosition = QPointF(segments[i].positionStart.lon, segments[i].positionStart.lat);
|
||||
newSegment.endPosition = QPointF(segments[i].positionEnd.lon, segments[i].positionEnd.lat);
|
||||
dbSegments << newSegment;
|
||||
}
|
||||
return dbSegments;
|
||||
|
||||
+16
-21
@@ -10,7 +10,6 @@
|
||||
|
||||
#include <aes.hpp>
|
||||
#include <AreaEffectSimulation/logger.h>
|
||||
#include <ElevationMap/elevation_map.h>
|
||||
#include <LtsCoordTrans/lts_coord_trans.h>
|
||||
#include <LtsCoordinate/lts_coord_vector.h>
|
||||
#include <LtsCoordinate/lts_coordinate.h>
|
||||
@@ -36,13 +35,9 @@
|
||||
|
||||
// Note: All polygones are open!
|
||||
|
||||
std::ostream &operator<<(std::ostream &stream, const QVector<QPointF> &value)
|
||||
{
|
||||
stream << "QVector<QPointF>(" << value.size() << "): ";
|
||||
for (const QPointF &item : value)
|
||||
stream << item << ";";
|
||||
return stream;
|
||||
}
|
||||
// operator<< for QVector<QPointF> removed: in Qt6 QVector is an alias of
|
||||
// QList, so the inline operator<<(std::ostream&, const QList<QPointF>&) in
|
||||
// INGLLogger.h (pulled in via logger.h) has the identical signature.
|
||||
|
||||
std::ostream &operator<<(std::ostream &stream, const QVector<LtsCoordTrans::UtmCoordinate> &value)
|
||||
{
|
||||
@@ -86,8 +81,8 @@ namespace Polygons
|
||||
// regarding ExplosionCluster:
|
||||
bool isPointSimilar(AreaEffectSimulation::AesExplosionGeometry geometry)
|
||||
{
|
||||
return (geometry.underlying() == AreaEffectSimulation::AesExplosionGeometry_def::EgAimPoint)
|
||||
|| (geometry.underlying() == AreaEffectSimulation::AesExplosionGeometry_def::EgPoint);
|
||||
return (geometry == AreaEffectSimulation::AesExplosionGeometry::EgAimPoint)
|
||||
|| (geometry == AreaEffectSimulation::AesExplosionGeometry::EgPoint);
|
||||
}
|
||||
|
||||
// AreaBottomLeft :
|
||||
@@ -427,7 +422,7 @@ QPolygonF explosionClusterArea(const Database::AesExplosionCluster &explosionClu
|
||||
QPolygonF poly;
|
||||
|
||||
const bool bIsPointSimilar = isPointSimilar(explosionCluster.explosionGeometryId);
|
||||
if (bIsPointSimilar || explosionCluster.explosionGeometryId.underlying() == AreaEffectSimulation::AesExplosionGeometry_def::EgRadial)
|
||||
if (bIsPointSimilar || explosionCluster.explosionGeometryId == AreaEffectSimulation::AesExplosionGeometry::EgRadial)
|
||||
{
|
||||
// get center ... (zog isn´t relevant yet)
|
||||
const double radius = explosionCluster.impactWidth / 2.0;
|
||||
@@ -626,7 +621,7 @@ QPolygonF effectClusterArea(const Database::AesEffectCluster &effectCluster)
|
||||
QPolygonF poly;
|
||||
|
||||
const bool bIsPointSimilar = isPointSimilar(effectCluster.explosionGeometryId);
|
||||
if (bIsPointSimilar || effectCluster.explosionGeometryId.underlying() == AreaEffectSimulation::AesExplosionGeometry_def::EgRadial)
|
||||
if (bIsPointSimilar || effectCluster.explosionGeometryId == AreaEffectSimulation::AesExplosionGeometry::EgRadial)
|
||||
{
|
||||
// get center ... (zog isn´t relevant yet)
|
||||
const double radius = effectCluster.impactWidth / 2.0;
|
||||
@@ -962,7 +957,7 @@ QVector<QPointF> explosionClusterSingleExplosionsGAUSS_Mtp(const Database::AesEx
|
||||
//
|
||||
// calculate the subAreas / mtps:
|
||||
//
|
||||
if (explosionCluster.explosionGeometryId.underlying() == AreaEffectSimulation::AesExplosionGeometry_def::EgRadial)
|
||||
if (explosionCluster.explosionGeometryId == AreaEffectSimulation::AesExplosionGeometry::EgRadial)
|
||||
mtps_asUtm = explosionClusterRadialToMtps(areaBlWithTla, numberOfMTPsRequested, firingOriginUtm, centerUtm, &singleWidthOut, &singleHeightOut);
|
||||
else
|
||||
mtps_asUtm = explosionClusterAreaToMtps(areaBlWithTla, numberOfMTPsRequested, &singleWidthOut, &singleHeightOut);
|
||||
@@ -1662,14 +1657,14 @@ LtsUtils::QPoint3D calculateFiringUnitCenterNonRecursive(const std::shared_ptr<P
|
||||
ppmDtc->waitForHistoricalDataParticipant(1000);
|
||||
|
||||
const ParticipantManagement::Participant &partData = ppmDtc->participant(unitParticipantId);
|
||||
if (partData.id() != unitParticipantId)
|
||||
if (partData.id != unitParticipantId)
|
||||
{
|
||||
ERROR_LOG(logger) << LOGFUNCTION << " ERROR, participant failed for id =" << unitParticipantId;
|
||||
return s_invalidPos;
|
||||
}
|
||||
ppmDtc->waitForHistoricalDataParticipantPosition(1000);
|
||||
|
||||
const std::vector<int> &childIds = partData.inferiorIds();
|
||||
const std::vector<int> &childIds = partData.inferiorIds;
|
||||
|
||||
singlePositionsOut.clear();
|
||||
singlePositionsOut.reserve(childIds.size());
|
||||
@@ -1681,21 +1676,21 @@ LtsUtils::QPoint3D calculateFiringUnitCenterNonRecursive(const std::shared_ptr<P
|
||||
for (int childId : qAsConst(childIds))
|
||||
{
|
||||
const ParticipantManagement::ParticipantPosition &childPos = ppmDtc->participantPosition(childId);
|
||||
if (childPos.participantId() != childId)
|
||||
if (childPos.participantId != childId)
|
||||
{
|
||||
// may happen in real life: so ERROR_LOG to DEBUG_LOG
|
||||
DEBUG_LOG(logger) << LOGFUNCTION << " ERROR, participantPosition failed for id =" << childId;
|
||||
return s_invalidPos;
|
||||
}
|
||||
const Core::GeoPosition &childGeoPos = childPos.pos();
|
||||
const Core::GeoPosition &childGeoPos = childPos.pos;
|
||||
|
||||
singlePositionsOut.emplace_back(childGeoPos);
|
||||
|
||||
const auto utm = LtsCoordTrans::UtmCoordinate::fromGeographic(childGeoPos.lon(), childGeoPos.lat(), utmZone);
|
||||
const auto utm = LtsCoordTrans::UtmCoordinate::fromGeographic(childGeoPos.lon, childGeoPos.lat, utmZone);
|
||||
if (utmZone == -1)
|
||||
utmZone = utm.zone;
|
||||
|
||||
pos += LtsUtils::QPoint3D(utm.x, utm.y, childGeoPos.z());
|
||||
pos += LtsUtils::QPoint3D(utm.x, utm.y, childGeoPos.z);
|
||||
++childCount;
|
||||
} // for
|
||||
|
||||
@@ -1743,7 +1738,7 @@ QVector<LtsCoordTrans::UtmCoordinate> geoVecToUtm(const std::vector<Core::GeoPos
|
||||
utmVec.reserve(vecPos.size());
|
||||
for (const auto &pos : vecPos)
|
||||
{
|
||||
const auto utm = LtsCoordTrans::UtmCoordinate::fromGeographic(pos.lon(), pos.lat(), utmZone);
|
||||
const auto utm = LtsCoordTrans::UtmCoordinate::fromGeographic(pos.lon, pos.lat, utmZone);
|
||||
if (utmZone == -1)
|
||||
utmZone = utm.zone;
|
||||
utmVec.append(utm);
|
||||
@@ -1757,7 +1752,7 @@ QVector<QPointF> geoVecToUtmPointF(const std::vector<Core::GeoPosition2D> &vecPo
|
||||
points.reserve(vecPos.size());
|
||||
for (const auto &pos : vecPos)
|
||||
{
|
||||
const auto utm = LtsCoordTrans::UtmCoordinate::fromGeographic(pos.lon(), pos.lat(), utmZone);
|
||||
const auto utm = LtsCoordTrans::UtmCoordinate::fromGeographic(pos.lon, pos.lat, utmZone);
|
||||
if (utmZone == -1)
|
||||
utmZone = utm.zone;
|
||||
points.append(QPointF(utm.x, utm.y));
|
||||
|
||||
+2
-2
@@ -69,14 +69,14 @@ static void fillData(const ExplosionSingleCentralModifyRequest &src, Database::A
|
||||
|
||||
fillGeometryData(src, dst);
|
||||
dst.name = QString::fromStdString(src.name());
|
||||
dst.effectStart = src.effectStart().is_set() && src.effectStart().get() > 0 ? QDateTime::fromMSecsSinceEpoch(src.effectStart().get()) : QDateTime();
|
||||
dst.effectStart = src.effectStart.is_set() && src.effectStart.get() > 0 ? QDateTime::fromMSecsSinceEpoch(src.effectStart.get()) : QDateTime();
|
||||
dst.effectDuration = 1000; // 1sec
|
||||
dst.chargeTypeId = src.chargeTypeId();
|
||||
dst.altitude = src.altitude();
|
||||
dst.firePurpose = QString::fromStdString(src.purpose());
|
||||
dst.fireRequestTime = QDateTime::fromMSecsSinceEpoch(src.fireRequestTime());
|
||||
dst.effectMarkingInTa = src.effectMarkingInTa();
|
||||
dst.externalId = src.externalId().is_set() ? src.externalId().get() : 0;
|
||||
dst.externalId = src.externalId.is_set() ? src.externalId.get() : 0;
|
||||
dst.angle = src.angle();
|
||||
dst.fuseTypeId = src.fuseType().underlying();
|
||||
dst.participantId = src.participantId();
|
||||
|
||||
+56
-56
@@ -28,8 +28,8 @@ bool DtcImplCustom::aesItemViewFromEntityId(int entityId, AesType aesType, AesIt
|
||||
}
|
||||
for (const auto &sample : m_dtcAesItemView->readAlive())
|
||||
{
|
||||
if ( (sample.data().aesItemId() == entityId) &&
|
||||
( (sample.data().aesTypeId() == aesType) || (aesType==AesType_def::AtUnknown) )
|
||||
if ( (sample.data().aesItemId == entityId) &&
|
||||
( (sample.data().aesTypeId == aesType) || (aesType==AesType::AtUnknown) )
|
||||
)
|
||||
{
|
||||
aesItemView = sample.data();
|
||||
@@ -42,71 +42,71 @@ bool DtcImplCustom::aesItemViewFromEntityId(int entityId, AesType aesType, AesIt
|
||||
bool DtcImplCustom::aesItemFromId(int aesId, AesItem &aesItem)
|
||||
{
|
||||
aesItem = nContamination(aesId);
|
||||
if (aesItem.id() > 0)
|
||||
if (aesItem.id > 0)
|
||||
return true;
|
||||
|
||||
aesItem = bCContamination(aesId);
|
||||
if (aesItem.id() > 0)
|
||||
if (aesItem.id > 0)
|
||||
return true;
|
||||
|
||||
aesItem = explosionArea(aesId);
|
||||
if (aesItem.id() > 0)
|
||||
if (aesItem.id > 0)
|
||||
return true;
|
||||
|
||||
aesItem = explosionCluster(aesId);
|
||||
if (aesItem.id() > 0)
|
||||
if (aesItem.id > 0)
|
||||
return true;
|
||||
|
||||
aesItem = explosionSingle(aesId);
|
||||
if (aesItem.id() > 0)
|
||||
if (aesItem.id > 0)
|
||||
return true;
|
||||
|
||||
aesItem = mineArea(aesId);
|
||||
if (aesItem.id() > 0)
|
||||
if (aesItem.id > 0)
|
||||
return true;
|
||||
|
||||
aesItem = dangerArea(aesId);
|
||||
if (aesItem.id() > 0)
|
||||
if (aesItem.id > 0)
|
||||
return true;
|
||||
|
||||
aesItem = functionalArea(aesId);
|
||||
if (aesItem.id() > 0)
|
||||
if (aesItem.id > 0)
|
||||
return true;
|
||||
|
||||
aesItem = mineCorridor(aesId);
|
||||
if (aesItem.id() > 0)
|
||||
if (aesItem.id > 0)
|
||||
return true;
|
||||
|
||||
aesItem = borderline(aesId);
|
||||
if (aesItem.id() > 0)
|
||||
if (aesItem.id > 0)
|
||||
return true;
|
||||
|
||||
aesItem = technicalArea(aesId);
|
||||
if (aesItem.id() > 0)
|
||||
if (aesItem.id > 0)
|
||||
return true;
|
||||
|
||||
aesItem = airSupportImpact(aesId);
|
||||
if (aesItem.id() > 0)
|
||||
if (aesItem.id > 0)
|
||||
return true;
|
||||
|
||||
aesItem = gasPipe(aesId);
|
||||
if (aesItem.id() > 0)
|
||||
if (aesItem.id > 0)
|
||||
return true;
|
||||
|
||||
aesItem = boobyTrap(aesId);
|
||||
if (aesItem.id() > 0)
|
||||
if (aesItem.id > 0)
|
||||
return true;
|
||||
|
||||
aesItem = dusSingleMine(aesId);
|
||||
if (aesItem.id() > 0)
|
||||
if (aesItem.id > 0)
|
||||
return true;
|
||||
|
||||
aesItem = offRouteMine(aesId);
|
||||
if (aesItem.id() > 0)
|
||||
if (aesItem.id > 0)
|
||||
return true;
|
||||
|
||||
aesItem = effectCluster(aesId);
|
||||
if (aesItem.id() > 0)
|
||||
if (aesItem.id > 0)
|
||||
return true;
|
||||
|
||||
DEBUG_LOG(m_logger) << "No aesItem for aesId=" << aesId << " found";
|
||||
@@ -122,76 +122,76 @@ AreaEffectSimulation::AesType DtcImplCustom::aesItemIdFromExternalId(long long e
|
||||
aesItemId = 0;
|
||||
for (const AreaEffectSimulation::BCContamination &bcCont : qAsConst(bcConts))
|
||||
{
|
||||
if (bcCont.externalId() == externalId)
|
||||
if (bcCont.externalId == externalId)
|
||||
{
|
||||
if (bcCont.id() > aesItemId)
|
||||
aesItemId = bcCont.id();
|
||||
if (bcCont.id > aesItemId)
|
||||
aesItemId = bcCont.id;
|
||||
}
|
||||
}
|
||||
if (aesItemId > 0)
|
||||
return AreaEffectSimulation::AesType_def::AtBCContamination;
|
||||
return AreaEffectSimulation::AesType::AtBCContamination;
|
||||
|
||||
QMap<qint32, AreaEffectSimulation::NContamination> nConts = nContaminations();
|
||||
for (const AreaEffectSimulation::NContamination &nCont: qAsConst(nConts))
|
||||
{
|
||||
if (nCont.externalId() == externalId)
|
||||
if (nCont.externalId == externalId)
|
||||
{
|
||||
if (nCont.id() > aesItemId)
|
||||
aesItemId = nCont.id();
|
||||
if (nCont.id > aesItemId)
|
||||
aesItemId = nCont.id;
|
||||
}
|
||||
}
|
||||
if (aesItemId > 0)
|
||||
return AreaEffectSimulation::AesType_def::AtNContamination;
|
||||
return AreaEffectSimulation::AesType::AtNContamination;
|
||||
|
||||
QMap<qint32, AreaEffectSimulation::ExplosionArea> explAreas = explosionAreas();
|
||||
for (const AreaEffectSimulation::ExplosionArea &explArea : qAsConst(explAreas))
|
||||
{
|
||||
if (explArea.externalId() == externalId)
|
||||
if (explArea.externalId == externalId)
|
||||
{
|
||||
if (explArea.id() > aesItemId)
|
||||
aesItemId = explArea.id();
|
||||
if (explArea.id > aesItemId)
|
||||
aesItemId = explArea.id;
|
||||
}
|
||||
}
|
||||
if (aesItemId > 0)
|
||||
return AreaEffectSimulation::AesType_def::AtExplosionArea;
|
||||
return AreaEffectSimulation::AesType::AtExplosionArea;
|
||||
|
||||
QMap<qint32, AreaEffectSimulation::ExplosionSingle> explSingles = explosionSingles();
|
||||
for (const AreaEffectSimulation::ExplosionSingle &explSingle : qAsConst(explSingles))
|
||||
{
|
||||
if (explSingle.externalId() == externalId)
|
||||
if (explSingle.externalId == externalId)
|
||||
{
|
||||
if (explSingle.id() > aesItemId)
|
||||
aesItemId = explSingle.id();
|
||||
if (explSingle.id > aesItemId)
|
||||
aesItemId = explSingle.id;
|
||||
}
|
||||
}
|
||||
if (aesItemId > 0)
|
||||
return AreaEffectSimulation::AesType_def::AtExplosionSingle;
|
||||
return AreaEffectSimulation::AesType::AtExplosionSingle;
|
||||
|
||||
QMap<qint32, AreaEffectSimulation::MineArea> mAreas = mineAreas();
|
||||
for(const AreaEffectSimulation::MineArea &mArea : qAsConst(mAreas))
|
||||
{
|
||||
if (mArea.externalId() == externalId)
|
||||
if (mArea.externalId == externalId)
|
||||
{
|
||||
if (mArea.id() > aesItemId)
|
||||
aesItemId = mArea.id();
|
||||
if (mArea.id > aesItemId)
|
||||
aesItemId = mArea.id;
|
||||
}
|
||||
}
|
||||
if (aesItemId > 0)
|
||||
return AreaEffectSimulation::AesType_def::AtMineArea;
|
||||
return AreaEffectSimulation::AesType::AtMineArea;
|
||||
|
||||
QMap<qint32, AreaEffectSimulation::MineCorridor> mCorridors = mineCorridors();
|
||||
for (const AreaEffectSimulation::MineCorridor &mCorridor : qAsConst(mCorridors))
|
||||
{
|
||||
if (mCorridor.externalId() == externalId)
|
||||
if (mCorridor.externalId == externalId)
|
||||
{
|
||||
if (mCorridor.id() > aesItemId)
|
||||
aesItemId = mCorridor.id();
|
||||
if (mCorridor.id > aesItemId)
|
||||
aesItemId = mCorridor.id;
|
||||
}
|
||||
}
|
||||
if (aesItemId > 0)
|
||||
return AreaEffectSimulation::AesType_def::AtMineCorridor;
|
||||
return AreaEffectSimulation::AesType::AtMineCorridor;
|
||||
|
||||
return AreaEffectSimulation::AesType_def::AtUnknown;
|
||||
return AreaEffectSimulation::AesType::AtUnknown;
|
||||
}
|
||||
|
||||
bool DtcImplCustom::triggeredImpactsFromEntityId(int entityId, AesType aesType, TriggeredImpacts &triggeredImpacts)
|
||||
@@ -206,8 +206,8 @@ bool DtcImplCustom::triggeredImpactsFromEntityId(int entityId, AesType aesType,
|
||||
}
|
||||
for (const auto &sample : m_dtcTriggeredImpacts->readAlive())
|
||||
{
|
||||
if ( (sample.data().aesItemId() == entityId) &&
|
||||
( (sample.data().aesTypeId() == aesType) || (aesType==AesType_def::AtUnknown) )
|
||||
if ( (sample.data().aesItemId == entityId) &&
|
||||
( (sample.data().aesTypeId == aesType) || (aesType==AesType::AtUnknown) )
|
||||
)
|
||||
{
|
||||
triggeredImpacts = sample.data();
|
||||
@@ -229,8 +229,8 @@ bool DtcImplCustom::effectsFromEntityId(int entityId, AesType aesType, Effects &
|
||||
}
|
||||
for (const auto &sample : m_dtcEffects->readAlive())
|
||||
{
|
||||
if ( (sample.data().aesItemId() == entityId) &&
|
||||
( (sample.data().aesTypeId() == aesType) || (aesType==AesType_def::AtUnknown) )
|
||||
if ( (sample.data().aesItemId == entityId) &&
|
||||
( (sample.data().aesTypeId == aesType) || (aesType==AesType::AtUnknown) )
|
||||
)
|
||||
{
|
||||
effects = sample.data();
|
||||
@@ -244,14 +244,14 @@ int DtcImplCustom::partyForDusMine(int dusMineId) const
|
||||
{
|
||||
for (const auto &dms : m_dusMineStateCont)
|
||||
{
|
||||
for (const DusMine &dm : dms.mines())
|
||||
for (const DusMine &dm : dms.mines)
|
||||
{
|
||||
if (dm.eqId() == dusMineId)
|
||||
if (dm.eqId == dusMineId)
|
||||
{
|
||||
auto it = m_mineAreaCont.find(dms.id());
|
||||
auto it = m_mineAreaCont.find(dms.id);
|
||||
if (it == m_mineAreaCont.end())
|
||||
return 1;
|
||||
return it.value().partyId().is_set() ? it.value().partyId().get() : 1;
|
||||
return it.value().partyId.is_set() ? it.value().partyId.get() : 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -263,8 +263,8 @@ QString DtcImplCustom::aesItemNameFromEntityId(int entityId)
|
||||
{
|
||||
AreaEffectSimulation::AesItem aesItem;
|
||||
aesItemFromId(entityId, aesItem);
|
||||
if (!aesItem.name().empty())
|
||||
return QString::fromStdString(aesItem.name());
|
||||
if (!aesItem.name.empty())
|
||||
return QString::fromStdString(aesItem.name);
|
||||
//else use DAO
|
||||
|
||||
if (!m_dao)
|
||||
@@ -355,8 +355,8 @@ QVector<TrajectoryTimeAware> DtcImplCustom::trajectoriesTimeAwareFromOriginatorI
|
||||
for (const AreaEffectSimulation::TrajectoryTimeAware &trajectoryTimeAware : qAsConst(trajectoryTimeAwareMap))
|
||||
{
|
||||
// be aware of: [E01562-259] use originatorId, originatorTypeId (instead of aesItemId, aesTypeId)
|
||||
if ((trajectoryTimeAware.originatorId() == originatorId) &&
|
||||
(trajectoryTimeAware.originatorTypeId() == originatorTypeId))
|
||||
if ((trajectoryTimeAware.originatorId == originatorId) &&
|
||||
(trajectoryTimeAware.originatorTypeId == originatorTypeId))
|
||||
foundTrajectories.append(trajectoryTimeAware);
|
||||
}
|
||||
return foundTrajectories;
|
||||
|
||||
@@ -141,7 +141,7 @@ qint64 DdsHandler::currentPartitionTimeMSec() const
|
||||
void DdsHandler::onPartitionTimeChanged(const Core::PartitionTime ¤tTime)
|
||||
{
|
||||
m_elapsedTimer.restart();
|
||||
m_currentTimeMSec = currentTime.timeStamp();
|
||||
m_currentTimeMSec = currentTime.timeStamp;
|
||||
}
|
||||
|
||||
ProjectDataManagement::ChargeType DdsHandler::getChargeType(int chargeTypeId)
|
||||
|
||||
+1
-1
@@ -91,7 +91,7 @@ void EffectorStateMachine::stopAllTimer()
|
||||
|
||||
QString EffectorStateMachine::getStateStr(AreaEffectSimulation::AesEffectorState state)
|
||||
{
|
||||
switch (state.underlying())
|
||||
switch (state)
|
||||
{
|
||||
case AreaEffectSimulation::AesEffectorState::EsNotReadyToFire:
|
||||
return QStringLiteral("EstNotReadyToFire");
|
||||
|
||||
+21
-21
@@ -12,7 +12,7 @@ namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
HandlerAirSupportImpact::HandlerAirSupportImpact(MainHandler *mainHandler)
|
||||
: HandlerBaseTmpl<ObjectAirSupportImpact>(mainHandler, QStringLiteral("AirSupportImpact"), s_areaCount[AesType::AtAirSupportImpact], s_areaCountCentral[AesType::AtAirSupportImpact])
|
||||
: HandlerBaseTmpl<ObjectAirSupportImpact>(mainHandler, QStringLiteral("AirSupportImpact"), s_areaCount[static_cast<int>(AesType::AtAirSupportImpact)], s_areaCountCentral[static_cast<int>(AesType::AtAirSupportImpact)])
|
||||
, Interface::Fts::AirSupportImpactModifyRequestHandler(mainHandler->dds()->fts())
|
||||
, Interface::Fts::AirSupportImpactRemoveRequestHandler(mainHandler->dds()->fts())
|
||||
{}
|
||||
@@ -39,7 +39,7 @@ bool HandlerAirSupportImpact::init()
|
||||
ERROR_LOG(m_logger) << ret();
|
||||
return false;
|
||||
}
|
||||
if (totalAreas() >= s_maxActiveAreas[AesType::AtAirSupportImpact])
|
||||
if (totalAreas() >= s_maxActiveAreas[static_cast<int>(AesType::AtAirSupportImpact)])
|
||||
{
|
||||
ERROR_LOG(m_logger) << "More active air support in database than allowed - ignoring the rest!";
|
||||
delete ifs;
|
||||
@@ -57,29 +57,29 @@ bool HandlerAirSupportImpact::init()
|
||||
|
||||
int HandlerAirSupportImpact::totalAreas() const
|
||||
{
|
||||
return s_areaCount[AesType::AtAirSupportImpact];
|
||||
return s_areaCount[static_cast<int>(AesType::AtAirSupportImpact)];
|
||||
}
|
||||
|
||||
int HandlerAirSupportImpact::totalAreasCentral() const
|
||||
{
|
||||
return s_areaCountCentral[AesType::AtAirSupportImpact];
|
||||
return s_areaCountCentral[static_cast<int>(AesType::AtAirSupportImpact)];
|
||||
}
|
||||
|
||||
static void fillData(const AirSupportImpactModifyRequest &src, Database::AesAirSupportImpact &dst)
|
||||
{
|
||||
if (src.id() < 0) // is the id given as negative? set id -> used by OC-Laptop
|
||||
dst.id = src.id();
|
||||
if (src.id < 0) // is the id given as negative? set id -> used by OC-Laptop
|
||||
dst.id = src.id;
|
||||
|
||||
dst.impactPosition.rx() = src.impactPosition().lon();
|
||||
dst.impactPosition.ry() = src.impactPosition().lat();
|
||||
dst.name = QString::fromStdString(src.name());
|
||||
dst.effectStart = src.effectStart().is_set() && src.effectStart().get() > 0 ? QDateTime::fromMSecsSinceEpoch(src.effectStart().get()) : QDateTime();
|
||||
dst.impactPosition.rx() = src.impactPosition.lon;
|
||||
dst.impactPosition.ry() = src.impactPosition.lat;
|
||||
dst.name = QString::fromStdString(src.name);
|
||||
dst.effectStart = src.effectStart.is_set() && src.effectStart.get() > 0 ? QDateTime::fromMSecsSinceEpoch(src.effectStart.get()) : QDateTime();
|
||||
dst.effectDuration = 1000; // 1sec
|
||||
dst.partyId = src.partyId().is_set() ? src.partyId().get() : 0;
|
||||
dst.chargeTypeId = src.chargeTypeId();
|
||||
dst.participantId = src.participantId().is_set() ? src.participantId().get() : 0;
|
||||
dst.flightTime = src.flightTime();
|
||||
dst.externalId = src.externalId().is_set() ? src.externalId().get() : 0;
|
||||
dst.partyId = src.partyId.is_set() ? src.partyId.get() : 0;
|
||||
dst.chargeTypeId = src.chargeTypeId;
|
||||
dst.participantId = src.participantId.is_set() ? src.participantId.get() : 0;
|
||||
dst.flightTime = src.flightTime;
|
||||
dst.externalId = src.externalId.is_set() ? src.externalId.get() : 0;
|
||||
}
|
||||
|
||||
void HandlerAirSupportImpact::onAirSupportImpactModifyRequest(const rti::core::SampleIdentity &cookie,
|
||||
@@ -96,7 +96,7 @@ void HandlerAirSupportImpact::onAirSupportImpactModifyRequest(const rti::core::S
|
||||
|
||||
Core::FunctionReplyObject HandlerAirSupportImpact::airSupportImpactCreateRequest(const AirSupportImpactModifyRequest &request)
|
||||
{
|
||||
if (totalAreas() >= s_maxActiveAreas[AesType::AtAirSupportImpact] && request.effectStart().is_set())
|
||||
if (totalAreas() >= s_maxActiveAreas[static_cast<int>(AesType::AtAirSupportImpact)] && request.effectStart.is_set())
|
||||
{
|
||||
ERROR_LOG(m_logger) << LOGFUNCTION << " Too many active air support impacts, request:" << request;
|
||||
return Core::FunctionReplyObject(1, tr_lts("dds", "Too many active air support impacts."));
|
||||
@@ -135,13 +135,13 @@ Core::FunctionReplyObject HandlerAirSupportImpact::airSupportImpactCreateRequest
|
||||
Core::FunctionReplyObject HandlerAirSupportImpact::airSupportImpactModifyRequest(const AirSupportImpactModifyRequest &request)
|
||||
{
|
||||
Core::FunctionReplyObject ret;
|
||||
if (request.id() == 0 || ((request.id() < 0) && (getObjectFromMap(m_objectMap, std::abs(request.id()), ret) == nullptr)))
|
||||
if (request.id == 0 || ((request.id < 0) && (getObjectFromMap(m_objectMap, std::abs(request.id), ret) == nullptr)))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " handle as createRequest, request:" << request;
|
||||
return airSupportImpactCreateRequest(request);
|
||||
}
|
||||
|
||||
ObjectAirSupportImpact *ifs = getObjectFromMap(m_objectMap, std::abs(request.id()), ret);
|
||||
ObjectAirSupportImpact *ifs = getObjectFromMap(m_objectMap, std::abs(request.id), ret);
|
||||
if (ifs == nullptr)
|
||||
{
|
||||
ERROR_LOG(m_logger) << LOGFUNCTION << " getObjectFromMap failed, request:" << request;
|
||||
@@ -150,8 +150,8 @@ Core::FunctionReplyObject HandlerAirSupportImpact::airSupportImpactModifyRequest
|
||||
|
||||
// Anzahl aktiver Areas ist erreicht, der Wirkbeginn ist (soll) gesetzt sein, aber die Area war
|
||||
// vorher noch ohne Wirkbeginn
|
||||
if (totalAreas() >= s_maxActiveAreas[AesType::AtAirSupportImpact]
|
||||
&& request.effectStart().is_set()
|
||||
if (totalAreas() >= s_maxActiveAreas[static_cast<int>(AesType::AtAirSupportImpact)]
|
||||
&& request.effectStart.is_set()
|
||||
&& !ifs->isActivationTimeSet()
|
||||
&& !ifs->isObjectModifiable())
|
||||
{
|
||||
@@ -161,7 +161,7 @@ Core::FunctionReplyObject HandlerAirSupportImpact::airSupportImpactModifyRequest
|
||||
|
||||
Database::AesAirSupportImpact aes(ifs->data());
|
||||
fillData(request, aes);
|
||||
if (request.id() < 0 && checkStateForSfm(ifs))
|
||||
if (request.id < 0 && checkStateForSfm(ifs))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Overwrite air support impact Effect State for OC";
|
||||
aes.effectStateId = AesEffectState::EsPrepared;
|
||||
|
||||
@@ -70,10 +70,10 @@ HandlerBase::HandlerBase(MainHandler *mainHandler,
|
||||
s_mineAreaCreationInterval = nglSettings->settings()->value(
|
||||
QStringLiteral("AES/mineAreaCreationInterval"),20000).toInt();
|
||||
|
||||
s_maxActiveAreas[AesType::AtBCContamination] = nglSettings->settings()->value(
|
||||
s_maxActiveAreas[static_cast<int>(AesType::AtBCContamination)] = nglSettings->settings()->value(
|
||||
QStringLiteral("AES/maxActiveDecentralBCContamination"),defaultMaxDecBCNContaminations).toInt();
|
||||
|
||||
s_maxActiveAreas[AesType::AtNContamination] = nglSettings->settings()->value(
|
||||
s_maxActiveAreas[static_cast<int>(AesType::AtNContamination)] = nglSettings->settings()->value(
|
||||
QStringLiteral("AES/maxActiveDecentralNContamination"),defaultMaxDecBCNContaminations).toInt();
|
||||
|
||||
// Keep equal as the totalAreas sums the actual active areas up and compares to either N or BC
|
||||
@@ -83,15 +83,15 @@ HandlerBase::HandlerBase(MainHandler *mainHandler,
|
||||
|
||||
// Keep equal as the totalAreas sums the actual active areas up and compares to either Area or Single
|
||||
// It is not distinguished any more. Therefore 50 (as the sum) ist the actual value for All Explosion Areas
|
||||
s_maxActiveAreas[AesType::AtExplosionArea] = nglSettings->settings()->value(
|
||||
s_maxActiveAreas[static_cast<int>(AesType::AtExplosionArea)] = nglSettings->settings()->value(
|
||||
QStringLiteral("AES/maxActiveDecentralExplosionAreas"),defaultMaxDecExplosions).toInt();
|
||||
s_maxActiveAreas[AesType::AtExplosionSingle] = nglSettings->settings()->value(
|
||||
s_maxActiveAreas[static_cast<int>(AesType::AtExplosionSingle)] = nglSettings->settings()->value(
|
||||
QStringLiteral("AES/maxActiveDecentralExplosionSingle"),defaultMaxDecExplosions).toInt();
|
||||
|
||||
s_maxActiveAreas[AesType::AtExplosionCluster] = nglSettings->settings()->value(
|
||||
s_maxActiveAreas[static_cast<int>(AesType::AtExplosionCluster)] = nglSettings->settings()->value(
|
||||
QStringLiteral("AES/maxActiveDecentralExplosionClusters"),defaultMaxDecExplosionCluster).toInt();
|
||||
|
||||
s_maxActiveAreas[AesType::AtMineArea] = nglSettings->settings()->value(
|
||||
s_maxActiveAreas[static_cast<int>(AesType::AtMineArea)] = nglSettings->settings()->value(
|
||||
QStringLiteral("AES/maxActiveDecentralMineAreas"),defaultMaxDecMineAreas).toInt();
|
||||
|
||||
|
||||
@@ -105,60 +105,60 @@ HandlerBase::HandlerBase(MainHandler *mainHandler,
|
||||
s_safePzAbwWMiCount = nglSettings->settings()->value(
|
||||
QStringLiteral("AES/reservePzAbwWMi"),defaultReservePzAbwWMi).toInt();
|
||||
|
||||
s_maxActiveAreas[AesType::AtFunctionalArea] = nglSettings->settings()->value(
|
||||
s_maxActiveAreas[static_cast<int>(AesType::AtFunctionalArea)] = nglSettings->settings()->value(
|
||||
QStringLiteral("AES/maxActiveDecentralFunctionalAreas"),defaultMaxDecFunctionalAreas).toInt();
|
||||
|
||||
s_maxActiveAreas[AesType::AtTechnicalArea] = nglSettings->settings()->value(
|
||||
s_maxActiveAreas[static_cast<int>(AesType::AtTechnicalArea)] = nglSettings->settings()->value(
|
||||
QStringLiteral("AES/maxActiveDecentralTechnicalAreas"),defaultMaxDecTechnicalAreas).toInt();
|
||||
|
||||
s_maxActiveAreas[AesType::AtGasPipe] = nglSettings->settings()->value(
|
||||
s_maxActiveAreas[static_cast<int>(AesType::AtGasPipe)] = nglSettings->settings()->value(
|
||||
QStringLiteral("AES/maxActiveDecentralGasPipes"),defaultMaxDecGasPipes).toInt();
|
||||
|
||||
s_maxActiveAreas[AesType::AtDusSingleMine] = nglSettings->settings()->value(
|
||||
s_maxActiveAreas[static_cast<int>(AesType::AtDusSingleMine)] = nglSettings->settings()->value(
|
||||
QStringLiteral("AES/maxActiveDecentralDusSingleMines"),defaultMaxDecDusSingleMines).toInt();
|
||||
|
||||
s_maxActiveAreas[AesType::AtAirSupportImpact] = 2147483647; // unlimited
|
||||
s_maxActiveAreas[static_cast<int>(AesType::AtAirSupportImpact)] = 2147483647; // unlimited
|
||||
|
||||
// Central
|
||||
s_maxActiveAreasCentral[AesType::AtBoobyTrap] = nglSettings->settings()->value(
|
||||
s_maxActiveAreasCentral[static_cast<int>(AesType::AtBoobyTrap)] = nglSettings->settings()->value(
|
||||
QStringLiteral("AES/maxActiveCentralBoobyTraps"),defaultMaxCenBoobyTraps).toInt();
|
||||
s_maxActiveAreasCentral[AesType::AtBCContamination] = nglSettings->settings()->value(
|
||||
s_maxActiveAreasCentral[static_cast<int>(AesType::AtBCContamination)] = nglSettings->settings()->value(
|
||||
QStringLiteral("AES/maxActiveCentralBCContamination"),defaultMaxCenBCNContaminations).toInt();
|
||||
s_maxActiveAreasCentral[AesType::AtNContamination] = nglSettings->settings()->value(
|
||||
s_maxActiveAreasCentral[static_cast<int>(AesType::AtNContamination)] = nglSettings->settings()->value(
|
||||
QStringLiteral("AES/maxActiveCentralNContamination"),defaultMaxCenBCNContaminations).toInt();
|
||||
|
||||
// Keep equal as the totalAreas sums the actual active areas up and compares to either Area or Single
|
||||
// It is not distinguished any more. Therefore 200 (as the sum) ist the actual value for All Explosion Areas
|
||||
s_maxActiveAreasCentral[AesType::AtExplosionArea] = nglSettings->settings()->value(
|
||||
s_maxActiveAreasCentral[static_cast<int>(AesType::AtExplosionArea)] = nglSettings->settings()->value(
|
||||
QStringLiteral("AES/maxActiveCentralExplosionAreas"),defaultMaxCenExplosions).toInt();
|
||||
|
||||
s_maxActiveAreasCentral[AesType::AtExplosionSingle] = nglSettings->settings()->value(
|
||||
s_maxActiveAreasCentral[static_cast<int>(AesType::AtExplosionSingle)] = nglSettings->settings()->value(
|
||||
QStringLiteral("AES/maxActiveCentralExplosionSingle"),defaultMaxCenExplosions).toInt();
|
||||
|
||||
|
||||
s_maxActiveAreasCentral[AesType::AtOffRouteMine] = nglSettings->settings()->value(
|
||||
s_maxActiveAreasCentral[static_cast<int>(AesType::AtOffRouteMine)] = nglSettings->settings()->value(
|
||||
QStringLiteral("AES/maxActiveCentralOffRouteMines"),defaultMaxCenOffRouteMines).toInt();
|
||||
|
||||
s_maxActiveAreasCentral[AesType::AtMineArea] = nglSettings->settings()->value(
|
||||
s_maxActiveAreasCentral[static_cast<int>(AesType::AtMineArea)] = nglSettings->settings()->value(
|
||||
QStringLiteral("AES/maxActiveCentralMineAreas"),defaultMaxCenMineAreas).toInt();
|
||||
|
||||
s_maxActiveAreasCentral[AesType::AtFunctionalArea] = nglSettings->settings()->value(
|
||||
s_maxActiveAreasCentral[static_cast<int>(AesType::AtFunctionalArea)] = nglSettings->settings()->value(
|
||||
QStringLiteral("AES/maxActiveCentralFunctionalAreas"),defaultMaxCenFunctionalAreas).toInt();
|
||||
|
||||
s_maxActiveAreasCentral[AesType::AtTechnicalArea] = nglSettings->settings()->value(
|
||||
s_maxActiveAreasCentral[static_cast<int>(AesType::AtTechnicalArea)] = nglSettings->settings()->value(
|
||||
QStringLiteral("AES/maxActiveCentralTechnicalAreas"),defaultMaxCenTechnicalAreas).toInt();
|
||||
|
||||
s_maxActiveAreasCentral[AesType::AtGasPipe] = nglSettings->settings()->value(
|
||||
s_maxActiveAreasCentral[static_cast<int>(AesType::AtGasPipe)] = nglSettings->settings()->value(
|
||||
QStringLiteral("AES/maxActiveCentralGasPipes"),defaultMaxCenGasPipes).toInt();
|
||||
|
||||
s_maxActiveAreasCentral[AesType::AtDusSingleMine] = nglSettings->settings()->value(
|
||||
s_maxActiveAreasCentral[static_cast<int>(AesType::AtDusSingleMine)] = nglSettings->settings()->value(
|
||||
QStringLiteral("AES/maxActiveCentralDusSingleMines"),defaultMaxCenDusSingleMines).toInt();
|
||||
|
||||
s_maxActiveAreasCentral[AesType::AtExplosionCluster] = nglSettings->settings()->value(
|
||||
s_maxActiveAreasCentral[static_cast<int>(AesType::AtExplosionCluster)] = nglSettings->settings()->value(
|
||||
QStringLiteral("AES/maxActiveCentralExplosionClusters"),defaultMaxCenExplosionCluster).toInt();
|
||||
s_maxActiveAreasCentral[AesType::AtEffectCluster] = nglSettings->settings()->value(
|
||||
s_maxActiveAreasCentral[static_cast<int>(AesType::AtEffectCluster)] = nglSettings->settings()->value(
|
||||
QStringLiteral("AES/maxActiveCentralEffectClusters"),defaultMaxCenEffectCluster).toInt();
|
||||
|
||||
s_maxActiveAreasCentral[AesType::AtAirSupportImpact] =
|
||||
s_maxActiveAreasCentral[static_cast<int>(AesType::AtAirSupportImpact)] =
|
||||
2147483647; // unlimited
|
||||
}
|
||||
@@ -57,7 +57,7 @@ protected:
|
||||
bool isLockedTopic(int id)
|
||||
{
|
||||
AreaEffectSimulation::AesItem data;
|
||||
data.id(id);
|
||||
data.id = id;
|
||||
int exId = m_mainHandler->dds()->ddsConnector()->getPartitionId();
|
||||
return m_mainHandler->dds()->topicLockMaster()->isLocked<AreaEffectSimulation::AesItem>(data, exId);
|
||||
}
|
||||
@@ -187,30 +187,30 @@ public:
|
||||
return Core::FunctionReplyObject(id, tr_lts("dds", "Effect simulation with id %1 not found.")).arg(id);
|
||||
|
||||
bool succ = false;
|
||||
switch (effectState.underlying())
|
||||
switch (effectState)
|
||||
{
|
||||
case AesEffectState_def::EsReceived:
|
||||
case AesEffectState::EsReceived:
|
||||
succ = ifs->trySwitchToReceived();
|
||||
break;
|
||||
case AesEffectState_def::EsCreated:
|
||||
case AesEffectState::EsCreated:
|
||||
succ = ifs->trySwitchToCreated();
|
||||
break;
|
||||
case AesEffectState_def::EsPrepared:
|
||||
case AesEffectState::EsPrepared:
|
||||
succ = ifs->trySwitchToPrepared();
|
||||
break;
|
||||
case AesEffectState_def::EsFired:
|
||||
case AesEffectState::EsFired:
|
||||
succ = ifs->trySwitchToFired();
|
||||
break;
|
||||
case AesEffectState_def::EsActivated:
|
||||
case AesEffectState::EsActivated:
|
||||
succ = !ifs->activateObjectNow().error();
|
||||
break;
|
||||
case AesEffectState_def::EsPaused:
|
||||
case AesEffectState::EsPaused:
|
||||
succ = ifs->trySwitchToPaused();
|
||||
break;
|
||||
case AesEffectState_def::EsExpired:
|
||||
case AesEffectState::EsExpired:
|
||||
succ = ifs->trySwitchToExpired();
|
||||
break;
|
||||
case AesEffectState_def::EsRemoved:
|
||||
case AesEffectState::EsRemoved:
|
||||
succ = ifs->trySwitchToRemoved();
|
||||
break;
|
||||
default:
|
||||
@@ -218,14 +218,14 @@ public:
|
||||
}
|
||||
if (succ)
|
||||
return Core::FunctionReplyObject();
|
||||
return Core::FunctionReplyObject(id, tr_lts("dds", "Could not switch effect simulation with id %1 to state with id %2.")).arg(id).arg(effectState.underlying());
|
||||
return Core::FunctionReplyObject(id, tr_lts("dds", "Could not switch effect simulation with id %1 to state with id %2.")).arg(id).arg(effectState);
|
||||
}
|
||||
|
||||
Core::FunctionReplyObject aesItemRemove(const Core::RemoveElementRequest &request)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "on" << m_typeName << "RemoveRequest: " << request;
|
||||
|
||||
int id = request.id();
|
||||
int id = request.id;
|
||||
|
||||
Core::FunctionReplyObject ret;
|
||||
Obj *ifs = getObjectFromMap(m_objectMap, id, ret);
|
||||
@@ -242,11 +242,11 @@ public:
|
||||
|
||||
Core::FunctionReplyObject removeReply(bool (AreaEffectSimulation::DatabaseInterface::*dbRemoveMethod)(qint32), const Core::RemoveElementRequest &request)
|
||||
{
|
||||
if (request.id() >= 0)
|
||||
if (request.id >= 0)
|
||||
return aesItemRemove(request);
|
||||
|
||||
// else force = negative id
|
||||
qint32 id = request.id() * -1;
|
||||
qint32 id = request.id * -1;
|
||||
Obj *ifs = m_objectMap.value(id);
|
||||
|
||||
if (ifs == nullptr)
|
||||
|
||||
+83
-83
@@ -14,7 +14,7 @@ namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
HandlerBCContamination::HandlerBCContamination(MainHandler *mainHandler)
|
||||
: HandlerBaseTmpl<ObjectBCContamination>(mainHandler, QStringLiteral("BCContamination"), s_areaCount[AesType::AtBCContamination], s_areaCountCentral[AesType::AtBCContamination])
|
||||
: HandlerBaseTmpl<ObjectBCContamination>(mainHandler, QStringLiteral("BCContamination"), s_areaCount[static_cast<int>(AesType::AtBCContamination)], s_areaCountCentral[static_cast<int>(AesType::AtBCContamination)])
|
||||
, Interface::Fts::BCContaminationModifyRequestHandler(mainHandler->dds()->fts())
|
||||
, Interface::Fts::BCContaminationRemoveRequestHandler(mainHandler->dds()->fts())
|
||||
{}
|
||||
@@ -40,7 +40,7 @@ bool HandlerBCContamination::init()
|
||||
}
|
||||
if(!ifs->data().isCentral)
|
||||
{
|
||||
if (totalAreas() >= (s_maxActiveAreas[AesType::AtBCContamination] + s_maxActiveAreas[AesType::AtNContamination]))
|
||||
if (totalAreas() >= (s_maxActiveAreas[static_cast<int>(AesType::AtBCContamination)] + s_maxActiveAreas[static_cast<int>(AesType::AtNContamination)]))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "More active bc contaminationsin database than allowed - ignoring the rest!";
|
||||
ifs->removeObject();
|
||||
@@ -50,7 +50,7 @@ bool HandlerBCContamination::init()
|
||||
}
|
||||
else
|
||||
{
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[AesType::AtBCContamination] + s_maxActiveAreasCentral[AesType::AtNContamination]))
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[static_cast<int>(AesType::AtBCContamination)] + s_maxActiveAreasCentral[static_cast<int>(AesType::AtNContamination)]))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "More active bc contaminationsin database than allowed - ignoring the rest!";
|
||||
ifs->removeObject();
|
||||
@@ -85,18 +85,18 @@ bool HandlerBCContamination::init()
|
||||
|
||||
int HandlerBCContamination::totalAreas() const
|
||||
{
|
||||
return s_areaCount[AesType::AtBCContamination] + s_areaCount[AesType::AtNContamination];
|
||||
return s_areaCount[static_cast<int>(AesType::AtBCContamination)] + s_areaCount[static_cast<int>(AesType::AtNContamination)];
|
||||
}
|
||||
|
||||
int HandlerBCContamination::totalAreasCentral() const
|
||||
{
|
||||
return s_areaCountCentral[AesType::AtBCContamination] + s_areaCountCentral[AesType::AtNContamination];
|
||||
return s_areaCountCentral[static_cast<int>(AesType::AtBCContamination)] + s_areaCountCentral[static_cast<int>(AesType::AtNContamination)];
|
||||
}
|
||||
|
||||
void HandlerBCContamination::onChangedToCentral()
|
||||
{
|
||||
s_areaCount[AesType::AtBCContamination]--;
|
||||
s_areaCountCentral[AesType::AtBCContamination]++;
|
||||
s_areaCount[static_cast<int>(AesType::AtBCContamination)]--;
|
||||
s_areaCountCentral[static_cast<int>(AesType::AtBCContamination)]++;
|
||||
|
||||
DEBUG_LOG(m_logger) << "m_areaCount after Recount = " << m_areaCount;
|
||||
DEBUG_LOG(m_logger) << "m_areaCountCentral after Recount = " << m_areaCountCentral;
|
||||
@@ -105,39 +105,39 @@ void HandlerBCContamination::onChangedToCentral()
|
||||
|
||||
static void fillData(const BCContaminationModifyRequest &src, Database::AesBCContamination &dst)
|
||||
{
|
||||
if (src.id() < 0) // is the id given as negative? set id -> used by OC-laptop
|
||||
dst.id = src.id();
|
||||
if (src.id < 0) // is the id given as negative? set id -> used by OC-laptop
|
||||
dst.id = src.id;
|
||||
|
||||
dst.name = QString::fromStdString(src.name());
|
||||
dst.effectStart = src.effectStart().is_set() && src.effectStart().get() > 0 ? QDateTime::fromMSecsSinceEpoch(src.effectStart().get()) : QDateTime();
|
||||
dst.effectDuration = src.effectDuration();
|
||||
dst.impactPosition.rx() = src.impactPosition().lon();
|
||||
dst.impactPosition.ry() = src.impactPosition().lat();
|
||||
dst.impactRadius = src.impactRadius();
|
||||
dst.partyId = src.partyId().is_set() ? src.partyId().get() : 0;
|
||||
dst.chargeTypeId = src.chargeTypeId();
|
||||
dst.participantId = src.participantId().is_set() ? src.participantId().get() : 0;
|
||||
dst.weatherSourceId = src.weatherSource();
|
||||
dst.externalId = src.externalId().is_set() ? src.externalId().get() : 0;
|
||||
dst.upperOffset = src.upperOffset();
|
||||
dst.lowerOffset = src.lowerOffset();
|
||||
dst.name = QString::fromStdString(src.name);
|
||||
dst.effectStart = src.effectStart.is_set() && src.effectStart.get() > 0 ? QDateTime::fromMSecsSinceEpoch(src.effectStart.get()) : QDateTime();
|
||||
dst.effectDuration = src.effectDuration;
|
||||
dst.impactPosition.rx() = src.impactPosition.lon;
|
||||
dst.impactPosition.ry() = src.impactPosition.lat;
|
||||
dst.impactRadius = src.impactRadius;
|
||||
dst.partyId = src.partyId.is_set() ? src.partyId.get() : 0;
|
||||
dst.chargeTypeId = src.chargeTypeId;
|
||||
dst.participantId = src.participantId.is_set() ? src.participantId.get() : 0;
|
||||
dst.weatherSourceId = src.weatherSource;
|
||||
dst.externalId = src.externalId.is_set() ? src.externalId.get() : 0;
|
||||
dst.upperOffset = src.upperOffset;
|
||||
dst.lowerOffset = src.lowerOffset;
|
||||
|
||||
// weather parameter are delivered, when adding in OC-laptop
|
||||
if (src.weatherPosition().is_set())
|
||||
if (src.weatherPosition.is_set())
|
||||
{
|
||||
dst.weatherPosition.rx() = src.weatherPosition().get().lon();
|
||||
dst.weatherPosition.ry() = src.weatherPosition().get().lat();
|
||||
dst.weatherPosition.rx() = src.weatherPosition.get().lon;
|
||||
dst.weatherPosition.ry() = src.weatherPosition.get().lat;
|
||||
}
|
||||
else
|
||||
dst.weatherPosition = dst.impactPosition; // initial, is not used during update therefore it's ok here
|
||||
if(src.windSpeed().is_set())
|
||||
dst.windSpeed = src.windSpeed().get();
|
||||
if(src.propagationDirection().is_set())
|
||||
dst.propagationDirection = src.propagationDirection().get();
|
||||
if(src.weatherTimestamp().is_set())
|
||||
dst.weatherTimestamp = QDateTime::fromMSecsSinceEpoch(src.weatherTimestamp().get());
|
||||
else if(src.effectStart().is_set())
|
||||
dst.weatherTimestamp = QDateTime::fromMSecsSinceEpoch(src.effectStart().get());
|
||||
if(src.windSpeed.is_set())
|
||||
dst.windSpeed = src.windSpeed.get();
|
||||
if(src.propagationDirection.is_set())
|
||||
dst.propagationDirection = src.propagationDirection.get();
|
||||
if(src.weatherTimestamp.is_set())
|
||||
dst.weatherTimestamp = QDateTime::fromMSecsSinceEpoch(src.weatherTimestamp.get());
|
||||
else if(src.effectStart.is_set())
|
||||
dst.weatherTimestamp = QDateTime::fromMSecsSinceEpoch(src.effectStart.get());
|
||||
}
|
||||
|
||||
void HandlerBCContamination::onBCContaminationModifyRequest(const rti::core::SampleIdentity &cookie,
|
||||
@@ -170,7 +170,7 @@ Core::FunctionReplyObject HandlerBCContamination::bCContaminationCreateRequest(c
|
||||
|
||||
if (ifs->data().isCentral)
|
||||
{
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[AesType::AtBCContamination] + s_maxActiveAreasCentral[AesType::AtNContamination]) && request.effectStart().is_set())
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[static_cast<int>(AesType::AtBCContamination)] + s_maxActiveAreasCentral[static_cast<int>(AesType::AtNContamination)]) && request.effectStart.is_set())
|
||||
{
|
||||
ifs->removeObject(); //Not finally deleted from db after this,Fallback if DB deletion is not working correct
|
||||
ifs->removeObjectFromDb();
|
||||
@@ -180,7 +180,7 @@ Core::FunctionReplyObject HandlerBCContamination::bCContaminationCreateRequest(c
|
||||
}
|
||||
else
|
||||
{
|
||||
if (totalAreas() >= (s_maxActiveAreas[AesType::AtBCContamination] + s_maxActiveAreas[AesType::AtNContamination]) && request.effectStart().is_set())
|
||||
if (totalAreas() >= (s_maxActiveAreas[static_cast<int>(AesType::AtBCContamination)] + s_maxActiveAreas[static_cast<int>(AesType::AtNContamination)]) && request.effectStart.is_set())
|
||||
{
|
||||
|
||||
ifs->removeObject(); //Not finally deleted from db after this,Fallback if DB deletion is not working correct
|
||||
@@ -208,23 +208,23 @@ Core::FunctionReplyObject HandlerBCContamination::bCContaminationCreateRequest(c
|
||||
}
|
||||
m_objectMap.insert(ifs->id(), ifs);
|
||||
|
||||
if (request.withDangerArea().is_set() && request.withDangerArea().get())
|
||||
if (request.withDangerArea.is_set() && request.withDangerArea.get())
|
||||
{
|
||||
DangerAreaModifyRequest req;
|
||||
req.id(0);
|
||||
req.id = 0;
|
||||
#ifdef GUEZ_MODE
|
||||
const QString name = QString::fromStdString(tr_lts("dds","%1 - Gefahrenbereich")).arg(ifs->data().name);
|
||||
#else
|
||||
const QString name = QString::fromStdString(tr_lts("dds","%1 - Danger Area")).arg(ifs->data().name);
|
||||
#endif
|
||||
req.name(name.toStdString());
|
||||
req.partyId(ifs->data().partyId);
|
||||
req.effectDuration(ifs->data().effectDuration);
|
||||
req.chargeTypeId(ifs->data().chargeTypeId);
|
||||
req.segments(Polygons::dangerAreaDefaultSegments(ifs->data().impactPosition, ifs->data().impactRadius + 50));
|
||||
req.associatedAesId(ifs->data().id);
|
||||
req.name = name.toStdString();
|
||||
req.partyId = ifs->data().partyId;
|
||||
req.effectDuration = ifs->data().effectDuration;
|
||||
req.chargeTypeId = ifs->data().chargeTypeId;
|
||||
req.segments = Polygons::dangerAreaDefaultSegments(ifs->data().impactPosition, ifs->data().impactRadius + 50);
|
||||
req.associatedAesId = ifs->data().id;
|
||||
if(ifs->data().effectStart.isValid())
|
||||
req.effectStart(ifs->data().effectStart.toMSecsSinceEpoch());
|
||||
req.effectStart = ifs->data().effectStart.toMSecsSinceEpoch();
|
||||
Core::FunctionReplyObject bretDangerArea= m_mainHandler->dangerAreaHandler()->dangerAreaCreateRequest(req);
|
||||
if (bretDangerArea.error())
|
||||
ERROR_LOG(m_logger)<<"Couldn't create associated dangerArea to bcContamination: "<<ifs->data().name;
|
||||
@@ -238,27 +238,27 @@ Core::FunctionReplyObject HandlerBCContamination::bCContaminationModifyRequest(c
|
||||
{
|
||||
Core::FunctionReplyObject ret;
|
||||
ObjectBCContamination *ifs = nullptr;
|
||||
if (request.externalId().is_set() && request.externalId().get() > 0)
|
||||
ifs = getObjectFromMapByExternalId(m_objectMap, request.externalId().get(), ret);
|
||||
if (request.externalId.is_set() && request.externalId.get() > 0)
|
||||
ifs = getObjectFromMapByExternalId(m_objectMap, request.externalId.get(), ret);
|
||||
|
||||
if (!ifs)
|
||||
{
|
||||
if (request.id() == 0 || ((request.id() < 0) && !getObjectFromMap(m_objectMap, std::abs(request.id()), ret)))
|
||||
if (request.id == 0 || ((request.id < 0) && !getObjectFromMap(m_objectMap, std::abs(request.id), ret)))
|
||||
return bCContaminationCreateRequest(request);
|
||||
|
||||
ifs = getObjectFromMap(m_objectMap, std::abs(request.id()), ret);
|
||||
ifs = getObjectFromMap(m_objectMap, std::abs(request.id), ret);
|
||||
|
||||
if (!ifs)
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (request.effectStart().is_set() && (request.effectStart().get() + request.effectDuration() < m_mainHandler->dds()->currentPartitionTime().toMSecsSinceEpoch()))
|
||||
if (request.effectStart.is_set() && (request.effectStart.get() + request.effectDuration < m_mainHandler->dds()->currentPartitionTime().toMSecsSinceEpoch()))
|
||||
return removeObject(ifs);
|
||||
|
||||
Database::AesBCContamination aea(ifs->data());
|
||||
fillData(request, aea);
|
||||
DEBUG_LOG(m_logger) << "request.upperOffset=" << request.upperOffset()
|
||||
<< " request.lowerOffset=" << request.lowerOffset()
|
||||
DEBUG_LOG(m_logger) << "request.upperOffset=" << request.upperOffset
|
||||
<< " request.lowerOffset=" << request.lowerOffset
|
||||
<< " aea.upperOffset=" << aea.upperOffset
|
||||
<< " aea.lowerOffset=" << aea.lowerOffset;
|
||||
|
||||
@@ -277,21 +277,21 @@ Core::FunctionReplyObject HandlerBCContamination::bCContaminationModifyRequest(c
|
||||
/*!
|
||||
* If the effect start added after creation, the max amount need to be checked
|
||||
*/
|
||||
if(!ifs->isActivationTimeSet() && request.effectStart().is_set())
|
||||
if(!ifs->isActivationTimeSet() && request.effectStart.is_set())
|
||||
{
|
||||
|
||||
if (isCentral)
|
||||
{
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[AesType::AtBCContamination] + s_maxActiveAreasCentral[AesType::AtNContamination])
|
||||
/*&& request.effectStart().is_set()*/)
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[static_cast<int>(AesType::AtBCContamination)] + s_maxActiveAreasCentral[static_cast<int>(AesType::AtNContamination)])
|
||||
/*&& request.effectStart.is_set()*/)
|
||||
{
|
||||
return Core::FunctionReplyObject(1, tr_lts("dds", "Too many active central B/C or N contamination areas."));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (totalAreas() >= (s_maxActiveAreas[AesType::AtBCContamination] + s_maxActiveAreas[AesType::AtNContamination])
|
||||
/*&& request.effectStart().is_set()*/)
|
||||
if (totalAreas() >= (s_maxActiveAreas[static_cast<int>(AesType::AtBCContamination)] + s_maxActiveAreas[static_cast<int>(AesType::AtNContamination)])
|
||||
/*&& request.effectStart.is_set()*/)
|
||||
{
|
||||
return Core::FunctionReplyObject(1, tr_lts("dds", "Too many active B/C or N contamination areas."));
|
||||
}
|
||||
@@ -299,7 +299,7 @@ Core::FunctionReplyObject HandlerBCContamination::bCContaminationModifyRequest(c
|
||||
}
|
||||
|
||||
// For counting, only Elements being at least prepared are important:
|
||||
if (request.effectStart().is_set() && ifs->isObjectModifiable())
|
||||
if (request.effectStart.is_set() && ifs->isObjectModifiable())
|
||||
{
|
||||
|
||||
DEBUG_LOG(m_logger) << "isCentral: " << isCentral;
|
||||
@@ -311,8 +311,8 @@ Core::FunctionReplyObject HandlerBCContamination::bCContaminationModifyRequest(c
|
||||
// Change from central to training area
|
||||
if (wasCentral)
|
||||
{
|
||||
if (totalAreas() >= (s_maxActiveAreas[AesType::AtBCContamination] + s_maxActiveAreas[AesType::AtNContamination]))
|
||||
return Core::FunctionReplyObject(request.id(), tr_lts("dds", "Too many active B/C or N contamination areas."));
|
||||
if (totalAreas() >= (s_maxActiveAreas[static_cast<int>(AesType::AtBCContamination)] + s_maxActiveAreas[static_cast<int>(AesType::AtNContamination)]))
|
||||
return Core::FunctionReplyObject(request.id, tr_lts("dds", "Too many active B/C or N contamination areas."));
|
||||
|
||||
m_areaCount++;
|
||||
m_areaCountCentral--;
|
||||
@@ -321,8 +321,8 @@ Core::FunctionReplyObject HandlerBCContamination::bCContaminationModifyRequest(c
|
||||
}
|
||||
else // Change from training area to central
|
||||
{
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[AesType::AtBCContamination] + s_maxActiveAreasCentral[AesType::AtNContamination]))
|
||||
return Core::FunctionReplyObject(request.id(), tr_lts("dds", "Too many active central B/C or N contamination areas."));
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[static_cast<int>(AesType::AtBCContamination)] + s_maxActiveAreasCentral[static_cast<int>(AesType::AtNContamination)]))
|
||||
return Core::FunctionReplyObject(request.id, tr_lts("dds", "Too many active central B/C or N contamination areas."));
|
||||
m_areaCount--;
|
||||
m_areaCountCentral++;
|
||||
DEBUG_LOG(m_logger) << "s_areaCount[AesType::AtBCContamination] = " << m_areaCount;
|
||||
@@ -331,7 +331,7 @@ Core::FunctionReplyObject HandlerBCContamination::bCContaminationModifyRequest(c
|
||||
}
|
||||
}
|
||||
|
||||
if (request.id() < 0 && checkStateForSfm(ifs))
|
||||
if (request.id < 0 && checkStateForSfm(ifs))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Overwrite bc contamination Effect State for OC";
|
||||
aea.effectStateId = AesEffectState::EsPrepared;
|
||||
@@ -346,44 +346,44 @@ Core::FunctionReplyObject HandlerBCContamination::bCContaminationModifyRequest(c
|
||||
DEBUG_LOG(m_logger)<<"[bCContaminationModifyRequest] modify danger area associated to bcId: " <<ifs->id()
|
||||
<<" dangerAreaId: "<<dangerArea.id;
|
||||
DangerAreaModifyRequest dangerRequest;
|
||||
dangerRequest.id(dangerArea.id);
|
||||
dangerRequest.name(QStringLiteral("%1").arg(dangerArea.name).toStdString());
|
||||
dangerRequest.partyId(dangerArea.partyId);
|
||||
dangerRequest.effectDuration(dangerArea.effectDuration);
|
||||
dangerRequest.chargeTypeId(dangerArea.chargeTypeId);
|
||||
dangerRequest.segments(Polygons::dangerAreaDefaultSegments(ifs->data().impactPosition, ifs->data().impactRadius + 50));
|
||||
dangerRequest.associatedAesId(ifs->data().id);
|
||||
dangerRequest.id = dangerArea.id;
|
||||
dangerRequest.name = QStringLiteral("%1").arg(dangerArea.name).toStdString();
|
||||
dangerRequest.partyId = dangerArea.partyId;
|
||||
dangerRequest.effectDuration = dangerArea.effectDuration;
|
||||
dangerRequest.chargeTypeId = dangerArea.chargeTypeId;
|
||||
dangerRequest.segments = Polygons::dangerAreaDefaultSegments(ifs->data().impactPosition, ifs->data().impactRadius + 50);
|
||||
dangerRequest.associatedAesId = ifs->data().id;
|
||||
if(ifs->data().effectStart.isValid())
|
||||
dangerRequest.effectStart(ifs->data().effectStart.toMSecsSinceEpoch());
|
||||
dangerRequest.effectStart = ifs->data().effectStart.toMSecsSinceEpoch();
|
||||
|
||||
Core::FunctionReplyObject bretDangerArea= m_mainHandler->dangerAreaHandler()->dangerAreaModifyRequest(dangerRequest);
|
||||
if (bretDangerArea.error())
|
||||
ERROR_LOG(m_logger)<<"[bCContaminationModifyRequest] couldn't update danger area: bccontamination.id: "<<ifs->id()
|
||||
<<" dangerArea.name: "<<dangerRequest.name();
|
||||
<<" dangerArea.name: "<<dangerRequest.name;
|
||||
}
|
||||
else if (request.withDangerArea().is_set() && request.withDangerArea().get())
|
||||
else if (request.withDangerArea.is_set() && request.withDangerArea.get())
|
||||
{
|
||||
DEBUG_LOG(m_logger)<<"[bCContaminationModifyRequest] add new danger area to bcId: " <<ifs->id();
|
||||
DangerAreaModifyRequest newDangerRequest;
|
||||
newDangerRequest.id(0);
|
||||
newDangerRequest.id = 0;
|
||||
#ifdef GUEZ_MODE
|
||||
const QString name = QString::fromStdString(tr_lts("dds","%1 - Gefahrenbereich")).arg(ifs->data().name);
|
||||
#else
|
||||
const QString name = QString::fromStdString(tr_lts("dds","%1 - Danger Area")).arg(ifs->data().name);
|
||||
#endif
|
||||
newDangerRequest.name(name.toStdString());
|
||||
newDangerRequest.partyId(ifs->data().partyId);
|
||||
newDangerRequest.effectDuration(ifs->data().effectDuration);
|
||||
newDangerRequest.chargeTypeId(ifs->data().chargeTypeId);
|
||||
newDangerRequest.segments(Polygons::dangerAreaDefaultSegments(ifs->data().impactPosition, ifs->data().impactRadius + 50));
|
||||
newDangerRequest.associatedAesId(ifs->data().id);
|
||||
newDangerRequest.name = name.toStdString();
|
||||
newDangerRequest.partyId = ifs->data().partyId;
|
||||
newDangerRequest.effectDuration = ifs->data().effectDuration;
|
||||
newDangerRequest.chargeTypeId = ifs->data().chargeTypeId;
|
||||
newDangerRequest.segments = Polygons::dangerAreaDefaultSegments(ifs->data().impactPosition, ifs->data().impactRadius + 50);
|
||||
newDangerRequest.associatedAesId = ifs->data().id;
|
||||
if(ifs->data().effectStart.isValid())
|
||||
newDangerRequest.effectStart(ifs->data().effectStart.toMSecsSinceEpoch());
|
||||
newDangerRequest.effectStart = ifs->data().effectStart.toMSecsSinceEpoch();
|
||||
|
||||
Core::FunctionReplyObject bretDangerArea = m_mainHandler->dangerAreaHandler()->dangerAreaCreateRequest(newDangerRequest);
|
||||
if (bretDangerArea.error())
|
||||
ERROR_LOG(m_logger)<<"[bCContaminationModifyRequest] couldn't add danger area: bccontamination.id: "<<ifs->id()
|
||||
<<" dangerArea.name: "<<newDangerRequest.name();
|
||||
<<" dangerArea.name: "<<newDangerRequest.name;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -399,12 +399,12 @@ void HandlerBCContamination::onBCContaminationRemoveRequest(const rti::core::Sam
|
||||
if (ret)
|
||||
{
|
||||
Database::AesDangerArea dangerArea;
|
||||
if (m_mainHandler->dangerAreaHandler()->getDangerAreaByAssociatedAesId(request.id(), &dangerArea))
|
||||
if (m_mainHandler->dangerAreaHandler()->getDangerAreaByAssociatedAesId(request.id, &dangerArea))
|
||||
{
|
||||
bool bret = m_mainHandler->dangerAreaHandler()->dangerAreaRemoveRequest(Core::RemoveElementRequest(dangerArea.id));
|
||||
if (!bret)
|
||||
ERROR_LOG(m_logger)<<"[onBCContaminationRemoveRequest] couldn't remove danger area: "<<dangerArea.id
|
||||
<<" associated with to bc contamination id: "<<request.id();
|
||||
<<" associated with to bc contamination id: "<<request.id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+30
-30
@@ -14,7 +14,7 @@ namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
HandlerBoobyTrap::HandlerBoobyTrap(MainHandler *mainHandler)
|
||||
: HandlerBaseTmpl<ObjectBoobyTrap>(mainHandler, QStringLiteral("BoobyTrap"), s_areaCount[AesType::AtBoobyTrap], s_areaCountCentral[AesType::AtBoobyTrap])
|
||||
: HandlerBaseTmpl<ObjectBoobyTrap>(mainHandler, QStringLiteral("BoobyTrap"), s_areaCount[static_cast<int>(AesType::AtBoobyTrap)], s_areaCountCentral[static_cast<int>(AesType::AtBoobyTrap)])
|
||||
, Interface::Fts::BoobyTrapModifyRequestHandler(mainHandler->dds()->fts())
|
||||
, Interface::Fts::BoobyTrapRemoveRequestHandler(mainHandler->dds()->fts())
|
||||
, Interface::Fts::BoobyTrapTriggerRequestHandler(mainHandler->dds()->fts())
|
||||
@@ -35,7 +35,7 @@ bool HandlerBoobyTrap::init()
|
||||
bRet = false;
|
||||
return;
|
||||
}
|
||||
if (totalAreasCentral() >= s_maxActiveAreasCentral[AesType::AtBoobyTrap] )
|
||||
if (totalAreasCentral() >= s_maxActiveAreasCentral[static_cast<int>(AesType::AtBoobyTrap)] )
|
||||
{
|
||||
ERROR_LOG(m_logger) << "More active booby traps in database than allowed - ignoring the rest!";
|
||||
ifs->removeObject();
|
||||
@@ -64,32 +64,32 @@ bool HandlerBoobyTrap::init()
|
||||
|
||||
int HandlerBoobyTrap::totalAreas() const
|
||||
{
|
||||
return s_areaCount[AesType::AtBoobyTrap];
|
||||
return s_areaCount[static_cast<int>(AesType::AtBoobyTrap)];
|
||||
}
|
||||
|
||||
int HandlerBoobyTrap::totalAreasCentral() const
|
||||
{
|
||||
return s_areaCountCentral[AesType::AtBoobyTrap];
|
||||
return s_areaCountCentral[static_cast<int>(AesType::AtBoobyTrap)];
|
||||
}
|
||||
|
||||
static void fillData(const BoobyTrapModifyRequest &src, Database::AesBoobyTrap &dst)
|
||||
{
|
||||
if (src.id() < 0) // is the id given as negative? set id -> used by OC-laptop
|
||||
dst.id = src.id();
|
||||
if (src.id < 0) // is the id given as negative? set id -> used by OC-laptop
|
||||
dst.id = src.id;
|
||||
|
||||
dst.name = QString::fromStdString(src.name());
|
||||
dst.effectStart = src.effectStart().is_set() && src.effectStart().get() > 0 ? QDateTime::fromMSecsSinceEpoch(src.effectStart().get()) : QDateTime();
|
||||
dst.effectDuration = src.effectDuration();
|
||||
dst.impactPosition.rx() = src.impactPosition().lon();
|
||||
dst.impactPosition.ry() = src.impactPosition().lat();
|
||||
dst.impactRadius = src.impactRadius();
|
||||
dst.partyId = src.partyId().is_set() ? src.partyId().get() : 0;
|
||||
dst.chargeTypeId = src.chargeTypeId();
|
||||
//dst.participantId = src.participantId().is_set() ? src.participantId().get() : 0;
|
||||
//dst.externalId = src.externalId().is_set() ? src.externalId().get() : 0;
|
||||
dst.triggerRadius = src.triggerRadius();
|
||||
dst.rotationAngle = src.rotationAngle().is_set() ? src.rotationAngle().get() : 0;
|
||||
dst.centralAngle = src.centralAngle().is_set() ? src.centralAngle().get() : 0;
|
||||
dst.name = QString::fromStdString(src.name);
|
||||
dst.effectStart = src.effectStart.is_set() && src.effectStart.get() > 0 ? QDateTime::fromMSecsSinceEpoch(src.effectStart.get()) : QDateTime();
|
||||
dst.effectDuration = src.effectDuration;
|
||||
dst.impactPosition.rx() = src.impactPosition.lon;
|
||||
dst.impactPosition.ry() = src.impactPosition.lat;
|
||||
dst.impactRadius = src.impactRadius;
|
||||
dst.partyId = src.partyId.is_set() ? src.partyId.get() : 0;
|
||||
dst.chargeTypeId = src.chargeTypeId;
|
||||
//dst.participantId = src.participantId.is_set() ? src.participantId.get() : 0;
|
||||
//dst.externalId = src.externalId.is_set() ? src.externalId.get() : 0;
|
||||
dst.triggerRadius = src.triggerRadius;
|
||||
dst.rotationAngle = src.rotationAngle.is_set() ? src.rotationAngle.get() : 0;
|
||||
dst.centralAngle = src.centralAngle.is_set() ? src.centralAngle.get() : 0;
|
||||
dst.isCentral = true;
|
||||
dst.triggered = false;
|
||||
}
|
||||
@@ -106,7 +106,7 @@ void HandlerBoobyTrap::onBoobyTrapModifyRequest(const rti::core::SampleIdentity
|
||||
|
||||
Core::FunctionReplyObject HandlerBoobyTrap::boobyTrapCreateRequest(const BoobyTrapModifyRequest &request)
|
||||
{
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[AesType::AtBoobyTrap]) && request.effectStart().is_set())
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[static_cast<int>(AesType::AtBoobyTrap)]) && request.effectStart.is_set())
|
||||
return Core::FunctionReplyObject(1, tr_lts("dds", "Too many active booby traps."));
|
||||
|
||||
Database::AesBoobyTrap newData;
|
||||
@@ -134,7 +134,7 @@ Core::FunctionReplyObject HandlerBoobyTrap::boobyTrapCreateRequest(const BoobyTr
|
||||
Core::FunctionReplyObject HandlerBoobyTrap::boobyTrapModifyRequest(const BoobyTrapModifyRequest &request)
|
||||
{
|
||||
Core::FunctionReplyObject ret;
|
||||
const QPointF &impactPos = QPointF(request.impactPosition().lon(),request.impactPosition().lat());
|
||||
const QPointF &impactPos = QPointF(request.impactPosition.lon,request.impactPosition.lat);
|
||||
// Convert Form to UTM
|
||||
bool isGroundLevel = true;
|
||||
const int exId = m_mainHandler->dds()->exerciseId();
|
||||
@@ -145,28 +145,28 @@ Core::FunctionReplyObject HandlerBoobyTrap::boobyTrapModifyRequest(const BoobyTr
|
||||
return Core::FunctionReplyObject(1, tr_lts("dds", "The Booby Trap is within a building"));
|
||||
}
|
||||
|
||||
if (request.id() == 0 || ((request.id() < 0) && !getObjectFromMap(m_objectMap, std::abs(request.id()), ret)))
|
||||
if (request.id == 0 || ((request.id < 0) && !getObjectFromMap(m_objectMap, std::abs(request.id), ret)))
|
||||
return boobyTrapCreateRequest(request);
|
||||
|
||||
ObjectBoobyTrap *ifs = getObjectFromMap(m_objectMap, std::abs(request.id()), ret);
|
||||
ObjectBoobyTrap *ifs = getObjectFromMap(m_objectMap, std::abs(request.id), ret);
|
||||
|
||||
if (!ifs)
|
||||
return ret;
|
||||
|
||||
if (request.effectStart().is_set() && (request.effectStart().get() + request.effectDuration() < m_mainHandler->dds()->currentPartitionTime().toMSecsSinceEpoch()))
|
||||
if (request.effectStart.is_set() && (request.effectStart.get() + request.effectDuration < m_mainHandler->dds()->currentPartitionTime().toMSecsSinceEpoch()))
|
||||
return removeObject(ifs);
|
||||
|
||||
// Anzahl aktiver Areas ist erreicht, der Wirkbeginn ist (soll) gesetzt sein, aber die Area war
|
||||
// vorher noch ohne Wirkbeginn
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[AesType::AtBoobyTrap])
|
||||
&& request.effectStart().is_set()
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[static_cast<int>(AesType::AtBoobyTrap)])
|
||||
&& request.effectStart.is_set()
|
||||
&& !ifs->isActivationTimeSet()
|
||||
/* && !ifs->isObjectModifiable()*/)
|
||||
return Core::FunctionReplyObject(request.id(), tr_lts("dds", "Too many active booby traps."));
|
||||
return Core::FunctionReplyObject(request.id, tr_lts("dds", "Too many active booby traps."));
|
||||
|
||||
Database::AesBoobyTrap aea(ifs->data());
|
||||
fillData(request, aea);
|
||||
if (request.id() < 0 && checkStateForSfm(ifs))
|
||||
if (request.id < 0 && checkStateForSfm(ifs))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Overwrite booby trap Effect State for OC";
|
||||
aea.effectStateId = AesEffectState::EsPrepared;
|
||||
@@ -193,7 +193,7 @@ void HandlerBoobyTrap::onBoobyTrapTriggerRequest(const rti::core::SampleIdentity
|
||||
Core::FunctionReplyObject HandlerBoobyTrap::boobyTrapTriggerRequest(const BoobyTrapTriggerRequest &request)
|
||||
{
|
||||
Core::FunctionReplyObject ret;
|
||||
ObjectBoobyTrap *ifs = getObjectFromMap(m_objectMap, request.id(), ret);
|
||||
ObjectBoobyTrap *ifs = getObjectFromMap(m_objectMap, request.id, ret);
|
||||
|
||||
if (!ifs)
|
||||
return ret;
|
||||
@@ -201,7 +201,7 @@ Core::FunctionReplyObject HandlerBoobyTrap::boobyTrapTriggerRequest(const BoobyT
|
||||
Database::AesBoobyTrap aea(ifs->data());
|
||||
DEBUG_LOG(m_logger) << "Overwrite booby trap Effect State to expired";
|
||||
aea.effectStateId = AesEffectState::EsExpired;
|
||||
aea.triggered = request.triggered();
|
||||
aea.triggered = request.triggered;
|
||||
aea.effectDuration = aea.effectStart.msecsTo(QDateTime::currentDateTimeUtc());
|
||||
if (aea.effectDuration < 0)
|
||||
aea.effectDuration = 1;
|
||||
|
||||
+12
-12
@@ -14,7 +14,7 @@ namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
HandlerBorderline::HandlerBorderline(MainHandler *mainHandler)
|
||||
: HandlerBaseTmpl<ObjectBorderline>(mainHandler, QStringLiteral("ExplosionArea"), s_areaCount[AesType::AtBorderline], s_areaCountCentral[AesType::AtBorderline])
|
||||
: HandlerBaseTmpl<ObjectBorderline>(mainHandler, QStringLiteral("ExplosionArea"), s_areaCount[static_cast<int>(AesType::AtBorderline)], s_areaCountCentral[static_cast<int>(AesType::AtBorderline)])
|
||||
, Interface::Fts::BorderlineModifyRequestHandler(mainHandler->dds()->fts())
|
||||
, Interface::Fts::BorderlineRemoveRequestHandler(mainHandler->dds()->fts())
|
||||
{
|
||||
@@ -49,7 +49,7 @@ bool HandlerBorderline::init()
|
||||
|
||||
for (const Database::AesBorderline &dbBorderline : qAsConst(borderlineVec))
|
||||
{
|
||||
if (dbBorderline.effectStateId == AesEffectState_def::EsRemoved)
|
||||
if (dbBorderline.effectStateId == AesEffectState::EsRemoved)
|
||||
continue;
|
||||
|
||||
dbBorderlineSegments.clear();
|
||||
@@ -83,7 +83,7 @@ void HandlerBorderline::onBorderlineModifyRequest(const rti::core::SampleIdentit
|
||||
const BorderlineModifyRequest &request)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onBorderlineModifyRequest: " << request;
|
||||
Core::FunctionReplyObject ret = request.id() > 0 ? borderlineModifyRequest(request) : borderlineCreateRequest(request);
|
||||
Core::FunctionReplyObject ret = request.id > 0 ? borderlineModifyRequest(request) : borderlineCreateRequest(request);
|
||||
if (ret.error())
|
||||
WARNING_LOG(m_logger) << ret();
|
||||
m_mainHandler->dds()->fts()->borderlineModifyReply(cookie, ret);
|
||||
@@ -94,14 +94,14 @@ Core::FunctionReplyObject HandlerBorderline::borderlineCreateRequest(const Borde
|
||||
{
|
||||
Database::AesBorderline newData;
|
||||
|
||||
newData.name = QString::fromStdString(request.name());
|
||||
newData.operatorId = request.operatorId() > 0 ? request.operatorId() : QVariant();
|
||||
newData.partyId = request.partyId();
|
||||
newData.name = QString::fromStdString(request.name);
|
||||
newData.operatorId = request.operatorId > 0 ? request.operatorId : QVariant();
|
||||
newData.partyId = request.partyId;
|
||||
|
||||
|
||||
ObjectBorderline *ifs(new ObjectBorderline(m_mainHandler, this));
|
||||
Core::FunctionReplyObject ret = ifs->createObject(newData,
|
||||
request.segments(),
|
||||
request.segments,
|
||||
QVector<Database::AesBorderlineSegment>());
|
||||
if (ret.error())
|
||||
{
|
||||
@@ -117,17 +117,17 @@ Core::FunctionReplyObject HandlerBorderline::borderlineCreateRequest(const Borde
|
||||
Core::FunctionReplyObject HandlerBorderline::borderlineModifyRequest(const BorderlineModifyRequest &request)
|
||||
{
|
||||
Core::FunctionReplyObject ret;
|
||||
ObjectBorderline *ifs = getObjectFromMap(m_objectMap, request.id(), ret);
|
||||
ObjectBorderline *ifs = getObjectFromMap(m_objectMap, request.id, ret);
|
||||
if (!ifs)
|
||||
return ret;
|
||||
|
||||
Database::AesBorderline newData;
|
||||
|
||||
newData.name = QString::fromStdString(request.name());
|
||||
newData.operatorId = request.operatorId() > 0 ? request.operatorId() : QVariant();
|
||||
newData.partyId = request.partyId();
|
||||
newData.name = QString::fromStdString(request.name);
|
||||
newData.operatorId = request.operatorId > 0 ? request.operatorId : QVariant();
|
||||
newData.partyId = request.partyId;
|
||||
|
||||
return ifs->updateObject(newData, request.segments());
|
||||
return ifs->updateObject(newData, request.segments);
|
||||
} // end of onBorderlineModifyRequest()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
+15
-15
@@ -64,10 +64,10 @@ void HandlerChargeAdministration::onChargeAdministrationModifyRequest(const rti:
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onChargeAdministrationModifyRequest: " << request;
|
||||
ChargeAdministrationModifyRequest newRequest = request;
|
||||
if (!newRequest.amountChangedByOperator())
|
||||
newRequest.id() = getObjectChargeAdministrationId(request.partyId(), request.chargeTypeId(), request.effectSourceId());
|
||||
if (!newRequest.amountChangedByOperator)
|
||||
newRequest.id = getObjectChargeAdministrationId(request.partyId, request.chargeTypeId, request.effectSourceId);
|
||||
|
||||
const auto ret = newRequest.id() > 0 ? chargeAdministrationModifyRequest(newRequest) : chargeAdministrationCreateRequest(request);
|
||||
const auto ret = newRequest.id > 0 ? chargeAdministrationModifyRequest(newRequest) : chargeAdministrationCreateRequest(request);
|
||||
if (ret.error())
|
||||
WARNING_LOG(m_logger) << ret();
|
||||
m_mainHandler->dds()->fts()->chargeAdministrationModifyReply(cookie, ret);
|
||||
@@ -77,11 +77,11 @@ Core::FunctionReplyObject HandlerChargeAdministration::chargeAdministrationCreat
|
||||
{
|
||||
Database::AesChargeAdministration newData;
|
||||
|
||||
newData.chargeTypeId = request.chargeTypeId();
|
||||
newData.partyId = request.partyId();
|
||||
newData.effectSourceId = request.effectSourceId();
|
||||
newData.amount = request.amount();
|
||||
newData.amountChangedByOperator = request.amountChangedByOperator();
|
||||
newData.chargeTypeId = request.chargeTypeId;
|
||||
newData.partyId = request.partyId;
|
||||
newData.effectSourceId = request.effectSourceId;
|
||||
newData.amount = request.amount;
|
||||
newData.amountChangedByOperator = request.amountChangedByOperator;
|
||||
|
||||
ObjectChargeAdministration *ifs(new ObjectChargeAdministration(m_mainHandler, this));
|
||||
|
||||
@@ -98,19 +98,19 @@ Core::FunctionReplyObject HandlerChargeAdministration::chargeAdministrationCreat
|
||||
Core::FunctionReplyObject HandlerChargeAdministration::chargeAdministrationModifyRequest(const ChargeAdministrationModifyRequest &request)
|
||||
{
|
||||
Core::FunctionReplyObject ret;
|
||||
ObjectChargeAdministration *ifs = getObjectFromMap(m_chargeAdminObjMap, request.id(), ret);
|
||||
ObjectChargeAdministration *ifs = getObjectFromMap(m_chargeAdminObjMap, request.id, ret);
|
||||
if (!ifs)
|
||||
return ret;
|
||||
|
||||
Database::AesChargeAdministration newData(ifs->data());
|
||||
newData.id = request.id();
|
||||
newData.chargeTypeId = request.chargeTypeId();
|
||||
newData.partyId = request.partyId();
|
||||
newData.amount = request.amount();
|
||||
newData.amountChangedByOperator = request.amountChangedByOperator();
|
||||
newData.id = request.id;
|
||||
newData.chargeTypeId = request.chargeTypeId;
|
||||
newData.partyId = request.partyId;
|
||||
newData.amount = request.amount;
|
||||
newData.amountChangedByOperator = request.amountChangedByOperator;
|
||||
|
||||
if (newData.amountChangedByOperator && newData.amount < newData.planned)
|
||||
return Core::FunctionReplyObject(request.id(), tr_lts("dds", "Amount is smaller than planned (%1 < %2).")).arg(newData.amount).arg(newData.planned);
|
||||
return Core::FunctionReplyObject(request.id, tr_lts("dds", "Amount is smaller than planned (%1 < %2).")).arg(newData.amount).arg(newData.planned);
|
||||
|
||||
return ifs->updateObject(newData);
|
||||
}
|
||||
|
||||
+18
-18
@@ -86,18 +86,18 @@ void HandlerChargeEffect::onChargeEffectModifyRequest(const rti::core::SampleIde
|
||||
return;
|
||||
}
|
||||
|
||||
if (request.id() == 0) // create
|
||||
if (request.id == 0) // create
|
||||
{
|
||||
m_mainHandler->dds()->fts()->chargeEffectModifyReply(cookie, createChargeEffect(request));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (request.id() < 0) // create with id
|
||||
if (request.id < 0) // create with id
|
||||
{
|
||||
ChargeEffectModifyRequest requestWithPositiveId = request;
|
||||
|
||||
requestWithPositiveId.id(qAbs(request.id()));
|
||||
requestWithPositiveId.id = qAbs(request.id);
|
||||
|
||||
m_mainHandler->dds()->fts()->chargeEffectModifyReply(cookie, createChargeEffect(requestWithPositiveId));
|
||||
|
||||
@@ -165,12 +165,12 @@ Core::FunctionReplyObject HandlerChargeEffect::createChargeEffect(const ChargeEf
|
||||
|
||||
// Create ChargeAdministration Entry for reports
|
||||
DEBUG_LOG(m_logger) << "newChargeEffect id: " << newChargeEffect->id();
|
||||
DEBUG_LOG(m_logger) << "request.originatorTypeId: " << request.originatorTypeId();
|
||||
if (request.originatorTypeId() == ProjectDataManagement::StateChangeOriginator::AreaEffectSimulation)
|
||||
DEBUG_LOG(m_logger) << "request.originatorTypeId: " << request.originatorTypeId;
|
||||
if (request.originatorTypeId == ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_AreaEffectSimulation)
|
||||
{
|
||||
int amount = 1;
|
||||
int partyId = m_mainHandler->effectClusterHandler()->getPartyId(request.originatorId());
|
||||
m_mainHandler->chargeAdministrationHandler()->consumeCharge(request.chargeTypeId(), partyId, amount);
|
||||
int partyId = m_mainHandler->effectClusterHandler()->getPartyId(request.originatorId);
|
||||
m_mainHandler->chargeAdministrationHandler()->consumeCharge(request.chargeTypeId, partyId, amount);
|
||||
}
|
||||
|
||||
// create
|
||||
@@ -180,9 +180,9 @@ Core::FunctionReplyObject HandlerChargeEffect::createChargeEffect(const ChargeEf
|
||||
newChargeEffect->init();
|
||||
|
||||
// create trajectory
|
||||
if (request.trajectoryTimeAware().is_set())
|
||||
if (request.trajectoryTimeAware.is_set())
|
||||
{
|
||||
int trajId = m_trajectoryHandler->create(trajectoryData(newChargeEffect->id(), request.trajectoryTimeAware().get()));
|
||||
int trajId = m_trajectoryHandler->create(trajectoryData(newChargeEffect->id(), request.trajectoryTimeAware.get()));
|
||||
if (trajId < 0)
|
||||
ERROR_LOG(m_logger) << " Couldn't create trajectory for chargeEffect id: " << newChargeEffect->id();
|
||||
else
|
||||
@@ -204,14 +204,14 @@ TrajectoryData HandlerChargeEffect::trajectoryData(int chargeEffectId, // act as
|
||||
{
|
||||
TrajectoryData td;
|
||||
td.id = trajObjId;
|
||||
td.index = trajectoryTimeAware.index();
|
||||
td.startTime = trajectoryTimeAware.trajectoryStartTime();
|
||||
td.geometry = trajectoryTimeAware.geometry();
|
||||
td.index = trajectoryTimeAware.index;
|
||||
td.startTime = trajectoryTimeAware.trajectoryStartTime;
|
||||
td.geometry = trajectoryTimeAware.geometry;
|
||||
// [E01562-259] use originatorId, originatorTypeId (instead of aesItemId, aesTypeId)
|
||||
// td.aesItemId = trajectoryTimeAware.aesItemId(); // charge effect's parent
|
||||
// td.aesTypeId = trajectoryTimeAware.aesTypeId();
|
||||
td.originatorId = chargeEffectId;
|
||||
td.originatorTypeId = ProjectDataManagement::StateChangeOriginator::ChargeEffect;
|
||||
td.originatorTypeId = ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_ChargeEffect;
|
||||
|
||||
return td;
|
||||
}
|
||||
@@ -227,7 +227,7 @@ const ObjectChargeEffect *HandlerChargeEffect::getChargeEffectById(int chargeEff
|
||||
|
||||
Core::FunctionReplyObject HandlerChargeEffect::updateChargeEffect(const ChargeEffectModifyRequest &request)
|
||||
{
|
||||
Core::FunctionReplyObject reply(request.id());
|
||||
Core::FunctionReplyObject reply(request.id);
|
||||
if (!m_mainHandler)
|
||||
{
|
||||
reply.setStr("Not possible to update ChargeEffect --> No MainHandler present.");
|
||||
@@ -237,7 +237,7 @@ Core::FunctionReplyObject HandlerChargeEffect::updateChargeEffect(const ChargeEf
|
||||
return reply;
|
||||
}
|
||||
|
||||
if (!m_chargeEffects.contains(request.id()))
|
||||
if (!m_chargeEffects.contains(request.id))
|
||||
{
|
||||
|
||||
reply.setStr("Not possible to update ChargeEffect --> Got invalid id.");
|
||||
@@ -247,12 +247,12 @@ Core::FunctionReplyObject HandlerChargeEffect::updateChargeEffect(const ChargeEf
|
||||
return reply;
|
||||
}
|
||||
|
||||
ObjectChargeEffect *chargeEffetObj = m_chargeEffects[request.id()];
|
||||
ObjectChargeEffect *chargeEffetObj = m_chargeEffects[request.id];
|
||||
reply = chargeEffetObj->update(request);
|
||||
|
||||
// update trajectory
|
||||
if (!reply.error() && request.trajectoryTimeAware().is_set()
|
||||
&& m_trajectoryHandler->update(trajectoryData(chargeEffetObj->id(), request.trajectoryTimeAware().get(), m_trajObjIds.value(chargeEffetObj->id(), -1))))
|
||||
if (!reply.error() && request.trajectoryTimeAware.is_set()
|
||||
&& m_trajectoryHandler->update(trajectoryData(chargeEffetObj->id(), request.trajectoryTimeAware.get(), m_trajObjIds.value(chargeEffetObj->id(), -1))))
|
||||
{
|
||||
// update failed should the trajectory be created again?
|
||||
reply.setStr("Not possible to update ChargeEffect --> Got invalid trajectory id.");
|
||||
|
||||
+25
-25
@@ -87,21 +87,21 @@ Core::FunctionReplyObject HandlerDangerArea::dangerAreaCreateRequest(const Dange
|
||||
{
|
||||
Database::AesDangerArea newData;
|
||||
|
||||
if (request.id() < 0) // is the id given as negative? set id -> used by OC-Laptop
|
||||
newData.id = request.id();
|
||||
newData.name = QString::fromStdString(request.name());
|
||||
newData.effectStart = request.effectStart().is_set() && request.effectStart().get() > 0 ? QDateTime::fromMSecsSinceEpoch(request.effectStart().get()) : QDateTime();
|
||||
newData.chargeTypeId = request.chargeTypeId();
|
||||
newData.effectDuration = request.effectDuration();
|
||||
newData.partyId = request.partyId().is_set() ? request.partyId().get() : 0;
|
||||
newData.participantId = request.participantId().is_set() ? request.participantId().get() : 0;
|
||||
newData.associatedAesId = request.associatedAesId().is_set() ? request.associatedAesId().get() : 0;
|
||||
if (request.id < 0) // is the id given as negative? set id -> used by OC-Laptop
|
||||
newData.id = request.id;
|
||||
newData.name = QString::fromStdString(request.name);
|
||||
newData.effectStart = request.effectStart.is_set() && request.effectStart.get() > 0 ? QDateTime::fromMSecsSinceEpoch(request.effectStart.get()) : QDateTime();
|
||||
newData.chargeTypeId = request.chargeTypeId;
|
||||
newData.effectDuration = request.effectDuration;
|
||||
newData.partyId = request.partyId.is_set() ? request.partyId.get() : 0;
|
||||
newData.participantId = request.participantId.is_set() ? request.participantId.get() : 0;
|
||||
newData.associatedAesId = request.associatedAesId.is_set() ? request.associatedAesId.get() : 0;
|
||||
|
||||
|
||||
ObjectDangerArea *ifs(new ObjectDangerArea(m_mainHandler, this));
|
||||
|
||||
Core::FunctionReplyObject ret = ifs->createObject(newData,
|
||||
request.segments(),
|
||||
request.segments,
|
||||
QVector<Database::AesDangerSegment>());
|
||||
if (ret.error())
|
||||
{
|
||||
@@ -117,10 +117,10 @@ Core::FunctionReplyObject HandlerDangerArea::dangerAreaCreateRequest(const Dange
|
||||
|
||||
bool HandlerDangerArea::dangerAreaRemoveRequest(const Core::RemoveElementRequest request)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onDangerAreaRemoveRequest dangerArea id: " << request.id();
|
||||
DEBUG_LOG(m_logger) << "onDangerAreaRemoveRequest dangerArea id: " << request.id;
|
||||
Core::FunctionReplyObject ret;
|
||||
const rti::core::SampleIdentity cookie;
|
||||
ObjectDangerArea *ifs = getObjectFromMap(m_dangerAreaObjMap, request.id(), ret);
|
||||
ObjectDangerArea *ifs = getObjectFromMap(m_dangerAreaObjMap, request.id, ret);
|
||||
if (!ifs)
|
||||
{
|
||||
return m_mainHandler->dds()->fts()->dangerAreaRemoveReply(cookie, ret);
|
||||
@@ -151,25 +151,25 @@ bool HandlerDangerArea::getDangerAreaByAssociatedAesId(const int &id, Database:
|
||||
Core::FunctionReplyObject HandlerDangerArea::dangerAreaModifyRequest(const DangerAreaModifyRequest &request)
|
||||
{
|
||||
Core::FunctionReplyObject ret;
|
||||
if (request.id() == 0 || ((request.id() < 0) && !getObjectFromMap(m_dangerAreaObjMap, std::abs(request.id()), ret)))
|
||||
if (request.id == 0 || ((request.id < 0) && !getObjectFromMap(m_dangerAreaObjMap, std::abs(request.id), ret)))
|
||||
return dangerAreaCreateRequest(request);
|
||||
|
||||
ObjectDangerArea *ifs = getObjectFromMap(m_dangerAreaObjMap, std::abs(request.id()), ret);
|
||||
ObjectDangerArea *ifs = getObjectFromMap(m_dangerAreaObjMap, std::abs(request.id), ret);
|
||||
if (!ifs)
|
||||
return ret;
|
||||
|
||||
Database::AesDangerArea newData(ifs->data());
|
||||
if (request.id() < 0) // is the id given as negative? set id -> used by OC-Laptop
|
||||
newData.id = request.id();
|
||||
newData.name = QString::fromStdString(request.name());
|
||||
newData.effectStart = request.effectStart().is_set() && request.effectStart().get() > 0 ? QDateTime::fromMSecsSinceEpoch(request.effectStart().get()) : QDateTime();
|
||||
newData.chargeTypeId = request.chargeTypeId();
|
||||
newData.effectDuration = request.effectDuration();
|
||||
newData.partyId = request.partyId().is_set() ? request.partyId().get() : 0;
|
||||
newData.participantId = request.participantId().is_set() ? request.participantId().get() : 0;
|
||||
newData.associatedAesId = request.associatedAesId().is_set() ? request.associatedAesId().get() : 0;
|
||||
if (request.id < 0) // is the id given as negative? set id -> used by OC-Laptop
|
||||
newData.id = request.id;
|
||||
newData.name = QString::fromStdString(request.name);
|
||||
newData.effectStart = request.effectStart.is_set() && request.effectStart.get() > 0 ? QDateTime::fromMSecsSinceEpoch(request.effectStart.get()) : QDateTime();
|
||||
newData.chargeTypeId = request.chargeTypeId;
|
||||
newData.effectDuration = request.effectDuration;
|
||||
newData.partyId = request.partyId.is_set() ? request.partyId.get() : 0;
|
||||
newData.participantId = request.participantId.is_set() ? request.participantId.get() : 0;
|
||||
newData.associatedAesId = request.associatedAesId.is_set() ? request.associatedAesId.get() : 0;
|
||||
|
||||
return ifs->updateObject(newData, request.segments());
|
||||
return ifs->updateObject(newData, request.segments);
|
||||
}
|
||||
|
||||
void HandlerDangerArea::onDangerAreaRemoveRequest(const rti::core::SampleIdentity &cookie,
|
||||
@@ -177,7 +177,7 @@ void HandlerDangerArea::onDangerAreaRemoveRequest(const rti::core::SampleIdentit
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onDangerAreaRemoveRequest" << request;
|
||||
Core::FunctionReplyObject ret;
|
||||
ObjectDangerArea *ifs = getObjectFromMap(m_dangerAreaObjMap, request.id(), ret);
|
||||
ObjectDangerArea *ifs = getObjectFromMap(m_dangerAreaObjMap, request.id, ret);
|
||||
if (!ifs)
|
||||
{
|
||||
m_mainHandler->dds()->fts()->dangerAreaRemoveReply(cookie, ret);
|
||||
|
||||
+15
-15
@@ -17,7 +17,7 @@ namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
HandlerDusSingleMine::HandlerDusSingleMine(MainHandler *mainHandler)
|
||||
: HandlerBaseTmpl<ObjectDusSingleMine>(mainHandler, QStringLiteral("DusSingleMine"), s_areaCount[AesType::AtMineArea], s_areaCountCentral[AesType::AtMineArea])
|
||||
: HandlerBaseTmpl<ObjectDusSingleMine>(mainHandler, QStringLiteral("DusSingleMine"), s_areaCount[static_cast<int>(AesType::AtMineArea)], s_areaCountCentral[static_cast<int>(AesType::AtMineArea)])
|
||||
, m_tabDtc(mainHandler->dds()->tabDtc())
|
||||
{}
|
||||
|
||||
@@ -41,7 +41,7 @@ bool HandlerDusSingleMine::init()
|
||||
// If active or prepared, check if it still can be handled and increment area count
|
||||
if (ifs->isObjectInTrainingArea())
|
||||
{
|
||||
if (totalAreas() >= s_maxActiveAreas[AesType::AtDusSingleMine])
|
||||
if (totalAreas() >= s_maxActiveAreas[static_cast<int>(AesType::AtDusSingleMine)])
|
||||
{
|
||||
ERROR_LOG(m_logger) << "More active DUS single mines in database than allowed - ignoring the rest!";
|
||||
delete ifs;
|
||||
@@ -80,12 +80,12 @@ bool HandlerDusSingleMine::init()
|
||||
|
||||
int HandlerDusSingleMine::totalAreas() const
|
||||
{
|
||||
return s_areaCount[AesType::AtDusSingleMine];
|
||||
return s_areaCount[static_cast<int>(AesType::AtDusSingleMine)];
|
||||
}
|
||||
|
||||
int HandlerDusSingleMine::totalAreasCentral() const
|
||||
{
|
||||
return s_areaCountCentral[AesType::AtDusSingleMine];
|
||||
return s_areaCountCentral[static_cast<int>(AesType::AtDusSingleMine)];
|
||||
}
|
||||
|
||||
void HandlerDusSingleMine::onDusSingleMineState(const TrainingAreaBase::DusSingleMineState &data, DataModification modType)
|
||||
@@ -93,31 +93,31 @@ void HandlerDusSingleMine::onDusSingleMineState(const TrainingAreaBase::DusSingl
|
||||
if (modType == DataModification::eRemoved)
|
||||
return;
|
||||
|
||||
if (totalAreas() >= s_maxActiveAreas[AesType::AtDusSingleMine])
|
||||
if (totalAreas() >= s_maxActiveAreas[static_cast<int>(AesType::AtDusSingleMine)])
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Too many active DUS single mines.";
|
||||
return;
|
||||
}
|
||||
|
||||
// set old AES item to expired
|
||||
if (m_activeMineIdToAesItemId.contains(data.mineId()))
|
||||
if (m_activeMineIdToAesItemId.contains(data.mineId))
|
||||
{
|
||||
m_objectMap.value(m_activeMineIdToAesItemId.value(data.mineId()))->setExpired();
|
||||
m_activeMineIdToAesItemId.remove(data.mineId());
|
||||
m_objectMap.value(m_activeMineIdToAesItemId.value(data.mineId))->setExpired();
|
||||
m_activeMineIdToAesItemId.remove(data.mineId);
|
||||
}
|
||||
|
||||
if (data.state())
|
||||
if (data.state)
|
||||
{
|
||||
Database::AesDusSingleMine newData;
|
||||
newData.mineId = data.mineId();
|
||||
newData.mineId = data.mineId;
|
||||
|
||||
newData.effectStart = QDateTime::fromMSecsSinceEpoch(data.effectStart() + Settings::getDusSingleMineEffectStartOffset()); // offset to get away from mine after laying it
|
||||
newData.effectStart = QDateTime::fromMSecsSinceEpoch(data.effectStart + Settings::getDusSingleMineEffectStartOffset()); // offset to get away from mine after laying it
|
||||
if (newData.effectStart <= m_mainHandler->dds()->currentPartitionTime()) // telegram arrived late -> start effect area now
|
||||
newData.effectStart = QDateTime::fromMSecsSinceEpoch(m_mainHandler->dds()->currentPartitionTimeMSec() + 100); // needs to be slightly in the future
|
||||
|
||||
newData.position.rx() = data.position().lon();
|
||||
newData.position.ry() = data.position().lat();
|
||||
newData.chargeTypeId = data.chargeTypeId();
|
||||
newData.position.rx() = data.position.lon;
|
||||
newData.position.ry() = data.position.lat;
|
||||
newData.chargeTypeId = data.chargeTypeId;
|
||||
|
||||
ObjectDusSingleMine *ifs(new ObjectDusSingleMine(m_mainHandler, this));
|
||||
connect(ifs, &ObjectDusSingleMine::effectStateChanged, this, &HandlerDusSingleMine::onEffectStateChanged);
|
||||
@@ -139,7 +139,7 @@ void HandlerDusSingleMine::onMineTriggered(const TrainingAreaBase::MineTriggered
|
||||
{
|
||||
if (modType == DataModification::eRemoved)
|
||||
return;
|
||||
auto it = m_objectMap.constFind(data.mineAreaId());
|
||||
auto it = m_objectMap.constFind(data.mineAreaId);
|
||||
if (it == m_objectMap.cend()) // is it a DUS single mine or just a normal mineArea?
|
||||
return;
|
||||
|
||||
|
||||
+138
-138
@@ -28,8 +28,8 @@ namespace AreaEffectSimulation
|
||||
HandlerEffectCluster::HandlerEffectCluster(MainHandler *mainHandler)
|
||||
: HandlerBaseTmpl<ObjectEffectCluster>(mainHandler,
|
||||
QStringLiteral("EffectCluster"),
|
||||
s_areaCount[AesType::AtEffectCluster],
|
||||
s_areaCountCentral[AesType::AtEffectCluster])
|
||||
s_areaCount[static_cast<int>(AesType::AtEffectCluster)],
|
||||
s_areaCountCentral[static_cast<int>(AesType::AtEffectCluster)])
|
||||
, Interface::Fts::EffectClusterModifyRequestHandler(mainHandler->dds()->fts())
|
||||
, Interface::Fts::EffectClusterModifyActorRequestHandler(mainHandler->dds()->fts())
|
||||
, Interface::Fts::EffectClusterSingleEffectOnlyModifyRequestHandler(mainHandler->dds()->fts())
|
||||
@@ -147,12 +147,12 @@ void HandlerEffectCluster::onFireCommandReceived(const TrainingAreaBase::EX_Fire
|
||||
// get fireReference
|
||||
if (modtype == DataModification::eRemoved)
|
||||
return;
|
||||
DEBUG_LOG(m_logger) << "got EX_Fire for ref: " << fire.reference() << " internal mapsize " << m_referenceToClusterId.size();
|
||||
auto *ifs = m_objectMap.value(m_referenceToClusterId.value(QString::fromStdString(fire.reference())));
|
||||
DEBUG_LOG(m_logger) << "got EX_Fire for ref: " << fire.reference << " internal mapsize " << m_referenceToClusterId.size();
|
||||
auto *ifs = m_objectMap.value(m_referenceToClusterId.value(QString::fromStdString(fire.reference)));
|
||||
if (!ifs)
|
||||
return;
|
||||
|
||||
ifs->sendFireCommand(AdlerJson::waffensystemkennerMap.key(fire.effectorId()));
|
||||
ifs->sendFireCommand(AdlerJson::waffensystemkennerMap.key(fire.effectorId));
|
||||
}
|
||||
|
||||
void HandlerEffectCluster::onFireHoldReceived(const TrainingAreaBase::EX_CeaseFiring &ceaseFire, DataModification modType)
|
||||
@@ -162,7 +162,7 @@ void HandlerEffectCluster::onFireHoldReceived(const TrainingAreaBase::EX_CeaseFi
|
||||
return;
|
||||
}
|
||||
|
||||
int HandlerEffectCluster::totalAreasCentral() const { return s_areaCountCentral[AesType::AtEffectCluster]; }
|
||||
int HandlerEffectCluster::totalAreasCentral() const { return s_areaCountCentral[static_cast<int>(AesType::AtEffectCluster)]; }
|
||||
|
||||
// Appends
|
||||
/*
|
||||
@@ -179,69 +179,69 @@ static void fillData(const EffectClusterModifyRequest &src,
|
||||
QVector<Database::AesEffectorData> &dstEffectorVector,
|
||||
MainHandler *mainHandler)
|
||||
{
|
||||
if (src.id() < 0) // is the id given as negative? set id -> used by OC-Laptop
|
||||
dst.id = src.id();
|
||||
if (src.id < 0) // is the id given as negative? set id -> used by OC-Laptop
|
||||
dst.id = src.id;
|
||||
|
||||
dst.name = QString::fromStdString(src.name());
|
||||
dst.element = QString::fromStdString(src.element());
|
||||
dst.name = QString::fromStdString(src.name);
|
||||
dst.element = QString::fromStdString(src.element);
|
||||
|
||||
dst.impactPosition.rx() = src.area().cornerBottomLeft().lon();
|
||||
dst.impactPosition.ry() = src.area().cornerBottomLeft().lat();
|
||||
dst.impactLength = src.area().height();
|
||||
dst.impactWidth = src.area().width();
|
||||
dst.rotationAngle = src.area().rotation();
|
||||
dst.impactPosition.rx() = src.area.cornerBottomLeft.lon;
|
||||
dst.impactPosition.ry() = src.area.cornerBottomLeft.lat;
|
||||
dst.impactLength = src.area.height;
|
||||
dst.impactWidth = src.area.width;
|
||||
dst.rotationAngle = src.area.rotation;
|
||||
|
||||
const bool bIsPointSimilar = (src.explosionGeometry() == AreaEffectSimulation::AesExplosionGeometry_def::EgAimPoint)
|
||||
|| (src.explosionGeometry() == AreaEffectSimulation::AesExplosionGeometry_def::EgPoint);
|
||||
const bool bIsPointSimilar = (src.explosionGeometry == AreaEffectSimulation::AesExplosionGeometry::EgAimPoint)
|
||||
|| (src.explosionGeometry == AreaEffectSimulation::AesExplosionGeometry::EgPoint);
|
||||
|
||||
dstEffectorVector.reserve(src.effectors().size());
|
||||
dstEffectorVector.reserve(src.effectors.size());
|
||||
Database::AesEffectorData dstEffector;
|
||||
int localImpactCount = 0;
|
||||
int firstChargeTypeId = 0;
|
||||
for (const auto &effector : src.effectors())
|
||||
for (const auto &effector : src.effectors)
|
||||
{
|
||||
// copy from Source Request.
|
||||
dstEffector.angleOfFall = effector.angleOfFall();
|
||||
dstEffector.chargeAmount = effector.chargeAmount();
|
||||
dstEffector.chargeTypeId = effector.chargeStruct().chargeTypeId();
|
||||
dstEffector.entityId = src.id();
|
||||
dstEffector.flightTime = effector.flightTime();
|
||||
dstEffector.igniterTypeId = effector.chargeStruct().igniterTypeId();
|
||||
dstEffector.igniterFunctionId = effector.chargeStruct().igniterFunctionId();
|
||||
dstEffector.interval = effector.interval();
|
||||
dstEffector.mhpPosition.rx() = effector.mhpPosition().lon();
|
||||
dstEffector.mhpPosition.ry() = effector.mhpPosition().lat();
|
||||
dstEffector.mhpPosition.rz() = effector.mhpPosition().z(); // [E01562-399]
|
||||
dstEffector.properties = QString::fromStdString(effector.properties());
|
||||
dstEffector.angleOfFall = effector.angleOfFall;
|
||||
dstEffector.chargeAmount = effector.chargeAmount;
|
||||
dstEffector.chargeTypeId = effector.chargeStruct.chargeTypeId;
|
||||
dstEffector.entityId = src.id;
|
||||
dstEffector.flightTime = effector.flightTime;
|
||||
dstEffector.igniterTypeId = effector.chargeStruct.igniterTypeId;
|
||||
dstEffector.igniterFunctionId = effector.chargeStruct.igniterFunctionId;
|
||||
dstEffector.interval = effector.interval;
|
||||
dstEffector.mhpPosition.rx() = effector.mhpPosition.lon;
|
||||
dstEffector.mhpPosition.ry() = effector.mhpPosition.lat;
|
||||
dstEffector.mhpPosition.rz() = effector.mhpPosition.z; // [E01562-399]
|
||||
dstEffector.properties = QString::fromStdString(effector.properties);
|
||||
// FillScatterData
|
||||
if (effector.mhpScatterLenght() > 0.0)
|
||||
dstEffector.mhpScatterLenght = effector.mhpScatterLenght();
|
||||
if (effector.mhpScatterLenght > 0.0)
|
||||
dstEffector.mhpScatterLenght = effector.mhpScatterLenght;
|
||||
else
|
||||
dstEffector.mhpScatterLenght = Settings::getScatterLenghtDefault();
|
||||
dstEffector.mhpScatterLengthDetonationHeight = effector.mhpScatterLengthDetonationHeight();
|
||||
if (effector.mhpScatterWidth() > 0.0)
|
||||
dstEffector.mhpScatterWidth = effector.mhpScatterWidth();
|
||||
dstEffector.mhpScatterLengthDetonationHeight = effector.mhpScatterLengthDetonationHeight;
|
||||
if (effector.mhpScatterWidth > 0.0)
|
||||
dstEffector.mhpScatterWidth = effector.mhpScatterWidth;
|
||||
else
|
||||
dstEffector.mhpScatterWidth = Settings::getScatterWidthDefault();
|
||||
dstEffector.mhpScatterWidthDetonationHeight = effector.mhpScatterWidthDetonationHeight();
|
||||
dstEffector.mhpScatterWidthDetonationHeight = effector.mhpScatterWidthDetonationHeight;
|
||||
// Fill rest
|
||||
dstEffector.participantId = effector.participantId();
|
||||
dstEffector.peakHeight = effector.peakHeight();
|
||||
dstEffector.trajectory = QString::fromStdString(TrajectoryRelative::toString(effector.trajectoryRelative()));
|
||||
dstEffector.participantId = effector.participantId;
|
||||
dstEffector.peakHeight = effector.peakHeight;
|
||||
dstEffector.trajectory = QString::fromStdString(TrajectoryRelative::toString(effector.trajectoryRelative));
|
||||
// sanity stuff
|
||||
localImpactCount = localImpactCount + dstEffector.chargeAmount;
|
||||
if (firstChargeTypeId <= 0)
|
||||
firstChargeTypeId = effector.chargeStruct().chargeTypeId();
|
||||
firstChargeTypeId = effector.chargeStruct.chargeTypeId;
|
||||
// check if it's a single fire
|
||||
if (bIsPointSimilar && ((src.area().width() <= 0) || (src.area().height() <= 0)))
|
||||
if (bIsPointSimilar && ((src.area.width <= 0) || (src.area.height <= 0)))
|
||||
{
|
||||
const Core::GeoPosition2D &cornerBottomLeft = src.area().cornerBottomLeft();
|
||||
const double impactDiameter = mainHandler->dds()->pdmDtc()->impactRadius(effector.chargeStruct().chargeTypeId(),
|
||||
effector.chargeStruct().igniterTypeId(),
|
||||
effector.chargeStruct().igniterFunctionId())
|
||||
const Core::GeoPosition2D &cornerBottomLeft = src.area.cornerBottomLeft;
|
||||
const double impactDiameter = mainHandler->dds()->pdmDtc()->impactRadius(effector.chargeStruct.chargeTypeId,
|
||||
effector.chargeStruct.igniterTypeId,
|
||||
effector.chargeStruct.igniterFunctionId)
|
||||
* 2.0; // GUEZE-2634
|
||||
|
||||
const QPointF bottomLeft(Polygons::centerPoint2BottomLeft(QPointF(cornerBottomLeft.lon(), cornerBottomLeft.lat()), impactDiameter, impactDiameter, 0));
|
||||
const QPointF bottomLeft(Polygons::centerPoint2BottomLeft(QPointF(cornerBottomLeft.lon, cornerBottomLeft.lat), impactDiameter, impactDiameter, 0));
|
||||
|
||||
dstEffector.mhpPosition.rx() = bottomLeft.x();
|
||||
dstEffector.mhpPosition.ry() = bottomLeft.y();
|
||||
@@ -252,14 +252,14 @@ static void fillData(const EffectClusterModifyRequest &src,
|
||||
}
|
||||
// Save the mhpCountRequest for later
|
||||
dst.mhpCountRequest = dstEffectorVector.size();
|
||||
dst.explosionGeometryId = src.explosionGeometry();
|
||||
dst.tla = src.tla();
|
||||
dst.explosionGeometryId = src.explosionGeometry;
|
||||
dst.tla = src.tla;
|
||||
|
||||
dst.effectStart = src.effectStart().is_set() && src.effectStart().get() > 0 ? QDateTime::fromMSecsSinceEpoch(src.effectStart().get()) : QDateTime();
|
||||
dst.effectStart = src.effectStart.is_set() && src.effectStart.get() > 0 ? QDateTime::fromMSecsSinceEpoch(src.effectStart.get()) : QDateTime();
|
||||
// Effect Duration might be set and will be used for the AutoFire
|
||||
// -- Module Duration
|
||||
if (src.effectDuration())
|
||||
dst.effectDuration = src.effectDuration();
|
||||
if (src.effectDuration)
|
||||
dst.effectDuration = src.effectDuration;
|
||||
else
|
||||
{
|
||||
// Sometimes there is no effectDuration
|
||||
@@ -267,20 +267,20 @@ static void fillData(const EffectClusterModifyRequest &src,
|
||||
dst.effectDuration = DEFAULT_EFFECT_DURATION;
|
||||
}
|
||||
|
||||
dst.effectSourceId = src.effectSourceId();
|
||||
dst.effectSourceId = src.effectSourceId;
|
||||
|
||||
dst.firePurposeId = src.firePurposeId();
|
||||
dst.firePurposeId = src.firePurposeId;
|
||||
|
||||
dst.partyId = src.partyId().is_set() ? src.partyId().get() : 0;
|
||||
dst.participantId = src.participantId().is_set() ? src.participantId().get() : -1; // -1 -> avoid trajectory
|
||||
dst.partyId = src.partyId.is_set() ? src.partyId.get() : 0;
|
||||
dst.participantId = src.participantId.is_set() ? src.participantId.get() : -1; // -1 -> avoid trajectory
|
||||
|
||||
dst.altitude = -1;
|
||||
|
||||
dst.effectMarkingInTa = src.effectMarkingInTa();
|
||||
dst.externalId = src.externalId().is_set() ? src.externalId().get() : 0;
|
||||
dst.effectMarkingInTa = src.effectMarkingInTa;
|
||||
dst.externalId = src.externalId.is_set() ? src.externalId.get() : 0;
|
||||
|
||||
dst.properties = QString::fromStdString(src.properties());
|
||||
dst.esmParticipantIds = LtsUtils::IntArray(src.esmParticipantIds());
|
||||
dst.properties = QString::fromStdString(src.properties);
|
||||
dst.esmParticipantIds = LtsUtils::IntArray(src.esmParticipantIds);
|
||||
// some modules:
|
||||
// if (dst.impactCount == 0 && localImpactCount > 0)
|
||||
|
||||
@@ -297,8 +297,8 @@ void HandlerEffectCluster::onEffectClusterModifyRequest(const rti::core::SampleI
|
||||
// DEBUG_LOG(m_logger) << "************************************ start onEffectClusterModifyRequest: " << request;
|
||||
Core::FunctionReplyObject ret = effectClusterModifyRequest(cookie, request);
|
||||
if (ret.error())
|
||||
WARNING_LOG(m_logger) << ret() << ", effectStart :" << request.effectStart();
|
||||
ret.setAdditionalInfo(request.properties().c_str());
|
||||
WARNING_LOG(m_logger) << ret() << ", effectStart :" << request.effectStart;
|
||||
ret.setAdditionalInfo(request.properties.c_str());
|
||||
// DEBUG_LOG(m_logger) << "************************************ SEND REPLY FOR onEffectClusterModifyRequest: " << request;
|
||||
|
||||
m_mainHandler->dds()->fts()->effectClusterModifyReply(cookie, ret);
|
||||
@@ -309,7 +309,7 @@ void HandlerEffectCluster::onEffectClusterModifyActorRequest(const rti::core::Sa
|
||||
// DEBUG_LOG(m_logger) << "************************************ start onEffectClusterModifyActorRequest: " << request;
|
||||
|
||||
Core::FunctionReplyObject ret;
|
||||
ObjectEffectCluster *ifs = getObjectFromMap(m_objectMap, request.aesId(), ret);
|
||||
ObjectEffectCluster *ifs = getObjectFromMap(m_objectMap, request.aesId, ret);
|
||||
if (!ifs)
|
||||
{
|
||||
m_mainHandler->dds()->fts()->effectClusterModifyActorReply(cookie, ret);
|
||||
@@ -380,28 +380,28 @@ void HandlerEffectCluster::onEffectClusterOcModifyRequest(const rti::core::Sampl
|
||||
|
||||
EffectClusterModifyRequest ecCommonModifyRequest;
|
||||
|
||||
ecCommonModifyRequest.id(request.id());
|
||||
ecCommonModifyRequest.id = request.id;
|
||||
// ecCommonModifyRequest.externalId(request.externalId());
|
||||
|
||||
ecCommonModifyRequest.effectStart(request.effectStart());
|
||||
ecCommonModifyRequest.effectDuration(request.effectDuration());
|
||||
ecCommonModifyRequest.effectStart = request.effectStart;
|
||||
ecCommonModifyRequest.effectDuration = request.effectDuration;
|
||||
|
||||
// charge and geometry:
|
||||
ecCommonModifyRequest.area(request.area());
|
||||
ecCommonModifyRequest.area = request.area;
|
||||
|
||||
int impactCount = 0;
|
||||
for (const auto &effector : request.effectors())
|
||||
effector.chargeAmount();
|
||||
for (const auto &effector : request.effectors)
|
||||
effector.chargeAmount;
|
||||
if (impactCount == 1)
|
||||
ecCommonModifyRequest.explosionGeometry(AreaEffectSimulation::AesExplosionGeometry_def::EgPoint);
|
||||
ecCommonModifyRequest.explosionGeometry = AreaEffectSimulation::AesExplosionGeometry::EgPoint;
|
||||
else
|
||||
ecCommonModifyRequest.explosionGeometry(AreaEffectSimulation::AesExplosionGeometry_def::EgArea);
|
||||
ecCommonModifyRequest.explosionGeometry = AreaEffectSimulation::AesExplosionGeometry::EgArea;
|
||||
// ecCommonModifyRequest.zog(0);
|
||||
ecCommonModifyRequest.effectors(request.effectors());
|
||||
ecCommonModifyRequest.name(request.name()); // ZpNummer
|
||||
ecCommonModifyRequest.element(ecCommonModifyRequest.element()); // element
|
||||
ecCommonModifyRequest.effectors = request.effectors;
|
||||
ecCommonModifyRequest.name = request.name; // ZpNummer
|
||||
ecCommonModifyRequest.element = ecCommonModifyRequest.element; // element
|
||||
|
||||
ecCommonModifyRequest.partyId(request.partyId());
|
||||
ecCommonModifyRequest.partyId = request.partyId;
|
||||
// ecCommonModifyRequest.participantId(-1); // -1 -> avoid trajectory
|
||||
|
||||
// ToDo: no trajectory needed, but how can we transfer the rotation of MhpAreas?
|
||||
@@ -423,26 +423,26 @@ Core::FunctionReplyObject HandlerEffectCluster::effectClusterCreateRequest(const
|
||||
// external (externalId==0) -> partyId required
|
||||
// We keep the old charge behavior
|
||||
// and also ignore it from ADLER?
|
||||
const int externalIdValue = request.externalId().is_set() ? request.externalId().get() : 0;
|
||||
if (request.effectors().size() == 0)
|
||||
const int externalIdValue = request.externalId.is_set() ? request.externalId.get() : 0;
|
||||
if (request.effectors.size() == 0)
|
||||
return Core::FunctionReplyObject(tr_lts("dds", "Invalid Effector Count"));
|
||||
|
||||
// We assume that there is no mixture of GeraClasses between charges
|
||||
const ProjectDataManagement::GearClass gearClass = m_mainHandler->gearClassOfChargeTypeId(request.effectors().at(0).chargeStruct().chargeTypeId());
|
||||
const ProjectDataManagement::GearClass gearClass = m_mainHandler->gearClassOfChargeTypeId(request.effectors.at(0).chargeStruct.chargeTypeId);
|
||||
|
||||
const bool bDoClaimPlannedCharge = (request.id() == 0) && (externalIdValue == 0)
|
||||
&& (gearClass != ProjectDataManagement::GearClass_def::AirSupport
|
||||
const bool bDoClaimPlannedCharge = (request.id == 0) && (externalIdValue == 0)
|
||||
&& (gearClass != ProjectDataManagement::GearClass::GearClass_AirSupport
|
||||
//&& (m_mainHandler->dds()->pdmDtc()->isAdlerChargeType(request.chargeTypeId()))
|
||||
)
|
||||
&& 1 == 2 && (request.effectSourceId() == ProjectDataManagement::EffectSource::ES_Internal);
|
||||
&& 1 == 2 && (request.effectSourceId == ProjectDataManagement::EffectSource::ES_Internal);
|
||||
|
||||
if (bDoClaimPlannedCharge)
|
||||
{
|
||||
// get full charge amount per charge
|
||||
|
||||
QMap<int, int> mapChargeTypeAmount; // QMp<chargeTypeId, chargeAmount>
|
||||
for (const auto &effector : request.effectors())
|
||||
mapChargeTypeAmount.insert(effector.chargeStruct().chargeTypeId(), mapChargeTypeAmount.value(effector.chargeStruct().chargeTypeId()) + effector.chargeAmount());
|
||||
for (const auto &effector : request.effectors)
|
||||
mapChargeTypeAmount.insert(effector.chargeStruct.chargeTypeId, mapChargeTypeAmount.value(effector.chargeStruct.chargeTypeId) + effector.chargeAmount);
|
||||
QMapIterator<int, int> it(mapChargeTypeAmount);
|
||||
while (it.hasNext())
|
||||
{
|
||||
@@ -452,14 +452,14 @@ Core::FunctionReplyObject HandlerEffectCluster::effectClusterCreateRequest(const
|
||||
if (chargeNeeded <= 0)
|
||||
return Core::FunctionReplyObject(tr_lts("dds", "Invalid impact count (<= 0)."));
|
||||
|
||||
if (request.id() == 0)
|
||||
if (request.id == 0)
|
||||
{
|
||||
int chargeLeft = m_mainHandler->chargeAdministrationHandler()->availableCharge(it.key(), request.partyId().get());
|
||||
int chargeLeft = m_mainHandler->chargeAdministrationHandler()->availableCharge(it.key(), request.partyId.get());
|
||||
|
||||
QString chargeName = QString::fromStdString(m_mainHandler->dds()->pdmDtc()->chargeType(it.key()).name());
|
||||
QString chargeName = QString::fromStdString(m_mainHandler->dds()->pdmDtc()->chargeType(it.key()).name);
|
||||
QString fireUnitName;
|
||||
if (request.participantId().is_set())
|
||||
fireUnitName = QString::fromStdString(m_mainHandler->dds()->ppmDtc()->participant(request.participantId().get()).designator());
|
||||
if (request.participantId.is_set())
|
||||
fireUnitName = QString::fromStdString(m_mainHandler->dds()->ppmDtc()->participant(request.participantId.get()).designator);
|
||||
|
||||
if (chargeNeeded > chargeLeft)
|
||||
return Core::FunctionReplyObject(tr_lts("dds", "Invalid impact count. Fire Unit '%1' has %2 charges (%3), but for this cluster %4 are needed."))
|
||||
@@ -474,11 +474,11 @@ Core::FunctionReplyObject HandlerEffectCluster::effectClusterCreateRequest(const
|
||||
Database::AesEffectCluster newData;
|
||||
QVector<Database::AesEffectorData> newEffectorDataVec;
|
||||
|
||||
const QJsonObject propertiesObject = QJsonDocument::fromJson(QByteArray::fromStdString(request.properties())).object();
|
||||
const QJsonObject propertiesObject = QJsonDocument::fromJson(QByteArray::fromStdString(request.properties)).object();
|
||||
|
||||
fillData(request, newData, newEffectorDataVec, m_mainHandler);
|
||||
DEBUG_LOG(m_logger) << "AUTO newData " << newData.impactCount;
|
||||
if (!request.properties().empty() && (!request.effectStart().is_set() || request.effectStart().get() == 0))
|
||||
if (!request.properties.empty() && (!request.effectStart.is_set() || request.effectStart.get() == 0))
|
||||
{
|
||||
newData.isUsingEffectStateReceived = propertiesObject.value(QStringLiteral("useReceived")).toBool();
|
||||
}
|
||||
@@ -513,7 +513,7 @@ Core::FunctionReplyObject HandlerEffectCluster::effectClusterCreateRequest(const
|
||||
return Core::FunctionReplyObject(1, tr_lts("dds", "Too many active air supports."));
|
||||
}
|
||||
}
|
||||
else if (totalAreasCentral() >= (s_maxActiveAreasCentral[AesType::AtEffectCluster]) + (s_currentAirSupportCount) && request.effectStart().is_set())
|
||||
else if (totalAreasCentral() >= (s_maxActiveAreasCentral[static_cast<int>(AesType::AtEffectCluster)]) + (s_currentAirSupportCount) && request.effectStart.is_set())
|
||||
{
|
||||
ifs->removeObject(); // Not finally deleted from db after this,Fallback if DB deletion is not working correct
|
||||
ifs->removeObjectFromDb();
|
||||
@@ -543,21 +543,21 @@ Core::FunctionReplyObject HandlerEffectCluster::effectClusterModifyRequest(const
|
||||
// // externalId maybe set be HLA interface:
|
||||
// // from external (externalIdValue>0) -> no partyId required
|
||||
// // from internal (externalIdValue==0) -> partyId required
|
||||
// const int externalIdValue = request.externalId().is_set() ? request.externalId().get() : 0;
|
||||
// if (externalIdValue == 0 && !request.partyId().is_set())
|
||||
// const int externalIdValue = request.externalId.is_set() ? request.externalId.get() : 0;
|
||||
// if (externalIdValue == 0 && !request.partyId.is_set())
|
||||
// return Core::FunctionReplyObject(tr_lts("dds", "Explosion areas need a party id."));
|
||||
|
||||
DEBUG_LOG(m_logger) << "request.effectStart :" << request.effectStart() << ", effectDuration :"
|
||||
<< request.effectDuration()
|
||||
DEBUG_LOG(m_logger) << "request.effectStart :" << request.effectStart << ", effectDuration :"
|
||||
<< request.effectDuration
|
||||
// << ", flightDuration :" << request.flightDuration()
|
||||
// << ", tapTime :" << request.tapTime()
|
||||
<< ", properties: " << request.properties();
|
||||
<< ", properties: " << request.properties;
|
||||
|
||||
Core::FunctionReplyObject ret;
|
||||
if (request.id() == 0 || ((request.id() < 0) && !getObjectFromMap(m_objectMap, std::abs(request.id()), ret)))
|
||||
if (request.id == 0 || ((request.id < 0) && !getObjectFromMap(m_objectMap, std::abs(request.id), ret)))
|
||||
return effectClusterCreateRequest(request);
|
||||
|
||||
ObjectEffectCluster *ifs = getObjectFromMap(m_objectMap, std::abs(request.id()), ret);
|
||||
ObjectEffectCluster *ifs = getObjectFromMap(m_objectMap, std::abs(request.id), ret);
|
||||
if (!ifs)
|
||||
return ret;
|
||||
|
||||
@@ -569,12 +569,12 @@ Core::FunctionReplyObject HandlerEffectCluster::effectClusterModifyRequest(const
|
||||
const QJsonObject propertiesObject = QJsonDocument::fromJson(QByteArray::fromStdString(aea.properties.toStdString())).object();
|
||||
|
||||
// Context NASAT: check via chargeTypeId:
|
||||
const ProjectDataManagement::GearClass gc = m_mainHandler->gearClassOfChargeTypeId(request.effectors().at(0).chargeStruct().chargeTypeId());
|
||||
const ProjectDataManagement::GearClass gc = m_mainHandler->gearClassOfChargeTypeId(request.effectors.at(0).chargeStruct.chargeTypeId);
|
||||
|
||||
const bool bChargeIsAirSupport = (gc == ProjectDataManagement::GearClass::GearClass_AirSupport);
|
||||
ifs->setAirSupportSource(bChargeIsAirSupport);
|
||||
// For counting, only Elements being at least prepared are important:
|
||||
if (request.effectStart().is_set() && ifs->isObjectModifiable()) // ToDo: check
|
||||
if (request.effectStart.is_set() && ifs->isObjectModifiable()) // ToDo: check
|
||||
{
|
||||
// Calculate new polygon here. Not nice, though
|
||||
auto poly = Polygons::effectClusterArea(aea);
|
||||
@@ -590,20 +590,20 @@ Core::FunctionReplyObject HandlerEffectCluster::effectClusterModifyRequest(const
|
||||
}
|
||||
else
|
||||
{
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[AesType::AtEffectCluster] + (s_currentAirSupportCount)) && request.effectStart().is_set()
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[static_cast<int>(AesType::AtEffectCluster)] + (s_currentAirSupportCount)) && request.effectStart.is_set()
|
||||
&& ((wasCentral && !ifs->isActivationTimeSet()) || !wasCentral))
|
||||
return Core::FunctionReplyObject(1, tr_lts("dds", "Too many active central effect clusters."));
|
||||
}
|
||||
// For counting, only Elements being at least prepared are important:
|
||||
}
|
||||
|
||||
if (request.id() < 0 && checkStateForSfm(ifs))
|
||||
if (request.id < 0 && checkStateForSfm(ifs))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Overwrite Effect State for OC";
|
||||
aea.effectStateId = AesEffectState::EsPrepared;
|
||||
}
|
||||
|
||||
DEBUG_LOG(m_logger) << "request.properties()" << request.properties() << " aea.properties=" << aea.properties;
|
||||
DEBUG_LOG(m_logger) << "request.properties()" << request.properties << " aea.properties=" << aea.properties;
|
||||
// ifs->setEffectors(effectorDataVec);
|
||||
// updateProperties(aea, effectorDataVec); <- done in fillData
|
||||
// update internalMap
|
||||
@@ -656,7 +656,7 @@ void HandlerEffectCluster::onEffectClusterPauseResumeRequest(const rti::core::Sa
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onEffectClusterPauseResumeRequest" << request;
|
||||
Core::FunctionReplyObject ret;
|
||||
ObjectEffectCluster *ifs = getObjectFromMap(m_objectMap, request.id(), ret);
|
||||
ObjectEffectCluster *ifs = getObjectFromMap(m_objectMap, request.id, ret);
|
||||
if (!ifs)
|
||||
{
|
||||
m_mainHandler->dds()->fts()->effectClusterPauseResumeReply(cookie, ret);
|
||||
@@ -677,13 +677,13 @@ void HandlerEffectCluster::onEffectClusterFireHaltRequest(const rti::core::Sampl
|
||||
|
||||
Core::FunctionReplyObject ret;
|
||||
|
||||
ProjectDataManagement::L22_FireHaltCategory categorie = request.fireHaltCategory();
|
||||
ProjectDataManagement::L22_FireHaltCategory categorie = request.fireHaltCategory;
|
||||
|
||||
QMap<int, ObjectEffectCluster *> effectClusterPartyMap;
|
||||
|
||||
for (const auto *area : qAsConst(m_objectMap))
|
||||
{
|
||||
if (area->data().partyId == request.partyId())
|
||||
if (area->data().partyId == request.partyId)
|
||||
{
|
||||
ObjectEffectCluster *ifs = getObjectFromMap(m_objectMap, area->data().id, ret);
|
||||
if (!ifs)
|
||||
@@ -696,7 +696,7 @@ void HandlerEffectCluster::onEffectClusterFireHaltRequest(const rti::core::Sampl
|
||||
}
|
||||
}
|
||||
|
||||
switch (categorie.underlying())
|
||||
switch (categorie)
|
||||
{
|
||||
case ProjectDataManagement::L22_FireHaltCategory::L22_FireHaltCategory_A: // Feuer Halt Allgemein
|
||||
{
|
||||
@@ -705,9 +705,9 @@ void HandlerEffectCluster::onEffectClusterFireHaltRequest(const rti::core::Sampl
|
||||
{
|
||||
EffectClusterPauseResumeRequest req;
|
||||
|
||||
req.id(ifs->data().id);
|
||||
req.remainingDuration(ifs->data().effectDuration);
|
||||
req.resumeExecution(false); // false -> pause aes
|
||||
req.id = ifs->data().id;
|
||||
req.remainingDuration = ifs->data().effectDuration;
|
||||
req.resumeExecution = false; // false -> pause aes
|
||||
|
||||
ret = ifs->resumePause(req);
|
||||
}
|
||||
@@ -720,9 +720,9 @@ void HandlerEffectCluster::onEffectClusterFireHaltRequest(const rti::core::Sampl
|
||||
// the fire hold with the corresponding target coordinate and circular area.
|
||||
for (auto *ifs : qAsConst(effectClusterPartyMap))
|
||||
{
|
||||
const double lonRad = request.longitude().is_set() ? request.longitude().get() * LtsCoordTrans::deg2rad() : 0.0;
|
||||
const double latRad = request.latitude().is_set() ? request.latitude().get() * LtsCoordTrans::deg2rad() : 0.0;
|
||||
const int radius = request.radius().is_set() ? request.radius().get() : 0;
|
||||
const double lonRad = request.longitude.is_set() ? request.longitude.get() * LtsCoordTrans::deg2rad() : 0.0;
|
||||
const double latRad = request.latitude.is_set() ? request.latitude.get() * LtsCoordTrans::deg2rad() : 0.0;
|
||||
const int radius = request.radius.is_set() ? request.radius.get() : 0;
|
||||
|
||||
DEBUG_LOG(m_logger) << "[Feuer Halt Referenziert] " << "lonRad : " << lonRad << " " << "latRad : " << latRad << " " << "radius : " << radius;
|
||||
|
||||
@@ -731,9 +731,9 @@ void HandlerEffectCluster::onEffectClusterFireHaltRequest(const rti::core::Sampl
|
||||
DEBUG_LOG(m_logger) << "[Feuer Halt Referenziert ----- intersectWithCircle] " << "effectClusterId: " << ifs->data().id;
|
||||
|
||||
EffectClusterPauseResumeRequest req;
|
||||
req.id(ifs->data().id);
|
||||
req.remainingDuration(ifs->data().effectDuration);
|
||||
req.resumeExecution(false); // false -> pause aes
|
||||
req.id = ifs->data().id;
|
||||
req.remainingDuration = ifs->data().effectDuration;
|
||||
req.resumeExecution = false; // false -> pause aes
|
||||
|
||||
ifs->resumePause(req);
|
||||
}
|
||||
@@ -750,7 +750,7 @@ void HandlerEffectCluster::onEffectClusterFireHaltRequest(const rti::core::Sampl
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "[Feuer Einstellen ----- markAsExpired] " << "effectClusterId: " << ifs->data().id;
|
||||
|
||||
ifs->markAsExpired(request.entladenSchuss().is_set() ? request.entladenSchuss().get() : false);
|
||||
ifs->markAsExpired(request.entladenSchuss.is_set() ? request.entladenSchuss.get() : false);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -760,8 +760,8 @@ void HandlerEffectCluster::onEffectClusterFireHaltRequest(const rti::core::Sampl
|
||||
DEBUG_LOG(m_logger) << "[Aufheben Feuer Halt Allgemein] " << "effectClusterId: " << ifs->data().id;
|
||||
|
||||
EffectClusterPauseResumeRequest req;
|
||||
req.remainingDuration(ifs->data().effectDuration);
|
||||
req.resumeExecution(true); // true -> resume aes
|
||||
req.remainingDuration = ifs->data().effectDuration;
|
||||
req.resumeExecution = true; // true -> resume aes
|
||||
|
||||
ifs->resumePause(req);
|
||||
}
|
||||
@@ -770,9 +770,9 @@ void HandlerEffectCluster::onEffectClusterFireHaltRequest(const rti::core::Sampl
|
||||
{
|
||||
for (auto *ifs : qAsConst(effectClusterPartyMap))
|
||||
{
|
||||
const double lonRad = request.longitude().is_set() ? request.longitude().get() * LtsCoordTrans::deg2rad() : 0.0; // optional<lonRad>
|
||||
const double latRad = request.latitude().is_set() ? request.latitude().get() * LtsCoordTrans::deg2rad() : 0.0; // optional <latRad>
|
||||
const int radius = request.radius().is_set() ? request.radius().get() : 0;
|
||||
const double lonRad = request.longitude.is_set() ? request.longitude.get() * LtsCoordTrans::deg2rad() : 0.0; // optional<lonRad>
|
||||
const double latRad = request.latitude.is_set() ? request.latitude.get() * LtsCoordTrans::deg2rad() : 0.0; // optional <latRad>
|
||||
const int radius = request.radius.is_set() ? request.radius.get() : 0;
|
||||
|
||||
DEBUG_LOG(m_logger) << "[Aufheben Feuer Halt Referenziert] " << "lonRad : " << lonRad << " " << "latRad : " << latRad << " " << "radius : " << radius;
|
||||
|
||||
@@ -782,9 +782,9 @@ void HandlerEffectCluster::onEffectClusterFireHaltRequest(const rti::core::Sampl
|
||||
|
||||
EffectClusterPauseResumeRequest req;
|
||||
|
||||
req.id(ifs->data().id);
|
||||
req.remainingDuration(ifs->data().effectDuration);
|
||||
req.resumeExecution(true); // true -> resume aes
|
||||
req.id = ifs->data().id;
|
||||
req.remainingDuration = ifs->data().effectDuration;
|
||||
req.resumeExecution = true; // true -> resume aes
|
||||
|
||||
ifs->resumePause(req);
|
||||
}
|
||||
@@ -792,7 +792,7 @@ void HandlerEffectCluster::onEffectClusterFireHaltRequest(const rti::core::Sampl
|
||||
break;
|
||||
}
|
||||
default:
|
||||
INFO_LOG(m_logger) << "EX-FH missing or wrong FireHaltCategory" << categorie.underlying();
|
||||
INFO_LOG(m_logger) << "EX-FH missing or wrong FireHaltCategory" << categorie;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -805,8 +805,8 @@ void HandlerEffectCluster::onEffectClusterFireHaltRequest(const rti::core::Sampl
|
||||
void HandlerEffectCluster::onEffectClusterReleaseReceivedRequest(const rti::core::SampleIdentity &cookie, const EffectClusterReleaseReceivedRequest &request)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onEffectClusterReleaseReceivedRequest" << request;
|
||||
Core::FunctionReplyObject ret(request.id());
|
||||
ObjectEffectCluster *ifs = getObjectFromMap(m_objectMap, request.id(), ret);
|
||||
Core::FunctionReplyObject ret(request.id);
|
||||
ObjectEffectCluster *ifs = getObjectFromMap(m_objectMap, request.id, ret);
|
||||
if (!ifs)
|
||||
{
|
||||
ERROR_LOG(m_logger) << ret();
|
||||
@@ -816,7 +816,7 @@ void HandlerEffectCluster::onEffectClusterReleaseReceivedRequest(const rti::core
|
||||
|
||||
if (!ifs->isUsingEffectStateReceived())
|
||||
{
|
||||
ret = ret.setStr(tr_lts("dds", "EffectCluster with id %1 is not using EffectState Received")).arg(request.id());
|
||||
ret = ret.setStr(tr_lts("dds", "EffectCluster with id %1 is not using EffectState Received")).arg(request.id);
|
||||
ERROR_LOG(m_logger) << ret();
|
||||
m_mainHandler->dds()->fts()->effectClusterReleaseReceivedReply(cookie, ret);
|
||||
return;
|
||||
@@ -832,9 +832,9 @@ void HandlerEffectCluster::onEffectClusterReleaseReceivedRequest(const rti::core
|
||||
|
||||
void HandlerEffectCluster::onAcknowledgeExternalAesItemRequest(const rti::core::SampleIdentity &cookie, const AcknowledgeExternalAesItemRequest &request)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "HandlerEffectCluster::onAcknowledgeExternalAesItemRequest for aesItem" << request.aesId();
|
||||
Core::FunctionReplyObject ret(request.aesId());
|
||||
ObjectEffectCluster *ifs = getObjectFromMap(m_objectMap, request.aesId(), ret);
|
||||
DEBUG_LOG(m_logger) << "HandlerEffectCluster::onAcknowledgeExternalAesItemRequest for aesItem" << request.aesId;
|
||||
Core::FunctionReplyObject ret(request.aesId);
|
||||
ObjectEffectCluster *ifs = getObjectFromMap(m_objectMap, request.aesId, ret);
|
||||
if (!ifs)
|
||||
{
|
||||
ERROR_LOG(m_logger) << ret();
|
||||
@@ -852,18 +852,18 @@ void HandlerEffectCluster::onAcknowledgeExternalAesItemRequest(const rti::core::
|
||||
|
||||
void HandlerEffectCluster::onSetAesItemEffectorStateRequest(const rti::core::SampleIdentity &cookie, const SetAesItemEffectorStateRequest &request)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "HandlerEffectCluster::onSetAesItemEffectorStateRequest for aesItem" << request.aesId() << " to State: " << request.newEffectorState();
|
||||
Core::FunctionReplyObject ret(request.aesId());
|
||||
ObjectEffectCluster *ifs = getObjectFromMap(m_objectMap, request.aesId(), ret);
|
||||
DEBUG_LOG(m_logger) << "HandlerEffectCluster::onSetAesItemEffectorStateRequest for aesItem" << request.aesId << " to State: " << request.newEffectorState;
|
||||
Core::FunctionReplyObject ret(request.aesId);
|
||||
ObjectEffectCluster *ifs = getObjectFromMap(m_objectMap, request.aesId, ret);
|
||||
if (!ifs)
|
||||
{
|
||||
ERROR_LOG(m_logger) << ret();
|
||||
m_mainHandler->dds()->fts()->setAesItemEffectorStateReply(cookie, ret);
|
||||
return;
|
||||
}
|
||||
if (!ifs->overrideEffectorStates(request.newEffectorState()))
|
||||
if (!ifs->overrideEffectorStates(request.newEffectorState))
|
||||
{
|
||||
ret.setStr(tr_lts("dds", "EffectCluster with id %1 can't change to new State")).arg(request.aesId());
|
||||
ret.setStr(tr_lts("dds", "EffectCluster with id %1 can't change to new State")).arg(request.aesId);
|
||||
}
|
||||
|
||||
m_mainHandler->dds()->fts()->setAesItemEffectorStateReply(cookie, ret);
|
||||
@@ -901,7 +901,7 @@ void HandlerEffectCluster::onTrajectoryAdlerModifyRequest(const rti::core::Sampl
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onTrajectoryAdlerModifyRequest" << request;
|
||||
Core::FunctionReplyObject ret;
|
||||
ObjectEffectCluster *ifs = getObjectFromMap(m_objectMap, request.aesItemId(), ret);
|
||||
ObjectEffectCluster *ifs = getObjectFromMap(m_objectMap, request.aesItemId, ret);
|
||||
if (!ifs)
|
||||
{
|
||||
m_mainHandler->dds()->fts()->trajectoryAdlerModifyReply(cookie, ret);
|
||||
|
||||
+9
-9
@@ -68,20 +68,20 @@ void HandlerEffector::onParticipantChanged(const ParticipantManagement::Particip
|
||||
//DEBUG_LOG(m_logger)<<"onParticipantChanged participantId:" << data.id();
|
||||
if (modType == DataModification::eRemoved)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "m_participantsOutsideMap.remove participantId: " << data.id();
|
||||
if (m_effectors.contains(data.id()))
|
||||
deleteEffector(data.id());
|
||||
DEBUG_LOG(m_logger) << "m_participantsOutsideMap.remove participantId: " << data.id;
|
||||
if (m_effectors.contains(data.id))
|
||||
deleteEffector(data.id);
|
||||
return;
|
||||
}
|
||||
if (m_ppmDtc->isArtilleryType(data.typeId()))
|
||||
if (m_ppmDtc->isArtilleryType(data.typeId))
|
||||
{
|
||||
// Filter TypeClass Unit
|
||||
ParticipantManagement::Type type = m_ppmDtc->type(data.typeId());
|
||||
if (type.typeClass() != ParticipantManagement::TypeClass_def::Unit)
|
||||
createEffector(data.id());
|
||||
ParticipantManagement::Type type = m_ppmDtc->type(data.typeId);
|
||||
if (type.typeClass != ParticipantManagement::TypeClass::Unit)
|
||||
createEffector(data.id);
|
||||
}
|
||||
else
|
||||
if (m_effectors.contains(data.id()))
|
||||
deleteEffector(data.id());
|
||||
if (m_effectors.contains(data.id))
|
||||
deleteEffector(data.id);
|
||||
}
|
||||
}
|
||||
+54
-54
@@ -15,7 +15,7 @@ namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
HandlerExplosionArea::HandlerExplosionArea(MainHandler *mainHandler)
|
||||
: HandlerBaseTmpl<ObjectExplosionArea>(mainHandler, QStringLiteral("ExplosionArea"), s_areaCount[AesType::AtExplosionArea], s_areaCountCentral[AesType::AtExplosionArea])
|
||||
: HandlerBaseTmpl<ObjectExplosionArea>(mainHandler, QStringLiteral("ExplosionArea"), s_areaCount[static_cast<int>(AesType::AtExplosionArea)], s_areaCountCentral[static_cast<int>(AesType::AtExplosionArea)])
|
||||
, Interface::Fts::ExplosionAreaModifyRequestHandler(mainHandler->dds()->fts())
|
||||
, Interface::Fts::ExplosionAreaRemoveRequestHandler(mainHandler->dds()->fts())
|
||||
, Interface::Fts::ExplosionAreaPauseResumeRequestHandler(m_mainHandler->dds()->fts())
|
||||
@@ -40,7 +40,7 @@ bool HandlerExplosionArea::init()
|
||||
}
|
||||
if (!ifs->data().isCentral)
|
||||
{
|
||||
if (totalAreas() >= (s_maxActiveAreas[AesType::AtExplosionArea] + s_maxActiveAreas[AesType::AtExplosionSingle]))
|
||||
if (totalAreas() >= (s_maxActiveAreas[static_cast<int>(AesType::AtExplosionArea)] + s_maxActiveAreas[static_cast<int>(AesType::AtExplosionSingle)]))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "More active explosion areas in database than allowed - ignoring the rest!";
|
||||
ifs->removeObject();
|
||||
@@ -50,7 +50,7 @@ bool HandlerExplosionArea::init()
|
||||
}
|
||||
else
|
||||
{
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[AesType::AtExplosionArea] + s_maxActiveAreasCentral[AesType::AtExplosionSingle]))
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[static_cast<int>(AesType::AtExplosionArea)] + s_maxActiveAreasCentral[static_cast<int>(AesType::AtExplosionSingle)]))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "More active explosion areas in database than allowed - ignoring the rest!";
|
||||
ifs->removeObject();
|
||||
@@ -83,39 +83,39 @@ bool HandlerExplosionArea::init()
|
||||
|
||||
int HandlerExplosionArea::totalAreas() const
|
||||
{
|
||||
return s_areaCount[AesType::AtExplosionArea] + s_areaCount[AesType::AtExplosionSingle];
|
||||
return s_areaCount[static_cast<int>(AesType::AtExplosionArea)] + s_areaCount[static_cast<int>(AesType::AtExplosionSingle)];
|
||||
}
|
||||
|
||||
int HandlerExplosionArea::totalAreasCentral() const
|
||||
{
|
||||
return s_areaCountCentral[AesType::AtExplosionArea] + s_areaCountCentral[AesType::AtExplosionSingle];
|
||||
return s_areaCountCentral[static_cast<int>(AesType::AtExplosionArea)] + s_areaCountCentral[static_cast<int>(AesType::AtExplosionSingle)];
|
||||
}
|
||||
|
||||
|
||||
static void fillData(const ExplosionAreaModifyRequest &src, Database::AesExplosionArea &dst)
|
||||
{
|
||||
if (src.id() < 0) // is the id given as negative? set id -> used by OC-Laptop
|
||||
dst.id = src.id();
|
||||
if (src.id < 0) // is the id given as negative? set id -> used by OC-Laptop
|
||||
dst.id = src.id;
|
||||
|
||||
dst.impactPosition.rx() = src.area().cornerBottomLeft().lon();
|
||||
dst.impactPosition.ry() = src.area().cornerBottomLeft().lat();
|
||||
dst.rotationAngle = src.area().rotation();
|
||||
dst.name = QString::fromStdString(src.name());
|
||||
dst.effectStart = src.effectStart().is_set() && src.effectStart().get() > 0 ? QDateTime::fromMSecsSinceEpoch(src.effectStart().get()) : QDateTime();
|
||||
dst.effectDuration = src.effectDuration();
|
||||
dst.effectSourceId = src.effectSourceId();
|
||||
dst.impactLength = src.area().height();
|
||||
dst.impactWidth = src.area().width();
|
||||
dst.partyId = src.partyId().is_set() ? src.partyId().get() : 0;
|
||||
dst.chargeTypeId = src.chargeTypeId();
|
||||
dst.participantId = src.participantId().is_set() ? src.participantId().get() : 0;
|
||||
dst.cannonCount = src.cannonCount();
|
||||
dst.cannonRounds = src.cannonRounds();
|
||||
dst.altitude = src.altitude();
|
||||
dst.firePurpose = QString::fromStdString(src.purpose());
|
||||
dst.fireRequestTime = QDateTime::fromMSecsSinceEpoch(src.fireRequestTime());
|
||||
dst.effectMarkingInTa = src.effectMarkingInTa();
|
||||
dst.externalId = src.externalId().is_set() ? src.externalId().get() : 0;
|
||||
dst.impactPosition.rx() = src.area.cornerBottomLeft.lon;
|
||||
dst.impactPosition.ry() = src.area.cornerBottomLeft.lat;
|
||||
dst.rotationAngle = src.area.rotation;
|
||||
dst.name = QString::fromStdString(src.name);
|
||||
dst.effectStart = src.effectStart.is_set() && src.effectStart.get() > 0 ? QDateTime::fromMSecsSinceEpoch(src.effectStart.get()) : QDateTime();
|
||||
dst.effectDuration = src.effectDuration;
|
||||
dst.effectSourceId = src.effectSourceId;
|
||||
dst.impactLength = src.area.height;
|
||||
dst.impactWidth = src.area.width;
|
||||
dst.partyId = src.partyId.is_set() ? src.partyId.get() : 0;
|
||||
dst.chargeTypeId = src.chargeTypeId;
|
||||
dst.participantId = src.participantId.is_set() ? src.participantId.get() : 0;
|
||||
dst.cannonCount = src.cannonCount;
|
||||
dst.cannonRounds = src.cannonRounds;
|
||||
dst.altitude = src.altitude;
|
||||
dst.firePurpose = QString::fromStdString(src.purpose);
|
||||
dst.fireRequestTime = QDateTime::fromMSecsSinceEpoch(src.fireRequestTime);
|
||||
dst.effectMarkingInTa = src.effectMarkingInTa;
|
||||
dst.externalId = src.externalId.is_set() ? src.externalId.get() : 0;
|
||||
}
|
||||
|
||||
void HandlerExplosionArea::onExplosionAreaModifyRequest(const rti::core::SampleIdentity &cookie,
|
||||
@@ -130,22 +130,22 @@ void HandlerExplosionArea::onExplosionAreaModifyRequest(const rti::core::SampleI
|
||||
|
||||
Core::FunctionReplyObject HandlerExplosionArea::explosionAreaCreateRequest(const ExplosionAreaModifyRequest &request)
|
||||
{
|
||||
if (!request.partyId().is_set())
|
||||
if (!request.partyId.is_set())
|
||||
return Core::FunctionReplyObject(tr_lts("dds", "Explosion areas need a party id."));
|
||||
|
||||
int chargeNeeded = request.cannonCount() * request.cannonRounds();
|
||||
int chargeNeeded = request.cannonCount * request.cannonRounds;
|
||||
if (chargeNeeded <= 0)
|
||||
return Core::FunctionReplyObject(tr_lts("dds", "Invalid impact count (cannon round or cannon count <= 0)."));
|
||||
|
||||
if (request.id() == 0)
|
||||
if (request.id == 0)
|
||||
{
|
||||
int chargeLeft = m_mainHandler->chargeAdministrationHandler()->availableCharge(request.chargeTypeId(), request.partyId().get());
|
||||
int chargeLeft = m_mainHandler->chargeAdministrationHandler()->availableCharge(request.chargeTypeId, request.partyId.get());
|
||||
if (chargeNeeded > chargeLeft)
|
||||
return Core::FunctionReplyObject(tr_lts("dds", "Invalid impact count (%1 charges needed but only %2 charges available for Charge Id %3 and Party Id %4)."))
|
||||
.arg(chargeNeeded)
|
||||
.arg(chargeLeft)
|
||||
.arg(request.chargeTypeId())
|
||||
.arg(request.partyId().get());
|
||||
.arg(request.chargeTypeId)
|
||||
.arg(request.partyId.get());
|
||||
}
|
||||
|
||||
Database::AesExplosionArea newData;
|
||||
@@ -164,7 +164,7 @@ Core::FunctionReplyObject HandlerExplosionArea::explosionAreaCreateRequest(const
|
||||
|
||||
if (ifs->data().isCentral)
|
||||
{
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[AesType::AtExplosionArea] + s_maxActiveAreasCentral[AesType::AtExplosionSingle]) && request.effectStart().is_set())
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[static_cast<int>(AesType::AtExplosionArea)] + s_maxActiveAreasCentral[static_cast<int>(AesType::AtExplosionSingle)]) && request.effectStart.is_set())
|
||||
{
|
||||
ifs->removeObject(); //Not finally deleted from db after this,Fallback if DB deletion is not working correct
|
||||
ifs->removeObjectFromDb();
|
||||
@@ -174,7 +174,7 @@ Core::FunctionReplyObject HandlerExplosionArea::explosionAreaCreateRequest(const
|
||||
}
|
||||
else
|
||||
{
|
||||
if (totalAreas() >= (s_maxActiveAreas[AesType::AtExplosionArea] + s_maxActiveAreas[AesType::AtExplosionSingle]) && request.effectStart().is_set())
|
||||
if (totalAreas() >= (s_maxActiveAreas[static_cast<int>(AesType::AtExplosionArea)] + s_maxActiveAreas[static_cast<int>(AesType::AtExplosionSingle)]) && request.effectStart.is_set())
|
||||
{
|
||||
ifs->removeObject(); //Not finally deleted from db after this,Fallback if DB deletion is not working correct
|
||||
ifs->removeObjectFromDb();
|
||||
@@ -208,10 +208,10 @@ Core::FunctionReplyObject HandlerExplosionArea::explosionAreaCreateRequest(const
|
||||
Core::FunctionReplyObject HandlerExplosionArea::explosionAreaModifyRequest(const ExplosionAreaModifyRequest &request)
|
||||
{
|
||||
Core::FunctionReplyObject ret;
|
||||
if (request.id() == 0 || ((request.id() < 0) && !getObjectFromMap(m_objectMap, std::abs(request.id()), ret)))
|
||||
if (request.id == 0 || ((request.id < 0) && !getObjectFromMap(m_objectMap, std::abs(request.id), ret)))
|
||||
return explosionAreaCreateRequest(request);
|
||||
|
||||
ObjectExplosionArea *ifs = getObjectFromMap(m_objectMap, std::abs(request.id()), ret);
|
||||
ObjectExplosionArea *ifs = getObjectFromMap(m_objectMap, std::abs(request.id), ret);
|
||||
if (!ifs)
|
||||
return ret;
|
||||
|
||||
@@ -230,18 +230,18 @@ Core::FunctionReplyObject HandlerExplosionArea::explosionAreaModifyRequest(const
|
||||
/*!
|
||||
* Check if the max amount is reached if the effect start added after creation.
|
||||
!*/
|
||||
if(!ifs->isActivationTimeSet() && request.effectStart().is_set())
|
||||
if(!ifs->isActivationTimeSet() && request.effectStart.is_set())
|
||||
{
|
||||
if (isCentral)
|
||||
{
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[AesType::AtExplosionArea] + s_maxActiveAreasCentral[AesType::AtExplosionSingle]))
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[static_cast<int>(AesType::AtExplosionArea)] + s_maxActiveAreasCentral[static_cast<int>(AesType::AtExplosionSingle)]))
|
||||
{
|
||||
return Core::FunctionReplyObject(1, tr_lts("dds", "Too many active central explosion areas and explosion singles"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (totalAreas() >= (s_maxActiveAreas[AesType::AtExplosionArea] + s_maxActiveAreas[AesType::AtExplosionSingle]))
|
||||
if (totalAreas() >= (s_maxActiveAreas[static_cast<int>(AesType::AtExplosionArea)] + s_maxActiveAreas[static_cast<int>(AesType::AtExplosionSingle)]))
|
||||
{
|
||||
return Core::FunctionReplyObject(1, tr_lts("dds", "Too many active explosion areas and explosion singles"));
|
||||
}
|
||||
@@ -249,7 +249,7 @@ Core::FunctionReplyObject HandlerExplosionArea::explosionAreaModifyRequest(const
|
||||
}
|
||||
|
||||
// For counting, only Elements being at least prepared are important:
|
||||
if (request.effectStart().is_set() && ifs->isObjectModifiable())
|
||||
if (request.effectStart.is_set() && ifs->isObjectModifiable())
|
||||
{
|
||||
|
||||
// Calculate new polygon here. Not nice, though
|
||||
@@ -264,8 +264,8 @@ Core::FunctionReplyObject HandlerExplosionArea::explosionAreaModifyRequest(const
|
||||
// Change from central to training area
|
||||
if (wasCentral)
|
||||
{
|
||||
if (totalAreas() >= (s_maxActiveAreas[AesType::AtExplosionArea] + s_maxActiveAreas[AesType::AtExplosionSingle]))
|
||||
return Core::FunctionReplyObject(request.id(), tr_lts("dds", "Too many active explosion areas and explosion singles"));
|
||||
if (totalAreas() >= (s_maxActiveAreas[static_cast<int>(AesType::AtExplosionArea)] + s_maxActiveAreas[static_cast<int>(AesType::AtExplosionSingle)]))
|
||||
return Core::FunctionReplyObject(request.id, tr_lts("dds", "Too many active explosion areas and explosion singles"));
|
||||
|
||||
m_areaCount++;
|
||||
m_areaCountCentral--;
|
||||
@@ -274,8 +274,8 @@ Core::FunctionReplyObject HandlerExplosionArea::explosionAreaModifyRequest(const
|
||||
}
|
||||
else // Change from training area to central
|
||||
{
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[AesType::AtExplosionArea] + s_maxActiveAreasCentral[AesType::AtExplosionSingle]))
|
||||
return Core::FunctionReplyObject(request.id(), tr_lts("dds", "Too many active central explosion areas and explosion singles"));
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[static_cast<int>(AesType::AtExplosionArea)] + s_maxActiveAreasCentral[static_cast<int>(AesType::AtExplosionSingle)]))
|
||||
return Core::FunctionReplyObject(request.id, tr_lts("dds", "Too many active central explosion areas and explosion singles"));
|
||||
m_areaCount--;
|
||||
m_areaCountCentral++;
|
||||
DEBUG_LOG(m_logger) << "s_areaCount[AesType::AtExplosionArea] = " << m_areaCount;
|
||||
@@ -284,7 +284,7 @@ Core::FunctionReplyObject HandlerExplosionArea::explosionAreaModifyRequest(const
|
||||
}
|
||||
}
|
||||
|
||||
if (request.id() < 0 && checkStateForSfm(ifs))
|
||||
if (request.id < 0 && checkStateForSfm(ifs))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Overwrite Effect State for OC";
|
||||
aea.effectStateId = AesEffectState::EsPrepared;
|
||||
@@ -297,27 +297,27 @@ Core::FunctionReplyObject HandlerExplosionArea::explosionAreaModifyGeometryReque
|
||||
{
|
||||
// WARNING: request.area.cornerBottomLeft() contains center point!
|
||||
Core::FunctionReplyObject ret;
|
||||
ObjectExplosionArea *ifs = getObjectFromMap(m_objectMap, request.id(), ret);
|
||||
ObjectExplosionArea *ifs = getObjectFromMap(m_objectMap, request.id, ret);
|
||||
if (!ifs)
|
||||
return ret;
|
||||
|
||||
// Anzahl aktiver Areas ist erreicht, der Wirkbeginn ist (soll) gesetzt sein, aber die Area war
|
||||
// vorher noch ohne Wirkbeginn
|
||||
if (totalAreas() >= (s_maxActiveAreas[AesType::AtExplosionArea] + s_maxActiveAreas[AesType::AtExplosionSingle])
|
||||
&& request.effectStart().is_set()
|
||||
if (totalAreas() >= (s_maxActiveAreas[static_cast<int>(AesType::AtExplosionArea)] + s_maxActiveAreas[static_cast<int>(AesType::AtExplosionSingle)])
|
||||
&& request.effectStart.is_set()
|
||||
&& !ifs->isActivationTimeSet() // if time was not set before change and now check count
|
||||
&& !ifs->isObjectModifiable())
|
||||
return Core::FunctionReplyObject(request.id(), tr_lts("dds", "Too many active explosion areas and explosion singles"));
|
||||
return Core::FunctionReplyObject(request.id, tr_lts("dds", "Too many active explosion areas and explosion singles"));
|
||||
|
||||
// Todo: IsObjectModifiable() ?!?
|
||||
AreaEffectSimulation::Database::AesExplosionArea aea(ifs->data());
|
||||
|
||||
aea.impactPosition = Polygons::centerPoint2BottomLeft(QPointF(request.area().cornerBottomLeft().lon(),
|
||||
request.area().cornerBottomLeft().lat()),
|
||||
aea.impactPosition = Polygons::centerPoint2BottomLeft(QPointF(request.area.cornerBottomLeft.lon,
|
||||
request.area.cornerBottomLeft.lat),
|
||||
ifs->data().impactWidth,
|
||||
ifs->data().impactLength,
|
||||
request.area().rotation());
|
||||
aea.rotationAngle = request.area().rotation();
|
||||
request.area.rotation);
|
||||
aea.rotationAngle = request.area.rotation;
|
||||
return ifs->updateObject(aea);
|
||||
}
|
||||
|
||||
@@ -343,7 +343,7 @@ void HandlerExplosionArea::onExplosionAreaPauseResumeRequest(const rti::core::Sa
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onExplosionAreaPauseResumeRequest" << request;
|
||||
Core::FunctionReplyObject ret;
|
||||
ObjectExplosionArea *ifs = getObjectFromMap(m_objectMap, request.id(), ret);
|
||||
ObjectExplosionArea *ifs = getObjectFromMap(m_objectMap, request.id, ret);
|
||||
if (!ifs)
|
||||
{
|
||||
m_mainHandler->dds()->fts()->explosionAreaPauseResumeReply(cookie, ret);
|
||||
|
||||
+127
-127
@@ -23,7 +23,7 @@ namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
HandlerExplosionCluster::HandlerExplosionCluster(MainHandler *mainHandler)
|
||||
: HandlerBaseTmpl<ObjectExplosionCluster>(mainHandler, QStringLiteral("HandlerExplosionCluster"), s_areaCount[AesType::AtExplosionCluster], s_areaCountCentral[AesType::AtExplosionCluster])
|
||||
: HandlerBaseTmpl<ObjectExplosionCluster>(mainHandler, QStringLiteral("HandlerExplosionCluster"), s_areaCount[static_cast<int>(AesType::AtExplosionCluster)], s_areaCountCentral[static_cast<int>(AesType::AtExplosionCluster)])
|
||||
, Interface::Fts::ExplosionClusterModifyRequestHandler(mainHandler->dds()->fts())
|
||||
, Interface::Fts::ExplosionClusterSingleEffectOnlyModifyRequestHandler(mainHandler->dds()->fts())
|
||||
, Interface::Fts::ExplosionClusterOcModifyRequestHandler(mainHandler->dds()->fts())
|
||||
@@ -68,7 +68,7 @@ bool HandlerExplosionCluster::init()
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (totalAreas() >= s_maxActiveAreas[AesType::AtExplosionCluster])
|
||||
else if (totalAreas() >= s_maxActiveAreas[static_cast<int>(AesType::AtExplosionCluster)])
|
||||
{
|
||||
ERROR_LOG(m_logger) << "More active explosion areas in database than allowed - ignoring the rest!";
|
||||
ifs->removeObject();
|
||||
@@ -78,7 +78,7 @@ bool HandlerExplosionCluster::init()
|
||||
}
|
||||
else
|
||||
{
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[AesType::AtExplosionCluster]))
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[static_cast<int>(AesType::AtExplosionCluster)]))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "More active explosion areas in database than allowed - ignoring the rest!";
|
||||
ifs->removeObject();
|
||||
@@ -114,41 +114,41 @@ bool HandlerExplosionCluster::init()
|
||||
|
||||
int HandlerExplosionCluster::totalAreas() const
|
||||
{
|
||||
return s_areaCount[AesType::AtExplosionCluster];
|
||||
return s_areaCount[static_cast<int>(AesType::AtExplosionCluster)];
|
||||
}
|
||||
|
||||
int HandlerExplosionCluster::totalAreasCentral() const
|
||||
{
|
||||
return s_areaCountCentral[AesType::AtExplosionCluster] ;
|
||||
return s_areaCountCentral[static_cast<int>(AesType::AtExplosionCluster)] ;
|
||||
}
|
||||
|
||||
|
||||
static void fillData(const ExplosionClusterModifyRequest &src, Database::AesExplosionCluster &dst, MainHandler *mainHandler)
|
||||
{
|
||||
if (src.id() < 0) // is the id given as negative? set id -> used by OC-Laptop
|
||||
dst.id = src.id();
|
||||
if (src.id < 0) // is the id given as negative? set id -> used by OC-Laptop
|
||||
dst.id = src.id;
|
||||
|
||||
dst.name = QString::fromStdString(src.name());
|
||||
dst.element = QString::fromStdString(src.element());
|
||||
dst.name = QString::fromStdString(src.name);
|
||||
dst.element = QString::fromStdString(src.element);
|
||||
|
||||
|
||||
dst.impactPosition.rx() = src.area().cornerBottomLeft().lon();
|
||||
dst.impactPosition.ry() = src.area().cornerBottomLeft().lat();
|
||||
dst.impactLength = src.area().height();
|
||||
dst.impactWidth = src.area().width();
|
||||
dst.rotationAngle = src.area().rotation();
|
||||
dst.impactPosition.rx() = src.area.cornerBottomLeft.lon;
|
||||
dst.impactPosition.ry() = src.area.cornerBottomLeft.lat;
|
||||
dst.impactLength = src.area.height;
|
||||
dst.impactWidth = src.area.width;
|
||||
dst.rotationAngle = src.area.rotation;
|
||||
|
||||
const bool bIsPointSimilar = (src.explosionGeometry() == AreaEffectSimulation::AesExplosionGeometry_def::EgAimPoint) ||
|
||||
(src.explosionGeometry() == AreaEffectSimulation::AesExplosionGeometry_def::EgPoint);
|
||||
const bool bIsPointSimilar = (src.explosionGeometry == AreaEffectSimulation::AesExplosionGeometry::EgAimPoint) ||
|
||||
(src.explosionGeometry == AreaEffectSimulation::AesExplosionGeometry::EgPoint);
|
||||
|
||||
if (bIsPointSimilar && ((src.area().width() <= 0) || (src.area().height() <= 0)))
|
||||
if (bIsPointSimilar && ((src.area.width <= 0) || (src.area.height <= 0)))
|
||||
{
|
||||
const Core::GeoPosition2D &cornerBottomLeft = src.area().cornerBottomLeft();
|
||||
const double impactDiameter = mainHandler->dds()->pdmDtc()->impactRadius(src.chargeStruct().chargeTypeId(),
|
||||
src.chargeStruct().igniterTypeId(),
|
||||
src.chargeStruct().igniterFunctionId()) * 2.0; // GUEZE-2634
|
||||
const Core::GeoPosition2D &cornerBottomLeft = src.area.cornerBottomLeft;
|
||||
const double impactDiameter = mainHandler->dds()->pdmDtc()->impactRadius(src.chargeStruct.chargeTypeId,
|
||||
src.chargeStruct.igniterTypeId,
|
||||
src.chargeStruct.igniterFunctionId) * 2.0; // GUEZE-2634
|
||||
|
||||
const QPointF bottomLeft(Polygons::centerPoint2BottomLeft(QPointF(cornerBottomLeft.lon(), cornerBottomLeft.lat()),
|
||||
const QPointF bottomLeft(Polygons::centerPoint2BottomLeft(QPointF(cornerBottomLeft.lon, cornerBottomLeft.lat),
|
||||
impactDiameter, impactDiameter, 0));
|
||||
|
||||
dst.impactPosition.rx() = bottomLeft.x();
|
||||
@@ -157,49 +157,49 @@ static void fillData(const ExplosionClusterModifyRequest &src, Database::AesExpl
|
||||
dst.impactWidth = impactDiameter;
|
||||
}
|
||||
|
||||
dst.explosionGeometryId = src.explosionGeometry();
|
||||
dst.zog = src.tla();
|
||||
dst.explosionGeometryId = src.explosionGeometry;
|
||||
dst.zog = src.tla;
|
||||
|
||||
dst.effectStart = src.effectStart().is_set() && src.effectStart().get() > 0 ? QDateTime::fromMSecsSinceEpoch(src.effectStart().get()) : QDateTime();
|
||||
dst.effectDuration = src.effectDuration();
|
||||
dst.effectSourceId = src.effectSourceId();
|
||||
dst.effectStart = src.effectStart.is_set() && src.effectStart.get() > 0 ? QDateTime::fromMSecsSinceEpoch(src.effectStart.get()) : QDateTime();
|
||||
dst.effectDuration = src.effectDuration;
|
||||
dst.effectSourceId = src.effectSourceId;
|
||||
|
||||
dst.chargeTypeId = src.chargeStruct().chargeTypeId();
|
||||
dst.igniterTypeId = src.chargeStruct().igniterTypeId();
|
||||
dst.igniterFunctionId = src.chargeStruct().igniterFunctionId();
|
||||
dst.firePurposeId = src.firePurposeId();
|
||||
dst.chargeTypeId = src.chargeStruct.chargeTypeId;
|
||||
dst.igniterTypeId = src.chargeStruct.igniterTypeId;
|
||||
dst.igniterFunctionId = src.chargeStruct.igniterFunctionId;
|
||||
dst.firePurposeId = src.firePurposeId;
|
||||
|
||||
dst.partyId = src.partyId().is_set() ? src.partyId().get() : 0;
|
||||
dst.participantId = src.participantId().is_set() ? src.participantId().get() : -1; // -1 -> avoid trajectory
|
||||
dst.partyId = src.partyId.is_set() ? src.partyId.get() : 0;
|
||||
dst.participantId = src.participantId.is_set() ? src.participantId.get() : -1; // -1 -> avoid trajectory
|
||||
// dst.firingGeoPosition // not provided, has to be retrieved from dds
|
||||
|
||||
dst.impactCount = src.impactCount();
|
||||
dst.mhpCountRequest = src.mhpCount();
|
||||
if (src.mhpRotation().is_set())
|
||||
dst.mhpRotationRequest = src.mhpRotation().get();
|
||||
dst.impactCount = src.impactCount;
|
||||
dst.mhpCountRequest = src.mhpCount;
|
||||
if (src.mhpRotation.is_set())
|
||||
dst.mhpRotationRequest = src.mhpRotation.get();
|
||||
else
|
||||
dst.mhpRotationRequest = ObjectExplosionCluster::s_invalid_rotation_angle;
|
||||
|
||||
dst.altitude = -1;
|
||||
dst.peakHeight = src.peakHeight();
|
||||
dst.flightDuration = src.flightDuration();
|
||||
dst.peakHeight = src.peakHeight;
|
||||
dst.flightDuration = src.flightDuration;
|
||||
|
||||
// dst.originatorId = src.o();
|
||||
// dst.firePurpose = QString::fromStdString(src.purpose());
|
||||
// dst.fireRequestTime = QDateTime::fromMSecsSinceEpoch(src.fireRequestTime());
|
||||
dst.effectMarkingInTa = src.effectMarkingInTa();
|
||||
dst.externalId = src.externalId().is_set() ? src.externalId().get() : 0;
|
||||
dst.effectMarkingInTa = src.effectMarkingInTa;
|
||||
dst.externalId = src.externalId.is_set() ? src.externalId.get() : 0;
|
||||
|
||||
dst.launchVelocity = src.launchVelocity();
|
||||
dst.launchAngleDeg = src.launchAngleDeg();
|
||||
dst.dropAngle = src.dropAngle();
|
||||
dst.launchVelocity = src.launchVelocity;
|
||||
dst.launchAngleDeg = src.launchAngleDeg;
|
||||
dst.dropAngle = src.dropAngle;
|
||||
|
||||
dst.tapTimepoint = src.tapTime();
|
||||
dst.lcPrf = src.lcAttack();
|
||||
dst.lcTermination = src.lcTermination();
|
||||
dst.cloudBase = src.cloudBase();
|
||||
dst.properties = QString::fromStdString(src.properties());
|
||||
dst.esmParticipantIds = LtsUtils::IntArray(src.esmParticipantIds());
|
||||
dst.tapTimepoint = src.tapTime;
|
||||
dst.lcPrf = src.lcAttack;
|
||||
dst.lcTermination = src.lcTermination;
|
||||
dst.cloudBase = src.cloudBase;
|
||||
dst.properties = QString::fromStdString(src.properties);
|
||||
dst.esmParticipantIds = LtsUtils::IntArray(src.esmParticipantIds);
|
||||
}
|
||||
|
||||
void HandlerExplosionCluster::onExplosionClusterModifyRequest(const rti::core::SampleIdentity &cookie,
|
||||
@@ -209,8 +209,8 @@ void HandlerExplosionCluster::onExplosionClusterModifyRequest(const rti::core::S
|
||||
Core::FunctionReplyObject ret = explosionClusterModifyRequest(cookie, request);
|
||||
if (ret.error())
|
||||
WARNING_LOG(m_logger) << ret()
|
||||
<< ", effectStart :" << request.effectStart();
|
||||
ret.setAdditionalInfo(request.properties().c_str());
|
||||
<< ", effectStart :" << request.effectStart;
|
||||
ret.setAdditionalInfo(request.properties.c_str());
|
||||
m_mainHandler->dds()->fts()->explosionClusterModifyReply(cookie, ret);
|
||||
}
|
||||
|
||||
@@ -224,35 +224,35 @@ void HandlerExplosionCluster::onExplosionClusterSingleEffectOnlyModifyRequest(co
|
||||
|
||||
ExplosionClusterModifyRequest ecCommonModifyRequest;
|
||||
|
||||
ecCommonModifyRequest.id(request.id());
|
||||
ecCommonModifyRequest.externalId(request.externalId());
|
||||
ecCommonModifyRequest.id = request.id;
|
||||
ecCommonModifyRequest.externalId = request.externalId;
|
||||
|
||||
ecCommonModifyRequest.effectStart(request.effectStart());
|
||||
ecCommonModifyRequest.effectDuration(1000);
|
||||
ecCommonModifyRequest.effectStart = request.effectStart;
|
||||
ecCommonModifyRequest.effectDuration = 1000;
|
||||
|
||||
// charge and geometry:
|
||||
ecCommonModifyRequest.explosionGeometry(AreaEffectSimulation::AesExplosionGeometry_def::EgPoint);
|
||||
ecCommonModifyRequest.explosionGeometry = AreaEffectSimulation::AesExplosionGeometry::EgPoint;
|
||||
// ecCommonModifyRequest.zog(0);
|
||||
|
||||
int igniterTypeId = 102; // from pdm_igniter_type (Impact Default)
|
||||
ecCommonModifyRequest.chargeStruct().igniterTypeId(igniterTypeId);
|
||||
ecCommonModifyRequest.chargeStruct().chargeTypeId(request.chargeTypeId());
|
||||
ecCommonModifyRequest.chargeStruct.igniterTypeId = igniterTypeId;
|
||||
ecCommonModifyRequest.chargeStruct.chargeTypeId = request.chargeTypeId;
|
||||
|
||||
// height, width are <=0 -> area will be adjusted using impactRadius of charge:
|
||||
ecCommonModifyRequest.area().cornerBottomLeft(request.impactPosition());
|
||||
ecCommonModifyRequest.area().height(0);
|
||||
ecCommonModifyRequest.area().width(0);
|
||||
ecCommonModifyRequest.area.cornerBottomLeft = request.impactPosition;
|
||||
ecCommonModifyRequest.area.height = 0;
|
||||
ecCommonModifyRequest.area.width = 0;
|
||||
|
||||
|
||||
ecCommonModifyRequest.mhpCount(1);
|
||||
ecCommonModifyRequest.impactCount(1);
|
||||
ecCommonModifyRequest.mhpCount = 1;
|
||||
ecCommonModifyRequest.impactCount = 1;
|
||||
|
||||
ecCommonModifyRequest.name(request.name()); // ZpNummer
|
||||
ecCommonModifyRequest.element(request.element()); // element
|
||||
ecCommonModifyRequest.name = request.name; // ZpNummer
|
||||
ecCommonModifyRequest.element = request.element; // element
|
||||
|
||||
|
||||
ecCommonModifyRequest.partyId(request.partyId());
|
||||
ecCommonModifyRequest.participantId(-1); // -1 -> avoid trajectory
|
||||
ecCommonModifyRequest.partyId = request.partyId;
|
||||
ecCommonModifyRequest.participantId = -1; // -1 -> avoid trajectory
|
||||
|
||||
|
||||
|
||||
@@ -273,33 +273,33 @@ void HandlerExplosionCluster::onExplosionClusterOcModifyRequest(const rti::core:
|
||||
|
||||
ExplosionClusterModifyRequest ecCommonModifyRequest;
|
||||
|
||||
ecCommonModifyRequest.id(request.id());
|
||||
ecCommonModifyRequest.id = request.id;
|
||||
//ecCommonModifyRequest.externalId(request.externalId());
|
||||
|
||||
ecCommonModifyRequest.effectStart(request.effectStart());
|
||||
ecCommonModifyRequest.effectDuration(request.effectDuration());
|
||||
ecCommonModifyRequest.effectStart = request.effectStart;
|
||||
ecCommonModifyRequest.effectDuration = request.effectDuration;
|
||||
|
||||
// charge and geometry:
|
||||
ecCommonModifyRequest.area(request.area());
|
||||
ecCommonModifyRequest.area = request.area;
|
||||
|
||||
if (request.impactCount() == 1)
|
||||
ecCommonModifyRequest.explosionGeometry(AreaEffectSimulation::AesExplosionGeometry_def::EgPoint);
|
||||
if (request.impactCount == 1)
|
||||
ecCommonModifyRequest.explosionGeometry = AreaEffectSimulation::AesExplosionGeometry::EgPoint;
|
||||
else
|
||||
ecCommonModifyRequest.explosionGeometry(AreaEffectSimulation::AesExplosionGeometry_def::EgArea);
|
||||
ecCommonModifyRequest.explosionGeometry = AreaEffectSimulation::AesExplosionGeometry::EgArea;
|
||||
// ecCommonModifyRequest.zog(0);
|
||||
|
||||
ecCommonModifyRequest.mhpCount(request.mhpCount());
|
||||
ecCommonModifyRequest.impactCount(request.impactCount());
|
||||
ecCommonModifyRequest.mhpRotation(request.mhpRotation());
|
||||
ecCommonModifyRequest.mhpCount = request.mhpCount;
|
||||
ecCommonModifyRequest.impactCount = request.impactCount;
|
||||
ecCommonModifyRequest.mhpRotation = request.mhpRotation;
|
||||
|
||||
// was FtImpact
|
||||
ecCommonModifyRequest.chargeStruct().igniterTypeId(request.chargeStruct().igniterTypeId());
|
||||
ecCommonModifyRequest.chargeStruct().chargeTypeId(request.chargeStruct().chargeTypeId());
|
||||
ecCommonModifyRequest.chargeStruct.igniterTypeId = request.chargeStruct.igniterTypeId;
|
||||
ecCommonModifyRequest.chargeStruct.chargeTypeId = request.chargeStruct.chargeTypeId;
|
||||
|
||||
ecCommonModifyRequest.name(request.name()); // ZpNummer
|
||||
ecCommonModifyRequest.element(ecCommonModifyRequest.element()); // element
|
||||
ecCommonModifyRequest.name = request.name; // ZpNummer
|
||||
ecCommonModifyRequest.element = ecCommonModifyRequest.element; // element
|
||||
|
||||
ecCommonModifyRequest.partyId(request.partyId());
|
||||
ecCommonModifyRequest.partyId = request.partyId;
|
||||
// ecCommonModifyRequest.participantId(-1); // -1 -> avoid trajectory
|
||||
|
||||
// ToDo: no trajectory needed, but how can we transfer the rotation of MhpAreas?
|
||||
@@ -320,26 +320,26 @@ Core::FunctionReplyObject HandlerExplosionCluster::explosionClusterCreateRequest
|
||||
// HLA Interface is using externalId...
|
||||
// external (externalId>0) -> no partyId required
|
||||
// external (externalId==0) -> partyId required
|
||||
const int externalIdValue = request.externalId().is_set() ? request.externalId().get() : 0;
|
||||
const ProjectDataManagement::GearClass gearClass = m_mainHandler->gearClassOfChargeTypeId(request.chargeStruct().chargeTypeId());
|
||||
const int externalIdValue = request.externalId.is_set() ? request.externalId.get() : 0;
|
||||
const ProjectDataManagement::GearClass gearClass = m_mainHandler->gearClassOfChargeTypeId(request.chargeStruct.chargeTypeId);
|
||||
|
||||
const bool bDoClaimPlannedCharge = (request.id() == 0) &&
|
||||
const bool bDoClaimPlannedCharge = (request.id == 0) &&
|
||||
(externalIdValue==0) &&
|
||||
(gearClass != ProjectDataManagement::GearClass_def::AirSupport);
|
||||
(gearClass != ProjectDataManagement::GearClass::GearClass_AirSupport);
|
||||
if (bDoClaimPlannedCharge)
|
||||
{
|
||||
int chargeNeeded = request.impactCount();
|
||||
int chargeNeeded = request.impactCount;
|
||||
if (chargeNeeded <= 0)
|
||||
return Core::FunctionReplyObject(tr_lts("dds", "Invalid impact count (<= 0)."));
|
||||
|
||||
if (request.id() == 0)
|
||||
if (request.id == 0)
|
||||
{
|
||||
int chargeLeft = m_mainHandler->chargeAdministrationHandler()->availableCharge(request.chargeStruct().chargeTypeId(), request.partyId().get());
|
||||
int chargeLeft = m_mainHandler->chargeAdministrationHandler()->availableCharge(request.chargeStruct.chargeTypeId, request.partyId.get());
|
||||
|
||||
QString chargeName= QString::fromStdString(m_mainHandler->dds()->pdmDtc()->chargeType(request.chargeStruct().chargeTypeId()).name());
|
||||
QString chargeName= QString::fromStdString(m_mainHandler->dds()->pdmDtc()->chargeType(request.chargeStruct.chargeTypeId).name);
|
||||
QString fireUnitName;
|
||||
if (request.participantId().is_set())
|
||||
fireUnitName = QString::fromStdString(m_mainHandler->dds()->ppmDtc()->participant(request.participantId().get()).designator());
|
||||
if (request.participantId.is_set())
|
||||
fireUnitName = QString::fromStdString(m_mainHandler->dds()->ppmDtc()->participant(request.participantId.get()).designator);
|
||||
|
||||
if (chargeNeeded > chargeLeft)
|
||||
return Core::FunctionReplyObject(tr_lts("dds", "Invalid impact count. Fire Unit '%1' has %2 charges (%3), but for this cluster %4 are needed."))
|
||||
@@ -353,11 +353,11 @@ Core::FunctionReplyObject HandlerExplosionCluster::explosionClusterCreateRequest
|
||||
Database::AesExplosionCluster newData;
|
||||
fillData(request, newData, m_mainHandler);
|
||||
|
||||
if (!request.properties().empty() &&
|
||||
(!request.effectStart().is_set() ||
|
||||
request.effectStart().get() == 0))
|
||||
if (!request.properties.empty() &&
|
||||
(!request.effectStart.is_set() ||
|
||||
request.effectStart.get() == 0))
|
||||
{
|
||||
QJsonObject propertiesObject = QJsonDocument::fromJson(QByteArray::fromStdString(request.properties())).object();
|
||||
QJsonObject propertiesObject = QJsonDocument::fromJson(QByteArray::fromStdString(request.properties)).object();
|
||||
|
||||
newData.isUsingEffectStateReceived = propertiesObject.value(QStringLiteral("useReceived")).toBool();
|
||||
}
|
||||
@@ -368,7 +368,7 @@ Core::FunctionReplyObject HandlerExplosionCluster::explosionClusterCreateRequest
|
||||
connect(ifs, &ObjectExplosionCluster::effectStateChanged, this, &HandlerExplosionCluster::onEffectStateChanged);
|
||||
|
||||
// Context NASAT: check via chargeTypeId:
|
||||
const ProjectDataManagement::GearClass gc = m_mainHandler->dds()->pdmDtc()->gearClassFromChargeTypeId(request.chargeStruct().chargeTypeId());
|
||||
const ProjectDataManagement::GearClass gc = m_mainHandler->dds()->pdmDtc()->gearClassFromChargeTypeId(request.chargeStruct.chargeTypeId);
|
||||
const bool bChargeIsAirSupport = gc == ProjectDataManagement::GearClass::GearClass_AirSupport;
|
||||
ifs->setAirSupportSource(bChargeIsAirSupport);
|
||||
|
||||
@@ -395,7 +395,7 @@ Core::FunctionReplyObject HandlerExplosionCluster::explosionClusterCreateRequest
|
||||
return Core::FunctionReplyObject(1, tr_lts("dds", "Too many active air supports."));
|
||||
}
|
||||
}
|
||||
else if (totalAreasCentral() >= (s_maxActiveAreasCentral[AesType::AtExplosionCluster]) + (s_currentAirSupportCount) && request.effectStart().is_set())
|
||||
else if (totalAreasCentral() >= (s_maxActiveAreasCentral[static_cast<int>(AesType::AtExplosionCluster)]) + (s_currentAirSupportCount) && request.effectStart.is_set())
|
||||
{
|
||||
ifs->removeObject(); //Not finally deleted from db after this,Fallback if DB deletion is not working correct
|
||||
ifs->removeObjectFromDb();
|
||||
@@ -405,9 +405,9 @@ Core::FunctionReplyObject HandlerExplosionCluster::explosionClusterCreateRequest
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "New dec ExplosionCluster: " << totalAreas() << " Max: " << s_maxActiveAreas[AesType::AtExplosionCluster] << " Is Set: " << request.effectStart().is_set();
|
||||
DEBUG_LOG(m_logger) << "New dec ExplosionCluster: " << totalAreas() << " Max: " << s_maxActiveAreas[static_cast<int>(AesType::AtExplosionCluster)] << " Is Set: " << request.effectStart.is_set();
|
||||
|
||||
if (totalAreas() >= (s_maxActiveAreas[AesType::AtExplosionCluster]) && request.effectStart().is_set())
|
||||
if (totalAreas() >= (s_maxActiveAreas[static_cast<int>(AesType::AtExplosionCluster)]) && request.effectStart.is_set())
|
||||
{
|
||||
ifs->removeObject(); //Not finally deleted from db after this,Fallback if DB deletion is not working correct
|
||||
ifs->removeObjectFromDb();
|
||||
@@ -446,21 +446,21 @@ Core::FunctionReplyObject HandlerExplosionCluster::explosionClusterModifyRequest
|
||||
// // externalId maybe set be HLA interface:
|
||||
// // from external (externalIdValue>0) -> no partyId required
|
||||
// // from internal (externalIdValue==0) -> partyId required
|
||||
// const int externalIdValue = request.externalId().is_set() ? request.externalId().get() : 0;
|
||||
// if (externalIdValue == 0 && !request.partyId().is_set())
|
||||
// const int externalIdValue = request.externalId.is_set() ? request.externalId.get() : 0;
|
||||
// if (externalIdValue == 0 && !request.partyId.is_set())
|
||||
// return Core::FunctionReplyObject(tr_lts("dds", "Explosion areas need a party id."));
|
||||
|
||||
DEBUG_LOG(m_logger) << "request.effectStart :" << request.effectStart()
|
||||
<< ", effectDuration :" << request.effectDuration()
|
||||
<< ", flightDuration :" << request.flightDuration()
|
||||
<< ", tapTime :" << request.tapTime()
|
||||
<< ", properties: " << request.properties();
|
||||
DEBUG_LOG(m_logger) << "request.effectStart :" << request.effectStart
|
||||
<< ", effectDuration :" << request.effectDuration
|
||||
<< ", flightDuration :" << request.flightDuration
|
||||
<< ", tapTime :" << request.tapTime
|
||||
<< ", properties: " << request.properties;
|
||||
|
||||
Core::FunctionReplyObject ret;
|
||||
if (request.id() == 0 || ((request.id() < 0) && !getObjectFromMap(m_objectMap, std::abs(request.id()), ret)))
|
||||
if (request.id == 0 || ((request.id < 0) && !getObjectFromMap(m_objectMap, std::abs(request.id), ret)))
|
||||
return explosionClusterCreateRequest(request);
|
||||
|
||||
ObjectExplosionCluster *ifs = getObjectFromMap(m_objectMap, std::abs(request.id()), ret);
|
||||
ObjectExplosionCluster *ifs = getObjectFromMap(m_objectMap, std::abs(request.id), ret);
|
||||
if (!ifs)
|
||||
return ret;
|
||||
|
||||
@@ -470,12 +470,12 @@ Core::FunctionReplyObject HandlerExplosionCluster::explosionClusterModifyRequest
|
||||
fillData(request, aea, m_mainHandler);
|
||||
|
||||
// Context NASAT: check via chargeTypeId:
|
||||
const ProjectDataManagement::GearClass gc = m_mainHandler->dds()->pdmDtc()->gearClassFromChargeTypeId(request.chargeStruct().chargeTypeId());
|
||||
const ProjectDataManagement::GearClass gc = m_mainHandler->dds()->pdmDtc()->gearClassFromChargeTypeId(request.chargeStruct.chargeTypeId);
|
||||
const bool bChargeIsAirSupport = (gc == ProjectDataManagement::GearClass::GearClass_AirSupport);
|
||||
ifs->setAirSupportSource(bChargeIsAirSupport);
|
||||
|
||||
// For counting, only Elements being at least prepared are important:
|
||||
if (request.effectStart().is_set() && ifs->isObjectModifiable()) // ToDo: check
|
||||
if (request.effectStart.is_set() && ifs->isObjectModifiable()) // ToDo: check
|
||||
{
|
||||
// Calculate new polygon here. Not nice, though
|
||||
auto poly = Polygons::explosionClusterArea(aea);
|
||||
@@ -502,7 +502,7 @@ Core::FunctionReplyObject HandlerExplosionCluster::explosionClusterModifyRequest
|
||||
{
|
||||
// case 1: war zentral && effectStart war nicht gesetzt
|
||||
// case 2: war dezentral && effectStart ist gesetzt.
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[AesType::AtExplosionCluster] + (s_currentAirSupportCount)) && request.effectStart().is_set()
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[static_cast<int>(AesType::AtExplosionCluster)] + (s_currentAirSupportCount)) && request.effectStart.is_set()
|
||||
&& ((wasCentral && !ifs->isActivationTimeSet()) || !wasCentral))
|
||||
{
|
||||
return Core::FunctionReplyObject(1, tr_lts("dds", "Too many active central explosion clusters."));
|
||||
@@ -513,7 +513,7 @@ Core::FunctionReplyObject HandlerExplosionCluster::explosionClusterModifyRequest
|
||||
{
|
||||
// case 1: war dezentral && effectStart war nicht gesetzt
|
||||
// case 2: war zentral && effectStart ist gesetzt.
|
||||
if (totalAreas() >= (s_maxActiveAreas[AesType::AtExplosionCluster]) && request.effectStart().is_set()
|
||||
if (totalAreas() >= (s_maxActiveAreas[static_cast<int>(AesType::AtExplosionCluster)]) && request.effectStart.is_set()
|
||||
&& (( !wasCentral && !ifs->isActivationTimeSet()) || wasCentral))
|
||||
{
|
||||
return Core::FunctionReplyObject(1, tr_lts("dds", "Too many active explosion clusters."));
|
||||
@@ -522,7 +522,7 @@ Core::FunctionReplyObject HandlerExplosionCluster::explosionClusterModifyRequest
|
||||
|
||||
|
||||
// For counting, only Elements being at least prepared are important:
|
||||
if (request.effectStart().is_set() && ifs->isObjectModifiable())
|
||||
if (request.effectStart.is_set() && ifs->isObjectModifiable())
|
||||
{
|
||||
|
||||
DEBUG_LOG(m_logger) << "isCentral: " << isCentral;
|
||||
@@ -534,8 +534,8 @@ Core::FunctionReplyObject HandlerExplosionCluster::explosionClusterModifyRequest
|
||||
// Change from central to training area
|
||||
if (wasCentral)
|
||||
{
|
||||
if (totalAreas() >= (s_maxActiveAreas[AesType::AtExplosionCluster]))
|
||||
return Core::FunctionReplyObject(request.id(), tr_lts("dds", "Too many active explosion clusters."));
|
||||
if (totalAreas() >= (s_maxActiveAreas[static_cast<int>(AesType::AtExplosionCluster)]))
|
||||
return Core::FunctionReplyObject(request.id, tr_lts("dds", "Too many active explosion clusters."));
|
||||
|
||||
m_areaCount++;
|
||||
m_areaCountCentral--;
|
||||
@@ -544,8 +544,8 @@ Core::FunctionReplyObject HandlerExplosionCluster::explosionClusterModifyRequest
|
||||
}
|
||||
else // Change from training area to central
|
||||
{
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[AesType::AtExplosionCluster]))
|
||||
return Core::FunctionReplyObject(request.id(), tr_lts("dds", "Too many active central explosion clusters."));
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[static_cast<int>(AesType::AtExplosionCluster)]))
|
||||
return Core::FunctionReplyObject(request.id, tr_lts("dds", "Too many active central explosion clusters."));
|
||||
m_areaCount--;
|
||||
m_areaCountCentral++;
|
||||
DEBUG_LOG(m_logger) << "s_areaCount[AesType::AtExplosionCluster] = " << m_areaCount;
|
||||
@@ -556,13 +556,13 @@ Core::FunctionReplyObject HandlerExplosionCluster::explosionClusterModifyRequest
|
||||
}
|
||||
|
||||
|
||||
if (request.id() < 0 && checkStateForSfm(ifs))
|
||||
if (request.id < 0 && checkStateForSfm(ifs))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Overwrite Effect State for OC";
|
||||
aea.effectStateId = AesEffectState::EsPrepared;
|
||||
}
|
||||
|
||||
DEBUG_LOG(m_logger) << "request.properties()" << request.properties()
|
||||
DEBUG_LOG(m_logger) << "request.properties()" << request.properties
|
||||
<< " aea.properties=" << aea.properties;
|
||||
return ifs->updateObject(aea);
|
||||
}
|
||||
@@ -579,7 +579,7 @@ Core::FunctionReplyObject HandlerExplosionCluster::explosionClusterModifyGeometr
|
||||
|
||||
// Anzahl aktiver Areas ist erreicht, der Wirkbeginn ist (soll) gesetzt sein, aber die Area war
|
||||
// vorher noch ohne Wirkbeginn
|
||||
if (totalAreas() >= (s_maxActiveAreas[AesType::AtExplosionArea] + s_maxActiveAreas[AesType::AtExplosionSingle]) && request.effectStart().is_set() && !ifs->isObjectModifiable())
|
||||
if (totalAreas() >= (s_maxActiveAreas[AesType::AtExplosionArea] + s_maxActiveAreas[AesType::AtExplosionSingle]) && request.effectStart.is_set() && !ifs->isObjectModifiable())
|
||||
return Core::FunctionReplyObject(request.id(), tr_lts("dds", "Too many active explosion areas."));
|
||||
|
||||
// Todo: IsObjectModifiable() ?!?
|
||||
@@ -638,7 +638,7 @@ void HandlerExplosionCluster::onExplosionClusterPauseResumeRequest(const rti::co
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onExplosionClusterPauseResumeRequest" << request;
|
||||
Core::FunctionReplyObject ret;
|
||||
ObjectExplosionCluster *ifs = getObjectFromMap(m_objectMap, request.id(), ret);
|
||||
ObjectExplosionCluster *ifs = getObjectFromMap(m_objectMap, request.id, ret);
|
||||
if (!ifs)
|
||||
{
|
||||
m_mainHandler->dds()->fts()->explosionClusterPauseResumeReply(cookie, ret);
|
||||
@@ -655,8 +655,8 @@ void HandlerExplosionCluster::onExplosionClusterPauseResumeRequest(const rti::co
|
||||
void HandlerExplosionCluster::onExplosionClusterReleaseReceivedRequest(const rti::core::SampleIdentity &cookie, const ExplosionClusterReleaseReceivedRequest &request)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onExplosionClusterReleaseReceivedRequest" << request;
|
||||
Core::FunctionReplyObject ret(request.id());
|
||||
ObjectExplosionCluster *ifs = getObjectFromMap(m_objectMap, request.id(), ret);
|
||||
Core::FunctionReplyObject ret(request.id);
|
||||
ObjectExplosionCluster *ifs = getObjectFromMap(m_objectMap, request.id, ret);
|
||||
if (!ifs)
|
||||
{
|
||||
ERROR_LOG(m_logger) << ret();
|
||||
@@ -666,7 +666,7 @@ void HandlerExplosionCluster::onExplosionClusterReleaseReceivedRequest(const rti
|
||||
|
||||
if (!ifs->isUsingEffectStateReceived())
|
||||
{
|
||||
ret = ret.setStr(tr_lts("dds", "ExplosionCluster with id %1 is not using EffectState Received")).arg(request.id());
|
||||
ret = ret.setStr(tr_lts("dds", "ExplosionCluster with id %1 is not using EffectState Received")).arg(request.id);
|
||||
ERROR_LOG(m_logger) << ret();
|
||||
m_mainHandler->dds()->fts()->explosionClusterReleaseReceivedReply(cookie, ret);
|
||||
return;
|
||||
@@ -684,7 +684,7 @@ void HandlerExplosionCluster::onTargetPositionsModifyRequest(const rti::core::Sa
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onTargetPositionsModifyRequest" << request;
|
||||
Core::FunctionReplyObject ret;
|
||||
ObjectExplosionCluster *ifs = getObjectFromMap(m_objectMap, request.aesItemId(), ret);
|
||||
ObjectExplosionCluster *ifs = getObjectFromMap(m_objectMap, request.aesItemId, ret);
|
||||
if (!ifs)
|
||||
{
|
||||
m_mainHandler->dds()->fts()->targetPositionsModifyReply(cookie, ret);
|
||||
|
||||
+38
-38
@@ -15,7 +15,7 @@ namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
HandlerExplosionSingle::HandlerExplosionSingle(MainHandler *mainHandler)
|
||||
: HandlerBaseTmpl<ObjectExplosionSingle>(mainHandler, QStringLiteral("ExplosionSingle"), s_areaCount[AesType::AtExplosionSingle], s_areaCountCentral[AesType::AtExplosionSingle])
|
||||
: HandlerBaseTmpl<ObjectExplosionSingle>(mainHandler, QStringLiteral("ExplosionSingle"), s_areaCount[static_cast<int>(AesType::AtExplosionSingle)], s_areaCountCentral[static_cast<int>(AesType::AtExplosionSingle)])
|
||||
, Interface::Fts::ExplosionSingleModifyRequestHandler(mainHandler->dds()->fts())
|
||||
, Interface::Fts::ExplosionSingleRemoveRequestHandler(mainHandler->dds()->fts())
|
||||
{}
|
||||
@@ -43,7 +43,7 @@ bool HandlerExplosionSingle::init()
|
||||
}
|
||||
if(!ifs->data().isCentral)
|
||||
{
|
||||
if (totalAreas() >= (s_maxActiveAreas[AesType::AtExplosionArea] + s_maxActiveAreas[AesType::AtExplosionSingle]))
|
||||
if (totalAreas() >= (s_maxActiveAreas[static_cast<int>(AesType::AtExplosionArea)] + s_maxActiveAreas[static_cast<int>(AesType::AtExplosionSingle)]))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "More active explosion single in database than allowed - ignoring the rest!";
|
||||
ifs->removeObject();
|
||||
@@ -54,7 +54,7 @@ bool HandlerExplosionSingle::init()
|
||||
else
|
||||
{
|
||||
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[AesType::AtExplosionArea] + s_maxActiveAreasCentral[AesType::AtExplosionSingle]))
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[static_cast<int>(AesType::AtExplosionArea)] + s_maxActiveAreasCentral[static_cast<int>(AesType::AtExplosionSingle)]))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "More active explosion single in database than allowed - ignoring the rest!";
|
||||
ifs->removeObject();
|
||||
@@ -80,38 +80,38 @@ bool HandlerExplosionSingle::init()
|
||||
|
||||
int HandlerExplosionSingle::totalAreas() const
|
||||
{
|
||||
return s_areaCount[AesType::AtExplosionArea] + s_areaCount[AesType::AtExplosionSingle];
|
||||
return s_areaCount[static_cast<int>(AesType::AtExplosionArea)] + s_areaCount[static_cast<int>(AesType::AtExplosionSingle)];
|
||||
}
|
||||
|
||||
int HandlerExplosionSingle::totalAreasCentral() const
|
||||
{
|
||||
return s_areaCountCentral[AesType::AtExplosionArea] + s_areaCountCentral[AesType::AtExplosionSingle];
|
||||
return s_areaCountCentral[static_cast<int>(AesType::AtExplosionArea)] + s_areaCountCentral[static_cast<int>(AesType::AtExplosionSingle)];
|
||||
}
|
||||
|
||||
static void fillGeometryData(const ExplosionSingleModifyRequest &src, Database::AesExplosionSingle &dst)
|
||||
{
|
||||
dst.impactPosition.rx() = src.impactPosition().lon();
|
||||
dst.impactPosition.ry() = src.impactPosition().lat();
|
||||
dst.impactPosition.rx() = src.impactPosition.lon;
|
||||
dst.impactPosition.ry() = src.impactPosition.lat;
|
||||
}
|
||||
|
||||
static void fillData(const ExplosionSingleModifyRequest &src, Database::AesExplosionSingle &dst)
|
||||
{
|
||||
if (src.id() < 0) // is the id given as negative? set id -> used by OC-Laptop
|
||||
dst.id = src.id();
|
||||
if (src.id < 0) // is the id given as negative? set id -> used by OC-Laptop
|
||||
dst.id = src.id;
|
||||
|
||||
fillGeometryData(src, dst);
|
||||
dst.name = QString::fromStdString(src.name());
|
||||
dst.effectStart = src.effectStart().is_set() && src.effectStart().get() > 0 ? QDateTime::fromMSecsSinceEpoch(src.effectStart().get()) : QDateTime();
|
||||
dst.name = QString::fromStdString(src.name);
|
||||
dst.effectStart = src.effectStart.is_set() && src.effectStart.get() > 0 ? QDateTime::fromMSecsSinceEpoch(src.effectStart.get()) : QDateTime();
|
||||
dst.effectDuration = 1000; // 1sec
|
||||
dst.effectSourceId = src.effectSourceId();
|
||||
dst.partyId = src.partyId().is_set() ? src.partyId().get() : 0;
|
||||
dst.chargeTypeId = src.chargeTypeId();
|
||||
dst.participantId = src.participantId().is_set() ? src.participantId().get() : 0;
|
||||
dst.altitude = src.altitude();
|
||||
dst.firePurpose = QString::fromStdString(src.purpose());
|
||||
dst.fireRequestTime = QDateTime::fromMSecsSinceEpoch(src.fireRequestTime());
|
||||
dst.effectMarkingInTa = src.effectMarkingInTa();
|
||||
dst.externalId = src.externalId().is_set() ? src.externalId().get() : 0;
|
||||
dst.effectSourceId = src.effectSourceId;
|
||||
dst.partyId = src.partyId.is_set() ? src.partyId.get() : 0;
|
||||
dst.chargeTypeId = src.chargeTypeId;
|
||||
dst.participantId = src.participantId.is_set() ? src.participantId.get() : 0;
|
||||
dst.altitude = src.altitude;
|
||||
dst.firePurpose = QString::fromStdString(src.purpose);
|
||||
dst.fireRequestTime = QDateTime::fromMSecsSinceEpoch(src.fireRequestTime);
|
||||
dst.effectMarkingInTa = src.effectMarkingInTa;
|
||||
dst.externalId = src.externalId.is_set() ? src.externalId.get() : 0;
|
||||
}
|
||||
|
||||
void HandlerExplosionSingle::onExplosionSingleModifyRequest(const rti::core::SampleIdentity &cookie,
|
||||
@@ -144,7 +144,7 @@ Core::FunctionReplyObject HandlerExplosionSingle::explosionSingleCreateRequest(c
|
||||
|
||||
if (ifs->data().isCentral)
|
||||
{
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[AesType::AtExplosionArea] + s_maxActiveAreasCentral[AesType::AtExplosionSingle]) && request.effectStart().is_set())
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[static_cast<int>(AesType::AtExplosionArea)] + s_maxActiveAreasCentral[static_cast<int>(AesType::AtExplosionSingle)]) && request.effectStart.is_set())
|
||||
{
|
||||
ifs->removeObject(); //Not finally deleted from db after this,Fallback if DB deletion is not working correct
|
||||
ifs->removeObjectFromDb();
|
||||
@@ -154,7 +154,7 @@ Core::FunctionReplyObject HandlerExplosionSingle::explosionSingleCreateRequest(c
|
||||
}
|
||||
else
|
||||
{
|
||||
if (totalAreas() >= (s_maxActiveAreas[AesType::AtExplosionArea] + s_maxActiveAreas[AesType::AtExplosionSingle]) && request.effectStart().is_set())
|
||||
if (totalAreas() >= (s_maxActiveAreas[static_cast<int>(AesType::AtExplosionArea)] + s_maxActiveAreas[static_cast<int>(AesType::AtExplosionSingle)]) && request.effectStart.is_set())
|
||||
{
|
||||
ifs->removeObject(); //Not finally deleted from db after this,Fallback if DB deletion is not working correct
|
||||
ifs->removeObjectFromDb();
|
||||
@@ -182,16 +182,16 @@ Core::FunctionReplyObject HandlerExplosionSingle::explosionSingleCreateRequest(c
|
||||
Core::FunctionReplyObject HandlerExplosionSingle::explosionSingleModifyRequest(const ExplosionSingleModifyRequest &request)
|
||||
{
|
||||
Core::FunctionReplyObject ret;
|
||||
if (request.id() == 0 || ((request.id() < 0) && !getObjectFromMap(m_objectMap, std::abs(request.id()), ret)))
|
||||
if (request.id == 0 || ((request.id < 0) && !getObjectFromMap(m_objectMap, std::abs(request.id), ret)))
|
||||
return explosionSingleCreateRequest(request);
|
||||
|
||||
ObjectExplosionSingle *ifs = getObjectFromMap(m_objectMap, std::abs(request.id()), ret);
|
||||
ObjectExplosionSingle *ifs = getObjectFromMap(m_objectMap, std::abs(request.id), ret);
|
||||
if (!ifs)
|
||||
return ret;
|
||||
|
||||
// Anzahl aktiver Areas ist erreicht, der Wirkbeginn ist (soll) gesetzt sein, aber die Area war
|
||||
// vorher noch ohne Wirkbeginn
|
||||
// if (totalAreas() >= (s_maxActiveAreas[AesType::AtExplosionArea] + s_maxActiveAreas[AesType::AtExplosionSingle]) && request.effectStart().is_set())
|
||||
// if (totalAreas() >= (s_maxActiveAreas[AesType::AtExplosionArea] + s_maxActiveAreas[AesType::AtExplosionSingle]) && request.effectStart.is_set())
|
||||
// return Core::FunctionReplyObject(request.id(), tr_lts("dds", "Too many active single explosions."));
|
||||
|
||||
Database::AesExplosionSingle aes(ifs->data());
|
||||
@@ -206,25 +206,25 @@ Core::FunctionReplyObject HandlerExplosionSingle::explosionSingleModifyRequest(c
|
||||
bool wasCentral = ifs->data().isCentral;
|
||||
|
||||
|
||||
if(!ifs->isActivationTimeSet() && request.effectStart().is_set())
|
||||
if(!ifs->isActivationTimeSet() && request.effectStart.is_set())
|
||||
{
|
||||
if (isCentral)
|
||||
{
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[AesType::AtExplosionArea] + s_maxActiveAreasCentral[AesType::AtExplosionSingle]))
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[static_cast<int>(AesType::AtExplosionArea)] + s_maxActiveAreasCentral[static_cast<int>(AesType::AtExplosionSingle)]))
|
||||
{
|
||||
return Core::FunctionReplyObject(1, tr_lts("dds", "Too many active central explosion singles and explosion areas."));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (totalAreas() >= (s_maxActiveAreas[AesType::AtExplosionArea] + s_maxActiveAreas[AesType::AtExplosionSingle]) )
|
||||
if (totalAreas() >= (s_maxActiveAreas[static_cast<int>(AesType::AtExplosionArea)] + s_maxActiveAreas[static_cast<int>(AesType::AtExplosionSingle)]) )
|
||||
{
|
||||
return Core::FunctionReplyObject(1, tr_lts("dds", "Too many active explosion singles and explosion areas."));
|
||||
}
|
||||
}
|
||||
}
|
||||
// For counting, only Elements being at least prepared are important:
|
||||
if (request.effectStart().is_set() && ifs->isObjectModifiable())
|
||||
if (request.effectStart.is_set() && ifs->isObjectModifiable())
|
||||
{
|
||||
|
||||
DEBUG_LOG(m_logger) << "isCentral: " << isCentral;
|
||||
@@ -236,8 +236,8 @@ Core::FunctionReplyObject HandlerExplosionSingle::explosionSingleModifyRequest(c
|
||||
// Change from central to training area
|
||||
if (wasCentral)
|
||||
{
|
||||
if (totalAreas() >= (s_maxActiveAreas[AesType::AtExplosionArea] + s_maxActiveAreas[AesType::AtExplosionSingle]))
|
||||
return Core::FunctionReplyObject(request.id(), tr_lts("dds", "Too many active explosion singles and explosion areas."));
|
||||
if (totalAreas() >= (s_maxActiveAreas[static_cast<int>(AesType::AtExplosionArea)] + s_maxActiveAreas[static_cast<int>(AesType::AtExplosionSingle)]))
|
||||
return Core::FunctionReplyObject(request.id, tr_lts("dds", "Too many active explosion singles and explosion areas."));
|
||||
|
||||
m_areaCount++;
|
||||
m_areaCountCentral--;
|
||||
@@ -246,8 +246,8 @@ Core::FunctionReplyObject HandlerExplosionSingle::explosionSingleModifyRequest(c
|
||||
}
|
||||
else // Change from training area to central
|
||||
{
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[AesType::AtExplosionArea] + s_maxActiveAreasCentral[AesType::AtExplosionSingle]))
|
||||
return Core::FunctionReplyObject(request.id(), tr_lts("dds", "Too many active central explosion singles and explosion areas"));
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[static_cast<int>(AesType::AtExplosionArea)] + s_maxActiveAreasCentral[static_cast<int>(AesType::AtExplosionSingle)]))
|
||||
return Core::FunctionReplyObject(request.id, tr_lts("dds", "Too many active central explosion singles and explosion areas"));
|
||||
m_areaCount--;
|
||||
m_areaCountCentral++;
|
||||
DEBUG_LOG(m_logger) << "s_areaCount[AesType::AtExplosionSingle] = " << m_areaCount;
|
||||
@@ -258,7 +258,7 @@ Core::FunctionReplyObject HandlerExplosionSingle::explosionSingleModifyRequest(c
|
||||
|
||||
|
||||
|
||||
if (request.id() < 0 && checkStateForSfm(ifs))
|
||||
if (request.id < 0 && checkStateForSfm(ifs))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Overwrite single explostion Effect State for OC";
|
||||
aes.effectStateId = AesEffectState::EsPrepared;
|
||||
@@ -270,17 +270,17 @@ Core::FunctionReplyObject HandlerExplosionSingle::explosionSingleModifyRequest(c
|
||||
Core::FunctionReplyObject HandlerExplosionSingle::explosionSingleModifyGeometryRequest(const ExplosionSingleModifyRequest &request)
|
||||
{
|
||||
Core::FunctionReplyObject ret;
|
||||
ObjectExplosionSingle *ifs = getObjectFromMap(m_objectMap, request.id(), ret);
|
||||
ObjectExplosionSingle *ifs = getObjectFromMap(m_objectMap, request.id, ret);
|
||||
if (!ifs)
|
||||
return ret;
|
||||
|
||||
// Anzahl aktiver Areas ist erreicht, der Wirkbeginn ist (soll) gesetzt sein, aber die Area war
|
||||
// vorher noch ohne Wirkbeginn
|
||||
if (totalAreas() >= (s_maxActiveAreas[AesType::AtExplosionArea] + s_maxActiveAreas[AesType::AtExplosionSingle])
|
||||
&& request.effectStart().is_set()
|
||||
if (totalAreas() >= (s_maxActiveAreas[static_cast<int>(AesType::AtExplosionArea)] + s_maxActiveAreas[static_cast<int>(AesType::AtExplosionSingle)])
|
||||
&& request.effectStart.is_set()
|
||||
&& !ifs->isActivationTimeSet()
|
||||
&& !ifs->isObjectModifiable())
|
||||
return Core::FunctionReplyObject(request.id(), tr_lts("dds", "Too many active single explosions."));
|
||||
return Core::FunctionReplyObject(request.id, tr_lts("dds", "Too many active single explosions."));
|
||||
|
||||
Database::AesExplosionSingle aes(ifs->data());
|
||||
fillGeometryData(request, aes);
|
||||
|
||||
+43
-43
@@ -15,7 +15,7 @@ namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
HandlerFunctionalArea::HandlerFunctionalArea(MainHandler *mainHandler)
|
||||
: HandlerBaseTmpl<ObjectFunctionalArea>(mainHandler, QStringLiteral("FunctionalArea"), s_areaCount[AesType::AtFunctionalArea], s_areaCountCentral[AesType::AtFunctionalArea])
|
||||
: HandlerBaseTmpl<ObjectFunctionalArea>(mainHandler, QStringLiteral("FunctionalArea"), s_areaCount[static_cast<int>(AesType::AtFunctionalArea)], s_areaCountCentral[static_cast<int>(AesType::AtFunctionalArea)])
|
||||
, Interface::Fts::FunctionalAreaModifyRequestHandler(mainHandler->dds()->fts())
|
||||
, Interface::Fts::FunctionalAreaRemoveRequestHandler(mainHandler->dds()->fts())
|
||||
{
|
||||
@@ -87,7 +87,7 @@ bool HandlerFunctionalArea::init()
|
||||
}
|
||||
if (!ifs->data().isCentral)
|
||||
{
|
||||
if (totalAreas() >= s_maxActiveAreas[AesType::AtFunctionalArea])
|
||||
if (totalAreas() >= s_maxActiveAreas[static_cast<int>(AesType::AtFunctionalArea)])
|
||||
{
|
||||
ERROR_LOG(m_logger) << "More active functional areas in database than allowed - ignoring the rest!";
|
||||
ifs->removeObject();
|
||||
@@ -97,7 +97,7 @@ bool HandlerFunctionalArea::init()
|
||||
}
|
||||
else
|
||||
{
|
||||
if (totalAreasCentral() >= s_maxActiveAreasCentral[AesType::AtFunctionalArea])
|
||||
if (totalAreasCentral() >= s_maxActiveAreasCentral[static_cast<int>(AesType::AtFunctionalArea)])
|
||||
{
|
||||
ERROR_LOG(m_logger) << "More active functional areas in database than allowed - ignoring the rest!";
|
||||
ifs->removeObject();
|
||||
@@ -148,40 +148,40 @@ QVector<Database::AesFunctionalAreaType> HandlerFunctionalArea::loadDefaultFunct
|
||||
|
||||
int HandlerFunctionalArea::totalAreas() const
|
||||
{
|
||||
return s_areaCount[AesType::AtFunctionalArea];
|
||||
return s_areaCount[static_cast<int>(AesType::AtFunctionalArea)];
|
||||
}
|
||||
|
||||
int HandlerFunctionalArea::totalAreasCentral() const
|
||||
{
|
||||
return s_areaCountCentral[AesType::AtFunctionalArea];
|
||||
return s_areaCountCentral[static_cast<int>(AesType::AtFunctionalArea)];
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static void fillData(const T &src, Database::AesFunctionalArea &dst)
|
||||
{
|
||||
if (src.id() < 0) // is the id given as negative? set id -> used by OC-Laptop
|
||||
dst.id = src.id();
|
||||
if (src.id < 0) // is the id given as negative? set id -> used by OC-Laptop
|
||||
dst.id = src.id;
|
||||
|
||||
dst.name = QString::fromStdString(src.name());
|
||||
dst.effectStart = src.effectStart().is_set() && src.effectStart().get() > 0 ? QDateTime::fromMSecsSinceEpoch(src.effectStart().get()) : QDateTime();
|
||||
dst.effectDuration = src.effectDuration();
|
||||
dst.position.rx() = src.area().cornerBottomLeft().lon();
|
||||
dst.position.ry() = src.area().cornerBottomLeft().lat();
|
||||
dst.length = src.area().height();
|
||||
dst.width = src.area().width();
|
||||
dst.partyId = src.partyId().is_set() ? src.partyId().get() : 0;
|
||||
dst.chargeTypeId = src.chargeTypeId();
|
||||
dst.participantId = src.participantId().is_set() ? src.participantId().get() : 0;
|
||||
dst.pointSymbol = src.pointSymbol().is_set() ? QString::fromStdString(src.pointSymbol().get()) : QString();
|
||||
dst.functionalAreaTypeId = src.functionalAreaTypeId();
|
||||
dst.deconMode = src.deconMode();
|
||||
dst.deconTime = src.deconTime();
|
||||
dst.maintMode = src.maintMode();
|
||||
dst.maintTime = src.maintTime();
|
||||
dst.medicMode = src.medicMode();
|
||||
dst.medicTime = src.medicTime();
|
||||
dst.supplyMode = src.supplyMode();
|
||||
dst.supplyTime = src.supplyTime();
|
||||
dst.name = QString::fromStdString(src.name);
|
||||
dst.effectStart = src.effectStart.is_set() && src.effectStart.get() > 0 ? QDateTime::fromMSecsSinceEpoch(src.effectStart.get()) : QDateTime();
|
||||
dst.effectDuration = src.effectDuration;
|
||||
dst.position.rx() = src.area.cornerBottomLeft.lon;
|
||||
dst.position.ry() = src.area.cornerBottomLeft.lat;
|
||||
dst.length = src.area.height;
|
||||
dst.width = src.area.width;
|
||||
dst.partyId = src.partyId.is_set() ? src.partyId.get() : 0;
|
||||
dst.chargeTypeId = src.chargeTypeId;
|
||||
dst.participantId = src.participantId.is_set() ? src.participantId.get() : 0;
|
||||
dst.pointSymbol = src.pointSymbol.is_set() ? QString::fromStdString(src.pointSymbol.get()) : QString();
|
||||
dst.functionalAreaTypeId = src.functionalAreaTypeId;
|
||||
dst.deconMode = src.deconMode;
|
||||
dst.deconTime = src.deconTime;
|
||||
dst.maintMode = src.maintMode;
|
||||
dst.maintTime = src.maintTime;
|
||||
dst.medicMode = src.medicMode;
|
||||
dst.medicTime = src.medicTime;
|
||||
dst.supplyMode = src.supplyMode;
|
||||
dst.supplyTime = src.supplyTime;
|
||||
}
|
||||
|
||||
void HandlerFunctionalArea::onFunctionalAreaModifyRequest(const rti::core::SampleIdentity &cookie,
|
||||
@@ -196,9 +196,9 @@ void HandlerFunctionalArea::onFunctionalAreaModifyRequest(const rti::core::Sampl
|
||||
|
||||
Core::FunctionReplyObject HandlerFunctionalArea::functionalAreaCreateRequest(const FunctionalAreaModifyRequest &request)
|
||||
{
|
||||
if (!request.partyId().is_set() && (request.supplyMode() != AesOperatingMode_def::OmWaitingTime))
|
||||
if (!request.partyId.is_set() && (request.supplyMode != AesOperatingMode::OmWaitingTime))
|
||||
return Core::FunctionReplyObject(tr_lts("dds", "Functional areas need a party id."));
|
||||
if ((!request.participantId().is_set()) && (request.supplyMode() == AesOperatingMode_def::OmWaitingTime))
|
||||
if ((!request.participantId.is_set()) && (request.supplyMode == AesOperatingMode::OmWaitingTime))
|
||||
return Core::FunctionReplyObject(tr_lts("dds", "Functional areas Supply need a participant id."));
|
||||
|
||||
|
||||
@@ -220,7 +220,7 @@ Core::FunctionReplyObject HandlerFunctionalArea::functionalAreaCreateRequest(con
|
||||
if (ifs->data().isCentral)
|
||||
{
|
||||
|
||||
if (totalAreasCentral() >= s_maxActiveAreasCentral[AesType::AtFunctionalArea] && request.effectStart().is_set())
|
||||
if (totalAreasCentral() >= s_maxActiveAreasCentral[static_cast<int>(AesType::AtFunctionalArea)] && request.effectStart.is_set())
|
||||
{
|
||||
|
||||
ifs->removeObject(); //Not finally deleted from db after this,Fallback if DB deletion is not working correct
|
||||
@@ -231,7 +231,7 @@ Core::FunctionReplyObject HandlerFunctionalArea::functionalAreaCreateRequest(con
|
||||
}
|
||||
else
|
||||
{
|
||||
if (totalAreas() >= s_maxActiveAreas[AesType::AtFunctionalArea] && request.effectStart().is_set())
|
||||
if (totalAreas() >= s_maxActiveAreas[static_cast<int>(AesType::AtFunctionalArea)] && request.effectStart.is_set())
|
||||
{
|
||||
ifs->removeObject(); //Not finally deleted from db after this,Fallback if DB deletion is not working correct
|
||||
ifs->removeObjectFromDb();
|
||||
@@ -258,16 +258,16 @@ Core::FunctionReplyObject HandlerFunctionalArea::functionalAreaCreateRequest(con
|
||||
Core::FunctionReplyObject HandlerFunctionalArea::functionalAreaModifyRequest(const FunctionalAreaModifyRequest &request)
|
||||
{
|
||||
Core::FunctionReplyObject ret;
|
||||
if (request.id() == 0 || ((request.id() < 0) && !getObjectFromMap(m_objectMap, std::abs(request.id()), ret)))
|
||||
if (request.id == 0 || ((request.id < 0) && !getObjectFromMap(m_objectMap, std::abs(request.id), ret)))
|
||||
return functionalAreaCreateRequest(request);
|
||||
|
||||
ObjectFunctionalArea *ifs = getObjectFromMap(m_objectMap, std::abs(request.id()), ret);
|
||||
ObjectFunctionalArea *ifs = getObjectFromMap(m_objectMap, std::abs(request.id), ret);
|
||||
if (!ifs)
|
||||
return ret;
|
||||
|
||||
// Anzahl aktiver Areas ist erreicht, der Wirkbeginn ist (soll) gesetzt sein, aber die Area war
|
||||
// vorher noch ohne Wirkbeginn
|
||||
// if (totalAreas() >= s_maxActiveAreas[AesType::AtFunctionalArea] && request.effectStart().is_set() && !ifs->isObjectModifiable())
|
||||
// if (totalAreas() >= s_maxActiveAreas[AesType::AtFunctionalArea] && request.effectStart.is_set() && !ifs->isObjectModifiable())
|
||||
// return Core::FunctionReplyObject(request.id(), tr_lts("dds", "Too many active functional areas."));
|
||||
|
||||
// Todo: IsObjectModifiable() ?!?
|
||||
@@ -286,19 +286,19 @@ Core::FunctionReplyObject HandlerFunctionalArea::functionalAreaModifyRequest(con
|
||||
/*!
|
||||
* If the effect start added after creation, the max amount need to be checked
|
||||
!*/
|
||||
if(!ifs->isActivationTimeSet() && request.effectStart().is_set())
|
||||
if(!ifs->isActivationTimeSet() && request.effectStart.is_set())
|
||||
{
|
||||
if (isCentral)
|
||||
{
|
||||
|
||||
if (totalAreasCentral() >= s_maxActiveAreasCentral[AesType::AtFunctionalArea])
|
||||
if (totalAreasCentral() >= s_maxActiveAreasCentral[static_cast<int>(AesType::AtFunctionalArea)])
|
||||
{
|
||||
return Core::FunctionReplyObject(1, tr_lts("dds", "Too many active central functional areas."));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (totalAreas() >= s_maxActiveAreas[AesType::AtFunctionalArea])
|
||||
if (totalAreas() >= s_maxActiveAreas[static_cast<int>(AesType::AtFunctionalArea)])
|
||||
{
|
||||
return Core::FunctionReplyObject(1, tr_lts("dds", "Too many active functional areas."));
|
||||
}
|
||||
@@ -306,7 +306,7 @@ Core::FunctionReplyObject HandlerFunctionalArea::functionalAreaModifyRequest(con
|
||||
}
|
||||
|
||||
// For counting, only Elements being at least prepared are important:
|
||||
if (request.effectStart().is_set() && ifs->isObjectModifiable())
|
||||
if (request.effectStart.is_set() && ifs->isObjectModifiable())
|
||||
{
|
||||
|
||||
|
||||
@@ -326,8 +326,8 @@ Core::FunctionReplyObject HandlerFunctionalArea::functionalAreaModifyRequest(con
|
||||
// Change from central to training area
|
||||
if (wasCentral)
|
||||
{
|
||||
if (totalAreas() >= s_maxActiveAreas[AesType::AtFunctionalArea])
|
||||
return Core::FunctionReplyObject(request.id(), tr_lts("dds", "Too many active functional areas."));
|
||||
if (totalAreas() >= s_maxActiveAreas[static_cast<int>(AesType::AtFunctionalArea)])
|
||||
return Core::FunctionReplyObject(request.id, tr_lts("dds", "Too many active functional areas."));
|
||||
|
||||
m_areaCount++;
|
||||
m_areaCountCentral--;
|
||||
@@ -336,8 +336,8 @@ Core::FunctionReplyObject HandlerFunctionalArea::functionalAreaModifyRequest(con
|
||||
}
|
||||
else // Change from training area to central
|
||||
{
|
||||
if (totalAreasCentral() >= s_maxActiveAreasCentral[AesType::AtFunctionalArea])
|
||||
return Core::FunctionReplyObject(request.id(), tr_lts("dds", "Too many active central functional areas."));
|
||||
if (totalAreasCentral() >= s_maxActiveAreasCentral[static_cast<int>(AesType::AtFunctionalArea)])
|
||||
return Core::FunctionReplyObject(request.id, tr_lts("dds", "Too many active central functional areas."));
|
||||
m_areaCount--;
|
||||
m_areaCountCentral++;
|
||||
DEBUG_LOG(m_logger) << "s_areaCount[AesType::AtFunctionalArea] = " << m_areaCount;
|
||||
@@ -346,7 +346,7 @@ Core::FunctionReplyObject HandlerFunctionalArea::functionalAreaModifyRequest(con
|
||||
}
|
||||
}
|
||||
|
||||
if (request.id() < 0 && checkStateForSfm(ifs))
|
||||
if (request.id < 0 && checkStateForSfm(ifs))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Overwrite functinal area Effect State for OC";
|
||||
aea.effectStateId = AesEffectState::EsPrepared;
|
||||
|
||||
+23
-23
@@ -17,7 +17,7 @@ namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
HandlerGasPipe::HandlerGasPipe(MainHandler *mainHandler)
|
||||
: HandlerBaseTmpl<ObjectGasPipe>(mainHandler, QStringLiteral("ExplosionArea"), s_areaCount[AesType::AtGasPipe], s_areaCountCentral[AesType::AtGasPipe])
|
||||
: HandlerBaseTmpl<ObjectGasPipe>(mainHandler, QStringLiteral("ExplosionArea"), s_areaCount[static_cast<int>(AesType::AtGasPipe)], s_areaCountCentral[static_cast<int>(AesType::AtGasPipe)])
|
||||
, Interface::Fts::GasPipeModifyRequestHandler(mainHandler->dds()->fts())
|
||||
, Interface::Fts::GasPipeRemoveRequestHandler(mainHandler->dds()->fts())
|
||||
{
|
||||
@@ -52,7 +52,7 @@ bool HandlerGasPipe::init()
|
||||
|
||||
for (const Database::AesGasPipe &dbGasPipe : qAsConst(gasPipeVec))
|
||||
{
|
||||
if (dbGasPipe.effectStateId == AesEffectState_def::EsRemoved)
|
||||
if (dbGasPipe.effectStateId == AesEffectState::EsRemoved)
|
||||
continue;
|
||||
|
||||
dbGasPipeSegments.clear();
|
||||
@@ -84,7 +84,7 @@ void HandlerGasPipe::onGasPipeModifyRequest(const rti::core::SampleIdentity &coo
|
||||
const GasPipeModifyRequest &request)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onGasPipeModifyRequest: " << request;
|
||||
Core::FunctionReplyObject ret = request.id() > 0 ? gasPipeModifyRequest(request) : gasPipeCreateRequest(request);
|
||||
Core::FunctionReplyObject ret = request.id > 0 ? gasPipeModifyRequest(request) : gasPipeCreateRequest(request);
|
||||
if (ret.error())
|
||||
WARNING_LOG(m_logger) << ret();
|
||||
m_mainHandler->dds()->fts()->gasPipeModifyReply(cookie, ret);
|
||||
@@ -95,15 +95,15 @@ Core::FunctionReplyObject HandlerGasPipe::gasPipeCreateRequest(const GasPipeModi
|
||||
{
|
||||
Database::AesGasPipe newData;
|
||||
|
||||
newData.name = QString::fromStdString(request.name());
|
||||
newData.effectStart = request.effectStart().is_set() && request.effectStart().get() > 0 ? QDateTime::fromMSecsSinceEpoch(request.effectStart().get()) : QDateTime();
|
||||
newData.partyId = request.partyId().is_set() ? request.partyId().get() : 0;
|
||||
newData.width = request.width();
|
||||
newData.effectDuration = request.effectDuration();
|
||||
newData.name = QString::fromStdString(request.name);
|
||||
newData.effectStart = request.effectStart.is_set() && request.effectStart.get() > 0 ? QDateTime::fromMSecsSinceEpoch(request.effectStart.get()) : QDateTime();
|
||||
newData.partyId = request.partyId.is_set() ? request.partyId.get() : 0;
|
||||
newData.width = request.width;
|
||||
newData.effectDuration = request.effectDuration;
|
||||
|
||||
ObjectGasPipe *ifs(new ObjectGasPipe(m_mainHandler, this));
|
||||
Core::FunctionReplyObject ret = ifs->createObject(newData,
|
||||
request.segments(),
|
||||
request.segments,
|
||||
QVector<Database::AesGasPipeSegment>());
|
||||
if (ret.error())
|
||||
{
|
||||
@@ -114,7 +114,7 @@ Core::FunctionReplyObject HandlerGasPipe::gasPipeCreateRequest(const GasPipeModi
|
||||
if (ifs->data().isCentral)
|
||||
{
|
||||
|
||||
if (totalAreasCentral() >= s_maxActiveAreasCentral[AesType::AtGasPipe] && request.effectStart().is_set())
|
||||
if (totalAreasCentral() >= s_maxActiveAreasCentral[static_cast<int>(AesType::AtGasPipe)] && request.effectStart.is_set())
|
||||
{
|
||||
ifs->removeObject();
|
||||
delete ifs;
|
||||
@@ -123,7 +123,7 @@ Core::FunctionReplyObject HandlerGasPipe::gasPipeCreateRequest(const GasPipeModi
|
||||
}
|
||||
else
|
||||
{
|
||||
if (totalAreas() >= s_maxActiveAreas[AesType::AtGasPipe] && request.effectStart().is_set())
|
||||
if (totalAreas() >= s_maxActiveAreas[static_cast<int>(AesType::AtGasPipe)] && request.effectStart.is_set())
|
||||
{
|
||||
ifs->removeObject();
|
||||
delete ifs;
|
||||
@@ -151,18 +151,18 @@ Core::FunctionReplyObject HandlerGasPipe::gasPipeCreateRequest(const GasPipeModi
|
||||
Core::FunctionReplyObject HandlerGasPipe::gasPipeModifyRequest(const GasPipeModifyRequest &request)
|
||||
{
|
||||
Core::FunctionReplyObject ret;
|
||||
ObjectGasPipe *ifs = getObjectFromMap(m_objectMap, request.id(), ret);
|
||||
ObjectGasPipe *ifs = getObjectFromMap(m_objectMap, request.id, ret);
|
||||
if (!ifs)
|
||||
return ret;
|
||||
|
||||
Database::AesGasPipe newData;
|
||||
|
||||
newData.name = QString::fromStdString(request.name());
|
||||
newData.effectStart = request.effectStart().is_set() && request.effectStart().get() > 0 ? QDateTime::fromMSecsSinceEpoch(request.effectStart().get()) : QDateTime();
|
||||
newData.partyId = request.partyId().is_set() ? request.partyId().get() : 0;
|
||||
newData.width = request.width();
|
||||
newData.effectDuration = request.effectDuration();
|
||||
if (request.id() < 0 && checkStateForSfm(ifs))
|
||||
newData.name = QString::fromStdString(request.name);
|
||||
newData.effectStart = request.effectStart.is_set() && request.effectStart.get() > 0 ? QDateTime::fromMSecsSinceEpoch(request.effectStart.get()) : QDateTime();
|
||||
newData.partyId = request.partyId.is_set() ? request.partyId.get() : 0;
|
||||
newData.width = request.width;
|
||||
newData.effectDuration = request.effectDuration;
|
||||
if (request.id < 0 && checkStateForSfm(ifs))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Overwrite gas pipe Effect State for OC";
|
||||
newData.effectStateId = AesEffectState::EsPrepared;
|
||||
@@ -171,19 +171,19 @@ Core::FunctionReplyObject HandlerGasPipe::gasPipeModifyRequest(const GasPipeModi
|
||||
/*!
|
||||
* If the effect start added after creation, the max amount need to be checked
|
||||
!*/
|
||||
if(!ifs->isActivationTimeSet() && request.effectStart().is_set())
|
||||
if(!ifs->isActivationTimeSet() && request.effectStart.is_set())
|
||||
{
|
||||
if (ifs->data().isCentral)
|
||||
{
|
||||
|
||||
if (totalAreasCentral() >= s_maxActiveAreasCentral[AesType::AtGasPipe])
|
||||
if (totalAreasCentral() >= s_maxActiveAreasCentral[static_cast<int>(AesType::AtGasPipe)])
|
||||
{
|
||||
return Core::FunctionReplyObject(1, tr_lts("dds", "Too many active central functional areas."));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (totalAreas() >= s_maxActiveAreas[AesType::AtGasPipe])
|
||||
if (totalAreas() >= s_maxActiveAreas[static_cast<int>(AesType::AtGasPipe)])
|
||||
{
|
||||
return Core::FunctionReplyObject(1, tr_lts("dds", "Too many active functional areas areas."));
|
||||
}
|
||||
@@ -191,7 +191,7 @@ Core::FunctionReplyObject HandlerGasPipe::gasPipeModifyRequest(const GasPipeModi
|
||||
}
|
||||
//TODO: Implement switch from decentral to central in gasp pipes
|
||||
// // For counting, only Elements being at least prepared are important:
|
||||
// if (request.effectStart().is_set() && ifs->isObjectModifiable())
|
||||
// if (request.effectStart.is_set() && ifs->isObjectModifiable())
|
||||
// {
|
||||
|
||||
// // Calculate new polygon here. Not nice, though
|
||||
@@ -238,7 +238,7 @@ Core::FunctionReplyObject HandlerGasPipe::gasPipeModifyRequest(const GasPipeModi
|
||||
// }
|
||||
|
||||
|
||||
return ifs->updateObject(newData, request.segments());
|
||||
return ifs->updateObject(newData, request.segments);
|
||||
} // end of onGasPipeModifyRequest()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
+181
-181
@@ -22,7 +22,7 @@ namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
HandlerMineArea::HandlerMineArea(MainHandler *mainHandler)
|
||||
: HandlerBaseTmpl<ObjectMineArea>(mainHandler, QStringLiteral("MineArea"), s_areaCount[AesType::AtMineArea], s_areaCountCentral[AesType::AtMineArea])
|
||||
: HandlerBaseTmpl<ObjectMineArea>(mainHandler, QStringLiteral("MineArea"), s_areaCount[static_cast<int>(AesType::AtMineArea)], s_areaCountCentral[static_cast<int>(AesType::AtMineArea)])
|
||||
, Interface::Fts::MineAreaModifyRequestHandler(mainHandler->dds()->fts())
|
||||
, Interface::Fts::MineAreaRemoveRequestHandler(mainHandler->dds()->fts())
|
||||
, Interface::Fts::MineResetRequestHandler(mainHandler->dds()->fts())
|
||||
@@ -35,12 +35,12 @@ HandlerMineArea::HandlerMineArea(MainHandler *mainHandler)
|
||||
|
||||
bool HandlerMineArea::isDusMineArea(int chargeTypeId, int igniterTypeId, int igniterFunctionId) const
|
||||
{
|
||||
return static_cast<MineClass::type>(m_mainHandler->dds()->pdmDtc()->mineClass(chargeTypeId, igniterTypeId, igniterFunctionId)) == MineClass::DUS;
|
||||
return static_cast<MineClass>(m_mainHandler->dds()->pdmDtc()->mineClass(chargeTypeId, igniterTypeId, igniterFunctionId)) == MineClass::DUS;
|
||||
}
|
||||
|
||||
bool HandlerMineArea::isConcreteMine(int chargeTypeId, int igniterTypeId, int igniterFunctionId) const
|
||||
{
|
||||
return static_cast<MineClass::type>(m_mainHandler->dds()->pdmDtc()->mineClass(chargeTypeId, igniterTypeId, igniterFunctionId)) == MineClass::Concrete;
|
||||
return static_cast<MineClass>(m_mainHandler->dds()->pdmDtc()->mineClass(chargeTypeId, igniterTypeId, igniterFunctionId)) == MineClass::Concrete;
|
||||
}
|
||||
|
||||
bool HandlerMineArea::isFromMineLayer(int chargeTypeId, int igniterTypeId, int igniterFunctionId) const
|
||||
@@ -50,12 +50,12 @@ bool HandlerMineArea::isFromMineLayer(int chargeTypeId, int igniterTypeId, int i
|
||||
|
||||
bool HandlerMineArea::isSingleVirtualMine(int chargeTypeId, int igniterTypeId, int igniterFunctionId) const
|
||||
{
|
||||
return static_cast<MineClass::type>(m_mainHandler->dds()->pdmDtc()->mineClass(chargeTypeId, igniterTypeId, igniterFunctionId)) == MineClass::VirtualSingle;
|
||||
return static_cast<MineClass>(m_mainHandler->dds()->pdmDtc()->mineClass(chargeTypeId, igniterTypeId, igniterFunctionId)) == MineClass::VirtualSingle;
|
||||
}
|
||||
|
||||
bool HandlerMineArea::isVirtualMine(int chargeTypeId, int igniterTypeId, int igniterFunctionId) const
|
||||
{
|
||||
return static_cast<MineClass::type>(m_mainHandler->dds()->pdmDtc()->mineClass(chargeTypeId, igniterTypeId, igniterFunctionId)) == MineClass::Virtual;
|
||||
return static_cast<MineClass>(m_mainHandler->dds()->pdmDtc()->mineClass(chargeTypeId, igniterTypeId, igniterFunctionId)) == MineClass::Virtual;
|
||||
}
|
||||
|
||||
bool HandlerMineArea::init()
|
||||
@@ -97,7 +97,7 @@ bool HandlerMineArea::init()
|
||||
|
||||
if (!ifs->data().isCentral)
|
||||
{
|
||||
if (totalAreas() >= s_maxActiveAreas[AesType::AtMineArea])
|
||||
if (totalAreas() >= s_maxActiveAreas[static_cast<int>(AesType::AtMineArea)])
|
||||
{
|
||||
ERROR_LOG(m_logger) << "More active mine areas in database than allowed - ignoring the rest!";
|
||||
ifs->removeObject();
|
||||
@@ -107,7 +107,7 @@ bool HandlerMineArea::init()
|
||||
}
|
||||
else
|
||||
{
|
||||
if (totalAreasCentral() >= s_maxActiveAreasCentral[AesType::AtMineArea])
|
||||
if (totalAreasCentral() >= s_maxActiveAreasCentral[static_cast<int>(AesType::AtMineArea)])
|
||||
{
|
||||
ERROR_LOG(m_logger) << "More active mine areas in database than allowed - ignoring the rest!";
|
||||
ifs->removeObject();
|
||||
@@ -196,9 +196,9 @@ bool HandlerMineArea::removeDuplicateMine(int mineId)
|
||||
return false;
|
||||
}
|
||||
|
||||
int HandlerMineArea::totalAreas() const { return s_areaCount[AesType::AtMineArea]; }
|
||||
int HandlerMineArea::totalAreas() const { return s_areaCount[static_cast<int>(AesType::AtMineArea)]; }
|
||||
|
||||
int HandlerMineArea::totalAreasCentral() const { return s_areaCountCentral[AesType::AtMineArea]; }
|
||||
int HandlerMineArea::totalAreasCentral() const { return s_areaCountCentral[static_cast<int>(AesType::AtMineArea)]; }
|
||||
|
||||
template <typename T> T getValueHelper(T in) { return in; }
|
||||
|
||||
@@ -206,23 +206,23 @@ template <typename T> T getValueHelper(const dds::core::optional<T> &in) { retur
|
||||
|
||||
template <typename T> static void fillData(const T &src, Database::AesMineArea &dst)
|
||||
{
|
||||
if (src.id() < 0) // is the id given as negative? set id -> used by OC-Laptop
|
||||
dst.id = src.id();
|
||||
if (src.id < 0) // is the id given as negative? set id -> used by OC-Laptop
|
||||
dst.id = src.id;
|
||||
|
||||
dst.name = QString::fromStdString(src.name());
|
||||
dst.effectStart = src.effectStart().is_set() && src.effectStart().get() > 0 ? QDateTime::fromMSecsSinceEpoch(src.effectStart().get()) : QDateTime();
|
||||
dst.effectDuration = src.effectDuration();
|
||||
dst.effectSourceId = src.effectSourceId();
|
||||
dst.partyId = src.partyId().is_set() ? src.partyId().get() : 0;
|
||||
dst.chargeTypeId = src.chargeStruct().chargeTypeId();
|
||||
dst.participantId = src.participantId().is_set() ? src.participantId().get() : 0;
|
||||
dst.density = src.density();
|
||||
dst.width = src.width();
|
||||
dst.layingProcedureTypeId = src.layingProcedureType();
|
||||
dst.isLaidHidden = src.isLaidHidden();
|
||||
dst.effectMarkingInTa = src.effectMarkingInTa();
|
||||
dst.isCenterLine = src.isCenterLine();
|
||||
dst.externalId = getValueHelper(src.externalId());
|
||||
dst.name = QString::fromStdString(src.name);
|
||||
dst.effectStart = src.effectStart.is_set() && src.effectStart.get() > 0 ? QDateTime::fromMSecsSinceEpoch(src.effectStart.get()) : QDateTime();
|
||||
dst.effectDuration = src.effectDuration;
|
||||
dst.effectSourceId = src.effectSourceId;
|
||||
dst.partyId = src.partyId.is_set() ? src.partyId.get() : 0;
|
||||
dst.chargeTypeId = src.chargeStruct.chargeTypeId;
|
||||
dst.participantId = src.participantId.is_set() ? src.participantId.get() : 0;
|
||||
dst.density = src.density;
|
||||
dst.width = src.width;
|
||||
dst.layingProcedureTypeId = src.layingProcedureType;
|
||||
dst.isLaidHidden = src.isLaidHidden;
|
||||
dst.effectMarkingInTa = src.effectMarkingInTa;
|
||||
dst.isCenterLine = src.isCenterLine;
|
||||
dst.externalId = getValueHelper(src.externalId);
|
||||
}
|
||||
|
||||
static inline bool intersects(const QPolygonF &p1, const std::vector<Core::GeoPosition> &ddsp2)
|
||||
@@ -230,7 +230,7 @@ static inline bool intersects(const QPolygonF &p1, const std::vector<Core::GeoPo
|
||||
QPolygonF p2(ddsp2.size());
|
||||
int i = 0;
|
||||
for (const auto &point : ddsp2)
|
||||
p2[i++] = QPointF(point.lon(), point.lat());
|
||||
p2[i++] = QPointF(point.lon, point.lat);
|
||||
|
||||
QPainterPath pp1;
|
||||
pp1.addPolygon(p1);
|
||||
@@ -242,7 +242,7 @@ static inline bool intersects(const QPolygonF &p1, const std::vector<Core::GeoPo
|
||||
void HandlerMineArea::onMineAreaModifyRequest(const rti::core::SampleIdentity &cookie, const MineAreaModifyRequest &request)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onMineAreaModifyRequest: " << request << "totalAreas=" << totalAreas()
|
||||
<< " s_maxActiveAreas[AesType::AtMineArea]=" << s_maxActiveAreas[AesType::AtMineArea];
|
||||
<< " s_maxActiveAreas[AesType::AtMineArea]=" << s_maxActiveAreas[static_cast<int>(AesType::AtMineArea)];
|
||||
|
||||
const Core::FunctionReplyObject ret = mineAreaModifyRequest(request);
|
||||
if (ret.error())
|
||||
@@ -253,7 +253,7 @@ void HandlerMineArea::onMineAreaModifyRequest(const rti::core::SampleIdentity &c
|
||||
template <typename T> Core::FunctionReplyObject HandlerMineArea::mineAreaCreateRequest(const T &request)
|
||||
{
|
||||
// if ( !isDusMineArea(request.chargeTypeId())
|
||||
// && (totalAreas() >= s_maxActiveAreas[AesType::AtMineArea] && request.effectStart().is_set()))
|
||||
// && (totalAreas() >= s_maxActiveAreas[AesType::AtMineArea] && request.effectStart.is_set()))
|
||||
// return Core::FunctionReplyObject(1, tr_lts("dds", "Too many peripheral mine areas."));
|
||||
|
||||
Database::AesMineArea newData;
|
||||
@@ -263,9 +263,9 @@ template <typename T> Core::FunctionReplyObject HandlerMineArea::mineAreaCreateR
|
||||
if (isDusMineArea(newData.chargeTypeId, newData.igniterTypeId, newData.igniterFunctionId)
|
||||
|| isConcreteMine(newData.chargeTypeId, newData.igniterTypeId, newData.igniterFunctionId))
|
||||
{
|
||||
if (!checkIfNullMineIsInArea(request.segments(), newData, request.distance()))
|
||||
if (!checkIfNullMineIsInArea(request.segments, newData, request.distance))
|
||||
{
|
||||
QString chargeTypeName = QString::fromStdString(m_mainHandler->dds()->pdmDtc()->chargeType(newData.chargeTypeId).name());
|
||||
QString chargeTypeName = QString::fromStdString(m_mainHandler->dds()->pdmDtc()->chargeType(newData.chargeTypeId).name);
|
||||
return Core::FunctionReplyObject(1, tr_lts("dds", "No mines of type '%1' found in chosen area")).arg(chargeTypeName);
|
||||
}
|
||||
}
|
||||
@@ -274,9 +274,9 @@ template <typename T> Core::FunctionReplyObject HandlerMineArea::mineAreaCreateR
|
||||
ObjectMineArea *ifs(new ObjectMineArea(m_mainHandler, this));
|
||||
connect(ifs, &ObjectMineArea::effectStateChanged, this, &HandlerMineArea::onEffectStateChanged);
|
||||
|
||||
Core::FunctionReplyObject ret = ifs->createObject(newData, request.segments());
|
||||
Core::FunctionReplyObject ret = ifs->createObject(newData, request.segments);
|
||||
|
||||
DEBUG_LOG(m_logger) << ">>> mineAreaCreateRequest: re.segSize: " << request.segments().size() << " // ifs.segSize: " << ifs->segments().size()
|
||||
DEBUG_LOG(m_logger) << ">>> mineAreaCreateRequest: re.segSize: " << request.segments.size() << " // ifs.segSize: " << ifs->segments().size()
|
||||
<< " // mineCount: " << ifs->mineCount();
|
||||
if (ret.error())
|
||||
{
|
||||
@@ -301,7 +301,7 @@ template <typename T> Core::FunctionReplyObject HandlerMineArea::mineAreaCreateR
|
||||
bool isCentral = ifs->checkIsCentral(_form);
|
||||
if (isCentral)
|
||||
{
|
||||
if (totalAreasCentral() >= s_maxActiveAreasCentral[AesType::AtMineArea] && request.effectStart().is_set())
|
||||
if (totalAreasCentral() >= s_maxActiveAreasCentral[static_cast<int>(AesType::AtMineArea)] && request.effectStart.is_set())
|
||||
{
|
||||
ifs->removeObject(); // Not finally deleted from db after this,Fallback if DB deletion is not working correct
|
||||
ifs->removeObjectFromDb();
|
||||
@@ -329,14 +329,14 @@ template <typename T> Core::FunctionReplyObject HandlerMineArea::mineAreaCreateR
|
||||
|
||||
if (newData.layingProcedureTypeId == AesMaLayingProcedureType::LptArtillery /*PzAbwWmiV */)
|
||||
{
|
||||
if (request.effectStart().is_set())
|
||||
if (request.effectStart.is_set())
|
||||
--pzAbwWMiSafe;
|
||||
}
|
||||
|
||||
if (pzAbwWMiSafe < 0)
|
||||
pzAbwWMiSafe = 0;
|
||||
|
||||
if (totalAreas() >= s_maxActiveAreas[AesType::AtMineArea] - pzAbwWMiSafe && request.effectStart().is_set())
|
||||
if (totalAreas() >= s_maxActiveAreas[static_cast<int>(AesType::AtMineArea)] - pzAbwWMiSafe && request.effectStart.is_set())
|
||||
{
|
||||
ifs->removeObject(); // Not finally deleted from db after this,Fallback if DB deletion is not working correct
|
||||
ifs->removeObjectFromDb();
|
||||
@@ -346,7 +346,7 @@ template <typename T> Core::FunctionReplyObject HandlerMineArea::mineAreaCreateR
|
||||
|
||||
if (newData.layingProcedureTypeId == AesMaLayingProcedureType::LptArtillery /*PzAbwWmiV */)
|
||||
{
|
||||
if (request.effectStart().is_set())
|
||||
if (request.effectStart.is_set())
|
||||
++m_totalPzAbwWMis;
|
||||
}
|
||||
}
|
||||
@@ -374,8 +374,8 @@ template <typename T> Core::FunctionReplyObject HandlerMineArea::mineAreaCreateR
|
||||
if (ifs->isDusMineArea() || ifs->isConcreteMine())
|
||||
{
|
||||
assignMinesFromNullArea(ifs->id());
|
||||
DEBUG_LOG(m_logger) << "Start change to Line: " << request.setMineSorted();
|
||||
ret = ifs->changeSegmentsToLine(request.setMineSorted());
|
||||
DEBUG_LOG(m_logger) << "Start change to Line: " << request.setMineSorted;
|
||||
ret = ifs->changeSegmentsToLine(request.setMineSorted);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -384,21 +384,21 @@ template <typename T> Core::FunctionReplyObject HandlerMineArea::mineAreaModifyR
|
||||
{
|
||||
Core::FunctionReplyObject ret;
|
||||
ObjectMineArea *ifs = nullptr;
|
||||
if (getValueHelper(request.externalId()) > 0)
|
||||
ifs = getObjectFromMapByExternalId(m_objectMap, getValueHelper(request.externalId()), ret);
|
||||
if (getValueHelper(request.externalId) > 0)
|
||||
ifs = getObjectFromMapByExternalId(m_objectMap, getValueHelper(request.externalId), ret);
|
||||
|
||||
if (!ifs)
|
||||
{
|
||||
if (request.id() == 0 || ((request.id() < 0) && !getObjectFromMap(m_objectMap, std::abs(request.id()), ret)))
|
||||
if (request.id == 0 || ((request.id < 0) && !getObjectFromMap(m_objectMap, std::abs(request.id), ret)))
|
||||
return mineAreaCreateRequest(request);
|
||||
|
||||
ifs = getObjectFromMap(m_objectMap, std::abs(request.id()), ret);
|
||||
ifs = getObjectFromMap(m_objectMap, std::abs(request.id), ret);
|
||||
|
||||
if (!ifs)
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (request.effectStart().is_set() && (request.effectStart().get() + request.effectDuration() < m_mainHandler->dds()->currentPartitionTime().toMSecsSinceEpoch()))
|
||||
if (request.effectStart.is_set() && (request.effectStart.get() + request.effectDuration < m_mainHandler->dds()->currentPartitionTime().toMSecsSinceEpoch()))
|
||||
return removeObject(ifs);
|
||||
|
||||
Database::AesMineArea newData(ifs->data());
|
||||
@@ -407,7 +407,7 @@ template <typename T> Core::FunctionReplyObject HandlerMineArea::mineAreaModifyR
|
||||
QVector<Database::AesMineAreaSegment> vecSegments;
|
||||
double totalLength = 0.0;
|
||||
|
||||
ifs->createSegments(request.segments(), request.id(), vecSegments, totalLength);
|
||||
ifs->createSegments(request.segments, request.id, vecSegments, totalLength);
|
||||
auto poly = Polygons::mineArea(vecSegments, newData.width, newData.density, newData.isCenterLine); // FIXME:Is segements filled here
|
||||
|
||||
// Check if mine field is in building only
|
||||
@@ -422,12 +422,12 @@ template <typename T> Core::FunctionReplyObject HandlerMineArea::mineAreaModifyR
|
||||
/*!
|
||||
* If the effect start added after creation, the max amount need to be checked
|
||||
*/
|
||||
if (!ifs->isActivationTimeSet() && request.effectStart().is_set())
|
||||
if (!ifs->isActivationTimeSet() && request.effectStart.is_set())
|
||||
{
|
||||
if (isCentral)
|
||||
{
|
||||
|
||||
if (totalAreasCentral() >= s_maxActiveAreasCentral[AesType::AtMineArea] /*&& request.effectStart().is_set()*/)
|
||||
if (totalAreasCentral() >= s_maxActiveAreasCentral[static_cast<int>(AesType::AtMineArea)] /*&& request.effectStart.is_set()*/)
|
||||
return Core::FunctionReplyObject(1, tr_lts("dds", "Too many central mine areas."));
|
||||
|
||||
ret = ifs->checkDensity(newData.density, totalLength, s_maxCentralSingleMinesCount);
|
||||
@@ -453,7 +453,7 @@ template <typename T> Core::FunctionReplyObject HandlerMineArea::mineAreaModifyR
|
||||
if (pzAbwWMiSafe < 0)
|
||||
pzAbwWMiSafe = 0;
|
||||
|
||||
if (totalAreas() >= s_maxActiveAreas[AesType::AtMineArea] - pzAbwWMiSafe /*&& request.effectStart().is_set()*/)
|
||||
if (totalAreas() >= s_maxActiveAreas[static_cast<int>(AesType::AtMineArea)] - pzAbwWMiSafe /*&& request.effectStart.is_set()*/)
|
||||
return Core::FunctionReplyObject(1, tr_lts("dds", "Too many peripheral mine areas."));
|
||||
|
||||
if (newData.layingProcedureTypeId == AesMaLayingProcedureType::LptArtillery /*PzAbwWmiV */)
|
||||
@@ -464,7 +464,7 @@ template <typename T> Core::FunctionReplyObject HandlerMineArea::mineAreaModifyR
|
||||
}
|
||||
|
||||
// For counting, only Elements being at least prepared are important:
|
||||
if (request.effectStart().is_set() && ifs->isObjectModifiable())
|
||||
if (request.effectStart.is_set() && ifs->isObjectModifiable())
|
||||
{
|
||||
// Calculate new polygon here. Not nice, though
|
||||
|
||||
@@ -481,15 +481,15 @@ template <typename T> Core::FunctionReplyObject HandlerMineArea::mineAreaModifyR
|
||||
|
||||
if (newData.layingProcedureTypeId == AesMaLayingProcedureType::LptArtillery /*PzAbwWmiV */)
|
||||
{
|
||||
if (request.effectStart().is_set())
|
||||
if (request.effectStart.is_set())
|
||||
--pzAbwWMiSafe;
|
||||
}
|
||||
|
||||
if (pzAbwWMiSafe < 0)
|
||||
pzAbwWMiSafe = 0;
|
||||
|
||||
if (totalAreas() >= s_maxActiveAreas[AesType::AtMineArea] - pzAbwWMiSafe) // Minus PzAbwWmiV
|
||||
return Core::FunctionReplyObject(request.id(), tr_lts("dds", "Too many peripheral mine areas."));
|
||||
if (totalAreas() >= s_maxActiveAreas[static_cast<int>(AesType::AtMineArea)] - pzAbwWMiSafe) // Minus PzAbwWmiV
|
||||
return Core::FunctionReplyObject(request.id, tr_lts("dds", "Too many peripheral mine areas."));
|
||||
|
||||
if (newData.layingProcedureTypeId == AesMaLayingProcedureType::LptArtillery /*&& newData.chargeTypeId == 216*/ /*PzAbwWmiV */)
|
||||
m_totalPzAbwWMis++;
|
||||
@@ -501,8 +501,8 @@ template <typename T> Core::FunctionReplyObject HandlerMineArea::mineAreaModifyR
|
||||
else // Change from training area to central
|
||||
{
|
||||
|
||||
if (totalAreasCentral() >= s_maxActiveAreasCentral[AesType::AtMineArea])
|
||||
return Core::FunctionReplyObject(request.id(), tr_lts("dds", "Too many central mine areas."));
|
||||
if (totalAreasCentral() >= s_maxActiveAreasCentral[static_cast<int>(AesType::AtMineArea)])
|
||||
return Core::FunctionReplyObject(request.id, tr_lts("dds", "Too many central mine areas."));
|
||||
m_areaCount--;
|
||||
m_areaCountCentral++;
|
||||
|
||||
@@ -514,7 +514,7 @@ template <typename T> Core::FunctionReplyObject HandlerMineArea::mineAreaModifyR
|
||||
}
|
||||
}
|
||||
|
||||
if (request.layingProcedureType() == AesMaLayingProcedureType::LptPioneer && ifs->get().layingProcedureTypeId == AesMaLayingProcedureType::LptArtillery && !isCentral)
|
||||
if (request.layingProcedureType == AesMaLayingProcedureType::LptPioneer && ifs->get().layingProcedureTypeId == AesMaLayingProcedureType::LptArtillery && !isCentral)
|
||||
{
|
||||
|
||||
--m_totalPzAbwWMis;
|
||||
@@ -525,13 +525,13 @@ template <typename T> Core::FunctionReplyObject HandlerMineArea::mineAreaModifyR
|
||||
if (pzAbwWMiSafe < 0)
|
||||
pzAbwWMiSafe = 0;
|
||||
|
||||
if (totalAreas() > s_maxActiveAreas[AesType::AtMineArea] - pzAbwWMiSafe) // Minus PzAbwWmiV
|
||||
if (totalAreas() > s_maxActiveAreas[static_cast<int>(AesType::AtMineArea)] - pzAbwWMiSafe) // Minus PzAbwWmiV
|
||||
{
|
||||
++m_totalPzAbwWMis;
|
||||
return Core::FunctionReplyObject(request.id(), tr_lts("dds", "Too many peripheral mine areas."));
|
||||
return Core::FunctionReplyObject(request.id, tr_lts("dds", "Too many peripheral mine areas."));
|
||||
}
|
||||
}
|
||||
else if (request.layingProcedureType() == AesMaLayingProcedureType::LptArtillery && ifs->get().layingProcedureTypeId == AesMaLayingProcedureType::LptPioneer
|
||||
else if (request.layingProcedureType == AesMaLayingProcedureType::LptArtillery && ifs->get().layingProcedureTypeId == AesMaLayingProcedureType::LptPioneer
|
||||
&& !isCentral)
|
||||
{
|
||||
|
||||
@@ -540,7 +540,7 @@ template <typename T> Core::FunctionReplyObject HandlerMineArea::mineAreaModifyR
|
||||
}
|
||||
}
|
||||
|
||||
if (request.id() < 0 && checkStateForSfm(ifs))
|
||||
if (request.id < 0 && checkStateForSfm(ifs))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Overwrite mine area Effect State for OC";
|
||||
newData.effectStateId = AesEffectState::EsPrepared;
|
||||
@@ -549,16 +549,16 @@ template <typename T> Core::FunctionReplyObject HandlerMineArea::mineAreaModifyR
|
||||
// check: effectStart > time(NULL) ?
|
||||
int32_t oldChargeTypeId = ifs->data().chargeTypeId;
|
||||
|
||||
ret = ifs->updateObject(newData, request.segments());
|
||||
ret = ifs->updateObject(newData, request.segments);
|
||||
|
||||
// assign mines from NullArea if applicable
|
||||
if (oldChargeTypeId != newData.chargeTypeId)
|
||||
if (ifs->isDusMineArea() || ifs->isConcreteMine())
|
||||
{
|
||||
assignMinesFromNullArea(ifs->id());
|
||||
DEBUG_LOG(m_logger) << "Start change to Line(modify): " << request.setMineSorted();
|
||||
DEBUG_LOG(m_logger) << "Start change to Line(modify): " << request.setMineSorted;
|
||||
|
||||
ifs->changeSegmentsToLine(request.setMineSorted());
|
||||
ifs->changeSegmentsToLine(request.setMineSorted);
|
||||
}
|
||||
|
||||
ifs->clearBuildings();
|
||||
@@ -569,7 +569,7 @@ template <typename T> Core::FunctionReplyObject HandlerMineArea::mineAreaModifyR
|
||||
void HandlerMineArea::onMineAreaRemoveRequest(const rti::core::SampleIdentity &cookie, const Core::RemoveElementRequest &request)
|
||||
{
|
||||
Core::FunctionReplyObject ret;
|
||||
const qint32 id = request.id() < 0 ? (request.id() * -1) : request.id();
|
||||
const qint32 id = request.id < 0 ? (request.id * -1) : request.id;
|
||||
ObjectMineArea *ifs = getObjectFromMap(m_objectMap, id, ret);
|
||||
|
||||
if (ifs == nullptr)
|
||||
@@ -597,23 +597,23 @@ Core::FunctionReplyObject HandlerMineArea::mineResetRequest(const MineResetReque
|
||||
{
|
||||
// If they are DUS Mines that are not part of a mine area [yet]
|
||||
// request does not contain position, so it cannot be assigned to an area
|
||||
if (request.mineAreaId() == 0)
|
||||
if (request.mineAreaId == 0)
|
||||
{
|
||||
// If single mine...
|
||||
if (request.mineId().is_set())
|
||||
if (request.mineId.is_set())
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Checking in DUS-Mine-Areas";
|
||||
bool found = false;
|
||||
auto it = m_objectMap.cbegin();
|
||||
while (it != m_objectMap.cend() && !found)
|
||||
{
|
||||
found = (*it)->resetMine(request.mineId().get());
|
||||
found = (*it)->resetMine(request.mineId.get());
|
||||
++it;
|
||||
}
|
||||
if (!found)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Not found in DUS Mine Areas, resetting in NullArea!";
|
||||
m_nullArea->resetMine(request.mineId().get());
|
||||
m_nullArea->resetMine(request.mineId.get());
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -628,24 +628,24 @@ Core::FunctionReplyObject HandlerMineArea::mineResetRequest(const MineResetReque
|
||||
mineAreaObj->resetMines();
|
||||
}
|
||||
}
|
||||
return Core::FunctionReplyObject(request.mineAreaId());
|
||||
return Core::FunctionReplyObject(request.mineAreaId);
|
||||
}
|
||||
|
||||
// Both Virtual and DUS Mine Area
|
||||
ObjectMineArea *ifs = m_objectMap.value(request.mineAreaId());
|
||||
ObjectMineArea *ifs = m_objectMap.value(request.mineAreaId);
|
||||
if (!ifs)
|
||||
return Core::FunctionReplyObject(request.mineAreaId(), tr_lts("dds", "Mine area with id %1 not found.")).arg(request.mineAreaId());
|
||||
return Core::FunctionReplyObject(request.mineAreaId, tr_lts("dds", "Mine area with id %1 not found.")).arg(request.mineAreaId);
|
||||
|
||||
bool bOk;
|
||||
if (request.mineId().is_set())
|
||||
bOk = ifs->resetMine(request.mineId().get());
|
||||
if (request.mineId.is_set())
|
||||
bOk = ifs->resetMine(request.mineId.get());
|
||||
else
|
||||
bOk = ifs->resetMines();
|
||||
|
||||
if (!bOk)
|
||||
return Core::FunctionReplyObject(request.mineAreaId(), tr_lts("dds", "Reset Virtual Mine(s) failed."));
|
||||
return Core::FunctionReplyObject(request.mineAreaId, tr_lts("dds", "Reset Virtual Mine(s) failed."));
|
||||
|
||||
return Core::FunctionReplyObject(request.mineAreaId());
|
||||
return Core::FunctionReplyObject(request.mineAreaId);
|
||||
}
|
||||
|
||||
void HandlerMineArea::onMineTriggered(const TrainingAreaBase::MineTriggered &data, DataModification modType)
|
||||
@@ -654,13 +654,13 @@ void HandlerMineArea::onMineTriggered(const TrainingAreaBase::MineTriggered &dat
|
||||
return;
|
||||
|
||||
MineTriggeredRequest mtr;
|
||||
mtr.mineAreaId(data.mineAreaId());
|
||||
mtr.mineAreaId = data.mineAreaId;
|
||||
// from tab - mine area mine index starts at 1 ...
|
||||
mtr.mineId(data.mineAreaId() == 0 ? data.mineIndex() : data.mineIndex() - 1);
|
||||
if (data.position().is_set())
|
||||
mtr.position(data.position().get());
|
||||
if (data.chargeTypeId().is_set())
|
||||
mtr.chargeTypeId(data.chargeTypeId().get());
|
||||
mtr.mineId = data.mineAreaId == 0 ? data.mineIndex : data.mineIndex - 1;
|
||||
if (data.position.is_set())
|
||||
mtr.position = data.position.get();
|
||||
if (data.chargeTypeId.is_set())
|
||||
mtr.chargeTypeId = data.chargeTypeId.get();
|
||||
|
||||
auto ret = mineTriggeredRequest(mtr);
|
||||
if (ret.error())
|
||||
@@ -679,17 +679,17 @@ Core::FunctionReplyObject HandlerMineArea::mineTriggeredRequest(const MineTrigge
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "mineTriggeredRequest: " << request;
|
||||
// NOTE: igniterType/IgniterFunciton = 0 as long as MineTriggeredRequest does not contain values
|
||||
if (request.mineAreaId() == 0 || (request.chargeTypeId().is_set() && isConcreteMine(request.chargeTypeId().get(), 0, 0)))
|
||||
if (request.mineAreaId == 0 || (request.chargeTypeId.is_set() && isConcreteMine(request.chargeTypeId.get(), 0, 0)))
|
||||
{
|
||||
int chargeTypeId = request.chargeTypeId().is_set() ? request.chargeTypeId().get() : 0;
|
||||
int chargeTypeId = request.chargeTypeId.is_set() ? request.chargeTypeId.get() : 0;
|
||||
|
||||
// DUS Mines:
|
||||
// NOTE: igniterType/IgniterFunciton = 0 as long as MineTriggeredRequest does not contain values
|
||||
QPointF position;
|
||||
if (request.position().is_set() && !isFromMineLayer(chargeTypeId, 0, 0))
|
||||
if (request.position.is_set() && !isFromMineLayer(chargeTypeId, 0, 0))
|
||||
{
|
||||
position.setX(request.position().get().lon());
|
||||
position.setY(request.position().get().lat());
|
||||
position.setX(request.position.get().lon);
|
||||
position.setY(request.position.get().lat);
|
||||
}
|
||||
|
||||
Database::AesMineAreaTriggeredMines mine;
|
||||
@@ -699,20 +699,20 @@ Core::FunctionReplyObject HandlerMineArea::mineTriggeredRequest(const MineTrigge
|
||||
auto it = m_objectMap.cbegin();
|
||||
while (it != m_objectMap.cend() && !mineFound)
|
||||
{
|
||||
int mineId = request.mineId();
|
||||
int mineId = request.mineId;
|
||||
ObjectMineArea *mineArea = it.value();
|
||||
DEBUG_LOG(m_logger) << "mineId: " << mineId << ", areaId:" << mineArea->id();
|
||||
if (request.mineAreaId() > 0 && request.mineAreaId() != mineArea->id())
|
||||
if (request.mineAreaId > 0 && request.mineAreaId != mineArea->id())
|
||||
{
|
||||
it++;
|
||||
continue;
|
||||
}
|
||||
|
||||
DEBUG_LOG(m_logger) << "request.mineAreaId: " << request.mineAreaId();
|
||||
DEBUG_LOG(m_logger) << "request.mineAreaId: " << request.mineAreaId;
|
||||
if (mineArea->isConcreteMine())
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "isConcrete = true";
|
||||
mineId = mineArea->getMineIdByIndex(request.mineId());
|
||||
mineId = mineArea->getMineIdByIndex(request.mineId);
|
||||
}
|
||||
|
||||
if ((mineArea->isDusMineArea() || mineArea->isConcreteMine()) && mineArea->hasMine(mineId)) // is mine in a DUS minearea
|
||||
@@ -723,7 +723,7 @@ Core::FunctionReplyObject HandlerMineArea::mineTriggeredRequest(const MineTrigge
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "triggerMine: mineId: " << mineId;
|
||||
mineArea->triggerMine(mineId, true, position);
|
||||
return Core::FunctionReplyObject(request.mineAreaId());
|
||||
return Core::FunctionReplyObject(request.mineAreaId);
|
||||
}
|
||||
mine = mineArea->takeMine(mineId); // take the mine, as it is not handled anymore
|
||||
}
|
||||
@@ -736,18 +736,18 @@ Core::FunctionReplyObject HandlerMineArea::mineTriggeredRequest(const MineTrigge
|
||||
while (it != m_objectMap.cend() && handlingAreaId == 0)
|
||||
{
|
||||
const ObjectMineArea *mineArea = it.value();
|
||||
if ((mineArea->isDusMineArea() || mineArea->isConcreteMine()) && mineArea->canHandleMine(request.mineId(), chargeTypeId, position))
|
||||
if ((mineArea->isDusMineArea() || mineArea->isConcreteMine()) && mineArea->canHandleMine(request.mineId, chargeTypeId, position))
|
||||
handlingAreaId = mineArea->id();
|
||||
++it;
|
||||
}
|
||||
|
||||
// if mine was not already in a mine area and there is an area that wants the mine, check if it can be taken from the null area
|
||||
if (!mineFound && handlingAreaId != 0)
|
||||
mine = m_nullArea->takeMine(request.mineId());
|
||||
mine = m_nullArea->takeMine(request.mineId);
|
||||
|
||||
if (mine.id != 0) // mine did exist already
|
||||
{
|
||||
if (request.position().is_set()) // update position
|
||||
if (request.position.is_set()) // update position
|
||||
mine.position = position;
|
||||
}
|
||||
|
||||
@@ -764,7 +764,7 @@ Core::FunctionReplyObject HandlerMineArea::mineTriggeredRequest(const MineTrigge
|
||||
else
|
||||
{
|
||||
if (!triggerUnpairedMine(request))
|
||||
ifs->triggerMine(request.mineId(), true, position);
|
||||
ifs->triggerMine(request.mineId, true, position);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -775,20 +775,20 @@ Core::FunctionReplyObject HandlerMineArea::mineTriggeredRequest(const MineTrigge
|
||||
else
|
||||
{
|
||||
if (!triggerUnpairedMine(request))
|
||||
m_nullArea->triggerMine(request.mineId(), true, chargeTypeId, position);
|
||||
m_nullArea->triggerMine(request.mineId, true, chargeTypeId, position);
|
||||
}
|
||||
}
|
||||
|
||||
return Core::FunctionReplyObject(request.mineAreaId());
|
||||
return Core::FunctionReplyObject(request.mineAreaId);
|
||||
}
|
||||
|
||||
// Virtual:
|
||||
ObjectMineArea *ifs = m_objectMap.value(request.mineAreaId());
|
||||
ObjectMineArea *ifs = m_objectMap.value(request.mineAreaId);
|
||||
if (!ifs)
|
||||
return Core::FunctionReplyObject(request.mineAreaId(), tr_lts("dds", "Mine area with id %1 not found.")).arg(request.mineAreaId());
|
||||
return Core::FunctionReplyObject(request.mineAreaId, tr_lts("dds", "Mine area with id %1 not found.")).arg(request.mineAreaId);
|
||||
|
||||
ifs->triggerMine(request.mineId());
|
||||
return Core::FunctionReplyObject(request.mineAreaId());
|
||||
ifs->triggerMine(request.mineId);
|
||||
return Core::FunctionReplyObject(request.mineAreaId);
|
||||
}
|
||||
|
||||
void HandlerMineArea::onMineAreaModifyFromCtaDataRequest(const rti::core::SampleIdentity &cookie, const MineArea &request)
|
||||
@@ -802,12 +802,12 @@ void HandlerMineArea::onMineAreaModifyFromCtaDataRequest(const rti::core::Sample
|
||||
|
||||
void HandlerMineArea::onNewMineCorridor(const AesItemView &aiv)
|
||||
{
|
||||
if (aiv.effectStateId() != AesEffectState::EsActivated)
|
||||
if (aiv.effectStateId != AesEffectState::EsActivated)
|
||||
return;
|
||||
|
||||
for (ObjectMineArea *ma : qAsConst(m_objectMap))
|
||||
{
|
||||
if (intersects(ma->boundingRect(), aiv.form()))
|
||||
if (intersects(ma->boundingRect(), aiv.form))
|
||||
ma->clearCorridor(aiv);
|
||||
}
|
||||
}
|
||||
@@ -821,11 +821,11 @@ void HandlerMineArea::onNewMineCorridor(const AesItemView &aiv)
|
||||
Core::FunctionReplyObject HandlerMineArea::mineAreaReferenceCreateRequest(const MineAreaReferenceModifyRequest &refRequest)
|
||||
{
|
||||
Core::FunctionReplyObject ret;
|
||||
if (refRequest.mineData().empty() || refRequest.referenceAesItemId() <= 0)
|
||||
if (refRequest.mineData.empty() || refRequest.referenceAesItemId <= 0)
|
||||
return Core::FunctionReplyObject(1, tr_lts("dds", "Invalid MineAreaReference data"));
|
||||
|
||||
DEBUG_LOG(m_logger) << "--[mineAreaReferenceCreateRequest] referenceAesItemId: " << refRequest.referenceAesItemId()
|
||||
<< " mindeData size: " << refRequest.mineData().size();
|
||||
DEBUG_LOG(m_logger) << "--[mineAreaReferenceCreateRequest] referenceAesItemId: " << refRequest.referenceAesItemId
|
||||
<< " mindeData size: " << refRequest.mineData.size();
|
||||
|
||||
Database::AesMineArea newData;
|
||||
if (!fillFromMineAreaReferenceRequest(refRequest, newData))
|
||||
@@ -833,13 +833,13 @@ Core::FunctionReplyObject HandlerMineArea::mineAreaReferenceCreateRequest(const
|
||||
|
||||
// add referencedAesItemId into the properties
|
||||
QJsonObject propObj = QJsonDocument::fromJson(newData.properties.toUtf8()).object();
|
||||
propObj.insert(QStringLiteral("referencedAesItemId"), refRequest.referenceAesItemId());
|
||||
propObj.insert(QStringLiteral("referencedAesItemId"), refRequest.referenceAesItemId);
|
||||
newData.properties = QString::fromStdString(QJsonDocument(propObj).toJson().toStdString());
|
||||
|
||||
ObjectMineArea *ifs(new ObjectMineArea(m_mainHandler, this));
|
||||
std::vector<Core::GeoPosition2D> vecGeoSegment;
|
||||
double newWidth = newData.width; // always central
|
||||
ret = ifs->createGeoSegmentsFromMineData(newWidth, refRequest.mineData(), vecGeoSegment); // segments will be filled through mineData
|
||||
ret = ifs->createGeoSegmentsFromMineData(newWidth, refRequest.mineData, vecGeoSegment); // segments will be filled through mineData
|
||||
if (ret.error())
|
||||
{
|
||||
delete ifs;
|
||||
@@ -848,7 +848,7 @@ Core::FunctionReplyObject HandlerMineArea::mineAreaReferenceCreateRequest(const
|
||||
|
||||
newData.width = newWidth;
|
||||
connect(ifs, &ObjectMineArea::effectStateChanged, this, &HandlerMineArea::onEffectStateChanged);
|
||||
ret = ifs->createObjectFromMineData(newData, vecGeoSegment, refRequest.mineData());
|
||||
ret = ifs->createObjectFromMineData(newData, vecGeoSegment, refRequest.mineData);
|
||||
|
||||
if (ret.error())
|
||||
{
|
||||
@@ -874,7 +874,7 @@ Core::FunctionReplyObject HandlerMineArea::mineAreaReferenceCreateRequest(const
|
||||
if (ifs->isObjectInTrainingArea())
|
||||
++m_areaCount;
|
||||
|
||||
DEBUG_LOG(m_logger) << "--[mineAreaReferenceCreateRequest]- -----> Mine Area created from MineData with refAesItemId: " << refRequest.referenceAesItemId()
|
||||
DEBUG_LOG(m_logger) << "--[mineAreaReferenceCreateRequest]- -----> Mine Area created from MineData with refAesItemId: " << refRequest.referenceAesItemId
|
||||
<< " ifs->id: " << ifs->id();
|
||||
return ret;
|
||||
}
|
||||
@@ -889,10 +889,10 @@ Core::FunctionReplyObject HandlerMineArea::mineAreaReferenceModifyRequest(const
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "--[mineAreaReferenceModifyRequest]- Modify/Create Mine with refAesItemId: ";
|
||||
Core::FunctionReplyObject ret;
|
||||
ObjectMineArea *ifs = getObjecMapByreferenceAesItemId(refRequest.referenceAesItemId());
|
||||
ObjectMineArea *ifs = getObjecMapByreferenceAesItemId(refRequest.referenceAesItemId);
|
||||
if (ifs == nullptr)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "--[mineAreaReferenceModifyRequest]- #### no Ref mine create one... refAesItemId: "<<refRequest.referenceAesItemId();
|
||||
DEBUG_LOG(m_logger) << "--[mineAreaReferenceModifyRequest]- #### no Ref mine create one... refAesItemId: "<<refRequest.referenceAesItemId;
|
||||
return mineAreaReferenceCreateRequest(refRequest);
|
||||
}
|
||||
|
||||
@@ -905,7 +905,7 @@ Core::FunctionReplyObject HandlerMineArea::mineAreaReferenceModifyRequest(const
|
||||
std::vector<Core::GeoPosition2D> vecGeoSegment;
|
||||
DEBUG_LOG(m_logger) << "--[mineAreaReferenceModifyRequest] create vector GeoPos from Mine data segments.. ";
|
||||
double newWidth = newData.width;
|
||||
ret = ifs->createGeoSegmentsFromMineData(newWidth, refRequest.mineData(), vecGeoSegment);
|
||||
ret = ifs->createGeoSegmentsFromMineData(newWidth, refRequest.mineData, vecGeoSegment);
|
||||
if (ret.error())
|
||||
return ret;
|
||||
|
||||
@@ -919,9 +919,9 @@ Core::FunctionReplyObject HandlerMineArea::mineAreaReferenceModifyRequest(const
|
||||
return ret;
|
||||
|
||||
// run update
|
||||
ret = ifs->updateObjectFromMineData(newData, vecGeoSegment, refRequest.mineData());
|
||||
ret = ifs->updateObjectFromMineData(newData, vecGeoSegment, refRequest.mineData);
|
||||
ifs->clearBuildings();
|
||||
DEBUG_LOG(m_logger) << "--[mineAreaReferenceModifyRequest] Mine Area Updated with MineData. AesItemId" << refRequest.referenceAesItemId()
|
||||
DEBUG_LOG(m_logger) << "--[mineAreaReferenceModifyRequest] Mine Area Updated with MineData. AesItemId" << refRequest.referenceAesItemId
|
||||
<< " // data.id: " << ifs->id();
|
||||
|
||||
return ret;
|
||||
@@ -929,7 +929,7 @@ Core::FunctionReplyObject HandlerMineArea::mineAreaReferenceModifyRequest(const
|
||||
|
||||
void HandlerMineArea::onMineAreaReferenceModifyRequest(const rti::core::SampleIdentity &cookie, const MineAreaReferenceModifyRequest &request)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << " onMineAreaReferenceModifyRequest: ADD MINE DATA with refAesItemId: " << request.referenceAesItemId();
|
||||
DEBUG_LOG(m_logger) << " onMineAreaReferenceModifyRequest: ADD MINE DATA with refAesItemId: " << request.referenceAesItemId;
|
||||
|
||||
const Core::FunctionReplyObject ret = mineAreaReferenceModifyRequest(request);
|
||||
if (ret.error())
|
||||
@@ -945,23 +945,23 @@ void HandlerMineArea::onMineAreaReferenceModifyRequest(const rti::core::SampleId
|
||||
*/
|
||||
bool HandlerMineArea::fillFromMineAreaReferenceRequest(const MineAreaReferenceModifyRequest &inReq, Database::AesMineArea &dbData)
|
||||
{
|
||||
if (inReq.mineData().empty())
|
||||
if (inReq.mineData.empty())
|
||||
return false;
|
||||
|
||||
const auto &mineData = std::min_element(inReq.mineData().begin(),
|
||||
inReq.mineData().end(),
|
||||
[](const MineData &first, const MineData &second) { return first.armingTime() < second.armingTime(); });
|
||||
const auto &mineData = std::min_element(inReq.mineData.begin(),
|
||||
inReq.mineData.end(),
|
||||
[](const MineData &first, const MineData &second) { return first.armingTime < second.armingTime; });
|
||||
|
||||
// get effect duration from chargeType properties
|
||||
const auto chargeType = m_mainHandler->dds()->pdmDtc()->chargeType(inReq.chargeTypeId());
|
||||
const QJsonObject chargeTypePropObj = QJsonDocument::fromJson(chargeType.properties().c_str()).object();
|
||||
const auto chargeType = m_mainHandler->dds()->pdmDtc()->chargeType(inReq.chargeTypeId);
|
||||
const QJsonObject chargeTypePropObj = QJsonDocument::fromJson(chargeType.properties.c_str()).object();
|
||||
|
||||
const qint64 effectStart = mineData->armingTime();
|
||||
const int effectDurationMsec = inReq.effectDurationMsec();
|
||||
auto effectCluster = m_mainHandler->effectClusterHandler()->getEffectClusterObj(inReq.referenceAesItemId()); // get partyId from effect cluster object
|
||||
const int effectDurationMsec = inReq.effectDurationMsec;
|
||||
auto effectCluster = m_mainHandler->effectClusterHandler()->getEffectClusterObj(inReq.referenceAesItemId); // get partyId from effect cluster object
|
||||
if (!effectCluster)
|
||||
{
|
||||
ERROR_LOG(m_logger) << " -- fillFromMineAreaReferenceRequest Unknown effect cluster id: " << inReq.referenceAesItemId();
|
||||
ERROR_LOG(m_logger) << " -- fillFromMineAreaReferenceRequest Unknown effect cluster id: " << inReq.referenceAesItemId;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -970,12 +970,12 @@ bool HandlerMineArea::fillFromMineAreaReferenceRequest(const MineAreaReferenceMo
|
||||
bool effectMarkingTa = false; // default
|
||||
bool isLaidHidden = false; // default
|
||||
bool isCenterLine = true; // default
|
||||
AreaEffectSimulation::AesMaLayingProcedureType layingProcedure = AreaEffectSimulation::AesMaLayingProcedureType_def::LptPioneer;
|
||||
AreaEffectSimulation::AesMaLayingProcedureType layingProcedure = AreaEffectSimulation::AesMaLayingProcedureType::LptPioneer;
|
||||
|
||||
// get effectDuration from effectorData
|
||||
int id = 0;
|
||||
QString name = QStringLiteral("%1 %2");
|
||||
ObjectMineArea *ifs = getObjecMapByreferenceAesItemId(inReq.referenceAesItemId());
|
||||
ObjectMineArea *ifs = getObjecMapByreferenceAesItemId(inReq.referenceAesItemId);
|
||||
if (ifs) // purpose is to get existing segments
|
||||
{
|
||||
id = ifs->id();
|
||||
@@ -990,7 +990,7 @@ bool HandlerMineArea::fillFromMineAreaReferenceRequest(const MineAreaReferenceMo
|
||||
else
|
||||
{
|
||||
const auto chargeEffectChargeType = m_mainHandler->dds()->pdmDtc()->chargeType(effectCluster->data().chargeTypeId);
|
||||
name = name.arg(QString::fromStdString(chargeEffectChargeType.shortName())).arg(effectCluster->name());
|
||||
name = name.arg(QString::fromStdString(chargeEffectChargeType.shortName)).arg(effectCluster->name());
|
||||
}
|
||||
|
||||
DEBUG_LOG(m_logger) << " Fill Mine from MineData effectCluster: id: " << effectCluster->data().id << " // effectClusterParty: " << effectCluster->data().partyId;
|
||||
@@ -1000,7 +1000,7 @@ bool HandlerMineArea::fillFromMineAreaReferenceRequest(const MineAreaReferenceMo
|
||||
dbData.effectDuration = effectDurationMsec;
|
||||
dbData.effectSourceId = effectCluster->data().effectSourceId;
|
||||
dbData.partyId = effectCluster->data().partyId;
|
||||
dbData.chargeTypeId = chargeType.id();
|
||||
dbData.chargeTypeId = chargeType.id;
|
||||
dbData.participantId = LtsUtils::toOptional(0);
|
||||
dbData.density = density;
|
||||
dbData.width = width;
|
||||
@@ -1062,7 +1062,7 @@ void HandlerMineArea::assignMinesFromNullArea(int aesId)
|
||||
|
||||
void HandlerMineArea::onMinelayerPositionChanged(const TrainingAreaBase::MinelayerTrailerPosition &data, DataModification modType)
|
||||
{
|
||||
if (data.sampleTime() + 5000 < QDateTime::currentMSecsSinceEpoch())
|
||||
if (data.sampleTime + 5000 < QDateTime::currentMSecsSinceEpoch())
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "ignore old layer data";
|
||||
return;
|
||||
@@ -1070,41 +1070,41 @@ void HandlerMineArea::onMinelayerPositionChanged(const TrainingAreaBase::Minelay
|
||||
if (modType == DataModification::eRemoved)
|
||||
return;
|
||||
|
||||
DEBUG_LOG(m_logger) << "lat: " << data.position().lat() << ", lon: " << data.position().lon();
|
||||
auto utm = LtsCoordTrans::UtmCoordinate::fromGeographic(data.position().lon(), data.position().lat());
|
||||
DEBUG_LOG(m_logger) << "lat: " << data.position.lat << ", lon: " << data.position.lon;
|
||||
auto utm = LtsCoordTrans::UtmCoordinate::fromGeographic(data.position.lon, data.position.lat);
|
||||
QPointF position(utm.x, utm.y);
|
||||
QPointF positionGeo(data.position().lon(), data.position().lat());
|
||||
m_zoneMap.insert(data.equipmentNumber(), utm.zone);
|
||||
QPointF positionGeo(data.position.lon, data.position.lat);
|
||||
m_zoneMap.insert(data.equipmentNumber, utm.zone);
|
||||
|
||||
DEBUG_LOG(m_logger) << "data." << data.equipmentNumber() << ", position: " << utm.mgrs();
|
||||
DEBUG_LOG(m_logger) << "data." << data.equipmentNumber << ", position: " << utm.mgrs();
|
||||
|
||||
if (m_timerMap.contains(data.equipmentNumber()))
|
||||
if (m_timerMap.contains(data.equipmentNumber))
|
||||
{
|
||||
QTimer *timer = m_timerMap.value(data.equipmentNumber());
|
||||
QTimer *timer = m_timerMap.value(data.equipmentNumber);
|
||||
if (timer->isActive())
|
||||
{
|
||||
// Save Positions as QPolygon -> Vector not Map
|
||||
QPolygonF pointsUtm = m_dusMinePosMapUtm.value(data.equipmentNumber());
|
||||
QPolygonF pointsUtm = m_dusMinePosMapUtm.value(data.equipmentNumber);
|
||||
pointsUtm.append(position);
|
||||
m_dusMinePosMapUtm.insert(data.equipmentNumber(), pointsUtm);
|
||||
m_dusMinePosMapUtm.insert(data.equipmentNumber, pointsUtm);
|
||||
|
||||
// Save Positions as QPolygon -> Vector not Map
|
||||
QPolygonF pointsGeo = m_dusMinePosMapGeo.value(data.equipmentNumber());
|
||||
QPolygonF pointsGeo = m_dusMinePosMapGeo.value(data.equipmentNumber);
|
||||
pointsGeo.append(positionGeo);
|
||||
m_dusMinePosMapGeo.insert(data.equipmentNumber(), pointsGeo);
|
||||
m_dusMinePosMapGeo.insert(data.equipmentNumber, pointsGeo);
|
||||
// m_dusMinePosMapUtm.insert(data.equipmentNumber(), position);
|
||||
// m_dusMinePosMapGeo.insert(data.equipmentNumber(), positionGeo);
|
||||
timer->start();
|
||||
DEBUG_LOG(m_logger) << "Timer restart for equipNo: " << data.equipmentNumber();
|
||||
DEBUG_LOG(m_logger) << "Timer restart for equipNo: " << data.equipmentNumber;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Start Timer for equipNo: " << data.equipmentNumber();
|
||||
DEBUG_LOG(m_logger) << "Start Timer for equipNo: " << data.equipmentNumber;
|
||||
QTimer *timer = new QTimer(this);
|
||||
timer->setInterval(s_mineAreaCreationInterval);
|
||||
int equipNo = data.equipmentNumber();
|
||||
int chargeTypeId = data.chargeTypeId();
|
||||
int equipNo = data.equipmentNumber;
|
||||
int chargeTypeId = data.chargeTypeId;
|
||||
connect(timer,
|
||||
&QTimer::timeout,
|
||||
this,
|
||||
@@ -1115,11 +1115,11 @@ void HandlerMineArea::onMinelayerPositionChanged(const TrainingAreaBase::Minelay
|
||||
});
|
||||
QPolygonF pointUtm;
|
||||
pointUtm.append(position);
|
||||
m_dusMinePosMapUtm.insert(data.equipmentNumber(), pointUtm);
|
||||
m_dusMinePosMapUtm.insert(data.equipmentNumber, pointUtm);
|
||||
|
||||
QPolygonF pointGeo;
|
||||
pointGeo.append(positionGeo);
|
||||
m_dusMinePosMapGeo.insert(data.equipmentNumber(), pointGeo);
|
||||
m_dusMinePosMapGeo.insert(data.equipmentNumber, pointGeo);
|
||||
|
||||
// m_dusMinePosMapUtm.insert(data.equipmentNumber(), position);
|
||||
// m_dusMinePosMapGeo.insert(data.equipmentNumber(), positionGeo);
|
||||
@@ -1127,21 +1127,21 @@ void HandlerMineArea::onMinelayerPositionChanged(const TrainingAreaBase::Minelay
|
||||
m_timerMap.insert(equipNo, timer);
|
||||
}
|
||||
|
||||
int dusSerialNo = data.dusSerialNo();
|
||||
int dusSerialNo = data.dusSerialNo;
|
||||
// DusMines with serialNo 0 should get a new serialNo ( > 70000), too
|
||||
// NOTE: igniterType/IgniterFunciton = 0 as long as MinelayerTrailerPosition does not contain values
|
||||
if (isConcreteMine(data.chargeTypeId(), 0, 0) || (isDusMineArea(data.chargeTypeId(), 0, 0) && dusSerialNo == 0))
|
||||
if (isConcreteMine(data.chargeTypeId, 0, 0) || (isDusMineArea(data.chargeTypeId, 0, 0) && dusSerialNo == 0))
|
||||
dusSerialNo = ++s_startPzAbwWMiCCount;
|
||||
else
|
||||
{
|
||||
if (data.dusSerialNo() != 0 && removeDuplicateMine(data.dusSerialNo()))
|
||||
INFO_LOG(m_logger) << "Existing mine with serialNo: " << data.dusSerialNo() << " removed";
|
||||
if (data.dusSerialNo != 0 && removeDuplicateMine(data.dusSerialNo))
|
||||
INFO_LOG(m_logger) << "Existing mine with serialNo: " << data.dusSerialNo << " removed";
|
||||
}
|
||||
|
||||
DEBUG_LOG(m_logger) << "dusSerialNo: " << dusSerialNo;
|
||||
DEBUG_LOG(m_logger) << "isConcrete: " << isConcreteMine(data.chargeTypeId(), 0, 0);
|
||||
DEBUG_LOG(m_logger) << "isConcrete: " << isConcreteMine(data.chargeTypeId, 0, 0);
|
||||
|
||||
m_nullArea->triggerMine(dusSerialNo, false, data.chargeTypeId(), {data.position().lon(), data.position().lat()});
|
||||
m_nullArea->triggerMine(dusSerialNo, false, data.chargeTypeId, {data.position.lon, data.position.lat});
|
||||
}
|
||||
|
||||
void HandlerMineArea::onTimeoutEquipNo(int equipNo, int chargeTypeId)
|
||||
@@ -1166,28 +1166,28 @@ void HandlerMineArea::onTimeoutEquipNo(int equipNo, int chargeTypeId)
|
||||
// QPolygonF boundingBox = msGetBoundingBoxPolygon(points, &width);
|
||||
|
||||
MineAreaModifyRequest req;
|
||||
req.chargeStruct().chargeTypeId(chargeTypeId);
|
||||
req.density(0.7);
|
||||
req.distance(0.5);
|
||||
DEBUG_LOG(m_logger) << "density1: " << req.density();
|
||||
req.effectDuration(0);
|
||||
req.effectStart(QDateTime::currentMSecsSinceEpoch() + Settings::getMineAreaByMiVSysEffectStart());
|
||||
req.isCenterLine(true);
|
||||
req.isLaidHidden(false);
|
||||
req.layingProcedureType(AesMaLayingProcedureType_def::LptPioneer);
|
||||
req.chargeStruct.chargeTypeId = chargeTypeId;
|
||||
req.density = 0.7;
|
||||
req.distance = 0.5;
|
||||
DEBUG_LOG(m_logger) << "density1: " << req.density;
|
||||
req.effectDuration = 0;
|
||||
req.effectStart = QDateTime::currentMSecsSinceEpoch() + Settings::getMineAreaByMiVSysEffectStart();
|
||||
req.isCenterLine = true;
|
||||
req.isLaidHidden = false;
|
||||
req.layingProcedureType = AesMaLayingProcedureType::LptPioneer;
|
||||
QString name = QString::number(equipNo);
|
||||
req.name(name.toStdString());
|
||||
req.name = name.toStdString();
|
||||
int participantID = m_mainHandler->dds()->ppmDtc()->participantIdByEquipmentNumber(equipNo);
|
||||
req.partyId(m_mainHandler->dds()->ppmDtc()->participant(participantID).partyId());
|
||||
req.width(0);
|
||||
req.partyId = m_mainHandler->dds()->ppmDtc()->participant(participantID).partyId;
|
||||
req.width = 0;
|
||||
|
||||
std::vector<Core::GeoPosition2D> vec;
|
||||
vec.reserve(points.size());
|
||||
for (QPointF bbPoint : qAsConst(points))
|
||||
{
|
||||
Core::GeoPosition2D pos;
|
||||
pos.lon(bbPoint.x());
|
||||
pos.lat(bbPoint.y());
|
||||
pos.lon = bbPoint.x();
|
||||
pos.lat = bbPoint.y();
|
||||
|
||||
vec.push_back(pos);
|
||||
}
|
||||
@@ -1205,13 +1205,13 @@ void HandlerMineArea::onTimeoutEquipNo(int equipNo, int chargeTypeId)
|
||||
// pos.lat(point.y());
|
||||
// vec.push_back(pos);
|
||||
// }
|
||||
req.segments(vec);
|
||||
req.segments = vec;
|
||||
|
||||
// Cannot create a minefield with only one segment => create two new segments with 10m distance
|
||||
if (req.segments().size() < 2)
|
||||
if (req.segments.size() < 2)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "only one segment - create 2 new with distance 10m";
|
||||
const LtsCoordTrans::UtmCoordinate pointUtm = LtsCoordTrans::UtmCoordinate::fromGeographic(vec[0].lon(), vec[0].lat());
|
||||
const LtsCoordTrans::UtmCoordinate pointUtm = LtsCoordTrans::UtmCoordinate::fromGeographic(vec[0].lon, vec[0].lat);
|
||||
LtsCoordTrans::UtmCoordinate point1Utm = pointUtm;
|
||||
LtsCoordTrans::UtmCoordinate point2Utm = pointUtm;
|
||||
point1Utm.y = pointUtm.y - 5.0;
|
||||
@@ -1223,11 +1223,11 @@ void HandlerMineArea::onTimeoutEquipNo(int equipNo, int chargeTypeId)
|
||||
Core::GeoPosition2D pos(point.x(), point.y());
|
||||
vec.push_back(pos);
|
||||
point = point2Utm.geographic();
|
||||
pos.lon(point.x());
|
||||
pos.lat(point.y());
|
||||
pos.lon = point.x();
|
||||
pos.lat = point.y();
|
||||
vec.push_back(pos);
|
||||
req.segments(vec);
|
||||
req.distance(10.0);
|
||||
req.segments = vec;
|
||||
req.distance = 10.0;
|
||||
}
|
||||
|
||||
Core::FunctionReplyObject reply = mineAreaCreateRequest(req);
|
||||
@@ -1247,8 +1247,8 @@ bool HandlerMineArea::checkIfNullMineIsInArea(const std::vector<Core::GeoPositio
|
||||
for (unsigned int i = 0; i < segments.size() - 1; i++)
|
||||
{
|
||||
Database::AesMineAreaSegment dataSeg;
|
||||
dataSeg.startPosition = QPointF(segments[i].lon(), segments[i].lat());
|
||||
dataSeg.endPosition = QPointF(segments[i + 1].lon(), segments[i + 1].lat());
|
||||
dataSeg.startPosition = QPointF(segments[i].lon, segments[i].lat);
|
||||
dataSeg.endPosition = QPointF(segments[i + 1].lon, segments[i + 1].lat);
|
||||
vecSeg.append(dataSeg);
|
||||
}
|
||||
|
||||
@@ -1262,8 +1262,8 @@ bool HandlerMineArea::checkIfNullMineIsInArea(const std::vector<AreaEffectSimula
|
||||
for (const AreaEffectSimulation::MineSegment &seg : qAsConst(segments))
|
||||
{
|
||||
Database::AesMineAreaSegment dbSeg;
|
||||
dbSeg.startPosition = QPointF(seg.positionStart().lon(), seg.positionStart().lat());
|
||||
dbSeg.endPosition = QPointF(seg.positionEnd().lon(), seg.positionEnd().lat());
|
||||
dbSeg.startPosition = QPointF(seg.positionStart.lon, seg.positionStart.lat);
|
||||
dbSeg.endPosition = QPointF(seg.positionEnd.lon, seg.positionEnd.lat);
|
||||
vecSeg.append(dbSeg);
|
||||
}
|
||||
|
||||
@@ -1443,7 +1443,7 @@ QPolygonF HandlerMineArea::msGetBoundingBoxPolygon(const QPolygonF &minen, doubl
|
||||
|
||||
bool HandlerMineArea::triggerUnpairedMine(const MineTriggeredRequest &request)
|
||||
{
|
||||
if (!request.position().is_set())
|
||||
if (!request.position.is_set())
|
||||
{
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " failed, because there is no position.";
|
||||
|
||||
@@ -1451,7 +1451,7 @@ bool HandlerMineArea::triggerUnpairedMine(const MineTriggeredRequest &request)
|
||||
}
|
||||
|
||||
qint32 halfLookupDistance = Settings::getUnpairedMinesLookupRange() / 2;
|
||||
LtsCoordTrans::UtmCoordinate mineUtmPos = LtsCoordTrans::UtmCoordinate::fromGeographic(request.position().get().lon(), request.position().get().lat());
|
||||
LtsCoordTrans::UtmCoordinate mineUtmPos = LtsCoordTrans::UtmCoordinate::fromGeographic(request.position.get().lon, request.position.get().lat);
|
||||
QPointF lookupTopLeft = mineUtmPos.geographic(-halfLookupDistance, -halfLookupDistance);
|
||||
QPointF lookupBottomRight = mineUtmPos.geographic(halfLookupDistance, halfLookupDistance);
|
||||
QRectF lookupRect = QRectF(lookupTopLeft, lookupBottomRight);
|
||||
@@ -1469,8 +1469,8 @@ bool HandlerMineArea::triggerUnpairedMine(const MineTriggeredRequest &request)
|
||||
|
||||
for (const Database::AesMineAreaTriggeredMines ¤tMine : unpairedMines)
|
||||
{
|
||||
positionPoint.setX(request.position().get().lon());
|
||||
positionPoint.setY(request.position().get().lat());
|
||||
positionPoint.setX(request.position.get().lon);
|
||||
positionPoint.setY(request.position.get().lat);
|
||||
|
||||
qreal currentDistance = LtsCoordTrans::distance(positionPoint, currentMine.position);
|
||||
|
||||
@@ -1493,7 +1493,7 @@ bool HandlerMineArea::triggerUnpairedMine(const MineTriggeredRequest &request)
|
||||
ObjectMineArea *ifs = m_objectMap.value(nearestMine.mineAreaId);
|
||||
qint32 oldMineId = nearestMine.mineId;
|
||||
|
||||
nearestMine.mineId = request.mineId();
|
||||
nearestMine.mineId = request.mineId;
|
||||
nearestMine.isTriggered = true;
|
||||
|
||||
ifs->updateMineByOldMineId(nearestMine, oldMineId);
|
||||
|
||||
+38
-38
@@ -13,7 +13,7 @@
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
HandlerMineCorridor::HandlerMineCorridor(MainHandler *mainHandler)
|
||||
: HandlerBaseTmpl<ObjectMineCorridor>(mainHandler, QStringLiteral("MineCorridor"), s_areaCount[AesType::AtMineCorridor], s_areaCountCentral[AesType::AtMineCorridor])
|
||||
: HandlerBaseTmpl<ObjectMineCorridor>(mainHandler, QStringLiteral("MineCorridor"), s_areaCount[static_cast<int>(AesType::AtMineCorridor)], s_areaCountCentral[static_cast<int>(AesType::AtMineCorridor)])
|
||||
, Interface::Fts::MineCorridorModifyRequestHandler(mainHandler->dds()->fts())
|
||||
, Interface::Fts::MineCorridorRemoveRequestHandler(mainHandler->dds()->fts())
|
||||
{}
|
||||
@@ -87,13 +87,13 @@ void HandlerMineCorridor::onSpecialSensorDataChanged(const TrainingAreaBase::Spe
|
||||
|
||||
if (mod == DataModification::eRemoved)
|
||||
return;
|
||||
if (data.operationalState() != MRF_MARSCH && data.operationalState() != MRF_RAEUMEN)
|
||||
if (data.operationalState != MRF_MARSCH && data.operationalState != MRF_RAEUMEN)
|
||||
return;
|
||||
DEBUG_LOG(m_logger) << "onSpecialSensorDataChanged: " << data;
|
||||
if (data.operationalState() == MRF_RAEUMEN)
|
||||
if (data.operationalState == MRF_RAEUMEN)
|
||||
{
|
||||
auto it = m_corridorCreators.constFind(data.equipmentNumber());
|
||||
if (data.position().is_set())
|
||||
auto it = m_corridorCreators.constFind(data.equipmentNumber);
|
||||
if (data.position.is_set())
|
||||
{
|
||||
MineCorridorCreator *mcc = nullptr;
|
||||
if (it == m_corridorCreators.constEnd())
|
||||
@@ -105,7 +105,7 @@ void HandlerMineCorridor::onSpecialSensorDataChanged(const TrainingAreaBase::Spe
|
||||
|
||||
Database::AesMineCorridor newData;
|
||||
|
||||
newData.name = QStringLiteral("MRF_%1").arg(data.equipmentNumber());
|
||||
newData.name = QStringLiteral("MRF_%1").arg(data.equipmentNumber);
|
||||
newData.effectStart = QDateTime::currentDateTime();
|
||||
newData.chargeTypeId = 315; // Mine Corridor Dummy
|
||||
newData.width = 5; // TODO: really?
|
||||
@@ -113,10 +113,10 @@ void HandlerMineCorridor::onSpecialSensorDataChanged(const TrainingAreaBase::Spe
|
||||
ifs->createObject(newData, std::vector<Core::GeoPosition2D>());
|
||||
m_objectMap.insert(ifs->id(), ifs);
|
||||
|
||||
mcc = new MineCorridorCreator(data.equipmentNumber(), ifs);
|
||||
m_corridorCreators[data.equipmentNumber()] = mcc;
|
||||
mcc = new MineCorridorCreator(data.equipmentNumber, ifs);
|
||||
m_corridorCreators[data.equipmentNumber] = mcc;
|
||||
TrainingAreaBase::SpecialSensorData stopTele(data);
|
||||
stopTele.operationalState(MRF_MARSCH);
|
||||
stopTele.operationalState = MRF_MARSCH;
|
||||
auto timeoutCb = [this, stopTele]()
|
||||
{
|
||||
onSpecialSensorDataChanged(stopTele, DataModification::eModified);
|
||||
@@ -125,14 +125,14 @@ void HandlerMineCorridor::onSpecialSensorDataChanged(const TrainingAreaBase::Spe
|
||||
}
|
||||
else
|
||||
mcc = it.value();
|
||||
mcc->addPosition(data.position().get(), data.sampleTime());
|
||||
mcc->addPosition(data.position.get(), data.sampleTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
// start a new corridor
|
||||
if (it != m_corridorCreators.constEnd())
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Starting a new mine corridor but the last one was not closed...: " << data.equipmentNumber();
|
||||
WARNING_LOG(m_logger) << "Starting a new mine corridor but the last one was not closed...: " << data.equipmentNumber;
|
||||
it.value()->creationFinished();
|
||||
delete it.value();
|
||||
m_corridorCreators.erase(it);
|
||||
@@ -141,10 +141,10 @@ void HandlerMineCorridor::onSpecialSensorDataChanged(const TrainingAreaBase::Spe
|
||||
}
|
||||
else
|
||||
{
|
||||
auto it = m_corridorCreators.constFind(data.equipmentNumber());
|
||||
auto it = m_corridorCreators.constFind(data.equipmentNumber);
|
||||
if (it == m_corridorCreators.constEnd())
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Finishing a mine corridor but no data available...: " << data.equipmentNumber();
|
||||
WARNING_LOG(m_logger) << "Finishing a mine corridor but no data available...: " << data.equipmentNumber;
|
||||
return;
|
||||
}
|
||||
it.value()->creationFinished();
|
||||
@@ -158,7 +158,7 @@ void HandlerMineCorridor::onMineCorridorModifyRequest(const rti::core::SampleIde
|
||||
const MineCorridorModifyRequest &request)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onMineCorridorModifyRequest: " << request;
|
||||
Core::FunctionReplyObject ret = request.id() > 0 ? mineCorridorModifyRequest(request) : mineCorridorCreateRequest(request);
|
||||
Core::FunctionReplyObject ret = request.id > 0 ? mineCorridorModifyRequest(request) : mineCorridorCreateRequest(request);
|
||||
if (ret.error())
|
||||
WARNING_LOG(m_logger) << ret();
|
||||
m_mainHandler->dds()->fts()->mineCorridorModifyReply(cookie, ret);
|
||||
@@ -168,20 +168,20 @@ Core::FunctionReplyObject HandlerMineCorridor::mineCorridorCreateRequest(const M
|
||||
{
|
||||
Database::AesMineCorridor newData;
|
||||
|
||||
newData.name = QString::fromStdString(request.name());
|
||||
newData.effectStart = request.effectStart().is_set() && request.effectStart().get() > 0 ? QDateTime::fromMSecsSinceEpoch(request.effectStart().get()) : QDateTime();
|
||||
newData.name = QString::fromStdString(request.name);
|
||||
newData.effectStart = request.effectStart.is_set() && request.effectStart.get() > 0 ? QDateTime::fromMSecsSinceEpoch(request.effectStart.get()) : QDateTime();
|
||||
newData.chargeTypeId = 315;
|
||||
newData.effectDuration = request.effectDuration();
|
||||
newData.effectSourceId = request.effectSourceId();
|
||||
newData.partyId = request.partyId().is_set() ? request.partyId().get() : 0;
|
||||
newData.participantId = request.participantId().is_set() ? request.participantId().get() : 0;
|
||||
newData.width = request.width();
|
||||
newData.externalId = request.externalId().is_set() ? request.externalId().get() : 0;
|
||||
newData.effectDuration = request.effectDuration;
|
||||
newData.effectSourceId = request.effectSourceId;
|
||||
newData.partyId = request.partyId.is_set() ? request.partyId.get() : 0;
|
||||
newData.participantId = request.participantId.is_set() ? request.participantId.get() : 0;
|
||||
newData.width = request.width;
|
||||
newData.externalId = request.externalId.is_set() ? request.externalId.get() : 0;
|
||||
|
||||
ObjectMineCorridor *ifs(new ObjectMineCorridor(m_mainHandler, this));
|
||||
|
||||
Core::FunctionReplyObject ret = ifs->createObject(newData,
|
||||
request.segments());
|
||||
request.segments);
|
||||
if (ret.error())
|
||||
{
|
||||
delete ifs;
|
||||
@@ -200,39 +200,39 @@ Core::FunctionReplyObject HandlerMineCorridor::mineCorridorModifyRequest(const M
|
||||
|
||||
Core::FunctionReplyObject ret;
|
||||
ObjectMineCorridor *ifs = nullptr;
|
||||
if (request.externalId().is_set() && request.externalId().get() > 0)
|
||||
ifs = getObjectFromMapByExternalId(m_objectMap, request.externalId().get(), ret);
|
||||
if (request.externalId.is_set() && request.externalId.get() > 0)
|
||||
ifs = getObjectFromMapByExternalId(m_objectMap, request.externalId.get(), ret);
|
||||
|
||||
if (!ifs)
|
||||
{
|
||||
if (request.id() == 0 || ((request.id() < 0) && !getObjectFromMap(m_objectMap, std::abs(request.id()), ret)))
|
||||
if (request.id == 0 || ((request.id < 0) && !getObjectFromMap(m_objectMap, std::abs(request.id), ret)))
|
||||
return mineCorridorCreateRequest(request);
|
||||
|
||||
ifs = getObjectFromMap(m_objectMap, std::abs(request.id()), ret);
|
||||
ifs = getObjectFromMap(m_objectMap, std::abs(request.id), ret);
|
||||
|
||||
if (!ifs)
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (request.effectStart().is_set() && (request.effectStart().get() + request.effectDuration() < m_mainHandler->dds()->currentPartitionTime().toMSecsSinceEpoch()))
|
||||
if (request.effectStart.is_set() && (request.effectStart.get() + request.effectDuration < m_mainHandler->dds()->currentPartitionTime().toMSecsSinceEpoch()))
|
||||
return removeObject(ifs);
|
||||
|
||||
Database::AesMineCorridor newData(ifs->data());
|
||||
newData.id = request.id();
|
||||
newData.name = QString::fromStdString(request.name());
|
||||
newData.effectStart = request.effectStart().is_set() && request.effectStart().get() > 0 ? QDateTime::fromMSecsSinceEpoch(request.effectStart().get()) : QDateTime();
|
||||
newData.id = request.id;
|
||||
newData.name = QString::fromStdString(request.name);
|
||||
newData.effectStart = request.effectStart.is_set() && request.effectStart.get() > 0 ? QDateTime::fromMSecsSinceEpoch(request.effectStart.get()) : QDateTime();
|
||||
newData.chargeTypeId = 315;
|
||||
newData.effectDuration = request.effectDuration();
|
||||
newData.partyId = request.partyId().is_set() ? request.partyId().get() : 0;
|
||||
newData.participantId = request.participantId().is_set() ? request.participantId().get() : 0;
|
||||
newData.width = request.width();
|
||||
newData.externalId = request.externalId().is_set() ? request.externalId().get() : 0;
|
||||
if (request.id() < 0 && checkStateForSfm(ifs))
|
||||
newData.effectDuration = request.effectDuration;
|
||||
newData.partyId = request.partyId.is_set() ? request.partyId.get() : 0;
|
||||
newData.participantId = request.participantId.is_set() ? request.participantId.get() : 0;
|
||||
newData.width = request.width;
|
||||
newData.externalId = request.externalId.is_set() ? request.externalId.get() : 0;
|
||||
if (request.id < 0 && checkStateForSfm(ifs))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Overwrite mine corridor Effect State for OC";
|
||||
newData.effectStateId = AesEffectState::EsPrepared;
|
||||
}
|
||||
return ifs->updateObject(newData, request.segments());
|
||||
return ifs->updateObject(newData, request.segments);
|
||||
}
|
||||
|
||||
void HandlerMineCorridor::onMineCorridorRemoveRequest(const rti::core::SampleIdentity &cookie,
|
||||
|
||||
+39
-39
@@ -15,7 +15,7 @@ namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
HandlerNContamination::HandlerNContamination(MainHandler *mainHandler)
|
||||
: HandlerBaseTmpl<ObjectNContamination>(mainHandler, QStringLiteral("NContamination"), s_areaCount[AesType::AtNContamination], s_areaCountCentral[AesType::AtNContamination])
|
||||
: HandlerBaseTmpl<ObjectNContamination>(mainHandler, QStringLiteral("NContamination"), s_areaCount[static_cast<int>(AesType::AtNContamination)], s_areaCountCentral[static_cast<int>(AesType::AtNContamination)])
|
||||
, Interface::Fts::NContaminationModifyRequestHandler(mainHandler->dds()->fts())
|
||||
, Interface::Fts::NContaminationRemoveRequestHandler(mainHandler->dds()->fts())
|
||||
{}
|
||||
@@ -48,7 +48,7 @@ bool HandlerNContamination::init()
|
||||
}
|
||||
if(!ifs->data().isCentral)
|
||||
{
|
||||
if (totalAreas() >= (s_maxActiveAreas[AesType::AtBCContamination] + s_maxActiveAreas[AesType::AtNContamination]))
|
||||
if (totalAreas() >= (s_maxActiveAreas[static_cast<int>(AesType::AtBCContamination)] + s_maxActiveAreas[static_cast<int>(AesType::AtNContamination)]))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "More active n contaminations in database than allowed - ignoring the rest!";
|
||||
ifs->removeObject();
|
||||
@@ -58,7 +58,7 @@ bool HandlerNContamination::init()
|
||||
}
|
||||
else
|
||||
{
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[AesType::AtBCContamination] + s_maxActiveAreasCentral[AesType::AtNContamination]))
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[static_cast<int>(AesType::AtBCContamination)] + s_maxActiveAreasCentral[static_cast<int>(AesType::AtNContamination)]))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "More active n contaminations in database than allowed - ignoring the rest!";
|
||||
ifs->removeObject();
|
||||
@@ -89,18 +89,18 @@ bool HandlerNContamination::init()
|
||||
|
||||
int HandlerNContamination::totalAreas() const
|
||||
{
|
||||
return s_areaCount[AesType::AtBCContamination] + s_areaCount[AesType::AtNContamination];
|
||||
return s_areaCount[static_cast<int>(AesType::AtBCContamination)] + s_areaCount[static_cast<int>(AesType::AtNContamination)];
|
||||
}
|
||||
|
||||
int HandlerNContamination::totalAreasCentral() const
|
||||
{
|
||||
return s_areaCountCentral[AesType::AtBCContamination] + s_areaCountCentral[AesType::AtNContamination];
|
||||
return s_areaCountCentral[static_cast<int>(AesType::AtBCContamination)] + s_areaCountCentral[static_cast<int>(AesType::AtNContamination)];
|
||||
}
|
||||
|
||||
void HandlerNContamination::onChangedToCentral()
|
||||
{
|
||||
s_areaCount[AesType::AtNContamination]--;
|
||||
s_areaCountCentral[AesType::AtNContamination]++;
|
||||
s_areaCount[static_cast<int>(AesType::AtNContamination)]--;
|
||||
s_areaCountCentral[static_cast<int>(AesType::AtNContamination)]++;
|
||||
|
||||
DEBUG_LOG(m_logger) << "m_areaCount after Recount = " << m_areaCount;
|
||||
DEBUG_LOG(m_logger) << "m_areaCountCentral after Recount = " << m_areaCountCentral;
|
||||
@@ -110,25 +110,25 @@ void HandlerNContamination::onChangedToCentral()
|
||||
|
||||
static void fillData(const NContaminationModifyRequest &src, Database::AesNContamination &dst)
|
||||
{
|
||||
if (src.id() < 0) // is the id given as negative? set id -> used by OC-Laptop
|
||||
dst.id = src.id();
|
||||
if (src.id < 0) // is the id given as negative? set id -> used by OC-Laptop
|
||||
dst.id = src.id;
|
||||
|
||||
dst.name = QString::fromStdString(src.name());
|
||||
dst.effectStart = src.effectStart().is_set() && src.effectStart().get() > 0 ? QDateTime::fromMSecsSinceEpoch(src.effectStart().get()) : QDateTime();
|
||||
dst.effectDuration = src.effectDuration();
|
||||
dst.impactPosition.rx() = src.impactPosition().lon();
|
||||
dst.impactPosition.ry() = src.impactPosition().lat();
|
||||
dst.impactRadius = src.impactRadius();
|
||||
dst.borderLengthInner = src.borderLengthInner();
|
||||
dst.borderLengthOuter = src.borderLengthOuter();
|
||||
dst.spanAngle = src.spanAngle();
|
||||
dst.rotationAngle = src.rotationAngle();
|
||||
dst.detonationValue = src.detonationValue();
|
||||
dst.partyId = src.partyId().is_set() ? src.partyId().get() : 0;
|
||||
dst.chargeTypeId = src.chargeTypeId();
|
||||
dst.participantId = src.participantId().is_set() ? src.participantId().get() : 0;
|
||||
dst.externalId = src.externalId().is_set() ? src.externalId().get() : 0;
|
||||
dst.weatherSourceId = src.weatherSource();
|
||||
dst.name = QString::fromStdString(src.name);
|
||||
dst.effectStart = src.effectStart.is_set() && src.effectStart.get() > 0 ? QDateTime::fromMSecsSinceEpoch(src.effectStart.get()) : QDateTime();
|
||||
dst.effectDuration = src.effectDuration;
|
||||
dst.impactPosition.rx() = src.impactPosition.lon;
|
||||
dst.impactPosition.ry() = src.impactPosition.lat;
|
||||
dst.impactRadius = src.impactRadius;
|
||||
dst.borderLengthInner = src.borderLengthInner;
|
||||
dst.borderLengthOuter = src.borderLengthOuter;
|
||||
dst.spanAngle = src.spanAngle;
|
||||
dst.rotationAngle = src.rotationAngle;
|
||||
dst.detonationValue = src.detonationValue;
|
||||
dst.partyId = src.partyId.is_set() ? src.partyId.get() : 0;
|
||||
dst.chargeTypeId = src.chargeTypeId;
|
||||
dst.participantId = src.participantId.is_set() ? src.participantId.get() : 0;
|
||||
dst.externalId = src.externalId.is_set() ? src.externalId.get() : 0;
|
||||
dst.weatherSourceId = src.weatherSource;
|
||||
}
|
||||
|
||||
void HandlerNContamination::onNContaminationModifyRequest(const rti::core::SampleIdentity &cookie,
|
||||
@@ -162,7 +162,7 @@ Core::FunctionReplyObject HandlerNContamination::nContaminationCreateRequest(con
|
||||
|
||||
if (ifs->data().isCentral)
|
||||
{
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[AesType::AtNContamination] + s_maxActiveAreasCentral[AesType::AtBCContamination]) && request.effectStart().is_set())
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[static_cast<int>(AesType::AtNContamination)] + s_maxActiveAreasCentral[static_cast<int>(AesType::AtBCContamination)]) && request.effectStart.is_set())
|
||||
{
|
||||
ifs->removeObject(); //Not finally deleted from db after this,Fallback if DB deletion is not working correct
|
||||
ifs->removeObjectFromDb();
|
||||
@@ -172,7 +172,7 @@ Core::FunctionReplyObject HandlerNContamination::nContaminationCreateRequest(con
|
||||
}
|
||||
else
|
||||
{
|
||||
if (totalAreas() >= (s_maxActiveAreas[AesType::AtNContamination] + s_maxActiveAreas[AesType::AtBCContamination]) && request.effectStart().is_set())
|
||||
if (totalAreas() >= (s_maxActiveAreas[static_cast<int>(AesType::AtNContamination)] + s_maxActiveAreas[static_cast<int>(AesType::AtBCContamination)]) && request.effectStart.is_set())
|
||||
{
|
||||
ifs->removeObject(); //Not finally deleted from db after this,Fallback if DB deletion is not working correct
|
||||
ifs->removeObjectFromDb();
|
||||
@@ -202,16 +202,16 @@ Core::FunctionReplyObject HandlerNContamination::nContaminationCreateRequest(con
|
||||
Core::FunctionReplyObject HandlerNContamination::nContaminationModifyRequest(const NContaminationModifyRequest &request)
|
||||
{
|
||||
Core::FunctionReplyObject ret;
|
||||
if (request.id() == 0 || ((request.id() < 0) && !getObjectFromMap(m_objectMap, std::abs(request.id()), ret)))
|
||||
if (request.id == 0 || ((request.id < 0) && !getObjectFromMap(m_objectMap, std::abs(request.id), ret)))
|
||||
return nContaminationCreateRequest(request);
|
||||
|
||||
ObjectNContamination *ifs = getObjectFromMap(m_objectMap, std::abs(request.id()), ret);
|
||||
ObjectNContamination *ifs = getObjectFromMap(m_objectMap, std::abs(request.id), ret);
|
||||
if (!ifs)
|
||||
return ret;
|
||||
|
||||
// Anzahl aktiver Areas ist erreicht, der Wirkbeginn ist (soll) gesetzt sein, aber die Area war
|
||||
// vorher noch ohne Wirkbeginn
|
||||
// if (totalAreas() >= (s_maxActiveAreas[AesType::AtBCContamination] + s_maxActiveAreas[AesType::AtNContamination]) && request.effectStart().is_set() && !ifs->isObjectModifiable())
|
||||
// if (totalAreas() >= (s_maxActiveAreas[AesType::AtBCContamination] + s_maxActiveAreas[AesType::AtNContamination]) && request.effectStart.is_set() && !ifs->isObjectModifiable())
|
||||
// return Core::FunctionReplyObject(request.id(), tr_lts("dds", "Too many active N contamination areas."));
|
||||
|
||||
Database::AesNContamination aea(ifs->data());
|
||||
@@ -228,25 +228,25 @@ Core::FunctionReplyObject HandlerNContamination::nContaminationModifyRequest(con
|
||||
/*!
|
||||
* If the effect start added after creation, the max amount need to be checked
|
||||
*/
|
||||
if(!ifs->isActivationTimeSet() && request.effectStart().is_set())
|
||||
if(!ifs->isActivationTimeSet() && request.effectStart.is_set())
|
||||
{
|
||||
if (isCentral)
|
||||
{
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[AesType::AtNContamination] + s_maxActiveAreasCentral[AesType::AtBCContamination]) /*&& request.effectStart().is_set()*/)
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[static_cast<int>(AesType::AtNContamination)] + s_maxActiveAreasCentral[static_cast<int>(AesType::AtBCContamination)]) /*&& request.effectStart.is_set()*/)
|
||||
{
|
||||
return Core::FunctionReplyObject(1, tr_lts("dds", "Too many active central N or B/C contamination areas."));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (totalAreas() >= (s_maxActiveAreas[AesType::AtNContamination] + s_maxActiveAreas[AesType::AtBCContamination]) /*&& request.effectStart().is_set()*/) // upper if-condition handle start-time
|
||||
if (totalAreas() >= (s_maxActiveAreas[static_cast<int>(AesType::AtNContamination)] + s_maxActiveAreas[static_cast<int>(AesType::AtBCContamination)]) /*&& request.effectStart.is_set()*/) // upper if-condition handle start-time
|
||||
{
|
||||
return Core::FunctionReplyObject(1, tr_lts("dds", "Too many active N or B/C contamination areas."));
|
||||
}
|
||||
}
|
||||
}
|
||||
// For counting, only Elements being at least prepared are important:
|
||||
if (request.effectStart().is_set() && ifs->isObjectModifiable())
|
||||
if (request.effectStart.is_set() && ifs->isObjectModifiable())
|
||||
{
|
||||
|
||||
DEBUG_LOG(m_logger) << "isCentral: " << isCentral;
|
||||
@@ -258,8 +258,8 @@ Core::FunctionReplyObject HandlerNContamination::nContaminationModifyRequest(con
|
||||
// Change from central to training area
|
||||
if (wasCentral)
|
||||
{
|
||||
if (totalAreas() >= (s_maxActiveAreas[AesType::AtBCContamination] + s_maxActiveAreas[AesType::AtNContamination]))
|
||||
return Core::FunctionReplyObject(request.id(), tr_lts("dds", "Too many active N or B/C contamination areas."));
|
||||
if (totalAreas() >= (s_maxActiveAreas[static_cast<int>(AesType::AtBCContamination)] + s_maxActiveAreas[static_cast<int>(AesType::AtNContamination)]))
|
||||
return Core::FunctionReplyObject(request.id, tr_lts("dds", "Too many active N or B/C contamination areas."));
|
||||
|
||||
m_areaCount++;
|
||||
m_areaCountCentral--;
|
||||
@@ -268,8 +268,8 @@ Core::FunctionReplyObject HandlerNContamination::nContaminationModifyRequest(con
|
||||
}
|
||||
else // Change from training area to central
|
||||
{
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[AesType::AtBCContamination] + s_maxActiveAreasCentral[AesType::AtNContamination]))
|
||||
return Core::FunctionReplyObject(request.id(), tr_lts("dds", "Too many active central N or B/C contamination areas."));
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[static_cast<int>(AesType::AtBCContamination)] + s_maxActiveAreasCentral[static_cast<int>(AesType::AtNContamination)]))
|
||||
return Core::FunctionReplyObject(request.id, tr_lts("dds", "Too many active central N or B/C contamination areas."));
|
||||
m_areaCount--;
|
||||
m_areaCountCentral++;
|
||||
DEBUG_LOG(m_logger) << "s_areaCount[AesType::AtBCContamination] = " << m_areaCount;
|
||||
@@ -281,7 +281,7 @@ Core::FunctionReplyObject HandlerNContamination::nContaminationModifyRequest(con
|
||||
|
||||
|
||||
|
||||
if (request.id() < 0 && checkStateForSfm(ifs))
|
||||
if (request.id < 0 && checkStateForSfm(ifs))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Overwrite n contamination Effect State for OC";
|
||||
aea.effectStateId = AesEffectState::EsPrepared;
|
||||
|
||||
+30
-30
@@ -12,7 +12,7 @@ namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
HandlerOffRouteMine::HandlerOffRouteMine(MainHandler *mainHandler)
|
||||
: HandlerBaseTmpl<ObjectOffRouteMine>(mainHandler, QStringLiteral("OffRouteMine"), s_areaCount[AesType::AtOffRouteMine], s_areaCountCentral[AesType::AtOffRouteMine])
|
||||
: HandlerBaseTmpl<ObjectOffRouteMine>(mainHandler, QStringLiteral("OffRouteMine"), s_areaCount[static_cast<int>(AesType::AtOffRouteMine)], s_areaCountCentral[static_cast<int>(AesType::AtOffRouteMine)])
|
||||
, Interface::Fts::OffRouteMineModifyRequestHandler(mainHandler->dds()->fts())
|
||||
, Interface::Fts::OffRouteMineRemoveRequestHandler(mainHandler->dds()->fts())
|
||||
, Interface::Fts::OffRouteMineTriggerRequestHandler(mainHandler->dds()->fts())
|
||||
@@ -33,7 +33,7 @@ bool HandlerOffRouteMine::init()
|
||||
bRet = false;
|
||||
return;
|
||||
}
|
||||
if (totalAreasCentral() >= s_maxActiveAreasCentral[AesType::AtOffRouteMine])
|
||||
if (totalAreasCentral() >= s_maxActiveAreasCentral[static_cast<int>(AesType::AtOffRouteMine)])
|
||||
{
|
||||
ERROR_LOG(m_logger) << "More active off route mines in database than allowed - ignoring the rest!";
|
||||
ifs->removeObject();
|
||||
@@ -62,34 +62,34 @@ bool HandlerOffRouteMine::init()
|
||||
|
||||
int HandlerOffRouteMine::totalAreas() const
|
||||
{
|
||||
return s_areaCount[AesType::AtOffRouteMine];
|
||||
return s_areaCount[static_cast<int>(AesType::AtOffRouteMine)];
|
||||
}
|
||||
|
||||
int HandlerOffRouteMine::totalAreasCentral() const
|
||||
{
|
||||
return s_areaCountCentral[AesType::AtOffRouteMine];
|
||||
return s_areaCountCentral[static_cast<int>(AesType::AtOffRouteMine)];
|
||||
}
|
||||
|
||||
static void fillData(const OffRouteMineModifyRequest &src, Database::AesOffRouteMine &dst)
|
||||
{
|
||||
if (src.id() < 0) // is the id given as negative? set id -> used by OC-laptop
|
||||
dst.id = src.id();
|
||||
if (src.id < 0) // is the id given as negative? set id -> used by OC-laptop
|
||||
dst.id = src.id;
|
||||
|
||||
dst.name = QString::fromStdString(src.name());
|
||||
dst.effectStart = src.effectStart().is_set() && src.effectStart().get() > 0 ? QDateTime::fromMSecsSinceEpoch(src.effectStart().get()) : QDateTime();
|
||||
dst.effectDuration = src.effectDuration();
|
||||
dst.impactPosition.rx() = src.area().cornerBottomLeft().lon();
|
||||
dst.impactPosition.ry() = src.area().cornerBottomLeft().lat();
|
||||
dst.width = src.area().width();
|
||||
dst.length = src.area().height();
|
||||
dst.rotationAngle = src.area().rotation();
|
||||
dst.impactRadius = src.impactRadius().is_set() ? src.impactRadius().get() : 0;
|
||||
dst.partyId = src.partyId().is_set() ? src.partyId().get() : 0;
|
||||
dst.chargeTypeId = src.chargeTypeId();
|
||||
dst.name = QString::fromStdString(src.name);
|
||||
dst.effectStart = src.effectStart.is_set() && src.effectStart.get() > 0 ? QDateTime::fromMSecsSinceEpoch(src.effectStart.get()) : QDateTime();
|
||||
dst.effectDuration = src.effectDuration;
|
||||
dst.impactPosition.rx() = src.area.cornerBottomLeft.lon;
|
||||
dst.impactPosition.ry() = src.area.cornerBottomLeft.lat;
|
||||
dst.width = src.area.width;
|
||||
dst.length = src.area.height;
|
||||
dst.rotationAngle = src.area.rotation;
|
||||
dst.impactRadius = src.impactRadius.is_set() ? src.impactRadius.get() : 0;
|
||||
dst.partyId = src.partyId.is_set() ? src.partyId.get() : 0;
|
||||
dst.chargeTypeId = src.chargeTypeId;
|
||||
dst.isCentral = true;
|
||||
dst.triggered = false;
|
||||
//dst.participantId = src.participantId().is_set() ? src.participantId().get() : 0;
|
||||
//dst.externalId = src.externalId().is_set() ? src.externalId().get() : 0;
|
||||
//dst.participantId = src.participantId.is_set() ? src.participantId.get() : 0;
|
||||
//dst.externalId = src.externalId.is_set() ? src.externalId.get() : 0;
|
||||
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ void HandlerOffRouteMine::onOffRouteMineModifyRequest(const rti::core::SampleIde
|
||||
|
||||
Core::FunctionReplyObject HandlerOffRouteMine::offRouteMineCreateRequest(const OffRouteMineModifyRequest &request)
|
||||
{
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[AesType::AtOffRouteMine]) && request.effectStart().is_set())
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[static_cast<int>(AesType::AtOffRouteMine)]) && request.effectStart.is_set())
|
||||
return Core::FunctionReplyObject(1, tr_lts("dds", "Too many active off route mines."));
|
||||
|
||||
Database::AesOffRouteMine newData;
|
||||
@@ -135,15 +135,15 @@ Core::FunctionReplyObject HandlerOffRouteMine::offRouteMineModifyRequest(const O
|
||||
{
|
||||
Core::FunctionReplyObject ret;
|
||||
ObjectOffRouteMine *ifs = nullptr;
|
||||
if (request.id() == 0 || ((request.id() < 0) && !getObjectFromMap(m_objectMap, std::abs(request.id()), ret)))
|
||||
if (request.id == 0 || ((request.id < 0) && !getObjectFromMap(m_objectMap, std::abs(request.id), ret)))
|
||||
return offRouteMineCreateRequest(request);
|
||||
|
||||
ifs = getObjectFromMap(m_objectMap, std::abs(request.id()), ret);
|
||||
ifs = getObjectFromMap(m_objectMap, std::abs(request.id), ret);
|
||||
|
||||
if (!ifs)
|
||||
return ret;
|
||||
|
||||
if (request.effectStart().is_set() && (request.effectStart().get() + request.effectDuration() < m_mainHandler->dds()->currentPartitionTime().toMSecsSinceEpoch()))
|
||||
if (request.effectStart.is_set() && (request.effectStart.get() + request.effectDuration < m_mainHandler->dds()->currentPartitionTime().toMSecsSinceEpoch()))
|
||||
return removeObject(ifs);
|
||||
|
||||
// Anzahl aktiver Areas ist erreicht, der Wirkbeginn ist (soll) gesetzt sein, aber die Area war
|
||||
@@ -151,16 +151,16 @@ Core::FunctionReplyObject HandlerOffRouteMine::offRouteMineModifyRequest(const O
|
||||
/*!
|
||||
* If the effect start added after creation, the max amount need to be checked
|
||||
!*/
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[AesType::AtOffRouteMine])
|
||||
&& request.effectStart().is_set()
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[static_cast<int>(AesType::AtOffRouteMine)])
|
||||
&& request.effectStart.is_set()
|
||||
&& !ifs->isActivationTimeSet() // check if time before change was not setted.
|
||||
/*&& !ifs->isObjectModifiable()*/)
|
||||
{
|
||||
return Core::FunctionReplyObject(request.id(), tr_lts("dds", "Too many active off route mines."));
|
||||
return Core::FunctionReplyObject(request.id, tr_lts("dds", "Too many active off route mines."));
|
||||
}
|
||||
Database::AesOffRouteMine aea(ifs->data());
|
||||
fillData(request, aea);
|
||||
if (request.id() < 0 && checkStateForSfm(ifs))
|
||||
if (request.id < 0 && checkStateForSfm(ifs))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Overwrite off route mine Effect State for OC";
|
||||
aea.effectStateId = AesEffectState::EsPrepared;
|
||||
@@ -187,15 +187,15 @@ void HandlerOffRouteMine::onOffRouteMineTriggerRequest(const rti::core::SampleId
|
||||
Core::FunctionReplyObject HandlerOffRouteMine::offRouteMineTriggerRequest(const OffRouteMineTriggerRequest &request)
|
||||
{
|
||||
Core::FunctionReplyObject ret;
|
||||
ObjectOffRouteMine *ifs = getObjectFromMap(m_objectMap, std::abs(request.id()), ret);
|
||||
ObjectOffRouteMine *ifs = getObjectFromMap(m_objectMap, std::abs(request.id), ret);
|
||||
|
||||
if (!ifs)
|
||||
return ret;
|
||||
|
||||
Database::AesOffRouteMine aea(ifs->data());
|
||||
DEBUG_LOG(m_logger) << "Overwrite off route mine Effect State ";
|
||||
aea.effectStateId = AesEffectState_def::EsExpired;
|
||||
aea.triggered = request.triggered();
|
||||
aea.effectStateId = AesEffectState::EsExpired;
|
||||
aea.triggered = request.triggered;
|
||||
aea.effectDuration = aea.effectStart.msecsTo(QDateTime::currentDateTimeUtc());
|
||||
if (aea.effectDuration < 0)
|
||||
aea.effectDuration = 1;
|
||||
|
||||
+28
-28
@@ -55,19 +55,19 @@ bool HandlerReconArea::init()
|
||||
|
||||
static void fillData(const ReconAreaModifyRequest &src, Database::AesReconArea &dst)
|
||||
{
|
||||
dst.name = QString::fromStdString(src.name());
|
||||
dst.name = QString::fromStdString(src.name);
|
||||
dst.chargeTypeId = 103; // recon area dummy
|
||||
dst.effectDuration = 0; // forever active
|
||||
dst.position.rx() = src.area().cornerBottomLeft().lon();
|
||||
dst.position.ry() = src.area().cornerBottomLeft().lat();
|
||||
dst.rotationAngle = src.area().rotation();
|
||||
dst.height = src.area().height();
|
||||
dst.width = src.area().width();
|
||||
dst.position.rx() = src.area.cornerBottomLeft.lon;
|
||||
dst.position.ry() = src.area.cornerBottomLeft.lat;
|
||||
dst.rotationAngle = src.area.rotation;
|
||||
dst.height = src.area.height;
|
||||
dst.width = src.area.width;
|
||||
dst.effectMarkingInTa = false;
|
||||
dst.effectStart = src.effectStart().is_set() ? QDateTime::fromMSecsSinceEpoch(src.effectStart().get()) : QDateTime();
|
||||
dst.participantId = src.participantId();
|
||||
dst.partyId = src.partyId().is_set() ? src.partyId().get() : 0;
|
||||
dst.purpose = QString::fromStdString(src.purpose());
|
||||
dst.effectStart = src.effectStart.is_set() ? QDateTime::fromMSecsSinceEpoch(src.effectStart.get()) : QDateTime();
|
||||
dst.participantId = src.participantId;
|
||||
dst.partyId = src.partyId.is_set() ? src.partyId.get() : 0;
|
||||
dst.purpose = QString::fromStdString(src.purpose);
|
||||
}
|
||||
|
||||
void HandlerReconArea::onReconAreaModifyRequest(const rti::core::SampleIdentity &cookie,
|
||||
@@ -100,8 +100,8 @@ Core::FunctionReplyObject HandlerReconArea::reconAreaCreateRequest(const ReconAr
|
||||
m_objectMap.insert(ifs->id(), ifs);
|
||||
if (ifs->isObjectInTrainingArea())
|
||||
{
|
||||
++s_areaCount[AesType::AtReconArea];
|
||||
DEBUG_LOG(m_logger) << "s_areaCount[AesType::AtReconArea] = " << s_areaCount[AesType::AtReconArea];
|
||||
++s_areaCount[static_cast<int>(AesType::AtReconArea)];
|
||||
DEBUG_LOG(m_logger) << "s_areaCount[AesType::AtReconArea] = " << s_areaCount[static_cast<int>(AesType::AtReconArea)];
|
||||
}
|
||||
connect(ifs, &ObjectReconArea::newAiv, this, &HandlerReconArea::newAiv);
|
||||
connect(ifs, &ObjectReconArea::removeAiv, this, &HandlerReconArea::removeAiv);
|
||||
@@ -110,11 +110,11 @@ Core::FunctionReplyObject HandlerReconArea::reconAreaCreateRequest(const ReconAr
|
||||
|
||||
Core::FunctionReplyObject HandlerReconArea::reconAreaModifyRequest(const ReconAreaModifyRequest &request)
|
||||
{
|
||||
if (request.id() <= 0)
|
||||
if (request.id <= 0)
|
||||
return reconAreaCreateRequest(request);
|
||||
|
||||
Core::FunctionReplyObject ret;
|
||||
ObjectReconArea *ifs = getObjectFromMap(m_objectMap, request.id(), ret);
|
||||
ObjectReconArea *ifs = getObjectFromMap(m_objectMap, request.id, ret);
|
||||
if (!ifs)
|
||||
return ret;
|
||||
|
||||
@@ -130,19 +130,19 @@ Core::FunctionReplyObject HandlerReconArea::reconAreaModifyGeometryRequest(const
|
||||
{
|
||||
// WARNING: request.area.cornerBottomLeft() contains center point!
|
||||
Core::FunctionReplyObject ret;
|
||||
ObjectReconArea *ifs = getObjectFromMap(m_objectMap, request.id(), ret);
|
||||
ObjectReconArea *ifs = getObjectFromMap(m_objectMap, request.id, ret);
|
||||
if (!ifs)
|
||||
return ret;
|
||||
|
||||
// Todo: IsObjectModifiable() ?!?
|
||||
|
||||
AreaEffectSimulation::Database::AesReconArea aea(ifs->data());
|
||||
aea.position = Polygons::centerPoint2BottomLeft(QPointF(request.area().cornerBottomLeft().lon(),
|
||||
request.area().cornerBottomLeft().lat()),
|
||||
aea.position = Polygons::centerPoint2BottomLeft(QPointF(request.area.cornerBottomLeft.lon,
|
||||
request.area.cornerBottomLeft.lat),
|
||||
ifs->data().width,
|
||||
ifs->data().height,
|
||||
request.area().rotation());
|
||||
aea.rotationAngle = request.area().rotation();
|
||||
request.area.rotation);
|
||||
aea.rotationAngle = request.area.rotation;
|
||||
|
||||
return ifs->updateObject(aea);
|
||||
}
|
||||
@@ -163,23 +163,23 @@ Core::FunctionReplyObject HandlerReconArea::switchTo(int id, AesEffectState effe
|
||||
return Core::FunctionReplyObject(id, tr_lts("dds", "Recon area with id %1 not found.")).arg(id);
|
||||
|
||||
bool succ = false;
|
||||
switch (effectState.underlying()) {
|
||||
case AesEffectState_def::EsActivated:
|
||||
switch (effectState) {
|
||||
case AesEffectState::EsActivated:
|
||||
succ = !ifs->activateObjectNow().error();
|
||||
break;
|
||||
case AesEffectState_def::EsPrepared:
|
||||
case AesEffectState::EsPrepared:
|
||||
succ = ifs->trySwitchToPrepared();
|
||||
break;
|
||||
case AesEffectState_def::EsPaused:
|
||||
case AesEffectState::EsPaused:
|
||||
succ = ifs->trySwitchToPaused();
|
||||
break;
|
||||
case AesEffectState_def::EsExpired:
|
||||
case AesEffectState::EsExpired:
|
||||
succ = ifs->trySwitchToExpired();
|
||||
break;
|
||||
case AesEffectState_def::EsRemoved:
|
||||
case AesEffectState::EsRemoved:
|
||||
succ = ifs->trySwitchToRemoved();
|
||||
break;
|
||||
case AesEffectState_def::EsCreated:
|
||||
case AesEffectState::EsCreated:
|
||||
succ = ifs->trySwitchToCreated();
|
||||
break;
|
||||
default:
|
||||
@@ -187,7 +187,7 @@ Core::FunctionReplyObject HandlerReconArea::switchTo(int id, AesEffectState effe
|
||||
}
|
||||
if (succ)
|
||||
return Core::FunctionReplyObject();
|
||||
return Core::FunctionReplyObject(id, tr_lts("dds", "Could not switch effect simulation with id %1 to state with id %2.")).arg(id).arg(effectState.underlying());
|
||||
return Core::FunctionReplyObject(id, tr_lts("dds", "Could not switch effect simulation with id %1 to state with id %2.")).arg(id).arg(effectState);
|
||||
}
|
||||
|
||||
void HandlerReconArea::onReconAreaRemoveRequest(const rti::core::SampleIdentity &cookie,
|
||||
@@ -195,7 +195,7 @@ void HandlerReconArea::onReconAreaRemoveRequest(const rti::core::SampleIdentity
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onReconAreaRemoveRequest: " << request;
|
||||
Core::FunctionReplyObject ret;
|
||||
ObjectReconArea *ifs = getObjectFromMap(m_objectMap, request.id(), ret);
|
||||
ObjectReconArea *ifs = getObjectFromMap(m_objectMap, request.id, ret);
|
||||
if (!ifs)
|
||||
{
|
||||
m_mainHandler->dds()->fts()->reconAreaRemoveReply(cookie, ret);
|
||||
|
||||
+16
-16
@@ -14,7 +14,7 @@ namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
HandlerTechnicalArea::HandlerTechnicalArea(MainHandler *mainHandler)
|
||||
: HandlerBaseTmpl<ObjectTechnicalArea>(mainHandler, QStringLiteral("TechnicalArea"), s_areaCount[AesType::AtTechnicalArea], s_areaCountCentral[AesType::AtTechnicalArea])
|
||||
: HandlerBaseTmpl<ObjectTechnicalArea>(mainHandler, QStringLiteral("TechnicalArea"), s_areaCount[static_cast<int>(AesType::AtTechnicalArea)], s_areaCountCentral[static_cast<int>(AesType::AtTechnicalArea)])
|
||||
, Interface::Fts::TechnicalAreaModifyRequestHandler(mainHandler->dds()->fts())
|
||||
, Interface::Fts::TechnicalAreaRemoveRequestHandler(mainHandler->dds()->fts())
|
||||
{
|
||||
@@ -43,7 +43,7 @@ bool HandlerTechnicalArea::init()
|
||||
return false;
|
||||
}
|
||||
|
||||
if (totalAreas() >= s_maxActiveAreas[AesType::AtTechnicalArea])
|
||||
if (totalAreas() >= s_maxActiveAreas[static_cast<int>(AesType::AtTechnicalArea)])
|
||||
{
|
||||
ERROR_LOG(m_logger) << "More active technical areas in database than allowed - ignoring the rest!";
|
||||
delete ifs;
|
||||
@@ -65,31 +65,31 @@ bool HandlerTechnicalArea::init()
|
||||
|
||||
int HandlerTechnicalArea::totalAreas() const
|
||||
{
|
||||
return s_areaCount[AesType::AtTechnicalArea];
|
||||
return s_areaCount[static_cast<int>(AesType::AtTechnicalArea)];
|
||||
}
|
||||
|
||||
int HandlerTechnicalArea::totalAreasCentral() const
|
||||
{
|
||||
return s_areaCountCentral[AesType::AtTechnicalArea];
|
||||
return s_areaCountCentral[static_cast<int>(AesType::AtTechnicalArea)];
|
||||
}
|
||||
|
||||
static void fillData(const TechnicalAreaModifyRequest &src, Database::AesTechnicalArea &dst)
|
||||
{
|
||||
dst.name = QString::fromStdString(src.name());
|
||||
dst.name = QString::fromStdString(src.name);
|
||||
dst.chargeTypeId = 421; // dummy
|
||||
dst.effectDuration = 0; // forever active
|
||||
dst.typeId = src.type().underlying();
|
||||
dst.position.rx() = src.area().cornerBottomLeft().lon();
|
||||
dst.position.ry() = src.area().cornerBottomLeft().lat();
|
||||
dst.length = src.area().height();
|
||||
dst.width = src.area().width();
|
||||
dst.typeId = src.type;
|
||||
dst.position.rx() = src.area.cornerBottomLeft.lon;
|
||||
dst.position.ry() = src.area.cornerBottomLeft.lat;
|
||||
dst.length = src.area.height;
|
||||
dst.width = src.area.width;
|
||||
}
|
||||
|
||||
void HandlerTechnicalArea::onTechnicalAreaModifyRequest(const rti::core::SampleIdentity &cookie,
|
||||
const TechnicalAreaModifyRequest &request)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onTechnicalAreaModifyRequest: " << request;
|
||||
Core::FunctionReplyObject ret = request.id() > 0 ? technicalAreaModifyRequest(request) : technicalAreaCreateRequest(request);
|
||||
Core::FunctionReplyObject ret = request.id > 0 ? technicalAreaModifyRequest(request) : technicalAreaCreateRequest(request);
|
||||
if (ret.error())
|
||||
WARNING_LOG(m_logger) << ret();
|
||||
m_mainHandler->dds()->fts()->technicalAreaModifyReply(cookie, ret);
|
||||
@@ -97,7 +97,7 @@ void HandlerTechnicalArea::onTechnicalAreaModifyRequest(const rti::core::SampleI
|
||||
|
||||
Core::FunctionReplyObject HandlerTechnicalArea::technicalAreaCreateRequest(const TechnicalAreaModifyRequest &request)
|
||||
{
|
||||
if (totalAreas() >= s_maxActiveAreas[AesType::AtTechnicalArea])
|
||||
if (totalAreas() >= s_maxActiveAreas[static_cast<int>(AesType::AtTechnicalArea)])
|
||||
return Core::FunctionReplyObject(tr_lts("dds", "Too many active technical areas."));
|
||||
|
||||
Database::AesTechnicalArea newData;
|
||||
@@ -129,20 +129,20 @@ Core::FunctionReplyObject HandlerTechnicalArea::technicalAreaCreateRequest(const
|
||||
Core::FunctionReplyObject HandlerTechnicalArea::technicalAreaModifyRequest(const TechnicalAreaModifyRequest &request)
|
||||
{
|
||||
Core::FunctionReplyObject ret;
|
||||
ObjectTechnicalArea *ifs = getObjectFromMap(m_objectMap, request.id(), ret);
|
||||
ObjectTechnicalArea *ifs = getObjectFromMap(m_objectMap, request.id, ret);
|
||||
if (!ifs)
|
||||
return ret;
|
||||
|
||||
// Anzahl aktiver Areas ist erreicht, der Wirkbeginn ist (soll) gesetzt sein, aber die Area war
|
||||
// vorher noch ohne Wirkbeginn
|
||||
if (totalAreas() >= s_maxActiveAreas[AesType::AtTechnicalArea] && !ifs->isObjectModifiable())
|
||||
return Core::FunctionReplyObject(request.id(), tr_lts("dds", "Too many active technical areas."));
|
||||
if (totalAreas() >= s_maxActiveAreas[static_cast<int>(AesType::AtTechnicalArea)] && !ifs->isObjectModifiable())
|
||||
return Core::FunctionReplyObject(request.id, tr_lts("dds", "Too many active technical areas."));
|
||||
|
||||
// Todo: IsObjectModifiable() ?!?
|
||||
|
||||
AreaEffectSimulation::Database::AesTechnicalArea aea(ifs->data());
|
||||
fillData(request, aea);
|
||||
if (request.id() < 0 && checkStateForSfm(ifs))
|
||||
if (request.id < 0 && checkStateForSfm(ifs))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Overwrite technical area Effect State for OC";
|
||||
aea.effectStateId = AesEffectState::EsPrepared;
|
||||
|
||||
@@ -178,7 +178,7 @@ bool MainHandler::initAESHandler()
|
||||
if (!ltsElevationManager)
|
||||
{
|
||||
ERROR_LOG(m_logger) << LOGFUNCTION << " LtsElevation::createInstance failed.";
|
||||
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::inner_enum::StoppedError);
|
||||
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::StoppedError);
|
||||
return false;
|
||||
}
|
||||
#endif // Q_OS_WIN
|
||||
@@ -190,7 +190,7 @@ bool MainHandler::initAESHandler()
|
||||
if (!trajectoryGenerator)
|
||||
{
|
||||
ERROR_LOG(m_logger) << LOGFUNCTION << " TrajectoryGenerator::getInstance failed.";
|
||||
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::inner_enum::StoppedError);
|
||||
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::StoppedError);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -250,7 +250,7 @@ bool MainHandler::initAESHandler()
|
||||
if (!m_handlerBorderline->init())
|
||||
{
|
||||
ERROR_LOG(m_logger) << LOGFUNCTION << " Initialisation HandlerBorderline failed.";
|
||||
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::inner_enum::StoppedError);
|
||||
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::StoppedError);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -259,7 +259,7 @@ bool MainHandler::initAESHandler()
|
||||
if (!m_handlerGasPipe->init())
|
||||
{
|
||||
ERROR_LOG(m_logger) << LOGFUNCTION << " Initialisation HandlerGasPipe failed.";
|
||||
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::inner_enum::StoppedError);
|
||||
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::StoppedError);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -268,7 +268,7 @@ bool MainHandler::initAESHandler()
|
||||
if (!m_handlerChargeEffect->init())
|
||||
{
|
||||
ERROR_LOG(m_logger) << LOGFUNCTION << " Initialisation HandlerChargeEffect failed.";
|
||||
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::inner_enum::StoppedError);
|
||||
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::StoppedError);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -281,7 +281,7 @@ bool MainHandler::initAESHandler()
|
||||
if (!m_handlerEffector->init())
|
||||
{
|
||||
ERROR_LOG(m_logger) << LOGFUNCTION << " Initialisation HandlerChargeEffect failed.";
|
||||
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::inner_enum::StoppedError);
|
||||
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::StoppedError);
|
||||
return false;
|
||||
}
|
||||
// Effect Cluster last as we need Effector first
|
||||
|
||||
+20
-20
@@ -37,38 +37,38 @@ MeteoDataManagement::MeteoData MeteoDataProvider::getStaticWeather()
|
||||
}
|
||||
// default values from wikipedia for aviations
|
||||
MeteoDataManagement::MeteoData dummyWeather;
|
||||
dummyWeather.pressure(1013.25);
|
||||
dummyWeather.temperature(15);
|
||||
dummyWeather.humidity(0);
|
||||
dummyWeather.pressure = 1013.25;
|
||||
dummyWeather.temperature = 15;
|
||||
dummyWeather.humidity = 0;
|
||||
|
||||
dummyWeather.timeStamp(m_mainHandler->dds()->currentPartitionTimeMSec());
|
||||
dummyWeather.windDirection(0);
|
||||
dummyWeather.windSpeed(0);
|
||||
dummyWeather.windOk(true);
|
||||
dummyWeather.climateOk(true);
|
||||
dummyWeather.timeStamp = m_mainHandler->dds()->currentPartitionTimeMSec();
|
||||
dummyWeather.windDirection = 0;
|
||||
dummyWeather.windSpeed = 0;
|
||||
dummyWeather.windOk = true;
|
||||
dummyWeather.climateOk = true;
|
||||
return dummyWeather;
|
||||
}
|
||||
|
||||
MeteoDataManagement::MeteoData MeteoDataProvider::getNearestWeather(const Core::GeoPosition2D &pos)
|
||||
{
|
||||
initWeatherData();
|
||||
LtsCoordTrans::UtmCoordinate utm(LtsCoordTrans::UtmCoordinate::fromGeographic(pos.lon(), pos.lat()));
|
||||
LtsCoordTrans::UtmCoordinate utm(LtsCoordTrans::UtmCoordinate::fromGeographic(pos.lon, pos.lat));
|
||||
double nearestDistanceSquared = std::numeric_limits<double>::max();
|
||||
MeteoDataManagement::MeteoData retMd;
|
||||
for (const auto &md : qAsConst(m_meteoData))
|
||||
{
|
||||
if (md.isStaticMeteoData())
|
||||
if (md.isStaticMeteoData)
|
||||
continue;
|
||||
if (QDateTime::fromMSecsSinceEpoch(md.timeStamp()).addMSecs(Settings::getValidityPeriodWeatherData()) < m_mainHandler->dds()->currentPartitionTime())
|
||||
if (QDateTime::fromMSecsSinceEpoch(md.timeStamp).addMSecs(Settings::getValidityPeriodWeatherData()) < m_mainHandler->dds()->currentPartitionTime())
|
||||
continue;
|
||||
const double distanceSquared = LtsCoordTrans::squareDistance(utm, md.pos().lon(), md.pos().lat());
|
||||
const double distanceSquared = LtsCoordTrans::squareDistance(utm, md.pos.lon, md.pos.lat);
|
||||
if (distanceSquared < nearestDistanceSquared)
|
||||
{
|
||||
retMd = md;
|
||||
nearestDistanceSquared = distanceSquared;
|
||||
}
|
||||
}
|
||||
return (retMd.id() > 0) ? retMd : getStaticWeather();
|
||||
return (retMd.id > 0) ? retMd : getStaticWeather();
|
||||
}
|
||||
|
||||
void MeteoDataProvider::meteoDataChanged(const MeteoDataManagement::MeteoData &data, DataModification modType)
|
||||
@@ -76,15 +76,15 @@ void MeteoDataProvider::meteoDataChanged(const MeteoDataManagement::MeteoData &d
|
||||
switch (modType)
|
||||
{
|
||||
case DataModification::eRemoved:
|
||||
m_meteoData.remove(data.id());
|
||||
if (m_staticWeatherId == data.id())
|
||||
m_meteoData.remove(data.id);
|
||||
if (m_staticWeatherId == data.id)
|
||||
m_staticWeatherId = 0;
|
||||
break;
|
||||
case DataModification::eAdded:
|
||||
case DataModification::eModified:
|
||||
m_meteoData[data.id()] = data;
|
||||
if (data.isStaticMeteoData())
|
||||
m_staticWeatherId = data.id();
|
||||
m_meteoData[data.id] = data;
|
||||
if (data.isStaticMeteoData)
|
||||
m_staticWeatherId = data.id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -96,9 +96,9 @@ void MeteoDataProvider::initWeatherData()
|
||||
m_mdmDtc->waitForHistoricalDataMeteoData();
|
||||
m_meteoData = m_mdmDtc->meteoDatas();
|
||||
for (const auto &data : qAsConst(m_meteoData))
|
||||
if (data.isStaticMeteoData())
|
||||
if (data.isStaticMeteoData)
|
||||
{
|
||||
m_staticWeatherId = data.id();
|
||||
m_staticWeatherId = data.id;
|
||||
return;
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -47,11 +47,11 @@ void MineCorridorCreator::addPosition(const Core::GeoPosition2D &pos, qint64 ts)
|
||||
{
|
||||
m_timeoutTimer->start();
|
||||
if (m_sortedCorridorData.isEmpty())
|
||||
m_sortedCorridorData.insert(ts, LtsCoordTrans::UtmCoordinate::fromGeographic(pos.lon(), pos.lat()));
|
||||
m_sortedCorridorData.insert(ts, LtsCoordTrans::UtmCoordinate::fromGeographic(pos.lon, pos.lat));
|
||||
else
|
||||
{
|
||||
const auto &last = m_sortedCorridorData.last();
|
||||
const auto utm = LtsCoordTrans::UtmCoordinate::fromGeographic(pos.lon(), pos.lat(), last.zone);
|
||||
const auto utm = LtsCoordTrans::UtmCoordinate::fromGeographic(pos.lon, pos.lat, last.zone);
|
||||
if (isSamePoint(last, utm, s_samePointDistance))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "got duplicated point (" << last.x << "/" << last.y
|
||||
|
||||
+13
-13
@@ -95,23 +95,23 @@ void ObjectAirSupportImpact::publishAiv()
|
||||
const QRectF bounds(poly.boundingRect());
|
||||
|
||||
AesItemView aiv(m_aiv);
|
||||
aiv.aesItemId(m_data.id);
|
||||
aiv.chargeStruct().chargeTypeId(m_data.chargeTypeId);
|
||||
ddsVecFromPoly(poly, aiv.form());
|
||||
aiv.effectStart(toMSec(m_data.effectStart));
|
||||
aiv.boundingBoxBottomLeft(Core::GeoPosition2D(bounds.bottomLeft().x(), bounds.bottomLeft().y()));
|
||||
aiv.boundingBoxTopRight(Core::GeoPosition2D(bounds.topRight().x(), bounds.topRight().y()));
|
||||
aiv.aesTypeId(AesType::AtAirSupportImpact);
|
||||
aiv.effectStateId(effectState());
|
||||
aiv.id(1000 * m_data.id + AesType::AtAirSupportImpact);
|
||||
aiv.aesItemId = m_data.id;
|
||||
aiv.chargeStruct.chargeTypeId = m_data.chargeTypeId;
|
||||
ddsVecFromPoly(poly, aiv.form);
|
||||
aiv.effectStart = toMSec(m_data.effectStart);
|
||||
aiv.boundingBoxBottomLeft = Core::GeoPosition2D(bounds.bottomLeft().x(), bounds.bottomLeft().y());
|
||||
aiv.boundingBoxTopRight = Core::GeoPosition2D(bounds.topRight().x(), bounds.topRight().y());
|
||||
aiv.aesTypeId = AesType::AtAirSupportImpact;
|
||||
aiv.effectStateId = effectState();
|
||||
aiv.id = 1000 * m_data.id + static_cast<int>(AesType::AtAirSupportImpact);
|
||||
if (m_data.partyId != 0)
|
||||
aiv.partyId(m_data.partyId);
|
||||
aiv.partyId = m_data.partyId;
|
||||
|
||||
checkIsCentralAndPublish(aiv.form(), m_aiv.form(), m_data.isCentral);
|
||||
checkIsCentralAndPublish(aiv.form, m_aiv.form, m_data.isCentral);
|
||||
|
||||
if (aiv != m_aiv)
|
||||
{
|
||||
aiv.sampleTime(partitionTimeMSec());
|
||||
aiv.sampleTime = partitionTimeMSec();
|
||||
m_aiv = aiv;
|
||||
m_mainHandler->dds()->dts()->publish(aiv);
|
||||
emit newAiv(aiv);
|
||||
@@ -122,7 +122,7 @@ void ObjectAirSupportImpact::removeTopics()
|
||||
{
|
||||
auto dts = m_mainHandler->dds()->dts();
|
||||
dts->removeExplosionSingleByKey(m_data.id);
|
||||
dts->removeAesItemViewByKey(1000 * m_data.id + AesType::AtAirSupportImpact);
|
||||
dts->removeAesItemViewByKey(1000 * m_data.id + static_cast<int>(AesType::AtAirSupportImpact));
|
||||
emit removeAiv(m_data.id);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ public:
|
||||
|
||||
Core::FunctionReplyObject updateObject(const Database::AesAirSupportImpact &data) override;
|
||||
|
||||
std::vector<Core::GeoPosition> form() const override { return m_aiv.form(); }
|
||||
std::vector<Core::GeoPosition> form() const override { return m_aiv.form; }
|
||||
QPolygonF generateForm() override;
|
||||
AesType aesType() const override { return AesType::AtAirSupportImpact; }
|
||||
bool isCentral() const override { return m_data.isCentral; }
|
||||
|
||||
@@ -93,7 +93,7 @@ AesEffectState ObjectBase::checkEnterNewState()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << id() << " checkEnterNewState - cur effect state is " << effectState();
|
||||
bool bNeedToPublishNewData = false;
|
||||
switch (effectState().underlying())
|
||||
switch (effectState())
|
||||
{
|
||||
case AesEffectState::EsUnknown:
|
||||
// initial state, switch to Received or Created
|
||||
@@ -376,7 +376,7 @@ bool ObjectBase::trySwitchToExpired()
|
||||
bool ObjectBase::trySwitchToRemoved()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << id() << " trySwitchToRemoved: " << effectState();
|
||||
switch (effectState().underlying())
|
||||
switch (effectState())
|
||||
{
|
||||
case AesEffectState::EsReceived:
|
||||
setUseEffectStateReceived(false);
|
||||
|
||||
@@ -149,7 +149,7 @@ class ObjectBase : public QObject
|
||||
QPolygonF out;
|
||||
out.reserve(in.size());
|
||||
for (const auto &pos : qAsConst(in))
|
||||
out.push_back(QPointF(pos.lon(), pos.lat()));
|
||||
out.push_back(QPointF(pos.lon, pos.lat));
|
||||
|
||||
return out;
|
||||
}
|
||||
@@ -300,7 +300,7 @@ template <typename T> class ObjectBaseTmpl : public ObjectBase
|
||||
m_data.effectStart = tTempStart;
|
||||
return Core::FunctionReplyObject(m_data.id, tr_lts("dds", "Can not activate effect simulation with id %1 which is in the effect state with id %2."))
|
||||
.arg(m_data.id)
|
||||
.arg(m_data.effectStateId.underlying());
|
||||
.arg(static_cast<int>(m_data.effectStateId));
|
||||
}
|
||||
|
||||
return Core::FunctionReplyObject();
|
||||
@@ -357,10 +357,10 @@ template <typename T> class ObjectBaseTmpl : public ObjectBase
|
||||
if (wasCentral && (effectState() == AesEffectState::EsExpired || effectState() == AesEffectState::EsActivated || effectState() == AesEffectState::EsPaused))
|
||||
return true;
|
||||
|
||||
if (static_cast<MineClass::type>(m_mainHandler->dds()->pdmDtc()->mineClass(m_data.chargeTypeId, m_data.igniterTypeId, m_data.igniterFunctionId)) == MineClass::VirtualSingle)
|
||||
if (static_cast<MineClass>(m_mainHandler->dds()->pdmDtc()->mineClass(m_data.chargeTypeId, m_data.igniterTypeId, m_data.igniterFunctionId)) == MineClass::VirtualSingle)
|
||||
return true;
|
||||
|
||||
if (m_mainHandler->dds()->pdmDtc()->gearClassFromChargeTypeId(m_data.chargeTypeId) == ProjectDataManagement::GearClass::AirSupport)
|
||||
if (m_mainHandler->dds()->pdmDtc()->gearClassFromChargeTypeId(m_data.chargeTypeId) == ProjectDataManagement::GearClass::GearClass_AirSupport)
|
||||
return true;
|
||||
|
||||
// Laser-Guidable Weapons must always be calculated by CES
|
||||
@@ -368,7 +368,7 @@ template <typename T> class ObjectBaseTmpl : public ObjectBase
|
||||
return true;
|
||||
|
||||
// PzAbwVMi B always true
|
||||
if (static_cast<MineClass::type>(m_mainHandler->dds()->pdmDtc()->mineClass(m_data.chargeTypeId, m_data.igniterTypeId, m_data.igniterFunctionId)) == MineClass::Concrete)
|
||||
if (static_cast<MineClass>(m_mainHandler->dds()->pdmDtc()->mineClass(m_data.chargeTypeId, m_data.igniterTypeId, m_data.igniterFunctionId)) == MineClass::Concrete)
|
||||
return true;
|
||||
|
||||
// If form didn't change, isCentral cannot change either:
|
||||
@@ -379,9 +379,9 @@ template <typename T> class ObjectBaseTmpl : public ObjectBase
|
||||
const QMap<int, InfrastructureManagement::SpecialArea> spAMap = m_mainHandler->specialAreaProvider()->getSpecialAreas();
|
||||
for (const InfrastructureManagement::SpecialArea &sa : spAMap)
|
||||
{
|
||||
if (sa.specialType() != InfrastructureManagement::SpecialAreaType::SatCesArea)
|
||||
if (sa.specialType != InfrastructureManagement::SpecialAreaType::SatCesArea)
|
||||
continue;
|
||||
if (intersects(form, sa.polygon()))
|
||||
if (intersects(form, sa.polygon))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
+17
-17
@@ -139,8 +139,8 @@ void ObjectBCContamination::onUpdateWeatherData()
|
||||
else
|
||||
md = m_mainHandler->meteoData()->getStaticWeather();
|
||||
|
||||
if (qFuzzyCompare(md.windDirection(), fmod(m_data.propagationDirection + 180.0, 360.0)) &&
|
||||
qFuzzyCompare(md.windSpeed(), m_data.windSpeed))
|
||||
if (qFuzzyCompare(md.windDirection, fmod(m_data.propagationDirection + 180.0, 360.0)) &&
|
||||
qFuzzyCompare(md.windSpeed, m_data.windSpeed))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << id() << " weather for " << m_typeName
|
||||
<< " did not change - no need to publish new data";
|
||||
@@ -148,8 +148,8 @@ void ObjectBCContamination::onUpdateWeatherData()
|
||||
}
|
||||
DEBUG_LOG(m_logger) << id() << " updating weather for " << m_typeName;
|
||||
|
||||
m_data.propagationDirection = fmod(md.windDirection() + 180.0, 360.0);
|
||||
m_data.windSpeed = md.windSpeed();
|
||||
m_data.propagationDirection = fmod(md.windDirection + 180.0, 360.0);
|
||||
m_data.windSpeed = md.windSpeed;
|
||||
m_data.weatherTimestamp = partitionTime() > m_data.effectStart ? partitionTime() : m_data.effectStart;
|
||||
m_data.weatherPosition = curCenterPointGeographic;
|
||||
m_publishDataTimer->start();
|
||||
@@ -217,26 +217,26 @@ void ObjectBCContamination::publishAiv()
|
||||
const QRectF bounds(poly.boundingRect());
|
||||
|
||||
AesItemView aiv(m_aiv);
|
||||
aiv.aesItemId(m_data.id);
|
||||
aiv.effectStart(toMSec(m_data.effectStart));
|
||||
aiv.chargeStruct().chargeTypeId(m_data.chargeTypeId);
|
||||
ddsVecFromPoly(poly, aiv.form());
|
||||
aiv.boundingBoxBottomLeft(Core::GeoPosition2D(bounds.bottomLeft().x(), bounds.bottomLeft().y()));
|
||||
aiv.boundingBoxTopRight(Core::GeoPosition2D(bounds.topRight().x(), bounds.topRight().y()));
|
||||
aiv.aesTypeId(AesType::AtBCContamination);
|
||||
aiv.effectStateId(data().effectStateId);
|
||||
aiv.id(1000 * m_data.id + AesType::AtBCContamination);
|
||||
aiv.aesItemId = m_data.id;
|
||||
aiv.effectStart = toMSec(m_data.effectStart);
|
||||
aiv.chargeStruct.chargeTypeId = m_data.chargeTypeId;
|
||||
ddsVecFromPoly(poly, aiv.form);
|
||||
aiv.boundingBoxBottomLeft = Core::GeoPosition2D(bounds.bottomLeft().x(), bounds.bottomLeft().y());
|
||||
aiv.boundingBoxTopRight = Core::GeoPosition2D(bounds.topRight().x(), bounds.topRight().y());
|
||||
aiv.aesTypeId = AesType::AtBCContamination;
|
||||
aiv.effectStateId = data().effectStateId;
|
||||
aiv.id = 1000 * m_data.id + static_cast<int>(AesType::AtBCContamination);
|
||||
|
||||
// Check if aiv is in special area
|
||||
// effectStart needs to be set
|
||||
checkIsCentralAndPublish(aiv.form(), m_aiv.form(), m_data.isCentral);
|
||||
checkIsCentralAndPublish(aiv.form, m_aiv.form, m_data.isCentral);
|
||||
|
||||
if (m_data.partyId != 0)
|
||||
aiv.partyId(m_data.partyId);
|
||||
aiv.partyId = m_data.partyId;
|
||||
|
||||
if (aiv != m_aiv)
|
||||
{
|
||||
aiv.sampleTime(partitionTimeMSec());
|
||||
aiv.sampleTime = partitionTimeMSec();
|
||||
m_aiv = aiv;
|
||||
m_mainHandler->dds()->dts()->publish(aiv);
|
||||
emit newAiv(m_aiv);
|
||||
@@ -278,7 +278,7 @@ void ObjectBCContamination::removeTopics()
|
||||
m_aivUpdateTimer->stop();
|
||||
m_weatherTimer->stop();
|
||||
dts->removeBCContaminationByKey(m_data.id);
|
||||
dts->removeAesItemViewByKey(1000 * m_data.id + AesType::AtBCContamination);
|
||||
dts->removeAesItemViewByKey(1000 * m_data.id + static_cast<int>(AesType::AtBCContamination));
|
||||
emit removeAiv(m_data.id);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ public:
|
||||
*/
|
||||
bool removeObjectFromDb();
|
||||
|
||||
std::vector<Core::GeoPosition> form() const override { return m_aiv.form(); }
|
||||
std::vector<Core::GeoPosition> form() const override { return m_aiv.form; }
|
||||
|
||||
QPolygonF generateForm() override;
|
||||
AesType aesType() const override { return AesType::AtBCContamination; }
|
||||
|
||||
+23
-23
@@ -164,22 +164,22 @@ void ObjectBoobyTrap::publishAiv()
|
||||
const QRectF bounds(poly.boundingRect());
|
||||
|
||||
AesItemView aiv(m_aiv);
|
||||
aiv.aesItemId(m_data.id);
|
||||
aiv.effectStart(toMSec(m_data.effectStart));
|
||||
aiv.chargeStruct().chargeTypeId(m_data.chargeTypeId);
|
||||
ddsVecFromPoly(poly, aiv.form());
|
||||
aiv.boundingBoxBottomLeft(Core::GeoPosition2D(bounds.bottomLeft().x(), bounds.bottomLeft().y()));
|
||||
aiv.boundingBoxTopRight(Core::GeoPosition2D(bounds.topRight().x(), bounds.topRight().y()));
|
||||
aiv.aesTypeId(AesType::AtBoobyTrap);
|
||||
aiv.effectStateId(data().effectStateId);
|
||||
aiv.id(1000 * m_data.id + AesType::AtBoobyTrap);
|
||||
aiv.aesItemId = m_data.id;
|
||||
aiv.effectStart = toMSec(m_data.effectStart);
|
||||
aiv.chargeStruct.chargeTypeId = m_data.chargeTypeId;
|
||||
ddsVecFromPoly(poly, aiv.form);
|
||||
aiv.boundingBoxBottomLeft = Core::GeoPosition2D(bounds.bottomLeft().x(), bounds.bottomLeft().y());
|
||||
aiv.boundingBoxTopRight = Core::GeoPosition2D(bounds.topRight().x(), bounds.topRight().y());
|
||||
aiv.aesTypeId = AesType::AtBoobyTrap;
|
||||
aiv.effectStateId = data().effectStateId;
|
||||
aiv.id = 1000 * m_data.id + static_cast<int>(AesType::AtBoobyTrap);
|
||||
|
||||
if (m_data.partyId != 0)
|
||||
aiv.partyId(m_data.partyId);
|
||||
aiv.partyId = m_data.partyId;
|
||||
|
||||
if (aiv != m_aiv)
|
||||
{
|
||||
aiv.sampleTime(partitionTimeMSec());
|
||||
aiv.sampleTime = partitionTimeMSec();
|
||||
m_aiv = aiv;
|
||||
m_mainHandler->dds()->dts()->publish(aiv);
|
||||
emit newAiv(m_aiv);
|
||||
@@ -191,21 +191,21 @@ void ObjectBoobyTrap::publishAiv()
|
||||
const QPolygonF poly = Polygons::boobyTrapCake(data(), data().impactRadius);
|
||||
const QRectF bounds(poly.boundingRect());
|
||||
AesItemView aiv2(m_aiv2);
|
||||
aiv2.aesItemId(m_data.id);
|
||||
aiv2.effectStart(toMSec(m_data.effectStart));
|
||||
aiv2.chargeStruct().chargeTypeId(m_data.chargeTypeId);
|
||||
ddsVecFromPoly(poly, aiv2.form());
|
||||
aiv2.boundingBoxBottomLeft(Core::GeoPosition2D(bounds.bottomLeft().x(), bounds.bottomLeft().y()));
|
||||
aiv2.boundingBoxTopRight(Core::GeoPosition2D(bounds.topRight().x(), bounds.topRight().y()));
|
||||
aiv2.aesTypeId(AesType::AtBoobyTrapSecondary);
|
||||
aiv2.effectStateId(data().effectStateId);
|
||||
aiv2.id(1000 * m_data.id + AesType::AtBoobyTrapSecondary);
|
||||
aiv2.aesItemId = m_data.id;
|
||||
aiv2.effectStart = toMSec(m_data.effectStart);
|
||||
aiv2.chargeStruct.chargeTypeId = m_data.chargeTypeId;
|
||||
ddsVecFromPoly(poly, aiv2.form);
|
||||
aiv2.boundingBoxBottomLeft = Core::GeoPosition2D(bounds.bottomLeft().x(), bounds.bottomLeft().y());
|
||||
aiv2.boundingBoxTopRight = Core::GeoPosition2D(bounds.topRight().x(), bounds.topRight().y());
|
||||
aiv2.aesTypeId = AesType::AtBoobyTrapSecondary;
|
||||
aiv2.effectStateId = data().effectStateId;
|
||||
aiv2.id = 1000 * m_data.id + static_cast<int>(AesType::AtBoobyTrapSecondary);
|
||||
|
||||
if (m_data.partyId != 0)
|
||||
aiv2.partyId(m_data.partyId);
|
||||
aiv2.partyId = m_data.partyId;
|
||||
if (aiv2 != m_aiv2)
|
||||
{
|
||||
aiv2.sampleTime(partitionTimeMSec());
|
||||
aiv2.sampleTime = partitionTimeMSec();
|
||||
m_aiv2 = aiv2;
|
||||
m_mainHandler->dds()->dts()->publish(aiv2);
|
||||
emit newAiv(aiv2);
|
||||
@@ -218,7 +218,7 @@ void ObjectBoobyTrap::removeTopics()
|
||||
{
|
||||
auto dts = m_mainHandler->dds()->dts();
|
||||
dts->removeBoobyTrapByKey(m_data.id);
|
||||
dts->removeAesItemViewByKey(1000 * m_data.id + AesType::AtBoobyTrap);
|
||||
dts->removeAesItemViewByKey(1000 * m_data.id + static_cast<int>(AesType::AtBoobyTrap));
|
||||
emit removeAiv(m_data.id);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ public:
|
||||
*/
|
||||
bool removeObjectFromDb();
|
||||
|
||||
std::vector<Core::GeoPosition> form() const override { return m_aiv.form(); }
|
||||
std::vector<Core::GeoPosition> form() const override { return m_aiv.form; }
|
||||
QPolygonF generateForm() override;
|
||||
AesType aesType() const override { return AesType::AtBoobyTrap; }
|
||||
bool isCentral() const override { return m_data.isCentral; }
|
||||
|
||||
+29
-29
@@ -36,7 +36,7 @@ Core::FunctionReplyObject ObjectBorderline::createObject(const Database::AesBord
|
||||
|
||||
m_data = dbData;
|
||||
m_data.effectStart = partitionTime();
|
||||
m_data.effectStateId = AreaEffectSimulation::AesEffectState_def::EsCreated;
|
||||
m_data.effectStateId = AreaEffectSimulation::AesEffectState::EsCreated;
|
||||
m_data.effectDuration = 0;
|
||||
m_data.chargeTypeId = 312; // see GearClass 1 -> 'pdm.pdm_charge_type' und 'pdm.pdm_gear_type_charge_type' in insert_pdm_values_xxx.sql
|
||||
|
||||
@@ -58,7 +58,7 @@ Core::FunctionReplyObject ObjectBorderline::createObject(const Database::AesBord
|
||||
{
|
||||
dbSegment.id = 0; // Reset for insert. Otherwise second segment cannot be inserted!
|
||||
dbSegment.borderlineId = m_data.privBorderlineId; // db
|
||||
dbSegment.position = QPointF(ddsSegments[i].lon(), ddsSegments[i].lat());
|
||||
dbSegment.position = QPointF(ddsSegments[i].lon, ddsSegments[i].lat);
|
||||
dbSegment.positionIndex = i;
|
||||
|
||||
if (!m_mainHandler->db()->insert(dbSegment))
|
||||
@@ -120,7 +120,7 @@ Core::FunctionReplyObject ObjectBorderline::updateObject(const Database::AesBord
|
||||
// update all segments in tmpDbSegments
|
||||
for (size_t i = 0; i < ddsSegments.size(); ++i)
|
||||
{
|
||||
tmpDbSegments[i].position = QPointF(ddsSegments[i].lon(), ddsSegments[i].lat());
|
||||
tmpDbSegments[i].position = QPointF(ddsSegments[i].lon, ddsSegments[i].lat);
|
||||
tmpDbSegments[i].positionIndex = i;
|
||||
}
|
||||
|
||||
@@ -174,19 +174,19 @@ void ObjectBorderline::onPublishData()
|
||||
|
||||
|
||||
AreaEffectSimulation::Borderline ddsData;
|
||||
ddsData.id(m_data.id);
|
||||
ddsData.name(m_data.name.toStdString());
|
||||
ddsData.operatorId(m_data.operatorId.isNull() ? 0 : m_data.operatorId.toInt());
|
||||
ddsData.isDeleted(effectState() == AesEffectState::EsRemoved);
|
||||
ddsData.isUsed(false);
|
||||
ddsData.sampleTime(m_mainHandler->dds()->currentPartitionTimeMSec());
|
||||
ddsData.chargeStruct().chargeTypeId(m_data.chargeTypeId);
|
||||
ddsData.effectDuration(m_data.effectDuration);
|
||||
ddsData.effectStart(toOptional(toMSec(m_data.effectStart)));
|
||||
ddsData.effectStateId(effectState());
|
||||
ddsData.partyId(toOptional(m_data.partyId));
|
||||
ddsData.participantId(toOptional(m_data.participantId));
|
||||
dbSegment2DdsSegment(m_dbSegments, ddsData.segments());
|
||||
ddsData.id = m_data.id;
|
||||
ddsData.name = m_data.name.toStdString();
|
||||
ddsData.operatorId = m_data.operatorId.isNull() ? 0 : m_data.operatorId.toInt();
|
||||
ddsData.isDeleted = effectState() == AesEffectState::EsRemoved;
|
||||
ddsData.isUsed = false;
|
||||
ddsData.sampleTime = m_mainHandler->dds()->currentPartitionTimeMSec();
|
||||
ddsData.chargeStruct.chargeTypeId = m_data.chargeTypeId;
|
||||
ddsData.effectDuration = m_data.effectDuration;
|
||||
ddsData.effectStart = toOptional(toMSec(m_data.effectStart));
|
||||
ddsData.effectStateId = effectState();
|
||||
ddsData.partyId = toOptional(m_data.partyId);
|
||||
ddsData.participantId = toOptional(m_data.participantId);
|
||||
dbSegment2DdsSegment(m_dbSegments, ddsData.segments);
|
||||
|
||||
if (!m_mainHandler->dds()->dts()->publish(ddsData))
|
||||
ERROR_LOG(m_logger) << "Error publishing AesBorderline-data to dds";
|
||||
@@ -203,10 +203,10 @@ void ObjectBorderline::publishAiv()
|
||||
poly[i] = m_dbSegments.at(i).position;
|
||||
|
||||
AesItemView aiv(m_aiv);
|
||||
aiv.aesItemId(m_data.id);
|
||||
aiv.chargeStruct().chargeTypeId(m_data.chargeTypeId);
|
||||
aiv.effectStart(partitionTimeMSec());
|
||||
ddsVecFromPoly(poly, aiv.form());
|
||||
aiv.aesItemId = m_data.id;
|
||||
aiv.chargeStruct.chargeTypeId = m_data.chargeTypeId;
|
||||
aiv.effectStart = partitionTimeMSec();
|
||||
ddsVecFromPoly(poly, aiv.form);
|
||||
|
||||
const QRectF bounds(poly.boundingRect());
|
||||
// Hack
|
||||
@@ -220,18 +220,18 @@ void ObjectBorderline::publishAiv()
|
||||
y_topRight = bounds.topRight().y();
|
||||
y_bottmLeft = bounds.bottomLeft().y();
|
||||
}
|
||||
aiv.boundingBoxBottomLeft(Core::GeoPosition2D(bounds.bottomLeft().x(), y_bottmLeft));
|
||||
aiv.boundingBoxTopRight(Core::GeoPosition2D(bounds.topRight().x(), y_topRight));
|
||||
aiv.aesTypeId(AesType::AtBorderline);
|
||||
aiv.effectStateId(effectState());
|
||||
aiv.id(1000 * m_data.id + AesType::AtBorderline);
|
||||
aiv.partyId(m_data.partyId);
|
||||
aiv.boundingBoxBottomLeft = Core::GeoPosition2D(bounds.bottomLeft().x(), y_bottmLeft);
|
||||
aiv.boundingBoxTopRight = Core::GeoPosition2D(bounds.topRight().x(), y_topRight);
|
||||
aiv.aesTypeId = AesType::AtBorderline;
|
||||
aiv.effectStateId = effectState();
|
||||
aiv.id = 1000 * m_data.id + static_cast<int>(AesType::AtBorderline);
|
||||
aiv.partyId = m_data.partyId;
|
||||
|
||||
checkIsCentralAndPublish(aiv.form(), m_aiv.form(), m_data.isCentral);
|
||||
checkIsCentralAndPublish(aiv.form, m_aiv.form, m_data.isCentral);
|
||||
|
||||
if (aiv != m_aiv)
|
||||
{
|
||||
aiv.sampleTime(partitionTimeMSec());
|
||||
aiv.sampleTime = partitionTimeMSec();
|
||||
m_aiv = aiv;
|
||||
m_mainHandler->dds()->dts()->publish(aiv);
|
||||
emit newAiv(aiv);
|
||||
@@ -243,7 +243,7 @@ void ObjectBorderline::removeTopics()
|
||||
{
|
||||
auto dts = m_mainHandler->dds()->dts();
|
||||
dts->removeBorderlineByKey(m_data.id);
|
||||
dts->removeAesItemViewByKey(1000 * m_data.id + AesType::AtBorderline);
|
||||
dts->removeAesItemViewByKey(1000 * m_data.id + static_cast<int>(AesType::AtBorderline));
|
||||
}
|
||||
|
||||
QPolygonF ObjectBorderline::generateForm()
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ public:
|
||||
|
||||
Core::FunctionReplyObject removeObject() override;
|
||||
|
||||
std::vector<Core::GeoPosition> form() const override { return m_aiv.form(); }
|
||||
std::vector<Core::GeoPosition> form() const override { return m_aiv.form; }
|
||||
QPolygonF generateForm() override;
|
||||
AesType aesType() const override { return AesType::AtBorderline; }
|
||||
bool isCentral() const override { return m_data.isCentral; }
|
||||
|
||||
+67
-67
@@ -24,7 +24,7 @@ ObjectChargeEffect::ObjectChargeEffect(MainHandler *mainHandler, QObject *parent
|
||||
: QObject(parent)
|
||||
, m_mainHandler(mainHandler)
|
||||
, m_trajectoryId(-1)
|
||||
, m_state(AesEffectState::inner_enum::EsUnknown)
|
||||
, m_state(AesEffectState::EsUnknown)
|
||||
, m_stateChanged(false)
|
||||
, m_stateTimer(new QTimer(this))
|
||||
, m_logger(getLogger(QStringLiteral("ObjectChargeEffect")))
|
||||
@@ -38,16 +38,16 @@ ObjectChargeEffect::ObjectChargeEffect(MainHandler *mainHandler, QObject *parent
|
||||
|
||||
Core::FunctionReplyObject ObjectChargeEffect::create(const ChargeEffectModifyRequest &data)
|
||||
{
|
||||
Core::FunctionReplyObject reply(data.id());
|
||||
Core::FunctionReplyObject reply(data.id);
|
||||
Database::AesChargeEffect dbData = functionTopicToDatabase(data);
|
||||
|
||||
if (!m_mainHandler)
|
||||
reply.setStr("Not possible to create ChargeEffect --> No MainHandler present.");
|
||||
else if (data.effectStart() < QDateTime::currentMSecsSinceEpoch())
|
||||
else if (data.effectStart < QDateTime::currentMSecsSinceEpoch())
|
||||
reply.setStr("Not possible to create ChargeEffect --> EffectStart has to be in the future.");
|
||||
else if (data.effectDuration() < 1000)
|
||||
else if (data.effectDuration < 1000)
|
||||
reply.setStr("Not possible to create ChargeEffect --> EffectDuration must be at least 1000ms.");
|
||||
else if (data.name().empty())
|
||||
else if (data.name.empty())
|
||||
reply.setStr("Not possible to create ChargeEffect --> Name must not be empty.");
|
||||
else if (!m_mainHandler->db()->insert(dbData))
|
||||
reply.setStr("Not possible to create ChargeEffect --> Database insert failed.");
|
||||
@@ -68,14 +68,14 @@ Core::FunctionReplyObject ObjectChargeEffect::create(const ChargeEffectModifyReq
|
||||
|
||||
Core::FunctionReplyObject ObjectChargeEffect::update(const ChargeEffectModifyRequest &data)
|
||||
{
|
||||
Core::FunctionReplyObject reply(data.id());
|
||||
Core::FunctionReplyObject reply(data.id);
|
||||
Database::AesChargeEffect dbData = functionTopicToDatabase(data);
|
||||
|
||||
if (!m_mainHandler)
|
||||
reply.setStr("Not possible to update ChargeEffect --> No MainHandler present.");
|
||||
else if (data.id() != m_data.id)
|
||||
else if (data.id != m_data.id)
|
||||
reply.setStr("Not possible to update ChargeEffect --> Id mismatch.");
|
||||
else if (m_state != AesEffectState::inner_enum::EsPrepared)
|
||||
else if (m_state != AesEffectState::EsPrepared)
|
||||
{
|
||||
// properties update is allowed!!!
|
||||
if (dbData.properties != m_data.properties)
|
||||
@@ -83,7 +83,7 @@ Core::FunctionReplyObject ObjectChargeEffect::update(const ChargeEffectModifyReq
|
||||
else
|
||||
reply.setStr("Not possible to update ChargeEffect --> It is not allowed to make changes EsState doesn't allow it.");
|
||||
}
|
||||
else if (data.name().empty())
|
||||
else if (data.name.empty())
|
||||
reply.setStr("Not possible to update ChargeEffect --> Name must not be empty.");
|
||||
else if (!hasChanges(dbData))
|
||||
reply.setStr("Not possible to update ChargeEffect --> There are no changes.");
|
||||
@@ -150,19 +150,19 @@ Database::AesChargeEffect ObjectChargeEffect::functionTopicToDatabase(const Char
|
||||
{
|
||||
Database::AesChargeEffect dbData;
|
||||
|
||||
dbData.id = data.id();
|
||||
dbData.name = QString::fromStdString(data.name());
|
||||
dbData.chargeTypeId = data.chargeTypeId();
|
||||
dbData.igniterTypeId = data.igniterTypeId();
|
||||
dbData.effectDuration = data.effectDuration();
|
||||
dbData.effectStart = QDateTime::fromMSecsSinceEpoch(data.effectStart());
|
||||
dbData.gearTypeId = data.gearTypeId();
|
||||
dbData.originatorId = data.originatorId();
|
||||
dbData.originatorTypeId = static_cast<int>(data.originatorTypeId().underlying());
|
||||
dbData.position.setX(data.position().lon());
|
||||
dbData.position.setY(data.position().lat());
|
||||
dbData.position.setZ(data.position().z());
|
||||
dbData.properties = QString::fromStdString(data.properties());
|
||||
dbData.id = data.id;
|
||||
dbData.name = QString::fromStdString(data.name);
|
||||
dbData.chargeTypeId = data.chargeTypeId;
|
||||
dbData.igniterTypeId = data.igniterTypeId;
|
||||
dbData.effectDuration = data.effectDuration;
|
||||
dbData.effectStart = QDateTime::fromMSecsSinceEpoch(data.effectStart);
|
||||
dbData.gearTypeId = data.gearTypeId;
|
||||
dbData.originatorId = data.originatorId;
|
||||
dbData.originatorTypeId = static_cast<int>(data.originatorTypeId);
|
||||
dbData.position.setX(data.position.lon);
|
||||
dbData.position.setY(data.position.lat);
|
||||
dbData.position.setZ(data.position.z);
|
||||
dbData.properties = QString::fromStdString(data.properties);
|
||||
|
||||
return dbData;
|
||||
}
|
||||
@@ -173,21 +173,21 @@ ChargeEffect ObjectChargeEffect::dataBaseToDataTopic(const Database::AesChargeEf
|
||||
{
|
||||
ChargeEffect dataTopic;
|
||||
|
||||
dataTopic.id(data.id);
|
||||
dataTopic.name(data.name.toStdString());
|
||||
dataTopic.chargeTypeId(data.chargeTypeId);
|
||||
dataTopic.effectDuration(data.effectDuration);
|
||||
dataTopic.effectStart(data.effectStart.toMSecsSinceEpoch());
|
||||
dataTopic.igniterTypeId(data.igniterTypeId);
|
||||
dataTopic.gearTypeId(data.gearTypeId);
|
||||
dataTopic.originatorId(data.originatorId);
|
||||
dataTopic.originatorTypeId(static_cast<ProjectDataManagement::StateChangeOriginator::inner_enum>(data.originatorTypeId));
|
||||
dataTopic.position().lon(data.position.x());
|
||||
dataTopic.position().lat(data.position.y());
|
||||
dataTopic.position().z(data.position.z());
|
||||
dataTopic.state(m_state);
|
||||
dataTopic.properties(data.properties.toStdString());
|
||||
dataTopic.sampleTime(m_mainHandler->dds()->currentPartitionTimeMSec());
|
||||
dataTopic.id = data.id;
|
||||
dataTopic.name = data.name.toStdString();
|
||||
dataTopic.chargeTypeId = data.chargeTypeId;
|
||||
dataTopic.effectDuration = data.effectDuration;
|
||||
dataTopic.effectStart = data.effectStart.toMSecsSinceEpoch();
|
||||
dataTopic.igniterTypeId = data.igniterTypeId;
|
||||
dataTopic.gearTypeId = data.gearTypeId;
|
||||
dataTopic.originatorId = data.originatorId;
|
||||
dataTopic.originatorTypeId = static_cast<ProjectDataManagement::StateChangeOriginator>(data.originatorTypeId);
|
||||
dataTopic.position.lon = data.position.x();
|
||||
dataTopic.position.lat = data.position.y();
|
||||
dataTopic.position.z = data.position.z();
|
||||
dataTopic.state = m_state;
|
||||
dataTopic.properties = data.properties.toStdString();
|
||||
dataTopic.sampleTime = m_mainHandler->dds()->currentPartitionTimeMSec();
|
||||
|
||||
return dataTopic;
|
||||
}
|
||||
@@ -243,24 +243,24 @@ bool ObjectChargeEffect::isFinished() const
|
||||
|
||||
void ObjectChargeEffect::onStateTimerTimeout()
|
||||
{
|
||||
switch (m_state.underlying())
|
||||
switch (m_state)
|
||||
{
|
||||
case AesEffectState::inner_enum::EsPrepared:
|
||||
case AesEffectState::inner_enum::EsActivated:
|
||||
case AesEffectState::EsPrepared:
|
||||
case AesEffectState::EsActivated:
|
||||
setNextState();
|
||||
startStateTimer();
|
||||
publish();
|
||||
|
||||
return;
|
||||
case AesEffectState::inner_enum::EsExpired:
|
||||
case AesEffectState::EsExpired:
|
||||
emit finished(m_data.id);
|
||||
|
||||
return;
|
||||
case AesEffectState::inner_enum::EsUnknown:
|
||||
case AesEffectState::inner_enum::EsError:
|
||||
case AesEffectState::inner_enum::EsRemoved:
|
||||
case AesEffectState::inner_enum::EsCreated:
|
||||
case AesEffectState::inner_enum::EsPaused:
|
||||
case AesEffectState::EsUnknown:
|
||||
case AesEffectState::EsError:
|
||||
case AesEffectState::EsRemoved:
|
||||
case AesEffectState::EsCreated:
|
||||
case AesEffectState::EsPaused:
|
||||
default:
|
||||
return;
|
||||
}
|
||||
@@ -273,20 +273,20 @@ void ObjectChargeEffect::setNextState()
|
||||
AesEffectState oldState = m_state;
|
||||
m_stateChanged = false;
|
||||
|
||||
switch (m_state.underlying())
|
||||
switch (m_state)
|
||||
{
|
||||
case AesEffectState::inner_enum::EsPrepared:
|
||||
case AesEffectState::EsPrepared:
|
||||
m_state = AesEffectState::EsActivated;
|
||||
break;
|
||||
case AesEffectState::inner_enum::EsActivated:
|
||||
case AesEffectState::EsActivated:
|
||||
m_state = AesEffectState::EsExpired;
|
||||
break;
|
||||
case AesEffectState::inner_enum::EsExpired:
|
||||
case AesEffectState::inner_enum::EsUnknown:
|
||||
case AesEffectState::inner_enum::EsError:
|
||||
case AesEffectState::inner_enum::EsRemoved:
|
||||
case AesEffectState::inner_enum::EsCreated:
|
||||
case AesEffectState::inner_enum::EsPaused:
|
||||
case AesEffectState::EsExpired:
|
||||
case AesEffectState::EsUnknown:
|
||||
case AesEffectState::EsError:
|
||||
case AesEffectState::EsRemoved:
|
||||
case AesEffectState::EsCreated:
|
||||
case AesEffectState::EsPaused:
|
||||
default:
|
||||
m_state = AesEffectState::EsUnknown;
|
||||
break;
|
||||
@@ -309,11 +309,11 @@ void ObjectChargeEffect::calculateInitEffectState()
|
||||
m_stateChanged = false;
|
||||
|
||||
if (QDateTime::currentMSecsSinceEpoch() < effectStartMsecs)
|
||||
m_state = AesEffectState::inner_enum::EsPrepared;
|
||||
m_state = AesEffectState::EsPrepared;
|
||||
else if (QDateTime::currentMSecsSinceEpoch() >= effectStartMsecs && QDateTime::currentMSecsSinceEpoch() < durationEndMsecs)
|
||||
m_state = AesEffectState::inner_enum::EsActivated;
|
||||
m_state = AesEffectState::EsActivated;
|
||||
else // expired
|
||||
m_state = AesEffectState::inner_enum::EsExpired;
|
||||
m_state = AesEffectState::EsExpired;
|
||||
|
||||
if (oldState != m_state)
|
||||
m_stateChanged = true;
|
||||
@@ -324,9 +324,9 @@ void ObjectChargeEffect::calculateInitEffectState()
|
||||
|
||||
void ObjectChargeEffect::startStateTimer()
|
||||
{
|
||||
switch (m_state.underlying())
|
||||
switch (m_state)
|
||||
{
|
||||
case AesEffectState::inner_enum::EsPrepared:
|
||||
case AesEffectState::EsPrepared:
|
||||
{
|
||||
qint64 timeToActivatedMsecs = m_data.effectStart.toMSecsSinceEpoch() - QDateTime::currentMSecsSinceEpoch();
|
||||
|
||||
@@ -336,7 +336,7 @@ void ObjectChargeEffect::startStateTimer()
|
||||
|
||||
return;
|
||||
}
|
||||
case AesEffectState::inner_enum::EsActivated:
|
||||
case AesEffectState::EsActivated:
|
||||
{
|
||||
qint64 timeToExpiredMsecs = m_data.effectStart.toMSecsSinceEpoch() + m_data.effectDuration - QDateTime::currentMSecsSinceEpoch();
|
||||
|
||||
@@ -346,7 +346,7 @@ void ObjectChargeEffect::startStateTimer()
|
||||
|
||||
return;
|
||||
}
|
||||
case AesEffectState::inner_enum::EsExpired:
|
||||
case AesEffectState::EsExpired:
|
||||
{
|
||||
qint64 timeToFinishMsecs = m_data.effectStart.toMSecsSinceEpoch() + m_data.effectDuration + s_afterglowMsecs - QDateTime::currentMSecsSinceEpoch();
|
||||
|
||||
@@ -356,11 +356,11 @@ void ObjectChargeEffect::startStateTimer()
|
||||
|
||||
return;
|
||||
}
|
||||
case AesEffectState::inner_enum::EsUnknown:
|
||||
case AesEffectState::inner_enum::EsError:
|
||||
case AesEffectState::inner_enum::EsRemoved:
|
||||
case AesEffectState::inner_enum::EsCreated:
|
||||
case AesEffectState::inner_enum::EsPaused:
|
||||
case AesEffectState::EsUnknown:
|
||||
case AesEffectState::EsError:
|
||||
case AesEffectState::EsRemoved:
|
||||
case AesEffectState::EsCreated:
|
||||
case AesEffectState::EsPaused:
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
+32
-32
@@ -72,7 +72,7 @@ Core::FunctionReplyObject ObjectDangerArea::createObject(const Database::AesDang
|
||||
Database::AesDangerSegment segment;
|
||||
segment.id = 0;
|
||||
segment.dangerAreaId = m_data.privDangerAreaId; // db
|
||||
segment.position = QPointF(segmentDds.lon(), segmentDds.lat());
|
||||
segment.position = QPointF(segmentDds.lon, segmentDds.lat);
|
||||
// will update segment.id
|
||||
if (!m_mainHandler->db()->insert(segment))
|
||||
return Core::FunctionReplyObject(getRightId(m_data.id, originOc), tr_lts("dds", "Error inserting AesDangerSegment-data into database."));
|
||||
@@ -128,7 +128,7 @@ Core::FunctionReplyObject ObjectDangerArea::updateObject(const Database::AesDang
|
||||
tmpSegments.resize(newSegmentSize); // if count is decreased
|
||||
|
||||
for (size_t i = 0; i < segments.size(); ++i)
|
||||
tmpSegments[i].position = QPointF(segments[i].lon(), segments[i].lat());
|
||||
tmpSegments[i].position = QPointF(segments[i].lon, segments[i].lat);
|
||||
|
||||
for (const Database::AesDangerSegment &segment : qAsConst(tmpSegments))
|
||||
{
|
||||
@@ -174,7 +174,7 @@ void ObjectDangerArea::onPublishData()
|
||||
m_data.properties.toStdString(),
|
||||
{},
|
||||
toOptional(m_data.associatedAesId));
|
||||
dbSegment2DdsSegment(m_segments, ddsData.segments());
|
||||
dbSegment2DdsSegment(m_segments, ddsData.segments);
|
||||
|
||||
m_mainHandler->dds()->dts()->publish(ddsData);
|
||||
publishAiv();
|
||||
@@ -191,30 +191,30 @@ void ObjectDangerArea::publishAiv()
|
||||
poly[i] = m_segments.at(i).position;
|
||||
|
||||
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.aesItemId = m_data.id;
|
||||
aiv.chargeStruct.chargeTypeId = m_data.chargeTypeId;
|
||||
aiv.effectStart = toMSec(m_data.effectStart);
|
||||
ddsVecFromPoly(poly, aiv.form);
|
||||
const QRectF bounds(poly.boundingRect());
|
||||
aiv.boundingBoxBottomLeft(Core::GeoPosition2D(bounds.bottomLeft().x(), bounds.bottomLeft().y()));
|
||||
aiv.boundingBoxTopRight(Core::GeoPosition2D(bounds.topRight().x(), bounds.topRight().y()));
|
||||
aiv.aesTypeId(AesType::AtDangerArea);
|
||||
aiv.effectStateId(effectState());
|
||||
aiv.id(1000 * m_data.id + AesType::AtDangerArea);
|
||||
aiv.partyId(0);
|
||||
aiv.boundingBoxBottomLeft = Core::GeoPosition2D(bounds.bottomLeft().x(), bounds.bottomLeft().y());
|
||||
aiv.boundingBoxTopRight = Core::GeoPosition2D(bounds.topRight().x(), bounds.topRight().y());
|
||||
aiv.aesTypeId = AesType::AtDangerArea;
|
||||
aiv.effectStateId = effectState();
|
||||
aiv.id = 1000 * m_data.id + static_cast<int>(AesType::AtDangerArea);
|
||||
aiv.partyId = 0;
|
||||
|
||||
checkIsCentralAndPublish(aiv.form(), m_aiv.form(), m_data.isCentral);
|
||||
checkIsCentralAndPublish(aiv.form, m_aiv.form, m_data.isCentral);
|
||||
|
||||
if (aiv != m_aiv)
|
||||
{
|
||||
aiv.sampleTime(partitionTimeMSec());
|
||||
aiv.sampleTime = partitionTimeMSec();
|
||||
m_aiv = aiv;
|
||||
m_mainHandler->dds()->dts()->publish(aiv);
|
||||
emit newAiv(aiv);
|
||||
}
|
||||
|
||||
m_zone = LtsCoordTrans::UtmCoordinate::fromGeographic(poly[0]).zone;
|
||||
m_utmPoly = utmPolyFromGeoVec(aiv.form(), m_zone);
|
||||
m_utmPoly = utmPolyFromGeoVec(aiv.form, m_zone);
|
||||
onUpdateCorrelation();
|
||||
|
||||
}
|
||||
@@ -224,13 +224,13 @@ QPolygonF ObjectDangerArea::utmPolyFromGeoVec(const std::vector<Core::GeoPositio
|
||||
if (geoPos.size() == 0)
|
||||
return QPolygonF();
|
||||
|
||||
int actZone = LtsCoordTrans::UtmCoordinate::fromGeographic(geoPos.at(0).lon(),geoPos.at(0).lat(), zone).zone;
|
||||
int actZone = LtsCoordTrans::UtmCoordinate::fromGeographic(geoPos.at(0).lon,geoPos.at(0).lat, zone).zone;
|
||||
|
||||
QPolygonF retVal(geoPos.size());
|
||||
int i=0;
|
||||
for(const auto &pos : geoPos)
|
||||
{
|
||||
LtsCoordTrans::UtmCoordinate utm = LtsCoordTrans::UtmCoordinate::fromGeographic(QPointF(pos.lon(), pos.lat()), actZone);
|
||||
LtsCoordTrans::UtmCoordinate utm = LtsCoordTrans::UtmCoordinate::fromGeographic(QPointF(pos.lon, pos.lat), actZone);
|
||||
retVal[i++] = QPointF(utm.x, utm.y);
|
||||
}
|
||||
return retVal;
|
||||
@@ -240,7 +240,7 @@ void ObjectDangerArea::removeTopics()
|
||||
{
|
||||
auto dts = m_mainHandler->dds()->dts();
|
||||
dts->removeDangerAreaByKey(m_data.id);
|
||||
dts->removeAesItemViewByKey(1000 * m_data.id + AesType::inner_enum::AtDangerArea);
|
||||
dts->removeAesItemViewByKey(1000 * m_data.id + static_cast<int>(AesType::AtDangerArea));
|
||||
for (int idx : qAsConst(m_correlatedAesItems))
|
||||
dts->removeDangerAreaCorrelatedAesItemByKey(idForCorrelatedItem(idx));
|
||||
m_correlatedAesItems.clear();
|
||||
@@ -285,9 +285,9 @@ void ObjectDangerArea::onUpdateCorrelation()
|
||||
for(int newItem : newItems)
|
||||
{
|
||||
DangerAreaCorrelatedAesItem item;
|
||||
item.id(idForCorrelatedItem(newItem));
|
||||
item.aesItemId(newItem);
|
||||
item.dangerAreaId(m_data.id); // on dds - correct
|
||||
item.id = idForCorrelatedItem(newItem);
|
||||
item.aesItemId = newItem;
|
||||
item.dangerAreaId = m_data.id; // on dds - correct
|
||||
m_mainHandler->dds()->dts()->publish(item);
|
||||
}
|
||||
|
||||
@@ -303,30 +303,30 @@ void ObjectDangerArea::onNewAiv(const AesItemView &itemView)
|
||||
// Warning: TypeId not in Key, so don't process multiple AIV per Type!
|
||||
|
||||
// Todo: Change here if more than BC is needed
|
||||
if (itemView.aesTypeId() != AesType_def::AtBCContamination)
|
||||
if (itemView.aesTypeId != AesType::AtBCContamination)
|
||||
return;
|
||||
|
||||
if (effectState() != AesEffectState_def::EsActivated ||
|
||||
itemView.effectStateId() != AesEffectState_def::EsActivated)
|
||||
if (effectState() != AesEffectState::EsActivated ||
|
||||
itemView.effectStateId != AesEffectState::EsActivated)
|
||||
{
|
||||
// If ES of this DA or the Contamination changed from(!) Activated to Whatever, kill the correlation
|
||||
m_mainHandler->dds()->dts()->removeDangerAreaCorrelatedAesItemByKey(idForCorrelatedItem(itemView.aesItemId()));
|
||||
m_mainHandler->dds()->dts()->removeDangerAreaCorrelatedAesItemByKey(idForCorrelatedItem(itemView.aesItemId));
|
||||
return;
|
||||
}
|
||||
|
||||
DEBUG_LOG(m_logger) << "New Aiv iof Type BC Contamination: " << itemView.aesItemId();
|
||||
QPolygonF utmPolyBc = utmPolyFromGeoVec(itemView.form(), m_zone);
|
||||
DEBUG_LOG(m_logger) << "New Aiv iof Type BC Contamination: " << itemView.aesItemId;
|
||||
QPolygonF utmPolyBc = utmPolyFromGeoVec(itemView.form, m_zone);
|
||||
if (!intersects(m_utmPoly, utmPolyBc))
|
||||
return;
|
||||
|
||||
DEBUG_LOG(m_logger) << "intersects with Danger Area:" << m_data.id;
|
||||
|
||||
DangerAreaCorrelatedAesItem item;
|
||||
item.id(idForCorrelatedItem(itemView.aesItemId()));
|
||||
item.aesItemId(itemView.aesItemId());
|
||||
item.dangerAreaId(m_data.id);
|
||||
item.id = idForCorrelatedItem(itemView.aesItemId);
|
||||
item.aesItemId = itemView.aesItemId;
|
||||
item.dangerAreaId = m_data.id;
|
||||
m_mainHandler->dds()->dts()->publish(item);
|
||||
m_correlatedAesItems += itemView.aesItemId();
|
||||
m_correlatedAesItems += itemView.aesItemId;
|
||||
}
|
||||
|
||||
void ObjectDangerArea::onRemoveAiv(int32_t aesItemId)
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ public:
|
||||
|
||||
QVector<Database::AesDangerSegment> segments() const { return m_segments; }
|
||||
|
||||
std::vector<Core::GeoPosition> form() const override { return m_aiv.form(); }
|
||||
std::vector<Core::GeoPosition> form() const override { return m_aiv.form; }
|
||||
QPolygonF generateForm() override;
|
||||
AesType aesType() const override { return AesType::AtDangerArea; }
|
||||
bool isCentral() const override { return m_data.isCentral; }
|
||||
|
||||
+283
-283
File diff suppressed because it is too large.
Load diff
+1
-1
@@ -96,7 +96,7 @@ public:
|
||||
bool initialCalculations(QString *reasonOut = nullptr);
|
||||
void abortPreStartTimer();
|
||||
|
||||
std::vector<Core::GeoPosition> form() const override { return m_aiv.form(); }
|
||||
std::vector<Core::GeoPosition> form() const override { return m_aiv.form; }
|
||||
QPolygonF generateForm() override;
|
||||
AesType aesType() const override { return AesType::AtExplosionArea; }
|
||||
bool isCentral() const override { return m_data.isCentral; }
|
||||
|
||||
+10
-10
@@ -169,10 +169,10 @@ void ObjectEffector::sendEffectorToDds()
|
||||
DEBUG_LOG(m_logger) << "sendEffectorToDds NewState= " << m_effectorStateMachine->getCurrentStateStr() << ", participantId=" << m_participantId
|
||||
<< ", aesItemId=" << m_aesItemId;
|
||||
AreaEffectSimulation::Effector effector;
|
||||
effector.id(m_participantId);
|
||||
effector.effectorState(m_effectorStateMachine->getCurrentState());
|
||||
effector.aesItemId(m_aesItemId);
|
||||
effector.participantId(m_participantId);
|
||||
effector.id = m_participantId;
|
||||
effector.effectorState = m_effectorStateMachine->getCurrentState();
|
||||
effector.aesItemId = m_aesItemId;
|
||||
effector.participantId = m_participantId;
|
||||
m_mainHandler->dds()->dts()->publish(effector);
|
||||
}
|
||||
|
||||
@@ -205,20 +205,20 @@ void ObjectEffector::setIndendedTrajectory(const std::vector<Core::RelativePosit
|
||||
m_intendendTrajectory.clear();
|
||||
for (const Core::RelativePositionRelativeTime &geoPosRelTime : geometryRelativeToLaunchOrigin)
|
||||
{
|
||||
double t = geoPosRelTime.relativeTime();
|
||||
double x = geoPosRelTime.offsetX();
|
||||
double y = geoPosRelTime.offsetY();
|
||||
double z = geoPosRelTime.offsetZ();
|
||||
double t = geoPosRelTime.relativeTime;
|
||||
double x = geoPosRelTime.offsetX;
|
||||
double y = geoPosRelTime.offsetY;
|
||||
double z = geoPosRelTime.offsetZ;
|
||||
m_intendendTrajectory.push_back({LtsUtils::QPoint3D(x, y, z), t});
|
||||
}
|
||||
}
|
||||
|
||||
void ObjectEffector::setEffectorData(const EffectorData &effectorData)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "setEffectorData" << ", effectorData.properties() = '" << effectorData.properties() << "'";
|
||||
DEBUG_LOG(m_logger) << "setEffectorData" << ", effectorData.properties() = '" << effectorData.properties << "'";
|
||||
|
||||
m_effectorData = effectorData;
|
||||
setIndendedTrajectory(effectorData.trajectoryRelative());
|
||||
setIndendedTrajectory(effectorData.trajectoryRelative);
|
||||
delete m_firingStrategy;
|
||||
m_firingStrategy = FiringStrategyFactory::createFiringStrategy(this);
|
||||
connect(m_firingStrategy, &AbstractFiringStrategy::signalFired,
|
||||
|
||||
+38
-38
@@ -176,15 +176,15 @@ bool ObjectExplosionArea::removeObjectFromDb()
|
||||
|
||||
Core::FunctionReplyObject ObjectExplosionArea::resumePause(const ExplosionAreaPauseResumeRequest &req)
|
||||
{
|
||||
if (req.resumeExecution())
|
||||
if (req.resumeExecution)
|
||||
{
|
||||
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
|
||||
|
||||
@@ -262,38 +262,38 @@ void ObjectExplosionArea::publishAiv()
|
||||
const QRectF bounds(poly.boundingRect());
|
||||
|
||||
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::AtExplosionArea);
|
||||
aiv.effectStateId(effectState());
|
||||
aiv.id(1000 * m_data.id + AesType::AtExplosionArea);
|
||||
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::AtExplosionArea;
|
||||
aiv.effectStateId = effectState();
|
||||
aiv.id = 1000 * m_data.id + static_cast<int>(AesType::AtExplosionArea);
|
||||
if (m_data.partyId != 0)
|
||||
aiv.partyId(m_data.partyId);
|
||||
aiv.partyId = m_data.partyId;
|
||||
|
||||
checkIsCentralAndPublish(aiv.form(), m_aiv.form(), m_data.isCentral);
|
||||
checkIsCentralAndPublish(aiv.form, m_aiv.form, m_data.isCentral);
|
||||
|
||||
const QVector<QPointF> singleExplosions = Polygons::explosionAreaSingleExplosions(data());
|
||||
|
||||
AesItemView aiv2(m_aiv2);
|
||||
aiv2.aesItemId(m_data.id);
|
||||
aiv2.chargeStruct().chargeTypeId(m_data.chargeTypeId);
|
||||
aiv2.effectStart(toMSec(m_data.effectStart));
|
||||
ddsVecFromPoly(singleExplosions, aiv2.form());
|
||||
aiv2.boundingBoxBottomLeft(aiv.boundingBoxBottomLeft());
|
||||
aiv2.boundingBoxTopRight(aiv.boundingBoxTopRight());
|
||||
aiv2.aesTypeId(AesType::AtExplosionAreaSingleExplosions);
|
||||
aiv2.id(1000 * m_data.id + AesType::AtExplosionAreaSingleExplosions);
|
||||
aiv2.effectStateId(effectState());
|
||||
aiv2.aesItemId = m_data.id;
|
||||
aiv2.chargeStruct.chargeTypeId = m_data.chargeTypeId;
|
||||
aiv2.effectStart = toMSec(m_data.effectStart);
|
||||
ddsVecFromPoly(singleExplosions, aiv2.form);
|
||||
aiv2.boundingBoxBottomLeft = aiv.boundingBoxBottomLeft;
|
||||
aiv2.boundingBoxTopRight = aiv.boundingBoxTopRight;
|
||||
aiv2.aesTypeId = AesType::AtExplosionAreaSingleExplosions;
|
||||
aiv2.id = 1000 * m_data.id + static_cast<int>(AesType::AtExplosionAreaSingleExplosions);
|
||||
aiv2.effectStateId = effectState();
|
||||
if (m_data.partyId != 0)
|
||||
aiv2.partyId(m_data.partyId);
|
||||
aiv2.partyId = m_data.partyId;
|
||||
|
||||
if (aiv != m_aiv)
|
||||
{
|
||||
aiv.sampleTime(partitionTimeMSec());
|
||||
aiv.sampleTime = partitionTimeMSec();
|
||||
m_aiv = aiv;
|
||||
m_mainHandler->dds()->dts()->publish(aiv);
|
||||
emit newAiv(aiv);
|
||||
@@ -301,7 +301,7 @@ void ObjectExplosionArea::publishAiv()
|
||||
|
||||
if (aiv2 != m_aiv2)
|
||||
{
|
||||
aiv2.sampleTime(partitionTimeMSec());
|
||||
aiv2.sampleTime = partitionTimeMSec();
|
||||
m_aiv2 = aiv2;
|
||||
m_mainHandler->dds()->dts()->publish(aiv2);
|
||||
emit newAiv(aiv2);
|
||||
@@ -312,8 +312,8 @@ void ObjectExplosionArea::removeTopics()
|
||||
{
|
||||
auto dts = m_mainHandler->dds()->dts();
|
||||
dts->removeExplosionAreaByKey(m_data.id);
|
||||
dts->removeAesItemViewByKey(1000 * m_data.id + AesType::AtExplosionArea);
|
||||
dts->removeAesItemViewByKey(1000 * m_data.id + AesType::AtExplosionAreaSingleExplosions);
|
||||
dts->removeAesItemViewByKey(1000 * m_data.id + static_cast<int>(AesType::AtExplosionArea));
|
||||
dts->removeAesItemViewByKey(1000 * m_data.id + static_cast<int>(AesType::AtExplosionAreaSingleExplosions));
|
||||
emit removeAiv(m_data.id);
|
||||
}
|
||||
|
||||
@@ -336,7 +336,7 @@ void ObjectExplosionArea::stopSingleExplosionHandling(AesEffectState newState)
|
||||
{
|
||||
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());
|
||||
@@ -401,18 +401,18 @@ void ObjectExplosionArea::checkNextSingleExplosion()
|
||||
|
||||
// publish new triggered explosions data here
|
||||
TriggeredImpacts ti;
|
||||
ti.id(1000 * m_data.id + AesType::AtExplosionAreaSingleExplosions);
|
||||
ti.aesItemId(m_data.id);
|
||||
ti.aesTypeId(AesType::AtExplosionAreaSingleExplosions);
|
||||
ti.sampleTime(partitionTimeMSec());
|
||||
ti.id = 1000 * m_data.id + static_cast<int>(AesType::AtExplosionAreaSingleExplosions);
|
||||
ti.aesItemId = m_data.id;
|
||||
ti.aesTypeId = AesType::AtExplosionAreaSingleExplosions;
|
||||
ti.sampleTime = partitionTimeMSec();
|
||||
|
||||
ti.impactCount(impactCount);
|
||||
ti.bitfield().resize((impactCount + 7) / 8);
|
||||
ti.impactCount = impactCount;
|
||||
ti.bitfield.resize((impactCount + 7) / 8);
|
||||
// not very fast but ok for now
|
||||
for(int i = 0; i < impactCount; ++i)
|
||||
{
|
||||
// Triggered Impact == 0, if impact has taken place
|
||||
LtsUtils::BitArray::setBit(ti.bitfield(), i, i >= curExplosionNumber); // not "<" -> explosion NUMBER
|
||||
LtsUtils::BitArray::setBit(ti.bitfield, i, i >= curExplosionNumber); // not "<" -> explosion NUMBER
|
||||
}
|
||||
|
||||
DEBUG_LOG(m_logger) << "Publishing TriggeredExplosions with curExplosionNumber " << curExplosionNumber;
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ public:
|
||||
bool removeObjectFromDb();
|
||||
Core::FunctionReplyObject resumePause(const ExplosionAreaPauseResumeRequest &req);
|
||||
|
||||
std::vector<Core::GeoPosition> form() const override { return m_aiv.form(); }
|
||||
std::vector<Core::GeoPosition> form() const override { return m_aiv.form; }
|
||||
QPolygonF generateForm() override;
|
||||
AesType aesType() const override { return AesType::AtExplosionArea; }
|
||||
bool isCentral() const override { return m_data.isCentral; }
|
||||
|
||||
+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;
|
||||
}
|
||||
|
||||
+1
-1
@@ -79,7 +79,7 @@ public:
|
||||
bool initialCalculations(QString *reasonOut = nullptr);
|
||||
void abortPreStartTimer();
|
||||
|
||||
std::vector<Core::GeoPosition> form() const override { return m_aiv.form(); }
|
||||
std::vector<Core::GeoPosition> form() const override { return m_aiv.form; }
|
||||
QPolygonF generateForm() override;
|
||||
AesType aesType() const override { return AesType::AtExplosionArea; }
|
||||
bool isCentral() const override { return m_data.isCentral; }
|
||||
|
||||
+13
-13
@@ -169,23 +169,23 @@ void ObjectExplosionSingle::publishAiv()
|
||||
const QRectF bounds(poly.boundingRect());
|
||||
|
||||
AesItemView aiv(m_aiv);
|
||||
aiv.aesItemId(m_data.id);
|
||||
aiv.chargeStruct().chargeTypeId(m_data.chargeTypeId);
|
||||
ddsVecFromPoly(poly, aiv.form());
|
||||
aiv.effectStart(toMSec(m_data.effectStart));
|
||||
aiv.boundingBoxBottomLeft(Core::GeoPosition2D(bounds.bottomLeft().x(), bounds.bottomLeft().y()));
|
||||
aiv.boundingBoxTopRight(Core::GeoPosition2D(bounds.topRight().x(), bounds.topRight().y()));
|
||||
aiv.aesTypeId(AesType::AtExplosionSingle);
|
||||
aiv.effectStateId(effectState());
|
||||
aiv.id(1000 * m_data.id + AesType::AtExplosionSingle);
|
||||
aiv.aesItemId = m_data.id;
|
||||
aiv.chargeStruct.chargeTypeId = m_data.chargeTypeId;
|
||||
ddsVecFromPoly(poly, aiv.form);
|
||||
aiv.effectStart = toMSec(m_data.effectStart);
|
||||
aiv.boundingBoxBottomLeft = Core::GeoPosition2D(bounds.bottomLeft().x(), bounds.bottomLeft().y());
|
||||
aiv.boundingBoxTopRight = Core::GeoPosition2D(bounds.topRight().x(), bounds.topRight().y());
|
||||
aiv.aesTypeId = AesType::AtExplosionSingle;
|
||||
aiv.effectStateId = effectState();
|
||||
aiv.id = 1000 * m_data.id + static_cast<int>(AesType::AtExplosionSingle);
|
||||
if (m_data.partyId != 0)
|
||||
aiv.partyId(m_data.partyId);
|
||||
aiv.partyId = m_data.partyId;
|
||||
|
||||
checkIsCentralAndPublish(aiv.form(), m_aiv.form(), m_data.isCentral);
|
||||
checkIsCentralAndPublish(aiv.form, m_aiv.form, m_data.isCentral);
|
||||
|
||||
if (aiv != m_aiv)
|
||||
{
|
||||
aiv.sampleTime(partitionTimeMSec());
|
||||
aiv.sampleTime = partitionTimeMSec();
|
||||
m_aiv = aiv;
|
||||
m_mainHandler->dds()->dts()->publish(aiv);
|
||||
emit newAiv(aiv);
|
||||
@@ -196,7 +196,7 @@ void ObjectExplosionSingle::removeTopics()
|
||||
{
|
||||
auto dts = m_mainHandler->dds()->dts();
|
||||
dts->removeExplosionSingleByKey(m_data.id);
|
||||
dts->removeAesItemViewByKey(1000 * m_data.id + AesType::AtExplosionSingle);
|
||||
dts->removeAesItemViewByKey(1000 * m_data.id + static_cast<int>(AesType::AtExplosionSingle));
|
||||
emit removeAiv(m_data.id);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ public:
|
||||
bool removeObjectFromDb();
|
||||
|
||||
|
||||
std::vector<Core::GeoPosition> form() const override { return m_aiv.form(); }
|
||||
std::vector<Core::GeoPosition> form() const override { return m_aiv.form; }
|
||||
QPolygonF generateForm() override;
|
||||
AesType aesType() const override { return AesType::AtExplosionSingle; }
|
||||
bool isCentral() const override { return m_data.isCentral; }
|
||||
|
||||
+32
-32
@@ -42,7 +42,7 @@ Core::FunctionReplyObject ObjectFunctionalArea::createObject(const Database::Aes
|
||||
m_dataAesFunctionalArea = data;
|
||||
|
||||
|
||||
if (data.supplyMode == AesOperatingMode_def::OmWaitingTime)
|
||||
if (data.supplyMode == AesOperatingMode::OmWaitingTime)
|
||||
{
|
||||
setIsCentral = true;
|
||||
m_data.participantId = data.participantId;
|
||||
@@ -198,23 +198,23 @@ void ObjectFunctionalArea::publishAiv()
|
||||
const QRectF bounds(poly.boundingRect());
|
||||
|
||||
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.bottomLeft().x(), bounds.bottomLeft().y()));
|
||||
aiv.boundingBoxTopRight(Core::GeoPosition2D(bounds.topRight().x(), bounds.topRight().y()));
|
||||
aiv.aesTypeId(AesType::AtFunctionalArea);
|
||||
aiv.effectStateId(effectState());
|
||||
aiv.id(1000 * m_data.id + AesType::AtFunctionalArea);
|
||||
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.bottomLeft().x(), bounds.bottomLeft().y());
|
||||
aiv.boundingBoxTopRight = Core::GeoPosition2D(bounds.topRight().x(), bounds.topRight().y());
|
||||
aiv.aesTypeId = AesType::AtFunctionalArea;
|
||||
aiv.effectStateId = effectState();
|
||||
aiv.id = 1000 * m_data.id + static_cast<int>(AesType::AtFunctionalArea);
|
||||
if (m_data.partyId != 0)
|
||||
aiv.partyId(m_data.partyId);
|
||||
aiv.partyId = m_data.partyId;
|
||||
|
||||
checkIsCentralAndPublish(aiv.form(), m_aiv.form(), m_data.isCentral);
|
||||
checkIsCentralAndPublish(aiv.form, m_aiv.form, m_data.isCentral);
|
||||
|
||||
if (aiv != m_aiv)
|
||||
{
|
||||
aiv.sampleTime(partitionTimeMSec());
|
||||
aiv.sampleTime = partitionTimeMSec();
|
||||
m_aiv = aiv;
|
||||
m_mainHandler->dds()->dts()->publish(aiv);
|
||||
emit newAiv(aiv);
|
||||
@@ -225,7 +225,7 @@ void ObjectFunctionalArea::removeTopics()
|
||||
{
|
||||
auto dts = m_mainHandler->dds()->dts();
|
||||
dts->removeFunctionalAreaByKey(m_data.id);
|
||||
dts->removeAesItemViewByKey(1000 * m_data.id + AesType::AtFunctionalArea);
|
||||
dts->removeAesItemViewByKey(1000 * m_data.id + static_cast<int>(AesType::AtFunctionalArea));
|
||||
emit removeAiv(m_data.id);
|
||||
}
|
||||
|
||||
@@ -237,7 +237,7 @@ QPolygonF ObjectFunctionalArea::generateForm()
|
||||
QPointF ObjectFunctionalArea::geographic2Utm(const Core::GeoPosition2D &geoPos, int *zone)
|
||||
{
|
||||
const int zoneToUse = zone ? *zone : -1;
|
||||
auto utm = LtsCoordTrans::UtmCoordinate::fromGeographic(geoPos.lon(), geoPos.lat(), zoneToUse);
|
||||
auto utm = LtsCoordTrans::UtmCoordinate::fromGeographic(geoPos.lon, geoPos.lat, zoneToUse);
|
||||
if (zone)
|
||||
*zone = utm.zone;
|
||||
return QPointF(utm.x, utm.y);
|
||||
@@ -247,10 +247,10 @@ QPointF ObjectFunctionalArea::geographic2Utm(const Core::GeoPosition2D &geoPos,
|
||||
void ObjectFunctionalArea::onParticipantPositionChanged(const ParticipantManagement::ParticipantPosition &data, DataModification modType)
|
||||
{
|
||||
|
||||
if (modType != DataModification::eRemoved && (data.participantId() == m_data.participantId))
|
||||
if (modType != DataModification::eRemoved && (data.participantId == m_data.participantId))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << " onParticipantPositionChanged....."
|
||||
<< " participantId=" << data.participantId()
|
||||
<< " participantId=" << data.participantId
|
||||
<< " aesId=" << m_data.id
|
||||
<< " suppyParticipantId=" << m_data.participantId;
|
||||
DEBUG_LOG(m_logger) << "Supply Truck: onParticipantPositionChanged: " << data;
|
||||
@@ -258,10 +258,10 @@ void ObjectFunctionalArea::onParticipantPositionChanged(const ParticipantManagem
|
||||
{
|
||||
int zone = -1;
|
||||
|
||||
DEBUG_LOG(m_logger) << "New Supply Truck Position participantId: " << data.participantId()
|
||||
<< " pos: lat=" << data.pos().lat() << " lon=" << data.pos().lon();
|
||||
DEBUG_LOG(m_logger) << "New Supply Truck Position participantId: " << data.participantId
|
||||
<< " pos: lat=" << data.pos.lat << " lon=" << data.pos.lon;
|
||||
|
||||
const QPointF participantPosUtmPoint = geographic2Utm(data.pos(), &zone);
|
||||
const QPointF participantPosUtmPoint = geographic2Utm(data.pos, &zone);
|
||||
DEBUG_LOG(m_logger) << "participantPosUtmPoint=" << participantPosUtmPoint.x() << "/" << participantPosUtmPoint.y()
|
||||
<< " zone=" << zone;
|
||||
|
||||
@@ -275,7 +275,7 @@ void ObjectFunctionalArea::onParticipantPositionChanged(const ParticipantManagem
|
||||
//double squareDistance = LtsCoordTrans::squareDistance(participantPosUtmPoint, activationPosUtmPoint);
|
||||
|
||||
|
||||
const double distanceSquared = LtsCoordTrans::squareDistance(data.pos().lon(), data.pos().lat(), m_activatePos.lon(), m_activatePos.lat());
|
||||
const double distanceSquared = LtsCoordTrans::squareDistance(data.pos.lon, data.pos.lat, m_activatePos.lon, m_activatePos.lat);
|
||||
DEBUG_LOG(m_logger) << "squareDistance=" << distanceSquared
|
||||
<< " distance = " << sqrt(distanceSquared)
|
||||
<< " getMaximumStepLengthStanding=" << Settings::getMaximumStepLengthStanding();
|
||||
@@ -299,23 +299,23 @@ void ObjectFunctionalArea::onParticipantPositionChanged(const ParticipantManagem
|
||||
}
|
||||
}
|
||||
}
|
||||
m_data.position.setX(data.pos().lon());
|
||||
m_data.position.setY(data.pos().lat());
|
||||
m_data.partyId = data.partyId();
|
||||
m_data.position.setX(data.pos.lon);
|
||||
m_data.position.setY(data.pos.lat);
|
||||
m_data.partyId = data.partyId;
|
||||
m_data.isCentral = true;
|
||||
|
||||
m_dataAesFunctionalArea.position.setX(data.pos().lon());
|
||||
m_dataAesFunctionalArea.position.setY(data.pos().lat());
|
||||
m_dataAesFunctionalArea.partyId = data.partyId();
|
||||
m_dataAesFunctionalArea.position.setX(data.pos.lon);
|
||||
m_dataAesFunctionalArea.position.setY(data.pos.lat);
|
||||
m_dataAesFunctionalArea.partyId = data.partyId;
|
||||
m_dataAesFunctionalArea.isCentral = true;
|
||||
{
|
||||
int zone = -1;
|
||||
const QPointF participantPosUtmPoint = geographic2Utm(data.pos(), &zone);
|
||||
const QPointF participantPosUtmPoint = geographic2Utm(data.pos, &zone);
|
||||
|
||||
QPointF utmPointShift;
|
||||
utmPointShift.setX(participantPosUtmPoint.x() - m_dataAesFunctionalArea.length / 2);
|
||||
utmPointShift.setY(participantPosUtmPoint.y() - m_dataAesFunctionalArea.width / 2);
|
||||
DEBUG_LOG(m_logger) << "data.pos=" << data.pos()
|
||||
DEBUG_LOG(m_logger) << "data.pos=" << data.pos
|
||||
<< " participantPosUtmPoint=" << participantPosUtmPoint.x() << "/" << participantPosUtmPoint.y()
|
||||
<< " utmPointShift=" << utmPointShift.x() << "/" << utmPointShift.y()
|
||||
<< " length=" << m_dataAesFunctionalArea.length
|
||||
@@ -330,8 +330,8 @@ void ObjectFunctionalArea::onParticipantPositionChanged(const ParticipantManagem
|
||||
QPointF point = utm.geographic();
|
||||
|
||||
|
||||
m_activatePos.lon(point.x());
|
||||
m_activatePos.lat(point.y());
|
||||
m_activatePos.lon = point.x();
|
||||
m_activatePos.lat = point.y();
|
||||
m_dataAesFunctionalArea.position.setX(point.x());
|
||||
m_dataAesFunctionalArea.position.setY(point.y());
|
||||
m_data.position.setX(point.x());
|
||||
@@ -361,7 +361,7 @@ void ObjectFunctionalArea::myTimerSlot()
|
||||
// m_activePosAvailable = false;
|
||||
m_data.effectStateId = AesEffectState::EsActivated;
|
||||
m_dataAesFunctionalArea.effectStateId = AesEffectState::EsActivated;
|
||||
DEBUG_LOG(m_logger) << "TimerSlot Setze Supply-Truck active aesItemId=" << m_aiv.aesItemId()
|
||||
DEBUG_LOG(m_logger) << "TimerSlot Setze Supply-Truck active aesItemId=" << m_aiv.aesItemId
|
||||
<< " participantId=" << m_data.participantId
|
||||
<< " effectStateId=" << m_data.effectStateId;
|
||||
DEBUG_LOG(m_logger) << "onParticipantPositionChanged: Vor updateObject";
|
||||
|
||||
+2
-2
@@ -33,12 +33,12 @@ public:
|
||||
bool removeObjectFromDb();
|
||||
|
||||
|
||||
std::vector<Core::GeoPosition> form() const override { return m_aiv.form(); }
|
||||
std::vector<Core::GeoPosition> form() const override { return m_aiv.form; }
|
||||
QPolygonF generateForm() override;
|
||||
AesType aesType() const override { return AesType::AtFunctionalArea; }
|
||||
bool isCentral() const override
|
||||
{
|
||||
if (m_data.supplyMode == AesOperatingMode_def::OmWaitingTime)
|
||||
if (m_data.supplyMode == AesOperatingMode::OmWaitingTime)
|
||||
return true;
|
||||
return m_data.isCentral;
|
||||
}
|
||||
|
||||
+30
-30
@@ -39,7 +39,7 @@ Core::FunctionReplyObject ObjectGasPipe::createObject(const Database::AesGasPipe
|
||||
m_data.operatorId = dbData.operatorId;
|
||||
m_data.partyId = dbData.partyId;
|
||||
m_data.effectStart = dbData.effectStart;
|
||||
m_data.effectStateId = AreaEffectSimulation::AesEffectState_def::EsCreated;
|
||||
m_data.effectStateId = AreaEffectSimulation::AesEffectState::EsCreated;
|
||||
m_data.effectDuration = dbData.effectDuration;
|
||||
m_data.chargeTypeId = 461; // 105 Dummy
|
||||
|
||||
@@ -61,7 +61,7 @@ Core::FunctionReplyObject ObjectGasPipe::createObject(const Database::AesGasPipe
|
||||
{
|
||||
dbSegment.id = 0; // Reset for insert. Otherwise second segment cannot be inserted!
|
||||
dbSegment.gasPipeId = m_data.privGasPipeId; // db
|
||||
dbSegment.position = QPointF(ddsSegments[i].lon(), ddsSegments[i].lat());
|
||||
dbSegment.position = QPointF(ddsSegments[i].lon, ddsSegments[i].lat);
|
||||
dbSegment.positionIndex = i;
|
||||
|
||||
if (!m_mainHandler->db()->insert(dbSegment))
|
||||
@@ -128,7 +128,7 @@ Core::FunctionReplyObject ObjectGasPipe::updateObject(const Database::AesGasPipe
|
||||
// update all segments in tmpDbSegments
|
||||
for (size_t i = 0; i < ddsSegments.size(); ++i)
|
||||
{
|
||||
tmpDbSegments[i].position = QPointF(ddsSegments[i].lon(), ddsSegments[i].lat());
|
||||
tmpDbSegments[i].position = QPointF(ddsSegments[i].lon, ddsSegments[i].lat);
|
||||
tmpDbSegments[i].positionIndex = i;
|
||||
}
|
||||
|
||||
@@ -183,20 +183,20 @@ void ObjectGasPipe::onPublishData()
|
||||
|
||||
|
||||
AreaEffectSimulation::GasPipe ddsData;
|
||||
ddsData.id(m_data.id);
|
||||
ddsData.name(m_data.name.toStdString());
|
||||
ddsData.isDeleted(effectState() == AesEffectState::EsRemoved);
|
||||
ddsData.isUsed(false);
|
||||
ddsData.sampleTime(m_mainHandler->dds()->currentPartitionTimeMSec());
|
||||
ddsData.chargeStruct().chargeTypeId(m_data.chargeTypeId);
|
||||
ddsData.effectDuration(m_data.effectDuration);
|
||||
ddsData.effectStart(toOptional(toMSec(m_data.effectStart)));
|
||||
ddsData.width(m_data.width);
|
||||
ddsData.effectStateId(effectState());
|
||||
ddsData.partyId(toOptional(m_data.partyId));
|
||||
ddsData.participantId(toOptional(m_data.participantId));
|
||||
ddsData.isCentral(m_data.isCentral);
|
||||
dbSegment2DdsSegment(m_dbSegments, ddsData.segments());
|
||||
ddsData.id = m_data.id;
|
||||
ddsData.name = m_data.name.toStdString();
|
||||
ddsData.isDeleted = effectState() == AesEffectState::EsRemoved;
|
||||
ddsData.isUsed = false;
|
||||
ddsData.sampleTime = m_mainHandler->dds()->currentPartitionTimeMSec();
|
||||
ddsData.chargeStruct.chargeTypeId = m_data.chargeTypeId;
|
||||
ddsData.effectDuration = m_data.effectDuration;
|
||||
ddsData.effectStart = toOptional(toMSec(m_data.effectStart));
|
||||
ddsData.width = m_data.width;
|
||||
ddsData.effectStateId = effectState();
|
||||
ddsData.partyId = toOptional(m_data.partyId);
|
||||
ddsData.participantId = toOptional(m_data.participantId);
|
||||
ddsData.isCentral = m_data.isCentral;
|
||||
dbSegment2DdsSegment(m_dbSegments, ddsData.segments);
|
||||
|
||||
if (!m_mainHandler->dds()->dts()->publish(ddsData))
|
||||
ERROR_LOG(m_logger) << "Error publishing AesGasPipe-data to dds";
|
||||
@@ -211,22 +211,22 @@ void ObjectGasPipe::publishAiv()
|
||||
const QRectF bounds(poly.boundingRect());
|
||||
|
||||
AesItemView aiv(m_aiv);
|
||||
aiv.aesItemId(m_data.id);
|
||||
aiv.chargeStruct().chargeTypeId(m_data.chargeTypeId);
|
||||
aiv.effectStart(partitionTimeMSec());
|
||||
ddsVecFromPoly(poly, aiv.form());
|
||||
aiv.boundingBoxBottomLeft(Core::GeoPosition2D(bounds.bottomLeft().x(), bounds.bottomLeft().y()));
|
||||
aiv.boundingBoxTopRight(Core::GeoPosition2D(bounds.topRight().x(), bounds.topRight().y()));
|
||||
aiv.aesTypeId(AesType::AtGasPipe);
|
||||
aiv.effectStateId(effectState());
|
||||
aiv.id(1000 * m_data.id + AesType::AtGasPipe);
|
||||
aiv.partyId(m_data.partyId);
|
||||
aiv.aesItemId = m_data.id;
|
||||
aiv.chargeStruct.chargeTypeId = m_data.chargeTypeId;
|
||||
aiv.effectStart = partitionTimeMSec();
|
||||
ddsVecFromPoly(poly, aiv.form);
|
||||
aiv.boundingBoxBottomLeft = Core::GeoPosition2D(bounds.bottomLeft().x(), bounds.bottomLeft().y());
|
||||
aiv.boundingBoxTopRight = Core::GeoPosition2D(bounds.topRight().x(), bounds.topRight().y());
|
||||
aiv.aesTypeId = AesType::AtGasPipe;
|
||||
aiv.effectStateId = effectState();
|
||||
aiv.id = 1000 * m_data.id + static_cast<int>(AesType::AtGasPipe);
|
||||
aiv.partyId = m_data.partyId;
|
||||
|
||||
checkIsCentralAndPublish(aiv.form(), m_aiv.form(), m_data.isCentral);
|
||||
checkIsCentralAndPublish(aiv.form, m_aiv.form, m_data.isCentral);
|
||||
|
||||
if (aiv != m_aiv)
|
||||
{
|
||||
aiv.sampleTime(partitionTimeMSec());
|
||||
aiv.sampleTime = partitionTimeMSec();
|
||||
m_aiv = aiv;
|
||||
m_mainHandler->dds()->dts()->publish(aiv);
|
||||
emit newAiv(aiv);
|
||||
@@ -238,7 +238,7 @@ void ObjectGasPipe::removeTopics()
|
||||
{
|
||||
auto dts = m_mainHandler->dds()->dts();
|
||||
dts->removeGasPipeByKey(m_data.id);
|
||||
dts->removeAesItemViewByKey(1000 * m_data.id + AesType::AtGasPipe);
|
||||
dts->removeAesItemViewByKey(1000 * m_data.id + static_cast<int>(AesType::AtGasPipe));
|
||||
}
|
||||
|
||||
QPolygonF ObjectGasPipe::generateForm()
|
||||
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
|
||||
Core::FunctionReplyObject removeObject() override;
|
||||
|
||||
std::vector<Core::GeoPosition> form() const override { return m_aiv.form(); }
|
||||
std::vector<Core::GeoPosition> form() const override { return m_aiv.form; }
|
||||
QPolygonF generateForm() override;
|
||||
AesType aesType() const override { return AesType::AtGasPipe; }
|
||||
bool isCentral() const override { return m_data.isCentral; }
|
||||
|
||||
+73
-73
@@ -74,25 +74,25 @@ bool ObjectMineArea::removeObjectFromDb() { return m_mainHandler->db()->removeAe
|
||||
|
||||
bool ObjectMineArea::isDusMineArea() const
|
||||
{
|
||||
return static_cast<MineClass::type>(m_mainHandler->dds()->pdmDtc()->mineClass(m_data.chargeTypeId, m_data.igniterTypeId, m_data.igniterFunctionId))
|
||||
return static_cast<MineClass>(m_mainHandler->dds()->pdmDtc()->mineClass(m_data.chargeTypeId, m_data.igniterTypeId, m_data.igniterFunctionId))
|
||||
== MineClass::DUS;
|
||||
}
|
||||
|
||||
bool ObjectMineArea::isConcreteMine() const
|
||||
{
|
||||
return static_cast<MineClass::type>(m_mainHandler->dds()->pdmDtc()->mineClass(m_data.chargeTypeId, m_data.igniterTypeId, m_data.igniterFunctionId))
|
||||
return static_cast<MineClass>(m_mainHandler->dds()->pdmDtc()->mineClass(m_data.chargeTypeId, m_data.igniterTypeId, m_data.igniterFunctionId))
|
||||
== MineClass::Concrete;
|
||||
}
|
||||
|
||||
bool ObjectMineArea::isSingleVirtual() const
|
||||
{
|
||||
return static_cast<MineClass::type>(m_mainHandler->dds()->pdmDtc()->mineClass(m_data.chargeTypeId, m_data.igniterTypeId, m_data.igniterFunctionId))
|
||||
return static_cast<MineClass>(m_mainHandler->dds()->pdmDtc()->mineClass(m_data.chargeTypeId, m_data.igniterTypeId, m_data.igniterFunctionId))
|
||||
== MineClass::VirtualSingle;
|
||||
}
|
||||
|
||||
bool ObjectMineArea::isVirtualMine() const
|
||||
{
|
||||
return static_cast<MineClass::type>(m_mainHandler->dds()->pdmDtc()->mineClass(m_data.chargeTypeId, m_data.igniterTypeId, m_data.igniterFunctionId))
|
||||
return static_cast<MineClass>(m_mainHandler->dds()->pdmDtc()->mineClass(m_data.chargeTypeId, m_data.igniterTypeId, m_data.igniterFunctionId))
|
||||
== MineClass::Virtual;
|
||||
}
|
||||
|
||||
@@ -140,11 +140,11 @@ void ObjectMineArea::clearCorridor(const AesItemView &aiv)
|
||||
return;
|
||||
|
||||
QPolygonF aivUtmPoly;
|
||||
aivUtmPoly.reserve(aiv.form().size());
|
||||
int zone = LtsCoordTrans::UtmCoordinate::fromGeographic(aiv.form()[0].lon(), aiv.form()[0].lat()).zone;
|
||||
for (const auto &pos : aiv.form()) // Last Pos just for Length and Direction...
|
||||
aivUtmPoly.reserve(aiv.form.size());
|
||||
int zone = LtsCoordTrans::UtmCoordinate::fromGeographic(aiv.form[0].lon, aiv.form[0].lat).zone;
|
||||
for (const auto &pos : aiv.form) // Last Pos just for Length and Direction...
|
||||
{
|
||||
LtsCoordTrans::UtmCoordinate utmPos = LtsCoordTrans::UtmCoordinate::fromGeographic(pos.lon(), pos.lat(), zone);
|
||||
LtsCoordTrans::UtmCoordinate utmPos = LtsCoordTrans::UtmCoordinate::fromGeographic(pos.lon, pos.lat, zone);
|
||||
aivUtmPoly.push_back(QPointF(utmPos.x, utmPos.y));
|
||||
}
|
||||
|
||||
@@ -263,7 +263,7 @@ Core::FunctionReplyObject ObjectMineArea::createSegments(const std::vector<Core:
|
||||
|
||||
int count = 0;
|
||||
outSegments.reserve(inSegments.size());
|
||||
LtsCoordTrans::UtmCoordinate start = LtsCoordTrans::UtmCoordinate::fromGeographic(inSegments[0].lon(), inSegments[0].lat());
|
||||
LtsCoordTrans::UtmCoordinate start = LtsCoordTrans::UtmCoordinate::fromGeographic(inSegments[0].lon, inSegments[0].lat);
|
||||
int zone = start.zone;
|
||||
totalLengthOut = 0.0;
|
||||
for (size_t i = 0; i < inSegments.size() - 1; ++i) // Last Pos just for Length and Direction...
|
||||
@@ -272,10 +272,10 @@ Core::FunctionReplyObject ObjectMineArea::createSegments(const std::vector<Core:
|
||||
newSegment.elementNumber = ++count;
|
||||
newSegment.mineAreaId = mineAreaId;
|
||||
newSegment.id = 0;
|
||||
newSegment.startPosition = QPointF(inSegments[i].lon(), inSegments[i].lat());
|
||||
newSegment.endPosition = QPointF(inSegments[i + 1].lon(), inSegments[i + 1].lat());
|
||||
newSegment.startPosition = QPointF(inSegments[i].lon, inSegments[i].lat);
|
||||
newSegment.endPosition = QPointF(inSegments[i + 1].lon, inSegments[i + 1].lat);
|
||||
// calculate length
|
||||
const LtsCoordTrans::UtmCoordinate end = LtsCoordTrans::UtmCoordinate::fromGeographic(inSegments[i + 1].lon(), inSegments[i + 1].lat(), zone);
|
||||
const LtsCoordTrans::UtmCoordinate end = LtsCoordTrans::UtmCoordinate::fromGeographic(inSegments[i + 1].lon, inSegments[i + 1].lat, zone);
|
||||
// QLine's y-axis is southbound!
|
||||
QLineF line(QPointF(start.x, start.y), QPointF(end.x, end.y));
|
||||
// if (line.length() * density < 0.95) // We top that up to one mine later on.
|
||||
@@ -329,8 +329,8 @@ Core::FunctionReplyObject ObjectMineArea::createSegments(
|
||||
const AreaEffectSimulation::MineSegment &segment = inSegments.at(i);
|
||||
|
||||
dbSegment.elementNumber = i;
|
||||
dbSegment.startPosition = QPointF(segment.positionStart().lon(), segment.positionStart().lat());
|
||||
dbSegment.endPosition = QPointF(segment.positionEnd().lon(), segment.positionEnd().lat());
|
||||
dbSegment.startPosition = QPointF(segment.positionStart.lon, segment.positionStart.lat);
|
||||
dbSegment.endPosition = QPointF(segment.positionEnd.lon, segment.positionEnd.lat);
|
||||
dbSegment.mineAreaId = mineAreaId;
|
||||
|
||||
outSegments.push_back(std::move(dbSegment));
|
||||
@@ -345,20 +345,20 @@ bool ObjectMineArea::publishTriggeredImpacts()
|
||||
// Build an own tes-bitfield and compare, only store and publish if changed.
|
||||
TriggeredImpacts tis(m_tis);
|
||||
|
||||
tis.impactCount(m_triggeredMines.size());
|
||||
tis.bitfield().resize((m_triggeredMines.size() + 7) / 8);
|
||||
tis.impactCount = m_triggeredMines.size();
|
||||
tis.bitfield.resize((m_triggeredMines.size() + 7) / 8);
|
||||
|
||||
int i = 0;
|
||||
for (const auto &mine : qAsConst(m_triggeredMines))
|
||||
{
|
||||
// Triggered Impact == 0, if mine is disarmed/exploded
|
||||
LtsUtils::BitArray::setBit(tis.bitfield(), i++, !mine.isTriggered);
|
||||
LtsUtils::BitArray::setBit(tis.bitfield, i++, !mine.isTriggered);
|
||||
}
|
||||
|
||||
if ((m_tis != tis) || m_triggeredMinesChanged)
|
||||
{
|
||||
m_tis = tis;
|
||||
m_tis.sampleTime(partitionTimeMSec());
|
||||
m_tis.sampleTime = partitionTimeMSec();
|
||||
return m_mainHandler->dds()->dts()->publish(m_tis);
|
||||
}
|
||||
return true;
|
||||
@@ -370,19 +370,19 @@ bool ObjectMineArea::publishDusMineStatus()
|
||||
// DusMineStatus mines vector is coherent to triggered impacts bitfield
|
||||
DusMineState dms(m_dms);
|
||||
|
||||
dms.mines().resize(m_triggeredMines.size());
|
||||
dms.mines.resize(m_triggeredMines.size());
|
||||
int i = 0;
|
||||
|
||||
for (const auto &mine : qAsConst(m_triggeredMines))
|
||||
{
|
||||
const DusMine entry(mine.mineId, mine.isTriggered, mine.chargeTypeId, {mine.position.x(), mine.position.y()});
|
||||
dms.mines()[i++] = entry;
|
||||
dms.mines[i++] = entry;
|
||||
}
|
||||
|
||||
if (m_dms != dms || m_triggeredMinesChanged)
|
||||
{
|
||||
m_dms = dms;
|
||||
m_dms.sampleTime(partitionTimeMSec());
|
||||
m_dms.sampleTime = partitionTimeMSec();
|
||||
return m_mainHandler->dds()->dts()->publish(m_dms);
|
||||
}
|
||||
return true;
|
||||
@@ -449,7 +449,7 @@ Core::FunctionReplyObject ObjectMineArea::changeSegmentsToLine(bool sortMines)
|
||||
DEBUG_LOG(m_logger) << "index: " << index;
|
||||
Core::GeoPosition2D startPos = vec[index];
|
||||
|
||||
LtsCoordTrans::UtmCoordinate startPositionUtm = LtsCoordTrans::UtmCoordinate::fromGeographic(startPos.lon(), startPos.lat());
|
||||
LtsCoordTrans::UtmCoordinate startPositionUtm = LtsCoordTrans::UtmCoordinate::fromGeographic(startPos.lon, startPos.lat);
|
||||
DEBUG_LOG(m_logger) << "startPosUtm: " << startPositionUtm.mgrs();
|
||||
double length = 0.0;
|
||||
|
||||
@@ -459,7 +459,7 @@ Core::FunctionReplyObject ObjectMineArea::changeSegmentsToLine(bool sortMines)
|
||||
while (vec.size() > 0)
|
||||
{
|
||||
Core::GeoPosition2D &pos = vec.first();
|
||||
DEBUG_LOG(m_logger) << "pos: " << pos.lon() << ", " << pos.lat();
|
||||
DEBUG_LOG(m_logger) << "pos: " << pos.lon << ", " << pos.lat;
|
||||
|
||||
if (pos == startPos)
|
||||
{
|
||||
@@ -468,7 +468,7 @@ Core::FunctionReplyObject ObjectMineArea::changeSegmentsToLine(bool sortMines)
|
||||
continue;
|
||||
}
|
||||
|
||||
length = LtsCoordTrans::squareDistance(startPositionUtm, pos.lon(), pos.lat());
|
||||
length = LtsCoordTrans::squareDistance(startPositionUtm, pos.lon, pos.lat);
|
||||
DEBUG_LOG(m_logger) << "Distance between startPos and pos: " << length;
|
||||
|
||||
Core::GeoPosition2D newPos = pos;
|
||||
@@ -477,9 +477,9 @@ Core::FunctionReplyObject ObjectMineArea::changeSegmentsToLine(bool sortMines)
|
||||
if (pos2 == pos || pos2 == startPos)
|
||||
continue;
|
||||
|
||||
DEBUG_LOG(m_logger) << "pos2: " << pos2.lon() << ", " << pos2.lat();
|
||||
DEBUG_LOG(m_logger) << "pos2: " << pos2.lon << ", " << pos2.lat;
|
||||
|
||||
double length2 = LtsCoordTrans::squareDistance(startPositionUtm, pos2.lon(), pos2.lat());
|
||||
double length2 = LtsCoordTrans::squareDistance(startPositionUtm, pos2.lon, pos2.lat);
|
||||
DEBUG_LOG(m_logger) << "Distance between startPos and pos2: " << length;
|
||||
|
||||
if (length2 < length)
|
||||
@@ -492,14 +492,14 @@ Core::FunctionReplyObject ObjectMineArea::changeSegmentsToLine(bool sortMines)
|
||||
vecSorted.push_back(newPos);
|
||||
vec.removeOne(newPos);
|
||||
|
||||
startPositionUtm = LtsCoordTrans::UtmCoordinate::fromGeographic(newPos.lon(), newPos.lat(), startPositionUtm.zone);
|
||||
startPositionUtm = LtsCoordTrans::UtmCoordinate::fromGeographic(newPos.lon, newPos.lat, startPositionUtm.zone);
|
||||
DEBUG_LOG(m_logger) << "New startPosUtm: " << startPositionUtm.mgrs();
|
||||
}
|
||||
|
||||
if (vecSorted.size() == 1)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "only one segment - create 2 new with distance 10m";
|
||||
const LtsCoordTrans::UtmCoordinate pointUtm = LtsCoordTrans::UtmCoordinate::fromGeographic(vecSorted[0].lon(), vecSorted[0].lat());
|
||||
const LtsCoordTrans::UtmCoordinate pointUtm = LtsCoordTrans::UtmCoordinate::fromGeographic(vecSorted[0].lon, vecSorted[0].lat);
|
||||
LtsCoordTrans::UtmCoordinate point1Utm = pointUtm;
|
||||
LtsCoordTrans::UtmCoordinate point2Utm = pointUtm;
|
||||
point1Utm.y = pointUtm.y - 5.01;
|
||||
@@ -511,8 +511,8 @@ Core::FunctionReplyObject ObjectMineArea::changeSegmentsToLine(bool sortMines)
|
||||
Core::GeoPosition2D pos(point.x(), point.y());
|
||||
vecSorted.push_back(pos);
|
||||
point = point2Utm.geographic();
|
||||
pos.lon(point.x());
|
||||
pos.lat(point.y());
|
||||
pos.lon = point.x();
|
||||
pos.lat = point.y();
|
||||
vecSorted.push_back(pos);
|
||||
}
|
||||
}
|
||||
@@ -671,12 +671,12 @@ template <typename T> Core::FunctionReplyObject ObjectMineArea::createObjectTmpl
|
||||
}
|
||||
|
||||
// Set TriggeredExplosions Base Data
|
||||
m_tis.id(1000 * m_data.id + AesType::AtMineAreaSingleMines);
|
||||
m_tis.aesItemId(m_data.id);
|
||||
m_tis.aesTypeId(AesType::AtMineAreaSingleMines);
|
||||
m_tis.id = 1000 * m_data.id + static_cast<int>(AesType::AtMineAreaSingleMines);
|
||||
m_tis.aesItemId = m_data.id;
|
||||
m_tis.aesTypeId = AesType::AtMineAreaSingleMines;
|
||||
|
||||
// Set DUS-Mine status Base Data
|
||||
m_dms.id(m_data.id);
|
||||
m_dms.id = m_data.id;
|
||||
|
||||
trans.commit();
|
||||
|
||||
@@ -883,12 +883,12 @@ Core::FunctionReplyObject ObjectMineArea::createObjectFromMineData(const Databas
|
||||
return Core::FunctionReplyObject(m_data.id, tr_lts("dds", "Error adding triggered mines to database."));
|
||||
|
||||
// Set TriggeredExplosions Base Data
|
||||
m_tis.id(1000 * m_data.id + AesType::AtMineAreaSingleMines);
|
||||
m_tis.aesItemId(m_data.id);
|
||||
m_tis.aesTypeId(AesType::AtMineAreaSingleMines);
|
||||
m_tis.id = 1000 * m_data.id + static_cast<int>(AesType::AtMineAreaSingleMines);
|
||||
m_tis.aesItemId = m_data.id;
|
||||
m_tis.aesTypeId = AesType::AtMineAreaSingleMines;
|
||||
|
||||
// Set DUS-Mine status Base Data
|
||||
m_dms.id(m_data.id);
|
||||
m_dms.id = m_data.id;
|
||||
|
||||
trans.commit();
|
||||
|
||||
@@ -1062,7 +1062,7 @@ bool ObjectMineArea::canHandleMine(int mineId, int chargeTypeId, const QPointF &
|
||||
DEBUG_LOG(m_logger) << "Mine Area " << m_data.id << " is not a DUS mine area.";
|
||||
|
||||
// EffectState has to be Created, Prepared, Active and Paused Areas
|
||||
if (m_data.effectStateId.underlying() < AesEffectState::EsCreated)
|
||||
if (m_data.effectStateId < AesEffectState::EsCreated)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Mine Area " << m_data.id << " can not handle mine because its current AesEffectState is"
|
||||
<< AreaEffectSimulation::toString(m_data.effectStateId);
|
||||
@@ -1237,9 +1237,9 @@ bool ObjectMineArea::addMineData(const std::vector<MineData> &mineData)
|
||||
tm.mineAreaId = m_data.id;
|
||||
tm.chargeTypeId = m_data.chargeTypeId;
|
||||
tm.mineId = idx++;
|
||||
tm.appearenceTime = QDateTime::fromMSecsSinceEpoch(mine.appearenceTime());
|
||||
tm.armingTime = QDateTime::fromMSecsSinceEpoch(mine.armingTime());
|
||||
tm.position = QPointF(mine.position().lon(), mine.position().lat());
|
||||
tm.appearenceTime = QDateTime::fromMSecsSinceEpoch(mine.appearenceTime);
|
||||
tm.armingTime = QDateTime::fromMSecsSinceEpoch(mine.armingTime);
|
||||
tm.position = QPointF(mine.position.lon, mine.position.lat);
|
||||
if (!m_mainHandler->db()->insert(tm))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "--[addMineData] Couldn't insert trigger mine into db";
|
||||
@@ -1412,50 +1412,50 @@ void ObjectMineArea::publishAiv()
|
||||
// Better than aiv.id(1000 * aesItemId + AesType::AtMineArea);
|
||||
|
||||
AesItemView aiv(m_aiv);
|
||||
aiv.aesItemId(m_data.id);
|
||||
aiv.chargeStruct().chargeTypeId(m_data.chargeTypeId);
|
||||
aiv.effectStart(toMSec(m_data.effectStart));
|
||||
ddsVecFromPoly(m_mineAreaPolygon, aiv.form());
|
||||
aiv.aesItemId = m_data.id;
|
||||
aiv.chargeStruct.chargeTypeId = m_data.chargeTypeId;
|
||||
aiv.effectStart = toMSec(m_data.effectStart);
|
||||
ddsVecFromPoly(m_mineAreaPolygon, aiv.form);
|
||||
const auto br = boundingRect(); // m_mineAreaPolygon.boundingRect()
|
||||
aiv.boundingBoxBottomLeft(Core::GeoPosition2D(br.bottomLeft().x(), br.bottomLeft().y()));
|
||||
aiv.boundingBoxTopRight(Core::GeoPosition2D(br.topRight().x(), br.topRight().y()));
|
||||
aiv.aesTypeId(AesType::AtMineArea);
|
||||
aiv.effectStateId(effectState());
|
||||
aiv.id(1000 * m_data.id + AesType::AtMineArea);
|
||||
aiv.boundingBoxBottomLeft = Core::GeoPosition2D(br.bottomLeft().x(), br.bottomLeft().y());
|
||||
aiv.boundingBoxTopRight = Core::GeoPosition2D(br.topRight().x(), br.topRight().y());
|
||||
aiv.aesTypeId = AesType::AtMineArea;
|
||||
aiv.effectStateId = effectState();
|
||||
aiv.id = 1000 * m_data.id + static_cast<int>(AesType::AtMineArea);
|
||||
if (m_data.partyId != 0)
|
||||
aiv.partyId(m_data.partyId);
|
||||
aiv.partyId = m_data.partyId;
|
||||
|
||||
checkIsCentralAndPublish(aiv.form(), m_aiv.form(), m_data.isCentral);
|
||||
checkIsCentralAndPublish(aiv.form, m_aiv.form, m_data.isCentral);
|
||||
|
||||
if (aiv != m_aiv)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "aiv changed - publish";
|
||||
aiv.sampleTime(partitionTimeMSec());
|
||||
aiv.sampleTime = partitionTimeMSec();
|
||||
m_aiv = aiv;
|
||||
m_mainHandler->dds()->dts()->publish(aiv);
|
||||
emit newAiv(aiv);
|
||||
}
|
||||
|
||||
AesItemView aiv2(m_aiv2);
|
||||
aiv2.aesItemId(m_data.id);
|
||||
aiv2.chargeStruct().chargeTypeId(m_data.chargeTypeId);
|
||||
aiv2.effectStart(toMSec(m_data.effectStart));
|
||||
aiv2.form().clear();
|
||||
aiv2.form().reserve(m_triggeredMines.size());
|
||||
aiv2.aesItemId = m_data.id;
|
||||
aiv2.chargeStruct.chargeTypeId = m_data.chargeTypeId;
|
||||
aiv2.effectStart = toMSec(m_data.effectStart);
|
||||
aiv2.form.clear();
|
||||
aiv2.form.reserve(m_triggeredMines.size());
|
||||
for (const auto &tm : qAsConst(m_triggeredMines))
|
||||
aiv2.form().resize(aiv2.form().size() + 1, Core::GeoPosition(tm.position.x(), tm.position.y(), 0.0));
|
||||
aiv2.boundingBoxBottomLeft(aiv.boundingBoxBottomLeft());
|
||||
aiv2.boundingBoxTopRight(aiv.boundingBoxTopRight());
|
||||
aiv2.aesTypeId(AesType::inner_enum::AtMineAreaSingleMines);
|
||||
aiv2.id(1000 * m_data.id + AesType::inner_enum::AtMineAreaSingleMines);
|
||||
aiv2.effectStateId(m_data.effectStateId);
|
||||
aiv2.form.resize(aiv2.form.size() + 1, Core::GeoPosition(tm.position.x(), tm.position.y(), 0.0));
|
||||
aiv2.boundingBoxBottomLeft = aiv.boundingBoxBottomLeft;
|
||||
aiv2.boundingBoxTopRight = aiv.boundingBoxTopRight;
|
||||
aiv2.aesTypeId = AesType::AtMineAreaSingleMines;
|
||||
aiv2.id = 1000 * m_data.id + static_cast<int>(AesType::AtMineAreaSingleMines);
|
||||
aiv2.effectStateId = m_data.effectStateId;
|
||||
if (m_data.partyId != 0)
|
||||
aiv2.partyId(m_data.partyId);
|
||||
aiv2.partyId = m_data.partyId;
|
||||
|
||||
if (aiv2 != m_aiv2 || m_triggeredMinesChanged)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "aiv2 changed";
|
||||
aiv2.sampleTime(partitionTimeMSec());
|
||||
aiv2.sampleTime = partitionTimeMSec();
|
||||
m_aiv2 = aiv2;
|
||||
m_mainHandler->dds()->dts()->publish(aiv2);
|
||||
emit newAiv(aiv2);
|
||||
@@ -1468,9 +1468,9 @@ void ObjectMineArea::removeTopics()
|
||||
|
||||
auto dts = m_mainHandler->dds()->dts();
|
||||
dts->removeMineAreaByKey(m_data.id);
|
||||
dts->removeAesItemViewByKey(1000 * m_data.id + AesType::inner_enum::AtMineArea);
|
||||
dts->removeAesItemViewByKey(1000 * m_data.id + AesType::inner_enum::AtMineAreaSingleMines);
|
||||
dts->removeTriggeredImpactsByKey(1000 * m_data.id + AesType::inner_enum::AtMineAreaSingleMines);
|
||||
dts->removeAesItemViewByKey(1000 * m_data.id + static_cast<int>(AesType::AtMineArea));
|
||||
dts->removeAesItemViewByKey(1000 * m_data.id + static_cast<int>(AesType::AtMineAreaSingleMines));
|
||||
dts->removeTriggeredImpactsByKey(1000 * m_data.id + static_cast<int>(AesType::AtMineAreaSingleMines));
|
||||
removeDusMineStateTopic();
|
||||
emit removeAiv(m_data.id);
|
||||
}
|
||||
@@ -1497,14 +1497,14 @@ Core::FunctionReplyObject ObjectMineArea::createGeoSegmentsFromMineData(double &
|
||||
tempMinePos.emplace_back(Core::GeoPosition2D(t.position.x(), t.position.y()));
|
||||
|
||||
for (const auto &md : mineData)
|
||||
tempMinePos.emplace_back(md.position());
|
||||
tempMinePos.emplace_back(md.position);
|
||||
|
||||
DEBUG_LOG(m_logger) << "--[createSegmentsFromMineData]: --> tempMinePos.Size: " << tempMinePos.size() << " m_triggeredMinesSIze: " << m_triggeredMines.size()
|
||||
<< " mineDataSize " << mineData.size();
|
||||
if (tempMinePos.empty())
|
||||
return Core::FunctionReplyObject(m_data.id, tr_lts("dds", "Mine data couldn't be added"));
|
||||
|
||||
LtsCoordTrans::UtmCoordinate tempCoord = LtsCoordTrans::UtmCoordinate::fromGeographic(tempMinePos.front().lon(), tempMinePos.front().lat());
|
||||
LtsCoordTrans::UtmCoordinate tempCoord = LtsCoordTrans::UtmCoordinate::fromGeographic(tempMinePos.front().lon, tempMinePos.front().lat);
|
||||
|
||||
// calculate position
|
||||
double angleDeg = 0.0;
|
||||
@@ -1557,7 +1557,7 @@ void ObjectMineArea::onEffectStateChanged()
|
||||
DEBUG_LOG(m_logger) << id() << " EffectStateChanged for MineArea " << m_data.id << ". Check if mines have to be released.";
|
||||
// If is an DUS-MineArea and it's state is Expired or Removed and still has mines
|
||||
if ((isDusMineArea() || isConcreteMine())
|
||||
&& (m_data.effectStateId.underlying() == AesEffectState::EsExpired || m_data.effectStateId.underlying() == AesEffectState::EsRemoved)
|
||||
&& (m_data.effectStateId == AesEffectState::EsExpired || m_data.effectStateId == AesEffectState::EsRemoved)
|
||||
&& !m_triggeredMines.isEmpty())
|
||||
{
|
||||
DEBUG_LOG(m_logger) << id() << " Releasing all mines from " << toString(m_data.effectStateId) << " MineArea " << m_data.id;
|
||||
|
||||
@@ -60,7 +60,7 @@ class ObjectMineArea final : public ObjectBaseTmpl<Database::AesMineArea>
|
||||
void clearBuildings();
|
||||
QVector<Database::AesMineAreaTriggeredMines> unpairedMines() const;
|
||||
|
||||
std::vector<Core::GeoPosition> form() const override { return m_aiv.form(); }
|
||||
std::vector<Core::GeoPosition> form() const override { return m_aiv.form; }
|
||||
QPolygonF generateForm() override;
|
||||
AesType aesType() const override { return AesType::AtMineArea; }
|
||||
bool isCentral() const override { return m_data.isCentral; }
|
||||
|
||||
+32
-32
@@ -33,12 +33,12 @@ ObjectMineAreaNull::ObjectMineAreaNull(MainHandler *mainHandler,
|
||||
}
|
||||
|
||||
// Set TriggeredExplosions Base Data
|
||||
m_tis.id(AesType::AtMineAreaSingleMines);
|
||||
m_tis.aesItemId(0);
|
||||
m_tis.aesTypeId(AesType::AtMineAreaSingleMines);
|
||||
m_tis.id = AesType::AtMineAreaSingleMines;
|
||||
m_tis.aesItemId = 0;
|
||||
m_tis.aesTypeId = AesType::AtMineAreaSingleMines;
|
||||
|
||||
// Set DUS-Mine status Base Data
|
||||
m_dms.mines().resize(m_triggeredMines.size());
|
||||
m_dms.mines.resize(m_triggeredMines.size());
|
||||
|
||||
onPublishData();
|
||||
}
|
||||
@@ -49,25 +49,25 @@ ObjectMineAreaNull::~ObjectMineAreaNull()
|
||||
}
|
||||
bool ObjectMineAreaNull::isDusMineArea() const
|
||||
{
|
||||
return static_cast<MineClass::type>(m_mainHandler->dds()->pdmDtc()->mineClass(m_data.chargeTypeId, m_data.igniterTypeId, m_data.igniterFunctionId))
|
||||
return static_cast<MineClass>(m_mainHandler->dds()->pdmDtc()->mineClass(m_data.chargeTypeId, m_data.igniterTypeId, m_data.igniterFunctionId))
|
||||
== MineClass::DUS;
|
||||
}
|
||||
|
||||
bool ObjectMineAreaNull::isConcreteMine() const
|
||||
{
|
||||
return static_cast<MineClass::type>(m_mainHandler->dds()->pdmDtc()->mineClass(m_data.chargeTypeId, m_data.igniterTypeId, m_data.igniterFunctionId))
|
||||
return static_cast<MineClass>(m_mainHandler->dds()->pdmDtc()->mineClass(m_data.chargeTypeId, m_data.igniterTypeId, m_data.igniterFunctionId))
|
||||
== MineClass::Concrete;
|
||||
}
|
||||
|
||||
bool ObjectMineAreaNull::isVirtualSingleMine() const
|
||||
{
|
||||
return static_cast<MineClass::type>(m_mainHandler->dds()->pdmDtc()->mineClass(m_data.chargeTypeId, m_data.igniterTypeId, m_data.igniterFunctionId))
|
||||
return static_cast<MineClass>(m_mainHandler->dds()->pdmDtc()->mineClass(m_data.chargeTypeId, m_data.igniterTypeId, m_data.igniterFunctionId))
|
||||
== MineClass::VirtualSingle;
|
||||
}
|
||||
|
||||
bool ObjectMineAreaNull::isVirtualMine() const
|
||||
{
|
||||
return static_cast<MineClass::type>(m_mainHandler->dds()->pdmDtc()->mineClass(m_data.chargeTypeId, m_data.igniterTypeId, m_data.igniterFunctionId))
|
||||
return static_cast<MineClass>(m_mainHandler->dds()->pdmDtc()->mineClass(m_data.chargeTypeId, m_data.igniterTypeId, m_data.igniterFunctionId))
|
||||
== MineClass::Virtual;
|
||||
}
|
||||
int ObjectMineAreaNull::lastConcreteMineNo()
|
||||
@@ -232,8 +232,8 @@ void ObjectMineAreaNull::removeTopics()
|
||||
{
|
||||
auto dts = m_mainHandler->dds()->dts();
|
||||
dts->removeMineAreaByKey(m_data.id);
|
||||
dts->removeAesItemViewByKey(1000 * m_data.id + AesType::AtMineAreaSingleMines);
|
||||
dts->removeTriggeredImpactsByKey(1000 * m_data.id + AesType::AtMineAreaSingleMines);
|
||||
dts->removeAesItemViewByKey(1000 * m_data.id + static_cast<int>(AesType::AtMineAreaSingleMines));
|
||||
dts->removeTriggeredImpactsByKey(1000 * m_data.id + static_cast<int>(AesType::AtMineAreaSingleMines));
|
||||
emit removeAiv(m_data.id);
|
||||
}
|
||||
|
||||
@@ -252,24 +252,24 @@ void ObjectMineAreaNull::publishAiv()
|
||||
}
|
||||
|
||||
AesItemView aiv2(m_aiv2);
|
||||
aiv2.aesItemId(0);
|
||||
aiv2.chargeStruct().chargeTypeId(m_data.chargeTypeId); // Shall be invalid. EffectSimulation has been conducted before, so not necessary for service sCES
|
||||
aiv2.effectStart(0);
|
||||
aiv2.form(vec);
|
||||
aiv2.boundingBoxBottomLeft() = Core::GeoPosition2D(tmp.boundingRect().bottomLeft().x(), tmp.boundingRect().bottomLeft().y());
|
||||
aiv2.boundingBoxTopRight() = Core::GeoPosition2D(tmp.boundingRect().topRight().x(), tmp.boundingRect().topRight().y());
|
||||
aiv2.aesTypeId(AesType::inner_enum::AtMineAreaSingleMines);
|
||||
aiv2.id(AesType::inner_enum::AtMineAreaSingleMines);
|
||||
aiv2.effectStateId(AesEffectState::inner_enum::EsActivated);
|
||||
aiv2.setId(dds::core::optional<rti::core::int64>(m_setId));
|
||||
aiv2.aesItemId = 0;
|
||||
aiv2.chargeStruct.chargeTypeId = m_data.chargeTypeId; // Shall be invalid. EffectSimulation has been conducted before, so not necessary for service sCES
|
||||
aiv2.effectStart = 0;
|
||||
aiv2.form = vec;
|
||||
aiv2.boundingBoxBottomLeft = Core::GeoPosition2D(tmp.boundingRect().bottomLeft().x(), tmp.boundingRect().bottomLeft().y());
|
||||
aiv2.boundingBoxTopRight = Core::GeoPosition2D(tmp.boundingRect().topRight().x(), tmp.boundingRect().topRight().y());
|
||||
aiv2.aesTypeId = AesType::AtMineAreaSingleMines;
|
||||
aiv2.id = AesType::AtMineAreaSingleMines;
|
||||
aiv2.effectStateId = AesEffectState::EsActivated;
|
||||
aiv2.setId = dds::core::optional<rti::core::int64>(m_setId);
|
||||
if (m_data.partyId != 0)
|
||||
aiv2.partyId(m_data.partyId);
|
||||
aiv2.partyId = m_data.partyId;
|
||||
|
||||
checkIsCentralAndPublish(aiv2.form(), m_aiv2.form(), m_data.isCentral);
|
||||
checkIsCentralAndPublish(aiv2.form, m_aiv2.form, m_data.isCentral);
|
||||
|
||||
if (aiv2 != m_aiv2)
|
||||
{
|
||||
aiv2.sampleTime(partitionTimeMSec());
|
||||
aiv2.sampleTime = partitionTimeMSec();
|
||||
m_aiv2 = aiv2;
|
||||
m_mainHandler->dds()->dts()->publish(aiv2);
|
||||
emit newAiv(aiv2);
|
||||
@@ -280,20 +280,20 @@ bool ObjectMineAreaNull::publishTriggeredImpacts()
|
||||
{
|
||||
// Build an own tes-bitfield and compare, only store and publish if changed.
|
||||
TriggeredImpacts tis(m_tis);
|
||||
tis.impactCount(m_triggeredMines.size());
|
||||
tis.bitfield().resize((m_triggeredMines.size() + 7) / 8);
|
||||
tis.setId(dds::core::optional<rti::core::int64>(m_setId));
|
||||
tis.impactCount = m_triggeredMines.size();
|
||||
tis.bitfield.resize((m_triggeredMines.size() + 7) / 8);
|
||||
tis.setId = dds::core::optional<rti::core::int64>(m_setId);
|
||||
|
||||
int i = 0;
|
||||
for (const auto &mine : qAsConst(m_triggeredMines))
|
||||
{
|
||||
// Triggered Impact == 0, if mine is disarmed/exploded
|
||||
LtsUtils::BitArray::setBit(tis.bitfield(), i++, !mine.isTriggered);
|
||||
LtsUtils::BitArray::setBit(tis.bitfield, i++, !mine.isTriggered);
|
||||
}
|
||||
if (m_tis != tis)
|
||||
{
|
||||
m_tis = tis;
|
||||
m_tis.sampleTime(partitionTimeMSec());
|
||||
m_tis.sampleTime = partitionTimeMSec();
|
||||
return m_mainHandler->dds()->dts()->publish(m_tis);
|
||||
}
|
||||
return true;
|
||||
@@ -304,19 +304,19 @@ bool ObjectMineAreaNull::publishDusMineStatus()
|
||||
// DusMineStatus mines vector is coherent to triggered impacts bitfield
|
||||
DusMineState dms(m_dms);
|
||||
|
||||
dms.mines().resize(m_triggeredMines.size());
|
||||
dms.setId(dds::core::optional<rti::core::int64>(m_setId));
|
||||
dms.mines.resize(m_triggeredMines.size());
|
||||
dms.setId = dds::core::optional<rti::core::int64>(m_setId);
|
||||
int i = 0;
|
||||
for (const auto &mine : qAsConst(m_triggeredMines))
|
||||
{
|
||||
const DusMine entry(mine.mineId, mine.isTriggered, mine.chargeTypeId, {mine.position.x(), mine.position.y()});
|
||||
dms.mines()[i++] = entry;
|
||||
dms.mines[i++] = entry;
|
||||
}
|
||||
|
||||
if (m_dms != dms)
|
||||
{
|
||||
m_dms = dms;
|
||||
m_dms.sampleTime(partitionTimeMSec());
|
||||
m_dms.sampleTime = partitionTimeMSec();
|
||||
return m_mainHandler->dds()->dts()->publish(m_dms);
|
||||
}
|
||||
return true;
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ public:
|
||||
|
||||
std::vector<Core::GeoPosition> form() const override { return {}; }
|
||||
QPolygonF generateForm() override;
|
||||
AesType aesType() const override { return AesType_def::AtMineArea; }
|
||||
AesType aesType() const override { return AesType::AtMineArea; }
|
||||
bool isCentral() const override { return m_data.isCentral; }
|
||||
int lastConcreteMineNo();
|
||||
public Q_SLOTS:
|
||||
|
||||
+19
-19
@@ -74,7 +74,7 @@ Core::FunctionReplyObject ObjectMineCorridor::createObject(const Database::AesMi
|
||||
{
|
||||
segment.id = 0;
|
||||
segment.mineCorridorId = m_data.id;
|
||||
segment.position = QPointF(ddsSeg.lon(), ddsSeg.lat());
|
||||
segment.position = QPointF(ddsSeg.lon, ddsSeg.lat);
|
||||
// will update segment.id
|
||||
if (!m_mainHandler->db()->insert(segment))
|
||||
return Core::FunctionReplyObject(getRightId(m_data.id, originOc), tr_lts("dds", "Error inserting AesMineAreaSegment-data into database."));
|
||||
@@ -138,7 +138,7 @@ Core::FunctionReplyObject ObjectMineCorridor::updateObject(const Database::AesMi
|
||||
tmpSegments.resize(newSegmentSize); // if count is decreased
|
||||
|
||||
for (size_t i = 0; i < segments.size(); ++i)
|
||||
tmpSegments[i].position = QPointF(segments[i].lon(), segments[i].lat());
|
||||
tmpSegments[i].position = QPointF(segments[i].lon, segments[i].lat);
|
||||
|
||||
for (const Database::AesMineCorridorSegment &segment : qAsConst(tmpSegments))
|
||||
{
|
||||
@@ -183,7 +183,7 @@ void ObjectMineCorridor::onPublishData()
|
||||
m_data.isCentral,
|
||||
m_data.properties.toStdString(),
|
||||
m_data.width, {});
|
||||
dbSegment2DdsSegment(m_segments, ddsData.segments());
|
||||
dbSegment2DdsSegment(m_segments, ddsData.segments);
|
||||
|
||||
m_mainHandler->dds()->dts()->publish(ddsData);
|
||||
publishAiv();
|
||||
@@ -201,22 +201,22 @@ void ObjectMineCorridor::publishAiv()
|
||||
const QRectF bounds(poly.boundingRect());
|
||||
|
||||
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.bottomLeft().x(), bounds.bottomLeft().y()));
|
||||
aiv.boundingBoxTopRight(Core::GeoPosition2D(bounds.topRight().x(), bounds.topRight().y()));
|
||||
aiv.aesTypeId(AesType::AtMineCorridor);
|
||||
aiv.effectStateId(effectState());
|
||||
aiv.id(1000 * m_data.id + AesType::AtMineCorridor);
|
||||
aiv.partyId(0);
|
||||
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.bottomLeft().x(), bounds.bottomLeft().y());
|
||||
aiv.boundingBoxTopRight = Core::GeoPosition2D(bounds.topRight().x(), bounds.topRight().y());
|
||||
aiv.aesTypeId = AesType::AtMineCorridor;
|
||||
aiv.effectStateId = effectState();
|
||||
aiv.id = 1000 * m_data.id + static_cast<int>(AesType::AtMineCorridor);
|
||||
aiv.partyId = 0;
|
||||
|
||||
checkIsCentralAndPublish(aiv.form(), m_aiv.form(), m_data.isCentral);
|
||||
checkIsCentralAndPublish(aiv.form, m_aiv.form, m_data.isCentral);
|
||||
|
||||
if (aiv != m_aiv)
|
||||
{
|
||||
aiv.sampleTime(partitionTimeMSec());
|
||||
aiv.sampleTime = partitionTimeMSec();
|
||||
m_aiv = aiv;
|
||||
m_mainHandler->dds()->dts()->publish(aiv);
|
||||
emit newAiv(aiv);
|
||||
@@ -225,7 +225,7 @@ void ObjectMineCorridor::publishAiv()
|
||||
const int zone = LtsCoordTrans::UtmCoordinate::fromGeographic(poly[0]).zone;
|
||||
|
||||
// Unused, Future use: Intersection with Mine Area to deactivate Mines
|
||||
m_utmPoly = utmPolyFromGeoVec(aiv.form(), zone);
|
||||
m_utmPoly = utmPolyFromGeoVec(aiv.form, zone);
|
||||
|
||||
}
|
||||
|
||||
@@ -234,13 +234,13 @@ QPolygonF ObjectMineCorridor::utmPolyFromGeoVec(const std::vector<Core::GeoPosit
|
||||
if (geoPos.size() == 0)
|
||||
return QPolygonF();
|
||||
|
||||
int actZone = LtsCoordTrans::UtmCoordinate::fromGeographic(geoPos.at(0).lon(),geoPos.at(0).lat(), zone).zone;
|
||||
int actZone = LtsCoordTrans::UtmCoordinate::fromGeographic(geoPos.at(0).lon,geoPos.at(0).lat, zone).zone;
|
||||
|
||||
QPolygonF retVal(geoPos.size());
|
||||
int i=0;
|
||||
for (const auto &pos : geoPos)
|
||||
{
|
||||
LtsCoordTrans::UtmCoordinate utm = LtsCoordTrans::UtmCoordinate::fromGeographic(QPointF(pos.lon(), pos.lat()), actZone);
|
||||
LtsCoordTrans::UtmCoordinate utm = LtsCoordTrans::UtmCoordinate::fromGeographic(QPointF(pos.lon, pos.lat), actZone);
|
||||
retVal[i++] = QPointF(utm.x, utm.y);
|
||||
}
|
||||
return retVal;
|
||||
@@ -250,7 +250,7 @@ void ObjectMineCorridor::removeTopics()
|
||||
{
|
||||
auto dts = m_mainHandler->dds()->dts();
|
||||
dts->removeMineCorridorByKey(m_data.id);
|
||||
dts->removeAesItemViewByKey(1000 * m_data.id + AesType::inner_enum::AtMineCorridor);
|
||||
dts->removeAesItemViewByKey(1000 * m_data.id + static_cast<int>(AesType::AtMineCorridor));
|
||||
emit removeAiv(m_data.id);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ public:
|
||||
Core::FunctionReplyObject updateObject(const Database::AesMineCorridor &data,
|
||||
const std::vector<Core::GeoPosition2D> &segments);
|
||||
|
||||
std::vector<Core::GeoPosition> form() const override { return m_aiv.form(); }
|
||||
std::vector<Core::GeoPosition> form() const override { return m_aiv.form; }
|
||||
QPolygonF generateForm() override;
|
||||
AesType aesType() const override { return AesType::AtMineCorridor; }
|
||||
bool isCentral() const override { return m_data.isCentral; }
|
||||
|
||||
+19
-19
@@ -28,7 +28,7 @@ ObjectNContamination::~ObjectNContamination()
|
||||
Core::FunctionReplyObject ObjectNContamination::createObject(const Database::AesNContamination &data)
|
||||
{
|
||||
Core::FunctionReplyObject ret = ObjectBaseTmpl::createObject(data);
|
||||
if (m_data.effectStateId == AesEffectState_def::EsActivated)
|
||||
if (m_data.effectStateId == AesEffectState::EsActivated)
|
||||
m_updateWeatherData = true;
|
||||
|
||||
return ret;
|
||||
@@ -92,7 +92,7 @@ void ObjectNContamination::onUpdateWeatherData()
|
||||
|
||||
if (m_data.weatherSourceId != AesWeatherSource::AwsNone)
|
||||
{
|
||||
m_data.rotationAngle = fmod(md.windDirection() + 180.0, 360.0);
|
||||
m_data.rotationAngle = fmod(md.windDirection + 180.0, 360.0);
|
||||
m_publishDataTimer->start();
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ void ObjectNContamination::onPublishData()
|
||||
if (!m_mainHandler->db()->update(m_data))
|
||||
ERROR_LOG(m_logger) << "Error updating AesIndirectFireSingle-data in database";
|
||||
|
||||
if (m_data.effectStateId == AesEffectState_def::EsActivated && !m_updateWeatherData)
|
||||
if (m_data.effectStateId == AesEffectState::EsActivated && !m_updateWeatherData)
|
||||
onUpdateWeatherData();
|
||||
|
||||
NContamination ddsData(m_data.id,
|
||||
@@ -142,9 +142,9 @@ void ObjectNContamination::onPublishData()
|
||||
void ObjectNContamination::publishAiv()
|
||||
{
|
||||
QPolygonF poly;
|
||||
if ((m_data.effectStateId == AesEffectState_def::EsCreated ||
|
||||
m_data.effectStateId == AesEffectState_def::EsPrepared ||
|
||||
m_data.effectStateId == AesEffectState_def::EsReceived) && m_data.weatherSourceId != AesWeatherSource_def::AwsNone)
|
||||
if ((m_data.effectStateId == AesEffectState::EsCreated ||
|
||||
m_data.effectStateId == AesEffectState::EsPrepared ||
|
||||
m_data.effectStateId == AesEffectState::EsReceived) && m_data.weatherSourceId != AesWeatherSource::AwsNone)
|
||||
{
|
||||
Database::AesNContamination tmpData = m_data;
|
||||
tmpData.borderLengthInner = tmpData.impactRadius;
|
||||
@@ -158,23 +158,23 @@ void ObjectNContamination::publishAiv()
|
||||
const QRectF bounds(poly.boundingRect());
|
||||
|
||||
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.bottomLeft().x(), bounds.bottomLeft().y()));
|
||||
aiv.boundingBoxTopRight(Core::GeoPosition2D(bounds.topRight().x(), bounds.topRight().y()));
|
||||
aiv.aesTypeId(AesType::AtNContamination);
|
||||
aiv.effectStateId(effectState());
|
||||
aiv.id(1000 * m_data.id + AesType::AtNContamination);
|
||||
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.bottomLeft().x(), bounds.bottomLeft().y());
|
||||
aiv.boundingBoxTopRight = Core::GeoPosition2D(bounds.topRight().x(), bounds.topRight().y());
|
||||
aiv.aesTypeId = AesType::AtNContamination;
|
||||
aiv.effectStateId = effectState();
|
||||
aiv.id = 1000 * m_data.id + static_cast<int>(AesType::AtNContamination);
|
||||
if (m_data.partyId != 0)
|
||||
aiv.partyId(m_data.partyId);
|
||||
aiv.partyId = m_data.partyId;
|
||||
|
||||
checkIsCentralAndPublish(aiv.form(), m_aiv.form(), m_data.isCentral);
|
||||
checkIsCentralAndPublish(aiv.form, m_aiv.form, m_data.isCentral);
|
||||
|
||||
if (aiv != m_aiv)
|
||||
{
|
||||
aiv.sampleTime(partitionTimeMSec());
|
||||
aiv.sampleTime = partitionTimeMSec();
|
||||
m_aiv = aiv;
|
||||
m_mainHandler->dds()->dts()->publish(aiv);
|
||||
emit newAiv(aiv);
|
||||
@@ -185,7 +185,7 @@ void ObjectNContamination::removeTopics()
|
||||
{
|
||||
auto dts = m_mainHandler->dds()->dts();
|
||||
dts->removeNContaminationByKey(m_data.id);
|
||||
dts->removeAesItemViewByKey(1000 * m_data.id + AesType::AtNContamination);
|
||||
dts->removeAesItemViewByKey(1000 * m_data.id + static_cast<int>(AesType::AtNContamination));
|
||||
emit removeAiv(m_data.id);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ public:
|
||||
*/
|
||||
bool removeObjectFromDb();
|
||||
|
||||
std::vector<Core::GeoPosition> form() const override { return m_aiv.form(); }
|
||||
std::vector<Core::GeoPosition> form() const override { return m_aiv.form; }
|
||||
QPolygonF generateForm() override;
|
||||
AesType aesType() const override { return AesType::AtNContamination; }
|
||||
bool isCentral() const override { return m_data.isCentral; }
|
||||
|
||||
+23
-23
@@ -163,22 +163,22 @@ void ObjectOffRouteMine::publishAiv()
|
||||
const QPolygonF poly = Polygons::offRouteMineArea(m_data);
|
||||
const QRectF bounds(poly.boundingRect());
|
||||
AesItemView aiv(m_aiv);
|
||||
aiv.aesItemId(m_data.id);
|
||||
aiv.effectStart(toMSec(m_data.effectStart));
|
||||
aiv.chargeStruct().chargeTypeId(m_data.chargeTypeId);
|
||||
ddsVecFromPoly(poly, aiv.form());
|
||||
aiv.boundingBoxBottomLeft(Core::GeoPosition2D(bounds.bottomLeft().x(), bounds.bottomLeft().y()));
|
||||
aiv.boundingBoxTopRight(Core::GeoPosition2D(bounds.topRight().x(), bounds.topRight().y()));
|
||||
aiv.aesTypeId(AesType::AtOffRouteMine);
|
||||
aiv.effectStateId(data().effectStateId);
|
||||
aiv.id(1000 * m_data.id + AesType::AtOffRouteMine);
|
||||
aiv.aesItemId = m_data.id;
|
||||
aiv.effectStart = toMSec(m_data.effectStart);
|
||||
aiv.chargeStruct.chargeTypeId = m_data.chargeTypeId;
|
||||
ddsVecFromPoly(poly, aiv.form);
|
||||
aiv.boundingBoxBottomLeft = Core::GeoPosition2D(bounds.bottomLeft().x(), bounds.bottomLeft().y());
|
||||
aiv.boundingBoxTopRight = Core::GeoPosition2D(bounds.topRight().x(), bounds.topRight().y());
|
||||
aiv.aesTypeId = AesType::AtOffRouteMine;
|
||||
aiv.effectStateId = data().effectStateId;
|
||||
aiv.id = 1000 * m_data.id + static_cast<int>(AesType::AtOffRouteMine);
|
||||
|
||||
if (m_data.partyId != 0)
|
||||
aiv.partyId(m_data.partyId);
|
||||
aiv.partyId = m_data.partyId;
|
||||
|
||||
if (aiv != m_aiv)
|
||||
{
|
||||
aiv.sampleTime(partitionTimeMSec());
|
||||
aiv.sampleTime = partitionTimeMSec();
|
||||
m_aiv = aiv;
|
||||
m_mainHandler->dds()->dts()->publish(aiv);
|
||||
emit newAiv(m_aiv);
|
||||
@@ -193,22 +193,22 @@ void ObjectOffRouteMine::publishAiv()
|
||||
const QRectF bounds(poly.boundingRect());
|
||||
|
||||
AesItemView aiv2(m_aiv2);
|
||||
aiv2.aesItemId(m_data.id);
|
||||
aiv2.effectStart(toMSec(m_data.effectStart));
|
||||
aiv2.chargeStruct().chargeTypeId(m_data.chargeTypeId);
|
||||
ddsVecFromPoly(poly, aiv2.form());
|
||||
aiv2.boundingBoxBottomLeft(Core::GeoPosition2D(bounds.bottomLeft().x(), bounds.bottomLeft().y()));
|
||||
aiv2.boundingBoxTopRight(Core::GeoPosition2D(bounds.topRight().x(), bounds.topRight().y()));
|
||||
aiv2.aesTypeId(AesType::AtOffRouteMineSecondary);
|
||||
aiv2.effectStateId(data().effectStateId);
|
||||
aiv2.id(1000 * m_data.id + AesType::AtOffRouteMineSecondary);
|
||||
aiv2.aesItemId = m_data.id;
|
||||
aiv2.effectStart = toMSec(m_data.effectStart);
|
||||
aiv2.chargeStruct.chargeTypeId = m_data.chargeTypeId;
|
||||
ddsVecFromPoly(poly, aiv2.form);
|
||||
aiv2.boundingBoxBottomLeft = Core::GeoPosition2D(bounds.bottomLeft().x(), bounds.bottomLeft().y());
|
||||
aiv2.boundingBoxTopRight = Core::GeoPosition2D(bounds.topRight().x(), bounds.topRight().y());
|
||||
aiv2.aesTypeId = AesType::AtOffRouteMineSecondary;
|
||||
aiv2.effectStateId = data().effectStateId;
|
||||
aiv2.id = 1000 * m_data.id + static_cast<int>(AesType::AtOffRouteMineSecondary);
|
||||
|
||||
if (m_data.partyId != 0)
|
||||
aiv2.partyId(m_data.partyId);
|
||||
aiv2.partyId = m_data.partyId;
|
||||
|
||||
if (aiv2 != m_aiv2)
|
||||
{
|
||||
aiv2.sampleTime(partitionTimeMSec());
|
||||
aiv2.sampleTime = partitionTimeMSec();
|
||||
m_aiv2 = aiv2;
|
||||
m_mainHandler->dds()->dts()->publish(aiv2);
|
||||
emit newAiv(aiv2);
|
||||
@@ -221,7 +221,7 @@ void ObjectOffRouteMine::removeTopics()
|
||||
{
|
||||
auto dts = m_mainHandler->dds()->dts();
|
||||
dts->removeOffRouteMineByKey(m_data.id);
|
||||
dts->removeAesItemViewByKey(1000 * m_data.id + AesType::AtOffRouteMine);
|
||||
dts->removeAesItemViewByKey(1000 * m_data.id + static_cast<int>(AesType::AtOffRouteMine));
|
||||
emit removeAiv(m_data.id);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ public:
|
||||
*/
|
||||
bool removeObjectFromDb();
|
||||
|
||||
std::vector<Core::GeoPosition> form() const override { return m_aiv.form(); }
|
||||
std::vector<Core::GeoPosition> form() const override { return m_aiv.form; }
|
||||
QPolygonF generateForm() override;
|
||||
AesType aesType() const override { return AesType::AtOffRouteMine; }
|
||||
bool isCentral() const override { return m_data.isCentral; }
|
||||
|
||||
+12
-12
@@ -123,21 +123,21 @@ void ObjectReconArea::publishAiv()
|
||||
const QRectF bounds(poly.boundingRect());
|
||||
|
||||
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.bottomLeft().x(), bounds.bottomLeft().y()));
|
||||
aiv.boundingBoxTopRight(Core::GeoPosition2D(bounds.topRight().x(), bounds.topRight().y()));
|
||||
aiv.aesTypeId(AesType::AtReconArea);
|
||||
aiv.effectStateId(effectState());
|
||||
aiv.id(1000 * m_data.id + AesType::AtReconArea);
|
||||
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.bottomLeft().x(), bounds.bottomLeft().y());
|
||||
aiv.boundingBoxTopRight = Core::GeoPosition2D(bounds.topRight().x(), bounds.topRight().y());
|
||||
aiv.aesTypeId = AesType::AtReconArea;
|
||||
aiv.effectStateId = effectState();
|
||||
aiv.id = 1000 * m_data.id + static_cast<int>(AesType::AtReconArea);
|
||||
|
||||
checkIsCentralAndPublish(aiv.form(), m_aiv.form(), m_data.isCentral);
|
||||
checkIsCentralAndPublish(aiv.form, m_aiv.form, m_data.isCentral);
|
||||
|
||||
if (aiv != m_aiv)
|
||||
{
|
||||
aiv.sampleTime(partitionTimeMSec());
|
||||
aiv.sampleTime = partitionTimeMSec();
|
||||
m_aiv = aiv;
|
||||
m_mainHandler->dds()->dts()->publish(aiv);
|
||||
emit newAiv(aiv);
|
||||
@@ -148,7 +148,7 @@ void ObjectReconArea::removeTopics()
|
||||
{
|
||||
auto dts = m_mainHandler->dds()->dts();
|
||||
dts->removeReconAreaByKey(m_data.id);
|
||||
dts->removeAesItemViewByKey(1000 * m_data.id + AesType::AtReconArea);
|
||||
dts->removeAesItemViewByKey(1000 * m_data.id + static_cast<int>(AesType::AtReconArea));
|
||||
emit removeAiv(m_data.id);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ public:
|
||||
Core::FunctionReplyObject updateObject(const Database::AesReconArea &data) override;
|
||||
Core::FunctionReplyObject removeObject() override;
|
||||
|
||||
std::vector<Core::GeoPosition> form() const override { return m_aiv.form(); }
|
||||
std::vector<Core::GeoPosition> form() const override { return m_aiv.form; }
|
||||
QPolygonF generateForm() override;
|
||||
AesType aesType() const override { return AesType::AtReconArea; }
|
||||
bool isCentral() const override { return m_data.isCentral; }
|
||||
|
||||
+12
-12
@@ -119,21 +119,21 @@ void ObjectTechnicalArea::publishAiv()
|
||||
const QRectF bounds(poly.boundingRect());
|
||||
|
||||
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.bottomLeft().x(), bounds.bottomLeft().y()));
|
||||
aiv.boundingBoxTopRight(Core::GeoPosition2D(bounds.topRight().x(), bounds.topRight().y()));
|
||||
aiv.aesTypeId(AesType::AtTechnicalArea);
|
||||
aiv.effectStateId(effectState());
|
||||
aiv.id(1000 * m_data.id + AesType::AtTechnicalArea);
|
||||
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.bottomLeft().x(), bounds.bottomLeft().y());
|
||||
aiv.boundingBoxTopRight = Core::GeoPosition2D(bounds.topRight().x(), bounds.topRight().y());
|
||||
aiv.aesTypeId = AesType::AtTechnicalArea;
|
||||
aiv.effectStateId = effectState();
|
||||
aiv.id = 1000 * m_data.id + static_cast<int>(AesType::AtTechnicalArea);
|
||||
|
||||
checkIsCentralAndPublish(aiv.form(), m_aiv.form(), m_data.isCentral);
|
||||
checkIsCentralAndPublish(aiv.form, m_aiv.form, m_data.isCentral);
|
||||
|
||||
if (aiv != m_aiv)
|
||||
{
|
||||
aiv.sampleTime(partitionTimeMSec());
|
||||
aiv.sampleTime = partitionTimeMSec();
|
||||
m_aiv = aiv;
|
||||
m_mainHandler->dds()->dts()->publish(aiv);
|
||||
emit newAiv(aiv);
|
||||
@@ -144,7 +144,7 @@ void ObjectTechnicalArea::removeTopics()
|
||||
{
|
||||
auto dts = m_mainHandler->dds()->dts();
|
||||
dts->removeTechnicalAreaByKey(m_data.id);
|
||||
dts->removeAesItemViewByKey(1000 * m_data.id + AesType::AtTechnicalArea);
|
||||
dts->removeAesItemViewByKey(1000 * m_data.id + static_cast<int>(AesType::AtTechnicalArea));
|
||||
emit removeAiv(m_data.id);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -24,9 +24,9 @@ public:
|
||||
Core::FunctionReplyObject updateObject(const Database::AesTechnicalArea &data) override;
|
||||
Core::FunctionReplyObject removeObject() override;
|
||||
|
||||
std::vector<Core::GeoPosition> form() const override { return m_aiv.form(); }
|
||||
std::vector<Core::GeoPosition> form() const override { return m_aiv.form; }
|
||||
QPolygonF generateForm() override;
|
||||
AesType aesType() const override { return AesType_def::AtTechnicalArea; }
|
||||
AesType aesType() const override { return AesType::AtTechnicalArea; }
|
||||
bool isCentral() const override { return m_data.isCentral; }
|
||||
void removeTopics();
|
||||
|
||||
|
||||
Loaded 100 of 102 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user