144 lines
4.5 KiB
C++
Executable File
144 lines
4.5 KiB
C++
Executable File
/**
|
|
*@RDE_HEADER@
|
|
* GUI Plugin for Building- Info
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by hjl, SLSE, 2017-04-05
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "info_dialog_base.h"
|
|
#include <CentralEffectSimulation/ces.hpp>
|
|
|
|
// DDS
|
|
#include <InfrastructureManagement/ism.hpp>
|
|
#include <CentralEffectSimulation/ces.hpp>
|
|
#include <Buildings/bld.hpp>
|
|
#include <LtsUtilsCore/data_modification_enum.h>
|
|
#include <ParticipantManagement/ppm_data_plugin_interface.h>
|
|
|
|
// Qt
|
|
#include <QMap>
|
|
#include <QPair>
|
|
|
|
|
|
namespace Ui
|
|
{
|
|
class BldInfoDialog;
|
|
}
|
|
namespace CentralEffectSimulation
|
|
{
|
|
namespace Interface
|
|
{
|
|
class Dtc;
|
|
}
|
|
}
|
|
namespace AreaEffectSimulation
|
|
{
|
|
namespace Interface
|
|
{
|
|
class Dtc;
|
|
}
|
|
}
|
|
namespace ParticipantManagement
|
|
{
|
|
namespace Interface
|
|
{
|
|
class Dtc;
|
|
}
|
|
}
|
|
namespace ProjectDataManagement
|
|
{
|
|
namespace Interface
|
|
{
|
|
class Dtc;
|
|
}
|
|
}
|
|
|
|
namespace Buildings
|
|
{
|
|
constexpr int ICON_RESOLUTION = 64;
|
|
|
|
// --------------------------------------------------------
|
|
// BuildingInfoDialog
|
|
// --------------------------------------------------------
|
|
class BldInfoDialog : public InfoDialogBase
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit BldInfoDialog(int bldEntityId, const QString &menuGroup, QWidget *parent = nullptr);
|
|
~BldInfoDialog();
|
|
|
|
bool init(LtsSession::LtsSession *session) override;
|
|
|
|
private:
|
|
template <typename ReturnType, typename Container, typename Key>
|
|
static ReturnType constFinder(const Container &container, const Key &key) noexcept(false)
|
|
{
|
|
auto it = container.constFind(key);
|
|
|
|
if (it == container.constEnd())
|
|
throw QStringLiteral("constFinder: cannot find '%1' in container").arg(keyToString(key));
|
|
|
|
return it.value();
|
|
}
|
|
|
|
void retranslate() override;
|
|
void showBuildingInfos() override;
|
|
void showBuildingInfos(const Buildings::BuildingState &bldState);
|
|
void fillOwnership(int buildingId);
|
|
void fillOwnership(const CentralEffectSimulation::BuildingOwnership &ownership);
|
|
void clearColumn(int column);
|
|
void fillContaminationTable(const Buildings::BuildingState &bldState);
|
|
QString buildingDisplayName() const override;
|
|
bool egcuVisibility();
|
|
|
|
// FloorParticipantCount stuff:
|
|
void updateFloorParticipantTable();
|
|
bool getRoom(int roomSeId, InfrastructureManagement::StructureElement &roomSe);
|
|
QString getFloorName(int floorSeId);
|
|
int findFloorIdByRoomId(int roomId) noexcept(false);
|
|
|
|
private slots:
|
|
void onBuildingStateChanged(const Buildings::BuildingState &data, const DataModification &modType);
|
|
void onBuildingOwnershipChanged(const CentralEffectSimulation::BuildingOwnership &data,
|
|
const DataModification &modType);
|
|
void onMainStructureElementChanged(const InfrastructureManagement::MainStructureElement &data,
|
|
const DataModification &modType);
|
|
void onMountingPointAssetChanged(const InfrastructureManagement::MountingPointAsset &data,
|
|
const DataModification &modType);
|
|
void onOpenHistory();
|
|
void onEgcuInfoDialogRequested();
|
|
|
|
// FloorParticipantCount stuff:
|
|
void onPositionChanged(const ParticipantManagement::ParticipantPosition &data, DataModification modType);
|
|
void addParticipantPosition(const ParticipantManagement::ParticipantPosition &data, DataModification modType);
|
|
|
|
private:
|
|
Ui::BldInfoDialog *m_ui;
|
|
InfrastructureManagement::MainStructureElement m_mse;
|
|
|
|
// FloorParticipantCount stuff:
|
|
// QMap<int /* participant */, int /* party */> m_participantToPartyMapping;
|
|
// QMap<int /* participant */, int /* floor */> m_participantToFloorMapping;
|
|
// QMap<QPair<int /* floor */, int /* party */>, int /* participant count */> m_floorPartyParticipantCount;
|
|
// QMap<int /* floor */, QVector<int /* party */> > m_floorToPartyMapping; // needed to have something to iterate better than the mess that m_floorPartyParticipantCount is
|
|
|
|
QMap<int /* floor's sei */, QString /* floor name */> m_floorNames;
|
|
QMap<int, int> m_rowToFloorId; // Key = row Value = floorId;
|
|
QMap<int, int> m_floorIdToRow; // Key = floorId Value = row;
|
|
QMap<int /* room */, int /* floor */> m_roomToFloorCache;
|
|
QMap<int /* room */, InfrastructureManagement::StructureElement /* se */> m_roomStructureElementCache;
|
|
QMap<int /* participant */, QPair<int /* floor */, int /* party */> > m_rawParticipantCount;
|
|
|
|
std::shared_ptr<CentralEffectSimulation::Interface::Dtc> m_cesDtc;
|
|
std::shared_ptr<AreaEffectSimulation::Interface::Dtc> m_aesDtc;
|
|
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
|
|
std::shared_ptr<ProjectDataManagement::Interface::Dtc> m_pdmDtc;
|
|
|
|
};
|
|
} // namespace Buildings
|