diff --git a/src/utils/gis/NewFiberMapUtils.js b/src/utils/gis/NewFiberMapUtils.js index 18d0f0d..2f59ddf 100644 --- a/src/utils/gis/NewFiberMapUtils.js +++ b/src/utils/gis/NewFiberMapUtils.js @@ -10,6 +10,58 @@ import cesiumMapLegend from '@/views/sponeScreen/gisMF/cesiumMapLegend.js'; import newfiberVectorLayer from "@/views/sponeScreen/gisMF/newfiberVectorLayer"; import { facilityPumpList } from '@/api/scada/pumpStationInformation'; + +let mapParams={ + geojson:{ + point:{ + type: NewFiberMap.Enum.VectorType.ICON, + options: { + url: "/static/images/icon.png", + width: 20, + height: 20, + verticalOrigin: Cesium.HorizontalOrigin.RIGHT, + pixelOffset: [0, -10], + }, + labelOptions: { + font: "17px PingFang SC", + style: Cesium.LabelStyle.FILL_AND_OUTLINE, + outlineColor: "rgba(20,83,154,1)", + outline: true, + outlineWidth: 3, + color: "#ffffff", + pixelOffset: [0, 25], + distanceDisplayCondition: [0, 5100], + }, + }, + warning:{ + type: NewFiberMap.Enum.VectorType.SPECIAL_CIRCLE, + options: { + radius: 70, + material: new NewFiberMap.Material.CircleDiffuseMaterialProperty({ + color: Cesium.Color.fromCssColorString("rgba(255,0,0, .5)"), + speed: 50, + }), + }, + }, + polyline: { + type: NewFiberMap.Enum.VectorType.POLYLINE, + options: { + show: true, + width: 6, + material:new Cesium.Spriteline1MaterialProperty(3000,'/static/images/spriteline.png'), + clampToGround: true + } + }, + polygon:{ + type: NewFiberMap.Enum.VectorType.POLYGON, + options: { + width: 1, + material: "rgba(46,196,203,0.5)", + outlineColor: "rgba(0,244,255,1)", + }, + } + } +}; export default class NewFiberMapUtils { static defaultParams = { @@ -20,7 +72,7 @@ defaultPreventWaterloggingDemo:'defaultPreventWaterloggingDemo', weather_cloud:'weather_cloud' }, - mapParams:{ + /* mapParams:{ geojson:{ point:{ type: NewFiberMap.Enum.VectorType.ICON, @@ -70,12 +122,12 @@ }, } } - } + }*/ } static async defaultPatrolDemo(newfiberMap) { - const {mapParams,keys} = NewFiberMapUtils.defaultParams; + const {keys} = NewFiberMapUtils.defaultParams; const defaulGeoJSONParams = _.cloneDeep(mapParams.geojson); const icons = {ylz:rainStation_icon, hmss:spongeFacility_icon, car:"/images/people.png"}; NewFiberMapUtils.removeByIds([keys.defaultPatrolDemo]); @@ -106,7 +158,8 @@ } static async defaultPreventWaterlogging(newfiberMap){ - const {mapParams, keys} = NewFiberMapUtils.defaultParams; + const { keys} = NewFiberMapUtils.defaultParams; + NewFiberMapUtils.removeByIds([keys.defaultPreventWaterloggingDemo]); const defaulGeoJSONParams = _.cloneDeep(mapParams.geojson); const icons = { "confluence":sewageBenZhan_icon, @@ -115,9 +168,9 @@ } let result = await facilityPumpList(); let pumpData = result.data.filter(i => i.lon && i.lat &&i.geometrys); - let points = pumpData.map(i => turf.point([i.lon,i.lat].map(Number),{style_:{id:keys.defaultPreventWaterloggingDemo,name:i.pumpName,...(defaulGeoJSONParams.point),options:Object.assign(defaulGeoJSONParams.point.options,{url:icons[i.pumpType]})}})) + let points = pumpData.map(i => turf.point([i.lon,i.lat].map(Number),{style_:{id:keys.defaultPreventWaterloggingDemo,name:i.pumpName,...(defaulGeoJSONParams.point),options:{...defaulGeoJSONParams.point.options,url:icons[i.pumpType]}}})) + console.log('points',points); let polygons = pumpData.map(i => turf.feature(Terraformer.WKT.parse(i.geometrys),{style_:{id:keys.defaultPatrolDemo,...defaulGeoJSONParams.polygon}})); - NewFiberMapUtils.removeByIds([keys.defaultPreventWaterloggingDemo]); NewFiberMapUtils.weatherToMap(newfiberMap); /* let modelLegends = cesiumMapLegend.map(i => i.children).flat(Infinity).filter(i => i.layername.includes('Line') && i.type == '3dModel'); let modelIds = modelLegends.map(i => i.layername); @@ -128,12 +181,12 @@ modelLegends.forEach(i => i.data.forEach(url => newfiberVectorLayer.add3DModelLayers(newfiberMap, url, i.layername))); }*/ riverFlow.features.forEach(i => i.properties.style_ = {id: keys.defaultPreventWaterloggingDemo, ...(defaulGeoJSONParams.polyline)}); - riverFlow.features = riverFlow.features.concat([...points,...polygons]); newfiberMap.geojsonToMap(riverFlow); + newfiberMap.geojsonToMap(turf.featureCollection([...points,...polygons])); } static async weatherToMap(newfiberMap){ - const {mapParams, keys} = NewFiberMapUtils.defaultParams; + const {keys} = NewFiberMapUtils.defaultParams; const urls = [ "/images/weather/QPFRef_202406210650.png", "/images/weather/QPFRef_202406210700.png",