@vtx/ol-map 1.0.144 → 1.0.146

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