@itwin/core-common 5.0.0-dev.99 → 5.1.0-dev.0

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 (378) hide show
  1. package/CHANGELOG.md +6 -1
  2. package/lib/cjs/AmbientOcclusion.js.map +1 -1
  3. package/lib/cjs/AnalysisStyle.js.map +1 -1
  4. package/lib/cjs/Atmosphere.js.map +1 -1
  5. package/lib/cjs/AuthorizationClient.js.map +1 -1
  6. package/lib/cjs/BackgroundMapProvider.js.map +1 -1
  7. package/lib/cjs/BackgroundMapSettings.js.map +1 -1
  8. package/lib/cjs/Base64EncodedString.js.map +1 -1
  9. package/lib/cjs/BlobReader.js.map +1 -1
  10. package/lib/cjs/BriefcaseTypes.js.map +1 -1
  11. package/lib/cjs/Camera.js.map +1 -1
  12. package/lib/cjs/CatalogIModel.d.ts +152 -0
  13. package/lib/cjs/CatalogIModel.d.ts.map +1 -0
  14. package/lib/cjs/CatalogIModel.js +30 -0
  15. package/lib/cjs/CatalogIModel.js.map +1 -0
  16. package/lib/cjs/CesiumIonAssets.d.ts +23 -0
  17. package/lib/cjs/CesiumIonAssets.d.ts.map +1 -0
  18. package/lib/cjs/CesiumIonAssets.js +32 -0
  19. package/lib/cjs/CesiumIonAssets.js.map +1 -0
  20. package/lib/cjs/ChangedElements.js.map +1 -1
  21. package/lib/cjs/ChangedEntities.js.map +1 -1
  22. package/lib/cjs/ChangesetProps.js.map +1 -1
  23. package/lib/cjs/ClipStyle.js.map +1 -1
  24. package/lib/cjs/Code.js.map +1 -1
  25. package/lib/cjs/ColorByName.js.map +1 -1
  26. package/lib/cjs/ColorDef.js.map +1 -1
  27. package/lib/cjs/CommonLoggerCategory.js.map +1 -1
  28. package/lib/cjs/ConcurrentQuery.js.map +1 -1
  29. package/lib/cjs/ContextRealityModel.js.map +1 -1
  30. package/lib/cjs/ContourDisplay.js.map +1 -1
  31. package/lib/cjs/DisplayStyleSettings.js.map +1 -1
  32. package/lib/cjs/ECSchemaProps.js.map +1 -1
  33. package/lib/cjs/ECSqlReader.js.map +1 -1
  34. package/lib/cjs/ECSqlTypes.js.map +1 -1
  35. package/lib/cjs/ElementMesh.js.map +1 -1
  36. package/lib/cjs/ElementProps.js.map +1 -1
  37. package/lib/cjs/EmphasizeElementsProps.js.map +1 -1
  38. package/lib/cjs/EntityProps.js.map +1 -1
  39. package/lib/cjs/EntityReference.js.map +1 -1
  40. package/lib/cjs/Environment.js.map +1 -1
  41. package/lib/cjs/FeatureIndex.js.map +1 -1
  42. package/lib/cjs/FeatureSymbology.js.map +1 -1
  43. package/lib/cjs/FeatureTable.js.map +1 -1
  44. package/lib/cjs/Fonts.js.map +1 -1
  45. package/lib/cjs/Frustum.js.map +1 -1
  46. package/lib/cjs/GenericInstanceFilter.js.map +1 -1
  47. package/lib/cjs/GeoCoordinateServices.js.map +1 -1
  48. package/lib/cjs/GeometryContainment.js.map +1 -1
  49. package/lib/cjs/GeometryParams.js.map +1 -1
  50. package/lib/cjs/GeometrySummary.js.map +1 -1
  51. package/lib/cjs/Gradient.js.map +1 -1
  52. package/lib/cjs/GraphicParams.js.map +1 -1
  53. package/lib/cjs/GroundPlane.js.map +1 -1
  54. package/lib/cjs/HSLColor.js.map +1 -1
  55. package/lib/cjs/HSVColor.js.map +1 -1
  56. package/lib/cjs/HiddenLine.js.map +1 -1
  57. package/lib/cjs/Hilite.js.map +1 -1
  58. package/lib/cjs/IModel.js.map +1 -1
  59. package/lib/cjs/IModelError.js.map +1 -1
  60. package/lib/cjs/IModelVersion.js.map +1 -1
  61. package/lib/cjs/ITwinCoreErrors.d.ts +87 -8
  62. package/lib/cjs/ITwinCoreErrors.d.ts.map +1 -1
  63. package/lib/cjs/ITwinCoreErrors.js +74 -12
  64. package/lib/cjs/ITwinCoreErrors.js.map +1 -1
  65. package/lib/cjs/Image.js.map +1 -1
  66. package/lib/cjs/IpcAppProps.js.map +1 -1
  67. package/lib/cjs/LightSettings.js.map +1 -1
  68. package/lib/cjs/LinePixels.js.map +1 -1
  69. package/lib/cjs/Localization.js.map +1 -1
  70. package/lib/cjs/MapImagerySettings.js.map +1 -1
  71. package/lib/cjs/MapLayerSettings.d.ts +4 -2
  72. package/lib/cjs/MapLayerSettings.d.ts.map +1 -1
  73. package/lib/cjs/MapLayerSettings.js +4 -2
  74. package/lib/cjs/MapLayerSettings.js.map +1 -1
  75. package/lib/cjs/MassProperties.js.map +1 -1
  76. package/lib/cjs/MaterialProps.js.map +1 -1
  77. package/lib/cjs/ModelClipGroup.js.map +1 -1
  78. package/lib/cjs/ModelGeometryChanges.js.map +1 -1
  79. package/lib/cjs/ModelProps.js.map +1 -1
  80. package/lib/cjs/NativeAppProps.js.map +1 -1
  81. package/lib/cjs/OctEncodedNormal.js.map +1 -1
  82. package/lib/cjs/PlanProjectionSettings.js.map +1 -1
  83. package/lib/cjs/PlanarClipMask.js.map +1 -1
  84. package/lib/cjs/QPoint.js.map +1 -1
  85. package/lib/cjs/RealityDataAccessProps.js.map +1 -1
  86. package/lib/cjs/RealityModelDisplaySettings.js.map +1 -1
  87. package/lib/cjs/RenderMaterial.js.map +1 -1
  88. package/lib/cjs/RenderPolyline.js.map +1 -1
  89. package/lib/cjs/RenderTexture.js.map +1 -1
  90. package/lib/cjs/RgbColor.js.map +1 -1
  91. package/lib/cjs/RpcInterface.js.map +1 -1
  92. package/lib/cjs/RpcManager.js.map +1 -1
  93. package/lib/cjs/SessionProps.js.map +1 -1
  94. package/lib/cjs/SkyBox.js.map +1 -1
  95. package/lib/cjs/SolarCalculate.js.map +1 -1
  96. package/lib/cjs/SolarShadows.js.map +1 -1
  97. package/lib/cjs/SpatialClassification.js.map +1 -1
  98. package/lib/cjs/SubCategoryAppearance.js.map +1 -1
  99. package/lib/cjs/SubCategoryOverride.js.map +1 -1
  100. package/lib/cjs/TerrainSettings.d.ts +0 -12
  101. package/lib/cjs/TerrainSettings.d.ts.map +1 -1
  102. package/lib/cjs/TerrainSettings.js +3 -15
  103. package/lib/cjs/TerrainSettings.js.map +1 -1
  104. package/lib/cjs/TextureMapping.js.map +1 -1
  105. package/lib/cjs/TextureProps.js.map +1 -1
  106. package/lib/cjs/ThematicDisplay.js.map +1 -1
  107. package/lib/cjs/Thumbnail.js.map +1 -1
  108. package/lib/cjs/TileProps.js.map +1 -1
  109. package/lib/cjs/Tween.js.map +1 -1
  110. package/lib/cjs/TxnAction.js.map +1 -1
  111. package/lib/cjs/ViewDetails.js.map +1 -1
  112. package/lib/cjs/ViewFlags.js.map +1 -1
  113. package/lib/cjs/ViewProps.js.map +1 -1
  114. package/lib/cjs/WhiteOnWhiteReversalSettings.js.map +1 -1
  115. package/lib/cjs/annotation/TextAnnotation.js.map +1 -1
  116. package/lib/cjs/annotation/TextBlock.js.map +1 -1
  117. package/lib/cjs/annotation/TextBlockGeometryProps.js.map +1 -1
  118. package/lib/cjs/annotation/TextBlockLayoutResult.js.map +1 -1
  119. package/lib/cjs/annotation/TextStyle.js.map +1 -1
  120. package/lib/cjs/core-common.d.ts +2 -0
  121. package/lib/cjs/core-common.d.ts.map +1 -1
  122. package/lib/cjs/core-common.js +2 -0
  123. package/lib/cjs/core-common.js.map +1 -1
  124. package/lib/cjs/domains/FunctionalElementProps.js.map +1 -1
  125. package/lib/cjs/domains/GenericElementProps.js.map +1 -1
  126. package/lib/cjs/geometry/AdditionalTransform.js.map +1 -1
  127. package/lib/cjs/geometry/AreaPattern.js.map +1 -1
  128. package/lib/cjs/geometry/BoundingSphere.js.map +1 -1
  129. package/lib/cjs/geometry/Cartographic.js.map +1 -1
  130. package/lib/cjs/geometry/CoordinateReferenceSystem.js.map +1 -1
  131. package/lib/cjs/geometry/ElementGeometry.js.map +1 -1
  132. package/lib/cjs/geometry/ElementGeometryFB.js.map +1 -1
  133. package/lib/cjs/geometry/FrustumPlanes.js.map +1 -1
  134. package/lib/cjs/geometry/GeodeticDatum.js.map +1 -1
  135. package/lib/cjs/geometry/GeodeticEllipsoid.js.map +1 -1
  136. package/lib/cjs/geometry/GeometryStream.js.map +1 -1
  137. package/lib/cjs/geometry/ImageGraphic.js.map +1 -1
  138. package/lib/cjs/geometry/LineStyle.js.map +1 -1
  139. package/lib/cjs/geometry/Placement.js.map +1 -1
  140. package/lib/cjs/geometry/Projection.js.map +1 -1
  141. package/lib/cjs/geometry/TextString.js.map +1 -1
  142. package/lib/cjs/internal/BackendTypes.js.map +1 -1
  143. package/lib/cjs/internal/PackedFeatureTable.js.map +1 -1
  144. package/lib/cjs/internal/RenderMaterialParams.js.map +1 -1
  145. package/lib/cjs/internal/RenderMesh.js.map +1 -1
  146. package/lib/cjs/internal/RenderTextureParams.js.map +1 -1
  147. package/lib/cjs/internal/Snapping.js.map +1 -1
  148. package/lib/cjs/internal/cross-package.js.map +1 -1
  149. package/lib/cjs/ipc/IpcSession.js.map +1 -1
  150. package/lib/cjs/ipc/IpcSocket.js.map +1 -1
  151. package/lib/cjs/ipc/IpcWebSocket.js.map +1 -1
  152. package/lib/cjs/ipc/IpcWebSocketTransport.js.map +1 -1
  153. package/lib/cjs/rpc/DevToolsRpcInterface.js.map +1 -1
  154. package/lib/cjs/rpc/IModelReadRpcInterface.js.map +1 -1
  155. package/lib/cjs/rpc/IModelTileRpcInterface.js.map +1 -1
  156. package/lib/cjs/rpc/SnapshotIModelRpcInterface.js.map +1 -1
  157. package/lib/cjs/rpc/TestRpcManager.js.map +1 -1
  158. package/lib/cjs/rpc/core/RpcConfiguration.js.map +1 -1
  159. package/lib/cjs/rpc/core/RpcConstants.js.map +1 -1
  160. package/lib/cjs/rpc/core/RpcControl.js.map +1 -1
  161. package/lib/cjs/rpc/core/RpcInvocation.js.map +1 -1
  162. package/lib/cjs/rpc/core/RpcMarshaling.js.map +1 -1
  163. package/lib/cjs/rpc/core/RpcOperation.js.map +1 -1
  164. package/lib/cjs/rpc/core/RpcPendingQueue.js.map +1 -1
  165. package/lib/cjs/rpc/core/RpcProtocol.js.map +1 -1
  166. package/lib/cjs/rpc/core/RpcPush.js.map +1 -1
  167. package/lib/cjs/rpc/core/RpcRegistry.js.map +1 -1
  168. package/lib/cjs/rpc/core/RpcRequest.js.map +1 -1
  169. package/lib/cjs/rpc/core/RpcRequestContext.js.map +1 -1
  170. package/lib/cjs/rpc/core/RpcRoutingToken.js.map +1 -1
  171. package/lib/cjs/rpc/core/RpcSessionInvocation.js.map +1 -1
  172. package/lib/cjs/rpc/web/BentleyCloudRpcManager.js.map +1 -1
  173. package/lib/cjs/rpc/web/BentleyCloudRpcProtocol.js.map +1 -1
  174. package/lib/cjs/rpc/web/OpenAPI.js.map +1 -1
  175. package/lib/cjs/rpc/web/RpcMultipart.js.map +1 -1
  176. package/lib/cjs/rpc/web/WebAppRpcLogging.js.map +1 -1
  177. package/lib/cjs/rpc/web/WebAppRpcProtocol.js.map +1 -1
  178. package/lib/cjs/rpc/web/WebAppRpcRequest.js.map +1 -1
  179. package/lib/cjs/rpc/web/multipart/RpcMultipartParser.js.map +1 -1
  180. package/lib/cjs/tile/B3dmTileIO.js.map +1 -1
  181. package/lib/cjs/tile/CompositeTileIO.js.map +1 -1
  182. package/lib/cjs/tile/ElementGraphics.js.map +1 -1
  183. package/lib/cjs/tile/GltfTileIO.js.map +1 -1
  184. package/lib/cjs/tile/I3dmTileIO.js.map +1 -1
  185. package/lib/cjs/tile/IModelTileIO.js.map +1 -1
  186. package/lib/cjs/tile/PntsTileIO.js.map +1 -1
  187. package/lib/cjs/tile/TileIO.js.map +1 -1
  188. package/lib/cjs/tile/TileMetadata.js.map +1 -1
  189. package/lib/cjs/tile/Tileset3dSchema.js.map +1 -1
  190. package/lib/esm/AmbientOcclusion.js.map +1 -1
  191. package/lib/esm/AnalysisStyle.js.map +1 -1
  192. package/lib/esm/Atmosphere.js.map +1 -1
  193. package/lib/esm/AuthorizationClient.js.map +1 -1
  194. package/lib/esm/BackgroundMapProvider.js.map +1 -1
  195. package/lib/esm/BackgroundMapSettings.js.map +1 -1
  196. package/lib/esm/Base64EncodedString.js.map +1 -1
  197. package/lib/esm/BlobReader.js.map +1 -1
  198. package/lib/esm/BriefcaseTypes.js.map +1 -1
  199. package/lib/esm/Camera.js.map +1 -1
  200. package/lib/esm/CatalogIModel.d.ts +152 -0
  201. package/lib/esm/CatalogIModel.d.ts.map +1 -0
  202. package/lib/esm/CatalogIModel.js +27 -0
  203. package/lib/esm/CatalogIModel.js.map +1 -0
  204. package/lib/esm/CesiumIonAssets.d.ts +23 -0
  205. package/lib/esm/CesiumIonAssets.d.ts.map +1 -0
  206. package/lib/esm/CesiumIonAssets.js +29 -0
  207. package/lib/esm/CesiumIonAssets.js.map +1 -0
  208. package/lib/esm/ChangedElements.js.map +1 -1
  209. package/lib/esm/ChangedEntities.js.map +1 -1
  210. package/lib/esm/ChangesetProps.js.map +1 -1
  211. package/lib/esm/ClipStyle.js.map +1 -1
  212. package/lib/esm/Code.js.map +1 -1
  213. package/lib/esm/ColorByName.js.map +1 -1
  214. package/lib/esm/ColorDef.js.map +1 -1
  215. package/lib/esm/CommonLoggerCategory.js.map +1 -1
  216. package/lib/esm/ConcurrentQuery.js.map +1 -1
  217. package/lib/esm/ContextRealityModel.js.map +1 -1
  218. package/lib/esm/ContourDisplay.js.map +1 -1
  219. package/lib/esm/DisplayStyleSettings.js.map +1 -1
  220. package/lib/esm/ECSchemaProps.js.map +1 -1
  221. package/lib/esm/ECSqlReader.js.map +1 -1
  222. package/lib/esm/ECSqlTypes.js.map +1 -1
  223. package/lib/esm/ElementMesh.js.map +1 -1
  224. package/lib/esm/ElementProps.js.map +1 -1
  225. package/lib/esm/EmphasizeElementsProps.js.map +1 -1
  226. package/lib/esm/EntityProps.js.map +1 -1
  227. package/lib/esm/EntityReference.js.map +1 -1
  228. package/lib/esm/Environment.js.map +1 -1
  229. package/lib/esm/FeatureIndex.js.map +1 -1
  230. package/lib/esm/FeatureSymbology.js.map +1 -1
  231. package/lib/esm/FeatureTable.js.map +1 -1
  232. package/lib/esm/Fonts.js.map +1 -1
  233. package/lib/esm/Frustum.js.map +1 -1
  234. package/lib/esm/GenericInstanceFilter.js.map +1 -1
  235. package/lib/esm/GeoCoordinateServices.js.map +1 -1
  236. package/lib/esm/GeometryContainment.js.map +1 -1
  237. package/lib/esm/GeometryParams.js.map +1 -1
  238. package/lib/esm/GeometrySummary.js.map +1 -1
  239. package/lib/esm/Gradient.js.map +1 -1
  240. package/lib/esm/GraphicParams.js.map +1 -1
  241. package/lib/esm/GroundPlane.js.map +1 -1
  242. package/lib/esm/HSLColor.js.map +1 -1
  243. package/lib/esm/HSVColor.js.map +1 -1
  244. package/lib/esm/HiddenLine.js.map +1 -1
  245. package/lib/esm/Hilite.js.map +1 -1
  246. package/lib/esm/IModel.js.map +1 -1
  247. package/lib/esm/IModelError.js.map +1 -1
  248. package/lib/esm/IModelVersion.js.map +1 -1
  249. package/lib/esm/ITwinCoreErrors.d.ts +87 -8
  250. package/lib/esm/ITwinCoreErrors.d.ts.map +1 -1
  251. package/lib/esm/ITwinCoreErrors.js +73 -11
  252. package/lib/esm/ITwinCoreErrors.js.map +1 -1
  253. package/lib/esm/Image.js.map +1 -1
  254. package/lib/esm/IpcAppProps.js.map +1 -1
  255. package/lib/esm/LightSettings.js.map +1 -1
  256. package/lib/esm/LinePixels.js.map +1 -1
  257. package/lib/esm/Localization.js.map +1 -1
  258. package/lib/esm/MapImagerySettings.js.map +1 -1
  259. package/lib/esm/MapLayerSettings.d.ts +4 -2
  260. package/lib/esm/MapLayerSettings.d.ts.map +1 -1
  261. package/lib/esm/MapLayerSettings.js +4 -2
  262. package/lib/esm/MapLayerSettings.js.map +1 -1
  263. package/lib/esm/MassProperties.js.map +1 -1
  264. package/lib/esm/MaterialProps.js.map +1 -1
  265. package/lib/esm/ModelClipGroup.js.map +1 -1
  266. package/lib/esm/ModelGeometryChanges.js.map +1 -1
  267. package/lib/esm/ModelProps.js.map +1 -1
  268. package/lib/esm/NativeAppProps.js.map +1 -1
  269. package/lib/esm/OctEncodedNormal.js.map +1 -1
  270. package/lib/esm/PlanProjectionSettings.js.map +1 -1
  271. package/lib/esm/PlanarClipMask.js.map +1 -1
  272. package/lib/esm/QPoint.js.map +1 -1
  273. package/lib/esm/RealityDataAccessProps.js.map +1 -1
  274. package/lib/esm/RealityModelDisplaySettings.js.map +1 -1
  275. package/lib/esm/RenderMaterial.js.map +1 -1
  276. package/lib/esm/RenderPolyline.js.map +1 -1
  277. package/lib/esm/RenderTexture.js.map +1 -1
  278. package/lib/esm/RgbColor.js.map +1 -1
  279. package/lib/esm/RpcInterface.js.map +1 -1
  280. package/lib/esm/RpcManager.js.map +1 -1
  281. package/lib/esm/SessionProps.js.map +1 -1
  282. package/lib/esm/SkyBox.js.map +1 -1
  283. package/lib/esm/SolarCalculate.js.map +1 -1
  284. package/lib/esm/SolarShadows.js.map +1 -1
  285. package/lib/esm/SpatialClassification.js.map +1 -1
  286. package/lib/esm/SubCategoryAppearance.js.map +1 -1
  287. package/lib/esm/SubCategoryOverride.js.map +1 -1
  288. package/lib/esm/TerrainSettings.d.ts +0 -12
  289. package/lib/esm/TerrainSettings.d.ts.map +1 -1
  290. package/lib/esm/TerrainSettings.js +1 -13
  291. package/lib/esm/TerrainSettings.js.map +1 -1
  292. package/lib/esm/TextureMapping.js.map +1 -1
  293. package/lib/esm/TextureProps.js.map +1 -1
  294. package/lib/esm/ThematicDisplay.js.map +1 -1
  295. package/lib/esm/Thumbnail.js.map +1 -1
  296. package/lib/esm/TileProps.js.map +1 -1
  297. package/lib/esm/Tween.js.map +1 -1
  298. package/lib/esm/TxnAction.js.map +1 -1
  299. package/lib/esm/ViewDetails.js.map +1 -1
  300. package/lib/esm/ViewFlags.js.map +1 -1
  301. package/lib/esm/ViewProps.js.map +1 -1
  302. package/lib/esm/WhiteOnWhiteReversalSettings.js.map +1 -1
  303. package/lib/esm/annotation/TextAnnotation.js.map +1 -1
  304. package/lib/esm/annotation/TextBlock.js.map +1 -1
  305. package/lib/esm/annotation/TextBlockGeometryProps.js.map +1 -1
  306. package/lib/esm/annotation/TextBlockLayoutResult.js.map +1 -1
  307. package/lib/esm/annotation/TextStyle.js.map +1 -1
  308. package/lib/esm/core-common.d.ts +2 -0
  309. package/lib/esm/core-common.d.ts.map +1 -1
  310. package/lib/esm/core-common.js +2 -0
  311. package/lib/esm/core-common.js.map +1 -1
  312. package/lib/esm/domains/FunctionalElementProps.js.map +1 -1
  313. package/lib/esm/domains/GenericElementProps.js.map +1 -1
  314. package/lib/esm/geometry/AdditionalTransform.js.map +1 -1
  315. package/lib/esm/geometry/AreaPattern.js.map +1 -1
  316. package/lib/esm/geometry/BoundingSphere.js.map +1 -1
  317. package/lib/esm/geometry/Cartographic.js.map +1 -1
  318. package/lib/esm/geometry/CoordinateReferenceSystem.js.map +1 -1
  319. package/lib/esm/geometry/ElementGeometry.js.map +1 -1
  320. package/lib/esm/geometry/ElementGeometryFB.js.map +1 -1
  321. package/lib/esm/geometry/FrustumPlanes.js.map +1 -1
  322. package/lib/esm/geometry/GeodeticDatum.js.map +1 -1
  323. package/lib/esm/geometry/GeodeticEllipsoid.js.map +1 -1
  324. package/lib/esm/geometry/GeometryStream.js.map +1 -1
  325. package/lib/esm/geometry/ImageGraphic.js.map +1 -1
  326. package/lib/esm/geometry/LineStyle.js.map +1 -1
  327. package/lib/esm/geometry/Placement.js.map +1 -1
  328. package/lib/esm/geometry/Projection.js.map +1 -1
  329. package/lib/esm/geometry/TextString.js.map +1 -1
  330. package/lib/esm/internal/BackendTypes.js.map +1 -1
  331. package/lib/esm/internal/PackedFeatureTable.js.map +1 -1
  332. package/lib/esm/internal/RenderMaterialParams.js.map +1 -1
  333. package/lib/esm/internal/RenderMesh.js.map +1 -1
  334. package/lib/esm/internal/RenderTextureParams.js.map +1 -1
  335. package/lib/esm/internal/Snapping.js.map +1 -1
  336. package/lib/esm/internal/cross-package.js.map +1 -1
  337. package/lib/esm/ipc/IpcSession.js.map +1 -1
  338. package/lib/esm/ipc/IpcSocket.js.map +1 -1
  339. package/lib/esm/ipc/IpcWebSocket.js.map +1 -1
  340. package/lib/esm/ipc/IpcWebSocketTransport.js.map +1 -1
  341. package/lib/esm/rpc/DevToolsRpcInterface.js.map +1 -1
  342. package/lib/esm/rpc/IModelReadRpcInterface.js.map +1 -1
  343. package/lib/esm/rpc/IModelTileRpcInterface.js.map +1 -1
  344. package/lib/esm/rpc/SnapshotIModelRpcInterface.js.map +1 -1
  345. package/lib/esm/rpc/TestRpcManager.js.map +1 -1
  346. package/lib/esm/rpc/core/RpcConfiguration.js.map +1 -1
  347. package/lib/esm/rpc/core/RpcConstants.js.map +1 -1
  348. package/lib/esm/rpc/core/RpcControl.js.map +1 -1
  349. package/lib/esm/rpc/core/RpcInvocation.js.map +1 -1
  350. package/lib/esm/rpc/core/RpcMarshaling.js.map +1 -1
  351. package/lib/esm/rpc/core/RpcOperation.js.map +1 -1
  352. package/lib/esm/rpc/core/RpcPendingQueue.js.map +1 -1
  353. package/lib/esm/rpc/core/RpcProtocol.js.map +1 -1
  354. package/lib/esm/rpc/core/RpcPush.js.map +1 -1
  355. package/lib/esm/rpc/core/RpcRegistry.js.map +1 -1
  356. package/lib/esm/rpc/core/RpcRequest.js.map +1 -1
  357. package/lib/esm/rpc/core/RpcRequestContext.js.map +1 -1
  358. package/lib/esm/rpc/core/RpcRoutingToken.js.map +1 -1
  359. package/lib/esm/rpc/core/RpcSessionInvocation.js.map +1 -1
  360. package/lib/esm/rpc/web/BentleyCloudRpcManager.js.map +1 -1
  361. package/lib/esm/rpc/web/BentleyCloudRpcProtocol.js.map +1 -1
  362. package/lib/esm/rpc/web/OpenAPI.js.map +1 -1
  363. package/lib/esm/rpc/web/RpcMultipart.js.map +1 -1
  364. package/lib/esm/rpc/web/WebAppRpcLogging.js.map +1 -1
  365. package/lib/esm/rpc/web/WebAppRpcProtocol.js.map +1 -1
  366. package/lib/esm/rpc/web/WebAppRpcRequest.js.map +1 -1
  367. package/lib/esm/rpc/web/multipart/RpcMultipartParser.js.map +1 -1
  368. package/lib/esm/tile/B3dmTileIO.js.map +1 -1
  369. package/lib/esm/tile/CompositeTileIO.js.map +1 -1
  370. package/lib/esm/tile/ElementGraphics.js.map +1 -1
  371. package/lib/esm/tile/GltfTileIO.js.map +1 -1
  372. package/lib/esm/tile/I3dmTileIO.js.map +1 -1
  373. package/lib/esm/tile/IModelTileIO.js.map +1 -1
  374. package/lib/esm/tile/PntsTileIO.js.map +1 -1
  375. package/lib/esm/tile/TileIO.js.map +1 -1
  376. package/lib/esm/tile/TileMetadata.js.map +1 -1
  377. package/lib/esm/tile/Tileset3dSchema.js.map +1 -1
  378. package/package.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"file":"RealityModelDisplaySettings.js","sourceRoot":"","sources":["../../src/RealityModelDisplaySettings.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAsEH;;;;;;;;GAQG;AACH,MAAM,OAAO,yBAAyB;IACpC;;OAEG;IACa,KAAK,CAAkB;IACvC;;;;OAIG;IACa,QAAQ,CAAqB;IAC7C;;;OAGG;IACa,SAAS,CAAS;IAClC;;;OAGG;IACa,UAAU,CAAS;IACnC;;OAEG;IACa,iBAAiB,CAAS;IAC1C;;OAEG;IACa,iBAAiB,CAAS;IAC1C;;;OAGG;IACa,OAAO,CAAoB;IAC3C;;;OAGG;IACa,WAAW,CAAS;IACpC;;;;OAIG;IACa,SAAS,CAAS;IAClC;;;OAGG;IACa,SAAS,CAAU;IACnC;;;;OAIG;IACa,UAAU,CAAU;IACpC;;;;OAIG;IACa,UAAU,CAAU;IACpC;;;;OAIG;IACa,UAAU,CAAU;IAEpC,wEAAwE;IACjE,MAAM,CAAC,QAAQ,GAAG,IAAI,yBAAyB,EAAE,CAAC;IAEzD,YAAoB,KAA8B;QAChD,IAAI,CAAC,KAAK,GAAG,KAAK,EAAE,KAAK,IAAI,OAAO,CAAC;QACrC,IAAI,CAAC,QAAQ,GAAG,KAAK,EAAE,QAAQ,IAAI,OAAO,CAAC;QAE3C,8EAA8E;QAC9E,IAAI,CAAC,SAAS,GAAG,KAAK,EAAE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AC,YAAsC;QACjD,MAAM,UAAU,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC;QAC9G,MAAM,UAAU,GAAG,YAAY,CAAC,cAAc,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC;QACjI,OAAO,IAAI,2BAA2B,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IACjE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module DisplayStyles\n */\n\n/** Specifies how the sizes of the individual points within a point cloud are computed.\n * - \"pixel\": Each point is an exact number of pixels in diameter, as specified by [[PointCloudDisplaySettings.pixelSize]].\n * - \"voxel\": Each point is the size of a \"voxel\" in meters, as specified by the [Tile]($frontend) to which the point belongs.\n * @see [[PointCloudDisplaySettings.sizeMode]].\n * @beta\n */\nexport type PointCloudSizeMode = \"voxel\" | \"pixel\";\n\n/** Specifies the shape drawn for each individual point within a point cloud.\n * - \"round\": Each point is drawn as a circle.\n * - \"square\": Each point is drawn as a square.\n * @see [[PointCloudDisplaySettings.shape]].\n * @beta\n */\nexport type PointCloudShape = \"square\" | \"round\";\n\n/** Specifies the Eye-Dome Lighting mode used for a point cloud.\n * - \"off\": EDL is not calculated\n * - \"on\": EDL is calculated using a single pass.\n * - \"full\" EDL is calculated with full algorithm including optional filtering\n * @see [[PointCloudDisplaySettings.edlMode]].\n * @beta\n */\nexport type PointCloudEDLMode = \"off\" | \"on\" | \"full\";\n\n/** The JSON representation of [[PointCloudDisplaySettings]].\n * @beta\n */\nexport interface PointCloudDisplayProps {\n /** See [[PointCloudDisplaySettings.sizeMode]]. */\n sizeMode?: PointCloudSizeMode;\n /** See [[PointCloudDisplaySettings.voxelScale]]. */\n voxelScale?: number;\n /** See [[PointCloudDisplaySettings.minPixelsPerVoxel]]. */\n minPixelsPerVoxel?: number;\n /** See [[PointCloudDisplaySettings.maxPixelsPerVoxel]]. */\n maxPixelsPerVoxel?: number;\n /** See [[PointCloudDisplaySettings.pixelSize]]. */\n pixelSize?: number;\n /** See [[PointCloudDisplaySettings.shape]]. */\n shape?: PointCloudShape;\n /** See [[PointCloudDisplaySettings.edlMode]]. */\n edlMode?: PointCloudEDLMode;\n /** See [[PointCloudDisplaySettings.edlStrength]]. */\n edlStrength?: number;\n /** See [[PointCloudDisplaySettings.edlRadius]]. */\n edlRadius?: number;\n /** See [[PointCloudDisplaySettings.edlFilter]]. */\n edlFilter?: number;\n /** See [[PointCloudDisplaySettings.edlMixWts1]]. */\n edlMixWts1?: number;\n /** See [[PointCloudDisplaySettings.edlMixWts2]]. */\n edlMixWts2?: number;\n /** See [[PointCloudDisplaySettings.edlMixWts4]]. */\n edlMixWts4?: number;\n}\n\n/** The JSON representation of [[RealityModelDisplaySettings]].\n * @beta\n */\nexport interface RealityModelDisplayProps {\n /** See [[RealityModelDisplaySettings.pointCloud]]. */\n pointCloud?: PointCloudDisplayProps;\n /** See [[RealityModelDisplaySettings.overrideColorRatio]]. */\n overrideColorRatio?: number;\n // ###TODO when we need it: mesh?: RealityMeshDisplayProps;\n}\n\n/** Settings that control how a point cloud reality model is displayed within a [Viewport]($frontend).\n * @note This is an immutable type - to modify its properties, use [[clone]].\n * Eye-Dome Lighting (EDL) is a non-photorealistic, image-based shading technique that was designed to improve depth\n * perception in scientific visualization. It is particularly useful for visualizing monochrome point cloud data, but\n * also can be useful for point clouds with color information.\n * @note EDL mode is ignored (off) if the view is not perspective (camera is off)\n * @see [[RealityModelDisplaySettings.pointCloud]].\n * @beta\n */\nexport class PointCloudDisplaySettings {\n /** The shape drawn for each point in the cloud.\n * Default: \"round\".\n */\n public readonly shape: PointCloudShape;\n /** The method by which the size of each individual point is computed.\n * Default: \"voxel\".\n * @see [[pixelSize]] to configure the size for \"pixel\" mode.\n * @see [[voxelScale]], [[minPixelsPerVoxel]], and [[maxPixelsPerVoxel]] to configure the size for \"voxel\" mode.\n */\n public readonly sizeMode: PointCloudSizeMode;\n /** The radius of each point in pixels, when [[sizeMode]] is \"pixel\".\n * The size is expected to be a positive integer. The maximum size will vary based on the graphics hardware in use, but typically is limited to 32 or 64 pixels.\n * Default: 1\n */\n public readonly pixelSize: number;\n /** A scale factor applied to the size of each point, when [[sizeMode]] is \"voxel\".\n * The scale is expected to be a positive floating point number.\n * Default: 1.0\n */\n public readonly voxelScale: number;\n /** If [[sizeMode]] is \"voxel\", the minimum radius of each point in pixels. It is expected to be a positive integer no greater than [[maxPixelsPerVoxel]].\n * Default: 2\n */\n public readonly minPixelsPerVoxel: number;\n /** If [[sizeMode]] is \"voxel\", the maximum radius of each point in pixels. It is expected to be a positive integer no less than [[minPixelsPerVoxel]].\n * Default: 20.\n */\n public readonly maxPixelsPerVoxel: number;\n /** The mode for the Eye-Dome Lighting (EDL) effect.\n * Default: \"off\"\n * @note EDL mode is ignored (off) if the view is not perspective (camera is off)\n */\n public readonly edlMode: PointCloudEDLMode;\n /** A strength value for the Eye Dome Lighting (EDL) effect.\n * The strength is expected to be a positive floating point number.\n * Default: 5.0\n */\n public readonly edlStrength: number;\n /** A radius value for the Eye Dome Lighting (EDL) effect.\n * The radius is expected to be a positive floating point number\n * It is used to deterimine how far away in pixels to sample for depth change\n * Default: 2.0\n */\n public readonly edlRadius: number;\n /** A flag for whether or not to apply filtering pass in the Eye Dome Lighting (EDL) effect.\n * It only applies if edlMode is \"full\"\n * Default: 1.0\n */\n public readonly edlFilter?: number;\n /** A weighting value to apply to the full image when combining it with the half and quarter sized ones\n * It only applies if edlMode is \"full\"\n * The strength is expected to be a floating point number between 0 and 1 inclusive.\n * Default: 1.0\n */\n public readonly edlMixWts1?: number;\n /** A weighting value to apply to the half sized image when combining it with the full and quarter sized ones\n * It only applies if edlMode is \"full\"\n * The strength is expected to be a floating point number between 0 and 1 inclusive.\n * Default: 0.5\n */\n public readonly edlMixWts2?: number;\n /** A weighting value to apply to the quarter sized image when combining it with the full and half sized ones\n * It only applies if edlMode is \"full\"\n * The strength is expected to be a floating point number between 0 and 1 inclusive.\n * Default: 0.25\n */\n public readonly edlMixWts4?: number;\n\n /** Settings with all properties initialized to their default values. */\n public static defaults = new PointCloudDisplaySettings();\n\n private constructor(props?: PointCloudDisplayProps) {\n this.shape = props?.shape ?? \"round\";\n this.sizeMode = props?.sizeMode ?? \"voxel\";\n\n // No sanity checks here - e.g., min < max, pixelSize and voxelScale > 0, etc.\n this.pixelSize = props?.pixelSize ?? 1;\n this.voxelScale = props?.voxelScale ?? 1;\n this.minPixelsPerVoxel = props?.minPixelsPerVoxel ?? 2;\n this.maxPixelsPerVoxel = props?.maxPixelsPerVoxel ?? 20;\n this.edlMode = props?.edlMode ?? \"off\";\n this.edlStrength = props?.edlStrength ?? 5;\n this.edlRadius = props?.edlRadius ?? 2;\n this.edlFilter = props?.edlFilter ?? 1;\n this.edlMixWts1 = props?.edlMixWts1 ?? 1.0;\n this.edlMixWts2 = props?.edlMixWts2 ?? 0.5;\n this.edlMixWts4 = props?.edlMixWts4 ?? 0.25;\n }\n\n /** Create display settings from their JSON representation. If `props` is `undefined`, the default settings are returned. */\n public static fromJSON(props?: PointCloudDisplayProps): PointCloudDisplaySettings {\n return props ? new PointCloudDisplaySettings(props) : this.defaults;\n }\n\n /** Convert these settings to their JSON representation. */\n public toJSON(): PointCloudDisplayProps | undefined {\n const defs = PointCloudDisplaySettings.defaults;\n if (this.equals(defs))\n return undefined;\n\n const props: PointCloudDisplayProps = { };\n if (this.shape !== defs.shape)\n props.shape = this.shape;\n\n if (this.sizeMode !== defs.sizeMode)\n props.sizeMode = this.sizeMode;\n\n if (this.pixelSize !== defs.pixelSize)\n props.pixelSize = this.pixelSize;\n\n if (this.voxelScale !== defs.voxelScale)\n props.voxelScale = this.voxelScale;\n\n if (this.minPixelsPerVoxel !== defs.minPixelsPerVoxel)\n props.minPixelsPerVoxel = this.minPixelsPerVoxel;\n\n if (this.maxPixelsPerVoxel !== defs.maxPixelsPerVoxel)\n props.maxPixelsPerVoxel = this.maxPixelsPerVoxel;\n\n if (this.edlMode !== defs.edlMode)\n props.edlMode = this.edlMode;\n\n if (this.edlStrength !== defs.edlStrength)\n props.edlStrength = this.edlStrength;\n\n if (this.edlRadius !== defs.edlRadius)\n props.edlRadius = this.edlRadius;\n\n if (this.edlFilter !== defs.edlFilter)\n props.edlFilter = this.edlFilter;\n\n if (this.edlMixWts1 !== defs.edlMixWts1)\n props.edlMixWts1 = this.edlMixWts1;\n\n if (this.edlMixWts2 !== defs.edlMixWts2)\n props.edlMixWts2 = this.edlMixWts2;\n\n if (this.edlMixWts4 !== defs.edlMixWts4)\n props.edlMixWts4 = this.edlMixWts4;\n\n return props;\n }\n\n /** Create a copy of these settings, identical except for any properties explicitly specified by `changedProps`. */\n public clone(changedProps: PointCloudDisplayProps): PointCloudDisplaySettings {\n return PointCloudDisplaySettings.fromJSON({\n ...this.toJSON(),\n ...changedProps,\n });\n }\n\n /** Returns true if these settings are identical to `other`. */\n public equals(other: PointCloudDisplaySettings): boolean {\n if (this === other)\n return true;\n\n return this.shape === other.shape && this.sizeMode === other.sizeMode && this.pixelSize === other.pixelSize\n && this.voxelScale === other.voxelScale && this.minPixelsPerVoxel === other.minPixelsPerVoxel && this.maxPixelsPerVoxel === other.maxPixelsPerVoxel\n && this.edlMode === other.edlMode && this.edlStrength === other.edlStrength && this.edlRadius === other.edlRadius\n && this.edlFilter === other.edlFilter\n && this.edlMixWts1 === other.edlMixWts1 && this.edlMixWts2 === other.edlMixWts2 && this.edlMixWts4 === other.edlMixWts4\n ;\n }\n}\n\n/** Settings that control how a reality model - whether a [[ContextRealityModel]] or a persistent reality [Model]($backend) - is displayed within a [Viewport]($frontend).\n * @see [[ContextRealityModel.displaySettings]] to apply these settings to a context reality model.\n * @see [[DisplayStyleSettings.setRealityModelDisplaySettings]] to apply these settings to a persistent reality model.\n * @note This is an immutable type - to modify its properties, use [[clone]].\n * @beta\n */\nexport class RealityModelDisplaySettings {\n /** If the reality model's color is overridden with another color, a ratio in [0..1] with which to mix the two colors together.\n * A ratio of 0 uses only the reality model's color, a ratio of 1 uses only the override color, and a ratio of 0.5 mixes the two colors equally.\n * The color may be overridden using [[FeatureOverrides]] such as those supplied by a [FeatureOverrideProvider]($frontend), or by applying a [[SpatialClassifier]].\n * Default: 0.5\n */\n public readonly overrideColorRatio: number;\n /** Settings that apply specifically to point cloud reality models.\n * Default: [[PointCloudDisplaySettings.defaults]].\n */\n public readonly pointCloud: PointCloudDisplaySettings;\n\n /** Settings with all properties initialized to their default values. */\n public static defaults = new RealityModelDisplaySettings(undefined, PointCloudDisplaySettings.defaults);\n\n private constructor(overrideColorRatio: number | undefined, pointCloud: PointCloudDisplaySettings) {\n this.overrideColorRatio = overrideColorRatio ?? 0.5;\n this.pointCloud = pointCloud;\n }\n\n /** Create display settings from their JSON representation. If `props` is `undefined`, the default settings are returned. */\n public static fromJSON(props?: RealityModelDisplayProps): RealityModelDisplaySettings {\n if (!props)\n return this.defaults;\n\n return new RealityModelDisplaySettings(props.overrideColorRatio, PointCloudDisplaySettings.fromJSON(props.pointCloud));\n }\n\n /** Convert these settings to their JSON representation, which is `undefined` if all of their properties match the default settings. */\n public toJSON(): RealityModelDisplayProps | undefined {\n const pointCloud = this.pointCloud.toJSON();\n const overrideColorRatio = this.overrideColorRatio === RealityModelDisplaySettings.defaults.overrideColorRatio ? undefined : this.overrideColorRatio;\n\n if (undefined === pointCloud && undefined === overrideColorRatio)\n return undefined;\n\n const props: RealityModelDisplayProps = { };\n if (undefined !== pointCloud)\n props.pointCloud = pointCloud;\n\n if (undefined !== overrideColorRatio)\n props.overrideColorRatio = overrideColorRatio;\n\n return props;\n }\n\n /** Returns true if these settings are identical to `other`. */\n public equals(other: RealityModelDisplaySettings): boolean {\n if (this === other)\n return true;\n\n return this.overrideColorRatio === other.overrideColorRatio && this.pointCloud.equals(other.pointCloud);\n }\n\n /** Create a copy of these settings, identical except for any properties explicitly specified by `changedProps`. */\n public clone(changedProps: RealityModelDisplayProps): RealityModelDisplaySettings {\n const pointCloud = changedProps.pointCloud ? this.pointCloud.clone(changedProps.pointCloud) : this.pointCloud;\n const colorRatio = changedProps.hasOwnProperty(\"overrideColorRatio\") ? changedProps.overrideColorRatio : this.overrideColorRatio;\n return new RealityModelDisplaySettings(colorRatio, pointCloud);\n }\n}\n"]}
