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