Files
qt5-legatus-legacy/Lts/Services/InfrastructureManagement/ImportBuildings/ism_import_buildings.h
T
2026-08-13 18:33:10 +02:00

100 lines
4.1 KiB
C++
Executable File

/**
* @RDE_HEADER@
* ISM Test Import XML
* $Id$
* $HeadURL$
* $Author$
* Created by Iuliana Ojog, SLSE, 2016-11-28
*/
#pragma once
#include <InfrastructureManagement/ism_ftc.h>
#include <InfrastructureManagement/ism_dtc.h>
#include <DDS/DDSConnector/dds_connector.h>
#include <InfrastructureManagement/logger.h>
#include <QVector>
//----------------------------------------------------------------------------------------------
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> &importData);
void remove(const QVector<int> &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</* scheduleId */ int, std::vector<MountingPointPlan> > MountingPointPlanByScheduleOfStructureElements(const QVector<qint32> &structureElementIds) const;
QVector<MountingPointAsset> mountingsOfStructureElements(const QVector<qint32> &structureElementIds) const;
QVector<std::string> pathWithNames(const StructureElement &structureElement, const MainStructureElement &mainStructureElement) const;
std::string structureElementNameById(qint32 id, const std::vector<StructureElement> &structureElements) const;
StructureElement structureElementById(qint32 id, const MainStructureElement &mainStructureElement) const;
void createNewMainStructureElement(const MainStructureElementModifyRequest &request);
void restoreData(const MainStructureElement &oldMainStructureElement,
const QMap<qint32, QVector<std::string>>&oldNamePaths,
const QVector<MountingPointAsset>& mountings,
const QHash<int, std::vector<MountingPointPlan> > &mountingPointPlansBySchedule);
void unmountAssetsOfBuliding(qint32 buildingId);
std::shared_ptr<DDSConnector::DdsConnector> m_ddsConnector;
std::shared_ptr<InfrastructureManagement::Interface::Dtc> m_dtc;
std::shared_ptr<InfrastructureManagement::Interface::Ftc> m_ftc;
QVector<int> m_idsToBeRemoved;
QVector<ImportData> m_importData;
ImportData m_currentData;
int m_curImportIdx;
bool m_hasOneRemoved = true;
bool m_isInRestoringMode = false;
LOGGER_T m_logger;
};
} // namespace InfrastructureManagement