@itwin/core-common 5.0.0-dev.4 → 5.0.0-dev.40

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 (270) hide show
  1. package/CHANGELOG.md +35 -1
  2. package/lib/cjs/AmbientOcclusion.js +9 -9
  3. package/lib/cjs/AmbientOcclusion.js.map +1 -1
  4. package/lib/cjs/AnalysisStyle.js +1 -1
  5. package/lib/cjs/AnalysisStyle.js.map +1 -1
  6. package/lib/cjs/Atmosphere.js +19 -21
  7. package/lib/cjs/Atmosphere.js.map +1 -1
  8. package/lib/cjs/BriefcaseTypes.d.ts +2 -2
  9. package/lib/cjs/BriefcaseTypes.d.ts.map +1 -1
  10. package/lib/cjs/BriefcaseTypes.js.map +1 -1
  11. package/lib/cjs/ClipStyle.js +5 -5
  12. package/lib/cjs/ClipStyle.js.map +1 -1
  13. package/lib/cjs/ColorDef.js +10 -10
  14. package/lib/cjs/ColorDef.js.map +1 -1
  15. package/lib/cjs/ConcurrentQuery.d.ts +5 -1
  16. package/lib/cjs/ConcurrentQuery.d.ts.map +1 -1
  17. package/lib/cjs/ConcurrentQuery.js.map +1 -1
  18. package/lib/cjs/ContourDisplay.js +5 -5
  19. package/lib/cjs/ContourDisplay.js.map +1 -1
  20. package/lib/cjs/ECSqlReader.d.ts.map +1 -1
  21. package/lib/cjs/ECSqlReader.js +3 -1
  22. package/lib/cjs/ECSqlReader.js.map +1 -1
  23. package/lib/cjs/ElementProps.d.ts.map +1 -1
  24. package/lib/cjs/ElementProps.js +3 -3
  25. package/lib/cjs/ElementProps.js.map +1 -1
  26. package/lib/cjs/Environment.js +2 -2
  27. package/lib/cjs/Environment.js.map +1 -1
  28. package/lib/cjs/FeatureSymbology.js +3 -3
  29. package/lib/cjs/FeatureSymbology.js.map +1 -1
  30. package/lib/cjs/Fonts.d.ts +69 -11
  31. package/lib/cjs/Fonts.d.ts.map +1 -1
  32. package/lib/cjs/Fonts.js +20 -5
  33. package/lib/cjs/Fonts.js.map +1 -1
  34. package/lib/cjs/Gradient.js +9 -9
  35. package/lib/cjs/Gradient.js.map +1 -1
  36. package/lib/cjs/GroundPlane.js +2 -2
  37. package/lib/cjs/GroundPlane.js.map +1 -1
  38. package/lib/cjs/HiddenLine.js +4 -4
  39. package/lib/cjs/HiddenLine.js.map +1 -1
  40. package/lib/cjs/IModel.d.ts +3 -12
  41. package/lib/cjs/IModel.d.ts.map +1 -1
  42. package/lib/cjs/IModel.js +6 -6
  43. package/lib/cjs/IModel.js.map +1 -1
  44. package/lib/cjs/IModelError.d.ts +0 -2
  45. package/lib/cjs/IModelError.d.ts.map +1 -1
  46. package/lib/cjs/IModelError.js +1 -8
  47. package/lib/cjs/IModelError.js.map +1 -1
  48. package/lib/cjs/ITwinError.d.ts +1 -1
  49. package/lib/cjs/ITwinError.d.ts.map +1 -1
  50. package/lib/cjs/ITwinError.js +1 -1
  51. package/lib/cjs/ITwinError.js.map +1 -1
  52. package/lib/cjs/LightSettings.js +1 -1
  53. package/lib/cjs/LightSettings.js.map +1 -1
  54. package/lib/cjs/PlanarClipMask.js +2 -2
  55. package/lib/cjs/PlanarClipMask.js.map +1 -1
  56. package/lib/cjs/RealityModelDisplaySettings.js +4 -4
  57. package/lib/cjs/RealityModelDisplaySettings.js.map +1 -1
  58. package/lib/cjs/RenderMaterial.js +3 -3
  59. package/lib/cjs/RenderMaterial.js.map +1 -1
  60. package/lib/cjs/RpcInterface.js +1 -1
  61. package/lib/cjs/RpcInterface.js.map +1 -1
  62. package/lib/cjs/SkyBox.js +4 -4
  63. package/lib/cjs/SkyBox.js.map +1 -1
  64. package/lib/cjs/SolarShadows.js +1 -1
  65. package/lib/cjs/SolarShadows.js.map +1 -1
  66. package/lib/cjs/SubCategoryAppearance.js +1 -1
  67. package/lib/cjs/SubCategoryAppearance.js.map +1 -1
  68. package/lib/cjs/SubCategoryOverride.js +2 -2
  69. package/lib/cjs/SubCategoryOverride.js.map +1 -1
  70. package/lib/cjs/TextureMapping.js +2 -2
  71. package/lib/cjs/TextureMapping.js.map +1 -1
  72. package/lib/cjs/ThematicDisplay.js +2 -2
  73. package/lib/cjs/ThematicDisplay.js.map +1 -1
  74. package/lib/cjs/ViewDetails.js +2 -2
  75. package/lib/cjs/ViewDetails.js.map +1 -1
  76. package/lib/cjs/ViewFlags.js +2 -2
  77. package/lib/cjs/ViewFlags.js.map +1 -1
  78. package/lib/cjs/WhiteOnWhiteReversalSettings.js +2 -2
  79. package/lib/cjs/WhiteOnWhiteReversalSettings.js.map +1 -1
  80. package/lib/cjs/annotation/TextStyle.js +19 -19
  81. package/lib/cjs/annotation/TextStyle.js.map +1 -1
  82. package/lib/cjs/core-common.d.ts +0 -1
  83. package/lib/cjs/core-common.d.ts.map +1 -1
  84. package/lib/cjs/core-common.js +0 -1
  85. package/lib/cjs/core-common.js.map +1 -1
  86. package/lib/cjs/geometry/Cartographic.js +13 -13
  87. package/lib/cjs/geometry/Cartographic.js.map +1 -1
  88. package/lib/cjs/ipc/IpcWebSocket.js +1 -1
  89. package/lib/cjs/ipc/IpcWebSocket.js.map +1 -1
  90. package/lib/cjs/ipc/IpcWebSocketTransport.js +1 -1
  91. package/lib/cjs/ipc/IpcWebSocketTransport.js.map +1 -1
  92. package/lib/cjs/rpc/DevToolsRpcInterface.js +6 -6
  93. package/lib/cjs/rpc/DevToolsRpcInterface.js.map +1 -1
  94. package/lib/cjs/rpc/IModelReadRpcInterface.js +5 -5
  95. package/lib/cjs/rpc/IModelReadRpcInterface.js.map +1 -1
  96. package/lib/cjs/rpc/IModelTileRpcInterface.js +4 -4
  97. package/lib/cjs/rpc/IModelTileRpcInterface.js.map +1 -1
  98. package/lib/cjs/rpc/SnapshotIModelRpcInterface.js +4 -4
  99. package/lib/cjs/rpc/SnapshotIModelRpcInterface.js.map +1 -1
  100. package/lib/cjs/rpc/core/RpcConfiguration.js +32 -34
  101. package/lib/cjs/rpc/core/RpcConfiguration.js.map +1 -1
  102. package/lib/cjs/rpc/core/RpcControl.js +8 -15
  103. package/lib/cjs/rpc/core/RpcControl.js.map +1 -1
  104. package/lib/cjs/rpc/core/RpcInvocation.js +3 -5
  105. package/lib/cjs/rpc/core/RpcInvocation.js.map +1 -1
  106. package/lib/cjs/rpc/core/RpcMarshaling.d.ts +0 -3
  107. package/lib/cjs/rpc/core/RpcMarshaling.d.ts.map +1 -1
  108. package/lib/cjs/rpc/core/RpcMarshaling.js +5 -4
  109. package/lib/cjs/rpc/core/RpcMarshaling.js.map +1 -1
  110. package/lib/cjs/rpc/core/RpcOperation.js +2 -2
  111. package/lib/cjs/rpc/core/RpcOperation.js.map +1 -1
  112. package/lib/cjs/rpc/core/RpcProtocol.js +4 -4
  113. package/lib/cjs/rpc/core/RpcProtocol.js.map +1 -1
  114. package/lib/cjs/rpc/core/RpcPush.js +5 -5
  115. package/lib/cjs/rpc/core/RpcPush.js.map +1 -1
  116. package/lib/cjs/rpc/core/RpcRequest.js +5 -5
  117. package/lib/cjs/rpc/core/RpcRequest.js.map +1 -1
  118. package/lib/cjs/rpc/core/RpcRoutingToken.js +2 -2
  119. package/lib/cjs/rpc/core/RpcRoutingToken.js.map +1 -1
  120. package/lib/cjs/rpc/core/RpcSessionInvocation.js +1 -1
  121. package/lib/cjs/rpc/core/RpcSessionInvocation.js.map +1 -1
  122. package/lib/cjs/rpc/web/BentleyCloudRpcManager.js +6 -6
  123. package/lib/cjs/rpc/web/BentleyCloudRpcManager.js.map +1 -1
  124. package/lib/cjs/rpc/web/RpcMultipart.d.ts.map +1 -1
  125. package/lib/cjs/rpc/web/RpcMultipart.js +13 -12
  126. package/lib/cjs/rpc/web/RpcMultipart.js.map +1 -1
  127. package/lib/cjs/rpc/web/WebAppRpcRequest.js +17 -19
  128. package/lib/cjs/rpc/web/WebAppRpcRequest.js.map +1 -1
  129. package/lib/cjs/tile/IModelTileIO.d.ts +2 -2
  130. package/lib/cjs/tile/IModelTileIO.js +3 -3
  131. package/lib/cjs/tile/IModelTileIO.js.map +1 -1
  132. package/lib/esm/AmbientOcclusion.js +9 -9
  133. package/lib/esm/AmbientOcclusion.js.map +1 -1
  134. package/lib/esm/AnalysisStyle.js +1 -1
  135. package/lib/esm/AnalysisStyle.js.map +1 -1
  136. package/lib/esm/Atmosphere.js +19 -21
  137. package/lib/esm/Atmosphere.js.map +1 -1
  138. package/lib/esm/BriefcaseTypes.d.ts +2 -2
  139. package/lib/esm/BriefcaseTypes.d.ts.map +1 -1
  140. package/lib/esm/BriefcaseTypes.js.map +1 -1
  141. package/lib/esm/ClipStyle.js +5 -5
  142. package/lib/esm/ClipStyle.js.map +1 -1
  143. package/lib/esm/ColorDef.js +10 -10
  144. package/lib/esm/ColorDef.js.map +1 -1
  145. package/lib/esm/ConcurrentQuery.d.ts +5 -1
  146. package/lib/esm/ConcurrentQuery.d.ts.map +1 -1
  147. package/lib/esm/ConcurrentQuery.js.map +1 -1
  148. package/lib/esm/ContourDisplay.js +5 -5
  149. package/lib/esm/ContourDisplay.js.map +1 -1
  150. package/lib/esm/ECSqlReader.d.ts.map +1 -1
  151. package/lib/esm/ECSqlReader.js +3 -1
  152. package/lib/esm/ECSqlReader.js.map +1 -1
  153. package/lib/esm/ElementProps.d.ts.map +1 -1
  154. package/lib/esm/ElementProps.js +4 -4
  155. package/lib/esm/ElementProps.js.map +1 -1
  156. package/lib/esm/Environment.js +2 -2
  157. package/lib/esm/Environment.js.map +1 -1
  158. package/lib/esm/FeatureSymbology.js +3 -3
  159. package/lib/esm/FeatureSymbology.js.map +1 -1
  160. package/lib/esm/Fonts.d.ts +69 -11
  161. package/lib/esm/Fonts.d.ts.map +1 -1
  162. package/lib/esm/Fonts.js +20 -5
  163. package/lib/esm/Fonts.js.map +1 -1
  164. package/lib/esm/Gradient.js +9 -9
  165. package/lib/esm/Gradient.js.map +1 -1
  166. package/lib/esm/GroundPlane.js +2 -2
  167. package/lib/esm/GroundPlane.js.map +1 -1
  168. package/lib/esm/HiddenLine.js +4 -4
  169. package/lib/esm/HiddenLine.js.map +1 -1
  170. package/lib/esm/IModel.d.ts +3 -12
  171. package/lib/esm/IModel.d.ts.map +1 -1
  172. package/lib/esm/IModel.js +6 -6
  173. package/lib/esm/IModel.js.map +1 -1
  174. package/lib/esm/IModelError.d.ts +0 -2
  175. package/lib/esm/IModelError.d.ts.map +1 -1
  176. package/lib/esm/IModelError.js +0 -1
  177. package/lib/esm/IModelError.js.map +1 -1
  178. package/lib/esm/ITwinError.d.ts +1 -1
  179. package/lib/esm/ITwinError.d.ts.map +1 -1
  180. package/lib/esm/ITwinError.js +1 -1
  181. package/lib/esm/ITwinError.js.map +1 -1
  182. package/lib/esm/LightSettings.js +1 -1
  183. package/lib/esm/LightSettings.js.map +1 -1
  184. package/lib/esm/PlanarClipMask.js +2 -2
  185. package/lib/esm/PlanarClipMask.js.map +1 -1
  186. package/lib/esm/RealityModelDisplaySettings.js +4 -4
  187. package/lib/esm/RealityModelDisplaySettings.js.map +1 -1
  188. package/lib/esm/RenderMaterial.js +3 -3
  189. package/lib/esm/RenderMaterial.js.map +1 -1
  190. package/lib/esm/RpcInterface.js +2 -2
  191. package/lib/esm/RpcInterface.js.map +1 -1
  192. package/lib/esm/SkyBox.js +4 -4
  193. package/lib/esm/SkyBox.js.map +1 -1
  194. package/lib/esm/SolarShadows.js +1 -1
  195. package/lib/esm/SolarShadows.js.map +1 -1
  196. package/lib/esm/SubCategoryAppearance.js +1 -1
  197. package/lib/esm/SubCategoryAppearance.js.map +1 -1
  198. package/lib/esm/SubCategoryOverride.js +2 -2
  199. package/lib/esm/SubCategoryOverride.js.map +1 -1
  200. package/lib/esm/TextureMapping.js +2 -2
  201. package/lib/esm/TextureMapping.js.map +1 -1
  202. package/lib/esm/ThematicDisplay.js +2 -2
  203. package/lib/esm/ThematicDisplay.js.map +1 -1
  204. package/lib/esm/ViewDetails.js +2 -2
  205. package/lib/esm/ViewDetails.js.map +1 -1
  206. package/lib/esm/ViewFlags.js +2 -2
  207. package/lib/esm/ViewFlags.js.map +1 -1
  208. package/lib/esm/WhiteOnWhiteReversalSettings.js +2 -2
  209. package/lib/esm/WhiteOnWhiteReversalSettings.js.map +1 -1
  210. package/lib/esm/annotation/TextStyle.js +19 -19
  211. package/lib/esm/annotation/TextStyle.js.map +1 -1
  212. package/lib/esm/core-common.d.ts +0 -1
  213. package/lib/esm/core-common.d.ts.map +1 -1
  214. package/lib/esm/core-common.js +0 -1
  215. package/lib/esm/core-common.js.map +1 -1
  216. package/lib/esm/geometry/Cartographic.js +13 -13
  217. package/lib/esm/geometry/Cartographic.js.map +1 -1
  218. package/lib/esm/ipc/IpcWebSocket.js +1 -1
  219. package/lib/esm/ipc/IpcWebSocket.js.map +1 -1
  220. package/lib/esm/ipc/IpcWebSocketTransport.js +1 -1
  221. package/lib/esm/ipc/IpcWebSocketTransport.js.map +1 -1
  222. package/lib/esm/rpc/DevToolsRpcInterface.js +6 -6
  223. package/lib/esm/rpc/DevToolsRpcInterface.js.map +1 -1
  224. package/lib/esm/rpc/IModelReadRpcInterface.js +5 -5
  225. package/lib/esm/rpc/IModelReadRpcInterface.js.map +1 -1
  226. package/lib/esm/rpc/IModelTileRpcInterface.js +4 -4
  227. package/lib/esm/rpc/IModelTileRpcInterface.js.map +1 -1
  228. package/lib/esm/rpc/SnapshotIModelRpcInterface.js +4 -4
  229. package/lib/esm/rpc/SnapshotIModelRpcInterface.js.map +1 -1
  230. package/lib/esm/rpc/core/RpcConfiguration.js +32 -34
  231. package/lib/esm/rpc/core/RpcConfiguration.js.map +1 -1
  232. package/lib/esm/rpc/core/RpcControl.js +8 -15
  233. package/lib/esm/rpc/core/RpcControl.js.map +1 -1
  234. package/lib/esm/rpc/core/RpcInvocation.js +3 -5
  235. package/lib/esm/rpc/core/RpcInvocation.js.map +1 -1
  236. package/lib/esm/rpc/core/RpcMarshaling.d.ts +0 -3
  237. package/lib/esm/rpc/core/RpcMarshaling.d.ts.map +1 -1
  238. package/lib/esm/rpc/core/RpcMarshaling.js +2 -1
  239. package/lib/esm/rpc/core/RpcMarshaling.js.map +1 -1
  240. package/lib/esm/rpc/core/RpcOperation.js +2 -2
  241. package/lib/esm/rpc/core/RpcOperation.js.map +1 -1
  242. package/lib/esm/rpc/core/RpcProtocol.js +4 -4
  243. package/lib/esm/rpc/core/RpcProtocol.js.map +1 -1
  244. package/lib/esm/rpc/core/RpcPush.js +5 -5
  245. package/lib/esm/rpc/core/RpcPush.js.map +1 -1
  246. package/lib/esm/rpc/core/RpcRequest.js +5 -5
  247. package/lib/esm/rpc/core/RpcRequest.js.map +1 -1
  248. package/lib/esm/rpc/core/RpcRoutingToken.js +2 -2
  249. package/lib/esm/rpc/core/RpcRoutingToken.js.map +1 -1
  250. package/lib/esm/rpc/core/RpcSessionInvocation.js +1 -1
  251. package/lib/esm/rpc/core/RpcSessionInvocation.js.map +1 -1
  252. package/lib/esm/rpc/web/BentleyCloudRpcManager.js +6 -6
  253. package/lib/esm/rpc/web/BentleyCloudRpcManager.js.map +1 -1
  254. package/lib/esm/rpc/web/RpcMultipart.d.ts.map +1 -1
  255. package/lib/esm/rpc/web/RpcMultipart.js +14 -13
  256. package/lib/esm/rpc/web/RpcMultipart.js.map +1 -1
  257. package/lib/esm/rpc/web/WebAppRpcRequest.js +17 -19
  258. package/lib/esm/rpc/web/WebAppRpcRequest.js.map +1 -1
  259. package/lib/esm/tile/IModelTileIO.d.ts +2 -2
  260. package/lib/esm/tile/IModelTileIO.js +3 -3
  261. package/lib/esm/tile/IModelTileIO.js.map +1 -1
  262. package/package.json +9 -9
  263. package/lib/cjs/rpc/WipRpcInterface.d.ts +0 -31
  264. package/lib/cjs/rpc/WipRpcInterface.d.ts.map +0 -1
  265. package/lib/cjs/rpc/WipRpcInterface.js +0 -42
  266. package/lib/cjs/rpc/WipRpcInterface.js.map +0 -1
  267. package/lib/esm/rpc/WipRpcInterface.d.ts +0 -31
  268. package/lib/esm/rpc/WipRpcInterface.d.ts.map +0 -1
  269. package/lib/esm/rpc/WipRpcInterface.js +0 -38
  270. package/lib/esm/rpc/WipR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AAuB;QACxC,MAAM,IAAI,yBAAW,CAAC,2BAAa,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;IAC3D,CAAC;IACD,YAAY,CAAC,CAAS,EAAE,IAAoB,EAAE,KAAyB;QACrE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,EAAE,IAAI,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,0BAA0B,EAAE,CAAC,CAAC,CAAC;IAC5F,CAAC;CACF,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RpcInterface\n */\n\nimport { BentleyStatus, IModelError } from \"../../IModelError\";\nimport { BackendBuffer, BackendReadable } from \"../../BackendTypes\";\nimport { RpcSerializedValue } from \"../core/RpcMarshaling\";\nimport { HttpServerRequest } from \"../web/WebAppRpcProtocol\";\n\n/* eslint-disable @typescript-eslint/no-deprecated */\n\n/** @internal */\nexport interface FormDataCommon {\n append(name: string, value: string | Blob | BackendBuffer, fileName?: string): void;\n}\n\n/** @internal */\nexport interface ReadableFormData extends BackendReadable {\n getHeaders(): { [key: string]: any };\n}\n\n/** Support for transporting RPC values using the HTTP multipart content type.\n * @internal\n */\nexport class RpcMultipart {\n /** Creates a multipart form object for an RPC value. */\n public static createForm(value: RpcSerializedValue): FormData {\n const form = new FormData();\n RpcMultipart.writeValueToForm(form, value);\n return form;\n }\n\n /** Creates a multipart stream for an RPC value. */\n public static createStream(value: RpcSerializedValue): ReadableFormData {\n return this.platform.createStream(value);\n }\n\n /** Obtains the RPC value from a multipart HTTP request. */\n public static async parseRequest(req: HttpServerRequest): Promise<RpcSerializedValue> {\n return this.platform.parseRequest(req);\n }\n\n /** @internal */\n public static writeValueToForm(form: FormDataCommon, value: RpcSerializedValue) {\n form.append(\"objects\", value.objects);\n\n for (let i = 0; i !== value.data.length; ++i) {\n this.platform.appendToForm(i, form, value);\n }\n }\n\n /** @internal */\n public static platform = {\n createStream(_value: RpcSerializedValue): ReadableFormData {\n throw new IModelError(BentleyStatus.ERROR, \"Not bound.\");\n },\n async parseRequest(_req: HttpServerRequest): Promise<RpcSerializedValue> {\n throw new IModelError(BentleyStatus.ERROR, \"Not bound.\");\n },\n appendToForm(i: number, form: FormDataCommon, value: RpcSerializedValue): void {\n form.append(`data-${i}`, new Blob([value.data[i]], { type: \"application/octet-stream\" }));\n },\n };\n}\n\n"]}
