@itwin/frontend-tiles 4.8.0-dev.4 → 4.8.0-dev.6

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.
Files changed (48) hide show
  1. package/CHANGELOG.md +14 -1
  2. package/lib/cjs/BatchedSpatialTileTreeRefs.d.ts.map +1 -1
  3. package/lib/cjs/BatchedSpatialTileTreeRefs.js +48 -0
  4. package/lib/cjs/BatchedSpatialTileTreeRefs.js.map +1 -1
  5. package/lib/cjs/BatchedTileTreeReference.d.ts +2 -0
  6. package/lib/cjs/BatchedTileTreeReference.d.ts.map +1 -1
  7. package/lib/cjs/BatchedTileTreeReference.js +3 -0
  8. package/lib/cjs/BatchedTileTreeReference.js.map +1 -1
  9. package/lib/cjs/FrontendTiles.d.ts +5 -15
  10. package/lib/cjs/FrontendTiles.d.ts.map +1 -1
  11. package/lib/cjs/FrontendTiles.js +35 -68
  12. package/lib/cjs/FrontendTiles.js.map +1 -1
  13. package/lib/cjs/GraphicsProvider/GraphicRepresentationProvider.d.ts +124 -0
  14. package/lib/cjs/GraphicsProvider/GraphicRepresentationProvider.d.ts.map +1 -0
  15. package/lib/cjs/GraphicsProvider/GraphicRepresentationProvider.js +120 -0
  16. package/lib/cjs/GraphicsProvider/GraphicRepresentationProvider.js.map +1 -0
  17. package/lib/cjs/GraphicsProvider/GraphicsProvider.d.ts +27 -0
  18. package/lib/cjs/GraphicsProvider/GraphicsProvider.d.ts.map +1 -0
  19. package/lib/cjs/GraphicsProvider/GraphicsProvider.js +44 -0
  20. package/lib/cjs/GraphicsProvider/GraphicsProvider.js.map +1 -0
  21. package/lib/cjs/frontend-tiles.d.ts +2 -0
  22. package/lib/cjs/frontend-tiles.d.ts.map +1 -1
  23. package/lib/cjs/frontend-tiles.js +2 -0
  24. package/lib/cjs/frontend-tiles.js.map +1 -1
  25. package/lib/esm/BatchedSpatialTileTreeRefs.d.ts.map +1 -1
  26. package/lib/esm/BatchedSpatialTileTreeRefs.js +48 -0
  27. package/lib/esm/BatchedSpatialTileTreeRefs.js.map +1 -1
  28. package/lib/esm/BatchedTileTreeReference.d.ts +2 -0
  29. package/lib/esm/BatchedTileTreeReference.d.ts.map +1 -1
  30. package/lib/esm/BatchedTileTreeReference.js +3 -0
  31. package/lib/esm/BatchedTileTreeReference.js.map +1 -1
  32. package/lib/esm/FrontendTiles.d.ts +5 -15
  33. package/lib/esm/FrontendTiles.d.ts.map +1 -1
  34. package/lib/esm/FrontendTiles.js +35 -68
  35. package/lib/esm/FrontendTiles.js.map +1 -1
  36. package/lib/esm/GraphicsProvider/GraphicRepresentationProvider.d.ts +124 -0
  37. package/lib/esm/GraphicsProvider/GraphicRepresentationProvider.d.ts.map +1 -0
  38. package/lib/esm/GraphicsProvider/GraphicRepresentationProvider.js +115 -0
  39. package/lib/esm/GraphicsProvider/GraphicRepresentationProvider.js.map +1 -0
  40. package/lib/esm/GraphicsProvider/GraphicsProvider.d.ts +27 -0
  41. package/lib/esm/GraphicsProvider/GraphicsProvider.d.ts.map +1 -0
  42. package/lib/esm/GraphicsProvider/GraphicsProvider.js +40 -0
  43. package/lib/esm/GraphicsProvider/GraphicsProvider.js.map +1 -0
  44. package/lib/esm/frontend-tiles.d.ts +2 -0
  45. package/lib/esm/frontend-tiles.d.ts.map +1 -1
  46. package/lib/esm/frontend-tiles.js +2 -0
  47. package/lib/esm/frontend-tiles.js.map +1 -1
  48. package/package.json +11 -11
