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'
|
|
// 白膜
|
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'
|
|
let url6 = 'http://183.162.245.49:8099/SHdata/GZ_BM_3DTILE1/tileset.json' // 广州白膜
|
|
let url7 = 'http://183.162.245.49:8099/SHdata/LJZJM3DTILES/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
|
}
|
// 初始添加注记
|
}
|
// 水系
|
// 点
|
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 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()
|
}
|
}
|
}
|
} 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)
|
|
// viewer.trackedEntity = model;
|
}
|
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)
|
|
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)
|
}
|
}, 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 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)
|
}
|
}
|
)
|
}
|
} else {
|
try {
|
window.divPoint8.deleteObject()
|
window.divPoint9.deleteObject()
|
window.divPoint10.deleteObject()
|
window.showtable = false
|
} catch (e) {}
|
}
|
}, 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
|
}
|
// mpt地形
|
let mptYx
|
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}')
|
}
|
}
|
|
// 监听不同浏览器的全屏事件,并件执行相应的代码
|
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)
|
}
|
)
|
}
|