components_timeline_tracklayer.html 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857
  1. <!--********************************************************************
  2. * Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  3. *********************************************************************-->
  4. <!DOCTYPE html>
  5. <html>
  6. <head>
  7. <meta charset="UTF-8" />
  8. <title data-i18n="resources.title_componentsTimeLineTracklayer_Vue"></title>
  9. <script type="text/javascript" include="vue,jquery,papaparse" src="../js/include-web.js"></script>
  10. <script
  11. include="lodash,moment,three92,LoaderSupport,OBJLoader2,echarts-vue,iclient-mapboxgl-vue,mapbox-gl-enhance"
  12. src="../../dist/mapboxgl/include-mapboxgl.js"
  13. ></script>
  14. <style>
  15. #main {
  16. position: relative;
  17. margin: 0 auto;
  18. width: 100%;
  19. height: 100%;
  20. }
  21. .sm-left-part {
  22. position: absolute;
  23. width: 270px;
  24. height: 100%;
  25. z-index: 1000;
  26. background: rgba(0, 0, 0, 0.73);
  27. }
  28. .sm-chart-wrapper .sm-component-chart {
  29. display: flex;
  30. }
  31. .sm-component-time-slider {
  32. position: absolute;
  33. left: 270px;
  34. bottom: 0px;
  35. width: calc(100% - 270px);
  36. z-index: 1000;
  37. }
  38. .sm-component-web-map {
  39. position: absolute;
  40. width: 100%;
  41. height: 100%;
  42. }
  43. .sm-gauge-wrapper {
  44. position: absolute;
  45. bottom: 0px;
  46. width: 100%;
  47. margin: 0 auto;
  48. }
  49. .sm-gauge-item {
  50. position: relative;
  51. }
  52. .sm-component-text {
  53. position: absolute;
  54. bottom: 0;
  55. width: 100%;
  56. }
  57. .sm-component-text span {
  58. margin: 0 auto;
  59. }
  60. .sm-chart-wrapper .sm-component-chart,
  61. .sm-chart-wrapper .sm-component-chart .sm-component-collapse-card__content {
  62. width: 270px;
  63. height: 160px;
  64. }
  65. .sm-gauge-wrapper .sm-component-chart,
  66. .sm-gauge-wrapper .sm-component-chart .sm-component-collapse-card__content {
  67. width: 130px;
  68. height: 100px;
  69. }
  70. </style>
  71. </head>
  72. <body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
  73. <div id="main">
  74. <sm-web-map :map-options="mapOptions" :tianditu-key="tiandituKey">
  75. <sm-track-layer v-bind="trackLayers" :position="position"></sm-track-layer>
  76. </sm-web-map>
  77. <div class="sm-left-part">
  78. <div class="sm-chart-wrapper">
  79. <sm-chart icon-class="" v-bind="chart" :dataset="dataset"></sm-chart>
  80. <sm-chart icon-class="" v-bind="chart1" :dataset="dataset"></sm-chart>
  81. <sm-chart icon-class="" v-bind="chart2" :dataset="dataset"></sm-chart>
  82. </div>
  83. <div class="sm-gauge-wrapper">
  84. <div class="sm-gauge-item" style="width:100%">
  85. <sm-chart
  86. icon-class=""
  87. v-bind="gauge"
  88. :dataset="gaugeDataset"
  89. style="margin: 0 auto"
  90. ></sm-chart>
  91. <sm-text title="速度"></sm-text>
  92. </div>
  93. <div class="sm-gauge-item" style="display: inline-block;width:49%">
  94. <sm-chart icon-class="" v-bind="gauge1" :dataset="gaugeDataset"></sm-chart>
  95. <sm-text title="加速度"></sm-text>
  96. </div>
  97. <div class="sm-gauge-item" style="display: inline-block;width:49%">
  98. <sm-chart icon-class="" v-bind="gauge2" :dataset="gaugeDataset"></sm-chart>
  99. <sm-text title="方位角"></sm-text>
  100. </div>
  101. </div>
  102. </div>
  103. <sm-time-slider
  104. :data="data"
  105. :play-interval="2000"
  106. :theme-style="themeStyle"
  107. :checkpoint-style="checkpointStyle"
  108. :label="themeStyle"
  109. :line-style="lineStyle"
  110. @timeplayerchanged="timeplayerchanged"
  111. background="rgba(0, 0, 0, 0.73)"
  112. ></sm-time-slider>
  113. </div>
  114. <script>
  115. new Vue({
  116. el: '#main',
  117. data() {
  118. var host = window.isLocal ? window.server : 'https://iserver.supermap.io';
  119. var attribution =
  120. "<a href='https://www.mapbox.com/about/maps/' target='_blank'>© Mapbox </a>" +
  121. " with <span>© <a href='https://iclient.supermap.io' target='_blank'>SuperMap iClient</a> | </span>" +
  122. " Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' target='_blank'>SuperMap iServer</a></span> ";
  123. return {
  124. tiandituKey: 'f16b023603de8ae8fdd09a2c0feb1ec2',
  125. dataset: {
  126. maxFeatures: '',
  127. type: 'geoJSON',
  128. geoJSON: {
  129. type: 'FeatureCollection',
  130. features: []
  131. }
  132. },
  133. chart: {
  134. datasetOptions: [
  135. {
  136. seriesType: 'line',
  137. isStastic: false,
  138. isStack: false,
  139. xField: 'timestamp',
  140. yField: 'speed',
  141. sort: 'unsort'
  142. }
  143. ],
  144. options: {
  145. series: [
  146. {
  147. data: ['3900', '3340', '3300', '2500', '2000', '520', '100'],
  148. name: 'Y1',
  149. emphasis: { itemStyle: {} },
  150. stack: 0,
  151. type: 'line',
  152. smooth: true,
  153. animationEasing: 'quadraticIn',
  154. animationEasingUpdate: 'quadraticIn',
  155. label: {
  156. normal: {
  157. position: 'top',
  158. show: false,
  159. textStyle: { fontSize: 12 },
  160. smart: false
  161. }
  162. },
  163. showAllSymbol: 'auto',
  164. symbol: 'emptyCircle',
  165. symbolSize: 4,
  166. itemStyle: { borderWidth: 2, color: '#F2F5F8', borderColor: '#F2F5F8' },
  167. lineStyle: { color: '#F2F5F8' }
  168. }
  169. ],
  170. yAxis: {
  171. axisLabel: {
  172. rotate: 0,
  173. fontFamily: 'MicrosoftYaHei',
  174. show: true,
  175. color: '#fff',
  176. fontSize: 12,
  177. align: 'right',
  178. margin: 8
  179. },
  180. axisLine: { lineStyle: { color: '#fff' }, show: true },
  181. name: '速度',
  182. show: true,
  183. splitLine: {
  184. lineStyle: { width: 0.3, type: 'solid', color: '#ccc', opacity: 1 },
  185. show: true
  186. },
  187. splitArea: { show: false },
  188. nameGap: 5,
  189. nameLocation: 'end',
  190. type: 'value',
  191. nameTextStyle: { padding: [0, 0, 5, 0] },
  192. axisTick: { show: false }
  193. },
  194. xAxis: {
  195. axisLabel: {
  196. rotate: 0,
  197. fontFamily: 'MicrosoftYaHei',
  198. show: false,
  199. color: '#fff',
  200. fontSize: 12,
  201. align: 'center',
  202. margin: 8
  203. },
  204. data: ['Fri', 'Thu', 'Sat', 'Sun', 'Wed', 'Tue', 'Mon'],
  205. axisLine: { lineStyle: { color: '#fff' }, show: false },
  206. show: true,
  207. name: '',
  208. axisTick: { alignWithLabel: true, show: false },
  209. splitLine: {
  210. lineStyle: { type: 'solid', color: '#ccc', opacity: 1, width: 0.3 },
  211. show: false
  212. },
  213. nameGap: 2,
  214. nameLocation: 'end',
  215. type: 'category',
  216. boundaryGap: true
  217. },
  218. grid: { top: 35, left: 36, bottom: 35, right: 20 },
  219. legend: {
  220. data: ['speed'],
  221. show: false,
  222. textStyle: { color: '#fff', fontSize: 12 },
  223. type: 'scroll',
  224. top: 'top',
  225. left: 'center'
  226. },
  227. tooltip: {
  228. axisPointer: { shadowStyle: {}, type: 'line' },
  229. trigger: 'axis',
  230. textStyle: { align: 'left' }
  231. },
  232. textStyle: { fontFamily: 'Microsoft YaHei Light' },
  233. title: {
  234. padding: [5, 0, 0, 20],
  235. x: 'left',
  236. text: '',
  237. textStyle: { fontFamily: 'Microsoft YaHei Light', fontWeight: '100' }
  238. },
  239. dataZoom: []
  240. }
  241. },
  242. chart1: {
  243. datasetOptions: [
  244. {
  245. seriesType: 'line',
  246. isStastic: false,
  247. isStack: false,
  248. xField: 'timestamp',
  249. yField: 'acceleration',
  250. sort: 'unsort'
  251. }
  252. ],
  253. options: {
  254. series: [
  255. {
  256. data: ['3900', '3340', '3300', '2500', '2000', '520', '100'],
  257. name: 'Y1',
  258. emphasis: { itemStyle: {} },
  259. stack: 0,
  260. type: 'line',
  261. smooth: true,
  262. animationEasing: 'quadraticIn',
  263. animationEasingUpdate: 'quadraticIn',
  264. label: {
  265. normal: {
  266. position: 'top',
  267. show: false,
  268. textStyle: { fontSize: 12 },
  269. smart: false
  270. }
  271. },
  272. showAllSymbol: 'auto',
  273. symbol: 'emptyCircle',
  274. symbolSize: 4,
  275. itemStyle: { borderWidth: 2, color: '#F2F5F8', borderColor: '#F2F5F8' },
  276. lineStyle: { color: '#F2F5F8' }
  277. }
  278. ],
  279. yAxis: {
  280. axisLabel: {
  281. rotate: 0,
  282. fontFamily: 'MicrosoftYaHei',
  283. show: true,
  284. color: '#fff',
  285. fontSize: 12,
  286. align: 'right',
  287. margin: 8
  288. },
  289. axisLine: { lineStyle: { color: '#fff' }, show: true },
  290. name: '加速度',
  291. show: true,
  292. splitLine: {
  293. lineStyle: { width: 0.3, type: 'solid', color: '#ccc', opacity: 1 },
  294. show: true
  295. },
  296. splitArea: { show: false },
  297. nameGap: 5,
  298. nameLocation: 'end',
  299. type: 'value',
  300. nameTextStyle: { padding: [0, 0, 5, 0] },
  301. axisTick: { show: false }
  302. },
  303. xAxis: {
  304. axisLabel: {
  305. rotate: 0,
  306. fontFamily: 'MicrosoftYaHei',
  307. show: false,
  308. color: '#fff',
  309. fontSize: 12,
  310. align: 'center',
  311. margin: 8
  312. },
  313. data: ['Fri', 'Thu', 'Sat', 'Sun', 'Wed', 'Tue', 'Mon'],
  314. axisLine: { lineStyle: { color: '#fff' }, show: false },
  315. show: true,
  316. name: '',
  317. axisTick: { alignWithLabel: true, show: false },
  318. splitLine: {
  319. lineStyle: { type: 'solid', color: '#ccc', opacity: 1, width: 0.3 },
  320. show: false
  321. },
  322. nameGap: 2,
  323. nameLocation: 'end',
  324. type: 'category',
  325. boundaryGap: true
  326. },
  327. grid: { top: 35, left: 36, bottom: 35, right: 20 },
  328. legend: {
  329. data: ['acceleration'],
  330. show: false,
  331. textStyle: { color: '#fff', fontSize: 12 },
  332. type: 'scroll',
  333. top: 'top',
  334. left: 'center'
  335. },
  336. tooltip: {
  337. axisPointer: { shadowStyle: {}, type: 'line' },
  338. trigger: 'axis',
  339. textStyle: { align: 'left' }
  340. },
  341. textStyle: { fontFamily: 'Microsoft YaHei Light' },
  342. title: {
  343. padding: [5, 0, 0, 20],
  344. x: 'left',
  345. text: '',
  346. textStyle: { fontFamily: 'Microsoft YaHei Light', fontWeight: '100' }
  347. },
  348. dataZoom: []
  349. }
  350. },
  351. chart2: {
  352. datasetOptions: [
  353. {
  354. seriesType: 'line',
  355. isStastic: false,
  356. isStack: false,
  357. xField: 'timestamp',
  358. yField: 'wheel_angle',
  359. sort: 'unsort'
  360. }
  361. ],
  362. options: {
  363. series: [
  364. {
  365. data: ['3900', '3340', '3300', '2500', '2000', '520', '100'],
  366. name: 'Y1',
  367. emphasis: { itemStyle: {} },
  368. stack: 0,
  369. type: 'line',
  370. smooth: true,
  371. animationEasing: 'quadraticIn',
  372. animationEasingUpdate: 'quadraticIn',
  373. label: {
  374. normal: {
  375. position: 'top',
  376. show: false,
  377. textStyle: { fontSize: 12 },
  378. smart: false
  379. }
  380. },
  381. showAllSymbol: 'auto',
  382. symbol: 'emptyCircle',
  383. symbolSize: 4,
  384. itemStyle: { borderWidth: 2, color: '#F2F5F8', borderColor: '#F2F5F8' },
  385. lineStyle: { color: '#F2F5F8' }
  386. }
  387. ],
  388. yAxis: {
  389. axisLabel: {
  390. rotate: 0,
  391. fontFamily: 'MicrosoftYaHei',
  392. show: true,
  393. color: '#fff',
  394. fontSize: 12,
  395. align: 'right',
  396. margin: 8
  397. },
  398. axisLine: { lineStyle: { color: '#fff' }, show: true },
  399. name: '方位角',
  400. show: true,
  401. splitLine: {
  402. lineStyle: { width: 0.3, type: 'solid', color: '#ccc', opacity: 1 },
  403. show: true
  404. },
  405. splitArea: { show: false },
  406. nameGap: 5,
  407. nameLocation: 'end',
  408. type: 'value',
  409. nameTextStyle: { padding: [0, 0, 5, 0] },
  410. axisTick: { show: false }
  411. },
  412. xAxis: {
  413. axisLabel: {
  414. rotate: 0,
  415. fontFamily: 'MicrosoftYaHei',
  416. show: false,
  417. color: '#fff',
  418. fontSize: 12,
  419. align: 'center',
  420. margin: 8
  421. },
  422. data: ['Fri', 'Thu', 'Sat', 'Sun', 'Wed', 'Tue', 'Mon'],
  423. axisLine: { lineStyle: { color: '#fff' }, show: false },
  424. show: true,
  425. name: '',
  426. axisTick: { alignWithLabel: true, show: false },
  427. splitLine: {
  428. lineStyle: { type: 'solid', color: '#ccc', opacity: 1, width: 0.3 },
  429. show: false
  430. },
  431. nameGap: 2,
  432. nameLocation: 'end',
  433. type: 'category',
  434. boundaryGap: true
  435. },
  436. grid: { top: 35, left: 36, bottom: 35, right: 20 },
  437. legend: {
  438. data: ['wheel_angle'],
  439. show: false,
  440. textStyle: { color: '#fff', fontSize: 12 },
  441. type: 'scroll',
  442. top: 'top',
  443. left: 'center'
  444. },
  445. tooltip: {
  446. axisPointer: { shadowStyle: {}, type: 'line' },
  447. trigger: 'axis',
  448. textStyle: { align: 'left' }
  449. },
  450. textStyle: { fontFamily: 'Microsoft YaHei Light' },
  451. title: {
  452. padding: [5, 0, 0, 20],
  453. x: 'left',
  454. text: '',
  455. textStyle: { fontFamily: 'Microsoft YaHei Light', fontWeight: '100' }
  456. },
  457. dataZoom: []
  458. }
  459. },
  460. gaugeDataset: { maxFeatures: 20, url: '', type: '', withCredentials: false },
  461. gauge: {
  462. datasetOptions: [{ seriesType: 'gauge' }],
  463. options: {
  464. series: [
  465. {
  466. name: 'inLoop',
  467. type: 'gauge',
  468. min: -15,
  469. max: 15,
  470. center: ['50%', '50%'],
  471. startAngle: 180,
  472. endAngle: 0,
  473. splitNumber: 10,
  474. radius: '70%',
  475. data: [{ value: 0, name: '完成率' }],
  476. title: { show: false, textStyle: { fontSize: 14, color: '#ffffff' } },
  477. detail: { show: true, textStyle: { fontSize: 15, color: '#ffffff' } },
  478. axisTick: { show: false, length: 13, lineStyle: { width: 1, color: '#fff' } },
  479. splitLine: { show: false, length: 20, lineStyle: { width: 2, color: '#fff' } },
  480. axisLabel: {
  481. show: false,
  482. fontSize: 12,
  483. fontWeight: 'normal',
  484. distance: 16,
  485. color: '#fff'
  486. },
  487. axisLine: {
  488. show: true,
  489. lineStyle: {
  490. color: [
  491. [0.36, '#F2F5F8'],
  492. [1, '#D3DDE8']
  493. ],
  494. width: 8
  495. }
  496. },
  497. pointer: { show: true, length: '66%', width: 2 },
  498. itemStyle: { show: false, color: 'auto' }
  499. },
  500. {
  501. name: 'outLoop',
  502. type: 'gauge',
  503. min: -15,
  504. max: 15,
  505. center: ['50%', '50%'],
  506. startAngle: 225,
  507. endAngle: -45,
  508. splitNumber: 10,
  509. radius: '75%',
  510. title: { show: false },
  511. detail: { show: false },
  512. axisTick: {
  513. show: false,
  514. length: -8,
  515. lineStyle: { width: 1, color: '#F2F5F8' },
  516. splitNumber: 7
  517. },
  518. splitLine: {
  519. show: false,
  520. length: -20,
  521. lineStyle: { width: 2, color: '#D3DDE8' }
  522. },
  523. axisLabel: { show: false, fontSize: 12, fontWeight: 'normal', distance: 25 },
  524. axisLine: { show: false },
  525. pointer: { show: false },
  526. itemStyle: { show: true, color: '' }
  527. }
  528. ]
  529. }
  530. },
  531. gauge1: {
  532. datasetOptions: [{ seriesType: 'gauge' }],
  533. options: {
  534. series: [
  535. {
  536. name: 'inLoop',
  537. type: 'gauge',
  538. min: -0.6,
  539. max: 1.2,
  540. center: ['50%', '50%'],
  541. startAngle: 180,
  542. endAngle: 0,
  543. splitNumber: 10,
  544. radius: '70%',
  545. data: [{ value: 0, name: '完成率' }],
  546. title: { show: false, textStyle: { fontSize: 14, color: '#ffffff' } },
  547. detail: { show: true, textStyle: { fontSize: 15, color: '#ffffff' } },
  548. axisTick: { show: false, length: 13, lineStyle: { width: 1, color: '#fff' } },
  549. splitLine: { show: false, length: 20, lineStyle: { width: 2, color: '#fff' } },
  550. axisLabel: {
  551. show: false,
  552. fontSize: 12,
  553. fontWeight: 'normal',
  554. distance: 16,
  555. color: '#fff'
  556. },
  557. axisLine: {
  558. show: true,
  559. lineStyle: {
  560. color: [
  561. [0.36, '#F2F5F8'],
  562. [1, '#D3DDE8']
  563. ],
  564. width: 8
  565. }
  566. },
  567. pointer: { show: true, length: '66%', width: 2 },
  568. itemStyle: { show: false, color: 'auto' }
  569. },
  570. {
  571. name: 'outLoop',
  572. type: 'gauge',
  573. min: -0.6,
  574. max: 1.2,
  575. center: ['50%', '50%'],
  576. startAngle: 225,
  577. endAngle: -45,
  578. splitNumber: 10,
  579. radius: '75%',
  580. title: { show: false },
  581. detail: { show: false },
  582. axisTick: {
  583. show: false,
  584. length: -8,
  585. lineStyle: { width: 1, color: '#F2F5F8' },
  586. splitNumber: 7
  587. },
  588. splitLine: {
  589. show: false,
  590. length: -20,
  591. lineStyle: { width: 2, color: '#D3DDE8' }
  592. },
  593. axisLabel: { show: false, fontSize: 12, fontWeight: 'normal', distance: 25 },
  594. axisLine: { show: false },
  595. pointer: { show: false },
  596. itemStyle: { show: true, color: '' }
  597. }
  598. ]
  599. }
  600. },
  601. gauge2: {
  602. datasetOptions: [{ seriesType: 'gauge' }],
  603. options: {
  604. series: [
  605. {
  606. name: 'inLoop',
  607. type: 'gauge',
  608. min: 0,
  609. max: 7,
  610. center: ['50%', '50%'],
  611. startAngle: 180,
  612. endAngle: 0,
  613. splitNumber: 10,
  614. radius: '70%',
  615. data: [{ value: 0, name: '完成率' }],
  616. title: { show: false, textStyle: { fontSize: 14, color: '#ffffff' } },
  617. detail: { show: true, textStyle: { fontSize: 15, color: '#ffffff' } },
  618. axisTick: { show: false, length: 13, lineStyle: { width: 1, color: '#fff' } },
  619. splitLine: { show: false, length: 20, lineStyle: { width: 2, color: '#fff' } },
  620. axisLabel: {
  621. show: false,
  622. fontSize: 12,
  623. fontWeight: 'normal',
  624. distance: 16,
  625. color: '#fff'
  626. },
  627. axisLine: {
  628. show: true,
  629. lineStyle: {
  630. color: [
  631. [0.36, '#F2F5F8'],
  632. [1, '#D3DDE8']
  633. ],
  634. width: 8
  635. }
  636. },
  637. pointer: { show: true, length: '66%', width: 2 },
  638. itemStyle: { show: false, color: 'auto' }
  639. },
  640. {
  641. name: 'outLoop',
  642. type: 'gauge',
  643. min: 0,
  644. max: 7,
  645. center: ['50%', '50%'],
  646. startAngle: 225,
  647. endAngle: -45,
  648. splitNumber: 10,
  649. radius: '75%',
  650. title: { show: false },
  651. detail: { show: false },
  652. axisTick: {
  653. show: false,
  654. length: -8,
  655. lineStyle: { width: 1, color: '#F2F5F8' },
  656. splitNumber: 7
  657. },
  658. splitLine: {
  659. show: false,
  660. length: -20,
  661. lineStyle: { width: 2, color: '#D3DDE8' }
  662. },
  663. axisLabel: { show: false, fontSize: 12, fontWeight: 'normal', distance: 25 },
  664. axisLine: { show: false },
  665. pointer: { show: false },
  666. itemStyle: { show: true, color: '' }
  667. }
  668. ]
  669. }
  670. },
  671. data: [],
  672. checkpointStyle: { color: '#F2F5F8', background: '#F2F5F8' },
  673. themeStyle: { color: '#F2F5F8', borderColor: '#F2F5F8' },
  674. lineStyle: { background: '#515659', height: '5px', type: 'solid' },
  675. mapOptions: {
  676. pitch: 60,
  677. container: 'map',
  678. style: {
  679. version: 8,
  680. sources: {
  681. buildings: {
  682. type: 'geojson',
  683. data: 'https://iclient.supermap.io/examples/data/buildings.json'
  684. },
  685. baseLayer: {
  686. type: 'raster',
  687. tiles: [
  688. 'https://t0.tianditu.gov.cn/img_w/wmts?tk=1d109683f4d84198e37a38c442d68311&service=WMTS&request=GetTile&version=1.0.0&style=default&tilematrixSet=w&format=tiles&width=256&height=256&layer=img&tilematrix={z}&tilerow={y}&tilecol={x}',
  689. 'https://t1.tianditu.gov.cn/img_w/wmts?tk=1d109683f4d84198e37a38c442d68311&service=WMTS&request=GetTile&version=1.0.0&style=default&tilematrixSet=w&format=tiles&width=256&height=256&layer=img&tilematrix={z}&tilerow={y}&tilecol={x}',
  690. 'https://t2.tianditu.gov.cn/img_w/wmts?tk=1d109683f4d84198e37a38c442d68311&service=WMTS&request=GetTile&version=1.0.0&style=default&tilematrixSet=w&format=tiles&width=256&height=256&layer=img&tilematrix={z}&tilerow={y}&tilecol={x}',
  691. 'https://t3.tianditu.gov.cn/img_w/wmts?tk=1d109683f4d84198e37a38c442d68311&service=WMTS&request=GetTile&version=1.0.0&style=default&tilematrixSet=w&format=tiles&width=256&height=256&layer=img&tilematrix={z}&tilerow={y}&tilecol={x}',
  692. 'https://t4.tianditu.gov.cn/img_w/wmts?tk=1d109683f4d84198e37a38c442d68311&service=WMTS&request=GetTile&version=1.0.0&style=default&tilematrixSet=w&format=tiles&width=256&height=256&layer=img&tilematrix={z}&tilerow={y}&tilecol={x}',
  693. 'https://t5.tianditu.gov.cn/img_w/wmts?tk=1d109683f4d84198e37a38c442d68311&service=WMTS&request=GetTile&version=1.0.0&style=default&tilematrixSet=w&format=tiles&width=256&height=256&layer=img&tilematrix={z}&tilerow={y}&tilecol={x}',
  694. 'https://t6.tianditu.gov.cn/img_w/wmts?tk=1d109683f4d84198e37a38c442d68311&service=WMTS&request=GetTile&version=1.0.0&style=default&tilematrixSet=w&format=tiles&width=256&height=256&layer=img&tilematrix={z}&tilerow={y}&tilecol={x}',
  695. 'https://t7.tianditu.gov.cn/img_w/wmts?tk=1d109683f4d84198e37a38c442d68311&service=WMTS&request=GetTile&version=1.0.0&style=default&tilematrixSet=w&format=tiles&width=256&height=256&layer=img&tilematrix={z}&tilerow={y}&tilecol={x}'
  696. ],
  697. tileSize: 256
  698. }
  699. },
  700. layers: [
  701. { id: 'baseLayer', type: 'raster', source: 'baseLayer' },
  702. {
  703. id: '3d-buildings',
  704. source: 'buildings',
  705. type: 'fill-extrusion',
  706. paint: {
  707. 'fill-extrusion-color': '#484646',
  708. 'fill-extrusion-height': ['*', ['get', 'height'], 5],
  709. 'fill-extrusion-opacity': 1
  710. }
  711. }
  712. ]
  713. },
  714. center: [116.4553, 39.9313],
  715. zoom: 16.51,
  716. maxZoom: 17,
  717. bearing: 180,
  718. rasterTileSize: 256
  719. },
  720. trackLayers: {
  721. loaderType: 'OBJ2',
  722. url: '../data/track-layer/car.obj',
  723. obj2Url: '../data/track-layer/car.obj',
  724. gltfUrl: '',
  725. imgUrl: '',
  726. displayLine: 'All',
  727. layerStyle: {
  728. line: {
  729. paint: { 'line-color': '#13FF13', 'line-width': 20, 'line-opacity': 0.8 }
  730. }
  731. },
  732. direction: { front: 'x', bottom: '-z' },
  733. unit: 'millimeter',
  734. scale: 5,
  735. followCamera: true,
  736. trackPoints: []
  737. },
  738. position: {
  739. prevTimestamp: null,
  740. currentTimestamp: 1599810915000,
  741. nextTimestamp: 1599810920000,
  742. step: 3000
  743. }
  744. };
  745. },
  746. created() {
  747. SuperMap.Components.setTheme({ textColor: '#fff', background: 'rgb(0,0,0,0)' });
  748. this.requestData();
  749. },
  750. methods: {
  751. requestData() {
  752. var _this = this;
  753. $.get('../data/track-layer/outTime.json', function(res) {
  754. _this.timeData = res;
  755. _this.setData(res);
  756. _this.trackLayers.trackPoints = _this.getAllDataFeatures(res);
  757. _this.timeplayerchanged({ currentTimestamp: 1599810915000, lastIndex: 0, nextIndex: 1 });
  758. });
  759. },
  760. setData(data) {
  761. var keys = [];
  762. for (var key in data) {
  763. keys.push(Number(key));
  764. }
  765. this.data = keys;
  766. },
  767. timeplayerchanged(val) {
  768. var currentIndex = val.lastIndex;
  769. var nextIndex = val.nextIndex;
  770. var currentTimeStamp = val.currentTimeStamp;
  771. if (currentIndex === -1) {
  772. return;
  773. }
  774. var timestamp = this.data[currentIndex] + '';
  775. var data = this.timeData[timestamp];
  776. this.gauge.options.series[0].data[0].value = data.properties.speed;
  777. this.gauge1.options.series[0].data[0].value = data.properties.acceleration;
  778. this.gauge2.options.series[0].data[0].value = data.properties.wheel_angle;
  779. var chartData = this.getDataByDates(this.timeData, Number(this.data[0]), Number(timestamp));
  780. var chartFeatures = this.createChartFeatures(chartData, [
  781. 'speed',
  782. 'acceleration',
  783. 'wheel_angle'
  784. ]);
  785. this.dataset.geoJSON = {
  786. type: 'FeatureCollection',
  787. features: chartFeatures
  788. };
  789. this.position = {
  790. prevTimestamp: Number(this.data[currentIndex] + '000'),
  791. currentTimestamp: Number(currentTimeStamp),
  792. nextTimestamp: Number(this.data[nextIndex] + '000'),
  793. step: 3000
  794. };
  795. },
  796. getAllDataFeatures(data) {
  797. var features = [];
  798. for (var key in data) {
  799. data[key].properties.timestamp = Number(key + '000');
  800. features.push(data[key]);
  801. }
  802. return features;
  803. },
  804. createChartFeatures(data, yFields) {
  805. var results = [];
  806. for (var timestamp in data) {
  807. var result = {};
  808. result['timestamp'] = this.timestamp2Date(timestamp);
  809. var datas = data[timestamp];
  810. yFields.forEach(yField => {
  811. result[yField] = datas.properties[yField];
  812. });
  813. results.push(result);
  814. }
  815. results = results.map(val => {
  816. var feature = {};
  817. feature.properties = val;
  818. return feature;
  819. });
  820. return results;
  821. },
  822. getDataByDates(data, start, end) {
  823. var newdata = {};
  824. if (data && start && end) {
  825. if (start === end) {
  826. var timestamp = this.getNearestDataIndex(this.data, start);
  827. newdata[start] = data[timestamp + ''];
  828. }
  829. for (var timestamp in data) {
  830. if (timestamp >= start && timestamp <= end) {
  831. newdata[timestamp] = data[timestamp + ''];
  832. }
  833. }
  834. }
  835. return newdata;
  836. },
  837. getNearestDataIndex(data, timestamp) {
  838. var keys = data;
  839. var index = _.findLastIndex(keys, function(val) {
  840. return val <= timestamp;
  841. });
  842. return keys[index];
  843. },
  844. timestamp2Date(timestamp) {
  845. return timestamp ? moment(timestamp * 1000).format('YYYY-MM-DD HH:mm:ss') : '';
  846. }
  847. }
  848. });
  849. </script>
  850. </body>
  851. </html>