@itwin/core-common 5.0.0-dev.9 → 5.0.0-dev.90

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 (806) hide show
  1. package/CHANGELOG.md +55 -1
  2. package/lib/cjs/AmbientOcclusion.js +17 -9
  3. package/lib/cjs/AmbientOcclusion.js.map +1 -1
  4. package/lib/cjs/AnalysisStyle.d.ts +0 -3
  5. package/lib/cjs/AnalysisStyle.d.ts.map +1 -1
  6. package/lib/cjs/AnalysisStyle.js +20 -4
  7. package/lib/cjs/AnalysisStyle.js.map +1 -1
  8. package/lib/cjs/Atmosphere.js +39 -21
  9. package/lib/cjs/Atmosphere.js.map +1 -1
  10. package/lib/cjs/AuthorizationClient.js.map +1 -1
  11. package/lib/cjs/BackgroundMapProvider.js +4 -0
  12. package/lib/cjs/BackgroundMapProvider.js.map +1 -1
  13. package/lib/cjs/BackgroundMapSettings.js +19 -0
  14. package/lib/cjs/BackgroundMapSettings.js.map +1 -1
  15. package/lib/cjs/Base64EncodedString.js.map +1 -1
  16. package/lib/cjs/BlobReader.js +8 -6
  17. package/lib/cjs/BlobReader.js.map +1 -1
  18. package/lib/cjs/BriefcaseTypes.d.ts +2 -2
  19. package/lib/cjs/BriefcaseTypes.d.ts.map +1 -1
  20. package/lib/cjs/BriefcaseTypes.js.map +1 -1
  21. package/lib/cjs/Camera.js +3 -0
  22. package/lib/cjs/Camera.js.map +1 -1
  23. package/lib/cjs/ChangedElements.js.map +1 -1
  24. package/lib/cjs/ChangedEntities.js.map +1 -1
  25. package/lib/cjs/ChangesetProps.d.ts +1 -1
  26. package/lib/cjs/ChangesetProps.js.map +1 -1
  27. package/lib/cjs/ClipStyle.js +31 -5
  28. package/lib/cjs/ClipStyle.js.map +1 -1
  29. package/lib/cjs/Code.d.ts +0 -5
  30. package/lib/cjs/Code.d.ts.map +1 -1
  31. package/lib/cjs/Code.js +16 -11
  32. package/lib/cjs/Code.js.map +1 -1
  33. package/lib/cjs/ColorByName.js.map +1 -1
  34. package/lib/cjs/ColorDef.js +11 -10
  35. package/lib/cjs/ColorDef.js.map +1 -1
  36. package/lib/cjs/CommonLoggerCategory.js.map +1 -1
  37. package/lib/cjs/ConcurrentQuery.d.ts +37 -1
  38. package/lib/cjs/ConcurrentQuery.d.ts.map +1 -1
  39. package/lib/cjs/ConcurrentQuery.js +16 -3
  40. package/lib/cjs/ConcurrentQuery.js.map +1 -1
  41. package/lib/cjs/ContextRealityModel.js +53 -27
  42. package/lib/cjs/ContextRealityModel.js.map +1 -1
  43. package/lib/cjs/ContourDisplay.js +40 -5
  44. package/lib/cjs/ContourDisplay.js.map +1 -1
  45. package/lib/cjs/DisplayStyleSettings.js +95 -63
  46. package/lib/cjs/DisplayStyleSettings.js.map +1 -1
  47. package/lib/cjs/ECSchemaProps.js.map +1 -1
  48. package/lib/cjs/ECSqlReader.d.ts +2 -0
  49. package/lib/cjs/ECSqlReader.d.ts.map +1 -1
  50. package/lib/cjs/ECSqlReader.js +56 -50
  51. package/lib/cjs/ECSqlReader.js.map +1 -1
  52. package/lib/cjs/ECSqlTypes.js.map +1 -1
  53. package/lib/cjs/ElementMesh.js.map +1 -1
  54. package/lib/cjs/ElementProps.d.ts.map +1 -1
  55. package/lib/cjs/ElementProps.js +7 -3
  56. package/lib/cjs/ElementProps.js.map +1 -1
  57. package/lib/cjs/EmphasizeElementsProps.js.map +1 -1
  58. package/lib/cjs/EntityProps.d.ts +25 -2
  59. package/lib/cjs/EntityProps.d.ts.map +1 -1
  60. package/lib/cjs/EntityProps.js +39 -0
  61. package/lib/cjs/EntityProps.js.map +1 -1
  62. package/lib/cjs/EntityReference.js.map +1 -1
  63. package/lib/cjs/Environment.js +25 -2
  64. package/lib/cjs/Environment.js.map +1 -1
  65. package/lib/cjs/FeatureIndex.js +15 -6
  66. package/lib/cjs/FeatureIndex.js.map +1 -1
  67. package/lib/cjs/FeatureSymbology.d.ts +25 -73
  68. package/lib/cjs/FeatureSymbology.d.ts.map +1 -1
  69. package/lib/cjs/FeatureSymbology.js +88 -103
  70. package/lib/cjs/FeatureSymbology.js.map +1 -1
  71. package/lib/cjs/FeatureTable.d.ts +6 -108
  72. package/lib/cjs/FeatureTable.d.ts.map +1 -1
  73. package/lib/cjs/FeatureTable.js +13 -329
  74. package/lib/cjs/FeatureTable.js.map +1 -1
  75. package/lib/cjs/Fonts.d.ts +68 -10
  76. package/lib/cjs/Fonts.d.ts.map +1 -1
  77. package/lib/cjs/Fonts.js +19 -4
  78. package/lib/cjs/Fonts.js.map +1 -1
  79. package/lib/cjs/Frustum.js +2 -2
  80. package/lib/cjs/Frustum.js.map +1 -1
  81. package/lib/cjs/GenericInstanceFilter.js.map +1 -1
  82. package/lib/cjs/GeoCoordinateServices.d.ts +1 -0
  83. package/lib/cjs/GeoCoordinateServices.d.ts.map +1 -1
  84. package/lib/cjs/GeoCoordinateServices.js +2 -1
  85. package/lib/cjs/GeoCoordinateServices.js.map +1 -1
  86. package/lib/cjs/GeometryContainment.js.map +1 -1
  87. package/lib/cjs/GeometryParams.js +58 -0
  88. package/lib/cjs/GeometryParams.js.map +1 -1
  89. package/lib/cjs/GeometrySummary.js.map +1 -1
  90. package/lib/cjs/Gradient.d.ts +3 -4
  91. package/lib/cjs/Gradient.d.ts.map +1 -1
  92. package/lib/cjs/Gradient.js +21 -19
  93. package/lib/cjs/Gradient.js.map +1 -1
  94. package/lib/cjs/GraphicParams.js +14 -12
  95. package/lib/cjs/GraphicParams.js.map +1 -1
  96. package/lib/cjs/GroundPlane.js +8 -2
  97. package/lib/cjs/GroundPlane.js.map +1 -1
  98. package/lib/cjs/HSLColor.js +6 -0
  99. package/lib/cjs/HSLColor.js.map +1 -1
  100. package/lib/cjs/HSVColor.js +6 -0
  101. package/lib/cjs/HSVColor.js.map +1 -1
  102. package/lib/cjs/HiddenLine.d.ts +17 -18
  103. package/lib/cjs/HiddenLine.d.ts.map +1 -1
  104. package/lib/cjs/HiddenLine.js +24 -5
  105. package/lib/cjs/HiddenLine.js.map +1 -1
  106. package/lib/cjs/Hilite.js +10 -0
  107. package/lib/cjs/Hilite.js.map +1 -1
  108. package/lib/cjs/IModel.d.ts +3 -12
  109. package/lib/cjs/IModel.d.ts.map +1 -1
  110. package/lib/cjs/IModel.js +47 -23
  111. package/lib/cjs/IModel.js.map +1 -1
  112. package/lib/cjs/IModelError.d.ts +0 -2
  113. package/lib/cjs/IModelError.d.ts.map +1 -1
  114. package/lib/cjs/IModelError.js +3 -8
  115. package/lib/cjs/IModelError.js.map +1 -1
  116. package/lib/cjs/IModelVersion.js +4 -0
  117. package/lib/cjs/IModelVersion.js.map +1 -1
  118. package/lib/cjs/ITwinError.d.ts +63 -27
  119. package/lib/cjs/ITwinError.d.ts.map +1 -1
  120. package/lib/cjs/ITwinError.js +93 -45
  121. package/lib/cjs/ITwinError.js.map +1 -1
  122. package/lib/cjs/Image.d.ts +22 -8
  123. package/lib/cjs/Image.d.ts.map +1 -1
  124. package/lib/cjs/Image.js +20 -4
  125. package/lib/cjs/Image.js.map +1 -1
  126. package/lib/cjs/IpcAppProps.d.ts +2 -0
  127. package/lib/cjs/IpcAppProps.d.ts.map +1 -1
  128. package/lib/cjs/IpcAppProps.js.map +1 -1
  129. package/lib/cjs/LightSettings.js +39 -1
  130. package/lib/cjs/LightSettings.js.map +1 -1
  131. package/lib/cjs/LinePixels.js.map +1 -1
  132. package/lib/cjs/Localization.d.ts +0 -10
  133. package/lib/cjs/Localization.d.ts.map +1 -1
  134. package/lib/cjs/Localization.js +0 -1
  135. package/lib/cjs/Localization.js.map +1 -1
  136. package/lib/cjs/MapImagerySettings.js +3 -2
  137. package/lib/cjs/MapImagerySettings.js.map +1 -1
  138. package/lib/cjs/MapLayerSettings.d.ts +20 -0
  139. package/lib/cjs/MapLayerSettings.d.ts.map +1 -1
  140. package/lib/cjs/MapLayerSettings.js +50 -1
  141. package/lib/cjs/MapLayerSettings.js.map +1 -1
  142. package/lib/cjs/MassProperties.d.ts +2 -0
  143. package/lib/cjs/MassProperties.d.ts.map +1 -1
  144. package/lib/cjs/MassProperties.js.map +1 -1
  145. package/lib/cjs/MaterialProps.js.map +1 -1
  146. package/lib/cjs/ModelClipGroup.js +6 -0
  147. package/lib/cjs/ModelClipGroup.js.map +1 -1
  148. package/lib/cjs/ModelGeometryChanges.js.map +1 -1
  149. package/lib/cjs/ModelProps.js.map +1 -1
  150. package/lib/cjs/NativeAppProps.js.map +1 -1
  151. package/lib/cjs/OctEncodedNormal.js +4 -0
  152. package/lib/cjs/OctEncodedNormal.js.map +1 -1
  153. package/lib/cjs/PlanProjectionSettings.d.ts +1 -2
  154. package/lib/cjs/PlanProjectionSettings.d.ts.map +1 -1
  155. package/lib/cjs/PlanProjectionSettings.js +8 -1
  156. package/lib/cjs/PlanProjectionSettings.js.map +1 -1
  157. package/lib/cjs/PlanarClipMask.d.ts +0 -12
  158. package/lib/cjs/PlanarClipMask.d.ts.map +1 -1
  159. package/lib/cjs/PlanarClipMask.js +24 -2
  160. package/lib/cjs/PlanarClipMask.js.map +1 -1
  161. package/lib/cjs/QPoint.d.ts +5 -5
  162. package/lib/cjs/QPoint.d.ts.map +1 -1
  163. package/lib/cjs/QPoint.js +37 -29
  164. package/lib/cjs/QPoint.js.map +1 -1
  165. package/lib/cjs/RealityDataAccessProps.js.map +1 -1
  166. package/lib/cjs/RealityModelDisplaySettings.js +81 -4
  167. package/lib/cjs/RealityModelDisplaySettings.js.map +1 -1
  168. package/lib/cjs/RenderMaterial.d.ts +0 -43
  169. package/lib/cjs/RenderMaterial.d.ts.map +1 -1
  170. package/lib/cjs/RenderMaterial.js +6 -51
  171. package/lib/cjs/RenderMaterial.js.map +1 -1
  172. package/lib/cjs/RenderPolyline.d.ts +36 -0
  173. package/lib/cjs/RenderPolyline.d.ts.map +1 -0
  174. package/lib/cjs/RenderPolyline.js +26 -0
  175. package/lib/cjs/RenderPolyline.js.map +1 -0
  176. package/lib/cjs/RenderSchedule.d.ts +1 -2
  177. package/lib/cjs/RenderSchedule.d.ts.map +1 -1
  178. package/lib/cjs/RenderSchedule.js +138 -11
  179. package/lib/cjs/RenderSchedule.js.map +1 -1
  180. package/lib/cjs/RenderTexture.d.ts +5 -23
  181. package/lib/cjs/RenderTexture.d.ts.map +1 -1
  182. package/lib/cjs/RenderTexture.js +13 -16
  183. package/lib/cjs/RenderTexture.js.map +1 -1
  184. package/lib/cjs/RgbColor.js +3 -0
  185. package/lib/cjs/RgbColor.js.map +1 -1
  186. package/lib/cjs/RpcInterface.d.ts.map +1 -1
  187. package/lib/cjs/RpcInterface.js +7 -1
  188. package/lib/cjs/RpcInterface.js.map +1 -1
  189. package/lib/cjs/RpcManager.js.map +1 -1
  190. package/lib/cjs/SessionProps.js.map +1 -1
  191. package/lib/cjs/SkyBox.js +17 -4
  192. package/lib/cjs/SkyBox.js.map +1 -1
  193. package/lib/cjs/SolarCalculate.js.map +1 -1
  194. package/lib/cjs/SolarShadows.js +5 -1
  195. package/lib/cjs/SolarShadows.js.map +1 -1
  196. package/lib/cjs/SpatialClassification.js +19 -1
  197. package/lib/cjs/SpatialClassification.js.map +1 -1
  198. package/lib/cjs/SubCategoryAppearance.js +35 -1
  199. package/lib/cjs/SubCategoryAppearance.js.map +1 -1
  200. package/lib/cjs/SubCategoryOverride.js +16 -2
  201. package/lib/cjs/SubCategoryOverride.js.map +1 -1
  202. package/lib/cjs/TerrainSettings.d.ts +0 -7
  203. package/lib/cjs/TerrainSettings.d.ts.map +1 -1
  204. package/lib/cjs/TerrainSettings.js +19 -0
  205. package/lib/cjs/TerrainSettings.js.map +1 -1
  206. package/lib/cjs/TextureMapping.d.ts +17 -14
  207. package/lib/cjs/TextureMapping.d.ts.map +1 -1
  208. package/lib/cjs/TextureMapping.js +47 -19
  209. package/lib/cjs/TextureMapping.js.map +1 -1
  210. package/lib/cjs/TextureProps.js.map +1 -1
  211. package/lib/cjs/ThematicDisplay.js +53 -2
  212. package/lib/cjs/ThematicDisplay.js.map +1 -1
  213. package/lib/cjs/Thumbnail.d.ts +1 -1
  214. package/lib/cjs/Thumbnail.js.map +1 -1
  215. package/lib/cjs/TileProps.js.map +1 -1
  216. package/lib/cjs/Tween.js +28 -19
  217. package/lib/cjs/Tween.js.map +1 -1
  218. package/lib/cjs/TxnAction.js.map +1 -1
  219. package/lib/cjs/ViewDetails.js +10 -6
  220. package/lib/cjs/ViewDetails.js.map +1 -1
  221. package/lib/cjs/ViewFlags.d.ts +1 -3
  222. package/lib/cjs/ViewFlags.d.ts.map +1 -1
  223. package/lib/cjs/ViewFlags.js +86 -5
  224. package/lib/cjs/ViewFlags.js.map +1 -1
  225. package/lib/cjs/ViewProps.d.ts +2 -6
  226. package/lib/cjs/ViewProps.d.ts.map +1 -1
  227. package/lib/cjs/ViewProps.js.map +1 -1
  228. package/lib/cjs/WhiteOnWhiteReversalSettings.js +7 -2
  229. package/lib/cjs/WhiteOnWhiteReversalSettings.js.map +1 -1
  230. package/lib/cjs/annotation/TextAnnotation.d.ts +3 -2
  231. package/lib/cjs/annotation/TextAnnotation.d.ts.map +1 -1
  232. package/lib/cjs/annotation/TextAnnotation.js +13 -2
  233. package/lib/cjs/annotation/TextAnnotation.js.map +1 -1
  234. package/lib/cjs/annotation/TextBlock.d.ts +17 -0
  235. package/lib/cjs/annotation/TextBlock.d.ts.map +1 -1
  236. package/lib/cjs/annotation/TextBlock.js +41 -6
  237. package/lib/cjs/annotation/TextBlock.js.map +1 -1
  238. package/lib/cjs/annotation/TextBlockGeometryProps.js.map +1 -1
  239. package/lib/cjs/annotation/TextBlockLayoutResult.js.map +1 -1
  240. package/lib/cjs/annotation/TextStyle.js +65 -19
  241. package/lib/cjs/annotation/TextStyle.js.map +1 -1
  242. package/lib/cjs/core-common.d.ts +1 -2
  243. package/lib/cjs/core-common.d.ts.map +1 -1
  244. package/lib/cjs/core-common.js +1 -2
  245. package/lib/cjs/core-common.js.map +1 -1
  246. package/lib/cjs/domains/FunctionalElementProps.js.map +1 -1
  247. package/lib/cjs/domains/GenericElementProps.js.map +1 -1
  248. package/lib/cjs/geometry/AdditionalTransform.js +12 -0
  249. package/lib/cjs/geometry/AdditionalTransform.js.map +1 -1
  250. package/lib/cjs/geometry/AreaPattern.js +17 -0
  251. package/lib/cjs/geometry/AreaPattern.js.map +1 -1
  252. package/lib/cjs/geometry/BoundingSphere.js +4 -0
  253. package/lib/cjs/geometry/BoundingSphere.js.map +1 -1
  254. package/lib/cjs/geometry/Cartographic.js +23 -20
  255. package/lib/cjs/geometry/Cartographic.js.map +1 -1
  256. package/lib/cjs/geometry/CoordinateReferenceSystem.js +62 -0
  257. package/lib/cjs/geometry/CoordinateReferenceSystem.js.map +1 -1
  258. package/lib/cjs/geometry/ElementGeometry.js +26 -8
  259. package/lib/cjs/geometry/ElementGeometry.js.map +1 -1
  260. package/lib/cjs/geometry/ElementGeometryFB.js +54 -108
  261. package/lib/cjs/geometry/ElementGeometryFB.js.map +1 -1
  262. package/lib/cjs/geometry/FrustumPlanes.js +1 -0
  263. package/lib/cjs/geometry/FrustumPlanes.js.map +1 -1
  264. package/lib/cjs/geometry/GeodeticDatum.js +100 -0
  265. package/lib/cjs/geometry/GeodeticDatum.js.map +1 -1
  266. package/lib/cjs/geometry/GeodeticEllipsoid.js +16 -0
  267. package/lib/cjs/geometry/GeodeticEllipsoid.js.map +1 -1
  268. package/lib/cjs/geometry/GeometryStream.js +19 -6
  269. package/lib/cjs/geometry/GeometryStream.js.map +1 -1
  270. package/lib/cjs/geometry/ImageGraphic.js +10 -0
  271. package/lib/cjs/geometry/ImageGraphic.js.map +1 -1
  272. package/lib/cjs/geometry/LineStyle.js +14 -0
  273. package/lib/cjs/geometry/LineStyle.js.map +1 -1
  274. package/lib/cjs/geometry/Placement.js +6 -0
  275. package/lib/cjs/geometry/Placement.js.map +1 -1
  276. package/lib/cjs/geometry/Projection.js +75 -0
  277. package/lib/cjs/geometry/Projection.js.map +1 -1
  278. package/lib/cjs/geometry/TextString.js +18 -0
  279. package/lib/cjs/geometry/TextString.js.map +1 -1
  280. package/lib/cjs/{BackendTypes.d.ts → internal/BackendTypes.d.ts} +1 -0
  281. package/lib/cjs/internal/BackendTypes.d.ts.map +1 -0
  282. package/lib/cjs/internal/BackendTypes.js.map +1 -0
  283. package/lib/cjs/internal/PackedFeatureTable.d.ts +111 -0
  284. package/lib/cjs/internal/PackedFeatureTable.d.ts.map +1 -0
  285. package/lib/cjs/internal/PackedFeatureTable.js +359 -0
  286. package/lib/cjs/internal/PackedFeatureTable.js.map +1 -0
  287. package/lib/cjs/internal/RenderMaterialParams.d.ts +47 -0
  288. package/lib/cjs/internal/RenderMaterialParams.d.ts.map +1 -0
  289. package/lib/cjs/internal/RenderMaterialParams.js +68 -0
  290. package/lib/cjs/internal/RenderMaterialParams.js.map +1 -0
  291. package/lib/cjs/internal/RenderMesh.d.ts +52 -0
  292. package/lib/cjs/internal/RenderMesh.d.ts.map +1 -0
  293. package/lib/cjs/{Render.js → internal/RenderMesh.js} +12 -31
  294. package/lib/cjs/internal/RenderMesh.js.map +1 -0
  295. package/lib/cjs/internal/RenderTextureParams.d.ts +25 -0
  296. package/lib/cjs/internal/RenderTextureParams.d.ts.map +1 -0
  297. package/lib/cjs/internal/RenderTextureParams.js +37 -0
  298. package/lib/cjs/internal/RenderTextureParams.js.map +1 -0
  299. package/lib/cjs/internal/Snapping.js.map +1 -1
  300. package/lib/cjs/internal/cross-package.d.ts +5 -0
  301. package/lib/cjs/internal/cross-package.d.ts.map +1 -1
  302. package/lib/cjs/internal/cross-package.js +16 -0
  303. package/lib/cjs/internal/cross-package.js.map +1 -1
  304. package/lib/cjs/ipc/IpcSession.js +1 -0
  305. package/lib/cjs/ipc/IpcSession.js.map +1 -1
  306. package/lib/cjs/ipc/IpcSocket.d.ts +3 -0
  307. package/lib/cjs/ipc/IpcSocket.d.ts.map +1 -1
  308. package/lib/cjs/ipc/IpcSocket.js.map +1 -1
  309. package/lib/cjs/ipc/IpcWebSocket.js +7 -6
  310. package/lib/cjs/ipc/IpcWebSocket.js.map +1 -1
  311. package/lib/cjs/ipc/IpcWebSocketTransport.js +8 -7
  312. package/lib/cjs/ipc/IpcWebSocketTransport.js.map +1 -1
  313. package/lib/cjs/rpc/DevToolsRpcInterface.js +6 -6
  314. package/lib/cjs/rpc/DevToolsRpcInterface.js.map +1 -1
  315. package/lib/cjs/rpc/IModelReadRpcInterface.js +8 -11
  316. package/lib/cjs/rpc/IModelReadRpcInterface.js.map +1 -1
  317. package/lib/cjs/rpc/IModelTileRpcInterface.js +4 -4
  318. package/lib/cjs/rpc/IModelTileRpcInterface.js.map +1 -1
  319. package/lib/cjs/rpc/SnapshotIModelRpcInterface.js +4 -4
  320. package/lib/cjs/rpc/SnapshotIModelRpcInterface.js.map +1 -1
  321. package/lib/cjs/rpc/TestRpcManager.js +1 -4
  322. package/lib/cjs/rpc/TestRpcManager.js.map +1 -1
  323. package/lib/cjs/rpc/core/RpcConfiguration.js +51 -64
  324. package/lib/cjs/rpc/core/RpcConfiguration.js.map +1 -1
  325. package/lib/cjs/rpc/core/RpcConstants.js.map +1 -1
  326. package/lib/cjs/rpc/core/RpcControl.js +29 -38
  327. package/lib/cjs/rpc/core/RpcControl.js.map +1 -1
  328. package/lib/cjs/rpc/core/RpcInvocation.js +19 -13
  329. package/lib/cjs/rpc/core/RpcInvocation.js.map +1 -1
  330. package/lib/cjs/rpc/core/RpcMarshaling.d.ts +1 -4
  331. package/lib/cjs/rpc/core/RpcMarshaling.d.ts.map +1 -1
  332. package/lib/cjs/rpc/core/RpcMarshaling.js +5 -4
  333. package/lib/cjs/rpc/core/RpcMarshaling.js.map +1 -1
  334. package/lib/cjs/rpc/core/RpcOperation.js +29 -31
  335. package/lib/cjs/rpc/core/RpcOperation.js.map +1 -1
  336. package/lib/cjs/rpc/core/RpcPendingQueue.js +17 -16
  337. package/lib/cjs/rpc/core/RpcPendingQueue.js.map +1 -1
  338. package/lib/cjs/rpc/core/RpcProtocol.js +32 -30
  339. package/lib/cjs/rpc/core/RpcProtocol.js.map +1 -1
  340. package/lib/cjs/rpc/core/RpcPush.js +15 -8
  341. package/lib/cjs/rpc/core/RpcPush.js.map +1 -1
  342. package/lib/cjs/rpc/core/RpcRegistry.d.ts.map +1 -1
  343. package/lib/cjs/rpc/core/RpcRegistry.js +10 -9
  344. package/lib/cjs/rpc/core/RpcRegistry.js.map +1 -1
  345. package/lib/cjs/rpc/core/RpcRequest.d.ts +2 -2
  346. package/lib/cjs/rpc/core/RpcRequest.d.ts.map +1 -1
  347. package/lib/cjs/rpc/core/RpcRequest.js +51 -29
  348. package/lib/cjs/rpc/core/RpcRequest.js.map +1 -1
  349. package/lib/cjs/rpc/core/RpcRequestContext.js.map +1 -1
  350. package/lib/cjs/rpc/core/RpcRoutingToken.js +4 -2
  351. package/lib/cjs/rpc/core/RpcRoutingToken.js.map +1 -1
  352. package/lib/cjs/rpc/core/RpcSessionInvocation.js +5 -10
  353. package/lib/cjs/rpc/core/RpcSessionInvocation.js.map +1 -1
  354. package/lib/cjs/rpc/web/BentleyCloudRpcManager.js +11 -17
  355. package/lib/cjs/rpc/web/BentleyCloudRpcManager.js.map +1 -1
  356. package/lib/cjs/rpc/web/BentleyCloudRpcProtocol.js +16 -19
  357. package/lib/cjs/rpc/web/BentleyCloudRpcProtocol.js.map +1 -1
  358. package/lib/cjs/rpc/web/OpenAPI.js +2 -0
  359. package/lib/cjs/rpc/web/OpenAPI.js.map +1 -1
  360. package/lib/cjs/rpc/web/RpcMultipart.d.ts +1 -1
  361. package/lib/cjs/rpc/web/RpcMultipart.d.ts.map +1 -1
  362. package/lib/cjs/rpc/web/RpcMultipart.js +13 -12
  363. package/lib/cjs/rpc/web/RpcMultipart.js.map +1 -1
  364. package/lib/cjs/rpc/web/WebAppRpcLogging.d.ts +3 -0
  365. package/lib/cjs/rpc/web/WebAppRpcLogging.d.ts.map +1 -1
  366. package/lib/cjs/rpc/web/WebAppRpcLogging.js +1 -6
  367. package/lib/cjs/rpc/web/WebAppRpcLogging.js.map +1 -1
  368. package/lib/cjs/rpc/web/WebAppRpcProtocol.d.ts +1 -1
  369. package/lib/cjs/rpc/web/WebAppRpcProtocol.d.ts.map +1 -1
  370. package/lib/cjs/rpc/web/WebAppRpcProtocol.js +6 -6
  371. package/lib/cjs/rpc/web/WebAppRpcProtocol.js.map +1 -1
  372. package/lib/cjs/rpc/web/WebAppRpcRequest.d.ts.map +1 -1
  373. package/lib/cjs/rpc/web/WebAppRpcRequest.js +27 -27
  374. package/lib/cjs/rpc/web/WebAppRpcRequest.js.map +1 -1
  375. package/lib/cjs/rpc/web/multipart/RpcMultipartParser.d.ts +0 -2
  376. package/lib/cjs/rpc/web/multipart/RpcMultipartParser.d.ts.map +1 -1
  377. package/lib/cjs/rpc/web/multipart/RpcMultipartParser.js +14 -8
  378. package/lib/cjs/rpc/web/multipart/RpcMultipartParser.js.map +1 -1
  379. package/lib/cjs/tile/B3dmTileIO.js +7 -0
  380. package/lib/cjs/tile/B3dmTileIO.js.map +1 -1
  381. package/lib/cjs/tile/CompositeTileIO.js +3 -0
  382. package/lib/cjs/tile/CompositeTileIO.js.map +1 -1
  383. package/lib/cjs/tile/ElementGraphics.js.map +1 -1
  384. package/lib/cjs/tile/GltfTileIO.js +4 -3
  385. package/lib/cjs/tile/GltfTileIO.js.map +1 -1
  386. package/lib/cjs/tile/I3dmTileIO.js +8 -0
  387. package/lib/cjs/tile/I3dmTileIO.js.map +1 -1
  388. package/lib/cjs/tile/IModelTileIO.d.ts +2 -2
  389. package/lib/cjs/tile/IModelTileIO.js +26 -3
  390. package/lib/cjs/tile/IModelTileIO.js.map +1 -1
  391. package/lib/cjs/tile/PntsTileIO.js +5 -0
  392. package/lib/cjs/tile/PntsTileIO.js.map +1 -1
  393. package/lib/cjs/tile/TileIO.js +2 -0
  394. package/lib/cjs/tile/TileIO.js.map +1 -1
  395. package/lib/cjs/tile/TileMetadata.js +9 -1
  396. package/lib/cjs/tile/TileMetadata.js.map +1 -1
  397. package/lib/cjs/tile/Tileset3dSchema.js.map +1 -1
  398. package/lib/esm/AmbientOcclusion.js +17 -9
  399. package/lib/esm/AmbientOcclusion.js.map +1 -1
  400. package/lib/esm/AnalysisStyle.d.ts +0 -3
  401. package/lib/esm/AnalysisStyle.d.ts.map +1 -1
  402. package/lib/esm/AnalysisStyle.js +20 -4
  403. package/lib/esm/AnalysisStyle.js.map +1 -1
  404. package/lib/esm/Atmosphere.js +39 -21
  405. package/lib/esm/Atmosphere.js.map +1 -1
  406. package/lib/esm/AuthorizationClient.js.map +1 -1
  407. package/lib/esm/BackgroundMapProvider.js +4 -0
  408. package/lib/esm/BackgroundMapProvider.js.map +1 -1
  409. package/lib/esm/BackgroundMapSettings.js +19 -0
  410. package/lib/esm/BackgroundMapSettings.js.map +1 -1
  411. package/lib/esm/Base64EncodedString.js.map +1 -1
  412. package/lib/esm/BlobReader.js +8 -6
  413. package/lib/esm/BlobReader.js.map +1 -1
  414. package/lib/esm/BriefcaseTypes.d.ts +2 -2
  415. package/lib/esm/BriefcaseTypes.d.ts.map +1 -1
  416. package/lib/esm/BriefcaseTypes.js.map +1 -1
  417. package/lib/esm/Camera.js +3 -0
  418. package/lib/esm/Camera.js.map +1 -1
  419. package/lib/esm/ChangedElements.js.map +1 -1
  420. package/lib/esm/ChangedEntities.js.map +1 -1
  421. package/lib/esm/ChangesetProps.d.ts +1 -1
  422. package/lib/esm/ChangesetProps.js.map +1 -1
  423. package/lib/esm/ClipStyle.js +31 -5
  424. package/lib/esm/ClipStyle.js.map +1 -1
  425. package/lib/esm/Code.d.ts +0 -5
  426. package/lib/esm/Code.d.ts.map +1 -1
  427. package/lib/esm/Code.js +16 -11
  428. package/lib/esm/Code.js.map +1 -1
  429. package/lib/esm/ColorByName.js.map +1 -1
  430. package/lib/esm/ColorDef.js +11 -10
  431. package/lib/esm/ColorDef.js.map +1 -1
  432. package/lib/esm/CommonLoggerCategory.js.map +1 -1
  433. package/lib/esm/ConcurrentQuery.d.ts +37 -1
  434. package/lib/esm/ConcurrentQuery.d.ts.map +1 -1
  435. package/lib/esm/ConcurrentQuery.js +16 -3
  436. package/lib/esm/ConcurrentQuery.js.map +1 -1
  437. package/lib/esm/ContextRealityModel.js +53 -27
  438. package/lib/esm/ContextRealityModel.js.map +1 -1
  439. package/lib/esm/ContourDisplay.js +40 -5
  440. package/lib/esm/ContourDisplay.js.map +1 -1
  441. package/lib/esm/DisplayStyleSettings.js +95 -63
  442. package/lib/esm/DisplayStyleSettings.js.map +1 -1
  443. package/lib/esm/ECSchemaProps.js.map +1 -1
  444. package/lib/esm/ECSqlReader.d.ts +2 -0
  445. package/lib/esm/ECSqlReader.d.ts.map +1 -1
  446. package/lib/esm/ECSqlReader.js +56 -50
  447. package/lib/esm/ECSqlReader.js.map +1 -1
  448. package/lib/esm/ECSqlTypes.js.map +1 -1
  449. package/lib/esm/ElementMesh.js.map +1 -1
  450. package/lib/esm/ElementProps.d.ts.map +1 -1
  451. package/lib/esm/ElementProps.js +8 -4
  452. package/lib/esm/ElementProps.js.map +1 -1
  453. package/lib/esm/EmphasizeElementsProps.js.map +1 -1
  454. package/lib/esm/EntityProps.d.ts +25 -2
  455. package/lib/esm/EntityProps.d.ts.map +1 -1
  456. package/lib/esm/EntityProps.js +39 -0
  457. package/lib/esm/EntityProps.js.map +1 -1
  458. package/lib/esm/EntityReference.js.map +1 -1
  459. package/lib/esm/Environment.js +25 -2
  460. package/lib/esm/Environment.js.map +1 -1
  461. package/lib/esm/FeatureIndex.js +15 -6
  462. package/lib/esm/FeatureIndex.js.map +1 -1
  463. package/lib/esm/FeatureSymbology.d.ts +25 -73
  464. package/lib/esm/FeatureSymbology.d.ts.map +1 -1
  465. package/lib/esm/FeatureSymbology.js +88 -103
  466. package/lib/esm/FeatureSymbology.js.map +1 -1
  467. package/lib/esm/FeatureTable.d.ts +6 -108
  468. package/lib/esm/FeatureTable.d.ts.map +1 -1
  469. package/lib/esm/FeatureTable.js +11 -324
  470. package/lib/esm/FeatureTable.js.map +1 -1
  471. package/lib/esm/Fonts.d.ts +68 -10
  472. package/lib/esm/Fonts.d.ts.map +1 -1
  473. package/lib/esm/Fonts.js +19 -4
  474. package/lib/esm/Fonts.js.map +1 -1
  475. package/lib/esm/Frustum.js +2 -2
  476. package/lib/esm/Frustum.js.map +1 -1
  477. package/lib/esm/GenericInstanceFilter.js.map +1 -1
  478. package/lib/esm/GeoCoordinateServices.d.ts +1 -0
  479. package/lib/esm/GeoCoordinateServices.d.ts.map +1 -1
  480. package/lib/esm/GeoCoordinateServices.js +2 -1
  481. package/lib/esm/GeoCoordinateServices.js.map +1 -1
  482. package/lib/esm/GeometryContainment.js.map +1 -1
  483. package/lib/esm/GeometryParams.js +58 -0
  484. package/lib/esm/GeometryParams.js.map +1 -1
  485. package/lib/esm/GeometrySummary.js.map +1 -1
  486. package/lib/esm/Gradient.d.ts +3 -4
  487. package/lib/esm/Gradient.d.ts.map +1 -1
  488. package/lib/esm/Gradient.js +21 -19
  489. package/lib/esm/Gradient.js.map +1 -1
  490. package/lib/esm/GraphicParams.js +14 -12
  491. package/lib/esm/GraphicParams.js.map +1 -1
  492. package/lib/esm/GroundPlane.js +8 -2
  493. package/lib/esm/GroundPlane.js.map +1 -1
  494. package/lib/esm/HSLColor.js +6 -0
  495. package/lib/esm/HSLColor.js.map +1 -1
  496. package/lib/esm/HSVColor.js +6 -0
  497. package/lib/esm/HSVColor.js.map +1 -1
  498. package/lib/esm/HiddenLine.d.ts +17 -18
  499. package/lib/esm/HiddenLine.d.ts.map +1 -1
  500. package/lib/esm/HiddenLine.js +24 -5
  501. package/lib/esm/HiddenLine.js.map +1 -1
  502. package/lib/esm/Hilite.js +10 -0
  503. package/lib/esm/Hilite.js.map +1 -1
  504. package/lib/esm/IModel.d.ts +3 -12
  505. package/lib/esm/IModel.d.ts.map +1 -1
  506. package/lib/esm/IModel.js +47 -23
  507. package/lib/esm/IModel.js.map +1 -1
  508. package/lib/esm/IModelError.d.ts +0 -2
  509. package/lib/esm/IModelError.d.ts.map +1 -1
  510. package/lib/esm/IModelError.js +2 -1
  511. package/lib/esm/IModelError.js.map +1 -1
  512. package/lib/esm/IModelVersion.js +4 -0
  513. package/lib/esm/IModelVersion.js.map +1 -1
  514. package/lib/esm/ITwinError.d.ts +63 -27
  515. package/lib/esm/ITwinError.d.ts.map +1 -1
  516. package/lib/esm/ITwinError.js +87 -44
  517. package/lib/esm/ITwinError.js.map +1 -1
  518. package/lib/esm/Image.d.ts +22 -8
  519. package/lib/esm/Image.d.ts.map +1 -1
  520. package/lib/esm/Image.js +19 -4
  521. package/lib/esm/Image.js.map +1 -1
  522. package/lib/esm/IpcAppProps.d.ts +2 -0
  523. package/lib/esm/IpcAppProps.d.ts.map +1 -1
  524. package/lib/esm/IpcAppProps.js.map +1 -1
  525. package/lib/esm/LightSettings.js +39 -1
  526. package/lib/esm/LightSettings.js.map +1 -1
  527. package/lib/esm/LinePixels.js.map +1 -1
  528. package/lib/esm/Localization.d.ts +0 -10
  529. package/lib/esm/Localization.d.ts.map +1 -1
  530. package/lib/esm/Localization.js +0 -1
  531. package/lib/esm/Localization.js.map +1 -1
  532. package/lib/esm/MapImagerySettings.js +3 -2
  533. package/lib/esm/MapImagerySettings.js.map +1 -1
  534. package/lib/esm/MapLayerSettings.d.ts +20 -0
  535. package/lib/esm/MapLayerSettings.d.ts.map +1 -1
  536. package/lib/esm/MapLayerSettings.js +50 -1
  537. package/lib/esm/MapLayerSettings.js.map +1 -1
  538. package/lib/esm/MassProperties.d.ts +2 -0
  539. package/lib/esm/MassProperties.d.ts.map +1 -1
  540. package/lib/esm/MassProperties.js.map +1 -1
  541. package/lib/esm/MaterialProps.js.map +1 -1
  542. package/lib/esm/ModelClipGroup.js +6 -0
  543. package/lib/esm/ModelClipGroup.js.map +1 -1
  544. package/lib/esm/ModelGeometryChanges.js.map +1 -1
  545. package/lib/esm/ModelProps.js.map +1 -1
  546. package/lib/esm/NativeAppProps.js.map +1 -1
  547. package/lib/esm/OctEncodedNormal.js +4 -0
  548. package/lib/esm/OctEncodedNormal.js.map +1 -1
  549. package/lib/esm/PlanProjectionSettings.d.ts +1 -2
  550. package/lib/esm/PlanProjectionSettings.d.ts.map +1 -1
  551. package/lib/esm/PlanProjectionSettings.js +8 -1
  552. package/lib/esm/PlanProjectionSettings.js.map +1 -1
  553. package/lib/esm/PlanarClipMask.d.ts +0 -12
  554. package/lib/esm/PlanarClipMask.d.ts.map +1 -1
  555. package/lib/esm/PlanarClipMask.js +24 -2
  556. package/lib/esm/PlanarClipMask.js.map +1 -1
  557. package/lib/esm/QPoint.d.ts +5 -5
  558. package/lib/esm/QPoint.d.ts.map +1 -1
  559. package/lib/esm/QPoint.js +37 -29
  560. package/lib/esm/QPoint.js.map +1 -1
  561. package/lib/esm/RealityDataAccessProps.js.map +1 -1
  562. package/lib/esm/RealityModelDisplaySettings.js +81 -4
  563. package/lib/esm/RealityModelDisplaySettings.js.map +1 -1
  564. package/lib/esm/RenderMaterial.d.ts +0 -43
  565. package/lib/esm/RenderMaterial.d.ts.map +1 -1
  566. package/lib/esm/RenderMaterial.js +6 -51
  567. package/lib/esm/RenderMaterial.js.map +1 -1
  568. package/lib/esm/RenderPolyline.d.ts +36 -0
  569. package/lib/esm/RenderPolyline.d.ts.map +1 -0
  570. package/lib/esm/RenderPolyline.js +23 -0
  571. package/lib/esm/RenderPolyline.js.map +1 -0
  572. package/lib/esm/RenderSchedule.d.ts +1 -2
  573. package/lib/esm/RenderSchedule.d.ts.map +1 -1
  574. package/lib/esm/RenderSchedule.js +138 -11
  575. package/lib/esm/RenderSchedule.js.map +1 -1
  576. package/lib/esm/RenderTexture.d.ts +5 -23
  577. package/lib/esm/RenderTexture.d.ts.map +1 -1
  578. package/lib/esm/RenderTexture.js +13 -16
  579. package/lib/esm/RenderTexture.js.map +1 -1
  580. package/lib/esm/RgbColor.js +3 -0
  581. package/lib/esm/RgbColor.js.map +1 -1
  582. package/lib/esm/RpcInterface.d.ts.map +1 -1
  583. package/lib/esm/RpcInterface.js +8 -2
  584. package/lib/esm/RpcInterface.js.map +1 -1
  585. package/lib/esm/RpcManager.js.map +1 -1
  586. package/lib/esm/SessionProps.js.map +1 -1
  587. package/lib/esm/SkyBox.js +17 -4
  588. package/lib/esm/SkyBox.js.map +1 -1
  589. package/lib/esm/SolarCalculate.js.map +1 -1
  590. package/lib/esm/SolarShadows.js +5 -1
  591. package/lib/esm/SolarShadows.js.map +1 -1
  592. package/lib/esm/SpatialClassification.js +19 -1
  593. package/lib/esm/SpatialClassification.js.map +1 -1
  594. package/lib/esm/SubCategoryAppearance.js +35 -1
  595. package/lib/esm/SubCategoryAppearance.js.map +1 -1
  596. package/lib/esm/SubCategoryOverride.js +16 -2
  597. package/lib/esm/SubCategoryOverride.js.map +1 -1
  598. package/lib/esm/TerrainSettings.d.ts +0 -7
  599. package/lib/esm/TerrainSettings.d.ts.map +1 -1
  600. package/lib/esm/TerrainSettings.js +19 -0
  601. package/lib/esm/TerrainSettings.js.map +1 -1
  602. package/lib/esm/TextureMapping.d.ts +17 -14
  603. package/lib/esm/TextureMapping.d.ts.map +1 -1
  604. package/lib/esm/TextureMapping.js +47 -19
  605. package/lib/esm/TextureMapping.js.map +1 -1
  606. package/lib/esm/TextureProps.js.map +1 -1
  607. package/lib/esm/ThematicDisplay.js +53 -2
  608. package/lib/esm/ThematicDisplay.js.map +1 -1
  609. package/lib/esm/Thumbnail.d.ts +1 -1
  610. package/lib/esm/Thumbnail.js.map +1 -1
  611. package/lib/esm/TileProps.js.map +1 -1
  612. package/lib/esm/Tween.js +28 -19
  613. package/lib/esm/Tween.js.map +1 -1
  614. package/lib/esm/TxnAction.js.map +1 -1
  615. package/lib/esm/ViewDetails.js +10 -6
  616. package/lib/esm/ViewDetails.js.map +1 -1
  617. package/lib/esm/ViewFlags.d.ts +1 -3
  618. package/lib/esm/ViewFlags.d.ts.map +1 -1
  619. package/lib/esm/ViewFlags.js +86 -5
  620. package/lib/esm/ViewFlags.js.map +1 -1
  621. package/lib/esm/ViewProps.d.ts +2 -6
  622. package/lib/esm/ViewProps.d.ts.map +1 -1
  623. package/lib/esm/ViewProps.js.map +1 -1
  624. package/lib/esm/WhiteOnWhiteReversalSettings.js +7 -2
  625. package/lib/esm/WhiteOnWhiteReversalSettings.js.map +1 -1
  626. package/lib/esm/annotation/TextAnnotation.d.ts +3 -2
  627. package/lib/esm/annotation/TextAnnotation.d.ts.map +1 -1
  628. package/lib/esm/annotation/TextAnnotation.js +13 -2
  629. package/lib/esm/annotation/TextAnnotation.js.map +1 -1
  630. package/lib/esm/annotation/TextBlock.d.ts +17 -0
  631. package/lib/esm/annotation/TextBlock.d.ts.map +1 -1
  632. package/lib/esm/annotation/TextBlock.js +41 -6
  633. package/lib/esm/annotation/TextBlock.js.map +1 -1
  634. package/lib/esm/annotation/TextBlockGeometryProps.js.map +1 -1
  635. package/lib/esm/annotation/TextBlockLayoutResult.js.map +1 -1
  636. package/lib/esm/annotation/TextStyle.js +65 -19
  637. package/lib/esm/annotation/TextStyle.js.map +1 -1
  638. package/lib/esm/core-common.d.ts +1 -2
  639. package/lib/esm/core-common.d.ts.map +1 -1
  640. package/lib/esm/core-common.js +1 -2
  641. package/lib/esm/core-common.js.map +1 -1
  642. package/lib/esm/domains/FunctionalElementProps.js.map +1 -1
  643. package/lib/esm/domains/GenericElementProps.js.map +1 -1
  644. package/lib/esm/geometry/AdditionalTransform.js +12 -0
  645. package/lib/esm/geometry/AdditionalTransform.js.map +1 -1
  646. package/lib/esm/geometry/AreaPattern.js +17 -0
  647. package/lib/esm/geometry/AreaPattern.js.map +1 -1
  648. package/lib/esm/geometry/BoundingSphere.js +4 -0
  649. package/lib/esm/geometry/BoundingSphere.js.map +1 -1
  650. package/lib/esm/geometry/Cartographic.js +23 -20
  651. package/lib/esm/geometry/Cartographic.js.map +1 -1
  652. package/lib/esm/geometry/CoordinateReferenceSystem.js +62 -0
  653. package/lib/esm/geometry/CoordinateReferenceSystem.js.map +1 -1
  654. package/lib/esm/geometry/ElementGeometry.js +26 -8
  655. package/lib/esm/geometry/ElementGeometry.js.map +1 -1
  656. package/lib/esm/geometry/ElementGeometryFB.js +54 -108
  657. package/lib/esm/geometry/ElementGeometryFB.js.map +1 -1
  658. package/lib/esm/geometry/FrustumPlanes.js +1 -0
  659. package/lib/esm/geometry/FrustumPlanes.js.map +1 -1
  660. package/lib/esm/geometry/GeodeticDatum.js +100 -0
  661. package/lib/esm/geometry/GeodeticDatum.js.map +1 -1
  662. package/lib/esm/geometry/GeodeticEllipsoid.js +16 -0
  663. package/lib/esm/geometry/GeodeticEllipsoid.js.map +1 -1
  664. package/lib/esm/geometry/GeometryStream.js +19 -6
  665. package/lib/esm/geometry/GeometryStream.js.map +1 -1
  666. package/lib/esm/geometry/ImageGraphic.js +10 -0
  667. package/lib/esm/geometry/ImageGraphic.js.map +1 -1
  668. package/lib/esm/geometry/LineStyle.js +14 -0
  669. package/lib/esm/geometry/LineStyle.js.map +1 -1
  670. package/lib/esm/geometry/Placement.js +6 -0
  671. package/lib/esm/geometry/Placement.js.map +1 -1
  672. package/lib/esm/geometry/Projection.js +75 -0
  673. package/lib/esm/geometry/Projection.js.map +1 -1
  674. package/lib/esm/geometry/TextString.js +18 -0
  675. package/lib/esm/geometry/TextString.js.map +1 -1
  676. package/lib/esm/{BackendTypes.d.ts → internal/BackendTypes.d.ts} +1 -0
  677. package/lib/esm/internal/BackendTypes.d.ts.map +1 -0
  678. package/lib/esm/internal/BackendTypes.js.map +1 -0
  679. package/lib/esm/internal/PackedFeatureTable.d.ts +111 -0
  680. package/lib/esm/internal/PackedFeatureTable.d.ts.map +1 -0
  681. package/lib/esm/internal/PackedFeatureTable.js +352 -0
  682. package/lib/esm/internal/PackedFeatureTable.js.map +1 -0
  683. package/lib/esm/internal/RenderMaterialParams.d.ts +47 -0
  684. package/lib/esm/internal/RenderMaterialParams.d.ts.map +1 -0
  685. package/lib/esm/internal/RenderMaterialParams.js +64 -0
  686. package/lib/esm/internal/RenderMaterialParams.js.map +1 -0
  687. package/lib/esm/internal/RenderMesh.d.ts +52 -0
  688. package/lib/esm/internal/RenderMesh.d.ts.map +1 -0
  689. package/lib/esm/{Render.js → internal/RenderMesh.js} +11 -29
  690. package/lib/esm/internal/RenderMesh.js.map +1 -0
  691. package/lib/esm/internal/RenderTextureParams.d.ts +25 -0
  692. package/lib/esm/internal/RenderTextureParams.d.ts.map +1 -0
  693. package/lib/esm/internal/RenderTextureParams.js +33 -0
  694. package/lib/esm/internal/RenderTextureParams.js.map +1 -0
  695. package/lib/esm/internal/Snapping.js.map +1 -1
  696. package/lib/esm/internal/cross-package.d.ts +5 -0
  697. package/lib/esm/internal/cross-package.d.ts.map +1 -1
  698. package/lib/esm/internal/cross-package.js +4 -1
  699. package/lib/esm/internal/cross-package.js.map +1 -1
  700. package/lib/esm/ipc/IpcSession.js +1 -0
  701. package/lib/esm/ipc/IpcSession.js.map +1 -1
  702. package/lib/esm/ipc/IpcSocket.d.ts +3 -0
  703. package/lib/esm/ipc/IpcSocket.d.ts.map +1 -1
  704. package/lib/esm/ipc/IpcSocket.js.map +1 -1
  705. package/lib/esm/ipc/IpcWebSocket.js +7 -6
  706. package/lib/esm/ipc/IpcWebSocket.js.map +1 -1
  707. package/lib/esm/ipc/IpcWebSocketTransport.js +8 -7
  708. package/lib/esm/ipc/IpcWebSocketTransport.js.map +1 -1
  709. package/lib/esm/rpc/DevToolsRpcInterface.js +6 -6
  710. package/lib/esm/rpc/DevToolsRpcInterface.js.map +1 -1
  711. package/lib/esm/rpc/IModelReadRpcInterface.js +8 -11
  712. package/lib/esm/rpc/IModelReadRpcInterface.js.map +1 -1
  713. package/lib/esm/rpc/IModelTileRpcInterface.js +4 -4
  714. package/lib/esm/rpc/IModelTileRpcInterface.js.map +1 -1
  715. package/lib/esm/rpc/SnapshotIModelRpcInterface.js +4 -4
  716. package/lib/esm/rpc/SnapshotIModelRpcInterface.js.map +1 -1
  717. package/lib/esm/rpc/TestRpcManager.js +1 -4
  718. package/lib/esm/rpc/TestRpcManager.js.map +1 -1
  719. package/lib/esm/rpc/core/RpcConfiguration.js +51 -64
  720. package/lib/esm/rpc/core/RpcConfiguration.js.map +1 -1
  721. package/lib/esm/rpc/core/RpcConstants.js.map +1 -1
  722. package/lib/esm/rpc/core/RpcControl.js +29 -38
  723. package/lib/esm/rpc/core/RpcControl.js.map +1 -1
  724. package/lib/esm/rpc/core/RpcInvocation.js +19 -13
  725. package/lib/esm/rpc/core/RpcInvocation.js.map +1 -1
  726. package/lib/esm/rpc/core/RpcMarshaling.d.ts +1 -4
  727. package/lib/esm/rpc/core/RpcMarshaling.d.ts.map +1 -1
  728. package/lib/esm/rpc/core/RpcMarshaling.js +2 -1
  729. package/lib/esm/rpc/core/RpcMarshaling.js.map +1 -1
  730. package/lib/esm/rpc/core/RpcOperation.js +29 -31
  731. package/lib/esm/rpc/core/RpcOperation.js.map +1 -1
  732. package/lib/esm/rpc/core/RpcPendingQueue.js +17 -16
  733. package/lib/esm/rpc/core/RpcPendingQueue.js.map +1 -1
  734. package/lib/esm/rpc/core/RpcProtocol.js +32 -30
  735. package/lib/esm/rpc/core/RpcProtocol.js.map +1 -1
  736. package/lib/esm/rpc/core/RpcPush.js +15 -8
  737. package/lib/esm/rpc/core/RpcPush.js.map +1 -1
  738. package/lib/esm/rpc/core/RpcRegistry.d.ts.map +1 -1
  739. package/lib/esm/rpc/core/RpcRegistry.js +10 -9
  740. package/lib/esm/rpc/core/RpcRegistry.js.map +1 -1
  741. package/lib/esm/rpc/core/RpcRequest.d.ts +2 -2
  742. package/lib/esm/rpc/core/RpcRequest.d.ts.map +1 -1
  743. package/lib/esm/rpc/core/RpcRequest.js +51 -29
  744. package/lib/esm/rpc/core/RpcRequest.js.map +1 -1
  745. package/lib/esm/rpc/core/RpcRequestContext.js.map +1 -1
  746. package/lib/esm/rpc/core/RpcRoutingToken.js +4 -2
  747. package/lib/esm/rpc/core/RpcRoutingToken.js.map +1 -1
  748. package/lib/esm/rpc/core/RpcSessionInvocation.js +5 -10
  749. package/lib/esm/rpc/core/RpcSessionInvocation.js.map +1 -1
  750. package/lib/esm/rpc/web/BentleyCloudRpcManager.js +11 -17
  751. package/lib/esm/rpc/web/BentleyCloudRpcManager.js.map +1 -1
  752. package/lib/esm/rpc/web/BentleyCloudRpcProtocol.js +16 -19
  753. package/lib/esm/rpc/web/BentleyCloudRpcProtocol.js.map +1 -1
  754. package/lib/esm/rpc/web/OpenAPI.js +2 -0
  755. package/lib/esm/rpc/web/OpenAPI.js.map +1 -1
  756. package/lib/esm/rpc/web/RpcMultipart.d.ts +1 -1
  757. package/lib/esm/rpc/web/RpcMultipart.d.ts.map +1 -1
  758. package/lib/esm/rpc/web/RpcMultipart.js +14 -13
  759. package/lib/esm/rpc/web/RpcMultipart.js.map +1 -1
  760. package/lib/esm/rpc/web/WebAppRpcLogging.d.ts +3 -0
  761. package/lib/esm/rpc/web/WebAppRpcLogging.d.ts.map +1 -1
  762. package/lib/esm/rpc/web/WebAppRpcLogging.js +1 -6
  763. package/lib/esm/rpc/web/WebAppRpcLogging.js.map +1 -1
  764. package/lib/esm/rpc/web/WebAppRpcProtocol.d.ts +1 -1
  765. package/lib/esm/rpc/web/WebAppRpcProtocol.d.ts.map +1 -1
  766. package/lib/esm/rpc/web/WebAppRpcProtocol.js +6 -6
  767. package/lib/esm/rpc/web/WebAppRpcProtocol.js.map +1 -1
  768. package/lib/esm/rpc/web/WebAppRpcRequest.d.ts.map +1 -1
  769. package/lib/esm/rpc/web/WebAppRpcRequest.js +27 -27
  770. package/lib/esm/rpc/web/WebAppRpcRequest.js.map +1 -1
  771. package/lib/esm/rpc/web/multipart/RpcMultipartParser.d.ts +0 -2
  772. package/lib/esm/rpc/web/multipart/RpcMultipartParser.d.ts.map +1 -1
  773. package/lib/esm/rpc/web/multipart/RpcMultipartParser.js +14 -8
  774. package/lib/esm/rpc/web/multipart/RpcMultipartParser.js.map +1 -1
  775. package/lib/esm/tile/B3dmTileIO.js +7 -0
  776. package/lib/esm/tile/B3dmTileIO.js.map +1 -1
  777. package/lib/esm/tile/CompositeTileIO.js +3 -0
  778. package/lib/esm/tile/CompositeTileIO.js.map +1 -1
  779. package/lib/esm/tile/ElementGraphics.js.map +1 -1
  780. package/lib/esm/tile/GltfTileIO.js +4 -3
  781. package/lib/esm/tile/GltfTileIO.js.map +1 -1
  782. package/lib/esm/tile/I3dmTileIO.js +8 -0
  783. package/lib/esm/tile/I3dmTileIO.js.map +1 -1
  784. package/lib/esm/tile/IModelTileIO.d.ts +2 -2
  785. package/lib/esm/tile/IModelTileIO.js +26 -3
  786. package/lib/esm/tile/IModelTileIO.js.map +1 -1
  787. package/lib/esm/tile/PntsTileIO.js +5 -0
  788. package/lib/esm/tile/PntsTileIO.js.map +1 -1
  789. package/lib/esm/tile/TileIO.js +2 -0
  790. package/lib/esm/tile/TileIO.js.map +1 -1
  791. package/lib/esm/tile/TileMetadata.js +9 -1
  792. package/lib/esm/tile/TileMetadata.js.map +1 -1
  793. package/lib/esm/tile/Tileset3dSchema.js.map +1 -1
  794. package/package.json +14 -14
  795. package/lib/cjs/BackendTypes.d.ts.map +0 -1
  796. package/lib/cjs/BackendTypes.js.map +0 -1
  797. package/lib/cjs/Render.d.ts +0 -85
  798. package/lib/cjs/Render.d.ts.map +0 -1
  799. package/lib/cjs/Render.js.map +0 -1
  800. package/lib/esm/BackendTypes.d.ts.map +0 -1
  801. package/lib/esm/BackendTypes.js.map +0 -1
  802. package/lib/esm/Render.d.ts +0 -85
  803. package/lib/esm/Render.d.ts.map +0 -1
  804. package/lib/esm/Render.js.map +0 -1
  805. /package/lib/cjs/{BackendTypes.js → internal/BackendTypes.js} +0 -0
  806. /package/lib/esm/{BackendTypes.js → internal/BackendTypes.js} +0 -0