1
+ {"version":3,"file":"RpcMultipart.js","sourceRoot":"","sources":["../../../../src/rpc/web/RpcMultipart.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAoD;AACpD,mDAAgD;AAiBhD;;GAEG;AACH,MAAa,YAAY;IACvB,wDAAwD;IACjD,MAAM,CAAC,UAAU,CAAC,KAAyB;QAChD,MAAM,IAAI,GAAG,IAAI,QAAQ,EAAE,CAAC;QAC5B,YAAY,CAAC,gBAAgB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,mDAAmD;IAC5C,MAAM,CAAC,YAAY,CAAC,KAAyB;QAClD,OAAO,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC;IAED,2DAA2D;IACpD,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,GAAsB;QACrD,OAAO,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;IACzC,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,gBAAgB,CAAC,IAAoB,EAAE,KAAyB;QAC5E,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QAEtC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC;YAC7C,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;QAC7C,CAAC;IACH,CAAC;IAED,gBAAgB;aACF,aAAQ,GAAG;QACvB,YAAY,CAAC,MAA0B;YACrC,MAAM,IAAI,yBAAW,CAAC,4BAAa,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;QAC3D,CAAC;QACD,KAAK,CAAC,YAAY,CAAC,IAAuB;YACxC,MAAM,IAAI,yBAAW,CAAC,4BAAa,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;QAC3D,CAAC;QACD,YAAY,CAAC,CAAS,EAAE,IAAoB,EAAE,KAAyB;YACrE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,EAAE,IAAI,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,0BAA0B,EAAE,CAAC,CAAC,CAAC;QAC5F,CAAC;KACF,CAAC;;AAtCJ,oCAuCC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RpcInterface\n */\n\nimport { BentleyStatus } from \"@itwin/core-bentley\";\nimport { IModelError } from \"../../IModelError\";\nimport { BackendBuffer, BackendReadable } from \"../../BackendTypes\";\nimport { RpcSerializedValue } from \"../core/RpcMarshaling\";\nimport { HttpServerRequest } from \"../web/WebAppRpcProtocol\";\n\n/* eslint-disable @typescript-eslint/no-deprecated */\n\n/** @internal */\nexport interface FormDataCommon {\n append(name: string, value: string | Blob | BackendBuffer, fileName?: string): void;\n}\n\n/** @internal */\nexport interface ReadableFormData extends BackendReadable {\n getHeaders(): { [key: string]: any };\n}\n\n/** Support for transporting RPC values using the HTTP multipart content type.\n * @internal\n */\nexport class RpcMultipart {\n /** Creates a multipart form object for an RPC value. */\n public static createForm(value: RpcSerializedValue): FormData {\n const form = new FormData();\n RpcMultipart.writeValueToForm(form, value);\n return form;\n }\n\n /** Creates a multipart stream for an RPC value. */\n public static createStream(value: RpcSerializedValue): ReadableFormData {\n return this.platform.createStream(value);\n }\n\n /** Obtains the RPC value from a multipart HTTP request. */\n public static async parseRequest(req: HttpServerRequest): Promise<RpcSerializedValue> {\n return this.platform.parseRequest(req);\n }\n\n /** @internal */\n public static writeValueToForm(form: FormDataCommon, value: RpcSerializedValue) {\n form.append(\"objects\", value.objects);\n\n for (let i = 0; i !== value.data.length; ++i) {\n this.platform.appendToForm(i, form, value);\n }\n }\n\n /** @internal */\n public static platform = {\n createStream(_value: RpcSerializedValue): ReadableFormData {\n throw new IModelError(BentleyStatus.ERROR, \"Not bound.\");\n },\n async parseRequest(_req: HttpServerRequest): Promise<RpcSerializedValue> {\n throw new IModelError(BentleyStatus.ERROR, \"Not bound.\");\n },\n appendToForm(i: number, form: FormDataCommon, value: RpcSerializedValue): void {\n form.append(`data-${i}`, new Blob([value.data[i]], { type: \"application/octet-stream\" }));\n },\n };\n}\n\n"]}
@@ -6,7 +6,6 @@
6
6
  /** @packageDocumentation
7
7
  * @module RpcInterface
8
8
  */
9
- var _a;
10
9
  Object.defineProperty(exports, "__esModule", { value: true });
11
10
  exports.WebAppRpcRequest = void 0;
12
11
  const core_bentley_1 = require("@itwin/core-bentley");
@@ -22,6 +21,12 @@ const WebAppRpcProtocol_1 = require("./WebAppRpcProtocol");
22
21
  */
