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
+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;
|
||||
|
||||
Reference in new issue
Block a user