1.修复子类初始化问题
2.加了id字段 Signed-off-by: dmy@lab <dmy@lab.lab>
This commit is contained in:
parent
da0a7f192e
commit
479bfc778a
|
|
@ -10,6 +10,7 @@ void CIMExporter::add(const QPair<QString,QString>& fromTo,Line* line)
|
||||||
lineStru.line=line;
|
lineStru.line=line;
|
||||||
lineStru.fromID=fromTo.first;
|
lineStru.fromID=fromTo.first;
|
||||||
lineStru.toID=fromTo.second;
|
lineStru.toID=fromTo.second;
|
||||||
|
lineStru.id=line->ac->getID();
|
||||||
this->line.push_back(lineStru);
|
this->line.push_back(lineStru);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -19,6 +20,7 @@ void CIMExporter::add(const QPair<QString,QString>& fromTo,Switch* sw)
|
||||||
switchStru.sw=sw;
|
switchStru.sw=sw;
|
||||||
switchStru.fromID=fromTo.first;
|
switchStru.fromID=fromTo.first;
|
||||||
switchStru.toID=fromTo.second;
|
switchStru.toID=fromTo.second;
|
||||||
|
switchStru.id=sw->id;
|
||||||
this->sw.push_back(switchStru);
|
this->sw.push_back(switchStru);
|
||||||
}
|
}
|
||||||
void CIMExporter::add(const QPair<QString,QString>& fromTo,Transformer* tf)
|
void CIMExporter::add(const QPair<QString,QString>& fromTo,Transformer* tf)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#include "branch.h"
|
#include "branch.h"
|
||||||
|
|
||||||
Branch::Branch(const QString& from, const QString& to, QObject *parent):from(from),to(to)
|
Branch::Branch(const QString& from, const QString& to, QObject *parent):from(from),to(to),QObject(parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,17 @@
|
||||||
#ifndef COMMONTYPE
|
#ifndef COMMONTYPE
|
||||||
#define COMMONTYPE
|
#define COMMONTYPE
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
#include "line.h"
|
||||||
|
#include "switch.h"
|
||||||
|
#include "transformer.h"
|
||||||
struct BranchStruc
|
struct BranchStruc
|
||||||
{
|
{
|
||||||
QString fromID;
|
QString fromID;
|
||||||
QString toID;
|
QString toID;
|
||||||
int fromNum;
|
int fromNum;
|
||||||
int toNum;
|
int toNum;
|
||||||
|
QString id;//后面有用的
|
||||||
};
|
};
|
||||||
struct LineStru:public BranchStruc
|
struct LineStru:public BranchStruc
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include "line.h"
|
#include "line.h"
|
||||||
|
|
||||||
Line::Line(const QPair<QString,QString>& fromTo, ACLineSegment* ac, QObject *parent):Branch(fromTo.first,fromTo.second)
|
Line::Line(const QPair<QString,QString>& fromTo, ACLineSegment* ac, QObject *parent):Branch(fromTo.first,fromTo.second,parent)
|
||||||
{
|
{
|
||||||
this->ratio=1;
|
this->ratio=1;
|
||||||
this->ac=ac;
|
this->ac=ac;
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,11 @@ class Line:public Branch
|
||||||
public:
|
public:
|
||||||
Line(const QPair<QString, QString> &fromTo, ACLineSegment* ac,QObject* parent=0);
|
Line(const QPair<QString, QString> &fromTo, ACLineSegment* ac,QObject* parent=0);
|
||||||
double length;
|
double length;
|
||||||
|
ACLineSegment *ac;
|
||||||
protected:
|
protected:
|
||||||
virtual void extract();
|
virtual void extract();
|
||||||
private:
|
private:
|
||||||
ACLineSegment *ac;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LINE_H
|
#endif // LINE_H
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include "switch.h"
|
#include "switch.h"
|
||||||
|
|
||||||
Switch::Switch(const QPair<QString,QString>& fromTo, QObject *parent):Branch(fromTo.first,fromTo.second)
|
Switch::Switch(const QPair<QString,QString>& fromTo, const QString &id, QObject *parent):Branch(fromTo.first,fromTo.second,parent),id(id)
|
||||||
{
|
{
|
||||||
this->extract();
|
this->extract();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,12 @@
|
||||||
class Switch:public Branch
|
class Switch:public Branch
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Switch(const QPair<QString, QString> &fromTo,QObject *parent=0);
|
Switch(const QPair<QString, QString> &fromTo,const QString& id,QObject *parent=0);
|
||||||
|
QString id;
|
||||||
protected:
|
protected:
|
||||||
virtual void extract();
|
virtual void extract();
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SWITCH_H
|
#endif // SWITCH_H
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#include "transformer.h"
|
#include "transformer.h"
|
||||||
|
|
||||||
|
|
||||||
Transformer::Transformer(const QPair<QString,QString>& fromTo, PowerTransformer* tf, QObject *parent):Branch(fromTo.first,fromTo.second)
|
Transformer::Transformer(const QPair<QString,QString>& fromTo, PowerTransformer* tf, QObject *parent):Branch(fromTo.first,fromTo.second,parent)
|
||||||
{
|
{
|
||||||
this->ratio=1;
|
this->ratio=1;
|
||||||
this->tf=tf;
|
this->tf=tf;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include "elementreduction.h"
|
#include "elementreduction.h"
|
||||||
|
|
||||||
ElementReduction::ElementReduction()
|
ElementReduction::ElementReduction(const QList<Branch *> &branchList):branchList(branchList)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -10,3 +10,13 @@ ElementReduction::~ElementReduction()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ElementReduction::doIt()
|
||||||
|
{
|
||||||
|
//先重新编号
|
||||||
|
int add=0;
|
||||||
|
foreach(Branch *v,this->branchList)
|
||||||
|
{
|
||||||
|
v->id=add++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,17 @@
|
||||||
#ifndef ELEMENTREDUCTION_H
|
#ifndef ELEMENTREDUCTION_H
|
||||||
#define ELEMENTREDUCTION_H
|
#define ELEMENTREDUCTION_H
|
||||||
|
|
||||||
|
#include <QList>
|
||||||
|
#include "element/commontype.h"
|
||||||
//把电阻等于0的元件都去掉
|
//把电阻等于0的元件都去掉
|
||||||
class ElementReduction
|
class ElementReduction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ElementReduction();
|
explicit ElementReduction(const QList<Branch*>& branchList);
|
||||||
|
void doIt();
|
||||||
~ElementReduction();
|
~ElementReduction();
|
||||||
|
private:
|
||||||
|
const QList<Branch*>& branchList;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ELEMENTREDUCTION_H
|
#endif // ELEMENTREDUCTION_H
|
||||||
|
|
|
||||||
|
|
@ -284,11 +284,11 @@ bool TopologyRecorder::startWithNode(const QString& node)
|
||||||
this->cimExporter.add(fromTo,static_cast<Line *>(branch));
|
this->cimExporter.add(fromTo,static_cast<Line *>(branch));
|
||||||
break;
|
break;
|
||||||
case TopologyRecorder::Type::BREAKER:
|
case TopologyRecorder::Type::BREAKER:
|
||||||
branch=new Switch(fromTo,this);
|
branch=new Switch(fromTo,foundEle->getID(),this);
|
||||||
this->cimExporter.add(fromTo,static_cast<Switch *>(branch));
|
this->cimExporter.add(fromTo,static_cast<Switch *>(branch));
|
||||||
break;
|
break;
|
||||||
case TopologyRecorder::Type::DISCONNECTOR:
|
case TopologyRecorder::Type::DISCONNECTOR:
|
||||||
branch=new Switch(fromTo,this);
|
branch=new Switch(fromTo,foundEle->getID(),this);
|
||||||
this->cimExporter.add(fromTo,static_cast<Switch *>(branch));
|
this->cimExporter.add(fromTo,static_cast<Switch *>(branch));
|
||||||
break;
|
break;
|
||||||
case TopologyRecorder::Type::TF:
|
case TopologyRecorder::Type::TF:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue