@antv/l7-map 2.17.12 → 2.18.2
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/package.json +4 -4
- package/es/camera.d.ts +0 -85
- package/es/camera.js +0 -775
- package/es/css/l7.css +0 -98
- package/es/earthmap.d.ts +0 -66
- package/es/earthmap.js +0 -422
- package/es/geo/edge_insets.d.ts +0 -54
- package/es/geo/edge_insets.js +0 -118
- package/es/geo/lng_lat.d.ts +0 -18
- package/es/geo/lng_lat.js +0 -81
- package/es/geo/lng_lat_bounds.d.ts +0 -24
- package/es/geo/lng_lat_bounds.js +0 -167
- package/es/geo/mercator.d.ts +0 -29
- package/es/geo/mercator.js +0 -92
- package/es/geo/point.d.ts +0 -40
- package/es/geo/point.js +0 -231
- package/es/geo/simple.d.ts +0 -29
- package/es/geo/simple.js +0 -92
- package/es/geo/transform.d.ts +0 -198
- package/es/geo/transform.js +0 -971
- 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 -83
- package/es/handler/box_zoom.d.ts +0 -59
- package/es/handler/box_zoom.js +0 -200
- package/es/handler/click_zoom.d.ts +0 -16
- package/es/handler/click_zoom.js +0 -59
- 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 -75
- package/es/handler/events/map_touch_event.d.ts +0 -57
- package/es/handler/events/map_touch_event.js +0 -105
- package/es/handler/events/map_wheel_event.d.ts +0 -33
- package/es/handler/events/map_wheel_event.js +0 -61
- package/es/handler/events/render_event.d.ts +0 -5
- package/es/handler/events/render_event.js +0 -39
- package/es/handler/handler_inertia.d.ts +0 -23
- package/es/handler/handler_inertia.js +0 -184
- package/es/handler/handler_manager.d.ts +0 -61
- package/es/handler/handler_manager.js +0 -684
- package/es/handler/handler_util.d.ts +0 -4
- package/es/handler/handler_util.js +0 -10
- package/es/handler/keyboard.d.ts +0 -36
- package/es/handler/keyboard.js +0 -162
- package/es/handler/map_event.d.ts +0 -29
- package/es/handler/map_event.js +0 -131
- 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 -131
- package/es/handler/mouse/mousepan_handler.d.ts +0 -10
- package/es/handler/mouse/mousepan_handler.js +0 -54
- package/es/handler/mouse/mousepitch_hander.d.ts +0 -9
- package/es/handler/mouse/mousepitch_hander.js +0 -56
- package/es/handler/mouse/mouserotate_hander.d.ts +0 -9
- package/es/handler/mouse/mouserotate_hander.js +0 -56
- 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 -353
- package/es/handler/shim/dblclick_zoom.d.ts +0 -40
- package/es/handler/shim/dblclick_zoom.js +0 -72
- package/es/handler/shim/drag_pan.d.ts +0 -61
- package/es/handler/shim/drag_pan.js +0 -96
- package/es/handler/shim/drag_rotate.d.ts +0 -46
- package/es/handler/shim/drag_rotate.js +0 -80
- package/es/handler/shim/touch_zoom_rotate.d.ts +0 -70
- package/es/handler/shim/touch_zoom_rotate.js +0 -130
- package/es/handler/tap/single_tap_recognizer.d.ts +0 -20
- package/es/handler/tap/single_tap_recognizer.js +0 -120
- package/es/handler/tap/tap_drag_zoom.d.ts +0 -22
- package/es/handler/tap/tap_drag_zoom.js +0 -114
- package/es/handler/tap/tap_recognizer.d.ts +0 -17
- package/es/handler/tap/tap_recognizer.js +0 -62
- package/es/handler/tap/tap_zoom.d.ts +0 -22
- package/es/handler/tap/tap_zoom.js +0 -115
- 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 -128
- package/es/handler/touch/touch_pitch.d.ts +0 -13
- package/es/handler/touch/touch_pitch.js +0 -110
- package/es/handler/touch/touch_rotate.d.ts +0 -12
- package/es/handler/touch/touch_rotate.js +0 -88
- package/es/handler/touch/touch_zoom.d.ts +0 -12
- package/es/handler/touch/touch_zoom.js +0 -67
- package/es/handler/touch/two_touch.d.ts +0 -23
- package/es/handler/touch/two_touch.js +0 -138
- package/es/hash.d.ts +0 -14
- package/es/hash.js +0 -156
- package/es/index.d.ts +0 -4
- package/es/index.js +0 -4
- 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 -464
- package/es/util.d.ts +0 -25
- package/es/util.js +0 -101
- package/es/utils/Aabb.d.ts +0 -12
- package/es/utils/Aabb.js +0 -133
- package/es/utils/dom.d.ts +0 -4
- package/es/utils/dom.js +0 -218
- package/es/utils/performance.d.ts +0 -17
- package/es/utils/performance.js +0 -62
- package/es/utils/primitives.d.ts +0 -6
- package/es/utils/primitives.js +0 -45
- package/es/utils/task_queue.d.ts +0 -13
- package/es/utils/task_queue.js +0 -106
- package/lib/camera.js +0 -801
- package/lib/css/l7.css +0 -98
- package/lib/earthmap.js +0 -445
- package/lib/geo/edge_insets.js +0 -129
- package/lib/geo/lng_lat.js +0 -94
- package/lib/geo/lng_lat_bounds.js +0 -177
- package/lib/geo/mercator.js +0 -121
- package/lib/geo/point.js +0 -239
- package/lib/geo/simple.js +0 -123
- package/lib/geo/transform.js +0 -1013
- package/lib/handler/IHandler.js +0 -5
- package/lib/handler/blockable_map_event.js +0 -92
- package/lib/handler/box_zoom.js +0 -217
- package/lib/handler/click_zoom.js +0 -67
- package/lib/handler/events/event.js +0 -23
- package/lib/handler/events/index.js +0 -31
- package/lib/handler/events/map_mouse_event.js +0 -87
- package/lib/handler/events/map_touch_event.js +0 -119
- package/lib/handler/events/map_wheel_event.js +0 -72
- package/lib/handler/events/render_event.js +0 -52
- package/lib/handler/handler_inertia.js +0 -193
- package/lib/handler/handler_manager.js +0 -714
- package/lib/handler/handler_util.js +0 -17
- package/lib/handler/keyboard.js +0 -172
- package/lib/handler/map_event.js +0 -140
- package/lib/handler/mouse/index.js +0 -31
- package/lib/handler/mouse/mouse_handler.js +0 -141
- package/lib/handler/mouse/mousepan_handler.js +0 -66
- package/lib/handler/mouse/mousepitch_hander.js +0 -67
- package/lib/handler/mouse/mouserotate_hander.js +0 -67
- package/lib/handler/mouse/util.js +0 -26
- package/lib/handler/scroll_zoom.js +0 -367
- package/lib/handler/shim/dblclick_zoom.js +0 -80
- package/lib/handler/shim/drag_pan.js +0 -105
- package/lib/handler/shim/drag_rotate.js +0 -88
- package/lib/handler/shim/touch_zoom_rotate.js +0 -139
- package/lib/handler/tap/single_tap_recognizer.js +0 -131
- package/lib/handler/tap/tap_drag_zoom.js +0 -124
- package/lib/handler/tap/tap_recognizer.js +0 -78
- package/lib/handler/tap/tap_zoom.js +0 -124
- package/lib/handler/touch/index.js +0 -39
- package/lib/handler/touch/touch_pan.js +0 -138
- package/lib/handler/touch/touch_pitch.js +0 -120
- package/lib/handler/touch/touch_rotate.js +0 -99
- package/lib/handler/touch/touch_zoom.js +0 -78
- package/lib/handler/touch/two_touch.js +0 -148
- package/lib/hash.js +0 -169
- package/lib/index.js +0 -57
- package/lib/interface.js +0 -5
- package/lib/map.js +0 -489
- package/lib/util.js +0 -135
- package/lib/utils/Aabb.js +0 -143
- package/lib/utils/dom.js +0 -233
- package/lib/utils/performance.js +0 -72
- package/lib/utils/primitives.js +0 -57
- package/lib/utils/task_queue.js +0 -115
package/es/geo/edge_insets.js
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
-
// @ts-ignore
|
|
4
|
-
import { clamp, interpolate as _interpolate } from "../util";
|
|
5
|
-
import Point from "./point";
|
|
6
|
-
/**
|
|
7
|
-
* An `EdgeInset` object represents screen space padding applied to the edges of the viewport.
|
|
8
|
-
* This shifts the apprent center or the vanishing point of the map. This is useful for adding floating UI elements
|
|
9
|
-
* on top of the map and having the vanishing point shift as UI elements resize.
|
|
10
|
-
*
|
|
11
|
-
* @param {number} [top=0]
|
|
12
|
-
* @param {number} [bottom=0]
|
|
13
|
-
* @param {number} [left=0]
|
|
14
|
-
* @param {number} [right=0]
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
var EdgeInsets = /*#__PURE__*/function () {
|
|
18
|
-
function EdgeInsets() {
|
|
19
|
-
var top = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
20
|
-
var bottom = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
21
|
-
var left = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
22
|
-
var right = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
23
|
-
|
|
24
|
-
_classCallCheck(this, EdgeInsets);
|
|
25
|
-
|
|
26
|
-
if (isNaN(top) || top < 0 || isNaN(bottom) || bottom < 0 || isNaN(left) || left < 0 || isNaN(right) || right < 0) {
|
|
27
|
-
throw new Error('Invalid value for edge-insets, top, bottom, left and right must all be numbers');
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
this.top = top;
|
|
31
|
-
this.bottom = bottom;
|
|
32
|
-
this.left = left;
|
|
33
|
-
this.right = right;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Interpolates the inset in-place.
|
|
37
|
-
* This maintains the current inset value for any inset not present in `target`.
|
|
38
|
-
*
|
|
39
|
-
* @param {PaddingOptions} target
|
|
40
|
-
* @param {number} t
|
|
41
|
-
* @returns {EdgeInsets}
|
|
42
|
-
* @memberof EdgeInsets
|
|
43
|
-
*/
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
_createClass(EdgeInsets, [{
|
|
47
|
-
key: "interpolate",
|
|
48
|
-
value: function interpolate(start, target, t) {
|
|
49
|
-
if (target.top != null && start.top != null) {
|
|
50
|
-
this.top = _interpolate(start.top, target.top, t);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
if (target.bottom != null && start.bottom != null) {
|
|
54
|
-
this.bottom = _interpolate(start.bottom, target.bottom, t);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (target.left != null && start.left != null) {
|
|
58
|
-
this.left = _interpolate(start.left, target.left, t);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if (target.right != null && start.right != null) {
|
|
62
|
-
this.right = _interpolate(start.right, target.right, t);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return this;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Utility method that computes the new apprent center or vanishing point after applying insets.
|
|
69
|
-
* This is in pixels and with the top left being (0.0) and +y being downwards.
|
|
70
|
-
*
|
|
71
|
-
* @param {number} width
|
|
72
|
-
* @param {number} height
|
|
73
|
-
* @returns {Point}
|
|
74
|
-
* @memberof EdgeInsets
|
|
75
|
-
*/
|
|
76
|
-
|
|
77
|
-
}, {
|
|
78
|
-
key: "getCenter",
|
|
79
|
-
value: function getCenter(width, height) {
|
|
80
|
-
// Clamp insets so they never overflow width/height and always calculate a valid center
|
|
81
|
-
var x = clamp((this.left + width - this.right) / 2, 0, width);
|
|
82
|
-
var y = clamp((this.top + height - this.bottom) / 2, 0, height);
|
|
83
|
-
return new Point(x, y);
|
|
84
|
-
}
|
|
85
|
-
}, {
|
|
86
|
-
key: "equals",
|
|
87
|
-
value: function equals(other) {
|
|
88
|
-
return this.top === other.top && this.bottom === other.bottom && this.left === other.left && this.right === other.right;
|
|
89
|
-
}
|
|
90
|
-
}, {
|
|
91
|
-
key: "clone",
|
|
92
|
-
value: function clone() {
|
|
93
|
-
return new EdgeInsets(this.top, this.bottom, this.left, this.right);
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Returns the current sdtate as json, useful when you want to have a
|
|
97
|
-
* read-only representation of the inset.
|
|
98
|
-
*
|
|
99
|
-
* @returns {PaddingOptions}
|
|
100
|
-
* @memberof EdgeInsets
|
|
101
|
-
*/
|
|
102
|
-
|
|
103
|
-
}, {
|
|
104
|
-
key: "toJSON",
|
|
105
|
-
value: function toJSON() {
|
|
106
|
-
return {
|
|
107
|
-
top: this.top,
|
|
108
|
-
bottom: this.bottom,
|
|
109
|
-
left: this.left,
|
|
110
|
-
right: this.right
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
}]);
|
|
114
|
-
|
|
115
|
-
return EdgeInsets;
|
|
116
|
-
}();
|
|
117
|
-
|
|
118
|
-
export { EdgeInsets as default };
|
package/es/geo/lng_lat.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export declare const earthRadius = 6371008.8;
|
|
2
|
-
export type LngLatLike = LngLat | {
|
|
3
|
-
lng: number;
|
|
4
|
-
lat: number;
|
|
5
|
-
} | {
|
|
6
|
-
lon: number;
|
|
7
|
-
lat: number;
|
|
8
|
-
} | [number, number];
|
|
9
|
-
export default class LngLat {
|
|
10
|
-
static convert(input: LngLatLike): LngLat;
|
|
11
|
-
lng: number;
|
|
12
|
-
lat: number;
|
|
13
|
-
constructor(lng: number, lat: number);
|
|
14
|
-
wrap(): LngLat;
|
|
15
|
-
toArray(): [number, number];
|
|
16
|
-
toString(): string;
|
|
17
|
-
distanceTo(lngLat: LngLat): number;
|
|
18
|
-
}
|
package/es/geo/lng_lat.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
2
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
-
import { wrap as _wrap } from "../util";
|
|
5
|
-
export var earthRadius = 6371008.8;
|
|
6
|
-
|
|
7
|
-
var LngLat = /*#__PURE__*/function () {
|
|
8
|
-
function LngLat(lng, lat) {
|
|
9
|
-
_classCallCheck(this, LngLat);
|
|
10
|
-
|
|
11
|
-
if (isNaN(lng) || isNaN(lat)) {
|
|
12
|
-
throw new Error("Invalid LngLat object: (".concat(lng, ", ").concat(lat, ")"));
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
this.lng = +lng;
|
|
16
|
-
this.lat = +lat;
|
|
17
|
-
|
|
18
|
-
if (this.lat > 90 || this.lat < -90) {
|
|
19
|
-
throw new Error('Invalid LngLat latitude value: must be between -90 and 90');
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
_createClass(LngLat, [{
|
|
24
|
-
key: "wrap",
|
|
25
|
-
value: function wrap() {
|
|
26
|
-
return new LngLat(_wrap(this.lng, -180, 180), this.lat);
|
|
27
|
-
}
|
|
28
|
-
}, {
|
|
29
|
-
key: "toArray",
|
|
30
|
-
value: function toArray() {
|
|
31
|
-
return [this.lng, this.lat];
|
|
32
|
-
} // public toBounds(radius: number = 0) {
|
|
33
|
-
// const earthCircumferenceInMetersAtEquator = 40075017;
|
|
34
|
-
// const latAccuracy = (360 * radius) / earthCircumferenceInMetersAtEquator;
|
|
35
|
-
// const lngAccuracy = latAccuracy / Math.cos((Math.PI / 180) * this.lat);
|
|
36
|
-
// return new LngLatBounds(
|
|
37
|
-
// new LngLat(this.lng - lngAccuracy, this.lat - latAccuracy),
|
|
38
|
-
// new LngLat(this.lng + lngAccuracy, this.lat + latAccuracy),
|
|
39
|
-
// );
|
|
40
|
-
// }
|
|
41
|
-
|
|
42
|
-
}, {
|
|
43
|
-
key: "toString",
|
|
44
|
-
value: function toString() {
|
|
45
|
-
return "LngLat(".concat(this.lng, ", ").concat(this.lat, ")");
|
|
46
|
-
}
|
|
47
|
-
}, {
|
|
48
|
-
key: "distanceTo",
|
|
49
|
-
value: function distanceTo(lngLat) {
|
|
50
|
-
var rad = Math.PI / 180;
|
|
51
|
-
var lat1 = this.lat * rad;
|
|
52
|
-
var lat2 = lngLat.lat * rad;
|
|
53
|
-
var a = Math.sin(lat1) * Math.sin(lat2) + Math.cos(lat1) * Math.cos(lat2) * Math.cos((lngLat.lng - this.lng) * rad);
|
|
54
|
-
var maxMeters = earthRadius * Math.acos(Math.min(a, 1));
|
|
55
|
-
return maxMeters;
|
|
56
|
-
}
|
|
57
|
-
}], [{
|
|
58
|
-
key: "convert",
|
|
59
|
-
value: function convert(input) {
|
|
60
|
-
if (input instanceof LngLat) {
|
|
61
|
-
return input;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
if (Array.isArray(input) && (input.length === 2 || input.length === 3)) {
|
|
65
|
-
return new LngLat(Number(input[0]), Number(input[1]));
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if (!Array.isArray(input) && _typeof(input) === 'object' && input !== null) {
|
|
69
|
-
var lng = 'lng' in input ? input.lng : input.lon;
|
|
70
|
-
return new LngLat( // flow can't refine this to have one of lng or lat, so we have to cast to any
|
|
71
|
-
Number(lng), Number(input.lat));
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
throw new Error('`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]');
|
|
75
|
-
}
|
|
76
|
-
}]);
|
|
77
|
-
|
|
78
|
-
return LngLat;
|
|
79
|
-
}();
|
|
80
|
-
|
|
81
|
-
export { LngLat as default };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import LngLat, { LngLatLike } from './lng_lat';
|
|
2
|
-
export type LngLatBoundsLike = LngLatBounds | [LngLatLike, LngLatLike] | [number, number, number, number];
|
|
3
|
-
export default class LngLatBounds {
|
|
4
|
-
static convert(input: LngLatBoundsLike): LngLatBounds;
|
|
5
|
-
private ne;
|
|
6
|
-
private sw;
|
|
7
|
-
constructor(sw?: any, ne?: any);
|
|
8
|
-
setNorthEast(ne: LngLatLike): this;
|
|
9
|
-
setSouthWest(sw: LngLatLike): this;
|
|
10
|
-
extend(obj: LngLatLike | LngLatBoundsLike): this;
|
|
11
|
-
getCenter(): LngLat;
|
|
12
|
-
getSouthWest(): LngLat;
|
|
13
|
-
getNorthEast(): LngLat;
|
|
14
|
-
getNorthWest(): LngLat;
|
|
15
|
-
getSouthEast(): LngLat;
|
|
16
|
-
getWest(): number;
|
|
17
|
-
getSouth(): number;
|
|
18
|
-
getEast(): number;
|
|
19
|
-
getNorth(): number;
|
|
20
|
-
toArray(): [[number, number], [number, number]];
|
|
21
|
-
toString(): string;
|
|
22
|
-
isEmpty(): boolean;
|
|
23
|
-
contains(lnglat: LngLatLike): boolean;
|
|
24
|
-
}
|
package/es/geo/lng_lat_bounds.js
DELETED
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
-
import LngLat from "./lng_lat";
|
|
4
|
-
|
|
5
|
-
var LngLatBounds = /*#__PURE__*/function () {
|
|
6
|
-
function LngLatBounds(sw, ne) {
|
|
7
|
-
_classCallCheck(this, LngLatBounds);
|
|
8
|
-
|
|
9
|
-
if (!sw) {// noop
|
|
10
|
-
} else if (ne) {
|
|
11
|
-
this.setSouthWest(sw).setNorthEast(ne);
|
|
12
|
-
} else if (sw.length === 4) {
|
|
13
|
-
this.setSouthWest([sw[0], sw[1]]).setNorthEast([sw[2], sw[3]]);
|
|
14
|
-
} else {
|
|
15
|
-
this.setSouthWest(sw[0]).setNorthEast(sw[1]);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
_createClass(LngLatBounds, [{
|
|
20
|
-
key: "setNorthEast",
|
|
21
|
-
value: function setNorthEast(ne) {
|
|
22
|
-
this.ne = ne instanceof LngLat ? new LngLat(ne.lng, ne.lat) : LngLat.convert(ne);
|
|
23
|
-
return this;
|
|
24
|
-
}
|
|
25
|
-
}, {
|
|
26
|
-
key: "setSouthWest",
|
|
27
|
-
value: function setSouthWest(sw) {
|
|
28
|
-
this.sw = sw instanceof LngLat ? new LngLat(sw.lng, sw.lat) : LngLat.convert(sw);
|
|
29
|
-
return this;
|
|
30
|
-
}
|
|
31
|
-
}, {
|
|
32
|
-
key: "extend",
|
|
33
|
-
value: function extend(obj) {
|
|
34
|
-
var sw = this.sw;
|
|
35
|
-
var ne = this.ne;
|
|
36
|
-
var sw2;
|
|
37
|
-
var ne2;
|
|
38
|
-
|
|
39
|
-
if (obj instanceof LngLat) {
|
|
40
|
-
sw2 = obj;
|
|
41
|
-
ne2 = obj;
|
|
42
|
-
} else if (obj instanceof LngLatBounds) {
|
|
43
|
-
sw2 = obj.sw;
|
|
44
|
-
ne2 = obj.ne;
|
|
45
|
-
|
|
46
|
-
if (!sw2 || !ne2) {
|
|
47
|
-
return this;
|
|
48
|
-
}
|
|
49
|
-
} else {
|
|
50
|
-
if (Array.isArray(obj)) {
|
|
51
|
-
// @ts-ignore
|
|
52
|
-
if (obj.length === 4 || obj.every(Array.isArray)) {
|
|
53
|
-
var lngLatBoundsObj = obj;
|
|
54
|
-
return this.extend(LngLatBounds.convert(lngLatBoundsObj));
|
|
55
|
-
} else {
|
|
56
|
-
var lngLatObj = obj;
|
|
57
|
-
return this.extend(LngLat.convert(lngLatObj));
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return this;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
if (!sw && !ne) {
|
|
65
|
-
this.sw = new LngLat(sw2.lng, sw2.lat);
|
|
66
|
-
this.ne = new LngLat(ne2.lng, ne2.lat);
|
|
67
|
-
} else {
|
|
68
|
-
sw.lng = Math.min(sw2.lng, sw.lng);
|
|
69
|
-
sw.lat = Math.min(sw2.lat, sw.lat);
|
|
70
|
-
ne.lng = Math.max(ne2.lng, ne.lng);
|
|
71
|
-
ne.lat = Math.max(ne2.lat, ne.lat);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return this;
|
|
75
|
-
}
|
|
76
|
-
}, {
|
|
77
|
-
key: "getCenter",
|
|
78
|
-
value: function getCenter() {
|
|
79
|
-
return new LngLat((this.sw.lng + this.ne.lng) / 2, (this.sw.lat + this.ne.lat) / 2);
|
|
80
|
-
}
|
|
81
|
-
}, {
|
|
82
|
-
key: "getSouthWest",
|
|
83
|
-
value: function getSouthWest() {
|
|
84
|
-
return this.sw;
|
|
85
|
-
}
|
|
86
|
-
}, {
|
|
87
|
-
key: "getNorthEast",
|
|
88
|
-
value: function getNorthEast() {
|
|
89
|
-
return this.ne;
|
|
90
|
-
}
|
|
91
|
-
}, {
|
|
92
|
-
key: "getNorthWest",
|
|
93
|
-
value: function getNorthWest() {
|
|
94
|
-
return new LngLat(this.getWest(), this.getNorth());
|
|
95
|
-
}
|
|
96
|
-
}, {
|
|
97
|
-
key: "getSouthEast",
|
|
98
|
-
value: function getSouthEast() {
|
|
99
|
-
return new LngLat(this.getEast(), this.getSouth());
|
|
100
|
-
}
|
|
101
|
-
}, {
|
|
102
|
-
key: "getWest",
|
|
103
|
-
value: function getWest() {
|
|
104
|
-
return this.sw.lng;
|
|
105
|
-
}
|
|
106
|
-
}, {
|
|
107
|
-
key: "getSouth",
|
|
108
|
-
value: function getSouth() {
|
|
109
|
-
return this.sw.lat;
|
|
110
|
-
}
|
|
111
|
-
}, {
|
|
112
|
-
key: "getEast",
|
|
113
|
-
value: function getEast() {
|
|
114
|
-
return this.ne.lng;
|
|
115
|
-
}
|
|
116
|
-
}, {
|
|
117
|
-
key: "getNorth",
|
|
118
|
-
value: function getNorth() {
|
|
119
|
-
return this.ne.lat;
|
|
120
|
-
}
|
|
121
|
-
}, {
|
|
122
|
-
key: "toArray",
|
|
123
|
-
value: function toArray() {
|
|
124
|
-
return [this.sw.toArray(), this.ne.toArray()];
|
|
125
|
-
}
|
|
126
|
-
}, {
|
|
127
|
-
key: "toString",
|
|
128
|
-
value: function toString() {
|
|
129
|
-
return "LngLatBounds(".concat(this.sw.toString(), ", ").concat(this.ne.toString(), ")");
|
|
130
|
-
}
|
|
131
|
-
}, {
|
|
132
|
-
key: "isEmpty",
|
|
133
|
-
value: function isEmpty() {
|
|
134
|
-
return !(this.sw && this.ne);
|
|
135
|
-
}
|
|
136
|
-
}, {
|
|
137
|
-
key: "contains",
|
|
138
|
-
value: function contains(lnglat) {
|
|
139
|
-
var _LngLat$convert = LngLat.convert(lnglat),
|
|
140
|
-
lng = _LngLat$convert.lng,
|
|
141
|
-
lat = _LngLat$convert.lat;
|
|
142
|
-
|
|
143
|
-
var containsLatitude = this.sw.lat <= lat && lat <= this.ne.lat;
|
|
144
|
-
var containsLongitude = this.sw.lng <= lng && lng <= this.ne.lng;
|
|
145
|
-
|
|
146
|
-
if (this.sw.lng > this.ne.lng) {
|
|
147
|
-
// wrapped coordinates
|
|
148
|
-
containsLongitude = this.sw.lng >= lng && lng >= this.ne.lng;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
return containsLatitude && containsLongitude;
|
|
152
|
-
}
|
|
153
|
-
}], [{
|
|
154
|
-
key: "convert",
|
|
155
|
-
value: function convert(input) {
|
|
156
|
-
if (input instanceof LngLatBounds) {
|
|
157
|
-
return input;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
return new LngLatBounds(input);
|
|
161
|
-
}
|
|
162
|
-
}]);
|
|
163
|
-
|
|
164
|
-
return LngLatBounds;
|
|
165
|
-
}();
|
|
166
|
-
|
|
167
|
-
export { LngLatBounds as default };
|
package/es/geo/mercator.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import LngLat, { LngLatLike } from '../geo/lng_lat';
|
|
2
|
-
export declare function mercatorXfromLng(lng: number): number;
|
|
3
|
-
export declare function mercatorYfromLat(lat: number): number;
|
|
4
|
-
export declare function mercatorZfromAltitude(altitude: number, lat: number): number;
|
|
5
|
-
export declare function lngFromMercatorX(x: number): number;
|
|
6
|
-
export declare function latFromMercatorY(y: number): number;
|
|
7
|
-
export declare function altitudeFromMercatorZ(z: number, y: number): number;
|
|
8
|
-
/**
|
|
9
|
-
* Determine the Mercator scale factor for a given latitude, see
|
|
10
|
-
* https://en.wikipedia.org/wiki/Mercator_projection#Scale_factor
|
|
11
|
-
*
|
|
12
|
-
* At the equator the scale factor will be 1, which increases at higher latitudes.
|
|
13
|
-
*
|
|
14
|
-
* @param {number} lat Latitude
|
|
15
|
-
* @returns {number} scale factor
|
|
16
|
-
* @private
|
|
17
|
-
*/
|
|
18
|
-
export declare function mercatorScale(lat: number): number;
|
|
19
|
-
export default class MercatorCoordinate {
|
|
20
|
-
static fromLngLat(lngLatLike: LngLatLike, altitude?: number): MercatorCoordinate;
|
|
21
|
-
x: number;
|
|
22
|
-
y: number;
|
|
23
|
-
z: number;
|
|
24
|
-
constructor(x: number, y: number, z?: number);
|
|
25
|
-
toLngLat(): LngLat;
|
|
26
|
-
toAltitude(): number;
|
|
27
|
-
meterInMercatorCoordinateUnits(): number;
|
|
28
|
-
}
|
|
29
|
-
export { MercatorCoordinate };
|
package/es/geo/mercator.js
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
-
import LngLat, { earthRadius } from "../geo/lng_lat";
|
|
4
|
-
/*
|
|
5
|
-
* The average circumference of the world in meters.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
var earthCircumfrence = 2 * Math.PI * earthRadius; // meters
|
|
9
|
-
|
|
10
|
-
/*
|
|
11
|
-
* The circumference at a line of latitude in meters.
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
function circumferenceAtLatitude(latitude) {
|
|
15
|
-
return earthCircumfrence * Math.cos(latitude * Math.PI / 180);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function mercatorXfromLng(lng) {
|
|
19
|
-
return (180 + lng) / 360;
|
|
20
|
-
}
|
|
21
|
-
export function mercatorYfromLat(lat) {
|
|
22
|
-
return (180 - 180 / Math.PI * Math.log(Math.tan(Math.PI / 4 + lat * Math.PI / 360))) / 360;
|
|
23
|
-
}
|
|
24
|
-
export function mercatorZfromAltitude(altitude, lat) {
|
|
25
|
-
return altitude / circumferenceAtLatitude(lat);
|
|
26
|
-
}
|
|
27
|
-
export function lngFromMercatorX(x) {
|
|
28
|
-
return x * 360 - 180;
|
|
29
|
-
}
|
|
30
|
-
export function latFromMercatorY(y) {
|
|
31
|
-
var y2 = 180 - y * 360;
|
|
32
|
-
return 360 / Math.PI * Math.atan(Math.exp(y2 * Math.PI / 180)) - 90;
|
|
33
|
-
}
|
|
34
|
-
export function altitudeFromMercatorZ(z, y) {
|
|
35
|
-
return z * circumferenceAtLatitude(latFromMercatorY(y));
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Determine the Mercator scale factor for a given latitude, see
|
|
39
|
-
* https://en.wikipedia.org/wiki/Mercator_projection#Scale_factor
|
|
40
|
-
*
|
|
41
|
-
* At the equator the scale factor will be 1, which increases at higher latitudes.
|
|
42
|
-
*
|
|
43
|
-
* @param {number} lat Latitude
|
|
44
|
-
* @returns {number} scale factor
|
|
45
|
-
* @private
|
|
46
|
-
*/
|
|
47
|
-
|
|
48
|
-
export function mercatorScale(lat) {
|
|
49
|
-
return 1 / Math.cos(lat * Math.PI / 180);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
var MercatorCoordinate = /*#__PURE__*/function () {
|
|
53
|
-
function MercatorCoordinate(x, y) {
|
|
54
|
-
var z = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
55
|
-
|
|
56
|
-
_classCallCheck(this, MercatorCoordinate);
|
|
57
|
-
|
|
58
|
-
this.x = +x;
|
|
59
|
-
this.y = +y;
|
|
60
|
-
this.z = +z;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
_createClass(MercatorCoordinate, [{
|
|
64
|
-
key: "toLngLat",
|
|
65
|
-
value: function toLngLat() {
|
|
66
|
-
return new LngLat(lngFromMercatorX(this.x), latFromMercatorY(this.y));
|
|
67
|
-
}
|
|
68
|
-
}, {
|
|
69
|
-
key: "toAltitude",
|
|
70
|
-
value: function toAltitude() {
|
|
71
|
-
return altitudeFromMercatorZ(this.z, this.y);
|
|
72
|
-
}
|
|
73
|
-
}, {
|
|
74
|
-
key: "meterInMercatorCoordinateUnits",
|
|
75
|
-
value: function meterInMercatorCoordinateUnits() {
|
|
76
|
-
// 1 meter / circumference at equator in meters * Mercator projection scale factor at this latitude
|
|
77
|
-
return 1 / earthCircumfrence * mercatorScale(latFromMercatorY(this.y));
|
|
78
|
-
}
|
|
79
|
-
}], [{
|
|
80
|
-
key: "fromLngLat",
|
|
81
|
-
value: function fromLngLat(lngLatLike) {
|
|
82
|
-
var altitude = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
83
|
-
var lngLat = LngLat.convert(lngLatLike);
|
|
84
|
-
return new MercatorCoordinate(mercatorXfromLng(lngLat.lng), mercatorYfromLat(lngLat.lat), mercatorZfromAltitude(altitude, lngLat.lat));
|
|
85
|
-
}
|
|
86
|
-
}]);
|
|
87
|
-
|
|
88
|
-
return MercatorCoordinate;
|
|
89
|
-
}();
|
|
90
|
-
|
|
91
|
-
export { MercatorCoordinate as default };
|
|
92
|
-
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
|
-
}
|