| | |
| | | } |
| | | |
| | | /** |
| | | * 更新导航预览状态显示 |
| | | * @param active 是否处于导航预览模式 |
| | | */ |
| | | public void updateNavigationPreviewStatus(boolean active) { |
| | | setNavigationPreviewLabelVisible(active); |
| | | } |
| | | |
| | | /** |
| | | * 更新割草进度显示 |
| | | * @param percentage 完成百分比 |
| | | * @param completedArea 已完成面积(平方米) |
| | | * @param totalArea 总面积(平方米) |
| | | */ |
| | | public void updateMowingProgress(double percentage, double completedArea, double totalArea) { |
| | | if (mowingProgressLabel == null) { |
| | | return; |
| | | } |
| | | if (totalArea <= 0) { |
| | | mowingProgressLabel.setText("--%"); |
| | | mowingProgressLabel.setToolTipText("暂无地块面积数据"); |
| | | return; |
| | | } |
| | | double percent = Math.max(0.0, Math.min(100.0, percentage)); |
| | | mowingProgressLabel.setText(String.format(Locale.US, "%.1f%%", percent)); |
| | | mowingProgressLabel.setToolTipText(String.format(Locale.US, "%.1f㎡ / %.1f㎡", completedArea, totalArea)); |
| | | } |
| | | |
| | | /** |
| | | * 更新割草机速度显示 |
| | | * @param speed 速度值(单位:km/h) |
| | | */ |
| | | public void updateMowerSpeed(double speed) { |
| | | if (mowerSpeedValueLabel == null) { |
| | | return; |
| | | } |
| | | if (speed < 0) { |
| | | mowerSpeedValueLabel.setText("--"); |
| | | } else { |
| | | mowerSpeedValueLabel.setText(String.format(Locale.US, "%.1f", speed)); |
| | | } |
| | | if (mowerSpeedUnitLabel != null) { |
| | | mowerSpeedUnitLabel.setText("km/h"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取可视化面板实例 |
| | | */ |
| | | public JPanel getVisualizationPanel() { |