@antv/l7-map 2.21.11-beta.5 → 2.21.11-beta.7

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 (358) hide show
  1. package/README.md +27 -6
  2. package/es/index.d.ts +3 -4
  3. package/es/index.js +2 -4
  4. package/es/map/camera.d.ts +690 -0
  5. package/es/map/camera.js +1138 -0
  6. package/{lib → es/map}/css/l7.css +41 -7
  7. package/es/map/events.d.ts +384 -0
  8. package/es/map/events.js +222 -0
  9. package/es/map/geo/edge_insets.d.ts +97 -0
  10. package/es/{geo → map/geo}/edge_insets.js +55 -33
  11. package/es/map/geo/lng_lat.d.ts +116 -0
  12. package/es/map/geo/lng_lat.js +159 -0
  13. package/es/map/geo/lng_lat_bounds.d.ts +217 -0
  14. package/es/map/geo/lng_lat_bounds.js +334 -0
  15. package/es/map/geo/mercator_coordinate.d.ts +113 -0
  16. package/es/map/geo/mercator_coordinate.js +142 -0
  17. package/es/map/geo/transform.d.ts +262 -0
  18. package/es/map/geo/transform.js +736 -0
  19. package/{lib → es/map}/handler/box_zoom.d.ts +30 -24
  20. package/es/map/handler/box_zoom.js +145 -0
  21. package/es/map/handler/click_zoom.d.ts +24 -0
  22. package/es/map/handler/click_zoom.js +47 -0
  23. package/es/map/handler/cooperative_gestures.d.ts +40 -0
  24. package/es/map/handler/cooperative_gestures.js +94 -0
  25. package/es/map/handler/drag_handler.d.ts +88 -0
  26. package/es/map/handler/drag_handler.js +89 -0
  27. package/es/map/handler/drag_move_state_manager.d.ts +30 -0
  28. package/es/map/handler/drag_move_state_manager.js +94 -0
  29. package/es/map/handler/handler_util.d.ts +3 -0
  30. package/es/{handler → map/handler}/handler_util.js +1 -2
  31. package/es/map/handler/keyboard.d.ts +88 -0
  32. package/es/map/handler/keyboard.js +197 -0
  33. package/es/map/handler/map_event.d.ts +46 -0
  34. package/es/map/handler/map_event.js +131 -0
  35. package/es/map/handler/mouse.d.ts +30 -0
  36. package/es/map/handler/mouse.js +85 -0
  37. package/es/map/handler/one_finger_touch_drag.d.ts +15 -0
  38. package/es/map/handler/one_finger_touch_drag.js +39 -0
  39. package/es/map/handler/scroll_zoom.d.ts +102 -0
  40. package/es/map/handler/scroll_zoom.js +312 -0
  41. package/es/{handler → map/handler}/shim/dblclick_zoom.d.ts +14 -10
  42. package/es/{handler → map/handler}/shim/dblclick_zoom.js +20 -16
  43. package/es/map/handler/shim/drag_pan.d.ts +79 -0
  44. package/es/map/handler/shim/drag_pan.js +77 -0
  45. package/es/{handler → map/handler}/shim/drag_rotate.d.ts +24 -16
  46. package/es/map/handler/shim/drag_rotate.js +66 -0
  47. package/es/map/handler/shim/two_fingers_touch.d.ts +74 -0
  48. package/es/map/handler/shim/two_fingers_touch.js +106 -0
  49. package/es/map/handler/tap_drag_zoom.d.ts +28 -0
  50. package/es/map/handler/tap_drag_zoom.js +92 -0
  51. package/es/map/handler/tap_recognizer.d.ts +35 -0
  52. package/es/map/handler/tap_recognizer.js +107 -0
  53. package/es/map/handler/tap_zoom.d.ts +28 -0
  54. package/es/map/handler/tap_zoom.js +87 -0
  55. package/es/map/handler/touch_pan.d.ts +40 -0
  56. package/es/map/handler/touch_pan.js +85 -0
  57. package/es/map/handler/transform-provider.d.ts +23 -0
  58. package/es/map/handler/transform-provider.js +35 -0
  59. package/es/map/handler/two_fingers_touch.d.ts +107 -0
  60. package/es/map/handler/two_fingers_touch.js +289 -0
  61. package/es/map/handler_inertia.d.ts +20 -0
  62. package/es/{handler → map}/handler_inertia.js +36 -50
  63. package/es/map/handler_manager.d.ts +154 -0
  64. package/es/map/handler_manager.js +466 -0
  65. package/es/map/map.d.ts +625 -0
  66. package/es/map/map.js +972 -0
  67. package/es/map/util/abort_error.d.ts +15 -0
  68. package/es/map/util/abort_error.js +21 -0
  69. package/es/map/util/browser.d.ts +10 -0
  70. package/es/map/util/browser.js +30 -0
  71. package/es/map/util/dom.d.ts +30 -0
  72. package/es/map/util/dom.js +105 -0
  73. package/es/map/util/evented.d.ts +75 -0
  74. package/es/map/util/evented.js +158 -0
  75. package/es/map/util/task_queue.d.ts +18 -0
  76. package/es/map/util/task_queue.js +54 -0
  77. package/es/map/util/util.d.ts +104 -0
  78. package/es/map/util/util.js +155 -0
  79. package/lib/index.d.ts +3 -4
  80. package/lib/index.js +12 -42
  81. package/lib/map/camera.d.ts +690 -0
  82. package/lib/map/camera.js +1145 -0
  83. package/{es → lib/map}/css/l7.css +41 -7
  84. package/lib/map/events.d.ts +384 -0
  85. package/lib/map/events.js +231 -0
  86. package/lib/map/geo/edge_insets.d.ts +97 -0
  87. package/lib/{geo → map/geo}/edge_insets.js +56 -35
  88. package/lib/map/geo/lng_lat.d.ts +116 -0
  89. package/lib/map/geo/lng_lat.js +166 -0
  90. package/lib/map/geo/lng_lat_bounds.d.ts +217 -0
  91. package/lib/map/geo/lng_lat_bounds.js +341 -0
  92. package/lib/map/geo/mercator_coordinate.d.ts +113 -0
  93. package/lib/map/geo/mercator_coordinate.js +157 -0
  94. package/lib/map/geo/transform.d.ts +262 -0
  95. package/lib/map/geo/transform.js +744 -0
  96. package/{es → lib/map}/handler/box_zoom.d.ts +30 -24
  97. package/lib/map/handler/box_zoom.js +153 -0
  98. package/lib/map/handler/click_zoom.d.ts +24 -0
  99. package/lib/map/handler/click_zoom.js +54 -0
  100. package/lib/map/handler/cooperative_gestures.d.ts +40 -0
  101. package/lib/map/handler/cooperative_gestures.js +101 -0
  102. package/lib/map/handler/drag_handler.d.ts +88 -0
  103. package/lib/map/handler/drag_handler.js +97 -0
  104. package/lib/map/handler/drag_move_state_manager.d.ts +30 -0
  105. package/lib/map/handler/drag_move_state_manager.js +103 -0
  106. package/lib/map/handler/handler_util.d.ts +3 -0
  107. package/lib/{handler → map/handler}/handler_util.js +1 -2
  108. package/lib/map/handler/keyboard.d.ts +88 -0
  109. package/lib/map/handler/keyboard.js +205 -0
  110. package/lib/map/handler/map_event.d.ts +46 -0
  111. package/lib/map/handler/map_event.js +140 -0
  112. package/lib/map/handler/mouse.d.ts +30 -0
  113. package/lib/map/handler/mouse.js +93 -0
  114. package/lib/map/handler/one_finger_touch_drag.d.ts +15 -0
  115. package/lib/map/handler/one_finger_touch_drag.js +47 -0
  116. package/lib/map/handler/scroll_zoom.d.ts +102 -0
  117. package/lib/map/handler/scroll_zoom.js +320 -0
  118. package/lib/{handler → map/handler}/shim/dblclick_zoom.d.ts +14 -10
  119. package/lib/{handler → map/handler}/shim/dblclick_zoom.js +21 -17
  120. package/lib/map/handler/shim/drag_pan.d.ts +79 -0
  121. package/lib/map/handler/shim/drag_pan.js +85 -0
  122. package/lib/{handler → map/handler}/shim/drag_rotate.d.ts +24 -16
  123. package/lib/map/handler/shim/drag_rotate.js +74 -0
  124. package/lib/map/handler/shim/two_fingers_touch.d.ts +74 -0
  125. package/lib/map/handler/shim/two_fingers_touch.js +114 -0
  126. package/lib/map/handler/tap_drag_zoom.d.ts +28 -0
  127. package/lib/map/handler/tap_drag_zoom.js +99 -0
  128. package/lib/map/handler/tap_recognizer.d.ts +35 -0
  129. package/lib/map/handler/tap_recognizer.js +116 -0
  130. package/lib/map/handler/tap_zoom.d.ts +28 -0
  131. package/lib/map/handler/tap_zoom.js +94 -0
  132. package/lib/map/handler/touch_pan.d.ts +40 -0
  133. package/lib/map/handler/touch_pan.js +92 -0
  134. package/lib/map/handler/transform-provider.d.ts +23 -0
  135. package/lib/map/handler/transform-provider.js +43 -0
  136. package/lib/map/handler/two_fingers_touch.d.ts +107 -0
  137. package/lib/map/handler/two_fingers_touch.js +296 -0
  138. package/lib/map/handler_inertia.d.ts +20 -0
  139. package/lib/{handler → map}/handler_inertia.js +38 -53
  140. package/lib/map/handler_manager.d.ts +154 -0
  141. package/lib/map/handler_manager.js +474 -0
  142. package/lib/map/map.d.ts +625 -0
  143. package/lib/map/map.js +979 -0
  144. package/lib/map/util/abort_error.d.ts +15 -0
  145. package/lib/map/util/abort_error.js +29 -0
  146. package/lib/map/util/browser.d.ts +10 -0
  147. package/lib/map/util/browser.js +36 -0
  148. package/lib/map/util/dom.d.ts +30 -0
  149. package/lib/map/util/dom.js +113 -0
  150. package/lib/map/util/evented.d.ts +75 -0
  151. package/lib/map/util/evented.js +167 -0
  152. package/lib/map/util/task_queue.d.ts +18 -0
  153. package/lib/map/util/task_queue.js +62 -0
  154. package/lib/map/util/util.d.ts +104 -0
  155. package/lib/map/util/util.js +171 -0
  156. package/package.json +6 -3
  157. package/es/camera.d.ts +0 -86
  158. package/es/camera.js +0 -639
  159. package/es/earthmap.d.ts +0 -69
  160. package/es/earthmap.js +0 -445
  161. package/es/geo/edge_insets.d.ts +0 -54
  162. package/es/geo/lng_lat.d.ts +0 -18
  163. package/es/geo/lng_lat.js +0 -59
  164. package/es/geo/lng_lat_bounds.d.ts +0 -25
  165. package/es/geo/lng_lat_bounds.js +0 -118
  166. package/es/geo/mercator.d.ts +0 -30
  167. package/es/geo/mercator.js +0 -72
  168. package/es/geo/point.d.ts +0 -40
  169. package/es/geo/point.js +0 -153
  170. package/es/geo/simple.d.ts +0 -30
  171. package/es/geo/simple.js +0 -75
  172. package/es/geo/transform.d.ts +0 -198
  173. package/es/geo/transform.js +0 -895
  174. package/es/handler/IHandler.d.ts +0 -34
  175. package/es/handler/IHandler.js +0 -1
  176. package/es/handler/blockable_map_event.d.ts +0 -17
  177. package/es/handler/blockable_map_event.js +0 -58
  178. package/es/handler/box_zoom.js +0 -162
  179. package/es/handler/click_zoom.d.ts +0 -16
  180. package/es/handler/click_zoom.js +0 -40
  181. package/es/handler/events/event.d.ts +0 -4
  182. package/es/handler/events/event.js +0 -12
  183. package/es/handler/events/index.d.ts +0 -4
  184. package/es/handler/events/index.js +0 -4
  185. package/es/handler/events/map_mouse_event.d.ts +0 -34
  186. package/es/handler/events/map_mouse_event.js +0 -45
  187. package/es/handler/events/map_touch_event.d.ts +0 -57
  188. package/es/handler/events/map_touch_event.js +0 -75
  189. package/es/handler/events/map_wheel_event.d.ts +0 -33
  190. package/es/handler/events/map_wheel_event.js +0 -33
  191. package/es/handler/events/render_event.d.ts +0 -6
  192. package/es/handler/events/render_event.js +0 -10
  193. package/es/handler/handler_inertia.d.ts +0 -23
  194. package/es/handler/handler_manager.d.ts +0 -61
  195. package/es/handler/handler_manager.js +0 -487
  196. package/es/handler/handler_util.d.ts +0 -4
  197. package/es/handler/keyboard.d.ts +0 -36
  198. package/es/handler/keyboard.js +0 -131
  199. package/es/handler/map_event.d.ts +0 -29
  200. package/es/handler/map_event.js +0 -89
  201. package/es/handler/mouse/index.d.ts +0 -4
  202. package/es/handler/mouse/index.js +0 -4
  203. package/es/handler/mouse/mouse_handler.d.ts +0 -22
  204. package/es/handler/mouse/mouse_handler.js +0 -99
  205. package/es/handler/mouse/mousepan_handler.d.ts +0 -10
  206. package/es/handler/mouse/mousepan_handler.js +0 -21
  207. package/es/handler/mouse/mousepitch_hander.d.ts +0 -9
  208. package/es/handler/mouse/mousepitch_hander.js +0 -24
  209. package/es/handler/mouse/mouserotate_hander.d.ts +0 -9
  210. package/es/handler/mouse/mouserotate_hander.js +0 -24
  211. package/es/handler/mouse/util.d.ts +0 -6
  212. package/es/handler/mouse/util.js +0 -12
  213. package/es/handler/scroll_zoom.d.ts +0 -93
  214. package/es/handler/scroll_zoom.js +0 -315
  215. package/es/handler/shim/drag_pan.d.ts +0 -61
  216. package/es/handler/shim/drag_pan.js +0 -75
  217. package/es/handler/shim/drag_rotate.js +0 -64
  218. package/es/handler/shim/touch_zoom_rotate.d.ts +0 -70
  219. package/es/handler/shim/touch_zoom_rotate.js +0 -104
  220. package/es/handler/tap/single_tap_recognizer.d.ts +0 -20
  221. package/es/handler/tap/single_tap_recognizer.js +0 -77
  222. package/es/handler/tap/tap_drag_zoom.d.ts +0 -22
  223. package/es/handler/tap/tap_drag_zoom.js +0 -89
  224. package/es/handler/tap/tap_recognizer.d.ts +0 -17
  225. package/es/handler/tap/tap_recognizer.js +0 -46
  226. package/es/handler/tap/tap_zoom.d.ts +0 -22
  227. package/es/handler/tap/tap_zoom.js +0 -81
  228. package/es/handler/touch/index.d.ts +0 -5
  229. package/es/handler/touch/index.js +0 -5
  230. package/es/handler/touch/touch_pan.d.ts +0 -30
  231. package/es/handler/touch/touch_pan.js +0 -91
  232. package/es/handler/touch/touch_pitch.d.ts +0 -13
  233. package/es/handler/touch/touch_pitch.js +0 -75
  234. package/es/handler/touch/touch_rotate.d.ts +0 -12
  235. package/es/handler/touch/touch_rotate.js +0 -57
  236. package/es/handler/touch/touch_zoom.d.ts +0 -12
  237. package/es/handler/touch/touch_zoom.js +0 -37
  238. package/es/handler/touch/two_touch.d.ts +0 -23
  239. package/es/handler/touch/two_touch.js +0 -98
  240. package/es/hash.d.ts +0 -14
  241. package/es/hash.js +0 -121
  242. package/es/interface.d.ts +0 -34
  243. package/es/interface.js +0 -1
  244. package/es/map.d.ts +0 -70
  245. package/es/map.js +0 -472
  246. package/es/util.d.ts +0 -25
  247. package/es/util.js +0 -70
  248. package/es/utils/Aabb.d.ts +0 -12
  249. package/es/utils/Aabb.js +0 -72
  250. package/es/utils/dom.d.ts +0 -4
  251. package/es/utils/dom.js +0 -117
  252. package/es/utils/performance.d.ts +0 -17
  253. package/es/utils/performance.js +0 -58
  254. package/es/utils/primitives.d.ts +0 -6
  255. package/es/utils/primitives.js +0 -37
  256. package/es/utils/task_queue.d.ts +0 -13
  257. package/es/utils/task_queue.js +0 -60
  258. package/lib/camera.d.ts +0 -86
  259. package/lib/camera.js +0 -648
  260. package/lib/earthmap.d.ts +0 -69
  261. package/lib/earthmap.js +0 -451
  262. package/lib/geo/edge_insets.d.ts +0 -54
  263. package/lib/geo/lng_lat.d.ts +0 -18
  264. package/lib/geo/lng_lat.js +0 -67
  265. package/lib/geo/lng_lat_bounds.d.ts +0 -25
  266. package/lib/geo/lng_lat_bounds.js +0 -126
  267. package/lib/geo/mercator.d.ts +0 -30
  268. package/lib/geo/mercator.js +0 -88
  269. package/lib/geo/point.d.ts +0 -40
  270. package/lib/geo/point.js +0 -161
  271. package/lib/geo/simple.d.ts +0 -30
  272. package/lib/geo/simple.js +0 -92
  273. package/lib/geo/transform.d.ts +0 -198
  274. package/lib/geo/transform.js +0 -906
  275. package/lib/handler/IHandler.d.ts +0 -34
  276. package/lib/handler/IHandler.js +0 -5
  277. package/lib/handler/blockable_map_event.d.ts +0 -17
  278. package/lib/handler/blockable_map_event.js +0 -66
  279. package/lib/handler/box_zoom.js +0 -168
  280. package/lib/handler/click_zoom.d.ts +0 -16
  281. package/lib/handler/click_zoom.js +0 -48
  282. package/lib/handler/events/event.d.ts +0 -4
  283. package/lib/handler/events/event.js +0 -20
  284. package/lib/handler/events/index.d.ts +0 -4
  285. package/lib/handler/events/index.js +0 -27
  286. package/lib/handler/events/map_mouse_event.d.ts +0 -34
  287. package/lib/handler/events/map_mouse_event.js +0 -53
  288. package/lib/handler/events/map_touch_event.d.ts +0 -57
  289. package/lib/handler/events/map_touch_event.js +0 -83
  290. package/lib/handler/events/map_wheel_event.d.ts +0 -33
  291. package/lib/handler/events/map_wheel_event.js +0 -41
  292. package/lib/handler/events/render_event.d.ts +0 -6
  293. package/lib/handler/events/render_event.js +0 -18
  294. package/lib/handler/handler_inertia.d.ts +0 -23
  295. package/lib/handler/handler_manager.d.ts +0 -61
  296. package/lib/handler/handler_manager.js +0 -495
  297. package/lib/handler/handler_util.d.ts +0 -4
  298. package/lib/handler/keyboard.d.ts +0 -36
  299. package/lib/handler/keyboard.js +0 -138
  300. package/lib/handler/map_event.d.ts +0 -29
  301. package/lib/handler/map_event.js +0 -97
  302. package/lib/handler/mouse/index.d.ts +0 -4
  303. package/lib/handler/mouse/index.js +0 -27
  304. package/lib/handler/mouse/mouse_handler.d.ts +0 -22
  305. package/lib/handler/mouse/mouse_handler.js +0 -107
  306. package/lib/handler/mouse/mousepan_handler.d.ts +0 -10
  307. package/lib/handler/mouse/mousepan_handler.js +0 -29
  308. package/lib/handler/mouse/mousepitch_hander.d.ts +0 -9
  309. package/lib/handler/mouse/mousepitch_hander.js +0 -32
  310. package/lib/handler/mouse/mouserotate_hander.d.ts +0 -9
  311. package/lib/handler/mouse/mouserotate_hander.js +0 -32
  312. package/lib/handler/mouse/util.d.ts +0 -6
  313. package/lib/handler/mouse/util.js +0 -19
  314. package/lib/handler/scroll_zoom.d.ts +0 -93
  315. package/lib/handler/scroll_zoom.js +0 -322
  316. package/lib/handler/shim/drag_pan.d.ts +0 -61
  317. package/lib/handler/shim/drag_pan.js +0 -83
  318. package/lib/handler/shim/drag_rotate.js +0 -72
  319. package/lib/handler/shim/touch_zoom_rotate.d.ts +0 -70
  320. package/lib/handler/shim/touch_zoom_rotate.js +0 -112
  321. package/lib/handler/tap/single_tap_recognizer.d.ts +0 -20
  322. package/lib/handler/tap/single_tap_recognizer.js +0 -86
  323. package/lib/handler/tap/tap_drag_zoom.d.ts +0 -22
  324. package/lib/handler/tap/tap_drag_zoom.js +0 -97
  325. package/lib/handler/tap/tap_recognizer.d.ts +0 -17
  326. package/lib/handler/tap/tap_recognizer.js +0 -56
  327. package/lib/handler/tap/tap_zoom.d.ts +0 -22
  328. package/lib/handler/tap/tap_zoom.js +0 -89
  329. package/lib/handler/touch/index.d.ts +0 -5
  330. package/lib/handler/touch/index.js +0 -34
  331. package/lib/handler/touch/touch_pan.d.ts +0 -30
  332. package/lib/handler/touch/touch_pan.js +0 -100
  333. package/lib/handler/touch/touch_pitch.d.ts +0 -13
  334. package/lib/handler/touch/touch_pitch.js +0 -83
  335. package/lib/handler/touch/touch_rotate.d.ts +0 -12
  336. package/lib/handler/touch/touch_rotate.js +0 -65
  337. package/lib/handler/touch/touch_zoom.d.ts +0 -12
  338. package/lib/handler/touch/touch_zoom.js +0 -45
  339. package/lib/handler/touch/two_touch.d.ts +0 -23
  340. package/lib/handler/touch/two_touch.js +0 -106
  341. package/lib/hash.d.ts +0 -14
  342. package/lib/hash.js +0 -129
  343. package/lib/interface.d.ts +0 -34
  344. package/lib/interface.js +0 -5
  345. package/lib/map.d.ts +0 -70
  346. package/lib/map.js +0 -478
  347. package/lib/util.d.ts +0 -25
  348. package/lib/util.js +0 -89
  349. package/lib/utils/Aabb.d.ts +0 -12
  350. package/lib/utils/Aabb.js +0 -80
  351. package/lib/utils/dom.d.ts +0 -4
  352. package/lib/utils/dom.js +0 -125
  353. package/lib/utils/performance.d.ts +0 -17
  354. package/lib/utils/performance.js +0 -64
  355. package/lib/utils/primitives.d.ts +0 -6
  356. package/lib/utils/primitives.js +0 -45
  357. package/lib/utils/task_queue.d.ts +0 -13
  358. package/lib/utils/task_queue.js +0 -67
