You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
2.2 KiB
67 lines
2.2 KiB
from PyQt5.QtWidgets import (QWidget, QVBoxLayout, QHBoxLayout, QLabel,
|
|
QPushButton, QToolBar, QAction)
|
|
from PyQt5.QtCore import Qt
|
|
from PyQt5.QtGui import QIcon
|
|
|
|
class MapView(QWidget):
|
|
def __init__(self):
|
|
super().__init__()
|
|
self.init_ui()
|
|
|
|
def init_ui(self):
|
|
# 创建主布局
|
|
main_layout = QVBoxLayout()
|
|
|
|
# 创建工具栏
|
|
toolbar = QToolBar()
|
|
toolbar.setMovable(False)
|
|
|
|
# 添加工具栏按钮
|
|
zoom_in_action = QAction("放大", self)
|
|
zoom_out_action = QAction("缩小", self)
|
|
pan_action = QAction("平移", self)
|
|
measure_action = QAction("测量", self)
|
|
|
|
toolbar.addAction(zoom_in_action)
|
|
toolbar.addAction(zoom_out_action)
|
|
toolbar.addAction(pan_action)
|
|
toolbar.addAction(measure_action)
|
|
|
|
main_layout.addWidget(toolbar)
|
|
|
|
# 创建地图显示区域
|
|
self.map_widget = QLabel("地图显示区域")
|
|
self.map_widget.setAlignment(Qt.AlignCenter)
|
|
self.map_widget.setStyleSheet("background-color: #f0f0f0; border: 1px solid #ccc;")
|
|
main_layout.addWidget(self.map_widget)
|
|
|
|
# 创建图层控制区域
|
|
layer_control = QHBoxLayout()
|
|
self.threat_layer_btn = QPushButton("威胁层")
|
|
self.path_layer_btn = QPushButton("路径层")
|
|
self.base_layer_btn = QPushButton("基础层")
|
|
|
|
layer_control.addWidget(self.threat_layer_btn)
|
|
layer_control.addWidget(self.path_layer_btn)
|
|
layer_control.addWidget(self.base_layer_btn)
|
|
|
|
main_layout.addLayout(layer_control)
|
|
|
|
self.setLayout(main_layout)
|
|
|
|
# 连接信号
|
|
self.threat_layer_btn.clicked.connect(self.toggle_threat_layer)
|
|
self.path_layer_btn.clicked.connect(self.toggle_path_layer)
|
|
self.base_layer_btn.clicked.connect(self.toggle_base_layer)
|
|
|
|
def toggle_threat_layer(self):
|
|
# TODO: 实现威胁层的显示/隐藏
|
|
pass
|
|
|
|
def toggle_path_layer(self):
|
|
# TODO: 实现路径层的显示/隐藏
|
|
pass
|
|
|
|
def toggle_base_layer(self):
|
|
# TODO: 实现基础层的显示/隐藏
|
|
pass |