@vtx/ol-map 1.0.144 → 1.0.145

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (511) hide show
  1. package/lib/_util/EventEmitter.js +78 -0
  2. package/lib/_util/EventEmitter.js.map +1 -0
  3. package/lib/_util/StyleCache.js +46 -0
  4. package/lib/_util/StyleCache.js.map +1 -0
  5. package/lib/_util/encryptParams.js +60 -0
  6. package/lib/_util/encryptParams.js.map +1 -0
  7. package/lib/_util/filterSpecialCharacters.js +90 -0
  8. package/lib/_util/filterSpecialCharacters.js.map +1 -0
  9. package/lib/_util/getComponentProps.js +14 -0
  10. package/lib/_util/getComponentProps.js.map +1 -0
  11. package/lib/_util/getCookie.js +24 -0
  12. package/lib/_util/getCookie.js.map +1 -0
  13. package/lib/_util/getDefaultMapInfo.js +50 -0
  14. package/lib/_util/getDefaultMapInfo.js.map +1 -0
  15. package/lib/_util/getSystemInfo.js +26 -0
  16. package/lib/_util/getSystemInfo.js.map +1 -0
  17. package/lib/_util/getToken.js +27 -0
  18. package/lib/_util/getToken.js.map +1 -0
  19. package/lib/_util/getUrlParam.js +15 -0
  20. package/lib/_util/getUrlParam.js.map +1 -0
  21. package/lib/_util/http.js +176 -0
  22. package/lib/_util/http.js.map +1 -0
  23. package/lib/_util/isFunction.js +10 -0
  24. package/lib/_util/isFunction.js.map +1 -0
  25. package/lib/_util/isObject.js +10 -0
  26. package/lib/_util/isObject.js.map +1 -0
  27. package/lib/_util/layer.js +152 -0
  28. package/lib/_util/layer.js.map +1 -0
  29. package/lib/_util/mapTool.js +188 -0
  30. package/lib/_util/mapTool.js.map +1 -0
  31. package/lib/_util/projzh/datum/bd-09.js +44 -0
  32. package/lib/_util/projzh/datum/bd-09.js.map +1 -0
  33. package/lib/_util/projzh/datum/gcj-02.js +72 -0
  34. package/lib/_util/projzh/datum/gcj-02.js.map +1 -0
  35. package/lib/_util/projzh/datum/index.js +14 -0
  36. package/lib/_util/projzh/datum/index.js.map +1 -0
  37. package/lib/_util/projzh/index.js +40 -0
  38. package/lib/_util/projzh/index.js.map +1 -0
  39. package/lib/_util/projzh/projection/baidu-mercator.js +74 -0
  40. package/lib/_util/projzh/projection/baidu-mercator.js.map +1 -0
  41. package/lib/_util/projzh/projection/index.js +14 -0
  42. package/lib/_util/projzh/projection/index.js.map +1 -0
  43. package/lib/_util/projzh/projection/spherical-mercator.js +25 -0
  44. package/lib/_util/projzh/projection/spherical-mercator.js.map +1 -0
  45. package/lib/_util/projzh/util.js +27 -0
  46. package/lib/_util/projzh/util.js.map +1 -0
  47. package/lib/_util/search.js +130 -0
  48. package/lib/_util/search.js.map +1 -0
  49. package/lib/_util/setCookie.js +15 -0
  50. package/lib/_util/setCookie.js.map +1 -0
  51. package/lib/_util/stringToFun.js +25 -0
  52. package/lib/_util/stringToFun.js.map +1 -0
  53. package/lib/_util/transform.js +169 -0
  54. package/lib/_util/transform.js.map +1 -0
  55. package/lib/_util/useColSize.js +28 -0
  56. package/lib/_util/useColSize.js.map +1 -0
  57. package/lib/_util/useInterval.js +19 -0
  58. package/lib/_util/useInterval.js.map +1 -0
  59. package/lib/_util/useSet.js +44 -0
  60. package/lib/_util/useSet.js.map +1 -0
  61. package/lib/analysis-layer/index.js +449 -0
  62. package/lib/analysis-layer/index.js.map +1 -0
  63. package/lib/analysis-layer/style/css.js +2 -0
  64. package/lib/analysis-layer/style/css.js.map +1 -0
  65. package/lib/analysis-layer/style/index.js +2 -0
  66. package/lib/analysis-layer/style/index.js.map +1 -0
  67. package/lib/assets/arrow.png +0 -0
  68. package/lib/assets/base-img-1.png +0 -0
  69. package/lib/assets/base-img-2.png +0 -0
  70. package/lib/assets/base-img-3.png +0 -0
  71. package/lib/assets/base-img-4.png +0 -0
  72. package/lib/assets/base-img-5.png +0 -0
  73. package/lib/assets/base-img-6.png +0 -0
  74. package/lib/assets/base-img.png +0 -0
  75. package/lib/assets/bz.png +0 -0
  76. package/lib/assets/img.png +0 -0
  77. package/lib/assets/kz.png +0 -0
  78. package/lib/assets/ll.png +0 -0
  79. package/lib/assets/location.png +0 -0
  80. package/lib/assets/noLocation.png +0 -0
  81. package/lib/assets/people.png +0 -0
  82. package/lib/assets/qd.png +0 -0
  83. package/lib/assets/sw.png +0 -0
  84. package/lib/assets/yl.png +0 -0
  85. package/lib/assets/zd.png +0 -0
  86. package/lib/buffer-draw/BufferDraw.js +398 -0
  87. package/lib/buffer-draw/BufferDraw.js.map +1 -0
  88. package/lib/buffer-draw/index.js +56 -0
  89. package/lib/buffer-draw/index.js.map +1 -0
  90. package/lib/buffer-draw/style/css.js +2 -0
  91. package/lib/buffer-draw/style/css.js.map +1 -0
  92. package/lib/buffer-draw/style/index.js +2 -0
  93. package/lib/buffer-draw/style/index.js.map +1 -0
  94. package/lib/circle/Circle.js +51 -0
  95. package/lib/circle/Circle.js.map +1 -0
  96. package/lib/circle/index.js +64 -0
  97. package/lib/circle/index.js.map +1 -0
  98. package/lib/circle/style/css.js +2 -0
  99. package/lib/circle/style/css.js.map +1 -0
  100. package/lib/circle/style/index.js +2 -0
  101. package/lib/circle/style/index.js.map +1 -0
  102. package/lib/config.js +12 -0
  103. package/lib/config.js.map +1 -0
  104. package/lib/convertCamelToCSS.js +23 -0
  105. package/lib/convertCamelToCSS.js.map +1 -0
  106. package/lib/dom/Dom.js +39 -0
  107. package/lib/dom/Dom.js.map +1 -0
  108. package/lib/dom/index.js +61 -0
  109. package/lib/dom/index.js.map +1 -0
  110. package/lib/dom/style/css.js +2 -0
  111. package/lib/dom/style/css.js.map +1 -0
  112. package/lib/dom/style/index.js +2 -0
  113. package/lib/dom/style/index.js.map +1 -0
  114. package/lib/events/index.js +25 -0
  115. package/lib/events/index.js.map +1 -0
  116. package/lib/feature-draw/FeatureDraw.js +230 -0
  117. package/lib/feature-draw/FeatureDraw.js.map +1 -0
  118. package/lib/feature-draw/index.js +73 -0
  119. package/lib/feature-draw/index.js.map +1 -0
  120. package/lib/feature-draw/style/css.js +2 -0
  121. package/lib/feature-draw/style/css.js.map +1 -0
  122. package/lib/feature-draw/style/index.js +2 -0
  123. package/lib/feature-draw/style/index.js.map +1 -0
  124. package/lib/feature-layer/FeatureLayer.js +1039 -0
  125. package/lib/feature-layer/FeatureLayer.js.map +1 -0
  126. package/lib/feature-layer/MyCluster.js +150 -0
  127. package/lib/feature-layer/MyCluster.js.map +1 -0
  128. package/lib/feature-layer/createFeatureCollection.js +167 -0
  129. package/lib/feature-layer/createFeatureCollection.js.map +1 -0
  130. package/lib/feature-layer/index.js +154 -0
  131. package/lib/feature-layer/index.js.map +1 -0
  132. package/lib/feature-layer/style/css.js +4 -0
  133. package/lib/feature-layer/style/css.js.map +1 -0
  134. package/lib/feature-layer/style/index.css +0 -0
  135. package/lib/feature-layer/style/index.js +4 -0
  136. package/lib/feature-layer/style/index.js.map +1 -0
  137. package/lib/feature-layer/style/index.less +0 -0
  138. package/lib/flow-line-layer/FlowLineLayer.js +197 -0
  139. package/lib/flow-line-layer/FlowLineLayer.js.map +1 -0
  140. package/lib/flow-line-layer/index.js +126 -0
  141. package/lib/flow-line-layer/index.js.map +1 -0
  142. package/lib/flow-line-layer/style/css.js +4 -0
  143. package/lib/flow-line-layer/style/css.js.map +1 -0
  144. package/lib/flow-line-layer/style/index.css +0 -0
  145. package/lib/flow-line-layer/style/index.js +4 -0
  146. package/lib/flow-line-layer/style/index.js.map +1 -0
  147. package/lib/flow-line-layer/style/index.less +0 -0
  148. package/lib/fly-line-layer/FlyLineLayer.js +217 -0
  149. package/lib/fly-line-layer/FlyLineLayer.js.map +1 -0
  150. package/lib/fly-line-layer/index.js +108 -0
  151. package/lib/fly-line-layer/index.js.map +1 -0
  152. package/lib/fly-line-layer/style/css.js +4 -0
  153. package/lib/fly-line-layer/style/css.js.map +1 -0
  154. package/lib/fly-line-layer/style/index.css +0 -0
  155. package/lib/fly-line-layer/style/index.js +4 -0
  156. package/lib/fly-line-layer/style/index.js.map +1 -0
  157. package/lib/fly-line-layer/style/index.less +0 -0
  158. package/lib/group-layer/GroupLayer.js +132 -0
  159. package/lib/group-layer/GroupLayer.js.map +1 -0
  160. package/lib/group-layer/index.js +73 -0
  161. package/lib/group-layer/index.js.map +1 -0
  162. package/lib/group-layer/style/css.js +4 -0
  163. package/lib/group-layer/style/css.js.map +1 -0
  164. package/lib/group-layer/style/index.css +0 -0
  165. package/lib/group-layer/style/index.js +4 -0
  166. package/lib/group-layer/style/index.js.map +1 -0
  167. package/lib/group-layer/style/index.less +0 -0
  168. package/lib/heatmap-layer/HeatmapLayer.js +191 -0
  169. package/lib/heatmap-layer/HeatmapLayer.js.map +1 -0
  170. package/lib/heatmap-layer/index.js +93 -0
  171. package/lib/heatmap-layer/index.js.map +1 -0
  172. package/lib/heatmap-layer/style/css.js +4 -0
  173. package/lib/heatmap-layer/style/css.js.map +1 -0
  174. package/lib/heatmap-layer/style/index.css +0 -0
  175. package/lib/heatmap-layer/style/index.js +4 -0
  176. package/lib/heatmap-layer/style/index.js.map +1 -0
  177. package/lib/heatmap-layer/style/index.less +0 -0
  178. package/lib/high-layer/HighLayer.js +199 -0
  179. package/lib/high-layer/HighLayer.js.map +1 -0
  180. package/lib/high-layer/index.js +44 -0
  181. package/lib/high-layer/index.js.map +1 -0
  182. package/lib/high-layer/style/css.js +2 -0
  183. package/lib/high-layer/style/css.js.map +1 -0
  184. package/lib/high-layer/style/index.js +2 -0
  185. package/lib/high-layer/style/index.js.map +1 -0
  186. package/lib/image-layer/ImageLayer.js +330 -0
  187. package/lib/image-layer/ImageLayer.js.map +1 -0
  188. package/lib/image-layer/ImageTileLayer.js +332 -0
  189. package/lib/image-layer/ImageTileLayer.js.map +1 -0
  190. package/lib/image-layer/index.js +100 -0
  191. package/lib/image-layer/index.js.map +1 -0
  192. package/lib/image-layer/style/css.js +4 -0
  193. package/lib/image-layer/style/css.js.map +1 -0
  194. package/lib/image-layer/style/index.css +0 -0
  195. package/lib/image-layer/style/index.js +4 -0
  196. package/lib/image-layer/style/index.js.map +1 -0
  197. package/lib/image-layer/style/index.less +0 -0
  198. package/lib/index.js +201 -0
  199. package/lib/index.js.map +1 -0
  200. package/lib/legend/index.js +220 -0
  201. package/lib/legend/index.js.map +1 -0
  202. package/lib/legend/style/css.js +8 -0
  203. package/lib/legend/style/css.js.map +1 -0
  204. package/lib/legend/style/index.css +74 -0
  205. package/lib/legend/style/index.js +8 -0
  206. package/lib/legend/style/index.js.map +1 -0
  207. package/lib/legend/style/index.less +73 -0
  208. package/lib/map/Analysis.js +148 -0
  209. package/lib/map/Analysis.js.map +1 -0
  210. package/lib/map/Layers.js +337 -0
  211. package/lib/map/Layers.js.map +1 -0
  212. package/lib/map/Popup.js +370 -0
  213. package/lib/map/Popup.js.map +1 -0
  214. package/lib/map/ScaleDenominator.js +68 -0
  215. package/lib/map/ScaleDenominator.js.map +1 -0
  216. package/lib/map/Test.js +144 -0
  217. package/lib/map/Test.js.map +1 -0
  218. package/lib/map/getBaseLayers/imagery/amap/AmapImageryProvider.js +163 -0
  219. package/lib/map/getBaseLayers/imagery/amap/AmapImageryProvider.js.map +1 -0
  220. package/lib/map/getBaseLayers/imagery/baidu/BaiduImageryProvider.js +84 -0
  221. package/lib/map/getBaseLayers/imagery/baidu/BaiduImageryProvider.js.map +1 -0
  222. package/lib/map/getBaseLayers/imagery/geoq/GeoQImageryProvider.js +65 -0
  223. package/lib/map/getBaseLayers/imagery/geoq/GeoQImageryProvider.js.map +1 -0
  224. package/lib/map/getBaseLayers/imagery/tdt/TdtImageryProvider.js +84 -0
  225. package/lib/map/getBaseLayers/imagery/tdt/TdtImageryProvider.js.map +1 -0
  226. package/lib/map/getBaseLayers/index.js +46 -0
  227. package/lib/map/getBaseLayers/index.js.map +1 -0
  228. package/lib/map/index.js +819 -0
  229. package/lib/map/index.js.map +1 -0
  230. package/lib/map/style/css.js +5 -0
  231. package/lib/map/style/css.js.map +1 -0
  232. package/lib/map/style/index.css +171 -0
  233. package/lib/map/style/index.js +5 -0
  234. package/lib/map/style/index.js.map +1 -0
  235. package/lib/map/style/index.less +152 -0
  236. package/lib/map-icon/svg/index.js +81 -0
  237. package/lib/map-icon/svg/index.js.map +1 -0
  238. package/lib/map-icon/svg/tuceng.svg.js +2 -0
  239. package/lib/map-icon/svg/tuceng.svg.js.map +1 -0
  240. package/lib/marker/Marker.js +105 -0
  241. package/lib/marker/Marker.js.map +1 -0
  242. package/lib/marker/index.js +61 -0
  243. package/lib/marker/index.js.map +1 -0
  244. package/lib/marker/style/css.js +2 -0
  245. package/lib/marker/style/css.js.map +1 -0
  246. package/lib/marker/style/index.js +2 -0
  247. package/lib/marker/style/index.js.map +1 -0
  248. package/lib/path-line-layer/PathLineLayer.js +45 -0
  249. package/lib/path-line-layer/PathLineLayer.js.map +1 -0
  250. package/lib/path-line-layer/getPathLineStyles.js +71 -0
  251. package/lib/path-line-layer/getPathLineStyles.js.map +1 -0
  252. package/lib/path-line-layer/index.js +151 -0
  253. package/lib/path-line-layer/index.js.map +1 -0
  254. package/lib/path-line-layer/style/css.js +4 -0
  255. package/lib/path-line-layer/style/css.js.map +1 -0
  256. package/lib/path-line-layer/style/index.css +0 -0
  257. package/lib/path-line-layer/style/index.js +4 -0
  258. package/lib/path-line-layer/style/index.js.map +1 -0
  259. package/lib/path-line-layer/style/index.less +0 -0
  260. package/lib/path-play-back/PathPlayBack.js +674 -0
  261. package/lib/path-play-back/PathPlayBack.js.map +1 -0
  262. package/lib/path-play-back/index.js +75 -0
  263. package/lib/path-play-back/index.js.map +1 -0
  264. package/lib/path-play-back/style/css.js +2 -0
  265. package/lib/path-play-back/style/css.js.map +1 -0
  266. package/lib/path-play-back/style/index.js +2 -0
  267. package/lib/path-play-back/style/index.js.map +1 -0
  268. package/lib/poi-search/Location.js +62 -0
  269. package/lib/poi-search/Location.js.map +1 -0
  270. package/lib/poi-search/PoiList.js +115 -0
  271. package/lib/poi-search/PoiList.js.map +1 -0
  272. package/lib/poi-search/Search.js +207 -0
  273. package/lib/poi-search/Search.js.map +1 -0
  274. package/lib/poi-search/index.js +172 -0
  275. package/lib/poi-search/index.js.map +1 -0
  276. package/lib/poi-search/style/css.js +8 -0
  277. package/lib/poi-search/style/css.js.map +1 -0
  278. package/lib/poi-search/style/index.css +96 -0
  279. package/lib/poi-search/style/index.js +8 -0
  280. package/lib/poi-search/style/index.js.map +1 -0
  281. package/lib/poi-search/style/index.less +97 -0
  282. package/lib/point/Point.js +57 -0
  283. package/lib/point/Point.js.map +1 -0
  284. package/lib/point/index.js +61 -0
  285. package/lib/point/index.js.map +1 -0
  286. package/lib/point/style/css.js +2 -0
  287. package/lib/point/style/css.js.map +1 -0
  288. package/lib/point/style/index.js +2 -0
  289. package/lib/point/style/index.js.map +1 -0
  290. package/lib/polygon/Polygon.js +51 -0
  291. package/lib/polygon/Polygon.js.map +1 -0
  292. package/lib/polygon/index.js +61 -0
  293. package/lib/polygon/index.js.map +1 -0
  294. package/lib/polygon/style/css.js +2 -0
  295. package/lib/polygon/style/css.js.map +1 -0
  296. package/lib/polygon/style/index.js +2 -0
  297. package/lib/polygon/style/index.js.map +1 -0
  298. package/lib/polyline/Polyline.js +51 -0
  299. package/lib/polyline/Polyline.js.map +1 -0
  300. package/lib/polyline/index.js +61 -0
  301. package/lib/polyline/index.js.map +1 -0
  302. package/lib/polyline/style/css.js +2 -0
  303. package/lib/polyline/style/css.js.map +1 -0
  304. package/lib/polyline/style/index.js +2 -0
  305. package/lib/polyline/style/index.js.map +1 -0
  306. package/lib/popup/index.js +202 -0
  307. package/lib/popup/index.js.map +1 -0
  308. package/lib/popup/style/css.js +4 -0
  309. package/lib/popup/style/css.js.map +1 -0
  310. package/lib/popup/style/index.css +131 -0
  311. package/lib/popup/style/index.js +4 -0
  312. package/lib/popup/style/index.js.map +1 -0
  313. package/lib/popup/style/index.less +129 -0
  314. package/lib/provider/index.js +12 -0
  315. package/lib/provider/index.js.map +1 -0
  316. package/lib/provider/style/css.js +2 -0
  317. package/lib/provider/style/css.js.map +1 -0
  318. package/lib/provider/style/index.js +2 -0
  319. package/lib/provider/style/index.js.map +1 -0
  320. package/lib/renderer/Fill.js +37 -0
  321. package/lib/renderer/Fill.js.map +1 -0
  322. package/lib/renderer/Stroke.js +39 -0
  323. package/lib/renderer/Stroke.js.map +1 -0
  324. package/lib/renderer/index.js +137 -0
  325. package/lib/renderer/index.js.map +1 -0
  326. package/lib/renderer/style/css.js +4 -0
  327. package/lib/renderer/style/css.js.map +1 -0
  328. package/lib/renderer/style/index.css +0 -0
  329. package/lib/renderer/style/index.js +4 -0
  330. package/lib/renderer/style/index.js.map +1 -0
  331. package/lib/renderer/style/index.less +0 -0
  332. package/lib/renderer/transformRgb.js +33 -0
  333. package/lib/renderer/transformRgb.js.map +1 -0
  334. package/lib/search-map/VtxModal.js +202 -0
  335. package/lib/search-map/VtxModal.js.map +1 -0
  336. package/lib/search-map/index.js +416 -0
  337. package/lib/search-map/index.js.map +1 -0
  338. package/lib/search-map/style/css.js +6 -0
  339. package/lib/search-map/style/css.js.map +1 -0
  340. package/lib/search-map/style/index.css +73 -0
  341. package/lib/search-map/style/index.js +6 -0
  342. package/lib/search-map/style/index.js.map +1 -0
  343. package/lib/search-map/style/index.less +83 -0
  344. package/lib/search-map/style/modal.css +54 -0
  345. package/lib/search-map/style/modal.less +58 -0
  346. package/lib/style/index.css +0 -0
  347. package/lib/style/index.less +2 -0
  348. package/lib/style/themes/compact.css +0 -0
  349. package/lib/style/themes/compact.less +1 -0
  350. package/lib/style/themes/dark.css +0 -0
  351. package/lib/style/themes/dark.less +9 -0
  352. package/lib/style/themes/default.css +0 -0
  353. package/lib/style/themes/default.less +7 -0
  354. package/lib/style/themes/index.css +0 -0
  355. package/lib/style/themes/index.less +1 -0
  356. package/lib/style/themes/variable.css +0 -0
  357. package/lib/style/themes/variable.less +5 -0
  358. package/lib/tile-layer/TileLayer.js +85 -0
  359. package/lib/tile-layer/TileLayer.js.map +1 -0
  360. package/lib/tile-layer/index.js +52 -0
  361. package/lib/tile-layer/index.js.map +1 -0
  362. package/lib/tile-layer/style/css.js +4 -0
  363. package/lib/tile-layer/style/css.js.map +1 -0
  364. package/lib/tile-layer/style/index.css +0 -0
  365. package/lib/tile-layer/style/index.js +4 -0
  366. package/lib/tile-layer/style/index.js.map +1 -0
  367. package/lib/tile-layer/style/index.less +0 -0
  368. package/lib/tools/Layer/LayerService.js +182 -0
  369. package/lib/tools/Layer/LayerService.js.map +1 -0
  370. package/lib/tools/Layer/LayersCheckService.js +188 -0
  371. package/lib/tools/Layer/LayersCheckService.js.map +1 -0
  372. package/lib/tools/Layer/index.css +50 -0
  373. package/lib/tools/Layer/index.js +225 -0
  374. package/lib/tools/Layer/index.js.map +1 -0
  375. package/lib/tools/Layer/index.less +43 -0
  376. package/lib/tools/Search/index.js +295 -0
  377. package/lib/tools/Search/index.js.map +1 -0
  378. package/lib/tools/Toolbox/BoxSelect/index.js +19 -0
  379. package/lib/tools/Toolbox/BoxSelect/index.js.map +1 -0
  380. package/lib/tools/Toolbox/CircleSelect/index.js +19 -0
  381. package/lib/tools/Toolbox/CircleSelect/index.js.map +1 -0
  382. package/lib/tools/Toolbox/EagleEye/index.js +55 -0
  383. package/lib/tools/Toolbox/EagleEye/index.js.map +1 -0
  384. package/lib/tools/Toolbox/MapBookmark/Bookmark.js +147 -0
  385. package/lib/tools/Toolbox/MapBookmark/Bookmark.js.map +1 -0
  386. package/lib/tools/Toolbox/MapBookmark/index.css +18 -0
  387. package/lib/tools/Toolbox/MapBookmark/index.js +428 -0
  388. package/lib/tools/Toolbox/MapBookmark/index.js.map +1 -0
  389. package/lib/tools/Toolbox/MapBookmark/index.less +20 -0
  390. package/lib/tools/Toolbox/MapDownload/index.js +16 -0
  391. package/lib/tools/Toolbox/MapDownload/index.js.map +1 -0
  392. package/lib/tools/Toolbox/MapPrint/index.css +4 -0
  393. package/lib/tools/Toolbox/MapPrint/index.js +231 -0
  394. package/lib/tools/Toolbox/MapPrint/index.js.map +1 -0
  395. package/lib/tools/Toolbox/MapPrint/index.less +4 -0
  396. package/lib/tools/Toolbox/Measure/Area/index.js +16 -0
  397. package/lib/tools/Toolbox/Measure/Area/index.js.map +1 -0
  398. package/lib/tools/Toolbox/Measure/Distance/index.js +16 -0
  399. package/lib/tools/Toolbox/Measure/Distance/index.js.map +1 -0
  400. package/lib/tools/Toolbox/Measure/Measure.js +227 -0
  401. package/lib/tools/Toolbox/Measure/Measure.js.map +1 -0
  402. package/lib/tools/Toolbox/Measure/index.js +75 -0
  403. package/lib/tools/Toolbox/Measure/index.js.map +1 -0
  404. package/lib/tools/Toolbox/PolygonSelect/index.js +19 -0
  405. package/lib/tools/Toolbox/PolygonSelect/index.js.map +1 -0
  406. package/lib/tools/Toolbox/ScaleLine/index.js +57 -0
  407. package/lib/tools/Toolbox/ScaleLine/index.js.map +1 -0
  408. package/lib/tools/Toolbox/SelectTools/index.css +103 -0
  409. package/lib/tools/Toolbox/SelectTools/index.js +776 -0
  410. package/lib/tools/Toolbox/SelectTools/index.js.map +1 -0
  411. package/lib/tools/Toolbox/SelectTools/index.less +87 -0
  412. package/lib/tools/Toolbox/SpaceQuery/index.css +19 -0
  413. package/lib/tools/Toolbox/SpaceQuery/index.js +592 -0
  414. package/lib/tools/Toolbox/SpaceQuery/index.js.map +1 -0
  415. package/lib/tools/Toolbox/SpaceQuery/index.less +16 -0
  416. package/lib/tools/Toolbox/ZoomInput/index.css +6 -0
  417. package/lib/tools/Toolbox/ZoomInput/index.js +48 -0
  418. package/lib/tools/Toolbox/ZoomInput/index.js.map +1 -0
  419. package/lib/tools/Toolbox/ZoomInput/index.less +6 -0
  420. package/lib/tools/Toolbox/index.css +0 -0
  421. package/lib/tools/Toolbox/index.js +169 -0
  422. package/lib/tools/Toolbox/index.js.map +1 -0
  423. package/lib/tools/Toolbox/index.less +2 -0
  424. package/lib/tools/Utils/CreateOverlay.js +46 -0
  425. package/lib/tools/Utils/CreateOverlay.js.map +1 -0
  426. package/lib/tools/Utils/Draw.js +127 -0
  427. package/lib/tools/Utils/Draw.js.map +1 -0
  428. package/lib/tools/Utils/HighLayer.js +211 -0
  429. package/lib/tools/Utils/HighLayer.js.map +1 -0
  430. package/lib/tools/Utils/measure.js +246 -0
  431. package/lib/tools/Utils/measure.js.map +1 -0
  432. package/lib/tools/Utils/utils.js +263 -0
  433. package/lib/tools/Utils/utils.js.map +1 -0
  434. package/lib/tools/View/index.css +35 -0
  435. package/lib/tools/View/index.js +164 -0
  436. package/lib/tools/View/index.js.map +1 -0
  437. package/lib/tools/View/index.less +28 -0
  438. package/lib/tools/analysis-tool/index.js +111 -0
  439. package/lib/tools/analysis-tool/index.js.map +1 -0
  440. package/lib/tools/base-map-switch/index.js +148 -0
  441. package/lib/tools/base-map-switch/index.js.map +1 -0
  442. package/lib/tools/components/Chart/index.js +817 -0
  443. package/lib/tools/components/Chart/index.js.map +1 -0
  444. package/lib/tools/components/Icon/index.js +31 -0
  445. package/lib/tools/components/Icon/index.js.map +1 -0
  446. package/lib/tools/components/Info/index.css +39 -0
  447. package/lib/tools/components/Info/index.js +34 -0
  448. package/lib/tools/components/Info/index.js.map +1 -0
  449. package/lib/tools/components/Info/index.less +26 -0
  450. package/lib/tools/components/ItemWrap/index.css +43 -0
  451. package/lib/tools/components/ItemWrap/index.js +46 -0
  452. package/lib/tools/components/ItemWrap/index.js.map +1 -0
  453. package/lib/tools/components/ItemWrap/index.less +41 -0
  454. package/lib/tools/components/Modal/index.css +42 -0
  455. package/lib/tools/components/Modal/index.js +45 -0
  456. package/lib/tools/components/Modal/index.js.map +1 -0
  457. package/lib/tools/components/Modal/index.less +33 -0
  458. package/lib/tools/components/MyTabs/index.js +22 -0
  459. package/lib/tools/components/MyTabs/index.js.map +1 -0
  460. package/lib/tools/components/RequiredLabel/index.css +5 -0
  461. package/lib/tools/components/RequiredLabel/index.js +32 -0
  462. package/lib/tools/components/RequiredLabel/index.js.map +1 -0
  463. package/lib/tools/components/RequiredLabel/index.less +5 -0
  464. package/lib/tools/components/Select/index.js +32 -0
  465. package/lib/tools/components/Select/index.js.map +1 -0
  466. package/lib/tools/components/Table/assets/tableIcon.png +0 -0
  467. package/lib/tools/components/Table/index.css +10 -0
  468. package/lib/tools/components/Table/index.js +89 -0
  469. package/lib/tools/components/Table/index.js.map +1 -0
  470. package/lib/tools/components/Table/index.less +13 -0
  471. package/lib/tools/components/ToolItem/index.css +30 -0
  472. package/lib/tools/components/ToolItem/index.js +28 -0
  473. package/lib/tools/components/ToolItem/index.js.map +1 -0
  474. package/lib/tools/components/ToolItem/index.less +27 -0
  475. package/lib/tools/components/ToolsSelect/index.css +15 -0
  476. package/lib/tools/components/ToolsSelect/index.js +44 -0
  477. package/lib/tools/components/ToolsSelect/index.js.map +1 -0
  478. package/lib/tools/components/ToolsSelect/index.less +10 -0
  479. package/lib/tools/full-screen/index.js +45 -0
  480. package/lib/tools/full-screen/index.js.map +1 -0
  481. package/lib/tools/index.js +150 -0
  482. package/lib/tools/index.js.map +1 -0
  483. package/lib/tools/layer-control/index.js +169 -0
  484. package/lib/tools/layer-control/index.js.map +1 -0
  485. package/lib/tools/refresh/index.js +39 -0
  486. package/lib/tools/refresh/index.js.map +1 -0
  487. package/lib/tools/style/css.js +22 -0
  488. package/lib/tools/style/css.js.map +1 -0
  489. package/lib/tools/style/index.css +136 -0
  490. package/lib/tools/style/index.js +22 -0
  491. package/lib/tools/style/index.js.map +1 -0
  492. package/lib/tools/style/index.less +154 -0
  493. package/lib/tools-item/index.js +65 -0
  494. package/lib/tools-item/index.js.map +1 -0
  495. package/lib/use-props/index.js +14 -0
  496. package/lib/use-props/index.js.map +1 -0
  497. package/lib/use-props/style/css.js +2 -0
  498. package/lib/use-props/style/css.js.map +1 -0
  499. package/lib/use-props/style/index.js +2 -0
  500. package/lib/use-props/style/index.js.map +1 -0
  501. package/lib/wms-layer/WmsLayer.js +313 -0
  502. package/lib/wms-layer/WmsLayer.js.map +1 -0
  503. package/lib/wms-layer/index.js +97 -0
  504. package/lib/wms-layer/index.js.map +1 -0
  505. package/lib/wms-layer/style/css.js +4 -0
  506. package/lib/wms-layer/style/css.js.map +1 -0
  507. package/lib/wms-layer/style/index.css +0 -0
  508. package/lib/wms-layer/style/index.js +4 -0
  509. package/lib/wms-layer/style/index.js.map +1 -0
  510. package/lib/wms-layer/style/index.less +0 -0
  511. package/package.json +1 -1
