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