| | |
| | | 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; |
| | |
| | | private String currentObstacleLandNumber; |
| | | private String boundaryName; |
| | | private boolean boundaryPointsVisible; |
| | | private boolean obstaclePointsVisible; |
| | | private double boundaryPointSizeScale = 1.0d; |
| | | private boolean previewSizingEnabled; |
| | | private String currentBoundaryLandNumber; |
| | |
| | | ); |
| | | } |
| | | |
| | | // 绘制障碍物坐标点 |
| | | 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); |
| | | } |
| | |
| | | obstacleBounds = null; |
| | | selectedObstacleName = null; |
| | | currentObstacleLandNumber = null; |
| | | obstaclePointsVisible = false; |
| | | } |
| | | |
| | | private List<Obstacledge.Obstacle> parseObstacles(String obstaclesData, String landNumber) { |
| | |
| | | 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) { |