zhitong.yu
2025-02-14 c4cce49f5e6fd1f74b9962cd86dd201694c3765e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
function joinHouTai(){
    var user = $("#yhm").text();
    var data = "username="+user
    $.get("/hxzkuwb/findUserRole",data,function (data){
        if(data.ujoin == "No"){
            layer.msg('当前没有权限进入后台,请联系管理员')
        }else{
            window.open("../../HouTai/HouTai.jsp")
        }
    })
}
 
let graphics = []; // 用于存储所有跌落位置的数组
 
function KuaiSuDingWei(){
    var pTagid = $("#KuaiSuDingWeiTag").val();
    if (pTagid == ""){
        graphics.forEach(graphic => {
            graphicLayer.removeGraphic(graphic); // 从图层中移除
        });
        graphics = []; // 清空标记数组
 
        layer.msg("清空跌落位置!"); // 显示清除成功消息
        return false;
    }
    if (pTagid && pTagid.includes(',')) {
        const coordinates = pTagid.split(',');
 
        if (coordinates.length === 2) {
            const lon = parseFloat(coordinates[0]);
            const lat = parseFloat(coordinates[1]);
 
            if (!isNaN(lon) && !isNaN(lat)) {
                // 经纬度搜索
                map.camera.flyTo({
                    destination: Cesium.Cartesian3.fromDegrees(lon, lat, 500),
                    duration: 3
                });
                layer.msg("搜索位置成功"); // 显示成功消息
 
                // 在指定位置添加标记
                var graphic = new mars3d.graphic.PointEntity({
                    name: "贴地点",
                    position: new mars3d.LngLatPoint(lon, lat),
                    style: {
                        color: "#ffff00",
                        pixelSize: 10,
                        clampToGround: true,
                        outlineWidth: 0,
                        label: { text: "坠落地点", pixelOffsetY: -10 },
                        // 高亮时的样式(默认为鼠标移入,也可以指定type:'click'单击高亮),构造后也可以openHighlight、closeHighlight方法来手动调用
                        highlight: {
                            type: mars3d.EventType.click, // 默认为鼠标移入高亮,也可以指定click单击高亮
                            pixelSize: 15,
                            outlineColor: "#ff0000",
                            outlineWidth: 2
                        }
                    },
                    attr: { remark: "跌落位置" }
                })
                graphicLayer.addGraphic(graphic)
                graphics.push(graphic); // 将新标记添加到数组中
 
            } else {
                layer.msg("不正确的纬度和经度格式。");
            }
        } else {
            layer.msg("请输入有效纬度和经度。");
        }
    }else{
        var data = "pTagid="+pTagid
        $.ajax({
            url: "/hxzkuwb/findOnePerson",
            type: "POST",
            data: data,
            async: false,
            success: function(data) {
                if (data !=""){
                    var targetPoint = {
                        lat: data.baoliu3, // 纬度
                        lon: data.baoliu2 // 经度
                    };
                    // 使用 Mars3D 的 flyTo 方法来移动地图
                    map.camera.flyTo({
                        destination: Cesium.Cartesian3.fromDegrees(targetPoint.lon, targetPoint.lat, 500), // 目标点经纬度和视角高度
                        duration: 3 // 动画持续时间(秒)
                    });
                    console.log(graphicLayer)
                    layer.msg("搜索位置成功!")
 
                }else{
                    layer.msg("请输入有效人员或设备")
                }
            },
            error: function(xhr, status, error) {
                layer.msg("请联系管理员")
            }
        });
    }
}