add diagram editor transformer preview
This commit is contained in:
parent
5231c342fe
commit
ad44b48ec2
|
|
@ -19,6 +19,9 @@ const int g_dEditorItem_Height = 80;
|
|||
|
||||
const int g_nEditorBus_Height = 10;
|
||||
|
||||
const int g_nVDiagramSpacing = 50;
|
||||
const int g_nHDiagramSpacing = 50;
|
||||
|
||||
//Q_NAMESPACE
|
||||
enum GraphicsItemType
|
||||
{
|
||||
|
|
@ -42,6 +45,10 @@ enum GraphicsItemType
|
|||
GIT_baseCT = QGraphicsItem::UserType + 203,
|
||||
GIT_basePT = QGraphicsItem::UserType + 204,
|
||||
GIT_baseDS = QGraphicsItem::UserType + 205,
|
||||
GIT_baseES = QGraphicsItem::UserType + 206,
|
||||
GIT_basePI = QGraphicsItem::UserType + 207, //带电指示器
|
||||
GIT_base2wTransformer = QGraphicsItem::UserType + 208, //两绕阻变压器
|
||||
GIT_base3wTransformer = QGraphicsItem::UserType + 209, //三绕组变压器
|
||||
};
|
||||
|
||||
enum AbstractItemType //工程模关联的对象类型
|
||||
|
|
@ -421,7 +428,7 @@ enum class BayType //间隔类型
|
|||
|
||||
enum class EditorItemType //组态编辑中的图形项类型
|
||||
{
|
||||
bus = 0, //母线
|
||||
bus = 1, //母线
|
||||
bay, //间隔
|
||||
trans, //变压器
|
||||
line, //连接线
|
||||
|
|
@ -462,7 +469,7 @@ struct DiagramEditorComponentInfo //组态设备信息
|
|||
int nRotate = 0; //旋转角
|
||||
};
|
||||
|
||||
struct DiagramEditorBayRouteInfo //间隔中单条线路信息
|
||||
struct DiagramEditorRouteInfo //间隔中单条线路信息
|
||||
{
|
||||
QString sRouteName;
|
||||
bool bMainRoute = false; //主线路(包含设备最多的线路,决定整体布局)
|
||||
|
|
@ -520,7 +527,8 @@ enum HandleType
|
|||
T_text, //文本
|
||||
T_lineIn, //入线口
|
||||
T_lineOut, //出线口
|
||||
T_lineInOut //双端线
|
||||
T_lineInOut, //双端线
|
||||
T_newTral //中性点
|
||||
};
|
||||
|
||||
enum HandleTag
|
||||
|
|
|
|||
|
|
@ -44,6 +44,10 @@ set(DIAGRAMCAVAS_HEADER_FILES
|
|||
include/diagramEditor/diagramEditorBayDetailAddDlg.h
|
||||
include/diagramEditor/diagramEditorTransSettingDlg.h
|
||||
include/diagramEditor/diagramEditorBayPreviewDlg.h
|
||||
include/diagramEditor/diagramEditorTransDetailAddDlg.h
|
||||
include/diagramEditor/diagramEditorTransDetailSettingDlg.h
|
||||
include/diagramEditor/diagramEditorTransPreviewDlg.h
|
||||
include/diagramEditor/diagramEditorPreviewDlg.h
|
||||
include/graphicsDataModel/baseModel.h
|
||||
include/graphicsDataModel/fixedPortsModel.h
|
||||
include/graphicsDataModel/diagramEditorModel.h
|
||||
|
|
@ -127,6 +131,10 @@ set(DIAGRAMCAVAS_SOURCE_FILES
|
|||
source/diagramEditor/diagramEditorBayDetailAddDlg.cpp
|
||||
source/diagramEditor/diagramEditorTransSettingDlg.cpp
|
||||
source/diagramEditor/diagramEditorBayPreviewDlg.cpp
|
||||
source/diagramEditor/diagramEditorTransDetailAddDlg.cpp
|
||||
source/diagramEditor/diagramEditorTransDetailSettingDlg.cpp
|
||||
source/diagramEditor/diagramEditorTransPreviewDlg.cpp
|
||||
source/diagramEditor/diagramEditorPreviewDlg.cpp
|
||||
source/graphicsDataModel/baseModel.cpp
|
||||
source/graphicsDataModel/fixedPortsModel.cpp
|
||||
source/graphicsDataModel/diagramEditorModel.cpp
|
||||
|
|
@ -182,6 +190,8 @@ set(UI_FILES
|
|||
ui/diagramEditorTransSettingDlg.ui
|
||||
ui/diagramEditorBayDetailSettingDlg.ui
|
||||
ui/diagramEditorBayDetailAddDlg.ui
|
||||
ui/diagramEditorTransDetailSettingDlg.ui
|
||||
ui/diagramEditorTransDetailAddDlg.ui
|
||||
)
|
||||
|
||||
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@ class DiagramEditorBaseBlock: public QObject
|
|||
public:
|
||||
DiagramEditorBaseBlock(QObject *parent = 0);
|
||||
virtual ~DiagramEditorBaseBlock() = 0;
|
||||
virtual void setId(QUuid id) {uid = id;}
|
||||
virtual QUuid getId() {return uid;}
|
||||
virtual void setName(const QString& str) {sName = str;}
|
||||
virtual QString getName() {return sName;}
|
||||
virtual void setType(int n) {nType = n;}
|
||||
|
|
@ -29,6 +31,7 @@ protected:
|
|||
QString sName;
|
||||
int nType; //1母线,2间隔,3变压器
|
||||
int nContainerLevel; //所处容器的层级 0,1,2,3
|
||||
QUuid uid;
|
||||
QList<QUuid> _lstCon; //连接信息
|
||||
DiagramEditorStructContainer* _curContainer; //当前所处的容器
|
||||
};
|
||||
|
|
@ -62,13 +65,13 @@ public:
|
|||
virtual ~DiagramEditorBayBlock();
|
||||
virtual void setBayType(BayType typ) {nBayType = typ;}
|
||||
virtual BayType getBayType() {return nBayType;}
|
||||
virtual void setRouteInfoMap(QMap<QString,DiagramEditorBayRouteInfo> info) {mapRouteInfo = info;}
|
||||
virtual QMap<QString,DiagramEditorBayRouteInfo>& getRouteInfoMap() {return mapRouteInfo;}
|
||||
virtual void setRouteInfoMap(QMap<QString,DiagramEditorRouteInfo> info) {mapRouteInfo = info;}
|
||||
virtual QMap<QString,DiagramEditorRouteInfo>& getRouteInfoMap() {return mapRouteInfo;}
|
||||
virtual void setComponentMap(QMap<QString,DiagramEditorComponentInfo> info) {mapComponents = info;}
|
||||
virtual QMap<QString,DiagramEditorComponentInfo>& getComponentMap() {return mapComponents;}
|
||||
protected:
|
||||
BayType nBayType;
|
||||
QMap<QString,DiagramEditorBayRouteInfo> mapRouteInfo; //间隔中的线路信息
|
||||
QMap<QString,DiagramEditorRouteInfo> mapRouteInfo; //间隔中的线路信息
|
||||
QMap<QString,DiagramEditorComponentInfo> mapComponents; //间隔中的所有设备信息
|
||||
};
|
||||
|
||||
|
|
@ -81,7 +84,13 @@ public:
|
|||
virtual ~DiagramEditorTransformerBlock();
|
||||
virtual void setTransType(TransformerType typ) {nTransType = typ;}
|
||||
virtual TransformerType getTransType() {return nTransType;}
|
||||
virtual void setRouteInfoMaps(QMap<int,QMap<QString,DiagramEditorRouteInfo>> info) {mapsRouteInfo = info;}
|
||||
virtual QMap<int,QMap<QString,DiagramEditorRouteInfo>>& getRouteInfoMaps() {return mapsRouteInfo;}
|
||||
virtual void setComponentMap(QMap<QString,DiagramEditorComponentInfo> info) {mapComponents = info;}
|
||||
virtual QMap<QString,DiagramEditorComponentInfo>& getComponentMap() {return mapComponents;}
|
||||
protected:
|
||||
TransformerType nTransType;
|
||||
QMap<int,QMap<QString,DiagramEditorRouteInfo>> mapsRouteInfo; //变压器中性点线路信息 0高1中2低
|
||||
QMap<QString,DiagramEditorComponentInfo> mapComponents; //变压器中性点设备信息
|
||||
};
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ public:
|
|||
|
||||
void initial();
|
||||
void showDlg();
|
||||
void showDlg(DiagramEditorBayRouteInfo info); //编辑
|
||||
void showDlg(DiagramEditorRouteInfo info); //编辑
|
||||
void setParent(DiagramEditorBayDetailSettingDlg* p) {_pParent = p;}
|
||||
public slots:
|
||||
void onAddClicked();
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@ public:
|
|||
void setParent(DiagramEditorWizard* p) {_pWizard = p;}
|
||||
QStandardItemModel* getComponentModel() {return _compoModel;}
|
||||
QStandardItemModel* getRouteModel() {return _routeModel;}
|
||||
void setRouteMap(QMap<QString,DiagramEditorBayRouteInfo> map) {_mapRouteInfo = map;}
|
||||
QMap<QString,DiagramEditorBayRouteInfo>& getRouteMap(){return _mapRouteInfo;}
|
||||
void setRouteMap(QMap<QString,DiagramEditorRouteInfo> map) {_mapRouteInfo = map;}
|
||||
QMap<QString,DiagramEditorRouteInfo>& getRouteMap(){return _mapRouteInfo;}
|
||||
void setModelDelegate(DiagramEditorModel* p){_pModel = p;}
|
||||
DiagramEditorModel* getModel() {return _pModel;}
|
||||
public slots:
|
||||
|
|
@ -48,7 +48,7 @@ private:
|
|||
DiagramEditorBayBlock* _curOperateObj; //当前加载的block对象
|
||||
QStandardItemModel* _compoModel; //设备库model name中的data:1为占用方向,2为相对坐标,3为uuid,4为item标志位(1新建2修改),5旋转角度
|
||||
QStandardItemModel* _routeModel; //所有线路model
|
||||
QMap<QString,DiagramEditorBayRouteInfo> _mapRouteInfo; //所有线路信息
|
||||
QMap<QString,DiagramEditorRouteInfo> _mapRouteInfo; //所有线路信息
|
||||
DiagramEditorModel* _pModel;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -4,14 +4,12 @@
|
|||
#include <QDialog>
|
||||
#include <QVBoxLayout>
|
||||
#include <QStandardItem>
|
||||
#include "global.h"
|
||||
|
||||
class EditView;
|
||||
class EditPreviewScene;
|
||||
class DiagramEditorBayDetailSettingDlg;
|
||||
|
||||
const int g_nVDiagramSpacing = 50;
|
||||
const int g_nHDiagramSpacing = 50;
|
||||
|
||||
class DiagramEditorBayPreviewDlg : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
@ -22,7 +20,7 @@ public:
|
|||
void initial();
|
||||
void showDlg();
|
||||
void setParent(DiagramEditorBayDetailSettingDlg* p) {_pParent = p;}
|
||||
void updateModelData(); //根据设置更新data中布局、方向
|
||||
//void updateModelData(); //根据设置更新data中布局、方向
|
||||
private:
|
||||
EditView* _pView;
|
||||
EditPreviewScene* _pScene;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,30 @@
|
|||
#ifndef DIAGRAMEDITORPREVIEWDLG_H
|
||||
#define DIAGRAMEDITORPREVIEWDLG_H
|
||||
//间隔预览窗口
|
||||
#include <QDialog>
|
||||
#include <QVBoxLayout>
|
||||
#include <QStandardItem>
|
||||
#include "global.h"
|
||||
|
||||
class EditView;
|
||||
class EditPreviewScene;
|
||||
class EditPanel;
|
||||
|
||||
class DiagramEditorPreviewDlg : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
DiagramEditorPreviewDlg(QWidget *parent = nullptr);
|
||||
~DiagramEditorPreviewDlg();
|
||||
|
||||
void initial();
|
||||
void showDlg();
|
||||
void setParent(EditPanel* p) {_pParent = p;}
|
||||
private:
|
||||
EditView* _pView;
|
||||
EditPreviewScene* _pScene;
|
||||
QVBoxLayout* _pMainLayout;
|
||||
EditPanel* _pParent;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
#ifndef DIAGRAMEDITORTRANSDETAILADDDLG_H
|
||||
#define DIAGRAMEDITORTRANSDETAILADDDLG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include "global.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui { class diagramEditorTransDetailAddDlg; }
|
||||
QT_END_NAMESPACE
|
||||
|
||||
class DiagramEditorTransDetailSettingDlg;
|
||||
|
||||
class DiagramEditorTransDetailAddDlg : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
DiagramEditorTransDetailAddDlg(QWidget *parent = nullptr);
|
||||
~DiagramEditorTransDetailAddDlg();
|
||||
|
||||
void initial();
|
||||
void showDlg(int n);
|
||||
void showDlg(DiagramEditorRouteInfo info); //编辑
|
||||
void setParent(DiagramEditorTransDetailSettingDlg* p) {_pParent = p;}
|
||||
public slots:
|
||||
void onAddClicked();
|
||||
void onDeleteClicked();
|
||||
void onSaveClicked();
|
||||
void onOkClicked();
|
||||
void onCancelClicked();
|
||||
void onCategoryChanged(const QString&);
|
||||
|
||||
void onComponentDeleteClicked();
|
||||
void onComponentRbtnClicked(const QPoint &pos);
|
||||
void onRouteDeleteClicked();
|
||||
void onRouteRbtnClicked(const QPoint &pos); //线路右键菜单
|
||||
private:
|
||||
Ui::diagramEditorTransDetailAddDlg *ui;
|
||||
QStandardItemModel* _selectedModel;
|
||||
DiagramEditorTransDetailSettingDlg* _pParent;
|
||||
int _curMode; //0新建1修改
|
||||
int _curType; //当前回路类型 0高压中性点1中2低
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
#ifndef DIAGRAMEDITORTRANSDETAILSETTINGDLG_H
|
||||
#define DIAGRAMEDITORTRANSDETAILSETTINGDLG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include "global.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui { class diagramEditorTransDetailSettingDlg; }
|
||||
QT_END_NAMESPACE
|
||||
|
||||
class DiagramEditorWizard;
|
||||
class DiagramEditorTransDetailAddDlg;
|
||||
class DiagramEditorTransformerBlock;
|
||||
class DiagramEditorTransPreviewDlg;
|
||||
class DiagramEditorModel;
|
||||
class QTableView;
|
||||
|
||||
class DiagramEditorTransDetailSettingDlg : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
DiagramEditorTransDetailSettingDlg(QWidget *parent = nullptr);
|
||||
~DiagramEditorTransDetailSettingDlg();
|
||||
|
||||
void initial();
|
||||
void refreshModel(); //刷新view显示的model
|
||||
void showDlg(DiagramEditorTransformerBlock*);
|
||||
void setParent(DiagramEditorWizard* p) {_pWizard = p;}
|
||||
QStandardItemModel* getComponentModel() {return _compoModel;}
|
||||
QMap<int,QStandardItemModel*> getRouteModels() {return _routeModels;}
|
||||
void setRouteMaps(QMap<int,QMap<QString,DiagramEditorRouteInfo>> map) {_mapsRouteInfo = map;}
|
||||
QMap<int,QMap<QString,DiagramEditorRouteInfo>>& getRouteMaps(){return _mapsRouteInfo;}
|
||||
void setModelDelegate(DiagramEditorModel* p){_pModel = p;}
|
||||
DiagramEditorModel* getModel() {return _pModel;}
|
||||
public slots:
|
||||
void onAddClicked();
|
||||
void onOkClicked();
|
||||
void onCancelClicked();
|
||||
|
||||
void onRouteDeleteClicked();
|
||||
void onRouteRbtnClicked(const QPoint &pos); //线路右键菜单
|
||||
void onRouteEditClicked();
|
||||
void onPreviewNeutralClicked(); //中性点成套装置预览
|
||||
void onPreviewTransClicked(); //预览变压器
|
||||
private:
|
||||
Ui::diagramEditorTransDetailSettingDlg *ui;
|
||||
DiagramEditorTransDetailAddDlg* _pAddDlg;
|
||||
DiagramEditorTransPreviewDlg* _pPreviewDlg;
|
||||
DiagramEditorWizard* _pWizard;
|
||||
DiagramEditorTransformerBlock* _curOperateObj; //当前加载的block对象
|
||||
QStandardItemModel* _compoModel; //设备库model name中的data:1为占用方向,2为相对坐标,3为uuid,4为item标志位(1新建2修改),5旋转角度
|
||||
QMap<int,QStandardItemModel*> _routeModels; //中性点拓扑,0,1,2高中低
|
||||
QMap<int,QMap<QString,DiagramEditorRouteInfo>> _mapsRouteInfo; //侧中性点线路信息
|
||||
DiagramEditorModel* _pModel;
|
||||
QTableView* _curOperateRouteView; //当前操作的中性点拓扑view
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
#ifndef DIAGRAMEDITORTRANSPREVIEWDLG_H
|
||||
#define DIAGRAMEDITORTRANSPREVIEWDLG_H
|
||||
//间隔预览窗口
|
||||
#include <QDialog>
|
||||
#include <QVBoxLayout>
|
||||
#include <QStandardItem>
|
||||
|
||||
class EditView;
|
||||
class EditPreviewScene;
|
||||
class DiagramEditorTransDetailSettingDlg;
|
||||
class DiagramEditorRouteInfo;
|
||||
|
||||
class DiagramEditorTransPreviewDlg : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
DiagramEditorTransPreviewDlg(QWidget *parent = nullptr);
|
||||
~DiagramEditorTransPreviewDlg();
|
||||
|
||||
void initial();
|
||||
void showDlg(int nType); //显示模式,0高压侧1中压侧2低压侧3变压器
|
||||
void setParent(DiagramEditorTransDetailSettingDlg* p) {_pParent = p;}
|
||||
void updateModelData(int showType); //根据设置更新data中布局、方向,0变压器,1高压侧2中压侧3低压侧
|
||||
private:
|
||||
EditView* _pView;
|
||||
EditPreviewScene* _pScene;
|
||||
QVBoxLayout* _pMainLayout;
|
||||
DiagramEditorTransDetailSettingDlg* _pParent;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -18,6 +18,7 @@ class DiagramEditorWizard;
|
|||
class DiagramEditorBaseBlock;
|
||||
class EditBaseItem;
|
||||
class DiagramEditorBayDetailSettingDlg;
|
||||
class DiagramEditorTransDetailSettingDlg;
|
||||
class DiagramEditorModel;
|
||||
|
||||
class EditPanel : public QWidget
|
||||
|
|
@ -30,6 +31,10 @@ public:
|
|||
void initByWizardInfo();
|
||||
void initBlockConnection(); //初始化block之间的连接信息
|
||||
void setOperateWizard(QPointer<DiagramEditorWizard> p) {_curWizard = p;}
|
||||
|
||||
DiagramEditorModel* getModel() {return _pModel;}
|
||||
EditScene* getScene() {return m_pEditScene;}
|
||||
QList<EditBaseItem*> getBlockItems(EditorItemType typ = EditorItemType::none); //返回block对应的item,如母线,间隔,变压器, none返回所有类型
|
||||
public slots:
|
||||
void onWidthChanged(int width);
|
||||
void onContainerSizeChanged(EditContainerItem*); //容器大小改变时调整内部大小
|
||||
|
|
@ -45,6 +50,7 @@ private:
|
|||
QVBoxLayout* _layout;
|
||||
EditMainRect* _mainWidget;
|
||||
DiagramEditorBayDetailSettingDlg* _bayDetailSetting;
|
||||
DiagramEditorTransDetailSettingDlg* _transDetailSetting;
|
||||
QGraphicsLinearLayout* _widgetLayout;
|
||||
QGraphicsProxyWidget* m_addBtnPro;
|
||||
int _maxWidth;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class BaseModel : public QObject
|
|||
public:
|
||||
void createTopoTerminalsByItem(GraphicsBaseItem*,ModelFunctionType funType = ModelFunctionType::ProjectModel); //通过图形对象创建port接线点(新建)
|
||||
QPointF calculateBusPortPos(GraphicsBaseItem* pBus,GraphicsBaseItem* item); //计算母线上接线点位置
|
||||
template<typename TypeLine> void establishConnection(GraphicsBaseItem*,GraphicsBaseItem*,TypeLine*,ModelFunctionType); //在两个item之间建立连接
|
||||
template<typename TypeLine> void establishConnection(GraphicsBaseItem*,GraphicsBaseItem*,TypeLine*,ModelFunctionType,int nMode=0,int nParam = 0); //在两个item之间建立连接 nMode:0正常1变压器中性点 nParam附加参数:中性点中表示需连接的位置(012高中低)
|
||||
double distanceBetweenItems(QGraphicsItem* item1, QGraphicsItem* item2) {
|
||||
QPointF center1 = item1->mapToScene(item1->boundingRect().center());
|
||||
QPointF center2 = item2->mapToScene(item2->boundingRect().center());
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ class DiagramEditorItemProperty;
|
|||
class GraphicsBaseItem;
|
||||
class EditPreviewScene;
|
||||
class ElectricBaseModelLineItem;
|
||||
class DiagramEditorTransformerBlock;
|
||||
class EditPanel;
|
||||
|
||||
class DiagramEditorModel : public BaseModel
|
||||
{
|
||||
|
|
@ -19,20 +21,36 @@ public:
|
|||
DiagramEditorItemProperty* addTempPreviewData(QUuid id,int type,QString name,QString metaName,QString sBlock = QString()); //添加图元基模数据
|
||||
void createTopoTerminalsByItem(GraphicsBaseItem*,ModelFunctionType funType = ModelFunctionType::ProjectModel); //通过图形对象创建port接线点(新建)
|
||||
void generateTempBay(); //通过设置生成间隔预览对象
|
||||
void generateTempTrans(int nType,DiagramEditorTransformerBlock* block = nullptr); //0高压侧1中压侧2低压侧3整个变压器
|
||||
void connectTransToNeutral(DiagramEditorTransformerBlock* block); //连接变压器与中性点设备
|
||||
void linkTransItem(GraphicsBaseModelItem*,QStandardItemModel*); //连接中性点与设备点
|
||||
void generateTempComponent(QUuid uid,QString sName,int nCategory,int nType,QPoint pos,int nRotate = 0); //生成设备 uid,分类(设备、逻辑点),类型,旋转
|
||||
ElectricBaseModelLineItem* generateTempLine(QUuid uid,QString sName); //生成连线
|
||||
void clearCurPreview();
|
||||
void setPanel(EditPanel* p) {_pPanel = p;}
|
||||
|
||||
void setCurBayRouteModel(QStandardItemModel* p) {_pCurBayRoute = p;}
|
||||
QStandardItemModel* getCurBayRouteModel() {return _pCurBayRoute;}
|
||||
void setCurBayComponentModel(QStandardItemModel* p) {_pCurBayComponent = p;}
|
||||
QStandardItemModel* getCurBayComponentModel() {return _pCurBayComponent;}
|
||||
|
||||
void setCurTransRouteModels(QMap<int,QStandardItemModel*> map) {_pCurTransLRoutes = map;}
|
||||
QMap<int,QStandardItemModel*> getCurTransRouteModels() {return _pCurTransLRoutes;}
|
||||
void setCurTransComponentModel(QStandardItemModel* p) {_pCurTransComponent = p;}
|
||||
QStandardItemModel* setCurTransComponentModel() {return _pCurTransComponent;}
|
||||
void setCurPreviewScene(EditPreviewScene* p) {_pCurPreviewScene = p;}
|
||||
QStandardItem* getNameItem(const QString&); //获取返回当前设备模型中的name项
|
||||
QStandardItem* getNameItem(const QString&,int nFrom = 0); //获取返回当前设备模型中的name项 nFrom,0间隔1变压器
|
||||
|
||||
void generateItemByModel(QStandardItemModel* pModel,int nFrom = 0,QPoint delta = QPoint(0,0)); //0间隔1变压器
|
||||
void generateItemByInfo(QMap<QString,DiagramEditorRouteInfo> mapRoute,QMap<QString,DiagramEditorComponentInfo> mapCompo,QPoint delta = QPoint(0,0)); //根据data生成item
|
||||
void updateTarget(QMap<QString,DiagramEditorRouteInfo>&,int nLayout,int nSource); //更新位置 nLayout主次朝向:8421,8421 上下左右,上下左右 nSource:0间隔1变压器
|
||||
private:
|
||||
QMap<QUuid,GraphicsBaseModelItem*> _tempItem; //临时预览对象
|
||||
QStandardItemModel* _pCurBayRoute; //当前使用的间隔路线
|
||||
QStandardItemModel* _pCurBayComponent; //当前使用的间隔设备库
|
||||
QMap<int,QStandardItemModel*> _pCurTransLRoutes; //变压器中性点路线
|
||||
QStandardItemModel* _pCurTransComponent; //当前使用的变压器设备库
|
||||
EditPreviewScene* _pCurPreviewScene; //当前预览scene
|
||||
EditPanel* _pPanel; //主界面
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
ElectricBaseModelPortItem::ElectricBaseModelPortItem(QGraphicsItem *parent)
|
||||
: GraphicsBaseModelItem(parent)
|
||||
{
|
||||
m_boundingRect = QRectF(-2,-2,4,4);
|
||||
m_boundingRect = QRectF(-1,-1,2,2);
|
||||
m_pen = QPen(Qt::black);
|
||||
m_brush = QBrush(Qt::black);
|
||||
setHandleVisible(false);
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ void DiagramEditorBayDetailAddDlg::showDlg()
|
|||
}
|
||||
}
|
||||
|
||||
void DiagramEditorBayDetailAddDlg::showDlg(DiagramEditorBayRouteInfo info)
|
||||
void DiagramEditorBayDetailAddDlg::showDlg(DiagramEditorRouteInfo info)
|
||||
{
|
||||
if(_pParent){
|
||||
_selectedModel->clear();
|
||||
|
|
@ -299,7 +299,7 @@ void DiagramEditorBayDetailAddDlg::onOkClicked()
|
|||
QString sRoute = ui->le_routeName->text();
|
||||
auto& mapRoute = _pParent->getRouteMap();
|
||||
QStringList lstName; //线路的设备列表
|
||||
DiagramEditorBayRouteInfo routeInfo;
|
||||
DiagramEditorRouteInfo routeInfo;
|
||||
routeInfo.sRouteName = sRoute;
|
||||
|
||||
int rowCount = _selectedModel->rowCount();
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ void DiagramEditorBayDetailSettingDlg::refreshModel()
|
|||
}
|
||||
else if(info.nType == 11)
|
||||
{
|
||||
sType = "带点指示器";
|
||||
sType = "带电指示器";
|
||||
}
|
||||
else if(info.nType == 12)
|
||||
{
|
||||
|
|
@ -220,13 +220,13 @@ void DiagramEditorBayDetailSettingDlg::onOkClicked()
|
|||
mapComponents.insert(compoInfo.sName,compoInfo);
|
||||
}
|
||||
_curOperateObj->setComponentMap(mapComponents);
|
||||
TopologyManager::instance().clearGlobalBlockData(_curOperateObj->getName());
|
||||
TopologyManager::instance().moveTempBlockData();
|
||||
_curOperateObj = nullptr;
|
||||
}
|
||||
hide();
|
||||
_pModel->clearCurPreview(); //关闭时清除预览Item
|
||||
//todo:清除mainPanel中的对应item(如果存在)
|
||||
TopologyManager::instance().clearGlobalBlockData(_curOperateObj->getName());
|
||||
TopologyManager::instance().moveTempBlockData();
|
||||
}
|
||||
|
||||
void DiagramEditorBayDetailSettingDlg::onCancelClicked()
|
||||
|
|
|
|||
|
|
@ -38,10 +38,11 @@ void DiagramEditorBayPreviewDlg::showDlg()
|
|||
_pParent->getModel()->setCurPreviewScene(_pScene);
|
||||
}
|
||||
show();
|
||||
updateModelData();
|
||||
_pParent->getModel()->updateTarget(_pParent->getRouteMap(),41,0); //1下2右
|
||||
//updateModelData();
|
||||
}
|
||||
|
||||
void DiagramEditorBayPreviewDlg::updateModelData()
|
||||
/*void DiagramEditorBayPreviewDlg::updateModelData()
|
||||
{
|
||||
auto& mapRoute = _pParent->getRouteMap();
|
||||
QString sMainRoute;
|
||||
|
|
@ -252,4 +253,4 @@ void DiagramEditorBayPreviewDlg::updateModelData()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,46 @@
|
|||
#include "diagramEditor/diagramEditorPreviewDlg.h"
|
||||
#include "diagramEditor/editView.h"
|
||||
#include "diagramEditor/editScene.h"
|
||||
#include "graphicsDataModel/diagramEditorModel.h"
|
||||
#include "diagramEditor/editPanel.h"
|
||||
#include "global.h"
|
||||
|
||||
DiagramEditorPreviewDlg::DiagramEditorPreviewDlg(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
,_pView(nullptr)
|
||||
,_pScene(nullptr)
|
||||
,_pMainLayout(nullptr)
|
||||
,_pParent(nullptr)
|
||||
{
|
||||
auto pParent = dynamic_cast<EditPanel*>(parent);
|
||||
if(pParent)
|
||||
setParent(pParent);
|
||||
QRect recParent = parent->geometry();
|
||||
setGeometry(recParent.right(),recParent.y(),recParent.width(),recParent.height());
|
||||
initial();
|
||||
}
|
||||
|
||||
DiagramEditorPreviewDlg::~DiagramEditorPreviewDlg()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void DiagramEditorPreviewDlg::initial()
|
||||
{
|
||||
_pMainLayout = new QVBoxLayout(this);
|
||||
_pView = new EditView(this);
|
||||
_pMainLayout->addWidget(_pView);
|
||||
_pScene = new EditPreviewScene(this);
|
||||
_pScene->setSceneRect(_pParent->getScene()->sceneRect()); //使用父窗口scene大小
|
||||
_pView->setScene(_pScene);
|
||||
}
|
||||
|
||||
void DiagramEditorPreviewDlg::showDlg()
|
||||
{
|
||||
if(_pParent){
|
||||
_pParent->getModel()->setCurPreviewScene(_pScene);
|
||||
}
|
||||
show();
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,583 @@
|
|||
#include <QMessageBox>
|
||||
#include <QMenu>
|
||||
#include "diagramEditor/diagramEditorTransDetailAddDlg.h"
|
||||
#include "diagramEditor/diagramEditorTransDetailSettingDlg.h"
|
||||
#include "ui_diagramEditorTransDetailAddDlg.h"
|
||||
|
||||
DiagramEditorTransDetailAddDlg::DiagramEditorTransDetailAddDlg(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
, ui(new Ui::diagramEditorTransDetailAddDlg)
|
||||
,_selectedModel(nullptr)
|
||||
,_pParent(nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->setWindowFlags(Qt::FramelessWindowHint | windowFlags());
|
||||
this->setWindowModality(Qt::WindowModal);
|
||||
initial();
|
||||
}
|
||||
|
||||
DiagramEditorTransDetailAddDlg::~DiagramEditorTransDetailAddDlg()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void DiagramEditorTransDetailAddDlg::initial()
|
||||
{
|
||||
_curMode = 0;
|
||||
_curType = 0;
|
||||
_selectedModel = new QStandardItemModel(this);
|
||||
_selectedModel->setHorizontalHeaderLabels({"分类", "名称", "类型", "关联对象", "引用线路"});
|
||||
ui->tableView_selected->setModel(_selectedModel);
|
||||
connect(ui->btn_add,&QPushButton::clicked,this,&DiagramEditorTransDetailAddDlg::onAddClicked);
|
||||
//connect(ui->btn_delete,&QPushButton::clicked,this,&DiagramEditorBayDetailAddDlg::onDeleteClicked);
|
||||
connect(ui->btn_save,&QPushButton::clicked,this,&DiagramEditorTransDetailAddDlg::onSaveClicked);
|
||||
connect(ui->btn_ok,&QPushButton::clicked,this,&DiagramEditorTransDetailAddDlg::onOkClicked);
|
||||
connect(ui->btn_cancel,&QPushButton::clicked,this,&DiagramEditorTransDetailAddDlg::onCancelClicked);
|
||||
connect(ui->cb_category,&QComboBox::currentTextChanged,this,&DiagramEditorTransDetailAddDlg::onCategoryChanged);
|
||||
connect(ui->tableView_selected, &QTableView::customContextMenuRequested, this, &DiagramEditorTransDetailAddDlg::onRouteRbtnClicked);
|
||||
connect(ui->tableView_items, &QTableView::customContextMenuRequested, this, &DiagramEditorTransDetailAddDlg::onComponentRbtnClicked);
|
||||
|
||||
ui->cb_category->addItem("电气设备",0);
|
||||
ui->cb_category->addItem("连接关系",1);
|
||||
ui->cb_type->addItem("母线",1);
|
||||
ui->cb_type->addItem("异步电动机",2);
|
||||
ui->cb_type->addItem("断路器",3);
|
||||
ui->cb_type->addItem("电缆",4);
|
||||
ui->cb_type->addItem("电流互感器",5);
|
||||
ui->cb_type->addItem("电压互感器",6);
|
||||
ui->cb_type->addItem("隔离开关",7);
|
||||
ui->cb_type->addItem("接地开关",8);
|
||||
ui->cb_type->addItem("快速接地开关",9);
|
||||
ui->cb_type->addItem("双掷接地隔离开关",10);
|
||||
ui->cb_type->addItem("带电指示器",11);
|
||||
ui->cb_type->addItem("避雷器",12);
|
||||
ui->cb_type->addItem("电缆出线套筒",13);
|
||||
ui->cb_type->addItem("电缆端",14);
|
||||
|
||||
ui->tableView_items->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
ui->tableView_items->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
ui->tableView_items->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
ui->tableView_items->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
|
||||
ui->tableView_items->verticalHeader()->setVisible(false);
|
||||
|
||||
ui->tableView_selected->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
ui->tableView_selected->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
ui->tableView_selected->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
ui->tableView_selected->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
|
||||
ui->tableView_selected->verticalHeader()->setVisible(false);
|
||||
}
|
||||
|
||||
void DiagramEditorTransDetailAddDlg::showDlg(int nType)
|
||||
{
|
||||
if(_pParent){
|
||||
_selectedModel->clear();
|
||||
_selectedModel->setHorizontalHeaderLabels({"分类", "名称", "类型", "关联对象", "引用线路"});
|
||||
show();
|
||||
auto pCompo = _pParent->getComponentModel();
|
||||
auto pRoute = _pParent->getRouteModels().value(nType);
|
||||
int n = pRoute->rowCount();
|
||||
ui->le_routeName->setText("线路"+QString::number(n+1));
|
||||
ui->tableView_items->setModel(pCompo);
|
||||
ui->label->setText("新建线路");
|
||||
ui->le_routeName->setReadOnly(true);
|
||||
_curMode = 0;
|
||||
_curType = nType;
|
||||
}
|
||||
}
|
||||
|
||||
void DiagramEditorTransDetailAddDlg::showDlg(DiagramEditorRouteInfo info)
|
||||
{
|
||||
if(_pParent){
|
||||
_selectedModel->clear();
|
||||
_selectedModel->setHorizontalHeaderLabels({"分类", "名称", "类型", "关联对象", "引用线路"});
|
||||
ui->le_routeName->setText(info.sRouteName);
|
||||
for(auto& component:info.lstCompo){
|
||||
|
||||
QStandardItem *itemCate = new QStandardItem();
|
||||
QStandardItem *itemName = new QStandardItem();
|
||||
QStandardItem *itemType = new QStandardItem();
|
||||
QStandardItem *itemObj = new QStandardItem();
|
||||
QStandardItem *itemRoute = new QStandardItem();
|
||||
|
||||
QString sCate;
|
||||
QString sType;
|
||||
if(component.nCategory == 0){
|
||||
sCate = "电气设备";
|
||||
if(component.nType == 1){
|
||||
sType = "母线";
|
||||
}
|
||||
else if(component.nType == 2){
|
||||
sType = "异步电动机";
|
||||
}
|
||||
else if(component.nType == 3){
|
||||
sType = "断路器";
|
||||
}
|
||||
else if(component.nType == 4){
|
||||
sType = "电缆";
|
||||
}
|
||||
else if(component.nType == 5){
|
||||
sType = "电流互感器";
|
||||
}
|
||||
else if(component.nType == 6){
|
||||
sType = "电压互感器";
|
||||
}
|
||||
else if(component.nType == 7){
|
||||
sType = "隔离开关";
|
||||
}
|
||||
else if(component.nType == 8){
|
||||
sType = "接地开关";
|
||||
}
|
||||
else if(component.nType == 9){
|
||||
sType = "快速接地开关";
|
||||
}
|
||||
else if(component.nType == 10){
|
||||
sType = "双掷接地隔离开关";
|
||||
}
|
||||
else if(component.nType == 11){
|
||||
sType = "带电指示器";
|
||||
}
|
||||
else if(component.nType == 12){
|
||||
sType = "避雷器";
|
||||
}
|
||||
else if(component.nType == 13){
|
||||
sType = "电缆出线套筒";
|
||||
}
|
||||
else if(component.nType == 14){
|
||||
sType = "电缆端";
|
||||
}
|
||||
}
|
||||
else if(component.nCategory == 1){
|
||||
sCate = "连接关系";
|
||||
if(component.nType == 1){
|
||||
sType = "连接点";
|
||||
}
|
||||
}
|
||||
itemCate->setText(sCate);
|
||||
itemName->setText(component.sName);
|
||||
itemType->setText(sType);
|
||||
itemObj->setText(component.sBindObj);
|
||||
itemRoute->setText(component.sUsedRoute.join(","));
|
||||
|
||||
QList<QStandardItem*> lstItems;
|
||||
lstItems<<itemCate<<itemName<<itemType<<itemObj<<itemRoute;
|
||||
_selectedModel->appendRow(lstItems);
|
||||
}
|
||||
show();
|
||||
ui->label->setText("编辑线路");
|
||||
ui->le_routeName->setReadOnly(false);
|
||||
_curMode = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void DiagramEditorTransDetailAddDlg::onAddClicked()
|
||||
{
|
||||
// 获取当前选中的索引
|
||||
QModelIndexList selectedIndexes = ui->tableView_items->selectionModel()->selectedRows();
|
||||
if (selectedIndexes.isEmpty()) {
|
||||
return; // 没有选中任何行
|
||||
}
|
||||
|
||||
QSet<int> uniqueRows;
|
||||
foreach (const QModelIndex &index, selectedIndexes) {
|
||||
uniqueRows.insert(index.row());
|
||||
}
|
||||
|
||||
auto pCompoModel = _pParent->getComponentModel();
|
||||
|
||||
foreach (int row, uniqueRows) {
|
||||
QStandardItem *sourceItemName = pCompoModel->item(row, 1); //名称
|
||||
int rowCount = _selectedModel->rowCount();
|
||||
for(int i = 0;i < rowCount;++i){
|
||||
QStandardItem *item = _selectedModel->item(i, 1);
|
||||
if(item->text() == sourceItemName->text()){
|
||||
QMessageBox::information(NULL, QString("提示"), QString::fromWCharArray(L"线路中设备已存在"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
QList<QStandardItem*> newRowItems;
|
||||
for (int col = 0; col < pCompoModel->columnCount(); ++col) {
|
||||
QStandardItem *sourceItem = pCompoModel->item(row, col);
|
||||
if (sourceItem) {
|
||||
// 创建深拷贝(重要!)
|
||||
if(col == 4){ //线路引用,特殊处理
|
||||
QString strAllRoute = sourceItem->text();
|
||||
QString strCurRoute = ui->le_routeName->text();
|
||||
|
||||
if(!strAllRoute.contains(strCurRoute)){ //第一个引用不加符号
|
||||
if(strAllRoute.isEmpty())
|
||||
sourceItem->setText(strCurRoute);
|
||||
else
|
||||
sourceItem->setText(strAllRoute+","+strCurRoute);
|
||||
}
|
||||
}
|
||||
|
||||
QStandardItem *newItem = sourceItem->clone();
|
||||
newRowItems.append(newItem);
|
||||
} else {
|
||||
// 如果单元格为空,创建空项目
|
||||
newRowItems.append(new QStandardItem());
|
||||
}
|
||||
}
|
||||
_selectedModel->appendRow(newRowItems);
|
||||
}
|
||||
}
|
||||
|
||||
void DiagramEditorTransDetailAddDlg::onDeleteClicked()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void DiagramEditorTransDetailAddDlg::onSaveClicked()
|
||||
{
|
||||
QString sCategory = ui->cb_category->currentText();
|
||||
int nCate = ui->cb_category->currentData().toInt();
|
||||
QString sName = ui->le_name->text();
|
||||
QString sType = ui->cb_type->currentText();
|
||||
int nType = ui->cb_type->currentData().toInt();
|
||||
QString sBindObj = ui->cb_bindObj->currentText();
|
||||
|
||||
if(_pParent){
|
||||
auto pCompoModel = _pParent->getComponentModel();
|
||||
int rowCount = pCompoModel->rowCount();
|
||||
for(int i = 0;i < rowCount;++i){
|
||||
QStandardItem *item = pCompoModel->item(i, 1);
|
||||
if(item->text() == sName){
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText(QString::fromWCharArray(L"提示"));
|
||||
msgBox.setInformativeText(QString::fromWCharArray(L"设备名已存在,是否覆盖?"));
|
||||
msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
|
||||
msgBox.setDefaultButton(QMessageBox::Cancel);
|
||||
int ret = msgBox.exec();
|
||||
|
||||
switch (ret) {
|
||||
case QMessageBox::Ok: //覆盖
|
||||
{
|
||||
QStandardItem *itemCate = pCompoModel->item(i, 0);
|
||||
QStandardItem *itemType = pCompoModel->item(i, 2);
|
||||
QStandardItem *itemObj = pCompoModel->item(i, 3);
|
||||
QStandardItem *itemRoute = pCompoModel->item(i, 4);
|
||||
|
||||
item->setData(0); //覆盖时初始化方向占用
|
||||
itemCate->setText(sCategory);
|
||||
itemType->setText(sType);
|
||||
itemType->setData(nType);
|
||||
itemObj->setText(sBindObj);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case QMessageBox::Cancel:
|
||||
// Cancel was clicked
|
||||
return;
|
||||
default:
|
||||
// should never be reached
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QStandardItem *itemCate = new QStandardItem();
|
||||
QStandardItem *itemName = new QStandardItem();
|
||||
QStandardItem *itemType = new QStandardItem();
|
||||
QStandardItem *itemObj = new QStandardItem();
|
||||
QStandardItem *itemRoute = new QStandardItem();
|
||||
itemCate->setText(sCategory);
|
||||
itemCate->setData(nCate);
|
||||
itemName->setText(sName);
|
||||
itemName->setData(0); //初始化方向占用
|
||||
itemName->setData(QUuid::createUuid(),Qt::UserRole+3); //初始化时赋予uuid
|
||||
itemType->setText(sType);
|
||||
itemType->setData(nType);
|
||||
itemObj->setText(sBindObj);
|
||||
|
||||
QList<QStandardItem*> lstItems;
|
||||
lstItems<<itemCate<<itemName<<itemType<<itemObj<<itemRoute;
|
||||
pCompoModel->appendRow(lstItems);
|
||||
}
|
||||
}
|
||||
|
||||
void DiagramEditorTransDetailAddDlg::onOkClicked()
|
||||
{
|
||||
QString sRoute = ui->le_routeName->text();
|
||||
auto& mapRoute = _pParent->getRouteMaps()[_curType];
|
||||
QStringList lstName; //线路的设备列表
|
||||
DiagramEditorRouteInfo routeInfo;
|
||||
routeInfo.sRouteName = sRoute;
|
||||
|
||||
int rowCount = _selectedModel->rowCount();
|
||||
for(int i = 0;i < rowCount;++i){
|
||||
DiagramEditorComponentInfo compoInfo;
|
||||
QStandardItem *itemCategory = _selectedModel->item(i, 0);
|
||||
QStandardItem *itemName = _selectedModel->item(i, 1);
|
||||
QStandardItem *itemType = _selectedModel->item(i, 2);
|
||||
QStandardItem *itemBind = _selectedModel->item(i, 3);
|
||||
QStandardItem *itemAllRoute = _selectedModel->item(i, 4);
|
||||
|
||||
QString sCate = itemCategory->text();
|
||||
QString sName = itemName->text();
|
||||
QString sType = itemType->text();
|
||||
QString sBind = itemBind->text();
|
||||
QString sAllRoute = itemAllRoute->text();
|
||||
|
||||
int nCate = 0;
|
||||
if(sCate == "电气设备")
|
||||
nCate = 0;
|
||||
else if(sCate == "连接关系")
|
||||
nCate = 1;
|
||||
|
||||
int nType = 0;
|
||||
nType = itemType->data().toInt();
|
||||
|
||||
compoInfo.nCategory = nCate;
|
||||
compoInfo.sName = sName;
|
||||
compoInfo.nType = nType;
|
||||
compoInfo.sBindObj = sBind;
|
||||
compoInfo.sUsedRoute = sAllRoute.split(",");
|
||||
|
||||
routeInfo.lstCompo.append(compoInfo);
|
||||
lstName.append(sName);
|
||||
}
|
||||
|
||||
QString strCompoNames = lstName.join(",");
|
||||
|
||||
if(_curMode == 0){
|
||||
if(mapRoute.contains(sRoute)){
|
||||
QMessageBox::information(NULL, QString("提示"), QString::fromWCharArray(L"线路名重复"));
|
||||
return;
|
||||
}
|
||||
|
||||
mapRoute.insert(sRoute,routeInfo); //插入线路到parent存储中
|
||||
|
||||
QStandardItem *itemRoute = new QStandardItem();
|
||||
QStandardItem *itemNames = new QStandardItem();
|
||||
itemRoute->setText(sRoute);
|
||||
itemNames->setText(strCompoNames);
|
||||
|
||||
QList<QStandardItem*> lstItems;
|
||||
lstItems<<itemRoute<<itemNames;
|
||||
|
||||
auto pRoute = _pParent->getRouteModels().value(_curType);
|
||||
pRoute->appendRow(lstItems);
|
||||
}
|
||||
else if(_curMode == 1){
|
||||
mapRoute[sRoute] = routeInfo;
|
||||
auto pRoute = _pParent->getRouteModels().value(_curType);
|
||||
int nCount = pRoute->rowCount();
|
||||
for(int i = 0;i < rowCount;++i){
|
||||
QStandardItem *itemName = pRoute->item(i, 0);
|
||||
if(itemName->text() == sRoute){
|
||||
QStandardItem *itemRoutes = pRoute->item(i, 1);
|
||||
itemRoutes->setText(strCompoNames);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
hide();
|
||||
}
|
||||
|
||||
void DiagramEditorTransDetailAddDlg::onCancelClicked()
|
||||
{
|
||||
hide();
|
||||
}
|
||||
|
||||
void DiagramEditorTransDetailAddDlg::onCategoryChanged(const QString& str)
|
||||
{
|
||||
ui->cb_type->clear();
|
||||
if(str == "电气设备"){
|
||||
QStringList lst;
|
||||
ui->cb_type->addItem("母线",1);
|
||||
ui->cb_type->addItem("异步电动机",2);
|
||||
ui->cb_type->addItem("断路器",3);
|
||||
ui->cb_type->addItem("电缆",4);
|
||||
ui->cb_type->addItem("电流互感器",5);
|
||||
ui->cb_type->addItem("电压互感器",6);
|
||||
ui->cb_type->addItem("隔离开关",7);
|
||||
ui->cb_type->addItem("接地开关",8);
|
||||
ui->cb_type->addItem("快速接地开关",9);
|
||||
ui->cb_type->addItem("双掷接地隔离开关",10);
|
||||
ui->cb_type->addItem("带电指示器",11);
|
||||
ui->cb_type->addItem("避雷器",12);
|
||||
ui->cb_type->addItem("电缆出线套筒",13);
|
||||
ui->cb_type->addItem("电缆端",14);
|
||||
}
|
||||
else if(str == "连接关系"){
|
||||
ui->cb_type->addItem("连接点",1);
|
||||
}
|
||||
}
|
||||
|
||||
void DiagramEditorTransDetailAddDlg::onComponentDeleteClicked()
|
||||
{
|
||||
// 获取当前选中的索引
|
||||
QModelIndexList selectedIndexes = ui->tableView_items->selectionModel()->selectedRows();
|
||||
if (selectedIndexes.isEmpty()) {
|
||||
return; // 没有选中任何行
|
||||
}
|
||||
|
||||
// 获取行号并排序(从大到小删除避免索引变化)
|
||||
QList<int> rowsToRemove;
|
||||
foreach (const QModelIndex &index, selectedIndexes) {
|
||||
rowsToRemove.append(index.row());
|
||||
}
|
||||
|
||||
// 获取当前选中的第一项索引
|
||||
QModelIndex index = selectedIndexes.first();
|
||||
if (!index.isValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QModelIndex indexName = index.sibling(index.row(),1);
|
||||
QString sName = indexName.data().toString();
|
||||
|
||||
bool bUsed = false;
|
||||
auto& mapRoute = _pParent->getRouteMaps()[_curType]; //检索所有路线,判断设备占用情况
|
||||
for(auto& route:mapRoute){
|
||||
QString sRoute = route.sRouteName;
|
||||
for(auto& compo:route.lstCompo){
|
||||
if(compo.sName == sName){
|
||||
bUsed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
auto pCompoModel = _pParent->getComponentModel();
|
||||
if(bUsed){
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText(QString::fromWCharArray(L"提示"));
|
||||
msgBox.setInformativeText(QString::fromWCharArray(L"设备已被使用,是否保存?"));
|
||||
msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
|
||||
msgBox.setDefaultButton(QMessageBox::Cancel);
|
||||
int ret = msgBox.exec();
|
||||
|
||||
switch (ret) {
|
||||
case QMessageBox::Ok: //同步删除所有占用对象
|
||||
{
|
||||
for(auto& route:mapRoute){
|
||||
QString sRoute = route.sRouteName;
|
||||
for(int i = 0;i < route.lstCompo.size();++i){
|
||||
QString sCompo = route.lstCompo[i].sName;
|
||||
if(sCompo == sName){
|
||||
route.lstCompo.removeAt(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//todo:刷新主界面
|
||||
|
||||
foreach (int row, rowsToRemove) {
|
||||
QList<QStandardItem*> rowItems;
|
||||
for (int col = 0; col < pCompoModel->columnCount(); ++col) {
|
||||
QStandardItem *item = pCompoModel->takeItem(row, col);
|
||||
rowItems.append(item);
|
||||
}
|
||||
qDeleteAll(rowItems); //take的item不释放
|
||||
pCompoModel->removeRow(row);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case QMessageBox::Cancel:
|
||||
// Cancel was clicked
|
||||
break;
|
||||
default:
|
||||
// should never be reached
|
||||
break;
|
||||
}
|
||||
}
|
||||
else{
|
||||
// 移除行
|
||||
foreach (int row, rowsToRemove) {
|
||||
QList<QStandardItem*> rowItems;
|
||||
for (int col = 0; col < pCompoModel->columnCount(); ++col) {
|
||||
QStandardItem *item = pCompoModel->takeItem(row, col);
|
||||
rowItems.append(item);
|
||||
}
|
||||
qDeleteAll(rowItems); //take的item不释放
|
||||
pCompoModel->removeRow(row);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DiagramEditorTransDetailAddDlg::onComponentRbtnClicked(const QPoint &pos)
|
||||
{
|
||||
QModelIndex index = ui->tableView_items->indexAt(pos);
|
||||
if (!index.isValid()) {
|
||||
return; // 如果点击的是空白区域,直接返回
|
||||
}
|
||||
|
||||
QMenu menu;
|
||||
QAction *deleteAction = new QAction("删除", this);
|
||||
menu.addAction(deleteAction);
|
||||
|
||||
// 连接删除菜单项的触发信号与槽函数
|
||||
connect(deleteAction, &QAction::triggered, this, &DiagramEditorTransDetailAddDlg::onComponentDeleteClicked);
|
||||
|
||||
// 在点击位置显示菜单
|
||||
menu.exec(ui->tableView_items->mapToGlobal(pos));
|
||||
}
|
||||
|
||||
void DiagramEditorTransDetailAddDlg::onRouteDeleteClicked()
|
||||
{
|
||||
// 获取当前选中的索引
|
||||
QModelIndexList selectedIndexes = ui->tableView_selected->selectionModel()->selectedRows();
|
||||
if (selectedIndexes.isEmpty()) {
|
||||
return; // 没有选中任何行
|
||||
}
|
||||
|
||||
// 获取行号并排序(从大到小删除避免索引变化)
|
||||
QList<int> rowsToRemove;
|
||||
foreach (const QModelIndex &index, selectedIndexes) {
|
||||
rowsToRemove.append(index.row());
|
||||
}
|
||||
|
||||
// 获取当前选中的第一项索引
|
||||
QModelIndex index = selectedIndexes.first();
|
||||
if (!index.isValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QModelIndex indexName = index.sibling(index.row(),1);
|
||||
QString sName = indexName.data().toString();
|
||||
|
||||
// 移除行
|
||||
foreach (int row, rowsToRemove) {
|
||||
QList<QStandardItem*> rowItems;
|
||||
for (int col = 0; col < _selectedModel->columnCount(); ++col) {
|
||||
QStandardItem *item = _selectedModel->takeItem(row, col);
|
||||
rowItems.append(item);
|
||||
}
|
||||
qDeleteAll(rowItems); //take的item不释放
|
||||
_selectedModel->removeRow(row);
|
||||
}
|
||||
|
||||
QString sRoute = ui->le_routeName->text();
|
||||
auto pCompoModel = _pParent->getComponentModel();
|
||||
int rowCount = pCompoModel->rowCount(); //移除设备库占用记录
|
||||
for(int i = 0;i < rowCount;++i){
|
||||
QStandardItem *itemName = pCompoModel->item(i, 1);
|
||||
if(itemName->text() == sName){
|
||||
QStandardItem *itemUsed = pCompoModel->item(i, 4);
|
||||
QString sUsed = itemUsed->text();
|
||||
QStringList lst = sUsed.split(",");
|
||||
lst.removeAll(sRoute);
|
||||
itemUsed->setText(lst.join(","));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DiagramEditorTransDetailAddDlg::onRouteRbtnClicked(const QPoint &pos)
|
||||
{
|
||||
QModelIndex index = ui->tableView_selected->indexAt(pos);
|
||||
if (!index.isValid()) {
|
||||
return; // 如果点击的是空白区域,直接返回
|
||||
}
|
||||
|
||||
QMenu menu;
|
||||
QAction *deleteAction = new QAction("移除", this);
|
||||
menu.addAction(deleteAction);
|
||||
|
||||
// 连接删除菜单项的触发信号与槽函数
|
||||
connect(deleteAction, &QAction::triggered, this, &DiagramEditorTransDetailAddDlg::onRouteDeleteClicked);
|
||||
|
||||
// 在点击位置显示菜单
|
||||
menu.exec(ui->tableView_selected->mapToGlobal(pos));
|
||||
}
|
||||
|
|
@ -0,0 +1,403 @@
|
|||
#include <QMessageBox>
|
||||
#include <QMenu>
|
||||
#include "diagramEditor/diagramEditorTransDetailSettingDlg.h"
|
||||
#include "diagramEditor/diagramEditorTransDetailAddDlg.h"
|
||||
#include "diagramEditor/diagramEditorTransPreviewDlg.h"
|
||||
#include "diagramEditor/diagramEditorWizard.h"
|
||||
#include "ui_diagramEditorTransDetailSettingDlg.h"
|
||||
#include "diagramEditor/diagramEditorBaseBlock.h"
|
||||
#include "graphicsDataModel/diagramEditorModel.h"
|
||||
#include "topologyManager.h"
|
||||
#include "diagramEditor/diagramEditorTransPreviewDlg.h"
|
||||
|
||||
DiagramEditorTransDetailSettingDlg::DiagramEditorTransDetailSettingDlg(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
, ui(new Ui::diagramEditorTransDetailSettingDlg)
|
||||
,_pAddDlg(nullptr)
|
||||
,_curOperateObj(nullptr)
|
||||
,_compoModel(nullptr)
|
||||
,_pPreviewDlg(nullptr)
|
||||
,_pModel(nullptr)
|
||||
,_curOperateRouteView(nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->setWindowFlags(Qt::FramelessWindowHint | windowFlags());
|
||||
this->setWindowModality(Qt::WindowModal);
|
||||
setStyleSheet("background-color: white;");
|
||||
initial();
|
||||
}
|
||||
|
||||
DiagramEditorTransDetailSettingDlg::~DiagramEditorTransDetailSettingDlg()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void DiagramEditorTransDetailSettingDlg::initial()
|
||||
{
|
||||
_compoModel = new QStandardItemModel(this);
|
||||
for(int i = 0;i < 3;++i){
|
||||
auto pModel = new QStandardItemModel(this);
|
||||
pModel->setHorizontalHeaderLabels({"线路名", "包含设备"});
|
||||
_routeModels[i] = pModel;
|
||||
if(i == 0){
|
||||
ui->tableView_hv->setModel(pModel);
|
||||
}
|
||||
else if(i == 1){
|
||||
ui->tableView_mv->setModel(pModel);
|
||||
}
|
||||
else if(i == 2){
|
||||
ui->tableView_lv->setModel(pModel);
|
||||
}
|
||||
}
|
||||
|
||||
connect(ui->btn_add,&QPushButton::clicked,this,&DiagramEditorTransDetailSettingDlg::onAddClicked);
|
||||
connect(ui->btn_ok,&QPushButton::clicked,this,&DiagramEditorTransDetailSettingDlg::onOkClicked);
|
||||
connect(ui->btn_cancel,&QPushButton::clicked,this,&DiagramEditorTransDetailSettingDlg::onCancelClicked);
|
||||
connect(ui->btn_previewEquips,&QPushButton::clicked,this,&DiagramEditorTransDetailSettingDlg::onPreviewNeutralClicked);
|
||||
connect(ui->btn_previewTrans,&QPushButton::clicked,this,&DiagramEditorTransDetailSettingDlg::onPreviewTransClicked);
|
||||
connect(ui->tableView_hv, &QTableView::customContextMenuRequested, this, &DiagramEditorTransDetailSettingDlg::onRouteRbtnClicked);
|
||||
connect(ui->tableView_mv, &QTableView::customContextMenuRequested, this, &DiagramEditorTransDetailSettingDlg::onRouteRbtnClicked);
|
||||
connect(ui->tableView_lv, &QTableView::customContextMenuRequested, this, &DiagramEditorTransDetailSettingDlg::onRouteRbtnClicked);
|
||||
|
||||
ui->tableView_hv->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
ui->tableView_hv->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
ui->tableView_hv->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
ui->tableView_hv->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
|
||||
ui->tableView_hv->verticalHeader()->setVisible(false);
|
||||
|
||||
ui->tableView_mv->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
ui->tableView_mv->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
ui->tableView_mv->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
ui->tableView_mv->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
|
||||
ui->tableView_mv->verticalHeader()->setVisible(false);
|
||||
|
||||
ui->tableView_lv->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
ui->tableView_lv->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
ui->tableView_lv->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
ui->tableView_lv->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
|
||||
ui->tableView_lv->verticalHeader()->setVisible(false);
|
||||
}
|
||||
|
||||
void DiagramEditorTransDetailSettingDlg::refreshModel()
|
||||
{
|
||||
if(_curOperateObj){
|
||||
_compoModel->clear();
|
||||
_compoModel->setColumnCount(5);
|
||||
_compoModel->setHorizontalHeaderLabels({"分类", "名称", "类型", "关联对象", "引用线路"});
|
||||
auto mapComponent = _curOperateObj->getComponentMap();
|
||||
for(auto& comp:mapComponent){
|
||||
DiagramEditorComponentInfo info = comp;
|
||||
QStandardItem *itemCate = new QStandardItem();
|
||||
QStandardItem *itemName = new QStandardItem();
|
||||
QStandardItem *itemType = new QStandardItem();
|
||||
QStandardItem *itemObj = new QStandardItem();
|
||||
QStandardItem *itemRoute = new QStandardItem();
|
||||
QString sCategory;
|
||||
if(info.nCategory == 0){
|
||||
sCategory = "设备";
|
||||
}
|
||||
else if(info.nCategory == 1){
|
||||
sCategory = "连接关系";
|
||||
}
|
||||
QString sType;
|
||||
if(info.nType == 1)
|
||||
{
|
||||
sType = "母线";
|
||||
}
|
||||
else if(info.nType == 2)
|
||||
{
|
||||
sType = "异步电动机";
|
||||
}
|
||||
else if(info.nType == 3)
|
||||
{
|
||||
sType = "断路器";
|
||||
}
|
||||
else if(info.nType == 4)
|
||||
{
|
||||
sType = "电缆";
|
||||
}
|
||||
else if(info.nType == 5)
|
||||
{
|
||||
sType = "电流互感器";
|
||||
}
|
||||
else if(info.nType == 6)
|
||||
{
|
||||
sType = "电压互感器";
|
||||
}
|
||||
else if(info.nType == 7)
|
||||
{
|
||||
sType = "隔离开关";
|
||||
}
|
||||
else if(info.nType == 8)
|
||||
{
|
||||
sType = "接地开关";
|
||||
}
|
||||
else if(info.nType == 9)
|
||||
{
|
||||
sType = "快速接地开关";
|
||||
}
|
||||
else if(info.nType == 10)
|
||||
{
|
||||
sType = "双掷接地隔离开关";
|
||||
}
|
||||
else if(info.nType == 11)
|
||||
{
|
||||
sType = "带点指示器";
|
||||
}
|
||||
else if(info.nType == 12)
|
||||
{
|
||||
sType = "避雷器";
|
||||
}
|
||||
else if(info.nType == 13)
|
||||
{
|
||||
sType = "电缆出线套筒";
|
||||
}
|
||||
else if(info.nType == 14)
|
||||
{
|
||||
sType = "电缆端";
|
||||
}
|
||||
itemCate->setText(sCategory);
|
||||
itemName->setText(info.sName);
|
||||
itemType->setText(sType);
|
||||
itemObj->setText(info.sBindObj);
|
||||
itemRoute->setText(info.sUsedRoute.join("、"));
|
||||
|
||||
QList<QStandardItem*> lstItems;
|
||||
lstItems<<itemCate<<itemName<<itemType<<itemObj<<itemRoute;
|
||||
_compoModel->appendRow(lstItems);
|
||||
}
|
||||
|
||||
for(auto pModel:_routeModels){
|
||||
pModel->clear();
|
||||
pModel->setColumnCount(2);
|
||||
pModel->setHorizontalHeaderLabels({"线路名", "包含设备"});
|
||||
}
|
||||
|
||||
auto mapRoutes = _curOperateObj->getRouteInfoMaps();
|
||||
setRouteMaps(mapRoutes); //更新路径数据到本界面
|
||||
for(auto it = mapRoutes.begin();it != mapRoutes.end();++it){
|
||||
for(auto& route:it.value()){
|
||||
QString sRoute = route.sRouteName;
|
||||
QStringList lstComp;
|
||||
for(auto& comp:route.lstCompo){
|
||||
lstComp.append(comp.sName);
|
||||
}
|
||||
|
||||
QStandardItem *itemRoute = new QStandardItem();
|
||||
QStandardItem *itemComponents = new QStandardItem();
|
||||
|
||||
itemRoute->setText(sRoute);
|
||||
itemComponents->setText(lstComp.join(","));
|
||||
QList<QStandardItem*> lstItems;
|
||||
lstItems<<itemRoute<<itemComponents;
|
||||
|
||||
auto routeModel = _routeModels.value(it.key());
|
||||
if(routeModel)
|
||||
routeModel->appendRow(lstItems);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DiagramEditorTransDetailSettingDlg::showDlg(DiagramEditorTransformerBlock* p)
|
||||
{
|
||||
show();
|
||||
_curOperateObj = p;
|
||||
refreshModel();
|
||||
}
|
||||
|
||||
void DiagramEditorTransDetailSettingDlg::onAddClicked()
|
||||
{
|
||||
if(_pAddDlg == nullptr){
|
||||
_pAddDlg = new DiagramEditorTransDetailAddDlg(this);
|
||||
_pAddDlg->setParent(this);
|
||||
}
|
||||
int n = ui->tabWidget->currentIndex();
|
||||
_pAddDlg->showDlg(n);
|
||||
}
|
||||
|
||||
void DiagramEditorTransDetailSettingDlg::onOkClicked()
|
||||
{
|
||||
//将ui设置的参数更新到对应block
|
||||
if(_curOperateObj){
|
||||
_curOperateObj->setRouteInfoMaps(_mapsRouteInfo);
|
||||
|
||||
QMap<QString,DiagramEditorComponentInfo> mapComponents;
|
||||
int nRowCount = _compoModel->rowCount();
|
||||
for(int i = 0;i < nRowCount;++i){
|
||||
QStandardItem *itemCate = _compoModel->item(i, 0);
|
||||
QStandardItem *itemName = _compoModel->item(i, 1);
|
||||
QStandardItem *itemType = _compoModel->item(i, 2);
|
||||
QStandardItem *itemBind = _compoModel->item(i, 3);
|
||||
QStandardItem *itemRoute = _compoModel->item(i, 4);
|
||||
int nDir = itemName->data(Qt::UserRole+1).toInt(); //连接方向
|
||||
QPoint deltaPos = itemName->data(Qt::UserRole+2).toPoint(); //相对位置
|
||||
QUuid uid = itemName->data(Qt::UserRole+3).toUuid(); //uid
|
||||
int nVal = itemName->data(Qt::UserRole+4).toInt(); //标志
|
||||
int nRotate = itemName->data(Qt::UserRole+5).toInt(); //旋转角度
|
||||
|
||||
DiagramEditorComponentInfo compoInfo;
|
||||
if(itemCate->text() == "电气设备"){
|
||||
compoInfo.nCategory = 0;
|
||||
}
|
||||
else if(itemCate->text() == "连接关系"){
|
||||
compoInfo.nCategory = 1;
|
||||
}
|
||||
compoInfo.sName = itemName->text();
|
||||
compoInfo.nType = itemType->data().toInt();
|
||||
compoInfo.sBindObj = itemBind->text();
|
||||
compoInfo.sUsedRoute = itemRoute->text().split(",");
|
||||
compoInfo.nUsedDirection = nDir;
|
||||
compoInfo.deltaPos = deltaPos;
|
||||
compoInfo.uid = uid;
|
||||
compoInfo.nFlag = nVal;
|
||||
compoInfo.nRotate = nRotate;
|
||||
|
||||
mapComponents.insert(compoInfo.sName,compoInfo);
|
||||
}
|
||||
_curOperateObj->setComponentMap(mapComponents);
|
||||
TopologyManager::instance().clearGlobalBlockData(_curOperateObj->getName());
|
||||
TopologyManager::instance().moveTempBlockData();
|
||||
_curOperateObj = nullptr;
|
||||
}
|
||||
hide();
|
||||
_pModel->clearCurPreview(); //关闭时清除预览Item
|
||||
//todo:清除mainPanel中的对应item(如果存在)
|
||||
}
|
||||
|
||||
void DiagramEditorTransDetailSettingDlg::onCancelClicked()
|
||||
{
|
||||
hide();
|
||||
}
|
||||
|
||||
void DiagramEditorTransDetailSettingDlg::onRouteDeleteClicked()
|
||||
{
|
||||
// 获取当前选中的索引
|
||||
QModelIndexList selectedIndexes = _curOperateRouteView->selectionModel()->selectedRows();
|
||||
if (selectedIndexes.isEmpty()) {
|
||||
return; // 没有选中任何行
|
||||
}
|
||||
|
||||
// 获取行号并排序(从大到小删除避免索引变化)
|
||||
QList<int> rowsToRemove;
|
||||
foreach (const QModelIndex &index, selectedIndexes) {
|
||||
rowsToRemove.append(index.row());
|
||||
}
|
||||
|
||||
// 获取当前选中的第一项索引
|
||||
QModelIndex index = selectedIndexes.first();
|
||||
if (!index.isValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QModelIndex indexName = index.sibling(index.row(),0);
|
||||
QString sName = indexName.data().toString();
|
||||
|
||||
// 移除行
|
||||
int n = ui->tabWidget->currentIndex();
|
||||
foreach (int row, rowsToRemove) {
|
||||
QList<QStandardItem*> rowItems;
|
||||
for (int col = 0; col < _routeModels.value(n)->columnCount(); ++col) {
|
||||
QStandardItem *item = _routeModels.value(n)->takeItem(row, col);
|
||||
rowItems.append(item);
|
||||
}
|
||||
qDeleteAll(rowItems); //take的item不释放
|
||||
_routeModels.value(n)->removeRow(row);
|
||||
}
|
||||
|
||||
_mapsRouteInfo.value(n).remove(sName); //同步移除数据
|
||||
}
|
||||
|
||||
void DiagramEditorTransDetailSettingDlg::onRouteRbtnClicked(const QPoint &pos)
|
||||
{
|
||||
int n = ui->tabWidget->currentIndex();
|
||||
if(n == 0){ //高压中性点v
|
||||
_curOperateRouteView = ui->tableView_hv;
|
||||
}
|
||||
else if(n == 1){ //中压
|
||||
_curOperateRouteView = ui->tableView_mv;
|
||||
}
|
||||
else if(n == 2){ //低压
|
||||
_curOperateRouteView = ui->tableView_lv;
|
||||
}
|
||||
if(_curOperateRouteView){
|
||||
QModelIndex index = _curOperateRouteView->indexAt(pos);
|
||||
if (!index.isValid()) {
|
||||
return; // 如果点击的是空白区域,直接返回
|
||||
}
|
||||
|
||||
QMenu menu;
|
||||
QAction *deleteAction = new QAction("删除", this);
|
||||
QAction *modifyAction = new QAction("修改", this);
|
||||
menu.addAction(deleteAction);
|
||||
menu.addAction(modifyAction);
|
||||
|
||||
// 连接删除菜单项的触发信号与槽函数
|
||||
connect(deleteAction, &QAction::triggered, this, &DiagramEditorTransDetailSettingDlg::onRouteDeleteClicked);
|
||||
//连接修改
|
||||
connect(modifyAction, &QAction::triggered, this, &DiagramEditorTransDetailSettingDlg::onRouteEditClicked);
|
||||
|
||||
// 在点击位置显示菜单
|
||||
menu.exec(_curOperateRouteView->mapToGlobal(pos));
|
||||
}
|
||||
}
|
||||
|
||||
void DiagramEditorTransDetailSettingDlg::onRouteEditClicked()
|
||||
{
|
||||
if(_pAddDlg == nullptr){
|
||||
_pAddDlg = new DiagramEditorTransDetailAddDlg(this);
|
||||
_pAddDlg->setParent(this);
|
||||
}
|
||||
|
||||
// 获取当前选中的索引
|
||||
QModelIndexList selectedIndexes = _curOperateRouteView->selectionModel()->selectedRows();
|
||||
if (selectedIndexes.isEmpty()) {
|
||||
return; // 没有选中任何行
|
||||
}
|
||||
// 获取当前选中的第一项索引
|
||||
QModelIndex index = selectedIndexes.first();
|
||||
if (!index.isValid()) {
|
||||
return;
|
||||
}
|
||||
QModelIndex indexName = index.sibling(index.row(),0);
|
||||
QString sName = indexName.data().toString();
|
||||
|
||||
int n = ui->tabWidget->currentIndex();
|
||||
auto routeInfo = _mapsRouteInfo.value(n).value(sName);
|
||||
_pAddDlg->showDlg(routeInfo);
|
||||
}
|
||||
|
||||
void DiagramEditorTransDetailSettingDlg::onPreviewNeutralClicked()
|
||||
{
|
||||
if(_pPreviewDlg == nullptr){
|
||||
_pPreviewDlg = new DiagramEditorTransPreviewDlg(this);
|
||||
_pPreviewDlg->setParent(this);
|
||||
_pModel->setCurTransComponentModel(_compoModel);
|
||||
_pModel->setCurTransRouteModels(_routeModels);
|
||||
}
|
||||
if(!_pPreviewDlg->isVisible()){
|
||||
int n = ui->tabWidget->currentIndex();
|
||||
_pPreviewDlg->showDlg(n);
|
||||
_pModel->clearCurPreview();
|
||||
_pModel->generateTempTrans(n);
|
||||
}
|
||||
else
|
||||
_pPreviewDlg->hide();
|
||||
}
|
||||
|
||||
void DiagramEditorTransDetailSettingDlg::onPreviewTransClicked()
|
||||
{
|
||||
if(_pPreviewDlg == nullptr){
|
||||
_pPreviewDlg = new DiagramEditorTransPreviewDlg(this);
|
||||
_pPreviewDlg->setParent(this);
|
||||
_pModel->setCurTransComponentModel(_compoModel);
|
||||
_pModel->setCurTransRouteModels(_routeModels);
|
||||
}
|
||||
if(!_pPreviewDlg->isVisible()){
|
||||
_pPreviewDlg->showDlg(3);
|
||||
_pModel->clearCurPreview();
|
||||
_pModel->generateTempTrans(3,_curOperateObj);
|
||||
}
|
||||
else
|
||||
_pPreviewDlg->hide();
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
#include "diagramEditor/diagramEditorTransPreviewDlg.h"
|
||||
#include "diagramEditor/diagramEditorTransDetailSettingDlg.h"
|
||||
#include "diagramEditor/editView.h"
|
||||
#include "diagramEditor/editScene.h"
|
||||
#include "graphicsDataModel/diagramEditorModel.h"
|
||||
#include "global.h"
|
||||
|
||||
DiagramEditorTransPreviewDlg::DiagramEditorTransPreviewDlg(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
,_pView(nullptr)
|
||||
,_pScene(nullptr)
|
||||
,_pMainLayout(nullptr)
|
||||
,_pParent(nullptr)
|
||||
{
|
||||
QRect recParent = parent->geometry();
|
||||
setGeometry(recParent.right(),recParent.y(),recParent.width(),recParent.height());
|
||||
initial();
|
||||
}
|
||||
|
||||
DiagramEditorTransPreviewDlg::~DiagramEditorTransPreviewDlg()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void DiagramEditorTransPreviewDlg::initial()
|
||||
{
|
||||
_pMainLayout = new QVBoxLayout(this);
|
||||
_pView = new EditView(this);
|
||||
_pMainLayout->addWidget(_pView);
|
||||
_pScene = new EditPreviewScene(this);
|
||||
_pScene->setSceneRect(-g_dGriaphicsScene_Width / 2, -g_dGriaphicsScene_Height / 2, g_dGriaphicsScene_Width, g_dGriaphicsScene_Height);
|
||||
_pView->setScene(_pScene);
|
||||
}
|
||||
|
||||
void DiagramEditorTransPreviewDlg::showDlg(int nType)
|
||||
{
|
||||
if(_pParent){
|
||||
_pParent->getModel()->setCurPreviewScene(_pScene);
|
||||
}
|
||||
show();
|
||||
updateModelData(nType);
|
||||
}
|
||||
|
||||
void DiagramEditorTransPreviewDlg::updateModelData(int nType)
|
||||
{
|
||||
if(nType == 0 || nType == 1 || nType == 2){
|
||||
_pParent->getModel()->updateTarget(_pParent->getRouteMaps()[nType],14,1); //1右2下
|
||||
}
|
||||
else if(nType == 3){ //整个变压器
|
||||
_pParent->getModel()->updateTarget(_pParent->getRouteMaps()[0],18,1); //1右2上
|
||||
_pParent->getModel()->updateTarget(_pParent->getRouteMaps()[1],14,1); //1右2下
|
||||
_pParent->getModel()->updateTarget(_pParent->getRouteMaps()[2],24,1); //1左2下
|
||||
}
|
||||
}
|
||||
|
|
@ -119,6 +119,7 @@ void DiagramEditorWizard::generateBayStruct()
|
|||
auto pContainer = new DiagramEditorStructContainer(this);
|
||||
pContainer->setId(QUuid::createUuid().toString());
|
||||
auto pBus = new DiagramEditorBusBlock(this);
|
||||
pBus->setId(QUuid::createUuid());
|
||||
pBus->setBusPro(sVoltage+"母线"+sDivPre,1,iter->dVoltage,0,i+1);
|
||||
pContainer->insertBlock(1,pBus);
|
||||
|
||||
|
|
@ -142,10 +143,12 @@ void DiagramEditorWizard::generateBayStruct()
|
|||
pContainer->setId(QUuid::createUuid().toString());
|
||||
|
||||
auto pBus1 = new DiagramEditorBusBlock(this);
|
||||
pBus1->setId(QUuid::createUuid());
|
||||
pBus1->setBusPro(sVoltage+"Ⅰ母"+sDivPre,1,iter->dVoltage,1,i+1);
|
||||
pContainer->insertBlock(1,pBus1);
|
||||
|
||||
auto pBus2 = new DiagramEditorBusBlock(this);
|
||||
pBus2->setId(QUuid::createUuid());
|
||||
pBus2->setBusPro(sVoltage+"Ⅱ母"+sDivPre,1,iter->dVoltage,2,i+1);
|
||||
pContainer->insertBlock(2,pBus2);
|
||||
_mapSturctContainer[iter.key()].insert(i,pContainer);
|
||||
|
|
@ -160,6 +163,7 @@ void DiagramEditorWizard::generateBayStruct()
|
|||
auto pContainer = new DiagramEditorStructContainer(this);
|
||||
|
||||
auto pBus1 = new DiagramEditorBusBlock(this);
|
||||
pBus1->setId(QUuid::createUuid());
|
||||
pBus1->setBusPro(sVoltage+"Ⅰ母"+sDivPre1,1,iter->dVoltage,1,i+1);
|
||||
pContainer->insertBlock(1,pBus1);
|
||||
|
||||
|
|
@ -172,6 +176,7 @@ void DiagramEditorWizard::generateBayStruct()
|
|||
}
|
||||
|
||||
auto pBus2 = new DiagramEditorBusBlock(this);
|
||||
pBus2->setId(QUuid::createUuid());
|
||||
pBus2->setBusPro(sVoltage+"Ⅱ母"+sDivPre2,1,iter->dVoltage,2,i+1);
|
||||
pContainer->insertBlock(2,pBus2);
|
||||
}
|
||||
|
|
@ -185,6 +190,7 @@ void DiagramEditorWizard::generateBayStruct()
|
|||
|
||||
auto pContainer = new DiagramEditorStructContainer(this);
|
||||
auto pBus2 = new DiagramEditorBusBlock(this);
|
||||
pBus2->setId(QUuid::createUuid());
|
||||
pBus2->setBusPro(sVoltage+"Ⅱ母"+sDivPre2,1,iter->dVoltage,2,i+1);
|
||||
pContainer->insertBlock(2,pBus2);
|
||||
|
||||
|
|
@ -197,6 +203,7 @@ void DiagramEditorWizard::generateBayStruct()
|
|||
}
|
||||
|
||||
auto pBus1 = new DiagramEditorBusBlock(this);
|
||||
pBus1->setId(QUuid::createUuid());
|
||||
pBus1->setBusPro(sVoltage+"Ⅰ母"+sDivPre1,1,iter->dVoltage,1,i+1);
|
||||
pContainer->insertBlock(1,pBus1);
|
||||
}
|
||||
|
|
@ -566,6 +573,7 @@ void DiagramEditorWizard::onAddTransFinished(DiagramEditorWizardTransformerInfo
|
|||
auto pContainer = new DiagramEditorStructContainer(this);
|
||||
auto pTrans = new DiagramEditorTransformerBlock(this);
|
||||
|
||||
pTrans->setId(QUuid::createUuid());
|
||||
pTrans->setName(info.sName);
|
||||
pTrans->setType(3);
|
||||
pTrans->setTransType(info.nType);
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
#include "diagramEditor/diagramEditorBaseBlock.h"
|
||||
#include "diagramEditor/editItems.h"
|
||||
#include "diagramEditor/diagramEditorBayDetailSettingDlg.h"
|
||||
#include "diagramEditor/diagramEditorTransDetailSettingDlg.h"
|
||||
#include "graphicsDataModel/diagramEditorModel.h"
|
||||
#include "global.h"
|
||||
#include <QDebug>
|
||||
|
|
@ -24,9 +25,11 @@ EditPanel::EditPanel(QWidget *parent)
|
|||
: QWidget(parent)
|
||||
,_curWizard(nullptr)
|
||||
,_bayDetailSetting(nullptr)
|
||||
,_transDetailSetting(nullptr)
|
||||
,_pModel(nullptr)
|
||||
{
|
||||
_pModel = new DiagramEditorModel();
|
||||
_pModel->setPanel(this);
|
||||
_maxWidth = 0;
|
||||
_maxHeight = 0;
|
||||
_layout = new QVBoxLayout(this);
|
||||
|
|
@ -347,6 +350,29 @@ void EditPanel::initBlockConnection()
|
|||
}
|
||||
}
|
||||
|
||||
QList<EditBaseItem*> EditPanel::getBlockItems(EditorItemType typ)
|
||||
{
|
||||
QList<EditBaseItem*> lst;
|
||||
auto allItems = m_pEditScene->items();
|
||||
for(auto item:allItems){
|
||||
auto p = dynamic_cast<EditBaseItem*>(item);
|
||||
if(p){
|
||||
EditorItemType eType = p->getType();
|
||||
if(typ == EditorItemType::none){ //返回所有block item
|
||||
if(eType == EditorItemType::bay || eType == EditorItemType::bus || eType == EditorItemType::trans){
|
||||
lst.push_back(p);
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(eType == typ){
|
||||
lst.push_back(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return lst;
|
||||
}
|
||||
|
||||
void EditPanel::onWidthChanged(int width)
|
||||
{
|
||||
if(_maxWidth < width)
|
||||
|
|
@ -390,7 +416,13 @@ void EditPanel::onItemDbClicked(QPointer<DiagramEditorBaseBlock> pBlock)
|
|||
_bayDetailSetting->showDlg(pBay);
|
||||
}
|
||||
else if(pBlock->getType() == 3){ //变压器
|
||||
|
||||
if(_transDetailSetting == nullptr){
|
||||
_transDetailSetting = new DiagramEditorTransDetailSettingDlg(this);
|
||||
_transDetailSetting->setModelDelegate(_pModel);
|
||||
}
|
||||
auto pTrans = dynamic_cast<DiagramEditorTransformerBlock*>(pBlock.data());
|
||||
if(pTrans)
|
||||
_transDetailSetting->showDlg(pTrans);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ QPointF BaseModel::calculateBusPortPos(GraphicsBaseItem* pBus,GraphicsBaseItem*
|
|||
return QPointF(item->pos().x(),pBus->pos().y());
|
||||
}
|
||||
|
||||
template<typename TypeLine> void BaseModel::establishConnection(GraphicsBaseItem* pSrc,GraphicsBaseItem* pDest,TypeLine* pItem,ModelFunctionType nType)
|
||||
template<typename TypeLine> void BaseModel::establishConnection(GraphicsBaseItem* pSrc,GraphicsBaseItem* pDest,TypeLine* pItem,ModelFunctionType nType,int nMode,int nParam)
|
||||
{
|
||||
ItemPort* pSrcPort = nullptr;
|
||||
ItemPort* pDestPort = nullptr;
|
||||
|
|
@ -60,8 +60,9 @@ template<typename TypeLine> void BaseModel::establishConnection(GraphicsBaseItem
|
|||
pSrcPort = pSrc->getPortPtr(index);
|
||||
|
||||
QMap<QString,ItemPort*> mapPorts = pDest->getPorts();
|
||||
double minDis = 999;
|
||||
|
||||
if(nMode == 0){
|
||||
double minDis = 999;
|
||||
for(auto& port:mapPorts) //与母线或节点连接时,连接最近接线点
|
||||
{
|
||||
double dis = distanceBetweenItems(port,pDest);
|
||||
|
|
@ -69,11 +70,31 @@ template<typename TypeLine> void BaseModel::establishConnection(GraphicsBaseItem
|
|||
minDis = dis;
|
||||
pDestPort = port;
|
||||
}
|
||||
/*if(port->getType() == T_lineIn)
|
||||
}
|
||||
}
|
||||
else if(nMode == 1){
|
||||
for(auto& port:mapPorts) //连接中性点
|
||||
{
|
||||
int nTpe = port->getType();
|
||||
int nPos = port->portPos();
|
||||
if(nTpe == T_newTral){
|
||||
if(nParam == 0){
|
||||
if(nPos == P_top){
|
||||
pDestPort = port;
|
||||
break;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
else if(nParam == 1){
|
||||
if(nPos == P_left || nPos == P_right){
|
||||
pDestPort = port;
|
||||
}
|
||||
}
|
||||
else if(nParam == 2){
|
||||
if(nPos == P_down){
|
||||
pDestPort = port;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if((nTypeDest == 1 || nTypeDest == 0) && (nTypeSrc != 1 && nTypeSrc != 0))
|
||||
|
|
@ -87,8 +108,9 @@ template<typename TypeLine> void BaseModel::establishConnection(GraphicsBaseItem
|
|||
pDestPort = pDest->getPortPtr(index);
|
||||
|
||||
QMap<QString,ItemPort*> mapPorts = pSrc->getPorts();
|
||||
double minDis = 999;
|
||||
|
||||
if(nMode == 0){
|
||||
double minDis = 999;
|
||||
for(auto& port:mapPorts) //与母线或节点连接时,连接最近接线点
|
||||
{
|
||||
double dis = distanceBetweenItems(port,pDest);
|
||||
|
|
@ -103,6 +125,32 @@ template<typename TypeLine> void BaseModel::establishConnection(GraphicsBaseItem
|
|||
}*/
|
||||
}
|
||||
}
|
||||
else if(nMode == 1){
|
||||
for(auto& port:mapPorts) //连接中性点
|
||||
{
|
||||
int nTpe = port->getType();
|
||||
int nPos = port->portPos();
|
||||
if(nTpe == T_newTral){
|
||||
if(nParam == 0){
|
||||
if(nPos == P_top){
|
||||
pSrcPort = port;
|
||||
}
|
||||
}
|
||||
else if(nParam == 1){
|
||||
if(nPos == P_left || nPos == P_right){
|
||||
pSrcPort = port;
|
||||
}
|
||||
}
|
||||
else if(nParam == 2){
|
||||
if(nPos == P_down){
|
||||
pSrcPort = port;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else if((nTypeSrc == 1 || nTypeSrc == 0) && (nTypeDest == 1 || nTypeDest == 0)){ //两个都是母线或节点
|
||||
int index = 0;
|
||||
if(nTypeSrc == 1 )
|
||||
|
|
@ -159,4 +207,4 @@ template<typename TypeLine> void BaseModel::establishConnection(GraphicsBaseItem
|
|||
}
|
||||
}
|
||||
|
||||
template void BaseModel::establishConnection<ElectricBaseModelLineItem>(GraphicsBaseItem*,GraphicsBaseItem*,ElectricBaseModelLineItem*,ModelFunctionType);
|
||||
template void BaseModel::establishConnection<ElectricBaseModelLineItem>(GraphicsBaseItem*,GraphicsBaseItem*,ElectricBaseModelLineItem*,ModelFunctionType,int,int);
|
||||
|
|
|
|||
|
|
@ -12,11 +12,16 @@
|
|||
#include "baseModelItem/electricBaseModelPortItem.h"
|
||||
#include "baseModelItem/electricBaseModelSvgBus.h"
|
||||
#include "baseModelItem/electricBaseModelLineItem.h"
|
||||
#include "diagramEditor/diagramEditorBaseBlock.h"
|
||||
#include "diagramEditor/editItems.h"
|
||||
#include "diagramEditor/editPanel.h"
|
||||
|
||||
DiagramEditorModel::DiagramEditorModel()
|
||||
:_pCurBayRoute(nullptr)
|
||||
,_pCurBayComponent(nullptr)
|
||||
,_pCurPreviewScene(nullptr)
|
||||
,_pCurTransComponent(nullptr)
|
||||
,_pPanel(nullptr)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -92,65 +97,7 @@ void DiagramEditorModel::createTopoTerminalsByItem(GraphicsBaseItem* pItem,Model
|
|||
|
||||
void DiagramEditorModel::generateTempBay()
|
||||
{
|
||||
int rowCount = _pCurBayRoute->rowCount();
|
||||
for(int i = 0;i < rowCount;++i){
|
||||
QStandardItem *itemComps = _pCurBayRoute->item(i, 1);
|
||||
QString sComps = itemComps->text();
|
||||
QStringList lst = sComps.split(",");
|
||||
for(auto& name:lst){ //第一次循环生成item
|
||||
QStandardItem* pItem = getNameItem(name);
|
||||
if(pItem){
|
||||
QModelIndex index = pItem->index();
|
||||
QModelIndex indexCate = index.sibling(index.row(),0);
|
||||
QModelIndex indexType = index.sibling(index.row(),2);
|
||||
if(!pItem->data(Qt::UserRole+4).isValid()){ //未初始化,新建item
|
||||
pItem->setData(1,Qt::UserRole+4);
|
||||
int nCate = indexCate.data(Qt::UserRole+1).toInt(); //0设备1连接
|
||||
int nType = indexType.data(Qt::UserRole+1).toInt();
|
||||
int nDir = pItem->data().toInt();
|
||||
int nRotate = 0;
|
||||
if(pItem->data(Qt::UserRole+5).isValid())
|
||||
nRotate = pItem->data(Qt::UserRole+5).toInt();
|
||||
QPoint pos = pItem->data(Qt::UserRole+2).toPoint();
|
||||
QUuid uid = pItem->data(Qt::UserRole+3).toUuid();
|
||||
if(!_tempItem.contains(uid))
|
||||
generateTempComponent(uid,name,nCate,nType,pos,nRotate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(lst.size() > 1){
|
||||
for(int i = 0;i < lst.size() -1;++i){
|
||||
QStandardItem* pItemFirst = getNameItem(lst[i]);
|
||||
QStandardItem* pItemSecond = getNameItem(lst[i+1]);
|
||||
|
||||
if(pItemFirst && pItemSecond){
|
||||
QUuid uid1 = pItemFirst->data(Qt::UserRole+3).toUuid();
|
||||
QUuid uid2 = pItemSecond->data(Qt::UserRole+3).toUuid();
|
||||
|
||||
if(_tempItem.contains(uid1) && _tempItem.contains(uid2)){
|
||||
GraphicsBaseModelItem* p1 = _tempItem.value(uid1);
|
||||
GraphicsBaseModelItem* p2 = _tempItem.value(uid2);
|
||||
auto pLineData = TopologyManager::instance().ifConnection(uid1.toString(),uid2.toString()); //判断两个item是否有连接
|
||||
if(pLineData != nullptr){
|
||||
if(!_tempItem.contains(QUuid(pLineData->id()))){ //connectdata已存在,item未绘制
|
||||
auto pLine = generateTempLine(QUuid(pLineData->id()),""); //重新绘制
|
||||
if(pLine)
|
||||
establishConnection(p1,p2,pLine,ModelFunctionType::BaseModel);
|
||||
}
|
||||
else{ //已绘制,略过
|
||||
}
|
||||
}
|
||||
else{ //connectdata不存在,新建
|
||||
auto pLine = generateTempLine(QUuid::createUuid(),"");
|
||||
if(pLine)
|
||||
establishConnection(p1,p2,pLine,ModelFunctionType::BaseModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
generateItemByModel(_pCurBayRoute);
|
||||
}
|
||||
|
||||
void DiagramEditorModel::generateTempComponent(QUuid uid,QString sName,int nCategory,int nType,QPoint pos,int nRotate)
|
||||
|
|
@ -180,25 +127,25 @@ void DiagramEditorModel::generateTempComponent(QUuid uid,QString sName,int nCate
|
|||
}
|
||||
else if(nType == 5){ //电流互感器
|
||||
byte = DataBase::GetInstance()->ModelType()[nType].icon; //注意modelType表与componentType表不一致!
|
||||
auto pBreaker = new ElectricBaseModelSvgItem(QRect(-10, -10, 20, 20));
|
||||
pBreaker->loadSvg(byte);
|
||||
pItem = pBreaker;
|
||||
auto pCt= new ElectricBaseModelSvgItem(QRect(-10, -10, 20, 20));
|
||||
pCt->loadSvg(byte);
|
||||
pItem = pCt;
|
||||
pItem->setItemType(GIT_baseCT);
|
||||
pItem->initialPortsByDatabase(4);
|
||||
}
|
||||
else if(nType == 6){ //电压互感器
|
||||
byte = DataBase::GetInstance()->ModelType()[nType].icon; //注意modelType表与componentType表不一致!
|
||||
auto pBreaker = new ElectricBaseModelSvgItem(QRect(-25, -25, 50, 50));
|
||||
pBreaker->loadSvg(byte);
|
||||
pItem = pBreaker;
|
||||
auto pPt = new ElectricBaseModelSvgItem(QRect(-25, -25, 50, 50));
|
||||
pPt->loadSvg(byte);
|
||||
pItem = pPt;
|
||||
pItem->setItemType(GIT_basePT);
|
||||
pItem->initialPortsByDatabase(5);
|
||||
}
|
||||
else if(nType == 7){ //隔离开关
|
||||
byte = DataBase::GetInstance()->ModelType()[nType].icon; //注意modelType表与componentType表不一致!
|
||||
auto pBreaker = new ElectricBaseModelSvgItem(QRect(-15, -15, 30, 30));
|
||||
pBreaker->loadSvg(byte);
|
||||
pItem = pBreaker;
|
||||
auto pDs = new ElectricBaseModelSvgItem(QRect(-15, -15, 30, 30));
|
||||
pDs->loadSvg(byte);
|
||||
pItem = pDs;
|
||||
pItem->setItemType(GIT_baseDS);
|
||||
pItem->initialPortsByDatabase(9);
|
||||
}
|
||||
|
|
@ -209,6 +156,12 @@ void DiagramEditorModel::generateTempComponent(QUuid uid,QString sName,int nCate
|
|||
else if(nType == 10){ //双掷接地隔离开关
|
||||
}
|
||||
else if(nType == 11){ //带电指示器
|
||||
byte = DataBase::GetInstance()->ModelType()[nType].icon; //注意modelType表与componentType表不一致!
|
||||
auto pPi = new ElectricBaseModelSvgItem(QRect(-15, -30, 30, 60));
|
||||
pPi->loadSvg(byte);
|
||||
pItem = pPi;
|
||||
pItem->setItemType(GIT_basePI);
|
||||
pItem->initialPortsByDatabase(11);
|
||||
}
|
||||
else if(nType == 12){ //避雷器
|
||||
}
|
||||
|
|
@ -216,6 +169,22 @@ void DiagramEditorModel::generateTempComponent(QUuid uid,QString sName,int nCate
|
|||
}
|
||||
else if(nType == 14){ //电缆端
|
||||
}
|
||||
else if(nType == 15){ //两绕组变压器
|
||||
byte = DataBase::GetInstance()->ModelType()[nType].icon; //注意modelType表与componentType表不一致!
|
||||
auto p2W = new ElectricBaseModelSvgItem(QRect(-50, -50, 100, 100));
|
||||
p2W->loadSvg(byte);
|
||||
pItem = p2W;
|
||||
pItem->setItemType(GIT_base2wTransformer);
|
||||
pItem->initialPortsByDatabase(15);
|
||||
}
|
||||
else if(nType == 16){ //三绕组变压器
|
||||
byte = DataBase::GetInstance()->ModelType()[nType].icon; //注意modelType表与componentType表不一致!
|
||||
auto p3W = new ElectricBaseModelSvgItem(QRect(-75, -50, 150, 100));
|
||||
p3W->loadSvg(byte);
|
||||
pItem = p3W;
|
||||
pItem->setItemType(GIT_base3wTransformer);
|
||||
pItem->initialPortsByDatabase(16);
|
||||
}
|
||||
}
|
||||
else if(nCategory == 1){
|
||||
if(nType == 1){ //节点
|
||||
|
|
@ -270,18 +239,700 @@ ElectricBaseModelLineItem* DiagramEditorModel::generateTempLine(QUuid uid,QStrin
|
|||
|
||||
void DiagramEditorModel::clearCurPreview()
|
||||
{
|
||||
if(_pCurPreviewScene)
|
||||
if(_pCurPreviewScene){
|
||||
_tempItem.clear();
|
||||
_pCurPreviewScene->clear();
|
||||
}
|
||||
}
|
||||
|
||||
QStandardItem* DiagramEditorModel::getNameItem(const QString& sName)
|
||||
void DiagramEditorModel::generateTempTrans(int nType,DiagramEditorTransformerBlock* block)
|
||||
{
|
||||
int nRowCount = _pCurBayComponent->rowCount();
|
||||
if(nType == 0 || nType == 1 || nType == 2){
|
||||
generateItemByModel(_pCurTransLRoutes.value(nType),1);
|
||||
}
|
||||
else if(nType == 3){
|
||||
TransformerType typ = block->getTransType();
|
||||
int nT = 0;
|
||||
if(typ == TransformerType::twoWinding){
|
||||
generateItemByModel(_pCurTransLRoutes.value(0),1,QPoint(100,-25));
|
||||
generateItemByModel(_pCurTransLRoutes.value(2),1,QPoint(100,25));
|
||||
}
|
||||
else if(typ == TransformerType::threeWinding){
|
||||
generateItemByModel(_pCurTransLRoutes.value(0),1,QPoint(100,-25));
|
||||
generateItemByModel(_pCurTransLRoutes.value(1),1,QPoint(-150,0));
|
||||
generateItemByModel(_pCurTransLRoutes.value(2),1,QPoint(100,25));
|
||||
}
|
||||
|
||||
connectTransToNeutral(block);
|
||||
}
|
||||
}
|
||||
|
||||
void DiagramEditorModel::connectTransToNeutral(DiagramEditorTransformerBlock* block)
|
||||
{
|
||||
if(block){ //生成变压器主体
|
||||
QUuid uid = block->getId();
|
||||
QString sName = block->getName();
|
||||
int nT = 0;
|
||||
TransformerType typ = block->getTransType();
|
||||
if(typ == TransformerType::twoWinding){
|
||||
nT = 15;
|
||||
}
|
||||
else if(typ == TransformerType::threeWinding){
|
||||
nT = 16;
|
||||
}
|
||||
generateTempComponent(uid,sName,0,nT,QPoint(0,0),0);
|
||||
|
||||
auto pTransItem = _tempItem.value(uid);
|
||||
if(typ == TransformerType::twoWinding){
|
||||
linkTransItem(pTransItem,_pCurTransLRoutes.value(0));
|
||||
linkTransItem(pTransItem,_pCurTransLRoutes.value(2));
|
||||
}
|
||||
else if(typ == TransformerType::threeWinding){
|
||||
linkTransItem(pTransItem,_pCurTransLRoutes.value(0));
|
||||
linkTransItem(pTransItem,_pCurTransLRoutes.value(1));
|
||||
linkTransItem(pTransItem,_pCurTransLRoutes.value(2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DiagramEditorModel::linkTransItem(GraphicsBaseModelItem* pTrans,QStandardItemModel* pModel)
|
||||
{
|
||||
QUuid uid1 = pTrans->itemId();
|
||||
int rowCount = pModel->rowCount();
|
||||
for(int i = 0;i < rowCount;++i){
|
||||
QStandardItem *itemComps = pModel->item(i, 1);
|
||||
QString sComps = itemComps->text();
|
||||
QStringList lst = sComps.split(",");
|
||||
for(auto& name:lst){ //寻找绑定到中性点的点
|
||||
QStandardItem* pItem = getNameItem(name,1);
|
||||
if(pItem){
|
||||
QModelIndex index = pItem->index();
|
||||
QModelIndex indexObj = index.sibling(index.row(),3);
|
||||
QUuid uid2 = pItem->data(Qt::UserRole+3).toUuid();
|
||||
|
||||
QString sBindObj = indexObj.data().toString(); //获取显示数据
|
||||
auto pItem = _tempItem.value(uid2);
|
||||
if(sBindObj == "高压绕组中性点" || sBindObj == "中压绕组中性点" || sBindObj == "低压绕组中性点"){
|
||||
int nPos = 0;
|
||||
if(sBindObj == "高压绕组中性点")
|
||||
nPos = 0;
|
||||
else if(sBindObj == "中压绕组中性点")
|
||||
nPos = 1;
|
||||
else if(sBindObj == "低压绕组中性点")
|
||||
nPos = 2;
|
||||
auto pLineData = TopologyManager::instance().ifConnection(uid1.toString(),uid2.toString()); //判断两个item是否有连接
|
||||
if(pLineData != nullptr){
|
||||
if(!_tempItem.contains(QUuid(pLineData->id()))){ //connectdata已存在,item未绘制
|
||||
auto pLine = generateTempLine(QUuid(pLineData->id()),""); //重新绘制
|
||||
if(pLine)
|
||||
establishConnection(pItem,pTrans,pLine,ModelFunctionType::BlockEditorModel,1,nPos);
|
||||
}
|
||||
else{ //已绘制,略过
|
||||
}
|
||||
}
|
||||
else{ //connectdata不存在,新建
|
||||
auto pLine = generateTempLine(QUuid::createUuid(),"");
|
||||
if(pLine)
|
||||
establishConnection(pItem,pTrans,pLine,ModelFunctionType::BlockEditorModel,1,nPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QStandardItem* DiagramEditorModel::getNameItem(const QString& sName,int nFrom)
|
||||
{
|
||||
QStandardItemModel* pModel = nullptr;
|
||||
if(nFrom == 0){ //间隔
|
||||
pModel = _pCurBayComponent;
|
||||
}
|
||||
else if(nFrom == 1){
|
||||
pModel = _pCurTransComponent;
|
||||
}
|
||||
if(pModel){
|
||||
int nRowCount = pModel->rowCount();
|
||||
for(int i = 0;i < nRowCount;++i){
|
||||
QStandardItem *itemName = _pCurBayComponent->item(i, 1);
|
||||
QStandardItem *itemName = pModel->item(i, 1);
|
||||
if(sName == itemName->text()){
|
||||
return itemName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void DiagramEditorModel::generateItemByModel(QStandardItemModel* pModel,int nFrom,QPoint delta)
|
||||
{
|
||||
int rowCount = pModel->rowCount();
|
||||
for(int i = 0;i < rowCount;++i){
|
||||
QStandardItem *itemComps = pModel->item(i, 1);
|
||||
QString sComps = itemComps->text();
|
||||
QStringList lst = sComps.split(",");
|
||||
for(auto& name:lst){ //第一次循环生成item
|
||||
QStandardItem* pItem = getNameItem(name,nFrom);
|
||||
if(pItem){
|
||||
QModelIndex index = pItem->index();
|
||||
QModelIndex indexCate = index.sibling(index.row(),0);
|
||||
QModelIndex indexType = index.sibling(index.row(),2);
|
||||
if(!pItem->data(Qt::UserRole+4).isValid()){ //未初始化,新建item
|
||||
pItem->setData(1,Qt::UserRole+4);
|
||||
}
|
||||
int nCate = indexCate.data(Qt::UserRole+1).toInt(); //0设备1连接
|
||||
int nType = indexType.data(Qt::UserRole+1).toInt();
|
||||
int nDir = pItem->data().toInt();
|
||||
int nRotate = 0;
|
||||
if(pItem->data(Qt::UserRole+5).isValid())
|
||||
nRotate = pItem->data(Qt::UserRole+5).toInt();
|
||||
QPoint pos = pItem->data(Qt::UserRole+2).toPoint();
|
||||
pos += delta;
|
||||
QUuid uid = pItem->data(Qt::UserRole+3).toUuid();
|
||||
if(!_tempItem.contains(uid))
|
||||
generateTempComponent(uid,name,nCate,nType,pos,nRotate);
|
||||
}
|
||||
}
|
||||
|
||||
if(lst.size() > 1){
|
||||
for(int i = 0;i < lst.size() -1;++i){
|
||||
QStandardItem* pItemFirst = getNameItem(lst[i],nFrom);
|
||||
QStandardItem* pItemSecond = getNameItem(lst[i+1],nFrom);
|
||||
|
||||
if(pItemFirst && pItemSecond){
|
||||
QUuid uid1 = pItemFirst->data(Qt::UserRole+3).toUuid();
|
||||
QUuid uid2 = pItemSecond->data(Qt::UserRole+3).toUuid();
|
||||
|
||||
if(_tempItem.contains(uid1) && _tempItem.contains(uid2)){
|
||||
GraphicsBaseModelItem* p1 = _tempItem.value(uid1);
|
||||
GraphicsBaseModelItem* p2 = _tempItem.value(uid2);
|
||||
auto pLineData = TopologyManager::instance().ifConnection(uid1.toString(),uid2.toString()); //判断两个item是否有连接
|
||||
if(pLineData != nullptr){
|
||||
if(!_tempItem.contains(QUuid(pLineData->id()))){ //connectdata已存在,item未绘制
|
||||
auto pLine = generateTempLine(QUuid(pLineData->id()),""); //重新绘制
|
||||
if(pLine)
|
||||
establishConnection(p1,p2,pLine,ModelFunctionType::BaseModel);
|
||||
}
|
||||
else{ //已绘制,略过
|
||||
}
|
||||
}
|
||||
else{ //connectdata不存在,新建
|
||||
auto pLine = generateTempLine(QUuid::createUuid(),"");
|
||||
if(pLine)
|
||||
establishConnection(p1,p2,pLine,ModelFunctionType::BaseModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DiagramEditorModel::generateItemByInfo(QMap<QString,DiagramEditorRouteInfo> mapRoute,QMap<QString,DiagramEditorComponentInfo> mapCompo,QPoint delta)
|
||||
{
|
||||
if(_pPanel){
|
||||
QList<EditBaseItem*> lst = _pPanel->getBlockItems();
|
||||
for(auto item:lst){
|
||||
if(item->getType() == EditorItemType::bus){
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DiagramEditorModel::updateTarget(QMap<QString,DiagramEditorRouteInfo>& data,int nLayout,int nSource)
|
||||
{
|
||||
auto& mapRoute = data;
|
||||
QString sMainRoute;
|
||||
int nCount = 0;
|
||||
for(auto& route:mapRoute){ //寻找包含设备最多的线路
|
||||
if(nCount < route.lstCompo.count()){
|
||||
nCount = route.lstCompo.count();
|
||||
sMainRoute = route.sRouteName;
|
||||
route.bMainRoute = true;
|
||||
}
|
||||
}
|
||||
int nMainDir = nLayout/10; //主朝向倾向 8421上下左右
|
||||
int nSubDir = nLayout%10; //次朝向倾向 8421
|
||||
|
||||
if(nMainDir == 4 || nMainDir == 8){ //竖直
|
||||
auto& maoCompo = mapRoute[sMainRoute].lstCompo; //假设竖直情况下,上下等分为nSeg段 假设主线路水平居中
|
||||
int nSeg = maoCompo.size()*0.5;
|
||||
int nSegIndex = 0;
|
||||
if(nMainDir == 4) //正向从负半加到正半
|
||||
nSegIndex = -nSeg; //计数器,计算deltaY
|
||||
else
|
||||
nSegIndex = nSeg; //反向从正半减到负半
|
||||
for(int i = 0;i < maoCompo.size();++i){ //优先遍历主线路,构建主体结构
|
||||
int nDir = 0;
|
||||
if(i == 0){ //队首
|
||||
maoCompo[i].nUsedDirection |= nMainDir; //默认向下,队首单向下(单线路记录,不可作为跨线判断依据)
|
||||
nDir = nMainDir;
|
||||
}
|
||||
else if(i == maoCompo.size()-1){
|
||||
maoCompo[i].nUsedDirection |= 12-nMainDir; //队尾单向上(单线路记录,不可作为跨线判断依据)
|
||||
nDir = 12-nMainDir;
|
||||
}
|
||||
else{
|
||||
maoCompo[i].nUsedDirection |= 12; //其余向上向下都被占用(单线路记录,不可作为跨线判断依据)
|
||||
nDir = 12;
|
||||
}
|
||||
int deltaY = nSegIndex*g_nVDiagramSpacing;
|
||||
|
||||
auto pItemName = getNameItem(maoCompo[i].sName,nSource);
|
||||
if(pItemName){
|
||||
int nVal = pItemName->data().toInt();
|
||||
pItemName->setData(QString::number(nVal |= nDir)); //在公用模型中更新设备方向占用(重要)
|
||||
pItemName->setData(QPoint(0,deltaY),Qt::UserRole+2); //设置相对位置
|
||||
if(nMainDir == 4)
|
||||
pItemName->setData(0,Qt::UserRole+5);
|
||||
else
|
||||
pItemName->setData(180,Qt::UserRole+5);
|
||||
}
|
||||
if(nMainDir == 8)
|
||||
nSegIndex -= 1;
|
||||
else
|
||||
nSegIndex += 1;
|
||||
}
|
||||
|
||||
for(auto& route:mapRoute){ //遍历主线路之外的线路
|
||||
if(route.sRouteName == sMainRoute){
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!route.lstCompo.isEmpty()){ //拆分线路为以节点为首
|
||||
auto pItemFirst = getNameItem(route.lstCompo.first().sName,nSource);
|
||||
int nFirstVal = pItemFirst->data().toInt();
|
||||
auto pItemLast = getNameItem(route.lstCompo.last().sName,nSource);
|
||||
int nLastVal = pItemLast->data().toInt();
|
||||
if(nFirstVal != 0){ //首位为节点
|
||||
route.lstOrder = route.lstCompo;
|
||||
}
|
||||
else if(nLastVal != 0){ //末位为节点
|
||||
for (auto it = route.lstCompo.rbegin(); it != route.lstCompo.rend(); ++it) {
|
||||
route.lstReverse.append(*it);
|
||||
}
|
||||
}
|
||||
else{ //节点在中间
|
||||
int nIndex = 0;
|
||||
for(int i = 0;i < route.lstCompo.size();++i){
|
||||
auto pItem = getNameItem(route.lstCompo[i].sName,nSource);
|
||||
if(pItem){
|
||||
int nVal = pItem->data().toInt();
|
||||
if(nVal != 0){
|
||||
nIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = nIndex;i >= 0;--i){
|
||||
route.lstReverse.append(route.lstCompo[i]);
|
||||
}
|
||||
|
||||
for(int i = nIndex;i < route.lstCompo.size();++i){
|
||||
route.lstOrder.append(route.lstCompo[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int nOrderFirstDeltaY = 0; //首节点y偏移量(假设后续节点与头节点水平)
|
||||
int nXOrderIndex = 1; //横向计数
|
||||
int nOrderPolarity = 1; //方向 1右 -1左
|
||||
if(route.lstOrder.size() > 1){
|
||||
for(int i = 0;i < route.lstOrder.size()-1;++i){ //遍历以节点为首的队列
|
||||
auto pItem = getNameItem(route.lstOrder[i].sName,nSource);
|
||||
int nVal = pItem->data().toInt();
|
||||
QPoint deltaP = pItem->data(Qt::UserRole+2).toPoint();
|
||||
auto pNextItem = getNameItem(route.lstOrder[i+1].sName,nSource); //下一个item
|
||||
nOrderFirstDeltaY = deltaP.y();
|
||||
int nNextVal = pNextItem->data().toInt();
|
||||
if(i == 0){ //首节点
|
||||
if(((nVal & 2) == 1) && ((nVal & 1) == 1)){
|
||||
qDebug()<<QString("point %1 full of connection").arg(route.lstOrder[i].sName);
|
||||
}
|
||||
else if((nVal & 2) == 1){
|
||||
//左被占用,右空
|
||||
pItem->setData(QString::number(nVal | 1));
|
||||
pNextItem->setData(QString::number(nNextVal | 2)); //同时连接下个点的一侧占用
|
||||
nOrderPolarity = 1;
|
||||
pNextItem->setData(-90,Qt::UserRole+5);
|
||||
}
|
||||
else if((nVal & 1) == 1){
|
||||
//右被占用,左空
|
||||
pItem->setData(QString::number(nVal | 2));
|
||||
pNextItem->setData(QString::number(nNextVal | 1));
|
||||
nOrderPolarity = -1;
|
||||
pNextItem->setData(90,Qt::UserRole+5);
|
||||
}
|
||||
else{ //左右都没被占,放到倾向位置
|
||||
pItem->setData(QString::number(nVal | nSubDir));
|
||||
pNextItem->setData(QString::number(nNextVal | 3-nSubDir));
|
||||
if(nSubDir == 1){
|
||||
nOrderPolarity = -1;
|
||||
pNextItem->setData(90,Qt::UserRole+5);
|
||||
}
|
||||
else if(nSubDir == 2){
|
||||
nOrderPolarity = 1;
|
||||
pNextItem->setData(-90,Qt::UserRole+5);
|
||||
}
|
||||
}
|
||||
int deltaX = nXOrderIndex*nOrderPolarity*g_nHDiagramSpacing;
|
||||
pNextItem->setData(QPoint(deltaX,nOrderFirstDeltaY),Qt::UserRole + 2);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(((nVal & 2) == 1) && ((nVal & 1) == 1)){
|
||||
qDebug()<<QString("point %1 full of connection").arg(route.lstOrder[i].sName);
|
||||
}
|
||||
else if((nVal & 2) == 1){
|
||||
//左被占用,右空
|
||||
pItem->setData(QString::number(nVal | 1));
|
||||
pNextItem->setData(QString::number(nNextVal | 2)); //同时连接下个点的一侧占用
|
||||
pNextItem->setData(-90,Qt::UserRole+5);
|
||||
}
|
||||
else if((nVal & 1) == 1){
|
||||
//右被占用,左空
|
||||
pItem->setData(QString::number(nVal | 2));
|
||||
pNextItem->setData(QString::number(nNextVal | 1));
|
||||
pNextItem->setData(90,Qt::UserRole+5);
|
||||
}
|
||||
else{ //左右都没被占,放到设定位置
|
||||
pItem->setData(QString::number(nVal | nSubDir));
|
||||
pNextItem->setData(QString::number(nNextVal | 3-nSubDir));
|
||||
if(nSubDir == 1){
|
||||
pNextItem->setData(90,Qt::UserRole+5);
|
||||
}
|
||||
else if(nSubDir == 2){
|
||||
pNextItem->setData(-90,Qt::UserRole+5);
|
||||
}
|
||||
}
|
||||
int deltaX = nXOrderIndex*nOrderPolarity*g_nHDiagramSpacing;
|
||||
pNextItem->setData(QPoint(deltaX,nOrderFirstDeltaY),Qt::UserRole + 2);
|
||||
nXOrderIndex += 1;
|
||||
}
|
||||
}
|
||||
|
||||
int nReverseFirstDeltaY = 0; //首节点y偏移量(假设后续节点与头节点水平)
|
||||
int nXReverseIndex = 1; //横向计数
|
||||
int nReversePolarity = 1; //方向 1右 -1左
|
||||
if(route.lstReverse.size() > 1){
|
||||
for(int i = 0;i < route.lstReverse.size()-1;++i){ //遍历以节点为首的队列
|
||||
auto pItem = getNameItem(route.lstReverse[i].sName,nSource);
|
||||
int nVal = pItem->data().toInt();
|
||||
QPoint deltaP = pItem->data(Qt::UserRole+2).toPoint();
|
||||
|
||||
auto pNextItem = getNameItem(route.lstReverse[i+1].sName,nSource); //下一个item
|
||||
nReverseFirstDeltaY = deltaP.y();
|
||||
|
||||
int nNextVal = pNextItem->data().toInt();
|
||||
if(i == 0){ //首节点
|
||||
if(((nVal & 2) == 1) && ((nVal & 1) == 1)){
|
||||
qDebug()<<QString("point %1 full of connection").arg(route.lstReverse[i].sName);
|
||||
}
|
||||
else if((nVal & 2) == 1){
|
||||
//左被占用,右空
|
||||
pItem->setData(QString::number(nVal | 1));
|
||||
pNextItem->setData(QString::number(nNextVal | 2)); //同时连接下个点的一侧占用
|
||||
nReversePolarity = 1;
|
||||
pNextItem->setData(-90,Qt::UserRole+5);
|
||||
}
|
||||
else if((nVal & 1) == 1){
|
||||
//右被占用,左空
|
||||
pItem->setData(QString::number(nVal | 2));
|
||||
pNextItem->setData(QString::number(nNextVal | 1));
|
||||
nReversePolarity = -1;
|
||||
pNextItem->setData(90,Qt::UserRole+5);
|
||||
}
|
||||
else{ //左右都没被占,放到倾向位置
|
||||
pItem->setData(QString::number(nVal | nSubDir));
|
||||
pNextItem->setData(QString::number(nNextVal | 3-nSubDir));
|
||||
if(nSubDir == 1){
|
||||
nOrderPolarity = -1;
|
||||
pNextItem->setData(90,Qt::UserRole+5);
|
||||
}
|
||||
else if(nSubDir == 2){
|
||||
nOrderPolarity = 1;
|
||||
pNextItem->setData(-90,Qt::UserRole+5);
|
||||
}
|
||||
}
|
||||
int deltaX = nXReverseIndex*nReversePolarity*g_nHDiagramSpacing;
|
||||
pNextItem->setData(QPoint(deltaX,nReverseFirstDeltaY),Qt::UserRole + 2);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(((nVal & 2) == 1) && ((nVal & 1) == 1)){
|
||||
qDebug()<<QString("point %1 full of connection").arg(route.lstOrder[i].sName);
|
||||
}
|
||||
else if((nVal & 2) == 1){
|
||||
//左被占用,右空
|
||||
pItem->setData(QString::number(nVal | 1));
|
||||
pNextItem->setData(QString::number(nNextVal | 2)); //同时连接下个点的一侧占用
|
||||
pNextItem->setData(-90,Qt::UserRole+5);
|
||||
}
|
||||
else if((nVal & 1) == 1){
|
||||
//右被占用,左空
|
||||
pItem->setData(QString::number(nVal | 2));
|
||||
pNextItem->setData(QString::number(nNextVal | 1));
|
||||
pNextItem->setData(90,Qt::UserRole+5);
|
||||
}
|
||||
else{ //左右都没被占,放到设定位置
|
||||
pItem->setData(QString::number(nVal | nSubDir));
|
||||
pNextItem->setData(QString::number(nNextVal | 3-nSubDir));
|
||||
if(nSubDir == 1){
|
||||
pNextItem->setData(90,Qt::UserRole+5);
|
||||
}
|
||||
else if(nSubDir == 2){
|
||||
pNextItem->setData(-90,Qt::UserRole+5);
|
||||
}
|
||||
}
|
||||
int deltaX = nXReverseIndex*nReversePolarity*g_nHDiagramSpacing;
|
||||
pNextItem->setData(QPoint(deltaX,nReverseFirstDeltaY),Qt::UserRole + 2);
|
||||
nXReverseIndex += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(nMainDir == 2 || nMainDir == 1){ //2左1右
|
||||
auto& maoCompo = mapRoute[sMainRoute].lstCompo; //左右等分为nSeg段 假设主线路水平居中
|
||||
int nSeg = maoCompo.size()*0.5;
|
||||
int nSegIndex = 0; //计数器,计算deltaY
|
||||
if(nMainDir == 1) //正向从负半加到正半
|
||||
nSegIndex = -nSeg; //计数器,计算deltaY
|
||||
else
|
||||
nSegIndex = nSeg; //反向从正半减到负半
|
||||
for(int i = 0;i < maoCompo.size();++i){ //优先遍历主线路,构建主体结构
|
||||
int nDir = 0;
|
||||
if(i == 0){ //队首
|
||||
maoCompo[i].nUsedDirection |= 1; //队首向右
|
||||
nDir = 1;
|
||||
}
|
||||
else if(i == maoCompo.size()-1){
|
||||
maoCompo[i].nUsedDirection |= 2; //队尾单向左(单线路记录,不可作为跨线判断依据)
|
||||
nDir = 2;
|
||||
}
|
||||
else{
|
||||
maoCompo[i].nUsedDirection |= 3; //其余左右都被占用(单线路记录,不可作为跨线判断依据)
|
||||
nDir = 3;
|
||||
}
|
||||
int deltaX = nSegIndex*g_nHDiagramSpacing;
|
||||
|
||||
auto pItemName = getNameItem(maoCompo[i].sName,nSource);
|
||||
if(pItemName){
|
||||
int nVal = pItemName->data().toInt();
|
||||
pItemName->setData(QString::number(nVal |= nDir)); //在公用模型中更新设备方向占用(重要)
|
||||
pItemName->setData(QPoint(deltaX,0),Qt::UserRole+2); //设置相对位置
|
||||
if(nMainDir == 1)
|
||||
pItemName->setData(-90,Qt::UserRole+5); //转至水平
|
||||
else
|
||||
pItemName->setData(90,Qt::UserRole+5);
|
||||
}
|
||||
if(nMainDir == 2)
|
||||
nSegIndex -= 1;
|
||||
else
|
||||
nSegIndex += 1;
|
||||
}
|
||||
|
||||
for(auto& route:mapRoute){ //遍历主线路之外的线路
|
||||
if(route.sRouteName == sMainRoute){
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!route.lstCompo.isEmpty()){ //拆分线路为以节点为首
|
||||
auto pItemFirst = getNameItem(route.lstCompo.first().sName,nSource);
|
||||
int nFirstVal = pItemFirst->data().toInt();
|
||||
auto pItemLast = getNameItem(route.lstCompo.last().sName,nSource);
|
||||
int nLastVal = pItemLast->data().toInt();
|
||||
if(nFirstVal != 0){ //首位为节点
|
||||
route.lstOrder = route.lstCompo;
|
||||
}
|
||||
else if(nLastVal != 0){ //末位为节点
|
||||
for (auto it = route.lstCompo.rbegin(); it != route.lstCompo.rend(); ++it) {
|
||||
route.lstReverse.append(*it);
|
||||
}
|
||||
}
|
||||
else{ //节点在中间
|
||||
int nIndex = 0;
|
||||
for(int i = 0;i < route.lstCompo.size();++i){
|
||||
auto pItem = getNameItem(route.lstCompo[i].sName,nSource);
|
||||
if(pItem){
|
||||
int nVal = pItem->data().toInt();
|
||||
if(nVal != 0){
|
||||
nIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = nIndex;i >= 0;--i){
|
||||
route.lstReverse.append(route.lstCompo[i]);
|
||||
}
|
||||
|
||||
for(int i = nIndex;i < route.lstCompo.size();++i){
|
||||
route.lstOrder.append(route.lstCompo[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int nOrderFirstDeltaX = 0; //首节点x偏移量(假设后续节点与头节点水平相同,纵向分布)
|
||||
int nYOrderIndex = 1; //总向计数
|
||||
int nOrderPolarity = 1; //方向 1下 -1上
|
||||
if(route.lstOrder.size() > 1){
|
||||
for(int i = 0;i < route.lstOrder.size()-1;++i){ //遍历以节点为首的队列
|
||||
auto pItem = getNameItem(route.lstOrder[i].sName,nSource);
|
||||
int nVal = pItem->data().toInt();
|
||||
QPoint deltaP = pItem->data(Qt::UserRole+2).toPoint();
|
||||
auto pNextItem = getNameItem(route.lstOrder[i+1].sName,nSource); //下一个item
|
||||
nOrderFirstDeltaX = deltaP.x();
|
||||
int nNextVal = pNextItem->data().toInt();
|
||||
if(i == 0){ //首节点
|
||||
if(((nVal & 8) == 1) && ((nVal & 4) == 1)){
|
||||
qDebug()<<QString("point %1 full of connection").arg(route.lstOrder[i].sName);
|
||||
}
|
||||
else if((nVal & 8) == 1){
|
||||
//上被占用,下空
|
||||
pItem->setData(QString::number(nVal | 4));
|
||||
pNextItem->setData(QString::number(nNextVal | 8)); //同时连接下个点的一侧占用
|
||||
nOrderPolarity = 1;
|
||||
pNextItem->setData(0,Qt::UserRole+5);
|
||||
}
|
||||
else if((nVal & 4) == 1){
|
||||
//下被占用,上空
|
||||
pItem->setData(QString::number(nVal | 8));
|
||||
pNextItem->setData(QString::number(nNextVal | 4));
|
||||
nOrderPolarity = -1;
|
||||
pNextItem->setData(180,Qt::UserRole+5);
|
||||
}
|
||||
else{ //上下都没占,放到设定位置
|
||||
pItem->setData(QString::number(nVal | nSubDir));
|
||||
pNextItem->setData(QString::number(nNextVal | 12-nSubDir));
|
||||
if(nSubDir == 4){
|
||||
nOrderPolarity = 1;
|
||||
pNextItem->setData(0,Qt::UserRole+5);
|
||||
}
|
||||
else if(nSubDir == 8){
|
||||
nOrderPolarity = -1;
|
||||
pNextItem->setData(180,Qt::UserRole+5);
|
||||
}
|
||||
}
|
||||
int deltaY = nYOrderIndex*nOrderPolarity*g_nVDiagramSpacing;
|
||||
pNextItem->setData(QPoint(nOrderFirstDeltaX,deltaY),Qt::UserRole + 2);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(((nVal & 8) == 1) && ((nVal & 4) == 1)){
|
||||
qDebug()<<QString("point %1 full of connection").arg(route.lstOrder[i].sName);
|
||||
}
|
||||
else if((nVal & 8) == 1){
|
||||
//上被占用,下空
|
||||
pItem->setData(QString::number(nVal | 4));
|
||||
pNextItem->setData(QString::number(nNextVal | 8)); //同时连接下个点的一侧占用
|
||||
pNextItem->setData(0,Qt::UserRole+5);
|
||||
}
|
||||
else if((nVal & 4) == 1){
|
||||
//下被占用,上空
|
||||
pItem->setData(QString::number(nVal | 8));
|
||||
pNextItem->setData(QString::number(nNextVal | 4));
|
||||
pNextItem->setData(180,Qt::UserRole+5);
|
||||
}
|
||||
else{ //上下都没被占,放到设定位置
|
||||
pItem->setData(QString::number(nVal | nSubDir));
|
||||
pNextItem->setData(QString::number(nNextVal | 12-nSubDir));
|
||||
if(nSubDir == 4){
|
||||
nOrderPolarity = 1;
|
||||
pNextItem->setData(0,Qt::UserRole+5);
|
||||
}
|
||||
else if(nSubDir == 8){
|
||||
nOrderPolarity = -1;
|
||||
pNextItem->setData(180,Qt::UserRole+5);
|
||||
}
|
||||
}
|
||||
int deltaY = nYOrderIndex*nOrderPolarity*g_nVDiagramSpacing;
|
||||
pNextItem->setData(QPoint(nOrderFirstDeltaX,deltaY),Qt::UserRole + 2);
|
||||
nYOrderIndex += 1;
|
||||
}
|
||||
}
|
||||
|
||||
int nReverseFirstDeltaX = 0; //首节点X偏移量(假设后续节点与头节点垂直分布)
|
||||
int nYReverseIndex = 1; //纵向计数
|
||||
int nReversePolarity = 1; //方向 1下 -1上
|
||||
if(route.lstReverse.size() > 1){
|
||||
for(int i = 0;i < route.lstReverse.size()-1;++i){ //遍历以节点为首的队列
|
||||
auto pItem = getNameItem(route.lstReverse[i].sName,nSource);
|
||||
int nVal = pItem->data().toInt();
|
||||
QPoint deltaP = pItem->data(Qt::UserRole+2).toPoint();
|
||||
|
||||
auto pNextItem = getNameItem(route.lstReverse[i+1].sName,nSource); //下一个item
|
||||
nReverseFirstDeltaX = deltaP.x();
|
||||
|
||||
int nNextVal = pNextItem->data().toInt();
|
||||
if(i == 0){ //首节点
|
||||
if(((nVal & 8) == 1) && ((nVal & 4) == 1)){
|
||||
qDebug()<<QString("point %1 full of connection").arg(route.lstReverse[i].sName);
|
||||
}
|
||||
else if((nVal & 8) == 1){
|
||||
//上被占用,下空
|
||||
pItem->setData(QString::number(nVal | 4));
|
||||
pNextItem->setData(QString::number(nNextVal | 8)); //同时连接下个点的一侧占用
|
||||
nReversePolarity = 1;
|
||||
pNextItem->setData(0,Qt::UserRole+5);
|
||||
}
|
||||
else if((nVal & 1) == 4){
|
||||
//下被占用,上空
|
||||
pItem->setData(QString::number(nVal | 8));
|
||||
pNextItem->setData(QString::number(nNextVal | 4));
|
||||
nReversePolarity = -1;
|
||||
pNextItem->setData(180,Qt::UserRole+5);
|
||||
}
|
||||
else{ //上下都没被占,放到设定位置
|
||||
pItem->setData(QString::number(nVal | nSubDir));
|
||||
pNextItem->setData(QString::number(nNextVal | 12-nSubDir));
|
||||
if(nSubDir == 4){
|
||||
nOrderPolarity = 1;
|
||||
pNextItem->setData(0,Qt::UserRole+5);
|
||||
}
|
||||
else if(nSubDir == 8){
|
||||
nOrderPolarity = -1;
|
||||
pNextItem->setData(180,Qt::UserRole+5);
|
||||
}
|
||||
}
|
||||
int deltaY = nYReverseIndex*nReversePolarity*g_nVDiagramSpacing;
|
||||
pNextItem->setData(QPoint(nReverseFirstDeltaX,deltaY),Qt::UserRole + 2);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(((nVal & 8) == 1) && ((nVal & 4) == 1)){
|
||||
qDebug()<<QString("point %1 full of connection").arg(route.lstOrder[i].sName);
|
||||
}
|
||||
else if((nVal & 8) == 1){
|
||||
//上被占用,下空
|
||||
pItem->setData(QString::number(nVal | 4));
|
||||
pNextItem->setData(QString::number(nNextVal | 8)); //同时连接下个点的一侧占用
|
||||
pNextItem->setData(0,Qt::UserRole+5);
|
||||
}
|
||||
else if((nVal & 4) == 1){
|
||||
//下被占用,上空
|
||||
pItem->setData(QString::number(nVal | 8));
|
||||
pNextItem->setData(QString::number(nNextVal | 4));
|
||||
pNextItem->setData(180,Qt::UserRole+5);
|
||||
}
|
||||
else{ //上下都没被占,默认放到下边
|
||||
pItem->setData(QString::number(nVal | 4));
|
||||
pNextItem->setData(QString::number(nNextVal | 8));
|
||||
if(nSubDir == 4){
|
||||
nOrderPolarity = 1;
|
||||
pNextItem->setData(0,Qt::UserRole+5);
|
||||
}
|
||||
else if(nSubDir == 8){
|
||||
nOrderPolarity = -1;
|
||||
pNextItem->setData(180,Qt::UserRole+5);
|
||||
}
|
||||
}
|
||||
int deltaY = nYReverseIndex*nReversePolarity*g_nVDiagramSpacing;
|
||||
pNextItem->setData(QPoint(nReverseFirstDeltaX,deltaY),Qt::UserRole + 2);
|
||||
nYReverseIndex += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,4 +61,8 @@ void ItemPort::paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
|
|||
{
|
||||
painter->drawEllipse(boundingRect().center(), HNDLE_SIZE / 4, HNDLE_SIZE / 4);
|
||||
}
|
||||
else if(m_type == T_newTral)
|
||||
{
|
||||
painter->drawEllipse(boundingRect().center(), HNDLE_SIZE / 4, HNDLE_SIZE / 4);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@
|
|||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QWidget" name="widget_4" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4" stretch="0,1,3">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4" stretch="0,1,0,0,3">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
|
|
@ -117,6 +117,27 @@
|
|||
<item>
|
||||
<widget class="QLineEdit" name="le_routeName"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>线路类型</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="cb_lineType">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>主线</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>支线</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
|
|
|
|||
|
|
@ -0,0 +1,412 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>diagramEditorTransDetailAddDlg</class>
|
||||
<widget class="QDialog" name="diagramEditorTransDetailAddDlg">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>650</width>
|
||||
<height>460</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2" columnstretch="1,3">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(210, 210, 210);</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">color: rgb(0, 0, 0);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>新增线路</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>536</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QWidget" name="widget_4" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4" stretch="0,1,0,0,3">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>线路名:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="le_routeName"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>线路类型</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="cb_lineType">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>主线</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>支线</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>449</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>编辑设备</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="verticalSpacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>分类:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QComboBox" name="cb_category"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>名称:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLineEdit" name="le_name"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>类型:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QComboBox" name="cb_type"/>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>关联实体:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QComboBox" name="cb_bindObj">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>无</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>高压绕组中性点</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>中压绕组中性点</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>低压绕组中性点</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1" colspan="2">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>84</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="3">
|
||||
<widget class="QWidget" name="widget_3" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>35</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_save">
|
||||
<property name="text">
|
||||
<string>保存</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>34</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="title">
|
||||
<string>设备库</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<property name="leftMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QTableView" name="tableView_items"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>186</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="btn_add">
|
||||
<property name="text">
|
||||
<string>添加到线路</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<spacer name="horizontalSpacer_7">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>186</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>线路设备列表</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QTableView" name="tableView_selected"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QWidget" name="widget_2" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>540</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_ok">
|
||||
<property name="text">
|
||||
<string>确定</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_cancel">
|
||||
<property name="text">
|
||||
<string>取消</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
@ -0,0 +1,276 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>diagramEditorTransDetailSettingDlg</class>
|
||||
<widget class="QDialog" name="diagramEditorTransDetailSettingDlg">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>650</width>
|
||||
<height>460</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(217, 217, 217);</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">color: rgb(0, 0, 0);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>变压器详细设置</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>530</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_3" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>中性点成套装置</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_add">
|
||||
<property name="text">
|
||||
<string>新增回路</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_previewEquips">
|
||||
<property name="text">
|
||||
<string>预览成套装置</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_previewTrans">
|
||||
<property name="text">
|
||||
<string>预览变压器</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_hv">
|
||||
<attribute name="title">
|
||||
<string>高压侧中性点</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QTableView" name="tableView_hv"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_mv">
|
||||
<attribute name="title">
|
||||
<string>中压侧中性点</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QTableView" name="tableView_mv"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_lv">
|
||||
<attribute name="title">
|
||||
<string>低压侧中性点</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QTableView" name="tableView_lv"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_2" native="true">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>变压器配置:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_save">
|
||||
<property name="text">
|
||||
<string>保存</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_load">
|
||||
<property name="text">
|
||||
<string>载入</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>91</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_ok">
|
||||
<property name="text">
|
||||
<string>确定</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_cancel">
|
||||
<property name="text">
|
||||
<string>取消</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Loading…
Reference in New Issue