@itwin/core-common 5.5.0-dev.2 → 5.5.0-dev.5

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 (346) hide show
  1. package/CHANGELOG.md +12 -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.js.map +1 -1
  13. package/lib/cjs/CesiumIonAssets.js.map +1 -1
  14. package/lib/cjs/ChangedElements.js.map +1 -1
  15. package/lib/cjs/ChangedEntities.js.map +1 -1
  16. package/lib/cjs/ChangesetProps.js.map +1 -1
  17. package/lib/cjs/ClipStyle.js.map +1 -1
  18. package/lib/cjs/Code.js.map +1 -1
  19. package/lib/cjs/ColorByName.js.map +1 -1
  20. package/lib/cjs/ColorDef.js.map +1 -1
  21. package/lib/cjs/CommonLoggerCategory.js.map +1 -1
  22. package/lib/cjs/ConcurrentQuery.js.map +1 -1
  23. package/lib/cjs/ContextRealityModel.js.map +1 -1
  24. package/lib/cjs/ContourDisplay.js.map +1 -1
  25. package/lib/cjs/DisplayStyleSettings.js.map +1 -1
  26. package/lib/cjs/ECSchemaProps.js.map +1 -1
  27. package/lib/cjs/ECSqlReader.js.map +1 -1
  28. package/lib/cjs/ECSqlTypes.js.map +1 -1
  29. package/lib/cjs/ElementMesh.js.map +1 -1
  30. package/lib/cjs/ElementProps.js.map +1 -1
  31. package/lib/cjs/EmphasizeElementsProps.js.map +1 -1
  32. package/lib/cjs/EntityProps.js.map +1 -1
  33. package/lib/cjs/EntityReference.js.map +1 -1
  34. package/lib/cjs/Environment.js.map +1 -1
  35. package/lib/cjs/FeatureIndex.js.map +1 -1
  36. package/lib/cjs/FeatureSymbology.js.map +1 -1
  37. package/lib/cjs/FeatureTable.js.map +1 -1
  38. package/lib/cjs/Fonts.js.map +1 -1
  39. package/lib/cjs/Frustum.js.map +1 -1
  40. package/lib/cjs/GenericInstanceFilter.js.map +1 -1
  41. package/lib/cjs/GeoCoordinateServices.js.map +1 -1
  42. package/lib/cjs/GeometryContainment.js.map +1 -1
  43. package/lib/cjs/GeometryParams.js.map +1 -1
  44. package/lib/cjs/GeometrySummary.js.map +1 -1
  45. package/lib/cjs/Gradient.js.map +1 -1
  46. package/lib/cjs/GraphicParams.js.map +1 -1
  47. package/lib/cjs/GroundPlane.js.map +1 -1
  48. package/lib/cjs/HSLColor.js.map +1 -1
  49. package/lib/cjs/HSVColor.js.map +1 -1
  50. package/lib/cjs/HiddenLine.js.map +1 -1
  51. package/lib/cjs/Hilite.js.map +1 -1
  52. package/lib/cjs/IModel.js.map +1 -1
  53. package/lib/cjs/IModelError.js.map +1 -1
  54. package/lib/cjs/IModelVersion.js.map +1 -1
  55. package/lib/cjs/ITwinCoreErrors.js.map +1 -1
  56. package/lib/cjs/Image.js.map +1 -1
  57. package/lib/cjs/IpcAppProps.js.map +1 -1
  58. package/lib/cjs/LightSettings.js.map +1 -1
  59. package/lib/cjs/LinePixels.js.map +1 -1
  60. package/lib/cjs/Localization.js.map +1 -1
  61. package/lib/cjs/MapImagerySettings.js.map +1 -1
  62. package/lib/cjs/MapLayerSettings.js.map +1 -1
  63. package/lib/cjs/MassProperties.js.map +1 -1
  64. package/lib/cjs/MaterialProps.js.map +1 -1
  65. package/lib/cjs/ModelClipGroup.js.map +1 -1
  66. package/lib/cjs/ModelGeometryChanges.js.map +1 -1
  67. package/lib/cjs/ModelProps.js.map +1 -1
  68. package/lib/cjs/NativeAppProps.js.map +1 -1
  69. package/lib/cjs/OctEncodedNormal.js.map +1 -1
  70. package/lib/cjs/PlanProjectionSettings.js.map +1 -1
  71. package/lib/cjs/PlanarClipMask.js.map +1 -1
  72. package/lib/cjs/QPoint.js.map +1 -1
  73. package/lib/cjs/RealityDataAccessProps.js.map +1 -1
  74. package/lib/cjs/RealityModelDisplaySettings.js.map +1 -1
  75. package/lib/cjs/RenderMaterial.js.map +1 -1
  76. package/lib/cjs/RenderPolyline.js.map +1 -1
  77. package/lib/cjs/RenderTexture.js.map +1 -1
  78. package/lib/cjs/RgbColor.js.map +1 -1
  79. package/lib/cjs/RpcInterface.js.map +1 -1
  80. package/lib/cjs/RpcManager.js.map +1 -1
  81. package/lib/cjs/SessionProps.js.map +1 -1
  82. package/lib/cjs/SkyBox.js.map +1 -1
  83. package/lib/cjs/SolarCalculate.js.map +1 -1
  84. package/lib/cjs/SolarShadows.js.map +1 -1
  85. package/lib/cjs/SpatialClassification.js.map +1 -1
  86. package/lib/cjs/SubCategoryAppearance.js.map +1 -1
  87. package/lib/cjs/SubCategoryOverride.js.map +1 -1
  88. package/lib/cjs/TerrainSettings.js.map +1 -1
  89. package/lib/cjs/TextureMapping.js.map +1 -1
  90. package/lib/cjs/TextureProps.js.map +1 -1
  91. package/lib/cjs/ThematicDisplay.js.map +1 -1
  92. package/lib/cjs/Thumbnail.js.map +1 -1
  93. package/lib/cjs/TileProps.js.map +1 -1
  94. package/lib/cjs/Tween.js.map +1 -1
  95. package/lib/cjs/TxnAction.js.map +1 -1
  96. package/lib/cjs/ViewDetails.js.map +1 -1
  97. package/lib/cjs/ViewFlags.js.map +1 -1
  98. package/lib/cjs/ViewProps.js.map +1 -1
  99. package/lib/cjs/WhiteOnWhiteReversalSettings.js.map +1 -1
  100. package/lib/cjs/annotation/TextAnnotation.js.map +1 -1
  101. package/lib/cjs/annotation/TextBlock.js.map +1 -1
  102. package/lib/cjs/annotation/TextBlockGeometryProps.js.map +1 -1
  103. package/lib/cjs/annotation/TextBlockLayoutResult.js.map +1 -1
  104. package/lib/cjs/annotation/TextField.js.map +1 -1
  105. package/lib/cjs/annotation/TextStyle.js.map +1 -1
  106. package/lib/cjs/core-common.js.map +1 -1
  107. package/lib/cjs/domains/FunctionalElementProps.js.map +1 -1
  108. package/lib/cjs/domains/GenericElementProps.js.map +1 -1
  109. package/lib/cjs/geometry/AdditionalTransform.js.map +1 -1
  110. package/lib/cjs/geometry/AreaPattern.js.map +1 -1
  111. package/lib/cjs/geometry/BoundingSphere.js.map +1 -1
  112. package/lib/cjs/geometry/Cartographic.js.map +1 -1
  113. package/lib/cjs/geometry/CoordinateReferenceSystem.js.map +1 -1
  114. package/lib/cjs/geometry/ElementGeometry.js.map +1 -1
  115. package/lib/cjs/geometry/ElementGeometryFB.js.map +1 -1
  116. package/lib/cjs/geometry/FrustumPlanes.js.map +1 -1
  117. package/lib/cjs/geometry/GeodeticDatum.js.map +1 -1
  118. package/lib/cjs/geometry/GeodeticEllipsoid.js.map +1 -1
  119. package/lib/cjs/geometry/GeometryStream.js.map +1 -1
  120. package/lib/cjs/geometry/ImageGraphic.js.map +1 -1
  121. package/lib/cjs/geometry/LineStyle.js.map +1 -1
  122. package/lib/cjs/geometry/Placement.js.map +1 -1
  123. package/lib/cjs/geometry/Projection.js.map +1 -1
  124. package/lib/cjs/geometry/TextString.js.map +1 -1
  125. package/lib/cjs/internal/BackendTypes.js.map +1 -1
  126. package/lib/cjs/internal/PackedFeatureTable.js.map +1 -1
  127. package/lib/cjs/internal/RenderMaterialParams.js.map +1 -1
  128. package/lib/cjs/internal/RenderMesh.js.map +1 -1
  129. package/lib/cjs/internal/RenderTextureParams.js.map +1 -1
  130. package/lib/cjs/internal/Snapping.js.map +1 -1
  131. package/lib/cjs/internal/annotations/FieldFormatter.js.map +1 -1
  132. package/lib/cjs/internal/cross-package.js.map +1 -1
  133. package/lib/cjs/ipc/IpcSession.js.map +1 -1
  134. package/lib/cjs/ipc/IpcSocket.js.map +1 -1
  135. package/lib/cjs/ipc/IpcWebSocket.js.map +1 -1
  136. package/lib/cjs/ipc/IpcWebSocketTransport.js.map +1 -1
  137. package/lib/cjs/rpc/DevToolsRpcInterface.js.map +1 -1
  138. package/lib/cjs/rpc/IModelReadRpcInterface.js.map +1 -1
  139. package/lib/cjs/rpc/IModelTileRpcInterface.js.map +1 -1
  140. package/lib/cjs/rpc/SnapshotIModelRpcInterface.js.map +1 -1
  141. package/lib/cjs/rpc/TestRpcManager.js.map +1 -1
  142. package/lib/cjs/rpc/core/RpcConfiguration.js.map +1 -1
  143. package/lib/cjs/rpc/core/RpcConstants.js.map +1 -1
  144. package/lib/cjs/rpc/core/RpcControl.js.map +1 -1
  145. package/lib/cjs/rpc/core/RpcInvocation.js.map +1 -1
  146. package/lib/cjs/rpc/core/RpcMarshaling.js.map +1 -1
  147. package/lib/cjs/rpc/core/RpcOperation.js.map +1 -1
  148. package/lib/cjs/rpc/core/RpcPendingQueue.js.map +1 -1
  149. package/lib/cjs/rpc/core/RpcProtocol.js.map +1 -1
  150. package/lib/cjs/rpc/core/RpcPush.js.map +1 -1
  151. package/lib/cjs/rpc/core/RpcRegistry.js.map +1 -1
  152. package/lib/cjs/rpc/core/RpcRequest.js.map +1 -1
  153. package/lib/cjs/rpc/core/RpcRequestContext.js.map +1 -1
  154. package/lib/cjs/rpc/core/RpcRoutingToken.js.map +1 -1
  155. package/lib/cjs/rpc/core/RpcSessionInvocation.js.map +1 -1
  156. package/lib/cjs/rpc/web/BentleyCloudRpcManager.js.map +1 -1
  157. package/lib/cjs/rpc/web/BentleyCloudRpcProtocol.js.map +1 -1
  158. package/lib/cjs/rpc/web/OpenAPI.js.map +1 -1
  159. package/lib/cjs/rpc/web/RpcMultipart.js.map +1 -1
  160. package/lib/cjs/rpc/web/WebAppRpcLogging.js.map +1 -1
  161. package/lib/cjs/rpc/web/WebAppRpcProtocol.js.map +1 -1
  162. package/lib/cjs/rpc/web/WebAppRpcRequest.js.map +1 -1
  163. package/lib/cjs/rpc/web/multipart/RpcMultipartParser.js.map +1 -1
  164. package/lib/cjs/tile/B3dmTileIO.js.map +1 -1
  165. package/lib/cjs/tile/CompositeTileIO.js.map +1 -1
  166. package/lib/cjs/tile/ElementGraphics.js.map +1 -1
  167. package/lib/cjs/tile/GltfTileIO.js.map +1 -1
  168. package/lib/cjs/tile/I3dmTileIO.js.map +1 -1
  169. package/lib/cjs/tile/IModelTileIO.js.map +1 -1
  170. package/lib/cjs/tile/PntsTileIO.js.map +1 -1
  171. package/lib/cjs/tile/TileIO.js.map +1 -1
  172. package/lib/cjs/tile/TileMetadata.js.map +1 -1
  173. package/lib/cjs/tile/Tileset3dSchema.js.map +1 -1
  174. package/lib/esm/AmbientOcclusion.js.map +1 -1
  175. package/lib/esm/AnalysisStyle.js.map +1 -1
  176. package/lib/esm/Atmosphere.js.map +1 -1
  177. package/lib/esm/AuthorizationClient.js.map +1 -1
  178. package/lib/esm/BackgroundMapProvider.js.map +1 -1
  179. package/lib/esm/BackgroundMapSettings.js.map +1 -1
  180. package/lib/esm/Base64EncodedString.js.map +1 -1
  181. package/lib/esm/BlobReader.js.map +1 -1
  182. package/lib/esm/BriefcaseTypes.js.map +1 -1
  183. package/lib/esm/Camera.js.map +1 -1
  184. package/lib/esm/CatalogIModel.js.map +1 -1
  185. package/lib/esm/CesiumIonAssets.js.map +1 -1
  186. package/lib/esm/ChangedElements.js.map +1 -1
  187. package/lib/esm/ChangedEntities.js.map +1 -1
  188. package/lib/esm/ChangesetProps.js.map +1 -1
  189. package/lib/esm/ClipStyle.js.map +1 -1
  190. package/lib/esm/Code.js.map +1 -1
  191. package/lib/esm/ColorByName.js.map +1 -1
  192. package/lib/esm/ColorDef.js.map +1 -1
  193. package/lib/esm/CommonLoggerCategory.js.map +1 -1
  194. package/lib/esm/ConcurrentQuery.js.map +1 -1
  195. package/lib/esm/ContextRealityModel.js.map +1 -1
  196. package/lib/esm/ContourDisplay.js.map +1 -1
  197. package/lib/esm/DisplayStyleSettings.js.map +1 -1
  198. package/lib/esm/ECSchemaProps.js.map +1 -1
  199. package/lib/esm/ECSqlReader.js.map +1 -1
  200. package/lib/esm/ECSqlTypes.js.map +1 -1
  201. package/lib/esm/ElementMesh.js.map +1 -1
  202. package/lib/esm/ElementProps.js.map +1 -1
  203. package/lib/esm/EmphasizeElementsProps.js.map +1 -1
  204. package/lib/esm/EntityProps.js.map +1 -1
  205. package/lib/esm/EntityReference.js.map +1 -1
  206. package/lib/esm/Environment.js.map +1 -1
  207. package/lib/esm/FeatureIndex.js.map +1 -1
  208. package/lib/esm/FeatureSymbology.js.map +1 -1
  209. package/lib/esm/FeatureTable.js.map +1 -1
  210. package/lib/esm/Fonts.js.map +1 -1
  211. package/lib/esm/Frustum.js.map +1 -1
  212. package/lib/esm/GenericInstanceFilter.js.map +1 -1
  213. package/lib/esm/GeoCoordinateServices.js.map +1 -1
  214. package/lib/esm/GeometryContainment.js.map +1 -1
  215. package/lib/esm/GeometryParams.js.map +1 -1
  216. package/lib/esm/GeometrySummary.js.map +1 -1
  217. package/lib/esm/Gradient.js.map +1 -1
  218. package/lib/esm/GraphicParams.js.map +1 -1
  219. package/lib/esm/GroundPlane.js.map +1 -1
  220. package/lib/esm/HSLColor.js.map +1 -1
  221. package/lib/esm/HSVColor.js.map +1 -1
  222. package/lib/esm/HiddenLine.js.map +1 -1
  223. package/lib/esm/Hilite.js.map +1 -1
  224. package/lib/esm/IModel.js.map +1 -1
  225. package/lib/esm/IModelError.js.map +1 -1
  226. package/lib/esm/IModelVersion.js.map +1 -1
  227. package/lib/esm/ITwinCoreErrors.js.map +1 -1
  228. package/lib/esm/Image.js.map +1 -1
  229. package/lib/esm/IpcAppProps.js.map +1 -1
  230. package/lib/esm/LightSettings.js.map +1 -1
  231. package/lib/esm/LinePixels.js.map +1 -1
  232. package/lib/esm/Localization.js.map +1 -1
  233. package/lib/esm/MapImagerySettings.js.map +1 -1
  234. package/lib/esm/MapLayerSettings.js.map +1 -1
  235. package/lib/esm/MassProperties.js.map +1 -1
  236. package/lib/esm/MaterialProps.js.map +1 -1
  237. package/lib/esm/ModelClipGroup.js.map +1 -1
  238. package/lib/esm/ModelGeometryChanges.js.map +1 -1
  239. package/lib/esm/ModelProps.js.map +1 -1
  240. package/lib/esm/NativeAppProps.js.map +1 -1
  241. package/lib/esm/OctEncodedNormal.js.map +1 -1
  242. package/lib/esm/PlanProjectionSettings.js.map +1 -1
  243. package/lib/esm/PlanarClipMask.js.map +1 -1
  244. package/lib/esm/QPoint.js.map +1 -1
  245. package/lib/esm/RealityDataAccessProps.js.map +1 -1
  246. package/lib/esm/RealityModelDisplaySettings.js.map +1 -1
  247. package/lib/esm/RenderMaterial.js.map +1 -1
  248. package/lib/esm/RenderPolyline.js.map +1 -1
  249. package/lib/esm/RenderTexture.js.map +1 -1
  250. package/lib/esm/RgbColor.js.map +1 -1
  251. package/lib/esm/RpcInterface.js.map +1 -1
  252. package/lib/esm/RpcManager.js.map +1 -1
  253. package/lib/esm/SessionProps.js.map +1 -1
  254. package/lib/esm/SkyBox.js.map +1 -1
  255. package/lib/esm/SolarCalculate.js.map +1 -1
  256. package/lib/esm/SolarShadows.js.map +1 -1
  257. package/lib/esm/SpatialClassification.js.map +1 -1
  258. package/lib/esm/SubCategoryAppearance.js.map +1 -1
  259. package/lib/esm/SubCategoryOverride.js.map +1 -1
  260. package/lib/esm/TerrainSettings.js.map +1 -1
  261. package/lib/esm/TextureMapping.js.map +1 -1
  262. package/lib/esm/TextureProps.js.map +1 -1
  263. package/lib/esm/ThematicDisplay.js.map +1 -1
  264. package/lib/esm/Thumbnail.js.map +1 -1
  265. package/lib/esm/TileProps.js.map +1 -1
  266. package/lib/esm/Tween.js.map +1 -1
  267. package/lib/esm/TxnAction.js.map +1 -1
  268. package/lib/esm/ViewDetails.js.map +1 -1
  269. package/lib/esm/ViewFlags.js.map +1 -1
  270. package/lib/esm/ViewProps.js.map +1 -1
  271. package/lib/esm/WhiteOnWhiteReversalSettings.js.map +1 -1
  272. package/lib/esm/annotation/TextAnnotation.js.map +1 -1
  273. package/lib/esm/annotation/TextBlock.js.map +1 -1
  274. package/lib/esm/annotation/TextBlockGeometryProps.js.map +1 -1
  275. package/lib/esm/annotation/TextBlockLayoutResult.js.map +1 -1
  276. package/lib/esm/annotation/TextField.js.map +1 -1
  277. package/lib/esm/annotation/TextStyle.js.map +1 -1
  278. package/lib/esm/core-common.js.map +1 -1
  279. package/lib/esm/domains/FunctionalElementProps.js.map +1 -1
  280. package/lib/esm/domains/GenericElementProps.js.map +1 -1
  281. package/lib/esm/geometry/AdditionalTransform.js.map +1 -1
  282. package/lib/esm/geometry/AreaPattern.js.map +1 -1
  283. package/lib/esm/geometry/BoundingSphere.js.map +1 -1
  284. package/lib/esm/geometry/Cartographic.js.map +1 -1
  285. package/lib/esm/geometry/CoordinateReferenceSystem.js.map +1 -1
  286. package/lib/esm/geometry/ElementGeometry.js.map +1 -1
  287. package/lib/esm/geometry/ElementGeometryFB.js.map +1 -1
  288. package/lib/esm/geometry/FrustumPlanes.js.map +1 -1
  289. package/lib/esm/geometry/GeodeticDatum.js.map +1 -1
  290. package/lib/esm/geometry/GeodeticEllipsoid.js.map +1 -1
  291. package/lib/esm/geometry/GeometryStream.js.map +1 -1
  292. package/lib/esm/geometry/ImageGraphic.js.map +1 -1
  293. package/lib/esm/geometry/LineStyle.js.map +1 -1
  294. package/lib/esm/geometry/Placement.js.map +1 -1
  295. package/lib/esm/geometry/Projection.js.map +1 -1
  296. package/lib/esm/geometry/TextString.js.map +1 -1
  297. package/lib/esm/internal/BackendTypes.js.map +1 -1
  298. package/lib/esm/internal/PackedFeatureTable.js.map +1 -1
  299. package/lib/esm/internal/RenderMaterialParams.js.map +1 -1
  300. package/lib/esm/internal/RenderMesh.js.map +1 -1
  301. package/lib/esm/internal/RenderTextureParams.js.map +1 -1
  302. package/lib/esm/internal/Snapping.js.map +1 -1
  303. package/lib/esm/internal/annotations/FieldFormatter.js.map +1 -1
  304. package/lib/esm/internal/cross-package.js.map +1 -1
  305. package/lib/esm/ipc/IpcSession.js.map +1 -1
  306. package/lib/esm/ipc/IpcSocket.js.map +1 -1
  307. package/lib/esm/ipc/IpcWebSocket.js.map +1 -1
  308. package/lib/esm/ipc/IpcWebSocketTransport.js.map +1 -1
  309. package/lib/esm/rpc/DevToolsRpcInterface.js.map +1 -1
  310. package/lib/esm/rpc/IModelReadRpcInterface.js.map +1 -1
  311. package/lib/esm/rpc/IModelTileRpcInterface.js.map +1 -1
  312. package/lib/esm/rpc/SnapshotIModelRpcInterface.js.map +1 -1
  313. package/lib/esm/rpc/TestRpcManager.js.map +1 -1
  314. package/lib/esm/rpc/core/RpcConfiguration.js.map +1 -1
  315. package/lib/esm/rpc/core/RpcConstants.js.map +1 -1
  316. package/lib/esm/rpc/core/RpcControl.js.map +1 -1
  317. package/lib/esm/rpc/core/RpcInvocation.js.map +1 -1
  318. package/lib/esm/rpc/core/RpcMarshaling.js.map +1 -1
  319. package/lib/esm/rpc/core/RpcOperation.js.map +1 -1
  320. package/lib/esm/rpc/core/RpcPendingQueue.js.map +1 -1
  321. package/lib/esm/rpc/core/RpcProtocol.js.map +1 -1
  322. package/lib/esm/rpc/core/RpcPush.js.map +1 -1
  323. package/lib/esm/rpc/core/RpcRegistry.js.map +1 -1
  324. package/lib/esm/rpc/core/RpcRequest.js.map +1 -1
  325. package/lib/esm/rpc/core/RpcRequestContext.js.map +1 -1
  326. package/lib/esm/rpc/core/RpcRoutingToken.js.map +1 -1
  327. package/lib/esm/rpc/core/RpcSessionInvocation.js.map +1 -1
  328. package/lib/esm/rpc/web/BentleyCloudRpcManager.js.map +1 -1
  329. package/lib/esm/rpc/web/BentleyCloudRpcProtocol.js.map +1 -1
  330. package/lib/esm/rpc/web/OpenAPI.js.map +1 -1
  331. package/lib/esm/rpc/web/RpcMultipart.js.map +1 -1
  332. package/lib/esm/rpc/web/WebAppRpcLogging.js.map +1 -1
  333. package/lib/esm/rpc/web/WebAppRpcProtocol.js.map +1 -1
  334. package/lib/esm/rpc/web/WebAppRpcRequest.js.map +1 -1
  335. package/lib/esm/rpc/web/multipart/RpcMultipartParser.js.map +1 -1
  336. package/lib/esm/tile/B3dmTileIO.js.map +1 -1
  337. package/lib/esm/tile/CompositeTileIO.js.map +1 -1
  338. package/lib/esm/tile/ElementGraphics.js.map +1 -1
  339. package/lib/esm/tile/GltfTileIO.js.map +1 -1
  340. package/lib/esm/tile/I3dmTileIO.js.map +1 -1
  341. package/lib/esm/tile/IModelTileIO.js.map +1 -1
  342. package/lib/esm/tile/PntsTileIO.js.map +1 -1
  343. package/lib/esm/tile/TileIO.js.map +1 -1
  344. package/lib/esm/tile/TileMetadata.js.map +1 -1
  345. package/lib/esm/tile/Tileset3dSchema.js.map +1 -1
  346. package/package.json +6 -6