1
+ {"version":3,"file":"RealityModelDisplaySettings.js","sourceRoot":"","sources":["../../src/RealityModelDisplaySettings.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAsEH;;;;;;;;GAQG;AACH,MAAM,OAAO,yBAAyB;IACpC;;OAEG;IACa,KAAK,CAAkB;IACvC;;;;OAIG;IACa,QAAQ,CAAqB;IAC7C;;;OAGG;IACa,SAAS,CAAS;IAClC;;;OAGG;IACa,UAAU,CAAS;IACnC;;OAEG;IACa,iBAAiB,CAAS;IAC1C;;OAEG;IACa,iBAAiB,CAAS;IAC1C;;;OAGG;IACa,OAAO,CAAoB;IAC3C;;;OAGG;IACa,WAAW,CAAS;IACpC;;;;OAIG;IACa,SAAS,CAAS;IAClC;;;OAGG;IACa,SAAS,CAAU;IACnC;;;;OAIG;IACa,UAAU,CAAU;IACpC;;;;OAIG;IACa,UAAU,CAAU;IACpC;;;;OAIG;IACa,UAAU,CAAU;IAEpC,wEAAwE;IACjE,MAAM,CAAC,QAAQ,GAAG,IAAI,yBAAyB,EAAE,CAAC;IAEzD,YAAoB,KAA8B;QAChD,IAAI,CAAC,KAAK,GAAG,KAAK,EAAE,KAAK,IAAI,OAAO,CAAC;QACrC,IAAI,CAAC,QAAQ,GAAG,KAAK,EAAE,QAAQ,IAAI,OAAO,CAAC;QAE3C,8EAA8E;QAC9E,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CAAC;IAED,mHAAmH;IAC5G,KAAK,CAAC,YAAsC;QACjD,MAAM,UAAU,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC;QAC9G,MAAM,UAAU,GAAG,YAAY,CAAC,cAAc,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC;QACjI,OAAO,IAAI,2BAA2B,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IACjE,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\n/** Specifies how the sizes of the individual points within a point cloud are computed.\r\n * - \"pixel\": Each point is an exact number of pixels in diameter, as specified by [[PointCloudDisplaySettings.pixelSize]].\r\n * - \"voxel\": Each point is the size of a \"voxel\" in meters, as specified by the [Tile]($frontend) to which the point belongs.\r\n * @see [[PointCloudDisplaySettings.sizeMode]].\r\n * @beta\r\n */\r\nexport type PointCloudSizeMode = \"voxel\" | \"pixel\";\r\n\r\n/** Specifies the shape drawn for each individual point within a point cloud.\r\n * - \"round\": Each point is drawn as a circle.\r\n * - \"square\": Each point is drawn as a square.\r\n * @see [[PointCloudDisplaySettings.shape]].\r\n * @beta\r\n */\r\nexport type PointCloudShape = \"square\" | \"round\";\r\n\r\n/** Specifies the Eye-Dome Lighting mode used for a point cloud.\r\n * - \"off\": EDL is not calculated\r\n * - \"on\": EDL is calculated using a single pass.\r\n * - \"full\" EDL is calculated with full algorithm including optional filtering\r\n * @see [[PointCloudDisplaySettings.edlMode]].\r\n * @beta\r\n */\r\nexport type PointCloudEDLMode = \"off\" | \"on\" | \"full\";\r\n\r\n/** The JSON representation of [[PointCloudDisplaySettings]].\r\n * @beta\r\n */\r\nexport interface PointCloudDisplayProps {\r\n /** See [[PointCloudDisplaySettings.sizeMode]]. */\r\n sizeMode?: PointCloudSizeMode;\r\n /** See [[PointCloudDisplaySettings.voxelScale]]. */\r\n voxelScale?: number;\r\n /** See [[PointCloudDisplaySettings.minPixelsPerVoxel]]. */\r\n minPixelsPerVoxel?: number;\r\n /** See [[PointCloudDisplaySettings.maxPixelsPerVoxel]]. */\r\n maxPixelsPerVoxel?: number;\r\n /** See [[PointCloudDisplaySettings.pixelSize]]. */\r\n pixelSize?: number;\r\n /** See [[PointCloudDisplaySettings.shape]]. */\r\n shape?: PointCloudShape;\r\n /** See [[PointCloudDisplaySettings.edlMode]]. */\r\n edlMode?: PointCloudEDLMode;\r\n /** See [[PointCloudDisplaySettings.edlStrength]]. */\r\n edlStrength?: number;\r\n /** See [[PointCloudDisplaySettings.edlRadius]]. */\r\n edlRadius?: number;\r\n /** See [[PointCloudDisplaySettings.edlFilter]]. */\r\n edlFilter?: number;\r\n /** See [[PointCloudDisplaySettings.edlMixWts1]]. */\r\n edlMixWts1?: number;\r\n /** See [[PointCloudDisplaySettings.edlMixWts2]]. */\r\n edlMixWts2?: number;\r\n /** See [[PointCloudDisplaySettings.edlMixWts4]]. */\r\n edlMixWts4?: number;\r\n}\r\n\r\n/** The JSON representation of [[RealityModelDisplaySettings]].\r\n * @beta\r\n */\r\nexport interface RealityModelDisplayProps {\r\n /** See [[RealityModelDisplaySettings.pointCloud]]. */\r\n pointCloud?: PointCloudDisplayProps;\r\n /** See [[RealityModelDisplaySettings.overrideColorRatio]]. */\r\n overrideColorRatio?: number;\r\n // ###TODO when we need it: mesh?: RealityMeshDisplayProps;\r\n}\r\n\r\n/** Settings that control how a point cloud reality model is displayed within a [Viewport]($frontend).\r\n * @note This is an immutable type - to modify its properties, use [[clone]].\r\n * Eye-Dome Lighting (EDL) is a non-photorealistic, image-based shading technique that was designed to improve depth\r\n * perception in scientific visualization. It is particularly useful for visualizing monochrome point cloud data, but\r\n * also can be useful for point clouds with color information.\r\n * @note EDL mode is ignored (off) if the view is not perspective (camera is off)\r\n * @see [[RealityModelDisplaySettings.pointCloud]].\r\n * @beta\r\n */\r\nexport class PointCloudDisplaySettings {\r\n /** The shape drawn for each point in the cloud.\r\n * Default: \"round\".\r\n */\r\n public readonly shape: PointCloudShape;\r\n /** The method by which the size of each individual point is computed.\r\n * Default: \"voxel\".\r\n * @see [[pixelSize]] to configure the size for \"pixel\" mode.\r\n * @see [[voxelScale]], [[minPixelsPerVoxel]], and [[maxPixelsPerVoxel]] to configure the size for \"voxel\" mode.\r\n */\r\n public readonly sizeMode: PointCloudSizeMode;\r\n /** The radius of each point in pixels, when [[sizeMode]] is \"pixel\".\r\n * The size is expected to be a positive integer. The maximum size will vary based on the graphics hardware in use, but typically is limited to 32 or 64 pixels.\r\n * Default: 1\r\n */\r\n public readonly pixelSize: number;\r\n /** A scale factor applied to the size of each point, when [[sizeMode]] is \"voxel\".\r\n * The scale is expected to be a positive floating point number.\r\n * Default: 1.0\r\n */\r\n public readonly voxelScale: number;\r\n /** If [[sizeMode]] is \"voxel\", the minimum radius of each point in pixels. It is expected to be a positive integer no greater than [[maxPixelsPerVoxel]].\r\n * Default: 2\r\n */\r\n public readonly minPixelsPerVoxel: number;\r\n /** If [[sizeMode]] is \"voxel\", the maximum radius of each point in pixels. It is expected to be a positive integer no less than [[minPixelsPerVoxel]].\r\n * Default: 20.\r\n */\r\n public readonly maxPixelsPerVoxel: number;\r\n /** The mode for the Eye-Dome Lighting (EDL) effect.\r\n * Default: \"off\"\r\n * @note EDL mode is ignored (off) if the view is not perspective (camera is off)\r\n */\r\n public readonly edlMode: PointCloudEDLMode;\r\n /** A strength value for the Eye Dome Lighting (EDL) effect.\r\n * The strength is expected to be a positive floating point number.\r\n * Default: 5.0\r\n */\r\n public readonly edlStrength: number;\r\n /** A radius value for the Eye Dome Lighting (EDL) effect.\r\n * The radius is expected to be a positive floating point number\r\n * It is used to deterimine how far away in pixels to sample for depth change\r\n * Default: 2.0\r\n */\r\n public readonly edlRadius: number;\r\n /** A flag for whether or not to apply filtering pass in the Eye Dome Lighting (EDL) effect.\r\n * It only applies if edlMode is \"full\"\r\n * Default: 1.0\r\n */\r\n public readonly edlFilter?: number;\r\n /** A weighting value to apply to the full image when combining it with the half and quarter sized ones\r\n * It only applies if edlMode is \"full\"\r\n * The strength is expected to be a floating point number between 0 and 1 inclusive.\r\n * Default: 1.0\r\n */\r\n public readonly edlMixWts1?: number;\r\n /** A weighting value to apply to the half sized image when combining it with the full and quarter sized ones\r\n * It only applies if edlMode is \"full\"\r\n * The strength is expected to be a floating point number between 0 and 1 inclusive.\r\n * Default: 0.5\r\n */\r\n public readonly edlMixWts2?: number;\r\n /** A weighting value to apply to the quarter sized image when combining it with the full and half sized ones\r\n * It only applies if edlMode is \"full\"\r\n * The strength is expected to be a floating point number between 0 and 1 inclusive.\r\n * Default: 0.25\r\n */\r\n public readonly edlMixWts4?: number;\r\n\r\n /** Settings with all properties initialized to their default values. */\r\n public static defaults = new PointCloudDisplaySettings();\r\n\r\n private constructor(props?: PointCloudDisplayProps) {\r\n this.shape = props?.shape ?? \"round\";\r\n this.sizeMode = props?.sizeMode ?? \"voxel\";\r\n\r\n // No sanity checks here - e.g., min < max, pixelSize and voxelScale > 0, etc.\r\n this.pixelSize = props?.pixelSize ?? 1;\r\n this.voxelScale = props?.voxelScale ?? 1;\r\n this.minPixelsPerVoxel = props?.minPixelsPerVoxel ?? 2;\r\n this.maxPixelsPerVoxel = props?.maxPixelsPerVoxel ?? 20;\r\n this.edlMode = props?.edlMode ?? \"off\";\r\n this.edlStrength = props?.edlStrength ?? 5;\r\n this.edlRadius = props?.edlRadius ?? 2;\r\n this.edlFilter = props?.edlFilter ?? 1;\r\n this.edlMixWts1 = props?.edlMixWts1 ?? 1.0;\r\n this.edlMixWts2 = props?.edlMixWts2 ?? 0.5;\r\n this.edlMixWts4 = props?.edlMixWts4 ?? 0.25;\r\n }\r\n\r\n /** Create display settings from their JSON representation. If `props` is `undefined`, the default settings are returned. */\r\n public static fromJSON(props?: PointCloudDisplayProps): PointCloudDisplaySettings {\r\n return props ? new PointCloudDisplaySettings(props) : this.defaults;\r\n }\r\n\r\n /** Convert these settings to their JSON representation. */\r\n public toJSON(): PointCloudDisplayProps | undefined {\r\n const defs = PointCloudDisplaySettings.defaults;\r\n if (this.equals(defs))\r\n return undefined;\r\n\r\n const props: PointCloudDisplayProps = { };\r\n if (this.shape !== defs.shape)\r\n props.shape = this.shape;\r\n\r\n if (this.sizeMode !== defs.sizeMode)\r\n props.sizeMode = this.sizeMode;\r\n\r\n if (this.pixelSize !== defs.pixelSize)\r\n props.pixelSize = this.pixelSize;\r\n\r\n if (this.voxelScale !== defs.voxelScale)\r\n props.voxelScale = this.voxelScale;\r\n\r\n if (this.minPixelsPerVoxel !== defs.minPixelsPerVoxel)\r\n props.minPixelsPerVoxel = this.minPixelsPerVoxel;\r\n\r\n if (this.maxPixelsPerVoxel !== defs.maxPixelsPerVoxel)\r\n props.maxPixelsPerVoxel = this.maxPixelsPerVoxel;\r\n\r\n if (this.edlMode !== defs.edlMode)\r\n props.edlMode = this.edlMode;\r\n\r\n if (this.edlStrength !== defs.edlStrength)\r\n props.edlStrength = this.edlStrength;\r\n\r\n if (this.edlRadius !== defs.edlRadius)\r\n props.edlRadius = this.edlRadius;\r\n\r\n if (this.edlFilter !== defs.edlFilter)\r\n props.edlFilter = this.edlFilter;\r\n\r\n if (this.edlMixWts1 !== defs.edlMixWts1)\r\n props.edlMixWts1 = this.edlMixWts1;\r\n\r\n if (this.edlMixWts2 !== defs.edlMixWts2)\r\n props.edlMixWts2 = this.edlMixWts2;\r\n\r\n if (this.edlMixWts4 !== defs.edlMixWts4)\r\n props.edlMixWts4 = this.edlMixWts4;\r\n\r\n return props;\r\n }\r\n\r\n /** Create a copy of these settings, identical except for any properties explicitly specified by `changedProps`. */\r\n public clone(changedProps: PointCloudDisplayProps): PointCloudDisplaySettings {\r\n return PointCloudDisplaySettings.fromJSON({\r\n ...this.toJSON(),\r\n ...changedProps,\r\n });\r\n }\r\n\r\n /** Returns true if these settings are identical to `other`. */\r\n public equals(other: PointCloudDisplaySettings): boolean {\r\n if (this === other)\r\n return true;\r\n\r\n return this.shape === other.shape && this.sizeMode === other.sizeMode && this.pixelSize === other.pixelSize\r\n && this.voxelScale === other.voxelScale && this.minPixelsPerVoxel === other.minPixelsPerVoxel && this.maxPixelsPerVoxel === other.maxPixelsPerVoxel\r\n && this.edlMode === other.edlMode && this.edlStrength === other.edlStrength && this.edlRadius === other.edlRadius\r\n && this.edlFilter === other.edlFilter\r\n && this.edlMixWts1 === other.edlMixWts1 && this.edlMixWts2 === other.edlMixWts2 && this.edlMixWts4 === other.edlMixWts4\r\n ;\r\n }\r\n}\r\n\r\n/** Settings that control how a reality model - whether a [[ContextRealityModel]] or a persistent reality [Model]($backend) - is displayed within a [Viewport]($frontend).\r\n * @see [[ContextRealityModel.displaySettings]] to apply these settings to a context reality model.\r\n * @see [[DisplayStyleSettings.setRealityModelDisplaySettings]] to apply these settings to a persistent reality model.\r\n * @note This is an immutable type - to modify its properties, use [[clone]].\r\n * @beta\r\n */\r\nexport class RealityModelDisplaySettings {\r\n /** If the reality model's color is overridden with another color, a ratio in [0..1] with which to mix the two colors together.\r\n * A ratio of 0 uses only the reality model's color, a ratio of 1 uses only the override color, and a ratio of 0.5 mixes the two colors equally.\r\n * The color may be overridden using [[FeatureOverrides]] such as those supplied by a [FeatureOverrideProvider]($frontend), or by applying a [[SpatialClassifier]].\r\n * Default: 0.5\r\n */\r\n public readonly overrideColorRatio: number;\r\n /** Settings that apply specifically to point cloud reality models.\r\n * Default: [[PointCloudDisplaySettings.defaults]].\r\n */\r\n public readonly pointCloud: PointCloudDisplaySettings;\r\n\r\n /** Settings with all properties initialized to their default values. */\r\n public static defaults = new RealityModelDisplaySettings(undefined, PointCloudDisplaySettings.defaults);\r\n\r\n private constructor(overrideColorRatio: number | undefined, pointCloud: PointCloudDisplaySettings) {\r\n this.overrideColorRatio = overrideColorRatio ?? 0.5;\r\n this.pointCloud = pointCloud;\r\n }\r\n\r\n /** Create display settings from their JSON representation. If `props` is `undefined`, the default settings are returned. */\r\n public static fromJSON(props?: RealityModelDisplayProps): RealityModelDisplaySettings {\r\n if (!props)\r\n return this.defaults;\r\n\r\n return new RealityModelDisplaySettings(props.overrideColorRatio, PointCloudDisplaySettings.fromJSON(props.pointCloud));\r\n }\r\n\r\n /** Convert these settings to their JSON representation, which is `undefined` if all of their properties match the default settings. */\r\n public toJSON(): RealityModelDisplayProps | undefined {\r\n const pointCloud = this.pointCloud.toJSON();\r\n const overrideColorRatio = this.overrideColorRatio === RealityModelDisplaySettings.defaults.overrideColorRatio ? undefined : this.overrideColorRatio;\r\n\r\n if (undefined === pointCloud && undefined === overrideColorRatio)\r\n return undefined;\r\n\r\n const props: RealityModelDisplayProps = { };\r\n if (undefined !== pointCloud)\r\n props.pointCloud = pointCloud;\r\n\r\n if (undefined !== overrideColorRatio)\r\n props.overrideColorRatio = overrideColorRatio;\r\n\r\n return props;\r\n }\r\n\r\n /** Returns true if these settings are identical to `other`. */\r\n public equals(other: RealityModelDisplaySettings): boolean {\r\n if (this === other)\r\n return true;\r\n\r\n return this.overrideColorRatio === other.overrideColorRatio && this.pointCloud.equals(other.pointCloud);\r\n }\r\n\r\n /** Create a copy of these settings, identical except for any properties explicitly specified by `changedProps`. */\r\n public clone(changedProps: RealityModelDisplayProps): RealityModelDisplaySettings {\r\n const pointCloud = changedProps.pointCloud ? this.pointCloud.clone(changedProps.pointCloud) : this.pointCloud;\r\n const colorRatio = changedProps.hasOwnProperty(\"overrideColorRatio\") ? changedProps.overrideColorRatio : this.overrideColorRatio;\r\n return new RealityModelDisplaySettings(colorRatio, pointCloud);\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"RenderMaterial.js","sourceRoot":"","sources":["../../src/RenderMaterial.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,IAAI,EAAc,MAAM,qBAAqB,CAAC;AAGvE;;GAEG;AACH,MAAM,OAAgB,cAAc;IAClC,sGAAsG;IACtF,GAAG,CAAU;IAC7B,oFAAoF;IACpE,cAAc,CAAkB;IAChD,0EAA0E;IACzD,KAAK,CAAa;IAEnC,YAAsB,MAAyD;QAC7E,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC;QACtB,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;QAC5C,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IAClC,CAAC;IAED,IAAW,UAAU;QACnB,OAAO,SAAS,KAAK,IAAI,CAAC,cAAc,EAAE,OAAO,CAAC;IACpD,CAAC;IAED,oFAAoF;IAC7E,OAAO,CAAC,KAAqB;QAClC,OAAO,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IACjD,CAAC;CACF","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 } from \"@itwin/core-bentley\";\nimport { TextureMapping } from \"./TextureMapping\";\n\n/** Represents a material which can be applied to a surface to control aspects of its appearance such as color, reflectivity, texture, and so on.\n * @public\n */\nexport abstract class RenderMaterial {\n /** If the material originated from a Material element in the [[IModelDb]], the Id of that element. */\n public readonly key?: string;\n /** Describes how to map an image to a surface to which this material is applied. */\n public readonly textureMapping?: TextureMapping;\n /** Used for ordered comparisons, e.g. in DisplayParams.compareForMerge */\n private readonly _guid: GuidString;\n\n protected constructor(params: { key?: string, textureMapping?: TextureMapping }) {\n this.key = params.key;\n this.textureMapping = params.textureMapping;\n this._guid = Guid.createValue();\n }\n\n public get hasTexture(): boolean {\n return undefined !== this.textureMapping?.texture;\n }\n\n /** An [OrderedComparator]($bentley) that compares this material against `other`. */\n public compare(other: RenderMaterial): number {\n return compareStrings(this._guid, other._guid);\n }\n}\n"]}
1
+ {"version":3,"file":"RenderMaterial.js","sourceRoot":"","sources":["../../src/RenderMaterial.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,IAAI,EAAc,MAAM,qBAAqB,CAAC;AAGvE;;GAEG;AACH,MAAM,OAAgB,cAAc;IAClC,sGAAsG;IACtF,GAAG,CAAU;IAC7B,oFAAoF;IACpE,cAAc,CAAkB;IAChD,0EAA0E;IACzD,KAAK,CAAa;IAEnC,YAAsB,MAAyD;QAC7E,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC;QACtB,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;QAC5C,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IAClC,CAAC;IAED,IAAW,UAAU;QACnB,OAAO,SAAS,KAAK,IAAI,CAAC,cAAc,EAAE,OAAO,CAAC;IACpD,CAAC;IAED,oFAAoF;IAC7E,OAAO,CAAC,KAAqB;QAClC,OAAO,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IACjD,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Rendering\r\n */\r\n\r\nimport { compareStrings, Guid, GuidString } from \"@itwin/core-bentley\";\r\nimport { TextureMapping } from \"./TextureMapping\";\r\n\r\n/** Represents a material which can be applied to a surface to control aspects of its appearance such as color, reflectivity, texture, and so on.\r\n * @public\r\n */\r\nexport abstract class RenderMaterial {\r\n /** If the material originated from a Material element in the [[IModelDb]], the Id of that element. */\r\n public readonly key?: string;\r\n /** Describes how to map an image to a surface to which this material is applied. */\r\n public readonly textureMapping?: TextureMapping;\r\n /** Used for ordered comparisons, e.g. in DisplayParams.compareForMerge */\r\n private readonly _guid: GuidString;\r\n\r\n protected constructor(params: { key?: string, textureMapping?: TextureMapping }) {\r\n this.key = params.key;\r\n this.textureMapping = params.textureMapping;\r\n this._guid = Guid.createValue();\r\n }\r\n\r\n public get hasTexture(): boolean {\r\n return undefined !== this.textureMapping?.texture;\r\n }\r\n\r\n /** An [OrderedComparator]($bentley) that compares this material against `other`. */\r\n public compare(other: RenderMaterial): number {\r\n return compareStrings(this._guid, other._guid);\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"RenderPolyline.js","sourceRoot":"","sources":["../../src/RenderPolyline.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,qBAAqB;AAErB;;GAEG;AACH,MAAM,CAAN,IAAY,iBASX;AATD,WAAY,iBAAiB;IAC3B,2DAA2D;IAC3D,6DAAU,CAAA;IACV,8DAA8D;IAC9D,yDAAa,CAAA;IACb;;OAEG;IACH,+DAAgB,CAAA;AAClB,CAAC,EATW,iBAAiB,KAAjB,iBAAiB,QAS5B","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\n// cSpell:ignore vals\n\n/** Describes the semantics of a [PolylineArgs]($frontend).\n * @public\n */\nexport enum PolylineTypeFlags {\n /** Just an ordinary polyline with no special semantics. */\n Normal = 0,\n /** A polyline used to define the edges of a planar region. */\n Edge = 1 << 0,\n /** Like [[Edge]], but the edges are only displayed in [[RenderMode.Wireframe]] when the surface's fill is not displayed.\n * [[FillFlags]] controls whether the fill is displayed.\n */\n Outline = 1 << 1,\n}\n\n/** Flags describing a [PolylineArgs]($frontend).\n * @public\n */\nexport interface PolylineFlags {\n /** If `true`, the polylines are to be drawn as individual disconnected point strings instead of as connected line strings. */\n isDisjoint?: boolean;\n /** If `true`, the polylines' positions are all coplanar. */\n isPlanar?: boolean;\n /** If `true`, the polylines' positions all have the same z coordinate. */\n is2d?: boolean;\n /** Default: Normal. */\n type?: PolylineTypeFlags;\n}\n\n/** Describes the vertex indices of a single line within a [PolylineArgs]($frontend).\n * The indices represent either a line string as a connected series of points, or a point string as a set of disconnected points, depending\n * on the [[PolylineFlags.isDisjoint]] value of [PolylineArgs.flags]($frontend).\n * @public\n */\nexport type PolylineIndices = number[];\n"]}
1
+ {"version":3,"file":"RenderPolyline.js","sourceRoot":"","sources":["../../src/RenderPolyline.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,qBAAqB;AAErB;;GAEG;AACH,MAAM,CAAN,IAAY,iBASX;AATD,WAAY,iBAAiB;IAC3B,2DAA2D;IAC3D,6DAAU,CAAA;IACV,8DAA8D;IAC9D,yDAAa,CAAA;IACb;;OAEG;IACH,+DAAgB,CAAA;AAClB,CAAC,EATW,iBAAiB,KAAjB,iBAAiB,QAS5B","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\n// cSpell:ignore vals\r\n\r\n/** Describes the semantics of a [PolylineArgs]($frontend).\r\n * @public\r\n */\r\nexport enum PolylineTypeFlags {\r\n /** Just an ordinary polyline with no special semantics. */\r\n Normal = 0,\r\n /** A polyline used to define the edges of a planar region. */\r\n Edge = 1 << 0,\r\n /** Like [[Edge]], but the edges are only displayed in [[RenderMode.Wireframe]] when the surface's fill is not displayed.\r\n * [[FillFlags]] controls whether the fill is displayed.\r\n */\r\n Outline = 1 << 1,\r\n}\r\n\r\n/** Flags describing a [PolylineArgs]($frontend).\r\n * @public\r\n */\r\nexport interface PolylineFlags {\r\n /** If `true`, the polylines are to be drawn as individual disconnected point strings instead of as connected line strings. */\r\n isDisjoint?: boolean;\r\n /** If `true`, the polylines' positions are all coplanar. */\r\n isPlanar?: boolean;\r\n /** If `true`, the polylines' positions all have the same z coordinate. */\r\n is2d?: boolean;\r\n /** Default: Normal. */\r\n type?: PolylineTypeFlags;\r\n}\r\n\r\n/** Describes the vertex indices of a single line within a [PolylineArgs]($frontend).\r\n * The indices represent either a line string as a connected series of points, or a point string as a set of disconnected points, depending\r\n * on the [[PolylineFlags.isDisjoint]] value of [PolylineArgs.flags]($frontend).\r\n * @public\r\n */\r\nexport type PolylineIndices = number[];\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"RenderTexture.js","sourceRoot":"","sources":["../../src/RenderTexture.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,IAAI,EAA0B,MAAM,qBAAqB,CAAC;AAUnF;;;;;GAKG;AACH,MAAM,OAAgB,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,IAAI,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,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IACjD,CAAC;CACF;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,KAAb,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"]}
1
+ {"version":3,"file":"RenderTexture.js","sourceRoot":"","sources":["../../src/RenderTexture.ts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I,KAAJ,kBAAI,QAaf;AACH,CAAC,EAhBgB,aAAa,KAAb,aAAa,QAgB7B","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 } 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.createTexture]($frontend) to obtain a texture.\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 Disposable {\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 [Symbol.dispose]() {\r\n this.dispose(); // eslint-disable-line @typescript-eslint/no-deprecated\r\n }\r\n\r\n /** @deprecated in 5.0 Will be made protected in a future release. Use [Symbol.dispose] instead. */\r\n public abstract dispose(): void; // eslint-disable-line @typescript-eslint/no-deprecated\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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"RgbColor.js","sourceRoot":"","sources":["../../src/RgbColor.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAYtC;;GAEG;AACH,MAAM,OAAO,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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I,CAAC,CAAC,CAAC;YACb,IAAI,OAAO,IAAI,CAAC,CAAC,KAAK,QAAQ;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,cAAc,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,cAAc,CAAC,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","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}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C,CAAC;IAC/G,CAAC;IAED,mIAAmI;IAC5H,WAAW;QAChB,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,WAAW,EAAE,CAAC;IACzC,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module 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 +1 @@
1
- {"version":3,"file":"RpcInterface.js","sourceRoot":"","sources":["../../src/RpcInterface.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,OAAO,EAAE,gBAAgB,EAA4B,MAAM,6BAA6B,CAAC;AACzF,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAyB,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGrE,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC5E,OAA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,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,cAAc,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
+ {"version":3,"file":"RpcInterface.js","sourceRoot":"","sources":["../../src/RpcInterface.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,OAAO,EAAE,gBAAgB,EAA4B,MAAM,6BAA6B,CAAC;AACzF,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAyB,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGrE,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MA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G,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,cAAc,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 { IModelError, NoContentError } from \"./IModelError\";\r\nimport { RpcRequestEvent, RpcRequestStatus } from \"./rpc/core/RpcConstants\";\r\nimport { BeDuration, BentleyStatus } 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 declare 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 +1 @@
1
- {"version":3,"file":"RpcManager.js","sourceRoot":"","sources":["../../src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IAC3D,CAAC;IAED,gFAAgF;IACzE,MAAM,CAAC,SAAS,CAAC,KAAqB;QAC3C,YAAY,CAAC,aAAa,GAAG,KAAK,CAAC;IACrC,CAAC;CACF","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
+ {"version":3,"file":"RpcManager.js","sourceRoot":"","sources":["../../src/RpcManager.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAY7D;;GAEG;AACH,MAAM,OAAO,UAAU;IACrB;;OAEG;IACI,MAAM,CAAC,mBAAmB,CAAyB,UAAqC;QAC7F,WAAW,CAAC,QAAQ,CAAC,sBAAsB,CAAC,UAAU,CAAC,CAAC;IAC1D,CAAC;IAED,yCAAyC;IAClC,MAAM,CAAC,kBAAkB,CAAyB,UAAqC;QAC5F,WAAW,CAAC,QAAQ,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;IACzD,CAAC;IAED,wDAAwD;IACjD,MAAM,CAAC,qBAAqB,CAAyB,UAAqC,EAAE,UAA2B,eAAe,CAAC,OAAO;QACnJ,OAAO,WAAW,CAAC,QAAQ,CAAC,qBAAqB,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IACzE,CAAC;IAED,6DAA6D;IACtD,MAAM,CAAC,YAAY,CAAwE,UAA+C,EAAE,cAA2D;QAC5M,WAAW,CAAC,QAAQ,CAAC,YAAY,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;IAChE,CAAC;IAED,gGAAgG;IACzF,MAAM,CAAC,kBAAkB,CAAwE,UAA+C,EAAE,QAAyB;QAChL,WAAW,CAAC,QAAQ,CAAC,kBAAkB,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;IAChE,CAAC;IAED,+DAA+D;IACxD,MAAM,CAAC,cAAc,CAAmC,UAA+C;QAC5G,WAAW,CAAC,QAAQ,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IAClD,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,KAAK,CAAC,0BAA0B;QAC5C,OAAO,WAAW,CAAC,QAAQ,CAAC,0BAA0B,EAAE,CAAC;IAC3D,CAAC;IAED,gFAAgF;IACzE,MAAM,CAAC,SAAS,CAAC,KAAqB;QAC3C,YAAY,CAAC,aAAa,GAAG,KAAK,CAAC;IACrC,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module 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 +1 @@
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"]}
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 +1 @@
1
-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AAI,CAAC,MAAM,GAAG,EAAE,GAAG,MAAM,EAAE,CAAC;IAC9B,CAAC;IAED,6BAA6B;IACb,MAAM,CAAC,OAAiB;QACtC,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACpC,KAAK,CAAC,KAAK,GAAG;YACZ,IAAI,EAAE,eAAe,CAAC,IAAI;YAC1B,QAAQ,EAAE,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE;SAC7B,CAAC;QAEF,OAAO,KAAK,CAAC;IACf,CAAC;IAED,gBAAgB;IAChB,IAAoB,UAAU;QAC5B,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC;QACzB,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IAClH,CAAC;CACF","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
+ {"version":3,"file":"SkyBox.js","sourceRoot":"","sources":["../../src/SkyBox.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAu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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,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IAClH,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module 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 +1 @@
1
- {"version":3,"file":"SolarCalculate.js","sourceRoot":"","sources":["../../src/SolarCalculate.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;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,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I,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"]}
1
+ {"version":3,"file":"SolarCalculate.js","sourceRoot":"","sources":["../../src/SolarCalculate.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;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,GAAG,KAAK,EAAE,CAAC;QAClB,EAAE,IAAI,KAAK,CAAC;IACd,CAAC;IACD,OAAO,EAAE,GAAG,GAAG,EAAE,CAAC;QAChB,EAAE,IAAI,KAAK,CAAC;IACd,CAAC;IACD,OAAO,EAAE,CAAC,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AK,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACjC,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;IACvH,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACnC,MAAM,KAAK,GAAG,SAAS,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAE,SAAS,CAAC,CAAC;IACnE,OAAO,GAAG,GAAG,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,MAAM,CAAC,CAAC,iBAAiB;AACxD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,wBAAwB,CAAC,IAAU,EAAE,QAAsB,EAAE,OAAgB;IAC3F,MAAM,IAAI,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC;IACtC,MAAM,SAAS,GAAG,QAAQ,CAAC,gBAAgB,CAAC;IAC5C,MAAM,QAAQ,GAAG,QAAQ,CAAC,eAAe,CAAC;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":["/*---------------------------------------------------------------------------------------------\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 +1 @@
1
- {"version":3,"file":"SolarShadows.js","sourceRoot":"","sources":["../../src/SolarShadows.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAiB,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAatC,MAAM,YAAY,GAAG,QAAQ,CAAC,YAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;AAEhF;;;GAGG;AACH,MAAM,OAAO,mBAAmB;IAC9B,oBAAoB;IACJ,KAAK,CAAW;IAChC,gBAAgB;IACA,IAAI,CAAS;IAE7B,YAAoB,KAA+B;QACjD,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAClD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AAM,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","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"]}
1
+ {"version":3,"file":"SolarShadows.js","sourceRoot":"","sources":["../../src/SolarShadows.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAiB,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAatC,MAAM,YAAY,GAAG,QAAQ,CAAC,YAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;AAEhF;;;GAGG;AACH,MAAM,OAAO,mBAAmB;IAC9B,oBAAoB;IACJ,KAAK,CAAW;IAChC,gBAAgB;IACA,IAAI,CAAS;IAE7B,YAAoB,KAA+B;QACjD,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAClD,IAAI,SAAS,KAAK,KAAK,CAAC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AAM,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","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"]}