@@ -1,118 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import LngLat from "./lng_lat";
3
- export default class LngLatBounds {
4
- static convert(input) {
5
- if (input instanceof LngLatBounds) {
6
- return input;
7
- }
8
- return new LngLatBounds(input);
9
- }
10
- constructor(sw, ne) {
11
- _defineProperty(this, "ne", void 0);
12
- _defineProperty(this, "sw", void 0);
13
- if (!sw) {
14
- // noop
15
- } else if (ne) {
16
- this.setSouthWest(sw).setNorthEast(ne);
17
- } else if (sw.length === 4) {
18
- this.setSouthWest([sw[0], sw[1]]).setNorthEast([sw[2], sw[3]]);
19
- } else {
20
- this.setSouthWest(sw[0]).setNorthEast(sw[1]);
21
- }
22
- }
23
- setNorthEast(ne) {
24
- this.ne = ne instanceof LngLat ? new LngLat(ne.lng, ne.lat) : LngLat.convert(ne);
25
- return this;
26
- }
27
- setSouthWest(sw) {
28
- this.sw = sw instanceof LngLat ? new LngLat(sw.lng, sw.lat) : LngLat.convert(sw);
29
- return this;
30
- }
31
- extend(obj) {
32
- const sw = this.sw;
33
- const ne = this.ne;
34
- let sw2;
35
- let ne2;
36
- if (obj instanceof LngLat) {
37
- sw2 = obj;
38
- ne2 = obj;
39
- } else if (obj instanceof LngLatBounds) {
40
- sw2 = obj.sw;
41
- ne2 = obj.ne;
42
- if (!sw2 || !ne2) {
43
- return this;
44
- }
45
- } else {
46
- if (Array.isArray(obj)) {
47
- // @ts-ignore
48
- if (obj.length === 4 || obj.every(Array.isArray)) {
49
- const lngLatBoundsObj = obj;
50
- return this.extend(LngLatBounds.convert(lngLatBoundsObj));
51
- } else {
52
- const lngLatObj = obj;
53
- return this.extend(LngLat.convert(lngLatObj));
54
- }
55
- }
56
- return this;
57
- }
58
- if (!sw && !ne) {
59
- this.sw = new LngLat(sw2.lng, sw2.lat);
60
- this.ne = new LngLat(ne2.lng, ne2.lat);
61
- } else {
62
- sw.lng = Math.min(sw2.lng, sw.lng);
63
- sw.lat = Math.min(sw2.lat, sw.lat);
64
- ne.lng = Math.max(ne2.lng, ne.lng);
65
- ne.lat = Math.max(ne2.lat, ne.lat);
66
- }
67
- return this;
68
- }
69
- getCenter() {
70
- return new LngLat((this.sw.lng + this.ne.lng) / 2, (this.sw.lat + this.ne.lat) / 2);
71
- }
72
- getSouthWest() {
73
- return this.sw;
74
- }
75
- getNorthEast() {
76
- return this.ne;
77
- }
78
- getNorthWest() {
79
- return new LngLat(this.getWest(), this.getNorth());
80
- }
81
- getSouthEast() {
82
- return new LngLat(this.getEast(), this.getSouth());
83
- }
84
- getWest() {
85
- return this.sw.lng;
86
- }
87
- getSouth() {
88
- return this.sw.lat;
89
- }
90
- getEast() {
91
- return this.ne.lng;
92
- }
93
- getNorth() {
94
- return this.ne.lat;
95
- }
96
- toArray() {
97
- return [this.sw.toArray(), this.ne.toArray()];
98
- }
99
- toString() {
100
- return `LngLatBounds(${this.sw.toString()}, ${this.ne.toString()})`;
101
- }
102
- isEmpty() {
103
- return !(this.sw && this.ne);
104
- }
105
- contains(lnglat) {
106
- const {
107
- lng,
108
- lat
109
- } = LngLat.convert(lnglat);
110
- const containsLatitude = this.sw.lat <= lat && lat <= this.ne.lat;
111
- let containsLongitude = this.sw.lng <= lng && lng <= this.ne.lng;
112
- if (this.sw.lng > this.ne.lng) {
113
- // wrapped coordinates
114
- containsLongitude = this.sw.lng >= lng && lng >= this.ne.lng;
115
- }
116
- return containsLatitude && containsLongitude;
117
- }
118
- }
@@ -1,30 +0,0 @@
1
- import type { LngLatLike } from '../geo/lng_lat';
2
- import LngLat from '../geo/lng_lat';
3
- export declare function mercatorXfromLng(lng: number): number;
4
- export declare function mercatorYfromLat(lat: number): number;
5
- export declare function mercatorZfromAltitude(altitude: number, lat: number): number;
6
- export declare function lngFromMercatorX(x: number): number;
7
- export declare function latFromMercatorY(y: number): number;
8
- export declare function altitudeFromMercatorZ(z: number, y: number): number;
9
- /**
10
- * Determine the Mercator scale factor for a given latitude, see
11
- * https://en.wikipedia.org/wiki/Mercator_projection#Scale_factor
12
- *
13
- * At the equator the scale factor will be 1, which increases at higher latitudes.
14
- *
15
- * @param {number} lat Latitude
16
- * @returns {number} scale factor
17
- * @private
18
- */
19
- export declare function mercatorScale(lat: number): number;
20
- export default class MercatorCoordinate {
21
- static fromLngLat(lngLatLike: LngLatLike, altitude?: number): MercatorCoordinate;
22
- x: number;
23
- y: number;
24
- z: number;
25
- constructor(x: number, y: number, z?: number);
26
- toLngLat(): LngLat;
27
- toAltitude(): number;
28
- meterInMercatorCoordinateUnits(): number;
29
- }
30
- export { MercatorCoordinate };
@@ -1,72 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import LngLat, { earthRadius } from "../geo/lng_lat";
3
-
4
- /*
5
- * The average circumference of the world in meters.
6
- */
7
- const earthCircumfrence = 2 * Math.PI * earthRadius; // meters
8
-
9
- /*
10
- * The circumference at a line of latitude in meters.
11
- */
12
- function circumferenceAtLatitude(latitude) {
13
- return earthCircumfrence * Math.cos(latitude * Math.PI / 180);
14
- }
15
- export function mercatorXfromLng(lng) {
16
- return (180 + lng) / 360;
17
- }
18
- export function mercatorYfromLat(lat) {
19
- return (180 - 180 / Math.PI * Math.log(Math.tan(Math.PI / 4 + lat * Math.PI / 360))) / 360;
20
- }
21
- export function mercatorZfromAltitude(altitude, lat) {
22
- return altitude / circumferenceAtLatitude(lat);
23
- }
24
- export function lngFromMercatorX(x) {
25
- return x * 360 - 180;
26
- }
27
- export function latFromMercatorY(y) {
28
- const y2 = 180 - y * 360;
29
- return 360 / Math.PI * Math.atan(Math.exp(y2 * Math.PI / 180)) - 90;
30
- }
31
- export function altitudeFromMercatorZ(z, y) {
32
- return z * circumferenceAtLatitude(latFromMercatorY(y));
33
- }
34
-
35
- /**
36
- * Determine the Mercator scale factor for a given latitude, see
37
- * https://en.wikipedia.org/wiki/Mercator_projection#Scale_factor
38
- *
39
- * At the equator the scale factor will be 1, which increases at higher latitudes.
40
- *
41
- * @param {number} lat Latitude
42
- * @returns {number} scale factor
43
- * @private
44
- */
45
- export function mercatorScale(lat) {
46
- return 1 / Math.cos(lat * Math.PI / 180);
47
- }
48
- export default class MercatorCoordinate {
49
- static fromLngLat(lngLatLike, altitude = 0) {
50
- const lngLat = LngLat.convert(lngLatLike);
51
- return new MercatorCoordinate(mercatorXfromLng(lngLat.lng), mercatorYfromLat(lngLat.lat), mercatorZfromAltitude(altitude, lngLat.lat));
52
- }
53
- constructor(x, y, z = 0) {
54
- _defineProperty(this, "x", void 0);
55
- _defineProperty(this, "y", void 0);
56
- _defineProperty(this, "z", void 0);
57
- this.x = +x;
58
- this.y = +y;
59
- this.z = +z;
60
- }
61
- toLngLat() {
62
- return new LngLat(lngFromMercatorX(this.x), latFromMercatorY(this.y));
63
- }
64
- toAltitude() {
65
- return altitudeFromMercatorZ(this.z, this.y);
66
- }
67
- meterInMercatorCoordinateUnits() {
68
- // 1 meter / circumference at equator in meters * Mercator projection scale factor at this latitude
69
- return 1 / earthCircumfrence * mercatorScale(latFromMercatorY(this.y));
70
- }
71
- }
72
- export { MercatorCoordinate };
package/es/geo/point.d.ts DELETED
@@ -1,40 +0,0 @@
1
- export type PointLike = [number, number] | Point;
2
- export default class Point {
3
- static convert(a: any): any;
4
- x: number;
5
- y: number;
6
- constructor(x: number, y: number);
7
- clone(): Point;
8
- _add(p: Point): this;
9
- add(p: Point): Point;
10
- _sub(p: Point): this;
11
- sub(p: Point): Point;
12
- _multByPoint(p: Point): this;
13
- multByPoint(p: Point): Point;
14
- _divByPoint(p: Point): this;
15
- divByPoint(p: Point): Point;
16
- _mult(k: number): this;
17
- mult(k: number): Point;
18
- _div(k: number): this;
19
- div(k: number): Point;
20
- _rotate(angle: number): this;
21
- rotate(angle: number): Point;
22
- _rotateAround(angle: number, p: Point): this;
23
- roateAround(angle: number, p: Point): Point;
24
- _matMult(m: number[]): this;
25
- matMult(m: number[]): Point;
26
- _unit(): this;
27
- unit(): Point;
28
- _perp(): this;
29
- perp(): Point;
30
- _round(): this;
31
- round(): Point;
32
- mag(): number;
33
- equals(other: Point): boolean;
34
- dist(p: Point): number;
35
- distSqr(p: Point): number;
36
- angle(): number;
37
- angleTo(b: Point): number;
38
- angleWith(b: Point): number;
39
- angleWithSep(x: number, y: number): number;
40
- }
package/es/geo/point.js DELETED
@@ -1,153 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- export default class Point {
3
- static convert(a) {
4
- if (a instanceof Point) {
5
- return a;
6
- }
7
- if (Array.isArray(a)) {
8
- return new Point(a[0], a[1]);
9
- }
10
- return a;
11
- }
12
- constructor(x, y) {
13
- _defineProperty(this, "x", void 0);
14
- _defineProperty(this, "y", void 0);
15
- this.x = x;
16
- this.y = y;
17
- }
18
- clone() {
19
- return new Point(this.x, this.y);
20
- }
21
- _add(p) {
22
- this.x += p.x;
23
- this.y += p.y;
24
- return this;
25
- }
26
- add(p) {
27
- return this.clone()._add(p);
28
- }
29
- _sub(p) {
30
- this.x -= p.x;
31
- this.y -= p.y;
32
- return this;
33
- }
34
- sub(p) {
35
- return this.clone()._sub(p);
36
- }
37
- _multByPoint(p) {
38
- this.x *= p.x;
39
- this.y *= p.y;
40
- return this;
41
- }
42
- multByPoint(p) {
43
- return this.clone()._multByPoint(p);
44
- }
45
- _divByPoint(p) {
46
- this.x /= p.x;
47
- this.y /= p.y;
48
- return this;
49
- }
50
- divByPoint(p) {
51
- return this.clone()._divByPoint(p);
52
- }
53
- _mult(k) {
54
- this.x *= k;
55
- this.y *= k;
56
- return this;
57
- }
58
- mult(k) {
59
- return this.clone()._mult(k);
60
- }
61
- _div(k) {
62
- this.x /= k;
63
- this.y /= k;
64
- return this;
65
- }
66
- div(k) {
67
- return this.clone()._div(k);
68
- }
69
- _rotate(angle) {
70
- const cos = Math.cos(angle);
71
- const sin = Math.sin(angle);
72
- const x = cos * this.x - sin * this.y;
73
- const y = sin * this.x + cos * this.y;
74
- this.x = x;
75
- this.y = y;
76
- return this;
77
- }
78
- rotate(angle) {
79
- return this.clone()._rotate(angle);
80
- }
81
- _rotateAround(angle, p) {
82
- const cos = Math.cos(angle);
83
- const sin = Math.sin(angle);
84
- const x = p.x + cos * (this.x - p.x) - sin * (this.y - p.y);
85
- const y = p.y + sin * (this.x - p.x) + cos * (this.y - p.y);
86
- this.x = x;
87
- this.y = y;
88
- return this;
89
- }
90
- roateAround(angle, p) {
91
- return this.clone()._rotateAround(angle, p);
92
- }
93
- _matMult(m) {
94
- const x = m[0] * this.x + m[1] * this.y;
95
- const y = m[2] * this.x + m[3] * this.y;
96
- this.x = x;
97
- this.y = y;
98
- return this;
99
- }
100
- matMult(m) {
101
- return this.clone()._matMult(m);
102
- }
103
- _unit() {
104
- this.div(this.mag());
105
- return this;
106
- }
107
- unit() {
108
- return this.clone()._unit();
109
- }
110
- _perp() {
111
- const y = this.y;
112
- this.y = this.x;
113
- this.x = -y;
114
- return this;
115
- }
116
- perp() {
117
- return this.clone()._perp();
118
- }
119
- _round() {
120
- this.x = Math.round(this.x);
121
- this.y = Math.round(this.y);
122
- return this;
123
- }
124
- round() {
125
- return this.clone()._round();
126
- }
127
- mag() {
128
- return Math.sqrt(this.x * this.x + this.y * this.y);
129
- }
130
- equals(other) {
131
- return this.x === other.x && this.y === other.y;
132
- }
133
- dist(p) {
134
- return Math.sqrt(this.distSqr(p));
135
- }
136
- distSqr(p) {
137
- const dx = p.x - this.x;
138
- const dy = p.y - this.y;
139
- return dx * dx + dy * dy;
140
- }
141
- angle() {
142
- return Math.atan2(this.y, this.x);
143
- }
144
- angleTo(b) {
145
- return Math.atan2(this.y - b.y, this.x - b.x);
146
- }
147
- angleWith(b) {
148
- return this.angleWithSep(b.x, b.y);
149
- }
150
- angleWithSep(x, y) {
151
- return Math.atan2(this.x * y - this.y * x, this.x * x + this.y * y);
152
- }
153
- }
@@ -1,30 +0,0 @@
1
- import type { LngLatLike } from '../geo/lng_lat';
2
- import LngLat from '../geo/lng_lat';
3
- export declare function circumferenceAtLatitude(latitude: number): number;
4
- export declare function mercatorXfromLng(lng: number): number;
5
- export declare function mercatorYfromLat(lat: number): number;
6
- export declare function mercatorZfromAltitude(altitude: number, lat: number): number;
7
- export declare function lngFromMercatorX(x: number): number;
8
- export declare function latFromMercatorY(y: number): number;
9
- export declare function altitudeFromMercatorZ(z: number, y: number): number;
10
- /**
11
- * Determine the Mercator scale factor for a given latitude, see
12
- * https://en.wikipedia.org/wiki/Mercator_projection#Scale_factor
13
- *
14
- * At the equator the scale factor will be 1, which increases at higher latitudes.
15
- *
16
- * @param {number} lat Latitude
17
- * @returns {number} scale factor
18
- * @private
19
- */
20
- export declare function mercatorScale(lat: number): number;
21
- export default class SimpleCoordinate {
22
- static fromLngLat(lngLatLike: LngLatLike, altitude?: number): SimpleCoordinate;
23
- x: number;
24
- y: number;
25
- z: number;
26
- constructor(x: number, y: number, z?: number);
27
- toLngLat(): LngLat;
28
- toAltitude(): number;
29
- meterInMercatorCoordinateUnits(): number;
30
- }
package/es/geo/simple.js DELETED
@@ -1,75 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import LngLat, { earthRadius } from "../geo/lng_lat";
3
-
4
- /*
5
- * The average circumference of the world in meters.
6
- */
7
- const earthCircumfrence = 2 * Math.PI * earthRadius; // meters
8
-
9
- /*
10
- * The circumference at a line of latitude in meters.
11
- */
12
- export function circumferenceAtLatitude(latitude) {
13
- return earthCircumfrence * Math.cos(latitude * Math.PI / 180);
14
- }
15
- export function mercatorXfromLng(lng) {
16
- return lng;
17
- }
18
- export function mercatorYfromLat(lat) {
19
- return lat;
20
- }
21
-
22
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
23
- export function mercatorZfromAltitude(altitude, lat) {
24
- return altitude;
25
- }
26
- export function lngFromMercatorX(x) {
27
- return x;
28
- }
29
- export function latFromMercatorY(y) {
30
- return y;
31
- }
32
-
33
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
34
- export function altitudeFromMercatorZ(z, y) {
35
- return z;
36
- }
37
-
38
- /**
39
- * Determine the Mercator scale factor for a given latitude, see
40
- * https://en.wikipedia.org/wiki/Mercator_projection#Scale_factor
41
- *
42
- * At the equator the scale factor will be 1, which increases at higher latitudes.
43
- *
44
- * @param {number} lat Latitude
45
- * @returns {number} scale factor
46
- * @private
47
- */
48
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
49
- export function mercatorScale(lat) {
50
- return 1;
51
- }
52
- export default class SimpleCoordinate {
53
- static fromLngLat(lngLatLike, altitude = 0) {
54
- const lngLat = LngLat.convert(lngLatLike);
55
- return new SimpleCoordinate(mercatorXfromLng(lngLat.lng), mercatorYfromLat(lngLat.lat), mercatorZfromAltitude(altitude, lngLat.lat));
56
- }
57
- constructor(x, y, z = 0) {
58
- _defineProperty(this, "x", void 0);
59
- _defineProperty(this, "y", void 0);
60
- _defineProperty(this, "z", void 0);
61
- this.x = +x;
62
- this.y = +y;
63
- this.z = +z;
64
- }
65
- toLngLat() {
66
- return new LngLat(this.x, this.y);
67
- }
68
- toAltitude() {
69
- return this.z;
70
- }
71
- meterInMercatorCoordinateUnits() {
72
- // 1 meter / circumference at equator in meters * Mercator projection scale factor at this latitude
73
- return 1;
74
- }
75
- }