路径生成优化
This commit is contained in:
@@ -800,8 +800,8 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
|
||||
polylines: [
|
||||
Polyline(
|
||||
points: gcjPathPoints, // 转换后的GCJ02坐标
|
||||
color: Colors.blueAccent, // 折线颜色(可自定义)
|
||||
strokeWidth: 3.0, // 折线宽度
|
||||
color: const Color.fromARGB(255, 223, 228, 116), // 折线颜色(可自定义)
|
||||
strokeWidth: 1.0, // 折线宽度
|
||||
isDotted: false, // 非虚线(Line模式)
|
||||
borderColor: Colors.white, // 可选:添加白色描边,提升辨识度
|
||||
borderStrokeWidth: 0.5,
|
||||
@@ -817,7 +817,7 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
|
||||
points: gcjOuterPoints, // 转换后的GCJ02坐标
|
||||
color: Colors.green.withOpacity(0.1), // 内部填充色(透明)
|
||||
borderColor: Colors.green, // 边框颜色
|
||||
borderStrokeWidth: 2.0, // 边框宽度
|
||||
borderStrokeWidth: 1.0, // 边框宽度
|
||||
isFilled: true, // 开启填充(即使透明,也需要开启才能显示边框)
|
||||
),
|
||||
],
|
||||
@@ -1102,7 +1102,7 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
|
||||
debugPrint('生成的路径数据:${cubitState.generatedPath}');
|
||||
|
||||
// 可选:将生成的路径转换为地图可显示的坐标(WGS84 → GCJ02)
|
||||
if (cubitState.generatedPath is List) {
|
||||
if (cubitState.generatedPath is List) {
|
||||
setState(() {
|
||||
// 先将 List<dynamic> 转换为 List<DeviceAddPathPointModel>
|
||||
final pathList = cubitState.generatedPath as List;
|
||||
@@ -1116,7 +1116,8 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
|
||||
return LatLng(gcjPoint.latitude, gcjPoint.longitude);
|
||||
}).toList();
|
||||
|
||||
gcjOuterPoints = _markedPoints;
|
||||
gcjOuterPoints = List.from(_markedPoints); // 生成新列表,复制所有元素 // ========== 核心修改:清空临时打点列表 ==========
|
||||
_markedPoints.clear(); // 清空后,临时划线会自动消失
|
||||
});
|
||||
moveMapToPointsCenter(gcjPathPoints);
|
||||
}
|
||||
@@ -1130,7 +1131,10 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
|
||||
}
|
||||
|
||||
// 5. 关闭操作面板
|
||||
setState(() => _isPanelOpen = false);
|
||||
setState(() {
|
||||
_isPanelOpen = false; // 关闭操作面板
|
||||
_currentWorkMode = null; // 清空作业模式,清除弓字模式的绿色半透明区域
|
||||
});
|
||||
},
|
||||
onUndoTap: _undoLastPoint,
|
||||
onDeleteTap: _deleteAllPoints,
|
||||
|
||||
Reference in New Issue
Block a user