update version
This commit is contained in:
parent
665635e839
commit
23527be14b
|
|
@ -33,7 +33,8 @@ enum HandleType
|
|||
T_lineIn, //入线口
|
||||
T_lineOut, //出线口
|
||||
T_lineInOut, //双端线
|
||||
T_newTral //中性点
|
||||
T_newTral, //中性点
|
||||
T_addSymbol //扩展标志
|
||||
};
|
||||
|
||||
struct Connection
|
||||
|
|
|
|||
|
|
@ -1,9 +1,21 @@
|
|||
#include "types.h"
|
||||
|
||||
const QMap<AbstractItemType,GraphicsItemType> linkType = {
|
||||
{AIT_motor,GIT_itemRect},{AIT_bus,GIT_bus},
|
||||
};
|
||||
const QMap<AbstractItemType, GraphicsItemType>& getLinkType() {
|
||||
static const QMap<AbstractItemType, GraphicsItemType> linkType = {
|
||||
{AIT_motor, GIT_itemRect},
|
||||
{AIT_bus, GIT_bus},
|
||||
};
|
||||
return linkType;
|
||||
}
|
||||
|
||||
//类型转换
|
||||
const QMap<int,GraphicsItemType> typeToProGraphic = {
|
||||
{0,GIT_node},{1,GIT_bus},{3,GIT_itemRect},{4,GIT_ctGroup},{5,GIT_ptGroup},{6,GIT_ES},{7,GIT_FES},{8,GIT_link},{9,GIT_DS},{10,GIT_DTEDS},{11,GIT_PI},{12,GIT_LA},{13,GIT_cableTer},{14,GIT_cableEnd},{15,GIT_2wTransformer},{16,GIT_3wTransformer}
|
||||
};
|
||||
const QMap<int, GraphicsItemType>& getTypeToProGraphic() {
|
||||
static const QMap<int, GraphicsItemType> typeToProGraphic = {
|
||||
{0, GIT_node}, {1, GIT_bus}, {3, GIT_itemRect}, {4, GIT_ctGroup},
|
||||
{5, GIT_ptGroup}, {6, GIT_ES}, {7, GIT_FES}, {8, GIT_link},
|
||||
{9, GIT_DS}, {10, GIT_DTEDS}, {11, GIT_PI}, {12, GIT_LA},
|
||||
{13, GIT_cableTer}, {14, GIT_cableEnd}, {15, GIT_2wTransformer},
|
||||
{16, GIT_3wTransformer}
|
||||
};
|
||||
return typeToProGraphic;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ enum GraphicsItemType
|
|||
GIT_3wTransformer= QGraphicsItem::UserType + 67,
|
||||
GIT_node= QGraphicsItem::UserType + 79,
|
||||
GIT_bay= QGraphicsItem::UserType + 80, //间隔
|
||||
|
||||
GIT_CustomType= QGraphicsItem::UserType + 81, //自定义(工程模)
|
||||
GIT_Image = QGraphicsItem::UserType + 110, //图形item
|
||||
GIT_Text = QGraphicsItem::UserType + 111, //文本item
|
||||
|
||||
|
|
@ -173,7 +173,9 @@ enum class ComponentType {
|
|||
CableEnd = 14 // 电缆端
|
||||
};
|
||||
|
||||
extern const QMap<AbstractItemType,GraphicsItemType> linkType;
|
||||
//extern const QMap<AbstractItemType,GraphicsItemType> linkType;
|
||||
extern const QMap<AbstractItemType, GraphicsItemType>& getLinkType();
|
||||
//类型转换
|
||||
extern const QMap<int,GraphicsItemType> typeToProGraphic;
|
||||
//extern const QMap<int,GraphicsItemType> typeToProGraphic;
|
||||
extern const QMap<int, GraphicsItemType>& getTypeToProGraphic();
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -235,6 +235,6 @@ public:
|
|||
VariableProperty(QObject* parent = nullptr);
|
||||
~VariableProperty();
|
||||
|
||||
ModelDataInfo& getPropertyValue() const;
|
||||
ModelDataInfo& getPropertyValue(bool useCatch = false) const;
|
||||
};
|
||||
#endif // DATABASE_H
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ VariableProperty::~VariableProperty()
|
|||
|
||||
}
|
||||
|
||||
ModelDataInfo& VariableProperty::getPropertyValue() const
|
||||
ModelDataInfo& VariableProperty::getPropertyValue(bool useCatch) const
|
||||
{
|
||||
return DataManager::instance().modelData()[sModelName];
|
||||
return DataManager::instance().modelData(useCatch)[sModelName];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,8 +61,8 @@ set(DIAGRAMCAVAS_HEADER_FILES
|
|||
include/graphicsDataModel/baseModel.h
|
||||
include/graphicsDataModel/fixedPortsModel.h
|
||||
include/graphicsItem/graphicsItemGroup.h
|
||||
#include/graphicsItem/graphicsPolygonItem.h
|
||||
include/graphicsItem/handleRect.h
|
||||
include/graphicsItem/addSymbol.h
|
||||
include/graphicsItem/handleText.h
|
||||
include/graphicsItem/itemPort.h
|
||||
include/graphicsItem/itemExtend.h
|
||||
|
|
@ -208,8 +208,8 @@ set(DIAGRAMCAVAS_SOURCE_FILES
|
|||
source/graphicsDataModel/baseModel.cpp
|
||||
source/graphicsDataModel/fixedPortsModel.cpp
|
||||
source/graphicsItem/graphicsItemGroup.cpp
|
||||
#source/graphicsItem/graphicsPolygonItem.cpp
|
||||
source/graphicsItem/handleRect.cpp
|
||||
source/graphicsItem/addSymbol.cpp
|
||||
source/graphicsItem/handleText.cpp
|
||||
source/graphicsItem/itemPort.cpp
|
||||
source/graphicsItem/itemExtend.cpp
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ class CornerMonitorLauncher : public QWidget
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CornerMonitorLauncher(QMdiArea *parent = nullptr);
|
||||
CornerMonitorLauncher(QWidget* parent = nullptr,QMdiArea *mdi = nullptr);
|
||||
~CornerMonitorLauncher();
|
||||
|
||||
void showDlg();
|
||||
|
|
|
|||
|
|
@ -118,6 +118,7 @@ public:
|
|||
void createHMIClickedImpl(const QString& sHMI, const QString& sStructPage, int modelType);
|
||||
bool createHMIDiagram(const QString& sHMI, int modelType, QUuid& outId, PowerEntity*& outEntity);
|
||||
bool loadStructureToPanel(const QString& panelName, const QString& sStructPage);
|
||||
void autoExtendMode(); //自动扩展模式
|
||||
private:
|
||||
DiagramCavas* q_ptr; // 指向公共接口的指针
|
||||
QSet<QString> m_modifiedPages; // 记录修改过的页面
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ public Q_SLOTS:
|
|||
private:
|
||||
void addPortsToItem_json(PortState,QJsonArray,GraphicsBaseItem*); //将json格式的port添加到item
|
||||
void autoSetModelName(GraphicsBaseModelItem*); //如果此页的工程模已被设置,将projectName更新到item
|
||||
QString removeSuffix(const QString& str); //移除最后一个下划线后的内容 (处理各种tag后缀)
|
||||
QString removeSuffix(const QString& str,QChar symbol = '_'); //移除最后一个下划线后的内容 (处理各种tag后缀)
|
||||
ModelProperty* getItemByUid(QList<GraphicsBaseItem*>,QUuid); //返回uid对应的data
|
||||
void updateMonitor(QMap<QString,QMap<quint64,double>>); //使用当前数据更新运行时
|
||||
void assignMeasureSymmetry(QMap<QString, MeasurementInfo>& measurementMap); //设置量测中互为double的name
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
#ifndef ADDSYMBOL_H
|
||||
#define ADDSYMBOL_H
|
||||
|
||||
/**********智能扩展模式中的加号**********/
|
||||
#include "graphicsItem/itemControlHandle.h"
|
||||
|
||||
class AddSymbol : public ItemControlHandle
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AddSymbol(QGraphicsItem *parent);
|
||||
virtual ~AddSymbol();
|
||||
protected:
|
||||
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent*) override;
|
||||
virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent*) override;
|
||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
||||
virtual QRectF boundingRect() const override;
|
||||
private:
|
||||
bool m_hovered = false;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -38,6 +38,8 @@ public:
|
|||
|
||||
MonitorConfigDlg* getMonitorConfigDlg() {return _pConfigDlg;}
|
||||
void setToobarlVisible(bool); //设置运行模式
|
||||
|
||||
void changeScalableItemState(bool); //改变扩展item的显示状态
|
||||
public:
|
||||
//对层级关系的序列化与反序列化
|
||||
QJsonArray serializeRelationToJsonArray(const QList<HierarchyItem>& data) const;
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@
|
|||
#include <QMouseEvent>
|
||||
#include <QMenu>
|
||||
|
||||
CornerMonitorLauncher::CornerMonitorLauncher(QMdiArea* parent)
|
||||
CornerMonitorLauncher::CornerMonitorLauncher(QWidget* parent,QMdiArea* mdi)
|
||||
: QWidget(parent)
|
||||
,m_mdiArea(parent)
|
||||
,m_mdiArea(mdi)
|
||||
{
|
||||
setFixedSize(48, 48);
|
||||
setWindowFlags(Qt::Tool | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
|
||||
|
|
|
|||
|
|
@ -166,6 +166,7 @@ void DiagramCavas::onSignal_extendClick(bool bCheck)
|
|||
{
|
||||
Q_D(DiagramCavas);
|
||||
d->_operateMode = bCheck?1:0;
|
||||
d->autoExtendMode();
|
||||
}
|
||||
|
||||
void DiagramCavas::onSignal_activatePage(const QString& name)
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ void DiagramCavasPrivate::initialImpl()
|
|||
}
|
||||
|
||||
// 2. 初始化角落监控启动器
|
||||
_cornerButton = new CornerMonitorLauncher(m_mdiArea);
|
||||
_cornerButton = new CornerMonitorLauncher(nullptr,m_mdiArea);
|
||||
_cornerButton->showDlg();
|
||||
//LOG_INFO("CanvasIni", QString("Insert bay fail"));
|
||||
|
||||
|
|
@ -1304,3 +1304,14 @@ bool DiagramCavasPrivate::loadStructureToPanel(const QString& panelName, const Q
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
void DiagramCavasPrivate::autoExtendMode()
|
||||
{
|
||||
if(m_mapMonitorPanel.contains(_curPage))
|
||||
{
|
||||
auto pPanel = m_mapMonitorPanel.value(_curPage).first;
|
||||
pPanel->changeScalableItemState(_operateMode);
|
||||
}
|
||||
else
|
||||
qDebug() <<"page" << _curPage << "not found";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -821,7 +821,7 @@ BaseProperty* FixedPortsModel::addNodeData(QUuid id,int type,QString name,QStrin
|
|||
item->setUuid(id);
|
||||
item->setModelName(modelName);
|
||||
item->setType(type);
|
||||
GraphicsItemType localType = typeToProGraphic[type]; //将通用类型转换为工程模图元
|
||||
GraphicsItemType localType = getTypeToProGraphic().value(type); //将通用类型转换为工程模图元
|
||||
item->setGraphicsType(localType);
|
||||
item->setTag(name);
|
||||
item->setName(name);
|
||||
|
|
@ -1080,7 +1080,7 @@ void FixedPortsModel::saveNode(int nPageId)
|
|||
BayProperty* pBay = dynamic_cast<BayProperty*>(pro);
|
||||
if(pBay){
|
||||
bool val = DataBase::GetInstance()->ifBayExist(pBay->uuid());
|
||||
QString tempTag = pBay->tag()+"_"+_pageName; //tag后加工程名保持全局唯一
|
||||
QString tempTag = pBay->tag()+"-"+_pageName; //tag后加工程名保持全局唯一
|
||||
if(!val){
|
||||
QJsonObject objFrom = turnListToJson(pBay->getLstFrom(),"id","ids");
|
||||
QJsonObject objTo= turnListToJson(pBay->getLstTo(),"id","ids");
|
||||
|
|
@ -1218,7 +1218,7 @@ void FixedPortsModel::saveNode(int nPageId)
|
|||
objBinding[info.sWindType] = objWind;
|
||||
}
|
||||
|
||||
QString tempMeasure = info.tag+"_"+_pageName; //tag后加工程名,保持全局唯一
|
||||
QString tempMeasure = info.tag+"-"+_pageName; //tag后加工程名,保持全局唯一
|
||||
|
||||
bool val = DataBase::GetInstance()->ifBayMeasureExist(info.name,pBay->uuid());
|
||||
if(val){
|
||||
|
|
@ -1331,8 +1331,8 @@ void FixedPortsModel::saveNode(int nPageId)
|
|||
VariableProperty* pVariable = dynamic_cast<VariableProperty*>(pData);
|
||||
if(pVariable)
|
||||
{
|
||||
ModelDataInfo& dataInfo = pVariable->getPropertyValue();
|
||||
QString tempTag = pData->tag()+"_"+_pageName; //tag后加工程名使得全局唯一
|
||||
ModelDataInfo& dataInfo = pVariable->getPropertyValue(true);
|
||||
QString tempTag = pData->tag()+"-"+_pageName; //tag后加工程名使得全局唯一
|
||||
if(exist) //已存在更新
|
||||
{
|
||||
DataBase::GetInstance()->updateComponent(pData->uuid(),tempTag,pData->name(),pData->context(),pData->inService(),pData->state(),pData->status());
|
||||
|
|
@ -1352,7 +1352,7 @@ void FixedPortsModel::saveNode(int nPageId)
|
|||
}
|
||||
else
|
||||
{
|
||||
QString tempPath = pData->path()+"_"+_pageName;
|
||||
QString tempPath = pData->path()+"-"+_pageName;
|
||||
DataBase::GetInstance()->insertComponent(pData->uuid(),pData->modelName(),tempPath,tempTag,pData->name(),pData->description(),pData->grid(),pData->zone(),pData->station(),pData->type(),true,pData->state(),pData->status(),pData->connectedBus(),pData->label(),pData->context(),1);
|
||||
for(auto &val:dataInfo.groupInfo)
|
||||
{
|
||||
|
|
@ -1530,7 +1530,7 @@ void FixedPortsModel::saveNode(int nPageId)
|
|||
objBinding[info.sWindType] = objWind;
|
||||
}
|
||||
|
||||
QString tempMeasure = info.tag+"_"+_pageName; //tag后加工程名,保持全局唯一
|
||||
QString tempMeasure = info.tag+"-"+_pageName; //tag后加工程名,保持全局唯一
|
||||
|
||||
bool val = DataBase::GetInstance()->ifMeasureExist(info.name,pData->uuid());
|
||||
if(val){
|
||||
|
|
@ -1879,9 +1879,9 @@ void FixedPortsModel::autoSetModelName(GraphicsBaseModelItem* pItem)
|
|||
}
|
||||
}
|
||||
|
||||
QString FixedPortsModel::removeSuffix(const QString& str)
|
||||
QString FixedPortsModel::removeSuffix(const QString& str,QChar symbol)
|
||||
{
|
||||
int lastUnderscore = str.lastIndexOf('_');
|
||||
int lastUnderscore = str.lastIndexOf(symbol);
|
||||
if (lastUnderscore == -1) return str; // 没有下划线
|
||||
|
||||
return str.left(lastUnderscore);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,54 @@
|
|||
#include "graphicsItem/addSymbol.h"
|
||||
#include <QPainter>
|
||||
|
||||
AddSymbol::AddSymbol(QGraphicsItem *parent)
|
||||
:ItemControlHandle(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
AddSymbol::~AddSymbol()
|
||||
{
|
||||
}
|
||||
|
||||
QRectF AddSymbol::boundingRect() const
|
||||
{
|
||||
return QRectF(-10,-10,20,20);
|
||||
}
|
||||
|
||||
void AddSymbol::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
|
||||
{
|
||||
Q_UNUSED(option)
|
||||
Q_UNUSED(widget)
|
||||
|
||||
painter->setRenderHint(QPainter::Antialiasing);
|
||||
|
||||
// 画笔
|
||||
QPen pen(m_hovered ? Qt::yellow : Qt::blue);
|
||||
pen.setWidth(m_hovered ? 2 : 1);
|
||||
pen.setWidth(1);
|
||||
painter->setPen(pen);
|
||||
|
||||
// 画圆
|
||||
QRectF circleRect(-8, -8, 16, 16);
|
||||
painter->drawEllipse(circleRect);
|
||||
|
||||
// 画十字
|
||||
int len = 5;
|
||||
painter->drawLine(0, -len, 0, len); // 竖线
|
||||
painter->drawLine(-len, 0, len, 0); // 横线
|
||||
}
|
||||
|
||||
void AddSymbol::hoverEnterEvent(QGraphicsSceneHoverEvent* event)
|
||||
{
|
||||
m_hovered = true;
|
||||
update();
|
||||
ItemControlHandle::hoverEnterEvent(event);
|
||||
}
|
||||
|
||||
void AddSymbol::hoverLeaveEvent(QGraphicsSceneHoverEvent* event)
|
||||
{
|
||||
m_hovered = false;
|
||||
update();
|
||||
ItemControlHandle::hoverLeaveEvent(event);
|
||||
}
|
||||
|
|
@ -578,7 +578,7 @@ GraphicsProjectModelItem::GraphicsProjectModelItem(QGraphicsItem *parent)
|
|||
pVoltage->setParent(this);
|
||||
m_vecHanle.insert(h_textVoltage,pVoltage);*/
|
||||
|
||||
setFlag(QGraphicsItem::ItemIsMovable, true);
|
||||
//setFlag(QGraphicsItem::ItemIsMovable, true);
|
||||
setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||
setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
|
||||
|
||||
|
|
|
|||
|
|
@ -920,6 +920,11 @@ void MonitorPanel::setToobarlVisible(bool b)
|
|||
_toolBar->setVisible(false);
|
||||
}
|
||||
|
||||
void MonitorPanel::changeScalableItemState(bool b)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void MonitorPanel::initDisplaySetting()
|
||||
{
|
||||
auto stateMap = _pModel->getMonitorStateMap();
|
||||
|
|
|
|||
|
|
@ -19,6 +19,16 @@ TopologyManager::~TopologyManager() {
|
|||
|
||||
void TopologyManager::clearAllData()
|
||||
{
|
||||
// 清理 diagrams(新增)
|
||||
qDeleteAll(m_diagrams);
|
||||
m_diagrams.clear();
|
||||
|
||||
qDeleteAll(m_baseDiagrams);
|
||||
m_baseDiagrams.clear();
|
||||
|
||||
qDeleteAll(m_monitorDiagrams);
|
||||
m_monitorDiagrams.clear();
|
||||
|
||||
// 删除所有连接
|
||||
qDeleteAll(m_connections);
|
||||
m_connections.clear();
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ public:
|
|||
void updateModelData(const QString& sModel,QUuid uuid,const QString& sGroup,QMap<QString,PropertyStateInfo> mapPro);
|
||||
|
||||
ModleStateMap& modelState();
|
||||
ModelDataMap& modelData();
|
||||
ModelDataMap& modelData(bool useCatch = false);
|
||||
private:
|
||||
ModleStateMap _modelStateInfo; //接收的模型结构信息(可直接返回引用)
|
||||
ModelDataMap _modleDataInfo; //模型实时数据(使用接口获取数据)
|
||||
|
|
|
|||
|
|
@ -277,7 +277,7 @@ bool DataBase::updateComponent(QUuid uuid,QString tag,QString name,QJsonObject c
|
|||
QJsonDocument contextDoc(context);
|
||||
QString strCon = contextDoc.toJson(QJsonDocument::Compact);
|
||||
|
||||
qry.prepare("UPDATE component SET tag=?, name=?, context=?, ts=? ,in_service=?,state=?,status=?WHERE global_uuid=?");
|
||||
qry.prepare("UPDATE component SET tag=?, name=?, context=?, ts=? ,in_service=?,state=?,status=? WHERE global_uuid=?");
|
||||
qry.bindValue(0,tag);
|
||||
qry.bindValue(1,name);
|
||||
qry.bindValue(2,strCon);
|
||||
|
|
|
|||
|
|
@ -282,11 +282,14 @@ ModleStateMap& DataManager::modelState()
|
|||
return _modelStateInfo;
|
||||
}
|
||||
|
||||
ModelDataMap& DataManager::modelData()
|
||||
ModelDataMap& DataManager::modelData(bool useCatch)
|
||||
{
|
||||
if(!_dataInitialised)
|
||||
initialModelData();
|
||||
else
|
||||
initialModelData(true);
|
||||
if(!useCatch){
|
||||
if(!_dataInitialised)
|
||||
initialModelData();
|
||||
else
|
||||
initialModelData(true);
|
||||
}
|
||||
|
||||
return _modleDataInfo;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ void ElectricElementsBox::addPanelItems(const QString& sPanel)
|
|||
|
||||
for(auto &model:_modelInfo)
|
||||
{
|
||||
GraphicsItemType localType = linkType[(AbstractItemType)model.modelType];
|
||||
GraphicsItemType localType = getLinkType().value((AbstractItemType)model.modelType);
|
||||
model.modelType = localType; //转换图元类别,从字典表转到内部类别
|
||||
}
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ void ElectricElementsBox::updateModelList()
|
|||
{
|
||||
for(auto &model:_modelInfo)
|
||||
{
|
||||
GraphicsItemType localType = linkType[(AbstractItemType)model.modelType];
|
||||
GraphicsItemType localType = getLinkType().value((AbstractItemType)model.modelType);
|
||||
model.modelType = localType;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@
|
|||
#include "diagramView.h"
|
||||
#include "projectModelManager.h"
|
||||
#include "monitorItemsDlg.h"
|
||||
#include "monitorPagesDlg.h"
|
||||
#include "QDetailsView.h"
|
||||
#include "baseDockWidget.h"
|
||||
#include "configToolBar.h"
|
||||
|
|
@ -60,9 +59,7 @@ CMainWindow::~CMainWindow()
|
|||
if(m_pElectricElementsBox)
|
||||
delete m_pElectricElementsBox;
|
||||
if(m_pPropertiesEditorView){
|
||||
auto pView = m_pPropertiesEditorView->getQuickDetailsView();
|
||||
delete pView;
|
||||
delete m_pPropertiesEditorView;
|
||||
m_pPropertiesEditorView->deleteLater();
|
||||
}
|
||||
if(m_pRuntimeDlg)
|
||||
delete m_pRuntimeDlg;
|
||||
|
|
|
|||
Loading…
Reference in New Issue