张世豪
6 天以前 b315a6943e6c0d6bdf0d5f7565c570d719154d6c
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) {