Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -0,0 +1,434 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for Exercisemanagemt (Interface for access from other Plugins)
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-02-29
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <PluginInterfaces/topic_replay_interface.h>
|
||||
#include <TopicEditorBase/topic_editor_interface.h>
|
||||
#include <Plugins/SituationMapPlugin/Gui/SituationMap/AdapterDds/map_object_type.h>
|
||||
#include <Plugins/SituationMapPlugin/Gui/SituationMap/AdapterDds/resource_manager_mode.h>
|
||||
|
||||
#include <QColor>
|
||||
#include <QPointer>
|
||||
#include <QPointF>
|
||||
#include <QPolygon>
|
||||
#include <QVector>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
|
||||
namespace LtsWidgets
|
||||
{
|
||||
class LtsDialog;
|
||||
}
|
||||
|
||||
|
||||
namespace SituationMap
|
||||
{
|
||||
|
||||
enum class MapMode
|
||||
{
|
||||
Undefined,
|
||||
MapMode_2D,
|
||||
MapMode_3D
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Define different line pattern.
|
||||
*/
|
||||
enum class MapLinePattern
|
||||
{
|
||||
Dash,
|
||||
DashDot,
|
||||
DashDotDot,
|
||||
Dot,
|
||||
Null,
|
||||
Solid
|
||||
};
|
||||
/*!
|
||||
\brief Define different fill pattern.
|
||||
*/
|
||||
enum class MapFillPattern
|
||||
{
|
||||
BackwardDiagonal, // /
|
||||
Cross,
|
||||
DiagonalCross,
|
||||
ForwardDiagonal, // '\'
|
||||
Horizontal,
|
||||
Null,
|
||||
Solid,
|
||||
Vertical
|
||||
};
|
||||
|
||||
|
||||
class Map;
|
||||
|
||||
class ForeignGuiInterface : public TopicReplay::Factory, public TopicEditorBase::Interface
|
||||
{
|
||||
public:
|
||||
/*! \name Construction, Destruction */
|
||||
//@{
|
||||
ForeignGuiInterface() = default;
|
||||
virtual ~ForeignGuiInterface() = default;
|
||||
//@}
|
||||
|
||||
//interface functions
|
||||
virtual bool clearObjects() = 0;
|
||||
|
||||
/*! \name map... */
|
||||
//@{
|
||||
virtual LtsWidgets::LtsDialog *createMapDialog(QWidget *parent) = 0;
|
||||
|
||||
virtual QPointer<Map> map() const = 0;
|
||||
virtual void setMapUpdatesEnabled(bool bEnabled) = 0;
|
||||
|
||||
virtual bool isMapReady() const = 0;
|
||||
virtual bool setMapReadyCallback(QObject *context, const std::function<void()> &mapReadyCallback) = 0; // mapReady && isSymbolDictionaryLoaded
|
||||
virtual MapMode mapMode() const = 0;
|
||||
|
||||
virtual bool reInitToSystemDefault() = 0;
|
||||
virtual bool forceUpdate() = 0;
|
||||
//@}
|
||||
|
||||
/*! \name ResourceManagerMode (RMM_PlanActivityView|RMM_PlanDefinitionView|RMM_ComponentMonitor) ... */
|
||||
//@{
|
||||
virtual ResourceManagerMode resourceManagerMode() const = 0;
|
||||
virtual bool setResourceManagerMode(ResourceManagerMode rmm) = 0;
|
||||
virtual bool setResourceManagerModeChangedCallback(QObject *context, const std::function<void()> &cb) = 0;
|
||||
//@}
|
||||
|
||||
|
||||
/*! \name center map / zoomTo*/
|
||||
//@{
|
||||
virtual QPointF centerPoint() const = 0;
|
||||
virtual void setCenterPoint(const QPointF ¢er, double scale = -1.0, float durationSeconds = -1.0) = 0;
|
||||
virtual void centerMapToParticipant(int participantId) = 0;
|
||||
virtual void centerMapToAesObject(int entityId) = 0;
|
||||
virtual void centerMapToBuildingObject(int entityId) = 0;
|
||||
virtual void centerMapToGuezIedObject(int entityId) = 0;
|
||||
virtual void centerMapToChargeEffectObject(int entityId) = 0;
|
||||
|
||||
// more general approach:
|
||||
virtual void centerMapToMapObject(MapObjectType mot, int entityId) = 0;
|
||||
|
||||
virtual void zoomMapTo(const QVector<QPair<MapObjectType, int>> &entities, int paddingInDIPS = 100) = 0;
|
||||
//@}
|
||||
|
||||
|
||||
|
||||
/*! \name Object Indicator */
|
||||
//@{
|
||||
/*!
|
||||
* \brief objectIndicatorToParticipant
|
||||
* \param participantId obj to point to
|
||||
* \param setSelected set selecttion of obj to point to
|
||||
* \param lifetimeMsec lifetime of indicator, 0 and less -> infinite
|
||||
* \return true on success, otherwise false
|
||||
*/
|
||||
virtual bool objectIndicatorToParticipant(int participantId, bool setSelected = false, int lifetimeMsec = -1) = 0;
|
||||
virtual bool objectIndicatorToAesObject(int entityId) = 0;
|
||||
virtual bool objectIndicatorToBuildingObject(int entityId) = 0;
|
||||
virtual bool objectIndicatorToGuezIedObject(int entityId) = 0;
|
||||
|
||||
// more general approach:
|
||||
virtual bool objectIndicatorToMapObject(MapObjectType mot, int entityId, bool setSelected = false, int lifetimeMsec = -1) = 0;
|
||||
|
||||
virtual bool objectIndicatorToPoint(const QPointF &targetGeo, int lifetimeMsec = -1) = 0;
|
||||
|
||||
virtual bool removeObjectIndicator() = 0;
|
||||
//@}
|
||||
|
||||
/*! \name Object Selection */
|
||||
//@{
|
||||
struct MapObjectTypeEntityId
|
||||
{
|
||||
MapObjectTypeEntityId(MapObjectType _mot, const QVector<int> &_entityIds) : mot(_mot), entityIds(_entityIds) {}
|
||||
MapObjectType mot;
|
||||
QVector<int> entityIds;
|
||||
};
|
||||
virtual bool openMapObjectSelection(MapObjectType mot, const QVector<int> &entityIds) = 0;
|
||||
virtual bool openMapObjectSelection(const QVector<MapObjectTypeEntityId> &mapObjectTypeEntityIdPairs) = 0;
|
||||
|
||||
virtual bool setMapObjectSelected(MapObjectType mot, const QVector<int> &entityIds, bool selection = true) = 0;
|
||||
virtual bool clearMapObjectSelection(MapObjectType mot = MapObjectType::MOT_Undefined) = 0;
|
||||
//@}
|
||||
|
||||
/*! \name Participant */
|
||||
//@{
|
||||
virtual void enableMovementTrack(int participantId, bool enable) = 0;
|
||||
virtual bool isMovementTrackEnabled(int participantId) = 0;
|
||||
virtual bool setMovementTrackCallback(QObject *context, const std::function<void(const QVector<int32_t> &activeSimIds)> &movementTrackCallback) = 0; //
|
||||
|
||||
virtual void enableGearRanges(int participantId, bool enable) = 0;
|
||||
virtual bool isGearRangesEnabled(int participantId) = 0;
|
||||
|
||||
virtual bool enableFireEventFlashing(bool enable) = 0;
|
||||
virtual bool isFireEventFlashingEnabled() const = 0;
|
||||
|
||||
//@}
|
||||
|
||||
/*! \name Rubberband */
|
||||
//@{
|
||||
virtual bool getCoordinate(QObject *objectToInform, const char *replySlot, const char *errorSlot) = 0;
|
||||
virtual QVector<QPointF> getParallelTranslation(const QVector<QPointF> &line, double distance, bool &angleFault) = 0;
|
||||
virtual bool getCorridor(QObject *objectToInform
|
||||
, const char *replySlot
|
||||
, const char *errorSlot
|
||||
, double widthMin
|
||||
, double widthMax
|
||||
, double maxSegmentLength
|
||||
, int maxSegmentCount
|
||||
, bool centerLine
|
||||
, const QVector<QPointF> &segments
|
||||
, double width) = 0;
|
||||
virtual bool getCircle(QObject *objectToInform
|
||||
, const char *replySlot
|
||||
, const char *errorSlot
|
||||
, double radiusMin
|
||||
, double radiusMax
|
||||
, const QPointF ¢er = QPointF()
|
||||
, double initialRadius = 0.0) = 0;
|
||||
|
||||
virtual bool getCircleSectorFixRadius(QObject *objectToInform
|
||||
, const char *replySlot
|
||||
, const char *errorSlot
|
||||
, double radius
|
||||
, const QPointF ¢er = QPointF()
|
||||
, double openingAngle = 90.0
|
||||
, double rotationDegNorth = 0.0) = 0;
|
||||
virtual bool getCircleSector(QObject *objectToInform
|
||||
, const char *replySlot
|
||||
, const char *errorSlot
|
||||
, double radiusInitial, double radiusMin, double radiusMax
|
||||
, const QPointF ¢er = QPointF()
|
||||
, double openingAngle = 90.0
|
||||
, double rotationDegNorth = 0.0) = 0;
|
||||
virtual bool getTwoCircleSector(QObject *objectToInform
|
||||
, const char *replySlot
|
||||
, const char *errorSlot
|
||||
, double radius1Initial, double radius1Min, double radius1Max
|
||||
, double radius2Initial, double radius2Min, double radius2Max
|
||||
, const QPointF ¢er = QPointF()
|
||||
, double openingAngle = 90.0
|
||||
, double rotationDegNorth = 0.0) = 0;
|
||||
|
||||
virtual bool getRectangle(QObject *objectToInform
|
||||
, const char *replySlot
|
||||
, const char *errorSlot
|
||||
, double widthMin
|
||||
, double widthMax
|
||||
, double heightMin
|
||||
, double heightMax
|
||||
, const QPointF &bottomLeft = QPointF()
|
||||
, double width = 0.0
|
||||
, double height = 0.0
|
||||
, double angleNorth = 0.0) = 0;
|
||||
virtual bool getRectangleNorth(QObject *objectToInform
|
||||
, const char *replySlot
|
||||
, const char *errorSlot
|
||||
, double widthMin
|
||||
, double widthMax
|
||||
, double heightMin
|
||||
, double heightMax
|
||||
, const QPointF ¢er = QPointF()
|
||||
, double width = 0.0
|
||||
, double height = 0.0) = 0;
|
||||
virtual bool getPolygon(QObject *objectToInform,
|
||||
const char *replySlot,
|
||||
const char *errorSlot,
|
||||
unsigned int minPoints = 0,
|
||||
unsigned int maxPoints = 0,
|
||||
double minSegmentLength = -1.0,
|
||||
double maxSegmentLength = -1.0,
|
||||
const QPolygonF &coordinates = QPolygonF()) = 0;
|
||||
virtual bool getPolyline(QObject *objectToInform,
|
||||
const char *replySlot,
|
||||
const char *errorSlot,
|
||||
unsigned int minPoints = 0,
|
||||
unsigned int maxPoints = 0,
|
||||
double minSegmentLength = -1.0,
|
||||
double maxSegmentLength = -1.0,
|
||||
const QPolygonF &coordinates = QPolygonF()) = 0;
|
||||
|
||||
virtual void cancelActiveRubberbands() = 0;
|
||||
|
||||
|
||||
virtual bool displayPreviewObject(QObject *parent, const QPolygonF &poly, bool closed) = 0;
|
||||
virtual bool displayPreviewObjects(QObject *parent, const QVector<QPolygonF> &polyVec, bool closed) = 0;
|
||||
virtual bool displayPreviewObject(QObject *parent, const QPointF ¢erGeo, double radius) = 0;
|
||||
virtual bool displayPreviewObjects(QObject *parent, const QVector<QPointF> ¢erGeoVec, double radiusd) = 0;
|
||||
virtual bool displayPreviewObject(QObject *parent, const QPointF ¢erPoint, double radius, double rotation, double openAngle) = 0;
|
||||
|
||||
// introduced for CollateralDamage:
|
||||
struct PreviewCircleData
|
||||
{
|
||||
// geometry
|
||||
QPointF centerGeo;
|
||||
double radius{100.0}; //meter
|
||||
// line
|
||||
MapLinePattern linePattern{MapLinePattern::Solid};
|
||||
QColor lineColor{Qt::black};
|
||||
int lineWidth{2};
|
||||
// fill
|
||||
MapFillPattern fillPattern{MapFillPattern::Solid};
|
||||
QColor fillColor{Qt::gray};
|
||||
};
|
||||
virtual bool displayPreviewObjects(QObject *parent, const QVector<PreviewCircleData> &previewCirclesAscending) = 0;
|
||||
|
||||
virtual bool removePreviewObject() = 0;
|
||||
//@}
|
||||
|
||||
/*! \name Object Selection: single or list*/
|
||||
// Useful for assignment of MountingPoints at resourceApp of ISM
|
||||
//@{
|
||||
virtual bool skipMapObjectSelectionDialog() const = 0;
|
||||
virtual void setSkipMapObjectSelectionDialog(bool skip) = 0;
|
||||
// virtual void
|
||||
//@}
|
||||
|
||||
/*! \name Tools... */
|
||||
//@{
|
||||
virtual void startMeasureLength() = 0;
|
||||
virtual void clearMeasureLength() = 0;
|
||||
|
||||
virtual void startTerrainProfile() = 0;
|
||||
virtual void clearTerrainProfile() = 0;
|
||||
|
||||
virtual void startViewshed() = 0;
|
||||
virtual void clearViewshed() = 0;
|
||||
//@}
|
||||
|
||||
|
||||
/*! \name EmergencyCalls ... */
|
||||
//@{
|
||||
virtual bool showExpiredEmergencyCalls(bool showExpired) = 0;
|
||||
//@}
|
||||
|
||||
|
||||
/*! \name OC situation range... */
|
||||
//@{
|
||||
struct ocSituationRangeAttributes
|
||||
{
|
||||
QColor lineColor; ///< invalid by default -> black or participant color will be used
|
||||
double opacity = -1.0; ///< range: 0.0 ... 1.0; neg. value -> no fill
|
||||
int lineWidth = 2;
|
||||
ocSituationRangeAttributes() {}
|
||||
};
|
||||
virtual bool ocSituationRange_create(const QPointF &origin_lonLatRadiant, double radius_meter,
|
||||
const ocSituationRangeAttributes &attributes = ocSituationRangeAttributes()) = 0; // default color -> black
|
||||
virtual bool ocSituationRange_create(int participantId, double radius_meter,
|
||||
const ocSituationRangeAttributes &attributes = ocSituationRangeAttributes()) = 0; // default color -> partyColor
|
||||
virtual bool ocSituationRange_show(bool visible) = 0;
|
||||
virtual bool ocSituationRange_remove() = 0;
|
||||
//@}
|
||||
|
||||
/*! \name ESC order position... */
|
||||
//@{
|
||||
struct escOrderPositionAttributes
|
||||
{
|
||||
QColor lineColor; ///< invalid by default -> black or participant color will be used
|
||||
double opacity = -1.0; ///< range: 0.0 ... 1.0; neg. value -> no fill
|
||||
int lineWidth = 2;
|
||||
escOrderPositionAttributes() {}
|
||||
};
|
||||
virtual bool escOrderPosition_create(const QPointF &origin_lonLatRadiant, int areaWidth, int areaDepth, int rotation, bool is_smoke,
|
||||
const escOrderPositionAttributes &attributes = escOrderPositionAttributes()) = 0; // default color -> black
|
||||
virtual bool escOrderPosition_show(bool visible) = 0;
|
||||
virtual bool escOrderPosition_remove() = 0;
|
||||
virtual bool isEscOrderPositionVisible() = 0;
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
/*! \name OperatorMapSetting */
|
||||
//@{
|
||||
virtual bool setInitialOperatorMapSettings(const QByteArray &data) = 0;
|
||||
virtual bool setInitialOperatorMapSettings(const QJsonValue &data) = 0;
|
||||
|
||||
virtual QByteArray operatorMapSettingsJson() const = 0;
|
||||
virtual bool setOperatorMapSettingsJson(const QByteArray &data) = 0;
|
||||
virtual QJsonValue operatorMapSettings() const = 0;
|
||||
virtual bool setOperatorMapSettings(const QJsonValue &data) = 0;
|
||||
//@}
|
||||
|
||||
/*! \name MovementTrackManager */
|
||||
//@{
|
||||
virtual QByteArray movementTrackManagerSettingsJson() const = 0;
|
||||
virtual bool setMovementTrackManagerSettingsJSon(const QByteArray &data) = 0;
|
||||
virtual QJsonObject movementTrackManagerSettings() const = 0;
|
||||
virtual bool setMovementTrackManagerSettings(const QJsonValue &data) = 0;
|
||||
//@}
|
||||
|
||||
|
||||
/*! \name Handle plan overlays */
|
||||
//@{
|
||||
|
||||
/*!
|
||||
* Provides a list of all plan overlay id's. The list is sorted in display order from bottom to top.
|
||||
*/
|
||||
virtual QList<int> planOverlayList() const = 0;
|
||||
virtual QList<int> planOverlayIdsFromOperatorMapSettings(const QJsonValue &data) const = 0;
|
||||
|
||||
|
||||
/*!
|
||||
* Returns the XML reperesentation of the plan with id \c id. In case of error the provides string is empty.
|
||||
*/
|
||||
virtual QByteArray planOverlayContent(int id) const = 0;
|
||||
|
||||
/*!
|
||||
* Set a new plan overlay to situationmap, or update if it already exists
|
||||
* @param id Id of plan used to store plan in file mamagement service
|
||||
* @param name name of plan
|
||||
* @param xmlContent Content of plan coded as XML string
|
||||
*/
|
||||
virtual bool planOverlaySetContent(int id, const QString &name, const QByteArray &xmlContent, bool isSnapshot = false) = 0;
|
||||
virtual bool planOverlayRemove(int id) = 0;
|
||||
virtual void planOverlayChangeOrder(const QVector<int> &orderOfIds) = 0;
|
||||
|
||||
virtual double planOverlayMinScale(int id) = 0;
|
||||
virtual double planOverlayMaxScale(int id) = 0;
|
||||
virtual bool planOverlayVisibility(int id) = 0;
|
||||
virtual double planOverlayOpacity(int id) = 0;
|
||||
virtual void setPlanOverlayOpacity(int id, double opacity) = 0;
|
||||
virtual void setPlanOverlayMinScale(int id, double minScale) = 0;
|
||||
virtual void setPlanOverlayMaxScale(int id, double maxScale) = 0;
|
||||
virtual void setPlanOverlayVisibility(int id, bool on) = 0;
|
||||
|
||||
virtual double getCurrentMapScale() const = 0;
|
||||
//@}
|
||||
|
||||
/*! \name Image... */
|
||||
//@{
|
||||
virtual bool toImage(QObject *context, const std::function<void(const QImage &)> &imageCompletedCallback) = 0;
|
||||
//@}
|
||||
|
||||
virtual void showExerciseTimeString(bool visible = false) = 0;
|
||||
|
||||
};
|
||||
|
||||
class SitMapUpdatesEnabledHelper
|
||||
{
|
||||
public:
|
||||
explicit inline SitMapUpdatesEnabledHelper(const std::shared_ptr<SituationMap::ForeignGuiInterface> &sitMapPtr)
|
||||
: m_sitMapPtr(sitMapPtr)
|
||||
{
|
||||
if (m_sitMapPtr)
|
||||
m_sitMapPtr->setMapUpdatesEnabled(false);
|
||||
}
|
||||
|
||||
inline ~SitMapUpdatesEnabledHelper()
|
||||
{
|
||||
if (m_sitMapPtr)
|
||||
m_sitMapPtr->setMapUpdatesEnabled(true);
|
||||
}
|
||||
private:
|
||||
std::shared_ptr<SituationMap::ForeignGuiInterface> m_sitMapPtr;
|
||||
};
|
||||
|
||||
} // namespace SituationMap
|
||||
Reference in new issue
Block a user