利用文件中独读到的线路头节点ID

Signed-off-by: dmy@lab <dmy@lab.lab>
This commit is contained in:
dmy@lab 2015-01-22 11:09:20 +08:00
parent 5017c73f09
commit 1c9f65b6cd
7 changed files with 14 additions and 13 deletions

View File

@ -40,7 +40,7 @@ void CIMExporter::add(const QPair<QString,QString>& 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);

View File

@ -32,7 +32,7 @@ public:
void add(const QPair<QString,QString>& fromTo,Line* line);
void add(const QPair<QString,QString>& fromTo,Switch* sw);
void add(const QPair<QString,QString>& fromTo,Transformer* tf);
void exportTo(const QString& path);
void exportTo(const QString& path, const QString &rootID);
private:
bool topologyTest();
QList<LineStru> line;

View File

@ -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;

View File

@ -21,7 +21,7 @@ void ElementReduction::calibration(const QString &id,QHash<QString,BranchStruc *
}
}
void ElementReduction::doIt()
void ElementReduction::doIt(const QString& rootID)
{
QHash<QString,QVector<BranchStruc *> > 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"<<std::endl;
QDomElement element=root.createElement(rootID);
this->calibration(rootID,idToBranch,linkage);
std::cout<<"start "<<rootID.toStdString()<<std::endl;
root.appendChild(element);
this->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<BranchStruc *> nextVec;
nextVec=linkage[nextTo];
std::cout<<nextVec.length()<<" of "<<element.tagName().toStdString()<<std::endl;
// std::cout<<nextVec.length()<<" of "<<element.tagName().toStdString()<<std::endl;
foreach(BranchStruc *n,nextVec)
{

View File

@ -16,7 +16,7 @@ class ElementReduction
{
public:
explicit ElementReduction(const QList<BranchStruc*>& branchList);
void doIt();
void doIt(const QString &rootID);
~ElementReduction();
private:
void calibration(const QString &id, QHash<QString, BranchStruc *> &idToBranch, QHash<QString, QVector<BranchStruc *> > &linkage);

View File

@ -1,7 +1,7 @@
#include "topologyrecorder.h"
#include <iostream>
#include <QList>
TopologyRecorder::TopologyRecorder(const QHash<QString,BasicElementInfo *>& elementHT, const QVector<QString> &FDSet,const QString& loadFilePath, QObject *parent):QObject(parent),eleHT(elementHT),FDSet(FDSet),cimExporter(elementHT,loadFilePath)
TopologyRecorder::TopologyRecorder(const QHash<QString,BasicElementInfo *>& elementHT, const QVector<QString> &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)

View File

@ -30,7 +30,7 @@ class TopologyRecorder:public QObject
};
public:
TopologyRecorder(const QHash<QString,BasicElementInfo *>& elementHT, const QVector<QString> &FDSet, const QString &loadFilePath, QObject *parent=0);
TopologyRecorder(const QHash<QString,BasicElementInfo *>& elementHT, const QVector<QString> &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<QString> FDSet;
CIMExporter cimExporter;
QHash<QString,char> hasAdded;
QString rootID;
bool isEquipmentNeeded(const QString& substatinID);
};