@@ -0,0 +1,124 @@
1
+ import { AccessToken } from "@itwin/core-bentley";
2
+ /** The expected format of the Graphic Representation
3
+ * @beta
4
+ */
5
+ export type GraphicRepresentationFormat = "IMDL" | "3DTILES" | string;
6
+ /** Graphic representations are generated from Data Sources.
7
+ * The status of a Graphic Representation indicates the progress of that generation process.
8
+ * @beta
9
+ */
10
+ export declare enum GraphicRepresentationStatus {
11
+ InProgress = "In progress",
12
+ Complete = "Complete",
13
+ NotStarted = "Not started",
14
+ Failed = "Failed"
15
+ }
16
+ /**
17
+ * Represents a data source for a graphic representation.
18
+ * A data source is usually higher-fidelity and contains more information, but may not be as well suited for visualization
19
+ * as a graphic representation.
20
+ * @beta
21
+ */
22
+ export interface DataSource {
23
+ /** The iTwinId associated with the DataSource */
24
+ iTwinId: string;
25
+ /** The unique identifier of a DataSource.
26
+ * For example, a DataSource of type "IMODEL" has an iModelId which would be attributed to this value.
27
+ */
28
+ id: string;
29
+ /** The unique identifier for a specific version of a DataSource.
30
+ * For example, if a specific version of an iModel is desired, the iModel's changesetId would be attributed to this value.
31
+ */
32
+ changeId?: string;
33
+ /** The type of the data source. For example, a DataSource can be of type "IMODEL" or "RealityData" */
34
+ type: string;
35
+ }
36
+ /** Represents a visual representation of a data source, for example a 3d tileset.
37
+ * A data source can be an iModel, reality data, or other kind of graphical data.
38
+ * @see [[queryGraphicRepresentations]] for its construction as a representation of the data produced by a query of data sources.
39
+ * @beta
40
+ */
41
+ export type GraphicRepresentation = {
42
+ /** The display name of the Graphic Representation */
43
+ displayName: string;
44
+ /** The unique identifier for the Graphic Representation */
45
+ representationId: string;
46
+ /** The status of the generation of the Graphic Representation from its Data Source.
47
+ * @see [[GraphicRepresentationStatus]] for possible values.
48
+ */
49
+ status: GraphicRepresentationStatus;
50
+ /** The expected format of the Graphic Representation
51
+ * @see [[GraphicRepresentationFormat]] for possible values.
52
+ */
53
+ format: GraphicRepresentationFormat;
54
+ /** The data source that the representation originates from.
55
+ * For example, a GraphicRepresentation in the 3D Tiles format might have a dataSource that is a specific iModel changeset.
56
+ */
57
+ dataSource: DataSource;
58
+ } & ({
59
+ status: Omit<GraphicRepresentationStatus, GraphicRepresentationStatus.Complete>;
60
+ url?: string;
61
+ } | {
62
+ status: GraphicRepresentationStatus.Complete;
63
+ url: string;
64
+ });
65
+ /** Arguments supplied to [[queryGraphicRepresentations]].
66
+ * @beta
67
+ */
68
+ export interface QueryGraphicRepresentationsArgs {
69
+ /** The token used to access the data source provider. */
70
+ accessToken: AccessToken;
71
+ /** The unique identifier for the session in which this data source was queried.
72
+ * A possible value is IModelApp.sessionId.
73
+ */
74
+ sessionId: string;
75
+ /** The Data Source for which to query the graphic representations */
76
+ dataSource: DataSource;
77
+ /** The expected format of the graphic representations
78
+ * @see [[GraphicRepresentationFormat]] for possible values.
79
+ */
80
+ format: GraphicRepresentationFormat;
81
+ /** Chiefly used in testing environments. */
82
+ urlPrefix?: string;
83
+ /** If true, exports whose status is not "Complete" (indicating the export successfully finished) will be included in the results */
84
+ includeIncomplete?: boolean;
85
+ /** If true, enables a CDN (content delivery network) to access tiles faster. */
86
+ enableCDN?: boolean;
87
+ }
88
+ /** Query Graphic Representations matching the specified criteria, sorted from most-recently- to least-recently-produced.
89
+ * @beta
90
+ */
91
+ export declare function queryGraphicRepresentations(args: QueryGraphicRepresentationsArgs): AsyncIterableIterator<GraphicRepresentation>;
92
+ /** Arguments supplied to [[obtainGraphicRepresentationUrl]].
93
+ * @beta
94
+ */
95
+ export interface ObtainGraphicRepresentationUrlArgs {
96
+ /** The token used to access the mesh export service. */
97
+ accessToken: AccessToken;
98
+ /** The unique identifier for the session in which this data source was queried.
99
+ * A possible value is IModelApp.sessionId.
100
+ */
101
+ sessionId: string;
102
+ /** The data source for which to query the graphic representations */
103
+ dataSource: DataSource;
104
+ /** The expected format of the graphic representations
105
+ * @see [[GraphicRepresentationFormat]] for possible values.
106
+ */
107
+ format: GraphicRepresentationFormat;
108
+ /** Chiefly used in testing environments. */
109
+ urlPrefix?: string;
110
+ /** If true, only data produced for a specific data source version will be considered;
111
+ * otherwise, if no data sources are found with the specified version,the most recent data source version will be used.
112
+ */
113
+ requireExactVersion?: boolean;
114
+ /** If true, enables a CDN (content delivery network) to access tiles faster. */
115
+ enableCDN?: boolean;
116
+ }
117
+ /** Obtains a URL pointing to a Graphic Representation.
118
+ * [[queryGraphicRepresentations]] is used to obtain a list of available representations. By default, the list is sorted from most to least recently-created.
119
+ * The first representation matching the source version is selected; or, if no such representation exists, the first representation in the list is selected.
120
+ * @returns A URL from which the tileset can be loaded, or `undefined` if no appropriate URL could be obtained.
121
+ * @beta
122
+ */
123
+ export declare function obtainGraphicRepresentationUrl(args: ObtainGraphicRepresentationUrlArgs): Promise<URL | undefined>;
124
+ //# sourceMappingURL=GraphicRepresentationProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphicRepresentationProvider.d.ts","sourceRoot":"","sources":["../../../src/GraphicsProvider/GraphicRepresentationProvider.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAS,MAAM,qBAAqB,CAAC;AAGzD;;GAEG;AAEH,MAAM,MAAM,2BAA2B,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC;AAEtE;;;GAGG;AACH,oBAAY,2BAA2B;IACrC,UAAU,gBAAgB;IAC1B,QAAQ,aAAa;IACrB,UAAU,gBAAgB;IAC1B,MAAM,WAAW;CAClB;AAED;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,iDAAiD;IACjD,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;MAEE;IACF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,sGAAsG;IACtG,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,qDAAqD;IACrD,WAAW,EAAE,MAAM,CAAC;IACpB,2DAA2D;IAC3D,gBAAgB,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,MAAM,EAAE,2BAA2B,CAAC;IACpC;;OAEG;IACH,MAAM,EAAG,2BAA2B,CAAC;IACrC;;OAEG;IACH,UAAU,EAAE,UAAU,CAAC;CAKxB,GAAG,CAAC;IACH,MAAM,EAAE,IAAI,CAAC,2BAA2B,EAAE,2BAA2B,CAAC,QAAQ,CAAC,CAAC;IAChF,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,GAAG;IACF,MAAM,EAAE,2BAA2B,CAAC,QAAQ,CAAC;IAC7C,GAAG,EAAE,MAAM,CAAC;CACb,CAAC,CAAC;AAiBH;;GAEG;AACH,MAAM,WAAW,+BAA+B;IAC9C,yDAAyD;IACzD,WAAW,EAAE,WAAW,CAAC;IACzB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB,qEAAqE;IACrE,UAAU,EAAE,UAAU,CAAC;IACvB;;OAEG;IACH,MAAM,EAAG,2BAA2B,CAAC;IACrC,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oIAAoI;IACpI,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,gFAAgF;IAChF,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;GAEG;AACH,wBAAuB,2BAA2B,CAAC,IAAI,EAAE,+BAA+B,GAAG,qBAAqB,CAAC,qBAAqB,CAAC,CA4EtI;AAED;;GAEG;AACH,MAAM,WAAW,kCAAkC;IACjD,wDAAwD;IACxD,WAAW,EAAE,WAAW,CAAC;IACzB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB,qEAAqE;IACrE,UAAU,EAAE,UAAU,CAAC;IACvB;;OAEG;IACH,MAAM,EAAG,2BAA2B,CAAC;IACrC,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,gFAAgF;IAChF,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;;;GAKG;AACH,wBAAsB,8BAA8B,CAAC,IAAI,EAAE,kCAAkC,GAAG,OAAO,CAAC,GAAG,GAAG,SAAS,CAAC,CAsCvH"}
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.obtainGraphicRepresentationUrl = exports.queryGraphicRepresentations = exports.GraphicRepresentationStatus = void 0;
8
+ const core_bentley_1 = require("@itwin/core-bentley");
9
+ const LoggerCategory_1 = require("../LoggerCategory");
10
+ /** Graphic representations are generated from Data Sources.
11
+ * The status of a Graphic Representation indicates the progress of that generation process.
12
+ * @beta
13
+ */
14
+ var GraphicRepresentationStatus;
15
+ (function (GraphicRepresentationStatus) {
16
+ GraphicRepresentationStatus["InProgress"] = "In progress";
17
+ GraphicRepresentationStatus["Complete"] = "Complete";
18
+ GraphicRepresentationStatus["NotStarted"] = "Not started";
19
+ GraphicRepresentationStatus["Failed"] = "Failed";
20
+ })(GraphicRepresentationStatus || (exports.GraphicRepresentationStatus = GraphicRepresentationStatus = {}));
21
+ /** Creates a URL used to query for Graphic Representations */
22
+ function createGraphicRepresentationsQueryUrl(args) {
23
+ const prefix = args.urlPrefix ?? "";
24
+ let url = `https://${prefix}api.bentley.com/mesh-export/?iModelId=${args.sourceId}&$orderBy=date:desc`;
25
+ if (args.changeId)
26
+ url = `${url}&changesetId=${args.changeId}`;
27
+ if (args.enableCDN)
28
+ url = `${url}&cdn=1`;
29
+ url = `${url}&tileVersion=1&exportType=IMODEL`;
30
+ return url;
31
+ }
32
+ /** Query Graphic Representations matching the specified criteria, sorted from most-recently- to least-recently-produced.
33
+ * @beta
34
+ */
35
+ async function* queryGraphicRepresentations(args) {
36
+ const headers = {
37
+ /* eslint-disable-next-line @typescript-eslint/naming-convention */
38
+ Authorization: args.accessToken,
39
+ /* eslint-disable-next-line @typescript-eslint/naming-convention */
40
+ Accept: "application/vnd.bentley.itwin-platform.v1+json",
41
+ /* eslint-disable-next-line @typescript-eslint/naming-convention */
42
+ Prefer: "return=representation",
43
+ /* eslint-disable-next-line @typescript-eslint/naming-convention */
44
+ SessionId: args.sessionId,
45
+ };
46
+ let url = createGraphicRepresentationsQueryUrl({ sourceId: args.dataSource.id, urlPrefix: args.urlPrefix, changeId: args.dataSource.changeId, enableCDN: args.enableCDN });
47
+ while (url) {
48
+ let result;
49
+ try {
50
+ const response = await fetch(url, { headers });
51
+ result = await response.json();
52
+ }
53
+ catch (err) {
54
+ core_bentley_1.Logger.logException(LoggerCategory_1.loggerCategory, err);
55
+ core_bentley_1.Logger.logError(LoggerCategory_1.loggerCategory, `Failed loading Graphics Data for Source ${args.dataSource.id}`);
56
+ break;
57
+ }
58
+ const foundSources = result.exports.filter((x) => x.request.exportType === args.dataSource.type && (args.includeIncomplete || x.status === GraphicRepresentationStatus.Complete));
59
+ for (const foundSource of foundSources) {
60
+ const graphicRepresentation = {
61
+ displayName: foundSource.displayName,
62
+ representationId: foundSource.id,
63
+ status: foundSource.status,
64
+ format: args.format,
65
+ url: foundSource._links.mesh.href,
66
+ dataSource: {
67
+ iTwinId: args.dataSource.iTwinId,
68
+ id: foundSource.request.iModelId,
69
+ versionId: foundSource.request.changesetId,
70
+ type: foundSource.request.exportType,
71
+ },
72
+ };
73
+ yield graphicRepresentation;
74
+ }
75
+ url = result._links.next?.href;
76
+ }
77
+ }
78
+ exports.queryGraphicRepresentations = queryGraphicRepresentations;
79
+ /** Obtains a URL pointing to a Graphic Representation.
80
+ * [[queryGraphicRepresentations]] is used to obtain a list of available representations. By default, the list is sorted from most to least recently-created.
81
+ * The first representation matching the source version is selected; or, if no such representation exists, the first representation in the list is selected.
82
+ * @returns A URL from which the tileset can be loaded, or `undefined` if no appropriate URL could be obtained.
83
+ * @beta
84
+ */
85
+ async function obtainGraphicRepresentationUrl(args) {
86
+ if (!args.dataSource.id) {
87
+ core_bentley_1.Logger.logInfo(LoggerCategory_1.loggerCategory, "Cannot obtain Graphics Data from a source without an Id");
88
+ return undefined;
89
+ }
90
+ const queryArgs = {
91
+ accessToken: args.accessToken,
92
+ sessionId: args.sessionId,
93
+ dataSource: args.dataSource,
94
+ format: args.format,
95
+ urlPrefix: args.urlPrefix,
96
+ enableCDN: args.enableCDN,
97
+ };
98
+ let selectedData;
99
+ for await (const data of queryGraphicRepresentations(queryArgs)) {
100
+ selectedData = data;
101
+ break;
102
+ }
103
+ if (!selectedData && !args.requireExactVersion) {
104
+ queryArgs.dataSource.changeId = undefined;
105
+ for await (const data of queryGraphicRepresentations(queryArgs)) {
106
+ selectedData = data;
107
+ core_bentley_1.Logger.logInfo(LoggerCategory_1.loggerCategory, `No data for Data Source ${args.dataSource.id} for version ${args.dataSource.changeId}; falling back to most recent`);
108
+ break;
109
+ }
110
+ }
111
+ if ((!selectedData) || (!selectedData.url)) {
112
+ core_bentley_1.Logger.logInfo(LoggerCategory_1.loggerCategory, `No data available for Data Source ${args.dataSource.id}`);
113
+ return undefined;
114
+ }
115
+ const url = new URL(selectedData.url);
116
+ url.pathname = `${url.pathname}/tileset.json`;
117
+ return url;
118
+ }
119
+ exports.obtainGraphicRepresentationUrl = obtainGraphicRepresentationUrl;
120
+ //# sourceMappingURL=GraphicRepresentationProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphicRepresentationProvider.js","sourceRoot":"","sources":["../../../src/GraphicsProvider/GraphicRepresentationProvider.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,sDAAyD;AACzD,sDAAkD;AAQlD;;;GAGG;AACH,IAAY,2BAKX;AALD,WAAY,2BAA2B;IACrC,yDAA0B,CAAA;IAC1B,oDAAqB,CAAA;IACrB,yDAA0B,CAAA;IAC1B,gDAAiB,CAAA;AACnB,CAAC,EALW,2BAA2B,2CAA3B,2BAA2B,QAKtC;AAyDD,8DAA8D;AAC9D,SAAS,oCAAoC,CAAC,IAAsF;IAClI,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,IAAI,EAAE,CAAC;IACpC,IAAI,GAAG,GAAG,WAAW,MAAM,yCAAyC,IAAI,CAAC,QAAQ,qBAAqB,CAAC;IACvG,IAAI,IAAI,CAAC,QAAQ;QACf,GAAG,GAAG,GAAG,GAAG,gBAAgB,IAAI,CAAC,QAAQ,EAAE,CAAC;IAE9C,IAAI,IAAI,CAAC,SAAS;QAChB,GAAG,GAAG,GAAG,GAAG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,IAAI,YAAY,CAAC;IACjB,IAAI,KAAK,EAAE,MAAM,IAAI,IAAI,2BAA2B,CAAC,SAAS,CAAC,EAAE,CAAC;QAChE,YAAY,GAAG,IAAI,CAAC;QACpB,MAAM;IACR,CAAC;IAED,IAAI,CAAC,YAAY,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAC/C,SAAS,CAAC,UAAU,CAAC,QAAQ,GAAG,SAAS,CAAC;QAC1C,IAAI,KAAK,EAAE,MAAM,IAAI,IAAI,2BAA2B,CAAC,SAAS,CAAC,EAAE,CAAC;YAChE,YAAY,GAAG,IAAI,CAAC;YACpB,qBAAM,CAAC,OAAO,CAAC,+BAAc,EAAE,2BAA2B,IAAI,CAAC,UAAU,CAAC,EAAE,gBAAgB,IAAI,CAAC,UAAU,CAAC,QAAQ,+BAA+B,CAAC,CAAC;YACrJ,MAAM;QACR,CAAC;IACH,CAAC;IAED,IAAI,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC;QAC3C,qBAAM,CAAC,OAAO,CAAC,+BAAc,EAAE,qCAAqC,IAAI,CAAC,UAAU,CAAC,EAAE,EAAE,CAAC,CAAC;QAC1F,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;IACtC,GAAG,CAAC,QAAQ,GAAG,GAAG,GAAG,CAAC,QAAQ,eAAe,CAAC;IAC9C,OAAO,GAAG,CAAC;AACb,CAAC;AAtCD,wEAsCC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n * See LICENSE.md in the project root for license terms and full copyright notice.\r\n *--------------------------------------------------------------------------------------------*/\r\n\r\nimport { AccessToken, Logger} from \"@itwin/core-bentley\";\r\nimport { loggerCategory} from \"../LoggerCategory\";\r\n\r\n/** The expected format of the Graphic Representation\r\n * @beta\r\n */\r\n/* eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents */\r\nexport type GraphicRepresentationFormat = \"IMDL\" | \"3DTILES\" | string;\r\n\r\n/** Graphic representations are generated from Data Sources.\r\n * The status of a Graphic Representation indicates the progress of that generation process.\r\n * @beta\r\n */\r\nexport enum GraphicRepresentationStatus {\r\n InProgress = \"In progress\",\r\n Complete = \"Complete\",\r\n NotStarted = \"Not started\",\r\n Failed = \"Failed\",\r\n}\r\n\r\n/**\r\n * Represents a data source for a graphic representation.\r\n * A data source is usually higher-fidelity and contains more information, but may not be as well suited for visualization\r\n * as a graphic representation.\r\n * @beta\r\n */\r\nexport interface DataSource {\r\n /** The iTwinId associated with the DataSource */\r\n iTwinId: string;\r\n /** The unique identifier of a DataSource.\r\n * For example, a DataSource of type \"IMODEL\" has an iModelId which would be attributed to this value.\r\n */\r\n id: string;\r\n /** The unique identifier for a specific version of a DataSource.\r\n * For example, if a specific version of an iModel is desired, the iModel's changesetId would be attributed to this value.\r\n */\r\n changeId?: string;\r\n /** The type of the data source. For example, a DataSource can be of type \"IMODEL\" or \"RealityData\" */\r\n type: string;\r\n}\r\n\r\n/** Represents a visual representation of a data source, for example a 3d tileset.\r\n * A data source can be an iModel, reality data, or other kind of graphical data.\r\n * @see [[queryGraphicRepresentations]] for its construction as a representation of the data produced by a query of data sources.\r\n * @beta\r\n */\r\nexport type GraphicRepresentation = {\r\n /** The display name of the Graphic Representation */\r\n displayName: string;\r\n /** The unique identifier for the Graphic Representation */\r\n representationId: string;\r\n /** The status of the generation of the Graphic Representation from its Data Source.\r\n * @see [[GraphicRepresentationStatus]] for possible values.\r\n */\r\n status: GraphicRepresentationStatus;\r\n /** The expected format of the Graphic Representation\r\n * @see [[GraphicRepresentationFormat]] for possible values.\r\n */\r\n format: GraphicRepresentationFormat;\r\n /** The data source that the representation originates from.\r\n * For example, a GraphicRepresentation in the 3D Tiles format might have a dataSource that is a specific iModel changeset.\r\n */\r\n dataSource: DataSource;\r\n /** The url of the graphic representation\r\n * @note The url can only be guaranteed to be valid if the status is complete.\r\n * Therefore, the url is optional if the status is not complete, and required if the status is complete.\r\n */\r\n} & ({\r\n status: Omit<GraphicRepresentationStatus, GraphicRepresentationStatus.Complete>;\r\n url?: string;\r\n} | {\r\n status: GraphicRepresentationStatus.Complete;\r\n url: string;\r\n});\r\n\r\n/** Creates a URL used to query for Graphic Representations */\r\nfunction createGraphicRepresentationsQueryUrl(args: { sourceId: string, urlPrefix?: string, changeId?: string, enableCDN?: boolean }): string {\r\n const prefix = args.urlPrefix ?? \"\";\r\n let url = `https://${prefix}api.bentley.com/mesh-export/?iModelId=${args.sourceId}&$orderBy=date:desc`;\r\n if (args.changeId)\r\n url = `${url}&changesetId=${args.changeId}`;\r\n\r\n if (args.enableCDN)\r\n url = `${url}&cdn=1`;\r\n\r\n url = `${url}&tileVersion=1&exportType=IMODEL`;\r\n\r\n return url;\r\n}\r\n\r\n/** Arguments supplied to [[queryGraphicRepresentations]].\r\n * @beta\r\n */\r\nexport interface QueryGraphicRepresentationsArgs {\r\n /** The token used to access the data source provider. */\r\n accessToken: AccessToken;\r\n /** The unique identifier for the session in which this data source was queried.\r\n * A possible value is IModelApp.sessionId.\r\n */\r\n sessionId: string;\r\n /** The Data Source for which to query the graphic representations */\r\n dataSource: DataSource;\r\n /** The expected format of the graphic representations\r\n * @see [[GraphicRepresentationFormat]] for possible values.\r\n */\r\n format: GraphicRepresentationFormat;\r\n /** Chiefly used in testing environments. */\r\n urlPrefix?: string;\r\n /** If true, exports whose status is not \"Complete\" (indicating the export successfully finished) will be included in the results */\r\n includeIncomplete?: boolean;\r\n /** If true, enables a CDN (content delivery network) to access tiles faster. */\r\n enableCDN?: boolean;\r\n}\r\n\r\n/** Query Graphic Representations matching the specified criteria, sorted from most-recently- to least-recently-produced.\r\n * @beta\r\n */\r\nexport async function* queryGraphicRepresentations(args: QueryGraphicRepresentationsArgs): AsyncIterableIterator<GraphicRepresentation> {\r\n interface ServiceJsonResponse {\r\n id: string;\r\n displayName: string;\r\n status: GraphicRepresentationStatus;\r\n request: {\r\n iModelId: string;\r\n changesetId: string;\r\n exportType: string;\r\n geometryOptions: any;\r\n viewDefinitionFilter: any;\r\n };\r\n\r\n /* eslint-disable-next-line @typescript-eslint/naming-convention */\r\n _links: {\r\n mesh: {\r\n href: string;\r\n };\r\n };\r\n }\r\n\r\n interface ServiceJsonResponses {\r\n exports: ServiceJsonResponse[];\r\n\r\n /* eslint-disable-next-line @typescript-eslint/naming-convention */\r\n _links: {\r\n next?: {\r\n href: string;\r\n };\r\n };\r\n }\r\n\r\n const headers = {\r\n /* eslint-disable-next-line @typescript-eslint/naming-convention */\r\n Authorization: args.accessToken,\r\n /* eslint-disable-next-line @typescript-eslint/naming-convention */\r\n Accept: \"application/vnd.bentley.itwin-platform.v1+json\",\r\n /* eslint-disable-next-line @typescript-eslint/naming-convention */\r\n Prefer: \"return=representation\",\r\n /* eslint-disable-next-line @typescript-eslint/naming-convention */\r\n SessionId: args.sessionId,\r\n };\r\n\r\n let url: string | undefined = createGraphicRepresentationsQueryUrl({ sourceId: args.dataSource.id, urlPrefix: args.urlPrefix, changeId: args.dataSource.changeId, enableCDN: args.enableCDN });\r\n while (url) {\r\n let result;\r\n try {\r\n const response = await fetch(url, { headers });\r\n result = await response.json() as ServiceJsonResponses;\r\n } catch (err) {\r\n Logger.logException(loggerCategory, err);\r\n Logger.logError(loggerCategory, `Failed loading Graphics Data for Source ${args.dataSource.id}`);\r\n break;\r\n }\r\n\r\n const foundSources = result.exports.filter((x) => x.request.exportType === args.dataSource.type && (args.includeIncomplete || x.status === GraphicRepresentationStatus.Complete));\r\n for (const foundSource of foundSources) {\r\n const graphicRepresentation = {\r\n displayName: foundSource.displayName,\r\n representationId: foundSource.id,\r\n status: foundSource.status,\r\n format: args.format,\r\n url: foundSource._links.mesh.href,\r\n dataSource: {\r\n iTwinId: args.dataSource.iTwinId,\r\n id: foundSource.request.iModelId,\r\n versionId: foundSource.request.changesetId,\r\n type: foundSource.request.exportType,\r\n },\r\n };\r\n\r\n yield graphicRepresentation;\r\n }\r\n\r\n url = result._links.next?.href;\r\n }\r\n}\r\n\r\n/** Arguments supplied to [[obtainGraphicRepresentationUrl]].\r\n * @beta\r\n */\r\nexport interface ObtainGraphicRepresentationUrlArgs {\r\n /** The token used to access the mesh export service. */\r\n accessToken: AccessToken;\r\n /** The unique identifier for the session in which this data source was queried.\r\n * A possible value is IModelApp.sessionId.\r\n */\r\n sessionId: string;\r\n /** The data source for which to query the graphic representations */\r\n dataSource: DataSource;\r\n /** The expected format of the graphic representations\r\n * @see [[GraphicRepresentationFormat]] for possible values.\r\n */\r\n format: GraphicRepresentationFormat;\r\n /** Chiefly used in testing environments. */\r\n urlPrefix?: string;\r\n /** If true, only data produced for a specific data source version will be considered;\r\n * otherwise, if no data sources are found with the specified version,the most recent data source version will be used.\r\n */\r\n requireExactVersion?: boolean;\r\n /** If true, enables a CDN (content delivery network) to access tiles faster. */\r\n enableCDN?: boolean;\r\n}\r\n\r\n/** Obtains a URL pointing to a Graphic Representation.\r\n * [[queryGraphicRepresentations]] is used to obtain a list of available representations. By default, the list is sorted from most to least recently-created.\r\n * The first representation matching the source version is selected; or, if no such representation exists, the first representation in the list is selected.\r\n * @returns A URL from which the tileset can be loaded, or `undefined` if no appropriate URL could be obtained.\r\n * @beta\r\n */\r\nexport async function obtainGraphicRepresentationUrl(args: ObtainGraphicRepresentationUrlArgs): Promise<URL | undefined> {\r\n if (!args.dataSource.id) {\r\n Logger.logInfo(loggerCategory, \"Cannot obtain Graphics Data from a source without an Id\");\r\n return undefined;\r\n }\r\n\r\n const queryArgs: QueryGraphicRepresentationsArgs = {\r\n accessToken: args.accessToken,\r\n sessionId: args.sessionId,\r\n dataSource: args.dataSource,\r\n format: args.format,\r\n urlPrefix: args.urlPrefix,\r\n enableCDN: args.enableCDN,\r\n };\r\n\r\n let selectedData;\r\n for await (const data of queryGraphicRepresentations(queryArgs)) {\r\n selectedData = data;\r\n break;\r\n }\r\n\r\n if (!selectedData && !args.requireExactVersion) {\r\n queryArgs.dataSource.changeId = undefined;\r\n for await (const data of queryGraphicRepresentations(queryArgs)) {\r\n selectedData = data;\r\n Logger.logInfo(loggerCategory, `No data for Data Source ${args.dataSource.id} for version ${args.dataSource.changeId}; falling back to most recent`);\r\n break;\r\n }\r\n }\r\n\r\n if ((!selectedData) || (!selectedData.url)) {\r\n Logger.logInfo(loggerCategory, `No data available for Data Source ${args.dataSource.id}`);\r\n return undefined;\r\n }\r\n\r\n const url = new URL(selectedData.url);\r\n url.pathname = `${url.pathname}/tileset.json`;\r\n return url;\r\n}\r\n"]}
@@ -0,0 +1,27 @@
1
+ import { AccessToken } from "@itwin/core-bentley";
2
+ import { IModelConnection } from "@itwin/core-frontend";
3
+ /** Arguments supplied to [[obtainMeshExportTilesetUrl]].
4
+ * @beta
5
+ */
6
+ export interface ObtainIModelTilesetUrlArgs {
7
+ /** The iModel for which to obtain a tileset URl. */
8
+ iModel: IModelConnection;
9
+ /** The token used to access the mesh export service. */
10
+ accessToken: AccessToken;
11
+ /** Chiefly used in testing environments. */
12
+ urlPrefix?: string;
13
+ /** If true, only exports produced for `iModel`'s specific changeset will be considered; otherwise, if no exports are found for the changeset,
14
+ * the most recent export for any changeset will be used.
15
+ */
16
+ requireExactChangeset?: boolean;
17
+ /** If true, enables a CDN (content delivery network) to access tiles faster. */
18
+ enableCDN?: boolean;
19
+ }
20
+ /** Obtains a URL pointing to a tileset appropriate for visualizing a specific iModel.
21
+ * [[queryCompletedMeshExports]] is used to obtain a list of available exports. By default, the list is sorted from most to least recently-exported.
22
+ * The first export matching the iModel's changeset is selected; or, if no such export exists, the first export in the list is selected.
23
+ * @returns A URL from which the tileset can be loaded, or `undefined` if no appropriate URL could be obtained.
24
+ * @beta
25
+ */
26
+ export declare function obtainIModelTilesetUrl(args: ObtainIModelTilesetUrlArgs): Promise<URL | undefined>;
27
+ //# sourceMappingURL=GraphicsProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphicsProvider.d.ts","sourceRoot":"","sources":["../../../src/GraphicsProvider/GraphicsProvider.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAS,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAa,gBAAgB,EAAC,MAAM,sBAAsB,CAAC;AAIlE;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,oDAAoD;IACpD,MAAM,EAAE,gBAAgB,CAAC;IACzB,wDAAwD;IACxD,WAAW,EAAE,WAAW,CAAC;IACzB,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,gFAAgF;IAChF,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAAC,IAAI,EAAE,0BAA0B,GAC7E,OAAO,CAAC,GAAG,GAAC,SAAS,CAAC,CA2BrB"}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.obtainIModelTilesetUrl = void 0;
8
+ const core_bentley_1 = require("@itwin/core-bentley");
9
+ const core_frontend_1 = require("@itwin/core-frontend");
10
+ const GraphicRepresentationProvider_1 = require("./GraphicRepresentationProvider");
11
+ const LoggerCategory_1 = require("../LoggerCategory");
12
+ /** Obtains a URL pointing to a tileset appropriate for visualizing a specific iModel.
13
+ * [[queryCompletedMeshExports]] is used to obtain a list of available exports. By default, the list is sorted from most to least recently-exported.
14
+ * The first export matching the iModel's changeset is selected; or, if no such export exists, the first export in the list is selected.
15
+ * @returns A URL from which the tileset can be loaded, or `undefined` if no appropriate URL could be obtained.
16
+ * @beta
17
+ */
18
+ async function obtainIModelTilesetUrl(args) {
19
+ if (!args.iModel.iModelId) {
20
+ core_bentley_1.Logger.logInfo(LoggerCategory_1.loggerCategory, "Cannot obtain Graphics Data for an iModel with no iModelId");
21
+ return undefined;
22
+ }
23
+ if (!args.iModel.iTwinId) {
24
+ core_bentley_1.Logger.logInfo(LoggerCategory_1.loggerCategory, "Cannot obtain Graphics Data for an iModel with no iTwinId");
25
+ return undefined;
26
+ }
27
+ const graphicsArgs = {
28
+ accessToken: args.accessToken,
29
+ sessionId: core_frontend_1.IModelApp.sessionId,
30
+ dataSource: {
31
+ iTwinId: args.iModel.iTwinId,
32
+ id: args.iModel.iModelId,
33
+ changeId: args.iModel.changeset.id,
34
+ type: "IMODEL",
35
+ },
36
+ format: "IMDL",
37
+ urlPrefix: args.urlPrefix,
38
+ requireExactVersion: args.requireExactChangeset,
39
+ enableCDN: args.enableCDN,
40
+ };
41
+ return (0, GraphicRepresentationProvider_1.obtainGraphicRepresentationUrl)(graphicsArgs);
42
+ }
43
+ exports.obtainIModelTilesetUrl = obtainIModelTilesetUrl;
44
+ //# sourceMappingURL=GraphicsProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphicsProvider.js","sourceRoot":"","sources":["../../../src/GraphicsProvider/GraphicsProvider.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,sDAAyD;AACzD,wDAAkE;AAClE,mFAAgF;AAChF,sDAAkD;AAoBlD;;;;;GAKG;AACI,KAAK,UAAU,sBAAsB,CAAC,IAAgC;IAE3E,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;QAC1B,qBAAM,CAAC,OAAO,CAAC,+BAAc,EAAE,4DAA4D,CAAC,CAAC;QAC7F,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACzB,qBAAM,CAAC,OAAO,CAAC,+BAAc,EAAE,2DAA2D,CAAC,CAAC;QAC5F,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,YAAY,GAAG;QACnB,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,SAAS,EAAE,yBAAS,CAAC,SAAS;QAC9B,UAAU,EAAE;YACV,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO;YAC5B,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ;YACxB,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE;YAClC,IAAI,EAAE,QAAQ;SACf;QACD,MAAM,EAAE,MAAM;QACd,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,mBAAmB,EAAE,IAAI,CAAC,qBAAqB;QAC/C,SAAS,EAAE,IAAI,CAAC,SAAS;KAC1B,CAAC;IAEF,OAAO,IAAA,8DAA8B,EAAC,YAAY,CAAC,CAAC;AACtD,CAAC;AA5BD,wDA4BC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n * See LICENSE.md in the project root for license terms and full copyright notice.\r\n *--------------------------------------------------------------------------------------------*/\r\n\r\nimport { AccessToken, Logger} from \"@itwin/core-bentley\";\r\nimport { IModelApp, IModelConnection} from \"@itwin/core-frontend\";\r\nimport { obtainGraphicRepresentationUrl} from \"./GraphicRepresentationProvider\";\r\nimport { loggerCategory} from \"../LoggerCategory\";\r\n\r\n/** Arguments supplied to [[obtainMeshExportTilesetUrl]].\r\n * @beta\r\n */\r\nexport interface ObtainIModelTilesetUrlArgs {\r\n /** The iModel for which to obtain a tileset URl. */\r\n iModel: IModelConnection;\r\n /** The token used to access the mesh export service. */\r\n accessToken: AccessToken;\r\n /** Chiefly used in testing environments. */\r\n urlPrefix?: string;\r\n /** If true, only exports produced for `iModel`'s specific changeset will be considered; otherwise, if no exports are found for the changeset,\r\n * the most recent export for any changeset will be used.\r\n */\r\n requireExactChangeset?: boolean;\r\n /** If true, enables a CDN (content delivery network) to access tiles faster. */\r\n enableCDN?: boolean;\r\n}\r\n\r\n/** Obtains a URL pointing to a tileset appropriate for visualizing a specific iModel.\r\n * [[queryCompletedMeshExports]] is used to obtain a list of available exports. By default, the list is sorted from most to least recently-exported.\r\n * The first export matching the iModel's changeset is selected; or, if no such export exists, the first export in the list is selected.\r\n * @returns A URL from which the tileset can be loaded, or `undefined` if no appropriate URL could be obtained.\r\n * @beta\r\n */\r\nexport async function obtainIModelTilesetUrl(args: ObtainIModelTilesetUrlArgs):\r\nPromise<URL|undefined> {\r\n if (!args.iModel.iModelId) {\r\n Logger.logInfo(loggerCategory, \"Cannot obtain Graphics Data for an iModel with no iModelId\");\r\n return undefined;\r\n }\r\n\r\n if (!args.iModel.iTwinId) {\r\n Logger.logInfo(loggerCategory, \"Cannot obtain Graphics Data for an iModel with no iTwinId\");\r\n return undefined;\r\n }\r\n\r\n const graphicsArgs = {\r\n accessToken: args.accessToken,\r\n sessionId: IModelApp.sessionId,\r\n dataSource: {\r\n iTwinId: args.iModel.iTwinId,\r\n id: args.iModel.iModelId,\r\n changeId: args.iModel.changeset.id,\r\n type: \"IMODEL\",\r\n },\r\n format: \"IMDL\",\r\n urlPrefix: args.urlPrefix,\r\n requireExactVersion: args.requireExactChangeset,\r\n enableCDN: args.enableCDN,\r\n };\r\n\r\n return obtainGraphicRepresentationUrl(graphicsArgs);\r\n}\r\n"]}
@@ -1,2 +1,4 @@
1
1
  export * from "./FrontendTiles";
