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/zhuye/WangfanDraw.java |   35 +++++++++++++++++++++++++++++++----
 1 files changed, 31 insertions(+), 4 deletions(-)

diff --git a/src/zhuye/WangfanDraw.java b/src/zhuye/WangfanDraw.java
index 464cedf..19c80ff 100644
--- a/src/zhuye/WangfanDraw.java
+++ b/src/zhuye/WangfanDraw.java
@@ -23,6 +23,7 @@
     // 缁樺埗鐘舵��
     private boolean drawingActive = false;
     private boolean paused = false;
+    private boolean isHandheldMode = false;  // 鏄惁浣跨敤鎵嬫寔璁惧妯″紡
     
     // 鍩哄噯鍧愭爣
     private double[] baseLatLon;
@@ -63,9 +64,10 @@
     /**
      * 鍚姩寰�杩旇矾寰勭粯鍒�
      * @param finishCallback 瀹屾垚缁樺埗鏃剁殑鍥炶皟
+     * @param isHandheld 鏄惁浣跨敤鎵嬫寔璁惧妯″紡
      * @return 鏄惁鎴愬姛鍚姩
      */
-    public boolean start(Runnable finishCallback) {
+    public boolean start(Runnable finishCallback, boolean isHandheld) {
         if (mapRenderer == null || helper == null) {
             return false;
         }
@@ -83,6 +85,12 @@
         paused = false;
         this.finishCallback = finishCallback;
         this.baseLatLon = baseLatLonCandidate;
+        this.isHandheldMode = isHandheld;
+        
+        // 濡傛灉鏄墜鎸佽澶囨ā寮忥紝鍒囨崲鍥炬爣
+        if (isHandheld && shouye != null) {
+            shouye.setHandheldMowerIconActive(true);
+        }
 
         // 娓呯┖璺緞鐐�
         synchronized (returnPathPoints) {
@@ -101,6 +109,12 @@
         if (helper != null) {
             helper.enterDrawingControlMode();
         }
+        
+        // 璁剧疆鐘舵�佹彁绀轰负"姝e湪缁樺埗寰�杩旇矾寰�"
+        if (shouye != null) {
+            shouye.setStatusLabelText("姝e湪缁樺埗寰�杩旇矾寰�");
+        }
+        
         startMonitor();
         return true;
     }
@@ -194,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;
         }
 
@@ -245,6 +259,12 @@
         if (helper != null) {
             helper.exitDrawingControlMode();
         }
+        
+        // 鎭㈠鍓茶崏鏈哄浘鏍�
+        if (isHandheldMode && shouye != null) {
+            shouye.setHandheldMowerIconActive(false);
+        }
+        isHandheldMode = false;
     }
     
     /**
@@ -407,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);
+    }
 }
-

--
Gitblit v1.10.0