@itwin/core-frontend 5.10.0-dev.11 → 5.10.0-dev.13

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.
@@ -1 +1 @@
1
- {"version":3,"file":"DisplayStyleState.js","sourceRoot":"","sources":["../../src/DisplayStyleState.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,sDAAiF;AACjF,wDAAyD;AACzD,oDAM4B;AAC5B,2EAAwE;AACxE,mEAAgE;AAChE,yEAAsE;AACtE,+CAA6C;AAC7C,2CAAwC;AAExC,+DAA4D;AAC5D,8CAA6F;AAC7F,uDAAwG;AACxG,wDAAwD;AAExD,gBAAgB;AAChB,MAAa,uBAAuB;IAC3B,UAAU,CAAW;IACrB,WAAW,CAAW;IACtB,eAAe,CAAW;CAClC;AAJD,0DAIC;AAcD;;;GAGG;AACH,MAAsB,iBAAkB,SAAQ,0BAAY;IACnD,MAAM,KAAc,SAAS,KAAK,OAAO,cAAc,CAAC,CAAC,CAAC;IACzD,qBAAqB,CAAoC;IACzD,oCAAoC,GAAG,IAAI,GAAG,EAAmC,CAAC;IAC1F,gBAAgB;IACN,gCAAgC,CAA4C;IAC9E,gBAAgB,GAAG,KAAK,CAAC;IAGjC;;MAEE;IACc,CAAC,2CAAiC,CAAC,GAAG,IAAI,sBAAO,EAA4E,CAAC;IAEtI,gBAAgB,CAAkC;IAE1D;;OAEG;IACa,wBAAwB,GAAG,IAAI,sBAAO,EAAsD,CAAC;IAE7G;;OAEG;IACa,0BAA0B,GAAG,IAAI,sBAAO,EAErD,CAAC;IAEJ,2EAA2E;IAC3D,uBAAuB,GAAG,IAAI,sBAAO,EAA0D,CAAC;IAChH,wGAAwG;IACxF,2BAA2B,GAAG,IAAI,sBAAO,EAAgD,CAAC;IAQ1G;;;;OAIG;IACH,YAAY,KAAwB,EAAE,MAAwB,EAAE,MAA0B;QACxF,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAA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B;IACT,sBAAsB;QAC3B,IAAI,SAAS,KAAK,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;YACzC,MAAM,GAAG,GAAG,IAAI,uBAAuB,EAAE,CAAC;YAC1C,IAAI,IAAI,CAAC,SAAS,CAAC,eAAe,IAAI,kCAAoB,CAAC,QAAQ,KAAK,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI;gBAClH,GAAG,CAAC,UAAU,GAAG,KAAK,CAAC;YACzB,IAAI,IAAI,CAAC,SAAS,CAAC,eAAe,IAAI,CAAC,iCAAmB,CAAC,KAAK,KAAK,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,IAAI,iCAAmB,CAAC,SAAS,KAAK,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC;gBAC9K,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC;YACzB,OAAO,GAAG,CAAC;QACb,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AA7ED,kDA6EC","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 Views\r\n */\r\nimport { assert, BeEvent, Id64, Id64Arg, Id64String } from \"@itwin/core-bentley\";\r\nimport { Range1d, Vector3d } from \"@itwin/core-geometry\";\r\nimport {\r\n BackgroundMapProps, BackgroundMapProvider, BackgroundMapProviderProps, BackgroundMapSettings,\r\n BaseLayerSettings, BaseMapLayerSettings, ColorDef, ContextRealityModelProps, DisplayStyle3dSettings, DisplayStyle3dSettingsProps,\r\n DisplayStyleProps, DisplayStyleSettings, Environment, FeatureAppearance, GlobeMode, ImageMapLayerSettings, LightSettings, MapLayerProps,\r\n MapLayerSettings, MapSubLayerProps, RenderSchedule, RenderTimelineProps,\r\n SolarShadowSettings, SubCategoryOverride, SubLayerId, TerrainHeightOriginMode, ThematicDisplay, ThematicDisplayMode, ThematicGradientMode, ViewFlags,\r\n} from \"@itwin/core-common\";\r\nimport { ApproximateTerrainHeights } from \"./ApproximateTerrainHeights\";\r\nimport { BackgroundMapGeometry } from \"./BackgroundMapGeometry\";\r\nimport { ContextRealityModelState } from \"./ContextRealityModelState\";\r\nimport { ElementState } from \"./EntityState\";\r\nimport { IModelApp } from \"./IModelApp\";\r\nimport { IModelConnection } from \"./IModelConnection\";\r\nimport { PlanarClipMaskState } from \"./PlanarClipMaskState\";\r\nimport { getCesiumOSMBuildingsUrl, MapLayerIndex, TileTreeReference } from \"./tile/internal\";\r\nimport { _onScheduleScriptReferenceChanged, _scheduleScriptReference } from './common/internal/Symbols';\r\nimport { getScriptDelta } from \"./internal/ScriptUtils\";\r\n\r\n/** @internal */\r\nexport class TerrainDisplayOverrides {\r\n public wantSkirts?: boolean;\r\n public wantNormals?: boolean;\r\n public produceGeometry?: boolean;\r\n}\r\n\r\n/** Options controlling display of [OpenStreetMap Buildings](https://cesium.com/platform/cesium-ion/content/cesium-osm-buildings/).\r\n * @see [[DisplayStyleState.setOSMBuildingDisplay]].\r\n * @public\r\n * @extensions\r\n */\r\nexport interface OsmBuildingDisplayOptions {\r\n /** If defined, enables or disables display of the buildings by attaching or detaching the OpenStreetMap Buildings reality model. */\r\n onOff?: boolean;\r\n /** If defined, overrides aspects of the appearance of the OpenStreetMap building meshes. */\r\n appearanceOverrides?: FeatureAppearance;\r\n}\r\n\r\n/** A DisplayStyle defines the parameters for 'styling' the contents of a [[ViewState]].\r\n * @public\r\n * @extensions\r\n */\r\nexport abstract class DisplayStyleState extends ElementState implements DisplayStyleProps {\r\n public static override get className() { return \"DisplayStyle\"; }\r\n private _ellipsoidMapGeometry: BackgroundMapGeometry | undefined;\r\n private _attachedRealityModelPlanarClipMasks = new Map<Id64String, PlanarClipMaskState>();\r\n /** @internal */\r\n protected _queryRenderTimelinePropsPromise?: Promise<RenderTimelineProps | undefined>;\r\n private _assigningScript = false;\r\n\r\n\r\n /** Event raised just before the [[scheduleScriptReference]] property is changed.\r\n * @internal as of 5.0, use [[onScheduleScriptChanged]].\r\n */\r\n public readonly [_onScheduleScriptReferenceChanged] = new BeEvent<(newScriptReference: RenderSchedule.ScriptReference | undefined) => void>();\r\n\r\n private _scriptReference?: RenderSchedule.ScriptReference;\r\n\r\n /** Event raised when schedule script edits are made, providing changed element IDs and the editing scope.\r\n * @beta\r\n */\r\n public readonly onScheduleEditingChanged = new BeEvent<(changes: RenderSchedule.EditingChanges[]) => void>();\r\n\r\n /** Event raised when schedule script edits are committed (finalized).\r\n * @beta\r\n */\r\n public readonly onScheduleEditingCommitted = new BeEvent<\r\n () => void\r\n >();\r\n\r\n /** Event raised just before the [[scheduleScript]] property is changed. */\r\n public readonly onScheduleScriptChanged = new BeEvent<(newScript: RenderSchedule.Script | undefined) => void>();\r\n /** Event raised just after [[setOSMBuildingDisplay]] changes the enabled state of the OSM buildings. */\r\n public readonly onOSMBuildingDisplayChanged = new BeEvent<(osmBuildingDisplayEnabled: boolean) => void>();\r\n\r\n /** The container for this display style's settings. */\r\n public abstract get settings(): DisplayStyleSettings;\r\n\r\n /** @internal */\r\n public abstract overrideTerrainDisplay(): TerrainDisplayOverrides | undefined;\r\n\r\n /** Construct a new DisplayStyleState from its JSON representation.\r\n * @param props JSON representation of the display style.\r\n * @param iModel IModelConnection containing the display style.\r\n * @param source If the constructor is being invoked from [[EntityState.clone]], the display style that is being cloned.\r\n */\r\n constructor(props: DisplayStyleProps, iModel: IModelConnection, source?: DisplayStyleState) {\r\n super(props, iModel);\r\n const styles = this.jsonProperties.styles;\r\n\r\n if (source)\r\n this._scriptReference = source._scriptReference;\r\n\r\n if (styles) {\r\n // ###TODO Use DisplayStyleSettings.planarClipMasks\r\n if (styles.planarClipOvr)\r\n for (const planarClipOvr of styles.planarClipOvr)\r\n if (Id64.isValid(planarClipOvr.modelId))\r\n this._attachedRealityModelPlanarClipMasks.set(planarClipOvr.modelId, PlanarClipMaskState.fromJSON(planarClipOvr));\r\n }\r\n }\r\n\r\n /** Ensures all of the data required by the display style is loaded. This method is invoked for you by [[ViewState.load]], but if\r\n * you obtain a display style by some other means you should `await` this method before using the display style.\r\n */\r\n public async load(): Promise<void> {\r\n // If we were cloned, we may already have a valid schedule state, and our display style Id may be invalid / different.\r\n // Preserve it if still usable.\r\n if (this._scriptReference) {\r\n if (this.settings.renderTimeline === this._scriptReference.sourceId) {\r\n // The script came from the same RenderTimeline element. Keep it.\r\n return;\r\n }\r\n\r\n if (undefined === this.settings.renderTimeline) {\r\n // The script came from a display style's JSON properties. Keep it if (1) this style is not persistent or (2) this style has the same Id\r\n if (this.id === this._scriptReference.sourceId || !Id64.isValidId64(this.id))\r\n return;\r\n }\r\n }\r\n\r\n // The schedule script stored in JSON properties takes precedence over the RenderTimeline if both are defined.\r\n if (this.settings.scheduleScriptProps)\r\n this.loadScriptReferenceFromScript(this.settings.scheduleScriptProps);\r\n else\r\n await this.loadScriptReferenceFromTimeline(this.settings.renderTimeline);\r\n }\r\n\r\n private loadScriptReferenceFromScript(scriptProps: Readonly<RenderSchedule.ScriptProps>): void {\r\n let newState;\r\n try {\r\n const script = RenderSchedule.Script.fromJSON(scriptProps);\r\n if (script)\r\n newState = new RenderSchedule.ScriptReference(this.id, script);\r\n } catch {\r\n // schedule state is undefined.\r\n }\r\n\r\n if (newState !== this._scriptReference) {\r\n this[_onScheduleScriptReferenceChanged].raiseEvent(newState);\r\n this.onScheduleScriptChanged.raiseEvent(newState?.script);\r\n this._scriptReference = newState;\r\n }\r\n }\r\n\r\n private async loadScriptReferenceFromTimeline(timelineId: Id64String | undefined): Promise<void> {\r\n let newState;\r\n if (timelineId && Id64.isValidId64(timelineId)) {\r\n try {\r\n // If a subsequent call to loadScriptReferenceFromTimeline is made while we're awaiting this one, we'll abort this one.\r\n const promise = this._queryRenderTimelinePropsPromise = this.queryRenderTimelineProps(timelineId);\r\n const timeline = await promise;\r\n if (promise !== this._queryRenderTimelinePropsPromise)\r\n return;\r\n\r\n if (timeline) {\r\n const scriptProps = JSON.parse(timeline.script);\r\n const script = RenderSchedule.Script.fromJSON(scriptProps);\r\n if (script)\r\n newState = new RenderSchedule.ScriptReference(timelineId, script);\r\n }\r\n } catch {\r\n // schedule state is undefined.\r\n }\r\n }\r\n\r\n this._queryRenderTimelinePropsPromise = undefined;\r\n if (newState !== this._scriptReference) {\r\n this[_onScheduleScriptReferenceChanged].raiseEvent(newState);\r\n this.onScheduleScriptChanged.raiseEvent(newState?.script);\r\n this._scriptReference = newState;\r\n }\r\n }\r\n\r\n /** @internal */\r\n protected async queryRenderTimelineProps(timelineId: Id64String): Promise<RenderTimelineProps | undefined> {\r\n try {\r\n const omitScriptElementIds = !IModelApp.tileAdmin.enableFrontendScheduleScripts;\r\n return await this.iModel.elements.loadProps(timelineId, { renderTimeline: { omitScriptElementIds } }) as RenderTimelineProps;\r\n } catch {\r\n return undefined;\r\n }\r\n }\r\n\r\n /** @internal */\r\n public get displayTerrain() {\r\n return this.viewFlags.backgroundMap && this.settings.backgroundMap.applyTerrain;\r\n }\r\n\r\n /** @internal */\r\n public get globeMode(): GlobeMode { return this.settings.backgroundMap.globeMode; }\r\n\r\n /** Settings controlling how the base map is displayed within a view.\r\n * The base map can be provided by any map imagery source or set to be a single color.\r\n */\r\n public get backgroundMapBase(): BaseLayerSettings {\r\n return this.settings.mapImagery.backgroundBase;\r\n }\r\n public set backgroundMapBase(base: BaseLayerSettings) {\r\n this.settings.mapImagery.backgroundBase = base;\r\n this._synchBackgroundMapImagery();\r\n }\r\n\r\n /** The settings controlling how a background map is displayed within a view.\r\n * @see [[ViewFlags.backgroundMap]] for toggling display of the map on or off.\r\n */\r\n public get backgroundMapSettings(): BackgroundMapSettings { return this.settings.backgroundMap; }\r\n public set backgroundMapSettings(settings: BackgroundMapSettings) {\r\n this.settings.backgroundMap = settings;\r\n }\r\n\r\n /** Modify a subset of the background map display settings.\r\n * @param name props JSON representation of the properties to change. Any properties not present will retain their current values in `this.backgroundMapSettings`.\r\n * @see [[ViewFlags.backgroundMap]] for toggling display of the map.\r\n * @see [[changeBackgroundMapProvider]] to change the type of map imagery displayed.\r\n *\r\n * Example that changes only the elevation, leaving the provider and type unchanged:\r\n * ``` ts\r\n * style.changeBackgroundMapProps({ groundBias: 16.2 });\r\n * ```\r\n * @public\r\n */\r\n public changeBackgroundMapProps(props: BackgroundMapProps): void {\r\n const newSettings = this.backgroundMapSettings.clone(props);\r\n this.backgroundMapSettings = newSettings;\r\n }\r\n\r\n /** Change aspects of the [BackgroundMapProvider]($common) from which background map imagery is obtained.\r\n * Any properties not explicitly specified by `props` will retain their current values.\r\n * @public\r\n */\r\n public changeBackgroundMapProvider(props: BackgroundMapProviderProps): void {\r\n const base = this.settings.mapImagery.backgroundBase;\r\n if (base instanceof ColorDef) {\r\n this.settings.mapImagery.backgroundBase = BaseMapLayerSettings.fromProvider(BackgroundMapProvider.fromJSON(props));\r\n } else {\r\n const provider = base.provider ? base.provider.clone(props) : BackgroundMapProvider.fromJSON(props);\r\n this.settings.mapImagery.backgroundBase = base.cloneWithProvider(provider);\r\n }\r\n\r\n this._synchBackgroundMapImagery();\r\n }\r\n\r\n /** Call a function for each reality model attached to this display style.\r\n * @see [DisplayStyleSettings.contextRealityModels]($common).\r\n */\r\n public forEachRealityModel(func: (model: ContextRealityModelState) => void): void {\r\n for (const model of this.settings.contextRealityModels.models) {\r\n assert(model instanceof ContextRealityModelState);\r\n func(model);\r\n }\r\n }\r\n\r\n private * getRealityModels(): Iterable<ContextRealityModelState> {\r\n for (const model of this.settings.contextRealityModels.models) {\r\n assert(model instanceof ContextRealityModelState);\r\n yield model;\r\n }\r\n }\r\n\r\n /** Iterate over the reality models attached to this display style. */\r\n public get realityModels(): Iterable<ContextRealityModelState> {\r\n return this.getRealityModels();\r\n }\r\n\r\n /** @internal */\r\n public * getTileTreeRefs(): Iterable<TileTreeReference> {\r\n for (const model of this.realityModels) {\r\n if (!model.invisible) {\r\n yield model.treeRef;\r\n }\r\n }\r\n }\r\n\r\n /** Performs logical comparison against another display style. Two display styles are logically equivalent if they have the same name, Id, and settings.\r\n * @param other The display style to which to compare.\r\n * @returns true if the specified display style is logically equivalent to this display style - i.e., both styles have the same values for all of their settings.\r\n */\r\n public equalState(other: DisplayStyleState): boolean {\r\n if (this.name !== other.name || this.id !== other.id)\r\n return false;\r\n else\r\n return JSON.stringify(this.settings) === JSON.stringify(other.settings);\r\n }\r\n\r\n /** The name of this DisplayStyle */\r\n public get name(): string { return this.code.value; }\r\n\r\n /** Change the Id of the [RenderTimeline]($backend) element that hosts the [RenderSchedule.Script]($common) to be applied by this display style for\r\n * animating the contents of the view, and update [[scheduleScript]] using the script associated with the [RenderTimeline]($backend) element.\r\n * @see [DisplayStyleSettings.renderTimeline]($common).\r\n */\r\n public async changeRenderTimeline(timelineId: Id64String | undefined): Promise<void> {\r\n // Potentially trigger async loading of new schedule state.\r\n this.settings.renderTimeline = timelineId;\r\n\r\n // Await async loading if necessary.\r\n // Note the `await` in loadScriptReferenceFromTimeline will resolve before this one [per the spec](https://262.ecma-international.org/6.0/#sec-triggerpromisereactions).\r\n if (this._queryRenderTimelinePropsPromise)\r\n await this._queryRenderTimelinePropsPromise;\r\n }\r\n\r\n /**\r\n * Begins or updates a schedule script editing session for the current display style.\r\n * During an editing session, changes to the schedule script are applied incrementally\r\n * using temporary dynamic tiles, allowing for interactive preview of visual changes like color,\r\n * transforms, visibility, and cutting planes — without requiring a full tile tree reload.\r\n *\r\n * Calling this method multiple times will update the current editing session with new script changes.\r\n * When all edits are complete, you must invoke [[commitScheduleEditing]] to finalize the session and\r\n * trigger a full tile tree refresh with the committed script.\r\n *\r\n * @note You cannot use schedule script editing while a @see [[GraphicalEditingScope]] is active.\r\n *\r\n * Example:\r\n * ```ts\r\n * [[include:ScheduleScript_editingMode]]\r\n * ```\r\n *\r\n * @beta\r\n */\r\n public setScheduleEditing(newScript: RenderSchedule.Script): void {\r\n const prevScript = this.scheduleScript;\r\n const changes: Array<{ timeline: RenderSchedule.ModelTimeline, elements: Set<Id64String> }> = [];\r\n\r\n const globalDelta = getScriptDelta(prevScript, newScript);\r\n\r\n for (const timeline of newScript.modelTimelines) {\r\n const ids = new Set<Id64String>();\r\n for (const et of timeline.elementTimelines) {\r\n for (const id of et.elementIds) {\r\n if (globalDelta.has(id))\r\n ids.add(id);\r\n }\r\n }\r\n\r\n if (ids.size > 0)\r\n changes.push({ timeline, elements: ids });\r\n }\r\n\r\n this.scheduleScript = newScript;\r\n this.onScheduleEditingChanged.raiseEvent(changes);\r\n\r\n for (const modelTimeline of this.scheduleScript.modelTimelines) {\r\n modelTimeline.isEditingCommitted = false;\r\n }\r\n }\r\n\r\n /**\r\n * Finalizes a script editing session previously started with [[setScheduleEditing]].\r\n * This applies all pending script changes and triggers a full tile tree reload to reflect them in the viewport.\r\n * After this call, the schedule script is considered committed and editing mode ends.\r\n *\r\n * @see [[setScheduleEditing]] to begin a schedule script editing session.\r\n * @beta\r\n */\r\n public commitScheduleEditing(): void {\r\n this.onScheduleEditingCommitted.raiseEvent();\r\n if (!this.scheduleScript)\r\n return;\r\n for (const modelTimeline of this.scheduleScript.modelTimelines) {\r\n modelTimeline.isEditingCommitted = true;\r\n }\r\n }\r\n\r\n /** The [RenderSchedule.Script]($common) that animates the contents of the view, if any.\r\n * @see [[changeRenderTimeline]] to change the script.\r\n */\r\n public get scheduleScript(): RenderSchedule.Script | undefined {\r\n return this._scriptReference?.script;\r\n }\r\n\r\n public set scheduleScript(script: RenderSchedule.Script | undefined) {\r\n if (script === this.scheduleScript)\r\n return;\r\n\r\n try {\r\n const scriptRef = script ? new RenderSchedule.ScriptReference(script) : undefined;\r\n this[_onScheduleScriptReferenceChanged].raiseEvent(scriptRef);\r\n this.onScheduleScriptChanged.raiseEvent(script);\r\n this._scriptReference = scriptRef;\r\n\r\n this._assigningScript = true;\r\n this.settings.scheduleScriptProps = script?.toJSON();\r\n\r\n if (!script)\r\n this.loadScriptReferenceFromTimeline(this.settings.renderTimeline); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n } finally {\r\n this._assigningScript = false;\r\n }\r\n }\r\n\r\n /** The [RenderSchedule.Script]($common) that animates the contents of the view, if any, along with the Id of the element that hosts the script.\r\n * @note The host element may be a [RenderTimeline]($backend) or a [DisplayStyle]($backend).\r\n * @internal\r\n */\r\n public get [_scheduleScriptReference](): RenderSchedule.ScriptReference | undefined {\r\n return this._scriptReference;\r\n }\r\n\r\n /** Attach a [ContextRealityModel]($common) to this display style.\r\n * @see [DisplayStyleSettings.contextRealityModels]($common).\r\n * @see [ContextRealityModels.add]($common)\r\n */\r\n public attachRealityModel(props: ContextRealityModelProps): ContextRealityModelState {\r\n const model = this.settings.contextRealityModels.add(props);\r\n assert(model instanceof ContextRealityModelState);\r\n return model;\r\n }\r\n\r\n /** Detach the first [ContextRealityModel]($common) that matches the specified name and url.\r\n * @see [DisplayStyleSettings.contextRealityModels]($common)\r\n * @see [ContextRealityModels.delete]($common)\r\n */\r\n public detachRealityModelByNameAndUrl(name: string, url: string): boolean {\r\n const model = this.settings.contextRealityModels.models.find((x) => x.matchesNameAndUrl(name, url));\r\n return undefined !== model && this.settings.contextRealityModels.delete(model);\r\n }\r\n\r\n /** Get the [[ContextRealityModelState]] that displays the OpenStreetMap worldwide building layer, if enabled.\r\n * @see [[setOSMBuildingDisplay]]\r\n */\r\n public getOSMBuildingRealityModel(): ContextRealityModelState | undefined {\r\n if (!this.iModel.isGeoLocated || this.globeMode !== GlobeMode.Ellipsoid) // The OSM tile tree is ellipsoidal.\r\n return undefined;\r\n\r\n const url = getCesiumOSMBuildingsUrl();\r\n if (undefined === url)\r\n return undefined;\r\n\r\n return this.contextRealityModelStates.find((x) => x.url === url);\r\n }\r\n\r\n /** Set the display of the OpenStreetMap worldwide building layer in this display style by attaching or detaching the reality model displaying the buildings.\r\n * The OSM buildings are displayed from a reality model aggregated and served from Cesium ion.<(https://cesium.com/content/cesium-osm-buildings/>\r\n * The options [[OsmBuildingDisplayOptions]] control the display and appearance overrides.\r\n */\r\n public setOSMBuildingDisplay(options: OsmBuildingDisplayOptions): boolean {\r\n if (!this.iModel.isGeoLocated || this.globeMode !== GlobeMode.Ellipsoid) // The OSM tile tree is ellipsoidal.\r\n return false;\r\n\r\n const url = getCesiumOSMBuildingsUrl();\r\n if (undefined === url)\r\n return false;\r\n\r\n let model = this.settings.contextRealityModels.models.find((x) => x.url === url);\r\n if (options.onOff === false) {\r\n const turnedOff = undefined !== model && this.settings.contextRealityModels.delete(model);\r\n if (turnedOff)\r\n this.onOSMBuildingDisplayChanged.raiseEvent(false);\r\n\r\n return turnedOff;\r\n }\r\n\r\n if (!model) {\r\n const name = IModelApp.localization.getLocalizedString(\"iModelJs:RealityModelNames.OSMBuildings\");\r\n model = this.attachRealityModel({ tilesetUrl: url, name });\r\n this.onOSMBuildingDisplayChanged.raiseEvent(true);\r\n }\r\n\r\n if (options.appearanceOverrides)\r\n model.appearanceOverrides = options.appearanceOverrides;\r\n\r\n return true;\r\n }\r\n\r\n /** Return if a context reality model is attached.\r\n * @see [[ContextRealityModelProps]].\r\n */\r\n public hasAttachedRealityModel(name: string, url: string): boolean {\r\n return undefined !== this.settings.contextRealityModels.models.find((x) => x.matchesNameAndUrl(name, url));\r\n }\r\n\r\n /** @internal */\r\n public getMapLayers(isOverlay: boolean) { return isOverlay ? this.settings.mapImagery.overlayLayers : this.settings.mapImagery.backgroundLayers; }\r\n\r\n /** Attach a map layer to display style.\r\n * @param Settings representing the map layer.\r\n * @param mapLayerIndex the [[MapLayerIndex]] where the map layer should be attached.\r\n * @public\r\n */\r\n public attachMapLayer(options: { settings: MapLayerSettings, mapLayerIndex: MapLayerIndex }): void {\r\n const layerSettings = options.settings.clone({});\r\n if (undefined === layerSettings)\r\n return;\r\n\r\n const isOverlay = options.mapLayerIndex.isOverlay;\r\n const insertIndex = options.mapLayerIndex.index;\r\n const layers = this.getMapLayers(isOverlay);\r\n\r\n if (insertIndex < 0 || insertIndex > (layers.length - 1)) {\r\n this.getMapLayers(isOverlay).push(layerSettings);\r\n } else {\r\n layers.splice(insertIndex, 0, layerSettings);\r\n }\r\n\r\n this._synchBackgroundMapImagery();\r\n }\r\n\r\n /**\r\n * @param mapLayerIndex the [[MapLayerIndex]] where the map layer should be attached.\r\n * @internal\r\n */\r\n public attachMapLayerProps(options: { props: MapLayerProps, mapLayerIndex: MapLayerIndex }): void {\r\n const settings = MapLayerSettings.fromJSON(options.props);\r\n if (undefined === settings)\r\n return;\r\n\r\n this.attachMapLayer({ settings, mapLayerIndex: options.mapLayerIndex });\r\n }\r\n\r\n /** @internal */\r\n public hasAttachedMapLayer(name: string, source: string, isOverlay: boolean): boolean {\r\n return -1 !== this.findMapLayerIndexByNameAndSource(name, source, isOverlay);\r\n }\r\n\r\n /** @internal */\r\n public detachMapLayerByNameAndSource(name: string, source: string, isOverlay: boolean): void {\r\n const index = this.findMapLayerIndexByNameAndSource(name, source, isOverlay);\r\n if (- 1 !== index)\r\n this.detachMapLayerByIndex({ index, isOverlay });\r\n }\r\n\r\n /** Detach map layer at index (-1 to remove all layers)\r\n * @param mapLayerIndex the [[MapLayerIndex]] of the map layer to detach.\r\n * @public\r\n */\r\n public detachMapLayerByIndex(mapLayerIndex: MapLayerIndex): void {\r\n const layers = this.getMapLayers(mapLayerIndex.isOverlay);\r\n const index = mapLayerIndex.index;\r\n if (index < 0)\r\n layers.length = 0;\r\n else\r\n layers.splice(index, 1);\r\n\r\n this._synchBackgroundMapImagery();\r\n }\r\n\r\n /**\r\n * Lookup a maplayer index by name and source.\r\n * @param name Name of of the layer.\r\n * @param source Unique string identifying the layer.\r\n * @param isOverlay true if layer is overlay, otherwise layer is background. Defaults to false.\r\n * @public\r\n *\r\n */\r\n public findMapLayerIndexByNameAndSource(name: string, source: string, isOverlay: boolean) {\r\n return this.getMapLayers(isOverlay).findIndex((layer) => layer.matchesNameAndSource(name, source));\r\n }\r\n\r\n /** Return the map layer settings for a map layer at the provided index.\r\n * @param mapLayerIndex the [[MapLayerIndex]] of the map layer.\r\n * @public\r\n */\r\n public mapLayerAtIndex(mapLayerIndex: MapLayerIndex): MapLayerSettings | undefined {\r\n const layers = this.getMapLayers(mapLayerIndex.isOverlay);\r\n const index = mapLayerIndex.index;\r\n return (index < 0 || index >= layers.length) ? undefined : layers[index];\r\n }\r\n\r\n /** Return map base transparency as a number between 0 and 1.\r\n * @public\r\n */\r\n public get baseMapTransparency(): number {\r\n return this.settings.mapImagery.baseTransparency;\r\n }\r\n\r\n /** Change the map base transparency as a number between 0 and 1.\r\n * @public\r\n */\r\n public changeBaseMapTransparency(transparency: number) {\r\n if (this.settings.mapImagery.backgroundBase instanceof ColorDef) {\r\n this.settings.mapImagery.backgroundBase = this.settings.mapImagery.backgroundBase.withTransparency(transparency * 255);\r\n } else {\r\n this.settings.mapImagery.backgroundBase = this.settings.mapImagery.backgroundBase.clone({ transparency });\r\n }\r\n this._synchBackgroundMapImagery();\r\n }\r\n\r\n /** Modify a subset of a map layer settings.\r\n * @param props props JSON representation of the properties to change. Any properties not present will retain their current values.\r\n * @param mapLayerIndex the [[MapLayerIndex]] where the map layer should be inserted.\r\n *\r\n * Example that changes only the visibility of the first overlay map layer.\r\n * ``` ts\r\n * style.changeMapLayerProps({ visible: false }, 0, false);\r\n * ```\r\n * @public\r\n */\r\n public changeMapLayerProps(props: Partial<MapLayerProps>, mapLayerIndex: MapLayerIndex) {\r\n const index = mapLayerIndex.index;\r\n const layers = this.getMapLayers(mapLayerIndex.isOverlay);\r\n if (index < 0 || index >= layers.length)\r\n return;\r\n layers[index] = layers[index].clone(props);\r\n this._synchBackgroundMapImagery();\r\n }\r\n\r\n /** Change the credentials for a map layer.\r\n * @param mapLayerIndex the [[MapLayerIndex]] of the map layer to change the credentials of.\r\n * @public\r\n */\r\n public changeMapLayerCredentials(mapLayerIndex: MapLayerIndex, userName?: string, password?: string) {\r\n const layers = this.getMapLayers(mapLayerIndex.isOverlay);\r\n const index = mapLayerIndex.index;\r\n if (index < 0 || index >= layers.length)\r\n return;\r\n const layer = layers[index];\r\n if (layer instanceof ImageMapLayerSettings) {\r\n layer.setCredentials(userName, password);\r\n this._synchBackgroundMapImagery();\r\n }\r\n }\r\n\r\n /** Modify a subset of a sub-layer settings.\r\n * @param props props JSON representation of the properties to change. Any properties not present will retain their current values.\r\n * @param subLayerId Id of the sub-layer that should be modified.\r\n * @param mapLayerIndex the [[MapLayerIndex]] of the map layer that contains the sub-layer to be modified.\r\n *\r\n * @public\r\n */\r\n public changeMapSubLayerProps(props: Partial<MapSubLayerProps>, subLayerId: SubLayerId, mapLayerIndex: MapLayerIndex) {\r\n const mapLayerSettings = this.mapLayerAtIndex(mapLayerIndex);\r\n if (undefined === mapLayerSettings)\r\n return;\r\n\r\n if (!(mapLayerSettings instanceof ImageMapLayerSettings)) {\r\n assert(false);\r\n return;\r\n }\r\n\r\n const subLayers = new Array<MapSubLayerProps>();\r\n for (const subLayer of mapLayerSettings.subLayers) {\r\n subLayers.push((subLayerId === -1 || subLayer.id === subLayerId) ? subLayer.clone(props).toJSON() : subLayer.toJSON());\r\n }\r\n\r\n this.changeMapLayerProps({ subLayers }, mapLayerIndex);\r\n }\r\n\r\n /* @internal */\r\n private _synchBackgroundMapImagery() {\r\n this.settings.synchMapImagery();\r\n }\r\n\r\n /** Move map layer to top.\r\n * @param mapLayerIndex the [[MapLayerIndex]] of the map layer to move.\r\n * @public\r\n *\r\n */\r\n public moveMapLayerToTop(mapLayerIndex: MapLayerIndex) {\r\n const layers = this.getMapLayers(mapLayerIndex.isOverlay);\r\n const index = mapLayerIndex.index;\r\n if (index >= 0 && index < layers.length - 1) {\r\n const layer = layers.splice(index, 1);\r\n layers.push(layer[0]);\r\n this._synchBackgroundMapImagery();\r\n }\r\n }\r\n\r\n /** Move map layer to bottom.\r\n * @param mapLayerIndex the [[MapLayerIndex]] of the map layer to move.\r\n * @public\r\n */\r\n public moveMapLayerToBottom(mapLayerIndex: MapLayerIndex) {\r\n const layers = this.getMapLayers(mapLayerIndex.isOverlay);\r\n const index = mapLayerIndex.index;\r\n if (index > 0 && index < layers.length) {\r\n const layer = layers.splice(index, 1);\r\n layers.unshift(layer[0]);\r\n this._synchBackgroundMapImagery();\r\n }\r\n }\r\n\r\n /** Reorder map layers\r\n * @param fromIndex index of map layer to move\r\n * @param toIndex insert index. If equal to length of map array the map layer is moved to end of array.\r\n * @param isOverlay true if map-layer is part of the overlay map, otherwise it is part of the background map.\r\n * @public\r\n */\r\n public moveMapLayerToIndex(fromIndex: number, toIndex: number, isOverlay: boolean) {\r\n const layers = this.getMapLayers(isOverlay);\r\n if (fromIndex === toIndex)\r\n return;\r\n\r\n if (fromIndex < 0 || fromIndex >= layers.length || toIndex > layers.length)\r\n return;\r\n\r\n const layer = layers.splice(fromIndex, 1);\r\n layers.splice(toIndex, 0, layer[0]); // note: if toIndex === settings.mapImagery.backgroundLayers.length item is appended\r\n this._synchBackgroundMapImagery();\r\n }\r\n\r\n /** Flags controlling various aspects of the display style.\r\n * @see [DisplayStyleSettings.viewFlags]($common)\r\n */\r\n public get viewFlags(): ViewFlags { return this.settings.viewFlags; }\r\n public set viewFlags(flags: ViewFlags) { this.settings.viewFlags = flags; }\r\n\r\n /** The background color for this DisplayStyle */\r\n public get backgroundColor(): ColorDef { return this.settings.backgroundColor; }\r\n public set backgroundColor(val: ColorDef) { this.settings.backgroundColor = val; }\r\n\r\n /** The color used to draw geometry in monochrome mode.\r\n * @see [ViewFlags.monochrome]($common) for enabling monochrome mode.\r\n */\r\n public get monochromeColor(): ColorDef { return this.settings.monochromeColor; }\r\n public set monochromeColor(val: ColorDef) { this.settings.monochromeColor = val; }\r\n\r\n private _backgroundMapGeometry?: {\r\n bimElevationBias: number;\r\n geometry: BackgroundMapGeometry;\r\n globeMode: GlobeMode;\r\n };\r\n\r\n /** @internal */\r\n public anyMapLayersVisible(overlay: boolean): boolean {\r\n const layers = this.getMapLayers(overlay);\r\n\r\n for (const mapLayer of layers)\r\n if (mapLayer.visible)\r\n return true;\r\n\r\n return false;\r\n }\r\n\r\n /** @internal */\r\n public getIsBackgroundMapVisible(): boolean {\r\n return undefined !== this.iModel.ecefLocation && (this.viewFlags.backgroundMap || this.anyMapLayersVisible(false));\r\n }\r\n /** @internal */\r\n public get backgroundMapElevationBias(): number | undefined {\r\n if (this.backgroundMapSettings.applyTerrain) {\r\n const terrainSettings = this.backgroundMapSettings.terrainSettings;\r\n switch (terrainSettings.heightOriginMode) {\r\n case TerrainHeightOriginMode.Ground:\r\n return (undefined === this.iModel.projectCenterAltitude) ? undefined : terrainSettings.heightOrigin + terrainSettings.exaggeration * this.iModel.projectCenterAltitude;\r\n\r\n case TerrainHeightOriginMode.Geodetic:\r\n return terrainSettings.heightOrigin;\r\n\r\n case TerrainHeightOriginMode.Geoid:\r\n return (undefined === this.iModel.geodeticToSeaLevel) ? undefined : terrainSettings.heightOrigin + this.iModel.geodeticToSeaLevel;\r\n }\r\n } else {\r\n return this.backgroundMapSettings.groundBias;\r\n }\r\n\r\n }\r\n\r\n /** @internal */\r\n public getBackgroundMapGeometry(): BackgroundMapGeometry | undefined {\r\n if (undefined === this.iModel.ecefLocation)\r\n return undefined;\r\n\r\n const bimElevationBias = this.backgroundMapElevationBias;\r\n\r\n if (undefined === bimElevationBias)\r\n return undefined;\r\n\r\n const globeMode = this.globeMode;\r\n if (undefined === this._backgroundMapGeometry || this._backgroundMapGeometry.globeMode !== globeMode || this._backgroundMapGeometry.bimElevationBias !== bimElevationBias) {\r\n const geometry = new BackgroundMapGeometry(bimElevationBias, globeMode, this.iModel);\r\n this._backgroundMapGeometry = { bimElevationBias, geometry, globeMode };\r\n }\r\n return this._backgroundMapGeometry.geometry;\r\n }\r\n\r\n /** [[ContextRealityModelState]]s attached to this display style.\r\n * @see [DisplayStyleSettings.contextRealityModels]($common).\r\n */\r\n public get contextRealityModelStates(): ReadonlyArray<ContextRealityModelState> {\r\n return this.settings.contextRealityModels.models as ContextRealityModelState[];\r\n }\r\n\r\n /** @internal */\r\n public getGlobalGeometryAndHeightRange(): { geometry: BackgroundMapGeometry, heightRange: Range1d } | undefined {\r\n let geometry = this.getIsBackgroundMapVisible() ? this.getBackgroundMapGeometry() : undefined;\r\n const terrainRange = ApproximateTerrainHeights.instance.globalHeightRange;\r\n let heightRange = this.displayTerrain ? terrainRange : Range1d.createXX(-1, 1);\r\n if (this.globeMode === GlobeMode.Ellipsoid && this.contextRealityModelStates.find((model) => model.isGlobal)) {\r\n if (!geometry) {\r\n if (!this._ellipsoidMapGeometry)\r\n this._ellipsoidMapGeometry = new BackgroundMapGeometry(0, GlobeMode.Ellipsoid, this.iModel);\r\n\r\n geometry = this._ellipsoidMapGeometry;\r\n }\r\n\r\n heightRange = terrainRange;\r\n }\r\n\r\n return geometry ? { geometry, heightRange } : undefined;\r\n }\r\n\r\n /** Returns true if this is a 3d display style. */\r\n public is3d(): this is DisplayStyle3dState { return this instanceof DisplayStyle3dState; }\r\n\r\n /** Customize the way geometry belonging to a [[SubCategory]] is drawn by this display style.\r\n * @param id The ID of the SubCategory whose appearance is to be overridden.\r\n * @param ovr The overrides to apply to the [[SubCategoryAppearance]].\r\n * @see [[dropSubCategoryOverride]]\r\n */\r\n public overrideSubCategory(id: Id64String, ovr: SubCategoryOverride) { this.settings.overrideSubCategory(id, ovr); }\r\n\r\n /** Remove any [[SubCategoryOverride]] applied to a [[SubCategoryAppearance]] by this style.\r\n * @param id The ID of the [[SubCategory]].\r\n * @see [[overrideSubCategory]]\r\n */\r\n public dropSubCategoryOverride(id: Id64String) { this.settings.dropSubCategoryOverride(id); }\r\n\r\n /** Returns true if an [[SubCategoryOverride]]s are defined by this style. */\r\n public get hasSubCategoryOverride() { return this.settings.hasSubCategoryOverride; }\r\n\r\n /** Obtain the overrides applied to a [[SubCategoryAppearance]] by this style.\r\n * @param id The ID of the [[SubCategory]].\r\n * @returns The corresponding SubCategoryOverride, or undefined if the SubCategory's appearance is not overridden.\r\n * @see [[overrideSubCategory]]\r\n */\r\n public getSubCategoryOverride(id: Id64String): SubCategoryOverride | undefined { return this.settings.getSubCategoryOverride(id); }\r\n\r\n /** For each subcategory belonging to any of the specified categories, make it visible by turning off the \"invisible\" flag in its subcategory appearance.\r\n * This requires that the categories and subcategories have been previously loaded by, e.g., a call to IModelConnection.querySubCategories.\r\n * @returns true if the visibility of any subcategory was modified.\r\n * @see Viewport.changeCategoryDisplay\r\n * @see ViewCreator3dOptions.allSubCategoriesVisible\r\n * @internal\r\n */\r\n public enableAllLoadedSubCategories(categoryIds: Id64Arg): boolean {\r\n let anyChanged = false;\r\n for (const categoryId of Id64.iterable(categoryIds)) {\r\n const subCategoryIds = this.iModel.subcategories.getSubCategories(categoryId);\r\n if (undefined !== subCategoryIds)\r\n for (const subCategoryId of subCategoryIds)\r\n if (this.setSubCategoryVisible(subCategoryId, true))\r\n anyChanged = true;\r\n }\r\n\r\n return anyChanged;\r\n }\r\n\r\n /** Change the \"invisible\" flag for the given subcategory's appearance.\r\n * This requires that the subcategory appearance has been previously loaded by, e.g., a call to IModelConnection.Categories.getSubCategoryInfo.\r\n * @returns true if the visibility of any subcategory was modified.\r\n * @see [[enableAllLoadedSubCategories]]\r\n * @internal\r\n */\r\n public setSubCategoryVisible(subCategoryId: Id64String, visible: boolean): boolean {\r\n const app = this.iModel.subcategories.getSubCategoryAppearance(subCategoryId);\r\n if (undefined === app)\r\n return false; // category not enabled or subcategory not found\r\n\r\n const curOvr = this.getSubCategoryOverride(subCategoryId);\r\n const isAlreadyVisible = undefined !== curOvr && undefined !== curOvr.invisible ? !curOvr.invisible : !app.invisible;\r\n if (isAlreadyVisible === visible)\r\n return false;\r\n\r\n // Preserve existing overrides - just flip the visibility flag.\r\n const json = undefined !== curOvr ? curOvr.toJSON() : {};\r\n json.invisible = !visible;\r\n this.overrideSubCategory(subCategoryId, SubCategoryOverride.fromJSON(json));\r\n return true;\r\n }\r\n\r\n /** Returns true if solar shadow display is enabled by this display style. */\r\n public get wantShadows(): boolean {\r\n return this.is3d() && this.viewFlags.shadows && false !== IModelApp.renderSystem.options.displaySolarShadows;\r\n }\r\n\r\n /** @internal */\r\n protected registerSettingsEventListeners(): void {\r\n this.settings.onScheduleScriptPropsChanged.addListener((scriptProps) => {\r\n if (this._assigningScript)\r\n return;\r\n\r\n try {\r\n this._assigningScript = true;\r\n if (scriptProps)\r\n this.loadScriptReferenceFromScript(scriptProps);\r\n else\r\n this.loadScriptReferenceFromTimeline(this.settings.renderTimeline); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n } finally {\r\n this._assigningScript = false;\r\n }\r\n });\r\n\r\n this.settings.onRenderTimelineChanged.addListener((newTimeline) => {\r\n // Cancel any in-progress loading of script from timeline.\r\n this._queryRenderTimelinePropsPromise = undefined;\r\n\r\n if (!this.settings.scheduleScriptProps)\r\n this.loadScriptReferenceFromTimeline(newTimeline); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n });\r\n\r\n this.settings.onPlanarClipMaskChanged.addListener((id, newSettings) => {\r\n if (newSettings)\r\n this._attachedRealityModelPlanarClipMasks.set(id, PlanarClipMaskState.create(newSettings));\r\n else\r\n this._attachedRealityModelPlanarClipMasks.delete(id);\r\n });\r\n }\r\n\r\n /** @internal */\r\n protected createRealityModel(props: ContextRealityModelProps): ContextRealityModelState {\r\n return new ContextRealityModelState(props, this.iModel, this);\r\n }\r\n\r\n /** @internal */\r\n public getPlanarClipMaskState(modelId: Id64String): PlanarClipMaskState | undefined {\r\n const model = this.iModel.models.getLoaded(modelId)?.asSpatialModel;\r\n return (model && model.isRealityModel) ? this._attachedRealityModelPlanarClipMasks.get(modelId) : undefined;\r\n }\r\n}\r\n\r\n/** A display style that can be applied to 2d views.\r\n * @public\r\n * @extensions\r\n */\r\nexport class DisplayStyle2dState extends DisplayStyleState {\r\n public static override get className() { return \"DisplayStyle2d\"; }\r\n private readonly _settings: DisplayStyleSettings;\r\n\r\n public get settings(): DisplayStyleSettings { return this._settings; }\r\n\r\n /** @internal */\r\n public overrideTerrainDisplay(): TerrainDisplayOverrides | undefined { return undefined; }\r\n\r\n constructor(props: DisplayStyleProps, iModel: IModelConnection) {\r\n super(props, iModel);\r\n this._settings = new DisplayStyleSettings(this.jsonProperties, {\r\n createContextRealityModel: (modelProps) => this.createRealityModel(modelProps),\r\n deferContextRealityModels: true,\r\n });\r\n\r\n this._settings.contextRealityModels.populate();\r\n this.registerSettingsEventListeners();\r\n }\r\n}\r\n\r\n/** A [[DisplayStyleState]] that can be applied to spatial views.\r\n * @public\r\n * @extensions\r\n */\r\nexport class DisplayStyle3dState extends DisplayStyleState {\r\n public static override get className() { return \"DisplayStyle3d\"; }\r\n private _settings: DisplayStyle3dSettings;\r\n\r\n public get settings(): DisplayStyle3dSettings { return this._settings; }\r\n\r\n public constructor(props: DisplayStyleProps, iModel: IModelConnection, source?: DisplayStyle3dState) {\r\n super(props, iModel, source);\r\n this._settings = new DisplayStyle3dSettings(this.jsonProperties, {\r\n createContextRealityModel: (modelProps) => this.createRealityModel(modelProps),\r\n deferContextRealityModels: true,\r\n });\r\n\r\n this._settings.contextRealityModels.populate();\r\n this.registerSettingsEventListeners();\r\n }\r\n\r\n public get environment(): Environment {\r\n return this.settings.environment;\r\n }\r\n public set environment(env: Environment) {\r\n this.settings.environment = env;\r\n }\r\n\r\n public get lights(): LightSettings { return this.settings.lights; }\r\n public set lights(lights: LightSettings) { this.settings.lights = lights; }\r\n\r\n /** The direction of the solar light. */\r\n public get sunDirection(): Readonly<Vector3d> {\r\n return this.settings.lights.solar.direction;\r\n }\r\n\r\n /** Set the solar light direction based on time value\r\n * @param time The time in unix time milliseconds.\r\n * @see [DisplayStyle3dSettings.sunTime]($common) to obtain the current sun time.\r\n * @see [DisplayStyle3dSettings.setSunTime]($common).\r\n */\r\n public setSunTime(time: number) {\r\n this.settings.setSunTime(time, this.iModel);\r\n }\r\n\r\n /** Settings controlling shadow display. */\r\n public get solarShadows(): SolarShadowSettings {\r\n return this.settings.solarShadows;\r\n }\r\n public set solarShadows(settings: SolarShadowSettings) {\r\n this.settings.solarShadows = settings;\r\n }\r\n\r\n /** @internal */\r\n protected override registerSettingsEventListeners(): void {\r\n super.registerSettingsEventListeners();\r\n\r\n this.settings.onOverridesApplied.addListener((overrides: DisplayStyle3dSettingsProps) => {\r\n if (overrides.thematic && this.settings.thematic.displayMode === ThematicDisplayMode.Height && undefined === overrides.thematic.range) {\r\n // Use the project extents as reasonable default height range.\r\n // NB: assumes using Z axis...\r\n const extents = this.iModel.projectExtents;\r\n const props = { ...overrides.thematic };\r\n props.range = { low: extents.zLow, high: extents.zHigh };\r\n this.settings.thematic = ThematicDisplay.fromJSON(props);\r\n }\r\n });\r\n }\r\n\r\n /** @internal */\r\n public overrideTerrainDisplay(): TerrainDisplayOverrides | undefined {\r\n if (undefined !== this.settings.thematic) {\r\n const ovr = new TerrainDisplayOverrides();\r\n if (this.viewFlags.thematicDisplay && ThematicGradientMode.IsoLines === this.settings.thematic.gradientSettings.mode)\r\n ovr.wantSkirts = false;\r\n if (this.viewFlags.thematicDisplay && (ThematicDisplayMode.Slope === this.settings.thematic.displayMode || ThematicDisplayMode.HillShade === this.settings.thematic.displayMode))\r\n ovr.wantNormals = true;\r\n return ovr;\r\n }\r\n return undefined;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"DisplayStyleState.js","sourceRoot":"","sources":["../../src/DisplayStyleState.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,sDAAiF;AACjF,wDAAyD;AACzD,oDAM4B;AAC5B,2EAAwE;AACxE,mEAAgE;AAChE,yEAAsE;AACtE,+CAA6C;AAC7C,2CAAwC;AAExC,+DAA4D;AAC5D,8CAA6F;AAC7F,uDAAwG;AACxG,wDAAwD;AAExD,gBAAgB;AAChB,MAAa,uBAAuB;IAC3B,UAAU,CAAW;IACrB,WAAW,CAAW;IACtB,eAAe,CAAW;CAClC;AAJD,0DAIC;AAcD;;;GAGG;AACH,MAAsB,iBAAkB,SAAQ,0BAAY;IACnD,MAAM,KAAc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gBAC9K,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC;YACzB,OAAO,GAAG,CAAC;QACb,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AA7ED,kDA6EC","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 Views\r\n */\r\nimport { assert, BeEvent, Id64, Id64Arg, Id64String } from \"@itwin/core-bentley\";\r\nimport { Range1d, Vector3d } from \"@itwin/core-geometry\";\r\nimport {\r\n BackgroundMapProps, BackgroundMapProvider, BackgroundMapProviderProps, BackgroundMapSettings,\r\n BaseLayerSettings, BaseMapLayerSettings, ColorDef, ContextRealityModelProps, DisplayStyle3dSettings, DisplayStyle3dSettingsProps,\r\n DisplayStyleProps, DisplayStyleSettings, Environment, FeatureAppearance, GlobeMode, ImageMapLayerSettings, LightSettings, MapLayerProps,\r\n MapLayerSettings, MapSubLayerProps, RenderSchedule, RenderTimelineProps,\r\n SolarShadowSettings, SubCategoryOverride, SubLayerId, TerrainHeightOriginMode, ThematicDisplay, ThematicDisplayMode, ThematicGradientMode, ViewFlags,\r\n} from \"@itwin/core-common\";\r\nimport { ApproximateTerrainHeights } from \"./ApproximateTerrainHeights\";\r\nimport { BackgroundMapGeometry } from \"./BackgroundMapGeometry\";\r\nimport { ContextRealityModelState } from \"./ContextRealityModelState\";\r\nimport { ElementState } from \"./EntityState\";\r\nimport { IModelApp } from \"./IModelApp\";\r\nimport { IModelConnection } from \"./IModelConnection\";\r\nimport { PlanarClipMaskState } from \"./PlanarClipMaskState\";\r\nimport { getCesiumOSMBuildingsUrl, MapLayerIndex, TileTreeReference } from \"./tile/internal\";\r\nimport { _onScheduleScriptReferenceChanged, _scheduleScriptReference } from './common/internal/Symbols';\r\nimport { getScriptDelta } from \"./internal/ScriptUtils\";\r\n\r\n/** @internal */\r\nexport class TerrainDisplayOverrides {\r\n public wantSkirts?: boolean;\r\n public wantNormals?: boolean;\r\n public produceGeometry?: boolean;\r\n}\r\n\r\n/** Options controlling display of [OpenStreetMap Buildings](https://cesium.com/platform/cesium-ion/content/cesium-osm-buildings/).\r\n * @see [[DisplayStyleState.setOSMBuildingDisplay]].\r\n * @public\r\n * @extensions\r\n */\r\nexport interface OsmBuildingDisplayOptions {\r\n /** If defined, enables or disables display of the buildings by attaching or detaching the OpenStreetMap Buildings reality model. */\r\n onOff?: boolean;\r\n /** If defined, overrides aspects of the appearance of the OpenStreetMap building meshes. */\r\n appearanceOverrides?: FeatureAppearance;\r\n}\r\n\r\n/** A DisplayStyle defines the parameters for 'styling' the contents of a [[ViewState]].\r\n * @public\r\n * @extensions\r\n */\r\nexport abstract class DisplayStyleState extends ElementState implements DisplayStyleProps {\r\n public static override get className() { return \"DisplayStyle\"; }\r\n private _ellipsoidMapGeometry: BackgroundMapGeometry | undefined;\r\n private _attachedRealityModelPlanarClipMasks = new Map<Id64String, PlanarClipMaskState>();\r\n /** @internal */\r\n protected _queryRenderTimelinePropsPromise?: Promise<RenderTimelineProps | undefined>;\r\n private _assigningScript = false;\r\n\r\n\r\n /** Event raised just before the [[scheduleScriptReference]] property is changed.\r\n * @internal as of 5.0, use [[onScheduleScriptChanged]].\r\n */\r\n public readonly [_onScheduleScriptReferenceChanged] = new BeEvent<(newScriptReference: RenderSchedule.ScriptReference | undefined) => void>();\r\n\r\n private _scriptReference?: RenderSchedule.ScriptReference;\r\n\r\n /** Event raised when schedule script edits are made, providing changed element IDs and the editing scope.\r\n * @beta\r\n */\r\n public readonly onScheduleEditingChanged = new BeEvent<(changes: RenderSchedule.EditingChanges[]) => void>();\r\n\r\n /** Event raised when schedule script edits are committed (finalized).\r\n * @beta\r\n */\r\n public readonly onScheduleEditingCommitted = new BeEvent<\r\n () => void\r\n >();\r\n\r\n /** Event raised just before the [[scheduleScript]] property is changed. */\r\n public readonly onScheduleScriptChanged = new BeEvent<(newScript: RenderSchedule.Script | undefined) => void>();\r\n /** Event raised just after [[setOSMBuildingDisplay]] changes the enabled state of the OSM buildings. */\r\n public readonly onOSMBuildingDisplayChanged = new BeEvent<(osmBuildingDisplayEnabled: boolean) => void>();\r\n\r\n /** The container for this display style's settings. */\r\n public abstract get settings(): DisplayStyleSettings;\r\n\r\n /** @internal */\r\n public abstract overrideTerrainDisplay(): TerrainDisplayOverrides | undefined;\r\n\r\n /** Construct a new DisplayStyleState from its JSON representation.\r\n * @param props JSON representation of the display style.\r\n * @param iModel IModelConnection containing the display style.\r\n * @param source If the constructor is being invoked from [[EntityState.clone]], the display style that is being cloned.\r\n */\r\n constructor(props: DisplayStyleProps, iModel: IModelConnection, source?: DisplayStyleState) {\r\n super(props, iModel);\r\n const styles = this.jsonProperties.styles;\r\n\r\n if (source)\r\n this._scriptReference = source._scriptReference;\r\n\r\n if (styles) {\r\n // ###TODO Use DisplayStyleSettings.planarClipMasks\r\n if (styles.planarClipOvr)\r\n for (const planarClipOvr of styles.planarClipOvr)\r\n if (Id64.isValid(planarClipOvr.modelId))\r\n this._attachedRealityModelPlanarClipMasks.set(planarClipOvr.modelId, PlanarClipMaskState.fromJSON(planarClipOvr));\r\n }\r\n }\r\n\r\n /** Ensures all of the data required by the display style is loaded. This method is invoked for you by [[ViewState.load]], but if\r\n * you obtain a display style by some other means you should `await` this method before using the display style.\r\n */\r\n public async load(): Promise<void> {\r\n // If we were cloned, we may already have a valid schedule state, and our display style Id may be invalid / different.\r\n // Preserve it if still usable.\r\n if (this._scriptReference) {\r\n if (this.settings.renderTimeline === this._scriptReference.sourceId) {\r\n // The script came from the same RenderTimeline element. Keep it.\r\n return;\r\n }\r\n\r\n if (undefined === this.settings.renderTimeline) {\r\n // The script came from a display style's JSON properties. Keep it if (1) this style is not persistent or (2) this style has the same Id\r\n if (this.id === this._scriptReference.sourceId || !Id64.isValidId64(this.id))\r\n return;\r\n }\r\n }\r\n\r\n // The schedule script stored in JSON properties takes precedence over the RenderTimeline if both are defined.\r\n if (this.settings.scheduleScriptProps)\r\n this.loadScriptReferenceFromScript(this.settings.scheduleScriptProps);\r\n else\r\n await this.loadScriptReferenceFromTimeline(this.settings.renderTimeline);\r\n }\r\n\r\n private loadScriptReferenceFromScript(scriptProps: Readonly<RenderSchedule.ScriptProps>): void {\r\n let newState;\r\n try {\r\n const script = RenderSchedule.Script.fromJSON(scriptProps);\r\n if (script)\r\n newState = new RenderSchedule.ScriptReference(this.id, script);\r\n } catch {\r\n // schedule state is undefined.\r\n }\r\n\r\n if (newState !== this._scriptReference) {\r\n this[_onScheduleScriptReferenceChanged].raiseEvent(newState);\r\n this.onScheduleScriptChanged.raiseEvent(newState?.script);\r\n this._scriptReference = newState;\r\n }\r\n }\r\n\r\n private async loadScriptReferenceFromTimeline(timelineId: Id64String | undefined): Promise<void> {\r\n let newState;\r\n if (timelineId && Id64.isValidId64(timelineId)) {\r\n try {\r\n // If a subsequent call to loadScriptReferenceFromTimeline is made while we're awaiting this one, we'll abort this one.\r\n const promise = this._queryRenderTimelinePropsPromise = this.queryRenderTimelineProps(timelineId);\r\n const timeline = await promise;\r\n if (promise !== this._queryRenderTimelinePropsPromise)\r\n return;\r\n\r\n if (timeline) {\r\n const scriptProps = JSON.parse(timeline.script);\r\n const script = RenderSchedule.Script.fromJSON(scriptProps);\r\n if (script)\r\n newState = new RenderSchedule.ScriptReference(timelineId, script);\r\n }\r\n } catch {\r\n // schedule state is undefined.\r\n }\r\n }\r\n\r\n this._queryRenderTimelinePropsPromise = undefined;\r\n if (newState !== this._scriptReference) {\r\n this[_onScheduleScriptReferenceChanged].raiseEvent(newState);\r\n this.onScheduleScriptChanged.raiseEvent(newState?.script);\r\n this._scriptReference = newState;\r\n }\r\n }\r\n\r\n /** @internal */\r\n protected async queryRenderTimelineProps(timelineId: Id64String): Promise<RenderTimelineProps | undefined> {\r\n try {\r\n const omitScriptElementIds = !IModelApp.tileAdmin.enableFrontendScheduleScripts;\r\n return await this.iModel.elements.loadProps(timelineId, { renderTimeline: { omitScriptElementIds } }) as RenderTimelineProps;\r\n } catch {\r\n return undefined;\r\n }\r\n }\r\n\r\n /** @internal */\r\n public get displayTerrain() {\r\n return this.viewFlags.backgroundMap && this.settings.backgroundMap.applyTerrain;\r\n }\r\n\r\n /** @internal */\r\n public get globeMode(): GlobeMode { return this.settings.backgroundMap.globeMode; }\r\n\r\n /** Settings controlling how the base map is displayed within a view.\r\n * The base map can be provided by any map imagery source or set to be a single color.\r\n */\r\n public get backgroundMapBase(): BaseLayerSettings {\r\n return this.settings.mapImagery.backgroundBase;\r\n }\r\n public set backgroundMapBase(base: BaseLayerSettings) {\r\n this.settings.mapImagery.backgroundBase = base;\r\n this._synchBackgroundMapImagery();\r\n }\r\n\r\n /** The settings controlling how a background map is displayed within a view.\r\n * @see [[ViewFlags.backgroundMap]] for toggling display of the map on or off.\r\n */\r\n public get backgroundMapSettings(): BackgroundMapSettings { return this.settings.backgroundMap; }\r\n public set backgroundMapSettings(settings: BackgroundMapSettings) {\r\n this.settings.backgroundMap = settings;\r\n }\r\n\r\n /** Modify a subset of the background map display settings.\r\n * @param name props JSON representation of the properties to change. Any properties not present will retain their current values in `this.backgroundMapSettings`.\r\n * @see [[ViewFlags.backgroundMap]] for toggling display of the map.\r\n * @see [[changeBackgroundMapProvider]] to change the type of map imagery displayed.\r\n *\r\n * Example that changes only the elevation, leaving the provider and type unchanged:\r\n * ``` ts\r\n * style.changeBackgroundMapProps({ groundBias: 16.2 });\r\n * ```\r\n * @public\r\n */\r\n public changeBackgroundMapProps(props: BackgroundMapProps): void {\r\n const newSettings = this.backgroundMapSettings.clone(props);\r\n this.backgroundMapSettings = newSettings;\r\n }\r\n\r\n /** Change aspects of the [BackgroundMapProvider]($common) from which background map imagery is obtained.\r\n * Any properties not explicitly specified by `props` will retain their current values.\r\n * @public\r\n */\r\n public changeBackgroundMapProvider(props: BackgroundMapProviderProps): void {\r\n const base = this.settings.mapImagery.backgroundBase;\r\n if (base instanceof ColorDef) {\r\n this.settings.mapImagery.backgroundBase = BaseMapLayerSettings.fromProvider(BackgroundMapProvider.fromJSON(props));\r\n } else {\r\n const provider = base.provider ? base.provider.clone(props) : BackgroundMapProvider.fromJSON(props);\r\n this.settings.mapImagery.backgroundBase = base.cloneWithProvider(provider);\r\n }\r\n\r\n this._synchBackgroundMapImagery();\r\n }\r\n\r\n /** Call a function for each reality model attached to this display style.\r\n * @see [DisplayStyleSettings.contextRealityModels]($common).\r\n */\r\n public forEachRealityModel(func: (model: ContextRealityModelState) => void): void {\r\n for (const model of this.settings.contextRealityModels.models) {\r\n assert(model instanceof ContextRealityModelState);\r\n func(model);\r\n }\r\n }\r\n\r\n private * getRealityModels(): Iterable<ContextRealityModelState> {\r\n for (const model of this.settings.contextRealityModels.models) {\r\n assert(model instanceof ContextRealityModelState);\r\n yield model;\r\n }\r\n }\r\n\r\n /** Iterate over the reality models attached to this display style. */\r\n public get realityModels(): Iterable<ContextRealityModelState> {\r\n return this.getRealityModels();\r\n }\r\n\r\n /** @internal */\r\n public * getTileTreeRefs(): Iterable<TileTreeReference> {\r\n for (const model of this.realityModels) {\r\n if (!model.invisible) {\r\n yield model.treeRef;\r\n }\r\n }\r\n }\r\n\r\n /** Performs logical comparison against another display style. Two display styles are logically equivalent if they have the same name, Id, and settings.\r\n * @param other The display style to which to compare.\r\n * @returns true if the specified display style is logically equivalent to this display style - i.e., both styles have the same values for all of their settings.\r\n */\r\n public equalState(other: DisplayStyleState): boolean {\r\n if (this.name !== other.name || this.id !== other.id)\r\n return false;\r\n else\r\n return JSON.stringify(this.settings) === JSON.stringify(other.settings);\r\n }\r\n\r\n /** The name of this DisplayStyle */\r\n public get name(): string { return this.code.value; }\r\n\r\n /** Change the Id of the [RenderTimeline]($backend) element that hosts the [RenderSchedule.Script]($common) to be applied by this display style for\r\n * animating the contents of the view, and update [[scheduleScript]] using the script associated with the [RenderTimeline]($backend) element.\r\n * @see [DisplayStyleSettings.renderTimeline]($common).\r\n */\r\n public async changeRenderTimeline(timelineId: Id64String | undefined): Promise<void> {\r\n // Potentially trigger async loading of new schedule state.\r\n this.settings.renderTimeline = timelineId;\r\n\r\n // Await async loading if necessary.\r\n // Note the `await` in loadScriptReferenceFromTimeline will resolve before this one [per the spec](https://262.ecma-international.org/6.0/#sec-triggerpromisereactions).\r\n if (this._queryRenderTimelinePropsPromise)\r\n await this._queryRenderTimelinePropsPromise;\r\n }\r\n\r\n /**\r\n * Begins or updates a schedule script editing session for the current display style.\r\n * During an editing session, changes to the schedule script are applied incrementally\r\n * using temporary dynamic tiles, allowing for interactive preview of visual changes like color,\r\n * transforms, visibility, and cutting planes — without requiring a full tile tree reload.\r\n *\r\n * Calling this method multiple times will update the current editing session with new script changes.\r\n * When all edits are complete, you must invoke [[commitScheduleEditing]] to finalize the session and\r\n * trigger a full tile tree refresh with the committed script.\r\n *\r\n * @note You cannot use schedule script editing while a @see [[GraphicalEditingScope]] is active.\r\n *\r\n * Example:\r\n * ```ts\r\n * [[include:ScheduleScript_editingMode]]\r\n * ```\r\n *\r\n * @beta\r\n */\r\n public setScheduleEditing(newScript: RenderSchedule.Script): void {\r\n const prevScript = this.scheduleScript;\r\n const changes: Array<{ timeline: RenderSchedule.ModelTimeline, elements: Set<Id64String> }> = [];\r\n\r\n const globalDelta = getScriptDelta(prevScript, newScript);\r\n\r\n for (const timeline of newScript.modelTimelines) {\r\n const ids = new Set<Id64String>();\r\n for (const et of timeline.elementTimelines) {\r\n for (const id of et.elementIds) {\r\n if (globalDelta.has(id))\r\n ids.add(id);\r\n }\r\n }\r\n\r\n if (ids.size > 0)\r\n changes.push({ timeline, elements: ids });\r\n }\r\n\r\n this.scheduleScript = newScript;\r\n this.onScheduleEditingChanged.raiseEvent(changes);\r\n\r\n for (const modelTimeline of this.scheduleScript.modelTimelines) {\r\n modelTimeline.isEditingCommitted = false;\r\n }\r\n }\r\n\r\n /**\r\n * Finalizes a script editing session previously started with [[setScheduleEditing]].\r\n * This applies all pending script changes and triggers a full tile tree reload to reflect them in the viewport.\r\n * After this call, the schedule script is considered committed and editing mode ends.\r\n *\r\n * @see [[setScheduleEditing]] to begin a schedule script editing session.\r\n * @beta\r\n */\r\n public commitScheduleEditing(): void {\r\n this.onScheduleEditingCommitted.raiseEvent();\r\n if (!this.scheduleScript)\r\n return;\r\n for (const modelTimeline of this.scheduleScript.modelTimelines) {\r\n modelTimeline.isEditingCommitted = true;\r\n }\r\n }\r\n\r\n /** The [RenderSchedule.Script]($common) that animates the contents of the view, if any.\r\n * @see [[changeRenderTimeline]] to change the script.\r\n */\r\n public get scheduleScript(): RenderSchedule.Script | undefined {\r\n return this._scriptReference?.script;\r\n }\r\n\r\n public set scheduleScript(script: RenderSchedule.Script | undefined) {\r\n if (script === this.scheduleScript)\r\n return;\r\n\r\n try {\r\n const scriptRef = script ? new RenderSchedule.ScriptReference(script) : undefined;\r\n this[_onScheduleScriptReferenceChanged].raiseEvent(scriptRef);\r\n this.onScheduleScriptChanged.raiseEvent(script);\r\n this._scriptReference = scriptRef;\r\n\r\n this._assigningScript = true;\r\n this.settings.scheduleScriptProps = script?.toJSON();\r\n\r\n if (!script)\r\n this.loadScriptReferenceFromTimeline(this.settings.renderTimeline); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n } finally {\r\n this._assigningScript = false;\r\n }\r\n }\r\n\r\n /** The [RenderSchedule.Script]($common) that animates the contents of the view, if any, along with the Id of the element that hosts the script.\r\n * @note The host element may be a [RenderTimeline]($backend) or a [DisplayStyle]($backend).\r\n * @internal\r\n */\r\n public get [_scheduleScriptReference](): RenderSchedule.ScriptReference | undefined {\r\n return this._scriptReference;\r\n }\r\n\r\n /** Attach a [ContextRealityModel]($common) to this display style.\r\n * @see [DisplayStyleSettings.contextRealityModels]($common).\r\n * @see [ContextRealityModels.add]($common)\r\n */\r\n public attachRealityModel(props: ContextRealityModelProps): ContextRealityModelState {\r\n const model = this.settings.contextRealityModels.add(props);\r\n assert(model instanceof ContextRealityModelState);\r\n return model;\r\n }\r\n\r\n /** Detach the first [ContextRealityModel]($common) that matches the specified name and url.\r\n * @see [DisplayStyleSettings.contextRealityModels]($common)\r\n * @see [ContextRealityModels.delete]($common)\r\n */\r\n public detachRealityModelByNameAndUrl(name: string, url: string): boolean {\r\n const model = this.settings.contextRealityModels.models.find((x) => x.matchesNameAndUrl(name, url));\r\n return undefined !== model && this.settings.contextRealityModels.delete(model);\r\n }\r\n\r\n /** Get the [[ContextRealityModelState]] that displays the OpenStreetMap worldwide building layer, if enabled.\r\n * @see [[setOSMBuildingDisplay]]\r\n */\r\n public getOSMBuildingRealityModel(): ContextRealityModelState | undefined {\r\n if (!this.iModel.isGeoLocated || this.globeMode !== GlobeMode.Ellipsoid) // The OSM tile tree is ellipsoidal.\r\n return undefined;\r\n\r\n const url = getCesiumOSMBuildingsUrl();\r\n if (undefined === url)\r\n return undefined;\r\n\r\n return this.contextRealityModelStates.find((x) => x.url === url);\r\n }\r\n\r\n /** Set the display of the OpenStreetMap worldwide building layer in this display style by attaching or detaching the reality model displaying the buildings.\r\n * The OSM buildings are displayed from a reality model aggregated and served from Cesium ion.<(https://cesium.com/content/cesium-osm-buildings/>\r\n * The options [[OsmBuildingDisplayOptions]] control the display and appearance overrides.\r\n */\r\n public setOSMBuildingDisplay(options: OsmBuildingDisplayOptions): boolean {\r\n if (!this.iModel.isGeoLocated || this.globeMode !== GlobeMode.Ellipsoid) // The OSM tile tree is ellipsoidal.\r\n return false;\r\n\r\n const url = getCesiumOSMBuildingsUrl();\r\n if (undefined === url)\r\n return false;\r\n\r\n let model = this.settings.contextRealityModels.models.find((x) => x.url === url);\r\n if (options.onOff === false) {\r\n const turnedOff = undefined !== model && this.settings.contextRealityModels.delete(model);\r\n if (turnedOff)\r\n this.onOSMBuildingDisplayChanged.raiseEvent(false);\r\n\r\n return turnedOff;\r\n }\r\n\r\n if (!model) {\r\n const name = IModelApp.localization.getLocalizedString(\"iModelJs:RealityModelNames.OSMBuildings\");\r\n model = this.attachRealityModel({ tilesetUrl: url, name });\r\n this.onOSMBuildingDisplayChanged.raiseEvent(true);\r\n }\r\n\r\n if (options.appearanceOverrides)\r\n model.appearanceOverrides = options.appearanceOverrides;\r\n\r\n return true;\r\n }\r\n\r\n /** Return if a context reality model is attached.\r\n * @see [[ContextRealityModelProps]].\r\n */\r\n public hasAttachedRealityModel(name: string, url: string): boolean {\r\n return undefined !== this.settings.contextRealityModels.models.find((x) => x.matchesNameAndUrl(name, url));\r\n }\r\n\r\n /** @internal */\r\n public getMapLayers(isOverlay: boolean) { return isOverlay ? this.settings.mapImagery.overlayLayers : this.settings.mapImagery.backgroundLayers; }\r\n\r\n /** Attach a map layer to display style.\r\n * @param Settings representing the map layer.\r\n * @param mapLayerIndex the [[MapLayerIndex]] where the map layer should be attached.\r\n * @public\r\n */\r\n public attachMapLayer(options: { settings: MapLayerSettings, mapLayerIndex: MapLayerIndex }): void {\r\n const layerSettings = options.settings.clone({});\r\n if (undefined === layerSettings)\r\n return;\r\n\r\n const isOverlay = options.mapLayerIndex.isOverlay;\r\n const insertIndex = options.mapLayerIndex.index;\r\n const layers = this.getMapLayers(isOverlay);\r\n\r\n if (insertIndex < 0 || insertIndex > (layers.length - 1)) {\r\n this.getMapLayers(isOverlay).push(layerSettings);\r\n } else {\r\n layers.splice(insertIndex, 0, layerSettings);\r\n }\r\n\r\n this._synchBackgroundMapImagery();\r\n }\r\n\r\n /**\r\n * @param mapLayerIndex the [[MapLayerIndex]] where the map layer should be attached.\r\n * @internal\r\n */\r\n public attachMapLayerProps(options: { props: MapLayerProps, mapLayerIndex: MapLayerIndex }): void {\r\n const settings = MapLayerSettings.fromJSON(options.props);\r\n if (undefined === settings)\r\n return;\r\n\r\n this.attachMapLayer({ settings, mapLayerIndex: options.mapLayerIndex });\r\n }\r\n\r\n /** @internal */\r\n public hasAttachedMapLayer(name: string, source: string, isOverlay: boolean): boolean {\r\n return -1 !== this.findMapLayerIndexByNameAndSource(name, source, isOverlay);\r\n }\r\n\r\n /** @internal */\r\n public detachMapLayerByNameAndSource(name: string, source: string, isOverlay: boolean): void {\r\n const index = this.findMapLayerIndexByNameAndSource(name, source, isOverlay);\r\n if (- 1 !== index)\r\n this.detachMapLayerByIndex({ index, isOverlay });\r\n }\r\n\r\n /** Detach map layer at index (-1 to remove all layers)\r\n * @param mapLayerIndex the [[MapLayerIndex]] of the map layer to detach.\r\n * @public\r\n */\r\n public detachMapLayerByIndex(mapLayerIndex: MapLayerIndex): void {\r\n const layers = this.getMapLayers(mapLayerIndex.isOverlay);\r\n const index = mapLayerIndex.index;\r\n if (index < 0)\r\n layers.length = 0;\r\n else\r\n layers.splice(index, 1);\r\n\r\n this._synchBackgroundMapImagery();\r\n }\r\n\r\n /**\r\n * Lookup a maplayer index by name and source.\r\n * @param name Name of of the layer.\r\n * @param source Unique string identifying the layer.\r\n * @param isOverlay true if layer is overlay, otherwise layer is background. Defaults to false.\r\n * @public\r\n *\r\n */\r\n public findMapLayerIndexByNameAndSource(name: string, source: string, isOverlay: boolean) {\r\n return this.getMapLayers(isOverlay).findIndex((layer) => layer.matchesNameAndSource(name, source));\r\n }\r\n\r\n /** Return the map layer settings for a map layer at the provided index.\r\n * @param mapLayerIndex the [[MapLayerIndex]] of the map layer.\r\n * @public\r\n */\r\n public mapLayerAtIndex(mapLayerIndex: MapLayerIndex): MapLayerSettings | undefined {\r\n const layers = this.getMapLayers(mapLayerIndex.isOverlay);\r\n const index = mapLayerIndex.index;\r\n return (index < 0 || index >= layers.length) ? undefined : layers[index];\r\n }\r\n\r\n /** Return map base transparency as a number between 0 and 1.\r\n * @public\r\n */\r\n public get baseMapTransparency(): number {\r\n return this.settings.mapImagery.baseTransparency;\r\n }\r\n\r\n /** Change the map base transparency as a number between 0 and 1.\r\n * @public\r\n */\r\n public changeBaseMapTransparency(transparency: number) {\r\n if (this.settings.mapImagery.backgroundBase instanceof ColorDef) {\r\n this.settings.mapImagery.backgroundBase = this.settings.mapImagery.backgroundBase.withTransparency(transparency * 255);\r\n } else {\r\n this.settings.mapImagery.backgroundBase = this.settings.mapImagery.backgroundBase.clone({ transparency });\r\n }\r\n this._synchBackgroundMapImagery();\r\n }\r\n\r\n /** Modify a subset of a map layer settings.\r\n * @param props props JSON representation of the properties to change. Any properties not present will retain their current values.\r\n * @param mapLayerIndex the [[MapLayerIndex]] where the map layer should be inserted.\r\n *\r\n * Example that changes only the visibility of the first overlay map layer.\r\n * ``` ts\r\n * style.changeMapLayerProps({ visible: false }, 0, false);\r\n * ```\r\n * @public\r\n */\r\n public changeMapLayerProps(props: Partial<MapLayerProps>, mapLayerIndex: MapLayerIndex) {\r\n const index = mapLayerIndex.index;\r\n const layers = this.getMapLayers(mapLayerIndex.isOverlay);\r\n if (index < 0 || index >= layers.length)\r\n return;\r\n layers[index] = layers[index].clone(props);\r\n this._synchBackgroundMapImagery();\r\n }\r\n\r\n /** Change the credentials for a map layer.\r\n * @param mapLayerIndex the [[MapLayerIndex]] of the map layer to change the credentials of.\r\n * @public\r\n */\r\n public changeMapLayerCredentials(mapLayerIndex: MapLayerIndex, userName?: string, password?: string) {\r\n const layers = this.getMapLayers(mapLayerIndex.isOverlay);\r\n const index = mapLayerIndex.index;\r\n if (index < 0 || index >= layers.length)\r\n return;\r\n const layer = layers[index];\r\n if (layer instanceof ImageMapLayerSettings) {\r\n layer.setCredentials(userName, password);\r\n this._synchBackgroundMapImagery();\r\n }\r\n }\r\n\r\n /** Modify a subset of a sub-layer settings.\r\n * @param props props JSON representation of the properties to change. Any properties not present will retain their current values.\r\n * @param subLayerId Id of the sub-layer that should be modified.\r\n * @param mapLayerIndex the [[MapLayerIndex]] of the map layer that contains the sub-layer to be modified.\r\n *\r\n * @public\r\n */\r\n public changeMapSubLayerProps(props: Partial<MapSubLayerProps>, subLayerId: SubLayerId, mapLayerIndex: MapLayerIndex) {\r\n const mapLayerSettings = this.mapLayerAtIndex(mapLayerIndex);\r\n if (undefined === mapLayerSettings)\r\n return;\r\n\r\n if (!(mapLayerSettings instanceof ImageMapLayerSettings)) {\r\n assert(false);\r\n return;\r\n }\r\n\r\n const subLayers = new Array<MapSubLayerProps>();\r\n for (const subLayer of mapLayerSettings.subLayers) {\r\n subLayers.push((subLayerId === -1 || subLayer.id === subLayerId) ? subLayer.clone(props).toJSON() : subLayer.toJSON());\r\n }\r\n\r\n this.changeMapLayerProps({ subLayers }, mapLayerIndex);\r\n }\r\n\r\n /* @internal */\r\n private _synchBackgroundMapImagery() {\r\n this.settings.synchMapImagery();\r\n }\r\n\r\n /** Move map layer to top.\r\n * @param mapLayerIndex the [[MapLayerIndex]] of the map layer to move.\r\n * @public\r\n *\r\n */\r\n public moveMapLayerToTop(mapLayerIndex: MapLayerIndex) {\r\n const layers = this.getMapLayers(mapLayerIndex.isOverlay);\r\n const index = mapLayerIndex.index;\r\n if (index >= 0 && index < layers.length - 1) {\r\n const layer = layers.splice(index, 1);\r\n layers.push(layer[0]);\r\n this._synchBackgroundMapImagery();\r\n }\r\n }\r\n\r\n /** Move map layer to bottom.\r\n * @param mapLayerIndex the [[MapLayerIndex]] of the map layer to move.\r\n * @public\r\n */\r\n public moveMapLayerToBottom(mapLayerIndex: MapLayerIndex) {\r\n const layers = this.getMapLayers(mapLayerIndex.isOverlay);\r\n const index = mapLayerIndex.index;\r\n if (index > 0 && index < layers.length) {\r\n const layer = layers.splice(index, 1);\r\n layers.unshift(layer[0]);\r\n this._synchBackgroundMapImagery();\r\n }\r\n }\r\n\r\n /** Reorder map layers\r\n * @param fromIndex index of map layer to move\r\n * @param toIndex insert index. If equal to length of map array the map layer is moved to end of array.\r\n * @param isOverlay true if map-layer is part of the overlay map, otherwise it is part of the background map.\r\n * @public\r\n */\r\n public moveMapLayerToIndex(fromIndex: number, toIndex: number, isOverlay: boolean) {\r\n const layers = this.getMapLayers(isOverlay);\r\n if (fromIndex === toIndex)\r\n return;\r\n\r\n if (fromIndex < 0 || fromIndex >= layers.length || toIndex > layers.length)\r\n return;\r\n\r\n const layer = layers.splice(fromIndex, 1);\r\n layers.splice(toIndex, 0, layer[0]); // note: if toIndex === settings.mapImagery.backgroundLayers.length item is appended\r\n this._synchBackgroundMapImagery();\r\n }\r\n\r\n /** Flags controlling various aspects of the display style.\r\n * @see [DisplayStyleSettings.viewFlags]($common)\r\n */\r\n public get viewFlags(): ViewFlags { return this.settings.viewFlags; }\r\n public set viewFlags(flags: ViewFlags) { this.settings.viewFlags = flags; }\r\n\r\n /** The background color for this DisplayStyle */\r\n public get backgroundColor(): ColorDef { return this.settings.backgroundColor; }\r\n public set backgroundColor(val: ColorDef) { this.settings.backgroundColor = val; }\r\n\r\n /** The color used to draw geometry in monochrome mode.\r\n * @see [ViewFlags.monochrome]($common) for enabling monochrome mode.\r\n */\r\n public get monochromeColor(): ColorDef { return this.settings.monochromeColor; }\r\n public set monochromeColor(val: ColorDef) { this.settings.monochromeColor = val; }\r\n\r\n private _backgroundMapGeometry?: {\r\n bimElevationBias: number;\r\n geometry: BackgroundMapGeometry;\r\n globeMode: GlobeMode;\r\n };\r\n\r\n /** @internal */\r\n public anyMapLayersVisible(overlay: boolean): boolean {\r\n const layers = this.getMapLayers(overlay);\r\n\r\n for (const mapLayer of layers)\r\n if (mapLayer.visible)\r\n return true;\r\n\r\n return false;\r\n }\r\n\r\n private get _hasEarthLocation(): boolean {\r\n return undefined !== this.iModel.ecefLocation;\r\n }\r\n\r\n /** @internal */\r\n public getIsBackgroundMapVisible(): boolean {\r\n return this._hasEarthLocation && (this.viewFlags.backgroundMap || this.anyMapLayersVisible(false));\r\n }\r\n /** @internal */\r\n public get backgroundMapElevationBias(): number | undefined {\r\n if (this.backgroundMapSettings.applyTerrain) {\r\n const terrainSettings = this.backgroundMapSettings.terrainSettings;\r\n switch (terrainSettings.heightOriginMode) {\r\n case TerrainHeightOriginMode.Ground:\r\n return (undefined === this.iModel.projectCenterAltitude) ? undefined : terrainSettings.heightOrigin + terrainSettings.exaggeration * this.iModel.projectCenterAltitude;\r\n\r\n case TerrainHeightOriginMode.Geodetic:\r\n return terrainSettings.heightOrigin;\r\n\r\n case TerrainHeightOriginMode.Geoid:\r\n return (undefined === this.iModel.geodeticToSeaLevel) ? undefined : terrainSettings.heightOrigin + this.iModel.geodeticToSeaLevel;\r\n }\r\n } else {\r\n return this.backgroundMapSettings.groundBias;\r\n }\r\n\r\n }\r\n\r\n /** @internal */\r\n public getBackgroundMapGeometry(): BackgroundMapGeometry | undefined {\r\n if (!this._hasEarthLocation)\r\n return undefined;\r\n\r\n const bimElevationBias = this.backgroundMapElevationBias;\r\n\r\n if (undefined === bimElevationBias)\r\n return undefined;\r\n\r\n const globeMode = this.globeMode;\r\n if (undefined === this._backgroundMapGeometry || this._backgroundMapGeometry.globeMode !== globeMode || this._backgroundMapGeometry.bimElevationBias !== bimElevationBias) {\r\n const geometry = new BackgroundMapGeometry(bimElevationBias, globeMode, this.iModel);\r\n this._backgroundMapGeometry = { bimElevationBias, geometry, globeMode };\r\n }\r\n return this._backgroundMapGeometry.geometry;\r\n }\r\n\r\n /** [[ContextRealityModelState]]s attached to this display style.\r\n * @see [DisplayStyleSettings.contextRealityModels]($common).\r\n */\r\n public get contextRealityModelStates(): ReadonlyArray<ContextRealityModelState> {\r\n return this.settings.contextRealityModels.models as ContextRealityModelState[];\r\n }\r\n\r\n /** @internal */\r\n public getGlobalGeometryAndHeightRange(): { geometry: BackgroundMapGeometry, heightRange: Range1d } | undefined {\r\n let geometry = this.getIsBackgroundMapVisible() ? this.getBackgroundMapGeometry() : undefined;\r\n const terrainRange = ApproximateTerrainHeights.instance.globalHeightRange;\r\n let heightRange = this.displayTerrain ? terrainRange : Range1d.createXX(-1, 1);\r\n if (this.globeMode === GlobeMode.Ellipsoid && this._hasEarthLocation && this.contextRealityModelStates.find((model) => model.isGlobal)) {\r\n if (!geometry) {\r\n if (!this._ellipsoidMapGeometry)\r\n this._ellipsoidMapGeometry = new BackgroundMapGeometry(0, GlobeMode.Ellipsoid, this.iModel);\r\n\r\n geometry = this._ellipsoidMapGeometry;\r\n }\r\n\r\n heightRange = terrainRange;\r\n }\r\n\r\n return geometry ? { geometry, heightRange } : undefined;\r\n }\r\n\r\n /** Returns true if this is a 3d display style. */\r\n public is3d(): this is DisplayStyle3dState { return this instanceof DisplayStyle3dState; }\r\n\r\n /** Customize the way geometry belonging to a [[SubCategory]] is drawn by this display style.\r\n * @param id The ID of the SubCategory whose appearance is to be overridden.\r\n * @param ovr The overrides to apply to the [[SubCategoryAppearance]].\r\n * @see [[dropSubCategoryOverride]]\r\n */\r\n public overrideSubCategory(id: Id64String, ovr: SubCategoryOverride) { this.settings.overrideSubCategory(id, ovr); }\r\n\r\n /** Remove any [[SubCategoryOverride]] applied to a [[SubCategoryAppearance]] by this style.\r\n * @param id The ID of the [[SubCategory]].\r\n * @see [[overrideSubCategory]]\r\n */\r\n public dropSubCategoryOverride(id: Id64String) { this.settings.dropSubCategoryOverride(id); }\r\n\r\n /** Returns true if an [[SubCategoryOverride]]s are defined by this style. */\r\n public get hasSubCategoryOverride() { return this.settings.hasSubCategoryOverride; }\r\n\r\n /** Obtain the overrides applied to a [[SubCategoryAppearance]] by this style.\r\n * @param id The ID of the [[SubCategory]].\r\n * @returns The corresponding SubCategoryOverride, or undefined if the SubCategory's appearance is not overridden.\r\n * @see [[overrideSubCategory]]\r\n */\r\n public getSubCategoryOverride(id: Id64String): SubCategoryOverride | undefined { return this.settings.getSubCategoryOverride(id); }\r\n\r\n /** For each subcategory belonging to any of the specified categories, make it visible by turning off the \"invisible\" flag in its subcategory appearance.\r\n * This requires that the categories and subcategories have been previously loaded by, e.g., a call to IModelConnection.querySubCategories.\r\n * @returns true if the visibility of any subcategory was modified.\r\n * @see Viewport.changeCategoryDisplay\r\n * @see ViewCreator3dOptions.allSubCategoriesVisible\r\n * @internal\r\n */\r\n public enableAllLoadedSubCategories(categoryIds: Id64Arg): boolean {\r\n let anyChanged = false;\r\n for (const categoryId of Id64.iterable(categoryIds)) {\r\n const subCategoryIds = this.iModel.subcategories.getSubCategories(categoryId);\r\n if (undefined !== subCategoryIds)\r\n for (const subCategoryId of subCategoryIds)\r\n if (this.setSubCategoryVisible(subCategoryId, true))\r\n anyChanged = true;\r\n }\r\n\r\n return anyChanged;\r\n }\r\n\r\n /** Change the \"invisible\" flag for the given subcategory's appearance.\r\n * This requires that the subcategory appearance has been previously loaded by, e.g., a call to IModelConnection.Categories.getSubCategoryInfo.\r\n * @returns true if the visibility of any subcategory was modified.\r\n * @see [[enableAllLoadedSubCategories]]\r\n * @internal\r\n */\r\n public setSubCategoryVisible(subCategoryId: Id64String, visible: boolean): boolean {\r\n const app = this.iModel.subcategories.getSubCategoryAppearance(subCategoryId);\r\n if (undefined === app)\r\n return false; // category not enabled or subcategory not found\r\n\r\n const curOvr = this.getSubCategoryOverride(subCategoryId);\r\n const isAlreadyVisible = undefined !== curOvr && undefined !== curOvr.invisible ? !curOvr.invisible : !app.invisible;\r\n if (isAlreadyVisible === visible)\r\n return false;\r\n\r\n // Preserve existing overrides - just flip the visibility flag.\r\n const json = undefined !== curOvr ? curOvr.toJSON() : {};\r\n json.invisible = !visible;\r\n this.overrideSubCategory(subCategoryId, SubCategoryOverride.fromJSON(json));\r\n return true;\r\n }\r\n\r\n /** Returns true if solar shadow display is enabled by this display style. */\r\n public get wantShadows(): boolean {\r\n return this.is3d() && this.viewFlags.shadows && false !== IModelApp.renderSystem.options.displaySolarShadows;\r\n }\r\n\r\n /** @internal */\r\n protected registerSettingsEventListeners(): void {\r\n this.settings.onScheduleScriptPropsChanged.addListener((scriptProps) => {\r\n if (this._assigningScript)\r\n return;\r\n\r\n try {\r\n this._assigningScript = true;\r\n if (scriptProps)\r\n this.loadScriptReferenceFromScript(scriptProps);\r\n else\r\n this.loadScriptReferenceFromTimeline(this.settings.renderTimeline); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n } finally {\r\n this._assigningScript = false;\r\n }\r\n });\r\n\r\n this.settings.onRenderTimelineChanged.addListener((newTimeline) => {\r\n // Cancel any in-progress loading of script from timeline.\r\n this._queryRenderTimelinePropsPromise = undefined;\r\n\r\n if (!this.settings.scheduleScriptProps)\r\n this.loadScriptReferenceFromTimeline(newTimeline); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n });\r\n\r\n this.settings.onPlanarClipMaskChanged.addListener((id, newSettings) => {\r\n if (newSettings)\r\n this._attachedRealityModelPlanarClipMasks.set(id, PlanarClipMaskState.create(newSettings));\r\n else\r\n this._attachedRealityModelPlanarClipMasks.delete(id);\r\n });\r\n }\r\n\r\n /** @internal */\r\n protected createRealityModel(props: ContextRealityModelProps): ContextRealityModelState {\r\n return new ContextRealityModelState(props, this.iModel, this);\r\n }\r\n\r\n /** @internal */\r\n public getPlanarClipMaskState(modelId: Id64String): PlanarClipMaskState | undefined {\r\n const model = this.iModel.models.getLoaded(modelId)?.asSpatialModel;\r\n return (model && model.isRealityModel) ? this._attachedRealityModelPlanarClipMasks.get(modelId) : undefined;\r\n }\r\n}\r\n\r\n/** A display style that can be applied to 2d views.\r\n * @public\r\n * @extensions\r\n */\r\nexport class DisplayStyle2dState extends DisplayStyleState {\r\n public static override get className() { return \"DisplayStyle2d\"; }\r\n private readonly _settings: DisplayStyleSettings;\r\n\r\n public get settings(): DisplayStyleSettings { return this._settings; }\r\n\r\n /** @internal */\r\n public overrideTerrainDisplay(): TerrainDisplayOverrides | undefined { return undefined; }\r\n\r\n constructor(props: DisplayStyleProps, iModel: IModelConnection) {\r\n super(props, iModel);\r\n this._settings = new DisplayStyleSettings(this.jsonProperties, {\r\n createContextRealityModel: (modelProps) => this.createRealityModel(modelProps),\r\n deferContextRealityModels: true,\r\n });\r\n\r\n this._settings.contextRealityModels.populate();\r\n this.registerSettingsEventListeners();\r\n }\r\n}\r\n\r\n/** A [[DisplayStyleState]] that can be applied to spatial views.\r\n * @public\r\n * @extensions\r\n */\r\nexport class DisplayStyle3dState extends DisplayStyleState {\r\n public static override get className() { return \"DisplayStyle3d\"; }\r\n private _settings: DisplayStyle3dSettings;\r\n\r\n public get settings(): DisplayStyle3dSettings { return this._settings; }\r\n\r\n public constructor(props: DisplayStyleProps, iModel: IModelConnection, source?: DisplayStyle3dState) {\r\n super(props, iModel, source);\r\n this._settings = new DisplayStyle3dSettings(this.jsonProperties, {\r\n createContextRealityModel: (modelProps) => this.createRealityModel(modelProps),\r\n deferContextRealityModels: true,\r\n });\r\n\r\n this._settings.contextRealityModels.populate();\r\n this.registerSettingsEventListeners();\r\n }\r\n\r\n public get environment(): Environment {\r\n return this.settings.environment;\r\n }\r\n public set environment(env: Environment) {\r\n this.settings.environment = env;\r\n }\r\n\r\n public get lights(): LightSettings { return this.settings.lights; }\r\n public set lights(lights: LightSettings) { this.settings.lights = lights; }\r\n\r\n /** The direction of the solar light. */\r\n public get sunDirection(): Readonly<Vector3d> {\r\n return this.settings.lights.solar.direction;\r\n }\r\n\r\n /** Set the solar light direction based on time value\r\n * @param time The time in unix time milliseconds.\r\n * @see [DisplayStyle3dSettings.sunTime]($common) to obtain the current sun time.\r\n * @see [DisplayStyle3dSettings.setSunTime]($common).\r\n */\r\n public setSunTime(time: number) {\r\n this.settings.setSunTime(time, this.iModel);\r\n }\r\n\r\n /** Settings controlling shadow display. */\r\n public get solarShadows(): SolarShadowSettings {\r\n return this.settings.solarShadows;\r\n }\r\n public set solarShadows(settings: SolarShadowSettings) {\r\n this.settings.solarShadows = settings;\r\n }\r\n\r\n /** @internal */\r\n protected override registerSettingsEventListeners(): void {\r\n super.registerSettingsEventListeners();\r\n\r\n this.settings.onOverridesApplied.addListener((overrides: DisplayStyle3dSettingsProps) => {\r\n if (overrides.thematic && this.settings.thematic.displayMode === ThematicDisplayMode.Height && undefined === overrides.thematic.range) {\r\n // Use the project extents as reasonable default height range.\r\n // NB: assumes using Z axis...\r\n const extents = this.iModel.projectExtents;\r\n const props = { ...overrides.thematic };\r\n props.range = { low: extents.zLow, high: extents.zHigh };\r\n this.settings.thematic = ThematicDisplay.fromJSON(props);\r\n }\r\n });\r\n }\r\n\r\n /** @internal */\r\n public overrideTerrainDisplay(): TerrainDisplayOverrides | undefined {\r\n if (undefined !== this.settings.thematic) {\r\n const ovr = new TerrainDisplayOverrides();\r\n if (this.viewFlags.thematicDisplay && ThematicGradientMode.IsoLines === this.settings.thematic.gradientSettings.mode)\r\n ovr.wantSkirts = false;\r\n if (this.viewFlags.thematicDisplay && (ThematicDisplayMode.Slope === this.settings.thematic.displayMode || ThematicDisplayMode.HillShade === this.settings.thematic.displayMode))\r\n ovr.wantNormals = true;\r\n return ovr;\r\n }\r\n return undefined;\r\n }\r\n}\r\n"]}
@@ -86,7 +86,7 @@ export declare abstract class PrimitiveTool extends InteractiveTool {
86
86
  redoPreviousStep(): Promise<boolean>;
87
87
  /**
88
88
  * If this tool is editing a briefcase, commits any elements that the tool has changed, supplying the tool flyover for the undo description.
89
- * @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use methods on [[EditCommand]] IPC instead.
89
+ * @deprecated in 5.9.0 - will not be removed until after 2027-05-04. Use methods on [[EditCommand]] IPC instead.
90
90
  */
91
91
  saveChanges(): Promise<void>;
92
92
  }
