a15_scene_center.html 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0,minimum-scale=1.0,maximum-scale=1.0" />
  6. <meta name="author" content="火星科技 http://mars3d.cn " />
  7. <meta name="apple-touch-fullscreen" content="yes" />
  8. <meta name="apple-mobile-web-app-capable" content="yes" />
  9. <meta name="apple-mobile-web-app-status-bar-style" content="black" />
  10. <meta name="format-detection" content="telephone=no" />
  11. <meta name="x5-fullscreen" content="true" />
  12. <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />
  13. <!-- 标题及搜索关键字 -->
  14. <meta name="keywords" content="火星科技,cesium,3D,GIS,marsgis,三维,地球,地图,开发,框架,系统,示例,资料,模型,离线,外包,合肥,安徽,中国" />
  15. <meta
  16. name="description"
  17. content="火星科技 合肥火星 合肥火星科技 合肥火星科技有限公司 leaflet leaflet框架 leaflet开发 cesium cesium开发 cesium框架 三维 地球 模型 gis marsgis 地图离线 地图开发 地图框架 地图外包 框架 开发 外包 地图离线 二维地图 三维地图 全景漫游 地理信息系统 云GIS 三维GIS GIS平台 WebGIS"
  18. />
  19. <link rel="shortcut icon" type="image/x-icon" href="" />
  20. <title>scene.center 默认视角 </title>
  21. <!--第三方lib-->
  22. <script
  23. type="text/javascript"
  24. src="../lib/include-lib.js"
  25. libpath="../lib/"
  26. include="jquery,font-awesome,bootstrap,layer,haoutil,turf,mars3d"
  27. ></script>
  28. <link href="css/style.css" rel="stylesheet" />
  29. </head>
  30. <body class="dark">
  31. <!--加载前进行操作提示,优化用户体验-->
  32. <div id="mask" class="signmask" onclick="removeMask()"></div>
  33. <div id="mars3dContainer" class="mars3d-container"></div>
  34. <div class="infoview">
  35. 著名景点视角:
  36. <input type="button" class="btn btn-primary" value="故宫" onclick="changeView1()" />
  37. <input type="button" class="btn btn-primary" value="珠峰" onclick="changeView2()" />
  38. <input type="button" class="btn btn-primary" value="华山" onclick="changeView3()" />
  39. <input type="button" class="btn btn-primary" value="大别山" onclick="changeView4()" />
  40. </div>
  41. <script src="./js/common.js"></script>
  42. <script type="text/javascript">
  43. "use script"; //开发环境建议开启严格模式
  44. var map;
  45. function initMap(options) {
  46. //合并属性参数,可覆盖config.json中的对应配置
  47. var mapOptions = mars3d.Util.merge(options, {
  48. scene: {
  49. center: { lat: 25.389914, lng: 119.084961, alt: 1179575, heading: 346, pitch: -60 },
  50. },
  51. });
  52. //创建三维地球场景
  53. map = new mars3d.Map("mars3dContainer", mapOptions);
  54. //1可以通过右键菜单"查看当前视角"来获取center参数后,拷贝到配置中
  55. //2也可以通过下面方法获取center参数
  56. var center = map.getCameraView();
  57. console.log(JSON.stringify(center));
  58. //可以通过centerAt切换视角
  59. map.setCameraView(center);
  60. }
  61. function changeView1() {
  62. map.setCameraView({ lat: 39.904128, lng: 116.391643, alt: 1054, heading: 356, pitch: -39 });
  63. }
  64. function changeView2() {
  65. map.setCameraView({ lat: 28.13059, lng: 86.835138, alt: 7627, heading: 148, pitch: -7 });
  66. }
  67. function changeView3() {
  68. map.setCameraView({ lat: 34.57029, lng: 110.041612, alt: 1288, heading: 168, pitch: -7 });
  69. }
  70. function changeView4() {
  71. map.setCameraView({ lat: 30.847409, lng: 115.832396, alt: 1541, heading: 116, pitch: -7 });
  72. }
  73. </script>
  74. </body>
  75. </html>