171 lines
6.9 KiB
C++
Executable File
171 lines
6.9 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* HMI Plugin for MeteoDataManagement - Meteo Data Overview Dialog
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Philipp Last, SLSY, 2017-08-15
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
#include <string>
|
|
#include "BgViewer/viewerCtrl/viewerinterface.h"
|
|
#include "bdv_helper.h"
|
|
|
|
#include <QByteArray>
|
|
#include <QHash>
|
|
#include <QList>
|
|
#include <QMap>
|
|
#include <QObject>
|
|
#include <QString>
|
|
#include <QVector>
|
|
#include <QVector3D>
|
|
|
|
#include "logger.h"
|
|
#include <Common/buildingviewercommon_export.h>
|
|
#include <BuildingViewer/share/exccommands.h>
|
|
#include <InfrastructureManagement/Shared/ism_mounting_point.h>
|
|
#include <ParticipantManagement/ppm_data_plugin_interface.h>
|
|
#include <LtsUtilsCore/qpoint3d.h>
|
|
|
|
|
|
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<int, int> &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<qint32, ParticipantManagement::Party>& 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<std::string> &paths, const QString &strXMLFile = QString());
|
|
void excDeleteBuildingList();
|
|
void excSetHitlineDuration(uint32_t duration_s);
|
|
void excUseExactPositioning(bool useExactPositioning);
|
|
void excOpenView(const std::vector<std::string> &bldIds);
|
|
void excCloseView(const std::vector<std::string> &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<std::string> &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<BuildingTuple> &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<QString, DeviceInfo> m_deviceMap;
|
|
|
|
// Party stuff
|
|
struct BdvParty
|
|
{
|
|
QString name;
|
|
VCtrl::Color color;
|
|
int id = 0;
|
|
};
|
|
QHash<int, BdvParty> m_teamMap;
|
|
|
|
// Player stuff
|
|
QHash<int, int> m_player2TeamMap; // playerID to teamID
|
|
QHash<int, std::string> m_playerId2String; // playerId <-> uniqueId
|
|
QMap<std::string, int> m_string2PlayerId; // uniqueId <-> playerId
|
|
|
|
VCtrl::ViewerInterface *m_pviewerInterface = nullptr;
|
|
bool m_useExactPositioning = true;
|
|
LOGGER_T m_logger;
|
|
};
|
|
|
|
}
|