Apply clang-format to Lts/Common and DTC/enum headers
- Formatted all CodeGen module files (9 files) - Formatted LtsAppDescriptor module files - Formatted LtsAppManager/AppChooser files - Applied clang-format to all DTC and enum headers across modules - Removed coordTransTests from CommonUnitTestsPlaceholder (moved to tests/) Cosmetic changes only, no functional modifications. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
848 files changed
+89305
-100020
No files matched your search
Executable → Regular
+2034
-2261
File diff suppressed because it is too large.
Load diff
Executable → Regular
+312
-334
@@ -1,25 +1,24 @@
|
||||
#pragma once
|
||||
|
||||
#include <dtEntity/entityid.h>
|
||||
#include <osg/BoundingBox>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <osg/Vec3>
|
||||
#include <osg/Vec4>
|
||||
#include <osg/Matrix>
|
||||
#include <osg/Geode>
|
||||
#include <dtEntity/message.h>
|
||||
#include "cameraviewposition.h"
|
||||
#include "logger.h"
|
||||
#include "viewerinterface.h"
|
||||
|
||||
#include <QMutex>
|
||||
#include <QMutexLocker>
|
||||
#include <QPolygonF>
|
||||
|
||||
#include <set>
|
||||
#include <map>
|
||||
#include <dtEntity/entityid.h>
|
||||
#include <dtEntity/message.h>
|
||||
#include <functional>
|
||||
#include "viewerinterface.h"
|
||||
#include "cameraviewposition.h"
|
||||
#include "logger.h"
|
||||
#include <map>
|
||||
#include <osg/BoundingBox>
|
||||
#include <osg/Geode>
|
||||
#include <osg/Matrix>
|
||||
#include <osg/Vec3>
|
||||
#include <osg/Vec4>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace dtEntity
|
||||
{
|
||||
@@ -32,451 +31,430 @@ class IconComponent;
|
||||
class TextComponent;
|
||||
class ViewWidget;
|
||||
|
||||
|
||||
struct OBB
|
||||
{
|
||||
osg::Matrix mMatrix;
|
||||
osg::Matrix mMatrixInverse;
|
||||
osg::BoundingBox mBB;
|
||||
QPolygonF mPoly;
|
||||
dtEntity::StringId mBuilding = 0;
|
||||
osg::Matrix mMatrix;
|
||||
osg::Matrix mMatrixInverse;
|
||||
osg::BoundingBox mBB;
|
||||
QPolygonF mPoly;
|
||||
dtEntity::StringId mBuilding = 0;
|
||||
};
|
||||
|
||||
|
||||
struct BuildingData
|
||||
{
|
||||
std::string mDescription;
|
||||
std::string mDisplayName;
|
||||
std::string mFeatureId;
|
||||
std::string mFileName;
|
||||
std::string mBuildingXMLPath;
|
||||
double mX = 0;
|
||||
double mY = 0;
|
||||
double mZ = 0;
|
||||
double mOrientation = 0;
|
||||
int mBuildingGroup = 0;
|
||||
bool properlySpawned = false;
|
||||
bool roomBBoxedLoaded = false;
|
||||
std::string mDescription;
|
||||
std::string mDisplayName;
|
||||
std::string mFeatureId;
|
||||
std::string mFileName;
|
||||
std::string mBuildingXMLPath;
|
||||
double mX = 0;
|
||||
double mY = 0;
|
||||
double mZ = 0;
|
||||
double mOrientation = 0;
|
||||
int mBuildingGroup = 0;
|
||||
bool properlySpawned = false;
|
||||
bool roomBBoxedLoaded = false;
|
||||
};
|
||||
|
||||
|
||||
struct BuildingLevel
|
||||
{
|
||||
|
||||
dtEntity::EntityId mEntityId;
|
||||
|
||||
|
||||
int mFloorId;
|
||||
dtEntity::EntityId mEntityId;
|
||||
|
||||
|
||||
float mHeightAboveGround;
|
||||
int mFloorId;
|
||||
|
||||
|
||||
osg::Matrix mLocalToLevel;
|
||||
float mHeightAboveGround;
|
||||
|
||||
|
||||
osg::BoundingBox mBounds;
|
||||
osg::Matrix mLocalToLevel;
|
||||
|
||||
BuildingLevel(dtEntity::EntityId eid, int floorId, float h, const osg::BoundingBox &bb)
|
||||
: mEntityId(eid), mFloorId(floorId), mHeightAboveGround(h), mBounds(bb)
|
||||
{
|
||||
}
|
||||
osg::BoundingBox mBounds;
|
||||
|
||||
BuildingLevel(dtEntity::EntityId eid, int floorId, float h, const osg::BoundingBox& bb)
|
||||
: mEntityId(eid), mFloorId(floorId), mHeightAboveGround(h), mBounds(bb)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
struct PlayerPosition
|
||||
{
|
||||
osg::Vec2d mPosition;
|
||||
dtEntity::EntityId mWorldPlayerId = 0;
|
||||
osg::Vec2d mPosition;
|
||||
dtEntity::EntityId mWorldPlayerId = 0;
|
||||
};
|
||||
|
||||
|
||||
struct PlayerDisplay
|
||||
{
|
||||
dtEntity::EntityId mWorldPlayerId = 0;
|
||||
dtEntity::EntityId mLocalPlayerId = 0;
|
||||
IconComponent *mIcon = nullptr;
|
||||
dtEntity::EntityId mWorldPlayerId = 0;
|
||||
dtEntity::EntityId mLocalPlayerId = 0;
|
||||
IconComponent* mIcon = nullptr;
|
||||
};
|
||||
|
||||
|
||||
struct Device
|
||||
{
|
||||
dtEntity::EntityId mWorldPlayerId = 0;
|
||||
std::string mPath;
|
||||
osg::Vec3d mPosition;
|
||||
dtEntity::EntityId mWorldPlayerId = 0;
|
||||
std::string mPath;
|
||||
osg::Vec3d mPosition;
|
||||
};
|
||||
|
||||
|
||||
struct DeviceDisplay
|
||||
{
|
||||
Device *mDevice = nullptr;
|
||||
dtEntity::EntityId mWorldPlayerId = 0;
|
||||
dtEntity::EntityId mLocalPlayerId = 0;
|
||||
Device* mDevice = nullptr;
|
||||
dtEntity::EntityId mWorldPlayerId = 0;
|
||||
dtEntity::EntityId mLocalPlayerId = 0;
|
||||
};
|
||||
|
||||
|
||||
struct Name
|
||||
{
|
||||
dtEntity::EntityId mWorldPlayerId;
|
||||
std::string mtext;
|
||||
std::string mdistext;
|
||||
std::string mbuilding;
|
||||
osg::Vec3d mPosition;
|
||||
dtEntity::EntityId mWorldPlayerId;
|
||||
std::string mtext;
|
||||
std::string mdistext;
|
||||
std::string mbuilding;
|
||||
osg::Vec3d mPosition;
|
||||
};
|
||||
|
||||
|
||||
struct NameDisplay
|
||||
{
|
||||
Name* mName = nullptr;
|
||||
dtEntity::EntityId mWorldPlayerId = 0;
|
||||
dtEntity::EntityId mLocalPlayerId = 0;
|
||||
bool visible = false;
|
||||
Name* mName = nullptr;
|
||||
dtEntity::EntityId mWorldPlayerId = 0;
|
||||
dtEntity::EntityId mLocalPlayerId = 0;
|
||||
bool visible = false;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class Shot
|
||||
{
|
||||
public:
|
||||
Shot(const int32_t id,
|
||||
const osg::Vec3d& shooterPos,
|
||||
const osg::Vec3d& targetPos,
|
||||
int buildingIdSrc,
|
||||
int rommNumberSrc,
|
||||
int buildingIdDst,
|
||||
int rommNumberDst,
|
||||
int lineType,
|
||||
const osg::Vec4& color,
|
||||
unsigned int duration_s,
|
||||
unsigned int durationMax_s,
|
||||
double simTimeCreated) :
|
||||
mId(id)
|
||||
, mShooterPos(shooterPos)
|
||||
, mTargetPos(targetPos)
|
||||
, mBuildingIdSrc(buildingIdSrc)
|
||||
, mRoomNumberSrc(rommNumberSrc)
|
||||
, mBuildingIdDst(buildingIdDst)
|
||||
, mRoomNumberDst(rommNumberDst)
|
||||
, mLineType(lineType)
|
||||
, mColor(color)
|
||||
, mDuration_s(duration_s)
|
||||
, m_DurationMax_s(durationMax_s)
|
||||
, mSimTimeCreated(simTimeCreated) {
|
||||
public:
|
||||
Shot(const int32_t id, const osg::Vec3d& shooterPos, const osg::Vec3d& targetPos, int buildingIdSrc,
|
||||
int rommNumberSrc, int buildingIdDst, int rommNumberDst, int lineType, const osg::Vec4& color,
|
||||
unsigned int duration_s, unsigned int durationMax_s, double simTimeCreated)
|
||||
: mId(id), mShooterPos(shooterPos), mTargetPos(targetPos), mBuildingIdSrc(buildingIdSrc),
|
||||
mRoomNumberSrc(rommNumberSrc), mBuildingIdDst(buildingIdDst), mRoomNumberDst(rommNumberDst),
|
||||
mLineType(lineType), mColor(color), mDuration_s(duration_s), m_DurationMax_s(durationMax_s),
|
||||
mSimTimeCreated(simTimeCreated)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
void setDisplayTime(unsigned int duration_s)
|
||||
{
|
||||
if (duration_s > m_DurationMax_s)
|
||||
m_DurationMax_s = duration_s;
|
||||
mDuration_s = duration_s;
|
||||
}
|
||||
|
||||
void setDisplayTime(unsigned int duration_s) {
|
||||
if(duration_s > m_DurationMax_s)
|
||||
m_DurationMax_s = duration_s;
|
||||
mDuration_s = duration_s;
|
||||
}
|
||||
double simTimeCreated() const {
|
||||
return mSimTimeCreated;
|
||||
}
|
||||
double simTimeCreated() const
|
||||
{
|
||||
return mSimTimeCreated;
|
||||
}
|
||||
|
||||
double displayTime() const {
|
||||
return mSimTimeCreated + mDuration_s;
|
||||
}
|
||||
double displayTime() const
|
||||
{
|
||||
return mSimTimeCreated + mDuration_s;
|
||||
}
|
||||
|
||||
double lifeTime() const {
|
||||
return mSimTimeCreated + (m_DurationMax_s*2);
|
||||
}
|
||||
double lifeTime() const
|
||||
{
|
||||
return mSimTimeCreated + (m_DurationMax_s * 2);
|
||||
}
|
||||
|
||||
const osg::Vec3d& getShooterPos() const { return mShooterPos; }
|
||||
const osg::Vec3d& getTargetPos() const { return mTargetPos; }
|
||||
int getBuildingIdSrc() const { return mBuildingIdSrc; }
|
||||
double getSimeTimeCreated() const { return mSimTimeCreated; }
|
||||
int getRoomNumberSrc() const { return mRoomNumberSrc; }
|
||||
int getBuildingIdDst() const { return mBuildingIdDst; }
|
||||
int getRoomNumberDst() const { return mRoomNumberDst; }
|
||||
int getDuration() const { return mDuration_s; }
|
||||
int getLineType() const { return mLineType; }
|
||||
const osg::Vec3d& getShooterPos() const
|
||||
{
|
||||
return mShooterPos;
|
||||
}
|
||||
|
||||
const osg::Vec4& getColor() const { return mColor; }
|
||||
int32_t getId() const { return mId; }
|
||||
const osg::Vec3d& getTargetPos() const
|
||||
{
|
||||
return mTargetPos;
|
||||
}
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
int32_t mId;
|
||||
osg::Vec3d mShooterPos;
|
||||
osg::Vec3d mTargetPos;
|
||||
int mBuildingIdSrc;
|
||||
int mRoomNumberSrc;
|
||||
int mBuildingIdDst;
|
||||
int mRoomNumberDst;
|
||||
int mLineType;
|
||||
osg::Vec4 mColor;
|
||||
unsigned int mDuration_s, m_DurationMax_s;
|
||||
double mSimTimeCreated;
|
||||
int getBuildingIdSrc() const
|
||||
{
|
||||
return mBuildingIdSrc;
|
||||
}
|
||||
|
||||
double getSimeTimeCreated() const
|
||||
{
|
||||
return mSimTimeCreated;
|
||||
}
|
||||
|
||||
int getRoomNumberSrc() const
|
||||
{
|
||||
return mRoomNumberSrc;
|
||||
}
|
||||
|
||||
int getBuildingIdDst() const
|
||||
{
|
||||
return mBuildingIdDst;
|
||||
}
|
||||
|
||||
int getRoomNumberDst() const
|
||||
{
|
||||
return mRoomNumberDst;
|
||||
}
|
||||
|
||||
int getDuration() const
|
||||
{
|
||||
return mDuration_s;
|
||||
}
|
||||
|
||||
int getLineType() const
|
||||
{
|
||||
return mLineType;
|
||||
}
|
||||
|
||||
const osg::Vec4& getColor() const
|
||||
{
|
||||
return mColor;
|
||||
}
|
||||
|
||||
int32_t getId() const
|
||||
{
|
||||
return mId;
|
||||
}
|
||||
|
||||
private:
|
||||
NGL::INGLLogger& m_logger;
|
||||
int32_t mId;
|
||||
osg::Vec3d mShooterPos;
|
||||
osg::Vec3d mTargetPos;
|
||||
int mBuildingIdSrc;
|
||||
int mRoomNumberSrc;
|
||||
int mBuildingIdDst;
|
||||
int mRoomNumberDst;
|
||||
int mLineType;
|
||||
osg::Vec4 mColor;
|
||||
unsigned int mDuration_s, m_DurationMax_s;
|
||||
double mSimTimeCreated;
|
||||
};
|
||||
|
||||
|
||||
struct ShotDisplay
|
||||
{
|
||||
Shot *mShot = nullptr;
|
||||
osg::ref_ptr<osg::Geode> mGeode;
|
||||
Shot* mShot = nullptr;
|
||||
osg::ref_ptr<osg::Geode> mGeode;
|
||||
};
|
||||
|
||||
|
||||
struct Building;
|
||||
|
||||
|
||||
|
||||
|
||||
class OrthoMotionModelComponent;
|
||||
|
||||
struct BuildingDisplay
|
||||
{
|
||||
|
||||
unsigned int mContextId = 0;
|
||||
{
|
||||
|
||||
|
||||
dtEntity::EntityId mAttachPointId = 0;
|
||||
unsigned int mContextId = 0;
|
||||
|
||||
|
||||
std::vector<BuildingLevel> mLevels;
|
||||
dtEntity::EntityId mAttachPointId = 0;
|
||||
|
||||
|
||||
osg::BoundingBox mWorldBounds;
|
||||
std::vector<BuildingLevel> mLevels;
|
||||
|
||||
|
||||
osg::BoundingBox mLocalBounds;
|
||||
osg::BoundingBox mWorldBounds;
|
||||
|
||||
|
||||
dtEntity::EntityId mCameraId = 0;
|
||||
osg::BoundingBox mLocalBounds;
|
||||
|
||||
|
||||
dtEntity::EntityId mMotionModelId = 0;
|
||||
OrthoMotionModelComponent *pMotion = nullptr;
|
||||
dtEntity::EntityId mCameraId = 0;
|
||||
|
||||
|
||||
dtEntity::EntityId mLightId = 0;
|
||||
dtEntity::EntityId mMotionModelId = 0;
|
||||
OrthoMotionModelComponent* pMotion = nullptr;
|
||||
|
||||
|
||||
PlayerDisplayMode mPlayerDisplayMode = PlayerDisplayMode::Icons;
|
||||
dtEntity::EntityId mLightId = 0;
|
||||
|
||||
|
||||
ViewMode mViewMode = ViewMode::ISOMETRIC;
|
||||
PlayerDisplayMode mPlayerDisplayMode = PlayerDisplayMode::Icons;
|
||||
|
||||
|
||||
std::vector<PlayerDisplay> mPlayers;
|
||||
ViewMode mViewMode = ViewMode::ISOMETRIC;
|
||||
|
||||
|
||||
std::vector<ShotDisplay> mShotDisplays;
|
||||
std::vector<PlayerDisplay> mPlayers;
|
||||
|
||||
|
||||
std::vector<DeviceDisplay> mDeviceDisplays;
|
||||
std::vector<ShotDisplay> mShotDisplays;
|
||||
|
||||
|
||||
std::vector<NameDisplay> mNameDisplays;
|
||||
std::vector<DeviceDisplay> mDeviceDisplays;
|
||||
|
||||
|
||||
bool mLockRotation = false;
|
||||
std::vector<NameDisplay> mNameDisplays;
|
||||
|
||||
|
||||
bool mNameMode = false;
|
||||
bool mLockRotation = false;
|
||||
|
||||
|
||||
bool mLineMode = false;
|
||||
bool mNameMode = false;
|
||||
|
||||
BuildingDisplay() = default;
|
||||
bool mLineMode = false;
|
||||
|
||||
BuildingDisplay(unsigned int contextid, ViewMode vm)
|
||||
: mContextId(contextid)
|
||||
, mViewMode(vm)
|
||||
{
|
||||
}
|
||||
BuildingDisplay() = default;
|
||||
|
||||
BuildingDisplay(unsigned int contextid, ViewMode vm) : mContextId(contextid), mViewMode(vm) {}
|
||||
};
|
||||
|
||||
|
||||
struct Building
|
||||
{
|
||||
|
||||
dtEntity::EntityId mWorldBuildingId = 0;
|
||||
|
||||
|
||||
std::vector<BuildingDisplay> mDisplays;
|
||||
dtEntity::EntityId mWorldBuildingId = 0;
|
||||
|
||||
|
||||
osg::Matrix mWorldToLocal;
|
||||
std::vector<BuildingDisplay> mDisplays;
|
||||
|
||||
|
||||
osg::Matrix mLocalToWorld;
|
||||
osg::Matrix mWorldToLocal;
|
||||
|
||||
|
||||
std::string mNavMeshGrpName;
|
||||
osg::Matrix mLocalToWorld;
|
||||
|
||||
|
||||
std::vector<Shot *> mShots;
|
||||
std::string mNavMeshGrpName;
|
||||
|
||||
|
||||
std::vector<Device *> mDevices;
|
||||
std::vector<Shot*> mShots;
|
||||
|
||||
|
||||
std::string mBuildingDisplayName;
|
||||
std::vector<Device*> mDevices;
|
||||
|
||||
|
||||
std::vector<Name*> mNames;
|
||||
std::string mBuildingDisplayName;
|
||||
|
||||
|
||||
std::string mFeatureId;
|
||||
std::vector<Name*> mNames;
|
||||
|
||||
std::string mFeatureId;
|
||||
};
|
||||
|
||||
|
||||
class BuildingManager
|
||||
{
|
||||
|
||||
public:
|
||||
public:
|
||||
explicit BuildingManager(dtEntity::EntityManager& em);
|
||||
~BuildingManager();
|
||||
|
||||
explicit BuildingManager(dtEntity::EntityManager &em);
|
||||
~BuildingManager();
|
||||
void addBuilding(dtEntity::EntityId buildingid, const std::string& featureId);
|
||||
void deleteAllBuildings();
|
||||
|
||||
void addBuilding(dtEntity::EntityId buildingid, const std::string &featureId);
|
||||
void deleteAllBuildings();
|
||||
BuildingDisplay* getBuildingDisplay(unsigned int contextid);
|
||||
void applyViewModeToBuildingParts(const Building& bldg, BuildingDisplay& dspl) const;
|
||||
|
||||
BuildingDisplay *getBuildingDisplay(unsigned int contextid);
|
||||
void applyViewModeToBuildingParts(const Building &bldg, BuildingDisplay &dspl) const;
|
||||
bool displayBuilding(const std::string& featureId, unsigned int contextid, dtEntity::EntityId buildingid,
|
||||
const osg::Vec4& bgcolor, ViewMode viewmode, bool exactPos);
|
||||
bool displayBuilding(unsigned int contextid, dtEntity::EntityId buildingid, const osg::Vec4& bgcolor,
|
||||
ViewMode viewmode, bool exactPos);
|
||||
|
||||
bool displayBuilding(const std::string& featureId, unsigned int contextid, dtEntity::EntityId buildingid, const osg::Vec4 &bgcolor, ViewMode viewmode, bool exactPos);
|
||||
bool displayBuilding(unsigned int contextid, dtEntity::EntityId buildingid, const osg::Vec4 &bgcolor, ViewMode viewmode, bool exactPos);
|
||||
bool setCameraPosition(unsigned int contextid, const BuildingViewer::CameraViewPosition& pos);
|
||||
bool getCameraPosition(unsigned int contextid, BuildingViewer::CameraViewPosition& pos);
|
||||
bool setDefaultCameraPosition(unsigned int contextid);
|
||||
|
||||
bool setCameraPosition(unsigned int contextid, const BuildingViewer::CameraViewPosition& pos);
|
||||
bool getCameraPosition(unsigned int contextid, BuildingViewer::CameraViewPosition& pos);
|
||||
bool setDefaultCameraPosition(unsigned int contextid);
|
||||
void closeBuildingDisplay(unsigned int contextid);
|
||||
void changeViewMode(unsigned int contextId, ViewMode viewmode, bool useOriginViewPos = true);
|
||||
void changeLineMode(unsigned int contextId, bool line);
|
||||
void changeNameMode(unsigned int contextId, bool name);
|
||||
|
||||
void closeBuildingDisplay(unsigned int contextid);
|
||||
void changeViewMode(unsigned int contextId, ViewMode viewmode, bool useOriginViewPos = true);
|
||||
void changeLineMode(unsigned int contextId, bool line);
|
||||
void changeNameMode(unsigned int contextId, bool name);
|
||||
void applyMapRotation(const Building& bd, BuildingDisplay& dspl);
|
||||
void lockViewRotationToMapRotation(unsigned int contextId, bool lock);
|
||||
void setPlayerDisplayMode(unsigned int contextId, PlayerDisplayMode mode);
|
||||
void setWallTransparency(unsigned int contextId, float value);
|
||||
|
||||
void applyMapRotation(const Building &bd, BuildingDisplay &dspl);
|
||||
void lockViewRotationToMapRotation(unsigned int contextId, bool lock);
|
||||
void setPlayerDisplayMode(unsigned int contextId, PlayerDisplayMode mode);
|
||||
void setWallTransparency(unsigned int contextId, float value);
|
||||
float getMapRotation() const;
|
||||
void setMapRotation(float angle);
|
||||
|
||||
float getMapRotation() const;
|
||||
void setMapRotation(float angle);
|
||||
void openOverview(unsigned int contextid);
|
||||
|
||||
void openOverview(unsigned int contextid);
|
||||
void addPlayerToBuildings(const std::string& navmeshgrpname, dtEntity::EntityId eid, const osg::Vec4& color,
|
||||
const std::string& symbol, const osg::Vec3d& pos, bool visible);
|
||||
void removePlayerFromBuilding(const std::string& navmeshgrpname, dtEntity::EntityId eid,
|
||||
const std::string& roomname);
|
||||
void updatePlayerPosition(const std::string& navmeshgrpname, dtEntity::EntityId eid, const osg::Vec3d& pos,
|
||||
int roomNumber);
|
||||
|
||||
void addPlayerToBuildings(const std::string &navmeshgrpname, dtEntity::EntityId eid,
|
||||
const osg::Vec4 &color, const std::string &symbol,
|
||||
const osg::Vec3d &pos, bool visible);
|
||||
void removePlayerFromBuilding(const std::string &navmeshgrpname, dtEntity::EntityId eid, const std::string &roomname);
|
||||
void updatePlayerPosition(const std::string &navmeshgrpname, dtEntity::EntityId eid,
|
||||
const osg::Vec3d &pos, int roomNumber);
|
||||
osg::Vec3d remapPosition(const Building& bd, const BuildingDisplay& dspl, const osg::Vec3d& world,
|
||||
int roomNumber = -1);
|
||||
|
||||
osg::Vec3d remapPosition(const Building &bd, const BuildingDisplay &dspl, const osg::Vec3d &world, int roomNumber = -1);
|
||||
void setPlayerColor(dtEntity::EntityId eid, const osg::Vec4& color);
|
||||
void setPlayerIcon(dtEntity::EntityId eid, const std::string& path);
|
||||
void reloadPlayerIcons();
|
||||
void updatePlayerPartyColor(dtEntity::EntityId eid, const VCtrl::Color& col);
|
||||
void setShowPlayerSelection(dtEntity::EntityId eid, bool show);
|
||||
void setShowDisplayNamesSelection(dtEntity::EntityId eid, bool show);
|
||||
void setShowHidePlayer(dtEntity::EntityId eid, bool show);
|
||||
void setShowHideDisplayNames(dtEntity::EntityId eid, unsigned int contextId, bool show);
|
||||
void setRoomDestructionValue(dtEntity::EntityId eid, const std::string& roomname, float value);
|
||||
void setBuildingDestructionValue(dtEntity::EntityId eid, float value);
|
||||
void setBuildingDisplayName(const std::string& featureId, dtEntity::EntityId eid,
|
||||
const std::string& strDisplayName);
|
||||
void setBuildingDisplayName(dtEntity::EntityId eid, const std::string& strDisplayName);
|
||||
void setRoomDisplayName(const std::string& featureId, dtEntity::EntityId eid, const std::string& roomname,
|
||||
const std::string& strDisplayName);
|
||||
void setRoomDisplayName(Building* building, const std::string& roomname, const std::string& strDisplayName);
|
||||
|
||||
void setPlayerColor(dtEntity::EntityId eid, const osg::Vec4 &color);
|
||||
void setPlayerIcon(dtEntity::EntityId eid, const std::string &path);
|
||||
void reloadPlayerIcons();
|
||||
void updatePlayerPartyColor(dtEntity::EntityId eid, const VCtrl::Color& col);
|
||||
void setShowPlayerSelection(dtEntity::EntityId eid, bool show);
|
||||
void setShowDisplayNamesSelection(dtEntity::EntityId eid, bool show);
|
||||
void setShowHidePlayer(dtEntity::EntityId eid, bool show);
|
||||
void setShowHideDisplayNames(dtEntity::EntityId eid, unsigned int contextId, bool show);
|
||||
void setRoomDestructionValue(dtEntity::EntityId eid, const std::string &roomname, float value);
|
||||
void setBuildingDestructionValue(dtEntity::EntityId eid, float value);
|
||||
void setBuildingDisplayName(const std::string& featureId, dtEntity::EntityId eid, const std::string& strDisplayName);
|
||||
void setBuildingDisplayName(dtEntity::EntityId eid, const std::string& strDisplayName);
|
||||
void setRoomDisplayName(const std::string& featureId, dtEntity::EntityId eid, const std::string& roomname, const std::string& strDisplayName);
|
||||
void setRoomDisplayName(Building *building, const std::string &roomname, const std::string& strDisplayName);
|
||||
void removeShoot(int32_t id);
|
||||
void showShoot(int32_t id, dtEntity::EntityId shooter, dtEntity::EntityId target, const dtEntity::Vec3d& shooterPos,
|
||||
const dtEntity::Vec3d& targetPos, int buildingIdSrc, int roomNumberSrc, int buildingIdDst,
|
||||
int roomNumberDst, int lineType, float duration, double simTimeCreated);
|
||||
|
||||
void removeShoot(int32_t id);
|
||||
void showShoot(int32_t id, dtEntity::EntityId shooter, dtEntity::EntityId target,
|
||||
const dtEntity::Vec3d &shooterPos, const dtEntity::Vec3d &targetPos, int buildingIdSrc, int roomNumberSrc,
|
||||
int buildingIdDst, int roomNumberDst, int lineType, float duration, double simTimeCreated);
|
||||
dtEntity::EntityId getWorldPlayerIdFromLocalPlayer(dtEntity::EntityId local) const;
|
||||
dtEntity::EntityId getWorldNameIdFromLocalName(dtEntity::EntityId local, std::string& buildingName,
|
||||
std::string& room) const;
|
||||
|
||||
dtEntity::EntityId getWorldPlayerIdFromLocalPlayer(dtEntity::EntityId local) const;
|
||||
dtEntity::EntityId getWorldNameIdFromLocalName(dtEntity::EntityId local, std::string &buildingName, std::string &room) const;
|
||||
void addDeviceToBuilding(dtEntity::EntityId iconmainid, dtEntity::EntityId buildingid, const osg::Vec3d& pos,
|
||||
const std::string& iconpath);
|
||||
void removeDeviceFromBuilding(dtEntity::EntityId iconmainid);
|
||||
|
||||
void addDeviceToBuilding(dtEntity::EntityId iconmainid, dtEntity::EntityId buildingid,
|
||||
const osg::Vec3d &pos, const std::string &iconpath);
|
||||
void removeDeviceFromBuilding(dtEntity::EntityId iconmainid);
|
||||
bool AddRoomOBBs(const BuildingData&);
|
||||
|
||||
const std::map<std::string, VCtrl::OBB>& GetRoomOBBs() const
|
||||
{
|
||||
return mRooms;
|
||||
}
|
||||
|
||||
|
||||
bool AddRoomOBBs(const BuildingData &);
|
||||
const std::map<std::string, VCtrl::OBB> &GetRoomOBBs() const { return mRooms; }
|
||||
bool getRoomBounds(const std::string& bldgname, const std::string& roomname, VCtrl::OBB& obb) const;
|
||||
|
||||
|
||||
bool getRoomBounds(const std::string &bldgname, const std::string &roomname, VCtrl::OBB &obb) const;
|
||||
bool LoadBuildings(const std::string& path, std::vector<BuildingData>&);
|
||||
|
||||
size_t getNumBuildings() const;
|
||||
void getBuildingIds(std::vector<dtEntity::EntityId>& toFill) const;
|
||||
dtEntity::EntityId getNextBuilding(const osg::Vec3d& pos, float& distance, std::string& featureId) const;
|
||||
Building getBuildingFromFeatureId(const std::string& bldname) const;
|
||||
|
||||
bool LoadBuildings(const std::string &path, std::vector<BuildingData> &);
|
||||
using RoomPlayers = std::vector<PlayerPosition>;
|
||||
|
||||
size_t getNumBuildings() const;
|
||||
void getBuildingIds(std::vector<dtEntity::EntityId> &toFill) const;
|
||||
dtEntity::EntityId getNextBuilding(const osg::Vec3d &pos, float &distance, std::string &featureId) const;
|
||||
Building getBuildingFromFeatureId(const std::string &bldname) const;
|
||||
osg::Vec2d AddRoomUsages(const std::string& bldgname, const std::string& roomname, VCtrl::PlayerPosition& playPos);
|
||||
|
||||
|
||||
using RoomPlayers = std::vector<PlayerPosition>;
|
||||
|
||||
osg::Vec2d AddRoomUsages(const std::string& bldgname, const std::string& roomname, VCtrl::PlayerPosition& playPos);
|
||||
const std::map<std::string, RoomPlayers> &GetRoomUsages() const { return mUsedRooms; }
|
||||
|
||||
void deleteRoomUsagePlayer(const std::string& bldgname, const std::string& roomname, dtEntity::EntityId playerId);
|
||||
void SetExactPos(bool exactPos) { mExactPos = exactPos; }
|
||||
bool GetExactPos() const { return mExactPos; }
|
||||
void updateShotDuration(unsigned int newDuration_s);
|
||||
using CallbackCamPosChanged = std::function<void(unsigned int, const BuildingViewer::CameraViewPosition &)>;
|
||||
void setCallbackCamPosChanged(const CallbackCamPosChanged &cb);
|
||||
const std::map<std::string, RoomPlayers>& GetRoomUsages() const
|
||||
{
|
||||
return mUsedRooms;
|
||||
}
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void updateShots(const Building &bd, BuildingDisplay &dspl);
|
||||
void updateDevices(const Building &bd, BuildingDisplay &dspl);
|
||||
void createRoomNames(dtEntity::EntityId buildingid, Building& building);
|
||||
void updateNames(const Building& bd, BuildingDisplay& dspl);
|
||||
void repositionCamera(const Building &bd, const BuildingDisplay &dspl, bool useOriginViewPos = true);
|
||||
void updatePlayerPositions(const Building &bd, BuildingDisplay &dspl);
|
||||
void addPlayerToBuilding(const Building &bd, BuildingDisplay &dspl, dtEntity::EntityId eid,
|
||||
const osg::Vec4 &color, const std::string &symbol, const osg::Vec3d &pos,
|
||||
bool visible);
|
||||
static osg::Vec2d shiftPosition(const VCtrl::OBB& obb, const osg::Vec2d& pos, double& shiftValue);
|
||||
void cameraViewPositionChanged(unsigned int contextId, const BuildingViewer::CameraViewPosition &viewPos);
|
||||
void deleteRoomUsagePlayer(const std::string& bldgname, const std::string& roomname, dtEntity::EntityId playerId);
|
||||
|
||||
std::set<unsigned int> m_setInitialCameraPositionSet;
|
||||
void SetExactPos(bool exactPos)
|
||||
{
|
||||
mExactPos = exactPos;
|
||||
}
|
||||
|
||||
std::map<std::string, std::map<std::string, std::string>> m_mapBuildingRoomNames;
|
||||
std::map<std::string, std::string> m_mapBuildingDisplayNames;
|
||||
dtEntity::EntityManager *mEntityManager;
|
||||
bool GetExactPos() const
|
||||
{
|
||||
return mExactPos;
|
||||
}
|
||||
|
||||
std::vector<Building *> mBuildings;
|
||||
QMutex m_mutexShots;
|
||||
void updateShotDuration(unsigned int newDuration_s);
|
||||
using CallbackCamPosChanged = std::function<void(unsigned int, const BuildingViewer::CameraViewPosition&)>;
|
||||
void setCallbackCamPosChanged(const CallbackCamPosChanged& cb);
|
||||
|
||||
bool mShotOverview;
|
||||
bool mExactPos;
|
||||
float mMapRotation;
|
||||
dtEntity::MessageFunctor mTickFunctor;
|
||||
private:
|
||||
NGL::INGLLogger& m_logger;
|
||||
void updateShots(const Building& bd, BuildingDisplay& dspl);
|
||||
void updateDevices(const Building& bd, BuildingDisplay& dspl);
|
||||
void createRoomNames(dtEntity::EntityId buildingid, Building& building);
|
||||
void updateNames(const Building& bd, BuildingDisplay& dspl);
|
||||
void repositionCamera(const Building& bd, const BuildingDisplay& dspl, bool useOriginViewPos = true);
|
||||
void updatePlayerPositions(const Building& bd, BuildingDisplay& dspl);
|
||||
void addPlayerToBuilding(const Building& bd, BuildingDisplay& dspl, dtEntity::EntityId eid, const osg::Vec4& color,
|
||||
const std::string& symbol, const osg::Vec3d& pos, bool visible);
|
||||
static osg::Vec2d shiftPosition(const VCtrl::OBB& obb, const osg::Vec2d& pos, double& shiftValue);
|
||||
void cameraViewPositionChanged(unsigned int contextId, const BuildingViewer::CameraViewPosition& viewPos);
|
||||
|
||||
void Tick(const dtEntity::Message &message);
|
||||
std::set<unsigned int> m_setInitialCameraPositionSet;
|
||||
|
||||
std::map<std::string, VCtrl::OBB> mRooms;
|
||||
std::map<std::string, RoomPlayers> mUsedRooms;
|
||||
CallbackCamPosChanged mCbCamPosChanged;
|
||||
std::map<std::string, std::map<std::string, std::string>> m_mapBuildingRoomNames;
|
||||
std::map<std::string, std::string> m_mapBuildingDisplayNames;
|
||||
dtEntity::EntityManager* mEntityManager;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool getFloorOfRoom(const std::string &bdlgFeatureId, int roomNumber, int &floorOut) const;
|
||||
|
||||
|
||||
std::map<std::string, std::map<int,int> > mRoomToFloorPerBldg;
|
||||
std::vector<Building*> mBuildings;
|
||||
QMutex m_mutexShots;
|
||||
|
||||
bool mShotOverview;
|
||||
bool mExactPos;
|
||||
float mMapRotation;
|
||||
dtEntity::MessageFunctor mTickFunctor;
|
||||
|
||||
void Tick(const dtEntity::Message& message);
|
||||
|
||||
std::map<std::string, VCtrl::OBB> mRooms;
|
||||
std::map<std::string, RoomPlayers> mUsedRooms;
|
||||
CallbackCamPosChanged mCbCamPosChanged;
|
||||
|
||||
bool getFloorOfRoom(const std::string& bdlgFeatureId, int roomNumber, int& floorOut) const;
|
||||
|
||||
std::map<std::string, std::map<int, int>> mRoomToFloorPerBldg;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace VCtrl
|
||||
Executable → Regular
+176
-285
@@ -1,41 +1,39 @@
|
||||
#pragma once
|
||||
|
||||
#include "buildingmanager.h"
|
||||
#include "exccommands.h"
|
||||
#include "logger.h"
|
||||
#include "viewerinterface.h"
|
||||
#include "viewwidgetcontainer.h"
|
||||
#include <dtEntity/mapcomponent.h>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
#include "viewwidgetstate.h"
|
||||
|
||||
#include <QPointer>
|
||||
#include <QWidget>
|
||||
|
||||
#include <dtEntity/mapcomponent.h>
|
||||
#include <dtEntity/core.h>
|
||||
#include <algorithm>
|
||||
#include <dtEntity/commandmessages.h>
|
||||
#include <dtEntity/core.h>
|
||||
#include <dtEntity/mapcomponent.h>
|
||||
#include <dtEntity/systemmessages.h>
|
||||
#include <dtEntity/windowinterface.h>
|
||||
#include <dtEntityOSG/cameracomponent.h>
|
||||
#include <dtEntityOSG/layercomponent.h>
|
||||
#include <dtEntityOSG/positionattitudetransformcomponent.h>
|
||||
#include <dtEntityOSG/osgsysteminterface.h>
|
||||
#include <dtEntityOSG/positionattitudetransformcomponent.h>
|
||||
#include <dtEntityOSG/staticmeshcomponent.h>
|
||||
#include <map>
|
||||
#include <osg/ComputeBoundsVisitor>
|
||||
#include <osg/io_utils>
|
||||
#include <osgDB/FileNameUtils>
|
||||
#include <osgDB/FileUtils>
|
||||
#include <osg/ComputeBoundsVisitor>
|
||||
#include <osgViewer/CompositeViewer>
|
||||
#include "buildingmanager.h"
|
||||
#include "exccommands.h"
|
||||
#include "viewwidgetstate.h"
|
||||
#include "logger.h"
|
||||
#include <string>
|
||||
|
||||
namespace dtEntity
|
||||
{
|
||||
class EntityManager;
|
||||
class MapSystem;
|
||||
class Message;
|
||||
}
|
||||
} // namespace dtEntity
|
||||
|
||||
namespace VCtrl
|
||||
{
|
||||
@@ -48,354 +46,247 @@ class CtrlMainWindow;
|
||||
|
||||
class CtrlImpl : public QObject, public ViewerInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Q_OBJECT
|
||||
public:
|
||||
CtrlImpl(dtEntity::EntityManager& em, QWidget* parentWidget);
|
||||
~CtrlImpl();
|
||||
|
||||
CtrlImpl(dtEntity::EntityManager &em, QWidget *parentWidget);
|
||||
~CtrlImpl();
|
||||
void SetViewerCallback(ViewerCallback*) override;
|
||||
void RemoveViewerCallback() override;
|
||||
|
||||
void SetViewerCallback(ViewerCallback *) override;
|
||||
void RemoveViewerCallback() override;
|
||||
void SetProjectDataPaths(const std::vector<std::string>& paths) override;
|
||||
|
||||
|
||||
QWidget* getMainWindow() override;
|
||||
quintptr requestMainWindowHandle() override;
|
||||
|
||||
void SetProjectDataPaths(const std::vector<std::string> &paths) override;
|
||||
void openViews(const std::vector<std::string>& bldIds, bool exactPos) override;
|
||||
bool isViewOpen(const std::string& strBldId) const override;
|
||||
|
||||
QWidget* getMainWindow() override;
|
||||
quintptr requestMainWindowHandle() override;
|
||||
void closeViews(const std::vector<std::string>& vecFeatureIDs) override;
|
||||
void closeAllViews();
|
||||
|
||||
void UseExactPositioning(bool exactPos) override;
|
||||
|
||||
void openViews(const std::vector<std::string> &bldIds, bool exactPos) override;
|
||||
bool isViewOpen(const std::string &strBldId) const override;
|
||||
bool OpenView(const std::string& buildingid, const std::string& windowtitle, const Color& col, ViewMode viewmode,
|
||||
int screennum, bool fullscreen, int x, int y, int w, int h, unsigned int& contextid,
|
||||
bool exactPos = true) override;
|
||||
|
||||
void closeViews(const std::vector<std::string> &vecFeatureIDs) override;
|
||||
void closeAllViews();
|
||||
void CloseView(unsigned int contextid) override;
|
||||
|
||||
void UseExactPositioning(bool exactPos) override;
|
||||
void ChangeViewMode(unsigned int contextId, ViewMode viewmode) override;
|
||||
|
||||
|
||||
void LockViewRotationToMapRotation(unsigned int contextId, bool lock) override;
|
||||
|
||||
bool OpenView(const std::string &buildingid, const std::string &windowtitle, const Color &col,
|
||||
ViewMode viewmode, int screennum,
|
||||
bool fullscreen, int x, int y, int w, int h, unsigned int &contextid, bool exactPos = true) override;
|
||||
void SetPlayerDisplayMode(unsigned int contextId, PlayerDisplayMode mode) override;
|
||||
|
||||
void SetWallTransparency(unsigned int contextId, float transparency) override;
|
||||
|
||||
|
||||
float GetMapRotation() const override;
|
||||
|
||||
void CloseView(unsigned int contextid) override;
|
||||
void SetMapRotation(float angle) override;
|
||||
|
||||
|
||||
void OpenOverview() override;
|
||||
|
||||
void ChangeViewMode(unsigned int contextId, ViewMode viewmode) override;
|
||||
bool LoadBuildingPositionMap(const std::string& path, bool loadAllAvailableBuildings) override;
|
||||
|
||||
|
||||
void LoadAllBuildings();
|
||||
|
||||
void LockViewRotationToMapRotation(unsigned int contextId, bool lock) override;
|
||||
void CreatePlayer(const std::string& id, const std::string& iconpath, const Color& color) override;
|
||||
|
||||
|
||||
void DeletePlayer(const std::string& id, float seconds = 0) override;
|
||||
|
||||
void SetPlayerDisplayMode(unsigned int contextId, PlayerDisplayMode mode) override;
|
||||
void SetPlayerColor(const std::string& id, const Color& color) override;
|
||||
|
||||
|
||||
void SetPlayerIcon(const std::string& id, const std::string& path) override;
|
||||
|
||||
void SetWallTransparency(unsigned int contextId, float transparency) override;
|
||||
void reloadPlayerIcons() override;
|
||||
|
||||
|
||||
void UpdatePlayerPartyColors(const std::map<std::string, VCtrl::Color>& mapPlayerColors) override;
|
||||
|
||||
float GetMapRotation() const override;
|
||||
size_t GetNumPlayers() const override;
|
||||
|
||||
|
||||
void GetPlayerIds(std::vector<std::string>& toFill) override;
|
||||
|
||||
void SetMapRotation(float angle) override;
|
||||
void SetPlayerShown(const std::string& id, bool show, double when = -1) override;
|
||||
|
||||
|
||||
size_t GetNumBuildings() const override;
|
||||
|
||||
void OpenOverview() override;
|
||||
void GetBuildingIds(std::vector<std::string>& toFill) const override;
|
||||
|
||||
void SetShowSelectionBox(const std::string& id, bool show, float duration = -1) override;
|
||||
|
||||
|
||||
void Shoot(const int32_t id, const std::string& shooter, const std::string& target, const Vec3d& shooterPos,
|
||||
const Vec3d& targetPos, int buildingIdSrc, int roomNumberSrc, int buildingIdDst, int roomNumberDst,
|
||||
int lineType, double when) override;
|
||||
void Shoot(const int32_t id, const std::string& shooter, const std::string& targetBuildingId,
|
||||
const std::string& targetRoomId, const Vec3d& shooterPos, int lineType, double when) override;
|
||||
|
||||
bool LoadBuildingPositionMap(const std::string &path, bool loadAllAvailableBuildings) override;
|
||||
void removeShoot(const int32_t id) override;
|
||||
|
||||
void Teleport(const std::string& id, double when, const Vec3d& target, const std::string& bldgname, int roomNumber,
|
||||
const std::string& roomname, ZValue zval) override;
|
||||
|
||||
void LoadAllBuildings();
|
||||
void GetRoomNames(const std::string& id, std::vector<std::string>& names) override;
|
||||
|
||||
|
||||
bool SetRoomDestructionValue(const std::string& id, const std::string& roomname, float value) override;
|
||||
|
||||
void CreatePlayer(const std::string &id, const std::string &iconpath, const Color &color) override;
|
||||
bool SetBuildingDestructionValue(const std::string& id, float value) override;
|
||||
|
||||
|
||||
void GetDeviceNames(const std::string& buildingId, std::vector<std::string>& names) override;
|
||||
|
||||
void DeletePlayer(const std::string &id, float seconds = 0) override;
|
||||
bool ShowDeviceIcon(const std::string& id, const std::string& buildingid, const std::string& devicename,
|
||||
const std::string& iconpath) override;
|
||||
|
||||
|
||||
bool ShowDeviceIcon(const std::string& id, const std::string& buildingid, const Vec3d& position,
|
||||
const std::string& iconpath) override;
|
||||
|
||||
void SetPlayerColor(const std::string &id, const Color &color) override;
|
||||
void ChangeLineMode(unsigned int contextId, bool line) override;
|
||||
void ChangeNameMode(unsigned int contextId, bool name) override;
|
||||
|
||||
|
||||
bool SetDisplayName(const std::string& buildingid, const std::string& roomname,
|
||||
const std::string& strDisplayName) override;
|
||||
void ShowDisplayNames(const std::string& buildingid, bool show) override;
|
||||
void SetShowDisplayNamesSelectionBox(const std::string& buildingid, const std::string& id, bool show,
|
||||
float duration = -1) override;
|
||||
void setHitLineDuration(uint32_t durationSec) override;
|
||||
void setMountingPointAsset(const MountingPointDescription& asset) override;
|
||||
std::vector<BuildingState> getBuildingState() const override;
|
||||
|
||||
void SetPlayerIcon(const std::string &id, const std::string &path) override;
|
||||
bool HideDeviceIcon(const std::string& id) override;
|
||||
|
||||
float GetTimeScale() const override;
|
||||
|
||||
void reloadPlayerIcons() override;
|
||||
void SetTimeScale(float scale) override;
|
||||
|
||||
void UpdatePlayerPartyColors(const std::map<std::string, VCtrl::Color>& mapPlayerColors) override;
|
||||
void SetSimulationTime(double t) override;
|
||||
|
||||
|
||||
double GetSimulationTime() const override;
|
||||
|
||||
size_t GetNumPlayers() const override;
|
||||
void SetPaused(bool) override;
|
||||
|
||||
|
||||
bool GetPaused() const override;
|
||||
|
||||
void GetPlayerIds(std::vector<std::string> &toFill) override;
|
||||
void FastForwardSimulationTo(double t) override;
|
||||
|
||||
|
||||
void DeleteQueuedCommands() override;
|
||||
|
||||
void SetPlayerShown(const std::string &id, bool show, double when = -1) override;
|
||||
void SetNonRealtimeMode(bool on) override;
|
||||
|
||||
|
||||
bool GetNonRealtimeMode() const override;
|
||||
|
||||
size_t GetNumBuildings() const override;
|
||||
bool StartVideoRecording(unsigned int contextid, const std::string& path, int w, int h, int framerate,
|
||||
int quality) override;
|
||||
bool StartVideoRecording(const std::string& buildingId, const std::string& path, int w, int h, int framerate,
|
||||
int quality) override;
|
||||
|
||||
|
||||
bool StopVideoRecording(unsigned int contextid) override;
|
||||
bool StopVideoRecording(const std::string& buildingId) override;
|
||||
|
||||
void GetBuildingIds(std::vector<std::string> &toFill) const override;
|
||||
void setTransparency(double percent) override;
|
||||
void setViewMode(ViewMode m) override;
|
||||
void setDisplayMode(PlayerDisplayMode m) override;
|
||||
|
||||
|
||||
|
||||
void SetShowSelectionBox(const std::string &id,
|
||||
bool show,
|
||||
float duration = -1) override;
|
||||
|
||||
|
||||
|
||||
void Shoot(const int32_t id,
|
||||
const std::string &shooter,
|
||||
const std::string &target,
|
||||
const Vec3d &shooterPos,
|
||||
const Vec3d &targetPos,
|
||||
int buildingIdSrc, int roomNumberSrc, int buildingIdDst, int roomNumberDst,
|
||||
int lineType,
|
||||
double when) override;
|
||||
void Shoot(const int32_t id,
|
||||
const std::string &shooter,
|
||||
const std::string &targetBuildingId,
|
||||
const std::string &targetRoomId,
|
||||
const Vec3d &shooterPos, int lineType,
|
||||
double when) override;
|
||||
|
||||
void removeShoot(const int32_t id) override;
|
||||
|
||||
|
||||
|
||||
void Teleport(const std::string &id,
|
||||
double when,
|
||||
const Vec3d &target,
|
||||
const std::string &bldgname,
|
||||
int roomNumber,
|
||||
const std::string &roomname,
|
||||
ZValue zval) override;
|
||||
|
||||
|
||||
|
||||
void GetRoomNames(const std::string &id, std::vector<std::string> &names) override;
|
||||
|
||||
|
||||
|
||||
bool SetRoomDestructionValue(const std::string &id,
|
||||
const std::string &roomname,
|
||||
float value) override;
|
||||
|
||||
|
||||
|
||||
bool SetBuildingDestructionValue(const std::string &id, float value) override;
|
||||
|
||||
|
||||
|
||||
void GetDeviceNames(const std::string &buildingId, std::vector<std::string> &names) override;
|
||||
|
||||
|
||||
|
||||
bool ShowDeviceIcon(const std::string &id, const std::string &buildingid,
|
||||
const std::string &devicename, const std::string &iconpath) override;
|
||||
|
||||
|
||||
|
||||
bool ShowDeviceIcon(const std::string &id, const std::string &buildingid,
|
||||
const Vec3d &position, const std::string &iconpath) override;
|
||||
|
||||
void ChangeLineMode(unsigned int contextId, bool line) override;
|
||||
void ChangeNameMode(unsigned int contextId, bool name) override;
|
||||
|
||||
bool SetDisplayName(const std::string& buildingid, const std::string& roomname, const std::string& strDisplayName) override;
|
||||
void ShowDisplayNames(const std::string& buildingid, bool show) override;
|
||||
void SetShowDisplayNamesSelectionBox(const std::string& buildingid, const std::string& id, bool show, float duration = -1) override;
|
||||
void setHitLineDuration(uint32_t durationSec) override;
|
||||
void setMountingPointAsset(const MountingPointDescription &asset) override;
|
||||
std::vector<BuildingState> getBuildingState() const override;
|
||||
|
||||
|
||||
|
||||
bool HideDeviceIcon(const std::string &id) override;
|
||||
|
||||
|
||||
|
||||
float GetTimeScale() const override;
|
||||
|
||||
|
||||
|
||||
void SetTimeScale(float scale) override;
|
||||
|
||||
|
||||
|
||||
void SetSimulationTime(double t) override;
|
||||
|
||||
|
||||
|
||||
double GetSimulationTime() const override;
|
||||
|
||||
|
||||
|
||||
void SetPaused(bool) override;
|
||||
|
||||
|
||||
|
||||
bool GetPaused() const override;
|
||||
|
||||
|
||||
|
||||
void FastForwardSimulationTo(double t) override;
|
||||
|
||||
|
||||
|
||||
void DeleteQueuedCommands() override;
|
||||
|
||||
|
||||
|
||||
void SetNonRealtimeMode(bool on) override;
|
||||
|
||||
|
||||
|
||||
bool GetNonRealtimeMode() const override;
|
||||
|
||||
|
||||
|
||||
bool StartVideoRecording(unsigned int contextid, const std::string &path,
|
||||
int w, int h, int framerate, int quality) override;
|
||||
bool StartVideoRecording(const std::string &buildingId, const std::string &path,
|
||||
int w, int h, int framerate, int quality) override;
|
||||
|
||||
|
||||
|
||||
bool StopVideoRecording(unsigned int contextid) override;
|
||||
bool StopVideoRecording(const std::string &buildingId) override;
|
||||
|
||||
void setTransparency(double percent) override;
|
||||
void setViewMode(ViewMode m) override;
|
||||
void setDisplayMode(PlayerDisplayMode m) override;
|
||||
|
||||
int GetFrameRate() const { return mFrameRate; }
|
||||
void OnShowMsgBox(const std::string &strText);
|
||||
|
||||
bool allViewWindowsExposed() const
|
||||
{
|
||||
for (auto *vw : m_openedViewWidgets.getViewWidgets())
|
||||
int GetFrameRate() const
|
||||
{
|
||||
if (!vw->isOpenGlWindowExposed())
|
||||
return false;
|
||||
return mFrameRate;
|
||||
}
|
||||
return !m_openedViewWidgets.getViewWidgets().empty();
|
||||
}
|
||||
|
||||
private:
|
||||
void OnShowMsgBox(const std::string& strText);
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
bool open(const std::string& strFeatureID, bool exactPos);
|
||||
bool open(const std::vector<std::string> &vecFeatureIDs, bool exactPos);
|
||||
bool openAll(bool exactPos);
|
||||
bool allViewWindowsExposed() const
|
||||
{
|
||||
for (auto* vw : m_openedViewWidgets.getViewWidgets())
|
||||
{
|
||||
if (!vw->isOpenGlWindowExposed())
|
||||
return false;
|
||||
}
|
||||
return !m_openedViewWidgets.getViewWidgets().empty();
|
||||
}
|
||||
|
||||
void onEXCOpen(const QString& strIDs, bool exactPos);
|
||||
void onEXCClose(const QString& strIDs);
|
||||
void convertAssetsToPngFiles();
|
||||
private:
|
||||
NGL::INGLLogger& m_logger;
|
||||
bool open(const std::string& strFeatureID, bool exactPos);
|
||||
bool open(const std::vector<std::string>& vecFeatureIDs, bool exactPos);
|
||||
bool openAll(bool exactPos);
|
||||
|
||||
void OnTransformSend(const dtEntity::Message &m);
|
||||
void OnMapLoaded(const dtEntity::Message &m);
|
||||
void OnMapUnloaded(const dtEntity::Message &m);
|
||||
void OnNavMeshGroupChanged(const dtEntity::Message &m);
|
||||
void OnPlayerPicked(const dtEntity::Message &m);
|
||||
void OnHideSelection(const dtEntity::Message &m);
|
||||
|
||||
void OnShoot(const dtEntity::Message &m);
|
||||
void OnShowHidePlayer(const dtEntity::Message &m);
|
||||
void OnDisplayNameClicked(const dtEntity::Message& m);
|
||||
void onEXCOpen(const QString& strIDs, bool exactPos);
|
||||
void onEXCClose(const QString& strIDs);
|
||||
void convertAssetsToPngFiles();
|
||||
|
||||
bool SpawnBuilding(const BuildingData &b, bool useStaticMeshesFolder = true);
|
||||
void LoadBuilding(BuildingData& bd, bool useStaticMeshesFolder);
|
||||
void deleteAllBuildings();
|
||||
void OnTransformSend(const dtEntity::Message& m);
|
||||
void OnMapLoaded(const dtEntity::Message& m);
|
||||
void OnMapUnloaded(const dtEntity::Message& m);
|
||||
void OnNavMeshGroupChanged(const dtEntity::Message& m);
|
||||
void OnPlayerPicked(const dtEntity::Message& m);
|
||||
void OnHideSelection(const dtEntity::Message& m);
|
||||
|
||||
bool getBuildingString(const std::string &strFeatureID, std::string *strBuildingNameID);
|
||||
void OnShoot(const dtEntity::Message& m);
|
||||
void OnShowHidePlayer(const dtEntity::Message& m);
|
||||
void OnDisplayNameClicked(const dtEntity::Message& m);
|
||||
|
||||
bool OpenView(unsigned int contextId);
|
||||
bool CreateView(dtEntity::EntityId bid, const std::string &windowtitle, const Color &col, ViewMode viewmode,
|
||||
int screennum, bool fullscreen, int x, int y, int w, int h,
|
||||
unsigned int &contextid, bool exactPos);
|
||||
bool SpawnBuilding(const BuildingData& b, bool useStaticMeshesFolder = true);
|
||||
void LoadBuilding(BuildingData& bd, bool useStaticMeshesFolder);
|
||||
void deleteAllBuildings();
|
||||
|
||||
QPointer<CtrlMainWindow> m_pMainWindow;
|
||||
bool getBuildingString(const std::string& strFeatureID, std::string* strBuildingNameID);
|
||||
|
||||
dtEntity::EntityManager *mEntityManager;
|
||||
ViewerCallback *mViewerCallback;
|
||||
LogHandler* mLogHandler = nullptr;
|
||||
dtEntity::MapSystem *mMapSystem;
|
||||
PlayerSystem *mPlayerSystem;
|
||||
BuildingManager *mBuildingManager;
|
||||
bool OpenView(unsigned int contextId);
|
||||
bool CreateView(dtEntity::EntityId bid, const std::string& windowtitle, const Color& col, ViewMode viewmode,
|
||||
int screennum, bool fullscreen, int x, int y, int w, int h, unsigned int& contextid, bool exactPos);
|
||||
|
||||
float mTimeScale;
|
||||
double mSimTime;
|
||||
bool mPaused;
|
||||
bool mNonRealtimeMode;
|
||||
int mFrameRate;
|
||||
std::map<unsigned int, ViewWidget *> mViewWidgets;
|
||||
QPointer<CtrlMainWindow> m_pMainWindow;
|
||||
|
||||
dtEntity::EntityManager* mEntityManager;
|
||||
ViewerCallback* mViewerCallback;
|
||||
LogHandler* mLogHandler = nullptr;
|
||||
dtEntity::MapSystem* mMapSystem;
|
||||
PlayerSystem* mPlayerSystem;
|
||||
BuildingManager* mBuildingManager;
|
||||
|
||||
ViewWidget *GetViewWidget(unsigned int contextid);
|
||||
void storeWidget(ViewWidget *pWidget, const std::string &strBuildingNameID, unsigned int contextid, VCtrl::ViewMode vmode, VCtrl::PlayerDisplayMode displayMode);
|
||||
float mTimeScale;
|
||||
double mSimTime;
|
||||
bool mPaused;
|
||||
bool mNonRealtimeMode;
|
||||
int mFrameRate;
|
||||
std::map<unsigned int, ViewWidget*> mViewWidgets;
|
||||
|
||||
ViewWidget* GetViewWidget(unsigned int contextid);
|
||||
void storeWidget(ViewWidget* pWidget, const std::string& strBuildingNameID, unsigned int contextid,
|
||||
VCtrl::ViewMode vmode, VCtrl::PlayerDisplayMode displayMode);
|
||||
|
||||
const std::size_t m_maxParallelViewWidgets = 8;
|
||||
|
||||
unsigned int m_hitlineDuration_s = 10;
|
||||
double m_desiredTransparencyValue = 0.75;
|
||||
bool m_showHitLines = true;
|
||||
ViewWidget *CreateMainWindowView(dtEntity::EntityId bid, const std::string &featureId, unsigned int &contextid, bool exactPos);
|
||||
const std::size_t m_maxParallelViewWidgets = 8;
|
||||
|
||||
unsigned int m_hitlineDuration_s = 10;
|
||||
double m_desiredTransparencyValue = 0.75;
|
||||
bool m_showHitLines = true;
|
||||
ViewWidget* CreateMainWindowView(dtEntity::EntityId bid, const std::string& featureId, unsigned int& contextid,
|
||||
bool exactPos);
|
||||
|
||||
std::unordered_map<std::string, BuildingData> m_loadedBuildings;
|
||||
std::unordered_map<std::string, BuildingData> m_loadedBuildings;
|
||||
|
||||
ViewWidgetContainer m_openedViewWidgets;
|
||||
bool m_isInFullscreenMode = false;
|
||||
ViewWidgetContainer m_openedViewWidgets;
|
||||
bool m_isInFullscreenMode = false;
|
||||
|
||||
|
||||
ViewMode m_desiredViewMode = ViewMode::ORTHOGRAPHIC;
|
||||
VCtrl::PlayerDisplayMode m_desiredPlayerDisplayMode = VCtrl::PlayerDisplayMode::Icons;
|
||||
ViewMode m_desiredViewMode = ViewMode::ORTHOGRAPHIC;
|
||||
VCtrl::PlayerDisplayMode m_desiredPlayerDisplayMode = VCtrl::PlayerDisplayMode::Icons;
|
||||
|
||||
void CloseView(ViewWidget *pWidget);
|
||||
void CloseView(ViewWidget* pWidget);
|
||||
|
||||
void onExcRestoreViewState(const std::string &strFeatureID);
|
||||
void restoreViewWidgetStates(const std::vector<BuildingViewer::ViewWidgetState> &vecStates);
|
||||
void restoreViewWidgetStateDeferred(ViewWidget *pViewWidget);
|
||||
std::unordered_map<std::string, BuildingViewer::ViewWidgetState> m_deferredViewStates;
|
||||
void onExcRestoreViewState(const std::string& strFeatureID);
|
||||
void restoreViewWidgetStates(const std::vector<BuildingViewer::ViewWidgetState>& vecStates);
|
||||
void restoreViewWidgetStateDeferred(ViewWidget* pViewWidget);
|
||||
std::unordered_map<std::string, BuildingViewer::ViewWidgetState> m_deferredViewStates;
|
||||
|
||||
QJsonValue getViewState() const override;
|
||||
void setViewState(const QJsonValue &val) override;
|
||||
void highlightView(const std::string &buildingId) override;
|
||||
void setBuildingDisplayName(const std::string &buildingId, const std::string &displayName) override;
|
||||
|
||||
QJsonValue getViewState() const override;
|
||||
void setViewState(const QJsonValue& val) override;
|
||||
void highlightView(const std::string& buildingId) override;
|
||||
void setBuildingDisplayName(const std::string& buildingId, const std::string& displayName) override;
|
||||
|
||||
private slots:
|
||||
void onViewWidget_MaximizeRequest(ViewWidget *pWidget);
|
||||
void onViewWidget_MinimizeRequest(ViewWidget *pWidget);
|
||||
void onViewWidget_CloseRequest(ViewWidget *pWidget);
|
||||
void onViewWidget_FocusRequest(ViewWidget *pWidget);
|
||||
void onViewWidget_Zoom(ViewWidget *pWidget, bool zoomIn);
|
||||
private slots:
|
||||
void onViewWidget_MaximizeRequest(ViewWidget* pWidget);
|
||||
void onViewWidget_MinimizeRequest(ViewWidget* pWidget);
|
||||
void onViewWidget_CloseRequest(ViewWidget* pWidget);
|
||||
void onViewWidget_FocusRequest(ViewWidget* pWidget);
|
||||
void onViewWidget_Zoom(ViewWidget* pWidget, bool zoomIn);
|
||||
};
|
||||
}
|
||||
} // namespace VCtrl
|
||||
Executable → Regular
+376
-418
File diff suppressed because it is too large.
Load diff
Executable → Regular
+109
-119
@@ -1,29 +1,25 @@
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
#include <string>
|
||||
#include "BgViewer/viewerCtrl/viewerinterface.h"
|
||||
#include "bdv_helper.h"
|
||||
#include "buildingviewercommon_export.h"
|
||||
#include "logger.h"
|
||||
|
||||
#include <BuildingViewer/share/exccommands.h>
|
||||
#include <InfrastructureManagement/Shared/ism_mounting_point.h>
|
||||
#include <LtsUtilsCore/qpoint3d.h>
|
||||
#include <ParticipantManagement/ppm_data_plugin_interface.h>
|
||||
#include <QByteArray>
|
||||
#include <QHash>
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
#include <QVector3D>
|
||||
|
||||
#include "logger.h"
|
||||
#include "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>
|
||||
|
||||
#include <QVector>
|
||||
#include <string>
|
||||
|
||||
namespace VCtrl
|
||||
{
|
||||
@@ -34,130 +30,124 @@ namespace BuildingViewer
|
||||
{
|
||||
struct DeviceInfo
|
||||
{
|
||||
QString deviceName;
|
||||
int buildingId = 0;
|
||||
QString deviceName;
|
||||
int buildingId = 0;
|
||||
|
||||
DeviceInfo() = default;
|
||||
DeviceInfo(int _buildingId, const QString &_deviceName)
|
||||
: deviceName(_deviceName)
|
||||
, buildingId(_buildingId)
|
||||
{}
|
||||
DeviceInfo() = default;
|
||||
|
||||
DeviceInfo(int _buildingId, const QString& _deviceName) : deviceName(_deviceName), buildingId(_buildingId) {}
|
||||
};
|
||||
|
||||
|
||||
|
||||
class BUILDINGVIEWERCOMMON_EXPORT CommunicationInterfaceInternal final : public QObject, public VCtrl::ViewerCallback
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CommunicationInterfaceInternal(VCtrl::ViewerInterface* pviewerInterface);
|
||||
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 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 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 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);
|
||||
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);
|
||||
|
||||
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;
|
||||
|
||||
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);
|
||||
|
||||
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 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);
|
||||
|
||||
void signalViewerEventRoomNameClicked(const QString &featureID, const QString &roomID);
|
||||
void signalViewerZoomChanged(const QString &featureId, double top, double left, double bottom, double right);
|
||||
private:
|
||||
NGL::INGLLogger& m_logger;
|
||||
void clearCameras();
|
||||
QHash<QString, DeviceInfo> m_deviceMap;
|
||||
|
||||
private:
|
||||
|
||||
struct BdvParty
|
||||
{
|
||||
QString name;
|
||||
VCtrl::Color color;
|
||||
int id = 0;
|
||||
};
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
void clearCameras();
|
||||
QHash<QString, DeviceInfo> m_deviceMap;
|
||||
QHash<int, BdvParty> m_teamMap;
|
||||
|
||||
|
||||
struct BdvParty
|
||||
{
|
||||
QString name;
|
||||
VCtrl::Color color;
|
||||
int id = 0;
|
||||
};
|
||||
QHash<int, BdvParty> m_teamMap;
|
||||
QHash<int, int> m_player2TeamMap;
|
||||
QHash<int, std::string> m_playerId2String;
|
||||
QMap<std::string, int> m_string2PlayerId;
|
||||
|
||||
|
||||
QHash<int, int> m_player2TeamMap;
|
||||
QHash<int, std::string> m_playerId2String;
|
||||
QMap<std::string, int> m_string2PlayerId;
|
||||
|
||||
VCtrl::ViewerInterface *m_pviewerInterface = nullptr;
|
||||
bool m_useExactPositioning = true;
|
||||
VCtrl::ViewerInterface* m_pviewerInterface = nullptr;
|
||||
bool m_useExactPositioning = true;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace BuildingViewer
|
||||
Executable → Regular
+241
-271
@@ -1,430 +1,400 @@
|
||||
|
||||
|
||||
|
||||
#include "bdv_controller.h"
|
||||
#include <utility>
|
||||
#include "bdv_dds_controller.h"
|
||||
#include "bdv_bgviewer_widget_container.h"
|
||||
|
||||
#include "bdv_bgviewer_widget_container.h"
|
||||
#include "bdv_dds_controller.h"
|
||||
|
||||
#include <Common/bdv_communication_interface_internal.h>
|
||||
#include <Common/bdv_plugin_provider.h>
|
||||
#include <LtsAppManager/lts_app_manager.h>
|
||||
#include <LtsPluginManager/lts_plugin_manager.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <Common/bdv_communication_interface_internal.h>
|
||||
#include <Common/bdv_plugin_provider.h>
|
||||
#include <ngltools/ngltools_filesystem.h>
|
||||
|
||||
#include <QDir>
|
||||
#include <QMessageBox>
|
||||
#include <ngltools/ngltools_filesystem.h>
|
||||
#include <utility>
|
||||
|
||||
namespace BuildingViewer
|
||||
{
|
||||
static int argc_dummy = 1;
|
||||
static char *argv_dummy[] = { (char*)"Dummy" };
|
||||
static char* argv_dummy[] = {(char*)"Dummy"};
|
||||
|
||||
BgViewerController::BgViewerController(QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_mainloop(argc_dummy, argv_dummy, nullptr)
|
||||
, m_widgetStolen(false)
|
||||
, m_comIfc(nullptr)
|
||||
, m_pBgViewerDDSController(nullptr)
|
||||
, m_bgvApp(nullptr)
|
||||
, m_tickTimer(new QTimer(this))
|
||||
BgViewerController::BgViewerController(QObject* parent)
|
||||
: QObject(parent), m_mainloop(argc_dummy, argv_dummy, nullptr), m_widgetStolen(false), m_comIfc(nullptr),
|
||||
m_pBgViewerDDSController(nullptr), m_bgvApp(nullptr), m_tickTimer(new QTimer(this))
|
||||
{
|
||||
m_tickTimer->setInterval(1000 / 25);
|
||||
connect(m_tickTimer, &QTimer::timeout, this, [this]() { m_mainloop.tick(); });
|
||||
m_tickTimer->setInterval(1000 / 25);
|
||||
connect(m_tickTimer, &QTimer::timeout, this, [this]() { m_mainloop.tick(); });
|
||||
|
||||
m_mainloop.getViewerInterface()->getMainWindow()->setMinimumSize(200, 200);
|
||||
m_mainloop.getViewerInterface()->getMainWindow()->setMinimumSize(200, 200);
|
||||
|
||||
m_viewerInterface = m_mainloop.getViewerInterface();
|
||||
m_comIfc = new CommunicationInterfaceInternal(m_viewerInterface);
|
||||
m_viewerInterface->SetViewerCallback(m_comIfc);
|
||||
m_viewerInterface = m_mainloop.getViewerInterface();
|
||||
m_comIfc = new CommunicationInterfaceInternal(m_viewerInterface);
|
||||
m_viewerInterface->SetViewerCallback(m_comIfc);
|
||||
|
||||
m_pBgViewerDDSController = new BuildingViewerDdsController(m_comIfc, m_viewerInterface);
|
||||
m_pBgViewerDDSController = new BuildingViewerDdsController(m_comIfc, m_viewerInterface);
|
||||
|
||||
connect(m_pBgViewerDDSController, &BuildingViewerDdsController::signalDdsInitFinished, this, [this]() {
|
||||
m_initExerciseWasSuccessful = true;
|
||||
});
|
||||
|
||||
connect(m_comIfc, &CommunicationInterfaceInternal::signalBgViewerInitFinished,
|
||||
this, &BgViewerController::signalBgViewerInitFinished);
|
||||
connect(m_comIfc, &CommunicationInterfaceInternal::signalReceivedBuildingList,
|
||||
this, &BgViewerController::signalReceivedBuildingList);
|
||||
connect(m_comIfc, &CommunicationInterfaceInternal::signalReceivedViewState,
|
||||
this, &BgViewerController::signalReceivedViewState);
|
||||
connect(m_comIfc, &CommunicationInterfaceInternal::signalPlayerPicked,
|
||||
this, &BgViewerController::signalPlayerPicked);
|
||||
connect(m_comIfc, &CommunicationInterfaceInternal::signalAssetPicked,
|
||||
this, &BgViewerController::signalAssetPicked);
|
||||
connect(m_comIfc, &CommunicationInterfaceInternal::signalViewerEventWidgetClosed,
|
||||
this, &BgViewerController::signalViewerEventWidgetClosed);
|
||||
connect(m_comIfc, &CommunicationInterfaceInternal::signalViewerEventWidgetMaximized,
|
||||
this, &BgViewerController::signalViewerEventWidgetMaximized);
|
||||
connect(m_comIfc, &CommunicationInterfaceInternal::signalViewerEventWidgetMinimized,
|
||||
this, &BgViewerController::signalViewerEventWidgetMinimized);
|
||||
connect(m_comIfc, &CommunicationInterfaceInternal::signalViewerEventWidgetFocused,
|
||||
this, &BgViewerController::signalViewerEventWidgetFocused);
|
||||
connect(m_comIfc, &CommunicationInterfaceInternal::signalViewerEventRoomNameClicked,
|
||||
this, &BgViewerController::signalViewerEventRoomNameClicked);
|
||||
connect(m_comIfc, &CommunicationInterfaceInternal::signalViewerZoomChanged,
|
||||
this, &BgViewerController::signalViewerZoomChanged);
|
||||
connect(m_comIfc, &CommunicationInterfaceInternal::signalViewerEventButton,
|
||||
this, &BgViewerController::signalViewerEventButton);
|
||||
connect(m_pBgViewerDDSController, &BuildingViewerDdsController::signalDdsInitFinished, this,
|
||||
[this]() { m_initExerciseWasSuccessful = true; });
|
||||
|
||||
connect(m_comIfc, &CommunicationInterfaceInternal::signalBgViewerInitFinished, this,
|
||||
&BgViewerController::signalBgViewerInitFinished);
|
||||
connect(m_comIfc, &CommunicationInterfaceInternal::signalReceivedBuildingList, this,
|
||||
&BgViewerController::signalReceivedBuildingList);
|
||||
connect(m_comIfc, &CommunicationInterfaceInternal::signalReceivedViewState, this,
|
||||
&BgViewerController::signalReceivedViewState);
|
||||
connect(m_comIfc, &CommunicationInterfaceInternal::signalPlayerPicked, this,
|
||||
&BgViewerController::signalPlayerPicked);
|
||||
connect(m_comIfc, &CommunicationInterfaceInternal::signalAssetPicked, this, &BgViewerController::signalAssetPicked);
|
||||
connect(m_comIfc, &CommunicationInterfaceInternal::signalViewerEventWidgetClosed, this,
|
||||
&BgViewerController::signalViewerEventWidgetClosed);
|
||||
connect(m_comIfc, &CommunicationInterfaceInternal::signalViewerEventWidgetMaximized, this,
|
||||
&BgViewerController::signalViewerEventWidgetMaximized);
|
||||
connect(m_comIfc, &CommunicationInterfaceInternal::signalViewerEventWidgetMinimized, this,
|
||||
&BgViewerController::signalViewerEventWidgetMinimized);
|
||||
connect(m_comIfc, &CommunicationInterfaceInternal::signalViewerEventWidgetFocused, this,
|
||||
&BgViewerController::signalViewerEventWidgetFocused);
|
||||
connect(m_comIfc, &CommunicationInterfaceInternal::signalViewerEventRoomNameClicked, this,
|
||||
&BgViewerController::signalViewerEventRoomNameClicked);
|
||||
connect(m_comIfc, &CommunicationInterfaceInternal::signalViewerZoomChanged, this,
|
||||
&BgViewerController::signalViewerZoomChanged);
|
||||
connect(m_comIfc, &CommunicationInterfaceInternal::signalViewerEventButton, this,
|
||||
&BgViewerController::signalViewerEventButton);
|
||||
}
|
||||
|
||||
|
||||
BgViewerController::~BgViewerController()
|
||||
{
|
||||
delete m_tickTimer;
|
||||
delete m_tickTimer;
|
||||
|
||||
if (m_bgvApp != nullptr)
|
||||
{
|
||||
m_bgvApp->disconnect();
|
||||
delete m_bgvApp;
|
||||
}
|
||||
if (m_bgvApp != nullptr)
|
||||
{
|
||||
m_bgvApp->disconnect();
|
||||
delete m_bgvApp;
|
||||
}
|
||||
|
||||
delete m_pBgViewerDDSController;
|
||||
delete m_comIfc;
|
||||
delete m_pBgViewerDDSController;
|
||||
delete m_comIfc;
|
||||
|
||||
m_bgvApp = nullptr;
|
||||
m_comIfc = nullptr;
|
||||
m_pBgViewerDDSController = nullptr;
|
||||
m_bgvApp = nullptr;
|
||||
m_comIfc = nullptr;
|
||||
m_pBgViewerDDSController = nullptr;
|
||||
}
|
||||
|
||||
|
||||
void BgViewerController::excConnect(const std::vector<std::string> &paths, const QString &strXMLFile)
|
||||
void BgViewerController::excConnect(const std::vector<std::string>& paths, const QString& strXMLFile)
|
||||
{
|
||||
if (m_comIfc)
|
||||
m_comIfc->excConnect(paths, strXMLFile);
|
||||
if (m_comIfc)
|
||||
m_comIfc->excConnect(paths, strXMLFile);
|
||||
}
|
||||
|
||||
void BgViewerController::excGetBuildingList()
|
||||
{
|
||||
if (m_comIfc)
|
||||
m_comIfc->excGetBuildingList();
|
||||
if (m_comIfc)
|
||||
m_comIfc->excGetBuildingList();
|
||||
}
|
||||
|
||||
void BgViewerController::excGetViewState()
|
||||
{
|
||||
if (m_comIfc)
|
||||
m_comIfc->excGetViewState();
|
||||
if (m_comIfc)
|
||||
m_comIfc->excGetViewState();
|
||||
}
|
||||
|
||||
void BgViewerController::excHighlightView(const QString &strFeatureID)
|
||||
void BgViewerController::excHighlightView(const QString& strFeatureID)
|
||||
{
|
||||
if (m_comIfc)
|
||||
m_comIfc->excHighlightView(strFeatureID);
|
||||
if (m_comIfc)
|
||||
m_comIfc->excHighlightView(strFeatureID);
|
||||
}
|
||||
|
||||
void BgViewerController::excRestoreViewState(const QJsonValue &state)
|
||||
void BgViewerController::excRestoreViewState(const QJsonValue& state)
|
||||
{
|
||||
if (m_comIfc)
|
||||
{
|
||||
m_comIfc->excRestoreViewState(state);
|
||||
m_comIfc->excGetBuildingList();
|
||||
}
|
||||
if (m_comIfc)
|
||||
{
|
||||
m_comIfc->excRestoreViewState(state);
|
||||
m_comIfc->excGetBuildingList();
|
||||
}
|
||||
}
|
||||
|
||||
void BgViewerController::excSetGlobalDotsMode(bool useDots)
|
||||
{
|
||||
if (m_comIfc)
|
||||
m_comIfc->excSetGlobalDotsMode(useDots);
|
||||
if (m_comIfc)
|
||||
m_comIfc->excSetGlobalDotsMode(useDots);
|
||||
}
|
||||
|
||||
void BgViewerController::excSetGlobalTransparency(double transparency)
|
||||
{
|
||||
if (m_comIfc)
|
||||
m_comIfc->excSetGlobalTransparency(transparency);
|
||||
if (m_comIfc)
|
||||
m_comIfc->excSetGlobalTransparency(transparency);
|
||||
}
|
||||
|
||||
void BgViewerController::excSetGlobalViewMode(bool useOrtho)
|
||||
{
|
||||
if (m_comIfc)
|
||||
m_comIfc->excSetGlobalViewMode(useOrtho);
|
||||
if (m_comIfc)
|
||||
m_comIfc->excSetGlobalViewMode(useOrtho);
|
||||
}
|
||||
|
||||
void BgViewerController::excSetHitlineDuration(uint32_t duration_s)
|
||||
{
|
||||
if (m_comIfc)
|
||||
m_comIfc->excSetHitlineDuration(duration_s);
|
||||
if (m_comIfc)
|
||||
m_comIfc->excSetHitlineDuration(duration_s);
|
||||
}
|
||||
|
||||
void BgViewerController::excStartRecording(const QString &strPathOutputFolder,
|
||||
const QString &strFeatureID,
|
||||
int w, int h, int framerate, int quality)
|
||||
void BgViewerController::excStartRecording(const QString& strPathOutputFolder, const QString& strFeatureID, int w,
|
||||
int h, int framerate, int quality)
|
||||
{
|
||||
if (m_comIfc)
|
||||
m_comIfc->excStartRecording(strPathOutputFolder, strFeatureID, w, h, framerate, quality);
|
||||
if (m_comIfc)
|
||||
m_comIfc->excStartRecording(strPathOutputFolder, strFeatureID, w, h, framerate, quality);
|
||||
}
|
||||
|
||||
void BgViewerController::excStopRecording(const QString &strFeatureID)
|
||||
void BgViewerController::excStopRecording(const QString& strFeatureID)
|
||||
{
|
||||
if (m_comIfc)
|
||||
m_comIfc->excStopRecording(strFeatureID);
|
||||
if (m_comIfc)
|
||||
m_comIfc->excStopRecording(strFeatureID);
|
||||
}
|
||||
|
||||
QString BgViewerController::buildingModelPath()
|
||||
{
|
||||
QVector<QString> directoriesToSearch = NGL::directories(NGL::FileType::ConfigFile);
|
||||
QVector<QString> directoriesToSearch = NGL::directories(NGL::FileType::ConfigFile);
|
||||
#ifndef WIN32
|
||||
directoriesToSearch += QStringLiteral("/opt");
|
||||
directoriesToSearch += QStringLiteral("/opt");
|
||||
#endif
|
||||
|
||||
for (const QString &d : std::as_const(directoriesToSearch))
|
||||
{
|
||||
const QDir dir(d + QStringLiteral("/BuildingModels/StaticMeshes/"));
|
||||
if (dir.exists() && dir.isReadable())
|
||||
return dir.absolutePath();
|
||||
INFO_LOG(getLogger("BgViewerController")) << "Map path '" << dir.absolutePath() << "' either does not exist or is not readable - skipping";
|
||||
}
|
||||
return QString();
|
||||
for (const QString& d : std::as_const(directoriesToSearch))
|
||||
{
|
||||
const QDir dir(d + QStringLiteral("/BuildingModels/StaticMeshes/"));
|
||||
if (dir.exists() && dir.isReadable())
|
||||
return dir.absolutePath();
|
||||
INFO_LOG(getLogger("BgViewerController"))
|
||||
<< "Map path '" << dir.absolutePath() << "' either does not exist or is not readable - skipping";
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
||||
void BgViewerController::clearInterfaces(const LtsSession::DdsConnectionParams &conParams)
|
||||
void BgViewerController::clearInterfaces(const LtsSession::DdsConnectionParams& conParams)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "BgViewerControllerSingleton::clearInterfaces()";
|
||||
if (m_pBgViewerDDSController && m_currentDdsConnParams == conParams)
|
||||
{
|
||||
m_pBgViewerDDSController->uninitialize();
|
||||
m_currentDdsConnParams = LtsSession::DdsConnectionParams();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BgViewerController::hideLiveVideo()
|
||||
{
|
||||
|
||||
|
||||
|
||||
DEBUG_LOG(m_logger) << "BgViewerControllerSingleton::clearInterfaces()";
|
||||
if (m_pBgViewerDDSController && m_currentDdsConnParams == conParams)
|
||||
{
|
||||
m_pBgViewerDDSController->uninitialize();
|
||||
m_currentDdsConnParams = LtsSession::DdsConnectionParams();
|
||||
}
|
||||
}
|
||||
|
||||
void BgViewerController::hideLiveVideo() {}
|
||||
|
||||
bool BgViewerController::isBgViewerApplicationRunning() const
|
||||
{
|
||||
return (m_bgvApp != nullptr);
|
||||
return (m_bgvApp != nullptr);
|
||||
}
|
||||
|
||||
|
||||
LtsSession::DdsConnectionParams BgViewerController::currentDdsConnParams() const
|
||||
{
|
||||
return m_currentDdsConnParams;
|
||||
return m_currentDdsConnParams;
|
||||
}
|
||||
|
||||
|
||||
PluginProvider *BgViewerController::activeSession() const
|
||||
PluginProvider* BgViewerController::activeSession() const
|
||||
{
|
||||
return m_pBgViewerDDSController->activeSession();
|
||||
return m_pBgViewerDDSController->activeSession();
|
||||
}
|
||||
|
||||
|
||||
bool BgViewerController::init(PluginProvider *pSession, bool bStartRendering, const QString &modelPath)
|
||||
bool BgViewerController::init(PluginProvider* pSession, bool bStartRendering, const QString& modelPath)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "getDdsController init: " << pSession->toString();
|
||||
DEBUG_LOG(m_logger) << "getDdsController init: " << pSession->toString();
|
||||
|
||||
if (m_currentDdsConnParams == pSession->connParams())
|
||||
{
|
||||
if (m_initExerciseWasSuccessful)
|
||||
if (m_currentDdsConnParams == pSession->connParams())
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "BgViewerControllerSingleton::init Already initialized";
|
||||
slotLoadBuilding();
|
||||
if (m_initExerciseWasSuccessful)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "BgViewerControllerSingleton::init Already initialized";
|
||||
slotLoadBuilding();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
m_currentDdsConnParams = pSession->connParams();
|
||||
m_initExerciseWasSuccessful = false;
|
||||
if (!m_pBgViewerDDSController->init(m_bgViewerBaseLayoutWidget, modelPath, pSession))
|
||||
return false;
|
||||
if (bStartRendering)
|
||||
{
|
||||
m_bgvAppIsInitialized = true;
|
||||
m_tickTimer->start();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
m_currentDdsConnParams = pSession->connParams();
|
||||
m_initExerciseWasSuccessful = false;
|
||||
if (!m_pBgViewerDDSController->init(m_bgViewerBaseLayoutWidget, modelPath, pSession))
|
||||
return false;
|
||||
if (bStartRendering)
|
||||
{
|
||||
m_bgvAppIsInitialized = true;
|
||||
m_tickTimer->start();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool BgViewerController::forceInit(PluginProvider *pSession)
|
||||
bool BgViewerController::forceInit(PluginProvider* pSession)
|
||||
{
|
||||
delete m_pBgViewerDDSController;
|
||||
m_pBgViewerDDSController = new BuildingViewerDdsController(m_comIfc, m_viewerInterface);
|
||||
|
||||
DEBUG_LOG(m_logger) << "FORCE INIT! with " << pSession;
|
||||
return (m_pBgViewerDDSController->init(m_bgViewerBaseLayoutWidget, buildingModelPath(), pSession));
|
||||
delete m_pBgViewerDDSController;
|
||||
m_pBgViewerDDSController = new BuildingViewerDdsController(m_comIfc, m_viewerInterface);
|
||||
|
||||
DEBUG_LOG(m_logger) << "FORCE INIT! with " << pSession;
|
||||
return (m_pBgViewerDDSController->init(m_bgViewerBaseLayoutWidget, buildingModelPath(), pSession));
|
||||
}
|
||||
|
||||
void BgViewerController::showBgViewerInfoMessageBox()
|
||||
{
|
||||
static bool showMsgBox = true;
|
||||
static bool showMsgBox = true;
|
||||
|
||||
if (!showMsgBox)
|
||||
return;
|
||||
if (!showMsgBox)
|
||||
return;
|
||||
|
||||
QMessageBox msgbox;
|
||||
msgbox.setText(tr("BuildingViewer is currently used by another application.\nPlease close the corresponding application."));
|
||||
msgbox.setIcon(QMessageBox::Information);
|
||||
msgbox.addButton(QMessageBox::Ok);
|
||||
QMessageBox msgbox;
|
||||
msgbox.setText(
|
||||
tr("BuildingViewer is currently used by another application.\nPlease close the corresponding application."));
|
||||
msgbox.setIcon(QMessageBox::Information);
|
||||
msgbox.addButton(QMessageBox::Ok);
|
||||
|
||||
QCheckBox *cb = new QCheckBox(tr("Do not show this message again."));
|
||||
msgbox.setCheckBox(cb);
|
||||
QCheckBox* cb = new QCheckBox(tr("Do not show this message again."));
|
||||
msgbox.setCheckBox(cb);
|
||||
|
||||
connect(cb, &QCheckBox::stateChanged, [](int state) {
|
||||
showMsgBox = state != Qt::Checked;
|
||||
});
|
||||
connect(cb, &QCheckBox::stateChanged, [](int state) { showMsgBox = state != Qt::Checked; });
|
||||
|
||||
msgbox.exec();
|
||||
msgbox.exec();
|
||||
}
|
||||
|
||||
|
||||
bool BgViewerController::startBgViewerAppInSession(PluginProvider* pStartingSession)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << std::hex << this << " startBgViewerAppInSession " << (m_currentDdsConnParams == pStartingSession->connParams());
|
||||
DEBUG_LOG(m_logger) << std::hex << this << " startBgViewerAppInSession "
|
||||
<< (m_currentDdsConnParams == pStartingSession->connParams());
|
||||
|
||||
if (m_bgvApp && (m_currentDdsConnParams == pStartingSession->connParams()))
|
||||
{
|
||||
INFO_LOG(m_logger) << std::hex << this << " BuildingViewer already opened. Doing nothing...";
|
||||
return true;
|
||||
}
|
||||
if (m_bgvApp && (m_currentDdsConnParams == pStartingSession->connParams()))
|
||||
{
|
||||
INFO_LOG(m_logger) << std::hex << this << " BuildingViewer already opened. Doing nothing...";
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if (!m_bgvApp && m_widgetStolen)
|
||||
{
|
||||
showBgViewerInfoMessageBox();
|
||||
return false;
|
||||
}
|
||||
if (!m_bgvApp && m_widgetStolen)
|
||||
{
|
||||
showBgViewerInfoMessageBox();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_bgvApp)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << std::hex << this << " Releasing m_bgvApp";
|
||||
delete m_bgvApp;
|
||||
m_bgvApp = nullptr;
|
||||
|
||||
clearInterfaces(m_currentDdsConnParams);
|
||||
m_comIfc->excCloseAllViews();
|
||||
}
|
||||
|
||||
m_bgvAppIsInitialized = false;
|
||||
m_bgvApp = LtsAppManager::LtsAppManager::getInstance()->createApp(LtsAppDescriptor::App::BuildingViewer, pStartingSession->connParams());
|
||||
if (!m_bgvApp || !m_bgvApp->sessions().size())
|
||||
{
|
||||
ERROR_LOG(m_logger) << std::hex << this << " m_bgvApp is nullptr or has no associated session!";
|
||||
return false;
|
||||
}
|
||||
|
||||
connect(m_bgvApp, &LtsPluginManager::LtsPluginManager::signalInitializationFinished,
|
||||
this, [this, pStartingSession]()
|
||||
{
|
||||
m_tickTimer->start();
|
||||
m_bgvAppIsInitialized = true;
|
||||
|
||||
QWidget *w = nullptr;
|
||||
if (m_bgvApp)
|
||||
{
|
||||
LtsSession::LtsSession *session = m_bgvApp->getSession(pStartingSession->connParams().partitionType, pStartingSession->connParams().partitionId);
|
||||
w = session->baseLayoutWidget();
|
||||
DEBUG_LOG(m_logger) << std::hex << this << " Releasing m_bgvApp";
|
||||
delete m_bgvApp;
|
||||
m_bgvApp = nullptr;
|
||||
|
||||
clearInterfaces(m_currentDdsConnParams);
|
||||
m_comIfc->excCloseAllViews();
|
||||
}
|
||||
m_bgViewerBaseLayoutWidget = w;
|
||||
|
||||
slotLoadBuilding();
|
||||
emit bgvAppIsInitialized();
|
||||
});
|
||||
|
||||
connect(m_bgvApp, &LtsPluginManager::LtsPluginManager::destroyed,
|
||||
this, [this]()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << std::hex << this << " LtsPluginManager destroyed m_bgvApp";
|
||||
m_tickTimer->stop();
|
||||
clearInterfaces(m_currentDdsConnParams);
|
||||
m_comIfc->excCloseAllViews();
|
||||
m_bgvAppIsInitialized = false;
|
||||
m_bgvApp = nullptr;
|
||||
m_bgViewerBaseLayoutWidget = nullptr;
|
||||
});
|
||||
m_bgvApp = LtsAppManager::LtsAppManager::getInstance()->createApp(LtsAppDescriptor::App::BuildingViewer,
|
||||
pStartingSession->connParams());
|
||||
if (!m_bgvApp || !m_bgvApp->sessions().size())
|
||||
{
|
||||
ERROR_LOG(m_logger) << std::hex << this << " m_bgvApp is nullptr or has no associated session!";
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
connect(m_bgvApp, &LtsPluginManager::LtsPluginManager::signalInitializationFinished, this,
|
||||
[this, pStartingSession]() {
|
||||
m_tickTimer->start();
|
||||
m_bgvAppIsInitialized = true;
|
||||
|
||||
QWidget* w = nullptr;
|
||||
if (m_bgvApp)
|
||||
{
|
||||
LtsSession::LtsSession* session = m_bgvApp->getSession(pStartingSession->connParams().partitionType,
|
||||
pStartingSession->connParams().partitionId);
|
||||
w = session->baseLayoutWidget();
|
||||
}
|
||||
m_bgViewerBaseLayoutWidget = w;
|
||||
|
||||
slotLoadBuilding();
|
||||
emit bgvAppIsInitialized();
|
||||
});
|
||||
|
||||
connect(m_bgvApp, &LtsPluginManager::LtsPluginManager::destroyed, this, [this]() {
|
||||
DEBUG_LOG(m_logger) << std::hex << this << " LtsPluginManager destroyed m_bgvApp";
|
||||
m_tickTimer->stop();
|
||||
clearInterfaces(m_currentDdsConnParams);
|
||||
m_comIfc->excCloseAllViews();
|
||||
m_bgvAppIsInitialized = false;
|
||||
m_bgvApp = nullptr;
|
||||
m_bgViewerBaseLayoutWidget = nullptr;
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
QWidget *BgViewerController::getBgViewerWidget()
|
||||
QWidget* BgViewerController::getBgViewerWidget()
|
||||
{
|
||||
if (m_widgetStolen)
|
||||
{
|
||||
showBgViewerInfoMessageBox();
|
||||
return nullptr;
|
||||
}
|
||||
if (m_widgetStolen)
|
||||
{
|
||||
showBgViewerInfoMessageBox();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
BgViewerWidgetContainer *pDummy = new BgViewerWidgetContainer(m_mainloop.getViewerInterface()->getMainWindow());
|
||||
BgViewerWidgetContainer* pDummy = new BgViewerWidgetContainer(m_mainloop.getViewerInterface()->getMainWindow());
|
||||
|
||||
m_widgetStolen = true;
|
||||
connect(pDummy, &BgViewerWidgetContainer::signalWidgetReleased, this, &BgViewerController::slotWidgetReleased);
|
||||
return pDummy;
|
||||
m_widgetStolen = true;
|
||||
connect(pDummy, &BgViewerWidgetContainer::signalWidgetReleased, this, &BgViewerController::slotWidgetReleased);
|
||||
return pDummy;
|
||||
}
|
||||
|
||||
void BgViewerController::slotWidgetReleased()
|
||||
{
|
||||
m_widgetStolen = false;
|
||||
m_widgetStolen = false;
|
||||
}
|
||||
|
||||
void BgViewerController::openBuilding(const QString &strBuildingFeatureId)
|
||||
void BgViewerController::openBuilding(const QString& strBuildingFeatureId)
|
||||
{
|
||||
m_buildingsToShow.push_back(strBuildingFeatureId.toStdString());
|
||||
slotLoadBuilding();
|
||||
m_buildingsToShow.push_back(strBuildingFeatureId.toStdString());
|
||||
slotLoadBuilding();
|
||||
}
|
||||
|
||||
void BgViewerController::closeBuilding(const QString &strBuildingFeatureId)
|
||||
void BgViewerController::closeBuilding(const QString& strBuildingFeatureId)
|
||||
{
|
||||
if (!strBuildingFeatureId.isEmpty())
|
||||
{
|
||||
const std::string s = strBuildingFeatureId.toStdString();
|
||||
m_buildingsToShow.erase(std::remove_if(m_buildingsToShow.begin(), m_buildingsToShow.end(),
|
||||
[s](const std::string &str) { return s == str;}), m_buildingsToShow.end());
|
||||
}
|
||||
else
|
||||
m_buildingsToShow.clear();
|
||||
|
||||
if (m_comIfc)
|
||||
{
|
||||
if (strBuildingFeatureId.isEmpty())
|
||||
m_comIfc->excCloseAllViews();
|
||||
if (!strBuildingFeatureId.isEmpty())
|
||||
{
|
||||
const std::string s = strBuildingFeatureId.toStdString();
|
||||
m_buildingsToShow.erase(std::remove_if(m_buildingsToShow.begin(), m_buildingsToShow.end(),
|
||||
[s](const std::string& str) { return s == str; }),
|
||||
m_buildingsToShow.end());
|
||||
}
|
||||
else
|
||||
m_comIfc->excCloseView({strBuildingFeatureId.toStdString()});
|
||||
m_comIfc->excGetBuildingList();
|
||||
}
|
||||
m_buildingsToShow.clear();
|
||||
|
||||
if (m_comIfc)
|
||||
{
|
||||
if (strBuildingFeatureId.isEmpty())
|
||||
m_comIfc->excCloseAllViews();
|
||||
else
|
||||
m_comIfc->excCloseView({strBuildingFeatureId.toStdString()});
|
||||
m_comIfc->excGetBuildingList();
|
||||
}
|
||||
}
|
||||
|
||||
void BgViewerController::updatePlayerSymbols(int size)
|
||||
{
|
||||
m_pBgViewerDDSController->updatePlayerSymbols(size);
|
||||
m_pBgViewerDDSController->updatePlayerSymbols(size);
|
||||
}
|
||||
|
||||
void BgViewerController::closeAll()
|
||||
{
|
||||
m_bgvApp->deleteLater();
|
||||
m_bgvApp->deleteLater();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void BgViewerController::slotLoadBuilding()
|
||||
{
|
||||
if (!m_bgvAppIsInitialized)
|
||||
return;
|
||||
m_comIfc->excOpenView(m_buildingsToShow);
|
||||
m_comIfc->excGetBuildingList();
|
||||
m_buildingsToShow.clear();
|
||||
if (!m_bgvAppIsInitialized)
|
||||
return;
|
||||
m_comIfc->excOpenView(m_buildingsToShow);
|
||||
m_comIfc->excGetBuildingList();
|
||||
m_buildingsToShow.clear();
|
||||
}
|
||||
|
||||
void BgViewerController::slotStartRecording(const QString &strFolderPath, const QJsonValue &state)
|
||||
void BgViewerController::slotStartRecording(const QString& strFolderPath, const QJsonValue& state)
|
||||
{
|
||||
excRestoreViewState(state);
|
||||
excStartRecording(strFolderPath, QStringLiteral("all"), 800, 600, 15, 40);
|
||||
excRestoreViewState(state);
|
||||
excStartRecording(strFolderPath, QStringLiteral("all"), 800, 600, 15, 40);
|
||||
}
|
||||
|
||||
void BgViewerController::slotStopRecording()
|
||||
{
|
||||
excStopRecording();
|
||||
excStopRecording();
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace BuildingViewer
|
||||
Executable → Regular
+83
-89
@@ -1,30 +1,27 @@
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
#include <QObject>
|
||||
#include <QTimer>
|
||||
#include <QString>
|
||||
|
||||
#include "buildingviewercommon_export.h"
|
||||
#include <BuildingViewer/share/exccommands.h>
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <LtsSession/lts_session_data_dds.h>
|
||||
#include <memory>
|
||||
#include "logger.h"
|
||||
#include "bdv_helper.h"
|
||||
#include "BgViewer/viewerCtrl/mainloop.h"
|
||||
#include "bdv_helper.h"
|
||||
#include "buildingviewercommon_export.h"
|
||||
#include "logger.h"
|
||||
|
||||
#include <BuildingViewer/share/exccommands.h>
|
||||
#include <LtsSession/lts_session_data_dds.h>
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QTimer>
|
||||
#include <memory>
|
||||
|
||||
class QWidget;
|
||||
|
||||
namespace LtsPluginManager
|
||||
{
|
||||
class LtsPluginManager;
|
||||
}
|
||||
|
||||
|
||||
|
||||
namespace BuildingViewer
|
||||
{
|
||||
class CommunicationInterfaceInternal;
|
||||
@@ -33,96 +30,93 @@ class PluginProvider;
|
||||
|
||||
class BUILDINGVIEWERCOMMON_EXPORT BgViewerController : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit BgViewerController(QObject *parent = nullptr);
|
||||
~BgViewerController();
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit BgViewerController(QObject* parent = nullptr);
|
||||
~BgViewerController();
|
||||
|
||||
void clearInterfaces(const LtsSession::DdsConnectionParams &conParams);
|
||||
void clearInterfaces(const LtsSession::DdsConnectionParams& conParams);
|
||||
|
||||
bool isBgViewerApplicationRunning() const;
|
||||
LtsSession::DdsConnectionParams currentDdsConnParams() const;
|
||||
bool isBgViewerApplicationRunning() const;
|
||||
LtsSession::DdsConnectionParams currentDdsConnParams() const;
|
||||
|
||||
bool startBgViewerAppInSession(PluginProvider *pStartingSession);
|
||||
void openBuilding(const QString &strBuildingFeatureId);
|
||||
void closeBuilding(const QString &strBuildingFeatureId = QString());
|
||||
bool forceInit(PluginProvider *pSession);
|
||||
void updatePlayerSymbols(int size);
|
||||
void closeAll();
|
||||
|
||||
QWidget *getBgViewerWidget();
|
||||
bool init(PluginProvider *pSession, bool bStartRendering = false, const QString &modelPath = buildingModelPath());
|
||||
PluginProvider *activeSession() const;
|
||||
bool startBgViewerAppInSession(PluginProvider* pStartingSession);
|
||||
void openBuilding(const QString& strBuildingFeatureId);
|
||||
void closeBuilding(const QString& strBuildingFeatureId = QString());
|
||||
bool forceInit(PluginProvider* pSession);
|
||||
void updatePlayerSymbols(int size);
|
||||
void closeAll();
|
||||
|
||||
|
||||
void excConnect(const std::vector<std::string> &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"));
|
||||
QWidget* getBgViewerWidget();
|
||||
bool init(PluginProvider* pSession, bool bStartRendering = false, const QString& modelPath = buildingModelPath());
|
||||
PluginProvider* activeSession() const;
|
||||
|
||||
static QString buildingModelPath();
|
||||
void excConnect(const std::vector<std::string>& 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"));
|
||||
|
||||
LtsPluginManager::LtsPluginManager *app() { return m_bgvApp; }
|
||||
static QString buildingModelPath();
|
||||
|
||||
Q_SIGNALS:
|
||||
void bgvAppIsInitialized();
|
||||
LtsPluginManager::LtsPluginManager* app()
|
||||
{
|
||||
return m_bgvApp;
|
||||
}
|
||||
|
||||
|
||||
void signalBgViewerInitFinished();
|
||||
void signalReceivedBuildingList(const QVector<BuildingTuple> &list);
|
||||
void signalReceivedViewState(const QJsonValue &state);
|
||||
Q_SIGNALS:
|
||||
void bgvAppIsInitialized();
|
||||
|
||||
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);
|
||||
void signalBgViewerInitFinished();
|
||||
void signalReceivedBuildingList(const QVector<BuildingTuple>& list);
|
||||
void signalReceivedViewState(const QJsonValue& state);
|
||||
|
||||
public slots:
|
||||
void slotStartRecording(const QString &strFolderPath, const QJsonValue &state);
|
||||
void slotStopRecording();
|
||||
void hideLiveVideo();
|
||||
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);
|
||||
|
||||
private slots:
|
||||
void slotLoadBuilding();
|
||||
void slotWidgetReleased();
|
||||
public slots:
|
||||
void slotStartRecording(const QString& strFolderPath, const QJsonValue& state);
|
||||
void slotStopRecording();
|
||||
void hideLiveVideo();
|
||||
|
||||
private:
|
||||
private slots:
|
||||
void slotLoadBuilding();
|
||||
void slotWidgetReleased();
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
void showBgViewerInfoMessageBox();
|
||||
private:
|
||||
NGL::INGLLogger& m_logger;
|
||||
void showBgViewerInfoMessageBox();
|
||||
|
||||
private:
|
||||
VCtrl::MainLoop m_mainloop;
|
||||
bool m_widgetStolen;
|
||||
private:
|
||||
VCtrl::MainLoop m_mainloop;
|
||||
bool m_widgetStolen;
|
||||
|
||||
std::vector<std::string> m_buildingsToShow;
|
||||
CommunicationInterfaceInternal *m_comIfc{nullptr};
|
||||
VCtrl::ViewerInterface *m_viewerInterface{nullptr};
|
||||
BuildingViewerDdsController *m_pBgViewerDDSController;
|
||||
std::vector<std::string> 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_initExerciseWasSuccessful{false};
|
||||
LtsSession::DdsConnectionParams m_currentDdsConnParams;
|
||||
LtsPluginManager::LtsPluginManager* m_bgvApp;
|
||||
|
||||
bool m_bgvAppIsInitialized{false};
|
||||
bool m_bgvAppIsInitialized{false};
|
||||
|
||||
QTimer *m_tickTimer{nullptr};
|
||||
QWidget *m_bgViewerBaseLayoutWidget{nullptr};
|
||||
QTimer* m_tickTimer{nullptr};
|
||||
QWidget* m_bgViewerBaseLayoutWidget{nullptr};
|
||||
};
|
||||
}
|
||||
|
||||
} // namespace BuildingViewer
|
||||
Executable → Regular
+1282
-1363
File diff suppressed because it is too large.
Load diff
Executable → Regular
+146
-139
@@ -1,34 +1,30 @@
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
#include <NGLLogger/INGLLogger.h>
|
||||
#include "buildingviewercommon_export.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QTimer>
|
||||
#include <QHash>
|
||||
#include <QVector>
|
||||
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
#include <AdvancedSymbology/asb_data_plugin_interface.h>
|
||||
#include <BuildingViewer/share/exccommands.h>
|
||||
#include <LtsCoordTrans/lts_coord_trans.h>
|
||||
#include <LtsUtils/LtsUtilsGui/LtsUtilsGuiDds/request_helper.h>
|
||||
#include <LtsUtilsCore/qpoint3d.h>
|
||||
#include <NGLLogger/INGLLogger.h>
|
||||
#include <ParticipantManagement/ppm_data_plugin_interface.h>
|
||||
#include <ParticipantManagement/ppm_participant_info_gui_plugin_interface.h>
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
#include <Plugins/AreaEffectSimulation/aes_data_plugin_interface.h>
|
||||
#include <Plugins/AudioVideoManagement/avm_data_plugin_interface.h>
|
||||
#include <Plugins/Buildings/bld_data_plugin_interface.h>
|
||||
#include <Plugins/SituationReplay/srp_data_plugin_interface.h>
|
||||
#include <Plugins/Buildings/bld_info_gui_plugin_interface.h>
|
||||
#include <ParticipantManagement/ppm_data_plugin_interface.h>
|
||||
#include <Plugins/ProjectDataManagement/pdm_data_plugin_interface.h>
|
||||
#include <ParticipantManagement/ppm_participant_info_gui_plugin_interface.h>
|
||||
#include <Plugins/InfrastructureManagement/ism_data_plugin_interface.h>
|
||||
#include <Plugins/ProjectDataManagement/pdm_data_plugin_interface.h>
|
||||
#include <Plugins/SituationReplay/srp_data_plugin_interface.h>
|
||||
#include <LtsCoordTrans/lts_coord_trans.h>
|
||||
#include <LtsUtilsCore/qpoint3d.h>
|
||||
#include "buildingviewercommon_export.h"
|
||||
#include <BuildingViewer/share/exccommands.h>
|
||||
#include <LtsUtils/LtsUtilsGui/LtsUtilsGuiDds/request_helper.h>
|
||||
#include <viewerinterface.h>
|
||||
|
||||
#include <QHash>
|
||||
#include <QObject>
|
||||
#include <QTimer>
|
||||
#include <QVector>
|
||||
#include <functional>
|
||||
#include <viewerinterface.h>
|
||||
|
||||
namespace BuildingViewer
|
||||
{
|
||||
@@ -37,141 +33,152 @@ class PluginProvider;
|
||||
|
||||
class BuildingViewerDdsController : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit BuildingViewerDdsController(CommunicationInterfaceInternal *connection,
|
||||
VCtrl::ViewerInterface* viewerInterface);
|
||||
~BuildingViewerDdsController();
|
||||
bool init(QWidget *irreplacableWidget, const QString &modelPath, PluginProvider *session);
|
||||
void uninitialize();
|
||||
public:
|
||||
explicit BuildingViewerDdsController(CommunicationInterfaceInternal* connection,
|
||||
VCtrl::ViewerInterface* viewerInterface);
|
||||
~BuildingViewerDdsController();
|
||||
bool init(QWidget* irreplacableWidget, const QString& modelPath, PluginProvider* session);
|
||||
void uninitialize();
|
||||
|
||||
void updatePlayerSymbols(const int sizeL, const int forParty = -1);
|
||||
void updatePlayerSymbols(const int sizeL, const int forParty = -1);
|
||||
|
||||
void clearAssets();
|
||||
PluginProvider *activeSession() const { return m_session; }
|
||||
void clearAssets();
|
||||
|
||||
signals:
|
||||
void signalDdsInitFinished();
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void setCurrentTrainingAreaMap(const QString &modelPath);
|
||||
private slots:
|
||||
void onPartyChanged(const ParticipantManagement::Party &party, DataModification modType);
|
||||
void onBgViewerInitFinished();
|
||||
void onFireEventFlashTimer();
|
||||
void onSynchronizeSimulationTime();
|
||||
void onBoobyTrapChanged(const AreaEffectSimulation::BoobyTrap &boobyTrap, DataModification modType);
|
||||
void onParticipantChanged(const ParticipantManagement::Participant &participant, DataModification modType);
|
||||
void onDynParticipantChanged(const ParticipantManagement::DynamicParticipantData &data, DataModification modType);
|
||||
void onPositionChanged(const ParticipantManagement::ParticipantPosition &position, DataModification modType);
|
||||
void onHitLineInfoChanged(const ParticipantManagement::HitLineInfo &hli, DataModification modType);
|
||||
void onParticipantGearEventChanged(const ParticipantManagement::ParticipantGearEvent &data, DataModification modType);
|
||||
PluginProvider* activeSession() const
|
||||
{
|
||||
return m_session;
|
||||
}
|
||||
|
||||
void onPlayerPicked(int playerId);
|
||||
void onAssetPicked(int structureElementId);
|
||||
void onMountingPointChanged(const InfrastructureManagement::MountingPoint &data, DataModification modType);
|
||||
void onBuildingStateChanged(const Buildings::BuildingState &data, DataModification modType);
|
||||
void onCleanupBuildingHitlines();
|
||||
void onBuildingHitLineInfoChanged(const Buildings::BuildingHitLineInfo &hli, DataModification modType);
|
||||
void onMainStructureElementChanged(const InfrastructureManagement::MainStructureElement &mse, DataModification modType);
|
||||
signals:
|
||||
void signalDdsInitFinished();
|
||||
|
||||
private:
|
||||
QPointF toRelativePosition(const Core::GeoPosition &geoPos) const;
|
||||
LtsUtils::QPoint3D toRelative3D(const Core::GeoPosition &geoPos) const;
|
||||
bool clear();
|
||||
bool syncTeams();
|
||||
bool setPaused(bool bPaused);
|
||||
bool isOutdatedPosition(qint64 sampleTime) const;
|
||||
inline bool isOutdatedPosition(const ParticipantManagement::ParticipantPosition &position) const
|
||||
{
|
||||
return position.participantId() <= 0 || isOutdatedPosition(position.sampleTime());
|
||||
}
|
||||
private:
|
||||
NGL::INGLLogger& m_logger;
|
||||
void setCurrentTrainingAreaMap(const QString& modelPath);
|
||||
private slots:
|
||||
void onPartyChanged(const ParticipantManagement::Party& party, DataModification modType);
|
||||
void onBgViewerInitFinished();
|
||||
void onFireEventFlashTimer();
|
||||
void onSynchronizeSimulationTime();
|
||||
void onBoobyTrapChanged(const AreaEffectSimulation::BoobyTrap& boobyTrap, DataModification modType);
|
||||
void onParticipantChanged(const ParticipantManagement::Participant& participant, DataModification modType);
|
||||
void onDynParticipantChanged(const ParticipantManagement::DynamicParticipantData& data, DataModification modType);
|
||||
void onPositionChanged(const ParticipantManagement::ParticipantPosition& position, DataModification modType);
|
||||
void onHitLineInfoChanged(const ParticipantManagement::HitLineInfo& hli, DataModification modType);
|
||||
void onParticipantGearEventChanged(const ParticipantManagement::ParticipantGearEvent& data,
|
||||
DataModification modType);
|
||||
|
||||
bool calcBaseCoordinate(const QMap<qint32, InfrastructureManagement::MainStructureElement> &mseMap);
|
||||
void sendAssets();
|
||||
void handleMountingPoint(const InfrastructureManagement::MountingPoint &mp, DataModification modType);
|
||||
void onReplayChanged(const SituationReplay::SitReplay &srp, DataModification modType);
|
||||
void effectGenerationUnitPicked(int structureElementId);
|
||||
QHash<int, BuildingViewer::AssetTypes> m_mountingPointId2AssetType;
|
||||
QHash<int, QString> m_knownAssetsInBgViewer;
|
||||
void onPlayerPicked(int playerId);
|
||||
void onAssetPicked(int structureElementId);
|
||||
void onMountingPointChanged(const InfrastructureManagement::MountingPoint& data, DataModification modType);
|
||||
void onBuildingStateChanged(const Buildings::BuildingState& data, DataModification modType);
|
||||
void onCleanupBuildingHitlines();
|
||||
void onBuildingHitLineInfoChanged(const Buildings::BuildingHitLineInfo& hli, DataModification modType);
|
||||
void onMainStructureElementChanged(const InfrastructureManagement::MainStructureElement& mse,
|
||||
DataModification modType);
|
||||
|
||||
void createBoobyTraps();
|
||||
void createParticipants();
|
||||
bool isValidParticipant(const ParticipantManagement::Participant &participant) const;
|
||||
void createParticipant(const ParticipantManagement::Participant &participant, const ParticipantManagement::ParticipantPosition &position, int sizeL);
|
||||
void createBoobyTrap(const AreaEffectSimulation::BoobyTrap &trap, int sizeL);
|
||||
void deleteParticipant(int participantId);
|
||||
void updateBuildingRoomNames(const InfrastructureManagement::MainStructureElement& building);
|
||||
bool writeBuildingDataToXML(const QString &modelPath);
|
||||
QString getBuildingConfigurationXml() const;
|
||||
private:
|
||||
QPointF toRelativePosition(const Core::GeoPosition& geoPos) const;
|
||||
LtsUtils::QPoint3D toRelative3D(const Core::GeoPosition& geoPos) const;
|
||||
bool clear();
|
||||
bool syncTeams();
|
||||
bool setPaused(bool bPaused);
|
||||
bool isOutdatedPosition(qint64 sampleTime) const;
|
||||
|
||||
static QString buildPlayerSymbolFilePath(int playerID, int postfix = 0);
|
||||
inline bool isOutdatedPosition(const ParticipantManagement::ParticipantPosition& position) const
|
||||
{
|
||||
return position.participantId() <= 0 || isOutdatedPosition(position.sampleTime());
|
||||
}
|
||||
|
||||
struct SymbolInfo
|
||||
{
|
||||
QString strPathToSymbolFile;
|
||||
QColor color;
|
||||
int participantId = -1;
|
||||
bool useThisSymbolNow = false;
|
||||
};
|
||||
bool calcBaseCoordinate(const QMap<qint32, InfrastructureManagement::MainStructureElement>& mseMap);
|
||||
void sendAssets();
|
||||
void handleMountingPoint(const InfrastructureManagement::MountingPoint& mp, DataModification modType);
|
||||
void onReplayChanged(const SituationReplay::SitReplay& srp, DataModification modType);
|
||||
void effectGenerationUnitPicked(int structureElementId);
|
||||
QHash<int, BuildingViewer::AssetTypes> m_mountingPointId2AssetType;
|
||||
QHash<int, QString> m_knownAssetsInBgViewer;
|
||||
|
||||
void createBoobyTraps();
|
||||
void createParticipants();
|
||||
bool isValidParticipant(const ParticipantManagement::Participant& participant) const;
|
||||
void createParticipant(const ParticipantManagement::Participant& participant,
|
||||
const ParticipantManagement::ParticipantPosition& position, int sizeL);
|
||||
void createBoobyTrap(const AreaEffectSimulation::BoobyTrap& trap, int sizeL);
|
||||
void deleteParticipant(int participantId);
|
||||
void updateBuildingRoomNames(const InfrastructureManagement::MainStructureElement& building);
|
||||
bool writeBuildingDataToXML(const QString& modelPath);
|
||||
QString getBuildingConfigurationXml() const;
|
||||
|
||||
QHash<int, qint64> m_participantGearEvents;
|
||||
QHash<int, qint64> m_lastPositionTime;
|
||||
struct BuildingHit
|
||||
{
|
||||
int32_t id = 0;
|
||||
int64_t sampleTime = 0;
|
||||
int originatorParticipantId = 0;
|
||||
int chargeTypeId = 0;
|
||||
};
|
||||
QHash<int, QVector<BuildingHit>> m_buildingHits;
|
||||
QVector<int> m_knownBuildings;
|
||||
inline bool isBuildingKnown(int id) const
|
||||
{
|
||||
return std::find(m_knownBuildings.cbegin(), m_knownBuildings.cend(), id) != m_knownBuildings.cend();
|
||||
}
|
||||
static QString buildPlayerSymbolFilePath(int playerID, int postfix = 0);
|
||||
|
||||
const int cColorSymbolId = 0;
|
||||
const QVector<QColor> m_vecFlashColors = {QColor(), Qt::white, Qt::gray};
|
||||
void createPlayerSymbols(const ParticipantManagement::Participant &participant, const int sizeL);
|
||||
void createSymbolResultWatcher(const ParticipantManagement::Participant &participant, const SymbolInfo &symbolInfo, const int sizeL);
|
||||
QHash<AdvancedSymbology::SymbolResultWatcher *, SymbolInfo> m_mapActiveSymbolResultWatcher;
|
||||
void reCheckHitLine();
|
||||
QString getSessionInfo() const;
|
||||
PluginProvider *m_session = nullptr;
|
||||
int m_exerciseId = -1;
|
||||
std::shared_ptr<AudioVideoManagement::ForeignDataInterface> m_avmIfc;
|
||||
std::shared_ptr<AdvancedSymbology::ForeignDataInterface> m_asbIfc;
|
||||
std::shared_ptr<AreaEffectSimulation::Interface::Dtc> m_aesDtc;
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
|
||||
std::shared_ptr<ProjectDataManagement::Interface::Dtc> m_pdmDtc;
|
||||
std::shared_ptr<ParticipantManagement::ForeignParticipantInfoGuiInterface> m_ppmGuiIfc;
|
||||
std::shared_ptr<InfrastructureManagement::Interface::Dtc> m_ismDtc;
|
||||
std::shared_ptr<InfrastructureManagement::ForeignDataInterface> m_ismIfc;
|
||||
std::shared_ptr<Buildings::Interface::Dtc> m_bldDtc;
|
||||
std::shared_ptr<SituationReplay::Interface::Dtc> m_srpDtc;
|
||||
std::shared_ptr<Buildings::ForeignInfoGuiInterface> m_blgGuiIfc;
|
||||
struct SymbolInfo
|
||||
{
|
||||
QString strPathToSymbolFile;
|
||||
QColor color;
|
||||
int participantId = -1;
|
||||
bool useThisSymbolNow = false;
|
||||
};
|
||||
|
||||
void stopAndClearTimer();
|
||||
QTimer *m_pSimTimeSyncTimer = nullptr;
|
||||
QTimer *m_pFireEventFlashTimer = nullptr;
|
||||
QTimer *m_pBuildingHitlineCleanupTimer = nullptr;
|
||||
bool m_ddsInitFinished = false;
|
||||
int m_dtc_timeout_ms = 10000;
|
||||
int m_hitlineDuration_ms = 10 * 1000;
|
||||
|
||||
QHash<int, qint64> m_participantGearEvents;
|
||||
QHash<int, qint64> m_lastPositionTime;
|
||||
|
||||
int m_bgviewer_simSyncTimeInterval_ms = 3000;
|
||||
struct BuildingHit
|
||||
{
|
||||
int32_t id = 0;
|
||||
int64_t sampleTime = 0;
|
||||
int originatorParticipantId = 0;
|
||||
int chargeTypeId = 0;
|
||||
};
|
||||
|
||||
QHash<int, QHash<int, int>> m_roomId2RoomNumber;
|
||||
CommunicationInterfaceInternal *m_connection{nullptr};
|
||||
VCtrl::ViewerInterface* m_viewerInterface{nullptr};
|
||||
QTimer *m_reCheckTimer{nullptr};
|
||||
LtsCoordTrans::UtmCoordinate m_baseCoordinate;
|
||||
QHash < int32_t, double > m_buildingHeight;
|
||||
QWidget *m_irreplacableWidget {nullptr};
|
||||
QHash<int, QVector<BuildingHit>> m_buildingHits;
|
||||
QVector<int> m_knownBuildings;
|
||||
|
||||
inline bool isBuildingKnown(int id) const
|
||||
{
|
||||
return std::find(m_knownBuildings.cbegin(), m_knownBuildings.cend(), id) != m_knownBuildings.cend();
|
||||
}
|
||||
|
||||
const int cColorSymbolId = 0;
|
||||
const QVector<QColor> m_vecFlashColors = {QColor(), Qt::white, Qt::gray};
|
||||
void createPlayerSymbols(const ParticipantManagement::Participant& participant, const int sizeL);
|
||||
void createSymbolResultWatcher(const ParticipantManagement::Participant& participant, const SymbolInfo& symbolInfo,
|
||||
const int sizeL);
|
||||
QHash<AdvancedSymbology::SymbolResultWatcher*, SymbolInfo> m_mapActiveSymbolResultWatcher;
|
||||
void reCheckHitLine();
|
||||
QString getSessionInfo() const;
|
||||
PluginProvider* m_session = nullptr;
|
||||
int m_exerciseId = -1;
|
||||
std::shared_ptr<AudioVideoManagement::ForeignDataInterface> m_avmIfc;
|
||||
std::shared_ptr<AdvancedSymbology::ForeignDataInterface> m_asbIfc;
|
||||
std::shared_ptr<AreaEffectSimulation::Interface::Dtc> m_aesDtc;
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
|
||||
std::shared_ptr<ProjectDataManagement::Interface::Dtc> m_pdmDtc;
|
||||
std::shared_ptr<ParticipantManagement::ForeignParticipantInfoGuiInterface> m_ppmGuiIfc;
|
||||
std::shared_ptr<InfrastructureManagement::Interface::Dtc> m_ismDtc;
|
||||
std::shared_ptr<InfrastructureManagement::ForeignDataInterface> m_ismIfc;
|
||||
std::shared_ptr<Buildings::Interface::Dtc> m_bldDtc;
|
||||
std::shared_ptr<SituationReplay::Interface::Dtc> m_srpDtc;
|
||||
std::shared_ptr<Buildings::ForeignInfoGuiInterface> m_blgGuiIfc;
|
||||
|
||||
void stopAndClearTimer();
|
||||
QTimer* m_pSimTimeSyncTimer = nullptr;
|
||||
QTimer* m_pFireEventFlashTimer = nullptr;
|
||||
QTimer* m_pBuildingHitlineCleanupTimer = nullptr;
|
||||
bool m_ddsInitFinished = false;
|
||||
int m_dtc_timeout_ms = 10000;
|
||||
int m_hitlineDuration_ms = 10 * 1000;
|
||||
|
||||
int m_bgviewer_simSyncTimeInterval_ms = 3000;
|
||||
|
||||
QHash<int, QHash<int, int>> m_roomId2RoomNumber;
|
||||
CommunicationInterfaceInternal* m_connection{nullptr};
|
||||
VCtrl::ViewerInterface* m_viewerInterface{nullptr};
|
||||
QTimer* m_reCheckTimer{nullptr};
|
||||
LtsCoordTrans::UtmCoordinate m_baseCoordinate;
|
||||
QHash<int32_t, double> m_buildingHeight;
|
||||
QWidget* m_irreplacableWidget{nullptr};
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace BuildingViewer
|
||||
Reference in new issue
Block a user