地质所 沉降监测网建设项目
chenhuan
2024-05-16 0fdd42e318f51f9e3c6581473416af1cca69877f
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="include :: header('申请定位信息')" />
<script th:src="@{/cms/js/tdt.js}"></script>
 
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <div id="map" class="content"
            style="width: 100%; height: 800px; background-color: white;"></div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
     var prefix = ctx + "platform/projectapply";
     
     var onProject = [[${projectApply}]];
     var holeList = [[${holeList}]];//钻孔列表
     
     var dxs = [[${dxs}]];
     
    var map;
    var MarkerClusterer;
    var zoom = 10;
     $(function() {
        map = new T.Map('map');
        map.centerAndZoom(new T.LngLat(116.23, 40), zoom);
 
        var control = new T.Control.Zoom();
        control.setPosition(T_ANCHOR_TOP_RIGHT);
        map.addControl(control);//添加缩放平移控件
 
        var scale = new T.Control.Scale();//创建比例尺控件对象
        var ctrl = new T.Control.MapType();
        ctrl.setPosition(T_ANCHOR_BOTTOM_RIGHT);
        //添加控件
        map.addControl(ctrl);
        showOnMap();            
     });
     
     //在地图上展示
    function showOnMap(){
        
         var center = JSON.parse(onProject.onProjectAddr);
         
            var icon = new T.Icon({
                iconUrl: '/bjfw/images/icons/6.png',
                iconSize: new T.Point(30, 30),
                iconAnchor: new T.Point(6, 40),
            });
            
            var zkicon = new T.Icon({
                iconUrl: '/bjfw/images/icons/zk.png',
                iconSize: new T.Point(30, 30),
                iconAnchor: new T.Point(6, 40),
            });
            
            var dxsIcon = new T.Icon({
                iconUrl: '/bjfw/images/icons/dxs.svg',
                iconSize: new T.Point(30, 30),
                iconAnchor: new T.Point(6, 40),
            });
            
            
            var centerMarker = new T.Marker(new T.LngLat(center.lng, center.lat), { title: "项目待建点",icon:icon});
 
            var proj = infoWindowProject(onProject);
            addClickHandler(proj, centerMarker);
            
            map.addOverLay(centerMarker);
                
            //展示地质钻孔
             for(var i=0;i<holeList.length;i++){
                var lng =holeList[i].longitude;
                var lat =holeList[i].latitude;
                var zkno = holeList[i].holeNo;
                var marker = new T.Marker(new T.LngLat(lng, lat), { title: "钻孔编号:" + zkno , icon : zkicon});
                
                var c = infoWindowDrill(holeList[i]);
                addClickHandler(c, marker);
                map.addOverLay(marker);            
            } 
            
            
            //展示地下水孔
             for(var i=0;i<dxs.length;i++){
                var lng =dxs[i].lng;
                var lat =dxs[i].lat;
                var zkno = dxs[i].holeNum;
                var marker = new T.Marker(new T.LngLat(lng, lat), { title: "钻孔编号:" + zkno , icon : dxsIcon});
                
                var c = infoWindowDrill(dxs[i]);
                //addClickHandler(dxs[i], marker);
                addDxsClick(dxs[i], marker);
                map.addOverLay(marker);            
            } 
            
             var circle = new T.Circle(new T.LngLat(center.lng, center.lat), 2000,
                     {color:"red",weight:2,opacity:0.5,fillColor:"#FFFFFF",fillOpacity:0.5,lineStyle:"dashed"});
                //向地图上添加圆
             map.addOverLay(circle);
             map.centerAndZoom(new T.LngLat(center.lng, center.lat), 14);
    }
     
 
 
    function infoWindowDrill(e) {
        var sContent =
            "<div style='margin:0px;'>" +
            "<div>" +
            "<div style='margin:5px 0px 5px 5px;'>" +
            "<font style='font-weight: bolder;'>钻孔编号 :</font>" + e.holeNo + "<br>" +
            "<font style='font-weight: bolder;'>钻孔类型:</font>" + e.holeType + "<br>" +
            "<font style='font-weight: bolder;'>孔深(米):</font>" + e.holeDepth + "<br>" +
            "</div>" +
            "</div>" +
            "</div>";
        return sContent;
    }
    //"<input style='margin-left:195px;  width: 80px;height: 24px; text-align: center; background: #5596de;color: #FFF;border: none;display: block;cursor: pointer;' type='button' value='钻孔图'  onClick=\"zhutu('" + id + "')\">" +
    
    function infoWindowProject(e){
        var files= e.files;
        var sContent =
            "<div style='margin:0px;'>" +
            "<div>" +
            "<div style='margin:5px 0px 5px 5px;'>" +
            "<font style='font-weight: bolder;'>项目名称 :</font>" + e.onProjectName + "<br>" +
            "<font style='font-weight: bolder;'>单位信息:</font>" + e.onProjectDept + "<br>" +
            "<font style='font-weight: bolder;'>联系人:</font>" + e.contacts + "<br>" +
            "<font style='font-weight: bolder;'>电话:</font>" + e.tel + "<br>" +
            "<font style='font-weight: bolder;'>附件:</font>" + "<a onClick=\"openFiles('" + files + "')\">审核材料</a>" + "<br>" +
            
            "</div>" +
            "</div>" +
            "</div>";
        return sContent;
    }
    
    function openFiles(files){
        if(files==null|| files ==""){
            return;
        }else{
            window.open(files);
        }
    }
    
    function addClickHandler(content, marker) {
        marker.addEventListener("click", function (e) {
            openInfo(content, e)
        });
    }
    
    //地下水折线
    function addDxsClick(entity, marker){
        marker.addEventListener("click", function (e) {        
            $.modal.openTab('地下水变化',prefix+'/dxs?holeNum='+ entity.holeNum);
        });
    }
    
    
    
    function openInfo(content, e) {
        var point = e.lnglat;
        var markerInfoWin = new T.InfoWindow(content, { offset: new T.Point(0, -30) }); // 创建信息窗口对象
        map.openInfoWindow(markerInfoWin, point); //开启信息窗口
    }
    
    </script>
</body>
</html>