diff --git a/testHasttable/cimexporter.cpp b/testHasttable/cimexporter.cpp index ed1783c..8595211 100644 --- a/testHasttable/cimexporter.cpp +++ b/testHasttable/cimexporter.cpp @@ -40,7 +40,7 @@ void CIMExporter::add(const QPair& fromTo,Transformer* tf) } -void CIMExporter::exportTo(const QString& path) +void CIMExporter::exportTo(const QString& path,const QString &rootID) { @@ -63,7 +63,7 @@ void CIMExporter::exportTo(const QString& path) elements.push_back( &(this->tf[i]) ); } ElementReduction elementReduction(elements); - elementReduction.doIt(); + elementReduction.doIt(rootID); //先给所有节点都编号 this->idToNumber(this->line); this->idToNumber(this->sw); diff --git a/testHasttable/cimexporter.h b/testHasttable/cimexporter.h index 2b19142..716ec0a 100644 --- a/testHasttable/cimexporter.h +++ b/testHasttable/cimexporter.h @@ -32,7 +32,7 @@ public: void add(const QPair& fromTo,Line* line); void add(const QPair& fromTo,Switch* sw); void add(const QPair& fromTo,Transformer* tf); - void exportTo(const QString& path); + void exportTo(const QString& path, const QString &rootID); private: bool topologyTest(); QList line; diff --git a/testHasttable/elementhashtable.cpp b/testHasttable/elementhashtable.cpp index e143be4..0e1b48b 100644 --- a/testHasttable/elementhashtable.cpp +++ b/testHasttable/elementhashtable.cpp @@ -103,7 +103,7 @@ bool ElementHashtable::GoPath() delete this->tpRecorder; this->tpRecorder=NULL; } - this->tpRecorder=new TopologyRecorder(this->eleHT,this->FDSet,this->loadFilePath); + this->tpRecorder=new TopologyRecorder(this->eleHT,this->FDSet,this->loadFilePath,this->lineID); this->tpRecorder->startWithNode(node); // this->tpRecorder->exportTo(""); break; diff --git a/testHasttable/elementreduction.cpp b/testHasttable/elementreduction.cpp index c11f883..542c7ea 100644 --- a/testHasttable/elementreduction.cpp +++ b/testHasttable/elementreduction.cpp @@ -21,7 +21,7 @@ void ElementReduction::calibration(const QString &id,QHash > linkage; //先记录元件之间的连接关系 @@ -36,9 +36,9 @@ void ElementReduction::doIt() QDomDocument root; // QDomElement element=root.createElement(this->branchList.at(2)->id); - QDomElement element=root.createElement("AC-671677"); - this->calibration("AC-671677",idToBranch,linkage); - std::cout<<"start "<<"AC-671677"<calibration(rootID,idToBranch,linkage); + std::cout<<"start "<buildTreeTo(element,root,linkage,idToBranch); // this->visited.remove(this->branchList.at(2)->id); @@ -135,7 +135,7 @@ void ElementReduction::buildTreeTo(QDomElement &element,QDomDocument &root,QHash nextTo=branch->toID; QVector nextVec; nextVec=linkage[nextTo]; - std::cout<& branchList); - void doIt(); + void doIt(const QString &rootID); ~ElementReduction(); private: void calibration(const QString &id, QHash &idToBranch, QHash > &linkage); diff --git a/testHasttable/topologyrecorder.cpp b/testHasttable/topologyrecorder.cpp index 2fd4fce..36fa582 100644 --- a/testHasttable/topologyrecorder.cpp +++ b/testHasttable/topologyrecorder.cpp @@ -1,7 +1,7 @@ #include "topologyrecorder.h" #include #include -TopologyRecorder::TopologyRecorder(const QHash& elementHT, const QVector &FDSet,const QString& loadFilePath, QObject *parent):QObject(parent),eleHT(elementHT),FDSet(FDSet),cimExporter(elementHT,loadFilePath) +TopologyRecorder::TopologyRecorder(const QHash& elementHT, const QVector &FDSet, const QString& loadFilePath, const QString &rootID, QObject *parent):QObject(parent),eleHT(elementHT),FDSet(FDSet),cimExporter(elementHT,loadFilePath),rootID(rootID) { } @@ -28,7 +28,7 @@ bool TopologyRecorder::isEquipmentNeeded(const QString& substatinID) void TopologyRecorder::exportTo(const QString& path) { - this->cimExporter.exportTo(path); + this->cimExporter.exportTo(path,this->rootID); } void TopologyRecorder::showContainerInfo(QTextStream &stream) diff --git a/testHasttable/topologyrecorder.h b/testHasttable/topologyrecorder.h index 48c17e5..f346b33 100644 --- a/testHasttable/topologyrecorder.h +++ b/testHasttable/topologyrecorder.h @@ -30,7 +30,7 @@ class TopologyRecorder:public QObject }; public: - TopologyRecorder(const QHash& elementHT, const QVector &FDSet, const QString &loadFilePath, QObject *parent=0); + TopologyRecorder(const QHash& elementHT, const QVector &FDSet, const QString &loadFilePath,const QString &rootID, QObject *parent=0); ~TopologyRecorder(); void showContainerInfo(QTextStream &stream); bool startWithNode(const QString& node); @@ -43,6 +43,7 @@ private: QVector FDSet; CIMExporter cimExporter; QHash hasAdded; + QString rootID; bool isEquipmentNeeded(const QString& substatinID); };