d10_showhide.html 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  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>控件控制(显示及关闭) </title>
  21. <!--第三方lib-->
  22. <script
  23. type="text/javascript"
  24. src="../lib/include-lib.js"
  25. libpath="../lib/"
  26. include="jquery,font-awesome,bootstrap,bootstrap-checkbox,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. <div>
  36. 按钮:
  37. <div class="checkbox checkbox-primary checkbox-inline">
  38. <input id="showLocationSearch" class="styled" type="checkbox" checked />
  39. <label for="showLocationSearch"> POI搜索 </label>
  40. </div>
  41. <div class="checkbox checkbox-primary checkbox-inline">
  42. <input id="showGoHome" class="styled" type="checkbox" checked />
  43. <label for="showGoHome"> 视角复位 </label>
  44. </div>
  45. <div class="checkbox checkbox-primary checkbox-inline">
  46. <input id="showSceneModePicker" class="styled" type="checkbox" checked />
  47. <label for="showSceneModePicker"> 二三维切换 </label>
  48. </div>
  49. <div class="checkbox checkbox-primary checkbox-inline">
  50. <input id="showBaseLayerPicker" class="styled" type="checkbox" checked />
  51. <label for="showBaseLayerPicker"> 底图切换 </label>
  52. </div>
  53. <div class="checkbox checkbox-primary checkbox-inline">
  54. <input id="showFullScreen" class="styled" type="checkbox" checked />
  55. <label for="showFullScreen"> 全屏切换 </label>
  56. </div>
  57. <div class="checkbox checkbox-primary checkbox-inline">
  58. <input id="showVR" class="styled" type="checkbox" checked />
  59. <label for="showVR"> VR模式 </label>
  60. </div>
  61. <div class="checkbox checkbox-primary checkbox-inline">
  62. <input id="showHelpButton" class="styled" type="checkbox" checked />
  63. <label for="showHelpButton"> 帮助 </label>
  64. </div>
  65. </div>
  66. <div>
  67. 面板:
  68. <div class="checkbox checkbox-primary checkbox-inline">
  69. <input id="showLocation" class="styled" type="checkbox" checked />
  70. <label for="showLocation"> 位置信息状态栏 </label>
  71. </div>
  72. <div class="checkbox checkbox-primary checkbox-inline">
  73. <input id="showClock" class="styled" type="checkbox" checked />
  74. <label for="showClock"> 时钟面板(左下角) </label>
  75. </div>
  76. <div class="checkbox checkbox-primary checkbox-inline">
  77. <input id="showTimeLine" class="styled" type="checkbox" checked />
  78. <label for="showTimeLine"> 时间刻度线 </label>
  79. </div>
  80. <div class="checkbox checkbox-primary checkbox-inline">
  81. <input id="showNav" class="styled" type="checkbox" checked />
  82. <label for="showNav"> 导航球 </label>
  83. </div>
  84. <div class="checkbox checkbox-primary checkbox-inline">
  85. <input id="showLegend" class="styled" type="checkbox" checked />
  86. <label for="showLegend"> 比例尺 </label>
  87. </div>
  88. </div>
  89. </div>
  90. <script src="./js/common.js"></script>
  91. <script type="text/javascript">
  92. "use script"; //开发环境建议开启严格模式
  93. var map;
  94. function initMap(options) {
  95. //合并属性参数,可覆盖config.json中的对应配置
  96. var mapOptions = mars3d.Util.merge(options, {
  97. control: {
  98. homeButton: true,
  99. sceneModePicker: true,
  100. navigationHelpButton: true,
  101. infoBox: true,
  102. vrButton: true,
  103. fullscreenButton: true,
  104. geocoder: true,
  105. baseLayerPicker: true,
  106. animation: true, //是否创建动画小器件,左下角仪表
  107. timeline: true, //是否显示时间线控件
  108. },
  109. });
  110. //创建三维地球场景
  111. map = new mars3d.Map("mars3dContainer", mapOptions);
  112. //显示clock
  113. $("#showClock").change(function () {
  114. var show = $(this).is(":checked");
  115. map.viewer.animation.container.style.display = show ? "block" : "none";
  116. if (show) {
  117. map.controls.locationBar.setStyle({
  118. left: "170px",
  119. });
  120. } else {
  121. map.controls.locationBar.setStyle({
  122. left: "0px",
  123. });
  124. }
  125. });
  126. //显示刻度线
  127. $("#showTimeLine").change(function () {
  128. var show = $(this).is(":checked");
  129. map.viewer.timeline.container.style.display = show ? "block" : "none";
  130. if (show) {
  131. map.controls.locationBar.setStyle({
  132. bottom: "25px",
  133. });
  134. } else {
  135. map.controls.locationBar.setStyle({
  136. bottom: "0px",
  137. });
  138. }
  139. });
  140. //位置信息状态栏
  141. $("#showLocation").change(function () {
  142. var show = $(this).is(":checked");
  143. map.controls.locationBar.show = show;
  144. });
  145. //导航球
  146. $("#showNav").change(function () {
  147. var show = $(this).is(":checked");
  148. map.controls.compass.show = show;
  149. });
  150. //比例尺
  151. $("#showLegend").change(function () {
  152. var show = $(this).is(":checked");
  153. map.controls.distanceLegend.show = show;
  154. });
  155. //显示位置搜索
  156. $("#showLocationSearch").change(function () {
  157. var show = $(this).is(":checked");
  158. map.viewer.geocoder.container.style.display = show ? "block" : "none";
  159. });
  160. //显示回主页
  161. $("#showGoHome").change(function () {
  162. var show = $(this).is(":checked");
  163. map.viewer.homeButton._element.style.display = show ? "block" : "none";
  164. });
  165. //显示三维视图切换
  166. $("#showSceneModePicker").change(function () {
  167. var show = $(this).is(":checked");
  168. if (show) {
  169. $(".cesium-sceneModePicker-wrapper").show();
  170. } else {
  171. $(".cesium-sceneModePicker-wrapper").hide();
  172. }
  173. });
  174. //显示基础图层切换
  175. $("#showBaseLayerPicker").change(function () {
  176. var show = $(this).is(":checked");
  177. map.viewer.baseLayerPicker._element.style.display = show ? "block" : "none";
  178. });
  179. //显示帮助
  180. $("#showFullScreen").change(function () {
  181. var show = $(this).is(":checked");
  182. map.viewer.fullscreenButton.container.style.display = show ? "block" : "none";
  183. });
  184. //VR
  185. $("#showVR").change(function () {
  186. var show = $(this).is(":checked");
  187. map.viewer.vrButton.container.style.display = show ? "block" : "none";
  188. });
  189. //显示帮助
  190. $("#showHelpButton").change(function () {
  191. var show = $(this).is(":checked");
  192. document.getElementsByClassName("cesium-navigationHelpButton-wrapper")[0].style.display = show ? "block" : "none";
  193. });
  194. }
  195. </script>
  196. </body>
  197. </html>