From c498385fb7e372d13e2ee76d7b54ae2381728082 Mon Sep 17 00:00:00 2001
From: 张世豪 <979909237@qq.com>
Date: 星期三, 17 十二月 2025 19:35:57 +0800
Subject: [PATCH] 新增了测量模式
---
src/set/Setsys.java | 48 ++++++++++++++++++++++++++++++++++++++----------
1 files changed, 38 insertions(+), 10 deletions(-)
diff --git a/src/set/Setsys.java b/src/set/Setsys.java
index b46d619..a3d9262 100644
--- a/src/set/Setsys.java
+++ b/src/set/Setsys.java
@@ -13,6 +13,8 @@
private String firmwareVersion;
private String appVersion;
private int idleTrailDurationSeconds = DEFAULT_IDLE_TRAIL_DURATION_SECONDS;
+ private boolean boundaryLengthVisible = false; // 榛樿鍏抽棴鏄剧ず杈圭晫璺濈
+ private boolean measurementModeEnabled = false; // 榛樿鍏抽棴娴嬮噺妯″紡
private static final String PROPERTIES_FILE = "set.properties";
@@ -86,6 +88,22 @@
public void setIdleTrailDurationSeconds(int seconds) {
this.idleTrailDurationSeconds = sanitizeIdleTrailDuration(String.valueOf(seconds));
}
+
+ public boolean isBoundaryLengthVisible() {
+ return boundaryLengthVisible;
+ }
+
+ public void setBoundaryLengthVisible(boolean visible) {
+ this.boundaryLengthVisible = visible;
+ }
+
+ public boolean isMeasurementModeEnabled() {
+ return measurementModeEnabled;
+ }
+
+ public void setMeasurementModeEnabled(boolean enabled) {
+ this.measurementModeEnabled = enabled;
+ }
/**
* 鍒濆鍖栨柟娉� - 浠巔roperties鏂囦欢璇诲彇鏁版嵁
@@ -104,15 +122,15 @@
this.firmwareVersion = "-1".equals(props.getProperty("firmwareVersion")) ? null : props.getProperty("firmwareVersion");
this.appVersion = "-1".equals(props.getProperty("appVersion")) ? null : props.getProperty("appVersion");
this.idleTrailDurationSeconds = sanitizeIdleTrailDuration(props.getProperty("idleTrailDurationSeconds"));
-
- System.out.println("鏁版嵁鍒濆鍖栧畬鎴�");
-
- } catch (FileNotFoundException e) {
- System.err.println("灞炴�ф枃浠舵湭鎵惧埌: " + PROPERTIES_FILE);
+ String boundaryLengthVisibleStr = props.getProperty("boundaryLengthVisible");
+ this.boundaryLengthVisible = "true".equalsIgnoreCase(boundaryLengthVisibleStr);
+ String measurementModeEnabledStr = props.getProperty("measurementModeEnabled");
+ this.measurementModeEnabled = "true".equalsIgnoreCase(measurementModeEnabledStr);
+
+ } catch (FileNotFoundException e) {
// 鏂囦欢涓嶅瓨鍦ㄦ椂锛岃缃墍鏈夊睘鎬т负null
setAllPropertiesToNull();
- } catch (IOException e) {
- System.err.println("璇诲彇灞炴�ф枃浠舵椂鍑洪敊: " + e.getMessage());
+ } catch (IOException e) {
setAllPropertiesToNull();
}
}
@@ -149,9 +167,18 @@
this.idleTrailDurationSeconds = durationSeconds;
value = String.valueOf(durationSeconds);
break;
+ case "boundaryLengthVisible":
+ this.boundaryLengthVisible = "true".equalsIgnoreCase(value);
+ break;
+ case "measurementModeEnabled":
+ this.measurementModeEnabled = "true".equalsIgnoreCase(value);
+ break;
+ case "mapScale":
+ // mapScale涓嶉渶瑕佸湪鍐呭瓨涓瓨鍌紝鐩存帴鏇存柊鍒版枃浠�
+ break;
default:
- System.err.println("鏈煡鐨勫睘鎬у悕: " + propertyName);
- return false;
+ // 瀵逛簬鍏朵粬灞炴�э紝涔熷厑璁哥洿鎺ユ洿鏂板埌鏂囦欢锛堜笉鎵撳嵃閿欒锛�
+ break;
}
// 鏇存柊properties鏂囦欢
@@ -177,7 +204,6 @@
// 鍐欏洖鏂囦欢
try (FileOutputStream output = new FileOutputStream(PROPERTIES_FILE)) {
props.store(output, "Mower Configuration Properties - Updated");
- System.out.println("灞炴�� " + propertyName + " 宸叉洿鏂颁负: " + value);
return true;
} catch (IOException e) {
System.err.println("鏇存柊灞炴�ф枃浠跺け璐�: " + e.getMessage());
@@ -215,6 +241,8 @@
this.firmwareVersion = null;
this.appVersion = null;
this.idleTrailDurationSeconds = DEFAULT_IDLE_TRAIL_DURATION_SECONDS;
+ this.boundaryLengthVisible = false; // 榛樿鍏抽棴
+ this.measurementModeEnabled = false; // 榛樿鍏抽棴娴嬮噺妯″紡
}
/**
--
Gitblit v1.10.0