From 57a9f37d0da2a95bcdbe8d35dc95ba9108a91b74 Mon Sep 17 00:00:00 2001 From: mmc <1556375442@qq.com> Date: Wed, 11 Mar 2026 14:48:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=E4=BC=A0=E5=80=BC=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../widgets/map/testmap_pages.dart | 46 +++++++++---------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/lib/features/home/presentation/widgets/map/testmap_pages.dart b/lib/features/home/presentation/widgets/map/testmap_pages.dart index 5510f4da..c467a2df 100644 --- a/lib/features/home/presentation/widgets/map/testmap_pages.dart +++ b/lib/features/home/presentation/widgets/map/testmap_pages.dart @@ -502,30 +502,29 @@ class _MapPageEnterpriseState extends State { //'img': imgBase64 ?? '', // 截图的 Base64 字符串 'name': plotName, // 地块名称 'path': _currentWorkMode == WorkMode.custom - ? jsonEncode([]) // 自定义模式 path 为空数组 - : jsonEncode( - typedPathList - .map( - (point) => { - // 路径点数组 - 'lon': point.longitude, - 'lat': point.latitude, - }, - ) - .toList(), - ), - 'outer': jsonEncode( - // 核心修改:根据机器人模式选择不同的坐标源 - (_currentRobotMode == RobotMode.robot ? _robotModeWgsPoints : gcjOuterPoints).map((point) { - // Robot模式:_robotModeWgsPoints本身就是WGS84坐标,无需转换 - // Point模式:gcjOuterPoints是GCJ02坐标,需要转换为WGS84 - final wgs84 = _currentRobotMode == RobotMode.robot - ? point // Robot模式直接使用原始WGS84坐标 - : gcj02ToWgs84(point.latitude, point.longitude); // Point模式转换 + ? [] // 自定义模式 path 为空数组 + : typedPathList + .map( + (point) => { + // 路径点数组 + 'lon': point.longitude, + 'lat': point.latitude, + }, + ) + .toList(), + + 'outer': + // 核心修改:根据机器人模式选择不同的坐标源 + (_currentRobotMode == RobotMode.robot ? _robotModeWgsPoints : gcjOuterPoints).map((point) { + // Robot模式:_robotModeWgsPoints本身就是WGS84坐标,无需转换 + // Point模式:gcjOuterPoints是GCJ02坐标,需要转换为WGS84 + final wgs84 = _currentRobotMode == RobotMode.robot + ? point // Robot模式直接使用原始WGS84坐标 + : gcj02ToWgs84(point.latitude, point.longitude); // Point模式转换 + + return {'lng': wgs84.longitude, 'lat': wgs84.latitude}; + }).toList(), - return {'lng': wgs84.longitude, 'lat': wgs84.latitude}; - }).toList(), - ), 'planModel': _currentWorkMode == WorkMode.bow ? 0 : 2, // 作业模式值 }; @@ -1811,7 +1810,6 @@ class _MapPageEnterpriseState extends State { LatLng firstPointGcj = _markedPoints.first; firstPointWgs = gcj02ToWgs84(firstPointGcj.latitude, firstPointGcj.longitude); } else { - debugPrint('⚠️ 参考点坐标为空,无法生成路径'); if (showTips) { ToastUtils.showError(context, '参考点坐标为空,请先添加作业区域打点!'); }