@itwin/core-common 3.0.0-extension.0 → 3.1.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 (289) hide show
  1. package/CHANGELOG.md +84 -1
  2. package/LICENSE.md +1 -1
  3. package/lib/cjs/BackgroundMapSettings.d.ts +1 -1
  4. package/lib/cjs/BackgroundMapSettings.d.ts.map +1 -1
  5. package/lib/cjs/BackgroundMapSettings.js.map +1 -1
  6. package/lib/cjs/ConcurrentQuery.d.ts +28 -11
  7. package/lib/cjs/ConcurrentQuery.d.ts.map +1 -1
  8. package/lib/cjs/ConcurrentQuery.js +26 -12
  9. package/lib/cjs/ConcurrentQuery.js.map +1 -1
  10. package/lib/cjs/ContextRealityModel.d.ts +36 -16
  11. package/lib/cjs/ContextRealityModel.d.ts.map +1 -1
  12. package/lib/cjs/ContextRealityModel.js +46 -7
  13. package/lib/cjs/ContextRealityModel.js.map +1 -1
  14. package/lib/cjs/DisplayStyleSettings.d.ts +30 -24
  15. package/lib/cjs/DisplayStyleSettings.d.ts.map +1 -1
  16. package/lib/cjs/DisplayStyleSettings.js +43 -16
  17. package/lib/cjs/DisplayStyleSettings.js.map +1 -1
  18. package/lib/cjs/ECSqlReader.d.ts +17 -5
  19. package/lib/cjs/ECSqlReader.d.ts.map +1 -1
  20. package/lib/cjs/ECSqlReader.js +55 -22
  21. package/lib/cjs/ECSqlReader.js.map +1 -1
  22. package/lib/cjs/ECSqlTypes.d.ts +3 -3
  23. package/lib/cjs/ECSqlTypes.js +3 -3
  24. package/lib/cjs/ECSqlTypes.js.map +1 -1
  25. package/lib/cjs/ElementProps.d.ts +9 -0
  26. package/lib/cjs/ElementProps.d.ts.map +1 -1
  27. package/lib/cjs/ElementProps.js.map +1 -1
  28. package/lib/cjs/Environment.d.ts +61 -0
  29. package/lib/cjs/Environment.d.ts.map +1 -0
  30. package/lib/cjs/Environment.js +74 -0
  31. package/lib/cjs/Environment.js.map +1 -0
  32. package/lib/cjs/FeatureSymbology.d.ts +97 -18
  33. package/lib/cjs/FeatureSymbology.d.ts.map +1 -1
  34. package/lib/cjs/FeatureSymbology.js +83 -27
  35. package/lib/cjs/FeatureSymbology.js.map +1 -1
  36. package/lib/cjs/GeoCoordinateServices.d.ts +66 -1
  37. package/lib/cjs/GeoCoordinateServices.d.ts.map +1 -1
  38. package/lib/cjs/GeoCoordinateServices.js +39 -1
  39. package/lib/cjs/GeoCoordinateServices.js.map +1 -1
  40. package/lib/cjs/Gradient.d.ts.map +1 -1
  41. package/lib/cjs/Gradient.js +10 -0
  42. package/lib/cjs/Gradient.js.map +1 -1
  43. package/lib/cjs/GroundPlane.d.ts +26 -15
  44. package/lib/cjs/GroundPlane.d.ts.map +1 -1
  45. package/lib/cjs/GroundPlane.js +40 -39
  46. package/lib/cjs/GroundPlane.js.map +1 -1
  47. package/lib/cjs/IModel.d.ts +33 -4
  48. package/lib/cjs/IModel.d.ts.map +1 -1
  49. package/lib/cjs/IModel.js +27 -10
  50. package/lib/cjs/IModel.js.map +1 -1
  51. package/lib/cjs/LightSettings.d.ts +59 -0
  52. package/lib/cjs/LightSettings.d.ts.map +1 -1
  53. package/lib/cjs/LightSettings.js +75 -6
  54. package/lib/cjs/LightSettings.js.map +1 -1
  55. package/lib/cjs/Localization.d.ts +1 -1
  56. package/lib/cjs/Localization.js.map +1 -1
  57. package/lib/cjs/MapLayerSettings.d.ts +2 -2
  58. package/lib/cjs/MapLayerSettings.js +2 -2
  59. package/lib/cjs/MapLayerSettings.js.map +1 -1
  60. package/lib/cjs/NativeAppProps.d.ts +2 -36
  61. package/lib/cjs/NativeAppProps.d.ts.map +1 -1
  62. package/lib/cjs/NativeAppProps.js.map +1 -1
  63. package/lib/cjs/PlanarClipMask.d.ts +73 -8
  64. package/lib/cjs/PlanarClipMask.d.ts.map +1 -1
  65. package/lib/cjs/PlanarClipMask.js +17 -24
  66. package/lib/cjs/PlanarClipMask.js.map +1 -1
  67. package/lib/cjs/RealityDataAccessProps.d.ts +42 -0
  68. package/lib/cjs/RealityDataAccessProps.d.ts.map +1 -0
  69. package/lib/cjs/RealityDataAccessProps.js +20 -0
  70. package/lib/cjs/RealityDataAccessProps.js.map +1 -0
  71. package/lib/cjs/RenderMaterial.d.ts +7 -7
  72. package/lib/cjs/RenderMaterial.d.ts.map +1 -1
  73. package/lib/cjs/RenderMaterial.js +10 -5
  74. package/lib/cjs/RenderMaterial.js.map +1 -1
  75. package/lib/cjs/RenderSchedule.d.ts +4 -0
  76. package/lib/cjs/RenderSchedule.d.ts.map +1 -1
  77. package/lib/cjs/RenderSchedule.js +5 -1
  78. package/lib/cjs/RenderSchedule.js.map +1 -1
  79. package/lib/cjs/RenderTexture.d.ts +8 -1
  80. package/lib/cjs/RenderTexture.d.ts.map +1 -1
  81. package/lib/cjs/RenderTexture.js.map +1 -1
  82. package/lib/cjs/SkyBox.d.ts +142 -34
  83. package/lib/cjs/SkyBox.d.ts.map +1 -1
  84. package/lib/cjs/SkyBox.js +192 -6
  85. package/lib/cjs/SkyBox.js.map +1 -1
  86. package/lib/cjs/TextureMapping.d.ts +3 -1
  87. package/lib/cjs/TextureMapping.d.ts.map +1 -1
  88. package/lib/cjs/TextureMapping.js +9 -6
  89. package/lib/cjs/TextureMapping.js.map +1 -1
  90. package/lib/cjs/TextureProps.d.ts +21 -2
  91. package/lib/cjs/TextureProps.d.ts.map +1 -1
  92. package/lib/cjs/TextureProps.js +19 -0
  93. package/lib/cjs/TextureProps.js.map +1 -1
  94. package/lib/cjs/ThematicDisplay.d.ts +6 -0
  95. package/lib/cjs/ThematicDisplay.d.ts.map +1 -1
  96. package/lib/cjs/ThematicDisplay.js +26 -0
  97. package/lib/cjs/ThematicDisplay.js.map +1 -1
  98. package/lib/cjs/TileProps.d.ts +6 -0
  99. package/lib/cjs/TileProps.d.ts.map +1 -1
  100. package/lib/cjs/TileProps.js.map +1 -1
  101. package/lib/cjs/ViewFlags.d.ts +8 -0
  102. package/lib/cjs/ViewFlags.d.ts.map +1 -1
  103. package/lib/cjs/ViewFlags.js +30 -10
  104. package/lib/cjs/ViewFlags.js.map +1 -1
  105. package/lib/cjs/core-common.d.ts +7 -0
  106. package/lib/cjs/core-common.d.ts.map +1 -1
  107. package/lib/cjs/core-common.js +7 -0
  108. package/lib/cjs/core-common.js.map +1 -1
  109. package/lib/cjs/geometry/AdditionalTransform.d.ts +1 -1
  110. package/lib/cjs/geometry/AdditionalTransform.js +1 -1
  111. package/lib/cjs/geometry/AdditionalTransform.js.map +1 -1
  112. package/lib/cjs/geometry/CoordinateReferenceSystem.d.ts +25 -10
  113. package/lib/cjs/geometry/CoordinateReferenceSystem.d.ts.map +1 -1
  114. package/lib/cjs/geometry/CoordinateReferenceSystem.js +9 -7
  115. package/lib/cjs/geometry/CoordinateReferenceSystem.js.map +1 -1
  116. package/lib/cjs/geometry/ElementGeometry.d.ts +12 -8
  117. package/lib/cjs/geometry/ElementGeometry.d.ts.map +1 -1
  118. package/lib/cjs/geometry/ElementGeometry.js.map +1 -1
  119. package/lib/cjs/geometry/FrustumPlanes.d.ts +1 -1
  120. package/lib/cjs/geometry/FrustumPlanes.d.ts.map +1 -1
  121. package/lib/cjs/geometry/FrustumPlanes.js +26 -13
  122. package/lib/cjs/geometry/FrustumPlanes.js.map +1 -1
  123. package/lib/cjs/ipc/IpcWebSocket.d.ts +12 -5
  124. package/lib/cjs/ipc/IpcWebSocket.d.ts.map +1 -1
  125. package/lib/cjs/ipc/IpcWebSocket.js +32 -8
  126. package/lib/cjs/ipc/IpcWebSocket.js.map +1 -1
  127. package/lib/cjs/ipc/IpcWebSocketTransport.d.ts +15 -0
  128. package/lib/cjs/ipc/IpcWebSocketTransport.d.ts.map +1 -0
  129. package/lib/cjs/ipc/IpcWebSocketTransport.js +142 -0
  130. package/lib/cjs/ipc/IpcWebSocketTransport.js.map +1 -0
  131. package/lib/cjs/rpc/core/RpcInvocation.d.ts +4 -4
  132. package/lib/cjs/rpc/core/RpcInvocation.d.ts.map +1 -1
  133. package/lib/cjs/rpc/core/RpcInvocation.js +3 -1
  134. package/lib/cjs/rpc/core/RpcInvocation.js.map +1 -1
  135. package/lib/cjs/tile/ElementGraphics.d.ts +5 -1
  136. package/lib/cjs/tile/ElementGraphics.d.ts.map +1 -1
  137. package/lib/cjs/tile/ElementGraphics.js.map +1 -1
  138. package/lib/cjs/tile/GltfTileIO.d.ts +16 -79
  139. package/lib/cjs/tile/GltfTileIO.d.ts.map +1 -1
  140. package/lib/cjs/tile/GltfTileIO.js +72 -153
  141. package/lib/cjs/tile/GltfTileIO.js.map +1 -1
  142. package/lib/cjs/tile/TileMetadata.d.ts +20 -8
  143. package/lib/cjs/tile/TileMetadata.d.ts.map +1 -1
  144. package/lib/cjs/tile/TileMetadata.js +50 -53
  145. package/lib/cjs/tile/TileMetadata.js.map +1 -1
  146. package/lib/esm/BackgroundMapSettings.d.ts +1 -1
  147. package/lib/esm/BackgroundMapSettings.d.ts.map +1 -1
  148. package/lib/esm/BackgroundMapSettings.js.map +1 -1
  149. package/lib/esm/ConcurrentQuery.d.ts +28 -11
  150. package/lib/esm/ConcurrentQuery.d.ts.map +1 -1
  151. package/lib/esm/ConcurrentQuery.js +26 -12
  152. package/lib/esm/ConcurrentQuery.js.map +1 -1
  153. package/lib/esm/ContextRealityModel.d.ts +36 -16
  154. package/lib/esm/ContextRealityModel.d.ts.map +1 -1
  155. package/lib/esm/ContextRealityModel.js +45 -6
  156. package/lib/esm/ContextRealityModel.js.map +1 -1
  157. package/lib/esm/DisplayStyleSettings.d.ts +30 -24
  158. package/lib/esm/DisplayStyleSettings.d.ts.map +1 -1
  159. package/lib/esm/DisplayStyleSettings.js +43 -16
  160. package/lib/esm/DisplayStyleSettings.js.map +1 -1
  161. package/lib/esm/ECSqlReader.d.ts +17 -5
  162. package/lib/esm/ECSqlReader.d.ts.map +1 -1
  163. package/lib/esm/ECSqlReader.js +56 -23
  164. package/lib/esm/ECSqlReader.js.map +1 -1
  165. package/lib/esm/ECSqlTypes.d.ts +3 -3
  166. package/lib/esm/ECSqlTypes.js +3 -3
  167. package/lib/esm/ECSqlTypes.js.map +1 -1
  168. package/lib/esm/ElementProps.d.ts +9 -0
  169. package/lib/esm/ElementProps.d.ts.map +1 -1
  170. package/lib/esm/ElementProps.js.map +1 -1
  171. package/lib/esm/Environment.d.ts +61 -0
  172. package/lib/esm/Environment.d.ts.map +1 -0
  173. package/lib/esm/Environment.js +70 -0
  174. package/lib/esm/Environment.js.map +1 -0
  175. package/lib/esm/FeatureSymbology.d.ts +97 -18
  176. package/lib/esm/FeatureSymbology.d.ts.map +1 -1
  177. package/lib/esm/FeatureSymbology.js +84 -28
  178. package/lib/esm/FeatureSymbology.js.map +1 -1
  179. package/lib/esm/GeoCoordinateServices.d.ts +66 -1
  180. package/lib/esm/GeoCoordinateServices.d.ts.map +1 -1
  181. package/lib/esm/GeoCoordinateServices.js +39 -1
  182. package/lib/esm/GeoCoordinateServices.js.map +1 -1
  183. package/lib/esm/Gradient.d.ts.map +1 -1
  184. package/lib/esm/Gradient.js +10 -0
  185. package/lib/esm/Gradient.js.map +1 -1
  186. package/lib/esm/GroundPlane.d.ts +26 -15
  187. package/lib/esm/GroundPlane.d.ts.map +1 -1
  188. package/lib/esm/GroundPlane.js +40 -39
  189. package/lib/esm/GroundPlane.js.map +1 -1
  190. package/lib/esm/IModel.d.ts +33 -4
  191. package/lib/esm/IModel.d.ts.map +1 -1
  192. package/lib/esm/IModel.js +27 -10
  193. package/lib/esm/IModel.js.map +1 -1
  194. package/lib/esm/LightSettings.d.ts +59 -0
  195. package/lib/esm/LightSettings.d.ts.map +1 -1
  196. package/lib/esm/LightSettings.js +74 -6
  197. package/lib/esm/LightSettings.js.map +1 -1
  198. package/lib/esm/Localization.d.ts +1 -1
  199. package/lib/esm/Localization.js.map +1 -1
  200. package/lib/esm/MapLayerSettings.d.ts +2 -2
  201. package/lib/esm/MapLayerSettings.js +2 -2
  202. package/lib/esm/MapLayerSettings.js.map +1 -1
  203. package/lib/esm/NativeAppProps.d.ts +2 -36
  204. package/lib/esm/NativeAppProps.d.ts.map +1 -1
  205. package/lib/esm/NativeAppProps.js.map +1 -1
  206. package/lib/esm/PlanarClipMask.d.ts +73 -8
  207. package/lib/esm/PlanarClipMask.d.ts.map +1 -1
  208. package/lib/esm/PlanarClipMask.js +17 -24
  209. package/lib/esm/PlanarClipMask.js.map +1 -1
  210. package/lib/esm/RealityDataAccessProps.d.ts +42 -0
  211. package/lib/esm/RealityDataAccessProps.d.ts.map +1 -0
  212. package/lib/esm/RealityDataAccessProps.js +17 -0
  213. package/lib/esm/RealityDataAccessProps.js.map +1 -0
  214. package/lib/esm/RenderMaterial.d.ts +7 -7
  215. package/lib/esm/RenderMaterial.d.ts.map +1 -1
  216. package/lib/esm/RenderMaterial.js +10 -5
  217. package/lib/esm/RenderMaterial.js.map +1 -1
  218. package/lib/esm/RenderSchedule.d.ts +4 -0
  219. package/lib/esm/RenderSchedule.d.ts.map +1 -1
  220. package/lib/esm/RenderSchedule.js +5 -1
  221. package/lib/esm/RenderSchedule.js.map +1 -1
  222. package/lib/esm/RenderTexture.d.ts +8 -1
  223. package/lib/esm/RenderTexture.d.ts.map +1 -1
  224. package/lib/esm/RenderTexture.js.map +1 -1
  225. package/lib/esm/SkyBox.d.ts +142 -34
  226. package/lib/esm/SkyBox.d.ts.map +1 -1
  227. package/lib/esm/SkyBox.js +187 -5
  228. package/lib/esm/SkyBox.js.map +1 -1
  229. package/lib/esm/TextureMapping.d.ts +3 -1
  230. package/lib/esm/TextureMapping.d.ts.map +1 -1
  231. package/lib/esm/TextureMapping.js +9 -6
  232. package/lib/esm/TextureMapping.js.map +1 -1
  233. package/lib/esm/TextureProps.d.ts +21 -2
  234. package/lib/esm/TextureProps.d.ts.map +1 -1
  235. package/lib/esm/TextureProps.js +18 -1
  236. package/lib/esm/TextureProps.js.map +1 -1
  237. package/lib/esm/ThematicDisplay.d.ts +6 -0
  238. package/lib/esm/ThematicDisplay.d.ts.map +1 -1
  239. package/lib/esm/ThematicDisplay.js +26 -0
  240. package/lib/esm/ThematicDisplay.js.map +1 -1
  241. package/lib/esm/TileProps.d.ts +6 -0
  242. package/lib/esm/TileProps.d.ts.map +1 -1
  243. package/lib/esm/TileProps.js.map +1 -1
  244. package/lib/esm/ViewFlags.d.ts +8 -0
  245. package/lib/esm/ViewFlags.d.ts.map +1 -1
  246. package/lib/esm/ViewFlags.js +30 -10
  247. package/lib/esm/ViewFlags.js.map +1 -1
  248. package/lib/esm/core-common.d.ts +7 -0
  249. package/lib/esm/core-common.d.ts.map +1 -1
  250. package/lib/esm/core-common.js +7 -0
  251. package/lib/esm/core-common.js.map +1 -1
  252. package/lib/esm/geometry/AdditionalTransform.d.ts +1 -1
  253. package/lib/esm/geometry/AdditionalTransform.js +1 -1
  254. package/lib/esm/geometry/AdditionalTransform.js.map +1 -1
  255. package/lib/esm/geometry/CoordinateReferenceSystem.d.ts +25 -10
  256. package/lib/esm/geometry/CoordinateReferenceSystem.d.ts.map +1 -1
  257. package/lib/esm/geometry/CoordinateReferenceSystem.js +9 -7
  258. package/lib/esm/geometry/CoordinateReferenceSystem.js.map +1 -1
  259. package/lib/esm/geometry/ElementGeometry.d.ts +12 -8
  260. package/lib/esm/geometry/ElementGeometry.d.ts.map +1 -1
  261. package/lib/esm/geometry/ElementGeometry.js.map +1 -1
  262. package/lib/esm/geometry/FrustumPlanes.d.ts +1 -1
  263. package/lib/esm/geometry/FrustumPlanes.d.ts.map +1 -1
  264. package/lib/esm/geometry/FrustumPlanes.js +26 -13
  265. package/lib/esm/geometry/FrustumPlanes.js.map +1 -1
  266. package/lib/esm/ipc/IpcWebSocket.d.ts +12 -5
  267. package/lib/esm/ipc/IpcWebSocket.d.ts.map +1 -1
  268. package/lib/esm/ipc/IpcWebSocket.js +31 -6
  269. package/lib/esm/ipc/IpcWebSocket.js.map +1 -1
  270. package/lib/esm/ipc/IpcWebSocketTransport.d.ts +15 -0
  271. package/lib/esm/ipc/IpcWebSocketTransport.d.ts.map +1 -0
  272. package/lib/esm/ipc/IpcWebSocketTransport.js +138 -0
  273. package/lib/esm/ipc/IpcWebSocketTransport.js.map +1 -0
  274. package/lib/esm/rpc/core/RpcInvocation.d.ts +4 -4
  275. package/lib/esm/rpc/core/RpcInvocation.d.ts.map +1 -1
  276. package/lib/esm/rpc/core/RpcInvocation.js +3 -1
  277. package/lib/esm/rpc/core/RpcInvocation.js.map +1 -1
  278. package/lib/esm/tile/ElementGraphics.d.ts +5 -1
  279. package/lib/esm/tile/ElementGraphics.d.ts.map +1 -1
  280. package/lib/esm/tile/ElementGraphics.js.map +1 -1
  281. package/lib/esm/tile/GltfTileIO.d.ts +16 -79
  282. package/lib/esm/tile/GltfTileIO.d.ts.map +1 -1
  283. package/lib/esm/tile/GltfTileIO.js +70 -149
  284. package/lib/esm/tile/GltfTileIO.js.map +1 -1
  285. package/lib/esm/tile/TileMetadata.d.ts +20 -8
  286. package/lib/esm/tile/TileMetadata.d.ts.map +1 -1
  287. package/lib/esm/tile/TileMetadata.js +50 -53
  288. package/lib/esm/tile/TileMetadata.js.map +1 -1
  289. package/package.json +10 -11
