@itwin/map-layers 4.0.0-dev.41 → 4.0.0-dev.47

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 (193) hide show
  1. package/CHANGELOG.md +864 -864
  2. package/README.md +32 -32
  3. package/lib/cjs/MapLayerPreferences.d.ts +88 -88
  4. package/lib/cjs/MapLayerPreferences.js +311 -311
  5. package/lib/cjs/MapLayerPreferences.js.map +1 -1
  6. package/lib/cjs/map-layers.d.ts +6 -6
  7. package/lib/cjs/map-layers.js +22 -22
  8. package/lib/cjs/mapLayers.d.ts +26 -44
  9. package/lib/cjs/mapLayers.d.ts.map +1 -1
  10. package/lib/cjs/mapLayers.js +33 -61
  11. package/lib/cjs/mapLayers.js.map +1 -1
  12. package/lib/cjs/ui/FeatureInfoUiItemsProvider.d.ts +16 -11
  13. package/lib/cjs/ui/FeatureInfoUiItemsProvider.d.ts.map +1 -1
  14. package/lib/cjs/ui/FeatureInfoUiItemsProvider.js +46 -51
  15. package/lib/cjs/ui/FeatureInfoUiItemsProvider.js.map +1 -1
  16. package/lib/cjs/ui/Interfaces.d.ts +50 -50
  17. package/lib/cjs/ui/Interfaces.js +2 -2
  18. package/lib/cjs/ui/Interfaces.js.map +1 -1
  19. package/lib/cjs/ui/MapFeatureInfoTool.d.ts +13 -13
  20. package/lib/cjs/ui/MapFeatureInfoTool.js +50 -50
  21. package/lib/cjs/ui/MapFeatureInfoTool.js.map +1 -1
  22. package/lib/cjs/ui/MapLayersUiItemsProvider.d.ts +8 -8
  23. package/lib/cjs/ui/MapLayersUiItemsProvider.d.ts.map +1 -1
  24. package/lib/cjs/ui/MapLayersUiItemsProvider.js +35 -38
  25. package/lib/cjs/ui/MapLayersUiItemsProvider.js.map +1 -1
  26. package/lib/cjs/ui/widget/AttachLayerPopupButton.d.ts +13 -14
  27. package/lib/cjs/ui/widget/AttachLayerPopupButton.d.ts.map +1 -1
  28. package/lib/cjs/ui/widget/AttachLayerPopupButton.js +335 -335
  29. package/lib/cjs/ui/widget/BasemapPanel.d.ts +7 -8
  30. package/lib/cjs/ui/widget/BasemapPanel.d.ts.map +1 -1
  31. package/lib/cjs/ui/widget/BasemapPanel.js +156 -156
  32. package/lib/cjs/ui/widget/BasemapPanel.js.map +1 -1
  33. package/lib/cjs/ui/widget/BasemapPanel.scss +87 -87
  34. package/lib/cjs/ui/widget/ConfirmMessageDialog.d.ts +20 -21
  35. package/lib/cjs/ui/widget/ConfirmMessageDialog.d.ts.map +1 -1
  36. package/lib/cjs/ui/widget/ConfirmMessageDialog.js +22 -22
  37. package/lib/cjs/ui/widget/ConfirmMessageDialog.js.map +1 -1
  38. package/lib/cjs/ui/widget/FeatureInfoDataProvider.d.ts +40 -40
  39. package/lib/cjs/ui/widget/FeatureInfoDataProvider.js +138 -138
  40. package/lib/cjs/ui/widget/FeatureInfoDataProvider.js.map +1 -1
  41. package/lib/cjs/ui/widget/FeatureInfoWidget.d.ts +6 -7
  42. package/lib/cjs/ui/widget/FeatureInfoWidget.d.ts.map +1 -1
  43. package/lib/cjs/ui/widget/FeatureInfoWidget.js +65 -65
  44. package/lib/cjs/ui/widget/FeatureInfoWidget.js.map +1 -1
  45. package/lib/cjs/ui/widget/MapLayerDroppable.d.ts +18 -19
  46. package/lib/cjs/ui/widget/MapLayerDroppable.d.ts.map +1 -1
  47. package/lib/cjs/ui/widget/MapLayerDroppable.js +85 -85
  48. package/lib/cjs/ui/widget/MapLayerDroppable.js.map +1 -1
  49. package/lib/cjs/ui/widget/MapLayerManager.d.ts +26 -26
  50. package/lib/cjs/ui/widget/MapLayerManager.js +401 -401
  51. package/lib/cjs/ui/widget/MapLayerManager.js.map +1 -1
  52. package/lib/cjs/ui/widget/MapLayerManager.scss +409 -409
  53. package/lib/cjs/ui/widget/MapLayerSettingsMenu.d.ts +11 -12
  54. package/lib/cjs/ui/widget/MapLayerSettingsMenu.d.ts.map +1 -1
  55. package/lib/cjs/ui/widget/MapLayerSettingsMenu.js +82 -82
  56. package/lib/cjs/ui/widget/MapLayerSettingsMenu.js.map +1 -1
  57. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.d.ts +6 -7
  58. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.d.ts.map +1 -1
  59. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.js +65 -65
  60. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.js.map +1 -1
  61. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.scss +20 -20
  62. package/lib/cjs/ui/widget/MapLayersWidget.d.ts +10 -11
  63. package/lib/cjs/ui/widget/MapLayersWidget.d.ts.map +1 -1
  64. package/lib/cjs/ui/widget/MapLayersWidget.js +31 -31
  65. package/lib/cjs/ui/widget/MapLayersWidget.js.map +1 -1
  66. package/lib/cjs/ui/widget/MapManagerSettings.d.ts +2 -3
  67. package/lib/cjs/ui/widget/MapManagerSettings.d.ts.map +1 -1
  68. package/lib/cjs/ui/widget/MapManagerSettings.js +200 -200
  69. package/lib/cjs/ui/widget/MapManagerSettings.js.map +1 -1
  70. package/lib/cjs/ui/widget/MapManagerSettings.scss +29 -29
  71. package/lib/cjs/ui/widget/MapUrlDialog.d.ts +22 -23
  72. package/lib/cjs/ui/widget/MapUrlDialog.d.ts.map +1 -1
  73. package/lib/cjs/ui/widget/MapUrlDialog.js +530 -530
  74. package/lib/cjs/ui/widget/MapUrlDialog.js.map +1 -1
  75. package/lib/cjs/ui/widget/MapUrlDialog.scss +99 -100
  76. package/lib/cjs/ui/widget/SelectMapFormat.d.ts +17 -18
  77. package/lib/cjs/ui/widget/SelectMapFormat.d.ts.map +1 -1
  78. package/lib/cjs/ui/widget/SelectMapFormat.js +54 -54
  79. package/lib/cjs/ui/widget/SelectMapFormat.js.map +1 -1
  80. package/lib/cjs/ui/widget/SubLayersDataProvider.d.ts +18 -20
  81. package/lib/cjs/ui/widget/SubLayersDataProvider.d.ts.map +1 -1
  82. package/lib/cjs/ui/widget/SubLayersDataProvider.js +74 -75
  83. package/lib/cjs/ui/widget/SubLayersDataProvider.js.map +1 -1
  84. package/lib/cjs/ui/widget/SubLayersPopupButton.d.ts +9 -10
  85. package/lib/cjs/ui/widget/SubLayersPopupButton.d.ts.map +1 -1
  86. package/lib/cjs/ui/widget/SubLayersPopupButton.js +40 -40
  87. package/lib/cjs/ui/widget/SubLayersPopupButton.js.map +1 -1
  88. package/lib/cjs/ui/widget/SubLayersTree.d.ts +14 -15
  89. package/lib/cjs/ui/widget/SubLayersTree.d.ts.map +1 -1
  90. package/lib/cjs/ui/widget/SubLayersTree.js +413 -413
  91. package/lib/cjs/ui/widget/SubLayersTree.js.map +1 -1
  92. package/lib/cjs/ui/widget/SubLayersTree.scss +69 -69
  93. package/lib/cjs/ui/widget/TransparencyPopupButton.d.ts +13 -14
  94. package/lib/cjs/ui/widget/TransparencyPopupButton.d.ts.map +1 -1
  95. package/lib/cjs/ui/widget/TransparencyPopupButton.js +47 -47
  96. package/lib/cjs/ui/widget/TransparencyPopupButton.js.map +1 -1
  97. package/lib/cjs/ui/widget/TransparencyPopupButton.scss +35 -36
  98. package/lib/esm/MapLayerPreferences.d.ts +88 -88
  99. package/lib/esm/MapLayerPreferences.js +307 -307
  100. package/lib/esm/MapLayerPreferences.js.map +1 -1
  101. package/lib/esm/map-layers.d.ts +6 -6
  102. package/lib/esm/map-layers.js +10 -10
  103. package/lib/esm/mapLayers.d.ts +26 -44
  104. package/lib/esm/mapLayers.d.ts.map +1 -1
  105. package/lib/esm/mapLayers.js +29 -57
  106. package/lib/esm/mapLayers.js.map +1 -1
  107. package/lib/esm/ui/FeatureInfoUiItemsProvider.d.ts +16 -11
  108. package/lib/esm/ui/FeatureInfoUiItemsProvider.d.ts.map +1 -1
  109. package/lib/esm/ui/FeatureInfoUiItemsProvider.js +42 -47
  110. package/lib/esm/ui/FeatureInfoUiItemsProvider.js.map +1 -1
  111. package/lib/esm/ui/Interfaces.d.ts +50 -50
  112. package/lib/esm/ui/Interfaces.js +1 -1
  113. package/lib/esm/ui/Interfaces.js.map +1 -1
  114. package/lib/esm/ui/MapFeatureInfoTool.d.ts +13 -13
  115. package/lib/esm/ui/MapFeatureInfoTool.js +45 -45
  116. package/lib/esm/ui/MapFeatureInfoTool.js.map +1 -1
  117. package/lib/esm/ui/MapLayersUiItemsProvider.d.ts +8 -8
  118. package/lib/esm/ui/MapLayersUiItemsProvider.d.ts.map +1 -1
  119. package/lib/esm/ui/MapLayersUiItemsProvider.js +31 -34
  120. package/lib/esm/ui/MapLayersUiItemsProvider.js.map +1 -1
  121. package/lib/esm/ui/widget/AttachLayerPopupButton.d.ts +13 -14
  122. package/lib/esm/ui/widget/AttachLayerPopupButton.d.ts.map +1 -1
  123. package/lib/esm/ui/widget/AttachLayerPopupButton.js +331 -331
  124. package/lib/esm/ui/widget/BasemapPanel.d.ts +7 -8
  125. package/lib/esm/ui/widget/BasemapPanel.d.ts.map +1 -1
  126. package/lib/esm/ui/widget/BasemapPanel.js +152 -152
  127. package/lib/esm/ui/widget/BasemapPanel.js.map +1 -1
  128. package/lib/esm/ui/widget/BasemapPanel.scss +87 -87
  129. package/lib/esm/ui/widget/ConfirmMessageDialog.d.ts +20 -21
  130. package/lib/esm/ui/widget/ConfirmMessageDialog.d.ts.map +1 -1
  131. package/lib/esm/ui/widget/ConfirmMessageDialog.js +18 -18
  132. package/lib/esm/ui/widget/ConfirmMessageDialog.js.map +1 -1
  133. package/lib/esm/ui/widget/FeatureInfoDataProvider.d.ts +40 -40
  134. package/lib/esm/ui/widget/FeatureInfoDataProvider.js +134 -134
  135. package/lib/esm/ui/widget/FeatureInfoDataProvider.js.map +1 -1
  136. package/lib/esm/ui/widget/FeatureInfoWidget.d.ts +6 -7
  137. package/lib/esm/ui/widget/FeatureInfoWidget.d.ts.map +1 -1
  138. package/lib/esm/ui/widget/FeatureInfoWidget.js +61 -61
  139. package/lib/esm/ui/widget/FeatureInfoWidget.js.map +1 -1
  140. package/lib/esm/ui/widget/MapLayerDroppable.d.ts +18 -19
  141. package/lib/esm/ui/widget/MapLayerDroppable.d.ts.map +1 -1
  142. package/lib/esm/ui/widget/MapLayerDroppable.js +81 -81
  143. package/lib/esm/ui/widget/MapLayerDroppable.js.map +1 -1
  144. package/lib/esm/ui/widget/MapLayerManager.d.ts +26 -26
  145. package/lib/esm/ui/widget/MapLayerManager.js +396 -396
  146. package/lib/esm/ui/widget/MapLayerManager.js.map +1 -1
  147. package/lib/esm/ui/widget/MapLayerManager.scss +409 -409
  148. package/lib/esm/ui/widget/MapLayerSettingsMenu.d.ts +11 -12
  149. package/lib/esm/ui/widget/MapLayerSettingsMenu.d.ts.map +1 -1
  150. package/lib/esm/ui/widget/MapLayerSettingsMenu.js +78 -78
  151. package/lib/esm/ui/widget/MapLayerSettingsMenu.js.map +1 -1
  152. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.d.ts +6 -7
  153. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.d.ts.map +1 -1
  154. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.js +61 -61
  155. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.js.map +1 -1
  156. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.scss +20 -20
  157. package/lib/esm/ui/widget/MapLayersWidget.d.ts +10 -11
  158. package/lib/esm/ui/widget/MapLayersWidget.d.ts.map +1 -1
  159. package/lib/esm/ui/widget/MapLayersWidget.js +27 -27
  160. package/lib/esm/ui/widget/MapLayersWidget.js.map +1 -1
  161. package/lib/esm/ui/widget/MapManagerSettings.d.ts +2 -3
  162. package/lib/esm/ui/widget/MapManagerSettings.d.ts.map +1 -1
  163. package/lib/esm/ui/widget/MapManagerSettings.js +196 -196
  164. package/lib/esm/ui/widget/MapManagerSettings.js.map +1 -1
  165. package/lib/esm/ui/widget/MapManagerSettings.scss +29 -29
  166. package/lib/esm/ui/widget/MapUrlDialog.d.ts +22 -23
  167. package/lib/esm/ui/widget/MapUrlDialog.d.ts.map +1 -1
  168. package/lib/esm/ui/widget/MapUrlDialog.js +526 -526
  169. package/lib/esm/ui/widget/MapUrlDialog.js.map +1 -1
  170. package/lib/esm/ui/widget/MapUrlDialog.scss +99 -100
  171. package/lib/esm/ui/widget/SelectMapFormat.d.ts +17 -18
  172. package/lib/esm/ui/widget/SelectMapFormat.d.ts.map +1 -1
  173. package/lib/esm/ui/widget/SelectMapFormat.js +50 -50
  174. package/lib/esm/ui/widget/SelectMapFormat.js.map +1 -1
  175. package/lib/esm/ui/widget/SubLayersDataProvider.d.ts +18 -20
  176. package/lib/esm/ui/widget/SubLayersDataProvider.d.ts.map +1 -1
  177. package/lib/esm/ui/widget/SubLayersDataProvider.js +70 -71
  178. package/lib/esm/ui/widget/SubLayersDataProvider.js.map +1 -1
  179. package/lib/esm/ui/widget/SubLayersPopupButton.d.ts +9 -10
  180. package/lib/esm/ui/widget/SubLayersPopupButton.d.ts.map +1 -1
  181. package/lib/esm/ui/widget/SubLayersPopupButton.js +36 -36
  182. package/lib/esm/ui/widget/SubLayersPopupButton.js.map +1 -1
  183. package/lib/esm/ui/widget/SubLayersTree.d.ts +14 -15
  184. package/lib/esm/ui/widget/SubLayersTree.d.ts.map +1 -1
  185. package/lib/esm/ui/widget/SubLayersTree.js +408 -408
  186. package/lib/esm/ui/widget/SubLayersTree.js.map +1 -1
  187. package/lib/esm/ui/widget/SubLayersTree.scss +69 -69
  188. package/lib/esm/ui/widget/TransparencyPopupButton.d.ts +13 -14
  189. package/lib/esm/ui/widget/TransparencyPopupButton.d.ts.map +1 -1
  190. package/lib/esm/ui/widget/TransparencyPopupButton.js +43 -43
  191. package/lib/esm/ui/widget/TransparencyPopupButton.js.map +1 -1
  192. package/lib/esm/ui/widget/TransparencyPopupButton.scss +35 -36
  193. package/package.json +31 -37
