@itwin/core-frontend 4.1.0-dev.67 → 4.1.0-dev.69

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/lib/cjs/DisplayStyleState.js.map +1 -1
  2. package/lib/cjs/FrustumAnimator.js.map +1 -1
  3. package/lib/cjs/IModelApp.js +5 -5
  4. package/lib/cjs/IModelApp.js.map +1 -1
  5. package/lib/cjs/ViewCreator3d.js.map +1 -1
  6. package/lib/cjs/extension/ExtensionAdmin.js.map +1 -1
  7. package/lib/cjs/extension/providers/ExtensionLoadScript.js.map +1 -1
  8. package/lib/cjs/render/RenderSystem.js.map +1 -1
  9. package/lib/cjs/render/UpsampleRealityMeshParams.js.map +1 -1
  10. package/lib/cjs/render/webgl/InstancedGeometry.js.map +1 -1
  11. package/lib/cjs/render/webgl/SceneCompositor.js.map +1 -1
  12. package/lib/cjs/render/webgl/System.d.ts.map +1 -1
  13. package/lib/cjs/render/webgl/System.js +1 -1
  14. package/lib/cjs/render/webgl/System.js.map +1 -1
  15. package/lib/cjs/render/webgl/glsl/Atmosphere.js.map +1 -1
  16. package/lib/cjs/tile/GltfReader.js +1 -1
  17. package/lib/cjs/tile/GltfReader.js.map +1 -1
  18. package/lib/cjs/tile/RealityModelTileTree.js.map +1 -1
  19. package/lib/cjs/tile/TileStorage.js.map +1 -1
  20. package/lib/cjs/tile/map/MapTile.js.map +1 -1
  21. package/lib/cjs/tile/map/MapTileTree.js.map +1 -1
  22. package/lib/cjs/tile/map/MapTilingScheme.js.map +1 -1
  23. package/lib/cjs/tile/map/QuadId.js.map +1 -1
  24. package/lib/esm/DisplayStyleState.js.map +1 -1
  25. package/lib/esm/FrustumAnimator.js.map +1 -1
  26. package/lib/esm/IModelApp.js +5 -5
  27. package/lib/esm/IModelApp.js.map +1 -1
  28. package/lib/esm/ViewCreator3d.js.map +1 -1
  29. package/lib/esm/extension/ExtensionAdmin.js.map +1 -1
  30. package/lib/esm/extension/providers/ExtensionLoadScript.js.map +1 -1
  31. package/lib/esm/render/RenderSystem.js.map +1 -1
  32. package/lib/esm/render/UpsampleRealityMeshParams.js.map +1 -1
  33. package/lib/esm/render/webgl/InstancedGeometry.js.map +1 -1
  34. package/lib/esm/render/webgl/SceneCompositor.js.map +1 -1
  35. package/lib/esm/render/webgl/System.d.ts.map +1 -1
  36. package/lib/esm/render/webgl/System.js +1 -1
  37. package/lib/esm/render/webgl/System.js.map +1 -1
  38. package/lib/esm/render/webgl/glsl/Atmosphere.js.map +1 -1
  39. package/lib/esm/tile/GltfReader.js +1 -1
  40. package/lib/esm/tile/GltfReader.js.map +1 -1
  41. package/lib/esm/tile/RealityModelTileTree.js.map +1 -1
  42. package/lib/esm/tile/TileStorage.js.map +1 -1
  43. package/lib/esm/tile/map/MapTile.js.map +1 -1
  44. package/lib/esm/tile/map/MapTileTree.js.map +1 -1
  45. package/lib/esm/tile/map/MapTilingScheme.js.map +1 -1
  46. package/lib/esm/tile/map/QuadId.js.map +1 -1
  47. package/lib/public/scripts/parse-imdl-worker.js +1 -1
  48. package/lib/workers/webpack/parse-imdl-worker.js +1 -1
  49. package/package.json +21 -59
