c10_tentect.html 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <!-- 2017-12-4 14:24:10 | 修改 木遥(微信: http://marsgis.cn/weixin.html ) -->
  2. <!DOCTYPE html>
  3. <html>
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0,minimum-scale=1.0,maximum-scale=1.0" />
  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>腾讯 </title>
  21. <script
  22. type="text/javascript"
  23. src="../lib/include-lib.js"
  24. libpath="../lib/"
  25. include="jquery,font-awesome,bootstrap,layer,localforage,haoutil,mars3d,mars3d-widget"
  26. ></script>
  27. <link href="css/style.css" rel="stylesheet" />
  28. </head>
  29. <body class="dark">
  30. <div id="mars3dContainer" class="mars3d-container"></div>
  31. <div class="infoview infoview-right">
  32. <input id="btnAddLayer" type="button" class="btn btn-primary" value="叠加图层" onclick="addLayer()" />
  33. <input id="btnRemoveLayer" type="button" class="btn btn-primary" value="移除图层" onclick="removeLayer()" />
  34. </div>
  35. <script type="text/javascript">
  36. "use script"; //开发环境建议开启严格模式
  37. $(document).ready(function () {
  38. if (!mars3d.Util.webglreport()) {
  39. mars3d.Util.webglerror();
  40. return;
  41. }
  42. initMap();
  43. });
  44. var map;
  45. function initMap() {
  46. //创建三维地球场景
  47. map = new mars3d.Map("mars3dContainer", {
  48. scene: {
  49. center: { lat: 31.675177, lng: 117.323257, alt: 81193, heading: 359, pitch: -79 },
  50. highDynamicRange: false,
  51. },
  52. control: {
  53. baseLayerPicker: true, //basemaps底图切换按钮
  54. homeButton: true, //视角复位按钮
  55. sceneModePicker: true, //二三维切换按钮
  56. defaultContextMenu: true, //右键菜单
  57. locationBar: { fps: true }, //状态栏
  58. },
  59. terrain: {
  60. url: "//data.mars3d.cn/terrain",
  61. show: true,
  62. },
  63. //方式1:在创建地球前的参数中配置
  64. basemaps: [
  65. {
  66. name: "腾讯电子",
  67. icon: "img/basemaps/gaode_vec.png",
  68. type: "tencent",
  69. layer: "vec",
  70. show: true,
  71. },
  72. {
  73. name: "腾讯影像",
  74. icon: "img/basemaps/gaode_img.png",
  75. type: "group",
  76. layers: [
  77. { name: "底图", type: "tencent", layer: "img_d" },
  78. { name: "注记", type: "tencent", layer: "img_z" },
  79. ],
  80. },
  81. {
  82. name: "腾讯深蓝色",
  83. icon: "img/basemaps/bd-c-midnight.png",
  84. type: "tencent",
  85. layer: "custom",
  86. style: "4",
  87. },
  88. ],
  89. });
  90. //poi查询栏
  91. activatePOIQuery(map);
  92. }
  93. //叠加的图层
  94. var tileLayer;
  95. function addLayer() {
  96. removeLayer();
  97. //方式2:在创建地球后调用addLayer添加图层(直接new对应type类型的图层类)
  98. tileLayer = new mars3d.layer.TencentLayer({
  99. layer: "custom",
  100. style: "4",
  101. });
  102. map.addLayer(tileLayer);
  103. }
  104. function removeLayer() {
  105. if (tileLayer) {
  106. map.removeLayer(tileLayer, true);
  107. tileLayer = null;
  108. }
  109. }
  110. //附加:激活POI查询widget,用于在底图上叠加显示数据
  111. function activatePOIQuery(map) {
  112. mars3d.widget.activate({
  113. map: map,
  114. name: "POI查询",
  115. uri: "widgets/queryGaodePOI/widget.js",
  116. });
  117. }
  118. </script>
  119. </body>
  120. </html>