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.
164 lines
4.8 KiB
164 lines
4.8 KiB
<script
|
|
type="text/javascript"
|
|
src="SuperMap_WebGL/examples/js/polygon.js"
|
|
></script>
|
|
<script type="text/javascript" src="subitem/js/yjcz.js"></script>
|
|
<script type="text/javascript" src="js/setting.js"></script>
|
|
<link href="subitem/css/clfzbs.css" rel="stylesheet" type="text/css" />
|
|
<style>
|
|
.layui-layer {
|
|
background: #0d1535 !important;
|
|
}
|
|
</style>
|
|
<!-- 工具栏 -->
|
|
<div class="yjcz-gjl" style="text-align: center">
|
|
<ul>
|
|
<li>
|
|
<a
|
|
href="javascript:void(0)"
|
|
onclick="clbs_fun()"
|
|
class="gjl-icon1"
|
|
data-value="0"
|
|
>
|
|
<div class="yjcz-gjl-icon yjcz-gjl-icon11"></div>
|
|
<h4>车辆部署</h4>
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<script type="text/javascript">
|
|
//标记数组
|
|
var addCarIconList = [];
|
|
|
|
function clbs_fun() {
|
|
$(".gjl-icon1").toggleClass("current");
|
|
var dataValue = $(".gjl-icon1").attr("data-value");
|
|
if (dataValue == "0") {
|
|
openCLXZ();
|
|
$(".gjl-icon1").attr("data-value", "1");
|
|
} else {
|
|
_ScreenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.RIGHT_CLICK);
|
|
$(".gjl-icon1").attr("data-value", "0");
|
|
}
|
|
}
|
|
function openCLXZ() {
|
|
var index = layui.layer.open({
|
|
title: "车辆选择 ",
|
|
type: 2,
|
|
area: ["1280px", "820px"],
|
|
shade: 0.4, //遮罩透明度
|
|
anim: 1,
|
|
maxmin: true,
|
|
content: _staticUrl+"subitem/item/clxz.html",
|
|
btn: ["确定", "取消"],
|
|
yes: function (index, layero) {
|
|
var body = parent.layer.getChildFrame("body", index);
|
|
var carSel = body.find("#carSel").val();
|
|
console.log(carSel);
|
|
if (carSel == null || carSel == "") {
|
|
layer.msg("");
|
|
return false;
|
|
}
|
|
var carSel_S = carSel.split("_,_");
|
|
try {
|
|
setPointIcon(carSel_S[0], carSel_S[1]);
|
|
} catch (e) {
|
|
layer.close(index);
|
|
}
|
|
layer.close(index);
|
|
},
|
|
btn2: function () {
|
|
$(".gjl-icon1").toggleClass("current");
|
|
$(".gjl-icon1").attr("data-value", "0");
|
|
layer.close(index);
|
|
},
|
|
});
|
|
}
|
|
|
|
//点击获取位置
|
|
function setPointIcon(id, name, type) {
|
|
_ScreenSpaceEventHandler.setInputAction(function onRightClick(movement) {
|
|
var position = _viewer.scene.pickPosition(movement.position);
|
|
if (position != null) {
|
|
var cartographic = _cesium.Cartographic.fromCartesian(position);
|
|
if (cartographic != null) {
|
|
longitude = _cesium.Math.toDegrees(cartographic.longitude);
|
|
latitude = _cesium.Math.toDegrees(cartographic.latitude);
|
|
var height = cartographic.height;
|
|
if (height < 0) {
|
|
height = 0;
|
|
}
|
|
position = _cesium.Cartesian3.fromDegrees(
|
|
longitude,
|
|
latitude,
|
|
height
|
|
);
|
|
addIcon(id, name, position, type);
|
|
}
|
|
}
|
|
}, _cesium.ScreenSpaceEventType.RIGHT_CLICK);
|
|
}
|
|
|
|
function addIcon(id, name, position, type) {
|
|
if (type == null || type == "") {
|
|
type = "ditu-cl-ducy-icon1";
|
|
}
|
|
|
|
//地图添加标注
|
|
addEntity_billboardAndLabel(
|
|
addCarIconList,
|
|
id == null || id == "" ? "addCarIconList" + addCarIconList.length : id,
|
|
name == null || name == ""
|
|
? "addCarIconList" + addCarIconList.length
|
|
: name,
|
|
position,
|
|
_staticUrl+"/icon/" + type + ".png",
|
|
new this._cesium.DistanceDisplayCondition(0, 15000.0),
|
|
15000.0,
|
|
1
|
|
);
|
|
|
|
$(".gjl-icon1").toggleClass("current");
|
|
$(".gjl-icon1").attr("data-value", "0");
|
|
_ScreenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.RIGHT_CLICK);
|
|
}
|
|
|
|
function goView(id,name) {
|
|
var index = layui.layer.open({
|
|
title: "【"+name+"】车辆状态监控 ",
|
|
type: 2,
|
|
area: ["1280px", "680px"],
|
|
shade: 0.4, //遮罩透明度
|
|
maxmin: true,
|
|
content: _staticUrl+"subitem/item/clxq.html?ID="+id
|
|
});
|
|
}
|
|
|
|
// 鼠标点击获取坐标点
|
|
this._ScreenSpaceEventHandler.setInputAction(function onLeftClick(movement) {
|
|
// 选择新模型
|
|
var pickedFeature = this._viewer.scene.pick(movement.position);
|
|
if (pickedFeature && pickedFeature.id) {
|
|
var index = $.inArray(pickedFeature.id._id, addCarIconList);
|
|
if (index >= 0) {
|
|
//人
|
|
updateEntity_billboardImg(
|
|
addCarIconList,
|
|
pickedFeature.id._id,
|
|
_staticUrl+"icon/ditu-cl-ducy-icon1h.png",
|
|
_staticUrl+"icon/ditu-cl-ducy-icon1.png"
|
|
);
|
|
} else {
|
|
updateEntity_billboardImg(
|
|
addCarIconList,
|
|
pickedFeature.id._id,
|
|
_staticUrl+"icon/ditu-cl-ducy-icon1h.png",
|
|
_staticUrl+"icon/ditu-cl-ducy-icon1.png"
|
|
);
|
|
}
|
|
goView(pickedFeature.id._id,pickedFeature.id._name);
|
|
} else {
|
|
console.log("点击的是模型");
|
|
}
|
|
}, this._cesium.ScreenSpaceEventType.LEFT_CLICK);
|
|
</script>
|
|
|