@@ -169,7 +169,7 @@ class PrimitiveTool extends Tool_1.InteractiveTool {
169
169
  }
170
170
  /**
171
171
  * If this tool is editing a briefcase, commits any elements that the tool has changed, supplying the tool flyover for the undo description.
172
- * @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use methods on [[EditCommand]] IPC instead.
172
+ * @deprecated in 5.9.0 - will not be removed until after 2027-05-04. Use methods on [[EditCommand]] IPC instead.
173
173
  */
174
174
  async saveChanges() {
175
175
  if (this.iModel.isBriefcaseConnection())
@@ -1 +1 @@
1
- {"version":3,"file":"PrimitiveTool.js","sourceRoot":"","sources":["../../../src/tools/PrimitiveTool.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA6C;AAE7C,4CAAyC;AAEzC,gEAAqF;AAErF,iDAAmD;AACnD,iCAAsG;AAEtG;;;;GAIG;AACH,MAAsB,aAAc,SAAQ,sBAAe;IACzD;;OAEG;IACI,UAAU,CAAY;IACrB,cA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,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,WAAW;QACtB,IAAI,IAAI,CAAC,MAAM,CAAC,qBAAqB,EAAE;YACrC,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,uDAAuD;IACzG,CAAC;CACF;AAjND,sCAiNC","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 Tools\r\n */\r\n\r\nimport { assert } from \"@itwin/core-bentley\";\r\nimport { BriefcaseConnection } from \"../BriefcaseConnection\";\r\nimport { IModelApp } from \"../IModelApp\";\r\nimport { IModelConnection } from \"../IModelConnection\";\r\nimport { NotifyMessageDetails, OutputMessagePriority } from \"../NotificationManager\";\r\nimport { Viewport } from \"../Viewport\";\r\nimport { AccuDrawShortcuts } from \"./AccuDrawTool\";\r\nimport { BeButton, BeButtonEvent, CoordinateLockOverrides, CoreTools, InteractiveTool } from \"./Tool\";\r\n\r\n/** The PrimitiveTool class can be used to implement tools to create or modify geometric elements.\r\n * @see [Writing a PrimitiveTool]($docs/learning/frontend/primitivetools.md)\r\n * @public\r\n * @extensions\r\n */\r\nexport abstract class PrimitiveTool extends InteractiveTool {\r\n /** The viewport within which the tool operates.\r\n * @note This property is only initialized if [[run]] returns `true`, causing the tool to be installed.\r\n */\r\n public targetView?: Viewport;\r\n private _targetModelId?: string;\r\n public get targetModelId() { return this._targetModelId; }\r\n public set targetModelId(v: string | undefined) { this._targetModelId = v; }\r\n public targetIsLocked: boolean = false; // If target model is known, set this to true in constructor and override getTargetModel.\r\n\r\n /** Get the iModel on which this tool operates.\r\n * @note The iModel is obtained from [[targetView]], so should only be invoked if the tool installed successfully.\r\n */\r\n public get iModel(): IModelConnection {\r\n assert(undefined !== this.targetView);\r\n return this.targetView.view.iModel;\r\n }\r\n\r\n /** Get the briefcase on which this tool operates, if the tool has successfully installed and the target [[iModel]] is a briefcase. */\r\n public get briefcase(): BriefcaseConnection | undefined {\r\n const iModel = this.targetView?.view.iModel;\r\n return iModel?.isBriefcaseConnection() ? iModel : undefined;\r\n }\r\n\r\n /**\r\n * Establish this tool as the active PrimitiveTool.\r\n * @return true if this tool was installed (though it may have exited too)\r\n * @note If you override this method you **must** call `super.run` and return false if it returns false.\r\n */\r\n public override async run(..._args: any[]): Promise<boolean> {\r\n const { toolAdmin, viewManager } = IModelApp;\r\n if (!this.isCompatibleViewport(viewManager.selectedView, false))\r\n return false;\r\n\r\n if (!await toolAdmin.onInstallTool(this))\r\n return false;\r\n\r\n await toolAdmin.startPrimitiveTool(this);\r\n // If another tool was installed at the same time (due to concurrent run calls),\r\n // the last start to complete wins. Detect that situation and return false.\r\n if (toolAdmin.primitiveTool !== this)\r\n return false;\r\n\r\n await toolAdmin.onPostInstallTool(this);\r\n return true;\r\n }\r\n\r\n /** Determine whether the supplied Viewport is compatible with this tool.\r\n * @param vp the Viewport to check\r\n */\r\n public override isCompatibleViewport(vp: Viewport | undefined, isSelectedViewChange: boolean): boolean {\r\n if (undefined === vp)\r\n return false; // No views are open...\r\n\r\n const view = vp.view;\r\n const iModel = view.iModel;\r\n\r\n if (this.requireWriteableTarget() && iModel.isReadonly)\r\n return false; // this Tool can't be used when iModel is read only.\r\n\r\n if (undefined === this.targetView || (!this.targetIsLocked && isSelectedViewChange))\r\n this.targetView = vp; // Update target to new view if undefined or still free to change.\r\n\r\n if (undefined === this.targetModelId && (!this.targetIsLocked || vp === this.targetView))\r\n return true; // Accept if this view is current target or any type of model/view is still ok as target is still free to change.\r\n\r\n if (iModel !== this.iModel)\r\n return false; // Once a ViewState has been established, only accept viewport showing the same iModel.\r\n\r\n if (this.targetModelId)\r\n return view.viewsModel(this.targetModelId); // If a specific target model is specified, only allow view that shows it.\r\n\r\n if (view.isSpatialView() && this.targetView.view.isSpatialView())\r\n return true; // No specific target, two spatial views are considered compatible.\r\n\r\n let allowView = false;\r\n const targetView = this.targetView;\r\n view.forEachModel((model) => {\r\n if (!allowView && targetView.view.viewsModel(model.id))\r\n allowView = true;\r\n });\r\n\r\n return allowView; // Accept if this view shares a model in common with target.\r\n }\r\n\r\n /**\r\n * Checks that the adjusted point from the supplied button event is within the project extents for spatial views. The range of physical geometry\r\n * should always be fully inside the project extents. Only checking the adjusted point won't absolutely guarantee that a tool doesn't create/move geometry\r\n * outside the project extents, but it will be sufficient to handle most cases and provide good feedback to the user.\r\n * @return true if ev is acceptable.\r\n */\r\n public override isValidLocation(ev: BeButtonEvent, isButtonEvent: boolean): boolean {\r\n const vp = ev.viewport;\r\n if (undefined === vp)\r\n return false;\r\n\r\n if (isButtonEvent && BeButton.Data !== ev.button)\r\n return true;\r\n\r\n const view = vp.view;\r\n if (!view.isSpatialView())\r\n return true;\r\n\r\n // NOTE: If points aren't being adjusted then the tool shouldn't be creating geometry currently (ex. locating elements) and we shouldn't filter point...\r\n if (0 !== (IModelApp.toolAdmin.toolState.coordLockOvr & CoordinateLockOverrides.ACS))\r\n return true;\r\n\r\n // We know the tool isn't doing a locate, we don't know what it will do with this point. Minimize erroneous filtering by restricting the check to when AccuSnap is tool enable (not user enabled)...\r\n if (!IModelApp.accuSnap.isSnapEnabled)\r\n return true;\r\n\r\n const extents = view.iModel.projectExtents;\r\n if (extents.containsPoint(ev.point))\r\n return true;\r\n\r\n if (isButtonEvent && ev.isDown)\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, CoreTools.translate(\"ElementSet.Error.ProjectExtents\")));\r\n\r\n return false;\r\n }\r\n\r\n /** Called on data button down event to lock the tool to its current target model. */\r\n public autoLockTarget(): void {\r\n if (undefined === this.targetView)\r\n return;\r\n\r\n this.targetIsLocked = true;\r\n }\r\n\r\n /** Returns the prompt based on the tool's current state. */\r\n public getPrompt(): string { return \"\"; }\r\n\r\n /** Called from isCompatibleViewport to check for a read only iModel, which is not a valid target for tools that create or modify elements. */\r\n public requireWriteableTarget(): boolean { return true; }\r\n\r\n /**\r\n * Called when active view changes. Tool may choose to restart or exit based on current view type.\r\n * @param _previous The previously active view.\r\n * @param current The new active view.\r\n */\r\n public override async onSelectedViewportChanged(_previous: Viewport | undefined, current: Viewport | undefined): Promise<void> {\r\n if (this.isCompatibleViewport(current, true))\r\n return;\r\n return this.onRestartTool();\r\n }\r\n\r\n /**\r\n * Called when an external event may invalidate the current tool's state.\r\n * Examples are undo, which may invalidate any references to elements, or an incompatible active view change.\r\n * The active tool is expected to call installTool with a new instance, or exitTool to start the default tool.\r\n * ```ts\r\n * const tool = new MyPrimitiveTool();\r\n * if (!await tool.run())\r\n * return this.exitTool(); // Don't leave current instance active if new instance rejects install...\r\n * ```\r\n */\r\n public abstract onRestartTool(): Promise<void>;\r\n\r\n /**\r\n * Called to reset tool to initial state. PrimitiveTool implements this method to call onRestartTool.\r\n */\r\n public override async onReinitialize(): Promise<void> { return this.onRestartTool(); }\r\n\r\n public async exitTool() { return IModelApp.toolAdmin.startDefaultTool(); }\r\n\r\n /**\r\n * Called to reverse to a previous tool state (ex. undo last data button).\r\n * @return false to instead reverse the most recent transaction.\r\n */\r\n public async onUndoPreviousStep(): Promise<boolean> { return false; }\r\n\r\n /** @internal */\r\n public async undoPreviousStep(): Promise<boolean> {\r\n if (!await this.onUndoPreviousStep())\r\n return false;\r\n\r\n AccuDrawShortcuts.processPendingHints(); // Process pending hints from onUndoPreviousStep before calling updateDynamics...\r\n IModelApp.viewManager.invalidateDecorationsAllViews();\r\n IModelApp.toolAdmin.updateDynamics(undefined, undefined, true); // Don't wait for motion to update dynamics...\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Called to reinstate to a previous tool state (ex. redo last data button).\r\n * @return false to instead reinstate the most recent transaction.\r\n */\r\n public async onRedoPreviousStep(): Promise<boolean> { return false; }\r\n\r\n /** @internal */\r\n public async redoPreviousStep(): Promise<boolean> {\r\n if (!await this.onRedoPreviousStep())\r\n return false;\r\n\r\n AccuDrawShortcuts.processPendingHints(); // Process pending hints from onRedoPreviousStep before calling updateDynamics...\r\n IModelApp.viewManager.invalidateDecorationsAllViews();\r\n IModelApp.toolAdmin.updateDynamics(undefined, undefined, true); // Don't wait for motion to update dynamics...\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * If this tool is editing a briefcase, commits any elements that the tool has changed, supplying the tool flyover for the undo description.\r\n * @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use methods on [[EditCommand]] IPC instead.\r\n */\r\n public async saveChanges(): Promise<void> {\r\n if (this.iModel.isBriefcaseConnection())\r\n return this.iModel.saveChanges(this.flyover); // eslint-disable-line @typescript-eslint/no-deprecated\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"PrimitiveTool.js","sourceRoot":"","sources":["../../../src/tools/PrimitiveTool.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA6C;AAE7C,4CAAyC;AAEzC,gEAAqF;AAErF,iDAAmD;AACnD,iCAAsG;AAEtG;;;;GAIG;AACH,MAAsB,aAAc,SAAQ,sBAAe;IACzD;;OAEG;IACI,UAAU,CAAY;IACrB,cAAc,CAAU;IAChC,IAAW,aAAa,KAAK,OAAO,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC;IAC1D,IAAW,aAAa,CAAC,CAAqB,IAAI,IAAI,CAAC,cAAc,GAAG,CAAC,CAAC,CAAC,CAAC;IACrE,cAAc,GAAY,KAAK,CAAC,CAAC,yFAAyF;IAEjI;;OAEG;IACH,IAAW,MAAM;QACf,IAAA,qBAAM,EAAC,SAAS,KAAK,IAAI,CAAC,UAAU,CAAC,CAAC;QACtC,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC;IACrC,CAAC;IAED,sIAAsI;IACtI,IAAW,SAAS;QAClB,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC;QAC5C,OAA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IAAI,CAAC,MAAM,IAAI,CAAC,kBAAkB,EAAE;YAClC,OAAO,KAAK,CAAC;QAEf,gCAAiB,CAAC,mBAAmB,EAAE,CAAC,CAAC,iFAAiF;QAC1H,qBAAS,CAAC,WAAW,CAAC,6BAA6B,EAAE,CAAC;QACtD,qBAAS,CAAC,SAAS,CAAC,cAAc,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,8CAA8C;QAE9G,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,kBAAkB,KAAuB,OAAO,KAAK,CAAC,CAAC,CAAC;IAErE,gBAAgB;IACT,KAAK,CAAC,gBAAgB;QAC3B,IAAI,CAAC,MAAM,IAAI,CAAC,kBAAkB,EAAE;YAClC,OAAO,KAAK,CAAC;QAEf,gCAAiB,CAAC,mBAAmB,EAAE,CAAC,CAAC,iFAAiF;QAC1H,qBAAS,CAAC,WAAW,CAAC,6BAA6B,EAAE,CAAC;QACtD,qBAAS,CAAC,SAAS,CAAC,cAAc,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,8CAA8C;QAE9G,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,WAAW;QACtB,IAAI,IAAI,CAAC,MAAM,CAAC,qBAAqB,EAAE;YACrC,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,uDAAuD;IACzG,CAAC;CACF;AAjND,sCAiNC","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 Tools\r\n */\r\n\r\nimport { assert } from \"@itwin/core-bentley\";\r\nimport { BriefcaseConnection } from \"../BriefcaseConnection\";\r\nimport { IModelApp } from \"../IModelApp\";\r\nimport { IModelConnection } from \"../IModelConnection\";\r\nimport { NotifyMessageDetails, OutputMessagePriority } from \"../NotificationManager\";\r\nimport { Viewport } from \"../Viewport\";\r\nimport { AccuDrawShortcuts } from \"./AccuDrawTool\";\r\nimport { BeButton, BeButtonEvent, CoordinateLockOverrides, CoreTools, InteractiveTool } from \"./Tool\";\r\n\r\n/** The PrimitiveTool class can be used to implement tools to create or modify geometric elements.\r\n * @see [Writing a PrimitiveTool]($docs/learning/frontend/primitivetools.md)\r\n * @public\r\n * @extensions\r\n */\r\nexport abstract class PrimitiveTool extends InteractiveTool {\r\n /** The viewport within which the tool operates.\r\n * @note This property is only initialized if [[run]] returns `true`, causing the tool to be installed.\r\n */\r\n public targetView?: Viewport;\r\n private _targetModelId?: string;\r\n public get targetModelId() { return this._targetModelId; }\r\n public set targetModelId(v: string | undefined) { this._targetModelId = v; }\r\n public targetIsLocked: boolean = false; // If target model is known, set this to true in constructor and override getTargetModel.\r\n\r\n /** Get the iModel on which this tool operates.\r\n * @note The iModel is obtained from [[targetView]], so should only be invoked if the tool installed successfully.\r\n */\r\n public get iModel(): IModelConnection {\r\n assert(undefined !== this.targetView);\r\n return this.targetView.view.iModel;\r\n }\r\n\r\n /** Get the briefcase on which this tool operates, if the tool has successfully installed and the target [[iModel]] is a briefcase. */\r\n public get briefcase(): BriefcaseConnection | undefined {\r\n const iModel = this.targetView?.view.iModel;\r\n return iModel?.isBriefcaseConnection() ? iModel : undefined;\r\n }\r\n\r\n /**\r\n * Establish this tool as the active PrimitiveTool.\r\n * @return true if this tool was installed (though it may have exited too)\r\n * @note If you override this method you **must** call `super.run` and return false if it returns false.\r\n */\r\n public override async run(..._args: any[]): Promise<boolean> {\r\n const { toolAdmin, viewManager } = IModelApp;\r\n if (!this.isCompatibleViewport(viewManager.selectedView, false))\r\n return false;\r\n\r\n if (!await toolAdmin.onInstallTool(this))\r\n return false;\r\n\r\n await toolAdmin.startPrimitiveTool(this);\r\n // If another tool was installed at the same time (due to concurrent run calls),\r\n // the last start to complete wins. Detect that situation and return false.\r\n if (toolAdmin.primitiveTool !== this)\r\n return false;\r\n\r\n await toolAdmin.onPostInstallTool(this);\r\n return true;\r\n }\r\n\r\n /** Determine whether the supplied Viewport is compatible with this tool.\r\n * @param vp the Viewport to check\r\n */\r\n public override isCompatibleViewport(vp: Viewport | undefined, isSelectedViewChange: boolean): boolean {\r\n if (undefined === vp)\r\n return false; // No views are open...\r\n\r\n const view = vp.view;\r\n const iModel = view.iModel;\r\n\r\n if (this.requireWriteableTarget() && iModel.isReadonly)\r\n return false; // this Tool can't be used when iModel is read only.\r\n\r\n if (undefined === this.targetView || (!this.targetIsLocked && isSelectedViewChange))\r\n this.targetView = vp; // Update target to new view if undefined or still free to change.\r\n\r\n if (undefined === this.targetModelId && (!this.targetIsLocked || vp === this.targetView))\r\n return true; // Accept if this view is current target or any type of model/view is still ok as target is still free to change.\r\n\r\n if (iModel !== this.iModel)\r\n return false; // Once a ViewState has been established, only accept viewport showing the same iModel.\r\n\r\n if (this.targetModelId)\r\n return view.viewsModel(this.targetModelId); // If a specific target model is specified, only allow view that shows it.\r\n\r\n if (view.isSpatialView() && this.targetView.view.isSpatialView())\r\n return true; // No specific target, two spatial views are considered compatible.\r\n\r\n let allowView = false;\r\n const targetView = this.targetView;\r\n view.forEachModel((model) => {\r\n if (!allowView && targetView.view.viewsModel(model.id))\r\n allowView = true;\r\n });\r\n\r\n return allowView; // Accept if this view shares a model in common with target.\r\n }\r\n\r\n /**\r\n * Checks that the adjusted point from the supplied button event is within the project extents for spatial views. The range of physical geometry\r\n * should always be fully inside the project extents. Only checking the adjusted point won't absolutely guarantee that a tool doesn't create/move geometry\r\n * outside the project extents, but it will be sufficient to handle most cases and provide good feedback to the user.\r\n * @return true if ev is acceptable.\r\n */\r\n public override isValidLocation(ev: BeButtonEvent, isButtonEvent: boolean): boolean {\r\n const vp = ev.viewport;\r\n if (undefined === vp)\r\n return false;\r\n\r\n if (isButtonEvent && BeButton.Data !== ev.button)\r\n return true;\r\n\r\n const view = vp.view;\r\n if (!view.isSpatialView())\r\n return true;\r\n\r\n // NOTE: If points aren't being adjusted then the tool shouldn't be creating geometry currently (ex. locating elements) and we shouldn't filter point...\r\n if (0 !== (IModelApp.toolAdmin.toolState.coordLockOvr & CoordinateLockOverrides.ACS))\r\n return true;\r\n\r\n // We know the tool isn't doing a locate, we don't know what it will do with this point. Minimize erroneous filtering by restricting the check to when AccuSnap is tool enable (not user enabled)...\r\n if (!IModelApp.accuSnap.isSnapEnabled)\r\n return true;\r\n\r\n const extents = view.iModel.projectExtents;\r\n if (extents.containsPoint(ev.point))\r\n return true;\r\n\r\n if (isButtonEvent && ev.isDown)\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, CoreTools.translate(\"ElementSet.Error.ProjectExtents\")));\r\n\r\n return false;\r\n }\r\n\r\n /** Called on data button down event to lock the tool to its current target model. */\r\n public autoLockTarget(): void {\r\n if (undefined === this.targetView)\r\n return;\r\n\r\n this.targetIsLocked = true;\r\n }\r\n\r\n /** Returns the prompt based on the tool's current state. */\r\n public getPrompt(): string { return \"\"; }\r\n\r\n /** Called from isCompatibleViewport to check for a read only iModel, which is not a valid target for tools that create or modify elements. */\r\n public requireWriteableTarget(): boolean { return true; }\r\n\r\n /**\r\n * Called when active view changes. Tool may choose to restart or exit based on current view type.\r\n * @param _previous The previously active view.\r\n * @param current The new active view.\r\n */\r\n public override async onSelectedViewportChanged(_previous: Viewport | undefined, current: Viewport | undefined): Promise<void> {\r\n if (this.isCompatibleViewport(current, true))\r\n return;\r\n return this.onRestartTool();\r\n }\r\n\r\n /**\r\n * Called when an external event may invalidate the current tool's state.\r\n * Examples are undo, which may invalidate any references to elements, or an incompatible active view change.\r\n * The active tool is expected to call installTool with a new instance, or exitTool to start the default tool.\r\n * ```ts\r\n * const tool = new MyPrimitiveTool();\r\n * if (!await tool.run())\r\n * return this.exitTool(); // Don't leave current instance active if new instance rejects install...\r\n * ```\r\n */\r\n public abstract onRestartTool(): Promise<void>;\r\n\r\n /**\r\n * Called to reset tool to initial state. PrimitiveTool implements this method to call onRestartTool.\r\n */\r\n public override async onReinitialize(): Promise<void> { return this.onRestartTool(); }\r\n\r\n public async exitTool() { return IModelApp.toolAdmin.startDefaultTool(); }\r\n\r\n /**\r\n * Called to reverse to a previous tool state (ex. undo last data button).\r\n * @return false to instead reverse the most recent transaction.\r\n */\r\n public async onUndoPreviousStep(): Promise<boolean> { return false; }\r\n\r\n /** @internal */\r\n public async undoPreviousStep(): Promise<boolean> {\r\n if (!await this.onUndoPreviousStep())\r\n return false;\r\n\r\n AccuDrawShortcuts.processPendingHints(); // Process pending hints from onUndoPreviousStep before calling updateDynamics...\r\n IModelApp.viewManager.invalidateDecorationsAllViews();\r\n IModelApp.toolAdmin.updateDynamics(undefined, undefined, true); // Don't wait for motion to update dynamics...\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Called to reinstate to a previous tool state (ex. redo last data button).\r\n * @return false to instead reinstate the most recent transaction.\r\n */\r\n public async onRedoPreviousStep(): Promise<boolean> { return false; }\r\n\r\n /** @internal */\r\n public async redoPreviousStep(): Promise<boolean> {\r\n if (!await this.onRedoPreviousStep())\r\n return false;\r\n\r\n AccuDrawShortcuts.processPendingHints(); // Process pending hints from onRedoPreviousStep before calling updateDynamics...\r\n IModelApp.viewManager.invalidateDecorationsAllViews();\r\n IModelApp.toolAdmin.updateDynamics(undefined, undefined, true); // Don't wait for motion to update dynamics...\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * If this tool is editing a briefcase, commits any elements that the tool has changed, supplying the tool flyover for the undo description.\r\n * @deprecated in 5.9.0 - will not be removed until after 2027-05-04. Use methods on [[EditCommand]] IPC instead.\r\n */\r\n public async saveChanges(): Promise<void> {\r\n if (this.iModel.isBriefcaseConnection())\r\n return this.iModel.saveChanges(this.flyover); // eslint-disable-line @typescript-eslint/no-deprecated\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"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,OAAO,GAAG,MAAM,GAAG,SAAS;IAgBzD,gBAAgB;IACT,gCAAgC,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,4BAA4B,EAAE,aAAa,CAAC,EAAE,OAAO,GAAG,OAAO;IA4IxK,qBAAqB,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,OAAO;CAoDvE;AAED;;;GAGG;AACH,wBAAsB,oCAAoC,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAsCtI"}
@@ -300,7 +300,14 @@ export class BackgroundMapGeometry {
300
300
  const eyePoint4d = eyePoint ? Point4d.createFromPointAndWeight(eyePoint, 1) : Point4d.createFromPointAndWeight(viewZ, 0);
301
301
  for (const radiusOffset of radiusOffsets) {
302
302
  const ellipsoid = this.getEarthEllipsoid(radiusOffset);
303
- const isInside = eyePoint && expectDefined(ellipsoid.worldToLocal(eyePoint)).magnitude() < 1.0;
303
+ const eyeLocal = eyePoint ? ellipsoid.worldToLocal(eyePoint) : undefined;
304
+ if (eyePoint && undefined === eyeLocal) {
305
+ // If the globe transform cannot map the eye point into ellipsoid-local
306
+ // space, treat the globe as unavailable here and let the caller fall
307
+ // back to its extents-based depth fitting.
308
+ return Range1d.createNull();
309
+ }
310
+ const isInside = eyeLocal !== undefined && eyeLocal.magnitude() < 1.0;
304
311
  const center = ellipsoid.localToWorld(scratchZeroPoint, scratchCenterPoint);
305
312
  const clipPlaneCount = clipPlanes.planes.length;
306
313
  // Extrema...
@@ -330,10 +337,22 @@ export class BackgroundMapGeometry {
330
337
  if (Vector3d.createStartEnd(silhouette.center, bimRange.center).dotProduct(scratchSilhouetteNormal) < 0)
331
338
  scratchSilhouetteNormal.negate(scratchSilhouetteNormal);
332
339
  }
333
- clipPlanes.planes.push(expectDefined(ClipPlane.createNormalAndDistance(scratchSilhouetteNormal, scratchSilhouetteNormal.dotProduct(silhouette.center))));
340
+ // The silhouette arc is the horizon between the visible and hidden
341
+ // halves of the globe. Its perpendicular vector is the normal of the
342
+ // clip plane that keeps us on the visible side. If that plane cannot
343
+ // be constructed, fall back to a view-aligned plane through the
344
+ // ellipsoid center instead of pushing an invalid entry.
345
+ const silhouettePlane = ClipPlane.createNormalAndDistance(scratchSilhouetteNormal, scratchSilhouetteNormal.dotProduct(silhouette.center))
346
+ ?? ClipPlane.createNormalAndPoint(viewZ, center);
347
+ if (undefined === silhouettePlane)
348
+ return Range1d.createNull();
349
+ clipPlanes.planes.push(silhouettePlane);
334
350
  }
335
351
  else {
336
- clipPlanes.planes.push(expectDefined(ClipPlane.createNormalAndPoint(viewZ, center)));
352
+ const centerPlane = ClipPlane.createNormalAndPoint(viewZ, center);
353
+ if (undefined === centerPlane)
354
+ return Range1d.createNull();
355
+ clipPlanes.planes.push(centerPlane);
337
356
  }
338
357
  }
339
358
  if (!isInside || radiusOffset === radiusOffsets[0]) {