/** * @RDE_HEADER@ * ISM Object Main Structure Element * $Id$ * $HeadURL$ * $Author$ * Created by Iuliana Ojog, SLSE, 2016-11-26 */ #pragma once #include #include #include "base.h" #include #include //------------------------------------------------------------------------------------------------------------- namespace InfrastructureManagement { class MainHandler; class ObjectStructureElement; class ObjectMainStructureElement : public Base { Q_OBJECT public: explicit ObjectMainStructureElement(MainHandler *mainHandler); ObjectMainStructureElement(const Database::IsmMainStructureElement &dbData, MainHandler *mainHandler); ~ObjectMainStructureElement(); Core::FunctionReplyObject createObject(const MainStructureElementModifyRequest &request); Core::FunctionReplyObject updateObject(const MainStructureElementModifyRequest &request); Core::FunctionReplyObject removeObject(); ObjectStructureElement *createStructureElementObject(const Database::IsmStructureElement &dbData); qint32 getId() const { return m_data.id(); } qint32 getStructureElementId() const { return m_data.structureElementId(); } const ObjectStructureElement *getMainStructureElementMountingPoint() const; QString getDescription() const { return QString::fromStdString(m_data.description()); } QString getName() const { return QString::fromStdString(m_data.name()); } std::vector getElements() const { return m_data.elements(); } QMap getStructureElements() const { return m_objectStructureElements; } const MainStructureElement &getData() const { return m_data; } const MainFootprint &getFootprint() const { return m_footprint; } void setFootprintData(const std::vector &elements); QJsonArray getAvailableInExerciseJsonArray() const; int getBridgeStatus() const; std::vector getAvailableInExercise() const; bool isValid() const; Core::FunctionReplyObject updatePosition(const Core::GeoPosition &position); void noticeNewProperties(bool remove = false); Core::FunctionReplyObject setBridgeStatus(const BridgeStatus &st); std::vector deleteEGCUOverrides(const MainStructureElement &data, int oldExerciseId, int newExerciseId, QSet &modifiedStructureElements); bool isTopLevel(StructureElementType structureElementTypeId); // convert methods static Database::IsmMainStructureElement toDbData(const MainStructureElement &ddsData); // dds -> db void onPublishData(); private: // methods Core::FunctionReplyObject createStructureElements(MainStructureElement &mse, QVector &objSeVec); Core::FunctionReplyObject updatePaths(MainStructureElement &mse, const QVector &objSeVec, const std::vector &childParentMapping); static bool isStructureElementDeletable(const StructureElement &se); private: // attributes MainStructureElement m_data; MainFootprint m_footprint; bool m_footprintNeedsUpdate = true; QMap m_objectStructureElements; // must be sorted }; }