@@ -1 +1 @@
1
- {"version":3,"file":"QuadId.js","sourceRoot":"","sources":["../../../../src/tile/map/QuadId.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA6D;AAC7D,wDAAkE;AAClE,oDAAkD;AAGlD,MAAM,oBAAoB,GAAG,0BAAY,CAAC,UAAU,EAAE,CAAC;AACvD,MAAM,oBAAoB,GAAG,0BAAY,CAAC,UAAU,EAAE,CAAC;AAEvD;;;;GAIG;AACH,MAAa,MAAM;IAQjB,aAAa;IACb,IAAW,OAAO;QAChB,OAAO,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC;IACzB,CAAC;IAED,aAAa;IACN,MAAM,CAAC,mBAAmB,CAAC,QAAgB;QAChD,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,C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AAK,EAAE,KAAK,CAAC,KAAK,CAAC;YAC5C,IAAA,6BAAc,EAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC;YACnC,IAAA,6BAAc,EAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC;CACF;AA7GD,wBA6GC","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 Tiles\r\n */\r\n\r\nimport { assert, compareNumbers } from \"@itwin/core-bentley\";\r\nimport { Angle, AngleSweep, Range2d } from \"@itwin/core-geometry\";\r\nimport { Cartographic } from \"@itwin/core-common\";\r\nimport { MapTilingScheme } from \"../internal\";\r\n\r\nconst scratchCartographic1 = Cartographic.createZero();\r\nconst scratchCartographic2 = Cartographic.createZero();\r\n\r\n/** Identifies a node within a [quad tree](https://en.wikipedia.org/wiki/Quadtree), such as a [[MapTile]] within a [[MapTileTree]].\r\n * A quad tree recursively sub-divides a two-dimensional space along the X and Y axes such that each node on level L has four child nodes on\r\n * level L+1.\r\n * @public\r\n */\r\nexport class QuadId {\r\n /** The level of the node within the tree, increasing with each subdivision, as a non-negative integer. */\r\n public level: number;\r\n /** The node's position along the X axis as a non-negative integer. */\r\n public column: number;\r\n /** The node's position along the Y axis as a non-negative integer. */\r\n public row: number;\r\n\r\n /** @alpha */\r\n public get isValid() {\r\n return this.level >= 0;\r\n }\r\n\r\n /** @alpha */\r\n public static createFromContentId(stringId: string) {\r\n const idParts = stringId.split(\"_\");\r\n assert(idParts.length === 3);\r\n if (3 !== idParts.length)\r\n return new QuadId(-1, -1, -1);\r\n\r\n return new QuadId(parseInt(idParts[0], 10), parseInt(idParts[1], 10), parseInt(idParts[2], 10));\r\n }\r\n\r\n /** @alpha */\r\n public get contentId(): string {\r\n return QuadId.getTileContentId(this.level, this.column, this.row);\r\n }\r\n\r\n /** @alpha */\r\n public static getTileContentId(level: number, column: number, row: number): string {\r\n return `${level}_${column}_${row}`;\r\n }\r\n\r\n /** @alpha */\r\n public get debugString(): string {\r\n return `Level: ${this.level} Column: ${this.column} Row: ${this.row}`;\r\n }\r\n\r\n /** Construct a new QuadId. The inputs are expected to be non-negative integers. */\r\n public constructor(level: number, column: number, row: number) {\r\n this.level = level;\r\n this.column = column;\r\n this.row = row;\r\n }\r\n\r\n /** Compute the QuadIds corresponding to this node's four child nodes. */\r\n public getChildIds(columnCount = 2, rowCount = 2): QuadId[] {\r\n const childIds = [];\r\n const level = this.level + 1;\r\n const column = this.column * 2;\r\n const row = this.row * 2;\r\n for (let j = 0; j < rowCount; j++)\r\n for (let i = 0; i < columnCount; i++)\r\n childIds.push(new QuadId(level, column + i, row + j));\r\n\r\n return childIds;\r\n }\r\n\r\n /** Compute the region of the surface of the Earth represented by this node according to the specified tiling scheme. */\r\n public getLatLongRangeDegrees(mapTilingScheme: MapTilingScheme): Range2d {\r\n return this._getLatLongRange(mapTilingScheme, \"degrees\");\r\n }\r\n\r\n /** Compute the region of the surface of the Earth represented by this node according to the specified tiling scheme. */\r\n public getLatLongRangeRadians(mapTilingScheme: MapTilingScheme): Range2d {\r\n return this._getLatLongRange(mapTilingScheme, \"radians\");\r\n }\r\n\r\n private _getLatLongRange(mapTilingScheme: MapTilingScheme, units: \"radians\" | \"degrees\"): Range2d {\r\n const range = Range2d.createNull();\r\n const factor = \"degrees\" === units ? Angle.degreesPerRadian : 1;\r\n\r\n mapTilingScheme.tileXYToCartographic(this.column, this.row, this.level, scratchCartographic1);\r\n range.extendXY(scratchCartographic1.longitude * factor, scratchCartographic1.latitude * factor);\r\n mapTilingScheme.tileXYToCartographic(this.column + 1, this.row + 1, this.level, scratchCartographic2);\r\n range.extendXY(scratchCartographic2.longitude * factor, scratchCartographic2.latitude * factor);\r\n\r\n return range;\r\n }\r\n\r\n /** @alpha */\r\n public getAngleSweep(mapTilingScheme: MapTilingScheme): { longitude: AngleSweep, latitude: AngleSweep } {\r\n mapTilingScheme.tileXYToCartographic(this.column, this.row, this.level, scratchCartographic1);\r\n mapTilingScheme.tileXYToCartographic(this.column + 1, this.row + 1, this.level, scratchCartographic2);\r\n return {\r\n longitude: AngleSweep.createStartEndRadians(scratchCartographic1.longitude, scratchCartographic2.longitude),\r\n latitude: AngleSweep.createStartEndRadians(\r\n Cartographic.parametricLatitudeFromGeodeticLatitude(scratchCartographic1.latitude),\r\n Cartographic.parametricLatitudeFromGeodeticLatitude(scratchCartographic2.latitude)\r\n ),\r\n };\r\n }\r\n\r\n /** Returns true if this node is adjacent to the south pole according to the specified tiling scheme. */\r\n public bordersSouthPole(mapTilingScheme: MapTilingScheme) {\r\n return mapTilingScheme.tileBordersSouthPole(this.row, this.level);\r\n }\r\n\r\n /** Returns true if this node is adjacent to the north pole according to the specified tiling scheme. */\r\n public bordersNorthPole(mapTilingScheme: MapTilingScheme) {\r\n return mapTilingScheme.tileBordersNorthPole(this.row, this.level);\r\n }\r\n\r\n /** Compares this Id to another according to the conventions of an [OrderedComparator]($bentley). */\r\n public compare(other: QuadId): number {\r\n return compareNumbers(this.level, other.level) ||\r\n compareNumbers(this.row, other.row) ||\r\n compareNumbers(this.column, other.column);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"QuadId.js","sourceRoot":"","sources":["../../../../src/tile/map/QuadId.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA6D;AAC7D,wDAAkE;AAClE,oDAAkD;AAGlD,MAAM,oBAAoB,GAAG,0BAAY,CAAC,UAAU,EAAE,CAAC;AACvD,MAAM,oBAAoB,GAAG,0BAAY,CAAC,UAAU,EAAE,CAAC;AAEvD;;;;GAIG;AACH,MAAa,MAAM;IAQjB,aAAa;IACb,IAAW,OAAO;QAChB,OAAO,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC;IACzB,CAAC;IAED,aAAa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IAED,oGAAoG;IAC7F,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAA,6BAAc,EAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC;YAC5C,IAAA,6BAAc,EAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC;YACnC,IAAA,6BAAc,EAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC;CACF;AA7GD,wBA6GC","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 Tiles\r\n */\r\n\r\nimport { assert, compareNumbers } from \"@itwin/core-bentley\";\r\nimport { Angle, AngleSweep, Range2d } from \"@itwin/core-geometry\";\r\nimport { Cartographic } from \"@itwin/core-common\";\r\nimport { MapTilingScheme } from \"../internal\";\r\n\r\nconst scratchCartographic1 = Cartographic.createZero();\r\nconst scratchCartographic2 = Cartographic.createZero();\r\n\r\n/** Identifies a node within a [quad tree](https://en.wikipedia.org/wiki/Quadtree), such as a [[MapTile]] within a [[MapTileTree]].\r\n * A quad tree recursively sub-divides a two-dimensional space along the X and Y axes such that each node on level L has four child nodes on\r\n * level L+1.\r\n * @public\r\n */\r\nexport class QuadId {\r\n /** The level of the node within the tree, increasing with each subdivision, as a non-negative integer. */\r\n public level: number;\r\n /** The node's position along the X axis as a non-negative integer. */\r\n public column: number;\r\n /** The node's position along the Y axis as a non-negative integer. */\r\n public row: number;\r\n\r\n /** @alpha */\r\n public get isValid() {\r\n return this.level >= 0;\r\n }\r\n\r\n /** @alpha */\r\n public static createFromContentId(stringId: string) {\r\n const idParts = stringId.split(\"_\");\r\n assert(idParts.length === 3);\r\n if (3 !== idParts.length)\r\n return new QuadId(-1, -1, -1);\r\n\r\n return new QuadId(parseInt(idParts[0], 10), parseInt(idParts[1], 10), parseInt(idParts[2], 10));\r\n }\r\n\r\n /** @alpha */\r\n public get contentId(): string {\r\n return QuadId.getTileContentId(this.level, this.column, this.row);\r\n }\r\n\r\n /** @alpha */\r\n public static getTileContentId(level: number, column: number, row: number): string {\r\n return `${level}_${column}_${row}`;\r\n }\r\n\r\n /** @alpha */\r\n public get debugString(): string {\r\n return `Level: ${this.level} Column: ${this.column} Row: ${this.row}`;\r\n }\r\n\r\n /** Construct a new QuadId. The inputs are expected to be non-negative integers. */\r\n public constructor(level: number, column: number, row: number) {\r\n this.level = level;\r\n this.column = column;\r\n this.row = row;\r\n }\r\n\r\n /** Compute the QuadIds corresponding to this node's four child nodes. */\r\n public getChildIds(columnCount = 2, rowCount = 2): QuadId[] {\r\n const childIds = [];\r\n const level = this.level + 1;\r\n const column = this.column * 2;\r\n const row = this.row * 2;\r\n for (let j = 0; j < rowCount; j++)\r\n for (let i = 0; i < columnCount; i++)\r\n childIds.push(new QuadId(level, column + i, row + j));\r\n\r\n return childIds;\r\n }\r\n\r\n /** Compute the region of the surface of the Earth represented by this node according to the specified tiling scheme. */\r\n public getLatLongRangeDegrees(mapTilingScheme: MapTilingScheme): Range2d {\r\n return this._getLatLongRange(mapTilingScheme, \"degrees\");\r\n }\r\n\r\n /** Compute the region of the surface of the Earth represented by this node according to the specified tiling scheme. */\r\n public getLatLongRangeRadians(mapTilingScheme: MapTilingScheme): Range2d {\r\n return this._getLatLongRange(mapTilingScheme, \"radians\");\r\n }\r\n\r\n private _getLatLongRange(mapTilingScheme: MapTilingScheme, units: \"radians\" | \"degrees\"): Range2d {\r\n const range = Range2d.createNull();\r\n const factor = \"degrees\" === units ? Angle.degreesPerRadian : 1;\r\n\r\n mapTilingScheme.tileXYToCartographic(this.column, this.row, this.level, scratchCartographic1);\r\n range.extendXY(scratchCartographic1.longitude * factor, scratchCartographic1.latitude * factor);\r\n mapTilingScheme.tileXYToCartographic(this.column + 1, this.row + 1, this.level, scratchCartographic2);\r\n range.extendXY(scratchCartographic2.longitude * factor, scratchCartographic2.latitude * factor);\r\n\r\n return range;\r\n }\r\n\r\n /** @alpha */\r\n public getAngleSweep(mapTilingScheme: MapTilingScheme): { longitude: AngleSweep, latitude: AngleSweep } {\r\n mapTilingScheme.tileXYToCartographic(this.column, this.row, this.level, scratchCartographic1);\r\n mapTilingScheme.tileXYToCartographic(this.column + 1, this.row + 1, this.level, scratchCartographic2);\r\n return {\r\n longitude: AngleSweep.createStartEndRadians(scratchCartographic1.longitude, scratchCartographic2.longitude),\r\n latitude: AngleSweep.createStartEndRadians(\r\n Cartographic.parametricLatitudeFromGeodeticLatitude(scratchCartographic1.latitude),\r\n Cartographic.parametricLatitudeFromGeodeticLatitude(scratchCartographic2.latitude),\r\n ),\r\n };\r\n }\r\n\r\n /** Returns true if this node is adjacent to the south pole according to the specified tiling scheme. */\r\n public bordersSouthPole(mapTilingScheme: MapTilingScheme) {\r\n return mapTilingScheme.tileBordersSouthPole(this.row, this.level);\r\n }\r\n\r\n /** Returns true if this node is adjacent to the north pole according to the specified tiling scheme. */\r\n public bordersNorthPole(mapTilingScheme: MapTilingScheme) {\r\n return mapTilingScheme.tileBordersNorthPole(this.row, this.level);\r\n }\r\n\r\n /** Compares this Id to another according to the conventions of an [OrderedComparator]($bentley). */\r\n public compare(other: QuadId): number {\r\n return compareNumbers(this.level, other.level) ||\r\n compareNumbers(this.row, other.row) ||\r\n compareNumbers(this.column, other.column);\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"DisplayStyleState.js","sourceRoot":"","sources":["../../src/DisplayStyleState.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAuB,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAAE,OAAO,EAAY,MAAM,sBAAsB,CAAC;AACzD,OAAO,EACe,qBAAqB,EACtB,oBAAoB,EAAE,QAAQ,EAA4B,sBAAsB,EAChF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,KAAK,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC;gBACzD,IAAI,CAAC,QAAQ,CAAC,QAAQ,GAAG,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;aAC1D;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,gBAAgB;IACT,sBAAsB;QAC3B,IAAI,SAAS,KAAK,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE;YACxC,MAAM,GAAG,GAAG,IAAI,uBAAuB,EAAE,CAAC;YAC1C,IAAI,IAAI,CAAC,SAAS,CAAC,eAAe,IAAI,oBAAoB,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,mBAAmB,CAAC,KAAK,KAAK,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,IAAI,mBAAmB,CAAC,SAAS,KAAK,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC;gBAC9K,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC;YACzB,OAAO,GAAG,CAAC;SACZ;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module 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\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 _scriptReference?: RenderSchedule.ScriptReference;\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 /** Event raised just before the [[scheduleScriptReference]] property is changed.\r\n * @deprecated in 3.x. use [[onScheduleScriptChanged]].\r\n */\r\n public readonly onScheduleScriptReferenceChanged = new BeEvent<(newScriptReference: RenderSchedule.ScriptReference | undefined) => void>();\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); // eslint-disable-line deprecation/deprecation\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); // eslint-disable-line deprecation/deprecation\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 /** @internal */\r\n public forEachRealityTileTreeRef(func: (ref: TileTreeReference) => void): void {\r\n this.forEachRealityModel((model) => func(model.treeRef));\r\n }\r\n\r\n /** @internal */\r\n public forEachTileTreeRef(func: (ref: TileTreeReference) => void): void {\r\n this.forEachRealityTileTreeRef(func);\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 /** 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); // eslint-disable-line deprecation/deprecation\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 * @deprecated in 3.x. Use [[scheduleScript]].\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,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAuB,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAAE,OAAO,EAAY,MAAM,sBAAsB,CAAC;AACzD,OAAO,EACe,qBAAqB,EACtB,oBAAoB,EAAE,QAAQ,EAA4B,sBAAsB,EAChF,oBAAoB,EAAkC,SAAS,EAAE,qBAAqB,EACzG,gBAAgB,EAAoB,cAAc,EAC7B,mBAAmB,EAAc,uBAAuB,EAAE,eAAe,EAAE,mBAAmB,EAAE,oBAAoB,GAC1I,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,O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AAG,GAAG,IAAI,uBAAuB,EAAE,CAAC;YAC1C,IAAI,IAAI,CAAC,SAAS,CAAC,eAAe,IAAI,oBAAoB,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,mBAAmB,CAAC,KAAK,KAAK,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,IAAI,mBAAmB,CAAC,SAAS,KAAK,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC;gBAC9K,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC;YACzB,OAAO,GAAG,CAAC;SACZ;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module 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\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 _scriptReference?: RenderSchedule.ScriptReference;\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 /** Event raised just before the [[scheduleScriptReference]] property is changed.\r\n * @deprecated in 3.x. use [[onScheduleScriptChanged]].\r\n */\r\n public readonly onScheduleScriptReferenceChanged = new BeEvent<(newScriptReference: RenderSchedule.ScriptReference | undefined) => void>();\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); // eslint-disable-line deprecation/deprecation\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); // eslint-disable-line deprecation/deprecation\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 /** @internal */\r\n public forEachRealityTileTreeRef(func: (ref: TileTreeReference) => void): void {\r\n this.forEachRealityModel((model) => func(model.treeRef));\r\n }\r\n\r\n /** @internal */\r\n public forEachTileTreeRef(func: (ref: TileTreeReference) => void): void {\r\n this.forEachRealityTileTreeRef(func);\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 /** 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); // eslint-disable-line deprecation/deprecation\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 * @deprecated in 3.x. Use [[scheduleScript]].\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 +1 @@
1
- {"version":3,"file":"FrustumAnimator.js","sourceRoot":"","sources":["../../src/FrustumAnimator.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAW,OAAO,EAAE,SAAS,EAAY,MAAM,sBAAsB,CAAC;AACxG,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAG5C;;;GAGG;AACH,SAAS,sBAAsB,CAC7B,KAAe,EACf,IAAa,EACb,SAAiB,EACjB,KAAe,EACf,IAAa,EACb,SAAiB,EACjB,QAAgB,EAChB,cAAwB;IAExB,MAAM,EAAE,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IACxB,MAAM,EAAE,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IACxB,MAAM,EAAE,GAAG,cAAc,CAAC,IAAI,EAAE,CAAC;IACjC,8CAA8C;IAC9C,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,CAAC;IAChD,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,CAAC;IAChD,mDAAmD;IACnD,MAAM,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACvD,4DAA4D;IAC5D,MAAM,SAAS,GAAG,QAAQ,CAAC,WAAW,CAAC,SAAS,EAA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F","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\n\r\nimport { Angle, Geometry, Matrix3d, Point3d, Range3d, Transform, Vector3d } from \"@itwin/core-geometry\";\r\nimport { Tweens } from \"@itwin/core-common\";\r\nimport { Animator, ViewAnimationOptions } from \"./ViewAnimation\";\r\nimport { ScreenViewport } from \"./Viewport\";\r\nimport { ViewPose, ViewPose3d } from \"./ViewPose\";\r\nimport { ViewState3d } from \"./ViewState\";\r\n/**\r\n * Compute an intermediate eye point as it swings around a moving target with rotating axes and varying distance to target.\r\n * (eye, target, distance) is redundant -- implementation problem is to figure out which to use for compatibility with subsequent view setup.\r\n */\r\nfunction interpolateSwingingEye(\r\n axes0: Matrix3d,\r\n eye0: Point3d,\r\n distance0: number,\r\n axes1: Matrix3d,\r\n eye1: Point3d,\r\n distance1: number,\r\n fraction: number,\r\n axesAtFraction: Matrix3d\r\n): { target: Point3d, eye: Point3d, distance: number } {\r\n const z0 = axes0.rowZ();\r\n const z1 = axes1.rowZ();\r\n const zA = axesAtFraction.rowZ();\r\n // back up from the eye points to the targets.\r\n const target0 = eye0.plusScaled(z0, -distance0);\r\n const target1 = eye1.plusScaled(z1, -distance1);\r\n // RULE: Target point moves by simple interpolation\r\n const targetA = target0.interpolate(fraction, target1);\r\n // RULE: Distance from target to eye is simple interpolation\r\n const distanceA = Geometry.interpolate(distance0, fraction, distance1);\r\n // The interpolated target, interpolated distance, and specified axes give the intermediate eyepoint.\r\n const eyeA = targetA.plusScaled(zA, distanceA);\r\n return {\r\n target: targetA,\r\n eye: eyeA,\r\n distance: distanceA,\r\n };\r\n}\r\n/** Animates the transition of a [[Viewport]] from one [Frustum]($common) to another. The viewport will render as many frames as necessary during the supplied duration.\r\n * @see [[Viewport.animateFrustumChange]] to conveniently animate a viewport from one frustum to another.\r\n * @public\r\n * @extensions\r\n */\r\nexport class FrustumAnimator implements Animator {\r\n private _tweens = new Tweens();\r\n private _duration = 0;\r\n\r\n /** Construct an animator that animates from `begin` to `end`. */\r\n public constructor(public options: ViewAnimationOptions, viewport: ScreenViewport, begin: ViewPose, end: ViewPose) {\r\n const settings = ScreenViewport.animation;\r\n const zoomSettings = settings.zoomOut;\r\n\r\n let duration = undefined !== options.animationTime ? options.animationTime : settings.time.normal.milliseconds;\r\n if (duration <= 0 || begin.cameraOn !== end.cameraOn) // no duration means skip animation. We can't animate if the camera toggles.\r\n return;\r\n\r\n this._duration = duration;\r\n let extentBias: Vector3d | undefined;\r\n let eyeBias: Vector3d | undefined;\r\n const zVec = begin.zVec;\r\n const view = viewport.view;\r\n const view3 = view as ViewState3d;\r\n const begin3 = begin as ViewPose3d;\r\n const end3 = end as ViewPose3d;\r\n const beginTarget = begin.target;\r\n const endTarget = end.target;\r\n const axis = end.rotation.multiplyMatrixMatrixInverse(begin.rotation)!.getAxisAndAngleOfRotation(); // axis to rotate begin to get to end\r\n const timing = { fraction: 0.0, height: 0, position: 0 }; // updated by tween.\r\n\r\n // don't do \"zoom out\" if the two views aren't pointing in the same direction, or if they request cancelOnAbort (since that implies that the view\r\n // is a linear interpolation from begin to end), or if it's disabled.\r\n if (zoomSettings.enable && !options.cancelOnAbort && zVec.isAlmostEqual(end.zVec)) {\r\n view.applyPose(end); // start with the pose at the end\r\n const viewTransform = Transform.createOriginAndMatrix(undefined, view.getRotation());\r\n const endRange = Range3d.createTransformedArray(viewTransform, view.calculateFocusCorners()); // get the view-aligned range of the focus plane at the end\r\n const beginRange = Range3d.createTransformedArray(viewTransform, view.applyPose(begin).calculateFocusCorners()); // get the view-aligned range of the focus plane at the beginning\r\n\r\n // do the starting and ending views (plus the margin) overlap? If not we need to zoom out to show how to get from one to the other\r\n const expand = (range: Range3d) => {\r\n const r = range.clone();\r\n r.scaleAboutCenterInPlace(zoomSettings.margin);\r\n return r;\r\n };\r\n\r\n if (!expand(beginRange).intersectsRangeXY(expand(endRange))) {\r\n view3.lookAtViewAlignedVolume(beginRange.union(endRange), viewport.viewRect.aspect); // set up a view that would show both extents\r\n duration *= zoomSettings.durationFactor; // increase duration so the zooming isn't too fast\r\n extentBias = view.getExtents().minus(begin.extents); // if the camera is off, the \"bias\" is the amount the union-ed view is larger than the starting view\r\n if (begin.cameraOn)\r\n eyeBias = zVec.scaleToLength(zVec.dotProduct(begin3.camera.eye.vectorTo(view3.camera.eye))); // if the camera is on, the bias is the difference in height of the two eye positions\r\n }\r\n }\r\n\r\n this._tweens.create(timing, {\r\n to: { fraction: 1.0, height: zoomSettings.heights, position: zoomSettings.positions },\r\n duration,\r\n start: true,\r\n easing: options.easingFunction ? options.easingFunction : settings.easing,\r\n interpolation: zoomSettings.interpolation,\r\n onComplete: () =>\r\n viewport.setupFromView(end), // when we're done, set up from final state\r\n onUpdate: () => {\r\n const fraction = extentBias ? timing.position : timing.fraction; // if we're zooming, fraction comes from position interpolation\r\n const rot = Matrix3d.createRotationAroundVector(axis.axis, Angle.createDegrees(fraction * axis.angle.degrees))!.multiplyMatrixMatrix(begin.rotation);\r\n if (begin.cameraOn) {\r\n const newExtents = begin.extents.interpolate(fraction, end.extents);\r\n if (undefined !== eyeBias) {\r\n const eyePoint = begin3.camera.eye.interpolate(fraction, end3.camera.eye);\r\n eyePoint.plusScaled(eyeBias, timing.height, eyePoint);\r\n const targetPoint = eyePoint.plusScaled(rot.getRow(2), -1.0 * (Geometry.interpolate(begin3.camera.focusDist, fraction, end3.camera.focusDist)));\r\n view3.lookAt({ eyePoint, targetPoint, upVector: rot.getRow(1), newExtents });\r\n } else {\r\n const data = interpolateSwingingEye(\r\n begin3.rotation, begin3.camera.eye, begin3.camera.focusDist,\r\n end3.rotation, end3.camera.eye, end3.camera.focusDist, fraction, rot);\r\n view3.lookAt({ eyePoint: data.eye, targetPoint: data.target, upVector: rot.getRow(1), newExtents });\r\n }\r\n } else {\r\n const extents = begin.extents.interpolate(timing.fraction, end.extents);\r\n if (undefined !== extentBias)\r\n extents.plusScaled(extentBias, timing.height, extents); // no camera, zooming out expands extents\r\n view.setExtents(extents);\r\n view.setRotation(rot);\r\n view.setCenter(beginTarget.interpolate(fraction, endTarget)); // must be done last - depends on extents and rotation\r\n }\r\n viewport.setupFromView();\r\n },\r\n });\r\n }\r\n\r\n /** @internal */\r\n public animate() {\r\n const didFinish = !this._tweens.update();\r\n if (didFinish && this.options.animationFinishedCallback)\r\n this.options.animationFinishedCallback(true);\r\n return didFinish;\r\n }\r\n\r\n /** @internal */\r\n public interrupt() {\r\n // We were interrupted. Either go to: the final frame (normally) or, add a small fraction of the total duration (30ms for a .5 second duration) to\r\n // the current time for cancelOnAbort. That makes aborted animations show some progress, as happens when the mouse wheel rolls quickly.\r\n this._tweens.update(this.options.cancelOnAbort ? Date.now() + (this._duration * .06) : Infinity);\r\n if (this.options.animationFinishedCallback)\r\n this.options.animationFinishedCallback(false);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"FrustumAnimator.js","sourceRoot":"","sources":["../../src/FrustumAnimator.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAW,OAAO,EAAE,SAAS,EAAY,MAAM,sBAAsB,CAAC;AACxG,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAG5C;;;GAGG;AACH,SAAS,sBAAsB,CAC7B,KAAe,EACf,IAAa,EACb,SAAiB,EACjB,KAAe,EACf,IAAa,EACb,SAAiB,EACjB,QAAgB,EAChB,cAAwB;IAExB,MAAM,EAAE,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IACxB,MAAM,EAAE,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IACxB,MAAM,EAAE,GAAG,cAAc,CAAC,IAAI,EAAE,CAAC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S;QACd,kJAAkJ;QAClJ,uIAAuI;QACvI,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,CAAC,SAAS,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;QACjG,IAAI,IAAI,CAAC,OAAO,CAAC,yBAAyB;YACxC,IAAI,CAAC,OAAO,CAAC,yBAAyB,CAAC,KAAK,CAAC,CAAC;IAClD,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Views\r\n */\r\n\r\nimport { Angle, Geometry, Matrix3d, Point3d, Range3d, Transform, Vector3d } from \"@itwin/core-geometry\";\r\nimport { Tweens } from \"@itwin/core-common\";\r\nimport { Animator, ViewAnimationOptions } from \"./ViewAnimation\";\r\nimport { ScreenViewport } from \"./Viewport\";\r\nimport { ViewPose, ViewPose3d } from \"./ViewPose\";\r\nimport { ViewState3d } from \"./ViewState\";\r\n/**\r\n * Compute an intermediate eye point as it swings around a moving target with rotating axes and varying distance to target.\r\n * (eye, target, distance) is redundant -- implementation problem is to figure out which to use for compatibility with subsequent view setup.\r\n */\r\nfunction interpolateSwingingEye(\r\n axes0: Matrix3d,\r\n eye0: Point3d,\r\n distance0: number,\r\n axes1: Matrix3d,\r\n eye1: Point3d,\r\n distance1: number,\r\n fraction: number,\r\n axesAtFraction: Matrix3d,\r\n): { target: Point3d, eye: Point3d, distance: number } {\r\n const z0 = axes0.rowZ();\r\n const z1 = axes1.rowZ();\r\n const zA = axesAtFraction.rowZ();\r\n // back up from the eye points to the targets.\r\n const target0 = eye0.plusScaled(z0, -distance0);\r\n const target1 = eye1.plusScaled(z1, -distance1);\r\n // RULE: Target point moves by simple interpolation\r\n const targetA = target0.interpolate(fraction, target1);\r\n // RULE: Distance from target to eye is simple interpolation\r\n const distanceA = Geometry.interpolate(distance0, fraction, distance1);\r\n // The interpolated target, interpolated distance, and specified axes give the intermediate eyepoint.\r\n const eyeA = targetA.plusScaled(zA, distanceA);\r\n return {\r\n target: targetA,\r\n eye: eyeA,\r\n distance: distanceA,\r\n };\r\n}\r\n/** Animates the transition of a [[Viewport]] from one [Frustum]($common) to another. The viewport will render as many frames as necessary during the supplied duration.\r\n * @see [[Viewport.animateFrustumChange]] to conveniently animate a viewport from one frustum to another.\r\n * @public\r\n * @extensions\r\n */\r\nexport class FrustumAnimator implements Animator {\r\n private _tweens = new Tweens();\r\n private _duration = 0;\r\n\r\n /** Construct an animator that animates from `begin` to `end`. */\r\n public constructor(public options: ViewAnimationOptions, viewport: ScreenViewport, begin: ViewPose, end: ViewPose) {\r\n const settings = ScreenViewport.animation;\r\n const zoomSettings = settings.zoomOut;\r\n\r\n let duration = undefined !== options.animationTime ? options.animationTime : settings.time.normal.milliseconds;\r\n if (duration <= 0 || begin.cameraOn !== end.cameraOn) // no duration means skip animation. We can't animate if the camera toggles.\r\n return;\r\n\r\n this._duration = duration;\r\n let extentBias: Vector3d | undefined;\r\n let eyeBias: Vector3d | undefined;\r\n const zVec = begin.zVec;\r\n const view = viewport.view;\r\n const view3 = view as ViewState3d;\r\n const begin3 = begin as ViewPose3d;\r\n const end3 = end as ViewPose3d;\r\n const beginTarget = begin.target;\r\n const endTarget = end.target;\r\n const axis = end.rotation.multiplyMatrixMatrixInverse(begin.rotation)!.getAxisAndAngleOfRotation(); // axis to rotate begin to get to end\r\n const timing = { fraction: 0.0, height: 0, position: 0 }; // updated by tween.\r\n\r\n // don't do \"zoom out\" if the two views aren't pointing in the same direction, or if they request cancelOnAbort (since that implies that the view\r\n // is a linear interpolation from begin to end), or if it's disabled.\r\n if (zoomSettings.enable && !options.cancelOnAbort && zVec.isAlmostEqual(end.zVec)) {\r\n view.applyPose(end); // start with the pose at the end\r\n const viewTransform = Transform.createOriginAndMatrix(undefined, view.getRotation());\r\n const endRange = Range3d.createTransformedArray(viewTransform, view.calculateFocusCorners()); // get the view-aligned range of the focus plane at the end\r\n const beginRange = Range3d.createTransformedArray(viewTransform, view.applyPose(begin).calculateFocusCorners()); // get the view-aligned range of the focus plane at the beginning\r\n\r\n // do the starting and ending views (plus the margin) overlap? If not we need to zoom out to show how to get from one to the other\r\n const expand = (range: Range3d) => {\r\n const r = range.clone();\r\n r.scaleAboutCenterInPlace(zoomSettings.margin);\r\n return r;\r\n };\r\n\r\n if (!expand(beginRange).intersectsRangeXY(expand(endRange))) {\r\n view3.lookAtViewAlignedVolume(beginRange.union(endRange), viewport.viewRect.aspect); // set up a view that would show both extents\r\n duration *= zoomSettings.durationFactor; // increase duration so the zooming isn't too fast\r\n extentBias = view.getExtents().minus(begin.extents); // if the camera is off, the \"bias\" is the amount the union-ed view is larger than the starting view\r\n if (begin.cameraOn)\r\n eyeBias = zVec.scaleToLength(zVec.dotProduct(begin3.camera.eye.vectorTo(view3.camera.eye))); // if the camera is on, the bias is the difference in height of the two eye positions\r\n }\r\n }\r\n\r\n this._tweens.create(timing, {\r\n to: { fraction: 1.0, height: zoomSettings.heights, position: zoomSettings.positions },\r\n duration,\r\n start: true,\r\n easing: options.easingFunction ? options.easingFunction : settings.easing,\r\n interpolation: zoomSettings.interpolation,\r\n onComplete: () =>\r\n viewport.setupFromView(end), // when we're done, set up from final state\r\n onUpdate: () => {\r\n const fraction = extentBias ? timing.position : timing.fraction; // if we're zooming, fraction comes from position interpolation\r\n const rot = Matrix3d.createRotationAroundVector(axis.axis, Angle.createDegrees(fraction * axis.angle.degrees))!.multiplyMatrixMatrix(begin.rotation);\r\n if (begin.cameraOn) {\r\n const newExtents = begin.extents.interpolate(fraction, end.extents);\r\n if (undefined !== eyeBias) {\r\n const eyePoint = begin3.camera.eye.interpolate(fraction, end3.camera.eye);\r\n eyePoint.plusScaled(eyeBias, timing.height, eyePoint);\r\n const targetPoint = eyePoint.plusScaled(rot.getRow(2), -1.0 * (Geometry.interpolate(begin3.camera.focusDist, fraction, end3.camera.focusDist)));\r\n view3.lookAt({ eyePoint, targetPoint, upVector: rot.getRow(1), newExtents });\r\n } else {\r\n const data = interpolateSwingingEye(\r\n begin3.rotation, begin3.camera.eye, begin3.camera.focusDist,\r\n end3.rotation, end3.camera.eye, end3.camera.focusDist, fraction, rot);\r\n view3.lookAt({ eyePoint: data.eye, targetPoint: data.target, upVector: rot.getRow(1), newExtents });\r\n }\r\n } else {\r\n const extents = begin.extents.interpolate(timing.fraction, end.extents);\r\n if (undefined !== extentBias)\r\n extents.plusScaled(extentBias, timing.height, extents); // no camera, zooming out expands extents\r\n view.setExtents(extents);\r\n view.setRotation(rot);\r\n view.setCenter(beginTarget.interpolate(fraction, endTarget)); // must be done last - depends on extents and rotation\r\n }\r\n viewport.setupFromView();\r\n },\r\n });\r\n }\r\n\r\n /** @internal */\r\n public animate() {\r\n const didFinish = !this._tweens.update();\r\n if (didFinish && this.options.animationFinishedCallback)\r\n this.options.animationFinishedCallback(true);\r\n return didFinish;\r\n }\r\n\r\n /** @internal */\r\n public interrupt() {\r\n // We were interrupted. Either go to: the final frame (normally) or, add a small fraction of the total duration (30ms for a .5 second duration) to\r\n // the current time for cancelOnAbort. That makes aborted animations show some progress, as happens when the mouse wheel rolls quickly.\r\n this._tweens.update(this.options.cancelOnAbort ? Date.now() + (this._duration * .06) : Infinity);\r\n if (this.options.animationFinishedCallback)\r\n this.options.animationFinishedCallback(false);\r\n }\r\n}\r\n"]}
@@ -155,7 +155,7 @@ class IModelApp {
155
155
  * @note As of 4.x, iTwin.js requires WebGL 2. If the client does not support WebGL 2, the `status` field of the returned compatibility info will be [WebGLRenderCompatibilityStatus.CannotCreateContext]($webgl-compatibility).
156
156
  */
157
157
  static queryRenderCompatibility() {
158
- return queryRenderCompatibility(true, System.createContext);
158
+ return queryRenderCompatibility(true, (canvas, useWebGL2, inputContextAttributes) => System.createContext(canvas, useWebGL2, inputContextAttributes));
159
159
  }
160
160
  /**
161
161
  * This method must be called before any other `@itwin/core-frontend` methods are used.
@@ -247,7 +247,7 @@ class IModelApp {
247
247
  window.iModelAppForDebugger = undefined;
248
248
  }
249
249
  this._wantEventLoop = false;
250
- window.removeEventListener("resize", IModelApp.requestNextAnimation);
250
+ window.removeEventListener("resize", () => IModelApp.requestNextAnimation());
251
251
  this.clearIntervalAnimation();
252
252
  [this.toolAdmin, this.viewManager, this.tileAdmin].forEach((sys) => sys.onShutDown());
253
253
  this.tools.shutdown();
@@ -284,7 +284,7 @@ class IModelApp {
284
284
  return;
285
285
  if (!IModelApp._animationRequested) {
286
286
  IModelApp._animationRequested = true;
287
- requestAnimationFrame(IModelApp.eventLoop);
287
+ requestAnimationFrame(() => IModelApp.eventLoop());
288
288
  }
289
289
  }
290
290
  /** @internal */
@@ -306,7 +306,7 @@ class IModelApp {
306
306
  static startEventLoop() {
307
307
  if (!IModelApp._wantEventLoop) {
308
308
  IModelApp._wantEventLoop = true;
309
- window.addEventListener("resize", IModelApp.requestNextAnimation);
309
+ window.addEventListener("resize", () => IModelApp.requestNextAnimation());
310
310
  IModelApp.requestIntervalAnimation();
311
311
  IModelApp.requestNextAnimation();
312
312
  }
@@ -329,7 +329,7 @@ class IModelApp {
329
329
  ToolAdmin.exceptionHandler(exception); // eslint-disable-line @typescript-eslint/no-floating-promises
330
330
  IModelApp._wantEventLoop = false;
331
331
  IModelApp._animationRequested = true; // unrecoverable after exception, don't request any further frames.
332
- window.removeEventListener("resize", IModelApp.requestNextAnimation);
332
+ window.removeEventListener("resize", () => IModelApp.requestNextAnimation());
333
333
  }
334
334
  }
335
335
  /** Get the user's access token for this IModelApp, or a blank string if none is available.