f61_satellite.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  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 TLE实时展示 </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,bootstrap-slider,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. <!-- 面板 -->
  35. <div class="infoview">
  36. <input id="btnCenter" type="button" class="btn btn-primary" value="定位至卫星" />
  37. <input id="btnSelPoint" type="button" class="btn btn-primary" value="凝视目标" />
  38. <table class="mars-table">
  39. <tr>
  40. <td class="nametd">类型</td>
  41. <td>
  42. <div class="radio radio-info radio-inline">
  43. <input type="radio" id="sensorType1" name="sensorType" value="1" />
  44. <label for="sensorType1">圆锥体</label>
  45. </div>
  46. <div class="radio radio-info radio-inline">
  47. <input type="radio" id="sensorType2" name="sensorType" value="2" checked="checked" />
  48. <label for="sensorType2">四棱锥体</label>
  49. </div>
  50. </td>
  51. </tr>
  52. <tr>
  53. <td class="nametd">前后侧摆(pitch)</td>
  54. <td>
  55. <input id="model_pitch" title="前后侧摆pitch" />
  56. </td>
  57. </tr>
  58. <tr>
  59. <td class="nametd">左右侧摆(roll)</td>
  60. <td>
  61. <input id="model_roll" title="左右侧摆roll" />
  62. </td>
  63. </tr>
  64. <tr>
  65. <td class="nametd">夹角1</td>
  66. <td>
  67. <input id="model_angle1" />
  68. </td>
  69. </tr>
  70. <tr id="tr_angle2">
  71. <td class="nametd">夹角2</td>
  72. <td>
  73. <input id="model_angle2" />
  74. </td>
  75. </tr>
  76. <tr>
  77. <td class="nametd">参考系轴</td>
  78. <td>
  79. <div class="checkbox checkbox-primary checkbox-inline">
  80. <input id="chkShowModelMatrix" class="styled" type="checkbox" />
  81. <label for="chkShowModelMatrix"> 显示/隐藏 </label>
  82. </div>
  83. </td>
  84. </tr>
  85. </table>
  86. </div>
  87. <div class="infoview rightbottom">
  88. <table class="mars-table tb-border">
  89. <tr>
  90. <td class="nametd">名称</td>
  91. <td id="td_name"></td>
  92. </tr>
  93. <tr>
  94. <td class="nametd">TLE1</td>
  95. <td id="td_tle1"></td>
  96. </tr>
  97. <tr>
  98. <td class="nametd">TLE2</td>
  99. <td id="td_tle2"></td>
  100. </tr>
  101. <tr>
  102. <td class="nametd">时间</td>
  103. <td id="td_time"></td>
  104. </tr>
  105. <tr>
  106. <td class="nametd">经度</td>
  107. <td id="td_jd"></td>
  108. </tr>
  109. <tr>
  110. <td class="nametd">经度</td>
  111. <td id="td_wd"></td>
  112. </tr>
  113. <tr>
  114. <td class="nametd">高程</td>
  115. <td id="td_gd"></td>
  116. </tr>
  117. </table>
  118. </div>
  119. <script src="./js/common.js"></script>
  120. <script type="text/javascript">
  121. "use script"; //开发环境建议开启严格模式
  122. var map;
  123. function initMap(options) {
  124. //合并属性参数,可覆盖config.json中的对应配置
  125. var mapOptions = mars3d.Util.merge(options, {
  126. scene: {
  127. //此处参数会覆盖config.json中的对应配置
  128. center: { lat: 5.459746, lng: 68.238291, alt: 36261079, heading: 143, pitch: -89 },
  129. cameraController: {
  130. zoomFactor: 3.0,
  131. minimumZoomDistance: 1000,
  132. maximumZoomDistance: 300000000,
  133. constrainedAxis: false, //解除在南北极区域鼠标操作限制
  134. },
  135. },
  136. control: {
  137. animation: true, //是否创建动画小器件,左下角仪表
  138. timeline: true, //是否显示时间线控件
  139. },
  140. });
  141. //创建三维地球场景
  142. map = new mars3d.Map("mars3dContainer", mapOptions);
  143. //指定时间
  144. // map.clock.currentTime = Cesium.JulianDate.fromDate(new Date('2020-11-27 10:48:28'))
  145. map.clock.shouldAnimate = true;
  146. map.clock.multiplier = 1; //速度
  147. //创建矢量数据图层
  148. var graphicLayer = new mars3d.layer.GraphicLayer();
  149. map.addLayer(graphicLayer);
  150. graphicLayer.on(mars3d.EventType.click, function (event) {
  151. console.log("单击了卫星", event);
  152. });
  153. var weixin = new mars3d.graphic.Satellite({
  154. name: "GAOFEN 1",
  155. tle1: "1 39150U 13018A 21180.50843864 .00000088 00000-0 19781-4 0 9997",
  156. tle2: "2 39150 97.8300 252.9072 0018449 344.7422 15.3253 14.76581022440650",
  157. model: {
  158. url: "//data.mars3d.cn/gltf/mars/weixin.gltf",
  159. scale: 1,
  160. minimumPixelSize: 90,
  161. autoHeading: true,
  162. show: true,
  163. },
  164. label: {
  165. color: "#ffffff",
  166. opacity: 1,
  167. font_family: "楷体",
  168. font_size: 30,
  169. outline: true,
  170. outlineColor: "#000000",
  171. outlineWidth: 3,
  172. background: true,
  173. backgroundColor: "#000000",
  174. backgroundOpacity: 0.5,
  175. font_weight: "normal",
  176. font_style: "normal",
  177. pixelOffsetX: 0,
  178. pixelOffsetY: -20,
  179. scaleByDistance: true,
  180. scaleByDistance_far: 10000000,
  181. scaleByDistance_farValue: 0.4,
  182. scaleByDistance_near: 100000,
  183. scaleByDistance_nearValue: 1,
  184. show: true,
  185. },
  186. cone: {
  187. sensorType: mars3d.graphic.SatelliteSensor.Type.Rect,
  188. angle1: 10,
  189. angle2: 5,
  190. color: "#6ef500",
  191. reverse: false,
  192. show: true,
  193. },
  194. path: {
  195. show: true,
  196. color: "#00ff00",
  197. opacity: 0.5,
  198. width: 1,
  199. },
  200. fixedFrameTransform: Cesium.Transforms.localFrameToFixedFrameGenerator("east", "south"),
  201. popup: `高分1号`,
  202. });
  203. graphicLayer.addGraphic(weixin);
  204. //显示 坐标系参考轴
  205. $("#chkShowModelMatrix").change(function () {
  206. var val = $(this).is(":checked");
  207. weixin.debugAxis = val;
  208. });
  209. $("#btnCenter").click(function () {
  210. weixin.flyTo();
  211. });
  212. $("#btnSelPoint").click(function () {
  213. if (weixin.lookAt) {
  214. weixin.lookAt = null;
  215. $("#btnSelPoint").val("凝视目标");
  216. } else {
  217. map.graphicLayer.startDraw({
  218. type: "point",
  219. style: {
  220. pixelSize: 12,
  221. color: "#ffff00",
  222. },
  223. success: function (graphic) {
  224. var position = graphic.positionShow;
  225. map.graphicLayer.clear();
  226. weixin.lookAt = position;
  227. $("#btnSelPoint").val("取消凝视目标");
  228. },
  229. });
  230. }
  231. });
  232. //滑动条
  233. $("#model_pitch")
  234. .slider({ min: -180, max: 180, step: 0.01, value: 0 })
  235. .on("change", (e) => {
  236. if (e && e.value) {
  237. weixin.pitch = e.value.newValue;
  238. }
  239. });
  240. $("#model_roll")
  241. .slider({ min: -180, max: 180, step: 0.01, value: 0 })
  242. .on("change", (e) => {
  243. if (e && e.value) {
  244. weixin.roll = e.value.newValue;
  245. }
  246. });
  247. $("#model_angle1")
  248. .slider({ min: 1, max: 89, step: 0.01, value: 30 })
  249. .on("change", (e) => {
  250. if (e && e.value) {
  251. weixin.angle1 = e.value.newValue;
  252. }
  253. });
  254. $("#model_angle2")
  255. .slider({ min: 1, max: 89, step: 0.01, value: 20 })
  256. .on("change", (e) => {
  257. if (e && e.value) {
  258. weixin.angle2 = e.value.newValue;
  259. }
  260. });
  261. $("input[type=radio][name=sensorType]").change(function () {
  262. var sensorType;
  263. if (this.value === "1") {
  264. weixin.setOptions({
  265. cone: {
  266. sensorType: mars3d.graphic.SatelliteSensor.Type.Conic,
  267. },
  268. });
  269. $("#tr_angle2").hide();
  270. } else {
  271. weixin.setOptions({
  272. cone: {
  273. sensorType: mars3d.graphic.SatelliteSensor.Type.Rect,
  274. },
  275. });
  276. $("#tr_angle2").show();
  277. }
  278. });
  279. $("#td_name").html(weixin.name);
  280. $("#td_tle1").html(weixin.options.tle1);
  281. $("#td_tle2").html(weixin.options.tle2);
  282. //显示实时坐标和时间
  283. weixin.on(mars3d.EventType.change, function (event) {
  284. let date = Cesium.JulianDate.toDate(map.clock.currentTime);
  285. $("#td_time").html(date.format("yyyy-M-d HH:mm:ss"));
  286. if (weixin.position) {
  287. var point = mars3d.LatLngPoint.fromCartesian(weixin.position);
  288. $("#td_jd").html(point.lng);
  289. $("#td_wd").html(point.lat);
  290. $("#td_gd").html(haoutil.str.formatLength(point.alt));
  291. }
  292. });
  293. }
  294. </script>
  295. </body>
  296. </html>