From 19725c3f47412a6003bc98f4c7168a737a55319b Mon Sep 17 00:00:00 2001 From: surprise <15810472099@163.com> Date: 星期四, 18 四月 2024 15:57:16 +0800 Subject: [PATCH] Merge branch 'master' of http://192.168.11.205:9000/r/wxdDemo --- src/utils/work.js | 2669 ++++++++++++++++++++++++++++++++--------------------------- 1 files changed, 1,448 insertions(+), 1,221 deletions(-) diff --git a/src/utils/work.js b/src/utils/work.js index 0666a17..2a7bbf4 100644 --- a/src/utils/work.js +++ b/src/utils/work.js @@ -1,1270 +1,1497 @@ import request from '@/api/request' import bus from './bus' -import { intensity, getbounds, createPic, picurl } from "@/api/http"; -import { Message, Loading } from 'element-ui'; -import data from "../utils/data.json" +import { intensity, getbounds, createPic, picurl } from '@/api/http' +import { Message, Loading } from 'element-ui' +import data from '../utils/data.json' +// 鐧借啘 +export function loadBaimo (num) { + // 涓婃捣灏忛潰绉櫧鑶� + let url1 = 'http://183.162.245.49:8099/SHdata/SH_CLIP_BM/tileset.json' + let url12 = 'http://183.162.245.49:8099/SHdata/LJZ_JM_BM1/tileset.json' + // 骞垮窞绮炬ā 2 3 4 + let url2 = 'http://183.162.245.49:82/SG/b3dm/part1.412787/tileset.json' + let url3 = 'http://183.162.245.49:82/SG/b3dm/_3.412788/tileset.json' + let url4 = 'http://183.162.245.49:82/SG/b3dm/_2.413191/tileset.json' -//鐧借啘 -export function loadBaimo(num) { - //涓婃捣灏忛潰绉櫧鑶� - let url1 = "http://183.162.245.49:8099/SHdata/SH_CLIP_BM/tileset.json" - let url12 = "http://183.162.245.49:8099/SHdata/LJZ_JM_BM1/tileset.json" + let url6 = 'http://183.162.245.49:8099/SHdata/GZ_BM_3DTILE1/tileset.json' // 骞垮窞鐧借啘 - //骞垮窞绮炬ā 2 3 4 - let url2 = "http://183.162.245.49:82/SG/b3dm/part1.412787/tileset.json" - let url3 = "http://183.162.245.49:82/SG/b3dm/_3.412788/tileset.json" - let url4 = "http://183.162.245.49:82/SG/b3dm/_2.413191/tileset.json" + let url7 = 'http://183.162.245.49:8099/SHdata/LJZJM3DTILES/tileset.json' // 涓婃捣鎵嬪伐绮炬ā - let url6 = "http://183.162.245.49:8099/SHdata/GZ_BM_3DTILE1/tileset.json"//骞垮窞鐧借啘 + let url8 = + 'http://183.162.245.49:8099/SHdata/SHQX_3dtiles/3dtiles/tileset.json' // 椋為涓婃捣鍊炬枩 + let url9 = 'http://183.162.245.49:8099/SHdata/GZ_TH_3DTILE/tileset.json' // 骞垮窞绮炬ā(澶╂渤) + let url10 = 'http://183.162.245.49:8099/SHdata/GZ_fujia_2/tileset.json' // 骞垮窞绮炬ā(澶╂渤) + let url11 = 'http://183.162.245.49:8099/SHdata/GZ_fujia_3/tileset.json' // 骞垮窞绮炬ā(澶╂渤) - let url7 = "http://183.162.245.49:8099/SHdata/LJZJM3DTILES/tileset.json"//涓婃捣鎵嬪伐绮炬ā + let url13 = 'http://183.162.245.49:8099/SHdata/SH_CJ/tileset.json' - - let url8 = "http://183.162.245.49:8099/SHdata/SHQX_3dtiles/3dtiles/tileset.json"//椋為涓婃捣鍊炬枩 - - - let url9 = "http://183.162.245.49:8099/SHdata/GZ_TH_3DTILE/tileset.json"//骞垮窞绮炬ā(澶╂渤) - let url10 = "http://183.162.245.49:8099/SHdata/GZ_fujia_2/tileset.json"//骞垮窞绮炬ā(澶╂渤) - let url11 = "http://183.162.245.49:8099/SHdata/GZ_fujia_3/tileset.json"//骞垮窞绮炬ā(澶╂渤) - - let url13 = "http://183.162.245.49:8099/SHdata/SH_CJ/tileset.json" - - switch (num) { - case 1: - window.model1 = sgworld.Creator.create3DTilesets("", url1, {}, { - }, "0", true, (data) => { - }); - window.model12 = sgworld.Creator.create3DTilesets("", url12, {}, { - - }, "0", true, (data) => { - }); - break; - case 2: - window.model8 = sgworld.Creator.create3DTilesets("", url8, {}, { - }, "0", true, (data) => { - }); - break; - case 3: - window.model7 = sgworld.Creator.create3DTilesets("", url7, {}, { - }, "0", true, (data) => { - }); - break; - case 4: - window.model9 = sgworld.Creator.create3DTilesets("", url9, {}, { - }, "0", true, (data) => { - }); - window.model10 = sgworld.Creator.create3DTilesets("", url10, {}, { - }, "0", true, (data) => { - }); - window.model11 = sgworld.Creator.create3DTilesets("", url11, {}, { - }, "0", true, (data) => { - }); - break; - case 5: - window.model2 = sgworld.Creator.create3DTilesets("", url2, {}, { - }, "0", true, (data) => { - }); - window.model3 = sgworld.Creator.create3DTilesets("", url3, {}, { - }, "0", true, (data) => { - }); - window.model4 = sgworld.Creator.create3DTilesets("", url4, {}, { - }, "0", true, (data) => { - }); - break; - case 6: - window.model6 = sgworld.Creator.create3DTilesets("", url6, {}, { - - }, "0", true, (data) => { - }); - break; - case 7: - window.model13 = sgworld.Creator.create3DTilesets("", url13, {}, { - edit: { - height: 0 - } - }, "0", true, (data) => { - }); - break; - default: - break; - } - //鍒濆娣诲姞娉ㄨ - + switch (num) { + case 1: + window.model1 = sgworld.Creator.create3DTilesets( + '', + url1, + {}, + {}, + '0', + true, + data => {} + ) + window.model12 = sgworld.Creator.create3DTilesets( + '', + url12, + {}, + {}, + '0', + true, + data => {} + ) + break + case 2: + window.model8 = sgworld.Creator.create3DTilesets( + '', + url8, + {}, + {}, + '0', + true, + data => {} + ) + break + case 3: + window.model7 = sgworld.Creator.create3DTilesets( + '', + url7, + {}, + {}, + '0', + true, + data => {} + ) + break + case 4: + window.model9 = sgworld.Creator.create3DTilesets( + '', + url9, + {}, + {}, + '0', + true, + data => {} + ) + window.model10 = sgworld.Creator.create3DTilesets( + '', + url10, + {}, + {}, + '0', + true, + data => {} + ) + window.model11 = sgworld.Creator.create3DTilesets( + '', + url11, + {}, + {}, + '0', + true, + data => {} + ) + break + case 5: + window.model2 = sgworld.Creator.create3DTilesets( + '', + url2, + {}, + {}, + '0', + true, + data => {} + ) + window.model3 = sgworld.Creator.create3DTilesets( + '', + url3, + {}, + {}, + '0', + true, + data => {} + ) + window.model4 = sgworld.Creator.create3DTilesets( + '', + url4, + {}, + {}, + '0', + true, + data => {} + ) + break + case 6: + window.model6 = sgworld.Creator.create3DTilesets( + '', + url6, + {}, + {}, + '0', + true, + data => {} + ) + break + case 7: + window.model13 = sgworld.Creator.create3DTilesets( + '', + url13, + {}, + { + edit: { + height: 0 + } + }, + '0', + true, + data => {} + ) + break + default: + break + } + // 鍒濆娣诲姞娉ㄨ } -//姘寸郴 -//鐐� +// 姘寸郴 +// 鐐� window.deleteObj = [] -export function loaddian(urls, name, height) { - var data = { - font_family: "寰蒋闆呴粦", - font_size: 16, - pointHeight: height, - showBackground: true, - text: name, - fillColor: "#00ffff", - outlineColor: "#000000", - outlineWidth: 2, - disableDepthTestDistance: Infinity, - near: 0, - far: 2000, - }; - let dx = sgworld.Creator.createLabelPointGeoJsonFeatureLayer("", urls, data, "0", true) - // - window.deleteObj.push(dx) - +export function loaddian (urls, name, height) { + var data = { + font_family: '寰蒋闆呴粦', + font_size: 16, + pointHeight: height, + showBackground: true, + text: name, + fillColor: '#00ffff', + outlineColor: '#000000', + outlineWidth: 2, + disableDepthTestDistance: Infinity, + near: 0, + far: 2000 + } + let dx = sgworld.Creator.createLabelPointGeoJsonFeatureLayer( + '', + urls, + data, + '0', + true + ) + // + window.deleteObj.push(dx) } -//璺綉 -export function loadLW() { - var urls = "http://183.162.245.49:8099/gisserver/tmsserver/SH_peitu" - var layer = sgworld.Creator.createUrlTemplateImageryProvider('tms鏈嶅姟', { - url: Cesium.buildModuleUrl(urls + "/{z}/{x}/{reverseY}.png"), - Level: 15 - }, '0', undefined, true, ""); - var urls1 = "http://183.162.245.49:8099//gisserver/tmsserver/SH_sj" - var layer1 = sgworld.Creator.createUrlTemplateImageryProvider('tms鏈嶅姟', { - url: Cesium.buildModuleUrl(urls1 + "/{z}/{x}/{reverseY}.png"), - Level: 6 - }, '0', undefined, true, ""); +// 璺綉 +export function loadLW () { + var urls = 'http://183.162.245.49:8099/gisserver/tmsserver/SH_peitu' + var layer = sgworld.Creator.createUrlTemplateImageryProvider( + 'tms鏈嶅姟', + { + url: Cesium.buildModuleUrl(urls + '/{z}/{x}/{reverseY}.png'), + Level: 15 + }, + '0', + undefined, + true, + '' + ) + var urls1 = 'http://183.162.245.49:8099//gisserver/tmsserver/SH_sj' + var layer1 = sgworld.Creator.createUrlTemplateImageryProvider( + 'tms鏈嶅姟', + { + url: Cesium.buildModuleUrl(urls1 + '/{z}/{x}/{reverseY}.png'), + Level: 6 + }, + '0', + undefined, + true, + '' + ) } -//鑱氬悎鏁堟灉 -export function juhe(params, name) { - var url; - var billboardImage; - var jhtype; - var dataSource; - if (name === "鐩戞祴绔�") { - url = "http://221.224.53.36:9080/gis/monitor/stations"; - billboardImage = "./static/img/jcz.png"; - jhtype = 'GET'; - dataSource = new Cesium.CustomDataSource("jcz"); - } else if (name === "绯荤粺鍙扮珯") { - url = "http://221.224.53.36:9080/map/searchRsbtStn"; - billboardImage = "./static/img/blue.png"; - jhtype = 'POST'; - dataSource = new Cesium.CustomDataSource("xttz"); - } else if (name === "娴嬭瘯鍙扮珯") { - } - if (!params) { - if (name === "绯荤粺鍙扮珯") { - var ds = viewer.dataSources.getByName("xttz"); - if (ds.length > 0) { - for (var i = 0; i < ds.length; i++) { - viewer.dataSources.remove(ds[i]); - } - } - if (window.modelList1.length > 0) { - for (var j = 0; j < window.modelList1.length; j++) { - window.modelList1[j].deleteObject(); - } - } - } else if (name === "鐩戞祴绔�") { - var jcz = viewer.dataSources.getByName("jcz"); - if (jcz.length > 0) { - for (var i = 0; i < jcz.length; i++) { - viewer.dataSources.remove(jcz[i]); - } - } - if (window.modelList.length > 0) { - for (var j = 0; j < window.modelList.length; j++) { - window.modelList[j].deleteObject(); - } - } +// 鑱氬悎鏁堟灉 +export function juhe (params, name) { + var url + var billboardImage + var jhtype + var dataSource + if (name === '鐩戞祴绔�') { + url = 'http://221.224.53.36:9080/gis/monitor/stations' + billboardImage = './static/img/jcz.png' + jhtype = 'GET' + dataSource = new Cesium.CustomDataSource('jcz') + } else if (name === '绯荤粺鍙扮珯') { + url = 'http://221.224.53.36:9080/map/searchRsbtStn' + billboardImage = './static/img/blue.png' + jhtype = 'POST' + dataSource = new Cesium.CustomDataSource('xttz') + } else if (name === '娴嬭瘯鍙扮珯') { + } + if (!params) { + if (name === '绯荤粺鍙扮珯') { + var ds = viewer.dataSources.getByName('xttz') + if (ds.length > 0) { + for (var i = 0; i < ds.length; i++) { + viewer.dataSources.remove(ds[i]) } - - } else { - - var dataSourcePromise = viewer.dataSources.add(dataSource); - $.ajax({ - url: url, - contentType: 'application/json;charset=UTF-8', - type: jhtype, - dataType: 'json', - data: JSON.stringify({}), - success: function (data) { - if (data.message == "Success") { - let height, lon, lat - data.rows.forEach((item) => { - height = 100, lon = item.statLg, lat = item.statLa - if (item.statName) { - item.dataType = "XXTZ"; - var pixelO = (item.statName.length / 2 * 20) - if (item.statName.indexOf("瀵硅鏈�") == 0) { - billboardImage = "./static/img/鎵嬫満.png"; - } else { - if (item.statName.indexOf("5G") == 0) { - billboardImage = "./static/img/5g.png"; - } else { - billboardImage = "./static/img/blue.png"; - } - } - var tzgltfurl = "./static/gltf/jizhan.glb"; - switch (item.statName) { - case "5G鍩虹珯4": - lon = 113.31284042 - lat = 23.1478328 - height = 94.24 - break; - case "瀵硅鏈虹郴缁�-07": - lon = 113.31746066 - lat = 23.14174174 - height = 60 - break; - case "瀵硅鏈虹郴缁�-04": - lon = 113.31971655 - lat = 23.14200308 - height = 78.30 - break; - case "瀵硅鏈虹郴缁�-02": - lon = 113.32338867 - lat = 23.14155387 - height = 159.73 - break; - case "5G鍩虹珯2": - lon = 113.32342299 - lat = 23.1420382 - height = 203.51 - break; - case "5G鍩虹珯1": - lon = 113.3154846 - lat = 23.13927926 - height = 196.47 - break; - case "瀵硅鏈虹郴缁�-03": - lon = 113.31920459 - lat = 23.13935581 - height = 100 - break; - case "4G鍩虹珯1": - lon = 113.31539679 - lat = 23.1375488 - height = 295 - break; - case "瀵硅鏈虹郴缁�-01": - lon = 113.32029651 - lat = 23.13864168 - height = 63 - break; - case "瀵硅鏈虹郴缁�-05": - lon = 113.31764205 - lat = 23.13788573 - height = 86.70 - break; - case "瀵硅鏈虹郴缁�-06": - lon = 113.32349384 - lat = 23.13662137 - height = 175 - break; - case "5G鍩虹珯5": - lon = 113.31429066 - lat = 23.12940111 - height = 248.14 - break; - case "5G鍩虹珯3": - lon = 113.32796088 - lat = 23.13521196 - height = 186.33 - break; - case "瓒婄鍖哄箍鎾數瑙嗗彂灏勫彴": - lon = 113.31643235 - lat = 23.12389751 - height = 255.47 - break; - default: - break; - } - if (item.statName.indexOf("鏄庣彔")) { - height = 500 - } - if (item.statName.indexOf("鍩虹珯") > -1) { - var positionTZ = new Cesium.Cartesian3.fromDegrees(lon, lat, height - 80); - loadGLTF(tzgltfurl, positionTZ, 2, "tz") - } - dataSource.entities.add(new Cesium.Entity({ - position: Cesium.Cartesian3.fromDegrees(lon, lat, height - 40), - label: { - showBackground: true, - backgroundColor: new Cesium.Color.fromCssColorString("#000").withAlpha(0.3), - text: item.statName, - font: "15px Helvetica", - fillColor: Cesium.Color.fromCssColorString("#FCFF00"), pixelOffset: new Cesium.Cartesian2(pixelO, 0), - style: Cesium.LabelStyle.FILL_AND_OUTLINE, - disableDepthTestDistance: Number.POSITIVE_INFINITY, - distanceDisplayCondition: new Cesium.DistanceDisplayCondition(10, 1000000) - }, - billboard: { - image: billboardImage, - disableDepthTestDistance: Number.POSITIVE_INFINITY, - width: 30, // default: undefined - height: 30, - distanceDisplayCondition: new Cesium.DistanceDisplayCondition(10, 1000000) - - }, - properties: item, - })); - } else if (item.monstationName) { - item.dataType = "JCZ"; - var gltfurl = "./static/gltf/JCZ.glb"; - let x = item.monstationLg, y = item.monstationLa - let z = 54 - var position = new Cesium.Cartesian3.fromDegrees(x, y, 0); - billboardImage = "./static/img/jcz.png" - if (item.monstationName == "浜戞捣") { - x = 121.444697 - y = 31.213850 - gltfurl = "./static/gltf/gdjcz.glb"; - billboardImage = "./static/img/4.png"; - position = new Cesium.Cartesian3.fromDegrees(121.444697, 31.213850, 88.5); - z = 150 - } - if (item.monstationName.indexOf("灏忓瀷鐩戞祴绔�1") == 0) { - gltfurl = "./static/gltf/xxz.glb"; - position = new Cesium.Cartesian3.fromDegrees(x, y, 200); - billboardImage = "./static/img/5.png"; - z = 205 - } - if (item.monstationName.indexOf("灏忓瀷鐩戞祴绔�2") == 0) { - gltfurl = "./static/gltf/xxz.glb"; - x = 113.32349347 - y = 23.13662572 - position = new Cesium.Cartesian3.fromDegrees(x, y, 118); - billboardImage = "./static/img/5.png"; - z = 121 - } - if (item.monstationName.indexOf("蹇儴寮忕洃娴嬬偣1") == 0) { - gltfurl = "./static/gltf/kbz.glb"; - position = new Cesium.Cartesian3.fromDegrees(x, y, 30); - - billboardImage = "./static/img/2.png"; - z = 35 - } - if (item.monstationName.indexOf("蹇儴寮忕洃娴嬬偣2") == 0) { - gltfurl = "./static/gltf/kbz.glb"; - x = 113.318593 - y = 23.140079 - z = 24 - billboardImage = "./static/img/2.png"; - position = new Cesium.Cartesian3.fromDegrees(x, y, 17); - } - if (item.monstationName.indexOf("鏃犱汉鏈�") == 0) { - gltfurl = "./static/gltf/wrj.glb"; - position = new Cesium.Cartesian3.fromDegrees(x, y, 103); - z = 108 - billboardImage = "./static/img/3.png"; - } - if (item.monstationName.indexOf("鐩戞祴杞�1") == 0) { - gltfurl = "./static/gltf/YDJCC2.glb"; - position = new Cesium.Cartesian3.fromDegrees(x, y, 11.5); - z = 17 - billboardImage = "./static/img/1.png"; - } - if (item.monstationName.indexOf("鐩戞祴杞�2") == 0) { - gltfurl = "./static/gltf/YDJCC2.glb"; - position = new Cesium.Cartesian3.fromDegrees(x, y, 11); - z = 16 - billboardImage = "./static/img/1.png"; - } - if (item.monstationName.indexOf("鍥哄畾鐩戞祴绔�") == 0) { - gltfurl = "./static/gltf/gdjcz.glb"; - x = 113.320531 - y = 23.119995 - z = 607 - position = new Cesium.Cartesian3.fromDegrees(x, y, 550); - - } - loadGLTF(gltfurl, position, 3, "JCZ") - var pixelO = (item.monstationName.length / 2 * 20) + 35 - dataSource.entities.add(new Cesium.Entity({ - position: Cesium.Cartesian3.fromDegrees(x, y, z), - label: { - showBackground: true, - backgroundColor: new Cesium.Color.fromCssColorString("#000").withAlpha(0.3), - text: item.monstationName, - font: "15px Helvetica", - fillColor: Cesium.Color.fromCssColorString("#6CFF00"), - pixelOffset: new Cesium.Cartesian2(pixelO, 0), - style: Cesium.LabelStyle.FILL_AND_OUTLINE, - disableDepthTestDistance: Number.POSITIVE_INFINITY, - distanceDisplayCondition: new Cesium.DistanceDisplayCondition(10, 1000000) - }, - billboard: { - image: billboardImage, - disableDepthTestDistance: Number.POSITIVE_INFINITY, - width: 40, // default: undefined - height: 40, - distanceDisplayCondition: new Cesium.DistanceDisplayCondition(10, 1000000) - - }, - properties: item, - })); - } - - - - var pathOption = { - width: 1, //绾垮锛堝彲閫夛級 - color: '#00ffff', //绾块鑹诧紙鍙�夛級, - height: 5000, - LightSpot: true, //鏄惁浣跨敤鍏夌偣鏁堟灉锛堝彲閫夛級 - LightSpotColor: '#ffffff', //鍏夌偣棰滆壊锛堝彲閫夛級 - inflow: true - - } - - - - - let arr = [{ "lon": 121.3915556, "lat": 31.621555, height: 15 }, - { "lon": 121.3710465, "lat": 31.3834148, height: 15 }, - { "lon": 121.222861, "lat": 31.31885, height: 15 }, - { "lon": 121.33049, "lat": 31.2425713, height: 15 }, - { "lon": 121.4392777, "lat": 31.1356388, height: 15 }, - { "lon": 121.628888, "lat": 31.2075, height: 15 }, - { "lon": 121.886707, "lat": 30.8659381, height: 15 }, - { "lon": 121.5605555, "lat": 30.8575, height: 15 }] - let center = { lat: 31.213850, lon: 121.444697, height: 110 } - window.lightStr ? window.lightStr.clear() : "" - window.lightStr = sgworld.Creator.createTrailLinePath(center, arr, pathOption); - - - }) - } - } - }) - dataSourcePromise.then(function (dataSource) { - const pixelRange = 25; - const minimumClusterSize = 3; - const enabled = true; - dataSource.clustering.enabled = enabled; - dataSource.clustering.pixelRange = pixelRange; - dataSource.clustering.minimumClusterSize = minimumClusterSize; - let removeListener; - const gradient = { - 0.0001: Cesium.Color.DEEPSKYBLUE, - 0.001: Cesium.Color.WHITE, - 0.01: Cesium.Color.ORANGE, - 0.1: Cesium.Color.RED - }; - function customStyle() { - if (Cesium.defined(removeListener)) { - removeListener(); - removeListener = undefined; - } else { - removeListener = dataSource.clustering.clusterEvent.addEventListener( - function (clusteredEntities, cluster) { - cluster.billboard.show = true; - // cluster.billboard.disableDepthTestDistance = Number.POSITIVE_INFINITY; - // cluster.label.font = `bold 12px sans-serif`; - cluster.label.font = `12px sans-serif`; - cluster.label.fillColor = new Cesium.Color.fromCssColorString("#fff"); - cluster.label.disableDepthTestDistance = Number.POSITIVE_INFINITY; - let allCount = dataSource.entities.values.length || 0 - for (let key in gradient) { - if (clusteredEntities.length >= allCount * key) { - let numLength = String(clusteredEntities.length).length - cluster.billboard.image = _drawCircle( - gradient[key], - numLength - ) - cluster.label.show = true - if (numLength === 1) { - cluster.label.pixelOffset = new Cesium.Cartesian2(-2, 3) - } else { - cluster.label.pixelOffset = new Cesium.Cartesian2( - -5 * (numLength - 1), - 5 - ) - } - } else if (clusteredEntities.length <= 1) { - cluster.label.show = false - } - } - } - ); - } - // force a re-cluster with the new styling - const pixelRange = dataSource.clustering.pixelRange; - dataSource.clustering.pixelRange = 0; - dataSource.clustering.pixelRange = pixelRange; - } - var _cache = {}; - function _drawCircle(color, numLength) { - let size = 18 * (numLength + 1) - let key = color.toCssColorString() + '-' + size - if (!_cache[key]) { - let canvas = document.createElement('canvas') - canvas.width = size - canvas.height = size - let context2D = canvas.getContext('2d') - context2D.save() - context2D.scale(size / 24, size / 24) //Added to auto-generated code to scale up to desired size. - context2D.fillStyle = color.withAlpha(0.2).toCssColorString() //Modified from auto-generated code. - context2D.beginPath() - context2D.arc(12, 12, 9, 0, 2 * Math.PI) - context2D.closePath() - context2D.fill() - context2D.beginPath() - context2D.arc(12, 12, 6, 0, 2 * Math.PI) - context2D.fillStyle = color.toCssColorString() - context2D.fill() - context2D.closePath() - context2D.restore() - _cache[key] = canvas.toDataURL() - } - return _cache[key] - } - // start with custom style - customStyle(); - }); - + } + if (window.modelList1.length > 0) { + for (var j = 0; j < window.modelList1.length; j++) { + window.modelList1[j].deleteObject() + } + } + } else if (name === '鐩戞祴绔�') { + var jcz = viewer.dataSources.getByName('jcz') + if (jcz.length > 0) { + for (var i = 0; i < jcz.length; i++) { + viewer.dataSources.remove(jcz[i]) + } + } + if (window.modelList.length > 0) { + for (var j = 0; j < window.modelList.length; j++) { + window.modelList[j].deleteObject() + } + } } + } else { + var dataSourcePromise = viewer.dataSources.add(dataSource) + $.ajax({ + url: url, + contentType: 'application/json;charset=UTF-8', + type: jhtype, + dataType: 'json', + data: JSON.stringify({}), + success: function (data) { + if (data.message == 'Success') { + let height, lon, lat + data.rows.forEach(item => { + ;(height = 100), (lon = item.statLg), (lat = item.statLa) + if (item.statName) { + item.dataType = 'XXTZ' + var pixelO = (item.statName.length / 2) * 20 + if (item.statName.indexOf('瀵硅鏈�') == 0) { + billboardImage = './static/img/鎵嬫満.png' + } else { + if (item.statName.indexOf('5G') == 0) { + billboardImage = './static/img/5g.png' + } else { + billboardImage = './static/img/blue.png' + } + } + var tzgltfurl = './static/gltf/jizhan.glb' + switch (item.statName) { + case '5G鍩虹珯4': + lon = 113.31284042 + lat = 23.1478328 + height = 94.24 + break + case '瀵硅鏈虹郴缁�-07': + lon = 113.31746066 + lat = 23.14174174 + height = 60 + break + case '瀵硅鏈虹郴缁�-04': + lon = 113.31971655 + lat = 23.14200308 + height = 78.3 + break + case '瀵硅鏈虹郴缁�-02': + lon = 113.32338867 + lat = 23.14155387 + height = 159.73 + break + case '5G鍩虹珯2': + lon = 113.32342299 + lat = 23.1420382 + height = 203.51 + break + case '5G鍩虹珯1': + lon = 113.3154846 + lat = 23.13927926 + height = 196.47 + break + case '瀵硅鏈虹郴缁�-03': + lon = 113.31920459 + lat = 23.13935581 + height = 100 + break + case '4G鍩虹珯1': + lon = 113.31539679 + lat = 23.1375488 + height = 295 + break + case '瀵硅鏈虹郴缁�-01': + lon = 113.32029651 + lat = 23.13864168 + height = 63 + break + case '瀵硅鏈虹郴缁�-05': + lon = 113.31764205 + lat = 23.13788573 + height = 86.7 + break + case '瀵硅鏈虹郴缁�-06': + lon = 113.32349384 + lat = 23.13662137 + height = 175 + break + case '5G鍩虹珯5': + lon = 113.31429066 + lat = 23.12940111 + height = 248.14 + break + case '5G鍩虹珯3': + lon = 113.32796088 + lat = 23.13521196 + height = 186.33 + break + case '瓒婄鍖哄箍鎾數瑙嗗彂灏勫彴': + lon = 113.31643235 + lat = 23.12389751 + height = 255.47 + break + default: + break + } + if (item.statName.indexOf('鏄庣彔')) { + height = 500 + } + if (item.statName.indexOf('鍩虹珯') > -1) { + var positionTZ = new Cesium.Cartesian3.fromDegrees( + lon, + lat, + height - 80 + ) + loadGLTF(tzgltfurl, positionTZ, 2, 'tz') + } + dataSource.entities.add( + new Cesium.Entity({ + position: Cesium.Cartesian3.fromDegrees( + lon, + lat, + height - 40 + ), + label: { + showBackground: true, + backgroundColor: new Cesium.Color.fromCssColorString( + '#000' + ).withAlpha(0.3), + text: item.statName, + font: '15px Helvetica', + fillColor: Cesium.Color.fromCssColorString('#FCFF00'), + pixelOffset: new Cesium.Cartesian2(pixelO, 0), + style: Cesium.LabelStyle.FILL_AND_OUTLINE, + disableDepthTestDistance: Number.POSITIVE_INFINITY, + distanceDisplayCondition: new Cesium.DistanceDisplayCondition( + 10, + 1000000 + ) + }, + billboard: { + image: billboardImage, + disableDepthTestDistance: Number.POSITIVE_INFINITY, + width: 30, // default: undefined + height: 30, + distanceDisplayCondition: new Cesium.DistanceDisplayCondition( + 10, + 1000000 + ) + }, + properties: item + }) + ) + } else if (item.monstationName) { + item.dataType = 'JCZ' + var gltfurl = './static/gltf/JCZ.glb' + let x = item.monstationLg, + y = item.monstationLa + let z = 54 + var position = new Cesium.Cartesian3.fromDegrees(x, y, 0) + billboardImage = './static/img/jcz.png' + if (item.monstationName == '浜戞捣') { + x = 121.444697 + y = 31.21385 + gltfurl = './static/gltf/gdjcz.glb' + billboardImage = './static/img/4.png' + position = new Cesium.Cartesian3.fromDegrees( + 121.444697, + 31.21385, + 88.5 + ) + z = 150 + } + if (item.monstationName.indexOf('灏忓瀷鐩戞祴绔�1') == 0) { + gltfurl = './static/gltf/xxz.glb' + position = new Cesium.Cartesian3.fromDegrees(x, y, 200) + billboardImage = './static/img/5.png' + z = 205 + } + if (item.monstationName.indexOf('灏忓瀷鐩戞祴绔�2') == 0) { + gltfurl = './static/gltf/xxz.glb' + x = 113.32349347 + y = 23.13662572 + position = new Cesium.Cartesian3.fromDegrees(x, y, 118) + billboardImage = './static/img/5.png' + z = 121 + } + if (item.monstationName.indexOf('蹇儴寮忕洃娴嬬偣1') == 0) { + gltfurl = './static/gltf/kbz.glb' + position = new Cesium.Cartesian3.fromDegrees(x, y, 30) + billboardImage = './static/img/2.png' + z = 35 + } + if (item.monstationName.indexOf('蹇儴寮忕洃娴嬬偣2') == 0) { + gltfurl = './static/gltf/kbz.glb' + x = 113.318593 + y = 23.140079 + z = 24 + billboardImage = './static/img/2.png' + position = new Cesium.Cartesian3.fromDegrees(x, y, 17) + } + if (item.monstationName.indexOf('鏃犱汉鏈�') == 0) { + gltfurl = './static/gltf/wrj.glb' + position = new Cesium.Cartesian3.fromDegrees(x, y, 103) + z = 108 + billboardImage = './static/img/3.png' + } + if (item.monstationName.indexOf('鐩戞祴杞�1') == 0) { + gltfurl = './static/gltf/YDJCC2.glb' + position = new Cesium.Cartesian3.fromDegrees(x, y, 11.5) + z = 17 + billboardImage = './static/img/1.png' + } + if (item.monstationName.indexOf('鐩戞祴杞�2') == 0) { + gltfurl = './static/gltf/YDJCC2.glb' + position = new Cesium.Cartesian3.fromDegrees(x, y, 11) + z = 16 + billboardImage = './static/img/1.png' + } + if (item.monstationName.indexOf('鍥哄畾鐩戞祴绔�') == 0) { + gltfurl = './static/gltf/gdjcz.glb' + x = 113.320531 + y = 23.119995 + z = 607 + position = new Cesium.Cartesian3.fromDegrees(x, y, 550) + } + loadGLTF(gltfurl, position, 3, 'JCZ') + var pixelO = (item.monstationName.length / 2) * 20 + 35 + dataSource.entities.add( + new Cesium.Entity({ + position: Cesium.Cartesian3.fromDegrees(x, y, z), + label: { + showBackground: true, + backgroundColor: new Cesium.Color.fromCssColorString( + '#000' + ).withAlpha(0.3), + text: item.monstationName, + font: '15px Helvetica', + fillColor: Cesium.Color.fromCssColorString('#6CFF00'), + pixelOffset: new Cesium.Cartesian2(pixelO, 0), + style: Cesium.LabelStyle.FILL_AND_OUTLINE, + disableDepthTestDistance: Number.POSITIVE_INFINITY, + distanceDisplayCondition: new Cesium.DistanceDisplayCondition( + 10, + 1000000 + ) + }, + billboard: { + image: billboardImage, + disableDepthTestDistance: Number.POSITIVE_INFINITY, + width: 40, // default: undefined + height: 40, + distanceDisplayCondition: new Cesium.DistanceDisplayCondition( + 10, + 1000000 + ) + }, + properties: item + }) + ) + } + var pathOption = { + width: 1, // 绾垮锛堝彲閫夛級 + color: '#00ffff', // 绾块鑹诧紙鍙�夛級, + height: 5000, + LightSpot: true, // 鏄惁浣跨敤鍏夌偣鏁堟灉锛堝彲閫夛級 + LightSpotColor: '#ffffff', // 鍏夌偣棰滆壊锛堝彲閫夛級 + inflow: true + } - + let arr = [ + { lon: 121.3915556, lat: 31.621555, height: 15 }, + { lon: 121.3710465, lat: 31.3834148, height: 15 }, + { lon: 121.222861, lat: 31.31885, height: 15 }, + { lon: 121.33049, lat: 31.2425713, height: 15 }, + { lon: 121.4392777, lat: 31.1356388, height: 15 }, + { lon: 121.628888, lat: 31.2075, height: 15 }, + { lon: 121.886707, lat: 30.8659381, height: 15 }, + { lon: 121.5605555, lat: 30.8575, height: 15 } + ] + let center = { lat: 31.21385, lon: 121.444697, height: 110 } + window.lightStr ? window.lightStr.clear() : '' + window.lightStr = sgworld.Creator.createTrailLinePath( + center, + arr, + pathOption + ) + }) + } + } + }) + dataSourcePromise.then(function (dataSource) { + const pixelRange = 25 + const minimumClusterSize = 3 + const enabled = true + dataSource.clustering.enabled = enabled + dataSource.clustering.pixelRange = pixelRange + dataSource.clustering.minimumClusterSize = minimumClusterSize + let removeListener + const gradient = { + 0.0001: Cesium.Color.DEEPSKYBLUE, + 0.001: Cesium.Color.WHITE, + 0.01: Cesium.Color.ORANGE, + 0.1: Cesium.Color.RED + } + function customStyle () { + if (Cesium.defined(removeListener)) { + removeListener() + removeListener = undefined + } else { + removeListener = dataSource.clustering.clusterEvent.addEventListener( + function (clusteredEntities, cluster) { + cluster.billboard.show = true + // cluster.billboard.disableDepthTestDistance = Number.POSITIVE_INFINITY; + // cluster.label.font = `bold 12px sans-serif`; + cluster.label.font = `12px sans-serif` + cluster.label.fillColor = new Cesium.Color.fromCssColorString( + '#fff' + ) + cluster.label.disableDepthTestDistance = Number.POSITIVE_INFINITY + let allCount = dataSource.entities.values.length || 0 + for (let key in gradient) { + if (clusteredEntities.length >= allCount * key) { + let numLength = String(clusteredEntities.length).length + cluster.billboard.image = _drawCircle( + gradient[key], + numLength + ) + cluster.label.show = true + if (numLength === 1) { + cluster.label.pixelOffset = new Cesium.Cartesian2(-2, 3) + } else { + cluster.label.pixelOffset = new Cesium.Cartesian2( + -5 * (numLength - 1), + 5 + ) + } + } else if (clusteredEntities.length <= 1) { + cluster.label.show = false + } + } + } + ) + } + // force a re-cluster with the new styling + const pixelRange = dataSource.clustering.pixelRange + dataSource.clustering.pixelRange = 0 + dataSource.clustering.pixelRange = pixelRange + } + var _cache = {} + function _drawCircle (color, numLength) { + let size = 18 * (numLength + 1) + let key = color.toCssColorString() + '-' + size + if (!_cache[key]) { + let canvas = document.createElement('canvas') + canvas.width = size + canvas.height = size + let context2D = canvas.getContext('2d') + context2D.save() + context2D.scale(size / 24, size / 24) // Added to auto-generated code to scale up to desired size. + context2D.fillStyle = color.withAlpha(0.2).toCssColorString() // Modified from auto-generated code. + context2D.beginPath() + context2D.arc(12, 12, 9, 0, 2 * Math.PI) + context2D.closePath() + context2D.fill() + context2D.beginPath() + context2D.arc(12, 12, 6, 0, 2 * Math.PI) + context2D.fillStyle = color.toCssColorString() + context2D.fill() + context2D.closePath() + context2D.restore() + _cache[key] = canvas.toDataURL() + } + return _cache[key] + } + // start with custom style + customStyle() + }) + } } +// 鍒涘缓glb妯″瀷 +window.modelList = [] +window.modelList1 = [] +export function loadGLTF (url, position, scale, type) { + var model = sgworld.Creator.addSimpleGraphic('model', { + url: url, + position: position, + removeEdit: true, // 灞忚斀鍏ㄥ眬鏍囩粯缂栬緫鍔熻兘 + scale: scale + }) + type == 'JCZ' ? window.modelList.push(model) : window.modelList1.push(model) - -//鍒涘缓glb妯″瀷 -window.modelList = []; -window.modelList1 = []; -export function loadGLTF(url, position, scale, type) { - var model = sgworld.Creator.addSimpleGraphic('model', { - url: url, - position: position, - removeEdit: true, // 灞忚斀鍏ㄥ眬鏍囩粯缂栬緫鍔熻兘 - scale: scale - }); - type == "JCZ" ? window.modelList.push(model) : window.modelList1.push(model) - - //viewer.trackedEntity = model; + // viewer.trackedEntity = model; } -window.showtable = false; +window.showtable = false let timeoutID let handlerMes -window.monstationGuidList = []; -window.stationList = []; -//鍙屽嚮浜嬩欢 -export function addMouseEvent() { - //鐐瑰嚮鑾峰彇淇℃伅 - handlerMes ? handlerMes.destroy() : "" - handlerMes = new Cesium.ScreenSpaceEventHandler( - window.Viewer.scene.canvas - ); +window.monstationGuidList = [] +window.stationList = [] +// 鍙屽嚮浜嬩欢 +export function addMouseEvent () { + // 鐐瑰嚮鑾峰彇淇℃伅 + handlerMes ? handlerMes.destroy() : '' + handlerMes = new Cesium.ScreenSpaceEventHandler(window.Viewer.scene.canvas) - handlerMes.setInputAction(function (movement) { - - // 鍒ゆ柇鐨勭洰鐨勬槸闃叉瀹炰緥琚垱寤轰箣鍚庡乏閿偣鍑荤洿鎺ュ鑷寸洃娴嬬珯琚垎鏋� - if (window.allowClick) { - if (window.JCZlist.length > 0) { - for (var j = 0; j < window.JCZlist.length; j++) { - viewer.entities.removeById(window.JCZlist[j].id); - } - - } - let pick = window.Viewer.scene.pick(movement.position) - console.log(pick); - if (pick && pick.id && pick.id.properties && pick.id.properties.monstationName && pick.id.properties.monstationGuid) { - let i = 0 - if (window.monstationGuidList.length == 0) { - window.monstationGuidList.push({ "name": pick.id.properties.monstationName._value, "id": pick.id.properties.monstationGuid._value }) - bus.$emit("ismonstationGuid", window.monstationGuidList); - } else { - window.monstationGuidList.forEach(item => { - if (pick.id.properties.monstationGuid._value == item.id) { - i++ - } - }); - if (i == 0) { - window.monstationGuidList.push({ "name": pick.id.properties.monstationName._value, "id": pick.id.properties.monstationGuid._value }) - bus.$emit("ismonstationGuid", window.monstationGuidList); - } - } - - } - // 閫変腑绯荤粺鍙扮珯 - if (pick && pick.id && pick.id.properties && pick.id.properties._dataType && pick.id.properties._dataType._value == "XXTZ") { - let i = 0 - debugger - if (window.stationList.length == 0) { - window.stationList.push({ "name": pick.id.properties._statName._value, "id": pick.id.properties._guid._value }) - bus.$emit("showMoreTZ", window.stationList); - } else { - // 闃叉閲嶅 - window.stationList.forEach(item => { - if (pick.id.properties._guid._value == item.id) { - i++ - } - }); - if (i == 0) { - window.stationList.push({ "name": pick.id.properties._statName._value, "id": pick.id.properties._guid._value }) - bus.$emit("showMoreTZ", window.stationList); - } - } - - } - clearTimeout(timeoutID); - timeoutID = window.setTimeout(function () { - if (!window.showtable) { - } else { - bus.$emit("isFX", true) - if (Cesium.defined(pick) && pick.id && pick.id.properties) { - window.objform.monstationGuid = pick.id.properties._monstationGuid._value; - let data = [ - window.objform - ] - window.allowClick = false - showdataJCZ(data) - } - } - }, 200); + handlerMes.setInputAction(function (movement) { + // 鍒ゆ柇鐨勭洰鐨勬槸闃叉瀹炰緥琚垱寤轰箣鍚庡乏閿偣鍑荤洿鎺ュ鑷寸洃娴嬬珯琚垎鏋� + if (window.allowClick) { + if (window.JCZlist.length > 0) { + for (var j = 0; j < window.JCZlist.length; j++) { + viewer.entities.removeById(window.JCZlist[j].id) } - }, Cesium.ScreenSpaceEventType.LEFT_CLICK); - var divPoint3; - handlerMes.setInputAction(function (movement) { - clearTimeout(timeoutID); - if (divPoint3) { - divPoint3.deleteObject(); - } - let pick = window.Viewer.scene.pick(movement.position); - if (Cesium.defined(pick) && pick.id && pick.id.properties) { - var prophtml = setEpidemicLayerInfoDomtj(pick.id.properties); - setInterval(function () { - $("body .closeclick").on("click", () => { - document.getElementsByClassName("tableContain")[0].style.display = - "none"; - }); - }, 1000); - if (pick.id.properties.statLg && pick.id.properties.statLa) { - var lng = pick.id.properties.statLg._value; - var lat = pick.id.properties.statLa._value; - } else if (pick.id.properties.monstationLg && pick.id.properties.monstationLa) { - var lng = pick.id.properties.monstationLg._value; - var lat = pick.id.properties.monstationLa._value; - } - if (pick.id.properties && pick.id.properties._monstationName && pick.id.properties._monstationName._value == "浜戞捣") { - lng = 121.444697 - lat = 31.213850 - } - if (movement.position) - divPoint3 = sgworld.Creator.createDivPoint('', { lon: lng, lat: lat, height: 105 }, { - type: "custom", - offset: ["c", 20], - description: prophtml, - near: 0, - far: 100000 - }); - } - - }, Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK) - -} - -//鎶界鐩戞祴绔欏浘渚嬪垱寤轰簨浠� -export function showdataJCZ(data) { - const loading = Loading.service({ - lock: true, - text: "璁$畻涓�", - spinner: "el-icon-loading", - background: "rgba(0, 0, 0, 0.7)", - }); - MonitoringStation(data).then((res) => { - if (res.message === "Success") { - var positions = res.data.countorResVOList[0].points; - var value = res.data.countorResVOList[0].areaResult - var positionsList = []; - for (var i = 0; i < positions.length; i++) { - positionsList.push(positions[i].lon, positions[i].lat); - } - let obj = { - name: window.analysisType, - value: value - } - bus.$emit("newData", obj) - createPloygon(positionsList); - loading.close(); - } - }).catch((error) => { - loading.close(); - }); -} -//寮�鍚钩琛屽厜 -export function light() { - // Viewer.scene.light = new Cesium.DirectionalLight({ - // direction: new Cesium.Cartesian3(0, 0, -1), - // }); -} -//鍙冲嚮浜嬩欢 -let nowplay -export function addRightMouseEvent() { - //鐐瑰嚮鑾峰彇淇℃伅 - let handler = new Cesium.ScreenSpaceEventHandler( - window.Viewer.scene.canvas - ); - handler.setInputAction(function (movement) { - window.divPoint4 && window.divPoint4.deleteObject(); - window.divPoint5 && window.divPoint5.deleteObject(); - window.divPoint6 && window.divPoint6.deleteObject(); - window.divPoint7 && window.divPoint7.deleteObject(); - window.divPoint8 && window.divPoint8.deleteObject(); - window.divPoint9 && window.divPoint9.deleteObject(); - window.divPoint10 && window.divPoint10.deleteObject(); - //娓呴櫎涔嬪墠鐩戞祴绔欎簨浠� - if (window.JCZlist.length > 0) { - for (var j = 0; j < window.JCZlist.length; j++) { - viewer.entities.removeById(window.JCZlist[j].id); - } - - } - var pick = window.Viewer.scene.pick(movement.position); - let position = pick.id.position.getValue() - let degrees = sgworld.Core.toDegrees(position) - if (Cesium.defined(pick) && pick.id && pick.id.properties) { - window.showtable = true - if (pick.id.properties.dataType._value == "JCZ") { - var lng = pick.id.properties.monstationLg._value; - var lat = pick.id.properties.monstationLa._value; - let prophtml = createHtmlRight("榛戝箍鎾洃娴嬭兘鍔�") - window.divPoint4 = sgworld.Creator.createDivPoint('', { lon: degrees.lon, lat: degrees.lat, height: degrees.height }, { - type: "custom", - offset: ["c", 170], - description: prophtml, - near: 0, - far: 50000, - onclick: function () { - window.showtable = true; - window.objform = { - analysisType: "榛戝箍鎾�", - areaResult: 99.83516631, - coverageThreshold: "-110", - freqPoint: 954, - frequency: 100, - modelName: "", - monFrequency: "", - monstationGuid: "2", - propModel: 2, - rxAntGain: 0, - rxAntHeight: 0, - txAntGain: 0, - txAntHeight: 20, - txFrequency: "", - txPower: 50 - } - window.objform.monstationGuid = pick.id.properties._monstationGuid._value; - let arrq = [window.objform] - showdataJCZ(arrq) - setTimeout(function name(params) { - try { - window.divPoint4.deleteObject(); - window.divPoint5.deleteObject(); - window.divPoint6.deleteObject(); - window.divPoint7.deleteObject(); - } catch (e) { - } - }, 100) - } - }); - let prophtml1 = createHtmlRight("浼熀绔欑洃娴嬭兘鍔�") - window.divPoint5 = sgworld.Creator.createDivPoint('', { lon: degrees.lon, lat: degrees.lat, height: degrees.height }, { - type: "custom", - offset: ["c", 120], - description: prophtml1, - near: 0, - far: 50000, - onclick: function name() { - window.showtable = true; - window.objform = { - analysisType: "浼熀绔�", - areaResult: 10185.58366101, - coverageThreshold: "-110", - freqPoint: 100, - frequency: 954, - modelName: "", - monFrequency: "", - monstationGuid: "2", - propModel: 2, - rxAntGain: 0, - rxAntHeight: 0, - txAntGain: 0, - txAntHeight: 10, - txFrequency: "", - txPower: 40 - } - window.objform.monstationGuid = pick.id.properties._monstationGuid._value; - let arrq = [window.objform] - showdataJCZ(arrq) - setTimeout(function name(params) { - try { - window.divPoint4.deleteObject(); - window.divPoint5.deleteObject(); - window.divPoint6.deleteObject(); - window.divPoint7.deleteObject(); - } catch (e) { - - } - }, 100) - } - }); - let prophtml2 = createHtmlRight("澶╃嚎璧嬪舰鍥�") - let scale = 0.5 - window.divPoint6 = sgworld.Creator.createDivPoint('', { lon: degrees.lon, lat: degrees.lat, height: degrees.height }, { - type: "custom", - offset: ["c", 20], - description: prophtml2, - near: 0, - far: 50000, - onclick: function name() { - if (window.FieldIntensity) { - window.FieldIntensity.deleteObject() - window.FieldIntensity = null - } - let height = degrees.height - 5 - // 鍒ゆ柇璧嬪舰鍥炬槸鍚﹂渶瑕佷慨鏀� - if (pick.id && pick.id._properties && pick.id._properties._monstationName && pick.id._properties._monstationName._value) { - let cheak = pick.id._properties._monstationName._value - if (cheak.indexOf("灏忓瀷鐩戞祴绔�") == 0 || cheak.indexOf("蹇儴寮忕洃娴嬬偣") == 0) { - scale = 0.1 - height = degrees.height - 2 - } - if (cheak.indexOf("鐩戞祴杞�") == 0) { - scale = 0.3 - height = degrees.height - 2 - } - } - let url = "./static/json/ant.json" - window.FieldIntensity = sgworld.Creator.FieldIntensity(url, { - center: [degrees.lon, degrees.lat, height], // 澶囩敤涓績鍧愭爣 - scale: scale - }) - setTimeout(function name(params) { - try { - window.divPoint4.deleteObject(); - window.divPoint5.deleteObject(); - window.divPoint6.deleteObject(); - window.divPoint7.deleteObject(); - } catch (e) { - - } - }, 100) - - } - - }); - let prophtml4 = createHtmlRight("瀵硅鏈虹洃娴嬭兘鍔�") - window.divPoint7 = sgworld.Creator.createDivPoint('', { lon: degrees.lon, lat: degrees.lat, height: degrees.height }, { - type: "custom", - offset: ["c", 70], - description: prophtml4, - near: 0, - far: 50000, - onclick: function name() { - window.showtable = true; - window.objform = { - analysisType: "瀵硅鏈�", - areaResult: 0.451125, - coverageThreshold: "-110", - freqPoint: 450, - frequency: 450, - modelName: "", - monFrequency: "", - monstationGuid: "2", - propModel: 2, - rxAntGain: 0, - rxAntHeight: 0, - txAntGain: 0, - txAntHeight: 2, - txFrequency: "", - txPower: 30 - } - window.objform.monstationGuid = pick.id.properties._monstationGuid._value; - let arrq = [window.objform] - showdataJCZ(arrq) - setTimeout(function name() { - try { - window.divPoint4.deleteObject(); - window.divPoint5.deleteObject(); - window.divPoint6.deleteObject(); - window.divPoint7.deleteObject(); - } catch (e) { - - } - }, 100) - } - }); - - } - if (pick.id.properties.dataType._value == "XXTZ") { - let prophtml1 = createHtmlRight("淇濇姢杞粨绾�") - window.divPoint10 = sgworld.Creator.createDivPoint('', { lon: degrees.lon, lat: degrees.lat, height: degrees.height }, { - type: "custom", - offset: ["c", 20], - description: prophtml1, - near: 0, - far: 50000, - onclick: function name() { - setTimeout(function name(params) { - try { - window.divPoint8.deleteObject(); - window.divPoint9.deleteObject(); - window.divPoint10.deleteObject(); - } catch (e) { - - } - }, 100) - } - }); - let prophtml2 = createHtmlRight("澶╃嚎璧嬪舰鍥�") - let scale = 3 - window.divPoint8 = sgworld.Creator.createDivPoint('', { lon: degrees.lon, lat: degrees.lat, height: degrees.height+10 }, { - type: "custom", - offset: ["c", 120], - description: prophtml2, - near: 0, - far: 50000, - onclick: function name() { - if (window.FieldIntensity) { - window.FieldIntensity.deleteObject() - window.FieldIntensity = null - } - let height = degrees.height - 5 - let url = "./static/json/ant.json" - window.FieldIntensity = sgworld.Creator.FieldIntensity(url, { - center: [degrees.lon, degrees.lat, height], // 澶囩敤涓績鍧愭爣 - scale: scale - }) - setTimeout(function name(params) { - try { - window.divPoint8.deleteObject(); - window.divPoint9.deleteObject(); - window.divPoint10.deleteObject(); - } catch (e) { - - } - }, 100) - - } - - }); - let prophtml4 = createHtmlRight("鍦哄己瑕嗙洊鍥�") - window.divPoint9 = sgworld.Creator.createDivPoint('', { lon: degrees.lon, lat: degrees.lat, height: degrees.height }, { - type: "custom", - offset: ["c", 70], - description: prophtml4, - near: 0, - far: 50000, - onclick: function name() { - window.showtable = true; - window.nowAnalyze = true; - window.allowClick = true - if (window.imageidXT) { - window.Viewer.entities.removeById(window.imageidXT); - window.imageidXT = null; - } - if (!window.nowAnalyze) { - return; - } - let data = { - corverageType: 1, - coverageRedius_km: 100, - coverageThreshold: -100, - model: "2", - noiseTemp: 293, - rxAntGain_dBi: 10, - rxAntHeight: 10, - station: pick.id.properties.guid._value, - type: "1", - }; - const loading = Loading.service({ - lock: true, - text: "璁$畻涓�", - spinner: "el-icon-loading", - background: "rgba(0, 0, 0, 0.7)", - }); - intensity(data) - .then((res) => { - if (res.message === "Success") { - getbounds({ file: Base64.encode(res.data) }).then((res1) => { - if (res1.message === "Success") { - let points = res1.data.points; - let data = { - colorSchemes: 1, - file: Base64.encode(res.data), - maxColor: "FF0000", - maxValue: 100, - minColor: "0000FF", - minValue: 0, - }; - nowplay = Base64.encode(res.data); - createPic(data).then((res2) => { - if (res2.message === "Success") { - let rectangle = sgworld.Creator.addSimpleGraphic( - "rectangle", - { - removeEdit: true, - coordinates: Cesium.Rectangle.fromDegrees( - points[0].x, - points[0].y, - points[1].x, - points[1].y - ), - color: "rgba(255,255,255,0.5)", - image: - "http://221.224.53.36:9081/calc/picurl?file=" + - Base64.encode(res2.data), - } - ); - window.imageidXT = rectangle.id; - - loading.close(); - } - }); - } - }); - } - }) - .catch((error) => { - loading.close(); - }); - - - - - - - - - - - - setTimeout(function name() { - try { - window.divPoint8.deleteObject(); - window.divPoint9.deleteObject(); - window.divPoint10.deleteObject(); - } catch (e) { - - } - }, 100) - } - }); - - } + } + let pick = window.Viewer.scene.pick(movement.position) + console.log(pick) + if ( + pick && + pick.id && + pick.id.properties && + pick.id.properties.monstationName && + pick.id.properties.monstationGuid + ) { + let i = 0 + if (window.monstationGuidList.length == 0) { + window.monstationGuidList.push({ + name: pick.id.properties.monstationName._value, + id: pick.id.properties.monstationGuid._value + }) + bus.$emit('ismonstationGuid', window.monstationGuidList) } else { - try { - window.divPoint8.deleteObject(); - window.divPoint9.deleteObject(); - window.divPoint10.deleteObject(); - window.showtable = false - } catch (e) { } + window.monstationGuidList.forEach(item => { + if (pick.id.properties.monstationGuid._value == item.id) { + i++ + } + }) + if (i == 0) { + window.monstationGuidList.push({ + name: pick.id.properties.monstationName._value, + id: pick.id.properties.monstationGuid._value + }) + bus.$emit('ismonstationGuid', window.monstationGuidList) + } } - }, Cesium.ScreenSpaceEventType.RIGHT_CLICK); + } + // 閫変腑绯荤粺鍙扮珯 + if ( + pick && + pick.id && + pick.id.properties && + pick.id.properties._dataType && + pick.id.properties._dataType._value == 'XXTZ' + ) { + let i = 0 + debugger + if (window.stationList.length == 0) { + window.stationList.push({ + name: pick.id.properties._statName._value, + id: pick.id.properties._guid._value + }) + bus.$emit('showMoreTZ', window.stationList) + } else { + // 闃叉閲嶅 + window.stationList.forEach(item => { + if (pick.id.properties._guid._value == item.id) { + i++ + } + }) + if (i == 0) { + window.stationList.push({ + name: pick.id.properties._statName._value, + id: pick.id.properties._guid._value + }) + bus.$emit('showMoreTZ', window.stationList) + } + } + } + clearTimeout(timeoutID) + timeoutID = window.setTimeout(function () { + if (!window.showtable) { + } else { + bus.$emit('isFX', true) + if (Cesium.defined(pick) && pick.id && pick.id.properties) { + window.objform.monstationGuid = + pick.id.properties._monstationGuid._value + let data = [window.objform] + window.allowClick = false + showdataJCZ(data) + } + } + }, 200) + } + }, Cesium.ScreenSpaceEventType.LEFT_CLICK) + var divPoint3 + handlerMes.setInputAction(function (movement) { + clearTimeout(timeoutID) + if (divPoint3) { + divPoint3.deleteObject() + } + let pick = window.Viewer.scene.pick(movement.position) + if (Cesium.defined(pick) && pick.id && pick.id.properties) { + var prophtml = setEpidemicLayerInfoDomtj(pick.id.properties) + setInterval(function () { + $('body .closeclick').on('click', () => { + document.getElementsByClassName('tableContain')[0].style.display = + 'none' + }) + }, 1000) + if (pick.id.properties.statLg && pick.id.properties.statLa) { + var lng = pick.id.properties.statLg._value + var lat = pick.id.properties.statLa._value + } else if ( + pick.id.properties.monstationLg && + pick.id.properties.monstationLa + ) { + var lng = pick.id.properties.monstationLg._value + var lat = pick.id.properties.monstationLa._value + } + if ( + pick.id.properties && + pick.id.properties._monstationName && + pick.id.properties._monstationName._value == '浜戞捣' + ) { + lng = 121.444697 + lat = 31.21385 + } + if (movement.position) { + divPoint3 = sgworld.Creator.createDivPoint( + '', + { lon: lng, lat: lat, height: 105 }, + { + type: 'custom', + offset: ['c', 20], + description: prophtml, + near: 0, + far: 100000 + } + ) + } + } + }, Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK) } -// 鐩戞祴绔欒鐩栬瘎浼� -export function MonitoringStation(data) { - return request({ - url: 'calc/stationCover', - method: 'POST', - data: data + +// 鎶界鐩戞祴绔欏浘渚嬪垱寤轰簨浠� +export function showdataJCZ (data) { + const loading = Loading.service({ + lock: true, + text: '璁$畻涓�', + spinner: 'el-icon-loading', + background: 'rgba(0, 0, 0, 0.7)' + }) + MonitoringStation(data) + .then(res => { + if (res.message === 'Success') { + var positions = res.data.countorResVOList[0].points + var value = res.data.countorResVOList[0].areaResult + var positionsList = [] + for (var i = 0; i < positions.length; i++) { + positionsList.push(positions[i].lon, positions[i].lat) + } + let obj = { + name: window.analysisType, + value: value + } + bus.$emit('newData', obj) + createPloygon(positionsList) + loading.close() + } + }) + .catch(error => { + loading.close() }) } -window.JCZlist = []; -export function createPloygon(pos) { - viewer.scene.globe.depthTestAgainstTerrain = false; - var poly = viewer.entities.add({ - name: "JCZ", - polygon: { - hierarchy: Cesium.Cartesian3.fromDegreesArray(pos), - extrudedHeight: 1, - material: Cesium.Color.DARKSALMON.withAlpha(0.3), - outline: false, - outlineColor: Cesium.Color.RED, - arcType: Cesium.ArcType.RHUMB, - }, - polyline: { - positions: Cesium.Cartesian3.fromDegreesArray(pos), - width: 2, - material: Cesium.Color.RED - } - }); - window.JCZlist.push(poly); - +// 寮�鍚钩琛屽厜 +export function light () { + // Viewer.scene.light = new Cesium.DirectionalLight({ + // direction: new Cesium.Cartesian3(0, 0, -1), + // }); } -//鍙冲嚮鎸夐挳 -export function createHtmlRight(data) { - var html = ``; - html += `<div class="showRightClickBtn">` - html += `<button type="button">${data}</button>` - html += `</div>` - return html; -} -//鐩戞祴绔欏脊妗� -export function setEpidemicLayerInfoDomtj(marker) { - let tablename, tablevalue - if (marker.dataType._value == "XXTZ") { - tablename = ["鍙扮珯鍚嶇О", "鍙扮珯浣嶇疆", "澶╃嚎楂樺害(m)", "缁忓害[掳]", "缁村害[掳]", "鎺ユ敹璧峰棰戠巼[MHz]", "鎺ュ彈缁撴潫棰戠巼[MHz]", "鍙戝皠璧峰棰戠巼[MHz]", "鍙戝皠缁撴潫棰戠巼[MHz]", "鍔熺巼[dBm]"] - tablevalue = ["statName", "statAddr", "antHight", "statLg", "statLa", "freqUc", "freqEfb", "freqEfe", "freqEfe", "equPow"] +// 鍙冲嚮浜嬩欢 +let nowplay +export function addRightMouseEvent () { + // 鐐瑰嚮鑾峰彇淇℃伅 + let handler = new Cesium.ScreenSpaceEventHandler(window.Viewer.scene.canvas) + handler.setInputAction(function (movement) { + window.divPoint4 && window.divPoint4.deleteObject() + window.divPoint5 && window.divPoint5.deleteObject() + window.divPoint6 && window.divPoint6.deleteObject() + window.divPoint7 && window.divPoint7.deleteObject() + window.divPoint8 && window.divPoint8.deleteObject() + window.divPoint9 && window.divPoint9.deleteObject() + window.divPoint10 && window.divPoint10.deleteObject() + // 娓呴櫎涔嬪墠鐩戞祴绔欎簨浠� + if (window.JCZlist.length > 0) { + for (var j = 0; j < window.JCZlist.length; j++) { + viewer.entities.removeById(window.JCZlist[j].id) + } } - if (marker.dataType._value == "JCZ") { - tablename = ["鐩戞祴璁炬柦", "鐩戞祴璁惧", "瑕嗙洊鍗婂緞(km)", "璁惧鍨嬪彿", "璁惧鍚嶇О", "缁忓害[掳]", "缁村害[掳]", "鐩戞祴绔欎綅缃�",] - tablevalue = ["monstationName", "monstationEquName", "monstationLa", "monstationType", "monstationEquName", "monstationLg", "monstationLa", "monstationName"] - } - var html = ``; - html += `<div class="tableContain">` - html += `<div class="closeclick" >X</div>` - html += `<div class="tableinner">` - html += `<table id="mytable" cellspacing="0"> - <caption> </caption> `; - if (marker.propertyNames) { - for (var i = 0; i < tablename.length; i++) { - html += `<tr> - <td class="row">`+ tablename[i] + `</td> - <td class="row">`+ marker[tablevalue[i]]._value + `</td> - </tr>` + var pick = window.Viewer.scene.pick(movement.position) + let position = pick.id.position.getValue() + let degrees = sgworld.Core.toDegrees(position) + if (Cesium.defined(pick) && pick.id && pick.id.properties) { + window.showtable = true + if (pick.id.properties.dataType._value == 'JCZ') { + var lng = pick.id.properties.monstationLg._value + var lat = pick.id.properties.monstationLa._value + let prophtml = createHtmlRight('榛戝箍鎾洃娴嬭兘鍔�') + window.divPoint4 = sgworld.Creator.createDivPoint( + '', + { lon: degrees.lon, lat: degrees.lat, height: degrees.height }, + { + type: 'custom', + offset: ['c', 170], + description: prophtml, + near: 0, + far: 50000, + onclick: function () { + window.showtable = true + window.objform = { + analysisType: '榛戝箍鎾�', + areaResult: 99.83516631, + coverageThreshold: '-110', + freqPoint: 954, + frequency: 100, + modelName: '', + monFrequency: '', + monstationGuid: '2', + propModel: 2, + rxAntGain: 0, + rxAntHeight: 0, + txAntGain: 0, + txAntHeight: 20, + txFrequency: '', + txPower: 50 + } + window.objform.monstationGuid = + pick.id.properties._monstationGuid._value + let arrq = [window.objform] + showdataJCZ(arrq) + setTimeout(function name (params) { + try { + window.divPoint4.deleteObject() + window.divPoint5.deleteObject() + window.divPoint6.deleteObject() + window.divPoint7.deleteObject() + } catch (e) {} + }, 100) + } + } + ) + let prophtml1 = createHtmlRight('浼熀绔欑洃娴嬭兘鍔�') + window.divPoint5 = sgworld.Creator.createDivPoint( + '', + { lon: degrees.lon, lat: degrees.lat, height: degrees.height }, + { + type: 'custom', + offset: ['c', 120], + description: prophtml1, + near: 0, + far: 50000, + onclick: function name () { + window.showtable = true + window.objform = { + analysisType: '浼熀绔�', + areaResult: 10185.58366101, + coverageThreshold: '-110', + freqPoint: 100, + frequency: 954, + modelName: '', + monFrequency: '', + monstationGuid: '2', + propModel: 2, + rxAntGain: 0, + rxAntHeight: 0, + txAntGain: 0, + txAntHeight: 10, + txFrequency: '', + txPower: 40 + } + window.objform.monstationGuid = + pick.id.properties._monstationGuid._value + let arrq = [window.objform] + showdataJCZ(arrq) + setTimeout(function name (params) { + try { + window.divPoint4.deleteObject() + window.divPoint5.deleteObject() + window.divPoint6.deleteObject() + window.divPoint7.deleteObject() + } catch (e) {} + }, 100) + } + } + ) + let prophtml2 = createHtmlRight('澶╃嚎璧嬪舰鍥�') + let scale = 0.5 + window.divPoint6 = sgworld.Creator.createDivPoint( + '', + { lon: degrees.lon, lat: degrees.lat, height: degrees.height }, + { + type: 'custom', + offset: ['c', 20], + description: prophtml2, + near: 0, + far: 50000, + onclick: function name () { + if (window.FieldIntensity) { + window.FieldIntensity.deleteObject() + window.FieldIntensity = null + } + let height = degrees.height - 5 + // 鍒ゆ柇璧嬪舰鍥炬槸鍚﹂渶瑕佷慨鏀� + if ( + pick.id && + pick.id._properties && + pick.id._properties._monstationName && + pick.id._properties._monstationName._value + ) { + let cheak = pick.id._properties._monstationName._value + if ( + cheak.indexOf('灏忓瀷鐩戞祴绔�') == 0 || + cheak.indexOf('蹇儴寮忕洃娴嬬偣') == 0 + ) { + scale = 0.1 + height = degrees.height - 2 + } + if (cheak.indexOf('鐩戞祴杞�') == 0) { + scale = 0.3 + height = degrees.height - 2 + } + } + let url = './static/json/ant.json' + window.FieldIntensity = sgworld.Creator.FieldIntensity(url, { + center: [degrees.lon, degrees.lat, height], // 澶囩敤涓績鍧愭爣 + scale: scale + }) + setTimeout(function name (params) { + try { + window.divPoint4.deleteObject() + window.divPoint5.deleteObject() + window.divPoint6.deleteObject() + window.divPoint7.deleteObject() + } catch (e) {} + }, 100) + } + } + ) + let prophtml4 = createHtmlRight('瀵硅鏈虹洃娴嬭兘鍔�') + window.divPoint7 = sgworld.Creator.createDivPoint( + '', + { lon: degrees.lon, lat: degrees.lat, height: degrees.height }, + { + type: 'custom', + offset: ['c', 70], + description: prophtml4, + near: 0, + far: 50000, + onclick: function name () { + window.showtable = true + window.objform = { + analysisType: '瀵硅鏈�', + areaResult: 0.451125, + coverageThreshold: '-110', + freqPoint: 450, + frequency: 450, + modelName: '', + monFrequency: '', + monstationGuid: '2', + propModel: 2, + rxAntGain: 0, + rxAntHeight: 0, + txAntGain: 0, + txAntHeight: 2, + txFrequency: '', + txPower: 30 + } + window.objform.monstationGuid = + pick.id.properties._monstationGuid._value + let arrq = [window.objform] + showdataJCZ(arrq) + setTimeout(function name () { + try { + window.divPoint4.deleteObject() + window.divPoint5.deleteObject() + window.divPoint6.deleteObject() + window.divPoint7.deleteObject() + } catch (e) {} + }, 100) + } + } + ) + } + if (pick.id.properties.dataType._value == 'XXTZ') { + let prophtml1 = createHtmlRight('淇濇姢杞粨绾�') + window.divPoint10 = sgworld.Creator.createDivPoint( + '', + { lon: degrees.lon, lat: degrees.lat, height: degrees.height }, + { + type: 'custom', + offset: ['c', 20], + description: prophtml1, + near: 0, + far: 50000, + onclick: function name () { + setTimeout(function name (params) { + try { + window.divPoint8.deleteObject() + window.divPoint9.deleteObject() + window.divPoint10.deleteObject() + } catch (e) {} + }, 100) + } + } + ) + let prophtml2 = createHtmlRight('澶╃嚎璧嬪舰鍥�') + let scale = 3 + window.divPoint8 = sgworld.Creator.createDivPoint( + '', + { lon: degrees.lon, lat: degrees.lat, height: degrees.height + 10 }, + { + type: 'custom', + offset: ['c', 120], + description: prophtml2, + near: 0, + far: 50000, + onclick: function name () { + if (window.FieldIntensity) { + window.FieldIntensity.deleteObject() + window.FieldIntensity = null + } + let height = degrees.height - 5 + let url = './static/json/ant.json' + window.FieldIntensity = sgworld.Creator.FieldIntensity(url, { + center: [degrees.lon, degrees.lat, height], // 澶囩敤涓績鍧愭爣 + scale: scale + }) + setTimeout(function name (params) { + try { + window.divPoint8.deleteObject() + window.divPoint9.deleteObject() + window.divPoint10.deleteObject() + } catch (e) {} + }, 100) + } + } + ) + let prophtml4 = createHtmlRight('鍦哄己瑕嗙洊鍥�') + window.divPoint9 = sgworld.Creator.createDivPoint( + '', + { lon: degrees.lon, lat: degrees.lat, height: degrees.height }, + { + type: 'custom', + offset: ['c', 70], + description: prophtml4, + near: 0, + far: 50000, + onclick: function name () { + window.showtable = true + window.nowAnalyze = true + window.allowClick = true + if (window.imageidXT) { + window.Viewer.entities.removeById(window.imageidXT) + window.imageidXT = null + } + if (!window.nowAnalyze) { + return + } + let data = { + corverageType: 1, + coverageRedius_km: 100, + coverageThreshold: -100, + model: '2', + noiseTemp: 293, + rxAntGain_dBi: 10, + rxAntHeight: 10, + station: pick.id.properties.guid._value, + type: '1' + } + const loading = Loading.service({ + lock: true, + text: '璁$畻涓�', + spinner: 'el-icon-loading', + background: 'rgba(0, 0, 0, 0.7)' + }) + intensity(data) + .then(res => { + if (res.message === 'Success') { + getbounds({ file: Base64.encode(res.data) }).then(res1 => { + if (res1.message === 'Success') { + let points = res1.data.points + let data = { + colorSchemes: 1, + file: Base64.encode(res.data), + maxColor: 'FF0000', + maxValue: 100, + minColor: '0000FF', + minValue: 0 + } + nowplay = Base64.encode(res.data) + createPic(data).then(res2 => { + if (res2.message === 'Success') { + let rectangle = sgworld.Creator.addSimpleGraphic( + 'rectangle', + { + removeEdit: true, + coordinates: Cesium.Rectangle.fromDegrees( + points[0].x, + points[0].y, + points[1].x, + points[1].y + ), + color: 'rgba(255,255,255,0.5)', + image: + 'http://221.224.53.36:9081/calc/picurl?file=' + + Base64.encode(res2.data) + } + ) + window.imageidXT = rectangle.id - } + loading.close() + } + }) + } + }) + } + }) + .catch(error => { + loading.close() + }) + + setTimeout(function name () { + try { + window.divPoint8.deleteObject() + window.divPoint9.deleteObject() + window.divPoint10.deleteObject() + } catch (e) {} + }, 100) + } + } + ) + } } else { - for (var item in marker) { - html += `<tr> - <td class="row">`+ item + `</td> - <td class="row">`+ marker[item] + `</td> - </tr>` - } + try { + window.divPoint8.deleteObject() + window.divPoint9.deleteObject() + window.divPoint10.deleteObject() + window.showtable = false + } catch (e) {} } - html += `</table>`; - html += `</div>` - html += `</div>` + }, Cesium.ScreenSpaceEventType.RIGHT_CLICK) +} +// 鐩戞祴绔欒鐩栬瘎浼� +export function MonitoringStation (data) { + return request({ + url: 'calc/stationCover', + method: 'POST', + data: data + }) +} +window.JCZlist = [] +export function createPloygon (pos) { + viewer.scene.globe.depthTestAgainstTerrain = false + var poly = viewer.entities.add({ + name: 'JCZ', + polygon: { + hierarchy: Cesium.Cartesian3.fromDegreesArray(pos), + extrudedHeight: 1, + material: Cesium.Color.DARKSALMON.withAlpha(0.3), + outline: false, + outlineColor: Cesium.Color.RED, + arcType: Cesium.ArcType.RHUMB + }, + polyline: { + positions: Cesium.Cartesian3.fromDegreesArray(pos), + width: 2, + material: Cesium.Color.RED + } + }) + window.JCZlist.push(poly) +} +// 鍙冲嚮鎸夐挳 +export function createHtmlRight (data) { + var html = `` + html += `<div class="showRightClickBtn">` + html += `<button type="button">${data}</button>` + html += `</div>` + return html +} +// 鐩戞祴绔欏脊妗� +export function setEpidemicLayerInfoDomtj (marker) { + let tablename, tablevalue + if (marker.dataType._value == 'XXTZ') { + tablename = [ + '鍙扮珯鍚嶇О', + '鍙扮珯浣嶇疆', + '澶╃嚎楂樺害(m)', + '缁忓害[掳]', + '缁村害[掳]', + '鎺ユ敹璧峰棰戠巼[MHz]', + '鎺ュ彈缁撴潫棰戠巼[MHz]', + '鍙戝皠璧峰棰戠巼[MHz]', + '鍙戝皠缁撴潫棰戠巼[MHz]', + '鍔熺巼[dBm]' + ] + tablevalue = [ + 'statName', + 'statAddr', + 'antHight', + 'statLg', + 'statLa', + 'freqUc', + 'freqEfb', + 'freqEfe', + 'freqEfe', + 'equPow' + ] + } + if (marker.dataType._value == 'JCZ') { + tablename = [ + '鐩戞祴璁炬柦', + '鐩戞祴璁惧', + '瑕嗙洊鍗婂緞(km)', + '璁惧鍨嬪彿', + '璁惧鍚嶇О', + '缁忓害[掳]', + '缁村害[掳]', + '鐩戞祴绔欎綅缃�' + ] + tablevalue = [ + 'monstationName', + 'monstationEquName', + 'monstationLa', + 'monstationType', + 'monstationEquName', + 'monstationLg', + 'monstationLa', + 'monstationName' + ] + } + var html = `` + html += `<div class="tableContain">` + html += `<div class="closeclick" >X</div>` + html += `<div class="tableinner">` + html += `<table id="mytable" cellspacing="0"> + <caption> </caption> ` + if (marker.propertyNames) { + for (var i = 0; i < tablename.length; i++) { + html += + `<tr> + <td class="row">` + + tablename[i] + + `</td> + <td class="row">` + + marker[tablevalue[i]]._value + + `</td> + </tr>` + } + } else { + for (var item in marker) { + html += + `<tr> + <td class="row">` + + item + + `</td> + <td class="row">` + + marker[item] + + `</td> + </tr>` + } + } + html += `</table>` + html += `</div>` + html += `</div>` - - return html; - + return html } // mpt鍦板舰 let mptYx -export function addMpt(bollean) { - if (bollean) { - mptYx ? mptYx.deleteObject() : ""; - mptYx = null - var option = { - url: "http://183.162.245.49:82/SG/Elevation", - layerName: "gz0920.414509", - requestVertexNormals: true, - }; - mptYx = sgworld.Creator.sfsterrainprovider("", option, "", true, ""); - } else { - mptYx ? mptYx.deleteObject() : ""; - mptYx = null - return - } +export function addMpt (bollean) { + if (bollean) { + Viewer.terrainProvider = Cesium.createWorldTerrain() + + // mptYx ? mptYx.deleteObject() : ""; + // mptYx = null + // var option = { + // url: "http://183.162.245.49:82/SG/Elevation", + // layerName: "gz0920.414509", + // requestVertexNormals: true, + // }; + // mptYx = sgworld.Creator.sfsterrainprovider("", option, "", true, ""); + } else { + mptYx ? mptYx.deleteObject() : '' + mptYx = null + Viewer.terrainProvider = new Cesium.EllipsoidTerrainProvider({}) + } } -//鐩戝惉鎸夐挳浜嬩欢 +// 鐩戝惉鎸夐挳浜嬩欢 let status -export function SPPM() { - tedp.trame.subStyle = { - left: "1446px", - top: "2100px" - } - window.addEventListener("keydown", - (event) => { - if (event.keyCode === 122) { - event.preventDefault(); - var el = document.documentElement; - var rfs = el.requestFullScreen || el.webkitRequestFullScreen || el.mozRequestFullScreen || el.msRequestFullScreen;//瀹氫箟涓嶅悓娴忚鍣ㄧ殑鍏ㄥ睆API - //鎵ц鍏ㄥ睆 - if (typeof rfs != "undefined" && rfs) { - rfs.call(el); - } else if (typeof window.ActiveXObject != "undefined") { - var wscript = new ActiveXObject("WScript.Shell"); - if (wscript != null) { - wscript.SendKeys("{F11}"); - } - } - - //鐩戝惉涓嶅悓娴忚鍣ㄧ殑鍏ㄥ睆浜嬩欢锛屽苟浠舵墽琛岀浉搴旂殑浠g爜 - document.addEventListener("webkitfullscreenchange", function () {// - if (document.webkitIsFullScreen) { - //鍏ㄥ睆鍚庤鎵ц鐨勪唬鐮� - tedp.trame.subStyle = { - left: "1446px", - top: "2420px" - } - document.getElementsByClassName("container")[0].style.height = "2200px" - document.getElementsByClassName("containerBtn")[0].style.top = "2300px" - status = false - } else { - tedp.trame.subStyle = { - left: "1446px", - top: "2120px" - } - //閫�鍑哄叏灞忓悗鎵ц鐨勪唬鐮� - document.getElementsByClassName("container")[0].style.height = "1900px" - document.getElementsByClassName("containerBtn")[0].style.top = "1980px" - } - }, false); - } - }, true) -} - -export function addnewPoint(position, name) { - var gltfurl = "./static/gltf/JCZ.glb"; - var position = new Cesium.Cartesian3.fromDegrees(position.x, position.y, 0); - loadGLTF(gltfurl, position, 1) - let dataSource - var pixelO = (name.length / 2 * 20) + 35 - dataSource.entities.add(new Cesium.Entity({ - position: Cesium.Cartesian3.fromDegrees(position.x, position.y, 10), - label: { - showBackground: true, - backgroundColor: new Cesium.Color.fromCssColorString("#000").withAlpha(0.3), - text: name, - font: "15px Helvetica", - fillColor: Cesium.Color.fromCssColorString("#6CFF00"), - pixelOffset: new Cesium.Cartesian2(pixelO, 0), - style: Cesium.LabelStyle.FILL_AND_OUTLINE, - disableDepthTestDistance: Number.POSITIVE_INFINITY, - distanceDisplayCondition: new Cesium.DistanceDisplayCondition(10, 1000000) - }, - billboard: { - image: billboardImage, - disableDepthTestDistance: Number.POSITIVE_INFINITY, - width: 40, // default: undefined - height: 40, - distanceDisplayCondition: new Cesium.DistanceDisplayCondition(10, 1000000) - - }, - properties: "", - })); - window.createTool = false -} -//浜戞捣寤虹瓚 -let yunhaimode1 -export function loadYH() { - let url = "http://183.162.245.49:8099/SHdata/yunhai_3dtile/tileset.json" - yunhaimode1 = sgworld.Creator.create3DTilesets("", url, {}, { - }, "0", true, (data) => { - }); -} - -//缁樺埗澶氳竟褰� -export function drawPolygon() { - window.datatype && viewer.entities.remove(window.datatype) - let polygom = sgworld.Creator.createSimpleGraphic('rectangle', { showSize: true, color: "rgba(108,167,247,0.3)" }, function (entity) { - debugger - window.datatype = entity - var pointsList = []; - var ellipsoid = entity.rectangle.coordinates.getValue() - for (let i in ellipsoid) { - let position = Cesium.Math.toDegrees(ellipsoid[i]) - pointsList.push(position); +export function SPPM () { + tedp.trame.subStyle = { + left: '1446px', + top: '2100px' + } + window.addEventListener( + 'keydown', + event => { + if (event.keyCode === 122) { + event.preventDefault() + var el = document.documentElement + var rfs = + el.requestFullScreen || + el.webkitRequestFullScreen || + el.mozRequestFullScreen || + el.msRequestFullScreen // 瀹氫箟涓嶅悓娴忚鍣ㄧ殑鍏ㄥ睆API + // 鎵ц鍏ㄥ睆 + if (typeof rfs !== 'undefined' && rfs) { + rfs.call(el) + } else if (typeof window.ActiveXObject !== 'undefined') { + var wscript = new ActiveXObject('WScript.Shell') + if (wscript != null) { + wscript.SendKeys('{F11}') + } } - pointsList = [[pointsList[1], pointsList[0]], [pointsList[1], pointsList[2]], [pointsList[3], pointsList[2]], [pointsList[3], pointsList[0]]] - bus.$emit("isdp", pointsList); - }); + // 鐩戝惉涓嶅悓娴忚鍣ㄧ殑鍏ㄥ睆浜嬩欢锛屽苟浠舵墽琛岀浉搴旂殑浠g爜 + document.addEventListener( + 'webkitfullscreenchange', + function () { + // + if (document.webkitIsFullScreen) { + // 鍏ㄥ睆鍚庤鎵ц鐨勪唬鐮� + tedp.trame.subStyle = { + left: '1446px', + top: '2420px' + } + document.getElementsByClassName('container')[0].style.height = + '2200px' + document.getElementsByClassName('containerBtn')[0].style.top = + '2300px' + status = false + } else { + tedp.trame.subStyle = { + left: '1446px', + top: '2120px' + } + // 閫�鍑哄叏灞忓悗鎵ц鐨勪唬鐮� + document.getElementsByClassName('container')[0].style.height = + '1900px' + document.getElementsByClassName('containerBtn')[0].style.top = + '1980px' + } + }, + false + ) + } + }, + true + ) } +export function addnewPoint (position, name) { + var gltfurl = './static/gltf/JCZ.glb' + var position = new Cesium.Cartesian3.fromDegrees(position.x, position.y, 0) + loadGLTF(gltfurl, position, 1) + let dataSource + var pixelO = (name.length / 2) * 20 + 35 + dataSource.entities.add( + new Cesium.Entity({ + position: Cesium.Cartesian3.fromDegrees(position.x, position.y, 10), + label: { + showBackground: true, + backgroundColor: new Cesium.Color.fromCssColorString('#000').withAlpha( + 0.3 + ), + text: name, + font: '15px Helvetica', + fillColor: Cesium.Color.fromCssColorString('#6CFF00'), + pixelOffset: new Cesium.Cartesian2(pixelO, 0), + style: Cesium.LabelStyle.FILL_AND_OUTLINE, + disableDepthTestDistance: Number.POSITIVE_INFINITY, + distanceDisplayCondition: new Cesium.DistanceDisplayCondition( + 10, + 1000000 + ) + }, + billboard: { + image: billboardImage, + disableDepthTestDistance: Number.POSITIVE_INFINITY, + width: 40, // default: undefined + height: 40, + distanceDisplayCondition: new Cesium.DistanceDisplayCondition( + 10, + 1000000 + ) + }, + properties: '' + }) + ) + window.createTool = false +} +// 浜戞捣寤虹瓚 +let yunhaimode1 +export function loadYH () { + let url = 'http://183.162.245.49:8099/SHdata/yunhai_3dtile/tileset.json' + yunhaimode1 = sgworld.Creator.create3DTilesets( + '', + url, + {}, + {}, + '0', + true, + data => {} + ) +} - +// 缁樺埗澶氳竟褰� +export function drawPolygon () { + window.datatype && viewer.entities.remove(window.datatype) + let polygom = sgworld.Creator.createSimpleGraphic( + 'rectangle', + { showSize: true, color: 'rgba(108,167,247,0.3)' }, + function (entity) { + debugger + window.datatype = entity + var pointsList = [] + var ellipsoid = entity.rectangle.coordinates.getValue() + for (let i in ellipsoid) { + let position = Cesium.Math.toDegrees(ellipsoid[i]) + pointsList.push(position) + } + pointsList = [ + [pointsList[1], pointsList[0]], + [pointsList[1], pointsList[2]], + [pointsList[3], pointsList[2]], + [pointsList[3], pointsList[0]] + ] + bus.$emit('isdp', pointsList) + } + ) +} -- Gitblit v1.9.3