diff --git a/src/views/longoPeration/Patrolmanagement/pop-upbox.vue b/src/views/longoPeration/Patrolmanagement/pop-upbox.vue index 02868d3..12edbe9 100644 --- a/src/views/longoPeration/Patrolmanagement/pop-upbox.vue +++ b/src/views/longoPeration/Patrolmanagement/pop-upbox.vue @@ -153,11 +153,11 @@ }; //添加轨迹线 const addRecordLine = (geojson, layerId) => { - newfiberMapbox.map.addSource(layerId, { + newfiberMap_risk.map.addSource(layerId, { type: 'geojson', data: geojson, }); - newfiberMapbox.map.addLayer({ + newfiberMap_risk.map.addLayer({ id: layerId, type: 'line', source: layerId, @@ -169,15 +169,15 @@ }; //添加轨迹起止点 const addStartAndEnd = (geojson, layerId, Icon) => { - newfiberMapbox.map.loadImage(Icon, (error, image) => { + newfiberMap_risk.map.loadImage(Icon, (error, image) => { if (error) throw error; - newfiberMapbox.map.addImage(layerId + '_icon', image); + newfiberMap_risk.map.addImage(layerId + '_icon', image); }); - newfiberMapbox.map.addSource(layerId, { + newfiberMap_risk.map.addSource(layerId, { type: 'geojson', data: geojson, }); - newfiberMapbox.map.addLayer({ + newfiberMap_risk.map.addLayer({ id: layerId, type: 'symbol', source: layerId, @@ -203,9 +203,9 @@ () => props.pathGeometry, val => { if (val) { - if (newfiberMapbox.map.getLayer('recordLineGeojson')) { - newfiberMapbox.map.removeLayer('recordLineGeojson'); - newfiberMapbox.map.removeSource('recordLineGeojson'); + if (newfiberMap_risk.map.getLayer('recordLineGeojson')) { + newfiberMap_risk.map.removeLayer('recordLineGeojson'); + newfiberMap_risk.map.removeSource('recordLineGeojson'); } if (val === '') return; @@ -234,13 +234,13 @@ if (val) { console.log('val-----', val); setTimeout(() => { - if (newfiberMapbox.map.getLayer('point_start')) { - newfiberMapbox.map.removeLayer('point_start'); - newfiberMapbox.map.removeLayer('point_end'); - newfiberMapbox.map.removeSource('point_start'); - newfiberMapbox.map.removeSource('point_end'); - newfiberMapbox.map.removeImage('point_start_icon'); - newfiberMapbox.map.removeImage('point_end_icon'); + if (newfiberMap_risk.map.getLayer('point_start')) { + newfiberMap_risk.map.removeLayer('point_start'); + newfiberMap_risk.map.removeLayer('point_end'); + newfiberMap_risk.map.removeSource('point_start'); + newfiberMap_risk.map.removeSource('point_end'); + newfiberMap_risk.map.removeImage('point_start_icon'); + newfiberMap_risk.map.removeImage('point_end_icon'); } }, 1000); @@ -260,8 +260,8 @@ setTimeout(() => { addStartAndEnd(startPointGeojson, 'point_start', point_start); addStartAndEnd(endPointGeojson, 'point_end', point_end); - newfiberMapbox.map.setPitch(0); - newfiberMapbox.map.easeTo({ + newfiberMap_risk.map.setPitch(0); + newfiberMap_risk.map.easeTo({ center: start_84, zoom: 15, });