2
+ export * from "./GraphicsProvider/GraphicRepresentationProvider";
3
+ export * from "./GraphicsProvider/GraphicsProvider";
2
4
  //# sourceMappingURL=frontend-tiles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"frontend-tiles.d.ts","sourceRoot":"","sources":["../../src/frontend-tiles.ts"],"names":[],"mappings":"AAKA,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"frontend-tiles.d.ts","sourceRoot":"","sources":["../../src/frontend-tiles.ts"],"names":[],"mappings":"AAKA,cAAc,iBAAiB,CAAC;AAChC,cAAc,kDAAkD,CAAC;AACjE,cAAc,qCAAqC,CAAC"}
@@ -19,4 +19,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
19
19
  };
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
21
  __exportStar(require("./FrontendTiles"), exports);
22
+ __exportStar(require("./GraphicsProvider/GraphicRepresentationProvider"), exports);
23
+ __exportStar(require("./GraphicsProvider/GraphicsProvider"), exports);
22
24
  //# sourceMappingURL=frontend-tiles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"frontend-tiles.js","sourceRoot":"","sources":["../../src/frontend-tiles.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;;;;;;;;;;;;;;AAE/F,kDAAgC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nexport * from \"./FrontendTiles\";\r\n"]}
1
+ {"version":3,"file":"frontend-tiles.js","sourceRoot":"","sources":["../../src/frontend-tiles.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;;;;;;;;;;;;;;AAE/F,kDAAgC;AAChC,mFAAiE;AACjE,sEAAoD","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nexport * from \"./FrontendTiles\";\r\nexport * from \"./GraphicsProvider/GraphicRepresentationProvider\";\r\nexport * from \"./GraphicsProvider/GraphicsProvider\";\r\n\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"BatchedSpatialTileTreeRefs.d.ts","sourceRoot":"","sources":["../../src/BatchedSpatialTileTreeRefs.ts"],"names":[],"mappings":"AAOA,OAAO,EAEoE,yBAAyB,EAAE,gBAAgB,EAErH,MAAM,sBAAsB,CAAC;AAI9B,OAAO,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC;AA+O/D,gBAAgB;AAChB,wBAAgB,sCAAsC,CAAC,IAAI,EAAE,gBAAgB,EAAE,cAAc,EAAE,4BAA4B,GAAG,yBAAyB,CA0BtJ"}
1
+ {"version":3,"file":"BatchedSpatialTileTreeRefs.d.ts","sourceRoot":"","sources":["../../src/BatchedSpatialTileTreeRefs.ts"],"names":[],"mappings":"AAOA,OAAO,EAEoE,yBAAyB,EAAE,gBAAgB,EAErH,MAAM,sBAAsB,CAAC;AAI9B,OAAO,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC;AAkS/D,gBAAgB;AAChB,wBAAgB,sCAAsC,CAAC,IAAI,EAAE,gBAAgB,EAAE,cAAc,EAAE,4BAA4B,GAAG,yBAAyB,CA0BtJ"}
@@ -100,6 +100,45 @@ class BatchedSpatialTileTreeReferences {
100
100
  this._removeSceneInvalidationListener = undefined;
101
101
  }
102
102
  }
103
+ // Collects the TileTreeReferences for the models that need to be drawn to create the planar clip mask.
104
+ collectMaskRefs(modelIds, maskTreeRefs) {
105
+ for (const ref of this._refs) {
106
+ // For each ref, check to see whether one of the models that are needed are in its group's list of models.
107
+ const refModelIds = ref.groupModelIds;
108
+ if (refModelIds) {
109
+ for (const modelId of modelIds) {
110
+ if (refModelIds.has(modelId)) {
111
+ maskTreeRefs.push(ref);
112
+ break;
113
+ }
114
+ }
115
+ }
116
+ }
117
+ // Also need to collect refs from other tile trees which are not in the batched tile tree refs.
118
+ this._excludedRefs.collectMaskRefs(modelIds, maskTreeRefs);
119
+ }
120
+ // Returns a list of the models that are NOT in the planar clip mask.
121
+ getModelsNotInMask(maskModels, useVisible) {
122
+ const modelsNotInMask = [];
123
+ const includedModels = this._spec.models.keys();
124
+ if (useVisible) {
125
+ // All viewed models are in the mask, so get a list of all models which are not viewed.
126
+ for (const modelId of includedModels) {
127
+ if (!this._models.views(modelId))
128
+ modelsNotInMask.push(modelId);
129
+ }
130
+ }
131
+ else {
132
+ // Get a list of all model which are NOT in the maskModels list.
133
+ const maskModelSet = new Set(maskModels);
134
+ for (const modelId of includedModels) {
135
+ if (!maskModelSet.has(modelId))
136
+ modelsNotInMask.push(modelId);
137
+ }
138
+ }
139
+ return modelsNotInMask.length > 0 ? modelsNotInMask : undefined;
140
+ }
141
+ // _view.models
103
142
  setDeactivated() {
104
143
  // Used for debugging. Unimplemented here.
105
144
  }
@@ -176,6 +215,15 @@ class ProxySpatialTileTreeReferences {
176
215
  yield this._proxyRef;
177
216
  }
178
217
  }
