/** *@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 // DDS #include #include #include #include #include // Qt #include #include 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 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 m_participantToPartyMapping; // QMap m_participantToFloorMapping; // QMap, int /* participant count */> m_floorPartyParticipantCount; // QMap > m_floorToPartyMapping; // needed to have something to iterate better than the mess that m_floorPartyParticipantCount is QMap m_floorNames; QMap m_rowToFloorId; // Key = row Value = floorId; QMap m_floorIdToRow; // Key = floorId Value = row; QMap m_roomToFloorCache; QMap m_roomStructureElementCache; QMap > m_rawParticipantCount; std::shared_ptr m_cesDtc; std::shared_ptr m_aesDtc; std::shared_ptr m_ppmDtc; std::shared_ptr m_pdmDtc; }; } // namespace Buildings