a15_control.html 4.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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>control 控件 </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. <div id="mars3dContainer" class="mars3d-container"></div>
  32. <script type="text/javascript">
  33. "use script"; //开发环境建议开启严格模式
  34. $(document).ready(function () {
  35. if (!mars3d.Util.webglreport()) {
  36. mars3d.Util.webglerror();
  37. return;
  38. }
  39. initMap();
  40. });
  41. function initMap() {
  42. //添加控件有2种方式:
  43. //方式1:在创建地球前的传参中配置control参数
  44. var map = new mars3d.Map("mars3dContainer", {
  45. scene: {
  46. center: { lat: 33.938752, lng: 103.753712, alt: 18401000, heading: 0, pitch: -90 },
  47. },
  48. control: {
  49. //以下是Cesium.Viewer所支持的控件相关的options
  50. baseLayerPicker: true, //basemaps底图切换按钮
  51. homeButton: true, //视角复位按钮
  52. sceneModePicker: true, //二三维切换按钮
  53. navigationHelpButton: true, //帮助按钮
  54. infoBox: true, //信息框
  55. selectionIndicator: true, //选择框
  56. vrButton: true, //vr模式按钮
  57. fullscreenButton: true, //全屏按钮
  58. animation: true, //动画部件按钮
  59. timeline: true, //时间线
  60. geocoder: true, //POI查询按钮
  61. geocoderConfig: { key: ["ae29a37307840c7ae4a785ac905927e0"] }, //POI查询按钮参数配置
  62. //以下是mars3d.control定义的控件
  63. defaultContextMenu: true, //右键菜单
  64. mouseDownView: true,
  65. compass: { top: "10px", right: "5px" },
  66. distanceLegend: { left: "100px", bottom: "2px" },
  67. },
  68. basemaps: [
  69. {
  70. name: "单张图片",
  71. icon: "img/basemaps/offline.png",
  72. type: "image",
  73. url: "//data.mars3d.cn/file/img/world/world.jpg",
  74. show: true,
  75. },
  76. ],
  77. });
  78. //方式2:在创建地球后按需调用addControl添加(直接new对应type类型的控件)
  79. var locationBar = new mars3d.control.LocationBar({
  80. fps: true,
  81. template:
  82. "<div>经度:{lng}</div> <div>纬度:{lat}</div> <div>海拔:{alt}米</div> <div>层级:{level}</div><div>方向:{heading}度</div> <div>俯仰角:{pitch}度</div><div>视高:{cameraHeight}米</div>",
  83. });
  84. map.addControl(locationBar);
  85. }
  86. </script>
  87. </body>
  88. </html>