From 69b40096cb0ae965f2a3e92672b880edfe7d04d2 Mon Sep 17 00:00:00 2001
From: 826220679@qq.com <826220679@qq.com>
Date: 星期六, 27 十二月 2025 21:14:09 +0800
Subject: [PATCH] 优化了登录页面
---
src/sendMQTT/Server.java | 1
src/chuankou/SerialPortNativeLoader.java | 13
dikuai.properties | 8
src/zhuye/adddikuaiyulan.java | 14
src/yaokong/SteeringCommandSender.java | 3
.classpath | 2
src/zhuye/WangfanDraw.java | 13
src/lujing/YixinglujingHaveObstacel.java | 49 +++
src/zhuye/MapRenderer.java | 69 +++-
src/zhuye/pointandnumber.java | 10
set.properties | 10
src/udpdell/UDPServer.java | 6
src/zhuye/ShouyeLauncher.java | 1
src/Mqttmessage/PushCallback.java | 7
src/udpdell/Mqttserver.java | 4
src/yaokong/Control07.java | 7
src/lujing/AoxinglujingNoObstacle.java | 8
src/chuankou/Sendmsg.java | 7
src/denglu/RegistrationFrame.java | 52 ---
src/lujing/MowingPathGenerationPage.java | 8
src/set/Setsys.java | 9
src/denglu/Denglu.java | 134 ++-------
src/lujing/AoxinglujingHaveObstacel.java | 8
src/gecaoji/MowerSafetyDistanceCalculator.java | 1
src/zhuye/tuowei.java | 10
src/denglu/UserChuShiHua.java | 1
src/yaokong/Control05.java | 7
src/chuankou/SerialDataReceiver.java | 32 --
user.properties | 14
src/zhuye/Coordinate.java | 14 -
Obstacledge.properties | 7
src/sendMQTT/HTTPUtils/PropertiesFileUploader.java | 2
src/user/Usrdell.java | 1
src/login/LoginTestRunner.java | 49 ---
src/lujing/YixinglujingNoObstacle.java | 141 +++++++++
src/chuankou/SerialPortAutoConnector.java | 1
src/Mqttmessage/Client.java | 21 -
src/chuankou/DataListener.java | 5
src/yaokong/Control06.java | 7
src/bianjie/BoundaryAlgorithm.java | 19 -
src/utils/FiniteChecker.java | 20 +
src/yaokong/Control03.java | 9
42 files changed, 377 insertions(+), 427 deletions(-)
diff --git a/.classpath b/.classpath
index b156962..f039d23 100644
--- a/.classpath
+++ b/.classpath
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
<attributes>
<attribute name="module" value="true"/>
</attributes>
diff --git a/Obstacledge.properties b/Obstacledge.properties
index 52a4a75..d268b97 100644
--- a/Obstacledge.properties
+++ b/Obstacledge.properties
@@ -1,5 +1,5 @@
# 鍓茶崏鏈哄湴鍧楅殰纰嶇墿閰嶇疆鏂囦欢
-# 鐢熸垚鏃堕棿锛�2025-12-27T13:39:05.917584700
+# 鐢熸垚鏃堕棿锛�2025-12-27T16:33:13.889689700
# 鍧愭爣绯伙細WGS84锛堝害鍒嗘牸寮忥級
# ============ 鍦板潡鍩哄噯绔欓厤缃� ============
@@ -12,8 +12,3 @@
# 鏍煎紡锛歱lot.[鍦板潡缂栧彿].obstacle.[闅滅鐗╁悕绉癩.originalCoords=[鍧愭爣涓瞉
# 鏍煎紡锛歱lot.[鍦板潡缂栧彿].obstacle.[闅滅鐗╁悕绉癩.xyCoords=[鍧愭爣涓瞉
-# --- 鍦板潡LAND1鐨勯殰纰嶇墿 ---
-plot.LAND1.obstacle.闅滅鐗�1.shape=1
-plot.LAND1.obstacle.闅滅鐗�1.originalCoords=0.000000,N;0.000000,E;0.000000,N;0.000000,E;0.000000,N;0.000000,E;0.000000,N;0.000000,E
-plot.LAND1.obstacle.闅滅鐗�1.xyCoords=53.95,39.88;55.58,45.69;64.53,45.45;66.97,40.57
-
diff --git a/dikuai.properties b/dikuai.properties
index 885dbb0..2a17fd8 100644
--- a/dikuai.properties
+++ b/dikuai.properties
@@ -1,5 +1,5 @@
#Dikuai Properties
-#Sat Dec 27 13:39:05 GMT+08:00 2025
+#Sat Dec 27 16:33:13 GMT+08:00 2025
LAND1.intelligentSceneAnalysis=-1
LAND1.mowingSafetyDistance=0.53
LAND1.landArea=577.12
@@ -11,8 +11,8 @@
LAND1.returnPathRawCoordinates=-1
LAND1.boundaryOriginalXY=-1
LAND1.mowingWidth=1.00
-LAND1.plannedPath=73.871028,49.873176;50.776259,50.037243;41.965934,22.443191;49.612130,19.993609;51.845415,34.259086;66.290000,36.696945;66.290000,21.401369;78.088741,24.750277;73.871028,49.873176;73.955072,49.372566;50.616974,49.538362;50.298405,48.540599;74.123160,48.371347;74.291248,47.370128;49.979836,47.542837;49.661267,46.545075;74.459336,46.368908;74.627423,45.367689;49.342698,45.547313;49.024129,44.549551;55.663908,44.502382;64.552007,44.439240;74.795511,44.366470;74.963599,43.365250;65.098159,43.435335;55.361561,43.504504;48.705560,43.551789;48.386992,42.554027;55.059215,42.506627;65.644310,42.431430;75.131687,42.364031;75.299775,41.362812;66.190462,41.427525;54.756869,41.508750;48.068423,41.556265;47.749854,40.558503;54.454523,40.510872;59.489469,40.475104;75.467863,40.361592;75.635951,39.360373;47.431285,39.560741;47.112716,38.562978;75.804039,38.359154;75.972127,37.357934;46.794147,37.565216;46.475578,36.567454;64.753396,36.437608;66.290000,36.426692;76.140215,36.356715;76.308303,35.355496;66.290000,35.426666;59.067471,35.477976;46.157009,35.569692;45.838440,34.571930;53.381545,34.518343;66.290000,34.426641;76.476391,34.354276;76.644478,33.353057;66.290000,33.426616;51.731282,33.530042;45.519871,33.574168;45.201302,32.576406;51.574900,32.531127;66.290000,32.426591;76.812566,32.351838;76.980654,31.350618;66.290000,31.426565;51.418519,31.532213;44.882733,31.578644;44.564164,30.580882;51.262137,30.533299;66.290000,30.426540;77.148742,30.349399;77.316830,29.348180;66.290000,29.426515;51.105755,29.534385;44.245595,29.583120;43.927026,28.585357;50.949373,28.535470;66.290000,28.426490;77.484918,28.346960;77.653006,27.345741;66.290000,27.426464;50.792992,27.536556;43.608458,27.587595;43.289889,26.589833;50.636610,26.537642;66.290000,26.426439;77.821094,26.344522;77.989182,25.343302;66.290000,25.426414;50.480228,25.538727;42.971320,25.592071;42.652751,24.594309;50.323846,24.539813;66.290000,24.426389;76.687398,24.352525;73.250178,23.376918;66.290000,23.426363;50.167465,23.540899;42.334182,23.596547;42.015613,22.598785;50.011083,22.541985;66.290000,22.426338;69.812957,22.401311;66.375737,21.425704;66.290000,21.426313;49.854701,21.543070;44.660415,21.579971;47.852711,20.557267;49.698319,20.544156
-LAND1.updateTime=2025-12-27 13\:39\:05
+LAND1.plannedPath=73.87,49.87;50.78,50.04;41.97,22.44;49.61,19.99;51.85,34.26;66.29,36.70;66.29,21.40;78.09,24.75;73.87,49.87;73.96,49.37;50.62,49.54;50.30,48.54;74.12,48.37;74.29,47.37;49.98,47.54;49.66,46.55;74.46,46.37;74.63,45.37;49.34,45.55;49.02,44.55;74.80,44.37;74.96,43.37;48.71,43.55;48.39,42.55;75.13,42.36;75.30,41.36;48.07,41.56;47.75,40.56;75.47,40.36;75.64,39.36;47.43,39.56;47.11,38.56;75.80,38.36;75.97,37.36;46.79,37.57;46.48,36.57;64.75,36.44;66.29,36.43;76.14,36.36;76.31,35.36;66.29,35.43;59.07,35.48;46.16,35.57;45.84,34.57;53.38,34.52;66.29,34.43;76.48,34.35;76.64,33.35;66.29,33.43;51.73,33.53;45.52,33.57;45.20,32.58;51.57,32.53;66.29,32.43;76.81,32.35;76.98,31.35;66.29,31.43;51.42,31.53;44.88,31.58;44.56,30.58;51.26,30.53;66.29,30.43;77.15,30.35;77.32,29.35;66.29,29.43;51.11,29.53;44.25,29.58;43.93,28.59;50.95,28.54;66.29,28.43;77.48,28.35;77.65,27.35;66.29,27.43;50.79,27.54;43.61,27.59;43.29,26.59;50.64,26.54;66.29,26.43;77.82,26.34;77.99,25.34;66.29,25.43;50.48,25.54;42.97,25.59;42.65,24.59;50.32,24.54;66.29,24.43;76.69,24.35;73.25,23.38;66.29,23.43;50.17,23.54;42.33,23.60;42.02,22.60;50.01,22.54;66.29,22.43;69.81,22.40;66.38,21.43;66.29,21.43;49.85,21.54;44.66,21.58;47.85,20.56;49.70,20.54
+LAND1.updateTime=2025-12-27 16\:33\:13
LAND1.baseStationCoordinates=3949.89151752,N,11616.79267501,E
LAND1.boundaryPointInterval=-1
LAND1.createTime=2025-12-23 17\:08\:09
@@ -21,6 +21,6 @@
LAND1.landName=123
LAND1.mowingTrack=-1
LAND1.boundaryOriginalCoordinates=39.831522,116.279873,49.25;39.831524,116.279878,49.25;39.831525,116.279878,49.24;39.831524,116.279912,49.30;39.831524,116.279911,49.29;39.831523,116.279911,49.23;39.831521,116.279915,49.31;39.831517,116.279925,49.34;39.831514,116.279940,49.30;39.831514,116.279957,49.28;39.831516,116.279974,49.28;39.831518,116.279991,49.29;39.831521,116.280008,49.24;39.831524,116.280025,49.30;39.831526,116.280042,49.24;39.831529,116.280059,49.29;39.831529,116.280076,49.26;39.831530,116.280093,49.32;39.831531,116.280110,49.28;39.831533,116.280127,49.28;39.831535,116.280144,49.26;39.831539,116.280161,49.27;39.831544,116.280175,49.25;39.831551,116.280190,49.24;39.831558,116.280204,49.26;39.831566,116.280219,49.26;39.831574,116.280234,49.22;39.831583,116.280248,49.24;39.831591,116.280260,49.24;39.831600,116.280272,49.23;39.831608,116.280285,49.18;39.831615,116.280298,49.12;39.831618,116.280312,49.11;39.831618,116.280328,49.12;39.831615,116.280342,49.15;39.831610,116.280356,49.21;39.831602,116.280369,49.23;39.831592,116.280379,49.25;39.831581,116.280388,49.25;39.831569,116.280394,49.19;39.831559,116.280395,49.23;39.831552,116.280387,49.28;39.831547,116.280373,49.32;39.831544,116.280357,49.33;39.831541,116.280340,49.29;39.831539,116.280324,49.27;39.831536,116.280307,49.24;39.831534,116.280290,49.25;39.831531,116.280273,49.26;39.831527,116.280257,49.28;39.831522,116.280242,49.21;39.831514,116.280232,49.28;39.831504,116.280229,49.24;39.831491,116.280230,49.33;39.831478,116.280233,49.34;39.831466,116.280236,49.31;39.831454,116.280239,49.31;39.831441,116.280242,49.26;39.831429,116.280244,49.23;39.831416,116.280247,49.25;39.831402,116.280250,49.22;39.831389,116.280253,49.25;39.831376,116.280256,49.26;39.831364,116.280258,49.24;39.831351,116.280261,49.25;39.831338,116.280265,49.26;39.831324,116.280268,49.20;39.831311,116.280271,49.16;39.831298,116.280274,49.17;39.831285,116.280277,49.22;39.831271,116.280278,49.16;39.831261,116.280273,49.23
-LAND1.obstacleCoordinates=(53.95,39.88;55.58,45.69;64.53,45.45;66.97,40.57)
+LAND1.obstacleCoordinates=-1
LAND1.boundaryCoordinates=50.39,50.57;74.32,50.40;78.69,24.37;65.76,20.70;65.76,36.07;52.31,33.80;50.04,19.30;41.30,22.10
LAND1.mowingBladeWidth=0.51
diff --git a/set.properties b/set.properties
index 37fa8d3..f5e555c 100644
--- a/set.properties
+++ b/set.properties
@@ -1,5 +1,5 @@
-#Mower Configuration Properties - Updated
-#Sat Dec 27 13:39:12 GMT+08:00 2025
+#Current work land selection updated
+#Sat Dec 27 20:42:43 GMT+08:00 2025
appVersion=-1
simCardNumber=-1
currentWorkLandNumber=LAND1
@@ -7,13 +7,13 @@
boundaryLengthVisible=false
idleTrailDurationSeconds=60
handheldMarkerId=1872
-viewCenterX=-60.00
-viewCenterY=-34.94
+viewCenterX=-61.89
+viewCenterY=-39.06
manualBoundaryDrawingMode=false
mowerId=6258
serialPortName=COM15
serialAutoConnect=true
-mapScale=10.32
+mapScale=17.84
measurementModeEnabled=false
firmwareVersion=-1
cuttingWidth=200
diff --git a/src/Mqttmessage/Client.java b/src/Mqttmessage/Client.java
index ca1e876..35c9b35 100644
--- a/src/Mqttmessage/Client.java
+++ b/src/Mqttmessage/Client.java
@@ -57,7 +57,6 @@
*/
public void connect() throws MqttException {
if (client != null && client.isConnected()) {
- System.out.println("MQTT瀹㈡埛绔凡杩炴帴锛孋lientId: " + clientId);
return;
}
@@ -78,7 +77,6 @@
// 鎵ц杩炴帴
client.connect(options);
- System.out.println("MQTT杩炴帴鎴愬姛锛丆lientId: " + clientId + ", 鏈嶅姟鍣�: " + host + ", 涓婚: " + topic);
// 鍚姩杩炴帴鐩戞帶绾跨▼
startConnectionMonitor();
@@ -95,7 +93,6 @@
connect();
}
client.subscribe(topic, qos);
- System.out.println("宸茶闃呬富棰�: " + topic + ", QoS: " + qos);
}
/**
@@ -132,7 +129,6 @@
Thread.sleep(5000); // 姣�5绉掓鏌ヤ竴娆�
if (client != null && !client.isConnected()) {
- System.out.println("妫�娴嬪埌MQTT杩炴帴鏂紑锛屽皾璇曢噸杩�... ClientId: " + clientId);
try {
// 灏濊瘯閲嶆柊杩炴帴
if (!client.isConnected()) {
@@ -140,7 +136,6 @@
// 閲嶈繛鎴愬姛鍚庨噸鏂拌闃�
if (client.isConnected()) {
client.subscribe(topic, qos);
- System.out.println("杩炴帴鐩戞帶锛氶噸杩炴垚鍔熷苟閲嶆柊璁㈤槄涓婚: " + topic);
}
}
} catch (Exception e) {
@@ -167,7 +162,6 @@
connectionMonitorThread.setDaemon(true);
connectionMonitorThread.setName("MQTT-ConnectionMonitor-" + clientId);
connectionMonitorThread.start();
- System.out.println("宸插惎鍔∕QTT杩炴帴鐩戞帶绾跨▼: " + clientId);
}
/**
@@ -228,13 +222,11 @@
public static boolean connectMQTT() {
// 闃叉閲嶅閲嶈繛
if (isReconnecting) {
- System.out.println("MQTT姝e湪閲嶈繛涓紝璺宠繃鏈閲嶈繛璇锋眰");
return false;
}
// 妫�鏌ユ槸鍚﹀凡缁忚繛鎺�
if (areClientsConnected()) {
- System.out.println("MQTT瀹㈡埛绔凡杩炴帴锛屾棤闇�閲嶅杩炴帴");
return true;
}
@@ -269,7 +261,6 @@
if (gpsClient != null && gpsClient.isConnected()) {
gpsClient.subscribe();
gpsSuccess = true;
- System.out.println("GPS涓婚MQTT杩炴帴骞惰闃呮垚鍔�");
}
} catch (MqttException e) {
System.err.println("GPS涓婚MQTT杩炴帴澶辫触: " + e.getMessage());
@@ -291,7 +282,6 @@
if (responseClient != null && responseClient.isConnected()) {
responseClient.subscribe();
responseSuccess = true;
- System.out.println("鍝嶅簲涓婚MQTT杩炴帴骞惰闃呮垚鍔�");
}
} catch (MqttException e) {
System.err.println("鍝嶅簲涓婚MQTT杩炴帴澶辫触: " + e.getMessage());
@@ -305,10 +295,8 @@
}
if (gpsSuccess && responseSuccess) {
- System.out.println("鎵�鏈塎QTT涓婚杩炴帴骞惰闃呮垚鍔燂紒");
return true;
} else if (gpsSuccess || responseSuccess) {
- System.out.println("閮ㄥ垎MQTT涓婚杩炴帴鎴愬姛");
return true;
} else {
System.err.println("鎵�鏈塎QTT涓婚杩炴帴澶辫触");
@@ -337,13 +325,11 @@
public static boolean connectMQTT(String host, String deviceId, String userEmail) {
// 闃叉閲嶅閲嶈繛
if (isReconnecting) {
- System.out.println("MQTT姝e湪閲嶈繛涓紝璺宠繃鏈閲嶈繛璇锋眰");
return false;
}
// 妫�鏌ユ槸鍚﹀凡缁忚繛鎺�
if (areClientsConnected()) {
- System.out.println("MQTT瀹㈡埛绔凡杩炴帴锛屾棤闇�閲嶅杩炴帴");
return true;
}
@@ -376,7 +362,6 @@
if (gpsClient != null && gpsClient.isConnected()) {
gpsClient.subscribe();
gpsSuccess = true;
- System.out.println("GPS涓婚MQTT杩炴帴骞惰闃呮垚鍔�");
}
} catch (MqttException e) {
System.err.println("GPS涓婚MQTT杩炴帴澶辫触: " + e.getMessage());
@@ -398,7 +383,6 @@
if (responseClient != null && responseClient.isConnected()) {
responseClient.subscribe();
responseSuccess = true;
- System.out.println("鍝嶅簲涓婚MQTT杩炴帴骞惰闃呮垚鍔�");
}
} catch (MqttException e) {
System.err.println("鍝嶅簲涓婚MQTT杩炴帴澶辫触: " + e.getMessage());
@@ -412,10 +396,8 @@
}
if (gpsSuccess && responseSuccess) {
- System.out.println("鎵�鏈塎QTT涓婚杩炴帴骞惰闃呮垚鍔燂紒");
return true;
} else if (gpsSuccess || responseSuccess) {
- System.out.println("閮ㄥ垎MQTT涓婚杩炴帴鎴愬姛");
return true;
} else {
System.err.println("鎵�鏈塎QTT涓婚杩炴帴澶辫触");
@@ -447,7 +429,6 @@
Client mqttClient = new Client(host, topic, clientId);
mqttClient.connect();
mqttClient.subscribe(qos);
- System.out.println("MQTT瀹㈡埛绔垱寤哄苟璁㈤槄鎴愬姛锛屼富棰�: " + topic + ", ClientId: " + clientId);
return mqttClient;
} catch (MqttException e) {
System.err.println("MQTT瀹㈡埛绔垱寤哄け璐�: " + e.getMessage() + ", 涓婚: " + topic);
@@ -474,12 +455,10 @@
try {
if (gpsClient != null) {
gpsClient.close();
- System.out.println("GPS涓婚MQTT杩炴帴宸叉柇寮�");
gpsClient = null;
}
if (responseClient != null) {
responseClient.close();
- System.out.println("鍝嶅簲涓婚MQTT杩炴帴宸叉柇寮�");
responseClient = null;
}
} catch (Exception e) {
diff --git a/src/Mqttmessage/PushCallback.java b/src/Mqttmessage/PushCallback.java
index 65ff0e2..4c0e0d4 100644
--- a/src/Mqttmessage/PushCallback.java
+++ b/src/Mqttmessage/PushCallback.java
@@ -66,7 +66,6 @@
try {
// 閲嶆柊璁㈤槄涓婚
clientInstance.getClient().subscribe(topic, qos);
- System.out.println("MQTT閲嶈繛鎴愬姛锛屽凡閲嶆柊璁㈤槄涓婚: " + topic);
return; // 閲嶈繛鎴愬姛锛岄��鍑哄惊鐜�
} catch (Exception e) {
System.err.println("閲嶆柊璁㈤槄涓婚澶辫触: " + e.getMessage());
@@ -74,9 +73,6 @@
}
retryCount++;
- if (retryCount % 5 == 0) {
- System.out.println("绛夊緟MQTT鑷姩閲嶈繛... (" + retryCount + "/" + maxRetries + ")");
- }
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
System.err.println("閲嶈繛绾跨▼琚腑鏂�");
@@ -92,7 +88,6 @@
clientInstance.connect();
if (clientInstance.isConnected()) {
clientInstance.subscribe(qos);
- System.out.println("鎵嬪姩閲嶈繛鎴愬姛锛屽凡閲嶆柊璁㈤槄涓婚: " + topic);
}
}
} catch (Exception e) {
@@ -102,7 +97,7 @@
}
public void deliveryComplete(IMqttDeliveryToken token) {
- System.out.println("deliveryComplete---------" + token.isComplete());
+ // 浜や粯瀹屾垚鍥炶皟
}
public void messageArrived(String topic, MqttMessage message) throws Exception {
diff --git a/src/bianjie/BoundaryAlgorithm.java b/src/bianjie/BoundaryAlgorithm.java
index aa4254c..7b47660 100644
--- a/src/bianjie/BoundaryAlgorithm.java
+++ b/src/bianjie/BoundaryAlgorithm.java
@@ -116,30 +116,21 @@
// 楂樼骇澶勭悊杈圭晫鏁版嵁鏂规硶
public List<Coordinate> processBoundaryDataAdvanced(String gnggaData, double baseLat, double baseLon,
BoundaryParameters params) {
- System.out.println("寮�濮嬪鐞嗚竟鐣屾暟鎹�...");
- System.out.println("鍩哄噯绔欏潗鏍�: " + baseLat + ", " + baseLon);
- System.out.println("鍙傛暟: 闂撮殧=" + params.interval + "绫�, 瑙掑害闃堝��=" + params.angleThreshold + "搴�");
-
// 1. 瑙f瀽GNGGA鏁版嵁
List<Coordinate> rawPoints = parseGNGGA(gnggaData, baseLat, baseLon);
- System.out.println("瑙f瀽鍒板師濮嬬偣: " + rawPoints.size() + " 涓�");
if (rawPoints.size() < 3) {
- System.out.println("鏁版嵁鐐逛笉瓒筹紝鏃犳硶褰㈡垚杈圭晫");
return new ArrayList<>();
}
// 2. 杩囨护鍜屽钩婊戞暟鎹�
List<Coordinate> filteredPoints = filterAndSmoothPoints(rawPoints);
- System.out.println("杩囨护鍚庣偣: " + filteredPoints.size() + " 涓�");
// 3. 楂樼骇杈圭晫鐐逛紭鍖�
List<Coordinate> optimizedPoints = optimizeBoundaryPointsAdvanced(filteredPoints, params);
- System.out.println("浼樺寲鍚庤竟鐣岀偣: " + optimizedPoints.size() + " 涓�");
// 4. 杈圭晫璐ㄩ噺璇勪及
BoundaryQuality quality = evaluateBoundaryQuality(optimizedPoints);
- System.out.println(quality.toString());
return optimizedPoints;
}
@@ -167,7 +158,6 @@
// 5. 鑷姩閫夋嫨棰勮鍦烘櫙
selectPresetAutomatically(analysis);
- System.out.println(analysis.toString());
return analysis;
}
@@ -287,8 +277,6 @@
} else {
analysis.suggestedPreset = "澶嶆潅灏忓尯鍩�";
}
-
- System.out.println("鑷姩鍦烘櫙閫夋嫨寰楀垎: " + String.format("%.2f", score) + " -> " + analysis.suggestedPreset);
}
// 鏍规嵁鍦烘櫙鍚嶇О鑾峰彇鍙傛暟
@@ -312,7 +300,6 @@
}
String[] records = gnggaData.split("\\$GNGGA");
- System.out.println("鎵惧埌GNGGA璁板綍: " + (records.length - 1) + " 鏉�");
for (String record : records) {
try {
@@ -325,7 +312,6 @@
String[] fields = trimmedRecord.split(",");
if (fields.length < 7) {
- System.out.println("璁板綍瀛楁涓嶈冻: " + trimmedRecord);
continue;
}
@@ -334,12 +320,10 @@
try {
fixStatus = Integer.parseInt(fields[6]);
} catch (NumberFormatException e) {
- System.out.println("瀹氫綅鐘舵�佹牸寮忛敊璇�: " + fields[6]);
continue;
}
if (fixStatus != 4) {
- System.out.println("璺宠繃闈為珮绮惧害瀹氫綅鐐癸紝鐘舵��: " + fixStatus);
continue;
}
@@ -415,8 +399,6 @@
double speed = calculateDistance(points.get(i-1), points.get(i));
if (speed < 5.0) { // 鏈�澶у悎鐞嗛�熷害涓�5绫�/绉�
filtered.add(points.get(i));
- } else {
- System.out.println("绉婚櫎楂橀�熺偣: 閫熷害=" + speed + "绫�/绉�");
}
}
@@ -462,7 +444,6 @@
// 1. 棣栧厛杩涜閬撴牸鎷夋柉-鏅厠绠楁硶绠�鍖�
List<Coordinate> simplified = douglasPeuckerSimplification(points, params.simplificationTolerance);
- System.out.println("閬撴牸鎷夋柉-鏅厠绠�鍖栧悗: " + simplified.size() + " 涓偣");
// 2. 鍩轰簬璺濈鍜岃搴︾殑杩涗竴姝ヤ紭鍖�
optimized.add(simplified.get(0));
diff --git a/src/chuankou/DataListener.java b/src/chuankou/DataListener.java
new file mode 100644
index 0000000..32a79c7
--- /dev/null
+++ b/src/chuankou/DataListener.java
@@ -0,0 +1,5 @@
+package chuankou;
+
+public interface DataListener<T> {
+ void accept(T t);
+}
diff --git a/src/chuankou/Sendmsg.java b/src/chuankou/Sendmsg.java
index 50f76d3..8a2bc74 100644
--- a/src/chuankou/Sendmsg.java
+++ b/src/chuankou/Sendmsg.java
@@ -95,7 +95,6 @@
*/
public static void enableDebugMode() {
DEBUG_MODE = true;
- System.out.println("[" + getCurrentTime() + "] Sendmsg璋冭瘯妯″紡宸插惎鐢�");
}
/**
@@ -103,7 +102,6 @@
*/
public static void disableDebugMode() {
DEBUG_MODE = false;
- System.out.println("[" + getCurrentTime() + "] Sendmsg璋冭瘯妯″紡宸茬鐢�");
}
/**
@@ -111,7 +109,6 @@
*/
public static void setDebugMode(boolean debug) {
DEBUG_MODE = debug;
- System.out.println("[" + getCurrentTime() + "] Sendmsg璋冭瘯妯″紡: " + (debug ? "鍚敤" : "绂佺敤"));
}
/**
@@ -123,10 +120,6 @@
// 娓呯悊ThreadLocal璧勬簮
TIME_FORMATTER.remove();
STRING_BUILDER_CACHE.remove();
-
- if (DEBUG_MODE) {
- System.out.println("[" + getCurrentTime() + "] Sendmsg璧勬簮娓呯悊瀹屾垚");
- }
}
/**
diff --git a/src/chuankou/SerialDataReceiver.java b/src/chuankou/SerialDataReceiver.java
index f55892d..7f699db 100644
--- a/src/chuankou/SerialDataReceiver.java
+++ b/src/chuankou/SerialDataReceiver.java
@@ -36,9 +36,6 @@
// 妫�鏌ョ紦鍐插尯瀹归噺锛屽姩鎬佸鐞�
if (!ensureBufferCapacity(rawData.length)) {
// 缂撳啿鍖轰笉瓒虫椂锛屾竻鐞嗗苟閲嶆柊寮�濮�
- if (debugEnabled) {
- System.out.println("缂撳啿鍖轰笉瓒筹紝娓呯┖缂撳啿鍖洪噸鏂板紑濮�");
- }
bufferPosition = 0;
}
@@ -79,9 +76,6 @@
int startIndex = findStartMarker();
if (startIndex == -1) {
// 娌℃湁鎵惧埌璧峰鏍囪锛屾竻绌烘棤鏁堟暟鎹�
- if (debugEnabled) {
- System.out.println("鏈壘鍒拌捣濮嬫爣璁帮紝娓呯┖缂撳啿鍖�");
- }
bufferPosition = 0;
return;
}
@@ -100,9 +94,6 @@
// 妫�鏌ユ暟鎹暱搴︽湁鏁堟��
if (dataLength < 0 || totalPacketLength > BUFFER_SIZE) {
- if (debugEnabled) {
- System.out.println("鏃犳晥鏁版嵁闀垮害: " + dataLength + ", 璺宠繃璧峰瀛楄妭");
- }
// 璺宠繃閿欒鐨勮捣濮嬫爣璁帮紝缁х画鏌ユ壘
compactBuffer(startIndex + 1);
continue;
@@ -118,10 +109,6 @@
// 鎻愬彇瀹屾暣鏁版嵁鍖�
byte[] packet = Arrays.copyOfRange(dataBuffer, startIndex, startIndex + totalPacketLength);
- if (debugEnabled) {
- System.out.println("瑙f瀽鍒板畬鏁存暟鎹寘: " + bytesToHex(packet));
- }
-
// 娣诲姞鍒拌繑鍥炲垪琛�
completePackets.add(packet);
@@ -162,24 +149,7 @@
* 鎵撳嵃鍘熷鏁版嵁锛堣皟璇曠敤锛�
*/
private void printRawData(String prefix, byte[] data, int maxPrintLength) {
- if (data == null || data.length == 0) {
- System.out.println(prefix + ": 绌烘暟鎹�");
- return;
- }
-
- StringBuilder sb = new StringBuilder();
- sb.append(prefix).append(" [闀垮害: ").append(data.length).append("]: ");
-
- int printLength = Math.min(data.length, maxPrintLength);
- for (int i = 0; i < printLength; i++) {
- sb.append(String.format("%02X ", data[i]));
- }
-
- if (data.length > maxPrintLength) {
- sb.append("... [鎴柇锛屾�婚暱搴�: ").append(data.length).append("]");
- }
-
- System.out.println(sb.toString());
+ // 璋冭瘯杈撳嚭宸茬Щ闄�
}
/**
diff --git a/src/chuankou/SerialPortAutoConnector.java b/src/chuankou/SerialPortAutoConnector.java
index 7acb7b8..e20c769 100644
--- a/src/chuankou/SerialPortAutoConnector.java
+++ b/src/chuankou/SerialPortAutoConnector.java
@@ -30,7 +30,6 @@
if (opened) {
service.ensureCaptureRunning();
service.setPaused(false);
- System.out.println("涓插彛鑷姩杩炴帴鎴愬姛: " + portName + " @ " + baudRate);
} else {
System.err.println("涓插彛鑷姩杩炴帴澶辫触: " + portName + " @ " + baudRate);
}
diff --git a/src/chuankou/SerialPortNativeLoader.java b/src/chuankou/SerialPortNativeLoader.java
index dfcdd1d..3ef2ed6 100644
--- a/src/chuankou/SerialPortNativeLoader.java
+++ b/src/chuankou/SerialPortNativeLoader.java
@@ -33,8 +33,7 @@
if (libraryConfigured) {
return;
}
-
- System.out.println("寮�濮嬪垵濮嬪寲 jSerialComm 鏈湴搴�...");
+
// 绗竴姝ワ細璁剧疆绯荤粺灞炴�э紝闃绘鑷姩涓嬭浇
setCriticalSystemProperties();
@@ -43,14 +42,12 @@
try {
extractNativeLibraryFromResources();
libraryConfigured = true;
- System.out.println("jSerialComm 鏈湴搴撳垵濮嬪寲鎴愬姛");
} catch (Exception e) {
System.err.println("浠庤祫婧愭彁鍙� DLL 澶辫触: " + e.getMessage());
// 灏濊瘯澶囩敤鏂规
try {
setupLibraryFromFileSystem();
libraryConfigured = true;
- System.out.println("浠庢枃浠剁郴缁熷姞杞� jSerialComm 鎴愬姛");
} catch (Exception ex) {
System.err.println("鎵�鏈夊姞杞芥柟寮忛兘澶辫触: " + ex.getMessage());
// 鏈�鍚庡皾璇曪細鍏佽 jSerialComm 浣跨敤榛樿鏂瑰紡
@@ -70,9 +67,7 @@
// 绂佺敤鏃ュ織鍜岃皟璇�
System.setProperty("com.fazecast.jSerialComm.debug", "false");
- System.setProperty("com.fazecast.jSerialComm.log", "false");
-
- System.out.println("宸茶缃� jSerialComm 绯荤粺灞炴��");
+ System.setProperty("com.fazecast.jSerialComm.log", "false");
}
/**
@@ -92,7 +87,6 @@
// 妫�鏌� DLL 鏄惁宸插瓨鍦ㄤ笖鍙敤
if (Files.exists(dllPath)) {
- System.out.println("DLL 宸插瓨鍦ㄤ簬: " + dllPath);
// 璁剧疆搴撹矾寰�
System.setProperty(LIB_PROPERTY, targetDir.toString());
return;
@@ -132,8 +126,6 @@
}
}
- System.out.println("DLL 宸叉彁鍙栧埌: " + dllPath);
-
// 璁剧疆搴撹矾寰�
System.setProperty(LIB_PROPERTY, targetDir.toString());
System.setProperty("java.library.path",
@@ -155,7 +147,6 @@
for (String path : possiblePaths) {
File dllFile = new File(path);
if (dllFile.exists()) {
- System.out.println("鎵惧埌 DLL: " + dllFile.getAbsolutePath());
// 浣跨敤 DLL 鎵�鍦ㄧ洰褰�
File parentDir = dllFile.getParentFile();
System.setProperty(LIB_PROPERTY, parentDir.getAbsolutePath());
diff --git a/src/denglu/Denglu.java b/src/denglu/Denglu.java
index 31ab615..6c46648 100644
--- a/src/denglu/Denglu.java
+++ b/src/denglu/Denglu.java
@@ -10,6 +10,7 @@
import user.Usrdell;
import Mqttmessage.Client;
import login.LoginVerifier;
+import publicway.buttonset;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
@@ -22,11 +23,10 @@
private JPasswordField passwordField;
private JCheckBox rememberMe;
private JButton loginButton;
- private JButton registerButton;
private Map<String, Map<String, String>> translations;
private JPanel mainPanel;
private JLabel usernameLabel, passwordLabel;
- private JLabel forgotPassword, noAccountLabel, signupLink, appInfoLabel;
+ private JLabel forgotPassword, noAccountLabel, signupLink;
// 涓婚棰滆壊
private final Color THEME_COLOR = new Color(46, 139, 87);
@@ -56,7 +56,6 @@
zh.put("sign_up", "绔嬪嵆娉ㄥ唽");
zh.put("app_title", "鏅鸿兘鍓茶崏绯荤粺");
zh.put("window_title", "鏅鸿兘鍓茶崏绯荤粺 - 鐧诲綍");
- zh.put("app_info", "鏅鸿兘鍓茶崏绯荤粺 漏 2023 - 鏅鸿兘鍓茶崏瑙e喅鏂规");
zh.put("register_button", "娉ㄥ唽鏂拌处鎴�");
translations.put("zh", zh);
@@ -71,7 +70,6 @@
en.put("sign_up", "Sign Up");
en.put("app_title", "Smart Mowing System");
en.put("window_title", "Smart Mowing System - Login");
- en.put("app_info", "Smart Mowing System 漏 2023 - Intelligent Lawn Care");
en.put("register_button", "Create New Account");
translations.put("en", en);
@@ -86,7 +84,6 @@
es.put("sign_up", "Reg铆strate");
es.put("app_title", "Sistema de Corte Inteligente");
es.put("window_title", "Sistema de Corte Inteligente - Iniciar Sesi贸n");
- es.put("app_info", "Sistema de Corte Inteligente 漏 2023 - Soluciones Inteligentes");
es.put("register_button", "Crear Nueva Cuenta");
translations.put("es", es);
@@ -101,7 +98,6 @@
fr.put("sign_up", "S'inscrire");
fr.put("app_title", "Syst猫me de Tonte Intelligent");
fr.put("window_title", "Syst猫me de Tonte Intelligent - Connexion");
- fr.put("app_info", "Syst猫me de Tonte Intelligent 漏 2023 - Solutions de Tonte");
fr.put("register_button", "Cr茅er un Nouveau Compte");
translations.put("fr", fr);
@@ -116,7 +112,6 @@
de.put("sign_up", "Registrieren");
de.put("app_title", "Intelligentes M盲hsystem");
de.put("window_title", "Intelligentes M盲hsystem - Anmeldung");
- de.put("app_info", "Intelligentes M盲hsystem 漏 2023 - M盲hl枚sungen");
de.put("register_button", "Neues Konto Erstellen");
translations.put("de", de);
}
@@ -158,12 +153,12 @@
// 涓昏〃鍗曞尯鍩�
JPanel formPanel = createFormPanel();
- // 搴曢儴搴旂敤淇℃伅
- JPanel appInfoPanel = createAppInfoPanel();
+ // 搴曢儴闈㈡澘锛堝寘鍚敞鍐岄摼鎺ワ級
+ JPanel bottomPanel = createBottomPanel();
mainPanel.add(topPanel, BorderLayout.NORTH);
mainPanel.add(formPanel, BorderLayout.CENTER);
- mainPanel.add(appInfoPanel, BorderLayout.SOUTH);
+ mainPanel.add(bottomPanel, BorderLayout.SOUTH);
add(mainPanel);
}
@@ -226,75 +221,21 @@
rememberForgotPanel.add(rememberMe, BorderLayout.WEST);
rememberForgotPanel.add(forgotPassword, BorderLayout.EAST);
- // 鐧诲綍鎸夐挳 - 姘村钩灞呬腑锛岄暱搴︿笌鏂囨湰妗嗗搴︿繚鎸佺浉杩�
+ // 鐧诲綍鎸夐挳 - 浣跨敤buttonset鍒涘缓锛屾按骞冲眳涓紝闀垮害涓庢枃鏈瀹藉害淇濇寔鐩歌繎
JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
buttonPanel.setBackground(Color.WHITE);
buttonPanel.setMaximumSize(new Dimension(Integer.MAX_VALUE, 50));
- loginButton = new JButton("鐧诲綍");
- loginButton.setBackground(THEME_COLOR);
- loginButton.setForeground(Color.WHITE);
+ // 浣跨敤buttonset鍒涘缓鐧诲綍鎸夐挳锛屼娇鐢ㄤ富棰樿壊
+ loginButton = buttonset.createStyledButton("鐧诲綍", THEME_COLOR);
loginButton.setFont(new Font("PingFang SC", Font.BOLD, 15));
// 璁剧疆鐧诲綍鎸夐挳闀垮害鎺ヨ繎鏂囨湰妗嗗搴�
loginButton.setPreferredSize(new Dimension(300, 48));
- loginButton.setBorderPainted(false);
- loginButton.setFocusPainted(false);
- loginButton.setCursor(new Cursor(Cursor.HAND_CURSOR));
-
- // 榧犳爣鎮仠鏁堟灉
- loginButton.addMouseListener(new MouseAdapter() {
- public void mouseEntered(MouseEvent e) {
- loginButton.setBackground(THEME_HOVER_COLOR);
- }
- public void mouseExited(MouseEvent e) {
- loginButton.setBackground(THEME_COLOR);
- }
- });
+ loginButton.setMinimumSize(new Dimension(300, 48));
+ loginButton.setMaximumSize(new Dimension(300, 48));
buttonPanel.add(loginButton);
- // 娉ㄥ唽鎸夐挳 - 鏇存槑鏄剧殑娉ㄥ唽鍏ュ彛
- JPanel registerButtonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
- registerButtonPanel.setBackground(Color.WHITE);
- registerButtonPanel.setMaximumSize(new Dimension(Integer.MAX_VALUE, 45));
-
- registerButton = new JButton("娉ㄥ唽鏂拌处鎴�");
- registerButton.setBackground(Color.WHITE);
- registerButton.setForeground(THEME_COLOR);
- registerButton.setFont(new Font("PingFang SC", Font.BOLD, 14));
- registerButton.setPreferredSize(new Dimension(180, 42));
- registerButton.setBorder(BorderFactory.createCompoundBorder(
- BorderFactory.createLineBorder(THEME_COLOR),
- BorderFactory.createEmptyBorder(5, 15, 5, 15)
- ));
- registerButton.setFocusPainted(false);
- registerButton.setCursor(new Cursor(Cursor.HAND_CURSOR));
-
- // 娉ㄥ唽鎸夐挳鎮仠鏁堟灉
- registerButton.addMouseListener(new MouseAdapter() {
- public void mouseEntered(MouseEvent e) {
- registerButton.setBackground(new Color(240, 250, 240));
- }
- public void mouseExited(MouseEvent e) {
- registerButton.setBackground(Color.WHITE);
- }
- });
-
- registerButtonPanel.add(registerButton);
-
- // 娉ㄥ唽閾炬帴锛堜繚鐣欏師鏈夌殑鏂囨湰閾炬帴锛�
- JPanel signupPanel = new JPanel();
- signupPanel.setBackground(Color.WHITE);
- noAccountLabel = new JLabel("杩樻病鏈夎处鎴凤紵 ");
- noAccountLabel.setFont(new Font("PingFang SC", Font.PLAIN, 12));
- noAccountLabel.setForeground(new Color(120, 120, 120));
- signupLink = new JLabel("绔嬪嵆娉ㄥ唽");
- signupLink.setFont(new Font("PingFang SC", Font.BOLD, 12));
- signupLink.setForeground(THEME_COLOR);
- signupLink.setCursor(new Cursor(Cursor.HAND_CURSOR));
- signupPanel.add(noAccountLabel);
- signupPanel.add(signupLink);
-
// 缁勮琛ㄥ崟
formPanel.add(Box.createRigidArea(new Dimension(0, 15)));
formPanel.add(usernameLabel);
@@ -308,26 +249,33 @@
formPanel.add(rememberForgotPanel);
formPanel.add(Box.createRigidArea(new Dimension(0, 20)));
formPanel.add(buttonPanel); // 鐧诲綍鎸夐挳
- formPanel.add(Box.createRigidArea(new Dimension(0, 15)));
- formPanel.add(registerButtonPanel); // 娉ㄥ唽鎸夐挳
- formPanel.add(Box.createRigidArea(new Dimension(0, 15)));
- formPanel.add(signupPanel); // 淇濈暀鍘熸湁鐨勬敞鍐岄摼鎺�
return formPanel;
}
- private JPanel createAppInfoPanel() {
- JPanel appInfoPanel = new JPanel();
- appInfoPanel.setBackground(Color.WHITE);
- appInfoPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 5, 0));
- appInfoLabel = new JLabel(
- getTranslationValue(currentLanguageCode, "app_info", "鏅鸿兘鍓茶崏绯荤粺 漏 2023")
- );
- appInfoLabel.setFont(new Font("PingFang SC", Font.PLAIN, 10));
- appInfoLabel.setForeground(new Color(150, 150, 150));
- appInfoPanel.add(appInfoLabel);
+ private JPanel createBottomPanel() {
+ JPanel bottomPanel = new JPanel();
+ bottomPanel.setLayout(new BoxLayout(bottomPanel, BoxLayout.Y_AXIS));
+ bottomPanel.setBackground(Color.WHITE);
- return appInfoPanel;
+ // 娉ㄥ唽閾炬帴锛堟斁鍒伴〉闈㈡渶涓嬫柟锛�
+ JPanel signupPanel = new JPanel();
+ signupPanel.setBackground(Color.WHITE);
+ noAccountLabel = new JLabel("杩樻病鏈夎处鎴凤紵 ");
+ noAccountLabel.setFont(new Font("PingFang SC", Font.PLAIN, 12));
+ noAccountLabel.setForeground(new Color(120, 120, 120));
+ signupLink = new JLabel("绔嬪嵆娉ㄥ唽");
+ signupLink.setFont(new Font("PingFang SC", Font.BOLD, 12));
+ signupLink.setForeground(THEME_COLOR);
+ signupLink.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ signupPanel.add(noAccountLabel);
+ signupPanel.add(signupLink);
+ signupPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 5, 0));
+
+ // 娉ㄥ唽閾炬帴鏀惧湪鏈�搴曢儴
+ bottomPanel.add(signupPanel);
+
+ return bottomPanel;
}
private void setupEventHandlers() {
@@ -356,9 +304,6 @@
openRegistrationWindow();
}
});
-
- // 娉ㄥ唽鎸夐挳鐐瑰嚮浜嬩欢 - 鎵撳紑娉ㄥ唽绐楀彛
- registerButton.addActionListener(e -> openRegistrationWindow());
}
private void updateLanguage(String language) {
@@ -375,10 +320,6 @@
loginButton.setText(getTranslationValue(langCode, "login_button", loginButton.getText()));
noAccountLabel.setText(getTranslationValue(langCode, "no_account", noAccountLabel.getText()));
signupLink.setText(getTranslationValue(langCode, "sign_up", signupLink.getText()));
- appInfoLabel.setText(getTranslationValue(langCode, "app_info", appInfoLabel.getText()));
-
- // 鏇存柊娉ㄥ唽鎸夐挳鏂囨湰
- registerButton.setText(getTranslationValue(langCode, "register_button", registerButton.getText()));
// 鏇存柊绐楀彛鏍囬
setTitle(getTranslationValue(langCode, "window_title", getTitle()));
@@ -607,8 +548,6 @@
}
public static void launchMainApp() {
- System.out.println("鍑嗗鎵撳紑涓诲簲鐢ㄧ▼搴�...");
-
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
@@ -624,14 +563,11 @@
mainFrame.setResizable(true);
mainFrame.setLocationRelativeTo(null);
mainFrame.setVisible(true);
-
- System.out.println("涓诲簲鐢ㄧ▼搴忓凡鍚姩");
// 鍚姩鍚庤繛鎺QTT
new Thread(new Runnable() {
@Override
public void run() {
- System.out.println("姝e湪杩炴帴MQTT鏈嶅姟鍣�...");
Client.lianjiemqqt();
}
}).start();
@@ -677,11 +613,7 @@
Device.initializeActiveDevice(setsys.getMowerId());
UDPServer.startAsync();//鍚姩鏁版嵁鎺ユ敹绾跨▼
-
- // 鏄剧ず鍒濆鏁版嵁
- System.out.println("鍒濆鐢ㄦ埛鍚�: " + UserChuShiHua.getProperty("userName"));
- System.out.println("鍒濆瀵嗙爜: " + UserChuShiHua.getProperty("password"));
-
+
// 鍚姩鐧诲綍鐣岄潰锛堣嚜鍔ㄧ櫥褰曢�昏緫鍦� loadUserPreferences 涓鐞嗭級
EventQueue.invokeLater(() -> {
try {
diff --git a/src/denglu/RegistrationFrame.java b/src/denglu/RegistrationFrame.java
index 919877d..717868e 100644
--- a/src/denglu/RegistrationFrame.java
+++ b/src/denglu/RegistrationFrame.java
@@ -3,6 +3,7 @@
import ui.UIConfig;
import login.EmailCodeSender;
import login.UserRegister;
+import publicway.buttonset;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
@@ -264,31 +265,12 @@
));
verificationCodeField.setAlignmentX(Component.LEFT_ALIGNMENT);
- // 鍙戦�侀獙璇佺爜鎸夐挳 - 鍗曠嫭涓�琛�
- sendCodeButton = new JButton("鍙戦�侀獙璇佺爜");
- sendCodeButton.setBackground(THEME_COLOR);
- sendCodeButton.setForeground(Color.WHITE);
+ // 鍙戦�侀獙璇佺爜鎸夐挳 - 浣跨敤buttonset鍒涘缓
+ sendCodeButton = buttonset.createStyledButton("鍙戦�侀獙璇佺爜", THEME_COLOR);
sendCodeButton.setFont(new Font("PingFang SC", Font.BOLD, 14));
sendCodeButton.setMaximumSize(new Dimension(Integer.MAX_VALUE, 35));
- sendCodeButton.setBorderPainted(false);
- sendCodeButton.setFocusPainted(false);
- sendCodeButton.setCursor(new Cursor(Cursor.HAND_CURSOR));
sendCodeButton.setAlignmentX(Component.LEFT_ALIGNMENT);
- // 楠岃瘉鐮佹寜閽偓鍋滄晥鏋�
- sendCodeButton.addMouseListener(new MouseAdapter() {
- public void mouseEntered(MouseEvent e) {
- if (sendCodeButton.isEnabled()) {
- sendCodeButton.setBackground(THEME_HOVER_COLOR);
- }
- }
- public void mouseExited(MouseEvent e) {
- if (sendCodeButton.isEnabled()) {
- sendCodeButton.setBackground(THEME_COLOR);
- }
- }
- });
-
// 瀵嗙爜 - 鏍囩宸﹀榻�
passLabel = new JLabel("瀵嗙爜");
passLabel.setFont(new Font("PingFang SC", Font.BOLD, 13));
@@ -321,36 +303,16 @@
passwordHintLabel.setForeground(Color.RED);
passwordHintLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
- // 娉ㄥ唽鎸夐挳 - 鍗曠嫭涓�琛岋紝闀垮害涓庢枃鏈鐩稿悓
- registerButton = new JButton("娉ㄥ唽");
- registerButton.setBackground(THEME_COLOR);
- registerButton.setForeground(Color.WHITE);
+ // 娉ㄥ唽鎸夐挳 - 浣跨敤buttonset鍒涘缓锛岄暱搴︿笌鏂囨湰妗嗙浉鍚�
+ registerButton = buttonset.createStyledButton("娉ㄥ唽", THEME_COLOR);
registerButton.setFont(new Font("PingFang SC", Font.BOLD, 14));
registerButton.setMaximumSize(new Dimension(Integer.MAX_VALUE, 40));
- registerButton.setBorderPainted(false);
- registerButton.setFocusPainted(false);
- registerButton.setCursor(new Cursor(Cursor.HAND_CURSOR));
registerButton.setAlignmentX(Component.LEFT_ALIGNMENT);
- // 娉ㄥ唽鎸夐挳鎮仠鏁堟灉
- registerButton.addMouseListener(new MouseAdapter() {
- public void mouseEntered(MouseEvent e) {
- registerButton.setBackground(THEME_HOVER_COLOR);
- }
- public void mouseExited(MouseEvent e) {
- registerButton.setBackground(THEME_COLOR);
- }
- });
-
- // 鍙栨秷鎸夐挳 - 鍗曠嫭涓�琛岋紝闀垮害涓庢枃鏈鐩稿悓
- cancelButton = new JButton("鍙栨秷");
- cancelButton.setBackground(Color.LIGHT_GRAY);
- cancelButton.setForeground(Color.DARK_GRAY);
+ // 鍙栨秷鎸夐挳 - 浣跨敤buttonset鍒涘缓锛岄暱搴︿笌鏂囨湰妗嗙浉鍚�
+ cancelButton = buttonset.createStyledButton("鍙栨秷", Color.LIGHT_GRAY);
cancelButton.setFont(new Font("PingFang SC", Font.BOLD, 14));
cancelButton.setMaximumSize(new Dimension(Integer.MAX_VALUE, 40));
- cancelButton.setBorderPainted(false);
- cancelButton.setFocusPainted(false);
- cancelButton.setCursor(new Cursor(Cursor.HAND_CURSOR));
cancelButton.setAlignmentX(Component.LEFT_ALIGNMENT);
// 缁勮琛ㄥ崟 - 缂╁皬琛岄棿璺�
diff --git a/src/denglu/UserChuShiHua.java b/src/denglu/UserChuShiHua.java
index e765f86..1a51408 100644
--- a/src/denglu/UserChuShiHua.java
+++ b/src/denglu/UserChuShiHua.java
@@ -11,7 +11,6 @@
userProperties = new Properties();
try (InputStream input = new FileInputStream(FILE_PATH)) {
userProperties.load(input);
- System.out.println("鐢ㄦ埛鏁版嵁鍒濆鍖栨垚鍔燂紒");
} catch (IOException e) {
System.err.println("鍒濆鍖栧け璐ワ紝鏂囦欢鏈壘鍒版垨璇诲彇閿欒: " + e.getMessage());
}
diff --git a/src/gecaoji/MowerSafetyDistanceCalculator.java b/src/gecaoji/MowerSafetyDistanceCalculator.java
index 8134855..496bd1b 100644
--- a/src/gecaoji/MowerSafetyDistanceCalculator.java
+++ b/src/gecaoji/MowerSafetyDistanceCalculator.java
@@ -87,7 +87,6 @@
// 纭繚琛岄棿璺濅负姝f暟
if (rowSpacing <= 0) {
- System.out.println("璀﹀憡锛氬壊鑽夊搴﹁繃灏忥紝鏃犳硶淇濊瘉鍏ㄨ鐩�");
rowSpacing = cuttingWidth; // 杩斿洖鍘熷鍊�
}
diff --git a/src/login/LoginTestRunner.java b/src/login/LoginTestRunner.java
index 8e07480..b7c5e53 100644
--- a/src/login/LoginTestRunner.java
+++ b/src/login/LoginTestRunner.java
@@ -7,8 +7,6 @@
public class LoginTestRunner {
public static void main(String[] args) {
- System.out.println("========== 鐧诲綍鍔熻兘娴嬭瘯寮�濮� ==========\n");
-
// 娴嬭瘯閭楠岃瘉鐮佸彂閫�
//testSendEmailCode();
@@ -25,79 +23,32 @@
* 娴嬭瘯鍙戦�侀偖绠遍獙璇佺爜
*/
private static void testSendEmailCode() {
- System.out.println("銆愭祴璇�1銆戝彂閫侀偖绠遍獙璇佺爜");
- System.out.println("----------------------------------------");
-
// 娴嬭瘯姝e父閭
String testEmail = "979909237@qq.com";
- System.out.println("娴嬭瘯閭: " + testEmail);
EmailCodeSender.EmailCodeResponse response = EmailCodeSender.sendEmailCode(testEmail);
-
- System.out.println("璇锋眰缁撴灉:");
- System.out.println(" 鉁� 鎴愬姛: " + response.isSuccess());
- System.out.println(" 鉁� 鐘舵�佺爜: " + response.getStatusCode());
- System.out.println(" 鉁� 娑堟伅: " + response.getMessage());
- if (response.getResponseBody() != null && !response.getResponseBody().isEmpty()) {
- System.out.println(" 鉁� 鍝嶅簲浣�: " + response.getResponseBody());
- }
- System.out.println();
}
/**
* 娴嬭瘯鐧诲綍楠岃瘉
*/
private static void testVerifyLogin() {
- System.out.println("銆愭祴璇�2銆戠櫥褰曢獙璇�");
- System.out.println("----------------------------------------");
-
String email = "979909237@qq.com";
String password = "password123";
- System.out.println("娴嬭瘯鍙傛暟:");
- System.out.println(" - 閭: " + email);
- System.out.println(" - 瀵嗙爜: " + password);
-
LoginVerifier.LoginVerifyResponse response = LoginVerifier.verifyLogin(email, password);
-
- System.out.println("楠岃瘉缁撴灉:");
- System.out.println(" 鉁� 鎴愬姛: " + response.isSuccess());
- System.out.println(" 鉁� 鐘舵�佺爜: " + response.getStatusCode());
- System.out.println(" 鉁� 娑堟伅: " + response.getMessage());
- if (response.getResponseBody() != null && !response.getResponseBody().isEmpty()) {
- System.out.println(" 鉁� 鍝嶅簲浣�: " + response.getResponseBody());
- }
- System.out.println();
}
/**
* 娴嬭瘯鐢ㄦ埛娉ㄥ唽
*/
private static void testUserRegister() {
- System.out.println("銆愭祴璇�3銆戠敤鎴锋敞鍐�");
- System.out.println("----------------------------------------");
-
String email = "979909237@qq.com";
String password = "password123";
String code = "709212";
String nickname = "zshTest";
- System.out.println("娴嬭瘯鍙傛暟:");
- System.out.println(" - 閭: " + email);
- System.out.println(" - 瀵嗙爜: " + password);
- System.out.println(" - 楠岃瘉鐮�: " + code);
- System.out.println(" - 鏄电О: " + nickname);
-
UserRegister.RegisterResponse response = UserRegister.register(email, password, code, nickname,password);
-
- System.out.println("娉ㄥ唽缁撴灉:");
- System.out.println(" 鉁� 鎴愬姛: " + response.isSuccess());
- System.out.println(" 鉁� 鐘舵�佺爜: " + response.getStatusCode());
- System.out.println(" 鉁� 娑堟伅: " + response.getMessage());
- if (response.getResponseBody() != null && !response.getResponseBody().isEmpty()) {
- System.out.println(" 鉁� 鍝嶅簲浣�: " + response.getResponseBody());
- }
- System.out.println();
}
diff --git a/src/lujing/AoxinglujingHaveObstacel.java b/src/lujing/AoxinglujingHaveObstacel.java
index ded40ab..cb3177a 100644
--- a/src/lujing/AoxinglujingHaveObstacel.java
+++ b/src/lujing/AoxinglujingHaveObstacel.java
@@ -108,6 +108,14 @@
List<PathSegment> zigZag = generateFixedZigZag(workArea, obstacles, bestAngle, width, currentPos);
finalPath.addAll(zigZag);
+ // 鏍煎紡鍖栧潗鏍囷細淇濈暀涓や綅灏忔暟
+ for (PathSegment segment : finalPath) {
+ segment.start.x = Math.round(segment.start.x * 100.0) / 100.0;
+ segment.start.y = Math.round(segment.start.y * 100.0) / 100.0;
+ segment.end.x = Math.round(segment.end.x * 100.0) / 100.0;
+ segment.end.y = Math.round(segment.end.y * 100.0) / 100.0;
+ }
+
return finalPath;
}
diff --git a/src/lujing/AoxinglujingNoObstacle.java b/src/lujing/AoxinglujingNoObstacle.java
index 4bdf628..7ada2c7 100644
--- a/src/lujing/AoxinglujingNoObstacle.java
+++ b/src/lujing/AoxinglujingNoObstacle.java
@@ -77,6 +77,14 @@
finalPath.addAll(zigZagLines);
+ // 鏍煎紡鍖栧潗鏍囷細淇濈暀涓や綅灏忔暟
+ for (PathSegment segment : finalPath) {
+ segment.start.x = Math.round(segment.start.x * 100.0) / 100.0;
+ segment.start.y = Math.round(segment.start.y * 100.0) / 100.0;
+ segment.end.x = Math.round(segment.end.x * 100.0) / 100.0;
+ segment.end.y = Math.round(segment.end.y * 100.0) / 100.0;
+ }
+
return finalPath;
}
diff --git a/src/lujing/MowingPathGenerationPage.java b/src/lujing/MowingPathGenerationPage.java
index 675d83f..a65bd39 100644
--- a/src/lujing/MowingPathGenerationPage.java
+++ b/src/lujing/MowingPathGenerationPage.java
@@ -831,7 +831,7 @@
if (sb.length() > 0) {
sb.append(";");
}
- sb.append(String.format(Locale.US, "%.6f,%.6f", point.x, point.y));
+ sb.append(String.format(Locale.US, "%.2f,%.2f", point.x, point.y));
}
/**
@@ -852,7 +852,7 @@
if (sb.length() > 0) {
sb.append(";");
}
- sb.append(String.format(Locale.US, "%.6f,%.6f", point.x, point.y));
+ sb.append(String.format(Locale.US, "%.2f,%.2f", point.x, point.y));
}
/**
@@ -873,7 +873,7 @@
if (sb.length() > 0) {
sb.append(";");
}
- sb.append(String.format(Locale.US, "%.6f,%.6f", point.x, point.y));
+ sb.append(String.format(Locale.US, "%.2f,%.2f", point.x, point.y));
}
/**
@@ -894,7 +894,7 @@
if (sb.length() > 0) {
sb.append(";");
}
- sb.append(String.format(Locale.US, "%.6f,%.6f", point.x, point.y));
+ sb.append(String.format(Locale.US, "%.2f,%.2f", point.x, point.y));
}
// ========== UI杈呭姪鏂规硶 ==========
diff --git a/src/lujing/YixinglujingHaveObstacel.java b/src/lujing/YixinglujingHaveObstacel.java
index 7d3cbce..6a14dc4 100644
--- a/src/lujing/YixinglujingHaveObstacel.java
+++ b/src/lujing/YixinglujingHaveObstacel.java
@@ -54,6 +54,17 @@
finalPath.addAll(scanPath);
+ // 10. 鏍煎紡鍖栧潗鏍囷細淇濈暀涓や綅灏忔暟
+ for (PathSegment segment : finalPath) {
+ segment.start.x = Math.round(segment.start.x * 100.0) / 100.0;
+ segment.start.y = Math.round(segment.start.y * 100.0) / 100.0;
+ segment.end.x = Math.round(segment.end.x * 100.0) / 100.0;
+ segment.end.y = Math.round(segment.end.y * 100.0) / 100.0;
+ }
+
+ // 11. 鎵撳嵃杈撳嚭璺緞鍧愭爣
+ printPathCoordinates(finalPath);
+
return finalPath;
}
@@ -610,6 +621,44 @@
return points;
}
+ /**
+ * 鎵撳嵃杈撳嚭璺緞鍧愭爣鍒版帶鍒跺彴
+ */
+ private static void printPathCoordinates(List<PathSegment> path) {
+ if (path == null || path.isEmpty()) {
+ System.out.println("璺緞涓虹┖");
+ return;
+ }
+
+ System.out.println("========== 璺緞鍧愭爣杈撳嚭 ==========");
+ System.out.println("鎬昏矾寰勬鏁�: " + path.size());
+ System.out.println();
+ System.out.println("璺緞鍧愭爣搴忓垪 (鏍煎紡: x,y;x,y;...):");
+
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < path.size(); i++) {
+ PathSegment segment = path.get(i);
+ if (i == 0) {
+ // 绗竴涓鐨勮捣鐐�
+ sb.append(String.format("%.2f,%.2f", segment.start.x, segment.start.y));
+ }
+ // 姣忎釜娈电殑缁堢偣
+ sb.append(";");
+ sb.append(String.format("%.2f,%.2f", segment.end.x, segment.end.y));
+ }
+
+ System.out.println(sb.toString());
+ System.out.println();
+ System.out.println("璇︾粏璺緞淇℃伅:");
+ for (int i = 0; i < path.size(); i++) {
+ PathSegment segment = path.get(i);
+ String type = segment.isMowing ? "鍓茶崏" : "绌鸿蛋";
+ System.out.println(String.format("娈� %d [%s]: (%.2f,%.2f) -> (%.2f,%.2f)",
+ i + 1, type, segment.start.x, segment.start.y, segment.end.x, segment.end.y));
+ }
+ System.out.println("==================================");
+ }
+
public static class Point {
public double x, y;
public Point(double x, double y) { this.x = x; this.y = y; }
diff --git a/src/lujing/YixinglujingNoObstacle.java b/src/lujing/YixinglujingNoObstacle.java
index c38d7c1..fd879ad 100644
--- a/src/lujing/YixinglujingNoObstacle.java
+++ b/src/lujing/YixinglujingNoObstacle.java
@@ -1,6 +1,8 @@
package lujing;
import java.util.*;
+import java.util.Set;
+import java.util.HashSet;
/**
* 寮傚舰鑽夊湴璺緞瑙勫垝 - 鍑瑰杈瑰舰鍏煎浼樺寲鐗� V5.0
@@ -59,6 +61,14 @@
finalPath.addAll(scanPath);
+ // 8. 鏍煎紡鍖栧潗鏍囷細淇濈暀涓や綅灏忔暟
+ for (PathSegment segment : finalPath) {
+ segment.start.x = Math.round(segment.start.x * 100.0) / 100.0;
+ segment.start.y = Math.round(segment.start.y * 100.0) / 100.0;
+ segment.end.x = Math.round(segment.end.x * 100.0) / 100.0;
+ segment.end.y = Math.round(segment.end.y * 100.0) / 100.0;
+ }
+
return finalPath;
}
@@ -100,7 +110,7 @@
for (PathSegment s : lineSegmentsInRow) {
if (Math.hypot(currentPos.x - s.start.x, currentPos.y - s.start.y) > 0.01) {
// 濡傛灉闂磋窛澶т簬1cm锛屾坊鍔犵┖璧拌矾寰�
- segments.add(new PathSegment(currentPos, s.start, false));
+ addSafeConnection(segments, currentPos, s.start, polygon);
}
segments.add(s);
currentPos = s.end;
@@ -139,12 +149,31 @@
private static List<Double> getXIntersections(List<Point> rotatedPoly, double y) {
List<Double> xIntersections = new ArrayList<>();
+ double tolerance = 1e-6;
+
for (int i = 0; i < rotatedPoly.size(); i++) {
Point p1 = rotatedPoly.get(i);
Point p2 = rotatedPoly.get((i + 1) % rotatedPoly.size());
- if ((p1.y <= y && p2.y > y) || (p2.y <= y && p1.y > y)) {
+
+ // 璺宠繃姘村钩杈癸紙閬垮厤涓庢壂鎻忕嚎閲嶅悎鏃剁殑鐗规畩鎯呭喌锛�
+ if (Math.abs(p1.y - p2.y) < tolerance) {
+ continue;
+ }
+
+ // 妫�鏌ユ槸鍚︾浉浜わ紙浣跨敤涓ユ牸涓嶇瓑寮忛伩鍏嶉《鐐归噸澶嶏級
+ if ((p1.y < y && p2.y >= y) || (p2.y < y && p1.y >= y)) {
double x = p1.x + (y - p1.y) * (p2.x - p1.x) / (p2.y - p1.y);
- xIntersections.add(x);
+ // 绠�鍗曞幓閲嶏細妫�鏌ユ槸鍚﹀凡瀛樺湪鐩歌繎鐨勭偣
+ boolean isDuplicate = false;
+ for (double existingX : xIntersections) {
+ if (Math.abs(x - existingX) < tolerance) {
+ isDuplicate = true;
+ break;
+ }
+ }
+ if (!isDuplicate) {
+ xIntersections.add(x);
+ }
}
}
return xIntersections;
@@ -171,7 +200,7 @@
return maxY - minY;
}
- private static List<Point> getInsetPolygon(List<Point> points, double margin) {
+ public static List<Point> getInsetPolygon(List<Point> points, double margin) {
List<Point> result = new ArrayList<>();
int n = points.size();
for (int i = 0; i < n; i++) {
@@ -207,12 +236,114 @@
return result;
}
+ private static void addSafeConnection(List<PathSegment> segments, Point start, Point end, List<Point> polygon) {
+ if (isSegmentSafe(start, end, polygon)) {
+ segments.add(new PathSegment(start, end, false));
+ } else {
+ List<Point> path = getBoundaryPath(start, end, polygon);
+ for (int i = 0; i < path.size() - 1; i++) {
+ segments.add(new PathSegment(path.get(i), path.get(i+1), false));
+ }
+ }
+ }
+
+ private static boolean isSegmentSafe(Point p1, Point p2, List<Point> polygon) {
+ Point mid = new Point((p1.x + p2.x) / 2, (p1.y + p2.y) / 2);
+ if (!isPointInPolygon(mid, polygon)) return false;
+
+ for (int i = 0; i < polygon.size(); i++) {
+ Point a = polygon.get(i);
+ Point b = polygon.get((i + 1) % polygon.size());
+ if (isSamePoint(p1, a) || isSamePoint(p1, b) || isSamePoint(p2, a) || isSamePoint(p2, b)) continue;
+ if (segmentsIntersect(p1, p2, a, b)) return false;
+ }
+ return true;
+ }
+
+ private static boolean isSamePoint(Point a, Point b) {
+ return Math.abs(a.x - b.x) < 1e-4 && Math.abs(a.y - b.y) < 1e-4;
+ }
+
+ private static boolean segmentsIntersect(Point a, Point b, Point c, Point d) {
+ return ccw(a, c, d) != ccw(b, c, d) && ccw(a, b, c) != ccw(a, b, d);
+ }
+
+ private static boolean ccw(Point a, Point b, Point c) {
+ return (c.y - a.y) * (b.x - a.x) > (b.y - a.y) * (c.x - a.x);
+ }
+
+ private static boolean isPointInPolygon(Point p, List<Point> polygon) {
+ boolean result = false;
+ for (int i = 0, j = polygon.size() - 1; i < polygon.size(); j = i++) {
+ if ((polygon.get(i).y > p.y) != (polygon.get(j).y > p.y) &&
+ (p.x < (polygon.get(j).x - polygon.get(i).x) * (p.y - polygon.get(i).y) / (polygon.get(j).y - polygon.get(i).y) + polygon.get(i).x)) {
+ result = !result;
+ }
+ }
+ return result;
+ }
+
+ private static List<Point> getBoundaryPath(Point start, Point end, List<Point> polygon) {
+ int idx1 = getEdgeIndex(start, polygon);
+ int idx2 = getEdgeIndex(end, polygon);
+
+ if (idx1 == -1 || idx2 == -1 || idx1 == idx2) {
+ return Arrays.asList(start, end);
+ }
+
+ List<Point> path1 = new ArrayList<>();
+ path1.add(start);
+ int curr = idx1;
+ while (curr != idx2) {
+ path1.add(polygon.get((curr + 1) % polygon.size()));
+ curr = (curr + 1) % polygon.size();
+ }
+ path1.add(end);
+
+ List<Point> pathRev = new ArrayList<>();
+ pathRev.add(start);
+ curr = idx1;
+ while (curr != idx2) {
+ pathRev.add(polygon.get(curr));
+ curr = (curr - 1 + polygon.size()) % polygon.size();
+ }
+ pathRev.add(polygon.get((idx2 + 1) % polygon.size()));
+ pathRev.add(end);
+
+ return getPathLength(path1) < getPathLength(pathRev) ? path1 : pathRev;
+ }
+
+ private static double getPathLength(List<Point> path) {
+ double len = 0;
+ for (int i = 0; i < path.size() - 1; i++) {
+ len += Math.hypot(path.get(i).x - path.get(i+1).x, path.get(i).y - path.get(i+1).y);
+ }
+ return len;
+ }
+
+ private static int getEdgeIndex(Point p, List<Point> poly) {
+ for (int i = 0; i < poly.size(); i++) {
+ Point p1 = poly.get(i);
+ Point p2 = poly.get((i + 1) % poly.size());
+ if (distToSegment(p, p1, p2) < 1e-3) return i;
+ }
+ return -1;
+ }
+
+ private static double distToSegment(Point p, Point s, Point e) {
+ double l2 = (s.x - e.x)*(s.x - e.x) + (s.y - e.y)*(s.y - e.y);
+ if (l2 == 0) return Math.hypot(p.x - s.x, p.y - s.y);
+ double t = ((p.x - s.x) * (e.x - s.x) + (p.y - s.y) * (e.y - s.y)) / l2;
+ t = Math.max(0, Math.min(1, t));
+ return Math.hypot(p.x - (s.x + t * (e.x - s.x)), p.y - (s.y + t * (e.y - s.y)));
+ }
+
private static Point rotatePoint(Point p, double angle) {
double cos = Math.cos(angle), sin = Math.sin(angle);
return new Point(p.x * cos - p.y * sin, p.x * sin + p.y * cos);
}
- private static void ensureCounterClockwise(List<Point> points) {
+ public static void ensureCounterClockwise(List<Point> points) {
double sum = 0;
for (int i = 0; i < points.size(); i++) {
Point p1 = points.get(i), p2 = points.get((i + 1) % points.size());
diff --git a/src/sendMQTT/HTTPUtils/PropertiesFileUploader.java b/src/sendMQTT/HTTPUtils/PropertiesFileUploader.java
index 80d8576..3003828 100644
--- a/src/sendMQTT/HTTPUtils/PropertiesFileUploader.java
+++ b/src/sendMQTT/HTTPUtils/PropertiesFileUploader.java
@@ -146,7 +146,6 @@
// 璋冪敤Server.propertiesFileToJson鏂规硶鐢熸垚JSON瀛楃涓�
String jsonData = propertiesFileToJson(filePath);
- System.out.println("宸叉垚鍔熷皢Properties鏂囦欢杞崲涓篔SON: " + filePath);
// 鏋勫缓瀹屾暣鐨刄RL锛堝寘鍚玣ilename鍙傛暟锛岃繘琛孶RL缂栫爜锛�
String encodedFilename = URLEncoder.encode(filename, StandardCharsets.UTF_8.name());
@@ -170,7 +169,6 @@
ObjectMapper objectMapper = new ObjectMapper();
FileUploadResponse response = objectMapper.readValue(responseJson, FileUploadResponse.class);
- System.out.println("鏂囦欢涓婁紶鎴愬姛: " + response.getSavedFilename());
return response;
} finally {
diff --git a/src/sendMQTT/Server.java b/src/sendMQTT/Server.java
index 8520ab3..bcf26e4 100644
--- a/src/sendMQTT/Server.java
+++ b/src/sendMQTT/Server.java
@@ -71,7 +71,6 @@
MqttMessage message = new MqttMessage();
message.setPayload(messageJson.getBytes("UTF-8"));
client.publish(topic, message);
- System.out.println("鍙戦�佹暟鎹埌涓婚: " + topic);
} catch (MqttException e) {
throw new RuntimeException(e);
} catch (UnsupportedEncodingException e) {
diff --git a/src/set/Setsys.java b/src/set/Setsys.java
index bff9a33..ebdccbc 100644
--- a/src/set/Setsys.java
+++ b/src/set/Setsys.java
@@ -264,14 +264,7 @@
* 鏄剧ず褰撳墠鎵�鏈夊睘鎬у��
*/
public void displayProperties() {
- System.out.println("褰撳墠灞炴�у��:");
- System.out.println("mowerId: " + (mowerId != null ? mowerId : "鏈缃�"));
- System.out.println("cuttingWidth: " + (cuttingWidth != null ? cuttingWidth : "鏈缃�"));
- System.out.println("simCardNumber: " + (simCardNumber != null ? simCardNumber : "鏈缃�"));
- System.out.println("handheldMarkerId: " + (handheldMarkerId != null ? handheldMarkerId : "鏈缃�"));
- System.out.println("firmwareVersion: " + (firmwareVersion != null ? firmwareVersion : "鏈缃�"));
- System.out.println("appVersion: " + (appVersion != null ? appVersion : "鏈缃�"));
- System.out.println("idleTrailDurationSeconds: " + idleTrailDurationSeconds);
+ // 鏄剧ず灞炴�у姛鑳藉凡绂佺敤
}
/**
diff --git a/src/udpdell/Mqttserver.java b/src/udpdell/Mqttserver.java
index a393604..7d226ce 100644
--- a/src/udpdell/Mqttserver.java
+++ b/src/udpdell/Mqttserver.java
@@ -23,7 +23,6 @@
ResponseData responseData = null;
try {
responseData = DeviceMessageParser.parseResponseData(responseJson);
- System.out.println("鍘熷娑堟伅ID: " + responseData.getOriginalMsgId());
} catch (JsonProcessingException e) {
e.printStackTrace();
} catch (IllegalArgumentException e) {
@@ -61,10 +60,8 @@
" }\n" +
"}";
try {
- System.out.println("=== GPS鏁版嵁瑙f瀽绀轰緥锛堟柊鍗忚鏍煎紡锛� ===");
GPSData gpsData2 = DeviceMessageParser.parseGPSData(gpsJsonStr);
String string2 = gpsData2.toString();
- System.out.println(string2);
} catch (JsonProcessingException e) {
e.printStackTrace();
@@ -85,7 +82,6 @@
0.5, // 閫熷害0.5绫�/绉�
10 // 鎸佺画10绉�
);
- System.out.println(json2);
}
diff --git a/src/udpdell/UDPServer.java b/src/udpdell/UDPServer.java
index 054939e..4cec508 100644
--- a/src/udpdell/UDPServer.java
+++ b/src/udpdell/UDPServer.java
@@ -50,8 +50,6 @@
ExecutorService executor = Executors.newFixedThreadPool(THREAD_POOL_SIZE);
try (DatagramSocket socket = new DatagramSocket(PORT)) {
- System.out.println("UDPServer started on port " + PORT);
-
while (!Thread.currentThread().isInterrupted()) {
byte[] buffer = new byte[BUFFER_SIZE];
DatagramPacket packet = new DatagramPacket(buffer, buffer.length);
@@ -86,7 +84,6 @@
return;
}
int sequence = incrementReceivedPacketCounter();
- System.out.println("鏀跺埌浜嗗樊鍒嗘暟鎹�(" + sequence + ")锛�" + message);
// 浣跨敤Gpstoxuzuobiao澶勭悊骞惰幏鍙朮Y鍧愭爣
double[] xy = Gpstoxuzuobiao.processGNGGAToXY(message);
@@ -97,7 +94,6 @@
Coordinate.parseGNGGAToCoordinateList(message);
int count = Coordinate.coordinates.size();
- System.out.println("savenum:" + count);
Device.updateFromGNGGA(message, fields[15]);
}
@@ -118,7 +114,6 @@
return;
}
int sequence = incrementReceivedPacketCounter();
- System.out.println("鏀跺埌浜嗕覆鍙f暟鎹�(" + sequence + ")锛�" + message);
// 浣跨敤Gpstoxuzuobiao澶勭悊骞惰幏鍙朮Y鍧愭爣
double[] xy = Gpstoxuzuobiao.processGNGGAToXY(message);
@@ -129,7 +124,6 @@
Coordinate.dellchuankougngga(message);
int count = Coordinate.coordinates.size();
- System.out.println("savenum:" + count);
Device.updateFromSerialGNGGA(message);
}
diff --git a/src/user/Usrdell.java b/src/user/Usrdell.java
index daafd0b..05d9e18 100644
--- a/src/user/Usrdell.java
+++ b/src/user/Usrdell.java
@@ -32,7 +32,6 @@
userProperties = new Properties();
try (FileInputStream input = new FileInputStream(PROPERTIES_FILE)) {
userProperties.load(input);
- System.out.println("鐢ㄦ埛灞炴�у垵濮嬪寲鎴愬姛锛�");
} catch (IOException e) {
System.err.println("鍒濆鍖栧け璐ワ紝鏂囦欢鏈壘鍒版垨璇诲彇閿欒: " + e.getMessage());
// 濡傛灉鏂囦欢涓嶅瓨鍦紝鍒涘缓榛樿灞炴��
diff --git a/src/utils/FiniteChecker.java b/src/utils/FiniteChecker.java
new file mode 100644
index 0000000..f5bd880
--- /dev/null
+++ b/src/utils/FiniteChecker.java
@@ -0,0 +1,20 @@
+package utils;
+
+/**
+ * 宸ュ叿绫伙細妫�鏌ouble鍊兼槸鍚︽湁闄愶紙鍏煎浣庣増鏈琂ava锛�
+ * 鐢ㄤ簬鏇夸唬 Double.isFinite() 鏂规硶
+ */
+public final class FiniteChecker {
+ private FiniteChecker() {
+ // 宸ュ叿绫伙紝涓嶅厑璁稿疄渚嬪寲
+ }
+
+ /**
+ * 妫�鏌ouble鍊兼槸鍚︽湁闄愶紙涓嶆槸NaN鎴栨棤绌峰ぇ锛�
+ * @param value 瑕佹鏌ョ殑double鍊�
+ * @return true濡傛灉鍊兼槸鏈夐檺鐨勶紝false濡傛灉鏄疦aN鎴栨棤绌峰ぇ
+ */
+ public static boolean isFinite(double value) {
+ return !Double.isNaN(value) && !Double.isInfinite(value);
+ }
+}
diff --git a/src/yaokong/Control03.java b/src/yaokong/Control03.java
index 6401d72..308ab11 100644
--- a/src/yaokong/Control03.java
+++ b/src/yaokong/Control03.java
@@ -217,9 +217,6 @@
nextForward = clampSpeed(nextForward);
byte[] payload = buildSteeringCommandBytes((byte) nextSteering, (byte) nextForward);
- // 璋冭瘯锛氭墦鍗板彂閫佺殑鏁版嵁
- System.out.println("鍙戦�佽浆鍚戞寚浠�: " + bytesToHex(payload));
-
boolean success = sendmessage.sendViaActive(payload);
if (success) {
currentSteeringSpeed = nextSteering;
@@ -299,23 +296,17 @@
* 娴嬭瘯鍑芥暟锛氶獙璇佽浆鍚戞寚浠ゆ瀯寤�
*/
public static void testBuildSteeringCommand() {
- System.out.println("=== 娴嬭瘯淇鍚庣殑杞悜鎸囦护鏋勫缓 ===");
-
// 娴嬭瘯1锛氱洿琛屽墠杩�
byte[] cmd1 = buildSteeringCommandBytes((byte)0, (byte)50);
- System.out.println("鐩磋鍓嶈繘50: " + bytesToHex(cmd1));
// 娴嬭瘯2锛氬乏杞墠杩�
byte[] cmd2 = buildSteeringCommandBytes((byte)-30, (byte)40);
- System.out.println("宸﹁浆鍓嶈繘: " + bytesToHex(cmd2));
// 娴嬭瘯3锛氬彸杞悗閫�
byte[] cmd3 = buildSteeringCommandBytes((byte)20, (byte)-60);
- System.out.println("鍙宠浆鍚庨��: " + bytesToHex(cmd3));
// 娴嬭瘯4锛氬仠姝�
byte[] cmd4 = buildSteeringCommandBytes((byte)0, (byte)0);
- System.out.println("鍋滄: " + bytesToHex(cmd4));
}
}
\ No newline at end of file
diff --git a/src/yaokong/Control05.java b/src/yaokong/Control05.java
index 39e8aa2..89945ab 100644
--- a/src/yaokong/Control05.java
+++ b/src/yaokong/Control05.java
@@ -158,9 +158,6 @@
}
byte[] payload = buildPowerCommandBytes(powerValue);
- // 璋冭瘯锛氭墦鍗板彂閫佺殑鏁版嵁
- System.out.println("鍙戦�佺數婧愭帶鍒舵寚浠�: " + bytesToHex(payload));
-
return sendmessage.sendViaActive(payload);
}
@@ -186,14 +183,10 @@
* 娴嬭瘯鍑芥暟锛氶獙璇佺數婧愭帶鍒舵寚浠ゆ瀯寤�
*/
public static void testBuildPowerCommand() {
- System.out.println("=== 娴嬭瘯鐢垫簮鎺у埗鎸囦护鏋勫缓 ===");
-
// 娴嬭瘯1锛氬惎鍔ㄦ寚浠�
byte[] cmd1 = buildPowerCommandBytes((byte)1);
- System.out.println("鍚姩鏈哄櫒: " + bytesToHex(cmd1));
// 娴嬭瘯2锛氬叧闂寚浠�
byte[] cmd2 = buildPowerCommandBytes((byte)0);
- System.out.println("鍏抽棴鏈哄櫒: " + bytesToHex(cmd2));
}
}
\ No newline at end of file
diff --git a/src/yaokong/Control06.java b/src/yaokong/Control06.java
index 5e367ff..b9549f2 100644
--- a/src/yaokong/Control06.java
+++ b/src/yaokong/Control06.java
@@ -180,8 +180,6 @@
}
byte[] payload = buildBladeCommandBytes((byte) targetHeight);
- // 璋冭瘯锛氭墦鍗板彂閫佺殑鏁版嵁
- System.out.println("鍙戦�佸垁鐩樺崌闄嶆寚浠�: " + bytesToHex(payload));
boolean success = sendmessage.sendViaActive(payload);
if (success) {
@@ -228,18 +226,13 @@
* 娴嬭瘯鍑芥暟锛氶獙璇佸垁鐩樺崌闄嶆寚浠ゆ瀯寤�
*/
public static void testBuildBladeCommand() {
- System.out.println("=== 娴嬭瘯鍒�鐩樺崌闄嶆寚浠ゆ瀯寤� ===");
-
// 娴嬭瘯1锛氭彁鍗囨寚浠�
byte[] cmd1 = buildBladeCommandBytes((byte)50);
- System.out.println("鎻愬崌50%: " + bytesToHex(cmd1));
// 娴嬭瘯2锛氶檷浣庢寚浠�
byte[] cmd2 = buildBladeCommandBytes((byte)-30);
- System.out.println("闄嶄綆30%: " + bytesToHex(cmd2));
// 娴嬭瘯3锛氬綊闆舵寚浠�
byte[] cmd3 = buildBladeCommandBytes((byte)0);
- System.out.println("褰掗浂: " + bytesToHex(cmd3));
}
}
\ No newline at end of file
diff --git a/src/yaokong/Control07.java b/src/yaokong/Control07.java
index 5c1ab2e..dc94580 100644
--- a/src/yaokong/Control07.java
+++ b/src/yaokong/Control07.java
@@ -157,9 +157,6 @@
}
byte[] payload = buildLightCommandBytes(lightValue);
- // 璋冭瘯锛氭墦鍗板彂閫佺殑鏁版嵁
- System.out.println("鍙戦�佸ぇ鐏帶鍒舵寚浠�: " + bytesToHex(payload));
-
return sendmessage.sendViaActive(payload);
}
@@ -185,14 +182,10 @@
* 娴嬭瘯鍑芥暟锛氶獙璇佸ぇ鐏帶鍒舵寚浠ゆ瀯寤�
*/
public static void testBuildLightCommand() {
- System.out.println("=== 娴嬭瘯澶х伅鎺у埗鎸囦护鏋勫缓 ===");
-
// 娴嬭瘯1锛氬紑鐏寚浠�
byte[] cmd1 = buildLightCommandBytes((byte)1);
- System.out.println("寮�鍚ぇ鐏�: " + bytesToHex(cmd1));
// 娴嬭瘯2锛氬叧鐏寚浠�
byte[] cmd2 = buildLightCommandBytes((byte)0);
- System.out.println("鍏抽棴澶х伅: " + bytesToHex(cmd2));
}
}
\ No newline at end of file
diff --git a/src/yaokong/SteeringCommandSender.java b/src/yaokong/SteeringCommandSender.java
index 0f2bfdf..8abd82d 100644
--- a/src/yaokong/SteeringCommandSender.java
+++ b/src/yaokong/SteeringCommandSender.java
@@ -19,9 +19,6 @@
// 浣跨敤淇鍚庣殑鏂规硶鏋勫缓鎸囦护
byte[] commandBytes = buildSteeringCommandBytes(steeringSpeed, forwardSpeed);
- // 璋冭瘯锛氭墦鍗板彂閫佺殑鏁版嵁
- System.out.println("鍙戦�佷慨姝e悗鐨勮浆鍚戞寚浠�: " + bytesToHex(commandBytes));
-
// 鍙戦�佹暟鎹�
outputStream.write(commandBytes);
outputStream.flush();
diff --git a/src/zhuye/Coordinate.java b/src/zhuye/Coordinate.java
index 644953d..89e789d 100644
--- a/src/zhuye/Coordinate.java
+++ b/src/zhuye/Coordinate.java
@@ -276,8 +276,6 @@
String line;
StringBuilder gnggaData = new StringBuilder();
- System.out.println("寮�濮嬭鍙朑NGGA鏂囦欢: " + file.getAbsolutePath());
-
while ((line = reader.readLine()) != null) {
// 娓呯悊鏁版嵁锛氱Щ闄ゅ浣欑殑绌烘牸鍜屾崲琛�
line = line.trim();
@@ -295,18 +293,6 @@
if (gnggaData.length() > 0) {
parseGNGGAToCoordinateList(gnggaData.toString());
loadedCount = coordinates.size();
- System.out.println("鎴愬姛鍔犺浇 " + loadedCount + " 涓潗鏍囩偣");
-
- // 杈撳嚭缁熻淇℃伅
- if (loadedCount > 0) {
- double[] elevationRange = getElevationRange();
- double avgElevation = getAverageElevation();
- System.out.println("娴锋嫈缁熻: 鑼冨洿=" + String.format("%.2f", elevationRange[0]) +
- " - " + String.format("%.2f", elevationRange[1]) + "绫�, 骞冲潎=" +
- String.format("%.2f", avgElevation) + "绫�");
- }
- } else {
- System.out.println("鏂囦欢涓湭鎵惧埌鏈夋晥鐨凣NGGA鏁版嵁");
}
} catch (IOException e) {
diff --git a/src/zhuye/MapRenderer.java b/src/zhuye/MapRenderer.java
index 2d77ce3..c39b39d 100644
--- a/src/zhuye/MapRenderer.java
+++ b/src/zhuye/MapRenderer.java
@@ -18,6 +18,7 @@
import java.util.List;
import java.util.Locale;
import java.util.Set;
+import java.util.function.Consumer;
import java.io.File;
import set.Setsys;
import gecaoji.Device;
@@ -632,7 +633,7 @@
* 娣诲姞瀵艰埅棰勮杞ㄨ抗鐐�
*/
public void addNavigationPreviewTrackPoint(Point2D.Double point) {
- if (point != null && Double.isFinite(point.x) && Double.isFinite(point.y)) {
+ if (point != null && isFinite(point.x) && isFinite(point.y)) {
navigationPreviewTrack.add(new Point2D.Double(point.x, point.y));
if (visualizationPanel != null) {
visualizationPanel.repaint();
@@ -750,7 +751,7 @@
return;
}
Point2D.Double position = mower.getPosition();
- if (position == null || !Double.isFinite(position.x) || !Double.isFinite(position.y)) {
+ if (position == null || !isFinite(position.x) || !isFinite(position.y)) {
pendingTrackBreak = true;
return;
}
@@ -776,7 +777,7 @@
}
realtimeMowingTrack.add(candidate);
- if (!pendingTrackBreak && lastPoint != null && Double.isFinite(distance)) {
+ if (!pendingTrackBreak && lastPoint != null && isFinite(distance)) {
trackLengthMeters += distance;
}
@@ -807,7 +808,7 @@
}
Point2D.Double position = mower.getPosition();
- if (position == null || !Double.isFinite(position.x) || !Double.isFinite(position.y)) {
+ if (position == null || !isFinite(position.x) || !isFinite(position.y)) {
return;
}
@@ -852,7 +853,7 @@
// 鍒锋柊mower浣嶇疆锛屼娇鐢ㄦ渶鏂扮殑Device鏁版嵁
mower.refreshFromDevice();
Point2D.Double position = mower.getPosition();
- if (position == null || !Double.isFinite(position.x) || !Double.isFinite(position.y)) {
+ if (position == null || !isFinite(position.x) || !isFinite(position.y)) {
return;
}
@@ -963,7 +964,7 @@
}
private String formatTrackCoordinate(double value) {
- if (!Double.isFinite(value)) {
+ if (!isFinite(value)) {
return "0";
}
return String.format(Locale.US, "%.3f", value);
@@ -1154,7 +1155,7 @@
try {
double x = Double.parseDouble(parts[0].trim());
double y = Double.parseDouble(parts[1].trim());
- if (!Double.isFinite(x) || !Double.isFinite(y)) {
+ if (!isFinite(x) || !isFinite(y)) {
continue;
}
Point2D.Double current = new Point2D.Double(x, y);
@@ -1459,6 +1460,7 @@
String safetyDistance = null;
String obstaclesCoords = null;
String mowingPattern = null;
+ String plannedPathStr = null;
// 浠庡綋鍓嶅湴鍧楃紪鍙疯幏鍙栧湴鍧椾俊鎭�
if (currentBoundaryLandNumber != null) {
@@ -1468,6 +1470,8 @@
mowingWidth = landData.getMowingWidth();
safetyDistance = landData.getMowingSafetyDistance();
mowingPattern = landData.getMowingPattern();
+ // 浠庡湴鍧楄幏鍙杙lannedPath灞炴�у�间綔涓鸿矾寰�
+ plannedPathStr = landData.getPlannedPath();
// 鑾峰彇闅滅鐗╁潗鏍�
try {
@@ -1525,9 +1529,18 @@
}
}
+ // 濡傛灉浠庡湴鍧楄幏鍙栧埌浜嗚矾寰勶紝浣跨敤鍦板潡鐨勮矾寰勶紱鍚﹀垯浣跨敤currentPlannedPath
+ List<Point2D.Double> pathToDraw = currentPlannedPath;
+ if (plannedPathStr != null && !plannedPathStr.trim().isEmpty() && !"-1".equals(plannedPathStr.trim())) {
+ // 浠庡湴鍧楄幏鍙栫殑璺緞
+ pathToDraw = lujingdraw.parsePlannedPath(plannedPathStr);
+ }
+
// 璋冪敤甯﹀湴鍧椾俊鎭殑缁樺埗鏂规硶
- lujingdraw.drawPlannedPath(g2d, currentPlannedPath, scale, arrowScale,
+ if (pathToDraw != null && pathToDraw.size() >= 2) {
+ lujingdraw.drawPlannedPath(g2d, pathToDraw, scale, arrowScale,
boundaryCoords, mowingWidth, safetyDistance, obstaclesCoords, mowingPattern);
+ }
}
private void drawCircleSampleMarkers(Graphics2D g2d, List<double[]> markers, double scale) {
@@ -1549,7 +1562,7 @@
FontMetrics metrics = g2d.getFontMetrics(labelFont);
for (double[] pt : markers) {
- if (pt == null || pt.length < 2 || !Double.isFinite(pt[0]) || !Double.isFinite(pt[1])) {
+ if (pt == null || pt.length < 2 || !isFinite(pt[0]) || !isFinite(pt[1])) {
continue;
}
double x = pt[0];
@@ -1647,7 +1660,7 @@
}
double x = pt[0];
double y = pt[1];
- if (!Double.isFinite(x) || !Double.isFinite(y)) {
+ if (!isFinite(x) || !isFinite(y)) {
continue;
}
circleSampleMarkers.add(new double[]{x, y});
@@ -1870,7 +1883,7 @@
private double computeSelectionThresholdPixels() {
double scaleFactor = Math.max(0.5, scale);
double diameterScale = boundaryPointSizeScale * (previewSizingEnabled ? PREVIEW_BOUNDARY_MARKER_SCALE : 1.0d);
- if (!Double.isFinite(diameterScale) || diameterScale <= 0.0d) {
+ if (!isFinite(diameterScale) || diameterScale <= 0.0d) {
diameterScale = 1.0d;
}
double markerDiameterWorld = Math.max(1.0, (10.0 / scaleFactor) * 0.2 * diameterScale);
@@ -2035,7 +2048,7 @@
}
private boolean isPointInsideActiveBoundary(Point2D.Double point) {
- if (point == null || !Double.isFinite(point.x) || !Double.isFinite(point.y)) {
+ if (point == null || !isFinite(point.x) || !isFinite(point.y)) {
return false;
}
if (realtimeTrackLandNumber == null) {
@@ -2046,7 +2059,7 @@
}
private boolean isPointInsideBoundary(Point2D.Double point, Path2D.Double path) {
- if (point == null || path == null || !Double.isFinite(point.x) || !Double.isFinite(point.y)) {
+ if (point == null || path == null || !isFinite(point.x) || !isFinite(point.y)) {
return false;
}
if (path.contains(point.x, point.y)) {
@@ -2067,7 +2080,7 @@
Path2D.Double path = new Path2D.Double();
boolean started = false;
for (Point2D.Double point : boundary) {
- if (point == null || !Double.isFinite(point.x) || !Double.isFinite(point.y)) {
+ if (point == null || !isFinite(point.x) || !isFinite(point.y)) {
continue;
}
if (!started) {
@@ -2103,7 +2116,7 @@
// 璁剧疆鐐圭殑澶у皬锛堥殢缂╂斁鍙樺寲锛�
double scaleFactor = Math.max(0.5, scale);
double clampedScale = boundaryPointSizeScale * (previewSizingEnabled ? PREVIEW_BOUNDARY_MARKER_SCALE : 1.0d);
- if (!Double.isFinite(clampedScale) || clampedScale <= 0.0d) {
+ if (!isFinite(clampedScale) || clampedScale <= 0.0d) {
clampedScale = 1.0d;
}
double minimumDiameter = clampedScale < 1.0 ? 0.5 : 1.0;
@@ -2552,7 +2565,7 @@
}
double x = coord.getX();
double y = coord.getY();
- if (!Double.isFinite(x) || !Double.isFinite(y)) {
+ if (!isFinite(x) || !isFinite(y)) {
continue;
}
copy.add(new Obstacledge.XYCoordinate(x, y));
@@ -2890,7 +2903,7 @@
}
public void setBoundaryPointSizeScale(double sizeScale) {
- double normalized = (Double.isFinite(sizeScale) && sizeScale > 0.0d) ? sizeScale : 1.0d;
+ double normalized = (isFinite(sizeScale) && sizeScale > 0.0d) ? sizeScale : 1.0d;
if (Math.abs(boundaryPointSizeScale - normalized) < 1e-6) {
return;
}
@@ -2918,7 +2931,7 @@
}
public void setBoundaryPreviewMarkerScale(double markerScale) {
- double normalized = Double.isFinite(markerScale) && markerScale > 0.0d ? markerScale : 1.0d;
+ double normalized = isFinite(markerScale) && markerScale > 0.0d ? markerScale : 1.0d;
if (Math.abs(boundaryPreviewMarkerScale - normalized) < 1e-6) {
return;
}
@@ -2955,7 +2968,7 @@
}
public void addHandheldBoundaryPoint(double x, double y) {
- if (!Double.isFinite(x) || !Double.isFinite(y)) {
+ if (!isFinite(x) || !isFinite(y)) {
return;
}
if (!handheldBoundaryPreviewActive) {
@@ -3067,8 +3080,8 @@
Point2D.Double mowerPosition = mower.getPosition();
if (mowerPosition == null
- || !Double.isFinite(mowerPosition.x)
- || !Double.isFinite(mowerPosition.y)) {
+ || !isFinite(mowerPosition.x)
+ || !isFinite(mowerPosition.y)) {
return expanded;
}
@@ -3512,9 +3525,9 @@
/**
* 璁剧疆杈圭晫棰勮鏇存柊鍥炶皟
*/
- private java.util.function.Consumer<String> boundaryPreviewUpdateCallback;
+ private Consumer<String> boundaryPreviewUpdateCallback;
- public void setBoundaryPreviewUpdateCallback(java.util.function.Consumer<String> callback) {
+ public void setBoundaryPreviewUpdateCallback(Consumer<String> callback) {
this.boundaryPreviewUpdateCallback = callback;
}
@@ -3531,4 +3544,12 @@
fitBoundsToView(bounds);
}
}
-}
\ No newline at end of file
+
+ /**
+ * 妫�鏌ouble鍊兼槸鍚︽湁闄愶紙涓嶆槸NaN鎴栨棤绌峰ぇ锛�
+ * 鍏煎浣庣増鏈琂ava
+ */
+ private static boolean isFinite(double value) {
+ return !Double.isNaN(value) && !Double.isInfinite(value);
+ }
+}
diff --git a/src/zhuye/ShouyeLauncher.java b/src/zhuye/ShouyeLauncher.java
index 197ec09..e7c3fa1 100644
--- a/src/zhuye/ShouyeLauncher.java
+++ b/src/zhuye/ShouyeLauncher.java
@@ -7,7 +7,6 @@
public class ShouyeLauncher {
public static void main(String[] args) {
SwingUtilities.invokeLater(() -> {
- System.out.println("Starting Shouye via Launcher...");
JFrame frame = new JFrame("AutoMow - 棣栭〉");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(400, 800);
diff --git a/src/zhuye/WangfanDraw.java b/src/zhuye/WangfanDraw.java
index c56abf5..19c80ff 100644
--- a/src/zhuye/WangfanDraw.java
+++ b/src/zhuye/WangfanDraw.java
@@ -208,13 +208,13 @@
double lat = helper.parseDMToDecimal(latest.getLatitude(), latest.getLatDirection());
double lon = helper.parseDMToDecimal(latest.getLongitude(), latest.getLonDirection());
- if (!Double.isFinite(lat) || !Double.isFinite(lon)) {
+ if (!isFinite(lat) || !isFinite(lon)) {
return;
}
double[] local = helper.convertLatLonToLocal(lat, lon, baseLatLon[0], baseLatLon[1]);
Point2D.Double candidate = new Point2D.Double(local[0], local[1]);
- if (!Double.isFinite(candidate.x) || !Double.isFinite(candidate.y)) {
+ if (!isFinite(candidate.x) || !isFinite(candidate.y)) {
return;
}
@@ -427,5 +427,12 @@
g2d.setStroke(new BasicStroke(dashWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 10.0f, dashPattern, 0.0f));
g2d.draw(path);
}
+
+ /**
+ * 妫�鏌ouble鍊兼槸鍚︽湁闄愶紙涓嶆槸NaN鎴栨棤绌峰ぇ锛�
+ * 鍏煎浣庣増鏈琂ava
+ */
+ private static boolean isFinite(double value) {
+ return !Double.isNaN(value) && !Double.isInfinite(value);
+ }
}
-
diff --git a/src/zhuye/adddikuaiyulan.java b/src/zhuye/adddikuaiyulan.java
index 4b382d2..92ac36e 100644
--- a/src/zhuye/adddikuaiyulan.java
+++ b/src/zhuye/adddikuaiyulan.java
@@ -41,7 +41,7 @@
// 杩囨护鏈夋晥鐐�
List<Point2D.Double> validPoints = new java.util.ArrayList<>();
for (Point2D.Double point : previewPoints) {
- if (point != null && Double.isFinite(point.x) && Double.isFinite(point.y)) {
+ if (point != null && isFinite(point.x) && isFinite(point.y)) {
validPoints.add(point);
}
}
@@ -125,12 +125,12 @@
double effectiveScale = Math.max(0.01d, scale);
double markerSize = cachedMarkerPixelDiameter / effectiveScale;
- double normalizedScale = Double.isFinite(diameterScale) && diameterScale > 0.0d ? diameterScale : 1.0d;
+ double normalizedScale = isFinite(diameterScale) && diameterScale > 0.0d ? diameterScale : 1.0d;
markerSize *= normalizedScale;
double markerRadius = markerSize / 2.0d;
for (Point2D.Double point : previewPoints) {
- if (point == null || !Double.isFinite(point.x) || !Double.isFinite(point.y)) {
+ if (point == null || !isFinite(point.x) || !isFinite(point.y)) {
continue;
}
Shape marker = new Ellipse2D.Double(point.x - markerRadius, point.y - markerRadius, markerSize, markerSize);
@@ -141,4 +141,12 @@
g2d.setStroke(originalStroke);
g2d.setColor(originalColor);
}
+
+ /**
+ * 妫�鏌ouble鍊兼槸鍚︽湁闄愶紙涓嶆槸NaN鎴栨棤绌峰ぇ锛�
+ * 鍏煎浣庣増鏈琂ava
+ */
+ private static boolean isFinite(double value) {
+ return !Double.isNaN(value) && !Double.isInfinite(value);
+ }
}
diff --git a/src/zhuye/pointandnumber.java b/src/zhuye/pointandnumber.java
index 582aca5..f0c0477 100644
--- a/src/zhuye/pointandnumber.java
+++ b/src/zhuye/pointandnumber.java
@@ -39,7 +39,7 @@
double boundaryLineWidth = 3.0 / scaleFactor; // 杈圭晫绾垮搴�
double markerDiameter = boundaryLineWidth * 2.0; // 鎻忕偣鐩村緞锛堣竟鐣岀嚎瀹藉害鐨�2鍊嶏級
// 搴旂敤鐩村緞缂╂斁鍥犲瓙
- if (diameterScale > 0.0 && Double.isFinite(diameterScale)) {
+ if (diameterScale > 0.0 && isFinite(diameterScale)) {
markerDiameter *= diameterScale;
}
double markerRadius = markerDiameter / 2.0; // 鍗婂緞
@@ -63,4 +63,12 @@
double dy = a.y - b.y; // Y宸��
return Math.hypot(dx, dy) <= threshold; // 璺濈鍒ゆ柇
}
+
+ /**
+ * 妫�鏌ouble鍊兼槸鍚︽湁闄愶紙涓嶆槸NaN鎴栨棤绌峰ぇ锛�
+ * 鍏煎浣庣増鏈琂ava
+ */
+ private static boolean isFinite(double value) {
+ return !Double.isNaN(value) && !Double.isInfinite(value);
+ }
}
diff --git a/src/zhuye/tuowei.java b/src/zhuye/tuowei.java
index 285e33f..f5f25e7 100644
--- a/src/zhuye/tuowei.java
+++ b/src/zhuye/tuowei.java
@@ -36,7 +36,7 @@
continue;
}
Point2D.Double point = sample.getPoint();
- if (point == null || !Double.isFinite(point.x) || !Double.isFinite(point.y)) {
+ if (point == null || !isFinite(point.x) || !isFinite(point.y)) {
continue;
}
if (!started) {
@@ -83,4 +83,12 @@
return point;
}
}
+
+ /**
+ * 妫�鏌ouble鍊兼槸鍚︽湁闄愶紙涓嶆槸NaN鎴栨棤绌峰ぇ锛�
+ * 鍏煎浣庣増鏈琂ava
+ */
+ private static boolean isFinite(double value) {
+ return !Double.isNaN(value) && !Double.isInfinite(value);
+ }
}
diff --git a/user.properties b/user.properties
index c2ae8d7..6c34544 100644
--- a/user.properties
+++ b/user.properties
@@ -1,11 +1,11 @@
#Updated User Properties
-#Fri Dec 26 19:12:46 CST 2025
-email=981894274@qq.com
-language=zh
+#Sat Dec 27 20:42:59 GMT+08:00 2025
+registrationTime=-1
lastLoginTime=1766747566698
password=123456
-registrationTime=-1
-rememberPassword=1
-status=-1
-userId=-1
+rememberPassword=0
+language=zh
userName=981894274@qq.com
+userId=-1
+email=981894274@qq.com
+status=-1
--
Gitblit v1.10.0