112 lines
3.3 KiB
C++
Executable File
112 lines
3.3 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* Interface
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
*/
|
|
|
|
#include "bccontamination_to_map.h"
|
|
#include <ProjectDataManagement/pdm_dtc.h>
|
|
|
|
|
|
namespace SituationMap
|
|
{
|
|
bool BCContamination2SituationMap::run()
|
|
{
|
|
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
|
|
if (!m_aesDtc)
|
|
{
|
|
ERROR_LOG(m_logger) << LOGFUNCTION << " no dtc";
|
|
return false;
|
|
}
|
|
|
|
connect(m_aesDtc.get(), &AreaEffectSimulation::Interface::Dtc::bCContaminationChanged,
|
|
this, &BCContamination2SituationMap::handleChanged, Qt::UniqueConnection);
|
|
|
|
// get:
|
|
m_aesDtc->bCContaminations([this](const AreaEffectSimulation::BCContamination &data)
|
|
{
|
|
handleChanged(data, DataModification::eAdded);
|
|
});
|
|
|
|
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
|
|
return BaseClass::run();
|
|
}
|
|
|
|
bool BCContamination2SituationMap::updateElementImpl(const Sim2SituationMap::DDS_T &ddsData,
|
|
RefPointer<MAP_T> mapObj)
|
|
{
|
|
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
|
|
|
|
|
|
// show just the ObjectAppearance::Technical
|
|
mapObj->setVisibility(ObjectAppearance::Tactical, false);
|
|
|
|
mapObj->setIdentifier(QString::fromStdString(ddsData.name()));
|
|
|
|
|
|
// if partyId is not set (like B,C agent), use default color
|
|
if (ddsData.partyId().is_set())
|
|
mapObj->setPartyId(ddsData.partyId().get());
|
|
else
|
|
{
|
|
mapObj->setLineStyle(LineStyle(Qt::yellow, 2));
|
|
mapObj->setFillStyle(FillStyle(Qt::yellow, FillPattern::Null));
|
|
}
|
|
|
|
mapObj->setAesState(effectState2aesState(ddsData.effectStateId().underlying()));
|
|
|
|
const int32_t simId = ddsData.id();
|
|
AreaEffectSimulation::AesItemView itemView;
|
|
if (m_aesDtc->aesItemViewFromEntityId(simId, AreaEffectSimulation::AesType::AtBCContamination, itemView))
|
|
this->updateGeometry(itemView, mapObj);
|
|
else
|
|
{
|
|
DEBUG_LOG(m_logger) << LOGFUNCTION
|
|
<< " no AesItemView (AtBCContamination) found"
|
|
<< ", simId = " << simId
|
|
<< ", provide fallBackGeometry";
|
|
|
|
// provide fallbackGeometry to avoid errorMsg like 'incorrect number of positions'
|
|
mapObj->setPositions({{0.0, 0.0, .0},
|
|
{0.0, 0.1, .0},
|
|
{0.1, 0.1, .0},
|
|
{0.1, 0.0, .0}});
|
|
// do not return here, perform stuff like updateVisibility and so on
|
|
}
|
|
|
|
// 'Impact':
|
|
const Core::GeoPosition2D& impactPos2D = ddsData.impactPosition();
|
|
mapObj->setImpactOrigin(Point3D(impactPos2D.lon(), impactPos2D.lat(), 0.0));
|
|
|
|
// Extrusion:
|
|
//
|
|
// Required: RenderingMode::Dynamic ; SurfacePlacementMode::Relative
|
|
// Renderer: initRenderer3D_AesExtrusion ->
|
|
// assignUniqueValueRendererAesCentral3DExtrusion
|
|
// with ExtrusionMode::BaseHeight - means relative to ground
|
|
//
|
|
if (ddsData.partyId().is_set())
|
|
{
|
|
//int height = m_pluginProvider->pdmDtc()->height(ddsData.chargeTypeId());
|
|
// mapObj->setExtrusionColorName();
|
|
// use partyId as Fallback
|
|
//
|
|
// pdm return '0' if chargeTypeId does not exists:
|
|
|
|
int height = ddsData.upperOffset();
|
|
if (height > 0)
|
|
mapObj->setExtrusionHeight(height);
|
|
else
|
|
mapObj->setExtrusionHeight(); // default value to reset
|
|
}
|
|
|
|
updateVisibility(ddsData, mapObj);
|
|
|
|
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
|
|
return true;
|
|
}
|
|
|
|
} // namespace SituationMap
|