@itwin/core-common 4.10.0-dev.3 → 4.10.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.
- package/lib/cjs/ContextRealityModel.d.ts +19 -0
- package/lib/cjs/ContextRealityModel.d.ts.map +1 -1
- package/lib/cjs/ContextRealityModel.js +31 -0
- package/lib/cjs/ContextRealityModel.js.map +1 -1
- package/lib/esm/ContextRealityModel.d.ts +19 -0
- package/lib/esm/ContextRealityModel.d.ts.map +1 -1
- package/lib/esm/ContextRealityModel.js +31 -0
- package/lib/esm/ContextRealityModel.js.map +1 -1
- package/package.json +6 -6
|
@@ -137,6 +137,10 @@ export interface ContextRealityModelProps {
|
|
|
137
137
|
* @beta
|
|
138
138
|
*/
|
|
139
139
|
displaySettings?: RealityModelDisplayProps;
|
|
140
|
+
/** See [[ContextRealityModel.invisible]].
|
|
141
|
+
* @beta
|
|
142
|
+
*/
|
|
143
|
+
invisible?: boolean;
|
|
140
144
|
}
|
|
141
145
|
/** @public */
|
|
142
146
|
export declare namespace ContextRealityModelProps {
|
|
@@ -166,6 +170,7 @@ export declare class ContextRealityModel {
|
|
|
166
170
|
readonly description: string;
|
|
167
171
|
/** An optional identifier that, if present, can be used to elide a request to the reality data service. */
|
|
168
172
|
readonly realityDataId?: string;
|
|
173
|
+
private _invisible;
|
|
169
174
|
private readonly _classifiers;
|
|
170
175
|
/** @alpha */
|
|
171
176
|
readonly orbitGtBlob?: Readonly<OrbitGtBlobProps>;
|
|
@@ -181,6 +186,10 @@ export declare class ContextRealityModel {
|
|
|
181
186
|
* @beta
|
|
182
187
|
*/
|
|
183
188
|
readonly onDisplaySettingsChanged: BeEvent<(newSettings: RealityModelDisplaySettings, model: ContextRealityModel) => void>;
|
|
189
|
+
/** Event dispatched just before a model become invisible
|
|
190
|
+
* @beta
|
|
191
|
+
*/
|
|
192
|
+
readonly onInvisibleChanged: BeEvent<(invisible: boolean, model: ContextRealityModel) => void>;
|
|
184
193
|
/** Construct a new context reality model.
|
|
185
194
|
* @param props JSON representation of the reality model, which will be kept in sync with changes made via the ContextRealityModel's methods.
|
|
186
195
|
* @param options Options to customize how the reality model is created.
|
|
@@ -201,6 +210,11 @@ export declare class ContextRealityModel {
|
|
|
201
210
|
*/
|
|
202
211
|
get displaySettings(): RealityModelDisplaySettings;
|
|
203
212
|
set displaySettings(settings: RealityModelDisplaySettings);
|
|
213
|
+
/** If true, reality model is not drawn.
|
|
214
|
+
* @beta
|
|
215
|
+
*/
|
|
216
|
+
get invisible(): boolean;
|
|
217
|
+
set invisible(invisible: boolean);
|
|
204
218
|
/** Convert this model to its JSON representation. */
|
|
205
219
|
toJSON(): ContextRealityModelProps;
|
|
206
220
|
/** Returns true if [[name]] and [[url]] match the specified name and url. */
|
|
@@ -249,6 +263,10 @@ export declare class ContextRealityModels {
|
|
|
249
263
|
* @beta
|
|
250
264
|
*/
|
|
251
265
|
readonly onDisplaySettingsChanged: BeEvent<(model: ContextRealityModel, newSettings: RealityModelDisplaySettings) => void>;
|
|
266
|
+
/** Event dispatched just before [[ContextRealityModel.invisible]] is modified for one of the reality models.
|
|
267
|
+
* @beta
|
|
268
|
+
*/
|
|
269
|
+
readonly onInvisibleChanged: BeEvent<(model: ContextRealityModel, invisible: boolean) => void>;
|
|
252
270
|
/** Event dispatched when a model is [[add]]ed, [[delete]]d, [[replace]]d, or [[update]]d. */
|
|
253
271
|
readonly onChanged: BeEvent<(previousModel: ContextRealityModel | undefined, newModel: ContextRealityModel | undefined) => void>;
|
|
254
272
|
/** Construct a new list of reality models from its JSON representation. The list will be initialized from `container.contextRealityModels` and that JSON representation
|
|
@@ -304,5 +322,6 @@ export declare class ContextRealityModels {
|
|
|
304
322
|
private handlePlanarClipMaskChanged;
|
|
305
323
|
private handleAppearanceOverridesChanged;
|
|
306
324
|
private handleDisplaySettingsChanged;
|
|
325
|
+
private handleInvisibleChanged;
|
|
307
326
|
}
|
|
308
327
|
//# sourceMappingURL=ContextRealityModel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BAAmB,GAAG,SAAS,KAAK,IAAI,EAAI;IAE/I;;;;;OAKG;gBACgB,SAAS,EAAE,6BAA6B,EAAE,yBAAyB,CAAC,EAAE,CAAC,KAAK,EAAE,wBAAwB,KAAK,mBAAmB;IAEjJ;;;;OAIG;gBACgB,IAAI,EAAE,wBAAwB;IAqBjD,4GAA4G;IAC5G;;;OAGG;IACI,QAAQ,IAAI,IAAI;IAQvB,4CAA4C;IAC5C,IAAW,MAAM,IAAI,aAAa,CAAC,mBAAmB,CAAC,CAEtD;IAED;;;OAGG;IACI,GAAG,CAAC,KAAK,EAAE,wBAAwB,GAAG,mBAAmB;IAehE;;;OAGG;IACI,MAAM,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO;IAoBlD,+CAA+C;IACxC,KAAK,IAAI,IAAI;IAUpB;;;;;;OAMG;IACI,OAAO,CAAC,SAAS,EAAE,mBAAmB,EAAE,WAAW,EAAE,wBAAwB,GAAG,mBAAmB;IAoB1G;;;;;OAKG;IACI,MAAM,CAAC,QAAQ,EAAE,mBAAmB,EAAE,WAAW,EAAE,OAAO,CAAC,wBAAwB,CAAC,GAAG,mBAAmB;IAajH,OAAO,CAAC,WAAW;IAanB,OAAO,CAAC,kBAAkB;IAW1B,OAAO,CAAC,2BAA2B;IAInC,OAAO,CAAC,gCAAgC;IAIxC,OAAO,CAAC,4BAA4B;IAIpC,OAAO,CAAC,sBAAsB;CAG/B"}
|
|
@@ -128,6 +128,8 @@ var ContextRealityModelProps;
|
|
|
128
128
|
output.planarClipMask = { ...input.planarClipMask };
|
|
129
129
|
if (input.classifiers)
|
|
130
130
|
output.classifiers = input.classifiers.map((x) => { return { ...x, flags: { ...x.flags } }; });
|
|
131
|
+
if (input.invisible)
|
|
132
|
+
output.invisible = input.invisible;
|
|
131
133
|
return output;
|
|
132
134
|
}
|
|
133
135
|
ContextRealityModelProps.clone = clone;
|
|
@@ -152,6 +154,10 @@ class ContextRealityModel {
|
|
|
152
154
|
* @beta
|
|
153
155
|
*/
|
|
154
156
|
this.onDisplaySettingsChanged = new core_bentley_1.BeEvent();
|
|
157
|
+
/** Event dispatched just before a model become invisible
|
|
158
|
+
* @beta
|
|
159
|
+
*/
|
|
160
|
+
this.onInvisibleChanged = new core_bentley_1.BeEvent();
|
|
155
161
|
this._props = props;
|
|
156
162
|
this.rdSourceKey = props.rdSourceKey;
|
|
157
163
|
this.name = props.name ?? "";
|
|
@@ -159,6 +165,7 @@ class ContextRealityModel {
|
|
|
159
165
|
this.orbitGtBlob = props.orbitGtBlob;
|
|
160
166
|
this.realityDataId = props.realityDataId;
|
|
161
167
|
this.description = props.description ?? "";
|
|
168
|
+
this._invisible = props.invisible ?? false;
|
|
162
169
|
this._appearanceOverrides = props.appearanceOverrides ? FeatureSymbology_1.FeatureAppearance.fromJSON(props.appearanceOverrides) : undefined;
|
|
163
170
|
this._displaySettings = RealityModelDisplaySettings_1.RealityModelDisplaySettings.fromJSON(props.displaySettings);
|
|
164
171
|
if (props.planarClipMask && props.planarClipMask.mode !== PlanarClipMask_1.PlanarClipMaskMode.None)
|
|
@@ -209,6 +216,19 @@ class ContextRealityModel {
|
|
|
209
216
|
this._props.displaySettings = settings.toJSON();
|
|
210
217
|
this._displaySettings = settings;
|
|
211
218
|
}
|
|
219
|
+
/** If true, reality model is not drawn.
|
|
220
|
+
* @beta
|
|
221
|
+
*/
|
|
222
|
+
get invisible() {
|
|
223
|
+
return this._invisible;
|
|
224
|
+
}
|
|
225
|
+
set invisible(invisible) {
|
|
226
|
+
if (invisible !== this.invisible) {
|
|
227
|
+
this.onInvisibleChanged.raiseEvent(invisible, this);
|
|
228
|
+
}
|
|
229
|
+
this._props.invisible = invisible;
|
|
230
|
+
this._invisible = invisible;
|
|
231
|
+
}
|
|
212
232
|
/** Convert this model to its JSON representation. */
|
|
213
233
|
toJSON() {
|
|
214
234
|
return ContextRealityModelProps.clone(this._props);
|
|
@@ -237,6 +257,10 @@ class ContextRealityModels {
|
|
|
237
257
|
* @beta
|
|
238
258
|
*/
|
|
239
259
|
this.onDisplaySettingsChanged = new core_bentley_1.BeEvent();
|
|
260
|
+
/** Event dispatched just before [[ContextRealityModel.invisible]] is modified for one of the reality models.
|
|
261
|
+
* @beta
|
|
262
|
+
*/
|
|
263
|
+
this.onInvisibleChanged = new core_bentley_1.BeEvent();
|
|
240
264
|
/** Event dispatched when a model is [[add]]ed, [[delete]]d, [[replace]]d, or [[update]]d. */
|
|
241
265
|
this.onChanged = new core_bentley_1.BeEvent();
|
|
242
266
|
let container;
|
|
@@ -357,6 +381,8 @@ class ContextRealityModels {
|
|
|
357
381
|
model.onAppearanceOverridesChanged.addListener(this.handleAppearanceOverridesChanged, this);
|
|
358
382
|
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
359
383
|
model.onDisplaySettingsChanged.addListener(this.handleDisplaySettingsChanged, this);
|
|
384
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
385
|
+
model.onInvisibleChanged.addListener(this.handleInvisibleChanged, this);
|
|
360
386
|
return model;
|
|
361
387
|
}
|
|
362
388
|
dropEventListeners(model) {
|
|
@@ -366,6 +392,8 @@ class ContextRealityModels {
|
|
|
366
392
|
model.onAppearanceOverridesChanged.removeListener(this.handleAppearanceOverridesChanged, this);
|
|
367
393
|
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
368
394
|
model.onDisplaySettingsChanged.removeListener(this.handleDisplaySettingsChanged, this);
|
|
395
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
396
|
+
model.onInvisibleChanged.removeListener(this.handleInvisibleChanged, this);
|
|
369
397
|
}
|
|
370
398
|
handlePlanarClipMaskChanged(mask, model) {
|
|
371
399
|
this.onPlanarClipMaskChanged.raiseEvent(model, mask);
|
|
@@ -376,6 +404,9 @@ class ContextRealityModels {
|
|
|
376
404
|
handleDisplaySettingsChanged(settings, model) {
|
|
377
405
|
this.onDisplaySettingsChanged.raiseEvent(model, settings);
|
|
378
406
|
}
|
|
407
|
+
handleInvisibleChanged(invisible, model) {
|
|
408
|
+
this.onInvisibleChanged.raiseEvent(model, invisible);
|
|
409
|
+
}
|
|
379
410
|
}
|
|
380
411
|
exports.ContextRealityModels = ContextRealityModels;
|
|
381
412
|
//# sourceMappingURL=ContextRealityModel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextRealityModel.js","sourceRoot":"","sources":["../../src/ContextRealityModel.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAsD;AACtD,yDAA+E;AAC/E,qDAAmG;AACnG,mEAAkH;AAClH,+EAAsG;AAatG;;GAEG;AACH,IAAY,mBAyBX;AAzBD,WAAY,mBAAmB;IAC7B;;;;;OAKG;IACH,gDAAyB,CAAA;IACzB;;;;;OAKG;IACH,kDAA2B,CAAA;IAC3B;;;;OAIG;IACH,oDAA6B,CAAA;IAC7B;;OAEG;IACH,wDAAiC,CAAA;AACnC,CAAC,EAzBW,mBAAmB,mCAAnB,mBAAmB,QAyB9B;AAED;;GAEG;AACH,IAAY,iBASX;AATD,WAAY,iBAAiB;IAC3B;;SAEK;IACL,8CAAyB,CAAA;IACzB;;MAEE;IACF,gCAAW,CAAA;AACb,CAAC,EATW,iBAAiB,iCAAjB,iBAAiB,QAS5B;AAED;;GAEG;AACH,WAAiB,iBAAiB;IAChC;;;;OAIG;IACH,SAAgB,OAAO,CAAC,UAAkB;QACxC,IAAI,MAAM,GAAG,iBAAiB,CAAC,UAAU,CAAC;QAC1C,IAAI,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC;YAC7B,MAAM,GAAG,iBAAiB,CAAC,GAAG,CAAC;QACjC,OAAO,MAAM,CAAC;IAChB,CAAC;IALe,yBAAO,UAKtB,CAAA;AACH,CAAC,EAZgB,iBAAiB,iCAAjB,iBAAiB,QAYjC;AAuBD;;WAEW;AACX,IAAiB,oBAAoB,CAepC;AAfD,WAAiB,oBAAoB;IACnC,wFAAwF;IACxF,SAAgB,eAAe,CAAC,WAAiC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OAAO,KAAK,CAAC;IACf,CAAC;IAEO,kBAAkB,CAAC,KAA0B;QACnD,6DAA6D;QAC7D,KAAK,CAAC,uBAAuB,CAAC,cAAc,CAAC,IAAI,CAAC,2BAA2B,EAAE,IAAI,CAAC,CAAC;QACrF,6DAA6D;QAC7D,KAAK,CAAC,4BAA4B,CAAC,cAAc,CAAC,IAAI,CAAC,gCAAgC,EAAE,IAAI,CAAC,CAAC;QAC/F,6DAA6D;QAC7D,KAAK,CAAC,wBAAwB,CAAC,cAAc,CAAC,IAAI,CAAC,4BAA4B,EAAE,IAAI,CAAC,CAAC;IACzF,CAAC;IAEO,2BAA2B,CAAC,IAAwC,EAAE,KAA0B;QACtG,IAAI,CAAC,uBAAuB,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACvD,CAAC;IAEO,gCAAgC,CAAC,GAAkC,EAAE,KAA0B;QACrG,IAAI,CAAC,4BAA4B,CAAC,UAAU,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAC3D,CAAC;IAEO,4BAA4B,CAAC,QAAqC,EAAE,KAA0B;QACpG,IAAI,CAAC,wBAAwB,CAAC,UAAU,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC5D,CAAC;CACF;AAtMD,oDAsMC","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/** @packageDocumentation\r\n * @module DisplayStyles\r\n */\r\n\r\nimport { assert, BeEvent } from \"@itwin/core-bentley\";\r\nimport { FeatureAppearance, FeatureAppearanceProps } from \"./FeatureSymbology\";\r\nimport { PlanarClipMaskMode, PlanarClipMaskProps, PlanarClipMaskSettings } from \"./PlanarClipMask\";\r\nimport { SpatialClassifierProps, SpatialClassifiers, SpatialClassifiersContainer } from \"./SpatialClassification\";\r\nimport { RealityModelDisplayProps, RealityModelDisplaySettings } from \"./RealityModelDisplaySettings\";\r\n\r\n/** JSON representation of the blob properties for an OrbitGt property cloud.\r\n * @alpha\r\n */\r\nexport interface OrbitGtBlobProps {\r\n rdsUrl?: string;\r\n containerName: string;\r\n blobFileName: string;\r\n sasToken: string;\r\n accountName: string;\r\n}\r\n\r\n/** Identify the Reality Data service provider\r\n * @beta\r\n */\r\nexport enum RealityDataProvider {\r\n /**\r\n * This is the legacy mode where the access to the 3d tiles is harcoded in ContextRealityModelProps.tilesetUrl property.\r\n * It was use to support RealityMesh3DTiles, Terrain3DTiles, Cesium3DTiles\r\n * You should use other mode when possible\r\n * @see [[RealityDataSource.createKeyFromUrl]] that will try to detect provider from an URL\r\n */\r\n TilesetUrl = \"TilesetUrl\",\r\n /**\r\n * This is the legacy mode where the access to the 3d tiles is harcoded in ContextRealityModelProps.OrbitGtBlob property.\r\n * It was use to support OrbitPointCloud (OPC) from other server than ContextShare\r\n * You should use other mode when possible\r\n * @see [[RealityDataSource.createKeyFromOrbitGtBlobProps]] that will try to detect provider from an URL\r\n */\r\n OrbitGtBlob = \"OrbitGtBlob\",\r\n /**\r\n * Will provide access url from realityDataId and iTwinId on contextShare for 3dTile storage format or OPC storage format\r\n * This provider support all type of 3dTile storage fomat and OrbitPointCloud: RealityMesh3DTiles, Terrain3DTiles, Cesium3DTiles, OPC\r\n * @see [[RealityDataFormat]].\r\n */\r\n ContextShare = \"ContextShare\",\r\n /**\r\n * Will provide Open Street Map Building (OSM) from Cesium Ion (in 3dTile format)\r\n */\r\n CesiumIonAsset = \"CesiumIonAsset\",\r\n}\r\n\r\n/** Identify the Reality Data storage format\r\n * @beta\r\n */\r\nexport enum RealityDataFormat {\r\n /**\r\n * 3dTile supported formats; RealityMesh3DTiles, Terrain3DTiles, Cesium3DTiles\r\n * */\r\n ThreeDTile = \"ThreeDTile\",\r\n /**\r\n * Orbit Point Cloud (OPC) storage format (RealityDataType.OPC)\r\n */\r\n OPC = \"OPC\",\r\n}\r\n\r\n/** Utility function for RealityDataFormat\r\n * @beta\r\n */\r\nexport namespace RealityDataFormat {\r\n /**\r\n * Try to extract the RealityDataFormat from the url\r\n * @param tilesetUrl the reality data attachment url\r\n * @returns the extracted RealityDataFormat or ThreeDTile by default if not found\r\n */\r\n export function fromUrl(tilesetUrl: string): RealityDataFormat {\r\n let format = RealityDataFormat.ThreeDTile;\r\n if (tilesetUrl.includes(\".opc\"))\r\n format = RealityDataFormat.OPC;\r\n return format;\r\n }\r\n}\r\n\r\n/**\r\n * Key used by RealityDataSource to identify provider and reality data format\r\n * This key identify one and only one reality data source on the provider\r\n * @beta\r\n */\r\nexport interface RealityDataSourceKey {\r\n /**\r\n * The provider that supplies the access to reality data source for displaying the reality model\r\n * @see [[RealityDataProvider]] for default supported value;\r\n */\r\n provider: string;\r\n /**\r\n * The format used by the provider to store the reality data\r\n * @see [[RealityDataFormat]] for default supported value;\r\n */\r\n format: string;\r\n /** The reality data id that identify a reality data for the provider */\r\n id: string;\r\n /** The context id that was used when reality data was attached - if none provided, current session iTwinId will be used */\r\n iTwinId?: string;\r\n}\r\n/**\r\n * RealityDataSourceKey utility functions\r\n * @beta */\r\nexport namespace RealityDataSourceKey {\r\n /** Utility function to convert a RealityDataSourceKey into its string representation */\r\n export function convertToString(rdSourceKey: RealityDataSourceKey): string {\r\n return `${rdSourceKey.provider}:${rdSourceKey.format}:${rdSourceKey.id}:${rdSourceKey?.iTwinId}`;\r\n }\r\n /** Utility function to compare two RealityDataSourceKey, we consider it equal even if itwinId is different */\r\n export function isEqual(key1: RealityDataSourceKey, key2: RealityDataSourceKey): boolean {\r\n if ((key1.provider === RealityDataProvider.CesiumIonAsset) && key2.provider === RealityDataProvider.CesiumIonAsset)\r\n return true; // ignore other properties for CesiumIonAsset, id is hidden\r\n if ((key1.provider === key2.provider) && (key1.format === key2.format) && (key1.id === key2.id)) {\r\n // && (key1?.iTwinId === key2?.iTwinId)) -> ignore iTwinId, consider it is the same reality data\r\n return true;\r\n }\r\n return false;\r\n }\r\n}\r\n\r\n/** JSON representation of the reality data reference attachment properties.\r\n * @beta\r\n*/\r\nexport interface RealityDataSourceProps {\r\n /** The source key that identify a reality data for the provider. */\r\n sourceKey: RealityDataSourceKey;\r\n}\r\n\r\n/** JSON representation of a [[ContextRealityModel]].\r\n * @public\r\n * @extensions\r\n */\r\nexport interface ContextRealityModelProps {\r\n /** See [[ContextRealityModel.rdSourceKey]].\r\n * @beta\r\n */\r\n rdSourceKey?: RealityDataSourceKey;\r\n /** The URL that supplies the 3d tiles for displaying the reality model. */\r\n tilesetUrl: string;\r\n /** See [[ContextRealityModel.orbitGtBlob]].\r\n * @alpha\r\n */\r\n orbitGtBlob?: OrbitGtBlobProps;\r\n /** See [[ContextRealityModel.realityDataId]]. */\r\n realityDataId?: string;\r\n /** An optional, user-friendly name for the reality model suitable for display in a user interface. */\r\n name?: string;\r\n /** An optional, user-friendly description of the reality model suitable for display in a user interface. */\r\n description?: string;\r\n /** See [[ContextRealityModel.classifiers]]. */\r\n classifiers?: SpatialClassifierProps[];\r\n /** See [[ContextRealityModel.planarClipMask]]. */\r\n planarClipMask?: PlanarClipMaskProps;\r\n /** See [[ContextRealityModel.appearanceOverrides]]. */\r\n appearanceOverrides?: FeatureAppearanceProps;\r\n /** See [[ContextRealityModel.displaySettings]].\r\n * @beta\r\n */\r\n displaySettings?: RealityModelDisplayProps;\r\n}\r\n\r\n/** @public */\r\nexport namespace ContextRealityModelProps {\r\n /** Produce a deep copy of `input`. */\r\n export function clone(input: ContextRealityModelProps): ContextRealityModelProps {\r\n // Spread operator is shallow, and includes `undefined` properties and empty strings.\r\n // We want to make deep copies, omit undefined properties and empty strings, and require tilesetUrl to be defined.\r\n const output: ContextRealityModelProps = { tilesetUrl: input.tilesetUrl ?? \"\" };\r\n\r\n if (input.rdSourceKey)\r\n output.rdSourceKey = { ...input.rdSourceKey };\r\n\r\n if (input.name)\r\n output.name = input.name;\r\n\r\n if (input.realityDataId)\r\n output.realityDataId = input.realityDataId;\r\n\r\n if (input.description)\r\n output.description = input.description;\r\n\r\n if (input.orbitGtBlob)\r\n output.orbitGtBlob = { ...input.orbitGtBlob };\r\n\r\n if (input.appearanceOverrides) {\r\n output.appearanceOverrides = { ...input.appearanceOverrides };\r\n if (input.appearanceOverrides.rgb)\r\n output.appearanceOverrides.rgb = { ...input.appearanceOverrides.rgb };\r\n }\r\n\r\n if (input.displaySettings) {\r\n output.displaySettings = { ...input.displaySettings };\r\n if (input.displaySettings.pointCloud)\r\n output.displaySettings.pointCloud = { ...output.displaySettings.pointCloud };\r\n }\r\n\r\n if (input.planarClipMask)\r\n output.planarClipMask = { ...input.planarClipMask };\r\n\r\n if (input.classifiers)\r\n output.classifiers = input.classifiers.map((x) => { return { ...x, flags: { ...x.flags } }; });\r\n\r\n return output;\r\n }\r\n}\r\n\r\n/** A reality model not associated with a [GeometricModel]($backend) but instead defined in a [DisplayStyle]($backend) or [DisplayStyleState]($frontend).\r\n * Such reality models are displayed to provide context to the view and can be freely attached and detached at display time.\r\n * @see [this interactive example](https://www.itwinjs.org/sample-showcase/?group=Viewer&sample=reality-data-sample)\r\n * @see [[DisplayStyleSettings.contextRealityModels]] to define context reality models for a display style.\r\n * @public\r\n */\r\nexport class ContextRealityModel {\r\n /** @internal */\r\n protected readonly _props: ContextRealityModelProps;\r\n /**\r\n * The reality data source key identify the reality data provider and storage format.\r\n * It takes precedence over tilesetUrl and orbitGtBlob when present and can be use to actually replace these properties.\r\n * @beta\r\n */\r\n public readonly rdSourceKey?: RealityDataSourceKey;\r\n /** A name suitable for display in a user interface. By default, an empty string. */\r\n public readonly name: string;\r\n /** The URL that supplies the 3d tiles for displaying the reality model. */\r\n public readonly url: string;\r\n /** A description of the model suitable for display in a user interface. By default, an empty string. */\r\n public readonly description: string;\r\n /** An optional identifier that, if present, can be used to elide a request to the reality data service. */\r\n public readonly realityDataId?: string;\r\n private readonly _classifiers: SpatialClassifiers;\r\n /** @alpha */\r\n public readonly orbitGtBlob?: Readonly<OrbitGtBlobProps>;\r\n protected _appearanceOverrides?: FeatureAppearance;\r\n /** @beta */\r\n protected _displaySettings: RealityModelDisplaySettings;\r\n protected _planarClipMask?: PlanarClipMaskSettings;\r\n /** Event dispatched just before assignment to [[planarClipMaskSettings]]. */\r\n public readonly onPlanarClipMaskChanged = new BeEvent<(newSettings: PlanarClipMaskSettings | undefined, model: ContextRealityModel) => void>();\r\n /** Event dispatched just before assignment to [[appearanceOverrides]]. */\r\n public readonly onAppearanceOverridesChanged = new BeEvent<(newOverrides: FeatureAppearance | undefined, model: ContextRealityModel) => void>();\r\n /** Event dispatched just before assignment to [[displaySettings]].\r\n * @beta\r\n */\r\n public readonly onDisplaySettingsChanged = new BeEvent<(newSettings: RealityModelDisplaySettings, model: ContextRealityModel) => void>();\r\n\r\n /** Construct a new context reality model.\r\n * @param props JSON representation of the reality model, which will be kept in sync with changes made via the ContextRealityModel's methods.\r\n * @param options Options to customize how the reality model is created.\r\n */\r\n public constructor(props: ContextRealityModelProps, options?: { createClassifiers: (container: SpatialClassifiersContainer) => SpatialClassifiers }) {\r\n this._props = props;\r\n this.rdSourceKey = props.rdSourceKey;\r\n this.name = props.name ?? \"\";\r\n this.url = props.tilesetUrl ?? \"\";\r\n this.orbitGtBlob = props.orbitGtBlob;\r\n this.realityDataId = props.realityDataId;\r\n this.description = props.description ?? \"\";\r\n this._appearanceOverrides = props.appearanceOverrides ? FeatureAppearance.fromJSON(props.appearanceOverrides) : undefined;\r\n this._displaySettings = RealityModelDisplaySettings.fromJSON(props.displaySettings);\r\n\r\n if (props.planarClipMask && props.planarClipMask.mode !== PlanarClipMaskMode.None)\r\n this._planarClipMask = PlanarClipMaskSettings.fromJSON(props.planarClipMask);\r\n\r\n if (options?.createClassifiers) {\r\n this._classifiers = options.createClassifiers(props);\r\n } else {\r\n this._classifiers = new SpatialClassifiers(props);\r\n }\r\n }\r\n\r\n /** A set of [[SpatialClassifier]]s, of which one at any given time can be used to classify the reality model. */\r\n public get classifiers(): SpatialClassifiers {\r\n return this._classifiers;\r\n }\r\n\r\n /** Optionally describes how the geometry of the reality model can be masked by other models. */\r\n public get planarClipMaskSettings(): PlanarClipMaskSettings | undefined {\r\n return this._planarClipMask;\r\n }\r\n public set planarClipMaskSettings(settings: PlanarClipMaskSettings | undefined) {\r\n this.onPlanarClipMaskChanged.raiseEvent(settings, this);\r\n if (!settings)\r\n delete this._props.planarClipMask;\r\n else\r\n this._props.planarClipMask = settings.toJSON();\r\n\r\n this._planarClipMask = settings;\r\n }\r\n\r\n /** Overrides applied to the appearance of the reality model. Only the rgb, transparency, nonLocatable, and emphasized properties are applicable - the rest are ignored. */\r\n public get appearanceOverrides(): FeatureAppearance | undefined {\r\n return this._appearanceOverrides;\r\n }\r\n public set appearanceOverrides(overrides: FeatureAppearance | undefined) {\r\n this.onAppearanceOverridesChanged.raiseEvent(overrides, this);\r\n if (!overrides)\r\n delete this._props.appearanceOverrides;\r\n else\r\n this._props.appearanceOverrides = overrides.toJSON();\r\n\r\n this._appearanceOverrides = overrides;\r\n }\r\n\r\n /** Settings controlling how this reality model is displayed in a [Viewport]($frontend).\r\n * @beta\r\n */\r\n public get displaySettings(): RealityModelDisplaySettings {\r\n return this._displaySettings;\r\n }\r\n public set displaySettings(settings: RealityModelDisplaySettings) {\r\n this.onDisplaySettingsChanged.raiseEvent(settings, this);\r\n this._props.displaySettings = settings.toJSON();\r\n this._displaySettings = settings;\r\n }\r\n\r\n /** Convert this model to its JSON representation. */\r\n public toJSON(): ContextRealityModelProps {\r\n return ContextRealityModelProps.clone(this._props);\r\n }\r\n\r\n /** Returns true if [[name]] and [[url]] match the specified name and url. */\r\n public matchesNameAndUrl(name: string, url: string): boolean {\r\n return this.name === name && this.url === url;\r\n }\r\n}\r\n\r\n/** An object that can store the JSON representation of a list of [[ContextRealityModel]]s.\r\n * @see [[ContextRealityModels]].\r\n * @see [[DisplayStyleSettingsProps.contextRealityModels]].\r\n * @public\r\n * @extensions\r\n */\r\nexport interface ContextRealityModelsContainer {\r\n /** The list of reality models. */\r\n contextRealityModels?: ContextRealityModelProps[];\r\n /** @internal used for type discrimination with ContextRealityModelsArgs. */\r\n container?: never;\r\n}\r\n\r\n/** Arguments supplied to the constructor of [[ContextRealityModels]].\r\n * @public\r\n */\r\nexport interface ContextRealityModelsArgs {\r\n /** The object that holds the JSON representation of the list of context reality models. */\r\n container: ContextRealityModelsContainer;\r\n /** Optional function used to instantiate each [[ContextRealityModel]] in the list. */\r\n createContextRealityModel?: (props: ContextRealityModelProps) => ContextRealityModel;\r\n /** If true, the list will not be populated by the constructor. Instead, the caller is responsible for calling [[ContextRealityModels.populate]] exactly once after construction.\r\n * This is chiefly intended for use internally by the [DisplayStyleState]($frontend) constructor.\r\n */\r\n deferPopulating?: boolean;\r\n}\r\n\r\n/** A list of [[ContextRealityModel]]s attached to a [[DisplayStyleSettings]]. The list may be presented to the user with the name and description of each model.\r\n * The list is automatically synchronized with the underlying JSON representation provided by the input [[ContextRealityModelsContainer]].\r\n * @see [this interactive example](https://www.itwinjs.org/sample-showcase/?group=Viewer&sample=reality-data-sample)\r\n * @see [[DisplayStyleSettings.contextRealityModels]].\r\n * @public\r\n */\r\nexport class ContextRealityModels {\r\n private readonly _container: ContextRealityModelsContainer;\r\n private readonly _createModel: (props: ContextRealityModelProps) => ContextRealityModel;\r\n private readonly _models: ContextRealityModel[] = [];\r\n /** Event dispatched just before [[ContextRealityModel.planarClipMaskSettings]] is modified for one of the reality models. */\r\n public readonly onPlanarClipMaskChanged = new BeEvent<(model: ContextRealityModel, newSettings: PlanarClipMaskSettings | undefined) => void>();\r\n /** Event dispatched just before [[ContextRealityModel.appearanceOverrides]] is modified for one of the reality models. */\r\n public readonly onAppearanceOverridesChanged = new BeEvent<(model: ContextRealityModel, newOverrides: FeatureAppearance | undefined) => void>();\r\n /** Event dispatched just before [[ContextRealityModel.displaySettings]] is modified for one of the reality models.\r\n * @beta\r\n */\r\n public readonly onDisplaySettingsChanged = new BeEvent<(model: ContextRealityModel, newSettings: RealityModelDisplaySettings) => void>();\r\n /** Event dispatched when a model is [[add]]ed, [[delete]]d, [[replace]]d, or [[update]]d. */\r\n public readonly onChanged = new BeEvent<(previousModel: ContextRealityModel | undefined, newModel: ContextRealityModel | undefined) => void>();\r\n\r\n /** Construct a new list of reality models from its JSON representation. The list will be initialized from `container.contextRealityModels` and that JSON representation\r\n * will be kept in sync with changes made to the list. The caller should not directly modify `container.contextRealityModels` or its contents as that will cause the list\r\n * to become out of sync with the JSON representation.\r\n * @param container The object that holds the JSON representation of the list.\r\n * @param createContextRealityModel Optional function used to instantiate each [[ContextRealityModel]] in the list.\r\n */\r\n public constructor(container: ContextRealityModelsContainer, createContextRealityModel?: (props: ContextRealityModelProps) => ContextRealityModel);\r\n\r\n /** Construct a new list of reality models from its JSON representation. The list will be initialized from `args.container.contextRealityModels` and that JSON representation\r\n * will be kept in sync with changes made to the list. The caller should not directly modify `container.contextRealityModels` or its contents as that will cause the list\r\n * to become out of sync with the JSON representation.\r\n * @param args Specifies the container and optionally customizes how the list of models is populated.\r\n */\r\n public constructor(args: ContextRealityModelsArgs);\r\n\r\n /** @internal */\r\n public constructor(arg0: ContextRealityModelsContainer | ContextRealityModelsArgs, createContextRealityModel?: (props: ContextRealityModelProps) => ContextRealityModel) {\r\n let container: ContextRealityModelsContainer;\r\n let defer = false;\r\n if (arg0.container) {\r\n container = arg0.container;\r\n createContextRealityModel = arg0.createContextRealityModel;\r\n defer = true === arg0.deferPopulating;\r\n } else {\r\n container = arg0;\r\n }\r\n\r\n this._container = container;\r\n this._createModel = createContextRealityModel ?? ((props) => new ContextRealityModel(props));\r\n\r\n if (!defer)\r\n this.populate();\r\n }\r\n\r\n /** @internal needs to be invoked after DisplayStyleSettings constructor by DisplayStyleState constructor.*/\r\n /** Populate the list of [[models]] from the container that was supplied to the constructor.\r\n * This should only be invoked once, and only if [[ContextRealityModelsArgs.deferPopulating]] was specified as `true` when calling the constructor.\r\n * @public\r\n */\r\n public populate(): void {\r\n assert(this._models.length === 0, \"do not call ContextRealityModels.populate more than once\");\r\n const models = this._container.contextRealityModels;\r\n if (models)\r\n for (const model of models)\r\n this._models.push(this.createModel(model));\r\n }\r\n\r\n /** The read-only list of reality models. */\r\n public get models(): ReadonlyArray<ContextRealityModel> {\r\n return this._models;\r\n }\r\n\r\n /** Append a new reality model to the list.\r\n * @param The JSON representation of the reality model.\r\n * @returns the newly-added reality model.\r\n */\r\n public add(props: ContextRealityModelProps): ContextRealityModel {\r\n if (!this._container.contextRealityModels)\r\n this._container.contextRealityModels = [];\r\n\r\n props = ContextRealityModelProps.clone(props);\r\n const model = this.createModel(props);\r\n\r\n this.onChanged.raiseEvent(undefined, model);\r\n\r\n this._models.push(model);\r\n this._container.contextRealityModels.push(props);\r\n\r\n return model;\r\n }\r\n\r\n /** Remove the specified reality model from the list.\r\n * @param model The reality model to remove.\r\n * @returns true if the model was removed, or false if the model was not present in the list.\r\n */\r\n public delete(model: ContextRealityModel): boolean {\r\n const index = this._models.indexOf(model);\r\n if (-1 === index)\r\n return false;\r\n\r\n assert(undefined !== this._container.contextRealityModels);\r\n assert(index < this._container.contextRealityModels.length);\r\n\r\n this.dropEventListeners(model);\r\n this.onChanged.raiseEvent(model, undefined);\r\n\r\n this._models.splice(index, 1);\r\n if (this.models.length === 0)\r\n this._container.contextRealityModels = undefined;\r\n else\r\n this._container.contextRealityModels.splice(index, 1);\r\n\r\n return true;\r\n }\r\n\r\n /** Remove all reality models from the list. */\r\n public clear(): void {\r\n for (const model of this.models) {\r\n this.dropEventListeners(model);\r\n this.onChanged.raiseEvent(model, undefined);\r\n }\r\n\r\n this._container.contextRealityModels = undefined;\r\n this._models.length = 0;\r\n }\r\n\r\n /** Replace a reality model in the list.\r\n * @param toReplace The reality model to be replaced.\r\n * @param replaceWith The JSON representation of the replacement reality model.\r\n * @returns the newly-created reality model that replaced `toReplace`.\r\n * @throws Error if `toReplace` is not present in the list\r\n * @note The replacement occupies the same index in the list as `toReplace` did.\r\n */\r\n public replace(toReplace: ContextRealityModel, replaceWith: ContextRealityModelProps): ContextRealityModel {\r\n const index = this._models.indexOf(toReplace);\r\n if (-1 === index)\r\n throw new Error(\"ContextRealityModel not present in list.\");\r\n\r\n assert(undefined !== this._container.contextRealityModels);\r\n assert(index < this._container.contextRealityModels.length);\r\n\r\n replaceWith = ContextRealityModelProps.clone(replaceWith);\r\n const model = this.createModel(replaceWith);\r\n\r\n this.onChanged.raiseEvent(toReplace, model);\r\n this.dropEventListeners(toReplace);\r\n\r\n this._models[index] = model;\r\n this._container.contextRealityModels[index] = replaceWith;\r\n\r\n return model;\r\n }\r\n\r\n /** Change selected properties of a reality model.\r\n * @param toUpdate The reality model whose properties are to be modified.\r\n * @param updateProps The properties to change.\r\n * @returns The updated reality model, identical to `toUpdate` except for properties explicitly supplied by `updateProps`.\r\n * @throws Error if `toUpdate` is not present in the list.\r\n */\r\n public update(toUpdate: ContextRealityModel, updateProps: Partial<ContextRealityModelProps>): ContextRealityModel {\r\n const props = {\r\n ...toUpdate.toJSON(),\r\n ...updateProps,\r\n };\r\n\r\n // Partial<> makes it possible to pass `undefined` for tilesetUrl...preserve previous URL in that case.\r\n if (undefined === props.tilesetUrl)\r\n props.tilesetUrl = toUpdate.url;\r\n\r\n return this.replace(toUpdate, props);\r\n }\r\n\r\n private createModel(props: ContextRealityModelProps): ContextRealityModel {\r\n const model = this._createModel(props);\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n model.onPlanarClipMaskChanged.addListener(this.handlePlanarClipMaskChanged, this);\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n model.onAppearanceOverridesChanged.addListener(this.handleAppearanceOverridesChanged, this);\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n model.onDisplaySettingsChanged.addListener(this.handleDisplaySettingsChanged, this);\r\n return model;\r\n }\r\n\r\n private dropEventListeners(model: ContextRealityModel): void {\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n model.onPlanarClipMaskChanged.removeListener(this.handlePlanarClipMaskChanged, this);\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n model.onAppearanceOverridesChanged.removeListener(this.handleAppearanceOverridesChanged, this);\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n model.onDisplaySettingsChanged.removeListener(this.handleDisplaySettingsChanged, this);\r\n }\r\n\r\n private handlePlanarClipMaskChanged(mask: PlanarClipMaskSettings | undefined, model: ContextRealityModel): void {\r\n this.onPlanarClipMaskChanged.raiseEvent(model, mask);\r\n }\r\n\r\n private handleAppearanceOverridesChanged(app: FeatureAppearance | undefined, model: ContextRealityModel): void {\r\n this.onAppearanceOverridesChanged.raiseEvent(model, app);\r\n }\r\n\r\n private handleDisplaySettingsChanged(settings: RealityModelDisplaySettings, model: ContextRealityModel): void {\r\n this.onDisplaySettingsChanged.raiseEvent(model, settings);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"ContextRealityModel.js","sourceRoot":"","sources":["../../src/ContextRealityModel.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAsD;AACtD,yDAA+E;AAC/E,qDAAmG;AACnG,mEAAkH;AAClH,+EAAsG;AAatG;;GAEG;AACH,IAAY,mBAyBX;AAzBD,WAAY,mBAAmB;IAC7B;;;;;OAKG;IACH,gDAAyB,CAAA;IACzB;;;;;OAKG;IACH,kDAA2B,CAAA;IAC3B;;;;OAIG;IACH,oDAA6B,CAAA;IAC7B;;OAEG;IACH,wDAAiC,CAAA;AACnC,CAAC,EAzBW,mBAAmB,mCAAnB,mBAAmB,QAyB9B;AAED;;GAEG;AACH,IAAY,iBASX;AATD,WAAY,iBAAiB;IAC3B;;SAEK;IACL,8CAAyB,CAAA;IACzB;;MAEE;IACF,gCAAW,CAAA;AACb,CAAC,EATW,iBAAiB,iCAAjB,iBAAiB,QAS5B;AAED;;GAEG;AACH,WAAiB,iBAAiB;IAChC;;;;OAIG;IACH,SAAgB,OAAO,CAAC,UAAkB;QACxC,IAAI,MAAM,GAAG,iBAAiB,CA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6DAA6D;QAC7D,KAAK,CAAC,4BAA4B,CAAC,cAAc,CAAC,IAAI,CAAC,gCAAgC,EAAE,IAAI,CAAC,CAAC;QAC/F,6DAA6D;QAC7D,KAAK,CAAC,wBAAwB,CAAC,cAAc,CAAC,IAAI,CAAC,4BAA4B,EAAE,IAAI,CAAC,CAAC;QACvF,6DAA6D;QAC7D,KAAK,CAAC,kBAAkB,CAAC,cAAc,CAAC,IAAI,CAAC,sBAAsB,EAAE,IAAI,CAAC,CAAC;IAC7E,CAAC;IAEO,2BAA2B,CAAC,IAAwC,EAAE,KAA0B;QACtG,IAAI,CAAC,uBAAuB,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACvD,CAAC;IAEO,gCAAgC,CAAC,GAAkC,EAAE,KAA0B;QACrG,IAAI,CAAC,4BAA4B,CAAC,UAAU,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAC3D,CAAC;IAEO,4BAA4B,CAAC,QAAqC,EAAE,KAA0B;QACpG,IAAI,CAAC,wBAAwB,CAAC,UAAU,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC5D,CAAC;IAEO,sBAAsB,CAAC,SAAkB,EAAE,KAA0B;QAC3E,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IACvD,CAAC;CACF;AAlND,oDAkNC","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/** @packageDocumentation\r\n * @module DisplayStyles\r\n */\r\n\r\nimport { assert, BeEvent } from \"@itwin/core-bentley\";\r\nimport { FeatureAppearance, FeatureAppearanceProps } from \"./FeatureSymbology\";\r\nimport { PlanarClipMaskMode, PlanarClipMaskProps, PlanarClipMaskSettings } from \"./PlanarClipMask\";\r\nimport { SpatialClassifierProps, SpatialClassifiers, SpatialClassifiersContainer } from \"./SpatialClassification\";\r\nimport { RealityModelDisplayProps, RealityModelDisplaySettings } from \"./RealityModelDisplaySettings\";\r\n\r\n/** JSON representation of the blob properties for an OrbitGt property cloud.\r\n * @alpha\r\n */\r\nexport interface OrbitGtBlobProps {\r\n rdsUrl?: string;\r\n containerName: string;\r\n blobFileName: string;\r\n sasToken: string;\r\n accountName: string;\r\n}\r\n\r\n/** Identify the Reality Data service provider\r\n * @beta\r\n */\r\nexport enum RealityDataProvider {\r\n /**\r\n * This is the legacy mode where the access to the 3d tiles is harcoded in ContextRealityModelProps.tilesetUrl property.\r\n * It was use to support RealityMesh3DTiles, Terrain3DTiles, Cesium3DTiles\r\n * You should use other mode when possible\r\n * @see [[RealityDataSource.createKeyFromUrl]] that will try to detect provider from an URL\r\n */\r\n TilesetUrl = \"TilesetUrl\",\r\n /**\r\n * This is the legacy mode where the access to the 3d tiles is harcoded in ContextRealityModelProps.OrbitGtBlob property.\r\n * It was use to support OrbitPointCloud (OPC) from other server than ContextShare\r\n * You should use other mode when possible\r\n * @see [[RealityDataSource.createKeyFromOrbitGtBlobProps]] that will try to detect provider from an URL\r\n */\r\n OrbitGtBlob = \"OrbitGtBlob\",\r\n /**\r\n * Will provide access url from realityDataId and iTwinId on contextShare for 3dTile storage format or OPC storage format\r\n * This provider support all type of 3dTile storage fomat and OrbitPointCloud: RealityMesh3DTiles, Terrain3DTiles, Cesium3DTiles, OPC\r\n * @see [[RealityDataFormat]].\r\n */\r\n ContextShare = \"ContextShare\",\r\n /**\r\n * Will provide Open Street Map Building (OSM) from Cesium Ion (in 3dTile format)\r\n */\r\n CesiumIonAsset = \"CesiumIonAsset\",\r\n}\r\n\r\n/** Identify the Reality Data storage format\r\n * @beta\r\n */\r\nexport enum RealityDataFormat {\r\n /**\r\n * 3dTile supported formats; RealityMesh3DTiles, Terrain3DTiles, Cesium3DTiles\r\n * */\r\n ThreeDTile = \"ThreeDTile\",\r\n /**\r\n * Orbit Point Cloud (OPC) storage format (RealityDataType.OPC)\r\n */\r\n OPC = \"OPC\",\r\n}\r\n\r\n/** Utility function for RealityDataFormat\r\n * @beta\r\n */\r\nexport namespace RealityDataFormat {\r\n /**\r\n * Try to extract the RealityDataFormat from the url\r\n * @param tilesetUrl the reality data attachment url\r\n * @returns the extracted RealityDataFormat or ThreeDTile by default if not found\r\n */\r\n export function fromUrl(tilesetUrl: string): RealityDataFormat {\r\n let format = RealityDataFormat.ThreeDTile;\r\n if (tilesetUrl.includes(\".opc\"))\r\n format = RealityDataFormat.OPC;\r\n return format;\r\n }\r\n}\r\n\r\n/**\r\n * Key used by RealityDataSource to identify provider and reality data format\r\n * This key identify one and only one reality data source on the provider\r\n * @beta\r\n */\r\nexport interface RealityDataSourceKey {\r\n /**\r\n * The provider that supplies the access to reality data source for displaying the reality model\r\n * @see [[RealityDataProvider]] for default supported value;\r\n */\r\n provider: string;\r\n /**\r\n * The format used by the provider to store the reality data\r\n * @see [[RealityDataFormat]] for default supported value;\r\n */\r\n format: string;\r\n /** The reality data id that identify a reality data for the provider */\r\n id: string;\r\n /** The context id that was used when reality data was attached - if none provided, current session iTwinId will be used */\r\n iTwinId?: string;\r\n}\r\n/**\r\n * RealityDataSourceKey utility functions\r\n * @beta */\r\nexport namespace RealityDataSourceKey {\r\n /** Utility function to convert a RealityDataSourceKey into its string representation */\r\n export function convertToString(rdSourceKey: RealityDataSourceKey): string {\r\n return `${rdSourceKey.provider}:${rdSourceKey.format}:${rdSourceKey.id}:${rdSourceKey?.iTwinId}`;\r\n }\r\n /** Utility function to compare two RealityDataSourceKey, we consider it equal even if itwinId is different */\r\n export function isEqual(key1: RealityDataSourceKey, key2: RealityDataSourceKey): boolean {\r\n if ((key1.provider === RealityDataProvider.CesiumIonAsset) && key2.provider === RealityDataProvider.CesiumIonAsset)\r\n return true; // ignore other properties for CesiumIonAsset, id is hidden\r\n if ((key1.provider === key2.provider) && (key1.format === key2.format) && (key1.id === key2.id)) {\r\n // && (key1?.iTwinId === key2?.iTwinId)) -> ignore iTwinId, consider it is the same reality data\r\n return true;\r\n }\r\n return false;\r\n }\r\n}\r\n\r\n/** JSON representation of the reality data reference attachment properties.\r\n * @beta\r\n*/\r\nexport interface RealityDataSourceProps {\r\n /** The source key that identify a reality data for the provider. */\r\n sourceKey: RealityDataSourceKey;\r\n}\r\n\r\n/** JSON representation of a [[ContextRealityModel]].\r\n * @public\r\n * @extensions\r\n */\r\nexport interface ContextRealityModelProps {\r\n /** See [[ContextRealityModel.rdSourceKey]].\r\n * @beta\r\n */\r\n rdSourceKey?: RealityDataSourceKey;\r\n /** The URL that supplies the 3d tiles for displaying the reality model. */\r\n tilesetUrl: string;\r\n /** See [[ContextRealityModel.orbitGtBlob]].\r\n * @alpha\r\n */\r\n orbitGtBlob?: OrbitGtBlobProps;\r\n /** See [[ContextRealityModel.realityDataId]]. */\r\n realityDataId?: string;\r\n /** An optional, user-friendly name for the reality model suitable for display in a user interface. */\r\n name?: string;\r\n /** An optional, user-friendly description of the reality model suitable for display in a user interface. */\r\n description?: string;\r\n /** See [[ContextRealityModel.classifiers]]. */\r\n classifiers?: SpatialClassifierProps[];\r\n /** See [[ContextRealityModel.planarClipMask]]. */\r\n planarClipMask?: PlanarClipMaskProps;\r\n /** See [[ContextRealityModel.appearanceOverrides]]. */\r\n appearanceOverrides?: FeatureAppearanceProps;\r\n /** See [[ContextRealityModel.displaySettings]].\r\n * @beta\r\n */\r\n displaySettings?: RealityModelDisplayProps;\r\n /** See [[ContextRealityModel.invisible]].\r\n * @beta\r\n */\r\n invisible?: boolean;\r\n}\r\n\r\n/** @public */\r\nexport namespace ContextRealityModelProps {\r\n /** Produce a deep copy of `input`. */\r\n export function clone(input: ContextRealityModelProps): ContextRealityModelProps {\r\n // Spread operator is shallow, and includes `undefined` properties and empty strings.\r\n // We want to make deep copies, omit undefined properties and empty strings, and require tilesetUrl to be defined.\r\n const output: ContextRealityModelProps = { tilesetUrl: input.tilesetUrl ?? \"\" };\r\n\r\n if (input.rdSourceKey)\r\n output.rdSourceKey = { ...input.rdSourceKey };\r\n\r\n if (input.name)\r\n output.name = input.name;\r\n\r\n if (input.realityDataId)\r\n output.realityDataId = input.realityDataId;\r\n\r\n if (input.description)\r\n output.description = input.description;\r\n\r\n if (input.orbitGtBlob)\r\n output.orbitGtBlob = { ...input.orbitGtBlob };\r\n\r\n if (input.appearanceOverrides) {\r\n output.appearanceOverrides = { ...input.appearanceOverrides };\r\n if (input.appearanceOverrides.rgb)\r\n output.appearanceOverrides.rgb = { ...input.appearanceOverrides.rgb };\r\n }\r\n\r\n if (input.displaySettings) {\r\n output.displaySettings = { ...input.displaySettings };\r\n if (input.displaySettings.pointCloud)\r\n output.displaySettings.pointCloud = { ...output.displaySettings.pointCloud };\r\n }\r\n\r\n if (input.planarClipMask)\r\n output.planarClipMask = { ...input.planarClipMask };\r\n\r\n if (input.classifiers)\r\n output.classifiers = input.classifiers.map((x) => { return { ...x, flags: { ...x.flags } }; });\r\n\r\n if (input.invisible)\r\n output.invisible = input.invisible;\r\n\r\n return output;\r\n }\r\n}\r\n\r\n/** A reality model not associated with a [GeometricModel]($backend) but instead defined in a [DisplayStyle]($backend) or [DisplayStyleState]($frontend).\r\n * Such reality models are displayed to provide context to the view and can be freely attached and detached at display time.\r\n * @see [this interactive example](https://www.itwinjs.org/sample-showcase/?group=Viewer&sample=reality-data-sample)\r\n * @see [[DisplayStyleSettings.contextRealityModels]] to define context reality models for a display style.\r\n * @public\r\n */\r\nexport class ContextRealityModel {\r\n /** @internal */\r\n protected readonly _props: ContextRealityModelProps;\r\n /**\r\n * The reality data source key identify the reality data provider and storage format.\r\n * It takes precedence over tilesetUrl and orbitGtBlob when present and can be use to actually replace these properties.\r\n * @beta\r\n */\r\n public readonly rdSourceKey?: RealityDataSourceKey;\r\n /** A name suitable for display in a user interface. By default, an empty string. */\r\n public readonly name: string;\r\n /** The URL that supplies the 3d tiles for displaying the reality model. */\r\n public readonly url: string;\r\n /** A description of the model suitable for display in a user interface. By default, an empty string. */\r\n public readonly description: string;\r\n /** An optional identifier that, if present, can be used to elide a request to the reality data service. */\r\n public readonly realityDataId?: string;\r\n\r\n private _invisible: boolean;\r\n private readonly _classifiers: SpatialClassifiers;\r\n /** @alpha */\r\n public readonly orbitGtBlob?: Readonly<OrbitGtBlobProps>;\r\n protected _appearanceOverrides?: FeatureAppearance;\r\n /** @beta */\r\n protected _displaySettings: RealityModelDisplaySettings;\r\n protected _planarClipMask?: PlanarClipMaskSettings;\r\n /** Event dispatched just before assignment to [[planarClipMaskSettings]]. */\r\n public readonly onPlanarClipMaskChanged = new BeEvent<(newSettings: PlanarClipMaskSettings | undefined, model: ContextRealityModel) => void>();\r\n /** Event dispatched just before assignment to [[appearanceOverrides]]. */\r\n public readonly onAppearanceOverridesChanged = new BeEvent<(newOverrides: FeatureAppearance | undefined, model: ContextRealityModel) => void>();\r\n /** Event dispatched just before assignment to [[displaySettings]].\r\n * @beta\r\n */\r\n public readonly onDisplaySettingsChanged = new BeEvent<(newSettings: RealityModelDisplaySettings, model: ContextRealityModel) => void>();\r\n /** Event dispatched just before a model become invisible\r\n * @beta\r\n */\r\n public readonly onInvisibleChanged = new BeEvent<(invisible: boolean, model: ContextRealityModel) => void>();\r\n\r\n /** Construct a new context reality model.\r\n * @param props JSON representation of the reality model, which will be kept in sync with changes made via the ContextRealityModel's methods.\r\n * @param options Options to customize how the reality model is created.\r\n */\r\n public constructor(props: ContextRealityModelProps, options?: { createClassifiers: (container: SpatialClassifiersContainer) => SpatialClassifiers }) {\r\n this._props = props;\r\n this.rdSourceKey = props.rdSourceKey;\r\n this.name = props.name ?? \"\";\r\n this.url = props.tilesetUrl ?? \"\";\r\n this.orbitGtBlob = props.orbitGtBlob;\r\n this.realityDataId = props.realityDataId;\r\n this.description = props.description ?? \"\";\r\n this._invisible = props.invisible ?? false;\r\n this._appearanceOverrides = props.appearanceOverrides ? FeatureAppearance.fromJSON(props.appearanceOverrides) : undefined;\r\n this._displaySettings = RealityModelDisplaySettings.fromJSON(props.displaySettings);\r\n\r\n if (props.planarClipMask && props.planarClipMask.mode !== PlanarClipMaskMode.None)\r\n this._planarClipMask = PlanarClipMaskSettings.fromJSON(props.planarClipMask);\r\n\r\n if (options?.createClassifiers) {\r\n this._classifiers = options.createClassifiers(props);\r\n } else {\r\n this._classifiers = new SpatialClassifiers(props);\r\n }\r\n }\r\n\r\n /** A set of [[SpatialClassifier]]s, of which one at any given time can be used to classify the reality model. */\r\n public get classifiers(): SpatialClassifiers {\r\n return this._classifiers;\r\n }\r\n\r\n /** Optionally describes how the geometry of the reality model can be masked by other models. */\r\n public get planarClipMaskSettings(): PlanarClipMaskSettings | undefined {\r\n return this._planarClipMask;\r\n }\r\n public set planarClipMaskSettings(settings: PlanarClipMaskSettings | undefined) {\r\n this.onPlanarClipMaskChanged.raiseEvent(settings, this);\r\n if (!settings)\r\n delete this._props.planarClipMask;\r\n else\r\n this._props.planarClipMask = settings.toJSON();\r\n\r\n this._planarClipMask = settings;\r\n }\r\n\r\n /** Overrides applied to the appearance of the reality model. Only the rgb, transparency, nonLocatable, and emphasized properties are applicable - the rest are ignored. */\r\n public get appearanceOverrides(): FeatureAppearance | undefined {\r\n return this._appearanceOverrides;\r\n }\r\n public set appearanceOverrides(overrides: FeatureAppearance | undefined) {\r\n this.onAppearanceOverridesChanged.raiseEvent(overrides, this);\r\n if (!overrides)\r\n delete this._props.appearanceOverrides;\r\n else\r\n this._props.appearanceOverrides = overrides.toJSON();\r\n\r\n this._appearanceOverrides = overrides;\r\n }\r\n\r\n /** Settings controlling how this reality model is displayed in a [Viewport]($frontend).\r\n * @beta\r\n */\r\n public get displaySettings(): RealityModelDisplaySettings {\r\n return this._displaySettings;\r\n }\r\n public set displaySettings(settings: RealityModelDisplaySettings) {\r\n this.onDisplaySettingsChanged.raiseEvent(settings, this);\r\n this._props.displaySettings = settings.toJSON();\r\n this._displaySettings = settings;\r\n }\r\n\r\n /** If true, reality model is not drawn.\r\n * @beta\r\n */\r\n public get invisible(): boolean {\r\n return this._invisible;\r\n }\r\n public set invisible(invisible: boolean) {\r\n if (invisible !== this.invisible) {\r\n this.onInvisibleChanged.raiseEvent(invisible, this);\r\n }\r\n\r\n this._props.invisible = invisible;\r\n this._invisible = invisible;\r\n }\r\n\r\n /** Convert this model to its JSON representation. */\r\n public toJSON(): ContextRealityModelProps {\r\n return ContextRealityModelProps.clone(this._props);\r\n }\r\n\r\n /** Returns true if [[name]] and [[url]] match the specified name and url. */\r\n public matchesNameAndUrl(name: string, url: string): boolean {\r\n return this.name === name && this.url === url;\r\n }\r\n}\r\n\r\n/** An object that can store the JSON representation of a list of [[ContextRealityModel]]s.\r\n * @see [[ContextRealityModels]].\r\n * @see [[DisplayStyleSettingsProps.contextRealityModels]].\r\n * @public\r\n * @extensions\r\n */\r\nexport interface ContextRealityModelsContainer {\r\n /** The list of reality models. */\r\n contextRealityModels?: ContextRealityModelProps[];\r\n /** @internal used for type discrimination with ContextRealityModelsArgs. */\r\n container?: never;\r\n}\r\n\r\n/** Arguments supplied to the constructor of [[ContextRealityModels]].\r\n * @public\r\n */\r\nexport interface ContextRealityModelsArgs {\r\n /** The object that holds the JSON representation of the list of context reality models. */\r\n container: ContextRealityModelsContainer;\r\n /** Optional function used to instantiate each [[ContextRealityModel]] in the list. */\r\n createContextRealityModel?: (props: ContextRealityModelProps) => ContextRealityModel;\r\n /** If true, the list will not be populated by the constructor. Instead, the caller is responsible for calling [[ContextRealityModels.populate]] exactly once after construction.\r\n * This is chiefly intended for use internally by the [DisplayStyleState]($frontend) constructor.\r\n */\r\n deferPopulating?: boolean;\r\n}\r\n\r\n/** A list of [[ContextRealityModel]]s attached to a [[DisplayStyleSettings]]. The list may be presented to the user with the name and description of each model.\r\n * The list is automatically synchronized with the underlying JSON representation provided by the input [[ContextRealityModelsContainer]].\r\n * @see [this interactive example](https://www.itwinjs.org/sample-showcase/?group=Viewer&sample=reality-data-sample)\r\n * @see [[DisplayStyleSettings.contextRealityModels]].\r\n * @public\r\n */\r\nexport class ContextRealityModels {\r\n private readonly _container: ContextRealityModelsContainer;\r\n private readonly _createModel: (props: ContextRealityModelProps) => ContextRealityModel;\r\n private readonly _models: ContextRealityModel[] = [];\r\n /** Event dispatched just before [[ContextRealityModel.planarClipMaskSettings]] is modified for one of the reality models. */\r\n public readonly onPlanarClipMaskChanged = new BeEvent<(model: ContextRealityModel, newSettings: PlanarClipMaskSettings | undefined) => void>();\r\n /** Event dispatched just before [[ContextRealityModel.appearanceOverrides]] is modified for one of the reality models. */\r\n public readonly onAppearanceOverridesChanged = new BeEvent<(model: ContextRealityModel, newOverrides: FeatureAppearance | undefined) => void>();\r\n /** Event dispatched just before [[ContextRealityModel.displaySettings]] is modified for one of the reality models.\r\n * @beta\r\n */\r\n public readonly onDisplaySettingsChanged = new BeEvent<(model: ContextRealityModel, newSettings: RealityModelDisplaySettings) => void>();\r\n /** Event dispatched just before [[ContextRealityModel.invisible]] is modified for one of the reality models.\r\n * @beta\r\n */\r\n public readonly onInvisibleChanged = new BeEvent<(model: ContextRealityModel, invisible: boolean) => void>();\r\n /** Event dispatched when a model is [[add]]ed, [[delete]]d, [[replace]]d, or [[update]]d. */\r\n public readonly onChanged = new BeEvent<(previousModel: ContextRealityModel | undefined, newModel: ContextRealityModel | undefined) => void>();\r\n\r\n /** Construct a new list of reality models from its JSON representation. The list will be initialized from `container.contextRealityModels` and that JSON representation\r\n * will be kept in sync with changes made to the list. The caller should not directly modify `container.contextRealityModels` or its contents as that will cause the list\r\n * to become out of sync with the JSON representation.\r\n * @param container The object that holds the JSON representation of the list.\r\n * @param createContextRealityModel Optional function used to instantiate each [[ContextRealityModel]] in the list.\r\n */\r\n public constructor(container: ContextRealityModelsContainer, createContextRealityModel?: (props: ContextRealityModelProps) => ContextRealityModel);\r\n\r\n /** Construct a new list of reality models from its JSON representation. The list will be initialized from `args.container.contextRealityModels` and that JSON representation\r\n * will be kept in sync with changes made to the list. The caller should not directly modify `container.contextRealityModels` or its contents as that will cause the list\r\n * to become out of sync with the JSON representation.\r\n * @param args Specifies the container and optionally customizes how the list of models is populated.\r\n */\r\n public constructor(args: ContextRealityModelsArgs);\r\n\r\n /** @internal */\r\n public constructor(arg0: ContextRealityModelsContainer | ContextRealityModelsArgs, createContextRealityModel?: (props: ContextRealityModelProps) => ContextRealityModel) {\r\n let container: ContextRealityModelsContainer;\r\n let defer = false;\r\n if (arg0.container) {\r\n container = arg0.container;\r\n createContextRealityModel = arg0.createContextRealityModel;\r\n defer = true === arg0.deferPopulating;\r\n } else {\r\n container = arg0;\r\n }\r\n\r\n this._container = container;\r\n this._createModel = createContextRealityModel ?? ((props) => new ContextRealityModel(props));\r\n\r\n if (!defer)\r\n this.populate();\r\n }\r\n\r\n /** @internal needs to be invoked after DisplayStyleSettings constructor by DisplayStyleState constructor.*/\r\n /** Populate the list of [[models]] from the container that was supplied to the constructor.\r\n * This should only be invoked once, and only if [[ContextRealityModelsArgs.deferPopulating]] was specified as `true` when calling the constructor.\r\n * @public\r\n */\r\n public populate(): void {\r\n assert(this._models.length === 0, \"do not call ContextRealityModels.populate more than once\");\r\n const models = this._container.contextRealityModels;\r\n if (models)\r\n for (const model of models)\r\n this._models.push(this.createModel(model));\r\n }\r\n\r\n /** The read-only list of reality models. */\r\n public get models(): ReadonlyArray<ContextRealityModel> {\r\n return this._models;\r\n }\r\n\r\n /** Append a new reality model to the list.\r\n * @param The JSON representation of the reality model.\r\n * @returns the newly-added reality model.\r\n */\r\n public add(props: ContextRealityModelProps): ContextRealityModel {\r\n if (!this._container.contextRealityModels)\r\n this._container.contextRealityModels = [];\r\n\r\n props = ContextRealityModelProps.clone(props);\r\n const model = this.createModel(props);\r\n\r\n this.onChanged.raiseEvent(undefined, model);\r\n\r\n this._models.push(model);\r\n this._container.contextRealityModels.push(props);\r\n\r\n return model;\r\n }\r\n\r\n /** Remove the specified reality model from the list.\r\n * @param model The reality model to remove.\r\n * @returns true if the model was removed, or false if the model was not present in the list.\r\n */\r\n public delete(model: ContextRealityModel): boolean {\r\n const index = this._models.indexOf(model);\r\n if (-1 === index)\r\n return false;\r\n\r\n assert(undefined !== this._container.contextRealityModels);\r\n assert(index < this._container.contextRealityModels.length);\r\n\r\n this.dropEventListeners(model);\r\n this.onChanged.raiseEvent(model, undefined);\r\n\r\n this._models.splice(index, 1);\r\n if (this.models.length === 0)\r\n this._container.contextRealityModels = undefined;\r\n else\r\n this._container.contextRealityModels.splice(index, 1);\r\n\r\n return true;\r\n }\r\n\r\n /** Remove all reality models from the list. */\r\n public clear(): void {\r\n for (const model of this.models) {\r\n this.dropEventListeners(model);\r\n this.onChanged.raiseEvent(model, undefined);\r\n }\r\n\r\n this._container.contextRealityModels = undefined;\r\n this._models.length = 0;\r\n }\r\n\r\n /** Replace a reality model in the list.\r\n * @param toReplace The reality model to be replaced.\r\n * @param replaceWith The JSON representation of the replacement reality model.\r\n * @returns the newly-created reality model that replaced `toReplace`.\r\n * @throws Error if `toReplace` is not present in the list\r\n * @note The replacement occupies the same index in the list as `toReplace` did.\r\n */\r\n public replace(toReplace: ContextRealityModel, replaceWith: ContextRealityModelProps): ContextRealityModel {\r\n const index = this._models.indexOf(toReplace);\r\n if (-1 === index)\r\n throw new Error(\"ContextRealityModel not present in list.\");\r\n\r\n assert(undefined !== this._container.contextRealityModels);\r\n assert(index < this._container.contextRealityModels.length);\r\n\r\n replaceWith = ContextRealityModelProps.clone(replaceWith);\r\n const model = this.createModel(replaceWith);\r\n\r\n this.onChanged.raiseEvent(toReplace, model);\r\n this.dropEventListeners(toReplace);\r\n\r\n this._models[index] = model;\r\n this._container.contextRealityModels[index] = replaceWith;\r\n\r\n return model;\r\n }\r\n\r\n /** Change selected properties of a reality model.\r\n * @param toUpdate The reality model whose properties are to be modified.\r\n * @param updateProps The properties to change.\r\n * @returns The updated reality model, identical to `toUpdate` except for properties explicitly supplied by `updateProps`.\r\n * @throws Error if `toUpdate` is not present in the list.\r\n */\r\n public update(toUpdate: ContextRealityModel, updateProps: Partial<ContextRealityModelProps>): ContextRealityModel {\r\n const props = {\r\n ...toUpdate.toJSON(),\r\n ...updateProps,\r\n };\r\n\r\n // Partial<> makes it possible to pass `undefined` for tilesetUrl...preserve previous URL in that case.\r\n if (undefined === props.tilesetUrl)\r\n props.tilesetUrl = toUpdate.url;\r\n\r\n return this.replace(toUpdate, props);\r\n }\r\n\r\n private createModel(props: ContextRealityModelProps): ContextRealityModel {\r\n const model = this._createModel(props);\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n model.onPlanarClipMaskChanged.addListener(this.handlePlanarClipMaskChanged, this);\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n model.onAppearanceOverridesChanged.addListener(this.handleAppearanceOverridesChanged, this);\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n model.onDisplaySettingsChanged.addListener(this.handleDisplaySettingsChanged, this);\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n model.onInvisibleChanged.addListener(this.handleInvisibleChanged, this);\r\n return model;\r\n }\r\n\r\n private dropEventListeners(model: ContextRealityModel): void {\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n model.onPlanarClipMaskChanged.removeListener(this.handlePlanarClipMaskChanged, this);\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n model.onAppearanceOverridesChanged.removeListener(this.handleAppearanceOverridesChanged, this);\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n model.onDisplaySettingsChanged.removeListener(this.handleDisplaySettingsChanged, this);\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n model.onInvisibleChanged.removeListener(this.handleInvisibleChanged, this);\r\n }\r\n\r\n private handlePlanarClipMaskChanged(mask: PlanarClipMaskSettings | undefined, model: ContextRealityModel): void {\r\n this.onPlanarClipMaskChanged.raiseEvent(model, mask);\r\n }\r\n\r\n private handleAppearanceOverridesChanged(app: FeatureAppearance | undefined, model: ContextRealityModel): void {\r\n this.onAppearanceOverridesChanged.raiseEvent(model, app);\r\n }\r\n\r\n private handleDisplaySettingsChanged(settings: RealityModelDisplaySettings, model: ContextRealityModel): void {\r\n this.onDisplaySettingsChanged.raiseEvent(model, settings);\r\n }\r\n\r\n private handleInvisibleChanged(invisible: boolean, model: ContextRealityModel): void {\r\n this.onInvisibleChanged.raiseEvent(model, invisible);\r\n }\r\n}\r\n"]}
|
|
@@ -137,6 +137,10 @@ export interface ContextRealityModelProps {
|
|
|
137
137
|
* @beta
|
|
138
138
|
*/
|
|
139
139
|
displaySettings?: RealityModelDisplayProps;
|
|
140
|
+
/** See [[ContextRealityModel.invisible]].
|
|
141
|
+
* @beta
|
|
142
|
+
*/
|
|
143
|
+
invisible?: boolean;
|
|
140
144
|
}
|
|
141
145
|
/** @public */
|
|
142
146
|
export declare namespace ContextRealityModelProps {
|
|
@@ -166,6 +170,7 @@ export declare class ContextRealityModel {
|
|
|
166
170
|
readonly description: string;
|
|
167
171
|
/** An optional identifier that, if present, can be used to elide a request to the reality data service. */
|
|
168
172
|
readonly realityDataId?: string;
|
|
173
|
+
private _invisible;
|
|
169
174
|
private readonly _classifiers;
|
|
170
175
|
/** @alpha */
|
|
171
176
|
readonly orbitGtBlob?: Readonly<OrbitGtBlobProps>;
|
|
@@ -181,6 +186,10 @@ export declare class ContextRealityModel {
|
|
|
181
186
|
* @beta
|
|
182
187
|
*/
|
|
183
188
|
readonly onDisplaySettingsChanged: BeEvent<(newSettings: RealityModelDisplaySettings, model: ContextRealityModel) => void>;
|
|
189
|
+
/** Event dispatched just before a model become invisible
|
|
190
|
+
* @beta
|
|
191
|
+
*/
|
|
192
|
+
readonly onInvisibleChanged: BeEvent<(invisible: boolean, model: ContextRealityModel) => void>;
|
|
184
193
|
/** Construct a new context reality model.
|
|
185
194
|
* @param props JSON representation of the reality model, which will be kept in sync with changes made via the ContextRealityModel's methods.
|
|
186
195
|
* @param options Options to customize how the reality model is created.
|
|
@@ -201,6 +210,11 @@ export declare class ContextRealityModel {
|
|
|
201
210
|
*/
|
|
202
211
|
get displaySettings(): RealityModelDisplaySettings;
|
|
203
212
|
set displaySettings(settings: RealityModelDisplaySettings);
|
|
213
|
+
/** If true, reality model is not drawn.
|
|
214
|
+
* @beta
|
|
215
|
+
*/
|
|
216
|
+
get invisible(): boolean;
|
|
217
|
+
set invisible(invisible: boolean);
|
|
204
218
|
/** Convert this model to its JSON representation. */
|
|
205
219
|
toJSON(): ContextRealityModelProps;
|
|
206
220
|
/** Returns true if [[name]] and [[url]] match the specified name and url. */
|
|
@@ -249,6 +263,10 @@ export declare class ContextRealityModels {
|
|
|
249
263
|
* @beta
|
|
250
264
|
*/
|
|
251
265
|
readonly onDisplaySettingsChanged: BeEvent<(model: ContextRealityModel, newSettings: RealityModelDisplaySettings) => void>;
|
|
266
|
+
/** Event dispatched just before [[ContextRealityModel.invisible]] is modified for one of the reality models.
|
|
267
|
+
* @beta
|
|
268
|
+
*/
|
|
269
|
+
readonly onInvisibleChanged: BeEvent<(model: ContextRealityModel, invisible: boolean) => void>;
|
|
252
270
|
/** Event dispatched when a model is [[add]]ed, [[delete]]d, [[replace]]d, or [[update]]d. */
|
|
253
271
|
readonly onChanged: BeEvent<(previousModel: ContextRealityModel | undefined, newModel: ContextRealityModel | undefined) => void>;
|
|
254
272
|
/** Construct a new list of reality models from its JSON representation. The list will be initialized from `container.contextRealityModels` and that JSON representation
|
|
@@ -304,5 +322,6 @@ export declare class ContextRealityModels {
|
|
|
304
322
|
private handlePlanarClipMaskChanged;
|
|
305
323
|
private handleAppearanceOverridesChanged;
|
|
306
324
|
private handleDisplaySettingsChanged;
|
|
325
|
+
private handleInvisibleChanged;
|
|
307
326
|
}
|
|
308
327
|
//# sourceMappingURL=ContextRealityModel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextRealityModel.d.ts","sourceRoot":"","sources":["../../src/ContextRealityModel.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAU,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MA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AAQ,IAAI,IAAI;IAQvB,4CAA4C;IAC5C,IAAW,MAAM,IAAI,aAAa,CAAC,mBAAmB,CAAC,CAEtD;IAED;;;OAGG;IACI,GAAG,CAAC,KAAK,EAAE,wBAAwB,GAAG,mBAAmB;IAehE;;;OAGG;IACI,MAAM,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO;IAoBlD,+CAA+C;IACxC,KAAK,IAAI,IAAI;IAUpB;;;;;;OAMG;IACI,OAAO,CAAC,SAAS,EAAE,mBAAmB,EAAE,WAAW,EAAE,wBAAwB,GAAG,mBAAmB;IAoB1G;;;;;OAKG;IACI,MAAM,CAAC,QAAQ,EAAE,mBAAmB,EAAE,WAAW,EAAE,OAAO,CAAC,wBAAwB,CAAC,GAAG,mBAAmB;IAajH,OAAO,CAAC,WAAW;IAanB,OAAO,CAAC,kBAAkB;IAW1B,OAAO,CAAC,2BAA2B;IAInC,OAAO,CAAC,gCAAgC;IAIxC,OAAO,CAAC,4BAA4B;IAIpC,OAAO,CAAC,sBAAsB;CAG/B"}
|
|
@@ -125,6 +125,8 @@ export var ContextRealityModelProps;
|
|
|
125
125
|
output.planarClipMask = { ...input.planarClipMask };
|
|
126
126
|
if (input.classifiers)
|
|
127
127
|
output.classifiers = input.classifiers.map((x) => { return { ...x, flags: { ...x.flags } }; });
|
|
128
|
+
if (input.invisible)
|
|
129
|
+
output.invisible = input.invisible;
|
|
128
130
|
return output;
|
|
129
131
|
}
|
|
130
132
|
ContextRealityModelProps.clone = clone;
|
|
@@ -149,6 +151,10 @@ export class ContextRealityModel {
|
|
|
149
151
|
* @beta
|
|
150
152
|
*/
|
|
151
153
|
this.onDisplaySettingsChanged = new BeEvent();
|
|
154
|
+
/** Event dispatched just before a model become invisible
|
|
155
|
+
* @beta
|
|
156
|
+
*/
|
|
157
|
+
this.onInvisibleChanged = new BeEvent();
|
|
152
158
|
this._props = props;
|
|
153
159
|
this.rdSourceKey = props.rdSourceKey;
|
|
154
160
|
this.name = props.name ?? "";
|
|
@@ -156,6 +162,7 @@ export class ContextRealityModel {
|
|
|
156
162
|
this.orbitGtBlob = props.orbitGtBlob;
|
|
157
163
|
this.realityDataId = props.realityDataId;
|
|
158
164
|
this.description = props.description ?? "";
|
|
165
|
+
this._invisible = props.invisible ?? false;
|
|
159
166
|
this._appearanceOverrides = props.appearanceOverrides ? FeatureAppearance.fromJSON(props.appearanceOverrides) : undefined;
|
|
160
167
|
this._displaySettings = RealityModelDisplaySettings.fromJSON(props.displaySettings);
|
|
161
168
|
if (props.planarClipMask && props.planarClipMask.mode !== PlanarClipMaskMode.None)
|
|
@@ -206,6 +213,19 @@ export class ContextRealityModel {
|
|
|
206
213
|
this._props.displaySettings = settings.toJSON();
|
|
207
214
|
this._displaySettings = settings;
|
|
208
215
|
}
|
|
216
|
+
/** If true, reality model is not drawn.
|
|
217
|
+
* @beta
|
|
218
|
+
*/
|
|
219
|
+
get invisible() {
|
|
220
|
+
return this._invisible;
|
|
221
|
+
}
|
|
222
|
+
set invisible(invisible) {
|
|
223
|
+
if (invisible !== this.invisible) {
|
|
224
|
+
this.onInvisibleChanged.raiseEvent(invisible, this);
|
|
225
|
+
}
|
|
226
|
+
this._props.invisible = invisible;
|
|
227
|
+
this._invisible = invisible;
|
|
228
|
+
}
|
|
209
229
|
/** Convert this model to its JSON representation. */
|
|
210
230
|
toJSON() {
|
|
211
231
|
return ContextRealityModelProps.clone(this._props);
|
|
@@ -233,6 +253,10 @@ export class ContextRealityModels {
|
|
|
233
253
|
* @beta
|
|
234
254
|
*/
|
|
235
255
|
this.onDisplaySettingsChanged = new BeEvent();
|
|
256
|
+
/** Event dispatched just before [[ContextRealityModel.invisible]] is modified for one of the reality models.
|
|
257
|
+
* @beta
|
|
258
|
+
*/
|
|
259
|
+
this.onInvisibleChanged = new BeEvent();
|
|
236
260
|
/** Event dispatched when a model is [[add]]ed, [[delete]]d, [[replace]]d, or [[update]]d. */
|
|
237
261
|
this.onChanged = new BeEvent();
|
|
238
262
|
let container;
|
|
@@ -353,6 +377,8 @@ export class ContextRealityModels {
|
|
|
353
377
|
model.onAppearanceOverridesChanged.addListener(this.handleAppearanceOverridesChanged, this);
|
|
354
378
|
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
355
379
|
model.onDisplaySettingsChanged.addListener(this.handleDisplaySettingsChanged, this);
|
|
380
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
381
|
+
model.onInvisibleChanged.addListener(this.handleInvisibleChanged, this);
|
|
356
382
|
return model;
|
|
357
383
|
}
|
|
358
384
|
dropEventListeners(model) {
|
|
@@ -362,6 +388,8 @@ export class ContextRealityModels {
|
|
|
362
388
|
model.onAppearanceOverridesChanged.removeListener(this.handleAppearanceOverridesChanged, this);
|
|
363
389
|
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
364
390
|
model.onDisplaySettingsChanged.removeListener(this.handleDisplaySettingsChanged, this);
|
|
391
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
392
|
+
model.onInvisibleChanged.removeListener(this.handleInvisibleChanged, this);
|
|
365
393
|
}
|
|
366
394
|
handlePlanarClipMaskChanged(mask, model) {
|
|
367
395
|
this.onPlanarClipMaskChanged.raiseEvent(model, mask);
|
|
@@ -372,5 +400,8 @@ export class ContextRealityModels {
|
|
|
372
400
|
handleDisplaySettingsChanged(settings, model) {
|
|
373
401
|
this.onDisplaySettingsChanged.raiseEvent(model, settings);
|
|
374
402
|
}
|
|
403
|
+
handleInvisibleChanged(invisible, model) {
|
|
404
|
+
this.onInvisibleChanged.raiseEvent(model, invisible);
|
|
405
|
+
}
|
|
375
406
|
}
|
|
376
407
|
//# sourceMappingURL=ContextRealityModel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextRealityModel.js","sourceRoot":"","sources":["../../src/ContextRealityModel.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,qBAAqB,C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AAC;QACrF,6DAA6D;QAC7D,KAAK,CAAC,4BAA4B,CAAC,cAAc,CAAC,IAAI,CAAC,gCAAgC,EAAE,IAAI,CAAC,CAAC;QAC/F,6DAA6D;QAC7D,KAAK,CAAC,wBAAwB,CAAC,cAAc,CAAC,IAAI,CAAC,4BAA4B,EAAE,IAAI,CAAC,CAAC;IACzF,CAAC;IAEO,2BAA2B,CAAC,IAAwC,EAAE,KAA0B;QACtG,IAAI,CAAC,uBAAuB,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACvD,CAAC;IAEO,gCAAgC,CAAC,GAAkC,EAAE,KAA0B;QACrG,IAAI,CAAC,4BAA4B,CAAC,UAAU,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAC3D,CAAC;IAEO,4BAA4B,CAAC,QAAqC,EAAE,KAA0B;QACpG,IAAI,CAAC,wBAAwB,CAAC,UAAU,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC5D,CAAC;CACF","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/** @packageDocumentation\r\n * @module DisplayStyles\r\n */\r\n\r\nimport { assert, BeEvent } from \"@itwin/core-bentley\";\r\nimport { FeatureAppearance, FeatureAppearanceProps } from \"./FeatureSymbology\";\r\nimport { PlanarClipMaskMode, PlanarClipMaskProps, PlanarClipMaskSettings } from \"./PlanarClipMask\";\r\nimport { SpatialClassifierProps, SpatialClassifiers, SpatialClassifiersContainer } from \"./SpatialClassification\";\r\nimport { RealityModelDisplayProps, RealityModelDisplaySettings } from \"./RealityModelDisplaySettings\";\r\n\r\n/** JSON representation of the blob properties for an OrbitGt property cloud.\r\n * @alpha\r\n */\r\nexport interface OrbitGtBlobProps {\r\n rdsUrl?: string;\r\n containerName: string;\r\n blobFileName: string;\r\n sasToken: string;\r\n accountName: string;\r\n}\r\n\r\n/** Identify the Reality Data service provider\r\n * @beta\r\n */\r\nexport enum RealityDataProvider {\r\n /**\r\n * This is the legacy mode where the access to the 3d tiles is harcoded in ContextRealityModelProps.tilesetUrl property.\r\n * It was use to support RealityMesh3DTiles, Terrain3DTiles, Cesium3DTiles\r\n * You should use other mode when possible\r\n * @see [[RealityDataSource.createKeyFromUrl]] that will try to detect provider from an URL\r\n */\r\n TilesetUrl = \"TilesetUrl\",\r\n /**\r\n * This is the legacy mode where the access to the 3d tiles is harcoded in ContextRealityModelProps.OrbitGtBlob property.\r\n * It was use to support OrbitPointCloud (OPC) from other server than ContextShare\r\n * You should use other mode when possible\r\n * @see [[RealityDataSource.createKeyFromOrbitGtBlobProps]] that will try to detect provider from an URL\r\n */\r\n OrbitGtBlob = \"OrbitGtBlob\",\r\n /**\r\n * Will provide access url from realityDataId and iTwinId on contextShare for 3dTile storage format or OPC storage format\r\n * This provider support all type of 3dTile storage fomat and OrbitPointCloud: RealityMesh3DTiles, Terrain3DTiles, Cesium3DTiles, OPC\r\n * @see [[RealityDataFormat]].\r\n */\r\n ContextShare = \"ContextShare\",\r\n /**\r\n * Will provide Open Street Map Building (OSM) from Cesium Ion (in 3dTile format)\r\n */\r\n CesiumIonAsset = \"CesiumIonAsset\",\r\n}\r\n\r\n/** Identify the Reality Data storage format\r\n * @beta\r\n */\r\nexport enum RealityDataFormat {\r\n /**\r\n * 3dTile supported formats; RealityMesh3DTiles, Terrain3DTiles, Cesium3DTiles\r\n * */\r\n ThreeDTile = \"ThreeDTile\",\r\n /**\r\n * Orbit Point Cloud (OPC) storage format (RealityDataType.OPC)\r\n */\r\n OPC = \"OPC\",\r\n}\r\n\r\n/** Utility function for RealityDataFormat\r\n * @beta\r\n */\r\nexport namespace RealityDataFormat {\r\n /**\r\n * Try to extract the RealityDataFormat from the url\r\n * @param tilesetUrl the reality data attachment url\r\n * @returns the extracted RealityDataFormat or ThreeDTile by default if not found\r\n */\r\n export function fromUrl(tilesetUrl: string): RealityDataFormat {\r\n let format = RealityDataFormat.ThreeDTile;\r\n if (tilesetUrl.includes(\".opc\"))\r\n format = RealityDataFormat.OPC;\r\n return format;\r\n }\r\n}\r\n\r\n/**\r\n * Key used by RealityDataSource to identify provider and reality data format\r\n * This key identify one and only one reality data source on the provider\r\n * @beta\r\n */\r\nexport interface RealityDataSourceKey {\r\n /**\r\n * The provider that supplies the access to reality data source for displaying the reality model\r\n * @see [[RealityDataProvider]] for default supported value;\r\n */\r\n provider: string;\r\n /**\r\n * The format used by the provider to store the reality data\r\n * @see [[RealityDataFormat]] for default supported value;\r\n */\r\n format: string;\r\n /** The reality data id that identify a reality data for the provider */\r\n id: string;\r\n /** The context id that was used when reality data was attached - if none provided, current session iTwinId will be used */\r\n iTwinId?: string;\r\n}\r\n/**\r\n * RealityDataSourceKey utility functions\r\n * @beta */\r\nexport namespace RealityDataSourceKey {\r\n /** Utility function to convert a RealityDataSourceKey into its string representation */\r\n export function convertToString(rdSourceKey: RealityDataSourceKey): string {\r\n return `${rdSourceKey.provider}:${rdSourceKey.format}:${rdSourceKey.id}:${rdSourceKey?.iTwinId}`;\r\n }\r\n /** Utility function to compare two RealityDataSourceKey, we consider it equal even if itwinId is different */\r\n export function isEqual(key1: RealityDataSourceKey, key2: RealityDataSourceKey): boolean {\r\n if ((key1.provider === RealityDataProvider.CesiumIonAsset) && key2.provider === RealityDataProvider.CesiumIonAsset)\r\n return true; // ignore other properties for CesiumIonAsset, id is hidden\r\n if ((key1.provider === key2.provider) && (key1.format === key2.format) && (key1.id === key2.id)) {\r\n // && (key1?.iTwinId === key2?.iTwinId)) -> ignore iTwinId, consider it is the same reality data\r\n return true;\r\n }\r\n return false;\r\n }\r\n}\r\n\r\n/** JSON representation of the reality data reference attachment properties.\r\n * @beta\r\n*/\r\nexport interface RealityDataSourceProps {\r\n /** The source key that identify a reality data for the provider. */\r\n sourceKey: RealityDataSourceKey;\r\n}\r\n\r\n/** JSON representation of a [[ContextRealityModel]].\r\n * @public\r\n * @extensions\r\n */\r\nexport interface ContextRealityModelProps {\r\n /** See [[ContextRealityModel.rdSourceKey]].\r\n * @beta\r\n */\r\n rdSourceKey?: RealityDataSourceKey;\r\n /** The URL that supplies the 3d tiles for displaying the reality model. */\r\n tilesetUrl: string;\r\n /** See [[ContextRealityModel.orbitGtBlob]].\r\n * @alpha\r\n */\r\n orbitGtBlob?: OrbitGtBlobProps;\r\n /** See [[ContextRealityModel.realityDataId]]. */\r\n realityDataId?: string;\r\n /** An optional, user-friendly name for the reality model suitable for display in a user interface. */\r\n name?: string;\r\n /** An optional, user-friendly description of the reality model suitable for display in a user interface. */\r\n description?: string;\r\n /** See [[ContextRealityModel.classifiers]]. */\r\n classifiers?: SpatialClassifierProps[];\r\n /** See [[ContextRealityModel.planarClipMask]]. */\r\n planarClipMask?: PlanarClipMaskProps;\r\n /** See [[ContextRealityModel.appearanceOverrides]]. */\r\n appearanceOverrides?: FeatureAppearanceProps;\r\n /** See [[ContextRealityModel.displaySettings]].\r\n * @beta\r\n */\r\n displaySettings?: RealityModelDisplayProps;\r\n}\r\n\r\n/** @public */\r\nexport namespace ContextRealityModelProps {\r\n /** Produce a deep copy of `input`. */\r\n export function clone(input: ContextRealityModelProps): ContextRealityModelProps {\r\n // Spread operator is shallow, and includes `undefined` properties and empty strings.\r\n // We want to make deep copies, omit undefined properties and empty strings, and require tilesetUrl to be defined.\r\n const output: ContextRealityModelProps = { tilesetUrl: input.tilesetUrl ?? \"\" };\r\n\r\n if (input.rdSourceKey)\r\n output.rdSourceKey = { ...input.rdSourceKey };\r\n\r\n if (input.name)\r\n output.name = input.name;\r\n\r\n if (input.realityDataId)\r\n output.realityDataId = input.realityDataId;\r\n\r\n if (input.description)\r\n output.description = input.description;\r\n\r\n if (input.orbitGtBlob)\r\n output.orbitGtBlob = { ...input.orbitGtBlob };\r\n\r\n if (input.appearanceOverrides) {\r\n output.appearanceOverrides = { ...input.appearanceOverrides };\r\n if (input.appearanceOverrides.rgb)\r\n output.appearanceOverrides.rgb = { ...input.appearanceOverrides.rgb };\r\n }\r\n\r\n if (input.displaySettings) {\r\n output.displaySettings = { ...input.displaySettings };\r\n if (input.displaySettings.pointCloud)\r\n output.displaySettings.pointCloud = { ...output.displaySettings.pointCloud };\r\n }\r\n\r\n if (input.planarClipMask)\r\n output.planarClipMask = { ...input.planarClipMask };\r\n\r\n if (input.classifiers)\r\n output.classifiers = input.classifiers.map((x) => { return { ...x, flags: { ...x.flags } }; });\r\n\r\n return output;\r\n }\r\n}\r\n\r\n/** A reality model not associated with a [GeometricModel]($backend) but instead defined in a [DisplayStyle]($backend) or [DisplayStyleState]($frontend).\r\n * Such reality models are displayed to provide context to the view and can be freely attached and detached at display time.\r\n * @see [this interactive example](https://www.itwinjs.org/sample-showcase/?group=Viewer&sample=reality-data-sample)\r\n * @see [[DisplayStyleSettings.contextRealityModels]] to define context reality models for a display style.\r\n * @public\r\n */\r\nexport class ContextRealityModel {\r\n /** @internal */\r\n protected readonly _props: ContextRealityModelProps;\r\n /**\r\n * The reality data source key identify the reality data provider and storage format.\r\n * It takes precedence over tilesetUrl and orbitGtBlob when present and can be use to actually replace these properties.\r\n * @beta\r\n */\r\n public readonly rdSourceKey?: RealityDataSourceKey;\r\n /** A name suitable for display in a user interface. By default, an empty string. */\r\n public readonly name: string;\r\n /** The URL that supplies the 3d tiles for displaying the reality model. */\r\n public readonly url: string;\r\n /** A description of the model suitable for display in a user interface. By default, an empty string. */\r\n public readonly description: string;\r\n /** An optional identifier that, if present, can be used to elide a request to the reality data service. */\r\n public readonly realityDataId?: string;\r\n private readonly _classifiers: SpatialClassifiers;\r\n /** @alpha */\r\n public readonly orbitGtBlob?: Readonly<OrbitGtBlobProps>;\r\n protected _appearanceOverrides?: FeatureAppearance;\r\n /** @beta */\r\n protected _displaySettings: RealityModelDisplaySettings;\r\n protected _planarClipMask?: PlanarClipMaskSettings;\r\n /** Event dispatched just before assignment to [[planarClipMaskSettings]]. */\r\n public readonly onPlanarClipMaskChanged = new BeEvent<(newSettings: PlanarClipMaskSettings | undefined, model: ContextRealityModel) => void>();\r\n /** Event dispatched just before assignment to [[appearanceOverrides]]. */\r\n public readonly onAppearanceOverridesChanged = new BeEvent<(newOverrides: FeatureAppearance | undefined, model: ContextRealityModel) => void>();\r\n /** Event dispatched just before assignment to [[displaySettings]].\r\n * @beta\r\n */\r\n public readonly onDisplaySettingsChanged = new BeEvent<(newSettings: RealityModelDisplaySettings, model: ContextRealityModel) => void>();\r\n\r\n /** Construct a new context reality model.\r\n * @param props JSON representation of the reality model, which will be kept in sync with changes made via the ContextRealityModel's methods.\r\n * @param options Options to customize how the reality model is created.\r\n */\r\n public constructor(props: ContextRealityModelProps, options?: { createClassifiers: (container: SpatialClassifiersContainer) => SpatialClassifiers }) {\r\n this._props = props;\r\n this.rdSourceKey = props.rdSourceKey;\r\n this.name = props.name ?? \"\";\r\n this.url = props.tilesetUrl ?? \"\";\r\n this.orbitGtBlob = props.orbitGtBlob;\r\n this.realityDataId = props.realityDataId;\r\n this.description = props.description ?? \"\";\r\n this._appearanceOverrides = props.appearanceOverrides ? FeatureAppearance.fromJSON(props.appearanceOverrides) : undefined;\r\n this._displaySettings = RealityModelDisplaySettings.fromJSON(props.displaySettings);\r\n\r\n if (props.planarClipMask && props.planarClipMask.mode !== PlanarClipMaskMode.None)\r\n this._planarClipMask = PlanarClipMaskSettings.fromJSON(props.planarClipMask);\r\n\r\n if (options?.createClassifiers) {\r\n this._classifiers = options.createClassifiers(props);\r\n } else {\r\n this._classifiers = new SpatialClassifiers(props);\r\n }\r\n }\r\n\r\n /** A set of [[SpatialClassifier]]s, of which one at any given time can be used to classify the reality model. */\r\n public get classifiers(): SpatialClassifiers {\r\n return this._classifiers;\r\n }\r\n\r\n /** Optionally describes how the geometry of the reality model can be masked by other models. */\r\n public get planarClipMaskSettings(): PlanarClipMaskSettings | undefined {\r\n return this._planarClipMask;\r\n }\r\n public set planarClipMaskSettings(settings: PlanarClipMaskSettings | undefined) {\r\n this.onPlanarClipMaskChanged.raiseEvent(settings, this);\r\n if (!settings)\r\n delete this._props.planarClipMask;\r\n else\r\n this._props.planarClipMask = settings.toJSON();\r\n\r\n this._planarClipMask = settings;\r\n }\r\n\r\n /** Overrides applied to the appearance of the reality model. Only the rgb, transparency, nonLocatable, and emphasized properties are applicable - the rest are ignored. */\r\n public get appearanceOverrides(): FeatureAppearance | undefined {\r\n return this._appearanceOverrides;\r\n }\r\n public set appearanceOverrides(overrides: FeatureAppearance | undefined) {\r\n this.onAppearanceOverridesChanged.raiseEvent(overrides, this);\r\n if (!overrides)\r\n delete this._props.appearanceOverrides;\r\n else\r\n this._props.appearanceOverrides = overrides.toJSON();\r\n\r\n this._appearanceOverrides = overrides;\r\n }\r\n\r\n /** Settings controlling how this reality model is displayed in a [Viewport]($frontend).\r\n * @beta\r\n */\r\n public get displaySettings(): RealityModelDisplaySettings {\r\n return this._displaySettings;\r\n }\r\n public set displaySettings(settings: RealityModelDisplaySettings) {\r\n this.onDisplaySettingsChanged.raiseEvent(settings, this);\r\n this._props.displaySettings = settings.toJSON();\r\n this._displaySettings = settings;\r\n }\r\n\r\n /** Convert this model to its JSON representation. */\r\n public toJSON(): ContextRealityModelProps {\r\n return ContextRealityModelProps.clone(this._props);\r\n }\r\n\r\n /** Returns true if [[name]] and [[url]] match the specified name and url. */\r\n public matchesNameAndUrl(name: string, url: string): boolean {\r\n return this.name === name && this.url === url;\r\n }\r\n}\r\n\r\n/** An object that can store the JSON representation of a list of [[ContextRealityModel]]s.\r\n * @see [[ContextRealityModels]].\r\n * @see [[DisplayStyleSettingsProps.contextRealityModels]].\r\n * @public\r\n * @extensions\r\n */\r\nexport interface ContextRealityModelsContainer {\r\n /** The list of reality models. */\r\n contextRealityModels?: ContextRealityModelProps[];\r\n /** @internal used for type discrimination with ContextRealityModelsArgs. */\r\n container?: never;\r\n}\r\n\r\n/** Arguments supplied to the constructor of [[ContextRealityModels]].\r\n * @public\r\n */\r\nexport interface ContextRealityModelsArgs {\r\n /** The object that holds the JSON representation of the list of context reality models. */\r\n container: ContextRealityModelsContainer;\r\n /** Optional function used to instantiate each [[ContextRealityModel]] in the list. */\r\n createContextRealityModel?: (props: ContextRealityModelProps) => ContextRealityModel;\r\n /** If true, the list will not be populated by the constructor. Instead, the caller is responsible for calling [[ContextRealityModels.populate]] exactly once after construction.\r\n * This is chiefly intended for use internally by the [DisplayStyleState]($frontend) constructor.\r\n */\r\n deferPopulating?: boolean;\r\n}\r\n\r\n/** A list of [[ContextRealityModel]]s attached to a [[DisplayStyleSettings]]. The list may be presented to the user with the name and description of each model.\r\n * The list is automatically synchronized with the underlying JSON representation provided by the input [[ContextRealityModelsContainer]].\r\n * @see [this interactive example](https://www.itwinjs.org/sample-showcase/?group=Viewer&sample=reality-data-sample)\r\n * @see [[DisplayStyleSettings.contextRealityModels]].\r\n * @public\r\n */\r\nexport class ContextRealityModels {\r\n private readonly _container: ContextRealityModelsContainer;\r\n private readonly _createModel: (props: ContextRealityModelProps) => ContextRealityModel;\r\n private readonly _models: ContextRealityModel[] = [];\r\n /** Event dispatched just before [[ContextRealityModel.planarClipMaskSettings]] is modified for one of the reality models. */\r\n public readonly onPlanarClipMaskChanged = new BeEvent<(model: ContextRealityModel, newSettings: PlanarClipMaskSettings | undefined) => void>();\r\n /** Event dispatched just before [[ContextRealityModel.appearanceOverrides]] is modified for one of the reality models. */\r\n public readonly onAppearanceOverridesChanged = new BeEvent<(model: ContextRealityModel, newOverrides: FeatureAppearance | undefined) => void>();\r\n /** Event dispatched just before [[ContextRealityModel.displaySettings]] is modified for one of the reality models.\r\n * @beta\r\n */\r\n public readonly onDisplaySettingsChanged = new BeEvent<(model: ContextRealityModel, newSettings: RealityModelDisplaySettings) => void>();\r\n /** Event dispatched when a model is [[add]]ed, [[delete]]d, [[replace]]d, or [[update]]d. */\r\n public readonly onChanged = new BeEvent<(previousModel: ContextRealityModel | undefined, newModel: ContextRealityModel | undefined) => void>();\r\n\r\n /** Construct a new list of reality models from its JSON representation. The list will be initialized from `container.contextRealityModels` and that JSON representation\r\n * will be kept in sync with changes made to the list. The caller should not directly modify `container.contextRealityModels` or its contents as that will cause the list\r\n * to become out of sync with the JSON representation.\r\n * @param container The object that holds the JSON representation of the list.\r\n * @param createContextRealityModel Optional function used to instantiate each [[ContextRealityModel]] in the list.\r\n */\r\n public constructor(container: ContextRealityModelsContainer, createContextRealityModel?: (props: ContextRealityModelProps) => ContextRealityModel);\r\n\r\n /** Construct a new list of reality models from its JSON representation. The list will be initialized from `args.container.contextRealityModels` and that JSON representation\r\n * will be kept in sync with changes made to the list. The caller should not directly modify `container.contextRealityModels` or its contents as that will cause the list\r\n * to become out of sync with the JSON representation.\r\n * @param args Specifies the container and optionally customizes how the list of models is populated.\r\n */\r\n public constructor(args: ContextRealityModelsArgs);\r\n\r\n /** @internal */\r\n public constructor(arg0: ContextRealityModelsContainer | ContextRealityModelsArgs, createContextRealityModel?: (props: ContextRealityModelProps) => ContextRealityModel) {\r\n let container: ContextRealityModelsContainer;\r\n let defer = false;\r\n if (arg0.container) {\r\n container = arg0.container;\r\n createContextRealityModel = arg0.createContextRealityModel;\r\n defer = true === arg0.deferPopulating;\r\n } else {\r\n container = arg0;\r\n }\r\n\r\n this._container = container;\r\n this._createModel = createContextRealityModel ?? ((props) => new ContextRealityModel(props));\r\n\r\n if (!defer)\r\n this.populate();\r\n }\r\n\r\n /** @internal needs to be invoked after DisplayStyleSettings constructor by DisplayStyleState constructor.*/\r\n /** Populate the list of [[models]] from the container that was supplied to the constructor.\r\n * This should only be invoked once, and only if [[ContextRealityModelsArgs.deferPopulating]] was specified as `true` when calling the constructor.\r\n * @public\r\n */\r\n public populate(): void {\r\n assert(this._models.length === 0, \"do not call ContextRealityModels.populate more than once\");\r\n const models = this._container.contextRealityModels;\r\n if (models)\r\n for (const model of models)\r\n this._models.push(this.createModel(model));\r\n }\r\n\r\n /** The read-only list of reality models. */\r\n public get models(): ReadonlyArray<ContextRealityModel> {\r\n return this._models;\r\n }\r\n\r\n /** Append a new reality model to the list.\r\n * @param The JSON representation of the reality model.\r\n * @returns the newly-added reality model.\r\n */\r\n public add(props: ContextRealityModelProps): ContextRealityModel {\r\n if (!this._container.contextRealityModels)\r\n this._container.contextRealityModels = [];\r\n\r\n props = ContextRealityModelProps.clone(props);\r\n const model = this.createModel(props);\r\n\r\n this.onChanged.raiseEvent(undefined, model);\r\n\r\n this._models.push(model);\r\n this._container.contextRealityModels.push(props);\r\n\r\n return model;\r\n }\r\n\r\n /** Remove the specified reality model from the list.\r\n * @param model The reality model to remove.\r\n * @returns true if the model was removed, or false if the model was not present in the list.\r\n */\r\n public delete(model: ContextRealityModel): boolean {\r\n const index = this._models.indexOf(model);\r\n if (-1 === index)\r\n return false;\r\n\r\n assert(undefined !== this._container.contextRealityModels);\r\n assert(index < this._container.contextRealityModels.length);\r\n\r\n this.dropEventListeners(model);\r\n this.onChanged.raiseEvent(model, undefined);\r\n\r\n this._models.splice(index, 1);\r\n if (this.models.length === 0)\r\n this._container.contextRealityModels = undefined;\r\n else\r\n this._container.contextRealityModels.splice(index, 1);\r\n\r\n return true;\r\n }\r\n\r\n /** Remove all reality models from the list. */\r\n public clear(): void {\r\n for (const model of this.models) {\r\n this.dropEventListeners(model);\r\n this.onChanged.raiseEvent(model, undefined);\r\n }\r\n\r\n this._container.contextRealityModels = undefined;\r\n this._models.length = 0;\r\n }\r\n\r\n /** Replace a reality model in the list.\r\n * @param toReplace The reality model to be replaced.\r\n * @param replaceWith The JSON representation of the replacement reality model.\r\n * @returns the newly-created reality model that replaced `toReplace`.\r\n * @throws Error if `toReplace` is not present in the list\r\n * @note The replacement occupies the same index in the list as `toReplace` did.\r\n */\r\n public replace(toReplace: ContextRealityModel, replaceWith: ContextRealityModelProps): ContextRealityModel {\r\n const index = this._models.indexOf(toReplace);\r\n if (-1 === index)\r\n throw new Error(\"ContextRealityModel not present in list.\");\r\n\r\n assert(undefined !== this._container.contextRealityModels);\r\n assert(index < this._container.contextRealityModels.length);\r\n\r\n replaceWith = ContextRealityModelProps.clone(replaceWith);\r\n const model = this.createModel(replaceWith);\r\n\r\n this.onChanged.raiseEvent(toReplace, model);\r\n this.dropEventListeners(toReplace);\r\n\r\n this._models[index] = model;\r\n this._container.contextRealityModels[index] = replaceWith;\r\n\r\n return model;\r\n }\r\n\r\n /** Change selected properties of a reality model.\r\n * @param toUpdate The reality model whose properties are to be modified.\r\n * @param updateProps The properties to change.\r\n * @returns The updated reality model, identical to `toUpdate` except for properties explicitly supplied by `updateProps`.\r\n * @throws Error if `toUpdate` is not present in the list.\r\n */\r\n public update(toUpdate: ContextRealityModel, updateProps: Partial<ContextRealityModelProps>): ContextRealityModel {\r\n const props = {\r\n ...toUpdate.toJSON(),\r\n ...updateProps,\r\n };\r\n\r\n // Partial<> makes it possible to pass `undefined` for tilesetUrl...preserve previous URL in that case.\r\n if (undefined === props.tilesetUrl)\r\n props.tilesetUrl = toUpdate.url;\r\n\r\n return this.replace(toUpdate, props);\r\n }\r\n\r\n private createModel(props: ContextRealityModelProps): ContextRealityModel {\r\n const model = this._createModel(props);\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n model.onPlanarClipMaskChanged.addListener(this.handlePlanarClipMaskChanged, this);\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n model.onAppearanceOverridesChanged.addListener(this.handleAppearanceOverridesChanged, this);\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n model.onDisplaySettingsChanged.addListener(this.handleDisplaySettingsChanged, this);\r\n return model;\r\n }\r\n\r\n private dropEventListeners(model: ContextRealityModel): void {\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n model.onPlanarClipMaskChanged.removeListener(this.handlePlanarClipMaskChanged, this);\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n model.onAppearanceOverridesChanged.removeListener(this.handleAppearanceOverridesChanged, this);\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n model.onDisplaySettingsChanged.removeListener(this.handleDisplaySettingsChanged, this);\r\n }\r\n\r\n private handlePlanarClipMaskChanged(mask: PlanarClipMaskSettings | undefined, model: ContextRealityModel): void {\r\n this.onPlanarClipMaskChanged.raiseEvent(model, mask);\r\n }\r\n\r\n private handleAppearanceOverridesChanged(app: FeatureAppearance | undefined, model: ContextRealityModel): void {\r\n this.onAppearanceOverridesChanged.raiseEvent(model, app);\r\n }\r\n\r\n private handleDisplaySettingsChanged(settings: RealityModelDisplaySettings, model: ContextRealityModel): void {\r\n this.onDisplaySettingsChanged.raiseEvent(model, settings);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"ContextRealityModel.js","sourceRoot":"","sources":["../../src/ContextRealityModel.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAA0B,MAAM,oBAAoB,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAuB,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AACnG,OAAO,EAA0B,kBAAkB,EAA+B,MAAM,yBAAyB,CAAC;AAClH,OAAO,EAA4B,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAatG;;GAEG;AACH,MAAM,CAAN,IAAY,mBAyBX;AAzBD,WAAY,mBAAmB;IAC7B;;;;;OAKG;IACH,gDAAyB,CAAA;IACzB;;;;;OAKG;IACH,kDAA2B,CAAA;IAC3B;;;;OAIG;IACH,oDAA6B,CAAA;IAC7B;;OAEG;IACH,wDAAiC,CAAA;AACnC,CAAC,EAzBW,mBAAmB,KAAnB,mBAAmB,QAyB9B;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,iBASX;AATD,WAAY,iBAAiB;IAC3B;;SAEK;IACL,8CAAyB,CAAA;IACzB;;MAEE;IACF,gCAAW,CAAA;AACb,CAAC,EATW,iBAAiB,KAAjB,iBAAiB,QAS5B;AAED;;GAEG;AACH,WAAiB,iBAAiB;IAChC;;;;OA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E,IAAI,CAAC,CAAC;QACrF,6DAA6D;QAC7D,KAAK,CAAC,4BAA4B,CAAC,cAAc,CAAC,IAAI,CAAC,gCAAgC,EAAE,IAAI,CAAC,CAAC;QAC/F,6DAA6D;QAC7D,KAAK,CAAC,wBAAwB,CAAC,cAAc,CAAC,IAAI,CAAC,4BAA4B,EAAE,IAAI,CAAC,CAAC;QACvF,6DAA6D;QAC7D,KAAK,CAAC,kBAAkB,CAAC,cAAc,CAAC,IAAI,CAAC,sBAAsB,EAAE,IAAI,CAAC,CAAC;IAC7E,CAAC;IAEO,2BAA2B,CAAC,IAAwC,EAAE,KAA0B;QACtG,IAAI,CAAC,uBAAuB,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACvD,CAAC;IAEO,gCAAgC,CAAC,GAAkC,EAAE,KAA0B;QACrG,IAAI,CAAC,4BAA4B,CAAC,UAAU,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAC3D,CAAC;IAEO,4BAA4B,CAAC,QAAqC,EAAE,KAA0B;QACpG,IAAI,CAAC,wBAAwB,CAAC,UAAU,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC5D,CAAC;IAEO,sBAAsB,CAAC,SAAkB,EAAE,KAA0B;QAC3E,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IACvD,CAAC;CACF","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/** @packageDocumentation\r\n * @module DisplayStyles\r\n */\r\n\r\nimport { assert, BeEvent } from \"@itwin/core-bentley\";\r\nimport { FeatureAppearance, FeatureAppearanceProps } from \"./FeatureSymbology\";\r\nimport { PlanarClipMaskMode, PlanarClipMaskProps, PlanarClipMaskSettings } from \"./PlanarClipMask\";\r\nimport { SpatialClassifierProps, SpatialClassifiers, SpatialClassifiersContainer } from \"./SpatialClassification\";\r\nimport { RealityModelDisplayProps, RealityModelDisplaySettings } from \"./RealityModelDisplaySettings\";\r\n\r\n/** JSON representation of the blob properties for an OrbitGt property cloud.\r\n * @alpha\r\n */\r\nexport interface OrbitGtBlobProps {\r\n rdsUrl?: string;\r\n containerName: string;\r\n blobFileName: string;\r\n sasToken: string;\r\n accountName: string;\r\n}\r\n\r\n/** Identify the Reality Data service provider\r\n * @beta\r\n */\r\nexport enum RealityDataProvider {\r\n /**\r\n * This is the legacy mode where the access to the 3d tiles is harcoded in ContextRealityModelProps.tilesetUrl property.\r\n * It was use to support RealityMesh3DTiles, Terrain3DTiles, Cesium3DTiles\r\n * You should use other mode when possible\r\n * @see [[RealityDataSource.createKeyFromUrl]] that will try to detect provider from an URL\r\n */\r\n TilesetUrl = \"TilesetUrl\",\r\n /**\r\n * This is the legacy mode where the access to the 3d tiles is harcoded in ContextRealityModelProps.OrbitGtBlob property.\r\n * It was use to support OrbitPointCloud (OPC) from other server than ContextShare\r\n * You should use other mode when possible\r\n * @see [[RealityDataSource.createKeyFromOrbitGtBlobProps]] that will try to detect provider from an URL\r\n */\r\n OrbitGtBlob = \"OrbitGtBlob\",\r\n /**\r\n * Will provide access url from realityDataId and iTwinId on contextShare for 3dTile storage format or OPC storage format\r\n * This provider support all type of 3dTile storage fomat and OrbitPointCloud: RealityMesh3DTiles, Terrain3DTiles, Cesium3DTiles, OPC\r\n * @see [[RealityDataFormat]].\r\n */\r\n ContextShare = \"ContextShare\",\r\n /**\r\n * Will provide Open Street Map Building (OSM) from Cesium Ion (in 3dTile format)\r\n */\r\n CesiumIonAsset = \"CesiumIonAsset\",\r\n}\r\n\r\n/** Identify the Reality Data storage format\r\n * @beta\r\n */\r\nexport enum RealityDataFormat {\r\n /**\r\n * 3dTile supported formats; RealityMesh3DTiles, Terrain3DTiles, Cesium3DTiles\r\n * */\r\n ThreeDTile = \"ThreeDTile\",\r\n /**\r\n * Orbit Point Cloud (OPC) storage format (RealityDataType.OPC)\r\n */\r\n OPC = \"OPC\",\r\n}\r\n\r\n/** Utility function for RealityDataFormat\r\n * @beta\r\n */\r\nexport namespace RealityDataFormat {\r\n /**\r\n * Try to extract the RealityDataFormat from the url\r\n * @param tilesetUrl the reality data attachment url\r\n * @returns the extracted RealityDataFormat or ThreeDTile by default if not found\r\n */\r\n export function fromUrl(tilesetUrl: string): RealityDataFormat {\r\n let format = RealityDataFormat.ThreeDTile;\r\n if (tilesetUrl.includes(\".opc\"))\r\n format = RealityDataFormat.OPC;\r\n return format;\r\n }\r\n}\r\n\r\n/**\r\n * Key used by RealityDataSource to identify provider and reality data format\r\n * This key identify one and only one reality data source on the provider\r\n * @beta\r\n */\r\nexport interface RealityDataSourceKey {\r\n /**\r\n * The provider that supplies the access to reality data source for displaying the reality model\r\n * @see [[RealityDataProvider]] for default supported value;\r\n */\r\n provider: string;\r\n /**\r\n * The format used by the provider to store the reality data\r\n * @see [[RealityDataFormat]] for default supported value;\r\n */\r\n format: string;\r\n /** The reality data id that identify a reality data for the provider */\r\n id: string;\r\n /** The context id that was used when reality data was attached - if none provided, current session iTwinId will be used */\r\n iTwinId?: string;\r\n}\r\n/**\r\n * RealityDataSourceKey utility functions\r\n * @beta */\r\nexport namespace RealityDataSourceKey {\r\n /** Utility function to convert a RealityDataSourceKey into its string representation */\r\n export function convertToString(rdSourceKey: RealityDataSourceKey): string {\r\n return `${rdSourceKey.provider}:${rdSourceKey.format}:${rdSourceKey.id}:${rdSourceKey?.iTwinId}`;\r\n }\r\n /** Utility function to compare two RealityDataSourceKey, we consider it equal even if itwinId is different */\r\n export function isEqual(key1: RealityDataSourceKey, key2: RealityDataSourceKey): boolean {\r\n if ((key1.provider === RealityDataProvider.CesiumIonAsset) && key2.provider === RealityDataProvider.CesiumIonAsset)\r\n return true; // ignore other properties for CesiumIonAsset, id is hidden\r\n if ((key1.provider === key2.provider) && (key1.format === key2.format) && (key1.id === key2.id)) {\r\n // && (key1?.iTwinId === key2?.iTwinId)) -> ignore iTwinId, consider it is the same reality data\r\n return true;\r\n }\r\n return false;\r\n }\r\n}\r\n\r\n/** JSON representation of the reality data reference attachment properties.\r\n * @beta\r\n*/\r\nexport interface RealityDataSourceProps {\r\n /** The source key that identify a reality data for the provider. */\r\n sourceKey: RealityDataSourceKey;\r\n}\r\n\r\n/** JSON representation of a [[ContextRealityModel]].\r\n * @public\r\n * @extensions\r\n */\r\nexport interface ContextRealityModelProps {\r\n /** See [[ContextRealityModel.rdSourceKey]].\r\n * @beta\r\n */\r\n rdSourceKey?: RealityDataSourceKey;\r\n /** The URL that supplies the 3d tiles for displaying the reality model. */\r\n tilesetUrl: string;\r\n /** See [[ContextRealityModel.orbitGtBlob]].\r\n * @alpha\r\n */\r\n orbitGtBlob?: OrbitGtBlobProps;\r\n /** See [[ContextRealityModel.realityDataId]]. */\r\n realityDataId?: string;\r\n /** An optional, user-friendly name for the reality model suitable for display in a user interface. */\r\n name?: string;\r\n /** An optional, user-friendly description of the reality model suitable for display in a user interface. */\r\n description?: string;\r\n /** See [[ContextRealityModel.classifiers]]. */\r\n classifiers?: SpatialClassifierProps[];\r\n /** See [[ContextRealityModel.planarClipMask]]. */\r\n planarClipMask?: PlanarClipMaskProps;\r\n /** See [[ContextRealityModel.appearanceOverrides]]. */\r\n appearanceOverrides?: FeatureAppearanceProps;\r\n /** See [[ContextRealityModel.displaySettings]].\r\n * @beta\r\n */\r\n displaySettings?: RealityModelDisplayProps;\r\n /** See [[ContextRealityModel.invisible]].\r\n * @beta\r\n */\r\n invisible?: boolean;\r\n}\r\n\r\n/** @public */\r\nexport namespace ContextRealityModelProps {\r\n /** Produce a deep copy of `input`. */\r\n export function clone(input: ContextRealityModelProps): ContextRealityModelProps {\r\n // Spread operator is shallow, and includes `undefined` properties and empty strings.\r\n // We want to make deep copies, omit undefined properties and empty strings, and require tilesetUrl to be defined.\r\n const output: ContextRealityModelProps = { tilesetUrl: input.tilesetUrl ?? \"\" };\r\n\r\n if (input.rdSourceKey)\r\n output.rdSourceKey = { ...input.rdSourceKey };\r\n\r\n if (input.name)\r\n output.name = input.name;\r\n\r\n if (input.realityDataId)\r\n output.realityDataId = input.realityDataId;\r\n\r\n if (input.description)\r\n output.description = input.description;\r\n\r\n if (input.orbitGtBlob)\r\n output.orbitGtBlob = { ...input.orbitGtBlob };\r\n\r\n if (input.appearanceOverrides) {\r\n output.appearanceOverrides = { ...input.appearanceOverrides };\r\n if (input.appearanceOverrides.rgb)\r\n output.appearanceOverrides.rgb = { ...input.appearanceOverrides.rgb };\r\n }\r\n\r\n if (input.displaySettings) {\r\n output.displaySettings = { ...input.displaySettings };\r\n if (input.displaySettings.pointCloud)\r\n output.displaySettings.pointCloud = { ...output.displaySettings.pointCloud };\r\n }\r\n\r\n if (input.planarClipMask)\r\n output.planarClipMask = { ...input.planarClipMask };\r\n\r\n if (input.classifiers)\r\n output.classifiers = input.classifiers.map((x) => { return { ...x, flags: { ...x.flags } }; });\r\n\r\n if (input.invisible)\r\n output.invisible = input.invisible;\r\n\r\n return output;\r\n }\r\n}\r\n\r\n/** A reality model not associated with a [GeometricModel]($backend) but instead defined in a [DisplayStyle]($backend) or [DisplayStyleState]($frontend).\r\n * Such reality models are displayed to provide context to the view and can be freely attached and detached at display time.\r\n * @see [this interactive example](https://www.itwinjs.org/sample-showcase/?group=Viewer&sample=reality-data-sample)\r\n * @see [[DisplayStyleSettings.contextRealityModels]] to define context reality models for a display style.\r\n * @public\r\n */\r\nexport class ContextRealityModel {\r\n /** @internal */\r\n protected readonly _props: ContextRealityModelProps;\r\n /**\r\n * The reality data source key identify the reality data provider and storage format.\r\n * It takes precedence over tilesetUrl and orbitGtBlob when present and can be use to actually replace these properties.\r\n * @beta\r\n */\r\n public readonly rdSourceKey?: RealityDataSourceKey;\r\n /** A name suitable for display in a user interface. By default, an empty string. */\r\n public readonly name: string;\r\n /** The URL that supplies the 3d tiles for displaying the reality model. */\r\n public readonly url: string;\r\n /** A description of the model suitable for display in a user interface. By default, an empty string. */\r\n public readonly description: string;\r\n /** An optional identifier that, if present, can be used to elide a request to the reality data service. */\r\n public readonly realityDataId?: string;\r\n\r\n private _invisible: boolean;\r\n private readonly _classifiers: SpatialClassifiers;\r\n /** @alpha */\r\n public readonly orbitGtBlob?: Readonly<OrbitGtBlobProps>;\r\n protected _appearanceOverrides?: FeatureAppearance;\r\n /** @beta */\r\n protected _displaySettings: RealityModelDisplaySettings;\r\n protected _planarClipMask?: PlanarClipMaskSettings;\r\n /** Event dispatched just before assignment to [[planarClipMaskSettings]]. */\r\n public readonly onPlanarClipMaskChanged = new BeEvent<(newSettings: PlanarClipMaskSettings | undefined, model: ContextRealityModel) => void>();\r\n /** Event dispatched just before assignment to [[appearanceOverrides]]. */\r\n public readonly onAppearanceOverridesChanged = new BeEvent<(newOverrides: FeatureAppearance | undefined, model: ContextRealityModel) => void>();\r\n /** Event dispatched just before assignment to [[displaySettings]].\r\n * @beta\r\n */\r\n public readonly onDisplaySettingsChanged = new BeEvent<(newSettings: RealityModelDisplaySettings, model: ContextRealityModel) => void>();\r\n /** Event dispatched just before a model become invisible\r\n * @beta\r\n */\r\n public readonly onInvisibleChanged = new BeEvent<(invisible: boolean, model: ContextRealityModel) => void>();\r\n\r\n /** Construct a new context reality model.\r\n * @param props JSON representation of the reality model, which will be kept in sync with changes made via the ContextRealityModel's methods.\r\n * @param options Options to customize how the reality model is created.\r\n */\r\n public constructor(props: ContextRealityModelProps, options?: { createClassifiers: (container: SpatialClassifiersContainer) => SpatialClassifiers }) {\r\n this._props = props;\r\n this.rdSourceKey = props.rdSourceKey;\r\n this.name = props.name ?? \"\";\r\n this.url = props.tilesetUrl ?? \"\";\r\n this.orbitGtBlob = props.orbitGtBlob;\r\n this.realityDataId = props.realityDataId;\r\n this.description = props.description ?? \"\";\r\n this._invisible = props.invisible ?? false;\r\n this._appearanceOverrides = props.appearanceOverrides ? FeatureAppearance.fromJSON(props.appearanceOverrides) : undefined;\r\n this._displaySettings = RealityModelDisplaySettings.fromJSON(props.displaySettings);\r\n\r\n if (props.planarClipMask && props.planarClipMask.mode !== PlanarClipMaskMode.None)\r\n this._planarClipMask = PlanarClipMaskSettings.fromJSON(props.planarClipMask);\r\n\r\n if (options?.createClassifiers) {\r\n this._classifiers = options.createClassifiers(props);\r\n } else {\r\n this._classifiers = new SpatialClassifiers(props);\r\n }\r\n }\r\n\r\n /** A set of [[SpatialClassifier]]s, of which one at any given time can be used to classify the reality model. */\r\n public get classifiers(): SpatialClassifiers {\r\n return this._classifiers;\r\n }\r\n\r\n /** Optionally describes how the geometry of the reality model can be masked by other models. */\r\n public get planarClipMaskSettings(): PlanarClipMaskSettings | undefined {\r\n return this._planarClipMask;\r\n }\r\n public set planarClipMaskSettings(settings: PlanarClipMaskSettings | undefined) {\r\n this.onPlanarClipMaskChanged.raiseEvent(settings, this);\r\n if (!settings)\r\n delete this._props.planarClipMask;\r\n else\r\n this._props.planarClipMask = settings.toJSON();\r\n\r\n this._planarClipMask = settings;\r\n }\r\n\r\n /** Overrides applied to the appearance of the reality model. Only the rgb, transparency, nonLocatable, and emphasized properties are applicable - the rest are ignored. */\r\n public get appearanceOverrides(): FeatureAppearance | undefined {\r\n return this._appearanceOverrides;\r\n }\r\n public set appearanceOverrides(overrides: FeatureAppearance | undefined) {\r\n this.onAppearanceOverridesChanged.raiseEvent(overrides, this);\r\n if (!overrides)\r\n delete this._props.appearanceOverrides;\r\n else\r\n this._props.appearanceOverrides = overrides.toJSON();\r\n\r\n this._appearanceOverrides = overrides;\r\n }\r\n\r\n /** Settings controlling how this reality model is displayed in a [Viewport]($frontend).\r\n * @beta\r\n */\r\n public get displaySettings(): RealityModelDisplaySettings {\r\n return this._displaySettings;\r\n }\r\n public set displaySettings(settings: RealityModelDisplaySettings) {\r\n this.onDisplaySettingsChanged.raiseEvent(settings, this);\r\n this._props.displaySettings = settings.toJSON();\r\n this._displaySettings = settings;\r\n }\r\n\r\n /** If true, reality model is not drawn.\r\n * @beta\r\n */\r\n public get invisible(): boolean {\r\n return this._invisible;\r\n }\r\n public set invisible(invisible: boolean) {\r\n if (invisible !== this.invisible) {\r\n this.onInvisibleChanged.raiseEvent(invisible, this);\r\n }\r\n\r\n this._props.invisible = invisible;\r\n this._invisible = invisible;\r\n }\r\n\r\n /** Convert this model to its JSON representation. */\r\n public toJSON(): ContextRealityModelProps {\r\n return ContextRealityModelProps.clone(this._props);\r\n }\r\n\r\n /** Returns true if [[name]] and [[url]] match the specified name and url. */\r\n public matchesNameAndUrl(name: string, url: string): boolean {\r\n return this.name === name && this.url === url;\r\n }\r\n}\r\n\r\n/** An object that can store the JSON representation of a list of [[ContextRealityModel]]s.\r\n * @see [[ContextRealityModels]].\r\n * @see [[DisplayStyleSettingsProps.contextRealityModels]].\r\n * @public\r\n * @extensions\r\n */\r\nexport interface ContextRealityModelsContainer {\r\n /** The list of reality models. */\r\n contextRealityModels?: ContextRealityModelProps[];\r\n /** @internal used for type discrimination with ContextRealityModelsArgs. */\r\n container?: never;\r\n}\r\n\r\n/** Arguments supplied to the constructor of [[ContextRealityModels]].\r\n * @public\r\n */\r\nexport interface ContextRealityModelsArgs {\r\n /** The object that holds the JSON representation of the list of context reality models. */\r\n container: ContextRealityModelsContainer;\r\n /** Optional function used to instantiate each [[ContextRealityModel]] in the list. */\r\n createContextRealityModel?: (props: ContextRealityModelProps) => ContextRealityModel;\r\n /** If true, the list will not be populated by the constructor. Instead, the caller is responsible for calling [[ContextRealityModels.populate]] exactly once after construction.\r\n * This is chiefly intended for use internally by the [DisplayStyleState]($frontend) constructor.\r\n */\r\n deferPopulating?: boolean;\r\n}\r\n\r\n/** A list of [[ContextRealityModel]]s attached to a [[DisplayStyleSettings]]. The list may be presented to the user with the name and description of each model.\r\n * The list is automatically synchronized with the underlying JSON representation provided by the input [[ContextRealityModelsContainer]].\r\n * @see [this interactive example](https://www.itwinjs.org/sample-showcase/?group=Viewer&sample=reality-data-sample)\r\n * @see [[DisplayStyleSettings.contextRealityModels]].\r\n * @public\r\n */\r\nexport class ContextRealityModels {\r\n private readonly _container: ContextRealityModelsContainer;\r\n private readonly _createModel: (props: ContextRealityModelProps) => ContextRealityModel;\r\n private readonly _models: ContextRealityModel[] = [];\r\n /** Event dispatched just before [[ContextRealityModel.planarClipMaskSettings]] is modified for one of the reality models. */\r\n public readonly onPlanarClipMaskChanged = new BeEvent<(model: ContextRealityModel, newSettings: PlanarClipMaskSettings | undefined) => void>();\r\n /** Event dispatched just before [[ContextRealityModel.appearanceOverrides]] is modified for one of the reality models. */\r\n public readonly onAppearanceOverridesChanged = new BeEvent<(model: ContextRealityModel, newOverrides: FeatureAppearance | undefined) => void>();\r\n /** Event dispatched just before [[ContextRealityModel.displaySettings]] is modified for one of the reality models.\r\n * @beta\r\n */\r\n public readonly onDisplaySettingsChanged = new BeEvent<(model: ContextRealityModel, newSettings: RealityModelDisplaySettings) => void>();\r\n /** Event dispatched just before [[ContextRealityModel.invisible]] is modified for one of the reality models.\r\n * @beta\r\n */\r\n public readonly onInvisibleChanged = new BeEvent<(model: ContextRealityModel, invisible: boolean) => void>();\r\n /** Event dispatched when a model is [[add]]ed, [[delete]]d, [[replace]]d, or [[update]]d. */\r\n public readonly onChanged = new BeEvent<(previousModel: ContextRealityModel | undefined, newModel: ContextRealityModel | undefined) => void>();\r\n\r\n /** Construct a new list of reality models from its JSON representation. The list will be initialized from `container.contextRealityModels` and that JSON representation\r\n * will be kept in sync with changes made to the list. The caller should not directly modify `container.contextRealityModels` or its contents as that will cause the list\r\n * to become out of sync with the JSON representation.\r\n * @param container The object that holds the JSON representation of the list.\r\n * @param createContextRealityModel Optional function used to instantiate each [[ContextRealityModel]] in the list.\r\n */\r\n public constructor(container: ContextRealityModelsContainer, createContextRealityModel?: (props: ContextRealityModelProps) => ContextRealityModel);\r\n\r\n /** Construct a new list of reality models from its JSON representation. The list will be initialized from `args.container.contextRealityModels` and that JSON representation\r\n * will be kept in sync with changes made to the list. The caller should not directly modify `container.contextRealityModels` or its contents as that will cause the list\r\n * to become out of sync with the JSON representation.\r\n * @param args Specifies the container and optionally customizes how the list of models is populated.\r\n */\r\n public constructor(args: ContextRealityModelsArgs);\r\n\r\n /** @internal */\r\n public constructor(arg0: ContextRealityModelsContainer | ContextRealityModelsArgs, createContextRealityModel?: (props: ContextRealityModelProps) => ContextRealityModel) {\r\n let container: ContextRealityModelsContainer;\r\n let defer = false;\r\n if (arg0.container) {\r\n container = arg0.container;\r\n createContextRealityModel = arg0.createContextRealityModel;\r\n defer = true === arg0.deferPopulating;\r\n } else {\r\n container = arg0;\r\n }\r\n\r\n this._container = container;\r\n this._createModel = createContextRealityModel ?? ((props) => new ContextRealityModel(props));\r\n\r\n if (!defer)\r\n this.populate();\r\n }\r\n\r\n /** @internal needs to be invoked after DisplayStyleSettings constructor by DisplayStyleState constructor.*/\r\n /** Populate the list of [[models]] from the container that was supplied to the constructor.\r\n * This should only be invoked once, and only if [[ContextRealityModelsArgs.deferPopulating]] was specified as `true` when calling the constructor.\r\n * @public\r\n */\r\n public populate(): void {\r\n assert(this._models.length === 0, \"do not call ContextRealityModels.populate more than once\");\r\n const models = this._container.contextRealityModels;\r\n if (models)\r\n for (const model of models)\r\n this._models.push(this.createModel(model));\r\n }\r\n\r\n /** The read-only list of reality models. */\r\n public get models(): ReadonlyArray<ContextRealityModel> {\r\n return this._models;\r\n }\r\n\r\n /** Append a new reality model to the list.\r\n * @param The JSON representation of the reality model.\r\n * @returns the newly-added reality model.\r\n */\r\n public add(props: ContextRealityModelProps): ContextRealityModel {\r\n if (!this._container.contextRealityModels)\r\n this._container.contextRealityModels = [];\r\n\r\n props = ContextRealityModelProps.clone(props);\r\n const model = this.createModel(props);\r\n\r\n this.onChanged.raiseEvent(undefined, model);\r\n\r\n this._models.push(model);\r\n this._container.contextRealityModels.push(props);\r\n\r\n return model;\r\n }\r\n\r\n /** Remove the specified reality model from the list.\r\n * @param model The reality model to remove.\r\n * @returns true if the model was removed, or false if the model was not present in the list.\r\n */\r\n public delete(model: ContextRealityModel): boolean {\r\n const index = this._models.indexOf(model);\r\n if (-1 === index)\r\n return false;\r\n\r\n assert(undefined !== this._container.contextRealityModels);\r\n assert(index < this._container.contextRealityModels.length);\r\n\r\n this.dropEventListeners(model);\r\n this.onChanged.raiseEvent(model, undefined);\r\n\r\n this._models.splice(index, 1);\r\n if (this.models.length === 0)\r\n this._container.contextRealityModels = undefined;\r\n else\r\n this._container.contextRealityModels.splice(index, 1);\r\n\r\n return true;\r\n }\r\n\r\n /** Remove all reality models from the list. */\r\n public clear(): void {\r\n for (const model of this.models) {\r\n this.dropEventListeners(model);\r\n this.onChanged.raiseEvent(model, undefined);\r\n }\r\n\r\n this._container.contextRealityModels = undefined;\r\n this._models.length = 0;\r\n }\r\n\r\n /** Replace a reality model in the list.\r\n * @param toReplace The reality model to be replaced.\r\n * @param replaceWith The JSON representation of the replacement reality model.\r\n * @returns the newly-created reality model that replaced `toReplace`.\r\n * @throws Error if `toReplace` is not present in the list\r\n * @note The replacement occupies the same index in the list as `toReplace` did.\r\n */\r\n public replace(toReplace: ContextRealityModel, replaceWith: ContextRealityModelProps): ContextRealityModel {\r\n const index = this._models.indexOf(toReplace);\r\n if (-1 === index)\r\n throw new Error(\"ContextRealityModel not present in list.\");\r\n\r\n assert(undefined !== this._container.contextRealityModels);\r\n assert(index < this._container.contextRealityModels.length);\r\n\r\n replaceWith = ContextRealityModelProps.clone(replaceWith);\r\n const model = this.createModel(replaceWith);\r\n\r\n this.onChanged.raiseEvent(toReplace, model);\r\n this.dropEventListeners(toReplace);\r\n\r\n this._models[index] = model;\r\n this._container.contextRealityModels[index] = replaceWith;\r\n\r\n return model;\r\n }\r\n\r\n /** Change selected properties of a reality model.\r\n * @param toUpdate The reality model whose properties are to be modified.\r\n * @param updateProps The properties to change.\r\n * @returns The updated reality model, identical to `toUpdate` except for properties explicitly supplied by `updateProps`.\r\n * @throws Error if `toUpdate` is not present in the list.\r\n */\r\n public update(toUpdate: ContextRealityModel, updateProps: Partial<ContextRealityModelProps>): ContextRealityModel {\r\n const props = {\r\n ...toUpdate.toJSON(),\r\n ...updateProps,\r\n };\r\n\r\n // Partial<> makes it possible to pass `undefined` for tilesetUrl...preserve previous URL in that case.\r\n if (undefined === props.tilesetUrl)\r\n props.tilesetUrl = toUpdate.url;\r\n\r\n return this.replace(toUpdate, props);\r\n }\r\n\r\n private createModel(props: ContextRealityModelProps): ContextRealityModel {\r\n const model = this._createModel(props);\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n model.onPlanarClipMaskChanged.addListener(this.handlePlanarClipMaskChanged, this);\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n model.onAppearanceOverridesChanged.addListener(this.handleAppearanceOverridesChanged, this);\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n model.onDisplaySettingsChanged.addListener(this.handleDisplaySettingsChanged, this);\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n model.onInvisibleChanged.addListener(this.handleInvisibleChanged, this);\r\n return model;\r\n }\r\n\r\n private dropEventListeners(model: ContextRealityModel): void {\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n model.onPlanarClipMaskChanged.removeListener(this.handlePlanarClipMaskChanged, this);\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n model.onAppearanceOverridesChanged.removeListener(this.handleAppearanceOverridesChanged, this);\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n model.onDisplaySettingsChanged.removeListener(this.handleDisplaySettingsChanged, this);\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n model.onInvisibleChanged.removeListener(this.handleInvisibleChanged, this);\r\n }\r\n\r\n private handlePlanarClipMaskChanged(mask: PlanarClipMaskSettings | undefined, model: ContextRealityModel): void {\r\n this.onPlanarClipMaskChanged.raiseEvent(model, mask);\r\n }\r\n\r\n private handleAppearanceOverridesChanged(app: FeatureAppearance | undefined, model: ContextRealityModel): void {\r\n this.onAppearanceOverridesChanged.raiseEvent(model, app);\r\n }\r\n\r\n private handleDisplaySettingsChanged(settings: RealityModelDisplaySettings, model: ContextRealityModel): void {\r\n this.onDisplaySettingsChanged.raiseEvent(model, settings);\r\n }\r\n\r\n private handleInvisibleChanged(invisible: boolean, model: ContextRealityModel): void {\r\n this.onInvisibleChanged.raiseEvent(model, invisible);\r\n }\r\n}\r\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/core-common",
|
|
3
|
-
"version": "4.10.0-dev.
|
|
3
|
+
"version": "4.10.0-dev.6",
|
|
4
4
|
"description": "iTwin.js components common to frontend and backend",
|
|
5
5
|
"main": "lib/cjs/core-common.js",
|
|
6
6
|
"module": "lib/esm/core-common.js",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"js-base64": "^3.6.1"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"@itwin/core-bentley": "^4.10.0-dev.
|
|
31
|
-
"@itwin/core-geometry": "^4.10.0-dev.
|
|
30
|
+
"@itwin/core-bentley": "^4.10.0-dev.6",
|
|
31
|
+
"@itwin/core-geometry": "^4.10.0-dev.6"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@itwin/eslint-plugin": "^4.0.2",
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"nyc": "^15.1.0",
|
|
44
44
|
"rimraf": "^3.0.2",
|
|
45
45
|
"typescript": "~5.3.3",
|
|
46
|
-
"@itwin/
|
|
47
|
-
"@itwin/core-
|
|
48
|
-
"@itwin/
|
|
46
|
+
"@itwin/build-tools": "4.10.0-dev.6",
|
|
47
|
+
"@itwin/core-bentley": "4.10.0-dev.6",
|
|
48
|
+
"@itwin/core-geometry": "4.10.0-dev.6"
|
|
49
49
|
},
|
|
50
50
|
"nyc": {
|
|
51
51
|
"extends": "./node_modules/@itwin/build-tools/.nycrc",
|