From b315a6943e6c0d6bdf0d5f7565c570d719154d6c Mon Sep 17 00:00:00 2001
From: 张世豪 <979909237@qq.com>
Date: 星期三, 17 十二月 2025 14:56:58 +0800
Subject: [PATCH] 新增了障碍物管理页面

---
 src/zhuye/MapRenderer.java |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/src/zhuye/MapRenderer.java b/src/zhuye/MapRenderer.java
index e36d3c3..3c79352 100644
--- a/src/zhuye/MapRenderer.java
+++ b/src/zhuye/MapRenderer.java
@@ -52,6 +52,7 @@
     private static final Color GRASS_FILL_COLOR = new Color(144, 238, 144, 120);
     private static final Color GRASS_BORDER_COLOR = new Color(60, 179, 113);
     private static final Color BOUNDARY_POINT_COLOR = new Color(128, 0, 128);
+    private static final Color OBSTACLE_POINT_COLOR = new Color(255, 140, 0); // 姗欒壊锛岀敤浜庡尯鍒嗛殰纰嶇墿鐐�
     private static final Color CIRCLE_SAMPLE_COLOR = new Color(220, 20, 60, 230);
     private static final double CIRCLE_SAMPLE_SIZE = 0.54d;
     private static final double BOUNDARY_POINT_MERGE_THRESHOLD = 0.05;
@@ -71,6 +72,7 @@
     private String currentObstacleLandNumber;
     private String boundaryName;
     private boolean boundaryPointsVisible;
+    private boolean obstaclePointsVisible;
     private double boundaryPointSizeScale = 1.0d;
     private boolean previewSizingEnabled;
     private String currentBoundaryLandNumber;
@@ -385,6 +387,22 @@
             );
         }
 
+        // 缁樺埗闅滅鐗╁潗鏍囩偣
+        if (obstaclePointsVisible && hasObstacles) {
+            List<Point2D.Double> obstaclePoints = Obstacledraw.getObstaclePoints(currentObstacles);
+            if (obstaclePoints != null && !obstaclePoints.isEmpty()) {
+                double markerScale = boundaryPointSizeScale * (previewSizingEnabled ? PREVIEW_BOUNDARY_MARKER_SCALE : 1.0d);
+                pointandnumber.drawBoundaryPoints(
+                    g2d,
+                    obstaclePoints,
+                    scale,
+                    BOUNDARY_POINT_MERGE_THRESHOLD,
+                    OBSTACLE_POINT_COLOR,
+                    markerScale
+                );
+            }
+        }
+
         if (shouldRenderIdleTrail()) {
             tuowei.draw(g2d, idleMowerTrail, scale);
         }
@@ -1746,6 +1764,7 @@
         obstacleBounds = null;
         selectedObstacleName = null;
         currentObstacleLandNumber = null;
+        obstaclePointsVisible = false;
     }
 
     private List<Obstacledge.Obstacle> parseObstacles(String obstaclesData, String landNumber) {
@@ -2033,6 +2052,11 @@
         visualizationPanel.repaint();
     }
 
+    public void setObstaclePointsVisible(boolean visible) {
+        this.obstaclePointsVisible = visible;
+        visualizationPanel.repaint();
+    }
+
     public void setBoundaryPointSizeScale(double sizeScale) {
         double normalized = (Double.isFinite(sizeScale) && sizeScale > 0.0d) ? sizeScale : 1.0d;
         if (Math.abs(boundaryPointSizeScale - normalized) < 1e-6) {

--
Gitblit v1.10.0