@progress/kendo-charts 1.22.0 → 1.23.0-dev.202201170838

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 (59) hide show
  1. package/LICENSE.md +1 -1
  2. package/NOTICE.txt +119 -79
  3. package/dist/cdn/js/kendo-charts.js +1 -1
  4. package/dist/cdn/main.js +1 -1
  5. package/dist/es/common/keys.js +25 -0
  6. package/dist/es/common.js +1 -0
  7. package/dist/es/drawing-utils.js +27 -3
  8. package/dist/es/main.js +1 -0
  9. package/dist/es/map/attribution.js +158 -0
  10. package/dist/es/map/crs.js +277 -0
  11. package/dist/es/map/datums.js +16 -0
  12. package/dist/es/map/extent.js +129 -0
  13. package/dist/es/map/layers/bubble.js +185 -0
  14. package/dist/es/map/layers/layer.js +140 -0
  15. package/dist/es/map/layers/marker.js +347 -0
  16. package/dist/es/map/layers/shape.js +389 -0
  17. package/dist/es/map/layers/tile.js +491 -0
  18. package/dist/es/map/location.js +201 -0
  19. package/dist/es/map/map.js +945 -0
  20. package/dist/es/map/navigator.js +175 -0
  21. package/dist/es/map/scroller/draggable.js +454 -0
  22. package/dist/es/map/scroller/fx.js +119 -0
  23. package/dist/es/map/scroller/observable.js +175 -0
  24. package/dist/es/map/scroller/scroller.js +746 -0
  25. package/dist/es/map/scroller/user-events.js +713 -0
  26. package/dist/es/map/utils.js +450 -0
  27. package/dist/es/map/zoom.js +139 -0
  28. package/dist/es/map.js +1 -0
  29. package/dist/es/services/map-service.js +15 -0
  30. package/dist/es2015/common/keys.js +25 -0
  31. package/dist/es2015/common.js +1 -0
  32. package/dist/es2015/drawing-utils.js +43 -3
  33. package/dist/es2015/main.js +1 -0
  34. package/dist/es2015/map/attribution.js +148 -0
  35. package/dist/es2015/map/crs.js +233 -0
  36. package/dist/es2015/map/datums.js +16 -0
  37. package/dist/es2015/map/extent.js +115 -0
  38. package/dist/es2015/map/layers/bubble.js +167 -0
  39. package/dist/es2015/map/layers/layer.js +134 -0
  40. package/dist/es2015/map/layers/marker.js +327 -0
  41. package/dist/es2015/map/layers/shape.js +369 -0
  42. package/dist/es2015/map/layers/tile.js +465 -0
  43. package/dist/es2015/map/location.js +193 -0
  44. package/dist/es2015/map/map.js +915 -0
  45. package/dist/es2015/map/navigator.js +170 -0
  46. package/dist/es2015/map/scroller/draggable.js +418 -0
  47. package/dist/es2015/map/scroller/fx.js +112 -0
  48. package/dist/es2015/map/scroller/observable.js +165 -0
  49. package/dist/es2015/map/scroller/scroller.js +716 -0
  50. package/dist/es2015/map/scroller/user-events.js +695 -0
  51. package/dist/es2015/map/utils.js +450 -0
  52. package/dist/es2015/map/zoom.js +134 -0
  53. package/dist/es2015/map.js +1 -0
  54. package/dist/es2015/services/map-service.js +15 -0
  55. package/dist/npm/main.d.ts +1 -0
  56. package/dist/npm/main.js +6218 -342
  57. package/dist/npm/map.d.ts +4 -0
  58. package/dist/systemjs/kendo-charts.js +1 -1
  59. package/package.json +1 -1
