itowns 2.44.3-next.4 → 2.44.3-next.40
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/CONTRIBUTORS.md +1 -0
- package/dist/debug.js +1 -1
- package/dist/debug.js.map +1 -1
- package/dist/itowns.js +1 -1
- package/dist/itowns.js.LICENSE.txt +0 -2
- package/dist/itowns.js.map +1 -1
- package/dist/itowns_widgets.js +1 -1
- package/dist/itowns_widgets.js.map +1 -1
- package/examples/3dtiles_loader.html +123 -48
- package/examples/config.json +3 -10
- package/examples/copc_simple_loader.html +15 -5
- package/examples/effects_stereo.html +2 -2
- package/examples/entwine_3d_loader.html +3 -1
- package/examples/entwine_simple_loader.html +1 -1
- package/examples/images/itowns_logo.svg +123 -0
- package/examples/js/plugins/COGParser.js +1 -1
- package/examples/jsm/OGC3DTilesHelper.js +6 -1
- package/examples/layers/JSONLayers/GeoidMNT.json +3 -1
- package/examples/misc_collada.html +2 -2
- package/examples/source_file_geojson_3d.html +0 -1
- package/examples/source_file_kml_raster_usgs.html +0 -1
- package/examples/source_stream_wfs_raster.html +0 -7
- package/examples/vector_tile_mapbox_raster.html +91 -0
- package/examples/view_3d_map_webxr.html +3 -1
- package/examples/view_multi_25d.html +2 -2
- package/lib/Controls/GlobeControls.js +45 -28
- package/lib/Controls/StateControl.js +5 -2
- package/lib/Converter/Feature2Mesh.js +10 -4
- package/lib/Converter/Feature2Texture.js +6 -1
- package/lib/Converter/convertToTile.js +3 -8
- package/lib/Converter/textureConverter.js +4 -5
- package/lib/Core/Deprecated/Undeprecator.js +0 -1
- package/lib/Core/Feature.js +3 -4
- package/lib/Core/Geographic/Coordinates.js +143 -132
- package/lib/Core/Geographic/Crs.js +140 -145
- package/lib/Core/Geographic/Extent.js +221 -397
- package/lib/Core/Geographic/GeoidGrid.js +1 -1
- package/lib/Core/MainLoop.js +1 -3
- package/lib/Core/Math/Ellipsoid.js +62 -21
- package/lib/Core/Prefab/Globe/Atmosphere.js +4 -8
- package/lib/Core/Prefab/Globe/GlobeLayer.js +22 -15
- package/lib/Core/Prefab/Globe/GlobeTileBuilder.js +111 -0
- package/lib/Core/Prefab/GlobeView.js +2 -7
- package/lib/Core/Prefab/Planar/PlanarLayer.js +17 -11
- package/lib/Core/Prefab/Planar/PlanarTileBuilder.js +43 -43
- package/lib/Core/Prefab/TileBuilder.js +42 -40
- package/lib/Core/Prefab/computeBufferTileGeometry.js +195 -130
- package/lib/Core/Scheduler/Cache.js +1 -240
- package/lib/Core/Style.js +34 -495
- package/lib/Core/StyleOptions.js +486 -0
- package/lib/Core/Tile/Tile.js +207 -0
- package/lib/Core/Tile/TileGrid.js +49 -0
- package/lib/Core/TileGeometry.js +112 -28
- package/lib/Core/TileMesh.js +3 -3
- package/lib/Core/View.js +15 -8
- package/lib/Layer/C3DTilesLayer.js +20 -16
- package/lib/Layer/ColorLayer.js +35 -9
- package/lib/Layer/CopcLayer.js +7 -2
- package/lib/Layer/ElevationLayer.js +39 -7
- package/lib/Layer/EntwinePointTileLayer.js +14 -7
- package/lib/Layer/FeatureGeometryLayer.js +20 -6
- package/lib/Layer/GeometryLayer.js +42 -11
- package/lib/Layer/LabelLayer.js +45 -27
- package/lib/Layer/Layer.js +92 -61
- package/lib/Layer/OGC3DTilesLayer.js +212 -56
- package/lib/Layer/OrientedImageLayer.js +11 -5
- package/lib/Layer/PointCloudLayer.js +76 -30
- package/lib/Layer/Potree2Layer.js +9 -2
- package/lib/Layer/PotreeLayer.js +10 -3
- package/lib/Layer/RasterLayer.js +12 -2
- package/lib/Layer/TiledGeometryLayer.js +69 -13
- package/lib/Main.js +2 -2
- package/lib/Parser/GeoJsonParser.js +1 -1
- package/lib/Parser/VectorTileParser.js +42 -29
- package/lib/Parser/XbilParser.js +14 -2
- package/lib/Provider/Fetcher.js +5 -1
- package/lib/Provider/URLBuilder.js +22 -11
- package/lib/Renderer/Camera.js +1 -1
- package/lib/Renderer/Label2DRenderer.js +9 -7
- package/lib/Renderer/OBB.js +11 -13
- package/lib/Renderer/PointsMaterial.js +5 -5
- package/lib/Renderer/RasterTile.js +1 -2
- package/lib/Renderer/SphereHelper.js +0 -6
- package/lib/Source/CopcSource.js +13 -2
- package/lib/Source/EntwinePointTileSource.js +14 -4
- package/lib/Source/FileSource.js +9 -10
- package/lib/Source/OrientedImageSource.js +2 -2
- package/lib/Source/Source.js +26 -46
- package/lib/Source/TMSSource.js +10 -9
- package/lib/Source/VectorTilesSource.js +38 -34
- package/lib/Source/WFSSource.js +18 -13
- package/lib/Source/WMSSource.js +56 -18
- package/lib/Source/WMTSSource.js +13 -7
- package/lib/ThreeExtended/libs/ktx-parse.module.js +310 -274
- package/lib/ThreeExtended/loaders/DRACOLoader.js +3 -2
- package/lib/ThreeExtended/loaders/GLTFLoader.js +6 -3
- package/lib/ThreeExtended/loaders/KTX2Loader.js +144 -60
- package/lib/ThreeExtended/math/ColorSpaces.js +59 -0
- package/lib/Utils/CameraUtils.js +1 -1
- package/lib/Utils/gui/C3DTilesStyle.js +2 -3
- package/lib/Utils/placeObjectOnGround.js +0 -1
- package/package.json +10 -8
- 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
- package/lib/Core/Prefab/Globe/BuilderEllipsoidTile.js +0 -110
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
let entry;
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* Cache policies for flushing. Those policies can be used when something is
|
|
5
3
|
* [set]{@link Cache.set} into the Cache, as the lifetime property.
|
|
@@ -16,241 +14,4 @@ export const CACHE_POLICIES = {
|
|
|
16
14
|
INFINITE: Infinity,
|
|
17
15
|
TEXTURE: 900000,
|
|
18
16
|
GEOMETRY: 900000
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* This is a copy of the Map object, except that it also store a value for last
|
|
23
|
-
* time used. This value is used for cache expiration mechanism.
|
|
24
|
-
*
|
|
25
|
-
* @example
|
|
26
|
-
* import Cache, { CACHE_POLICIES } from 'Core/Scheduler/Cache';
|
|
27
|
-
*
|
|
28
|
-
* const cache = new Cache(CACHE_POLICIES.TEXTURE)
|
|
29
|
-
* cache.set({ bar: 1 }, 'foo');
|
|
30
|
-
* cache.set({ bar: 32 }, 'foo', 'toto');
|
|
31
|
-
*
|
|
32
|
-
* cache.get('foo');
|
|
33
|
-
*
|
|
34
|
-
* cache.delete('foo');
|
|
35
|
-
*
|
|
36
|
-
* cache.clear();
|
|
37
|
-
*
|
|
38
|
-
* cache.flush();
|
|
39
|
-
*/
|
|
40
|
-
class Cache {
|
|
41
|
-
/**
|
|
42
|
-
* @param {number} [lifetime=CACHE_POLICIES.INFINITE] The cache expiration time for all values.
|
|
43
|
-
*/
|
|
44
|
-
constructor() {
|
|
45
|
-
let lifetime = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : CACHE_POLICIES.INFINITE;
|
|
46
|
-
this.lifeTime = lifetime;
|
|
47
|
-
this.lastTimeFlush = Date.now();
|
|
48
|
-
this.data = new Map();
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Returns the entry related to the specified key, content in array, from the cache.
|
|
53
|
-
* The array contents one to three key.
|
|
54
|
-
* The last time used property of the entry is updated to extend the longevity of the
|
|
55
|
-
* entry.
|
|
56
|
-
*
|
|
57
|
-
* @param {string[]|number[]} keyArray key array ([key0, key1, key3])
|
|
58
|
-
*
|
|
59
|
-
* @return {Object}
|
|
60
|
-
*/
|
|
61
|
-
|
|
62
|
-
getByArray(keyArray) {
|
|
63
|
-
return this.get(keyArray[0], keyArray[1], keyArray[2]);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Adds or updates an entry with specified keys array ([key0, key1, key3]).
|
|
68
|
-
* Caution: it overrides any existing entry already set at this/those key/s.
|
|
69
|
-
*
|
|
70
|
-
* @param {Object} value to add in cache
|
|
71
|
-
* @param {string[]|number[]} keyArray key array ([key0, key1, key3])
|
|
72
|
-
*
|
|
73
|
-
* @return {Object} the added value
|
|
74
|
-
*/
|
|
75
|
-
setByArray(value, keyArray) {
|
|
76
|
-
return this.set(value, keyArray[0], keyArray[1], keyArray[2]);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Returns the entry related to the specified key from the cache. The last
|
|
81
|
-
* time used property of the entry is updated to extend the longevity of the
|
|
82
|
-
* entry.
|
|
83
|
-
*
|
|
84
|
-
* @param {string|number} key1
|
|
85
|
-
* @param {string|number} [key2]
|
|
86
|
-
* @param {string|number} [key3]
|
|
87
|
-
*
|
|
88
|
-
* @return {Object}
|
|
89
|
-
*/
|
|
90
|
-
get(key1, key2, key3) {
|
|
91
|
-
const entry_1 = this.data.get(key1);
|
|
92
|
-
if (entry_1 == undefined) {
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
if (entry_1.lastTimeUsed != undefined) {
|
|
96
|
-
entry = entry_1;
|
|
97
|
-
} else {
|
|
98
|
-
const entry_2 = entry_1.get(key2);
|
|
99
|
-
if (entry_2 == undefined) {
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
if (entry_2.lastTimeUsed != undefined) {
|
|
103
|
-
entry = entry_2;
|
|
104
|
-
} else {
|
|
105
|
-
const entry_3 = entry_2.get(key3);
|
|
106
|
-
if (entry_3 == undefined) {
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
entry = entry_3;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
if (entry.value) {
|
|
113
|
-
entry.lastTimeUsed = Date.now();
|
|
114
|
-
return entry.value;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Adds or updates an entry with specified keys (up to 3).
|
|
120
|
-
* Caution: it overrides any existing entry already set at this/those key/s.
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
* @param {Object} value to add in cache
|
|
124
|
-
* @param {string|number} key1
|
|
125
|
-
* @param {string|number} [key2]
|
|
126
|
-
* @param {string|number} [key3]
|
|
127
|
-
*
|
|
128
|
-
* @return {Object} the added value
|
|
129
|
-
*/
|
|
130
|
-
set(value, key1, key2, key3) {
|
|
131
|
-
entry = {
|
|
132
|
-
value,
|
|
133
|
-
lastTimeUsed: Date.now()
|
|
134
|
-
};
|
|
135
|
-
if (key2 == undefined) {
|
|
136
|
-
this.data.set(key1, entry);
|
|
137
|
-
return value;
|
|
138
|
-
}
|
|
139
|
-
if (!this.data.get(key1)) {
|
|
140
|
-
this.data.set(key1, new Map());
|
|
141
|
-
}
|
|
142
|
-
const entry_map = this.data.get(key1);
|
|
143
|
-
if (key3 == undefined) {
|
|
144
|
-
entry_map.set(key2, entry);
|
|
145
|
-
return value;
|
|
146
|
-
}
|
|
147
|
-
if (!entry_map.get(key2)) {
|
|
148
|
-
entry_map.set(key2, new Map());
|
|
149
|
-
}
|
|
150
|
-
entry_map.get(key2).set(key3, entry);
|
|
151
|
-
return value;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Deletes the specified entry from the cache.
|
|
156
|
-
*
|
|
157
|
-
* @param {string|number} key1
|
|
158
|
-
* @param {string|number} [key2]
|
|
159
|
-
* @param {string|number} [key3]
|
|
160
|
-
*/
|
|
161
|
-
delete(key1, key2, key3) {
|
|
162
|
-
const entry_1 = this.data.get(key1);
|
|
163
|
-
if (entry_1 === undefined) {
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
if (entry_1.lastTimeUsed != undefined) {
|
|
167
|
-
delete this.data.get(key1);
|
|
168
|
-
this.data.delete(key1);
|
|
169
|
-
} else {
|
|
170
|
-
const entry_2 = entry_1.get(key2);
|
|
171
|
-
if (entry_2 === undefined) {
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
if (entry_2.lastTimeUsed != undefined) {
|
|
175
|
-
delete entry_1.get(key2);
|
|
176
|
-
entry_1.delete(key2);
|
|
177
|
-
if (entry_1.size == 0) {
|
|
178
|
-
this.data.delete(key1);
|
|
179
|
-
}
|
|
180
|
-
} else {
|
|
181
|
-
const entry_3 = entry_2.get(key3);
|
|
182
|
-
if (entry_3 === undefined) {
|
|
183
|
-
return;
|
|
184
|
-
}
|
|
185
|
-
delete entry_2.get(key3);
|
|
186
|
-
entry_2.delete(key3);
|
|
187
|
-
if (entry_2.size == 0) {
|
|
188
|
-
entry_1.delete(key2);
|
|
189
|
-
if (entry_1.size == 0) {
|
|
190
|
-
this.data.delete(key1);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* Removes all entries of the cache.
|
|
199
|
-
*
|
|
200
|
-
*/
|
|
201
|
-
clear() {
|
|
202
|
-
this.data.clear();
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* Flush the cache: entries that have been present for too long since the
|
|
207
|
-
* last time they were used, are removed from the cache. By default, the
|
|
208
|
-
* time is the current time, but the interval can be reduced by doing
|
|
209
|
-
* something like `Cache.flush(Date.now() - reductionTime)`. If you want to
|
|
210
|
-
* clear the whole cache, use {@link Cache.clear} instead.
|
|
211
|
-
*
|
|
212
|
-
* @param {number} [time=Date.now()]
|
|
213
|
-
*/
|
|
214
|
-
flush() {
|
|
215
|
-
let time = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Date.now();
|
|
216
|
-
if (this.lifeTime == CACHE_POLICIES.INFINITE || this.lifeTime > time - this.lastTimeFlush || !this.data.size) {
|
|
217
|
-
return;
|
|
218
|
-
}
|
|
219
|
-
this.lastTimeFlush = Infinity;
|
|
220
|
-
this.data.forEach((v1, i) => {
|
|
221
|
-
if (this.lifeTime < time - v1.lastTimeUsed) {
|
|
222
|
-
delete this.data.get(i);
|
|
223
|
-
this.data.delete(i);
|
|
224
|
-
} else {
|
|
225
|
-
v1.forEach((v2, j) => {
|
|
226
|
-
if (this.lifeTime < time - v2.lastTimeUsed) {
|
|
227
|
-
delete v1.get(j);
|
|
228
|
-
v1.delete(j);
|
|
229
|
-
} else {
|
|
230
|
-
v2.forEach((v3, k) => {
|
|
231
|
-
if (this.lifeTime < time - v3.lastTimeUsed) {
|
|
232
|
-
delete v2.get(k);
|
|
233
|
-
v2.delete(k);
|
|
234
|
-
} else {
|
|
235
|
-
// Work for the moment because all flushed caches have 3 key!
|
|
236
|
-
this.lastTimeFlush = Math.min(this.lastTimeFlush, v3.lastTimeUsed);
|
|
237
|
-
}
|
|
238
|
-
});
|
|
239
|
-
if (!v2.size) {
|
|
240
|
-
delete v1.get(j);
|
|
241
|
-
v1.delete(j);
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
});
|
|
245
|
-
if (!v1.size) {
|
|
246
|
-
delete this.data.get(i);
|
|
247
|
-
this.data.delete(i);
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
});
|
|
251
|
-
if (this.data.size == 0) {
|
|
252
|
-
this.lastTimeFlush = Date.now();
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
export default Cache;
|
|
17
|
+
};
|