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

View File

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