@@ -0,0 +1,674 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ var _Feature = _interopRequireDefault(require("ol/Feature"));
8
+ var _geom = require("ol/geom");
9
+ var _Vector = _interopRequireDefault(require("ol/source/Vector"));
10
+ var _style = require("ol/style");
11
+ var _layer = require("ol/layer");
12
+ var _render = require("ol/render");
13
+ var _people = _interopRequireDefault(require("../assets/people.png"));
14
+ var _qd = _interopRequireDefault(require("../assets/qd.png"));
15
+ var _zd = _interopRequireDefault(require("../assets/zd.png"));
16
+ var _lodash = _interopRequireWildcard(require("lodash"));
17
+ var _createFeatureCollection = require("../feature-layer/createFeatureCollection");
18
+ var _getPathLineStyles = _interopRequireDefault(require("../path-line-layer/getPathLineStyles"));
19
+ var _turf = require("@turf/turf");
20
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
21
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
22
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
23
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
24
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
25
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
26
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
27
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
28
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
29
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
30
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
31
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
32
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
33
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
34
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
35
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
36
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
37
+ var getAngle = function getAngle(point1, point2) {
38
+ var arc = 0;
39
+ if (point2 && point2.length && point1 && point1.length) {
40
+ if (point2[0] - point1[0] >= 0 && point2[1] - point1[1] >= 0 || point2[0] - point1[0] < 0 && point2[1] - point1[1] > 0) {
41
+ arc = Math.atan((point2[0] - point1[0]) / (point2[1] - point1[1]));
42
+ } else if (point2[0] - point1[0] > 0 && point2[1] - point1[1] < 0 || point2[0] - point1[0] < 0 && point2[1] - point1[1] < 0) {
43
+ arc = Math.PI + Math.atan((point2[0] - point1[0]) / (point2[1] - point1[1]));
44
+ }
45
+ }
46
+ return arc;
47
+ };
48
+ var PathPlayBack = exports["default"] = /*#__PURE__*/function () {
49
+ function PathPlayBack(options) {
50
+ _classCallCheck(this, PathPlayBack);
51
+ var data = options.data,
52
+ _options$show = options.show,
53
+ show = _options$show === void 0 ? true : _options$show,
54
+ play = options.play,
55
+ speed = options.speed,
56
+ map = options.map,
57
+ style = options.style,
58
+ onPlaying = options.onPlaying,
59
+ onPlayEnd = options.onPlayEnd,
60
+ _options$repeatPlay = options.repeatPlay,
61
+ repeatPlay = _options$repeatPlay === void 0 ? true : _options$repeatPlay,
62
+ _options$autoView = options.autoView,
63
+ autoView = _options$autoView === void 0 ? false : _options$autoView,
64
+ _options$enableRotati = options.enableRotation,
65
+ enableRotation = _options$enableRotati === void 0 ? false : _options$enableRotati,
66
+ arrowStyle = options.arrowStyle,
67
+ showTrace = options.showTrace,
68
+ _options$traceStyle = options.traceStyle,
69
+ traceStyle = _options$traceStyle === void 0 ? {} : _options$traceStyle,
70
+ _options$showStartPoi = options.showStartPoint,
71
+ showStartPoint = _options$showStartPoi === void 0 ? true : _options$showStartPoi,
72
+ _options$showEndPoint = options.showEndPoint,
73
+ showEndPoint = _options$showEndPoint === void 0 ? true : _options$showEndPoint,
74
+ _options$zIndex = options.zIndex,
75
+ zIndex = _options$zIndex === void 0 ? 10 : _options$zIndex,
76
+ isHighlight = options.isHighlight;
77
+ this._init = false;
78
+ this.speed = speed || 10;
79
+ this.onPlaying = onPlaying;
80
+ this.onPlayEnd = onPlayEnd;
81
+ this.style = style;
82
+ this.repeatPlay = repeatPlay;
83
+ this.enableRotation = enableRotation;
84
+ this.arrowStyle = arrowStyle;
85
+ this.showTrace = showTrace;
86
+ this.traceStyle = traceStyle;
87
+ this.currentIndex = 0;
88
+ this._distance = 0;
89
+ this._lastTime = Date.now();
90
+ this.autoView = autoView;
91
+ this.zIndex = zIndex;
92
+ this.lastCoordinate = null;
93
+ this.distanceRatioArr = [];
94
+ this.dataDistanceRatioArr = [];
95
+ this.isPlayEnd = false;
96
+ this.initRotation = 0;
97
+ this.isHighlight = isHighlight;
98
+ this.startStyle = new _style.Style({
99
+ image: new _style.Icon(_objectSpread({
100
+ anchor: [0.5, 1],
101
+ src: _qd["default"]
102
+ }, (style === null || style === void 0 ? void 0 : style.start) || {}))
103
+ });
104
+ this.endStyle = new _style.Style({
105
+ image: new _style.Icon(_objectSpread({
106
+ anchor: [0.5, 1],
107
+ src: _zd["default"]
108
+ }, (style === null || style === void 0 ? void 0 : style.end) || {}))
109
+ });
110
+ this.geoMarkerStyle = new _style.Style({
111
+ image: new _style.Icon(_objectSpread({
112
+ anchor: [0.5, 1],
113
+ src: _people["default"]
114
+ }, (style === null || style === void 0 ? void 0 : style.geoMarker) || {}))
115
+ });
116
+ this.map = map;
117
+ if (data !== null && data !== void 0 && data.length) {
118
+ this.loadData(data);
119
+ }
120
+ this.play = play || false;
121
+ this.show = show;
122
+ this.showStartPoint = showStartPoint;
123
+ this.showEndPoint = showEndPoint;
124
+ this._init = true;
125
+ }
126
+ return _createClass(PathPlayBack, [{
127
+ key: "play",
128
+ set: function set(val) {
129
+ if (this._init) {
130
+ if (val) {
131
+ this.startAnimation();
132
+ } else {
133
+ this.stopAnimation();
134
+ }
135
+ }
136
+ }
137
+ }, {
138
+ key: "show",
139
+ set: function set(val) {
140
+ this.vectorLayer.setVisible(val);
141
+ if (this._animating) {
142
+ this.stopAnimation();
143
+ }
144
+ }
145
+ }, {
146
+ key: "showStartPoint",
147
+ set: function set(val) {
148
+ if (this.vectorLayer) {
149
+ var source = this.vectorLayer.getSource();
150
+ if (val) {
151
+ !source.hasFeature(this.startMarker) && source.addFeature(this.startMarker);
152
+ } else {
153
+ source.removeFeature(this.startMarker);
154
+ }
155
+ }
156
+ }
157
+ }, {
158
+ key: "showEndPoint",
159
+ set: function set(val) {
160
+ if (this.vectorLayer) {
161
+ var source = this.vectorLayer.getSource();
162
+ if (val) {
163
+ !source.hasFeature(this.endMarker) && source.addFeature(this.endMarker);
164
+ } else {
165
+ source.removeFeature(this.endMarker);
166
+ }
167
+ }
168
+ }
169
+ }, {
170
+ key: "loadObjectData",
171
+ value: function loadObjectData(data) {
172
+ var coordinates = [];
173
+ var distanceArr = [];
174
+ var dataDistanceArr = [];
175
+ var routeFeature = data.map(function (item, index) {
176
+ var geometryInfo = item.geometryInfo;
177
+ var type = geometryInfo.type,
178
+ lngLats = geometryInfo.lngLats,
179
+ coordType = geometryInfo.coordType;
180
+ var lineData = (0, _createFeatureCollection.transformGeometryInfoToWGS84)(lngLats, type, coordType)[0];
181
+ coordinates.push.apply(coordinates, _toConsumableArray(lineData));
182
+ var line = (0, _turf.lineString)(lineData);
183
+ distanceArr.push((0, _turf.length)(line));
184
+ var route = new _geom.LineString(lineData);
185
+ // 计算两个点的之间距离
186
+ lineData.forEach(function (v, i) {
187
+ if (i === 0) {
188
+ dataDistanceArr[index] = [0];
189
+ } else {
190
+ var from = (0, _turf.point)(lineData[i - 1]);
191
+ var to = (0, _turf.point)(v);
192
+ dataDistanceArr[index].push((0, _turf.distance)(from, to));
193
+ }
194
+ });
195
+ return new _Feature["default"](_objectSpread({
196
+ type: 'route',
197
+ geometry: route
198
+ }, item));
199
+ });
200
+ var dataDistanceRatioArr = dataDistanceArr.map(function (arr) {
201
+ var totalDistance = _lodash["default"].sum(arr);
202
+ var list = arr.map(function (distance) {
203
+ return distance / (totalDistance || 1);
204
+ });
205
+ // 计算两个点之间距离的占比
206
+ return list.map(function (distance, index) {
207
+ if (index === 0) {
208
+ return distance;
209
+ } else if (index === arr.length - 1) {
210
+ return 1;
211
+ }
212
+ return _lodash["default"].sum(list.slice(0, index + 1));
213
+ });
214
+ });
215
+ this.distanceArr = distanceArr;
216
+ var totalDistance = _lodash["default"].sum(distanceArr);
217
+ distanceArr = distanceArr.map(function (distance) {
218
+ return distance / (totalDistance || 1);
219
+ });
220
+ this.distanceRatioArr = distanceArr.map(function (distance, index) {
221
+ if (index === 0) {
222
+ return distance;
223
+ } else if (index === distanceArr.length - 1) {
224
+ return 1;
225
+ }
226
+ var total = _lodash["default"].sum(distanceArr.slice(0, index + 1));
227
+ return total > 1 ? 1 : total;
228
+ });
229
+ this.dataDistanceRatioArr = dataDistanceRatioArr;
230
+ this.route = new _geom.LineString(coordinates);
231
+ var firstFeature = routeFeature[0];
232
+ var lastFeature = _lodash["default"].last(routeFeature);
233
+ var firstGeometry = new _geom.Point(firstFeature.getGeometry().getFirstCoordinate());
234
+ var lastGeometry = new _geom.Point(lastFeature.getGeometry().getLastCoordinate());
235
+ return {
236
+ routeFeature: routeFeature,
237
+ firstGeometry: firstGeometry,
238
+ lastGeometry: lastGeometry
239
+ };
240
+ }
241
+ }, {
242
+ key: "loadArrayData",
243
+ value: function loadArrayData(data) {
244
+ var route = new _geom.LineString(data);
245
+ var distance = (0, _turf.length)((0, _turf.lineString)(data));
246
+ this.route = route;
247
+ var routeFeature = [new _Feature["default"]({
248
+ type: 'route',
249
+ geometry: route
250
+ })];
251
+ this.distanceArr = [distance];
252
+ this.distanceRatioArr = [1];
253
+ var firstGeometry = new _geom.Point(route.getFirstCoordinate());
254
+ var lastGeometry = new _geom.Point(route.getLastCoordinate());
255
+ return {
256
+ routeFeature: routeFeature,
257
+ firstGeometry: firstGeometry,
258
+ lastGeometry: lastGeometry
259
+ };
260
+ }
261
+ }, {
262
+ key: "getDefaultRouteStyle",
263
+ value: function getDefaultRouteStyle(feature) {
264
+ var _this$style, _this$style2;
265
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
266
+ var style = (0, _lodash.isFunction)((_this$style = this.style) === null || _this$style === void 0 ? void 0 : _this$style.route) ? this.style.route(feature) : ((_this$style2 = this.style) === null || _this$style2 === void 0 ? void 0 : _this$style2.route) || {};
267
+ return new _style.Style({
268
+ stroke: new _style.Stroke(_objectSpread(_objectSpread({
269
+ width: 6,
270
+ color: [237, 212, 0, 0.8]
271
+ }, style), options))
272
+ });
273
+ }
274
+ }, {
275
+ key: "setRouteStyle",
276
+ value: function setRouteStyle(features) {
277
+ var _this = this;
278
+ features.forEach(function (feature) {
279
+ feature.setStyle(function (feature, resolution) {
280
+ var styles = [_this.getDefaultRouteStyle(feature)];
281
+ if (!(0, _lodash.isEmpty)(_this.arrowStyle)) {
282
+ styles.push.apply(styles, _toConsumableArray((0, _getPathLineStyles["default"])({
283
+ feature: feature,
284
+ resolution: resolution,
285
+ arrowStyle: _this.arrowStyle
286
+ })));
287
+ }
288
+ return styles;
289
+ });
290
+ });
291
+ }
292
+ }, {
293
+ key: "loadData",
294
+ value: function loadData(data) {
295
+ if (this.vectorLayer) {
296
+ this.destroy();
297
+ }
298
+ var routeFeature = null;
299
+ var firstGeometry = null;
300
+ var lastGeometry = null;
301
+ if ((0, _lodash.isArray)(data[0])) {
302
+ var _this$loadArrayData = this.loadArrayData(data);
303
+ routeFeature = _this$loadArrayData.routeFeature;
304
+ firstGeometry = _this$loadArrayData.firstGeometry;
305
+ lastGeometry = _this$loadArrayData.lastGeometry;
306
+ } else {
307
+ var _this$loadObjectData = this.loadObjectData(data);
308
+ routeFeature = _this$loadObjectData.routeFeature;
309
+ firstGeometry = _this$loadObjectData.firstGeometry;
310
+ lastGeometry = _this$loadObjectData.lastGeometry;
311
+ }
312
+ var startMarker = new _Feature["default"]({
313
+ type: 'start',
314
+ geometry: firstGeometry
315
+ });
316
+ startMarker.setStyle(this.startStyle);
317
+ var endMarker = new _Feature["default"]({
318
+ type: 'end',
319
+ geometry: lastGeometry
320
+ });
321
+ endMarker.setStyle(this.endStyle);
322
+ var position = startMarker.getGeometry().clone();
323
+ var geoMarker = new _Feature["default"]({
324
+ type: 'geoMarker',
325
+ geometry: position,
326
+ id: 'geoMarker'
327
+ });
328
+ if (this.isHighlight) {
329
+ this.map.setHighlightFeature(geoMarker, {
330
+ autoView: false
331
+ });
332
+ }
333
+ geoMarker.setStyle(this.geoMarkerStyle);
334
+ this.setRouteStyle(routeFeature);
335
+ var vectorLayer = new _layer.Vector({
336
+ source: new _Vector["default"]({
337
+ features: [].concat(_toConsumableArray(routeFeature), [geoMarker])
338
+ }),
339
+ zIndex: this.zIndex
340
+ });
341
+ this.map.addLayer(vectorLayer);
342
+ this.routeFeatures = routeFeature;
343
+ this.position = position;
344
+ this.vectorLayer = vectorLayer;
345
+ this.geoMarker = geoMarker;
346
+ this.startMarker = startMarker;
347
+ this.endMarker = endMarker;
348
+ if (!vectorLayer.getSource().hasFeature(startMarker)) {
349
+ vectorLayer.getSource().addFeature(startMarker);
350
+ }
351
+ if (!vectorLayer.getSource().hasFeature(endMarker)) {
352
+ vectorLayer.getSource().addFeature(endMarker);
353
+ }
354
+ if (this.showTrace) {
355
+ this.addTrace();
356
+ }
357
+ }
358
+ }, {
359
+ key: "changeProcess",
360
+ value: function changeProcess(process) {
361
+ var _this2 = this;
362
+ this._distance = process;
363
+ var distance = this.calculateDistance();
364
+ var route = this.routeFeatures[this.currentIndex].getGeometry();
365
+ var currentCoordinate = route.getCoordinateAt(distance > 1 ? 2 - distance : distance);
366
+ if (distance > 0) {
367
+ var lastCoordinate = route.getCoordinateAt(distance - 0.0001);
368
+ this.setRotation(lastCoordinate, currentCoordinate);
369
+ } else {
370
+ var nextCoordinate = route.getCoordinateAt(0.0000001);
371
+ if ((0, _lodash.isEqual)(currentCoordinate, nextCoordinate)) {
372
+ if (this.currentIndex === this.routeFeatures.length - 1) {
373
+ var lastRoute = this.routeFeatures[this.currentIndex - 1].getGeometry();
374
+ var _lastCoordinate = lastRoute.getCoordinateAt(1 - 0.0001);
375
+ this.setRotation(_lastCoordinate, currentCoordinate);
376
+ } else {
377
+ var nextRoute = this.routeFeatures[this.currentIndex + 1].getGeometry();
378
+ var _nextCoordinate = nextRoute.getCoordinateAt(0.0001);
379
+ this.setRotation(currentCoordinate, _nextCoordinate);
380
+ }
381
+ } else {
382
+ this.setRotation(currentCoordinate, nextCoordinate);
383
+ }
384
+ }
385
+ this.position.setCoordinates(currentCoordinate);
386
+ if (distance >= 1 && this.currentIndex >= this.routeFeatures.length - 1) {
387
+ this.isPlayEnd = true;
388
+ this.playEnd();
389
+ return distance;
390
+ }
391
+ if (this.showTrace) {
392
+ var list = [];
393
+ var getCoordinates = function getCoordinates(_ref) {
394
+ var startCoordinates = _ref.startCoordinates,
395
+ endCoordinates = _ref.endCoordinates,
396
+ lineCoordinates = _ref.lineCoordinates;
397
+ var start = (0, _turf.point)(startCoordinates);
398
+ var end = (0, _turf.point)(endCoordinates);
399
+ var line = (0, _turf.lineString)(lineCoordinates);
400
+ var sliced = (0, _turf.lineSlice)(start, end, line);
401
+ return sliced.geometry.coordinates;
402
+ };
403
+ if (this.currentIndex === 0) {
404
+ list.push(getCoordinates({
405
+ startCoordinates: this.startMarker.getGeometry().getCoordinates(),
406
+ endCoordinates: currentCoordinate,
407
+ lineCoordinates: route.getCoordinates()
408
+ }));
409
+ } else {
410
+ var features = this.routeFeatures.slice(0, this.currentIndex + 1);
411
+ features.forEach(function (feature, index) {
412
+ var geometry = feature.getGeometry();
413
+ var endCoordinates = currentCoordinate;
414
+ if (index !== _this2.currentIndex) {
415
+ endCoordinates = geometry.getLastCoordinate();
416
+ }
417
+ list.push(getCoordinates({
418
+ startCoordinates: geometry.getFirstCoordinate(),
419
+ endCoordinates: endCoordinates,
420
+ lineCoordinates: geometry.getCoordinates()
421
+ }));
422
+ });
423
+ }
424
+ list.forEach(function (coordinates, index) {
425
+ coordinates.forEach(function (coordinate, i) {
426
+ _this2.setPaintLinePath({
427
+ coordinate: coordinate,
428
+ init: i === 0,
429
+ index: index
430
+ });
431
+ });
432
+ });
433
+ }
434
+ return distance;
435
+ }
436
+ }, {
437
+ key: "moveToIndex",
438
+ value: function moveToIndex(index, dataIndex) {
439
+ var process = 0;
440
+ if (this.dataDistanceRatioArr[index][dataIndex] === 1) {
441
+ process = this.distanceRatioArr[index];
442
+ } else {
443
+ process = index === 0 ? this.dataDistanceRatioArr[index][dataIndex] : (this.distanceRatioArr[index] - this.distanceRatioArr[index - 1]) * this.dataDistanceRatioArr[index][dataIndex] + this.distanceRatioArr[index - 1];
444
+ }
445
+ this.currentIndex = index;
446
+ this.changeProcess(process);
447
+ this.onPlaying && this.onPlaying(process, index, dataIndex);
448
+ }
449
+ }, {
450
+ key: "moveTo",
451
+ value: function moveTo(process) {
452
+ this.currentIndex = this.distanceRatioArr.findIndex(function (distance) {
453
+ return distance >= process;
454
+ });
455
+ var distance = this.changeProcess(process);
456
+ var dataIndex = 0;
457
+ if (distance === 1) {
458
+ dataIndex = (this.dataDistanceRatioArr[this.currentIndex] || []).length - 1;
459
+ } else {
460
+ dataIndex = (this.dataDistanceRatioArr[this.currentIndex] || []).findIndex(function (v, index, arr) {
461
+ if (index === arr.length - 1) {
462
+ return true;
463
+ }
464
+ return v <= distance <= arr[index + 1];
465
+ });
466
+ }
467
+ // 计算当前进度的对应index
468
+
469
+ console.log('moveTo', this.distanceRatioArr, distance, dataIndex, this.currentIndex);
470
+ this.onPlaying && this.onPlaying(this._distance, this.currentIndex, dataIndex);
471
+ }
472
+ }, {
473
+ key: "playEnd",
474
+ value: function playEnd() {
475
+ var _this3 = this;
476
+ if (!this.repeatPlay) {
477
+ this.stopAnimation();
478
+ }
479
+ this.isPlayEnd = true;
480
+ if (this.showTrace) {
481
+ this.lineDashFeatures.forEach(function (feature) {
482
+ _this3.vectorLayer.getSource().removeFeature(feature);
483
+ });
484
+ this.paintLineFeatures.forEach(function (feature) {
485
+ _this3.vectorLayer.getSource().removeFeature(feature);
486
+ feature.setGeometry(null);
487
+ });
488
+ this.setRouteStyle(this.routeFeatures);
489
+ }
490
+ }
491
+ }, {
492
+ key: "setRotation",
493
+ value: function setRotation(lastCoordinate, coordinate) {
494
+ if (lastCoordinate && coordinate && this.enableRotation) {
495
+ this.geoMarkerStyle.getImage().setRotation(getAngle(lastCoordinate, coordinate));
496
+ }
497
+ }
498
+
499
+ // 计算当前路段跑的距离,计算公式:(当前跑的总距离 - 已跑路段的总距离) / 当前路段的百分比
500
+ }, {
501
+ key: "calculateDistance",
502
+ value: function calculateDistance() {
503
+ var currentRouteRatio = this.currentIndex > 0 ? this.distanceRatioArr[this.currentIndex] - this.distanceRatioArr[this.currentIndex - 1] : this.distanceRatioArr[this.currentIndex];
504
+ if (currentRouteRatio === 0) {
505
+ return 1.001;
506
+ }
507
+ var distance = (this._distance - (this.currentIndex > 0 ? this.distanceRatioArr[this.currentIndex - 1] : 0)) / currentRouteRatio;
508
+ return distance;
509
+ }
510
+ }, {
511
+ key: "moveFeature",
512
+ value: function moveFeature(event) {
513
+ var vectorContext = (0, _render.getVectorContext)(event);
514
+ var speed = Number(this.speed);
515
+ var time = event.frameState.time;
516
+ var elapsedTime = time - this._lastTime;
517
+ this._distance = (this._distance + speed * elapsedTime / 1e6) % 2;
518
+ var distance = this.calculateDistance();
519
+ this._lastTime = time;
520
+ if (distance > 1) {
521
+ this.currentIndex = this.currentIndex + 1;
522
+ distance = 0;
523
+ }
524
+ if (this.currentIndex > this.routeFeatures.length - 1) {
525
+ this.playEnd();
526
+ if (this.repeatPlay) {
527
+ this.currentIndex = this.routeFeatures.length - 1;
528
+ } else {
529
+ var _currentCoordinate = this.endMarker.getGeometry().getCoordinates();
530
+ this.position.setCoordinates(_currentCoordinate);
531
+ vectorContext.setStyle(this.geoMarkerStyle);
532
+ vectorContext.drawGeometry(this.position);
533
+ this.onPlayEnd && this.onPlayEnd();
534
+ return;
535
+ }
536
+ }
537
+ // 计算当前进度的对应index
538
+ var dataIndex = (this.dataDistanceRatioArr[this.currentIndex] || []).findIndex(function (v, index, arr) {
539
+ if (index === arr.length - 1) {
540
+ return true;
541
+ }
542
+ return v <= distance <= arr[index + 1];
543
+ });
544
+ var route = this.routeFeatures[this.currentIndex].getGeometry();
545
+ var currentCoordinate = route.getCoordinateAt(distance > 1 ? 2 - distance : distance);
546
+ this.position.setCoordinates(currentCoordinate);
547
+ this.setRotation(this.lastCoordinate, currentCoordinate);
548
+ this.lastCoordinate = currentCoordinate;
549
+ if (this.autoView) {
550
+ this.map.getView().fit(this.position, {
551
+ padding: [100, 400, 100, 400],
552
+ maxZoom: this.map.getView().getZoom(),
553
+ duration: 0
554
+ });
555
+ }
556
+ vectorContext.setStyle(this.geoMarkerStyle);
557
+ vectorContext.drawGeometry(this.position);
558
+ var overlay = this.map.getOverlayById('geoMarker');
559
+ if (overlay) {
560
+ overlay.setPosition(this.position.getFlatCoordinates());
561
+ }
562
+ if (this.showTrace) {
563
+ this.setPaintLinePath({
564
+ coordinate: currentCoordinate,
565
+ index: this.currentIndex
566
+ });
567
+ }
568
+ this.onPlaying && this.onPlaying(this._distance > 1 ? 1 : this._distance, this.currentIndex, dataIndex);
569
+ this.map.render();
570
+ }
571
+ }, {
572
+ key: "setPaintLinePath",
573
+ value: function setPaintLinePath(_ref2) {
574
+ var coordinate = _ref2.coordinate,
575
+ init = _ref2.init,
576
+ index = _ref2.index;
577
+ var paintLineFeature = this.paintLineFeatures[index];
578
+ if (init) {
579
+ paintLineFeature.setGeometry(null);
580
+ }
581
+ var geometry = paintLineFeature.getGeometry();
582
+ if (geometry) {
583
+ geometry.setCoordinates([[].concat(_toConsumableArray(geometry.getCoordinates()[0]), [coordinate])]);
584
+ } else {
585
+ var lineData = [[coordinate]];
586
+ var route = new _geom.MultiLineString(lineData);
587
+ paintLineFeature.setGeometry(route);
588
+ }
589
+ if (!this.vectorLayer.getSource().hasFeature(paintLineFeature)) {
590
+ this.vectorLayer.getSource().addFeature(paintLineFeature);
591
+ }
592
+ }
593
+ }, {
594
+ key: "addTrace",
595
+ value: function addTrace() {
596
+ var _this4 = this;
597
+ if (this._distance === 0) {
598
+ var lineDashFeatures = [];
599
+ var paintLineFeatures = [];
600
+ this.routeFeatures.forEach(function (feature) {
601
+ var lineDashFeature = feature.clone();
602
+ var paintLineFeature = feature.clone();
603
+ paintLineFeature.setGeometry(null);
604
+ lineDashFeature.setStyle(_this4.getDefaultRouteStyle(feature, {
605
+ lineDash: [15]
606
+ }));
607
+ lineDashFeatures.push(lineDashFeature);
608
+ paintLineFeatures.push(paintLineFeature);
609
+ });
610
+ this.lineDashFeatures = lineDashFeatures;
611
+ this.paintLineFeatures = paintLineFeatures;
612
+ }
613
+ }
614
+ }, {
615
+ key: "startAnimation",
616
+ value: function startAnimation() {
617
+ var _this5 = this;
618
+ if (!this.repeatPlay && this.isPlayEnd) {
619
+ // 当不重复播放,且当前在终点时,从起点开始播放
620
+ this.cancel();
621
+ this.geoMarkerStyle.getImage().setRotation(0);
622
+ }
623
+ this.isPlayEnd = false;
624
+ this._animating = true;
625
+ this._lastTime = Date.now();
626
+ this._on_event = this.vectorLayer.on('postrender', this.moveFeature.bind(this));
627
+ this.geoMarker.setGeometry(null);
628
+ if (this.showTrace) {
629
+ this.lineDashFeatures.forEach(function (feature) {
630
+ if (!_this5.vectorLayer.getSource().hasFeature(feature)) {
631
+ _this5.vectorLayer.getSource().addFeature(feature);
632
+ }
633
+ });
634
+ this.routeFeatures.forEach(function (feature) {
635
+ feature.setStyle(new _style.Style({}));
636
+ });
637
+ }
638
+ }
639
+ }, {
640
+ key: "stopAnimation",
641
+ value: function stopAnimation() {
642
+ this._animating = false;
643
+ this.geoMarker.setGeometry(this.position);
644
+ if (this._on_event) {
645
+ this.vectorLayer.un('postrender', this._on_event.listener);
646
+ }
647
+ }
648
+ }, {
649
+ key: "cancel",
650
+ value: function cancel() {
651
+ this.geoMarkerStyle.getImage().setRotation(0);
652
+ this._distance = 0;
653
+ this.currentIndex = 0;
654
+ var currentCoordinate = this.route.getCoordinateAt(0);
655
+ this.position.setCoordinates(currentCoordinate);
656
+ this.playEnd();
657
+ this.onPlaying && this.onPlaying(this._distance, this.currentIndex, 0);
658
+ }
659
+ }, {
660
+ key: "destroy",
661
+ value: function destroy() {
662
+ if (this._animating) {
663
+ this.stopAnimation();
664
+ }
665
+ this.map.removeLayer(this.vectorLayer);
666
+ this.map.clearHighlightFeature();
667
+ this.routeFeatures = null;
668
+ this.position = null;
669
+ this.vectorLayer = null;
670
+ this.geoMarker = null;
671
+ }
672
+ }]);
673
+ }();
674
+ //# sourceMappingURL=PathPlayBack.js.map