diff --git a/public/config/mars3dConfig.json b/public/config/mars3dConfig.json index 7752593..498d918 100644 --- a/public/config/mars3dConfig.json +++ b/public/config/mars3dConfig.json @@ -1,7 +1,7 @@ { "scene": { "center": { - "lat": "36.48", "lng": "117.48", "alt": 20000, "heading": 360, "pitch": -45 + "lat": "25.675", "lng": "114.875", "alt": 10000, "heading": 360, "pitch": -45 }, "requestRenderMode": true, "showSun": false, @@ -60,25 +60,5 @@ "key": ["216ee92889e17ab1b083fae665d522b8"], "show": true } - ], - "layers": [ - { - "type": "geojson", - "id": "building", - "url": "http://111.198.10.15:11404/3d/zqBuilding.json", - "symbol": { - "type": "polygonP", - "styleOptions": { - "color": "rgb(52,125,246)", - "outline": false, - "opacity": 0.8 - } - }, - "buildings": { - "height": 100 - }, - "popup": "{name}", - "show": true - } ] } diff --git a/public/config/mars3dConfig.json b/public/config/mars3dConfig.json index 7752593..498d918 100644 --- a/public/config/mars3dConfig.json +++ b/public/config/mars3dConfig.json @@ -1,7 +1,7 @@ { "scene": { "center": { - "lat": "36.48", "lng": "117.48", "alt": 20000, "heading": 360, "pitch": -45 + "lat": "25.675", "lng": "114.875", "alt": 10000, "heading": 360, "pitch": -45 }, "requestRenderMode": true, "showSun": false, @@ -60,25 +60,5 @@ "key": ["216ee92889e17ab1b083fae665d522b8"], "show": true } - ], - "layers": [ - { - "type": "geojson", - "id": "building", - "url": "http://111.198.10.15:11404/3d/zqBuilding.json", - "symbol": { - "type": "polygonP", - "styleOptions": { - "color": "rgb(52,125,246)", - "outline": false, - "opacity": 0.8 - } - }, - "buildings": { - "height": 100 - }, - "popup": "{name}", - "show": true - } ] } diff --git a/public/config/project.config.json b/public/config/project.config.json index 4021326..7c4ca91 100644 --- a/public/config/project.config.json +++ b/public/config/project.config.json @@ -2,8 +2,8 @@ "title": "管网运行监测系统", "subtitle": "", "theme":"blue", - "baseUrl": "http://60.208.121.150:5001/", - "wsUrl": "ws://60.208.121.150:5001/websocket/", + "baseUrl": "http://11.100.6.182:5001/", + "wsUrl": "ws://11.100.6.182:5001/websocket/", "mainPage": "http://111.198.10.15:11404/dcms/#", "amapSecurityCode": "182a2c5889f7fe6d90546d9b8f4781ad", "amapKey": "1733551f35b56f6d8e9c0a9d4c2523b", @@ -17,5 +17,5 @@ "provinceCode":"360000", "cityCode":"361000", "areaCode":"361024", - "arcgisUrl": "http://111.198.10.15:13002/arcgis/rest/services/zq_publish/MapServer/" + "arcgisUrl": "http://111.198.10.15:13002/arcgis/rest/services/gztest/MapServer/" } diff --git a/public/config/mars3dConfig.json b/public/config/mars3dConfig.json index 7752593..498d918 100644 --- a/public/config/mars3dConfig.json +++ b/public/config/mars3dConfig.json @@ -1,7 +1,7 @@ { "scene": { "center": { - "lat": "36.48", "lng": "117.48", "alt": 20000, "heading": 360, "pitch": -45 + "lat": "25.675", "lng": "114.875", "alt": 10000, "heading": 360, "pitch": -45 }, "requestRenderMode": true, "showSun": false, @@ -60,25 +60,5 @@ "key": ["216ee92889e17ab1b083fae665d522b8"], "show": true } - ], - "layers": [ - { - "type": "geojson", - "id": "building", - "url": "http://111.198.10.15:11404/3d/zqBuilding.json", - "symbol": { - "type": "polygonP", - "styleOptions": { - "color": "rgb(52,125,246)", - "outline": false, - "opacity": 0.8 - } - }, - "buildings": { - "height": 100 - }, - "popup": "{name}", - "show": true - } ] } diff --git a/public/config/project.config.json b/public/config/project.config.json index 4021326..7c4ca91 100644 --- a/public/config/project.config.json +++ b/public/config/project.config.json @@ -2,8 +2,8 @@ "title": "管网运行监测系统", "subtitle": "", "theme":"blue", - "baseUrl": "http://60.208.121.150:5001/", - "wsUrl": "ws://60.208.121.150:5001/websocket/", + "baseUrl": "http://11.100.6.182:5001/", + "wsUrl": "ws://11.100.6.182:5001/websocket/", "mainPage": "http://111.198.10.15:11404/dcms/#", "amapSecurityCode": "182a2c5889f7fe6d90546d9b8f4781ad", "amapKey": "1733551f35b56f6d8e9c0a9d4c2523b", @@ -17,5 +17,5 @@ "provinceCode":"360000", "cityCode":"361000", "areaCode":"361024", - "arcgisUrl": "http://111.198.10.15:13002/arcgis/rest/services/zq_publish/MapServer/" + "arcgisUrl": "http://111.198.10.15:13002/arcgis/rest/services/gztest/MapServer/" } diff --git "a/public/static/images/\346\240\207\350\257\206\345\231\250.png" "b/public/static/images/\346\240\207\350\257\206\345\231\250.png" index b5f36b5..72894cd 100644 --- "a/public/static/images/\346\240\207\350\257\206\345\231\250.png" +++ "b/public/static/images/\346\240\207\350\257\206\345\231\250.png" Binary files differ diff --git a/public/config/mars3dConfig.json b/public/config/mars3dConfig.json index 7752593..498d918 100644 --- a/public/config/mars3dConfig.json +++ b/public/config/mars3dConfig.json @@ -1,7 +1,7 @@ { "scene": { "center": { - "lat": "36.48", "lng": "117.48", "alt": 20000, "heading": 360, "pitch": -45 + "lat": "25.675", "lng": "114.875", "alt": 10000, "heading": 360, "pitch": -45 }, "requestRenderMode": true, "showSun": false, @@ -60,25 +60,5 @@ "key": ["216ee92889e17ab1b083fae665d522b8"], "show": true } - ], - "layers": [ - { - "type": "geojson", - "id": "building", - "url": "http://111.198.10.15:11404/3d/zqBuilding.json", - "symbol": { - "type": "polygonP", - "styleOptions": { - "color": "rgb(52,125,246)", - "outline": false, - "opacity": 0.8 - } - }, - "buildings": { - "height": 100 - }, - "popup": "{name}", - "show": true - } ] } diff --git a/public/config/project.config.json b/public/config/project.config.json index 4021326..7c4ca91 100644 --- a/public/config/project.config.json +++ b/public/config/project.config.json @@ -2,8 +2,8 @@ "title": "管网运行监测系统", "subtitle": "", "theme":"blue", - "baseUrl": "http://60.208.121.150:5001/", - "wsUrl": "ws://60.208.121.150:5001/websocket/", + "baseUrl": "http://11.100.6.182:5001/", + "wsUrl": "ws://11.100.6.182:5001/websocket/", "mainPage": "http://111.198.10.15:11404/dcms/#", "amapSecurityCode": "182a2c5889f7fe6d90546d9b8f4781ad", "amapKey": "1733551f35b56f6d8e9c0a9d4c2523b", @@ -17,5 +17,5 @@ "provinceCode":"360000", "cityCode":"361000", "areaCode":"361024", - "arcgisUrl": "http://111.198.10.15:13002/arcgis/rest/services/zq_publish/MapServer/" + "arcgisUrl": "http://111.198.10.15:13002/arcgis/rest/services/gztest/MapServer/" } diff --git "a/public/static/images/\346\240\207\350\257\206\345\231\250.png" "b/public/static/images/\346\240\207\350\257\206\345\231\250.png" index b5f36b5..72894cd 100644 --- "a/public/static/images/\346\240\207\350\257\206\345\231\250.png" +++ "b/public/static/images/\346\240\207\350\257\206\345\231\250.png" Binary files differ diff --git "a/public/static/images/\346\240\207\350\257\206\345\231\2502.png" "b/public/static/images/\346\240\207\350\257\206\345\231\2502.png" new file mode 100644 index 0000000..b5f36b5 --- /dev/null +++ "b/public/static/images/\346\240\207\350\257\206\345\231\2502.png" Binary files differ diff --git a/public/config/mars3dConfig.json b/public/config/mars3dConfig.json index 7752593..498d918 100644 --- a/public/config/mars3dConfig.json +++ b/public/config/mars3dConfig.json @@ -1,7 +1,7 @@ { "scene": { "center": { - "lat": "36.48", "lng": "117.48", "alt": 20000, "heading": 360, "pitch": -45 + "lat": "25.675", "lng": "114.875", "alt": 10000, "heading": 360, "pitch": -45 }, "requestRenderMode": true, "showSun": false, @@ -60,25 +60,5 @@ "key": ["216ee92889e17ab1b083fae665d522b8"], "show": true } - ], - "layers": [ - { - "type": "geojson", - "id": "building", - "url": "http://111.198.10.15:11404/3d/zqBuilding.json", - "symbol": { - "type": "polygonP", - "styleOptions": { - "color": "rgb(52,125,246)", - "outline": false, - "opacity": 0.8 - } - }, - "buildings": { - "height": 100 - }, - "popup": "{name}", - "show": true - } ] } diff --git a/public/config/project.config.json b/public/config/project.config.json index 4021326..7c4ca91 100644 --- a/public/config/project.config.json +++ b/public/config/project.config.json @@ -2,8 +2,8 @@ "title": "管网运行监测系统", "subtitle": "", "theme":"blue", - "baseUrl": "http://60.208.121.150:5001/", - "wsUrl": "ws://60.208.121.150:5001/websocket/", + "baseUrl": "http://11.100.6.182:5001/", + "wsUrl": "ws://11.100.6.182:5001/websocket/", "mainPage": "http://111.198.10.15:11404/dcms/#", "amapSecurityCode": "182a2c5889f7fe6d90546d9b8f4781ad", "amapKey": "1733551f35b56f6d8e9c0a9d4c2523b", @@ -17,5 +17,5 @@ "provinceCode":"360000", "cityCode":"361000", "areaCode":"361024", - "arcgisUrl": "http://111.198.10.15:13002/arcgis/rest/services/zq_publish/MapServer/" + "arcgisUrl": "http://111.198.10.15:13002/arcgis/rest/services/gztest/MapServer/" } diff --git "a/public/static/images/\346\240\207\350\257\206\345\231\250.png" "b/public/static/images/\346\240\207\350\257\206\345\231\250.png" index b5f36b5..72894cd 100644 --- "a/public/static/images/\346\240\207\350\257\206\345\231\250.png" +++ "b/public/static/images/\346\240\207\350\257\206\345\231\250.png" Binary files differ diff --git "a/public/static/images/\346\240\207\350\257\206\345\231\2502.png" "b/public/static/images/\346\240\207\350\257\206\345\231\2502.png" new file mode 100644 index 0000000..b5f36b5 --- /dev/null +++ "b/public/static/images/\346\240\207\350\257\206\345\231\2502.png" Binary files differ diff --git "a/public/static/images/\346\266\210\351\230\262\346\240\223\351\230\262\347\233\227\346\260\264\347\233\221\346\265\213\344\273\252.png" "b/public/static/images/\346\266\210\351\230\262\346\240\223\351\230\262\347\233\227\346\260\264\347\233\221\346\265\213\344\273\252.png" new file mode 100644 index 0000000..6efac42 --- /dev/null +++ "b/public/static/images/\346\266\210\351\230\262\346\240\223\351\230\262\347\233\227\346\260\264\347\233\221\346\265\213\344\273\252.png" Binary files differ diff --git a/public/config/mars3dConfig.json b/public/config/mars3dConfig.json index 7752593..498d918 100644 --- a/public/config/mars3dConfig.json +++ b/public/config/mars3dConfig.json @@ -1,7 +1,7 @@ { "scene": { "center": { - "lat": "36.48", "lng": "117.48", "alt": 20000, "heading": 360, "pitch": -45 + "lat": "25.675", "lng": "114.875", "alt": 10000, "heading": 360, "pitch": -45 }, "requestRenderMode": true, "showSun": false, @@ -60,25 +60,5 @@ "key": ["216ee92889e17ab1b083fae665d522b8"], "show": true } - ], - "layers": [ - { - "type": "geojson", - "id": "building", - "url": "http://111.198.10.15:11404/3d/zqBuilding.json", - "symbol": { - "type": "polygonP", - "styleOptions": { - "color": "rgb(52,125,246)", - "outline": false, - "opacity": 0.8 - } - }, - "buildings": { - "height": 100 - }, - "popup": "{name}", - "show": true - } ] } diff --git a/public/config/project.config.json b/public/config/project.config.json index 4021326..7c4ca91 100644 --- a/public/config/project.config.json +++ b/public/config/project.config.json @@ -2,8 +2,8 @@ "title": "管网运行监测系统", "subtitle": "", "theme":"blue", - "baseUrl": "http://60.208.121.150:5001/", - "wsUrl": "ws://60.208.121.150:5001/websocket/", + "baseUrl": "http://11.100.6.182:5001/", + "wsUrl": "ws://11.100.6.182:5001/websocket/", "mainPage": "http://111.198.10.15:11404/dcms/#", "amapSecurityCode": "182a2c5889f7fe6d90546d9b8f4781ad", "amapKey": "1733551f35b56f6d8e9c0a9d4c2523b", @@ -17,5 +17,5 @@ "provinceCode":"360000", "cityCode":"361000", "areaCode":"361024", - "arcgisUrl": "http://111.198.10.15:13002/arcgis/rest/services/zq_publish/MapServer/" + "arcgisUrl": "http://111.198.10.15:13002/arcgis/rest/services/gztest/MapServer/" } diff --git "a/public/static/images/\346\240\207\350\257\206\345\231\250.png" "b/public/static/images/\346\240\207\350\257\206\345\231\250.png" index b5f36b5..72894cd 100644 --- "a/public/static/images/\346\240\207\350\257\206\345\231\250.png" +++ "b/public/static/images/\346\240\207\350\257\206\345\231\250.png" Binary files differ diff --git "a/public/static/images/\346\240\207\350\257\206\345\231\2502.png" "b/public/static/images/\346\240\207\350\257\206\345\231\2502.png" new file mode 100644 index 0000000..b5f36b5 --- /dev/null +++ "b/public/static/images/\346\240\207\350\257\206\345\231\2502.png" Binary files differ diff --git "a/public/static/images/\346\266\210\351\230\262\346\240\223\351\230\262\347\233\227\346\260\264\347\233\221\346\265\213\344\273\252.png" "b/public/static/images/\346\266\210\351\230\262\346\240\223\351\230\262\347\233\227\346\260\264\347\233\221\346\265\213\344\273\252.png" new file mode 100644 index 0000000..6efac42 --- /dev/null +++ "b/public/static/images/\346\266\210\351\230\262\346\240\223\351\230\262\347\233\227\346\260\264\347\233\221\346\265\213\344\273\252.png" Binary files differ diff --git a/src/components/Mars3D/utils/GeoJsonLayer.js b/src/components/Mars3D/utils/GeoJsonLayer.js index 4c8f784..2a822c9 100644 --- a/src/components/Mars3D/utils/GeoJsonLayer.js +++ b/src/components/Mars3D/utils/GeoJsonLayer.js @@ -225,3 +225,49 @@ }) return layer3D } + + +export async function createModelLayerAsync(index, name, model = '', scale, condition) { + const queryServer = new mars3d.query.QueryArcServer({ + url: Vue.prototype.baseConfig.arcgisUrl + index, + popup: 'all', + pageSize: 8000 + }) + const layer3D = new mars3d.layer.GraphicLayer({ + name: name + }).bindPopup(function(event) { + const attr = event.graphic.attr || {} + return mars3d.Util.getTemplateHtml({ template: 'all', attr: attr }) + }) + window.map.addLayer(layer3D) + layer3D.show = false + await queryServer.query({ + where: condition, + success: (result) => { + if (result.count === 0) { + console.log('未查询到相关记录!') + } + if (model !== '') { + const points = [] + result.geojson.features.forEach(item => { + points.push({ + position: [item.geometry.coordinates[0], item.geometry.coordinates[1], 0], + style: { + scale: scale + }, + attr: item.properties + }) + }) + const modelCombine = new mars3d.graphic.ModelCombine({ + url: model, + instances: points + }) + layer3D.addGraphic(modelCombine) + } + }, + error: (error, msg) => { + console.log('服务访问错误,' + error) + } + }) + return layer3D +} diff --git a/public/config/mars3dConfig.json b/public/config/mars3dConfig.json index 7752593..498d918 100644 --- a/public/config/mars3dConfig.json +++ b/public/config/mars3dConfig.json @@ -1,7 +1,7 @@ { "scene": { "center": { - "lat": "36.48", "lng": "117.48", "alt": 20000, "heading": 360, "pitch": -45 + "lat": "25.675", "lng": "114.875", "alt": 10000, "heading": 360, "pitch": -45 }, "requestRenderMode": true, "showSun": false, @@ -60,25 +60,5 @@ "key": ["216ee92889e17ab1b083fae665d522b8"], "show": true } - ], - "layers": [ - { - "type": "geojson", - "id": "building", - "url": "http://111.198.10.15:11404/3d/zqBuilding.json", - "symbol": { - "type": "polygonP", - "styleOptions": { - "color": "rgb(52,125,246)", - "outline": false, - "opacity": 0.8 - } - }, - "buildings": { - "height": 100 - }, - "popup": "{name}", - "show": true - } ] } diff --git a/public/config/project.config.json b/public/config/project.config.json index 4021326..7c4ca91 100644 --- a/public/config/project.config.json +++ b/public/config/project.config.json @@ -2,8 +2,8 @@ "title": "管网运行监测系统", "subtitle": "", "theme":"blue", - "baseUrl": "http://60.208.121.150:5001/", - "wsUrl": "ws://60.208.121.150:5001/websocket/", + "baseUrl": "http://11.100.6.182:5001/", + "wsUrl": "ws://11.100.6.182:5001/websocket/", "mainPage": "http://111.198.10.15:11404/dcms/#", "amapSecurityCode": "182a2c5889f7fe6d90546d9b8f4781ad", "amapKey": "1733551f35b56f6d8e9c0a9d4c2523b", @@ -17,5 +17,5 @@ "provinceCode":"360000", "cityCode":"361000", "areaCode":"361024", - "arcgisUrl": "http://111.198.10.15:13002/arcgis/rest/services/zq_publish/MapServer/" + "arcgisUrl": "http://111.198.10.15:13002/arcgis/rest/services/gztest/MapServer/" } diff --git "a/public/static/images/\346\240\207\350\257\206\345\231\250.png" "b/public/static/images/\346\240\207\350\257\206\345\231\250.png" index b5f36b5..72894cd 100644 --- "a/public/static/images/\346\240\207\350\257\206\345\231\250.png" +++ "b/public/static/images/\346\240\207\350\257\206\345\231\250.png" Binary files differ diff --git "a/public/static/images/\346\240\207\350\257\206\345\231\2502.png" "b/public/static/images/\346\240\207\350\257\206\345\231\2502.png" new file mode 100644 index 0000000..b5f36b5 --- /dev/null +++ "b/public/static/images/\346\240\207\350\257\206\345\231\2502.png" Binary files differ diff --git "a/public/static/images/\346\266\210\351\230\262\346\240\223\351\230\262\347\233\227\346\260\264\347\233\221\346\265\213\344\273\252.png" "b/public/static/images/\346\266\210\351\230\262\346\240\223\351\230\262\347\233\227\346\260\264\347\233\221\346\265\213\344\273\252.png" new file mode 100644 index 0000000..6efac42 --- /dev/null +++ "b/public/static/images/\346\266\210\351\230\262\346\240\223\351\230\262\347\233\227\346\260\264\347\233\221\346\265\213\344\273\252.png" Binary files differ diff --git a/src/components/Mars3D/utils/GeoJsonLayer.js b/src/components/Mars3D/utils/GeoJsonLayer.js index 4c8f784..2a822c9 100644 --- a/src/components/Mars3D/utils/GeoJsonLayer.js +++ b/src/components/Mars3D/utils/GeoJsonLayer.js @@ -225,3 +225,49 @@ }) return layer3D } + + +export async function createModelLayerAsync(index, name, model = '', scale, condition) { + const queryServer = new mars3d.query.QueryArcServer({ + url: Vue.prototype.baseConfig.arcgisUrl + index, + popup: 'all', + pageSize: 8000 + }) + const layer3D = new mars3d.layer.GraphicLayer({ + name: name + }).bindPopup(function(event) { + const attr = event.graphic.attr || {} + return mars3d.Util.getTemplateHtml({ template: 'all', attr: attr }) + }) + window.map.addLayer(layer3D) + layer3D.show = false + await queryServer.query({ + where: condition, + success: (result) => { + if (result.count === 0) { + console.log('未查询到相关记录!') + } + if (model !== '') { + const points = [] + result.geojson.features.forEach(item => { + points.push({ + position: [item.geometry.coordinates[0], item.geometry.coordinates[1], 0], + style: { + scale: scale + }, + attr: item.properties + }) + }) + const modelCombine = new mars3d.graphic.ModelCombine({ + url: model, + instances: points + }) + layer3D.addGraphic(modelCombine) + } + }, + error: (error, msg) => { + console.log('服务访问错误,' + error) + } + }) + return layer3D +} diff --git a/src/views/overview/overview3d.vue b/src/views/overview/overview3d.vue index 84b9615..12a2eea 100644 --- a/src/views/overview/overview3d.vue +++ b/src/views/overview/overview3d.vue @@ -3,8 +3,8 @@
-
- +
+ {{item}}
@@ -52,13 +52,17 @@ import { breadcrumb } from '@/settings' import { RSAencrypt } from '@/utils/security' import {polylineC, polylineVolumeP} from "@/components/Mars3D/utils/ArcGisWfsLayer"; -import {createPointModelLayer, createModelLayer, createPointLayer} from "@/components/Mars3D/utils/GeoJsonLayer"; +import { + createPointModelLayer, + createModelLayer, + createPointLayer, createModelLayerAsync +} from "@/components/Mars3D/utils/GeoJsonLayer"; +import {Tetrahedron} from "@/components/Mars3D/utils/GraphicLayer"; const line_layer = [] const line_layer_3D = [] let point_layer_3D = [] let dev_layer = [] -const dev_layer_3D = [] const wellLoc = {} let underground = null let alarm_layer = null @@ -67,13 +71,14 @@ components: { Mars3dMap, MapSearchComp, PopupLocation, PopupDataFilter, ToolBox, AlarmList }, data() { return { + showAllWells: false, initWell: false, // 是否初始化井信息 showLine: true, basemap: 1113, colors: ['#7f0000', '#804000', '#ff7fe9', '#ff7fe9', '#00bfff', '#00ff00', '#ff0000', '#00ff00', '#ff0000'], layerName: - ['雨水管线', '污水管线', '天然气管线', '燃气管线', '给水管线', '电信管线', '电力管线', '通信管线','路灯管线', - '标识器', '井盖状态监测仪', '燃气智能监测', '消防栓防盗水', '液位监测仪', '噪声记录仪'], + ['雨水管线', '污水管线', '燃气管线','路灯管线', '给水管线', '电信管线', '电力管线', + '井盖状态监测仪', '燃气智能监测终端', '消防栓防盗水监测仪', '液位监测仪', '噪声记录仪'], baseLayer: 'gaode_vec', // 底图图层 layers: [{ id: 'line', name: '管线图层', children: [] }, { id: 'dev', name: '设备图层', children: [] }, { id: 'alarm', name: '报警图层' }], // 图层列表 checkedLayer: [], // 选中的图层 @@ -204,21 +209,21 @@ window.map.addThing(underground) alarm_layer = new mars3d.layer.GraphicLayer({ name: '报警图层' }) window.map.addLayer(alarm_layer) - this.initLine() + // this.initLine() this.initPoint() window.map.on(mars3d.EventType.cameraChanged, this.cameraChange, this) - this.mapLoading = false }, async initLine() { - for (let i = 0; i <= 8; i++) { + for (let i = 1; i <= 6; i++) { // 三维管线 - line_layer_3D.push(polylineVolumeP(i+8, this.colors[i], this.layerName[i], 0.1, -1.5)) + line_layer_3D.push(polylineVolumeP(i + 6, this.colors[i], this.layerName[i], 0.1, -1.5)) // 二维管线 - line_layer.push(polylineC(i+8, this.colors[i], this.layerName[i], 3)) + line_layer.push(polylineC(i + 6, this.colors[i], this.layerName[i], 3)) } }, - async initPoint(condition = '') { - const layerName = ['雨水附属物', '污水附属物', '天然气附属物', '燃气附属物', '给水附属物', '电信附属物', '电力附属物'] + async initPoint(condition = '', isDev = false) { + const layerName = ['雨水附属物', '污水附属物', '燃气附属物', '给水附属物', '电信附属物', '电力附属物'] + // 删原有的 if (point_layer_3D.length !== 0) { point_layer_3D.forEach(item => window.map.removeLayer(item)) } @@ -228,15 +233,32 @@ dev_layer.forEach(item => window.map.removeLayer(item)) } dev_layer = [] + + // 筛选条件 const str = condition === '' ? '1<>1' : "编号 LIKE '%" + condition + "%' or 附属物名称 LIKE '%" + condition + "%' or 所属道路 LIKE '%" + condition + "%'" const bsq = condition === '' ? '1<>1' : "编号 LIKE '%" + condition + "%' or 对象名称 LIKE '%" + condition + "%' or 所属道路 LIKE '%" + condition + "%'" - - dev_layer.push(createPointLayer('标识器', 7, '../static/images/标识器.png', bsq)) - - for (let i = 0; i <= 7; i++) { - point_layer_3D.push(createModelLayer(i, layerName[i], '../static/model/ys.gltf', 1.5, str)) + for (let i = 0; i <= 5; i++) { + point_layer_3D.push(await createModelLayerAsync(i, layerName[i], '../static/model/ys.gltf', 1.5, str)) } + // if(isDev){ + // dev_layer.push(createPointLayer('标识器', 7, '../static/images/标识器.png', bsq)) + // } this.mapReady() + // const that = this + // setTimeout(function(){ + // that.mapReady() + // }, 1000) + }, + async initLineLayer(name){ + let i = this.layerName.indexOf(name) + // 三维管线 + line_layer_3D.push(polylineVolumeP(i + 6, this.colors[i], name, 0.1, -1.5)) + // 二维管线 + line_layer.push(polylineC(i + 6, this.colors[i], name, 3)) + + }, + async initDevLayer(name){ + dev_layer.push(createPointLayer(name, this.layerName.indexOf(name) + 6, '../static/images/'+ name + '.png', '1<>1')) }, cameraChange() { // console.log('map-level:' + window.map.level) @@ -245,6 +267,7 @@ if(this.alpha <= 80 && window.map.level > 19){ const lineTypes = this.checkedLayer.filter(item => item.indexOf('line-') > -1).map(item => item.substring(5)) const wellTypes = lineTypes.map(item => item.replace('管线','附属物')) + wellTypes.splice(3,1) // 显示三维井 point_layer_3D.forEach(layer => { layer.show = wellTypes.indexOf(layer.options.name) > -1 }) // 显示三维管线 @@ -271,6 +294,7 @@ this.fetchWellList() // 加载全部井 this.firstAmount = true this.toolShow = true + this.mapLoading = false // if (this.refreshType === 'clock') { // 如果需要倒计时刷新的 setTimeout(() => { this.countDown() }, 1000) // } @@ -299,16 +323,30 @@ const lineTypes = checkedLayer.filter(item => item.indexOf('line-') > -1).map(item => item.substring(5)) const wellTypes = lineTypes.map(item => item.replace('管线','附属物')) + const devTypes = checkedLayer.filter(item => item.indexOf('dev-') > -1).map(item => item.substring(4)) // 点 point_layer_3D.forEach(layer => { layer.show = wellTypes.indexOf(layer.options.name) > -1 }) + // 线 line_layer.forEach(layer => { layer.show = lineTypes.indexOf(layer.options.name) > -1 }) line_layer_3D.forEach(layer => { layer.show = lineTypes.indexOf(layer.options.name) > -1 }) + let line_layer_name = line_layer.map( item => item.options.name ) + lineTypes.forEach(type => { + if(line_layer_name.indexOf(type) <= -1){ + this.initLineLayer(type) + } + }) + // 2.选中or没选中设备图层 - const devTypes = checkedLayer.filter(item => item.indexOf('dev-') > -1).map(item => item.substring(4)) dev_layer.forEach(layer => { layer.show = devTypes.indexOf(layer.options.name) > -1 }) + let dev_layer_name = dev_layer.map( item => item.options.name ) + devTypes.forEach(type => { + if(dev_layer_name.indexOf(type) <= -1){ + this.initDevLayer(type) + } + }) // 3.选中or没选中报警图层 checkedLayer.indexOf('alarm') !== -1 ? alarm_layer.show = true : alarm_layer.show = false @@ -345,7 +383,7 @@ id: 'line-' + item, name: item } - }).splice(0, 9) + }).splice(0, 7) } const devLayer = { id: 'dev', @@ -355,12 +393,12 @@ id: 'dev-' + item, name: item } - }).splice(9, 6) + }).splice(7, 5) } this.layers.splice(0, 1, lineLayer) this.layers.splice(1, 1, devLayer) - if (this.baseConfig.showAllWells) { + if (this.showAllWells) { this.checkedLayer = ['line', 'dev'] lineLayer.children.forEach(item => this.checkedLayer.push('line-' + item.name)) lineLayer.children.forEach(item => this.checkedLayer.push('dev-' + item.name)) @@ -422,41 +460,22 @@ // this.center = marker.lnglat // this.openInfoWindow(marker.wellId, marker.lnglat, this.searchResultOffset[1]) }, - // 过滤海量点,给markers赋visible值 - filterMassMarker(listQuery, showMessage = false) { - const hideWellIds = []// 要隐藏的点位编号 - let center = [] // 待移动到的地图中心 - // 2. 整理查询条件 - const keywords = listQuery.keywords // 关键字 - const wellTypes = listQuery.wellTypes ? listQuery.wellTypes : listQuery.wellType ? [listQuery.wellType] : [] // 点位类型 - let deptids = [] // 所有权属 - if (listQuery.deptid) { - deptids = this.fetchDeptList(listQuery.deptid) // 获取所有下级 + // 在附属物图层里查设备 + searchWellLayer(wellCode){ + // *********************************测试wellCode********************************* + wellCode = 'GX_YSD_4001_BJNDD_104' + let point = undefined + for (let i = 0; i < point_layer_3D.length; i++) + { + point = point_layer_3D[i].graphics[0].options.instances.filter(well => { + return well.attr.编号 === wellCode + })[0] + if (point !== undefined) { + return point + } } - // 3.查询全部井,是否匹配,只要有一项不匹配则show为false - for (const marker of this.markers) { - let show = true - // 关键字不为空,且没有匹配成功,不显示, 关键字匹配点位编号和位置 - if (keywords && keywords !== '' && !(marker.wellCode.indexOf(keywords) !== -1 || marker.position.indexOf(keywords) !== -1)) { - show = false - } - // 部门不为空, 且没有匹配成功,多部门匹配 - if (deptids.length > 0 && deptids.indexOf(marker.deptid) === -1) { - show = false - } - // 点位类型不为空,且没有匹配成功 - if (wellTypes && wellTypes.length > 0 && wellTypes.indexOf(marker.wellType) === -1) { - show = false - } - // 如果show为false,放入需要隐藏的井id列表 - if (show === false) { - hideWellIds.push(marker.wellId) - } else { - center = marker.lnglat - } - marker.visible = show - } - this.resetMassMarker() + console.log(point) + return undefined }, // 刷新报警列表 refreshAlarm() { @@ -467,6 +486,7 @@ if (this.showAlarm && this.checkedLayer.indexOf('alarm') == -1) { this.checkedLayer.push('alarm') } + alarm_layer.closePopup().clear() getAlarmsNow().then(response => { if (response.code === 200) { this.loading = false @@ -485,24 +505,73 @@ } this.alarmFirstAmount = false // 初次加载完毕 // 获取当前报警列表 - this.alarmListOri = response.data // 列表原始 this.alarmList = response.data // 要显示的报警列表 this.alarmWells = [] // 报警的井列表 for (const alarm of response.data) { if (this.alarmWells.findIndex(item => item.wellCode === alarm.wellCode) == -1) { - this.alarmWells.push({ - wellCode: alarm.wellCode, - wellId: alarm.wellId, - wellType: alarm.wellType, - lngGaode: alarm.lngGaode, - latGaode: alarm.latGaode, - coordinates: [alarm.lngGaode, alarm.latGaode], - position: alarm.position, - visible: true - }) + this.alarmWells.push(alarm) } } console.log('alarmWells Length', this.alarmWells.length) + this.alarmWells.forEach(item => { + const point = this.searchWellLayer(item.wellCode) + if (point !== undefined) { + const attr = point.attr || {} + attr['报警内容'] = item.alarmContent + attr['报警数值'] = item.alarmValue + attr['报警时间'] = item.alarmTime + + var str = `
` + for (const j in attr) { + if (j === 'FID') continue + str += `
+ + ${attr[j]}
` + } + str += `
` + + const primitive = new mars3d.graphic.BillboardPrimitive({ + allowDrillPick: true, + attr: attr, + id: "alarm-" + attr.编号, + position: [attr.经度,attr.纬度], + style: { + image: '../static/images/alarm.png', + scale: 0.6, + hasPixelOffset: true, + pixelOffsetY: -10, + scaleByDistance: true, + scaleByDistance_far: 20000, + scaleByDistance_farValue: 0.6, + scaleByDistance_near: 0, + scaleByDistance_nearValue: 1.4 + }, + flyTo: true + }) + primitive.bindPopup(str) + alarm_layer.addGraphic(primitive) + + + + + //Tetrahedron(alarm_layer, [attr.经度,attr.纬度], attr) + // point.setStyle({ + // image: '../static/images/alarm.png', + // scale: 0.8, + // hasPixelOffset: true, + // pixelOffsetY: -20, + // scaleByDistance: true, + // scaleByDistance_far: 20000, + // scaleByDistance_farValue: 0.8, + // scaleByDistance_near: 0, + // scaleByDistance_nearValue: 1.6, + // visibleDepth: false + // }).unbindHighlight() + // point.unbindPopup() + // point.bindPopup(str) + // this.initAlarmPoint(point, item) + } + }) } }) },