有可能会访问到重复的元件,如果是已经访问过的就不添加了。

Signed-off-by: dmy@lab <dmy@lab.lab>
This commit is contained in:
dmy@lab
2015-01-15 17:19:06 +08:00
parent c1b2c0e367
commit 5cd6849e95
6 changed files with 14 additions and 11 deletions

View File

@@ -83,7 +83,6 @@ bool TopologyRecorder::startWithNode(const QString& node)
{
TopologyRecorder::Type::EleType typ;
BasicElementInfo *foundEle=NULL;
// bool foundCate=false;
anotherTerminal=anotherTerminalVector.at(atI);
if(this->reachedTerminal.contains(anotherTerminal))
{
@@ -109,10 +108,6 @@ bool TopologyRecorder::startWithNode(const QString& node)
}
terminalA=AC->getTerminalA();
terminalB=AC->getTerminalB();
// std::cout<<"find"<<AC->getID().toStdString()<<std::endl;
// std::cout<<AC->getNamingDescription().toStdString()<<std::endl;
//把线路长度也输出来看一下
// std::cout<<AC->getLength()<<std::endl;
foundEle=AC;
typ=TopologyRecorder::Type::AC;
}
@@ -244,6 +239,12 @@ bool TopologyRecorder::startWithNode(const QString& node)
Branch *branch=NULL;
switch(typ)
{
//有可能会访问到重复的元件,所以这里判断一下,如果是已经访问过的就不添加了。
if(this->hasAdded.contains(foundEle->getID()))
{
continue;
}
this->hasAdded[foundEle->getID()]=0;
case TopologyRecorder::Type::AC:
branch=new Line(fromTo,static_cast<ACLineSegment *>(foundEle),this);
this->cimExporter.add(fromTo,static_cast<Line *>(branch));