@@ -1 +1 @@
1
- {"version":3,"file":"MapLayerPreferences.js","sourceRoot":"","sources":["../../src/MapLayerPreferences.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,oBAAoB,EAA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;QACrC,OAAO,gCAAgC,CAAC;IAC1C,CAAC;;AAhTD;;;;;;GAMG;AACoB,wCAAoB,GAAG,IAAI,OAAO,EAA0G,CAAC,CAAC,mFAAmF","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\r\nimport { IModelApp, MapLayerSource, NotifyMessageDetails, OutputMessagePriority } from \"@itwin/core-frontend\";\r\nimport { BeEvent, GuidString } from \"@itwin/core-bentley\";\r\nimport { MapLayersUI } from \"./mapLayers\";\r\n\r\n/** @internal */\r\nexport interface MapLayerPreferencesContent {\r\n url: string;\r\n name: string;\r\n formatId: string;\r\n transparentBackground: boolean | undefined;\r\n}\r\n\r\n/** @internal */\r\nexport enum MapLayerSourceChangeType {\r\n Added = 0,\r\n Removed = 1,\r\n Replaced = 2,\r\n}\r\n\r\n/** @internal */\r\nexport interface MapLayerSourceArg {\r\n readonly source: MapLayerSource;\r\n readonly iTwinId: GuidString;\r\n readonly iModelId: GuidString;\r\n}\r\n\r\n/** A wrapper around user preferences to provide a way to store [[MapLayerSettings]].\r\n *\r\n * Note: This is currently internal only and used directly by the MapLayersExtension. It makes use of the IModelApp.authorizationClient if it exists.\r\n *\r\n * @internal\r\n */\r\nexport class MapLayerPreferences {\r\n /** Event raised whenever a source is added, replaced or removed:\r\n * changeType : Type of changed occurred.\r\n * oldSource : Source that was removed or replaced.\r\n * newSource : Source that was added or replacement of oldSource.\r\n *\r\n * @see [[MapLayerSourceChangeType]]\r\n */\r\n public static readonly onLayerSourceChanged = new BeEvent<(changeType: MapLayerSourceChangeType, oldSource?: MapLayerSource, newSource?: MapLayerSource) => void>(); // Used to notify the frontend that it needs to update its list of available layers\r\n\r\n /** Store the Map Layer source preference. If the same setting exists at a higher level, an error will be thrown and the setting will not be updated.\r\n *\r\n * Returns false if the settings object would override some other settings object in a larger scope i.e. storing settings on model when\r\n * a project setting exists with same name or map layer url.\r\n * @param source source to be stored on the setting service\r\n * @param storeOnIModel if true store the settings object on the model, if false store it on the project\r\n */\r\n public static async storeSource(source: MapLayerSource, iTwinId: GuidString, iModelId?: GuidString, storeOnIModel?: boolean): Promise<boolean> {\r\n if (!MapLayersUI.iTwinConfig)\r\n return false;\r\n const accessToken = undefined !== IModelApp.authorizationClient ? (await IModelApp.authorizationClient.getAccessToken()) : undefined;\r\n\r\n const sourceJSON = source.toJSON();\r\n const mapLayerSetting: MapLayerPreferencesContent = {\r\n url: sourceJSON.url,\r\n name: sourceJSON.name,\r\n formatId: sourceJSON.formatId,\r\n transparentBackground: sourceJSON.transparentBackground,\r\n };\r\n\r\n const result: boolean = await MapLayerPreferences.delete(sourceJSON.url, sourceJSON.name, iTwinId, iModelId, storeOnIModel);\r\n if (result) {\r\n await MapLayersUI.iTwinConfig.save({\r\n accessToken,\r\n content: mapLayerSetting,\r\n namespace: MapLayerPreferences._preferenceNamespace,\r\n key: sourceJSON.name,\r\n iTwinId,\r\n iModelId: storeOnIModel ? iModelId : undefined,\r\n });\r\n MapLayerPreferences.onLayerSourceChanged.raiseEvent(MapLayerSourceChangeType.Added, undefined, MapLayerSource.fromJSON(mapLayerSetting));\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }\r\n\r\n /** Replace the old map layer source with a new map layer source.\r\n *\r\n * The source is replaced at the same level that the original source is defined. (i.e. if the old source is defined at a project level, the new source will also be defined there.)\r\n *\r\n * @param oldSource\r\n * @param newSource\r\n * @param iTwinId\r\n * @param iModelId\r\n */\r\n public static async replaceSource(oldSource: MapLayerSource, newSource: MapLayerSource, iTwinId: GuidString, iModelId?: GuidString): Promise<void> {\r\n if (!MapLayersUI.iTwinConfig)\r\n return;\r\n const accessToken = undefined !== IModelApp.authorizationClient ? (await IModelApp.authorizationClient.getAccessToken()) : undefined;\r\n\r\n let storeOnIModel = false;\r\n try {\r\n await MapLayersUI.iTwinConfig.delete({\r\n accessToken,\r\n namespace: MapLayerPreferences._preferenceNamespace,\r\n key: oldSource.name,\r\n iTwinId,\r\n iModelId,\r\n });\r\n } catch (_err) {\r\n await MapLayersUI.iTwinConfig.delete({\r\n accessToken,\r\n namespace: MapLayerPreferences._preferenceNamespace,\r\n key: oldSource.name,\r\n iTwinId,\r\n });\r\n storeOnIModel = true;\r\n }\r\n\r\n const mapLayerSetting: MapLayerPreferencesContent = {\r\n url: newSource.url,\r\n name: newSource.name,\r\n formatId: newSource.formatId,\r\n transparentBackground: newSource.transparentBackground,\r\n };\r\n\r\n await MapLayersUI.iTwinConfig.save({\r\n accessToken,\r\n namespace: MapLayerPreferences._preferenceNamespace,\r\n key: `${MapLayerPreferences._preferenceNamespace}.${newSource.name}`,\r\n iTwinId,\r\n iModelId: storeOnIModel ? iModelId : undefined,\r\n content: mapLayerSetting,\r\n });\r\n\r\n MapLayerPreferences.onLayerSourceChanged.raiseEvent(MapLayerSourceChangeType.Replaced, oldSource, newSource);\r\n }\r\n\r\n /** Deletes the provided MapLayerSource by name from both the iTwin or iModel level.\r\n *\r\n * @param source The source to delete. The name is used to identify the source.\r\n * @param iTwinId\r\n * @param iModelId\r\n */\r\n public static async deleteByName(source: MapLayerSource, iTwinId: GuidString, iModelId?: GuidString): Promise<void> {\r\n if (!MapLayersUI.iTwinConfig)\r\n return;\r\n const accessToken = undefined !== IModelApp.authorizationClient ? (await IModelApp.authorizationClient.getAccessToken()) : undefined;\r\n\r\n try {\r\n await MapLayersUI.iTwinConfig.delete({\r\n accessToken,\r\n namespace: MapLayerPreferences._preferenceNamespace,\r\n key: source.name,\r\n iTwinId,\r\n iModelId,\r\n });\r\n } catch (_err) {\r\n // failed to store based on iModelId, attempt using iTwinId\r\n await MapLayersUI.iTwinConfig.delete({\r\n accessToken,\r\n namespace: MapLayerPreferences._preferenceNamespace,\r\n key: source.name,\r\n iTwinId,\r\n });\r\n }\r\n\r\n MapLayerPreferences.onLayerSourceChanged.raiseEvent(MapLayerSourceChangeType.Removed, source, undefined);\r\n }\r\n\r\n /** Deletes the current setting with the provided key if it is defined at the same preference level.\r\n *\r\n * If the preference is defined within a different level, false will be returned indicating the setting should not be overriden.\r\n *\r\n * The two potential preference levels are iTwin and iModel.\r\n *\r\n * @param url\r\n * @param name\r\n * @param iTwinId\r\n * @param iModelId\r\n * @param storeOnIModel\r\n */\r\n private static async delete(url: string, name: string, iTwinId: GuidString, iModelId?: GuidString, storeOnIModel?: boolean): Promise<boolean> {\r\n if (!MapLayersUI.iTwinConfig)\r\n return true;\r\n const accessToken = undefined !== IModelApp.authorizationClient ? (await IModelApp.authorizationClient.getAccessToken()) : undefined;\r\n\r\n const iTwinPreferenceByName = await MapLayersUI.iTwinConfig.get({\r\n accessToken,\r\n namespace: MapLayerPreferences._preferenceNamespace,\r\n key: name,\r\n iTwinId,\r\n });\r\n\r\n if (undefined !== iTwinPreferenceByName && storeOnIModel) {\r\n const errorMessage = IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.LayerExistsAsProjectSetting\", { layer: iTwinPreferenceByName.name });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, errorMessage));\r\n return false;\r\n } else if (iTwinPreferenceByName) {\r\n const infoMessage = IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.LayerExistsOverwriting\", { layer: iTwinPreferenceByName.name });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, infoMessage));\r\n await MapLayersUI.iTwinConfig.delete({\r\n accessToken,\r\n namespace: MapLayerPreferences._preferenceNamespace,\r\n key: iTwinPreferenceByName.name,\r\n iTwinId,\r\n });\r\n }\r\n\r\n // check if setting with url already exists, if it does, delete it\r\n const settingFromUrl = await MapLayerPreferences.getByUrl(url, iTwinId, undefined);\r\n if (settingFromUrl && storeOnIModel) {\r\n const errorMessage = IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.LayerWithUrlExistsAsProjectSetting\", { url: settingFromUrl.url, name: settingFromUrl.name });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, errorMessage));\r\n return false;\r\n } else if (settingFromUrl) {\r\n const infoMessage = IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.LayerWithUrlExistsOverwriting\", { url: settingFromUrl.url, oldName: settingFromUrl.name, newName: name });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, infoMessage));\r\n await MapLayersUI.iTwinConfig.delete({\r\n accessToken,\r\n namespace: MapLayerPreferences._preferenceNamespace,\r\n key: settingFromUrl.name,\r\n iTwinId,\r\n });\r\n }\r\n\r\n if (iModelId) { // delete any settings on model so user can update them if theres collisions\r\n const settingOnIModelFromName = await MapLayersUI.iTwinConfig.get({\r\n accessToken,\r\n namespace: MapLayerPreferences._preferenceNamespace,\r\n key: name,\r\n iTwinId,\r\n iModelId,\r\n });\r\n const settingFromUrlOnIModel = await MapLayerPreferences.getByUrl(url, iTwinId, iModelId);\r\n if (settingOnIModelFromName) {\r\n const infoMessage = IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.LayerExistsOverwriting\", { layer: settingOnIModelFromName.name });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, infoMessage));\r\n await MapLayersUI.iTwinConfig.delete({\r\n accessToken,\r\n namespace: MapLayerPreferences._preferenceNamespace,\r\n key: settingOnIModelFromName.name,\r\n iTwinId,\r\n iModelId,\r\n });\r\n }\r\n if (settingFromUrlOnIModel) {\r\n const infoMessage = IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.LayerWithUrlExistsOverwriting\", { url: settingFromUrlOnIModel.url, oldName: settingFromUrlOnIModel.name, newName: name });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, infoMessage));\r\n await MapLayersUI.iTwinConfig.delete({\r\n accessToken,\r\n namespace: MapLayerPreferences._preferenceNamespace,\r\n key: settingFromUrlOnIModel.name,\r\n iTwinId,\r\n iModelId,\r\n });\r\n }\r\n }\r\n return true;\r\n }\r\n\r\n /** Attempts to get a map layer based off a specific url.\r\n * @param url\r\n * @param iTwinId\r\n * @param iModelId\r\n */\r\n public static async getByUrl(url: string, iTwinId: string, iModelId?: string): Promise<MapLayerPreferencesContent | undefined> {\r\n if (!MapLayersUI.iTwinConfig)\r\n return undefined;\r\n\r\n const accessToken = undefined !== IModelApp.authorizationClient ? (await IModelApp.authorizationClient.getAccessToken()) : undefined;\r\n\r\n const settingResponse = await MapLayersUI.iTwinConfig.get({\r\n accessToken,\r\n namespace: MapLayerPreferences._preferenceNamespace,\r\n key: \"\",\r\n iTwinId,\r\n iModelId,\r\n });\r\n\r\n if (undefined === settingResponse || 0 === settingResponse.length)\r\n return undefined;\r\n\r\n let savedMapLayer;\r\n settingResponse.settingsMap?.forEach((savedLayer: any) => {\r\n if (savedLayer.url === url) {\r\n savedMapLayer = savedLayer;\r\n }\r\n });\r\n return savedMapLayer;\r\n }\r\n\r\n /** Get all MapLayerSources from the user's preferences, iTwin setting and iModel settings.\r\n * @param iTwinId id of the iTwin\r\n * @param iModelId id of the iModel\r\n * @throws if any of the calls to grab settings fail.\r\n */\r\n public static async getSources(iTwinId: GuidString, iModelId?: GuidString): Promise<MapLayerSource[]> {\r\n if (!MapLayersUI.iTwinConfig)\r\n return [];\r\n const accessToken = undefined !== IModelApp.authorizationClient ? (await IModelApp.authorizationClient.getAccessToken()) : undefined;\r\n\r\n const mapLayerList = [];\r\n\r\n try {\r\n const userResultByProject = await MapLayersUI.iTwinConfig.get({\r\n accessToken,\r\n namespace: MapLayerPreferences._preferenceNamespace,\r\n key: \"\",\r\n iTwinId,\r\n });\r\n if (undefined !== userResultByProject)\r\n mapLayerList.push(userResultByProject);\r\n } catch (err: any) {\r\n throw new Error(IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.ErrorRetrieveUserProject\", { errorMessage: err }));\r\n }\r\n\r\n try {\r\n const userResultByIModel = await MapLayersUI.iTwinConfig.get({\r\n accessToken,\r\n namespace: MapLayerPreferences._preferenceNamespace,\r\n key: \"\",\r\n iTwinId,\r\n iModelId,\r\n });\r\n if (undefined !== userResultByIModel)\r\n mapLayerList.push(userResultByIModel);\r\n } catch (err: any) {\r\n throw new Error(IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.ErrorRetrieveUserProject\", { errorMessage: err }));\r\n }\r\n\r\n const savedMapLayerSources: MapLayerSource[] = [];\r\n for (const mapLayer of mapLayerList) {\r\n mapLayer.forEach((savedLayer: any) => {\r\n const mapLayerSource = MapLayerSource.fromJSON(savedLayer as MapLayerPreferencesContent);\r\n if (mapLayerSource)\r\n savedMapLayerSources.push(mapLayerSource);\r\n });\r\n }\r\n return savedMapLayerSources;\r\n }\r\n\r\n private static get _preferenceNamespace() {\r\n return \"MapLayerSource-SettingsService\";\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"MapLayerPreferences.js","sourceRoot":"","sources":["../../src/MapLayerPreferences.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC9G,OAAO,EAAE,OAAO,EAAc,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAU1C,gBAAgB;AAChB,MAAM,CAAN,IAAY,wBAIX;AAJD,WAAY,wBAAwB;IAClC,yEAAS,CAAA;IACT,6EAAW,CAAA;IACX,+EAAY,CAAA;AACd,CAAC,EAJW,wBAAwB,KAAxB,wBAAwB,QAInC;AASD;;;;;GAKG;AACH,MAAM,OAAO,mBAAmB;IAU9B;;;;;;OAMG;IACI,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,MAAsB,EAAE,OAAmB,EAAE,QAAqB,EAAE,aAAuB;QACzH,IAAI,CAAC,WAAW,CAAC,WAAW;YAC1B,OAAO,KAAK,CAAC;QACf,MAAM,WAAW,GAAG,SAAS,KAAK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G,EAAE,EAAE;gBACP,OAAO;gBACP,QAAQ;aACT,CAAC,CAAC;YACH,IAAI,SAAS,KAAK,kBAAkB;gBAClC,YAAY,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;SACzC;QAAC,OAAO,GAAQ,EAAE;YACjB,MAAM,IAAI,KAAK,CAAC,SAAS,CAAC,YAAY,CAAC,kBAAkB,CAAC,iDAAiD,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;SACtI;QAED,MAAM,oBAAoB,GAAqB,EAAE,CAAC;QAClD,KAAK,MAAM,QAAQ,IAAI,YAAY,EAAE;YACnC,QAAQ,CAAC,OAAO,CAAC,CAAC,UAAe,EAAE,EAAE;gBACnC,MAAM,cAAc,GAAG,cAAc,CAAC,QAAQ,CAAC,UAAwC,CAAC,CAAC;gBACzF,IAAI,cAAc;oBAChB,oBAAoB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;YAC9C,CAAC,CAAC,CAAC;SACJ;QACD,OAAO,oBAAoB,CAAC;IAC9B,CAAC;IAEO,MAAM,KAAK,oBAAoB;QACrC,OAAO,gCAAgC,CAAC;IAC1C,CAAC;;AAhTD;;;;;;GAMG;AACoB,wCAAoB,GAAG,IAAI,OAAO,EAA0G,CAAC,CAAC,mFAAmF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nimport { IModelApp, MapLayerSource, NotifyMessageDetails, OutputMessagePriority } from \"@itwin/core-frontend\";\nimport { BeEvent, GuidString } from \"@itwin/core-bentley\";\nimport { MapLayersUI } from \"./mapLayers\";\n\n/** @internal */\nexport interface MapLayerPreferencesContent {\n url: string;\n name: string;\n formatId: string;\n transparentBackground: boolean | undefined;\n}\n\n/** @internal */\nexport enum MapLayerSourceChangeType {\n Added = 0,\n Removed = 1,\n Replaced = 2,\n}\n\n/** @internal */\nexport interface MapLayerSourceArg {\n readonly source: MapLayerSource;\n readonly iTwinId: GuidString;\n readonly iModelId: GuidString;\n}\n\n/** A wrapper around user preferences to provide a way to store [[MapLayerSettings]].\n *\n * Note: This is currently internal only and used directly by the MapLayersExtension. It makes use of the IModelApp.authorizationClient if it exists.\n *\n * @internal\n */\nexport class MapLayerPreferences {\n /** Event raised whenever a source is added, replaced or removed:\n * changeType : Type of changed occurred.\n * oldSource : Source that was removed or replaced.\n * newSource : Source that was added or replacement of oldSource.\n *\n * @see [[MapLayerSourceChangeType]]\n */\n public static readonly onLayerSourceChanged = new BeEvent<(changeType: MapLayerSourceChangeType, oldSource?: MapLayerSource, newSource?: MapLayerSource) => void>(); // Used to notify the frontend that it needs to update its list of available layers\n\n /** Store the Map Layer source preference. If the same setting exists at a higher level, an error will be thrown and the setting will not be updated.\n *\n * Returns false if the settings object would override some other settings object in a larger scope i.e. storing settings on model when\n * a project setting exists with same name or map layer url.\n * @param source source to be stored on the setting service\n * @param storeOnIModel if true store the settings object on the model, if false store it on the project\n */\n public static async storeSource(source: MapLayerSource, iTwinId: GuidString, iModelId?: GuidString, storeOnIModel?: boolean): Promise<boolean> {\n if (!MapLayersUI.iTwinConfig)\n return false;\n const accessToken = undefined !== IModelApp.authorizationClient ? (await IModelApp.authorizationClient.getAccessToken()) : undefined;\n\n const sourceJSON = source.toJSON();\n const mapLayerSetting: MapLayerPreferencesContent = {\n url: sourceJSON.url,\n name: sourceJSON.name,\n formatId: sourceJSON.formatId,\n transparentBackground: sourceJSON.transparentBackground,\n };\n\n const result: boolean = await MapLayerPreferences.delete(sourceJSON.url, sourceJSON.name, iTwinId, iModelId, storeOnIModel);\n if (result) {\n await MapLayersUI.iTwinConfig.save({\n accessToken,\n content: mapLayerSetting,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: sourceJSON.name,\n iTwinId,\n iModelId: storeOnIModel ? iModelId : undefined,\n });\n MapLayerPreferences.onLayerSourceChanged.raiseEvent(MapLayerSourceChangeType.Added, undefined, MapLayerSource.fromJSON(mapLayerSetting));\n return true;\n } else {\n return false;\n }\n }\n\n /** Replace the old map layer source with a new map layer source.\n *\n * The source is replaced at the same level that the original source is defined. (i.e. if the old source is defined at a project level, the new source will also be defined there.)\n *\n * @param oldSource\n * @param newSource\n * @param iTwinId\n * @param iModelId\n */\n public static async replaceSource(oldSource: MapLayerSource, newSource: MapLayerSource, iTwinId: GuidString, iModelId?: GuidString): Promise<void> {\n if (!MapLayersUI.iTwinConfig)\n return;\n const accessToken = undefined !== IModelApp.authorizationClient ? (await IModelApp.authorizationClient.getAccessToken()) : undefined;\n\n let storeOnIModel = false;\n try {\n await MapLayersUI.iTwinConfig.delete({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: oldSource.name,\n iTwinId,\n iModelId,\n });\n } catch (_err) {\n await MapLayersUI.iTwinConfig.delete({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: oldSource.name,\n iTwinId,\n });\n storeOnIModel = true;\n }\n\n const mapLayerSetting: MapLayerPreferencesContent = {\n url: newSource.url,\n name: newSource.name,\n formatId: newSource.formatId,\n transparentBackground: newSource.transparentBackground,\n };\n\n await MapLayersUI.iTwinConfig.save({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: `${MapLayerPreferences._preferenceNamespace}.${newSource.name}`,\n iTwinId,\n iModelId: storeOnIModel ? iModelId : undefined,\n content: mapLayerSetting,\n });\n\n MapLayerPreferences.onLayerSourceChanged.raiseEvent(MapLayerSourceChangeType.Replaced, oldSource, newSource);\n }\n\n /** Deletes the provided MapLayerSource by name from both the iTwin or iModel level.\n *\n * @param source The source to delete. The name is used to identify the source.\n * @param iTwinId\n * @param iModelId\n */\n public static async deleteByName(source: MapLayerSource, iTwinId: GuidString, iModelId?: GuidString): Promise<void> {\n if (!MapLayersUI.iTwinConfig)\n return;\n const accessToken = undefined !== IModelApp.authorizationClient ? (await IModelApp.authorizationClient.getAccessToken()) : undefined;\n\n try {\n await MapLayersUI.iTwinConfig.delete({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: source.name,\n iTwinId,\n iModelId,\n });\n } catch (_err) {\n // failed to store based on iModelId, attempt using iTwinId\n await MapLayersUI.iTwinConfig.delete({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: source.name,\n iTwinId,\n });\n }\n\n MapLayerPreferences.onLayerSourceChanged.raiseEvent(MapLayerSourceChangeType.Removed, source, undefined);\n }\n\n /** Deletes the current setting with the provided key if it is defined at the same preference level.\n *\n * If the preference is defined within a different level, false will be returned indicating the setting should not be overriden.\n *\n * The two potential preference levels are iTwin and iModel.\n *\n * @param url\n * @param name\n * @param iTwinId\n * @param iModelId\n * @param storeOnIModel\n */\n private static async delete(url: string, name: string, iTwinId: GuidString, iModelId?: GuidString, storeOnIModel?: boolean): Promise<boolean> {\n if (!MapLayersUI.iTwinConfig)\n return true;\n const accessToken = undefined !== IModelApp.authorizationClient ? (await IModelApp.authorizationClient.getAccessToken()) : undefined;\n\n const iTwinPreferenceByName = await MapLayersUI.iTwinConfig.get({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: name,\n iTwinId,\n });\n\n if (undefined !== iTwinPreferenceByName && storeOnIModel) {\n const errorMessage = IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.LayerExistsAsProjectSetting\", { layer: iTwinPreferenceByName.name });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, errorMessage));\n return false;\n } else if (iTwinPreferenceByName) {\n const infoMessage = IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.LayerExistsOverwriting\", { layer: iTwinPreferenceByName.name });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, infoMessage));\n await MapLayersUI.iTwinConfig.delete({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: iTwinPreferenceByName.name,\n iTwinId,\n });\n }\n\n // check if setting with url already exists, if it does, delete it\n const settingFromUrl = await MapLayerPreferences.getByUrl(url, iTwinId, undefined);\n if (settingFromUrl && storeOnIModel) {\n const errorMessage = IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.LayerWithUrlExistsAsProjectSetting\", { url: settingFromUrl.url, name: settingFromUrl.name });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, errorMessage));\n return false;\n } else if (settingFromUrl) {\n const infoMessage = IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.LayerWithUrlExistsOverwriting\", { url: settingFromUrl.url, oldName: settingFromUrl.name, newName: name });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, infoMessage));\n await MapLayersUI.iTwinConfig.delete({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: settingFromUrl.name,\n iTwinId,\n });\n }\n\n if (iModelId) { // delete any settings on model so user can update them if theres collisions\n const settingOnIModelFromName = await MapLayersUI.iTwinConfig.get({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: name,\n iTwinId,\n iModelId,\n });\n const settingFromUrlOnIModel = await MapLayerPreferences.getByUrl(url, iTwinId, iModelId);\n if (settingOnIModelFromName) {\n const infoMessage = IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.LayerExistsOverwriting\", { layer: settingOnIModelFromName.name });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, infoMessage));\n await MapLayersUI.iTwinConfig.delete({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: settingOnIModelFromName.name,\n iTwinId,\n iModelId,\n });\n }\n if (settingFromUrlOnIModel) {\n const infoMessage = IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.LayerWithUrlExistsOverwriting\", { url: settingFromUrlOnIModel.url, oldName: settingFromUrlOnIModel.name, newName: name });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, infoMessage));\n await MapLayersUI.iTwinConfig.delete({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: settingFromUrlOnIModel.name,\n iTwinId,\n iModelId,\n });\n }\n }\n return true;\n }\n\n /** Attempts to get a map layer based off a specific url.\n * @param url\n * @param iTwinId\n * @param iModelId\n */\n public static async getByUrl(url: string, iTwinId: string, iModelId?: string): Promise<MapLayerPreferencesContent | undefined> {\n if (!MapLayersUI.iTwinConfig)\n return undefined;\n\n const accessToken = undefined !== IModelApp.authorizationClient ? (await IModelApp.authorizationClient.getAccessToken()) : undefined;\n\n const settingResponse = await MapLayersUI.iTwinConfig.get({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: \"\",\n iTwinId,\n iModelId,\n });\n\n if (undefined === settingResponse || 0 === settingResponse.length)\n return undefined;\n\n let savedMapLayer;\n settingResponse.settingsMap?.forEach((savedLayer: any) => {\n if (savedLayer.url === url) {\n savedMapLayer = savedLayer;\n }\n });\n return savedMapLayer;\n }\n\n /** Get all MapLayerSources from the user's preferences, iTwin setting and iModel settings.\n * @param iTwinId id of the iTwin\n * @param iModelId id of the iModel\n * @throws if any of the calls to grab settings fail.\n */\n public static async getSources(iTwinId: GuidString, iModelId?: GuidString): Promise<MapLayerSource[]> {\n if (!MapLayersUI.iTwinConfig)\n return [];\n const accessToken = undefined !== IModelApp.authorizationClient ? (await IModelApp.authorizationClient.getAccessToken()) : undefined;\n\n const mapLayerList = [];\n\n try {\n const userResultByProject = await MapLayersUI.iTwinConfig.get({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: \"\",\n iTwinId,\n });\n if (undefined !== userResultByProject)\n mapLayerList.push(userResultByProject);\n } catch (err: any) {\n throw new Error(IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.ErrorRetrieveUserProject\", { errorMessage: err }));\n }\n\n try {\n const userResultByIModel = await MapLayersUI.iTwinConfig.get({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: \"\",\n iTwinId,\n iModelId,\n });\n if (undefined !== userResultByIModel)\n mapLayerList.push(userResultByIModel);\n } catch (err: any) {\n throw new Error(IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.ErrorRetrieveUserProject\", { errorMessage: err }));\n }\n\n const savedMapLayerSources: MapLayerSource[] = [];\n for (const mapLayer of mapLayerList) {\n mapLayer.forEach((savedLayer: any) => {\n const mapLayerSource = MapLayerSource.fromJSON(savedLayer as MapLayerPreferencesContent);\n if (mapLayerSource)\n savedMapLayerSources.push(mapLayerSource);\n });\n }\n return savedMapLayerSources;\n }\n\n private static get _preferenceNamespace() {\n return \"MapLayerSource-SettingsService\";\n }\n}\n"]}
@@ -1,7 +1,7 @@
1
- export * from "./mapLayers";
2
- export * from "./ui/Interfaces";
3
- export * from "./ui/MapLayersUiItemsProvider";
4
- export * from "./ui/FeatureInfoUiItemsProvider";
5
- export * from "./ui/MapFeatureInfoTool";
6
- export * from "./ui/widget/MapLayersWidget";
1
+ export * from "./mapLayers";
2
+ export * from "./ui/Interfaces";
3
+ export * from "./ui/MapLayersUiItemsProvider";
4
+ export * from "./ui/FeatureInfoUiItemsProvider";
5
+ export * from "./ui/MapFeatureInfoTool";
6
+ export * from "./ui/widget/MapLayersWidget";
7
7
  //# sourceMappingURL=map-layers.d.ts.map
