itowns 2.44.3-next.33 → 2.44.3-next.34
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/itowns.js +1 -1
- package/dist/itowns.js.map +1 -1
- package/lib/Converter/textureConverter.js +1 -1
- package/lib/Core/Geographic/Extent.js +171 -152
- package/lib/Core/Prefab/Planar/PlanarTileBuilder.js +1 -1
- package/lib/Core/Tile/Tile.js +39 -51
- package/lib/Core/Tile/TileGrid.js +12 -6
- package/lib/Source/Source.js +1 -1
- package/lib/Source/WFSSource.js +1 -1
- package/lib/Source/WMSSource.js +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
2
|
import Feature2Texture from "./Feature2Texture.js";
|
|
3
3
|
import Extent from "../Core/Geographic/Extent.js";
|
|
4
|
-
const extentTexture = new Extent('EPSG:4326'
|
|
4
|
+
const extentTexture = new Extent('EPSG:4326');
|
|
5
5
|
const textureLayer = (texture, layer) => {
|
|
6
6
|
texture.generateMipmaps = false;
|
|
7
7
|
texture.magFilter = layer.magFilter || THREE.LinearFilter;
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
2
|
import * as CRS from "./Crs.js";
|
|
3
3
|
import Coordinates from "./Coordinates.js";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Extent is a SIG-area (so 2D)
|
|
7
|
-
* It can use explicit coordinates (e.g: lon/lat) or implicit (WMTS coordinates)
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
4
|
const _dim = new THREE.Vector2();
|
|
11
5
|
const _dim2 = new THREE.Vector2();
|
|
12
6
|
const _box = new THREE.Box3();
|
|
@@ -16,32 +10,60 @@ const cSouthWest = new Coordinates('EPSG:4326', 0, 0, 0);
|
|
|
16
10
|
const cNorthEast = new Coordinates('EPSG:4326', 0, 0, 0);
|
|
17
11
|
const southWest = new THREE.Vector3();
|
|
18
12
|
const northEast = new THREE.Vector3();
|
|
19
|
-
|
|
20
|
-
/** @type {Extent} */
|
|
21
13
|
let _extent;
|
|
22
14
|
const cardinals = new Array(8);
|
|
23
15
|
for (let i = cardinals.length - 1; i >= 0; i--) {
|
|
24
16
|
cardinals[i] = new Coordinates('EPSG:4326', 0, 0, 0);
|
|
25
17
|
}
|
|
26
18
|
const _c = new Coordinates('EPSG:4326', 0, 0);
|
|
19
|
+
/**
|
|
20
|
+
* A class representing a geographical extent.
|
|
21
|
+
*
|
|
22
|
+
* An extent is a geographical bounding rectangle defined by 4 limits: west,
|
|
23
|
+
* east, south and north.
|
|
24
|
+
*
|
|
25
|
+
* **Warning**: Using a geocentric projection is not suitable for representing a
|
|
26
|
+
* geographical extent. Please use a geographic projection.
|
|
27
|
+
*/
|
|
27
28
|
class Extent {
|
|
28
29
|
/**
|
|
29
|
-
*
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
*
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
*
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
30
|
+
* Read-only flag to check if a given object is of type `Extent`.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* A default or user-defined CRS (see {@link ProjectionLike}).
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* West longitude bound of this extent.
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* East longitude bound of this extent.
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* South latitude bound of this extent.
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* North latitude bound of this extent.
|
|
51
|
+
*/
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @param crs - A default or user-defined CRS (see {@link ProjectionLike}).
|
|
55
|
+
* @param west - the `west` value of this extent. Default is 0.
|
|
56
|
+
* @param east - the `east` value of this extent. Default is 0.
|
|
57
|
+
* @param south - the `south` value of this extent. Default is 0.
|
|
58
|
+
* @param north - the `north` value of this extent. Default is 0.
|
|
59
|
+
*/
|
|
60
|
+
constructor(crs) {
|
|
61
|
+
let west = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
62
|
+
let east = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
63
|
+
let south = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
64
|
+
let north = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
|
43
65
|
if (CRS.isGeocentric(crs)) {
|
|
44
|
-
throw new Error(
|
|
66
|
+
throw new Error(`Non-compatible geocentric projection ${crs} to build a geographical extent`);
|
|
45
67
|
}
|
|
46
68
|
this.isExtent = true;
|
|
47
69
|
this.crs = crs;
|
|
@@ -49,26 +71,26 @@ class Extent {
|
|
|
49
71
|
this.east = 0;
|
|
50
72
|
this.south = 0;
|
|
51
73
|
this.north = 0;
|
|
52
|
-
this.set(
|
|
74
|
+
this.set(west, east, south, north);
|
|
53
75
|
}
|
|
54
76
|
|
|
55
77
|
/**
|
|
56
|
-
*
|
|
57
|
-
* @return {Extent} cloned extent
|
|
78
|
+
* Returns a new extent with the same bounds and crs as this one.
|
|
58
79
|
*/
|
|
59
80
|
clone() {
|
|
60
81
|
return new Extent(this.crs, this.west, this.east, this.south, this.north);
|
|
61
82
|
}
|
|
62
83
|
|
|
63
84
|
/**
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* @param
|
|
67
|
-
* @
|
|
85
|
+
* Projects this extent to the specified projection.
|
|
86
|
+
*
|
|
87
|
+
* @param crs - target's projection.
|
|
88
|
+
* @param target - The target to store the projected extent. If this not
|
|
89
|
+
* provided a new extent will be created.
|
|
68
90
|
*/
|
|
69
|
-
as(crs
|
|
91
|
+
as(crs) {
|
|
92
|
+
let target = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Extent('EPSG:4326');
|
|
70
93
|
CRS.isValid(crs);
|
|
71
|
-
target = target || new Extent('EPSG:4326', [0, 0, 0, 0]);
|
|
72
94
|
if (this.crs != crs) {
|
|
73
95
|
// Compute min/max in x/y by projecting 8 cardinal points,
|
|
74
96
|
// and then taking the min/max of each coordinates.
|
|
@@ -102,9 +124,10 @@ class Extent {
|
|
|
102
124
|
}
|
|
103
125
|
|
|
104
126
|
/**
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
* @
|
|
127
|
+
* Returns the center of the extent.
|
|
128
|
+
*
|
|
129
|
+
* @param target - The target to store the center coordinate. If this not
|
|
130
|
+
* provided a new coordinate will be created.
|
|
108
131
|
*/
|
|
109
132
|
center() {
|
|
110
133
|
let target = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Coordinates(this.crs);
|
|
@@ -115,26 +138,12 @@ class Extent {
|
|
|
115
138
|
}
|
|
116
139
|
|
|
117
140
|
/**
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
* @return {THREE.Vector2}
|
|
123
|
-
*/
|
|
124
|
-
dimensions() {
|
|
125
|
-
let target = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new THREE.Vector2();
|
|
126
|
-
console.warn('Extent.dimensions is deprecated, use planarDimensions, geodeticDimensions or spatialEuclideanDimensions');
|
|
127
|
-
target.x = Math.abs(this.east - this.west);
|
|
128
|
-
target.y = Math.abs(this.north - this.south);
|
|
129
|
-
return target;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Planar dimensions are two planar distances west/east and south/north.
|
|
134
|
-
* Planar distance straight-line Euclidean distance calculated in a 2D Cartesian coordinate system.
|
|
141
|
+
* Returns the planar dimensions as two-vector planar distances west/east
|
|
142
|
+
* and south/north.
|
|
143
|
+
* The planar distance is a straight-line Euclidean distance calculated in a
|
|
144
|
+
* 2D Cartesian coordinate system.
|
|
135
145
|
*
|
|
136
|
-
* @param
|
|
137
|
-
* @return {THREE.Vector2} Planar dimensions
|
|
146
|
+
* @param target - optional target
|
|
138
147
|
*/
|
|
139
148
|
planarDimensions() {
|
|
140
149
|
let target = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new THREE.Vector2();
|
|
@@ -143,12 +152,12 @@ class Extent {
|
|
|
143
152
|
}
|
|
144
153
|
|
|
145
154
|
/**
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
155
|
+
* Returns the geodetic dimensions as two-vector planar distances west/east
|
|
156
|
+
* and south/north.
|
|
157
|
+
* Geodetic distance is calculated in an ellispoid space as the distance
|
|
158
|
+
* across the curved surface of the ellipsoid.
|
|
149
159
|
*
|
|
150
|
-
* @param
|
|
151
|
-
* @return {THREE.Vector2} geodetic dimensions
|
|
160
|
+
* @param target - optional target
|
|
152
161
|
*/
|
|
153
162
|
geodeticDimensions() {
|
|
154
163
|
let target = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new THREE.Vector2();
|
|
@@ -165,11 +174,11 @@ class Extent {
|
|
|
165
174
|
}
|
|
166
175
|
|
|
167
176
|
/**
|
|
168
|
-
*
|
|
169
|
-
*
|
|
177
|
+
* Returns the spatial euclidean dimensions as a two-vector spatial
|
|
178
|
+
* euclidean distances between west/east corner and south/north corner.
|
|
179
|
+
* Spatial euclidean distance chord is calculated in an ellispoid space.
|
|
170
180
|
*
|
|
171
|
-
* @param
|
|
172
|
-
* @return {THREE.Vector2} spatial euclidean dimensions
|
|
181
|
+
* @param target - optional target
|
|
173
182
|
*/
|
|
174
183
|
spatialEuclideanDimensions() {
|
|
175
184
|
let target = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new THREE.Vector2();
|
|
@@ -186,13 +195,11 @@ class Extent {
|
|
|
186
195
|
}
|
|
187
196
|
|
|
188
197
|
/**
|
|
189
|
-
*
|
|
198
|
+
* Checks whether a coordinates is inside the extent.
|
|
190
199
|
*
|
|
191
|
-
* @param
|
|
192
|
-
* @param
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
* @return {boolean}
|
|
200
|
+
* @param coord - the given coordinates.
|
|
201
|
+
* @param epsilon - error margin when comparing to the coordinates.
|
|
202
|
+
* Default is 0.
|
|
196
203
|
*/
|
|
197
204
|
isPointInside(coord) {
|
|
198
205
|
let epsilon = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
@@ -207,26 +214,27 @@ class Extent {
|
|
|
207
214
|
}
|
|
208
215
|
|
|
209
216
|
/**
|
|
210
|
-
*
|
|
211
|
-
*
|
|
212
|
-
* @param {Extent} extent the extent to check
|
|
213
|
-
* @param {number} epsilon to take into account when comparing to the
|
|
214
|
-
* point.
|
|
217
|
+
* Checks whether another extent is inside the extent.
|
|
215
218
|
*
|
|
216
|
-
* @
|
|
219
|
+
* @param extent - the extent to check
|
|
220
|
+
* @param epsilon - error margin when comparing the extent bounds.
|
|
217
221
|
*/
|
|
218
|
-
isInside(extent
|
|
222
|
+
isInside(extent) {
|
|
223
|
+
let epsilon = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : CRS.reasonableEpsilon(this.crs);
|
|
219
224
|
extent.as(this.crs, _extent);
|
|
220
|
-
epsilon = epsilon ?? CRS.reasonableEpsilon(this.crs);
|
|
221
225
|
return this.east - _extent.east <= epsilon && _extent.west - this.west <= epsilon && this.north - _extent.north <= epsilon && _extent.south - this.south <= epsilon;
|
|
222
226
|
}
|
|
223
227
|
|
|
224
228
|
/**
|
|
225
|
-
* Return the translation and scale to transform this extent to input
|
|
229
|
+
* Return the translation and scale to transform this extent to the input
|
|
230
|
+
* extent.
|
|
226
231
|
*
|
|
227
|
-
* @param
|
|
228
|
-
* @param
|
|
229
|
-
* @
|
|
232
|
+
* @param extent - input extent
|
|
233
|
+
* @param target - copy the result to target.
|
|
234
|
+
* @returns A {@link THREE.Vector4} where the `x` property encodes the
|
|
235
|
+
* translation on west-east, the `y` property the translation on
|
|
236
|
+
* south-north, the `z` property the scale on west-east, the `w` property
|
|
237
|
+
* the scale on south-north.
|
|
230
238
|
*/
|
|
231
239
|
offsetToParent(extent) {
|
|
232
240
|
let target = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new THREE.Vector4();
|
|
@@ -243,27 +251,26 @@ class Extent {
|
|
|
243
251
|
}
|
|
244
252
|
|
|
245
253
|
/**
|
|
246
|
-
*
|
|
247
|
-
*
|
|
248
|
-
* @
|
|
254
|
+
* Checks wheter this bounding box intersects with the given extent
|
|
255
|
+
* parameter.
|
|
256
|
+
* @param extent - the provided extent
|
|
249
257
|
*/
|
|
250
258
|
intersectsExtent(extent) {
|
|
251
259
|
return Extent.intersectsExtent(this, extent);
|
|
252
260
|
}
|
|
253
|
-
static intersectsExtent(
|
|
261
|
+
static intersectsExtent(extentA, extentB) {
|
|
254
262
|
// TODO don't work when is on limit
|
|
255
263
|
const other = extentB.crs == extentA.crs ? extentB : extentB.as(extentA.crs, _extent);
|
|
256
264
|
return !(extentA.west >= other.east || extentA.east <= other.west || extentA.south >= other.north || extentA.north <= other.south);
|
|
257
265
|
}
|
|
258
266
|
|
|
259
267
|
/**
|
|
260
|
-
*
|
|
261
|
-
* @param
|
|
262
|
-
* @returns {Extent}
|
|
268
|
+
* Returns the intersection of this extent with another one.
|
|
269
|
+
* @param extent - extent to intersect
|
|
263
270
|
*/
|
|
264
271
|
intersect(extent) {
|
|
265
272
|
if (!this.intersectsExtent(extent)) {
|
|
266
|
-
return new Extent(this.crs
|
|
273
|
+
return new Extent(this.crs);
|
|
267
274
|
}
|
|
268
275
|
if (extent.crs != this.crs) {
|
|
269
276
|
extent = extent.as(this.crs, _extent);
|
|
@@ -274,43 +281,26 @@ class Extent {
|
|
|
274
281
|
/**
|
|
275
282
|
* Set west, east, south and north values.
|
|
276
283
|
*
|
|
277
|
-
* @param
|
|
278
|
-
*
|
|
279
|
-
*
|
|
280
|
-
*
|
|
281
|
-
* @param {number|Coordinates} [v1] east value, row value or Coordinates of
|
|
282
|
-
* east-north corner
|
|
283
|
-
* @param {number} [v2] south value or column value
|
|
284
|
-
* @param {number} [v3] north value
|
|
285
|
-
*
|
|
286
|
-
* @return {Extent}
|
|
284
|
+
* @param v0 - the `west` value of this extent. Default is 0.
|
|
285
|
+
* @param v1 - the `east` value of this extent. Default is 0.
|
|
286
|
+
* @param v2 - the `south` value of this extent. Default is 0.
|
|
287
|
+
* @param v3 - the `north` value of this extent. Default is 0.
|
|
287
288
|
*/
|
|
288
289
|
set(v0, v1, v2, v3) {
|
|
289
290
|
if (v0 == undefined) {
|
|
290
291
|
throw new Error('No values to set in the extent');
|
|
291
292
|
}
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
v0
|
|
297
|
-
|
|
298
|
-
if (v0.isCoordinates) {
|
|
299
|
-
// seem never used
|
|
300
|
-
this.west = v0.x;
|
|
301
|
-
this.east = v1.x;
|
|
302
|
-
this.south = v0.y;
|
|
303
|
-
this.north = v1.y;
|
|
304
|
-
} else if (v0.west !== undefined) {
|
|
305
|
-
this.west = v0.west;
|
|
306
|
-
this.east = v0.east;
|
|
307
|
-
this.south = v0.south;
|
|
308
|
-
this.north = v0.north;
|
|
293
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
294
|
+
if (v0.west !== undefined) {
|
|
295
|
+
console.warn('Deprecated Extent#constructor(string, Extent) and Extent#set(Extent),', 'use new Extent(string).setFromExtent(Extent) instead.');
|
|
296
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
297
|
+
this.setFromExtent(v0);
|
|
298
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
309
299
|
} else if (v0.length == 4) {
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
this.
|
|
300
|
+
// deepscan-disable-line
|
|
301
|
+
console.warn('Deprecated Extent#constructor(string, number[]) and Extent#set(number[]),', 'use new Extent(string).setFromArray(number[]) instead.');
|
|
302
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
303
|
+
this.setFromArray(v0);
|
|
314
304
|
} else if (v3 !== undefined) {
|
|
315
305
|
this.west = v0;
|
|
316
306
|
this.east = v1;
|
|
@@ -321,18 +311,46 @@ class Extent {
|
|
|
321
311
|
}
|
|
322
312
|
|
|
323
313
|
/**
|
|
324
|
-
*
|
|
325
|
-
*
|
|
326
|
-
*
|
|
314
|
+
* Sets this extent `west` property to `array[offset + 0]`, `east` property
|
|
315
|
+
* to `array[offset + 1]`, `south` property to `array[offset + 2]` and
|
|
316
|
+
* `north` property to `array[offset + 3]`.
|
|
317
|
+
* @param array - the source array
|
|
318
|
+
* @param offset - offset into the array. Default is 0.
|
|
319
|
+
*/
|
|
320
|
+
setFromArray(array) {
|
|
321
|
+
let offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
322
|
+
this.west = array[offset];
|
|
323
|
+
this.east = array[offset + 1];
|
|
324
|
+
this.south = array[offset + 2];
|
|
325
|
+
this.north = array[offset + 3];
|
|
326
|
+
return this;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* Sets this extent `west`, `east`, `south` and `north` properties from an
|
|
331
|
+
* `extent` bounds.
|
|
332
|
+
* @param extent - the source extent
|
|
333
|
+
*/
|
|
334
|
+
setFromExtent(extent) {
|
|
335
|
+
this.west = extent.west;
|
|
336
|
+
this.east = extent.east;
|
|
337
|
+
this.south = extent.south;
|
|
338
|
+
this.north = extent.north;
|
|
339
|
+
return this;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Copies the passed extent to this extent.
|
|
344
|
+
* @param extent - extent to copy.
|
|
327
345
|
*/
|
|
328
346
|
copy(extent) {
|
|
329
347
|
this.crs = extent.crs;
|
|
330
|
-
return this.
|
|
348
|
+
return this.setFromExtent(extent);
|
|
331
349
|
}
|
|
332
350
|
|
|
333
351
|
/**
|
|
334
352
|
* Union this extent with the input extent.
|
|
335
|
-
* @param
|
|
353
|
+
* @param extent - the extent to union.
|
|
336
354
|
*/
|
|
337
355
|
union(extent) {
|
|
338
356
|
if (extent.crs != this.crs) {
|
|
@@ -363,7 +381,7 @@ class Extent {
|
|
|
363
381
|
/**
|
|
364
382
|
* expandByCoordinates perfoms the minimal extension
|
|
365
383
|
* for the coordinates to belong to this Extent object
|
|
366
|
-
* @param
|
|
384
|
+
* @param coordinates - The coordinates to belong
|
|
367
385
|
*/
|
|
368
386
|
expandByCoordinates(coordinates) {
|
|
369
387
|
const coords = coordinates.crs == this.crs ? coordinates : coordinates.as(this.crs, _c);
|
|
@@ -373,8 +391,8 @@ class Extent {
|
|
|
373
391
|
/**
|
|
374
392
|
* expandByValuesCoordinates perfoms the minimal extension
|
|
375
393
|
* for the coordinates values to belong to this Extent object
|
|
376
|
-
* @param
|
|
377
|
-
* @param
|
|
394
|
+
* @param we - The coordinate on west-east
|
|
395
|
+
* @param sn - The coordinate on south-north
|
|
378
396
|
*
|
|
379
397
|
*/
|
|
380
398
|
expandByValuesCoordinates(we, sn) {
|
|
@@ -399,9 +417,8 @@ class Extent {
|
|
|
399
417
|
* should be the geocentric coordinates of `min` and `max` of a `box3`
|
|
400
418
|
* in local tangent plane.
|
|
401
419
|
*
|
|
402
|
-
* @param
|
|
403
|
-
* @param
|
|
404
|
-
* @return {Extent}
|
|
420
|
+
* @param crs - Projection of extent to instancied.
|
|
421
|
+
* @param box - Bounding-box
|
|
405
422
|
*/
|
|
406
423
|
static fromBox3(crs, box) {
|
|
407
424
|
if (CRS.isGeocentric(crs)) {
|
|
@@ -413,7 +430,7 @@ class Extent {
|
|
|
413
430
|
cNorthEast.crs = crs;
|
|
414
431
|
cNorthEast.setFromVector3(box.max).as(crs, cNorthEast).toVector3(box.max);
|
|
415
432
|
}
|
|
416
|
-
return new Extent(crs
|
|
433
|
+
return new Extent(crs).setFromExtent({
|
|
417
434
|
west: box.min.x,
|
|
418
435
|
east: box.max.x,
|
|
419
436
|
south: box.min.y,
|
|
@@ -423,29 +440,29 @@ class Extent {
|
|
|
423
440
|
|
|
424
441
|
/**
|
|
425
442
|
* Return values of extent in string, separated by the separator input.
|
|
426
|
-
* @param
|
|
427
|
-
* @return {string}
|
|
443
|
+
* @param sep - string separator
|
|
428
444
|
*/
|
|
429
445
|
toString() {
|
|
430
|
-
let
|
|
431
|
-
return `${this.east}${
|
|
446
|
+
let sep = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
447
|
+
return `${this.east}${sep}${this.north}${sep}${this.west}${sep}${this.south}`;
|
|
432
448
|
}
|
|
433
449
|
|
|
434
450
|
/**
|
|
435
451
|
* Subdivide equally an extent from its center to return four extents:
|
|
436
452
|
* north-west, north-east, south-west and south-east.
|
|
437
453
|
*
|
|
438
|
-
* @returns
|
|
439
|
-
*
|
|
454
|
+
* @returns An array containing the four sections of the extent. The order
|
|
455
|
+
* of the sections is [NW, NE, SW, SE].
|
|
440
456
|
*/
|
|
441
457
|
subdivision() {
|
|
442
458
|
return this.subdivisionByScheme();
|
|
443
459
|
}
|
|
460
|
+
|
|
444
461
|
/**
|
|
445
462
|
* subdivise extent by scheme.x on west-east and scheme.y on south-north.
|
|
446
463
|
*
|
|
447
|
-
* @param
|
|
448
|
-
* @
|
|
464
|
+
* @param scheme - The scheme to subdivise.
|
|
465
|
+
* @returns subdivised extents.
|
|
449
466
|
*/
|
|
450
467
|
subdivisionByScheme() {
|
|
451
468
|
let scheme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultScheme;
|
|
@@ -462,10 +479,11 @@ class Extent {
|
|
|
462
479
|
}
|
|
463
480
|
|
|
464
481
|
/**
|
|
465
|
-
* Multiplies all extent `coordinates` (with an implicit 1 in the 4th
|
|
482
|
+
* Multiplies all extent `coordinates` (with an implicit 1 in the 4th
|
|
483
|
+
* dimension) and `matrix`.
|
|
466
484
|
*
|
|
467
|
-
* @param
|
|
468
|
-
* @return
|
|
485
|
+
* @param matrix - The matrix
|
|
486
|
+
* @returns return this extent instance.
|
|
469
487
|
*/
|
|
470
488
|
applyMatrix4(matrix) {
|
|
471
489
|
southWest.set(this.west, this.south, 0).applyMatrix4(matrix);
|
|
@@ -490,9 +508,9 @@ class Extent {
|
|
|
490
508
|
/**
|
|
491
509
|
* clamp south and north values
|
|
492
510
|
*
|
|
493
|
-
* @param
|
|
494
|
-
* @param
|
|
495
|
-
* @
|
|
511
|
+
* @param south - The min south
|
|
512
|
+
* @param north - The max north
|
|
513
|
+
* @returns this extent
|
|
496
514
|
*/
|
|
497
515
|
clampSouthNorth() {
|
|
498
516
|
let south = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.south;
|
|
@@ -505,9 +523,9 @@ class Extent {
|
|
|
505
523
|
/**
|
|
506
524
|
* clamp west and east values
|
|
507
525
|
*
|
|
508
|
-
* @param
|
|
509
|
-
* @param
|
|
510
|
-
* @
|
|
526
|
+
* @param west - The min west
|
|
527
|
+
* @param east - The max east
|
|
528
|
+
* @returns this extent
|
|
511
529
|
*/
|
|
512
530
|
clampWestEast() {
|
|
513
531
|
let west = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.west;
|
|
@@ -516,16 +534,17 @@ class Extent {
|
|
|
516
534
|
this.east = Math.min(this.east, east);
|
|
517
535
|
return this;
|
|
518
536
|
}
|
|
537
|
+
|
|
519
538
|
/**
|
|
520
539
|
* clamp this extent by passed extent
|
|
521
540
|
*
|
|
522
|
-
* @param
|
|
523
|
-
* @
|
|
541
|
+
* @param extent - The maximum extent.
|
|
542
|
+
* @returns this extent.
|
|
524
543
|
*/
|
|
525
544
|
clampByExtent(extent) {
|
|
526
545
|
this.clampSouthNorth(extent.south, extent.north);
|
|
527
546
|
return this.clampWestEast(extent.west, extent.east);
|
|
528
547
|
}
|
|
529
548
|
}
|
|
530
|
-
_extent = new Extent('EPSG:4326'
|
|
549
|
+
_extent = new Extent('EPSG:4326');
|
|
531
550
|
export default Extent;
|
|
@@ -59,7 +59,7 @@ export class PlanarTileBuilder {
|
|
|
59
59
|
// the geometry in common extent is identical to the existing input
|
|
60
60
|
// with a translation
|
|
61
61
|
return {
|
|
62
|
-
shareableExtent: new Extent(extent.crs
|
|
62
|
+
shareableExtent: new Extent(extent.crs).setFromExtent({
|
|
63
63
|
west: 0,
|
|
64
64
|
east: Math.abs(extent.west - extent.east),
|
|
65
65
|
south: 0,
|