f80_interPoly.html 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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,layer,haoutil,turf,mars3d"
  27. ></script>
  28. <link href="css/style.css" rel="stylesheet" />
  29. <style>
  30. .infoview div {
  31. margin-bottom: 5px;
  32. }
  33. </style>
  34. </head>
  35. <body class="dark">
  36. <!--加载前进行操作提示,优化用户体验-->
  37. <div id="mask" class="signmask" onclick="removeMask()"></div>
  38. <div id="mars3dContainer" class="mars3d-container"></div>
  39. <!-- 面板 -->
  40. <div class="infoview">
  41. <div>
  42. <span style="color: #cad1d1">提示:插值数大时分析略慢,请耐心等待。</span>
  43. <input type="button" class="btn btn-info" value="清除" onclick="removeAll()" />
  44. </div>
  45. <div>
  46. 插值数:
  47. <input id="txtSplitNum" type="number" value="10" step="1" min="1" max="999" class="form-control" style="width: 100px" />
  48. <input type="button" class="btn btn-primary" value="面插值" onclick="interPolygon()" />
  49. </div>
  50. <div>
  51. 插值数:
  52. <input id="txtSplitLineNum" type="number" value="100" step="1" min="1" max="9999" class="form-control" style="width: 100px" />
  53. <input type="button" class="btn btn-primary" value="线插值" onclick="interPolyline()" />
  54. <input type="button" class="btn btn-primary" value="线插值(高度等分)" onclick="interLine()" />
  55. </div>
  56. </div>
  57. <script src="js/showPolygonInter.js"></script>
  58. <script src="./js/common.js"></script>
  59. <script type="text/javascript">
  60. "use script"; //开发环境建议开启严格模式
  61. var map;
  62. function initMap(options) {
  63. //合并属性参数,可覆盖config.json中的对应配置
  64. var mapOptions = mars3d.Util.merge(options, {
  65. scene: {
  66. //此处参数会覆盖config.json中的对应配置
  67. center: { lat: 30.841762, lng: 116.26537, alt: 3281, heading: 39, pitch: -63 },
  68. },
  69. });
  70. //创建三维地球场景
  71. map = new mars3d.Map("mars3dContainer", mapOptions);
  72. }
  73. function removeAll() {
  74. map.graphicLayer.clear();
  75. clearInterResult(); //在js/showPolygonInter.js
  76. }
  77. function interPolygon() {
  78. map.graphicLayer.startDraw({
  79. type: "polygon",
  80. style: {
  81. color: "#29cf34",
  82. opacity: 0.3,
  83. outline: true,
  84. outlineColor: "#ffffff",
  85. clampToGround: true,
  86. },
  87. success: function (graphic) {
  88. var positions = graphic.positionsShow;
  89. map.graphicLayer.clear();
  90. var splitNum = Number($("#txtSplitNum").val());
  91. var resultInter = mars3d.PolyUtil.interPolygon({
  92. scene: map.scene,
  93. positions: positions,
  94. splitNum: splitNum, //splitNum插值分割的个数
  95. });
  96. showInterResult(resultInter.list); //在js/showPolygonInter.js
  97. },
  98. });
  99. }
  100. function interLine(clampToGround) {
  101. map.graphicLayer.startDraw({
  102. type: "polyline",
  103. style: {
  104. color: "#55ff33",
  105. width: 3,
  106. },
  107. success: function (graphic) {
  108. var positions = graphic.positionsShow;
  109. map.graphicLayer.clear();
  110. var splitNum = Number($("#txtSplitLineNum").val());
  111. var arrLine = mars3d.PolyUtil.interLine(positions, {
  112. splitNum: splitNum, // 插值分割的个数
  113. });
  114. showInterLineResult(arrLine); //在js/showPolygonInter.js
  115. },
  116. });
  117. }
  118. function interPolyline(clampToGround) {
  119. map.graphicLayer.startDraw({
  120. type: "polyline",
  121. style: {
  122. color: "#55ff33",
  123. width: 3,
  124. clampToGround: true,
  125. },
  126. success: function (graphic) {
  127. var positions = graphic.positionsShow;
  128. map.graphicLayer.clear();
  129. var splitNum = Number($("#txtSplitLineNum").val());
  130. var arrLine = mars3d.PolyUtil.interPolyline({
  131. scene: map.scene,
  132. positions: positions,
  133. splitNum: splitNum, // 插值分割的个数
  134. });
  135. showInterLineResult(arrLine); //在js/showPolygonInter.js
  136. },
  137. });
  138. }
  139. </script>
  140. </body>
  141. </html>