十字准星 模式 作业区域模式 一系列完成

This commit is contained in:
mmc
2026-03-02 11:20:34 +08:00
parent 0e1c027ab5
commit 991c4fe174
2 changed files with 30 additions and 91 deletions

View File

@@ -339,16 +339,12 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
)
.toList(),
),
'outer': jsonEncode(
_markedPoints
.map(
(point) => {
// 外边界点数组
'lng': point.longitude,
'lat': point.latitude,
},
)
.toList(),
gcjOuterPoints.map((point) {
final wgs84 = gcj02ToWgs84(point.latitude, point.longitude);
return {'lng': wgs84.longitude, 'lat': wgs84.latitude};
}).toList(),
),
'planModel': _currentWorkMode == WorkMode.bow ? 0 : 2, // 作业模式值
};
@@ -429,6 +425,9 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
setState(() {
_markedPoints.clear(); // 清空打点
gcjPathPoints.clear(); // 清空路径
gcjOuterPoints.clear(); // 清空外边界
_isPanelOpen = false; // 关闭操作面板
});
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('地块「$plotName」保存成功!'), backgroundColor: Colors.green));
@@ -825,6 +824,7 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
_selectedPlot = plot;
_isListBoxOpen = false;
_isWorkPanelOpen = true;
_isPanelOpen = false; // 关闭操作面板,专注作业界面
});
// 移动地图到中心
List<LatLng> allPoints = [];
@@ -843,6 +843,7 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
_selectedPlot = plot;
_isListBoxOpen = false;
_isWorkPanelOpen = true;
_isPanelOpen = false; // 关闭操作面板,专注作业界面
});
}
} else {
@@ -852,6 +853,7 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
_selectedPlot = plot;
_isListBoxOpen = false;
_isWorkPanelOpen = true;
_isPanelOpen = false; // 关闭操作面板,专注作业界面
});
}
} else {
@@ -1317,6 +1319,7 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
}).toList();
gcjOuterPoints = List.from(_markedPoints);
_markedPoints.clear();
});
moveMapToPointsCenter(gcjPathPoints);
}

View File