@@ -1,11 +1,11 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
5
- export * from "./mapLayers";
6
- export * from "./ui/Interfaces";
7
- export * from "./ui/MapLayersUiItemsProvider";
8
- export * from "./ui/FeatureInfoUiItemsProvider";
9
- export * from "./ui/MapFeatureInfoTool";
10
- export * from "./ui/widget/MapLayersWidget";
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ export * from "./mapLayers";
6
+ export * from "./ui/Interfaces";
7
+ export * from "./ui/MapLayersUiItemsProvider";
8
+ export * from "./ui/FeatureInfoUiItemsProvider";
9
+ export * from "./ui/MapFeatureInfoTool";
10
+ export * from "./ui/widget/MapLayersWidget";
11
11
  //# sourceMappingURL=map-layers.js.map
@@ -1,45 +1,27 @@
1
- import { Localization } from "@itwin/core-common";
2
- import { UserPreferencesAccess } from "@itwin/core-frontend";
3
- import { UiItemProviderOverrides } from "@itwin/appui-abstract";
4
- import { MapFeatureInfoOptions, MapLayerOptions } from "./ui/Interfaces";
5
- export interface MapLayersConfig {
6
- localization?: Localization;
7
- /** If an iTwinConfig is provided, it will be used to load the MapLayerSources that are stored. */
8
- iTwinConfig?: UserPreferencesAccess;
9
- mapLayerOptions?: MapLayerOptions;
10
- featureInfoOpts?: MapFeatureInfoOptions;
11
- delayItemsProviderRegister?: boolean;
12
- }
13
- /** Configuration for registering UiItemsProviders for the MapLayers package */
14
- export interface MapLayersUiProviderConfig {
15
- mapLayerProviderOverrides?: UiItemProviderOverrides;
16
- featureInfoProviderOverrides?: UiItemProviderOverrides;
17
- }
18
- /** MapLayersUI is use when the package is used as a dependency to another app.
19
- * '''ts
20
- * await MapLayersUI.initialize({...MapLayersInitProps});
21
- * '''
22
- * @beta
23
- */
24
- export declare class MapLayersUI {
25
- private static _defaultNs;
26
- static localization: Localization;
27
- private static _uiItemsProvidersId;
28
- private static _iTwinConfig?;
29
- private static _featureInfoOpts?;
30
- private static _mapLayerOptions?;
31
- static get iTwinConfig(): UserPreferencesAccess | undefined;
32
- /** Used to initialize the Map Layers */
33
- static initialize(config?: MapLayersConfig): Promise<void>;
34
- /** Registers the UiItemsProviders for MapLayers with optional overrides
35
- * This is useful for an app that wants to defer UiItemsProvider registration so that it
36
- * may limit the MapLayers widgets to a specific workflow
37
- * @beta
38
- */
39
- static registerUiItemsProviders(config?: MapLayersUiProviderConfig): void;
40
- /** Unregisters internationalization service namespace and UiItemManager */
41
- static terminate(): void;
42
- /** The internationalization service namespace. */
43
- static get localizationNamespace(): string;
44
- }
1
+ import { Localization } from "@itwin/core-common";
2
+ import { UserPreferencesAccess } from "@itwin/core-frontend";
3
+ export interface MapLayersConfig {
4
+ localization?: Localization;
5
+ /** If an iTwinConfig is provided, it will be used to load the MapLayerSources that are stored. */
6
+ iTwinConfig?: UserPreferencesAccess;
7
+ }
8
+ /** MapLayersUI is use when the package is used as a dependency to another app.
9
+ * '''ts
10
+ * await MapLayersUI.initialize({...MapLayersInitProps});
11
+ * '''
12
+ * @beta
13
+ */
14
+ export declare class MapLayersUI {
15
+ private static _defaultNs;
16
+ static localization: Localization;
17
+ private static _uiItemsProvidersId;
18
+ private static _iTwinConfig?;
19
+ static get iTwinConfig(): UserPreferencesAccess | undefined;
20
+ /** Used to initialize the Map Layers */
21
+ static initialize(config?: MapLayersConfig): Promise<void>;
22
+ /** Unregisters internationalization service namespace and UiItemManager */
23
+ static terminate(): void;
24
+ /** The internationalization service namespace. */
25
+ static get localizationNamespace(): string;
26
+ }
45
27
  //# sourceMappingURL=mapLayers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mapLayers.d.ts","sourceRoot":"","sources":["../../src/mapLayers.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAa,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAExE,OAAO,EAAE,uBAAuB,EAAkB,MAAM,uBAAuB,CAAC;AAEhF,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEzE,MAAM,WAAW,eAAe;IAC9B,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,kGAAkG;IAClG,WAAW,CAAC,EAAE,qBAAqB,CAAC;IACpC,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,eAAe,CAAC,EAAE,qBAAqB,CAAC;IACxC,0BAA0B,CAAC,EAAE,OAAO,CAAC;CACtC;AACD,+EAA+E;AAC/E,MAA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AAW,IAAI,qBAAqB,GAAG,SAAS,CAEjE;IAED,wCAAwC;WACpB,UAAU,CAAC,MAAM,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAUvE,4EAA4E;WAC9D,SAAS;IAIvB,kDAAkD;IAClD,WAAkB,qBAAqB,IAAI,MAAM,CAEhD;CACF"}
