2015-01-20 20:59:47 +08:00
|
|
|
#ifndef ELEMENTREDUCTION_H
|
|
|
|
|
#define ELEMENTREDUCTION_H
|
|
|
|
|
|
2015-01-20 21:24:33 +08:00
|
|
|
#include <QList>
|
2015-01-20 22:46:26 +08:00
|
|
|
#include <QHash>
|
|
|
|
|
#include <QString>
|
|
|
|
|
#include <QVector>
|
2015-01-21 14:03:07 +08:00
|
|
|
#include <QDomElement>
|
|
|
|
|
#include <QDomDocument>
|
2015-01-20 21:24:33 +08:00
|
|
|
#include "element/commontype.h"
|
2015-01-20 20:59:47 +08:00
|
|
|
//把电阻等于0的元件都去掉
|
|
|
|
|
class ElementReduction
|
|
|
|
|
{
|
|
|
|
|
public:
|
2015-01-20 22:46:26 +08:00
|
|
|
explicit ElementReduction(const QList<BranchStruc*>& branchList);
|
2015-01-20 21:24:33 +08:00
|
|
|
void doIt();
|
2015-01-20 20:59:47 +08:00
|
|
|
~ElementReduction();
|
2015-01-20 21:24:33 +08:00
|
|
|
private:
|
2015-01-21 14:03:07 +08:00
|
|
|
void buildTree(QDomElement &element, QDomDocument &root, QHash<QString,QVector<BranchStruc *> >& linkage, QHash<QString,BranchStruc *>& idToBranch);
|
|
|
|
|
void buildTree2(QDomElement &element, QDomDocument &root, QHash<QString,QVector<BranchStruc *> >& linkage, QHash<QString,BranchStruc *>& idToBranch);
|
2015-01-20 22:46:26 +08:00
|
|
|
void visit(BranchStruc* branch, QHash<QString, QVector<BranchStruc *> > &linkage);
|
2015-01-21 14:03:07 +08:00
|
|
|
void visit2(BranchStruc* branch, QHash<QString, QVector<BranchStruc *> > &linkage);
|
2015-01-20 22:46:26 +08:00
|
|
|
const QList<BranchStruc*>& branchList;
|
|
|
|
|
QHash<QString,char> visited;
|
2015-01-20 20:59:47 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // ELEMENTREDUCTION_H
|