@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,1040 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ var _layer = require("ol/layer");
8
+ var _ol = require("ol");
9
+ var _source = require("ol/source");
10
+ var _renderer = _interopRequireDefault(require("../renderer"));
11
+ var _style6 = require("ol/style");
12
+ var _isFunction = _interopRequireDefault(require("../_util/isFunction"));
13
+ var _createFeatureCollection = require("./createFeatureCollection");
14
+ var _isObject = _interopRequireDefault(require("../_util/isObject"));
15
+ var _encryptParams = _interopRequireDefault(require("../_util/encryptParams"));
16
+ var _stringToFun = _interopRequireDefault(require("../_util/stringToFun"));
17
+ var _convertCamelToCSS = _interopRequireDefault(require("../convertCamelToCSS"));
18
+ var _MyCluster = _interopRequireDefault(require("./MyCluster"));
19
+ var _Marker = require("../marker/Marker");
20
+ var _excluded = ["url", "params", "data", "dataField", "features", "sourceOptions", "key", "name", "label", "labelField", "point", "cluster", "template", "autoRefresh", "method", "layerControl", "show", "style", "group", "iconOptions", "afterGetData", "legend", "viewOnly", "encrypt", "valueField", "map", "tipTemplate", "alarmBg", "cancelPopup"],
21
+ _excluded2 = ["color", "background", "backgroundStroke", "backgroundStrokeWidth"],
22
+ _excluded3 = ["type", "iconSrc", "color", "scale", "numberStyle"],
23
+ _excluded4 = ["numberStyle", "iconOptions"];
24
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
25
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
26
+ 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."); }
27
+ 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); }
28
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
29
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
30
+ 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; }
31
+ 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); }
32
+ 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; }
33
+ 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; }
34
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
35
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
36
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
37
+ 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); } }
38
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
39
+ function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
40
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
41
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
42
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
43
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
44
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
45
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
46
+ function set(target, property, value, receiver) { if (typeof Reflect !== "undefined" && Reflect.set) { set = Reflect.set; } else { set = function set(target, property, value, receiver) { var base = _superPropBase(target, property); var desc; if (base) { desc = Object.getOwnPropertyDescriptor(base, property); if (desc.set) { desc.set.call(receiver, value); return true; } else if (!desc.writable) { return false; } } desc = Object.getOwnPropertyDescriptor(receiver, property); if (desc) { if (!desc.writable) { return false; } desc.value = value; Object.defineProperty(receiver, property, desc); } else { _defineProperty(receiver, property, value); } return true; }; } return set(target, property, value, receiver); }
47
+ function _set(target, property, value, receiver, isStrict) { var s = set(target, property, value, receiver || target); if (!s && isStrict) { throw new TypeError('failed to set property'); } return value; }
48
+ function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
49
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
50
+ 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; }
51
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
52
+ 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); }
53
+ var addOverlay = function addOverlay(feature, map, alarmBg) {
54
+ if (alarmBg) {
55
+ var itemVal = alarmBg.find(function (v) {
56
+ return v.filter(feature.values_);
57
+ });
58
+ if (itemVal) {
59
+ var image = itemVal.image,
60
+ style = itemVal.style;
61
+ var dom;
62
+ if (image) {
63
+ dom = document.createElement('img');
64
+ dom.src = image;
65
+ } else {
66
+ dom = document.createElement('div');
67
+ dom.className = "ol-map-icon-alarm";
68
+ }
69
+ if (style) {
70
+ dom.style.cssText = style;
71
+ }
72
+ var overlay = new _ol.Overlay({
73
+ element: dom,
74
+ positioning: 'bottom-center',
75
+ stopEvent: true,
76
+ className: 'ol-overlay_container-stop_event'
77
+ });
78
+ map.addOverlay(overlay);
79
+ overlay.setPosition(feature.getGeometry().getCoordinates());
80
+ return overlay;
81
+ }
82
+ }
83
+ };
84
+ var FeatureLayer = /*#__PURE__*/function (_Vector) {
85
+ _inherits(FeatureLayer, _Vector);
86
+ var _super = _createSuper(FeatureLayer);
87
+ function FeatureLayer(_options) {
88
+ var _thisSuper, _this2;
89
+ _classCallCheck(this, FeatureLayer);
90
+ var url = _options.url,
91
+ params = _options.params,
92
+ data = _options.data,
93
+ dataField = _options.dataField,
94
+ features = _options.features,
95
+ sourceOptions = _options.sourceOptions,
96
+ key = _options.key,
97
+ name = _options.name,
98
+ label = _options.label,
99
+ _labelField = _options.labelField,
100
+ point = _options.point,
101
+ cluster = _options.cluster,
102
+ template = _options.template,
103
+ autoRefresh = _options.autoRefresh,
104
+ method = _options.method,
105
+ layerControl = _options.layerControl,
106
+ show = _options.show,
107
+ _style2 = _options.style,
108
+ group = _options.group,
109
+ iconOptions = _options.iconOptions,
110
+ afterGetData = _options.afterGetData,
111
+ legend = _options.legend,
112
+ viewOnly = _options.viewOnly,
113
+ encrypt = _options.encrypt,
114
+ valueField = _options.valueField,
115
+ map = _options.map,
116
+ tipTemplate = _options.tipTemplate,
117
+ alarmBg = _options.alarmBg,
118
+ cancelPopup = _options.cancelPopup,
119
+ other = _objectWithoutProperties(_options, _excluded);
120
+ var props = _objectSpread({}, other);
121
+ props.source = props.source || new _source.Vector(_objectSpread({
122
+ features: features
123
+ }, sourceOptions));
124
+ var defaultShow = show;
125
+ if (group !== null && group !== void 0 && group.length) {
126
+ defaultShow = false;
127
+ if (show) {
128
+ group.map(function (f) {
129
+ if (f.show) {
130
+ defaultShow = true;
131
+ }
132
+
133
+ // 将字符函数转化为可执行的函数
134
+ f.filter = (0, _stringToFun["default"])(f.filter);
135
+ });
136
+ }
137
+ }
138
+ _this2 = _super.call(this, props);
139
+ _defineProperty(_assertThisInitialized(_this2), "getClusterTextStyle", function (size, options) {
140
+ var _ref = options && _typeof(options) === 'object' ? options : {},
141
+ color = _ref.color,
142
+ background = _ref.background,
143
+ backgroundStroke = _ref.backgroundStroke,
144
+ backgroundStrokeWidth = _ref.backgroundStrokeWidth,
145
+ otherVal = _objectWithoutProperties(_ref, _excluded2);
146
+ var style = _objectSpread({
147
+ text: String(size),
148
+ font: '18px Calibri,sans-serif',
149
+ fill: new _style6.Fill({
150
+ color: color || '#fff'
151
+ }),
152
+ padding: [0, 0, 0, 0],
153
+ justify: 'center',
154
+ textAlign: 'center',
155
+ textBaseline: 'middle',
156
+ offsetY: -22,
157
+ offsetX: 16
158
+ }, otherVal);
159
+ if (background) {
160
+ style.backgroundFill = new _style6.Fill({
161
+ color: background
162
+ });
163
+ }
164
+ if (backgroundStroke) {
165
+ style.backgroundStroke = new _style6.Stroke({
166
+ color: '#FFFFFF',
167
+ width: backgroundStrokeWidth || 2
168
+ });
169
+ }
170
+ return new _style6.Text(style);
171
+ });
172
+ _defineProperty(_assertThisInitialized(_this2), "getLabelStyle", function (feature, color) {
173
+ var labelField = _this2._options.labelField;
174
+
175
+ // 判断是否是聚合点位
176
+ if (feature.isCluster) {
177
+ var _feature$get;
178
+ var size = ((_feature$get = feature.get('features')) === null || _feature$get === void 0 ? void 0 : _feature$get.length) || 0;
179
+ if (size !== 1) {
180
+ return;
181
+ }
182
+ }
183
+ if (labelField) {
184
+ return new _style6.Text({
185
+ text: feature.values_[labelField] || '-',
186
+ font: '12px Calibri,sans-serif',
187
+ fill: new _style6.Fill({
188
+ color: color
189
+ }),
190
+ backgroundFill: new _style6.Fill({
191
+ color: '#fff'
192
+ }),
193
+ backgroundStroke: new _style6.Stroke({
194
+ color: color,
195
+ width: 1
196
+ }),
197
+ padding: [4, 2, 2, 4],
198
+ justify: 'center',
199
+ textBaseline: 'middle',
200
+ offsetY: 12
201
+ });
202
+ }
203
+ });
204
+ _set((_thisSuper = _assertThisInitialized(_this2), _getPrototypeOf(FeatureLayer.prototype)), "show", show, _thisSuper, true);
205
+ // 参数
206
+ _this2._options = _options;
207
+
208
+ // 地图
209
+ _this2.map = map;
210
+
211
+ // 接口地址
212
+ _this2.url = url;
213
+
214
+ // 接口地址请求类型
215
+ _this2.method = method;
216
+
217
+ // 接口查询参数
218
+ _this2.params = params;
219
+
220
+ // 图层标识
221
+ _this2.key = key;
222
+
223
+ // 图层名称
224
+ _this2.name = name;
225
+
226
+ // 标签
227
+ _this2.label = label;
228
+
229
+ // 标签字段
230
+ _this2.labelField = _labelField;
231
+
232
+ // 聚合
233
+ _this2.cluster = cluster;
234
+
235
+ // 聚合距离
236
+ _this2.distance = (cluster === null || cluster === void 0 ? void 0 : cluster.distance) || 80;
237
+
238
+ // 海量点
239
+ _this2.point = point;
240
+
241
+ // 自动刷新标识
242
+ _this2.autoRefresh = autoRefresh;
243
+
244
+ // 模版内容
245
+ _this2.template = template;
246
+
247
+ // 图层控制
248
+ _this2.layerControl = layerControl;
249
+
250
+ // 过滤
251
+ _this2.group = group;
252
+
253
+ // 处理获取的数据
254
+ _this2.afterGetData = afterGetData;
255
+
256
+ // 数据查询字段
257
+ _this2.valueField = valueField;
258
+
259
+ // 图例
260
+ _this2.legend = legend;
261
+
262
+ // 样式
263
+ _this2.style = _style2;
264
+
265
+ // 数据
266
+ _this2.data = data;
267
+
268
+ // 数据取值字段
269
+ _this2.dataField = dataField || 'geometryInfo';
270
+
271
+ // 仅展示
272
+ _this2.viewOnly = viewOnly;
273
+
274
+ // 是否初始化
275
+ _this2.inited = false;
276
+
277
+ // 加密
278
+ _this2.encrypt = encrypt;
279
+
280
+ // 气泡模板
281
+ _this2.tipTemplate = tipTemplate;
282
+
283
+ // 取消气泡
284
+ _this2.cancelPopup = cancelPopup;
285
+
286
+ // 报警背景
287
+ if (alarmBg) {
288
+ _this2.alarmBg = (Array.isArray(alarmBg) ? alarmBg : [alarmBg]).map(function (item) {
289
+ var filter = item.filter,
290
+ style = item.style;
291
+ filter = (0, _stringToFun["default"])(filter);
292
+ if (style) {
293
+ style = item.style && _typeof(item.style) === 'object' ? style : {
294
+ color: style
295
+ };
296
+ style = (0, _convertCamelToCSS["default"])(style);
297
+ }
298
+ return _objectSpread(_objectSpread({}, item), {}, {
299
+ filter: filter,
300
+ style: style
301
+ });
302
+ });
303
+ }
304
+
305
+ // 临时数据
306
+ _this2._features = [];
307
+
308
+ // 默认是否展示
309
+ if (defaultShow) {
310
+ _this2.init();
311
+ }
312
+ return _this2;
313
+ }
314
+
315
+ // 初始化数据
316
+ _createClass(FeatureLayer, [{
317
+ key: "init",
318
+ value: function init() {
319
+ // 是否存在地址
320
+ if (this.url) {
321
+ // 执行
322
+ this.loadUrlData(this.url, this.params, this.method);
323
+ }
324
+
325
+ // 直接加载数据
326
+ if (this.data) {
327
+ // 执行
328
+ this.loadData(this.data);
329
+ }
330
+ this.inited = true;
331
+ }
332
+
333
+ // 重写父类的属性访问器
334
+ }, {
335
+ key: "show",
336
+ get: function get() {
337
+ return _get(_getPrototypeOf(FeatureLayer.prototype), "show", this);
338
+ },
339
+ set: function set(value) {
340
+ this.setVisible(value);
341
+ }
342
+ }, {
343
+ key: "label",
344
+ set: function set(val) {
345
+ this._options.label = val;
346
+ this.setStyle(this.getStyleByMode());
347
+ }
348
+ }, {
349
+ key: "point",
350
+ set: function set(val) {
351
+ this._options.point = val;
352
+ this.setStyle(this.getStyleByMode());
353
+ }
354
+ }, {
355
+ key: "cluster",
356
+ set: function set(val) {
357
+ this.setClusterMode(val);
358
+ }
359
+ }, {
360
+ key: "setShow",
361
+ value: function setShow(value) {
362
+ this.show = value;
363
+ this.setVisible(value);
364
+ }
365
+ }, {
366
+ key: "setClusterMode",
367
+ value: function setClusterMode(val) {
368
+ var _this3 = this;
369
+ var _ref2 = (0, _isObject["default"])(val) ? val : {
370
+ show: val
371
+ },
372
+ show = _ref2.show;
373
+ this.setClusterSource(val);
374
+ this.setStyle(this.getStyleByMode());
375
+ if (this.map && show) {
376
+ var map = this.map;
377
+ this.destroy();
378
+
379
+ // 监听地图缩放大于阈值时取消聚合
380
+ var oldZoom = map.getView().getZoom();
381
+ this.moveEnd = map.on('moveend', function () {
382
+ var zoom = map.getView().getZoom(); //获取当前地图的缩放级别
383
+ if (oldZoom !== zoom) {
384
+ var _this3$_options$clust;
385
+ oldZoom = zoom;
386
+ if (zoom >= (((_this3$_options$clust = _this3._options.cluster) === null || _this3$_options$clust === void 0 ? void 0 : _this3$_options$clust.zoomThreshold) || 14)) {
387
+ _this3.setClusterSource();
388
+ } else {
389
+ _this3.setClusterSource(val);
390
+ }
391
+ }
392
+ });
393
+ }
394
+ }
395
+ }, {
396
+ key: "getCustomClusterStyle",
397
+ value: function getCustomClusterStyle(feature, clusterStyle) {
398
+ var _feature$get2;
399
+ var type = clusterStyle.type,
400
+ iconSrc = clusterStyle.iconSrc,
401
+ color = clusterStyle.color,
402
+ _clusterStyle$scale = clusterStyle.scale,
403
+ scale = _clusterStyle$scale === void 0 ? 1 : _clusterStyle$scale,
404
+ numberStyle = clusterStyle.numberStyle,
405
+ iconOptions = _objectWithoutProperties(clusterStyle, _excluded3);
406
+ var size = ((_feature$get2 = feature.get('features')) === null || _feature$get2 === void 0 ? void 0 : _feature$get2.length) || 0;
407
+ return [new _renderer["default"].Marker({
408
+ image: (0, _Marker.getImgUrl)(type || 'CommonIcon', {
409
+ color: color || '#2491fc',
410
+ hideFooter: true,
411
+ info: {
412
+ text: '',
413
+ fontSize: 18
414
+ }
415
+ }),
416
+ text: this.getClusterTextStyle(size, numberStyle)
417
+ }), new _renderer["default"].Marker(_objectSpread({
418
+ image: iconSrc,
419
+ scale: scale || 1,
420
+ anchor: [1.1, 1.25]
421
+ }, iconOptions))];
422
+ }
423
+ }, {
424
+ key: "getStyleByMode",
425
+ value: function getStyleByMode() {
426
+ var _this4 = this;
427
+ return function (feature, resolution) {
428
+ var _feature$get3, _this4$group, _cluster$style;
429
+ var size = ((_feature$get3 = feature.get('features')) === null || _feature$get3 === void 0 ? void 0 : _feature$get3.length) || 0;
430
+ var _this4$_options = _this4._options,
431
+ style = _this4$_options.style,
432
+ cluster = _this4$_options.cluster,
433
+ otherStyle = _this4$_options.otherStyle;
434
+ var show = true;
435
+ (_this4$group = _this4.group) === null || _this4$group === void 0 ? void 0 : _this4$group.map(function (v) {
436
+ var _v$filter;
437
+ if (v !== null && v !== void 0 && (_v$filter = v.filter) !== null && _v$filter !== void 0 && _v$filter.call(v, feature.values_)) {
438
+ style = v.style || style;
439
+ if (v.hasOwnProperty('show') && !v.show) {
440
+ show = false;
441
+ }
442
+ }
443
+ });
444
+ feature.show = show;
445
+ if (!show) {
446
+ return null;
447
+ }
448
+ var styles = [];
449
+ if (otherStyle) {
450
+ if ((0, _isFunction["default"])(otherStyle)) {
451
+ var _styles = otherStyle(feature, resolution);
452
+ if (_styles) {
453
+ if (Array.isArray(styles)) {
454
+ styles.push.apply(styles, _toConsumableArray(_styles));
455
+ } else {
456
+ styles.push(_styles);
457
+ }
458
+ }
459
+ }
460
+ }
461
+ if (size > 1 && cluster !== null && cluster !== void 0 && (_cluster$style = cluster.style) !== null && _cluster$style !== void 0 && _cluster$style.iconSrc) {
462
+ return _this4.getCustomClusterStyle(feature, cluster.style);
463
+ }
464
+ if (style) {
465
+ if (typeof style === 'string' || (0, _isFunction["default"])(style) && cluster) {
466
+ styles.push(new _renderer["default"].Marker(_objectSpread({}, _this4.getMarkerOptions(feature, style))));
467
+ return styles;
468
+ } else if (style instanceof _style6.Style) {
469
+ // 判断是否为 ol Style
470
+ styles.push(style);
471
+ return styles;
472
+ } else if ((0, _isFunction["default"])(style)) {
473
+ // 判断是否为自定义函数渲染
474
+
475
+ var _style = style(feature);
476
+ if (_style !== null && _style !== void 0 && _style.type && _style !== null && _style !== void 0 && _style.style) {
477
+ var options = _this4.getSimpleStyle(feature, _style);
478
+ styles.push(_renderer["default"].Simple(options));
479
+ return styles;
480
+ }
481
+ styles.push(_style);
482
+ return styles;
483
+ } else if ((0, _isObject["default"])(style)) {
484
+ var _style3 = style,
485
+ mode = _style3.mode;
486
+ if (mode) {
487
+ if (mode === 'Simple') {
488
+ var _options2 = _this4.getSimpleStyle(feature, style.render);
489
+ styles.push(_renderer["default"].Simple(_options2));
490
+ return styles;
491
+ }
492
+ if (mode === 'UniqueValue') {
493
+ if (size > 1) {
494
+ var _options3 = _this4.getSimpleStyle(feature, style.render.render[0]);
495
+ styles.push(_renderer["default"].Simple(_options3));
496
+ return styles;
497
+ }
498
+ var _options4 = _this4.getMultipleStyle(feature, style.render);
499
+ styles.push(_renderer["default"].UniqueValue(feature, _options4));
500
+ return styles;
501
+ }
502
+ if (mode === 'ClassBreaks') {
503
+ if (size > 1) {
504
+ var _options5 = _this4.getSimpleStyle(feature, style.render.render[0]);
505
+ styles.push(_renderer["default"].Simple(_options5));
506
+ return styles;
507
+ }
508
+ var _options6 = _this4.getMultipleStyle(feature, style.render);
509
+ styles.push(_renderer["default"].ClassBreaks(feature, _options6));
510
+ return styles;
511
+ }
512
+ } else if (style.style) {
513
+ var _options7 = _this4.getSimpleStyle(feature, style);
514
+ styles.push(_renderer["default"].Simple(_options7));
515
+ return styles;
516
+ }
517
+ }
518
+ }
519
+ styles.push(new _style6.Style({
520
+ image: new _style6.Circle({
521
+ radius: 4,
522
+ fill: new _style6.Fill({
523
+ color: 'rgba(0,155,255, 0.8)'
524
+ })
525
+ }),
526
+ fill: new _style6.Fill({
527
+ color: 'rgba(255, 255, 255, 0.6)'
528
+ }),
529
+ stroke: new _style6.Stroke({
530
+ color: '#009BFF',
531
+ width: 2
532
+ })
533
+ }));
534
+ return styles;
535
+ };
536
+ }
537
+ }, {
538
+ key: "getSimpleStyle",
539
+ value: function getSimpleStyle(feature, _render) {
540
+ var _render$style, _render$style2;
541
+ var cluster = this._options.cluster;
542
+ var render = _objectSpread({}, _render);
543
+ if (render.type === 'Marker' && (render !== null && render !== void 0 && (_render$style = render.style) !== null && _render$style !== void 0 && _render$style.icon || cluster && render !== null && render !== void 0 && (_render$style2 = render.style) !== null && _render$style2 !== void 0 && _render$style2.image)) {
544
+ render.style = _objectSpread(_objectSpread({}, render.style), this.getMarkerOptions(feature, render.style));
545
+ }
546
+ return render;
547
+ }
548
+ }, {
549
+ key: "getMultipleStyle",
550
+ value: function getMultipleStyle(feature, _render) {
551
+ var _render$render,
552
+ _this5 = this;
553
+ var render = _objectSpread({}, _render);
554
+ if (render !== null && render !== void 0 && (_render$render = render.render) !== null && _render$render !== void 0 && _render$render.length) {
555
+ render.render = render.render.map(function (v) {
556
+ return _this5.getSimpleStyle(feature, v);
557
+ });
558
+ }
559
+ return render;
560
+ }
561
+ }, {
562
+ key: "getMarkerOptions",
563
+ value: function getMarkerOptions(feature, style) {
564
+ var _feature$get4;
565
+ var icon = (style === null || style === void 0 ? void 0 : style.icon) || style;
566
+ var image = style === null || style === void 0 ? void 0 : style.image;
567
+ var scale = style === null || style === void 0 ? void 0 : style.scale;
568
+ var color = (style === null || style === void 0 ? void 0 : style.color) || '#2491fc';
569
+ var iconSize = (style === null || style === void 0 ? void 0 : style.size) || null;
570
+ var hideFooter = (style === null || style === void 0 ? void 0 : style.hideFooter) || null;
571
+ var _this$_options = this._options,
572
+ cluster = _this$_options.cluster,
573
+ point = _this$_options.point,
574
+ label = _this$_options.label;
575
+ // 判断是否为自定义函数渲染
576
+ var isFun = (0, _isFunction["default"])(style);
577
+ var data = {};
578
+ if (isFun) {
579
+ var _data, _data$style, _data2, _data3, _data3$style, _data4, _data5, _data5$style, _data6, _data7, _data7$style, _data8, _data9, _data9$style, _data10, _data11, _data11$style, _data12;
580
+ data = style(feature) || {};
581
+ icon = ((_data = data) === null || _data === void 0 ? void 0 : (_data$style = _data.style) === null || _data$style === void 0 ? void 0 : _data$style.icon) || ((_data2 = data) === null || _data2 === void 0 ? void 0 : _data2.icon) || icon;
582
+ color = ((_data3 = data) === null || _data3 === void 0 ? void 0 : (_data3$style = _data3.style) === null || _data3$style === void 0 ? void 0 : _data3$style.color) || ((_data4 = data) === null || _data4 === void 0 ? void 0 : _data4.color) || color;
583
+ image = ((_data5 = data) === null || _data5 === void 0 ? void 0 : (_data5$style = _data5.style) === null || _data5$style === void 0 ? void 0 : _data5$style.image) || ((_data6 = data) === null || _data6 === void 0 ? void 0 : _data6.image) || image;
584
+ scale = ((_data7 = data) === null || _data7 === void 0 ? void 0 : (_data7$style = _data7.style) === null || _data7$style === void 0 ? void 0 : _data7$style.scale) || ((_data8 = data) === null || _data8 === void 0 ? void 0 : _data8.scale) || scale;
585
+ iconSize = ((_data9 = data) === null || _data9 === void 0 ? void 0 : (_data9$style = _data9.style) === null || _data9$style === void 0 ? void 0 : _data9$style.size) || ((_data10 = data) === null || _data10 === void 0 ? void 0 : _data10.size) || iconSize;
586
+ hideFooter = ((_data11 = data) === null || _data11 === void 0 ? void 0 : (_data11$style = _data11.style) === null || _data11$style === void 0 ? void 0 : _data11$style.hideFooter) || ((_data12 = data) === null || _data12 === void 0 ? void 0 : _data12.hideFooter) || hideFooter;
587
+ }
588
+ var size = ((_feature$get4 = feature.get('features')) === null || _feature$get4 === void 0 ? void 0 : _feature$get4.length) || 0;
589
+ var iconOptions = {
590
+ size: iconSize,
591
+ hideFooter: hideFooter
592
+ };
593
+ var P = {
594
+ marker: {
595
+ // 图标
596
+ icon: icon,
597
+ image: image,
598
+ iconOptions: iconOptions,
599
+ scale: scale
600
+ },
601
+ point: {
602
+ // 点位
603
+ icon: icon,
604
+ type: 'PointIcon',
605
+ iconOptions: iconOptions
606
+ },
607
+ marker_cluster: _objectSpread({
608
+ // 聚合图标
609
+ icon: icon,
610
+ image: image,
611
+ scale: scale,
612
+ color: size > 1 ? '' : color,
613
+ iconOptions: size > 1 ? _objectSpread({
614
+ hideFooter: true,
615
+ info: {
616
+ text: '',
617
+ fontSize: 18
618
+ }
619
+ }, (cluster === null || cluster === void 0 ? void 0 : cluster.iconOptions) || {}) : {}
620
+ }, size > 1 ? cluster === null || cluster === void 0 ? void 0 : cluster.style : cluster === null || cluster === void 0 ? void 0 : cluster.commonStyle),
621
+ point_cluster: _objectSpread({
622
+ // 聚合点位
623
+ icon: icon,
624
+ type: 'PointIcon',
625
+ iconOptions: size > 1 ? {
626
+ text: size
627
+ } : {}
628
+ }, size > 1 && (cluster === null || cluster === void 0 ? void 0 : cluster.style))
629
+ };
630
+ var type = point ? 'point' : 'marker';
631
+ if (cluster) {
632
+ if ((0, _isObject["default"])(cluster)) {
633
+ if (cluster.show) {
634
+ type = 'marker_cluster';
635
+ if (point) {
636
+ type = 'point_cluster';
637
+ }
638
+ }
639
+ } else {
640
+ type = 'marker_cluster';
641
+ if (point) {
642
+ type = 'point_cluster';
643
+ }
644
+ }
645
+ }
646
+ var _style = P[type];
647
+ if (label) {
648
+ var _Object$keys;
649
+ if ((_Object$keys = Object.keys(data)) !== null && _Object$keys !== void 0 && _Object$keys.includes('customText')) {
650
+ var _data13;
651
+ _style.text = (_data13 = data) === null || _data13 === void 0 ? void 0 : _data13.customText;
652
+ } else {
653
+ _style.text = this.getLabelStyle(feature, color);
654
+ }
655
+ }
656
+ if (feature.isCluster && size > 1 && type === 'marker_cluster') {
657
+ var _cluster$style2;
658
+ _style.text = this.getClusterTextStyle(size, cluster === null || cluster === void 0 ? void 0 : (_cluster$style2 = cluster.style) === null || _cluster$style2 === void 0 ? void 0 : _cluster$style2.numberStyle);
659
+ }
660
+ return _style;
661
+ }
662
+ }, {
663
+ key: "setClusterSource",
664
+ value: function setClusterSource(cluster) {
665
+ var _this$_features,
666
+ _this6 = this;
667
+ var _this = this;
668
+ cluster = (0, _isObject["default"])(cluster) ? cluster : {
669
+ show: cluster
670
+ };
671
+ var _cluster = cluster,
672
+ show = _cluster.show,
673
+ minDistance = _cluster.minDistance,
674
+ distance = _cluster.distance,
675
+ group = _cluster.group;
676
+ var source = new _source.Vector({
677
+ features: (_this$_features = this._features) === null || _this$_features === void 0 ? void 0 : _this$_features.filter(function (v) {
678
+ return !v.hasOwnProperty('show') || v.show;
679
+ })
680
+ });
681
+ if (show) {
682
+ group = group || this.group;
683
+ var clusterSource = new _MyCluster["default"](_objectSpread({
684
+ distance: distance || 100,
685
+ minDistance: minDistance || 50,
686
+ source: source,
687
+ group: group,
688
+ clusterChange: function clusterChange(features) {
689
+ _this6.setAlarmBgByFeatures(features);
690
+ },
691
+ createCluster: function createCluster(point, features) {
692
+ var _group;
693
+ var feature = new _ol.Feature({
694
+ geometry: point,
695
+ features: features.map(function (v) {
696
+ v.layerKey = _this.key;
697
+ return v;
698
+ })
699
+ });
700
+ if ((_group = group) !== null && _group !== void 0 && _group.length) {
701
+ var _group2, _groupItem, _groupItem$clusterSty;
702
+ var style, groupItem;
703
+ var f = features[0];
704
+ var size = features.length;
705
+ (_group2 = group) === null || _group2 === void 0 ? void 0 : _group2.map(function (v) {
706
+ var _v$filter2;
707
+ if (v !== null && v !== void 0 && (_v$filter2 = v.filter) !== null && _v$filter2 !== void 0 && _v$filter2.call(v, f.values_)) {
708
+ style = v.style || style;
709
+ groupItem = v;
710
+ }
711
+ });
712
+
713
+ // 当点位单独展示时,并且style为自定义函数
714
+ if (size === 1 && (0, _isFunction["default"])(style)) {
715
+ style = style(f);
716
+ }
717
+ var markerStyle = _objectSpread({}, style.style);
718
+ if (size > 1 && (_groupItem = groupItem) !== null && _groupItem !== void 0 && (_groupItem$clusterSty = _groupItem.clusterStyle) !== null && _groupItem$clusterSty !== void 0 && _groupItem$clusterSty.iconSrc) {
719
+ var _style = _this6.getCustomClusterStyle(feature, groupItem.clusterStyle);
720
+ feature.setStyle(_style);
721
+ } else {
722
+ if (size > 1) {
723
+ var _style4, _markerStyle2, _cluster2;
724
+ if ((_style4 = style) !== null && _style4 !== void 0 && _style4.clusterStyle) {
725
+ markerStyle = _objectSpread({}, style.clusterStyle);
726
+ }
727
+ var _markerStyle = markerStyle,
728
+ numberStyle = _markerStyle.numberStyle,
729
+ iconOptions = _markerStyle.iconOptions,
730
+ otherStyle = _objectWithoutProperties(_markerStyle, _excluded4);
731
+ markerStyle = _objectSpread(_objectSpread({}, otherStyle), {}, {
732
+ text: _this6.getClusterTextStyle((_markerStyle2 = markerStyle) !== null && _markerStyle2 !== void 0 && _markerStyle2.image ? size : ' ', numberStyle),
733
+ iconOptions: _objectSpread({
734
+ hideFooter: true,
735
+ info: {
736
+ text: size,
737
+ fontSize: 18
738
+ }
739
+ }, iconOptions || ((_cluster2 = cluster) === null || _cluster2 === void 0 ? void 0 : _cluster2.iconOptions) || {})
740
+ });
741
+ }
742
+ var _style5 = new _renderer["default"].Marker(markerStyle);
743
+ feature.setStyle(_style5);
744
+ }
745
+ }
746
+
747
+ // 增加聚合点位标识
748
+ feature.isCluster = true;
749
+ if (features.length === 1) {
750
+ feature.setProperties(features[0].values_);
751
+ }
752
+ return feature;
753
+ }
754
+ }, cluster));
755
+ this.setSource(clusterSource);
756
+ } else {
757
+ this.setSource(source);
758
+ }
759
+ }
760
+
761
+ // 清除报警背景
762
+ }, {
763
+ key: "clearAlarmBg",
764
+ value: function clearAlarmBg() {
765
+ var _this$overlays,
766
+ _this7 = this;
767
+ if (this.map && (_this$overlays = this.overlays) !== null && _this$overlays !== void 0 && _this$overlays.length) {
768
+ this.overlays.map(function (overlay) {
769
+ return _this7.map.removeOverlay(overlay);
770
+ });
771
+ this.overlays = null;
772
+ }
773
+ }
774
+
775
+ // 设置报警背景
776
+ }, {
777
+ key: "setAlarmBgByFeatures",
778
+ value: function setAlarmBgByFeatures(features) {
779
+ var _this8 = this;
780
+ this.clearAlarmBg();
781
+ this.overlays = [];
782
+ if (this.map && this.alarmBg && features !== null && features !== void 0 && features.length) {
783
+ features.map(function (feature) {
784
+ var _feature = feature;
785
+ var cluster = feature.get('features');
786
+ if (cluster) {
787
+ _feature = cluster.length < 2 ? cluster[0] : null;
788
+ }
789
+ if (_feature && (_feature.hasOwnProperty('show') ? _feature.show : true)) {
790
+ var overlay = addOverlay(_feature, _this8.map, _this8.alarmBg);
791
+ if (overlay) {
792
+ _this8.overlays.push(overlay);
793
+ }
794
+ }
795
+ });
796
+ }
797
+ }
798
+ }, {
799
+ key: "refresh",
800
+ value: function refresh() {
801
+ var _this9 = this;
802
+ (0, _createFeatureCollection.getDataByHttpByParams)({
803
+ url: this.url,
804
+ params: this.params,
805
+ method: this.method,
806
+ afterGetData: this.afterGetData,
807
+ field: this.dataField
808
+ }).then(function (features) {
809
+ if (features) {
810
+ var new_features = features;
811
+ _this9._features = new_features;
812
+ var newFeatures = [];
813
+ new_features.map(function (v) {
814
+ var f = _this9.getFeatureByFieldValue('id', v.values_.id);
815
+ if (f) {
816
+ f.values_ = v.values_;
817
+ } else {
818
+ newFeatures.push(v);
819
+ }
820
+ });
821
+ if (newFeatures.length) {
822
+ _this9.getSource().addFeatures(newFeatures);
823
+ _this9.setAlarmBgByFeatures(_this9.getSource().getFeatures());
824
+ }
825
+ _this9.getSource().changed();
826
+ }
827
+ });
828
+ }
829
+ }, {
830
+ key: "loadData",
831
+ value: function loadData(data) {
832
+ this.getSource().clear();
833
+ var features = (0, _createFeatureCollection.createGeoJson)(data, this.dataField);
834
+ this.getSource().addFeatures(features);
835
+ this.setAlarmBgByFeatures(this.getSource().getFeatures());
836
+ this._features = features;
837
+ if (this._options.cluster) {
838
+ this.setClusterMode(this._options.cluster);
839
+ }
840
+ }
841
+ }, {
842
+ key: "loadUrlData",
843
+ value: function loadUrlData(url, params, method) {
844
+ var _this10 = this;
845
+ var afterGetData = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : this.afterGetData;
846
+ this.getSource().clear();
847
+ this._features = [];
848
+ if (this.encrypt) {
849
+ params = (0, _encryptParams["default"])(params, this.encrypt);
850
+ }
851
+ (0, _createFeatureCollection.getDataByHttpByParams)({
852
+ url: url,
853
+ params: params,
854
+ method: method,
855
+ afterGetData: afterGetData,
856
+ field: this.dataField
857
+ }).then(function (features) {
858
+ _this10.getSource().clear();
859
+ _this10._features = [];
860
+ if (features !== null && features !== void 0 && features.length) {
861
+ _this10._features = features;
862
+ _this10.getSource().addFeatures(features);
863
+ _this10.setAlarmBgByFeatures(_this10.getSource().getFeatures());
864
+ }
865
+ if (_this10._options.cluster) {
866
+ _this10.setClusterMode(_this10._options.cluster);
867
+ }
868
+ });
869
+ }
870
+ }, {
871
+ key: "loadFeatures",
872
+ value: function loadFeatures(features) {
873
+ this.getSource().clear();
874
+ this.getSource().addFeatures(features);
875
+ this.setAlarmBgByFeatures(this.getSource().getFeatures());
876
+ this._features = features;
877
+ if (this._options.cluster) {
878
+ this.setClusterMode(this._options.cluster);
879
+ }
880
+ }
881
+ }, {
882
+ key: "getFeatures",
883
+ value: function getFeatures() {
884
+ var source = this.getSource().source || this.getSource();
885
+ return source.getFeatures();
886
+ }
887
+ }, {
888
+ key: "getFeatureByFieldValue",
889
+ value: function getFeatureByFieldValue(field, value) {
890
+ return this.getFeatures().find(function (v) {
891
+ return v.values_[field] === value;
892
+ });
893
+ }
894
+ }, {
895
+ key: "getFeaturesByFieldValueOpera",
896
+ value: function getFeaturesByFieldValueOpera(_ref3) {
897
+ var _this11 = this;
898
+ var field = _ref3.field,
899
+ value = _ref3.value,
900
+ _ref3$operation = _ref3.operation,
901
+ operation = _ref3$operation === void 0 ? '===' : _ref3$operation,
902
+ features = _ref3.features,
903
+ filter = _ref3.filter;
904
+ return new Promise(function (resolve, reject) {
905
+ var _features = features || _this11.getFeatures();
906
+ if (filter) {
907
+ _features = _features.filter(function (feature) {
908
+ return filter(feature.values_);
909
+ });
910
+ }
911
+ var result = _features;
912
+ if (operation && value !== undefined) {
913
+ if (['>', '>=', '<', '<=', '===', '!=='].includes(operation)) {
914
+ try {
915
+ // 通过动态创建方法自动传入操作符
916
+ var fun = new Function('features', 'field', 'value', "return features.filter(v => v.values_[field] ".concat(operation, " value)"));
917
+ result = fun(_features, field, value);
918
+ } catch (err) {
919
+ reject(err);
920
+ }
921
+ } else if (operation === 'like') {
922
+ // 包含
923
+ result = _features.filter(function (v) {
924
+ var _v$values_$field;
925
+ return ((_v$values_$field = v.values_[field]) === null || _v$values_$field === void 0 ? void 0 : _v$values_$field.indexOf(value)) !== -1;
926
+ });
927
+ } else if (operation === 'notLike') {
928
+ // 不包含
929
+ result = _features.filter(function (v) {
930
+ var _v$values_$field2;
931
+ return ((_v$values_$field2 = v.values_[field]) === null || _v$values_$field2 === void 0 ? void 0 : _v$values_$field2.indexOf(value)) === -1;
932
+ });
933
+ } else {
934
+ result = _features.filter(function (v) {
935
+ var _v$values_$field3;
936
+ return ((_v$values_$field3 = v.values_[field]) === null || _v$values_$field3 === void 0 ? void 0 : _v$values_$field3.indexOf(value)) !== -1;
937
+ });
938
+ }
939
+ }
940
+ resolve(result);
941
+ });
942
+ }
943
+
944
+ // 获取地图
945
+ }, {
946
+ key: "getMap",
947
+ value: function getMap() {
948
+ return this.map;
949
+ }
950
+
951
+ // 设置过滤条件
952
+ }, {
953
+ key: "setGroup",
954
+ value: function setGroup(group) {
955
+ if (group !== null && group !== void 0 && group.length) {
956
+ var _this$_features2;
957
+ if ((_this$_features2 = this._features) !== null && _this$_features2 !== void 0 && _this$_features2.length) {
958
+ this._features.map(function (feature) {
959
+ var show = true;
960
+ group.map(function (v) {
961
+ var _v$filter3;
962
+ v.filter = (0, _stringToFun["default"])(v.filter);
963
+ if (v !== null && v !== void 0 && (_v$filter3 = v.filter) !== null && _v$filter3 !== void 0 && _v$filter3.call(v, feature.values_)) {
964
+ if (v.hasOwnProperty('show') && !v.show) {
965
+ show = false;
966
+ }
967
+ }
968
+ });
969
+ feature.show = show;
970
+ });
971
+ }
972
+ this.group = group;
973
+ this.setVisibleByGroup();
974
+ if (this._options.cluster) {
975
+ this.setClusterMode(this._options.cluster);
976
+ } else {
977
+ this.setStyle(this.getStyleByMode());
978
+ }
979
+ this.setAlarmBgByFeatures(this._features);
980
+ }
981
+ }
982
+
983
+ // 根据过滤条件组显示图层
984
+ }, {
985
+ key: "setVisibleByGroup",
986
+ value: function setVisibleByGroup() {
987
+ var group = this.group;
988
+ if (group !== null && group !== void 0 && group.length) {
989
+ var visible = false;
990
+ group.map(function (v) {
991
+ if (!v.hasOwnProperty('show') || v.show) {
992
+ visible = true;
993
+ }
994
+ });
995
+ this.setVisible(visible);
996
+ }
997
+ }
998
+
999
+ // 设置图层显示隐藏
1000
+ }, {
1001
+ key: "setVisible",
1002
+ value: function setVisible(visible) {
1003
+ _get(_getPrototypeOf(FeatureLayer.prototype), "setVisible", this).call(this, visible); // 将属性传递给父类
1004
+
1005
+ var map = this.getMap && this.getMap();
1006
+ if (map) {
1007
+ map.layers.onChange();
1008
+ }
1009
+
1010
+ // 判断是否完成过初始化,没有的话就加载一波数据
1011
+ if (!this.inited) {
1012
+ this.init();
1013
+ }
1014
+ if (!visible) {
1015
+ this.clearAlarmBg();
1016
+ } else {
1017
+ this.setAlarmBgByFeatures(this.getSource().getFeatures());
1018
+ }
1019
+ }
1020
+ }, {
1021
+ key: "clearMoveEnd",
1022
+ value: function clearMoveEnd() {
1023
+ var map = this.map;
1024
+ if (map && this.moveEnd) {
1025
+ map.un('moveend', this.moveEnd);
1026
+ this.moveEnd = null;
1027
+ }
1028
+ }
1029
+ }, {
1030
+ key: "destroy",
1031
+ value: function destroy() {
1032
+ this.clearMoveEnd();
1033
+ this.clearAlarmBg();
1034
+ }
1035
+ }]);
1036
+ return FeatureLayer;
1037
+ }(_layer.Vector);
1038
+ var _default = FeatureLayer;
1039
+ exports["default"] = _default;
1040
+ //# sourceMappingURL=FeatureLayer.js.map