@itwin/core-frontend 3.1.0-dev.1 → 3.1.0-dev.8
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/lib/cjs/BriefcaseConnection.d.ts.map +1 -1
- package/lib/cjs/BriefcaseConnection.js +6 -5
- package/lib/cjs/BriefcaseConnection.js.map +1 -1
- package/lib/cjs/DrawingViewState.js +3 -3
- package/lib/cjs/DrawingViewState.js.map +1 -1
- package/lib/cjs/SheetViewState.js +3 -3
- package/lib/cjs/SheetViewState.js.map +1 -1
- package/lib/cjs/Viewport.d.ts +6 -3
- package/lib/cjs/Viewport.d.ts.map +1 -1
- package/lib/cjs/Viewport.js +16 -9
- package/lib/cjs/Viewport.js.map +1 -1
- package/lib/cjs/render/webgl/Texture.d.ts.map +1 -1
- package/lib/cjs/render/webgl/Texture.js +2 -2
- package/lib/cjs/render/webgl/Texture.js.map +1 -1
- package/lib/cjs/tile/DynamicIModelTile.d.ts.map +1 -1
- package/lib/cjs/tile/DynamicIModelTile.js +1 -1
- package/lib/cjs/tile/DynamicIModelTile.js.map +1 -1
- package/lib/cjs/tile/LRUTileList.d.ts +29 -29
- package/lib/cjs/tile/LRUTileList.d.ts.map +1 -1
- package/lib/cjs/tile/LRUTileList.js +50 -50
- package/lib/cjs/tile/LRUTileList.js.map +1 -1
- package/lib/cjs/tile/OrbitGtTileTree.js +1 -1
- package/lib/cjs/tile/OrbitGtTileTree.js.map +1 -1
- package/lib/cjs/tile/RealityModelTileTree.d.ts.map +1 -1
- package/lib/cjs/tile/RealityModelTileTree.js +1 -1
- package/lib/cjs/tile/RealityModelTileTree.js.map +1 -1
- package/lib/cjs/tile/RealityTile.d.ts +2 -2
- package/lib/cjs/tile/RealityTile.d.ts.map +1 -1
- package/lib/cjs/tile/RealityTile.js +2 -2
- package/lib/cjs/tile/RealityTile.js.map +1 -1
- package/lib/cjs/tile/RealityTileLoader.d.ts +2 -2
- package/lib/cjs/tile/RealityTileLoader.d.ts.map +1 -1
- package/lib/cjs/tile/RealityTileLoader.js +1 -1
- package/lib/cjs/tile/RealityTileLoader.js.map +1 -1
- package/lib/cjs/tile/RealityTileTree.js +1 -1
- package/lib/cjs/tile/RealityTileTree.js.map +1 -1
- package/lib/cjs/tile/Tile.d.ts +5 -4
- package/lib/cjs/tile/Tile.d.ts.map +1 -1
- package/lib/cjs/tile/Tile.js +3 -2
- package/lib/cjs/tile/Tile.js.map +1 -1
- package/lib/cjs/tile/TileAdmin.d.ts +43 -45
- package/lib/cjs/tile/TileAdmin.d.ts.map +1 -1
- package/lib/cjs/tile/TileAdmin.js +104 -99
- package/lib/cjs/tile/TileAdmin.js.map +1 -1
- package/lib/cjs/tile/TileRequest.d.ts +12 -9
- package/lib/cjs/tile/TileRequest.d.ts.map +1 -1
- package/lib/cjs/tile/TileRequest.js +19 -11
- package/lib/cjs/tile/TileRequest.js.map +1 -1
- package/lib/cjs/tile/TileRequestChannel.js +3 -3
- package/lib/cjs/tile/TileRequestChannel.js.map +1 -1
- package/lib/cjs/tile/TileTree.js +1 -1
- package/lib/cjs/tile/TileTree.js.map +1 -1
- package/lib/cjs/tile/TileTreeReference.d.ts +1 -1
- package/lib/cjs/tile/TileTreeReference.js +1 -1
- package/lib/cjs/tile/TileTreeReference.js.map +1 -1
- package/lib/cjs/tile/TileUsageMarker.d.ts +9 -9
- package/lib/cjs/tile/TileUsageMarker.d.ts.map +1 -1
- package/lib/cjs/tile/TileUsageMarker.js +9 -9
- package/lib/cjs/tile/TileUsageMarker.js.map +1 -1
- package/lib/cjs/tile/TileUser.d.ts +33 -0
- package/lib/cjs/tile/TileUser.d.ts.map +1 -0
- package/lib/cjs/tile/TileUser.js +28 -0
- package/lib/cjs/tile/TileUser.js.map +1 -0
- package/lib/cjs/tile/TileUserSet.d.ts +28 -0
- package/lib/cjs/tile/TileUserSet.d.ts.map +1 -0
- package/lib/cjs/tile/TileUserSet.js +123 -0
- package/lib/cjs/tile/TileUserSet.js.map +1 -0
- package/lib/cjs/tile/internal.d.ts +2 -0
- package/lib/cjs/tile/internal.d.ts.map +1 -1
- package/lib/cjs/tile/internal.js +2 -0
- package/lib/cjs/tile/internal.js.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.d.ts +1 -2
- package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.d.ts.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js +1 -1
- package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/AzureMapsLayerImageryProvider.d.ts +1 -2
- package/lib/cjs/tile/map/ImageryProviders/AzureMapsLayerImageryProvider.d.ts.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/AzureMapsLayerImageryProvider.js +1 -1
- package/lib/cjs/tile/map/ImageryProviders/AzureMapsLayerImageryProvider.js.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/BingImageryProvider.js +1 -1
- package/lib/cjs/tile/map/ImageryProviders/BingImageryProvider.js.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/MapBoxLayerImageryProvider.d.ts +1 -2
- package/lib/cjs/tile/map/ImageryProviders/MapBoxLayerImageryProvider.d.ts.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/MapBoxLayerImageryProvider.js +1 -1
- package/lib/cjs/tile/map/ImageryProviders/MapBoxLayerImageryProvider.js.map +1 -1
- package/lib/cjs/tile/map/ImageryTileTree.d.ts +2 -2
- package/lib/cjs/tile/map/ImageryTileTree.d.ts.map +1 -1
- package/lib/cjs/tile/map/ImageryTileTree.js +1 -1
- package/lib/cjs/tile/map/ImageryTileTree.js.map +1 -1
- package/lib/cjs/tile/map/MapTileTree.d.ts +3 -3
- package/lib/cjs/tile/map/MapTileTree.js +4 -4
- package/lib/cjs/tile/map/MapTileTree.js.map +1 -1
- package/lib/esm/BriefcaseConnection.d.ts.map +1 -1
- package/lib/esm/BriefcaseConnection.js +6 -5
- package/lib/esm/BriefcaseConnection.js.map +1 -1
- package/lib/esm/DrawingViewState.js +3 -3
- package/lib/esm/DrawingViewState.js.map +1 -1
- package/lib/esm/SheetViewState.js +3 -3
- package/lib/esm/SheetViewState.js.map +1 -1
- package/lib/esm/Viewport.d.ts +6 -3
- package/lib/esm/Viewport.d.ts.map +1 -1
- package/lib/esm/Viewport.js +17 -10
- package/lib/esm/Viewport.js.map +1 -1
- package/lib/esm/render/webgl/Texture.d.ts.map +1 -1
- package/lib/esm/render/webgl/Texture.js +2 -2
- package/lib/esm/render/webgl/Texture.js.map +1 -1
- package/lib/esm/tile/DynamicIModelTile.d.ts.map +1 -1
- package/lib/esm/tile/DynamicIModelTile.js +1 -1
- package/lib/esm/tile/DynamicIModelTile.js.map +1 -1
- package/lib/esm/tile/LRUTileList.d.ts +29 -29
- package/lib/esm/tile/LRUTileList.d.ts.map +1 -1
- package/lib/esm/tile/LRUTileList.js +47 -47
- package/lib/esm/tile/LRUTileList.js.map +1 -1
- package/lib/esm/tile/OrbitGtTileTree.js +1 -1
- package/lib/esm/tile/OrbitGtTileTree.js.map +1 -1
- package/lib/esm/tile/RealityModelTileTree.d.ts.map +1 -1
- package/lib/esm/tile/RealityModelTileTree.js +1 -1
- package/lib/esm/tile/RealityModelTileTree.js.map +1 -1
- package/lib/esm/tile/RealityTile.d.ts +2 -2
- package/lib/esm/tile/RealityTile.d.ts.map +1 -1
- package/lib/esm/tile/RealityTile.js +2 -2
- package/lib/esm/tile/RealityTile.js.map +1 -1
- package/lib/esm/tile/RealityTileLoader.d.ts +2 -2
- package/lib/esm/tile/RealityTileLoader.d.ts.map +1 -1
- package/lib/esm/tile/RealityTileLoader.js +1 -1
- package/lib/esm/tile/RealityTileLoader.js.map +1 -1
- package/lib/esm/tile/RealityTileTree.js +1 -1
- package/lib/esm/tile/RealityTileTree.js.map +1 -1
- package/lib/esm/tile/Tile.d.ts +5 -4
- package/lib/esm/tile/Tile.d.ts.map +1 -1
- package/lib/esm/tile/Tile.js +3 -2
- package/lib/esm/tile/Tile.js.map +1 -1
- package/lib/esm/tile/TileAdmin.d.ts +43 -45
- package/lib/esm/tile/TileAdmin.d.ts.map +1 -1
- package/lib/esm/tile/TileAdmin.js +105 -100
- package/lib/esm/tile/TileAdmin.js.map +1 -1
- package/lib/esm/tile/TileRequest.d.ts +12 -9
- package/lib/esm/tile/TileRequest.d.ts.map +1 -1
- package/lib/esm/tile/TileRequest.js +19 -11
- package/lib/esm/tile/TileRequest.js.map +1 -1
- package/lib/esm/tile/TileRequestChannel.js +3 -3
- package/lib/esm/tile/TileRequestChannel.js.map +1 -1
- package/lib/esm/tile/TileTree.js +1 -1
- package/lib/esm/tile/TileTree.js.map +1 -1
- package/lib/esm/tile/TileTreeReference.d.ts +1 -1
- package/lib/esm/tile/TileTreeReference.js +1 -1
- package/lib/esm/tile/TileTreeReference.js.map +1 -1
- package/lib/esm/tile/TileUsageMarker.d.ts +9 -9
- package/lib/esm/tile/TileUsageMarker.d.ts.map +1 -1
- package/lib/esm/tile/TileUsageMarker.js +9 -9
- package/lib/esm/tile/TileUsageMarker.js.map +1 -1
- package/lib/esm/tile/TileUser.d.ts +33 -0
- package/lib/esm/tile/TileUser.d.ts.map +1 -0
- package/lib/esm/tile/TileUser.js +25 -0
- package/lib/esm/tile/TileUser.js.map +1 -0
- package/lib/esm/tile/TileUserSet.d.ts +28 -0
- package/lib/esm/tile/TileUserSet.d.ts.map +1 -0
- package/lib/esm/tile/TileUserSet.js +118 -0
- package/lib/esm/tile/TileUserSet.js.map +1 -0
- package/lib/esm/tile/internal.d.ts +2 -0
- package/lib/esm/tile/internal.d.ts.map +1 -1
- package/lib/esm/tile/internal.js +2 -0
- package/lib/esm/tile/internal.js.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.d.ts +1 -2
- package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.d.ts.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js +1 -1
- package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/AzureMapsLayerImageryProvider.d.ts +1 -2
- package/lib/esm/tile/map/ImageryProviders/AzureMapsLayerImageryProvider.d.ts.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/AzureMapsLayerImageryProvider.js +1 -1
- package/lib/esm/tile/map/ImageryProviders/AzureMapsLayerImageryProvider.js.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/BingImageryProvider.js +1 -1
- package/lib/esm/tile/map/ImageryProviders/BingImageryProvider.js.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/MapBoxLayerImageryProvider.d.ts +1 -2
- package/lib/esm/tile/map/ImageryProviders/MapBoxLayerImageryProvider.d.ts.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/MapBoxLayerImageryProvider.js +1 -1
- package/lib/esm/tile/map/ImageryProviders/MapBoxLayerImageryProvider.js.map +1 -1
- package/lib/esm/tile/map/ImageryTileTree.d.ts +2 -2
- package/lib/esm/tile/map/ImageryTileTree.d.ts.map +1 -1
- package/lib/esm/tile/map/ImageryTileTree.js +1 -1
- package/lib/esm/tile/map/ImageryTileTree.js.map +1 -1
- package/lib/esm/tile/map/MapTileTree.d.ts +3 -3
- package/lib/esm/tile/map/MapTileTree.js +4 -4
- package/lib/esm/tile/map/MapTileTree.js.map +1 -1
- package/package.json +20 -20
- package/lib/cjs/ViewportSet.d.ts +0 -28
- package/lib/cjs/ViewportSet.d.ts.map +0 -1
- package/lib/cjs/ViewportSet.js +0 -126
- package/lib/cjs/ViewportSet.js.map +0 -1
- package/lib/esm/ViewportSet.d.ts +0 -28
- package/lib/esm/ViewportSet.d.ts.map +0 -1
- package/lib/esm/ViewportSet.js +0 -121
- package/lib/esm/ViewportSet.js.map +0 -1
|
@@ -10,8 +10,8 @@ import { BackendError, CloudStorageTileCache, defaultTileOptions, EdgeType, getM
|
|
|
10
10
|
import { IModelApp } from "../IModelApp";
|
|
11
11
|
import { IpcApp } from "../IpcApp";
|
|
12
12
|
import { IModelConnection } from "../IModelConnection";
|
|
13
|
-
import {
|
|
14
|
-
import { DisclosedTileTreeSet, LRUTileList, TileLoadStatus, TileRequest, TileRequestChannels, } from "./internal";
|
|
13
|
+
import { Viewport } from "../Viewport";
|
|
14
|
+
import { DisclosedTileTreeSet, LRUTileList, TileLoadStatus, TileRequest, TileRequestChannels, UniqueTileUserSets, } from "./internal";
|
|
15
15
|
/** Manages [[Tile]]s and [[TileTree]]s on behalf of [[IModelApp]]. Its responsibilities include scheduling requests for tile content via a priority queue;
|
|
16
16
|
* keeping track of and imposing limits upon the amount of GPU memory consumed by tiles; and notifying listeners of tile-related events.
|
|
17
17
|
* @see [[IModelApp.tileAdmin]] to access the instance of the TileAdmin.
|
|
@@ -24,11 +24,11 @@ export class TileAdmin {
|
|
|
24
24
|
*/
|
|
25
25
|
constructor(isMobile, rpcConcurrency, options) {
|
|
26
26
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
27
|
-
this.
|
|
28
|
-
this.
|
|
29
|
-
this.
|
|
27
|
+
this._users = new Set();
|
|
28
|
+
this._requestsPerUser = new Map();
|
|
29
|
+
this._tileUsagePerUser = new Map();
|
|
30
30
|
this._selectedAndReady = new Map();
|
|
31
|
-
this.
|
|
31
|
+
this._tileUserSetsForRequests = new UniqueTileUserSets();
|
|
32
32
|
this._totalElided = 0;
|
|
33
33
|
this._rpcInitialized = false;
|
|
34
34
|
this._tileTreePropsRequests = [];
|
|
@@ -98,7 +98,10 @@ export class TileAdmin {
|
|
|
98
98
|
// If unspecified skip one level before preloading of parents of context tiles.
|
|
99
99
|
this.contextPreloadParentSkip = Math.max(0, Math.min((options.contextPreloadParentSkip === undefined ? 1 : options.contextPreloadParentSkip), 5));
|
|
100
100
|
this._cleanup = this.addLoadListener(() => {
|
|
101
|
-
this.
|
|
101
|
+
this._users.forEach((user) => {
|
|
102
|
+
if (user instanceof Viewport)
|
|
103
|
+
user.invalidateScene();
|
|
104
|
+
});
|
|
102
105
|
});
|
|
103
106
|
}
|
|
104
107
|
/** Create a TileAdmin suitable for passing to [[IModelApp.startup]] via [[IModelAppOptions.tileAdmin]] to customize aspects of
|
|
@@ -112,7 +115,7 @@ export class TileAdmin {
|
|
|
112
115
|
return new TileAdmin(isMobile, rpcConcurrency, props);
|
|
113
116
|
}
|
|
114
117
|
/** @internal */
|
|
115
|
-
get
|
|
118
|
+
get emptyTileUserSet() { return UniqueTileUserSets.emptySet; }
|
|
116
119
|
/** Returns basic statistics about the TileAdmin's current state. */
|
|
117
120
|
get statistics() {
|
|
118
121
|
let numActiveTileTreePropsRequests = 0;
|
|
@@ -218,13 +221,13 @@ export class TileAdmin {
|
|
|
218
221
|
// Free up any additional memory as required to keep within our limit.
|
|
219
222
|
this.freeMemory();
|
|
220
223
|
}
|
|
221
|
-
/** Iterate over the tiles that have content loaded but are not
|
|
224
|
+
/** Iterate over the tiles that have content loaded but are not in use by any [[TileUser]].
|
|
222
225
|
* @alpha
|
|
223
226
|
*/
|
|
224
227
|
get unselectedLoadedTiles() {
|
|
225
228
|
return this._lruList.unselectedTiles;
|
|
226
229
|
}
|
|
227
|
-
/** Iterate over the tiles that have content loaded and are
|
|
230
|
+
/** Iterate over the tiles that have content loaded and are in use by any [[TileUser]].
|
|
228
231
|
* @alpha
|
|
229
232
|
*/
|
|
230
233
|
get selectedLoadedTiles() {
|
|
@@ -232,48 +235,52 @@ export class TileAdmin {
|
|
|
232
235
|
}
|
|
233
236
|
/** Returns the number of pending and active requests associated with the specified viewport. */
|
|
234
237
|
getNumRequestsForViewport(vp) {
|
|
238
|
+
return this.getNumRequestsForUser(vp);
|
|
239
|
+
}
|
|
240
|
+
/** Returns the number of pending and active requests associated with the specified user. */
|
|
241
|
+
getNumRequestsForUser(user) {
|
|
235
242
|
var _a;
|
|
236
|
-
const requests = this.
|
|
243
|
+
const requests = this.getRequestsForUser(user);
|
|
237
244
|
let count = (_a = requests === null || requests === void 0 ? void 0 : requests.size) !== null && _a !== void 0 ? _a : 0;
|
|
238
|
-
const tiles = this.
|
|
245
|
+
const tiles = this.getTilesForUser(user);
|
|
239
246
|
if (tiles)
|
|
240
247
|
count += tiles.external.requested;
|
|
241
248
|
return count;
|
|
242
249
|
}
|
|
243
|
-
/** Returns the current set of Tiles requested by the specified
|
|
250
|
+
/** Returns the current set of Tiles requested by the specified TileUser.
|
|
244
251
|
* Do not modify the set or the Tiles.
|
|
245
252
|
* @internal
|
|
246
253
|
*/
|
|
247
|
-
|
|
248
|
-
return this.
|
|
254
|
+
getRequestsForUser(user) {
|
|
255
|
+
return this._requestsPerUser.get(user);
|
|
249
256
|
}
|
|
250
|
-
/** Specifies the set of tiles currently requested for use by a
|
|
257
|
+
/** Specifies the set of tiles currently requested for use by a TileUser. This set replaces any previously specified for the same user.
|
|
251
258
|
* The requests are not actually processed until the next call to [[TileAdmin.process].
|
|
252
|
-
* This is typically invoked when
|
|
259
|
+
* This is typically invoked when a viewport recreates its scene, e.g. in response to camera movement.
|
|
253
260
|
* @internal
|
|
254
261
|
*/
|
|
255
|
-
requestTiles(
|
|
256
|
-
this.
|
|
262
|
+
requestTiles(user, tiles) {
|
|
263
|
+
this._requestsPerUser.set(user, tiles);
|
|
257
264
|
}
|
|
258
|
-
/** Returns two sets of tiles associated with the specified
|
|
265
|
+
/** Returns two sets of tiles associated with the specified user - typically, a viewport's current scene.
|
|
259
266
|
* Do not modify the returned sets.
|
|
260
267
|
* @internal
|
|
261
268
|
*/
|
|
262
|
-
|
|
263
|
-
return this._selectedAndReady.get(
|
|
269
|
+
getTilesForUser(user) {
|
|
270
|
+
return this._selectedAndReady.get(user);
|
|
264
271
|
}
|
|
265
|
-
/** Adds the specified tiles to the sets of selected and ready tiles for the specified
|
|
272
|
+
/** Adds the specified tiles to the sets of selected and ready tiles for the specified TileUser.
|
|
266
273
|
* The TileAdmin takes ownership of the `ready` set - do not modify it after passing it in.
|
|
267
274
|
* @internal
|
|
268
275
|
*/
|
|
269
|
-
|
|
276
|
+
addTilesForUser(user, selected, ready) {
|
|
270
277
|
// "selected" are tiles we are drawing.
|
|
271
|
-
this._lruList.
|
|
278
|
+
this._lruList.markUsed(user.tileUserId, selected);
|
|
272
279
|
// "ready" are tiles we want to draw but can't yet because, for example, their siblings are not yet ready to be drawn.
|
|
273
|
-
this._lruList.
|
|
274
|
-
const entry = this.
|
|
280
|
+
this._lruList.markUsed(user.tileUserId, ready);
|
|
281
|
+
const entry = this.getTilesForUser(user);
|
|
275
282
|
if (undefined === entry) {
|
|
276
|
-
this._selectedAndReady.set(
|
|
283
|
+
this._selectedAndReady.set(user, { ready, selected: new Set(selected), external: { selected: 0, requested: 0, ready: 0 } });
|
|
277
284
|
return;
|
|
278
285
|
}
|
|
279
286
|
for (const tile of selected)
|
|
@@ -282,51 +289,49 @@ export class TileAdmin {
|
|
|
282
289
|
entry.ready.add(tile);
|
|
283
290
|
}
|
|
284
291
|
/** Disclose statistics about tiles that are handled externally from TileAdmin. At this time, that means OrbitGT point cloud tiles.
|
|
285
|
-
* These statistics are included in the return value of [[
|
|
292
|
+
* These statistics are included in the return value of [[getTilesForUser]].
|
|
286
293
|
* @internal
|
|
287
294
|
*/
|
|
288
|
-
|
|
289
|
-
const entry = this.
|
|
295
|
+
addExternalTilesForUser(user, statistics) {
|
|
296
|
+
const entry = this.getTilesForUser(user);
|
|
290
297
|
if (!entry) {
|
|
291
|
-
this._selectedAndReady.set(
|
|
298
|
+
this._selectedAndReady.set(user, { ready: new Set(), selected: new Set(), external: { ...statistics } });
|
|
292
299
|
return;
|
|
293
300
|
}
|
|
294
301
|
entry.external.requested += statistics.requested;
|
|
295
302
|
entry.external.selected += statistics.selected;
|
|
296
303
|
entry.external.ready += statistics.ready;
|
|
297
304
|
}
|
|
298
|
-
/** Clears the sets of tiles associated with a
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
this._selectedAndReady.delete(vp);
|
|
303
|
-
this._lruList.clearSelectedForViewport(vp.viewportId);
|
|
305
|
+
/** Clears the sets of tiles associated with a TileUser. */
|
|
306
|
+
clearTilesForUser(user) {
|
|
307
|
+
this._selectedAndReady.delete(user);
|
|
308
|
+
this._lruList.clearUsed(user.tileUserId);
|
|
304
309
|
}
|
|
305
|
-
/** Indicates that the TileAdmin should cease tracking the specified
|
|
306
|
-
* Any requests which are of interest only to the specified
|
|
307
|
-
* @internal
|
|
310
|
+
/** Indicates that the TileAdmin should cease tracking the specified TileUser, e.g. because it is about to be destroyed.
|
|
311
|
+
* Any requests which are of interest only to the specified user will be canceled.
|
|
308
312
|
*/
|
|
309
|
-
|
|
310
|
-
this.
|
|
311
|
-
this.
|
|
313
|
+
forgetUser(user) {
|
|
314
|
+
this.onUserIModelClosed(user);
|
|
315
|
+
this._users.delete(user);
|
|
312
316
|
}
|
|
313
|
-
/** Indicates that the TileAdmin should track tile requests for the specified
|
|
314
|
-
* This is invoked by the Viewport constructor and should
|
|
315
|
-
*
|
|
317
|
+
/** Indicates that the TileAdmin should track tile requests for the specified TileUser.
|
|
318
|
+
* This is invoked by the Viewport constructor and should be invoked manually for any non-Viewport TileUser.
|
|
319
|
+
* [[forgetUser]] must be later invoked to unregister the user.
|
|
316
320
|
*/
|
|
317
|
-
|
|
318
|
-
this.
|
|
321
|
+
registerUser(user) {
|
|
322
|
+
this._users.add(user);
|
|
319
323
|
}
|
|
320
|
-
/** Iterable over all
|
|
324
|
+
/** Iterable over all TileUsers registered with TileAdmin. This may include [[OffScreenViewports]].
|
|
321
325
|
* @alpha
|
|
322
326
|
*/
|
|
323
|
-
get
|
|
324
|
-
return this.
|
|
327
|
+
get tileUsers() {
|
|
328
|
+
return this._users;
|
|
325
329
|
}
|
|
326
330
|
/** @internal */
|
|
327
331
|
invalidateAllScenes() {
|
|
328
|
-
for (const
|
|
329
|
-
|
|
332
|
+
for (const user of this.tileUsers)
|
|
333
|
+
if (user instanceof Viewport)
|
|
334
|
+
user.invalidateScene();
|
|
330
335
|
}
|
|
331
336
|
/** @internal */
|
|
332
337
|
onShutDown() {
|
|
@@ -338,46 +343,46 @@ export class TileAdmin {
|
|
|
338
343
|
this.channels.onShutDown();
|
|
339
344
|
for (const req of this._tileTreePropsRequests)
|
|
340
345
|
req.abandon();
|
|
341
|
-
this.
|
|
342
|
-
this.
|
|
343
|
-
this.
|
|
346
|
+
this._requestsPerUser.clear();
|
|
347
|
+
this._tileUserSetsForRequests.clear();
|
|
348
|
+
this._tileUsagePerUser.clear();
|
|
344
349
|
this._tileTreePropsRequests.length = 0;
|
|
345
350
|
this._lruList.dispose();
|
|
346
351
|
}
|
|
347
|
-
/** Returns the union of the input set and the input
|
|
352
|
+
/** Returns the union of the input set and the input TileUser, to be associated with a [[TileRequest]].
|
|
348
353
|
* @internal
|
|
349
354
|
*/
|
|
350
|
-
|
|
351
|
-
return this.
|
|
355
|
+
getTileUserSetForRequest(user, users) {
|
|
356
|
+
return this._tileUserSetsForRequests.getTileUserSet(user, users);
|
|
352
357
|
}
|
|
353
|
-
/** Marks the Tile as "in use" by the specified
|
|
354
|
-
* A tile will not be discarded while it is in use by any
|
|
358
|
+
/** Marks the Tile as "in use" by the specified TileUser, where the tile defines what "in use" means.
|
|
359
|
+
* A tile will not be discarded while it is in use by any TileUser.
|
|
355
360
|
* @see [[TileTree.prune]]
|
|
356
361
|
* @internal
|
|
357
362
|
*/
|
|
358
|
-
|
|
359
|
-
let set = this.
|
|
363
|
+
markTileUsed(marker, user) {
|
|
364
|
+
let set = this._tileUsagePerUser.get(user);
|
|
360
365
|
if (!set)
|
|
361
|
-
this.
|
|
366
|
+
this._tileUsagePerUser.set(user, set = new Set());
|
|
362
367
|
set.add(marker);
|
|
363
368
|
}
|
|
364
|
-
/** Returns true if the Tile is currently in use by any
|
|
365
|
-
* @see [[
|
|
369
|
+
/** Returns true if the Tile is currently in use by any TileUser.
|
|
370
|
+
* @see [[markTileUsed]].
|
|
366
371
|
* @internal
|
|
367
372
|
*/
|
|
368
373
|
isTileInUse(marker) {
|
|
369
374
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
370
|
-
for (const [
|
|
375
|
+
for (const [_user, markers] of this._tileUsagePerUser)
|
|
371
376
|
if (markers.has(marker))
|
|
372
377
|
return true;
|
|
373
378
|
return false;
|
|
374
379
|
}
|
|
375
|
-
/** Indicates that the TileAdmin should reset usage tracking for the specified
|
|
376
|
-
* to recreate its scene. Any tiles currently marked as "in use" by this
|
|
380
|
+
/** Indicates that the TileAdmin should reset usage tracking for the specified TileUser, e.g. because the user is a Viewport about
|
|
381
|
+
* to recreate its scene. Any tiles currently marked as "in use" by this user no longer will be.
|
|
377
382
|
* @internal
|
|
378
383
|
*/
|
|
379
|
-
|
|
380
|
-
this.
|
|
384
|
+
clearUsageForUser(user) {
|
|
385
|
+
this._tileUsagePerUser.delete(user);
|
|
381
386
|
}
|
|
382
387
|
/** @internal */
|
|
383
388
|
async requestTileTreeProps(iModel, treeId) {
|
|
@@ -500,12 +505,12 @@ export class TileAdmin {
|
|
|
500
505
|
this._tileTreePropsRequests[i].dispatch();
|
|
501
506
|
}
|
|
502
507
|
processQueue() {
|
|
503
|
-
// Mark all requests as being associated with no
|
|
504
|
-
this.
|
|
508
|
+
// Mark all requests as being associated with no users, indicating they are no longer needed.
|
|
509
|
+
this._tileUserSetsForRequests.clearAll();
|
|
505
510
|
// Notify channels that we are enqueuing new requests.
|
|
506
511
|
this.channels.swapPending();
|
|
507
|
-
// Repopulate pending requests queue from each
|
|
508
|
-
this.
|
|
512
|
+
// Repopulate pending requests queue from each user. We do NOT sort by priority while doing so.
|
|
513
|
+
this._requestsPerUser.forEach((value, key) => this.processRequests(key, value));
|
|
509
514
|
// Ask channels to update their queues and dispatch requests.
|
|
510
515
|
this.channels.process();
|
|
511
516
|
}
|
|
@@ -520,18 +525,18 @@ export class TileAdmin {
|
|
|
520
525
|
const needPurge = this._nextPurgeTime.before(now);
|
|
521
526
|
if (!needPrune && !needPurge)
|
|
522
527
|
return;
|
|
523
|
-
// Identify all of the TileTrees
|
|
524
|
-
// A single viewport can display tiles from more than one IModelConnection.
|
|
528
|
+
// Identify all of the TileTrees in use by all of the TileUsers known to the TileAdmin.
|
|
529
|
+
// NOTE: A single viewport can display tiles from more than one IModelConnection.
|
|
525
530
|
// NOTE: A viewport may be displaying no trees - but we need to record its IModel so we can purge those which are NOT being displayed
|
|
526
531
|
// NOTE: That won't catch external tile trees previously used by that viewport.
|
|
527
532
|
const trees = new DisclosedTileTreeSet();
|
|
528
533
|
const treesByIModel = needPurge ? new Map() : undefined;
|
|
529
|
-
for (const
|
|
530
|
-
if (!
|
|
534
|
+
for (const user of this._users) {
|
|
535
|
+
if (!user.iModel.isOpen) // case of closing an IModelConnection while keeping the Viewport open, possibly for reuse with a different IModelConnection.
|
|
531
536
|
continue;
|
|
532
|
-
|
|
533
|
-
if (treesByIModel && undefined === treesByIModel.get(
|
|
534
|
-
treesByIModel.set(
|
|
537
|
+
user.discloseTileTrees(trees);
|
|
538
|
+
if (treesByIModel && undefined === treesByIModel.get(user.iModel))
|
|
539
|
+
treesByIModel.set(user.iModel, new Set());
|
|
535
540
|
}
|
|
536
541
|
if (needPrune) {
|
|
537
542
|
// Request that each displayed tile tree discard any tiles and/or tile content that is no longer needed.
|
|
@@ -546,21 +551,21 @@ export class TileAdmin {
|
|
|
546
551
|
treesByIModel.set(tree.iModel, set = new Set());
|
|
547
552
|
set.add(tree);
|
|
548
553
|
}
|
|
549
|
-
// Discard any tile trees that are no longer in use by any
|
|
554
|
+
// Discard any tile trees that are no longer in use by any user.
|
|
550
555
|
const olderThan = now.minus(this.tileTreeExpirationTime);
|
|
551
556
|
for (const entry of treesByIModel)
|
|
552
557
|
entry[0].tiles.purge(olderThan, entry[1]);
|
|
553
558
|
this._nextPurgeTime = now.plus(this.tileTreeExpirationTime);
|
|
554
559
|
}
|
|
555
560
|
}
|
|
556
|
-
processRequests(
|
|
561
|
+
processRequests(user, tiles) {
|
|
557
562
|
for (const tile of tiles) {
|
|
558
563
|
if (undefined === tile.request) {
|
|
559
564
|
// ###TODO: This assertion triggers for AttachmentViewports used for rendering 3d sheet attachments.
|
|
560
565
|
// Determine why and fix.
|
|
561
566
|
// assert(tile.loadStatus === Tile.LoadStatus.NotLoaded);
|
|
562
567
|
if (TileLoadStatus.NotLoaded === tile.loadStatus) {
|
|
563
|
-
const request = new TileRequest(tile,
|
|
568
|
+
const request = new TileRequest(tile, user);
|
|
564
569
|
tile.request = request;
|
|
565
570
|
assert(this.channels.has(request.channel));
|
|
566
571
|
request.channel.append(request);
|
|
@@ -571,33 +576,33 @@ export class TileAdmin {
|
|
|
571
576
|
assert(undefined !== req);
|
|
572
577
|
if (undefined !== req) {
|
|
573
578
|
// Request may already be dispatched (in channel's active requests) - if so do not re-enqueue!
|
|
574
|
-
if (req.isQueued && 0 === req.
|
|
579
|
+
if (req.isQueued && 0 === req.users.length)
|
|
575
580
|
req.channel.append(req);
|
|
576
|
-
req.
|
|
577
|
-
assert(0 < req.
|
|
581
|
+
req.addUser(user);
|
|
582
|
+
assert(0 < req.users.length);
|
|
578
583
|
}
|
|
579
584
|
}
|
|
580
585
|
}
|
|
581
586
|
}
|
|
582
|
-
// NB: This does *not* remove from this.
|
|
583
|
-
|
|
584
|
-
this.
|
|
585
|
-
this.
|
|
586
|
-
// NB:
|
|
587
|
-
const tiles = this.
|
|
587
|
+
// NB: This does *not* remove from this._users - a viewport could later be reused with a different IModelConnection.
|
|
588
|
+
onUserIModelClosed(user) {
|
|
589
|
+
this.clearUsageForUser(user);
|
|
590
|
+
this.clearTilesForUser(user);
|
|
591
|
+
// NB: user will be removed from TileUserSets in process() - but if we can establish that only this user wants a given tile, cancel its request immediately.
|
|
592
|
+
const tiles = this._requestsPerUser.get(user);
|
|
588
593
|
if (undefined !== tiles) {
|
|
589
594
|
for (const tile of tiles) {
|
|
590
595
|
const request = tile.request;
|
|
591
|
-
if (undefined !== request && 1 === request.
|
|
596
|
+
if (undefined !== request && 1 === request.users.length)
|
|
592
597
|
request.cancel();
|
|
593
598
|
}
|
|
594
|
-
this.
|
|
599
|
+
this._requestsPerUser.delete(user);
|
|
595
600
|
}
|
|
596
601
|
}
|
|
597
602
|
onIModelClosed(iModel) {
|
|
598
|
-
this.
|
|
599
|
-
if (
|
|
600
|
-
this.
|
|
603
|
+
this._requestsPerUser.forEach((_req, user) => {
|
|
604
|
+
if (user.iModel === iModel)
|
|
605
|
+
this.onUserIModelClosed(user);
|
|
601
606
|
});
|
|
602
607
|
// Remove any TileTreeProps requests associated with this iModel.
|
|
603
608
|
this._tileTreePropsRequests = this._tileTreePropsRequests.filter((req) => {
|