From a541fbdc8812337de120aad3792a2033a5dd7afe Mon Sep 17 00:00:00 2001
From: 张世豪 <979909237@qq.com>
Date: 星期四, 25 十二月 2025 12:23:01 +0800
Subject: [PATCH] 优化了首页
---
src/zhuye/MapRenderer.java | 77 ++++++++++++++++++++++++++++++++++++++
1 files changed, 76 insertions(+), 1 deletions(-)
diff --git a/src/zhuye/MapRenderer.java b/src/zhuye/MapRenderer.java
index dfffdf9..9d63270 100644
--- a/src/zhuye/MapRenderer.java
+++ b/src/zhuye/MapRenderer.java
@@ -1451,7 +1451,82 @@
private void drawCurrentPlannedPath(Graphics2D g2d) {
double arrowScale = previewSizingEnabled ? 0.5d : 1.0d;
- lujingdraw.drawPlannedPath(g2d, currentPlannedPath, scale, arrowScale);
+
+ // 灏濊瘯鑾峰彇鍦板潡淇℃伅浠ユ敮鎸佸尯鍒嗕綔涓氳矾寰勫拰绉诲姩璺緞锛屼互鍙婄粯鍒跺唴缂╄竟鐣�
+ String boundaryCoords = null;
+ String mowingWidth = null;
+ String safetyDistance = null;
+ String obstaclesCoords = null;
+ String mowingPattern = null;
+
+ // 浠庡綋鍓嶅湴鍧楃紪鍙疯幏鍙栧湴鍧椾俊鎭�
+ if (currentBoundaryLandNumber != null) {
+ Dikuai landData = Dikuai.getDikuai(currentBoundaryLandNumber);
+ if (landData != null) {
+ boundaryCoords = landData.getBoundaryCoordinates();
+ mowingWidth = landData.getMowingWidth();
+ safetyDistance = landData.getMowingSafetyDistance();
+ mowingPattern = landData.getMowingPattern();
+
+ // 鑾峰彇闅滅鐗╁潗鏍�
+ try {
+ java.io.File configFile = new java.io.File("Obstacledge.properties");
+ if (configFile.exists()) {
+ Obstacledge.ConfigManager manager = new Obstacledge.ConfigManager();
+ if (manager.loadFromFile(configFile.getAbsolutePath())) {
+ Obstacledge.Plot plot = manager.getPlotById(currentBoundaryLandNumber.trim());
+ if (plot != null && plot.getObstacles() != null && !plot.getObstacles().isEmpty()) {
+ obstaclesCoords = Obstacledge.buildPlannerPayload(plot.getObstacles());
+ }
+ }
+ }
+ } catch (Exception e) {
+ // 蹇界暐闅滅鐗╁姞杞介敊璇�
+ }
+ }
+ }
+
+ // 濡傛灉鏃犳硶浠庡湴鍧楄幏鍙栬竟鐣岋紝灏濊瘯浣跨敤褰撳墠鏄剧ず鐨勮竟鐣�
+ if (boundaryCoords == null || boundaryCoords.trim().isEmpty() || "-1".equals(boundaryCoords.trim())) {
+ if (currentBoundary != null && !currentBoundary.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < currentBoundary.size(); i++) {
+ Point2D.Double pt = currentBoundary.get(i);
+ if (i > 0) sb.append(";");
+ sb.append(String.format(java.util.Locale.US, "%.3f,%.3f", pt.x, pt.y));
+ }
+ boundaryCoords = sb.toString();
+ }
+ }
+
+ // 杞崲鍓茶崏瀹藉害浠庡帢绫冲埌绫筹紙濡傛灉瀛樺湪锛�
+ if (mowingWidth != null && !mowingWidth.trim().isEmpty() && !"-1".equals(mowingWidth.trim())) {
+ try {
+ double widthCm = Double.parseDouble(mowingWidth.trim());
+ double widthMeters = widthCm / 100.0;
+ mowingWidth = String.format(java.util.Locale.US, "%.3f", widthMeters);
+ } catch (NumberFormatException e) {
+ // 濡傛灉宸茬粡鏄背涓哄崟浣嶏紝淇濇寔鍘熷��
+ }
+ }
+
+ // 杞崲瀹夊叏璺濈浠庡帢绫冲埌绫筹紙濡傛灉瀛樺湪锛�
+ if (safetyDistance != null && !safetyDistance.trim().isEmpty() && !"-1".equals(safetyDistance.trim())) {
+ try {
+ double distCm = Double.parseDouble(safetyDistance.trim());
+ // 濡傛灉鍊煎ぇ浜�100锛岃涓烘槸鍘樼背锛岄渶瑕佽浆鎹负绫�
+ if (distCm > 100) {
+ double distMeters = distCm / 100.0;
+ safetyDistance = String.format(java.util.Locale.US, "%.3f", distMeters);
+ }
+ } catch (NumberFormatException e) {
+ // 濡傛灉宸茬粡鏄背涓哄崟浣嶏紝淇濇寔鍘熷��
+ }
+ }
+
+ // 璋冪敤甯﹀湴鍧椾俊鎭殑缁樺埗鏂规硶
+ lujingdraw.drawPlannedPath(g2d, currentPlannedPath, scale, arrowScale,
+ boundaryCoords, mowingWidth, safetyDistance, obstaclesCoords, mowingPattern);
}
private void drawCircleSampleMarkers(Graphics2D g2d, List<double[]> markers, double scale) {
--
Gitblit v1.10.0