diff --git a/src/views/sponeScreen/cityGK/PhysicalGeography.vue b/src/views/sponeScreen/cityGK/PhysicalGeography.vue index 6e06251..dd80883 100644 --- a/src/views/sponeScreen/cityGK/PhysicalGeography.vue +++ b/src/views/sponeScreen/cityGK/PhysicalGeography.vue @@ -256,11 +256,15 @@ }; onMounted(() => { - setTimeout(() => { - newfiberMapBoxVectorLayer.addGeojsonPolygonWithLabel('oneCenter', oneCenter); - newfiberMapBoxVectorLayer.addGeojsonPolygonWithLabel('oneCenter1', oneCenter1); - newfiberMapBoxVectorLayer.addGeojsonPolygonWithLabel('oneCenter2', oneCenter2); - }, 3000); + let mapboxTimer = setInterval(() => { + if (!newfiberMapbox) return; + newfiberMapbox.map.on('style.load', () => { + newfiberMapBoxVectorLayer.addGeojsonPolygonWithLabel('oneCenter', oneCenter); + newfiberMapBoxVectorLayer.addGeojsonPolygonWithLabel('oneCenter1', oneCenter1); + newfiberMapBoxVectorLayer.addGeojsonPolygonWithLabel('oneCenter2', oneCenter2); + }); + clearInterval(mapboxTimer); + }); setTimeout(() => { newfiberMapbox.map.easeTo({ center: [114.315, 34.852], diff --git a/src/views/sponeScreen/cityGK/PhysicalGeography.vue b/src/views/sponeScreen/cityGK/PhysicalGeography.vue index 6e06251..dd80883 100644 --- a/src/views/sponeScreen/cityGK/PhysicalGeography.vue +++ b/src/views/sponeScreen/cityGK/PhysicalGeography.vue @@ -256,11 +256,15 @@ }; onMounted(() => { - setTimeout(() => { - newfiberMapBoxVectorLayer.addGeojsonPolygonWithLabel('oneCenter', oneCenter); - newfiberMapBoxVectorLayer.addGeojsonPolygonWithLabel('oneCenter1', oneCenter1); - newfiberMapBoxVectorLayer.addGeojsonPolygonWithLabel('oneCenter2', oneCenter2); - }, 3000); + let mapboxTimer = setInterval(() => { + if (!newfiberMapbox) return; + newfiberMapbox.map.on('style.load', () => { + newfiberMapBoxVectorLayer.addGeojsonPolygonWithLabel('oneCenter', oneCenter); + newfiberMapBoxVectorLayer.addGeojsonPolygonWithLabel('oneCenter1', oneCenter1); + newfiberMapBoxVectorLayer.addGeojsonPolygonWithLabel('oneCenter2', oneCenter2); + }); + clearInterval(mapboxTimer); + }); setTimeout(() => { newfiberMapbox.map.easeTo({ center: [114.315, 34.852], diff --git a/src/views/sponeScreen/gisMF/mapboxVectorLayer.js b/src/views/sponeScreen/gisMF/mapboxVectorLayer.js index 2ea860b..3181a00 100644 --- a/src/views/sponeScreen/gisMF/mapboxVectorLayer.js +++ b/src/views/sponeScreen/gisMF/mapboxVectorLayer.js @@ -1,4 +1,42 @@ export default class newfiberMapBoxVectorLayer { + //添加circle + static addGeojsonCircle(layerId, geojson, minzoom) { + if (!newfiberMapbox.map.getLayer(layerId)) { + newfiberMapbox.map.addSource(layerId, { + type: 'geojson', + data: geojson, + }); + newfiberMapbox.map.addLayer({ + id: layerId, + type: 'circle', + source: layerId, + paint: { + 'circle-color': ['get', 'fillcolor'], + 'circle-radius': 10, + }, + }); + newfiberMapbox.map.addLayer({ + id: layerId + '_label', + type: 'symbol', + minzoom: minzoom ? minzoom : 0, + source: layerId, + paint: { + 'text-color': 'rgba(255, 255, 255, 1)', + 'text-halo-color': 'rgba(14, 139, 90, 1)', + 'text-halo-width': 2, + }, + layout: { + 'text-field': '{name}', + 'text-font': ['KlokanTech Noto Sans Regular'], + 'text-size': 16, + 'text-line-height': 3, + 'text-anchor': 'bottom', + 'text-max-width': 50, + }, + }); + } + } + //添加geojson Symbol static addGeojsonSymbol(layerId, geojson, icon) { if (!newfiberMapbox.map.getLayer(layerId)) { @@ -60,6 +98,48 @@ }); } } + //添加有标注的geojson线 + static addGeojsonLineWithLabel(layerId, geojson, lineWidth, minzoom) { + let labelGeojson = this.getGeojsonCenterPoint(geojson); + if (!newfiberMapbox.map.getLayer(layerId)) { + newfiberMapbox.map.addSource(layerId, { + type: 'geojson', + data: geojson, + }); + newfiberMapbox.map.addSource(layerId + '_label', { + type: 'geojson', + data: labelGeojson, + }); + newfiberMapbox.map.addLayer({ + id: layerId, + type: 'line', + source: layerId, + paint: { + 'line-color': ['get', 'fillcolor'], + 'line-width': lineWidth ? lineWidth : 3, + }, + }); + newfiberMapbox.map.addLayer({ + id: layerId + '_label', + type: 'symbol', + minzoom: minzoom ? minzoom : 0, + source: layerId + '_label', + paint: { + 'text-color': 'rgba(255, 255, 255, 1)', + 'text-halo-color': 'rgba(14, 139, 90, 1)', + 'text-halo-width': 2, + }, + layout: { + 'text-field': '{name}', + 'text-font': ['KlokanTech Noto Sans Regular'], + 'text-size': 16, + 'text-line-height': 3, + 'text-anchor': 'bottom', + 'text-max-width': 50, + }, + }); + } + } //添加geojson面 static addGeojsonPolygon(layerId, geojson) { if (!newfiberMapbox.map.getLayer(layerId)) { @@ -78,8 +158,9 @@ }); } } + //添加有标注的geojson面 - static addGeojsonPolygonWithLabel(layerId, geojson) { + static addGeojsonPolygonWithLabel(layerId, geojson, minzoom) { let labelGeojson = this.getGeojsonCenterPoint(geojson); if (!newfiberMapbox.map.getLayer(layerId)) { newfiberMapbox.map.addSource(layerId, { @@ -102,6 +183,7 @@ id: layerId + '_label', type: 'symbol', source: layerId + '_label', + minzoom: minzoom ? minzoom : 0, paint: { 'text-color': 'rgba(255, 255, 255, 1)', 'text-halo-color': 'rgba(14, 139, 90, 1)', diff --git a/src/views/sponeScreen/cityGK/PhysicalGeography.vue b/src/views/sponeScreen/cityGK/PhysicalGeography.vue index 6e06251..dd80883 100644 --- a/src/views/sponeScreen/cityGK/PhysicalGeography.vue +++ b/src/views/sponeScreen/cityGK/PhysicalGeography.vue @@ -256,11 +256,15 @@ }; onMounted(() => { - setTimeout(() => { - newfiberMapBoxVectorLayer.addGeojsonPolygonWithLabel('oneCenter', oneCenter); - newfiberMapBoxVectorLayer.addGeojsonPolygonWithLabel('oneCenter1', oneCenter1); - newfiberMapBoxVectorLayer.addGeojsonPolygonWithLabel('oneCenter2', oneCenter2); - }, 3000); + let mapboxTimer = setInterval(() => { + if (!newfiberMapbox) return; + newfiberMapbox.map.on('style.load', () => { + newfiberMapBoxVectorLayer.addGeojsonPolygonWithLabel('oneCenter', oneCenter); + newfiberMapBoxVectorLayer.addGeojsonPolygonWithLabel('oneCenter1', oneCenter1); + newfiberMapBoxVectorLayer.addGeojsonPolygonWithLabel('oneCenter2', oneCenter2); + }); + clearInterval(mapboxTimer); + }); setTimeout(() => { newfiberMapbox.map.easeTo({ center: [114.315, 34.852], diff --git a/src/views/sponeScreen/gisMF/mapboxVectorLayer.js b/src/views/sponeScreen/gisMF/mapboxVectorLayer.js index 2ea860b..3181a00 100644 --- a/src/views/sponeScreen/gisMF/mapboxVectorLayer.js +++ b/src/views/sponeScreen/gisMF/mapboxVectorLayer.js @@ -1,4 +1,42 @@ export default class newfiberMapBoxVectorLayer { + //添加circle + static addGeojsonCircle(layerId, geojson, minzoom) { + if (!newfiberMapbox.map.getLayer(layerId)) { + newfiberMapbox.map.addSource(layerId, { + type: 'geojson', + data: geojson, + }); + newfiberMapbox.map.addLayer({ + id: layerId, + type: 'circle', + source: layerId, + paint: { + 'circle-color': ['get', 'fillcolor'], + 'circle-radius': 10, + }, + }); + newfiberMapbox.map.addLayer({ + id: layerId + '_label', + type: 'symbol', + minzoom: minzoom ? minzoom : 0, + source: layerId, + paint: { + 'text-color': 'rgba(255, 255, 255, 1)', + 'text-halo-color': 'rgba(14, 139, 90, 1)', + 'text-halo-width': 2, + }, + layout: { + 'text-field': '{name}', + 'text-font': ['KlokanTech Noto Sans Regular'], + 'text-size': 16, + 'text-line-height': 3, + 'text-anchor': 'bottom', + 'text-max-width': 50, + }, + }); + } + } + //添加geojson Symbol static addGeojsonSymbol(layerId, geojson, icon) { if (!newfiberMapbox.map.getLayer(layerId)) { @@ -60,6 +98,48 @@ }); } } + //添加有标注的geojson线 + static addGeojsonLineWithLabel(layerId, geojson, lineWidth, minzoom) { + let labelGeojson = this.getGeojsonCenterPoint(geojson); + if (!newfiberMapbox.map.getLayer(layerId)) { + newfiberMapbox.map.addSource(layerId, { + type: 'geojson', + data: geojson, + }); + newfiberMapbox.map.addSource(layerId + '_label', { + type: 'geojson', + data: labelGeojson, + }); + newfiberMapbox.map.addLayer({ + id: layerId, + type: 'line', + source: layerId, + paint: { + 'line-color': ['get', 'fillcolor'], + 'line-width': lineWidth ? lineWidth : 3, + }, + }); + newfiberMapbox.map.addLayer({ + id: layerId + '_label', + type: 'symbol', + minzoom: minzoom ? minzoom : 0, + source: layerId + '_label', + paint: { + 'text-color': 'rgba(255, 255, 255, 1)', + 'text-halo-color': 'rgba(14, 139, 90, 1)', + 'text-halo-width': 2, + }, + layout: { + 'text-field': '{name}', + 'text-font': ['KlokanTech Noto Sans Regular'], + 'text-size': 16, + 'text-line-height': 3, + 'text-anchor': 'bottom', + 'text-max-width': 50, + }, + }); + } + } //添加geojson面 static addGeojsonPolygon(layerId, geojson) { if (!newfiberMapbox.map.getLayer(layerId)) { @@ -78,8 +158,9 @@ }); } } + //添加有标注的geojson面 - static addGeojsonPolygonWithLabel(layerId, geojson) { + static addGeojsonPolygonWithLabel(layerId, geojson, minzoom) { let labelGeojson = this.getGeojsonCenterPoint(geojson); if (!newfiberMapbox.map.getLayer(layerId)) { newfiberMapbox.map.addSource(layerId, { @@ -102,6 +183,7 @@ id: layerId + '_label', type: 'symbol', source: layerId + '_label', + minzoom: minzoom ? minzoom : 0, paint: { 'text-color': 'rgba(255, 255, 255, 1)', 'text-halo-color': 'rgba(14, 139, 90, 1)', diff --git a/src/views/sponeScreen/projectHM/ProjectDisplay_1.vue b/src/views/sponeScreen/projectHM/ProjectDisplay_1.vue new file mode 100644 index 0000000..4d0443b --- /dev/null +++ b/src/views/sponeScreen/projectHM/ProjectDisplay_1.vue @@ -0,0 +1,288 @@ + + + + + diff --git a/src/views/sponeScreen/cityGK/PhysicalGeography.vue b/src/views/sponeScreen/cityGK/PhysicalGeography.vue index 6e06251..dd80883 100644 --- a/src/views/sponeScreen/cityGK/PhysicalGeography.vue +++ b/src/views/sponeScreen/cityGK/PhysicalGeography.vue @@ -256,11 +256,15 @@ }; onMounted(() => { - setTimeout(() => { - newfiberMapBoxVectorLayer.addGeojsonPolygonWithLabel('oneCenter', oneCenter); - newfiberMapBoxVectorLayer.addGeojsonPolygonWithLabel('oneCenter1', oneCenter1); - newfiberMapBoxVectorLayer.addGeojsonPolygonWithLabel('oneCenter2', oneCenter2); - }, 3000); + let mapboxTimer = setInterval(() => { + if (!newfiberMapbox) return; + newfiberMapbox.map.on('style.load', () => { + newfiberMapBoxVectorLayer.addGeojsonPolygonWithLabel('oneCenter', oneCenter); + newfiberMapBoxVectorLayer.addGeojsonPolygonWithLabel('oneCenter1', oneCenter1); + newfiberMapBoxVectorLayer.addGeojsonPolygonWithLabel('oneCenter2', oneCenter2); + }); + clearInterval(mapboxTimer); + }); setTimeout(() => { newfiberMapbox.map.easeTo({ center: [114.315, 34.852], diff --git a/src/views/sponeScreen/gisMF/mapboxVectorLayer.js b/src/views/sponeScreen/gisMF/mapboxVectorLayer.js index 2ea860b..3181a00 100644 --- a/src/views/sponeScreen/gisMF/mapboxVectorLayer.js +++ b/src/views/sponeScreen/gisMF/mapboxVectorLayer.js @@ -1,4 +1,42 @@ export default class newfiberMapBoxVectorLayer { + //添加circle + static addGeojsonCircle(layerId, geojson, minzoom) { + if (!newfiberMapbox.map.getLayer(layerId)) { + newfiberMapbox.map.addSource(layerId, { + type: 'geojson', + data: geojson, + }); + newfiberMapbox.map.addLayer({ + id: layerId, + type: 'circle', + source: layerId, + paint: { + 'circle-color': ['get', 'fillcolor'], + 'circle-radius': 10, + }, + }); + newfiberMapbox.map.addLayer({ + id: layerId + '_label', + type: 'symbol', + minzoom: minzoom ? minzoom : 0, + source: layerId, + paint: { + 'text-color': 'rgba(255, 255, 255, 1)', + 'text-halo-color': 'rgba(14, 139, 90, 1)', + 'text-halo-width': 2, + }, + layout: { + 'text-field': '{name}', + 'text-font': ['KlokanTech Noto Sans Regular'], + 'text-size': 16, + 'text-line-height': 3, + 'text-anchor': 'bottom', + 'text-max-width': 50, + }, + }); + } + } + //添加geojson Symbol static addGeojsonSymbol(layerId, geojson, icon) { if (!newfiberMapbox.map.getLayer(layerId)) { @@ -60,6 +98,48 @@ }); } } + //添加有标注的geojson线 + static addGeojsonLineWithLabel(layerId, geojson, lineWidth, minzoom) { + let labelGeojson = this.getGeojsonCenterPoint(geojson); + if (!newfiberMapbox.map.getLayer(layerId)) { + newfiberMapbox.map.addSource(layerId, { + type: 'geojson', + data: geojson, + }); + newfiberMapbox.map.addSource(layerId + '_label', { + type: 'geojson', + data: labelGeojson, + }); + newfiberMapbox.map.addLayer({ + id: layerId, + type: 'line', + source: layerId, + paint: { + 'line-color': ['get', 'fillcolor'], + 'line-width': lineWidth ? lineWidth : 3, + }, + }); + newfiberMapbox.map.addLayer({ + id: layerId + '_label', + type: 'symbol', + minzoom: minzoom ? minzoom : 0, + source: layerId + '_label', + paint: { + 'text-color': 'rgba(255, 255, 255, 1)', + 'text-halo-color': 'rgba(14, 139, 90, 1)', + 'text-halo-width': 2, + }, + layout: { + 'text-field': '{name}', + 'text-font': ['KlokanTech Noto Sans Regular'], + 'text-size': 16, + 'text-line-height': 3, + 'text-anchor': 'bottom', + 'text-max-width': 50, + }, + }); + } + } //添加geojson面 static addGeojsonPolygon(layerId, geojson) { if (!newfiberMapbox.map.getLayer(layerId)) { @@ -78,8 +158,9 @@ }); } } + //添加有标注的geojson面 - static addGeojsonPolygonWithLabel(layerId, geojson) { + static addGeojsonPolygonWithLabel(layerId, geojson, minzoom) { let labelGeojson = this.getGeojsonCenterPoint(geojson); if (!newfiberMapbox.map.getLayer(layerId)) { newfiberMapbox.map.addSource(layerId, { @@ -102,6 +183,7 @@ id: layerId + '_label', type: 'symbol', source: layerId + '_label', + minzoom: minzoom ? minzoom : 0, paint: { 'text-color': 'rgba(255, 255, 255, 1)', 'text-halo-color': 'rgba(14, 139, 90, 1)', diff --git a/src/views/sponeScreen/projectHM/ProjectDisplay_1.vue b/src/views/sponeScreen/projectHM/ProjectDisplay_1.vue new file mode 100644 index 0000000..4d0443b --- /dev/null +++ b/src/views/sponeScreen/projectHM/ProjectDisplay_1.vue @@ -0,0 +1,288 @@ + + + + + diff --git a/src/views/sponeScreen/projectHM/index.vue b/src/views/sponeScreen/projectHM/index.vue index bbb9286..6f73580 100644 --- a/src/views/sponeScreen/projectHM/index.vue +++ b/src/views/sponeScreen/projectHM/index.vue @@ -23,7 +23,7 @@ import CaldarRain from '@/views/sponeScreen/waterFlood/rainCaldar.vue'; //降雨日历 import ConstructionStatus from '@/views/sponeScreen/projectHM/ConstructionStatus.vue'; //建设状态 import ProjectYype from '@/views/sponeScreen/projectHM/ProjectYype.vue'; //建设状态 -import ProjectDisplay from '@/views/sponeScreen/projectHM/ProjectDisplay.vue'; //项目展示 +import ProjectDisplay from '@/views/sponeScreen/projectHM/ProjectDisplay_1.vue'; //项目展示 import ProjectEvaluation from '@/views/sponeScreen/projectHM/ProjectEvaluation.vue'; //项目评估 import qipao from '@/views/sponeScreen/projectHM/gongchenkanbani_comp/qipao.vue'; const { proxy } = getCurrentInstance();