23
22
  class WebAppRpcRequest extends RpcRequest_1.RpcRequest {
24
23
  get _headers() { return this._request.headers; }
24
+ /** The maximum size permitted for an encoded component in a URL.
25
+ * Note that some backends limit the total cumulative request size. Our current node backends accept requests with a max size of 16 kb.
26
+ * In addition to the url size, an authorization header may also add considerably to the request size.
27
+ * @note This is used for features like encoding the payload of a cacheable request in the URL.
28
+ */
29
+ static { this.maxUrlComponentSize = 1024 * 8; }
25
30
  /** Parses a request. */
26
31
  static async parseRequest(protocol, req) {
27
32
  return this.backend.parseRequest(protocol, req);
@@ -181,7 +186,7 @@ class WebAppRpcRequest extends RpcRequest_1.RpcRequest {
181
186
  }
182
187
  async setupTransport() {
183
188
  const parameters = (await this.protocol.serialize(this)).parameters;
184
- const transportType = _a.computeTransportType(parameters, this.parameters);
189
+ const transportType = WebAppRpcRequest.computeTransportType(parameters, this.parameters);
185
190
  if (transportType === RpcConstants_1.RpcContentType.Binary) {
186
191
  this.setupBinaryTransport(parameters);
187
192
  }
@@ -206,7 +211,7 @@ class WebAppRpcRequest extends RpcRequest_1.RpcRequest {
206
211
  setupTextTransport(parameters) {
207
212
  if (this.operation.policy.allowResponseCaching(this)) {
208
213
  const encodedBody = btoa(parameters.objects);
209
- if (encodedBody.length <= _a.maxUrlComponentSize) {
214
+ if (encodedBody.length <= WebAppRpcRequest.maxUrlComponentSize) {
210
215
  this._request.method = "get";
211
216
  this._request.body = undefined;
212
217
  delete this._headers[RpcConstants_1.WEB_RPC_CONSTANTS.CONTENT];
@@ -219,22 +224,15 @@ class WebAppRpcRequest extends RpcRequest_1.RpcRequest {
219
224
  this._request.method = "post";
220
225
  this._request.body = parameters.objects;
221
226
  }
227
+ /** @internal */
228
+ static { this.backend = {
229
+ sendResponse: async (_protocol, _request, _fulfillment, _req, _res) => {
230
+ throw new IModelError_1.IModelError(core_bentley_1.BentleyStatus.ERROR, "Not bound.");
231
+ },
232
+ parseRequest: async (_protocol, _req) => {
233
+ throw new IModelError_1.IModelError(core_bentley_1.BentleyStatus.ERROR, "Not bound.");
234
+ },
235
+ }; }
222
236
  }
223
237
  exports.WebAppRpcRequest = WebAppRpcRequest;
224
- _a = WebAppRpcRequest;
225
- /** The maximum size permitted for an encoded component in a URL.
226
- * Note that some backends limit the total cumulative request size. Our current node backends accept requests with a max size of 16 kb.
227
- * In addition to the url size, an authorization header may also add considerably to the request size.
228
- * @note This is used for features like encoding the payload of a cacheable request in the URL.
229
- */
230
- WebAppRpcRequest.maxUrlComponentSize = 1024 * 8;
231
- /** @internal */
232
- WebAppRpcRequest.backend = {
233
- sendResponse: async (_protocol, _request, _fulfillment, _req, _res) => {
234
- throw new IModelError_1.IModelError(core_bentley_1.BentleyStatus.ERROR, "Not bound.");
235
- },
236
- parseRequest: async (_protocol, _req) => {
237
- throw new IModelError_1.IModelError(core_bentley_1.BentleyStatus.ERROR, "Not bound.");
238
- },
239
- };
240
238
  //# sourceMappingURL=WebAppRpcRequest.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"WebAppRpcRequest.js","sourceRoot":"","sources":["../../../../src/rpc/web/WebAppRpcRequest.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;AAEH,sDAAoD;AACpD,mDAAiF;AAEjF,uDAA2F;AAC3F,yDAAmF;AAEnF,mDAAgD;AAChD,uEAAoE;AACpE,iDAA8C;AAC9C,2DAA+F;AAO/F;;GAEG;AACH,MAAa,gBAAiB,SAAQ,uBAAU;IAI9C,IAAY,QAAQ,KAAK,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAoC,CAAC,CAAC,CAAC;IAkBrF,wBAAwB;IACjB,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,QAA2B,EAAE,GAAsB;QAClF,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IAClD,CAAC;IAED,4CAA4C;IACrC,MAAM,CAAC,KAAK,CAAC,YAAY,CAC9B,QAA2B,EAC3B,OAA6B,EAC7B,WAAkC,EAClC,GAAsB,EACtB,GAAuB;QAEvB,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;IAC7E,CAAC;IAED,qEAAqE;IAC9D,MAAM,CAAC,oBAAoB,CAAC,KAAyB,EAAE,MAAW;QACvE,IAAI,MAAM,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MAAM,IAAI,yBAAW,CAAC,4BAAa,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;IAC3D,CAAC;CACF,AAPoB,CAOnB","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RpcInterface\n */\n\nimport { BentleyStatus } from \"@itwin/core-bentley\";\nimport { IModelError, ServerError, ServerTimeoutError } from \"../../IModelError\";\nimport { RpcInterface } from \"../../RpcInterface\";\nimport { RpcContentType, RpcProtocolEvent, WEB_RPC_CONSTANTS } from \"../core/RpcConstants\";\nimport { MarshalingBinaryMarker, RpcSerializedValue } from \"../core/RpcMarshaling\";\nimport { RpcRequestFulfillment, SerializedRpcRequest } from \"../core/RpcProtocol\";\nimport { RpcRequest } from \"../core/RpcRequest\";\nimport { RpcMultipartParser } from \"./multipart/RpcMultipartParser\";\nimport { RpcMultipart } from \"./RpcMultipart\";\nimport { HttpServerRequest, HttpServerResponse, WebAppRpcProtocol } from \"./WebAppRpcProtocol\";\n\n/* eslint-disable @typescript-eslint/no-deprecated */\n\n/** @internal */\nexport type HttpMethod_T = \"get\" | \"put\" | \"post\" | \"delete\" | \"options\" | \"head\" | \"patch\" | \"trace\"; // eslint-disable-line @typescript-eslint/naming-convention\n\n/** A web application RPC request.\n * @internal\n */\nexport class WebAppRpcRequest extends RpcRequest {\n private _loading: boolean = false;\n private _request: RequestInit = {};\n private _pathSuffix: string = \"\";\n private get _headers() { return this._request.headers as { [key: string]: string }; }\n\n /** The maximum size permitted for an encoded component in a URL.\n * Note that some backends limit the total cumulative request size. Our current node backends accept requests with a max size of 16 kb.\n * In addition to the url size, an authorization header may also add considerably to the request size.\n * @note This is used for features like encoding the payload of a cacheable request in the URL.\n */\n public static maxUrlComponentSize = 1024 * 8;\n\n /** The HTTP method for this request. */\n public override method: HttpMethod_T;\n\n /** Convenience access to the protocol of this request. */\n public override readonly protocol: WebAppRpcProtocol = this.client.configuration.protocol as any;\n\n /** Standardized access to metadata about the request (useful for purposes such as logging). */\n public metadata = { status: 0, message: \"\" };\n\n /** Parses a request. */\n public static async parseRequest(protocol: WebAppRpcProtocol, req: HttpServerRequest): Promise<SerializedRpcRequest> {\n return this.backend.parseRequest(protocol, req);\n }\n\n /** Sends the response for a web request. */\n public static async sendResponse(\n protocol: WebAppRpcProtocol,\n request: SerializedRpcRequest,\n fulfillment: RpcRequestFulfillment,\n req: HttpServerRequest,\n res: HttpServerResponse,\n ): Promise<void> {\n return this.backend.sendResponse(protocol, request, fulfillment, req, res);\n }\n\n /** Determines the most efficient transport type for an RPC value. */\n public static computeTransportType(value: RpcSerializedValue, source: any): RpcContentType {\n if (source instanceof Uint8Array || (Array.isArray(source) && source[0] instanceof Uint8Array)) {\n return RpcContentType.Binary;\n } else if (value.data.length > 0) {\n return RpcContentType.Multipart;\n } else if (value.stream) {\n return RpcContentType.Stream;\n } else {\n return RpcContentType.Text;\n }\n }\n\n /** Constructs a web application request. */\n public constructor(client: RpcInterface, operation: string, parameters: any[]) {\n super(client, operation, parameters);\n this.path = this.protocol.supplyPathForOperation(this.operation, this);\n this.method = \"head\";\n this._request.headers = {};\n }\n\n /** Sets request header values. */\n protected setHeader(name: string, value: string): void {\n this._headers[name] = value;\n }\n\n /** Sends the request. */\n protected async send(): Promise<number> {\n this._loading = true;\n await this.setupTransport();\n\n return new Promise<number>(async (resolve, reject) => {\n try {\n resolve(await this.performFetch());\n } catch (reason) {\n reject(new ServerError(-1, typeof (reason) === \"string\" ? reason : \"Server connection error.\"));\n }\n });\n }\n\n protected override computeRetryAfter(attempts: number): number {\n const retryAfter = this._response && this._response.headers.get(\"Retry-After\");\n if (retryAfter) {\n this.resetTransientFaultCount();\n\n const r = Number(retryAfter);\n if (Number.isFinite(r)) {\n return r * 1000;\n }\n\n const d = Date.parse(retryAfter);\n if (!Number.isNaN(d)) {\n return d - Date.now();\n }\n } else {\n this.recordTransientFault();\n }\n\n return super.computeRetryAfter(attempts);\n }\n\n protected override handleUnknownResponse(code: number) {\n if (this.protocol.isTimeout(code)) {\n this.reject(new ServerTimeoutError(\"Request timeout.\"));\n } else {\n this.reject(new ServerError(code, \"Unknown server response code.\"));\n }\n }\n\n protected async load(): Promise<RpcSerializedValue> {\n return new Promise<RpcSerializedValue>(async (resolve, reject) => {\n try {\n if (!this._loading)\n return;\n\n const response = this._response;\n if (!response) {\n reject(new IModelError(BentleyStatus.ERROR, \"Invalid state.\"));\n return;\n }\n\n if (this.protocol.protocolVersionHeaderName) {\n const version = response.headers.get(this.protocol.protocolVersionHeaderName);\n if (version) {\n this.responseProtocolVersion = parseInt(version, 10);\n }\n }\n\n const contentType = response.headers.get(WEB_RPC_CONSTANTS.CONTENT);\n const responseType = WebAppRpcProtocol.computeContentType(contentType);\n\n if (responseType === RpcContentType.Binary) {\n resolve(await this.loadBinary(response));\n } else if (responseType === RpcContentType.Multipart) {\n resolve(await this.loadMultipart(response, contentType!));\n } else {\n resolve(await this.loadText(response));\n }\n\n this._loading = false;\n this.setLastUpdatedTime();\n this.protocol.events.raiseEvent(RpcProtocolEvent.ResponseLoaded, this);\n } catch (reason) {\n if (!this._loading)\n return;\n\n this._loading = false;\n reject(new ServerError(this.metadata.status, typeof (reason) === \"string\" ? reason : \"Unknown server response error.\"));\n }\n });\n }\n\n /** Override to supply an alternate fetch function. */\n protected supplyFetch(): typeof fetch {\n return fetch;\n }\n\n /** Override to supply an alternate Request function. */\n protected supplyRequest(): typeof Request {\n return Request;\n }\n\n private async performFetch(): Promise<number> {\n const requestClass = this.supplyRequest();\n const fetchFunction = this.supplyFetch();\n\n const path = new URL(this.path, typeof (location) !== \"undefined\" ? location.origin : undefined);\n if (this._pathSuffix) {\n const params = new URLSearchParams();\n params.set(\"parameters\", this._pathSuffix);\n path.search = `?${params.toString()}`;\n }\n\n const request = new requestClass(path.toString(), this._request);\n const response = await fetchFunction(request);\n this._response = response;\n this.metadata.status = response.status;\n return response.status;\n }\n\n private async loadText(response: Response) {\n const value = await response.text();\n this.metadata.message = value;\n return RpcSerializedValue.create(value);\n }\n\n private async loadBinary(response: Response) {\n const value = new Uint8Array(await response.arrayBuffer());\n const objects = JSON.stringify(MarshalingBinaryMarker.createDefault());\n return RpcSerializedValue.create(objects, [value]);\n }\n\n private async loadMultipart(response: Response, contentType: string) {\n const data = await response.arrayBuffer();\n const value = new RpcMultipartParser(contentType, new Uint8Array(data)).parse();\n return value;\n }\n\n private async setupTransport(): Promise<void> {\n const parameters = (await this.protocol.serialize(this)).parameters;\n const transportType = WebAppRpcRequest.computeTransportType(parameters, this.parameters);\n\n if (transportType === RpcContentType.Binary) {\n this.setupBinaryTransport(parameters);\n } else if (transportType === RpcContentType.Multipart) {\n this.setupMultipartTransport(parameters);\n } else {\n this.setupTextTransport(parameters);\n }\n }\n\n private setupBinaryTransport(parameters: RpcSerializedValue) {\n this._headers[WEB_RPC_CONSTANTS.CONTENT] = WEB_RPC_CONSTANTS.BINARY;\n this._request.method = \"post\";\n this._request.body = parameters.data[0];\n }\n\n private setupMultipartTransport(parameters: RpcSerializedValue) {\n // IMPORTANT: do not set a multipart Content-Type header value. The browser does this automatically!\n delete this._headers[WEB_RPC_CONSTANTS.CONTENT];\n this._request.method = \"post\";\n this._request.body = RpcMultipart.createForm(parameters);\n }\n\n private setupTextTransport(parameters: RpcSerializedValue) {\n if (this.operation.policy.allowResponseCaching(this)) {\n const encodedBody = btoa(parameters.objects);\n if (encodedBody.length <= WebAppRpcRequest.maxUrlComponentSize) {\n this._request.method = \"get\";\n this._request.body = undefined;\n delete this._headers[WEB_RPC_CONSTANTS.CONTENT];\n this._pathSuffix = encodedBody;\n return;\n }\n }\n\n this._pathSuffix = \"\";\n this._headers[WEB_RPC_CONSTANTS.CONTENT] = WEB_RPC_CONSTANTS.TEXT;\n this._request.method = \"post\";\n this._request.body = parameters.objects;\n }\n\n /** @internal */\n public static backend = {\n sendResponse: async (_protocol: WebAppRpcProtocol, _request: SerializedRpcRequest, _fulfillment: RpcRequestFulfillment, _req: HttpServerRequest, _res: HttpServerResponse): Promise<void> => {\n throw new IModelError(BentleyStatus.ERROR, \"Not bound.\");\n },\n parseRequest: async (_protocol: WebAppRpcProtocol, _req: HttpServerRequest): Promise<SerializedRpcRequest> => {\n throw new IModelError(BentleyStatus.ERROR, \"Not bound.\");\n },\n };\n}\n"]}
1
+ {"version":3,"file":"WebAppRpcRequest.js","sourceRoot":"","sources":["../../../../src/rpc/web/WebAppRpcRequest.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAoD;AACpD,mDAAiF;AAEjF,uDAA2F;AAC3F,yDAAmF;AAEnF,mDAAgD;AAChD,uEAAoE;AACpE,iDAA8C;AAC9C,2DAA+F;AAO/F;;GAEG;AACH,MAAa,gBAAiB,SAAQ,uBAAU;IAI9C,IAAY,QAAQ,KAAK,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAoC,CAAC,CAAC,CAAC;IAErF;;;;OAIG;aACW,wBAAmB,GAAG,IAAI,GAAG,CAAC,AAAX,CAAY;IAW7C,wBAAwB;IACjB,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,QAA2B,EAAE,GAAsB;QAClF,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IAClD,CAAC;IAED,4CAA4C;IACrC,MAAM,CAAC,KAAK,CAAC,YAAY,CAC9B,QAA2B,EAC3B,OAA6B,EAC7B,WAAkC,EAClC,GAAsB,EACtB,GAAuB;QAEvB,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;IAC7E,CAAC;IAED,qEAAqE;IAC9D,MAAM,CAAC,oBAAoB,CAAC,KAAyB,EAAE,MAAW;QACvE,IAAI,MAAM,YAAY,UAAU,IAAI,CAAC,KAAK,C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","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RpcInterface\n */\n\nimport { BentleyStatus } from \"@itwin/core-bentley\";\nimport { IModelError, ServerError, ServerTimeoutError } from \"../../IModelError\";\nimport { RpcInterface } from \"../../RpcInterface\";\nimport { RpcContentType, RpcProtocolEvent, WEB_RPC_CONSTANTS } from \"../core/RpcConstants\";\nimport { MarshalingBinaryMarker, RpcSerializedValue } from \"../core/RpcMarshaling\";\nimport { RpcRequestFulfillment, SerializedRpcRequest } from \"../core/RpcProtocol\";\nimport { RpcRequest } from \"../core/RpcRequest\";\nimport { RpcMultipartParser } from \"./multipart/RpcMultipartParser\";\nimport { RpcMultipart } from \"./RpcMultipart\";\nimport { HttpServerRequest, HttpServerResponse, WebAppRpcProtocol } from \"./WebAppRpcProtocol\";\n\n/* eslint-disable @typescript-eslint/no-deprecated */\n\n/** @internal */\nexport type HttpMethod_T = \"get\" | \"put\" | \"post\" | \"delete\" | \"options\" | \"head\" | \"patch\" | \"trace\"; // eslint-disable-line @typescript-eslint/naming-convention\n\n/** A web application RPC request.\n * @internal\n */\nexport class WebAppRpcRequest extends RpcRequest {\n private _loading: boolean = false;\n private _request: RequestInit = {};\n private _pathSuffix: string = \"\";\n private get _headers() { return this._request.headers as { [key: string]: string }; }\n\n /** The maximum size permitted for an encoded component in a URL.\n * Note that some backends limit the total cumulative request size. Our current node backends accept requests with a max size of 16 kb.\n * In addition to the url size, an authorization header may also add considerably to the request size.\n * @note This is used for features like encoding the payload of a cacheable request in the URL.\n */\n public static maxUrlComponentSize = 1024 * 8;\n\n /** The HTTP method for this request. */\n public override method: HttpMethod_T;\n\n /** Convenience access to the protocol of this request. */\n public override readonly protocol: WebAppRpcProtocol = this.client.configuration.protocol as any;\n\n /** Standardized access to metadata about the request (useful for purposes such as logging). */\n public metadata = { status: 0, message: \"\" };\n\n /** Parses a request. */\n public static async parseRequest(protocol: WebAppRpcProtocol, req: HttpServerRequest): Promise<SerializedRpcRequest> {\n return this.backend.parseRequest(protocol, req);\n }\n\n /** Sends the response for a web request. */\n public static async sendResponse(\n protocol: WebAppRpcProtocol,\n request: SerializedRpcRequest,\n fulfillment: RpcRequestFulfillment,\n req: HttpServerRequest,\n res: HttpServerResponse,\n ): Promise<void> {\n return this.backend.sendResponse(protocol, request, fulfillment, req, res);\n }\n\n /** Determines the most efficient transport type for an RPC value. */\n public static computeTransportType(value: RpcSerializedValue, source: any): RpcContentType {\n if (source instanceof Uint8Array || (Array.isArray(source) && source[0] instanceof Uint8Array)) {\n return RpcContentType.Binary;\n } else if (value.data.length > 0) {\n return RpcContentType.Multipart;\n } else if (value.stream) {\n return RpcContentType.Stream;\n } else {\n return RpcContentType.Text;\n }\n }\n\n /** Constructs a web application request. */\n public constructor(client: RpcInterface, operation: string, parameters: any[]) {\n super(client, operation, parameters);\n this.path = this.protocol.supplyPathForOperation(this.operation, this);\n this.method = \"head\";\n this._request.headers = {};\n }\n\n /** Sets request header values. */\n protected setHeader(name: string, value: string): void {\n this._headers[name] = value;\n }\n\n /** Sends the request. */\n protected async send(): Promise<number> {\n this._loading = true;\n await this.setupTransport();\n\n return new Promise<number>(async (resolve, reject) => {\n try {\n resolve(await this.performFetch());\n } catch (reason) {\n reject(new ServerError(-1, typeof (reason) === \"string\" ? reason : \"Server connection error.\"));\n }\n });\n }\n\n protected override computeRetryAfter(attempts: number): number {\n const retryAfter = this._response && this._response.headers.get(\"Retry-After\");\n if (retryAfter) {\n this.resetTransientFaultCount();\n\n const r = Number(retryAfter);\n if (Number.isFinite(r)) {\n return r * 1000;\n }\n\n const d = Date.parse(retryAfter);\n if (!Number.isNaN(d)) {\n return d - Date.now();\n }\n } else {\n this.recordTransientFault();\n }\n\n return super.computeRetryAfter(attempts);\n }\n\n protected override handleUnknownResponse(code: number) {\n if (this.protocol.isTimeout(code)) {\n this.reject(new ServerTimeoutError(\"Request timeout.\"));\n } else {\n this.reject(new ServerError(code, \"Unknown server response code.\"));\n }\n }\n\n protected async load(): Promise<RpcSerializedValue> {\n return new Promise<RpcSerializedValue>(async (resolve, reject) => {\n try {\n if (!this._loading)\n return;\n\n const response = this._response;\n if (!response) {\n reject(new IModelError(BentleyStatus.ERROR, \"Invalid state.\"));\n return;\n }\n\n if (this.protocol.protocolVersionHeaderName) {\n const version = response.headers.get(this.protocol.protocolVersionHeaderName);\n if (version) {\n this.responseProtocolVersion = parseInt(version, 10);\n }\n }\n\n const contentType = response.headers.get(WEB_RPC_CONSTANTS.CONTENT);\n const responseType = WebAppRpcProtocol.computeContentType(contentType);\n\n if (responseType === RpcContentType.Binary) {\n resolve(await this.loadBinary(response));\n } else if (responseType === RpcContentType.Multipart) {\n resolve(await this.loadMultipart(response, contentType!));\n } else {\n resolve(await this.loadText(response));\n }\n\n this._loading = false;\n this.setLastUpdatedTime();\n this.protocol.events.raiseEvent(RpcProtocolEvent.ResponseLoaded, this);\n } catch (reason) {\n if (!this._loading)\n return;\n\n this._loading = false;\n reject(new ServerError(this.metadata.status, typeof (reason) === \"string\" ? reason : \"Unknown server response error.\"));\n }\n });\n }\n\n /** Override to supply an alternate fetch function. */\n protected supplyFetch(): typeof fetch {\n return fetch;\n }\n\n /** Override to supply an alternate Request function. */\n protected supplyRequest(): typeof Request {\n return Request;\n }\n\n private async performFetch(): Promise<number> {\n const requestClass = this.supplyRequest();\n const fetchFunction = this.supplyFetch();\n\n const path = new URL(this.path, typeof (location) !== \"undefined\" ? location.origin : undefined);\n if (this._pathSuffix) {\n const params = new URLSearchParams();\n params.set(\"parameters\", this._pathSuffix);\n path.search = `?${params.toString()}`;\n }\n\n const request = new requestClass(path.toString(), this._request);\n const response = await fetchFunction(request);\n this._response = response;\n this.metadata.status = response.status;\n return response.status;\n }\n\n private async loadText(response: Response) {\n const value = await response.text();\n this.metadata.message = value;\n return RpcSerializedValue.create(value);\n }\n\n private async loadBinary(response: Response) {\n const value = new Uint8Array(await response.arrayBuffer());\n const objects = JSON.stringify(MarshalingBinaryMarker.createDefault());\n return RpcSerializedValue.create(objects, [value]);\n }\n\n private async loadMultipart(response: Response, contentType: string) {\n const data = await response.arrayBuffer();\n const value = new RpcMultipartParser(contentType, new Uint8Array(data)).parse();\n return value;\n }\n\n private async setupTransport(): Promise<void> {\n const parameters = (await this.protocol.serialize(this)).parameters;\n const transportType = WebAppRpcRequest.computeTransportType(parameters, this.parameters);\n\n if (transportType === RpcContentType.Binary) {\n this.setupBinaryTransport(parameters);\n } else if (transportType === RpcContentType.Multipart) {\n this.setupMultipartTransport(parameters);\n } else {\n this.setupTextTransport(parameters);\n }\n }\n\n private setupBinaryTransport(parameters: RpcSerializedValue) {\n this._headers[WEB_RPC_CONSTANTS.CONTENT] = WEB_RPC_CONSTANTS.BINARY;\n this._request.method = \"post\";\n this._request.body = parameters.data[0];\n }\n\n private setupMultipartTransport(parameters: RpcSerializedValue) {\n // IMPORTANT: do not set a multipart Content-Type header value. The browser does this automatically!\n delete this._headers[WEB_RPC_CONSTANTS.CONTENT];\n this._request.method = \"post\";\n this._request.body = RpcMultipart.createForm(parameters);\n }\n\n private setupTextTransport(parameters: RpcSerializedValue) {\n if (this.operation.policy.allowResponseCaching(this)) {\n const encodedBody = btoa(parameters.objects);\n if (encodedBody.length <= WebAppRpcRequest.maxUrlComponentSize) {\n this._request.method = \"get\";\n this._request.body = undefined;\n delete this._headers[WEB_RPC_CONSTANTS.CONTENT];\n this._pathSuffix = encodedBody;\n return;\n }\n }\n\n this._pathSuffix = \"\";\n this._headers[WEB_RPC_CONSTANTS.CONTENT] = WEB_RPC_CONSTANTS.TEXT;\n this._request.method = \"post\";\n this._request.body = parameters.objects;\n }\n\n /** @internal */\n public static backend = {\n sendResponse: async (_protocol: WebAppRpcProtocol, _request: SerializedRpcRequest, _fulfillment: RpcRequestFulfillment, _req: HttpServerRequest, _res: HttpServerResponse): Promise<void> => {\n throw new IModelError(BentleyStatus.ERROR, \"Not bound.\");\n },\n parseRequest: async (_protocol: WebAppRpcProtocol, _req: HttpServerRequest): Promise<SerializedRpcRequest> => {\n throw new IModelError(BentleyStatus.ERROR, \"Not bound.\");\n },\n };\n}\n"]}
@@ -27,13 +27,13 @@ export declare enum CurrentImdlVersion {
27
27
  * front-end is not capable of reading the tile content. Otherwise, this front-end can read the tile content even if the header specifies a
28
28
  * greater minor version than CurrentVersion.Minor, although some data may be skipped.
29
29
  */
30
- Major = 35,
30
+ Major = 36,
31
31
  /** The unsigned 16-bit minor version number. If the major version in the tile header is equal to CurrentVersion.Major, then this package can
32
32
  * read the tile content even if the minor version in the tile header is greater than this value, although some data may be skipped.
33
33
  */
34
34
  Minor = 0,
35
35
  /** The unsigned 32-bit version number derived from the 16-bit major and minor version numbers. */
36
- Combined = 2293760
36
+ Combined = 2359296
37
37
  }
38
38
  /** Header embedded at the beginning of binary tile data in iMdl format describing its contents.
39
39
  * @internal
@@ -36,13 +36,13 @@ var CurrentImdlVersion;
36
36
  * front-end is not capable of reading the tile content. Otherwise, this front-end can read the tile content even if the header specifies a
37
37
  * greater minor version than CurrentVersion.Minor, although some data may be skipped.
38
38
  */
39
- CurrentImdlVersion[CurrentImdlVersion["Major"] = 35] = "Major";
39
+ CurrentImdlVersion[CurrentImdlVersion["Major"] = 36] = "Major";
40
40
  /** The unsigned 16-bit minor version number. If the major version in the tile header is equal to CurrentVersion.Major, then this package can
41
41
  * read the tile content even if the minor version in the tile header is greater than this value, although some data may be skipped.
42
42
  */
43
43
  CurrentImdlVersion[CurrentImdlVersion["Minor"] = 0] = "Minor";
44
44
  /** The unsigned 32-bit version number derived from the 16-bit major and minor version numbers. */
45
- CurrentImdlVersion[CurrentImdlVersion["Combined"] = 2293760] = "Combined";
45
+ CurrentImdlVersion[CurrentImdlVersion["Combined"] = 2359296] = "Combined";
46
46
  })(CurrentImdlVersion || (exports.CurrentImdlVersion = CurrentImdlVersion = {}));
47
47
  /** Header embedded at the beginning of binary tile data in iMdl format describing its contents.
48
48
  * @internal
@@ -87,6 +87,7 @@ class FeatureTableHeader {
87
87
  const count = stream.readUint32();
88
88
  return stream.isPastTheEnd ? undefined : new FeatureTableHeader(length, maxFeatures, count);
89
89
  }
90
+ static { this.sizeInBytes = 12; }
90
91
  constructor(length, numSubCategories, count) {
91
92
  this.length = length;
92
93
  this.numSubCategories = numSubCategories;
@@ -94,5 +95,4 @@ class FeatureTableHeader {
94
95
  }
95
96
  }
96
97
  exports.FeatureTableHeader = FeatureTableHeader;
97
- FeatureTableHeader.sizeInBytes = 12;
98
98
  //# sourceMappingURL=IModelTileIO.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"IModelTileIO.js","sourceRoot":"","sources":["../../../src/tile/IModelTileIO.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAyD;AACzD,wDAA+C;AAE/C,qCAA+E;AAE/E;;GAEG;AACH,IAAY,SAWX;AAXD,WAAY,SAAS;IACnB,uBAAuB;IACvB,yCAAQ,CAAA;IACR,6CAA6C;IAC7C,6DAAuB,CAAA;IACvB,wEAAwE;IACxE,qDAAmB,CAAA;IACnB,mEAAmE;IACnE,2EAA8B,CAAA;IAC9B,uEAAuE;IACvE,8EAA+B,CAAA;AACjC,CAAC,EAXW,SAAS,yBAAT,SAAS,QAWpB;AAED;;GAEG;AACH,IAAY,kBAYX;AAZD,WAAY,kBAAkB;IAC5B;;;OAGG;IACH,8DAAU,CAAA;IACV;;OAEG;IACH,6DAAS,CAAA;IACT,kGAAkG;IAClG,yEAAkC,CAAA;AACpC,CAAC,EAZW,kBAAkB,kCAAlB,kBAAkB,QAY7B;AAED;;GAEG;AACH,MAAa,UAAW,SAAQ,mBAAU;IAkBxC,IAAW,YAAY,KAAa,OAAO,IAAI,CAAC,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC;IACnE,IAAW,YAAY,KAAa,OAAO,CAAC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,KA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,MAAM,CAAC,YAAY;YACrB,IAAI,CAAC,UAAU,EAAE,CAAC;IACtB,CAAC;CACF;AApDD,gCAoDC;AAED;;GAEG;AACH,MAAa,kBAAkB;IAStB,MAAM,CAAC,QAAQ,CAAC,MAAkB;QACvC,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QACnC,MAAM,WAAW,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QACxC,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QAClC,OAAO,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,kBAAkB,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;IAC9F,CAAC;IAID,YAAoB,MAAc,EAAE,gBAAwB,EAAE,KAAa;QACzE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;;AAtBH,gDAuBC;AAPe,8BAAW,GAAG,EAAE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Tile\n */\n\nimport { assert, ByteStream } from \"@itwin/core-bentley\";\nimport { Range3d } from \"@itwin/core-geometry\";\nimport { ElementAlignedBox3d } from \"../geometry/Placement\";\nimport { nextPoint3d64FromByteStream, TileFormat, TileHeader } from \"./TileIO\";\n\n/** Flags describing the geometry contained within a tile in iMdl format.\n * @internal\n */\nexport enum ImdlFlags {\n /** No special flags */\n None = 0,\n /** The tile contains some curved geometry */\n ContainsCurves = 1 << 0,\n /** Some geometry within the tile range was omitted based on its size */\n Incomplete = 1 << 2,\n /** The tile must be refined by sub-division, not magnification. */\n DisallowMagnification = 1 << 3,\n /** The tile's feature table contains features from multiple models. */\n MultiModelFeatureTable = 1 << 4,\n}\n\n/** Describes the maximum major and minor version of the iMdl tile format supported by this version of this package.\n * @internal\n */\nexport enum CurrentImdlVersion {\n /** The unsigned 16-bit major version number. If the major version specified in the tile header is greater than this value, then this\n * front-end is not capable of reading the tile content. Otherwise, this front-end can read the tile content even if the header specifies a\n * greater minor version than CurrentVersion.Minor, although some data may be skipped.\n */\n Major = 35,\n /** The unsigned 16-bit minor version number. If the major version in the tile header is equal to CurrentVersion.Major, then this package can\n * read the tile content even if the minor version in the tile header is greater than this value, although some data may be skipped.\n */\n Minor = 0,\n /** The unsigned 32-bit version number derived from the 16-bit major and minor version numbers. */\n Combined = (Major << 0x10) | Minor,\n}\n\n/** Header embedded at the beginning of binary tile data in iMdl format describing its contents.\n * @internal\n */\nexport class ImdlHeader extends TileHeader {\n /** The size of this header in bytes. */\n public readonly headerLength: number;\n /** Flags describing the geometry contained within the tile */\n public readonly flags: ImdlFlags;\n /** A bounding box no larger than the tile's range, tightly enclosing the tile's geometry; or a null range if the tile is empty */\n public readonly contentRange: ElementAlignedBox3d;\n /** The chord tolerance in meters at which the tile's geometry was faceted */\n public readonly tolerance: number;\n /** The number of elements which contributed at least some geometry to the tile content */\n public readonly numElementsIncluded: number;\n /** The number of elements within the tile range which contributed no geometry to the tile content */\n public readonly numElementsExcluded: number;\n /** The total number of bytes in the binary tile data, including this header */\n public readonly tileLength: number;\n /** A bitfield wherein each set bit indicates an empty sub-volume. */\n public readonly emptySubRanges: number;\n\n public get versionMajor(): number { return this.version >>> 0x10; }\n public get versionMinor(): number { return (this.version & 0xffff) >>> 0; }\n\n public get isValid(): boolean { return TileFormat.IModel === this.format; }\n public get isReadableVersion(): boolean { return this.versionMajor <= CurrentImdlVersion.Major; }\n\n /** Deserialize a header from the binary data at the stream's current position.\n * If the binary data does not contain a valid header, the Header will be marked 'invalid'.\n */\n public constructor(stream: ByteStream) {\n super(stream);\n this.headerLength = stream.readUint32();\n this.flags = stream.readUint32();\n\n this.contentRange = new Range3d();\n nextPoint3d64FromByteStream(stream, this.contentRange.low);\n nextPoint3d64FromByteStream(stream, this.contentRange.high);\n\n this.tolerance = stream.readFloat64();\n this.numElementsIncluded = stream.readUint32();\n this.numElementsExcluded = stream.readUint32();\n this.tileLength = stream.readUint32();\n\n // empty sub-volume bit field introduced in format v02.00\n this.emptySubRanges = this.versionMajor >= 2 ? stream.readUint32() : 0;\n\n // Skip any unprocessed bytes in header\n const remainingHeaderBytes = this.headerLength - stream.curPos;\n assert(remainingHeaderBytes >= 0);\n stream.advance(remainingHeaderBytes);\n\n if (stream.isPastTheEnd)\n this.invalidate();\n }\n}\n\n/** Header preceding the feature table embedded in an iMdl tile's content.\n * @internal\n */\nexport class FeatureTableHeader {\n // The number of bytes the entire table occupies.\n public readonly length: number;\n // The number of subcategories in the table.\n // NOTE: This used to be \"max features\" which was useless and unused. It is only accurate if ImdlFlags.HasMultiModelFeatureTable is set.\n public readonly numSubCategories: number;\n // The number of features in the table.\n public readonly count: number;\n\n public static readFrom(stream: ByteStream) {\n const length = stream.readUint32();\n const maxFeatures = stream.readUint32();\n const count = stream.readUint32();\n return stream.isPastTheEnd ? undefined : new FeatureTableHeader(length, maxFeatures, count);\n }\n\n public static sizeInBytes = 12;\n\n private constructor(length: number, numSubCategories: number, count: number) {\n this.length = length;\n this.numSubCategories = numSubCategories;\n this.count = count;\n }\n}\n"]}
1
+ {"version":3,"file":"IModelTileIO.js","sourceRoot":"","sources":["../../../src/tile/IModelTileIO.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAyD;AACzD,wDAA+C;AAE/C,qCAA+E;AAE/E;;GAEG;AACH,IAAY,SAWX;AAXD,WAAY,SAAS;IACnB,uBAAuB;IACvB,yCAAQ,CAAA;IACR,6CAA6C;IAC7C,6DAAuB,CAAA;IACvB,wEAAwE;IACxE,qDAAmB,CAAA;IACnB,mEAAmE;IACnE,2EAA8B,CAAA;IAC9B,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CAAC,mBAAmB,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QAC/C,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QAEtC,yDAAyD;QACzD,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,YAAY,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAEvE,uCAAuC;QACvC,MAAM,oBAAoB,GAAG,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC;QAC/D,IAAA,qBAAM,EAAC,oBAAoB,IAAI,CAAC,CAAC,CAAC;QAClC,MAAM,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC;QAErC,IAAI,MAAM,CAAC,YAAY;YACrB,IAAI,CAAC,UAAU,EAAE,CAAC;IACtB,CAAC;CACF;AApDD,gCAoDC;AAED;;GAEG;AACH,MAAa,kBAAkB;IAStB,MAAM,CAAC,QAAQ,CAAC,MAAkB;QACvC,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QACnC,MAAM,WAAW,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QACxC,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QAClC,OAAO,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,kBAAkB,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;IAC9F,CAAC;aAEa,gBAAW,GAAG,EAAE,CAAC;IAE/B,YAAoB,MAAc,EAAE,gBAAwB,EAAE,KAAa;QACzE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;;AAtBH,gDAuBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Tile\n */\n\nimport { assert, ByteStream } from \"@itwin/core-bentley\";\nimport { Range3d } from \"@itwin/core-geometry\";\nimport { ElementAlignedBox3d } from \"../geometry/Placement\";\nimport { nextPoint3d64FromByteStream, TileFormat, TileHeader } from \"./TileIO\";\n\n/** Flags describing the geometry contained within a tile in iMdl format.\n * @internal\n */\nexport enum ImdlFlags {\n /** No special flags */\n None = 0,\n /** The tile contains some curved geometry */\n ContainsCurves = 1 << 0,\n /** Some geometry within the tile range was omitted based on its size */\n Incomplete = 1 << 2,\n /** The tile must be refined by sub-division, not magnification. */\n DisallowMagnification = 1 << 3,\n /** The tile's feature table contains features from multiple models. */\n MultiModelFeatureTable = 1 << 4,\n}\n\n/** Describes the maximum major and minor version of the iMdl tile format supported by this version of this package.\n * @internal\n */\nexport enum CurrentImdlVersion {\n /** The unsigned 16-bit major version number. If the major version specified in the tile header is greater than this value, then this\n * front-end is not capable of reading the tile content. Otherwise, this front-end can read the tile content even if the header specifies a\n * greater minor version than CurrentVersion.Minor, although some data may be skipped.\n */\n Major = 36,\n /** The unsigned 16-bit minor version number. If the major version in the tile header is equal to CurrentVersion.Major, then this package can\n * read the tile content even if the minor version in the tile header is greater than this value, although some data may be skipped.\n */\n Minor = 0,\n /** The unsigned 32-bit version number derived from the 16-bit major and minor version numbers. */\n Combined = (Major << 0x10) | Minor,\n}\n\n/** Header embedded at the beginning of binary tile data in iMdl format describing its contents.\n * @internal\n */\nexport class ImdlHeader extends TileHeader {\n /** The size of this header in bytes. */\n public readonly headerLength: number;\n /** Flags describing the geometry contained within the tile */\n public readonly flags: ImdlFlags;\n /** A bounding box no larger than the tile's range, tightly enclosing the tile's geometry; or a null range if the tile is empty */\n public readonly contentRange: ElementAlignedBox3d;\n /** The chord tolerance in meters at which the tile's geometry was faceted */\n public readonly tolerance: number;\n /** The number of elements which contributed at least some geometry to the tile content */\n public readonly numElementsIncluded: number;\n /** The number of elements within the tile range which contributed no geometry to the tile content */\n public readonly numElementsExcluded: number;\n /** The total number of bytes in the binary tile data, including this header */\n public readonly tileLength: number;\n /** A bitfield wherein each set bit indicates an empty sub-volume. */\n public readonly emptySubRanges: number;\n\n public get versionMajor(): number { return this.version >>> 0x10; }\n public get versionMinor(): number { return (this.version & 0xffff) >>> 0; }\n\n public get isValid(): boolean { return TileFormat.IModel === this.format; }\n public get isReadableVersion(): boolean { return this.versionMajor <= CurrentImdlVersion.Major; }\n\n /** Deserialize a header from the binary data at the stream's current position.\n * If the binary data does not contain a valid header, the Header will be marked 'invalid'.\n */\n public constructor(stream: ByteStream) {\n super(stream);\n this.headerLength = stream.readUint32();\n this.flags = stream.readUint32();\n\n this.contentRange = new Range3d();\n nextPoint3d64FromByteStream(stream, this.contentRange.low);\n nextPoint3d64FromByteStream(stream, this.contentRange.high);\n\n this.tolerance = stream.readFloat64();\n this.numElementsIncluded = stream.readUint32();\n this.numElementsExcluded = stream.readUint32();\n this.tileLength = stream.readUint32();\n\n // empty sub-volume bit field introduced in format v02.00\n this.emptySubRanges = this.versionMajor >= 2 ? stream.readUint32() : 0;\n\n // Skip any unprocessed bytes in header\n const remainingHeaderBytes = this.headerLength - stream.curPos;\n assert(remainingHeaderBytes >= 0);\n stream.advance(remainingHeaderBytes);\n\n if (stream.isPastTheEnd)\n this.invalidate();\n }\n}\n\n/** Header preceding the feature table embedded in an iMdl tile's content.\n * @internal\n */\nexport class FeatureTableHeader {\n // The number of bytes the entire table occupies.\n public readonly length: number;\n // The number of subcategories in the table.\n // NOTE: This used to be \"max features\" which was useless and unused. It is only accurate if ImdlFlags.HasMultiModelFeatureTable is set.\n public readonly numSubCategories: number;\n // The number of features in the table.\n public readonly count: number;\n\n public static readFrom(stream: ByteStream) {\n const length = stream.readUint32();\n const maxFeatures = stream.readUint32();\n const count = stream.readUint32();\n return stream.isPastTheEnd ? undefined : new FeatureTableHeader(length, maxFeatures, count);\n }\n\n public static sizeInBytes = 12;\n\n private constructor(length: number, numSubCategories: number, count: number) {\n this.length = length;\n this.numSubCategories = numSubCategories;\n this.count = count;\n }\n}\n"]}
@@ -13,6 +13,14 @@ export var AmbientOcclusion;
13
13
  (function (AmbientOcclusion) {
14
14
  /** Describes the properties with which ambient occlusion should be drawn. These properties correspond to a horizon-based ambient occlusion approach. */
15
15
  class Settings {
16
+ static { this._defaultBias = 0.25; }
17
+ static { this._defaultZLengthCap = 0.0025; }
18
+ static { this._defaultMaxDistance = 10000.0; }
19
+ static { this._defaultIntensity = 1.0; }
20
+ static { this._defaultTexelStepSize = 1; }
21
+ static { this._defaultBlurDelta = 1.0; }
22
+ static { this._defaultBlurSigma = 2.0; }
23
+ static { this._defaultBlurTexelStepSize = 1.0; }
16
24
  constructor(json) {
17
25
  if (undefined === json)
18
26
  json = {};
@@ -25,6 +33,7 @@ export var AmbientOcclusion;
25
33
  this.blurSigma = JsonUtils.asDouble(json.blurSigma, Settings._defaultBlurSigma);
26
34
  this.blurTexelStepSize = JsonUtils.asDouble(json.blurTexelStepSize, Settings._defaultBlurTexelStepSize);
27
35
  }
36
+ static { this.defaults = new Settings({}); }
28
37
  static fromJSON(json) { return undefined !== json ? new Settings(json) : this.defaults; }
29
38
  toJSON() {
30
39
  return {
@@ -39,15 +48,6 @@ export var AmbientOcclusion;
39
48
  };
40
49
  }
41
50
  }
42
- Settings._defaultBias = 0.25;
43
- Settings._defaultZLengthCap = 0.0025;
44
- Settings._defaultMaxDistance = 10000.0;
45
- Settings._defaultIntensity = 1.0;
46
- Settings._defaultTexelStepSize = 1;
47
- Settings._defaultBlurDelta = 1.0;
48
- Settings._defaultBlurSigma = 2.0;
49
- Settings._defaultBlurTexelStepSize = 1.0;
50
- Settings.defaults = new Settings({});
51
51
  AmbientOcclusion.Settings = Settings;
52
52
  })(AmbientOcclusion || (AmbientOcclusion = {}));
53
53
  //# sourceMappingURL=AmbientOcclusion.js.map
@@ -1 +1 @@
1
- {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AAC,SAAS;aACtH,CAAC;QACJ,CAAC;;IA/Cc,qBAAY,GAAW,IAAI,CAAC;IAC5B,2BAAkB,GAAW,MAAM,CAAC;IACpC,4BAAmB,GAAW,OAAO,CAAC;IACtC,0BAAiB,GAAW,GAAG,CAAC;IAChC,8BAAqB,GAAW,CAAC,CAAC;IAClC,0BAAiB,GAAW,GAAG,CAAC;IAChC,0BAAiB,GAAW,GAAG,CAAC;IAChC,kCAAyB,GAAW,GAAG,CAAC;IAyBzC,iBAAQ,GAAG,IAAI,QAAQ,CAAC,EAAE,CAAC,CAAC;IAjC/B,yBAAQ,WAiDpB,CAAA;AACH,CAAC,EAxEgB,gBAAgB,KAAhB,gBAAgB,QAwEhC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module DisplayStyles\n */\n\nimport { JsonUtils } from \"@itwin/core-bentley\";\n\n/** Namespace containing types controlling how ambient occlusion should be drawn.\n * @public\n */\nexport namespace AmbientOcclusion {\n /** Describes the properties with which ambient occlusion should be drawn. These properties correspond to a horizon-based ambient occlusion approach. */\n export interface Props {\n /** If defined, represents an angle in radians. If the dot product between the normal of the sample and the vector to the camera is less than this value, sampling stops in the current direction. This is used to remove shadows from near planar edges. If undefined, the bias defaults to 0.25. */\n readonly bias?: number;\n /** If defined, if the distance in linear depth from the current sample to first sample is greater than this value, sampling stops in the current direction. If undefined, the zLengthCap defaults to 0.0025. The full range of linear depth is 0 to 1. */\n readonly zLengthCap?: number;\n /** If defined, the maximum distance from the camera's near plane in meters at which ambient occlusion will be applied. If undefined, the maximum distance defaults to 10000. */\n readonly maxDistance?: number;\n /** If defined, raise the final ambient occlusion to the power of this value. Larger values make the ambient shadows darker. If undefined, the intensity defaults to 2.0. */\n readonly intensity?: number;\n /** If defined, indicates the texel distance to step toward the next texel sample in the current direction. For portions of geometry close to the near plane, this value will be what is used. As portions of geometry extend away from the near plane, this value will gradually reduce until it reaches a minimum value of 1.0 at the far plane. If undefined, texelStepSize defaults to 1.95. */\n readonly texelStepSize?: number;\n /** If defined, blurDelta is used to compute the weight of a Gaussian filter. The equation is exp((-0.5 * blurDelta * blurDelta) / (blurSigma * blurSigma)). If undefined, blurDelta defaults to 1.0. */\n readonly blurDelta?: number;\n /** If defined, blurSigma is used to compute the weight of a Gaussian filter. The equation is exp((-0.5 * blurDelta * blurDelta) / (blurSigma * blurSigma)). If undefined, blurSigma defaults to 2.0. */\n readonly blurSigma?: number;\n /* If defined, blurTexelStepSize indicates the distance to the next texel for blurring. If undefined, blurTexelStepSize defaults to 1.0. */\n readonly blurTexelStepSize?: number;\n }\n\n /** Describes the properties with which ambient occlusion should be drawn. These properties correspond to a horizon-based ambient occlusion approach. */\n export class Settings implements Props {\n private static _defaultBias: number = 0.25;\n private static _defaultZLengthCap: number = 0.0025;\n private static _defaultMaxDistance: number = 10000.0;\n private static _defaultIntensity: number = 1.0;\n private static _defaultTexelStepSize: number = 1;\n private static _defaultBlurDelta: number = 1.0;\n private static _defaultBlurSigma: number = 2.0;\n private static _defaultBlurTexelStepSize: number = 1.0;\n\n public readonly bias: number;\n public readonly zLengthCap: number;\n public readonly maxDistance: number;\n public readonly intensity: number;\n public readonly texelStepSize: number;\n public readonly blurDelta: number;\n public readonly blurSigma: number;\n public readonly blurTexelStepSize: number;\n\n private constructor(json?: Props) {\n if (undefined === json)\n json = {};\n\n this.bias = JsonUtils.asDouble(json.bias, Settings._defaultBias);\n this.zLengthCap = JsonUtils.asDouble(json.zLengthCap, Settings._defaultZLengthCap);\n this.maxDistance = JsonUtils.asDouble(json.maxDistance, Settings._defaultMaxDistance);\n this.intensity = JsonUtils.asDouble(json.intensity, Settings._defaultIntensity);\n this.texelStepSize = JsonUtils.asDouble(json.texelStepSize, Settings._defaultTexelStepSize);\n this.blurDelta = JsonUtils.asDouble(json.blurDelta, Settings._defaultBlurDelta);\n this.blurSigma = JsonUtils.asDouble(json.blurSigma, Settings._defaultBlurSigma);\n this.blurTexelStepSize = JsonUtils.asDouble(json.blurTexelStepSize, Settings._defaultBlurTexelStepSize);\n }\n\n public static defaults = new Settings({});\n\n public static fromJSON(json?: Props): Settings { return undefined !== json ? new Settings(json) : this.defaults; }\n\n public toJSON(): Props {\n return {\n bias: this.bias !== Settings._defaultBias ? this.bias : undefined,\n zLengthCap: this.zLengthCap !== Settings._defaultZLengthCap ? this.zLengthCap : undefined,\n maxDistance: this.maxDistance !== Settings._defaultMaxDistance ? this.maxDistance : undefined,\n intensity: this.intensity !== Settings._defaultIntensity ? this.intensity : undefined,\n texelStepSize: this.texelStepSize !== Settings._defaultTexelStepSize ? this.texelStepSize : undefined,\n blurDelta: this.blurDelta !== Settings._defaultBlurDelta ? this.blurDelta : undefined,\n blurSigma: this.blurSigma !== Settings._defaultBlurSigma ? this.blurSigma : undefined,\n blurTexelStepSize: this.blurTexelStepSize !== Settings._defaultBlurTexelStepSize ? this.blurTexelStepSize : undefined,\n };\n }\n }\n}\n"]}
1
+ {"version":3,"file":"AmbientOcclusion.js","sourceRoot":"","sources":["../../src/AmbientOcclusion.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD;;GAEG;AACH,MAAM,KAAW,gBAAgB,CAwEhC;AAxED,WAAiB,gBAAgB;IAqB/B,wJAAwJ;IACxJ,MAAa,QAAQ;iBACJ,iBAAY,GAAW,IAAI,CAAC;iBAC5B,uBAAkB,GAAW,MAAM,CAAC;iBACpC,wBAAmB,GAAW,OAAO,CAAC;iBACtC,sBAAiB,GAAW,GAAG,CAAC;iBAChC,0BAAqB,GAAW,CAAC,CAAC;iBAClC,sBAAiB,GAAW,GAAG,CAAC;iBAChC,sBAAiB,GAAW,GAAG,CAAC;iBAChC,8BAAyB,GAAW,GAAG,CAAC;QAWvD,YAAoB,IAAY;YA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OAAO;gBACL,IAAI,EAAE,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;gBACjE,UAAU,EAAE,IAAI,CAAC,UAAU,KAAK,QAAQ,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS;gBACzF,WAAW,EAAE,IAAI,CAAC,WAAW,KAAK,QAAQ,CAAC,mBAAmB,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS;gBAC7F,SAAS,EAAE,IAAI,CAAC,SAAS,KAAK,QAAQ,CAAC,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;gBACrF,aAAa,EAAE,IAAI,CAAC,aAAa,KAAK,QAAQ,CAAC,qBAAqB,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS;gBACrG,SAAS,EAAE,IAAI,CAAC,SAAS,KAAK,QAAQ,CAAC,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;gBACrF,SAAS,EAAE,IAAI,CAAC,SAAS,KAAK,QAAQ,CAAC,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;gBACrF,iBAAiB,EAAE,IAAI,CAAC,iBAAiB,KAAK,QAAQ,CAAC,yBAAyB,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,SAAS;aACtH,CAAC;QACJ,CAAC;;IAhDU,yBAAQ,WAiDpB,CAAA;AACH,CAAC,EAxEgB,gBAAgB,KAAhB,gBAAgB,QAwEhC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module DisplayStyles\n */\n\nimport { JsonUtils } from \"@itwin/core-bentley\";\n\n/** Namespace containing types controlling how ambient occlusion should be drawn.\n * @public\n */\nexport namespace AmbientOcclusion {\n /** Describes the properties with which ambient occlusion should be drawn. These properties correspond to a horizon-based ambient occlusion approach. */\n export interface Props {\n /** If defined, represents an angle in radians. If the dot product between the normal of the sample and the vector to the camera is less than this value, sampling stops in the current direction. This is used to remove shadows from near planar edges. If undefined, the bias defaults to 0.25. */\n readonly bias?: number;\n /** If defined, if the distance in linear depth from the current sample to first sample is greater than this value, sampling stops in the current direction. If undefined, the zLengthCap defaults to 0.0025. The full range of linear depth is 0 to 1. */\n readonly zLengthCap?: number;\n /** If defined, the maximum distance from the camera's near plane in meters at which ambient occlusion will be applied. If undefined, the maximum distance defaults to 10000. */\n readonly maxDistance?: number;\n /** If defined, raise the final ambient occlusion to the power of this value. Larger values make the ambient shadows darker. If undefined, the intensity defaults to 2.0. */\n readonly intensity?: number;\n /** If defined, indicates the texel distance to step toward the next texel sample in the current direction. For portions of geometry close to the near plane, this value will be what is used. As portions of geometry extend away from the near plane, this value will gradually reduce until it reaches a minimum value of 1.0 at the far plane. If undefined, texelStepSize defaults to 1.95. */\n readonly texelStepSize?: number;\n /** If defined, blurDelta is used to compute the weight of a Gaussian filter. The equation is exp((-0.5 * blurDelta * blurDelta) / (blurSigma * blurSigma)). If undefined, blurDelta defaults to 1.0. */\n readonly blurDelta?: number;\n /** If defined, blurSigma is used to compute the weight of a Gaussian filter. The equation is exp((-0.5 * blurDelta * blurDelta) / (blurSigma * blurSigma)). If undefined, blurSigma defaults to 2.0. */\n readonly blurSigma?: number;\n /* If defined, blurTexelStepSize indicates the distance to the next texel for blurring. If undefined, blurTexelStepSize defaults to 1.0. */\n readonly blurTexelStepSize?: number;\n }\n\n /** Describes the properties with which ambient occlusion should be drawn. These properties correspond to a horizon-based ambient occlusion approach. */\n export class Settings implements Props {\n private static _defaultBias: number = 0.25;\n private static _defaultZLengthCap: number = 0.0025;\n private static _defaultMaxDistance: number = 10000.0;\n private static _defaultIntensity: number = 1.0;\n private static _defaultTexelStepSize: number = 1;\n private static _defaultBlurDelta: number = 1.0;\n private static _defaultBlurSigma: number = 2.0;\n private static _defaultBlurTexelStepSize: number = 1.0;\n\n public readonly bias: number;\n public readonly zLengthCap: number;\n public readonly maxDistance: number;\n public readonly intensity: number;\n public readonly texelStepSize: number;\n public readonly blurDelta: number;\n public readonly blurSigma: number;\n public readonly blurTexelStepSize: number;\n\n private constructor(json?: Props) {\n if (undefined === json)\n json = {};\n\n this.bias = JsonUtils.asDouble(json.bias, Settings._defaultBias);\n this.zLengthCap = JsonUtils.asDouble(json.zLengthCap, Settings._defaultZLengthCap);\n this.maxDistance = JsonUtils.asDouble(json.maxDistance, Settings._defaultMaxDistance);\n this.intensity = JsonUtils.asDouble(json.intensity, Settings._defaultIntensity);\n this.texelStepSize = JsonUtils.asDouble(json.texelStepSize, Settings._defaultTexelStepSize);\n this.blurDelta = JsonUtils.asDouble(json.blurDelta, Settings._defaultBlurDelta);\n this.blurSigma = JsonUtils.asDouble(json.blurSigma, Settings._defaultBlurSigma);\n this.blurTexelStepSize = JsonUtils.asDouble(json.blurTexelStepSize, Settings._defaultBlurTexelStepSize);\n }\n\n public static defaults = new Settings({});\n\n public static fromJSON(json?: Props): Settings { return undefined !== json ? new Settings(json) : this.defaults; }\n\n public toJSON(): Props {\n return {\n bias: this.bias !== Settings._defaultBias ? this.bias : undefined,\n zLengthCap: this.zLengthCap !== Settings._defaultZLengthCap ? this.zLengthCap : undefined,\n maxDistance: this.maxDistance !== Settings._defaultMaxDistance ? this.maxDistance : undefined,\n intensity: this.intensity !== Settings._defaultIntensity ? this.intensity : undefined,\n texelStepSize: this.texelStepSize !== Settings._defaultTexelStepSize ? this.texelStepSize : undefined,\n blurDelta: this.blurDelta !== Settings._defaultBlurDelta ? this.blurDelta : undefined,\n blurSigma: this.blurSigma !== Settings._defaultBlurSigma ? this.blurSigma : undefined,\n blurTexelStepSize: this.blurTexelStepSize !== Settings._defaultBlurTexelStepSize ? this.blurTexelStepSize : undefined,\n };\n }\n }\n}\n"]}
@@ -155,6 +155,6 @@ export class AnalysisStyle {
155
155
  return false;
156
156
  return undefined === this.thematic || this.thematic.equals(other.thematic);
157
157
  }
158
+ static { this.defaults = new AnalysisStyle({}); }
158
159
  }
159
- AnalysisStyle.defaults = new AnalysisStyle({});
160
160
  //# sourceMappingURL=AnalysisStyle.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AnalysisStyle.js","sourceRoot":"","sources":["../../src/AnalysisStyle.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAgB,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,wBAAwB,EAAiC,MAAM,mBAAmB,CAAC;AAC5F,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAgBtC;;;GAGG;AACH,MAAM,OAAO,yBAAyB;IAQpC,gBAAgB;IAChB,YAAoB,WAAmB,EAAE,KAAK,GAAG,CAAC;QAChD,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,uCAAuC;IAChC,MAAM,CAAC,QAAQ,CAAC,KAAqC;QAC1D,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IAClD,CAAC;IAED,sCAAsC;IAC/B,MAAM;QACX,MAAM,KAAK,GAAmC,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC;QAChF,IAAI,IAAI,CAAC,KAAK,KAAK,CAAC;YAClB,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QAE3B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,sDAAsD;IAC/C,MAAM,CAAC,KAAgC;QAC5C,OAAO,IAAI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,CAAC;QAEf,IAAI,CAAC,SAAS,KAAK,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,SAAS,KAAK,KAAK,CAAC,YAAY,CAAC;YAC1E,OAAO,KAAK,CAAC;aACV,IAAI,IAAI,CAAC,YAAY,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,YAAa,CAAC;YAC1E,OAAO,KAAK,CAAC;QAEf,IAAI,CAAC,SAAS,KAAK,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,KAAK,KAAK,CAAC,QAAQ,CAAC;YAClE,OAAO,KAAK,CAAC;QAEf,OAAO,SAAS,KAAK,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,QAAS,CAAC,CAAC;IAC9E,CAAC;;AAEsB,sBAAQ,GAAG,IAAI,aAAa,CAAC,EAAE,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module DisplayStyles\n */\n\nimport { Range1d, Range1dProps } from \"@itwin/core-geometry\";\nimport { ThematicGradientSettings, ThematicGradientSettingsProps } from \"./ThematicDisplay\";\nimport { Gradient } from \"./Gradient\";\n\n/** JSON representation of an [[AnalysisStyleDisplacement]].\n * @see [[AnalysisStyleProps.displacement]].\n * @public\n * @extensions\n */\nexport interface AnalysisStyleDisplacementProps {\n /** See [[AnalysisStyleDisplacement.channelName]]. */\n channelName: string;\n /** See [[AnalysisStyleDisplacement.scale]].\n * Default value: 1.\n */\n scale?: number;\n}\n\n/** Describes how an [[AnalysisStyle]] deforms a [Polyface]($core-geometry) by applying translation to its vertices.\n * @see [[AnalysisStyle.displacement]].\n * @public\n */\nexport class AnalysisStyleDisplacement {\n /** The name of the [AuxChannel]($core-geometry) supplying the displacements to be applied to the vertices. */\n public readonly channelName: string;\n /** A scale applied to the displacements to adjust the magnitude of the effect.\n * Default value: 1.\n */\n public readonly scale: number;\n\n /** @internal */\n private constructor(channelName: string, scale = 1) {\n this.channelName = channelName;\n this.scale = scale;\n }\n\n /** Create from JSON representation. */\n public static fromJSON(props: AnalysisStyleDisplacementProps): AnalysisStyleDisplacement {\n return new this(props.channelName, props.scale);\n }\n\n /** Convert to JSON representation. */\n public toJSON(): AnalysisStyleDisplacementProps {\n const props: AnalysisStyleDisplacementProps = { channelName: this.channelName };\n if (this.scale !== 1)\n props.scale = this.scale;\n\n return props;\n }\n\n /** Return true if `this` is equivalent to `other`. */\n public equals(other: AnalysisStyleDisplacement): boolean {\n return this.channelName === other.channelName && this.scale === other.scale;\n }\n}\n\n/** JSON representation of an [[AnalysisStyleThematic]].\n * @see [[AnalysisStyleProps.scalar]].\n * @public\n * @extensions\n */\nexport interface AnalysisStyleThematicProps {\n /** See [[AnalysisStyleThematic.channelName]]. */\n channelName: string;\n /** See [[AnalysisStyleThematic.range]]. */\n range: Range1dProps;\n /** See [[AnalysisStyleThematic.thematicSettings]].\n * Default value: [[ThematicGradientSettings.defaults]].\n */\n thematicSettings?: ThematicGradientSettingsProps;\n}\n\n/** Describes how an [[AnalysisStyle]] recolors [Polyface]($core-geometry) vertices by mapping values of type\n * [AuxChannelDataType.Scalar]($core-geometry) or [AuxChannelDataType.Distance]($core-geometry) supplied\n * by an [AuxChannel]($core-geometry) to colors supplied by a [[Gradient]] image.\n * @see [[AnalysisStyle.thematic]].\n * @public\n */\nexport class AnalysisStyleThematic {\n /** The name of the [AuxChannel]($core-geometry) supplying the values from which the vertex colors are computed. */\n public readonly channelName: string;\n /** The minimum and maximum values that map to colors in the [[Gradient]] image. Vertices with values outside of\n * this range are displayed with the gradient's margin color.\n */\n public readonly range: Readonly<Range1d>;\n /** Settings used to produce the [[Gradient]] image. */\n public readonly thematicSettings: ThematicGradientSettings;\n private _gradient?: Gradient.Symb;\n\n /** @internal */\n private constructor(props: AnalysisStyleThematicProps) {\n this.channelName = props.channelName;\n this.range = Range1d.fromJSON(props.range);\n this.thematicSettings = ThematicGradientSettings.fromJSON(props.thematicSettings);\n }\n\n /** Create from JSON representation. */\n public static fromJSON(props: AnalysisStyleThematicProps): AnalysisStyleThematic {\n return new this(props);\n }\n\n /** Convert to JSON representation. */\n public toJSON(): AnalysisStyleThematicProps {\n const props: AnalysisStyleThematicProps = {\n channelName: this.channelName,\n range: this.range.toJSON(),\n };\n\n if (!this.thematicSettings.equals(ThematicGradientSettings.defaults))\n props.thematicSettings = this.thematicSettings.toJSON();\n\n return props;\n }\n\n /** The gradient computed from [[thematicSettings]]. */\n public get gradient(): Gradient.Symb {\n if (!this._gradient)\n this._gradient = Gradient.Symb.createThematic(this.thematicSettings);\n\n return this._gradient;\n }\n\n /** Return true if `this` is equivalent to `other`. */\n public equals(other: AnalysisStyleThematic): boolean {\n return this.channelName === other.channelName && this.range.isAlmostEqual(other.range) && this.thematicSettings.equals(other.thematicSettings);\n }\n}\n\n/** JSON representation of an [[AnalysisStyle]].\n * @public\n * @extensions\n */\nexport interface AnalysisStyleProps {\n /** See [[AnalysisStyle.displacement]]. */\n displacement?: AnalysisStyleDisplacementProps;\n /** JSON representation of [[AnalysisStyle.thematic]].\n * @note The name \"scalar\" is used instead of \"thematic\" for backwards compatibility.\n */\n scalar?: AnalysisStyleThematicProps;\n /** See [[AnalysisStyle.normalChannelName]]. */\n normalChannelName?: string;\n}\n\n/** At time of writing, the only iModel in existence that uses AnalysisStyle is the one created by the analysis-importer test app.\n * To avoid breaking existing saved views of that iModel, AnalysisStyle.fromJSON() continues to accept the old JSON representation -\n * but that representation is not part of the public API.\n * @internal exported strictly for tests.\n */\nexport interface LegacyAnalysisStyleProps {\n displacementChannelName?: string;\n scalarChannelName?: string;\n normalChannelName?: string;\n displacementScale?: number;\n scalarRange?: Range1dProps;\n scalarThematicSettings?: ThematicGradientSettingsProps;\n}\n\nfunction tryConvertLegacyProps(input: AnalysisStyleProps): AnalysisStyleProps {\n if (input.displacement || input.scalar)\n return input;\n\n const legacy = input as LegacyAnalysisStyleProps;\n if (undefined === legacy.displacementChannelName && undefined === legacy.scalarChannelName)\n return input;\n\n const output: AnalysisStyleProps = {\n normalChannelName: input.normalChannelName,\n };\n\n if (undefined !== legacy.displacementChannelName) {\n output.displacement = {\n channelName: legacy.displacementChannelName,\n scale: legacy.displacementScale,\n };\n }\n\n if (undefined !== legacy.scalarChannelName && undefined !== legacy.scalarRange) {\n output.scalar = {\n channelName: legacy.scalarChannelName,\n range: legacy.scalarRange,\n thematicSettings: legacy.scalarThematicSettings,\n };\n }\n\n return output;\n}\n\n/** As part of a [[DisplayStyleSettings]], describes how to animate meshes in the view that have been augmented with\n * [PolyfaceAuxData]($core-geometry). The style specifies which channels to use, and can deform the meshes by\n * translating vertices and/or recolor vertices using [[ThematicDisplay]].\n * @see [[DisplayStyleSettings.analysisStyle]] to define the analysis style for a [DisplayStyle]($backend).\n * @see [[DisplayStyleSettings.analysisFraction]] to control playback of the animation.\n * @public\n */\nexport class AnalysisStyle {\n public readonly displacement?: AnalysisStyleDisplacement;\n public readonly thematic?: AnalysisStyleThematic;\n /** If defined, the name of the [AuxChannel]($core-geometry) from which to obtain normal vectors for the vertices. */\n public readonly normalChannelName?: string;\n\n /** Create an analysis style from its JSON representation.\n * @note AnalysisStyle is an immutable type - use [[clone]] to produce a modified copy.\n */\n public static fromJSON(props?: AnalysisStyleProps): AnalysisStyle {\n if (!props)\n return this.defaults;\n\n props = tryConvertLegacyProps(props);\n if (!props.displacement && !props.scalar && undefined === props.normalChannelName)\n return this.defaults;\n\n return new AnalysisStyle(props);\n }\n\n /** @internal */\n private constructor(props: AnalysisStyleProps) {\n this.normalChannelName = props.normalChannelName;\n if (props.displacement)\n this.displacement = AnalysisStyleDisplacement.fromJSON(props.displacement);\n\n if (props.scalar)\n this.thematic = AnalysisStyleThematic.fromJSON(props.scalar);\n }\n\n /** Convert this style to its JSON representation. */\n public toJSON(): AnalysisStyleProps {\n const props: AnalysisStyleProps = {};\n if (this === AnalysisStyle.defaults)\n return props;\n\n if (this.displacement)\n props.displacement = this.displacement.toJSON();\n\n if (this.thematic)\n props.scalar = this.thematic.toJSON();\n\n if (undefined !== this.normalChannelName)\n props.normalChannelName = this.normalChannelName;\n\n return props;\n }\n\n /** Produce a copy of this style identical except for properties explicitly specified by `changedProps`. */\n public clone(changedProps: AnalysisStyleProps): AnalysisStyle {\n return AnalysisStyle.fromJSON({\n ...this.toJSON(),\n ...changedProps,\n });\n }\n\n /** Return true if this style is equivalent to `other`. */\n public equals(other: AnalysisStyle): boolean {\n if (this.normalChannelName !== other.normalChannelName)\n return false;\n\n if ((undefined === this.displacement) !== (undefined === other.displacement))\n return false;\n else if (this.displacement && !this.displacement.equals(other.displacement!))\n return false;\n\n if ((undefined === this.thematic) !== (undefined === other.thematic))\n return false;\n\n return undefined === this.thematic || this.thematic.equals(other.thematic!);\n }\n\n public static readonly defaults = new AnalysisStyle({});\n}\n"]}
1
+ {"version":3,"file":"AnalysisStyle.js","sourceRoot":"","sources":["../../src/AnalysisStyle.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAgB,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,wBAAwB,EAAiC,MAAM,mBAAmB,CAAC;AAC5F,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAgBtC;;;GAGG;AACH,MAAM,OAAO,yBAAyB;IAQpC,gBAAgB;IAChB,YAAoB,WAAmB,EAAE,KAAK,GAAG,CAAC;QAChD,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,uCAAuC;IAChC,MAAM,CAAC,QAAQ,CAAC,KAAqC;QAC1D,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IA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KAAK,CAAC;IACf,CAAC;IAED,2GAA2G;IACpG,KAAK,CAAC,YAAgC;QAC3C,OAAO,aAAa,CAAC,QAAQ,CAAC;YAC5B,GAAG,IAAI,CAAC,MAAM,EAAE;YAChB,GAAG,YAAY;SAChB,CAAC,CAAC;IACL,CAAC;IAED,0DAA0D;IACnD,MAAM,CAAC,KAAoB;QAChC,IAAI,IAAI,CAAC,iBAAiB,KAAK,KAAK,CAAC,iBAAiB;YACpD,OAAO,KAAK,CAAC;QAEf,IAAI,CAAC,SAAS,KAAK,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,SAAS,KAAK,KAAK,CAAC,YAAY,CAAC;YAC1E,OAAO,KAAK,CAAC;aACV,IAAI,IAAI,CAAC,YAAY,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,YAAa,CAAC;YAC1E,OAAO,KAAK,CAAC;QAEf,IAAI,CAAC,SAAS,KAAK,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,KAAK,KAAK,CAAC,QAAQ,CAAC;YAClE,OAAO,KAAK,CAAC;QAEf,OAAO,SAAS,KAAK,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,QAAS,CAAC,CAAC;IAC9E,CAAC;aAEsB,aAAQ,GAAG,IAAI,aAAa,CAAC,EAAE,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module DisplayStyles\n */\n\nimport { Range1d, Range1dProps } from \"@itwin/core-geometry\";\nimport { ThematicGradientSettings, ThematicGradientSettingsProps } from \"./ThematicDisplay\";\nimport { Gradient } from \"./Gradient\";\n\n/** JSON representation of an [[AnalysisStyleDisplacement]].\n * @see [[AnalysisStyleProps.displacement]].\n * @public\n * @extensions\n */\nexport interface AnalysisStyleDisplacementProps {\n /** See [[AnalysisStyleDisplacement.channelName]]. */\n channelName: string;\n /** See [[AnalysisStyleDisplacement.scale]].\n * Default value: 1.\n */\n scale?: number;\n}\n\n/** Describes how an [[AnalysisStyle]] deforms a [Polyface]($core-geometry) by applying translation to its vertices.\n * @see [[AnalysisStyle.displacement]].\n * @public\n */\nexport class AnalysisStyleDisplacement {\n /** The name of the [AuxChannel]($core-geometry) supplying the displacements to be applied to the vertices. */\n public readonly channelName: string;\n /** A scale applied to the displacements to adjust the magnitude of the effect.\n * Default value: 1.\n */\n public readonly scale: number;\n\n /** @internal */\n private constructor(channelName: string, scale = 1) {\n this.channelName = channelName;\n this.scale = scale;\n }\n\n /** Create from JSON representation. */\n public static fromJSON(props: AnalysisStyleDisplacementProps): AnalysisStyleDisplacement {\n return new this(props.channelName, props.scale);\n }\n\n /** Convert to JSON representation. */\n public toJSON(): AnalysisStyleDisplacementProps {\n const props: AnalysisStyleDisplacementProps = { channelName: this.channelName };\n if (this.scale !== 1)\n props.scale = this.scale;\n\n return props;\n }\n\n /** Return true if `this` is equivalent to `other`. */\n public equals(other: AnalysisStyleDisplacement): boolean {\n return this.channelName === other.channelName && this.scale === other.scale;\n }\n}\n\n/** JSON representation of an [[AnalysisStyleThematic]].\n * @see [[AnalysisStyleProps.scalar]].\n * @public\n * @extensions\n */\nexport interface AnalysisStyleThematicProps {\n /** See [[AnalysisStyleThematic.channelName]]. */\n channelName: string;\n /** See [[AnalysisStyleThematic.range]]. */\n range: Range1dProps;\n /** See [[AnalysisStyleThematic.thematicSettings]].\n * Default value: [[ThematicGradientSettings.defaults]].\n */\n thematicSettings?: ThematicGradientSettingsProps;\n}\n\n/** Describes how an [[AnalysisStyle]] recolors [Polyface]($core-geometry) vertices by mapping values of type\n * [AuxChannelDataType.Scalar]($core-geometry) or [AuxChannelDataType.Distance]($core-geometry) supplied\n * by an [AuxChannel]($core-geometry) to colors supplied by a [[Gradient]] image.\n * @see [[AnalysisStyle.thematic]].\n * @public\n */\nexport class AnalysisStyleThematic {\n /** The name of the [AuxChannel]($core-geometry) supplying the values from which the vertex colors are computed. */\n public readonly channelName: string;\n /** The minimum and maximum values that map to colors in the [[Gradient]] image. Vertices with values outside of\n * this range are displayed with the gradient's margin color.\n */\n public readonly range: Readonly<Range1d>;\n /** Settings used to produce the [[Gradient]] image. */\n public readonly thematicSettings: ThematicGradientSettings;\n private _gradient?: Gradient.Symb;\n\n /** @internal */\n private constructor(props: AnalysisStyleThematicProps) {\n this.channelName = props.channelName;\n this.range = Range1d.fromJSON(props.range);\n this.thematicSettings = ThematicGradientSettings.fromJSON(props.thematicSettings);\n }\n\n /** Create from JSON representation. */\n public static fromJSON(props: AnalysisStyleThematicProps): AnalysisStyleThematic {\n return new this(props);\n }\n\n /** Convert to JSON representation. */\n public toJSON(): AnalysisStyleThematicProps {\n const props: AnalysisStyleThematicProps = {\n channelName: this.channelName,\n range: this.range.toJSON(),\n };\n\n if (!this.thematicSettings.equals(ThematicGradientSettings.defaults))\n props.thematicSettings = this.thematicSettings.toJSON();\n\n return props;\n }\n\n /** The gradient computed from [[thematicSettings]]. */\n public get gradient(): Gradient.Symb {\n if (!this._gradient)\n this._gradient = Gradient.Symb.createThematic(this.thematicSettings);\n\n return this._gradient;\n }\n\n /** Return true if `this` is equivalent to `other`. */\n public equals(other: AnalysisStyleThematic): boolean {\n return this.channelName === other.channelName && this.range.isAlmostEqual(other.range) && this.thematicSettings.equals(other.thematicSettings);\n }\n}\n\n/** JSON representation of an [[AnalysisStyle]].\n * @public\n * @extensions\n */\nexport interface AnalysisStyleProps {\n /** See [[AnalysisStyle.displacement]]. */\n displacement?: AnalysisStyleDisplacementProps;\n /** JSON representation of [[AnalysisStyle.thematic]].\n * @note The name \"scalar\" is used instead of \"thematic\" for backwards compatibility.\n */\n scalar?: AnalysisStyleThematicProps;\n /** See [[AnalysisStyle.normalChannelName]]. */\n normalChannelName?: string;\n}\n\n/** At time of writing, the only iModel in existence that uses AnalysisStyle is the one created by the analysis-importer test app.\n * To avoid breaking existing saved views of that iModel, AnalysisStyle.fromJSON() continues to accept the old JSON representation -\n * but that representation is not part of the public API.\n * @internal exported strictly for tests.\n */\nexport interface LegacyAnalysisStyleProps {\n displacementChannelName?: string;\n scalarChannelName?: string;\n normalChannelName?: string;\n displacementScale?: number;\n scalarRange?: Range1dProps;\n scalarThematicSettings?: ThematicGradientSettingsProps;\n}\n\nfunction tryConvertLegacyProps(input: AnalysisStyleProps): AnalysisStyleProps {\n if (input.displacement || input.scalar)\n return input;\n\n const legacy = input as LegacyAnalysisStyleProps;\n if (undefined === legacy.displacementChannelName && undefined === legacy.scalarChannelName)\n return input;\n\n const output: AnalysisStyleProps = {\n normalChannelName: input.normalChannelName,\n };\n\n if (undefined !== legacy.displacementChannelName) {\n output.displacement = {\n channelName: legacy.displacementChannelName,\n scale: legacy.displacementScale,\n };\n }\n\n if (undefined !== legacy.scalarChannelName && undefined !== legacy.scalarRange) {\n output.scalar = {\n channelName: legacy.scalarChannelName,\n range: legacy.scalarRange,\n thematicSettings: legacy.scalarThematicSettings,\n };\n }\n\n return output;\n}\n\n/** As part of a [[DisplayStyleSettings]], describes how to animate meshes in the view that have been augmented with\n * [PolyfaceAuxData]($core-geometry). The style specifies which channels to use, and can deform the meshes by\n * translating vertices and/or recolor vertices using [[ThematicDisplay]].\n * @see [[DisplayStyleSettings.analysisStyle]] to define the analysis style for a [DisplayStyle]($backend).\n * @see [[DisplayStyleSettings.analysisFraction]] to control playback of the animation.\n * @public\n */\nexport class AnalysisStyle {\n public readonly displacement?: AnalysisStyleDisplacement;\n public readonly thematic?: AnalysisStyleThematic;\n /** If defined, the name of the [AuxChannel]($core-geometry) from which to obtain normal vectors for the vertices. */\n public readonly normalChannelName?: string;\n\n /** Create an analysis style from its JSON representation.\n * @note AnalysisStyle is an immutable type - use [[clone]] to produce a modified copy.\n */\n public static fromJSON(props?: AnalysisStyleProps): AnalysisStyle {\n if (!props)\n return this.defaults;\n\n props = tryConvertLegacyProps(props);\n if (!props.displacement && !props.scalar && undefined === props.normalChannelName)\n return this.defaults;\n\n return new AnalysisStyle(props);\n }\n\n /** @internal */\n private constructor(props: AnalysisStyleProps) {\n this.normalChannelName = props.normalChannelName;\n if (props.displacement)\n this.displacement = AnalysisStyleDisplacement.fromJSON(props.displacement);\n\n if (props.scalar)\n this.thematic = AnalysisStyleThematic.fromJSON(props.scalar);\n }\n\n /** Convert this style to its JSON representation. */\n public toJSON(): AnalysisStyleProps {\n const props: AnalysisStyleProps = {};\n if (this === AnalysisStyle.defaults)\n return props;\n\n if (this.displacement)\n props.displacement = this.displacement.toJSON();\n\n if (this.thematic)\n props.scalar = this.thematic.toJSON();\n\n if (undefined !== this.normalChannelName)\n props.normalChannelName = this.normalChannelName;\n\n return props;\n }\n\n /** Produce a copy of this style identical except for properties explicitly specified by `changedProps`. */\n public clone(changedProps: AnalysisStyleProps): AnalysisStyle {\n return AnalysisStyle.fromJSON({\n ...this.toJSON(),\n ...changedProps,\n });\n }\n\n /** Return true if this style is equivalent to `other`. */\n public equals(other: AnalysisStyle): boolean {\n if (this.normalChannelName !== other.normalChannelName)\n return false;\n\n if ((undefined === this.displacement) !== (undefined === other.displacement))\n return false;\n else if (this.displacement && !this.displacement.equals(other.displacement!))\n return false;\n\n if ((undefined === this.thematic) !== (undefined === other.thematic))\n return false;\n\n return undefined === this.thematic || this.thematic.equals(other.thematic!);\n }\n\n public static readonly defaults = new AnalysisStyle({});\n}\n"]}
@@ -28,7 +28,6 @@ import { JsonUtils } from "@itwin/core-bentley";
28
28
  */
29
29
  export var Atmosphere;
30
30
  (function (Atmosphere) {
31
- var _a;
32
31
  /** @internal An immutable container of wavelength values for the red, green and blue pixel components. Values are in nanometers. */
33
32
  class Wavelengths {
34
33
  /** Constructs from red, green, and blue wavelength values.
@@ -65,6 +64,16 @@ export var Atmosphere;
65
64
  Atmosphere.Wavelengths = Wavelengths;
66
65
  /** Describes the properties with which the atmospheric scattering effect should be drawn. Theses properties correspond to a physics-based approximation of atmospheric scattering phenomenons. */
67
66
  class Settings {
67
+ static { this._defaultAtmosphereHeightAboveEarth = 100000.0; }
68
+ static { this._defaultExposure = 2.0; }
69
+ static { this._defaultDensityFalloff = 10.0; }
70
+ static { this._defaultScatteringStrength = 100; }
71
+ static { this._defaultWavelengths = new Wavelengths({ r: 700.0, g: 530.0, b: 440.0 }); }
72
+ static { this._defaultNumViewRaySamples = 10; }
73
+ static { this._highQualityNumViewRaySamples = 20; }
74
+ static { this._defaultNumSunRaySamples = 5; }
75
+ static { this.defaults = new Settings({}); }
76
+ static { this.highQuality = new Settings({ numViewRaySamples: this._highQualityNumViewRaySamples }); }
68
77
  equals(other) {
69
78
  if (this.atmosphereHeightAboveEarth !== other.atmosphereHeightAboveEarth)
70
79
  return false;
@@ -85,19 +94,19 @@ export var Atmosphere;
85
94
  return true;
86
95
  }
87
96
  constructor(json) {
88
- this.atmosphereHeightAboveEarth = JsonUtils.asDouble(json.atmosphereHeightAboveEarth, _a._defaultAtmosphereHeightAboveEarth);
89
- this.exposure = JsonUtils.asDouble(json.exposure, _a._defaultExposure);
90
- this.densityFalloff = JsonUtils.asDouble(json.densityFalloff, _a._defaultDensityFalloff);
91
- this.depthBelowEarthForMaxDensity = JsonUtils.asDouble(json.depthBelowEarthForMaxDensity, _a._defaultMinDensityHeightBelowEarth);
92
- this.numViewRaySamples = JsonUtils.asDouble(json.numViewRaySamples, _a._defaultNumViewRaySamples);
93
- this.numSunRaySamples = JsonUtils.asDouble(json.numSunRaySamples, _a._defaultNumSunRaySamples);
94
- this.scatteringStrength = JsonUtils.asDouble(json.scatteringStrength, _a._defaultScatteringStrength);
95
- this.wavelengths = Wavelengths.fromJSON(JsonUtils.asObject(json.wavelengths) ?? _a._defaultWavelengths);
97
+ this.atmosphereHeightAboveEarth = JsonUtils.asDouble(json.atmosphereHeightAboveEarth, Settings._defaultAtmosphereHeightAboveEarth);
98
+ this.exposure = JsonUtils.asDouble(json.exposure, Settings._defaultExposure);
99
+ this.densityFalloff = JsonUtils.asDouble(json.densityFalloff, Settings._defaultDensityFalloff);
100
+ this.depthBelowEarthForMaxDensity = JsonUtils.asDouble(json.depthBelowEarthForMaxDensity, Settings._defaultMinDensityHeightBelowEarth);
101
+ this.numViewRaySamples = JsonUtils.asDouble(json.numViewRaySamples, Settings._defaultNumViewRaySamples);
102
+ this.numSunRaySamples = JsonUtils.asDouble(json.numSunRaySamples, Settings._defaultNumSunRaySamples);
103
+ this.scatteringStrength = JsonUtils.asDouble(json.scatteringStrength, Settings._defaultScatteringStrength);
104
+ this.wavelengths = Wavelengths.fromJSON(JsonUtils.asObject(json.wavelengths) ?? Settings._defaultWavelengths);
96
105
  }
97
106
  static fromJSON(json) {
98
107
  if (undefined === json)
99
108
  return this.defaults;
100
- return new _a(json);
109
+ return new Settings(json);
101
110
  }
102
111
  toJSON(display) {
103
112
  const json = {
@@ -115,17 +124,6 @@ export var Atmosphere;
115
124
  return json;
116
125
  }
117
126
  }
118
- _a = Settings;
119
- Settings._defaultAtmosphereHeightAboveEarth = 100000.0;
120
- Settings._defaultExposure = 2.0;
121
- Settings._defaultDensityFalloff = 10.0;
122
- Settings._defaultScatteringStrength = 100;
123
- Settings._defaultWavelengths = new Wavelengths({ r: 700.0, g: 530.0, b: 440.0 });
124
- Settings._defaultNumViewRaySamples = 10;
125
- Settings._highQualityNumViewRaySamples = 20;
126
- Settings._defaultNumSunRaySamples = 5;
127
- Settings.defaults = new _a({});
128
- Settings.highQuality = new _a({ numViewRaySamples: _a._highQualityNumViewRaySamples });
129
127
  Atmosphere.Settings = Settings;
130
128
  })(Atmosphere || (Atmosphere = {}));
131
129
  //# sourceMappingURL=Atmosphere.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Atmosphere.js","sourceRoot":"","sources":["../../src/Atmosphere.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD;;;;;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C,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE;aACvC,CAAC;YAEF,IAAI,SAAS,KAAK,OAAO;gBACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;YAEzB,OAAO,IAAI,CAAC;QACd,CAAC;;;IApFc,2CAAkC,GAAW,QAAQ,AAAnB,CAAoB;IACtD,yBAAgB,GAAW,GAAG,AAAd,CAAe;IAC/B,+BAAsB,GAAW,IAAI,AAAf,CAAgB;IAEtC,mCAA0B,GAAW,GAAG,AAAd,CAAe;IACzC,4BAAmB,GAAgB,IAAI,WAAW,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,AAAjE,CAAkE;IAErF,kCAAyB,GAAW,EAAE,AAAb,CAAc;IACvC,sCAA6B,GAAW,EAAE,AAAb,CAAc;IAC3C,iCAAwB,GAAW,CAAC,AAAZ,CAAa;IAE7B,iBAAQ,GAAG,IAAI,EAAQ,CAAC,EAAE,CAAC,AAAnB,CAAoB;IAC5B,oBAAW,GAAG,IAAI,EAAQ,CAAC,EAAE,iBAAiB,EAAE,EAAI,CAAC,6BAA6B,EAAE,CAAC,AAA1E,CAA2E;IAblG,mBAAQ,WAsFpB,CAAA;AACH,CAAC,EAhKgB,UAAU,KAAV,UAAU,QAgK1B","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module DisplayStyles\n */\nimport { JsonUtils } from \"@itwin/core-bentley\";\n\n/** Namespace containing types controlling how atmospheric scattering should be rendered.\n * @beta\n * The techniques used to render the atmosphere approximate the physical behavior of light when interacting with particles in the air (Rayleigh Scattering and Mie Scattering)\n * Presently, only Rayleigh Scattering is implemented here\n *\n * In a nutshell, this implementation samples atmospheric density along rays cast from the view and uses the samples to simulate the scattering of light toward the camera.\n * The amount of light scattered toward the camera is dependent on the amount of light scattered away from its original path from the sun, so rays must also be cast from the sample points to the sun.\n *\n * The effect can be computed on vertices (the default for the background map) and fragments (the default for the skybox, which is a ViewportQuad).\n * All coordinates are in view space.\n *\n * This implementation is adapted from equations outlined in \"Display of Clouds Taking into Account Multiple Anisotropic Scattering and Sky Light\", Nishita et al. 1993\n * which are further refined for use in GPU shaders in \"Photorealistic Real-Time Outdoor Light Scattering\", Hoffman and Preetham 2002.\n * These sources are also compiled in Chapter 16 of NVIDIA's \"GPU Gems 2\", which can be found online here:\n * https://developer.nvidia.com/gpugems/gpugems2/part-ii-shading-lighting-and-shadows/chapter-16-accurate-atmospheric-scattering\n *\n * This implementation is also highly inspired by Sebastian Lague's Solar System project: https://github.com/SebLague/Solar-System/ and video: https://www.youtube.com/watch?v=DxfEbulyFcY\n * along with this ShaderToy replica: https://www.shadertoy.com/view/fltXD2.\n * Both of which are inspired by this Nvidia article on atmospheric scattering: https://developer.nvidia.com/gpugems/gpugems2/part-ii-shading-lighting-and-shadows/chapter-16-accurate-atmospheric-scattering.\n */\nexport namespace Atmosphere {\n\n /** @internal JSON representation of a [[Wavelengths]] object */\n export interface WavelengthsProps {\n r: number;\n g: number;\n b: number;\n }\n\n /** @internal An immutable container of wavelength values for the red, green and blue pixel components. Values are in nanometers. */\n export class Wavelengths {\n public readonly r: number;\n public readonly g: number;\n public readonly b: number;\n\n /** Constructs from red, green, and blue wavelength values.\n * @param r Wavelength value for red\n * @param g Wavelength value for green\n * @param b Wavelength value for blue\n */\n constructor(props: WavelengthsProps) {\n this.r = Math.max(0, props.r);\n this.g = Math.max(0, props.g);\n this.b = Math.max(0, props.b);\n }\n\n public equals(other: Wavelengths): boolean {\n return this.r === other.r && this.g === other.g && this.b === other.b;\n }\n\n public toJSON(): WavelengthsProps {\n return { r: this.r, g: this.g, b: this.b };\n }\n\n public static fromJSON(json: WavelengthsProps | undefined): Wavelengths {\n let r = 0;\n let g = 0;\n let b = 0;\n if (undefined !== json) {\n if (typeof json.r === \"number\")\n r = json.r;\n if (typeof json.g === \"number\")\n g = json.g;\n if (typeof json.b === \"number\")\n b = json.b;\n }\n return new Wavelengths({ r, g, b });\n }\n }\n\n /** Describes the properties with which the atmospheric scattering effect should be drawn. Theses properties correspond to a physics-based approximation of atmospheric scattering phenomenons. */\n export interface Props {\n /** Whether the ground plane should be displayed. Defaults to false. */\n display?: boolean;\n /** @internal See [[Settings.atmosphereHeightAboveEarth]] */\n atmosphereHeightAboveEarth?: number;\n /** See [[Settings.exposure]] */\n exposure?: number;\n /** @internal See [[Settings.densityFalloff]] */\n densityFalloff?: number;\n /** @internal See [[Settings.minDensityHeightBelowEarth]] */\n depthBelowEarthForMaxDensity?: number;\n /** See [[Settings.numViewRaySamples]] */\n numViewRaySamples?: number;\n /** See [[Settings.numSunRaySamples]] */\n numSunRaySamples?: number;\n /** @internal See [[Settings.scatteringStrength]] */\n scatteringStrength?: number;\n /** @internal See [[Settings.wavelengths]] */\n wavelengths?: WavelengthsProps;\n }\n\n /** Describes the properties with which the atmospheric scattering effect should be drawn. Theses properties correspond to a physics-based approximation of atmospheric scattering phenomenons. */\n export class Settings {\n private static _defaultAtmosphereHeightAboveEarth: number = 100000.0;\n private static _defaultExposure: number = 2.0;\n private static _defaultDensityFalloff: number = 10.0;\n private static _defaultMinDensityHeightBelowEarth: 0.0;\n private static _defaultScatteringStrength: number = 100;\n private static _defaultWavelengths: Wavelengths = new Wavelengths({ r: 700.0, g: 530.0, b: 440.0 });\n\n private static _defaultNumViewRaySamples: number = 10;\n private static _highQualityNumViewRaySamples: number = 20;\n private static _defaultNumSunRaySamples: number = 5;\n\n public static readonly defaults = new Settings({});\n public static readonly highQuality = new Settings({ numViewRaySamples: this._highQualityNumViewRaySamples });\n\n /** @internal If defined, corresponds to the height in meters above the earth's pole at which the atmosphere terminates. Physically, this is the point at which there are no more air molecules to interfere with light transmission. Defaults to 100_000.0. */\n public readonly atmosphereHeightAboveEarth: number;\n /** If defined, this value is used to simulate the aperture of a camera. Higher values allow more light in. This value might need to be adjusted slightly in situations without much sunlight (like sunset) to brighten the image. Defaults to 2.0 */\n public readonly exposure: number;\n /** @internal If defined, controls the rate at which the air density decreases between the point it is the highest and the point is is the lowest. A higher value means a faster decrease in air density. Defaults to 10.0. */\n public readonly densityFalloff: number;\n /** @internal If defined, corresponds to the height in meters below the earth's pole at which the atmosphere is at its densest. Physically, this is the point at which there is the most air molecules to interfere with light transmission. Defaults to 0.0. */\n public readonly depthBelowEarthForMaxDensity: number;\n /** If defined, corresponds to the number of atmospheric density samples used to compute the amount of light scattered along each view ray. For each sample point, another ray will be cast toward the sun to compute the amount of light reaching the sample point. Higher values increase fidelity, but greatly decrease performance because sun rays must be cast from each additional sample point. The range is 1 to 40. Defaults to 10. */\n public readonly numViewRaySamples: number;\n /** If defined, corresponds to the number of atmospheric density samples uses to compute the amount of light scattered along each sun ray. Higher values increase fidelity slightly but greatly decrease performance. Minimal improvement is observable with values above 5. The range is 1 to 40. Defaults to 5. */\n public readonly numSunRaySamples: number;\n /** @internal If defined, controls how strongly the atmosphere's air diverts light. Higher values increase scattering intensity. Defaults to 100.0. */\n public readonly scatteringStrength: number;\n /** @internal If defined, corresponds the wavelengths of the red, green and blue color components in nanometers used to simulate how the atmosphere's air molecules affects light transmission. (See Rayleigh Scattering) Thus, a value of 470 for the red wavelength will make the red light component scatter as if it physically were a cyan light ray. The default value is {r:700.0, g:530.0, b:440.0}. */\n public readonly wavelengths: Wavelengths;\n\n public equals(other: Settings): boolean {\n if (this.atmosphereHeightAboveEarth !== other.atmosphereHeightAboveEarth)\n return false;\n if (this.exposure !== other.exposure)\n return false;\n if (this.densityFalloff !== other.densityFalloff)\n return false;\n if (this.depthBelowEarthForMaxDensity !== other.depthBelowEarthForMaxDensity)\n return false;\n if (this.numViewRaySamples !== other.numViewRaySamples)\n return false;\n if (this.numSunRaySamples !== other.numSunRaySamples)\n return false;\n if (this.scatteringStrength !== other.scatteringStrength)\n return false;\n if (!this.wavelengths.equals(other.wavelengths))\n return false;\n return true;\n }\n\n private constructor(json: Props) {\n this.atmosphereHeightAboveEarth = JsonUtils.asDouble(json.atmosphereHeightAboveEarth, Settings._defaultAtmosphereHeightAboveEarth);\n this.exposure = JsonUtils.asDouble(json.exposure, Settings._defaultExposure);\n this.densityFalloff = JsonUtils.asDouble(json.densityFalloff, Settings._defaultDensityFalloff);\n this.depthBelowEarthForMaxDensity = JsonUtils.asDouble(json.depthBelowEarthForMaxDensity, Settings._defaultMinDensityHeightBelowEarth);\n this.numViewRaySamples = JsonUtils.asDouble(json.numViewRaySamples, Settings._defaultNumViewRaySamples);\n this.numSunRaySamples = JsonUtils.asDouble(json.numSunRaySamples, Settings._defaultNumSunRaySamples);\n this.scatteringStrength = JsonUtils.asDouble(json.scatteringStrength, Settings._defaultScatteringStrength);\n this.wavelengths = Wavelengths.fromJSON(JsonUtils.asObject(json.wavelengths) ?? Settings._defaultWavelengths);\n }\n\n public static fromJSON(json?: Props) {\n if (undefined === json)\n return this.defaults;\n return new Settings(json);\n }\n\n public toJSON(display?: boolean): Props {\n const json: Props = {\n atmosphereHeightAboveEarth: this.atmosphereHeightAboveEarth,\n exposure: this.exposure,\n densityFalloff: this.densityFalloff,\n depthBelowEarthForMaxDensity: this.depthBelowEarthForMaxDensity,\n numViewRaySamples: this.numViewRaySamples,\n numSunRaySamples: this.numSunRaySamples,\n scatteringStrength: this.scatteringStrength,\n wavelengths: this.wavelengths.toJSON(),\n };\n\n if (undefined !== display)\n json.display = display;\n\n return json;\n }\n }\n}\n"]}
1
+ {"version":3,"file":"Atmosphere.js","sourceRoot":"","sources":["../../src/Atmosphere.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,KAAW,UAAU,CAgK1B;AAhKD,WAAiB,UAAU;IASzB,oIAAoI;IACp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,IAAI,CAAC,QAAQ,CAAC;YACvB,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC5B,CAAC;QAEM,MAAM,CAAC,OAAiB;YAC7B,MAAM,IAAI,GAAU;gBAClB,0BAA0B,EAAE,IAAI,CAAC,0BAA0B;gBAC3D,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,cAAc,EAAE,IAAI,CAAC,cAAc;gBACnC,4BAA4B,EAAE,IAAI,CAAC,4BAA4B;gBAC/D,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;gBACzC,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;gBACvC,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;gBAC3C,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE;aACvC,CAAC;YAEF,IAAI,SAAS,KAAK,OAAO;gBACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;YAEzB,OAAO,IAAI,CAAC;QACd,CAAC;;IArFU,mBAAQ,WAsFpB,CAAA;AACH,CAAC,EAhKgB,UAAU,KAAV,UAAU,QAgK1B","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module DisplayStyles\n */\nimport { JsonUtils } from \"@itwin/core-bentley\";\n\n/** Namespace containing types controlling how atmospheric scattering should be rendered.\n * @beta\n * The techniques used to render the atmosphere approximate the physical behavior of light when interacting with particles in the air (Rayleigh Scattering and Mie Scattering)\n * Presently, only Rayleigh Scattering is implemented here\n *\n * In a nutshell, this implementation samples atmospheric density along rays cast from the view and uses the samples to simulate the scattering of light toward the camera.\n * The amount of light scattered toward the camera is dependent on the amount of light scattered away from its original path from the sun, so rays must also be cast from the sample points to the sun.\n *\n * The effect can be computed on vertices (the default for the background map) and fragments (the default for the skybox, which is a ViewportQuad).\n * All coordinates are in view space.\n *\n * This implementation is adapted from equations outlined in \"Display of Clouds Taking into Account Multiple Anisotropic Scattering and Sky Light\", Nishita et al. 1993\n * which are further refined for use in GPU shaders in \"Photorealistic Real-Time Outdoor Light Scattering\", Hoffman and Preetham 2002.\n * These sources are also compiled in Chapter 16 of NVIDIA's \"GPU Gems 2\", which can be found online here:\n * https://developer.nvidia.com/gpugems/gpugems2/part-ii-shading-lighting-and-shadows/chapter-16-accurate-atmospheric-scattering\n *\n * This implementation is also highly inspired by Sebastian Lague's Solar System project: https://github.com/SebLague/Solar-System/ and video: https://www.youtube.com/watch?v=DxfEbulyFcY\n * along with this ShaderToy replica: https://www.shadertoy.com/view/fltXD2.\n * Both of which are inspired by this Nvidia article on atmospheric scattering: https://developer.nvidia.com/gpugems/gpugems2/part-ii-shading-lighting-and-shadows/chapter-16-accurate-atmospheric-scattering.\n */\nexport namespace Atmosphere {\n\n /** @internal JSON representation of a [[Wavelengths]] object */\n export interface WavelengthsProps {\n r: number;\n g: number;\n b: number;\n }\n\n /** @internal An immutable container of wavelength values for the red, green and blue pixel components. Values are in nanometers. */\n export class Wavelengths {\n public readonly r: number;\n public readonly g: number;\n public readonly b: number;\n\n /** Constructs from red, green, and blue wavelength values.\n * @param r Wavelength value for red\n * @param g Wavelength value for green\n * @param b Wavelength value for blue\n */\n constructor(props: WavelengthsProps) {\n this.r = Math.max(0, props.r);\n this.g = Math.max(0, props.g);\n this.b = Math.max(0, props.b);\n }\n\n public equals(other: Wavelengths): boolean {\n return this.r === other.r && this.g === other.g && this.b === other.b;\n }\n\n public toJSON(): WavelengthsProps {\n return { r: this.r, g: this.g, b: this.b };\n }\n\n public static fromJSON(json: WavelengthsProps | undefined): Wavelengths {\n let r = 0;\n let g = 0;\n let b = 0;\n if (undefined !== json) {\n if (typeof json.r === \"number\")\n r = json.r;\n if (typeof json.g === \"number\")\n g = json.g;\n if (typeof json.b === \"number\")\n b = json.b;\n }\n return new Wavelengths({ r, g, b });\n }\n }\n\n /** Describes the properties with which the atmospheric scattering effect should be drawn. Theses properties correspond to a physics-based approximation of atmospheric scattering phenomenons. */\n export interface Props {\n /** Whether the ground plane should be displayed. Defaults to false. */\n display?: boolean;\n /** @internal See [[Settings.atmosphereHeightAboveEarth]] */\n atmosphereHeightAboveEarth?: number;\n /** See [[Settings.exposure]] */\n exposure?: number;\n /** @internal See [[Settings.densityFalloff]] */\n densityFalloff?: number;\n /** @internal See [[Settings.minDensityHeightBelowEarth]] */\n depthBelowEarthForMaxDensity?: number;\n /** See [[Settings.numViewRaySamples]] */\n numViewRaySamples?: number;\n /** See [[Settings.numSunRaySamples]] */\n numSunRaySamples?: number;\n /** @internal See [[Settings.scatteringStrength]] */\n scatteringStrength?: number;\n /** @internal See [[Settings.wavelengths]] */\n wavelengths?: WavelengthsProps;\n }\n\n /** Describes the properties with which the atmospheric scattering effect should be drawn. Theses properties correspond to a physics-based approximation of atmospheric scattering phenomenons. */\n export class Settings {\n private static _defaultAtmosphereHeightAboveEarth: number = 100000.0;\n private static _defaultExposure: number = 2.0;\n private static _defaultDensityFalloff: number = 10.0;\n private static _defaultMinDensityHeightBelowEarth: 0.0;\n private static _defaultScatteringStrength: number = 100;\n private static _defaultWavelengths: Wavelengths = new Wavelengths({ r: 700.0, g: 530.0, b: 440.0 });\n\n private static _defaultNumViewRaySamples: number = 10;\n private static _highQualityNumViewRaySamples: number = 20;\n private static _defaultNumSunRaySamples: number = 5;\n\n public static readonly defaults = new Settings({});\n public static readonly highQuality = new Settings({ numViewRaySamples: this._highQualityNumViewRaySamples });\n\n /** @internal If defined, corresponds to the height in meters above the earth's pole at which the atmosphere terminates. Physically, this is the point at which there are no more air molecules to interfere with light transmission. Defaults to 100_000.0. */\n public readonly atmosphereHeightAboveEarth: number;\n /** If defined, this value is used to simulate the aperture of a camera. Higher values allow more light in. This value might need to be adjusted slightly in situations without much sunlight (like sunset) to brighten the image. Defaults to 2.0 */\n public readonly exposure: number;\n /** @internal If defined, controls the rate at which the air density decreases between the point it is the highest and the point is is the lowest. A higher value means a faster decrease in air density. Defaults to 10.0. */\n public readonly densityFalloff: number;\n /** @internal If defined, corresponds to the height in meters below the earth's pole at which the atmosphere is at its densest. Physically, this is the point at which there is the most air molecules to interfere with light transmission. Defaults to 0.0. */\n public readonly depthBelowEarthForMaxDensity: number;\n /** If defined, corresponds to the number of atmospheric density samples used to compute the amount of light scattered along each view ray. For each sample point, another ray will be cast toward the sun to compute the amount of light reaching the sample point. Higher values increase fidelity, but greatly decrease performance because sun rays must be cast from each additional sample point. The range is 1 to 40. Defaults to 10. */\n public readonly numViewRaySamples: number;\n /** If defined, corresponds to the number of atmospheric density samples uses to compute the amount of light scattered along each sun ray. Higher values increase fidelity slightly but greatly decrease performance. Minimal improvement is observable with values above 5. The range is 1 to 40. Defaults to 5. */\n public readonly numSunRaySamples: number;\n /** @internal If defined, controls how strongly the atmosphere's air diverts light. Higher values increase scattering intensity. Defaults to 100.0. */\n public readonly scatteringStrength: number;\n /** @internal If defined, corresponds the wavelengths of the red, green and blue color components in nanometers used to simulate how the atmosphere's air molecules affects light transmission. (See Rayleigh Scattering) Thus, a value of 470 for the red wavelength will make the red light component scatter as if it physically were a cyan light ray. The default value is {r:700.0, g:530.0, b:440.0}. */\n public readonly wavelengths: Wavelengths;\n\n public equals(other: Settings): boolean {\n if (this.atmosphereHeightAboveEarth !== other.atmosphereHeightAboveEarth)\n return false;\n if (this.exposure !== other.exposure)\n return false;\n if (this.densityFalloff !== other.densityFalloff)\n return false;\n if (this.depthBelowEarthForMaxDensity !== other.depthBelowEarthForMaxDensity)\n return false;\n if (this.numViewRaySamples !== other.numViewRaySamples)\n return false;\n if (this.numSunRaySamples !== other.numSunRaySamples)\n return false;\n if (this.scatteringStrength !== other.scatteringStrength)\n return false;\n if (!this.wavelengths.equals(other.wavelengths))\n return false;\n return true;\n }\n\n private constructor(json: Props) {\n this.atmosphereHeightAboveEarth = JsonUtils.asDouble(json.atmosphereHeightAboveEarth, Settings._defaultAtmosphereHeightAboveEarth);\n this.exposure = JsonUtils.asDouble(json.exposure, Settings._defaultExposure);\n this.densityFalloff = JsonUtils.asDouble(json.densityFalloff, Settings._defaultDensityFalloff);\n this.depthBelowEarthForMaxDensity = JsonUtils.asDouble(json.depthBelowEarthForMaxDensity, Settings._defaultMinDensityHeightBelowEarth);\n this.numViewRaySamples = JsonUtils.asDouble(json.numViewRaySamples, Settings._defaultNumViewRaySamples);\n this.numSunRaySamples = JsonUtils.asDouble(json.numSunRaySamples, Settings._defaultNumSunRaySamples);\n this.scatteringStrength = JsonUtils.asDouble(json.scatteringStrength, Settings._defaultScatteringStrength);\n this.wavelengths = Wavelengths.fromJSON(JsonUtils.asObject(json.wavelengths) ?? Settings._defaultWavelengths);\n }\n\n public static fromJSON(json?: Props) {\n if (undefined === json)\n return this.defaults;\n return new Settings(json);\n }\n\n public toJSON(display?: boolean): Props {\n const json: Props = {\n atmosphereHeightAboveEarth: this.atmosphereHeightAboveEarth,\n exposure: this.exposure,\n densityFalloff: this.densityFalloff,\n depthBelowEarthForMaxDensity: this.depthBelowEarthForMaxDensity,\n numViewRaySamples: this.numViewRaySamples,\n numSunRaySamples: this.numSunRaySamples,\n scatteringStrength: this.scatteringStrength,\n wavelengths: this.wavelengths.toJSON(),\n };\n\n if (undefined !== display)\n json.display = display;\n\n return json;\n }\n }\n}\n"]}
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import { GuidString } from "@itwin/core-bentley";
5
5
  import { ChangesetIdWithIndex, ChangesetIndexOrId, LocalFileName } from "./ChangesetProps";
6
- import { IModelEncryptionProps, OpenDbKey } from "./IModel";
6
+ import { OpenDbKey } from "./IModel";
7
7
  import { IModelVersionProps } from "./IModelVersion";
8
8
  /** The Id assigned to a briefcase by iModelHub, or [[BriefcaseIdValue.Unassigned]] .
9
9
  * @public
@@ -70,7 +70,7 @@ export interface BriefcaseProps {
70
70
  /** Properties for opening a local briefcase file via [BriefcaseDb.open]($backend)
71
71
  * @public
72
72
  */
73
- export interface OpenBriefcaseProps extends IModelEncryptionProps, OpenDbKey {
73
+ export interface OpenBriefcaseProps extends OpenDbKey {
74
74
  /** the full path to the briefcase file */
75
75
  readonly fileName: LocalFileName;
76
76
  /**