@@ -1 +1 @@
1
- {"version":3,"file":"Localization.js","sourceRoot":"","sources":["../../src/Localization.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAkGH;;GAEG;AACH,MAAa,iBAAiB;IACrB,KAAK,CAAC,UAAU,KAAoB,CAAC;IACrC,kBAAkB,CAAC,GAAsB,IAAY,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACtG,+BAA+B,CAAC,UAAkB,EAAE,GAAsB,IAAY,OAAO,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAC5H,gBAAgB,CAAC,UAAkB,EAAE,GAAsB,IAAY,OAAO,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAC7G,gBAAgB,CAAC,WAAmB,IAAY,OAAO,WAAW,CAAC,CAAC,CAAC;IACrE,KAAK,CAAC,iBAAiB,KAAoB,CAAC;IAC5C,mBAAmB,KAAW,CAAC;IAC/B,mBAAmB,KAAgC,OAAO,SAAS,CAAC,CAAC,CAAC;IACtE,eAAe,KAAwB,OAAO,EAAE,CAAC,CAAC,CAAC;IACnD,KAAK,CAAC,cAAc,KAAK,CAAC;CAClC;AAXD,8CAWC","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 Localization\r\n */\r\n\r\n/** Options for Localization\r\n * @public\r\n */\r\ninterface LocalizationOptions {\r\n /** for interpolation values */\r\n [key: string]: any;\r\n /**\r\n * defaultValue to return if a translation was not found\r\n */\r\n defaultValue?: any;\r\n /**\r\n * count value used for plurals\r\n */\r\n count?: number;\r\n /**\r\n * used for contexts (eg. male\\female)\r\n */\r\n context?: any;\r\n /**\r\n * override languages to use\r\n */\r\n lngs?: string[];\r\n /**\r\n * override language to lookup key if not found see fallbacks for details\r\n */\r\n fallbackLng?: string;\r\n}\r\n\r\n/** The interface defining the localization requirements of [IModelApp]($frontend).\r\n * @public\r\n */\r\nexport interface Localization {\r\n /** This method must be called and awaited before using an instance of Localization.\r\n * @param namespaces an array of namespaces to load. There must be at least one namespace, and it\r\n * becomes the default namespace.\r\n * @note IModelApp.startup calls this internally, so you should not call this method directly\r\n * except for Localization instances outside of IModelApp (e.g., for tests.)\r\n */\r\n initialize(namespaces: string[]): Promise<void>;\r\n\r\n /** Return the translated value of a key.\r\n * @param key - the key that matches a property in the JSON localization file.\r\n * @note The key includes the namespace, which identifies the particular localization file that contains the property,\r\n * followed by a colon, followed by the property in the JSON file.\r\n * For example:\r\n * ``` ts\r\n * const dataString: string = IModelApp.localization.getLocalizedString(\"iModelJs:BackgroundMap.BingDataAttribution\");\r\n * ```\r\n * assigns to dataString the string with property BackgroundMap.BingDataAttribution from the iModelJs.json localization file.\r\n * @returns The string corresponding to the first key that resolves.\r\n * @throws Error if no keys resolve to a string.\r\n */\r\n getLocalizedString(key: string | string[], options?: LocalizationOptions): string;\r\n /** Similar to 'translate()' but the namespace is a separate param and the key does not include the namespace.\r\n * @param namespace - the namespace that identifies the particular localization file that contains the property.\r\n * @param key - the key that matches a property in the JSON localization file.\r\n * @returns The string corresponding to the first key that resolves.\r\n * @throws Error if no keys resolve to a string.\r\n */\r\n getLocalizedStringWithNamespace(namespace: string, key: string | string[], options?: LocalizationOptions): string;\r\n /** get the English string for a key. */\r\n getEnglishString(namespace: string, key: string | string[], options?: LocalizationOptions): string;\r\n /** Replace all instances of `%{key}` within a string with the translations of those keys.\r\n * For example:\r\n * ``` ts\r\n * \"MyKeys\": {\r\n * \"Key1\": \"First value\",\r\n * \"Key2\": \"Second value\"\r\n * }\r\n * ```\r\n *\r\n * ``` ts\r\n * getLocalizedKeys(\"string with %{MyKeys.Key1} followed by %{MyKeys.Key2}!\"\") // returns \"string with First Value followed by Second Value!\"\r\n * ```\r\n */\r\n getLocalizedKeys(inputString: string): string;\r\n\r\n /** Register a new Namespace and return a Promise that is fulfilled when the content is loaded.\r\n * If the namespace is already registered, its Promise will be returned.\r\n * @param name - the name of the namespace.\r\n * @note - The registerNamespace method starts fetching the appropriate version of the JSON localization file from the server,\r\n * based on the current locale. To make sure that fetch is complete before performing translations from this namespace, await\r\n * fulfillment of returned Promise.\r\n * @see [Localization in iTwin.js]($docs/learning/frontend/Localization.md)\r\n */\r\n registerNamespace(namespace: string): Promise<void>;\r\n /** @internal */\r\n unregisterNamespace(namespace: string): void;\r\n /** @internal */\r\n getNamespacePromise(name: string): Promise<void> | undefined;\r\n /** Get the list of available languages for translations */\r\n getLanguageList(): readonly string[];\r\n /** Change the language for translations. This overrides the language from the browser, for tests. */\r\n changeLanguage(language: string): Promise<void>;\r\n}\r\n\r\n/** An empty [[Localization]] used if one is not provided to [IModelApp]($frontend). Does not perform localizations (merely returns the key.)\r\n * @public\r\n */\r\nexport class EmptyLocalization implements Localization {\r\n public async initialize(): Promise<void> { }\r\n public getLocalizedString(key: string | string[]): string { return typeof (key) == \"string\" ? key : key[0]; }\r\n public getLocalizedStringWithNamespace(_namespace: string, key: string | string[]): string { return this.getLocalizedString(key); }\r\n public getEnglishString(_namespace: string, key: string | string[]): string { return this.getLocalizedString(key); }\r\n public getLocalizedKeys(inputString: string): string { return inputString; }\r\n public async registerNamespace(): Promise<void> { }\r\n public unregisterNamespace(): void { }\r\n public getNamespacePromise(): Promise<void> | undefined { return undefined; }\r\n public getLanguageList(): readonly string[] { return []; }\r\n public async changeLanguage() { }\r\n}\r\n"]}
1
+ {"version":3,"file":"Localization.js","sourceRoot":"","sources":["../../src/Localization.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAkGH;;GAEG;AACH,MAAa,iBAAiB;IACrB,KAAK,CAAC,UAAU,KAAoB,CAAC;IACrC,kBAAkB,CAAC,GAAsB,IAAY,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACtG,+BAA+B,CAAC,UAAkB,EAAE,GAAsB,IAAY,OAAO,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAC5H,gBAAgB,CAAC,UAAkB,EAAE,GAAsB,IAAY,OAAO,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAC7G,gBAAgB,CAAC,WAAmB,IAAY,OAAO,WAAW,CAAC,CAAC,CAAC;IACrE,KAAK,CAAC,iBAAiB,KAAoB,CAAC;IAC5C,mBAAmB,KAAW,CAAC;IAC/B,mBAAmB,KAAgC,OAAO,SAAS,CAAC,CAAC,CAAC;IACtE,eAAe,KAAwB,OAAO,EAAE,CAAC,CAAC,CAAC;IACnD,KAAK,CAAC,cAAc,KAAK,CAAC;CAClC;AAXD,8CAWC","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 Localization\r\n */\r\n\r\n/** Options for Localization\r\n * @public\r\n */\r\ninterface LocalizationOptions {\r\n /** for interpolation values */\r\n [key: string]: any;\r\n /**\r\n * defaultValue to return if a translation was not found\r\n */\r\n defaultValue?: any;\r\n /**\r\n * count value used for plurals\r\n */\r\n count?: number;\r\n /**\r\n * used for contexts (eg. male\\female)\r\n */\r\n context?: any;\r\n /**\r\n * override languages to use\r\n */\r\n lngs?: string[];\r\n /**\r\n * override language to lookup key if not found see fallbacks for details\r\n */\r\n fallbackLng?: string;\r\n}\r\n\r\n/** The interface defining the localization requirements of [IModelApp]($frontend).\r\n * @public\r\n */\r\nexport interface Localization {\r\n /** This method must be called and awaited before using an instance of Localization.\r\n * @param namespaces an array of namespaces to load. There must be at least one namespace, and it\r\n * becomes the default namespace.\r\n * @note IModelApp.startup calls this internally, so you should not call this method directly\r\n * except for Localization instances outside of IModelApp (e.g., for tests.)\r\n */\r\n initialize(namespaces: string[]): Promise<void>;\r\n\r\n /** Return the translated value of a key.\r\n * @param key - the key that matches a property in the JSON localization file.\r\n * @note The key includes the namespace, which identifies the particular localization file that contains the property,\r\n * followed by a colon, followed by the property in the JSON file.\r\n * For example:\r\n * ``` ts\r\n * const dataString: string = IModelApp.localization.getLocalizedString(\"iModelJs:BackgroundMap.BingDataAttribution\");\r\n * ```\r\n * assigns to dataString the string with property BackgroundMap.BingDataAttribution from the iModelJs.json localization file.\r\n * @returns The string corresponding to the first key that resolves.\r\n * @throws Error if no keys resolve to a string.\r\n */\r\n getLocalizedString(key: string | string[], options?: LocalizationOptions): string;\r\n /** Similar to `getLocalizedString` but the namespace is a separate param and the key does not include the namespace.\r\n * @param namespace - the namespace that identifies the particular localization file that contains the property.\r\n * @param key - the key that matches a property in the JSON localization file.\r\n * @returns The string corresponding to the first key that resolves.\r\n * @throws Error if no keys resolve to a string.\r\n */\r\n getLocalizedStringWithNamespace(namespace: string, key: string | string[], options?: LocalizationOptions): string;\r\n /** get the English string for a key. */\r\n getEnglishString(namespace: string, key: string | string[], options?: LocalizationOptions): string;\r\n /** Replace all instances of `%{key}` within a string with the translations of those keys.\r\n * For example:\r\n * ``` ts\r\n * \"MyKeys\": {\r\n * \"Key1\": \"First value\",\r\n * \"Key2\": \"Second value\"\r\n * }\r\n * ```\r\n *\r\n * ``` ts\r\n * getLocalizedKeys(\"string with %{MyKeys.Key1} followed by %{MyKeys.Key2}!\"\") // returns \"string with First Value followed by Second Value!\"\r\n * ```\r\n */\r\n getLocalizedKeys(inputString: string): string;\r\n\r\n /** Register a new Namespace and return a Promise that is fulfilled when the content is loaded.\r\n * If the namespace is already registered, its Promise will be returned.\r\n * @param name - the name of the namespace.\r\n * @note - The registerNamespace method starts fetching the appropriate version of the JSON localization file from the server,\r\n * based on the current locale. To make sure that fetch is complete before performing translations from this namespace, await\r\n * fulfillment of returned Promise.\r\n * @see [Localization in iTwin.js]($docs/learning/frontend/Localization.md)\r\n */\r\n registerNamespace(namespace: string): Promise<void>;\r\n /** @internal */\r\n unregisterNamespace(namespace: string): void;\r\n /** @internal */\r\n getNamespacePromise(name: string): Promise<void> | undefined;\r\n /** Get the list of available languages for translations */\r\n getLanguageList(): readonly string[];\r\n /** Change the language for translations. This overrides the language from the browser, for tests. */\r\n changeLanguage(language: string): Promise<void>;\r\n}\r\n\r\n/** An empty [[Localization]] used if one is not provided to [IModelApp]($frontend). Does not perform localizations (merely returns the key.)\r\n * @public\r\n */\r\nexport class EmptyLocalization implements Localization {\r\n public async initialize(): Promise<void> { }\r\n public getLocalizedString(key: string | string[]): string { return typeof (key) == \"string\" ? key : key[0]; }\r\n public getLocalizedStringWithNamespace(_namespace: string, key: string | string[]): string { return this.getLocalizedString(key); }\r\n public getEnglishString(_namespace: string, key: string | string[]): string { return this.getLocalizedString(key); }\r\n public getLocalizedKeys(inputString: string): string { return inputString; }\r\n public async registerNamespace(): Promise<void> { }\r\n public unregisterNamespace(): void { }\r\n public getNamespacePromise(): Promise<void> | undefined { return undefined; }\r\n public getLanguageList(): readonly string[] { return []; }\r\n public async changeLanguage() { }\r\n}\r\n"]}
@@ -23,7 +23,7 @@ export interface MapSubLayerProps {
23
23
  * have been validated and default values have been applied where explicit values not defined.
24
24
  * A map sub layer represents a set of objects within the layer that can be controlled separately. These
25
25
  * are produced only from map servers that produce images on demand and are not supported by tiled (cached) servers.
26
- * This class can represent an hierarchy, in this case a sub layer is visible only if all its ancestors are also visible.
26
+ * This class can represent a hierarchy, in this case a sub layer is visible only if all its ancestors are also visible.
27
27
  * @see [[MapLayerSettings]]
28
28
  * @beta
29
29
  */
@@ -93,7 +93,7 @@ export interface MapLayerKey {
93
93
  key: string;
94
94
  value: string;
95
95
  }
96
- /** Normalized representation of a [[MapLayerProps]] for which values have been validated and default values have been applied where explicit values not defined.
96
+ /** Normalized representation of a [[MapLayerProps]] for which values have been validated and default values have been applied where explicit values not defined.
97
97
  * One or more map layers may be included within [[MapImagerySettings]] object.
98
98
  * @see [[MapImagerySettings]]
99
99
  * @beta
@@ -14,7 +14,7 @@ const BackgroundMapProvider_1 = require("./BackgroundMapProvider");
14
14
  * have been validated and default values have been applied where explicit values not defined.
15
15
  * A map sub layer represents a set of objects within the layer that can be controlled separately. These
16
16
  * are produced only from map servers that produce images on demand and are not supported by tiled (cached) servers.
17
- * This class can represent an hierarchy, in this case a sub layer is visible only if all its ancestors are also visible.
17
+ * This class can represent a hierarchy, in this case a sub layer is visible only if all its ancestors are also visible.
18
18
  * @see [[MapLayerSettings]]
19
19
  * @beta
20
20
  */
@@ -72,7 +72,7 @@ class MapSubLayerSettings {
72
72
  get idString() { return (typeof this.id === "number") ? this.id.toString(10) : this.id; }
73
73
  }
74
74
  exports.MapSubLayerSettings = MapSubLayerSettings;
75
- /** Normalized representation of a [[MapLayerProps]] for which values have been validated and default values have been applied where explicit values not defined.
75
+ /** Normalized representation of a [[MapLayerProps]] for which values have been validated and default values have been applied where explicit values not defined.
76
76
  * One or more map layers may be included within [[MapImagerySettings]] object.
77
77
  * @see [[MapImagerySettings]]
78
78
  * @beta
@@ -1 +1 @@
1
- {"version":3,"file":"MapLayerSettings.js","sourceRoot":"","sources":["../../src/MapLayerSettings.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA6C;AAC7C,mEAA+G;AAqB/G;;;;;;;GAOG;AACH,MAAa,mBAAmB;IAc9B,YAAY,IAAY,EAAE,KAAc,EAAE,OAAiB,EAAE,EAAe,EAAE,MAAmB,EAAE,QAAuB;QACxH,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,OAAO,GAAG,OAAO,KAAK,SAAS,IAAI,OAAO,CAAC;QAChD,IAAI,CAAC,EAAE,GAAG,CAAC,EAAE,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IACD,mGAAmG;IAC5F,MAAM,CAAC,QAAQ,CAAC,IAAsB;QAC3C,OAAO,IAAI,mBAAmB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,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ACT,MAAM,CAAC,sBAAsB,CAAC,KAAmC;QACtE,OAAO,IAAI,CAAC,YAAY,CAAC,6CAAqB,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC,CAAC;IAChF,CAAC;IAED,aAAa;IACN,iBAAiB,CAAC,QAA+B;QACtD,OAAO,oBAAoB,CAAC,YAAY,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,YAAY,EAAE,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;IACpH,CAAC;CACF;AArHD,oDAqHC","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 } from \"@itwin/core-bentley\";\r\nimport { BackgroundMapProvider, BackgroundMapProviderProps, BackgroundMapType } from \"./BackgroundMapProvider\";\r\nimport { DeprecatedBackgroundMapProps } from \"./BackgroundMapSettings\";\r\n\r\n/** @beta */\r\nexport type SubLayerId = string | number;\r\n\r\n/** JSON representation of the settings associated with a map sublayer included within a [[MapLayerProps]].\r\n * A map sub layer represents a set of objects within the layer that can be controlled separately. These\r\n * are produced only from map servers that produce images on demand and are not supported by tiled (cached) servers.\r\n * @see [[MapLayerProps]]\r\n * @beta\r\n */\r\nexport interface MapSubLayerProps {\r\n name: string;\r\n title?: string;\r\n visible?: boolean;\r\n id?: SubLayerId;\r\n parent?: SubLayerId;\r\n children?: SubLayerId[];\r\n}\r\n\r\n/** Normalized representation of a [[MapSubLayerProps]] for which values\r\n * have been validated and default values have been applied where explicit values not defined.\r\n * A map sub layer represents a set of objects within the layer that can be controlled separately. These\r\n * are produced only from map servers that produce images on demand and are not supported by tiled (cached) servers.\r\n * This class can represent an hierarchy, in this case a sub layer is visible only if all its ancestors are also visible.\r\n * @see [[MapLayerSettings]]\r\n * @beta\r\n */\r\nexport class MapSubLayerSettings {\r\n /** Typically Name is a single word used for machine-to-machine communication while the Title is for the benefit of humans (WMS) */\r\n public readonly name: string;\r\n /** Title. */\r\n public readonly title?: string;\r\n /** If true the sub layer is visible. If part of a hierarchy, a sub layer is visible only if its ancestors are also visible. */\r\n public readonly visible: boolean;\r\n /** A unique string or number that may be used to identify the sub layer (ArcGIS) */\r\n public readonly id: SubLayerId;\r\n /** One or more sublayer children */\r\n public readonly children?: SubLayerId[];\r\n /** sublayer parent. */\r\n public readonly parent?: SubLayerId;\r\n\r\n constructor(name: string, title?: string, visible?: boolean, id?: SubLayerId, parent?: SubLayerId, children?: SubLayerId[]) {\r\n this.name = name;\r\n this.title = title;\r\n this.visible = visible !== undefined && visible;\r\n this.id = (id === undefined) ? this.name : id;\r\n this.parent = parent;\r\n this.children = children;\r\n }\r\n /** Construct from JSON, performing validation and applying default values for undefined fields. */\r\n public static fromJSON(json: MapSubLayerProps): MapSubLayerSettings {\r\n return new MapSubLayerSettings(json.name, json.title, json.visible, (json.id === json.name) ? undefined : json.id, json.parent, json.children);\r\n }\r\n public toJSON(): MapSubLayerProps {\r\n const props: MapSubLayerProps = { name: this.name, visible: this.visible };\r\n\r\n if (undefined !== this.id && this.id !== this.name)\r\n props.id = this.id;\r\n\r\n if (undefined !== this.title)\r\n props.title = this.title;\r\n\r\n if (this.children)\r\n props.children = [...this.children];\r\n\r\n if (undefined !== this.parent)\r\n props.parent = this.parent;\r\n\r\n return props;\r\n }\r\n\r\n /** Creating a copy of this MapSubLayer, optionally modifying some if its properties */\r\n public clone(changedProps: Partial<MapSubLayerProps>): MapSubLayerSettings {\r\n if (undefined === changedProps)\r\n return this;\r\n\r\n const props = {\r\n name: undefined !== changedProps.name ? changedProps.name : this.name,\r\n id: undefined !== changedProps.id ? changedProps.id : this.id,\r\n visible: undefined !== changedProps.visible ? changedProps.visible : this.visible,\r\n parent: undefined !== changedProps.parent ? changedProps.parent : this.parent,\r\n children: undefined !== changedProps.children ? changedProps.children.slice() : this.children?.slice(),\r\n title: undefined !== changedProps.title ? changedProps.title : this.title,\r\n };\r\n return MapSubLayerSettings.fromJSON(props)!;\r\n }\r\n /** @internal */\r\n public displayMatches(other: MapSubLayerSettings): boolean {\r\n return this.name === other.name && this.visible === other.visible;\r\n }\r\n /** return true if this sublayer is named. */\r\n public get isNamed(): boolean { return this.name.length > 0; }\r\n\r\n /** return true if this sublayer is a leaf (has no children) */\r\n public get isLeaf(): boolean { return this.children === undefined || this.children.length === 0; }\r\n\r\n /** return true if this sublayer is an unnamed group */\r\n public get isUnnamedGroup(): boolean { return !this.isLeaf && !this.isNamed; }\r\n\r\n /** return a string representing this sublayer id (converting to string if underlying id is number) */\r\n public get idString(): string { return (typeof this.id === \"number\") ? this.id.toString(10) : this.id; }\r\n}\r\n\r\n/** JSON representation of the settings associated with a map layer. One or more map layers may be included within a [[MapImageryProps]] object.\r\n * @see [[MapImageryProps]]\r\n * @beta\r\n */\r\nexport interface MapLayerProps {\r\n /** Controls visibility of layer. Defaults to 'true'. */\r\n visible?: boolean;\r\n /** Identifies the map layers source.*/\r\n formatId: string;\r\n /** Name */\r\n name: string;\r\n /** URL */\r\n url: string;\r\n /** Source layers. If undefined all layers are displayed. */\r\n subLayers?: MapSubLayerProps[];\r\n /** A transparency value from 0.0 (fully opaque) to 1.0 (fully transparent) to apply to map graphics when drawing,\r\n * or false to indicate the transparency should not be overridden. Default value: 0.\r\n * If omitted, defaults to 0. */\r\n transparency?: number;\r\n /** True to indicate background is transparent. Defaults to 'true'. */\r\n transparentBackground?: boolean;\r\n /** Is a base layer. Defaults to 'false'. */\r\n isBase?: boolean;\r\n /** Access Key for the Layer, like a subscription key or access token.\r\n * TODO This does not belong in the props object. It should never be persisted.\r\n */\r\n accessKey?: MapLayerKey;\r\n}\r\n\r\n/**\r\n * stores key-value pair to be added to all requests made involving map layer.\r\n * @beta\r\n */\r\nexport interface MapLayerKey {\r\n key: string;\r\n value: string;\r\n}\r\n\r\n/** Normalized representation of a [[MapLayerProps]] for which values have been validated and default values have been applied where explicit values not defined.\r\n * One or more map layers may be included within [[MapImagerySettings]] object.\r\n * @see [[MapImagerySettings]]\r\n * @beta\r\n */\r\nexport class MapLayerSettings {\r\n public readonly visible: boolean;\r\n public readonly formatId: string;\r\n public readonly name: string;\r\n public readonly url: string;\r\n public readonly transparency: number;\r\n public readonly subLayers: MapSubLayerSettings[];\r\n public readonly transparentBackground: boolean;\r\n public readonly isBase: boolean;\r\n public userName?: string;\r\n public password?: string;\r\n public accessKey?: MapLayerKey;\r\n\r\n public setCredentials(userName?: string, password?: string) {\r\n this.userName = userName;\r\n this.password = password;\r\n }\r\n\r\n /** @internal */\r\n protected constructor(url: string, name: string, formatId: string, visible = true,\r\n jsonSubLayers: MapSubLayerProps[] | undefined = undefined, transparency: number = 0,\r\n transparentBackground = true, isBase = false, userName?: string, password?: string, accessKey?: MapLayerKey) {\r\n this.formatId = formatId;\r\n this.name = name;\r\n this.visible = visible;\r\n this.transparentBackground = transparentBackground;\r\n this.isBase = isBase;\r\n this.subLayers = new Array<MapSubLayerSettings>();\r\n if (jsonSubLayers !== undefined) {\r\n let hasUnnamedGroups = false;\r\n for (const jsonSubLayer of jsonSubLayers) {\r\n const subLayer = MapSubLayerSettings.fromJSON(jsonSubLayer);\r\n if (undefined !== subLayer) {\r\n this.subLayers.push(subLayer);\r\n if (subLayer.children?.length !== 0 && !subLayer.isNamed && !hasUnnamedGroups)\r\n hasUnnamedGroups = true;\r\n }\r\n }\r\n\r\n this.userName = userName;\r\n this.password = password;\r\n }\r\n this.accessKey = accessKey;\r\n this.transparency = transparency;\r\n this.url = url;\r\n }\r\n\r\n /** Construct from JSON, performing validation and applying default values for undefined fields. */\r\n public static fromJSON(json: MapLayerProps): MapLayerSettings {\r\n const transparentBackground = (json.transparentBackground === undefined) ? true : json.transparentBackground;\r\n return new this(json.url, json.name, json.formatId, json.visible, json.subLayers, json.transparency, transparentBackground, json.isBase === true, undefined, undefined, json.accessKey);\r\n }\r\n\r\n /** return JSON representation of this MapLayerSettings object */\r\n public toJSON(): MapLayerProps {\r\n const props: MapLayerProps = {formatId: this.formatId, name: this.name, url: this.url};\r\n if (this.subLayers.length > 0) {\r\n props.subLayers = [];\r\n this.subLayers.forEach((subLayer) => {\r\n const subLayerJson = subLayer.toJSON();\r\n if (subLayerJson)\r\n props.subLayers!.push(subLayerJson);\r\n });\r\n }\r\n\r\n if (0 !== this.transparency)\r\n props.transparency = this.transparency;\r\n\r\n if (this.transparentBackground === false)\r\n props.transparentBackground = this.transparentBackground;\r\n\r\n if (this.isBase === true)\r\n props.isBase = this.isBase;\r\n\r\n props.visible = this.visible;\r\n return props;\r\n }\r\n\r\n /** @internal */\r\n protected static mapTypeName(type: BackgroundMapType) { // TBD.. Localization.\r\n switch (type) {\r\n case BackgroundMapType.Aerial:\r\n return \"Aerial Imagery\";\r\n default:\r\n case BackgroundMapType.Hybrid:\r\n return \"Aerial Imagery with labels\";\r\n case BackgroundMapType.Street:\r\n return \"Streets\";\r\n }\r\n }\r\n\r\n /** Create a copy of this MapLayerSettings, optionally modifying some of its properties.\r\n * @param changedProps JSON representation of the properties to change.\r\n * @returns A MapLayerSettings with all of its properties set to match those of `this`, except those explicitly defined in `changedProps`.\r\n */\r\n public clone(changedProps: Partial<MapLayerProps>): MapLayerSettings {\r\n const clone = MapLayerSettings.fromJSON(this.cloneProps(changedProps));\r\n\r\n // Clone members not part of MapLayerProps\r\n clone.userName = this.userName;\r\n clone.password = this.password;\r\n clone.accessKey = this.accessKey;\r\n\r\n return clone;\r\n }\r\n\r\n /** @internal */\r\n protected cloneProps(changedProps: Partial<MapLayerProps>): MapLayerProps {\r\n return {\r\n name: undefined !== changedProps.name ? changedProps.name : this.name,\r\n formatId: undefined !== changedProps.formatId ? changedProps.formatId : this.formatId,\r\n visible: undefined !== changedProps.visible ? changedProps.visible : this.visible,\r\n url: undefined !== changedProps.url ? changedProps.url : this.url,\r\n transparency: undefined !== changedProps.transparency ? changedProps.transparency : this.transparency,\r\n transparentBackground: undefined !== changedProps.transparentBackground ? changedProps.transparentBackground : this.transparentBackground,\r\n subLayers: undefined !== changedProps.subLayers ? changedProps.subLayers : this.subLayers,\r\n accessKey: undefined !== changedProps.accessKey ? changedProps.accessKey : this.accessKey,\r\n };\r\n }\r\n\r\n /** @internal */\r\n public displayMatches(other: MapLayerSettings): boolean {\r\n if (!this.matchesNameAndUrl(other.name, other.url)\r\n || this.visible !== other.visible\r\n || this.transparency !== other.transparency\r\n || this.transparentBackground !== other.transparentBackground\r\n || this.subLayers.length !== other.subLayers.length) {\r\n return false;\r\n }\r\n\r\n if (this.userName !== other.userName || this.password !== other.password) {\r\n return false;\r\n }\r\n\r\n for (let i = 0; i < this.subLayers.length; i++)\r\n if (!this.subLayers[i].displayMatches(other.subLayers[i]))\r\n return false;\r\n\r\n return true;\r\n }\r\n\r\n /** @internal */\r\n public matchesNameAndUrl(name: string, url: string): boolean {\r\n return this.name === name && this.url === url;\r\n }\r\n\r\n /** Return a sublayer matching id -- or undefined if not found */\r\n public subLayerById(id?: SubLayerId): MapSubLayerSettings | undefined {\r\n return id === undefined ? undefined : this.subLayers.find((subLayer) => subLayer.id === id);\r\n }\r\n\r\n private hasInvisibleAncestors(subLayer?: MapSubLayerSettings): boolean {\r\n if (!subLayer || !subLayer.parent)\r\n return false;\r\n\r\n const parent = this.subLayerById(subLayer.parent);\r\n if (!parent)\r\n return false;\r\n\r\n // Visibility of named group has no impact on the visibility of children (only unnamed group does)\r\n // i.e For WMS, its should be possible to request a child layer when its parent is not visible (if the parent is also named)\r\n return (!parent.visible && !parent.isNamed) || this.hasInvisibleAncestors(parent);\r\n }\r\n\r\n /** Return true if sublayer is visible -- testing ancestors for visibility if they exist. */\r\n public isSubLayerVisible(subLayer: MapSubLayerSettings): boolean {\r\n if (!subLayer.visible)\r\n return false;\r\n\r\n return !this.hasInvisibleAncestors(subLayer);\r\n }\r\n\r\n /** Return true if all sublayers are visible. */\r\n public get allSubLayersInvisible(): boolean {\r\n if (this.subLayers.length === 0)\r\n return false;\r\n\r\n return this.subLayers.every((subLayer) => (subLayer.isUnnamedGroup || !this.isSubLayerVisible(subLayer)));\r\n }\r\n\r\n /** Return the children for a sublayer */\r\n public getSubLayerChildren(subLayer: MapSubLayerSettings): MapSubLayerSettings[] | undefined {\r\n if (!subLayer.children)\r\n return undefined;\r\n\r\n const children = new Array<MapSubLayerSettings>();\r\n subLayer.children.forEach((childId) => {\r\n const child = this.subLayerById(childId);\r\n if (child !== undefined)\r\n children.push(child);\r\n });\r\n\r\n return children;\r\n }\r\n}\r\n\r\n/** JSON representation of a [[BaseMapLayerSettings]].\r\n * @beta\r\n */\r\nexport interface BaseMapLayerProps extends MapLayerProps {\r\n provider?: BackgroundMapProviderProps;\r\n}\r\n\r\n/** A [[MapLayerSettings]] that can serve as the base layer for a [[MapImagerySettings]].\r\n * The base layer supports all of the same options as any other layer, but also allows for simplified configuration based\r\n * on a small set of known supported [[BackgroundMapProvider]]s like [Bing Maps](https://www.microsoft.com/en-us/maps).\r\n * If the base layer was configured from such a provider, that information will be preserved and can be queried; this allows\r\n * the imagery provider and/or type to be easily modified.\r\n * @see [[MapImagerySettings.backgroundBase]].\r\n * @beta\r\n */\r\nexport class BaseMapLayerSettings extends MapLayerSettings {\r\n private _provider?: BackgroundMapProvider;\r\n\r\n /** The provider from which this base layer was configured, if any. */\r\n public get provider(): BackgroundMapProvider | undefined { return this._provider; }\r\n\r\n /** Create a base layer from its JSON representation.\r\n * TODO: This, MapLayerSettings.fromJSON, and MapSubLayerSettings.fromJSON should never return undefined.\r\n * That means they should not accept undefined for props and should define props such that it fully describes the\r\n * layer - e.g., url and name must be defined.\r\n */\r\n public static override fromJSON(props: BaseMapLayerProps): BaseMapLayerSettings {\r\n const settings = super.fromJSON(props);\r\n assert(settings instanceof BaseMapLayerSettings);\r\n if (props.provider)\r\n settings._provider = BackgroundMapProvider.fromJSON(props.provider);\r\n\r\n return settings;\r\n }\r\n\r\n /** Convert this layer to its JSON representation. */\r\n public override toJSON(): BaseMapLayerProps {\r\n const props = super.toJSON() as BaseMapLayerProps;\r\n if (this.provider)\r\n props.provider = this.provider.toJSON();\r\n\r\n return props;\r\n }\r\n\r\n /** @internal */\r\n public override cloneProps(changedProps: Partial<MapLayerProps>): BaseMapLayerProps {\r\n const props = super.cloneProps(changedProps) as BaseMapLayerProps;\r\n if (this.provider)\r\n props.provider = this.provider.toJSON();\r\n\r\n return props;\r\n }\r\n\r\n /** Create a copy of this layer. */\r\n public override clone(changedProps: Partial<MapLayerProps>): BaseMapLayerSettings {\r\n const prevUrl = this.url;\r\n const clone = BaseMapLayerSettings.fromJSON(this.cloneProps(changedProps))!;\r\n\r\n if (this.provider && prevUrl !== this.url)\r\n clone._provider = undefined;\r\n\r\n return clone;\r\n }\r\n\r\n /** Create a base layer from a BackgroundMapProvider. */\r\n public static fromProvider(provider: BackgroundMapProvider, options?: { invisible?: boolean, transparency?: number }): BaseMapLayerSettings {\r\n let formatId: string, url: string, name: string;\r\n switch (provider.name) {\r\n case \"BingProvider\":\r\n default:\r\n formatId = \"BingMaps\";\r\n\r\n let imagerySet;\r\n switch (provider.type) {\r\n case BackgroundMapType.Street:\r\n imagerySet = \"Road\";\r\n break;\r\n case BackgroundMapType.Aerial:\r\n imagerySet = \"Aerial\";\r\n break;\r\n case BackgroundMapType.Hybrid:\r\n default:\r\n imagerySet = \"AerialWithLabels\";\r\n break;\r\n }\r\n name = `Bing Maps: ${MapLayerSettings.mapTypeName(provider.type)}`;\r\n url = `https://dev.virtualearth.net/REST/v1/Imagery/Metadata/${imagerySet}?o=json&incl=ImageryProviders&key={bingKey}`;\r\n break;\r\n\r\n case \"MapBoxProvider\":\r\n formatId = \"MapboxImagery\";\r\n name = `MapBox: ${MapLayerSettings.mapTypeName(provider.type)}`;\r\n switch (provider.type) {\r\n case BackgroundMapType.Street:\r\n url = \"https://api.mapbox.com/v4/mapbox.streets/\";\r\n break;\r\n case BackgroundMapType.Aerial:\r\n url = \"https://api.mapbox.com/v4/mapbox.satellite/\";\r\n break;\r\n case BackgroundMapType.Hybrid:\r\n url = \"https://api.mapbox.com/v4/mapbox.streets-satellite/\";\r\n break;\r\n }\r\n break;\r\n }\r\n\r\n const settings = super.fromJSON({\r\n name,\r\n formatId,\r\n url,\r\n transparentBackground: false,\r\n isBase: true,\r\n visible: !options?.invisible,\r\n transparency: options?.transparency,\r\n });\r\n\r\n assert(undefined !== settings);\r\n assert(settings instanceof BaseMapLayerSettings);\r\n\r\n settings._provider = provider;\r\n return settings;\r\n }\r\n\r\n /** @internal */\r\n public static fromBackgroundMapProps(props: DeprecatedBackgroundMapProps): BaseMapLayerSettings {\r\n return this.fromProvider(BackgroundMapProvider.fromBackgroundMapProps(props));\r\n }\r\n\r\n /** @alpha */\r\n public cloneWithProvider(provider: BackgroundMapProvider): BaseMapLayerSettings {\r\n return BaseMapLayerSettings.fromProvider(provider, { invisible: !this.visible, transparency: this.transparency });\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"MapLayerSettings.js","sourceRoot":"","sources":["../../src/MapLayerSettings.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA6C;AAC7C,mEAA+G;AAqB/G;;;;;;;GAOG;AACH,MAAa,mBAAmB;IAc9B,YAAY,IAAY,EAAE,KAAc,EAAE,OAAiB,EAAE,EAAe,EAAE,MAAmB,EAAE,QAAuB;QACxH,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,OAAO,GAAG,OAAO,KAAK,SAAS,IAAI,OAAO,CAAC;QAChD,IAAI,CAAC,EAAE,GAAG,CAAC,EAAE,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,QA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,SAAS,CAAA;YAC5B,YAAY,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,YAAY;SACpC,CAAC,CAAC;QAEH,IAAA,qBAAM,EAAC,SAAS,KAAK,QAAQ,CAAC,CAAC;QAC/B,IAAA,qBAAM,EAAC,QAAQ,YAAY,oBAAoB,CAAC,CAAC;QAEjD,QAAQ,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC9B,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,sBAAsB,CAAC,KAAmC;QACtE,OAAO,IAAI,CAAC,YAAY,CAAC,6CAAqB,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC,CAAC;IAChF,CAAC;IAED,aAAa;IACN,iBAAiB,CAAC,QAA+B;QACtD,OAAO,oBAAoB,CAAC,YAAY,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,YAAY,EAAE,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;IACpH,CAAC;CACF;AArHD,oDAqHC","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 } from \"@itwin/core-bentley\";\r\nimport { BackgroundMapProvider, BackgroundMapProviderProps, BackgroundMapType } from \"./BackgroundMapProvider\";\r\nimport { DeprecatedBackgroundMapProps } from \"./BackgroundMapSettings\";\r\n\r\n/** @beta */\r\nexport type SubLayerId = string | number;\r\n\r\n/** JSON representation of the settings associated with a map sublayer included within a [[MapLayerProps]].\r\n * A map sub layer represents a set of objects within the layer that can be controlled separately. These\r\n * are produced only from map servers that produce images on demand and are not supported by tiled (cached) servers.\r\n * @see [[MapLayerProps]]\r\n * @beta\r\n */\r\nexport interface MapSubLayerProps {\r\n name: string;\r\n title?: string;\r\n visible?: boolean;\r\n id?: SubLayerId;\r\n parent?: SubLayerId;\r\n children?: SubLayerId[];\r\n}\r\n\r\n/** Normalized representation of a [[MapSubLayerProps]] for which values\r\n * have been validated and default values have been applied where explicit values not defined.\r\n * A map sub layer represents a set of objects within the layer that can be controlled separately. These\r\n * are produced only from map servers that produce images on demand and are not supported by tiled (cached) servers.\r\n * This class can represent a hierarchy, in this case a sub layer is visible only if all its ancestors are also visible.\r\n * @see [[MapLayerSettings]]\r\n * @beta\r\n */\r\nexport class MapSubLayerSettings {\r\n /** Typically Name is a single word used for machine-to-machine communication while the Title is for the benefit of humans (WMS) */\r\n public readonly name: string;\r\n /** Title. */\r\n public readonly title?: string;\r\n /** If true the sub layer is visible. If part of a hierarchy, a sub layer is visible only if its ancestors are also visible. */\r\n public readonly visible: boolean;\r\n /** A unique string or number that may be used to identify the sub layer (ArcGIS) */\r\n public readonly id: SubLayerId;\r\n /** One or more sublayer children */\r\n public readonly children?: SubLayerId[];\r\n /** sublayer parent. */\r\n public readonly parent?: SubLayerId;\r\n\r\n constructor(name: string, title?: string, visible?: boolean, id?: SubLayerId, parent?: SubLayerId, children?: SubLayerId[]) {\r\n this.name = name;\r\n this.title = title;\r\n this.visible = visible !== undefined && visible;\r\n this.id = (id === undefined) ? this.name : id;\r\n this.parent = parent;\r\n this.children = children;\r\n }\r\n /** Construct from JSON, performing validation and applying default values for undefined fields. */\r\n public static fromJSON(json: MapSubLayerProps): MapSubLayerSettings {\r\n return new MapSubLayerSettings(json.name, json.title, json.visible, (json.id === json.name) ? undefined : json.id, json.parent, json.children);\r\n }\r\n public toJSON(): MapSubLayerProps {\r\n const props: MapSubLayerProps = { name: this.name, visible: this.visible };\r\n\r\n if (undefined !== this.id && this.id !== this.name)\r\n props.id = this.id;\r\n\r\n if (undefined !== this.title)\r\n props.title = this.title;\r\n\r\n if (this.children)\r\n props.children = [...this.children];\r\n\r\n if (undefined !== this.parent)\r\n props.parent = this.parent;\r\n\r\n return props;\r\n }\r\n\r\n /** Creating a copy of this MapSubLayer, optionally modifying some if its properties */\r\n public clone(changedProps: Partial<MapSubLayerProps>): MapSubLayerSettings {\r\n if (undefined === changedProps)\r\n return this;\r\n\r\n const props = {\r\n name: undefined !== changedProps.name ? changedProps.name : this.name,\r\n id: undefined !== changedProps.id ? changedProps.id : this.id,\r\n visible: undefined !== changedProps.visible ? changedProps.visible : this.visible,\r\n parent: undefined !== changedProps.parent ? changedProps.parent : this.parent,\r\n children: undefined !== changedProps.children ? changedProps.children.slice() : this.children?.slice(),\r\n title: undefined !== changedProps.title ? changedProps.title : this.title,\r\n };\r\n return MapSubLayerSettings.fromJSON(props)!;\r\n }\r\n /** @internal */\r\n public displayMatches(other: MapSubLayerSettings): boolean {\r\n return this.name === other.name && this.visible === other.visible;\r\n }\r\n /** return true if this sublayer is named. */\r\n public get isNamed(): boolean { return this.name.length > 0; }\r\n\r\n /** return true if this sublayer is a leaf (has no children) */\r\n public get isLeaf(): boolean { return this.children === undefined || this.children.length === 0; }\r\n\r\n /** return true if this sublayer is an unnamed group */\r\n public get isUnnamedGroup(): boolean { return !this.isLeaf && !this.isNamed; }\r\n\r\n /** return a string representing this sublayer id (converting to string if underlying id is number) */\r\n public get idString(): string { return (typeof this.id === \"number\") ? this.id.toString(10) : this.id; }\r\n}\r\n\r\n/** JSON representation of the settings associated with a map layer. One or more map layers may be included within a [[MapImageryProps]] object.\r\n * @see [[MapImageryProps]]\r\n * @beta\r\n */\r\nexport interface MapLayerProps {\r\n /** Controls visibility of layer. Defaults to 'true'. */\r\n visible?: boolean;\r\n /** Identifies the map layers source.*/\r\n formatId: string;\r\n /** Name */\r\n name: string;\r\n /** URL */\r\n url: string;\r\n /** Source layers. If undefined all layers are displayed. */\r\n subLayers?: MapSubLayerProps[];\r\n /** A transparency value from 0.0 (fully opaque) to 1.0 (fully transparent) to apply to map graphics when drawing,\r\n * or false to indicate the transparency should not be overridden. Default value: 0.\r\n * If omitted, defaults to 0. */\r\n transparency?: number;\r\n /** True to indicate background is transparent. Defaults to 'true'. */\r\n transparentBackground?: boolean;\r\n /** Is a base layer. Defaults to 'false'. */\r\n isBase?: boolean;\r\n /** Access Key for the Layer, like a subscription key or access token.\r\n * TODO This does not belong in the props object. It should never be persisted.\r\n */\r\n accessKey?: MapLayerKey;\r\n}\r\n\r\n/**\r\n * stores key-value pair to be added to all requests made involving map layer.\r\n * @beta\r\n */\r\nexport interface MapLayerKey {\r\n key: string;\r\n value: string;\r\n}\r\n\r\n/** Normalized representation of a [[MapLayerProps]] for which values have been validated and default values have been applied where explicit values not defined.\r\n * One or more map layers may be included within [[MapImagerySettings]] object.\r\n * @see [[MapImagerySettings]]\r\n * @beta\r\n */\r\nexport class MapLayerSettings {\r\n public readonly visible: boolean;\r\n public readonly formatId: string;\r\n public readonly name: string;\r\n public readonly url: string;\r\n public readonly transparency: number;\r\n public readonly subLayers: MapSubLayerSettings[];\r\n public readonly transparentBackground: boolean;\r\n public readonly isBase: boolean;\r\n public userName?: string;\r\n public password?: string;\r\n public accessKey?: MapLayerKey;\r\n\r\n public setCredentials(userName?: string, password?: string) {\r\n this.userName = userName;\r\n this.password = password;\r\n }\r\n\r\n /** @internal */\r\n protected constructor(url: string, name: string, formatId: string, visible = true,\r\n jsonSubLayers: MapSubLayerProps[] | undefined = undefined, transparency: number = 0,\r\n transparentBackground = true, isBase = false, userName?: string, password?: string, accessKey?: MapLayerKey) {\r\n this.formatId = formatId;\r\n this.name = name;\r\n this.visible = visible;\r\n this.transparentBackground = transparentBackground;\r\n this.isBase = isBase;\r\n this.subLayers = new Array<MapSubLayerSettings>();\r\n if (jsonSubLayers !== undefined) {\r\n let hasUnnamedGroups = false;\r\n for (const jsonSubLayer of jsonSubLayers) {\r\n const subLayer = MapSubLayerSettings.fromJSON(jsonSubLayer);\r\n if (undefined !== subLayer) {\r\n this.subLayers.push(subLayer);\r\n if (subLayer.children?.length !== 0 && !subLayer.isNamed && !hasUnnamedGroups)\r\n hasUnnamedGroups = true;\r\n }\r\n }\r\n\r\n this.userName = userName;\r\n this.password = password;\r\n }\r\n this.accessKey = accessKey;\r\n this.transparency = transparency;\r\n this.url = url;\r\n }\r\n\r\n /** Construct from JSON, performing validation and applying default values for undefined fields. */\r\n public static fromJSON(json: MapLayerProps): MapLayerSettings {\r\n const transparentBackground = (json.transparentBackground === undefined) ? true : json.transparentBackground;\r\n return new this(json.url, json.name, json.formatId, json.visible, json.subLayers, json.transparency, transparentBackground, json.isBase === true, undefined, undefined, json.accessKey);\r\n }\r\n\r\n /** return JSON representation of this MapLayerSettings object */\r\n public toJSON(): MapLayerProps {\r\n const props: MapLayerProps = { formatId: this.formatId, name: this.name, url: this.url };\r\n if (this.subLayers.length > 0) {\r\n props.subLayers = [];\r\n this.subLayers.forEach((subLayer) => {\r\n const subLayerJson = subLayer.toJSON();\r\n if (subLayerJson)\r\n props.subLayers!.push(subLayerJson);\r\n });\r\n }\r\n\r\n if (0 !== this.transparency)\r\n props.transparency = this.transparency;\r\n\r\n if (this.transparentBackground === false)\r\n props.transparentBackground = this.transparentBackground;\r\n\r\n if (this.isBase === true)\r\n props.isBase = this.isBase;\r\n\r\n props.visible = this.visible;\r\n return props;\r\n }\r\n\r\n /** @internal */\r\n protected static mapTypeName(type: BackgroundMapType) { // TBD.. Localization.\r\n switch (type) {\r\n case BackgroundMapType.Aerial:\r\n return \"Aerial Imagery\";\r\n default:\r\n case BackgroundMapType.Hybrid:\r\n return \"Aerial Imagery with labels\";\r\n case BackgroundMapType.Street:\r\n return \"Streets\";\r\n }\r\n }\r\n\r\n /** Create a copy of this MapLayerSettings, optionally modifying some of its properties.\r\n * @param changedProps JSON representation of the properties to change.\r\n * @returns A MapLayerSettings with all of its properties set to match those of `this`, except those explicitly defined in `changedProps`.\r\n */\r\n public clone(changedProps: Partial<MapLayerProps>): MapLayerSettings {\r\n const clone = MapLayerSettings.fromJSON(this.cloneProps(changedProps));\r\n\r\n // Clone members not part of MapLayerProps\r\n clone.userName = this.userName;\r\n clone.password = this.password;\r\n clone.accessKey = this.accessKey;\r\n\r\n return clone;\r\n }\r\n\r\n /** @internal */\r\n protected cloneProps(changedProps: Partial<MapLayerProps>): MapLayerProps {\r\n return {\r\n name: undefined !== changedProps.name ? changedProps.name : this.name,\r\n formatId: undefined !== changedProps.formatId ? changedProps.formatId : this.formatId,\r\n visible: undefined !== changedProps.visible ? changedProps.visible : this.visible,\r\n url: undefined !== changedProps.url ? changedProps.url : this.url,\r\n transparency: undefined !== changedProps.transparency ? changedProps.transparency : this.transparency,\r\n transparentBackground: undefined !== changedProps.transparentBackground ? changedProps.transparentBackground : this.transparentBackground,\r\n subLayers: undefined !== changedProps.subLayers ? changedProps.subLayers : this.subLayers,\r\n accessKey: undefined !== changedProps.accessKey ? changedProps.accessKey : this.accessKey,\r\n };\r\n }\r\n\r\n /** @internal */\r\n public displayMatches(other: MapLayerSettings): boolean {\r\n if (!this.matchesNameAndUrl(other.name, other.url)\r\n || this.visible !== other.visible\r\n || this.transparency !== other.transparency\r\n || this.transparentBackground !== other.transparentBackground\r\n || this.subLayers.length !== other.subLayers.length) {\r\n return false;\r\n }\r\n\r\n if (this.userName !== other.userName || this.password !== other.password) {\r\n return false;\r\n }\r\n\r\n for (let i = 0; i < this.subLayers.length; i++)\r\n if (!this.subLayers[i].displayMatches(other.subLayers[i]))\r\n return false;\r\n\r\n return true;\r\n }\r\n\r\n /** @internal */\r\n public matchesNameAndUrl(name: string, url: string): boolean {\r\n return this.name === name && this.url === url;\r\n }\r\n\r\n /** Return a sublayer matching id -- or undefined if not found */\r\n public subLayerById(id?: SubLayerId): MapSubLayerSettings | undefined {\r\n return id === undefined ? undefined : this.subLayers.find((subLayer) => subLayer.id === id);\r\n }\r\n\r\n private hasInvisibleAncestors(subLayer?: MapSubLayerSettings): boolean {\r\n if (!subLayer || !subLayer.parent)\r\n return false;\r\n\r\n const parent = this.subLayerById(subLayer.parent);\r\n if (!parent)\r\n return false;\r\n\r\n // Visibility of named group has no impact on the visibility of children (only unnamed group does)\r\n // i.e For WMS, its should be possible to request a child layer when its parent is not visible (if the parent is also named)\r\n return (!parent.visible && !parent.isNamed) || this.hasInvisibleAncestors(parent);\r\n }\r\n\r\n /** Return true if sublayer is visible -- testing ancestors for visibility if they exist. */\r\n public isSubLayerVisible(subLayer: MapSubLayerSettings): boolean {\r\n if (!subLayer.visible)\r\n return false;\r\n\r\n return !this.hasInvisibleAncestors(subLayer);\r\n }\r\n\r\n /** Return true if all sublayers are visible. */\r\n public get allSubLayersInvisible(): boolean {\r\n if (this.subLayers.length === 0)\r\n return false;\r\n\r\n return this.subLayers.every((subLayer) => (subLayer.isUnnamedGroup || !this.isSubLayerVisible(subLayer)));\r\n }\r\n\r\n /** Return the children for a sublayer */\r\n public getSubLayerChildren(subLayer: MapSubLayerSettings): MapSubLayerSettings[] | undefined {\r\n if (!subLayer.children)\r\n return undefined;\r\n\r\n const children = new Array<MapSubLayerSettings>();\r\n subLayer.children.forEach((childId) => {\r\n const child = this.subLayerById(childId);\r\n if (child !== undefined)\r\n children.push(child);\r\n });\r\n\r\n return children;\r\n }\r\n}\r\n\r\n/** JSON representation of a [[BaseMapLayerSettings]].\r\n * @beta\r\n */\r\nexport interface BaseMapLayerProps extends MapLayerProps {\r\n provider?: BackgroundMapProviderProps;\r\n}\r\n\r\n/** A [[MapLayerSettings]] that can serve as the base layer for a [[MapImagerySettings]].\r\n * The base layer supports all of the same options as any other layer, but also allows for simplified configuration based\r\n * on a small set of known supported [[BackgroundMapProvider]]s like [Bing Maps](https://www.microsoft.com/en-us/maps).\r\n * If the base layer was configured from such a provider, that information will be preserved and can be queried; this allows\r\n * the imagery provider and/or type to be easily modified.\r\n * @see [[MapImagerySettings.backgroundBase]].\r\n * @beta\r\n */\r\nexport class BaseMapLayerSettings extends MapLayerSettings {\r\n private _provider?: BackgroundMapProvider;\r\n\r\n /** The provider from which this base layer was configured, if any. */\r\n public get provider(): BackgroundMapProvider | undefined { return this._provider; }\r\n\r\n /** Create a base layer from its JSON representation.\r\n * TODO: This, MapLayerSettings.fromJSON, and MapSubLayerSettings.fromJSON should never return undefined.\r\n * That means they should not accept undefined for props and should define props such that it fully describes the\r\n * layer - e.g., url and name must be defined.\r\n */\r\n public static override fromJSON(props: BaseMapLayerProps): BaseMapLayerSettings {\r\n const settings = super.fromJSON(props);\r\n assert(settings instanceof BaseMapLayerSettings);\r\n if (props.provider)\r\n settings._provider = BackgroundMapProvider.fromJSON(props.provider);\r\n\r\n return settings;\r\n }\r\n\r\n /** Convert this layer to its JSON representation. */\r\n public override toJSON(): BaseMapLayerProps {\r\n const props = super.toJSON() as BaseMapLayerProps;\r\n if (this.provider)\r\n props.provider = this.provider.toJSON();\r\n\r\n return props;\r\n }\r\n\r\n /** @internal */\r\n public override cloneProps(changedProps: Partial<MapLayerProps>): BaseMapLayerProps {\r\n const props = super.cloneProps(changedProps) as BaseMapLayerProps;\r\n if (this.provider)\r\n props.provider = this.provider.toJSON();\r\n\r\n return props;\r\n }\r\n\r\n /** Create a copy of this layer. */\r\n public override clone(changedProps: Partial<MapLayerProps>): BaseMapLayerSettings {\r\n const prevUrl = this.url;\r\n const clone = BaseMapLayerSettings.fromJSON(this.cloneProps(changedProps))!;\r\n\r\n if (this.provider && prevUrl !== this.url)\r\n clone._provider = undefined;\r\n\r\n return clone;\r\n }\r\n\r\n /** Create a base layer from a BackgroundMapProvider. */\r\n public static fromProvider(provider: BackgroundMapProvider, options?: { invisible?: boolean, transparency?: number }): BaseMapLayerSettings {\r\n let formatId: string, url: string, name: string;\r\n switch (provider.name) {\r\n case \"BingProvider\":\r\n default:\r\n formatId = \"BingMaps\";\r\n\r\n let imagerySet;\r\n switch (provider.type) {\r\n case BackgroundMapType.Street:\r\n imagerySet = \"Road\";\r\n break;\r\n case BackgroundMapType.Aerial:\r\n imagerySet = \"Aerial\";\r\n break;\r\n case BackgroundMapType.Hybrid:\r\n default:\r\n imagerySet = \"AerialWithLabels\";\r\n break;\r\n }\r\n name = `Bing Maps: ${MapLayerSettings.mapTypeName(provider.type)}`;\r\n url = `https://dev.virtualearth.net/REST/v1/Imagery/Metadata/${imagerySet}?o=json&incl=ImageryProviders&key={bingKey}`;\r\n break;\r\n\r\n case \"MapBoxProvider\":\r\n formatId = \"MapboxImagery\";\r\n name = `MapBox: ${MapLayerSettings.mapTypeName(provider.type)}`;\r\n switch (provider.type) {\r\n case BackgroundMapType.Street:\r\n url = \"https://api.mapbox.com/v4/mapbox.streets/\";\r\n break;\r\n case BackgroundMapType.Aerial:\r\n url = \"https://api.mapbox.com/v4/mapbox.satellite/\";\r\n break;\r\n case BackgroundMapType.Hybrid:\r\n url = \"https://api.mapbox.com/v4/mapbox.streets-satellite/\";\r\n break;\r\n }\r\n break;\r\n }\r\n\r\n const settings = super.fromJSON({\r\n name,\r\n formatId,\r\n url,\r\n transparentBackground: false,\r\n isBase: true,\r\n visible: !options?.invisible,\r\n transparency: options?.transparency,\r\n });\r\n\r\n assert(undefined !== settings);\r\n assert(settings instanceof BaseMapLayerSettings);\r\n\r\n settings._provider = provider;\r\n return settings;\r\n }\r\n\r\n /** @internal */\r\n public static fromBackgroundMapProps(props: DeprecatedBackgroundMapProps): BaseMapLayerSettings {\r\n return this.fromProvider(BackgroundMapProvider.fromBackgroundMapProps(props));\r\n }\r\n\r\n /** @alpha */\r\n public cloneWithProvider(provider: BackgroundMapProvider): BaseMapLayerSettings {\r\n return BaseMapLayerSettings.fromProvider(provider, { invisible: !this.visible, transparency: this.transparency });\r\n }\r\n}\r\n"]}
@@ -3,7 +3,6 @@
3
3
  */
4
4
  import { AccessToken, GuidString } from "@itwin/core-bentley";
5
5
  import { BriefcaseProps, LocalBriefcaseProps, RequestNewBriefcaseProps } from "./BriefcaseTypes";
6
- import { SessionProps } from "./SessionProps";
7
6
  /** @internal */
8
7
  export declare const nativeAppChannel = "nativeApp";
9
8
  /** @internal */
@@ -33,47 +32,14 @@ export declare enum OverriddenBy {
33
32
  */
34
33
  export interface NativeAppNotifications {
35
34
  notifyInternetConnectivityChanged(status: InternetConnectivityStatus): void;
36
- notifyAccessTokenChanged(accessToken: AccessToken): void;
37
- }
38
- /**
39
- * Client configuration to generate OIDC/OAuth tokens for native applications
40
- * @beta
41
- */
42
- export interface NativeAppAuthorizationConfiguration {
43
- /**
44
- * The OAuth token issuer URL. Defaults to Bentley's auth URL if undefined.
45
- */
46
- issuerUrl?: string;
47
- /**
48
- * Upon signing in, the client application receives a response from the Bentley IMS OIDC/OAuth2 provider at this URI
49
- * For mobile/desktop applications, must start with `http://localhost:${redirectPort}` or `https://localhost:${redirectPort}`
50
- */
51
- readonly redirectUri?: string;
52
- /** Client application's identifier as registered with the OIDC/OAuth2 provider. */
53
- readonly clientId: string;
54
- /** List of space separated scopes to request access to various resources. */
55
- readonly scope: string;
56
- /**
57
- * Time in seconds that's used as a buffer to check the token for validity/expiry.
58
- * The checks for authorization, and refreshing access tokens all use this buffer - i.e., the token is considered expired if the current time is within the specified
59
- * time of the actual expiry.
60
- * @note If unspecified this defaults to 10 minutes.
61
- */
62
- readonly expiryBuffer?: number;
63
35
  }
64
36
  /**
65
37
  * The methods that may be invoked via Ipc from the frontend of a Native App and are implemented on its backend.
66
38
  * @internal
67
39
  */
68
40
  export interface NativeAppFunctions {
69
- setAccessToken(token: AccessToken): Promise<void>;
70
- /** returns expirySafety, in seconds */
71
- initializeAuth(props: SessionProps, config?: NativeAppAuthorizationConfiguration): Promise<number>;
72
- /** Called to start the sign-in process. Subscribe to onAccessTokenChanged to be notified when sign-in completes */
73
- signIn(): Promise<void>;
74
- /** Called to start the sign-out process. Subscribe to onAccessTokenChanged to be notified when sign-out completes */
75
- signOut(): Promise<void>;
76
- getAccessToken: () => Promise<AccessToken>;
41
+ /** If the user is signed in a valid access token will be returned. */
42
+ getAccessToken: () => Promise<AccessToken | undefined>;
77
43
  /** Check if the internet is reachable. */
78
44
  checkInternetConnectivity(): Promise<InternetConnectivityStatus>;
79
45
  /** Manually override internet reachability for testing purposes.
@@ -1 +1 @@
1
- {"version":3,"file":"Native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,GAAG,kBAAkB,CAAC;AAQlD;;GAEG;AACH,IAAY,0BAGX;AAHD,WAAY,0BAA0B;IACpC,+EAAM,CAAA;IACN,iFAAO,CAAA;AACT,CAAC,EAHW,0BAA0B,GAA1B,kCAA0B,KAA1B,kCAA0B,QAGrC;AAED;;GAEG;AACH,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,qDAAO,CAAA;IACP,+CAAI,CAAA;AACN,CAAC,EAHW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAGvB","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 NativeApp\r\n */\r\n\r\nimport { AccessToken, GuidString } from \"@itwin/core-bentley\";\r\nimport { BriefcaseProps, LocalBriefcaseProps, RequestNewBriefcaseProps } from \"./BriefcaseTypes\";\r\nimport { SessionProps } from \"./SessionProps\";\r\n\r\n/** @internal */\r\nexport const nativeAppChannel = \"nativeApp\";\r\n/** @internal */\r\nexport const nativeAppNotify = \"nativeApp-notify\";\r\n\r\n/**\r\n * Type of value for storage values\r\n * @beta\r\n */\r\nexport type StorageValue = string | number | boolean | undefined | Uint8Array;\r\n\r\n/** Indicates whether or not the computer is currently connected to the internet.\r\n * @beta\r\n */\r\nexport enum InternetConnectivityStatus {\r\n Online,\r\n Offline,\r\n}\r\n\r\n/** Describes whether the user or the browser overrode the internet connectivity status.\r\n * @beta\r\n */\r\nexport enum OverriddenBy {\r\n Browser,\r\n User,\r\n}\r\n\r\n/**\r\n * Interface implemented by the frontend [NotificationHandler]($common) to be notified of events from NativeApp backend.\r\n * @internal\r\n */\r\nexport interface NativeAppNotifications {\r\n notifyInternetConnectivityChanged(status: InternetConnectivityStatus): void;\r\n notifyAccessTokenChanged(accessToken: AccessToken): void;\r\n}\r\n\r\n/**\r\n * Client configuration to generate OIDC/OAuth tokens for native applications\r\n * @beta\r\n */\r\nexport interface NativeAppAuthorizationConfiguration {\r\n /**\r\n * The OAuth token issuer URL. Defaults to Bentley's auth URL if undefined.\r\n */\r\n issuerUrl?: string;\r\n\r\n /**\r\n * Upon signing in, the client application receives a response from the Bentley IMS OIDC/OAuth2 provider at this URI\r\n * For mobile/desktop applications, must start with `http://localhost:${redirectPort}` or `https://localhost:${redirectPort}`\r\n */\r\n readonly redirectUri?: string;\r\n\r\n /** Client application's identifier as registered with the OIDC/OAuth2 provider. */\r\n readonly clientId: string;\r\n\r\n /** List of space separated scopes to request access to various resources. */\r\n readonly scope: string;\r\n\r\n /**\r\n * Time in seconds that's used as a buffer to check the token for validity/expiry.\r\n * The checks for authorization, and refreshing access tokens all use this buffer - i.e., the token is considered expired if the current time is within the specified\r\n * time of the actual expiry.\r\n * @note If unspecified this defaults to 10 minutes.\r\n */\r\n readonly expiryBuffer?: number;\r\n}\r\n\r\n/**\r\n * The methods that may be invoked via Ipc from the frontend of a Native App and are implemented on its backend.\r\n * @internal\r\n */\r\nexport interface NativeAppFunctions {\r\n setAccessToken(token: AccessToken): Promise<void>;\r\n\r\n /** returns expirySafety, in seconds */\r\n initializeAuth(props: SessionProps, config?: NativeAppAuthorizationConfiguration): Promise<number>;\r\n\r\n /** Called to start the sign-in process. Subscribe to onAccessTokenChanged to be notified when sign-in completes */\r\n signIn(): Promise<void>;\r\n\r\n /** Called to start the sign-out process. Subscribe to onAccessTokenChanged to be notified when sign-out completes */\r\n signOut(): Promise<void>;\r\n\r\n getAccessToken: () => Promise<AccessToken>;\r\n\r\n /** Check if the internet is reachable. */\r\n checkInternetConnectivity(): Promise<InternetConnectivityStatus>;\r\n\r\n /** Manually override internet reachability for testing purposes.\r\n * @param _status New status to set on backend.\r\n */\r\n overrideInternetConnectivity(_overriddenBy: OverriddenBy, _status: InternetConnectivityStatus): Promise<void>;\r\n\r\n /** Acquire a new BriefcaseId for the supplied iModelId from iModelHub */\r\n acquireNewBriefcaseId(_iModelId: GuidString): Promise<number>;\r\n\r\n /** Get the filename in the briefcase cache for the supplied BriefcaseId and iModelId.\r\n * @note this merely returns the full path fileName. It does not test for the existence of the file.\r\n */\r\n getBriefcaseFileName(_props: BriefcaseProps): Promise<string>;\r\n\r\n /** Download a briefcase file for the supplied briefcase properties. */\r\n downloadBriefcase(_requestProps: RequestNewBriefcaseProps, _reportProgress: boolean, _interval?: number): Promise<LocalBriefcaseProps>;\r\n\r\n /**\r\n * Cancels the previously requested download of a briefcase\r\n * @param _key Key to locate the briefcase in the disk cache\r\n * @note returns true if the cancel request was acknowledged. false otherwise\r\n */\r\n requestCancelDownloadBriefcase(_fileName: string): Promise<boolean>;\r\n\r\n /**\r\n * Delete a previously downloaded briefcase. The briefcase must be closed.\r\n * @param _fileName the Briefcase to delete\r\n */\r\n deleteBriefcaseFiles(_fileName: string): Promise<void>;\r\n\r\n /**\r\n * Gets a list of all briefcases that were previously downloaded to the system briefcase cache.\r\n * @note returns array of LocalBriefcaseProps.\r\n */\r\n getCachedBriefcases(_iModelId?: GuidString): Promise<LocalBriefcaseProps[]>;\r\n\r\n /**\r\n * Open a key/value pair base storage\r\n * @param _storageId string identifier of storage\r\n */\r\n storageMgrOpen(_storageId: string): Promise<string>;\r\n\r\n /**\r\n * Close a key/value pair base storage\r\n * @param _storageId string identifier of storage\r\n * @param _deleteOnClose delete the storage on close\r\n */\r\n storageMgrClose(_storageId: string, _deleteOnClose: boolean): Promise<void>;\r\n\r\n /**\r\n * Get the names of available storages\r\n * @note returns list of storage names\r\n */\r\n storageMgrNames(): Promise<string[]>;\r\n\r\n /**\r\n * Get the value associated with a key.\r\n * @param _storageId string identifier of storage\r\n * @param _key key identifier for value\r\n * @note returns key value or undefined\r\n */\r\n storageGet(_storageId: string, _key: string): Promise<StorageValue | undefined>;\r\n\r\n /**\r\n * Set a value for a key.\r\n * @param _storageId string identifier of storage\r\n * @param _key key identifier for value\r\n * @param _value value to be set\r\n */\r\n storageSet(_storageId: string, _key: string, _value: StorageValue): Promise<void>;\r\n\r\n /**\r\n * Remove a key/value pair.\r\n * @param _storageId string identifier of storage\r\n * @param _key key identifier for value\r\n */\r\n storageRemove(_storageId: string, _key: string): Promise<void>;\r\n\r\n /**\r\n * Get list of keys in a storage.\r\n * @param _storageId string identifier of storage\r\n * @note returns list of storage ids\r\n */\r\n storageKeys(_storageId: string): Promise<string[]>;\r\n\r\n /**\r\n * Delete all key/value pairs.\r\n * @param _storageId string identifier of storage\r\n */\r\n storageRemoveAll(_storageId: string): Promise<void>;\r\n\r\n /** get the type of a value for a key, or undefined if not present. */\r\n storageGetValueType(_storageId: string, _key: string): Promise<\"number\" | \"string\" | \"boolean\" | \"Uint8Array\" | \"null\" | undefined>;\r\n}\r\n"]}
1
+ {"version":3,"file":"NativeAppProps.js","sourceRoot":"","sources":["../../src/NativeAppProps.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAKH,gBAAgB;AACH,QAAA,gBAAgB,GAAG,WAAW,CAAC;AAC5C,gBAAgB;AACH,QAAA,eAAe,GAAG,kBAAkB,CAAC;AAQlD;;GAEG;AACH,IAAY,0BAGX;AAHD,WAAY,0BAA0B;IACpC,+EAAM,CAAA;IACN,iFAAO,CAAA;AACT,CAAC,EAHW,0BAA0B,GAA1B,kCAA0B,KAA1B,kCAA0B,QAGrC;AAED;;GAEG;AACH,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,qDAAO,CAAA;IACP,+CAAI,CAAA;AACN,CAAC,EAHW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAGvB","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 NativeApp\r\n */\r\n\r\nimport { AccessToken, GuidString } from \"@itwin/core-bentley\";\r\nimport { BriefcaseProps, LocalBriefcaseProps, RequestNewBriefcaseProps } from \"./BriefcaseTypes\";\r\n\r\n/** @internal */\r\nexport const nativeAppChannel = \"nativeApp\";\r\n/** @internal */\r\nexport const nativeAppNotify = \"nativeApp-notify\";\r\n\r\n/**\r\n * Type of value for storage values\r\n * @beta\r\n */\r\nexport type StorageValue = string | number | boolean | undefined | Uint8Array;\r\n\r\n/** Indicates whether or not the computer is currently connected to the internet.\r\n * @beta\r\n */\r\nexport enum InternetConnectivityStatus {\r\n Online,\r\n Offline,\r\n}\r\n\r\n/** Describes whether the user or the browser overrode the internet connectivity status.\r\n * @beta\r\n */\r\nexport enum OverriddenBy {\r\n Browser,\r\n User,\r\n}\r\n\r\n/**\r\n * Interface implemented by the frontend [NotificationHandler]($common) to be notified of events from NativeApp backend.\r\n * @internal\r\n */\r\nexport interface NativeAppNotifications {\r\n notifyInternetConnectivityChanged(status: InternetConnectivityStatus): void;\r\n}\r\n\r\n/**\r\n * The methods that may be invoked via Ipc from the frontend of a Native App and are implemented on its backend.\r\n * @internal\r\n */\r\nexport interface NativeAppFunctions {\r\n\r\n /** If the user is signed in a valid access token will be returned. */\r\n getAccessToken: () => Promise<AccessToken | undefined>;\r\n\r\n /** Check if the internet is reachable. */\r\n checkInternetConnectivity(): Promise<InternetConnectivityStatus>;\r\n\r\n /** Manually override internet reachability for testing purposes.\r\n * @param _status New status to set on backend.\r\n */\r\n overrideInternetConnectivity(_overriddenBy: OverriddenBy, _status: InternetConnectivityStatus): Promise<void>;\r\n\r\n /** Acquire a new BriefcaseId for the supplied iModelId from iModelHub */\r\n acquireNewBriefcaseId(_iModelId: GuidString): Promise<number>;\r\n\r\n /** Get the filename in the briefcase cache for the supplied BriefcaseId and iModelId.\r\n * @note this merely returns the full path fileName. It does not test for the existence of the file.\r\n */\r\n getBriefcaseFileName(_props: BriefcaseProps): Promise<string>;\r\n\r\n /** Download a briefcase file for the supplied briefcase properties. */\r\n downloadBriefcase(_requestProps: RequestNewBriefcaseProps, _reportProgress: boolean, _interval?: number): Promise<LocalBriefcaseProps>;\r\n\r\n /**\r\n * Cancels the previously requested download of a briefcase\r\n * @param _key Key to locate the briefcase in the disk cache\r\n * @note returns true if the cancel request was acknowledged. false otherwise\r\n */\r\n requestCancelDownloadBriefcase(_fileName: string): Promise<boolean>;\r\n\r\n /**\r\n * Delete a previously downloaded briefcase. The briefcase must be closed.\r\n * @param _fileName the Briefcase to delete\r\n */\r\n deleteBriefcaseFiles(_fileName: string): Promise<void>;\r\n\r\n /**\r\n * Gets a list of all briefcases that were previously downloaded to the system briefcase cache.\r\n * @note returns array of LocalBriefcaseProps.\r\n */\r\n getCachedBriefcases(_iModelId?: GuidString): Promise<LocalBriefcaseProps[]>;\r\n\r\n /**\r\n * Open a key/value pair base storage\r\n * @param _storageId string identifier of storage\r\n */\r\n storageMgrOpen(_storageId: string): Promise<string>;\r\n\r\n /**\r\n * Close a key/value pair base storage\r\n * @param _storageId string identifier of storage\r\n * @param _deleteOnClose delete the storage on close\r\n */\r\n storageMgrClose(_storageId: string, _deleteOnClose: boolean): Promise<void>;\r\n\r\n /**\r\n * Get the names of available storages\r\n * @note returns list of storage names\r\n */\r\n storageMgrNames(): Promise<string[]>;\r\n\r\n /**\r\n * Get the value associated with a key.\r\n * @param _storageId string identifier of storage\r\n * @param _key key identifier for value\r\n * @note returns key value or undefined\r\n */\r\n storageGet(_storageId: string, _key: string): Promise<StorageValue | undefined>;\r\n\r\n /**\r\n * Set a value for a key.\r\n * @param _storageId string identifier of storage\r\n * @param _key key identifier for value\r\n * @param _value value to be set\r\n */\r\n storageSet(_storageId: string, _key: string, _value: StorageValue): Promise<void>;\r\n\r\n /**\r\n * Remove a key/value pair.\r\n * @param _storageId string identifier of storage\r\n * @param _key key identifier for value\r\n */\r\n storageRemove(_storageId: string, _key: string): Promise<void>;\r\n\r\n /**\r\n * Get list of keys in a storage.\r\n * @param _storageId string identifier of storage\r\n * @note returns list of storage ids\r\n */\r\n storageKeys(_storageId: string): Promise<string[]>;\r\n\r\n /**\r\n * Delete all key/value pairs.\r\n * @param _storageId string identifier of storage\r\n */\r\n storageRemoveAll(_storageId: string): Promise<void>;\r\n\r\n /** get the type of a value for a key, or undefined if not present. */\r\n storageGetValueType(_storageId: string, _key: string): Promise<\"number\" | \"string\" | \"boolean\" | \"Uint8Array\" | \"null\" | undefined>;\r\n}\r\n"]}
@@ -51,6 +51,75 @@ export interface PlanarClipMaskProps {
51
51
  priority?: number;
52
52
  /** @see [[PlanarClipMaskSettings.transparency]]. */
53
53
  transparency?: number;
54
+ /** @see PlanarClipMaskSettings.invert */
55
+ invert?: boolean;
56
+ }
57
+ /** Basic arguments supplied to [[PlanarClipMaskSettings.create]].
58
+ * @public
59
+ */
60
+ export interface BasicPlanarClipMaskArgs {
61
+ /** @see [[PlanarClipMaskSettings.transparency]]. */
62
+ transparency?: number;
63
+ /** @see [[PlanarClipMaskSettings.invert]]. */
64
+ invert?: boolean;
65
+ }
66
+ /** Arguments supplied to [[PlanarClipMaskSettings.create]] to create a mask of [[PlanarClipMaskMode.Models]].
67
+ * @public
68
+ */
69
+ export interface ModelPlanarClipMaskArgs extends BasicPlanarClipMaskArgs {
70
+ /** @see [[PlanarClipMaskSettings.modelIds]]. */
71
+ modelIds?: Iterable<Id64String>;
72
+ /** @internal */
73
+ exclude?: never;
74
+ /** @internal */
75
+ elementIds?: never;
76
+ /** @internal */
77
+ subCategoryIds?: never;
78
+ /** @internal */
79
+ priority?: never;
80
+ }
81
+ /** Arguments supplied to [[PlanarClipMaskSettings.create]] to create a mask of [[PlanarClipMaskMode.IncludeElements]] or [[PlanarClipMaskMode.ExcludeElements]].
82
+ * @public
83
+ */
84
+ export interface ElementPlanarClipMaskArgs extends BasicPlanarClipMaskArgs {
85
+ /** @see [[PlanarClipMaskSettings.modelIds]]. */
86
+ modelIds?: Iterable<Id64String>;
87
+ /** The elements used by the mask. @see [[PlanarClipMaskSettings.subCategoryOrElementIds]]. */
88
+ elementIds: Iterable<Id64String>;
89
+ /** If true, creates a mask of [[PlanarClipMaskMode.ExcludeElements]]; otherwise, [[PlanarClipMaskMode.IncludeElements]]. */
90
+ exclude?: boolean;
91
+ /** @internal */
92
+ subCategoryIds?: never;
93
+ /** @internal */
94
+ priority?: never;
95
+ }
96
+ /** Arguments supplied to [[PlanarClipMaskSettings.create]] to create a mask of [[PlanarClipMaskMode.IncludeSubCategories]].
97
+ * @public
98
+ */
99
+ export interface SubCategoryPlanarClipMaskArgs extends BasicPlanarClipMaskArgs {
100
+ /** @see [[PlanarClipMaskSettings.modelIds]]. */
101
+ modelIds?: Iterable<Id64String>;
102
+ /** The subcategories used by the mask. @see [[PlanarClipMaskSettings.subCategoryOrElementIds]]. */
103
+ subCategoryIds: Iterable<Id64String>;
104
+ /** @internal */
105
+ exclude?: never;
106
+ /** @internal */
107
+ elementIds?: never;
108
+ /** @internal */
109
+ priority?: never;
110
+ }
111
+ /** Arguments supplied to [[PlanarClipMaskSettings.create]] to create a mask of [[PlanarClipMaskMode.Priority]].
112
+ * @public
113
+ */
114
+ export interface PriorityPlanarClipMaskArgs extends BasicPlanarClipMaskArgs {
115
+ /** @see [[PlanarClipMaskSettings.priority]]. */
116
+ priority: number;
117
+ /** @internal */
118
+ exclude?: never;
119
+ /** @internal */
120
+ elementIds?: never;
121
+ /** @internal */
122
+ modelIds?: never;
54
123
  }
55
124
  /** Describes how to mask the geometry of one [GeometricModel]($backend) for display. The mask is produced by projecting geometry from any number of other models -
56
125
  * optionally filtered by [SubCategory]($backend) or by a set of specific [GeometricElement]($backend)s - onto a plane. Regions of the masked model that intersect the
@@ -79,20 +148,16 @@ export declare class PlanarClipMaskSettings {
79
148
  If no transparency is defined then the transparencies of the mask elements are used.
80
149
  */
81
150
  readonly transparency?: number;
151
+ /** A value of true indicates that the mask should be inverted and only content within the mask should be displayed, in other words the area inside the mask is displayed rather than outside. */
152
+ readonly invert: boolean;
82
153
  private readonly _modelIds?;
83
154
  private readonly _subCategoryOrElementIds?;
84
155
  /** The compressed representation of [[modelIds]]. */
85
156
  get compressedModelIds(): CompressedId64Set | undefined;
86
157
  /** Create a new [[PlanarClipMaskSettings]] object from its JSON representation. */
87
158
  static fromJSON(json?: PlanarClipMaskProps): PlanarClipMaskSettings;
88
- /** Create settings for [[PlanarClipMaskMode.Models]]. */
89
- static createForModels(modelIds: Iterable<Id64String> | undefined, transparency?: number): PlanarClipMaskSettings;
90
- /** Create settings that filter by element or subcategory. */
91
- static createForElementsOrSubCategories(mode: PlanarClipMaskMode.IncludeElements | PlanarClipMaskMode.ExcludeElements | PlanarClipMaskMode.IncludeSubCategories, elementOrSubCategoryIds: Iterable<Id64String>, modelIds?: Iterable<Id64String>, transparency?: number): PlanarClipMaskSettings;
92
- /** Create settings that mask by priority.
93
- * @see [[PlanarClipMaskPriority]] for default priority values based on model type.
94
- */
95
- static createByPriority(priority: number, transparency?: number): PlanarClipMaskSettings;
159
+ /** Create a new PlanarClipMaskSettings. */
160
+ static create(args: ModelPlanarClipMaskArgs | ElementPlanarClipMaskArgs | SubCategoryPlanarClipMaskArgs | PriorityPlanarClipMaskArgs): PlanarClipMaskSettings;
96
161
  /** Create JSON object representing this [[PlanarClipMaskSettings]] */
97
162
  toJSON(): PlanarClipMaskProps;
98
163
  /** Returns true if masking is enabled. */
@@ -1 +1 @@
1
- {"version":3,"file":"PlanarClipMask.d.ts","sourceRoot":"","sources":["../../src/PlanarClipMask.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAEzF;;GAEG;AACH,oBAAY,kBAAkB;IAC5B,kBAAkB;IAClB,IAAI,IAAI;IACR;;;OAGG;IACH,QAAQ,IAAI;IACZ,yGAAyG;IACzG,MAAM,IAAI;IACV,iGAAiG;IACjG,oBAAoB,IAAI;IACxB,2GAA2G;IAC3G,eAAe,IAAI;IACnB,qKAAqK;IACrK,eAAe,IAAI;CACpB;AAED;;;GAGG;AACH,oBAAY,sBAAsB;IAChC,sBAAsB;IACt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AAM,IAAI,mBAAmB;IAoBpC,0CAA0C;IAC1C,IAAW,OAAO,IAAI,OAAO,CAE5B;IAEM,MAAM,CAAC,KAAK,EAAE,sBAAsB,GAAG,OAAO;IASrD;;;OAGG;IACI,KAAK,CAAC,YAAY,CAAC,EAAE,mBAAmB,GAAG,sBAAsB;IAUxE,OAAO;IAeP,oDAAoD;IACpD,OAAc,QAAQ,yBAAuD;CAC9E"}
@@ -55,11 +55,12 @@ var PlanarClipMaskPriority;
55
55
  * @public
56
56
  */
57
57
  class PlanarClipMaskSettings {
58
- constructor(mode, transparency, modelIds, subCategoryOrElementIds, priority) {
58
+ constructor(mode, transparency, modelIds, subCategoryOrElementIds, priority, invert) {
59
59
  this.mode = mode;
60
60
  this._modelIds = modelIds;
61
61
  this._subCategoryOrElementIds = subCategoryOrElementIds;
62
62
  this.priority = priority;
63
+ this.invert = true === invert;
63
64
  this.transparency = undefined !== transparency ? Math.max(0, Math.min(1, transparency)) : undefined;
64
65
  if (modelIds)
65
66
  this.modelIds = core_bentley_1.CompressedId64Set.iterable(modelIds);
@@ -74,30 +75,19 @@ class PlanarClipMaskSettings {
74
75
  static fromJSON(json) {
75
76
  if (!json || undefined === json.mode)
76
77
  return this.defaults;
77
- return new PlanarClipMaskSettings(json.mode, json.transparency, json.modelIds, json.subCategoryOrElementIds, json.priority);
78
+ return new PlanarClipMaskSettings(json.mode, json.transparency, json.modelIds, json.subCategoryOrElementIds, json.priority, json.invert);
78
79
  }
79
- /** Create settings for [[PlanarClipMaskMode.Models]]. */
80
- static createForModels(modelIds, transparency) {
81
- return this.fromJSON({
82
- mode: PlanarClipMaskMode.Models,
83
- transparency,
84
- modelIds: modelIds ? core_bentley_1.CompressedId64Set.sortAndCompress(modelIds) : undefined,
85
- });
86
- }
87
- /** Create settings that filter by element or subcategory. */
88
- static createForElementsOrSubCategories(mode, elementOrSubCategoryIds, modelIds, transparency) {
89
- return this.fromJSON({
90
- mode,
91
- transparency,
92
- modelIds: modelIds ? core_bentley_1.CompressedId64Set.sortAndCompress(modelIds) : undefined,
93
- subCategoryOrElementIds: core_bentley_1.CompressedId64Set.sortAndCompress(elementOrSubCategoryIds),
94
- });
95
- }
96
- /** Create settings that mask by priority.
97
- * @see [[PlanarClipMaskPriority]] for default priority values based on model type.
98
- */
99
- static createByPriority(priority, transparency) {
100
- return new PlanarClipMaskSettings(PlanarClipMaskMode.Priority, transparency, undefined, undefined, priority);
80
+ /** Create a new PlanarClipMaskSettings. */
81
+ static create(args) {
82
+ const modelIds = args.modelIds ? core_bentley_1.CompressedId64Set.sortAndCompress(args.modelIds) : undefined;
83
+ if (undefined !== args.priority)
84
+ return new PlanarClipMaskSettings(PlanarClipMaskMode.Priority, args.transparency, undefined, undefined, args.priority, args.invert);
85
+ else if (undefined !== args.subCategoryIds)
86
+ return new PlanarClipMaskSettings(PlanarClipMaskMode.IncludeSubCategories, args.transparency, modelIds, core_bentley_1.CompressedId64Set.sortAndCompress(args.subCategoryIds), undefined, args.invert);
87
+ else if (undefined !== args.elementIds)
88
+ return new PlanarClipMaskSettings(args.exclude ? PlanarClipMaskMode.ExcludeElements : PlanarClipMaskMode.IncludeElements, args.transparency, modelIds, core_bentley_1.CompressedId64Set.sortAndCompress(args.elementIds), undefined, args.invert);
89
+ else
90
+ return new PlanarClipMaskSettings(PlanarClipMaskMode.Models, args.transparency, modelIds, undefined, undefined, args.invert);
101
91
  }
102
92
  /** Create JSON object representing this [[PlanarClipMaskSettings]] */
103
93
  toJSON() {
@@ -110,6 +100,8 @@ class PlanarClipMaskSettings {
110
100
  props.priority = this.priority;
111
101
  if (undefined !== this.transparency)
112
102
  props.transparency = this.transparency;
103
+ if (this.invert)
104
+ props.invert = true;
113
105
  return props;
114
106
  }
115
107
  /** Returns true if masking is enabled. */
@@ -120,6 +112,7 @@ class PlanarClipMaskSettings {
120
112
  return this.mode === other.mode &&
121
113
  this.priority === other.priority &&
122
114
  this.transparency === other.transparency &&
115
+ this.invert === other.invert &&
123
116
  this._modelIds === other._modelIds &&
124
117
  this._subCategoryOrElementIds === other._subCategoryOrElementIds;
125
118
  }