diff --git a/index.html b/index.html index a94b4bf..e649c97 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ - + diff --git a/index.html b/index.html index a94b4bf..e649c97 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ - + diff --git a/public/static/libs/mapbox/style/wh_dhgx.json b/public/static/libs/mapbox/style/wh_dhgx.json index a28127c..2296a00 100644 --- a/public/static/libs/mapbox/style/wh_dhgx.json +++ b/public/static/libs/mapbox/style/wh_dhgx.json @@ -1679,6 +1679,72 @@ }, "mType": "geojsonMvt", "columns": "id,st_asText ( geometrys ) AS geometry,color,mix_intensity :: FLOAT as mix_intensity,fade_range :: FLOAT as fade_range,opacity :: FLOAT as opacity,string_to_array( rotation, ',' ) :: FLOAT [] as rotation,string_to_array( SCALE, ',' ) :: FLOAT [] as scale,string_to_array(translation, ',' ) :: FLOAT [] as translation,type,p_id,model_id " + }, + { + "id": "雨水管网充满度", + "key": "管线充满度", + "type": "heatmap", + "filter": [ + "in", + "type", + "YS" + ], + "layout": { + "visibility": "none" + }, + "minzoom": 0, + "maxzoom": 24, + "paint": { + "heatmap-weight": ["interpolate", ["linear"], ["get", "value"], 0, 0, 100, 1], + "heatmap-intensity": ["interpolate", ["linear"], ["zoom"], 0, 1, 9, 3], + "heatmap-color": [ + "interpolate", + ["linear"], + ["heatmap-density"], + 0, "rgba(43, 231, 171,0)", + 0.2, "rgba(43, 231, 171,0.6)", + 0.4, "rgb(43, 231, 171)", + 0.6, "rgb(24, 167, 242)", + 0.8, "rgb(248, 226, 112)", + 1, "rgb(178,24,43)" + ], + "heatmap-radius": ["interpolate", ["linear"], ["zoom"], 0, 2, 9, 30], + "heatmap-opacity": ["interpolate", ["linear"], ["zoom"], 1, 0, 15, 0.5] + }, + "mType": "geojson" + }, + { + "id": "污水管网充满度", + "key": "管线充满度", + "type": "heatmap", + "filter": [ + "in", + "type", + "WS" + ], + "layout": { + "visibility": "none" + }, + "minzoom": 0, + "maxzoom": 24, + "paint": { + "heatmap-weight": ["interpolate", ["linear"], ["get", "value"], 0, 0, 100, 1], + "heatmap-intensity": ["interpolate", ["linear"], ["zoom"], 0, 1, 9, 3], + "heatmap-color": [ + "interpolate", + ["linear"], + ["heatmap-density"], + 0, "rgba(43, 231, 171,0)", + 0.2, "rgba(43, 231, 171,0.6)", + 0.4, "rgb(43, 231, 171)", + 0.6, "rgb(24, 167, 242)", + 0.8, "rgb(248, 226, 112)", + 1, "rgb(178,24,43)" + ], + "heatmap-radius": ["interpolate", ["linear"], ["zoom"], 0, 2, 9, 30], + "heatmap-opacity": ["interpolate", ["linear"], ["zoom"], 1, 0, 15, 0.5] + }, + "mType": "geojson" } ], "maptalks": { @@ -4703,8 +4769,6 @@ ["WS", "HS"] ] }, - "雨水管网充满度": { "layerName": ["linestring","point"], "filter": [["fullness_YS"],["fullness_YS"]] }, - "污水管网充满度": { "layerName": ["linestring","point"], "filter": [["fullness_WS"],["fullness_WS"]] }, "污水系统流向1": { "layerName": ["linestring"], "filter": [["污水系统流向1"]] diff --git a/index.html b/index.html index a94b4bf..e649c97 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ - + diff --git a/public/static/libs/mapbox/style/wh_dhgx.json b/public/static/libs/mapbox/style/wh_dhgx.json index a28127c..2296a00 100644 --- a/public/static/libs/mapbox/style/wh_dhgx.json +++ b/public/static/libs/mapbox/style/wh_dhgx.json @@ -1679,6 +1679,72 @@ }, "mType": "geojsonMvt", "columns": "id,st_asText ( geometrys ) AS geometry,color,mix_intensity :: FLOAT as mix_intensity,fade_range :: FLOAT as fade_range,opacity :: FLOAT as opacity,string_to_array( rotation, ',' ) :: FLOAT [] as rotation,string_to_array( SCALE, ',' ) :: FLOAT [] as scale,string_to_array(translation, ',' ) :: FLOAT [] as translation,type,p_id,model_id " + }, + { + "id": "雨水管网充满度", + "key": "管线充满度", + "type": "heatmap", + "filter": [ + "in", + "type", + "YS" + ], + "layout": { + "visibility": "none" + }, + "minzoom": 0, + "maxzoom": 24, + "paint": { + "heatmap-weight": ["interpolate", ["linear"], ["get", "value"], 0, 0, 100, 1], + "heatmap-intensity": ["interpolate", ["linear"], ["zoom"], 0, 1, 9, 3], + "heatmap-color": [ + "interpolate", + ["linear"], + ["heatmap-density"], + 0, "rgba(43, 231, 171,0)", + 0.2, "rgba(43, 231, 171,0.6)", + 0.4, "rgb(43, 231, 171)", + 0.6, "rgb(24, 167, 242)", + 0.8, "rgb(248, 226, 112)", + 1, "rgb(178,24,43)" + ], + "heatmap-radius": ["interpolate", ["linear"], ["zoom"], 0, 2, 9, 30], + "heatmap-opacity": ["interpolate", ["linear"], ["zoom"], 1, 0, 15, 0.5] + }, + "mType": "geojson" + }, + { + "id": "污水管网充满度", + "key": "管线充满度", + "type": "heatmap", + "filter": [ + "in", + "type", + "WS" + ], + "layout": { + "visibility": "none" + }, + "minzoom": 0, + "maxzoom": 24, + "paint": { + "heatmap-weight": ["interpolate", ["linear"], ["get", "value"], 0, 0, 100, 1], + "heatmap-intensity": ["interpolate", ["linear"], ["zoom"], 0, 1, 9, 3], + "heatmap-color": [ + "interpolate", + ["linear"], + ["heatmap-density"], + 0, "rgba(43, 231, 171,0)", + 0.2, "rgba(43, 231, 171,0.6)", + 0.4, "rgb(43, 231, 171)", + 0.6, "rgb(24, 167, 242)", + 0.8, "rgb(248, 226, 112)", + 1, "rgb(178,24,43)" + ], + "heatmap-radius": ["interpolate", ["linear"], ["zoom"], 0, 2, 9, 30], + "heatmap-opacity": ["interpolate", ["linear"], ["zoom"], 1, 0, 15, 0.5] + }, + "mType": "geojson" } ], "maptalks": { @@ -4703,8 +4769,6 @@ ["WS", "HS"] ] }, - "雨水管网充满度": { "layerName": ["linestring","point"], "filter": [["fullness_YS"],["fullness_YS"]] }, - "污水管网充满度": { "layerName": ["linestring","point"], "filter": [["fullness_WS"],["fullness_WS"]] }, "污水系统流向1": { "layerName": ["linestring"], "filter": [["污水系统流向1"]] diff --git a/src/components/Map/Map.vue b/src/components/Map/Map.vue index 9214976..e57a91f 100644 --- a/src/components/Map/Map.vue +++ b/src/components/Map/Map.vue @@ -225,7 +225,7 @@ if (!!!map.getSource(sourceID)) { let flag = mType == "geojson"; flag - ? map.addSource(sourceID, { type: mType, data: geojson[key] }) + ? map.addSource(sourceID, { type: mType, data: geojson[key] || turf.featureCollection([]) }) : map.addSource(sourceID, { ...(mType == "mvt" ? { @@ -518,6 +518,8 @@ layer && newfiberMap.addLayer(layer); } if (layer) return layer.setData(json); + let layerSource = newfiberMap.map.getSource(key); + if(layerSource) return newfiberMap.map.getSource(key).setData(json); setLegendData([{ data: json, layername: key, type: "point" }]); }; diff --git a/index.html b/index.html index a94b4bf..e649c97 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ - + diff --git a/public/static/libs/mapbox/style/wh_dhgx.json b/public/static/libs/mapbox/style/wh_dhgx.json index a28127c..2296a00 100644 --- a/public/static/libs/mapbox/style/wh_dhgx.json +++ b/public/static/libs/mapbox/style/wh_dhgx.json @@ -1679,6 +1679,72 @@ }, "mType": "geojsonMvt", "columns": "id,st_asText ( geometrys ) AS geometry,color,mix_intensity :: FLOAT as mix_intensity,fade_range :: FLOAT as fade_range,opacity :: FLOAT as opacity,string_to_array( rotation, ',' ) :: FLOAT [] as rotation,string_to_array( SCALE, ',' ) :: FLOAT [] as scale,string_to_array(translation, ',' ) :: FLOAT [] as translation,type,p_id,model_id " + }, + { + "id": "雨水管网充满度", + "key": "管线充满度", + "type": "heatmap", + "filter": [ + "in", + "type", + "YS" + ], + "layout": { + "visibility": "none" + }, + "minzoom": 0, + "maxzoom": 24, + "paint": { + "heatmap-weight": ["interpolate", ["linear"], ["get", "value"], 0, 0, 100, 1], + "heatmap-intensity": ["interpolate", ["linear"], ["zoom"], 0, 1, 9, 3], + "heatmap-color": [ + "interpolate", + ["linear"], + ["heatmap-density"], + 0, "rgba(43, 231, 171,0)", + 0.2, "rgba(43, 231, 171,0.6)", + 0.4, "rgb(43, 231, 171)", + 0.6, "rgb(24, 167, 242)", + 0.8, "rgb(248, 226, 112)", + 1, "rgb(178,24,43)" + ], + "heatmap-radius": ["interpolate", ["linear"], ["zoom"], 0, 2, 9, 30], + "heatmap-opacity": ["interpolate", ["linear"], ["zoom"], 1, 0, 15, 0.5] + }, + "mType": "geojson" + }, + { + "id": "污水管网充满度", + "key": "管线充满度", + "type": "heatmap", + "filter": [ + "in", + "type", + "WS" + ], + "layout": { + "visibility": "none" + }, + "minzoom": 0, + "maxzoom": 24, + "paint": { + "heatmap-weight": ["interpolate", ["linear"], ["get", "value"], 0, 0, 100, 1], + "heatmap-intensity": ["interpolate", ["linear"], ["zoom"], 0, 1, 9, 3], + "heatmap-color": [ + "interpolate", + ["linear"], + ["heatmap-density"], + 0, "rgba(43, 231, 171,0)", + 0.2, "rgba(43, 231, 171,0.6)", + 0.4, "rgb(43, 231, 171)", + 0.6, "rgb(24, 167, 242)", + 0.8, "rgb(248, 226, 112)", + 1, "rgb(178,24,43)" + ], + "heatmap-radius": ["interpolate", ["linear"], ["zoom"], 0, 2, 9, 30], + "heatmap-opacity": ["interpolate", ["linear"], ["zoom"], 1, 0, 15, 0.5] + }, + "mType": "geojson" } ], "maptalks": { @@ -4703,8 +4769,6 @@ ["WS", "HS"] ] }, - "雨水管网充满度": { "layerName": ["linestring","point"], "filter": [["fullness_YS"],["fullness_YS"]] }, - "污水管网充满度": { "layerName": ["linestring","point"], "filter": [["fullness_WS"],["fullness_WS"]] }, "污水系统流向1": { "layerName": ["linestring"], "filter": [["污水系统流向1"]] diff --git a/src/components/Map/Map.vue b/src/components/Map/Map.vue index 9214976..e57a91f 100644 --- a/src/components/Map/Map.vue +++ b/src/components/Map/Map.vue @@ -225,7 +225,7 @@ if (!!!map.getSource(sourceID)) { let flag = mType == "geojson"; flag - ? map.addSource(sourceID, { type: mType, data: geojson[key] }) + ? map.addSource(sourceID, { type: mType, data: geojson[key] || turf.featureCollection([]) }) : map.addSource(sourceID, { ...(mType == "mvt" ? { @@ -518,6 +518,8 @@ layer && newfiberMap.addLayer(layer); } if (layer) return layer.setData(json); + let layerSource = newfiberMap.map.getSource(key); + if(layerSource) return newfiberMap.map.getSource(key).setData(json); setLegendData([{ data: json, layername: key, type: "point" }]); }; diff --git a/src/components/Map/MapBox.vue b/src/components/Map/MapBox.vue index 801909b..a024760 100644 --- a/src/components/Map/MapBox.vue +++ b/src/components/Map/MapBox.vue @@ -863,8 +863,19 @@ fullness:{ method:getPipeMonitorRun, fields:{geometry:"pipelineGeometry",name:"name"}, - groupMethod:(data)=> _.groupBy(data.filter(k => k.pipelineGeometry).map(o => ({...o,width:8,type:`fullness_${o.pipeSystem}`,name:`管径:${o.pipelineDiameter}\n充满度:${o.fullness}`,color:fullnessColor(o.fullness)})),(v)=>v.type) + groupMethod:(data) => { + busEmit(events_params.setGeoJSON.key, { + json: turf.featureCollection(data.filter(i => i.pipelineGeometry).map(v => turf.flatten(turf.feature(Terraformer.WKT.parse(v.pipelineGeometry),{type:v.pipeSystem,value:Number(v.fullness)})).features.map(i => ({...(turf.center(i)),properties:i.properties}))).flat(Infinity)), + key: '管线充满度', + }) + return {}; + } } +/* fullness:{ + method:getPipeMonitorRun, + fields:{geometry:"pipelineGeometry",name:"name"}, + groupMethod:(data)=> _.groupBy(data.filter(k => k.pipelineGeometry).map(o => ({...o,width:8,type:`fullness_${o.pipeSystem}`,name:`管径:${o.pipelineDiameter}\n充满度:${o.fullness}`,color:fullnessColor(o.fullness)})),(v)=>v.type) + }*/ }; const other_data_params = {}; let keys = Object.keys(params || data_default_params); @@ -881,12 +892,12 @@ const groups = data_default_params[k].groupMethod(data); const g_keys = Object.keys(groups); bus.emit("removeMapDatas", g_keys); - if (k == keys[0]) { + /* if (k == keys[0]) { appStore.SET_MapData(filterGeometryNotEmpty(data)); appStore.SET_MapData_COUNT( _.assign({}, ...g_keys.map((a) => ({ [a]: groups[a].length }))) ); - } + }*/ g_keys.forEach((key) => { busEmit(beansToMap.key, { beans: groups[key].map((i) => ({