@@ -1,58 +1,30 @@
1
- import { IModelApp } from "@itwin/core-frontend";
2
- import { MapLayersUiItemsProvider } from "./ui/MapLayersUiItemsProvider";
3
- import { UiItemsManager } from "@itwin/appui-abstract";
4
- import { FeatureInfoUiItemsProvider } from "./ui/FeatureInfoUiItemsProvider";
5
- /** MapLayersUI is use when the package is used as a dependency to another app.
6
- * '''ts
7
- * await MapLayersUI.initialize({...MapLayersInitProps});
8
- * '''
9
- * @beta
10
- */
11
- export class MapLayersUI {
12
- static get iTwinConfig() {
13
- return this._iTwinConfig;
14
- }
15
- /** Used to initialize the Map Layers */
16
- static async initialize(config) {
17
- // register namespace containing localized strings for this package
18
- MapLayersUI.localization = config?.localization ?? IModelApp.localization;
19
- await MapLayersUI.localization.registerNamespace(MapLayersUI.localizationNamespace);
20
- MapLayersUI._iTwinConfig = config?.iTwinConfig;
21
- MapLayersUI._featureInfoOpts = config?.featureInfoOpts;
22
- MapLayersUI._mapLayerOptions = config?.mapLayerOptions;
23
- if (!config?.delayItemsProviderRegister)
24
- MapLayersUI.registerUiItemsProviders();
25
- }
26
- /** Registers the UiItemsProviders for MapLayers with optional overrides
27
- * This is useful for an app that wants to defer UiItemsProvider registration so that it
28
- * may limit the MapLayers widgets to a specific workflow
29
- * @beta
30
- */
31
- static registerUiItemsProviders(config) {
32
- const mlProvider = new MapLayersUiItemsProvider({ ...MapLayersUI._mapLayerOptions });
33
- const mlProviderId = config?.mapLayerProviderOverrides?.providerId ?? mlProvider.id;
34
- MapLayersUI._uiItemsProvidersId.push(mlProviderId);
35
- UiItemsManager.register(mlProvider, config?.mapLayerProviderOverrides); // eslint-disable-line deprecation/deprecation
36
- // Register the FeatureInfo widget only if MapHit was provided.
37
- if (MapLayersUI._featureInfoOpts?.onMapHit) {
38
- const fiProvider = new FeatureInfoUiItemsProvider({ ...MapLayersUI._featureInfoOpts });
39
- const fiProviderId = config?.featureInfoProviderOverrides?.providerId ?? fiProvider.id;
40
- MapLayersUI._uiItemsProvidersId.push(fiProviderId);
41
- UiItemsManager.register(fiProvider, config?.featureInfoProviderOverrides); // eslint-disable-line deprecation/deprecation
42
- }
43
- }
44
- /** Unregisters internationalization service namespace and UiItemManager */
45
- static terminate() {
46
- IModelApp.localization.unregisterNamespace(MapLayersUI.localizationNamespace);
47
- MapLayersUI._uiItemsProvidersId.forEach((uiProviderId) => {
48
- UiItemsManager.unregister(uiProviderId); // eslint-disable-line deprecation/deprecation
49
- });
50
- }
51
- /** The internationalization service namespace. */
52
- static get localizationNamespace() {
53
- return MapLayersUI._defaultNs;
54
- }
55
- }
56
- MapLayersUI._defaultNs = "mapLayers";
57
- MapLayersUI._uiItemsProvidersId = [];
1
+ import { IModelApp } from "@itwin/core-frontend";
2
+ /** MapLayersUI is use when the package is used as a dependency to another app.
3
+ * '''ts
4
+ * await MapLayersUI.initialize({...MapLayersInitProps});
5
+ * '''
6
+ * @beta
7
+ */
8
+ export class MapLayersUI {
9
+ static get iTwinConfig() {
10
+ return this._iTwinConfig;
11
+ }
12
+ /** Used to initialize the Map Layers */
13
+ static async initialize(config) {
14
+ // register namespace containing localized strings for this package
15
+ MapLayersUI.localization = config?.localization ?? IModelApp.localization;
16
+ await MapLayersUI.localization.registerNamespace(MapLayersUI.localizationNamespace);
17
+ MapLayersUI._iTwinConfig = config?.iTwinConfig;
18
+ }
19
+ /** Unregisters internationalization service namespace and UiItemManager */
20
+ static terminate() {
21
+ IModelApp.localization.unregisterNamespace(MapLayersUI.localizationNamespace);
22
+ }
23
+ /** The internationalization service namespace. */
24
+ static get localizationNamespace() {
25
+ return MapLayersUI._defaultNs;
26
+ }
27
+ }
28
+ MapLayersUI._defaultNs = "mapLayers";
29
+ MapLayersUI._uiItemsProvidersId = [];
58
30
  //# sourceMappingURL=mapLayers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mapLayers.js","sourceRoot":"","sources":["../../src/mapLayers.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAyB,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAA2B,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAChF,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAiB7E;;;;;GAKG;AACH,MAAM,OAAO,WAAW;IAQf,MAAM,KAAK,WAAW;QAC3B,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED,wCAAwC;IACjC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,MAAwB;QACrD,mEAAmE;QACnE,WAAW,CAAC,YAAY,GAAG,MAAM,EAAE,YAAY,IAAI,SAAS,CAAC,YAAY,CAAC;QAC1E,MAAM,WAAW,CAAC,YAAY,CAAC,iBAAiB,CAC9C,WAAW,CAAC,qBAAqB,CAClC,CAAC;QAEF,WAAW,CAAC,YAAY,GAAG,MAAM,EAAE,WAAW,CAAC;QAC/C,WAAW,CAAC,gBAAgB,GAAG,MAAM,EAAE,eAAe,CAAC;QACvD,WAAW,CAAC,gBAAgB,GAAG,MAAM,EAAE,eAAe,CAAC;QAEvD,IAAI,CAAC,MAAM,EAAE,0BAA0B;YACrC,WAAW,CAAC,wBAAwB,EAAE,CAAC;IAC3C,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,wBAAwB,CAAC,MAAkC;QACvE,MAAM,UAAU,GAAG,IAAI,wBAAwB,CAAC,EAAE,GAAG,WAAW,CAAC,gBAAgB,EAAE,CAAC,CAAC;QACrF,MAAM,YAAY,GAAG,MAAM,EAAE,yBAAyB,EAAE,UAAU,IAAI,UAAU,CAAC,EAAE,CAAC;QACpF,WAAW,CAAC,mBAAmB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACnD,cAAc,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,yBAAyB,CAAC,CAAC,CAAC,8CAA8C;QAEtH,+DAA+D;QAC/D,IAAI,WAAW,CAAC,gBAAgB,EAAE,QAAQ,EAAE;YAC1C,MAAM,UAAU,GAAG,IAAI,0BAA0B,CAAC,EAAE,GAAG,WAAW,CAAC,gBAAgB,EAAE,CAAC,CAAC;YACvF,MAAM,YAAY,GAAG,MAAM,EAAE,4BAA4B,EAAE,UAAU,IAAI,UAAU,CAAC,EAAE,CAAC;YACvF,WAAW,CAAC,mBAAmB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YACnD,cAAc,CAAC,QAAQ,CAAC,UAAU,EAAG,MAAM,EAAE,4BAA4B,CAAC,CAAC,CAAC,8CAA8C;SAC3H;IACH,CAAC;IAED,4EAA4E;IACrE,MAAM,CAAC,SAAS;QACrB,SAAS,CAAC,YAAY,CAAC,mBAAmB,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC;QAE9E,WAAW,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,YAAY,EAAE,EAAE;YACvD,cAAc,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC,8CAA8C;QACzF,CAAC,CAAC,CAAC;IACL,CAAC;IAED,kDAAkD;IAC3C,MAAM,KAAK,qBAAqB;QACrC,OAAO,WAAW,CAAC,UAAU,CAAC;IAChC,CAAC;;AA3Dc,sBAAU,GAAG,WAAW,CAAC;AAEzB,+BAAmB,GAAa,EAAE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport { Localization } from \"@itwin/core-common\";\r\nimport { IModelApp, UserPreferencesAccess } from \"@itwin/core-frontend\";\r\nimport { MapLayersUiItemsProvider } from \"./ui/MapLayersUiItemsProvider\";\r\nimport { UiItemProviderOverrides, UiItemsManager } from \"@itwin/appui-abstract\";\r\nimport { FeatureInfoUiItemsProvider } from \"./ui/FeatureInfoUiItemsProvider\";\r\nimport { MapFeatureInfoOptions, MapLayerOptions } from \"./ui/Interfaces\";\r\n\r\nexport interface MapLayersConfig {\r\n localization?: Localization;\r\n /** If an iTwinConfig is provided, it will be used to load the MapLayerSources that are stored. */\r\n iTwinConfig?: UserPreferencesAccess;\r\n mapLayerOptions?: MapLayerOptions;\r\n featureInfoOpts?: MapFeatureInfoOptions;\r\n delayItemsProviderRegister?: boolean;\r\n}\r\n/** Configuration for registering UiItemsProviders for the MapLayers package */\r\nexport interface MapLayersUiProviderConfig {\r\n mapLayerProviderOverrides?: UiItemProviderOverrides; // eslint-disable-line deprecation/deprecation\r\n featureInfoProviderOverrides?: UiItemProviderOverrides; // eslint-disable-line deprecation/deprecation\r\n}\r\n\r\n/** MapLayersUI is use when the package is used as a dependency to another app.\r\n * '''ts\r\n * await MapLayersUI.initialize({...MapLayersInitProps});\r\n * '''\r\n * @beta\r\n */\r\nexport class MapLayersUI {\r\n private static _defaultNs = \"mapLayers\";\r\n public static localization: Localization;\r\n private static _uiItemsProvidersId: string[] = [];\r\n private static _iTwinConfig?: UserPreferencesAccess;\r\n private static _featureInfoOpts?: MapFeatureInfoOptions;\r\n private static _mapLayerOptions?: MapLayerOptions;\r\n\r\n public static get iTwinConfig(): UserPreferencesAccess | undefined {\r\n return this._iTwinConfig;\r\n }\r\n\r\n /** Used to initialize the Map Layers */\r\n public static async initialize(config?: MapLayersConfig): Promise<void> {\r\n // register namespace containing localized strings for this package\r\n MapLayersUI.localization = config?.localization ?? IModelApp.localization;\r\n await MapLayersUI.localization.registerNamespace(\r\n MapLayersUI.localizationNamespace\r\n );\r\n\r\n MapLayersUI._iTwinConfig = config?.iTwinConfig;\r\n MapLayersUI._featureInfoOpts = config?.featureInfoOpts;\r\n MapLayersUI._mapLayerOptions = config?.mapLayerOptions;\r\n\r\n if (!config?.delayItemsProviderRegister)\r\n MapLayersUI.registerUiItemsProviders();\r\n }\r\n\r\n /** Registers the UiItemsProviders for MapLayers with optional overrides\r\n * This is useful for an app that wants to defer UiItemsProvider registration so that it\r\n * may limit the MapLayers widgets to a specific workflow\r\n * @beta\r\n */\r\n public static registerUiItemsProviders(config?: MapLayersUiProviderConfig) {\r\n const mlProvider = new MapLayersUiItemsProvider({ ...MapLayersUI._mapLayerOptions });\r\n const mlProviderId = config?.mapLayerProviderOverrides?.providerId ?? mlProvider.id;\r\n MapLayersUI._uiItemsProvidersId.push(mlProviderId);\r\n UiItemsManager.register(mlProvider, config?.mapLayerProviderOverrides); // eslint-disable-line deprecation/deprecation\r\n\r\n // Register the FeatureInfo widget only if MapHit was provided.\r\n if (MapLayersUI._featureInfoOpts?.onMapHit) {\r\n const fiProvider = new FeatureInfoUiItemsProvider({ ...MapLayersUI._featureInfoOpts });\r\n const fiProviderId = config?.featureInfoProviderOverrides?.providerId ?? fiProvider.id;\r\n MapLayersUI._uiItemsProvidersId.push(fiProviderId);\r\n UiItemsManager.register(fiProvider, config?.featureInfoProviderOverrides); // eslint-disable-line deprecation/deprecation\r\n }\r\n }\r\n\r\n /** Unregisters internationalization service namespace and UiItemManager */\r\n public static terminate() {\r\n IModelApp.localization.unregisterNamespace(MapLayersUI.localizationNamespace);\r\n\r\n MapLayersUI._uiItemsProvidersId.forEach((uiProviderId) => {\r\n UiItemsManager.unregister(uiProviderId); // eslint-disable-line deprecation/deprecation\r\n });\r\n }\r\n\r\n /** The internationalization service namespace. */\r\n public static get localizationNamespace(): string {\r\n return MapLayersUI._defaultNs;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"mapLayers.js","sourceRoot":"","sources":["../../src/mapLayers.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAyB,MAAM,sBAAsB,CAAC;AAUxE;;;;;GAKG;AACH,MAAM,OAAO,WAAW;IAMf,MAAM,KAAK,WAAW;QAC3B,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED,wCAAwC;IACjC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,MAAwB;QACrD,mEAAmE;QACnE,WAAW,CAAC,YAAY,GAAG,MAAM,EAAE,YAAY,IAAI,SAAS,CAAC,YAAY,CAAC;QAC1E,MAAM,WAAW,CAAC,YAAY,CAAC,iBAAiB,CAC9C,WAAW,CAAC,qBAAqB,CAClC,CAAC;QAEF,WAAW,CAAC,YAAY,GAAG,MAAM,EAAE,WAAW,CAAC;IACjD,CAAC;IAED,4EAA4E;IACrE,MAAM,CAAC,SAAS;QACrB,SAAS,CAAC,YAAY,CAAC,mBAAmB,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC;IAChF,CAAC;IAED,kDAAkD;IAC3C,MAAM,KAAK,qBAAqB;QACrC,OAAO,WAAW,CAAC,UAAU,CAAC;IAChC,CAAC;;AA5Bc,sBAAU,GAAG,WAAW,CAAC;AAEzB,+BAAmB,GAAa,EAAE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { Localization } from \"@itwin/core-common\";\nimport { IModelApp, UserPreferencesAccess } from \"@itwin/core-frontend\";\n// import { MapLayersUiItemsProvider } from \"./ui/MapLayersUiItemsProvider\";\n// import { FeatureInfoUiItemsProvider } from \"./ui/FeatureInfoUiItemsProvider\";\n\nexport interface MapLayersConfig {\n localization?: Localization;\n /** If an iTwinConfig is provided, it will be used to load the MapLayerSources that are stored. */\n iTwinConfig?: UserPreferencesAccess;\n}\n\n/** MapLayersUI is use when the package is used as a dependency to another app.\n * '''ts\n * await MapLayersUI.initialize({...MapLayersInitProps});\n * '''\n * @beta\n */\nexport class MapLayersUI {\n private static _defaultNs = \"mapLayers\";\n public static localization: Localization;\n private static _uiItemsProvidersId: string[] = [];\n private static _iTwinConfig?: UserPreferencesAccess;\n\n public static get iTwinConfig(): UserPreferencesAccess | undefined {\n return this._iTwinConfig;\n }\n\n /** Used to initialize the Map Layers */\n public static async initialize(config?: MapLayersConfig): Promise<void> {\n // register namespace containing localized strings for this package\n MapLayersUI.localization = config?.localization ?? IModelApp.localization;\n await MapLayersUI.localization.registerNamespace(\n MapLayersUI.localizationNamespace\n );\n\n MapLayersUI._iTwinConfig = config?.iTwinConfig;\n }\n\n /** Unregisters internationalization service namespace and UiItemManager */\n public static terminate() {\n IModelApp.localization.unregisterNamespace(MapLayersUI.localizationNamespace);\n }\n\n /** The internationalization service namespace. */\n public static get localizationNamespace(): string {\n return MapLayersUI._defaultNs;\n }\n}\n"]}
