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.fromID=fromTo.first;
|
||||
lineStru.toID=fromTo.second;
|
||||
lineStru.id=line->ac->getID();
|
||||
this->line.push_back(lineStru);
|
||||
|
||||
}
|
||||
|
|
@ -19,6 +20,7 @@ void CIMExporter::add(const QPair<QString,QString>& fromTo,Switch* sw)
|
|||
switchStru.sw=sw;
|
||||
switchStru.fromID=fromTo.first;
|
||||
switchStru.toID=fromTo.second;
|
||||
switchStru.id=sw->id;
|
||||
this->sw.push_back(switchStru);
|
||||
}
|
||||
void CIMExporter::add(const QPair<QString,QString>& fromTo,Transformer* tf)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#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
|
||||
#define COMMONTYPE
|
||||
|
||||
#include <QString>
|
||||
#include "line.h"
|
||||
#include "switch.h"
|
||||
#include "transformer.h"
|
||||
struct BranchStruc
|
||||
{
|
||||
QString fromID;
|
||||
QString toID;
|
||||
int fromNum;
|
||||
int toNum;
|
||||
QString id;//后面有用的
|
||||
};
|
||||
struct LineStru:public BranchStruc
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#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->ac=ac;
|
||||
|
|
|
|||
|
|
@ -9,10 +9,11 @@ class Line:public Branch
|
|||
public:
|
||||
Line(const QPair<QString, QString> &fromTo, ACLineSegment* ac,QObject* parent=0);
|
||||
double length;
|
||||
ACLineSegment *ac;
|
||||
protected:
|
||||
virtual void extract();
|
||||
private:
|
||||
ACLineSegment *ac;
|
||||
|
||||
};
|
||||
|
||||
#endif // LINE_H
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,10 +6,12 @@
|
|||
class Switch:public Branch
|
||||
{
|
||||
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:
|
||||
virtual void extract();
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // SWITCH_H
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#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->tf=tf;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#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
|
||||
#define ELEMENTREDUCTION_H
|
||||
|
||||
#include <QList>
|
||||
#include "element/commontype.h"
|
||||
//把电阻等于0的元件都去掉
|
||||
class ElementReduction
|
||||
{
|
||||
public:
|
||||
ElementReduction();
|
||||
explicit ElementReduction(const QList<Branch*>& branchList);
|
||||
void doIt();
|
||||
~ElementReduction();
|
||||
private:
|
||||
const QList<Branch*>& branchList;
|
||||
};
|
||||
|
||||
#endif // ELEMENTREDUCTION_H
|
||||
|
|
|
|||
|
|
@ -284,11 +284,11 @@ bool TopologyRecorder::startWithNode(const QString& node)
|
|||
this->cimExporter.add(fromTo,static_cast<Line *>(branch));
|
||||
break;
|
||||
case TopologyRecorder::Type::BREAKER:
|
||||
branch=new Switch(fromTo,this);
|
||||
branch=new Switch(fromTo,foundEle->getID(),this);
|
||||
this->cimExporter.add(fromTo,static_cast<Switch *>(branch));
|
||||
break;
|
||||
case TopologyRecorder::Type::DISCONNECTOR:
|
||||
branch=new Switch(fromTo,this);
|
||||
branch=new Switch(fromTo,foundEle->getID(),this);
|
||||
this->cimExporter.add(fromTo,static_cast<Switch *>(branch));
|
||||
break;
|
||||
case TopologyRecorder::Type::TF:
|
||||
|
|
|
|||
Loading…
Reference in New Issue