diff --git a/src/assets/track1.json b/src/assets/track1.json new file mode 100644 index 0000000..b56ade9 --- /dev/null +++ b/src/assets/track1.json @@ -0,0 +1,165 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "id": 0, + "geometry": { + "type": "LineString", + "coordinates": [ + [ + 109.51952626140188, + 36.611401777023502 + ], + [ + 109.52247679304911, + 36.613724130965196 + ], + [ + 109.52502757524736, + 36.616198770411259 + ], + [ + 109.52236257892083, + 36.619149302058489 + ], + [ + 109.52420904066136, + 36.620329514717383 + ], + [ + 109.52367604139604, + 36.62095769242292 + ], + [ + 109.52285750681004, + 36.62120515636753 + ], + [ + 109.52207704360013, + 36.621319370495804 + ], + [ + 109.52150597295874, + 36.621681048568696 + ], + [ + 109.51924072608118, + 36.623641724437498 + ], + [ + 109.51878386956805, + 36.624174723702808 + ], + [ + 109.51762269259721, + 36.624869526316509 + ], + [ + 109.51549069553599, + 36.625821310718848 + ], + [ + 109.51354905535523, + 36.627277540854422 + ], + [ + 109.51237360161834, + 36.62779150443167 + ], + [ + 109.51201192354546, + 36.62808655759639 + ], + [ + 109.51207854845362, + 36.628648110393769 + ], + [ + 109.51258299418686, + 36.628971717090565 + ], + [ + 109.51305888638802, + 36.628952681402517 + ], + [ + 109.51398211725828, + 36.628276914476857 + ], + [ + 109.51593327528307, + 36.626611291772775 + ], + [ + 109.51633302473205, + 36.626430452736336 + ], + [ + 109.51703734518978, + 36.626335274296096 + ], + [ + 109.51767504073935, + 36.626554184708638 + ], + [ + 109.51804623665626, + 36.626877791405434 + ], + [ + 109.51819852216063, + 36.627115737506017 + ], + [ + 109.51856020023352, + 36.627325130074532 + ], + [ + 109.5188838069303, + 36.627525004799018 + ], + [ + 109.5189599496825, + 36.627762950899601 + ], + [ + 109.51891236046238, + 36.628000897000184 + ], + [ + 109.51860778945364, + 36.628096075440418 + ], + [ + 109.51833177197696, + 36.628210289568699 + ], + [ + 109.5178178083997, + 36.628828949430215 + ], + [ + 109.51630447119999, + 36.630618304106605 + ], + [ + 109.51520991913731, + 36.6317985167655 + ], + [ + 109.5144770451475, + 36.632407658782995 + ], + [ + 109.5143057239551, + 36.632507596145231 + ] + ] + }, + "properties": { + "color": "rgba(82, 214, 108,1)" + } + } + ] +} \ No newline at end of file diff --git a/src/assets/track1.json b/src/assets/track1.json new file mode 100644 index 0000000..b56ade9 --- /dev/null +++ b/src/assets/track1.json @@ -0,0 +1,165 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "id": 0, + "geometry": { + "type": "LineString", + "coordinates": [ + [ + 109.51952626140188, + 36.611401777023502 + ], + [ + 109.52247679304911, + 36.613724130965196 + ], + [ + 109.52502757524736, + 36.616198770411259 + ], + [ + 109.52236257892083, + 36.619149302058489 + ], + [ + 109.52420904066136, + 36.620329514717383 + ], + [ + 109.52367604139604, + 36.62095769242292 + ], + [ + 109.52285750681004, + 36.62120515636753 + ], + [ + 109.52207704360013, + 36.621319370495804 + ], + [ + 109.52150597295874, + 36.621681048568696 + ], + [ + 109.51924072608118, + 36.623641724437498 + ], + [ + 109.51878386956805, + 36.624174723702808 + ], + [ + 109.51762269259721, + 36.624869526316509 + ], + [ + 109.51549069553599, + 36.625821310718848 + ], + [ + 109.51354905535523, + 36.627277540854422 + ], + [ + 109.51237360161834, + 36.62779150443167 + ], + [ + 109.51201192354546, + 36.62808655759639 + ], + [ + 109.51207854845362, + 36.628648110393769 + ], + [ + 109.51258299418686, + 36.628971717090565 + ], + [ + 109.51305888638802, + 36.628952681402517 + ], + [ + 109.51398211725828, + 36.628276914476857 + ], + [ + 109.51593327528307, + 36.626611291772775 + ], + [ + 109.51633302473205, + 36.626430452736336 + ], + [ + 109.51703734518978, + 36.626335274296096 + ], + [ + 109.51767504073935, + 36.626554184708638 + ], + [ + 109.51804623665626, + 36.626877791405434 + ], + [ + 109.51819852216063, + 36.627115737506017 + ], + [ + 109.51856020023352, + 36.627325130074532 + ], + [ + 109.5188838069303, + 36.627525004799018 + ], + [ + 109.5189599496825, + 36.627762950899601 + ], + [ + 109.51891236046238, + 36.628000897000184 + ], + [ + 109.51860778945364, + 36.628096075440418 + ], + [ + 109.51833177197696, + 36.628210289568699 + ], + [ + 109.5178178083997, + 36.628828949430215 + ], + [ + 109.51630447119999, + 36.630618304106605 + ], + [ + 109.51520991913731, + 36.6317985167655 + ], + [ + 109.5144770451475, + 36.632407658782995 + ], + [ + 109.5143057239551, + 36.632507596145231 + ] + ] + }, + "properties": { + "color": "rgba(82, 214, 108,1)" + } + } + ] +} \ No newline at end of file diff --git a/src/utils/GISdocument/mapboxVectorLayer.js b/src/utils/GISdocument/mapboxVectorLayer.js index 6aca56f..ca28221 100644 --- a/src/utils/GISdocument/mapboxVectorLayer.js +++ b/src/utils/GISdocument/mapboxVectorLayer.js @@ -388,6 +388,9 @@ newfiberMapbox.map.removeLayer(layerName); newfiberMapbox.map.removeSource(layerName); } + if (newfiberMapbox.map.hasImage(layerName)) { + newfiberMapbox.map.removeImage(layerName); + } }); } } diff --git a/src/assets/track1.json b/src/assets/track1.json new file mode 100644 index 0000000..b56ade9 --- /dev/null +++ b/src/assets/track1.json @@ -0,0 +1,165 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "id": 0, + "geometry": { + "type": "LineString", + "coordinates": [ + [ + 109.51952626140188, + 36.611401777023502 + ], + [ + 109.52247679304911, + 36.613724130965196 + ], + [ + 109.52502757524736, + 36.616198770411259 + ], + [ + 109.52236257892083, + 36.619149302058489 + ], + [ + 109.52420904066136, + 36.620329514717383 + ], + [ + 109.52367604139604, + 36.62095769242292 + ], + [ + 109.52285750681004, + 36.62120515636753 + ], + [ + 109.52207704360013, + 36.621319370495804 + ], + [ + 109.52150597295874, + 36.621681048568696 + ], + [ + 109.51924072608118, + 36.623641724437498 + ], + [ + 109.51878386956805, + 36.624174723702808 + ], + [ + 109.51762269259721, + 36.624869526316509 + ], + [ + 109.51549069553599, + 36.625821310718848 + ], + [ + 109.51354905535523, + 36.627277540854422 + ], + [ + 109.51237360161834, + 36.62779150443167 + ], + [ + 109.51201192354546, + 36.62808655759639 + ], + [ + 109.51207854845362, + 36.628648110393769 + ], + [ + 109.51258299418686, + 36.628971717090565 + ], + [ + 109.51305888638802, + 36.628952681402517 + ], + [ + 109.51398211725828, + 36.628276914476857 + ], + [ + 109.51593327528307, + 36.626611291772775 + ], + [ + 109.51633302473205, + 36.626430452736336 + ], + [ + 109.51703734518978, + 36.626335274296096 + ], + [ + 109.51767504073935, + 36.626554184708638 + ], + [ + 109.51804623665626, + 36.626877791405434 + ], + [ + 109.51819852216063, + 36.627115737506017 + ], + [ + 109.51856020023352, + 36.627325130074532 + ], + [ + 109.5188838069303, + 36.627525004799018 + ], + [ + 109.5189599496825, + 36.627762950899601 + ], + [ + 109.51891236046238, + 36.628000897000184 + ], + [ + 109.51860778945364, + 36.628096075440418 + ], + [ + 109.51833177197696, + 36.628210289568699 + ], + [ + 109.5178178083997, + 36.628828949430215 + ], + [ + 109.51630447119999, + 36.630618304106605 + ], + [ + 109.51520991913731, + 36.6317985167655 + ], + [ + 109.5144770451475, + 36.632407658782995 + ], + [ + 109.5143057239551, + 36.632507596145231 + ] + ] + }, + "properties": { + "color": "rgba(82, 214, 108,1)" + } + } + ] +} \ No newline at end of file diff --git a/src/utils/GISdocument/mapboxVectorLayer.js b/src/utils/GISdocument/mapboxVectorLayer.js index 6aca56f..ca28221 100644 --- a/src/utils/GISdocument/mapboxVectorLayer.js +++ b/src/utils/GISdocument/mapboxVectorLayer.js @@ -388,6 +388,9 @@ newfiberMapbox.map.removeLayer(layerName); newfiberMapbox.map.removeSource(layerName); } + if (newfiberMapbox.map.hasImage(layerName)) { + newfiberMapbox.map.removeImage(layerName); + } }); } } diff --git a/src/views/oneMap/FloodStuationReview/sqhgBottomBox.vue b/src/views/oneMap/FloodStuationReview/sqhgBottomBox.vue index 6a66c14..800d5ed 100644 --- a/src/views/oneMap/FloodStuationReview/sqhgBottomBox.vue +++ b/src/views/oneMap/FloodStuationReview/sqhgBottomBox.vue @@ -116,7 +116,6 @@ ]; const ranLeng = [ [ - { value: '0-0.2', color: 'rgba(7, 213, 118, 0)' }, { value: '0.2-5', color: 'rgb(38, 129, 240,1)' }, { value: '5-16', color: 'rgba(222,230,0,1)' }, @@ -215,7 +214,6 @@ runDayInterval.value = setTimeout(() => { stepNum.value++; if (stepNum.value <= 24) { - setRainImage(stepNum.value - 1); // NewFiberMapUtils.disposeRainfall(hoursList.value.rainTrend[Number(stepNum.value)-1]) stepLin.value = `${stepNum.value * 4.1666}%`; @@ -391,7 +389,7 @@ let canvas = []; let plot = null; const initRainImage = async imagesList => { - console.log('imagesList',imagesList); + console.log('imagesList', imagesList); imageFiles = await Promise.all(imagesList.map(url => urlToFile(url, _.last(_.split(url, '/'))))); canvas = createCanvas(0); @@ -406,7 +404,6 @@ }; const setRainImage = index => { - var reader = new FileReader(); reader.onload = e => createPlot(e, canvas); reader.readAsArrayBuffer(imageFiles[index]); diff --git a/src/assets/track1.json b/src/assets/track1.json new file mode 100644 index 0000000..b56ade9 --- /dev/null +++ b/src/assets/track1.json @@ -0,0 +1,165 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "id": 0, + "geometry": { + "type": "LineString", + "coordinates": [ + [ + 109.51952626140188, + 36.611401777023502 + ], + [ + 109.52247679304911, + 36.613724130965196 + ], + [ + 109.52502757524736, + 36.616198770411259 + ], + [ + 109.52236257892083, + 36.619149302058489 + ], + [ + 109.52420904066136, + 36.620329514717383 + ], + [ + 109.52367604139604, + 36.62095769242292 + ], + [ + 109.52285750681004, + 36.62120515636753 + ], + [ + 109.52207704360013, + 36.621319370495804 + ], + [ + 109.52150597295874, + 36.621681048568696 + ], + [ + 109.51924072608118, + 36.623641724437498 + ], + [ + 109.51878386956805, + 36.624174723702808 + ], + [ + 109.51762269259721, + 36.624869526316509 + ], + [ + 109.51549069553599, + 36.625821310718848 + ], + [ + 109.51354905535523, + 36.627277540854422 + ], + [ + 109.51237360161834, + 36.62779150443167 + ], + [ + 109.51201192354546, + 36.62808655759639 + ], + [ + 109.51207854845362, + 36.628648110393769 + ], + [ + 109.51258299418686, + 36.628971717090565 + ], + [ + 109.51305888638802, + 36.628952681402517 + ], + [ + 109.51398211725828, + 36.628276914476857 + ], + [ + 109.51593327528307, + 36.626611291772775 + ], + [ + 109.51633302473205, + 36.626430452736336 + ], + [ + 109.51703734518978, + 36.626335274296096 + ], + [ + 109.51767504073935, + 36.626554184708638 + ], + [ + 109.51804623665626, + 36.626877791405434 + ], + [ + 109.51819852216063, + 36.627115737506017 + ], + [ + 109.51856020023352, + 36.627325130074532 + ], + [ + 109.5188838069303, + 36.627525004799018 + ], + [ + 109.5189599496825, + 36.627762950899601 + ], + [ + 109.51891236046238, + 36.628000897000184 + ], + [ + 109.51860778945364, + 36.628096075440418 + ], + [ + 109.51833177197696, + 36.628210289568699 + ], + [ + 109.5178178083997, + 36.628828949430215 + ], + [ + 109.51630447119999, + 36.630618304106605 + ], + [ + 109.51520991913731, + 36.6317985167655 + ], + [ + 109.5144770451475, + 36.632407658782995 + ], + [ + 109.5143057239551, + 36.632507596145231 + ] + ] + }, + "properties": { + "color": "rgba(82, 214, 108,1)" + } + } + ] +} \ No newline at end of file diff --git a/src/utils/GISdocument/mapboxVectorLayer.js b/src/utils/GISdocument/mapboxVectorLayer.js index 6aca56f..ca28221 100644 --- a/src/utils/GISdocument/mapboxVectorLayer.js +++ b/src/utils/GISdocument/mapboxVectorLayer.js @@ -388,6 +388,9 @@ newfiberMapbox.map.removeLayer(layerName); newfiberMapbox.map.removeSource(layerName); } + if (newfiberMapbox.map.hasImage(layerName)) { + newfiberMapbox.map.removeImage(layerName); + } }); } } diff --git a/src/views/oneMap/FloodStuationReview/sqhgBottomBox.vue b/src/views/oneMap/FloodStuationReview/sqhgBottomBox.vue index 6a66c14..800d5ed 100644 --- a/src/views/oneMap/FloodStuationReview/sqhgBottomBox.vue +++ b/src/views/oneMap/FloodStuationReview/sqhgBottomBox.vue @@ -116,7 +116,6 @@ ]; const ranLeng = [ [ - { value: '0-0.2', color: 'rgba(7, 213, 118, 0)' }, { value: '0.2-5', color: 'rgb(38, 129, 240,1)' }, { value: '5-16', color: 'rgba(222,230,0,1)' }, @@ -215,7 +214,6 @@ runDayInterval.value = setTimeout(() => { stepNum.value++; if (stepNum.value <= 24) { - setRainImage(stepNum.value - 1); // NewFiberMapUtils.disposeRainfall(hoursList.value.rainTrend[Number(stepNum.value)-1]) stepLin.value = `${stepNum.value * 4.1666}%`; @@ -391,7 +389,7 @@ let canvas = []; let plot = null; const initRainImage = async imagesList => { - console.log('imagesList',imagesList); + console.log('imagesList', imagesList); imageFiles = await Promise.all(imagesList.map(url => urlToFile(url, _.last(_.split(url, '/'))))); canvas = createCanvas(0); @@ -406,7 +404,6 @@ }; const setRainImage = index => { - var reader = new FileReader(); reader.onload = e => createPlot(e, canvas); reader.readAsArrayBuffer(imageFiles[index]); diff --git a/src/views/oneMap/FloodStuationReview/xqhgLeftBox.vue b/src/views/oneMap/FloodStuationReview/xqhgLeftBox.vue index e5a188e..ae3c851 100644 --- a/src/views/oneMap/FloodStuationReview/xqhgLeftBox.vue +++ b/src/views/oneMap/FloodStuationReview/xqhgLeftBox.vue @@ -100,6 +100,7 @@ import ChartCl from './chartCl.vue'; import ChartXcry from './ChartXcry.vue'; import track from '@/assets/track.json'; +import track1 from '@/assets/track1.json'; import car from '@/assets/newImgs/car.png'; import mapBoxVectorLayer from '@/utils/GISdocument/mapboxVectorLayer.js'; import { ref, reactive, toRefs, onMounted, onBeforeUnmount } from 'vue'; @@ -114,13 +115,25 @@ // 车辆调度 function getCarIndex(num) { console.log('num--', num); - let center = turf.center(track); - console.log('center---', center); - newfiberMapbox.map.easeTo({ - center: [center.geometry.coordinates[0], center.geometry.coordinates[1] - 0.005], - zoom: 13.8, - }); - mapBoxVectorLayer.addDynamicRoute('dynamicRoute', track, car); + if (num == 0) { + clearInterval(window.routeTimer); + mapBoxVectorLayer.removeByIds(['dynamicRoute', 'dynamicRoute_Symbol']); + let center = turf.center(track); + newfiberMapbox.map.easeTo({ + center: [center.geometry.coordinates[0], center.geometry.coordinates[1] - 0.005], + zoom: 13.8, + }); + mapBoxVectorLayer.addDynamicRoute('dynamicRoute', track, car); + } else if (num == 1) { + clearInterval(window.routeTimer); + mapBoxVectorLayer.removeByIds(['dynamicRoute', 'dynamicRoute_Symbol']); + let center = turf.center(track1); + newfiberMapbox.map.easeTo({ + center: [center.geometry.coordinates[0], center.geometry.coordinates[1] - 0.005], + zoom: 13.8, + }); + mapBoxVectorLayer.addDynamicRoute('dynamicRoute', track1, car); + } } // 人员 function getData() { diff --git a/src/assets/track1.json b/src/assets/track1.json new file mode 100644 index 0000000..b56ade9 --- /dev/null +++ b/src/assets/track1.json @@ -0,0 +1,165 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "id": 0, + "geometry": { + "type": "LineString", + "coordinates": [ + [ + 109.51952626140188, + 36.611401777023502 + ], + [ + 109.52247679304911, + 36.613724130965196 + ], + [ + 109.52502757524736, + 36.616198770411259 + ], + [ + 109.52236257892083, + 36.619149302058489 + ], + [ + 109.52420904066136, + 36.620329514717383 + ], + [ + 109.52367604139604, + 36.62095769242292 + ], + [ + 109.52285750681004, + 36.62120515636753 + ], + [ + 109.52207704360013, + 36.621319370495804 + ], + [ + 109.52150597295874, + 36.621681048568696 + ], + [ + 109.51924072608118, + 36.623641724437498 + ], + [ + 109.51878386956805, + 36.624174723702808 + ], + [ + 109.51762269259721, + 36.624869526316509 + ], + [ + 109.51549069553599, + 36.625821310718848 + ], + [ + 109.51354905535523, + 36.627277540854422 + ], + [ + 109.51237360161834, + 36.62779150443167 + ], + [ + 109.51201192354546, + 36.62808655759639 + ], + [ + 109.51207854845362, + 36.628648110393769 + ], + [ + 109.51258299418686, + 36.628971717090565 + ], + [ + 109.51305888638802, + 36.628952681402517 + ], + [ + 109.51398211725828, + 36.628276914476857 + ], + [ + 109.51593327528307, + 36.626611291772775 + ], + [ + 109.51633302473205, + 36.626430452736336 + ], + [ + 109.51703734518978, + 36.626335274296096 + ], + [ + 109.51767504073935, + 36.626554184708638 + ], + [ + 109.51804623665626, + 36.626877791405434 + ], + [ + 109.51819852216063, + 36.627115737506017 + ], + [ + 109.51856020023352, + 36.627325130074532 + ], + [ + 109.5188838069303, + 36.627525004799018 + ], + [ + 109.5189599496825, + 36.627762950899601 + ], + [ + 109.51891236046238, + 36.628000897000184 + ], + [ + 109.51860778945364, + 36.628096075440418 + ], + [ + 109.51833177197696, + 36.628210289568699 + ], + [ + 109.5178178083997, + 36.628828949430215 + ], + [ + 109.51630447119999, + 36.630618304106605 + ], + [ + 109.51520991913731, + 36.6317985167655 + ], + [ + 109.5144770451475, + 36.632407658782995 + ], + [ + 109.5143057239551, + 36.632507596145231 + ] + ] + }, + "properties": { + "color": "rgba(82, 214, 108,1)" + } + } + ] +} \ No newline at end of file diff --git a/src/utils/GISdocument/mapboxVectorLayer.js b/src/utils/GISdocument/mapboxVectorLayer.js index 6aca56f..ca28221 100644 --- a/src/utils/GISdocument/mapboxVectorLayer.js +++ b/src/utils/GISdocument/mapboxVectorLayer.js @@ -388,6 +388,9 @@ newfiberMapbox.map.removeLayer(layerName); newfiberMapbox.map.removeSource(layerName); } + if (newfiberMapbox.map.hasImage(layerName)) { + newfiberMapbox.map.removeImage(layerName); + } }); } } diff --git a/src/views/oneMap/FloodStuationReview/sqhgBottomBox.vue b/src/views/oneMap/FloodStuationReview/sqhgBottomBox.vue index 6a66c14..800d5ed 100644 --- a/src/views/oneMap/FloodStuationReview/sqhgBottomBox.vue +++ b/src/views/oneMap/FloodStuationReview/sqhgBottomBox.vue @@ -116,7 +116,6 @@ ]; const ranLeng = [ [ - { value: '0-0.2', color: 'rgba(7, 213, 118, 0)' }, { value: '0.2-5', color: 'rgb(38, 129, 240,1)' }, { value: '5-16', color: 'rgba(222,230,0,1)' }, @@ -215,7 +214,6 @@ runDayInterval.value = setTimeout(() => { stepNum.value++; if (stepNum.value <= 24) { - setRainImage(stepNum.value - 1); // NewFiberMapUtils.disposeRainfall(hoursList.value.rainTrend[Number(stepNum.value)-1]) stepLin.value = `${stepNum.value * 4.1666}%`; @@ -391,7 +389,7 @@ let canvas = []; let plot = null; const initRainImage = async imagesList => { - console.log('imagesList',imagesList); + console.log('imagesList', imagesList); imageFiles = await Promise.all(imagesList.map(url => urlToFile(url, _.last(_.split(url, '/'))))); canvas = createCanvas(0); @@ -406,7 +404,6 @@ }; const setRainImage = index => { - var reader = new FileReader(); reader.onload = e => createPlot(e, canvas); reader.readAsArrayBuffer(imageFiles[index]); diff --git a/src/views/oneMap/FloodStuationReview/xqhgLeftBox.vue b/src/views/oneMap/FloodStuationReview/xqhgLeftBox.vue index e5a188e..ae3c851 100644 --- a/src/views/oneMap/FloodStuationReview/xqhgLeftBox.vue +++ b/src/views/oneMap/FloodStuationReview/xqhgLeftBox.vue @@ -100,6 +100,7 @@ import ChartCl from './chartCl.vue'; import ChartXcry from './ChartXcry.vue'; import track from '@/assets/track.json'; +import track1 from '@/assets/track1.json'; import car from '@/assets/newImgs/car.png'; import mapBoxVectorLayer from '@/utils/GISdocument/mapboxVectorLayer.js'; import { ref, reactive, toRefs, onMounted, onBeforeUnmount } from 'vue'; @@ -114,13 +115,25 @@ // 车辆调度 function getCarIndex(num) { console.log('num--', num); - let center = turf.center(track); - console.log('center---', center); - newfiberMapbox.map.easeTo({ - center: [center.geometry.coordinates[0], center.geometry.coordinates[1] - 0.005], - zoom: 13.8, - }); - mapBoxVectorLayer.addDynamicRoute('dynamicRoute', track, car); + if (num == 0) { + clearInterval(window.routeTimer); + mapBoxVectorLayer.removeByIds(['dynamicRoute', 'dynamicRoute_Symbol']); + let center = turf.center(track); + newfiberMapbox.map.easeTo({ + center: [center.geometry.coordinates[0], center.geometry.coordinates[1] - 0.005], + zoom: 13.8, + }); + mapBoxVectorLayer.addDynamicRoute('dynamicRoute', track, car); + } else if (num == 1) { + clearInterval(window.routeTimer); + mapBoxVectorLayer.removeByIds(['dynamicRoute', 'dynamicRoute_Symbol']); + let center = turf.center(track1); + newfiberMapbox.map.easeTo({ + center: [center.geometry.coordinates[0], center.geometry.coordinates[1] - 0.005], + zoom: 13.8, + }); + mapBoxVectorLayer.addDynamicRoute('dynamicRoute', track1, car); + } } // 人员 function getData() { diff --git a/src/views/oneMap/components/FXHG.vue b/src/views/oneMap/components/FXHG.vue index a45ccd9..13abdf5 100644 --- a/src/views/oneMap/components/FXHG.vue +++ b/src/views/oneMap/components/FXHG.vue @@ -48,6 +48,7 @@ newfiberMapbox.map.removeSource('dynamicRoute_Symbol'); clearInterval(window.routeTimer); } + newfiberMapbox.map.setBearing(0); } function selectTime(time) { checkTime.value = time; diff --git a/src/assets/track1.json b/src/assets/track1.json new file mode 100644 index 0000000..b56ade9 --- /dev/null +++ b/src/assets/track1.json @@ -0,0 +1,165 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "id": 0, + "geometry": { + "type": "LineString", + "coordinates": [ + [ + 109.51952626140188, + 36.611401777023502 + ], + [ + 109.52247679304911, + 36.613724130965196 + ], + [ + 109.52502757524736, + 36.616198770411259 + ], + [ + 109.52236257892083, + 36.619149302058489 + ], + [ + 109.52420904066136, + 36.620329514717383 + ], + [ + 109.52367604139604, + 36.62095769242292 + ], + [ + 109.52285750681004, + 36.62120515636753 + ], + [ + 109.52207704360013, + 36.621319370495804 + ], + [ + 109.52150597295874, + 36.621681048568696 + ], + [ + 109.51924072608118, + 36.623641724437498 + ], + [ + 109.51878386956805, + 36.624174723702808 + ], + [ + 109.51762269259721, + 36.624869526316509 + ], + [ + 109.51549069553599, + 36.625821310718848 + ], + [ + 109.51354905535523, + 36.627277540854422 + ], + [ + 109.51237360161834, + 36.62779150443167 + ], + [ + 109.51201192354546, + 36.62808655759639 + ], + [ + 109.51207854845362, + 36.628648110393769 + ], + [ + 109.51258299418686, + 36.628971717090565 + ], + [ + 109.51305888638802, + 36.628952681402517 + ], + [ + 109.51398211725828, + 36.628276914476857 + ], + [ + 109.51593327528307, + 36.626611291772775 + ], + [ + 109.51633302473205, + 36.626430452736336 + ], + [ + 109.51703734518978, + 36.626335274296096 + ], + [ + 109.51767504073935, + 36.626554184708638 + ], + [ + 109.51804623665626, + 36.626877791405434 + ], + [ + 109.51819852216063, + 36.627115737506017 + ], + [ + 109.51856020023352, + 36.627325130074532 + ], + [ + 109.5188838069303, + 36.627525004799018 + ], + [ + 109.5189599496825, + 36.627762950899601 + ], + [ + 109.51891236046238, + 36.628000897000184 + ], + [ + 109.51860778945364, + 36.628096075440418 + ], + [ + 109.51833177197696, + 36.628210289568699 + ], + [ + 109.5178178083997, + 36.628828949430215 + ], + [ + 109.51630447119999, + 36.630618304106605 + ], + [ + 109.51520991913731, + 36.6317985167655 + ], + [ + 109.5144770451475, + 36.632407658782995 + ], + [ + 109.5143057239551, + 36.632507596145231 + ] + ] + }, + "properties": { + "color": "rgba(82, 214, 108,1)" + } + } + ] +} \ No newline at end of file diff --git a/src/utils/GISdocument/mapboxVectorLayer.js b/src/utils/GISdocument/mapboxVectorLayer.js index 6aca56f..ca28221 100644 --- a/src/utils/GISdocument/mapboxVectorLayer.js +++ b/src/utils/GISdocument/mapboxVectorLayer.js @@ -388,6 +388,9 @@ newfiberMapbox.map.removeLayer(layerName); newfiberMapbox.map.removeSource(layerName); } + if (newfiberMapbox.map.hasImage(layerName)) { + newfiberMapbox.map.removeImage(layerName); + } }); } } diff --git a/src/views/oneMap/FloodStuationReview/sqhgBottomBox.vue b/src/views/oneMap/FloodStuationReview/sqhgBottomBox.vue index 6a66c14..800d5ed 100644 --- a/src/views/oneMap/FloodStuationReview/sqhgBottomBox.vue +++ b/src/views/oneMap/FloodStuationReview/sqhgBottomBox.vue @@ -116,7 +116,6 @@ ]; const ranLeng = [ [ - { value: '0-0.2', color: 'rgba(7, 213, 118, 0)' }, { value: '0.2-5', color: 'rgb(38, 129, 240,1)' }, { value: '5-16', color: 'rgba(222,230,0,1)' }, @@ -215,7 +214,6 @@ runDayInterval.value = setTimeout(() => { stepNum.value++; if (stepNum.value <= 24) { - setRainImage(stepNum.value - 1); // NewFiberMapUtils.disposeRainfall(hoursList.value.rainTrend[Number(stepNum.value)-1]) stepLin.value = `${stepNum.value * 4.1666}%`; @@ -391,7 +389,7 @@ let canvas = []; let plot = null; const initRainImage = async imagesList => { - console.log('imagesList',imagesList); + console.log('imagesList', imagesList); imageFiles = await Promise.all(imagesList.map(url => urlToFile(url, _.last(_.split(url, '/'))))); canvas = createCanvas(0); @@ -406,7 +404,6 @@ }; const setRainImage = index => { - var reader = new FileReader(); reader.onload = e => createPlot(e, canvas); reader.readAsArrayBuffer(imageFiles[index]); diff --git a/src/views/oneMap/FloodStuationReview/xqhgLeftBox.vue b/src/views/oneMap/FloodStuationReview/xqhgLeftBox.vue index e5a188e..ae3c851 100644 --- a/src/views/oneMap/FloodStuationReview/xqhgLeftBox.vue +++ b/src/views/oneMap/FloodStuationReview/xqhgLeftBox.vue @@ -100,6 +100,7 @@ import ChartCl from './chartCl.vue'; import ChartXcry from './ChartXcry.vue'; import track from '@/assets/track.json'; +import track1 from '@/assets/track1.json'; import car from '@/assets/newImgs/car.png'; import mapBoxVectorLayer from '@/utils/GISdocument/mapboxVectorLayer.js'; import { ref, reactive, toRefs, onMounted, onBeforeUnmount } from 'vue'; @@ -114,13 +115,25 @@ // 车辆调度 function getCarIndex(num) { console.log('num--', num); - let center = turf.center(track); - console.log('center---', center); - newfiberMapbox.map.easeTo({ - center: [center.geometry.coordinates[0], center.geometry.coordinates[1] - 0.005], - zoom: 13.8, - }); - mapBoxVectorLayer.addDynamicRoute('dynamicRoute', track, car); + if (num == 0) { + clearInterval(window.routeTimer); + mapBoxVectorLayer.removeByIds(['dynamicRoute', 'dynamicRoute_Symbol']); + let center = turf.center(track); + newfiberMapbox.map.easeTo({ + center: [center.geometry.coordinates[0], center.geometry.coordinates[1] - 0.005], + zoom: 13.8, + }); + mapBoxVectorLayer.addDynamicRoute('dynamicRoute', track, car); + } else if (num == 1) { + clearInterval(window.routeTimer); + mapBoxVectorLayer.removeByIds(['dynamicRoute', 'dynamicRoute_Symbol']); + let center = turf.center(track1); + newfiberMapbox.map.easeTo({ + center: [center.geometry.coordinates[0], center.geometry.coordinates[1] - 0.005], + zoom: 13.8, + }); + mapBoxVectorLayer.addDynamicRoute('dynamicRoute', track1, car); + } } // 人员 function getData() { diff --git a/src/views/oneMap/components/FXHG.vue b/src/views/oneMap/components/FXHG.vue index a45ccd9..13abdf5 100644 --- a/src/views/oneMap/components/FXHG.vue +++ b/src/views/oneMap/components/FXHG.vue @@ -48,6 +48,7 @@ newfiberMapbox.map.removeSource('dynamicRoute_Symbol'); clearInterval(window.routeTimer); } + newfiberMapbox.map.setBearing(0); } function selectTime(time) { checkTime.value = time; diff --git a/src/views/oneMap/components/ZHPS.vue b/src/views/oneMap/components/ZHPS.vue index f09ddbc..81c6230 100644 --- a/src/views/oneMap/components/ZHPS.vue +++ b/src/views/oneMap/components/ZHPS.vue @@ -44,6 +44,7 @@ }); onBeforeUnmount(() => { bus.emit('SetLayerShow', ['蓝色地图']); + newfiberMapbox.map.setBearing(0); // bus.emit('setLayerVisible', { layername: 'ysLine1', isCheck: false }); // bus.emit('setLayerVisible', { layername: 'wsLine1', isCheck: false }); });