/** * @RDE_HEADER@ * HMI Plugin for MeteoDataManagement - Meteo Data Overview Dialog * $Id$ * $HeadURL$ * $Author$ * Created by Philipp Last, SLSY, 2017-08-15 */ #pragma once #include #include "BgViewer/viewerCtrl/viewerinterface.h" #include "bdv_helper.h" #include #include #include #include #include #include #include #include #include "logger.h" #include #include #include #include #include namespace VCtrl { class ViewerInterface; } namespace BuildingViewer { struct DeviceInfo { QString deviceName; int buildingId = 0; DeviceInfo() = default; DeviceInfo(int _buildingId, const QString &_deviceName) : deviceName(_deviceName) , buildingId(_buildingId) {} }; /* * Interface which provides methods respectively signals to communicate * with the BgViewer application which is started as a separate process. */ class BUILDINGVIEWERCOMMON_EXPORT CommunicationInterfaceInternal final : public QObject, public VCtrl::ViewerCallback { Q_OBJECT public: explicit CommunicationInterfaceInternal(VCtrl::ViewerInterface* pviewerInterface); void playerCreate(int playerID, int partyID, const QString &strPathToSymbolFile, const LtsUtils::QPoint3D &pos, int buildingID , int roomNumber, Core::PositionReportingSource reportingSource); void playerPlace(int playerID, const LtsUtils::QPoint3D &pos, int buildingID, int roomNumber, Core::PositionReportingSource reportingSource); void playerDelete(int playerID); void setPlayerVisible(int playerID, bool bVisible); void playerClear(); void playerUpdateSymbols(); void playerUpdatePlayerSymbol(int playerID, const QString &strPathToSymbolFile); void playerHit(const int32_t id, int playerIdSrc, int playerIdDst, const LtsUtils::QPoint3D &posSrc, const LtsUtils::QPoint3D &posDst, int buildingIdSrc, int roomNumberSrc, int buildingIdDst, int roomNumberDst, int lineType, int64_t time); void buildingHit(const int32_t id, int buildingId, int damagePercent, const QMap &mapRoomDestructions); void roomHit(const int32_t id, int playerIdSrc, int buildingId, int roomNumber, const LtsUtils::QPoint3D &posSrc, int lineType, int64_t time); void removeRoomHit(const int32_t id); void setTeamConfiguration(const QMap& parties); void systemSetSimulationTime(qint64 time); void setSimuationPace(double pace); void systemDisconnect(); void systemSetPaused(bool bPaused); void systemSetMountingPoint(const InfrastructureManagement::MountingPoint &data, const QString &filename, bool show); void excConnect(const std::vector &paths, const QString &strXMLFile = QString()); void excDeleteBuildingList(); void excSetHitlineDuration(uint32_t duration_s); void excUseExactPositioning(bool useExactPositioning); void excOpenView(const std::vector &bldIds); void excCloseView(const std::vector &bldIds); void excCloseAllViews(); void excStartRecording(const QString &strPathOutputFolder, const QString &buildingId = QStringLiteral("all"), int w = 800, int h = 600, int framerate = 20, int quality = 100); void excStopRecording(const QString &buildingId = QStringLiteral("all")); void excHighlightView(const QString &buildingId); void excSetGlobalTransparency(double transparency); void excSetGlobalViewMode(bool useOrtho); void excSetGlobalDotsMode(bool useDots); void excGetBuildingList(); void excRestoreViewState(const QJsonValue &val); void excGetViewState(); void excSetRoomDisplayName(const QString &strFeatureID, const QString &strRoomName, const QString &strRoomDisplayName); void excSetBuildingDisplayName(const QString &buildingId, const QString &strBuildingDisplayName); void extSetMountingPointAsset(const QString &strFeatureID, const QString &strMountingPointId, const QVector3D &position, BuildingViewer::AssetTypes assetType); void extHideMountingPointAsset(const QString &strMountingPointId); // VCtrl::ViewerCallback interface void SystemReady() override; void TransformChanged(const std::string &id, const VCtrl::Vec3d &pos, const VCtrl::Quat &attitude) override; void NavMeshGroupChanged(const std::string &id, const std::string &grpname) override; void PlayerPicked(const std::string &strId) override; void DisplayNamePicked(const std::string &buildingid, const std::string &roomname) override; void ViewCreated(unsigned int contextId, VCtrl::ViewMode viewmode) override; void ViewModeChanged(unsigned int contextId, VCtrl::ViewMode viewmode) override; void ViewLineModeChanged(unsigned int contextId, bool line) override; void ViewNameModeChanged(unsigned int contextId, bool name) override; void ViewLockRotationChanged(unsigned int contextId, bool lock) override; void ViewTransparencyChanged() override; void PlayerDisplayModeChanged(unsigned int contextId, VCtrl::PlayerDisplayMode mode) override; void ViewClosed(unsigned int contextId) override; void HandleViewerEvent(BuildingViewer::BgViewerEvents event, const std::vector &args) override; void ViewZoomChanged(const std::string &buildingId, double top, double left, double bottom, double right) override; void LogMessage(Severity &severity, const std::string &filename, const std::string &methodname, int linenumber, const std::string &msg) override; Q_SIGNALS: void signalBgViewerInitFinished(); void signalReceivedBuildingList(const QVector &states); void signalReceivedViewState(const QJsonValue &state); void signalPlayerPicked(int playerId); void signalAssetPicked(int structureElementId); void signalViewerEventWidgetClosed(const QString &featureID); void signalViewerEventWidgetMaximized(const QString &featureID); void signalViewerEventWidgetMinimized(const QString &featureID); void signalViewerEventWidgetFocused(const QString &featureID); void signalViewerEventButton(); void signalViewerEventRoomNameClicked(const QString &featureID, const QString &roomID); void signalViewerZoomChanged(const QString &featureId, double top, double left, double bottom, double right); private: // Cameras, ... void clearCameras(); QHash m_deviceMap; // Party stuff struct BdvParty { QString name; VCtrl::Color color; int id = 0; }; QHash m_teamMap; // Player stuff QHash m_player2TeamMap; // playerID to teamID QHash m_playerId2String; // playerId <-> uniqueId QMap m_string2PlayerId; // uniqueId <-> playerId VCtrl::ViewerInterface *m_pviewerInterface = nullptr; bool m_useExactPositioning = true; LOGGER_T m_logger; }; }