@@ -1,12 +1,17 @@
1
- import { AbstractWidgetProps, AbstractZoneLocation, CommonToolbarItem, StagePanelLocation, StagePanelSection, ToolbarOrientation, ToolbarUsage, UiItemsProvider } from "@itwin/appui-abstract";
2
- import { MapFeatureInfoOptions } from "./Interfaces";
3
- export declare class FeatureInfoUiItemsProvider implements UiItemsProvider {
4
- private _featureInfoOpts;
5
- readonly id = "FeatureInfoUiItemsProvider";
6
- static readonly widgetId = "map-layers:mapFeatureInfoWidget";
7
- constructor(_featureInfoOpts: MapFeatureInfoOptions);
8
- provideToolbarButtonItems(_stageId: string, stageUsage: string, toolbarUsage: ToolbarUsage, // eslint-disable-line deprecation/deprecation
9
- toolbarOrientation: ToolbarOrientation): CommonToolbarItem[];
10
- provideWidgets(_stageId: string, stageUsage: string, location: StagePanelLocation, section?: StagePanelSection, zoneLocation?: AbstractZoneLocation): ReadonlyArray<AbstractWidgetProps>;
11
- }
1
+ import { StagePanelLocation, StagePanelSection, ToolbarItem, ToolbarOrientation, ToolbarUsage, UiItemsProvider, WidgetState } from "@itwin/appui-react";
2
+ import { MapFeatureInfoOptions } from "./Interfaces";
3
+ export declare class FeatureInfoUiItemsProvider implements UiItemsProvider {
4
+ private _featureInfoOpts;
5
+ readonly id = "FeatureInfoUiItemsProvider";
6
+ static readonly widgetId = "map-layers:mapFeatureInfoWidget";
7
+ constructor(_featureInfoOpts: MapFeatureInfoOptions);
8
+ provideToolbarItems(_stageId: string, stageUsage: string, toolbarUsage: ToolbarUsage, toolbarOrientation: ToolbarOrientation): ReadonlyArray<ToolbarItem>;
9
+ provideWidgets(_stageId: string, stageUsage: string, location: StagePanelLocation, section?: StagePanelSection): {
10
+ id: string;
11
+ label: string;
12
+ icon: string;
13
+ content: JSX.Element;
14
+ defaultState: WidgetState;
15
+ }[];
16
+ }
12
17
  //# sourceMappingURL=FeatureInfoUiItemsProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FeatureInfoUiItemsProvider.d.ts","sourceRoot":"","sources":["../../../src/ui/FeatureInfoUiItemsProvider.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,iBAAiB,EAAc,kBAAkB,EAAE,YAAY,EAAE,eAAe,EAAe,MAAM,uBAAuB,CAAC;AAGxN,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAIrD,qBAAa,0BAA2B,YAAW,eAAe;IAI7C,OAAO,CAAC,gBAAgB;IAH3C,SAAgB,EAAE,gCAAgC;IAClD,gBAAuB,QAAQ,qCAAqC;gBAEzC,gBAAgB,EAAE,qBAAqB;IAE3D,yBAAyB,CAC9B,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,YAAY,EAAE,8CAA8C;IAC1E,kBAAkB,EAAE,kBAAkB,GACrC,iBAAiB,EAAE;IAiBf,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,iBAAiB,EAAE,YAAY,CAAC,EAAE,oBAAoB,GAAG,aAAa,CAAC,mBAAmB,CAAC;CAiBhM"}
