uav.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. {% load staticfiles %}
  2. <!DOCTYPE html>
  3. <html lang="en">
  4. <head>
  5. <meta charset="UTF-8" />
  6. <link href="{% static '/lib/bootstrap-3.3.7/css/bootstrap.css' %}" rel="stylesheet">
  7. <link rel="stylesheet" href="{% static '/lib/font-awesome/4.5.0/css/font-awesome.css' %}">
  8. <link rel="stylesheet" href="{% static '/lib/css/ace.min.css' %}" />
  9. <link rel="stylesheet" href="{% static '/lib/layui/css/layui.css' %}">
  10. <!-- <link rel="stylesheet" href="{% static '/lib/css/ace-skins.min.css' %}"> -->
  11. <!-- <link rel="stylesheet" href="{% static '/lib/css/ace-rtl.min.css' %}"> -->
  12. <style>
  13. body {
  14. background: #fff;
  15. }
  16. .frameParent {
  17. /* display: flex; */
  18. /* justify-content: center; */
  19. /* align-items: center; */
  20. display: table;
  21. width: 100%;
  22. background: gray
  23. }
  24. .frameLeft,
  25. .frameRight {
  26. display: table-cell;
  27. }
  28. /* 图像左 */
  29. .frameLeftTitle {
  30. line-height: 50px;
  31. color: #fff;
  32. background: #313a47;
  33. padding-left: 20px;
  34. letter-spacing: 1px;
  35. }
  36. .frameLeftTitle>span {
  37. margin-right: 30px;
  38. }
  39. .frameLeftTitle>span i {
  40. color: #18ff18;
  41. }
  42. /* 图像右 */
  43. .frameRight {
  44. background: #464e60;
  45. color: rgb(224, 224, 224);
  46. width: 200px;
  47. position: relative;
  48. }
  49. .frameRight a {
  50. color: rgb(214, 182, 0);
  51. }
  52. .frameRight .equipList {
  53. line-height: 50px;
  54. }
  55. .frameRight .equipList li {
  56. padding: 0 15px;
  57. cursor: pointer;
  58. }
  59. .frameRight .equipList li:hover,
  60. .frameRight .equipList li.active {
  61. background: #36404d;
  62. }
  63. /* 控制按钮 */
  64. .ctrlBtnBox {
  65. position: absolute;
  66. bottom: 0;
  67. left: 0;
  68. right: 0;
  69. text-align: center;
  70. }
  71. .ctrlBtnBox .majorKey img {
  72. width: 80%;
  73. margin-bottom: 15px;
  74. }
  75. .ctrlBtnBox .zoomKey img,
  76. .ctrlBtnBox .cruiseKey img {
  77. width: 60%;
  78. margin-bottom: 15px;
  79. }
  80. </style>
  81. <body>
  82. <div class="content">
  83. <!-- <div class="page-header">
  84. <h1>
  85. <font style="vertical-align: inherit;">
  86. <font style="vertical-align: inherit;">
  87. 无人机
  88. </font>
  89. </font>
  90. </h1>
  91. </div> -->
  92. <div class="frameParent">
  93. <!-- 图像 -->
  94. <div class="frameLeft">
  95. <div class="frameLeftTitle">
  96. <span>经度:116.405289</span>
  97. <span>维度:39.90498</span>
  98. <span>飞行时间:2小时15分钟</span>
  99. <span>剩余电量:
  100. <i class="fa fa-battery-2" aria-hidden="true"></i> 39%</span>
  101. </div>
  102. <div>
  103. <div id="map"></div>
  104. </div>
  105. </div>
  106. <!-- 控制 -->
  107. <div class="frameRight">
  108. <!-- 设备列表 -->
  109. <div>
  110. <div>
  111. <ul class="equipList">
  112. <li class="active">
  113. <img src="{% static '/img/uavImg/icon.png' %}" alt="">
  114. <span id="123456">设备123456</span>
  115. <a href="#">
  116. <i class="fa fa-file-photo-o" aria-hidden="true"></i>
  117. </a>
  118. </li>
  119. <li>
  120. <img src="{% static '/img/uavImg/icon.png' %}" alt="">
  121. <span id="123456">设备123456</span>
  122. <a href="#">
  123. <i class="fa fa-file-photo-o" aria-hidden="true"></i>
  124. </a>
  125. </li>
  126. <li>
  127. <img src="{% static '/img/uavImg/icon.png' %}" alt="">
  128. <span id="123456">设备123456</span>
  129. <a href="#">
  130. <i class="fa fa-file-photo-o" aria-hidden="true"></i>
  131. </a>
  132. </li>
  133. <li>
  134. <img src="{% static '/img/uavImg/icon.png' %}" alt="">
  135. <span id="123456">设备123456</span>
  136. </li>
  137. <li>
  138. <img src="{% static '/img/uavImg/icon.png' %}" alt="">
  139. <span id="123456">设备123456</span>
  140. </li>
  141. </ul>
  142. </div>
  143. </div>
  144. <!-- 控制按钮 -->
  145. <div class="ctrlBtnBox">
  146. <div>
  147. <div class="majorKey">
  148. <img src="{% static '/img/uavImg/ctrlImg.png' %}" alt="">
  149. </div>
  150. <div class="zoomKey">
  151. <img src="{% static '/img/uavImg/ctrlImg2.png' %}" alt="">
  152. </div>
  153. <div class="cruiseKey">
  154. <img src="{% static '/img/uavImg/ctrlImg3.png' %}" alt="">
  155. </div>
  156. </div>
  157. </div>
  158. </div>
  159. </div>
  160. </div>
  161. <script src="{% static '/lib/js/jquery-2.1.4.min.js' %}"></script>
  162. <script src="{% static '/lib/bootstrap-3.3.7/js/bootstrap.js' %}"></script>
  163. <script type="text/javascript" src='//webapi.amap.com/maps?v=1.4.15&key=a223a998dc112437cb32afb43a8b2c24'></script>
  164. <script src="../../../../plug/ext/dat.gui.min.js?v=1.0.11"></script>
  165. <!-- UI组件库 1.0 -->
  166. <script src="//webapi.amap.com/ui/1.0/main.js?v=1.0.11"></script>
  167. <script src="{% static '/js/common.js' %}?versions=0.5.0"></script>
  168. <script>
  169. $.ajaxSetup({
  170. data: {
  171. csrfmiddlewaretoken: '{{ csrf_token }}'
  172. },
  173. });
  174. </script>
  175. <script>
  176. getHeight()
  177. //创建地图
  178. var map = new AMap.Map('map', {
  179. zoom: 4
  180. });
  181. map.add(new AMap.TileLayer.Satellite());
  182. AMapUI.load(['ui/misc/PathSimplifier', 'lib/$'], function (PathSimplifier, $) {
  183. if (!PathSimplifier.supportCanvas) {
  184. alert('当前环境不支持 Canvas!');
  185. return;
  186. }
  187. var defaultRenderOptions = {
  188. pathNavigatorStyle: {
  189. initRotateDegree: 0,
  190. width: 16,
  191. height: 16,
  192. autoRotate: true,
  193. lineJoin: 'round',
  194. content: 'defaultPathNavigator',
  195. fillStyle: '#087EC4',
  196. strokeStyle: '#116394', //'#eeeeee',
  197. lineWidth: 1,
  198. pathLinePassedStyle: {
  199. lineWidth: 2,
  200. strokeStyle: 'rgba(8, 126, 196, 1)',
  201. borderWidth: 1,
  202. borderStyle: '#eeeeee',
  203. dirArrowStyle: false
  204. }
  205. }
  206. };
  207. var pathSimplifierIns = new PathSimplifier({
  208. zIndex: 100,
  209. //autoSetFitView:false,
  210. map: map, //所属的地图实例
  211. getPath: function (pathData, pathIndex) {
  212. return pathData.path;
  213. },
  214. getHoverTitle: function (pathData, pathIndex, pointIndex) {
  215. if (pointIndex >= 0) {
  216. //point
  217. return pathData.name + ',点:' + pointIndex + '/' + pathData.path.length;
  218. }
  219. return pathData.name + ',点数量' + pathData.path.length;
  220. },
  221. renderOptions: defaultRenderOptions,
  222. // renderOptions: {
  223. // renderAllPointsIfNumberBelow: 100 //绘制路线节点,如不需要可设置为-1
  224. // }
  225. });
  226. window.pathSimplifierIns = pathSimplifierIns;
  227. //设置数据
  228. pathSimplifierIns.setData([{
  229. name: '路线0',
  230. path: [
  231. [114.342379,34.847584],
  232. [114.117159,35.029959],
  233. [113.614535,35.081671],
  234. [113.235506,34.901663],
  235. [113.172335,34.526887],
  236. [113.740877,34.334327],
  237. [114.323153,34.47709],
  238. [114.342379,34.847584],
  239. ]
  240. }]);
  241. pathSimplifierIns.setSelectedPathIndex(0);
  242. //对第一条线路(即索引 0)创建一个巡航器
  243. var navg1 = pathSimplifierIns.createPathNavigator(0, {
  244. loop: true, //循环播放
  245. speed: 50000 //巡航速度,单位千米/小时
  246. });
  247. navg1.start();
  248. });
  249. function getHeight() {
  250. var width = $('#map').css('width').replace("px", "");
  251. var height = width * (9 / 16)
  252. console.log(width)
  253. console.log(height)
  254. $('#map').css('height', height)
  255. scrollBar()
  256. }
  257. window.onresize = function () {
  258. getHeight()
  259. }
  260. </script>
  261. </body>
  262. </html>