Files
qt5-legatus-legacy/Lts/Viewer/SituationMap/MapObjectsImpl/area_fire_impl.cpp
T
2026-08-13 18:33:10 +02:00

821 lines
30 KiB
C++
Executable File

/**
* @RDE_HEADER@
* Interface-Implementation of AreaFire
* $Id$
* $HeadURL$
* $Author$
*/
// Own
#include "area_fire_impl.h"
#include <MapImpl/map_impl.h>
#include <GraphicalObjects/graphical_object_path.h>
#include <GraphicalObjects/graphical_object_scene_marker.h>
#include <GraphicalObjects/graphical_object_renderer_attributes.h>
#include "single_fire_impl.h"
#include <Symbology/sidc_codec.h>
// ESRI
#ifdef LTS_DEBUG
#include <QMessageBox>
#include <arcgis/Graphic.h>
#endif // LTS_DEBUG
// Qt
//#define USE_MARKER
namespace SituationMap
{
static int s_gunToTargetLine3DKEY = -1;
static int s_gunToTargetLineSurfaceKEY = 0;
static int s_nonLethalAreaKEY = 1;
class AreaFireImpl::Private
{
public:
Private() = default;
~Private() = default;
// ESRI data:
// Esri::ArcGISRuntime::GraphicsOverlay *m_graphicsLayer = nullptr;
// Own data:
MapImpl *m_mapImpl = nullptr;
QString m_logicalLayer;
QString m_debugInfo; // will be appended by consecutive number
UniqueMapId m_uniqueMapId = INVALID_MAP_ID;
SimpleValue<QColor> m_scheduledImpactsExplcitColor; // by default invalid color
struct Detonations
{
PositionsTranslated m_detonationPositions;
SimpleValue<double> m_detonationRadius{5};
bool m_detonationChanged{true};
bool changed() const { return m_detonationRadius.changed() || m_detonationChanged; }
void reset() { m_detonationRadius.reset(); m_detonationChanged = false; }
} m_detonationsAbsolute, m_detonationsDraped;
//
// ABSOLUTE using SceneMarker
//
struct ValueDataGOSM_Abs
{
QSharedPointer<GraphicalObjectSceneMarker> m_goSceneMarker;
};
QVector<ValueDataGOSM_Abs> m_cont_VDGOSM_Abs;
void resizeGOSM_Abs(int newSize) { m_cont_VDGOSM_Abs.resize(newSize); }
ValueDataGOSM_Abs& getObjectGOSM_abs(int idx)
{
ValueDataGOSM_Abs &retRef = m_cont_VDGOSM_Abs[idx];
if (retRef.m_goSceneMarker.isNull())
{
Esri::ArcGISRuntime::GraphicsOverlay *graphicsLayer = m_mapImpl->getGraphicsLayer3D_SpAbsolute(m_logicalLayer);
if (!graphicsLayer)
{
qCritical() << LOGFUNCTION << " debugInfo='" << m_debugInfo << "'"
<< " getGraphicsLayer3D_SpAbsolute failed";
}
QString debugInfo = QStringLiteral("%1#ModelSceneMarkerAbs(%2)").arg(m_debugInfo).arg(idx);
GraphicalObjectSceneMarker *temp = new GraphicalObjectSceneMarker(SituationMap::SceneMarkerType::SPHERE,
m_mapImpl->getEsriGeoView(),
graphicsLayer,
debugInfo,
m_uniqueMapId);
temp->setUniqueMapId(m_uniqueMapId);
retRef.m_goSceneMarker = QSharedPointer<GraphicalObjectSceneMarker>(temp);
}
return retRef;
}
//
// DRAPED a) using renderer approach
//
#ifdef AREA_FIRE_DRAPED_RENDERER // GUEZE_2933
struct ValueDataGORA_Drpd
{
QSharedPointer<GraphicalObjectRendererAttributes> m_goRendererAtt;
};
QVector<ValueDataGORA_Drpd> m_cont_GORA_drpd;
void resizeDraped_GORA(int newSize)
{
m_cont_GORA_drpd.resize(newSize);
}
ValueDataGORA_Drpd& getObjectDraped_GORA(int idx, Esri::ArcGISRuntime::GraphicsOverlay *graphicsLayer)
{
Q_ASSERT(graphicsLayer);
ValueDataGORA_Drpd &retRef = m_cont_GORA_drpd[idx];
if (retRef.m_goRendererAtt.isNull())
{
QString debugInfo = QStringLiteral("%1#Drpd_goRendererAtt_%2").arg(m_debugInfo).arg(idx);
retRef.m_goRendererAtt = QSharedPointer<GraphicalObjectRendererAttributes>
(new GraphicalObjectRendererAttributes(m_mapImpl->getEsriGeoView()
, graphicsLayer
, debugInfo
, m_uniqueMapId)
);
retRef.m_goRendererAtt->setUniqueMapId(m_uniqueMapId);
}
return retRef;
}
static QVariantMap createGORA_AttributeMap(const QColor &majorColor, double radius)
{
QVariantMap attribMap;
QString attribValue;
{
attribValue = QString(QStringLiteral("Impact_Color_%1")).arg(majorColor.name());
attribMap.insert(QStringLiteral("IMPACT_COLOR"), attribValue);
}
{
const double radiusWithMin = std::max(radius, 1.0); // at least 1 meter
attribValue = QString(QStringLiteral("Impact_Radius_%1")).arg(radiusWithMin);
attribMap.insert(QStringLiteral("IMPACT_RADIUS"), attribValue);
}
{
LayerFactory::UniqueValueDataAesCentral::TYPE type{LayerFactory::UniqueValueDataAesCentral::TYPE::SPHERE};
attribValue = QString(QStringLiteral("Impact_Type_%1")).arg(LayerFactory::toString(type));
attribMap.insert(QStringLiteral("IMPACT_TYPE"), attribValue);
}
// {
// // SceneProperties: HEADING, PITCH, ROLL
// int heading = 0;
// if (data.rotationAngle().is_set())
// heading = static_cast<int>(data.rotationAngle().get());
// attribMap.insert(QStringLiteral("HEADING"), ((heading+90)%360)); // data.rotationAngle()
// attribMap.insert(QStringLiteral("PITCH"), 0);
// attribMap.insert(QStringLiteral("ROLL"), 90);
// }
// qCritical() << " ident " << ", " << attribMap;
return attribMap;
}
#else
//
// DRAPED b) using SceneMarker (see also GUEZE_2933)
//
struct ValueDataGOSM_Drpd
{
QSharedPointer<GraphicalObjectSceneMarker> m_goSceneMarker;
};
QVector<ValueDataGOSM_Drpd> m_cont_GOSM_drpd;
void resizeDraped_GOSM(int newSize)
{
m_cont_GOSM_drpd.resize(newSize);
}
ValueDataGOSM_Drpd& getObjectDraped_GOSM(int idx, Esri::ArcGISRuntime::GraphicsOverlay *graphicsLayer)
{
Q_ASSERT(graphicsLayer);
ValueDataGOSM_Drpd &retRef = m_cont_GOSM_drpd[idx];
if (retRef.m_goSceneMarker.isNull())
{
QString debugInfo = QStringLiteral("%1#Drpd_GOSM_%2").arg(m_debugInfo).arg(idx);
GraphicalObjectSceneMarker *temp = new GraphicalObjectSceneMarker(SituationMap::SceneMarkerType::SPHERE,
m_mapImpl->getEsriGeoView(),
graphicsLayer,
debugInfo,
m_uniqueMapId);
temp->setUniqueMapId(m_uniqueMapId);
retRef.m_goSceneMarker = QSharedPointer<GraphicalObjectSceneMarker>(temp);
}
return retRef;
}
#endif // AREA_FIRE_DRAPED_RENDERER
}; // class AreaFireImpl::Private
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// class AreaFireImpl
//-----------------------------------------------------------------------------
AreaFireImpl::AreaFireImpl(const QString &debugInfo)
: AreaFire() // Interface
, BaseClass(debugInfo) // Implementation
, d(new Private)
, m_logger(getLogger("AreaFireImpl"))
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START, debugInfo=" << m_debugInfo;
m_fillColorAlpha = 200;
TRACE_LOG(m_logger) << LOGFUNCTION << " END, debugInfo=" << m_debugInfo;
}
AreaFireImpl::~AreaFireImpl()
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START, debugInfo=" << m_debugInfo;
delete d;
TRACE_LOG(m_logger) << LOGFUNCTION << " END, debugInfo=" << m_debugInfo;
}
void AreaFireImpl::setUniqueId(const UniqueMapId &uniqueId)
{
BaseClass::setUniqueId(uniqueId);
d->m_uniqueMapId = m_uniqueMapId;
}
PositionCont AreaFireImpl::scheduledImpacts() const
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
return this->rIndicationContainer().positions(1);
}
void AreaFireImpl::setScheduledImpacts(const PositionCont &posCont, const QColor &explicitColor)
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START"
<< " scheduledImpactsSize=" << posCont.size()
<< " explicitColor=" << explicitColor
;
IndicationContainer &drapedImpactsIC = this->rIndicationContainer();
drapedImpactsIC.setDebugInfo(m_debugInfo + QStringLiteral("DefaultSpDraped"));
drapedImpactsIC.setPositions(1, posCont);
d->m_scheduledImpactsExplcitColor = explicitColor;
}
PositionCont AreaFireImpl::impacts() const
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
return this->rIndicationContainer().positions(0);
}
void AreaFireImpl::setImpacts(const PositionCont &posCont)
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START"
<< ", impactSize=" << posCont.size();
IndicationContainer &drapedImpactsIC = this->rIndicationContainer();
drapedImpactsIC.setDebugInfo(m_debugInfo + QStringLiteral("DefaultSpDraped"));
drapedImpactsIC.setPositions(0, posCont);
#ifdef USE_MARKER
drapedImpactsIC.setMarker(0, MarkerSymbolType::X, 20, partyColor());
#endif
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
}
PositionCont AreaFireImpl::impactsAbsoluteHeight() const
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
return this->rIndicationContainerAbsolute().positions(0);
}
void AreaFireImpl::setImpactsAbsoluteHeight(const PositionCont &posCont)
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START"
<< " impactSize=" << posCont.size()
<< " lineStyle().lineColor()=" << lineStyle().lineColor();
IndicationContainer &impactsAbsolute = this->rIndicationContainerAbsolute();
impactsAbsolute.setDebugInfo(m_debugInfo + QStringLiteral("SpAbso"));
impactsAbsolute.setPositions(0, posCont);
#ifdef USE_MARKER
impacts.setMarker(0, MarkerSymbolType::X, 20, partyColor());
#endif
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
}
PositionCont AreaFireImpl::detonationsAbsolute() const
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
return d->m_detonationsAbsolute.m_detonationPositions.positions();
}
bool AreaFireImpl::setDetonationsAbsolute(const PositionCont &detonationsPositions, int detonationRadius)
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START" << ", set detonationsPositions = " << detonationsPositions
<< ", radius=" << detonationRadius;
bool bHasChanged = d->m_detonationsAbsolute.m_detonationPositions.setPositions(detonationsPositions);
d->m_detonationsAbsolute.m_detonationRadius = detonationRadius;
d->m_detonationsAbsolute.m_detonationChanged = d->m_detonationsAbsolute.m_detonationChanged || bHasChanged; // Do not reset of changed==true; (maybe it was already changed)
TRACE_LOG(m_logger) << LOGFUNCTION << " END" << ", bHasChanged=" << d->m_detonationsAbsolute.changed();
return d->m_detonationsAbsolute.changed();
}
PositionCont AreaFireImpl::detonationsDraped() const
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
return d->m_detonationsDraped.m_detonationPositions.positions();
}
bool AreaFireImpl::setDetonationsDraped(const PositionCont &detonationsPositions, int detonationRadius)
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START" << ", set detonationsPositions = " << detonationsPositions
<< ", radius=" << detonationRadius;
bool bHasChanged = d->m_detonationsDraped.m_detonationPositions.setPositions(detonationsPositions);
d->m_detonationsDraped.m_detonationRadius = detonationRadius;
d->m_detonationsDraped.m_detonationChanged = d->m_detonationsDraped.m_detonationChanged || bHasChanged; // Do not reset of changed==true; (maybe it was already changed)
TRACE_LOG(m_logger) << LOGFUNCTION << " END" << ", bHasChanged=" << d->m_detonationsDraped.changed();
return d->m_detonationsDraped.changed();
}
void AreaFireImpl::setGunToTargetLineSurface(const Point3D &start, const Point3D &end)
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START"
<< ", start=" << start << ", end=" << end << ", debugInfo=" << m_debugInfo;
PathContainer &path = this->rPathContainer(); // should be SP::Draped
path.setDebugInfo(m_debugInfo + QStringLiteral("SpDraped"));
if (start.isNull() && end.isNull())
{
path.clear(s_gunToTargetLineSurfaceKEY); // 0
} else {
LineStyle ls = m_mainGraphicalObject->lineStyle();
ls.setLinePattern(LinePattern::Dot);
ls.setLineWidth(2);
path.setLineStyle(ls);
path.setPath(s_gunToTargetLineSurfaceKEY, {start, end});
}
TRACE_LOG(m_logger) << LOGFUNCTION << " END"
<< ", start=" << start << ", end=" << end << ", debugInfo=" << m_debugInfo;
}
void AreaFireImpl::setGunToTargetTrajectory3D(const PositionCont &gunToTargetPath)
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START"
<< ", gunToTargetPath=" << gunToTargetPath.size()
<< ", debugInfo=" << m_debugInfo;
PathContainer &path3D_Abs = this->rPathContainerSpAbsolute2(); // should be SP::Absolute
path3D_Abs.setDebugInfo(m_debugInfo + QStringLiteral("Absolute"));
path3D_Abs.setDrawOrder(5);
if (gunToTargetPath.isEmpty())
{
path3D_Abs.clear(s_gunToTargetLine3DKEY); // -1
} else {
LineStyle ls = m_mainGraphicalObject->lineStyle();
// Try to reduce z-Fighting between gunToTarget and trajectory.
// by reducing the opacity (GUEZE-2722)
QColor lCol = ls.lineColor();
lCol.setAlphaF(0.99);
ls.setLineColor(lCol);
ls.setLinePattern(LinePattern::Dot);
ls.setLineWidth(1);
path3D_Abs.setLineStyle(ls);
path3D_Abs.setPath(s_gunToTargetLine3DKEY, gunToTargetPath);
}
TRACE_LOG(m_logger) << LOGFUNCTION << " END"
<< ", gunToTargetPath=" << gunToTargetPath.size()
<< ", debugInfo=" << m_debugInfo;
}
void AreaFireImpl::setNonLethalArea(const PositionCont &nonLethalArea)
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START"
<< ", nonLethalArea=" << nonLethalArea.size()
<< ", debugInfo=" << m_debugInfo;
// avoid creating PathContainer in case of non-existing data:
if (nonLethalArea.size() < 3)
{
clearPathContainerSpDrapedPolygon(s_nonLethalAreaKEY);
return;
}
PathContainer &path = this->rPathContainerSpDrapedPolygon();
path.setDebugInfo(m_debugInfo + QStringLiteral("SpDrapedNonLethalArea"));
// LineStyle ls = m_mainGraphicalObject->lineStyle();
// ls.setLineColor(partyColor());
// ls.setLinePattern(LinePattern::Solid);
// ls.setLineWidth(2);
// path.setLineStyle(ls);
// const FillStyle &fs = m_mainGraphicalObject->fillStyle();
// path.setFillStyle(fs);
path.setPath(s_nonLethalAreaKEY, nonLethalArea); // 1
TRACE_LOG(m_logger) << LOGFUNCTION << " END"
<< ", nonLethalArea=" << nonLethalArea.size()
<< ", debugInfo=" << m_debugInfo;
}
PositionCont AreaFireImpl::trajectory(int index) const
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START" << ", index=" << index;
TRACE_LOG(m_logger) << LOGFUNCTION << " END" << ", index=" << index;
return this->rPathContainerSpAbsolute1().path(index);
}
bool AreaFireImpl::setTrajectory(int index, const PositionCont &trajectoryPath)
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START"
<< " index=" << index
<< ", trajectoryPath.size=" << trajectoryPath.size()
<< ", lineStyle().lineColor()=" << lineStyle().lineColor();
PathContainer &path = this->rPathContainerSpAbsolute1(); // Trajectory -> Absolute
path.setDebugInfo(m_debugInfo + QStringLiteral("Draped"));
path.setDrawOrder(6); // 'above' guntToTargetLine/guntToTargetCurve
LineStyle ls = this->lineStyle();
ls.setLinePattern(LinePattern::Solid);
ls.setLineWidth(2);
path.setLineStyle(ls);
return path.setPath(index, trajectoryPath);
}
bool AreaFireImpl::updateViewImpl()
{
DEBUG_LOG(m_logger) << LOGFUNCTION << " START"
<< ", m_debugInfo=" << m_debugInfo
<< ", visibility=" << m_visibility
<< ", visiTechn=" << m_visibilityTechnical
<< ", visiTact=" << m_visibilityTactical
// IndicationContainer &drapedImpactsIC = this->rIndicationContainer();
// IndicationContainer &impactsAbsolute = this->rIndicationContainerAbsolute();
<< ", d->m_detonationsAbsolute.changed() = " << d->m_detonationsAbsolute.changed()
<< ", d->m_detonationsAbsolute.size() = " << d->m_detonationsAbsolute.m_detonationPositions.size()
<< ", d->m_detonationsDraped.changed() = " << d->m_detonationsDraped.changed()
<< ", d->m_detonationsDraped.size() = " << d->m_detonationsDraped.m_detonationPositions.size();
for (IndicationContainer *indCont : {m_indicationCont, m_indicationContSpAbsolute})
{
if (!indCont)
continue;
if (m_mainGraphicalObject)
{
#ifdef USE_MARKER
indCont->setMarker(0, col);
#else
if (indCont->image(0).isNull() || m_party.partyId.changed())
{
const QColor &col = m_mainGraphicalObject->lineStyle().lineColor();
indCont->setImage(0, SingleFireImpl::renderImpactSymbol(col, 20, true)); // filled for impacts
}
if (indCont->image(1).isNull() || m_party.partyId.changed() || d->m_scheduledImpactsExplcitColor.changed())
{
d->m_scheduledImpactsExplcitColor.reset();
QColor col = d->m_scheduledImpactsExplcitColor.value();
if (!col.isValid())
col = m_mainGraphicalObject->lineStyle().lineColor();
indCont->setImage(1, SingleFireImpl::renderImpactSymbol(col, 20, false)); // open for scheduledImpacts
}
#endif
}
indCont->setSelected(0, m_selected);
indCont->setPickable(0, m_pickable);
indCont->setVisible(0, m_visibility);
indCont->setSelected(1, m_selected);
indCont->setPickable(1, m_pickable);
indCont->setVisible(1, m_visibility);
} // for (IndicationContainer *indCont...
// control selection
if (m_pathCont_SpDraped)
{
m_pathCont_SpDraped->setSelected(m_selected);
// m_pathCont_SpDraped->setPickable(0, m_pickable);
m_pathCont_SpDraped->setVisibility(s_gunToTargetLineSurfaceKEY, m_visibility); // 0 -> GunToTargetLineSurface
}
if (m_pathCont_SpDrapedPolygon)
{
m_pathCont_SpDrapedPolygon->setSelected(m_selected);
// m_pathCont->setPickable(0, m_pickable);
m_pathCont_SpDrapedPolygon->setVisibility(s_nonLethalAreaKEY, m_visibility);
LineStyle ls = m_mainGraphicalObject->lineStyle();
ls.setLinePattern(LinePattern::Solid);
ls.setLineWidth(2);
m_pathCont_SpDrapedPolygon->setLineStyle(ls);
FillStyle fs = m_mainGraphicalObject->fillStyle();
m_pathCont_SpDrapedPolygon->setFillStyle(fs);
}
if (m_pathCont_SpAbsolute1)
{
const auto &keys = m_pathCont_SpAbsolute1->getIndicationIndexList();
for (auto keyIndex : qAsConst(keys))
m_pathCont_SpAbsolute1->setVisibility(keyIndex, m_visibility); // trajectories
m_pathCont_SpAbsolute1->setSelected(m_selected);
// m_pathCont->setPickable(0, m_pickable);
}
if (m_pathCont_SpAbsolute2)
{
m_pathCont_SpAbsolute2->setSelected(m_selected);
// m_pathCont->setPickable(0, m_pickable);
m_pathCont_SpAbsolute2->setVisibility(s_gunToTargetLine3DKEY, m_visibility); // -1 -> GunToTargetLine3D
}
const bool mgoVisiOld = m_mainGraphicalObject->visibility();
bool success = BaseClass::updateViewImpl();
if (!success)
ERROR_LOG(m_logger) << LOGFUNCTION << " updateViewImpl failed";
// Detonations (3D)
bool successDetonationsAbs = true;
if ( (m_mapImpl->mode() == Mode::Mode_3D) &&
(d->m_detonationsAbsolute.changed() || (mgoVisiOld != m_mainGraphicalObject->visibility()))
)
{
const PositionCont &positionsTranslated = d->m_detonationsAbsolute.m_detonationPositions.positionsTranslated();
const int newSize = positionsTranslated.size();
DEBUG_LOG(m_logger) << LOGFUNCTION << " resizeGOSM_Abs" << d->m_cont_VDGOSM_Abs.size() << " to " << newSize;
d->resizeGOSM_Abs(newSize);
int idx = 0;
for(const Point3D &point3DTranslated : qAsConst(positionsTranslated))
{
Private::ValueDataGOSM_Abs &vdGOSM_absRef = d->getObjectGOSM_abs(idx);
QSharedPointer<GraphicalObjectSceneMarker> goSceneMarker = vdGOSM_absRef.m_goSceneMarker;
goSceneMarker->setOrigin(point3DTranslated);
goSceneMarker->setDiameter(d->m_detonationsAbsolute.m_detonationRadius.value() * 2);
goSceneMarker->setPickable(false);
goSceneMarker->setSelected(false);
QColor col = partyColor();
col.setAlphaF(col.alphaF() / 2.0);
goSceneMarker->setFillStyle(FillStyle(col, FillPattern::Solid));
goSceneMarker->setVisibility(m_visibility);
if (!goSceneMarker->updateView())
successDetonationsAbs = false;
++idx;
} // for
if (!successDetonationsAbs)
ERROR_LOG(m_logger) << LOGFUNCTION << " updateView m_goSceneMarker failed, m_debugInfo = " << m_debugInfo;
d->m_detonationsAbsolute.reset();
} else {
// To simplifiy debugging:
d->m_detonationsAbsolute.reset();
}
DEBUG_LOG(m_logger) << LOGFUNCTION << " START"
<< ", m_debugInfo=" << m_debugInfo
<< ", d->m_detonationsDraped.changed = " << d->m_detonationsDraped.changed();
bool successDetonationsDrpd = true;
if ( (m_mapImpl->mode() == Mode::Mode_3D) &&
(d->m_detonationsDraped.changed() || (mgoVisiOld != m_mainGraphicalObject->visibility())) )
{
#ifdef AREA_FIRE_DRAPED_RENDERER
successDetonationsDrpd = updateViewImplDetonation3dDraped_RendererApproach();
#else
successDetonationsDrpd = updateViewImplDetonation3dDraped_SceneMarkerApproach();
#endif // AREA_FIRE_DRAPED_RENDERER
} else {
// to simplify debugging:
d->m_detonationsDraped.reset();
}
success = success && successDetonationsAbs && successDetonationsDrpd;
#ifdef LTS_DEBUG
const bool afVisi = m_visibility;
const bool mgoVisi = m_mainGraphicalObject->visibility();
const bool esriGraphicVisi = m_mainGraphicalObject->graphic()->isVisible();
// REGG-5360 - Wenn man beim Beobachten der Live-Lage über den Wirksimulationsfilter alle gepla..
// ... sind Flächenfeuer entgegen dem Filter sichtbar
if ( (afVisi != mgoVisi) || (afVisi != esriGraphicVisi) )
{
for (int i = 0; i < 100; ++i)
FATAL_LOG(m_logger) << LOGFUNCTION << " INKONSISTENCY!!!!!!!!!!!!!!";
FATAL_LOG(m_logger) << LOGFUNCTION << " INKONSISTENCY!!!!!!!!!!!!!!"
<< ", afVisi=" << afVisi
<< ", mgoVisi=" << mgoVisi
<< ", esriGraphicVisi" << esriGraphicVisi;
QMessageBox::critical(nullptr,
QLatin1String("INKONSISTENCY"),
QLatin1String("INKONSISTENCY, corefile wil be created ; check logfile regarding REGG-5360.."));
abort();
}
#endif // LTS_DEBUG
TRACE_LOG(m_logger) << LOGFUNCTION << " END, success=" << success;
return success;
}
#ifdef AREA_FIRE_DRAPED_RENDERER
bool AreaFireImpl::updateViewImplDetonation3dDraped_RendererApproach() // GUEZE_2933
{
DEBUG_LOG(m_logger) << LOGFUNCTION << " START"
<< ", m_debugInfo=" << m_debugInfo
<< ", visibility=" << m_visibility
<< ", visiTechn=" << m_visibilityTechnical
<< ", visiTact=" << m_visibilityTactical
<< ", d->m_detonationsDraped.changed() = " << d->m_detonationsDraped.changed()
<< ", d->m_detonationsDraped.size() = " << d->m_detonationsDraped.m_detonationPositions.size();
bool successDetonationsDrpd = true;
if ((m_mapImpl->mode() == Mode::Mode_3D) && d->m_detonationsDraped.changed())
{
const PositionCont &positionsTranslated_drpdTrans = d->m_detonationsDraped.m_detonationPositions.positionsTranslated();
const int newSize = positionsTranslated_drpdTrans.size();
d->resizeDraped_GORA(newSize);
int idx = 0;
for(const Point3D &point3DTranslated : qAsConst(positionsTranslated_drpdTrans))
{
Private::ValueDataGORA_Drpd &vdGORA_drpdRef = d->getObjectDraped_GORA(idx, m_graphicsLayer);
QSharedPointer<GraphicalObjectRendererAttributes> goRendererAtt = vdGORA_drpdRef.m_goRendererAtt;
goRendererAtt->setOrigin(point3DTranslated);
const QVariantMap &attribMap = d->createGORA_AttributeMap(m_mainGraphicalObject->lineStyle().lineColor(), d->m_detonationsDraped.m_detonationRadius.value());
if (m_logger.isDebugEnabled())
qCritical() << LOGFUNCTION << " START"
<< ", m_debugInfo=" << m_debugInfo
<< ", attribMap = " << attribMap
<< ", point3DTranslated = " << point3DTranslated.x() << " / " << point3DTranslated.y() << " / " << point3DTranslated.z()
<< ", m_visibility = " << m_visibility;
goRendererAtt->setAttributeMap(attribMap);
goRendererAtt->setVisibility(m_visibility);
goRendererAtt->setPickable(false);
goRendererAtt->setSelected(false);
if (!goRendererAtt->updateView())
successDetonationsDrpd = false;
++idx;
} // for
if (!successDetonationsDrpd)
ERROR_LOG(m_logger) << LOGFUNCTION << " updateViewImpl m_goRendererAtt failed, m_debugInfo=" << m_debugInfo;
d->m_detonationsDraped.reset();
}
TRACE_LOG(m_logger) << LOGFUNCTION << " END, successDetonationsDrpd=" << successDetonationsDrpd;
return successDetonationsDrpd;
}
#else // AREA_FIRE_DRAPED_RENDERER // GUEZE_2933
bool AreaFireImpl::updateViewImplDetonation3dDraped_SceneMarkerApproach() // GUEZE_2933
{
DEBUG_LOG(m_logger) << LOGFUNCTION << " START"
<< ", m_debugInfo=" << m_debugInfo
<< ", visibility=" << m_visibility
<< ", visiTechn=" << m_visibilityTechnical
<< ", visiTact=" << m_visibilityTactical
<< ", d->m_detonationsDraped.changed() = " << d->m_detonationsDraped.changed()
<< ", d->m_detonationsDraped.size() = " << d->m_detonationsDraped.m_detonationPositions.size();
bool successDetonationsDrpd = true;
if ((m_mapImpl->mode() == Mode::Mode_3D) && d->m_detonationsDraped.changed())
{
const PositionCont &positionsTranslated_drpdTrans = d->m_detonationsDraped.m_detonationPositions.positionsTranslated();
const int newSize = positionsTranslated_drpdTrans.size();
d->resizeDraped_GOSM(newSize);
int idx = 0;
for(const Point3D &point3DTranslated : qAsConst(positionsTranslated_drpdTrans))
{
Private::ValueDataGOSM_Drpd &GOSM_drpdRef = d->getObjectDraped_GOSM(idx, m_graphicsLayer);
QSharedPointer<GraphicalObjectSceneMarker> goSceneMarker = GOSM_drpdRef.m_goSceneMarker;
goSceneMarker->setOrigin(point3DTranslated);
goSceneMarker->setDiameter(d->m_detonationsDraped.m_detonationRadius.value() * 2);
goSceneMarker->setPickable(false);
goSceneMarker->setSelected(false);
QColor col = partyColor();
col.setAlphaF(col.alphaF() / 2.0);
goSceneMarker->setFillStyle(FillStyle(col, FillPattern::Solid));
goSceneMarker->setVisibility(m_visibility);
if (!goSceneMarker->updateView())
successDetonationsDrpd = false;
++idx;
} // for
if (!successDetonationsDrpd)
ERROR_LOG(m_logger) << LOGFUNCTION << " updateViewImpl GOSM_drpdRef failed, m_debugInfo=" << m_debugInfo;
d->m_detonationsDraped.reset();
}
TRACE_LOG(m_logger) << LOGFUNCTION << " END, successDetonationsDrpd=" << successDetonationsDrpd;
return successDetonationsDrpd;
}
#endif // AREA_FIRE_DRAPED_RENDERER
bool AreaFireImpl::init(MapImpl *mapImpl, const QString &logicalLayerName)
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
if (mapImpl)
{
switch (mapImpl->symbologyType())
{
case AdvancedSymbology::SymbologyType::APP6D:
case AdvancedSymbology::SymbologyType::MIL2525D:
m_symbol.refValue().sidc = AdvancedSymbology::SidcCodec::encodeComplete(mapImpl->symbologyType(), "10012500002408010000"); // SymbolSet = 25 240801
break;
case AdvancedSymbology::SymbologyType::MIL2525C:
// m_symbol.refValue().m_sidc = QLatin1String("GHFPATB---"); // GHFPATB--- 0879, Area Target Bomb
m_symbol.refValue().sidc = AdvancedSymbology::SidcCodec::encodeComplete(mapImpl->symbologyType(), "GHFPATS---"); // GHFPATB--- 0879, Area Target Smoke
break;
case AdvancedSymbology::SymbologyType::APP6B:
m_symbol.refValue().sidc = AdvancedSymbology::SidcCodec::encodeComplete(mapImpl->symbologyType(), "GHCPFLKS--"); // APP6B: 3965: GHCPFLKS-- -> Polygon
break;
case AdvancedSymbology::SymbologyType::None:
// empty
break;
} // switch
} // if (mapImpl)
bool success = BaseClass::init(mapImpl, logicalLayerName, GraphicalObjectPathType::Polygon);
setLineStyle(LineStyle(Qt::black, 2));
// setup Private:
d->m_mapImpl = mapImpl;
d->m_logicalLayer = logicalLayerName;
d->m_debugInfo = this->debugInfo();
d->m_detonationsAbsolute.m_detonationPositions.setMapObjectImpl(this);
d->m_detonationsDraped.m_detonationPositions.setMapObjectImpl(this);
if (!success)
ERROR_LOG(m_logger) << LOGFUNCTION << " init failed";
TRACE_LOG(m_logger) << LOGFUNCTION << " END, success=" << success;
return success;
}
bool AreaFireImpl::onMapExtentChanged()
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
for (auto item : {m_indicationCont, m_indicationContSpAbsolute})
{
const bool visiScale = m_visibilityScaleRange.scaleHasVisibility(m_mapImpl->scale());
if (item)
{
item->setVisible(0, m_visibility && m_visibilityTechnical && visiScale);
item->setVisible(1, m_visibility && m_visibilityTechnical && visiScale);
}
}
bool success = BaseClass::onMapExtentChanged();
TRACE_LOG(m_logger) << LOGFUNCTION << " END, success=" << success;
return success;
}
} // namespace SituationMap