@@ -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,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAyBhE;;;GAGG;AACH,MAAM,OAAgB,YAAY;IAExB,MAAM,CAAC,QAAQ,CAAC,OAAmB,EAAE,QAAoB;QAC/D,OAAO,OAAO,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;YACjD,OAAO,CAAC,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cesContent":["/*---------------------------------------------------------------------------------------------\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,MAAM,qBAAqB,CAAC;AAyBhE;;;GAGG;AACH,MAAM,OAAgB,YAAY;IAExB,MAAM,CAAC,QAAQ,CAAC,OAAmB,EAAE,QAAoB;QAC/D,OAAO,OAAO,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;YACjD,OAAO,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,CAA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AC9G,OAAO,CAAC,OAAO,GAAG,gBAAgB,CAAC,OAAO,CAAC;IAC3C,OAAO,CAAC,eAAe,GAAI,MAAM,CAAC,aAAqC,CAAC,OAAO,CAAC;IAChF,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,eAAe,CAAC,qBAAqB,EAAE,OAAO,CAAC,CAAC;IAE7E,MAAM,KAAK,GAAG,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IAEnF,MAAM,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC7B,OAAO,QAAQ,EAAE,CAAC;AACpB,CAAC;AAED,KAAK,UAAU,cAAc,CAAC,OAA2B,EAAE,MAAwB,EAAE,QAA4B;IAC/G,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,IAAI,WAAW,GAAG,KAAK,CAAC;QAExB,UAAU,CAAC,gBAAgB,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,CAAC,aAAoC,EAAE,KAAK,IAAI,EAAE;YACtG,IAAI,WAAW,EAAE,CAAC;gBAChB,MAAM,IAAI,WAAW,CAAC,aAAa,CAAC,KAAK,EAAE,yCAAyC,CAAC,CAAC;YACxF,CAAC;YAED,WAAW,GAAG,IAAI,CAAC;YAEnB,IAAI,CAAC;gBACH,MAAM,QAAQ,GAAG,MAAM,QAAQ,EAAE,CAAC;gBAClC,OAAO,CAAC,QAAQ,CAAC,CAAC;YACpB,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,sEAAsE;YACrF,CAAC;QACH,CAAC,EAAE,MAAM,CAAC,CAAC;IACb,CAAC,CAAC,CAAC;AACL,CAAC;AAED,KAAK,UAAU,eAAe;IAC5B,MAAM,IAAI,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/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":["/*---------------------------------------------------------------------------------------------\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
- {"version":3,"file":"SkyBox.js","sourceRoot":"","sources":["../../src/SkyBox.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAuC,MAAM,qBAAqB,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAiB,MAAM,YAAY,CAAC;AAGrD;;;;GAIG;AACH,MAAM,CAAN,IAAY,eAaX;AAbD,WAA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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,EAAuC,MAAM,qBAAqB,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAiB,MAAM,YAAY,CAAC;AAGrD;;;;GAIG;AACH,MAAM,CAAN,IAAY,eAaX;AAbD,WAAY,eAAe;IACzB,kEAAkE;IAClE,qDAAQ,CAAA;IACR;;OAEG;IACH,+DAAa,CAAA;IACb,kCAAkC;IAClC,mEAAe,CAAA;IACf;;OAEG;IACH,qDAA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M,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC;QACzB,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,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,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,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/*---------------------------------------------------------------------------------------------\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,CAAE,aAAa;AAC3B,CAAC;AAED,SAAS,sBAAsB,CAAC,CAAS;IACvC,MAAM,CAAC,GAAG,SAAS,GAAG,CAAC,GAAG,CAAC,WAAW,GAAG,SAAS,GAAG,CAAC,CAAC,CAAC;IACxD,OAAO,CAAC,CAAC,CAAE,aAAa;AAC1B,CAAC;AAED,SAAS,0BAA0B,CAAC,CAAS;IAC3C,MAAM,CAAC,GAA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AM,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,IAAI,SAAS,KAAK,KAAK,CAAC,KAAK,IAAI,IAAI,KAAK,KAAK,CAAC,KAAK;YACnD,IAAI,CAAC,KAAK,GAAG,YAAY,CAAC;;YAE1B,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,YAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IACvE,CAAC;IAEM,MA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AAmB,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,KAAK,IAAI,IAAI,KAAK,KAAK,CAAC,KAAK;YACnD,IAAI,CAAC,KAAK,GAAG,YAAY,CAAC;;YAE1B,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,YAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IACvE,CAAC;IAEM,MAAM,CAAC,QAAQ,GAAG,IAAI,m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,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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"SpatialClassification.js","sourceRoot":"","sources":["../../src/SpatialClassification.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAc,MAAM,qBAAqB,CAAC;AAGzD;;;;GAIG;AACH,MAAM,CAAN,IAAY,8BAWX;AAXD,WAAY,8BAA8B;IACxC,qCAAqC;IACrC,iFAAO,CAAA;IACP,oDAAoD;IACpD,+EAAM,CAAA;IACN,gCAAgC;IAChC,uFAAU,CAAA;IACV,wEAAwE;IACxE,uFAAU,CAAA;IACV,yEAAyE;IACzE,mGAAgB,CAAA;AAClB,CAAC,EAXW,8BAA8B,KAA9B,8BAA8B,QAWzC;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAY,+BAOX;AAPD,WAAY,+BAA+B;IACzC,qCAAqC;IACrC,mFAAO,CAAA;IACP,oDAAoD;IACpD,iFAAM,CAAA;IACN,gCAAgC;IAChC,yFAAU,CAAA;AACZ,CAAC,EAPW,+BAA+B,KAA/B,+BAA+B,QAO1C;AAeD;;GAEG;AACH,MAAM,OAAO,sBAAsB;IACjC,oEAAoE;IACpD,MAAM,CAAiC;IACvD,wEAAwE;I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AAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC;IACpF,CAAC;CACF;AAED,SAAS,aAAa,CAAC,OAAe;IACpC,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,8BAA8B,CAAC,GAAG,CAAC;QACxC,KAAK,8BAA8B,CAAC,EAAE,CAAC;QACvC,KAAK,8BAA8B,CAAC,MAAM,CAAC;QAC3C,KAAK,8BAA8B,CAAC,MAAM,CAAC;QAC3C,KAAK,8BAA8B,CAAC,YAAY;YAC9C,OAAO,OAAO,CAAC;QACjB;YACE,OAAO,8BAA8B,CAAC,YAAY,CAAC;IACvD,CAAC;AACH,CAAC;AAED,SAAS,cAAc,CAAC,OAAe;IACrC,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,+BAA+B,CAAC,GAAG,CAAC;QACzC,KAAK,+BAA+B,CAAC,EAAE,CAAC;QACxC,KAAK,+BAA+B,CAAC,MAAM;YACzC,OAAO,OAAO,CAAC;QACjB;YACE,OAAO,+BAA+B,CAAC,MAAM,CAAC;IAClD,CAAC;AACH,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 { assert, Id64String } from \"@itwin/core-bentley\";\nimport { ModelMapLayerSettings } from \"./MapLayerSettings\";\n\n/** Describes how a [[SpatialClassifier]] affects the display of classified geometry - that is, geometry intersecting\n * the classifier.\n * @public\n * @extensions\n */\nexport enum SpatialClassifierInsideDisplay {\n /** The geometry is not displayed. */\n Off = 0,\n /** The geometry is displayed without alteration. */\n On = 1,\n /** The geometry is darkened. */\n Dimmed = 2,\n /** The geometry is tinted by the [Viewport.hilite]($frontend) color. */\n Hilite = 3,\n /** The geometry is tinted with the colors of the classifier elements. */\n ElementColor = 4,\n}\n\n/** Describes how a [[SpatialClassifier]] affects the display of unclassified geometry - that is, geometry not intersecting\n * the classifier.\n * @public\n * @extensions\n */\nexport enum SpatialClassifierOutsideDisplay {\n /** The geometry is not displayed. */\n Off = 0,\n /** The geometry is displayed without alteration. */\n On = 1,\n /** The geometry is darkened. */\n Dimmed = 2,\n}\n\n/** JSON representation of a [[SpatialClassifierFlags]].\n * @public\n * @extensions\n */\nexport interface SpatialClassifierFlagsProps {\n /** See [[SpatialClassifierFlags.inside]]. */\n inside: SpatialClassifierInsideDisplay;\n /** See [[SpatialClassifierFlags.outside]]. */\n outside: SpatialClassifierOutsideDisplay;\n /** See [[SpatialClassifierFlags.isVolumeClassifier]]. */\n isVolumeClassifier?: boolean;\n}\n\n/** Flags affecting how a [[SpatialClassifier]] is applied.\n * @public\n */\nexport class SpatialClassifierFlags {\n /** How geometry intersecting the classifier should be displayed. */\n public readonly inside: SpatialClassifierInsideDisplay;\n /** How geometry not intersecting the classifier should be displayed. */\n public readonly outside: SpatialClassifierOutsideDisplay;\n /** True for volume classification; false for planar classification. */\n public readonly isVolumeClassifier: boolean;\n\n /** Construct new flags. */\n public constructor(inside = SpatialClassifierInsideDisplay.ElementColor, outside = SpatialClassifierOutsideDisplay.Dimmed, isVolumeClassifier = false) {\n this.inside = insideDisplay(inside);\n this.outside = outsideDisplay(outside);\n this.isVolumeClassifier = isVolumeClassifier;\n }\n\n /** Construct from JSON representation. */\n public static fromJSON(props: SpatialClassifierFlagsProps): SpatialClassifierFlags {\n return new SpatialClassifierFlags(props.inside, props.outside, true === props.isVolumeClassifier);\n }\n\n /** Convert to JSON representation. */\n public toJSON(): SpatialClassifierFlagsProps {\n const props: SpatialClassifierFlagsProps = {\n inside: this.inside,\n outside: this.outside,\n };\n\n if (this.isVolumeClassifier)\n props.isVolumeClassifier = true;\n\n return props;\n }\n\n /** Create flags indentical to these ones except for any properties explicitly specified by `changedProps`. */\n public clone(changedProps?: Partial<SpatialClassifierFlagsProps>): SpatialClassifierFlags {\n if (!changedProps)\n return this;\n\n return SpatialClassifierFlags.fromJSON({ ...this.toJSON(), ...changedProps });\n }\n\n /** Return true if these flags are equivalent to `other`. */\n public equals(other: SpatialClassifierFlags): boolean {\n if (other === this)\n return true;\n\n return other.inside === this.inside && other.outside === this.outside && other.isVolumeClassifier === this.isVolumeClassifier;\n }\n\n /** Return true if these flags are equivalent to `props`. */\n public equalsProps(props: SpatialClassifierFlagsProps): boolean {\n return this.inside === props.inside && this.outside === props.outside && this.isVolumeClassifier === (true === props.isVolumeClassifier);\n }\n}\n\n/** JSON representation of a [[SpatialClassifier]].\n * @public\n * @extensions\n */\nexport interface SpatialClassifierProps {\n /** See [[SpatialClassifier.modelId]]. */\n modelId: Id64String;\n /** See [[SpatialClassifier.expand]]. */\n expand: number;\n /** See [[SpatialClassifier.flags]]. */\n flags: SpatialClassifierFlagsProps;\n /** See [[SpatialClassifier.name]]. */\n name: string;\n /** Records whether this is the active classifier.\n * See [[SpatialClassifier.active]].\n */\n isActive?: boolean;\n}\n\n/** Describes how to use the geometry of one [GeometricModel]($backend) to classify the contents of other models - most typically, reality models.\n * Applying a classifier divides the geometry of the classified model into two groups:\n * - Classified (intersecting the classifier); and\n * - Unclassified (not intersecting the classifier).\n * For example, a model containing the building footprints for a city block could be used to classify a reality mesh captured from photographs of the\n * real-world block. Then, buildings within the reality mesh can be selected individually, and present the properties of the classifier geometry (e.g.,\n * the address of the building). The appearance of the geometry can also be customized based using [[SpatialClassifierInsideDisplay]] and [[SpatialClassifierOutsideDisplay]].\n * Two types of classification are supported:\n * - Planar classification, in which the geometry of the classifier model is projected onto a plane to classify geometry within a region extruded perpendicular\n * the plane (e.g., the building footprints example); and\n * - Volume classification, in which closed, non-intersecting volumes within the classifier classify geometry that intersects (i.e. is contained within) those same volumes (e.g., imagine using boxes instead\n * of footprints to classify buildings, or floors of buildings).\n * @see this (interactive example)[https://www.itwinjs.org/sample-showcase/?group=Viewer+Features&sample=classifier-sample].\n * @see [[SpatialClassifiers]] to define a set of classifiers.\n * @see [[ContextRealityModel.classifiers]] to classify a context reality model.\n * @see [SpatialModelState.classifiers]($frontend) to classify a persistent reality model.\n * @public\n */\nexport class SpatialClassifier {\n /** The Id of the [GeometricModel]($backend) whose geometry is used to produce the classifier. */\n public readonly modelId: Id64String;\n /** A distance in meters by which to expand the classifier geometry. For example, if line strings are used to represent streets,\n * you might expand them to the average width of a street.\n */\n public readonly expand: number;\n /** Flags controlling how to apply the classifier. */\n public readonly flags: SpatialClassifierFlags;\n /** A user-friendly name, useful for identifying individual classifiers within a [[SpatialClassifiers]]. */\n public readonly name: string;\n\n /** Construct a new classifier. */\n public constructor(modelId: Id64String, name: string, flags = new SpatialClassifierFlags(), expand = 0) {\n this.modelId = modelId;\n this.expand = expand;\n this.flags = flags;\n this.name = name;\n }\n\n /** Construct from JSON representation. */\n public static fromJSON(props: SpatialClassifierProps): SpatialClassifier {\n return new SpatialClassifier(props.modelId, props.name, SpatialClassifierFlags.fromJSON(props.flags), props.expand);\n }\n\n /** Convert to JSON representation.\n * @note This method always sets the [[SpatialClassifierProps.isActive]] property to `false`.\n */\n public toJSON(): SpatialClassifierProps {\n return {\n modelId: this.modelId,\n expand: this.expand,\n flags: this.flags.toJSON(),\n name: this.name,\n isActive: false,\n };\n }\n\n /** Construct from Model Map Layer.\n * @beta\n */\n public static fromModelMapLayer(mapLayer: ModelMapLayerSettings): SpatialClassifier {\n const flags = SpatialClassifierFlags.fromJSON({ inside: SpatialClassifierInsideDisplay.Off, outside: SpatialClassifierOutsideDisplay.Off });\n\n return new SpatialClassifier(mapLayer.modelId, mapLayer.name, flags);\n }\n\n /** Create a classifier identical to this one except for any properties explicitly specified by `changedProps`. */\n public clone(changedProps?: Partial<SpatialClassifierProps>): SpatialClassifier {\n if (!changedProps)\n return this;\n\n return SpatialClassifier.fromJSON({ ...this.toJSON(), ...changedProps });\n }\n\n /** Return true if this classifier is equivalent to `other`. */\n public equals(other: SpatialClassifier): boolean {\n if (other === this)\n return true;\n\n return this.modelId === other.modelId && this.expand === other.expand && this.name === other.name && this.flags.equals(other.flags);\n }\n\n /** Return true if this classifier is equivalent to `props`. */\n public equalsProps(props: SpatialClassifierProps): boolean {\n return this.modelId === props.modelId && this.expand === props.expand && this.name === props.name && this.flags.equalsProps(props.flags);\n }\n}\n\n/** An object that can store the JSON representation of a list of [[SpatialClassifier]]s.\n * @see [[SpatialClassifiers]].\n * @public\n * @extensions\n */\nexport interface SpatialClassifiersContainer {\n /** The list of classifiers. */\n classifiers?: SpatialClassifierProps[];\n}\n\n/** A set of [[SpatialClassifier]]s for a given reality model. At most one of the classifiers can be actively classifying the model at any given time.\n * The set of classifiers can be presented to the user, listed by name, so that the active classifier can be changed.\n * The set of classifiers is populated from its JSON representation and that representation is kept in sync as the set of classifiers is modified.\n * @see this (interactive example)[https://www.itwinjs.org/sample-showcase/?group=Viewer+Features&sample=classifier-sample].\n * @see [[SpatialClassifier]] for details on how spatial classification works.\n * @see [[ContextRealityModel.classifiers]] to define classifiers for a context reality model.\n * @see [SpatialModelState.classifiers]($frontend) to define classifiers for a persistent reality model.\n * @public\n */\nexport class SpatialClassifiers implements Iterable<SpatialClassifier> {\n private readonly _json: SpatialClassifiersContainer;\n private readonly _classifiers: SpatialClassifier[] = [];\n private _active?: SpatialClassifier;\n\n /** Construct a new set of classifiers from the JSON representation. The set will be initialized from `container.classifiers` and that JSON representation\n * will be kept in sync with changes made to the set. The caller should not directly modify `container.classifiers` or its contents as that will cause the set to become out\n * of sync with the JSON representation.\n * The [[active]] classifier will be determined by the first [[SpatialClassifierProps]] whose `isActive` property is set to `true`, if any.\n */\n public constructor(container: SpatialClassifiersContainer) {\n this._json = container;\n\n const json = this._array;\n if (!json)\n return;\n\n for (const props of json) {\n const classifier = SpatialClassifier.fromJSON(props);\n this._classifiers.push(classifier);\n if (props.isActive) {\n if (!this._active)\n this._active = classifier;\n else\n props.isActive = false;\n }\n }\n }\n\n /** The classifier currently classifying the target reality model. The classifier passed to the setter must be one obtained from this set, or one equivalent to\n * one contained in this set; in the latter case, the equivalent classifier contained in this set becomes active.\n */\n /** The classifier currently classifying the target reality model, if any.\n * @see [[setActive]] to change the active classifier.\n */\n public get active(): SpatialClassifier | undefined {\n return this._active;\n }\n\n /** Change the [[active]] classifier. The input must be a classifier belonging to this set, or equivalent to one in the set.\n * If no equivalent classifier exists in the set, the active classifier remains unchanged.\n * @param The classifier to set as active, or `undefined` to clear the active classifier.\n * @returns the active classifier.\n */\n public setActive(active: SpatialClassifier | undefined): SpatialClassifier | undefined {\n const array = this._array;\n if (!array)\n return this.active;\n\n if (active) {\n active = this.findEquivalent(active);\n if (!active)\n return this.active;\n }\n\n if (active === this.active)\n return this.active;\n\n let propsIndex = -1;\n if (active) {\n propsIndex = array.findIndex((x) => active.equalsProps(x));\n if (-1 === propsIndex)\n return this.active;\n }\n\n this._active = active;\n for (let i = 0; i < array.length; i++)\n array[i].isActive = (i === propsIndex);\n\n return this.active;\n }\n\n /** Obtain an iterator over the classifiers contained in this set. */\n public [Symbol.iterator](): Iterator<SpatialClassifier> {\n return this._classifiers[Symbol.iterator]();\n }\n\n /** The number of classifiers in this set. */\n public get size(): number {\n return this._array?.length ?? 0;\n }\n\n /** Returns the first classifier that satisfies `criterion`, or `undefined` if no classifier satisfies it. */\n public find(criterion: (classifier: SpatialClassifier) => boolean): SpatialClassifier | undefined {\n return this._classifiers.find(criterion);\n }\n\n /** Find the first classifier that is equivalent to the supplied classifier, or `undefined` if no equivalent classifier exists in this set. */\n public findEquivalent(classifier: SpatialClassifier): SpatialClassifier | undefined {\n return this.find((x) => x.equals(classifier));\n }\n\n /** Return true if the specified classifier or one equivalent to it exists in this set. */\n public has(classifier: SpatialClassifier): boolean {\n return undefined !== this.findEquivalent(classifier);\n }\n\n /** Add a classifier to this set. If an equivalent classifier already exists, the supplied classifier is not added.\n * @param classifier The classifier to add.\n * @returns The equivalent pre-existing classifier, if one existed; or the supplied classifier, if it was added to the set.\n */\n public add(classifier: SpatialClassifier): SpatialClassifier {\n const existing = this.findEquivalent(classifier);\n if (existing)\n return existing;\n\n let array = this._array;\n if (!array)\n array = this._json.classifiers = [];\n\n this._classifiers.push(classifier);\n array.push(classifier.toJSON());\n return classifier;\n }\n\n /** Replace an existing classifier with a different one.\n * @param toReplace The classifier to be replaced.\n * @param replacement The classifier to replace `toReplace`.\n * @returns true if a classifier equivalent to `toReplace` existed in the set and was replaced by `replacement`.\n * @note If `toReplace` was the [[active]] classifier, `replacement` will become active.\n */\n public replace(toReplace: SpatialClassifier, replacement: SpatialClassifier): boolean {\n const list = this._array;\n if (!list)\n return false;\n\n const classifierIndex = this._classifiers.findIndex((x) => x.equals(toReplace));\n if (-1 === classifierIndex)\n return false;\n\n const propsIndex = list.findIndex((x) => toReplace.equalsProps(x));\n assert(propsIndex === classifierIndex);\n if (-1 === propsIndex)\n return false;\n\n toReplace = this._classifiers[classifierIndex];\n const wasActive = this.active === toReplace;\n\n this._classifiers[classifierIndex] = replacement;\n const props = list[propsIndex] = replacement.toJSON();\n\n if (wasActive) {\n props.isActive = true;\n this._active = replacement;\n }\n\n return true;\n }\n\n /** Remove the first classifier equivalent to `classifier` from this set.\n * @param classifier The classifier to remove.\n * @returns The classifier that was actually removed, or `undefined` if none was removed.\n */\n public delete(classifier: SpatialClassifier): SpatialClassifier | undefined {\n const list = this._array;\n if (!list)\n return undefined;\n\n const classifierIndex = this._classifiers.findIndex((x) => x.equals(classifier));\n if (-1 === classifierIndex)\n return undefined;\n\n classifier = this._classifiers[classifierIndex];\n const propsIndex = list.findIndex((x) => classifier.equalsProps(x));\n assert(propsIndex === classifierIndex);\n if (-1 === propsIndex)\n return undefined;\n\n list.splice(propsIndex, 1);\n this._classifiers.splice(classifierIndex, 1);\n if (list.length === 0)\n this._json.classifiers = undefined;\n\n if (classifier === this.active)\n this._active = undefined;\n\n return classifier;\n }\n\n /** Remove all classifiers from this set. */\n public clear(): void {\n this._classifiers.length = 0;\n this._json.classifiers = undefined;\n this._active = undefined;\n }\n\n private get _array(): SpatialClassifierProps[] | undefined {\n return Array.isArray(this._json.classifiers) ? this._json.classifiers : undefined;\n }\n}\n\nfunction insideDisplay(display: number): SpatialClassifierInsideDisplay {\n switch (display) {\n case SpatialClassifierInsideDisplay.Off:\n case SpatialClassifierInsideDisplay.On:\n case SpatialClassifierInsideDisplay.Dimmed:\n case SpatialClassifierInsideDisplay.Hilite:\n case SpatialClassifierInsideDisplay.ElementColor:\n return display;\n default:\n return SpatialClassifierInsideDisplay.ElementColor;\n }\n}\n\nfunction outsideDisplay(display: number): SpatialClassifierOutsideDisplay {\n switch (display) {\n case SpatialClassifierOutsideDisplay.Off:\n case SpatialClassifierOutsideDisplay.On:\n case SpatialClassifierOutsideDisplay.Dimmed:\n return display;\n default:\n return SpatialClassifierOutsideDisplay.Dimmed;\n }\n}\n"]}
1
+ {"version":3,"file":"SpatialClassification.js","sourceRoot":"","sources":["../../src/SpatialClassification.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAc,MAAM,qBAAqB,CAAC;AAGzD;;;;GAIG;AACH,MAAM,CAAN,IAAY,8BAWX;AAXD,WAAY,8BAA8B;IACxC,qCAAqC;IACrC,iFAAO,CAAA;IACP,oDAAoD;IACpD,+EAAM,CAAA;IACN,gCAAgC;IAChC,uFAAU,CAAA;IACV,wEAAwE;IACxE,uFAAU,CAAA;IACV,yEAAyE;IACzE,mGAAgB,CAAA;AAClB,CAAC,EAXW,8BAA8B,KAA9B,8BAA8B,QAWzC;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAY,+BAOX;AAPD,WAAY,+BAA+B;IACzC,qCAAqC;IACrC,mFAAO,CAAA;IACP,oDAAoD;IACpD,iFAAM,CAAA;IACN,gCAAgC;IAChC,yFAAU,CAAA;AACZ,CAAC,EAPW,+BAA+B,KAA/B,+BAA+B,QAO1C;AAeD;;GAEG;AACH,MAAM,OAAO,sBAAsB;IACjC,oEAAoE;IACpD,M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C,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC;IACpF,CAAC;CACF;AAED,SAAS,aAAa,CAAC,OAAe;IACpC,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,8BAA8B,CAAC,GAAG,CAAC;QACxC,KAAK,8BAA8B,CAAC,EAAE,CAAC;QACvC,KAAK,8BAA8B,CAAC,MAAM,CAAC;QAC3C,KAAK,8BAA8B,CAAC,MAAM,CAAC;QAC3C,KAAK,8BAA8B,CAAC,YAAY;YAC9C,OAAO,OAAO,CAAC;QACjB;YACE,OAAO,8BAA8B,CAAC,YAAY,CAAC;IACvD,CAAC;AACH,CAAC;AAED,SAAS,cAAc,CAAC,OAAe;IACrC,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,+BAA+B,CAAC,GAAG,CAAC;QACzC,KAAK,+BAA+B,CAAC,EAAE,CAAC;QACxC,KAAK,+BAA+B,CAAC,MAAM;YACzC,OAAO,OAAO,CAAC;QACjB;YACE,OAAO,+BAA+B,CAAC,MAAM,CAAC;IAClD,CAAC;AACH,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 { assert, Id64String } from \"@itwin/core-bentley\";\r\nimport { ModelMapLayerSettings } from \"./MapLayerSettings\";\r\n\r\n/** Describes how a [[SpatialClassifier]] affects the display of classified geometry - that is, geometry intersecting\r\n * the classifier.\r\n * @public\r\n * @extensions\r\n */\r\nexport enum SpatialClassifierInsideDisplay {\r\n /** The geometry is not displayed. */\r\n Off = 0,\r\n /** The geometry is displayed without alteration. */\r\n On = 1,\r\n /** The geometry is darkened. */\r\n Dimmed = 2,\r\n /** The geometry is tinted by the [Viewport.hilite]($frontend) color. */\r\n Hilite = 3,\r\n /** The geometry is tinted with the colors of the classifier elements. */\r\n ElementColor = 4,\r\n}\r\n\r\n/** Describes how a [[SpatialClassifier]] affects the display of unclassified geometry - that is, geometry not intersecting\r\n * the classifier.\r\n * @public\r\n * @extensions\r\n */\r\nexport enum SpatialClassifierOutsideDisplay {\r\n /** The geometry is not displayed. */\r\n Off = 0,\r\n /** The geometry is displayed without alteration. */\r\n On = 1,\r\n /** The geometry is darkened. */\r\n Dimmed = 2,\r\n}\r\n\r\n/** JSON representation of a [[SpatialClassifierFlags]].\r\n * @public\r\n * @extensions\r\n */\r\nexport interface SpatialClassifierFlagsProps {\r\n /** See [[SpatialClassifierFlags.inside]]. */\r\n inside: SpatialClassifierInsideDisplay;\r\n /** See [[SpatialClassifierFlags.outside]]. */\r\n outside: SpatialClassifierOutsideDisplay;\r\n /** See [[SpatialClassifierFlags.isVolumeClassifier]]. */\r\n isVolumeClassifier?: boolean;\r\n}\r\n\r\n/** Flags affecting how a [[SpatialClassifier]] is applied.\r\n * @public\r\n */\r\nexport class SpatialClassifierFlags {\r\n /** How geometry intersecting the classifier should be displayed. */\r\n public readonly inside: SpatialClassifierInsideDisplay;\r\n /** How geometry not intersecting the classifier should be displayed. */\r\n public readonly outside: SpatialClassifierOutsideDisplay;\r\n /** True for volume classification; false for planar classification. */\r\n public readonly isVolumeClassifier: boolean;\r\n\r\n /** Construct new flags. */\r\n public constructor(inside = SpatialClassifierInsideDisplay.ElementColor, outside = SpatialClassifierOutsideDisplay.Dimmed, isVolumeClassifier = false) {\r\n this.inside = insideDisplay(inside);\r\n this.outside = outsideDisplay(outside);\r\n this.isVolumeClassifier = isVolumeClassifier;\r\n }\r\n\r\n /** Construct from JSON representation. */\r\n public static fromJSON(props: SpatialClassifierFlagsProps): SpatialClassifierFlags {\r\n return new SpatialClassifierFlags(props.inside, props.outside, true === props.isVolumeClassifier);\r\n }\r\n\r\n /** Convert to JSON representation. */\r\n public toJSON(): SpatialClassifierFlagsProps {\r\n const props: SpatialClassifierFlagsProps = {\r\n inside: this.inside,\r\n outside: this.outside,\r\n };\r\n\r\n if (this.isVolumeClassifier)\r\n props.isVolumeClassifier = true;\r\n\r\n return props;\r\n }\r\n\r\n /** Create flags indentical to these ones except for any properties explicitly specified by `changedProps`. */\r\n public clone(changedProps?: Partial<SpatialClassifierFlagsProps>): SpatialClassifierFlags {\r\n if (!changedProps)\r\n return this;\r\n\r\n return SpatialClassifierFlags.fromJSON({ ...this.toJSON(), ...changedProps });\r\n }\r\n\r\n /** Return true if these flags are equivalent to `other`. */\r\n public equals(other: SpatialClassifierFlags): boolean {\r\n if (other === this)\r\n return true;\r\n\r\n return other.inside === this.inside && other.outside === this.outside && other.isVolumeClassifier === this.isVolumeClassifier;\r\n }\r\n\r\n /** Return true if these flags are equivalent to `props`. */\r\n public equalsProps(props: SpatialClassifierFlagsProps): boolean {\r\n return this.inside === props.inside && this.outside === props.outside && this.isVolumeClassifier === (true === props.isVolumeClassifier);\r\n }\r\n}\r\n\r\n/** JSON representation of a [[SpatialClassifier]].\r\n * @public\r\n * @extensions\r\n */\r\nexport interface SpatialClassifierProps {\r\n /** See [[SpatialClassifier.modelId]]. */\r\n modelId: Id64String;\r\n /** See [[SpatialClassifier.expand]]. */\r\n expand: number;\r\n /** See [[SpatialClassifier.flags]]. */\r\n flags: SpatialClassifierFlagsProps;\r\n /** See [[SpatialClassifier.name]]. */\r\n name: string;\r\n /** Records whether this is the active classifier.\r\n * See [[SpatialClassifier.active]].\r\n */\r\n isActive?: boolean;\r\n}\r\n\r\n/** Describes how to use the geometry of one [GeometricModel]($backend) to classify the contents of other models - most typically, reality models.\r\n * Applying a classifier divides the geometry of the classified model into two groups:\r\n * - Classified (intersecting the classifier); and\r\n * - Unclassified (not intersecting the classifier).\r\n * For example, a model containing the building footprints for a city block could be used to classify a reality mesh captured from photographs of the\r\n * real-world block. Then, buildings within the reality mesh can be selected individually, and present the properties of the classifier geometry (e.g.,\r\n * the address of the building). The appearance of the geometry can also be customized based using [[SpatialClassifierInsideDisplay]] and [[SpatialClassifierOutsideDisplay]].\r\n * Two types of classification are supported:\r\n * - Planar classification, in which the geometry of the classifier model is projected onto a plane to classify geometry within a region extruded perpendicular\r\n * the plane (e.g., the building footprints example); and\r\n * - Volume classification, in which closed, non-intersecting volumes within the classifier classify geometry that intersects (i.e. is contained within) those same volumes (e.g., imagine using boxes instead\r\n * of footprints to classify buildings, or floors of buildings).\r\n * @see this (interactive example)[https://www.itwinjs.org/sample-showcase/?group=Viewer+Features&sample=classifier-sample].\r\n * @see [[SpatialClassifiers]] to define a set of classifiers.\r\n * @see [[ContextRealityModel.classifiers]] to classify a context reality model.\r\n * @see [SpatialModelState.classifiers]($frontend) to classify a persistent reality model.\r\n * @public\r\n */\r\nexport class SpatialClassifier {\r\n /** The Id of the [GeometricModel]($backend) whose geometry is used to produce the classifier. */\r\n public readonly modelId: Id64String;\r\n /** A distance in meters by which to expand the classifier geometry. For example, if line strings are used to represent streets,\r\n * you might expand them to the average width of a street.\r\n */\r\n public readonly expand: number;\r\n /** Flags controlling how to apply the classifier. */\r\n public readonly flags: SpatialClassifierFlags;\r\n /** A user-friendly name, useful for identifying individual classifiers within a [[SpatialClassifiers]]. */\r\n public readonly name: string;\r\n\r\n /** Construct a new classifier. */\r\n public constructor(modelId: Id64String, name: string, flags = new SpatialClassifierFlags(), expand = 0) {\r\n this.modelId = modelId;\r\n this.expand = expand;\r\n this.flags = flags;\r\n this.name = name;\r\n }\r\n\r\n /** Construct from JSON representation. */\r\n public static fromJSON(props: SpatialClassifierProps): SpatialClassifier {\r\n return new SpatialClassifier(props.modelId, props.name, SpatialClassifierFlags.fromJSON(props.flags), props.expand);\r\n }\r\n\r\n /** Convert to JSON representation.\r\n * @note This method always sets the [[SpatialClassifierProps.isActive]] property to `false`.\r\n */\r\n public toJSON(): SpatialClassifierProps {\r\n return {\r\n modelId: this.modelId,\r\n expand: this.expand,\r\n flags: this.flags.toJSON(),\r\n name: this.name,\r\n isActive: false,\r\n };\r\n }\r\n\r\n /** Construct from Model Map Layer.\r\n * @beta\r\n */\r\n public static fromModelMapLayer(mapLayer: ModelMapLayerSettings): SpatialClassifier {\r\n const flags = SpatialClassifierFlags.fromJSON({ inside: SpatialClassifierInsideDisplay.Off, outside: SpatialClassifierOutsideDisplay.Off });\r\n\r\n return new SpatialClassifier(mapLayer.modelId, mapLayer.name, flags);\r\n }\r\n\r\n /** Create a classifier identical to this one except for any properties explicitly specified by `changedProps`. */\r\n public clone(changedProps?: Partial<SpatialClassifierProps>): SpatialClassifier {\r\n if (!changedProps)\r\n return this;\r\n\r\n return SpatialClassifier.fromJSON({ ...this.toJSON(), ...changedProps });\r\n }\r\n\r\n /** Return true if this classifier is equivalent to `other`. */\r\n public equals(other: SpatialClassifier): boolean {\r\n if (other === this)\r\n return true;\r\n\r\n return this.modelId === other.modelId && this.expand === other.expand && this.name === other.name && this.flags.equals(other.flags);\r\n }\r\n\r\n /** Return true if this classifier is equivalent to `props`. */\r\n public equalsProps(props: SpatialClassifierProps): boolean {\r\n return this.modelId === props.modelId && this.expand === props.expand && this.name === props.name && this.flags.equalsProps(props.flags);\r\n }\r\n}\r\n\r\n/** An object that can store the JSON representation of a list of [[SpatialClassifier]]s.\r\n * @see [[SpatialClassifiers]].\r\n * @public\r\n * @extensions\r\n */\r\nexport interface SpatialClassifiersContainer {\r\n /** The list of classifiers. */\r\n classifiers?: SpatialClassifierProps[];\r\n}\r\n\r\n/** A set of [[SpatialClassifier]]s for a given reality model. At most one of the classifiers can be actively classifying the model at any given time.\r\n * The set of classifiers can be presented to the user, listed by name, so that the active classifier can be changed.\r\n * The set of classifiers is populated from its JSON representation and that representation is kept in sync as the set of classifiers is modified.\r\n * @see this (interactive example)[https://www.itwinjs.org/sample-showcase/?group=Viewer+Features&sample=classifier-sample].\r\n * @see [[SpatialClassifier]] for details on how spatial classification works.\r\n * @see [[ContextRealityModel.classifiers]] to define classifiers for a context reality model.\r\n * @see [SpatialModelState.classifiers]($frontend) to define classifiers for a persistent reality model.\r\n * @public\r\n */\r\nexport class SpatialClassifiers implements Iterable<SpatialClassifier> {\r\n private readonly _json: SpatialClassifiersContainer;\r\n private readonly _classifiers: SpatialClassifier[] = [];\r\n private _active?: SpatialClassifier;\r\n\r\n /** Construct a new set of classifiers from the JSON representation. The set will be initialized from `container.classifiers` and that JSON representation\r\n * will be kept in sync with changes made to the set. The caller should not directly modify `container.classifiers` or its contents as that will cause the set to become out\r\n * of sync with the JSON representation.\r\n * The [[active]] classifier will be determined by the first [[SpatialClassifierProps]] whose `isActive` property is set to `true`, if any.\r\n */\r\n public constructor(container: SpatialClassifiersContainer) {\r\n this._json = container;\r\n\r\n const json = this._array;\r\n if (!json)\r\n return;\r\n\r\n for (const props of json) {\r\n const classifier = SpatialClassifier.fromJSON(props);\r\n this._classifiers.push(classifier);\r\n if (props.isActive) {\r\n if (!this._active)\r\n this._active = classifier;\r\n else\r\n props.isActive = false;\r\n }\r\n }\r\n }\r\n\r\n /** The classifier currently classifying the target reality model. The classifier passed to the setter must be one obtained from this set, or one equivalent to\r\n * one contained in this set; in the latter case, the equivalent classifier contained in this set becomes active.\r\n */\r\n /** The classifier currently classifying the target reality model, if any.\r\n * @see [[setActive]] to change the active classifier.\r\n */\r\n public get active(): SpatialClassifier | undefined {\r\n return this._active;\r\n }\r\n\r\n /** Change the [[active]] classifier. The input must be a classifier belonging to this set, or equivalent to one in the set.\r\n * If no equivalent classifier exists in the set, the active classifier remains unchanged.\r\n * @param The classifier to set as active, or `undefined` to clear the active classifier.\r\n * @returns the active classifier.\r\n */\r\n public setActive(active: SpatialClassifier | undefined): SpatialClassifier | undefined {\r\n const array = this._array;\r\n if (!array)\r\n return this.active;\r\n\r\n if (active) {\r\n active = this.findEquivalent(active);\r\n if (!active)\r\n return this.active;\r\n }\r\n\r\n if (active === this.active)\r\n return this.active;\r\n\r\n let propsIndex = -1;\r\n if (active) {\r\n propsIndex = array.findIndex((x) => active.equalsProps(x));\r\n if (-1 === propsIndex)\r\n return this.active;\r\n }\r\n\r\n this._active = active;\r\n for (let i = 0; i < array.length; i++)\r\n array[i].isActive = (i === propsIndex);\r\n\r\n return this.active;\r\n }\r\n\r\n /** Obtain an iterator over the classifiers contained in this set. */\r\n public [Symbol.iterator](): Iterator<SpatialClassifier> {\r\n return this._classifiers[Symbol.iterator]();\r\n }\r\n\r\n /** The number of classifiers in this set. */\r\n public get size(): number {\r\n return this._array?.length ?? 0;\r\n }\r\n\r\n /** Returns the first classifier that satisfies `criterion`, or `undefined` if no classifier satisfies it. */\r\n public find(criterion: (classifier: SpatialClassifier) => boolean): SpatialClassifier | undefined {\r\n return this._classifiers.find(criterion);\r\n }\r\n\r\n /** Find the first classifier that is equivalent to the supplied classifier, or `undefined` if no equivalent classifier exists in this set. */\r\n public findEquivalent(classifier: SpatialClassifier): SpatialClassifier | undefined {\r\n return this.find((x) => x.equals(classifier));\r\n }\r\n\r\n /** Return true if the specified classifier or one equivalent to it exists in this set. */\r\n public has(classifier: SpatialClassifier): boolean {\r\n return undefined !== this.findEquivalent(classifier);\r\n }\r\n\r\n /** Add a classifier to this set. If an equivalent classifier already exists, the supplied classifier is not added.\r\n * @param classifier The classifier to add.\r\n * @returns The equivalent pre-existing classifier, if one existed; or the supplied classifier, if it was added to the set.\r\n */\r\n public add(classifier: SpatialClassifier): SpatialClassifier {\r\n const existing = this.findEquivalent(classifier);\r\n if (existing)\r\n return existing;\r\n\r\n let array = this._array;\r\n if (!array)\r\n array = this._json.classifiers = [];\r\n\r\n this._classifiers.push(classifier);\r\n array.push(classifier.toJSON());\r\n return classifier;\r\n }\r\n\r\n /** Replace an existing classifier with a different one.\r\n * @param toReplace The classifier to be replaced.\r\n * @param replacement The classifier to replace `toReplace`.\r\n * @returns true if a classifier equivalent to `toReplace` existed in the set and was replaced by `replacement`.\r\n * @note If `toReplace` was the [[active]] classifier, `replacement` will become active.\r\n */\r\n public replace(toReplace: SpatialClassifier, replacement: SpatialClassifier): boolean {\r\n const list = this._array;\r\n if (!list)\r\n return false;\r\n\r\n const classifierIndex = this._classifiers.findIndex((x) => x.equals(toReplace));\r\n if (-1 === classifierIndex)\r\n return false;\r\n\r\n const propsIndex = list.findIndex((x) => toReplace.equalsProps(x));\r\n assert(propsIndex === classifierIndex);\r\n if (-1 === propsIndex)\r\n return false;\r\n\r\n toReplace = this._classifiers[classifierIndex];\r\n const wasActive = this.active === toReplace;\r\n\r\n this._classifiers[classifierIndex] = replacement;\r\n const props = list[propsIndex] = replacement.toJSON();\r\n\r\n if (wasActive) {\r\n props.isActive = true;\r\n this._active = replacement;\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /** Remove the first classifier equivalent to `classifier` from this set.\r\n * @param classifier The classifier to remove.\r\n * @returns The classifier that was actually removed, or `undefined` if none was removed.\r\n */\r\n public delete(classifier: SpatialClassifier): SpatialClassifier | undefined {\r\n const list = this._array;\r\n if (!list)\r\n return undefined;\r\n\r\n const classifierIndex = this._classifiers.findIndex((x) => x.equals(classifier));\r\n if (-1 === classifierIndex)\r\n return undefined;\r\n\r\n classifier = this._classifiers[classifierIndex];\r\n const propsIndex = list.findIndex((x) => classifier.equalsProps(x));\r\n assert(propsIndex === classifierIndex);\r\n if (-1 === propsIndex)\r\n return undefined;\r\n\r\n list.splice(propsIndex, 1);\r\n this._classifiers.splice(classifierIndex, 1);\r\n if (list.length === 0)\r\n this._json.classifiers = undefined;\r\n\r\n if (classifier === this.active)\r\n this._active = undefined;\r\n\r\n return classifier;\r\n }\r\n\r\n /** Remove all classifiers from this set. */\r\n public clear(): void {\r\n this._classifiers.length = 0;\r\n this._json.classifiers = undefined;\r\n this._active = undefined;\r\n }\r\n\r\n private get _array(): SpatialClassifierProps[] | undefined {\r\n return Array.isArray(this._json.classifiers) ? this._json.classifiers : undefined;\r\n }\r\n}\r\n\r\nfunction insideDisplay(display: number): SpatialClassifierInsideDisplay {\r\n switch (display) {\r\n case SpatialClassifierInsideDisplay.Off:\r\n case SpatialClassifierInsideDisplay.On:\r\n case SpatialClassifierInsideDisplay.Dimmed:\r\n case SpatialClassifierInsideDisplay.Hilite:\r\n case SpatialClassifierInsideDisplay.ElementColor:\r\n return display;\r\n default:\r\n return SpatialClassifierInsideDisplay.ElementColor;\r\n }\r\n}\r\n\r\nfunction outsideDisplay(display: number): SpatialClassifierOutsideDisplay {\r\n switch (display) {\r\n case SpatialClassifierOutsideDisplay.Off:\r\n case SpatialClassifierOutsideDisplay.On:\r\n case SpatialClassifierOutsideDisplay.Dimmed:\r\n return display;\r\n default:\r\n return SpatialClassifierOutsideDisplay.Dimmed;\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"SubCategoryAppearance.js","sourceRoot":"","sources":["../../src/SubCategoryAppearance.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAc,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAiB,MAAM,YAAY,CAAC;AAErD;;;;GAIG;AACH,MAAM,OAAO,qBAAqB;IAChC;;;OAGG;IACa,KAAK,CAAW;IAChC;;OAEG;IACa,MAAM,CAAS;IAC/B;;;;;OAKG;IACa,QAAQ,CAAS;IACjC,gJAAgJ;IAChI,YAAY,CAAS;IACrC,oEAAoE;IACpD,SAAS,CAAU;IACnC,gBAAgB;IACA,QAAQ,CAAU;IAClC,gBAAgB;IACA,QAAQ,CAAU;IAClC,gBAAgB;IACA,UAAU,CAAU;IACpC,4GAA4G;IAC5F,OAAO,CAAa;IACpC,wGAAwG;IACxF,UAAU,CAAa;IACvC,gBAAgB;IACG,UAAU,CAAY;IACzC,gBAAgB;IACG,iBAAiB,CAAU;IAE9C;;;OAGG;IACH,IAAW,SAAS,KAAe,OAAO,CAAC,SAAS,KAAK,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,C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AC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC;IAEnF,MAAM,CAAC,QAAQ,GAAG,IAAI,qBAAqB,EAAE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Symbology\n */\n\nimport { Id64, Id64String, JsonUtils } from \"@itwin/core-bentley\";\nimport { ColorDef, ColorDefProps } from \"./ColorDef\";\n\n/** Parameters that define the way geometry on a [[SubCategory]] appears.\n * SubCategoryAppearance describes the intrinsic appearance of geometry belonging to that SubCategory, independent of a particular [[ViewState]].\n * Aspects of a SubCategory's appearance can be overridden in the context of a particular [[ViewState]] through the use of [[SubCategoryOverride]]s.\n * @public\n */\nexport class SubCategoryAppearance {\n /** The color of the geometry.\n * @note The transparency component of the color is ignored.\n * @see [[SubCategoryAppearance.transparency]].\n */\n public readonly color: ColorDef;\n /** The line width, in pixels.\n * @note The renderer will clamp values to the integer range [1, 32].\n */\n public readonly weight: number;\n /** The display priority used to control which geometry draws in front of other geometry within a 2D view.\n * The priority is a number in the range [-8388576,8388576].\n * Where two pieces of geometry overlap, the one with the larger priority value draws on top of the one with the smaller priority.\n * If they have equal priorities, the order in which they draw is undefined, and z-fighting may result.\n * @note This property has no effect in 3D views unless [[PlanProjectionSettings]] are in effect.\n */\n public readonly priority: number;\n /** A value in the range [0, 1] indicating the transparency of the geometry where 0.0 means \"fully opaque\" and 1.0 means \"fully transparent\". */\n public readonly transparency: number;\n /** If true, geometry belonging to this SubCategory is not drawn. */\n public readonly invisible: boolean;\n /** @internal */\n public readonly dontPlot: boolean;\n /** @internal */\n public readonly dontSnap: boolean;\n /** @internal */\n public readonly dontLocate: boolean;\n /** The element ID of the line style used to draw curves, or an invalid ID if no line style is specified. */\n public readonly styleId: Id64String;\n /** The element ID of the material applied to surfaces, or an invalid ID if no material is specified. */\n public readonly materialId: Id64String;\n /** @internal */\n protected readonly _fillColor?: ColorDef;\n /** @internal */\n protected readonly _fillTransparency?: number;\n\n /** The fill color of geometry marked as being filled.\n * @note The transparency component of the fill color is ignored.\n * @see [[SubCategoryAppearance.fillTransparency]].\n */\n public get fillColor(): ColorDef { return (undefined !== this._fillColor ? this._fillColor : this.color); }\n /** A value in the range [0, 1] indicating the fill transparency of the geometry where 0.0 means \"fully opaque\" and 1.0 means \"fully transparent\". */\n public get fillTransparency(): number { return (undefined !== this._fillTransparency ? this._fillTransparency : this.transparency); }\n\n constructor(props?: SubCategoryAppearance.Props) {\n if (!props) {\n this.color = ColorDef.black;\n this.weight = 0;\n this.priority = 0;\n this.transparency = 0;\n this.invisible = this.dontPlot = this.dontSnap = this.dontLocate = false;\n this.styleId = Id64.invalid;\n this.materialId = Id64.invalid;\n return;\n }\n\n this.invisible = JsonUtils.asBool(props.invisible);\n this.dontSnap = JsonUtils.asBool(props.dontSnap);\n this.dontLocate = JsonUtils.asBool(props.dontLocate);\n this.dontPlot = JsonUtils.asBool(props.dontPlot);\n this.color = ColorDef.fromJSON(props.color);\n this.weight = JsonUtils.asInt(props.weight);\n this.styleId = Id64.fromJSON(props.style);\n this.priority = JsonUtils.asInt(props.priority);\n this.materialId = Id64.fromJSON(props.material);\n this.transparency = JsonUtils.asDouble(props.transp);\n if (props.fill)\n this._fillColor = ColorDef.fromJSON(props.fill);\n if (props.transpFill)\n this._fillTransparency = JsonUtils.asDouble(props.transpFill);\n }\n\n public equals(other: SubCategoryAppearance): boolean {\n return this.invisible === other.invisible &&\n this.dontPlot === other.dontPlot &&\n this.dontSnap === other.dontSnap &&\n this.dontLocate === other.dontLocate &&\n this.color.equals(other.color) &&\n this.weight === other.weight &&\n this.priority === other.priority &&\n this.styleId === other.styleId &&\n this.materialId === other.materialId &&\n this.transparency === other.transparency &&\n this.fillColor.equals(other.fillColor) &&\n this.fillTransparency === other.fillTransparency;\n }\n\n /** @internal */\n public toJSON(): SubCategoryAppearance.Props {\n const val: SubCategoryAppearance.Props = { color: this.color.toJSON() };\n if (this.invisible)\n val.invisible = true;\n\n if (this.dontPlot)\n val.dontPlot = true;\n\n if (this.dontSnap)\n val.dontSnap = true;\n\n if (this.dontLocate)\n val.dontLocate = true;\n\n if (0 !== this.weight)\n val.weight = this.weight;\n\n if (0 !== this.priority)\n val.priority = this.priority;\n\n if (Id64.isValid(this.styleId))\n val.style = this.styleId;\n\n if (Id64.isValid(this.materialId))\n val.material = this.materialId;\n\n if (0.0 !== this.transparency)\n val.transp = this.transparency;\n\n if (this._fillColor)\n val.fill = this._fillColor.toJSON();\n\n if (this._fillTransparency)\n val.transpFill = this._fillTransparency;\n\n return val;\n }\n\n public clone(): SubCategoryAppearance { return new SubCategoryAppearance(this.toJSON()); }\n\n public static defaults = new SubCategoryAppearance();\n}\n\n/** @public */\nexport namespace SubCategoryAppearance {\n /** Properties used to create a SubCategoryAppearance\n * See [[SubCategoryAppearance]]\n */\n export interface Props {\n /** See [[SubCategoryAppearance.color]]. Defaults to black. */\n color?: ColorDefProps;\n /** See [[SubCategoryAppearance.fillColor]]. Defaults to [[SubCategoryAppearance.color]]. */\n fill?: ColorDefProps;\n /** See [[SubCategoryAppearance.invisible]]. Defaults to false. */\n invisible?: boolean;\n /** @internal */\n dontPlot?: boolean;\n /** @internal */\n dontSnap?: boolean;\n /** @internal */\n dontLocate?: boolean;\n /** See [[SubCategoryAppearance.weight]]. Defaults to 0. */\n weight?: number;\n /** See [[SubCategoryAppearance.styleId]]. Defaults to an invalid ID indicating \"no line style\". */\n style?: Id64String;\n /** See [[SubCategoryAppearance.priority]]. Defaults to 0. */\n priority?: number;\n /** See [[SubCategoryAppearance.materialId]]. Defaults to an invalid ID indicating \"no material\". */\n material?: Id64String;\n /** See [[SubCategoryAppearance.transparency]]. Defaults to 0. */\n transp?: number;\n /** See [[SubCategoryAppearance.fillTransparency]]. Defaults to [[SubCategoryAppearance.transparency]]. */\n transpFill?: number;\n }\n}\n"]}
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IAAI,CAAC;QAExB,IAAI,CAAC,KAAK,IAAI,CAAC,MAAM;YACnB,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAE3B,IAAI,CAAC,KAAK,IAAI,CAAC,QAAQ;YACrB,GAAG,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAE/B,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC;YAC5B,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC;QAE3B,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC;YAC/B,GAAG,CAAC,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC;QAEjC,IAAI,GAAG,KAAK,IAAI,CAAC,YAAY;YAC3B,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC;QAEjC,IAAI,IAAI,CAAC,UAAU;YACjB,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;QAEtC,IAAI,IAAI,CAAC,iBAAiB;YACxB,GAAG,CAAC,UAAU,GAAG,IAAI,CAAC,iBAAiB,CAAC;QAE1C,OAAO,GAAG,CAAC;IACb,CAAC;IAEM,KAAK,KAA4B,OAAO,IAAI,qBAAqB,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC;IAEnF,MAAM,CAAC,QAAQ,GAAG,IAAI,qBAAqB,EAAE,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 Symbology\r\n */\r\n\r\nimport { Id64, Id64String, JsonUtils } from \"@itwin/core-bentley\";\r\nimport { ColorDef, ColorDefProps } from \"./ColorDef\";\r\n\r\n/** Parameters that define the way geometry on a [[SubCategory]] appears.\r\n * SubCategoryAppearance describes the intrinsic appearance of geometry belonging to that SubCategory, independent of a particular [[ViewState]].\r\n * Aspects of a SubCategory's appearance can be overridden in the context of a particular [[ViewState]] through the use of [[SubCategoryOverride]]s.\r\n * @public\r\n */\r\nexport class SubCategoryAppearance {\r\n /** The color of the geometry.\r\n * @note The transparency component of the color is ignored.\r\n * @see [[SubCategoryAppearance.transparency]].\r\n */\r\n public readonly color: ColorDef;\r\n /** The line width, in pixels.\r\n * @note The renderer will clamp values to the integer range [1, 32].\r\n */\r\n public readonly weight: number;\r\n /** The display priority used to control which geometry draws in front of other geometry within a 2D view.\r\n * The priority is a number in the range [-8388576,8388576].\r\n * Where two pieces of geometry overlap, the one with the larger priority value draws on top of the one with the smaller priority.\r\n * If they have equal priorities, the order in which they draw is undefined, and z-fighting may result.\r\n * @note This property has no effect in 3D views unless [[PlanProjectionSettings]] are in effect.\r\n */\r\n public readonly priority: number;\r\n /** A value in the range [0, 1] indicating the transparency of the geometry where 0.0 means \"fully opaque\" and 1.0 means \"fully transparent\". */\r\n public readonly transparency: number;\r\n /** If true, geometry belonging to this SubCategory is not drawn. */\r\n public readonly invisible: boolean;\r\n /** @internal */\r\n public readonly dontPlot: boolean;\r\n /** @internal */\r\n public readonly dontSnap: boolean;\r\n /** @internal */\r\n public readonly dontLocate: boolean;\r\n /** The element ID of the line style used to draw curves, or an invalid ID if no line style is specified. */\r\n public readonly styleId: Id64String;\r\n /** The element ID of the material applied to surfaces, or an invalid ID if no material is specified. */\r\n public readonly materialId: Id64String;\r\n /** @internal */\r\n protected readonly _fillColor?: ColorDef;\r\n /** @internal */\r\n protected readonly _fillTransparency?: number;\r\n\r\n /** The fill color of geometry marked as being filled.\r\n * @note The transparency component of the fill color is ignored.\r\n * @see [[SubCategoryAppearance.fillTransparency]].\r\n */\r\n public get fillColor(): ColorDef { return (undefined !== this._fillColor ? this._fillColor : this.color); }\r\n /** A value in the range [0, 1] indicating the fill transparency of the geometry where 0.0 means \"fully opaque\" and 1.0 means \"fully transparent\". */\r\n public get fillTransparency(): number { return (undefined !== this._fillTransparency ? this._fillTransparency : this.transparency); }\r\n\r\n constructor(props?: SubCategoryAppearance.Props) {\r\n if (!props) {\r\n this.color = ColorDef.black;\r\n this.weight = 0;\r\n this.priority = 0;\r\n this.transparency = 0;\r\n this.invisible = this.dontPlot = this.dontSnap = this.dontLocate = false;\r\n this.styleId = Id64.invalid;\r\n this.materialId = Id64.invalid;\r\n return;\r\n }\r\n\r\n this.invisible = JsonUtils.asBool(props.invisible);\r\n this.dontSnap = JsonUtils.asBool(props.dontSnap);\r\n this.dontLocate = JsonUtils.asBool(props.dontLocate);\r\n this.dontPlot = JsonUtils.asBool(props.dontPlot);\r\n this.color = ColorDef.fromJSON(props.color);\r\n this.weight = JsonUtils.asInt(props.weight);\r\n this.styleId = Id64.fromJSON(props.style);\r\n this.priority = JsonUtils.asInt(props.priority);\r\n this.materialId = Id64.fromJSON(props.material);\r\n this.transparency = JsonUtils.asDouble(props.transp);\r\n if (props.fill)\r\n this._fillColor = ColorDef.fromJSON(props.fill);\r\n if (props.transpFill)\r\n this._fillTransparency = JsonUtils.asDouble(props.transpFill);\r\n }\r\n\r\n public equals(other: SubCategoryAppearance): boolean {\r\n return this.invisible === other.invisible &&\r\n this.dontPlot === other.dontPlot &&\r\n this.dontSnap === other.dontSnap &&\r\n this.dontLocate === other.dontLocate &&\r\n this.color.equals(other.color) &&\r\n this.weight === other.weight &&\r\n this.priority === other.priority &&\r\n this.styleId === other.styleId &&\r\n this.materialId === other.materialId &&\r\n this.transparency === other.transparency &&\r\n this.fillColor.equals(other.fillColor) &&\r\n this.fillTransparency === other.fillTransparency;\r\n }\r\n\r\n /** @internal */\r\n public toJSON(): SubCategoryAppearance.Props {\r\n const val: SubCategoryAppearance.Props = { color: this.color.toJSON() };\r\n if (this.invisible)\r\n val.invisible = true;\r\n\r\n if (this.dontPlot)\r\n val.dontPlot = true;\r\n\r\n if (this.dontSnap)\r\n val.dontSnap = true;\r\n\r\n if (this.dontLocate)\r\n val.dontLocate = true;\r\n\r\n if (0 !== this.weight)\r\n val.weight = this.weight;\r\n\r\n if (0 !== this.priority)\r\n val.priority = this.priority;\r\n\r\n if (Id64.isValid(this.styleId))\r\n val.style = this.styleId;\r\n\r\n if (Id64.isValid(this.materialId))\r\n val.material = this.materialId;\r\n\r\n if (0.0 !== this.transparency)\r\n val.transp = this.transparency;\r\n\r\n if (this._fillColor)\r\n val.fill = this._fillColor.toJSON();\r\n\r\n if (this._fillTransparency)\r\n val.transpFill = this._fillTransparency;\r\n\r\n return val;\r\n }\r\n\r\n public clone(): SubCategoryAppearance { return new SubCategoryAppearance(this.toJSON()); }\r\n\r\n public static defaults = new SubCategoryAppearance();\r\n}\r\n\r\n/** @public */\r\nexport namespace SubCategoryAppearance {\r\n /** Properties used to create a SubCategoryAppearance\r\n * See [[SubCategoryAppearance]]\r\n */\r\n export interface Props {\r\n /** See [[SubCategoryAppearance.color]]. Defaults to black. */\r\n color?: ColorDefProps;\r\n /** See [[SubCategoryAppearance.fillColor]]. Defaults to [[SubCategoryAppearance.color]]. */\r\n fill?: ColorDefProps;\r\n /** See [[SubCategoryAppearance.invisible]]. Defaults to false. */\r\n invisible?: boolean;\r\n /** @internal */\r\n dontPlot?: boolean;\r\n /** @internal */\r\n dontSnap?: boolean;\r\n /** @internal */\r\n dontLocate?: boolean;\r\n /** See [[SubCategoryAppearance.weight]]. Defaults to 0. */\r\n weight?: number;\r\n /** See [[SubCategoryAppearance.styleId]]. Defaults to an invalid ID indicating \"no line style\". */\r\n style?: Id64String;\r\n /** See [[SubCategoryAppearance.priority]]. Defaults to 0. */\r\n priority?: number;\r\n /** See [[SubCategoryAppearance.materialId]]. Defaults to an invalid ID indicating \"no material\". */\r\n material?: Id64String;\r\n /** See [[SubCategoryAppearance.transparency]]. Defaults to 0. */\r\n transp?: number;\r\n /** See [[SubCategoryAppearance.fillTransparency]]. Defaults to [[SubCategoryAppearance.transparency]]. */\r\n transpFill?: number;\r\n }\r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YAC3B,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC9C,IAAI,SAAS,KAAK,KAAK,CAAC,MAAM;YAC5B,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC9C,IAAI,SAAS,KAAK,KAAK,CAAC,KAAK;YAC3B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC1C,IAAI,SAAS,KAAK,KAAK,CAAC,QAAQ;YAC9B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAChD,IAAI,SAAS,KAAK,KAAK,CAAC,QAAQ;YAC9B,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAClD,IAAI,SAAS,KAAK,KAAK,CAAC,MAAM;YAC5B,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACzD,CAAC;IAED,6DAA6D;IACtD,MAAM,CAAC,QAAQ,GAAG,IAAI,mBAAmB,CAAC,EAAE,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module DisplayStyles\n */\n\nimport { Id64, Id64String, JsonUtils } from \"@itwin/core-bentley\";\nimport { ColorDef } from \"./ColorDef\";\nimport { SubCategoryAppearance } from \"./SubCategoryAppearance\";\n\n/** Overrides selected aspects of a [[SubCategoryAppearance]] in the context of a [[DisplayStyleState]].\n * When determining how geometry belonging to a [[SubCategory]] will appear when drawn within a view:\n * 1. The base [[SubCategoryAppearance]] associated with that subcategory is obtained.\n * 2. The [[SubCategoryOverride]] associated with that subcategory in the [[DisplayStyleState]] is obtained.\n * 3. Any aspects of the appearance overridden by the SubCategoryOverride are replaced with the values from the SubCategoryOverride.\n * An aspect is overridden by virtue of not being set to \"undefined\" in the SubCategoryOverride.\n * @see [[DisplayStyleState.overrideSubCategory]]\n * @public\n */\nexport class SubCategoryOverride {\n /** See [[SubCategoryAppearance.color]] */\n public readonly color?: ColorDef;\n /** See [[SubCategoryAppearance.invisible]] */\n public readonly invisible?: boolean;\n /** See [[SubCategoryAppearance.weight]] */\n public readonly weight?: number;\n /** @internal Overriding with arbitrary custom line style is not supported - overriding with LinePixels enum could be. */\n public readonly style?: Id64String;\n /** See [[SubCategoryAppearance.priority]] */\n public readonly priority?: number;\n /** See [[SubCategoryAppearance.materialId]] */\n public readonly material?: Id64String;\n /** See [[SubCategoryAppearance.transparency]] */\n public readonly transparency?: number;\n\n /** Returns true if any aspect of the appearance is overridden (i.e., if any member is not undefined). */\n public get anyOverridden(): boolean {\n return undefined !== this.invisible || undefined !== this.color || undefined !== this.weight || undefined !== this.style || undefined !== this.priority || undefined !== this.material || undefined !== this.transparency;\n }\n\n /** Returns a SubCategoryAppearance overridden to match the properties defined by this SubCategoryOverride. */\n public override(appearance: SubCategoryAppearance): SubCategoryAppearance {\n if (!this.anyOverridden)\n return appearance;\n\n const props = appearance.toJSON();\n const ovrProps = this.toJSON();\n if (undefined !== ovrProps.invisible)\n props.invisible = ovrProps.invisible;\n if (undefined !== ovrProps.weight)\n props.weight = ovrProps.weight;\n if (undefined !== ovrProps.style)\n props.style = ovrProps.style;\n if (undefined !== ovrProps.material)\n props.material = ovrProps.material;\n if (undefined !== ovrProps.priority)\n props.priority = ovrProps.priority;\n if (undefined !== ovrProps.transp)\n props.transp = ovrProps.transp;\n if (undefined !== ovrProps.color)\n props.color = ovrProps.color;\n\n return new SubCategoryAppearance(props);\n }\n\n /** Convert this SubCategoryOverride to a JSON object\n * @internal\n */\n public toJSON(): SubCategoryAppearance.Props {\n const props: SubCategoryAppearance.Props = {};\n if (undefined !== this.invisible)\n props.invisible = this.invisible;\n\n if (undefined !== this.weight)\n props.weight = this.weight;\n\n if (undefined !== this.style)\n props.style = this.style;\n\n if (undefined !== this.material)\n props.material = this.material;\n\n if (undefined !== this.priority)\n props.priority = this.priority;\n\n if (undefined !== this.transparency)\n props.transp = this.transparency;\n\n if (undefined !== this.color)\n props.color = this.color.toJSON();\n\n return props;\n }\n\n /** Perform equality comparison against another SubCategoryOverride. */\n public equals(other: SubCategoryOverride): boolean {\n if (this.invisible !== other.invisible || this.weight !== other.weight || this.style !== other.style\n || this.priority !== other.priority || this.material !== other.material || this.transparency !== other.transparency)\n return false;\n\n if (undefined !== this.color && undefined !== other.color)\n return this.color.tbgr === other.color.tbgr;\n else\n return undefined === this.color && undefined === other.color;\n }\n\n /** Create a new SubCategoryOverride from a JSON object */\n public static fromJSON(json?: SubCategoryAppearance.Props): SubCategoryOverride {\n return undefined !== json ? new SubCategoryOverride(json) : this.defaults;\n }\n\n private constructor(props: SubCategoryAppearance.Props) {\n if (undefined !== props.invisible)\n this.invisible = JsonUtils.asBool(props.invisible);\n if (undefined !== props.color)\n this.color = ColorDef.fromJSON(props.color);\n if (undefined !== props.weight)\n this.weight = JsonUtils.asInt(props.weight);\n if (undefined !== props.style)\n this.style = Id64.fromJSON(props.style);\n if (undefined !== props.material)\n this.material = Id64.fromJSON(props.material);\n if (undefined !== props.priority)\n this.priority = JsonUtils.asInt(props.priority);\n if (undefined !== props.transp)\n this.transparency = JsonUtils.asDouble(props.transp);\n }\n\n /** A default SubCategoryOverride which overrides nothing. */\n public static defaults = new SubCategoryOverride({});\n}\n"]}
1
+ {"version":3,"file":"SubCategoryOverride.js","sourceRoot":"","sources":["../../src/SubCategoryOverride.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAc,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAClE,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C,CAAC;QAC9C,IAAI,SAAS,KAAK,KAAK,CAAC,KAAK;YAC3B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC1C,IAAI,SAAS,KAAK,KAAK,CAAC,QAAQ;YAC9B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAChD,IAAI,SAAS,KAAK,KAAK,CAAC,QAAQ;YAC9B,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAClD,IAAI,SAAS,KAAK,KAAK,CAAC,MAAM;YAC5B,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACzD,CAAC;IAED,6DAA6D;IACtD,MAAM,CAAC,QAAQ,GAAG,IAAI,mBAAmB,CAAC,EAAE,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module DisplayStyles\r\n */\r\n\r\nimport { Id64, Id64String, JsonUtils } from \"@itwin/core-bentley\";\r\nimport { ColorDef } from \"./ColorDef\";\r\nimport { SubCategoryAppearance } from \"./SubCategoryAppearance\";\r\n\r\n/** Overrides selected aspects of a [[SubCategoryAppearance]] in the context of a [[DisplayStyleState]].\r\n * When determining how geometry belonging to a [[SubCategory]] will appear when drawn within a view:\r\n * 1. The base [[SubCategoryAppearance]] associated with that subcategory is obtained.\r\n * 2. The [[SubCategoryOverride]] associated with that subcategory in the [[DisplayStyleState]] is obtained.\r\n * 3. Any aspects of the appearance overridden by the SubCategoryOverride are replaced with the values from the SubCategoryOverride.\r\n * An aspect is overridden by virtue of not being set to \"undefined\" in the SubCategoryOverride.\r\n * @see [[DisplayStyleState.overrideSubCategory]]\r\n * @public\r\n */\r\nexport class SubCategoryOverride {\r\n /** See [[SubCategoryAppearance.color]] */\r\n public readonly color?: ColorDef;\r\n /** See [[SubCategoryAppearance.invisible]] */\r\n public readonly invisible?: boolean;\r\n /** See [[SubCategoryAppearance.weight]] */\r\n public readonly weight?: number;\r\n /** @internal Overriding with arbitrary custom line style is not supported - overriding with LinePixels enum could be. */\r\n public readonly style?: Id64String;\r\n /** See [[SubCategoryAppearance.priority]] */\r\n public readonly priority?: number;\r\n /** See [[SubCategoryAppearance.materialId]] */\r\n public readonly material?: Id64String;\r\n /** See [[SubCategoryAppearance.transparency]] */\r\n public readonly transparency?: number;\r\n\r\n /** Returns true if any aspect of the appearance is overridden (i.e., if any member is not undefined). */\r\n public get anyOverridden(): boolean {\r\n return undefined !== this.invisible || undefined !== this.color || undefined !== this.weight || undefined !== this.style || undefined !== this.priority || undefined !== this.material || undefined !== this.transparency;\r\n }\r\n\r\n /** Returns a SubCategoryAppearance overridden to match the properties defined by this SubCategoryOverride. */\r\n public override(appearance: SubCategoryAppearance): SubCategoryAppearance {\r\n if (!this.anyOverridden)\r\n return appearance;\r\n\r\n const props = appearance.toJSON();\r\n const ovrProps = this.toJSON();\r\n if (undefined !== ovrProps.invisible)\r\n props.invisible = ovrProps.invisible;\r\n if (undefined !== ovrProps.weight)\r\n props.weight = ovrProps.weight;\r\n if (undefined !== ovrProps.style)\r\n props.style = ovrProps.style;\r\n if (undefined !== ovrProps.material)\r\n props.material = ovrProps.material;\r\n if (undefined !== ovrProps.priority)\r\n props.priority = ovrProps.priority;\r\n if (undefined !== ovrProps.transp)\r\n props.transp = ovrProps.transp;\r\n if (undefined !== ovrProps.color)\r\n props.color = ovrProps.color;\r\n\r\n return new SubCategoryAppearance(props);\r\n }\r\n\r\n /** Convert this SubCategoryOverride to a JSON object\r\n * @internal\r\n */\r\n public toJSON(): SubCategoryAppearance.Props {\r\n const props: SubCategoryAppearance.Props = {};\r\n if (undefined !== this.invisible)\r\n props.invisible = this.invisible;\r\n\r\n if (undefined !== this.weight)\r\n props.weight = this.weight;\r\n\r\n if (undefined !== this.style)\r\n props.style = this.style;\r\n\r\n if (undefined !== this.material)\r\n props.material = this.material;\r\n\r\n if (undefined !== this.priority)\r\n props.priority = this.priority;\r\n\r\n if (undefined !== this.transparency)\r\n props.transp = this.transparency;\r\n\r\n if (undefined !== this.color)\r\n props.color = this.color.toJSON();\r\n\r\n return props;\r\n }\r\n\r\n /** Perform equality comparison against another SubCategoryOverride. */\r\n public equals(other: SubCategoryOverride): boolean {\r\n if (this.invisible !== other.invisible || this.weight !== other.weight || this.style !== other.style\r\n || this.priority !== other.priority || this.material !== other.material || this.transparency !== other.transparency)\r\n return false;\r\n\r\n if (undefined !== this.color && undefined !== other.color)\r\n return this.color.tbgr === other.color.tbgr;\r\n else\r\n return undefined === this.color && undefined === other.color;\r\n }\r\n\r\n /** Create a new SubCategoryOverride from a JSON object */\r\n public static fromJSON(json?: SubCategoryAppearance.Props): SubCategoryOverride {\r\n return undefined !== json ? new SubCategoryOverride(json) : this.defaults;\r\n }\r\n\r\n private constructor(props: SubCategoryAppearance.Props) {\r\n if (undefined !== props.invisible)\r\n this.invisible = JsonUtils.asBool(props.invisible);\r\n if (undefined !== props.color)\r\n this.color = ColorDef.fromJSON(props.color);\r\n if (undefined !== props.weight)\r\n this.weight = JsonUtils.asInt(props.weight);\r\n if (undefined !== props.style)\r\n this.style = Id64.fromJSON(props.style);\r\n if (undefined !== props.material)\r\n this.material = Id64.fromJSON(props.material);\r\n if (undefined !== props.priority)\r\n this.priority = JsonUtils.asInt(props.priority);\r\n if (undefined !== props.transp)\r\n this.transparency = JsonUtils.asDouble(props.transp);\r\n }\r\n\r\n /** A default SubCategoryOverride which overrides nothing. */\r\n public static defaults = new SubCategoryOverride({});\r\n}\r\n"]}