路径生成优化

This commit is contained in:
mmc
2026-02-28 17:20:38 +08:00
parent bcaebade9a
commit 9ba03b9917

View File

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