@itwin/core-common 4.1.0-dev.8 → 4.1.0-dev.81

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 (172) hide show
  1. package/CHANGELOG.md +83 -1
  2. package/lib/cjs/BriefcaseTypes.d.ts +13 -1
  3. package/lib/cjs/BriefcaseTypes.d.ts.map +1 -1
  4. package/lib/cjs/BriefcaseTypes.js.map +1 -1
  5. package/lib/cjs/ChangedElements.d.ts +2 -0
  6. package/lib/cjs/ChangedElements.d.ts.map +1 -1
  7. package/lib/cjs/ChangedElements.js +2 -0
  8. package/lib/cjs/ChangedElements.js.map +1 -1
  9. package/lib/cjs/ConcurrentQuery.d.ts +26 -2
  10. package/lib/cjs/ConcurrentQuery.d.ts.map +1 -1
  11. package/lib/cjs/ConcurrentQuery.js +29 -3
  12. package/lib/cjs/ConcurrentQuery.js.map +1 -1
  13. package/lib/cjs/DisplayStyleSettings.d.ts +1 -15
  14. package/lib/cjs/DisplayStyleSettings.d.ts.map +1 -1
  15. package/lib/cjs/DisplayStyleSettings.js +1 -15
  16. package/lib/cjs/DisplayStyleSettings.js.map +1 -1
  17. package/lib/cjs/ECSqlReader.d.ts +164 -7
  18. package/lib/cjs/ECSqlReader.d.ts.map +1 -1
  19. package/lib/cjs/ECSqlReader.js +124 -12
  20. package/lib/cjs/ECSqlReader.js.map +1 -1
  21. package/lib/cjs/ElementProps.d.ts +2 -2
  22. package/lib/cjs/ElementProps.js.map +1 -1
  23. package/lib/cjs/EntityProps.js +2 -2
  24. package/lib/cjs/EntityProps.js.map +1 -1
  25. package/lib/cjs/FeatureIndex.d.ts +50 -4
  26. package/lib/cjs/FeatureIndex.d.ts.map +1 -1
  27. package/lib/cjs/FeatureIndex.js +44 -4
  28. package/lib/cjs/FeatureIndex.js.map +1 -1
  29. package/lib/cjs/FeatureTable.d.ts +44 -20
  30. package/lib/cjs/FeatureTable.d.ts.map +1 -1
  31. package/lib/cjs/FeatureTable.js +17 -2
  32. package/lib/cjs/FeatureTable.js.map +1 -1
  33. package/lib/cjs/IModel.d.ts +1 -1
  34. package/lib/cjs/IModel.d.ts.map +1 -1
  35. package/lib/cjs/IModel.js +1 -1
  36. package/lib/cjs/IModel.js.map +1 -1
  37. package/lib/cjs/QPoint.d.ts +3 -3
  38. package/lib/cjs/QPoint.js +3 -3
  39. package/lib/cjs/QPoint.js.map +1 -1
  40. package/lib/cjs/Render.d.ts +27 -35
  41. package/lib/cjs/Render.d.ts.map +1 -1
  42. package/lib/cjs/Render.js +4 -67
  43. package/lib/cjs/Render.js.map +1 -1
  44. package/lib/cjs/RpcInterface.d.ts +1 -1
  45. package/lib/cjs/RpcInterface.d.ts.map +1 -1
  46. package/lib/cjs/RpcInterface.js +26 -25
  47. package/lib/cjs/RpcInterface.js.map +1 -1
  48. package/lib/cjs/SkyBox.d.ts +3 -3
  49. package/lib/cjs/SkyBox.d.ts.map +1 -1
  50. package/lib/cjs/SkyBox.js +3 -3
  51. package/lib/cjs/SkyBox.js.map +1 -1
  52. package/lib/cjs/ViewFlags.d.ts +4 -4
  53. package/lib/cjs/ViewFlags.d.ts.map +1 -1
  54. package/lib/cjs/ViewFlags.js +4 -4
  55. package/lib/cjs/ViewFlags.js.map +1 -1
  56. package/lib/cjs/ViewProps.d.ts +429 -5
  57. package/lib/cjs/ViewProps.d.ts.map +1 -1
  58. package/lib/cjs/ViewProps.js +16 -0
  59. package/lib/cjs/ViewProps.js.map +1 -1
  60. package/lib/cjs/geometry/AreaPattern.js +2 -2
  61. package/lib/cjs/geometry/AreaPattern.js.map +1 -1
  62. package/lib/cjs/geometry/ElementGeometry.d.ts +6 -6
  63. package/lib/cjs/geometry/ElementGeometry.js +1 -1
  64. package/lib/cjs/geometry/ElementGeometry.js.map +1 -1
  65. package/lib/cjs/rpc/IModelReadRpcInterface.d.ts +4 -2
  66. package/lib/cjs/rpc/IModelReadRpcInterface.d.ts.map +1 -1
  67. package/lib/cjs/rpc/IModelReadRpcInterface.js +6 -4
  68. package/lib/cjs/rpc/IModelReadRpcInterface.js.map +1 -1
  69. package/lib/cjs/rpc/core/RpcInvocation.d.ts +2 -0
  70. package/lib/cjs/rpc/core/RpcInvocation.d.ts.map +1 -1
  71. package/lib/cjs/rpc/core/RpcInvocation.js +1 -0
  72. package/lib/cjs/rpc/core/RpcInvocation.js.map +1 -1
  73. package/lib/cjs/rpc/core/RpcMarshaling.js +2 -2
  74. package/lib/cjs/rpc/core/RpcMarshaling.js.map +1 -1
  75. package/lib/cjs/rpc/web/WebAppRpcProtocol.js +1 -1
  76. package/lib/cjs/rpc/web/WebAppRpcProtocol.js.map +1 -1
  77. package/lib/cjs/tile/GltfTileIO.d.ts.map +1 -1
  78. package/lib/cjs/tile/GltfTileIO.js +2 -0
  79. package/lib/cjs/tile/GltfTileIO.js.map +1 -1
  80. package/lib/cjs/tile/IModelTileIO.d.ts +2 -2
  81. package/lib/cjs/tile/IModelTileIO.js +2 -2
  82. package/lib/cjs/tile/IModelTileIO.js.map +1 -1
  83. package/lib/cjs/tile/TileMetadata.d.ts +14 -13
  84. package/lib/cjs/tile/TileMetadata.d.ts.map +1 -1
  85. package/lib/cjs/tile/TileMetadata.js +56 -44
  86. package/lib/cjs/tile/TileMetadata.js.map +1 -1
  87. package/lib/esm/BriefcaseTypes.d.ts +13 -1
  88. package/lib/esm/BriefcaseTypes.d.ts.map +1 -1
  89. package/lib/esm/BriefcaseTypes.js.map +1 -1
  90. package/lib/esm/ChangedElements.d.ts +2 -0
  91. package/lib/esm/ChangedElements.d.ts.map +1 -1
  92. package/lib/esm/ChangedElements.js +2 -0
  93. package/lib/esm/ChangedElements.js.map +1 -1
  94. package/lib/esm/ConcurrentQuery.d.ts +26 -2
  95. package/lib/esm/ConcurrentQuery.d.ts.map +1 -1
  96. package/lib/esm/ConcurrentQuery.js +29 -3
  97. package/lib/esm/ConcurrentQuery.js.map +1 -1
  98. package/lib/esm/DisplayStyleSettings.d.ts +1 -15
  99. package/lib/esm/DisplayStyleSettings.d.ts.map +1 -1
  100. package/lib/esm/DisplayStyleSettings.js +1 -15
  101. package/lib/esm/DisplayStyleSettings.js.map +1 -1
  102. package/lib/esm/ECSqlReader.d.ts +164 -7
  103. package/lib/esm/ECSqlReader.d.ts.map +1 -1
  104. package/lib/esm/ECSqlReader.js +124 -12
  105. package/lib/esm/ECSqlReader.js.map +1 -1
  106. package/lib/esm/ElementProps.d.ts +2 -2
  107. package/lib/esm/ElementProps.js.map +1 -1
  108. package/lib/esm/EntityProps.js +2 -2
  109. package/lib/esm/EntityProps.js.map +1 -1
  110. package/lib/esm/FeatureIndex.d.ts +50 -4
  111. package/lib/esm/FeatureIndex.d.ts.map +1 -1
  112. package/lib/esm/FeatureIndex.js +44 -4
  113. package/lib/esm/FeatureIndex.js.map +1 -1
  114. package/lib/esm/FeatureTable.d.ts +44 -20
  115. package/lib/esm/FeatureTable.d.ts.map +1 -1
  116. package/lib/esm/FeatureTable.js +17 -2
  117. package/lib/esm/FeatureTable.js.map +1 -1
  118. package/lib/esm/IModel.d.ts +1 -1
  119. package/lib/esm/IModel.d.ts.map +1 -1
  120. package/lib/esm/IModel.js +1 -1
  121. package/lib/esm/IModel.js.map +1 -1
  122. package/lib/esm/QPoint.d.ts +3 -3
  123. package/lib/esm/QPoint.js +3 -3
  124. package/lib/esm/QPoint.js.map +1 -1
  125. package/lib/esm/Render.d.ts +27 -35
  126. package/lib/esm/Render.d.ts.map +1 -1
  127. package/lib/esm/Render.js +3 -64
  128. package/lib/esm/Render.js.map +1 -1
  129. package/lib/esm/RpcInterface.d.ts +1 -1
  130. package/lib/esm/RpcInterface.d.ts.map +1 -1
  131. package/lib/esm/RpcInterface.js +26 -25
  132. package/lib/esm/RpcInterface.js.map +1 -1
  133. package/lib/esm/SkyBox.d.ts +3 -3
  134. package/lib/esm/SkyBox.d.ts.map +1 -1
  135. package/lib/esm/SkyBox.js +3 -3
  136. package/lib/esm/SkyBox.js.map +1 -1
  137. package/lib/esm/ViewFlags.d.ts +4 -4
  138. package/lib/esm/ViewFlags.d.ts.map +1 -1
  139. package/lib/esm/ViewFlags.js +4 -4
  140. package/lib/esm/ViewFlags.js.map +1 -1
  141. package/lib/esm/ViewProps.d.ts +429 -5
  142. package/lib/esm/ViewProps.d.ts.map +1 -1
  143. package/lib/esm/ViewProps.js +15 -1
  144. package/lib/esm/ViewProps.js.map +1 -1
  145. package/lib/esm/geometry/AreaPattern.js +2 -2
  146. package/lib/esm/geometry/AreaPattern.js.map +1 -1
  147. package/lib/esm/geometry/ElementGeometry.d.ts +6 -6
  148. package/lib/esm/geometry/ElementGeometry.js +1 -1
  149. package/lib/esm/geometry/ElementGeometry.js.map +1 -1
  150. package/lib/esm/rpc/IModelReadRpcInterface.d.ts +4 -2
  151. package/lib/esm/rpc/IModelReadRpcInterface.d.ts.map +1 -1
  152. package/lib/esm/rpc/IModelReadRpcInterface.js +6 -4
  153. package/lib/esm/rpc/IModelReadRpcInterface.js.map +1 -1
  154. package/lib/esm/rpc/core/RpcInvocation.d.ts +2 -0
  155. package/lib/esm/rpc/core/RpcInvocation.d.ts.map +1 -1
  156. package/lib/esm/rpc/core/RpcInvocation.js +1 -0
  157. package/lib/esm/rpc/core/RpcInvocation.js.map +1 -1
  158. package/lib/esm/rpc/core/RpcMarshaling.js +2 -2
  159. package/lib/esm/rpc/core/RpcMarshaling.js.map +1 -1
  160. package/lib/esm/rpc/web/WebAppRpcProtocol.js +1 -1
  161. package/lib/esm/rpc/web/WebAppRpcProtocol.js.map +1 -1
  162. package/lib/esm/tile/GltfTileIO.d.ts.map +1 -1
  163. package/lib/esm/tile/GltfTileIO.js +2 -0
  164. package/lib/esm/tile/GltfTileIO.js.map +1 -1
  165. package/lib/esm/tile/IModelTileIO.d.ts +2 -2
  166. package/lib/esm/tile/IModelTileIO.js +2 -2
  167. package/lib/esm/tile/IModelTileIO.js.map +1 -1
  168. package/lib/esm/tile/TileMetadata.d.ts +14 -13
  169. package/lib/esm/tile/TileMetadata.d.ts.map +1 -1
  170. package/lib/esm/tile/TileMetadata.js +57 -45
  171. package/lib/esm/tile/TileMetadata.js.map +1 -1
  172. package/package.json +11 -29
@@ -22,41 +22,42 @@ const core_bentley_1 = require("@itwin/core-bentley");
22
22
  */
