Migrates EffectShow and AssetManagement to generated rtiddsgen API
Converts accessor calls to plain member access across esc and asm services.
This commit is contained in:
39 files changed
+818
-818
No files matched your search
+48
-48
@@ -40,7 +40,7 @@ Database::EsmEffectShow EffectShowEffectCluster::getEffectShow(int idx)
|
||||
|
||||
Database::EsmEffectShow esmEffectShow;
|
||||
|
||||
if (!m_handlerPdmData->isSmoke(m_effectCluster.chargeStruct()))
|
||||
if (!m_handlerPdmData->isSmoke(m_effectCluster.chargeStruct))
|
||||
{
|
||||
int indX = idx % m_areasWidth.numOfAreas;
|
||||
int indY = idx / m_areasWidth.numOfAreas;
|
||||
@@ -67,15 +67,15 @@ Database::EsmEffectShow EffectShowEffectCluster::getEffectShow(int idx)
|
||||
|
||||
esmEffectShow.id = 0;
|
||||
esmEffectShow.name = QStringLiteral("EXP");
|
||||
esmEffectShow.startTime = m_effectCluster.effectStart().is_set() ? m_effectCluster.effectStart().get() : 0;
|
||||
esmEffectShow.startTime = m_effectCluster.effectStart.is_set() ? m_effectCluster.effectStart.get() : 0;
|
||||
|
||||
esmEffectShow.centerPosition = centerPosRotated.geographic();
|
||||
esmEffectShow.idAreaEffectSimulation = m_effectCluster.id();
|
||||
esmEffectShow.idAreaEffectSimulation = m_effectCluster.id;
|
||||
esmEffectShow.esmParticipantId = -1;
|
||||
esmEffectShow.nameAreaEfffectSimulation = QString::fromStdString(m_effectCluster.name());
|
||||
esmEffectShow.nameAreaEfffectSimulation = QString::fromStdString(m_effectCluster.name);
|
||||
esmEffectShow.numOfVolley = getNumberOfVolley();
|
||||
esmEffectShow.shotsPerVolley = getShotsPerArea() / esmEffectShow.numOfVolley;
|
||||
esmEffectShow.typeOfAmmunition = m_effectCluster.chargeStruct().chargeTypeId();
|
||||
esmEffectShow.typeOfAmmunition = m_effectCluster.chargeStruct.chargeTypeId;
|
||||
// can there be more then 48 shoots?
|
||||
|
||||
if (esmEffectShow.shotsPerVolley > 48)
|
||||
@@ -85,12 +85,12 @@ Database::EsmEffectShow EffectShowEffectCluster::getEffectShow(int idx)
|
||||
|
||||
DEBUG_LOG(m_logger) << "recalc effectDuration ";
|
||||
|
||||
if (m_effectCluster.effectDuration() == DEFAULT_EFFECT_DURATION)
|
||||
if (m_effectCluster.effectDuration == DEFAULT_EFFECT_DURATION)
|
||||
{
|
||||
QJsonObject probObject = QJsonDocument::fromJson(QByteArray::fromStdString(m_effectCluster.properties())).object();
|
||||
QJsonObject probObject = QJsonDocument::fromJson(QByteArray::fromStdString(m_effectCluster.properties)).object();
|
||||
AreaEffectSimulation::FiringType firingType = AreaEffectSimulation::FiringType::ReportReadyToFire;
|
||||
if (probObject.contains(QStringLiteral("abfeuerungsArt")))
|
||||
firingType = static_cast<AreaEffectSimulation::FiringType::inner_enum>(probObject[QStringLiteral("abfeuerungsArt")].toInt());
|
||||
firingType = static_cast<AreaEffectSimulation::FiringType>(probObject[QStringLiteral("abfeuerungsArt")].toInt());
|
||||
if (firingType == AreaEffectSimulation::FiringType::FireOnCommand)
|
||||
{
|
||||
//use default
|
||||
@@ -100,25 +100,25 @@ Database::EsmEffectShow EffectShowEffectCluster::getEffectShow(int idx)
|
||||
else
|
||||
{
|
||||
// use cadence
|
||||
if (m_effectCluster.effectors().size()) //should always be there!
|
||||
if (m_effectCluster.effectors.size()) //should always be there!
|
||||
{
|
||||
esmEffectShow.duration = m_effectCluster.effectors().at(0).chargeAmount() * m_handlerPdmData.get()->getCadence(m_effectCluster.effectors().at(0).chargeStruct().chargeTypeId());
|
||||
DEBUG_LOG(m_logger) << " recalc effectDuration use cadence value " << esmEffectShow.duration << " effector shots: " << m_effectCluster.effectors().at(0).chargeAmount() << " cadence " << m_handlerPdmData.get()->getCadence(m_effectCluster.effectors().at(0).chargeStruct().chargeTypeId());
|
||||
esmEffectShow.duration = m_effectCluster.effectors.at(0).chargeAmount * m_handlerPdmData.get()->getCadence(m_effectCluster.effectors.at(0).chargeStruct.chargeTypeId);
|
||||
DEBUG_LOG(m_logger) << " recalc effectDuration use cadence value " << esmEffectShow.duration << " effector shots: " << m_effectCluster.effectors.at(0).chargeAmount << " cadence " << m_handlerPdmData.get()->getCadence(m_effectCluster.effectors.at(0).chargeStruct.chargeTypeId);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Use effectDuration directly ";
|
||||
esmEffectShow.duration = m_effectCluster.effectDuration();
|
||||
esmEffectShow.duration = m_effectCluster.effectDuration;
|
||||
}
|
||||
esmEffectShow.lowerLeftPosition = lowerLeftPosRotated.geographic();
|
||||
esmEffectShow.areaWidth = m_areasWidth.side(indX);
|
||||
esmEffectShow.areaDepth = m_areasDepth.side(indY);
|
||||
esmEffectShow.areaRotation = m_effectCluster.area().rotation() + 90;
|
||||
esmEffectShow.areaRotation = m_effectCluster.area.rotation + 90;
|
||||
|
||||
|
||||
DEBUG_LOG(m_logger) << "\nWidth: " << m_effectCluster.area().width() << " Height: " << m_effectCluster.area().height()
|
||||
DEBUG_LOG(m_logger) << "\nWidth: " << m_effectCluster.area.width << " Height: " << m_effectCluster.area.height
|
||||
<< "\nRotated LL Pos: " << lowerLeftPosRotated.mgrs()
|
||||
<< "\nduration: " << esmEffectShow.duration
|
||||
<< "\nRotated Center Pos: " << centerPosRotated.mgrs()
|
||||
@@ -136,30 +136,30 @@ Database::EsmEffectShow EffectShowEffectCluster::getEffectShow(int idx)
|
||||
|
||||
// calculate center position
|
||||
LtsCoordTrans::UtmCoordinate centerPos = lowerLeftPosRotated;
|
||||
centerPos.x = centerPos.x + m_effectCluster.area().width() / 2.;
|
||||
centerPos.y = centerPos.y + m_effectCluster.area().height() / 2.;
|
||||
centerPos.x = centerPos.x + m_effectCluster.area.width / 2.;
|
||||
centerPos.y = centerPos.y + m_effectCluster.area.height / 2.;
|
||||
LtsCoordTrans::UtmCoordinate centerPosRotated = rotate(centerPos, m_lowerLeftPos, rotationRad());
|
||||
|
||||
esmEffectShow.id = 0;
|
||||
esmEffectShow.name = QStringLiteral("EXP");
|
||||
esmEffectShow.startTime = m_effectCluster.effectStart().is_set() ? m_effectCluster.effectStart().get() : 0;
|
||||
esmEffectShow.duration = m_effectCluster.effectDuration();
|
||||
esmEffectShow.startTime = m_effectCluster.effectStart.is_set() ? m_effectCluster.effectStart.get() : 0;
|
||||
esmEffectShow.duration = m_effectCluster.effectDuration;
|
||||
esmEffectShow.centerPosition = centerPosRotated.geographic();
|
||||
esmEffectShow.idAreaEffectSimulation = m_effectCluster.id();
|
||||
esmEffectShow.idAreaEffectSimulation = m_effectCluster.id;
|
||||
esmEffectShow.esmParticipantId = -1;
|
||||
esmEffectShow.nameAreaEfffectSimulation = QString::fromStdString(m_effectCluster.name());
|
||||
esmEffectShow.typeOfAmmunition = m_effectCluster.chargeStruct().chargeTypeId();
|
||||
esmEffectShow.nameAreaEfffectSimulation = QString::fromStdString(m_effectCluster.name);
|
||||
esmEffectShow.typeOfAmmunition = m_effectCluster.chargeStruct.chargeTypeId;
|
||||
esmEffectShow.numOfVolley = 1;
|
||||
esmEffectShow.shotsPerVolley = 1;
|
||||
esmEffectShow.lowerLeftPosition = lowerLeftPosRotated.geographic();
|
||||
esmEffectShow.areaWidth = m_effectCluster.area().width();
|
||||
esmEffectShow.areaDepth = m_effectCluster.area().height();
|
||||
esmEffectShow.areaRotation = m_effectCluster.area().rotation() + 90;
|
||||
esmEffectShow.areaWidth = m_effectCluster.area.width;
|
||||
esmEffectShow.areaDepth = m_effectCluster.area.height;
|
||||
esmEffectShow.areaRotation = m_effectCluster.area.rotation + 90;
|
||||
|
||||
DEBUG_LOG(m_logger) << "\nWidth: " << m_effectCluster.area().width() << " Height: " << m_effectCluster.area().height()
|
||||
DEBUG_LOG(m_logger) << "\nWidth: " << m_effectCluster.area.width << " Height: " << m_effectCluster.area.height
|
||||
<< "\nRotated LL Pos: " << lowerLeftPosRotated.mgrs()
|
||||
<< "\nRotated Center Pos: " << centerPosRotated.mgrs()
|
||||
<< "\nSide x,y: " << m_effectCluster.area().width() << " , " << m_effectCluster.area().height();
|
||||
<< "\nSide x,y: " << m_effectCluster.area.width << " , " << m_effectCluster.area.height;
|
||||
}
|
||||
|
||||
return esmEffectShow;
|
||||
@@ -169,18 +169,18 @@ void EffectShowEffectCluster::updateEffectShow(Database::EsmEffectShow &data)
|
||||
{
|
||||
|
||||
DEBUG_LOG(m_logger) << "update EffectSHow for (" << data.id << ")";
|
||||
data.nameAreaEfffectSimulation = QString::fromStdString(m_effectCluster.name());
|
||||
data.startTime = m_effectCluster.effectStart().is_set() ? m_effectCluster.effectStart().get() : 0;
|
||||
data.nameAreaEfffectSimulation = QString::fromStdString(m_effectCluster.name);
|
||||
data.startTime = m_effectCluster.effectStart.is_set() ? m_effectCluster.effectStart.get() : 0;
|
||||
|
||||
|
||||
DEBUG_LOG(m_logger) << "Recalc effectDuration ";
|
||||
|
||||
if (m_effectCluster.effectDuration() == DEFAULT_EFFECT_DURATION)
|
||||
if (m_effectCluster.effectDuration == DEFAULT_EFFECT_DURATION)
|
||||
{
|
||||
QJsonObject probObject = QJsonDocument::fromJson(QByteArray::fromStdString(m_effectCluster.properties())).object();
|
||||
QJsonObject probObject = QJsonDocument::fromJson(QByteArray::fromStdString(m_effectCluster.properties)).object();
|
||||
AreaEffectSimulation::FiringType firingType = AreaEffectSimulation::FiringType::ReportReadyToFire;
|
||||
if (probObject.contains(QStringLiteral("abfeuerungsArt")))
|
||||
firingType = static_cast<AreaEffectSimulation::FiringType::inner_enum>(probObject[QStringLiteral("abfeuerungsArt")].toInt());
|
||||
firingType = static_cast<AreaEffectSimulation::FiringType>(probObject[QStringLiteral("abfeuerungsArt")].toInt());
|
||||
if (firingType == AreaEffectSimulation::FiringType::FireOnCommand)
|
||||
{
|
||||
//use default
|
||||
@@ -190,17 +190,17 @@ void EffectShowEffectCluster::updateEffectShow(Database::EsmEffectShow &data)
|
||||
else
|
||||
{
|
||||
// use cadence
|
||||
if (m_effectCluster.effectors().size()) //should always be there!
|
||||
if (m_effectCluster.effectors.size()) //should always be there!
|
||||
{
|
||||
data.duration = m_effectCluster.effectors().at(0).chargeAmount() * m_handlerPdmData.get()->getCadence(m_effectCluster.effectors().at(0).chargeStruct().chargeTypeId());
|
||||
DEBUG_LOG(m_logger) << " recalc effectDuration use cadence value " << data.duration << " effector shots: " << m_effectCluster.effectors().at(0).chargeAmount() << " cadence " << m_handlerPdmData.get()->getCadence(m_effectCluster.effectors().at(0).chargeStruct().chargeTypeId());
|
||||
data.duration = m_effectCluster.effectors.at(0).chargeAmount * m_handlerPdmData.get()->getCadence(m_effectCluster.effectors.at(0).chargeStruct.chargeTypeId);
|
||||
DEBUG_LOG(m_logger) << " recalc effectDuration use cadence value " << data.duration << " effector shots: " << m_effectCluster.effectors.at(0).chargeAmount << " cadence " << m_handlerPdmData.get()->getCadence(m_effectCluster.effectors.at(0).chargeStruct.chargeTypeId);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Use effectDuration directly ";
|
||||
data.duration = m_effectCluster.effectDuration();
|
||||
data.duration = m_effectCluster.effectDuration;
|
||||
}
|
||||
|
||||
if (data.shotsPerVolley > 48)
|
||||
@@ -208,21 +208,21 @@ void EffectShowEffectCluster::updateEffectShow(Database::EsmEffectShow &data)
|
||||
if (data.shotsPerVolley <= 0)
|
||||
data.shotsPerVolley = 1;
|
||||
|
||||
data.typeOfAmmunition = m_effectCluster.chargeStruct().chargeTypeId();
|
||||
data.esmParticipantId = (m_effectCluster.esmParticipantIds().size() > 0)
|
||||
? m_effectCluster.esmParticipantIds().at(0)
|
||||
data.typeOfAmmunition = m_effectCluster.chargeStruct.chargeTypeId;
|
||||
data.esmParticipantId = (m_effectCluster.esmParticipantIds.size() > 0)
|
||||
? m_effectCluster.esmParticipantIds.at(0)
|
||||
: -1;
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void EffectShowEffectCluster::calculateSquare()
|
||||
{
|
||||
Core::GeoPosition2D geoPos = m_effectCluster.area().cornerBottomLeft();
|
||||
m_lowerLeftPos = LtsCoordTrans::UtmCoordinate::fromGeographic(geoPos.lon(), geoPos.lat());
|
||||
Core::GeoPosition2D geoPos = m_effectCluster.area.cornerBottomLeft;
|
||||
m_lowerLeftPos = LtsCoordTrans::UtmCoordinate::fromGeographic(geoPos.lon, geoPos.lat);
|
||||
|
||||
// Calculate squares.
|
||||
m_areasWidth = getAreasSideLength(m_effectCluster.area().width()); // Squares in x-direction
|
||||
m_areasDepth = getAreasSideLength(m_effectCluster.area().height()); // Squares in y-direction
|
||||
m_numOfEffectShows = m_handlerPdmData->effectShowCount(m_effectCluster.chargeStruct());
|
||||
m_areasWidth = getAreasSideLength(m_effectCluster.area.width); // Squares in x-direction
|
||||
m_areasDepth = getAreasSideLength(m_effectCluster.area.height); // Squares in y-direction
|
||||
m_numOfEffectShows = m_handlerPdmData->effectShowCount(m_effectCluster.chargeStruct);
|
||||
}
|
||||
//static ----------------------------------------------------------------------
|
||||
LtsCoordTrans::UtmCoordinate EffectShowEffectCluster::rotate(const LtsCoordTrans::UtmCoordinate &p, const LtsCoordTrans::UtmCoordinate &c, double angle)
|
||||
@@ -268,9 +268,9 @@ int EffectShowEffectCluster::getShotsPerArea() const
|
||||
if (!m_numOfEffectShows)
|
||||
return 0;
|
||||
int v = 0;
|
||||
for (const auto &effector: m_effectCluster.effectors())
|
||||
for (const auto &effector: m_effectCluster.effectors)
|
||||
{
|
||||
v+= effector.chargeAmount();
|
||||
v+= effector.chargeAmount;
|
||||
}
|
||||
return v / m_numOfEffectShows; //split even across all effect shows
|
||||
}
|
||||
@@ -280,9 +280,9 @@ int EffectShowEffectCluster::getShotsPerArea(int areas) const
|
||||
if (areas == 0)
|
||||
return 0;
|
||||
int v = 0;
|
||||
for (const auto &effector: m_effectCluster.effectors())
|
||||
for (const auto &effector: m_effectCluster.effectors)
|
||||
{
|
||||
v+= effector.chargeAmount();
|
||||
v+= effector.chargeAmount;
|
||||
}
|
||||
return v / areas;
|
||||
}
|
||||
@@ -308,7 +308,7 @@ int EffectShowEffectCluster::getNumberOfVolley(int v)
|
||||
//-----------------------------------------------------------------------------
|
||||
double EffectShowEffectCluster::rotationRad() const
|
||||
{
|
||||
return -m_effectCluster.area().rotation() * LtsCoordTrans::deg2rad();
|
||||
return -m_effectCluster.area.rotation * LtsCoordTrans::deg2rad();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
Reference in new issue
Block a user