@swissgeo/coordinates 1.0.2 → 1.0.3

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/dist/ol.js CHANGED
@@ -1,317 +1,5 @@
1
- import { L as g, D as G } from "./index-DZ4q3KlK.js";
2
- const a = {
3
- UNKNOWN: 0,
4
- INTERSECTING: 1,
5
- ABOVE: 2,
6
- RIGHT: 4,
7
- BELOW: 8,
8
- LEFT: 16
9
- };
10
- function C(e, t) {
11
- const n = e[0], r = e[1], i = e[2], s = e[3], o = t[0], l = t[1];
12
- let u = a.UNKNOWN;
13
- return o < n ? u = u | a.LEFT : o > i && (u = u | a.RIGHT), l < r ? u = u | a.BELOW : l > s && (u = u | a.ABOVE), u === a.UNKNOWN && (u = a.INTERSECTING), u;
14
- }
15
- function $() {
16
- return [1 / 0, 1 / 0, -1 / 0, -1 / 0];
17
- }
18
- function j(e, t, n, r, i) {
19
- return i ? (i[0] = e, i[1] = t, i[2] = n, i[3] = r, i) : [e, t, n, r];
20
- }
21
- function q(e, t, n, r, i) {
22
- for (; n < r; n += i)
23
- v(e, t[n], t[n + 1]);
24
- return e;
25
- }
26
- function v(e, t, n) {
27
- e[0] = Math.min(e[0], t), e[1] = Math.min(e[1], n), e[2] = Math.max(e[2], t), e[3] = Math.max(e[3], n);
28
- }
29
- function K(e) {
30
- return [e[0], e[3]];
31
- }
32
- function J(e, t) {
33
- return e[0] <= t[2] && e[2] >= t[0] && e[1] <= t[3] && e[3] >= t[1];
34
- }
35
- function k(e, t, n) {
36
- let r = !1;
37
- const i = C(e, t), s = C(e, n);
38
- if (i === a.INTERSECTING || s === a.INTERSECTING)
39
- r = !0;
40
- else {
41
- const o = e[0], l = e[1], u = e[2], h = e[3], c = t[0], f = t[1], _ = n[0], R = n[1], I = (R - f) / (_ - c);
42
- let E, x;
43
- s & a.ABOVE && !(i & a.ABOVE) && (E = _ - (R - h) / I, r = E >= o && E <= u), !r && s & a.RIGHT && !(i & a.RIGHT) && (x = R - (_ - u) * I, r = x >= l && x <= h), !r && s & a.BELOW && !(i & a.BELOW) && (E = _ - (R - l) / I, r = E >= o && E <= u), !r && s & a.LEFT && !(i & a.LEFT) && (x = R - (_ - o) * I, r = x >= l && x <= h);
44
- }
45
- return r;
46
- }
47
- function Q(e, t, n) {
48
- return Math.min(Math.max(e, t), n);
49
- }
50
- function V(e, t) {
51
- const n = Math.pow(10, t);
52
- return Math.round(e * n) / n;
53
- }
54
- function P(e, t) {
55
- return Math.floor(V(e, t));
56
- }
57
- function F(e, t) {
58
- return Math.ceil(V(e, t));
59
- }
60
- const p = {
61
- // use the radius of the Normal sphere
62
- radians: 6370997 / (2 * Math.PI),
63
- degrees: 2 * Math.PI * 6370997 / 360,
64
- ft: 0.3048,
65
- m: 1,
66
- "us-ft": 1200 / 3937
67
- };
68
- class D {
69
- /**
70
- * @param {Options} options Projection options.
71
- */
72
- constructor(t) {
73
- this.code_ = t.code, this.units_ = /** @type {import("./Units.js").Units} */
74
- t.units, this.extent_ = t.extent !== void 0 ? t.extent : null, this.worldExtent_ = t.worldExtent !== void 0 ? t.worldExtent : null, this.axisOrientation_ = t.axisOrientation !== void 0 ? t.axisOrientation : "enu", this.global_ = t.global !== void 0 ? t.global : !1, this.canWrapX_ = !!(this.global_ && this.extent_), this.getPointResolutionFunc_ = t.getPointResolution, this.defaultTileGrid_ = null, this.metersPerUnit_ = t.metersPerUnit;
75
- }
76
- /**
77
- * @return {boolean} The projection is suitable for wrapping the x-axis
78
- */
79
- canWrapX() {
80
- return this.canWrapX_;
81
- }
82
- /**
83
- * Get the code for this projection, e.g. 'EPSG:4326'.
84
- * @return {string} Code.
85
- * @api
86
- */
87
- getCode() {
88
- return this.code_;
89
- }
90
- /**
91
- * Get the validity extent for this projection.
92
- * @return {import("../extent.js").Extent} Extent.
93
- * @api
94
- */
95
- getExtent() {
96
- return this.extent_;
97
- }
98
- /**
99
- * Get the units of this projection.
100
- * @return {import("./Units.js").Units} Units.
101
- * @api
102
- */
103
- getUnits() {
104
- return this.units_;
105
- }
106
- /**
107
- * Get the amount of meters per unit of this projection. If the projection is
108
- * not configured with `metersPerUnit` or a units identifier, the return is
109
- * `undefined`.
110
- * @return {number|undefined} Meters.
111
- * @api
112
- */
113
- getMetersPerUnit() {
114
- return this.metersPerUnit_ || p[this.units_];
115
- }
116
- /**
117
- * Get the world extent for this projection.
118
- * @return {import("../extent.js").Extent} Extent.
119
- * @api
120
- */
121
- getWorldExtent() {
122
- return this.worldExtent_;
123
- }
124
- /**
125
- * Get the axis orientation of this projection.
126
- * Example values are:
127
- * enu - the default easting, northing, elevation.
128
- * neu - northing, easting, up - useful for "lat/long" geographic coordinates,
129
- * or south orientated transverse mercator.
130
- * wnu - westing, northing, up - some planetary coordinate systems have
131
- * "west positive" coordinate systems
132
- * @return {string} Axis orientation.
133
- * @api
134
- */
135
- getAxisOrientation() {
136
- return this.axisOrientation_;
137
- }
138
- /**
139
- * Is this projection a global projection which spans the whole world?
140
- * @return {boolean} Whether the projection is global.
141
- * @api
142
- */
143
- isGlobal() {
144
- return this.global_;
145
- }
146
- /**
147
- * Set if the projection is a global projection which spans the whole world
148
- * @param {boolean} global Whether the projection is global.
149
- * @api
150
- */
151
- setGlobal(t) {
152
- this.global_ = t, this.canWrapX_ = !!(t && this.extent_);
153
- }
154
- /**
155
- * @return {import("../tilegrid/TileGrid.js").default} The default tile grid.
156
- */
157
- getDefaultTileGrid() {
158
- return this.defaultTileGrid_;
159
- }
160
- /**
161
- * @param {import("../tilegrid/TileGrid.js").default} tileGrid The default tile grid.
162
- */
163
- setDefaultTileGrid(t) {
164
- this.defaultTileGrid_ = t;
165
- }
166
- /**
167
- * Set the validity extent for this projection.
168
- * @param {import("../extent.js").Extent} extent Extent.
169
- * @api
170
- */
171
- setExtent(t) {
172
- this.extent_ = t, this.canWrapX_ = !!(this.global_ && t);
173
- }
174
- /**
175
- * Set the world extent for this projection.
176
- * @param {import("../extent.js").Extent} worldExtent World extent
177
- * [minlon, minlat, maxlon, maxlat].
178
- * @api
179
- */
180
- setWorldExtent(t) {
181
- this.worldExtent_ = t;
182
- }
183
- /**
184
- * Set the getPointResolution function (see {@link module:ol/proj.getPointResolution}
185
- * for this projection.
186
- * @param {function(number, import("../coordinate.js").Coordinate):number} func Function
187
- * @api
188
- */
189
- setGetPointResolution(t) {
190
- this.getPointResolutionFunc_ = t;
191
- }
192
- /**
193
- * Get the custom point resolution function for this projection (if set).
194
- * @return {GetPointResolution|undefined} The custom point
195
- * resolution function (if set).
196
- */
197
- getPointResolutionFunc() {
198
- return this.getPointResolutionFunc_;
199
- }
200
- }
201
- const w = 6378137, Y = Math.PI * w, tt = [-Y, -Y, Y, Y], it = [-180, -85, 180, 85], O = w * Math.log(Math.tan(Math.PI / 2));
202
- class T extends D {
203
- /**
204
- * @param {string} code Code.
205
- */
206
- constructor(t) {
207
- super({
208
- code: t,
209
- units: "m",
210
- extent: tt,
211
- global: !0,
212
- worldExtent: it,
213
- getPointResolution: function(n, r) {
214
- return n / Math.cosh(r[1] / w);
215
- }
216
- });
217
- }
218
- }
219
- const b = [
220
- new T("EPSG:3857"),
221
- new T("EPSG:102100"),
222
- new T("EPSG:102113"),
223
- new T("EPSG:900913"),
224
- new T("http://www.opengis.net/def/crs/EPSG/0/3857"),
225
- new T("http://www.opengis.net/gml/srs/epsg.xml#3857")
226
- ];
227
- function nt(e, t, n, r) {
228
- const i = e.length;
229
- n = n > 1 ? n : 2, r = r ?? n, t === void 0 && (n > 2 ? t = e.slice() : t = new Array(i));
230
- for (let s = 0; s < i; s += r) {
231
- t[s] = Y * e[s] / 180;
232
- let o = w * Math.log(Math.tan(Math.PI * (+e[s + 1] + 90) / 360));
233
- o > O ? o = O : o < -O && (o = -O), t[s + 1] = o;
234
- }
235
- return t;
236
- }
237
- function et(e, t, n, r) {
238
- const i = e.length;
239
- n = n > 1 ? n : 2, r = r ?? n, t === void 0 && (n > 2 ? t = e.slice() : t = new Array(i));
240
- for (let s = 0; s < i; s += r)
241
- t[s] = 180 * e[s] / Y, t[s + 1] = 360 * Math.atan(Math.exp(e[s + 1] / w)) / Math.PI - 90;
242
- return t;
243
- }
244
- const rt = 6378137, L = [-180, -90, 180, 90], st = Math.PI * rt / 180;
245
- class d extends D {
246
- /**
247
- * @param {string} code Code.
248
- * @param {string} [axisOrientation] Axis orientation.
249
- */
250
- constructor(t, n) {
251
- super({
252
- code: t,
253
- units: "degrees",
254
- extent: L,
255
- axisOrientation: n,
256
- global: !0,
257
- metersPerUnit: st,
258
- worldExtent: L
259
- });
260
- }
261
- }
262
- const U = [
263
- new d("CRS:84"),
264
- new d("EPSG:4326", "neu"),
265
- new d("urn:ogc:def:crs:OGC:1.3:CRS84"),
266
- new d("urn:ogc:def:crs:OGC:2:84"),
267
- new d("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),
268
- new d("http://www.opengis.net/gml/srs/epsg.xml#4326", "neu"),
269
- new d("http://www.opengis.net/def/crs/EPSG/0/4326", "neu")
270
- ];
271
- let N = {};
272
- function A(e, t, n) {
273
- const r = e.getCode(), i = t.getCode();
274
- r in N || (N[r] = {}), N[r][i] = n;
275
- }
276
- function B(e, t) {
277
- if (t !== void 0) {
278
- for (let n = 0, r = e.length; n < r; ++n)
279
- t[n] = e[n];
280
- t = t;
281
- } else
282
- t = e.slice();
283
- return t;
284
- }
285
- function ot(e) {
286
- e.getCode(), A(e, e, B);
287
- }
288
- function lt(e) {
289
- e.forEach(ot);
290
- }
291
- function W(e) {
292
- lt(e), e.forEach(function(t) {
293
- e.forEach(function(n) {
294
- t !== n && A(t, n, B);
295
- });
296
- });
297
- }
298
- function ut(e, t, n, r) {
299
- e.forEach(function(i) {
300
- t.forEach(function(s) {
301
- A(i, s, n), A(s, i, r);
302
- });
303
- });
304
- }
305
- function ht() {
306
- W(b), W(U), ut(
307
- U,
308
- b,
309
- nt,
310
- et
311
- );
312
- }
313
- ht();
314
- class H {
1
+ import { L as f, D as G } from "./index-C-LPtO1W.js";
2
+ class V {
315
3
  /**
316
4
  * @param {number} minX Minimum X.
317
5
  * @param {number} maxX Maximum X.
@@ -382,13 +70,13 @@ class H {
382
70
  return this.minX <= t.maxX && this.maxX >= t.minX && this.minY <= t.maxY && this.maxY >= t.minY;
383
71
  }
384
72
  }
385
- function S(e, t, n, r, i) {
386
- return i !== void 0 ? (i.minX = e, i.maxX = t, i.minY = n, i.maxY = r, i) : new H(e, t, n, r);
73
+ function x(e, t, n, r, i) {
74
+ return i !== void 0 ? (i.minX = e, i.maxX = t, i.minY = n, i.maxY = r, i) : new V(e, t, n, r);
387
75
  }
388
- function ct(e, t) {
76
+ function j(e, t) {
389
77
  return e > t ? 1 : e < t ? -1 : 0;
390
78
  }
391
- function at(e, t, n) {
79
+ function q(e, t, n) {
392
80
  if (e[0] <= t)
393
81
  return 0;
394
82
  const r = e.length;
@@ -424,20 +112,65 @@ function at(e, t, n) {
424
112
  }
425
113
  return r - 1;
426
114
  }
427
- function ft(e, t, n) {
428
- const r = t || ct;
429
- return e.every(function(i, s) {
430
- if (s === 0)
431
- return !0;
432
- const o = r(e[s - 1], i);
433
- return !(o > 0 || o === 0);
434
- });
115
+ function v(e, t, n) {
116
+ const r = t || j;
117
+ return e.every(function(i, s) {
118
+ if (s === 0)
119
+ return !0;
120
+ const o = r(e[s - 1], i);
121
+ return !(o > 0 || o === 0);
122
+ });
123
+ }
124
+ function M(e, t) {
125
+ if (!e)
126
+ throw new Error(t);
127
+ }
128
+ const a = {
129
+ UNKNOWN: 0,
130
+ INTERSECTING: 1,
131
+ ABOVE: 2,
132
+ RIGHT: 4,
133
+ BELOW: 8,
134
+ LEFT: 16
135
+ };
136
+ function C(e, t) {
137
+ const n = e[0], r = e[1], i = e[2], s = e[3], o = t[0], l = t[1];
138
+ let u = a.UNKNOWN;
139
+ return o < n ? u = u | a.LEFT : o > i && (u = u | a.RIGHT), l < r ? u = u | a.BELOW : l > s && (u = u | a.ABOVE), u === a.UNKNOWN && (u = a.INTERSECTING), u;
140
+ }
141
+ function K() {
142
+ return [1 / 0, 1 / 0, -1 / 0, -1 / 0];
143
+ }
144
+ function J(e, t, n, r, i) {
145
+ return i ? (i[0] = e, i[1] = t, i[2] = n, i[3] = r, i) : [e, t, n, r];
435
146
  }
436
- function M(e, t) {
437
- if (!e)
438
- throw new Error(t);
147
+ function k(e, t, n, r, i) {
148
+ for (; n < r; n += i)
149
+ Q(e, t[n], t[n + 1]);
150
+ return e;
151
+ }
152
+ function Q(e, t, n) {
153
+ e[0] = Math.min(e[0], t), e[1] = Math.min(e[1], n), e[2] = Math.max(e[2], t), e[3] = Math.max(e[3], n);
439
154
  }
440
- function Z(e, t, n, r, i, s) {
155
+ function p(e) {
156
+ return [e[0], e[3]];
157
+ }
158
+ function tt(e, t) {
159
+ return e[0] <= t[2] && e[2] >= t[0] && e[1] <= t[3] && e[3] >= t[1];
160
+ }
161
+ function it(e, t, n) {
162
+ let r = !1;
163
+ const i = C(e, t), s = C(e, n);
164
+ if (i === a.INTERSECTING || s === a.INTERSECTING)
165
+ r = !0;
166
+ else {
167
+ const o = e[0], l = e[1], u = e[2], h = e[3], c = t[0], m = t[1], _ = n[0], R = n[1], I = (R - m) / (_ - c);
168
+ let E, T;
169
+ s & a.ABOVE && !(i & a.ABOVE) && (E = _ - (R - h) / I, r = E >= o && E <= u), !r && s & a.RIGHT && !(i & a.RIGHT) && (T = R - (_ - u) * I, r = T >= l && T <= h), !r && s & a.BELOW && !(i & a.BELOW) && (E = _ - (R - l) / I, r = E >= o && E <= u), !r && s & a.LEFT && !(i & a.LEFT) && (T = R - (_ - o) * I, r = T >= l && T <= h);
170
+ }
171
+ return r;
172
+ }
173
+ function P(e, t, n, r, i, s) {
441
174
  let o = 0, l = e[n - r], u = e[n - r + 1];
442
175
  for (; t < n; t += r) {
443
176
  const h = e[t], c = e[t + 1];
@@ -445,7 +178,7 @@ function Z(e, t, n, r, i, s) {
445
178
  }
446
179
  return o !== 0;
447
180
  }
448
- function mt(e, t, n, r, i) {
181
+ function nt(e, t, n, r, i) {
449
182
  let s;
450
183
  for (t += r; t < n; t += r)
451
184
  if (s = i(
@@ -455,8 +188,8 @@ function mt(e, t, n, r, i) {
455
188
  return s;
456
189
  return !1;
457
190
  }
458
- function gt(e, t, n, r, i, s) {
459
- return s = s ?? q($(), e, t, n, r), J(i, s) ? s[0] >= i[0] && s[2] <= i[2] || s[1] >= i[1] && s[3] <= i[3] ? !0 : mt(
191
+ function et(e, t, n, r, i, s) {
192
+ return s = s ?? k(K(), e, t, n, r), tt(i, s) ? s[0] >= i[0] && s[2] <= i[2] || s[1] >= i[1] && s[3] <= i[3] ? !0 : nt(
460
193
  e,
461
194
  t,
462
195
  n,
@@ -468,33 +201,33 @@ function gt(e, t, n, r, i, s) {
468
201
  * `false` otherwise.
469
202
  */
470
203
  function(o, l) {
471
- return k(i, o, l);
204
+ return it(i, o, l);
472
205
  }
473
206
  ) : !1;
474
207
  }
475
- function _t(e, t, n, r, i) {
476
- return !!(gt(e, t, n, r, i) || Z(
208
+ function rt(e, t, n, r, i) {
209
+ return !!(et(e, t, n, r, i) || P(
477
210
  e,
478
211
  t,
479
212
  n,
480
213
  r,
481
214
  i[0],
482
215
  i[1]
483
- ) || Z(
216
+ ) || P(
484
217
  e,
485
218
  t,
486
219
  n,
487
220
  r,
488
221
  i[0],
489
222
  i[3]
490
- ) || Z(
223
+ ) || P(
491
224
  e,
492
225
  t,
493
226
  n,
494
227
  r,
495
228
  i[2],
496
229
  i[1]
497
- ) || Z(
230
+ ) || P(
498
231
  e,
499
232
  t,
500
233
  n,
@@ -503,20 +236,33 @@ function _t(e, t, n, r, i) {
503
236
  i[3]
504
237
  ));
505
238
  }
239
+ function st(e, t, n) {
240
+ return Math.min(Math.max(e, t), n);
241
+ }
242
+ function D(e, t) {
243
+ const n = Math.pow(10, t);
244
+ return Math.round(e * n) / n;
245
+ }
246
+ function F(e, t) {
247
+ return Math.floor(D(e, t));
248
+ }
249
+ function O(e, t) {
250
+ return Math.ceil(D(e, t));
251
+ }
506
252
  function z(e, t) {
507
253
  return Array.isArray(e) ? e : (t === void 0 ? t = [e, e] : (t[0] = e, t[1] = e), t);
508
254
  }
509
- function y(e, t, n, r) {
255
+ function b(e, t, n, r) {
510
256
  return r !== void 0 ? (r[0] = e, r[1] = t, r[2] = n, r) : [e, t, n];
511
257
  }
512
- const dt = 256, X = [0, 0, 0], m = 5;
513
- class Et {
258
+ const ot = 256, S = [0, 0, 0], g = 5;
259
+ class B {
514
260
  /**
515
261
  * @param {Options} options Tile grid options.
516
262
  */
517
263
  constructor(t) {
518
264
  this.minZoom = t.minZoom !== void 0 ? t.minZoom : 0, this.resolutions_ = t.resolutions, M(
519
- ft(
265
+ v(
520
266
  this.resolutions_,
521
267
  /**
522
268
  * @param {number} a First resolution
@@ -542,17 +288,17 @@ class Et {
542
288
  "Number of `origins` and `resolutions` must be equal"
543
289
  ));
544
290
  const r = t.extent;
545
- r !== void 0 && !this.origin_ && !this.origins_ && (this.origin_ = K(r)), M(
291
+ r !== void 0 && !this.origin_ && !this.origins_ && (this.origin_ = p(r)), M(
546
292
  !this.origin_ && this.origins_ || this.origin_ && !this.origins_,
547
293
  "Either `origin` or `origins` must be configured, never both"
548
294
  ), this.tileSizes_ = null, t.tileSizes !== void 0 && (this.tileSizes_ = t.tileSizes, M(
549
295
  this.tileSizes_.length == this.resolutions_.length,
550
296
  "Number of `tileSizes` and `resolutions` must be equal"
551
- )), this.tileSize_ = t.tileSize !== void 0 ? t.tileSize : this.tileSizes_ ? null : dt, M(
297
+ )), this.tileSize_ = t.tileSize !== void 0 ? t.tileSize : this.tileSizes_ ? null : ot, M(
552
298
  !this.tileSize_ && this.tileSizes_ || this.tileSize_ && !this.tileSizes_,
553
299
  "Either `tileSize` or `tileSizes` must be configured, never both"
554
300
  ), this.extent_ = r !== void 0 ? r : null, this.fullTileRanges_ = null, this.tmpSize_ = [0, 0], this.tmpExtent_ = [0, 0, 0, 0], t.sizes !== void 0 ? this.fullTileRanges_ = t.sizes.map((i, s) => {
555
- const o = new H(
301
+ const o = new V(
556
302
  Math.min(0, i[0]),
557
303
  Math.max(i[0] - 1, -1),
558
304
  Math.min(0, i[1]),
@@ -589,7 +335,7 @@ class Et {
589
335
  forEachTileCoordParentTileRange(t, n, r, i) {
590
336
  let s, o, l, u = null, h = t[0] - 1;
591
337
  for (this.zoomFactor_ === 2 ? (o = t[1], l = t[2]) : u = this.getTileCoordExtent(t, i); h >= this.minZoom; ) {
592
- if (o !== void 0 && l !== void 0 ? (o = Math.floor(o / 2), l = Math.floor(l / 2), s = S(o, o, l, l, r)) : s = this.getTileRangeForExtentAndZ(
338
+ if (o !== void 0 && l !== void 0 ? (o = Math.floor(o / 2), l = Math.floor(l / 2), s = x(o, o, l, l, r)) : s = this.getTileRangeForExtentAndZ(
593
339
  u,
594
340
  h,
595
341
  r
@@ -659,7 +405,7 @@ class Et {
659
405
  if (t[0] < this.maxZoom) {
660
406
  if (this.zoomFactor_ === 2) {
661
407
  const s = t[1] * 2, o = t[2] * 2;
662
- return S(
408
+ return x(
663
409
  s,
664
410
  s + 1,
665
411
  o,
@@ -690,7 +436,7 @@ class Et {
690
436
  return null;
691
437
  const i = t[0], s = t[1], o = t[2];
692
438
  if (n === i)
693
- return S(
439
+ return x(
694
440
  s,
695
441
  o,
696
442
  s,
@@ -700,9 +446,9 @@ class Et {
700
446
  if (this.zoomFactor_) {
701
447
  const u = Math.pow(this.zoomFactor_, n - i), h = Math.floor(s * u), c = Math.floor(o * u);
702
448
  if (n < i)
703
- return S(h, h, c, c, r);
704
- const f = Math.floor(u * (s + 1)) - 1, _ = Math.floor(u * (o + 1)) - 1;
705
- return S(h, f, c, _, r);
449
+ return x(h, h, c, c, r);
450
+ const m = Math.floor(u * (s + 1)) - 1, _ = Math.floor(u * (o + 1)) - 1;
451
+ return x(h, m, c, _, r);
706
452
  }
707
453
  const l = this.getTileCoordExtent(t, this.tmpExtent_);
708
454
  return this.getTileRangeForExtentAndZ(l, n, r);
@@ -715,11 +461,11 @@ class Et {
715
461
  * @return {import("../TileRange.js").default} Tile range.
716
462
  */
717
463
  getTileRangeForExtentAndZ(t, n, r) {
718
- this.getTileCoordForXYAndZ_(t[0], t[3], n, !1, X);
719
- const i = X[1], s = X[2];
720
- this.getTileCoordForXYAndZ_(t[2], t[1], n, !0, X);
721
- const o = X[1], l = X[2];
722
- return S(i, o, s, l, r);
464
+ this.getTileCoordForXYAndZ_(t[0], t[3], n, !1, S);
465
+ const i = S[1], s = S[2];
466
+ this.getTileCoordForXYAndZ_(t[2], t[1], n, !0, S);
467
+ const o = S[1], l = S[2];
468
+ return x(i, o, s, l, r);
723
469
  }
724
470
  /**
725
471
  * @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
@@ -742,7 +488,7 @@ class Et {
742
488
  */
743
489
  getTileCoordExtent(t, n) {
744
490
  const r = this.getOrigin(t[0]), i = this.getResolution(t[0]), s = z(this.getTileSize(t[0]), this.tmpSize_), o = r[0] + t[1] * s[0] * i, l = r[1] - (t[2] + 1) * s[1] * i, u = o + s[0] * i, h = l + s[1] * i;
745
- return j(o, l, u, h, n);
491
+ return J(o, l, u, h, n);
746
492
  }
747
493
  /**
748
494
  * Get the tile coordinate for the given map coordinate and resolution. This
@@ -779,8 +525,8 @@ class Et {
779
525
  */
780
526
  getTileCoordForXYAndResolution_(t, n, r, i, s) {
781
527
  const o = this.getZForResolution(r), l = r / this.getResolution(o), u = this.getOrigin(o), h = z(this.getTileSize(o), this.tmpSize_);
782
- let c = l * (t - u[0]) / r / h[0], f = l * (u[1] - n) / r / h[1];
783
- return i ? (c = F(c, m) - 1, f = F(f, m) - 1) : (c = P(c, m), f = P(f, m)), y(o, c, f, s);
528
+ let c = l * (t - u[0]) / r / h[0], m = l * (u[1] - n) / r / h[1];
529
+ return i ? (c = O(c, g) - 1, m = O(m, g) - 1) : (c = F(c, g), m = F(m, g)), b(o, c, m, s);
784
530
  }
785
531
  /**
786
532
  * Although there is repetition between this method and `getTileCoordForXYAndResolution_`,
@@ -800,7 +546,7 @@ class Et {
800
546
  getTileCoordForXYAndZ_(t, n, r, i, s) {
801
547
  const o = this.getOrigin(r), l = this.getResolution(r), u = z(this.getTileSize(r), this.tmpSize_);
802
548
  let h = (t - o[0]) / l / u[0], c = (o[1] - n) / l / u[1];
803
- return i ? (h = F(h, m) - 1, c = F(c, m) - 1) : (h = P(h, m), c = P(c, m)), y(r, h, c, s);
549
+ return i ? (h = O(h, g) - 1, c = O(c, g) - 1) : (h = F(h, g), c = F(c, g)), b(r, h, c, s);
804
550
  }
805
551
  /**
806
552
  * Get a tile coordinate given a map coordinate and zoom level.
@@ -862,12 +608,12 @@ class Et {
862
608
  * @api
863
609
  */
864
610
  getZForResolution(t, n) {
865
- const r = at(
611
+ const r = q(
866
612
  this.resolutions_,
867
613
  t,
868
614
  n || 0
869
615
  );
870
- return Q(r, this.minZoom, this.maxZoom);
616
+ return st(r, this.minZoom, this.maxZoom);
871
617
  }
872
618
  /**
873
619
  * The tile with the provided tile coordinate intersects the given viewport.
@@ -876,7 +622,7 @@ class Et {
876
622
  * @return {boolean} The tile with the provided tile coordinate intersects the given viewport.
877
623
  */
878
624
  tileCoordIntersectsViewport(t, n) {
879
- return _t(
625
+ return rt(
880
626
  n,
881
627
  0,
882
628
  n.length,
@@ -895,7 +641,261 @@ class Et {
895
641
  this.fullTileRanges_ = r;
896
642
  }
897
643
  }
898
- class xt extends Et {
644
+ const lt = {
645
+ // use the radius of the Normal sphere
646
+ radians: 6370997 / (2 * Math.PI),
647
+ degrees: 2 * Math.PI * 6370997 / 360,
648
+ ft: 0.3048,
649
+ m: 1,
650
+ "us-ft": 1200 / 3937
651
+ };
652
+ class H {
653
+ /**
654
+ * @param {Options} options Projection options.
655
+ */
656
+ constructor(t) {
657
+ this.code_ = t.code, this.units_ = /** @type {import("./Units.js").Units} */
658
+ t.units, this.extent_ = t.extent !== void 0 ? t.extent : null, this.worldExtent_ = t.worldExtent !== void 0 ? t.worldExtent : null, this.axisOrientation_ = t.axisOrientation !== void 0 ? t.axisOrientation : "enu", this.global_ = t.global !== void 0 ? t.global : !1, this.canWrapX_ = !!(this.global_ && this.extent_), this.getPointResolutionFunc_ = t.getPointResolution, this.defaultTileGrid_ = null, this.metersPerUnit_ = t.metersPerUnit;
659
+ }
660
+ /**
661
+ * @return {boolean} The projection is suitable for wrapping the x-axis
662
+ */
663
+ canWrapX() {
664
+ return this.canWrapX_;
665
+ }
666
+ /**
667
+ * Get the code for this projection, e.g. 'EPSG:4326'.
668
+ * @return {string} Code.
669
+ * @api
670
+ */
671
+ getCode() {
672
+ return this.code_;
673
+ }
674
+ /**
675
+ * Get the validity extent for this projection.
676
+ * @return {import("../extent.js").Extent} Extent.
677
+ * @api
678
+ */
679
+ getExtent() {
680
+ return this.extent_;
681
+ }
682
+ /**
683
+ * Get the units of this projection.
684
+ * @return {import("./Units.js").Units} Units.
685
+ * @api
686
+ */
687
+ getUnits() {
688
+ return this.units_;
689
+ }
690
+ /**
691
+ * Get the amount of meters per unit of this projection. If the projection is
692
+ * not configured with `metersPerUnit` or a units identifier, the return is
693
+ * `undefined`.
694
+ * @return {number|undefined} Meters.
695
+ * @api
696
+ */
697
+ getMetersPerUnit() {
698
+ return this.metersPerUnit_ || lt[this.units_];
699
+ }
700
+ /**
701
+ * Get the world extent for this projection.
702
+ * @return {import("../extent.js").Extent} Extent.
703
+ * @api
704
+ */
705
+ getWorldExtent() {
706
+ return this.worldExtent_;
707
+ }
708
+ /**
709
+ * Get the axis orientation of this projection.
710
+ * Example values are:
711
+ * enu - the default easting, northing, elevation.
712
+ * neu - northing, easting, up - useful for "lat/long" geographic coordinates,
713
+ * or south orientated transverse mercator.
714
+ * wnu - westing, northing, up - some planetary coordinate systems have
715
+ * "west positive" coordinate systems
716
+ * @return {string} Axis orientation.
717
+ * @api
718
+ */
719
+ getAxisOrientation() {
720
+ return this.axisOrientation_;
721
+ }
722
+ /**
723
+ * Is this projection a global projection which spans the whole world?
724
+ * @return {boolean} Whether the projection is global.
725
+ * @api
726
+ */
727
+ isGlobal() {
728
+ return this.global_;
729
+ }
730
+ /**
731
+ * Set if the projection is a global projection which spans the whole world
732
+ * @param {boolean} global Whether the projection is global.
733
+ * @api
734
+ */
735
+ setGlobal(t) {
736
+ this.global_ = t, this.canWrapX_ = !!(t && this.extent_);
737
+ }
738
+ /**
739
+ * @return {import("../tilegrid/TileGrid.js").default} The default tile grid.
740
+ */
741
+ getDefaultTileGrid() {
742
+ return this.defaultTileGrid_;
743
+ }
744
+ /**
745
+ * @param {import("../tilegrid/TileGrid.js").default} tileGrid The default tile grid.
746
+ */
747
+ setDefaultTileGrid(t) {
748
+ this.defaultTileGrid_ = t;
749
+ }
750
+ /**
751
+ * Set the validity extent for this projection.
752
+ * @param {import("../extent.js").Extent} extent Extent.
753
+ * @api
754
+ */
755
+ setExtent(t) {
756
+ this.extent_ = t, this.canWrapX_ = !!(this.global_ && t);
757
+ }
758
+ /**
759
+ * Set the world extent for this projection.
760
+ * @param {import("../extent.js").Extent} worldExtent World extent
761
+ * [minlon, minlat, maxlon, maxlat].
762
+ * @api
763
+ */
764
+ setWorldExtent(t) {
765
+ this.worldExtent_ = t;
766
+ }
767
+ /**
768
+ * Set the getPointResolution function (see {@link module:ol/proj.getPointResolution}
769
+ * for this projection.
770
+ * @param {function(number, import("../coordinate.js").Coordinate):number} func Function
771
+ * @api
772
+ */
773
+ setGetPointResolution(t) {
774
+ this.getPointResolutionFunc_ = t;
775
+ }
776
+ /**
777
+ * Get the custom point resolution function for this projection (if set).
778
+ * @return {GetPointResolution|undefined} The custom point
779
+ * resolution function (if set).
780
+ */
781
+ getPointResolutionFunc() {
782
+ return this.getPointResolutionFunc_;
783
+ }
784
+ }
785
+ const w = 6378137, Y = Math.PI * w, ut = [-Y, -Y, Y, Y], ht = [-180, -85, 180, 85], Z = w * Math.log(Math.tan(Math.PI / 2));
786
+ class X extends H {
787
+ /**
788
+ * @param {string} code Code.
789
+ */
790
+ constructor(t) {
791
+ super({
792
+ code: t,
793
+ units: "m",
794
+ extent: ut,
795
+ global: !0,
796
+ worldExtent: ht,
797
+ getPointResolution: function(n, r) {
798
+ return n / Math.cosh(r[1] / w);
799
+ }
800
+ });
801
+ }
802
+ }
803
+ const L = [
804
+ new X("EPSG:3857"),
805
+ new X("EPSG:102100"),
806
+ new X("EPSG:102113"),
807
+ new X("EPSG:900913"),
808
+ new X("http://www.opengis.net/def/crs/EPSG/0/3857"),
809
+ new X("http://www.opengis.net/gml/srs/epsg.xml#3857")
810
+ ];
811
+ function ct(e, t, n, r) {
812
+ const i = e.length;
813
+ n = n > 1 ? n : 2, r = r ?? n, t === void 0 && (n > 2 ? t = e.slice() : t = new Array(i));
814
+ for (let s = 0; s < i; s += r) {
815
+ t[s] = Y * e[s] / 180;
816
+ let o = w * Math.log(Math.tan(Math.PI * (+e[s + 1] + 90) / 360));
817
+ o > Z ? o = Z : o < -Z && (o = -Z), t[s + 1] = o;
818
+ }
819
+ return t;
820
+ }
821
+ function at(e, t, n, r) {
822
+ const i = e.length;
823
+ n = n > 1 ? n : 2, r = r ?? n, t === void 0 && (n > 2 ? t = e.slice() : t = new Array(i));
824
+ for (let s = 0; s < i; s += r)
825
+ t[s] = 180 * e[s] / Y, t[s + 1] = 360 * Math.atan(Math.exp(e[s + 1] / w)) / Math.PI - 90;
826
+ return t;
827
+ }
828
+ const ft = 6378137, W = [-180, -90, 180, 90], mt = Math.PI * ft / 180;
829
+ class d extends H {
830
+ /**
831
+ * @param {string} code Code.
832
+ * @param {string} [axisOrientation] Axis orientation.
833
+ */
834
+ constructor(t, n) {
835
+ super({
836
+ code: t,
837
+ units: "degrees",
838
+ extent: W,
839
+ axisOrientation: n,
840
+ global: !0,
841
+ metersPerUnit: mt,
842
+ worldExtent: W
843
+ });
844
+ }
845
+ }
846
+ const U = [
847
+ new d("CRS:84"),
848
+ new d("EPSG:4326", "neu"),
849
+ new d("urn:ogc:def:crs:OGC:1.3:CRS84"),
850
+ new d("urn:ogc:def:crs:OGC:2:84"),
851
+ new d("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),
852
+ new d("http://www.opengis.net/gml/srs/epsg.xml#4326", "neu"),
853
+ new d("http://www.opengis.net/def/crs/EPSG/0/4326", "neu")
854
+ ];
855
+ let N = {};
856
+ function A(e, t, n) {
857
+ const r = e.getCode(), i = t.getCode();
858
+ r in N || (N[r] = {}), N[r][i] = n;
859
+ }
860
+ function $(e, t) {
861
+ if (t !== void 0) {
862
+ for (let n = 0, r = e.length; n < r; ++n)
863
+ t[n] = e[n];
864
+ t = t;
865
+ } else
866
+ t = e.slice();
867
+ return t;
868
+ }
869
+ function gt(e) {
870
+ e.getCode(), A(e, e, $);
871
+ }
872
+ function _t(e) {
873
+ e.forEach(gt);
874
+ }
875
+ function y(e) {
876
+ _t(e), e.forEach(function(t) {
877
+ e.forEach(function(n) {
878
+ t !== n && A(t, n, $);
879
+ });
880
+ });
881
+ }
882
+ function dt(e, t, n, r) {
883
+ e.forEach(function(i) {
884
+ t.forEach(function(s) {
885
+ A(i, s, n), A(s, i, r);
886
+ });
887
+ });
888
+ }
889
+ function Et() {
890
+ y(L), y(U), dt(
891
+ U,
892
+ L,
893
+ ct,
894
+ at
895
+ );
896
+ }
897
+ Et();
898
+ class Tt extends B {
899
899
  /**
900
900
  * @param {Options} options WMTS options.
901
901
  */
@@ -926,34 +926,44 @@ class xt extends Et {
926
926
  return this.matrixIds_;
927
927
  }
928
928
  }
929
- function Tt(e) {
930
- const t = g.getResolutionSteps(), n = t.find(
929
+ function xt(e) {
930
+ const t = f.getResolutionSteps(), n = t.find(
931
931
  (r) => r.resolution === e
932
932
  );
933
933
  return n ? t.indexOf(n) : t.length - 1;
934
934
  }
935
- function Xt(e = 0.25) {
936
- const t = Tt(e);
937
- let n = g.getResolutionSteps();
938
- return n.length > t && (n = n.slice(0, t + 1)), new xt({
935
+ function Xt() {
936
+ return new B({
937
+ resolutions: f.getResolutionSteps().map((e) => e.resolution),
938
+ extent: f.bounds.flatten,
939
+ origin: f.getTileOrigin(),
940
+ tileSize: 512
941
+ });
942
+ }
943
+ function Yt(e = 0.25) {
944
+ const t = xt(e);
945
+ let n = f.getResolutionSteps();
946
+ return n.length > t && (n = n.slice(0, t + 1)), new Tt({
939
947
  resolutions: n.map((r) => r.resolution),
940
- origin: g.getTileOrigin(),
948
+ origin: f.getTileOrigin(),
941
949
  matrixIds: n.map((r, i) => i.toString()),
942
- extent: g.bounds?.flatten
950
+ extent: f.bounds?.flatten
943
951
  });
944
952
  }
945
- function Yt() {
953
+ function Rt() {
946
954
  return {
947
- projection: g.epsg,
948
- center: g.bounds.center,
949
- zoom: g.getDefaultZoom(),
955
+ projection: f.epsg,
956
+ center: f.bounds.center,
957
+ zoom: f.getDefaultZoom(),
950
958
  minResolution: G[G.length - 1],
951
959
  resolutions: G,
952
- extent: g.bounds.flatten,
960
+ extent: f.bounds.flatten,
953
961
  constrainOnlyCenter: !0
954
962
  };
955
963
  }
956
964
  export {
957
- Xt as getLV95TileGrid,
958
- Yt as getLV95ViewConfig
965
+ Rt as getLV95ViewConfig,
966
+ Xt as getLV95WMSTileGrid,
967
+ Yt as getLV95WMTSTileGrid
959
968
  };
969
+ //# sourceMappingURL=ol.js.map