23
23
  class RpcInterface {
24
24
  static findDiff(backend, frontend) {
25
- return backend.major !== frontend.major ? "major" : backend.minor !== frontend.minor ? "minor" : backend.patch !== frontend.patch ? "patch" : backend.prerelease !== frontend.prerelease ? "prerelease" : "same";
25
+ return backend.major !== frontend.major ? "major" :
26
+ backend.minor !== frontend.minor ? "minor" :
27
+ backend.patch !== frontend.patch ? "patch" :
28
+ backend.prerelease !== frontend.prerelease ? "prerelease" :
29
+ "same";
26
30
  }
27
31
  static parseVer(version) {
28
- // Split the version string into major.minor.path and prerelease tag
29
- const split = version.split(/[:-]/);
30
- // Split the major.minor.path into seperate components
31
- const prefix = split[0].split(".");
32
- if (split.length === 1) {
33
- return { major: Number(prefix[0]), minor: Number(prefix[1]), patch: Number(prefix[2]) };
34
- }
35
- else {
36
- return { major: Number(prefix[0]), minor: Number(prefix[1]), patch: Number(prefix[2]), prerelease: split[1] };
37
- }
32
+ // separate the version from the prerelease tag
33
+ const parts = version.split(/[:-]/);
34
+ // Split the major.minor.path into separate components
35
+ const prefix = parts[0].split(".");
36
+ const ver = { major: Number(prefix[0]), minor: Number(prefix[1]), patch: Number(prefix[2]) };
37
+ if (parts.length > 1)
38
+ ver.prerelease = parts[1];
39
+ return ver;
38
40
  }
39
41
  /** Determines whether the backend version of an RPC interface is compatible (according to semantic versioning) with the frontend version of the interface. */
40
42
  static isVersionCompatible(backend, frontend) {
43
+ if (backend === frontend)
44
+ return true; // most common case, versions are identical
41
45
  const backendSemver = this.parseVer(backend);
42
46
  const frontendSemver = this.parseVer(frontend);
47
+ // if either has a prerelease tag, they are not compatible unless version strings are identical
48
+ if (backendSemver.prerelease || frontendSemver.prerelease)
49
+ return false;
43
50
  const difference = this.findDiff(backendSemver, frontendSemver);
44
51
  // If the major versions are different, the versions are not compatible
45
- // In the case of prerelease tags, they are compatible if the whole version string matches, otherwise it fails
46
- if ((backendSemver.prerelease !== undefined || frontendSemver.prerelease !== undefined) || difference === "major") {
47
- return difference === "same";
48
- }
49
- else if (backendSemver.major === 0 || frontendSemver.major === 0) {
50
- // If the major and minor versions match and major versions are 0, compatible as long as backend patch version is greater
51
- return difference === "same" || (difference === "patch" && frontendSemver.patch < backendSemver.patch);
52
- }
53
- else {
54
- // If the strings match exactly, major and minor match but patch differs, versions are compatible
55
- // If minor versions differ, compatible as long as backend patch versionn is greater
56
- return difference === "same" || difference === "patch" || (difference === "minor" && frontendSemver.minor < backendSemver.minor);
57
- }
52
+ if (difference === "major")
53
+ return false;
54
+ // special case for major version 0. If patch difference, backend patch must be greater than frontend patch
55
+ if (backendSemver.major === 0)
56
+ return (difference === "patch" && frontendSemver.patch < backendSemver.patch);
57
+ // patch difference is fine. If minor versions differ, compatible as long as backend minor version is greater
58
+ return difference === "patch" || (difference === "minor" && frontendSemver.minor < backendSemver.minor);
58
59
  }
59
- /** @internal */
60
+ /** @beta */
60
61
  constructor(routing = RpcRoutingToken_1.RpcRoutingToken.default) {
61
62
  this.routing = routing;
62
63
  this.configuration = RpcConfiguration_1.RpcConfiguration.supply(this);
@@ -1 +1 @@
1
- {"version":3,"file":"RpcInterface.js","sourceRoot":"","sources":["../../src/RpcInterface.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,kEAAyF;AACzF,wDAAyD;AACzD,sDAAkE;AAClE,gEAA6D;AAC7D,iDAAqE;AAGrE,+CAA2E;AAC3E,0DAA4E;AAC5E,sDAAiD;AAyBjD;;;GAGG;AACH,MAAsB,YAAY;IAExB,MAAM,CAAC,QAAQ,CAAC,OAAmB,EAAE,QAAoB;QAC/D,OAAO,OAAO,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,KAAK,QAAQ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;IAC5B,MAAM,IAAI,4BAAc,EAAE,CAAC;AAC7B,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module RpcInterface\r\n */\r\nimport { RpcConfiguration, RpcConfigurationSupplier } from \"./rpc/core/RpcConfiguration\";\r\nimport { CURRENT_REQUEST } from \"./rpc/core/RpcRegistry\";\r\nimport { aggregateLoad, RpcRequest } from \"./rpc/core/RpcRequest\";\r\nimport { RpcRoutingToken } from \"./rpc/core/RpcRoutingToken\";\r\nimport { InterceptedRpcRequest, IpcSession } from \"./ipc/IpcSession\";\r\nimport { RpcSerializedValue } from \"./rpc/core/RpcMarshaling\";\r\nimport { RpcManagedStatus } from \"./rpc/core/RpcProtocol\";\r\nimport { BentleyStatus, IModelError, NoContentError } from \"./IModelError\";\r\nimport { RpcRequestEvent, RpcRequestStatus } from \"./rpc/core/RpcConstants\";\r\nimport { BeDuration } from \"@itwin/core-bentley\";\r\nimport { RpcNotFoundResponse } from \"./rpc/core/RpcControl\";\r\n\r\n/* eslint-disable deprecation/deprecation */\r\n\r\n/**\r\n * Specifies the required static properties of an RpcInterface class.\r\n * These properties are used to identify RPC requests and responses.\r\n * @beta\r\n */\r\nexport interface RpcInterfaceDefinition<T extends RpcInterface = RpcInterface> { prototype: T, interfaceName: string, interfaceVersion: string }\r\n\r\n/**\r\n * A class that implements the operations of an RPC interface.\r\n * @beta\r\n */\r\nexport type RpcInterfaceImplementation<T extends RpcInterface = RpcInterface> = new () => T;\r\n\r\ninterface SemverType {\r\n major: number;\r\n minor: number;\r\n patch: number;\r\n prerelease?: string;\r\n}\r\n\r\n/** An RPC interface is a set of operations exposed by a service that a client can call, using configurable protocols,\r\n * in a platform-independent way. TheRpcInterface class is the base class for RPC interface definitions and implementations.\r\n * @public\r\n */\r\nexport abstract class RpcInterface {\r\n\r\n private static findDiff(backend: SemverType, frontend: SemverType) {\r\n return backend.major !== frontend.major ? \"major\" : backend.minor !== frontend.minor ? \"minor\" : backend.patch !== frontend.patch ? \"patch\" : backend.prerelease !== frontend.prerelease ? \"prerelease\" : \"same\";\r\n }\r\n\r\n private static parseVer(version: string): SemverType {\r\n // Split the version string into major.minor.path and prerelease tag\r\n const split = version.split(/[:-]/);\r\n // Split the major.minor.path into seperate components\r\n const prefix = split[0].split(\".\");\r\n if (split.length === 1) {\r\n return { major: Number(prefix[0]), minor: Number(prefix[1]), patch: Number(prefix[2]) };\r\n } else {\r\n return { major: Number(prefix[0]), minor: Number(prefix[1]), patch: Number(prefix[2]), prerelease: split[1] };\r\n }\r\n }\r\n\r\n /** Determines whether the backend version of an RPC interface is compatible (according to semantic versioning) with the frontend version of the interface. */\r\n public static isVersionCompatible(backend: string, frontend: string): boolean {\r\n const backendSemver = this.parseVer(backend);\r\n const frontendSemver = this.parseVer(frontend);\r\n const difference = this.findDiff(backendSemver, frontendSemver);\r\n\r\n // If the major versions are different, the versions are not compatible\r\n // In the case of prerelease tags, they are compatible if the whole version string matches, otherwise it fails\r\n if ((backendSemver.prerelease !== undefined || frontendSemver.prerelease !== undefined) || difference === \"major\") {\r\n return difference === \"same\";\r\n } else if (backendSemver.major === 0 || frontendSemver.major === 0) {\r\n // If the major and minor versions match and major versions are 0, compatible as long as backend patch version is greater\r\n return difference === \"same\" || (difference === \"patch\" && frontendSemver.patch < backendSemver.patch);\r\n } else {\r\n // If the strings match exactly, major and minor match but patch differs, versions are compatible\r\n // If minor versions differ, compatible as long as backend patch versionn is greater\r\n return difference === \"same\" || difference === \"patch\" || (difference === \"minor\" && frontendSemver.minor < backendSemver.minor);\r\n }\r\n }\r\n\r\n /** The configuration for the RPC interface.\r\n * @internal\r\n */\r\n public readonly configuration: RpcConfiguration;\r\n\r\n /** @internal */\r\n public readonly routing: RpcRoutingToken;\r\n\r\n /** @internal */\r\n public constructor(routing: RpcRoutingToken = RpcRoutingToken.default) {\r\n this.routing = routing;\r\n this.configuration = RpcConfiguration.supply(this);\r\n }\r\n\r\n /** Obtains the implementation result for an RPC operation. */\r\n public async forward<T = any>(parameters: IArguments): Promise<T> {\r\n const parametersCompat = (arguments.length === 1 && typeof (parameters) === \"object\") ? parameters : arguments;\r\n const parametersArray = Array.isArray(parametersCompat) ? parametersCompat : Array.prototype.slice.call(parametersCompat);\r\n const operationName = parametersArray.pop();\r\n\r\n const session = IpcSession.active;\r\n if (session) {\r\n return intercept(session, this, operationName, parametersArray);\r\n } else {\r\n const request = new (this.configuration.protocol.requestType as any)(this, operationName, parametersArray) as RpcRequest;\r\n request.submit(); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n (this as any)[CURRENT_REQUEST] = request;\r\n return request.response;\r\n }\r\n }\r\n\r\n /** @internal */\r\n public configurationSupplier: RpcConfigurationSupplier | undefined;\r\n}\r\n\r\nRpcInterface.prototype.configurationSupplier = undefined;\r\n\r\nclass InterceptedRequest extends RpcRequest {\r\n protected override async load(): Promise<RpcSerializedValue> { throw new Error(); }\r\n protected override async send(): Promise<number> { throw new Error(); }\r\n protected override setHeader(_name: string, _value: string): void { throw new Error(); }\r\n}\r\n\r\nasync function intercept(session: IpcSession, client: RpcInterface, operation: string, parameters: any[]) {\r\n const request = new InterceptedRequest(client, operation, []);\r\n (client as any)[CURRENT_REQUEST] = request;\r\n\r\n const context = await client.configuration.protocol.serialize(request);\r\n request.parameters = parameters;\r\n\r\n const info: InterceptedRpcRequest = {\r\n definition: {\r\n interfaceName: context.operation.interfaceDefinition,\r\n interfaceVersion: context.operation.interfaceVersion,\r\n },\r\n operation,\r\n parameters,\r\n context: {\r\n applicationId: context.applicationId,\r\n applicationVersion: context.applicationVersion,\r\n id: context.id,\r\n sessionId: context.sessionId,\r\n protocolVersion: (context.protocolVersion || 0).toString(),\r\n },\r\n };\r\n\r\n const dispatch = async () => {\r\n aggregateLoad.lastRequest = new Date().getTime();\r\n\r\n const response = await session.handleRpc(info);\r\n\r\n aggregateLoad.lastResponse = new Date().getTime();\r\n\r\n if (typeof (response) === \"object\" && response.hasOwnProperty(\"iTwinRpcCoreResponse\") && response.hasOwnProperty(\"managedStatus\")) {\r\n const status: RpcManagedStatus = response;\r\n\r\n if (status.managedStatus === \"pending\") {\r\n return handlePending(request, status, dispatch);\r\n } else if (status.managedStatus === \"notFound\") {\r\n return handleNotFound(request, status, dispatch);\r\n } else if (status.managedStatus === \"noContent\") {\r\n return handleNoContent();\r\n }\r\n } else {\r\n return response;\r\n }\r\n };\r\n\r\n return dispatch();\r\n}\r\n\r\nasync function handlePending(request: InterceptedRequest, status: RpcManagedStatus, dispatch: () => Promise<any>) {\r\n request._status = RpcRequestStatus.Pending;\r\n request._extendedStatus = (status.responseValue as { message: string }).message;\r\n RpcRequest.events.raiseEvent(RpcRequestEvent.PendingUpdateReceived, request);\r\n\r\n const delay = request.operation.policy.retryInterval(request.client.configuration);\r\n\r\n await BeDuration.wait(delay);\r\n return dispatch();\r\n}\r\n\r\nasync function handleNotFound(request: InterceptedRequest, status: RpcManagedStatus, dispatch: () => Promise<any>) {\r\n return new Promise((resolve, reject) => {\r\n let resubmitted = false;\r\n\r\n RpcRequest.notFoundHandlers.raiseEvent(request, status.responseValue as RpcNotFoundResponse, async () => {\r\n if (resubmitted) {\r\n throw new IModelError(BentleyStatus.ERROR, `Already resubmitted using this handler.`);\r\n }\r\n\r\n resubmitted = true;\r\n\r\n try {\r\n const response = await dispatch();\r\n resolve(response);\r\n } catch (err) {\r\n reject(err);\r\n }\r\n }, reject);\r\n });\r\n}\r\n\r\nasync function handleNoContent() {\r\n throw new NoContentError();\r\n}\r\n"]}
1
+ {"version":3,"file":"RpcInterface.js","sourceRoot":"","sources":["../../src/RpcInterface.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,kEAAyF;AACzF,wDAAyD;AACzD,sDAAkE;AAClE,gEAA6D;AAC7D,iDAAqE;AAGrE,+CAA2E;AA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e;IAC5B,MAAM,IAAI,4BAAc,EAAE,CAAC;AAC7B,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module RpcInterface\r\n */\r\nimport { RpcConfiguration, RpcConfigurationSupplier } from \"./rpc/core/RpcConfiguration\";\r\nimport { CURRENT_REQUEST } from \"./rpc/core/RpcRegistry\";\r\nimport { aggregateLoad, RpcRequest } from \"./rpc/core/RpcRequest\";\r\nimport { RpcRoutingToken } from \"./rpc/core/RpcRoutingToken\";\r\nimport { InterceptedRpcRequest, IpcSession } from \"./ipc/IpcSession\";\r\nimport { RpcSerializedValue } from \"./rpc/core/RpcMarshaling\";\r\nimport { RpcManagedStatus } from \"./rpc/core/RpcProtocol\";\r\nimport { BentleyStatus, IModelError, NoContentError } from \"./IModelError\";\r\nimport { RpcRequestEvent, RpcRequestStatus } from \"./rpc/core/RpcConstants\";\r\nimport { BeDuration } from \"@itwin/core-bentley\";\r\nimport { RpcNotFoundResponse } from \"./rpc/core/RpcControl\";\r\n\r\n/* eslint-disable deprecation/deprecation */\r\n\r\n/**\r\n * Specifies the required static properties of an RpcInterface class.\r\n * These properties are used to identify RPC requests and responses.\r\n * @beta\r\n */\r\nexport interface RpcInterfaceDefinition<T extends RpcInterface = RpcInterface> { prototype: T, interfaceName: string, interfaceVersion: string }\r\n\r\n/**\r\n * A class that implements the operations of an RPC interface.\r\n * @beta\r\n */\r\nexport type RpcInterfaceImplementation<T extends RpcInterface = RpcInterface> = new () => T;\r\n\r\ninterface SemverType {\r\n major: number;\r\n minor: number;\r\n patch: number;\r\n prerelease?: string;\r\n}\r\n\r\n/** An RPC interface is a set of operations exposed by a service that a client can call, using configurable protocols,\r\n * in a platform-independent way. TheRpcInterface class is the base class for RPC interface definitions and implementations.\r\n * @public\r\n */\r\nexport abstract class RpcInterface {\r\n\r\n private static findDiff(backend: SemverType, frontend: SemverType) {\r\n return backend.major !== frontend.major ? \"major\" :\r\n backend.minor !== frontend.minor ? \"minor\" :\r\n backend.patch !== frontend.patch ? \"patch\" :\r\n backend.prerelease !== frontend.prerelease ? \"prerelease\" :\r\n \"same\";\r\n }\r\n\r\n private static parseVer(version: string): SemverType {\r\n // separate the version from the prerelease tag\r\n const parts = version.split(/[:-]/);\r\n // Split the major.minor.path into separate components\r\n const prefix = parts[0].split(\".\");\r\n\r\n const ver: SemverType = { major: Number(prefix[0]), minor: Number(prefix[1]), patch: Number(prefix[2]) };\r\n if (parts.length > 1)\r\n ver.prerelease = parts[1];\r\n return ver;\r\n }\r\n\r\n /** Determines whether the backend version of an RPC interface is compatible (according to semantic versioning) with the frontend version of the interface. */\r\n public static isVersionCompatible(backend: string, frontend: string): boolean {\r\n if (backend === frontend)\r\n return true; // most common case, versions are identical\r\n\r\n const backendSemver = this.parseVer(backend);\r\n const frontendSemver = this.parseVer(frontend);\r\n\r\n // if either has a prerelease tag, they are not compatible unless version strings are identical\r\n if (backendSemver.prerelease || frontendSemver.prerelease)\r\n return false;\r\n\r\n const difference = this.findDiff(backendSemver, frontendSemver);\r\n // If the major versions are different, the versions are not compatible\r\n if (difference === \"major\")\r\n return false;\r\n\r\n // special case for major version 0. If patch difference, backend patch must be greater than frontend patch\r\n if (backendSemver.major === 0)\r\n return (difference === \"patch\" && frontendSemver.patch < backendSemver.patch);\r\n\r\n // patch difference is fine. If minor versions differ, compatible as long as backend minor version is greater\r\n return difference === \"patch\" || (difference === \"minor\" && frontendSemver.minor < backendSemver.minor);\r\n }\r\n\r\n /** The configuration for the RPC interface.\r\n * @internal\r\n */\r\n public readonly configuration: RpcConfiguration;\r\n\r\n /** @internal */\r\n public readonly routing: RpcRoutingToken;\r\n\r\n /** @beta */\r\n public constructor(routing: RpcRoutingToken = RpcRoutingToken.default) {\r\n this.routing = routing;\r\n this.configuration = RpcConfiguration.supply(this);\r\n }\r\n\r\n /** Obtains the implementation result for an RPC operation. */\r\n public async forward<T = any>(parameters: IArguments): Promise<T> {\r\n const parametersCompat = (arguments.length === 1 && typeof (parameters) === \"object\") ? parameters : arguments;\r\n const parametersArray = Array.isArray(parametersCompat) ? parametersCompat : Array.prototype.slice.call(parametersCompat);\r\n const operationName = parametersArray.pop();\r\n\r\n const session = IpcSession.active;\r\n if (session) {\r\n return intercept(session, this, operationName, parametersArray);\r\n } else {\r\n const request = new (this.configuration.protocol.requestType as any)(this, operationName, parametersArray) as RpcRequest;\r\n request.submit(); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n (this as any)[CURRENT_REQUEST] = request;\r\n return request.response;\r\n }\r\n }\r\n\r\n /** @internal */\r\n public configurationSupplier: RpcConfigurationSupplier | undefined;\r\n}\r\n\r\nRpcInterface.prototype.configurationSupplier = undefined;\r\n\r\nclass InterceptedRequest extends RpcRequest {\r\n protected override async load(): Promise<RpcSerializedValue> { throw new Error(); }\r\n protected override async send(): Promise<number> { throw new Error(); }\r\n protected override setHeader(_name: string, _value: string): void { throw new Error(); }\r\n}\r\n\r\nasync function intercept(session: IpcSession, client: RpcInterface, operation: string, parameters: any[]) {\r\n const request = new InterceptedRequest(client, operation, []);\r\n (client as any)[CURRENT_REQUEST] = request;\r\n\r\n const context = await client.configuration.protocol.serialize(request);\r\n request.parameters = parameters;\r\n\r\n const info: InterceptedRpcRequest = {\r\n definition: {\r\n interfaceName: context.operation.interfaceDefinition,\r\n interfaceVersion: context.operation.interfaceVersion,\r\n },\r\n operation,\r\n parameters,\r\n context: {\r\n applicationId: context.applicationId,\r\n applicationVersion: context.applicationVersion,\r\n id: context.id,\r\n sessionId: context.sessionId,\r\n protocolVersion: (context.protocolVersion || 0).toString(),\r\n },\r\n };\r\n\r\n const dispatch = async () => {\r\n aggregateLoad.lastRequest = new Date().getTime();\r\n\r\n const response = await session.handleRpc(info);\r\n\r\n aggregateLoad.lastResponse = new Date().getTime();\r\n\r\n if (typeof (response) === \"object\" && response.hasOwnProperty(\"iTwinRpcCoreResponse\") && response.hasOwnProperty(\"managedStatus\")) {\r\n const status: RpcManagedStatus = response;\r\n\r\n if (status.managedStatus === \"pending\") {\r\n return handlePending(request, status, dispatch);\r\n } else if (status.managedStatus === \"notFound\") {\r\n return handleNotFound(request, status, dispatch);\r\n } else if (status.managedStatus === \"noContent\") {\r\n return handleNoContent();\r\n }\r\n } else {\r\n return response;\r\n }\r\n };\r\n\r\n return dispatch();\r\n}\r\n\r\nasync function handlePending(request: InterceptedRequest, status: RpcManagedStatus, dispatch: () => Promise<any>) {\r\n request._status = RpcRequestStatus.Pending;\r\n request._extendedStatus = (status.responseValue as { message: string }).message;\r\n RpcRequest.events.raiseEvent(RpcRequestEvent.PendingUpdateReceived, request);\r\n\r\n const delay = request.operation.policy.retryInterval(request.client.configuration);\r\n\r\n await BeDuration.wait(delay);\r\n return dispatch();\r\n}\r\n\r\nasync function handleNotFound(request: InterceptedRequest, status: RpcManagedStatus, dispatch: () => Promise<any>) {\r\n return new Promise((resolve, reject) => {\r\n let resubmitted = false;\r\n\r\n RpcRequest.notFoundHandlers.raiseEvent(request, status.responseValue as RpcNotFoundResponse, async () => {\r\n if (resubmitted) {\r\n throw new IModelError(BentleyStatus.ERROR, `Already resubmitted using this handler.`);\r\n }\r\n\r\n resubmitted = true;\r\n\r\n try {\r\n const response = await dispatch();\r\n resolve(response);\r\n } catch (err) {\r\n reject(err);\r\n }\r\n }, reject);\r\n });\r\n}\r\n\r\nasync function handleNoContent() {\r\n throw new NoContentError();\r\n}\r\n"]}
@@ -193,7 +193,7 @@ export declare class SkySphere extends SkyBox {
193
193
  * @param gradient Optionally overrides the default gradient settings used if the image cannot be obtained.
194
194
  */
195
195
  constructor(image: TextureImageSpec, gradient?: SkyGradient);
196
- /** @internal override */
196
+ /** See [[SkyBox.toJSON]]. */
197
197
  toJSON(display?: boolean): SkyBoxProps;
198
198
  /** @internal */
199
199
  get textureIds(): Iterable<Id64String>;
@@ -207,10 +207,10 @@ export declare class SkyCube extends SkyBox {
207
207
  readonly images: SkyCubeProps;
208
208
  /** Create a new sky cube using the specified images.
209
209
  * @param images The images to map to each face of the cube.
210
- * @param Optionally overrides the default gradient settings used if the images cannot be obtained.
210
+ * @param gradient Optionally overrides the default gradient settings used if the images cannot be obtained.
211
211
  */
212
212
  constructor(images: SkyCubeProps, gradient?: SkyGradient);
213
- /** @internal override */
213
+ /** See [[SkyBox.toJSON]]. */
214
214
  toJSON(display?: boolean): SkyBoxProps;
215
215
  /** @internal */
216
216
  get textureIds(): Iterable<Id64String>;
@@ -1 +1 @@
1
- {"version":3,"file":"SkyBox.d.ts","sourceRoot":"","sources":["../../src/SkyBox.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAQ,UAAU,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnD;;;;GAIG;AACH,oBAAY,eAAe;IACzB,kEAAkE;IAClE,IAAI,IAAI;IACR;;OAEG;IACH,SAAS,IAAI;IACb,kCAAkC;IAClC,WAAW,IAAI;IACf;;OAEG;IACH,IAAI,IAAI;CACT;AAED;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,gBAAgB,CAAC;IACxB,IAAI,EAAE,gBAAgB,CAAC;IACvB,GAAG,EAAE,gBAAgB,CAAC;IACtB,MAAM,EAAE,gBAAgB,CAAC;IACzB,KAAK,EAAE,gBAAgB,CAAC;IACxB,IAAI,EAAE,gBAAgB,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,eAAe,CAAC,SAAS,CAAC;IAChC,OAAO,EAAE,gBAAgB,CAAC;IAC1B,gBAAgB;IAChB,QAAQ,CAAC,EAAE,KAAK,CAAC;CAClB;AAED;;;GAGG;AACH,MAAM,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AK/D,6BAA6B;IACb,MAAM,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,WAAW;IAUtD,gBAAgB;IAChB,IAAoB,UAAU,IAAI,QAAQ,CAAC,UAAU,CAAC,CAGrD;CACF"}
package/lib/cjs/SkyBox.js CHANGED
@@ -163,7 +163,7 @@ class SkySphere extends SkyBox {
163
163
  super(gradient ?? SkyGradient.defaults);
164
164
  this.image = image;
165
165
  }
166
- /** @internal override */
166
+ /** See [[SkyBox.toJSON]]. */
167
167
  toJSON(display) {
168
168
  const props = super.toJSON(display);
169
169
  props.image = {
@@ -185,13 +185,13 @@ exports.SkySphere = SkySphere;
185
185
  class SkyCube extends SkyBox {
186
186
  /** Create a new sky cube using the specified images.
187
187
  * @param images The images to map to each face of the cube.
188
- * @param Optionally overrides the default gradient settings used if the images cannot be obtained.
188
+ * @param gradient Optionally overrides the default gradient settings used if the images cannot be obtained.
189
189
  */
190
190
  constructor(images, gradient) {
191
191
  super(gradient ?? SkyGradient.defaults);
192
192
  this.images = { ...images };
193
193
  }
194
- /** @internal override */
194
+ /** See [[SkyBox.toJSON]]. */
195
195
  toJSON(display) {
196
196
  const props = super.toJSON(display);
197
197
  props.image = {
@@ -1 +1 @@
1
- {"version":3,"file":"SkyBox.js","sourceRoot":"","sources":["../../src/SkyBox.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAgF;AAChF,yCAAqD;AAGrD;;;;GAIG;AACH,IAAY,eAaX;AAbD,WAAY,eAAe;IACzB,kEAAkE;IAClE,qDAAQ,CAAA;IACR;;OAEG;IACH,+DAAa,CAAA;IACb,kCAAkC;IAClC,mEAAe,CAAA;IACf;;OAEG;IACH,qDAAQ,CAAA;AACV,CAAC,EAbW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAa1B;AA4GD,MAAM,kBAAkB,GAAG,mBAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AACxD,MAAM,k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I,CAAC,KAAK;SACpB,CAAC;QAEF,OAAO,KAAK,CAAC;IACf,CAAC;IAED,gBAAgB;IAChB,IAAoB,UAAU;QAC5B,OAAO,mBAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1D,CAAC;CACF;AA5BD,8BA4BC;AAED;;;GAGG;AACH,MAAa,OAAQ,SAAQ,MAAM;IAIjC;;;OAGG;IACH,YAAmB,MAAoB,EAAE,QAAsB;QAC7D,KAAK,CAAC,QAAQ,IAAI,WAAW,CAAC,QAAQ,CAAC,CAAC;QACxC,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,MAAM,EAAE,CAAC;IAC9B,CAAC;IAED,yBAAyB;IACT,MAAM,CAAC,OAAiB;QACtC,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACpC,KAAK,CAAC,KAAK,GAAG;YACZ,IAAI,EAAE,eAAe,CAAC,IAAI;YAC1B,QAAQ,EAAE,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE;SAC7B,CAAC;QAEF,OAAO,KAAK,CAAC;IACf,CAAC;IAED,gBAAgB;IAChB,IAAoB,UAAU;QAC5B,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC;QACzB,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,mBAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IAClH,CAAC;CACF;AA7BD,0BA6BC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module DisplayStyles\r\n */\r\n\r\nimport { Id64, Id64String, NonFunctionPropertiesOf } from \"@itwin/core-bentley\";\r\nimport { ColorDef, ColorDefProps } from \"./ColorDef\";\r\nimport { TextureImageSpec } from \"./RenderTexture\";\r\n\r\n/** Supported types of [[SkyBox]] images.\r\n * @see [[SkyBoxImageProps]].\r\n * @public\r\n * @extensions\r\n */\r\nexport enum SkyBoxImageType {\r\n /** No image, indicating a [[SkyGradient]] should be displayed. */\r\n None = 0,\r\n /** A single image mapped to the surface of a sphere.\r\n * @see [[SkySphere]].\r\n */\r\n Spherical = 1,\r\n /** @internal not yet supported */\r\n Cylindrical = 2,\r\n /** Six images mapped to the faces of a cube.\r\n * @see [[SkyCube]].\r\n */\r\n Cube = 3,\r\n}\r\n\r\n/** JSON representation of the six images used by a [[SkyCube]].\r\n * Each property specifies the image for a face of the cube as either an image URL, or the Id of a [Texture]($backend) element.\r\n * Each image must be square and have the same dimensions as all the other images.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface SkyCubeProps {\r\n front: TextureImageSpec;\r\n back: TextureImageSpec;\r\n top: TextureImageSpec;\r\n bottom: TextureImageSpec;\r\n right: TextureImageSpec;\r\n left: TextureImageSpec;\r\n}\r\n\r\n/** JSON representation of the image used for a [[SkySphere]].\r\n * @see [[SkyBoxProps.image]].\r\n * @public\r\n */\r\nexport interface SkySphereImageProps {\r\n type: SkyBoxImageType.Spherical;\r\n texture: TextureImageSpec;\r\n /** @internal */\r\n textures?: never;\r\n}\r\n\r\n/** JSON representation of the images used for a [[SkyCube]].\r\n * @see [[SkyBoxProps.image]].\r\n * @public\r\n */\r\nexport interface SkyCubeImageProps {\r\n type: SkyBoxImageType.Cube;\r\n textures: SkyCubeProps;\r\n /** @internal */\r\n texture?: never;\r\n}\r\n\r\n/** JSON representation of the image(s) to be mapped to the surfaces of a [[SkyBox]].\r\n * @see [[SkyBoxProps.image]].\r\n * @public\r\n * @extensions\r\n */\r\nexport type SkyBoxImageProps = SkySphereImageProps | SkyCubeImageProps | { type?: SkyBoxImageType, texture?: never, textures?: never };\r\n\r\n/** JSON representation of a [[SkyBox]] that can be drawn as the background of a [ViewState3d]($frontend).\r\n * An object of this type can describe one of several types of sky box:\r\n * - A cube with a texture image mapped to each face; or\r\n * - A sphere with a single texture image mapped to its surface; or\r\n * - A sphere with a two- or four-color vertical [[Gradient]] mapped to its surface.\r\n *\r\n * Whether cuboid or spherical, the skybox is drawn as if the viewer and the contents of the view are contained within its interior.\r\n *\r\n * For a two-color gradient, the gradient transitions smoothly from the nadir color at the bottom of the sphere to the zenith color at the top of the sphere.\r\n * The sky and ground colors are unused, as are the sky and ground exponents.\r\n *\r\n * For a four-color gradient, a \"horizon\" is produced on the equator of the sphere, where the ground color and sky color meet. The lower half of the sphere transitions\r\n * smoothly from the ground color at the equator to the nadir color at the bottom, and the upper half transitions from the sky color at the equator to the zenith color at\r\n * the top of the sphere.\r\n *\r\n * The color and exponent properties are unused if one or more texture images are supplied.\r\n *\r\n * The skybox is ignored entirely when an atmosphere is displayed.\r\n *\r\n * @see [[DisplayStyle3dSettings.environment]] to define the skybox for a display style.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface SkyBoxProps {\r\n /** Whether or not the skybox should be displayed.\r\n * Default: false.\r\n */\r\n display?: boolean;\r\n /** For a [[SkyGradient]], if true, a 2-color gradient skybox is used instead of a 4-color.\r\n * Default: false.\r\n */\r\n twoColor?: boolean;\r\n /** The color of the sky at the horizon. Unused unless this is a four-color [[SkyGradient]].\r\n * Default: (143, 205, 255).\r\n */\r\n skyColor?: ColorDefProps;\r\n /** The color of the ground at the horizon. Unused unless this is a four-color [[SkyGradient]].\r\n * Default: (120, 143, 125).\r\n */\r\n groundColor?: ColorDefProps;\r\n /** The color of the top of the sphere.\r\n * Default: (54, 117, 255).\r\n */\r\n zenithColor?: ColorDefProps;\r\n /** The color of the bottom of the sphere.\r\n * Default: (40, 15, 0).\r\n */\r\n nadirColor?: ColorDefProps;\r\n /** For a 4-color [[SkyGradient]], controls speed of change from sky color to zenith color; otherwise unused.\r\n * Default: 4.0.\r\n */\r\n skyExponent?: number;\r\n /** For a 4-color [[SkyGradient]], controls speed of change from ground color to nadir color; otherwise unused.\r\n * Default: 4.0.\r\n */\r\n groundExponent?: number;\r\n /** The image(s), if any, to be mapped to the surfaces of the sphere or cube. If undefined, the skybox will be displayed as a gradient instead.\r\n * Default: undefined.\r\n */\r\n image?: SkyBoxImageProps;\r\n}\r\n\r\nconst defaultGroundColor = ColorDef.from(143, 205, 125);\r\nconst defaultZenithColor = ColorDef.from(54, 117, 255);\r\nconst defaultNadirColor = ColorDef.from(40, 125, 0);\r\nconst defaultSkyColor = ColorDef.from(142, 205, 255);\r\nconst defaultExponent = 4.0;\r\n\r\nfunction colorDefFromJson(props?: ColorDefProps): ColorDef | undefined {\r\n return undefined !== props ? ColorDef.fromJSON(props) : undefined;\r\n}\r\n\r\n/** A type containing all of the properties and none of the methods of [[SkyGradient]] with `readonly` modifiers removed.\r\n * @see [[SkyGradient.create]] and [[SkyGradient.clone]].\r\n * @public\r\n */\r\nexport type SkyGradientProperties = NonFunctionPropertiesOf<SkyGradient>;\r\n\r\n/** Describes how to map a two- or four-color [[Gradient]] to the interior of a sphere to produce a [[SkyBox]].\r\n * @see [[SkyBox.gradient]].\r\n * @public\r\n */\r\nexport class SkyGradient {\r\n public readonly twoColor: boolean;\r\n public readonly skyColor: ColorDef;\r\n public readonly groundColor: ColorDef;\r\n public readonly zenithColor: ColorDef;\r\n public readonly nadirColor: ColorDef;\r\n public readonly skyExponent: number;\r\n public readonly groundExponent: number;\r\n\r\n private constructor(args: Partial<SkyGradientProperties>) {\r\n this.twoColor = args.twoColor ?? false;\r\n this.skyColor = args.skyColor ?? defaultSkyColor;\r\n this.groundColor = args.groundColor ?? defaultGroundColor;\r\n this.nadirColor = args.nadirColor ?? defaultNadirColor;\r\n this.zenithColor = args.zenithColor ?? defaultZenithColor;\r\n this.skyExponent = args.skyExponent ?? defaultExponent;\r\n this.groundExponent = args.groundExponent ?? defaultExponent;\r\n }\r\n\r\n /** Default settings for a four-color gradient. */\r\n public static readonly defaults = new SkyGradient({});\r\n\r\n /** Create a new gradient. Any properties not specified by `props` are initialized to their default values. */\r\n public static create(props?: Partial<SkyGradientProperties>): SkyGradient {\r\n return props ? new this(props) : this.defaults;\r\n }\r\n\r\n /** Create from JSON representation. */\r\n public static fromJSON(props?: SkyBoxProps): SkyGradient {\r\n if (!props)\r\n return this.defaults;\r\n\r\n return new this({\r\n twoColor: props.twoColor,\r\n skyExponent: props.skyExponent,\r\n groundExponent: props.groundExponent,\r\n skyColor: colorDefFromJson(props.skyColor),\r\n groundColor: colorDefFromJson(props.groundColor),\r\n nadirColor: colorDefFromJson(props.nadirColor),\r\n zenithColor: colorDefFromJson(props.zenithColor),\r\n });\r\n }\r\n\r\n /** Create ea copy of this gradient, identical except for any properties explicitly specified by `changedProps`.\r\n * Any properties of `changedProps` explicitly set to `undefined` will be reset to their default values.\r\n */\r\n public clone(changedProps: SkyGradientProperties): SkyGradient {\r\n return new SkyGradient({ ...this, ...changedProps });\r\n }\r\n\r\n /** Convert to JSON representation. */\r\n public toJSON(): SkyBoxProps {\r\n const props: SkyBoxProps = {\r\n skyColor: this.skyColor.toJSON(),\r\n groundColor: this.groundColor.toJSON(),\r\n nadirColor: this.nadirColor.toJSON(),\r\n zenithColor: this.zenithColor.toJSON(),\r\n };\r\n\r\n if (this.groundExponent !== defaultExponent)\r\n props.groundExponent = this.groundExponent;\r\n\r\n if (this.skyExponent !== defaultExponent)\r\n props.skyExponent = this.skyExponent;\r\n\r\n if (this.twoColor)\r\n props.twoColor = this.twoColor;\r\n\r\n return props;\r\n }\r\n\r\n /** Returns true if this gradient is equivalent to the supplied gradient. */\r\n public equals(other: SkyGradient): boolean {\r\n if (this === other)\r\n return true;\r\n\r\n return this.twoColor === other.twoColor && this.skyColor.equals(other.skyColor) && this.groundColor.equals(other.groundColor) &&\r\n this.zenithColor.equals(other.zenithColor) && this.nadirColor.equals(other.nadirColor);\r\n }\r\n}\r\n\r\n/** Describes how to draw a representation of a sky, as part of an [[Environment]].\r\n * @see [[SkyBoxProps]].\r\n * @public\r\n */\r\nexport class SkyBox {\r\n /** The gradient settings, used if no cube or sphere images are supplied, or if the images cannot be loaded. */\r\n public readonly gradient: SkyGradient;\r\n\r\n protected constructor(gradient: SkyGradient) {\r\n this.gradient = gradient;\r\n }\r\n\r\n /** Default settings for a four-color gradient. */\r\n public static readonly defaults = new SkyBox(SkyGradient.defaults);\r\n\r\n /** Create a skybox that displays the specified gradient, or the default gradient if none is supplied. */\r\n public static createGradient(gradient?: SkyGradient): SkyBox {\r\n return gradient ? new this(gradient) : this.defaults;\r\n }\r\n\r\n /** Create from JSON representation. */\r\n public static fromJSON(props?: SkyBoxProps): SkyBox {\r\n const gradient = SkyGradient.fromJSON(props);\r\n\r\n if (props?.image) {\r\n switch (props.image.type) {\r\n case SkyBoxImageType.Spherical:\r\n if (undefined !== props.image.texture)\r\n return new SkySphere(props.image.texture, gradient);\r\n\r\n break;\r\n case SkyBoxImageType.Cube: {\r\n const tx = props.image.textures;\r\n if (tx && undefined !== tx.top && undefined !== tx.bottom && undefined !== tx.right && undefined !== tx.left && undefined !== tx.front && undefined !== tx.back)\r\n return new SkyCube(tx, gradient);\r\n\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return this.createGradient(gradient);\r\n }\r\n\r\n /** Convert to JSON representation.\r\n * @param display If defined, the value to use for [[SkyBoxProps.display]]; otherwise, that property will be left undefined.\r\n */\r\n public toJSON(display?: boolean): SkyBoxProps {\r\n const props = this.gradient.toJSON();\r\n if (undefined !== display)\r\n props.display = display;\r\n\r\n return props;\r\n }\r\n\r\n /** @internal */\r\n public get textureIds(): Iterable<Id64String> {\r\n return [];\r\n }\r\n}\r\n\r\n/** Describes how to draw a representation of a sky by mapping a single image to the interior of a sphere.\r\n * @public\r\n */\r\nexport class SkySphere extends SkyBox {\r\n /** The image to map to the interior of the sphere. */\r\n public readonly image: TextureImageSpec;\r\n\r\n /** Create a new sky sphere using the specified image.\r\n * @param image The image to map to the interior of the sphere.\r\n * @param gradient Optionally overrides the default gradient settings used if the image cannot be obtained.\r\n */\r\n public constructor(image: TextureImageSpec, gradient?: SkyGradient) {\r\n super(gradient ?? SkyGradient.defaults);\r\n this.image = image;\r\n }\r\n\r\n /** @internal override */\r\n public override toJSON(display?: boolean): SkyBoxProps {\r\n const props = super.toJSON(display);\r\n props.image = {\r\n type: SkyBoxImageType.Spherical,\r\n texture: this.image,\r\n };\r\n\r\n return props;\r\n }\r\n\r\n /** @internal */\r\n public override get textureIds(): Iterable<Id64String> {\r\n return Id64.isValidId64(this.image) ? [this.image] : [];\r\n }\r\n}\r\n\r\n/** Describes how to draw a representation of a sky by mapping images to the interior faces of a cube.\r\n * The images are required to be *square*, and each image must have the same dimensions as the other images.\r\n * @public\r\n */\r\nexport class SkyCube extends SkyBox {\r\n /** The images to map to each face of the cube. */\r\n public readonly images: SkyCubeProps;\r\n\r\n /** Create a new sky cube using the specified images.\r\n * @param images The images to map to each face of the cube.\r\n * @param Optionally overrides the default gradient settings used if the images cannot be obtained.\r\n */\r\n public constructor(images: SkyCubeProps, gradient?: SkyGradient) {\r\n super(gradient ?? SkyGradient.defaults);\r\n this.images = { ...images };\r\n }\r\n\r\n /** @internal override */\r\n public override toJSON(display?: boolean): SkyBoxProps {\r\n const props = super.toJSON(display);\r\n props.image = {\r\n type: SkyBoxImageType.Cube,\r\n textures: { ...this.images },\r\n };\r\n\r\n return props;\r\n }\r\n\r\n /** @internal */\r\n public override get textureIds(): Iterable<Id64String> {\r\n const imgs = this.images;\r\n return [imgs.front, imgs.back, imgs.top, imgs.bottom, imgs.left, imgs.right].filter((x) => Id64.isValidId64(x));\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"SkyBox.js","sourceRoot":"","sources":["../../src/SkyBox.ts"],"names":[],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M,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC;QACzB,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,mBAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IAClH,CAAC;CACF;AA7BD,0BA6BC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module DisplayStyles\r\n */\r\n\r\nimport { Id64, Id64String, NonFunctionPropertiesOf } from \"@itwin/core-bentley\";\r\nimport { ColorDef, ColorDefProps } from \"./ColorDef\";\r\nimport { TextureImageSpec } from \"./RenderTexture\";\r\n\r\n/** Supported types of [[SkyBox]] images.\r\n * @see [[SkyBoxImageProps]].\r\n * @public\r\n * @extensions\r\n */\r\nexport enum SkyBoxImageType {\r\n /** No image, indicating a [[SkyGradient]] should be displayed. */\r\n None = 0,\r\n /** A single image mapped to the surface of a sphere.\r\n * @see [[SkySphere]].\r\n */\r\n Spherical = 1,\r\n /** @internal not yet supported */\r\n Cylindrical = 2,\r\n /** Six images mapped to the faces of a cube.\r\n * @see [[SkyCube]].\r\n */\r\n Cube = 3,\r\n}\r\n\r\n/** JSON representation of the six images used by a [[SkyCube]].\r\n * Each property specifies the image for a face of the cube as either an image URL, or the Id of a [Texture]($backend) element.\r\n * Each image must be square and have the same dimensions as all the other images.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface SkyCubeProps {\r\n front: TextureImageSpec;\r\n back: TextureImageSpec;\r\n top: TextureImageSpec;\r\n bottom: TextureImageSpec;\r\n right: TextureImageSpec;\r\n left: TextureImageSpec;\r\n}\r\n\r\n/** JSON representation of the image used for a [[SkySphere]].\r\n * @see [[SkyBoxProps.image]].\r\n * @public\r\n */\r\nexport interface SkySphereImageProps {\r\n type: SkyBoxImageType.Spherical;\r\n texture: TextureImageSpec;\r\n /** @internal */\r\n textures?: never;\r\n}\r\n\r\n/** JSON representation of the images used for a [[SkyCube]].\r\n * @see [[SkyBoxProps.image]].\r\n * @public\r\n */\r\nexport interface SkyCubeImageProps {\r\n type: SkyBoxImageType.Cube;\r\n textures: SkyCubeProps;\r\n /** @internal */\r\n texture?: never;\r\n}\r\n\r\n/** JSON representation of the image(s) to be mapped to the surfaces of a [[SkyBox]].\r\n * @see [[SkyBoxProps.image]].\r\n * @public\r\n * @extensions\r\n */\r\nexport type SkyBoxImageProps = SkySphereImageProps | SkyCubeImageProps | { type?: SkyBoxImageType, texture?: never, textures?: never };\r\n\r\n/** JSON representation of a [[SkyBox]] that can be drawn as the background of a [ViewState3d]($frontend).\r\n * An object of this type can describe one of several types of sky box:\r\n * - A cube with a texture image mapped to each face; or\r\n * - A sphere with a single texture image mapped to its surface; or\r\n * - A sphere with a two- or four-color vertical [[Gradient]] mapped to its surface.\r\n *\r\n * Whether cuboid or spherical, the skybox is drawn as if the viewer and the contents of the view are contained within its interior.\r\n *\r\n * For a two-color gradient, the gradient transitions smoothly from the nadir color at the bottom of the sphere to the zenith color at the top of the sphere.\r\n * The sky and ground colors are unused, as are the sky and ground exponents.\r\n *\r\n * For a four-color gradient, a \"horizon\" is produced on the equator of the sphere, where the ground color and sky color meet. The lower half of the sphere transitions\r\n * smoothly from the ground color at the equator to the nadir color at the bottom, and the upper half transitions from the sky color at the equator to the zenith color at\r\n * the top of the sphere.\r\n *\r\n * The color and exponent properties are unused if one or more texture images are supplied.\r\n *\r\n * The skybox is ignored entirely when an atmosphere is displayed.\r\n *\r\n * @see [[DisplayStyle3dSettings.environment]] to define the skybox for a display style.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface SkyBoxProps {\r\n /** Whether or not the skybox should be displayed.\r\n * Default: false.\r\n */\r\n display?: boolean;\r\n /** For a [[SkyGradient]], if true, a 2-color gradient skybox is used instead of a 4-color.\r\n * Default: false.\r\n */\r\n twoColor?: boolean;\r\n /** The color of the sky at the horizon. Unused unless this is a four-color [[SkyGradient]].\r\n * Default: (143, 205, 255).\r\n */\r\n skyColor?: ColorDefProps;\r\n /** The color of the ground at the horizon. Unused unless this is a four-color [[SkyGradient]].\r\n * Default: (120, 143, 125).\r\n */\r\n groundColor?: ColorDefProps;\r\n /** The color of the top of the sphere.\r\n * Default: (54, 117, 255).\r\n */\r\n zenithColor?: ColorDefProps;\r\n /** The color of the bottom of the sphere.\r\n * Default: (40, 15, 0).\r\n */\r\n nadirColor?: ColorDefProps;\r\n /** For a 4-color [[SkyGradient]], controls speed of change from sky color to zenith color; otherwise unused.\r\n * Default: 4.0.\r\n */\r\n skyExponent?: number;\r\n /** For a 4-color [[SkyGradient]], controls speed of change from ground color to nadir color; otherwise unused.\r\n * Default: 4.0.\r\n */\r\n groundExponent?: number;\r\n /** The image(s), if any, to be mapped to the surfaces of the sphere or cube. If undefined, the skybox will be displayed as a gradient instead.\r\n * Default: undefined.\r\n */\r\n image?: SkyBoxImageProps;\r\n}\r\n\r\nconst defaultGroundColor = ColorDef.from(143, 205, 125);\r\nconst defaultZenithColor = ColorDef.from(54, 117, 255);\r\nconst defaultNadirColor = ColorDef.from(40, 125, 0);\r\nconst defaultSkyColor = ColorDef.from(142, 205, 255);\r\nconst defaultExponent = 4.0;\r\n\r\nfunction colorDefFromJson(props?: ColorDefProps): ColorDef | undefined {\r\n return undefined !== props ? ColorDef.fromJSON(props) : undefined;\r\n}\r\n\r\n/** A type containing all of the properties and none of the methods of [[SkyGradient]] with `readonly` modifiers removed.\r\n * @see [[SkyGradient.create]] and [[SkyGradient.clone]].\r\n * @public\r\n */\r\nexport type SkyGradientProperties = NonFunctionPropertiesOf<SkyGradient>;\r\n\r\n/** Describes how to map a two- or four-color [[Gradient]] to the interior of a sphere to produce a [[SkyBox]].\r\n * @see [[SkyBox.gradient]].\r\n * @public\r\n */\r\nexport class SkyGradient {\r\n public readonly twoColor: boolean;\r\n public readonly skyColor: ColorDef;\r\n public readonly groundColor: ColorDef;\r\n public readonly zenithColor: ColorDef;\r\n public readonly nadirColor: ColorDef;\r\n public readonly skyExponent: number;\r\n public readonly groundExponent: number;\r\n\r\n private constructor(args: Partial<SkyGradientProperties>) {\r\n this.twoColor = args.twoColor ?? false;\r\n this.skyColor = args.skyColor ?? defaultSkyColor;\r\n this.groundColor = args.groundColor ?? defaultGroundColor;\r\n this.nadirColor = args.nadirColor ?? defaultNadirColor;\r\n this.zenithColor = args.zenithColor ?? defaultZenithColor;\r\n this.skyExponent = args.skyExponent ?? defaultExponent;\r\n this.groundExponent = args.groundExponent ?? defaultExponent;\r\n }\r\n\r\n /** Default settings for a four-color gradient. */\r\n public static readonly defaults = new SkyGradient({});\r\n\r\n /** Create a new gradient. Any properties not specified by `props` are initialized to their default values. */\r\n public static create(props?: Partial<SkyGradientProperties>): SkyGradient {\r\n return props ? new this(props) : this.defaults;\r\n }\r\n\r\n /** Create from JSON representation. */\r\n public static fromJSON(props?: SkyBoxProps): SkyGradient {\r\n if (!props)\r\n return this.defaults;\r\n\r\n return new this({\r\n twoColor: props.twoColor,\r\n skyExponent: props.skyExponent,\r\n groundExponent: props.groundExponent,\r\n skyColor: colorDefFromJson(props.skyColor),\r\n groundColor: colorDefFromJson(props.groundColor),\r\n nadirColor: colorDefFromJson(props.nadirColor),\r\n zenithColor: colorDefFromJson(props.zenithColor),\r\n });\r\n }\r\n\r\n /** Create ea copy of this gradient, identical except for any properties explicitly specified by `changedProps`.\r\n * Any properties of `changedProps` explicitly set to `undefined` will be reset to their default values.\r\n */\r\n public clone(changedProps: SkyGradientProperties): SkyGradient {\r\n return new SkyGradient({ ...this, ...changedProps });\r\n }\r\n\r\n /** Convert to JSON representation. */\r\n public toJSON(): SkyBoxProps {\r\n const props: SkyBoxProps = {\r\n skyColor: this.skyColor.toJSON(),\r\n groundColor: this.groundColor.toJSON(),\r\n nadirColor: this.nadirColor.toJSON(),\r\n zenithColor: this.zenithColor.toJSON(),\r\n };\r\n\r\n if (this.groundExponent !== defaultExponent)\r\n props.groundExponent = this.groundExponent;\r\n\r\n if (this.skyExponent !== defaultExponent)\r\n props.skyExponent = this.skyExponent;\r\n\r\n if (this.twoColor)\r\n props.twoColor = this.twoColor;\r\n\r\n return props;\r\n }\r\n\r\n /** Returns true if this gradient is equivalent to the supplied gradient. */\r\n public equals(other: SkyGradient): boolean {\r\n if (this === other)\r\n return true;\r\n\r\n return this.twoColor === other.twoColor && this.skyColor.equals(other.skyColor) && this.groundColor.equals(other.groundColor) &&\r\n this.zenithColor.equals(other.zenithColor) && this.nadirColor.equals(other.nadirColor);\r\n }\r\n}\r\n\r\n/** Describes how to draw a representation of a sky, as part of an [[Environment]].\r\n * @see [[SkyBoxProps]].\r\n * @public\r\n */\r\nexport class SkyBox {\r\n /** The gradient settings, used if no cube or sphere images are supplied, or if the images cannot be loaded. */\r\n public readonly gradient: SkyGradient;\r\n\r\n protected constructor(gradient: SkyGradient) {\r\n this.gradient = gradient;\r\n }\r\n\r\n /** Default settings for a four-color gradient. */\r\n public static readonly defaults = new SkyBox(SkyGradient.defaults);\r\n\r\n /** Create a skybox that displays the specified gradient, or the default gradient if none is supplied. */\r\n public static createGradient(gradient?: SkyGradient): SkyBox {\r\n return gradient ? new this(gradient) : this.defaults;\r\n }\r\n\r\n /** Create from JSON representation. */\r\n public static fromJSON(props?: SkyBoxProps): SkyBox {\r\n const gradient = SkyGradient.fromJSON(props);\r\n\r\n if (props?.image) {\r\n switch (props.image.type) {\r\n case SkyBoxImageType.Spherical:\r\n if (undefined !== props.image.texture)\r\n return new SkySphere(props.image.texture, gradient);\r\n\r\n break;\r\n case SkyBoxImageType.Cube: {\r\n const tx = props.image.textures;\r\n if (tx && undefined !== tx.top && undefined !== tx.bottom && undefined !== tx.right && undefined !== tx.left && undefined !== tx.front && undefined !== tx.back)\r\n return new SkyCube(tx, gradient);\r\n\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return this.createGradient(gradient);\r\n }\r\n\r\n /** Convert to JSON representation.\r\n * @param display If defined, the value to use for [[SkyBoxProps.display]]; otherwise, that property will be left undefined.\r\n */\r\n public toJSON(display?: boolean): SkyBoxProps {\r\n const props = this.gradient.toJSON();\r\n if (undefined !== display)\r\n props.display = display;\r\n\r\n return props;\r\n }\r\n\r\n /** @internal */\r\n public get textureIds(): Iterable<Id64String> {\r\n return [];\r\n }\r\n}\r\n\r\n/** Describes how to draw a representation of a sky by mapping a single image to the interior of a sphere.\r\n * @public\r\n */\r\nexport class SkySphere extends SkyBox {\r\n /** The image to map to the interior of the sphere. */\r\n public readonly image: TextureImageSpec;\r\n\r\n /** Create a new sky sphere using the specified image.\r\n * @param image The image to map to the interior of the sphere.\r\n * @param gradient Optionally overrides the default gradient settings used if the image cannot be obtained.\r\n */\r\n public constructor(image: TextureImageSpec, gradient?: SkyGradient) {\r\n super(gradient ?? SkyGradient.defaults);\r\n this.image = image;\r\n }\r\n\r\n /** See [[SkyBox.toJSON]]. */\r\n public override toJSON(display?: boolean): SkyBoxProps {\r\n const props = super.toJSON(display);\r\n props.image = {\r\n type: SkyBoxImageType.Spherical,\r\n texture: this.image,\r\n };\r\n\r\n return props;\r\n }\r\n\r\n /** @internal */\r\n public override get textureIds(): Iterable<Id64String> {\r\n return Id64.isValidId64(this.image) ? [this.image] : [];\r\n }\r\n}\r\n\r\n/** Describes how to draw a representation of a sky by mapping images to the interior faces of a cube.\r\n * The images are required to be *square*, and each image must have the same dimensions as the other images.\r\n * @public\r\n */\r\nexport class SkyCube extends SkyBox {\r\n /** The images to map to each face of the cube. */\r\n public readonly images: SkyCubeProps;\r\n\r\n /** Create a new sky cube using the specified images.\r\n * @param images The images to map to each face of the cube.\r\n * @param gradient Optionally overrides the default gradient settings used if the images cannot be obtained.\r\n */\r\n public constructor(images: SkyCubeProps, gradient?: SkyGradient) {\r\n super(gradient ?? SkyGradient.defaults);\r\n this.images = { ...images };\r\n }\r\n\r\n /** See [[SkyBox.toJSON]]. */\r\n public override toJSON(display?: boolean): SkyBoxProps {\r\n const props = super.toJSON(display);\r\n props.image = {\r\n type: SkyBoxImageType.Cube,\r\n textures: { ...this.images },\r\n };\r\n\r\n return props;\r\n }\r\n\r\n /** @internal */\r\n public override get textureIds(): Iterable<Id64String> {\r\n const imgs = this.images;\r\n return [imgs.front, imgs.back, imgs.top, imgs.bottom, imgs.left, imgs.right].filter((x) => Id64.isValidId64(x));\r\n }\r\n}\r\n"]}
@@ -249,11 +249,11 @@ export declare class ViewFlags {
249
249
  hiddenEdgesVisible(): boolean;
250
250
  /** Returns true if the edges of surfaces should be displayed, based on [[RenderMode]] and the [[visibleEdges]] flag. */
251
251
  edgesRequired(): boolean;
252
- /** Convert to JSON representation. */
253
- toJSON(): ViewFlagProps;
254
- /** Like [[toJSON]], but no properties are omitted.
255
- * @internal
252
+ /** Convert to JSON representation.
253
+ * Properties are omitted if they match the default values.
256
254
  */
255
+ toJSON(): ViewFlagProps;
256
+ /** Like [[toJSON]], but no properties are omitted. */
257
257
  toFullyDefinedJSON(): Required<ViewFlagProps>;
258
258
  /** A ViewFlags object with all properties initialized to their default values. */
259
259
  static readonly defaults: ViewFlags;
@@ -1 +1 @@
1
- {"version":3,"file":"ViewFlags.d.ts","sourceRoot":"","sources":["../../src/ViewFlags.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,EAAa,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAElF;;;;GAIG;AACH,oBAAY,UAAU;IACpB;;;;OAIG;IACH,SAAS,IAAI;IACb;;;;OAIG;IACH,WAAW,IAAI;IACf;;;;;OAKG;IACH,SAAS,IAAI;IACb;;;OAGG;IACH,UAAU,IAAI;CACf;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,aAAa;IAC5B,+EAA+E;IAC/E,WAAW,CAA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AAkB,IAAI,QAAQ,CAAC,aAAa,CAAC;IA+BpD,kFAAkF;IAClF,gBAAuB,QAAQ,YAAmB;IAElD;;OAEG;WACW,MAAM,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,GAAG,SAAS;IAIrE;;;;;;;OAOG;WACW,QAAQ,CAAC,IAAI,CAAC,EAAE,aAAa,GAAG,SAAS;IA0CvD,yDAAyD;IAClD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,mBAAmB,CAAC,GAAG,OAAO;CA6B7D;AAED;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC,CAAC;AAE9E;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC"}
@@ -194,7 +194,9 @@ class ViewFlags {
194
194
  edgesRequired() {
195
195
  return edgesRequired(this.renderMode, this.visibleEdges);
196
196
  }
197
- /** Convert to JSON representation. */
197
+ /** Convert to JSON representation.
198
+ * Properties are omitted if they match the default values.
199
+ */
198
200
  toJSON() {
199
201
  const out = {};
200
202
  if (!this.constructions)
@@ -246,9 +248,7 @@ class ViewFlags {
246
248
  out.renderMode = this.renderMode;
247
249
  return out;
248
250
  }
249
- /** Like [[toJSON]], but no properties are omitted.
250
- * @internal
251
- */
251
+ /** Like [[toJSON]], but no properties are omitted. */
252
252
  toFullyDefinedJSON() {
253
253
  return {
254
254
  renderMode: this.renderMode,
@@ -1 +1 @@
1
- {"version":3,"file":"ViewFlags.js","sourceRoot":"","sources":["../../src/ViewFlags.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,qBAAqB;AAErB,sDAAkF;AAElF;;;;GAIG;AACH,IAAY,UAyBX;AAzBD,WAAY,UAAU;IACpB;;;;OAIG;IACH,qDAAa,CAAA;IACb;;;;OAIG;IACH,yDAAe,CAAA;IACf;;;;;OAKG;IACH,qDAAa,C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CAAC,UAAU,KAAK,KAAK,CAAC,UAAU;eACpC,IAAI,CAAC,aAAa,KAAK,KAAK,CAAC,aAAa;eAC1C,IAAI,CAAC,gBAAgB,KAAK,KAAK,CAAC,gBAAgB;eAChD,IAAI,CAAC,eAAe,KAAK,KAAK,CAAC,eAAe;eAC9C,IAAI,CAAC,QAAQ,KAAK,KAAK,CAAC,QAAQ;eAChC,IAAI,CAAC,mBAAmB,KAAK,KAAK,CAAC,mBAAmB;eACtD,IAAI,CAAC,oBAAoB,KAAK,KAAK,CAAC,oBAAoB,CAAC;IAChE,CAAC;;AAzFD,kFAAkF;AAC3D,kBAAQ,GAAG,IAAI,SAAS,EAAE,CAAC;AAzTvC,8BAAS","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module DisplayStyles\r\n */\r\n\r\n// cspell:ignore ovrs\r\n\r\nimport { JsonUtils, Mutable, NonFunctionPropertiesOf } from \"@itwin/core-bentley\";\r\n\r\n/** Enumerates the available basic rendering modes, as part of a [DisplayStyle]($backend)'s [[ViewFlags]].\r\n * The rendering mode broadly affects various aspects of the display style - in particular, whether and how surfaces and their edges are drawn.\r\n * @public\r\n * @extensions\r\n */\r\nexport enum RenderMode {\r\n /** Renders only the edges of surfaces, with exceptions for planar regions based on their [[FillFlags]].\r\n * Lighting (and by extension, shadows) is not applied.\r\n * [[HiddenLine.Settings]] are not applied - edges use the elements' width, style, and color.\r\n * [[ViewFlags.hiddenEdges]] is ignored - hidden edges are never displayed in wireframe mode.\r\n */\r\n Wireframe = 0,\r\n /** By default, renders surfaces without their edges.\r\n * Lighting and shadows can be applied using [[ViewFlags.lighting]] and [[ViewFlags.shadows]].\r\n * Edges can be enabled using [[ViewFlags.visibleEdges]] and [[ViewFlags.hiddenEdges]], and their appearance customized using [[HiddenLine.Settings]].\r\n * Surfaces can be drawn with transparency, based on [[ViewFlags.transparency]].\r\n */\r\n SmoothShade = 6,\r\n /** Renders surfaces and their edges. By default, edges are drawn in white; this can be overridden using [[HiddenLine.Settings]].\r\n * All surfaces are rendered opaque. If a surface's transparency is below that specified by [[HiddenLine.Settings.transparencyThreshold]], it is not rendered.\r\n * Materials and textures are not applied - surfaces are drawn in their actual colors.\r\n * [[ViewFlags.visibleEdges]] is ignored - visible edges are always drawn. Hidden edges can be enabled using [[ViewFlags.hiddenEdges]].\r\n * Lighting (and by extension, shadows) is not applied.\r\n */\r\n SolidFill = 4,\r\n /** Identical to [[RenderMode.SolidFill]], except:\r\n * - Surfaces are drawn using the [DisplayStyle]($backend)'s background color.\r\n * - Edges are drawn using their surface's colors; this can be overridden using [[HiddenLine.Settings]].\r\n */\r\n HiddenLine = 3,\r\n}\r\n\r\n/** JSON representation of [[ViewFlags]].\r\n * This is a persistence format with some unfortunate quirks that have been retained for backwards compatibility.\r\n * In particular, it supplies three separate flags intended to control lighting - [[noCameraLights]], [[noSourceLights]], and [[noSolarLight]] -\r\n * but there exists only a single [[ViewFlags.lighting]] flag. [[ViewFlags.lighting]] is set to true unless all three of the \"no lighting\" flags are true.\r\n * It also uses awkward negative ([[noConstruct]], [[noTransp]]) and/or abbreviated ([[clipVol]], [[visEdges]]) property names that differ from\r\n * those of the corresponding [[ViewFlags]] properties, making usage of this type in code error-prone.\r\n * Prefer to use [[ViewFlagsProperties]] unless you need to work directly with the persistence format.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface ViewFlagProps {\r\n /** If true, don't display geometry of class [[GeometryClass.Construction]]. */\r\n noConstruct?: boolean;\r\n /** If true, don't display geometry of class [[GeometryClass.Dimension]]. */\r\n noDim?: boolean;\r\n /** If true, don't display geometry of class [[GeometryClass.Pattern]]. */\r\n noPattern?: boolean;\r\n /** If true, all lines are drawn with a width of 1 pixel. */\r\n noWeight?: boolean;\r\n /** If true, don't apply [[LinePixels]] styles. */\r\n noStyle?: boolean;\r\n /** If true, display transparency geometry as opaque. */\r\n noTransp?: boolean;\r\n /** If true, don't show filled planar regions, unless they use [[FillFlags.Always]]. */\r\n noFill?: boolean;\r\n /** If true, display a grid in the view. */\r\n grid?: boolean;\r\n /** If true, display graphics representing the [AuxCoordSystem]($backend). */\r\n acs?: boolean;\r\n /** If true, don't apply [[RenderTexture]]s to surfaces. */\r\n noTexture?: boolean;\r\n /** If true, don't apply [[RenderMaterial]]s to surfaces. */\r\n noMaterial?: boolean;\r\n /** See [[ViewFlagProps]] for how this affects [[ViewFlags.lighting]]. */\r\n noCameraLights?: boolean;\r\n /** See [[ViewFlagProps]] for how this affects [[ViewFlags.lighting]]. */\r\n noSourceLights?: boolean;\r\n /** See [[ViewFlagProps]] for how this affects [[ViewFlags.lighting]]. */\r\n noSolarLight?: boolean;\r\n /** If true, display the edges of surfaces. */\r\n visEdges?: boolean;\r\n /** If true, display the edges of surfaces, even if they are behind other geometry. */\r\n hidEdges?: boolean;\r\n /** If true, display shadows. */\r\n shadows?: boolean;\r\n /** If true, apply the view's clipping volume. Has no effect on other types of clips like [[ModelClipGroups]]. */\r\n clipVol?: boolean;\r\n /** If true, apply the view's [[DisplayStyleSettings.monochromeColor]] and [[DisplayStyleSettings.monochromeMode]] to produce a monochrome image. */\r\n monochrome?: boolean;\r\n /** The basic rendering mode, which affects the behavior of other flags. */\r\n renderMode?: RenderMode;\r\n /** Display a background map. */\r\n backgroundMap?: boolean;\r\n /** If true, apply [[AmbientOcclusion]]. */\r\n ambientOcclusion?: boolean;\r\n /** If true, apply [[ThematicDisplay]]. */\r\n thematicDisplay?: boolean;\r\n /** If true, overlay surfaces with wiremesh to reveal their triangulation. */\r\n wiremesh?: boolean;\r\n /** Controls whether surface discard is always applied regardless of other ViewFlags.\r\n * Surface shaders contain complicated logic to ensure that the edges of a surface always draw in front of the surface, and that planar surfaces sketched coincident with\r\n * non-planar surfaces always draw in front of those non-planar surfaces.\r\n * When this view flag is set to false (the default), then for 3d views if the render mode is wireframe (only edges are displayed) or smooth shader with visible edges turned off (only surfaces are displayed),\r\n * that logic does not execute, potentially improving performance for no degradation in visual quality. In some scenarios - such as wireframe views containing many planar regions with interior fill, or smooth views containing many coincident planar and non-planar surfaces - enabling this view flag improves display quality by forcing that logic to execute.\r\n */\r\n forceSurfaceDiscard?: boolean;\r\n /** Disables the \"white-on-white reversal\" employed by some CAD applications.\r\n * @see [[ViewFlags.whiteOnWhiteReversal]].\r\n */\r\n noWhiteOnWhiteReversal?: boolean;\r\n}\r\n\r\nfunction edgesRequired(renderMode: RenderMode, visibleEdges: boolean): boolean {\r\n return visibleEdges || RenderMode.SmoothShade !== renderMode;\r\n}\r\n\r\n/** Flags controlling how graphics appear within a view.\r\n * A [[ViewFlags]] object is immutable. There are several ways to produce a modified copy of a ViewFlags object:\r\n * ```ts\r\n * // Start with the default values for all properties.\r\n * let vf = ViewFlags.defaults;\r\n * // Change a single boolean property:\r\n * vf = vf.with(\"visibleEdges\", true);\r\n * // Change only the render mode:\r\n * vf = vf.withRenderMode(RenderMode.HiddenLine);\r\n * // Change multiple properties:\r\n * vf = vf.copy({ renderMode: RenderMode.SmoothShade, visibleEdges: true });\r\n * // Reset multiple properties to their default values:\r\n * vf = vf.copy({ renderMode: undefined, visibleEdges: undefined });\r\n *\r\n * ```\r\n * [[with]] and [[withRenderMode]] should be preferred if you only need to change a single property, as they will not create a new object unless\r\n * the new value differs from the current value.\r\n * [[copy]] and [[override]] should be preferred if you need to change multiple properties, as they will create no more than one new object, vs\r\n * each call to [[with]] or [[withRenderMode]] potentially creating a new object.\r\n * @see [[DisplayStyleSettings.viewFlags]] to define the view flags for a [DisplayStyle]($backend).\r\n * @public\r\n */\r\nexport class ViewFlags {\r\n /** The basic rendering mode applied to the view. This modulates the behavior of some of the other flags.\r\n * Default: [[RenderMode.Wireframe]].\r\n * @see [[RenderMode]] for details.\r\n */\r\n public readonly renderMode: RenderMode;\r\n /** Whether to display geometry of class [[GeometryClass.Dimension]]. Default: true. */\r\n public readonly dimensions: boolean;\r\n /** Whether to display geometry of class [[GeometryClass.Pattern]]. Default: true. */\r\n public readonly patterns: boolean;\r\n /** Whether to allow lines and edges to draw with width greater than one pixel. Default: true. */\r\n public readonly weights: boolean;\r\n /** Whether [[LinePixels]] are allowed to apply patterns to lines and edges. If false, they all draw as solid lines. Default: true. */\r\n public readonly styles: boolean;\r\n /** Whether element transparency is applied. If false, transparent geometry is drawn opaque. Default: true.\r\n * @see [[RenderMode]] for render mode-specific behavior.\r\n */\r\n public readonly transparency: boolean;\r\n /** In [[RenderMode.Wireframe]] only, whether to display the interiors of planar regions with [[FillFlags.ByView]]. Default: true. */\r\n public readonly fill: boolean;\r\n /** In [[RenderMode.SmoothShade]], whether to apply [[RenderTexture]]s to surfaces. Default: true. */\r\n public readonly textures: boolean;\r\n /** In [[RenderMode.SmoothShade]], whether to apply [[RenderMaterial]]s to surfaces. Default: true. */\r\n public readonly materials: boolean;\r\n /** Whether to display a graphical representation of the view's [AuxCoordSystem]($backend). Default: false. */\r\n public readonly acsTriad: boolean;\r\n /** Whether to display a grid. Default: false. */\r\n public readonly grid: boolean;\r\n /** In [[RenderMode.SmoothShade]], whether to display the edges of surfaces. Default: false.\r\n * @see [[HiddenLine.Settings]] to customize the appearance of the edges.\r\n */\r\n public readonly visibleEdges: boolean;\r\n /** In any mode except [[RenderMode.Wireframe]], whether to display the edges of surfaces occluded by other geometry.\r\n * This has no effect unless [[visibleEdges]] is also true.\r\n * Default: false.\r\n * @see [[HiddenLine.Settings]] to customize the appearance of the edges.\r\n */\r\n public readonly hiddenEdges: boolean;\r\n /** In [[RenderMode.SmoothShade]], whether to display solar shadows. This has no effect unless [[lighting]] is also true. Default: false.\r\n * @note Rendering shadows can reduce framerate, particularly on less capable graphics hardware or in complex scenes.\r\n */\r\n public readonly shadows: boolean;\r\n /** Whether to apply the view's clip volume to the geometry in the scene.\r\n * Default: true, except when using [[fromJSON]].\r\n * @see [[ViewDetails.clipVector]] to define the view's clip volume.\r\n */\r\n public readonly clipVolume: boolean;\r\n /** Whether to display geometry of class [[GeometryClass.Construction]].\r\n * Default: false, except when using [[fromJSON]].\r\n */\r\n public readonly constructions: boolean;\r\n /** Whether to produce a monochrome image. Default: false.\r\n * @see [DisplayStyleSettings.monochromeColor]($common) to define the monochrome color.\r\n * @see [DisplayStyleSettings.monochromeMode]($common) to define how the monochrome image is produced.\r\n */\r\n public readonly monochrome: boolean;\r\n /** Whether to display background map imagery. Default: false.\r\n * @see [[DisplayStyleSettings.backgroundMap]] to customize the map settings.\r\n */\r\n public readonly backgroundMap: boolean;\r\n /** In [[RenderMode.SmoothShade]], whether to apply [[AmbientOcclusion]]. Default: false. */\r\n public readonly ambientOcclusion: boolean;\r\n /** Whether to apply [[ThematicDisplay]]. Default: false. */\r\n public readonly thematicDisplay: boolean;\r\n /** If true, overlay surfaces with wiremesh to reveal their triangulation. */\r\n public readonly wiremesh: boolean;\r\n /** Controls whether surface discard is always applied regardless of other ViewFlags.\r\n * Surface shaders contain complicated logic to ensure that the edges of a surface always draw in front of the surface, and that planar surfaces sketched coincident with\r\n * non-planar surfaces always draw in front of those non-planar surfaces.\r\n * When this view flag is set to false (the default), then for 3d views if the render mode is wireframe (only edges are displayed) or smooth shader with visible edges turned off (only surfaces are displayed),\r\n * that logic does not execute, potentially improving performance for no degradation in visual quality. In some scenarios - such as wireframe views containing many planar regions with interior fill, or smooth views containing many coincident planar and non-planar surfaces - enabling this view flag improves display quality by forcing that logic to execute.\r\n */\r\n public readonly forceSurfaceDiscard: boolean;\r\n /** Whether to apply white-on-white reversal.\r\n * Some CAD applications use this to cause white geometry to be drawn as black if the view's background color is white.\r\n * When enabled, the [[DisplayStyleSettings]]' [[WhiteOnWhiteReversalSettings]] control how white-on-white reversal is applied.\r\n * Default: true.\r\n */\r\n public readonly whiteOnWhiteReversal: boolean;\r\n\r\n /** In [[RenderMode.SmoothShade]], whether to apply lighting to surfaces.\r\n * Default: false, except when using [[fromJSON]].\r\n * @see [[DisplayStyleSettings.lights]] to customize the light settings.\r\n */\r\n public readonly lighting: boolean;\r\n\r\n /** Create a new ViewFlags.\r\n * @param flags The properties to initialize. Any properties not specified are initialized to their default values.\r\n */\r\n public constructor(flags?: Partial<ViewFlagsProperties>) {\r\n this.renderMode = flags?.renderMode ?? RenderMode.Wireframe;\r\n this.dimensions = flags?.dimensions ?? true;\r\n this.patterns = flags?.patterns ?? true;\r\n this.weights = flags?.weights ?? true;\r\n this.styles = flags?.styles ?? true;\r\n this.transparency = flags?.transparency ?? true;\r\n this.fill = flags?.fill ?? true;\r\n this.textures = flags?.textures ?? true;\r\n this.materials = flags?.materials ?? true;\r\n this.acsTriad = flags?.acsTriad ?? false;\r\n this.grid = flags?.grid ?? false;\r\n this.visibleEdges = flags?.visibleEdges ?? false;\r\n this.hiddenEdges = flags?.hiddenEdges ?? false;\r\n this.shadows = flags?.shadows ?? false;\r\n this.clipVolume = flags?.clipVolume ?? true;\r\n this.constructions = flags?.constructions ?? false;\r\n this.monochrome = flags?.monochrome ?? false;\r\n this.backgroundMap = flags?.backgroundMap ?? false;\r\n this.ambientOcclusion = flags?.ambientOcclusion ?? false;\r\n this.thematicDisplay = flags?.thematicDisplay ?? false;\r\n this.wiremesh = flags?.wiremesh ?? false;\r\n this.forceSurfaceDiscard = flags?.forceSurfaceDiscard ?? false;\r\n this.whiteOnWhiteReversal = flags?.whiteOnWhiteReversal ?? true;\r\n this.lighting = flags?.lighting ?? false;\r\n }\r\n\r\n /** Produce a copy of these ViewFlags with some modified properties. Any properties not explicitly specified by `changedFlags` will retain their current values.\r\n * @param changedFlags Properties to modify.\r\n * @returns A copy of these ViewFlags modified according to the supplied properties.\r\n * @note Any explicitly `undefined` property of `changedFlags` will be set to its default value in the returned ViewFlags.\r\n * @see [[override]] to have `undefined` properties retain their current values.\r\n */\r\n public copy(changedFlags: Partial<ViewFlagsProperties>): ViewFlags {\r\n return JsonUtils.isNonEmptyObject(changedFlags) ? new ViewFlags({ ...this, ...changedFlags }) : this;\r\n }\r\n\r\n /** Produce a copy of these ViewFlags, overriding some of its properties. Any properties not explicitly specified by `overrides` will retain their current values,\r\n * as will any property explicitly set to `undefined`.\r\n * @param overrides The properties to override.\r\n * @see [[copy]] to have `undefined` properties reset to their default values.\r\n */\r\n public override(overrides: Partial<ViewFlagsProperties>): ViewFlags {\r\n // This method can get called very frequently when a RenderTimeline script is applied to the view. Often `overrides` will be an empty object.\r\n // To optimize:\r\n // - Bail as quickly as possible if nothing is actually overridden, without allocating a new ViewFlags.\r\n // - Only make a copy of the input if at least one property is explicitly `undefined`.\r\n let copied = false;\r\n let anyOverridden = false;\r\n\r\n for (const propName of Object.keys(overrides)) {\r\n const key = propName as keyof Partial<ViewFlagsProperties>;\r\n const overrideValue = overrides[key];\r\n if (undefined === overrideValue) {\r\n if (!copied) {\r\n // Don't modify input...\r\n overrides = { ...overrides };\r\n copied = true;\r\n }\r\n\r\n // `undefined` means \"retain existing value\".\r\n delete overrides[key];\r\n } else if (overrideValue !== this[key]) {\r\n anyOverridden = true;\r\n }\r\n }\r\n\r\n return anyOverridden ? this.copy(overrides) : this;\r\n }\r\n\r\n /** Produce a copy of these ViewFlags with a single boolean property changed.\r\n * @param flag The name of the property.\r\n * @param value The value to change the property to.\r\n * @returns A new ViewFlags with the property changed as specified, or `this` if the property already has the specified value.\r\n * @see [[withRenderMode]] to change the [[renderMode]] property.\r\n * @see [[copy]] and [[override]] to change multiple properties.\r\n */\r\n public with(flag: keyof Omit<ViewFlagsProperties, \"renderMode\">, value: boolean): ViewFlags {\r\n if (this[flag] === value)\r\n return this;\r\n\r\n const props: ViewFlagsProperties = { ...this };\r\n props[flag] = value;\r\n return new ViewFlags(props);\r\n }\r\n\r\n /** Produce a copy of these ViewFlags with a different [[renderMode]].\r\n * @param renderMode The new render mode.\r\n * @returns A new ViewFlags with the render mode changed as specified, or `this` if the render mode is already set to the requested value.\r\n * @see [[copy]] and [[override]] to change multiple properties.\r\n */\r\n public withRenderMode(renderMode: RenderMode): ViewFlags {\r\n return renderMode === this.renderMode ? this : this.copy({ renderMode });\r\n }\r\n\r\n /** Adjust view flags for renderer.\r\n * @internal\r\n */\r\n public normalize(): ViewFlags {\r\n switch (this.renderMode) {\r\n case RenderMode.Wireframe:\r\n if (this.visibleEdges || this.hiddenEdges)\r\n return this.copy({ visibleEdges: false, hiddenEdges: false });\r\n break;\r\n case RenderMode.SmoothShade:\r\n if (!this.visibleEdges)\r\n return this.copy({ hiddenEdges: false });\r\n break;\r\n case RenderMode.HiddenLine:\r\n case RenderMode.SolidFill:\r\n if (!this.visibleEdges || this.transparency)\r\n return this.copy({ visibleEdges: true, transparency: false });\r\n break;\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /** @internal */\r\n public hiddenEdgesVisible(): boolean {\r\n switch (this.renderMode) {\r\n case RenderMode.SolidFill:\r\n case RenderMode.HiddenLine:\r\n return this.hiddenEdges;\r\n case RenderMode.SmoothShade:\r\n return this.visibleEdges && this.hiddenEdges;\r\n }\r\n return true;\r\n }\r\n\r\n /** Returns true if the edges of surfaces should be displayed, based on [[RenderMode]] and the [[visibleEdges]] flag. */\r\n public edgesRequired(): boolean {\r\n return edgesRequired(this.renderMode, this.visibleEdges);\r\n }\r\n\r\n /** Convert to JSON representation. */\r\n public toJSON(): ViewFlagProps {\r\n const out: ViewFlagProps = {};\r\n if (!this.constructions)\r\n out.noConstruct = true;\r\n if (!this.dimensions)\r\n out.noDim = true;\r\n if (!this.patterns)\r\n out.noPattern = true;\r\n if (!this.weights)\r\n out.noWeight = true;\r\n if (!this.styles)\r\n out.noStyle = true;\r\n if (!this.transparency)\r\n out.noTransp = true;\r\n if (!this.fill)\r\n out.noFill = true;\r\n if (this.grid)\r\n out.grid = true;\r\n if (this.acsTriad)\r\n out.acs = true;\r\n if (!this.textures)\r\n out.noTexture = true;\r\n if (!this.materials)\r\n out.noMaterial = true;\r\n if (!this.lighting)\r\n out.noCameraLights = out.noSourceLights = out.noSolarLight = true;\r\n if (this.visibleEdges)\r\n out.visEdges = true;\r\n if (this.hiddenEdges)\r\n out.hidEdges = true;\r\n if (this.shadows)\r\n out.shadows = true;\r\n if (this.clipVolume)\r\n out.clipVol = true;\r\n if (this.monochrome)\r\n out.monochrome = true;\r\n if (this.backgroundMap)\r\n out.backgroundMap = true;\r\n if (this.ambientOcclusion)\r\n out.ambientOcclusion = true;\r\n if (this.thematicDisplay)\r\n out.thematicDisplay = true;\r\n if (this.wiremesh)\r\n out.wiremesh = true;\r\n if (this.forceSurfaceDiscard)\r\n out.forceSurfaceDiscard = true;\r\n if (!this.whiteOnWhiteReversal)\r\n out.noWhiteOnWhiteReversal = true;\r\n\r\n out.renderMode = this.renderMode;\r\n return out;\r\n }\r\n\r\n /** Like [[toJSON]], but no properties are omitted.\r\n * @internal\r\n */\r\n public toFullyDefinedJSON(): Required<ViewFlagProps> {\r\n return {\r\n renderMode: this.renderMode,\r\n noConstruct: !this.constructions,\r\n noDim: !this.dimensions,\r\n noPattern: !this.patterns,\r\n noWeight: !this.weights,\r\n noStyle: !this.styles,\r\n noTransp: !this.transparency,\r\n noFill: !this.fill,\r\n grid: this.grid,\r\n acs: this.acsTriad,\r\n noTexture: !this.textures,\r\n noMaterial: !this.materials,\r\n noCameraLights: !this.lighting,\r\n noSourceLights: !this.lighting,\r\n noSolarLight: !this.lighting,\r\n visEdges: this.visibleEdges,\r\n hidEdges: this.hiddenEdges,\r\n shadows: this.shadows,\r\n clipVol: this.clipVolume,\r\n monochrome: this.monochrome,\r\n backgroundMap: this.backgroundMap,\r\n ambientOcclusion: this.ambientOcclusion,\r\n thematicDisplay: this.thematicDisplay,\r\n wiremesh: this.wiremesh,\r\n forceSurfaceDiscard: this.forceSurfaceDiscard,\r\n noWhiteOnWhiteReversal: !this.whiteOnWhiteReversal,\r\n };\r\n }\r\n\r\n /** A ViewFlags object with all properties initialized to their default values. */\r\n public static readonly defaults = new ViewFlags();\r\n\r\n /** Create a ViewFlags.\r\n * @param flags The properties to initialize. Any properties not specified are initialized to their default values.\r\n */\r\n public static create(flags?: Partial<ViewFlagsProperties>): ViewFlags {\r\n return flags && !JsonUtils.isEmptyObject(flags) ? new ViewFlags(flags) : this.defaults;\r\n }\r\n\r\n /** Create a ViewFlags from its JSON representation.\r\n * @note As described in [[ViewFlagProps]], the JSON representation is awkward and error-prone. Prefer to use [[create]] unless you\r\n * need to deal with the persistence format directly.\r\n * @note The default values differ slightly from those used by the constructor and [[create]]:\r\n * - [[clipVolume]] defaults to false.\r\n * - [[constructions]] defaults to true.\r\n * - [[lighting]] defaults to true unless all of [[ViewFlagProps.noSolarLight]], [[ViewFlagProps.noCameraLights]], and [[ViewFlagProps.noSourceLights]] are true.\r\n */\r\n public static fromJSON(json?: ViewFlagProps): ViewFlags {\r\n if (!json)\r\n return this.defaults;\r\n\r\n let renderMode: RenderMode;\r\n const renderModeValue = JsonUtils.asInt(json.renderMode);\r\n if (renderModeValue < RenderMode.HiddenLine)\r\n renderMode = RenderMode.Wireframe;\r\n else if (renderModeValue > RenderMode.SolidFill)\r\n renderMode = RenderMode.SmoothShade;\r\n else\r\n renderMode = renderModeValue;\r\n\r\n const lighting = !JsonUtils.asBool(json.noCameraLights) || !JsonUtils.asBool(json.noSourceLights) || !JsonUtils.asBool(json.noSolarLight);\r\n return new ViewFlags({\r\n renderMode,\r\n lighting,\r\n constructions: !JsonUtils.asBool(json.noConstruct),\r\n dimensions: !JsonUtils.asBool(json.noDim),\r\n patterns: !JsonUtils.asBool(json.noPattern),\r\n weights: !JsonUtils.asBool(json.noWeight),\r\n styles: !JsonUtils.asBool(json.noStyle),\r\n transparency: !JsonUtils.asBool(json.noTransp),\r\n fill: !JsonUtils.asBool(json.noFill),\r\n grid: JsonUtils.asBool(json.grid),\r\n acsTriad: JsonUtils.asBool(json.acs),\r\n textures: !JsonUtils.asBool(json.noTexture),\r\n materials: !JsonUtils.asBool(json.noMaterial),\r\n visibleEdges: JsonUtils.asBool(json.visEdges),\r\n hiddenEdges: JsonUtils.asBool(json.hidEdges),\r\n shadows: JsonUtils.asBool(json.shadows),\r\n clipVolume: JsonUtils.asBool(json.clipVol),\r\n monochrome: JsonUtils.asBool(json.monochrome),\r\n backgroundMap: JsonUtils.asBool(json.backgroundMap),\r\n ambientOcclusion: JsonUtils.asBool(json.ambientOcclusion),\r\n thematicDisplay: JsonUtils.asBool(json.thematicDisplay),\r\n wiremesh: JsonUtils.asBool(json.wiremesh),\r\n forceSurfaceDiscard: JsonUtils.asBool(json.forceSurfaceDiscard),\r\n whiteOnWhiteReversal: !JsonUtils.asBool(json.noWhiteOnWhiteReversal),\r\n });\r\n }\r\n\r\n /** Returns true if `this` and `other` are equivalent. */\r\n public equals(other: Readonly<ViewFlagsProperties>): boolean {\r\n if (this === other)\r\n return true;\r\n\r\n return this.renderMode === other.renderMode\r\n && this.dimensions === other.dimensions\r\n && this.patterns === other.patterns\r\n && this.weights === other.weights\r\n && this.styles === other.styles\r\n && this.transparency === other.transparency\r\n && this.fill === other.fill\r\n && this.textures === other.textures\r\n && this.materials === other.materials\r\n && this.acsTriad === other.acsTriad\r\n && this.grid === other.grid\r\n && this.visibleEdges === other.visibleEdges\r\n && this.hiddenEdges === other.hiddenEdges\r\n && this.lighting === other.lighting\r\n && this.shadows === other.shadows\r\n && this.clipVolume === other.clipVolume\r\n && this.constructions === other.constructions\r\n && this.monochrome === other.monochrome\r\n && this.backgroundMap === other.backgroundMap\r\n && this.ambientOcclusion === other.ambientOcclusion\r\n && this.thematicDisplay === other.thematicDisplay\r\n && this.wiremesh === other.wiremesh\r\n && this.forceSurfaceDiscard === other.forceSurfaceDiscard\r\n && this.whiteOnWhiteReversal === other.whiteOnWhiteReversal;\r\n }\r\n}\r\n\r\n/** A type containing all of the properties of [[ViewFlags]] with none of the methods and with the `readonly` modifiers removed.\r\n * @see [[ViewFlags.create]], [[ViewFlags.copy]], and [[ViewFlags.override]] for methods accepting an object of this type.\r\n * @public\r\n * @extensions\r\n */\r\nexport type ViewFlagsProperties = Mutable<NonFunctionPropertiesOf<ViewFlags>>;\r\n\r\n/** A type that describes how to override selected properties of a [[ViewFlags]].\r\n * @see [[ViewFlags.override]] to apply the overrides to a ViewFlags object.\r\n * @public\r\n * @extensions\r\n */\r\nexport type ViewFlagOverrides = Partial<ViewFlagsProperties>;\r\n"]}
1
+ {"version":3,"file":"ViewFlags.js","sourceRoot":"","sources":["../../src/ViewFlags.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,qBAAqB;AAErB,sDAAkF;AAElF;;;;GAIG;AACH,IAAY,UAyBX;AAzBD,WAAY,UAAU;IACpB;;;;OAIG;IACH,qDAAa,CAAA;IACb;;;;OAIG;IACH,yDAAe,CAAA;IACf;;;;;OAKG;IACH,qDAAa,CAAA;IACb;;;OAGG;IACH,uDAAc,CAAA;AAChB,CAAC,EAzBW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAyBrB;AA0ED,SAAS,aAAa,CAAC,UAAsB,EAAE,YAAqB;IAClE,OAAO,YAAY,IAAI,UAAU,CAAC,WAAW,KAAK,UAAU,CAAC;AAC/D,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAa,SAAS;IAsFpB;;OAEG;IACH,YAAmB,KAAoC;QACrD,IAAI,CAAC,UAAU,GAAG,KAAK,EAAE,UAAU,IAAI,UAAU,CAAC,SAAS,CAAC;QAC5D,IAAI,CAAC,UAAU,GAAG,KAAK,EAAE,UAAU,IAAI,IAAI,CAAC;QAC5C,IAAI,CAAC,QAAQ,GAAG,KAAK,EAAE,QAAQ,IAAI,IAAI,CAAC;QACxC,IAAI,CAAC,OAAO,GAAG,KAAK,EAAE,OAAO,IAAI,IAAI,CAAC;QACtC,IAAI,CAAC,MAAM,GAAG,KAAK,EAAE,MAAM,IAAI,IAAI,CAAC;QACpC,IAAI,CAAC,YAAY,GAAG,KAAK,EAAE,YAAY,IAAI,IAAI,CAAC;QAChD,IAAI,CAAC,IAAI,GAAG,KAAK,EAAE,IAAI,IAAI,IAAI,CAAC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ChC,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC,SAAS;eAClC,IAAI,CAAC,QAAQ,KAAK,KAAK,CAAC,QAAQ;eAChC,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI;eACxB,IAAI,CAAC,YAAY,KAAK,KAAK,CAAC,YAAY;eACxC,IAAI,CAAC,WAAW,KAAK,KAAK,CAAC,WAAW;eACtC,IAAI,CAAC,QAAQ,KAAK,KAAK,CAAC,QAAQ;eAChC,IAAI,CAAC,OAAO,KAAK,KAAK,CAAC,OAAO;eAC9B,IAAI,CAAC,UAAU,KAAK,KAAK,CAAC,UAAU;eACpC,IAAI,CAAC,aAAa,KAAK,KAAK,CAAC,aAAa;eAC1C,IAAI,CAAC,UAAU,KAAK,KAAK,CAAC,UAAU;eACpC,IAAI,CAAC,aAAa,KAAK,KAAK,CAAC,aAAa;eAC1C,IAAI,CAAC,gBAAgB,KAAK,KAAK,CAAC,gBAAgB;eAChD,IAAI,CAAC,eAAe,KAAK,KAAK,CAAC,eAAe;eAC9C,IAAI,CAAC,QAAQ,KAAK,KAAK,CAAC,QAAQ;eAChC,IAAI,CAAC,mBAAmB,KAAK,KAAK,CAAC,mBAAmB;eACtD,IAAI,CAAC,oBAAoB,KAAK,KAAK,CAAC,oBAAoB,CAAC;IAChE,CAAC;;AAzFD,kFAAkF;AAC3D,kBAAQ,GAAG,IAAI,SAAS,EAAE,CAAC;AAzTvC,8BAAS","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module DisplayStyles\r\n */\r\n\r\n// cspell:ignore ovrs\r\n\r\nimport { JsonUtils, Mutable, NonFunctionPropertiesOf } from \"@itwin/core-bentley\";\r\n\r\n/** Enumerates the available basic rendering modes, as part of a [DisplayStyle]($backend)'s [[ViewFlags]].\r\n * The rendering mode broadly affects various aspects of the display style - in particular, whether and how surfaces and their edges are drawn.\r\n * @public\r\n * @extensions\r\n */\r\nexport enum RenderMode {\r\n /** Renders only the edges of surfaces, with exceptions for planar regions based on their [[FillFlags]].\r\n * Lighting (and by extension, shadows) is not applied.\r\n * [[HiddenLine.Settings]] are not applied - edges use the elements' width, style, and color.\r\n * [[ViewFlags.hiddenEdges]] is ignored - hidden edges are never displayed in wireframe mode.\r\n */\r\n Wireframe = 0,\r\n /** By default, renders surfaces without their edges.\r\n * Lighting and shadows can be applied using [[ViewFlags.lighting]] and [[ViewFlags.shadows]].\r\n * Edges can be enabled using [[ViewFlags.visibleEdges]] and [[ViewFlags.hiddenEdges]], and their appearance customized using [[HiddenLine.Settings]].\r\n * Surfaces can be drawn with transparency, based on [[ViewFlags.transparency]].\r\n */\r\n SmoothShade = 6,\r\n /** Renders surfaces and their edges. By default, edges are drawn in white; this can be overridden using [[HiddenLine.Settings]].\r\n * All surfaces are rendered opaque. If a surface's transparency is below that specified by [[HiddenLine.Settings.transparencyThreshold]], it is not rendered.\r\n * Materials and textures are not applied - surfaces are drawn in their actual colors.\r\n * [[ViewFlags.visibleEdges]] is ignored - visible edges are always drawn. Hidden edges can be enabled using [[ViewFlags.hiddenEdges]].\r\n * Lighting (and by extension, shadows) is not applied.\r\n */\r\n SolidFill = 4,\r\n /** Identical to [[RenderMode.SolidFill]], except:\r\n * - Surfaces are drawn using the [DisplayStyle]($backend)'s background color.\r\n * - Edges are drawn using their surface's colors; this can be overridden using [[HiddenLine.Settings]].\r\n */\r\n HiddenLine = 3,\r\n}\r\n\r\n/** JSON representation of [[ViewFlags]].\r\n * This is a persistence format with some unfortunate quirks that have been retained for backwards compatibility.\r\n * In particular, it supplies three separate flags intended to control lighting - [[noCameraLights]], [[noSourceLights]], and [[noSolarLight]] -\r\n * but there exists only a single [[ViewFlags.lighting]] flag. [[ViewFlags.lighting]] is set to true unless all three of the \"no lighting\" flags are true.\r\n * It also uses awkward negative ([[noConstruct]], [[noTransp]]) and/or abbreviated ([[clipVol]], [[visEdges]]) property names that differ from\r\n * those of the corresponding [[ViewFlags]] properties, making usage of this type in code error-prone.\r\n * Prefer to use [[ViewFlagsProperties]] unless you need to work directly with the persistence format.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface ViewFlagProps {\r\n /** If true, don't display geometry of class [[GeometryClass.Construction]]. */\r\n noConstruct?: boolean;\r\n /** If true, don't display geometry of class [[GeometryClass.Dimension]]. */\r\n noDim?: boolean;\r\n /** If true, don't display geometry of class [[GeometryClass.Pattern]]. */\r\n noPattern?: boolean;\r\n /** If true, all lines are drawn with a width of 1 pixel. */\r\n noWeight?: boolean;\r\n /** If true, don't apply [[LinePixels]] styles. */\r\n noStyle?: boolean;\r\n /** If true, display transparency geometry as opaque. */\r\n noTransp?: boolean;\r\n /** If true, don't show filled planar regions, unless they use [[FillFlags.Always]]. */\r\n noFill?: boolean;\r\n /** If true, display a grid in the view. */\r\n grid?: boolean;\r\n /** If true, display graphics representing the [AuxCoordSystem]($backend). */\r\n acs?: boolean;\r\n /** If true, don't apply [[RenderTexture]]s to surfaces. */\r\n noTexture?: boolean;\r\n /** If true, don't apply [[RenderMaterial]]s to surfaces. */\r\n noMaterial?: boolean;\r\n /** See [[ViewFlagProps]] for how this affects [[ViewFlags.lighting]]. */\r\n noCameraLights?: boolean;\r\n /** See [[ViewFlagProps]] for how this affects [[ViewFlags.lighting]]. */\r\n noSourceLights?: boolean;\r\n /** See [[ViewFlagProps]] for how this affects [[ViewFlags.lighting]]. */\r\n noSolarLight?: boolean;\r\n /** If true, display the edges of surfaces. */\r\n visEdges?: boolean;\r\n /** If true, display the edges of surfaces, even if they are behind other geometry. */\r\n hidEdges?: boolean;\r\n /** If true, display shadows. */\r\n shadows?: boolean;\r\n /** If true, apply the view's clipping volume. Has no effect on other types of clips like [[ModelClipGroups]]. */\r\n clipVol?: boolean;\r\n /** If true, apply the view's [[DisplayStyleSettings.monochromeColor]] and [[DisplayStyleSettings.monochromeMode]] to produce a monochrome image. */\r\n monochrome?: boolean;\r\n /** The basic rendering mode, which affects the behavior of other flags. */\r\n renderMode?: RenderMode;\r\n /** Display a background map. */\r\n backgroundMap?: boolean;\r\n /** If true, apply [[AmbientOcclusion]]. */\r\n ambientOcclusion?: boolean;\r\n /** If true, apply [[ThematicDisplay]]. */\r\n thematicDisplay?: boolean;\r\n /** If true, overlay surfaces with wiremesh to reveal their triangulation. */\r\n wiremesh?: boolean;\r\n /** Controls whether surface discard is always applied regardless of other ViewFlags.\r\n * Surface shaders contain complicated logic to ensure that the edges of a surface always draw in front of the surface, and that planar surfaces sketched coincident with\r\n * non-planar surfaces always draw in front of those non-planar surfaces.\r\n * When this view flag is set to false (the default), then for 3d views if the render mode is wireframe (only edges are displayed) or smooth shader with visible edges turned off (only surfaces are displayed),\r\n * that logic does not execute, potentially improving performance for no degradation in visual quality. In some scenarios - such as wireframe views containing many planar regions with interior fill, or smooth views containing many coincident planar and non-planar surfaces - enabling this view flag improves display quality by forcing that logic to execute.\r\n */\r\n forceSurfaceDiscard?: boolean;\r\n /** Disables the \"white-on-white reversal\" employed by some CAD applications.\r\n * @see [[ViewFlags.whiteOnWhiteReversal]].\r\n */\r\n noWhiteOnWhiteReversal?: boolean;\r\n}\r\n\r\nfunction edgesRequired(renderMode: RenderMode, visibleEdges: boolean): boolean {\r\n return visibleEdges || RenderMode.SmoothShade !== renderMode;\r\n}\r\n\r\n/** Flags controlling how graphics appear within a view.\r\n * A [[ViewFlags]] object is immutable. There are several ways to produce a modified copy of a ViewFlags object:\r\n * ```ts\r\n * // Start with the default values for all properties.\r\n * let vf = ViewFlags.defaults;\r\n * // Change a single boolean property:\r\n * vf = vf.with(\"visibleEdges\", true);\r\n * // Change only the render mode:\r\n * vf = vf.withRenderMode(RenderMode.HiddenLine);\r\n * // Change multiple properties:\r\n * vf = vf.copy({ renderMode: RenderMode.SmoothShade, visibleEdges: true });\r\n * // Reset multiple properties to their default values:\r\n * vf = vf.copy({ renderMode: undefined, visibleEdges: undefined });\r\n *\r\n * ```\r\n * [[with]] and [[withRenderMode]] should be preferred if you only need to change a single property, as they will not create a new object unless\r\n * the new value differs from the current value.\r\n * [[copy]] and [[override]] should be preferred if you need to change multiple properties, as they will create no more than one new object, vs\r\n * each call to [[with]] or [[withRenderMode]] potentially creating a new object.\r\n * @see [[DisplayStyleSettings.viewFlags]] to define the view flags for a [DisplayStyle]($backend).\r\n * @public\r\n */\r\nexport class ViewFlags {\r\n /** The basic rendering mode applied to the view. This modulates the behavior of some of the other flags.\r\n * Default: [[RenderMode.Wireframe]].\r\n * @see [[RenderMode]] for details.\r\n */\r\n public readonly renderMode: RenderMode;\r\n /** Whether to display geometry of class [[GeometryClass.Dimension]]. Default: true. */\r\n public readonly dimensions: boolean;\r\n /** Whether to display geometry of class [[GeometryClass.Pattern]]. Default: true. */\r\n public readonly patterns: boolean;\r\n /** Whether to allow lines and edges to draw with width greater than one pixel. Default: true. */\r\n public readonly weights: boolean;\r\n /** Whether [[LinePixels]] are allowed to apply patterns to lines and edges. If false, they all draw as solid lines. Default: true. */\r\n public readonly styles: boolean;\r\n /** Whether element transparency is applied. If false, transparent geometry is drawn opaque. Default: true.\r\n * @see [[RenderMode]] for render mode-specific behavior.\r\n */\r\n public readonly transparency: boolean;\r\n /** In [[RenderMode.Wireframe]] only, whether to display the interiors of planar regions with [[FillFlags.ByView]]. Default: true. */\r\n public readonly fill: boolean;\r\n /** In [[RenderMode.SmoothShade]], whether to apply [[RenderTexture]]s to surfaces. Default: true. */\r\n public readonly textures: boolean;\r\n /** In [[RenderMode.SmoothShade]], whether to apply [[RenderMaterial]]s to surfaces. Default: true. */\r\n public readonly materials: boolean;\r\n /** Whether to display a graphical representation of the view's [AuxCoordSystem]($backend). Default: false. */\r\n public readonly acsTriad: boolean;\r\n /** Whether to display a grid. Default: false. */\r\n public readonly grid: boolean;\r\n /** In [[RenderMode.SmoothShade]], whether to display the edges of surfaces. Default: false.\r\n * @see [[HiddenLine.Settings]] to customize the appearance of the edges.\r\n */\r\n public readonly visibleEdges: boolean;\r\n /** In any mode except [[RenderMode.Wireframe]], whether to display the edges of surfaces occluded by other geometry.\r\n * This has no effect unless [[visibleEdges]] is also true.\r\n * Default: false.\r\n * @see [[HiddenLine.Settings]] to customize the appearance of the edges.\r\n */\r\n public readonly hiddenEdges: boolean;\r\n /** In [[RenderMode.SmoothShade]], whether to display solar shadows. This has no effect unless [[lighting]] is also true. Default: false.\r\n * @note Rendering shadows can reduce framerate, particularly on less capable graphics hardware or in complex scenes.\r\n */\r\n public readonly shadows: boolean;\r\n /** Whether to apply the view's clip volume to the geometry in the scene.\r\n * Default: true, except when using [[fromJSON]].\r\n * @see [[ViewDetails.clipVector]] to define the view's clip volume.\r\n */\r\n public readonly clipVolume: boolean;\r\n /** Whether to display geometry of class [[GeometryClass.Construction]].\r\n * Default: false, except when using [[fromJSON]].\r\n */\r\n public readonly constructions: boolean;\r\n /** Whether to produce a monochrome image. Default: false.\r\n * @see [DisplayStyleSettings.monochromeColor]($common) to define the monochrome color.\r\n * @see [DisplayStyleSettings.monochromeMode]($common) to define how the monochrome image is produced.\r\n */\r\n public readonly monochrome: boolean;\r\n /** Whether to display background map imagery. Default: false.\r\n * @see [[DisplayStyleSettings.backgroundMap]] to customize the map settings.\r\n */\r\n public readonly backgroundMap: boolean;\r\n /** In [[RenderMode.SmoothShade]], whether to apply [[AmbientOcclusion]]. Default: false. */\r\n public readonly ambientOcclusion: boolean;\r\n /** Whether to apply [[ThematicDisplay]]. Default: false. */\r\n public readonly thematicDisplay: boolean;\r\n /** If true, overlay surfaces with wiremesh to reveal their triangulation. */\r\n public readonly wiremesh: boolean;\r\n /** Controls whether surface discard is always applied regardless of other ViewFlags.\r\n * Surface shaders contain complicated logic to ensure that the edges of a surface always draw in front of the surface, and that planar surfaces sketched coincident with\r\n * non-planar surfaces always draw in front of those non-planar surfaces.\r\n * When this view flag is set to false (the default), then for 3d views if the render mode is wireframe (only edges are displayed) or smooth shader with visible edges turned off (only surfaces are displayed),\r\n * that logic does not execute, potentially improving performance for no degradation in visual quality. In some scenarios - such as wireframe views containing many planar regions with interior fill, or smooth views containing many coincident planar and non-planar surfaces - enabling this view flag improves display quality by forcing that logic to execute.\r\n */\r\n public readonly forceSurfaceDiscard: boolean;\r\n /** Whether to apply white-on-white reversal.\r\n * Some CAD applications use this to cause white geometry to be drawn as black if the view's background color is white.\r\n * When enabled, the [[DisplayStyleSettings]]' [[WhiteOnWhiteReversalSettings]] control how white-on-white reversal is applied.\r\n * Default: true.\r\n */\r\n public readonly whiteOnWhiteReversal: boolean;\r\n\r\n /** In [[RenderMode.SmoothShade]], whether to apply lighting to surfaces.\r\n * Default: false, except when using [[fromJSON]].\r\n * @see [[DisplayStyleSettings.lights]] to customize the light settings.\r\n */\r\n public readonly lighting: boolean;\r\n\r\n /** Create a new ViewFlags.\r\n * @param flags The properties to initialize. Any properties not specified are initialized to their default values.\r\n */\r\n public constructor(flags?: Partial<ViewFlagsProperties>) {\r\n this.renderMode = flags?.renderMode ?? RenderMode.Wireframe;\r\n this.dimensions = flags?.dimensions ?? true;\r\n this.patterns = flags?.patterns ?? true;\r\n this.weights = flags?.weights ?? true;\r\n this.styles = flags?.styles ?? true;\r\n this.transparency = flags?.transparency ?? true;\r\n this.fill = flags?.fill ?? true;\r\n this.textures = flags?.textures ?? true;\r\n this.materials = flags?.materials ?? true;\r\n this.acsTriad = flags?.acsTriad ?? false;\r\n this.grid = flags?.grid ?? false;\r\n this.visibleEdges = flags?.visibleEdges ?? false;\r\n this.hiddenEdges = flags?.hiddenEdges ?? false;\r\n this.shadows = flags?.shadows ?? false;\r\n this.clipVolume = flags?.clipVolume ?? true;\r\n this.constructions = flags?.constructions ?? false;\r\n this.monochrome = flags?.monochrome ?? false;\r\n this.backgroundMap = flags?.backgroundMap ?? false;\r\n this.ambientOcclusion = flags?.ambientOcclusion ?? false;\r\n this.thematicDisplay = flags?.thematicDisplay ?? false;\r\n this.wiremesh = flags?.wiremesh ?? false;\r\n this.forceSurfaceDiscard = flags?.forceSurfaceDiscard ?? false;\r\n this.whiteOnWhiteReversal = flags?.whiteOnWhiteReversal ?? true;\r\n this.lighting = flags?.lighting ?? false;\r\n }\r\n\r\n /** Produce a copy of these ViewFlags with some modified properties. Any properties not explicitly specified by `changedFlags` will retain their current values.\r\n * @param changedFlags Properties to modify.\r\n * @returns A copy of these ViewFlags modified according to the supplied properties.\r\n * @note Any explicitly `undefined` property of `changedFlags` will be set to its default value in the returned ViewFlags.\r\n * @see [[override]] to have `undefined` properties retain their current values.\r\n */\r\n public copy(changedFlags: Partial<ViewFlagsProperties>): ViewFlags {\r\n return JsonUtils.isNonEmptyObject(changedFlags) ? new ViewFlags({ ...this, ...changedFlags }) : this;\r\n }\r\n\r\n /** Produce a copy of these ViewFlags, overriding some of its properties. Any properties not explicitly specified by `overrides` will retain their current values,\r\n * as will any property explicitly set to `undefined`.\r\n * @param overrides The properties to override.\r\n * @see [[copy]] to have `undefined` properties reset to their default values.\r\n */\r\n public override(overrides: Partial<ViewFlagsProperties>): ViewFlags {\r\n // This method can get called very frequently when a RenderTimeline script is applied to the view. Often `overrides` will be an empty object.\r\n // To optimize:\r\n // - Bail as quickly as possible if nothing is actually overridden, without allocating a new ViewFlags.\r\n // - Only make a copy of the input if at least one property is explicitly `undefined`.\r\n let copied = false;\r\n let anyOverridden = false;\r\n\r\n for (const propName of Object.keys(overrides)) {\r\n const key = propName as keyof Partial<ViewFlagsProperties>;\r\n const overrideValue = overrides[key];\r\n if (undefined === overrideValue) {\r\n if (!copied) {\r\n // Don't modify input...\r\n overrides = { ...overrides };\r\n copied = true;\r\n }\r\n\r\n // `undefined` means \"retain existing value\".\r\n delete overrides[key];\r\n } else if (overrideValue !== this[key]) {\r\n anyOverridden = true;\r\n }\r\n }\r\n\r\n return anyOverridden ? this.copy(overrides) : this;\r\n }\r\n\r\n /** Produce a copy of these ViewFlags with a single boolean property changed.\r\n * @param flag The name of the property.\r\n * @param value The value to change the property to.\r\n * @returns A new ViewFlags with the property changed as specified, or `this` if the property already has the specified value.\r\n * @see [[withRenderMode]] to change the [[renderMode]] property.\r\n * @see [[copy]] and [[override]] to change multiple properties.\r\n */\r\n public with(flag: keyof Omit<ViewFlagsProperties, \"renderMode\">, value: boolean): ViewFlags {\r\n if (this[flag] === value)\r\n return this;\r\n\r\n const props: ViewFlagsProperties = { ...this };\r\n props[flag] = value;\r\n return new ViewFlags(props);\r\n }\r\n\r\n /** Produce a copy of these ViewFlags with a different [[renderMode]].\r\n * @param renderMode The new render mode.\r\n * @returns A new ViewFlags with the render mode changed as specified, or `this` if the render mode is already set to the requested value.\r\n * @see [[copy]] and [[override]] to change multiple properties.\r\n */\r\n public withRenderMode(renderMode: RenderMode): ViewFlags {\r\n return renderMode === this.renderMode ? this : this.copy({ renderMode });\r\n }\r\n\r\n /** Adjust view flags for renderer.\r\n * @internal\r\n */\r\n public normalize(): ViewFlags {\r\n switch (this.renderMode) {\r\n case RenderMode.Wireframe:\r\n if (this.visibleEdges || this.hiddenEdges)\r\n return this.copy({ visibleEdges: false, hiddenEdges: false });\r\n break;\r\n case RenderMode.SmoothShade:\r\n if (!this.visibleEdges)\r\n return this.copy({ hiddenEdges: false });\r\n break;\r\n case RenderMode.HiddenLine:\r\n case RenderMode.SolidFill:\r\n if (!this.visibleEdges || this.transparency)\r\n return this.copy({ visibleEdges: true, transparency: false });\r\n break;\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /** @internal */\r\n public hiddenEdgesVisible(): boolean {\r\n switch (this.renderMode) {\r\n case RenderMode.SolidFill:\r\n case RenderMode.HiddenLine:\r\n return this.hiddenEdges;\r\n case RenderMode.SmoothShade:\r\n return this.visibleEdges && this.hiddenEdges;\r\n }\r\n return true;\r\n }\r\n\r\n /** Returns true if the edges of surfaces should be displayed, based on [[RenderMode]] and the [[visibleEdges]] flag. */\r\n public edgesRequired(): boolean {\r\n return edgesRequired(this.renderMode, this.visibleEdges);\r\n }\r\n\r\n /** Convert to JSON representation.\r\n * Properties are omitted if they match the default values.\r\n */\r\n public toJSON(): ViewFlagProps {\r\n const out: ViewFlagProps = {};\r\n if (!this.constructions)\r\n out.noConstruct = true;\r\n if (!this.dimensions)\r\n out.noDim = true;\r\n if (!this.patterns)\r\n out.noPattern = true;\r\n if (!this.weights)\r\n out.noWeight = true;\r\n if (!this.styles)\r\n out.noStyle = true;\r\n if (!this.transparency)\r\n out.noTransp = true;\r\n if (!this.fill)\r\n out.noFill = true;\r\n if (this.grid)\r\n out.grid = true;\r\n if (this.acsTriad)\r\n out.acs = true;\r\n if (!this.textures)\r\n out.noTexture = true;\r\n if (!this.materials)\r\n out.noMaterial = true;\r\n if (!this.lighting)\r\n out.noCameraLights = out.noSourceLights = out.noSolarLight = true;\r\n if (this.visibleEdges)\r\n out.visEdges = true;\r\n if (this.hiddenEdges)\r\n out.hidEdges = true;\r\n if (this.shadows)\r\n out.shadows = true;\r\n if (this.clipVolume)\r\n out.clipVol = true;\r\n if (this.monochrome)\r\n out.monochrome = true;\r\n if (this.backgroundMap)\r\n out.backgroundMap = true;\r\n if (this.ambientOcclusion)\r\n out.ambientOcclusion = true;\r\n if (this.thematicDisplay)\r\n out.thematicDisplay = true;\r\n if (this.wiremesh)\r\n out.wiremesh = true;\r\n if (this.forceSurfaceDiscard)\r\n out.forceSurfaceDiscard = true;\r\n if (!this.whiteOnWhiteReversal)\r\n out.noWhiteOnWhiteReversal = true;\r\n\r\n out.renderMode = this.renderMode;\r\n return out;\r\n }\r\n\r\n /** Like [[toJSON]], but no properties are omitted. */\r\n public toFullyDefinedJSON(): Required<ViewFlagProps> {\r\n return {\r\n renderMode: this.renderMode,\r\n noConstruct: !this.constructions,\r\n noDim: !this.dimensions,\r\n noPattern: !this.patterns,\r\n noWeight: !this.weights,\r\n noStyle: !this.styles,\r\n noTransp: !this.transparency,\r\n noFill: !this.fill,\r\n grid: this.grid,\r\n acs: this.acsTriad,\r\n noTexture: !this.textures,\r\n noMaterial: !this.materials,\r\n noCameraLights: !this.lighting,\r\n noSourceLights: !this.lighting,\r\n noSolarLight: !this.lighting,\r\n visEdges: this.visibleEdges,\r\n hidEdges: this.hiddenEdges,\r\n shadows: this.shadows,\r\n clipVol: this.clipVolume,\r\n monochrome: this.monochrome,\r\n backgroundMap: this.backgroundMap,\r\n ambientOcclusion: this.ambientOcclusion,\r\n thematicDisplay: this.thematicDisplay,\r\n wiremesh: this.wiremesh,\r\n forceSurfaceDiscard: this.forceSurfaceDiscard,\r\n noWhiteOnWhiteReversal: !this.whiteOnWhiteReversal,\r\n };\r\n }\r\n\r\n /** A ViewFlags object with all properties initialized to their default values. */\r\n public static readonly defaults = new ViewFlags();\r\n\r\n /** Create a ViewFlags.\r\n * @param flags The properties to initialize. Any properties not specified are initialized to their default values.\r\n */\r\n public static create(flags?: Partial<ViewFlagsProperties>): ViewFlags {\r\n return flags && !JsonUtils.isEmptyObject(flags) ? new ViewFlags(flags) : this.defaults;\r\n }\r\n\r\n /** Create a ViewFlags from its JSON representation.\r\n * @note As described in [[ViewFlagProps]], the JSON representation is awkward and error-prone. Prefer to use [[create]] unless you\r\n * need to deal with the persistence format directly.\r\n * @note The default values differ slightly from those used by the constructor and [[create]]:\r\n * - [[clipVolume]] defaults to false.\r\n * - [[constructions]] defaults to true.\r\n * - [[lighting]] defaults to true unless all of [[ViewFlagProps.noSolarLight]], [[ViewFlagProps.noCameraLights]], and [[ViewFlagProps.noSourceLights]] are true.\r\n */\r\n public static fromJSON(json?: ViewFlagProps): ViewFlags {\r\n if (!json)\r\n return this.defaults;\r\n\r\n let renderMode: RenderMode;\r\n const renderModeValue = JsonUtils.asInt(json.renderMode);\r\n if (renderModeValue < RenderMode.HiddenLine)\r\n renderMode = RenderMode.Wireframe;\r\n else if (renderModeValue > RenderMode.SolidFill)\r\n renderMode = RenderMode.SmoothShade;\r\n else\r\n renderMode = renderModeValue;\r\n\r\n const lighting = !JsonUtils.asBool(json.noCameraLights) || !JsonUtils.asBool(json.noSourceLights) || !JsonUtils.asBool(json.noSolarLight);\r\n return new ViewFlags({\r\n renderMode,\r\n lighting,\r\n constructions: !JsonUtils.asBool(json.noConstruct),\r\n dimensions: !JsonUtils.asBool(json.noDim),\r\n patterns: !JsonUtils.asBool(json.noPattern),\r\n weights: !JsonUtils.asBool(json.noWeight),\r\n styles: !JsonUtils.asBool(json.noStyle),\r\n transparency: !JsonUtils.asBool(json.noTransp),\r\n fill: !JsonUtils.asBool(json.noFill),\r\n grid: JsonUtils.asBool(json.grid),\r\n acsTriad: JsonUtils.asBool(json.acs),\r\n textures: !JsonUtils.asBool(json.noTexture),\r\n materials: !JsonUtils.asBool(json.noMaterial),\r\n visibleEdges: JsonUtils.asBool(json.visEdges),\r\n hiddenEdges: JsonUtils.asBool(json.hidEdges),\r\n shadows: JsonUtils.asBool(json.shadows),\r\n clipVolume: JsonUtils.asBool(json.clipVol),\r\n monochrome: JsonUtils.asBool(json.monochrome),\r\n backgroundMap: JsonUtils.asBool(json.backgroundMap),\r\n ambientOcclusion: JsonUtils.asBool(json.ambientOcclusion),\r\n thematicDisplay: JsonUtils.asBool(json.thematicDisplay),\r\n wiremesh: JsonUtils.asBool(json.wiremesh),\r\n forceSurfaceDiscard: JsonUtils.asBool(json.forceSurfaceDiscard),\r\n whiteOnWhiteReversal: !JsonUtils.asBool(json.noWhiteOnWhiteReversal),\r\n });\r\n }\r\n\r\n /** Returns true if `this` and `other` are equivalent. */\r\n public equals(other: Readonly<ViewFlagsProperties>): boolean {\r\n if (this === other)\r\n return true;\r\n\r\n return this.renderMode === other.renderMode\r\n && this.dimensions === other.dimensions\r\n && this.patterns === other.patterns\r\n && this.weights === other.weights\r\n && this.styles === other.styles\r\n && this.transparency === other.transparency\r\n && this.fill === other.fill\r\n && this.textures === other.textures\r\n && this.materials === other.materials\r\n && this.acsTriad === other.acsTriad\r\n && this.grid === other.grid\r\n && this.visibleEdges === other.visibleEdges\r\n && this.hiddenEdges === other.hiddenEdges\r\n && this.lighting === other.lighting\r\n && this.shadows === other.shadows\r\n && this.clipVolume === other.clipVolume\r\n && this.constructions === other.constructions\r\n && this.monochrome === other.monochrome\r\n && this.backgroundMap === other.backgroundMap\r\n && this.ambientOcclusion === other.ambientOcclusion\r\n && this.thematicDisplay === other.thematicDisplay\r\n && this.wiremesh === other.wiremesh\r\n && this.forceSurfaceDiscard === other.forceSurfaceDiscard\r\n && this.whiteOnWhiteReversal === other.whiteOnWhiteReversal;\r\n }\r\n}\r\n\r\n/** A type containing all of the properties of [[ViewFlags]] with none of the methods and with the `readonly` modifiers removed.\r\n * @see [[ViewFlags.create]], [[ViewFlags.copy]], and [[ViewFlags.override]] for methods accepting an object of this type.\r\n * @public\r\n * @extensions\r\n */\r\nexport type ViewFlagsProperties = Mutable<NonFunctionPropertiesOf<ViewFlags>>;\r\n\r\n/** A type that describes how to override selected properties of a [[ViewFlags]].\r\n * @see [[ViewFlags.override]] to apply the overrides to a ViewFlags object.\r\n * @public\r\n * @extensions\r\n */\r\nexport type ViewFlagOverrides = Partial<ViewFlagsProperties>;\r\n"]}