@@ -0,0 +1,25 @@
1
+ var keys = {
2
+ INSERT: 45,
3
+ DELETE: 46,
4
+ BACKSPACE: 8,
5
+ TAB: 9,
6
+ ENTER: 13,
7
+ ESC: 27,
8
+ LEFT: 37,
9
+ UP: 38,
10
+ RIGHT: 39,
11
+ DOWN: 40,
12
+ END: 35,
13
+ HOME: 36,
14
+ SPACEBAR: 32,
15
+ PAGEUP: 33,
16
+ PAGEDOWN: 34,
17
+ F2: 113,
18
+ F10: 121,
19
+ F12: 123,
20
+ NUMPAD_PLUS: 107,
21
+ NUMPAD_MINUS: 109,
22
+ NUMPAD_DOT: 110
23
+ };
24
+
25
+ export default keys;
package/dist/es/common.js CHANGED
@@ -30,5 +30,6 @@ export { default as elementScale } from './common/element-scale';
30
30
  export { default as autoTextColor } from './common/auto-text-color';
31
31
  export { default as createHashSet } from './common/create-hash-set';
32
32
  export { default as defaultErrorHandler } from './common/default-error-handler';
33
+ export { default as keys } from './common/keys';
33
34
 
34
35
  export * from './drawing-utils';
@@ -1,4 +1,8 @@
1
- import { drawing, Class, logToConsole } from '@progress/kendo-drawing';
1
+ import {
2
+ drawing,
3
+ Class,
4
+ logToConsole
5
+ } from '@progress/kendo-drawing';
2
6
 
3
7
  var ref = drawing.util;
4
8
  var append = ref.append;
@@ -7,8 +11,9 @@ var defined = ref.defined;
7
11
  var deg = ref.deg;
8
12
  var elementOffset = ref.elementOffset;
9
13
  var elementSize = ref.elementSize;
10
- var eventElement = ref.eventElement;
11
14
  var eventCoordinates = ref.eventCoordinates;
15
+ var eventElement = ref.eventElement;
16
+ var hashKey = ref.hashKey;
12
17
  var last = ref.last;
13
18
  var limitValue = ref.limitValue;
14
19
  var objectKey = ref.objectKey;
@@ -17,4 +22,23 @@ var round = ref.round;
17
22
  var unbindEvents = ref.unbindEvents;
18
23
  var valueOrDefault = ref.valueOrDefault;
19
24
 
20
- export { append, bindEvents, Class, defined, deg, elementOffset, elementSize, eventElement, eventCoordinates, last, limitValue, logToConsole, objectKey, rad, round, unbindEvents, valueOrDefault };
25
+ export {
26
+ append,
27
+ bindEvents,
28
+ Class,
29
+ defined,
30
+ deg,
31
+ elementOffset,
32
+ elementSize,
33
+ eventCoordinates,
34
+ eventElement,
35
+ hashKey,
36
+ last,
37
+ limitValue,
38
+ logToConsole,
39
+ objectKey,
40
+ rad,
41
+ round,
42
+ unbindEvents,
43
+ valueOrDefault
44
+ };
package/dist/es/main.js CHANGED
@@ -6,6 +6,7 @@ export * from './stock';
6
6
  export * from './gauges';
7
7
  export * from './barcode';
8
8
  export * from './qrcode';
9
+ export * from './map';
9
10
  export * from './common';
10
11
 
11
12
  export { baseTheme as chartBaseTheme } from './chart/base-theme';
