用QTextStream来输出Container的信息。
Signed-off-by: dmy@lab <dmy@lab.lab>
This commit is contained in:
parent
cd22eecbca
commit
1e3ad32bfa
|
|
@ -1,7 +1,7 @@
|
||||||
#include "elementhashtable.h"
|
#include "elementhashtable.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
ElementHashtable::ElementHashtable(QObject *parent) :
|
ElementHashtable::ElementHashtable(QObject *parent) :
|
||||||
QObject(parent),currentHT(NULL)
|
QObject(parent),currentHT(NULL),tpRecorder(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -96,9 +96,14 @@ bool ElementHashtable::GoPath()
|
||||||
continue;//有些Terminal是没有Node的
|
continue;//有些Terminal是没有Node的
|
||||||
}
|
}
|
||||||
std::cout<<node.toStdString()<<std::endl;
|
std::cout<<node.toStdString()<<std::endl;
|
||||||
TopologyRecorder tpRecorder(this->eleHT,this->FDSet);
|
if(this->tpRecorder!=NULL)
|
||||||
tpRecorder.startWithNode(node);
|
{
|
||||||
tpRecorder.exportTo("");
|
delete this->tpRecorder;
|
||||||
|
this->tpRecorder=NULL;
|
||||||
|
}
|
||||||
|
this->tpRecorder=new TopologyRecorder(this->eleHT,this->FDSet);
|
||||||
|
this->tpRecorder->startWithNode(node);
|
||||||
|
this->tpRecorder->exportTo("");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -155,6 +160,8 @@ bool ElementHashtable::Parse(const QString& xmlPWPath,const QString& xmlZWPath){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ElementHashtable::SetACLineID(const QString &id)//寻找的线路ID
|
void ElementHashtable::SetACLineID(const QString &id)//寻找的线路ID
|
||||||
{
|
{
|
||||||
this->lineID=id;
|
this->lineID=id;
|
||||||
|
|
@ -163,3 +170,15 @@ void ElementHashtable::SetFDSet(const QVector<QString> &FDSet)//FeeDer集合
|
||||||
{
|
{
|
||||||
this->FDSet=FDSet;
|
this->FDSet=FDSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ElementHashtable::ShowContainerInfo(const QString& fileName)
|
||||||
|
{
|
||||||
|
QString relPath="./../output/";
|
||||||
|
QFile file(relPath+fileName+".txt");
|
||||||
|
if(file.open(QFile::ReadOnly))
|
||||||
|
{
|
||||||
|
QTextStream stream(&file);
|
||||||
|
this->tpRecorder->showContainerInfo(stream);
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
#include <QTextStream>
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include "BasicElementInfo.h"
|
#include "BasicElementInfo.h"
|
||||||
|
|
@ -28,6 +29,7 @@ public:
|
||||||
bool GoPath();
|
bool GoPath();
|
||||||
void SetACLineID(const QString &id);//寻找的线路ID
|
void SetACLineID(const QString &id);//寻找的线路ID
|
||||||
void SetFDSet(const QVector<QString> &FDSet);//FeeDer集合
|
void SetFDSet(const QVector<QString> &FDSet);//FeeDer集合
|
||||||
|
void ShowContainerInfo(const QString& fileName);
|
||||||
private:
|
private:
|
||||||
bool child(QXmlStreamReader &reader);
|
bool child(QXmlStreamReader &reader);
|
||||||
bool setCurrentHashTable(QHash<QString,BasicElementInfo *> *t);
|
bool setCurrentHashTable(QHash<QString,BasicElementInfo *> *t);
|
||||||
|
|
@ -38,6 +40,7 @@ private:
|
||||||
QHash<QString,BasicElementInfo *> *currentHT;
|
QHash<QString,BasicElementInfo *> *currentHT;
|
||||||
QString lineID;
|
QString lineID;
|
||||||
QVector<QString> FDSet;
|
QVector<QString> FDSet;
|
||||||
|
TopologyRecorder *tpRecorder;
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
|
||||||
|
|
@ -7,37 +7,7 @@ TopologyRecorder::TopologyRecorder(const QHash<QString,BasicElementInfo *>& elem
|
||||||
|
|
||||||
TopologyRecorder::~TopologyRecorder()
|
TopologyRecorder::~TopologyRecorder()
|
||||||
{
|
{
|
||||||
const QHash<QString,BasicElementInfo*> &ht=this->eleHT;
|
|
||||||
std::cout<<"total tf"<<this->tfs.length()<<std::endl;
|
|
||||||
//统计一下每个Container下有多少个变压器
|
|
||||||
QHash<QString,QVector<QString> > s;
|
|
||||||
for(QVector<QString>::iterator ite=this->tfs.begin();
|
|
||||||
ite!=this->tfs.end();
|
|
||||||
ite++)
|
|
||||||
{
|
|
||||||
PowerTransformer *pf=static_cast<PowerTransformer *>(ht[*ite]);
|
|
||||||
QString container;
|
|
||||||
container=pf->getEquipmentMemberOf_EquipmentContainer();
|
|
||||||
s[container].push_back(*ite);
|
|
||||||
}
|
|
||||||
std::cout<<"container "<<s.keys().length()<<std::endl;
|
|
||||||
QList<QString> keys=s.keys();
|
|
||||||
for(QList<QString>::iterator ite=keys.begin();
|
|
||||||
ite!=keys.end();
|
|
||||||
ite++)
|
|
||||||
{
|
|
||||||
QString k=*ite;
|
|
||||||
std::cout<<k.toStdString();
|
|
||||||
Substation *sb=static_cast<Substation *>(ht[k]);
|
|
||||||
std::cout<<", "<<sb->getNamingDescription().toStdString();
|
|
||||||
QVector<QString> v=s[k];
|
|
||||||
foreach (QString n, v) {
|
|
||||||
std::cout<<", "<<n.toStdString();
|
|
||||||
PowerTransformer *pf=static_cast<PowerTransformer *>(ht[n]);
|
|
||||||
std::cout<<"("<<pf->getNamingDescription().toStdString()<<")";
|
|
||||||
}
|
|
||||||
std::cout<<std::endl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TopologyRecorder::isEquipmentNeeded(const QString& substatinID)
|
bool TopologyRecorder::isEquipmentNeeded(const QString& substatinID)
|
||||||
|
|
@ -61,6 +31,43 @@ void TopologyRecorder::exportTo(const QString& path)
|
||||||
this->cimExporter.exportTo(path);
|
this->cimExporter.exportTo(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TopologyRecorder::showContainerInfo(QTextStream &stream)
|
||||||
|
{
|
||||||
|
|
||||||
|
const QHash<QString,BasicElementInfo*> &ht=this->eleHT;
|
||||||
|
stream<<"total tf"<<this->tfs.length()<<"\n";
|
||||||
|
//统计一下每个Container下有多少个变压器
|
||||||
|
QHash<QString,QVector<QString> > s;
|
||||||
|
for(QVector<QString>::iterator ite=this->tfs.begin();
|
||||||
|
ite!=this->tfs.end();
|
||||||
|
ite++)
|
||||||
|
{
|
||||||
|
PowerTransformer *pf=static_cast<PowerTransformer *>(ht[*ite]);
|
||||||
|
QString container;
|
||||||
|
container=pf->getEquipmentMemberOf_EquipmentContainer();
|
||||||
|
s[container].push_back(*ite);
|
||||||
|
}
|
||||||
|
std::cout<<"container "<<s.keys().length()<<std::endl;
|
||||||
|
QList<QString> keys=s.keys();
|
||||||
|
for(QList<QString>::iterator ite=keys.begin();
|
||||||
|
ite!=keys.end();
|
||||||
|
ite++)
|
||||||
|
{
|
||||||
|
QString k=*ite;
|
||||||
|
stream<<k;
|
||||||
|
Substation *sb=static_cast<Substation *>(ht[k]);
|
||||||
|
stream<<"("<<sb->getNamingDescription()<<")";
|
||||||
|
QVector<QString> v=s[k];
|
||||||
|
foreach (QString n, v) {
|
||||||
|
std::cout<<", "<<n.toStdString();
|
||||||
|
PowerTransformer *pf=static_cast<PowerTransformer *>(ht[n]);
|
||||||
|
stream<<"("<<pf->getNamingDescription()<<")";
|
||||||
|
}
|
||||||
|
stream<<"\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
bool TopologyRecorder::startWithNode(const QString& node)
|
bool TopologyRecorder::startWithNode(const QString& node)
|
||||||
{
|
{
|
||||||
if(node=="")
|
if(node=="")
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QPair>
|
#include <QPair>
|
||||||
|
#include <QTextStream>
|
||||||
#include "BasicElementInfo.h"
|
#include "BasicElementInfo.h"
|
||||||
#include "breaker.h"
|
#include "breaker.h"
|
||||||
#include "aclinesegment.h"
|
#include "aclinesegment.h"
|
||||||
|
|
@ -31,6 +32,7 @@ class TopologyRecorder:public QObject
|
||||||
public:
|
public:
|
||||||
TopologyRecorder(const QHash<QString,BasicElementInfo *>& elementHT,const QVector<QString> &FDSet,QObject *parent=0);
|
TopologyRecorder(const QHash<QString,BasicElementInfo *>& elementHT,const QVector<QString> &FDSet,QObject *parent=0);
|
||||||
~TopologyRecorder();
|
~TopologyRecorder();
|
||||||
|
void showContainerInfo(QTextStream &stream);
|
||||||
bool startWithNode(const QString& node);
|
bool startWithNode(const QString& node);
|
||||||
void exportTo(const QString& path);
|
void exportTo(const QString& path);
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue