张世豪
5 天以前 dc9dce0555beb85d1262893fd5d56747d6a83855
src/zhuye/Shouye.java
@@ -80,6 +80,8 @@
   private JLabel statusLabel;
   private JLabel speedLabel;  // 速度显示标签
   private JLabel areaNameLabel;
   private JLabel drawingBoundaryLabel;  // 正在绘制边界状态标签
   private JLabel navigationPreviewLabel;  // 导航预览模式标签
   
   // 边界警告相关
   private Timer boundaryWarningTimer;  // 边界警告检查定时器
@@ -452,6 +454,19 @@
         }
      }
      mapRenderer.setIdleTrailDurationSeconds(durationSeconds);
      // 应用边界距离显示设置和测量模式设置
      Setsys setsys = new Setsys();
      setsys.initializeFromProperties();
      mapRenderer.setBoundaryLengthVisible(setsys.isBoundaryLengthVisible());
      // 初始化测量模式
      boolean measurementEnabled = setsys.isMeasurementModeEnabled();
      mapRenderer.setMeasurementMode(measurementEnabled);
      if (measurementEnabled) {
         celiangmoshi.start();
      } else {
         celiangmoshi.stop();
      }
   }
   private void createHeaderPanel() {
@@ -498,14 +513,28 @@
      // 添加速度显示标签
      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 中靠左显示
@@ -1141,7 +1170,7 @@
         if (parentWindow != null) {
            // 使用 yaokong 包中的 RemoteControlDialog 实现
            remoteDialog = new yaokong.RemoteControlDialog(this, THEME_COLOR, speedLabel);
         } else {
         } else {/*  */
            remoteDialog = new yaokong.RemoteControlDialog((JFrame) null, THEME_COLOR, speedLabel);
         }
      }
@@ -2780,6 +2809,11 @@
      circleDialogMode = false;
      hideCircleGuidancePanel();
      enterDrawingControlMode();
      // 显示"正在绘制边界"提示
      if (drawingBoundaryLabel != null) {
         drawingBoundaryLabel.setVisible(true);
      }
      boolean enableCircleGuidance = drawingShape != null
            && "circle".equalsIgnoreCase(drawingShape.trim());
@@ -3255,7 +3289,34 @@
      if (latest == null) {
         return false;
      }
      return lastCapturedCoordinate == null || latest != lastCapturedCoordinate;
      // 检查是否有新的坐标(与上次采集的不同)
      if (lastCapturedCoordinate != null && latest == lastCapturedCoordinate) {
         return false;
      }
      // 检查定位状态是否为4(固定解)
      // 当选择割草机绘制圆形障碍物时,需要检查设备编号和定位状态
      Device device = Device.getGecaoji();
      if (device == null) {
         return false;
      }
      String positioningStatus = device.getPositioningStatus();
      if (positioningStatus == null || !"4".equals(positioningStatus.trim())) {
         return false;
      }
      // 检查设备编号是否匹配割草机编号
      String mowerId = Setsys.getPropertyValue("mowerId");
      String deviceId = device.getMowerNumber();
      if (mowerId != null && !mowerId.trim().isEmpty()) {
         if (deviceId == null || !mowerId.trim().equals(deviceId.trim())) {
            return false;
         }
      }
      return true;
   }
   private void applyCirclePrimaryButtonState(boolean enabled) {
@@ -3457,6 +3518,12 @@
         activeBoundaryMode = BoundaryCaptureMode.NONE;
      }
      endDrawingCallback = null;
      // 隐藏"正在绘制边界"提示
      if (drawingBoundaryLabel != null) {
         drawingBoundaryLabel.setVisible(false);
      }
      visualizationPanel.revalidate();
      visualizationPanel.repaint();
      setHandheldMowerIconActive(false);
@@ -3602,6 +3669,55 @@
      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;