surprise
2023-12-29 18377dc5d61caf3a6a0835e17015ac2601f8709d
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
let timeOut = null;
export function creatPoiLayer(write, local, entity, keyMatch) {
 
  if (window.poiLayerObj) {
    window.poiLayerObj.deleteObject()
  }
 
  let description = `<div class="poiLayer">`;
 
  for (let key in write) {
    description += `<div class="poi-item">
        <span class="name">${keyMatch ? keyMatch[key] : key}</span>
        <span class="value">${write[key]}</span>
        </div>
    `
  }
  description += '</div>';
  window.poiLayerObj = sgworld.Creator.createDivPoint('', {
    lon: local[0],
    lat: local[1]
  }, {
    id: 'POI',
    type: "custom",
    offset: ["c", 60],
    description,
    near: 0,
    far: 8000000
  });
 
  if (timeOut) {
    clearTimeout(timeOut);
  }
 
  const cartesian3 = Cesium.Cartesian3.fromDegrees(local[0], local[1], 10);
  let distance = sgworld.Core.getPointToCameraDistance(Viewer, cartesian3);
  Viewer.flyTo(entity, {
    offset: {
      heading: sgworld.Viewer.camera.heading,
      pitch: sgworld.Viewer.camera.pitch,
      range: distance
    },
    duration: 1,
 
  });
}