@@ -80,10 +80,7 @@ class _BottomOperationPanelState extends State<BottomOperationPanel> {
_buildTabContent(),
// 底部标签页切换(修复背景色切换+状态更新)
Container(
decoration: BoxDecoration(
color: Colors.grey[200],
borderRadius: BorderRadius.circular(8),
),
decoration: BoxDecoration(color: Colors.grey[200], borderRadius: BorderRadius.circular(8)),
child: Row(
children: [
Expanded(
@@ -98,20 +95,9 @@ class _BottomOperationPanelState extends State<BottomOperationPanel> {
child: Container(
padding: const EdgeInsets.symmetric(vertical: 10),
// 选中地块时背景为白色,否则透明
decoration: BoxDecoration(
color: _currentTab == '地块'
? Colors.white
: Colors.transparent,
borderRadius: BorderRadius.circular(8),
),
decoration: BoxDecoration(color: _currentTab == '地块' ? Colors.white : Colors.transparent, borderRadius: BorderRadius.circular(8)),
child: const Center(
child: Text(
'地块',
style: TextStyle(
color: Colors.black87,
fontSize: 16,
),
),
child: Text('地块', style: TextStyle(color: Colors.black87, fontSize: 16)),
),
),
),
@@ -128,20 +114,9 @@ class _BottomOperationPanelState extends State<BottomOperationPanel> {
child: Container(
padding: const EdgeInsets.symmetric(vertical: 10),
// 选中航线时背景为白色,否则透明
decoration: BoxDecoration(
color: _currentTab == '航线'
? Colors.white
: Colors.transparent,
borderRadius: BorderRadius.circular(8),
),
decoration: BoxDecoration(color: _currentTab == '航线' ? Colors.white : Colors.transparent, borderRadius: BorderRadius.circular(8)),
child: const Center(
child: Text(
'航线',
style: TextStyle(
color: Colors.black87,
fontSize: 16,
),
),
child: Text('航线', style: TextStyle(color: Colors.black87, fontSize: 16)),
),
),
),
@@ -168,7 +143,7 @@ class _BottomOperationPanelState extends State<BottomOperationPanel> {
DropdownButton<RobotMode>(
value: _robotMode,
items: const [
DropdownMenuItem(value: RobotMode.point, child: Text("地图打点")),
DropdownMenuItem(value: RobotMode.point, child: Text("十字准星")),
DropdownMenuItem(value: RobotMode.robot, child: Text("机器人模式")),
],
onChanged: (v) {
@@ -187,10 +162,7 @@ class _BottomOperationPanelState extends State<BottomOperationPanel> {
child: Container(
width: 40,
height: 40,
decoration: const BoxDecoration(
color: Color(0xFF00C853),
shape: BoxShape.circle,
),
decoration: const BoxDecoration(color: Color(0xFF00C853), shape: BoxShape.circle),
child: const Icon(Icons.add, color: Colors.white, size: 32),
),
),
@@ -246,10 +218,7 @@ class _BottomOperationPanelState extends State<BottomOperationPanel> {
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Text(
'作业行距(米)',
style: TextStyle(fontSize: 16, color: Colors.black87),
),
const Text('作业行距(米)', style: TextStyle(fontSize: 16, color: Colors.black87)),
Row(
children: [
// 减号按钮
@@ -265,23 +234,13 @@ class _BottomOperationPanelState extends State<BottomOperationPanel> {
child: Container(
width: 30,
height: 30,
decoration: BoxDecoration(
color: Colors.grey[200],
shape: BoxShape.circle,
),
child: const Icon(
Icons.remove,
size: 16,
color: Colors.black87,
),
decoration: BoxDecoration(color: Colors.grey[200], shape: BoxShape.circle),
child: const Icon(Icons.remove, size: 16, color: Colors.black87),
),
),
const SizedBox(width: 10),
// 行距数值
Text(
'${_operationDistance.toStringAsFixed(1)}',
style: const TextStyle(fontSize: 16, color: Colors.black87),
),
Text('${_operationDistance.toStringAsFixed(1)}', style: const TextStyle(fontSize: 16, color: Colors.black87)),
const SizedBox(width: 10),
// 加号按钮
GestureDetector(
@@ -294,15 +253,8 @@ class _BottomOperationPanelState extends State<BottomOperationPanel> {
child: Container(
width: 30,
height: 30,
decoration: BoxDecoration(
color: Colors.grey[200],
shape: BoxShape.circle,
),
child: const Icon(
Icons.add,
size: 16,
color: Colors.black87,
),
decoration: BoxDecoration(color: Colors.grey[200], shape: BoxShape.circle),
child: const Icon(Icons.add, size: 16, color: Colors.black87),
),
),
],
@@ -314,10 +266,7 @@ class _BottomOperationPanelState extends State<BottomOperationPanel> {
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Text(
'航线方向',
style: TextStyle(fontSize: 16, color: Colors.black87),
),
const Text('航线方向', style: TextStyle(fontSize: 16, color: Colors.black87)),
// 设置按钮
ElevatedButton(
onPressed: () {
@@ -328,9 +277,7 @@ class _BottomOperationPanelState extends State<BottomOperationPanel> {
style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFF00C853),
foregroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(6),
),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(6)),
),
child: const Text('设置'),
),
@@ -342,12 +289,7 @@ class _BottomOperationPanelState extends State<BottomOperationPanel> {
}
// 构建操作按钮
Widget _buildActionButton(
IconData icon,
String label,
bool isEnabled,
VoidCallback onTap,
) {
Widget _buildActionButton(IconData icon, String label, bool isEnabled, VoidCallback onTap) {
return GestureDetector(
onTap: isEnabled ? onTap : null,
child: Column(
@@ -355,17 +297,11 @@ class _BottomOperationPanelState extends State<BottomOperationPanel> {
Container(
width: 40,
height: 40,
decoration: BoxDecoration(
color: isEnabled ? Colors.blue : Colors.grey[300],
shape: BoxShape.circle,
),
decoration: BoxDecoration(color: isEnabled ? Colors.blue : Colors.grey[300], shape: BoxShape.circle),
child: Icon(icon, color: Colors.white),
),
const SizedBox(height: 6),
Text(
label,
style: TextStyle(color: isEnabled ? Colors.black : Colors.grey),
),
Text(label, style: TextStyle(color: isEnabled ? Colors.black : Colors.grey)),
],
),
);