You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

51 lines
2.4 KiB

/*
* 添加分布在地图上的物联设备
* id : 模型关联数据库ID
* name : 模型名称(文字描述设备位置)
* type : 模型类型(物联设备类型:消防栓、摄像头等)
* state : 设备状态(是否在线)
* longitude : wgs84地理坐标 经度
* latitude : wgs84地理坐标 维度
* altitude : 模型所在位置 高程
* imageName : 图标名称
* content : 点击模型显示的内容(html标签形式)
* */
function ShowDevice(id,name,type,state,utype,longitude,latitude,altitude,imageName,content){
var pinBuilder = new _Cesium.PinBuilder();
var deviceColor = _Cesium.Color.DEEPSKYBLUE;
if(state == "0"){
if(utype == "0"){
deviceColor = _Cesium.Color.fromCssColorString('#296bb2');
}else if(utype == "1"){
deviceColor = _Cesium.Color.AQUAMARINE;
}
}else if(state == "1"){
deviceColor = _Cesium.Color.GOLD;
}else if(state == "2"){
deviceColor = _Cesium.Color.RED;
}
_Cesium.when(pinBuilder.fromUrl(ctx + "/style/images/" + imageName, deviceColor, 48), function(canvas) {
return viewer.entities.add({
id : id,
name : name,
position : _Cesium.Cartesian3.fromDegrees(longitude, latitude, altitude),
billboard : {
image : canvas.toDataURL(),
verticalOrigin : _Cesium.VerticalOrigin.BOTTOM
},
description : content
});
});
}
ShowDevice('1','camera','','0','0',111.67709183285903,40.8100732374135,30,'sxt.png','');
ShowDevice('2','camera','','0','0',111.67662744314939,40.80873632914009,20,'sxt.png','');
ShowDevice('3','camera','','0','0',111.67637055913079,40.810474530805514,20,'sxt.png','');
ShowDevice('4','camera','','0','0',111.67614532998128,40.809811912869506,20,'sxt.png','');
ShowDevice('5','camera','','0','0',111.67833603138492,40.80882708120876,20,'sxt.png','');
ShowDevice('6','camera','','0','0',111.67838693341717,40.81024410286892,20,'sxt.png','');
ShowDevice('7','camera','','0','0',111.67834681444374,40.811058424448184,20,'sxt.png','');
ShowDevice('8','camera','','0','0',111.67540239519059,40.808647022737105,20,'sxt.png','');
ShowDevice('9','camera','','0','0',111.67762448411564,40.80943130797424,20,'sxt.png','');
ShowDevice('10','camera','','0','0',111.67689387637793,40.80984947443322,20,'sxt.png','');
ShowDevice('11','camera','','0','0',111.67713586294273,40.80871657203668,15,'sxt.png','');