| | |
| | | } |
| | | } |
| | | 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() { |
| | |
| | | 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) { |
| | |
| | | String obstacles, |
| | | String plannedPath, |
| | | Runnable returnAction) { |
| | | if (mapRenderer == null || !isMeaningfulValue(plannedPath)) { |
| | | if (mapRenderer == null) { |
| | | return false; |
| | | } |
| | | // 允许没有路径的预览(例如障碍物预览),只要有返回回调即可 |
| | | if (!isMeaningfulValue(plannedPath) && returnAction == null) { |
| | | return false; |
| | | } |
| | | |
| | |
| | | |
| | | mapRenderer.setCurrentBoundary(boundary, landNumber, landName); |
| | | mapRenderer.setCurrentObstacles(obstacles, landNumber); |
| | | mapRenderer.setCurrentPlannedPath(plannedPath); |
| | | // 只有在有路径时才设置路径 |
| | | if (isMeaningfulValue(plannedPath)) { |
| | | mapRenderer.setCurrentPlannedPath(plannedPath); |
| | | } else { |
| | | mapRenderer.setCurrentPlannedPath(null); |
| | | } |
| | | mapRenderer.clearHandheldBoundaryPreview(); |
| | | mapRenderer.setBoundaryPointSizeScale(1.0d); |
| | | mapRenderer.setBoundaryPointsVisible(isMeaningfulValue(boundary)); |
| | | // 启用障碍物边界点显示 |
| | | mapRenderer.setObstaclePointsVisible(isMeaningfulValue(obstacles)); |
| | | |
| | | String displayName = isMeaningfulValue(landName) ? landName : landNumber; |
| | | updateCurrentAreaName(displayName); |