修复 保存传值问题
This commit is contained in:
@@ -502,30 +502,29 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
|
|||||||
//'img': imgBase64 ?? '', // 截图的 Base64 字符串
|
//'img': imgBase64 ?? '', // 截图的 Base64 字符串
|
||||||
'name': plotName, // 地块名称
|
'name': plotName, // 地块名称
|
||||||
'path': _currentWorkMode == WorkMode.custom
|
'path': _currentWorkMode == WorkMode.custom
|
||||||
? jsonEncode([]) // 自定义模式 path 为空数组
|
? [] // 自定义模式 path 为空数组
|
||||||
: jsonEncode(
|
: typedPathList
|
||||||
typedPathList
|
.map(
|
||||||
.map(
|
(point) => {
|
||||||
(point) => {
|
// 路径点数组
|
||||||
// 路径点数组
|
'lon': point.longitude,
|
||||||
'lon': point.longitude,
|
'lat': point.latitude,
|
||||||
'lat': point.latitude,
|
},
|
||||||
},
|
)
|
||||||
)
|
.toList(),
|
||||||
.toList(),
|
|
||||||
),
|
'outer':
|
||||||
'outer': jsonEncode(
|
// 核心修改:根据机器人模式选择不同的坐标源
|
||||||
// 核心修改:根据机器人模式选择不同的坐标源
|
(_currentRobotMode == RobotMode.robot ? _robotModeWgsPoints : gcjOuterPoints).map((point) {
|
||||||
(_currentRobotMode == RobotMode.robot ? _robotModeWgsPoints : gcjOuterPoints).map((point) {
|
// Robot模式:_robotModeWgsPoints本身就是WGS84坐标,无需转换
|
||||||
// Robot模式:_robotModeWgsPoints本身就是WGS84坐标,无需转换
|
// Point模式:gcjOuterPoints是GCJ02坐标,需要转换为WGS84
|
||||||
// Point模式:gcjOuterPoints是GCJ02坐标,需要转换为WGS84
|
final wgs84 = _currentRobotMode == RobotMode.robot
|
||||||
final wgs84 = _currentRobotMode == RobotMode.robot
|
? point // Robot模式直接使用原始WGS84坐标
|
||||||
? point // Robot模式直接使用原始WGS84坐标
|
: gcj02ToWgs84(point.latitude, point.longitude); // Point模式转换
|
||||||
: 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, // 作业模式值
|
'planModel': _currentWorkMode == WorkMode.bow ? 0 : 2, // 作业模式值
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1811,7 +1810,6 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
|
|||||||
LatLng firstPointGcj = _markedPoints.first;
|
LatLng firstPointGcj = _markedPoints.first;
|
||||||
firstPointWgs = gcj02ToWgs84(firstPointGcj.latitude, firstPointGcj.longitude);
|
firstPointWgs = gcj02ToWgs84(firstPointGcj.latitude, firstPointGcj.longitude);
|
||||||
} else {
|
} else {
|
||||||
debugPrint('⚠️ 参考点坐标为空,无法生成路径');
|
|
||||||
if (showTips) {
|
if (showTips) {
|
||||||
ToastUtils.showError(context, '参考点坐标为空,请先添加作业区域打点!');
|
ToastUtils.showError(context, '参考点坐标为空,请先添加作业区域打点!');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user