2024-12-03 20:07:25 +08:00
|
|
|
|
#ifndef GLOBAL_H
|
|
|
|
|
|
#define GLOBAL_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <QGraphicsItem>
|
|
|
|
|
|
#include <QtCore/QMetaObject>
|
|
|
|
|
|
#include <QtSwap>
|
|
|
|
|
|
#include <QHash>
|
2025-03-21 12:53:45 +08:00
|
|
|
|
#include <QUuid>
|
|
|
|
|
|
#include <QJsonObject>
|
2025-04-30 16:29:17 +08:00
|
|
|
|
#include <QWidget>
|
2025-06-06 18:57:37 +08:00
|
|
|
|
#include <QStandardItemModel>
|
2025-06-27 19:17:04 +08:00
|
|
|
|
#include "tools.h"
|
2024-12-03 20:07:25 +08:00
|
|
|
|
|
2024-12-13 18:08:00 +08:00
|
|
|
|
const double g_dGriaphicsScene_Width = 800;
|
|
|
|
|
|
const double g_dGriaphicsScene_Height = 600;
|
2024-12-03 20:07:25 +08:00
|
|
|
|
|
2025-05-30 16:28:51 +08:00
|
|
|
|
const int g_dEditorItem_Width = 150;
|
|
|
|
|
|
const int g_dEditorItem_Height = 80;
|
2025-06-27 19:17:04 +08:00
|
|
|
|
|
2025-08-06 20:10:10 +08:00
|
|
|
|
const int g_nEditorBus_Height = 10;
|
|
|
|
|
|
|
2025-10-17 18:14:44 +08:00
|
|
|
|
const int g_nVDiagramSpacing = 80;
|
|
|
|
|
|
const int g_nHDiagramSpacing = 80;
|
2025-09-05 17:30:07 +08:00
|
|
|
|
|
2024-12-03 20:07:25 +08:00
|
|
|
|
//Q_NAMESPACE
|
|
|
|
|
|
enum GraphicsItemType
|
|
|
|
|
|
{
|
|
|
|
|
|
GIT_base = QGraphicsItem::UserType + 1,
|
|
|
|
|
|
GIT_line = QGraphicsItem::UserType + 2,
|
|
|
|
|
|
GIT_rect = QGraphicsItem::UserType + 3,
|
|
|
|
|
|
GIT_roundRect = QGraphicsItem::UserType + 4,
|
|
|
|
|
|
GIT_ellipse = QGraphicsItem::UserType + 5,
|
|
|
|
|
|
GIT_polygon = QGraphicsItem::UserType + 6,
|
|
|
|
|
|
//======================================
|
|
|
|
|
|
GIT_bus = QGraphicsItem::UserType + 50,
|
|
|
|
|
|
GIT_itemRect = QGraphicsItem::UserType + 51,
|
2024-12-07 17:24:36 +08:00
|
|
|
|
GIT_itemTri = QGraphicsItem::UserType + 52,
|
2025-06-13 19:00:05 +08:00
|
|
|
|
GIT_link= QGraphicsItem::UserType + 53,
|
2025-10-11 18:51:33 +08:00
|
|
|
|
GIT_ctItem= QGraphicsItem::UserType + 54,
|
|
|
|
|
|
GIT_ctGroup= QGraphicsItem::UserType + 55,
|
2025-10-17 18:14:44 +08:00
|
|
|
|
GIT_ptItem= QGraphicsItem::UserType + 56,
|
|
|
|
|
|
GIT_ptGroup= QGraphicsItem::UserType + 57,
|
|
|
|
|
|
GIT_ES= QGraphicsItem::UserType + 58,
|
|
|
|
|
|
GIT_DS= QGraphicsItem::UserType + 59,
|
|
|
|
|
|
GIT_FES= QGraphicsItem::UserType + 60,
|
|
|
|
|
|
GIT_DTEDS= QGraphicsItem::UserType + 61,
|
|
|
|
|
|
GIT_PI= QGraphicsItem::UserType + 62,
|
|
|
|
|
|
GIT_LA= QGraphicsItem::UserType + 63,
|
|
|
|
|
|
GIT_cableTer= QGraphicsItem::UserType + 64,
|
|
|
|
|
|
GIT_cableEnd= QGraphicsItem::UserType + 65,
|
|
|
|
|
|
GIT_2wTransformer= QGraphicsItem::UserType + 66,
|
|
|
|
|
|
GIT_3wTransformer= QGraphicsItem::UserType + 67,
|
2025-10-11 18:51:33 +08:00
|
|
|
|
GIT_node= QGraphicsItem::UserType + 79,
|
|
|
|
|
|
GIT_bay= QGraphicsItem::UserType + 80, //间隔
|
2025-06-13 19:00:05 +08:00
|
|
|
|
//======================================
|
2025-08-25 12:02:15 +08:00
|
|
|
|
GIT_baseNode = QGraphicsItem::UserType + 199,
|
2025-06-13 19:00:05 +08:00
|
|
|
|
GIT_baseBus = QGraphicsItem::UserType + 200,
|
|
|
|
|
|
GIT_baseLine = QGraphicsItem::UserType + 201,
|
2025-08-28 10:59:04 +08:00
|
|
|
|
GIT_baseBreaker = QGraphicsItem::UserType + 202,
|
|
|
|
|
|
GIT_baseCT = QGraphicsItem::UserType + 203,
|
|
|
|
|
|
GIT_basePT = QGraphicsItem::UserType + 204,
|
2025-10-11 18:51:33 +08:00
|
|
|
|
GIT_baseDS = QGraphicsItem::UserType + 205, //隔离开关
|
|
|
|
|
|
GIT_baseES = QGraphicsItem::UserType + 206, //接地开关
|
|
|
|
|
|
GIT_baseFES = QGraphicsItem::UserType + 207, //快速接地
|
|
|
|
|
|
GIT_baseDTEDS = QGraphicsItem::UserType + 208, //双掷接地隔离开关
|
|
|
|
|
|
GIT_basePI = QGraphicsItem::UserType + 209, //带电指示器
|
|
|
|
|
|
GIT_baseLightningArrester = QGraphicsItem::UserType + 210, //避雷器
|
|
|
|
|
|
GIT_baseCableTer = QGraphicsItem::UserType + 211, //电缆出线套筒
|
|
|
|
|
|
GIT_baseCableEnd = QGraphicsItem::UserType + 212,
|
|
|
|
|
|
GIT_base2wTransformer = QGraphicsItem::UserType + 213, //两绕阻变压器
|
|
|
|
|
|
GIT_base3wTransformer = QGraphicsItem::UserType + 214, //三绕组变压器
|
2024-12-03 20:07:25 +08:00
|
|
|
|
};
|
2025-02-06 16:36:50 +08:00
|
|
|
|
|
2025-03-21 12:53:45 +08:00
|
|
|
|
enum AbstractItemType //工程模关联的对象类型
|
|
|
|
|
|
{
|
2025-04-09 16:20:34 +08:00
|
|
|
|
AIT_motor = 1,
|
|
|
|
|
|
AIT_bus
|
2025-03-28 18:08:21 +08:00
|
|
|
|
};
|
2025-03-21 12:53:45 +08:00
|
|
|
|
|
2025-06-13 19:00:05 +08:00
|
|
|
|
enum class ModelFunctionType //模型函数的类型
|
|
|
|
|
|
{
|
|
|
|
|
|
ProjectModel = 0,
|
2025-08-25 12:02:15 +08:00
|
|
|
|
BaseModel,
|
|
|
|
|
|
EditorModel,
|
|
|
|
|
|
BlockEditorModel //模块划分时的连接关系
|
2025-06-13 19:00:05 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
2025-07-24 10:01:31 +08:00
|
|
|
|
|
|
|
|
|
|
extern const QMap<AbstractItemType,GraphicsItemType> linkType;
|
|
|
|
|
|
//类型转换
|
|
|
|
|
|
extern const QMap<int,GraphicsItemType> typeToProGraphic;
|
2025-03-21 12:53:45 +08:00
|
|
|
|
|
2025-02-06 16:36:50 +08:00
|
|
|
|
enum DiagramMode //组态图模式
|
|
|
|
|
|
{
|
|
|
|
|
|
DM_edit = 0,
|
2025-05-16 19:20:46 +08:00
|
|
|
|
DM_run,
|
2025-06-13 19:00:05 +08:00
|
|
|
|
DM_academic,
|
|
|
|
|
|
DM_baseModel
|
2025-05-16 19:20:46 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
enum VariantIcon //变种图
|
|
|
|
|
|
{
|
|
|
|
|
|
VI_thumbnail = 0,
|
|
|
|
|
|
VI_normal_1,
|
|
|
|
|
|
VI_normal_2,
|
|
|
|
|
|
VI_normal_3,
|
|
|
|
|
|
VI_normal_4,
|
|
|
|
|
|
VI_normal_5
|
2025-02-06 16:36:50 +08:00
|
|
|
|
};
|
2025-03-04 09:44:03 +08:00
|
|
|
|
|
|
|
|
|
|
enum Attribute //元模属性字段对照
|
|
|
|
|
|
{
|
|
|
|
|
|
Id = Qt::UserRole + 1,
|
|
|
|
|
|
Attribute = Qt::UserRole + 2,
|
2025-03-21 12:53:45 +08:00
|
|
|
|
AttributeName = Qt::UserRole + 3,
|
|
|
|
|
|
DataType = Qt::UserRole + 4,
|
|
|
|
|
|
LengthPrecision = Qt::UserRole + 5,
|
|
|
|
|
|
Scale = Qt::UserRole + 6,
|
|
|
|
|
|
IsNotNull = Qt::UserRole + 7,
|
|
|
|
|
|
DefaultValue = Qt::UserRole + 8,
|
|
|
|
|
|
ValueRange = Qt::UserRole + 9,
|
2025-05-23 10:30:52 +08:00
|
|
|
|
IsVisible = Qt::UserRole + 10
|
2025-03-21 12:53:45 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
2025-04-17 16:51:20 +08:00
|
|
|
|
enum TableDelegateContent //代理内容
|
|
|
|
|
|
{
|
|
|
|
|
|
TD_ProjectModel = 0, //工程模
|
|
|
|
|
|
TD_MetaModel, //基模
|
|
|
|
|
|
TD_ComponentType //元件类型
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
enum SelectorDialogType //选择dialog类型
|
|
|
|
|
|
{
|
|
|
|
|
|
ST_MetaModel = 0, //元模对话框
|
|
|
|
|
|
ST_ComponentType //元件选择
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
enum TableItemState //工程模table操作的对象状态
|
|
|
|
|
|
{
|
|
|
|
|
|
TS_create = 1,
|
|
|
|
|
|
TS_select = 2,
|
|
|
|
|
|
TS_edit = 4
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-04-30 16:29:17 +08:00
|
|
|
|
enum class AlertInfo //警告提示信息
|
|
|
|
|
|
{
|
|
|
|
|
|
success = 1,
|
|
|
|
|
|
fail = 2,
|
|
|
|
|
|
exist = 4
|
|
|
|
|
|
};
|
2025-04-17 16:51:20 +08:00
|
|
|
|
|
2025-03-21 12:53:45 +08:00
|
|
|
|
struct attributeGroup //属性组(元模)
|
|
|
|
|
|
{
|
|
|
|
|
|
int id = 0;
|
|
|
|
|
|
QString groupType;
|
|
|
|
|
|
QString groupName;
|
2025-04-30 16:29:17 +08:00
|
|
|
|
int ispublic = -1;
|
2025-03-21 12:53:45 +08:00
|
|
|
|
QString remark;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct dataType //数据类型(元模)
|
|
|
|
|
|
{
|
|
|
|
|
|
int id = 0;
|
|
|
|
|
|
QString dataType;
|
|
|
|
|
|
QString databaseType;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct modelType //模型类型
|
|
|
|
|
|
{
|
|
|
|
|
|
int id = 0;
|
|
|
|
|
|
QString modelType;
|
|
|
|
|
|
QString modelName;
|
2025-06-20 18:09:41 +08:00
|
|
|
|
int graphicEelement; //类型
|
|
|
|
|
|
QByteArray icon; //图片
|
2025-03-21 12:53:45 +08:00
|
|
|
|
QString remark;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct modelGroup
|
|
|
|
|
|
{
|
|
|
|
|
|
int id = 0;
|
|
|
|
|
|
qint64 modelTypeId = 0;
|
|
|
|
|
|
qint64 attributeGroupId = 0;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct attribute //属性表(元模属性字段)
|
|
|
|
|
|
{
|
|
|
|
|
|
int id = 0;
|
|
|
|
|
|
QString attribute; //属性名
|
|
|
|
|
|
QString attributeName; //别名(中文名)
|
|
|
|
|
|
qint64 dataTypeId = 0; //数据类型id
|
|
|
|
|
|
int lengthPrecision=0; //长度限制(varchar)
|
|
|
|
|
|
int scale=0; //小数点位数
|
|
|
|
|
|
int isNotNull=0; //是否非空
|
|
|
|
|
|
QString defaultValue; //默认值
|
|
|
|
|
|
QString valueRange; //数值范围
|
2025-05-23 10:30:52 +08:00
|
|
|
|
int isVisible = 1;
|
2025-03-21 12:53:45 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct modelAttribute //模型属性表(所有模型属性的索引)
|
|
|
|
|
|
{
|
|
|
|
|
|
int id = 0;
|
|
|
|
|
|
qint64 modelTypeId = 0;
|
|
|
|
|
|
qint64 attributeGroupId = 0;
|
|
|
|
|
|
qint64 attributeId = 0;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-04-30 16:29:17 +08:00
|
|
|
|
struct modelAttributePublic //公共属性表
|
|
|
|
|
|
{
|
|
|
|
|
|
int id = 0;
|
|
|
|
|
|
qint64 attributeGroupId = 0;
|
|
|
|
|
|
qint64 attributeId = 0;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-03-21 12:53:45 +08:00
|
|
|
|
struct modelConnectivity //模型连接性表(元模是否可以连接)
|
|
|
|
|
|
{
|
|
|
|
|
|
int id = 0;
|
|
|
|
|
|
QString fromModel; //属性名
|
|
|
|
|
|
QString toModel;
|
|
|
|
|
|
int connectivity=0; //是否可连
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//=====================================
|
|
|
|
|
|
struct projectManager //工程模管理类
|
|
|
|
|
|
{
|
|
|
|
|
|
int id = 0;
|
|
|
|
|
|
QString name; //工程模表名
|
|
|
|
|
|
QString tag; //工程模名称
|
|
|
|
|
|
QString metaModel; //元模名
|
|
|
|
|
|
QString groupName; //属性组名
|
|
|
|
|
|
int linkType; //图元链接类型
|
|
|
|
|
|
QJsonObject checkState; //属性选择状态
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-06-27 19:17:04 +08:00
|
|
|
|
struct projectModelSetting //工程模设定类,如图标
|
|
|
|
|
|
{
|
|
|
|
|
|
QString modelName; //工程模名
|
|
|
|
|
|
QMap<QString,QByteArray> mapSvg; //存放选择的svg图片
|
2025-10-17 18:14:44 +08:00
|
|
|
|
QMap<QString,QByteArray> mapUsedSvg; //存放使用的svg
|
2025-06-27 19:17:04 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
2025-06-13 19:00:05 +08:00
|
|
|
|
/*struct baseModelSelectManger
|
|
|
|
|
|
{
|
|
|
|
|
|
int id = 0;
|
|
|
|
|
|
QUuid componentId;
|
|
|
|
|
|
QString componentTag;
|
|
|
|
|
|
int pageId;
|
|
|
|
|
|
int version;
|
|
|
|
|
|
QJsonObject checkState;
|
|
|
|
|
|
};*/
|
|
|
|
|
|
|
2025-06-06 18:57:37 +08:00
|
|
|
|
enum projectState
|
|
|
|
|
|
{
|
|
|
|
|
|
Err = -1,
|
|
|
|
|
|
NotExist = 0,
|
|
|
|
|
|
Exist,
|
|
|
|
|
|
Changed
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct FormerName //曾用名,记录修改前名称
|
|
|
|
|
|
{
|
|
|
|
|
|
QString sName;
|
|
|
|
|
|
bool bChanged = false; //是否改变过
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct PropertyState //每个属性的状态
|
|
|
|
|
|
{
|
|
|
|
|
|
bool checkState = false;
|
|
|
|
|
|
QString dataType;
|
|
|
|
|
|
bool editable = true; //可勾选状态
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct PropertyPage //属性信息
|
|
|
|
|
|
{
|
|
|
|
|
|
QMap<QString,PropertyState> mCheckState; //属性选择状态
|
|
|
|
|
|
bool isPublic = false;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
typedef QMap<QString,PropertyPage> MapProperty; //属性组
|
|
|
|
|
|
struct PropertyModel //工程模
|
|
|
|
|
|
{
|
|
|
|
|
|
MapProperty mapProperty;
|
|
|
|
|
|
int nType = 0; //工程模类型,选择图标后确定
|
2025-06-27 19:17:04 +08:00
|
|
|
|
QStandardItemModel* pBase = nullptr; //基础属性
|
|
|
|
|
|
QStandardItemModel* pSelect = nullptr; //已选择属性
|
2025-06-06 18:57:37 +08:00
|
|
|
|
FormerName formerMeta; //曾用元模名
|
2025-06-27 19:17:04 +08:00
|
|
|
|
FormerName formerProject; //曾用工程模名
|
2025-06-06 18:57:37 +08:00
|
|
|
|
QMap<QString,projectManager> dataInfo; //存放数据库内容
|
2025-06-27 19:17:04 +08:00
|
|
|
|
projectModelSetting modelSetting;
|
|
|
|
|
|
PropertyModel deepCopy() //深拷贝
|
|
|
|
|
|
{
|
|
|
|
|
|
PropertyModel copy;
|
|
|
|
|
|
copy.mapProperty = mapProperty;
|
2025-10-17 18:14:44 +08:00
|
|
|
|
copy.nType = nType;
|
2025-06-27 19:17:04 +08:00
|
|
|
|
copy.pBase = deepCloneModel(pBase);
|
|
|
|
|
|
copy.pSelect = deepCloneModel(pSelect);
|
|
|
|
|
|
copy.formerMeta = formerMeta;
|
|
|
|
|
|
copy.formerProject = formerProject;
|
|
|
|
|
|
copy.dataInfo = dataInfo;
|
|
|
|
|
|
copy.modelSetting = modelSetting;
|
|
|
|
|
|
return copy;
|
|
|
|
|
|
}
|
|
|
|
|
|
void release()
|
|
|
|
|
|
{
|
|
|
|
|
|
delete pBase;
|
|
|
|
|
|
delete pSelect;
|
|
|
|
|
|
pBase = nullptr;
|
|
|
|
|
|
pSelect = nullptr;
|
|
|
|
|
|
}
|
2025-06-06 18:57:37 +08:00
|
|
|
|
};
|
|
|
|
|
|
typedef QMap<QString,PropertyModel> MapProject; //str为工程名,PropertyModel为工程属性
|
|
|
|
|
|
typedef QMap<QString,MapProject> MapMeta; //str为元模名,PropertyModel为工程模集
|
|
|
|
|
|
|
2025-03-28 18:08:21 +08:00
|
|
|
|
//=====================================
|
|
|
|
|
|
struct propertyGroupState //模型属性组信息
|
|
|
|
|
|
{
|
|
|
|
|
|
QString groupName; //属性组名称
|
|
|
|
|
|
QString tableName; //属性组表名
|
|
|
|
|
|
QJsonObject propertyState; //属性状态信息
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//================工程模使用======================
|
|
|
|
|
|
|
|
|
|
|
|
struct propertyStateInfo //属性
|
|
|
|
|
|
{
|
|
|
|
|
|
QString name; //属性名
|
|
|
|
|
|
QString tagName; //别名
|
|
|
|
|
|
QString type; //属性类型
|
2025-04-03 18:33:10 +08:00
|
|
|
|
QVariant defaultValue; //默认值
|
|
|
|
|
|
int lengthPrecision = 999; //长度限制
|
2025-07-18 18:26:13 +08:00
|
|
|
|
int isVisibe = 1; //是否可见(0:不可见,1:可见,2:特殊项)
|
|
|
|
|
|
bool lock = false; //值手动改变时置true,下次保存时恢复
|
2025-03-28 18:08:21 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
2025-05-23 10:30:52 +08:00
|
|
|
|
Q_DECLARE_METATYPE(propertyStateInfo);
|
|
|
|
|
|
|
2025-03-28 18:08:21 +08:00
|
|
|
|
typedef QMap<QString,propertyStateInfo> PropertyValueInfo;
|
|
|
|
|
|
|
|
|
|
|
|
struct groupStateInfo //属性组(结构信息)
|
|
|
|
|
|
{
|
|
|
|
|
|
QString groupName; //组名
|
|
|
|
|
|
QString tableName; //表名
|
2025-04-30 16:29:17 +08:00
|
|
|
|
bool isPublic = false;;
|
2025-03-28 18:08:21 +08:00
|
|
|
|
PropertyValueInfo info; //属性信息
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct groupStateValue //属性组(实时数据)
|
|
|
|
|
|
{
|
|
|
|
|
|
QString groupName; //组名
|
|
|
|
|
|
QString tableName; //表名
|
|
|
|
|
|
QMap<QUuid,PropertyValueInfo> mapInfo;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct modelStateInfo //模型结构信息
|
|
|
|
|
|
{
|
|
|
|
|
|
QString modelName;
|
|
|
|
|
|
int modelType;
|
2025-04-03 18:33:10 +08:00
|
|
|
|
QWidget* _PropertyDlg = NULL; //属性设置界面,每个模型维护一种界面
|
2025-03-28 18:08:21 +08:00
|
|
|
|
QMap<QString,groupStateInfo> groupInfo; //属性组信息
|
2025-04-30 16:29:17 +08:00
|
|
|
|
void release()
|
|
|
|
|
|
{
|
|
|
|
|
|
if(_PropertyDlg)
|
|
|
|
|
|
delete _PropertyDlg;
|
|
|
|
|
|
}
|
2025-03-28 18:08:21 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct modelDataInfo //模型数据信息
|
|
|
|
|
|
{
|
|
|
|
|
|
QString modelName;
|
|
|
|
|
|
int modelType;
|
|
|
|
|
|
QMap<QString,groupStateValue> groupInfo; //属性组实时信息
|
|
|
|
|
|
};
|
2025-04-03 18:33:10 +08:00
|
|
|
|
|
|
|
|
|
|
struct propertyContentInfo //单个属性结构
|
|
|
|
|
|
{
|
|
|
|
|
|
QString proName; //名称
|
|
|
|
|
|
QString proType; //类型
|
|
|
|
|
|
QWidget* proEditer = NULL; //编辑窗口对象
|
|
|
|
|
|
};
|
2025-04-22 10:10:55 +08:00
|
|
|
|
|
2025-07-04 18:47:49 +08:00
|
|
|
|
struct measureAttributeType //量测可用属性类型(从基模获取的占位符变量)
|
|
|
|
|
|
{
|
|
|
|
|
|
QString tag;
|
|
|
|
|
|
QString name;
|
|
|
|
|
|
};
|
2025-04-30 16:29:17 +08:00
|
|
|
|
//==================组态拓扑结构======================
|
2025-05-16 19:20:46 +08:00
|
|
|
|
enum class DataState
|
|
|
|
|
|
{
|
|
|
|
|
|
unchanged = 0,
|
|
|
|
|
|
changed,
|
|
|
|
|
|
prepareDelete
|
|
|
|
|
|
};
|
2025-04-30 16:29:17 +08:00
|
|
|
|
/*struct diagramInfo
|
|
|
|
|
|
{
|
|
|
|
|
|
QString name;
|
|
|
|
|
|
QString uuid;
|
|
|
|
|
|
QMap<QString,diagramInfo> childMap;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct stationInfo
|
|
|
|
|
|
{
|
|
|
|
|
|
QString stationName;
|
|
|
|
|
|
QString uuid;
|
|
|
|
|
|
QMap<QString,diagramInfo> diagramMap;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct zoneInfo
|
|
|
|
|
|
{
|
|
|
|
|
|
QString zoneName;
|
|
|
|
|
|
QString uuid;
|
|
|
|
|
|
QMap<QString,stationInfo> stationMap;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct gridInfo //grid
|
|
|
|
|
|
{
|
|
|
|
|
|
QString gridName;
|
|
|
|
|
|
QString uuid;
|
|
|
|
|
|
QMap<QString,zoneInfo> zoneMap;
|
|
|
|
|
|
};*/
|
2025-05-30 16:28:51 +08:00
|
|
|
|
//===================组态编辑器使用================
|
2025-07-31 19:38:06 +08:00
|
|
|
|
const int g_transformerLevel = 999; //层级结构中变压器所处层级
|
2025-07-22 12:03:43 +08:00
|
|
|
|
|
2025-07-25 19:42:20 +08:00
|
|
|
|
struct DiagramEditorWizardBusInfo //组态编辑母线信息
|
2025-07-22 12:03:43 +08:00
|
|
|
|
{
|
|
|
|
|
|
int nIndex = 0;
|
2025-07-25 19:42:20 +08:00
|
|
|
|
double dVoltage = 0; //电压等级
|
2025-07-22 12:03:43 +08:00
|
|
|
|
int nLineType = 1; //1单母线,2双母线
|
2025-07-25 19:42:20 +08:00
|
|
|
|
int nNum1 = 0; //1母
|
|
|
|
|
|
int nNum2 = 0; //2母
|
2025-07-22 12:03:43 +08:00
|
|
|
|
int connectType = 0; //接线方式,1为分段连接
|
2025-07-29 20:15:18 +08:00
|
|
|
|
bool bChanged = false; //是否改变
|
2025-10-24 21:11:07 +08:00
|
|
|
|
|
|
|
|
|
|
friend QDataStream &operator<<(QDataStream &out, const DiagramEditorWizardBusInfo &data) {
|
|
|
|
|
|
out << data.nIndex << data.dVoltage << data.nLineType << data.nNum1 << data.nNum2 << data.connectType << data.bChanged;
|
|
|
|
|
|
return out;
|
|
|
|
|
|
}
|
|
|
|
|
|
friend QDataStream &operator>>(QDataStream &in, DiagramEditorWizardBusInfo &data) {
|
|
|
|
|
|
in >> data.nIndex >> data.dVoltage >> data.nLineType >> data.nNum1 >> data.nNum2 >> data.connectType >> data.bChanged;
|
|
|
|
|
|
return in;
|
|
|
|
|
|
}
|
2025-05-30 16:28:51 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
2025-07-31 19:38:06 +08:00
|
|
|
|
enum class TransformerType //变压器类型
|
|
|
|
|
|
{
|
|
|
|
|
|
twoWinding = 0, //两绕组
|
|
|
|
|
|
threeWinding //三绕组
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-07-25 19:42:20 +08:00
|
|
|
|
enum class BayType //间隔类型
|
|
|
|
|
|
{
|
|
|
|
|
|
busSectionBay = 0, //分段
|
|
|
|
|
|
busCouplerBay, //母联
|
|
|
|
|
|
ptBay, //pt
|
|
|
|
|
|
incomingBay, //进线
|
|
|
|
|
|
outcomingBay, //出线
|
|
|
|
|
|
compensationBay, //无功补偿
|
|
|
|
|
|
bypassBay, //旁路
|
|
|
|
|
|
mainTransformerBay //主变
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-07-31 19:38:06 +08:00
|
|
|
|
enum class EditorItemType //组态编辑中的图形项类型
|
|
|
|
|
|
{
|
2025-09-05 17:30:07 +08:00
|
|
|
|
bus = 1, //母线
|
2025-07-31 19:38:06 +08:00
|
|
|
|
bay, //间隔
|
2025-08-08 17:47:31 +08:00
|
|
|
|
trans, //变压器
|
|
|
|
|
|
line, //连接线
|
2025-08-06 20:10:10 +08:00
|
|
|
|
none //空白占位图
|
2025-07-31 19:38:06 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
2025-08-15 18:21:20 +08:00
|
|
|
|
struct EditorTransConnection //组态变压器连接信息
|
|
|
|
|
|
{
|
|
|
|
|
|
QString sName;
|
|
|
|
|
|
int nPara = 0; //012,高中低侧
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-07-31 19:38:06 +08:00
|
|
|
|
struct DiagramEditorWizardTransformerInfo //组态变压器信息
|
|
|
|
|
|
{
|
|
|
|
|
|
QString sName;
|
|
|
|
|
|
TransformerType nType;
|
2025-08-15 18:21:20 +08:00
|
|
|
|
QList<EditorTransConnection> lstBindObj; //连接的对象
|
2025-07-31 19:38:06 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
2025-07-25 19:42:20 +08:00
|
|
|
|
struct DiagramEditorWizardBayInfo //组态间隔信息
|
|
|
|
|
|
{
|
|
|
|
|
|
QString sName;
|
|
|
|
|
|
BayType nType;
|
|
|
|
|
|
QList<QString> lstBindObj; //连接的对象
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-08-15 18:21:20 +08:00
|
|
|
|
struct DiagramEditorComponentInfo //组态设备信息
|
|
|
|
|
|
{
|
|
|
|
|
|
int nCategory = 0; //分类 0电气设备1连接关系
|
|
|
|
|
|
QString sName;
|
|
|
|
|
|
int nType = 0; //类型 1母线2异步电动机3断路器4电缆5电流互感器6电压互感器7隔离开关8接地开关9快速接地开关10双掷接地隔离开关11带电指示器12避雷器13电缆出线套筒14电缆端
|
2025-09-19 18:11:28 +08:00
|
|
|
|
QString sBindObj; //所关联的实体名 (母线block,间隔block,变压器高中低端子)
|
2025-09-12 17:28:47 +08:00
|
|
|
|
int nBindType = 0; //关联实体的类型 1母线2间隔3变压器
|
2025-09-19 18:11:28 +08:00
|
|
|
|
int nBindPara = 0; //关联额外参数,关联变压器时为(0高1中2低)
|
|
|
|
|
|
QString sBindParent; //关联父item名,关联变压器时为变压器名
|
2025-08-15 18:21:20 +08:00
|
|
|
|
QStringList sUsedRoute; //使用设备的线路名
|
2025-08-25 12:02:15 +08:00
|
|
|
|
int nUsedDirection = 0; //被占用的方向 8421 上下左右
|
|
|
|
|
|
QPoint deltaPos = QPoint(0,0); //相对坐标(相对间隔)
|
2025-08-28 10:59:04 +08:00
|
|
|
|
QUuid uid;
|
|
|
|
|
|
int nFlag = 0; //标志0未使用1新建2修改
|
|
|
|
|
|
int nRotate = 0; //旋转角
|
2025-09-12 17:28:47 +08:00
|
|
|
|
|
|
|
|
|
|
bool operator ==(const DiagramEditorComponentInfo& obj) const {
|
|
|
|
|
|
if(nCategory == obj.nCategory && sName == obj.sName && nType == obj.nType && sBindObj == obj.sBindObj && nBindType == obj.nBindType &&
|
|
|
|
|
|
sUsedRoute == obj.sUsedRoute && nUsedDirection == obj.nUsedDirection && deltaPos == obj.deltaPos && uid == obj.uid && nFlag == obj.nFlag && nRotate == obj.nRotate)
|
|
|
|
|
|
return true;
|
|
|
|
|
|
else
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
2025-10-24 21:11:07 +08:00
|
|
|
|
|
|
|
|
|
|
friend QDataStream &operator<<(QDataStream &out, const DiagramEditorComponentInfo &data) {
|
|
|
|
|
|
out << data.nCategory << data.sName << data.nType << data.sBindObj << data.nBindType << data.nBindPara << data.sBindParent << data.sUsedRoute << data.nUsedDirection << data.deltaPos << data.uid << data.nFlag << data.nRotate;
|
|
|
|
|
|
return out;
|
|
|
|
|
|
}
|
|
|
|
|
|
friend QDataStream &operator>>(QDataStream &in, DiagramEditorComponentInfo &data) {
|
|
|
|
|
|
in >> data.nCategory >> data.sName >> data.nType >> data.sBindObj >> data.nBindType >> data.nBindPara >> data.sBindParent >> data.sUsedRoute >> data.nUsedDirection >> data.deltaPos >> data.uid >> data.nFlag >> data.nRotate;
|
|
|
|
|
|
return in;
|
|
|
|
|
|
}
|
2025-08-15 18:21:20 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
2025-09-19 18:11:28 +08:00
|
|
|
|
inline uint qHash(const DiagramEditorComponentInfo &key, uint seed = 0) {
|
|
|
|
|
|
return qHash(key.uid, seed);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-05 17:30:07 +08:00
|
|
|
|
struct DiagramEditorRouteInfo //间隔中单条线路信息
|
2025-08-15 18:21:20 +08:00
|
|
|
|
{
|
|
|
|
|
|
QString sRouteName;
|
2025-08-25 12:02:15 +08:00
|
|
|
|
bool bMainRoute = false; //主线路(包含设备最多的线路,决定整体布局)
|
|
|
|
|
|
QList<DiagramEditorComponentInfo> lstCompo;
|
|
|
|
|
|
QList<DiagramEditorComponentInfo> lstOrder; //线路顺序容器(计算用)
|
|
|
|
|
|
QList<DiagramEditorComponentInfo> lstReverse; //逆序容器(计算用)
|
2025-10-24 21:11:07 +08:00
|
|
|
|
|
|
|
|
|
|
friend QDataStream &operator<<(QDataStream &out, const DiagramEditorRouteInfo &data) {
|
|
|
|
|
|
out << data.sRouteName << data.bMainRoute << data.lstCompo << data.lstOrder << data.lstReverse;
|
|
|
|
|
|
return out;
|
|
|
|
|
|
}
|
|
|
|
|
|
friend QDataStream &operator>>(QDataStream &in, DiagramEditorRouteInfo &data) {
|
|
|
|
|
|
in >> data.sRouteName >> data.bMainRoute >> data.lstCompo >> data.lstOrder >> data.lstReverse;
|
|
|
|
|
|
return in;
|
|
|
|
|
|
}
|
2025-08-15 18:21:20 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
2025-09-12 17:28:47 +08:00
|
|
|
|
struct DiagramEditorBayInfo //组态编辑间隔信息
|
|
|
|
|
|
{
|
2025-09-19 18:11:28 +08:00
|
|
|
|
QString name; //间隔名
|
2025-09-12 17:28:47 +08:00
|
|
|
|
int nLayout; //布局 0纵向1横向
|
2025-10-21 18:46:51 +08:00
|
|
|
|
QList<QUuid> lstFrom; //起始
|
|
|
|
|
|
QList<QUuid> lstTo; //结束
|
2025-09-12 17:28:47 +08:00
|
|
|
|
QMap<QString,DiagramEditorRouteInfo> mapRoute; //线路信息
|
|
|
|
|
|
QMap<QString,DiagramEditorComponentInfo> mapComponent; //设备信息
|
2025-10-24 21:11:07 +08:00
|
|
|
|
|
|
|
|
|
|
friend QDataStream &operator<<(QDataStream &out, const DiagramEditorBayInfo &data) {
|
|
|
|
|
|
out << data.name << data.nLayout << data.lstFrom << data.lstTo << data.mapRoute << data.mapComponent;
|
|
|
|
|
|
return out;
|
|
|
|
|
|
}
|
|
|
|
|
|
friend QDataStream &operator>>(QDataStream &in, DiagramEditorBayInfo &data) {
|
|
|
|
|
|
in >> data.name >> data.nLayout >> data.lstFrom >> data.lstTo >> data.mapRoute >> data.mapComponent;
|
|
|
|
|
|
return in;
|
|
|
|
|
|
}
|
2025-09-12 17:28:47 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
2025-09-19 18:11:28 +08:00
|
|
|
|
struct DiagramEditorTransNeutralInfo //组态编辑变压器中性点信息
|
|
|
|
|
|
{
|
|
|
|
|
|
QString name; //中性点名
|
|
|
|
|
|
int nType = 0; //中性点类型 0高1中2低
|
|
|
|
|
|
QPointF delPoint; //相对变压器偏移量
|
|
|
|
|
|
QMap<QString,DiagramEditorRouteInfo> mapRoute; //中性点对应的线路结构
|
2025-10-24 21:11:07 +08:00
|
|
|
|
|
|
|
|
|
|
friend QDataStream &operator<<(QDataStream &out, const DiagramEditorTransNeutralInfo &data) {
|
|
|
|
|
|
out << data.name << data.nType << data.delPoint << data.mapRoute;
|
|
|
|
|
|
return out;
|
|
|
|
|
|
}
|
|
|
|
|
|
friend QDataStream &operator>>(QDataStream &in, DiagramEditorTransNeutralInfo &data) {
|
|
|
|
|
|
in >> data.name >> data.nType >> data.delPoint >> data.mapRoute;
|
|
|
|
|
|
return in;
|
|
|
|
|
|
}
|
2025-09-19 18:11:28 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct DiagramEditorTransInfo //组态编辑变压器信息
|
|
|
|
|
|
{
|
|
|
|
|
|
QString name; //变压器名
|
|
|
|
|
|
QMap<int,DiagramEditorTransNeutralInfo> mapNeutral; //中性点结构
|
|
|
|
|
|
QMap<QString,DiagramEditorComponentInfo> mapComponent; //设备信息
|
2025-10-24 21:11:07 +08:00
|
|
|
|
|
|
|
|
|
|
friend QDataStream &operator<<(QDataStream &out, const DiagramEditorTransInfo &data) {
|
|
|
|
|
|
out << data.name << data.mapNeutral << data.mapComponent;
|
|
|
|
|
|
return out;
|
|
|
|
|
|
}
|
|
|
|
|
|
friend QDataStream &operator>>(QDataStream &in, DiagramEditorTransInfo &data) {
|
|
|
|
|
|
in >> data.name >> data.mapNeutral >> data.mapComponent;
|
|
|
|
|
|
return in;
|
|
|
|
|
|
}
|
2025-09-19 18:11:28 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
2025-05-30 16:28:51 +08:00
|
|
|
|
enum class DiagramEditorStructType
|
|
|
|
|
|
{
|
2025-07-31 19:38:06 +08:00
|
|
|
|
block = 0, //模块(母线段、间隔、变压器)
|
|
|
|
|
|
blockContainer, //模块容器(包含若干模块)
|
|
|
|
|
|
rowData //行数据(包含若干容器)
|
2025-05-30 16:28:51 +08:00
|
|
|
|
};
|
2025-04-30 16:29:17 +08:00
|
|
|
|
|
2025-07-25 19:42:20 +08:00
|
|
|
|
struct DiagramEditorConnectType //组态编辑连接信息
|
|
|
|
|
|
{
|
|
|
|
|
|
QString sName;
|
2025-08-06 20:10:10 +08:00
|
|
|
|
int nType = 0; //1母线,2间隔,3变压器
|
2025-10-24 21:11:07 +08:00
|
|
|
|
|
|
|
|
|
|
friend QDataStream &operator<<(QDataStream &out, const DiagramEditorConnectType &data) {
|
|
|
|
|
|
out << data.sName << data.nType;
|
|
|
|
|
|
return out;
|
|
|
|
|
|
}
|
|
|
|
|
|
friend QDataStream &operator>>(QDataStream &in, DiagramEditorConnectType &data) {
|
|
|
|
|
|
in >> data.sName >> data.nType;
|
|
|
|
|
|
return in;
|
|
|
|
|
|
}
|
2025-07-25 19:42:20 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct DiagramEditorBriefConnect //组态编辑时连接信息
|
|
|
|
|
|
{
|
2025-08-06 20:10:10 +08:00
|
|
|
|
QUuid uid;
|
2025-07-25 19:42:20 +08:00
|
|
|
|
DiagramEditorConnectType con1;
|
|
|
|
|
|
DiagramEditorConnectType con2;
|
2025-08-15 18:21:20 +08:00
|
|
|
|
int nPara = 0; //万用参数(变压器中表示连接位置,0高压侧,1中压侧,2低压侧)
|
2025-07-25 19:42:20 +08:00
|
|
|
|
|
|
|
|
|
|
bool operator==(const DiagramEditorBriefConnect& obj)
|
|
|
|
|
|
{
|
|
|
|
|
|
if(this == &obj)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
if((con1.sName == obj.con1.sName && con2.sName == obj.con2.sName)||(con1.sName == obj.con2.sName && con2.sName == obj.con1.sName))
|
|
|
|
|
|
return true;
|
|
|
|
|
|
else
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
2025-07-29 20:15:18 +08:00
|
|
|
|
|
2025-10-24 21:11:07 +08:00
|
|
|
|
friend QDataStream &operator<<(QDataStream &out, const DiagramEditorBriefConnect &data) {
|
|
|
|
|
|
out << data.uid << data.con1 << data.con2 << data.nPara;
|
|
|
|
|
|
return out;
|
|
|
|
|
|
}
|
|
|
|
|
|
friend QDataStream &operator>>(QDataStream &in, DiagramEditorBriefConnect &data) {
|
|
|
|
|
|
in >> data.uid >> data.con1 >> data.con2 >> data.nPara;
|
|
|
|
|
|
return in;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-12 17:28:47 +08:00
|
|
|
|
DiagramEditorConnectType getOpposite(const QString& s){ //获取另一端名称
|
2025-07-29 20:15:18 +08:00
|
|
|
|
if(con1.sName == s)
|
2025-09-12 17:28:47 +08:00
|
|
|
|
return con2;
|
2025-07-29 20:15:18 +08:00
|
|
|
|
else if(con2.sName == s)
|
2025-09-12 17:28:47 +08:00
|
|
|
|
return con1;
|
|
|
|
|
|
return DiagramEditorConnectType();
|
2025-07-29 20:15:18 +08:00
|
|
|
|
}
|
2025-07-25 19:42:20 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
2025-10-24 21:11:07 +08:00
|
|
|
|
struct DiagramEditorBlockInfo //组态编辑block信息
|
|
|
|
|
|
{
|
|
|
|
|
|
QString sName;
|
|
|
|
|
|
QString sContainerId; //所属的容器id
|
|
|
|
|
|
int nType; //1母线,2间隔,3变压器
|
|
|
|
|
|
int nContainerLevel; //所处容器的层级 0,1,2,3
|
|
|
|
|
|
QUuid uid;
|
|
|
|
|
|
QList<QUuid> _lstCon; //连接信息
|
|
|
|
|
|
QRectF recSize; //当前大小(根据内容确定)
|
|
|
|
|
|
QPointF sceneDelta; //block中心相对位移(计算布局位置
|
|
|
|
|
|
bool bEditState; //详细编辑状态
|
|
|
|
|
|
|
|
|
|
|
|
//bus
|
|
|
|
|
|
float fVoltage; //母线电压
|
|
|
|
|
|
int nBusType; //0无前缀,1:Ⅰ母,2Ⅱ母
|
|
|
|
|
|
int nIndex; //第几段,1A,2B,3C,4D,5E,6F,7G,8H
|
|
|
|
|
|
//bay
|
|
|
|
|
|
BayType nBayType;
|
|
|
|
|
|
DiagramEditorBayInfo bayInfo; //间隔信息
|
|
|
|
|
|
//transformer
|
|
|
|
|
|
TransformerType nTransType;
|
|
|
|
|
|
DiagramEditorTransInfo transInfo;
|
|
|
|
|
|
|
|
|
|
|
|
friend QDataStream &operator<<(QDataStream &out, const DiagramEditorBlockInfo &data) {
|
|
|
|
|
|
out << data.sName << data.sContainerId << data.nType << data.nContainerLevel << data.uid << data._lstCon << data.recSize << data.sceneDelta
|
|
|
|
|
|
<< data.bEditState << data.fVoltage << data.nBusType << data.nIndex << data.nBayType << data.bayInfo << data.nTransType << data.transInfo;
|
|
|
|
|
|
return out;
|
|
|
|
|
|
}
|
|
|
|
|
|
friend QDataStream &operator>>(QDataStream &in, DiagramEditorBlockInfo &data) {
|
|
|
|
|
|
in >> data.sName >> data.sContainerId >> data.nType >> data.nContainerLevel >> data.uid >> data._lstCon >> data.recSize >> data.sceneDelta
|
|
|
|
|
|
>> data.bEditState >> data.fVoltage >> data.nBusType >> data.nIndex >> data.nBayType >> data.bayInfo >> data.nTransType >> data.transInfo;
|
|
|
|
|
|
return in;
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct DiagramEditorContainerInfo //组态编辑容器信息
|
|
|
|
|
|
{
|
|
|
|
|
|
QString sId;
|
|
|
|
|
|
double dMidUpY; //1母上边界
|
|
|
|
|
|
double dMidDownY; //2母下边界
|
|
|
|
|
|
double dStartX; //起始x
|
|
|
|
|
|
double dStartY; //起始y
|
|
|
|
|
|
double dWidth; //宽度
|
|
|
|
|
|
double dHeight;
|
|
|
|
|
|
double dMaxUpH; //上方最大高度(1母线到上边界)
|
|
|
|
|
|
double dMaxDownH; //下方最大高度(2母线到下边界)
|
|
|
|
|
|
QMap<int,QList<DiagramEditorBlockInfo>> mapBlockInfo;
|
|
|
|
|
|
|
|
|
|
|
|
friend QDataStream &operator<<(QDataStream &out, const DiagramEditorContainerInfo &data) {
|
|
|
|
|
|
out << data.sId << data.dMidUpY << data.dMidDownY << data.dStartX << data.dStartY << data.dWidth << data.dHeight << data.dMaxUpH << data.dMaxDownH << data.mapBlockInfo;
|
|
|
|
|
|
return out;
|
|
|
|
|
|
}
|
|
|
|
|
|
friend QDataStream &operator>>(QDataStream &in, DiagramEditorContainerInfo &data) {
|
|
|
|
|
|
in >> data.sId >> data.dMidUpY >> data.dMidDownY >> data.dStartX >> data.dStartY >> data.dWidth >> data.dHeight >> data.dMaxUpH >> data.dMaxDownH >> data.mapBlockInfo;
|
|
|
|
|
|
return in;
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct DiagramEditorProjectInfo //editor工程信息
|
|
|
|
|
|
{
|
|
|
|
|
|
QString sName;
|
|
|
|
|
|
QUuid uid;
|
|
|
|
|
|
QMap<int,DiagramEditorWizardBusInfo> mapBus;
|
|
|
|
|
|
QMap<int,QList<DiagramEditorContainerInfo>> mapSturctContainer;
|
|
|
|
|
|
QMap<QUuid,DiagramEditorBriefConnect> mapConnect;
|
|
|
|
|
|
|
|
|
|
|
|
friend QDataStream &operator<<(QDataStream &out, const DiagramEditorProjectInfo &data) {
|
|
|
|
|
|
out << data.sName << data.uid << data.mapBus << data.mapSturctContainer << data.mapConnect;
|
|
|
|
|
|
return out;
|
|
|
|
|
|
}
|
|
|
|
|
|
friend QDataStream &operator>>(QDataStream &in, DiagramEditorProjectInfo &data) {
|
|
|
|
|
|
in >> data.sName >> data.uid >> data.mapBus >> data.mapSturctContainer >> data.mapConnect;
|
|
|
|
|
|
return in;
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-04-22 10:10:55 +08:00
|
|
|
|
//==================组态图使用=====================
|
2025-06-13 19:00:05 +08:00
|
|
|
|
enum HandleType
|
|
|
|
|
|
{
|
|
|
|
|
|
T_none = 0,
|
|
|
|
|
|
T_resize, //调整大小
|
|
|
|
|
|
T_rotate, //旋转
|
|
|
|
|
|
T_editShape, //编辑形状
|
|
|
|
|
|
T_text, //文本
|
|
|
|
|
|
T_lineIn, //入线口
|
|
|
|
|
|
T_lineOut, //出线口
|
2025-09-05 17:30:07 +08:00
|
|
|
|
T_lineInOut, //双端线
|
|
|
|
|
|
T_newTral //中性点
|
2025-06-13 19:00:05 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
enum HandleTag
|
|
|
|
|
|
{
|
|
|
|
|
|
H_none = 0,
|
|
|
|
|
|
H_leftTop,
|
|
|
|
|
|
H_top,
|
|
|
|
|
|
H_rightTop,
|
|
|
|
|
|
H_right,
|
|
|
|
|
|
H_rightBottom,
|
|
|
|
|
|
H_bottom,
|
|
|
|
|
|
H_leftBottom,
|
|
|
|
|
|
H_left, //8
|
|
|
|
|
|
H_rotate_leftTop,
|
|
|
|
|
|
H_rotate_rightTop,
|
|
|
|
|
|
H_rotate_rightBottom,
|
|
|
|
|
|
H_rotate_leftBottom, //12
|
|
|
|
|
|
H_edit,
|
|
|
|
|
|
H_textCaption = 40, //标题文本
|
|
|
|
|
|
H_textCurrent, //电流
|
|
|
|
|
|
h_textVoltage, //电压
|
|
|
|
|
|
H_connect = 50 //连接操作点从50开始,前面预留
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
enum PortPos
|
|
|
|
|
|
{
|
|
|
|
|
|
P_top = 0,
|
|
|
|
|
|
P_down,
|
|
|
|
|
|
P_left,
|
|
|
|
|
|
P_right
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct Connection
|
|
|
|
|
|
{
|
|
|
|
|
|
QUuid nSrcNodeId;
|
|
|
|
|
|
QUuid nSrcPortId;
|
|
|
|
|
|
HandleType srcType;
|
|
|
|
|
|
PortPos srcPos;
|
|
|
|
|
|
QUuid nDestNodeId;
|
|
|
|
|
|
QUuid nDestPortId;
|
|
|
|
|
|
HandleType destType;
|
|
|
|
|
|
PortPos destPos;
|
|
|
|
|
|
|
|
|
|
|
|
Connection()
|
|
|
|
|
|
{
|
|
|
|
|
|
srcType = T_none;
|
|
|
|
|
|
srcPos = P_top;
|
|
|
|
|
|
destType = T_none;
|
|
|
|
|
|
destPos = P_top;
|
2025-07-11 18:13:54 +08:00
|
|
|
|
nSrcNodeId = QUuid();
|
|
|
|
|
|
nSrcPortId = QUuid();
|
|
|
|
|
|
nDestNodeId = QUuid();
|
|
|
|
|
|
nDestPortId = QUuid();
|
2025-06-13 19:00:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Connection(const Connection& obj)
|
|
|
|
|
|
{
|
|
|
|
|
|
nSrcNodeId = obj.nSrcNodeId;
|
|
|
|
|
|
nSrcPortId = obj.nSrcPortId;
|
|
|
|
|
|
srcType = obj.srcType;
|
|
|
|
|
|
srcPos = obj.srcPos;
|
|
|
|
|
|
nDestNodeId = obj.nDestNodeId;
|
|
|
|
|
|
nDestPortId = obj.nDestPortId;
|
|
|
|
|
|
destType = obj.destType;
|
|
|
|
|
|
destPos = obj.destPos;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Connection(QUuid nSNI,QUuid nSPI,HandleType sT,PortPos sPOS,QUuid nDNI,QUuid nDPI,HandleType dT,PortPos dPOS)
|
|
|
|
|
|
{
|
|
|
|
|
|
nSrcNodeId = nSNI;
|
|
|
|
|
|
nSrcPortId = nSPI;
|
|
|
|
|
|
srcType = sT;
|
|
|
|
|
|
srcPos = sPOS;
|
|
|
|
|
|
nDestNodeId = nDNI;
|
|
|
|
|
|
nDestPortId = nDPI;
|
|
|
|
|
|
destType = dT;
|
|
|
|
|
|
destPos = dPOS;
|
|
|
|
|
|
}
|
|
|
|
|
|
bool operator==(const Connection& obj)
|
|
|
|
|
|
{
|
2025-07-11 18:13:54 +08:00
|
|
|
|
return ((nSrcNodeId == obj.nSrcNodeId)&&(nSrcPortId == obj.nSrcPortId)&&(srcType == obj.srcType)&&(nDestNodeId == obj.nDestNodeId)&&(nDestPortId == obj.nDestPortId)&&(destType == obj.destType));
|
2025-06-13 19:00:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Connection& operator=(const Connection& obj)
|
|
|
|
|
|
{
|
2025-07-11 18:13:54 +08:00
|
|
|
|
if(this == &obj)
|
2025-06-13 19:00:05 +08:00
|
|
|
|
return *this;
|
|
|
|
|
|
nSrcNodeId = obj.nSrcNodeId;
|
|
|
|
|
|
nSrcPortId = obj.nSrcPortId;
|
|
|
|
|
|
srcType = obj.srcType;
|
|
|
|
|
|
srcPos = obj.srcPos;
|
|
|
|
|
|
nDestNodeId = obj.nDestNodeId;
|
|
|
|
|
|
nDestPortId = obj.nDestPortId;
|
|
|
|
|
|
destType = obj.destType;
|
|
|
|
|
|
destPos = obj.destPos;
|
|
|
|
|
|
return *this;
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-04-22 10:10:55 +08:00
|
|
|
|
// 基础实体类型(电力元素或组态图)
|
|
|
|
|
|
enum class EntityType {
|
|
|
|
|
|
Grid,
|
|
|
|
|
|
Zone,
|
|
|
|
|
|
Station,
|
|
|
|
|
|
ConfigurationDiagram,
|
2025-05-09 19:36:32 +08:00
|
|
|
|
Component };
|
2025-04-22 10:10:55 +08:00
|
|
|
|
|
2025-04-30 16:29:17 +08:00
|
|
|
|
struct EntityInfo
|
|
|
|
|
|
{
|
|
|
|
|
|
QString sName;
|
|
|
|
|
|
QString sUuid;
|
|
|
|
|
|
QString sParentId;
|
|
|
|
|
|
EntityType eType;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-05-09 19:36:32 +08:00
|
|
|
|
struct DiagramInfo //组态图结构信息
|
|
|
|
|
|
{
|
|
|
|
|
|
QVariant id; //临时id使用uuid,load数据使用数据库自增id
|
|
|
|
|
|
QString sName;
|
|
|
|
|
|
QString sTag;
|
|
|
|
|
|
QVariant parentId;
|
2025-06-20 18:09:41 +08:00
|
|
|
|
QString sBasePageName; //基模组态图名称
|
2025-05-09 19:36:32 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct DiagramContent {
|
2025-04-22 10:10:55 +08:00
|
|
|
|
QString diagramId; // 对应的PowerEntity ID
|
|
|
|
|
|
|
|
|
|
|
|
// 元素位置信息 <元素ID, 位置>
|
|
|
|
|
|
QHash<QString, QPointF> elementPositions;
|
|
|
|
|
|
//QHash<QString, QColor> connectionColors; // <连接ID, 显示颜色>
|
|
|
|
|
|
QHash<QString, QList<QPointF>> connectionPaths; // 自定义路径点
|
|
|
|
|
|
};
|
2025-05-23 10:30:52 +08:00
|
|
|
|
|
|
|
|
|
|
struct PtExtraInfo
|
|
|
|
|
|
{
|
|
|
|
|
|
int id;
|
|
|
|
|
|
QString transRatio; //变比
|
|
|
|
|
|
QString accuracyClass; //精度等级
|
|
|
|
|
|
QString secondaryLoadCapacity; //二次负载容量
|
|
|
|
|
|
QString windingConnectionMethod; //绕组接法
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct CtExtraInfo
|
|
|
|
|
|
{
|
|
|
|
|
|
int id;
|
|
|
|
|
|
QString transRatio; //变比
|
|
|
|
|
|
QString accuracyClass; //精度等级
|
|
|
|
|
|
QString secondaryLoadCapacity; //二次负载容量
|
|
|
|
|
|
};
|
2025-06-20 18:09:41 +08:00
|
|
|
|
|
2025-07-04 18:47:49 +08:00
|
|
|
|
struct MeasurementInfo //量测
|
|
|
|
|
|
{
|
|
|
|
|
|
QString tag; //量测tag
|
|
|
|
|
|
QString name; //量测名称
|
|
|
|
|
|
QString equipment; //设备名称
|
|
|
|
|
|
QString channel; //设备端子
|
|
|
|
|
|
QString type; //量测类型
|
|
|
|
|
|
int size; //量测size
|
2025-07-18 18:26:13 +08:00
|
|
|
|
QUuid bayUuid; //所属间隔
|
|
|
|
|
|
QUuid componentUuid; //所属设备
|
2025-07-04 18:47:49 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
2025-06-20 18:09:41 +08:00
|
|
|
|
//==================================================
|
|
|
|
|
|
struct baseComponentInfo //基模图元数据
|
|
|
|
|
|
{
|
|
|
|
|
|
int id = 0;
|
|
|
|
|
|
QUuid uuid;
|
|
|
|
|
|
QString name;
|
|
|
|
|
|
QString tag;
|
|
|
|
|
|
int typeId = 0;
|
|
|
|
|
|
QJsonObject context;
|
|
|
|
|
|
QString metaMmodel;
|
|
|
|
|
|
QString projectModel;
|
|
|
|
|
|
};
|
2025-10-24 21:11:07 +08:00
|
|
|
|
|
|
|
|
|
|
struct editorProjectInfo //editor工程数据
|
|
|
|
|
|
{
|
|
|
|
|
|
int id = 0;
|
|
|
|
|
|
QUuid uuid;
|
|
|
|
|
|
QString name;
|
|
|
|
|
|
QString tag;
|
|
|
|
|
|
QByteArray context;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-03-21 12:53:45 +08:00
|
|
|
|
//==================================================
|
|
|
|
|
|
|
2025-06-20 18:09:41 +08:00
|
|
|
|
struct componentInfo //工程模图元数据
|
2025-03-21 12:53:45 +08:00
|
|
|
|
{
|
|
|
|
|
|
QUuid uuid;
|
2025-03-28 18:08:21 +08:00
|
|
|
|
QString modelName;
|
2025-03-21 12:53:45 +08:00
|
|
|
|
QString nspath;
|
|
|
|
|
|
QString tag;
|
|
|
|
|
|
QString name;
|
|
|
|
|
|
QString description;
|
|
|
|
|
|
QString grid;
|
|
|
|
|
|
QString zone;
|
|
|
|
|
|
QString station;
|
|
|
|
|
|
int type = 0;
|
|
|
|
|
|
bool inService = true;
|
|
|
|
|
|
int state = 0;
|
|
|
|
|
|
QJsonObject connected_bus;
|
|
|
|
|
|
QJsonObject label;
|
|
|
|
|
|
QJsonObject context;
|
|
|
|
|
|
int op = 0;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-06-20 18:09:41 +08:00
|
|
|
|
struct componentTypeInfo //元件类型
|
|
|
|
|
|
{
|
|
|
|
|
|
int id = 0;
|
|
|
|
|
|
QString type;
|
|
|
|
|
|
QString name;
|
|
|
|
|
|
QJsonObject config;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-05-16 19:20:46 +08:00
|
|
|
|
struct topologicInfo
|
|
|
|
|
|
{
|
|
|
|
|
|
int id = -1;
|
|
|
|
|
|
QUuid uuid_from;
|
|
|
|
|
|
QUuid uuid_to;
|
2025-06-20 18:09:41 +08:00
|
|
|
|
QJsonObject context;
|
2025-05-16 19:20:46 +08:00
|
|
|
|
int flag;
|
|
|
|
|
|
QString description;
|
|
|
|
|
|
int op;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct pageInfo
|
|
|
|
|
|
{
|
|
|
|
|
|
int id = -1;
|
|
|
|
|
|
QString tag;
|
|
|
|
|
|
QString name;
|
|
|
|
|
|
QJsonObject label;
|
|
|
|
|
|
QJsonObject context;
|
|
|
|
|
|
QString description;
|
|
|
|
|
|
int op;
|
|
|
|
|
|
};
|
2025-05-23 10:30:52 +08:00
|
|
|
|
|
|
|
|
|
|
struct gridInfo
|
|
|
|
|
|
{
|
|
|
|
|
|
int id = -1;
|
|
|
|
|
|
QString name;
|
|
|
|
|
|
QString description;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct zoneInfo
|
|
|
|
|
|
{
|
|
|
|
|
|
int id = -1;
|
|
|
|
|
|
int grid_id = -1;
|
|
|
|
|
|
QString name;
|
|
|
|
|
|
QString description;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct stationInfo
|
|
|
|
|
|
{
|
|
|
|
|
|
int id = -1;
|
|
|
|
|
|
int zone_id = -1;
|
|
|
|
|
|
QString name;
|
|
|
|
|
|
QString description;
|
|
|
|
|
|
bool is_local = true;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-07-18 18:26:13 +08:00
|
|
|
|
struct bayInfo
|
|
|
|
|
|
{
|
|
|
|
|
|
QUuid uuid;
|
|
|
|
|
|
QString name;
|
2025-10-21 18:46:51 +08:00
|
|
|
|
QString tag;
|
2025-07-18 18:26:13 +08:00
|
|
|
|
QString type;
|
|
|
|
|
|
double unom;
|
|
|
|
|
|
double fla;
|
|
|
|
|
|
double capacity;
|
|
|
|
|
|
QString description;
|
|
|
|
|
|
bool inService;
|
|
|
|
|
|
int nState;
|
|
|
|
|
|
QString grid;
|
|
|
|
|
|
QString zone;
|
|
|
|
|
|
QString station;
|
|
|
|
|
|
QJsonObject business;
|
|
|
|
|
|
QJsonObject fromUuid;
|
|
|
|
|
|
QJsonObject toUuid;
|
|
|
|
|
|
QJsonObject protect;
|
|
|
|
|
|
QJsonObject faultRec;
|
|
|
|
|
|
QJsonObject status;
|
|
|
|
|
|
QJsonObject dynSense;
|
|
|
|
|
|
QJsonObject instruct;
|
|
|
|
|
|
QJsonObject etc;
|
2025-07-25 19:42:20 +08:00
|
|
|
|
QJsonObject context;
|
2025-07-18 18:26:13 +08:00
|
|
|
|
QList<QUuid> components;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-10-11 18:51:33 +08:00
|
|
|
|
struct itemPageInfo //page中保存的item信息(大小,位置etc)
|
|
|
|
|
|
{
|
|
|
|
|
|
QPointF pos;
|
|
|
|
|
|
double dWidth = 0.0;
|
|
|
|
|
|
double dHeight = 0.0;
|
2025-10-21 18:46:51 +08:00
|
|
|
|
double dRotate = 0.0;
|
2025-10-11 18:51:33 +08:00
|
|
|
|
};
|
2025-07-18 18:26:13 +08:00
|
|
|
|
|
2025-05-16 19:20:46 +08:00
|
|
|
|
/*struct busStability
|
2025-03-21 12:53:45 +08:00
|
|
|
|
{
|
|
|
|
|
|
int componentId = 0;
|
|
|
|
|
|
double resistance = 0;
|
|
|
|
|
|
bool anchor_v = false;
|
|
|
|
|
|
double uv_alarm = 0;
|
|
|
|
|
|
double ov_alarm = 0;
|
|
|
|
|
|
bool anchor_i = false;
|
|
|
|
|
|
double ui_alarm = 0;
|
|
|
|
|
|
double oi_alarm = 0;
|
2025-05-16 19:20:46 +08:00
|
|
|
|
};*/
|
2024-12-03 20:07:25 +08:00
|
|
|
|
//Q_ENUM_NS(GraphicsItemType)
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Constants used for fetching QVariant data from GraphModel.
|
|
|
|
|
|
*/
|
|
|
|
|
|
enum class NodeRole {
|
|
|
|
|
|
Type = 0, ///< Type of the current node, usually a string.
|
|
|
|
|
|
Position = 1, ///< `QPointF` positon of the node on the scene.
|
|
|
|
|
|
Size = 2, ///< `QSize` for resizable nodes.
|
|
|
|
|
|
CaptionVisible = 3, ///< `bool` for caption visibility.
|
|
|
|
|
|
Caption = 4, ///< `QString` for node caption.
|
|
|
|
|
|
Style = 5, ///< Custom NodeStyle as QJsonDocument
|
|
|
|
|
|
InternalData = 6, ///< Node-stecific user data as QJsonObject
|
|
|
|
|
|
InPortCount = 7, ///< `unsigned int`
|
|
|
|
|
|
OutPortCount = 9, ///< `unsigned int`
|
|
|
|
|
|
Widget = 10, ///< Optional `QWidget*` or `nullptr`
|
|
|
|
|
|
};
|
|
|
|
|
|
//Q_ENUM_NS(NodeRole)
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Specific flags regulating node features and appeaarence.
|
|
|
|
|
|
*/
|
|
|
|
|
|
enum NodeFlag {
|
|
|
|
|
|
NoFlags = 0x0, ///< Default NodeFlag
|
|
|
|
|
|
Resizable = 0x1, ///< Lets the node be resizable
|
|
|
|
|
|
Locked = 0x2
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
Q_DECLARE_FLAGS(NodeFlags, NodeFlag)
|
|
|
|
|
|
//Q_FLAG_NS(NodeFlags)
|
|
|
|
|
|
Q_DECLARE_OPERATORS_FOR_FLAGS(NodeFlags)
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Constants for fetching port-related information from the GraphModel.
|
|
|
|
|
|
*/
|
|
|
|
|
|
enum class PortRole {
|
|
|
|
|
|
Data = 0, ///< `std::shared_ptr<NodeData>`.
|
|
|
|
|
|
DataType = 1, ///< `QString` describing the port data type.
|
|
|
|
|
|
ConnectionPolicyRole = 2, ///< `enum` ConnectionPolicyRole
|
|
|
|
|
|
CaptionVisible = 3, ///< `bool` for caption visibility.
|
|
|
|
|
|
Caption = 4, ///< `QString` for port caption.
|
|
|
|
|
|
};
|
|
|
|
|
|
//Q_ENUM_NS(PortRole)
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Defines how many connections are possible to attach to ports. The
|
|
|
|
|
|
* values are fetched using PortRole::ConnectionPolicy.
|
|
|
|
|
|
*/
|
|
|
|
|
|
enum class ConnectionPolicy {
|
|
|
|
|
|
One, ///< Just one connection for each port.
|
|
|
|
|
|
Many, ///< Any number of connections possible for the port.
|
|
|
|
|
|
};
|
|
|
|
|
|
//Q_ENUM_NS(ConnectionPolicy)
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Used for distinguishing input and output node ports.
|
|
|
|
|
|
*/
|
|
|
|
|
|
enum class PortType {
|
|
|
|
|
|
In = 0, ///< Input node port (from the left).
|
|
|
|
|
|
Out = 1, ///< Output node port (from the right).
|
|
|
|
|
|
None = 2
|
|
|
|
|
|
};
|
|
|
|
|
|
//Q_ENUM_NS(PortType)
|
|
|
|
|
|
|
2024-12-07 17:24:36 +08:00
|
|
|
|
enum PortState
|
|
|
|
|
|
{
|
|
|
|
|
|
P_const = 0, //固定端口
|
|
|
|
|
|
p_movable, //移动端口
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2024-12-03 20:07:25 +08:00
|
|
|
|
using PortCount = int;
|
|
|
|
|
|
|
|
|
|
|
|
/// ports are consecutively numbered starting from zero.
|
|
|
|
|
|
using PortIndex = int;
|
|
|
|
|
|
|
|
|
|
|
|
const PortIndex InvalidPortIndex = -1;
|
|
|
|
|
|
|
|
|
|
|
|
/// Unique Id associated with each node in the GraphModel.
|
|
|
|
|
|
using NodeId = int;
|
|
|
|
|
|
|
|
|
|
|
|
const NodeId InvalidNodeId = -1;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* A unique connection identificator that stores
|
|
|
|
|
|
* out `NodeId`, out `PortIndex`, in `NodeId`, in `PortIndex`
|
|
|
|
|
|
*/
|
|
|
|
|
|
struct ConnectionId
|
|
|
|
|
|
{
|
|
|
|
|
|
int conId;
|
|
|
|
|
|
NodeId outNodeId;
|
|
|
|
|
|
PortIndex outPortIndex;
|
|
|
|
|
|
NodeId inNodeId;
|
|
|
|
|
|
PortIndex inPortIndex;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
inline uint qHash(const ConnectionId &data, uint seed){
|
|
|
|
|
|
|
|
|
|
|
|
return data.conId;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline bool operator<(ConnectionId const &a, ConnectionId const &b)
|
|
|
|
|
|
{
|
|
|
|
|
|
return a.conId<b.conId;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline bool operator==(ConnectionId const &a, ConnectionId const &b)
|
|
|
|
|
|
{
|
|
|
|
|
|
return a.outNodeId == b.outNodeId && a.outPortIndex == b.outPortIndex
|
|
|
|
|
|
&& a.inNodeId == b.inNodeId && a.inPortIndex == b.inPortIndex;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline bool operator!=(ConnectionId const &a, ConnectionId const &b)
|
|
|
|
|
|
{
|
|
|
|
|
|
return !(a == b);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline void invertConnection(ConnectionId &id)
|
|
|
|
|
|
{
|
|
|
|
|
|
qSwap(id.outNodeId, id.inNodeId);
|
|
|
|
|
|
qSwap(id.outPortIndex, id.inPortIndex);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|