217 lines
8.5 KiB
C++
217 lines
8.5 KiB
C++
#ifndef BASEPROPERTY_H
|
||
#define BASEPROPERTY_H
|
||
|
||
#include <QObject>
|
||
#include <QJsonObject>
|
||
#include "global.h"
|
||
|
||
class AbstractProperty:public QObject //抽象属性类
|
||
{
|
||
Q_OBJECT
|
||
public:
|
||
AbstractProperty(QObject* parent);
|
||
virtual ~AbstractProperty();
|
||
|
||
virtual void setUuid(QUuid id) {uUid = id;}
|
||
virtual QUuid uuid() const {return uUid;}
|
||
virtual void setTag(QString s){sTag = s;}
|
||
virtual QString tag() const {return sTag;}
|
||
virtual void setName(QString s){sName = s;}
|
||
virtual QString name() const {return sName;}
|
||
virtual void setContext(QJsonObject j){jContext = j;}
|
||
virtual QJsonObject context() const {return jContext;}
|
||
virtual void setSubList(QList<QPair<int,QUuid>> lst) {subList = lst;}
|
||
virtual QList<QPair<int,QUuid>>& getSubList() {return subList;}
|
||
|
||
virtual QJsonArray saveSubToJsonArr();
|
||
protected:
|
||
QUuid uUid;
|
||
QString sTag;
|
||
QString sName;
|
||
QJsonObject jContext; //存放port信息
|
||
QList<QPair<int,QUuid>> subList; //可能存在的子对象(不用来拓朴计算) <类型,uid> //类型0:设备 1:间隔
|
||
};
|
||
|
||
class BayProperty:public AbstractProperty //间隔属性(待扩展)
|
||
{
|
||
Q_OBJECT
|
||
public:
|
||
BayProperty(QObject* parent = nullptr)
|
||
:AbstractProperty(parent){
|
||
dVoltage = 0.0;
|
||
dFla = 0.0; //电流
|
||
dCapacity = 0.0; //容量
|
||
sType = "normal";
|
||
}
|
||
virtual ~BayProperty(){};
|
||
public:
|
||
virtual void setType(QString s) {sType = s;}
|
||
virtual QString getType(){return sType;}
|
||
virtual void setLstComponent(QList<QUuid> lst) {lstComponent = lst;}
|
||
virtual QList<QUuid>& getLstComponent() {return lstComponent;}
|
||
virtual void setVoltage(double d) {dVoltage = d;}
|
||
virtual double getVoltage() {return dVoltage;}
|
||
virtual void setFla(double d) {dFla = d;}
|
||
virtual double getFla() {return dFla;}
|
||
virtual void setCapacity(double d) {dCapacity = d;}
|
||
virtual double getCapacity() {return dCapacity;}
|
||
virtual void setInService(bool b) {bInService = b;}
|
||
virtual bool getInService() {return bInService;}
|
||
virtual void setLstFrom(QList<QUuid> lst) {lstFrom = lst;}
|
||
virtual QList<QUuid>& getLstFrom() {return lstFrom;}
|
||
virtual void setLstTo(QList<QUuid> lst) {lstTo = lst;}
|
||
virtual QList<QUuid>& getLstTo() {return lstTo;}
|
||
virtual void setLstProtect(QList<QUuid> lst) {lstProtect = lst;}
|
||
virtual QList<QUuid>& getLstProtect() {return lstProtect;}
|
||
virtual void setLstFaultRecord(QList<QUuid> lst) {lstFaultRecord = lst;}
|
||
virtual QList<QUuid>& getLstFaultRecord() {return lstFaultRecord;}
|
||
virtual void setLstDynSense(QList<QUuid> lst) {lstDynSense = lst;}
|
||
virtual QList<QUuid>& getLstDynSense() {return lstDynSense;}
|
||
virtual void setLstStatus(QList<QUuid> lst) {lstStatus = lst;}
|
||
virtual QList<QUuid>& getLstStatus() {return lstStatus;}
|
||
virtual void setLstInstruct(QList<QUuid> lst) {lstInstruct = lst;}
|
||
virtual QList<QUuid>& getLstInstruct() {return lstInstruct;}
|
||
virtual void setLstEtc(QList<QUuid> lst) {lstEtc = lst;}
|
||
virtual QList<QUuid>& getLstEtc() {return lstEtc;}
|
||
protected:
|
||
QString sType;
|
||
QList<QUuid> lstComponent; //包含的设备
|
||
double dVoltage; //电压
|
||
double dFla; //电流
|
||
double dCapacity; //容量
|
||
bool bInService; //服役状态
|
||
QList<QUuid> lstFrom; //联结 从
|
||
QList<QUuid> lstTo; //联结到
|
||
|
||
QList<QUuid> lstProtect; //综合保护
|
||
QList<QUuid> lstFaultRecord; //故障录播
|
||
QList<QUuid> lstDynSense; //动态感知
|
||
QList<QUuid> lstStatus; //状态检测
|
||
QList<QUuid> lstInstruct; //监控
|
||
QList<QUuid> lstEtc; //其他设备
|
||
};
|
||
|
||
class ModelProperty:public AbstractProperty //模型基类
|
||
{
|
||
Q_OBJECT
|
||
public:
|
||
ModelProperty(QObject* parent);
|
||
virtual ~ModelProperty();
|
||
virtual void setType(int n) {nType = n;} //设置实际类型
|
||
virtual int type() const {return nType;}
|
||
virtual void setGraphicsType(int n) {nGraphicsType = n;} //设置显示类型
|
||
virtual int graphicsType() const {return nGraphicsType;}
|
||
virtual void setModelName(QString sName) {sModelName = sName;}
|
||
virtual QString modelName() const {return sModelName;}
|
||
virtual void setMetaModelName(QString sName) {sMetaName = sName;}
|
||
virtual QString metaModelName() const {return sMetaName;}
|
||
virtual void notifyUpdate(){emit updateData();}
|
||
virtual void setBay(QString s){sBay = s;}
|
||
virtual QString getBay(){return sBay;}
|
||
|
||
void setPrepareDelete(bool b) {_prepareDelete = b;}
|
||
bool prepareDelete() const {return _prepareDelete;}
|
||
void setDataChanged(bool b) {_dataChanged = b;} //数据变换标签
|
||
bool dataChanged() const {return _dataChanged;}
|
||
void setConnection(Connection con){m_connectState = con;} //保留,用以获取当前图中的连接
|
||
Connection getConnection() const {return m_connectState;}
|
||
signals:
|
||
void updateData(); //通知数据拥有者更新
|
||
protected:
|
||
Connection m_connectState;
|
||
int nType; //设备类型
|
||
int nGraphicsType;
|
||
QString sModelName; //模型名
|
||
QString sMetaName; //元模型名
|
||
QString sBay; //所属间隔
|
||
|
||
bool _dataChanged; //数据状态,为真则写入库
|
||
bool _prepareDelete; //状态,为真准备删除
|
||
};
|
||
|
||
class DiagramEditorItemProperty:public ModelProperty //基模编辑中预览元件的属性
|
||
{
|
||
public:
|
||
DiagramEditorItemProperty(QObject* parent);
|
||
virtual ~DiagramEditorItemProperty();
|
||
void setBlock(const QString& s) {sBlock = s;}
|
||
QString getBlock(){return sBlock;}
|
||
private:
|
||
QString sBlock; //所属的block(跨间隔连线等可能无此值)
|
||
};
|
||
|
||
class BaseProperty;
|
||
class BaseModelProperty:public ModelProperty //图像基模属性
|
||
{
|
||
Q_OBJECT
|
||
public:
|
||
BaseModelProperty(QObject* parent);
|
||
virtual ~BaseModelProperty();
|
||
|
||
virtual void addProData(QString sPage,BaseProperty* pData) {_generatedData.insert(sPage,pData);}
|
||
virtual PropertyModel& getModelProperty() {return pm;}
|
||
virtual void setModelProperty(PropertyModel pro) {pm = pro;}
|
||
private:
|
||
QMap<QString,BaseProperty*> _generatedData; //该数据生成过的工程模数据
|
||
PropertyModel pm; //工程模的选择状态
|
||
};
|
||
|
||
class BaseProperty:public ModelProperty //图像工程模模属性类,存放电路元件属性
|
||
{
|
||
Q_OBJECT
|
||
public:
|
||
BaseProperty(QObject* parent);
|
||
virtual ~BaseProperty();
|
||
|
||
void setPath(QString s){sPath = s;}
|
||
QString path() const {return sPath;}
|
||
void setDescription(QString s) {sDescription = s;}
|
||
QString description() const {return sDescription;}
|
||
void setInService(bool b) {bInService = b;}
|
||
bool inService() {return bInService;}
|
||
void setState(int n) {nState = n;}
|
||
int state() const {return nState;}
|
||
void setStatus(int n) {nStatus = n;}
|
||
int status() const {return nStatus;}
|
||
void setConnectedBus(QJsonObject j) {jConnectedBus = j;}
|
||
QJsonObject connectedBus() const {return jConnectedBus;}
|
||
void setLabel(QJsonObject j){jLabel = j;}
|
||
QJsonObject label() const {return jLabel;}
|
||
void setGrid(const QString& s) {sGrid = s;}
|
||
QString grid() const {return sGrid;}
|
||
void setZone(const QString& s) {sZone = s;}
|
||
QString zone() const {return sZone;}
|
||
void setStation(const QString& s) {sStation = s;}
|
||
QString station() const {return sStation;}
|
||
void setSourceItemId(const QString& s) {sSourceItemId = s;}
|
||
QString getSourceItemId() {return sSourceItemId;}
|
||
void setMeasurement(QMap<QString,MeasurementInfo> map) {mMeasurement = map;}
|
||
auto getMeasurement() {return mMeasurement;}
|
||
protected:
|
||
QString sPath;
|
||
QString sDescription;
|
||
QString sGrid;
|
||
QString sZone;
|
||
QString sStation;
|
||
bool bInService;
|
||
int nState;
|
||
int nStatus;
|
||
QJsonObject jConnectedBus;
|
||
QJsonObject jLabel;
|
||
QString sSourceItemId; //被哪个对象生成
|
||
QMap<QString,MeasurementInfo> mMeasurement; //量测
|
||
};
|
||
|
||
typedef QMap<QString,QVariant> VariableMap; //属性名,值
|
||
|
||
class VariableProperty:public BaseProperty //收到的变量数据
|
||
{
|
||
Q_OBJECT
|
||
public:
|
||
VariableProperty(QObject* parent = nullptr);
|
||
~VariableProperty();
|
||
|
||
modelDataInfo& getPropertyValue() const;
|
||
};
|
||
#endif // DATABASE_H
|