@@ -11,11 +11,15 @@ exports.RenderTexture = void 0;
11
11
  const core_bentley_1 = require("@itwin/core-bentley");
12
12
  /** Represents a texture image applied to a surface during rendering.
13
13
  * A RenderTexture is typically - but not always - associated with a [[RenderMaterial]].
14
- * @see [RenderSystem.createTextureFromImage]($frontend) to obtain a texture from an HTML image.
14
+ * @see [RenderSystem.createTexture]($frontend) to obtain a texture.
15
15
  * @see [RenderSystem.createTextureFromElement]($frontend) to obtain a texture from a [Texture]($backend) element.
16
16
  * @public
17
17
  */
18
18
  class RenderTexture {
19
+ /** Indicates the type of texture. */
20
+ type;
21
+ /** Used for ordered comparisons, e.g. in DisplayParams.compareForMerge */
22
+ _guid;
19
23
  get isTileSection() { return RenderTexture.Type.TileSection === this.type; }
20
24
  get isGlyph() { return RenderTexture.Type.Glyph === this.type; }
21
25
  get isSkyBox() { return RenderTexture.Type.SkyBox === this.type; }
@@ -23,6 +27,14 @@ class RenderTexture {
23
27
  this.type = type;
24
28
  this._guid = core_bentley_1.Guid.createValue();
25
29
  }
30
+ /** Releases any WebGL resources owned by this texture.
31
+ * For a texture created by a [RenderSystem]($frontend) for which [CreateTextureArgs.ownership]($frontend) was specified as "external",
32
+ * the caller is responsible for invoking this method when it is finished using the texture; otherwise, the [RenderSystem]($frontend) will handle
33
+ * its disposal.
34
+ */
35
+ [Symbol.dispose]() {
36
+ this.dispose(); // eslint-disable-line @typescript-eslint/no-deprecated
37
+ }
26
38
  /** An [OrderedComparator]($bentley) that compares this texture against `other`. */
27
39
  compare(other) {
28
40
  return (0, core_bentley_1.compareStrings)(this._guid, other._guid);
@@ -47,20 +59,5 @@ exports.RenderTexture = RenderTexture;
47
59
  /** A gradient image used for thematic display. */
48
60
  Type[Type["ThematicGradient"] = 5] = "ThematicGradient";
49
61
  })(Type = RenderTexture.Type || (RenderTexture.Type = {}));
