张世豪
4 天以前 87d7cf316e983b0398b270de03a8092412af8487
src/set/Setsys.java
@@ -14,6 +14,8 @@
    private String appVersion;
    private int idleTrailDurationSeconds = DEFAULT_IDLE_TRAIL_DURATION_SECONDS;
    private boolean boundaryLengthVisible = false;  // 默认关闭显示边界距离
    private boolean measurementModeEnabled = false;  // 默认关闭测量模式
    private boolean manualBoundaryDrawingMode = false;  // 默认关闭手动绘制边界模式
    
    private static final String PROPERTIES_FILE = "set.properties";
@@ -95,6 +97,22 @@
    public void setBoundaryLengthVisible(boolean visible) {
        this.boundaryLengthVisible = visible;
    }
    public boolean isMeasurementModeEnabled() {
        return measurementModeEnabled;
    }
    public void setMeasurementModeEnabled(boolean enabled) {
        this.measurementModeEnabled = enabled;
    }
    public boolean isManualBoundaryDrawingMode() {
        return manualBoundaryDrawingMode;
    }
    public void setManualBoundaryDrawingMode(boolean enabled) {
        this.manualBoundaryDrawingMode = enabled;
    }
    /**
     * 初始化方法 - 从properties文件读取数据
@@ -115,6 +133,10 @@
            this.idleTrailDurationSeconds = sanitizeIdleTrailDuration(props.getProperty("idleTrailDurationSeconds"));
            String boundaryLengthVisibleStr = props.getProperty("boundaryLengthVisible");
            this.boundaryLengthVisible = "true".equalsIgnoreCase(boundaryLengthVisibleStr);
            String measurementModeEnabledStr = props.getProperty("measurementModeEnabled");
            this.measurementModeEnabled = "true".equalsIgnoreCase(measurementModeEnabledStr);
            String manualBoundaryDrawingModeStr = props.getProperty("manualBoundaryDrawingMode");
            this.manualBoundaryDrawingMode = "true".equalsIgnoreCase(manualBoundaryDrawingModeStr);
                        
        } catch (FileNotFoundException e) {           
            // 文件不存在时,设置所有属性为null
@@ -159,6 +181,12 @@
            case "boundaryLengthVisible":
                this.boundaryLengthVisible = "true".equalsIgnoreCase(value);
                break;
            case "measurementModeEnabled":
                this.measurementModeEnabled = "true".equalsIgnoreCase(value);
                break;
            case "manualBoundaryDrawingMode":
                this.manualBoundaryDrawingMode = "true".equalsIgnoreCase(value);
                break;
            case "mapScale":
                // mapScale不需要在内存中存储,直接更新到文件
                break;
@@ -228,6 +256,8 @@
        this.appVersion = null;
        this.idleTrailDurationSeconds = DEFAULT_IDLE_TRAIL_DURATION_SECONDS;
        this.boundaryLengthVisible = false;  // 默认关闭
        this.measurementModeEnabled = false;  // 默认关闭测量模式
        this.manualBoundaryDrawingMode = false;  // 默认关闭手动绘制边界模式
    }
    /**