@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.
- package/README.md +27 -6
- package/es/index.d.ts +3 -4
- package/es/index.js +2 -4
- package/es/map/camera.d.ts +690 -0
- package/es/map/camera.js +1138 -0
- package/{lib → es/map}/css/l7.css +41 -7
- package/es/map/events.d.ts +384 -0
- package/es/map/events.js +222 -0
- package/es/map/geo/edge_insets.d.ts +97 -0
- package/es/{geo → map/geo}/edge_insets.js +55 -33
- package/es/map/geo/lng_lat.d.ts +116 -0
- package/es/map/geo/lng_lat.js +159 -0
- package/es/map/geo/lng_lat_bounds.d.ts +217 -0
- package/es/map/geo/lng_lat_bounds.js +334 -0
- package/es/map/geo/mercator_coordinate.d.ts +113 -0
- package/es/map/geo/mercator_coordinate.js +142 -0
- package/es/map/geo/transform.d.ts +262 -0
- package/es/map/geo/transform.js +736 -0
- package/{lib → es/map}/handler/box_zoom.d.ts +30 -24
- package/es/map/handler/box_zoom.js +145 -0
- package/es/map/handler/click_zoom.d.ts +24 -0
- package/es/map/handler/click_zoom.js +47 -0
- package/es/map/handler/cooperative_gestures.d.ts +40 -0
- package/es/map/handler/cooperative_gestures.js +94 -0
- package/es/map/handler/drag_handler.d.ts +88 -0
- package/es/map/handler/drag_handler.js +89 -0
- package/es/map/handler/drag_move_state_manager.d.ts +30 -0
- package/es/map/handler/drag_move_state_manager.js +94 -0
- package/es/map/handler/handler_util.d.ts +3 -0
- package/es/{handler → map/handler}/handler_util.js +1 -2
- package/es/map/handler/keyboard.d.ts +88 -0
- package/es/map/handler/keyboard.js +197 -0
- package/es/map/handler/map_event.d.ts +46 -0
- package/es/map/handler/map_event.js +131 -0
- package/es/map/handler/mouse.d.ts +30 -0
- package/es/map/handler/mouse.js +85 -0
- package/es/map/handler/one_finger_touch_drag.d.ts +15 -0
- package/es/map/handler/one_finger_touch_drag.js +39 -0
- package/es/map/handler/scroll_zoom.d.ts +102 -0
- package/es/map/handler/scroll_zoom.js +312 -0
- package/es/{handler → map/handler}/shim/dblclick_zoom.d.ts +14 -10
- package/es/{handler → map/handler}/shim/dblclick_zoom.js +20 -16
- package/es/map/handler/shim/drag_pan.d.ts +79 -0
- package/es/map/handler/shim/drag_pan.js +77 -0
- package/es/{handler → map/handler}/shim/drag_rotate.d.ts +24 -16
- package/es/map/handler/shim/drag_rotate.js +66 -0
- package/es/map/handler/shim/two_fingers_touch.d.ts +74 -0
- package/es/map/handler/shim/two_fingers_touch.js +106 -0
- package/es/map/handler/tap_drag_zoom.d.ts +28 -0
- package/es/map/handler/tap_drag_zoom.js +92 -0
- package/es/map/handler/tap_recognizer.d.ts +35 -0
- package/es/map/handler/tap_recognizer.js +107 -0
- package/es/map/handler/tap_zoom.d.ts +28 -0
- package/es/map/handler/tap_zoom.js +87 -0
- package/es/map/handler/touch_pan.d.ts +40 -0
- package/es/map/handler/touch_pan.js +85 -0
- package/es/map/handler/transform-provider.d.ts +23 -0
- package/es/map/handler/transform-provider.js +35 -0
- package/es/map/handler/two_fingers_touch.d.ts +107 -0
- package/es/map/handler/two_fingers_touch.js +289 -0
- package/es/map/handler_inertia.d.ts +20 -0
- package/es/{handler → map}/handler_inertia.js +36 -50
- package/es/map/handler_manager.d.ts +154 -0
- package/es/map/handler_manager.js +466 -0
- package/es/map/map.d.ts +625 -0
- package/es/map/map.js +972 -0
- package/es/map/util/abort_error.d.ts +15 -0
- package/es/map/util/abort_error.js +21 -0
- package/es/map/util/browser.d.ts +10 -0
- package/es/map/util/browser.js +30 -0
- package/es/map/util/dom.d.ts +30 -0
- package/es/map/util/dom.js +105 -0
- package/es/map/util/evented.d.ts +75 -0
- package/es/map/util/evented.js +158 -0
- package/es/map/util/task_queue.d.ts +18 -0
- package/es/map/util/task_queue.js +54 -0
- package/es/map/util/util.d.ts +104 -0
- package/es/map/util/util.js +155 -0
- package/lib/index.d.ts +3 -4
- package/lib/index.js +12 -42
- package/lib/map/camera.d.ts +690 -0
- package/lib/map/camera.js +1145 -0
- package/{es → lib/map}/css/l7.css +41 -7
- package/lib/map/events.d.ts +384 -0
- package/lib/map/events.js +231 -0
- package/lib/map/geo/edge_insets.d.ts +97 -0
- package/lib/{geo → map/geo}/edge_insets.js +56 -35
- package/lib/map/geo/lng_lat.d.ts +116 -0
- package/lib/map/geo/lng_lat.js +166 -0
- package/lib/map/geo/lng_lat_bounds.d.ts +217 -0
- package/lib/map/geo/lng_lat_bounds.js +341 -0
- package/lib/map/geo/mercator_coordinate.d.ts +113 -0
- package/lib/map/geo/mercator_coordinate.js +157 -0
- package/lib/map/geo/transform.d.ts +262 -0
- package/lib/map/geo/transform.js +744 -0
- package/{es → lib/map}/handler/box_zoom.d.ts +30 -24
- package/lib/map/handler/box_zoom.js +153 -0
- package/lib/map/handler/click_zoom.d.ts +24 -0
- package/lib/map/handler/click_zoom.js +54 -0
- package/lib/map/handler/cooperative_gestures.d.ts +40 -0
- package/lib/map/handler/cooperative_gestures.js +101 -0
- package/lib/map/handler/drag_handler.d.ts +88 -0
- package/lib/map/handler/drag_handler.js +97 -0
- package/lib/map/handler/drag_move_state_manager.d.ts +30 -0
- package/lib/map/handler/drag_move_state_manager.js +103 -0
- package/lib/map/handler/handler_util.d.ts +3 -0
- package/lib/{handler → map/handler}/handler_util.js +1 -2
- package/lib/map/handler/keyboard.d.ts +88 -0
- package/lib/map/handler/keyboard.js +205 -0
- package/lib/map/handler/map_event.d.ts +46 -0
- package/lib/map/handler/map_event.js +140 -0
- package/lib/map/handler/mouse.d.ts +30 -0
- package/lib/map/handler/mouse.js +93 -0
- package/lib/map/handler/one_finger_touch_drag.d.ts +15 -0
- package/lib/map/handler/one_finger_touch_drag.js +47 -0
- package/lib/map/handler/scroll_zoom.d.ts +102 -0
- package/lib/map/handler/scroll_zoom.js +320 -0
- package/lib/{handler → map/handler}/shim/dblclick_zoom.d.ts +14 -10
- package/lib/{handler → map/handler}/shim/dblclick_zoom.js +21 -17
- package/lib/map/handler/shim/drag_pan.d.ts +79 -0
- package/lib/map/handler/shim/drag_pan.js +85 -0
- package/lib/{handler → map/handler}/shim/drag_rotate.d.ts +24 -16
- package/lib/map/handler/shim/drag_rotate.js +74 -0
- package/lib/map/handler/shim/two_fingers_touch.d.ts +74 -0
- package/lib/map/handler/shim/two_fingers_touch.js +114 -0
- package/lib/map/handler/tap_drag_zoom.d.ts +28 -0
- package/lib/map/handler/tap_drag_zoom.js +99 -0
- package/lib/map/handler/tap_recognizer.d.ts +35 -0
- package/lib/map/handler/tap_recognizer.js +116 -0
- package/lib/map/handler/tap_zoom.d.ts +28 -0
- package/lib/map/handler/tap_zoom.js +94 -0
- package/lib/map/handler/touch_pan.d.ts +40 -0
- package/lib/map/handler/touch_pan.js +92 -0
- package/lib/map/handler/transform-provider.d.ts +23 -0
- package/lib/map/handler/transform-provider.js +43 -0
- package/lib/map/handler/two_fingers_touch.d.ts +107 -0
- package/lib/map/handler/two_fingers_touch.js +296 -0
- package/lib/map/handler_inertia.d.ts +20 -0
- package/lib/{handler → map}/handler_inertia.js +38 -53
- package/lib/map/handler_manager.d.ts +154 -0
- package/lib/map/handler_manager.js +474 -0
- package/lib/map/map.d.ts +625 -0
- package/lib/map/map.js +979 -0
- package/lib/map/util/abort_error.d.ts +15 -0
- package/lib/map/util/abort_error.js +29 -0
- package/lib/map/util/browser.d.ts +10 -0
- package/lib/map/util/browser.js +36 -0
- package/lib/map/util/dom.d.ts +30 -0
- package/lib/map/util/dom.js +113 -0
- package/lib/map/util/evented.d.ts +75 -0
- package/lib/map/util/evented.js +167 -0
- package/lib/map/util/task_queue.d.ts +18 -0
- package/lib/map/util/task_queue.js +62 -0
- package/lib/map/util/util.d.ts +104 -0
- package/lib/map/util/util.js +171 -0
- package/package.json +6 -3
- package/es/camera.d.ts +0 -86
- package/es/camera.js +0 -639
- package/es/earthmap.d.ts +0 -69
- package/es/earthmap.js +0 -445
- package/es/geo/edge_insets.d.ts +0 -54
- package/es/geo/lng_lat.d.ts +0 -18
- package/es/geo/lng_lat.js +0 -59
- package/es/geo/lng_lat_bounds.d.ts +0 -25
- package/es/geo/lng_lat_bounds.js +0 -118
- package/es/geo/mercator.d.ts +0 -30
- package/es/geo/mercator.js +0 -72
- package/es/geo/point.d.ts +0 -40
- package/es/geo/point.js +0 -153
- package/es/geo/simple.d.ts +0 -30
- package/es/geo/simple.js +0 -75
- package/es/geo/transform.d.ts +0 -198
- package/es/geo/transform.js +0 -895
- package/es/handler/IHandler.d.ts +0 -34
- package/es/handler/IHandler.js +0 -1
- package/es/handler/blockable_map_event.d.ts +0 -17
- package/es/handler/blockable_map_event.js +0 -58
- package/es/handler/box_zoom.js +0 -162
- package/es/handler/click_zoom.d.ts +0 -16
- package/es/handler/click_zoom.js +0 -40
- package/es/handler/events/event.d.ts +0 -4
- package/es/handler/events/event.js +0 -12
- package/es/handler/events/index.d.ts +0 -4
- package/es/handler/events/index.js +0 -4
- package/es/handler/events/map_mouse_event.d.ts +0 -34
- package/es/handler/events/map_mouse_event.js +0 -45
- package/es/handler/events/map_touch_event.d.ts +0 -57
- package/es/handler/events/map_touch_event.js +0 -75
- package/es/handler/events/map_wheel_event.d.ts +0 -33
- package/es/handler/events/map_wheel_event.js +0 -33
- package/es/handler/events/render_event.d.ts +0 -6
- package/es/handler/events/render_event.js +0 -10
- package/es/handler/handler_inertia.d.ts +0 -23
- package/es/handler/handler_manager.d.ts +0 -61
- package/es/handler/handler_manager.js +0 -487
- package/es/handler/handler_util.d.ts +0 -4
- package/es/handler/keyboard.d.ts +0 -36
- package/es/handler/keyboard.js +0 -131
- package/es/handler/map_event.d.ts +0 -29
- package/es/handler/map_event.js +0 -89
- package/es/handler/mouse/index.d.ts +0 -4
- package/es/handler/mouse/index.js +0 -4
- package/es/handler/mouse/mouse_handler.d.ts +0 -22
- package/es/handler/mouse/mouse_handler.js +0 -99
- package/es/handler/mouse/mousepan_handler.d.ts +0 -10
- package/es/handler/mouse/mousepan_handler.js +0 -21
- package/es/handler/mouse/mousepitch_hander.d.ts +0 -9
- package/es/handler/mouse/mousepitch_hander.js +0 -24
- package/es/handler/mouse/mouserotate_hander.d.ts +0 -9
- package/es/handler/mouse/mouserotate_hander.js +0 -24
- package/es/handler/mouse/util.d.ts +0 -6
- package/es/handler/mouse/util.js +0 -12
- package/es/handler/scroll_zoom.d.ts +0 -93
- package/es/handler/scroll_zoom.js +0 -315
- package/es/handler/shim/drag_pan.d.ts +0 -61
- package/es/handler/shim/drag_pan.js +0 -75
- package/es/handler/shim/drag_rotate.js +0 -64
- package/es/handler/shim/touch_zoom_rotate.d.ts +0 -70
- package/es/handler/shim/touch_zoom_rotate.js +0 -104
- package/es/handler/tap/single_tap_recognizer.d.ts +0 -20
- package/es/handler/tap/single_tap_recognizer.js +0 -77
- package/es/handler/tap/tap_drag_zoom.d.ts +0 -22
- package/es/handler/tap/tap_drag_zoom.js +0 -89
- package/es/handler/tap/tap_recognizer.d.ts +0 -17
- package/es/handler/tap/tap_recognizer.js +0 -46
- package/es/handler/tap/tap_zoom.d.ts +0 -22
- package/es/handler/tap/tap_zoom.js +0 -81
- package/es/handler/touch/index.d.ts +0 -5
- package/es/handler/touch/index.js +0 -5
- package/es/handler/touch/touch_pan.d.ts +0 -30
- package/es/handler/touch/touch_pan.js +0 -91
- package/es/handler/touch/touch_pitch.d.ts +0 -13
- package/es/handler/touch/touch_pitch.js +0 -75
- package/es/handler/touch/touch_rotate.d.ts +0 -12
- package/es/handler/touch/touch_rotate.js +0 -57
- package/es/handler/touch/touch_zoom.d.ts +0 -12
- package/es/handler/touch/touch_zoom.js +0 -37
- package/es/handler/touch/two_touch.d.ts +0 -23
- package/es/handler/touch/two_touch.js +0 -98
- package/es/hash.d.ts +0 -14
- package/es/hash.js +0 -121
- package/es/interface.d.ts +0 -34
- package/es/interface.js +0 -1
- package/es/map.d.ts +0 -70
- package/es/map.js +0 -472
- package/es/util.d.ts +0 -25
- package/es/util.js +0 -70
- package/es/utils/Aabb.d.ts +0 -12
- package/es/utils/Aabb.js +0 -72
- package/es/utils/dom.d.ts +0 -4
- package/es/utils/dom.js +0 -117
- package/es/utils/performance.d.ts +0 -17
- package/es/utils/performance.js +0 -58
- package/es/utils/primitives.d.ts +0 -6
- package/es/utils/primitives.js +0 -37
- package/es/utils/task_queue.d.ts +0 -13
- package/es/utils/task_queue.js +0 -60
- package/lib/camera.d.ts +0 -86
- package/lib/camera.js +0 -648
- package/lib/earthmap.d.ts +0 -69
- package/lib/earthmap.js +0 -451
- package/lib/geo/edge_insets.d.ts +0 -54
- package/lib/geo/lng_lat.d.ts +0 -18
- package/lib/geo/lng_lat.js +0 -67
- package/lib/geo/lng_lat_bounds.d.ts +0 -25
- package/lib/geo/lng_lat_bounds.js +0 -126
- package/lib/geo/mercator.d.ts +0 -30
- package/lib/geo/mercator.js +0 -88
- package/lib/geo/point.d.ts +0 -40
- package/lib/geo/point.js +0 -161
- package/lib/geo/simple.d.ts +0 -30
- package/lib/geo/simple.js +0 -92
- package/lib/geo/transform.d.ts +0 -198
- package/lib/geo/transform.js +0 -906
- package/lib/handler/IHandler.d.ts +0 -34
- package/lib/handler/IHandler.js +0 -5
- package/lib/handler/blockable_map_event.d.ts +0 -17
- package/lib/handler/blockable_map_event.js +0 -66
- package/lib/handler/box_zoom.js +0 -168
- package/lib/handler/click_zoom.d.ts +0 -16
- package/lib/handler/click_zoom.js +0 -48
- package/lib/handler/events/event.d.ts +0 -4
- package/lib/handler/events/event.js +0 -20
- package/lib/handler/events/index.d.ts +0 -4
- package/lib/handler/events/index.js +0 -27
- package/lib/handler/events/map_mouse_event.d.ts +0 -34
- package/lib/handler/events/map_mouse_event.js +0 -53
- package/lib/handler/events/map_touch_event.d.ts +0 -57
- package/lib/handler/events/map_touch_event.js +0 -83
- package/lib/handler/events/map_wheel_event.d.ts +0 -33
- package/lib/handler/events/map_wheel_event.js +0 -41
- package/lib/handler/events/render_event.d.ts +0 -6
- package/lib/handler/events/render_event.js +0 -18
- package/lib/handler/handler_inertia.d.ts +0 -23
- package/lib/handler/handler_manager.d.ts +0 -61
- package/lib/handler/handler_manager.js +0 -495
- package/lib/handler/handler_util.d.ts +0 -4
- package/lib/handler/keyboard.d.ts +0 -36
- package/lib/handler/keyboard.js +0 -138
- package/lib/handler/map_event.d.ts +0 -29
- package/lib/handler/map_event.js +0 -97
- package/lib/handler/mouse/index.d.ts +0 -4
- package/lib/handler/mouse/index.js +0 -27
- package/lib/handler/mouse/mouse_handler.d.ts +0 -22
- package/lib/handler/mouse/mouse_handler.js +0 -107
- package/lib/handler/mouse/mousepan_handler.d.ts +0 -10
- package/lib/handler/mouse/mousepan_handler.js +0 -29
- package/lib/handler/mouse/mousepitch_hander.d.ts +0 -9
- package/lib/handler/mouse/mousepitch_hander.js +0 -32
- package/lib/handler/mouse/mouserotate_hander.d.ts +0 -9
- package/lib/handler/mouse/mouserotate_hander.js +0 -32
- package/lib/handler/mouse/util.d.ts +0 -6
- package/lib/handler/mouse/util.js +0 -19
- package/lib/handler/scroll_zoom.d.ts +0 -93
- package/lib/handler/scroll_zoom.js +0 -322
- package/lib/handler/shim/drag_pan.d.ts +0 -61
- package/lib/handler/shim/drag_pan.js +0 -83
- package/lib/handler/shim/drag_rotate.js +0 -72
- package/lib/handler/shim/touch_zoom_rotate.d.ts +0 -70
- package/lib/handler/shim/touch_zoom_rotate.js +0 -112
- package/lib/handler/tap/single_tap_recognizer.d.ts +0 -20
- package/lib/handler/tap/single_tap_recognizer.js +0 -86
- package/lib/handler/tap/tap_drag_zoom.d.ts +0 -22
- package/lib/handler/tap/tap_drag_zoom.js +0 -97
- package/lib/handler/tap/tap_recognizer.d.ts +0 -17
- package/lib/handler/tap/tap_recognizer.js +0 -56
- package/lib/handler/tap/tap_zoom.d.ts +0 -22
- package/lib/handler/tap/tap_zoom.js +0 -89
- package/lib/handler/touch/index.d.ts +0 -5
- package/lib/handler/touch/index.js +0 -34
- package/lib/handler/touch/touch_pan.d.ts +0 -30
- package/lib/handler/touch/touch_pan.js +0 -100
- package/lib/handler/touch/touch_pitch.d.ts +0 -13
- package/lib/handler/touch/touch_pitch.js +0 -83
- package/lib/handler/touch/touch_rotate.d.ts +0 -12
- package/lib/handler/touch/touch_rotate.js +0 -65
- package/lib/handler/touch/touch_zoom.d.ts +0 -12
- package/lib/handler/touch/touch_zoom.js +0 -45
- package/lib/handler/touch/two_touch.d.ts +0 -23
- package/lib/handler/touch/two_touch.js +0 -106
- package/lib/hash.d.ts +0 -14
- package/lib/hash.js +0 -129
- package/lib/interface.d.ts +0 -34
- package/lib/interface.js +0 -5
- package/lib/map.d.ts +0 -70
- package/lib/map.js +0 -478
- package/lib/util.d.ts +0 -25
- package/lib/util.js +0 -89
- package/lib/utils/Aabb.d.ts +0 -12
- package/lib/utils/Aabb.js +0 -80
- package/lib/utils/dom.d.ts +0 -4
- package/lib/utils/dom.js +0 -125
- package/lib/utils/performance.d.ts +0 -17
- package/lib/utils/performance.js +0 -64
- package/lib/utils/primitives.d.ts +0 -6
- package/lib/utils/primitives.js +0 -45
- package/lib/utils/task_queue.d.ts +0 -13
- package/lib/utils/task_queue.js +0 -67
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var _lng_lat = _interopRequireDefault(require("./lng_lat"));
|
|
10
|
-
class LngLatBounds {
|
|
11
|
-
static convert(input) {
|
|
12
|
-
if (input instanceof LngLatBounds) {
|
|
13
|
-
return input;
|
|
14
|
-
}
|
|
15
|
-
return new LngLatBounds(input);
|
|
16
|
-
}
|
|
17
|
-
constructor(sw, ne) {
|
|
18
|
-
(0, _defineProperty2.default)(this, "ne", void 0);
|
|
19
|
-
(0, _defineProperty2.default)(this, "sw", void 0);
|
|
20
|
-
if (!sw) {
|
|
21
|
-
// noop
|
|
22
|
-
} else if (ne) {
|
|
23
|
-
this.setSouthWest(sw).setNorthEast(ne);
|
|
24
|
-
} else if (sw.length === 4) {
|
|
25
|
-
this.setSouthWest([sw[0], sw[1]]).setNorthEast([sw[2], sw[3]]);
|
|
26
|
-
} else {
|
|
27
|
-
this.setSouthWest(sw[0]).setNorthEast(sw[1]);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
setNorthEast(ne) {
|
|
31
|
-
this.ne = ne instanceof _lng_lat.default ? new _lng_lat.default(ne.lng, ne.lat) : _lng_lat.default.convert(ne);
|
|
32
|
-
return this;
|
|
33
|
-
}
|
|
34
|
-
setSouthWest(sw) {
|
|
35
|
-
this.sw = sw instanceof _lng_lat.default ? new _lng_lat.default(sw.lng, sw.lat) : _lng_lat.default.convert(sw);
|
|
36
|
-
return this;
|
|
37
|
-
}
|
|
38
|
-
extend(obj) {
|
|
39
|
-
const sw = this.sw;
|
|
40
|
-
const ne = this.ne;
|
|
41
|
-
let sw2;
|
|
42
|
-
let ne2;
|
|
43
|
-
if (obj instanceof _lng_lat.default) {
|
|
44
|
-
sw2 = obj;
|
|
45
|
-
ne2 = obj;
|
|
46
|
-
} else if (obj instanceof LngLatBounds) {
|
|
47
|
-
sw2 = obj.sw;
|
|
48
|
-
ne2 = obj.ne;
|
|
49
|
-
if (!sw2 || !ne2) {
|
|
50
|
-
return this;
|
|
51
|
-
}
|
|
52
|
-
} else {
|
|
53
|
-
if (Array.isArray(obj)) {
|
|
54
|
-
// @ts-ignore
|
|
55
|
-
if (obj.length === 4 || obj.every(Array.isArray)) {
|
|
56
|
-
const lngLatBoundsObj = obj;
|
|
57
|
-
return this.extend(LngLatBounds.convert(lngLatBoundsObj));
|
|
58
|
-
} else {
|
|
59
|
-
const lngLatObj = obj;
|
|
60
|
-
return this.extend(_lng_lat.default.convert(lngLatObj));
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
return this;
|
|
64
|
-
}
|
|
65
|
-
if (!sw && !ne) {
|
|
66
|
-
this.sw = new _lng_lat.default(sw2.lng, sw2.lat);
|
|
67
|
-
this.ne = new _lng_lat.default(ne2.lng, ne2.lat);
|
|
68
|
-
} else {
|
|
69
|
-
sw.lng = Math.min(sw2.lng, sw.lng);
|
|
70
|
-
sw.lat = Math.min(sw2.lat, sw.lat);
|
|
71
|
-
ne.lng = Math.max(ne2.lng, ne.lng);
|
|
72
|
-
ne.lat = Math.max(ne2.lat, ne.lat);
|
|
73
|
-
}
|
|
74
|
-
return this;
|
|
75
|
-
}
|
|
76
|
-
getCenter() {
|
|
77
|
-
return new _lng_lat.default((this.sw.lng + this.ne.lng) / 2, (this.sw.lat + this.ne.lat) / 2);
|
|
78
|
-
}
|
|
79
|
-
getSouthWest() {
|
|
80
|
-
return this.sw;
|
|
81
|
-
}
|
|
82
|
-
getNorthEast() {
|
|
83
|
-
return this.ne;
|
|
84
|
-
}
|
|
85
|
-
getNorthWest() {
|
|
86
|
-
return new _lng_lat.default(this.getWest(), this.getNorth());
|
|
87
|
-
}
|
|
88
|
-
getSouthEast() {
|
|
89
|
-
return new _lng_lat.default(this.getEast(), this.getSouth());
|
|
90
|
-
}
|
|
91
|
-
getWest() {
|
|
92
|
-
return this.sw.lng;
|
|
93
|
-
}
|
|
94
|
-
getSouth() {
|
|
95
|
-
return this.sw.lat;
|
|
96
|
-
}
|
|
97
|
-
getEast() {
|
|
98
|
-
return this.ne.lng;
|
|
99
|
-
}
|
|
100
|
-
getNorth() {
|
|
101
|
-
return this.ne.lat;
|
|
102
|
-
}
|
|
103
|
-
toArray() {
|
|
104
|
-
return [this.sw.toArray(), this.ne.toArray()];
|
|
105
|
-
}
|
|
106
|
-
toString() {
|
|
107
|
-
return `LngLatBounds(${this.sw.toString()}, ${this.ne.toString()})`;
|
|
108
|
-
}
|
|
109
|
-
isEmpty() {
|
|
110
|
-
return !(this.sw && this.ne);
|
|
111
|
-
}
|
|
112
|
-
contains(lnglat) {
|
|
113
|
-
const {
|
|
114
|
-
lng,
|
|
115
|
-
lat
|
|
116
|
-
} = _lng_lat.default.convert(lnglat);
|
|
117
|
-
const containsLatitude = this.sw.lat <= lat && lat <= this.ne.lat;
|
|
118
|
-
let containsLongitude = this.sw.lng <= lng && lng <= this.ne.lng;
|
|
119
|
-
if (this.sw.lng > this.ne.lng) {
|
|
120
|
-
// wrapped coordinates
|
|
121
|
-
containsLongitude = this.sw.lng >= lng && lng >= this.ne.lng;
|
|
122
|
-
}
|
|
123
|
-
return containsLatitude && containsLongitude;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
exports.default = LngLatBounds;
|
package/lib/geo/mercator.d.ts
DELETED
|
@@ -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 };
|
package/lib/geo/mercator.js
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.MercatorCoordinate = void 0;
|
|
8
|
-
exports.altitudeFromMercatorZ = altitudeFromMercatorZ;
|
|
9
|
-
exports.default = void 0;
|
|
10
|
-
exports.latFromMercatorY = latFromMercatorY;
|
|
11
|
-
exports.lngFromMercatorX = lngFromMercatorX;
|
|
12
|
-
exports.mercatorScale = mercatorScale;
|
|
13
|
-
exports.mercatorXfromLng = mercatorXfromLng;
|
|
14
|
-
exports.mercatorYfromLat = mercatorYfromLat;
|
|
15
|
-
exports.mercatorZfromAltitude = mercatorZfromAltitude;
|
|
16
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
17
|
-
var _lng_lat = _interopRequireWildcard(require("../geo/lng_lat"));
|
|
18
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
19
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
20
|
-
/*
|
|
21
|
-
* The average circumference of the world in meters.
|
|
22
|
-
*/
|
|
23
|
-
const earthCircumfrence = 2 * Math.PI * _lng_lat.earthRadius; // meters
|
|
24
|
-
|
|
25
|
-
/*
|
|
26
|
-
* The circumference at a line of latitude in meters.
|
|
27
|
-
*/
|
|
28
|
-
function circumferenceAtLatitude(latitude) {
|
|
29
|
-
return earthCircumfrence * Math.cos(latitude * Math.PI / 180);
|
|
30
|
-
}
|
|
31
|
-
function mercatorXfromLng(lng) {
|
|
32
|
-
return (180 + lng) / 360;
|
|
33
|
-
}
|
|
34
|
-
function mercatorYfromLat(lat) {
|
|
35
|
-
return (180 - 180 / Math.PI * Math.log(Math.tan(Math.PI / 4 + lat * Math.PI / 360))) / 360;
|
|
36
|
-
}
|
|
37
|
-
function mercatorZfromAltitude(altitude, lat) {
|
|
38
|
-
return altitude / circumferenceAtLatitude(lat);
|
|
39
|
-
}
|
|
40
|
-
function lngFromMercatorX(x) {
|
|
41
|
-
return x * 360 - 180;
|
|
42
|
-
}
|
|
43
|
-
function latFromMercatorY(y) {
|
|
44
|
-
const y2 = 180 - y * 360;
|
|
45
|
-
return 360 / Math.PI * Math.atan(Math.exp(y2 * Math.PI / 180)) - 90;
|
|
46
|
-
}
|
|
47
|
-
function altitudeFromMercatorZ(z, y) {
|
|
48
|
-
return z * circumferenceAtLatitude(latFromMercatorY(y));
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Determine the Mercator scale factor for a given latitude, see
|
|
53
|
-
* https://en.wikipedia.org/wiki/Mercator_projection#Scale_factor
|
|
54
|
-
*
|
|
55
|
-
* At the equator the scale factor will be 1, which increases at higher latitudes.
|
|
56
|
-
*
|
|
57
|
-
* @param {number} lat Latitude
|
|
58
|
-
* @returns {number} scale factor
|
|
59
|
-
* @private
|
|
60
|
-
*/
|
|
61
|
-
function mercatorScale(lat) {
|
|
62
|
-
return 1 / Math.cos(lat * Math.PI / 180);
|
|
63
|
-
}
|
|
64
|
-
class MercatorCoordinate {
|
|
65
|
-
static fromLngLat(lngLatLike, altitude = 0) {
|
|
66
|
-
const lngLat = _lng_lat.default.convert(lngLatLike);
|
|
67
|
-
return new MercatorCoordinate(mercatorXfromLng(lngLat.lng), mercatorYfromLat(lngLat.lat), mercatorZfromAltitude(altitude, lngLat.lat));
|
|
68
|
-
}
|
|
69
|
-
constructor(x, y, z = 0) {
|
|
70
|
-
(0, _defineProperty2.default)(this, "x", void 0);
|
|
71
|
-
(0, _defineProperty2.default)(this, "y", void 0);
|
|
72
|
-
(0, _defineProperty2.default)(this, "z", void 0);
|
|
73
|
-
this.x = +x;
|
|
74
|
-
this.y = +y;
|
|
75
|
-
this.z = +z;
|
|
76
|
-
}
|
|
77
|
-
toLngLat() {
|
|
78
|
-
return new _lng_lat.default(lngFromMercatorX(this.x), latFromMercatorY(this.y));
|
|
79
|
-
}
|
|
80
|
-
toAltitude() {
|
|
81
|
-
return altitudeFromMercatorZ(this.z, this.y);
|
|
82
|
-
}
|
|
83
|
-
meterInMercatorCoordinateUnits() {
|
|
84
|
-
// 1 meter / circumference at equator in meters * Mercator projection scale factor at this latitude
|
|
85
|
-
return 1 / earthCircumfrence * mercatorScale(latFromMercatorY(this.y));
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
exports.MercatorCoordinate = exports.default = MercatorCoordinate;
|
package/lib/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/lib/geo/point.js
DELETED
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
class Point {
|
|
10
|
-
static convert(a) {
|
|
11
|
-
if (a instanceof Point) {
|
|
12
|
-
return a;
|
|
13
|
-
}
|
|
14
|
-
if (Array.isArray(a)) {
|
|
15
|
-
return new Point(a[0], a[1]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
}
|
|
19
|
-
constructor(x, y) {
|
|
20
|
-
(0, _defineProperty2.default)(this, "x", void 0);
|
|
21
|
-
(0, _defineProperty2.default)(this, "y", void 0);
|
|
22
|
-
this.x = x;
|
|
23
|
-
this.y = y;
|
|
24
|
-
}
|
|
25
|
-
clone() {
|
|
26
|
-
return new Point(this.x, this.y);
|
|
27
|
-
}
|
|
28
|
-
_add(p) {
|
|
29
|
-
this.x += p.x;
|
|
30
|
-
this.y += p.y;
|
|
31
|
-
return this;
|
|
32
|
-
}
|
|
33
|
-
add(p) {
|
|
34
|
-
return this.clone()._add(p);
|
|
35
|
-
}
|
|
36
|
-
_sub(p) {
|
|
37
|
-
this.x -= p.x;
|
|
38
|
-
this.y -= p.y;
|
|
39
|
-
return this;
|
|
40
|
-
}
|
|
41
|
-
sub(p) {
|
|
42
|
-
return this.clone()._sub(p);
|
|
43
|
-
}
|
|
44
|
-
_multByPoint(p) {
|
|
45
|
-
this.x *= p.x;
|
|
46
|
-
this.y *= p.y;
|
|
47
|
-
return this;
|
|
48
|
-
}
|
|
49
|
-
multByPoint(p) {
|
|
50
|
-
return this.clone()._multByPoint(p);
|
|
51
|
-
}
|
|
52
|
-
_divByPoint(p) {
|
|
53
|
-
this.x /= p.x;
|
|
54
|
-
this.y /= p.y;
|
|
55
|
-
return this;
|
|
56
|
-
}
|
|
57
|
-
divByPoint(p) {
|
|
58
|
-
return this.clone()._divByPoint(p);
|
|
59
|
-
}
|
|
60
|
-
_mult(k) {
|
|
61
|
-
this.x *= k;
|
|
62
|
-
this.y *= k;
|
|
63
|
-
return this;
|
|
64
|
-
}
|
|
65
|
-
mult(k) {
|
|
66
|
-
return this.clone()._mult(k);
|
|
67
|
-
}
|
|
68
|
-
_div(k) {
|
|
69
|
-
this.x /= k;
|
|
70
|
-
this.y /= k;
|
|
71
|
-
return this;
|
|
72
|
-
}
|
|
73
|
-
div(k) {
|
|
74
|
-
return this.clone()._div(k);
|
|
75
|
-
}
|
|
76
|
-
_rotate(angle) {
|
|
77
|
-
const cos = Math.cos(angle);
|
|
78
|
-
const sin = Math.sin(angle);
|
|
79
|
-
const x = cos * this.x - sin * this.y;
|
|
80
|
-
const y = sin * this.x + cos * this.y;
|
|
81
|
-
this.x = x;
|
|
82
|
-
this.y = y;
|
|
83
|
-
return this;
|
|
84
|
-
}
|
|
85
|
-
rotate(angle) {
|
|
86
|
-
return this.clone()._rotate(angle);
|
|
87
|
-
}
|
|
88
|
-
_rotateAround(angle, p) {
|
|
89
|
-
const cos = Math.cos(angle);
|
|
90
|
-
const sin = Math.sin(angle);
|
|
91
|
-
const x = p.x + cos * (this.x - p.x) - sin * (this.y - p.y);
|
|
92
|
-
const y = p.y + sin * (this.x - p.x) + cos * (this.y - p.y);
|
|
93
|
-
this.x = x;
|
|
94
|
-
this.y = y;
|
|
95
|
-
return this;
|
|
96
|
-
}
|
|
97
|
-
roateAround(angle, p) {
|
|
98
|
-
return this.clone()._rotateAround(angle, p);
|
|
99
|
-
}
|
|
100
|
-
_matMult(m) {
|
|
101
|
-
const x = m[0] * this.x + m[1] * this.y;
|
|
102
|
-
const y = m[2] * this.x + m[3] * this.y;
|
|
103
|
-
this.x = x;
|
|
104
|
-
this.y = y;
|
|
105
|
-
return this;
|
|
106
|
-
}
|
|
107
|
-
matMult(m) {
|
|
108
|
-
return this.clone()._matMult(m);
|
|
109
|
-
}
|
|
110
|
-
_unit() {
|
|
111
|
-
this.div(this.mag());
|
|
112
|
-
return this;
|
|
113
|
-
}
|
|
114
|
-
unit() {
|
|
115
|
-
return this.clone()._unit();
|
|
116
|
-
}
|
|
117
|
-
_perp() {
|
|
118
|
-
const y = this.y;
|
|
119
|
-
this.y = this.x;
|
|
120
|
-
this.x = -y;
|
|
121
|
-
return this;
|
|
122
|
-
}
|
|
123
|
-
perp() {
|
|
124
|
-
return this.clone()._perp();
|
|
125
|
-
}
|
|
126
|
-
_round() {
|
|
127
|
-
this.x = Math.round(this.x);
|
|
128
|
-
this.y = Math.round(this.y);
|
|
129
|
-
return this;
|
|
130
|
-
}
|
|
131
|
-
round() {
|
|
132
|
-
return this.clone()._round();
|
|
133
|
-
}
|
|
134
|
-
mag() {
|
|
135
|
-
return Math.sqrt(this.x * this.x + this.y * this.y);
|
|
136
|
-
}
|
|
137
|
-
equals(other) {
|
|
138
|
-
return this.x === other.x && this.y === other.y;
|
|
139
|
-
}
|
|
140
|
-
dist(p) {
|
|
141
|
-
return Math.sqrt(this.distSqr(p));
|
|
142
|
-
}
|
|
143
|
-
distSqr(p) {
|
|
144
|
-
const dx = p.x - this.x;
|
|
145
|
-
const dy = p.y - this.y;
|
|
146
|
-
return dx * dx + dy * dy;
|
|
147
|
-
}
|
|
148
|
-
angle() {
|
|
149
|
-
return Math.atan2(this.y, this.x);
|
|
150
|
-
}
|
|
151
|
-
angleTo(b) {
|
|
152
|
-
return Math.atan2(this.y - b.y, this.x - b.x);
|
|
153
|
-
}
|
|
154
|
-
angleWith(b) {
|
|
155
|
-
return this.angleWithSep(b.x, b.y);
|
|
156
|
-
}
|
|
157
|
-
angleWithSep(x, y) {
|
|
158
|
-
return Math.atan2(this.x * y - this.y * x, this.x * x + this.y * y);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
exports.default = Point;
|
package/lib/geo/simple.d.ts
DELETED
|
@@ -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/lib/geo/simple.js
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.altitudeFromMercatorZ = altitudeFromMercatorZ;
|
|
8
|
-
exports.circumferenceAtLatitude = circumferenceAtLatitude;
|
|
9
|
-
exports.default = void 0;
|
|
10
|
-
exports.latFromMercatorY = latFromMercatorY;
|
|
11
|
-
exports.lngFromMercatorX = lngFromMercatorX;
|
|
12
|
-
exports.mercatorScale = mercatorScale;
|
|
13
|
-
exports.mercatorXfromLng = mercatorXfromLng;
|
|
14
|
-
exports.mercatorYfromLat = mercatorYfromLat;
|
|
15
|
-
exports.mercatorZfromAltitude = mercatorZfromAltitude;
|
|
16
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
17
|
-
var _lng_lat = _interopRequireWildcard(require("../geo/lng_lat"));
|
|
18
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
19
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
20
|
-
/*
|
|
21
|
-
* The average circumference of the world in meters.
|
|
22
|
-
*/
|
|
23
|
-
const earthCircumfrence = 2 * Math.PI * _lng_lat.earthRadius; // meters
|
|
24
|
-
|
|
25
|
-
/*
|
|
26
|
-
* The circumference at a line of latitude in meters.
|
|
27
|
-
*/
|
|
28
|
-
function circumferenceAtLatitude(latitude) {
|
|
29
|
-
return earthCircumfrence * Math.cos(latitude * Math.PI / 180);
|
|
30
|
-
}
|
|
31
|
-
function mercatorXfromLng(lng) {
|
|
32
|
-
return lng;
|
|
33
|
-
}
|
|
34
|
-
function mercatorYfromLat(lat) {
|
|
35
|
-
return lat;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
39
|
-
function mercatorZfromAltitude(altitude, lat) {
|
|
40
|
-
return altitude;
|
|
41
|
-
}
|
|
42
|
-
function lngFromMercatorX(x) {
|
|
43
|
-
return x;
|
|
44
|
-
}
|
|
45
|
-
function latFromMercatorY(y) {
|
|
46
|
-
return y;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
50
|
-
function altitudeFromMercatorZ(z, y) {
|
|
51
|
-
return z;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Determine the Mercator scale factor for a given latitude, see
|
|
56
|
-
* https://en.wikipedia.org/wiki/Mercator_projection#Scale_factor
|
|
57
|
-
*
|
|
58
|
-
* At the equator the scale factor will be 1, which increases at higher latitudes.
|
|
59
|
-
*
|
|
60
|
-
* @param {number} lat Latitude
|
|
61
|
-
* @returns {number} scale factor
|
|
62
|
-
* @private
|
|
63
|
-
*/
|
|
64
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
65
|
-
function mercatorScale(lat) {
|
|
66
|
-
return 1;
|
|
67
|
-
}
|
|
68
|
-
class SimpleCoordinate {
|
|
69
|
-
static fromLngLat(lngLatLike, altitude = 0) {
|
|
70
|
-
const lngLat = _lng_lat.default.convert(lngLatLike);
|
|
71
|
-
return new SimpleCoordinate(mercatorXfromLng(lngLat.lng), mercatorYfromLat(lngLat.lat), mercatorZfromAltitude(altitude, lngLat.lat));
|
|
72
|
-
}
|
|
73
|
-
constructor(x, y, z = 0) {
|
|
74
|
-
(0, _defineProperty2.default)(this, "x", void 0);
|
|
75
|
-
(0, _defineProperty2.default)(this, "y", void 0);
|
|
76
|
-
(0, _defineProperty2.default)(this, "z", void 0);
|
|
77
|
-
this.x = +x;
|
|
78
|
-
this.y = +y;
|
|
79
|
-
this.z = +z;
|
|
80
|
-
}
|
|
81
|
-
toLngLat() {
|
|
82
|
-
return new _lng_lat.default(this.x, this.y);
|
|
83
|
-
}
|
|
84
|
-
toAltitude() {
|
|
85
|
-
return this.z;
|
|
86
|
-
}
|
|
87
|
-
meterInMercatorCoordinateUnits() {
|
|
88
|
-
// 1 meter / circumference at equator in meters * Mercator projection scale factor at this latitude
|
|
89
|
-
return 1;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
exports.default = SimpleCoordinate;
|