50
- /** Parameters used to construct a [[RenderTexture]].
51
- * @deprecated in 3.x. use RenderSystem.createTexture and CreateTextureArgs.
52
- * @public
53
- */
54
- class Params {
55
- constructor(key, type = RenderTexture.Type.Normal, isOwned = false) {
56
- this.key = key;
57
- this.type = type;
58
- this.isOwned = isOwned;
59
- }
60
- get isTileSection() { return RenderTexture.Type.TileSection === this.type; }
61
- get isGlyph() { return RenderTexture.Type.Glyph === this.type; }
62
- get isSkyBox() { return RenderTexture.Type.SkyBox === this.type; }
63
- }
64
- RenderTexture.Params = Params;
65
62
  })(RenderTexture || (exports.RenderTexture = RenderTexture = {}));
66
63
  //# sourceMappingURL=RenderTexture.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RenderTexture.js","sourceRoot":"","sources":["../../src/RenderTexture.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAgG;AAUhG;;;;;GAKG;AACH,MAAsB,aAAa;IAMjC,IAAW,aAAa,KAAc,OAAO,aAAa,CAAC,IAAI,CAAC,WAAW,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC5F,IAAW,OAAO,KAAc,OAAO,aAAa,CAAC,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAChF,IAAW,QAAQ,KAAc,OAAO,aAAa,CAAC,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAGlF,YAAsB,IAAwB;QAC5C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,mBAAI,CAAC,WAAW,EAAE,CAAC;IAClC,CAAC;IASD,mFAAmF;IAC5E,OAAO,CAAC,KAAoB;QACjC,OAAO,IAAA,6BAAc,EAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IACjD,CAAC;CACF;AA3BD,sCA2BC;AAED,cAAc;AACd,WAAiB,aAAa;IAC5B,0FAA0F;IAC1F,IAAY,IAaX;IAbD,WAAY,IAAI;QACd,kFAAkF;QAClF,mCAAM,CAAA;QACN,yGAAyG;QACzG,iCAAK,CAAA;QACL,mFAAmF;QACnF,6CAAW,CAAA;QACX,+DAA+D;QAC/D,mCAAM,CAAA;QACN,oHAAoH;QACpH,6DAAmB,CAAA;QACnB,kDAAkD;QAClD,uDAAgB,CAAA;IAClB,CAAC,EAbW,IAAI,GAAJ,kBAAI,KAAJ,kBAAI,QAaf;IAED;;;OAGG;IACH,MAAa,MAAM;QAYjB,YAAmB,GAAY,EAAE,OAA2B,aAAa,CAAC,IAAI,CAAC,MAAM,EAAE,UAAmB,KAAK;YAC7G,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;YACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;YACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACzB,CAAC;QAED,IAAW,aAAa,KAAc,OAAO,aAAa,CAAC,IAAI,CAAC,WAAW,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAC5F,IAAW,OAAO,KAAc,OAAO,aAAa,CAAC,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAChF,IAAW,QAAQ,KAAc,OAAO,aAAa,CAAC,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;KACnF;IArBY,oBAAM,SAqBlB,CAAA;AACH,CAAC,EA3CgB,aAAa,6BAAb,aAAa,QA2C7B","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Rendering\r\n */\r\n\r\nimport { compareStrings, Guid, GuidString, Id64String, IDisposable } from \"@itwin/core-bentley\";\r\n\r\n/** Identifies an image to be used to produce a [[RenderTexture]] for a given purpose - for example,\r\n * as part of a [[SkyBox]]. If the string is a valid `Id64String`, it refers to a persistent [Texture]($backend) element stored in an iModel.\r\n * Otherwise, it is interpreted as a Url resolving to an HTMLImageElement.\r\n * @see [[SkySphereImageProps.texture]] and [[SkyCubeImageProps]].\r\n * @public\r\n */\r\nexport type TextureImageSpec = Id64String | string;\r\n\r\n/** Represents a texture image applied to a surface during rendering.\r\n * A RenderTexture is typically - but not always - associated with a [[RenderMaterial]].\r\n * @see [RenderSystem.createTextureFromImage]($frontend) to obtain a texture from an HTML image.\r\n * @see [RenderSystem.createTextureFromElement]($frontend) to obtain a texture from a [Texture]($backend) element.\r\n * @public\r\n */\r\nexport abstract class RenderTexture implements IDisposable {\r\n /** Indicates the type of texture. */\r\n public readonly type: RenderTexture.Type;\r\n /** Used for ordered comparisons, e.g. in DisplayParams.compareForMerge */\r\n private readonly _guid: GuidString;\r\n\r\n public get isTileSection(): boolean { return RenderTexture.Type.TileSection === this.type; }\r\n public get isGlyph(): boolean { return RenderTexture.Type.Glyph === this.type; }\r\n public get isSkyBox(): boolean { return RenderTexture.Type.SkyBox === this.type; }\r\n public abstract get bytesUsed(): number;\r\n\r\n protected constructor(type: RenderTexture.Type) {\r\n this.type = type;\r\n this._guid = Guid.createValue();\r\n }\r\n\r\n /** Releases any WebGL resources owned by this texture.\r\n * For a texture created by a [RenderSystem]($frontend) for which [CreateTextureArgs.ownership]($frontend) was specified as \"external\",\r\n * the caller is responsible for invoking this method when it is finished using the texture; otherwise, the [RenderSystem]($frontend) will handle\r\n * its disposal.\r\n */\r\n public abstract dispose(): void;\r\n\r\n /** An [OrderedComparator]($bentley) that compares this texture against `other`. */\r\n public compare(other: RenderTexture): number {\r\n return compareStrings(this._guid, other._guid);\r\n }\r\n}\r\n\r\n/** @public */\r\nexport namespace RenderTexture {\r\n /** The types of [[RenderTexture]]s that can be created by a [RenderSystem]($frontend). */\r\n export enum Type {\r\n /** An image applied to a surface, with support for mip-mapping and repetition. */\r\n Normal,\r\n /** An image containing any number of text glyphs, used for efficiently rendering readable small text. */\r\n Glyph,\r\n /** A non-repeating image with no mip-maps, used for example for reality models. */\r\n TileSection,\r\n /** A three-dimensional texture used for rendering a skybox. */\r\n SkyBox,\r\n /** A non-repeating image with mip-maps and and anisotropic filtering, used for map tiles when draped on terrain. */\r\n FilteredTileSection,\r\n /** A gradient image used for thematic display. */\r\n ThematicGradient,\r\n }\r\n\r\n /** Parameters used to construct a [[RenderTexture]].\r\n * @deprecated in 3.x. use RenderSystem.createTexture and CreateTextureArgs.\r\n * @public\r\n */\r\n export class Params {\r\n /** A string uniquely identifying this texture within the context of an [[IModel]]. Typically this is the element Id of the corresponding [Texture]($backend) element.\r\n * Textures created on the front-end generally have no key.\r\n */\r\n public readonly key?: string;\r\n /** Indicates the type of texture. */\r\n public readonly type: RenderTexture.Type;\r\n /** Indicates that some object is managing the lifetime of this texture and will take care of calling its dispose function appropriately.\r\n * An unowned texture associated with a [RenderGraphic]($frontend) will be disposed when the RenderGraphic is disposed.\r\n */\r\n public readonly isOwned: boolean;\r\n\r\n public constructor(key?: string, type: RenderTexture.Type = RenderTexture.Type.Normal, isOwned: boolean = false) {\r\n this.key = key;\r\n this.type = type;\r\n this.isOwned = isOwned;\r\n }\r\n\r\n public get isTileSection(): boolean { return RenderTexture.Type.TileSection === this.type; }\r\n public get isGlyph(): boolean { return RenderTexture.Type.Glyph === this.type; }\r\n public get isSkyBox(): boolean { return RenderTexture.Type.SkyBox === this.type; }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"RenderTexture.js","sourceRoot":"","sources":["../../src/RenderTexture.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAmF;AAUnF;;;;;GAKG;AACH,MAAsB,aAAa;IACjC,qCAAqC;IACrB,IAAI,CAAqB;IACzC,0EAA0E;IACzD,KAAK,CAAa;IAEnC,IAAW,aAAa,KAAc,OAAO,aAAa,CAAC,IAAI,CAAC,WAAW,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC5F,IAAW,OAAO,KAAc,OAAO,aAAa,CAAC,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAChF,IAAW,QAAQ,KAAc,OAAO,aAAa,CAAC,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAGlF,YAAsB,IAAwB;QAC5C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,mBAAI,CAAC,WAAW,EAAE,CAAC;IAClC,CAAC;IAED;;;;OAIG;IACI,CAAC,MAAM,CAAC,OAAO,CAAC;QACrB,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,uDAAuD;IACzE,CAAC;IAKD,mFAAmF;IAC5E,OAAO,CAAC,KAAoB;QACjC,OAAO,IAAA,6BAAc,EAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IACjD,CAAC;CACF;AAhCD,sCAgCC;AAED,cAAc;AACd,WAAiB,aAAa;IAC5B,0FAA0F;IAC1F,IAAY,IAaX;IAbD,WAAY,IAAI;QACd,kFAAkF;QAClF,mCAAM,CAAA;QACN,yGAAyG;QACzG,iCAAK,CAAA;QACL,mFAAmF;QACnF,6CAAW,CAAA;QACX,+DAA+D;QAC/D,mCAAM,CAAA;QACN,oHAAoH;QACpH,6DAAmB,CAAA;QACnB,kDAAkD;QAClD,uDAAgB,CAAA;IAClB,CAAC,EAbW,IAAI,GAAJ,kBAAI,KAAJ,kBAAI,QAaf;AACH,CAAC,EAhBgB,aAAa,6BAAb,aAAa,QAgB7B","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 Rendering\n */\n\nimport { compareStrings, Guid, GuidString, Id64String } from \"@itwin/core-bentley\";\n\n/** Identifies an image to be used to produce a [[RenderTexture]] for a given purpose - for example,\n * as part of a [[SkyBox]]. If the string is a valid `Id64String`, it refers to a persistent [Texture]($backend) element stored in an iModel.\n * Otherwise, it is interpreted as a Url resolving to an HTMLImageElement.\n * @see [[SkySphereImageProps.texture]] and [[SkyCubeImageProps]].\n * @public\n */\nexport type TextureImageSpec = Id64String | string;\n\n/** Represents a texture image applied to a surface during rendering.\n * A RenderTexture is typically - but not always - associated with a [[RenderMaterial]].\n * @see [RenderSystem.createTexture]($frontend) to obtain a texture.\n * @see [RenderSystem.createTextureFromElement]($frontend) to obtain a texture from a [Texture]($backend) element.\n * @public\n */\nexport abstract class RenderTexture implements Disposable {\n /** Indicates the type of texture. */\n public readonly type: RenderTexture.Type;\n /** Used for ordered comparisons, e.g. in DisplayParams.compareForMerge */\n private readonly _guid: GuidString;\n\n public get isTileSection(): boolean { return RenderTexture.Type.TileSection === this.type; }\n public get isGlyph(): boolean { return RenderTexture.Type.Glyph === this.type; }\n public get isSkyBox(): boolean { return RenderTexture.Type.SkyBox === this.type; }\n public abstract get bytesUsed(): number;\n\n protected constructor(type: RenderTexture.Type) {\n this.type = type;\n this._guid = Guid.createValue();\n }\n\n /** Releases any WebGL resources owned by this texture.\n * For a texture created by a [RenderSystem]($frontend) for which [CreateTextureArgs.ownership]($frontend) was specified as \"external\",\n * the caller is responsible for invoking this method when it is finished using the texture; otherwise, the [RenderSystem]($frontend) will handle\n * its disposal.\n */\n public [Symbol.dispose]() {\n this.dispose(); // eslint-disable-line @typescript-eslint/no-deprecated\n }\n\n /** @deprecated in 5.0 Will be made protected in a future release. Use [Symbol.dispose] instead. */\n public abstract dispose(): void; // eslint-disable-line @typescript-eslint/no-deprecated\n\n /** An [OrderedComparator]($bentley) that compares this texture against `other`. */\n public compare(other: RenderTexture): number {\n return compareStrings(this._guid, other._guid);\n }\n}\n\n/** @public */\nexport namespace RenderTexture {\n /** The types of [[RenderTexture]]s that can be created by a [RenderSystem]($frontend). */\n export enum Type {\n /** An image applied to a surface, with support for mip-mapping and repetition. */\n Normal,\n /** An image containing any number of text glyphs, used for efficiently rendering readable small text. */\n Glyph,\n /** A non-repeating image with no mip-maps, used for example for reality models. */\n TileSection,\n /** A three-dimensional texture used for rendering a skybox. */\n SkyBox,\n /** A non-repeating image with mip-maps and and anisotropic filtering, used for map tiles when draped on terrain. */\n FilteredTileSection,\n /** A gradient image used for thematic display. */\n ThematicGradient,\n }\n}\n"]}
