Migrates AreaEffectSimulation to generated rtiddsgen API

Converts accessor calls to plain member access across aes service and plugin.
This commit is contained in:
berrux-dev committed 2026-09-21 02:45:07 +02:00
1 parent e8d07af320
commit 472f537313
102 files changed
+3307 -3313

No files matched your search

@@ -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)