@vtx/ol-map 2.0.0-beta.1 → 2.0.0-beta.3

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