218
+ collectMaskRefs(modelIds, maskTreeRefs) {
219
+ this._impl?.collectMaskRefs(modelIds, maskTreeRefs);
220
+ }
221
+ getModelsNotInMask(maskModels, useVisible) {
222
+ if (this._impl)
223
+ return this._impl.getModelsNotInMask(maskModels, useVisible);
224
+ else
225
+ return undefined;
226
+ }
179
227
  }
180
228
  const iModelToTilesetSpec = new Map();
181
229
  async function fetchTilesetSpec(iModel, computeBaseUrl) {
@@ -1 +1 @@
1
- {"version":3,"file":"BatchedSpatialTileTreeRefs.js","sourceRoot":"","sources":["../../src/BatchedSpatialTileTreeRefs.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EACL,eAAe,EACO,+BAA+B,EACrD,kBAAkB,EAAiB,iBAAiB,GACrD,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAG,wBAAwB,EAAiC,MAAM,4BAA4B,CAAC;AACtG,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,sDAAsD;AACtD,MAAM,gCAAgC;IAapC,YAAmB,IAA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AC;QACxB,MAAM,OAAO,GAAG,KAAK,GAAG,gBAAgB,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;QACjE,mBAAmB,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QACvC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,mBAAmB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;QAEjE,OAAO,CAAC,IAAI,CAAC,CAAC,IAA+B,EAAE,EAAE;YAC/C,IAAI,mBAAmB,CAAC,GAAG,CAAC,MAAM,CAAC;gBACjC,mBAAmB,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAC1C,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE;YACZ,IAAI,mBAAmB,CAAC,GAAG,CAAC,MAAM,CAAC;gBACjC,mBAAmB,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAC1C,CAAC,CAAC,CAAC;IACL,CAAC;IAED,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC;QACnB,sFAAsF;QACtF,OAAO,+BAA+B,CAAC,IAAI,CAAC,CAAC;IAC/C,CAAC;IAED,IAAI,KAAK,YAAY,OAAO;QAC1B,OAAO,IAAI,8BAA8B,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAEzD,OAAO,IAAI,gCAAgC,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AAC3D,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nimport { Logger } from \"@itwin/core-bentley\";\r\nimport { RenderSchedule } from \"@itwin/core-common\";\r\nimport {\r\n AnimationNodeId,\r\n AttachToViewportArgs, createSpatialTileTreeReferences, IModelConnection, SpatialTileTreeReferences, SpatialViewState,\r\n TileTreeLoadStatus, TileTreeOwner, TileTreeReference,\r\n} from \"@itwin/core-frontend\";\r\nimport { BatchedTileTreeReference, BatchedTileTreeReferenceArgs } from \"./BatchedTileTreeReference\";\r\nimport { getBatchedTileTreeOwner } from \"./BatchedTileTreeSupplier\";\r\nimport { BatchedModels } from \"./BatchedModels\";\r\nimport { ComputeSpatialTilesetBaseUrl } from \"./FrontendTiles\";\r\nimport { BatchedTilesetSpec } from \"./BatchedTilesetReader\";\r\nimport { loggerCategory } from \"./LoggerCategory\";\r\nimport { BatchedModelGroups } from \"./BatchedModelGroups\";\r\n\r\n// Obtains tiles pre-published by mesh export service.\r\nclass BatchedSpatialTileTreeReferences implements SpatialTileTreeReferences {\r\n private readonly _view: SpatialViewState;\r\n private readonly _models: BatchedModels;\r\n private readonly _groups: BatchedModelGroups;\r\n private readonly _spec: BatchedTilesetSpec;\r\n private _treeOwner: TileTreeOwner;\r\n private _refs: BatchedTileTreeReference[] = [];\r\n private _currentScript?: RenderSchedule.Script;\r\n private _onModelSelectorChanged?: () => void;\r\n /** Provides tile trees for models that are not included in the batched tile set. */\r\n private readonly _excludedRefs: SpatialTileTreeReferences;\r\n private _removeSceneInvalidationListener?: () => void;\r\n\r\n public constructor(spec: BatchedTilesetSpec, view: SpatialViewState) {\r\n this._view = view;\r\n this._models = new BatchedModels(view, spec.models);\r\n this._spec = spec;\r\n\r\n const script = view.displayStyle.scheduleScript;\r\n this._currentScript = script?.requiresBatching ? script : undefined;\r\n\r\n const includedModels = new Set(spec.models.keys());\r\n this._excludedRefs = createSpatialTileTreeReferences(view, includedModels);\r\n\r\n this._groups = new BatchedModelGroups(view, this._currentScript, includedModels, spec.models);\r\n this._treeOwner = this.getTreeOwner();\r\n this.loadRefs();\r\n\r\n this.listenForScriptChange();\r\n }\r\n\r\n private ensureLoaded(): void {\r\n if (!this._groups.update())\r\n return;\r\n\r\n this._treeOwner = this.getTreeOwner();\r\n this.loadRefs();\r\n }\r\n\r\n private getTreeOwner(): TileTreeOwner {\r\n return getBatchedTileTreeOwner(this._view.iModel, {\r\n spec: this._spec,\r\n script: this._currentScript,\r\n modelGroups: this._groups.guid,\r\n });\r\n }\r\n\r\n private listenForScriptChange(): void {\r\n const onScriptChanged = (newScript: RenderSchedule.Script | undefined) => {\r\n if (!newScript?.requiresBatching)\r\n newScript = undefined;\r\n\r\n const currentScript = this._currentScript;\r\n this._currentScript = newScript;\r\n\r\n if (newScript !== currentScript)\r\n if (!newScript || !currentScript || !newScript.equals(currentScript))\r\n this._groups.setScript(newScript);\r\n };\r\n\r\n let rmListener = this._view.displayStyle.onScheduleScriptChanged.addListener((newScript) => onScriptChanged(newScript));\r\n this._view.onDisplayStyleChanged.addListener((newStyle) => {\r\n rmListener();\r\n onScriptChanged(newStyle.scheduleScript);\r\n rmListener = this._view.displayStyle.onScheduleScriptChanged.addListener((newScript) => onScriptChanged(newScript));\r\n });\r\n }\r\n\r\n private loadRefs(): void {\r\n this._refs.length = 0;\r\n const groups = this._groups.groups;\r\n const args: BatchedTileTreeReferenceArgs = {\r\n models: this._models,\r\n groups,\r\n treeOwner: this._treeOwner,\r\n getCurrentTimePoint: () => this._currentScript ? (this._view.displayStyle.settings.timePoint ?? this._currentScript.duration.low) : 0,\r\n };\r\n\r\n for (let i = 0; i < groups.length; i++) {\r\n const timeline = groups[i].timeline;\r\n this._refs.push(new BatchedTileTreeReference(args, i, timeline ? AnimationNodeId.Untransformed : undefined));\r\n if (timeline) {\r\n for (const nodeId of timeline.transformBatchIds)\r\n this._refs.push(new BatchedTileTreeReference(args, i, nodeId));\r\n }\r\n }\r\n }\r\n\r\n public *[Symbol.iterator](): Iterator<TileTreeReference> {\r\n this.ensureLoaded();\r\n for (const ref of this._refs)\r\n yield ref;\r\n\r\n for (const ref of this._excludedRefs)\r\n yield ref;\r\n }\r\n\r\n public update(): void {\r\n this._excludedRefs.update();\r\n this._models.setViewedModels(this._view.modelSelector.models);\r\n if (this._onModelSelectorChanged)\r\n this._onModelSelectorChanged();\r\n }\r\n\r\n public attachToViewport(args: AttachToViewportArgs): void {\r\n this._onModelSelectorChanged = () => args.invalidateSymbologyOverrides();\r\n this._excludedRefs.attachToViewport(args);\r\n this._removeSceneInvalidationListener = args.onSceneInvalidated.addListener(() => this._groups.invalidateTransforms());\r\n }\r\n\r\n public detachFromViewport(): void {\r\n this._onModelSelectorChanged = undefined;\r\n this._excludedRefs.detachFromViewport();\r\n\r\n if (this._removeSceneInvalidationListener) {\r\n this._removeSceneInvalidationListener();\r\n this._removeSceneInvalidationListener = undefined;\r\n }\r\n }\r\n\r\n public setDeactivated(): void {\r\n // Used for debugging. Unimplemented here.\r\n }\r\n}\r\n\r\n// A placeholder used by [[ProxySpatialTileTreeReferences]] until asynchronous loading completes.\r\n// It provides a TileTreeOwner that never loads a tile tree.\r\n// This ensures that [ViewState.areAllTileTreesLoaded]($frontend) will not return `true` while we are loading.\r\nclass ProxyTileTreeReference extends TileTreeReference {\r\n private readonly _treeOwner: TileTreeOwner;\r\n\r\n public constructor(iModel: IModelConnection) {\r\n super();\r\n this._treeOwner = {\r\n iModel,\r\n tileTree: undefined,\r\n loadStatus: TileTreeLoadStatus.NotLoaded,\r\n load: () => undefined,\r\n dispose: () => { },\r\n loadTree: async () => Promise.resolve(undefined),\r\n };\r\n }\r\n\r\n public override get treeOwner() {\r\n return this._treeOwner;\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public override get _isLoadingComplete() {\r\n return false;\r\n }\r\n}\r\n\r\n// Serves as a placeholder while we asynchronously obtain the base URL for a pre-published tileset (or asynchronously determine\r\n// that no such tileset exists).\r\nclass ProxySpatialTileTreeReferences implements SpatialTileTreeReferences {\r\n // Once async loading completes, all methods will be forwarded to this implementation.\r\n private _impl?: SpatialTileTreeReferences;\r\n private readonly _proxyRef: ProxyTileTreeReference;\r\n // Retained if attachToViewport is called while we are still loading; and reset if detachFromViewport is called while loading.\r\n private _attachArgs?: AttachToViewportArgs;\r\n\r\n public constructor(view: SpatialViewState, getSpec: Promise<BatchedTilesetSpec | null>) {\r\n this._proxyRef = new ProxyTileTreeReference(view.iModel);\r\n getSpec.then((spec: BatchedTilesetSpec | null) => {\r\n if (spec) {\r\n this.setTreeRefs(new BatchedSpatialTileTreeReferences(spec, view));\r\n } else {\r\n this.setTreeRefs(createSpatialTileTreeReferences(view));\r\n }\r\n }).catch(() => {\r\n this.setTreeRefs(createSpatialTileTreeReferences(view));\r\n });\r\n }\r\n\r\n private setTreeRefs(refs: SpatialTileTreeReferences): void {\r\n this._impl = refs;\r\n if (this._attachArgs) {\r\n this._impl.attachToViewport(this._attachArgs);\r\n this._attachArgs.invalidateSymbologyOverrides();\r\n this._attachArgs = undefined;\r\n }\r\n }\r\n\r\n public update(): void {\r\n this._impl?.update();\r\n }\r\n\r\n public attachToViewport(args: AttachToViewportArgs): void {\r\n if (this._impl)\r\n this._impl.attachToViewport(args);\r\n else\r\n this._attachArgs = args;\r\n }\r\n\r\n public detachFromViewport(): void {\r\n if (this._impl)\r\n this._impl.detachFromViewport();\r\n else\r\n this._attachArgs = undefined;\r\n }\r\n\r\n public setDeactivated(): void { }\r\n\r\n public *[Symbol.iterator](): Iterator<TileTreeReference> {\r\n if (this._impl) {\r\n for (const ref of this._impl)\r\n yield ref;\r\n } else {\r\n yield this._proxyRef;\r\n }\r\n }\r\n}\r\n\r\nconst iModelToTilesetSpec = new Map<IModelConnection, BatchedTilesetSpec | null | Promise<BatchedTilesetSpec | null>>();\r\n\r\nasync function fetchTilesetSpec(iModel: IModelConnection, computeBaseUrl: ComputeSpatialTilesetBaseUrl): Promise<BatchedTilesetSpec | null> {\r\n try {\r\n const baseUrl = await computeBaseUrl(iModel);\r\n if (undefined === baseUrl)\r\n return null;\r\n\r\n const url = new URL(\"tileset.json\", baseUrl);\r\n url.search = baseUrl.search;\r\n const response = await fetch(url.toString());\r\n const json = await response.json();\r\n return BatchedTilesetSpec.create(baseUrl, json);\r\n } catch (err) {\r\n Logger.logException(loggerCategory, err);\r\n return null;\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport function createBatchedSpatialTileTreeReferences(view: SpatialViewState, computeBaseUrl: ComputeSpatialTilesetBaseUrl): SpatialTileTreeReferences {\r\n const iModel = view.iModel;\r\n let entry = iModelToTilesetSpec.get(iModel);\r\n if (undefined === entry) {\r\n const promise = entry = fetchTilesetSpec(iModel, computeBaseUrl);\r\n iModelToTilesetSpec.set(iModel, entry);\r\n iModel.onClose.addOnce(() => iModelToTilesetSpec.delete(iModel));\r\n\r\n promise.then((spec: BatchedTilesetSpec | null) => {\r\n if (iModelToTilesetSpec.has(iModel))\r\n iModelToTilesetSpec.set(iModel, spec);\r\n }).catch(() => {\r\n if (iModelToTilesetSpec.has(iModel))\r\n iModelToTilesetSpec.set(iModel, null);\r\n });\r\n }\r\n\r\n if (null === entry) {\r\n // No tileset could be obtained for this iModel - use default tile generation instead.\r\n return createSpatialTileTreeReferences(view);\r\n }\r\n\r\n if (entry instanceof Promise)\r\n return new ProxySpatialTileTreeReferences(view, entry);\r\n\r\n return new BatchedSpatialTileTreeReferences(entry, view);\r\n}\r\n\r\n"]}
1
+ {"version":3,"file":"BatchedSpatialTileTreeRefs.js","sourceRoot":"","sources":["../../src/BatchedSpatialTileTreeRefs.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAc,MAAM,EAAuB,MAAM,qBAAqB,CAAC;AAE9E,OAAO,EACL,eAAe,EACO,+BAA+B,EACrD,kBAAkB,EAAiB,iBAAiB,GACrD,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAG,wBAAwB,EAAiC,MAAM,4BAA4B,CAAC;AACtG,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAA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AO;QAC1B,OAAO,IAAI,8BAA8B,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAEzD,OAAO,IAAI,gCAAgC,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AAC3D,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nimport { Id64String, Logger, OrderedId64Iterable } from \"@itwin/core-bentley\";\r\nimport { RenderSchedule } from \"@itwin/core-common\";\r\nimport {\r\n AnimationNodeId,\r\n AttachToViewportArgs, createSpatialTileTreeReferences, IModelConnection, SpatialTileTreeReferences, SpatialViewState,\r\n TileTreeLoadStatus, TileTreeOwner, TileTreeReference,\r\n} from \"@itwin/core-frontend\";\r\nimport { BatchedTileTreeReference, BatchedTileTreeReferenceArgs } from \"./BatchedTileTreeReference\";\r\nimport { getBatchedTileTreeOwner } from \"./BatchedTileTreeSupplier\";\r\nimport { BatchedModels } from \"./BatchedModels\";\r\nimport { ComputeSpatialTilesetBaseUrl } from \"./FrontendTiles\";\r\nimport { BatchedTilesetSpec } from \"./BatchedTilesetReader\";\r\nimport { loggerCategory } from \"./LoggerCategory\";\r\nimport { BatchedModelGroups } from \"./BatchedModelGroups\";\r\n\r\n// Obtains tiles pre-published by mesh export service.\r\nclass BatchedSpatialTileTreeReferences implements SpatialTileTreeReferences {\r\n private readonly _view: SpatialViewState;\r\n private readonly _models: BatchedModels;\r\n private readonly _groups: BatchedModelGroups;\r\n private readonly _spec: BatchedTilesetSpec;\r\n private _treeOwner: TileTreeOwner;\r\n private _refs: BatchedTileTreeReference[] = [];\r\n private _currentScript?: RenderSchedule.Script;\r\n private _onModelSelectorChanged?: () => void;\r\n /** Provides tile trees for models that are not included in the batched tile set. */\r\n private readonly _excludedRefs: SpatialTileTreeReferences;\r\n private _removeSceneInvalidationListener?: () => void;\r\n\r\n public constructor(spec: BatchedTilesetSpec, view: SpatialViewState) {\r\n this._view = view;\r\n this._models = new BatchedModels(view, spec.models);\r\n this._spec = spec;\r\n\r\n const script = view.displayStyle.scheduleScript;\r\n this._currentScript = script?.requiresBatching ? script : undefined;\r\n\r\n const includedModels = new Set(spec.models.keys());\r\n this._excludedRefs = createSpatialTileTreeReferences(view, includedModels);\r\n\r\n this._groups = new BatchedModelGroups(view, this._currentScript, includedModels, spec.models);\r\n this._treeOwner = this.getTreeOwner();\r\n this.loadRefs();\r\n\r\n this.listenForScriptChange();\r\n }\r\n\r\n private ensureLoaded(): void {\r\n if (!this._groups.update())\r\n return;\r\n\r\n this._treeOwner = this.getTreeOwner();\r\n this.loadRefs();\r\n }\r\n\r\n private getTreeOwner(): TileTreeOwner {\r\n return getBatchedTileTreeOwner(this._view.iModel, {\r\n spec: this._spec,\r\n script: this._currentScript,\r\n modelGroups: this._groups.guid,\r\n });\r\n }\r\n\r\n private listenForScriptChange(): void {\r\n const onScriptChanged = (newScript: RenderSchedule.Script | undefined) => {\r\n if (!newScript?.requiresBatching)\r\n newScript = undefined;\r\n\r\n const currentScript = this._currentScript;\r\n this._currentScript = newScript;\r\n\r\n if (newScript !== currentScript)\r\n if (!newScript || !currentScript || !newScript.equals(currentScript))\r\n this._groups.setScript(newScript);\r\n };\r\n\r\n let rmListener = this._view.displayStyle.onScheduleScriptChanged.addListener((newScript) => onScriptChanged(newScript));\r\n this._view.onDisplayStyleChanged.addListener((newStyle) => {\r\n rmListener();\r\n onScriptChanged(newStyle.scheduleScript);\r\n rmListener = this._view.displayStyle.onScheduleScriptChanged.addListener((newScript) => onScriptChanged(newScript));\r\n });\r\n }\r\n\r\n private loadRefs(): void {\r\n this._refs.length = 0;\r\n const groups = this._groups.groups;\r\n const args: BatchedTileTreeReferenceArgs = {\r\n models: this._models,\r\n groups,\r\n treeOwner: this._treeOwner,\r\n getCurrentTimePoint: () => this._currentScript ? (this._view.displayStyle.settings.timePoint ?? this._currentScript.duration.low) : 0,\r\n };\r\n\r\n for (let i = 0; i < groups.length; i++) {\r\n const timeline = groups[i].timeline;\r\n this._refs.push(new BatchedTileTreeReference(args, i, timeline ? AnimationNodeId.Untransformed : undefined));\r\n if (timeline) {\r\n for (const nodeId of timeline.transformBatchIds)\r\n this._refs.push(new BatchedTileTreeReference(args, i, nodeId));\r\n }\r\n }\r\n }\r\n\r\n public *[Symbol.iterator](): Iterator<TileTreeReference> {\r\n this.ensureLoaded();\r\n for (const ref of this._refs)\r\n yield ref;\r\n\r\n for (const ref of this._excludedRefs)\r\n yield ref;\r\n }\r\n\r\n public update(): void {\r\n this._excludedRefs.update();\r\n this._models.setViewedModels(this._view.modelSelector.models);\r\n if (this._onModelSelectorChanged)\r\n this._onModelSelectorChanged();\r\n }\r\n\r\n public attachToViewport(args: AttachToViewportArgs): void {\r\n this._onModelSelectorChanged = () => args.invalidateSymbologyOverrides();\r\n this._excludedRefs.attachToViewport(args);\r\n this._removeSceneInvalidationListener = args.onSceneInvalidated.addListener(() => this._groups.invalidateTransforms());\r\n }\r\n\r\n public detachFromViewport(): void {\r\n this._onModelSelectorChanged = undefined;\r\n this._excludedRefs.detachFromViewport();\r\n\r\n if (this._removeSceneInvalidationListener) {\r\n this._removeSceneInvalidationListener();\r\n this._removeSceneInvalidationListener = undefined;\r\n }\r\n }\r\n\r\n // Collects the TileTreeReferences for the models that need to be drawn to create the planar clip mask.\r\n public collectMaskRefs(modelIds: OrderedId64Iterable, maskTreeRefs: TileTreeReference[]): void {\r\n for (const ref of this._refs) {\r\n // For each ref, check to see whether one of the models that are needed are in its group's list of models.\r\n const refModelIds = ref.groupModelIds;\r\n if (refModelIds) {\r\n for (const modelId of modelIds) {\r\n if (refModelIds.has(modelId)) {\r\n maskTreeRefs.push(ref);\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n // Also need to collect refs from other tile trees which are not in the batched tile tree refs.\r\n this._excludedRefs.collectMaskRefs(modelIds, maskTreeRefs);\r\n }\r\n\r\n // Returns a list of the models that are NOT in the planar clip mask.\r\n public getModelsNotInMask(maskModels: OrderedId64Iterable | undefined, useVisible: boolean): Id64String[] | undefined {\r\n const modelsNotInMask: Id64String[] = [];\r\n const includedModels = this._spec.models.keys();\r\n if (useVisible) {\r\n // All viewed models are in the mask, so get a list of all models which are not viewed.\r\n for (const modelId of includedModels) {\r\n if (!this._models.views(modelId))\r\n modelsNotInMask.push(modelId);\r\n }\r\n } else {\r\n // Get a list of all model which are NOT in the maskModels list.\r\n const maskModelSet = new Set(maskModels);\r\n for (const modelId of includedModels) {\r\n if (!maskModelSet.has(modelId))\r\n modelsNotInMask.push(modelId);\r\n }\r\n }\r\n return modelsNotInMask.length > 0 ? modelsNotInMask : undefined;\r\n }\r\n\r\n // _view.models\r\n public setDeactivated(): void {\r\n // Used for debugging. Unimplemented here.\r\n }\r\n}\r\n\r\n// A placeholder used by [[ProxySpatialTileTreeReferences]] until asynchronous loading completes.\r\n// It provides a TileTreeOwner that never loads a tile tree.\r\n// This ensures that [ViewState.areAllTileTreesLoaded]($frontend) will not return `true` while we are loading.\r\nclass ProxyTileTreeReference extends TileTreeReference {\r\n private readonly _treeOwner: TileTreeOwner;\r\n\r\n public constructor(iModel: IModelConnection) {\r\n super();\r\n this._treeOwner = {\r\n iModel,\r\n tileTree: undefined,\r\n loadStatus: TileTreeLoadStatus.NotLoaded,\r\n load: () => undefined,\r\n dispose: () => { },\r\n loadTree: async () => Promise.resolve(undefined),\r\n };\r\n }\r\n\r\n public override get treeOwner() {\r\n return this._treeOwner;\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public override get _isLoadingComplete() {\r\n return false;\r\n }\r\n}\r\n\r\n// Serves as a placeholder while we asynchronously obtain the base URL for a pre-published tileset (or asynchronously determine\r\n// that no such tileset exists).\r\nclass ProxySpatialTileTreeReferences implements SpatialTileTreeReferences {\r\n // Once async loading completes, all methods will be forwarded to this implementation.\r\n private _impl?: SpatialTileTreeReferences;\r\n private readonly _proxyRef: ProxyTileTreeReference;\r\n // Retained if attachToViewport is called while we are still loading; and reset if detachFromViewport is called while loading.\r\n private _attachArgs?: AttachToViewportArgs;\r\n\r\n public constructor(view: SpatialViewState, getSpec: Promise<BatchedTilesetSpec | null>) {\r\n this._proxyRef = new ProxyTileTreeReference(view.iModel);\r\n getSpec.then((spec: BatchedTilesetSpec | null) => {\r\n if (spec) {\r\n this.setTreeRefs(new BatchedSpatialTileTreeReferences(spec, view));\r\n } else {\r\n this.setTreeRefs(createSpatialTileTreeReferences(view));\r\n }\r\n }).catch(() => {\r\n this.setTreeRefs(createSpatialTileTreeReferences(view));\r\n });\r\n }\r\n\r\n private setTreeRefs(refs: SpatialTileTreeReferences): void {\r\n this._impl = refs;\r\n if (this._attachArgs) {\r\n this._impl.attachToViewport(this._attachArgs);\r\n this._attachArgs.invalidateSymbologyOverrides();\r\n this._attachArgs = undefined;\r\n }\r\n }\r\n\r\n public update(): void {\r\n this._impl?.update();\r\n }\r\n\r\n public attachToViewport(args: AttachToViewportArgs): void {\r\n if (this._impl)\r\n this._impl.attachToViewport(args);\r\n else\r\n this._attachArgs = args;\r\n }\r\n\r\n public detachFromViewport(): void {\r\n if (this._impl)\r\n this._impl.detachFromViewport();\r\n else\r\n this._attachArgs = undefined;\r\n }\r\n\r\n public setDeactivated(): void { }\r\n\r\n public *[Symbol.iterator](): Iterator<TileTreeReference> {\r\n if (this._impl) {\r\n for (const ref of this._impl)\r\n yield ref;\r\n } else {\r\n yield this._proxyRef;\r\n }\r\n }\r\n\r\n public collectMaskRefs(modelIds: OrderedId64Iterable, maskTreeRefs: TileTreeReference[]): void {\r\n this._impl?.collectMaskRefs(modelIds, maskTreeRefs);\r\n }\r\n\r\n public getModelsNotInMask(maskModels: OrderedId64Iterable | undefined, useVisible: boolean): Id64String[] | undefined {\r\n if (this._impl)\r\n return this._impl.getModelsNotInMask(maskModels, useVisible);\r\n else\r\n return undefined;\r\n }\r\n}\r\n\r\nconst iModelToTilesetSpec = new Map<IModelConnection, BatchedTilesetSpec | null | Promise<BatchedTilesetSpec | null>>();\r\n\r\nasync function fetchTilesetSpec(iModel: IModelConnection, computeBaseUrl: ComputeSpatialTilesetBaseUrl): Promise<BatchedTilesetSpec | null> {\r\n try {\r\n const baseUrl = await computeBaseUrl(iModel);\r\n if (undefined === baseUrl)\r\n return null;\r\n\r\n const url = new URL(\"tileset.json\", baseUrl);\r\n url.search = baseUrl.search;\r\n const response = await fetch(url.toString());\r\n const json = await response.json();\r\n return BatchedTilesetSpec.create(baseUrl, json);\r\n } catch (err) {\r\n Logger.logException(loggerCategory, err);\r\n return null;\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport function createBatchedSpatialTileTreeReferences(view: SpatialViewState, computeBaseUrl: ComputeSpatialTilesetBaseUrl): SpatialTileTreeReferences {\r\n const iModel = view.iModel;\r\n let entry = iModelToTilesetSpec.get(iModel);\r\n if (undefined === entry) {\r\n const promise = entry = fetchTilesetSpec(iModel, computeBaseUrl);\r\n iModelToTilesetSpec.set(iModel, entry);\r\n iModel.onClose.addOnce(() => iModelToTilesetSpec.delete(iModel));\r\n\r\n promise.then((spec: BatchedTilesetSpec | null) => {\r\n if (iModelToTilesetSpec.has(iModel))\r\n iModelToTilesetSpec.set(iModel, spec);\r\n }).catch(() => {\r\n if (iModelToTilesetSpec.has(iModel))\r\n iModelToTilesetSpec.set(iModel, null);\r\n });\r\n }\r\n\r\n if (null === entry) {\r\n // No tileset could be obtained for this iModel - use default tile generation instead.\r\n return createSpatialTileTreeReferences(view);\r\n }\r\n\r\n if (entry instanceof Promise)\r\n return new ProxySpatialTileTreeReferences(view, entry);\r\n\r\n return new BatchedSpatialTileTreeReferences(entry, view);\r\n}\r\n\r\n"]}
@@ -1,3 +1,4 @@
1
+ import { Id64Set } from "@itwin/core-bentley";
1
2
  import { Range3d, Transform } from "@itwin/core-geometry";
2
3
  import { BatchType, FeatureAppearance, FeatureAppearanceProvider, FeatureAppearanceSource, GeometryClass, ViewFlagOverrides } from "@itwin/core-common";
3
4
  import { RenderClipVolume, SceneContext, TileDrawArgs, TileTree, TileTreeOwner, TileTreeReference } from "@itwin/core-frontend";
@@ -15,6 +16,7 @@ export declare class BatchedTileTreeReference extends TileTreeReference implemen
15
16
  private readonly _animationNodeId?;
16
17
  private readonly _branchId?;
17
18
  constructor(args: BatchedTileTreeReferenceArgs, groupIndex: number, animationNodeId: number | undefined);
19
+ get groupModelIds(): Id64Set | undefined;
18
20
  private get _groupInfo();
19
21
  get treeOwner(): TileTreeOwner;
20
22
  getAppearanceProvider(): FeatureAppearanceProvider;
@@ -1 +1 @@
1
- {"version":3,"file":"BatchedTileTreeReference.d.ts","sourceRoot":"","sources":["../../src/BatchedTileTreeReference.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EACL,SAAS,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,aAAa,EAAE,iBAAiB,EACnH,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACoB,gBAAgB,EAAE,YAAY,EAAE,YAAY,EAAmB,QAAQ,EAAE,aAAa,EAAE,iBAAiB,EACnI,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC,cAAc,CAAC,CAAC;IAC/C,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAC;IAClC,QAAQ,CAAC,mBAAmB,EAAE,MAAM,MAAM,CAAC;CAC5C;AAED,qBAAa,wBAAyB,SAAQ,iBAAkB,YAAW,yBAAyB;IAClG,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA+B;IACrD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAA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AE,MAAM,EAChC,IAAI,EAAE,SAAS,EACf,eAAe,EAAE,MAAM,GACtB,iBAAiB,GAAG,SAAS;IAOhB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAInD,IAAoB,YAAY,IAAI,OAAO,CAK1C;IAEe,oBAAoB,IAAI,iBAAiB;IAIzC,IAAI,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI;cAO3B,gBAAgB,CAAC,IAAI,EAAE,QAAQ,GAAG,SAAS;cAuB3C,2BAA2B;cAI3B,cAAc;IAIjB,cAAc,CAAC,OAAO,EAAE,YAAY,GAAG,YAAY,GAAG,SAAS;CAgBhF"}
@@ -15,6 +15,9 @@ export class BatchedTileTreeReference extends TileTreeReference {
15
15
  this._branchId = formatAnimationBranchId(this._groupInfo.timeline.modelId, animationNodeId);
16
16
  }
17
17
  }
18
+ get groupModelIds() {
19
+ return this._groupInfo.modelIds;
20
+ }
18
21
  get _groupInfo() {
19
22
  assert(this._groupIndex < this._args.groups.length);
20
23
  return this._args.groups[this._groupIndex];