This commit is contained in:
mmc
2026-03-12 13:51:54 +08:00
parent eeebc83fd5
commit 21e98d4b89

View File

@@ -764,47 +764,54 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
try {
// 2. 重置所有页面状态(恢复初始值)
setState(() {
_traceManager.setMode(TPMode.LOCATION);
// 清空打点和轨迹数据
_traceManager.setMode(TPMode.LOCATION);
// 2. 清空打点和轨迹数据
_markedPoints.clear();
gcjPathPoints.clear();
_robotModeObsWgsPoints.clear();
gcjOuterPoints.clear();
_robotModeWgsPoints.clear();
// 3. 重置作业区域状态
_isWorkAreaCompleted = false;
_saveBoxOpen = false;
_showControlModeWarn = false;
_showHeadingWarn = false;
// 重置面板状态
// 4. 重置面板状态
_isPanelOpen = false;
_directionBoxOpen = false;
_isListBoxOpen = false;
_isWorkPanelOpen = false;
// 5. 重置障碍物数据
_obstacleHoles.clear();
_currentObstaclePoints.clear();
_isObstacleEditing = false;
// 重置选中状态
// 6. 重置选中状态
_selectedPlot = null;
_selectedPlotPath = null;
// 重置作业模式
// 7. 重置作业模式
_currentRobotMode = RobotMode.robot;
_currentAreaMode = AreaMode.work;
_currentWorkMode = WorkMode.bow;
// 重置参数
// 8. 重置作业参数
_workDistance = 0.0;
_angle = 0.0;
// 🔥 修复2:优先恢复地图中心,而非定位坐标
// 9. 重置地图与定位状态(关键修复)
_currentLatLng = null;
_currentWgsLatLng = null;
_mapCenter = _getDefaultValidCenter(); // 仅用兜底坐标初始化地图中心
// 10. 重置作业状态
isDjMapShow = false;
_workStatus = WorkStatus.idle;
isStartWork = false;
});
_clearLocalData();
@@ -1649,6 +1656,7 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
_workStatus = WorkStatus.idle;
_showHeadingWarn = false;
_showControlModeWarn = false;
isStartWork = false;
});
},
icon: const Icon(Icons.close, color: Colors.grey, size: 20),