Compare commits
No commits in common. "d5609bd466ef5e7347a4a3c8cf0abd58a13a59c8" and "5592c20747bd059f8b2a2862fdd6335d3cfb1d96" have entirely different histories.
d5609bd466
...
5592c20747
|
|
@ -62,21 +62,14 @@ set(H_HEADER_FILES
|
||||||
include/monitorPagesDlg.h
|
include/monitorPagesDlg.h
|
||||||
include/baseDockWidget.h
|
include/baseDockWidget.h
|
||||||
|
|
||||||
#common/include/global.h
|
common/include/global.h
|
||||||
common/include/tools.h
|
common/include/tools.h
|
||||||
common/include/httpInterface.h
|
common/include/httpInterface.h
|
||||||
common/include/baseProperty.h
|
common/include/baseProperty.h
|
||||||
common/include/compiler.hpp
|
common/include/compiler.hpp
|
||||||
common/include/export.hpp
|
common/include/export.hpp
|
||||||
common/include/operatingSystem.hpp
|
common/include/operatingSystem.hpp
|
||||||
common/include/structDataSource.h
|
|
||||||
common/include/extraPropertyManager.h
|
|
||||||
|
|
||||||
common/core_model/types.h
|
|
||||||
common/core_model/topology.h
|
|
||||||
common/core_model/diagram.h
|
|
||||||
common/backend/project_model.h
|
|
||||||
common/backend/meta_model.h
|
|
||||||
)
|
)
|
||||||
set(CPP_SOURCE_FILES
|
set(CPP_SOURCE_FILES
|
||||||
source/main.cpp
|
source/main.cpp
|
||||||
|
|
@ -101,13 +94,9 @@ set(CPP_SOURCE_FILES
|
||||||
source/baseDockWidget.cpp
|
source/baseDockWidget.cpp
|
||||||
|
|
||||||
common/source/httpInterface.cpp
|
common/source/httpInterface.cpp
|
||||||
#common/source/global.cpp
|
common/source/global.cpp
|
||||||
common/source/tools.cpp
|
common/source/tools.cpp
|
||||||
common/source/baseProperty.cpp
|
common/source/baseProperty.cpp
|
||||||
common/source/structDataSource.cpp
|
|
||||||
common/source/extraPropertyManager.cpp
|
|
||||||
|
|
||||||
common/core_model/types.cpp
|
|
||||||
)
|
)
|
||||||
set(UI_FILES
|
set(UI_FILES
|
||||||
ui/mainwindow.ui
|
ui/mainwindow.ui
|
||||||
|
|
@ -155,7 +144,6 @@ include_directories(common/include)
|
||||||
include_directories(${PostgreSQL_INCLUDE_DIRS})
|
include_directories(${PostgreSQL_INCLUDE_DIRS})
|
||||||
|
|
||||||
target_include_directories(DiagramDesigner PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
target_include_directories(DiagramDesigner PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
||||||
target_include_directories(DiagramDesigner PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/common")
|
|
||||||
target_include_directories(DiagramDesigner PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/PropertyEditor/source/include)")
|
target_include_directories(DiagramDesigner PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/PropertyEditor/source/include)")
|
||||||
target_link_libraries(DiagramDesigner PUBLIC Qt${QT_VERSION_MAJOR}::Core
|
target_link_libraries(DiagramDesigner PUBLIC Qt${QT_VERSION_MAJOR}::Core
|
||||||
Qt${QT_VERSION_MAJOR}::Gui
|
Qt${QT_VERSION_MAJOR}::Gui
|
||||||
|
|
|
||||||
|
|
@ -23,9 +23,5 @@
|
||||||
<file>resources/Qml/ValueEditor/FileSelector.qml</file>
|
<file>resources/Qml/ValueEditor/FileSelector.qml</file>
|
||||||
<file>resources/Qml/ValueEditor/LineTextBox.qml</file>
|
<file>resources/Qml/ValueEditor/LineTextBox.qml</file>
|
||||||
<file>resources/Qml/ValueEditor/MultiLineTextBox.qml</file>
|
<file>resources/Qml/ValueEditor/MultiLineTextBox.qml</file>
|
||||||
<file>resources/Qml/ValueEditor/PointFBox.qml</file>
|
|
||||||
<file>resources/Qml/ValueEditor/RectFBox.qml</file>
|
|
||||||
<file>resources/Qml/ValueEditor/SizeFBox.qml</file>
|
|
||||||
<file>resources/Qml/ValueEditor/BoolBox.qml</file>
|
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
|
||||||
|
|
@ -1,184 +0,0 @@
|
||||||
import QtQuick
|
|
||||||
import QtQuick.Controls
|
|
||||||
import QtQuick.Layouts
|
|
||||||
import QtQuick.Shapes
|
|
||||||
|
|
||||||
Item {
|
|
||||||
id: control
|
|
||||||
|
|
||||||
// 保持与框架一致的接口
|
|
||||||
property var value: false
|
|
||||||
property int decimals: 0
|
|
||||||
property string text: "Enabled"
|
|
||||||
property color textColor: "black"
|
|
||||||
property color checkedColor: "#2196F3"
|
|
||||||
property color uncheckedColor: "#cccccc"
|
|
||||||
property color checkedBoxColor: "white"
|
|
||||||
property color uncheckedBoxColor: "white"
|
|
||||||
property int boxSize: 16
|
|
||||||
property int spacing: 8
|
|
||||||
property int textSize: 12
|
|
||||||
property alias font: label.font
|
|
||||||
|
|
||||||
// 与框架一致的信号
|
|
||||||
signal asValueChanged(value: var)
|
|
||||||
signal boolValueChanged(bool checked) // 辅助信号,避免与内置信号冲突
|
|
||||||
|
|
||||||
implicitHeight: Math.max(boxSize, label.implicitHeight)
|
|
||||||
implicitWidth: boxSize + spacing + label.implicitWidth
|
|
||||||
|
|
||||||
function toggle() {
|
|
||||||
var newValue = !getBoolValue()
|
|
||||||
setValue(newValue)
|
|
||||||
}
|
|
||||||
|
|
||||||
function setValue(newValue) {
|
|
||||||
var boolValue = getBoolValue()
|
|
||||||
var newBoolValue = toBool(newValue)
|
|
||||||
|
|
||||||
if (boolValue !== newBoolValue) {
|
|
||||||
value = newBoolValue
|
|
||||||
boolValueChanged(newBoolValue)
|
|
||||||
asValueChanged(newBoolValue)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getBoolValue() {
|
|
||||||
return toBool(value)
|
|
||||||
}
|
|
||||||
|
|
||||||
function toBool(value) {
|
|
||||||
if (typeof value === 'boolean') {
|
|
||||||
return value
|
|
||||||
} else if (typeof value === 'number') {
|
|
||||||
return value !== 0
|
|
||||||
} else if (typeof value === 'string') {
|
|
||||||
var str = value.toString().toLowerCase()
|
|
||||||
return str === 'true' || str === '1' || str === 'on'
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
// 整个区域的点击事件
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent
|
|
||||||
|
|
||||||
onClicked: function(mouse) {
|
|
||||||
control.toggle()
|
|
||||||
mouse.accepted = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
anchors.fill: parent
|
|
||||||
spacing: control.spacing
|
|
||||||
|
|
||||||
// 复选框
|
|
||||||
Rectangle {
|
|
||||||
id: checkBox
|
|
||||||
width: control.boxSize
|
|
||||||
height: control.boxSize
|
|
||||||
radius: 3
|
|
||||||
border.color: getBoolValue() ? control.checkedColor : control.uncheckedColor
|
|
||||||
border.width: 1
|
|
||||||
color: getBoolValue() ? control.checkedColor : control.uncheckedBoxColor
|
|
||||||
|
|
||||||
Layout.alignment: Qt.AlignVCenter
|
|
||||||
|
|
||||||
// 勾选标记
|
|
||||||
Shape {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
width: 10
|
|
||||||
height: 8
|
|
||||||
visible: getBoolValue()
|
|
||||||
|
|
||||||
ShapePath {
|
|
||||||
strokeColor: "transparent"
|
|
||||||
fillColor: control.checkedBoxColor
|
|
||||||
strokeWidth: 0
|
|
||||||
|
|
||||||
PathMove { x: 0; y: 4 }
|
|
||||||
PathLine { x: 4; y: 8 }
|
|
||||||
PathLine { x: 10; y: 0 }
|
|
||||||
PathLine { x: 9; y: 0 }
|
|
||||||
PathLine { x: 4; y: 7 }
|
|
||||||
PathLine { x: 1; y: 4 }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 悬停效果
|
|
||||||
Rectangle {
|
|
||||||
anchors.fill: parent
|
|
||||||
radius: parent.radius
|
|
||||||
color: "transparent"
|
|
||||||
border.color: "#888888"
|
|
||||||
border.width: boxMouseArea.containsMouse ? 1 : 0
|
|
||||||
opacity: boxMouseArea.containsMouse ? 0.3 : 0
|
|
||||||
}
|
|
||||||
|
|
||||||
// 复选框自身的点击事件
|
|
||||||
MouseArea {
|
|
||||||
id: boxMouseArea
|
|
||||||
anchors.fill: parent
|
|
||||||
hoverEnabled: true
|
|
||||||
|
|
||||||
onClicked: function(mouse) {
|
|
||||||
control.toggle()
|
|
||||||
mouse.accepted = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 标签文本
|
|
||||||
Label {
|
|
||||||
id: label
|
|
||||||
text: control.text
|
|
||||||
color: control.textColor
|
|
||||||
font.pixelSize: control.textSize
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
|
|
||||||
Layout.alignment: Qt.AlignVCenter
|
|
||||||
Layout.fillWidth: true
|
|
||||||
|
|
||||||
// 鼠标悬停在文本上时的点击事件
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent
|
|
||||||
|
|
||||||
onClicked: function(mouse) {
|
|
||||||
control.toggle()
|
|
||||||
mouse.accepted = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 键盘支持
|
|
||||||
Keys.onPressed: function(event) {
|
|
||||||
if (event.key === Qt.Key_Space || event.key === Qt.Key_Return) {
|
|
||||||
control.toggle()
|
|
||||||
event.accepted = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 聚焦支持
|
|
||||||
activeFocusOnTab: true
|
|
||||||
|
|
||||||
// 聚焦时的边框
|
|
||||||
Rectangle {
|
|
||||||
anchors.fill: parent
|
|
||||||
color: "transparent"
|
|
||||||
border.color: control.activeFocus ? "#2196F3" : "transparent"
|
|
||||||
border.width: 2
|
|
||||||
radius: 2
|
|
||||||
visible: control.activeFocus
|
|
||||||
}
|
|
||||||
|
|
||||||
// 当value从外部改变时,更新显示
|
|
||||||
onValueChanged: {
|
|
||||||
var boolValue = getBoolValue()
|
|
||||||
if (checkBox.border.color !== (boolValue ? control.checkedColor : control.uncheckedColor)) {
|
|
||||||
checkBox.border.color = boolValue ? control.checkedColor : control.uncheckedColor
|
|
||||||
checkBox.color = boolValue ? control.checkedColor : control.uncheckedBoxColor
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,91 +1,33 @@
|
||||||
import QtQuick
|
import QtQuick;
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls;
|
||||||
import QtQuick.Dialogs
|
import QtQuick.Dialogs
|
||||||
|
|
||||||
Item {
|
Item{
|
||||||
id: control
|
id: control
|
||||||
property color value
|
property color value
|
||||||
implicitHeight: 25
|
implicitHeight: 25
|
||||||
implicitWidth: 150
|
signal asValueChanged(text:var)
|
||||||
signal asValueChanged(text: var)
|
|
||||||
|
|
||||||
// 计算颜色代码(hex格式)
|
function setValue(newValue:var){
|
||||||
function getColorCode(color) {
|
if(newValue !== value){
|
||||||
if (color.a === 1) {
|
|
||||||
// 不透明颜色
|
|
||||||
return color.toString().toUpperCase()
|
|
||||||
} else {
|
|
||||||
// 透明颜色
|
|
||||||
return Qt.rgba(color.r, color.g, color.b, color.a).toString()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function setValue(newValue: var) {
|
|
||||||
if (newValue !== value) {
|
|
||||||
value = newValue
|
value = newValue
|
||||||
asValueChanged(value)
|
asValueChanged(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Row {
|
Button{
|
||||||
|
anchors.margins: 2
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
spacing: 5
|
palette {
|
||||||
|
button: value
|
||||||
// 左边颜色显示矩形
|
|
||||||
Rectangle {
|
|
||||||
id: colorRect
|
|
||||||
width: 25
|
|
||||||
height: parent.height
|
|
||||||
radius: 2
|
|
||||||
border.width: 1
|
|
||||||
border.color: Qt.darker(colorRect.color, 1.5)
|
|
||||||
color: value
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent
|
|
||||||
onClicked: {
|
|
||||||
colorDialog.open()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
background: Rectangle {
|
||||||
// 右边颜色代码显示(不可编辑)
|
color: value
|
||||||
Rectangle {
|
}
|
||||||
width: parent.width - colorRect.width - parent.spacing
|
onClicked: {
|
||||||
height: parent.height
|
colorDialog.open()
|
||||||
radius: 2
|
|
||||||
border.width: 1
|
|
||||||
border.color: "#cccccc"
|
|
||||||
|
|
||||||
Text {
|
|
||||||
id: colorText
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.margins: 2
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
horizontalAlignment: Text.AlignLeft
|
|
||||||
text: getColorCode(value)
|
|
||||||
font.pixelSize: 12
|
|
||||||
elide: Text.ElideRight
|
|
||||||
|
|
||||||
// 颜色值改变时更新文本
|
|
||||||
Connections {
|
|
||||||
target: control
|
|
||||||
function onValueChanged() {
|
|
||||||
colorText.text = getColorCode(control.value)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 点击整个右侧区域也可以打开颜色选择
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent
|
|
||||||
onClicked: {
|
|
||||||
colorDialog.open()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ColorDialog {
|
ColorDialog {
|
||||||
id: colorDialog
|
id: colorDialog
|
||||||
selectedColor: value
|
selectedColor: value
|
||||||
|
|
@ -93,4 +35,6 @@ Item {
|
||||||
control.setValue(selectedColor)
|
control.setValue(selectedColor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,102 +1,39 @@
|
||||||
import QtQuick
|
import QtQuick;
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls;
|
||||||
import QtQuick.Dialogs
|
import QtQuick.Dialogs
|
||||||
import QtQuick.Layouts
|
|
||||||
import QtCore
|
|
||||||
import ColorPalette
|
|
||||||
|
|
||||||
Item {
|
Item{
|
||||||
id: control
|
id: control
|
||||||
|
|
||||||
// 属性接口
|
|
||||||
property var value
|
property var value
|
||||||
property string fileFilter: "svg(*.svg)" // 文件过滤器
|
implicitHeight: 25
|
||||||
property bool selectMultiple: false // 是否多选
|
signal asValueChanged(text:var)
|
||||||
|
|
||||||
implicitHeight: fileBox.implicitHeight
|
function setValue(newValue:var){
|
||||||
signal asValueChanged(text: var)
|
if(newValue !== value){
|
||||||
|
|
||||||
function setValue(newValue: var) {
|
|
||||||
if (newValue !== value) {
|
|
||||||
value = newValue
|
value = newValue
|
||||||
fileBox.value = value
|
|
||||||
asValueChanged(value)
|
asValueChanged(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Button{
|
||||||
LineTextBox {
|
anchors.margins: 2
|
||||||
id: fileBox
|
anchors.fill: parent
|
||||||
value: control.value
|
palette {
|
||||||
anchors.left: parent.left
|
button: value
|
||||||
anchors.right: button.left
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
|
|
||||||
onValueChanged: {
|
|
||||||
control.setValue(value)
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Button {
|
|
||||||
id: button
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
width: 30
|
|
||||||
height: 25
|
|
||||||
text: "..."
|
|
||||||
palette.buttonText: ColorPalette.theme.textPrimary
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
color: ColorPalette.theme.buttonBackground
|
color: value
|
||||||
}
|
}
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
fileDialog.open()
|
colorDialog.open()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ColorDialog {
|
||||||
FileDialog {
|
id: colorDialog
|
||||||
id: fileDialog
|
selectedColor: value
|
||||||
modality: Qt.WindowModal // 改为窗口模态
|
|
||||||
options: FolderDialog.DontUseNativeDialog // 尝试禁用原生对话框
|
|
||||||
title: control.selectMultiple ? "选择多个文件" : "选择文件"
|
|
||||||
fileMode: control.selectMultiple ? FileDialog.OpenFiles : FileDialog.OpenFile
|
|
||||||
|
|
||||||
// 设置文件过滤器
|
|
||||||
nameFilters: {
|
|
||||||
if (control.fileFilter) {
|
|
||||||
return control.fileFilter.split(";;")
|
|
||||||
}
|
|
||||||
return ["所有文件 (*.*)"]
|
|
||||||
}
|
|
||||||
|
|
||||||
onAccepted: {
|
onAccepted: {
|
||||||
if (control.selectMultiple) {
|
control.setValue(selectedColor)
|
||||||
// 多选模式
|
|
||||||
var filePaths = []
|
|
||||||
|
|
||||||
for (var i = 0; i < selectedFiles.length; i++) {
|
|
||||||
var filePath = selectedFiles[i].toString()
|
|
||||||
filePath = removeFileProtocol(filePath)
|
|
||||||
filePaths.push(filePath)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 多个文件用分号分隔
|
|
||||||
control.setValue(filePaths.join(";"))
|
|
||||||
} else {
|
|
||||||
// 单选模式
|
|
||||||
var filePath = selectedFile.toString()
|
|
||||||
filePath = removeFileProtocol(filePath)
|
|
||||||
control.setValue(filePath)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 辅助函数:移除文件协议前缀
|
|
||||||
function removeFileProtocol(path) {
|
|
||||||
if (path.startsWith("file:///")) {
|
|
||||||
return path.substring(8)
|
|
||||||
} else if (path.startsWith("file://")) {
|
|
||||||
return path.substring(7)
|
|
||||||
}
|
|
||||||
return path
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,184 +0,0 @@
|
||||||
import QtQuick
|
|
||||||
import QtQuick.Controls
|
|
||||||
import QtQuick.Layouts
|
|
||||||
|
|
||||||
Item {
|
|
||||||
id: control
|
|
||||||
|
|
||||||
property var value: Qt.point(0, 0)
|
|
||||||
property int decimals: 2
|
|
||||||
implicitHeight: 25
|
|
||||||
implicitWidth: 120 // 设置默认宽度
|
|
||||||
|
|
||||||
signal asValueChanged(value: var)
|
|
||||||
|
|
||||||
function setValue(newValue: var) {
|
|
||||||
if (!control.value ||
|
|
||||||
Math.abs(control.value.x - newValue.x) > 0.000001 ||
|
|
||||||
Math.abs(control.value.y - newValue.y) > 0.000001) {
|
|
||||||
value = newValue
|
|
||||||
asValueChanged(value)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
anchors.fill: parent
|
|
||||||
spacing: 4 // 减小间距
|
|
||||||
|
|
||||||
Label {
|
|
||||||
text: "X:"
|
|
||||||
Layout.alignment: Qt.AlignVCenter
|
|
||||||
font.pixelSize: 10
|
|
||||||
}
|
|
||||||
|
|
||||||
TextField {
|
|
||||||
id: xBox
|
|
||||||
Layout.preferredWidth: 60 // 减小宽度
|
|
||||||
Layout.preferredHeight: 22
|
|
||||||
Layout.alignment: Qt.AlignVCenter
|
|
||||||
text: control.value ? control.value.x.toFixed(control.decimals) : "0.00"
|
|
||||||
font.pixelSize: 10
|
|
||||||
leftPadding: 4
|
|
||||||
rightPadding: 4
|
|
||||||
selectByMouse: true
|
|
||||||
|
|
||||||
// 双击全选的处理
|
|
||||||
MouseArea {
|
|
||||||
id: xMouseArea
|
|
||||||
anchors.fill: parent
|
|
||||||
propagateComposedEvents: true
|
|
||||||
acceptedButtons: Qt.LeftButton
|
|
||||||
cursorShape: Qt.IBeamCursor
|
|
||||||
|
|
||||||
onDoubleClicked: function(mouse) {
|
|
||||||
parent.selectAll()
|
|
||||||
parent.forceActiveFocus()
|
|
||||||
mouse.accepted = true
|
|
||||||
}
|
|
||||||
|
|
||||||
onClicked: function(mouse) {
|
|
||||||
// 单击时设置焦点但不全选
|
|
||||||
parent.forceActiveFocus()
|
|
||||||
mouse.accepted = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onActiveFocusChanged: {
|
|
||||||
if (activeFocus) {
|
|
||||||
// 如果不是双击触发的焦点变化,就全选文本
|
|
||||||
if (!xMouseArea.containsPress) {
|
|
||||||
selectAll()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
validator: DoubleValidator {
|
|
||||||
bottom: -999999
|
|
||||||
top: 999999
|
|
||||||
decimals: 2
|
|
||||||
}
|
|
||||||
|
|
||||||
background: Rectangle {
|
|
||||||
color: xBox.enabled ? "white" : "#f0f0f0"
|
|
||||||
border.color: xBox.activeFocus ? "#2196F3" : "#cccccc"
|
|
||||||
border.width: 1
|
|
||||||
radius: 2
|
|
||||||
}
|
|
||||||
|
|
||||||
onEditingFinished: {
|
|
||||||
var xValue = parseFloat(text)
|
|
||||||
if (!isNaN(xValue) && control.value) {
|
|
||||||
control.setValue(Qt.point(xValue, control.value.y))
|
|
||||||
} else {
|
|
||||||
xBox.text = control.value ? control.value.x.toFixed(control.decimals) : "0.00"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Label {
|
|
||||||
text: "Y:"
|
|
||||||
Layout.alignment: Qt.AlignVCenter
|
|
||||||
font.pixelSize: 10
|
|
||||||
}
|
|
||||||
|
|
||||||
TextField {
|
|
||||||
id: yBox
|
|
||||||
Layout.preferredWidth: 60
|
|
||||||
Layout.preferredHeight: 22
|
|
||||||
Layout.alignment: Qt.AlignVCenter
|
|
||||||
text: control.value ? control.value.y.toFixed(control.decimals) : "0.00"
|
|
||||||
font.pixelSize: 10
|
|
||||||
leftPadding: 4
|
|
||||||
rightPadding: 4
|
|
||||||
selectByMouse: true
|
|
||||||
|
|
||||||
// 双击全选的处理
|
|
||||||
MouseArea {
|
|
||||||
id: yMouseArea
|
|
||||||
anchors.fill: parent
|
|
||||||
propagateComposedEvents: true
|
|
||||||
acceptedButtons: Qt.LeftButton
|
|
||||||
cursorShape: Qt.IBeamCursor
|
|
||||||
|
|
||||||
onDoubleClicked: function(mouse) {
|
|
||||||
parent.selectAll()
|
|
||||||
parent.forceActiveFocus()
|
|
||||||
mouse.accepted = true
|
|
||||||
}
|
|
||||||
|
|
||||||
onClicked: function(mouse) {
|
|
||||||
// 单击时设置焦点但不全选
|
|
||||||
parent.forceActiveFocus()
|
|
||||||
mouse.accepted = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onActiveFocusChanged: {
|
|
||||||
if (activeFocus) {
|
|
||||||
// 如果不是双击触发的焦点变化,就全选文本
|
|
||||||
if (!yMouseArea.containsPress) {
|
|
||||||
selectAll()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
validator: DoubleValidator {
|
|
||||||
bottom: -999999
|
|
||||||
top: 999999
|
|
||||||
decimals: 2
|
|
||||||
}
|
|
||||||
|
|
||||||
background: Rectangle {
|
|
||||||
color: yBox.enabled ? "white" : "#f0f0f0"
|
|
||||||
border.color: yBox.activeFocus ? "#2196F3" : "#cccccc"
|
|
||||||
border.width: 1
|
|
||||||
radius: 2
|
|
||||||
}
|
|
||||||
|
|
||||||
onEditingFinished: {
|
|
||||||
var yValue = parseFloat(text)
|
|
||||||
if (!isNaN(yValue) && control.value) {
|
|
||||||
control.setValue(Qt.point(control.value.x, yValue))
|
|
||||||
} else {
|
|
||||||
yBox.text = control.value ? control.value.y.toFixed(control.decimals) : "0.00"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 当value从外部改变时,更新输入框显示
|
|
||||||
onValueChanged: {
|
|
||||||
if (value) {
|
|
||||||
if (!xBox.activeFocus) {
|
|
||||||
xBox.text = value.x.toFixed(decimals)
|
|
||||||
}
|
|
||||||
if (!yBox.activeFocus) {
|
|
||||||
yBox.text = value.y.toFixed(decimals)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,136 +0,0 @@
|
||||||
import QtQuick
|
|
||||||
import QtQuick.Controls
|
|
||||||
import QtQuick.Layouts
|
|
||||||
|
|
||||||
Item {
|
|
||||||
id: control
|
|
||||||
|
|
||||||
property var value: Qt.rect(0, 0, 0, 0)
|
|
||||||
property int decimals: 1
|
|
||||||
implicitHeight: 25
|
|
||||||
implicitWidth: 240
|
|
||||||
|
|
||||||
signal asValueChanged(value: var)
|
|
||||||
|
|
||||||
function setValue(newValue) {
|
|
||||||
if (!control.value ||
|
|
||||||
Math.abs(control.value.x - newValue.x) > 0.000001 ||
|
|
||||||
Math.abs(control.value.y - newValue.y) > 0.000001 ||
|
|
||||||
Math.abs(control.value.width - newValue.width) > 0.000001 ||
|
|
||||||
Math.abs(control.value.height - newValue.height) > 0.000001) {
|
|
||||||
value = newValue
|
|
||||||
asValueChanged(value)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
anchors.fill: parent
|
|
||||||
spacing: 2
|
|
||||||
|
|
||||||
Repeater {
|
|
||||||
id: repeater
|
|
||||||
model: [
|
|
||||||
{ label: "X", prop: "x", validator: [-999999, 999999] },
|
|
||||||
{ label: "Y", prop: "y", validator: [-999999, 999999] },
|
|
||||||
{ label: "W", prop: "width", validator: [0, 999999] },
|
|
||||||
{ label: "H", prop: "height", validator: [0, 999999] }
|
|
||||||
]
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
id: inputRow
|
|
||||||
spacing: 2
|
|
||||||
Layout.alignment: Qt.AlignVCenter
|
|
||||||
|
|
||||||
property string propertyName: modelData.prop
|
|
||||||
property var textField: inputField
|
|
||||||
|
|
||||||
Label {
|
|
||||||
text: modelData.label + ":"
|
|
||||||
font.pixelSize: 10
|
|
||||||
}
|
|
||||||
|
|
||||||
TextField {
|
|
||||||
id: inputField
|
|
||||||
Layout.preferredWidth: 60
|
|
||||||
Layout.preferredHeight: 22
|
|
||||||
text: control.value ? control.value[modelData.prop].toFixed(control.decimals) : "0.0"
|
|
||||||
font.pixelSize: 9
|
|
||||||
padding: 2
|
|
||||||
selectByMouse: true
|
|
||||||
|
|
||||||
// 双击全选的处理
|
|
||||||
MouseArea {
|
|
||||||
id: fieldMouseArea
|
|
||||||
anchors.fill: parent
|
|
||||||
propagateComposedEvents: true
|
|
||||||
acceptedButtons: Qt.LeftButton
|
|
||||||
cursorShape: Qt.IBeamCursor
|
|
||||||
|
|
||||||
onDoubleClicked: function(mouse) {
|
|
||||||
parent.selectAll()
|
|
||||||
parent.forceActiveFocus()
|
|
||||||
mouse.accepted = true
|
|
||||||
}
|
|
||||||
|
|
||||||
onClicked: function(mouse) {
|
|
||||||
// 单击时设置焦点但不全选
|
|
||||||
parent.forceActiveFocus()
|
|
||||||
mouse.accepted = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onActiveFocusChanged: {
|
|
||||||
if (activeFocus) {
|
|
||||||
// 如果不是双击触发的焦点变化,就全选文本
|
|
||||||
if (!fieldMouseArea.containsPress) {
|
|
||||||
selectAll()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
validator: DoubleValidator {
|
|
||||||
bottom: modelData.validator[0]
|
|
||||||
top: modelData.validator[1]
|
|
||||||
decimals: 2
|
|
||||||
}
|
|
||||||
|
|
||||||
background: Rectangle {
|
|
||||||
border.color: parent.activeFocus ? "#0066cc" : "#999999"
|
|
||||||
border.width: 1
|
|
||||||
radius: 1
|
|
||||||
}
|
|
||||||
|
|
||||||
onEditingFinished: {
|
|
||||||
var val = parseFloat(text)
|
|
||||||
if (!isNaN(val) && control.value) {
|
|
||||||
var newRect = Qt.rect(
|
|
||||||
modelData.prop === "x" ? val : control.value.x,
|
|
||||||
modelData.prop === "y" ? val : control.value.y,
|
|
||||||
modelData.prop === "width" ? val : control.value.width,
|
|
||||||
modelData.prop === "height" ? val : control.value.height
|
|
||||||
)
|
|
||||||
control.setValue(newRect)
|
|
||||||
} else {
|
|
||||||
text = control.value ? control.value[modelData.prop].toFixed(control.decimals) : "0.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Item { Layout.fillWidth: true }
|
|
||||||
}
|
|
||||||
|
|
||||||
onValueChanged: {
|
|
||||||
if (!value) return
|
|
||||||
|
|
||||||
// 通过 Repeater 的 itemAt 方法安全访问
|
|
||||||
var props = ["x", "y", "width", "height"]
|
|
||||||
for (var i = 0; i < props.length; i++) {
|
|
||||||
var item = repeater.itemAt(i)
|
|
||||||
if (item && item.textField && !item.textField.activeFocus) {
|
|
||||||
item.textField.text = value[props[i]].toFixed(decimals)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,372 +0,0 @@
|
||||||
import QtQuick
|
|
||||||
import QtQuick.Controls
|
|
||||||
import QtQuick.Layouts
|
|
||||||
|
|
||||||
Item {
|
|
||||||
id: control
|
|
||||||
|
|
||||||
// 属性定义
|
|
||||||
property var value: Qt.size(0, 0) // QSizeF
|
|
||||||
property int decimals: 1 // 默认小数位为1
|
|
||||||
property int precision: 2 // 精度,允许的小数位数
|
|
||||||
|
|
||||||
// 尺寸相关属性
|
|
||||||
property real minWidth: 0
|
|
||||||
property real maxWidth: 999999
|
|
||||||
property real minHeight: 0
|
|
||||||
property real maxHeight: 999999
|
|
||||||
|
|
||||||
// 步进增量
|
|
||||||
property real widthStep: 1.0
|
|
||||||
property real heightStep: 1.0
|
|
||||||
|
|
||||||
// 是否显示步进按钮
|
|
||||||
property bool showSpinButtons: true
|
|
||||||
|
|
||||||
implicitHeight: 25
|
|
||||||
implicitWidth: showSpinButtons ? 140 : 120
|
|
||||||
|
|
||||||
// 信号 - 重命名避免与内置信号冲突
|
|
||||||
signal asValueChanged(value: var)
|
|
||||||
signal sizeWidthChanged(width: real) // 改为 sizeWidthChanged
|
|
||||||
signal sizeHeightChanged(height: real) // 改为 sizeHeightChanged
|
|
||||||
|
|
||||||
// 获取宽高
|
|
||||||
function getWidth() {
|
|
||||||
return value ? value.width : 0
|
|
||||||
}
|
|
||||||
|
|
||||||
function getHeight() {
|
|
||||||
return value ? value.height : 0
|
|
||||||
}
|
|
||||||
|
|
||||||
// 设置值
|
|
||||||
function setValue(newValue: var) {
|
|
||||||
if (!control.value ||
|
|
||||||
Math.abs(control.value.width - newValue.width) > 0.000001 ||
|
|
||||||
Math.abs(control.value.height - newValue.height) > 0.000001) {
|
|
||||||
|
|
||||||
// 应用边界限制
|
|
||||||
var limitedWidth = Math.max(minWidth, Math.min(maxWidth, newValue.width))
|
|
||||||
var limitedHeight = Math.max(minHeight, Math.min(maxHeight, newValue.height))
|
|
||||||
|
|
||||||
// 保留精度
|
|
||||||
limitedWidth = parseFloat(limitedWidth.toFixed(precision))
|
|
||||||
limitedHeight = parseFloat(limitedHeight.toFixed(precision))
|
|
||||||
|
|
||||||
value = Qt.size(limitedWidth, limitedHeight)
|
|
||||||
asValueChanged(value)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 设置宽度
|
|
||||||
function setWidth(width: real) {
|
|
||||||
if (control.value && Math.abs(control.value.width - width) > 0.000001) {
|
|
||||||
var limitedWidth = Math.max(minWidth, Math.min(maxWidth, width))
|
|
||||||
limitedWidth = parseFloat(limitedWidth.toFixed(precision))
|
|
||||||
control.setValue(Qt.size(limitedWidth, control.value.height))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 设置高度
|
|
||||||
function setHeight(height: real) {
|
|
||||||
if (control.value && Math.abs(control.value.height - height) > 0.000001) {
|
|
||||||
var limitedHeight = Math.max(minHeight, Math.min(maxHeight, height))
|
|
||||||
limitedHeight = parseFloat(limitedHeight.toFixed(precision))
|
|
||||||
control.setValue(Qt.size(control.value.width, limitedHeight))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 步进增加/减少
|
|
||||||
function stepWidth(positive: bool) {
|
|
||||||
if (!control.value) return
|
|
||||||
var step = positive ? widthStep : -widthStep
|
|
||||||
setWidth(getWidth() + step)
|
|
||||||
}
|
|
||||||
|
|
||||||
function stepHeight(positive: bool) {
|
|
||||||
if (!control.value) return
|
|
||||||
var step = positive ? heightStep : -heightStep
|
|
||||||
setHeight(getHeight() + step)
|
|
||||||
}
|
|
||||||
|
|
||||||
// UI布局
|
|
||||||
RowLayout {
|
|
||||||
anchors.fill: parent
|
|
||||||
spacing: 4
|
|
||||||
|
|
||||||
// 宽度部分
|
|
||||||
Label {
|
|
||||||
text: "W:"
|
|
||||||
Layout.alignment: Qt.AlignVCenter
|
|
||||||
font.pixelSize: 10
|
|
||||||
}
|
|
||||||
|
|
||||||
TextField {
|
|
||||||
id: widthBox
|
|
||||||
Layout.preferredWidth: 60
|
|
||||||
Layout.preferredHeight: 22
|
|
||||||
Layout.alignment: Qt.AlignVCenter
|
|
||||||
selectByMouse: true // 允许鼠标选择文本
|
|
||||||
|
|
||||||
text: control.value ? control.value.width.toFixed(control.decimals) : "0.0"
|
|
||||||
font.pixelSize: 10
|
|
||||||
leftPadding: 4
|
|
||||||
rightPadding: 4
|
|
||||||
|
|
||||||
// 双击全选的处理
|
|
||||||
MouseArea {
|
|
||||||
id: widthMouseArea
|
|
||||||
anchors.fill: parent
|
|
||||||
propagateComposedEvents: true
|
|
||||||
acceptedButtons: Qt.LeftButton
|
|
||||||
cursorShape: Qt.IBeamCursor
|
|
||||||
|
|
||||||
onDoubleClicked: function(mouse) {
|
|
||||||
parent.selectAll()
|
|
||||||
parent.forceActiveFocus()
|
|
||||||
mouse.accepted = true
|
|
||||||
}
|
|
||||||
|
|
||||||
onClicked: function(mouse) {
|
|
||||||
// 单击时设置焦点但不全选
|
|
||||||
parent.forceActiveFocus()
|
|
||||||
mouse.accepted = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onActiveFocusChanged: {
|
|
||||||
if (activeFocus) {
|
|
||||||
// 如果不是双击触发的焦点变化,就全选文本
|
|
||||||
if (!widthMouseArea.containsPress) {
|
|
||||||
selectAll()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 验证器
|
|
||||||
validator: DoubleValidator {
|
|
||||||
bottom: control.minWidth
|
|
||||||
top: control.maxWidth
|
|
||||||
decimals: control.precision
|
|
||||||
notation: DoubleValidator.StandardNotation
|
|
||||||
}
|
|
||||||
|
|
||||||
background: Rectangle {
|
|
||||||
color: widthBox.enabled ? "white" : "#f0f0f0"
|
|
||||||
border.color: widthBox.activeFocus ? "#2196F3" : "#cccccc"
|
|
||||||
border.width: 1
|
|
||||||
radius: 2
|
|
||||||
}
|
|
||||||
|
|
||||||
onEditingFinished: {
|
|
||||||
var num = parseFloat(text)
|
|
||||||
if (!isNaN(num) && control.value) {
|
|
||||||
control.setWidth(num)
|
|
||||||
} else {
|
|
||||||
// 恢复原值
|
|
||||||
widthBox.text = control.value ?
|
|
||||||
control.value.width.toFixed(control.decimals) :
|
|
||||||
"0.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 键盘上下键调整
|
|
||||||
Keys.onUpPressed: function(event) {
|
|
||||||
control.stepWidth(true)
|
|
||||||
event.accepted = true
|
|
||||||
}
|
|
||||||
|
|
||||||
Keys.onDownPressed: function(event) {
|
|
||||||
control.stepWidth(false)
|
|
||||||
event.accepted = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 宽度步进按钮
|
|
||||||
Row {
|
|
||||||
visible: control.showSpinButtons
|
|
||||||
spacing: 0
|
|
||||||
Layout.alignment: Qt.AlignVCenter
|
|
||||||
|
|
||||||
Button {
|
|
||||||
width: 12
|
|
||||||
height: 11
|
|
||||||
text: "▲"
|
|
||||||
font.pixelSize: 6
|
|
||||||
padding: 0
|
|
||||||
onClicked: control.stepWidth(true)
|
|
||||||
|
|
||||||
background: Rectangle {
|
|
||||||
color: parent.hovered ? "#e0e0e0" : "transparent"
|
|
||||||
border.color: "#cccccc"
|
|
||||||
border.width: 1
|
|
||||||
radius: 2
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Button {
|
|
||||||
width: 12
|
|
||||||
height: 11
|
|
||||||
text: "▼"
|
|
||||||
font.pixelSize: 6
|
|
||||||
padding: 0
|
|
||||||
onClicked: control.stepWidth(false)
|
|
||||||
|
|
||||||
background: Rectangle {
|
|
||||||
color: parent.hovered ? "#e0e0e0" : "transparent"
|
|
||||||
border.color: "#cccccc"
|
|
||||||
border.width: 1
|
|
||||||
radius: 2
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 高度部分
|
|
||||||
Label {
|
|
||||||
text: "H:"
|
|
||||||
Layout.alignment: Qt.AlignVCenter
|
|
||||||
font.pixelSize: 10
|
|
||||||
}
|
|
||||||
|
|
||||||
TextField {
|
|
||||||
id: heightBox
|
|
||||||
Layout.preferredWidth: 60
|
|
||||||
Layout.preferredHeight: 22
|
|
||||||
Layout.alignment: Qt.AlignVCenter
|
|
||||||
selectByMouse: true // 允许鼠标选择文本
|
|
||||||
|
|
||||||
text: control.value ? control.value.height.toFixed(control.decimals) : "0.0"
|
|
||||||
font.pixelSize: 10
|
|
||||||
leftPadding: 4
|
|
||||||
rightPadding: 4
|
|
||||||
|
|
||||||
// 双击全选的处理
|
|
||||||
MouseArea {
|
|
||||||
id: heightMouseArea
|
|
||||||
anchors.fill: parent
|
|
||||||
propagateComposedEvents: true
|
|
||||||
acceptedButtons: Qt.LeftButton
|
|
||||||
cursorShape: Qt.IBeamCursor
|
|
||||||
|
|
||||||
onDoubleClicked: function(mouse) {
|
|
||||||
parent.selectAll()
|
|
||||||
parent.forceActiveFocus()
|
|
||||||
mouse.accepted = true
|
|
||||||
}
|
|
||||||
|
|
||||||
onClicked: function(mouse) {
|
|
||||||
// 单击时设置焦点但不全选
|
|
||||||
parent.forceActiveFocus()
|
|
||||||
mouse.accepted = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onActiveFocusChanged: {
|
|
||||||
if (activeFocus) {
|
|
||||||
// 如果不是双击触发的焦点变化,就全选文本
|
|
||||||
if (!heightMouseArea.containsPress) {
|
|
||||||
selectAll()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 验证器
|
|
||||||
validator: DoubleValidator {
|
|
||||||
bottom: control.minHeight
|
|
||||||
top: control.maxHeight
|
|
||||||
decimals: control.precision
|
|
||||||
notation: DoubleValidator.StandardNotation
|
|
||||||
}
|
|
||||||
|
|
||||||
background: Rectangle {
|
|
||||||
color: heightBox.enabled ? "white" : "#f0f0f0"
|
|
||||||
border.color: heightBox.activeFocus ? "#2196F3" : "#cccccc"
|
|
||||||
border.width: 1
|
|
||||||
radius: 2
|
|
||||||
}
|
|
||||||
|
|
||||||
onEditingFinished: {
|
|
||||||
var num = parseFloat(text)
|
|
||||||
if (!isNaN(num) && control.value) {
|
|
||||||
control.setHeight(num)
|
|
||||||
} else {
|
|
||||||
// 恢复原值
|
|
||||||
heightBox.text = control.value ?
|
|
||||||
control.value.height.toFixed(control.decimals) :
|
|
||||||
"0.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 键盘上下键调整
|
|
||||||
Keys.onUpPressed: function(event) {
|
|
||||||
control.stepHeight(true)
|
|
||||||
event.accepted = true
|
|
||||||
}
|
|
||||||
|
|
||||||
Keys.onDownPressed: function(event) {
|
|
||||||
control.stepHeight(false)
|
|
||||||
event.accepted = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 高度步进按钮
|
|
||||||
Row {
|
|
||||||
visible: control.showSpinButtons
|
|
||||||
spacing: 0
|
|
||||||
Layout.alignment: Qt.AlignVCenter
|
|
||||||
|
|
||||||
Button {
|
|
||||||
width: 12
|
|
||||||
height: 11
|
|
||||||
text: "▲"
|
|
||||||
font.pixelSize: 6
|
|
||||||
padding: 0
|
|
||||||
onClicked: control.stepHeight(true)
|
|
||||||
|
|
||||||
background: Rectangle {
|
|
||||||
color: parent.hovered ? "#e0e0e0" : "transparent"
|
|
||||||
border.color: "#cccccc"
|
|
||||||
border.width: 1
|
|
||||||
radius: 2
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Button {
|
|
||||||
width: 12
|
|
||||||
height: 11
|
|
||||||
text: "▼"
|
|
||||||
font.pixelSize: 6
|
|
||||||
padding: 0
|
|
||||||
onClicked: control.stepHeight(false)
|
|
||||||
|
|
||||||
background: Rectangle {
|
|
||||||
color: parent.hovered ? "#e0e0e0" : "transparent"
|
|
||||||
border.color: "#cccccc"
|
|
||||||
border.width: 1
|
|
||||||
radius: 2
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 当value从外部改变时,更新输入框显示
|
|
||||||
onValueChanged: {
|
|
||||||
if (value) {
|
|
||||||
if (!widthBox.activeFocus) {
|
|
||||||
widthBox.text = value.width.toFixed(decimals)
|
|
||||||
}
|
|
||||||
if (!heightBox.activeFocus) {
|
|
||||||
heightBox.text = value.height.toFixed(decimals)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 发出单独的宽高变化信号
|
|
||||||
sizeWidthChanged(value.width)
|
|
||||||
sizeHeightChanged(value.height)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -162,188 +162,6 @@ void QQuickDetailsViewManager::RegisterBasicTypeEditor() {
|
||||||
return valueEditor;
|
return valueEditor;
|
||||||
});
|
});
|
||||||
|
|
||||||
registerTypeEditor(QMetaType::fromType<bool>(), [](QPropertyHandle* handle, QQuickItem* parent)->QQuickItem* {
|
|
||||||
QQmlEngine* engine = qmlEngine(parent);
|
|
||||||
QQmlContext* context = qmlContext(parent);
|
|
||||||
QQmlComponent comp(engine);
|
|
||||||
comp.setData(R"(
|
|
||||||
import QtQuick;
|
|
||||||
import QtQuick.Controls;
|
|
||||||
import "qrc:/resources/Qml/ValueEditor"
|
|
||||||
BoolBox{
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
width: parent.width
|
|
||||||
}
|
|
||||||
)", QUrl());
|
|
||||||
QVariantMap initialProperties;
|
|
||||||
initialProperties["parent"] = QVariant::fromValue(parent);
|
|
||||||
auto valueEditor = qobject_cast<QQuickItem*>(comp.createWithInitialProperties(initialProperties, context));
|
|
||||||
if (!comp.errors().isEmpty()) {
|
|
||||||
qDebug() << comp.errorString();
|
|
||||||
}
|
|
||||||
valueEditor->setParentItem(parent);
|
|
||||||
valueEditor->setProperty("value", handle->getVar());
|
|
||||||
connect(valueEditor, SIGNAL(asValueChanged(QVariant)), handle, SLOT(setVar(QVariant)));
|
|
||||||
connect(handle, SIGNAL(asRequestRollback(QVariant)), valueEditor, SLOT(setValue(QVariant)));
|
|
||||||
return valueEditor;
|
|
||||||
});
|
|
||||||
|
|
||||||
registerTypeEditor(QMetaType::fromType<QPoint>(), [](QPropertyHandle* handle, QQuickItem* parent)->QQuickItem* {
|
|
||||||
QQmlEngine* engine = qmlEngine(parent);
|
|
||||||
QQmlContext* context = qmlContext(parent);
|
|
||||||
QQmlComponent comp(engine);
|
|
||||||
comp.setData(R"(
|
|
||||||
import QtQuick;
|
|
||||||
import QtQuick.Controls;
|
|
||||||
import "qrc:/resources/Qml/ValueEditor"
|
|
||||||
PointFBox{
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
width: parent.width
|
|
||||||
}
|
|
||||||
)", QUrl());
|
|
||||||
QVariantMap initialProperties;
|
|
||||||
initialProperties["parent"] = QVariant::fromValue(parent);
|
|
||||||
auto valueEditor = qobject_cast<QQuickItem*>(comp.createWithInitialProperties(initialProperties, context));
|
|
||||||
if (!comp.errors().isEmpty()) {
|
|
||||||
qDebug() << comp.errorString();
|
|
||||||
}
|
|
||||||
valueEditor->setParentItem(parent);
|
|
||||||
valueEditor->setProperty("value", handle->getVar());
|
|
||||||
connect(valueEditor, SIGNAL(asValueChanged(QVariant)), handle, SLOT(setVar(QVariant)));
|
|
||||||
connect(handle, SIGNAL(asRequestRollback(QVariant)), valueEditor, SLOT(setValue(QVariant)));
|
|
||||||
return valueEditor;
|
|
||||||
});
|
|
||||||
|
|
||||||
registerTypeEditor(QMetaType::fromType<QPointF>(), [](QPropertyHandle* handle, QQuickItem* parent)->QQuickItem* {
|
|
||||||
QQmlEngine* engine = qmlEngine(parent);
|
|
||||||
QQmlContext* context = qmlContext(parent);
|
|
||||||
QQmlComponent comp(engine);
|
|
||||||
comp.setData(R"(
|
|
||||||
import QtQuick;
|
|
||||||
import QtQuick.Controls;
|
|
||||||
import "qrc:/resources/Qml/ValueEditor"
|
|
||||||
PointFBox{
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
width: parent.width
|
|
||||||
}
|
|
||||||
)", QUrl());
|
|
||||||
QVariantMap initialProperties;
|
|
||||||
initialProperties["parent"] = QVariant::fromValue(parent);
|
|
||||||
auto valueEditor = qobject_cast<QQuickItem*>(comp.createWithInitialProperties(initialProperties, context));
|
|
||||||
if (!comp.errors().isEmpty()) {
|
|
||||||
qDebug() << comp.errorString();
|
|
||||||
}
|
|
||||||
valueEditor->setParentItem(parent);
|
|
||||||
valueEditor->setProperty("value", handle->getVar());
|
|
||||||
connect(valueEditor, SIGNAL(asValueChanged(QVariant)), handle, SLOT(setVar(QVariant)));
|
|
||||||
connect(handle, SIGNAL(asRequestRollback(QVariant)), valueEditor, SLOT(setValue(QVariant)));
|
|
||||||
return valueEditor;
|
|
||||||
});
|
|
||||||
|
|
||||||
registerTypeEditor(QMetaType::fromType<QRect>(), [](QPropertyHandle* handle, QQuickItem* parent)->QQuickItem* {
|
|
||||||
QQmlEngine* engine = qmlEngine(parent);
|
|
||||||
QQmlContext* context = qmlContext(parent);
|
|
||||||
QQmlComponent comp(engine);
|
|
||||||
comp.setData(R"(
|
|
||||||
import QtQuick;
|
|
||||||
import QtQuick.Controls;
|
|
||||||
import "qrc:/resources/Qml/ValueEditor"
|
|
||||||
RectFBox{
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
width: parent.width
|
|
||||||
}
|
|
||||||
)", QUrl());
|
|
||||||
QVariantMap initialProperties;
|
|
||||||
initialProperties["parent"] = QVariant::fromValue(parent);
|
|
||||||
auto valueEditor = qobject_cast<QQuickItem*>(comp.createWithInitialProperties(initialProperties, context));
|
|
||||||
if (!comp.errors().isEmpty()) {
|
|
||||||
qDebug() << comp.errorString();
|
|
||||||
}
|
|
||||||
valueEditor->setParentItem(parent);
|
|
||||||
valueEditor->setProperty("value", handle->getVar());
|
|
||||||
connect(valueEditor, SIGNAL(asValueChanged(QVariant)), handle, SLOT(setVar(QVariant)));
|
|
||||||
connect(handle, SIGNAL(asRequestRollback(QVariant)), valueEditor, SLOT(setValue(QVariant)));
|
|
||||||
return valueEditor;
|
|
||||||
});
|
|
||||||
|
|
||||||
registerTypeEditor(QMetaType::fromType<QRectF>(), [](QPropertyHandle* handle, QQuickItem* parent)->QQuickItem* {
|
|
||||||
QQmlEngine* engine = qmlEngine(parent);
|
|
||||||
QQmlContext* context = qmlContext(parent);
|
|
||||||
QQmlComponent comp(engine);
|
|
||||||
comp.setData(R"(
|
|
||||||
import QtQuick;
|
|
||||||
import QtQuick.Controls;
|
|
||||||
import "qrc:/resources/Qml/ValueEditor"
|
|
||||||
RectFBox{
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
width: parent.width
|
|
||||||
}
|
|
||||||
)", QUrl());
|
|
||||||
QVariantMap initialProperties;
|
|
||||||
initialProperties["parent"] = QVariant::fromValue(parent);
|
|
||||||
auto valueEditor = qobject_cast<QQuickItem*>(comp.createWithInitialProperties(initialProperties, context));
|
|
||||||
if (!comp.errors().isEmpty()) {
|
|
||||||
qDebug() << comp.errorString();
|
|
||||||
}
|
|
||||||
valueEditor->setParentItem(parent);
|
|
||||||
valueEditor->setProperty("value", handle->getVar());
|
|
||||||
connect(valueEditor, SIGNAL(asValueChanged(QVariant)), handle, SLOT(setVar(QVariant)));
|
|
||||||
connect(handle, SIGNAL(asRequestRollback(QVariant)), valueEditor, SLOT(setValue(QVariant)));
|
|
||||||
return valueEditor;
|
|
||||||
});
|
|
||||||
|
|
||||||
registerTypeEditor(QMetaType::fromType<QSize>(), [](QPropertyHandle* handle, QQuickItem* parent)->QQuickItem* {
|
|
||||||
QQmlEngine* engine = qmlEngine(parent);
|
|
||||||
QQmlContext* context = qmlContext(parent);
|
|
||||||
QQmlComponent comp(engine);
|
|
||||||
comp.setData(R"(
|
|
||||||
import QtQuick;
|
|
||||||
import QtQuick.Controls;
|
|
||||||
import "qrc:/resources/Qml/ValueEditor"
|
|
||||||
SizeFBox{
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
width: parent.width
|
|
||||||
}
|
|
||||||
)", QUrl());
|
|
||||||
QVariantMap initialProperties;
|
|
||||||
initialProperties["parent"] = QVariant::fromValue(parent);
|
|
||||||
auto valueEditor = qobject_cast<QQuickItem*>(comp.createWithInitialProperties(initialProperties, context));
|
|
||||||
if (!comp.errors().isEmpty()) {
|
|
||||||
qDebug() << comp.errorString();
|
|
||||||
}
|
|
||||||
valueEditor->setParentItem(parent);
|
|
||||||
valueEditor->setProperty("value", handle->getVar());
|
|
||||||
connect(valueEditor, SIGNAL(asValueChanged(QVariant)), handle, SLOT(setVar(QVariant)));
|
|
||||||
connect(handle, SIGNAL(asRequestRollback(QVariant)), valueEditor, SLOT(setValue(QVariant)));
|
|
||||||
return valueEditor;
|
|
||||||
});
|
|
||||||
|
|
||||||
registerTypeEditor(QMetaType::fromType<QSizeF>(), [](QPropertyHandle* handle, QQuickItem* parent)->QQuickItem* {
|
|
||||||
QQmlEngine* engine = qmlEngine(parent);
|
|
||||||
QQmlContext* context = qmlContext(parent);
|
|
||||||
QQmlComponent comp(engine);
|
|
||||||
comp.setData(R"(
|
|
||||||
import QtQuick;
|
|
||||||
import QtQuick.Controls;
|
|
||||||
import "qrc:/resources/Qml/ValueEditor"
|
|
||||||
SizeFBox{
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
width: parent.width
|
|
||||||
}
|
|
||||||
)", QUrl());
|
|
||||||
QVariantMap initialProperties;
|
|
||||||
initialProperties["parent"] = QVariant::fromValue(parent);
|
|
||||||
auto valueEditor = qobject_cast<QQuickItem*>(comp.createWithInitialProperties(initialProperties, context));
|
|
||||||
if (!comp.errors().isEmpty()) {
|
|
||||||
qDebug() << comp.errorString();
|
|
||||||
}
|
|
||||||
valueEditor->setParentItem(parent);
|
|
||||||
valueEditor->setProperty("value", handle->getVar());
|
|
||||||
connect(valueEditor, SIGNAL(asValueChanged(QVariant)), handle, SLOT(setVar(QVariant)));
|
|
||||||
connect(handle, SIGNAL(asRequestRollback(QVariant)), valueEditor, SLOT(setValue(QVariant)));
|
|
||||||
return valueEditor;
|
|
||||||
});
|
|
||||||
|
|
||||||
registerTypeEditor(QMetaType::fromType<QColor>(), [](QPropertyHandle* handle, QQuickItem* parent)->QQuickItem* {
|
registerTypeEditor(QMetaType::fromType<QColor>(), [](QPropertyHandle* handle, QQuickItem* parent)->QQuickItem* {
|
||||||
QQmlEngine* engine = qmlEngine(parent);
|
QQmlEngine* engine = qmlEngine(parent);
|
||||||
QQmlContext* context = qmlContext(parent);
|
QQmlContext* context = qmlContext(parent);
|
||||||
|
|
@ -417,52 +235,4 @@ void QQuickDetailsViewManager::RegisterBasicTypeEditor() {
|
||||||
connect(handle, SIGNAL(asRequestRollback(QVariant)), valueEditor, SLOT(setValue(QVariant)));
|
connect(handle, SIGNAL(asRequestRollback(QVariant)), valueEditor, SLOT(setValue(QVariant)));
|
||||||
return valueEditor;
|
return valueEditor;
|
||||||
});
|
});
|
||||||
|
|
||||||
QMetaType::registerConverterFunction(
|
|
||||||
[](const void* src, void* target) -> bool {
|
|
||||||
const QFileInfo& file = *static_cast<const QFileInfo*>(src);
|
|
||||||
QString& str = *static_cast<QString*>(target);
|
|
||||||
str = file.fileName();
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
QMetaType::fromType<QFileInfo>(),
|
|
||||||
QMetaType::fromType<QString>()
|
|
||||||
);
|
|
||||||
|
|
||||||
QMetaType::registerConverterFunction(
|
|
||||||
[](const void* src, void* target) -> bool {
|
|
||||||
const QString& str = *static_cast<const QString*>(src);
|
|
||||||
QFileInfo& file = *static_cast<QFileInfo*>(target);
|
|
||||||
file = QFileInfo(str);
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
QMetaType::fromType<QString>(),
|
|
||||||
QMetaType::fromType<QFileInfo>()
|
|
||||||
);
|
|
||||||
|
|
||||||
registerTypeEditor(QMetaType::fromType<QFileInfo>(), [](QPropertyHandle* handle, QQuickItem* parent)->QQuickItem* {
|
|
||||||
QQmlEngine* engine = qmlEngine(parent);
|
|
||||||
QQmlContext* context = qmlContext(parent);
|
|
||||||
QQmlComponent comp(engine);
|
|
||||||
comp.setData(R"(
|
|
||||||
import QtQuick;
|
|
||||||
import QtQuick.Controls;
|
|
||||||
import "qrc:/resources/Qml/ValueEditor"
|
|
||||||
FileSelector{
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
width: parent.width
|
|
||||||
}
|
|
||||||
)", QUrl());
|
|
||||||
QVariantMap initialProperties;
|
|
||||||
initialProperties["parent"] = QVariant::fromValue(parent);
|
|
||||||
auto valueEditor = qobject_cast<QQuickItem*>(comp.createWithInitialProperties(initialProperties, context));
|
|
||||||
if (!comp.errors().isEmpty()) {
|
|
||||||
qDebug() << comp.errorString();
|
|
||||||
}
|
|
||||||
valueEditor->setParentItem(parent);
|
|
||||||
valueEditor->setProperty("value", handle->getVar());
|
|
||||||
connect(valueEditor, SIGNAL(asValueChanged(QVariant)), handle, SLOT(setVar(QVariant)));
|
|
||||||
connect(handle, SIGNAL(asRequestRollback(QVariant)), valueEditor, SLOT(setValue(QVariant)));
|
|
||||||
return valueEditor;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,72 +0,0 @@
|
||||||
#ifndef META_MODEL_H
|
|
||||||
#define META_MODEL_H
|
|
||||||
/*********元模型********/
|
|
||||||
#include <QString>
|
|
||||||
#include <QJsonObject>
|
|
||||||
|
|
||||||
struct attributeGroup {
|
|
||||||
int id = 0;
|
|
||||||
QString groupType;
|
|
||||||
QString groupName;
|
|
||||||
int isPublic = -1;
|
|
||||||
QString remark;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct dataType //数据类型(元模)
|
|
||||||
{
|
|
||||||
int id = 0;
|
|
||||||
QString dataType;
|
|
||||||
QString databaseType;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct modelType {
|
|
||||||
int id = 0;
|
|
||||||
QString modelType;
|
|
||||||
QString modelName;
|
|
||||||
int graphicElement; // 图形元素类型
|
|
||||||
QByteArray icon; //图片
|
|
||||||
QString remark;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct modelGroup
|
|
||||||
{
|
|
||||||
int id = 0;
|
|
||||||
qint64 modelTypeId = 0;
|
|
||||||
qint64 attributeGroupId = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct attribute {
|
|
||||||
int id = 0;
|
|
||||||
QString attribute; // 属性名
|
|
||||||
QString attributeName; // 别名
|
|
||||||
qint64 dataTypeId = 0; //数据类型id
|
|
||||||
int lengthPrecision = 0; //长度限制(varchar)
|
|
||||||
int scale = 0; //小数点位数
|
|
||||||
int isNotNull = 0; //是否非空
|
|
||||||
QString defaultValue; //默认值
|
|
||||||
QString valueRange; //数值范围
|
|
||||||
int isVisible = 1;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct modelAttribute //模型属性表(所有模型属性的索引)
|
|
||||||
{
|
|
||||||
int id = 0;
|
|
||||||
qint64 modelTypeId = 0;
|
|
||||||
qint64 attributeGroupId = 0;
|
|
||||||
qint64 attributeId = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct modelAttributePublic //公共属性表
|
|
||||||
{
|
|
||||||
int id = 0;
|
|
||||||
qint64 attributeGroupId = 0;
|
|
||||||
qint64 attributeId = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct modelConnectivity { //模型连接性表(元模是否可以连接)
|
|
||||||
int id = 0;
|
|
||||||
QString fromModel; //属性名
|
|
||||||
QString toModel;
|
|
||||||
int connectivity = 0; //是否可连
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,283 +0,0 @@
|
||||||
#ifndef PROJECT_MODEL_H
|
|
||||||
#define PROJECT_MODEL_H
|
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
#include <QString>
|
|
||||||
#include <QJsonObject>
|
|
||||||
#include <QMap>
|
|
||||||
#include <QStandardItemModel>
|
|
||||||
#include "tools.h"
|
|
||||||
|
|
||||||
struct ProjectManagerStruct {
|
|
||||||
int id = 0;
|
|
||||||
QString name; // 工程模表名
|
|
||||||
QString tag; // 工程模名称
|
|
||||||
QString metaModel; // 元模名
|
|
||||||
QString groupName; // 属性组名
|
|
||||||
int linkType; // 图元链接类型
|
|
||||||
QJsonObject checkState; // 属性选择状态
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ProjectModelSettingStruct //工程模设定类,如图标
|
|
||||||
{
|
|
||||||
QString modelName; //工程模名
|
|
||||||
QMap<QString,QByteArray> mapSvg; //存放选择的svg图片
|
|
||||||
QMap<QString,QByteArray> mapUsedSvg; //存放使用的svg
|
|
||||||
};
|
|
||||||
|
|
||||||
struct PropertyState {
|
|
||||||
bool checkState = false;
|
|
||||||
QString dataType;
|
|
||||||
bool editable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct PropertyPage {
|
|
||||||
QMap<QString, PropertyState> checkState;
|
|
||||||
bool isPublic = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct FormerName //曾用名,记录修改前名称
|
|
||||||
{
|
|
||||||
QString sName;
|
|
||||||
bool bChanged = false; //是否改变过
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef QMap<QString, PropertyPage> MapProperty;
|
|
||||||
|
|
||||||
struct PropertyModel {
|
|
||||||
MapProperty mapProperty;
|
|
||||||
int nType = 0; //工程模类型,选择图标后确定
|
|
||||||
QStandardItemModel* pBase = nullptr; //基础属性
|
|
||||||
QStandardItemModel* pSelect = nullptr; //已选择属性
|
|
||||||
FormerName formerMeta; //曾用元模名
|
|
||||||
FormerName formerProject; //曾用工程模名
|
|
||||||
QMap<QString,ProjectManagerStruct> dataInfo; //存放数据库内容
|
|
||||||
ProjectModelSettingStruct modelSetting;
|
|
||||||
PropertyModel deepCopy() //深拷贝
|
|
||||||
{
|
|
||||||
PropertyModel copy;
|
|
||||||
copy.mapProperty = mapProperty;
|
|
||||||
copy.nType = nType;
|
|
||||||
copy.pBase = deepCloneModel(pBase);
|
|
||||||
copy.pSelect = deepCloneModel(pSelect);
|
|
||||||
copy.formerMeta = formerMeta;
|
|
||||||
copy.formerProject = formerProject;
|
|
||||||
copy.dataInfo = dataInfo;
|
|
||||||
copy.modelSetting = modelSetting;
|
|
||||||
return copy;
|
|
||||||
}
|
|
||||||
void release()
|
|
||||||
{
|
|
||||||
delete pBase;
|
|
||||||
delete pSelect;
|
|
||||||
pBase = nullptr;
|
|
||||||
pSelect = nullptr;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef QMap<QString,PropertyModel> MapProject; //str为工程名,PropertyModel为工程属性
|
|
||||||
typedef QMap<QString,MapProject> MapMeta; //str为元模名,PropertyModel为工程模集
|
|
||||||
|
|
||||||
struct PropertyStateInfo {
|
|
||||||
QString name; // 属性名
|
|
||||||
QString tagName; // 别名
|
|
||||||
QString type; // 属性类型
|
|
||||||
QVariant defaultValue; // 默认值
|
|
||||||
int lengthPrecision = 999; // 长度限制
|
|
||||||
int isVisible = 1; // 是否可见(0不可见,1可见,2特殊项)
|
|
||||||
bool lock = false; // 值手动改变时置true,下次保存时恢复
|
|
||||||
};
|
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(PropertyStateInfo)
|
|
||||||
|
|
||||||
// 属性值信息映射
|
|
||||||
typedef QMap<QString, PropertyStateInfo> PropertyValueInfo;
|
|
||||||
|
|
||||||
// 属性组状态信息
|
|
||||||
struct GroupStateInfo {
|
|
||||||
QString groupName; // 组名
|
|
||||||
QString tableName; // 表名
|
|
||||||
bool isPublic = false; // 是否公共
|
|
||||||
PropertyValueInfo info; // 属性信息
|
|
||||||
};
|
|
||||||
|
|
||||||
// 属性组实时数据
|
|
||||||
struct GroupStateValue {
|
|
||||||
QString groupName; // 组名
|
|
||||||
QString tableName; // 表名
|
|
||||||
QMap<QUuid, PropertyValueInfo> mapInfo; // 实时信息映射
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ModelStateInfo //模型结构信息
|
|
||||||
{
|
|
||||||
QString modelName;
|
|
||||||
int modelType;
|
|
||||||
QWidget* _PropertyDlg = NULL; //属性设置界面,每个模型维护一种界面
|
|
||||||
QMap<QString,GroupStateInfo> groupInfo; //属性组信息
|
|
||||||
void release()
|
|
||||||
{
|
|
||||||
if(_PropertyDlg){
|
|
||||||
delete _PropertyDlg;
|
|
||||||
_PropertyDlg = nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ModelDataInfo //模型数据信息
|
|
||||||
{
|
|
||||||
QString modelName;
|
|
||||||
int modelType;
|
|
||||||
QMap<QString,GroupStateValue> groupInfo; //属性组实时信息
|
|
||||||
};
|
|
||||||
|
|
||||||
struct PropertyGroupState {
|
|
||||||
QString groupName; // 属性组名称
|
|
||||||
QString tableName; // 属性组表名
|
|
||||||
QJsonObject propertyState; // 属性状态信息
|
|
||||||
};
|
|
||||||
|
|
||||||
struct MeasureAttributeType //量测可用属性类型(从基模获取的占位符变量)
|
|
||||||
{
|
|
||||||
QString tag;
|
|
||||||
QString name;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 属性内容信息
|
|
||||||
struct PropertyContentInfo {
|
|
||||||
QString proTag; // 属性标签
|
|
||||||
QString proName; // 属性名称
|
|
||||||
QString proType; // 属性类型
|
|
||||||
QWidget* proEditor = nullptr; // 编辑窗口对象
|
|
||||||
|
|
||||||
bool isValid() const {
|
|
||||||
return !proTag.isEmpty() && !proName.isEmpty();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct PtExtraInfo
|
|
||||||
{
|
|
||||||
int index = 0;
|
|
||||||
QString scope; //变比标签
|
|
||||||
QString accuracy; //精度等级标签
|
|
||||||
QString volume; //二次负载容量标签
|
|
||||||
QString star; //线圈接法
|
|
||||||
double ratio; //变比
|
|
||||||
int polarity = 1; //极性
|
|
||||||
};
|
|
||||||
|
|
||||||
struct CtExtraInfo
|
|
||||||
{
|
|
||||||
int index = 0;
|
|
||||||
QString scope; //变比标签
|
|
||||||
QString accuracy; //精度等级标签
|
|
||||||
QString volume; //二次负载容量标签
|
|
||||||
double ratio; //变比
|
|
||||||
int polarity = 1; //极性
|
|
||||||
};
|
|
||||||
|
|
||||||
struct MeasurementInfo //量测
|
|
||||||
{
|
|
||||||
QString tag; //量测tag
|
|
||||||
QString name; //量测名称
|
|
||||||
int type; //量测类型 0:遥测 1:遥信 2:遥控
|
|
||||||
int size; //量测size
|
|
||||||
QUuid bayUuid; //所属间隔
|
|
||||||
QUuid componentUuid; //所属设备
|
|
||||||
|
|
||||||
//通讯
|
|
||||||
int nSource; //数据来源 1:cl3611 2:104
|
|
||||||
QString sStation; //子站名称
|
|
||||||
QString sDevice; //设备名称
|
|
||||||
QString sChannel; //通道名(cl3611) 遥测:TMx(1-8); P; Q; S; PF; F; deltaF; UAB; UBC; UCA; 遥信: TSxx(01-10); 遥控: TCx;
|
|
||||||
int nPacket; //包号(104)
|
|
||||||
int nOffset; //偏移量(104)
|
|
||||||
//事件
|
|
||||||
bool bEnable = false; //"enable"开启标志
|
|
||||||
QMap<QString,double> mapTE; //遥测"cause" key:upup,up,down,downdown可选,val:0-100
|
|
||||||
QString sEdge; //遥信"cause:edge" raising, falling 字符串单选
|
|
||||||
QString sCommand; //"action:command" info, warning, error, critical, exception 字符串单选
|
|
||||||
QStringList lstParameter; //"action:parameters" 字符串数组
|
|
||||||
|
|
||||||
QString sWindType; //绕组类型 ctpt
|
|
||||||
int nRatio; //变比
|
|
||||||
int nPolarity; //极性
|
|
||||||
int nIndex; //对应绕组序号
|
|
||||||
|
|
||||||
QString sSymmetry; //对称量测的name
|
|
||||||
};
|
|
||||||
|
|
||||||
// 定义比较键的结构
|
|
||||||
struct MeasurementKey {
|
|
||||||
int nSource;
|
|
||||||
QString sStation;
|
|
||||||
QString sDevice;
|
|
||||||
QString sChannel;
|
|
||||||
int nPacket;
|
|
||||||
int nOffset;
|
|
||||||
|
|
||||||
MeasurementKey(const MeasurementInfo& info)
|
|
||||||
: nSource(info.nSource)
|
|
||||||
, sStation(info.sStation)
|
|
||||||
, sDevice(info.sDevice)
|
|
||||||
, sChannel(info.sChannel)
|
|
||||||
, nPacket(info.nPacket)
|
|
||||||
, nOffset(info.nOffset) {}
|
|
||||||
|
|
||||||
// 用于QMap排序
|
|
||||||
bool operator<(const MeasurementKey& other) const {
|
|
||||||
if (nSource != other.nSource) return nSource < other.nSource;
|
|
||||||
if (sStation != other.sStation) return sStation < other.sStation;
|
|
||||||
if (sDevice != other.sDevice) return sDevice < other.sDevice;
|
|
||||||
if (sChannel != other.sChannel) return sChannel < other.sChannel;
|
|
||||||
if (nPacket != other.nPacket) return nPacket < other.nPacket;
|
|
||||||
return nOffset < other.nOffset;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ComponentInfo //工程模图元数据
|
|
||||||
{
|
|
||||||
QUuid uuid;
|
|
||||||
QString modelName;
|
|
||||||
QString nspath;
|
|
||||||
QString tag;
|
|
||||||
QString name;
|
|
||||||
QString description;
|
|
||||||
QString grid;
|
|
||||||
QString zone;
|
|
||||||
QString station;
|
|
||||||
int type = 0;
|
|
||||||
bool inService = true;
|
|
||||||
int state = 0;
|
|
||||||
QJsonObject connected_bus;
|
|
||||||
QJsonObject label;
|
|
||||||
QJsonObject context;
|
|
||||||
int op = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ComponentTypeInfo //元件类型
|
|
||||||
{
|
|
||||||
int id = 0;
|
|
||||||
QString type;
|
|
||||||
QString name;
|
|
||||||
QJsonObject config;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct PageInfo
|
|
||||||
{
|
|
||||||
int id = -1;
|
|
||||||
QString tag;
|
|
||||||
QString name;
|
|
||||||
QJsonObject label;
|
|
||||||
QJsonObject context;
|
|
||||||
QString description;
|
|
||||||
int op;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 页面中保存的项信息
|
|
||||||
struct ItemPageInfo {
|
|
||||||
QPointF pos;
|
|
||||||
double dWidth = 0.0;
|
|
||||||
double dHeight = 0.0;
|
|
||||||
double dRotate = 0.0;
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
#ifndef CONSTANTS_H
|
|
||||||
#define CONSTANTS_H
|
|
||||||
/*********常量定义********/
|
|
||||||
namespace Constants {
|
|
||||||
const double SCENE_WIDTH = 800;
|
|
||||||
const double SCENE_HEIGHT = 600;
|
|
||||||
const int EDITOR_ITEM_WIDTH = 150;
|
|
||||||
const int EDITOR_ITEM_HEIGHT = 80;
|
|
||||||
const int EDITOR_BUS_HEIGHT = 10;
|
|
||||||
const int V_DIAGRAM_SPACING = 80;
|
|
||||||
const int H_DIAGRAM_SPACING = 80;
|
|
||||||
const int TRANSFORMER_LEVEL = 999; // 层级结构中变压器所处层级
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
#ifndef DATA_TRANSMISSION_H
|
|
||||||
#define DATA_TRANSMISSION_H
|
|
||||||
/*********数据传输********/
|
|
||||||
#include <QString>
|
|
||||||
#include <QStringList>
|
|
||||||
|
|
||||||
/*******************传递的数据************************/
|
|
||||||
struct HttpRecommandInfo{ //推荐数据服务
|
|
||||||
QString sInput; //输入的前缀
|
|
||||||
int nOffset = 0; //正确位置计数
|
|
||||||
QStringList lstRecommand; //推荐列表
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,372 +0,0 @@
|
||||||
#ifndef DIAGRAM_H
|
|
||||||
#define DIAGRAM_H
|
|
||||||
/*********组态图********/
|
|
||||||
#include <QString>
|
|
||||||
#include <QUuid>
|
|
||||||
#include <QJsonObject>
|
|
||||||
#include <QHash>
|
|
||||||
#include <QList>
|
|
||||||
#include <QPointF>
|
|
||||||
#include <QRectF>
|
|
||||||
|
|
||||||
// 组态图信息
|
|
||||||
struct DiagramInfo {
|
|
||||||
QVariant id; //临时id使用uuid,load数据使用数据库自增id
|
|
||||||
QString sName;
|
|
||||||
QString sTag;
|
|
||||||
QVariant parentId;
|
|
||||||
QString sBasePageName; //父组态图名称
|
|
||||||
};
|
|
||||||
|
|
||||||
struct DiagramEditorWizardBusInfo //组态编辑母线信息
|
|
||||||
{
|
|
||||||
int nIndex = 0;
|
|
||||||
double dVoltage = 0; //电压等级
|
|
||||||
int nLineType = 1; //1单母线,2双母线
|
|
||||||
int nNum1 = 0; //1母
|
|
||||||
int nNum2 = 0; //2母
|
|
||||||
int connectType = 0; //接线方式,1为分段连接
|
|
||||||
int nState = 0; //母线状态位 0已保存1新建2修改
|
|
||||||
|
|
||||||
friend QDataStream &operator<<(QDataStream &out, const DiagramEditorWizardBusInfo &data) {
|
|
||||||
out << data.nIndex << data.dVoltage << data.nLineType << data.nNum1 << data.nNum2 << data.connectType << data.nState;
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
friend QDataStream &operator>>(QDataStream &in, DiagramEditorWizardBusInfo &data) {
|
|
||||||
in >> data.nIndex >> data.dVoltage >> data.nLineType >> data.nNum1 >> data.nNum2 >> data.connectType >> data.nState;
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class TransformerType //变压器类型
|
|
||||||
{
|
|
||||||
twoWinding = 0, //两绕组
|
|
||||||
threeWinding //三绕组
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class BayType //间隔类型
|
|
||||||
{
|
|
||||||
busSectionBay = 0, //分段
|
|
||||||
busCouplerBay, //母联
|
|
||||||
ptBay, //pt
|
|
||||||
incomingBay, //进线
|
|
||||||
outcomingBay, //出线
|
|
||||||
compensationBay, //无功补偿
|
|
||||||
bypassBay, //旁路
|
|
||||||
mainTransformerBay //主变
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class EditorItemType //组态编辑中的图形项类型
|
|
||||||
{
|
|
||||||
bus = 1, //母线
|
|
||||||
bay, //间隔
|
|
||||||
trans, //变压器
|
|
||||||
line, //连接线
|
|
||||||
None //空白占位图
|
|
||||||
};
|
|
||||||
|
|
||||||
struct EditorTransConnection //组态变压器连接信息
|
|
||||||
{
|
|
||||||
QString sName;
|
|
||||||
int nPara = 0; //012,高中低侧
|
|
||||||
};
|
|
||||||
|
|
||||||
struct DiagramEditorWizardTransformerInfo //组态变压器信息
|
|
||||||
{
|
|
||||||
QString sName;
|
|
||||||
TransformerType nType;
|
|
||||||
double dVoltageLevel;
|
|
||||||
QList<EditorTransConnection> lstBindObj; //连接的对象
|
|
||||||
};
|
|
||||||
|
|
||||||
struct DiagramEditorWizardBayInfo //组态间隔信息
|
|
||||||
{
|
|
||||||
QString sName;
|
|
||||||
BayType nType;
|
|
||||||
double dVoltageLevel;
|
|
||||||
QList<QString> lstBindObj; //连接的对象
|
|
||||||
};
|
|
||||||
|
|
||||||
struct DiagramEditorComponentInfo //组态设备信息
|
|
||||||
{
|
|
||||||
int nCategory = 0; //分类 0电气设备1连接关系
|
|
||||||
QString sName;
|
|
||||||
int nType = 0; //类型 1母线2异步电动机3断路器4电缆5电流互感器6电压互感器7隔离开关8接地开关9快速接地开关10双掷接地隔离开关11带电指示器12避雷器13电缆出线套筒14电缆端
|
|
||||||
QString sBindObj; //所关联的实体名 (母线block,间隔block,变压器高中低端子)
|
|
||||||
int nBindType = 0; //关联实体的类型 1母线2间隔3变压器
|
|
||||||
int nBindPara = 0; //关联额外参数,关联变压器时为(0高1中2低)
|
|
||||||
QString sBindParent; //关联父item名,关联变压器时为变压器名
|
|
||||||
QStringList sUsedRoute; //使用设备的线路名
|
|
||||||
int nUsedDirection = 0; //被占用的方向 8421 上下左右
|
|
||||||
QPoint deltaPos = QPoint(0,0); //相对坐标(相对间隔)
|
|
||||||
QUuid uid;
|
|
||||||
int nFlag = 0; //标志0未使用1新建2修改
|
|
||||||
int nRotate = 0; //旋转角
|
|
||||||
|
|
||||||
bool operator ==(const DiagramEditorComponentInfo& obj) const {
|
|
||||||
if(nCategory == obj.nCategory && sName == obj.sName && nType == obj.nType && sBindObj == obj.sBindObj && nBindType == obj.nBindType &&
|
|
||||||
sUsedRoute == obj.sUsedRoute && nUsedDirection == obj.nUsedDirection && deltaPos == obj.deltaPos && uid == obj.uid && nFlag == obj.nFlag && nRotate == obj.nRotate)
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator<<(QDataStream &out, const DiagramEditorComponentInfo &data) {
|
|
||||||
out << data.nCategory << data.sName << data.nType << data.sBindObj << data.nBindType << data.nBindPara << data.sBindParent << data.sUsedRoute << data.nUsedDirection << data.deltaPos << data.uid << data.nFlag << data.nRotate;
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
friend QDataStream &operator>>(QDataStream &in, DiagramEditorComponentInfo &data) {
|
|
||||||
in >> data.nCategory >> data.sName >> data.nType >> data.sBindObj >> data.nBindType >> data.nBindPara >> data.sBindParent >> data.sUsedRoute >> data.nUsedDirection >> data.deltaPos >> data.uid >> data.nFlag >> data.nRotate;
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
inline uint qHash(const DiagramEditorComponentInfo &key, uint seed = 0) {
|
|
||||||
return qHash(key.uid, seed);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct DiagramEditorRouteInfo //间隔中单条线路信息
|
|
||||||
{
|
|
||||||
QString sRouteName;
|
|
||||||
bool bMainRoute = false; //主线路(包含设备最多的线路,决定整体布局)
|
|
||||||
QList<DiagramEditorComponentInfo> lstCompo;
|
|
||||||
QList<DiagramEditorComponentInfo> lstOrder; //线路顺序容器(计算用)
|
|
||||||
QList<DiagramEditorComponentInfo> lstReverse; //逆序容器(计算用)
|
|
||||||
|
|
||||||
friend QDataStream &operator<<(QDataStream &out, const DiagramEditorRouteInfo &data) {
|
|
||||||
out << data.sRouteName << data.bMainRoute << data.lstCompo << data.lstOrder << data.lstReverse;
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
friend QDataStream &operator>>(QDataStream &in, DiagramEditorRouteInfo &data) {
|
|
||||||
in >> data.sRouteName >> data.bMainRoute >> data.lstCompo >> data.lstOrder >> data.lstReverse;
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct DiagramEditorBayInfo //组态编辑间隔信息
|
|
||||||
{
|
|
||||||
QString name; //间隔名
|
|
||||||
int nLayout; //布局 0纵向1横向
|
|
||||||
QList<QUuid> lstFrom; //起始
|
|
||||||
QList<QUuid> lstTo; //结束
|
|
||||||
QMap<QString,DiagramEditorRouteInfo> mapRoute; //线路信息
|
|
||||||
QMap<QString,DiagramEditorComponentInfo> mapComponent; //设备信息
|
|
||||||
|
|
||||||
friend QDataStream &operator<<(QDataStream &out, const DiagramEditorBayInfo &data) {
|
|
||||||
out << data.name << data.nLayout << data.lstFrom << data.lstTo << data.mapRoute << data.mapComponent;
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
friend QDataStream &operator>>(QDataStream &in, DiagramEditorBayInfo &data) {
|
|
||||||
in >> data.name >> data.nLayout >> data.lstFrom >> data.lstTo >> data.mapRoute >> data.mapComponent;
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct DiagramEditorTransNeutralInfo //组态编辑变压器中性点信息
|
|
||||||
{
|
|
||||||
QString name; //中性点名
|
|
||||||
int nType = 0; //中性点类型 0高1中2低
|
|
||||||
QPointF delPoint; //相对变压器偏移量
|
|
||||||
QMap<QString,DiagramEditorRouteInfo> mapRoute; //中性点对应的线路结构
|
|
||||||
|
|
||||||
friend QDataStream &operator<<(QDataStream &out, const DiagramEditorTransNeutralInfo &data) {
|
|
||||||
out << data.name << data.nType << data.delPoint << data.mapRoute;
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
friend QDataStream &operator>>(QDataStream &in, DiagramEditorTransNeutralInfo &data) {
|
|
||||||
in >> data.name >> data.nType >> data.delPoint >> data.mapRoute;
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct DiagramEditorTransInfo //组态编辑变压器信息
|
|
||||||
{
|
|
||||||
QString name; //变压器名
|
|
||||||
QMap<int,DiagramEditorTransNeutralInfo> mapNeutral; //中性点结构
|
|
||||||
QMap<QString,DiagramEditorComponentInfo> mapComponent; //设备信息
|
|
||||||
|
|
||||||
friend QDataStream &operator<<(QDataStream &out, const DiagramEditorTransInfo &data) {
|
|
||||||
out << data.name << data.mapNeutral << data.mapComponent;
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
friend QDataStream &operator>>(QDataStream &in, DiagramEditorTransInfo &data) {
|
|
||||||
in >> data.name >> data.mapNeutral >> data.mapComponent;
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class DiagramEditorStructType
|
|
||||||
{
|
|
||||||
block = 0, //模块(母线段、间隔、变压器)
|
|
||||||
blockContainer, //模块容器(包含若干模块)
|
|
||||||
rowData //行数据(包含若干容器)
|
|
||||||
};
|
|
||||||
|
|
||||||
struct DiagramEditorConnectType //组态编辑连接信息
|
|
||||||
{
|
|
||||||
QString sName;
|
|
||||||
int nType = 0; //1母线,2间隔,3变压器
|
|
||||||
|
|
||||||
friend QDataStream &operator<<(QDataStream &out, const DiagramEditorConnectType &data) {
|
|
||||||
out << data.sName << data.nType;
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
friend QDataStream &operator>>(QDataStream &in, DiagramEditorConnectType &data) {
|
|
||||||
in >> data.sName >> data.nType;
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct DiagramEditorBriefConnect //组态编辑时连接信息
|
|
||||||
{
|
|
||||||
QUuid uid;
|
|
||||||
DiagramEditorConnectType con1;
|
|
||||||
DiagramEditorConnectType con2;
|
|
||||||
int nPara = 0; //万用参数(变压器中表示连接位置,0高压侧,1中压侧,2低压侧)
|
|
||||||
|
|
||||||
bool operator==(const DiagramEditorBriefConnect& obj)
|
|
||||||
{
|
|
||||||
if(this == &obj)
|
|
||||||
return false;
|
|
||||||
if((con1.sName == obj.con1.sName && con2.sName == obj.con2.sName)||(con1.sName == obj.con2.sName && con2.sName == obj.con1.sName))
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator<<(QDataStream &out, const DiagramEditorBriefConnect &data) {
|
|
||||||
out << data.uid << data.con1 << data.con2 << data.nPara;
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
friend QDataStream &operator>>(QDataStream &in, DiagramEditorBriefConnect &data) {
|
|
||||||
in >> data.uid >> data.con1 >> data.con2 >> data.nPara;
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
DiagramEditorConnectType getOpposite(const QString& s){ //获取另一端名称
|
|
||||||
if(con1.sName == s)
|
|
||||||
return con2;
|
|
||||||
else if(con2.sName == s)
|
|
||||||
return con1;
|
|
||||||
return DiagramEditorConnectType();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct DiagramEditorBlockInfo //组态编辑block信息
|
|
||||||
{
|
|
||||||
QString sName;
|
|
||||||
QString sContainerId; //所属的容器id
|
|
||||||
int nType; //1母线,2间隔,3变压器
|
|
||||||
int nContainerLevel; //所处容器的层级 0,1,2,3
|
|
||||||
QUuid uid;
|
|
||||||
QList<QUuid> _lstCon; //连接信息
|
|
||||||
QList<QPair<int,QUuid>> _lstSub; //子对象列表(非拓扑计算使用) 如母线子对象为间隔,间隔子对象为item,电动机子对象为item <类型,uid> 类型:0设备1间隔
|
|
||||||
QRectF recSize; //当前大小(根据内容确定)
|
|
||||||
QPointF sceneDelta; //block中心相对位移(计算布局位置
|
|
||||||
bool bEditState; //详细编辑状态
|
|
||||||
|
|
||||||
//bus
|
|
||||||
float fVoltage; //母线电压
|
|
||||||
int nBusType; //0无前缀,1:Ⅰ母,2Ⅱ母
|
|
||||||
int nIndex; //第几段,1A,2B,3C,4D,5E,6F,7G,8H
|
|
||||||
//bay
|
|
||||||
BayType nBayType;
|
|
||||||
DiagramEditorBayInfo bayInfo; //间隔信息
|
|
||||||
//transformer
|
|
||||||
TransformerType nTransType;
|
|
||||||
DiagramEditorTransInfo transInfo;
|
|
||||||
|
|
||||||
friend QDataStream &operator<<(QDataStream &out, const DiagramEditorBlockInfo &data) {
|
|
||||||
out << data.sName << data.sContainerId << data.nType << data.nContainerLevel << data.uid << data._lstCon << data.recSize << data.sceneDelta
|
|
||||||
<< data.bEditState << data.fVoltage << data.nBusType << data.nIndex << data.nBayType << data.bayInfo << data.nTransType << data.transInfo;
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
friend QDataStream &operator>>(QDataStream &in, DiagramEditorBlockInfo &data) {
|
|
||||||
in >> data.sName >> data.sContainerId >> data.nType >> data.nContainerLevel >> data.uid >> data._lstCon >> data.recSize >> data.sceneDelta
|
|
||||||
>> data.bEditState >> data.fVoltage >> data.nBusType >> data.nIndex >> data.nBayType >> data.bayInfo >> data.nTransType >> data.transInfo;
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct DiagramEditorContainerInfo //组态编辑容器信息
|
|
||||||
{
|
|
||||||
QString sId;
|
|
||||||
double dMidUpY; //1母上边界
|
|
||||||
double dMidDownY; //2母下边界
|
|
||||||
double dStartX; //起始x
|
|
||||||
double dStartY; //起始y
|
|
||||||
double dWidth; //宽度
|
|
||||||
double dHeight;
|
|
||||||
double dMaxUpH; //上方最大高度(1母线到上边界)
|
|
||||||
double dMaxDownH; //下方最大高度(2母线到下边界)
|
|
||||||
QMap<int,QList<DiagramEditorBlockInfo>> mapBlockInfo;
|
|
||||||
|
|
||||||
friend QDataStream &operator<<(QDataStream &out, const DiagramEditorContainerInfo &data) {
|
|
||||||
out << data.sId << data.dMidUpY << data.dMidDownY << data.dStartX << data.dStartY << data.dWidth << data.dHeight << data.dMaxUpH << data.dMaxDownH << data.mapBlockInfo;
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
friend QDataStream &operator>>(QDataStream &in, DiagramEditorContainerInfo &data) {
|
|
||||||
in >> data.sId >> data.dMidUpY >> data.dMidDownY >> data.dStartX >> data.dStartY >> data.dWidth >> data.dHeight >> data.dMaxUpH >> data.dMaxDownH >> data.mapBlockInfo;
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct DiagramEditorProjectInfo //editor工程信息
|
|
||||||
{
|
|
||||||
QString sName;
|
|
||||||
QUuid uid;
|
|
||||||
QMap<int,DiagramEditorWizardBusInfo> mapBus;
|
|
||||||
QMap<int,QList<DiagramEditorContainerInfo>> mapSturctContainer;
|
|
||||||
QMap<QUuid,DiagramEditorBriefConnect> mapConnect;
|
|
||||||
|
|
||||||
friend QDataStream &operator<<(QDataStream &out, const DiagramEditorProjectInfo &data) {
|
|
||||||
out << data.sName << data.uid << data.mapBus << data.mapSturctContainer << data.mapConnect;
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
friend QDataStream &operator>>(QDataStream &in, DiagramEditorProjectInfo &data) {
|
|
||||||
in >> data.sName >> data.uid >> data.mapBus >> data.mapSturctContainer >> data.mapConnect;
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct DiagramContent {
|
|
||||||
QString diagramId; // 对应的PowerEntity ID
|
|
||||||
|
|
||||||
// 元素位置信息 <元素ID, 位置>
|
|
||||||
QHash<QString, QPointF> elementPositions;
|
|
||||||
QHash<QString, QList<QPointF>> connectionPaths; // 自定义路径点
|
|
||||||
};
|
|
||||||
|
|
||||||
struct BaseComponentInfo //基模图元数据
|
|
||||||
{
|
|
||||||
int id = 0;
|
|
||||||
QUuid uuid;
|
|
||||||
QString name;
|
|
||||||
QString tag;
|
|
||||||
int typeId = 0;
|
|
||||||
QJsonObject context;
|
|
||||||
QString metaMmodel;
|
|
||||||
QString projectModel;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct EditorProjectInfo //editor工程数据
|
|
||||||
{
|
|
||||||
int id = 0;
|
|
||||||
QUuid uuid;
|
|
||||||
QString name;
|
|
||||||
QString tag;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct EditorBaseSettingInfo //editor基础设置
|
|
||||||
{
|
|
||||||
int id = 0;
|
|
||||||
QUuid uuid;
|
|
||||||
QString projectName; //所属工程名
|
|
||||||
QString autor; //作者
|
|
||||||
QByteArray context; //内容
|
|
||||||
QUuid generateUid; //生成的图uuid
|
|
||||||
QString ts; //时间戳
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif // DIAGRAM_H
|
|
||||||
|
|
@ -1,413 +0,0 @@
|
||||||
#ifndef TOPOLOGY_H
|
|
||||||
#define TOPOLOGY_H
|
|
||||||
/*********拓扑相关结构********/
|
|
||||||
#include <QString>
|
|
||||||
#include <QUuid>
|
|
||||||
#include <QJsonObject>
|
|
||||||
#include <QList>
|
|
||||||
#include <QMap>
|
|
||||||
#include <QJsonArray>
|
|
||||||
|
|
||||||
// 数据状态
|
|
||||||
enum class DataState {
|
|
||||||
Unchanged = 0,
|
|
||||||
Changed,
|
|
||||||
PrepareDelete
|
|
||||||
};
|
|
||||||
|
|
||||||
// 端口位置
|
|
||||||
enum PortPos {
|
|
||||||
P_top = 0,
|
|
||||||
P_down,
|
|
||||||
P_left,
|
|
||||||
P_right
|
|
||||||
};
|
|
||||||
|
|
||||||
enum HandleType
|
|
||||||
{
|
|
||||||
T_none = 0,
|
|
||||||
T_resize, //调整大小
|
|
||||||
T_rotate, //旋转
|
|
||||||
T_editShape, //编辑形状
|
|
||||||
T_text, //文本
|
|
||||||
T_lineIn, //入线口
|
|
||||||
T_lineOut, //出线口
|
|
||||||
T_lineInOut, //双端线
|
|
||||||
T_newTral //中性点
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Connection
|
|
||||||
{
|
|
||||||
QUuid nSrcNodeId;
|
|
||||||
QUuid nSrcPortId;
|
|
||||||
HandleType srcType;
|
|
||||||
PortPos srcPos;
|
|
||||||
QUuid nDestNodeId;
|
|
||||||
QUuid nDestPortId;
|
|
||||||
HandleType destType;
|
|
||||||
PortPos destPos;
|
|
||||||
|
|
||||||
Connection()
|
|
||||||
{
|
|
||||||
srcType = T_none;
|
|
||||||
srcPos = P_top;
|
|
||||||
destType = T_none;
|
|
||||||
destPos = P_top;
|
|
||||||
nSrcNodeId = QUuid();
|
|
||||||
nSrcPortId = QUuid();
|
|
||||||
nDestNodeId = QUuid();
|
|
||||||
nDestPortId = QUuid();
|
|
||||||
}
|
|
||||||
|
|
||||||
Connection(const Connection& obj)
|
|
||||||
{
|
|
||||||
nSrcNodeId = obj.nSrcNodeId;
|
|
||||||
nSrcPortId = obj.nSrcPortId;
|
|
||||||
srcType = obj.srcType;
|
|
||||||
srcPos = obj.srcPos;
|
|
||||||
nDestNodeId = obj.nDestNodeId;
|
|
||||||
nDestPortId = obj.nDestPortId;
|
|
||||||
destType = obj.destType;
|
|
||||||
destPos = obj.destPos;
|
|
||||||
}
|
|
||||||
|
|
||||||
Connection(QUuid nSNI,QUuid nSPI,HandleType sT,PortPos sPOS,QUuid nDNI,QUuid nDPI,HandleType dT,PortPos dPOS)
|
|
||||||
{
|
|
||||||
nSrcNodeId = nSNI;
|
|
||||||
nSrcPortId = nSPI;
|
|
||||||
srcType = sT;
|
|
||||||
srcPos = sPOS;
|
|
||||||
nDestNodeId = nDNI;
|
|
||||||
nDestPortId = nDPI;
|
|
||||||
destType = dT;
|
|
||||||
destPos = dPOS;
|
|
||||||
}
|
|
||||||
bool operator==(const Connection& obj)
|
|
||||||
{
|
|
||||||
return ((nSrcNodeId == obj.nSrcNodeId)&&(nSrcPortId == obj.nSrcPortId)&&(srcType == obj.srcType)&&(nDestNodeId == obj.nDestNodeId)&&(nDestPortId == obj.nDestPortId)&&(destType == obj.destType));
|
|
||||||
}
|
|
||||||
|
|
||||||
Connection& operator=(const Connection& obj)
|
|
||||||
{
|
|
||||||
if(this == &obj)
|
|
||||||
return *this;
|
|
||||||
nSrcNodeId = obj.nSrcNodeId;
|
|
||||||
nSrcPortId = obj.nSrcPortId;
|
|
||||||
srcType = obj.srcType;
|
|
||||||
srcPos = obj.srcPos;
|
|
||||||
nDestNodeId = obj.nDestNodeId;
|
|
||||||
nDestPortId = obj.nDestPortId;
|
|
||||||
destType = obj.destType;
|
|
||||||
destPos = obj.destPos;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// 拓扑连接信息
|
|
||||||
struct TopologyInfo
|
|
||||||
{
|
|
||||||
int id = -1;
|
|
||||||
QUuid uuid_from;
|
|
||||||
QUuid uuid_to;
|
|
||||||
QJsonObject context;
|
|
||||||
int flag;
|
|
||||||
QString description;
|
|
||||||
int op;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 电网信息
|
|
||||||
struct GridInfo
|
|
||||||
{
|
|
||||||
int id = -1;
|
|
||||||
QString tagname;
|
|
||||||
QString name;
|
|
||||||
QString description;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 区域信息
|
|
||||||
struct ZoneInfo
|
|
||||||
{
|
|
||||||
int id = -1;
|
|
||||||
int grid_id = -1;
|
|
||||||
QString tagname;
|
|
||||||
QString name;
|
|
||||||
QString description;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 电站信息
|
|
||||||
struct StationInfo
|
|
||||||
{
|
|
||||||
int id = -1;
|
|
||||||
int zone_id = -1;
|
|
||||||
QString tagname;
|
|
||||||
QString name;
|
|
||||||
QString description;
|
|
||||||
bool is_local = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 间隔信息
|
|
||||||
struct BayInfo
|
|
||||||
{
|
|
||||||
QUuid uuid;
|
|
||||||
QString name;
|
|
||||||
QString tag;
|
|
||||||
QString type;
|
|
||||||
double unom;
|
|
||||||
double fla;
|
|
||||||
double capacity;
|
|
||||||
QString description;
|
|
||||||
bool inService;
|
|
||||||
int nState;
|
|
||||||
QString grid;
|
|
||||||
QString zone;
|
|
||||||
QString station;
|
|
||||||
QJsonObject business;
|
|
||||||
QJsonObject fromUuid;
|
|
||||||
QJsonObject toUuid;
|
|
||||||
QJsonObject protect;
|
|
||||||
QJsonObject faultRec;
|
|
||||||
QJsonObject status;
|
|
||||||
QJsonObject dynSense;
|
|
||||||
QJsonObject instruct;
|
|
||||||
QJsonObject etc;
|
|
||||||
QJsonObject context;
|
|
||||||
QList<QUuid> components;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 层级关系结构项
|
|
||||||
struct HierarchyStructItem {
|
|
||||||
QString sVoltageLevel;
|
|
||||||
int nCategory; //类型 0设备1间隔
|
|
||||||
int nEquipType; //设备类别
|
|
||||||
QString sName; //名称
|
|
||||||
QUuid uid; //id
|
|
||||||
QString grid; //电网
|
|
||||||
QString zone; //区域
|
|
||||||
QString station; //电站
|
|
||||||
|
|
||||||
QJsonObject toJson() const {
|
|
||||||
QJsonObject obj;
|
|
||||||
obj["sVoltageLevel"] = sVoltageLevel;
|
|
||||||
obj["nCategory"] = nCategory;
|
|
||||||
obj["nEquipType"] = nEquipType;
|
|
||||||
obj["sName"] = sName;
|
|
||||||
obj["uid"] = uid.toString();
|
|
||||||
obj["grid"] = grid;
|
|
||||||
obj["zone"] = zone;
|
|
||||||
obj["station"] = station;
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 从JSON对象解析
|
|
||||||
void fromJson(const QJsonObject& json) {
|
|
||||||
sVoltageLevel = json["sVoltageLevel"].toString();
|
|
||||||
nCategory = json["nCategory"].toInt();
|
|
||||||
nEquipType = json["nEquipType"].toInt();
|
|
||||||
sName = json["sName"].toString();
|
|
||||||
uid = QUuid::fromString(json["uid"].toString());
|
|
||||||
grid = json["grid"].toString();
|
|
||||||
zone = json["zone"].toString();
|
|
||||||
station = json["station"].toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查有效性
|
|
||||||
bool isValid() const {
|
|
||||||
return !uid.isNull() && !sName.isEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 重载相等运算符
|
|
||||||
bool operator==(const HierarchyStructItem& other) const {
|
|
||||||
return uid == other.uid &&
|
|
||||||
sName == other.sName &&
|
|
||||||
nCategory == other.nCategory;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// 层级关系项
|
|
||||||
struct HierarchyItem {
|
|
||||||
HierarchyStructItem parent;
|
|
||||||
HierarchyStructItem item;
|
|
||||||
QList<HierarchyStructItem> subList;
|
|
||||||
|
|
||||||
QJsonObject toJson() const {
|
|
||||||
QJsonObject obj;
|
|
||||||
obj["parent"] = parent.toJson();
|
|
||||||
obj["item"] = item.toJson();
|
|
||||||
|
|
||||||
// 序列化子列表
|
|
||||||
QJsonArray subArray;
|
|
||||||
for (const auto& subItem : subList) {
|
|
||||||
subArray.append(subItem.toJson());
|
|
||||||
}
|
|
||||||
obj["subList"] = subArray;
|
|
||||||
obj["subCount"] = subList.size();
|
|
||||||
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 从JSON对象解析
|
|
||||||
void fromJson(const QJsonObject& json) {
|
|
||||||
parent.fromJson(json["parent"].toObject());
|
|
||||||
item.fromJson(json["item"].toObject());
|
|
||||||
|
|
||||||
// 解析子列表
|
|
||||||
subList.clear();
|
|
||||||
QJsonArray subArray = json["subList"].toArray();
|
|
||||||
for (const QJsonValue& subValue : subArray) {
|
|
||||||
HierarchyStructItem sub;
|
|
||||||
sub.fromJson(subValue.toObject());
|
|
||||||
subList.append(sub);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查有效性
|
|
||||||
bool isValid() const {
|
|
||||||
return parent.isValid() && item.isValid();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 添加子项
|
|
||||||
void addSubItem(const HierarchyStructItem& subItem) {
|
|
||||||
subList.append(subItem);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 移除子项
|
|
||||||
bool removeSubItem(const QUuid& subUid) {
|
|
||||||
for (int i = 0; i < subList.size(); ++i) {
|
|
||||||
if (subList[i].uid == subUid) {
|
|
||||||
subList.removeAt(i);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 查找子项
|
|
||||||
HierarchyStructItem* findSubItem(const QUuid& subUid) {
|
|
||||||
for (auto& sub : subList) {
|
|
||||||
if (sub.uid == subUid) {
|
|
||||||
return ⊂
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
//属性其他参数与层级关系
|
|
||||||
struct ExtraProperty
|
|
||||||
{
|
|
||||||
int id = 0;
|
|
||||||
QString code; // 唯一编码(拼接字符串)
|
|
||||||
QString tag; // 属性tag
|
|
||||||
QString name; // 显示名称
|
|
||||||
QString connect_para; // 连接参数
|
|
||||||
|
|
||||||
// 层级名称
|
|
||||||
QString grid_name;
|
|
||||||
QString zone_name;
|
|
||||||
QString station_name;
|
|
||||||
QString currentLevel;
|
|
||||||
QString bay_name;
|
|
||||||
QString component_name;
|
|
||||||
QString group_name;
|
|
||||||
QString type_name;
|
|
||||||
|
|
||||||
//层级索引
|
|
||||||
QString grid_tag;
|
|
||||||
QString zone_tag;
|
|
||||||
QString station_tag;
|
|
||||||
QString page_tag;
|
|
||||||
QString bay_tag;
|
|
||||||
QUuid component_uuid;
|
|
||||||
QString component_tag;
|
|
||||||
QString group_tag;
|
|
||||||
QString type_tag;
|
|
||||||
|
|
||||||
// 数据源配置
|
|
||||||
QString sourceType; // "property", "measurement"
|
|
||||||
QVariantMap sourceConfig;
|
|
||||||
|
|
||||||
bool bDataChanged = false; //数据改变标志(临时)
|
|
||||||
// 获取完整路径
|
|
||||||
QString getFullName() const {
|
|
||||||
QStringList parts = {grid_name, zone_name, station_name, currentLevel, bay_name, component_name, group_name, name};
|
|
||||||
parts.removeAll("");
|
|
||||||
return parts.join(".");
|
|
||||||
}
|
|
||||||
|
|
||||||
//获取完整索引
|
|
||||||
QString getFullTag() const {
|
|
||||||
QStringList parts = {grid_tag, zone_tag, station_tag, page_tag, currentLevel, bay_tag, component_uuid.toString(), group_tag, tag};
|
|
||||||
parts.removeAll("");
|
|
||||||
return parts.join(".");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查是否匹配过滤条件
|
|
||||||
bool matches(const QVariantMap& filter,const QString& type) const {
|
|
||||||
for (auto it = filter.begin(); it != filter.end(); ++it) {
|
|
||||||
QString field = it.key();
|
|
||||||
QString filterValue = it.value().toString();
|
|
||||||
QString fieldValue;
|
|
||||||
if(type == "name"){
|
|
||||||
fieldValue = getFieldName(field);
|
|
||||||
}
|
|
||||||
else if(type == "tag"){
|
|
||||||
fieldValue = getFieldTag(field);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!filterValue.isEmpty() && fieldValue != filterValue) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString getFieldName(const QString& field) const {
|
|
||||||
if (field == "grid") return grid_name;
|
|
||||||
if (field == "zone") return zone_name;
|
|
||||||
if (field == "station") return station_name;
|
|
||||||
if (field == "currentLevel") return currentLevel;
|
|
||||||
if (field == "bay") return bay_name;
|
|
||||||
if (field == "component") return component_name;
|
|
||||||
if (field == "group") return group_name;
|
|
||||||
if (field == "property") return name;
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
QString getFieldTag(const QString& field) const {
|
|
||||||
if (field == "grid") return grid_tag;
|
|
||||||
if (field == "zone") return zone_tag;
|
|
||||||
if (field == "station") return station_tag;
|
|
||||||
if (field == "page") return page_tag;
|
|
||||||
if (field == "currentLevel") return currentLevel;
|
|
||||||
if (field == "bay") return bay_tag;
|
|
||||||
if (field == "component") return component_name;
|
|
||||||
if (field == "group") return component_uuid.toString();
|
|
||||||
if (field == "tag") return name;
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ExtraPropertyLevelInfo { //层级关系item信息
|
|
||||||
QString displayText; // 显示文本
|
|
||||||
QString nameValue; // 名称值
|
|
||||||
QString tagValue; // 标签值
|
|
||||||
bool isRequired; // 是否必填
|
|
||||||
QString placeholder; // 缺省占位符
|
|
||||||
};
|
|
||||||
|
|
||||||
// 基础实体类型
|
|
||||||
enum class EntityType {
|
|
||||||
Grid,
|
|
||||||
Zone,
|
|
||||||
Station,
|
|
||||||
ConfigurationDiagram,
|
|
||||||
Component
|
|
||||||
};
|
|
||||||
|
|
||||||
struct EntityInfo {
|
|
||||||
QString sName;
|
|
||||||
QString sUuid;
|
|
||||||
QString sParentId;
|
|
||||||
EntityType eType;
|
|
||||||
};
|
|
||||||
#endif // TOPOLOGY_H
|
|
||||||
|
|
@ -1,172 +0,0 @@
|
||||||
#ifndef TYPES_H
|
|
||||||
#define TYPES_H
|
|
||||||
/*********枚举类型********/
|
|
||||||
#include <QGraphicsItem>
|
|
||||||
#include <QObject>
|
|
||||||
#include <QMetaType>
|
|
||||||
|
|
||||||
// 图形项类型
|
|
||||||
enum GraphicsItemType
|
|
||||||
{
|
|
||||||
GIT_base = QGraphicsItem::UserType + 1,
|
|
||||||
GIT_line = QGraphicsItem::UserType + 2,
|
|
||||||
GIT_rect = QGraphicsItem::UserType + 3,
|
|
||||||
GIT_roundRect = QGraphicsItem::UserType + 4,
|
|
||||||
GIT_ellipse = QGraphicsItem::UserType + 5,
|
|
||||||
GIT_polygon = QGraphicsItem::UserType + 6,
|
|
||||||
//======================================
|
|
||||||
GIT_bus = QGraphicsItem::UserType + 50,
|
|
||||||
GIT_itemRect = QGraphicsItem::UserType + 51,
|
|
||||||
GIT_itemTri = QGraphicsItem::UserType + 52,
|
|
||||||
GIT_link= QGraphicsItem::UserType + 53,
|
|
||||||
GIT_ctItem= QGraphicsItem::UserType + 54,
|
|
||||||
GIT_ctGroup= QGraphicsItem::UserType + 55,
|
|
||||||
GIT_ptItem= QGraphicsItem::UserType + 56,
|
|
||||||
GIT_ptGroup= QGraphicsItem::UserType + 57,
|
|
||||||
GIT_ES= QGraphicsItem::UserType + 58,
|
|
||||||
GIT_DS= QGraphicsItem::UserType + 59,
|
|
||||||
GIT_FES= QGraphicsItem::UserType + 60,
|
|
||||||
GIT_DTEDS= QGraphicsItem::UserType + 61,
|
|
||||||
GIT_PI= QGraphicsItem::UserType + 62,
|
|
||||||
GIT_LA= QGraphicsItem::UserType + 63,
|
|
||||||
GIT_cableTer= QGraphicsItem::UserType + 64,
|
|
||||||
GIT_cableEnd= QGraphicsItem::UserType + 65,
|
|
||||||
GIT_2wTransformer= QGraphicsItem::UserType + 66,
|
|
||||||
GIT_3wTransformer= QGraphicsItem::UserType + 67,
|
|
||||||
GIT_node= QGraphicsItem::UserType + 79,
|
|
||||||
GIT_bay= QGraphicsItem::UserType + 80, //间隔
|
|
||||||
//======================================
|
|
||||||
GIT_baseNode = QGraphicsItem::UserType + 199,
|
|
||||||
GIT_baseBus = QGraphicsItem::UserType + 200,
|
|
||||||
GIT_baseLine = QGraphicsItem::UserType + 201,
|
|
||||||
GIT_baseBreaker = QGraphicsItem::UserType + 202,
|
|
||||||
GIT_baseCT = QGraphicsItem::UserType + 203,
|
|
||||||
GIT_basePT = QGraphicsItem::UserType + 204,
|
|
||||||
GIT_baseDS = QGraphicsItem::UserType + 205, //隔离开关
|
|
||||||
GIT_baseES = QGraphicsItem::UserType + 206, //接地开关
|
|
||||||
GIT_baseFES = QGraphicsItem::UserType + 207, //快速接地
|
|
||||||
GIT_baseDTEDS = QGraphicsItem::UserType + 208, //双掷接地隔离开关
|
|
||||||
GIT_basePI = QGraphicsItem::UserType + 209, //带电指示器
|
|
||||||
GIT_baseLightningArrester = QGraphicsItem::UserType + 210, //避雷器
|
|
||||||
GIT_baseCableTer = QGraphicsItem::UserType + 211, //电缆出线套筒
|
|
||||||
GIT_baseCableEnd = QGraphicsItem::UserType + 212,
|
|
||||||
GIT_base2wTransformer = QGraphicsItem::UserType + 213, //两绕阻变压器
|
|
||||||
GIT_base3wTransformer = QGraphicsItem::UserType + 214, //三绕组变压器
|
|
||||||
};
|
|
||||||
|
|
||||||
enum AttributeField //元模属性字段对照
|
|
||||||
{
|
|
||||||
Id = Qt::UserRole + 1,
|
|
||||||
Attribute = Qt::UserRole + 2,
|
|
||||||
AttributeName = Qt::UserRole + 3,
|
|
||||||
DataType = Qt::UserRole + 4,
|
|
||||||
LengthPrecision = Qt::UserRole + 5,
|
|
||||||
Scale = Qt::UserRole + 6,
|
|
||||||
IsNotNull = Qt::UserRole + 7,
|
|
||||||
DefaultValue = Qt::UserRole + 8,
|
|
||||||
ValueRange = Qt::UserRole + 9,
|
|
||||||
IsVisible = Qt::UserRole + 10
|
|
||||||
};
|
|
||||||
|
|
||||||
// 抽象项类型
|
|
||||||
enum AbstractItemType {
|
|
||||||
AIT_motor = 1,
|
|
||||||
AIT_bus
|
|
||||||
};
|
|
||||||
|
|
||||||
// 模型功能类型
|
|
||||||
enum class ModelFunctionType {
|
|
||||||
ProjectModel = 0,
|
|
||||||
BaseModel,
|
|
||||||
EditorModel,
|
|
||||||
BlockEditorModel,
|
|
||||||
RuntimeModel
|
|
||||||
};
|
|
||||||
|
|
||||||
// 组态图模式
|
|
||||||
enum DiagramMode {
|
|
||||||
DM_edit = 0,
|
|
||||||
DM_run,
|
|
||||||
DM_academic,
|
|
||||||
DM_baseModel
|
|
||||||
};
|
|
||||||
|
|
||||||
//端口类型
|
|
||||||
enum PortState
|
|
||||||
{
|
|
||||||
P_const = 0, //固定端口
|
|
||||||
p_movable, //移动端口
|
|
||||||
};
|
|
||||||
|
|
||||||
// 项目状态
|
|
||||||
enum ProjectState {
|
|
||||||
Error = -1, // 错误
|
|
||||||
NotExist = 0, // 不存在
|
|
||||||
Exist, // 已存在
|
|
||||||
Changed // 已改变
|
|
||||||
};
|
|
||||||
|
|
||||||
// 表单项状态
|
|
||||||
enum TableItemState {
|
|
||||||
TS_Create = 1, // 创建
|
|
||||||
TS_Select = 2, // 选择
|
|
||||||
TS_Edit = 4 // 编辑
|
|
||||||
};
|
|
||||||
|
|
||||||
// 警告提示信息
|
|
||||||
enum class AlertInfo {
|
|
||||||
Success = 1, // 成功
|
|
||||||
Fail = 2, // 失败
|
|
||||||
Exist = 4 // 已存在
|
|
||||||
};
|
|
||||||
|
|
||||||
// 选择对话框类型
|
|
||||||
enum SelectorDialogType {
|
|
||||||
ST_MetaModel = 0, // 元模对话框
|
|
||||||
ST_ComponentType // 元件选择
|
|
||||||
};
|
|
||||||
|
|
||||||
// 表格代理内容
|
|
||||||
enum TableDelegateContent {
|
|
||||||
TD_ProjectModel = 0, // 工程模
|
|
||||||
TD_MetaModel, // 基模
|
|
||||||
TD_ComponentType // 元件类型
|
|
||||||
};
|
|
||||||
|
|
||||||
// 变种图标
|
|
||||||
enum VariantIcon {
|
|
||||||
VI_Thumbnail = 0, // 缩略图
|
|
||||||
VI_Normal_1, // 常规1
|
|
||||||
VI_Normal_2, // 常规2
|
|
||||||
VI_Normal_3, // 常规3
|
|
||||||
VI_Normal_4, // 常规4
|
|
||||||
VI_Normal_5 // 常规5
|
|
||||||
};
|
|
||||||
|
|
||||||
// 组件类型枚举
|
|
||||||
enum class ComponentCategory {
|
|
||||||
ElectricalEquipment = 0, // 电气设备
|
|
||||||
ConnectionRelation = 1 // 连接关系
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class ComponentType {
|
|
||||||
Bus = 1, // 母线
|
|
||||||
AsynchronousMotor = 2, // 异步电动机
|
|
||||||
CircuitBreaker = 3, // 断路器
|
|
||||||
Cable = 4, // 电缆
|
|
||||||
CurrentTransformer = 5, // 电流互感器
|
|
||||||
VoltageTransformer = 6, // 电压互感器
|
|
||||||
Disconnector = 7, // 隔离开关
|
|
||||||
EarthingSwitch = 8, // 接地开关
|
|
||||||
FastEarthingSwitch = 9, // 快速接地开关
|
|
||||||
DoubleThrowEarthingSwitch = 10, // 双掷接地隔离开关
|
|
||||||
VoltageIndicator = 11, // 带电指示器
|
|
||||||
LightningArrester = 12, // 避雷器
|
|
||||||
CableTerminal = 13, // 电缆出线套筒
|
|
||||||
CableEnd = 14 // 电缆端
|
|
||||||
};
|
|
||||||
|
|
||||||
extern const QMap<AbstractItemType,GraphicsItemType> linkType;
|
|
||||||
//类型转换
|
|
||||||
extern const QMap<int,GraphicsItemType> typeToProGraphic;
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
||||||
#ifndef GRAPHICS_ITEMS_H
|
|
||||||
#define GRAPHICS_ITEMS_H
|
|
||||||
/*********图元********/
|
|
||||||
#include <QGraphicsItem>
|
|
||||||
|
|
||||||
// 句柄标签
|
|
||||||
enum HandleTag {
|
|
||||||
H_none = 0,
|
|
||||||
H_leftTop,
|
|
||||||
H_top,
|
|
||||||
H_rightTop,
|
|
||||||
H_right,
|
|
||||||
H_rightBottom,
|
|
||||||
H_bottom,
|
|
||||||
H_leftBottom,
|
|
||||||
H_left,
|
|
||||||
H_rotate_leftTop,
|
|
||||||
H_rotate_rightTop,
|
|
||||||
H_rotate_rightBottom,
|
|
||||||
H_rotate_leftBottom,
|
|
||||||
H_edit,
|
|
||||||
H_textCaption = 40, // 标题文本
|
|
||||||
H_textCurrent, // 电流
|
|
||||||
H_textVoltage, // 电压
|
|
||||||
H_connect = 50 // 连接操作点
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,236 +0,0 @@
|
||||||
#ifndef MONITOR_ITEM_H
|
|
||||||
#define MONITOR_ITEM_H
|
|
||||||
/*********人机界面********/
|
|
||||||
#include <QString>
|
|
||||||
#include <QMap>
|
|
||||||
#include <QJsonObject>
|
|
||||||
|
|
||||||
enum class MonitorItemState { //监控item的状态
|
|
||||||
Normal = 0, //正常
|
|
||||||
Closing, //合闸
|
|
||||||
Opening, //分闸
|
|
||||||
AccidentTrip, //事故跳闸
|
|
||||||
StatusFault, //状态故障
|
|
||||||
Energized, //带电
|
|
||||||
DeEnergized, //失电
|
|
||||||
Grounding, //接地
|
|
||||||
Running, //运行
|
|
||||||
ShutDown, //停运
|
|
||||||
Alarm, //告警
|
|
||||||
LineBreak, //断线
|
|
||||||
MeasureMentOutLimit //量测越限
|
|
||||||
};
|
|
||||||
|
|
||||||
struct MonitorItemAttributeInfo //单个监控item属性
|
|
||||||
{
|
|
||||||
QString sGroup; //所属组别
|
|
||||||
QString sTag; //索引名
|
|
||||||
QString sName; //显示名
|
|
||||||
int nConnectType = 0; //关联数据类别 0字段 1量测
|
|
||||||
QString sConnectPara; //查询参数(参数服务使用)
|
|
||||||
int nShowType = 0; //显示类别 0字符 1图表
|
|
||||||
bool bShowDiagram = false; //显示到组态中
|
|
||||||
int nGraphType = 0; //图表类型 0折线1柱状
|
|
||||||
QString sTimeRange; //时间范围(分)
|
|
||||||
QMap<quint64,double> mapValue; //属性值
|
|
||||||
bool bSelected = false;
|
|
||||||
|
|
||||||
// 转换为JSON对象
|
|
||||||
QJsonObject toJson() const {
|
|
||||||
QJsonObject obj;
|
|
||||||
obj["sGroup"] = sGroup;
|
|
||||||
obj["sTag"] = sTag;
|
|
||||||
obj["sName"] = sName;
|
|
||||||
obj["nConnectType"] = nConnectType;
|
|
||||||
obj["sConnectPara"] = sConnectPara;
|
|
||||||
obj["nShowType"] = nShowType;
|
|
||||||
obj["bShowDiagram"] = bShowDiagram;
|
|
||||||
obj["nGraphType"] = nGraphType;
|
|
||||||
obj["sTimeRange"] = sTimeRange;
|
|
||||||
obj["sValue"] = mapToJson(mapValue);
|
|
||||||
obj["bSelected"] = bSelected;
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 从JSON对象解析
|
|
||||||
void fromJson(const QJsonObject& json) {
|
|
||||||
sGroup = json["sGroup"].toString();
|
|
||||||
sTag = json["sTag"].toString();
|
|
||||||
sName = json["sName"].toString();
|
|
||||||
nConnectType = json["nConnectType"].toInt();
|
|
||||||
sConnectPara = json["sConnectPara"].toString();
|
|
||||||
nShowType = json["nShowType"].toInt();
|
|
||||||
bShowDiagram = json["bShowDiagram"].toBool();
|
|
||||||
nGraphType = json["nGraphType"].toInt();
|
|
||||||
sTimeRange = json["sTimeRange"].toString();
|
|
||||||
mapValue = jsonToMap(json["sValue"].toObject());
|
|
||||||
bSelected = json["bSelected"].toBool();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查有效性
|
|
||||||
bool isValid() const {
|
|
||||||
return !sTag.isEmpty() && !sName.isEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 重载相等运算符
|
|
||||||
bool operator==(const MonitorItemAttributeInfo& other) const {
|
|
||||||
return sTag == other.sTag &&
|
|
||||||
sName == other.sName &&
|
|
||||||
sGroup == other.sGroup;
|
|
||||||
}
|
|
||||||
|
|
||||||
QJsonObject mapToJson(const QMap<quint64, double>& map) const{
|
|
||||||
QJsonObject jsonObj;
|
|
||||||
|
|
||||||
for (auto it = map.constBegin(); it != map.constEnd(); ++it) {
|
|
||||||
// 将quint64的key转换为QString
|
|
||||||
QString key = QString::number(it.key());
|
|
||||||
jsonObj[key] = it.value();
|
|
||||||
}
|
|
||||||
|
|
||||||
return jsonObj;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 从JSON转换回来
|
|
||||||
QMap<quint64, double> jsonToMap(const QJsonObject& jsonObj) const{
|
|
||||||
QMap<quint64, double> map;
|
|
||||||
|
|
||||||
for (auto it = jsonObj.constBegin(); it != jsonObj.constEnd(); ++it) {
|
|
||||||
bool ok;
|
|
||||||
quint64 key = it.key().toULongLong(&ok);
|
|
||||||
if (ok) {
|
|
||||||
double value = it.value().toDouble();
|
|
||||||
map[key] = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct MonitorItemTypeStruct //监控设备类型
|
|
||||||
{
|
|
||||||
QString sTag;
|
|
||||||
QString sName;
|
|
||||||
|
|
||||||
bool isValid() const {
|
|
||||||
return !sTag.isEmpty() && !sName.isEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator==(const MonitorItemTypeStruct& other) const {
|
|
||||||
return sTag == other.sTag && sName == other.sName;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator<(const MonitorItemTypeStruct& other) const {
|
|
||||||
return sTag < other.sTag || (sTag == other.sTag && sName < other.sName);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 转换为JSON对象 - 成员函数
|
|
||||||
QJsonObject toJson() const {
|
|
||||||
QJsonObject obj;
|
|
||||||
obj["sTag"] = sTag;
|
|
||||||
obj["sName"] = sName;
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 从JSON对象解析 - 成员函数
|
|
||||||
void fromJson(const QJsonObject& json) {
|
|
||||||
sTag = json["sTag"].toString();
|
|
||||||
sName = json["sName"].toString();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct MonitorItemStateStruct //监控设备状态
|
|
||||||
{
|
|
||||||
QString sState;
|
|
||||||
MonitorItemState eState;
|
|
||||||
|
|
||||||
bool isValid() const {
|
|
||||||
return !sState.isEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator==(const MonitorItemStateStruct& other) const {
|
|
||||||
return sState == other.sState && eState == other.eState;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator<(const MonitorItemStateStruct& other) const {
|
|
||||||
return sState < other.sState || (sState == other.sState && eState < other.eState);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 转换为JSON对象 - 成员函数
|
|
||||||
QJsonObject toJson() const {
|
|
||||||
QJsonObject obj;
|
|
||||||
obj["sState"] = sState;
|
|
||||||
obj["eState"] = static_cast<int>(eState);
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 从JSON对象解析 - 成员函数
|
|
||||||
void fromJson(const QJsonObject& json) {
|
|
||||||
sState = json["sState"].toString();
|
|
||||||
eState = static_cast<MonitorItemState>(json["eState"].toInt());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ModelTypeInfo{ //类型临时信息
|
|
||||||
int nType;
|
|
||||||
QString sType;
|
|
||||||
QString sName;
|
|
||||||
QString sMeta; //该类型元模名
|
|
||||||
QString sModel; //该类型工程模名
|
|
||||||
};
|
|
||||||
|
|
||||||
struct MonitorPageInfo //运行时page
|
|
||||||
{
|
|
||||||
int id = -1;
|
|
||||||
QUuid uid;
|
|
||||||
QString tag;
|
|
||||||
QString name;
|
|
||||||
QString parent;
|
|
||||||
QJsonObject context;
|
|
||||||
QString ts;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct MonitorItemDisplayInfo //监控模式显示信息
|
|
||||||
{
|
|
||||||
int nItemType; //设备类型
|
|
||||||
QString sStateName; //状态名
|
|
||||||
bool bEnable = false;
|
|
||||||
QString sColor;
|
|
||||||
QByteArray bytPicture; //存储二进制数据
|
|
||||||
int nWidth;
|
|
||||||
int nHeight;
|
|
||||||
QString sMeta; //元模型名
|
|
||||||
QString sModel; //工程模名
|
|
||||||
|
|
||||||
QJsonObject toJson() const {
|
|
||||||
QJsonObject obj;
|
|
||||||
obj["nItemType"] = nItemType;
|
|
||||||
obj["sStateName"] = sStateName;
|
|
||||||
obj["bEnable"] = bEnable;
|
|
||||||
obj["sColor"] = sColor;
|
|
||||||
obj["bytPicture"] = QString(bytPicture.toBase64());
|
|
||||||
obj["nWidth"] = nWidth;
|
|
||||||
obj["nHeight"] = nHeight;
|
|
||||||
obj["sMeta"] = sMeta;
|
|
||||||
obj["sModel"] = sModel;
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 从JSON对象解析 - 成员函数
|
|
||||||
void fromJson(const QJsonObject& json) {
|
|
||||||
nItemType = json["nItemType"].toInt();
|
|
||||||
sStateName = json["sStateName"].toString();
|
|
||||||
bEnable = json["bEnable"].toBool();
|
|
||||||
sColor = json["sColor"].toString();
|
|
||||||
|
|
||||||
QString pictureBase64 = json["bytPicture"].toString();
|
|
||||||
bytPicture = QByteArray::fromBase64(pictureBase64.toUtf8());
|
|
||||||
|
|
||||||
nWidth = json["nWidth"].toInt();
|
|
||||||
nHeight = json["nHeight"].toInt();
|
|
||||||
sMeta = json["sMeta"].toString();
|
|
||||||
sModel = json["sModel"].toString();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
@ -3,9 +3,7 @@
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
//#include "global.h"
|
#include "global.h"
|
||||||
#include "common/backend/project_model.h"
|
|
||||||
#include "common/core_model/topology.h"
|
|
||||||
|
|
||||||
class AbstractProperty:public QObject //抽象属性类
|
class AbstractProperty:public QObject //抽象属性类
|
||||||
{
|
{
|
||||||
|
|
@ -219,6 +217,6 @@ public:
|
||||||
VariableProperty(QObject* parent = nullptr);
|
VariableProperty(QObject* parent = nullptr);
|
||||||
~VariableProperty();
|
~VariableProperty();
|
||||||
|
|
||||||
ModelDataInfo& getPropertyValue() const;
|
modelDataInfo& getPropertyValue() const;
|
||||||
};
|
};
|
||||||
#endif // DATABASE_H
|
#endif // DATABASE_H
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -90,7 +90,7 @@ VariableProperty::~VariableProperty()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ModelDataInfo& VariableProperty::getPropertyValue() const
|
modelDataInfo& VariableProperty::getPropertyValue() const
|
||||||
{
|
{
|
||||||
return DataManager::instance().modelData()[sModelName];
|
return DataManager::instance().modelData()[sModelName];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#include "types.h"
|
#include "global.h"
|
||||||
|
|
||||||
const QMap<AbstractItemType,GraphicsItemType> linkType = {
|
const QMap<AbstractItemType,GraphicsItemType> linkType = {
|
||||||
{AIT_motor,GIT_itemRect},{AIT_bus,GIT_bus},
|
{AIT_motor,GIT_itemRect},{AIT_bus,GIT_bus},
|
||||||
|
|
@ -43,6 +43,7 @@ set(DIAGRAMCAVAS_HEADER_FILES
|
||||||
include/diagramConnectSetting.h
|
include/diagramConnectSetting.h
|
||||||
include/structDataPreviewDlg.h
|
include/structDataPreviewDlg.h
|
||||||
include/titleBar.h
|
include/titleBar.h
|
||||||
|
include/structDataSource.h
|
||||||
include/structDataMeasurementModel.h
|
include/structDataMeasurementModel.h
|
||||||
include/structDataPropertyModel.h
|
include/structDataPropertyModel.h
|
||||||
include/structDataMeasurementDelegate.h
|
include/structDataMeasurementDelegate.h
|
||||||
|
|
@ -50,9 +51,6 @@ set(DIAGRAMCAVAS_HEADER_FILES
|
||||||
include/structDataCauseEditDlg.h
|
include/structDataCauseEditDlg.h
|
||||||
include/structDataActionParaDlg.h
|
include/structDataActionParaDlg.h
|
||||||
include/bayMeasureDlg.h
|
include/bayMeasureDlg.h
|
||||||
include/basePropertyProxy.h
|
|
||||||
include/basePannelPropertyProxy.h
|
|
||||||
include/dataSourceDlg.h
|
|
||||||
include/diagramEditor/editPanel.h
|
include/diagramEditor/editPanel.h
|
||||||
include/diagramEditor/editView.h
|
include/diagramEditor/editView.h
|
||||||
include/diagramEditor/editScene.h
|
include/diagramEditor/editScene.h
|
||||||
|
|
@ -126,31 +124,18 @@ set(DIAGRAMCAVAS_HEADER_FILES
|
||||||
include/util/selectorManager.h
|
include/util/selectorManager.h
|
||||||
include/util/subMovingSelector.h
|
include/util/subMovingSelector.h
|
||||||
include/instance/dataAccessor.h
|
include/instance/dataAccessor.h
|
||||||
|
include/instance/extraPropertyManager.h
|
||||||
|
|
||||||
include/propertyType/CustomGadget.h
|
include/propertyType/CustomGadget.h
|
||||||
include/propertyType/CustomType.h
|
include/propertyType/CustomType.h
|
||||||
include/propertyType/dataSourceType.h
|
|
||||||
include/propertyType/PropertyTypeCustomization_CustomType.h
|
include/propertyType/PropertyTypeCustomization_CustomType.h
|
||||||
include/propertyType/propertyTypeCustomization_DataSourceType.h
|
|
||||||
include/propertyType/pannelColorGadget.h
|
|
||||||
../common/include/httpInterface.h
|
../common/include/httpInterface.h
|
||||||
../common/include/tools.h
|
../common/include/tools.h
|
||||||
#../common/include/global.h
|
../common/include/global.h
|
||||||
../common/include/baseProperty.h
|
../common/include/baseProperty.h
|
||||||
../common/include/compiler.hpp
|
../common/include/compiler.hpp
|
||||||
../common/include/export.hpp
|
../common/include/export.hpp
|
||||||
../common/include/operatingSystem.hpp
|
../common/include/operatingSystem.hpp
|
||||||
../common/include/structDataSource.h
|
|
||||||
../common/include/extraPropertyManager.h
|
|
||||||
|
|
||||||
../common/core_model/types.h
|
|
||||||
../common/core_model/diagram.h
|
|
||||||
../common/core_model/topology.h
|
|
||||||
../common/core_model/data_transmission.h
|
|
||||||
../common/core_model/constants.h
|
|
||||||
../common/frontend/monitor_item.h
|
|
||||||
../common/backend/project_model.h
|
|
||||||
../common/frontend/graphics_items.h
|
|
||||||
)
|
)
|
||||||
|
|
||||||
set(DIAGRAMCAVAS_SOURCE_FILES
|
set(DIAGRAMCAVAS_SOURCE_FILES
|
||||||
|
|
@ -195,6 +180,7 @@ set(DIAGRAMCAVAS_SOURCE_FILES
|
||||||
source/diagramConnectSetting.cpp
|
source/diagramConnectSetting.cpp
|
||||||
source/structDataPreviewDlg.cpp
|
source/structDataPreviewDlg.cpp
|
||||||
source/titleBar.cpp
|
source/titleBar.cpp
|
||||||
|
source/structDataSource.cpp
|
||||||
source/structDataMeasurementModel.cpp
|
source/structDataMeasurementModel.cpp
|
||||||
source/structDataPropertyModel.cpp
|
source/structDataPropertyModel.cpp
|
||||||
source/structDataMeasurementDelegate.cpp
|
source/structDataMeasurementDelegate.cpp
|
||||||
|
|
@ -202,9 +188,6 @@ set(DIAGRAMCAVAS_SOURCE_FILES
|
||||||
source/structDataCauseEditDlg.cpp
|
source/structDataCauseEditDlg.cpp
|
||||||
source/structDataActionParaDlg.cpp
|
source/structDataActionParaDlg.cpp
|
||||||
source/bayMeasureDlg.cpp
|
source/bayMeasureDlg.cpp
|
||||||
source/basePropertyProxy.cpp
|
|
||||||
source/basePannelPropertyProxy.cpp
|
|
||||||
source/dataSourceDlg.cpp
|
|
||||||
source/diagramEditor/editPanel.cpp
|
source/diagramEditor/editPanel.cpp
|
||||||
source/diagramEditor/editView.cpp
|
source/diagramEditor/editView.cpp
|
||||||
source/diagramEditor/editScene.cpp
|
source/diagramEditor/editScene.cpp
|
||||||
|
|
@ -278,18 +261,13 @@ set(DIAGRAMCAVAS_SOURCE_FILES
|
||||||
source/util/selectorManager.cpp
|
source/util/selectorManager.cpp
|
||||||
source/util/subMovingSelector.cpp
|
source/util/subMovingSelector.cpp
|
||||||
source/instance/dataAccessor.cpp
|
source/instance/dataAccessor.cpp
|
||||||
|
source/instance/extraPropertyManager.cpp
|
||||||
|
|
||||||
source/propertyType/PropertyTypeCustomization_CustomType.cpp
|
source/propertyType/PropertyTypeCustomization_CustomType.cpp
|
||||||
source/propertyType/propertyTypeCustomization_DataSourceType.cpp
|
|
||||||
source/propertyType/pannelColorGadget.cpp
|
|
||||||
../common/source/httpInterface.cpp
|
../common/source/httpInterface.cpp
|
||||||
../common/source/baseProperty.cpp
|
../common/source/baseProperty.cpp
|
||||||
../common/source/tools.cpp
|
../common/source/tools.cpp
|
||||||
#../common/source/global.cpp
|
../common/source/global.cpp
|
||||||
../common/source/structDataSource.cpp
|
|
||||||
../common/source/extraPropertyManager.cpp
|
|
||||||
|
|
||||||
../common/core_model/types.cpp
|
|
||||||
)
|
)
|
||||||
|
|
||||||
set(UI_FILES
|
set(UI_FILES
|
||||||
|
|
@ -320,7 +298,6 @@ set(UI_FILES
|
||||||
ui/diagramConnectSetting.ui
|
ui/diagramConnectSetting.ui
|
||||||
ui/structDataPreviewDlg.ui
|
ui/structDataPreviewDlg.ui
|
||||||
ui/bayMeasureDlg.ui
|
ui/bayMeasureDlg.ui
|
||||||
ui/dataSourceDlg.ui
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
|
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,7 @@
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QFormLayout>
|
#include <QFormLayout>
|
||||||
//#include "global.h"
|
#include "global.h"
|
||||||
#include "common/backend/project_model.h"
|
|
||||||
/*******************************************************
|
/*******************************************************
|
||||||
属性组界面基类
|
属性组界面基类
|
||||||
********************************************************/
|
********************************************************/
|
||||||
|
|
@ -20,19 +19,19 @@ class BaseContentDlg : public QDialog
|
||||||
public:
|
public:
|
||||||
BaseContentDlg(QWidget *parent = nullptr);
|
BaseContentDlg(QWidget *parent = nullptr);
|
||||||
virtual ~BaseContentDlg();
|
virtual ~BaseContentDlg();
|
||||||
virtual void createGroupView(GroupStateInfo) = 0; //创建页面
|
virtual void createGroupView(groupStateInfo) = 0; //创建页面
|
||||||
virtual QMap<QString,PropertyStateInfo> getPropertyValue(BaseProperty* = nullptr) = 0; //返回当前页面的属性值
|
virtual QMap<QString,propertyStateInfo> getPropertyValue(BaseProperty* = nullptr) = 0; //返回当前页面的属性值
|
||||||
//void setPropertyValue(QMap<QString,propertyStateInfo>);
|
//void setPropertyValue(QMap<QString,propertyStateInfo>);
|
||||||
//void setPropertyValue(BaseProperty*);
|
//void setPropertyValue(BaseProperty*);
|
||||||
virtual void setPropertyValue(QVariant) = 0;
|
virtual void setPropertyValue(QVariant) = 0;
|
||||||
void setModelController(FixedPortsModel* p){_curModelController = p;}
|
void setModelController(FixedPortsModel* p){_curModelController = p;}
|
||||||
auto getModelController() {return _curModelController;}
|
auto getModelController() {return _curModelController;}
|
||||||
void setExtendProperty(PropertyStateInfo info) {_extendInfo = info;} //设置跨组别使用的公共变量(ct,pt使用extend绕组信息)
|
void setExtendProperty(propertyStateInfo info) {_extendInfo = info;} //设置跨组别使用的公共变量(ct,pt使用extend绕组信息)
|
||||||
protected:
|
protected:
|
||||||
QMap<QString,PropertyContentInfo> _mapPro;
|
QMap<QString,propertyContentInfo> _mapPro;
|
||||||
QFormLayout* createFormLayout(QWidget* parent);
|
QFormLayout* createFormLayout(QWidget* parent);
|
||||||
FixedPortsModel* _curModelController;
|
FixedPortsModel* _curModelController;
|
||||||
PropertyStateInfo _extendInfo;
|
propertyStateInfo _extendInfo;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QSplitter>
|
#include <QSplitter>
|
||||||
//#include "global.h"
|
#include "global.h"
|
||||||
#include "designerScene.h"
|
#include "designerScene.h"
|
||||||
|
|
||||||
class DesignerView;
|
class DesignerView;
|
||||||
|
|
@ -17,11 +17,11 @@ class StatusBar;
|
||||||
class PowerEntity;
|
class PowerEntity;
|
||||||
class ProjectDiagramNameInput;
|
class ProjectDiagramNameInput;
|
||||||
class BayManagerDlg;
|
class BayManagerDlg;
|
||||||
class BasePannelPropertyProxy;
|
|
||||||
|
|
||||||
class BaseDrawingPanel : public QWidget
|
class BaseDrawingPanel : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BaseDrawingPanel(PowerEntity* pEntity,QWidget *parent = nullptr,DiagramMode mode = DM_edit);
|
BaseDrawingPanel(PowerEntity* pEntity,QWidget *parent = nullptr,DiagramMode mode = DM_edit);
|
||||||
~BaseDrawingPanel();
|
~BaseDrawingPanel();
|
||||||
|
|
@ -50,13 +50,10 @@ public:
|
||||||
QString getGenerateByPanel() {return _sGenerateByPanel;}
|
QString getGenerateByPanel() {return _sGenerateByPanel;}
|
||||||
|
|
||||||
PowerEntity* getEntity() {return _pEntity;}
|
PowerEntity* getEntity() {return _pEntity;}
|
||||||
BasePannelPropertyProxy* getPropertyProxy();
|
|
||||||
signals:
|
signals:
|
||||||
void panelDelete(const QString&,int);
|
void panelDelete(const QString&,int);
|
||||||
protected:
|
protected:
|
||||||
virtual void closeEvent(QCloseEvent *closeEvent) {};
|
virtual void closeEvent(QCloseEvent *closeEvent) {};
|
||||||
protected:
|
|
||||||
QPointer<BasePannelPropertyProxy> _pPropertyProxy; //属性页代理
|
|
||||||
protected:
|
protected:
|
||||||
DesignerView* m_pGraphicsView;
|
DesignerView* m_pGraphicsView;
|
||||||
DesignerScene* m_pGraphicsScene;
|
DesignerScene* m_pGraphicsScene;
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,8 @@ public:
|
||||||
|
|
||||||
void initial();
|
void initial();
|
||||||
|
|
||||||
virtual void createGroupView(GroupStateInfo);
|
virtual void createGroupView(groupStateInfo);
|
||||||
virtual QMap<QString,PropertyStateInfo> getPropertyValue(BaseProperty* = nullptr);
|
virtual QMap<QString,propertyStateInfo> getPropertyValue(BaseProperty* = nullptr);
|
||||||
virtual void setPropertyValue(QVariant);
|
virtual void setPropertyValue(QVariant);
|
||||||
void setParentDlg(ItemPropertyDlg* p) {_parentDlg = p;}
|
void setParentDlg(ItemPropertyDlg* p) {_parentDlg = p;}
|
||||||
public slots:
|
public slots:
|
||||||
|
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
#ifndef BASEPANNELPROPERTYPROXY_H
|
|
||||||
#define BASEPANNELPROPERTYPROXY_H
|
|
||||||
/****************************
|
|
||||||
* pannel属性代理基类
|
|
||||||
* *************************/
|
|
||||||
#include "basePropertyProxy.h"
|
|
||||||
#include "propertyType/pannelColorGadget.h"
|
|
||||||
|
|
||||||
class BaseDrawingPanel;
|
|
||||||
|
|
||||||
class BasePannelPropertyProxy : public BasePropertyProxy {
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
Q_PROPERTY(QString Name READ getName WRITE setName)
|
|
||||||
Q_PROPERTY(QSize Size READ getSize WRITE setSize)
|
|
||||||
Q_PROPERTY(PannelColorGadget* Color READ getColorGadgetPtr WRITE setColorGadgetPtr)
|
|
||||||
public:
|
|
||||||
BasePannelPropertyProxy(BaseDrawingPanel*);
|
|
||||||
~BasePannelPropertyProxy();
|
|
||||||
public:
|
|
||||||
virtual QString getName() const;
|
|
||||||
virtual void setName(QString);
|
|
||||||
virtual QSize getSize() const;
|
|
||||||
virtual void setSize(QSize);
|
|
||||||
PannelColorGadget* getColorGadgetPtr(){return _pColorGadget;}
|
|
||||||
void setColorGadgetPtr(PannelColorGadget* p){_pColorGadget = p;}
|
|
||||||
protected:
|
|
||||||
BaseDrawingPanel* _pPanel;
|
|
||||||
PannelColorGadget* _pColorGadget;
|
|
||||||
};
|
|
||||||
#endif //BASEPANNELPROPERTYPROXY_H
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
#ifndef BASEPROPERTYPROXY_H
|
|
||||||
#define BASEPROPERTYPROXY_H
|
|
||||||
/****************************
|
|
||||||
* 属性页代理基类
|
|
||||||
* *************************/
|
|
||||||
#include <QObject>
|
|
||||||
|
|
||||||
class BasePropertyProxy : public QObject {
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
BasePropertyProxy(QObject* parnet = nullptr);
|
|
||||||
~BasePropertyProxy();
|
|
||||||
};
|
|
||||||
#endif //BASEPROPERTYPROXY_H
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
#include <QtWidgets/QMenu>
|
#include <QtWidgets/QMenu>
|
||||||
|
|
||||||
#include "graphicsDataModel/baseModel.h"
|
#include "graphicsDataModel/baseModel.h"
|
||||||
//#include "global.h"
|
#include "global.h"
|
||||||
|
|
||||||
class QUndoStack;
|
class QUndoStack;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,7 @@
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include "baseContentDlg.h"
|
#include "baseContentDlg.h"
|
||||||
//#include "global.h"
|
#include "global.h"
|
||||||
#include "common/core_model/data_transmission.h"
|
|
||||||
/*******************************************************
|
/*******************************************************
|
||||||
间隔信息
|
间隔信息
|
||||||
********************************************************/
|
********************************************************/
|
||||||
|
|
@ -21,8 +20,8 @@ class BayInfoDlg : public BaseContentDlg
|
||||||
public:
|
public:
|
||||||
BayInfoDlg(QWidget *parent = nullptr);
|
BayInfoDlg(QWidget *parent = nullptr);
|
||||||
virtual ~BayInfoDlg();
|
virtual ~BayInfoDlg();
|
||||||
virtual void createGroupView(GroupStateInfo);
|
virtual void createGroupView(groupStateInfo);
|
||||||
virtual QMap<QString,PropertyStateInfo> getPropertyValue(BaseProperty* = nullptr); //返回当前页面的属性值
|
virtual QMap<QString,propertyStateInfo> getPropertyValue(BaseProperty* = nullptr); //返回当前页面的属性值
|
||||||
virtual void setPropertyValue(QVariant);
|
virtual void setPropertyValue(QVariant);
|
||||||
auto& getValidType() {return _validType;} //获取可用的量测属性
|
auto& getValidType() {return _validType;} //获取可用的量测属性
|
||||||
void setUi();
|
void setUi();
|
||||||
|
|
@ -43,7 +42,7 @@ private:
|
||||||
BayProperty* _bayProperty; //当前间隔属性
|
BayProperty* _bayProperty; //当前间隔属性
|
||||||
BaseProperty* _itemProperty; //当前对象属性
|
BaseProperty* _itemProperty; //当前对象属性
|
||||||
MeasureSettingDlg* _measureDlg;
|
MeasureSettingDlg* _measureDlg;
|
||||||
QList<MeasureAttributeType> _validType; //可用的属性列表
|
QList<measureAttributeType> _validType; //可用的属性列表
|
||||||
QMap<QString,MeasurementInfo> _mapMeasure; //量测列表
|
QMap<QString,MeasurementInfo> _mapMeasure; //量测列表
|
||||||
bool bShowDouble = false; //显示double界面
|
bool bShowDouble = false; //显示double界面
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,7 @@
|
||||||
#define BAYMEASUREDLG_H
|
#define BAYMEASUREDLG_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
//#include "global.h"
|
#include "global.h"
|
||||||
#include "common/backend/project_model.h"
|
|
||||||
/*******************************************************
|
/*******************************************************
|
||||||
间隔量测界面
|
间隔量测界面
|
||||||
********************************************************/
|
********************************************************/
|
||||||
|
|
@ -41,7 +40,7 @@ private:
|
||||||
Ui::bayMeasureDlg *ui;
|
Ui::bayMeasureDlg *ui;
|
||||||
BayProperty* _bayProperty; //当前间隔属性
|
BayProperty* _bayProperty; //当前间隔属性
|
||||||
MeasureSettingDlg* _measureDlg;
|
MeasureSettingDlg* _measureDlg;
|
||||||
QList<MeasureAttributeType> _validType; //可用的属性列表
|
QList<measureAttributeType> _validType; //可用的属性列表
|
||||||
QMap<QString,MeasurementInfo> _mapMeasure; //量测列表
|
QMap<QString,MeasurementInfo> _mapMeasure; //量测列表
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include "baseContentDlg.h"
|
#include "baseContentDlg.h"
|
||||||
//#include "global.h"
|
#include "global.h"
|
||||||
/*******************************************************
|
/*******************************************************
|
||||||
ct扩展信息界面
|
ct扩展信息界面
|
||||||
********************************************************/
|
********************************************************/
|
||||||
|
|
@ -21,8 +21,8 @@ class CtExtraInfoDlg : public BaseContentDlg
|
||||||
public:
|
public:
|
||||||
CtExtraInfoDlg(QWidget *parent = nullptr);
|
CtExtraInfoDlg(QWidget *parent = nullptr);
|
||||||
virtual ~CtExtraInfoDlg();
|
virtual ~CtExtraInfoDlg();
|
||||||
virtual void createGroupView(GroupStateInfo);
|
virtual void createGroupView(groupStateInfo);
|
||||||
virtual QMap<QString,PropertyStateInfo> getPropertyValue(BaseProperty* = nullptr); //返回当前页面的属性值
|
virtual QMap<QString,propertyStateInfo> getPropertyValue(BaseProperty* = nullptr); //返回当前页面的属性值
|
||||||
virtual void setPropertyValue(QVariant);
|
virtual void setPropertyValue(QVariant);
|
||||||
public slots:
|
public slots:
|
||||||
void onAddClicked();
|
void onAddClicked();
|
||||||
|
|
|
||||||
|
|
@ -1,67 +0,0 @@
|
||||||
#ifndef DATASOURCEDLG_H
|
|
||||||
#define DATASOURCEDLG_H
|
|
||||||
|
|
||||||
/*********运行时数据源选则*********/
|
|
||||||
#include <QDialog>
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
namespace Ui { class dataSourceDlg; }
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
class QStandardItemModel;
|
|
||||||
class QStandardItem;
|
|
||||||
struct ExtraProperty;
|
|
||||||
class StructDataSource;
|
|
||||||
class ExtraPropertyManager;
|
|
||||||
class QPropertyHandle;
|
|
||||||
struct DataSourceType;
|
|
||||||
class QListWidgetItem;
|
|
||||||
|
|
||||||
class DataSourceDlg : public QDialog
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
DataSourceDlg(QWidget *parent = nullptr);
|
|
||||||
~DataSourceDlg();
|
|
||||||
|
|
||||||
void initial();
|
|
||||||
void loadData();
|
|
||||||
|
|
||||||
void showDlg(DataSourceType);
|
|
||||||
DataSourceType getCurData();
|
|
||||||
signals:
|
|
||||||
void listWidgetUpdated();
|
|
||||||
public slots:
|
|
||||||
void onOkClicked();
|
|
||||||
void onCancelClicked();
|
|
||||||
|
|
||||||
void onTreeSelectionChanged(const QModelIndex& current, const QModelIndex& previous);
|
|
||||||
void onListWidgetClicked(QListWidgetItem*);
|
|
||||||
void addItemToView(const ExtraProperty& property,
|
|
||||||
const QString& displayMode, // "name" 或 "tag"
|
|
||||||
QStandardItem* root,
|
|
||||||
QStandardItem* pItem);
|
|
||||||
private:
|
|
||||||
QString getLevelType(int index);
|
|
||||||
void clearItems();
|
|
||||||
void clearPropertyList();
|
|
||||||
void loadCategoryProperties(QStandardItem* categoryItem);
|
|
||||||
QVector<ExtraProperty> getCategoryPropertiesFromDataManager(const QVariantMap& categoryData);
|
|
||||||
void updateCategoryProperties(QStandardItem* categoryItem,const ExtraProperty& property); // 更新category节点的属性列表
|
|
||||||
QStandardItem* processGroupLevel(QStandardItem* componentItem,const ExtraProperty& property); // 处理group层级
|
|
||||||
void processCategoryLevel(QStandardItem* groupItem,const ExtraProperty& property); // 处理category层级
|
|
||||||
void updatePropertyList(QVector<ExtraProperty>);
|
|
||||||
void expandToNodeByCode(const QString& code,QStandardItemModel* model); //根据属性code展开树到指定节点
|
|
||||||
void selectListItemByCode(const QString& code); //在listWidget中选中指定code的项
|
|
||||||
QStandardItem* findCategoryNodeByPropertyCode(QStandardItem* item, const QString& code);
|
|
||||||
private:
|
|
||||||
Ui::dataSourceDlg *ui;
|
|
||||||
QStandardItemModel* _treeModel;
|
|
||||||
QStandardItem* m_currentCategoryItem; //当前操作对象
|
|
||||||
ExtraPropertyManager* _pExtraProManager;
|
|
||||||
StructDataSource* m_dataSource;
|
|
||||||
QListWidgetItem* _curProperty; //当前属性
|
|
||||||
QString m_targetPropertyCode; //打开的目标code
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -24,10 +24,7 @@ public:
|
||||||
|
|
||||||
GraphicsItemGroup* createGroup();
|
GraphicsItemGroup* createGroup();
|
||||||
void destroyGroup();
|
void destroyGroup();
|
||||||
void setBackGoundColor(QColor color) {m_backGroundColor = color;}
|
|
||||||
QColor getBackGoundColor() {return m_backGroundColor;}
|
|
||||||
void setGridColor(QColor color) {m_gridColor = color;}
|
|
||||||
QColor getGridColor() {return m_gridColor;}
|
|
||||||
signals:
|
signals:
|
||||||
void signalAddItem(QGraphicsItem*);
|
void signalAddItem(QGraphicsItem*);
|
||||||
protected:
|
protected:
|
||||||
|
|
@ -46,8 +43,7 @@ private:
|
||||||
bool m_bGridVisible;
|
bool m_bGridVisible;
|
||||||
QGraphicsView* m_pView;
|
QGraphicsView* m_pView;
|
||||||
BaseDrawingPanel* m_pDrawingPanel; //保存父指针
|
BaseDrawingPanel* m_pDrawingPanel; //保存父指针
|
||||||
QColor m_backGroundColor;
|
|
||||||
QColor m_gridColor;
|
|
||||||
private:
|
private:
|
||||||
FixedPortsModel* _graphModel;
|
FixedPortsModel* _graphModel;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,7 @@
|
||||||
#define DIAGRAMCAVAS_H
|
#define DIAGRAMCAVAS_H
|
||||||
|
|
||||||
#include <QMdiArea>
|
#include <QMdiArea>
|
||||||
//#include "global.h"
|
#include "global.h"
|
||||||
#include "common/backend/project_model.h"
|
|
||||||
#include "common/core_model/topology.h"
|
|
||||||
#include "common/core_model/types.h"
|
|
||||||
#include "common/core_model/diagram.h"
|
|
||||||
#include "export.hpp"
|
#include "export.hpp"
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
@ -27,7 +23,6 @@ class DataAccessor;
|
||||||
struct HttpRecommandInfo;
|
struct HttpRecommandInfo;
|
||||||
class StructDataPreviewDlg;
|
class StructDataPreviewDlg;
|
||||||
class ExtraPropertyManager;
|
class ExtraPropertyManager;
|
||||||
class DataSourceDlg;
|
|
||||||
|
|
||||||
class DIAGRAM_DESIGNER_PUBLIC DiagramCavas : public QMdiArea
|
class DIAGRAM_DESIGNER_PUBLIC DiagramCavas : public QMdiArea
|
||||||
{
|
{
|
||||||
|
|
@ -49,17 +44,13 @@ public:
|
||||||
public:
|
public:
|
||||||
void initial();
|
void initial();
|
||||||
signals:
|
signals:
|
||||||
void prepareUpdateItems(QList<HierarchyItem>,bool refresh);
|
void prepareUpdateItems(QList<monitorRelationItem>,bool refresh);
|
||||||
void prepareSelectItems(QList<HierarchyItem>);
|
void prepareSelectItems(QList<monitorRelationItem>);
|
||||||
void updateMonitorList(QString,QPair<QString,QUuid>,int nMode = 0); //0新增1删除
|
void updateMonitorList(QString,QPair<QString,QUuid>,int nMode = 0); //0新增1删除
|
||||||
void createdMonitorItems(QList<HierarchyItem>); //创建的监控中item个数
|
void createdMonitorItems(QList<monitorRelationItem>); //创建的监控中item个数
|
||||||
void selectTarget(QObject*);
|
|
||||||
void prepareUpdateTopology(QList<HierarchyItem>,bool refresh,bool showFull); //更新层级数 refresh:刷新标志,showFull:显示全部层级
|
|
||||||
|
|
||||||
void updateMonitorTopology(QList<QUuid>);
|
|
||||||
public slots:
|
public slots:
|
||||||
void onSignal_addDrawingPanel(PowerEntity* p,DiagramMode = DM_edit,QString parent = QString()); //parent:派生运行时的page
|
void onSignal_addDrawingPanel(PowerEntity* p,DiagramMode = DM_edit,QString parent = QString()); //parent:派生运行时的page
|
||||||
void onSignal_addGraphicsItem(ModelStateInfo&);
|
void onSignal_addGraphicsItem(modelStateInfo&);
|
||||||
void onSignal_addPage();
|
void onSignal_addPage();
|
||||||
void onSignal_savePage();
|
void onSignal_savePage();
|
||||||
void onSignal_loadPage(PowerEntity* p);
|
void onSignal_loadPage(PowerEntity* p);
|
||||||
|
|
@ -86,9 +77,6 @@ public slots:
|
||||||
void onSignal_openStructDataPreview(); //打开结构数据界面
|
void onSignal_openStructDataPreview(); //打开结构数据界面
|
||||||
|
|
||||||
void onCreateTestBaseModelDiagram(); //生成测试基模图
|
void onCreateTestBaseModelDiagram(); //生成测试基模图
|
||||||
|
|
||||||
/****************************拓扑关系(层级关系)******************************/
|
|
||||||
void onSignal_updateTopology(QList<HierarchyItem>,bool,bool); //更新拓扑列表
|
|
||||||
/******************************生成组态***********************************/
|
/******************************生成组态***********************************/
|
||||||
void onSignal_createEditPanel(QString,QUuid);
|
void onSignal_createEditPanel(QString,QUuid);
|
||||||
void onSignal_prepareOpenSetting(QString);
|
void onSignal_prepareOpenSetting(QString);
|
||||||
|
|
@ -101,23 +89,20 @@ public slots:
|
||||||
/*********************************间隔**************************************/
|
/*********************************间隔**************************************/
|
||||||
void onSignl_openCurrentBay();
|
void onSignl_openCurrentBay();
|
||||||
/********************************运行时**********************************/
|
/********************************运行时**********************************/
|
||||||
void onSignal_updateCurItems(QList<HierarchyItem>,bool); //更新当前设备列表
|
void onSignal_updateCurItems(QList<monitorRelationItem>,bool); //更新当前设备列表
|
||||||
void onSignal_selectedItems(QList<HierarchyItem>); //当前选中设备
|
void onSignal_selectedItems(QList<monitorRelationItem>); //当前选中设备
|
||||||
void onSignal_generate(QString,QList<HierarchyItem>); //使用选中设备生成监控 (监控名,设备)
|
void onSignal_generate(QString,QList<monitorRelationItem>); //使用选中设备生成监控 (监控名,设备)
|
||||||
void onSignal_monitorCreated(QString,QPair<QString,QUuid>); //监控已创建
|
void onSignal_monitorCreated(QString,QPair<QString,QUuid>); //监控已创建
|
||||||
void onSignal_monitorItemCreated(QList<HierarchyItem>); //监控中创建的对象
|
void onSignal_monitorItemCreated(QList<monitorRelationItem>); //监控中创建的对象
|
||||||
|
|
||||||
void onSignal_monitorSelected(DiagramInfo); //监控选中
|
void onSignal_monitorSelected(DiagramInfo); //监控选中
|
||||||
void onSignal_saveMonitor(QList<QPair<QString,QUuid>>); //保存选中的监控
|
void onSignal_saveMonitor(QList<QPair<QString,QUuid>>); //保存选中的监控
|
||||||
|
|
||||||
void updateMonitorListFromDB(int dest = 0); //从数据库更新监控列表 0更新外部lst 1更新内部lst
|
void updateMonitorListFromDB(int dest = 0); //从数据库更新监控列表 0更新外部lst 1更新内部lst
|
||||||
void onSignal_updateMonitorTopology(QList<QUuid>); //通知tree更新monitor拓扑
|
|
||||||
|
|
||||||
QMap<QString,QPair<DrawingPanel*,QMdiSubWindow*>> getMapDraw() {return m_mapDrawPanel;}
|
QMap<QString,QPair<DrawingPanel*,QMdiSubWindow*>> getMapDraw() {return m_mapDrawPanel;}
|
||||||
QMap<QString,QPair<EditPanel*,QMdiSubWindow*>> getMapEdit() {return m_mapEditPanel;}
|
QMap<QString,QPair<EditPanel*,QMdiSubWindow*>> getMapEdit() {return m_mapEditPanel;}
|
||||||
QMap<QString,QPair<MonitorPanel*,QMdiSubWindow*>> getMapMonitor() {return m_mapMonitorPanel;}
|
QMap<QString,QPair<MonitorPanel*,QMdiSubWindow*>> getMapMonitor() {return m_mapMonitorPanel;}
|
||||||
|
|
||||||
void onTargetSelected(QObject*); //选中事件(属性显示)
|
|
||||||
protected:
|
protected:
|
||||||
void resizeEvent(QResizeEvent* event) override;
|
void resizeEvent(QResizeEvent* event) override;
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
#define DIAGRAMCONNECTSETTING_H
|
#define DIAGRAMCONNECTSETTING_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
//#include "global.h"
|
#include "global.h"
|
||||||
/*******************************************************
|
/*******************************************************
|
||||||
网络连接设置
|
网络连接设置
|
||||||
********************************************************/
|
********************************************************/
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,7 @@
|
||||||
|
|
||||||
//组态编辑基础块(分段母线、间隔等)
|
//组态编辑基础块(分段母线、间隔等)
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
//#include "global.h"
|
#include "global.h"
|
||||||
#include "common/core_model/diagram.h"
|
|
||||||
|
|
||||||
class DiagramEditorStructContainer;
|
class DiagramEditorStructContainer;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,15 +2,13 @@
|
||||||
#define DIAGRAMEDITORBAYDETAILADDDLG_H
|
#define DIAGRAMEDITORBAYDETAILADDDLG_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
//#include "global.h"
|
#include "global.h"
|
||||||
#include "common/core_model/diagram.h"
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
namespace Ui { class diagramEditorBayDetailAddDlg; }
|
namespace Ui { class diagramEditorBayDetailAddDlg; }
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
class DiagramEditorBayDetailSettingDlg;
|
class DiagramEditorBayDetailSettingDlg;
|
||||||
class QStandardItemModel;
|
|
||||||
|
|
||||||
class DiagramEditorBayDetailAddDlg : public QDialog
|
class DiagramEditorBayDetailAddDlg : public QDialog
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,7 @@
|
||||||
#define DIAGRAMEDITORBAYDETAILSETTINGDLG_H
|
#define DIAGRAMEDITORBAYDETAILSETTINGDLG_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
//#include "global.h"
|
#include "global.h"
|
||||||
#include "common/core_model/diagram.h"
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
namespace Ui { class diagramEditorBayDetailSettingDlg; }
|
namespace Ui { class diagramEditorBayDetailSettingDlg; }
|
||||||
|
|
@ -14,13 +13,12 @@ class DiagramEditorBayDetailAddDlg;
|
||||||
class DiagramEditorBayBlock;
|
class DiagramEditorBayBlock;
|
||||||
class DiagramEditorBayPreviewDlg;
|
class DiagramEditorBayPreviewDlg;
|
||||||
class DiagramEditorModel;
|
class DiagramEditorModel;
|
||||||
class QStandardItemModel;
|
|
||||||
|
|
||||||
class DiagramEditorBayDetailSettingDlg : public QDialog
|
class DiagramEditorBayDetailSettingDlg : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
DiagramEditorBayDetailSettingDlg(QWidget *parent = nullptr,DiagramEditorModel* p = nullptr);
|
DiagramEditorBayDetailSettingDlg(QWidget *parent = nullptr);
|
||||||
~DiagramEditorBayDetailSettingDlg();
|
~DiagramEditorBayDetailSettingDlg();
|
||||||
|
|
||||||
void initial();
|
void initial();
|
||||||
|
|
@ -35,7 +33,6 @@ public:
|
||||||
DiagramEditorModel* getModel() {return _pModel;}
|
DiagramEditorModel* getModel() {return _pModel;}
|
||||||
DiagramEditorBayBlock* getCurBlock(){return _curOperateObj;}
|
DiagramEditorBayBlock* getCurBlock(){return _curOperateObj;}
|
||||||
DiagramEditorWizard* getWizard() {return _pWizard;}
|
DiagramEditorWizard* getWizard() {return _pWizard;}
|
||||||
void showPreview(); //预览间隔
|
|
||||||
public slots:
|
public slots:
|
||||||
void onAddClicked();
|
void onAddClicked();
|
||||||
void onOkClicked();
|
void onOkClicked();
|
||||||
|
|
@ -44,6 +41,7 @@ public slots:
|
||||||
void onRouteDeleteClicked();
|
void onRouteDeleteClicked();
|
||||||
void onRouteRbtnClicked(const QPoint &pos); //线路右键菜单
|
void onRouteRbtnClicked(const QPoint &pos); //线路右键菜单
|
||||||
void onRouteEditClicked();
|
void onRouteEditClicked();
|
||||||
|
void onPreviewClicked(); //预览间隔
|
||||||
private:
|
private:
|
||||||
Ui::diagramEditorBayDetailSettingDlg *ui;
|
Ui::diagramEditorBayDetailSettingDlg *ui;
|
||||||
DiagramEditorBayDetailAddDlg* _pAddDlg;
|
DiagramEditorBayDetailAddDlg* _pAddDlg;
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QStandardItem>
|
#include <QStandardItem>
|
||||||
//#include "global.h"
|
#include "global.h"
|
||||||
|
|
||||||
class EditView;
|
class EditView;
|
||||||
class EditPreviewScene;
|
class EditPreviewScene;
|
||||||
|
|
@ -20,7 +20,6 @@ public:
|
||||||
void initial();
|
void initial();
|
||||||
void showDlg(int nLayout); //0纵向1横向
|
void showDlg(int nLayout); //0纵向1横向
|
||||||
void setParent(DiagramEditorBayDetailSettingDlg* p) {_pParent = p;}
|
void setParent(DiagramEditorBayDetailSettingDlg* p) {_pParent = p;}
|
||||||
void setSceneRect(const QRect);
|
|
||||||
//void updateModelData(); //根据设置更新data中布局、方向
|
//void updateModelData(); //根据设置更新data中布局、方向
|
||||||
private:
|
private:
|
||||||
EditView* _pView;
|
EditView* _pView;
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
#define DIAGRAMEDITORBAYSETTINGDLG_H
|
#define DIAGRAMEDITORBAYSETTINGDLG_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
//#include "global.h"
|
#include "global.h"
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
namespace Ui { class diagramEditorBaySettingDlg; }
|
namespace Ui { class diagramEditorBaySettingDlg; }
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QStandardItem>
|
#include <QStandardItem>
|
||||||
//#include "global.h"
|
#include "global.h"
|
||||||
|
|
||||||
class EditView;
|
class EditView;
|
||||||
class EditPreviewScene;
|
class EditPreviewScene;
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,7 @@
|
||||||
//组态划分后结构的容器,可包含分段母线及间隔、独立间隔、变压器等,以确定组态图空间结构
|
//组态划分后结构的容器,可包含分段母线及间隔、独立间隔、变压器等,以确定组态图空间结构
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QVector2D>
|
#include <QVector2D>
|
||||||
//#include "global.h"
|
#include "global.h"
|
||||||
#include "common/core_model/diagram.h"
|
|
||||||
|
|
||||||
class DiagramEditorBaseBlock;
|
class DiagramEditorBaseBlock;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,7 @@
|
||||||
#define DIAGRAMEDITORTRANSDETAILADDDLG_H
|
#define DIAGRAMEDITORTRANSDETAILADDDLG_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QStandardItemModel>
|
#include "global.h"
|
||||||
#include "common/core_model/diagram.h"
|
|
||||||
//#include "global.h"
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
namespace Ui { class diagramEditorTransDetailAddDlg; }
|
namespace Ui { class diagramEditorTransDetailAddDlg; }
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,7 @@
|
||||||
#define DIAGRAMEDITORTRANSDETAILSETTINGDLG_H
|
#define DIAGRAMEDITORTRANSDETAILSETTINGDLG_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QStandardItemModel>
|
#include "global.h"
|
||||||
//#include "global.h"
|
|
||||||
#include "common/core_model/diagram.h"
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
namespace Ui { class diagramEditorTransDetailSettingDlg; }
|
namespace Ui { class diagramEditorTransDetailSettingDlg; }
|
||||||
|
|
@ -21,7 +19,7 @@ class DiagramEditorTransDetailSettingDlg : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
DiagramEditorTransDetailSettingDlg(QWidget *parent = nullptr,DiagramEditorModel* p = nullptr);
|
DiagramEditorTransDetailSettingDlg(QWidget *parent = nullptr);
|
||||||
~DiagramEditorTransDetailSettingDlg();
|
~DiagramEditorTransDetailSettingDlg();
|
||||||
|
|
||||||
void initial();
|
void initial();
|
||||||
|
|
@ -38,7 +36,6 @@ public:
|
||||||
DiagramEditorModel* getModel() {return _pModel;}
|
DiagramEditorModel* getModel() {return _pModel;}
|
||||||
DiagramEditorTransformerBlock* getCurBlock(){return _curOperateObj;}
|
DiagramEditorTransformerBlock* getCurBlock(){return _curOperateObj;}
|
||||||
DiagramEditorWizard* getWizard() {return _pWizard;}
|
DiagramEditorWizard* getWizard() {return _pWizard;}
|
||||||
void showPreview();
|
|
||||||
public slots:
|
public slots:
|
||||||
void onAddClicked();
|
void onAddClicked();
|
||||||
void onOkClicked();
|
void onOkClicked();
|
||||||
|
|
@ -47,6 +44,8 @@ public slots:
|
||||||
void onRouteDeleteClicked();
|
void onRouteDeleteClicked();
|
||||||
void onRouteRbtnClicked(const QPoint &pos); //线路右键菜单
|
void onRouteRbtnClicked(const QPoint &pos); //线路右键菜单
|
||||||
void onRouteEditClicked();
|
void onRouteEditClicked();
|
||||||
|
void onPreviewNeutralClicked(); //中性点成套装置预览
|
||||||
|
void onPreviewTransClicked(); //预览变压器
|
||||||
private:
|
private:
|
||||||
Ui::diagramEditorTransDetailSettingDlg *ui;
|
Ui::diagramEditorTransDetailSettingDlg *ui;
|
||||||
DiagramEditorTransDetailAddDlg* _pAddDlg;
|
DiagramEditorTransDetailAddDlg* _pAddDlg;
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ public:
|
||||||
void showDlg(int nType); //显示模式,0高压侧1中压侧2低压侧3变压器
|
void showDlg(int nType); //显示模式,0高压侧1中压侧2低压侧3变压器
|
||||||
void setParent(DiagramEditorTransDetailSettingDlg* p) {_pParent = p;}
|
void setParent(DiagramEditorTransDetailSettingDlg* p) {_pParent = p;}
|
||||||
void updateModelData(int showType); //根据设置更新data中布局、方向,0变压器,1高压侧2中压侧3低压侧
|
void updateModelData(int showType); //根据设置更新data中布局、方向,0变压器,1高压侧2中压侧3低压侧
|
||||||
void setSceneRect(const QRect rec);
|
|
||||||
private:
|
private:
|
||||||
EditView* _pView;
|
EditView* _pView;
|
||||||
EditPreviewScene* _pScene;
|
EditPreviewScene* _pScene;
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
#define DIAGRAMEDITORTRANSSETTINGDLG_H
|
#define DIAGRAMEDITORTRANSSETTINGDLG_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
//#include "global.h"
|
#include "global.h"
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
namespace Ui { class diagramEditorTransSettingDlg; }
|
namespace Ui { class diagramEditorTransSettingDlg; }
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,7 @@
|
||||||
#define DIAGRAMEDITORWIZARD_H
|
#define DIAGRAMEDITORWIZARD_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
//#include "global.h"
|
#include "global.h"
|
||||||
#include "tools.h"
|
|
||||||
#include "common/core_model/diagram.h"
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
namespace Ui { class diagramEditorWizard; }
|
namespace Ui { class diagramEditorWizard; }
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,7 @@
|
||||||
|
|
||||||
//编辑器基础空间结构
|
//编辑器基础空间结构
|
||||||
#include <QGraphicsWidget>
|
#include <QGraphicsWidget>
|
||||||
//#include "global.h"
|
#include "global.h"
|
||||||
#include "common/core_model/diagram.h"
|
|
||||||
|
|
||||||
class EditBaseStruct : public QGraphicsWidget
|
class EditBaseStruct : public QGraphicsWidget
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,7 @@
|
||||||
//组态过程中的item
|
//组态过程中的item
|
||||||
#include <QGraphicsWidget>
|
#include <QGraphicsWidget>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
//#include "global.h"
|
#include "global.h"
|
||||||
#include "common/core_model/diagram.h"
|
|
||||||
|
|
||||||
class DiagramEditorBaseBlock;
|
class DiagramEditorBaseBlock;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,7 @@
|
||||||
//编辑文本项生成组态图
|
//编辑文本项生成组态图
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
//#include "global.h"
|
#include "global.h"
|
||||||
#include "common/core_model/diagram.h"
|
|
||||||
|
|
||||||
class EditView;
|
class EditView;
|
||||||
class EditScene;
|
class EditScene;
|
||||||
|
|
@ -41,7 +40,7 @@ public:
|
||||||
|
|
||||||
DiagramEditorModel* getModel() {return _pModel;}
|
DiagramEditorModel* getModel() {return _pModel;}
|
||||||
EditScene* getScene() {return m_pEditScene;}
|
EditScene* getScene() {return m_pEditScene;}
|
||||||
QList<EditBaseItem*> getBlockItems(EditorItemType typ = EditorItemType::None); //返回block对应的item,如母线,间隔,变压器, none返回所有类型
|
QList<EditBaseItem*> getBlockItems(EditorItemType typ = EditorItemType::none); //返回block对应的item,如母线,间隔,变压器, none返回所有类型
|
||||||
|
|
||||||
void setProjectName(const QString& s){_projectName = s;};
|
void setProjectName(const QString& s){_projectName = s;};
|
||||||
QString getProjectName(){return _projectName;}
|
QString getProjectName(){return _projectName;}
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,7 @@
|
||||||
|
|
||||||
//向导bay设置右侧table
|
//向导bay设置右侧table
|
||||||
#include <QTableWidget>
|
#include <QTableWidget>
|
||||||
//#include "global.h"
|
#include "global.h"
|
||||||
#include "common/core_model/diagram.h"
|
|
||||||
|
|
||||||
class DiagramEditorWizard;
|
class DiagramEditorWizard;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ public:
|
||||||
protected:
|
protected:
|
||||||
void closeEvent(QCloseEvent *closeEvent) override;
|
void closeEvent(QCloseEvent *closeEvent) override;
|
||||||
public slots:
|
public slots:
|
||||||
void onSignal_addGraphicsItem(ModelStateInfo&);
|
void onSignal_addGraphicsItem(modelStateInfo&);
|
||||||
void onSignal_Generate(); //由基模组态生成工程模组态
|
void onSignal_Generate(); //由基模组态生成工程模组态
|
||||||
private:
|
private:
|
||||||
ProjectDiagramNameInput* m_pDiagramNameInputer;
|
ProjectDiagramNameInput* m_pDiagramNameInputer;
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,7 @@
|
||||||
#include <QtCore/QVariant>
|
#include <QtCore/QVariant>
|
||||||
#include <QUuid>
|
#include <QUuid>
|
||||||
|
|
||||||
//#include "global.h"
|
#include "global.h"
|
||||||
#include "common/core_model/types.h"
|
|
||||||
|
|
||||||
class GraphicsBaseItem;
|
class GraphicsBaseItem;
|
||||||
class ItemPort;
|
class ItemPort;
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,6 @@
|
||||||
/**组态编辑时的数据模型*/
|
/**组态编辑时的数据模型*/
|
||||||
#include "graphicsDataModel/baseModel.h"
|
#include "graphicsDataModel/baseModel.h"
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
#include <QStandardItemModel>
|
|
||||||
#include "common/core_model/diagram.h"
|
|
||||||
#include "common/core_model/topology.h"
|
|
||||||
|
|
||||||
class GraphicsBaseModelItem;
|
class GraphicsBaseModelItem;
|
||||||
class DiagramEditorItemProperty;
|
class DiagramEditorItemProperty;
|
||||||
|
|
@ -42,9 +39,9 @@ public:
|
||||||
EditPanel* getPanel(){return _pPanel;}
|
EditPanel* getPanel(){return _pPanel;}
|
||||||
void setWizard(QPointer<DiagramEditorWizard> p){_pWizard = p;}
|
void setWizard(QPointer<DiagramEditorWizard> p){_pWizard = p;}
|
||||||
QMap<QUuid,GraphicsBaseModelItem*> getPreviewItem(){return _previewItem;};
|
QMap<QUuid,GraphicsBaseModelItem*> getPreviewItem(){return _previewItem;};
|
||||||
void clearItems();
|
void clearItems(){_previewItem.clear();}
|
||||||
|
|
||||||
void generatePreview(bool bVisible = true); //生成预览
|
void generatePreview(); //生成预览
|
||||||
void calculateBlockPos(); //重新计算block位置
|
void calculateBlockPos(); //重新计算block位置
|
||||||
void setItemInBlockPos(); //设置block中的item位置
|
void setItemInBlockPos(); //设置block中的item位置
|
||||||
void refreshConnection(); //刷新连接线
|
void refreshConnection(); //刷新连接线
|
||||||
|
|
@ -59,12 +56,11 @@ public:
|
||||||
void setCurTransComponentModel(QStandardItemModel* p) {_pCurTransComponent = p;}
|
void setCurTransComponentModel(QStandardItemModel* p) {_pCurTransComponent = p;}
|
||||||
QStandardItemModel* setCurTransComponentModel() {return _pCurTransComponent;}
|
QStandardItemModel* setCurTransComponentModel() {return _pCurTransComponent;}
|
||||||
void setCurPreviewScene(EditBaseScene* p) {_pCurPreviewScene = p;}
|
void setCurPreviewScene(EditBaseScene* p) {_pCurPreviewScene = p;}
|
||||||
EditBaseScene* getCurPreviewScene(){return _pCurPreviewScene;}
|
|
||||||
QStandardItem* getNameItem(const QString&,int nFrom = 0); //获取返回当前设备模型中的name项 nFrom,0间隔1变压器
|
QStandardItem* getNameItem(const QString&,int nFrom = 0); //获取返回当前设备模型中的name项 nFrom,0间隔1变压器
|
||||||
|
|
||||||
void generateItemByModel(QStandardItemModel* pModel,DiagramEditorBaseBlock* pBlock,int nFrom = 0,QPoint delta = QPoint(0,0)); //0间隔1变压器
|
void generateItemByModel(QStandardItemModel* pModel,DiagramEditorBaseBlock* pBlock,int nFrom = 0,QPoint delta = QPoint(0,0)); //0间隔1变压器
|
||||||
QList<DiagramEditorComponentInfo> generateItemByInfo(QMap<QString,DiagramEditorRouteInfo> mapRoute,QMap<QString,DiagramEditorComponentInfo> mapCompo,QPointF delta = QPointF(0,0),DiagramEditorBaseBlock* pParent = nullptr); //根据data生成item parent:生成的对象添加到parent下(非拓扑计算)
|
QList<DiagramEditorComponentInfo> generateItemByInfo(QMap<QString,DiagramEditorRouteInfo> mapRoute,QMap<QString,DiagramEditorComponentInfo> mapCompo,QPointF delta = QPointF(0,0),DiagramEditorBaseBlock* pParent = nullptr); //根据data生成item parent:生成的对象添加到parent下(非拓扑计算)
|
||||||
QMultiMap<int,QUuid> generateOutConnection(QList<DiagramEditorComponentInfo>,QList<HierarchyItem>&,int nTypeTransCon,int nPos = 0,DiagramEditorBaseBlock* pParent = nullptr); //生成外部连接(手动bind的连接)relation:层级关系引用 nTypeTransCon变压器连线类型,1中性点连接2外部连接,nPos中性点连接时的位置
|
QMultiMap<int,QUuid> generateOutConnection(QList<DiagramEditorComponentInfo>,int nTypeTransCon,int nPos = 0,DiagramEditorBaseBlock* pParent = nullptr); //生成外部连接(手动bind的连接) nTypeTransCon变压器连线类型,1中性点连接2外部连接,nPos中性点连接时的位置
|
||||||
QRectF updateTarget(QMap<QString,DiagramEditorRouteInfo>&,QMap<QString,DiagramEditorComponentInfo>&,int nLayout,int nSource,bool saveToModel = true); //更新位置 nLayout主次朝向:8421,8421 上下左右,上下左右 nSource:0间隔1变压器 regenerate重新生成标志 saveToModel:生成到模型或map
|
QRectF updateTarget(QMap<QString,DiagramEditorRouteInfo>&,QMap<QString,DiagramEditorComponentInfo>&,int nLayout,int nSource,bool saveToModel = true); //更新位置 nLayout主次朝向:8421,8421 上下左右,上下左右 nSource:0间隔1变压器 regenerate重新生成标志 saveToModel:生成到模型或map
|
||||||
void clearCompoDir(QMap<QString,DiagramEditorRouteInfo>&,QMap<QString,DiagramEditorComponentInfo>&,int nSource); //清空component中的dir(updateTarget前调用)
|
void clearCompoDir(QMap<QString,DiagramEditorRouteInfo>&,QMap<QString,DiagramEditorComponentInfo>&,int nSource); //清空component中的dir(updateTarget前调用)
|
||||||
|
|
||||||
|
|
@ -72,8 +68,7 @@ public:
|
||||||
|
|
||||||
QByteArray getWizardInfo(); //返回二进制wizard设置
|
QByteArray getWizardInfo(); //返回二进制wizard设置
|
||||||
void setWizardInfo(const QByteArray&); //二进制设置wizard
|
void setWizardInfo(const QByteArray&); //二进制设置wizard
|
||||||
signals:
|
|
||||||
void updateTopologyItems(QList<HierarchyItem>,bool,bool); //更新当前拓扑列表 <连接关系,是否刷新,显示全部层级>
|
|
||||||
private:
|
private:
|
||||||
void bulidAndLinkComponent(QList<DiagramEditorComponentInfo>,QMap<QString,DiagramEditorComponentInfo>,DiagramEditorBaseBlock* pParent = nullptr); //生成并连接线路上的设备 lst,mapComponents(从map中获取正确数据)
|
void bulidAndLinkComponent(QList<DiagramEditorComponentInfo>,QMap<QString,DiagramEditorComponentInfo>,DiagramEditorBaseBlock* pParent = nullptr); //生成并连接线路上的设备 lst,mapComponents(从map中获取正确数据)
|
||||||
QByteArray serializeWizardData(const DiagramEditorProjectInfo &data); //序列化eidtor向导设置数据
|
QByteArray serializeWizardData(const DiagramEditorProjectInfo &data); //序列化eidtor向导设置数据
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,6 @@
|
||||||
#include <QSharedPointer>
|
#include <QSharedPointer>
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QPointer>
|
|
||||||
|
|
||||||
#include "common/frontend/monitor_item.h"
|
|
||||||
#include "common/backend/project_model.h"
|
|
||||||
|
|
||||||
class BaseDrawingPanel;
|
class BaseDrawingPanel;
|
||||||
class DrawingPanel;
|
class DrawingPanel;
|
||||||
|
|
@ -33,12 +29,11 @@ class GraphicsNonStandardItem;
|
||||||
class BayProperty;
|
class BayProperty;
|
||||||
class BayManagerDlg;
|
class BayManagerDlg;
|
||||||
class ModelProperty;
|
class ModelProperty;
|
||||||
struct ItemPageInfo;
|
struct itemPageInfo;
|
||||||
class EditBaseItem;
|
class EditBaseItem;
|
||||||
class MonitorPanel;
|
class MonitorPanel;
|
||||||
class ItemPropertyDlg;
|
class ItemPropertyDlg;
|
||||||
class BayMeasureDlg;
|
class BayMeasureDlg;
|
||||||
struct MeasurementInfo;
|
|
||||||
|
|
||||||
class FixedPortsModel : public BaseModel, public Serializable
|
class FixedPortsModel : public BaseModel, public Serializable
|
||||||
{
|
{
|
||||||
|
|
@ -48,7 +43,7 @@ public:
|
||||||
FixedPortsModel(PowerEntity*);
|
FixedPortsModel(PowerEntity*);
|
||||||
~FixedPortsModel();
|
~FixedPortsModel();
|
||||||
public:
|
public:
|
||||||
QMap<QUuid,ItemPageInfo> allNodePos() const;
|
QMap<QUuid,itemPageInfo> allNodePos() const;
|
||||||
QVector<ModelProperty*> allConnectionProperty();
|
QVector<ModelProperty*> allConnectionProperty();
|
||||||
QMap<QUuid,GraphicsProjectModelItem*>& allItems();
|
QMap<QUuid,GraphicsProjectModelItem*>& allItems();
|
||||||
bool addNodeItem(QUuid uuid,GraphicsProjectModelItem*);
|
bool addNodeItem(QUuid uuid,GraphicsProjectModelItem*);
|
||||||
|
|
@ -67,7 +62,6 @@ public:
|
||||||
QWidget* getTopWidget();
|
QWidget* getTopWidget();
|
||||||
QPointF getTerminalPos(const QString& sTerminalId); //获取拓扑接线点在当前diagram中的位置
|
QPointF getTerminalPos(const QString& sTerminalId); //获取拓扑接线点在当前diagram中的位置
|
||||||
ElectricConnectLineItem* getLineItemById(const QString& terminalId);
|
ElectricConnectLineItem* getLineItemById(const QString& terminalId);
|
||||||
void updateItemLinePort(QUuid,ModelFunctionType); //刷新连接item的线端点位置
|
|
||||||
|
|
||||||
void showModelDlg(const QString&,QUuid,GraphicsProjectModelItem*); //点击时显示指定模型的dlg、指定item的数据(模型名,对象Uuid,触发事件的item)
|
void showModelDlg(const QString&,QUuid,GraphicsProjectModelItem*); //点击时显示指定模型的dlg、指定item的数据(模型名,对象Uuid,触发事件的item)
|
||||||
void initialPropertyDlg(); //初始化属性设置dlg,每个模型拥各自的dlg
|
void initialPropertyDlg(); //初始化属性设置dlg,每个模型拥各自的dlg
|
||||||
|
|
@ -78,8 +72,7 @@ public:
|
||||||
|
|
||||||
void insertProjectModelName(QString,QString); //插入工程模类型(生成工程模时调用)
|
void insertProjectModelName(QString,QString); //插入工程模类型(生成工程模时调用)
|
||||||
void showProjectIconSettingDlg(GraphicsProjectModelItem*); //显示工程模图标设置(设置使用图标)
|
void showProjectIconSettingDlg(GraphicsProjectModelItem*); //显示工程模图标设置(设置使用图标)
|
||||||
void updateItemIcon(QString sMeta,QString sModel,QMap<QString,QByteArray>,QString sIndex = ""); //更新指定模型的图标 sIndex:索引下标,为空全部更新
|
void updateItemIcon(QString sMeta,QString sModel); //更新指定模型的图标
|
||||||
void saveProject(); //保存工程模组态
|
|
||||||
/********************baseModel相关**********************/
|
/********************baseModel相关**********************/
|
||||||
QMap<QUuid,GraphicsBaseModelItem*>& allBaseItems(); //获取所有基模对象
|
QMap<QUuid,GraphicsBaseModelItem*>& allBaseItems(); //获取所有基模对象
|
||||||
QVector<Connection> allBaseConnections();
|
QVector<Connection> allBaseConnections();
|
||||||
|
|
@ -110,12 +103,12 @@ public:
|
||||||
QJsonObject turnListToJson(QList<QUuid> lst,QString sInerTag,QString sOutTag); //将list转换为QJsonObject,<lst,内部标签,外部标签>
|
QJsonObject turnListToJson(QList<QUuid> lst,QString sInerTag,QString sOutTag); //将list转换为QJsonObject,<lst,内部标签,外部标签>
|
||||||
QList<QUuid> turnJsonArrToList(QJsonObject obj,QString sInner,QString sOut);
|
QList<QUuid> turnJsonArrToList(QJsonObject obj,QString sInner,QString sOut);
|
||||||
/*************************监控(运行时)**************************/
|
/*************************监控(运行时)**************************/
|
||||||
void generateMonitor(QString,QList<HierarchyItem>); //生成监控 (监控名,选中的设备列表)
|
void generateMonitor(QString,QList<monitorRelationItem>); //生成监控 (监控名,选中的设备列表)
|
||||||
void generateMonitorConfig(MonitorPanel*); //生成监控配置参数结构
|
void generateMonitorConfig(MonitorPanel*); //生成监控配置参数结构
|
||||||
void setMonitorPara(QMap<QUuid,QList<MonitorItemAttributeInfo>> map){m_monitorPara = map;}
|
void setMonitorPara(QMap<QUuid,QList<monitorItemAttributeInfo>> map){m_monitorPara = map;}
|
||||||
QMap<QUuid,QList<MonitorItemAttributeInfo>>& getMonitorPara() {return m_monitorPara;}
|
QMap<QUuid,QList<monitorItemAttributeInfo>>& getMonitorPara() {return m_monitorPara;}
|
||||||
void setMonitorRelation(QList<HierarchyItem> lst){m_lstMonitorRelation = lst;}
|
void setMonitorRelation(QList<monitorRelationItem> lst){m_lstMonitorRelation = lst;}
|
||||||
QList<HierarchyItem> getMonitorRelation() {return m_lstMonitorRelation;}
|
QList<monitorRelationItem> getMonitorRelation() {return m_lstMonitorRelation;}
|
||||||
|
|
||||||
void monitorItemSelected(QUuid); //运行时item选中事件
|
void monitorItemSelected(QUuid); //运行时item选中事件
|
||||||
void monitorItemDetailAttr(QUuid); //显示属性详情
|
void monitorItemDetailAttr(QUuid); //显示属性详情
|
||||||
|
|
@ -126,29 +119,27 @@ public:
|
||||||
void startAcceptData(); //开始接收实时数据
|
void startAcceptData(); //开始接收实时数据
|
||||||
void stopAcceptData(QString); //停止接收实时数据
|
void stopAcceptData(QString); //停止接收实时数据
|
||||||
|
|
||||||
QMap<int,QList<QPair<MonitorItemState,QString>>>& getMonitorStateMap(){return m_monitorStateMap;}
|
QMap<int,QList<QPair<monitorItemState,QString>>>& getMonitorStateMap(){return m_monitorStateMap;}
|
||||||
void setMonitorDisplaySetting(QMap<MonitorItemTypeStruct,QMap<MonitorItemStateStruct,MonitorItemDisplayInfo>> map){m_monitorDisplaySetting = map;}
|
void setMonitorDisplaySetting(QMap<monitorItemTypeStruct,QMap<monitorItemStateStruct,monitorItemDisplayInfo>> map){m_monitorDisplaySetting = map;}
|
||||||
QMap<MonitorItemTypeStruct,QMap<MonitorItemStateStruct,MonitorItemDisplayInfo>>& getMonitorDisplaySetting(){return m_monitorDisplaySetting;}
|
QMap<monitorItemTypeStruct,QMap<monitorItemStateStruct,monitorItemDisplayInfo>>& getMonitorDisplaySetting(){return m_monitorDisplaySetting;}
|
||||||
|
|
||||||
/************************数据显示*************************/
|
/************************数据显示*************************/
|
||||||
void setCurItemPropertyDlg(ItemPropertyDlg* p) {m_curPropertyDlg = p;}
|
void setCurItemPropertyDlg(ItemPropertyDlg* p) {m_curPropertyDlg = p;}
|
||||||
ItemPropertyDlg* getCurItemPropertyDlg() {return m_curPropertyDlg;}
|
ItemPropertyDlg* getCurItemPropertyDlg() {return m_curPropertyDlg;}
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void activatePage(const QString&); //激活当前model所在page
|
void activatePage(const QString&); //激活当前model所在page
|
||||||
void updateCurrentItems(QList<HierarchyItem>,bool); //更新当前组态元件列表 <连接关系,是否刷新>
|
void updateCurrentItems(QList<monitorRelationItem>,bool); //更新当前组态元件列表 <名称,uid>
|
||||||
void itemSelected(QList<HierarchyItem>); //发送选中的元件
|
void itemSelected(QList<monitorRelationItem>); //发送选中的元件
|
||||||
void monitorCreated(QString,QPair<QString,QUuid>); //监控创建信号 <工程page,<监控page,page_uid>>
|
void monitorCreated(QString,QPair<QString,QUuid>); //监控创建信号 <工程page,<监控page,page_uid>>
|
||||||
void monitorItems(QList<HierarchyItem>); //发送创建成功的Items
|
void monitorItems(QList<monitorRelationItem>); //发送创建成功的Items
|
||||||
void dataUpdated(); //数据更新通知
|
void dataUpdated(); //数据更新通知
|
||||||
void updateTopologyItems(QList<HierarchyItem>,bool,bool); //更新当前拓扑列表 <连接关系,是否刷新,显示全部层级>
|
|
||||||
void notifyUpdateMonitorTopology(QList<QUuid>); //使用列表中的item id更新总拓扑
|
|
||||||
public:
|
public:
|
||||||
void setPageName(QString s) {_pageName = s;} //设置表名称
|
void setPageName(QString s) {_pageName = s;} //设置表名称
|
||||||
QString pageName() const {return _pageName;}
|
QString pageName() const {return _pageName;}
|
||||||
void activateModel() {Q_EMIT activatePage(_pageName);} //发送激活信号(点击)
|
void activateModel() {Q_EMIT activatePage(_pageName);} //发送激活信号(点击)
|
||||||
void startHttpRequest(); //开始请求数据(运行时)
|
void startHttpRequest(); //开始请求数据(运行时)
|
||||||
void setCavas(QPointer<DiagramCavas> p) {_cavas = p;} //设置所属顶层容器
|
void setCavas(DiagramCavas* p) {_cavas = p;} //设置所属顶层容器
|
||||||
DiagramCavas* getCavas();
|
DiagramCavas* getCavas() {return _cavas;}
|
||||||
|
|
||||||
QMap<QUuid,GraphicsProjectModelItem*> getProjectItems(){return _nodeItem;}
|
QMap<QUuid,GraphicsProjectModelItem*> getProjectItems(){return _nodeItem;}
|
||||||
QMap<QUuid,GraphicsBaseModelItem*> getBaseModelItems(){return _baseItem;}
|
QMap<QUuid,GraphicsBaseModelItem*> getBaseModelItems(){return _baseItem;}
|
||||||
|
|
@ -161,9 +152,8 @@ public Q_SLOTS:
|
||||||
void onSignal_generateDiagram(const QString&); //生成工程组态信号
|
void onSignal_generateDiagram(const QString&); //生成工程组态信号
|
||||||
void onSignal_openBayManager();
|
void onSignal_openBayManager();
|
||||||
void onDataTimerOut();
|
void onDataTimerOut();
|
||||||
void onSelectionChanged();
|
|
||||||
private:
|
private:
|
||||||
void addPortsToItem_json(PortState,QJsonArray,GraphicsBaseItem*); //将json格式的port添加到item
|
void addPortsToItem_json(PortState,QJsonArray,GraphicsProjectModelItem*); //将json格式的port添加到item
|
||||||
void autoSetModelName(GraphicsBaseModelItem*); //如果此页的工程模已被设置,将projectName更新到item
|
void autoSetModelName(GraphicsBaseModelItem*); //如果此页的工程模已被设置,将projectName更新到item
|
||||||
QString removeSuffix(const QString& str); //移除最后一个下划线后的内容 (处理各种tag后缀)
|
QString removeSuffix(const QString& str); //移除最后一个下划线后的内容 (处理各种tag后缀)
|
||||||
ModelProperty* getItemByUid(QList<GraphicsBaseItem*>,QUuid); //返回uid对应的data
|
ModelProperty* getItemByUid(QList<GraphicsBaseItem*>,QUuid); //返回uid对应的data
|
||||||
|
|
@ -177,7 +167,7 @@ private:
|
||||||
QMap<QUuid,ElectricBayItem*> _bayItem; //间隔对象
|
QMap<QUuid,ElectricBayItem*> _bayItem; //间隔对象
|
||||||
|
|
||||||
QString _pageName;
|
QString _pageName;
|
||||||
QPointer<DiagramCavas> _cavas;
|
DiagramCavas* _cavas;
|
||||||
DesignerScene* _scene;
|
DesignerScene* _scene;
|
||||||
BaseDrawingPanel* _widget; //顶层widget
|
BaseDrawingPanel* _widget; //顶层widget
|
||||||
HttpInterface* _Interface;
|
HttpInterface* _Interface;
|
||||||
|
|
@ -185,15 +175,15 @@ private:
|
||||||
PowerEntity* _pEntity; //拓扑实体
|
PowerEntity* _pEntity; //拓扑实体
|
||||||
QMap<QString,QString> _projectModelName; //该图中所有元件对应的工程模类型(todo:扩展为每张图独立的结构体) uuid,工程模名称
|
QMap<QString,QString> _projectModelName; //该图中所有元件对应的工程模类型(todo:扩展为每张图独立的结构体) uuid,工程模名称
|
||||||
|
|
||||||
QMap<QString,ModelStateInfo> _modelStateInfo; //模型结构信息
|
QMap<QString,modelStateInfo> _modelStateInfo; //模型结构信息
|
||||||
QMap<QString,ModelDataInfo> _modelDataInfo; //模型数据信息
|
QMap<QString,modelDataInfo> _modelDataInfo; //模型数据信息
|
||||||
ProjectModelSetting* m_proModelSettingDlg;
|
ProjectModelSetting* m_proModelSettingDlg;
|
||||||
ProjectIconSetting* m_projectIconSettingDlg;
|
ProjectIconSetting* m_projectIconSettingDlg;
|
||||||
BayManagerDlg* m_pBayManager;
|
BayManagerDlg* m_pBayManager;
|
||||||
QMap<QUuid,QList<MonitorItemAttributeInfo>> m_monitorPara; //监控参数
|
QMap<QUuid,QList<monitorItemAttributeInfo>> m_monitorPara; //监控参数
|
||||||
QMap<int,QList<QPair<MonitorItemState,QString>>> m_monitorStateMap; //元件状态对照表 <type,<state,状态名>>
|
QMap<int,QList<QPair<monitorItemState,QString>>> m_monitorStateMap; //元件状态对照表 <type,<state,状态名>>
|
||||||
QMap<MonitorItemTypeStruct,QMap<MonitorItemStateStruct,MonitorItemDisplayInfo>> m_monitorDisplaySetting; //元件设置
|
QMap<monitorItemTypeStruct,QMap<monitorItemStateStruct,monitorItemDisplayInfo>> m_monitorDisplaySetting; //元件设置
|
||||||
QList<HierarchyItem> m_lstMonitorRelation; //监控item层级关系
|
QList<monitorRelationItem> m_lstMonitorRelation; //监控item层级关系
|
||||||
|
|
||||||
ItemPropertyDlg* m_curPropertyDlg;
|
ItemPropertyDlg* m_curPropertyDlg;
|
||||||
QTimer* m_dataTimer; //获取数据的定时器
|
QTimer* m_dataTimer; //获取数据的定时器
|
||||||
|
|
|
||||||
|
|
@ -7,14 +7,6 @@
|
||||||
|
|
||||||
class ElectricConnectLineItem : public GraphicsProjectModelItem
|
class ElectricConnectLineItem : public GraphicsProjectModelItem
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
enum UShapeType {
|
|
||||||
UShape_Unknown,
|
|
||||||
UShape_TopOpen, // 开口向上
|
|
||||||
UShape_BottomOpen, // 开口向下
|
|
||||||
UShape_LeftOpen, // 开口向左
|
|
||||||
UShape_RightOpen // 开口向右
|
|
||||||
};
|
|
||||||
public:
|
public:
|
||||||
ElectricConnectLineItem(QGraphicsItem *parent = 0);
|
ElectricConnectLineItem(QGraphicsItem *parent = 0);
|
||||||
ElectricConnectLineItem(const ElectricConnectLineItem&); //暂不拷贝位置关系,由线自己计算
|
ElectricConnectLineItem(const ElectricConnectLineItem&); //暂不拷贝位置关系,由线自己计算
|
||||||
|
|
@ -25,73 +17,22 @@ public:
|
||||||
void setEndPoint(const QPointF& p);
|
void setEndPoint(const QPointF& p);
|
||||||
QPainterPath getPoints(void) const { return m_points; }
|
QPainterPath getPoints(void) const { return m_points; }
|
||||||
|
|
||||||
void startDrag(const QPointF& scenePos);
|
void moveLine(QPointF); //鼠标点击拖动
|
||||||
void updateDrag(const QPointF& scenePos);
|
|
||||||
void endDrag();
|
|
||||||
void setLastPoint(const QPointF& point);
|
|
||||||
void setPath(const QPainterPath& path);
|
|
||||||
QPainterPath path() const;
|
|
||||||
|
|
||||||
void resetCurLine(){_curLine = QPoint();}
|
|
||||||
void calculatePath();
|
void calculatePath();
|
||||||
|
void resetCurLine(){_curLine = QPoint();}
|
||||||
|
|
||||||
|
protected:
|
||||||
virtual QPainterPath shape() const override;
|
virtual QPainterPath shape() const override;
|
||||||
virtual QRectF boundingRect() const override;
|
virtual QRectF boundingRect() const override;
|
||||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
||||||
|
private:
|
||||||
protected:
|
|
||||||
void initial();
|
void initial();
|
||||||
private:
|
|
||||||
//路径计算相关
|
|
||||||
void generateAvoidancePath(const QPointF& start, const QPointF& end,const QList<QRectF>& obstacleShapes); // 使用形状进行避障
|
|
||||||
double calculatePathLength(const QList<QPointF>& path);
|
|
||||||
bool lineIntersectsRect(const QLineF& line, const QRectF& rect) const;
|
|
||||||
bool isSegmentSafe(const QPointF& p1, const QPointF& p2,const QList<QRectF>& components);
|
|
||||||
bool isPathSafe(const QList<QPointF>& path,const QList<QRectF>& components);
|
|
||||||
bool segmentPenetratesComponent(const QLineF& segment,const QRectF& component);
|
|
||||||
QRectF getTotalComponentsBounds(const QList<QRectF>& components);
|
|
||||||
void collectRectilinearPaths(const QPointF& start, const QPointF& end,const QList<QRectF>& components,QMultiMap<double, QList<QPointF>>& paths);
|
|
||||||
void addPathIfRectilinear(const QList<QPointF>& path,QMultiMap<double, QList<QPointF>>& paths);
|
|
||||||
void collectBypassPaths(const QPointF& start, const QPointF& end,const QList<QRectF>& components,QMultiMap<double, QList<QPointF>>& paths);
|
|
||||||
void generateForcedRectilinearBypass(const QPointF& start, const QPointF& end,const QList<QRectF>& components);
|
|
||||||
QRectF findFirstBlockingComponent(const QPointF& start, const QPointF& end,const QList<QRectF>& components);
|
|
||||||
|
|
||||||
//线段拖拽相关
|
|
||||||
double distancePointToLine(const QLineF& line, const QPointF& point) const;
|
|
||||||
void ensureEnoughPointsForDrag();
|
|
||||||
void debugPathState(const QString& context) const;
|
|
||||||
|
|
||||||
QVector<QLineF> extractSegmentsFromPainterPath() const;
|
|
||||||
void collectBoundaryBypassPaths(const QPointF& start, const QPointF& end,const QList<QRectF>& obstacles,QMultiMap<double, QList<QPointF>>& paths);
|
|
||||||
void collectBoundaryPath(const QPointF& start, const QPointF& end,const QList<QRectF>& obstacles,QMultiMap<double, QList<QPointF>>& paths,const QRectF& bounds, bool useTop);
|
|
||||||
QRectF getSceneBounds() const;
|
|
||||||
QList<QPointF> generateForcedBypass(const QPointF& start, const QPointF& end,const QList<QRectF>& components);
|
|
||||||
|
|
||||||
// 拖拽实现
|
|
||||||
int findSegmentAt(const QList<QPointF>& points,const QPointF& itemPos) const;
|
|
||||||
double distanceToSegment(const QLineF& segment, const QPointF& point) const;
|
|
||||||
void fixConnections(int segmentIndex, bool isVertical);
|
|
||||||
QList<QPointF> extractPointsFromPath() const;
|
|
||||||
QList<QPointF> extractPointsFromPath(const QPainterPath& path) const;
|
|
||||||
void applyPointsToPath(const QList<QPointF>& points);
|
|
||||||
void fixConnections(QList<QPointF>& points, int segmentIndex, bool isVertical);
|
|
||||||
void validateAndFixPath();
|
|
||||||
void updateBoundingRect();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPainterPath m_points;
|
QPainterPath m_points;
|
||||||
|
QPainterPath m_pointsBoundingRect; //包裹点的矩形集合
|
||||||
QList<QPointF> m_lstPoints;
|
QList<QPointF> m_lstPoints;
|
||||||
QPoint _curLine; //参数1用点序号表示的当前线段起始点,参数2表示线段方向
|
QPoint _curLine; //参数1用点序号表示的当前线段起始点,参数2表示线段方向
|
||||||
|
|
||||||
struct DragState {
|
|
||||||
bool isActive = false;
|
|
||||||
int segmentIndex = -1;
|
|
||||||
bool isVertical = false;
|
|
||||||
QPointF startScenePos;
|
|
||||||
QPainterPath originalPath;
|
|
||||||
};
|
|
||||||
|
|
||||||
DragState m_dragData;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -18,14 +18,14 @@ public:
|
||||||
void updateCoordinate() override;
|
void updateCoordinate() override;
|
||||||
void move(const QPointF&) override;
|
void move(const QPointF&) override;
|
||||||
virtual void addSvgItem(ElectricSvgItem* item);
|
virtual void addSvgItem(ElectricSvgItem* item);
|
||||||
virtual void updateMapSvg(QMap<QString,QByteArray> map,QString sIndex = ""); //工程模property不含图片,额外存储
|
virtual void updateMapSvg(QMap<QString,QByteArray> map); //工程模property不含图片,额外存储
|
||||||
virtual void setMonitorDisplayInfo(QMap<MonitorItemStateStruct,MonitorItemDisplayInfo> info) override; //将显示数据更新到子item中
|
virtual void setMonitorDisplayInfo(QMap<monitorItemStateStruct,monitorItemDisplayInfo> info) override; //将显示数据更新到子item中
|
||||||
protected:
|
protected:
|
||||||
virtual QPainterPath shape() override;
|
virtual QPainterPath shape() override;
|
||||||
virtual void editShape(int, const QPointF&) override;
|
virtual void editShape(int, const QPointF&) override;
|
||||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
||||||
protected:
|
protected:
|
||||||
virtual void updateCurState(MonitorItemState e) override;
|
virtual void updateCurState(monitorItemState e) override;
|
||||||
protected:
|
protected:
|
||||||
QRectF m_lastBoudingRect; //记录上一时刻的boundingRect
|
QRectF m_lastBoudingRect; //记录上一时刻的boundingRect
|
||||||
QMap<QString,QByteArray> m_mapSvg;
|
QMap<QString,QByteArray> m_mapSvg;
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,8 @@ public:
|
||||||
virtual void updateItem() override;
|
virtual void updateItem() override;
|
||||||
void setCtType(int n){_nType = n;}
|
void setCtType(int n){_nType = n;}
|
||||||
void setCtSize(int n){_nSize = n;}
|
void setCtSize(int n){_nSize = n;}
|
||||||
virtual void setImage_1(QFileInfo) override;
|
|
||||||
protected:
|
protected:
|
||||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
||||||
private:
|
|
||||||
void initial();
|
|
||||||
protected:
|
protected:
|
||||||
int _nType = 0; //Ct类型 1三相0零相
|
int _nType = 0; //Ct类型 1三相0零相
|
||||||
int _nSize = 0; //ct个数
|
int _nSize = 0; //ct个数
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,8 @@ public:
|
||||||
virtual void updateItem() override;
|
virtual void updateItem() override;
|
||||||
virtual void updateLayout() override;
|
virtual void updateLayout() override;
|
||||||
QList<int>& getLstType() {return m_lstType;}
|
QList<int>& getLstType() {return m_lstType;}
|
||||||
virtual void setImage_1(QFileInfo) override;
|
|
||||||
protected:
|
protected:
|
||||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
||||||
private:
|
|
||||||
void initial();
|
|
||||||
protected:
|
protected:
|
||||||
QList<int> m_lstType; //绕组类型 1星型 0三角
|
QList<int> m_lstType; //绕组类型 1星型 0三角
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,8 @@ public:
|
||||||
void move(const QPointF&) override;
|
void move(const QPointF&) override;
|
||||||
virtual void loadSvg(){};
|
virtual void loadSvg(){};
|
||||||
virtual void loadSvg(QByteArray); //第二种load直接加载图片
|
virtual void loadSvg(QByteArray); //第二种load直接加载图片
|
||||||
virtual void updateMapSvg(QMap<QString,QByteArray> map,QString sIndex = ""); //index:空全部更新
|
virtual void updateMapSvg(QMap<QString,QByteArray> map);
|
||||||
virtual void updateCurState(MonitorItemState e) override;
|
virtual void updateCurState(monitorItemState e) override;
|
||||||
protected:
|
protected:
|
||||||
virtual QPainterPath shape() override;
|
virtual QPainterPath shape() override;
|
||||||
virtual void editShape(int, const QPointF&) override;
|
virtual void editShape(int, const QPointF&) override;
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ public:
|
||||||
ElectricSvgItem2wTransformer(const ElectricSvgItem2wTransformer&);
|
ElectricSvgItem2wTransformer(const ElectricSvgItem2wTransformer&);
|
||||||
virtual ~ElectricSvgItem2wTransformer();
|
virtual ~ElectricSvgItem2wTransformer();
|
||||||
virtual ElectricSvgItem2wTransformer* clone() const override;
|
virtual ElectricSvgItem2wTransformer* clone() const override;
|
||||||
virtual void setImage_1(QFileInfo) override;
|
|
||||||
protected:
|
protected:
|
||||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ public:
|
||||||
ElectricSvgItem3wTransformer(const ElectricSvgItem3wTransformer&);
|
ElectricSvgItem3wTransformer(const ElectricSvgItem3wTransformer&);
|
||||||
virtual ~ElectricSvgItem3wTransformer();
|
virtual ~ElectricSvgItem3wTransformer();
|
||||||
virtual ElectricSvgItem3wTransformer* clone() const override;
|
virtual ElectricSvgItem3wTransformer* clone() const override;
|
||||||
virtual void setImage_1(QFileInfo) override;
|
|
||||||
protected:
|
protected:
|
||||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
#define ELECTRICSVGITEMBUS_H
|
#define ELECTRICSVGITEMBUS_H
|
||||||
|
|
||||||
#include "electricSvgItem.h"
|
#include "electricSvgItem.h"
|
||||||
|
#include "baseProperty.h"
|
||||||
|
|
||||||
class ElectricSvgItemBus :public ElectricSvgItem
|
class ElectricSvgItemBus :public ElectricSvgItem
|
||||||
{
|
{
|
||||||
|
|
@ -11,7 +12,7 @@ public:
|
||||||
ElectricSvgItemBus(const ElectricSvgItemBus&);
|
ElectricSvgItemBus(const ElectricSvgItemBus&);
|
||||||
virtual ~ElectricSvgItemBus();
|
virtual ~ElectricSvgItemBus();
|
||||||
virtual ElectricSvgItemBus* clone() const override;
|
virtual ElectricSvgItemBus* clone() const override;
|
||||||
virtual void setImage_1(QFileInfo) override;
|
|
||||||
void addPort();
|
void addPort();
|
||||||
public:
|
public:
|
||||||
virtual void updateConnectData() override;
|
virtual void updateConnectData() override;
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ public:
|
||||||
ElectricSvgItemCableEnd(const ElectricSvgItemCableEnd&);
|
ElectricSvgItemCableEnd(const ElectricSvgItemCableEnd&);
|
||||||
virtual ~ElectricSvgItemCableEnd();
|
virtual ~ElectricSvgItemCableEnd();
|
||||||
virtual ElectricSvgItemCableEnd* clone() const override;
|
virtual ElectricSvgItemCableEnd* clone() const override;
|
||||||
virtual void setImage_1(QFileInfo) override;
|
|
||||||
protected:
|
protected:
|
||||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ public:
|
||||||
ElectricSvgItemCableTer(const ElectricSvgItemCableTer&);
|
ElectricSvgItemCableTer(const ElectricSvgItemCableTer&);
|
||||||
virtual ~ElectricSvgItemCableTer();
|
virtual ~ElectricSvgItemCableTer();
|
||||||
virtual ElectricSvgItemCableTer* clone() const override;
|
virtual ElectricSvgItemCableTer* clone() const override;
|
||||||
virtual void setImage_1(QFileInfo) override;
|
|
||||||
protected:
|
protected:
|
||||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ public:
|
||||||
ElectricSvgItemDS(const ElectricSvgItemDS&);
|
ElectricSvgItemDS(const ElectricSvgItemDS&);
|
||||||
virtual ~ElectricSvgItemDS();
|
virtual ~ElectricSvgItemDS();
|
||||||
virtual ElectricSvgItemDS* clone() const override;
|
virtual ElectricSvgItemDS* clone() const override;
|
||||||
virtual void setImage_1(QFileInfo) override;
|
|
||||||
protected:
|
protected:
|
||||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ public:
|
||||||
ElectricSvgItemDTEDS(const ElectricSvgItemDTEDS&);
|
ElectricSvgItemDTEDS(const ElectricSvgItemDTEDS&);
|
||||||
virtual ~ElectricSvgItemDTEDS();
|
virtual ~ElectricSvgItemDTEDS();
|
||||||
virtual ElectricSvgItemDTEDS* clone() const override;
|
virtual ElectricSvgItemDTEDS* clone() const override;
|
||||||
virtual void setImage_1(QFileInfo) override;
|
|
||||||
protected:
|
protected:
|
||||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ public:
|
||||||
ElectricSvgItemES(const ElectricSvgItemES&);
|
ElectricSvgItemES(const ElectricSvgItemES&);
|
||||||
virtual ~ElectricSvgItemES();
|
virtual ~ElectricSvgItemES();
|
||||||
virtual ElectricSvgItemES* clone() const override;
|
virtual ElectricSvgItemES* clone() const override;
|
||||||
virtual void setImage_1(QFileInfo) override;
|
|
||||||
protected:
|
protected:
|
||||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ public:
|
||||||
ElectricSvgItemFES(const ElectricSvgItemFES&);
|
ElectricSvgItemFES(const ElectricSvgItemFES&);
|
||||||
virtual ~ElectricSvgItemFES();
|
virtual ~ElectricSvgItemFES();
|
||||||
virtual ElectricSvgItemFES* clone() const override;
|
virtual ElectricSvgItemFES* clone() const override;
|
||||||
virtual void setImage_1(QFileInfo) override;
|
|
||||||
protected:
|
protected:
|
||||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ public:
|
||||||
ElectricSvgItemLA(const ElectricSvgItemLA&);
|
ElectricSvgItemLA(const ElectricSvgItemLA&);
|
||||||
virtual ~ElectricSvgItemLA();
|
virtual ~ElectricSvgItemLA();
|
||||||
virtual ElectricSvgItemLA* clone() const override;
|
virtual ElectricSvgItemLA* clone() const override;
|
||||||
virtual void setImage_1(QFileInfo) override;
|
|
||||||
protected:
|
protected:
|
||||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ public:
|
||||||
ElectricSvgItemPI(const ElectricSvgItemPI&);
|
ElectricSvgItemPI(const ElectricSvgItemPI&);
|
||||||
virtual ~ElectricSvgItemPI();
|
virtual ~ElectricSvgItemPI();
|
||||||
virtual ElectricSvgItemPI* clone() const override;
|
virtual ElectricSvgItemPI* clone() const override;
|
||||||
virtual void setImage_1(QFileInfo) override;
|
|
||||||
protected:
|
protected:
|
||||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ public:
|
||||||
ElectricSvgItemRect(const ElectricSvgItemRect&);
|
ElectricSvgItemRect(const ElectricSvgItemRect&);
|
||||||
virtual ~ElectricSvgItemRect();
|
virtual ~ElectricSvgItemRect();
|
||||||
virtual ElectricSvgItemRect* clone() const override;
|
virtual ElectricSvgItemRect* clone() const override;
|
||||||
virtual void setImage_1(QFileInfo) override;
|
|
||||||
protected:
|
protected:
|
||||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
||||||
virtual void updateHandles() override;
|
virtual void updateHandles() override;
|
||||||
|
|
|
||||||
|
|
@ -1,95 +0,0 @@
|
||||||
#ifndef ELECTRICFUNCTIONMODELCONNECTLINEITEM_H
|
|
||||||
#define ELECTRICFUNCTIONMODELCONNECTLINEITEM_H
|
|
||||||
|
|
||||||
#include <QPainterPath>
|
|
||||||
#include <QUuid>
|
|
||||||
#include "graphicsFunctionModelItem.h"
|
|
||||||
|
|
||||||
class ElectricFunctionModelConnectLineItem : public GraphicsFunctionModelItem
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
enum UShapeType {
|
|
||||||
UShape_Unknown,
|
|
||||||
UShape_TopOpen, // 开口向上
|
|
||||||
UShape_BottomOpen, // 开口向下
|
|
||||||
UShape_LeftOpen, // 开口向左
|
|
||||||
UShape_RightOpen // 开口向右
|
|
||||||
};
|
|
||||||
public:
|
|
||||||
ElectricFunctionModelConnectLineItem(QGraphicsItem *parent = 0);
|
|
||||||
virtual ~ElectricFunctionModelConnectLineItem();
|
|
||||||
|
|
||||||
void setStartPoint(const QPointF& p);
|
|
||||||
void setEndPoint(const QPointF& p);
|
|
||||||
QPainterPath getPoints(void) const { return m_points; }
|
|
||||||
|
|
||||||
void startDrag(const QPointF& scenePos);
|
|
||||||
void updateDrag(const QPointF& scenePos);
|
|
||||||
void endDrag();
|
|
||||||
void setLastPoint(const QPointF& point);
|
|
||||||
void setPath(const QPainterPath& path);
|
|
||||||
QPainterPath path() const;
|
|
||||||
|
|
||||||
void resetCurLine(){_curLine = QPoint();}
|
|
||||||
void calculatePath();
|
|
||||||
|
|
||||||
virtual QPainterPath shape() const override;
|
|
||||||
virtual QRectF boundingRect() const override;
|
|
||||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void initial();
|
|
||||||
private:
|
|
||||||
//路径计算相关
|
|
||||||
void generateAvoidancePath(const QPointF& start, const QPointF& end,const QList<QRectF>& obstacleShapes); // 使用形状进行避障
|
|
||||||
double calculatePathLength(const QList<QPointF>& path);
|
|
||||||
bool lineIntersectsRect(const QLineF& line, const QRectF& rect) const;
|
|
||||||
bool isSegmentSafe(const QPointF& p1, const QPointF& p2,const QList<QRectF>& components);
|
|
||||||
bool isPathSafe(const QList<QPointF>& path,const QList<QRectF>& components);
|
|
||||||
bool segmentPenetratesComponent(const QLineF& segment,const QRectF& component);
|
|
||||||
QRectF getTotalComponentsBounds(const QList<QRectF>& components);
|
|
||||||
void collectRectilinearPaths(const QPointF& start, const QPointF& end,const QList<QRectF>& components,QMultiMap<double, QList<QPointF>>& paths);
|
|
||||||
void addPathIfRectilinear(const QList<QPointF>& path,QMultiMap<double, QList<QPointF>>& paths);
|
|
||||||
void collectBypassPaths(const QPointF& start, const QPointF& end,const QList<QRectF>& components,QMultiMap<double, QList<QPointF>>& paths);
|
|
||||||
void generateForcedRectilinearBypass(const QPointF& start, const QPointF& end,const QList<QRectF>& components);
|
|
||||||
QRectF findFirstBlockingComponent(const QPointF& start, const QPointF& end,const QList<QRectF>& components);
|
|
||||||
|
|
||||||
//线段拖拽相关
|
|
||||||
double distancePointToLine(const QLineF& line, const QPointF& point) const;
|
|
||||||
void ensureEnoughPointsForDrag();
|
|
||||||
void debugPathState(const QString& context) const;
|
|
||||||
|
|
||||||
QVector<QLineF> extractSegmentsFromPainterPath() const;
|
|
||||||
void collectBoundaryBypassPaths(const QPointF& start, const QPointF& end,const QList<QRectF>& obstacles,QMultiMap<double, QList<QPointF>>& paths);
|
|
||||||
void collectBoundaryPath(const QPointF& start, const QPointF& end,const QList<QRectF>& obstacles,QMultiMap<double, QList<QPointF>>& paths,const QRectF& bounds, bool useTop);
|
|
||||||
QRectF getSceneBounds() const;
|
|
||||||
QList<QPointF> generateForcedBypass(const QPointF& start, const QPointF& end,const QList<QRectF>& components);
|
|
||||||
|
|
||||||
// 拖拽实现
|
|
||||||
int findSegmentAt(const QList<QPointF>& points,const QPointF& itemPos) const;
|
|
||||||
double distanceToSegment(const QLineF& segment, const QPointF& point) const;
|
|
||||||
void fixConnections(int segmentIndex, bool isVertical);
|
|
||||||
QList<QPointF> extractPointsFromPath() const;
|
|
||||||
QList<QPointF> extractPointsFromPath(const QPainterPath& path) const;
|
|
||||||
void applyPointsToPath(const QList<QPointF>& points);
|
|
||||||
void fixConnections(QList<QPointF>& points, int segmentIndex, bool isVertical);
|
|
||||||
void validateAndFixPath();
|
|
||||||
void updateBoundingRect();
|
|
||||||
|
|
||||||
private:
|
|
||||||
QPainterPath m_points;
|
|
||||||
QList<QPointF> m_lstPoints;
|
|
||||||
QPoint _curLine; //参数1用点序号表示的当前线段起始点,参数2表示线段方向
|
|
||||||
|
|
||||||
struct DragState {
|
|
||||||
bool isActive = false;
|
|
||||||
int segmentIndex = -1;
|
|
||||||
bool isVertical = false;
|
|
||||||
QPointF startScenePos;
|
|
||||||
QPainterPath originalPath;
|
|
||||||
};
|
|
||||||
|
|
||||||
DragState m_dragData;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
#ifndef ELECTRICFUNCTIONMODELPORTITEM_H
|
|
||||||
#define ELECTRICFUNCTIONMODELPORTITEM_H
|
|
||||||
|
|
||||||
#include "graphicsItem/functionModelItem/graphicsFunctionModelItem.h"
|
|
||||||
|
|
||||||
//node节点
|
|
||||||
class ElectricFunctionModelPortItem :public GraphicsFunctionModelItem
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
ElectricFunctionModelPortItem(QGraphicsItem *parent = 0);
|
|
||||||
virtual ~ElectricFunctionModelPortItem();
|
|
||||||
|
|
||||||
void addPort();
|
|
||||||
public:
|
|
||||||
virtual void updateConnectData() override;
|
|
||||||
protected:
|
|
||||||
virtual QRectF boundingRect() const override;
|
|
||||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
|
||||||
private:
|
|
||||||
void initial();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
||||||
#ifndef ELECTRICFUNCTIONMODELSVGGROUPCT_H
|
|
||||||
#define ELECTRICFUNCTIONMODELSVGGROUPCT_H
|
|
||||||
|
|
||||||
#include "graphicsItem/functionModelItem/graphicsFunctionModelSvgGroup.h"
|
|
||||||
|
|
||||||
class ElectricFunctionModelSvgGroupCT :public ElectricFunctionModelSvgGroup
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
ElectricFunctionModelSvgGroupCT(const QRect &rect,QGraphicsItem *parent = 0);
|
|
||||||
virtual ~ElectricFunctionModelSvgGroupCT();
|
|
||||||
virtual void setupFinish(QVariant) override;
|
|
||||||
virtual void updateItem() override;
|
|
||||||
void setCtType(int n){_nType = n;}
|
|
||||||
void setCtSize(int n){_nSize = n;}
|
|
||||||
virtual void setImage_1(QFileInfo) override;
|
|
||||||
protected:
|
|
||||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
|
||||||
private:
|
|
||||||
void initial();
|
|
||||||
protected:
|
|
||||||
int _nType = 0; //Ct类型 1三相0零相
|
|
||||||
int _nSize = 0; //ct个数
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
#ifndef ELECTRICFUNCTIONMODELSVGGROUPPT_H
|
|
||||||
#define ELECTRICFUNCTIONMODELSVGGROUPPT_H
|
|
||||||
|
|
||||||
#include "graphicsItem/functionModelItem/graphicsFunctionModelSvgGroup.h"
|
|
||||||
|
|
||||||
class ElectricFunctionModelSvgGroupPT :public ElectricFunctionModelSvgGroup
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
ElectricFunctionModelSvgGroupPT(const QRect &rect,QGraphicsItem *parent = 0);
|
|
||||||
virtual ~ElectricFunctionModelSvgGroupPT();
|
|
||||||
virtual void setupFinish(QVariant) override;
|
|
||||||
virtual void updateItem() override;
|
|
||||||
virtual void updateLayout() override;
|
|
||||||
QList<int>& getLstType() {return m_lstType;}
|
|
||||||
virtual void setImage_1(QFileInfo) override;
|
|
||||||
protected:
|
|
||||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
|
||||||
private:
|
|
||||||
void initial();
|
|
||||||
protected:
|
|
||||||
QList<int> m_lstType; //绕组类型 1星型 0三角
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
||||||
#ifndef ELECTRICFUNCTIONMODELSVGITEM_H
|
|
||||||
#define ELECTRICFUNCTIONMODELSVGITEM_H
|
|
||||||
|
|
||||||
#include "graphicsFunctionModelItem.h"
|
|
||||||
|
|
||||||
class ElectricFunctionModelSvgItem :public GraphicsFunctionModelItem
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
ElectricFunctionModelSvgItem(const QRect &rect, bool genNewPort = true,QGraphicsItem *parent = 0); //genNewPort生成新接线点
|
|
||||||
virtual ~ElectricFunctionModelSvgItem();
|
|
||||||
void resize(int,double, double, const QPointF&) override;
|
|
||||||
void updateCoordinate() override;
|
|
||||||
void move(const QPointF&) override;
|
|
||||||
virtual void loadSvg(){};
|
|
||||||
virtual void loadSvg(QByteArray); //第二种load直接加载图片
|
|
||||||
virtual void updateMapSvg(QMap<QString,QByteArray> map,QString sIndex = ""); //index:空全部更新
|
|
||||||
virtual void updateCurState(MonitorItemState e) override;
|
|
||||||
protected:
|
|
||||||
virtual QPainterPath shape() override;
|
|
||||||
virtual void editShape(int, const QPointF&) override;
|
|
||||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
|
||||||
protected:
|
|
||||||
QRectF m_lastBoudingRect; //记录上一时刻的boundingRect
|
|
||||||
QSvgRenderer* m_pRender; //默认
|
|
||||||
QSvgRenderer* m_pCustomRender; //定制
|
|
||||||
QMap<QString,QByteArray> m_mapSvg;
|
|
||||||
QByteArray _tempSvg; //保存直接加载的svg数据
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
#ifndef ELECTRICFUNCTIONMODELSVGITEM2WTRANSFORMER_H
|
|
||||||
#define ELECTRICFUNCTIONMODELSVGITEM2WTRANSFORMER_H
|
|
||||||
|
|
||||||
/*************两绕组变压器***********/
|
|
||||||
#include "electricFunctionModelSvgItem.h"
|
|
||||||
|
|
||||||
class ElectricFunctionModelSvgItem2wTransformer :public ElectricFunctionModelSvgItem
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
ElectricFunctionModelSvgItem2wTransformer(const QRect &rect,QGraphicsItem *parent = 0);
|
|
||||||
virtual ~ElectricFunctionModelSvgItem2wTransformer();
|
|
||||||
virtual void setImage_1(QFileInfo) override;
|
|
||||||
protected:
|
|
||||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
|
||||||
private:
|
|
||||||
void initial();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
#ifndef ELECTRICFUNCTIONMODELSVGITEM3WTRANSFORMER_H
|
|
||||||
#define ELECTRICFUNCTIONMODELSVGITEM3WTRANSFORMER_H
|
|
||||||
|
|
||||||
/*************三绕组变压器***********/
|
|
||||||
#include "electricFunctionModelSvgItem.h"
|
|
||||||
|
|
||||||
class ElectricFunctionModelSvgItem3wTransformer :public ElectricFunctionModelSvgItem
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
ElectricFunctionModelSvgItem3wTransformer(const QRect &rect,QGraphicsItem *parent = 0);
|
|
||||||
virtual ~ElectricFunctionModelSvgItem3wTransformer();
|
|
||||||
virtual void setImage_1(QFileInfo) override;
|
|
||||||
protected:
|
|
||||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
|
||||||
private:
|
|
||||||
void initial();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
#ifndef ELECTRICFUNCTIONMODELSVGITEMBUS_H
|
|
||||||
#define ELECTRICFUNCTIONMODELSVGITEMBUS_H
|
|
||||||
|
|
||||||
#include "electricFunctionModelSvgItem.h"
|
|
||||||
|
|
||||||
class ElectricFunctionModelSvgItemBus :public ElectricFunctionModelSvgItem
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
ElectricFunctionModelSvgItemBus(const QRect &rect, QGraphicsItem *parent = 0);
|
|
||||||
virtual ~ElectricFunctionModelSvgItemBus();
|
|
||||||
virtual void setImage_1(QFileInfo) override;
|
|
||||||
void addPort();
|
|
||||||
public:
|
|
||||||
virtual void updateConnectData() override;
|
|
||||||
protected:
|
|
||||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
|
||||||
virtual void updateHandles() override;
|
|
||||||
private:
|
|
||||||
void initial();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
#ifndef ELECTRICFUNCTIONMODELSVGITEMCB_H
|
|
||||||
#define ELECTRICFUNCTIONMODELSVGITEMCB_H
|
|
||||||
|
|
||||||
/*****************断路器*******************/
|
|
||||||
#include "electricFunctionModelSvgItem.h"
|
|
||||||
|
|
||||||
|
|
||||||
class ElectricFunctionModelSvgItemCB :public ElectricFunctionModelSvgItem
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
ElectricFunctionModelSvgItemCB(const QRect &rect, bool genNewPort = true,QGraphicsItem *parent = 0);
|
|
||||||
virtual ~ElectricFunctionModelSvgItemCB();
|
|
||||||
virtual void setImage_1(QFileInfo) override;
|
|
||||||
protected:
|
|
||||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
|
||||||
virtual void updateHandles() override;
|
|
||||||
private:
|
|
||||||
void initial();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
#ifndef ELECTRICSVGITEMCT_H
|
|
||||||
#define ELECTRICSVGITEMCT_H
|
|
||||||
|
|
||||||
#include "electricFunctionModelSvgItem.h"
|
|
||||||
|
|
||||||
class ElectricFunctionModelSvgItemCT :public ElectricFunctionModelSvgItem
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
ElectricFunctionModelSvgItemCT(const QRect &rect,QGraphicsItem *parent = 0);
|
|
||||||
virtual ~ElectricFunctionModelSvgItemCT();
|
|
||||||
void setItemType(int n){_itemType = n;}
|
|
||||||
private:
|
|
||||||
void initial();
|
|
||||||
protected:
|
|
||||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
|
||||||
|
|
||||||
int _itemType = 0; //1三相0零相
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
#ifndef ELECTRICFUNCTIONMODELSVGITEMCABLEEND_H
|
|
||||||
#define ELECTRICFUNCTIONMODELSVGITEMCABLEEND_H
|
|
||||||
|
|
||||||
/*****************电缆端*******************/
|
|
||||||
#include "electricFunctionModelSvgItem.h"
|
|
||||||
|
|
||||||
class ElectricFunctionModelSvgItemCableEnd :public ElectricFunctionModelSvgItem
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
ElectricFunctionModelSvgItemCableEnd(const QRect &rect,QGraphicsItem *parent = 0);
|
|
||||||
virtual ~ElectricFunctionModelSvgItemCableEnd();
|
|
||||||
virtual void setImage_1(QFileInfo) override;
|
|
||||||
protected:
|
|
||||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
|
||||||
private:
|
|
||||||
void initial();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
#ifndef ELECTRICFUNCTIONMODELSVGITEMCABLETER_H
|
|
||||||
#define ELECTRICFUNCTIONMODELSVGITEMCABLETER_H
|
|
||||||
|
|
||||||
/*****************电缆出线套筒*******************/
|
|
||||||
#include "electricFunctionModelSvgItem.h"
|
|
||||||
|
|
||||||
class ElectricFunctionModelSvgItemCableTer :public ElectricFunctionModelSvgItem
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
ElectricFunctionModelSvgItemCableTer(const QRect &rect,QGraphicsItem *parent = 0);
|
|
||||||
virtual ~ElectricFunctionModelSvgItemCableTer();
|
|
||||||
virtual void setImage_1(QFileInfo) override;
|
|
||||||
protected:
|
|
||||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
|
||||||
private:
|
|
||||||
void initial();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
#ifndef ELECTRICFUNCTIONMODELSVGITEMDS_H
|
|
||||||
#define ELECTRICFUNCTIONMODELSVGITEMDS_H
|
|
||||||
|
|
||||||
#include "electricFunctionModelSvgItem.h"
|
|
||||||
|
|
||||||
class ElectricFunctionModelSvgItemDS :public ElectricFunctionModelSvgItem
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
ElectricFunctionModelSvgItemDS(const QRect &rect,QGraphicsItem *parent = 0);
|
|
||||||
virtual ~ElectricFunctionModelSvgItemDS();
|
|
||||||
virtual void setImage_1(QFileInfo) override;
|
|
||||||
protected:
|
|
||||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
|
||||||
private:
|
|
||||||
void initial();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
#ifndef ELECTRICFUNCTIONMODELSVGITEMDTEDS_H
|
|
||||||
#define ELECTRICFUNCTIONMODELSVGITEMDTEDS_H
|
|
||||||
|
|
||||||
/**********双掷接地隔离开关*********/
|
|
||||||
#include "electricFunctionModelSvgItem.h"
|
|
||||||
|
|
||||||
class ElectricFunctionModelSvgItemDTEDS:public ElectricFunctionModelSvgItem
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
ElectricFunctionModelSvgItemDTEDS(const QRect &rect,QGraphicsItem *parent = 0);
|
|
||||||
virtual ~ElectricFunctionModelSvgItemDTEDS();
|
|
||||||
virtual void setImage_1(QFileInfo) override;
|
|
||||||
protected:
|
|
||||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
|
||||||
private:
|
|
||||||
void inital();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
#ifndef ELECTRICFUNCTIONMODELSVGITEMES_H
|
|
||||||
#define ELECTRICFUNCTIONMODELSVGITEMES_H
|
|
||||||
|
|
||||||
#include "electricFunctionModelSvgItem.h"
|
|
||||||
|
|
||||||
class ElectricFunctionModelSvgItemES :public ElectricFunctionModelSvgItem
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
ElectricFunctionModelSvgItemES(const QRect &rect,QGraphicsItem *parent = 0);
|
|
||||||
virtual ~ElectricFunctionModelSvgItemES();
|
|
||||||
virtual void setImage_1(QFileInfo) override;
|
|
||||||
protected:
|
|
||||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
|
||||||
private:
|
|
||||||
void initial();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
#ifndef ELECTRICFUNCTIONMODELSVGITEMFES_H
|
|
||||||
#define ELECTRICFUNCTIONMODELSVGITEMFES_H
|
|
||||||
|
|
||||||
#include "electricFunctionModelSvgItem.h"
|
|
||||||
|
|
||||||
class ElectricFunctionModelSvgItemFES :public ElectricFunctionModelSvgItem
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
ElectricFunctionModelSvgItemFES(const QRect &rect,QGraphicsItem *parent = 0);
|
|
||||||
virtual ~ElectricFunctionModelSvgItemFES();
|
|
||||||
virtual void setImage_1(QFileInfo) override;
|
|
||||||
protected:
|
|
||||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
|
||||||
private:
|
|
||||||
void initial();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
#ifndef ELECTRICFUNCTIONMODELSVGITEMLA_H
|
|
||||||
#define ELECTRICFUNCTIONMODELSVGITEMLA_H
|
|
||||||
|
|
||||||
/***********避雷器************/
|
|
||||||
#include "electricFunctionModelSvgItem.h"
|
|
||||||
|
|
||||||
class ElectricFunctionModelSvgItemLA :public ElectricFunctionModelSvgItem
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
ElectricFunctionModelSvgItemLA(const QRect &rect,QGraphicsItem *parent = 0);
|
|
||||||
virtual ~ElectricFunctionModelSvgItemLA();
|
|
||||||
virtual void setImage_1(QFileInfo) override;
|
|
||||||
protected:
|
|
||||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
|
||||||
private:
|
|
||||||
void initial();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
#ifndef ELECTRICFUNCTIONMODELSVGITEMPI_H
|
|
||||||
#define ELECTRICFUNCTIONMODELSVGITEMPI_H
|
|
||||||
|
|
||||||
/*************带点指示器***************/
|
|
||||||
#include "electricFunctionModelSvgItem.h"
|
|
||||||
|
|
||||||
class ElectricFunctionModelSvgItemPI :public ElectricFunctionModelSvgItem
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
ElectricFunctionModelSvgItemPI(const QRect &rect,QGraphicsItem *parent = 0);
|
|
||||||
virtual ~ElectricFunctionModelSvgItemPI();
|
|
||||||
virtual void setImage_1(QFileInfo) override;
|
|
||||||
protected:
|
|
||||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
|
||||||
private:
|
|
||||||
void initial();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
#ifndef ELECTRICFUNCTIONMODELSVGITEMPT_H
|
|
||||||
#define ELECTRICFUNCTIONMODELSVGITEMPT_H
|
|
||||||
|
|
||||||
#include "electricFunctionModelSvgItem.h"
|
|
||||||
|
|
||||||
class ElectricFunctionModelSvgItemPT :public ElectricFunctionModelSvgItem
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
ElectricFunctionModelSvgItemPT(const QRect &rect,QGraphicsItem *parent = 0);
|
|
||||||
virtual ~ElectricFunctionModelSvgItemPT();
|
|
||||||
void setItemType(int n){_itemType = n;}
|
|
||||||
protected:
|
|
||||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
|
||||||
private:
|
|
||||||
void initial();
|
|
||||||
|
|
||||||
int _itemType = 0; //1星型 0三角
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,41 +0,0 @@
|
||||||
#ifndef GRAPHICSFUNCTIONMODELITEM_H
|
|
||||||
#define GRAPHICSFUNCTIONMODELITEM_H
|
|
||||||
|
|
||||||
#include "../graphicsBaseItem.h"
|
|
||||||
|
|
||||||
class GraphicsFunctionModelItem : public GraphicsProjectModelItem //功能模item
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
GraphicsFunctionModelItem(QGraphicsItem *parent);
|
|
||||||
virtual ~GraphicsFunctionModelItem();
|
|
||||||
protected:
|
|
||||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class GraphicsFunctionModelGroup : public GraphicsFunctionModelItem //功能模group
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
GraphicsFunctionModelGroup(QGraphicsItem *parent);
|
|
||||||
virtual ~GraphicsFunctionModelGroup();
|
|
||||||
virtual void addItem(GraphicsFunctionModelItem* item);
|
|
||||||
virtual void updateLayout();
|
|
||||||
virtual void setLayout(int n) {m_direction = n;}
|
|
||||||
virtual void setGroupType(int n) {_groupType = n;}
|
|
||||||
virtual int getGroupType() {return _groupType;}
|
|
||||||
virtual void setSpacing(qreal spacing) {
|
|
||||||
if (m_spacing != spacing) {
|
|
||||||
m_spacing = spacing;
|
|
||||||
updateLayout();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
QRectF updateBoundRect();
|
|
||||||
protected:
|
|
||||||
QList<GraphicsBaseItem*> m_childItems;
|
|
||||||
int m_direction = 1; //组内布局,0横1纵
|
|
||||||
int m_spacing = 0; //间距
|
|
||||||
int _groupType = 0; //组类型,0联合(子item独立连接),1聚合(子item仅作展示)
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
#ifndef ELECTRICFUNCTIONMODELSVGGROUP_H
|
|
||||||
#define ELECTRICFUNCTIONMODELSVGGROUP_H
|
|
||||||
|
|
||||||
#include "graphicsFunctionModelItem.h"
|
|
||||||
#include <QGraphicsSvgItem>
|
|
||||||
|
|
||||||
class ElectricFunctionModelSvgItem;
|
|
||||||
|
|
||||||
class ElectricFunctionModelSvgGroup :public GraphicsFunctionModelGroup
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
ElectricFunctionModelSvgGroup(const QRect &rect,QGraphicsItem *parent = 0);
|
|
||||||
virtual ~ElectricFunctionModelSvgGroup();
|
|
||||||
void resize(int,double, double, const QPointF&) override;
|
|
||||||
void updateCoordinate() override;
|
|
||||||
void move(const QPointF&) override;
|
|
||||||
virtual void addSvgItem(ElectricFunctionModelSvgItem* item);
|
|
||||||
virtual void updateMapSvg(QMap<QString,QByteArray> map,QString sIndex = ""); //工程模property不含图片,额外存储
|
|
||||||
virtual void setMonitorDisplayInfo(QMap<MonitorItemStateStruct,MonitorItemDisplayInfo> info) override; //将显示数据更新到子item中
|
|
||||||
protected:
|
|
||||||
virtual QPainterPath shape() override;
|
|
||||||
virtual void editShape(int, const QPointF&) override;
|
|
||||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
|
||||||
protected:
|
|
||||||
virtual void updateCurState(MonitorItemState e) override;
|
|
||||||
protected:
|
|
||||||
QRectF m_lastBoudingRect; //记录上一时刻的boundingRect
|
|
||||||
QMap<QString,QByteArray> m_mapSvg;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -2,11 +2,7 @@
|
||||||
#define GRAPHICSBASEITEM_H
|
#define GRAPHICSBASEITEM_H
|
||||||
|
|
||||||
#include "itemControlHandle.h"
|
#include "itemControlHandle.h"
|
||||||
//#include "global.h"
|
#include "global.h"
|
||||||
#include "common/core_model/types.h"
|
|
||||||
#include "common/core_model/topology.h"
|
|
||||||
#include "common/frontend/graphics_items.h"
|
|
||||||
#include "common/frontend/monitor_item.h"
|
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QGraphicsItem>
|
#include <QGraphicsItem>
|
||||||
|
|
@ -15,12 +11,8 @@
|
||||||
#include <QGraphicsSvgItem>
|
#include <QGraphicsSvgItem>
|
||||||
#include <QUuid>
|
#include <QUuid>
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include <QFileInfo>
|
|
||||||
#include "propertyType/dataSourceType.h"
|
|
||||||
//#include "graphicsItem/itemPort.h"
|
//#include "graphicsItem/itemPort.h"
|
||||||
|
|
||||||
class FixedPortsModel;
|
|
||||||
|
|
||||||
enum ShapeType
|
enum ShapeType
|
||||||
{
|
{
|
||||||
T_undefined,
|
T_undefined,
|
||||||
|
|
@ -178,39 +170,12 @@ protected:
|
||||||
class GraphicsBaseItem :public QObject, public AbstractShapeType<QGraphicsItem>
|
class GraphicsBaseItem :public QObject, public AbstractShapeType<QGraphicsItem>
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
enum RotateAngle {
|
|
||||||
Angle_0 = 0,
|
|
||||||
Angle_90 = 90,
|
|
||||||
Angle_180 = 180,
|
|
||||||
Angle_270 = 270
|
|
||||||
};
|
|
||||||
Q_ENUM(RotateAngle);
|
|
||||||
|
|
||||||
Q_PROPERTY(QString Name READ getName WRITE setName)
|
|
||||||
Q_PROPERTY(QPointF Position READ getPosition WRITE setPosition NOTIFY posChanged)
|
|
||||||
Q_PROPERTY(QRectF Size READ getSize WRITE setSize)
|
|
||||||
Q_PROPERTY(RotateAngle Rotation READ getRotateAngle WRITE setRotateAngle)
|
|
||||||
Q_PROPERTY(QFileInfo Image READ getImage_1 WRITE setImage_1)
|
|
||||||
public:
|
|
||||||
GraphicsBaseItem(QGraphicsItem *parent);
|
GraphicsBaseItem(QGraphicsItem *parent);
|
||||||
GraphicsBaseItem(const GraphicsBaseItem&);
|
GraphicsBaseItem(const GraphicsBaseItem&);
|
||||||
virtual ~GraphicsBaseItem();
|
virtual ~GraphicsBaseItem();
|
||||||
virtual GraphicsBaseItem* clone() const = 0;
|
virtual GraphicsBaseItem* clone() const = 0;
|
||||||
signals:
|
|
||||||
void itemRotated(GraphicsBaseItem*);
|
|
||||||
void posChanged();
|
|
||||||
public:
|
|
||||||
virtual QString getName() const;
|
|
||||||
virtual void setName(QString);
|
|
||||||
virtual QPointF getPosition() const;
|
|
||||||
virtual void setPosition(QPointF);
|
|
||||||
virtual QRectF getSize() const;
|
|
||||||
virtual void setSize(QRectF);
|
|
||||||
virtual RotateAngle getRotateAngle() const;
|
|
||||||
virtual void setRotateAngle(RotateAngle);
|
|
||||||
virtual QFileInfo getImage_1() const;
|
|
||||||
virtual void setImage_1(QFileInfo);
|
|
||||||
public:
|
public:
|
||||||
int addPort(PortState typ,QPointF vec,QString id = "",HandleType hType = T_lineInOut,PortPos pos = P_top,double dXPercent = 0,double dYPercent = 0); //新建,返回-1失败
|
int addPort(PortState typ,QPointF vec,QString id = "",HandleType hType = T_lineInOut,PortPos pos = P_top,double dXPercent = 0,double dYPercent = 0); //新建,返回-1失败
|
||||||
virtual void movePort(QString id,QPointF vec); //移动可动点
|
virtual void movePort(QString id,QPointF vec); //移动可动点
|
||||||
|
|
@ -240,10 +205,6 @@ public:
|
||||||
virtual bool hasDynamicText(const QString& tag);
|
virtual bool hasDynamicText(const QString& tag);
|
||||||
virtual void setDynamicLayoutRadius(qreal radius);
|
virtual void setDynamicLayoutRadius(qreal radius);
|
||||||
virtual QMap<QString,HandleText*> getDynamicText() {return m_mapDynamicText;}
|
virtual QMap<QString,HandleText*> getDynamicText() {return m_mapDynamicText;}
|
||||||
void setHandle(FixedPortsModel* p){_pHandle = p;}
|
|
||||||
virtual void img_1_selected(QString sMeta,QString sModel,QByteArray img){};
|
|
||||||
virtual void img_2_selected(QString sMeta,QString sModel,QByteArray img){};
|
|
||||||
virtual void img_3_selected(QString sMeta,QString sModel,QByteArray img){};
|
|
||||||
|
|
||||||
int collidesWithHandle(const QPointF& point)
|
int collidesWithHandle(const QPointF& point)
|
||||||
{
|
{
|
||||||
|
|
@ -527,10 +488,7 @@ public slots:
|
||||||
void onUpdateData(); //data发送的更新通知
|
void onUpdateData(); //data发送的更新通知
|
||||||
protected:
|
protected:
|
||||||
void rearrangeDynamicText(); //重新设置动态数据的布局
|
void rearrangeDynamicText(); //重新设置动态数据的布局
|
||||||
QList<QRectF> getAllComponentRects() const; //获取图所有碰撞矩形
|
|
||||||
QList<QPainterPath> getObstacleShapes() const; //获取所有碰撞shape
|
|
||||||
protected:
|
protected:
|
||||||
FixedPortsModel* _pHandle;
|
|
||||||
ModelProperty* _property;
|
ModelProperty* _property;
|
||||||
PowerEntity* _pEntity; //图元拓扑
|
PowerEntity* _pEntity; //图元拓扑
|
||||||
bool _itemChanged; //图元变化标志,判断是否需要保存
|
bool _itemChanged; //图元变化标志,判断是否需要保存
|
||||||
|
|
@ -542,8 +500,6 @@ protected:
|
||||||
QRectF m_boundingRect_selected; //选中矩形框
|
QRectF m_boundingRect_selected; //选中矩形框
|
||||||
bool _posChanged = false; //位置移动标志
|
bool _posChanged = false; //位置移动标志
|
||||||
bool _bMove = true; //是否允许移动
|
bool _bMove = true; //是否允许移动
|
||||||
QString m_bgImagePath; //选定的背景图路径
|
|
||||||
QStringList _itemImgIndex; //item图形索引列表
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
qreal m_layoutRadius; // 布局半径 (动态数据使用)
|
qreal m_layoutRadius; // 布局半径 (动态数据使用)
|
||||||
|
|
@ -585,9 +541,6 @@ protected:
|
||||||
class GraphicsProjectModelItem : public GraphicsBaseItem //工程模item
|
class GraphicsProjectModelItem : public GraphicsBaseItem //工程模item
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
|
||||||
Q_PROPERTY(DataSourceType DataSourceType READ getDataSourceType WRITE setDataSourceType)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GraphicsProjectModelItem(QGraphicsItem *parent);
|
GraphicsProjectModelItem(QGraphicsItem *parent);
|
||||||
GraphicsProjectModelItem(const GraphicsProjectModelItem&);
|
GraphicsProjectModelItem(const GraphicsProjectModelItem&);
|
||||||
|
|
@ -606,6 +559,11 @@ public:
|
||||||
|
|
||||||
virtual void setLabelTag(const QString& name); //设置名字牌
|
virtual void setLabelTag(const QString& name); //设置名字牌
|
||||||
virtual QString getLabelTag() const;
|
virtual QString getLabelTag() const;
|
||||||
|
virtual void setLabelCurrent(const QString& str); //设置电流标签
|
||||||
|
virtual QString getLabelCurrent() const;
|
||||||
|
virtual void setLabelVoltage(const QString& str); //设置电压标签
|
||||||
|
virtual QString getLabelVoltage() const;
|
||||||
|
//virtual void addPort(PortState typ,int ntagId,QPointF vec); //载入 PortState为P_const时,QPointF中为(0~1,0~1)的相对位置;PortState为p_movable时,QPointF为坐标值
|
||||||
virtual void setState(ItemState s){m_state = s;}
|
virtual void setState(ItemState s){m_state = s;}
|
||||||
virtual void setBeginConnectPos(QPointF p){m_beginConnectPoint = p;}
|
virtual void setBeginConnectPos(QPointF p){m_beginConnectPoint = p;}
|
||||||
virtual void setEndConnectPos(QPointF p){m_endConnectPoint = p;}
|
virtual void setEndConnectPos(QPointF p){m_endConnectPoint = p;}
|
||||||
|
|
@ -619,10 +577,9 @@ public:
|
||||||
virtual void setupFinish(QVariant){} //设置完成后调用(如ct,pt)
|
virtual void setupFinish(QVariant){} //设置完成后调用(如ct,pt)
|
||||||
virtual void updateItem(){}; //更新自身(如ct,pt)
|
virtual void updateItem(){}; //更新自身(如ct,pt)
|
||||||
virtual void updateTerPos(); //ct,pt等item大小变动后重新计算端点位置
|
virtual void updateTerPos(); //ct,pt等item大小变动后重新计算端点位置
|
||||||
|
virtual void setCurMonitorState(monitorItemState sta) {_curMonitorState = sta;} //设置当前运行时模式
|
||||||
virtual void setCurMonitorState(MonitorItemState sta) {_curMonitorState = sta;} //设置当前运行时模式
|
virtual void setMonitorDisplayInfo(QMap<monitorItemStateStruct,monitorItemDisplayInfo> info){_displaySetting = info;}
|
||||||
virtual void setMonitorDisplayInfo(QMap<MonitorItemStateStruct,MonitorItemDisplayInfo> info){_displaySetting = info;}
|
virtual void updateCurState(monitorItemState e){ //更新当前显示模式(运行时)
|
||||||
virtual void updateCurState(MonitorItemState e){ //更新当前显示模式(运行时)
|
|
||||||
if(ifStateExist(e)){
|
if(ifStateExist(e)){
|
||||||
_curMonitorState = e;
|
_curMonitorState = e;
|
||||||
auto info = getInfoByState(e);
|
auto info = getInfoByState(e);
|
||||||
|
|
@ -631,9 +588,6 @@ public:
|
||||||
_curMonitorStateEnable = info.bEnable;
|
_curMonitorStateEnable = info.bEnable;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public:
|
|
||||||
DataSourceType getDataSourceType() const;
|
|
||||||
void setDataSourceType(DataSourceType);
|
|
||||||
protected:
|
protected:
|
||||||
virtual QVariant itemChange(QGraphicsItem::GraphicsItemChange, const QVariant&) override;
|
virtual QVariant itemChange(QGraphicsItem::GraphicsItemChange, const QVariant&) override;
|
||||||
virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent*) override;
|
virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent*) override;
|
||||||
|
|
@ -643,7 +597,7 @@ signals:
|
||||||
public slots:
|
public slots:
|
||||||
void onEditNameFinish(const QString&);
|
void onEditNameFinish(const QString&);
|
||||||
protected:
|
protected:
|
||||||
bool ifStateExist(MonitorItemState sta){ //判断指定状态存在
|
bool ifStateExist(monitorItemState sta){ //判断指定状态存在
|
||||||
for(auto iter = _displaySetting.begin();iter != _displaySetting.end();++iter){
|
for(auto iter = _displaySetting.begin();iter != _displaySetting.end();++iter){
|
||||||
if(iter.key().eState == sta){
|
if(iter.key().eState == sta){
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -651,13 +605,13 @@ protected:
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
MonitorItemDisplayInfo getInfoByState(MonitorItemState sta){ //返回指定状态设置值
|
monitorItemDisplayInfo getInfoByState(monitorItemState sta){ //返回指定状态设置值
|
||||||
for(auto iter = _displaySetting.begin();iter != _displaySetting.end();++iter){
|
for(auto iter = _displaySetting.begin();iter != _displaySetting.end();++iter){
|
||||||
if(iter.key().eState == sta){
|
if(iter.key().eState == sta){
|
||||||
return iter.value();
|
return iter.value();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return MonitorItemDisplayInfo();
|
return monitorItemDisplayInfo();
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
ItemState m_state;
|
ItemState m_state;
|
||||||
|
|
@ -665,14 +619,11 @@ protected:
|
||||||
QPointF m_endConnectPoint;
|
QPointF m_endConnectPoint;
|
||||||
int _lastPort; //最后触碰的port
|
int _lastPort; //最后触碰的port
|
||||||
QString _modelName; //当前图元使用的模型名,用来在model中检索属性信息
|
QString _modelName; //当前图元使用的模型名,用来在model中检索属性信息
|
||||||
|
monitorItemState _curMonitorState; //当前运行时模式
|
||||||
MonitorItemState _curMonitorState; //当前运行时模式
|
|
||||||
QColor _curMonitorStateColor;
|
QColor _curMonitorStateColor;
|
||||||
QByteArray _curMonitorStateSvg;
|
QByteArray _curMonitorStateSvg;
|
||||||
bool _curMonitorStateEnable;
|
bool _curMonitorStateEnable;
|
||||||
QMap<MonitorItemStateStruct,MonitorItemDisplayInfo> _displaySetting; //显示设置
|
QMap<monitorItemStateStruct,monitorItemDisplayInfo> _displaySetting; //显示设置
|
||||||
|
|
||||||
DataSourceType _sourceType;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class GraphicsProjectModelGroup : public GraphicsProjectModelItem //工程模group
|
class GraphicsProjectModelGroup : public GraphicsProjectModelItem //工程模group
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,7 @@
|
||||||
#define ITEMCONTROLHANDLE_H
|
#define ITEMCONTROLHANDLE_H
|
||||||
|
|
||||||
#include <QGraphicsRectItem>
|
#include <QGraphicsRectItem>
|
||||||
//#include "global.h"
|
#include "global.h"
|
||||||
#include "common/core_model/topology.h"
|
|
||||||
|
|
||||||
const int HNDLE_SIZE = 8;
|
const int HNDLE_SIZE = 8;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,7 @@
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
//#include "global.h"
|
#include "global.h"
|
||||||
#include "common/core_model/topology.h"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 属性层级信息管理
|
* 属性层级信息管理
|
||||||
|
|
@ -33,8 +32,7 @@ public:
|
||||||
QStringList getGrids() const;
|
QStringList getGrids() const;
|
||||||
QStringList getZones(const QString& grid = "") const;
|
QStringList getZones(const QString& grid = "") const;
|
||||||
QStringList getStations(const QString& grid = "", const QString& zone = "") const;
|
QStringList getStations(const QString& grid = "", const QString& zone = "") const;
|
||||||
private:
|
|
||||||
QString removeSuffix(const QString& str); //移除最后一个下划线后的内容 (处理各种tag后缀)
|
|
||||||
private:
|
private:
|
||||||
QMap<QString, ExtraProperty> m_props; // 内存缓存
|
QMap<QString, ExtraProperty> m_props; // 内存缓存
|
||||||
};
|
};
|
||||||
|
|
@ -5,9 +5,7 @@
|
||||||
#include <QMetaType>
|
#include <QMetaType>
|
||||||
#include <QButtonGroup>
|
#include <QButtonGroup>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
//#include "global.h"
|
#include "global.h"
|
||||||
#include "common/backend/project_model.h"
|
|
||||||
#include "common/core_model/data_transmission.h"
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
namespace Ui { class itemPropertyDlg; }
|
namespace Ui { class itemPropertyDlg; }
|
||||||
|
|
@ -25,9 +23,9 @@ public:
|
||||||
~ItemPropertyDlg();
|
~ItemPropertyDlg();
|
||||||
|
|
||||||
void initial();
|
void initial();
|
||||||
void loadGroupButton(QMap<QString,GroupStateInfo>); //加载属性组列表
|
void loadGroupButton(QMap<QString,groupStateInfo>); //加载属性组列表
|
||||||
void createGroupView(const QString&); //创建属性页
|
void createGroupView(const QString&); //创建属性页
|
||||||
void showDlg(ModelDataInfo,QUuid,GraphicsProjectModelItem*); //显示属性页面
|
void showDlg(modelDataInfo,QUuid,GraphicsProjectModelItem*); //显示属性页面
|
||||||
void setModelController(FixedPortsModel* p) {_curModelController = p;}
|
void setModelController(FixedPortsModel* p) {_curModelController = p;}
|
||||||
auto getModelController() {return _curModelController;}
|
auto getModelController() {return _curModelController;}
|
||||||
auto getCurItem() {return _curItem;}
|
auto getCurItem() {return _curItem;}
|
||||||
|
|
@ -46,8 +44,8 @@ private:
|
||||||
QMap<QString, QAbstractButton*> btnMap_;
|
QMap<QString, QAbstractButton*> btnMap_;
|
||||||
|
|
||||||
QMap<QString, QWidget*> groupViews_; //stack中存储的属性页
|
QMap<QString, QWidget*> groupViews_; //stack中存储的属性页
|
||||||
QMap<QString,GroupStateInfo> groupInfo_; //属性组结构信息
|
QMap<QString,groupStateInfo> groupInfo_; //属性组结构信息
|
||||||
QMap<QString,GroupStateValue> groupValue_; //属性数据
|
QMap<QString,groupStateValue> groupValue_; //属性数据
|
||||||
QUuid curUuid_; //当前显示对象的uuid
|
QUuid curUuid_; //当前显示对象的uuid
|
||||||
QString _curModel; //当前模型名
|
QString _curModel; //当前模型名
|
||||||
GraphicsProjectModelItem* _curItem;
|
GraphicsProjectModelItem* _curItem;
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,7 @@
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QButtonGroup>
|
#include <QButtonGroup>
|
||||||
//#include "global.h"
|
#include "global.h"
|
||||||
#include "common/backend/project_model.h"
|
|
||||||
#include "common/core_model/data_transmission.h"
|
|
||||||
/*******************************************************
|
/*******************************************************
|
||||||
间隔信息
|
间隔信息
|
||||||
********************************************************/
|
********************************************************/
|
||||||
|
|
@ -27,8 +25,8 @@ public:
|
||||||
void setParentType(int n) {_nParentType = n;}
|
void setParentType(int n) {_nParentType = n;}
|
||||||
void setBayComponent(BayInfoDlg* p) {_pBayComponent = p;}
|
void setBayComponent(BayInfoDlg* p) {_pBayComponent = p;}
|
||||||
void setBayMeasure(BayMeasureDlg* p) {_pBayMeasure = p;}
|
void setBayMeasure(BayMeasureDlg* p) {_pBayMeasure = p;}
|
||||||
void showDlg(int type,PropertyStateInfo,bool isDouble = false);
|
void showDlg(int type,propertyStateInfo,bool isDouble = false);
|
||||||
void showDlg(MeasurementInfo,PropertyStateInfo,bool isDouble = false,MeasurementInfo symmetryInfo = MeasurementInfo()); //修改
|
void showDlg(MeasurementInfo,propertyStateInfo,bool isDouble = false,MeasurementInfo symmetryInfo = MeasurementInfo()); //修改
|
||||||
public slots:
|
public slots:
|
||||||
void onOkClicked();
|
void onOkClicked();
|
||||||
void onCancelClicked();
|
void onCancelClicked();
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
class MonitorToolBox;
|
class MonitorToolBox;
|
||||||
class MonitorAttributeGroupDlg;
|
class MonitorAttributeGroupDlg;
|
||||||
class MonitorSideBarDlg;
|
class MonitorSideBarDlg;
|
||||||
struct MonitorItemAttributeInfo;
|
struct monitorItemAttributeInfo;
|
||||||
|
|
||||||
class MonitorAttributeDlg : public QDialog
|
class MonitorAttributeDlg : public QDialog
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue