@antv/l7-map 2.18.0 → 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.
Files changed (168) hide show
  1. package/package.json +3 -3
  2. package/es/camera.d.ts +0 -85
  3. package/es/camera.js +0 -718
  4. package/es/css/l7.css +0 -98
  5. package/es/earthmap.d.ts +0 -66
  6. package/es/earthmap.js +0 -369
  7. package/es/geo/edge_insets.d.ts +0 -54
  8. package/es/geo/edge_insets.js +0 -108
  9. package/es/geo/lng_lat.d.ts +0 -18
  10. package/es/geo/lng_lat.js +0 -73
  11. package/es/geo/lng_lat_bounds.d.ts +0 -24
  12. package/es/geo/lng_lat_bounds.js +0 -154
  13. package/es/geo/mercator.d.ts +0 -29
  14. package/es/geo/mercator.js +0 -84
  15. package/es/geo/point.d.ts +0 -40
  16. package/es/geo/point.js +0 -224
  17. package/es/geo/simple.d.ts +0 -29
  18. package/es/geo/simple.js +0 -87
  19. package/es/geo/transform.d.ts +0 -198
  20. package/es/geo/transform.js +0 -961
  21. package/es/handler/IHandler.d.ts +0 -34
  22. package/es/handler/IHandler.js +0 -1
  23. package/es/handler/blockable_map_event.d.ts +0 -17
  24. package/es/handler/blockable_map_event.js +0 -78
  25. package/es/handler/box_zoom.d.ts +0 -59
  26. package/es/handler/box_zoom.js +0 -180
  27. package/es/handler/click_zoom.d.ts +0 -16
  28. package/es/handler/click_zoom.js +0 -54
  29. package/es/handler/events/event.d.ts +0 -4
  30. package/es/handler/events/event.js +0 -11
  31. package/es/handler/events/index.d.ts +0 -4
  32. package/es/handler/events/index.js +0 -4
  33. package/es/handler/events/map_mouse_event.d.ts +0 -34
  34. package/es/handler/events/map_mouse_event.js +0 -64
  35. package/es/handler/events/map_touch_event.d.ts +0 -57
  36. package/es/handler/events/map_touch_event.js +0 -95
  37. package/es/handler/events/map_wheel_event.d.ts +0 -33
  38. package/es/handler/events/map_wheel_event.js +0 -50
  39. package/es/handler/events/render_event.d.ts +0 -5
  40. package/es/handler/events/render_event.js +0 -26
  41. package/es/handler/handler_inertia.d.ts +0 -23
  42. package/es/handler/handler_inertia.js +0 -157
  43. package/es/handler/handler_manager.d.ts +0 -61
  44. package/es/handler/handler_manager.js +0 -577
  45. package/es/handler/handler_util.d.ts +0 -4
  46. package/es/handler/handler_util.js +0 -9
  47. package/es/handler/keyboard.d.ts +0 -36
  48. package/es/handler/keyboard.js +0 -143
  49. package/es/handler/map_event.d.ts +0 -29
  50. package/es/handler/map_event.js +0 -125
  51. package/es/handler/mouse/index.d.ts +0 -4
  52. package/es/handler/mouse/index.js +0 -4
  53. package/es/handler/mouse/mouse_handler.d.ts +0 -22
  54. package/es/handler/mouse/mouse_handler.js +0 -118
  55. package/es/handler/mouse/mousepan_handler.d.ts +0 -10
  56. package/es/handler/mouse/mousepan_handler.js +0 -44
  57. package/es/handler/mouse/mousepitch_hander.d.ts +0 -9
  58. package/es/handler/mouse/mousepitch_hander.js +0 -46
  59. package/es/handler/mouse/mouserotate_hander.d.ts +0 -9
  60. package/es/handler/mouse/mouserotate_hander.js +0 -46
  61. package/es/handler/mouse/util.d.ts +0 -6
  62. package/es/handler/mouse/util.js +0 -11
  63. package/es/handler/scroll_zoom.d.ts +0 -93
  64. package/es/handler/scroll_zoom.js +0 -325
  65. package/es/handler/shim/dblclick_zoom.d.ts +0 -40
  66. package/es/handler/shim/dblclick_zoom.js +0 -67
  67. package/es/handler/shim/drag_pan.d.ts +0 -61
  68. package/es/handler/shim/drag_pan.js +0 -84
  69. package/es/handler/shim/drag_rotate.d.ts +0 -46
  70. package/es/handler/shim/drag_rotate.js +0 -74
  71. package/es/handler/shim/touch_zoom_rotate.d.ts +0 -70
  72. package/es/handler/shim/touch_zoom_rotate.js +0 -115
  73. package/es/handler/tap/single_tap_recognizer.d.ts +0 -20
  74. package/es/handler/tap/single_tap_recognizer.js +0 -97
  75. package/es/handler/tap/tap_drag_zoom.d.ts +0 -22
  76. package/es/handler/tap/tap_drag_zoom.js +0 -106
  77. package/es/handler/tap/tap_recognizer.d.ts +0 -17
  78. package/es/handler/tap/tap_recognizer.js +0 -54
  79. package/es/handler/tap/tap_zoom.d.ts +0 -22
  80. package/es/handler/tap/tap_zoom.js +0 -109
  81. package/es/handler/touch/index.d.ts +0 -5
  82. package/es/handler/touch/index.js +0 -5
  83. package/es/handler/touch/touch_pan.d.ts +0 -30
  84. package/es/handler/touch/touch_pan.js +0 -110
  85. package/es/handler/touch/touch_pitch.d.ts +0 -13
  86. package/es/handler/touch/touch_pitch.js +0 -93
  87. package/es/handler/touch/touch_rotate.d.ts +0 -12
  88. package/es/handler/touch/touch_rotate.js +0 -77
  89. package/es/handler/touch/touch_zoom.d.ts +0 -12
  90. package/es/handler/touch/touch_zoom.js +0 -54
  91. package/es/handler/touch/two_touch.d.ts +0 -23
  92. package/es/handler/touch/two_touch.js +0 -125
  93. package/es/hash.d.ts +0 -14
  94. package/es/hash.js +0 -134
  95. package/es/index.d.ts +0 -4
  96. package/es/index.js +0 -4
  97. package/es/interface.d.ts +0 -34
  98. package/es/interface.js +0 -1
  99. package/es/map.d.ts +0 -70
  100. package/es/map.js +0 -387
  101. package/es/util.d.ts +0 -25
  102. package/es/util.js +0 -88
  103. package/es/utils/Aabb.d.ts +0 -12
  104. package/es/utils/Aabb.js +0 -112
  105. package/es/utils/dom.d.ts +0 -4
  106. package/es/utils/dom.js +0 -140
  107. package/es/utils/performance.d.ts +0 -17
  108. package/es/utils/performance.js +0 -62
  109. package/es/utils/primitives.d.ts +0 -6
  110. package/es/utils/primitives.js +0 -47
  111. package/es/utils/task_queue.d.ts +0 -13
  112. package/es/utils/task_queue.js +0 -89
  113. package/lib/camera.js +0 -724
  114. package/lib/css/l7.css +0 -98
  115. package/lib/earthmap.js +0 -376
  116. package/lib/geo/edge_insets.js +0 -114
  117. package/lib/geo/lng_lat.js +0 -81
  118. package/lib/geo/lng_lat_bounds.js +0 -161
  119. package/lib/geo/mercator.js +0 -100
  120. package/lib/geo/point.js +0 -231
  121. package/lib/geo/simple.js +0 -104
  122. package/lib/geo/transform.js +0 -971
  123. package/lib/handler/IHandler.js +0 -5
  124. package/lib/handler/blockable_map_event.js +0 -84
  125. package/lib/handler/box_zoom.js +0 -186
  126. package/lib/handler/click_zoom.js +0 -61
  127. package/lib/handler/events/event.js +0 -20
  128. package/lib/handler/events/index.js +0 -27
  129. package/lib/handler/events/map_mouse_event.js +0 -70
  130. package/lib/handler/events/map_touch_event.js +0 -100
  131. package/lib/handler/events/map_wheel_event.js +0 -57
  132. package/lib/handler/events/render_event.js +0 -33
  133. package/lib/handler/handler_inertia.js +0 -162
  134. package/lib/handler/handler_manager.js +0 -584
  135. package/lib/handler/handler_util.js +0 -15
  136. package/lib/handler/keyboard.js +0 -151
  137. package/lib/handler/map_event.js +0 -131
  138. package/lib/handler/mouse/index.js +0 -27
  139. package/lib/handler/mouse/mouse_handler.js +0 -124
  140. package/lib/handler/mouse/mousepan_handler.js +0 -49
  141. package/lib/handler/mouse/mousepitch_hander.js +0 -51
  142. package/lib/handler/mouse/mouserotate_hander.js +0 -51
  143. package/lib/handler/mouse/util.js +0 -22
  144. package/lib/handler/scroll_zoom.js +0 -333
  145. package/lib/handler/shim/dblclick_zoom.js +0 -74
  146. package/lib/handler/shim/drag_pan.js +0 -91
  147. package/lib/handler/shim/drag_rotate.js +0 -81
  148. package/lib/handler/shim/touch_zoom_rotate.js +0 -122
  149. package/lib/handler/tap/single_tap_recognizer.js +0 -106
  150. package/lib/handler/tap/tap_drag_zoom.js +0 -112
  151. package/lib/handler/tap/tap_recognizer.js +0 -63
  152. package/lib/handler/tap/tap_zoom.js +0 -115
  153. package/lib/handler/touch/index.js +0 -34
  154. package/lib/handler/touch/touch_pan.js +0 -117
  155. package/lib/handler/touch/touch_pitch.js +0 -98
  156. package/lib/handler/touch/touch_rotate.js +0 -82
  157. package/lib/handler/touch/touch_zoom.js +0 -59
  158. package/lib/handler/touch/two_touch.js +0 -131
  159. package/lib/hash.js +0 -143
  160. package/lib/index.js +0 -49
  161. package/lib/interface.js +0 -5
  162. package/lib/map.js +0 -394
  163. package/lib/util.js +0 -108
  164. package/lib/utils/Aabb.js +0 -119
  165. package/lib/utils/dom.js +0 -147
  166. package/lib/utils/performance.js +0 -70
  167. package/lib/utils/primitives.js +0 -54
  168. package/lib/utils/task_queue.js +0 -97