@@ -0,0 +1,158 @@
1
+ import {
2
+ addClass,
3
+ defined,
4
+ valueOrDefault,
5
+ deepExtend,
6
+ setDefaultOptions
7
+ } from '../common';
8
+
9
+ import TemplateService from '../services/template-service';
10
+
11
+ import {
12
+ appendHtml,
13
+ removeChildren
14
+ } from './utils';
15
+
16
+ import { Observable } from './scroller/observable';
17
+
18
+ var template = TemplateService.compile;
19
+
20
+ export var Attribution = (function (Observable) {
21
+ function Attribution(element, options) {
22
+ Observable.call(this);
23
+ this.element = element;
24
+
25
+ this._initOptions(options);
26
+ this.items = [];
27
+
28
+ addClass(this.element, 'k-widget k-attribution');
29
+ }
30
+
31
+ if ( Observable ) Attribution.__proto__ = Observable;
32
+ Attribution.prototype = Object.create( Observable && Observable.prototype );
33
+ Attribution.prototype.constructor = Attribution;
34
+
35
+ Attribution.prototype._initOptions = function _initOptions (options) {
36
+ this.options = deepExtend({}, this.options, options);
37
+ };
38
+
39
+ Attribution.prototype.filter = function filter (extent, zoom) {
40
+ this._extent = extent;
41
+ this._zoom = zoom;
42
+ this._render();
43
+ };
44
+
45
+ Attribution.prototype.add = function add (item) {
46
+ var newItem = item;
47
+
48
+ if (defined(item)) {
49
+ if (typeof item === 'string') {
50
+ newItem = {
51
+ text: item
52
+ };
53
+ }
54
+
55
+ this.items.push(newItem);
56
+ this._render();
57
+ }
58
+ };
59
+
60
+ Attribution.prototype.remove = function remove (text) {
61
+ var this$1 = this;
62
+
63
+ var result = [];
64
+
65
+ for (var i = 0; i < this.items.length; i++) {
66
+ var item = this$1.items[i];
67
+
68
+ if (item.text !== text) {
69
+ result.push(item);
70
+ }
71
+ }
72
+
73
+ this.items = result;
74
+ this._render();
75
+ };
76
+
77
+ Attribution.prototype.clear = function clear () {
78
+ this.items = [];
79
+ removeChildren(this.element);
80
+ };
81
+
82
+ Attribution.prototype._render = function _render () {
83
+ var this$1 = this;
84
+
85
+ var result = [];
86
+ var itemTemplate = template(this.options.itemTemplate);
87
+
88
+ for (var i = 0; i < this.items.length; i++) {
89
+ var item = this$1.items[i];
90
+ var text = this$1._itemText(item);
91
+
92
+ if (text !== '') {
93
+ result.push(itemTemplate({
94
+ text: text
95
+ }));
96
+ }
97
+ }
98
+
99
+ if (result.length > 0) {
100
+ removeChildren(this.element);
101
+
102
+ var html = result.join(this.options.separator);
103
+ appendHtml(html, this.element);
104
+
105
+ this.showElement();
106
+ } else {
107
+ this.hideElement();
108
+ }
109
+ };
110
+
111
+ Attribution.prototype.hideElement = function hideElement () {
112
+ this.element.style.display = "none";
113
+ };
114
+
115
+ Attribution.prototype.showElement = function showElement () {
116
+ this.element.style.display = "";
117
+ };
118
+
119
+ Attribution.prototype._itemText = function _itemText (item) {
120
+ var text = '';
121
+ var inZoomLevel = this._inZoomLevel(item.minZoom, item.maxZoom);
122
+ var inArea = this._inArea(item.extent);
123
+
124
+ if (inZoomLevel && inArea) {
125
+ text += item.text;
126
+ }
127
+
128
+ return text;
129
+ };
130
+
131
+ Attribution.prototype._inZoomLevel = function _inZoomLevel (min, max) {
132
+ var result = true;
133
+ var newMin = valueOrDefault(min, -Number.MAX_VALUE);
134
+ var newMax = valueOrDefault(max, Number.MAX_VALUE);
135
+
136
+ result = this._zoom > newMin && this._zoom < newMax;
137
+ return result;
138
+ };
139
+
140
+ Attribution.prototype._inArea = function _inArea (area) {
141
+ var result = true;
142
+
143
+ if (area) {
144
+ result = area.contains(this._extent);
145
+ }
146
+
147
+ return result;
148
+ };
149
+
150
+ return Attribution;
151
+ }(Observable));
152
+
153
+ setDefaultOptions(Attribution, {
154
+ name: 'Attribution',
155
+ separator: '&nbsp;|&nbsp;',
156
+ itemTemplate: '#= text #'
157
+ });
158
+
@@ -0,0 +1,277 @@
1
+ import {
2
+ geometry as g
3
+ } from '@progress/kendo-drawing';
4
+
5
+ import {
6
+ Class,
7
+ setDefaultOptions,
8
+ limitValue,
9
+ rad,
10
+ deg,
11
+ deepExtend
12
+ } from '../common';
13
+
14
+ import {
15
+ Location
16
+ } from './location';
17
+
18
+ import {
19
+ datums
20
+ } from './datums';
21
+
22
+
23
+ var math = Math,
24
+ atan = math.atan,
25
+ exp = math.exp,
26
+ pow = math.pow,
27
+ sin = math.sin,
28
+ log = math.log,
29
+ tan = math.tan,
30
+ Point = g.Point;
31
+
32
+ var PI = math.PI,
33
+ PI_DIV_2 = PI / 2,
34
+ PI_DIV_4 = PI / 4,
35
+ DEG_TO_RAD = PI / 180;
36
+
37
+ var WGS84 = datums.WGS84;
38
+
39
+ // WGS 84 / World Mercator
40
+ export var Mercator = (function (Class) {
41
+ function Mercator(options) {
42
+ Class.call(this);
43
+ this.initProperties();
44
+ this._initOptions(options);
45
+ }
46
+
47
+ if ( Class ) Mercator.__proto__ = Class;
48
+ Mercator.prototype = Object.create( Class && Class.prototype );
49
+ Mercator.prototype.constructor = Mercator;
50
+
51
+ Mercator.prototype._initOptions = function _initOptions (options) {
52
+ this.options = deepExtend({}, this.options, options);
53
+ };
54
+
55
+ Mercator.prototype.initProperties = function initProperties () {
56
+ // super.initProperties();
57
+
58
+ deepExtend(this, {
59
+ MAX_LNG: 180,
60
+ MAX_LAT: 85.0840590501,
61
+ INVERSE_ITERATIONS: 15,
62
+ INVERSE_CONVERGENCE: 1e-12
63
+ });
64
+ };
65
+
66
+ Mercator.prototype.forward = function forward (loc, clamp) {
67
+ var proj = this,
68
+ options = proj.options,
69
+ datum = options.datum,
70
+ r = datum.a,
71
+ lng0 = options.centralMeridian,
72
+ lat = limitValue(loc.lat, -proj.MAX_LAT, proj.MAX_LAT),
73
+ lng = clamp ? limitValue(loc.lng, -proj.MAX_LNG, proj.MAX_LNG) : loc.lng,
74
+ x = rad(lng - lng0) * r,
75
+ y = proj._projectLat(lat);
76
+ return new Point(x, y);
77
+ };
78
+ Mercator.prototype._projectLat = function _projectLat (lat) {
79
+ var datum = this.options.datum,
80
+ ecc = datum.e,
81
+ r = datum.a,
82
+ y = rad(lat),
83
+ ts = tan(PI_DIV_4 + y / 2),
84
+ con = ecc * sin(y),
85
+ p = pow((1 - con) / (1 + con), ecc / 2);
86
+
87
+ // See: http://en.wikipedia.org/wiki/Mercator_projection#Generalization_to_the_ellipsoid
88
+ return r * log(ts * p);
89
+ };
90
+ Mercator.prototype.inverse = function inverse (point, clamp) {
91
+ var proj = this,
92
+ options = proj.options,
93
+ datum = options.datum,
94
+ r = datum.a,
95
+ lng0 = options.centralMeridian,
96
+ lng = point.x / (DEG_TO_RAD * r) + lng0,
97
+ lat = limitValue(proj._inverseY(point.y), -proj.MAX_LAT, proj.MAX_LAT);
98
+ if (clamp) {
99
+ lng = limitValue(lng, -proj.MAX_LNG, proj.MAX_LNG);
100
+ }
101
+ return new Location(lat, lng);
102
+ };
103
+ Mercator.prototype._inverseY = function _inverseY (y) {
104
+ var proj = this,
105
+ datum = proj.options.datum,
106
+ r = datum.a,
107
+ ecc = datum.e,
108
+ ecch = ecc / 2,
109
+ ts = exp(-y / r),
110
+ phi = PI_DIV_2 - 2 * atan(ts),
111
+ i;
112
+ for (i = 0; i <= proj.INVERSE_ITERATIONS; i++) {
113
+ var con = ecc * sin(phi),
114
+ p = pow((1 - con) / (1 + con), ecch),
115
+ dphi = PI_DIV_2 - 2 * atan(ts * p) - phi;
116
+ phi += dphi;
117
+ if (math.abs(dphi) <= proj.INVERSE_CONVERGENCE) {
118
+ break;
119
+ }
120
+ }
121
+ return deg(phi);
122
+ };
123
+
124
+ return Mercator;
125
+ }(Class));
126
+
127
+ setDefaultOptions(Mercator, {
128
+ centralMeridian: 0,
129
+ datum: WGS84
130
+ });
131
+
132
+
133
+ // WGS 84 / Pseudo-Mercator
134
+ // Used by Google Maps, Bing, OSM, etc.
135
+ // Spherical projection of ellipsoidal coordinates.
136
+ export var SphericalMercator = (function (Mercator) {
137
+ function SphericalMercator () {
138
+ Mercator.apply(this, arguments);
139
+ }
140
+
141
+ if ( Mercator ) SphericalMercator.__proto__ = Mercator;
142
+ SphericalMercator.prototype = Object.create( Mercator && Mercator.prototype );
143
+ SphericalMercator.prototype.constructor = SphericalMercator;
144
+
145
+ SphericalMercator.prototype.initProperties = function initProperties () {
146
+ Mercator.prototype.initProperties.call(this);
147
+
148
+ deepExtend(this, {
149
+ MAX_LAT: 85.0511287798
150
+ });
151
+ };
152
+
153
+ SphericalMercator.prototype._projectLat = function _projectLat (lat) {
154
+ var r = this.options.datum.a,
155
+ y = rad(lat),
156
+ ts = tan(PI_DIV_4 + y / 2);
157
+ return r * log(ts);
158
+ };
159
+
160
+ SphericalMercator.prototype._inverseY = function _inverseY (y) {
161
+ var r = this.options.datum.a,
162
+ ts = exp(-y / r);
163
+ return deg(PI_DIV_2 - 2 * atan(ts));
164
+ };
165
+
166
+ return SphericalMercator;
167
+ }(Mercator));
168
+
169
+ export var Equirectangular = (function (Class) {
170
+ function Equirectangular () {
171
+ Class.apply(this, arguments);
172
+ }
173
+
174
+ if ( Class ) Equirectangular.__proto__ = Class;
175
+ Equirectangular.prototype = Object.create( Class && Class.prototype );
176
+ Equirectangular.prototype.constructor = Equirectangular;
177
+
178
+ Equirectangular.prototype.forward = function forward (loc) {
179
+ return new Point(loc.lng, loc.lat);
180
+ };
181
+ Equirectangular.prototype.inverse = function inverse (point) {
182
+ return new Location(point.y, point.x);
183
+ };
184
+
185
+ return Equirectangular;
186
+ }(Class));
187
+
188
+ // This is the projected coordinate system used for rendering maps in Google Maps, OpenStreetMap, etc
189
+ // Unit: metre
190
+ // Geodetic CRS: WGS 84
191
+ // Scope: Certain Web mapping and visualisation applications. It is not a recognised geodetic system: for that see ellipsoidal Mercator CRS code 3395 (WGS 84 / World Mercator).
192
+ // Remarks: Uses spherical development of ellipsoidal coordinates. Relative to WGS 84 / World Mercator (CRS code 3395) errors of 0.7 percent in scale and differences in northing of up to 43km in the map (equivalent to 21km on the ground) may arise.
193
+ // Area of use: World between 85.06°S and 85.06°N.
194
+ // Coordinate system: Cartesian 2D CS. Axes: easting, northing (X,Y). Orientations: east, north. UoM: m.
195
+ // https://epsg.io/3857
196
+ export var EPSG3857 = (function (Class) {
197
+ function EPSG3857() {
198
+ Class.call(this);
199
+ var crs = this,
200
+ proj = crs._proj = new SphericalMercator();
201
+ var c = this.c = 2 * PI * proj.options.datum.a;
202
+
203
+ // transfrom matrix
204
+ // Scale circumference to 1, mirror Y and shift origin to top left
205
+ this._tm = g.transform().translate(0.5, 0.5).scale(1 / c, -1 / c);
206
+
207
+ // Inverse transform matrix
208
+ this._itm = g.transform().scale(c, -c).translate(-0.5, -0.5);
209
+ }
210
+
211
+ if ( Class ) EPSG3857.__proto__ = Class;
212
+ EPSG3857.prototype = Object.create( Class && Class.prototype );
213
+ EPSG3857.prototype.constructor = EPSG3857;
214
+
215
+ // Location <-> Point (screen coordinates for a given scale)
216
+ EPSG3857.prototype.toPoint = function toPoint (loc, scale, clamp) {
217
+ var point = this._proj.forward(loc, clamp);
218
+ return point.transform(this._tm).scale(scale || 1);
219
+ };
220
+ EPSG3857.prototype.toLocation = function toLocation (point, scale, clamp) {
221
+ var newPoint = point.clone().scale(1 / (scale || 1)).transform(this._itm);
222
+ return this._proj.inverse(newPoint, clamp);
223
+ };
224
+
225
+ return EPSG3857;
226
+ }(Class));
227
+
228
+ // Unit: metre
229
+ // Geodetic CRS: WGS 84
230
+ // Scope: Very small scale mapping.
231
+ // Remarks: Euro-centric view of world excluding polar areas.
232
+ // Area of use: World between 80°S and 84°N.
233
+ // Coordinate system: Cartesian 2D CS. Axes: easting, northing (E,N). Orientations: east, north. UoM: m.
234
+ // https://epsg.io/3395
235
+ export var EPSG3395 = (function (Class) {
236
+ function EPSG3395() {
237
+ Class.call(this);
238
+ this._proj = new Mercator();
239
+ }
240
+
241
+ if ( Class ) EPSG3395.__proto__ = Class;
242
+ EPSG3395.prototype = Object.create( Class && Class.prototype );
243
+ EPSG3395.prototype.constructor = EPSG3395;
244
+ EPSG3395.prototype.toPoint = function toPoint (loc) {
245
+ return this._proj.forward(loc);
246
+ };
247
+ EPSG3395.prototype.toLocation = function toLocation (point) {
248
+ return this._proj.inverse(point);
249
+ };
250
+
251
+ return EPSG3395;
252
+ }(Class));
253
+
254
+ // Unit: degree
255
+ // Geodetic CRS: WGS 84
256
+ // Scope: Horizontal component of 3D system. Used by the GPS satellite navigation system and for NATO military geodetic surveying.
257
+ // Area of use: World.
258
+ // Coordinate system: Ellipsoidal 2D CS. Axes: latitude, longitude. Orientations: north, east. UoM: degree
259
+ // https://epsg.io/4326
260
+ export var EPSG4326 = (function (Class) {
261
+ function EPSG4326() {
262
+ Class.call(this);
263
+ this._proj = new Equirectangular();
264
+ }
265
+
266
+ if ( Class ) EPSG4326.__proto__ = Class;
267
+ EPSG4326.prototype = Object.create( Class && Class.prototype );
268
+ EPSG4326.prototype.constructor = EPSG4326;
269
+ EPSG4326.prototype.toPoint = function toPoint (loc) {
270
+ return this._proj.forward(loc);
271
+ };
272
+ EPSG4326.prototype.toLocation = function toLocation (point) {
273
+ return this._proj.inverse(point);
274
+ };
275
+
276
+ return EPSG4326;
277
+ }(Class));
@@ -0,0 +1,16 @@
1
+ // Coordinate reference system
2
+ // World Geodetic System of 1984
3
+ var WGS84 = {
4
+ a: 6378137, // Semi-major radius
5
+ b: 6356752.314245179, // Semi-minor radius
6
+ f: 0.0033528106647474805, // Flattening
7
+ e: 0.08181919084262149 // Eccentricity
8
+ };
9
+
10
+ // Geographic coordinate systems use a spheroid to calculate positions on the earth.
11
+ // A datum defines the position of the spheroid relative to the center of the earth
12
+ // it provides a frame of reference for measuring locations on the surface of the earth
13
+ // and defines the origin and orientation of latitude and longitude lines.
14
+ export var datums = {
15
+ WGS84: WGS84
16
+ };
@@ -0,0 +1,129 @@
1
+ import {
2
+ Class,
3
+ valueOrDefault
4
+ } from '../common';
5
+
6
+ import { Location } from './location';
7
+
8
+ var math = Math,
9
+ max = math.max,
10
+ min = math.min;
11
+
12
+ export var Extent = (function (Class) {
13
+ function Extent(initialNw, initialSe) {
14
+ Class.call(this);
15
+ var nw = Location.create(initialNw);
16
+ var se = Location.create(initialSe);
17
+
18
+ if (nw.lng + 180 > se.lng + 180 && nw.lat + 90 < se.lat + 90) {
19
+ this.se = nw;
20
+ this.nw = se;
21
+ } else {
22
+ this.se = se;
23
+ this.nw = nw;
24
+ }
25
+ }
26
+
27
+ if ( Class ) Extent.__proto__ = Class;
28
+ Extent.prototype = Object.create( Class && Class.prototype );
29
+ Extent.prototype.constructor = Extent;
30
+
31
+ var staticAccessors = { World: { configurable: true } };
32
+
33
+ Extent.prototype.contains = function contains (loc) {
34
+ var nw = this.nw, se = this.se, lng = valueOrDefault(loc.lng, loc[1]), lat = valueOrDefault(loc.lat, loc[0]);
35
+
36
+ return loc &&
37
+ lng + 180 >= nw.lng + 180 && lng + 180 <= se.lng + 180 &&
38
+ lat + 90 >= se.lat + 90 && lat + 90 <= nw.lat + 90;
39
+ };
40
+
41
+ Extent.prototype.center = function center () {
42
+ var nw = this.nw;
43
+ var se = this.se;
44
+ var lng = nw.lng + (se.lng - nw.lng) / 2;
45
+ var lat = nw.lat + (se.lat - nw.lat) / 2;
46
+
47
+ return new Location(lat, lng);
48
+ };
49
+
50
+ Extent.prototype.containsAny = function containsAny (locs) {
51
+ var this$1 = this;
52
+
53
+ var result = false;
54
+
55
+ for (var i = 0; i < locs.length; i++) {
56
+ result = result || this$1.contains(locs[i]);
57
+ }
58
+
59
+ return result;
60
+ };
61
+
62
+ Extent.prototype.include = function include (loc) {
63
+ var nw = this.nw, se = this.se, lng = valueOrDefault(loc.lng, loc[1]), lat = valueOrDefault(loc.lat, loc[0]);
64
+
65
+ nw.lng = min(nw.lng, lng);
66
+ nw.lat = max(nw.lat, lat);
67
+ se.lng = max(se.lng, lng);
68
+ se.lat = min(se.lat, lat);
69
+ };
70
+
71
+ Extent.prototype.includeAll = function includeAll (locs) {
72
+ var this$1 = this;
73
+
74
+ for (var i = 0; i < locs.length; i++) {
75
+ this$1.include(locs[i]);
76
+ }
77
+ };
78
+
79
+ Extent.prototype.edges = function edges () {
80
+ var nw = this.nw, se = this.se;
81
+
82
+ return {
83
+ nw: this.nw,
84
+ ne: new Location(nw.lat, se.lng),
85
+ se: this.se,
86
+ sw: new Location(se.lat, nw.lng)
87
+ };
88
+ };
89
+
90
+ Extent.prototype.toArray = function toArray () {
91
+ var nw = this.nw, se = this.se;
92
+
93
+ return [
94
+ nw,
95
+ new Location(nw.lat, se.lng),
96
+ se,
97
+ new Location(se.lat, nw.lng)
98
+ ];
99
+ };
100
+
101
+ Extent.prototype.overlaps = function overlaps (extent) {
102
+ return this.containsAny(extent.toArray()) ||
103
+ extent.containsAny(this.toArray());
104
+ };
105
+
106
+ Extent.create = function create (a, b) {
107
+ if (a instanceof Extent) {
108
+ return a;
109
+ } else if (a && b) {
110
+ return new Extent(a, b);
111
+ } else if (a && a.length === 4 && !b) {
112
+ return new Extent([
113
+ a[0],
114
+ a[1]
115
+ ], [
116
+ a[2],
117
+ a[3]
118
+ ]);
119
+ }
120
+ };
121
+
122
+ staticAccessors.World.get = function () {
123
+ return new Extent([ 90, -180 ], [ -90, 180 ]);
124
+ };
125
+
126
+ Object.defineProperties( Extent, staticAccessors );
127
+
128
+ return Extent;
129
+ }(Class));