wangrong
2025-09-23 40634ebaf5863a599bba8ca2c0575ca079fb8e15
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
/* eslint-disable no-undef */
"use script" //开发环境建议开启严格模式
 
$(document).ready(function () {
  let inhtml = `
            <div class="infoview rightbottom">
                <input type="button" class="btn btn-primary" value="定位至山区" onclick="centerAtTerrain()" />
                <input type="button" class="btn btn-primary" value="定位至模型" onclick="centerAtModel()" />
            </div>  `
  $("body").append(inhtml)
})
 
function centerAtTerrain() {
  map.setCameraView({ lat: 30.859414, lng: 116.28709, alt: 8617, heading: 18, pitch: -28 })
}
 
let modelTest
function centerAtModel() {
  map.setCameraView({ lat: 33.590452, lng: 119.032184, alt: 185, heading: 359, pitch: -34 })
 
  //三维模型
  if (!modelTest) {
    modelTest = new mars3d.layer.TilesetLayer({
      url: "//data.mars3d.cn/3dtiles/qx-simiao/tileset.json",
      position: { alt: 80.6 },
      maximumScreenSpaceError: 1,
      maximumMemoryUsage: 1024,
      flyTo: true
    })
    map.addLayer(modelTest)
  }
}