添加摄像头IP+3D显示添加一个是否显示线条备注的形参
This commit is contained in:
13
UI/ui_3d.py
13
UI/ui_3d.py
@ -6,6 +6,7 @@
|
||||
# @File : 3D.py
|
||||
# @Desc : 界面上的线条3D显示
|
||||
'''
|
||||
from re import T
|
||||
import sys
|
||||
|
||||
from PySide6.QtWidgets import QApplication, QWidget, QVBoxLayout
|
||||
@ -85,9 +86,10 @@ class Target3DWidget(QWidget):
|
||||
("f", 100, 2.75, 1, 'purple')
|
||||
]
|
||||
|
||||
def __init__(self, index: int = 0, parent=None):
|
||||
def __init__(self, anno: bool, index: int = 0, parent=None):
|
||||
super().__init__(parent)
|
||||
self._index = index
|
||||
self._anno = anno
|
||||
|
||||
self.setWindowFlags(Qt.Window | Qt.FramelessWindowHint) # 无边框窗口
|
||||
self.setAttribute(Qt.WA_TranslucentBackground) # 设置背景为透明
|
||||
@ -109,7 +111,8 @@ class Target3DWidget(QWidget):
|
||||
# 绘制3D形状
|
||||
self.draw_target_shape()
|
||||
# 添加标注
|
||||
self.add_annotations()
|
||||
if self._anno:
|
||||
self.add_annotations()
|
||||
|
||||
# ========== 核心修改:X/Y/Z轴统一为1cm单位 ==========
|
||||
self.ax.set_xlabel('X')
|
||||
@ -165,7 +168,7 @@ def show(x: int, y: int, w: int, h: int, index: int):
|
||||
raise ValueError("index must be 0 or 1")
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
window = Target3DWidget(index)
|
||||
window = Target3DWidget(anno=True, index=index)
|
||||
window.setGeometry(x, y, w, h)
|
||||
window.show()
|
||||
sys.exit(app.exec())
|
||||
@ -173,5 +176,5 @@ def show(x: int, y: int, w: int, h: int, index: int):
|
||||
|
||||
# ----------测试接口----------
|
||||
if __name__ == '__main__':
|
||||
show(100, 100, 700, 700, 0) # 显示A视图窗口
|
||||
# show(100, 100, 700, 700, 1) # 显示B视图窗口
|
||||
# show(100, 100, 700, 700, 0) # 显示A视图窗口
|
||||
show(100, 100, 700, 700, 1) # 显示B视图窗口
|
||||
|
||||
Reference in New Issue
Block a user