/** * @RDE_HEADER@ * DDS IFC to BuildingViewer * $Id$ * $HeadURL$ * $Author$ * Created by Philipp Last, SLSY, 2017-08-14 */ #pragma once #include #include #include #include #include #include #include #include #include "logger.h" #include "bdv_helper.h" #include "BgViewer/viewerCtrl/mainloop.h" class QWidget; namespace LtsPluginManager { class LtsPluginManager; } /* * Initialization sequence: * * CommunicationInterface: * 1. BgViewer is started as an external application * 1.1 A network connection is established * 1.2 The BgViewer window is "stolen" by requesting the window id via network * 1.3 Signal 'signalBgViewerInitFinished' is emitted * * BuildingViewerDdsController: * 2. DdsController receives this signal and sets the current training area * 2.1 BgViewer respectively emits 'signalBgViewerInitFinished' when the BgViewer loaded all models * 2.2 Mounting points, teams, participants, etc. are transmitted to the BgViewer * 2.3 DdsController emits 'signalDdsInitFinished' * * Finally, the signal 'signalDdsInitFinished' may be used to start requests to the BgViewer, e.g., requesting the Building list. */ namespace BuildingViewer { class CommunicationInterfaceInternal; class BuildingViewerDdsController; class PluginProvider; class BUILDINGVIEWERCOMMON_EXPORT BgViewerController : public QObject { Q_OBJECT public: explicit BgViewerController(QObject *parent = nullptr); ~BgViewerController(); void clearInterfaces(const LtsSession::DdsConnectionParams &conParams); bool isBgViewerApplicationRunning() const; LtsSession::DdsConnectionParams currentDdsConnParams() const; bool startBgViewerAppInSession(PluginProvider *pStartingSession); void openBuilding(const QString &strBuildingFeatureId); void closeBuilding(const QString &strBuildingFeatureId = QString()); // empty string = all bool forceInit(PluginProvider *pSession); void updatePlayerSymbols(int size); void closeAll(); // Also for/by SkriptPlayer QWidget *getBgViewerWidget(); bool init(PluginProvider *pSession, bool bStartRendering = false, const QString &modelPath = buildingModelPath()); PluginProvider *activeSession() const; // from communication interface void excConnect(const std::vector &paths, const QString &strXMLFile = QString()); void excGetBuildingList(); void excGetViewState(); void excHighlightView(const QString &strFeatureID); void excRestoreViewState(const QJsonValue &state); void excSetGlobalDotsMode(bool useDots); void excSetGlobalTransparency(double transparency); void excSetGlobalViewMode(bool useOrtho); void excSetHitlineDuration(uint32_t duration_s); void excStartRecording(const QString &strPathOutputFolder, const QString &strFeatureID = QStringLiteral("all"), int w = 800, int h = 600, int framerate = 20, int quality = 100); void excStopRecording(const QString &strFeatureID = QStringLiteral("all")); static QString buildingModelPath(); LtsPluginManager::LtsPluginManager *app() { return m_bgvApp; } Q_SIGNALS: void bgvAppIsInitialized(); // from communication interface void signalBgViewerInitFinished(); void signalReceivedBuildingList(const QVector &list); void signalReceivedViewState(const QJsonValue &state); void signalViewerEventButton(); 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 signalViewerEventRoomNameClicked(const QString &featureID, const QString &roomID); void signalViewerZoomChanged(const QString &featureId, double top, double left, double bottom, double right); public slots: void slotStartRecording(const QString &strFolderPath, const QJsonValue &state); void slotStopRecording(); void hideLiveVideo(); private slots: void slotLoadBuilding(); void slotWidgetReleased(); private: void showBgViewerInfoMessageBox(); private: VCtrl::MainLoop m_mainloop; bool m_widgetStolen; std::vector m_buildingsToShow; CommunicationInterfaceInternal *m_comIfc{nullptr}; VCtrl::ViewerInterface *m_viewerInterface{nullptr}; BuildingViewerDdsController *m_pBgViewerDDSController; bool m_initExerciseWasSuccessful{false}; LtsSession::DdsConnectionParams m_currentDdsConnParams; LtsPluginManager::LtsPluginManager *m_bgvApp; bool m_bgvAppIsInitialized{false}; QTimer *m_tickTimer{nullptr}; QWidget *m_bgViewerBaseLayoutWidget{nullptr}; LOGGER_T m_logger; }; }