@@ -14,6 +14,9 @@ const ColorDef_1 = require("./ColorDef");
14
14
  * @public
15
15
  */
16
16
  class RgbColor {
17
+ r;
18
+ g;
19
+ b;
17
20
  /** Constructs from red, green, and blue components.
18
21
  * @param r Red
19
22
  * @param g Green
@@ -1 +1 @@
1
- {"version":3,"file":"RgbColor.js","sourceRoot":"","sources":["../../src/RgbColor.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAqD;AACrD,yCAAsC;AAYtC;;GAEG;AACH,MAAa,QAAQ;IACnB;;;;OAIG;IACH,YAAmC,CAAS,EAAkB,CAAS,EAAkB,CAAS;QAA/D,MAAC,GAAD,CAAC,CAAQ;QAAkB,MAAC,GAAD,CAAC,CAAQ;QAAkB,MAAC,GAAD,CAAC,CAAQ;QAChG,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;QAC7C,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;QAC7C,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;IAC/C,CAAC;IAED,gHAAgH;IACzG,MAAM,CAAC,YAAY,CAAC,QAAkB;QAC3C,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;QAC/B,OAAO,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;IACpD,CAAC;IAED;;;;OAIG;IACI,UAAU,CAAC,YAAY,GAAG,CAAC;QAChC,OAAO,mBAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC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AC,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IAC/G,CAAC;IAED,mIAAmI;IAC5H,WAAW;QAChB,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,WAAW,EAAE,CAAC;IACzC,CAAC;CACF;AAjED,4BAiEC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Symbology\r\n */\r\n\r\nimport { compareNumbers } from \"@itwin/core-bentley\";\r\nimport { ColorDef } from \"./ColorDef\";\r\n\r\n/** JSON representation of an [[RgbColor]], with each component an integer in the range [0, 255].\r\n * @public\r\n * @extensions\r\n */\r\nexport interface RgbColorProps {\r\n r: number;\r\n g: number;\r\n b: number;\r\n}\r\n\r\n/** An immutable representation of a color with red, green, and blue components each in the integer range [0, 255].\r\n * @public\r\n */\r\nexport class RgbColor {\r\n /** Constructs from red, green, and blue components.\r\n * @param r Red\r\n * @param g Green\r\n * @param b Blue\r\n */\r\n public constructor(public readonly r: number, public readonly g: number, public readonly b: number) {\r\n this.r = Math.max(0, Math.min(this.r, 0xff));\r\n this.g = Math.max(0, Math.min(this.g, 0xff));\r\n this.b = Math.max(0, Math.min(this.b, 0xff));\r\n }\r\n\r\n /** Constructs from the red, green, and blue components of a ColorDef. The transparency component is ignored. */\r\n public static fromColorDef(colorDef: ColorDef): RgbColor {\r\n const colors = colorDef.colors;\r\n return new RgbColor(colors.r, colors.g, colors.b);\r\n }\r\n\r\n /** Converts this RgbColor to a ColorDef.\r\n * @param transparency Value to use for the transparency component of the ColorDef.\r\n * @param out If defined, this ColorDef will be modified in-place and returned; otherwise a new ColorDef will be allocated.\r\n * @returns A ColorDef with RGB components equivalent to those of this RgbColor and transparency component as specified.\r\n */\r\n public toColorDef(transparency = 0): ColorDef {\r\n return ColorDef.from(this.r, this.g, this.b, transparency);\r\n }\r\n\r\n /** Convert this color to its JSON representation. */\r\n public toJSON(): RgbColorProps {\r\n return { r: this.r, g: this.g, b: this.b };\r\n }\r\n\r\n /** Create an RgbColor from its JSON representation.\r\n * If `json` is `undefined`, the result is pure white.\r\n */\r\n public static fromJSON(json: RgbColorProps | undefined): RgbColor {\r\n let r = 0xff;\r\n let g = 0xff;\r\n let b = 0xff;\r\n if (undefined !== json) {\r\n if (typeof json.r === \"number\")\r\n r = json.r;\r\n if (typeof json.g === \"number\")\r\n g = json.g;\r\n if (typeof json.b === \"number\")\r\n b = json.b;\r\n }\r\n\r\n return new RgbColor(r, g, b);\r\n }\r\n\r\n /** Returns true if this color's red, green, and blue components are identical to those of `other`. */\r\n public equals(other: RgbColor): boolean {\r\n return this.r === other.r && this.g === other.g && this.b === other.b;\r\n }\r\n\r\n /** Compare this color to another color using the rules of an [OrderedComparator]($bentley). */\r\n public compareTo(other: RgbColor): number {\r\n return compareNumbers(this.r, other.r) || compareNumbers(this.g, other.g) || compareNumbers(this.b, other.b);\r\n }\r\n\r\n /** Convert this color to a string in the form \"#rrggbb\" where the values are the hex digits of the respective color components. */\r\n public toHexString(): string {\r\n return this.toColorDef().toHexString();\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"RgbColor.js","sourceRoot":"","sources":["../../src/RgbColor.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAqD;AACrD,yCAAsC;AAYtC;;GAEG;AACH,MAAa,QAAQ;IAMgB;IAA2B;IAA2B;IALzF;;;;OAIG;IACH,YAAmC,CAAS,EAAkB,CAAS,EAAkB,CAAS;QAA/D,MAAC,GAAD,CAAC,CAAQ;QAAkB,MAAC,GAAD,CAAC,CAAQ;QAAkB,MAAC,GAAD,CAAC,CAAQ;QAChG,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,EAAE,IA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AAQ;gBAC5B,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;YACb,IAAI,OAAO,IAAI,CAAC,CAAC,KAAK,QAAQ;gBAC5B,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;QACf,CAAC;QAED,OAAO,IAAI,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAC/B,CAAC;IAED,sGAAsG;IAC/F,MAAM,CAAC,KAAe;QAC3B,OAAO,IAAI,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC;IACxE,CAAC;IAED,+FAA+F;IACxF,SAAS,CAAC,KAAe;QAC9B,OAAO,IAAA,6BAAc,EAAC,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,IAAA,6BAAc,EAAC,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,IAAA,6BAAc,EAAC,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IAC/G,CAAC;IAED,mIAAmI;IAC5H,WAAW;QAChB,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,WAAW,EAAE,CAAC;IACzC,CAAC;CACF;AAjED,4BAiEC","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 Symbology\n */\n\nimport { compareNumbers } from \"@itwin/core-bentley\";\nimport { ColorDef } from \"./ColorDef\";\n\n/** JSON representation of an [[RgbColor]], with each component an integer in the range [0, 255].\n * @public\n * @extensions\n */\nexport interface RgbColorProps {\n r: number;\n g: number;\n b: number;\n}\n\n/** An immutable representation of a color with red, green, and blue components each in the integer range [0, 255].\n * @public\n */\nexport class RgbColor {\n /** Constructs from red, green, and blue components.\n * @param r Red\n * @param g Green\n * @param b Blue\n */\n public constructor(public readonly r: number, public readonly g: number, public readonly b: number) {\n this.r = Math.max(0, Math.min(this.r, 0xff));\n this.g = Math.max(0, Math.min(this.g, 0xff));\n this.b = Math.max(0, Math.min(this.b, 0xff));\n }\n\n /** Constructs from the red, green, and blue components of a ColorDef. The transparency component is ignored. */\n public static fromColorDef(colorDef: ColorDef): RgbColor {\n const colors = colorDef.colors;\n return new RgbColor(colors.r, colors.g, colors.b);\n }\n\n /** Converts this RgbColor to a ColorDef.\n * @param transparency Value to use for the transparency component of the ColorDef.\n * @param out If defined, this ColorDef will be modified in-place and returned; otherwise a new ColorDef will be allocated.\n * @returns A ColorDef with RGB components equivalent to those of this RgbColor and transparency component as specified.\n */\n public toColorDef(transparency = 0): ColorDef {\n return ColorDef.from(this.r, this.g, this.b, transparency);\n }\n\n /** Convert this color to its JSON representation. */\n public toJSON(): RgbColorProps {\n return { r: this.r, g: this.g, b: this.b };\n }\n\n /** Create an RgbColor from its JSON representation.\n * If `json` is `undefined`, the result is pure white.\n */\n public static fromJSON(json: RgbColorProps | undefined): RgbColor {\n let r = 0xff;\n let g = 0xff;\n let b = 0xff;\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\n return new RgbColor(r, g, b);\n }\n\n /** Returns true if this color's red, green, and blue components are identical to those of `other`. */\n public equals(other: RgbColor): boolean {\n return this.r === other.r && this.g === other.g && this.b === other.b;\n }\n\n /** Compare this color to another color using the rules of an [OrderedComparator]($bentley). */\n public compareTo(other: RgbColor): number {\n return compareNumbers(this.r, other.r) || compareNumbers(this.g, other.g) || compareNumbers(this.b, other.b);\n }\n\n /** Convert this color to a string in the form \"#rrggbb\" where the values are the hex digits of the respective color components. */\n public toHexString(): string {\n return this.toColorDef().toHexString();\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"RpcInterface.d.ts","sourceRoot":"","sources":["../../src/RpcInterface.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAGzF,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAW7D;;;;GAIG;AACH,MAAM,WAAW,sBAAsB,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY;IAAI,SAAS,EAAE,CAAC,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,gBAAgB,EAAE,MAAM,CAAA;CAAE;AAEhJ;;;GAGG;AACH,MAAM,MAAM,0BAA0B,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY,IAAI,UAAU,CAAC,CAAC;AAS5F;;;GAGG;AACH,8BAAsB,YAAY;IAEhC,OAAO,CAAC,MAAM,CAAC,QAAQ;IAQvB,OAAO,CAAC,MAAM,CAAC,QAAQ;IAYvB,8JAA8J;WAChJ,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO;IAwB7E;;OAEG;IACH,SAAgB,aAAa,EAAE,gBAAgB,CAAC;IAEhD,gBAAgB;IAChB,SAAgB,OAAO,EAAE,eAAe,CAAC;IAEzC,YAAY;gBACO,OAAO,GAAE,eAAyC;IAKrE,8DAA8D;IACjD,OAAO,CAAC,CAAC,GAAG,GAAG,EAAE,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,CAAC,CAAC;IAgBjE,gBAAgB;IACT,qBAAqB,EAAE,wBAAwB,GAAG,SAAS,CAAC;CACpE"}
1
+ {"version":3,"file":"RpcInterface.d.ts","sourceRoot":"","sources":["../../src/RpcInterface.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAGzF,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAW7D;;;;GAIG;AACH,MAAM,WAAW,sBAAsB,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY;IAAI,SAAS,EAAE,CAAC,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,gBAAgB,EAAE,MAAM,CAAA;CAAE;AAEhJ;;;GAGG;AACH,MAAM,MAAM,0BAA0B,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY,IAAI,UAAU,CAAC,CAAC;AAS5F;;;GAGG;AACH,8BAAsB,YAAY;IAEhC,OAAO,CAAC,MAAM,CAAC,QAAQ;IAQvB,OAAO,CAAC,MAAM,CAAC,QAAQ;IAYvB,8JAA8J;WAChJ,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO;IAwB7E;;OAEG;IACH,SAAgB,aAAa,EAAE,gBAAgB,CAAC;IAEhD,gBAAgB;IAChB,SAAgB,OAAO,EAAE,eAAe,CAAC;IAEzC,YAAY;gBACO,OAAO,GAAE,eAAyC;IAKrE,8DAA8D;IACjD,OAAO,CAAC,CAAC,GAAG,GAAG,EAAE,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,CAAC,CAAC;IAgBjE,gBAAgB;IACD,qBAAqB,EAAE,wBAAwB,GAAG,SAAS,CAAC;CAC5E"}
@@ -57,6 +57,12 @@ class RpcInterface {
57
57
  // patch difference is fine. If minor versions differ, compatible as long as backend minor version is greater
58
58
  return difference === "patch" || (difference === "minor" && frontendSemver.minor < backendSemver.minor);
59
59
  }
60
+ /** The configuration for the RPC interface.
61
+ * @internal
62
+ */
63
+ configuration;
64
+ /** @internal */
65
+ routing;
60
66
  /** @beta */
61
67
  constructor(routing = RpcRoutingToken_1.RpcRoutingToken.default) {
62
68
  this.routing = routing;
@@ -141,7 +147,7 @@ async function handleNotFound(request, status, dispatch) {
141
147
  let resubmitted = false;
142
148
  RpcRequest_1.RpcRequest.notFoundHandlers.raiseEvent(request, status.responseValue, async () => {
143
149
  if (resubmitted) {
144
- throw new IModelError_1.IModelError(IModelError_1.BentleyStatus.ERROR, `Already resubmitted using this handler.`);
150
+ throw new IModelError_1.IModelError(core_bentley_1.BentleyStatus.ERROR, `Already resubmitted using this handler.`);
145
151
  }
146
152
  resubmitted = true;
147
153
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"RpcInterface.js","sourceRoot":"","sources":["../../src/RpcInterface.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,kEAAyF;AACzF,wDAAyD;AACzD,sDAAkE;AAClE,gEAA6D;AAC7D,iDAAqE;AAGrE,+CAA2E;AAC3E,0DAA4E;AAC5E,sDAAiD;AAyBjD;;;GAGG;AACH,MAAsB,YAAY;IAExB,MAAM,CAAC,QAAQ,CAAC,OAAmB,EAAE,QAAoB;QAC/D,OAAO,OAAO,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;YACjD,OAAO,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;gBAC1C,OAAO,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;oBAC1C,OAAO,CAAC,UAAU,KAAK,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;wBACzD,MAAM,CAAC;IACjB,CAAC;IAEO,MAAM,CAAC,QAAQ,CAAC,OAAe;QACrC,+CAA+C;QAC/C,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACpC,sDAAsD;QACtD,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAEnC,MAAM,GAAG,GAAe,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,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AAO,EAAE,MAAM,CAAC,aAAoC,EAAE,KAAK,IAAI,EAAE;YACtG,IAAI,WAAW,EAAE,CAAC;gBAChB,MAAM,IAAI,yBAAW,CAAC,2BAAa,CAAC,KAAK,EAAE,yCAAyC,CAAC,CAAC;YACxF,CAAC;YAED,WAAW,GAAG,IAAI,CAAC;YAEnB,IAAI,CAAC;gBACH,MAAM,QAAQ,GAAG,MAAM,QAAQ,EAAE,CAAC;gBAClC,OAAO,CAAC,QAAQ,CAAC,CAAC;YACpB,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,sEAAsE;YACrF,CAAC;QACH,CAAC,EAAE,MAAM,CAAC,CAAC;IACb,CAAC,CAAC,CAAC;AACL,CAAC;AAED,KAAK,UAAU,eAAe;IAC5B,MAAM,IAAI,4BAAc,EAAE,CAAC;AAC7B,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module RpcInterface\r\n */\r\nimport { RpcConfiguration, RpcConfigurationSupplier } from \"./rpc/core/RpcConfiguration\";\r\nimport { CURRENT_REQUEST } from \"./rpc/core/RpcRegistry\";\r\nimport { aggregateLoad, RpcRequest } from \"./rpc/core/RpcRequest\";\r\nimport { RpcRoutingToken } from \"./rpc/core/RpcRoutingToken\";\r\nimport { InterceptedRpcRequest, IpcSession } from \"./ipc/IpcSession\";\r\nimport { RpcSerializedValue } from \"./rpc/core/RpcMarshaling\";\r\nimport { RpcManagedStatus } from \"./rpc/core/RpcProtocol\";\r\nimport { BentleyStatus, IModelError, NoContentError } from \"./IModelError\";\r\nimport { RpcRequestEvent, RpcRequestStatus } from \"./rpc/core/RpcConstants\";\r\nimport { BeDuration } from \"@itwin/core-bentley\";\r\nimport { RpcNotFoundResponse } from \"./rpc/core/RpcControl\";\r\n\r\n/* eslint-disable @typescript-eslint/no-deprecated */\r\n\r\n/**\r\n * Specifies the required static properties of an RpcInterface class.\r\n * These properties are used to identify RPC requests and responses.\r\n * @beta\r\n */\r\nexport interface RpcInterfaceDefinition<T extends RpcInterface = RpcInterface> { prototype: T, interfaceName: string, interfaceVersion: string }\r\n\r\n/**\r\n * A class that implements the operations of an RPC interface.\r\n * @beta\r\n */\r\nexport type RpcInterfaceImplementation<T extends RpcInterface = RpcInterface> = new () => T;\r\n\r\ninterface SemverType {\r\n major: number;\r\n minor: number;\r\n patch: number;\r\n prerelease?: string;\r\n}\r\n\r\n/** An RPC interface is a set of operations exposed by a service that a client can call, using configurable protocols,\r\n * in a platform-independent way. TheRpcInterface class is the base class for RPC interface definitions and implementations.\r\n * @public\r\n */\r\nexport abstract class RpcInterface {\r\n\r\n private static findDiff(backend: SemverType, frontend: SemverType) {\r\n return backend.major !== frontend.major ? \"major\" :\r\n backend.minor !== frontend.minor ? \"minor\" :\r\n backend.patch !== frontend.patch ? \"patch\" :\r\n backend.prerelease !== frontend.prerelease ? \"prerelease\" :\r\n \"same\";\r\n }\r\n\r\n private static parseVer(version: string): SemverType {\r\n // separate the version from the prerelease tag\r\n const parts = version.split(/[:-]/);\r\n // Split the major.minor.path into separate components\r\n const prefix = parts[0].split(\".\");\r\n\r\n const ver: SemverType = { major: Number(prefix[0]), minor: Number(prefix[1]), patch: Number(prefix[2]) };\r\n if (parts.length > 1)\r\n ver.prerelease = parts[1];\r\n return ver;\r\n }\r\n\r\n /** Determines whether the backend version of an RPC interface is compatible (according to semantic versioning) with the frontend version of the interface. */\r\n public static isVersionCompatible(backend: string, frontend: string): boolean {\r\n if (backend === frontend)\r\n return true; // most common case, versions are identical\r\n\r\n const backendSemver = this.parseVer(backend);\r\n const frontendSemver = this.parseVer(frontend);\r\n\r\n // if either has a prerelease tag, they are not compatible unless version strings are identical\r\n if (backendSemver.prerelease || frontendSemver.prerelease)\r\n return false;\r\n\r\n const difference = this.findDiff(backendSemver, frontendSemver);\r\n // If the major versions are different, the versions are not compatible\r\n if (difference === \"major\")\r\n return false;\r\n\r\n // special case for major version 0. If patch difference, backend patch must be greater than frontend patch\r\n if (backendSemver.major === 0)\r\n return (difference === \"patch\" && frontendSemver.patch < backendSemver.patch);\r\n\r\n // patch difference is fine. If minor versions differ, compatible as long as backend minor version is greater\r\n return difference === \"patch\" || (difference === \"minor\" && frontendSemver.minor < backendSemver.minor);\r\n }\r\n\r\n /** The configuration for the RPC interface.\r\n * @internal\r\n */\r\n public readonly configuration: RpcConfiguration;\r\n\r\n /** @internal */\r\n public readonly routing: RpcRoutingToken;\r\n\r\n /** @beta */\r\n public constructor(routing: RpcRoutingToken = RpcRoutingToken.default) {\r\n this.routing = routing;\r\n this.configuration = RpcConfiguration.supply(this);\r\n }\r\n\r\n /** Obtains the implementation result for an RPC operation. */\r\n public async forward<T = any>(parameters: IArguments): Promise<T> {\r\n const parametersCompat = (arguments.length === 1 && typeof (parameters) === \"object\") ? parameters : arguments;\r\n const parametersArray = Array.isArray(parametersCompat) ? parametersCompat : Array.prototype.slice.call(parametersCompat);\r\n const operationName = parametersArray.pop();\r\n\r\n const session = IpcSession.active;\r\n if (session) {\r\n return intercept(session, this, operationName, parametersArray);\r\n } else {\r\n const request = new (this.configuration.protocol.requestType as any)(this, operationName, parametersArray) as RpcRequest;\r\n request.submit(); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n (this as any)[CURRENT_REQUEST] = request;\r\n return request.response;\r\n }\r\n }\r\n\r\n /** @internal */\r\n public configurationSupplier: RpcConfigurationSupplier | undefined;\r\n}\r\n\r\nRpcInterface.prototype.configurationSupplier = undefined;\r\n\r\nclass InterceptedRequest extends RpcRequest {\r\n protected override async load(): Promise<RpcSerializedValue> { throw new Error(); }\r\n protected override async send(): Promise<number> { throw new Error(); }\r\n protected override setHeader(_name: string, _value: string): void { throw new Error(); }\r\n}\r\n\r\nasync function intercept(session: IpcSession, client: RpcInterface, operation: string, parameters: any[]) {\r\n const request = new InterceptedRequest(client, operation, []);\r\n (client as any)[CURRENT_REQUEST] = request;\r\n\r\n const context = await client.configuration.protocol.serialize(request);\r\n request.parameters = parameters;\r\n\r\n const info: InterceptedRpcRequest = {\r\n definition: {\r\n interfaceName: context.operation.interfaceDefinition,\r\n interfaceVersion: context.operation.interfaceVersion,\r\n },\r\n operation,\r\n parameters,\r\n context: {\r\n applicationId: context.applicationId,\r\n applicationVersion: context.applicationVersion,\r\n id: context.id,\r\n sessionId: context.sessionId,\r\n protocolVersion: (context.protocolVersion || 0).toString(),\r\n },\r\n };\r\n\r\n const dispatch = async () => {\r\n aggregateLoad.lastRequest = new Date().getTime();\r\n\r\n const response = await session.handleRpc(info);\r\n\r\n aggregateLoad.lastResponse = new Date().getTime();\r\n\r\n if (typeof (response) === \"object\" && response.hasOwnProperty(\"iTwinRpcCoreResponse\") && response.hasOwnProperty(\"managedStatus\")) {\r\n const status: RpcManagedStatus = response;\r\n\r\n if (status.managedStatus === \"pending\") {\r\n return handlePending(request, status, dispatch);\r\n } else if (status.managedStatus === \"notFound\") {\r\n return handleNotFound(request, status, dispatch);\r\n } else if (status.managedStatus === \"noContent\") {\r\n return handleNoContent();\r\n }\r\n } else {\r\n return response;\r\n }\r\n };\r\n\r\n return dispatch();\r\n}\r\n\r\nasync function handlePending(request: InterceptedRequest, status: RpcManagedStatus, dispatch: () => Promise<any>) {\r\n request._status = RpcRequestStatus.Pending;\r\n request._extendedStatus = (status.responseValue as { message: string }).message;\r\n RpcRequest.events.raiseEvent(RpcRequestEvent.PendingUpdateReceived, request);\r\n\r\n const delay = request.operation.policy.retryInterval(request.client.configuration);\r\n\r\n await BeDuration.wait(delay);\r\n return dispatch();\r\n}\r\n\r\nasync function handleNotFound(request: InterceptedRequest, status: RpcManagedStatus, dispatch: () => Promise<any>) {\r\n return new Promise((resolve, reject) => {\r\n let resubmitted = false;\r\n\r\n RpcRequest.notFoundHandlers.raiseEvent(request, status.responseValue as RpcNotFoundResponse, async () => {\r\n if (resubmitted) {\r\n throw new IModelError(BentleyStatus.ERROR, `Already resubmitted using this handler.`);\r\n }\r\n\r\n resubmitted = true;\r\n\r\n try {\r\n const response = await dispatch();\r\n resolve(response);\r\n } catch (err) {\r\n reject(err); // eslint-disable-line @typescript-eslint/prefer-promise-reject-errors\r\n }\r\n }, reject);\r\n });\r\n}\r\n\r\nasync function handleNoContent() {\r\n throw new NoContentError();\r\n}\r\n"]}
1
+ {"version":3,"file":"RpcInterface.js","sourceRoot":"","sources":["../../src/RpcInterface.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,kEAAyF;AACzF,wDAAyD;AACzD,sDAAkE;AAClE,gEAA6D;AAC7D,iDAAqE;AAGrE,+CAA4D;AAC5D,0DAA4E;AAC5E,sDAAgE;AAyBhE;;;GAGG;AACH,MAAsB,YAAY;IAExB,MAAM,CAAC,QAAQ,CAAC,OAAmB,EAAE,QAAoB;QAC/D,OAAO,OAAO,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;YACjD,OAAO,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;gBAC1C,OAAO,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;oBAC1C,OAAO,CAAC,UAAU,KAAK,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;wBACzD,MAAM,CAAC;IACjB,CAAC;IAEO,MAAM,CAAC,QAAQ,CAAC,OAAe;QACrC,+CAA+C;QAC/C,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACpC,sDAAsD;QACtD,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAEnC,MAAM,GAAG,GAAe,EAAE,KAAK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AE,MAAwB,EAAE,QAA4B;IAC/G,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,IAAI,WAAW,GAAG,KAAK,CAAC;QAExB,uBAAU,CAAC,gBAAgB,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,CAAC,aAAoC,EAAE,KAAK,IAAI,EAAE;YACtG,IAAI,WAAW,EAAE,CAAC;gBAChB,MAAM,IAAI,yBAAW,CAAC,4BAAa,CAAC,KAAK,EAAE,yCAAyC,CAAC,CAAC;YACxF,CAAC;YAED,WAAW,GAAG,IAAI,CAAC;YAEnB,IAAI,CAAC;gBACH,MAAM,QAAQ,GAAG,MAAM,QAAQ,EAAE,CAAC;gBAClC,OAAO,CAAC,QAAQ,CAAC,CAAC;YACpB,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,sEAAsE;YACrF,CAAC;QACH,CAAC,EAAE,MAAM,CAAC,CAAC;IACb,CAAC,CAAC,CAAC;AACL,CAAC;AAED,KAAK,UAAU,eAAe;IAC5B,MAAM,IAAI,4BAAc,EAAE,CAAC;AAC7B,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 */\nimport { RpcConfiguration, RpcConfigurationSupplier } from \"./rpc/core/RpcConfiguration\";\nimport { CURRENT_REQUEST } from \"./rpc/core/RpcRegistry\";\nimport { aggregateLoad, RpcRequest } from \"./rpc/core/RpcRequest\";\nimport { RpcRoutingToken } from \"./rpc/core/RpcRoutingToken\";\nimport { InterceptedRpcRequest, IpcSession } from \"./ipc/IpcSession\";\nimport { RpcSerializedValue } from \"./rpc/core/RpcMarshaling\";\nimport { RpcManagedStatus } from \"./rpc/core/RpcProtocol\";\nimport { IModelError, NoContentError } from \"./IModelError\";\nimport { RpcRequestEvent, RpcRequestStatus } from \"./rpc/core/RpcConstants\";\nimport { BeDuration, BentleyStatus } from \"@itwin/core-bentley\";\nimport { RpcNotFoundResponse } from \"./rpc/core/RpcControl\";\n\n/* eslint-disable @typescript-eslint/no-deprecated */\n\n/**\n * Specifies the required static properties of an RpcInterface class.\n * These properties are used to identify RPC requests and responses.\n * @beta\n */\nexport interface RpcInterfaceDefinition<T extends RpcInterface = RpcInterface> { prototype: T, interfaceName: string, interfaceVersion: string }\n\n/**\n * A class that implements the operations of an RPC interface.\n * @beta\n */\nexport type RpcInterfaceImplementation<T extends RpcInterface = RpcInterface> = new () => T;\n\ninterface SemverType {\n major: number;\n minor: number;\n patch: number;\n prerelease?: string;\n}\n\n/** An RPC interface is a set of operations exposed by a service that a client can call, using configurable protocols,\n * in a platform-independent way. TheRpcInterface class is the base class for RPC interface definitions and implementations.\n * @public\n */\nexport abstract class RpcInterface {\n\n private static findDiff(backend: SemverType, frontend: SemverType) {\n return backend.major !== frontend.major ? \"major\" :\n backend.minor !== frontend.minor ? \"minor\" :\n backend.patch !== frontend.patch ? \"patch\" :\n backend.prerelease !== frontend.prerelease ? \"prerelease\" :\n \"same\";\n }\n\n private static parseVer(version: string): SemverType {\n // separate the version from the prerelease tag\n const parts = version.split(/[:-]/);\n // Split the major.minor.path into separate components\n const prefix = parts[0].split(\".\");\n\n const ver: SemverType = { major: Number(prefix[0]), minor: Number(prefix[1]), patch: Number(prefix[2]) };\n if (parts.length > 1)\n ver.prerelease = parts[1];\n return ver;\n }\n\n /** Determines whether the backend version of an RPC interface is compatible (according to semantic versioning) with the frontend version of the interface. */\n public static isVersionCompatible(backend: string, frontend: string): boolean {\n if (backend === frontend)\n return true; // most common case, versions are identical\n\n const backendSemver = this.parseVer(backend);\n const frontendSemver = this.parseVer(frontend);\n\n // if either has a prerelease tag, they are not compatible unless version strings are identical\n if (backendSemver.prerelease || frontendSemver.prerelease)\n return false;\n\n const difference = this.findDiff(backendSemver, frontendSemver);\n // If the major versions are different, the versions are not compatible\n if (difference === \"major\")\n return false;\n\n // special case for major version 0. If patch difference, backend patch must be greater than frontend patch\n if (backendSemver.major === 0)\n return (difference === \"patch\" && frontendSemver.patch < backendSemver.patch);\n\n // patch difference is fine. If minor versions differ, compatible as long as backend minor version is greater\n return difference === \"patch\" || (difference === \"minor\" && frontendSemver.minor < backendSemver.minor);\n }\n\n /** The configuration for the RPC interface.\n * @internal\n */\n public readonly configuration: RpcConfiguration;\n\n /** @internal */\n public readonly routing: RpcRoutingToken;\n\n /** @beta */\n public constructor(routing: RpcRoutingToken = RpcRoutingToken.default) {\n this.routing = routing;\n this.configuration = RpcConfiguration.supply(this);\n }\n\n /** Obtains the implementation result for an RPC operation. */\n public async forward<T = any>(parameters: IArguments): Promise<T> {\n const parametersCompat = (arguments.length === 1 && typeof (parameters) === \"object\") ? parameters : arguments;\n const parametersArray = Array.isArray(parametersCompat) ? parametersCompat : Array.prototype.slice.call(parametersCompat);\n const operationName = parametersArray.pop();\n\n const session = IpcSession.active;\n if (session) {\n return intercept(session, this, operationName, parametersArray);\n } else {\n const request = new (this.configuration.protocol.requestType as any)(this, operationName, parametersArray) as RpcRequest;\n request.submit(); // eslint-disable-line @typescript-eslint/no-floating-promises\n (this as any)[CURRENT_REQUEST] = request;\n return request.response;\n }\n }\n\n /** @internal */\n declare public configurationSupplier: RpcConfigurationSupplier | undefined;\n}\n\nRpcInterface.prototype.configurationSupplier = undefined;\n\nclass InterceptedRequest extends RpcRequest {\n protected override async load(): Promise<RpcSerializedValue> { throw new Error(); }\n protected override async send(): Promise<number> { throw new Error(); }\n protected override setHeader(_name: string, _value: string): void { throw new Error(); }\n}\n\nasync function intercept(session: IpcSession, client: RpcInterface, operation: string, parameters: any[]) {\n const request = new InterceptedRequest(client, operation, []);\n (client as any)[CURRENT_REQUEST] = request;\n\n const context = await client.configuration.protocol.serialize(request);\n request.parameters = parameters;\n\n const info: InterceptedRpcRequest = {\n definition: {\n interfaceName: context.operation.interfaceDefinition,\n interfaceVersion: context.operation.interfaceVersion,\n },\n operation,\n parameters,\n context: {\n applicationId: context.applicationId,\n applicationVersion: context.applicationVersion,\n id: context.id,\n sessionId: context.sessionId,\n protocolVersion: (context.protocolVersion || 0).toString(),\n },\n };\n\n const dispatch = async () => {\n aggregateLoad.lastRequest = new Date().getTime();\n\n const response = await session.handleRpc(info);\n\n aggregateLoad.lastResponse = new Date().getTime();\n\n if (typeof (response) === \"object\" && response.hasOwnProperty(\"iTwinRpcCoreResponse\") && response.hasOwnProperty(\"managedStatus\")) {\n const status: RpcManagedStatus = response;\n\n if (status.managedStatus === \"pending\") {\n return handlePending(request, status, dispatch);\n } else if (status.managedStatus === \"notFound\") {\n return handleNotFound(request, status, dispatch);\n } else if (status.managedStatus === \"noContent\") {\n return handleNoContent();\n }\n } else {\n return response;\n }\n };\n\n return dispatch();\n}\n\nasync function handlePending(request: InterceptedRequest, status: RpcManagedStatus, dispatch: () => Promise<any>) {\n request._status = RpcRequestStatus.Pending;\n request._extendedStatus = (status.responseValue as { message: string }).message;\n RpcRequest.events.raiseEvent(RpcRequestEvent.PendingUpdateReceived, request);\n\n const delay = request.operation.policy.retryInterval(request.client.configuration);\n\n await BeDuration.wait(delay);\n return dispatch();\n}\n\nasync function handleNotFound(request: InterceptedRequest, status: RpcManagedStatus, dispatch: () => Promise<any>) {\n return new Promise((resolve, reject) => {\n let resubmitted = false;\n\n RpcRequest.notFoundHandlers.raiseEvent(request, status.responseValue as RpcNotFoundResponse, async () => {\n if (resubmitted) {\n throw new IModelError(BentleyStatus.ERROR, `Already resubmitted using this handler.`);\n }\n\n resubmitted = true;\n\n try {\n const response = await dispatch();\n resolve(response);\n } catch (err) {\n reject(err); // eslint-disable-line @typescript-eslint/prefer-promise-reject-errors\n }\n }, reject);\n });\n}\n\nasync function handleNoContent() {\n throw new NoContentError();\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"RpcManager.js","sourceRoot":"","sources":["../../src/RpcManager.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C,CAAC;CACF;AA5CD,gCA4CC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module RpcInterface\r\n */\r\n\r\nimport { IModelRpcProps } from \"./IModel\";\r\nimport { RpcOperation } from \"./rpc/core/RpcOperation\";\r\nimport { RpcRegistry } from \"./rpc/core/RpcRegistry\";\r\nimport { RpcInterface, RpcInterfaceDefinition, RpcInterfaceImplementation } from \"./RpcInterface\";\r\nimport { RpcRoutingToken } from \"./rpc/core/RpcRoutingToken\";\r\n\r\n/** Describes the endpoints of an RPC interface.\r\n * @beta\r\n */\r\nexport interface RpcInterfaceEndpoints {\r\n interfaceName: string;\r\n interfaceVersion: string;\r\n operationNames: string[];\r\n compatible: boolean;\r\n}\r\n\r\n/** RPC interface management is concerned with coordination of access and configuration for RPC interfaces.\r\n * @beta\r\n */\r\nexport class RpcManager {\r\n /** Initializes an RPC interface class.\r\n * @note This function must be called on the frontend and on the backend for each RPC interface class used by an application.\r\n */\r\n public static initializeInterface<T extends RpcInterface>(definition: RpcInterfaceDefinition<T>): void {\r\n RpcRegistry.instance.initializeRpcInterface(definition);\r\n }\r\n\r\n /** Terminates an RPC interface class. */\r\n public static terminateInterface<T extends RpcInterface>(definition: RpcInterfaceDefinition<T>): void {\r\n RpcRegistry.instance.terminateRpcInterface(definition);\r\n }\r\n\r\n /** Returns the RPC client instance for the frontend. */\r\n public static getClientForInterface<T extends RpcInterface>(definition: RpcInterfaceDefinition<T>, routing: RpcRoutingToken = RpcRoutingToken.default): T {\r\n return RpcRegistry.instance.getClientForInterface(definition, routing);\r\n }\r\n\r\n /** Register the RPC implementation class for the backend. */\r\n public static registerImpl<TDefinition extends RpcInterface, TImplementation extends TDefinition>(definition: RpcInterfaceDefinition<TDefinition>, implementation: RpcInterfaceImplementation<TImplementation>): void {\r\n RpcRegistry.instance.registerImpl(definition, implementation);\r\n }\r\n\r\n /** Supply the instance of the RPC interface implementation class for the backend (optional). */\r\n public static supplyImplInstance<TDefinition extends RpcInterface, TImplementation extends TDefinition>(definition: RpcInterfaceDefinition<TDefinition>, instance: TImplementation): void {\r\n RpcRegistry.instance.supplyImplInstance(definition, instance);\r\n }\r\n\r\n /** Unregister the RPC implementation class for the backend. */\r\n public static unregisterImpl<TDefinition extends RpcInterface>(definition: RpcInterfaceDefinition<TDefinition>): void {\r\n RpcRegistry.instance.unregisterImpl(definition);\r\n }\r\n\r\n /** Describes the RPC interfaces and endpoints that are currently available from the backend.\r\n * @note Some endpoints may be marked incompatible if the frontend expected a different interface declaration than the backend supplied. RPC operations against an incompatible interface will fail.\r\n */\r\n public static async describeAvailableEndpoints(): Promise<RpcInterfaceEndpoints[]> {\r\n return RpcRegistry.instance.describeAvailableEndpoints();\r\n }\r\n\r\n /** Configures RPC protocols that employ iModel-based routing infrastructure. */\r\n public static setIModel(props: IModelRpcProps) {\r\n RpcOperation.fallbackToken = props;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"RpcManager.js","sourceRoot":"","sources":["../../src/RpcManager.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,0DAAuD;AACvD,wDAAqD;AAErD,gEAA6D;AAY7D;;GAEG;AACH,MAAa,UAAU;IACrB;;OAEG;IACI,MAAM,CAAC,mBAAmB,CAAyB,UAAqC;QAC7F,yBAAW,CAAC,QAAQ,CAAC,sBAAsB,CAAC,UAAU,CAAC,CAAC;IAC1D,CAAC;IAED,yCAAyC;IAClC,MAAM,CAAC,kBAAkB,CAAyB,UAAqC;QAC5F,yBAAW,CAAC,QAAQ,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;IACzD,CAAC;IAED,wDAAwD;IACjD,MAAM,CAAC,qBAAqB,CAAyB,UAAqC,EAAE,UAA2B,iCAAe,CAAC,OAAO;QACnJ,OAAO,yBAAW,CAAC,QAAQ,CAAC,qBAAqB,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IACzE,CAAC;IAED,6DAA6D;IACtD,MAAM,CAAC,YAAY,CAAwE,UAA+C,EAAE,cAA2D;QAC5M,yBAAW,CAAC,QAAQ,CAAC,YAAY,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;IAChE,CAAC;IAED,gGAAgG;IACzF,MAAM,CAAC,kBAAkB,CAAwE,UAA+C,EAAE,QAAyB;QAChL,yBAAW,CAAC,QAAQ,CAAC,kBAAkB,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;IAChE,CAAC;IAED,+DAA+D;IACxD,MAAM,CAAC,cAAc,CAAmC,UAA+C;QAC5G,yBAAW,CAAC,QAAQ,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IAClD,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,KAAK,CAAC,0BAA0B;QAC5C,OAAO,yBAAW,CAAC,QAAQ,CAAC,0BAA0B,EAAE,CAAC;IAC3D,CAAC;IAED,gFAAgF;IACzE,MAAM,CAAC,SAAS,CAAC,KAAqB;QAC3C,2BAAY,CAAC,aAAa,GAAG,KAAK,CAAC;IACrC,CAAC;CACF;AA5CD,gCA4CC","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 { IModelRpcProps } from \"./IModel\";\nimport { RpcOperation } from \"./rpc/core/RpcOperation\";\nimport { RpcRegistry } from \"./rpc/core/RpcRegistry\";\nimport { RpcInterface, RpcInterfaceDefinition, RpcInterfaceImplementation } from \"./RpcInterface\";\nimport { RpcRoutingToken } from \"./rpc/core/RpcRoutingToken\";\n\n/** Describes the endpoints of an RPC interface.\n * @beta\n */\nexport interface RpcInterfaceEndpoints {\n interfaceName: string;\n interfaceVersion: string;\n operationNames: string[];\n compatible: boolean;\n}\n\n/** RPC interface management is concerned with coordination of access and configuration for RPC interfaces.\n * @beta\n */\nexport class RpcManager {\n /** Initializes an RPC interface class.\n * @note This function must be called on the frontend and on the backend for each RPC interface class used by an application.\n */\n public static initializeInterface<T extends RpcInterface>(definition: RpcInterfaceDefinition<T>): void {\n RpcRegistry.instance.initializeRpcInterface(definition);\n }\n\n /** Terminates an RPC interface class. */\n public static terminateInterface<T extends RpcInterface>(definition: RpcInterfaceDefinition<T>): void {\n RpcRegistry.instance.terminateRpcInterface(definition);\n }\n\n /** Returns the RPC client instance for the frontend. */\n public static getClientForInterface<T extends RpcInterface>(definition: RpcInterfaceDefinition<T>, routing: RpcRoutingToken = RpcRoutingToken.default): T {\n return RpcRegistry.instance.getClientForInterface(definition, routing);\n }\n\n /** Register the RPC implementation class for the backend. */\n public static registerImpl<TDefinition extends RpcInterface, TImplementation extends TDefinition>(definition: RpcInterfaceDefinition<TDefinition>, implementation: RpcInterfaceImplementation<TImplementation>): void {\n RpcRegistry.instance.registerImpl(definition, implementation);\n }\n\n /** Supply the instance of the RPC interface implementation class for the backend (optional). */\n public static supplyImplInstance<TDefinition extends RpcInterface, TImplementation extends TDefinition>(definition: RpcInterfaceDefinition<TDefinition>, instance: TImplementation): void {\n RpcRegistry.instance.supplyImplInstance(definition, instance);\n }\n\n /** Unregister the RPC implementation class for the backend. */\n public static unregisterImpl<TDefinition extends RpcInterface>(definition: RpcInterfaceDefinition<TDefinition>): void {\n RpcRegistry.instance.unregisterImpl(definition);\n }\n\n /** Describes the RPC interfaces and endpoints that are currently available from the backend.\n * @note Some endpoints may be marked incompatible if the frontend expected a different interface declaration than the backend supplied. RPC operations against an incompatible interface will fail.\n */\n public static async describeAvailableEndpoints(): Promise<RpcInterfaceEndpoints[]> {\n return RpcRegistry.instance.describeAvailableEndpoints();\n }\n\n /** Configures RPC protocols that employ iModel-based routing infrastructure. */\n public static setIModel(props: IModelRpcProps) {\n RpcOperation.fallbackToken = props;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"SessionProps.js","sourceRoot":"","sources":["../../src/SessionProps.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module RpcInterface\r\n */\r\n\r\nimport { GuidString } from \"@itwin/core-bentley\";\r\n\r\n/** Properties that identify a session.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface SessionProps {\r\n /** Used for logging and usage tracking to identify the application */\r\n readonly applicationId: string;\r\n\r\n /** Used for logging and usage tracking to identify the application version */\r\n readonly applicationVersion: string;\r\n\r\n /** Used for logging to identify a session */\r\n readonly sessionId: GuidString;\r\n}\r\n\r\n"]}
1
+ {"version":3,"file":"SessionProps.js","sourceRoot":"","sources":["../../src/SessionProps.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG","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 { GuidString } from \"@itwin/core-bentley\";\n\n/** Properties that identify a session.\n * @public\n * @extensions\n */\nexport interface SessionProps {\n /** Used for logging and usage tracking to identify the application */\n readonly applicationId: string;\n\n /** Used for logging and usage tracking to identify the application version */\n readonly applicationVersion: string;\n\n /** Used for logging to identify a session */\n readonly sessionId: GuidString;\n}\n\n"]}
package/lib/cjs/SkyBox.js CHANGED
@@ -43,6 +43,13 @@ function colorDefFromJson(props) {
43
43
  * @public
44
44
  */
45
45
  class SkyGradient {
46
+ twoColor;
47
+ skyColor;
48
+ groundColor;
49
+ zenithColor;
50
+ nadirColor;
51
+ skyExponent;
52
+ groundExponent;
46
53
  constructor(args) {
47
54
  this.twoColor = args.twoColor ?? false;
48
55
  this.skyColor = args.skyColor ?? defaultSkyColor;
@@ -52,6 +59,8 @@ class SkyGradient {
52
59
  this.skyExponent = args.skyExponent ?? defaultExponent;
53
60
  this.groundExponent = args.groundExponent ?? defaultExponent;
54
61
  }
62
+ /** Default settings for a four-color gradient. */
63
+ static defaults = new SkyGradient({});
55
64
  /** Create a new gradient. Any properties not specified by `props` are initialized to their default values. */
56
65
  static create(props) {
57
66
  return props ? new this(props) : this.defaults;
@@ -101,16 +110,18 @@ class SkyGradient {
101
110
  }
102
111
  }
103
112
  exports.SkyGradient = SkyGradient;
104
- /** Default settings for a four-color gradient. */
105
- SkyGradient.defaults = new SkyGradient({});
106
113
  /** Describes how to draw a representation of a sky, as part of an [[Environment]].
107
114
  * @see [[SkyBoxProps]].
108
115
  * @public
109
116
  */
110
117
  class SkyBox {
118
+ /** The gradient settings, used if no cube or sphere images are supplied, or if the images cannot be loaded. */
119
+ gradient;
111
120
  constructor(gradient) {
112
121
  this.gradient = gradient;
113
122
  }
123
+ /** Default settings for a four-color gradient. */
124
+ static defaults = new SkyBox(SkyGradient.defaults);
114
125
  /** Create a skybox that displays the specified gradient, or the default gradient if none is supplied. */
115
126
  static createGradient(gradient) {
116
127
  return gradient ? new this(gradient) : this.defaults;
@@ -149,12 +160,12 @@ class SkyBox {
149
160
  }
150
161
  }
151
162
  exports.SkyBox = SkyBox;
152
- /** Default settings for a four-color gradient. */
153
- SkyBox.defaults = new SkyBox(SkyGradient.defaults);
154
163
  /** Describes how to draw a representation of a sky by mapping a single image to the interior of a sphere.
155
164
  * @public
156
165
  */
157
166
  class SkySphere extends SkyBox {
167
+ /** The image to map to the interior of the sphere. */
168
+ image;
158
169
  /** Create a new sky sphere using the specified image.
159
170
  * @param image The image to map to the interior of the sphere.
160
171
  * @param gradient Optionally overrides the default gradient settings used if the image cannot be obtained.
@@ -183,6 +194,8 @@ exports.SkySphere = SkySphere;
183
194
  * @public
184
195
  */
185
196
  class SkyCube extends SkyBox {
197
+ /** The images to map to each face of the cube. */
198
+ images;
186
199
  /** Create a new sky cube using the specified images.
187
200
  * @param images The images to map to each face of the cube.
188
201
  * @param gradient Optionally overrides the default gradient settings used if the images cannot be obtained.
@@ -1 +1 @@
1
- {"version":3,"file":"SkyBox.js","sourceRoot":"","sources":["../../src/SkyBox.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAgF;AAChF,yCAAqD;AAGrD;;;;GAIG;AACH,IAAY,eAaX;AAbD,WAAY,eAAe;IACzB,kEAAkE;IAClE,qDAAQ,CAAA;IACR;;OAEG;IACH,+DAAa,CAAA;IACb,kCAAkC;IAClC,mEAAe,CAAA;IACf;;OAEG;IACH,qDAAQ,CAAA;AACV,CAAC,EAbW,eAAe,+BAAf,eAAe,QAa1B;AA4GD,MAAM,kBAAkB,GAAG,mBAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AACxD,MAAM,kBAAkB,GAAG,mBAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AACvD,MAAM,iBAAiB,GAAG,mBAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;AACpD,MAAM,eAAe,GAAG,mBAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AACrD,MAAM,eAAe,GAAG,GAAG,CAAC;AAE5B,SAAS,gBAAgB,CAAC,KAAqB;IAC7C,OAAO,SAAS,KAAK,KAAK,CAAC,CAAC,CAAC,mBAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACpE,CAAC;AAQD;;;GAGG;AACH,MAAa,WAAW;IAStB,YAAoB,IAAoC;QACtD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC;QACvC,I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,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACpC,KAAK,CAAC,KAAK,GAAG;YACZ,IAAI,EAAE,eAAe,CAAC,IAAI;YAC1B,QAAQ,EAAE,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE;SAC7B,CAAC;QAEF,OAAO,KAAK,CAAC;IACf,CAAC;IAED,gBAAgB;IAChB,IAAoB,UAAU;QAC5B,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC;QACzB,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,mBAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IAClH,CAAC;CACF;AA7BD,0BA6BC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module DisplayStyles\r\n */\r\n\r\nimport { Id64, Id64String, NonFunctionPropertiesOf } from \"@itwin/core-bentley\";\r\nimport { ColorDef, ColorDefProps } from \"./ColorDef\";\r\nimport { TextureImageSpec } from \"./RenderTexture\";\r\n\r\n/** Supported types of [[SkyBox]] images.\r\n * @see [[SkyBoxImageProps]].\r\n * @public\r\n * @extensions\r\n */\r\nexport enum SkyBoxImageType {\r\n /** No image, indicating a [[SkyGradient]] should be displayed. */\r\n None = 0,\r\n /** A single image mapped to the surface of a sphere.\r\n * @see [[SkySphere]].\r\n */\r\n Spherical = 1,\r\n /** @internal not yet supported */\r\n Cylindrical = 2,\r\n /** Six images mapped to the faces of a cube.\r\n * @see [[SkyCube]].\r\n */\r\n Cube = 3,\r\n}\r\n\r\n/** JSON representation of the six images used by a [[SkyCube]].\r\n * Each property specifies the image for a face of the cube as either an image URL, or the Id of a [Texture]($backend) element.\r\n * Each image must be square and have the same dimensions as all the other images.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface SkyCubeProps {\r\n front: TextureImageSpec;\r\n back: TextureImageSpec;\r\n top: TextureImageSpec;\r\n bottom: TextureImageSpec;\r\n right: TextureImageSpec;\r\n left: TextureImageSpec;\r\n}\r\n\r\n/** JSON representation of the image used for a [[SkySphere]].\r\n * @see [[SkyBoxProps.image]].\r\n * @public\r\n */\r\nexport interface SkySphereImageProps {\r\n type: SkyBoxImageType.Spherical;\r\n texture: TextureImageSpec;\r\n /** @internal */\r\n textures?: never;\r\n}\r\n\r\n/** JSON representation of the images used for a [[SkyCube]].\r\n * @see [[SkyBoxProps.image]].\r\n * @public\r\n */\r\nexport interface SkyCubeImageProps {\r\n type: SkyBoxImageType.Cube;\r\n textures: SkyCubeProps;\r\n /** @internal */\r\n texture?: never;\r\n}\r\n\r\n/** JSON representation of the image(s) to be mapped to the surfaces of a [[SkyBox]].\r\n * @see [[SkyBoxProps.image]].\r\n * @public\r\n * @extensions\r\n */\r\nexport type SkyBoxImageProps = SkySphereImageProps | SkyCubeImageProps | { type?: SkyBoxImageType, texture?: never, textures?: never };\r\n\r\n/** JSON representation of a [[SkyBox]] that can be drawn as the background of a [ViewState3d]($frontend).\r\n * An object of this type can describe one of several types of sky box:\r\n * - A cube with a texture image mapped to each face; or\r\n * - A sphere with a single texture image mapped to its surface; or\r\n * - A sphere with a two- or four-color vertical [[Gradient]] mapped to its surface.\r\n *\r\n * Whether cuboid or spherical, the skybox is drawn as if the viewer and the contents of the view are contained within its interior.\r\n *\r\n * For a two-color gradient, the gradient transitions smoothly from the nadir color at the bottom of the sphere to the zenith color at the top of the sphere.\r\n * The sky and ground colors are unused, as are the sky and ground exponents.\r\n *\r\n * For a four-color gradient, a \"horizon\" is produced on the equator of the sphere, where the ground color and sky color meet. The lower half of the sphere transitions\r\n * smoothly from the ground color at the equator to the nadir color at the bottom, and the upper half transitions from the sky color at the equator to the zenith color at\r\n * the top of the sphere.\r\n *\r\n * The color and exponent properties are unused if one or more texture images are supplied.\r\n *\r\n * The skybox is ignored entirely when an atmosphere is displayed.\r\n *\r\n * @see [[DisplayStyle3dSettings.environment]] to define the skybox for a display style.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface SkyBoxProps {\r\n /** Whether or not the skybox should be displayed.\r\n * Default: false.\r\n */\r\n display?: boolean;\r\n /** For a [[SkyGradient]], if true, a 2-color gradient skybox is used instead of a 4-color.\r\n * Default: false.\r\n */\r\n twoColor?: boolean;\r\n /** The color of the sky at the horizon. Unused unless this is a four-color [[SkyGradient]].\r\n * Default: (143, 205, 255).\r\n */\r\n skyColor?: ColorDefProps;\r\n /** The color of the ground at the horizon. Unused unless this is a four-color [[SkyGradient]].\r\n * Default: (120, 143, 125).\r\n */\r\n groundColor?: ColorDefProps;\r\n /** The color of the top of the sphere.\r\n * Default: (54, 117, 255).\r\n */\r\n zenithColor?: ColorDefProps;\r\n /** The color of the bottom of the sphere.\r\n * Default: (40, 15, 0).\r\n */\r\n nadirColor?: ColorDefProps;\r\n /** For a 4-color [[SkyGradient]], controls speed of change from sky color to zenith color; otherwise unused.\r\n * Default: 4.0.\r\n */\r\n skyExponent?: number;\r\n /** For a 4-color [[SkyGradient]], controls speed of change from ground color to nadir color; otherwise unused.\r\n * Default: 4.0.\r\n */\r\n groundExponent?: number;\r\n /** The image(s), if any, to be mapped to the surfaces of the sphere or cube. If undefined, the skybox will be displayed as a gradient instead.\r\n * Default: undefined.\r\n */\r\n image?: SkyBoxImageProps;\r\n}\r\n\r\nconst defaultGroundColor = ColorDef.from(143, 205, 125);\r\nconst defaultZenithColor = ColorDef.from(54, 117, 255);\r\nconst defaultNadirColor = ColorDef.from(40, 125, 0);\r\nconst defaultSkyColor = ColorDef.from(142, 205, 255);\r\nconst defaultExponent = 4.0;\r\n\r\nfunction colorDefFromJson(props?: ColorDefProps): ColorDef | undefined {\r\n return undefined !== props ? ColorDef.fromJSON(props) : undefined;\r\n}\r\n\r\n/** A type containing all of the properties and none of the methods of [[SkyGradient]] with `readonly` modifiers removed.\r\n * @see [[SkyGradient.create]] and [[SkyGradient.clone]].\r\n * @public\r\n */\r\nexport type SkyGradientProperties = NonFunctionPropertiesOf<SkyGradient>;\r\n\r\n/** Describes how to map a two- or four-color [[Gradient]] to the interior of a sphere to produce a [[SkyBox]].\r\n * @see [[SkyBox.gradient]].\r\n * @public\r\n */\r\nexport class SkyGradient {\r\n public readonly twoColor: boolean;\r\n public readonly skyColor: ColorDef;\r\n public readonly groundColor: ColorDef;\r\n public readonly zenithColor: ColorDef;\r\n public readonly nadirColor: ColorDef;\r\n public readonly skyExponent: number;\r\n public readonly groundExponent: number;\r\n\r\n private constructor(args: Partial<SkyGradientProperties>) {\r\n this.twoColor = args.twoColor ?? false;\r\n this.skyColor = args.skyColor ?? defaultSkyColor;\r\n this.groundColor = args.groundColor ?? defaultGroundColor;\r\n this.nadirColor = args.nadirColor ?? defaultNadirColor;\r\n this.zenithColor = args.zenithColor ?? defaultZenithColor;\r\n this.skyExponent = args.skyExponent ?? defaultExponent;\r\n this.groundExponent = args.groundExponent ?? defaultExponent;\r\n }\r\n\r\n /** Default settings for a four-color gradient. */\r\n public static readonly defaults = new SkyGradient({});\r\n\r\n /** Create a new gradient. Any properties not specified by `props` are initialized to their default values. */\r\n public static create(props?: Partial<SkyGradientProperties>): SkyGradient {\r\n return props ? new this(props) : this.defaults;\r\n }\r\n\r\n /** Create from JSON representation. */\r\n public static fromJSON(props?: SkyBoxProps): SkyGradient {\r\n if (!props)\r\n return this.defaults;\r\n\r\n return new this({\r\n twoColor: props.twoColor,\r\n skyExponent: props.skyExponent,\r\n groundExponent: props.groundExponent,\r\n skyColor: colorDefFromJson(props.skyColor),\r\n groundColor: colorDefFromJson(props.groundColor),\r\n nadirColor: colorDefFromJson(props.nadirColor),\r\n zenithColor: colorDefFromJson(props.zenithColor),\r\n });\r\n }\r\n\r\n /** Create ea copy of this gradient, identical except for any properties explicitly specified by `changedProps`.\r\n * Any properties of `changedProps` explicitly set to `undefined` will be reset to their default values.\r\n */\r\n public clone(changedProps: SkyGradientProperties): SkyGradient {\r\n return new SkyGradient({ ...this, ...changedProps });\r\n }\r\n\r\n /** Convert to JSON representation. */\r\n public toJSON(): SkyBoxProps {\r\n const props: SkyBoxProps = {\r\n skyColor: this.skyColor.toJSON(),\r\n groundColor: this.groundColor.toJSON(),\r\n nadirColor: this.nadirColor.toJSON(),\r\n zenithColor: this.zenithColor.toJSON(),\r\n };\r\n\r\n if (this.groundExponent !== defaultExponent)\r\n props.groundExponent = this.groundExponent;\r\n\r\n if (this.skyExponent !== defaultExponent)\r\n props.skyExponent = this.skyExponent;\r\n\r\n if (this.twoColor)\r\n props.twoColor = this.twoColor;\r\n\r\n return props;\r\n }\r\n\r\n /** Returns true if this gradient is equivalent to the supplied gradient. */\r\n public equals(other: SkyGradient): boolean {\r\n if (this === other)\r\n return true;\r\n\r\n return this.twoColor === other.twoColor && this.skyColor.equals(other.skyColor) && this.groundColor.equals(other.groundColor) &&\r\n this.zenithColor.equals(other.zenithColor) && this.nadirColor.equals(other.nadirColor);\r\n }\r\n}\r\n\r\n/** Describes how to draw a representation of a sky, as part of an [[Environment]].\r\n * @see [[SkyBoxProps]].\r\n * @public\r\n */\r\nexport class SkyBox {\r\n /** The gradient settings, used if no cube or sphere images are supplied, or if the images cannot be loaded. */\r\n public readonly gradient: SkyGradient;\r\n\r\n protected constructor(gradient: SkyGradient) {\r\n this.gradient = gradient;\r\n }\r\n\r\n /** Default settings for a four-color gradient. */\r\n public static readonly defaults = new SkyBox(SkyGradient.defaults);\r\n\r\n /** Create a skybox that displays the specified gradient, or the default gradient if none is supplied. */\r\n public static createGradient(gradient?: SkyGradient): SkyBox {\r\n return gradient ? new this(gradient) : this.defaults;\r\n }\r\n\r\n /** Create from JSON representation. */\r\n public static fromJSON(props?: SkyBoxProps): SkyBox {\r\n const gradient = SkyGradient.fromJSON(props);\r\n\r\n if (props?.image) {\r\n switch (props.image.type) {\r\n case SkyBoxImageType.Spherical:\r\n if (undefined !== props.image.texture)\r\n return new SkySphere(props.image.texture, gradient);\r\n\r\n break;\r\n case SkyBoxImageType.Cube: {\r\n const tx = props.image.textures;\r\n if (tx && undefined !== tx.top && undefined !== tx.bottom && undefined !== tx.right && undefined !== tx.left && undefined !== tx.front && undefined !== tx.back)\r\n return new SkyCube(tx, gradient);\r\n\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return this.createGradient(gradient);\r\n }\r\n\r\n /** Convert to JSON representation.\r\n * @param display If defined, the value to use for [[SkyBoxProps.display]]; otherwise, that property will be left undefined.\r\n */\r\n public toJSON(display?: boolean): SkyBoxProps {\r\n const props = this.gradient.toJSON();\r\n if (undefined !== display)\r\n props.display = display;\r\n\r\n return props;\r\n }\r\n\r\n /** @internal */\r\n public get textureIds(): Iterable<Id64String> {\r\n return [];\r\n }\r\n}\r\n\r\n/** Describes how to draw a representation of a sky by mapping a single image to the interior of a sphere.\r\n * @public\r\n */\r\nexport class SkySphere extends SkyBox {\r\n /** The image to map to the interior of the sphere. */\r\n public readonly image: TextureImageSpec;\r\n\r\n /** Create a new sky sphere using the specified image.\r\n * @param image The image to map to the interior of the sphere.\r\n * @param gradient Optionally overrides the default gradient settings used if the image cannot be obtained.\r\n */\r\n public constructor(image: TextureImageSpec, gradient?: SkyGradient) {\r\n super(gradient ?? SkyGradient.defaults);\r\n this.image = image;\r\n }\r\n\r\n /** See [[SkyBox.toJSON]]. */\r\n public override toJSON(display?: boolean): SkyBoxProps {\r\n const props = super.toJSON(display);\r\n props.image = {\r\n type: SkyBoxImageType.Spherical,\r\n texture: this.image,\r\n };\r\n\r\n return props;\r\n }\r\n\r\n /** @internal */\r\n public override get textureIds(): Iterable<Id64String> {\r\n return Id64.isValidId64(this.image) ? [this.image] : [];\r\n }\r\n}\r\n\r\n/** Describes how to draw a representation of a sky by mapping images to the interior faces of a cube.\r\n * The images are required to be *square*, and each image must have the same dimensions as the other images.\r\n * @public\r\n */\r\nexport class SkyCube extends SkyBox {\r\n /** The images to map to each face of the cube. */\r\n public readonly images: SkyCubeProps;\r\n\r\n /** Create a new sky cube using the specified images.\r\n * @param images The images to map to each face of the cube.\r\n * @param gradient Optionally overrides the default gradient settings used if the images cannot be obtained.\r\n */\r\n public constructor(images: SkyCubeProps, gradient?: SkyGradient) {\r\n super(gradient ?? SkyGradient.defaults);\r\n this.images = { ...images };\r\n }\r\n\r\n /** See [[SkyBox.toJSON]]. */\r\n public override toJSON(display?: boolean): SkyBoxProps {\r\n const props = super.toJSON(display);\r\n props.image = {\r\n type: SkyBoxImageType.Cube,\r\n textures: { ...this.images },\r\n };\r\n\r\n return props;\r\n }\r\n\r\n /** @internal */\r\n public override get textureIds(): Iterable<Id64String> {\r\n const imgs = this.images;\r\n return [imgs.front, imgs.back, imgs.top, imgs.bottom, imgs.left, imgs.right].filter((x) => Id64.isValidId64(x));\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"SkyBox.js","sourceRoot":"","sources":["../../src/SkyBox.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAgF;AAChF,yCAAqD;AAGrD;;;;GAIG;AACH,IAAY,eAaX;AAbD,WAAY,eAAe;IACzB,kEAAkE;IAClE,qDAAQ,CAAA;IACR;;OAEG;IACH,+DAAa,CAAA;IACb,kCAAkC;IAClC,mEAAe,CAAA;IACf;;OAEG;IACH,qDAAQ,CAAA;AACV,CAAC,EAbW,eAAe,+BAAf,eAAe,QAa1B;AA4GD,MAAM,kBAAkB,GAAG,mBAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AACxD,MAAM,kBAAkB,GAAG,mBAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AACvD,MAAM,iBAAiB,GAAG,mBAAQ,CAAC,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CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IAClH,CAAC;CACF;AA7BD,0BA6BC","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 { Id64, Id64String, NonFunctionPropertiesOf } from \"@itwin/core-bentley\";\nimport { ColorDef, ColorDefProps } from \"./ColorDef\";\nimport { TextureImageSpec } from \"./RenderTexture\";\n\n/** Supported types of [[SkyBox]] images.\n * @see [[SkyBoxImageProps]].\n * @public\n * @extensions\n */\nexport enum SkyBoxImageType {\n /** No image, indicating a [[SkyGradient]] should be displayed. */\n None = 0,\n /** A single image mapped to the surface of a sphere.\n * @see [[SkySphere]].\n */\n Spherical = 1,\n /** @internal not yet supported */\n Cylindrical = 2,\n /** Six images mapped to the faces of a cube.\n * @see [[SkyCube]].\n */\n Cube = 3,\n}\n\n/** JSON representation of the six images used by a [[SkyCube]].\n * Each property specifies the image for a face of the cube as either an image URL, or the Id of a [Texture]($backend) element.\n * Each image must be square and have the same dimensions as all the other images.\n * @public\n * @extensions\n */\nexport interface SkyCubeProps {\n front: TextureImageSpec;\n back: TextureImageSpec;\n top: TextureImageSpec;\n bottom: TextureImageSpec;\n right: TextureImageSpec;\n left: TextureImageSpec;\n}\n\n/** JSON representation of the image used for a [[SkySphere]].\n * @see [[SkyBoxProps.image]].\n * @public\n */\nexport interface SkySphereImageProps {\n type: SkyBoxImageType.Spherical;\n texture: TextureImageSpec;\n /** @internal */\n textures?: never;\n}\n\n/** JSON representation of the images used for a [[SkyCube]].\n * @see [[SkyBoxProps.image]].\n * @public\n */\nexport interface SkyCubeImageProps {\n type: SkyBoxImageType.Cube;\n textures: SkyCubeProps;\n /** @internal */\n texture?: never;\n}\n\n/** JSON representation of the image(s) to be mapped to the surfaces of a [[SkyBox]].\n * @see [[SkyBoxProps.image]].\n * @public\n * @extensions\n */\nexport type SkyBoxImageProps = SkySphereImageProps | SkyCubeImageProps | { type?: SkyBoxImageType, texture?: never, textures?: never };\n\n/** JSON representation of a [[SkyBox]] that can be drawn as the background of a [ViewState3d]($frontend).\n * An object of this type can describe one of several types of sky box:\n * - A cube with a texture image mapped to each face; or\n * - A sphere with a single texture image mapped to its surface; or\n * - A sphere with a two- or four-color vertical [[Gradient]] mapped to its surface.\n *\n * Whether cuboid or spherical, the skybox is drawn as if the viewer and the contents of the view are contained within its interior.\n *\n * For a two-color gradient, the gradient transitions smoothly from the nadir color at the bottom of the sphere to the zenith color at the top of the sphere.\n * The sky and ground colors are unused, as are the sky and ground exponents.\n *\n * For a four-color gradient, a \"horizon\" is produced on the equator of the sphere, where the ground color and sky color meet. The lower half of the sphere transitions\n * smoothly from the ground color at the equator to the nadir color at the bottom, and the upper half transitions from the sky color at the equator to the zenith color at\n * the top of the sphere.\n *\n * The color and exponent properties are unused if one or more texture images are supplied.\n *\n * The skybox is ignored entirely when an atmosphere is displayed.\n *\n * @see [[DisplayStyle3dSettings.environment]] to define the skybox for a display style.\n * @public\n * @extensions\n */\nexport interface SkyBoxProps {\n /** Whether or not the skybox should be displayed.\n * Default: false.\n */\n display?: boolean;\n /** For a [[SkyGradient]], if true, a 2-color gradient skybox is used instead of a 4-color.\n * Default: false.\n */\n twoColor?: boolean;\n /** The color of the sky at the horizon. Unused unless this is a four-color [[SkyGradient]].\n * Default: (143, 205, 255).\n */\n skyColor?: ColorDefProps;\n /** The color of the ground at the horizon. Unused unless this is a four-color [[SkyGradient]].\n * Default: (120, 143, 125).\n */\n groundColor?: ColorDefProps;\n /** The color of the top of the sphere.\n * Default: (54, 117, 255).\n */\n zenithColor?: ColorDefProps;\n /** The color of the bottom of the sphere.\n * Default: (40, 15, 0).\n */\n nadirColor?: ColorDefProps;\n /** For a 4-color [[SkyGradient]], controls speed of change from sky color to zenith color; otherwise unused.\n * Default: 4.0.\n */\n skyExponent?: number;\n /** For a 4-color [[SkyGradient]], controls speed of change from ground color to nadir color; otherwise unused.\n * Default: 4.0.\n */\n groundExponent?: number;\n /** The image(s), if any, to be mapped to the surfaces of the sphere or cube. If undefined, the skybox will be displayed as a gradient instead.\n * Default: undefined.\n */\n image?: SkyBoxImageProps;\n}\n\nconst defaultGroundColor = ColorDef.from(143, 205, 125);\nconst defaultZenithColor = ColorDef.from(54, 117, 255);\nconst defaultNadirColor = ColorDef.from(40, 125, 0);\nconst defaultSkyColor = ColorDef.from(142, 205, 255);\nconst defaultExponent = 4.0;\n\nfunction colorDefFromJson(props?: ColorDefProps): ColorDef | undefined {\n return undefined !== props ? ColorDef.fromJSON(props) : undefined;\n}\n\n/** A type containing all of the properties and none of the methods of [[SkyGradient]] with `readonly` modifiers removed.\n * @see [[SkyGradient.create]] and [[SkyGradient.clone]].\n * @public\n */\nexport type SkyGradientProperties = NonFunctionPropertiesOf<SkyGradient>;\n\n/** Describes how to map a two- or four-color [[Gradient]] to the interior of a sphere to produce a [[SkyBox]].\n * @see [[SkyBox.gradient]].\n * @public\n */\nexport class SkyGradient {\n public readonly twoColor: boolean;\n public readonly skyColor: ColorDef;\n public readonly groundColor: ColorDef;\n public readonly zenithColor: ColorDef;\n public readonly nadirColor: ColorDef;\n public readonly skyExponent: number;\n public readonly groundExponent: number;\n\n private constructor(args: Partial<SkyGradientProperties>) {\n this.twoColor = args.twoColor ?? false;\n this.skyColor = args.skyColor ?? defaultSkyColor;\n this.groundColor = args.groundColor ?? defaultGroundColor;\n this.nadirColor = args.nadirColor ?? defaultNadirColor;\n this.zenithColor = args.zenithColor ?? defaultZenithColor;\n this.skyExponent = args.skyExponent ?? defaultExponent;\n this.groundExponent = args.groundExponent ?? defaultExponent;\n }\n\n /** Default settings for a four-color gradient. */\n public static readonly defaults = new SkyGradient({});\n\n /** Create a new gradient. Any properties not specified by `props` are initialized to their default values. */\n public static create(props?: Partial<SkyGradientProperties>): SkyGradient {\n return props ? new this(props) : this.defaults;\n }\n\n /** Create from JSON representation. */\n public static fromJSON(props?: SkyBoxProps): SkyGradient {\n if (!props)\n return this.defaults;\n\n return new this({\n twoColor: props.twoColor,\n skyExponent: props.skyExponent,\n groundExponent: props.groundExponent,\n skyColor: colorDefFromJson(props.skyColor),\n groundColor: colorDefFromJson(props.groundColor),\n nadirColor: colorDefFromJson(props.nadirColor),\n zenithColor: colorDefFromJson(props.zenithColor),\n });\n }\n\n /** Create ea copy of this gradient, identical except for any properties explicitly specified by `changedProps`.\n * Any properties of `changedProps` explicitly set to `undefined` will be reset to their default values.\n */\n public clone(changedProps: SkyGradientProperties): SkyGradient {\n return new SkyGradient({ ...this, ...changedProps });\n }\n\n /** Convert to JSON representation. */\n public toJSON(): SkyBoxProps {\n const props: SkyBoxProps = {\n skyColor: this.skyColor.toJSON(),\n groundColor: this.groundColor.toJSON(),\n nadirColor: this.nadirColor.toJSON(),\n zenithColor: this.zenithColor.toJSON(),\n };\n\n if (this.groundExponent !== defaultExponent)\n props.groundExponent = this.groundExponent;\n\n if (this.skyExponent !== defaultExponent)\n props.skyExponent = this.skyExponent;\n\n if (this.twoColor)\n props.twoColor = this.twoColor;\n\n return props;\n }\n\n /** Returns true if this gradient is equivalent to the supplied gradient. */\n public equals(other: SkyGradient): boolean {\n if (this === other)\n return true;\n\n return this.twoColor === other.twoColor && this.skyColor.equals(other.skyColor) && this.groundColor.equals(other.groundColor) &&\n this.zenithColor.equals(other.zenithColor) && this.nadirColor.equals(other.nadirColor);\n }\n}\n\n/** Describes how to draw a representation of a sky, as part of an [[Environment]].\n * @see [[SkyBoxProps]].\n * @public\n */\nexport class SkyBox {\n /** The gradient settings, used if no cube or sphere images are supplied, or if the images cannot be loaded. */\n public readonly gradient: SkyGradient;\n\n protected constructor(gradient: SkyGradient) {\n this.gradient = gradient;\n }\n\n /** Default settings for a four-color gradient. */\n public static readonly defaults = new SkyBox(SkyGradient.defaults);\n\n /** Create a skybox that displays the specified gradient, or the default gradient if none is supplied. */\n public static createGradient(gradient?: SkyGradient): SkyBox {\n return gradient ? new this(gradient) : this.defaults;\n }\n\n /** Create from JSON representation. */\n public static fromJSON(props?: SkyBoxProps): SkyBox {\n const gradient = SkyGradient.fromJSON(props);\n\n if (props?.image) {\n switch (props.image.type) {\n case SkyBoxImageType.Spherical:\n if (undefined !== props.image.texture)\n return new SkySphere(props.image.texture, gradient);\n\n break;\n case SkyBoxImageType.Cube: {\n const tx = props.image.textures;\n if (tx && undefined !== tx.top && undefined !== tx.bottom && undefined !== tx.right && undefined !== tx.left && undefined !== tx.front && undefined !== tx.back)\n return new SkyCube(tx, gradient);\n\n break;\n }\n }\n }\n\n return this.createGradient(gradient);\n }\n\n /** Convert to JSON representation.\n * @param display If defined, the value to use for [[SkyBoxProps.display]]; otherwise, that property will be left undefined.\n */\n public toJSON(display?: boolean): SkyBoxProps {\n const props = this.gradient.toJSON();\n if (undefined !== display)\n props.display = display;\n\n return props;\n }\n\n /** @internal */\n public get textureIds(): Iterable<Id64String> {\n return [];\n }\n}\n\n/** Describes how to draw a representation of a sky by mapping a single image to the interior of a sphere.\n * @public\n */\nexport class SkySphere extends SkyBox {\n /** The image to map to the interior of the sphere. */\n public readonly image: TextureImageSpec;\n\n /** Create a new sky sphere using the specified image.\n * @param image The image to map to the interior of the sphere.\n * @param gradient Optionally overrides the default gradient settings used if the image cannot be obtained.\n */\n public constructor(image: TextureImageSpec, gradient?: SkyGradient) {\n super(gradient ?? SkyGradient.defaults);\n this.image = image;\n }\n\n /** See [[SkyBox.toJSON]]. */\n public override toJSON(display?: boolean): SkyBoxProps {\n const props = super.toJSON(display);\n props.image = {\n type: SkyBoxImageType.Spherical,\n texture: this.image,\n };\n\n return props;\n }\n\n /** @internal */\n public override get textureIds(): Iterable<Id64String> {\n return Id64.isValidId64(this.image) ? [this.image] : [];\n }\n}\n\n/** Describes how to draw a representation of a sky by mapping images to the interior faces of a cube.\n * The images are required to be *square*, and each image must have the same dimensions as the other images.\n * @public\n */\nexport class SkyCube extends SkyBox {\n /** The images to map to each face of the cube. */\n public readonly images: SkyCubeProps;\n\n /** Create a new sky cube using the specified images.\n * @param images The images to map to each face of the cube.\n * @param gradient Optionally overrides the default gradient settings used if the images cannot be obtained.\n */\n public constructor(images: SkyCubeProps, gradient?: SkyGradient) {\n super(gradient ?? SkyGradient.defaults);\n this.images = { ...images };\n }\n\n /** See [[SkyBox.toJSON]]. */\n public override toJSON(display?: boolean): SkyBoxProps {\n const props = super.toJSON(display);\n props.image = {\n type: SkyBoxImageType.Cube,\n textures: { ...this.images },\n };\n\n return props;\n }\n\n /** @internal */\n public override get textureIds(): Iterable<Id64String> {\n const imgs = this.images;\n return [imgs.front, imgs.back, imgs.top, imgs.bottom, imgs.left, imgs.right].filter((x) => Id64.isValidId64(x));\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"SolarCalculate.js","sourceRoot":"","sources":["../../src/SolarCalculate.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;AAkKH,oDAUC;AAKD,0DAEC;AAKD,8EAMC;AA0BD,4DAMC;AA5ND,wDAAuD;AAGvD,oCAAoC;AAEpC,kFAAkF;AAClF,SAAS,kBAAkB,CAAC,EAAU;IACpC,MAAM,CAAC,GAAG,CAAC,EAAE,GAAG,SAAS,CAAC,GAAG,OAAO,CAAC;IACrC,OAAO,CAAC,CAAC;AACX,CAAC;AAED,SAAS,QAAQ,CAAC,QAAgB;IAChC,OAAO,CAAC,KAAK,GAAG,QAAQ,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC;AACtC,CAAC;AAED,SAAS,QAAQ,CAAC,QAAgB;IAChC,OAAO,CAAC,IAAI,CAAC,EAAE,GAAG,QAAQ,GAAG,KAAK,CAAC,CAAC;AACtC,CAAC;AAED,SAAS,mBAAmB,CAAC,CAAS;IACpC,IAAI,EAAE,GAAG,SAAS,GAAG,CAAC,GAAG,CAAC,WAAW,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC;IACzD,OAAO,EAAE,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,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,GAAG,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC;AAClK,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Utils\r\n */\r\n\r\nimport { Angle, Vector3d } from \"@itwin/core-geometry\";\r\nimport { Cartographic } from \"./geometry/Cartographic\";\r\n\r\n// cspell:ignore mrad sinm sint aarg\r\n\r\n// Code below loosely translated from https://www.esrl.noaa.gov/gmd/grad/solcalc/\r\nfunction calcTimeJulianCent(jd: number) {\r\n const T = (jd - 2451545.0) / 36525.0;\r\n return T;\r\n}\r\n\r\nfunction radToDeg(angleRad: number) {\r\n return (180.0 * angleRad / Math.PI);\r\n}\r\n\r\nfunction degToRad(angleDeg: number) {\r\n return (Math.PI * angleDeg / 180.0);\r\n}\r\n\r\nfunction calcGeomMeanLongSun(t: number) {\r\n let L0 = 280.46646 + t * (36000.76983 + t * (0.0003032));\r\n while (L0 > 360.0) {\r\n L0 -= 360.0;\r\n }\r\n while (L0 < 0.0) {\r\n L0 += 360.0;\r\n }\r\n return L0;\t\t// in degrees\r\n}\r\n\r\nfunction calcGeomMeanAnomalySun(t: number) {\r\n const M = 357.52911 + t * (35999.05029 - 0.0001537 * t);\r\n return M;\t\t// in degrees\r\n}\r\n\r\nfunction calcEccentricityEarthOrbit(t: number) {\r\n const e = 0.016708634 - t * (0.000042037 + 0.0000001267 * t);\r\n return e;\t\t// unitless\r\n}\r\n\r\nfunction calcSunEqOfCenter(t: number) {\r\n const m = calcGeomMeanAnomalySun(t);\r\n const mrad = degToRad(m);\r\n const sinm = Math.sin(mrad);\r\n const sin2m = Math.sin(mrad + mrad);\r\n const sin3m = Math.sin(mrad + mrad + mrad);\r\n const C = sinm * (1.914602 - t * (0.004817 + 0.000014 * t)) + sin2m * (0.019993 - 0.000101 * t) + sin3m * 0.000289;\r\n return C;\t\t// in degrees\r\n}\r\n\r\nfunction calcSunTrueLong(t: number) {\r\n const l0 = calcGeomMeanLongSun(t);\r\n const c = calcSunEqOfCenter(t);\r\n const O = l0 + c;\r\n return O;\t\t// in degrees\r\n}\r\n\r\nfunction calcSunApparentLong(t: number) {\r\n const o = calcSunTrueLong(t);\r\n const omega = 125.04 - 1934.136 * t;\r\n const lambda = o - 0.00569 - 0.00478 * Math.sin(degToRad(omega));\r\n return lambda;\t\t// in degrees\r\n}\r\n\r\nfunction calcMeanObliquityOfEcliptic(t: number) {\r\n const seconds = 21.448 - t * (46.8150 + t * (0.00059 - t * (0.001813)));\r\n const e0 = 23.0 + (26.0 + (seconds / 60.0)) / 60.0;\r\n return e0;\t\t// in degrees\r\n}\r\n\r\nfunction calcObliquityCorrection(t: number) {\r\n const e0 = calcMeanObliquityOfEcliptic(t);\r\n const omega = 125.04 - 1934.136 * t;\r\n const e = e0 + 0.00256 * Math.cos(degToRad(omega));\r\n return e;\t\t// in degrees\r\n}\r\n\r\nfunction calcSunDeclination(t: number) {\r\n const e = calcObliquityCorrection(t);\r\n const lambda = calcSunApparentLong(t);\r\n\r\n const sint = Math.sin(degToRad(e)) * Math.sin(degToRad(lambda));\r\n const theta = radToDeg(Math.asin(sint));\r\n return theta;\t\t// in degrees\r\n}\r\n\r\nfunction calcEquationOfTime(t: number) {\r\n const epsilon = calcObliquityCorrection(t);\r\n const l0 = calcGeomMeanLongSun(t);\r\n const e = calcEccentricityEarthOrbit(t);\r\n const m = calcGeomMeanAnomalySun(t);\r\n\r\n let y = Math.tan(degToRad(epsilon) / 2.0);\r\n y *= y;\r\n\r\n const sin2l0 = Math.sin(2.0 * degToRad(l0));\r\n const sinm = Math.sin(degToRad(m));\r\n const cos2l0 = Math.cos(2.0 * degToRad(l0));\r\n const sin4l0 = Math.sin(4.0 * degToRad(l0));\r\n const sin2m = Math.sin(2.0 * degToRad(m));\r\n\r\n const eTime = y * sin2l0 - 2.0 * e * sinm + 4.0 * e * y * sinm * cos2l0 - 0.5 * y * y * sin4l0 - 1.25 * e * e * sin2m;\r\n return radToDeg(eTime) * 4.0;\t// in minutes of time\r\n}\r\n\r\nfunction calcAzEl(t: number, localTime: number, latitude: number, longitude: number, zone: number): { azimuth: number, elevation: number } {\r\n const eqTime = calcEquationOfTime(t);\r\n const theta = calcSunDeclination(t);\r\n const solarTimeFix = eqTime + 4.0 * longitude - 60.0 * zone;\r\n let trueSolarTime = localTime + solarTimeFix;\r\n while (trueSolarTime > 1440)\r\n trueSolarTime -= 1440;\r\n\r\n let hourAngle = trueSolarTime / 4.0 - 180.0;\r\n if (hourAngle < -180) {\r\n hourAngle += 360.0;\r\n }\r\n const haRad = degToRad(hourAngle);\r\n let csz = Math.sin(degToRad(latitude)) * Math.sin(degToRad(theta)) + Math.cos(degToRad(latitude)) * Math.cos(degToRad(theta)) * Math.cos(haRad);\r\n if (csz > 1.0) {\r\n csz = 1.0;\r\n } else if (csz < -1.0) {\r\n csz = -1.0;\r\n }\r\n const zenith = radToDeg(Math.acos(csz));\r\n const azDenom = (Math.cos(degToRad(latitude)) * Math.sin(degToRad(zenith)));\r\n let azimuth;\r\n if (Math.abs(azDenom) > 0.001) {\r\n let azRad = ((Math.sin(degToRad(latitude)) * Math.cos(degToRad(zenith))) - Math.sin(degToRad(theta))) / azDenom;\r\n if (Math.abs(azRad) > 1.0) {\r\n if (azRad < 0) {\r\n azRad = -1.0;\r\n } else {\r\n azRad = 1.0;\r\n }\r\n }\r\n azimuth = 180.0 - radToDeg(Math.acos(azRad));\r\n if (hourAngle > 0.0) {\r\n azimuth = -azimuth;\r\n }\r\n } else {\r\n if (latitude > 0.0) {\r\n azimuth = 180.0;\r\n } else {\r\n azimuth = 0.0;\r\n }\r\n }\r\n if (azimuth < 0.0) {\r\n azimuth += 360.0;\r\n }\r\n return { azimuth, elevation: 90 - zenith };\r\n}\r\n\r\nfunction calculateJulianDay(date: Date) {\r\n return Math.floor(date.getTime() / 86400000) + 2440587.5; // https://stackoverflow.com/questions/11759992/calculating-jdayjulian-day-in-javascript\r\n}\r\n\r\n/** @public\r\n * calculate solar angles (in radians) based at a given date/time and cartographic location.\r\n */\r\nexport function calculateSolarAngles(date: Date, location: Cartographic): { azimuth: number, elevation: number } {\r\n const jDay = calculateJulianDay(date);\r\n const latitude = location.latitudeDegrees;\r\n const longitude = location.longitudeDegrees;\r\n const utcMinutes = date.getUTCHours() * 60 + date.getUTCMinutes() + date.getUTCSeconds() / 60;\r\n const zone = Math.floor(.5 + longitude / 15.0); // date.getTimeZoneOffset mixes in DST.\r\n const localMinutes = utcMinutes + zone * 60;\r\n const jTotal = jDay + utcMinutes / 1440.0;\r\n const T = calcTimeJulianCent(jTotal);\r\n return calcAzEl(T, localMinutes, latitude, longitude, zone);\r\n}\r\n\r\n/** @public\r\n * calculate solar direction based at a given date/time and cartpgrphic location.\r\n */\r\nexport function calculateSolarDirection(date: Date, location: Cartographic): Vector3d {\r\n return calculateSolarDirectionFromAngles(calculateSolarAngles(date, location));\r\n}\r\n\r\n/** @public\r\n * calculate solar direction corresponding to the given azimuth and elevation (altitude) angles in degrees.\r\n */\r\nexport function calculateSolarDirectionFromAngles(azimuthElevation: { azimuth: number, elevation: number }): Vector3d {\r\n const azimuth = Angle.degreesToRadians(azimuthElevation.azimuth);\r\n const elevation = Angle.degreesToRadians(azimuthElevation.elevation);\r\n const cosElevation = Math.cos(elevation);\r\n const sinElevation = Math.sin(elevation);\r\n return Vector3d.create(-Math.sin(azimuth) * cosElevation, -Math.cos(azimuth) * cosElevation, -sinElevation);\r\n}\r\n\r\nfunction dateFromUtcMinutes(date: Date, utcMinutes: number) {\r\n const utcHours = Math.floor(utcMinutes / 60.0);\r\n const output = new Date(date);\r\n output.setUTCHours(utcHours);\r\n output.setUTCMinutes(Math.floor(.5 + utcMinutes - 60.0 * utcHours));\r\n output.setUTCSeconds(0);\r\n return output;\r\n}\r\n\r\nfunction calcSunriseUtcMinutes(rise: boolean, lat: number, longitude: number, jDay: number) {\r\n const t = calcTimeJulianCent(jDay);\r\n const eqTime = calcEquationOfTime(t);\r\n const solarDec = calcSunDeclination(t);\r\n const latRad = degToRad(lat);\r\n const sdRad = degToRad(solarDec);\r\n const hAarg = (Math.cos(degToRad(90.833)) / (Math.cos(latRad) * Math.cos(sdRad)) - Math.tan(latRad) * Math.tan(sdRad));\r\n const hourAngle = Math.acos(hAarg);\r\n const delta = longitude + radToDeg(rise ? hourAngle : - hourAngle);\r\n return 720 - (4.0 * delta) - eqTime;\t// in UTC minutes\r\n}\r\n\r\n/** @public\r\n * calculate solar sunrise or sunset for a given day and cartographic location.\r\n */\r\nexport function calculateSunriseOrSunset(date: Date, location: Cartographic, sunrise: boolean): Date {\r\n const jDay = calculateJulianDay(date);\r\n const longitude = location.longitudeDegrees;\r\n const latitude = location.latitudeDegrees;\r\n const utcMinutes = calcSunriseUtcMinutes(sunrise, latitude, longitude, jDay);\r\n return sunrise ? dateFromUtcMinutes(date, utcMinutes) : dateFromUtcMinutes(date, calcSunriseUtcMinutes(sunrise, latitude, longitude, jDay + utcMinutes / 1440));\r\n}\r\n"]}
1
+ {"version":3,"file":"SolarCalculate.js","sourceRoot":"","sources":["../../src/SolarCalculate.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;AAkKH,oDAUC;AAKD,0DAEC;AAKD,8EAMC;AA0BD,4DAMC;AA5ND,wDAAuD;AAGvD,oCAAoC;AAEpC,kFAAkF;AAClF,SAAS,kBAAkB,CAAC,EAAU;IACpC,MAAM,CAAC,GAAG,CAAC,EAAE,GAAG,SAAS,CAAC,GAAG,OAAO,CAAC;IACrC,OAAO,CAAC,CAAC;AACX,CAAC;AAED,SAAS,QAAQ,CAAC,QAAgB;IAChC,OAAO,CAAC,KAAK,GAAG,QAAQ,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC;AACtC,CAAC;AAED,SAAS,QAAQ,CAAC,QAAgB;IAChC,O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;IAC1C,MAAM,UAAU,GAAG,qBAAqB,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;IAC7E,OAAO,OAAO,CAAC,CAAC,CAAC,kBAAkB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,IAAI,EAAE,qBAAqB,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,GAAG,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC;AAClK,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 Utils\n */\n\nimport { Angle, Vector3d } from \"@itwin/core-geometry\";\nimport { Cartographic } from \"./geometry/Cartographic\";\n\n// cspell:ignore mrad sinm sint aarg\n\n// Code below loosely translated from https://www.esrl.noaa.gov/gmd/grad/solcalc/\nfunction calcTimeJulianCent(jd: number) {\n const T = (jd - 2451545.0) / 36525.0;\n return T;\n}\n\nfunction radToDeg(angleRad: number) {\n return (180.0 * angleRad / Math.PI);\n}\n\nfunction degToRad(angleDeg: number) {\n return (Math.PI * angleDeg / 180.0);\n}\n\nfunction calcGeomMeanLongSun(t: number) {\n let L0 = 280.46646 + t * (36000.76983 + t * (0.0003032));\n while (L0 > 360.0) {\n L0 -= 360.0;\n }\n while (L0 < 0.0) {\n L0 += 360.0;\n }\n return L0;\t\t// in degrees\n}\n\nfunction calcGeomMeanAnomalySun(t: number) {\n const M = 357.52911 + t * (35999.05029 - 0.0001537 * t);\n return M;\t\t// in degrees\n}\n\nfunction calcEccentricityEarthOrbit(t: number) {\n const e = 0.016708634 - t * (0.000042037 + 0.0000001267 * t);\n return e;\t\t// unitless\n}\n\nfunction calcSunEqOfCenter(t: number) {\n const m = calcGeomMeanAnomalySun(t);\n const mrad = degToRad(m);\n const sinm = Math.sin(mrad);\n const sin2m = Math.sin(mrad + mrad);\n const sin3m = Math.sin(mrad + mrad + mrad);\n const C = sinm * (1.914602 - t * (0.004817 + 0.000014 * t)) + sin2m * (0.019993 - 0.000101 * t) + sin3m * 0.000289;\n return C;\t\t// in degrees\n}\n\nfunction calcSunTrueLong(t: number) {\n const l0 = calcGeomMeanLongSun(t);\n const c = calcSunEqOfCenter(t);\n const O = l0 + c;\n return O;\t\t// in degrees\n}\n\nfunction calcSunApparentLong(t: number) {\n const o = calcSunTrueLong(t);\n const omega = 125.04 - 1934.136 * t;\n const lambda = o - 0.00569 - 0.00478 * Math.sin(degToRad(omega));\n return lambda;\t\t// in degrees\n}\n\nfunction calcMeanObliquityOfEcliptic(t: number) {\n const seconds = 21.448 - t * (46.8150 + t * (0.00059 - t * (0.001813)));\n const e0 = 23.0 + (26.0 + (seconds / 60.0)) / 60.0;\n return e0;\t\t// in degrees\n}\n\nfunction calcObliquityCorrection(t: number) {\n const e0 = calcMeanObliquityOfEcliptic(t);\n const omega = 125.04 - 1934.136 * t;\n const e = e0 + 0.00256 * Math.cos(degToRad(omega));\n return e;\t\t// in degrees\n}\n\nfunction calcSunDeclination(t: number) {\n const e = calcObliquityCorrection(t);\n const lambda = calcSunApparentLong(t);\n\n const sint = Math.sin(degToRad(e)) * Math.sin(degToRad(lambda));\n const theta = radToDeg(Math.asin(sint));\n return theta;\t\t// in degrees\n}\n\nfunction calcEquationOfTime(t: number) {\n const epsilon = calcObliquityCorrection(t);\n const l0 = calcGeomMeanLongSun(t);\n const e = calcEccentricityEarthOrbit(t);\n const m = calcGeomMeanAnomalySun(t);\n\n let y = Math.tan(degToRad(epsilon) / 2.0);\n y *= y;\n\n const sin2l0 = Math.sin(2.0 * degToRad(l0));\n const sinm = Math.sin(degToRad(m));\n const cos2l0 = Math.cos(2.0 * degToRad(l0));\n const sin4l0 = Math.sin(4.0 * degToRad(l0));\n const sin2m = Math.sin(2.0 * degToRad(m));\n\n const eTime = y * sin2l0 - 2.0 * e * sinm + 4.0 * e * y * sinm * cos2l0 - 0.5 * y * y * sin4l0 - 1.25 * e * e * sin2m;\n return radToDeg(eTime) * 4.0;\t// in minutes of time\n}\n\nfunction calcAzEl(t: number, localTime: number, latitude: number, longitude: number, zone: number): { azimuth: number, elevation: number } {\n const eqTime = calcEquationOfTime(t);\n const theta = calcSunDeclination(t);\n const solarTimeFix = eqTime + 4.0 * longitude - 60.0 * zone;\n let trueSolarTime = localTime + solarTimeFix;\n while (trueSolarTime > 1440)\n trueSolarTime -= 1440;\n\n let hourAngle = trueSolarTime / 4.0 - 180.0;\n if (hourAngle < -180) {\n hourAngle += 360.0;\n }\n const haRad = degToRad(hourAngle);\n let csz = Math.sin(degToRad(latitude)) * Math.sin(degToRad(theta)) + Math.cos(degToRad(latitude)) * Math.cos(degToRad(theta)) * Math.cos(haRad);\n if (csz > 1.0) {\n csz = 1.0;\n } else if (csz < -1.0) {\n csz = -1.0;\n }\n const zenith = radToDeg(Math.acos(csz));\n const azDenom = (Math.cos(degToRad(latitude)) * Math.sin(degToRad(zenith)));\n let azimuth;\n if (Math.abs(azDenom) > 0.001) {\n let azRad = ((Math.sin(degToRad(latitude)) * Math.cos(degToRad(zenith))) - Math.sin(degToRad(theta))) / azDenom;\n if (Math.abs(azRad) > 1.0) {\n if (azRad < 0) {\n azRad = -1.0;\n } else {\n azRad = 1.0;\n }\n }\n azimuth = 180.0 - radToDeg(Math.acos(azRad));\n if (hourAngle > 0.0) {\n azimuth = -azimuth;\n }\n } else {\n if (latitude > 0.0) {\n azimuth = 180.0;\n } else {\n azimuth = 0.0;\n }\n }\n if (azimuth < 0.0) {\n azimuth += 360.0;\n }\n return { azimuth, elevation: 90 - zenith };\n}\n\nfunction calculateJulianDay(date: Date) {\n return Math.floor(date.getTime() / 86400000) + 2440587.5; // https://stackoverflow.com/questions/11759992/calculating-jdayjulian-day-in-javascript\n}\n\n/** @public\n * calculate solar angles (in radians) based at a given date/time and cartographic location.\n */\nexport function calculateSolarAngles(date: Date, location: Cartographic): { azimuth: number, elevation: number } {\n const jDay = calculateJulianDay(date);\n const latitude = location.latitudeDegrees;\n const longitude = location.longitudeDegrees;\n const utcMinutes = date.getUTCHours() * 60 + date.getUTCMinutes() + date.getUTCSeconds() / 60;\n const zone = Math.floor(.5 + longitude / 15.0); // date.getTimeZoneOffset mixes in DST.\n const localMinutes = utcMinutes + zone * 60;\n const jTotal = jDay + utcMinutes / 1440.0;\n const T = calcTimeJulianCent(jTotal);\n return calcAzEl(T, localMinutes, latitude, longitude, zone);\n}\n\n/** @public\n * calculate solar direction based at a given date/time and cartpgrphic location.\n */\nexport function calculateSolarDirection(date: Date, location: Cartographic): Vector3d {\n return calculateSolarDirectionFromAngles(calculateSolarAngles(date, location));\n}\n\n/** @public\n * calculate solar direction corresponding to the given azimuth and elevation (altitude) angles in degrees.\n */\nexport function calculateSolarDirectionFromAngles(azimuthElevation: { azimuth: number, elevation: number }): Vector3d {\n const azimuth = Angle.degreesToRadians(azimuthElevation.azimuth);\n const elevation = Angle.degreesToRadians(azimuthElevation.elevation);\n const cosElevation = Math.cos(elevation);\n const sinElevation = Math.sin(elevation);\n return Vector3d.create(-Math.sin(azimuth) * cosElevation, -Math.cos(azimuth) * cosElevation, -sinElevation);\n}\n\nfunction dateFromUtcMinutes(date: Date, utcMinutes: number) {\n const utcHours = Math.floor(utcMinutes / 60.0);\n const output = new Date(date);\n output.setUTCHours(utcHours);\n output.setUTCMinutes(Math.floor(.5 + utcMinutes - 60.0 * utcHours));\n output.setUTCSeconds(0);\n return output;\n}\n\nfunction calcSunriseUtcMinutes(rise: boolean, lat: number, longitude: number, jDay: number) {\n const t = calcTimeJulianCent(jDay);\n const eqTime = calcEquationOfTime(t);\n const solarDec = calcSunDeclination(t);\n const latRad = degToRad(lat);\n const sdRad = degToRad(solarDec);\n const hAarg = (Math.cos(degToRad(90.833)) / (Math.cos(latRad) * Math.cos(sdRad)) - Math.tan(latRad) * Math.tan(sdRad));\n const hourAngle = Math.acos(hAarg);\n const delta = longitude + radToDeg(rise ? hourAngle : - hourAngle);\n return 720 - (4.0 * delta) - eqTime;\t// in UTC minutes\n}\n\n/** @public\n * calculate solar sunrise or sunset for a given day and cartographic location.\n */\nexport function calculateSunriseOrSunset(date: Date, location: Cartographic, sunrise: boolean): Date {\n const jDay = calculateJulianDay(date);\n const longitude = location.longitudeDegrees;\n const latitude = location.latitudeDegrees;\n const utcMinutes = calcSunriseUtcMinutes(sunrise, latitude, longitude, jDay);\n return sunrise ? dateFromUtcMinutes(date, utcMinutes) : dateFromUtcMinutes(date, calcSunriseUtcMinutes(sunrise, latitude, longitude, jDay + utcMinutes / 1440));\n}\n"]}
@@ -18,6 +18,10 @@ const defaultColor = RgbColor_1.RgbColor.fromColorDef(ColorDef_1.ColorDef.fromTb
18
18
  * @public
19
19
  */
20
20
  class SolarShadowSettings {
21
+ /** Shadow color. */
22
+ color;
23
+ /** @internal */
24
+ bias;
21
25
  constructor(props) {
22
26
  this.bias = core_bentley_1.JsonUtils.asDouble(props.bias, 0.001);
23
27
  if (undefined === props.color || null === props.color)
@@ -25,6 +29,7 @@ class SolarShadowSettings {
25
29
  else
26
30
  this.color = RgbColor_1.RgbColor.fromColorDef(ColorDef_1.ColorDef.fromJSON(props.color));
27
31
  }
32
+ static defaults = new SolarShadowSettings({});
28
33
  static fromJSON(props) {
29
34
  return props ? new SolarShadowSettings(props) : this.defaults;
30
35
  }
@@ -58,5 +63,4 @@ class SolarShadowSettings {
58
63
  }
59
64
  }
60
65
  exports.SolarShadowSettings = SolarShadowSettings;
61
- SolarShadowSettings.defaults = new SolarShadowSettings({});
62
66
  //# sourceMappingURL=SolarShadows.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SolarShadows.js","sourceRoot":"","sources":["../../src/SolarShadows.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAgD;AAChD,+CAA4C;AAC5C,yCAAqD;AACrD,yCAAsC;AAatC,MAAM,YAAY,GAAG,m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IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAChE,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,YAAuC;QAClD,IAAI,CAAC,YAAY;YACf,OAAO,IAAI,CAAC;QAEd,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC;QAClC,IAAI,YAAY,CAAC,KAAK;YACpB,KAAK,CAAC,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC;QAEnC,IAAI,SAAS,KAAK,YAAY,CAAC,IAAI;YACjC,KAAK,CAAC,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC;QAEjC,OAAO,mBAAmB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC7C,CAAC;;AAvDH,kDAwDC;AA1Ce,4BAAQ,GAAG,IAAI,mBAAmB,CAAC,EAAE,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module DisplayStyles\r\n */\r\n\r\nimport { JsonUtils } from \"@itwin/core-bentley\";\r\nimport { ColorByName } from \"./ColorByName\";\r\nimport { ColorDef, ColorDefProps } from \"./ColorDef\";\r\nimport { RgbColor } from \"./RgbColor\";\r\n\r\n/** JSON representation of [[SolarShadowSettings]].\r\n * @public\r\n * @extensions\r\n */\r\nexport interface SolarShadowSettingsProps {\r\n /** Shadow color. Default: [[ColorByName.grey]]. */\r\n color?: ColorDefProps;\r\n /** @internal */\r\n bias?: number;\r\n}\r\n\r\nconst defaultColor = RgbColor.fromColorDef(ColorDef.fromTbgr(ColorByName.grey));\r\n\r\n/** Settings controlling display of solar shadows for a [[DisplayStyle3dSettings]].\r\n * Solar shadows are imposed as a color scaling on geometry occluded from solar lighting.\r\n * @public\r\n */\r\nexport class SolarShadowSettings {\r\n /** Shadow color. */\r\n public readonly color: RgbColor;\r\n /** @internal */\r\n public readonly bias: number;\r\n\r\n private constructor(props: SolarShadowSettingsProps) {\r\n this.bias = JsonUtils.asDouble(props.bias, 0.001);\r\n if (undefined === props.color || null === props.color)\r\n this.color = defaultColor;\r\n else\r\n this.color = RgbColor.fromColorDef(ColorDef.fromJSON(props.color));\r\n }\r\n\r\n public static defaults = new SolarShadowSettings({});\r\n\r\n public static fromJSON(props?: SolarShadowSettingsProps): SolarShadowSettings {\r\n return props ? new SolarShadowSettings(props) : this.defaults;\r\n }\r\n\r\n public toJSON(): SolarShadowSettingsProps | undefined {\r\n const defaults = SolarShadowSettings.defaults;\r\n if (this.equals(defaults))\r\n return undefined;\r\n\r\n const props: SolarShadowSettingsProps = {};\r\n if (!this.color.equals(defaults.color))\r\n props.color = this.color.toColorDef().toJSON();\r\n\r\n if (this.bias !== defaults.bias)\r\n props.bias = this.bias;\r\n\r\n return props;\r\n }\r\n\r\n public equals(rhs: SolarShadowSettings): boolean {\r\n return this.bias === rhs.bias && this.color.equals(rhs.color);\r\n }\r\n\r\n /** Create a copy of these settings.\r\n * @param changedProps Any property explicitly defined will be overridden in the copy.\r\n * @returns A settings object equivalent to this one except for any properties explicitly overridden by `changedProps`.\r\n */\r\n public clone(changedProps?: SolarShadowSettingsProps): SolarShadowSettings {\r\n if (!changedProps)\r\n return this;\r\n\r\n const props = this.toJSON() ?? {};\r\n if (changedProps.color)\r\n props.color = changedProps.color;\r\n\r\n if (undefined !== changedProps.bias)\r\n props.bias = changedProps.bias;\r\n\r\n return SolarShadowSettings.fromJSON(props);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"SolarShadows.js","sourceRoot":"","sources":["../../src/SolarShadows.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAgD;AAChD,+CAA4C;AAC5C,yCAAqD;AACrD,yCAAsC;AAatC,MAAM,YAAY,GAAG,mBAAQ,CAAC,YA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AAI,CAAC;QAEzB,OAAO,KAAK,CAAC;IACf,CAAC;IAEM,MAAM,CAAC,GAAwB;QACpC,OAAO,IAAI,CAAC,IAAI,KAAK,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAChE,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,YAAuC;QAClD,IAAI,CAAC,YAAY;YACf,OAAO,IAAI,CAAC;QAEd,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC;QAClC,IAAI,YAAY,CAAC,KAAK;YACpB,KAAK,CAAC,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC;QAEnC,IAAI,SAAS,KAAK,YAAY,CAAC,IAAI;YACjC,KAAK,CAAC,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC;QAEjC,OAAO,mBAAmB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC7C,CAAC;;AAvDH,kDAwDC","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\";\nimport { ColorByName } from \"./ColorByName\";\nimport { ColorDef, ColorDefProps } from \"./ColorDef\";\nimport { RgbColor } from \"./RgbColor\";\n\n/** JSON representation of [[SolarShadowSettings]].\n * @public\n * @extensions\n */\nexport interface SolarShadowSettingsProps {\n /** Shadow color. Default: [[ColorByName.grey]]. */\n color?: ColorDefProps;\n /** @internal */\n bias?: number;\n}\n\nconst defaultColor = RgbColor.fromColorDef(ColorDef.fromTbgr(ColorByName.grey));\n\n/** Settings controlling display of solar shadows for a [[DisplayStyle3dSettings]].\n * Solar shadows are imposed as a color scaling on geometry occluded from solar lighting.\n * @public\n */\nexport class SolarShadowSettings {\n /** Shadow color. */\n public readonly color: RgbColor;\n /** @internal */\n public readonly bias: number;\n\n private constructor(props: SolarShadowSettingsProps) {\n this.bias = JsonUtils.asDouble(props.bias, 0.001);\n if (undefined === props.color || null === props.color)\n this.color = defaultColor;\n else\n this.color = RgbColor.fromColorDef(ColorDef.fromJSON(props.color));\n }\n\n public static defaults = new SolarShadowSettings({});\n\n public static fromJSON(props?: SolarShadowSettingsProps): SolarShadowSettings {\n return props ? new SolarShadowSettings(props) : this.defaults;\n }\n\n public toJSON(): SolarShadowSettingsProps | undefined {\n const defaults = SolarShadowSettings.defaults;\n if (this.equals(defaults))\n return undefined;\n\n const props: SolarShadowSettingsProps = {};\n if (!this.color.equals(defaults.color))\n props.color = this.color.toColorDef().toJSON();\n\n if (this.bias !== defaults.bias)\n props.bias = this.bias;\n\n return props;\n }\n\n public equals(rhs: SolarShadowSettings): boolean {\n return this.bias === rhs.bias && this.color.equals(rhs.color);\n }\n\n /** Create a copy of these settings.\n * @param changedProps Any property explicitly defined will be overridden in the copy.\n * @returns A settings object equivalent to this one except for any properties explicitly overridden by `changedProps`.\n */\n public clone(changedProps?: SolarShadowSettingsProps): SolarShadowSettings {\n if (!changedProps)\n return this;\n\n const props = this.toJSON() ?? {};\n if (changedProps.color)\n props.color = changedProps.color;\n\n if (undefined !== changedProps.bias)\n props.bias = changedProps.bias;\n\n return SolarShadowSettings.fromJSON(props);\n }\n}\n"]}