190 lines
6.4 KiB
C++
Executable File
190 lines
6.4 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* SituationMap - SituationMapInit
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Christian Ehrlicher, SLSE, 2016-02-29
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <SituationMap/sitmapdds_export.h>
|
|
|
|
#include <Map/map.h>
|
|
#include <Map/viewpoint2D.h>
|
|
|
|
//DDS
|
|
#include "AdapterDds/adapter_dds.h"
|
|
#include "AdapterDds/plugin_provider.h"
|
|
|
|
#include <functional>
|
|
|
|
namespace NGL
|
|
{
|
|
class INGLLogger;
|
|
}
|
|
namespace SituationMap
|
|
{
|
|
enum class MapObjectType;
|
|
class MapSettingsJson;
|
|
|
|
//-----------------------------------------------------------------------------
|
|
class SITMAPDDS_EXPORT SituationMapInit : public QObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit SituationMapInit(QObject *parent);
|
|
~SituationMapInit();
|
|
|
|
bool initPluginProvider(SituationMap::PluginProvider *pluginProvider);
|
|
bool initAdapter(QPointer<SituationMap::MovementTrackManager> &movementTrackMgr, bool resourceMode);
|
|
bool initMap(bool enableSelection, SituationMap::Mode mapMode, const SituationMap::Viewpoint2D &viewPoint = SituationMap::Viewpoint2D());
|
|
bool initMapPart2(Mode mapMode,
|
|
const Viewpoint2D &viewPoint = Viewpoint2D(),
|
|
const MapSettingsJson* mapSettingJson = nullptr);
|
|
|
|
QPointer<SituationMap::MovementTrackManager> movementTrackManager() const;
|
|
|
|
SituationMap::Map *getWidget();
|
|
SituationMap::AdapterDds *adapterDds();
|
|
SituationMap::RB::RubberbandFactory &rubberbandFactory();
|
|
|
|
/*! \name ResourceManagerMode (PlanView|ComponentMonitor) ... */
|
|
//@{
|
|
ResourceManagerMode resourceManagerMode() const;
|
|
bool setResourceManagerMode(ResourceManagerMode rmm);
|
|
//@}
|
|
|
|
|
|
RefPointer<Participant> simId2Participant(int32_t simId);
|
|
QVector<UniqueMapId> simIds2UniqueMapIds(MapObjectType mot, const QVector<int32_t> &simIds) const;
|
|
|
|
void startDisplay();
|
|
void stopDisplay();
|
|
bool clearObjects();
|
|
|
|
//
|
|
//Playback
|
|
//
|
|
void setPlaybackTimeString(const QString &timeString);
|
|
|
|
//
|
|
//control
|
|
//
|
|
bool enableMovementTrack(int participantId, bool enable);
|
|
bool isMovementTrackEnabled(int participantId) const;
|
|
bool enableGearRanges(int participantId, bool enable);
|
|
bool isGearRangesEnabled(int participantId) const;
|
|
|
|
QPointF centerPoint() const;
|
|
void setCenterPoint(const QPointF ¢er, double scale = -1.0, float durationSeconds = -1.0);
|
|
bool centerMapToParticipant(int participantId);
|
|
bool centerMapToAesObject(int entityId);
|
|
bool centerMapToBuildingObject(int entityId);
|
|
bool centerMapToGuezIedObject(int entityId);
|
|
bool centerMapToChargeEffectObject(int entityId);
|
|
// more general approach:
|
|
bool centerMapToMapObject(MapObjectType mot, int entityId);
|
|
|
|
bool zoomMapTo(const QVector<QPair<MapObjectType, int>> &entities, int paddingInDIPS);
|
|
|
|
|
|
bool objectIndicatorToParticipant(int participantId, bool setSelected, int lifetimeMsec);
|
|
bool objectIndicatorToAesObject(int entityId);
|
|
bool objectIndicatorToBuildingObject(int entityId);
|
|
bool objectIndicatorToGuezIedObject(int entityId);
|
|
// more general approach:
|
|
bool objectIndicatorToMapObject(MapObjectType mot, int entityId, bool setSelected = false, int lifetimeMsec = -1);
|
|
bool objectIndicatorToPoint(const QPointF &targetGeo, int lifetimeMsec = -1);
|
|
bool removeObjectIndicator();
|
|
|
|
/*! \name Object Selection */
|
|
//@{
|
|
bool setMapObjectSelected(MapObjectType mot, const QVector<int> &entityIds, bool selection = true);
|
|
bool clearMapObjectSelection(MapObjectType mot = MapObjectType::MOT_Undefined);
|
|
//@}
|
|
|
|
|
|
bool skipMapObjectSelectionDialog() const;
|
|
void setSkipMapObjectSelectionDialog(bool asList);
|
|
|
|
/*! \name Tools... */
|
|
//@{
|
|
void startMeasureLength();
|
|
void clearMeasureLength();
|
|
|
|
void startViewshed();
|
|
void startViewshed(double alpha, double innerRadius, double observerHeight, double targetHeight, double beamAngle);
|
|
void modifyViewshed(double alpha, double innerRadius, double observerHeight, double targetHeight, double beamAngle);
|
|
|
|
void clearViewshed();
|
|
//@}
|
|
|
|
/*! \name EmergencyCalls ... */
|
|
//@{
|
|
bool showExpiredEmergencyCalls(bool showExpired);
|
|
//@}
|
|
|
|
// Nmea own Position
|
|
bool setOwnPositionVisible(bool enable);
|
|
bool isOwnPositionVisble() const;
|
|
|
|
// buildingOwnership
|
|
bool isBuildingOwnershipSupported() const;
|
|
bool isBuildingOwnershipVisible() const;
|
|
bool setBuildingOwnershipVisible(bool visible);
|
|
|
|
// buildingOwnership
|
|
bool isBuildingContaminationSupported() const;
|
|
bool isBuildingContaminationVisible() const;
|
|
bool setBuildingContaminationVisible(bool visible);
|
|
|
|
// Participants:
|
|
bool enableFireEventFlashing(bool enable);
|
|
bool isFireEventFlashingEnabled() const;
|
|
|
|
|
|
public Q_SLOTS:
|
|
void onMapObjectsClicked(const SituationMap::Map::RefPointerMapObjectList &mapObjList,
|
|
const QPointF &viewportPosition);
|
|
void onMapObjectClickedByArea(const SituationMap::Map::RefPointerMapObjectList &mapObjList);
|
|
void onProcessMapObjectClicked(const QVector<SituationMap::UniqueMapId> &uniqueMapIds);
|
|
void onContextMenuRequested(const SituationMap::Map::RefPointerMapObjectList &mapObjList,
|
|
const QPointF &viewportPosition);
|
|
|
|
void myMapWidgetDialogIsAboutToBeClosed();
|
|
|
|
bool updateAll();
|
|
|
|
Q_SIGNALS:
|
|
void saveAsImageRequested();
|
|
void mapObjectsClicked(const SituationMap::Map::RefPointerMapObjectList &mapObjList);
|
|
void participantPositionChanged(const int32_t participantId, const Point3D &newPos); // to update OC situation range for example
|
|
void resourceManagerModeChanged(ResourceManagerMode newMode);
|
|
|
|
private Q_SLOTS:
|
|
void onMapbeginDestroy();
|
|
void onViewshedFinished(long viewshedId);
|
|
|
|
protected:
|
|
virtual bool trainingAreaExists() const;
|
|
virtual MapSettingsJson getMapSettingsFromService() const;
|
|
private:
|
|
// AdapterDds:
|
|
QSharedPointer<SituationMap::AdapterDds> m_adapterDds;
|
|
SituationMap::PluginProvider *m_pluginProvider{nullptr};
|
|
|
|
// MapObjectSelection:
|
|
bool m_skipMapObjectSelectionDialog{false}; // Useful for assignment of MountingPoints at resourceApp of ISM
|
|
|
|
// other:
|
|
QPointer<SituationMap::Map> m_situationMap; // QPointer to detect when this widget is already deleted
|
|
long m_viewshedId{-1};
|
|
QMetaObject::Connection m_viewshedFinishedConnection;
|
|
// ^-> As this widget can always be deleted outside of this class, 0ptr checks have to be issued everytime before usage!
|
|
NGL::INGLLogger &m_logger;
|
|
|
|
};
|
|
} // namespace SituationMap
|