var layer_xingzhengqu_100;
|
var layer_sifasuo_101;
|
var layer_shequjiaozheng_102;
|
var layer_anzhibangjiao_103;
|
var layer_renmintiaojie_104;
|
var layer_pudong_gltf_200;
|
var layer_shanghai_tiles_201;
|
var layer_shanghai_roads_202;
|
var layer_sifaju_effect_203;
|
var layer_shanghai_mask_300;
|
var pci_data = [];
|
var MR_data = [];
|
var MR_msisdn1;
|
var MR_msisdn2;
|
var MR_msisdn3;
|
var msisdn_list;
|
var msisdn_id_list = [];
|
var msisdn_name = [];
|
var point_list = [];
|
var open_merge_list = [];
|
var new_msisdn_list = [];
|
var data_yn = '';
|
var repoint_list = [];
|
var repoint_id_list = [];
|
var repoint_name = [];
|
var floor_linght = []
|
var floor_position_light = []
|
var floor_position_light2 = []
|
var model_list = [];
|
var light_graphic_list = [];
|
var color_boxs = $("#color_boxs")
|
var new_msisdn_position = []
|
var msisdn_msg = []
|
var floor_position_points = []
|
var floor_position_floor = []
|
var graphicLayer17
|
var points17 = []
|
var initGraphic
|
var polinlayer1
|
// import data from '../data/sites.js'
|
var get_JSON = {
|
ruijin_url:"http://localhost:4500/dataservice/Bdata?bid="
|
}
|
// 页面初始化,创建楼层按键
|
$(document).ready(function(){
|
var btn_box_html = ''
|
for(let i=1;i<23;i++){
|
btn_box_html += `<button style="margin-right:4px;" class="${i}">F${i}</button>`
|
}
|
$("#building_btn").append(btn_box_html)
|
// $.ajax({
|
// type: 'get',
|
// dataType: 'json',
|
// async: true,//同步
|
// url: `http://localhost:4500/dataservice/Bdata?bid=get_msisdn_msg`,
|
// success:function(data){
|
// console.log(data.data.data,"msisdn")
|
// msisdn_msg = data.data.data
|
// for(let i=0;i<msisdn_msg.length;i++){
|
// floor_position_floor[i] = []
|
// }
|
// },
|
// error: function (request, textStatus) {
|
|
// }
|
// })
|
$.getJSON('data/msisdn_list.json',(result)=>{
|
|
console.log("e")
|
let data = result.RECORDS
|
console.log(data)
|
msisdn_list = data
|
for(let i=0;i<msisdn_list.length;i++){
|
floor_linght[i] = []
|
}
|
console.log(floor_linght)
|
})
|
|
$.getJSON('data/msisdn_position.json',(result)=>{
|
console.log(result.data,"data")
|
MR_data = result.data;
|
if(MR_data.length>=0){
|
data_yn = '<p>定位运行</p>'
|
}else{
|
data_yn = '<p>暂无数据</p>'
|
}
|
$("#data_yn").append(data_yn)
|
for(let i=0;i<msisdn_list.length;i++){
|
msisdn_name[i] = `graphic_msisdn${i}`
|
msisdn_id_list[i] = MR_data.filter(item=>{
|
return item.msisdn == msisdn_list[i].msisdn
|
})
|
}
|
})
|
$.getJSON('data/repoint.json',(result)=>{
|
console.log("eeee")
|
repoint_list = result.data;
|
for(let i=0;i<repoint_list.length;i++){
|
if(Number(repoint_list[i].lat)<31.211869869520108){
|
repoint_list[i].lat = 31.211869869520108
|
}
|
}
|
for(let i=0;i<msisdn_list.length;i++){
|
repoint_name[i] = `graphic_msisdn${i}`
|
repoint_id_list[i] = repoint_list.filter(item=>{
|
return item.msisdn == msisdn_list[i].msisdn
|
})
|
}
|
for(let i=0;i<floor_linght.length;i++){
|
for(let j=0;j<22;j++){
|
floor_linght[i][j] = msisdn_id_list[i].filter(item=>{
|
return finalHeight2(item.height) == j
|
})
|
}
|
}
|
console.log(floor_linght)
|
})
|
|
// $.ajax({
|
// type:'get',
|
// dataType:'json',
|
// async:true,
|
// url:'http://localhost:4500/dataservice/Bdata?bid=get_ruijin_outside&floor_=7',
|
// success:function(data){
|
// console.log("e")
|
// let datas = data.data.data
|
// console.log(datas)
|
// for(let i=0;i<datas.length;i++){
|
// let item = datas[i]
|
// points17[i] = [item.lon,item.lat]
|
// }
|
|
// const graphic_17 = new mars3d.graphic.WallEntity({
|
// positions:points17,
|
// style: {
|
// closure: true,
|
// diffHeight: 2,
|
// }
|
// })
|
// graphicLayer17.addGraphic(graphic_17)
|
|
|
// }
|
// })
|
|
})
|
//
|
|
var current=null
|
function getEvent()
|
{
|
if(document.all)
|
{
|
return window.event;//如果是ie
|
}
|
func=getEvent.caller;
|
while(func!=null)
|
{
|
var arg0=func.arguments[0];
|
if(arg0)
|
{
|
if((arg0.constructor==Event || arg0.constructor ==MouseEvent)||(typeof(arg0)=="object" && arg0.preventDefault && arg0.stopPropagation))
|
{
|
return arg0;
|
}
|
}
|
func=func.caller;
|
}
|
return null;
|
}
|
|
function doOver() {
|
var evt=getEvent();
|
var element=evt.srcElement || evt.target;
|
var DisColor=document.getElementById("DisColor");
|
var HexColor=document.getElementById("HexColor");
|
if ((element.tagName=="TD") && (current!=element)) {
|
if (current!=null){
|
current.style.backgroundColor = current._background
|
}
|
element._background = element.style.backgroundColor
|
DisColor.style.backgroundColor = rgbToHex(element.style.backgroundColor)
|
HexColor.value = rgbToHex(element.style.backgroundColor)
|
element.style.backgroundColor = "white"
|
current = element
|
}
|
}
|
function rgbToHex(aa)
|
{
|
if(aa.indexOf("rgb") != -1)
|
{
|
aa=aa.replace("rgb(","")
|
aa=aa.replace(")","")
|
aa=aa.split(",")
|
r=parseInt(aa[0]);
|
g=parseInt(aa[1]);
|
b=parseInt(aa[2]);
|
r = r.toString(16);
|
if (r.length == 1) { r = '0' + r; }
|
g = g.toString(16);
|
if (g.length == 1) { g = '0' + g; }
|
b = b.toString(16);
|
if (b.length == 1) { b = '0' + b; }
|
return ("#" + r + g + b).toUpperCase();
|
}
|
else
|
{
|
return aa;
|
}
|
}
|
|
// 通过获取到的数据进行创建设备定位点和路线
|
function addMsisdnPoint(){
|
|
console.log(msisdn_id_list)
|
for(let i=0;i<msisdn_id_list.length;i++){
|
|
msisdn_position(msisdn_id_list[i],msisdn_name[i],`msisdn_graphic${i}`,msisdn_list[i].name_,"img/end.png")
|
// msisdn_position(repoint_id_list[i],repoint_name[i],`repoint_graphic${i}`,msisdn_list[i].name_,"img/start.png")
|
}
|
// for(let i=0;i<)
|
if(floor_linght.length>0){
|
for(let i=0;i<floor_linght.length;i++){
|
for(let j=0;j<22;j++){
|
msisdn_light(floor_linght[i][j],`msisdn_graphic${i}`,`#00${i}${i}${i}${i}`,"img/textures/arrow2.png",0,floor_position_light)
|
msisdn_light2(floor_linght[i][j],`msisdn_graphic${i}`,`#00${i}${i}${i}${i}`,"img/textures/arrow2.png",15*(j-1),floor_position_light2)
|
}
|
}
|
}
|
|
console.log(floor_position_light[0].points[0])
|
}
|
|
// 将获得的数据高度转换成适应大楼模型的高度
|
function finalHeight(h){
|
// let h1 = Number(h)/2.8
|
// let h2 = Math.floor(h1)-1
|
// let h3 = h2*3
|
// return h3
|
let h1 = Number(h)
|
let h2 = 0
|
let h3 = 0
|
let h4 = 0
|
let h5 = 0
|
if(h1<=4.5){
|
h5 = 1
|
}else{
|
h2 = h1-4.5-1
|
h3 = h2/2.8
|
h4 = Math.floor(h3)+2
|
h5 = h4*3
|
}
|
|
return h5
|
}
|
function finalHeight2(h){
|
let h1 = Number(h)/2.8
|
let h2 = Math.floor(h1)-1
|
return h2
|
|
}
|
function light_graphic(code){
|
var light_graphic = name_ = new mars3d.layer.GraphicLayer({
|
id:code,
|
pid:104,
|
name:code,
|
show:true
|
})
|
light_graphic_list.push(light_graphic)
|
map.addLayer(light_graphic)
|
}
|
// 封装设备定位曲线的创建方法
|
function msisdn_light(data,map_name_,color,image_url,hh=0,arr_){
|
var polinlayer = new mars3d.layer.GraphicLayer({
|
pid:104,
|
// name:code,
|
show:false
|
})
|
map.addLayer(polinlayer)
|
let len = data.length
|
for (let i = 0; i < len-1; i++) {
|
let item = data[i];
|
// 分别计算出两个点的高
|
let h1 = finalHeight(data[i]["height"])+hh
|
let h2 = finalHeight(data[i+1]["height"])+hh
|
// 设置开始和技术点,两点确定一条直线
|
let startPoint = Cesium.Cartesian3.fromDegrees(data[i]["lon"], data[i]["lat"], h1)
|
let endPoint = Cesium.Cartesian3.fromDegrees(data[i+1]["lon"], data[i+1]["lat"], h2)
|
map_name_ = new mars3d.graphic.PolylineEntity({
|
positions: [startPoint,endPoint],
|
style: {
|
width: 5,
|
// 动画线材质
|
material: mars3d.MaterialUtil.createMaterialProperty(mars3d.MaterialType.LineFlow, {
|
color: color,
|
image: image_url,
|
speed: 5,
|
repeat: new Cesium.Cartesian2(15, 1)
|
})
|
},
|
hsaEdit:true,
|
hasHeightEdit:true
|
})
|
polinlayer.addGraphic(map_name_)
|
arr_.push(map_name_)
|
}
|
}
|
function msisdn_light2(data,map_name_,color,image_url,hh=0,arr_){
|
polinlayer1 = new mars3d.layer.GraphicLayer({
|
pid:104,
|
// name:code,
|
show:false
|
})
|
map.addLayer(polinlayer1)
|
let len = data.length
|
for (let i = 0; i < len-1; i++) {
|
let item = data[i];
|
// 分别计算出两个点的高
|
let h1 = finalHeight(data[i]["height"])+hh
|
let h2 = finalHeight(data[i+1]["height"])+hh
|
// 设置开始和技术点,两点确定一条直线
|
let startPoint = Cesium.Cartesian3.fromDegrees(data[i]["lon"], data[i]["lat"], h1)
|
let endPoint = Cesium.Cartesian3.fromDegrees(data[i+1]["lon"], data[i+1]["lat"], h2)
|
map_name_ = new mars3d.graphic.PolylineEntity({
|
positions: [startPoint,endPoint],
|
style: {
|
width: 5,
|
// 动画线材质
|
material: mars3d.MaterialUtil.createMaterialProperty(mars3d.MaterialType.LineFlow, {
|
color: color,
|
image: image_url,
|
speed: 5,
|
repeat: new Cesium.Cartesian2(15, 1)
|
})
|
},
|
hsaEdit:true,
|
hasHeightEdit:true
|
})
|
arr_.push(map_name_)
|
}
|
}
|
function showHistoryPathDetail(itemname,itemid,itemfloor) {
|
|
if (mars3d.widget.isActivate("widgets/rruRouterReplay/widget.js")) {
|
var detailWiget = mars3d.widget.getClass("widgets/rruRouterReplay/widget.js");
|
detailWiget.reloadData({
|
"id":itemid,
|
"name":itemname,
|
"floor":itemfloor
|
});
|
} else {
|
mars3d.widget.activate({
|
uri: "widgets/rruRouterReplay/widget.js",
|
params: {
|
"id":itemid,
|
"name":itemname,
|
"floor":itemfloor
|
}
|
});
|
}
|
}
|
// 封装设备定位点的方法
|
function msisdn_position(data,name_,map_name_,code,image_url){
|
name_ = new mars3d.layer.GraphicLayer({
|
pid:155,
|
name:code,
|
show:true
|
})
|
map.addLayer(name_)
|
for(let i=0;i<data.length;i++){
|
let item = data[i]
|
let height = finalHeight(item.height)
|
map_name_ = new mars3d.graphic.BillboardEntity({
|
position: [Number(item.lon), Number(item.lat),height], // 楼栋位置
|
style: {
|
image: image_url,
|
scale:0.5,
|
opacity:1,
|
scaleByDistance_far:500,
|
distanceDisplayCondition_far:500,
|
scaleByDistance_farValue:0.5,
|
scaleByDistance:true,
|
visibleDepth:true,
|
hasPixelOffset:false,
|
distanceDisplayCondition:true,
|
label:{
|
text:item.index_,
|
color:"#ffff00",
|
font_size: 15,
|
pixelOffsetY: -20,
|
distanceDisplayCondition: true,
|
distanceDisplayCondition_far: 1500,
|
distanceDisplayCondition_near: 0
|
}
|
},
|
|
popup:"编号:" +
|
item["msisdn"] +
|
"<br />时间:" +
|
item["id"] +
|
"<br />名称:" +
|
item["name_"] +
|
"<br/><p><a href='#' onclick='javascript:showHistoryPathDetail(" + item["msisdn"] + ",\"" + item["name_"] + "\",\"" + item["height"] + "\")' >轨迹查询</a></p>"
|
})
|
name_.addGraphic(map_name_)
|
point_list.push(map_name_)
|
}
|
}
|
|
function addpoint17(){
|
graphicLayer17 = new mars3d.layer.GraphicLayer()
|
map.addLayer(graphicLayer17)
|
|
|
}
|
|
function mr_rode(){
|
console.log(model_list)
|
console.log(new_msisdn_position,msisdn_msg)
|
|
}
|
|
|
function floor_height(h){
|
let x = (h+15)/18
|
return x
|
}
|
|
// 瑞金大楼的创建和对其进行的操作
|
function openFloor(){
|
var num = 0;
|
var openfl = false;
|
var height_list = [];
|
initGraphic = new mars3d.layer.GraphicLayer({
|
pid:155,
|
name:"路径",
|
show:true
|
})
|
map.addLayer(initGraphic)
|
// 切换楼层颜色
|
|
// 调色板,用于调整大楼外部颜色
|
|
// 展开楼层
|
$(".open2").click(function(e){
|
mr_rode()
|
console.log(floor_position_light,"展开前")
|
let point_arr = new_msisdn_list.length>0?new_msisdn_list:point_list
|
for(let i=0;i<point_arr.length;i++){
|
let floor = point_arr[i].options.position[2]/3
|
console.log(floor,"floor")
|
if(floor>1){
|
point_arr[i].addDynamicPosition([point_arr[i].options.position[0],point_arr[i].options.position[1],point_arr[i].options.position[2]+15*(floor-1)])
|
}
|
|
}
|
for(let i = 1;i<model_list.length;i++){
|
if(i<7){
|
model_list[i].moveTo({
|
position:[model_list[i].options.position[0],model_list[i].options.position[1],model_list[i].options.position[2]+15*i]
|
})
|
}else{
|
model_list[i].moveTo({
|
position:[model_list[i].options.position[0],model_list[i].options.position[1],model_list[i].options.position[2]+15*(i-1)]
|
})
|
}
|
}
|
for(let i=0;i<floor_position_light.length;i++){
|
floor_position_light[i].remove()
|
}
|
for(let i=0;i<floor_position_light2.length;i++){
|
polinlayer1.addGraphic(floor_position_light2[i])
|
}
|
|
console.log(floor_position_light,"展开后")
|
})
|
// 合并楼层
|
$(".merge").click(function(){
|
for(let i=0;i<floor_position_light2.length;i++){
|
floor_position_light2[i].remove()
|
}
|
for(let i=0;i<point_list.length;i++){
|
point_list[i].addDynamicPosition([point_list[i].options.position[0],point_list[i].options.position[1],point_list[i].options.position[2]])
|
}
|
for(let i = 1;i<model_list.length;i++){
|
model_list[i].moveTo({
|
position:[model_list[i].options.position[0],model_list[i].options.position[1],model_list[i].options.position[2]]
|
})
|
}
|
for(let i=0;i<floor_position_light.length;i++){
|
floor_position_light[i].addTo(initGraphic)
|
}
|
})
|
// 显示全部
|
$(".hide_").click(function(){
|
for(let i=0;i<model_list.length;i++){
|
model_list[i].show = true
|
}
|
for(let i=0;i<point_list.length;i++){
|
new_msisdn_list = []
|
point_list[i].setStyle({
|
opacity:1,
|
label:{
|
opacity:1
|
}
|
})
|
|
new_msisdn_list.push(point_list[i])
|
}
|
})
|
// 切换按钮,显示与隐藏调色盘
|
$(".change").click(function(){
|
$("#color_boxs").toggle();
|
})
|
// 选取按钮,点击按钮显示相应楼层
|
var button_button = $("button")
|
button_button.click(function(e){
|
new_msisdn_list = []
|
// console.log(new_msisdn_list,"opacity")
|
// 六楼以下楼层对应相应的按钮,六层时把五楼楼顶和六楼同时隐藏,六楼以上按钮对应到楼层加一
|
$(this).addClass('red')
|
$(this).siblings('button').removeClass('red')
|
let floor_ = e.target.className
|
// let floor_end = Number(floor_)
|
let floor_end = Number(floor_.slice(0,-3))
|
if(floor_end){
|
for(let i=0;i<point_list.length;i++){
|
new_msisdn_list= []
|
let floor = Number(point_list[i].options.position[2])/3
|
// let floor_1 = Math.floor(floor)
|
// console.log(floor_end,floor)
|
if(floor_end < floor){
|
point_list[i].setStyle({
|
opacity:0,
|
label:{
|
opacity:0
|
}
|
})
|
}else{
|
point_list[i].setStyle({
|
opacity:1,
|
label:{
|
opacity:1
|
}
|
})
|
}
|
new_msisdn_list.push(point_list[i])
|
}
|
for(let i=0;i<floor_position_light.length;i++){
|
let floor = Number(floor_position_light[i].points[0]._alt)/3
|
// console.log(floor,"floor")
|
if(floor_end < floor){
|
floor_position_light[i].setStyle({
|
width:0
|
})
|
}else{
|
floor_position_light[i].setStyle({
|
width:5
|
})
|
}
|
}
|
for(let i=0;i<floor_position_light2.length;i++){
|
let floor_2 = floor_height(Number(floor_position_light2[i].points[0]._alt))
|
let floor = floor_2
|
if(floor_end < floor_2){
|
floor_position_light2[i].setStyle({
|
width:0
|
})
|
}else{
|
floor_position_light2[i].setStyle({
|
width:5
|
})
|
}
|
|
}
|
if(floor_end<7){
|
|
for(let i=1;i<floor_end+1;i++){
|
model_list[i].show = true
|
}
|
for(let j=floor_end;j<model_list.length;j++){
|
model_list[j].show = false
|
}
|
|
}else if(floor_end == 7){
|
for(let i=1;i<8;i++){
|
model_list[i].show = true
|
}
|
for(let j=8;j<model_list.length;j++){
|
model_list[j].show = false
|
}
|
}else{
|
for(let i=1;i<floor_end+1;i++){
|
model_list[i+1].show = true
|
}
|
for(let j=floor_end;j<model_list.length+1;j++){
|
model_list[j+1].show = false
|
}
|
}
|
}
|
|
|
console.log("完成")
|
|
})
|
|
|
|
var model_lon = 121.462091;
|
var model_lat = 31.212238;
|
var heading_ = 165
|
// 添加医院大楼模型
|
const graphicLayer = new mars3d.layer.GraphicLayer({
|
id: 203,
|
pid: 98,
|
name: "上海瑞金医院",
|
show: true,
|
flyTo:false
|
})
|
map.addLayer(graphicLayer)
|
floorGraphic1 = new mars3d.graphic.ModelEntity({
|
position: [model_lon, model_lat, 0], // 楼栋位置
|
style: {
|
scale:1,
|
distanceDisplayCondition_far:100,
|
url: "./gltf/Ruijin2/F1.gltf",
|
heading: heading_,
|
color:"#ffff00",
|
fill:true
|
},
|
popup:`<p>一楼</p>`,
|
rotation:{x:0,y:0,z:180}
|
})
|
floorGraphic2 = new mars3d.graphic.ModelEntity({
|
|
position: [model_lon,model_lat, 0], // 楼栋位置
|
style: {
|
scale:1,
|
distanceDisplayCondition_far:100,
|
url: "./gltf/Ruijin2/F2.gltf",
|
heading: heading_,
|
color:"#ffff00",
|
fill:true
|
},
|
popup:`<p>二楼</p>`,
|
rotation:{x:0,y:0,z:180}
|
})
|
floorGraphic3 = new mars3d.graphic.ModelEntity({
|
|
position: [model_lon,model_lat, 0], // 楼栋位置
|
style: {
|
scale:1,
|
distanceDisplayCondition_far:100,
|
url: "./gltf/Ruijin2/F3-5.gltf",
|
heading: heading_,
|
color:"#ffff00",
|
fill:true
|
},
|
popup:`<p>三楼</p>`,
|
rotation:{x:0,y:0,z:180}
|
})
|
floorGraphic4 = new mars3d.graphic.ModelEntity({
|
|
position: [model_lon,model_lat, 2.8], // 楼栋位置
|
style: {
|
scale:1,
|
distanceDisplayCondition_far:100,
|
url: "./gltf/Ruijin2/F3-5.gltf",
|
heading: heading_,
|
color:"#ffff00",
|
fill:true
|
},
|
popup:`<p>四楼</p>`,
|
rotation:{x:0,y:0,z:180}
|
})
|
floorGraphic5 = new mars3d.graphic.ModelEntity({
|
|
position: [model_lon,model_lat, 5.6], // 楼栋位置
|
style: {
|
scale:1,
|
distanceDisplayCondition_far:100,
|
url: "./gltf/Ruijin2/F3-5.gltf",
|
heading: heading_,
|
color:"#ffff00",
|
fill:true
|
},
|
popup:`<p>五楼</p>`,
|
rotation:{x:0,y:0,z:180}
|
})
|
floorGraphic6 = new mars3d.graphic.ModelEntity({
|
|
position: [model_lon,model_lat, 8.4], // 楼栋位置
|
style: {
|
scale:1,
|
distanceDisplayCondition_far:100,
|
url: "./gltf/Ruijin2/F3-5.gltf",
|
heading: heading_,
|
color:"#ffff00",
|
fill:true
|
},
|
|
rotation:{x:0,y:0,z:180}
|
})
|
floorGraphic7 = new mars3d.graphic.ModelEntity({
|
|
position: [model_lon,model_lat, 1.8], // 楼栋位置
|
style: {
|
scale:1,
|
url: "./gltf/Ruijin2/F5-roof.gltf",
|
heading: heading_,
|
color:"#ffff00",
|
fill:true
|
},
|
popup:`<p>六楼</p>`,
|
rotation:{x:0,y:0,z:180}
|
})
|
floorGraphic8 = new mars3d.graphic.ModelEntity({
|
|
position: [model_lon,model_lat, -1.1], // 楼栋位置
|
style: {
|
scale:1,
|
url: "./gltf/Ruijin2/F7-16.gltf",
|
heading: heading_,
|
color:"#ffff00",
|
fill:true
|
},
|
popup:`<p>七楼</p>`,
|
rotation:{x:0,y:0,z:180}
|
})
|
floorGraphic9 = new mars3d.graphic.ModelEntity({
|
|
position: [model_lon,model_lat, 2.1], // 楼栋位置
|
style: {
|
scale:1,
|
url: "./gltf/Ruijin2/F7-16.gltf",
|
heading: heading_,
|
color:"#ffff00",
|
fill:true
|
},
|
popup:`<p>八楼</p>`,
|
rotation:{x:0,y:0,z:180}
|
})
|
floorGraphic10 = new mars3d.graphic.ModelEntity({
|
|
position: [model_lon,model_lat, 5], // 楼栋位置
|
style: {
|
scale:1,
|
url: "./gltf/Ruijin2/F7-16.gltf",
|
heading: heading_,
|
color:"#ffff00",
|
fill:true
|
},
|
rotation:{x:0,y:0,z:180}
|
})
|
floorGraphic11 = new mars3d.graphic.ModelEntity({
|
|
position: [model_lon,model_lat, 7.9], // 楼栋位置
|
style: {
|
scale:1,
|
url: "./gltf/Ruijin2/F7-16.gltf",
|
heading: heading_,
|
color:"#ffff00",
|
fill:true
|
},
|
rotation:{x:0,y:0,z:180}
|
})
|
floorGraphic12 = new mars3d.graphic.ModelEntity({
|
|
position: [model_lon,model_lat, 10.7], // 楼栋位置
|
style: {
|
scale:1,
|
url: "./gltf/Ruijin2/F7-16.gltf",
|
heading: heading_,
|
color:"#ffff00",
|
fill:true
|
},
|
rotation:{x:0,y:0,z:180}
|
})
|
floorGraphic13 = new mars3d.graphic.ModelEntity({
|
|
position: [model_lon,model_lat, 13.5], // 楼栋位置
|
style: {
|
scale:1,
|
url: "./gltf/Ruijin2/F7-16.gltf",
|
heading: heading_,
|
color:"#ffff00",
|
fill:true
|
},
|
rotation:{x:0,y:0,z:180}
|
})
|
floorGraphic14 = new mars3d.graphic.ModelEntity({
|
|
position: [model_lon,model_lat, 16.3], // 楼栋位置
|
style: {
|
scale:1,
|
url: "./gltf/Ruijin2/F7-16.gltf",
|
heading: heading_,
|
color:"#ffff00",
|
fill:true
|
},
|
rotation:{x:0,y:0,z:180}
|
})
|
floorGraphic15 = new mars3d.graphic.ModelEntity({
|
|
position: [model_lon,model_lat, 19.1], // 楼栋位置
|
style: {
|
scale:1,
|
url: "./gltf/Ruijin2/F7-16.gltf",
|
heading: heading_,
|
color:"#ffff00",
|
fill:true
|
},
|
rotation:{x:0,y:0,z:180}
|
})
|
floorGraphic16 = new mars3d.graphic.ModelEntity({
|
|
position: [model_lon,model_lat, 21.9], // 楼栋位置
|
style: {
|
scale:1,
|
fill:true,
|
// opacity:0.7,
|
// color:"#ffffff",
|
url: "./gltf/Ruijin2/F7-16.gltf",
|
heading: heading_,
|
color:"#ffff00",
|
fill:true
|
},
|
rotation:{x:0,y:0,z:180}
|
})
|
floorGraphic17 = new mars3d.graphic.ModelEntity({
|
|
position: [model_lon,model_lat, 24.7], // 楼栋位置
|
style: {
|
scale:1,
|
url: "./gltf/Ruijin2/F7-16.gltf",
|
heading: heading_,
|
color:"#ffff00",
|
fill:true
|
},
|
rotation:{x:0,y:0,z:180}
|
})
|
floorGraphic18 = new mars3d.graphic.ModelEntity({
|
|
position: [model_lon,model_lat, -5], // 楼栋位置
|
style: {
|
scale:1,
|
url: "./gltf/Ruijin2/L17_220303.gltf",
|
heading: heading_,
|
color:"#ffff00",
|
fill:true
|
},
|
rotation:{x:0,y:0,z:180}
|
})
|
floorGraphic19 = new mars3d.graphic.ModelEntity({
|
|
position: [model_lon,model_lat, -2], // 楼栋位置
|
style: {
|
scale:1,
|
url: "./gltf/Ruijin2/L17_220303.gltf",
|
heading: heading_,
|
color:"#ffff00",
|
fill:true
|
},
|
rotation:{x:0,y:0,z:180}
|
})
|
floorGraphic20 = new mars3d.graphic.ModelEntity({
|
|
position: [model_lon,model_lat, 1], // 楼栋位置
|
style: {
|
scale:1,
|
url: "./gltf/Ruijin2/L17_220303.gltf",
|
heading: heading_,
|
color:"#ffff00",
|
fill:true
|
},
|
rotation:{x:0,y:0,z:180}
|
})
|
floorGraphic21 = new mars3d.graphic.ModelEntity({
|
|
position: [model_lon,model_lat, 4], // 楼栋位置
|
style: {
|
scale:1,
|
url: "./gltf/Ruijin2/L17_220303.gltf",
|
heading: heading_,
|
color:"#ffff00",
|
fill:true
|
},
|
rotation:{x:0,y:0,z:180}
|
})
|
floorGraphic22 = new mars3d.graphic.ModelEntity({
|
|
position: [model_lon,model_lat, 7], // 楼栋位置
|
style: {
|
scale:1,
|
url: "./gltf/Ruijin2/L17_220303.gltf",
|
heading: heading_,
|
color:"#ffff00",
|
fill:true
|
},
|
rotation:{x:0,y:0,z:180}
|
})
|
floorGraphic23 = new mars3d.graphic.ModelEntity({
|
|
position: [model_lon,model_lat, 10], // 楼栋位置
|
style: {
|
scale:1,
|
url: "./gltf/Ruijin2/L17_220303.gltf",
|
heading: heading_,
|
color:"#ffff00",
|
fill:true
|
},
|
rotation:{x:0,y:0,z:180}
|
})
|
floorGraphic24 = new mars3d.graphic.ModelEntity({
|
|
position: [model_lon,model_lat, -6.8], // 楼栋位置
|
style: {
|
scale:1,
|
maximumScale:2,
|
url: "./gltf/Ruijin2/F22-roof.gltf",
|
heading: heading_,
|
color:"#ffff00",
|
fill:true
|
},
|
})
|
model_list.push(
|
floorGraphic1,
|
floorGraphic2,
|
floorGraphic3,
|
floorGraphic4,
|
floorGraphic5,
|
floorGraphic6,
|
floorGraphic7,
|
floorGraphic8,
|
floorGraphic9,
|
floorGraphic10,
|
floorGraphic11,
|
floorGraphic12,
|
floorGraphic13,
|
floorGraphic14,
|
floorGraphic15,
|
floorGraphic16,
|
floorGraphic17,
|
floorGraphic18,
|
floorGraphic19,
|
floorGraphic20,
|
floorGraphic21,
|
floorGraphic22,
|
floorGraphic23,
|
floorGraphic24,
|
)
|
|
for(let i = 0;i<model_list.length;i++){
|
graphicLayer.addGraphic(model_list[i])
|
}
|
if(model_list.length>0){
|
var ColorHex=new Array('00','33','66','99','CC','FF')
|
var SpColorHex=new Array('FF0000','00FF00','0000FF','FFFF00','00FFFF','FF00FF')
|
|
|
var colorTable=''
|
for (i=0;i<2;i++) //循环2部分
|
{
|
for (j=0;j<6;j++) //循环6行
|
{
|
colorTable=colorTable+'<tr height=12>'
|
for (k=0;k<3;k++)
|
{
|
for (l=0;l<6;l++)
|
{
|
colorTable=colorTable+'<td onclick="test_box()" class="color_box" width=11 style="background-color:#'+ColorHex[k+i*3]+ColorHex[l]+ColorHex[j]+'">'
|
}
|
}
|
}
|
}
|
colorTable='<table id="color_fbox" border="1" cellspacing="0" cellpadding="0" style="border-collapse: collapse" bordercolor="000000" style="cursor:hand;">'
|
+colorTable+'</table>';
|
colorpanel.innerHTML=colorTable
|
}
|
|
}
|
|
function test_box(){
|
console.log("我在外边")
|
doclick()
|
}
|
function doclick(){
|
console.log("我在里面")
|
var evt=getEvent();
|
var element=evt.srcElement || evt.target;
|
console.log(element.style.backgroundColor)
|
if (element.tagName=="TD"){
|
console.log(element)
|
var bg=rgbToHex(element.style.backgroundColor);
|
for(let i=0;i<model_list.length;i++){
|
model_list[i].setStyle({
|
color:bg,
|
fill:true,
|
shadows:Cesium.ShadowMode.ENABLED,
|
colorBlendMode:Cesium.ColorBlendMode.HIGHLIGHT,
|
colorBlendAmountEnabled : true ,
|
colorBlendAmount:0.8
|
})
|
}
|
return bg;
|
}
|
}
|
// 图层&目录设备定位
|
function addMockpoint(){
|
var tucengdian = new mars3d.layer.DivLayer({
|
id: 155,
|
pid: 99,
|
name: "设备定位",
|
show:false,
|
popup: "all",
|
flyTo: false
|
}); //新建图层
|
map.addLayer(tucengdian);
|
}
|
function open_msg(e){//轨迹回放方法
|
console.log(e)
|
}
|
|
// group方法可以将一个数组按照指定长度进行分组
|
function group(array, subGroupLength) {
|
let index = 0 ;
|
let newArray = [];
|
while (index < array.length) {
|
newArray.push(array.slice(index, index += subGroupLength));
|
}
|
return newArray;
|
}
|
|
|
|
// 添加PCI模型
|
function addPciModel(){
|
var PCI_position_layer = new mars3d.layer.GraphicLayer({
|
pid:99,
|
name:'new_PCI',
|
show:false
|
})
|
map.addLayer(PCI_position_layer)
|
$.ajax({
|
type:'get',
|
dataType:'json',
|
async:true,
|
url:get_JSON.ruijin_url+'get_rru_info',
|
success:function(data){
|
var datas_2 = []
|
let datas = data.data.data
|
for(let i=0;i<datas.length;i++){
|
datas_2.push(datas[i])
|
}
|
let rru_end = unique(datas)
|
console.log(rru_end,"rru_end")
|
for(let i=0;i<rru_end.length;i++){
|
let item = datas[i]
|
let coneGlow = new mars3d.graphic.CircleEntity({
|
position: Cesium.Cartesian3.fromDegrees(Number(item.Longitude),Number(item.Latitude),0),
|
style: {
|
color:'rgba(255, 254, 253, 1.0)',
|
radius: 4,
|
diffHeight:Number(item.AntHight)
|
},
|
popup:`<p>名称:${item.SitenameCN}</p>
|
<p>地址:${item.SiteAddress}</p>
|
<p>编号:${item.eNodeBID}</p>
|
<p>经度:${item.Longitude}</p>
|
<p>纬度:${item.Latitude}</p>
|
<p>高度:${item.AntHight}</p>`,
|
show:true
|
})
|
PCI_position_layer.addGraphic(coneGlow)
|
}
|
for(let i=0;i<datas_2.length;i++){
|
let item = datas_2[i]
|
for(let j=0;j<rru_end.length;j++){
|
if(item.SitenameCN == rru_end[j].SitenameCN||item.SiteAddress === rru_end[j].SiteAddress){
|
item.Longitude = rru_end[j].Longitude
|
item.Latitude = rru_end[j].Latitude
|
item.AntHight = rru_end[j].AntHight
|
let num = Number(item.DirectionalAngle)
|
let plane_pci
|
let h = Number(item.AntHight)
|
if(item.frequencyRange == '1.8G'){
|
plane_pci = addPCIPlane(item,h-7,num,"#ff0000")
|
}else if(item.frequencyRange == '2.1G'){
|
plane_pci = addPCIPlane(item,h+7,num,"#00ff00")
|
}else{
|
plane_pci = addPCIPlane(item,h,num,"#0000ff")
|
}
|
PCI_position_layer.addGraphic(plane_pci)
|
}
|
}
|
}
|
|
},
|
error: function (request, textStatus) {
|
|
}
|
})
|
}
|
|
|
// 封装方法,将rru_info获取到的宏站数据去重
|
function unique(arr) {
|
for ( var i = 0, len = arr.length; i < len; i++ ) {
|
for ( var j = i + 1, len = arr.length; j < len; j++ ) {
|
if (arr[i].SitenameCN === arr[j].SitenameCN||arr[i].SiteAddress === arr[j].SiteAddress) {
|
arr.splice(j, 1 );
|
j --; //每刪除一個數j的值就減1
|
len--; // j值減小時len也要相應減1(減少循環次數,節省性能)
|
// console.log(j,len)
|
|
}
|
}
|
}
|
return arr;
|
}
|
|
function addPCIPlane(item,h,heading,color){
|
const primitive = new mars3d.graphic.PlaneEntity({
|
|
position: [Number(item.Longitude),Number(item.Latitude),h],
|
style: {
|
plane: new Cesium.Plane(Cesium.Cartesian3.UNIT_X,10.0),
|
// plane_normal: ,
|
heading:heading,
|
dimensions_x: 3.0,
|
dimensions_y: 6.0,
|
color: color,
|
opacity: 0.4,
|
|
// 高亮时的样式(默认为鼠标移入,也可以指定type:'click'单击高亮),构造后也可以openHighlight、closeHighlight方法来手动调用
|
highlight: {
|
opacity: 0.9
|
},
|
|
},
|
popup:`<p>PCI:${item.PCI}</p>
|
<p>Sitename:${item.SitenameCN}</p>
|
<p>信号:${item.frequencyRange}</p>
|
<p>???:${item.EARFCN}</p>
|
`,
|
description:"文字"
|
})
|
// PCI_position_layer.addGraphic(primitive)
|
return primitive
|
}
|
|
|
function addLightMr(){
|
ue_trace_layer = new mars3d.layer.GraphicLayer({
|
// type:'group',
|
id: 104,
|
pid: 99,
|
name: "设备轨迹",
|
show: true,
|
popup: "all",
|
flyTo: false
|
});
|
map.addLayer(ue_trace_layer);
|
|
}
|
function testLight(){
|
var testgraphic = new mars3d.layer.GraphicLayer({
|
id: 104,
|
pid: 99,
|
name: "测试轨迹",
|
show: true,
|
flyTo: false
|
});
|
map.addLayer(ue_trace_layer);
|
}
|
|
function addCustomLayers() {
|
addMsisdnPoint();
|
addLightMr();//设备轨迹
|
addPciModel();//PCI位置
|
openFloor();//瑞金大楼
|
addMockpoint();//设备定位点
|
addpoint17();
|
}
|