itowns 2.44.3-next.0 → 2.44.3-next.10
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/CODING.md +1 -1
- package/dist/455.js +1 -1
- package/dist/455.js.map +1 -1
- package/dist/debug.js +1 -1
- package/dist/debug.js.LICENSE.txt +1 -1
- package/dist/debug.js.map +1 -1
- package/dist/itowns.js +1 -1
- package/dist/itowns.js.map +1 -1
- package/dist/itowns_lasworker.js +1 -1
- package/dist/itowns_lasworker.js.map +1 -1
- package/dist/itowns_widgets.js +1 -1
- package/dist/itowns_widgets.js.map +1 -1
- package/examples/3dtiles_loader.html +104 -43
- package/examples/config.json +2 -10
- package/lib/Controls/GlobeControls.js +41 -22
- package/lib/Controls/StateControl.js +4 -1
- package/lib/Controls/StreetControls.js +5 -2
- package/lib/Converter/Feature2Mesh.js +11 -4
- package/lib/Converter/textureConverter.js +3 -3
- package/lib/Core/Feature.js +2 -2
- package/lib/Core/Geographic/Extent.js +74 -266
- package/lib/Core/Prefab/Globe/GlobeLayer.js +1 -4
- package/lib/Core/Prefab/Planar/PlanarLayer.js +1 -4
- package/lib/Core/Style.js +2 -2
- package/lib/Core/Tile/Tile.js +219 -0
- package/lib/Core/Tile/TileGrid.js +46 -0
- package/lib/Core/TileMesh.js +3 -2
- package/lib/Core/View.js +1 -1
- package/lib/Layer/C3DTilesLayer.js +15 -14
- package/lib/Layer/CopcLayer.js +1 -1
- package/lib/Layer/LabelLayer.js +9 -5
- package/lib/Layer/OGC3DTilesLayer.js +36 -9
- package/lib/Layer/TiledGeometryLayer.js +3 -16
- package/lib/Parser/GeoJsonParser.js +1 -1
- package/lib/Parser/LASParser.js +1 -1
- package/lib/Parser/Potree2BinParser.js +1 -1
- package/lib/Parser/VectorTileParser.js +1 -1
- package/lib/Parser/XbilParser.js +15 -4
- package/lib/Provider/URLBuilder.js +22 -11
- package/lib/Renderer/Camera.js +1 -1
- package/lib/Renderer/LayeredMaterial.js +1 -1
- package/lib/Renderer/PointsMaterial.js +1 -1
- package/lib/Source/CopcSource.js +1 -1
- package/lib/Source/TMSSource.js +9 -7
- package/lib/Source/VectorTilesSource.js +2 -2
- package/lib/Source/WFSSource.js +4 -1
- package/lib/Source/WMSSource.js +4 -1
- package/lib/ThreeExtended/capabilities/WebGL.js +16 -11
- package/lib/ThreeExtended/loaders/GLTFLoader.js +10 -6
- package/lib/ThreeExtended/loaders/KTX2Loader.js +14 -7
- package/lib/Utils/CameraUtils.js +5 -4
- package/lib/Utils/gui/C3DTilesStyle.js +2 -3
- package/package.json +33 -28
- package/examples/3dtiles_25d.html +0 -120
- package/examples/3dtiles_basic.html +0 -94
- package/examples/3dtiles_batch_table.html +0 -86
- package/examples/3dtiles_ion.html +0 -126
- package/examples/3dtiles_pointcloud.html +0 -95
|
@@ -9,101 +9,49 @@ import CRS from "./Crs.js";
|
|
|
9
9
|
|
|
10
10
|
const _dim = new THREE.Vector2();
|
|
11
11
|
const _dim2 = new THREE.Vector2();
|
|
12
|
-
const _countTiles = new THREE.Vector2();
|
|
13
12
|
const _box = new THREE.Box3();
|
|
14
|
-
const tmsCoord = new THREE.Vector2();
|
|
15
|
-
const dimensionTile = new THREE.Vector2();
|
|
16
13
|
const defaultScheme = new THREE.Vector2(2, 2);
|
|
17
|
-
const r = {
|
|
18
|
-
row: 0,
|
|
19
|
-
col: 0,
|
|
20
|
-
invDiff: 0
|
|
21
|
-
};
|
|
22
14
|
const cNorthWest = new Coordinates('EPSG:4326', 0, 0, 0);
|
|
23
15
|
const cSouthWest = new Coordinates('EPSG:4326', 0, 0, 0);
|
|
24
16
|
const cNorthEast = new Coordinates('EPSG:4326', 0, 0, 0);
|
|
25
17
|
const southWest = new THREE.Vector3();
|
|
26
18
|
const northEast = new THREE.Vector3();
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const diff = 2 ** diffLevel;
|
|
30
|
-
r.invDiff = 1 / diff;
|
|
31
|
-
r.row = (extent.row - extent.row % diff) * r.invDiff;
|
|
32
|
-
r.col = (extent.col - extent.col % diff) * r.invDiff;
|
|
33
|
-
return r;
|
|
34
|
-
}
|
|
19
|
+
|
|
20
|
+
/** @type {Extent} */
|
|
35
21
|
let _extent;
|
|
36
|
-
let _extent2;
|
|
37
22
|
const cardinals = new Array(8);
|
|
38
23
|
for (let i = cardinals.length - 1; i >= 0; i--) {
|
|
39
|
-
cardinals[i] = new Coordinates('EPSG:4326', 0, 0, 0
|
|
24
|
+
cardinals[i] = new Coordinates('EPSG:4326', 0, 0, 0);
|
|
40
25
|
}
|
|
41
26
|
const _c = new Coordinates('EPSG:4326', 0, 0);
|
|
42
|
-
|
|
43
|
-
/** @private */
|
|
44
|
-
export const globalExtentTMS = new Map();
|
|
45
|
-
/** @private */
|
|
46
|
-
export const schemeTiles = new Map();
|
|
47
|
-
function getInfoTms(crs) {
|
|
48
|
-
const epsg = CRS.formatToEPSG(crs);
|
|
49
|
-
const globalExtent = globalExtentTMS.get(epsg);
|
|
50
|
-
const globalDimension = globalExtent.planarDimensions(_dim2);
|
|
51
|
-
const tms = CRS.formatToTms(crs);
|
|
52
|
-
const sTs = schemeTiles.get(tms) || schemeTiles.get('default');
|
|
53
|
-
// The isInverted parameter is to be set to the correct value, true or false
|
|
54
|
-
// (default being false) if the computation of the coordinates needs to be
|
|
55
|
-
// inverted to match the same scheme as OSM, Google Maps or other system.
|
|
56
|
-
// See link below for more information
|
|
57
|
-
// https://alastaira.wordpress.com/2011/07/06/converting-tms-tile-coordinates-to-googlebingosm-tile-coordinates/
|
|
58
|
-
// in crs includes ':NI' => tms isn't inverted (NOT INVERTED)
|
|
59
|
-
const isInverted = !tms.includes(':NI');
|
|
60
|
-
return {
|
|
61
|
-
epsg,
|
|
62
|
-
globalExtent,
|
|
63
|
-
globalDimension,
|
|
64
|
-
sTs,
|
|
65
|
-
isInverted
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
function getCountTiles(crs, zoom) {
|
|
69
|
-
const sTs = schemeTiles.get(CRS.formatToTms(crs)) || schemeTiles.get('default');
|
|
70
|
-
const count = 2 ** zoom;
|
|
71
|
-
_countTiles.set(count, count).multiply(sTs);
|
|
72
|
-
return _countTiles;
|
|
73
|
-
}
|
|
74
27
|
class Extent {
|
|
75
28
|
/**
|
|
76
29
|
* Extent is geographical bounding rectangle defined by 4 limits: west, east, south and north.
|
|
77
|
-
* If crs is tiled projection (WMTS or TMS), the extent is defined by zoom, row and column.
|
|
78
30
|
*
|
|
79
31
|
* Warning, using geocentric projection isn't consistent with geographical extent.
|
|
80
32
|
*
|
|
81
33
|
* @param {String} crs projection of limit values.
|
|
82
|
-
* @param {number|Array.<number>|Coordinates|Object} v0 west value,
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
* @param {number|Coordinates} [v1] east value
|
|
34
|
+
* @param {number|Array.<number>|Coordinates|Object} v0 west value, Array
|
|
35
|
+
* of values [west, east, south and north], Coordinates of west-south
|
|
36
|
+
* corner or object {west, east, south and north}
|
|
37
|
+
* @param {number|Coordinates} [v1] east value or Coordinates of
|
|
86
38
|
* east-north corner
|
|
87
|
-
* @param {number} [v2] south value
|
|
39
|
+
* @param {number} [v2] south value
|
|
88
40
|
* @param {number} [v3] north value
|
|
89
41
|
*/
|
|
90
42
|
constructor(crs, v0, v1, v2, v3) {
|
|
91
43
|
if (CRS.isGeocentric(crs)) {
|
|
92
44
|
throw new Error(`${crs} is a geocentric projection, it doesn't make sense with a geographical extent`);
|
|
93
45
|
}
|
|
46
|
+
if (CRS.isTms(crs)) {
|
|
47
|
+
throw new Error(`${crs} is a tiled projection, use Tile instead`);
|
|
48
|
+
}
|
|
94
49
|
this.isExtent = true;
|
|
95
50
|
this.crs = crs;
|
|
96
|
-
|
|
97
|
-
this.
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
this.col = 0;
|
|
101
|
-
} else {
|
|
102
|
-
this.west = 0;
|
|
103
|
-
this.east = 0;
|
|
104
|
-
this.south = 0;
|
|
105
|
-
this.north = 0;
|
|
106
|
-
}
|
|
51
|
+
this.west = 0;
|
|
52
|
+
this.east = 0;
|
|
53
|
+
this.south = 0;
|
|
54
|
+
this.north = 0;
|
|
107
55
|
this.set(v0, v1, v2, v3);
|
|
108
56
|
}
|
|
109
57
|
|
|
@@ -112,126 +60,48 @@ class Extent {
|
|
|
112
60
|
* @return {Extent} cloned extent
|
|
113
61
|
*/
|
|
114
62
|
clone() {
|
|
115
|
-
|
|
116
|
-
return new Extent(this.crs, this.zoom, this.row, this.col);
|
|
117
|
-
} else {
|
|
118
|
-
return new Extent(this.crs, this.west, this.east, this.south, this.north);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* get tiled extents convering this extent
|
|
124
|
-
*
|
|
125
|
-
* @param {string} crs WMTS, TMS crs
|
|
126
|
-
* @return {Array<Extent>} array of extents covering
|
|
127
|
-
*/
|
|
128
|
-
tiledCovering(crs) {
|
|
129
|
-
if (this.crs == 'EPSG:4326' && crs == CRS.tms_3857) {
|
|
130
|
-
const extents_WMTS_PM = [];
|
|
131
|
-
const extent = _extent.copy(this).as(CRS.formatToEPSG(crs), _extent2);
|
|
132
|
-
const {
|
|
133
|
-
globalExtent,
|
|
134
|
-
globalDimension,
|
|
135
|
-
sTs
|
|
136
|
-
} = getInfoTms(CRS.formatToEPSG(crs));
|
|
137
|
-
extent.clampByExtent(globalExtent);
|
|
138
|
-
extent.planarDimensions(dimensionTile);
|
|
139
|
-
const zoom = this.zoom + 1 || Math.floor(Math.log2(Math.round(globalDimension.x / (dimensionTile.x * sTs.x))));
|
|
140
|
-
const countTiles = getCountTiles(crs, zoom);
|
|
141
|
-
const center = extent.center(_c);
|
|
142
|
-
tmsCoord.x = center.x - globalExtent.west;
|
|
143
|
-
tmsCoord.y = globalExtent.north - extent.north;
|
|
144
|
-
tmsCoord.divide(globalDimension).multiply(countTiles).floor();
|
|
145
|
-
|
|
146
|
-
// ]N; N+1] => N
|
|
147
|
-
const maxRow = Math.ceil((globalExtent.north - extent.south) / globalDimension.x * countTiles.y) - 1;
|
|
148
|
-
for (let r = maxRow; r >= tmsCoord.y; r--) {
|
|
149
|
-
extents_WMTS_PM.push(new Extent(crs, zoom, r, tmsCoord.x));
|
|
150
|
-
}
|
|
151
|
-
return extents_WMTS_PM;
|
|
152
|
-
} else {
|
|
153
|
-
const target = new Extent(crs, 0, 0, 0);
|
|
154
|
-
const {
|
|
155
|
-
globalExtent,
|
|
156
|
-
globalDimension,
|
|
157
|
-
sTs,
|
|
158
|
-
isInverted
|
|
159
|
-
} = getInfoTms(this.crs);
|
|
160
|
-
const center = this.center(_c);
|
|
161
|
-
this.planarDimensions(dimensionTile);
|
|
162
|
-
// Each level has 2^n * 2^n tiles...
|
|
163
|
-
// ... so we count how many tiles of the same width as tile we can fit in the layer
|
|
164
|
-
// ... 2^zoom = tilecount => zoom = log2(tilecount)
|
|
165
|
-
const zoom = Math.floor(Math.log2(Math.round(globalDimension.x / (dimensionTile.x * sTs.x))));
|
|
166
|
-
const countTiles = getCountTiles(crs, zoom);
|
|
167
|
-
|
|
168
|
-
// Now that we have computed zoom, we can deduce x and y (or row / column)
|
|
169
|
-
tmsCoord.x = center.x - globalExtent.west;
|
|
170
|
-
tmsCoord.y = isInverted ? globalExtent.north - center.y : center.y - globalExtent.south;
|
|
171
|
-
tmsCoord.divide(globalDimension).multiply(countTiles).floor();
|
|
172
|
-
target.set(zoom, tmsCoord.y, tmsCoord.x);
|
|
173
|
-
return [target];
|
|
174
|
-
}
|
|
63
|
+
return new Extent(this.crs, this.west, this.east, this.south, this.north);
|
|
175
64
|
}
|
|
176
65
|
|
|
177
66
|
/**
|
|
178
67
|
* Convert Extent to the specified projection.
|
|
179
68
|
* @param {string} crs the projection of destination.
|
|
180
|
-
* @param {Extent} target copy the destination to target.
|
|
69
|
+
* @param {Extent} [target] copy the destination to target.
|
|
181
70
|
* @return {Extent}
|
|
182
71
|
*/
|
|
183
72
|
as(crs, target) {
|
|
184
73
|
CRS.isValid(crs);
|
|
185
74
|
target = target || new Extent('EPSG:4326', [0, 0, 0, 0]);
|
|
186
|
-
if (
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
target.
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
cardinals[3].setFromValues(this.east, center.y);
|
|
210
|
-
cardinals[4].setFromValues(this.east, this.south);
|
|
211
|
-
cardinals[5].setFromValues(center.x, this.south);
|
|
212
|
-
cardinals[6].setFromValues(this.west, this.south);
|
|
213
|
-
cardinals[7].setFromValues(this.west, center.y);
|
|
214
|
-
target.set(Infinity, -Infinity, Infinity, -Infinity);
|
|
215
|
-
|
|
216
|
-
// loop over the coordinates
|
|
217
|
-
for (let i = 0; i < cardinals.length; i++) {
|
|
218
|
-
// convert the coordinate.
|
|
219
|
-
cardinals[i].crs = this.crs;
|
|
220
|
-
cardinals[i].as(crs, _c);
|
|
221
|
-
target.north = Math.max(target.north, _c.y);
|
|
222
|
-
target.south = Math.min(target.south, _c.y);
|
|
223
|
-
target.east = Math.max(target.east, _c.x);
|
|
224
|
-
target.west = Math.min(target.west, _c.x);
|
|
225
|
-
}
|
|
226
|
-
target.zoom = this.zoom;
|
|
227
|
-
target.crs = crs;
|
|
228
|
-
return target;
|
|
75
|
+
if (this.crs != crs) {
|
|
76
|
+
// Compute min/max in x/y by projecting 8 cardinal points,
|
|
77
|
+
// and then taking the min/max of each coordinates.
|
|
78
|
+
const center = this.center(_c);
|
|
79
|
+
cardinals[0].setFromValues(this.west, this.north);
|
|
80
|
+
cardinals[1].setFromValues(center.x, this.north);
|
|
81
|
+
cardinals[2].setFromValues(this.east, this.north);
|
|
82
|
+
cardinals[3].setFromValues(this.east, center.y);
|
|
83
|
+
cardinals[4].setFromValues(this.east, this.south);
|
|
84
|
+
cardinals[5].setFromValues(center.x, this.south);
|
|
85
|
+
cardinals[6].setFromValues(this.west, this.south);
|
|
86
|
+
cardinals[7].setFromValues(this.west, center.y);
|
|
87
|
+
target.set(Infinity, -Infinity, Infinity, -Infinity);
|
|
88
|
+
|
|
89
|
+
// loop over the coordinates
|
|
90
|
+
for (let i = 0; i < cardinals.length; i++) {
|
|
91
|
+
// convert the coordinate.
|
|
92
|
+
cardinals[i].crs = this.crs;
|
|
93
|
+
cardinals[i].as(crs, _c);
|
|
94
|
+
target.north = Math.max(target.north, _c.y);
|
|
95
|
+
target.south = Math.min(target.south, _c.y);
|
|
96
|
+
target.east = Math.max(target.east, _c.x);
|
|
97
|
+
target.west = Math.min(target.west, _c.x);
|
|
229
98
|
}
|
|
230
99
|
target.crs = crs;
|
|
231
|
-
target.zoom = this.zoom;
|
|
232
|
-
target.set(this.west, this.east, this.south, this.north);
|
|
233
100
|
return target;
|
|
234
101
|
}
|
|
102
|
+
target.crs = crs;
|
|
103
|
+
target.set(this.west, this.east, this.south, this.north);
|
|
104
|
+
return target;
|
|
235
105
|
}
|
|
236
106
|
|
|
237
107
|
/**
|
|
@@ -241,9 +111,6 @@ class Extent {
|
|
|
241
111
|
*/
|
|
242
112
|
center() {
|
|
243
113
|
let target = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Coordinates(this.crs);
|
|
244
|
-
if (CRS.isTms(this.crs)) {
|
|
245
|
-
throw new Error('Invalid operation for WMTS bbox');
|
|
246
|
-
}
|
|
247
114
|
this.planarDimensions(_dim);
|
|
248
115
|
target.crs = this.crs;
|
|
249
116
|
target.setFromValues(this.west + _dim.x * 0.5, this.south + _dim.y * 0.5);
|
|
@@ -352,20 +219,9 @@ class Extent {
|
|
|
352
219
|
* @return {boolean}
|
|
353
220
|
*/
|
|
354
221
|
isInside(extent, epsilon) {
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
} else if (this.zoom < extent.zoom) {
|
|
359
|
-
return false;
|
|
360
|
-
} else {
|
|
361
|
-
_rowColfromParent(this, extent.zoom);
|
|
362
|
-
return r.row == extent.row && r.col == extent.col;
|
|
363
|
-
}
|
|
364
|
-
} else {
|
|
365
|
-
extent.as(this.crs, _extent);
|
|
366
|
-
epsilon = epsilon == undefined ? CRS.reasonnableEpsilon(this.crs) : epsilon;
|
|
367
|
-
return this.east - _extent.east <= epsilon && _extent.west - this.west <= epsilon && this.north - _extent.north <= epsilon && _extent.south - this.south <= epsilon;
|
|
368
|
-
}
|
|
222
|
+
extent.as(this.crs, _extent);
|
|
223
|
+
epsilon = epsilon == undefined ? CRS.reasonnableEpsilon(this.crs) : epsilon;
|
|
224
|
+
return this.east - _extent.east <= epsilon && _extent.west - this.west <= epsilon && this.north - _extent.north <= epsilon && _extent.south - this.south <= epsilon;
|
|
369
225
|
}
|
|
370
226
|
|
|
371
227
|
/**
|
|
@@ -380,10 +236,6 @@ class Extent {
|
|
|
380
236
|
if (this.crs != extent.crs) {
|
|
381
237
|
throw new Error('unsupported mix');
|
|
382
238
|
}
|
|
383
|
-
if (CRS.isTms(this.crs)) {
|
|
384
|
-
_rowColfromParent(this, extent.zoom);
|
|
385
|
-
return target.set(this.col * r.invDiff - r.col, this.row * r.invDiff - r.row, r.invDiff, r.invDiff);
|
|
386
|
-
}
|
|
387
239
|
extent.planarDimensions(_dim);
|
|
388
240
|
this.planarDimensions(_dim2);
|
|
389
241
|
const originX = (this.west - extent.west) / _dim.x;
|
|
@@ -393,21 +245,6 @@ class Extent {
|
|
|
393
245
|
return target.set(originX, originY, scaleX, scaleY);
|
|
394
246
|
}
|
|
395
247
|
|
|
396
|
-
/**
|
|
397
|
-
* Return parent tiled extent with input level
|
|
398
|
-
*
|
|
399
|
-
* @param {number} levelParent level of parent.
|
|
400
|
-
* @return {Extent}
|
|
401
|
-
*/
|
|
402
|
-
tiledExtentParent(levelParent) {
|
|
403
|
-
if (levelParent && levelParent < this.zoom) {
|
|
404
|
-
_rowColfromParent(this, levelParent);
|
|
405
|
-
return new Extent(this.crs, levelParent, r.row, r.col);
|
|
406
|
-
} else {
|
|
407
|
-
return this;
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
|
|
411
248
|
/**
|
|
412
249
|
* Return true if this bounding box intersect with the bouding box parameter
|
|
413
250
|
* @param {Extent} extent
|
|
@@ -416,7 +253,7 @@ class Extent {
|
|
|
416
253
|
intersectsExtent(extent) {
|
|
417
254
|
return Extent.intersectsExtent(this, extent);
|
|
418
255
|
}
|
|
419
|
-
static intersectsExtent(extentA, extentB) {
|
|
256
|
+
static intersectsExtent(/** @type {Extent} */extentA, /** @type {Extent} */extentB) {
|
|
420
257
|
// TODO don't work when is on limit
|
|
421
258
|
const other = extentB.crs == extentA.crs ? extentB : extentB.as(extentA.crs, _extent);
|
|
422
259
|
return !(extentA.west >= other.east || extentA.east <= other.west || extentA.south >= other.north || extentA.north <= other.south);
|
|
@@ -425,7 +262,7 @@ class Extent {
|
|
|
425
262
|
/**
|
|
426
263
|
* Return the intersection of this extent with another one
|
|
427
264
|
* @param {Extent} extent
|
|
428
|
-
* @returns {
|
|
265
|
+
* @returns {Extent}
|
|
429
266
|
*/
|
|
430
267
|
intersect(extent) {
|
|
431
268
|
if (!this.intersectsExtent(extent)) {
|
|
@@ -439,12 +276,11 @@ class Extent {
|
|
|
439
276
|
|
|
440
277
|
/**
|
|
441
278
|
* Set west, east, south and north values.
|
|
442
|
-
* Or if tiled extent, set zoom, row and column values
|
|
443
279
|
*
|
|
444
280
|
* @param {number|Array.<number>|Coordinates|Object|Extent} v0 west value,
|
|
445
|
-
*
|
|
446
|
-
*
|
|
447
|
-
*
|
|
281
|
+
* Array of values [west, east, south and north], Extent of same type (tiled
|
|
282
|
+
* or not), Coordinates of west-south corner or object {west, east, south
|
|
283
|
+
* and north}
|
|
448
284
|
* @param {number|Coordinates} [v1] east value, row value or Coordinates of
|
|
449
285
|
* east-north corner
|
|
450
286
|
* @param {number} [v2] south value or column value
|
|
@@ -457,22 +293,12 @@ class Extent {
|
|
|
457
293
|
throw new Error('No values to set in the extent');
|
|
458
294
|
}
|
|
459
295
|
if (v0.isExtent) {
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
} else {
|
|
465
|
-
v1 = v0.east;
|
|
466
|
-
v2 = v0.south;
|
|
467
|
-
v3 = v0.north;
|
|
468
|
-
v0 = v0.west;
|
|
469
|
-
}
|
|
296
|
+
v1 = v0.east;
|
|
297
|
+
v2 = v0.south;
|
|
298
|
+
v3 = v0.north;
|
|
299
|
+
v0 = v0.west;
|
|
470
300
|
}
|
|
471
|
-
if (
|
|
472
|
-
this.zoom = v0;
|
|
473
|
-
this.row = v1;
|
|
474
|
-
this.col = v2;
|
|
475
|
-
} else if (v0.isCoordinates) {
|
|
301
|
+
if (v0.isCoordinates) {
|
|
476
302
|
// seem never used
|
|
477
303
|
this.west = v0.x;
|
|
478
304
|
this.east = v1.x;
|
|
@@ -605,11 +431,7 @@ class Extent {
|
|
|
605
431
|
*/
|
|
606
432
|
toString() {
|
|
607
433
|
let separator = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
608
|
-
|
|
609
|
-
return `${this.zoom}${separator}${this.row}${separator}${this.col}`;
|
|
610
|
-
} else {
|
|
611
|
-
return `${this.east}${separator}${this.north}${separator}${this.west}${separator}${this.south}`;
|
|
612
|
-
}
|
|
434
|
+
return `${this.east}${separator}${this.north}${separator}${this.west}${separator}${this.south}`;
|
|
613
435
|
}
|
|
614
436
|
|
|
615
437
|
/**
|
|
@@ -625,7 +447,7 @@ class Extent {
|
|
|
625
447
|
/**
|
|
626
448
|
* subdivise extent by scheme.x on west-east and scheme.y on south-north.
|
|
627
449
|
*
|
|
628
|
-
* @param {Vector2} [scheme=Vector2(2,2)] The scheme to subdivise.
|
|
450
|
+
* @param {THREE.Vector2} [scheme=Vector2(2,2)] The scheme to subdivise.
|
|
629
451
|
* @return {Array<Extent>} subdivised extents.
|
|
630
452
|
*/
|
|
631
453
|
subdivisionByScheme() {
|
|
@@ -649,25 +471,23 @@ class Extent {
|
|
|
649
471
|
* @return {Extent} return this extent instance.
|
|
650
472
|
*/
|
|
651
473
|
applyMatrix4(matrix) {
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
this.east = temp;
|
|
663
|
-
}
|
|
664
|
-
if (this.south > this.north) {
|
|
665
|
-
const temp = this.south;
|
|
666
|
-
this.south = this.north;
|
|
667
|
-
this.north = temp;
|
|
668
|
-
}
|
|
669
|
-
return this;
|
|
474
|
+
southWest.set(this.west, this.south, 0).applyMatrix4(matrix);
|
|
475
|
+
northEast.set(this.east, this.north, 0).applyMatrix4(matrix);
|
|
476
|
+
this.west = southWest.x;
|
|
477
|
+
this.east = northEast.x;
|
|
478
|
+
this.south = southWest.y;
|
|
479
|
+
this.north = northEast.y;
|
|
480
|
+
if (this.west > this.east) {
|
|
481
|
+
const temp = this.west;
|
|
482
|
+
this.west = this.east;
|
|
483
|
+
this.east = temp;
|
|
670
484
|
}
|
|
485
|
+
if (this.south > this.north) {
|
|
486
|
+
const temp = this.south;
|
|
487
|
+
this.south = this.north;
|
|
488
|
+
this.north = temp;
|
|
489
|
+
}
|
|
490
|
+
return this;
|
|
671
491
|
}
|
|
672
492
|
|
|
673
493
|
/**
|
|
@@ -711,16 +531,4 @@ class Extent {
|
|
|
711
531
|
}
|
|
712
532
|
}
|
|
713
533
|
_extent = new Extent('EPSG:4326', [0, 0, 0, 0]);
|
|
714
|
-
_extent2 = new Extent('EPSG:4326', [0, 0, 0, 0]);
|
|
715
|
-
globalExtentTMS.set('EPSG:4326', new Extent('EPSG:4326', -180, 180, -90, 90));
|
|
716
|
-
|
|
717
|
-
// Compute global extent of TMS in EPSG:3857
|
|
718
|
-
// It's square whose a side is between -180° to 180°.
|
|
719
|
-
// So, west extent, it's 180 convert in EPSG:3857
|
|
720
|
-
const extent3857 = globalExtentTMS.get('EPSG:4326').as('EPSG:3857');
|
|
721
|
-
extent3857.clampSouthNorth(extent3857.west, extent3857.east);
|
|
722
|
-
globalExtentTMS.set('EPSG:3857', extent3857);
|
|
723
|
-
schemeTiles.set('default', new THREE.Vector2(1, 1));
|
|
724
|
-
schemeTiles.set(CRS.tms_3857, schemeTiles.get('default'));
|
|
725
|
-
schemeTiles.set(CRS.tms_4326, new THREE.Vector2(2, 1));
|
|
726
534
|
export default Extent;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
2
|
import TiledGeometryLayer from "../../../Layer/TiledGeometryLayer.js";
|
|
3
3
|
import { ellipsoidSizes } from "../../Math/Ellipsoid.js";
|
|
4
|
-
import { globalExtentTMS, schemeTiles } from "../../
|
|
4
|
+
import { globalExtentTMS, schemeTiles } from "../../Tile/TileGrid.js";
|
|
5
5
|
import BuilderEllipsoidTile from "./BuilderEllipsoidTile.js";
|
|
6
6
|
import CRS from "../../Geographic/Crs.js";
|
|
7
7
|
|
|
@@ -43,8 +43,6 @@ class GlobeLayer extends TiledGeometryLayer {
|
|
|
43
43
|
* level for this tiled layer.
|
|
44
44
|
* @param {number} [config.sseSubdivisionThreshold=1] - Threshold level for
|
|
45
45
|
* the SSE.
|
|
46
|
-
* @param {number} [config.maxDeltaElevationLevel=4] - Maximum delta between
|
|
47
|
-
* two elevations tile.
|
|
48
46
|
*
|
|
49
47
|
* @throws {Error} `object3d` must be a valid `THREE.Object3d`.
|
|
50
48
|
*/
|
|
@@ -66,7 +64,6 @@ class GlobeLayer extends TiledGeometryLayer {
|
|
|
66
64
|
this.options.defaultPickingRadius = 5;
|
|
67
65
|
this.minSubdivisionLevel = this.minSubdivisionLevel == undefined ? 2 : this.minSubdivisionLevel;
|
|
68
66
|
this.maxSubdivisionLevel = this.maxSubdivisionLevel == undefined ? 19 : this.maxSubdivisionLevel;
|
|
69
|
-
this.maxDeltaElevationLevel = this.maxDeltaElevationLevel || 4.0;
|
|
70
67
|
this.extent = this.schemeTile[0].clone();
|
|
71
68
|
for (let i = 1; i < this.schemeTile.length; i++) {
|
|
72
69
|
this.extent.union(this.schemeTile[i]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
2
|
import TiledGeometryLayer from "../../../Layer/TiledGeometryLayer.js";
|
|
3
|
-
import { globalExtentTMS } from "../../
|
|
3
|
+
import { globalExtentTMS } from "../../Tile/TileGrid.js";
|
|
4
4
|
import CRS from "../../Geographic/Crs.js";
|
|
5
5
|
import PlanarTileBuilder from "./PlanarTileBuilder.js";
|
|
6
6
|
|
|
@@ -30,8 +30,6 @@ class PlanarLayer extends TiledGeometryLayer {
|
|
|
30
30
|
* name.
|
|
31
31
|
* @param {number} [config.maxSubdivisionLevel=5] - Maximum subdivision
|
|
32
32
|
* level for this tiled layer.
|
|
33
|
-
* @param {number} [config.maxDeltaElevationLevel=4] - Maximum delta between
|
|
34
|
-
* two elevations tile.
|
|
35
33
|
*
|
|
36
34
|
* @throws {Error} `object3d` must be a valid `THREE.Object3d`.
|
|
37
35
|
*/
|
|
@@ -50,7 +48,6 @@ class PlanarLayer extends TiledGeometryLayer {
|
|
|
50
48
|
this.extent = extent;
|
|
51
49
|
this.minSubdivisionLevel = this.minSubdivisionLevel == undefined ? 0 : this.minSubdivisionLevel;
|
|
52
50
|
this.maxSubdivisionLevel = this.maxSubdivisionLevel == undefined ? 5 : this.maxSubdivisionLevel;
|
|
53
|
-
this.maxDeltaElevationLevel = this.maxDeltaElevationLevel || 4.0;
|
|
54
51
|
}
|
|
55
52
|
}
|
|
56
53
|
export default PlanarLayer;
|
package/lib/Core/Style.js
CHANGED
|
@@ -198,8 +198,8 @@ function defineStyleProperty(style, category, parameter, userValue, defaultValue
|
|
|
198
198
|
* @property {FeatureGeometry} geometry @private The FeatureGeometry to compute the style.
|
|
199
199
|
*/
|
|
200
200
|
export class StyleContext {
|
|
201
|
-
#worldCoord = new Coordinates('EPSG:4326', 0, 0, 0);
|
|
202
|
-
#localCoordinates = new Coordinates('EPSG:4326', 0, 0, 0);
|
|
201
|
+
#worldCoord = (() => new Coordinates('EPSG:4326', 0, 0, 0))();
|
|
202
|
+
#localCoordinates = (() => new Coordinates('EPSG:4326', 0, 0, 0))();
|
|
203
203
|
#worldCoordsComputed = true;
|
|
204
204
|
#feature = {};
|
|
205
205
|
#geometry = {};
|