From 9ab155df113e9b42f6ec29e7c4c379780324d37d Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Fri, 4 Aug 2023 20:11:44 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E7=AE=A1=E7=90=86=E5=A4=A7=E5=B1=8F-?= =?UTF-8?q?=E4=BB=8E=E5=BB=BA=E8=AE=BE=E5=88=87=E5=88=B0=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=A4=A7=E5=B1=8F=E5=B1=95=E7=A4=BA=E5=BB=BA=E8=AE=BE=E7=82=B9?= =?UTF-8?q?=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../quanju/containers/public/olMap.js | 47 ++++++++++--------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/web/client/src/sections/quanju/containers/public/olMap.js b/web/client/src/sections/quanju/containers/public/olMap.js index 002d5dfa..4d50a3be 100644 --- a/web/client/src/sections/quanju/containers/public/olMap.js +++ b/web/client/src/sections/quanju/containers/public/olMap.js @@ -434,34 +434,35 @@ const OlMap = (props) => { useEffect(() => { if (busLine && olMap && tab == 'operation') { - olMap.addGeometryLayer({ - features: [ - { - name: 'busLine', - attributes: { - }, - geometry: busLine.map(b => { - return [b.pointLng, b.pointLat] - }), - // geometry: [115.944220000000, 28.545380000000], - geometryType: 'LineString', - style: { stroke: { width: 5, color: '#9933FF' } }, - selectStyle: { stroke: { width: 8, color: '#9933FF' } }, - }, - ], - style: { stroke: { width: 5, color: '#9933FF' } }, - selectStyle: { stroke: { width: 8, color: '#9933FF' } }, - layerName: 'geometry_bus_line' - }); if (busLine.length) { olMap.closeOverlay('clickOpen') + busRunData.forEach((d, index) => { + olMap.removeGeometryLayer('geometry_bus_' + index) + }) + olMap.addGeometryLayer({ + features: [ + { + name: 'busLine', + attributes: { + }, + geometry: busLine.map(b => { + return [b.pointLng, b.pointLat] + }), + // geometry: [115.944220000000, 28.545380000000], + geometryType: 'LineString', + style: { stroke: { width: 5, color: '#9933FF' } }, + selectStyle: { stroke: { width: 8, color: '#9933FF' } }, + }, + ], + style: { stroke: { width: 5, color: '#9933FF' } }, + selectStyle: { stroke: { width: 8, color: '#9933FF' } }, + layerName: 'geometry_bus_line' + }); olMap.setCenter([ (busLine[0].pointLng + busLine[busLine.length - 1].pointLng) / 2, (busLine[0].pointLat + busLine[busLine.length - 1].pointLat) / 2 ]) - busRunData.forEach((d, index) => { - olMap.removeGeometryLayer('geometry_bus_' + index) - }) + } else { drawBusRunPoint() } @@ -505,7 +506,7 @@ const OlMap = (props) => { // geometryType: 'Point', attributes: { callbackParams: {}, - callback: (p, x) => { + callback: (p, x) => { let extent = p?.selected[0]?.values_?.geometry?.flatCoordinates let coordinate = [] if (extent && extent.length) {