100 lines
2.2 KiB
C++
100 lines
2.2 KiB
C++
#include "diagramEditor/diagramEditorBaseBlock.h"
|
|
|
|
DiagramEditorBaseBlock::DiagramEditorBaseBlock(QObject *parent)
|
|
: QObject(parent)
|
|
,_curContainer(nullptr)
|
|
{
|
|
nType = 0;
|
|
}
|
|
DiagramEditorBaseBlock::~DiagramEditorBaseBlock()
|
|
{
|
|
|
|
}
|
|
|
|
void DiagramEditorBaseBlock::addConnect(const QString& str,int n,bool bCover)
|
|
{
|
|
if(!bCover){
|
|
if(str == sName)
|
|
return;
|
|
}
|
|
|
|
for(auto& con:lstCon){
|
|
if(con.con1.sName == str || con.con2.sName == str){ //已存在不插入
|
|
return;
|
|
}
|
|
}
|
|
|
|
DiagramEditorBriefConnect con;
|
|
con.con1.sName = sName; //首参数为自己名
|
|
con.con1.nType = nType;
|
|
con.con2.sName = str;
|
|
con.con2.nType = n;
|
|
|
|
lstCon.append(con);
|
|
}
|
|
|
|
void DiagramEditorBaseBlock::addConnect(DiagramEditorBriefConnect obj)
|
|
{
|
|
for(auto& con:lstCon){
|
|
if(con == obj){ //已存在不插入
|
|
return;
|
|
}
|
|
}
|
|
lstCon.append(obj);
|
|
}
|
|
|
|
void DiagramEditorBaseBlock::removeConnect(const QString& str)
|
|
{
|
|
for(int i = 0;i < lstCon.size();++i){
|
|
if(lstCon[i].con1.sName == str || lstCon[i].con2.sName == str){
|
|
lstCon.removeAt(i);
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
void DiagramEditorBaseBlock::removeConnect(DiagramEditorBriefConnect obj)
|
|
{
|
|
for(int i = 0;i < lstCon.size();++i){
|
|
if(lstCon[i] == obj){
|
|
lstCon.removeAt(i);
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
/***************************划分后的分段bus单元****************************/
|
|
DiagramEditorBusBlock::DiagramEditorBusBlock(QObject *parent)
|
|
:DiagramEditorBaseBlock(parent)
|
|
{
|
|
fVoltage = 0.0;
|
|
nBusType = 0;
|
|
nIndex = 0;
|
|
}
|
|
|
|
DiagramEditorBusBlock::~DiagramEditorBusBlock()
|
|
{
|
|
|
|
}
|
|
/***************************bay单元****************************/
|
|
DiagramEditorBayBlock::DiagramEditorBayBlock(QObject *parent)
|
|
:DiagramEditorBaseBlock(parent)
|
|
{
|
|
nBayType = BayType::busSectionBay;
|
|
}
|
|
|
|
DiagramEditorBayBlock::~DiagramEditorBayBlock()
|
|
{
|
|
|
|
}
|
|
/***************************transformer单元****************************/
|
|
DiagramEditorTransformerBlock::DiagramEditorTransformerBlock(QObject *parent)
|
|
:DiagramEditorBaseBlock(parent)
|
|
{
|
|
nTransType = TransformerType::twoWinding;
|
|
}
|
|
|
|
DiagramEditorTransformerBlock::~DiagramEditorTransformerBlock()
|
|
{
|
|
|
|
}
|