@@ -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,73 +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
- var LngLat = /*#__PURE__*/function () {
7
- function LngLat(lng, lat) {
8
- _classCallCheck(this, LngLat);
9
- if (isNaN(lng) || isNaN(lat)) {
10
- throw new Error("Invalid LngLat object: (".concat(lng, ", ").concat(lat, ")"));
11
- }
12
- this.lng = +lng;
13
- this.lat = +lat;
14
- if (this.lat > 90 || this.lat < -90) {
15
- throw new Error('Invalid LngLat latitude value: must be between -90 and 90');
16
- }
17
- }
18
- _createClass(LngLat, [{
19
- key: "wrap",
20
- value: function wrap() {
21
- return new LngLat(_wrap(this.lng, -180, 180), this.lat);
22
- }
23
- }, {
24
- key: "toArray",
25
- value: function toArray() {
26
- return [this.lng, this.lat];
27
- }
28
- // public toBounds(radius: number = 0) {
29
- // const earthCircumferenceInMetersAtEquator = 40075017;
30
- // const latAccuracy = (360 * radius) / earthCircumferenceInMetersAtEquator;
31
- // const lngAccuracy = latAccuracy / Math.cos((Math.PI / 180) * this.lat);
32
-
33
- // return new LngLatBounds(
34
- // new LngLat(this.lng - lngAccuracy, this.lat - latAccuracy),
35
- // new LngLat(this.lng + lngAccuracy, this.lat + latAccuracy),
36
- // );
37
- // }
38
- }, {
39
- key: "toString",
40
- value: function toString() {
41
- return "LngLat(".concat(this.lng, ", ").concat(this.lat, ")");
42
- }
43
- }, {
44
- key: "distanceTo",
45
- value: function distanceTo(lngLat) {
46
- var rad = Math.PI / 180;
47
- var lat1 = this.lat * rad;
48
- var lat2 = lngLat.lat * rad;
49
- var a = Math.sin(lat1) * Math.sin(lat2) + Math.cos(lat1) * Math.cos(lat2) * Math.cos((lngLat.lng - this.lng) * rad);
50
- var maxMeters = earthRadius * Math.acos(Math.min(a, 1));
51
- return maxMeters;
52
- }
53
- }], [{
54
- key: "convert",
55
- value: function convert(input) {
56
- if (input instanceof LngLat) {
57
- return input;
58
- }
59
- if (Array.isArray(input) && (input.length === 2 || input.length === 3)) {
60
- return new LngLat(Number(input[0]), Number(input[1]));
61
- }
62
- if (!Array.isArray(input) && _typeof(input) === 'object' && input !== null) {
63
- var lng = 'lng' in input ? input.lng : input.lon;
64
- return new LngLat(
65
- // flow can't refine this to have one of lng or lat, so we have to cast to any
66
- Number(lng), Number(input.lat));
67
- }
68
- 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>]');
69
- }
70
- }]);
71
- return LngLat;
72
- }();
73
- 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
- }
@@ -1,154 +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
- var LngLatBounds = /*#__PURE__*/function () {
5
- function LngLatBounds(sw, ne) {
6
- _classCallCheck(this, LngLatBounds);
7
- if (!sw) {
8
- // noop
9
- } else if (ne) {
10
- this.setSouthWest(sw).setNorthEast(ne);
11
- } else if (sw.length === 4) {
12
- this.setSouthWest([sw[0], sw[1]]).setNorthEast([sw[2], sw[3]]);
13
- } else {
14
- this.setSouthWest(sw[0]).setNorthEast(sw[1]);
15
- }
16
- }
17
- _createClass(LngLatBounds, [{
18
- key: "setNorthEast",
19
- value: function setNorthEast(ne) {
20
- this.ne = ne instanceof LngLat ? new LngLat(ne.lng, ne.lat) : LngLat.convert(ne);
21
- return this;
22
- }
23
- }, {
24
- key: "setSouthWest",
25
- value: function setSouthWest(sw) {
26
- this.sw = sw instanceof LngLat ? new LngLat(sw.lng, sw.lat) : LngLat.convert(sw);
27
- return this;
28
- }
29
- }, {
30
- key: "extend",
31
- value: function extend(obj) {
32
- var sw = this.sw;
33
- var ne = this.ne;
34
- var sw2;
35
- var 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
- var lngLatBoundsObj = obj;
50
- return this.extend(LngLatBounds.convert(lngLatBoundsObj));
51
- } else {
52
- var 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
- }, {
70
- key: "getCenter",
71
- value: function getCenter() {
72
- return new LngLat((this.sw.lng + this.ne.lng) / 2, (this.sw.lat + this.ne.lat) / 2);
73
- }
74
- }, {
75
- key: "getSouthWest",
76
- value: function getSouthWest() {
77
- return this.sw;
78
- }
79
- }, {
80
- key: "getNorthEast",
81
- value: function getNorthEast() {
82
- return this.ne;
83
- }
84
- }, {
85
- key: "getNorthWest",
86
- value: function getNorthWest() {
87
- return new LngLat(this.getWest(), this.getNorth());
88
- }
89
- }, {
90
- key: "getSouthEast",
91
- value: function getSouthEast() {
92
- return new LngLat(this.getEast(), this.getSouth());
93
- }
94
- }, {
95
- key: "getWest",
96
- value: function getWest() {
97
- return this.sw.lng;
98
- }
99
- }, {
100
- key: "getSouth",
101
- value: function getSouth() {
102
- return this.sw.lat;
103
- }
104
- }, {
105
- key: "getEast",
106
- value: function getEast() {
107
- return this.ne.lng;
108
- }
109
- }, {
110
- key: "getNorth",
111
- value: function getNorth() {
112
- return this.ne.lat;
113
- }
114
- }, {
115
- key: "toArray",
116
- value: function toArray() {
117
- return [this.sw.toArray(), this.ne.toArray()];
118
- }
119
- }, {
120
- key: "toString",
121
- value: function toString() {
122
- return "LngLatBounds(".concat(this.sw.toString(), ", ").concat(this.ne.toString(), ")");
123
- }
124
- }, {
125
- key: "isEmpty",
126
- value: function isEmpty() {
127
- return !(this.sw && this.ne);
128
- }
129
- }, {
130
- key: "contains",
131
- value: function contains(lnglat) {
132
- var _LngLat$convert = LngLat.convert(lnglat),
133
- lng = _LngLat$convert.lng,
134
- lat = _LngLat$convert.lat;
135
- var containsLatitude = this.sw.lat <= lat && lat <= this.ne.lat;
136
- var containsLongitude = this.sw.lng <= lng && lng <= this.ne.lng;
137
- if (this.sw.lng > this.ne.lng) {
138
- // wrapped coordinates
139
- containsLongitude = this.sw.lng >= lng && lng >= this.ne.lng;
140
- }
141
- return containsLatitude && containsLongitude;
142
- }
143
- }], [{
144
- key: "convert",
145
- value: function convert(input) {
146
- if (input instanceof LngLatBounds) {
147
- return input;
148
- }
149
- return new LngLatBounds(input);
150
- }
151
- }]);
152
- return LngLatBounds;
153
- }();
154
- export { LngLatBounds as default };
@@ -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 };
@@ -1,84 +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
- /*
6
- * The average circumference of the world in meters.
7
- */
8
- var earthCircumfrence = 2 * Math.PI * earthRadius; // meters
9
-
10
- /*
11
- * The circumference at a line of latitude in meters.
12
- */
13
- function circumferenceAtLatitude(latitude) {
14
- return earthCircumfrence * Math.cos(latitude * Math.PI / 180);
15
- }
16
- export function mercatorXfromLng(lng) {
17
- return (180 + lng) / 360;
18
- }
19
- export function mercatorYfromLat(lat) {
20
- return (180 - 180 / Math.PI * Math.log(Math.tan(Math.PI / 4 + lat * Math.PI / 360))) / 360;
21
- }
22
- export function mercatorZfromAltitude(altitude, lat) {
23
- return altitude / circumferenceAtLatitude(lat);
24
- }
25
- export function lngFromMercatorX(x) {
26
- return x * 360 - 180;
27
- }
28
- export function latFromMercatorY(y) {
29
- var y2 = 180 - y * 360;
30
- return 360 / Math.PI * Math.atan(Math.exp(y2 * Math.PI / 180)) - 90;
31
- }
32
- export function altitudeFromMercatorZ(z, y) {
33
- return z * circumferenceAtLatitude(latFromMercatorY(y));
34
- }
35
-
36
- /**
37
- * Determine the Mercator scale factor for a given latitude, see
38
- * https://en.wikipedia.org/wiki/Mercator_projection#Scale_factor
39
- *
40
- * At the equator the scale factor will be 1, which increases at higher latitudes.
41
- *
42
- * @param {number} lat Latitude
43
- * @returns {number} scale factor
44
- * @private
45
- */
46
- export function mercatorScale(lat) {
47
- return 1 / Math.cos(lat * Math.PI / 180);
48
- }
49
- var MercatorCoordinate = /*#__PURE__*/function () {
50
- function MercatorCoordinate(x, y) {
51
- var z = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
52
- _classCallCheck(this, MercatorCoordinate);
53
- this.x = +x;
54
- this.y = +y;
55
- this.z = +z;
56
- }
57
- _createClass(MercatorCoordinate, [{
58
- key: "toLngLat",
59
- value: function toLngLat() {
60
- return new LngLat(lngFromMercatorX(this.x), latFromMercatorY(this.y));
61
- }
62
- }, {
63
- key: "toAltitude",
64
- value: function toAltitude() {
65
- return altitudeFromMercatorZ(this.z, this.y);
66
- }
67
- }, {
68
- key: "meterInMercatorCoordinateUnits",
69
- value: function meterInMercatorCoordinateUnits() {
70
- // 1 meter / circumference at equator in meters * Mercator projection scale factor at this latitude
71
- return 1 / earthCircumfrence * mercatorScale(latFromMercatorY(this.y));
72
- }
73
- }], [{
74
- key: "fromLngLat",
75
- value: function fromLngLat(lngLatLike) {
76
- var altitude = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
77
- var lngLat = LngLat.convert(lngLatLike);
78
- return new MercatorCoordinate(mercatorXfromLng(lngLat.lng), mercatorYfromLat(lngLat.lat), mercatorZfromAltitude(altitude, lngLat.lat));
79
- }
80
- }]);
81
- return MercatorCoordinate;
82
- }();
83
- export { MercatorCoordinate as default };
84
- 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,224 +0,0 @@
1
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/esm/createClass";
3
- var Point = /*#__PURE__*/function () {
4
- function Point(x, y) {
5
- _classCallCheck(this, Point);
6
- this.x = x;
7
- this.y = y;
8
- }
9
- _createClass(Point, [{
10
- key: "clone",
11
- value: function clone() {
12
- return new Point(this.x, this.y);
13
- }
14
- }, {
15
- key: "_add",
16
- value: function _add(p) {
17
- this.x += p.x;
18
- this.y += p.y;
19
- return this;
20
- }
21
- }, {
22
- key: "add",
23
- value: function add(p) {
24
- return this.clone()._add(p);
25
- }
26
- }, {
27
- key: "_sub",
28
- value: function _sub(p) {
29
- this.x -= p.x;
30
- this.y -= p.y;
31
- return this;
32
- }
33
- }, {
34
- key: "sub",
35
- value: function sub(p) {
36
- return this.clone()._sub(p);
37
- }
38
- }, {
39
- key: "_multByPoint",
40
- value: function _multByPoint(p) {
41
- this.x *= p.x;
42
- this.y *= p.y;
43
- return this;
44
- }
45
- }, {
46
- key: "multByPoint",
47
- value: function multByPoint(p) {
48
- return this.clone()._multByPoint(p);
49
- }
50
- }, {
51
- key: "_divByPoint",
52
- value: function _divByPoint(p) {
53
- this.x /= p.x;
54
- this.y /= p.y;
55
- return this;
56
- }
57
- }, {
58
- key: "divByPoint",
59
- value: function divByPoint(p) {
60
- return this.clone()._divByPoint(p);
61
- }
62
- }, {
63
- key: "_mult",
64
- value: function _mult(k) {
65
- this.x *= k;
66
- this.y *= k;
67
- return this;
68
- }
69
- }, {
70
- key: "mult",
71
- value: function mult(k) {
72
- return this.clone()._mult(k);
73
- }
74
- }, {
75
- key: "_div",
76
- value: function _div(k) {
77
- this.x /= k;
78
- this.y /= k;
79
- return this;
80
- }
81
- }, {
82
- key: "div",
83
- value: function div(k) {
84
- return this.clone()._div(k);
85
- }
86
- }, {
87
- key: "_rotate",
88
- value: function _rotate(angle) {
89
- var cos = Math.cos(angle);
90
- var sin = Math.sin(angle);
91
- var x = cos * this.x - sin * this.y;
92
- var y = sin * this.x + cos * this.y;
93
- this.x = x;
94
- this.y = y;
95
- return this;
96
- }
97
- }, {
98
- key: "rotate",
99
- value: function rotate(angle) {
100
- return this.clone()._rotate(angle);
101
- }
102
- }, {
103
- key: "_rotateAround",
104
- value: function _rotateAround(angle, p) {
105
- var cos = Math.cos(angle);
106
- var sin = Math.sin(angle);
107
- var x = p.x + cos * (this.x - p.x) - sin * (this.y - p.y);
108
- var y = p.y + sin * (this.x - p.x) + cos * (this.y - p.y);
109
- this.x = x;
110
- this.y = y;
111
- return this;
112
- }
113
- }, {
114
- key: "roateAround",
115
- value: function roateAround(angle, p) {
116
- return this.clone()._rotateAround(angle, p);
117
- }
118
- }, {
119
- key: "_matMult",
120
- value: function _matMult(m) {
121
- var x = m[0] * this.x + m[1] * this.y;
122
- var y = m[2] * this.x + m[3] * this.y;
123
- this.x = x;
124
- this.y = y;
125
- return this;
126
- }
127
- }, {
128
- key: "matMult",
129
- value: function matMult(m) {
130
- return this.clone()._matMult(m);
131
- }
132
- }, {
133
- key: "_unit",
134
- value: function _unit() {
135
- this.div(this.mag());
136
- return this;
137
- }
138
- }, {
139
- key: "unit",
140
- value: function unit() {
141
- return this.clone()._unit();
142
- }
143
- }, {
144
- key: "_perp",
145
- value: function _perp() {
146
- var y = this.y;
147
- this.y = this.x;
148
- this.x = -y;
149
- return this;
150
- }
151
- }, {
152
- key: "perp",
153
- value: function perp() {
154
- return this.clone()._perp();
155
- }
156
- }, {
157
- key: "_round",
158
- value: function _round() {
159
- this.x = Math.round(this.x);
160
- this.y = Math.round(this.y);
161
- return this;
162
- }
163
- }, {
164
- key: "round",
165
- value: function round() {
166
- return this.clone()._round();
167
- }
168
- }, {
169
- key: "mag",
170
- value: function mag() {
171
- return Math.sqrt(this.x * this.x + this.y * this.y);
172
- }
173
- }, {
174
- key: "equals",
175
- value: function equals(other) {
176
- return this.x === other.x && this.y === other.y;
177
- }
178
- }, {
179
- key: "dist",
180
- value: function dist(p) {
181
- return Math.sqrt(this.distSqr(p));
182
- }
183
- }, {
184
- key: "distSqr",
185
- value: function distSqr(p) {
186
- var dx = p.x - this.x;
187
- var dy = p.y - this.y;
188
- return dx * dx + dy * dy;
189
- }
190
- }, {
191
- key: "angle",
192
- value: function angle() {
193
- return Math.atan2(this.y, this.x);
194
- }
195
- }, {
196
- key: "angleTo",
197
- value: function angleTo(b) {
198
- return Math.atan2(this.y - b.y, this.x - b.x);
199
- }
200
- }, {
201
- key: "angleWith",
202
- value: function angleWith(b) {
203
- return this.angleWithSep(b.x, b.y);
204
- }
205
- }, {
206
- key: "angleWithSep",
207
- value: function angleWithSep(x, y) {
208
- return Math.atan2(this.x * y - this.y * x, this.x * x + this.y * y);
209
- }
210
- }], [{
211
- key: "convert",
212
- value: function convert(a) {
213
- if (a instanceof Point) {
214
- return a;
215
- }
216
- if (Array.isArray(a)) {
217
- return new Point(a[0], a[1]);
218
- }
219
- return a;
220
- }
221
- }]);
222
- return Point;
223
- }();
224
- export { Point as default };
@@ -1,29 +0,0 @@
1
- import LngLat, { LngLatLike } from '../geo/lng_lat';
2
- export declare function circumferenceAtLatitude(latitude: number): number;
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 SimpleCoordinate {
21
- static fromLngLat(lngLatLike: LngLatLike, altitude?: number): SimpleCoordinate;
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
- }