| | |
| | | private JLabel statusLabel; |
| | | private JLabel speedLabel; // 速度显示标签 |
| | | private JLabel areaNameLabel; |
| | | private JLabel drawingBoundaryLabel; // 正在绘制边界状态标签 |
| | | private JLabel navigationPreviewLabel; // 导航预览模式标签 |
| | | |
| | | // 边界警告相关 |
| | | private Timer boundaryWarningTimer; // 边界警告检查定时器 |
| | |
| | | |
| | | // 添加速度显示标签 |
| | | speedLabel = new JLabel(""); |
| | | speedLabel.setFont(new Font("微软雅黑", Font.PLAIN, 12)); |
| | | speedLabel.setForeground(Color.GRAY); |
| | | speedLabel.setVisible(false); // 默认隐藏 |
| | | speedLabel.setFont(new Font("微软雅黑", Font.PLAIN, 12)); |
| | | speedLabel.setForeground(Color.GRAY); |
| | | speedLabel.setVisible(false); // 默认隐藏 |
| | | |
| | | // 正在绘制边界状态标签 |
| | | drawingBoundaryLabel = new JLabel("正在绘制边界"); |
| | | drawingBoundaryLabel.setFont(new Font("微软雅黑", Font.PLAIN, 14)); |
| | | drawingBoundaryLabel.setForeground(new Color(46, 139, 87)); |
| | | drawingBoundaryLabel.setVisible(false); // 默认隐藏 |
| | | |
| | | // 导航预览模式标签 |
| | | navigationPreviewLabel = new JLabel("当前导航预览模式"); |
| | | navigationPreviewLabel.setFont(new Font("微软雅黑", Font.PLAIN, 14)); |
| | | navigationPreviewLabel.setForeground(new Color(46, 139, 87)); |
| | | navigationPreviewLabel.setVisible(false); // 默认隐藏 |
| | | |
| | | // 将状态与速度放在同一行,显示在地块名称下面一行 |
| | | JPanel statusRow = new JPanel(new FlowLayout(FlowLayout.LEFT, 8, 0)); |
| | | statusRow.setOpaque(false); |
| | | statusRow.add(statusLabel); |
| | | statusRow.add(drawingBoundaryLabel); |
| | | statusRow.add(navigationPreviewLabel); |
| | | statusRow.add(speedLabel); |
| | | |
| | | // 左对齐标签与状态行,确保它们在 BoxLayout 中靠左显示 |
| | |
| | | if (parentWindow != null) { |
| | | // 使用 yaokong 包中的 RemoteControlDialog 实现 |
| | | remoteDialog = new yaokong.RemoteControlDialog(this, THEME_COLOR, speedLabel); |
| | | } else { |
| | | } else {/* */ |
| | | remoteDialog = new yaokong.RemoteControlDialog((JFrame) null, THEME_COLOR, speedLabel); |
| | | } |
| | | } |
| | |
| | | circleDialogMode = false; |
| | | hideCircleGuidancePanel(); |
| | | enterDrawingControlMode(); |
| | | |
| | | // 显示"正在绘制边界"提示 |
| | | if (drawingBoundaryLabel != null) { |
| | | drawingBoundaryLabel.setVisible(true); |
| | | } |
| | | |
| | | boolean enableCircleGuidance = drawingShape != null |
| | | && "circle".equalsIgnoreCase(drawingShape.trim()); |
| | |
| | | activeBoundaryMode = BoundaryCaptureMode.NONE; |
| | | } |
| | | endDrawingCallback = null; |
| | | |
| | | // 隐藏"正在绘制边界"提示 |
| | | if (drawingBoundaryLabel != null) { |
| | | drawingBoundaryLabel.setVisible(false); |
| | | } |
| | | |
| | | visualizationPanel.revalidate(); |
| | | visualizationPanel.repaint(); |
| | | setHandheldMowerIconActive(false); |
| | |
| | | return mapRenderer; |
| | | } |
| | | |
| | | /** |
| | | * 获取控制面板(用于导航预览时替换按钮) |
| | | * @return 控制面板 |
| | | */ |
| | | public JPanel getControlPanel() { |
| | | return controlPanel; |
| | | } |
| | | |
| | | /** |
| | | * 获取开始按钮(用于导航预览时隐藏) |
| | | * @return 开始按钮 |
| | | */ |
| | | public JButton getStartButton() { |
| | | return startBtn; |
| | | } |
| | | |
| | | /** |
| | | * 获取结束按钮(用于导航预览时隐藏) |
| | | * @return 结束按钮 |
| | | */ |
| | | public JButton getStopButton() { |
| | | return stopBtn; |
| | | } |
| | | |
| | | /** |
| | | * 设置导航预览模式标签的显示状态 |
| | | * @param visible 是否显示 |
| | | */ |
| | | public void setNavigationPreviewLabelVisible(boolean visible) { |
| | | if (navigationPreviewLabel != null) { |
| | | navigationPreviewLabel.setVisible(visible); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取可视化面板实例 |
| | | */ |
| | | public JPanel getVisualizationPanel() { |
| | | return visualizationPanel; |
| | | } |
| | | |
| | | /** |
| | | * 获取主内容面板实例(用于添加浮动按钮) |
| | | */ |
| | | public JPanel getMainContentPanel() { |
| | | return mainContentPanel; |
| | | } |
| | | |
| | | |
| | | public void updateCurrentAreaName(String areaName) { |
| | | if (areaNameLabel == null) { |
| | | return; |