1.修复子类初始化问题

2.加了id字段

Signed-off-by: dmy@lab <dmy@lab.lab>
This commit is contained in:
dmy@lab
2015-01-20 21:24:33 +08:00
parent da0a7f192e
commit 479bfc778a
11 changed files with 35 additions and 10 deletions

View File

@@ -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)
{
}

View File

@@ -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
{

View File

@@ -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;

View File

@@ -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

View File

@@ -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();
}

View File

@@ -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

View File

@@ -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;