1
+ {"version":3,"file":"FeatureInfoUiItemsProvider.d.ts","sourceRoot":"","sources":["../../../src/ui/FeatureInfoUiItemsProvider.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAA6B,WAAW,EAAE,kBAAkB,EAAE,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEnL,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAIrD,qBAAa,0BAA2B,YAAW,eAAe;IAI7C,OAAO,CAAC,gBAAgB;IAH3C,SAAgB,EAAE,gCAAgC;IAClD,gBAAuB,QAAQ,qCAAqC;gBAEzC,gBAAgB,EAAE,qBAAqB;IAE3D,mBAAmB,CACxB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,YAAY,EAC1B,kBAAkB,EAAE,kBAAkB,GACrC,aAAa,CAAC,WAAW,CAAC;IAgBtB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,iBAAiB;;;;;;;CAgBtH"}
@@ -1,48 +1,43 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
5
- import * as React from "react";
6
- import { AbstractZoneLocation, StagePanelLocation, StagePanelSection, StageUsage, ToolbarOrientation, ToolbarUsage, WidgetState } from "@itwin/appui-abstract";
7
- import { ToolbarHelper, UiFramework } from "@itwin/appui-react";
8
- import { MapFeatureInfoWidget } from "./widget/FeatureInfoWidget";
9
- import { MapLayersUI } from "../mapLayers";
10
- import { DefaultMapFeatureInfoTool, getDefaultMapFeatureInfoToolItemDef } from "./MapFeatureInfoTool";
11
- export class FeatureInfoUiItemsProvider {
12
- constructor(_featureInfoOpts) {
13
- this._featureInfoOpts = _featureInfoOpts;
14
- this.id = "FeatureInfoUiItemsProvider";
15
- }
16
- provideToolbarButtonItems(_stageId, stageUsage, toolbarUsage, // eslint-disable-line deprecation/deprecation
17
- toolbarOrientation) {
18
- if (!this._featureInfoOpts?.disableDefaultFeatureInfoTool &&
19
- stageUsage === StageUsage.General && // eslint-disable-line deprecation/deprecation
20
- toolbarUsage === ToolbarUsage.ContentManipulation && // eslint-disable-line deprecation/deprecation
21
- toolbarOrientation === ToolbarOrientation.Vertical // eslint-disable-line deprecation/deprecation
22
- ) {
23
- DefaultMapFeatureInfoTool.register(MapLayersUI.localizationNamespace);
24
- return [
25
- ToolbarHelper.createToolbarItemFromItemDef(60, getDefaultMapFeatureInfoToolItemDef()),
26
- ];
27
- }
28
- return [];
29
- }
30
- // eslint-disable-next-line deprecation/deprecation
31
- provideWidgets(_stageId, stageUsage, location, section, zoneLocation) {
32
- const widgets = []; // eslint-disable-line deprecation/deprecation
33
- // eslint-disable-next-line deprecation/deprecation
34
- if ((undefined === section && stageUsage === StageUsage.General && zoneLocation === AbstractZoneLocation.BottomRight) ||
35
- (stageUsage === StageUsage.General && location === StagePanelLocation.Right && section === StagePanelSection.End && "1" !== UiFramework.uiVersion)) { // eslint-disable-line deprecation/deprecation
36
- widgets.push({
37
- id: FeatureInfoUiItemsProvider.widgetId,
38
- label: MapLayersUI.localization.getLocalizedString("mapLayers:FeatureInfoWidget.Label"),
39
- icon: "icon-map",
40
- getWidgetContent: () => React.createElement(MapFeatureInfoWidget, { featureInfoOpts: this._featureInfoOpts }),
41
- defaultState: WidgetState.Closed, // eslint-disable-line deprecation/deprecation
42
- });
43
- }
44
- return widgets;
45
- }
46
- }
47
- FeatureInfoUiItemsProvider.widgetId = "map-layers:mapFeatureInfoWidget";
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import * as React from "react";
6
+ import { StagePanelLocation, StagePanelSection, StageUsage, ToolbarHelper, ToolbarOrientation, ToolbarUsage, WidgetState } from "@itwin/appui-react";
7
+ import { MapFeatureInfoWidget } from "./widget/FeatureInfoWidget";
8
+ import { MapLayersUI } from "../mapLayers";
9
+ import { DefaultMapFeatureInfoTool, getDefaultMapFeatureInfoToolItemDef } from "./MapFeatureInfoTool";
10
+ export class FeatureInfoUiItemsProvider {
11
+ constructor(_featureInfoOpts) {
12
+ this._featureInfoOpts = _featureInfoOpts;
13
+ this.id = "FeatureInfoUiItemsProvider";
14
+ }
15
+ provideToolbarItems(_stageId, stageUsage, toolbarUsage, toolbarOrientation) {
16
+ if (!this._featureInfoOpts?.disableDefaultFeatureInfoTool &&
17
+ stageUsage === StageUsage.General &&
18
+ toolbarUsage === ToolbarUsage.ContentManipulation &&
19
+ toolbarOrientation === ToolbarOrientation.Vertical) {
20
+ DefaultMapFeatureInfoTool.register(MapLayersUI.localizationNamespace);
21
+ return [
22
+ ToolbarHelper.createToolbarItemFromItemDef(60, getDefaultMapFeatureInfoToolItemDef()),
23
+ ];
24
+ }
25
+ return [];
26
+ }
27
+ provideWidgets(_stageId, stageUsage, location, section) {
28
+ const widgets = [];
29
+ const tmpSection = section ?? StagePanelSection.End;
30
+ if (tmpSection === StagePanelSection.End && stageUsage === StageUsage.General && location === StagePanelLocation.Right) {
31
+ widgets.push({
32
+ id: FeatureInfoUiItemsProvider.widgetId,
33
+ label: MapLayersUI.localization.getLocalizedString("mapLayers:FeatureInfoWidget.Label"),
34
+ icon: "icon-map",
35
+ content: React.createElement(MapFeatureInfoWidget, { featureInfoOpts: this._featureInfoOpts }),
36
+ defaultState: WidgetState.Closed,
37
+ });
38
+ }
39
+ return widgets;
40
+ }
41
+ }
42
+ FeatureInfoUiItemsProvider.widgetId = "map-layers:mapFeatureInfoWidget";
48
43
  //# sourceMappingURL=FeatureInfoUiItemsProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FeatureInfoUiItemsProvider.js","sourceRo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O,GAA0B,EAAE,CAAC,CAAC,8CAA8C;QAEzF,mDAAmD;QACnD,IAAI,CAAC,SAAS,KAAK,OAAO,IAAI,UAAU,KAAK,UAAU,CAAC,OAAO,IAAI,YAAY,KAAK,oBAAoB,CAAC,WAAW,CAAC;YACnH,CAAC,UAAU,KAAK,UAAU,CAAC,OAAO,IAAI,QAAQ,KAAK,kBAAkB,CAAC,KAAK,IAAI,OAAO,KAAK,iBAAiB,CAAC,GAAG,IAAI,GAAG,KAAK,WAAW,CAAC,SAAS,CAAC,EAAE,EAAE,8CAA8C;YACpM,OAAO,CAAC,IAAI,CAAC;gBACX,EAAE,EAAE,0BAA0B,CAAC,QAAQ;gBACvC,KAAK,EAAE,WAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,mCAAmC,CAAC;gBACvF,IAAI,EAAE,UAAU;gBAChB,gBAAgB,EAAE,GAAG,EAAE,CAAC,oBAAC,oBAAoB,IAAC,eAAe,EAAE,IAAI,CAAC,gBAAgB,GAAI;gBACxF,YAAY,EAAE,WAAW,CAAC,MAAM,EAAE,8CAA8C;aACjF,CAAC,CAAC;SACJ;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;;AA1CsB,mCAAQ,GAAG,iCAAiC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nimport * as React from \"react\";\r\nimport { AbstractWidgetProps, AbstractZoneLocation, CommonToolbarItem, StagePanelLocation, StagePanelSection, StageUsage, ToolbarOrientation, ToolbarUsage, UiItemsProvider, WidgetState } from \"@itwin/appui-abstract\";\r\nimport { ToolbarHelper, UiFramework } from \"@itwin/appui-react\";\r\nimport { MapFeatureInfoWidget } from \"./widget/FeatureInfoWidget\";\r\nimport { MapFeatureInfoOptions } from \"./Interfaces\";\r\nimport { MapLayersUI } from \"../mapLayers\";\r\nimport { DefaultMapFeatureInfoTool, getDefaultMapFeatureInfoToolItemDef } from \"./MapFeatureInfoTool\";\r\n\r\nexport class FeatureInfoUiItemsProvider implements UiItemsProvider { // eslint-disable-line deprecation/deprecation\r\n public readonly id = \"FeatureInfoUiItemsProvider\";\r\n public static readonly widgetId = \"map-layers:mapFeatureInfoWidget\";\r\n\r\n public constructor(private _featureInfoOpts: MapFeatureInfoOptions) { }\r\n\r\n public provideToolbarButtonItems(\r\n _stageId: string,\r\n stageUsage: string,\r\n toolbarUsage: ToolbarUsage, // eslint-disable-line deprecation/deprecation\r\n toolbarOrientation: ToolbarOrientation, // eslint-disable-line deprecation/deprecation\r\n ): CommonToolbarItem[] {\r\n if (\r\n !this._featureInfoOpts?.disableDefaultFeatureInfoTool &&\r\n stageUsage === StageUsage.General && // eslint-disable-line deprecation/deprecation\r\n toolbarUsage === ToolbarUsage.ContentManipulation && // eslint-disable-line deprecation/deprecation\r\n toolbarOrientation === ToolbarOrientation.Vertical // eslint-disable-line deprecation/deprecation\r\n ) {\r\n DefaultMapFeatureInfoTool.register(MapLayersUI.localizationNamespace);\r\n return [\r\n ToolbarHelper.createToolbarItemFromItemDef(60, getDefaultMapFeatureInfoToolItemDef()),\r\n ];\r\n }\r\n\r\n return [];\r\n }\r\n\r\n // eslint-disable-next-line deprecation/deprecation\r\n public provideWidgets(_stageId: string, stageUsage: string, location: StagePanelLocation, section?: StagePanelSection, zoneLocation?: AbstractZoneLocation): ReadonlyArray<AbstractWidgetProps> {\r\n const widgets: AbstractWidgetProps[] = []; // eslint-disable-line deprecation/deprecation\r\n\r\n // eslint-disable-next-line deprecation/deprecation\r\n if ((undefined === section && stageUsage === StageUsage.General && zoneLocation === AbstractZoneLocation.BottomRight) ||\r\n (stageUsage === StageUsage.General && location === StagePanelLocation.Right && section === StagePanelSection.End && \"1\" !== UiFramework.uiVersion)) { // eslint-disable-line deprecation/deprecation\r\n widgets.push({\r\n id: FeatureInfoUiItemsProvider.widgetId,\r\n label: MapLayersUI.localization.getLocalizedString(\"mapLayers:FeatureInfoWidget.Label\"),\r\n icon: \"icon-map\",\r\n getWidgetContent: () => <MapFeatureInfoWidget featureInfoOpts={this._featureInfoOpts} />, // eslint-disable-line react/display-name\r\n defaultState: WidgetState.Closed, // eslint-disable-line deprecation/deprecation\r\n });\r\n }\r\n\r\n return widgets;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"FeatureInfoUiItemsProvider.js","sourceRoot":"","sources":["../../../src/ui/FeatureInfoUiItemsProvider.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,UAAU,EAAE,aAAa,EAAe,kBAAkB,EAAE,YAAY,EAAmB,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACnL,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,yBAAyB,EAAE,mCAAmC,EAAE,MAAM,sBAAsB,CAAC;AAEtG,MAAM,OAAO,0BAA0B;IAIrC,YAA2B,gBAAuC;QAAvC,qBAAgB,GAAhB,gBAAgB,CAAuB;QAHlD,OAAE,GAAG,4BAA4B,CAAC;IAGoB,CAAC;IAEhE,mBAAmB,CACxB,QAAgB,EAChB,UAAkB,EAClB,YAA0B,EAC1B,kBAAsC;QAEtC,IACE,CAAC,IAAI,CAAC,gBAAgB,EAAE,6BAA6B;YACrD,UAAU,KAAK,UAAU,CAAC,OAAO;YACjC,YAAY,KAAK,YAAY,CAAC,mBAAmB;YACjD,kBAAkB,KAAK,kBAAkB,CAAC,QAAQ,EAClD;YACA,yBAAyB,CAAC,QAAQ,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC;YACtE,OAAO;gBACL,aAAa,CAAC,4BAA4B,CAAC,EAAE,EAAE,mCAAmC,EAAE,CAAC;aACtF,CAAC;SACH;QAED,OAAO,EAAE,CAAC;IACZ,CAAC;IAEM,cAAc,CAAC,QAAgB,EAAE,UAAkB,EAAE,QAA4B,EAAE,OAA2B;QACnH,MAAM,OAAO,GAAG,EAAE,CAAC;QAEnB,MAAM,UAAU,GAAG,OAAO,IAAI,iBAAiB,CAAC,GAAG,CAAC;QACpD,IAAI,UAAU,KAAK,iBAAiB,CAAC,GAAG,IAAK,UAAU,KAAK,UAAU,CAAC,OAAO,IAAI,QAAQ,KAAK,kBAAkB,CAAC,KAAK,EAAI;YACzH,OAAO,CAAC,IAAI,CAAC;gBACX,EAAE,EAAE,0BAA0B,CAAC,QAAQ;gBACvC,KAAK,EAAE,WAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,mCAAmC,CAAC;gBACvF,IAAI,EAAE,UAAU;gBAChB,OAAO,EAAE,oBAAC,oBAAoB,IAAC,eAAe,EAAE,IAAI,CAAC,gBAAgB,GAAI;gBACzE,YAAY,EAAE,WAAW,CAAC,MAAM;aACjC,CAAC,CAAC;SACJ;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;;AAxCsB,mCAAQ,GAAG,iCAAiC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nimport * as React from \"react\";\nimport { StagePanelLocation, StagePanelSection, StageUsage, ToolbarHelper, ToolbarItem, ToolbarOrientation, ToolbarUsage, UiItemsProvider, WidgetState } from \"@itwin/appui-react\";\nimport { MapFeatureInfoWidget } from \"./widget/FeatureInfoWidget\";\nimport { MapFeatureInfoOptions } from \"./Interfaces\";\nimport { MapLayersUI } from \"../mapLayers\";\nimport { DefaultMapFeatureInfoTool, getDefaultMapFeatureInfoToolItemDef } from \"./MapFeatureInfoTool\";\n\nexport class FeatureInfoUiItemsProvider implements UiItemsProvider { // eslint-disable-line deprecation/deprecation\n public readonly id = \"FeatureInfoUiItemsProvider\";\n public static readonly widgetId = \"map-layers:mapFeatureInfoWidget\";\n\n public constructor(private _featureInfoOpts: MapFeatureInfoOptions) { }\n\n public provideToolbarItems(\n _stageId: string,\n stageUsage: string,\n toolbarUsage: ToolbarUsage,\n toolbarOrientation: ToolbarOrientation,\n ): ReadonlyArray<ToolbarItem> {\n if (\n !this._featureInfoOpts?.disableDefaultFeatureInfoTool &&\n stageUsage === StageUsage.General &&\n toolbarUsage === ToolbarUsage.ContentManipulation &&\n toolbarOrientation === ToolbarOrientation.Vertical\n ) {\n DefaultMapFeatureInfoTool.register(MapLayersUI.localizationNamespace);\n return [\n ToolbarHelper.createToolbarItemFromItemDef(60, getDefaultMapFeatureInfoToolItemDef()),\n ];\n }\n\n return [];\n }\n\n public provideWidgets(_stageId: string, stageUsage: string, location: StagePanelLocation, section?: StagePanelSection) {\n const widgets = [];\n\n const tmpSection = section ?? StagePanelSection.End;\n if (tmpSection === StagePanelSection.End && stageUsage === StageUsage.General && location === StagePanelLocation.Right ) {\n widgets.push({\n id: FeatureInfoUiItemsProvider.widgetId,\n label: MapLayersUI.localization.getLocalizedString(\"mapLayers:FeatureInfoWidget.Label\"),\n icon: \"icon-map\",\n content: <MapFeatureInfoWidget featureInfoOpts={this._featureInfoOpts} />,\n defaultState: WidgetState.Closed,\n });\n }\n\n return widgets;\n }\n}\n"]}
@@ -1,51 +1,51 @@
1
- import { BeEvent } from "@itwin/core-bentley";
2
- import { MapSubLayerProps } from "@itwin/core-common";
3
- import { HitDetail, MapLayerImageryProvider, MapTileTreeScaleRangeVisibility } from "@itwin/core-frontend";
4
- export interface StyleMapLayerSettings {
5
- /** Name */
6
- name: string;
7
- /** source (i.URL for ImageMapLayerSettings or modelId for ModelMapLayerSettings) */
8
- source: string;
9
- /** Controls visibility of layer */
10
- visible: boolean;
11
- treeVisibility: MapTileTreeScaleRangeVisibility;
12
- /** A transparency value from 0.0 (fully opaque) to 1.0 (fully transparent) to apply to map graphics when drawing, or false to indicate the transparency should not be overridden. Default value: false. */
13
- transparency: number;
14
- /** Transparent background */
15
- transparentBackground: boolean;
16
- /** set map as underlay or overlay */
17
- isOverlay: boolean;
18
- /** layer index in the viewport */
19
- layerIndex: number;
20
- /** Available map sub-layer */
21
- subLayers?: MapSubLayerProps[];
22
- /** sub-layer panel displayed. */
23
- showSubLayers: boolean;
24
- /** Some format can publish only a single layer at a time (i.e WMTS) */
25
- provider?: MapLayerImageryProvider;
26
- }
27
- export interface MapTypesOptions {
28
- readonly supportTileUrl: boolean;
29
- readonly supportWmsAuthentication: boolean;
30
- }
31
- export interface MapLayerOptions {
32
- hideExternalMapLayers?: boolean;
33
- fetchPublicMapLayerSources?: boolean;
34
- mapTypeOptions?: MapTypesOptions;
35
- }
36
- export interface MapFeatureInfoPropertyGridOptions {
37
- isPropertySelectionEnabled?: boolean;
38
- }
39
- export declare type MapHitEvent = BeEvent<(hit: HitDetail) => void>;
40
- export interface MapFeatureInfoOptions {
41
- /**
42
- * HitDetail Event whenever the map is clicked.
43
- * Typically the HitDetail object is provided by ElementLocateManager.doLocate.
44
- * Every time this event is raised, FeatureInfoWidget will attempt to retrieve data from MapLayerImageryProviders.
45
- */
46
- onMapHit: MapHitEvent;
47
- disableDefaultFeatureInfoTool?: boolean;
48
- showLoadProgressAnimation?: boolean;
49
- propertyGridOptions?: MapFeatureInfoPropertyGridOptions;
50
- }
1
+ import { BeEvent } from "@itwin/core-bentley";
2
+ import { MapSubLayerProps } from "@itwin/core-common";
3
+ import { HitDetail, MapLayerImageryProvider, MapTileTreeScaleRangeVisibility } from "@itwin/core-frontend";
4
+ export interface StyleMapLayerSettings {
5
+ /** Name */
6
+ name: string;
7
+ /** source (i.URL for ImageMapLayerSettings or modelId for ModelMapLayerSettings) */
8
+ source: string;
9
+ /** Controls visibility of layer */
10
+ visible: boolean;
11
+ treeVisibility: MapTileTreeScaleRangeVisibility;
12
+ /** A transparency value from 0.0 (fully opaque) to 1.0 (fully transparent) to apply to map graphics when drawing, or false to indicate the transparency should not be overridden. Default value: false. */
13
+ transparency: number;
14
+ /** Transparent background */
15
+ transparentBackground: boolean;
16
+ /** set map as underlay or overlay */
17
+ isOverlay: boolean;
18
+ /** layer index in the viewport */
19
+ layerIndex: number;
20
+ /** Available map sub-layer */
21
+ subLayers?: MapSubLayerProps[];
22
+ /** sub-layer panel displayed. */
23
+ showSubLayers: boolean;
24
+ /** Some format can publish only a single layer at a time (i.e WMTS) */
25
+ provider?: MapLayerImageryProvider;
26
+ }
27
+ export interface MapTypesOptions {
28
+ readonly supportTileUrl: boolean;
29
+ readonly supportWmsAuthentication: boolean;
30
+ }
31
+ export interface MapLayerOptions {
32
+ hideExternalMapLayers?: boolean;
33
+ fetchPublicMapLayerSources?: boolean;
34
+ mapTypeOptions?: MapTypesOptions;
35
+ }
36
+ export interface MapFeatureInfoPropertyGridOptions {
37
+ isPropertySelectionEnabled?: boolean;
38
+ }
39
+ export declare type MapHitEvent = BeEvent<(hit: HitDetail) => void>;
40
+ export interface MapFeatureInfoOptions {
41
+ /**
42
+ * HitDetail Event whenever the map is clicked.
43
+ * Typically the HitDetail object is provided by ElementLocateManager.doLocate.
44
+ * Every time this event is raised, FeatureInfoWidget will attempt to retrieve data from MapLayerImageryProviders.
45
+ */
46
+ onMapHit: MapHitEvent;
47
+ disableDefaultFeatureInfoTool?: boolean;
48
+ showLoadProgressAnimation?: boolean;
49
+ propertyGridOptions?: MapFeatureInfoPropertyGridOptions;
50
+ }
51
51
  //# sourceMappingURL=Interfaces.d.ts.map