1.修复了一些类的isTerminal没有被初始化的bug
2.修复了一些地方判断下一个Terminal的bug Signed-off-by: facat@lab.com <facat@lab.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#include "elementhashtable.h"
|
||||
#include <iostream>
|
||||
ElementHashtable::ElementHashtable(QObject *parent) :
|
||||
QObject(parent)
|
||||
QObject(parent),currentHT(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -60,40 +60,45 @@ bool ElementHashtable::child(QXmlStreamReader &reader)
|
||||
|
||||
if(pointer && id!="")
|
||||
{
|
||||
this->eleHT[id]=pointer;
|
||||
QHash<QString,BasicElementInfo *> *hash=this->currentHT;
|
||||
(*hash)[id]=pointer;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ElementHashtable::goPath()
|
||||
bool ElementHashtable::GoPath()
|
||||
{
|
||||
const QHash<QString,BasicElementInfo*> &ht=this->eleHT;
|
||||
const QHash<QString,BasicElementInfo*> &zwht=this->eleHT;//从配网开始找
|
||||
QList<QString> keys;
|
||||
keys=ht.keys();
|
||||
keys=zwht.keys();
|
||||
std::cout<<keys.length()<<std::endl;
|
||||
for(QList<QString>::Iterator ite=keys.begin();
|
||||
ite!=keys.end();
|
||||
ite++)
|
||||
{
|
||||
BasicElementInfo *p=ht[*ite];
|
||||
if(p->getName()=="BusbarSection")
|
||||
BasicElementInfo *p=zwht[*ite];
|
||||
// if(p->getName()=="ACLineSegment"){
|
||||
// std::cout<<p->getID().toStdString()<<std::endl;
|
||||
// }
|
||||
if(p->getName()=="ACLineSegment" && p->getID()=="AC-456432")
|
||||
{
|
||||
// std::cout<<"BusbarSection"<<"\n";
|
||||
BusbarSection *foo=static_cast<BusbarSection *>(p);
|
||||
QString terminal=foo->getTerminal();
|
||||
ACLineSegment *ac=static_cast<ACLineSegment *>(p);//BusbarSection也就是线路头节点
|
||||
QString acTerminal=ac->getTerminalB();
|
||||
//找Terminal的东西
|
||||
Terminal *terminalP=static_cast<Terminal *>(ht[terminal]);
|
||||
std::cout<<terminalP->getID().toStdString()<<std::endl;
|
||||
Terminal *acTerminalP=static_cast<Terminal *>(zwht[acTerminal]);
|
||||
std::cout<<acTerminalP->getID().toStdString()<<std::endl;
|
||||
QString node;
|
||||
node=terminalP->getConnectivityNode();
|
||||
node=acTerminalP->getConnectivityNode();
|
||||
if(node=="")
|
||||
{
|
||||
continue;//有些Terminal是没有Node的
|
||||
}
|
||||
std::cout<<node.toStdString()<<std::endl;
|
||||
QString anotherTerminal;
|
||||
anotherTerminal=this->nodeToTerminal.value(node);
|
||||
// std::cout<<"anotherTerminal"<<anotherTerminal.toStdString()<<std::endl;
|
||||
Terminal *anotherTerminalP=static_cast<Terminal *>(ht[anotherTerminal]);
|
||||
std::cout<<anotherTerminalP->getConductingEquipment().toStdString()<<std::endl;
|
||||
TopologyRecorder tpRecorder(this->eleHT);
|
||||
tpRecorder.startWithNode(node);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -131,3 +136,17 @@ bool ElementHashtable::parse(const QString& xmlPath)
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ElementHashtable::setCurrentHashTable(QHash<QString,BasicElementInfo *> *t)
|
||||
{
|
||||
this->currentHT=t;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ElementHashtable::Parse(const QString& xmlPWPath,const QString& xmlZWPath){
|
||||
this->setCurrentHashTable(&this->eleHT);
|
||||
this->parse(xmlPWPath);
|
||||
// this->setCurrentHashTable(&this->mainStationHT);
|
||||
// this->parse(xmlZWPath);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user