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

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

@ -49,6 +49,7 @@ void CIMExporter::exportTo(const QString& path)
} }
template<typename T> template<typename T>
void CIMExporter::idToNumber(QList<T> &s)//把所有元件的标识进行编号 void CIMExporter::idToNumber(QList<T> &s)//把所有元件的标识进行编号
{ {

View File

@ -7,10 +7,10 @@ int main(int argc, char *argv[])
{ {
QCoreApplication a(argc, argv); QCoreApplication a(argc, argv);
// ReadWrite aa; // ReadWrite aa;
RegexExtract re; // RegexExtract re;
re.extract("D:/Project/佛山项目/数据/df8003/df8600/exportfiles/exportmodel_pw.xml"); // re.extract("D:/Project/佛山项目/数据/df8003/df8600/exportfiles/exportmodel_pw.xml");
re.exportBlocks("./a"); // re.exportBlocks("./a");
return a.exec(); // return a.exec();
ElementHashtable eleReader; ElementHashtable eleReader;
eleReader.Parse("D:/Project/佛山项目/数据/df8003/df8600/exportfiles/exportmodel_pw.xml","D:/Project/佛山项目/佛山收资/exportmodel_zwyth20141204/exportmodel_zwyth.xml"); eleReader.Parse("D:/Project/佛山项目/数据/df8003/df8600/exportfiles/exportmodel_pw.xml","D:/Project/佛山项目/佛山收资/exportmodel_zwyth20141204/exportmodel_zwyth.xml");
// eleReader.GoPath(); // eleReader.GoPath();

View File

@ -66,7 +66,7 @@ void Task::doAgainstTaskFile(ElementHashtable &eleHT)
eleHT.SetFDSet(setSep.toVector()); eleHT.SetFDSet(setSep.toVector());
eleHT.GoPath(); eleHT.GoPath();
eleHT.ShowContainerInfo(lineName); eleHT.ShowContainerInfo(lineName);
// break; break;
} }
file.close(); file.close();
} }

View File

@ -47,7 +47,7 @@
719广水Ⅱ线,AC-831217,(FD-2048) 719广水Ⅱ线,AC-831217,(FD-2048)
#704广水Ⅲ线,AC-591831,()无svg #704广水Ⅲ线,AC-591831,()无svg
703港前北线,AC-671661,(FD-1992,FD-1998) 703港前北线,AC-671661,(FD-1992,FD-1998)
730ĚŠ¸ŰŇŇĎß,AC-903666,(FD-58442,FD-2025) 730ĚŠ¸ŰŇŇĎß,AC-903666,(FD-58442,FD-2025,)
716兴业南线,AC-591810,(FD-1994,FD-58443) 716兴业南线,AC-591810,(FD-1994,FD-58443)
712洗碗机线,AC-671668,(FD-2042) 712洗碗机线,AC-671668,(FD-2042)
714泰林西乙线,AC-671670,(FD-2103,) 714泰林西乙线,AC-671670,(FD-2103,)

View File

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

View File

@ -42,6 +42,7 @@ private:
QVector<QString> tfs; QVector<QString> tfs;
CIMExporter cimExporter; CIMExporter cimExporter;
QVector<QString> FDSet; QVector<QString> FDSet;
QHash<QString,char> hasAdded;
bool isEquipmentNeeded(const QString& substatinID); bool isEquipmentNeeded(const QString& substatinID);
}; };