234 lines
11 KiB
C++
Executable File
234 lines
11 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* Interface
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
// Qwn
|
|
#include "sim_to_situation_map_tmpl.h"
|
|
#include "pdm_handler.h"
|
|
|
|
#include <Utils/movement_track_manager.h>
|
|
|
|
#include <Plugins/FilterManagement/flt_data_plugin_interface.h>
|
|
#include <Plugins/AreaEffectSimulation/aes_data_plugin_interface.h>
|
|
#include <Plugins/ParticipantManagement/ppm_data_plugin_interface.h>
|
|
#include <Plugins/ParticipantManagement/ppm_participant_info_gui_plugin_interface.h>
|
|
#include <Plugins/OcSituationClient/osc_participant_info_gui_plugin_interface.h>
|
|
#include <Plugins/GuezIedManagement/gim_data_plugin_interface.h>
|
|
|
|
#include <MapObjects/participant.h>
|
|
|
|
#include <QPointer>
|
|
|
|
namespace SituationMap
|
|
{
|
|
|
|
struct HitlineInfo // For info dialog
|
|
{
|
|
qint32 participantId = -1;
|
|
ParticipantManagement::ParticipantPosition participantPosition;
|
|
|
|
ParticipantManagement::StateInformation participantState; // contains originatorId
|
|
|
|
ParticipantManagement::ParticipantPosition originatorPosition;
|
|
qint32 injuryPartyId = -1;
|
|
};
|
|
|
|
|
|
class LayerFactory;
|
|
class PdmHandler;
|
|
|
|
//------------------------------------------------------------------------------
|
|
class Participant2SituationMap final : public Sim2SituationMap<ParticipantManagement::Participant, SituationMap::Participant>
|
|
, protected DdsFilterHandling<SituationMap::Participant>
|
|
{
|
|
Q_OBJECT
|
|
|
|
using BaseClass = SituationMap::Sim2SituationMap<ParticipantManagement::Participant, SituationMap::Participant>;
|
|
using FilterClass = DdsFilterHandling<SituationMap::Participant>;
|
|
|
|
struct InternalPosition final : public ParticipantManagement::UnitPosition
|
|
{
|
|
Core::PositionReportingSource reportingSource;
|
|
bool isUnit = true;
|
|
bool bShowCenter = false;
|
|
|
|
bool bIsMountedOn = false;
|
|
bool bHasMountedParticipants = false;
|
|
|
|
inline const Core::GeoPosition &position() const OMG_NOEXCEPT
|
|
{
|
|
return (isUnit && bShowCenter) ? positionCenter() : positionLeader();
|
|
}
|
|
inline rti::core::int64 sampleTime() const OMG_NOEXCEPT
|
|
{
|
|
return (isUnit && bShowCenter) ? sampleTimeCenter() : sampleTimeLeader();
|
|
}
|
|
|
|
InternalPosition() = default;
|
|
explicit InternalPosition(const ParticipantManagement::UnitPosition &unitPos_param, bool bCenter)
|
|
: ParticipantManagement::UnitPosition(unitPos_param)
|
|
, bShowCenter(bCenter)
|
|
{}
|
|
};
|
|
public:
|
|
Participant2SituationMap(PdmHandler *pdmHandler,
|
|
ObjectFactory &objFac,
|
|
const QString &layername,
|
|
const char *loggerName);
|
|
~Participant2SituationMap();
|
|
|
|
|
|
// ppmParticipantInfoIfc and ocParticipantInfoIfc are optional
|
|
bool init(LayerFactory *layerFactory,
|
|
PluginProvider *pluginProvider);
|
|
|
|
bool run() override;
|
|
void stop() override;
|
|
bool mapObjectsClicked(const QVector<UniqueMapId> &uniqueMapIds) override;
|
|
|
|
bool unifiedMapObjectData(UniqueMapId uniqueMapId, UnifiedMapObjectData &umodOut) const override;
|
|
|
|
void setMovementTrackManager(const QPointer<MovementTrackManager> &mtMgr) { m_movementTrackManager = mtMgr; }
|
|
|
|
bool enableFireEventFlashing(bool enable);
|
|
bool isFireEventFlashingEnabled() const;
|
|
|
|
// for hitlineInfo:
|
|
bool isParticipantVisible(const int32_t participantId, bool *bParticipantExists) const;
|
|
Q_SIGNALS:
|
|
void hitlineOccured(const HitlineInfo &hitlineInfo); // to create Hitline (and its info dialog)
|
|
void participantPositionChanged(const int32_t participantId, const Point3D &newPos);
|
|
void participantOwnPositionChanged(const Point3D &newPos, int64_t sampleTime); // For filtering out the own position of tablet via Nmea
|
|
|
|
public Q_SLOTS:
|
|
void onParticipantFakeGearEventChanged(int participantId, qint64 sampleTime, SpecialChargeType specialChargeType);
|
|
|
|
protected Q_SLOTS:
|
|
void onPartitionTimeChanged(qint64 newPartitionTime);
|
|
|
|
void onFireEventFlashTimer();
|
|
|
|
void onTypesChanged(const ParticipantManagement::Type &data,
|
|
DataModification modType);
|
|
|
|
void onParticipantChanged(const ParticipantManagement::Participant &data,
|
|
DataModification modType);
|
|
|
|
void onPositionChanged(const ParticipantManagement::ParticipantPosition &data,
|
|
DataModification modType);
|
|
|
|
void onUnitPositionChanged(const ParticipantManagement::UnitPosition &data,
|
|
DataModification modType);
|
|
|
|
void updateParticipantPosition(int participantId, bool bHandleSymbolAppearanceSettingsParticipant = true);
|
|
void updateParticipantPosition(const InternalPosition &pos, bool bHandleSymbolAppearanceSettingsParticipant = true);
|
|
// void updateParticipantPosition(RefPointer<Sim2SituationMap::MAP_T> mapObj, int participantId);
|
|
|
|
void onDynamicParticipantDataChanged(const ParticipantManagement::DynamicParticipantData &data,
|
|
DataModification modType);
|
|
|
|
void onBiteChanged(const ParticipantManagement::Bite &data,
|
|
DataModification modType);
|
|
|
|
void onParticipantGearEventChanged(const ParticipantManagement::ParticipantGearEvent &data, DataModification modType);
|
|
|
|
void onAesItemViewChanged(const AreaEffectSimulation::AesItemView &data, DataModification modType);
|
|
|
|
void onDusMineStateChanged(const AreaEffectSimulation::DusMineState &data, DataModification modType);
|
|
|
|
void onMovementTrackActivityChanged(int trackId, bool active);
|
|
void onMovementTrackRemoved(int trackId);
|
|
|
|
void addToUpdateNotify(const RefPointer<MAP_T> &mapObj);
|
|
void notifyMapAboutModifedObjects();
|
|
|
|
protected:
|
|
void updateHierarchyLevels();
|
|
int participantHierachyLevel(const ParticipantManagement::Participant &data) const;
|
|
QString layernameWithHierachy(qint32 hierachyLevel) const;
|
|
QString layernameWithHierachy(const Sim2SituationMap::DDS_T &ddsData) const override;
|
|
|
|
bool isElapsed(const ParticipantManagement::Participant &data) const override;
|
|
|
|
|
|
void checkForUnknownOriginatorsParticipant(int possibleOriginatorParticipantId);
|
|
void checkForUnknownOriginatorsAes(int possibleOriginatorEffectSimId);
|
|
bool updateDynamicParticipantData(RefPointer<Sim2SituationMap::MAP_T> mapObj, const ParticipantManagement::DynamicParticipantData &data);
|
|
|
|
int32_t getSimId(const Sim2SituationMap::DDS_T &ddsData) const override;
|
|
bool updateElementImpl(const ParticipantManagement::Participant &ddsData,
|
|
RefPointer<Participant> mapObj) override;
|
|
|
|
bool removeElement(const int32_t simId) override;
|
|
|
|
void updateGearEvents(bool doUpdateView = false); // to let the participant flash
|
|
void updateGearEventInternal(bool doUpdateView,
|
|
qint64 curPartitionTimeMSec,
|
|
qint64 fireEventFlashingDurationMSec,
|
|
const QSet<int> &particpantIdsWithGearEvents);
|
|
|
|
bool symbolAppearanceSettingsChangesAreRelevant(const FilterManagement::SymbolAppearanceSettings::Settings & /*newSas*/) const override
|
|
{
|
|
return true;
|
|
}
|
|
void handleSymbolAppearanceSettings(RefPointer<MAP_T> &mapObj) override;
|
|
|
|
|
|
void onSymbolAppearanceSettingsChanged(FilterManagement::SymbolAppearanceSettings::Part part) override;
|
|
bool hasBitError(const ParticipantManagement::DynamicParticipantData &dpd) const;
|
|
bool isOutOfDate(const InternalPosition &pos) const;
|
|
bool isSimulatedPosition(const InternalPosition &pos) const;
|
|
void handleSymbolAppearanceSettingsParticipant(int participantId);
|
|
void handleSymbolAppearanceSettingsParticipant(RefPointer<MAP_T> &mapObj,
|
|
const ParticipantManagement::Participant &participant);
|
|
void handleSymbolAppearanceSettingsParticipant(RefPointer<MAP_T> &mapObj,
|
|
const ParticipantManagement::Participant &participant,
|
|
const InternalPosition &pPos,
|
|
const ParticipantManagement::DynamicParticipantData &dpd);
|
|
|
|
private:
|
|
LayerFactory *m_layerFactory = nullptr;
|
|
PluginProvider *m_pluginProvider = nullptr;
|
|
QTimer *m_notifiyTimer = nullptr;
|
|
|
|
std::shared_ptr<AreaEffectSimulation::Interface::Dtc> m_aesDtc;
|
|
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
|
|
std::shared_ptr<ParticipantManagement::ForeignParticipantInfoGuiInterface> m_ppmParticipantInfoIfc;
|
|
std::shared_ptr<OcSituationClient::ForeignParticipantInfoGuiInterface> m_ocParticipantInfoIfc;
|
|
|
|
|
|
// some lookupTables:
|
|
QHash<qint32, ParticipantManagement::Type> m_types;
|
|
QHash<int, ParticipantManagement::Participant> m_participants;
|
|
QHash<int, InternalPosition> m_participantPositions;
|
|
QHash<int, ParticipantManagement::DynamicParticipantData> m_participantDynamicData;
|
|
QHash<int, qint64> m_participantGearEvents; // for fireEventFlashing, <participantId, sampleTime>
|
|
QHash<int, qint64> m_lrfParticipantFakeGearEvents; // for fireEventFlashing, <participantId, sampleTime> / caused by Hitline(LRF, LTD)
|
|
QHash<int, qint64> m_ltdParticipantFakeGearEvents; // for fireEventFlashing, <participantId, sampleTime> / caused by Hitline(LRF, LTD)
|
|
|
|
QHash<int, bool> m_participantsWithProperties; // participantId, isArtillery(feuereinheit)
|
|
QVector<QPair<int, int>> m_unknownOriginatorsParticipant; // <originatorParticipantId, participantId>
|
|
QVector<QPair<int, int>> m_unknownOriginatorsAes; // <originatorEffectSimulationId, participantId>
|
|
QSet<int> m_participantWithMaybeMissingPartyId; // <participantId> originatorType==DusMine
|
|
QHash<int, int> m_aesItemView2PartyId; // <EffectSimulationId, PartyId>
|
|
QVector<RefPointer<MAP_T>> m_objectsToUpdate;
|
|
|
|
QSet<int> m_hasBiteError;
|
|
PdmHandler *m_pdmHandler;
|
|
bool m_bShowCenterPositions = false;
|
|
|
|
QTimer *m_fireEventFlashTimer = nullptr;
|
|
int m_fireEventFlashTriState = 0;
|
|
bool m_fireEventFlashEnable = true;
|
|
|
|
QPointer<SituationMap::MovementTrackManager> m_movementTrackManager;
|
|
};
|
|
|
|
} // namespace
|