f61_satellite_position.html 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  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>Satellite 自定义动态位置 </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,mars3d-space"
  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. <script src="./js/common.js"></script>
  35. <script type="text/javascript">
  36. "use script"; //开发环境建议开启严格模式
  37. var map;
  38. function initMap(options) {
  39. //合并属性参数,可覆盖config.json中的对应配置
  40. var mapOptions = mars3d.Util.merge(options, {
  41. scene: {
  42. center: { lat: 19.172158, lng: -157.023638, alt: 20271284, heading: 68, pitch: -90 },
  43. mapMode2D: Cesium.MapMode2D.ROTATE, //二三维场景切换黑影
  44. clock: {
  45. currentTime: "2021-01-01T11:55:00Z",
  46. multiplier: 1, //速度
  47. },
  48. cameraController: {
  49. maximumZoomDistance: 9000000000,
  50. constrainedAxis: false, //解除在南北极区域鼠标操作限制
  51. },
  52. },
  53. control: {
  54. animation: true, //是否创建动画小器件,左下角仪表
  55. timeline: false, //是否显示时间线控件
  56. infoBox: false,
  57. baseLayerPicker: false,
  58. fullscreenButton: false,
  59. sceneModePicker: true,
  60. geocoder: false, //查询
  61. navigationHelpButton: false, //提示
  62. },
  63. });
  64. //创建三维地球场景
  65. map = new mars3d.Map("mars3dContainer", mapOptions);
  66. //创建矢量数据图层
  67. var graphicLayer = new mars3d.layer.GraphicLayer();
  68. map.addLayer(graphicLayer);
  69. //取数据
  70. var property = getDynamicProperty();
  71. var weixin = new mars3d.graphic.Satellite({
  72. name: "自定义轨道",
  73. position: property, //无tle,传入自定义的动态轨道位置属性
  74. model: {
  75. url: "//data.mars3d.cn/gltf/mars/weixin2.gltf",
  76. scale: 1,
  77. minimumPixelSize: 90,
  78. autoHeading: true,
  79. show: true,
  80. },
  81. label: {
  82. color: "#ffffff",
  83. opacity: 1,
  84. font_family: "楷体",
  85. font_size: 30,
  86. outline: true,
  87. outlineColor: "#000000",
  88. outlineWidth: 3,
  89. background: true,
  90. backgroundColor: "#000000",
  91. backgroundOpacity: 0.5,
  92. font_weight: "normal",
  93. font_style: "normal",
  94. pixelOffsetX: 0,
  95. pixelOffsetY: -20,
  96. scaleByDistance: true,
  97. scaleByDistance_far: 10000000,
  98. scaleByDistance_farValue: 0.4,
  99. scaleByDistance_near: 100000,
  100. scaleByDistance_nearValue: 1,
  101. show: true,
  102. },
  103. cone: {
  104. sensorType: mars3d.graphic.SatelliteSensor.Type.Rect,
  105. angle1: 10,
  106. angle2: 5,
  107. color: "#6ef500",
  108. reverse: true,
  109. show: true,
  110. },
  111. path: {
  112. show: true,
  113. color: "#00ff00",
  114. opacity: 0.5,
  115. width: 1,
  116. },
  117. });
  118. graphicLayer.addGraphic(weixin);
  119. }
  120. function getDynamicProperty() {
  121. //该数据是由后端计算返回的轨道信息
  122. var wxdata = [
  123. {
  124. time: "2021-01-01T11:55:00Z",
  125. x: -134.648939681369,
  126. y: -16.7002098082909,
  127. z: 1116015.99646736,
  128. },
  129. {
  130. time: "2021-01-01T11:58:20Z",
  131. x: -136.899721614564,
  132. y: -5.57109779324382,
  133. z: 1114660.42260167,
  134. },
  135. {
  136. time: "2021-01-01T12:01:40Z",
  137. x: -139.097755346946,
  138. y: 5.5661675014342,
  139. z: 1114652.53771041,
  140. },
  141. {
  142. time: "2021-01-01T12:05:00Z",
  143. x: -141.348494748721,
  144. y: 16.6953271278176,
  145. z: 1115992.62270236,
  146. },
  147. {
  148. time: "2021-01-01T12:08:20Z",
  149. x: -143.774623333805,
  150. y: 27.7998266828718,
  151. z: 1118477.29262629,
  152. },
  153. {
  154. time: "2021-01-01T12:11:40Z",
  155. x: -146.56364947549,
  156. y: 38.8612791867078,
  157. z: 1121731.48352323,
  158. },
  159. {
  160. time: "2021-01-01T12:15:00Z",
  161. x: -150.074587947037,
  162. y: 49.8538696199919,
  163. z: 1125266.75027392,
  164. },
  165. {
  166. time: "2021-01-01T12:18:20Z",
  167. x: -155.164247872234,
  168. y: 60.7243205344318,
  169. z: 1128555.88185048,
  170. },
  171. {
  172. time: "2021-01-01T12:21:40Z",
  173. x: -164.565295557077,
  174. y: 71.3021698947674,
  175. z: 1131111.78312013,
  176. },
  177. {
  178. time: "2021-01-01T12:25:00Z",
  179. x: 168.08311253827,
  180. y: 80.6216347342535,
  181. z: 1132558.81749868,
  182. },
  183. {
  184. time: "2021-01-01T12:28:20Z",
  185. x: 90.2490230895946,
  186. y: 81.5572161531476,
  187. z: 1132686.79200749,
  188. },
  189. {
  190. time: "2021-01-01T12:31:40Z",
  191. x: 57.1447486006726,
  192. y: 72.6931112200722,
  193. z: 1131480.71852334,
  194. },
  195. {
  196. time: "2021-01-01T12:35:00Z",
  197. x: 46.6265974503472,
  198. y: 62.1897990251119,
  199. z: 1129122.78290078,
  200. },
  201. {
  202. time: "2021-01-01T12:38:20Z",
  203. x: 41.1892143509244,
  204. y: 51.3446936437554,
  205. z: 1125966.29999715,
  206. },
  207. {
  208. time: "2021-01-01T12:41:40Z",
  209. x: 37.5323471372029,
  210. y: 40.3652635518961,
  211. z: 1122484.77649625,
  212. },
  213. ];
  214. var property = new Cesium.SampledPositionProperty();
  215. for (var z = 0; z < wxdata.length; z++) {
  216. var item = wxdata[z];
  217. var thisTime = Cesium.JulianDate.fromIso8601(item.time);
  218. var position = Cesium.Cartesian3.fromDegrees(item.x, item.y, item.z);
  219. // 添加每一个链接点的信息,到达的时间以及坐标位置
  220. property.addSample(thisTime, position);
  221. }
  222. property.setInterpolationOptions({
  223. interpolationDegree: 2,
  224. interpolationAlgorithm: Cesium.LagrangePolynomialApproximation,
  225. });
  226. return property;
  227. }
  228. </script>
  229. </body>
  230. </html>