cesium display data in divPoint

cesium display data in divPoint

When acquiring location information with a click of the face will pop up a divPoint box, used to show the face of the attribute information; or location information.

code show as below:

 1  var handlerClick = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
 2     var divPoint = null;
 3     handlerClick.setInputAction(function (movement) {
 4         var position = viewer.scene.pickPosition(movement.position);
 5         if (position) {
 6             var cartographic = Cesium.Cartographic.fromCartesian(position);
 7             var BSM = showDivPositionOld.BSM._value;
 8             var JSMJ = showDivPositionOld.JSMJ._value;
 9             var YSDM = showDivPositionOld.YSDM._value;
10             var html = `<div class="label">
11                             <table>
12                                     <tr>
13                                         <th>属性名</th>
14                                         <th>属性值</th>
15                                     </tr>
16                                     <tr>
17                                         <td>BSM</td>
18                                         <td>{BSM}</td>
19                                     </tr>
20                                     <tr>
21                                         <td>JSMJ</td>
22                                         <td>{JSMJ}</td>
23                                     </tr>
24                                     <tr>
25                                         <td>YSDM</td>
26                                         <td>{YSDM}</td>
27                                     </tr>
28                                 </table>
29                                 <span class="triangle"></span>
30                             </div>`;
31             html = html.replace('{BSM}', BSM)
32                 .replace('{JSMJ}', JSMJ)
33                 .replace('{YSDM}', YSDM);
34 
35             if (divPoint) {
36                 divPoint.destroy();
37                 divPoint = null;
38             }
39 
40             divPoint = new Cesium.DivPoint(viewer, {
41                 html: html,
42                 position: position,
43                 anchor: [0, -15],
44                 noEvent: true
45             });
46         }
47     }, Cesium.ScreenSpaceEventType.LEFT_CLICK);

Where I get the attribute information surface. If you want to obtain its latitude and longitude information, then the method is the same.

 

There is a problem with doubts please add the relevant study group:

Guess you like

Origin www.cnblogs.com/yaosusu/p/11484796.html