/** * @RDE_HEADER@ * ISM Test Import XML * $Id$ * $HeadURL$ * $Author$ * Created by Iuliana Ojog, SLSE, 2016-11-28 */ #pragma once #include #include #include #include #include //---------------------------------------------------------------------------------------------- namespace InfrastructureManagement { class IsmImportBuildings : public QObject , protected InfrastructureManagement::Interface::Ftc::MainStructureElementModifyReplyHandler , protected InfrastructureManagement::Interface::Ftc::MainStructureElementRemoveReplyHandler , protected InfrastructureManagement::Interface::Ftc::MountingPointAssetRemoveReplyHandler , protected InfrastructureManagement::Interface::Ftc::MountingPointAssetModifyReplyHandler , protected InfrastructureManagement::Interface::Ftc::MountingPointPlanModifyReplyHandler , protected InfrastructureManagement::Interface::Ftc::StructureElementModifyReplyHandler { Q_OBJECT public: struct ImportData { QString xmlFileName; QString vulFileName; QString egcuToRoomFileName; QString soundAreaFileName; Core::GeoPosition geoPos; double angleDegree = 0; int exerciseId = 0; int externalWlsId = 0; int buildingId = -1; int bauabschnitt = -1; }; explicit IsmImportBuildings(QObject *parent = nullptr); bool init(int domainId, const QUrl &tcpDiscoveryUrl); void import(const ImportData &importData); void import(const QVector &importData); void remove(const QVector &ids); Q_SIGNALS: void importDone(); void removeDone(); protected Q_SLOTS: void doImport(); void importNext(); protected: void onMainStructureElementModifyReply(const Core::FunctionReplyObject &replyObject) override final; void onMainStructureElementRemoveReply(const Core::FunctionReplyObject &replyObject) override final; void onMountingPointPlanModifyReply(const Core::FunctionReplyObject &reply) override final; void onMountingPointAssetModifyReply(const Core::FunctionReplyObject &reply) override final; void onMountingPointAssetRemoveReply(const Core::FunctionReplyObject &reply) override final; void onStructureElementModifyReply(const Core::FunctionReplyObject &reply) override final; bool handleReply(const Core::FunctionReplyObject &replyObject); private: void removeNext(); void remove(int buildingId); void doRemove(int buildingId); MainStructureElement mainStructureElementByName(const std::string &name) const; QHash > MountingPointPlanByScheduleOfStructureElements(const QVector &structureElementIds) const; QVector mountingsOfStructureElements(const QVector &structureElementIds) const; QVector pathWithNames(const StructureElement &structureElement, const MainStructureElement &mainStructureElement) const; std::string structureElementNameById(qint32 id, const std::vector &structureElements) const; StructureElement structureElementById(qint32 id, const MainStructureElement &mainStructureElement) const; void createNewMainStructureElement(const MainStructureElementModifyRequest &request); void restoreData(const MainStructureElement &oldMainStructureElement, const QMap>&oldNamePaths, const QVector& mountings, const QHash > &mountingPointPlansBySchedule); void unmountAssetsOfBuliding(qint32 buildingId); std::shared_ptr m_ddsConnector; std::shared_ptr m_dtc; std::shared_ptr m_ftc; QVector m_idsToBeRemoved; QVector m_importData; ImportData m_currentData; int m_curImportIdx; bool m_hasOneRemoved = true; bool m_isInRestoringMode = false; LOGGER_T m_logger; }; } // namespace InfrastructureManagement