|
@ -434,34 +434,35 @@ const OlMap = (props) => { |
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
useEffect(() => { |
|
|
if (busLine && olMap && tab == 'operation') { |
|
|
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) { |
|
|
if (busLine.length) { |
|
|
olMap.closeOverlay('clickOpen') |
|
|
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([ |
|
|
olMap.setCenter([ |
|
|
(busLine[0].pointLng + busLine[busLine.length - 1].pointLng) / 2, |
|
|
(busLine[0].pointLng + busLine[busLine.length - 1].pointLng) / 2, |
|
|
(busLine[0].pointLat + busLine[busLine.length - 1].pointLat) / 2 |
|
|
(busLine[0].pointLat + busLine[busLine.length - 1].pointLat) / 2 |
|
|
]) |
|
|
]) |
|
|
busRunData.forEach((d, index) => { |
|
|
|
|
|
olMap.removeGeometryLayer('geometry_bus_' + index) |
|
|
|
|
|
}) |
|
|
|
|
|
} else { |
|
|
} else { |
|
|
drawBusRunPoint() |
|
|
drawBusRunPoint() |
|
|
} |
|
|
} |
|
|