@itwin/map-layers 5.3.0 → 5.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -2
- package/lib/cjs/BrowserStorage.d.ts +25 -0
- package/lib/cjs/BrowserStorage.d.ts.map +1 -0
- package/lib/cjs/BrowserStorage.js +80 -0
- package/lib/cjs/BrowserStorage.js.map +1 -0
- package/lib/cjs/CustomParamUtils.d.ts +5 -0
- package/lib/cjs/CustomParamUtils.d.ts.map +1 -0
- package/lib/cjs/CustomParamUtils.js +26 -0
- package/lib/cjs/CustomParamUtils.js.map +1 -0
- package/lib/cjs/CustomParamsMappingStorage.d.ts +6 -0
- package/lib/cjs/CustomParamsMappingStorage.d.ts.map +1 -0
- package/lib/cjs/CustomParamsMappingStorage.js +15 -0
- package/lib/cjs/CustomParamsMappingStorage.js.map +1 -0
- package/lib/cjs/CustomParamsStorage.d.ts +6 -0
- package/lib/cjs/CustomParamsStorage.d.ts.map +1 -0
- package/lib/cjs/CustomParamsStorage.js +15 -0
- package/lib/cjs/CustomParamsStorage.js.map +1 -0
- package/lib/cjs/MapLayerPreferences.d.ts.map +1 -1
- package/lib/cjs/MapLayerPreferences.js +2 -0
- package/lib/cjs/MapLayerPreferences.js.map +1 -1
- package/lib/cjs/PreferencesBrowserStorage.d.ts +9 -2
- package/lib/cjs/PreferencesBrowserStorage.d.ts.map +1 -1
- package/lib/cjs/PreferencesBrowserStorage.js +11 -51
- package/lib/cjs/PreferencesBrowserStorage.js.map +1 -1
- package/lib/cjs/public/locales/en/mapLayers.json +29 -3
- package/lib/cjs/ui/FeatureInfoUiItemsProvider.d.ts +1 -1
- package/lib/cjs/ui/FeatureInfoUiItemsProvider.js +1 -1
- package/lib/cjs/ui/FeatureInfoUiItemsProvider.js.map +1 -1
- package/lib/cjs/ui/Interfaces.d.ts +11 -0
- package/lib/cjs/ui/Interfaces.d.ts.map +1 -1
- package/lib/cjs/ui/Interfaces.js.map +1 -1
- package/lib/cjs/ui/widget/AttachLayerPopupButton.d.ts.map +1 -1
- package/lib/cjs/ui/widget/AttachLayerPopupButton.js +20 -18
- package/lib/cjs/ui/widget/AttachLayerPopupButton.js.map +1 -1
- package/lib/cjs/ui/widget/CustomParamEditDialog.d.ts +11 -0
- package/lib/cjs/ui/widget/CustomParamEditDialog.d.ts.map +1 -0
- package/lib/cjs/ui/widget/CustomParamEditDialog.js +57 -0
- package/lib/cjs/ui/widget/CustomParamEditDialog.js.map +1 -0
- package/lib/cjs/ui/widget/CustomParamEditDialog.scss +26 -0
- package/lib/cjs/ui/widget/CustomParamsSettings.d.ts +4 -0
- package/lib/cjs/ui/widget/CustomParamsSettings.d.ts.map +1 -0
- package/lib/cjs/ui/widget/CustomParamsSettings.js +116 -0
- package/lib/cjs/ui/widget/CustomParamsSettings.js.map +1 -0
- package/lib/cjs/ui/widget/CustomParamsSettings.scss +67 -0
- package/lib/cjs/ui/widget/MapLayerDroppable.d.ts +3 -3
- package/lib/cjs/ui/widget/MapLayerDroppable.d.ts.map +1 -1
- package/lib/cjs/ui/widget/MapLayerDroppable.js +23 -10
- package/lib/cjs/ui/widget/MapLayerDroppable.js.map +1 -1
- package/lib/cjs/ui/widget/MapLayerManager.d.ts +2 -2
- package/lib/cjs/ui/widget/MapLayerManager.d.ts.map +1 -1
- package/lib/cjs/ui/widget/MapLayerManager.js +19 -11
- package/lib/cjs/ui/widget/MapLayerManager.js.map +1 -1
- package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.d.ts.map +1 -1
- package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.js +1 -1
- package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.js.map +1 -1
- package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.scss +4 -1
- package/lib/cjs/ui/widget/MapManagerSettings.d.ts.map +1 -1
- package/lib/cjs/ui/widget/MapManagerSettings.js +37 -29
- package/lib/cjs/ui/widget/MapManagerSettings.js.map +1 -1
- package/lib/cjs/ui/widget/MapUrlDialog.d.ts +15 -5
- package/lib/cjs/ui/widget/MapUrlDialog.d.ts.map +1 -1
- package/lib/cjs/ui/widget/MapUrlDialog.js +129 -58
- package/lib/cjs/ui/widget/MapUrlDialog.js.map +1 -1
- package/lib/cjs/ui/widget/MapUrlDialog.scss +12 -1
- package/lib/cjs/ui/widget/SelectApiKey.d.ts +10 -0
- package/lib/cjs/ui/widget/SelectApiKey.d.ts.map +1 -0
- package/lib/cjs/ui/widget/SelectApiKey.js +39 -0
- package/lib/cjs/ui/widget/SelectApiKey.js.map +1 -0
- package/lib/cjs/ui/widget/SelectCustomParam.d.ts +10 -0
- package/lib/cjs/ui/widget/SelectCustomParam.d.ts.map +1 -0
- package/lib/cjs/ui/widget/SelectCustomParam.js +49 -0
- package/lib/cjs/ui/widget/SelectCustomParam.js.map +1 -0
- package/lib/cjs/ui/widget/SelectMapFormat.d.ts +11 -2
- package/lib/cjs/ui/widget/SelectMapFormat.d.ts.map +1 -1
- package/lib/cjs/ui/widget/SelectMapFormat.js +5 -6
- package/lib/cjs/ui/widget/SelectMapFormat.js.map +1 -1
- package/lib/cjs/ui/widget/UserPreferencesStorageOptions.d.ts +10 -0
- package/lib/cjs/ui/widget/UserPreferencesStorageOptions.d.ts.map +1 -0
- package/lib/cjs/ui/widget/UserPreferencesStorageOptions.js +17 -0
- package/lib/cjs/ui/widget/UserPreferencesStorageOptions.js.map +1 -0
- package/lib/esm/BrowserStorage.d.ts +25 -0
- package/lib/esm/BrowserStorage.d.ts.map +1 -0
- package/lib/esm/BrowserStorage.js +76 -0
- package/lib/esm/BrowserStorage.js.map +1 -0
- package/lib/esm/CustomParamUtils.d.ts +5 -0
- package/lib/esm/CustomParamUtils.d.ts.map +1 -0
- package/lib/esm/CustomParamUtils.js +22 -0
- package/lib/esm/CustomParamUtils.js.map +1 -0
- package/lib/esm/CustomParamsMappingStorage.d.ts +6 -0
- package/lib/esm/CustomParamsMappingStorage.d.ts.map +1 -0
- package/lib/esm/CustomParamsMappingStorage.js +11 -0
- package/lib/esm/CustomParamsMappingStorage.js.map +1 -0
- package/lib/esm/CustomParamsStorage.d.ts +6 -0
- package/lib/esm/CustomParamsStorage.d.ts.map +1 -0
- package/lib/esm/CustomParamsStorage.js +11 -0
- package/lib/esm/CustomParamsStorage.js.map +1 -0
- package/lib/esm/MapLayerPreferences.d.ts.map +1 -1
- package/lib/esm/MapLayerPreferences.js +2 -0
- package/lib/esm/MapLayerPreferences.js.map +1 -1
- package/lib/esm/PreferencesBrowserStorage.d.ts +9 -2
- package/lib/esm/PreferencesBrowserStorage.d.ts.map +1 -1
- package/lib/esm/PreferencesBrowserStorage.js +11 -51
- package/lib/esm/PreferencesBrowserStorage.js.map +1 -1
- package/lib/esm/public/locales/en/mapLayers.json +29 -3
- package/lib/esm/ui/FeatureInfoUiItemsProvider.d.ts +1 -1
- package/lib/esm/ui/FeatureInfoUiItemsProvider.js +1 -1
- package/lib/esm/ui/FeatureInfoUiItemsProvider.js.map +1 -1
- package/lib/esm/ui/Interfaces.d.ts +11 -0
- package/lib/esm/ui/Interfaces.d.ts.map +1 -1
- package/lib/esm/ui/Interfaces.js.map +1 -1
- package/lib/esm/ui/widget/AttachLayerPopupButton.d.ts.map +1 -1
- package/lib/esm/ui/widget/AttachLayerPopupButton.js +20 -18
- package/lib/esm/ui/widget/AttachLayerPopupButton.js.map +1 -1
- package/lib/esm/ui/widget/CustomParamEditDialog.d.ts +11 -0
- package/lib/esm/ui/widget/CustomParamEditDialog.d.ts.map +1 -0
- package/lib/esm/ui/widget/CustomParamEditDialog.js +53 -0
- package/lib/esm/ui/widget/CustomParamEditDialog.js.map +1 -0
- package/lib/esm/ui/widget/CustomParamEditDialog.scss +26 -0
- package/lib/esm/ui/widget/CustomParamsSettings.d.ts +4 -0
- package/lib/esm/ui/widget/CustomParamsSettings.d.ts.map +1 -0
- package/lib/esm/ui/widget/CustomParamsSettings.js +112 -0
- package/lib/esm/ui/widget/CustomParamsSettings.js.map +1 -0
- package/lib/esm/ui/widget/CustomParamsSettings.scss +67 -0
- package/lib/esm/ui/widget/MapLayerDroppable.d.ts +3 -3
- package/lib/esm/ui/widget/MapLayerDroppable.d.ts.map +1 -1
- package/lib/esm/ui/widget/MapLayerDroppable.js +24 -11
- package/lib/esm/ui/widget/MapLayerDroppable.js.map +1 -1
- package/lib/esm/ui/widget/MapLayerManager.d.ts +2 -2
- package/lib/esm/ui/widget/MapLayerManager.d.ts.map +1 -1
- package/lib/esm/ui/widget/MapLayerManager.js +20 -12
- package/lib/esm/ui/widget/MapLayerManager.js.map +1 -1
- package/lib/esm/ui/widget/MapLayerSettingsPopupButton.d.ts.map +1 -1
- package/lib/esm/ui/widget/MapLayerSettingsPopupButton.js +1 -1
- package/lib/esm/ui/widget/MapLayerSettingsPopupButton.js.map +1 -1
- package/lib/esm/ui/widget/MapLayerSettingsPopupButton.scss +4 -1
- package/lib/esm/ui/widget/MapManagerSettings.d.ts.map +1 -1
- package/lib/esm/ui/widget/MapManagerSettings.js +38 -30
- package/lib/esm/ui/widget/MapManagerSettings.js.map +1 -1
- package/lib/esm/ui/widget/MapUrlDialog.d.ts +15 -5
- package/lib/esm/ui/widget/MapUrlDialog.d.ts.map +1 -1
- package/lib/esm/ui/widget/MapUrlDialog.js +129 -58
- package/lib/esm/ui/widget/MapUrlDialog.js.map +1 -1
- package/lib/esm/ui/widget/MapUrlDialog.scss +12 -1
- package/lib/esm/ui/widget/SelectApiKey.d.ts +10 -0
- package/lib/esm/ui/widget/SelectApiKey.d.ts.map +1 -0
- package/lib/esm/ui/widget/SelectApiKey.js +35 -0
- package/lib/esm/ui/widget/SelectApiKey.js.map +1 -0
- package/lib/esm/ui/widget/SelectCustomParam.d.ts +10 -0
- package/lib/esm/ui/widget/SelectCustomParam.d.ts.map +1 -0
- package/lib/esm/ui/widget/SelectCustomParam.js +45 -0
- package/lib/esm/ui/widget/SelectCustomParam.js.map +1 -0
- package/lib/esm/ui/widget/SelectMapFormat.d.ts +11 -2
- package/lib/esm/ui/widget/SelectMapFormat.d.ts.map +1 -1
- package/lib/esm/ui/widget/SelectMapFormat.js +5 -6
- package/lib/esm/ui/widget/SelectMapFormat.js.map +1 -1
- package/lib/esm/ui/widget/UserPreferencesStorageOptions.d.ts +10 -0
- package/lib/esm/ui/widget/UserPreferencesStorageOptions.d.ts.map +1 -0
- package/lib/esm/ui/widget/UserPreferencesStorageOptions.js +13 -0
- package/lib/esm/ui/widget/UserPreferencesStorageOptions.js.map +1 -0
- package/lib/public/locales/en/mapLayers.json +29 -3
- package/package.json +6 -6
|
@@ -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,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,SAAS,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,MAAM,SAAS,CAAC,mBAAmB,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAErI,MAAM,UAAU,GAAG,MAAM,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AC,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: 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
|
+
{"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,SAAS,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,MAAM,SAAS,CAAC,mBAAmB,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAErI,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;QACnC,IAAI,CAAC,UAAU,CAAC,QAAQ;YACtB,OAAO,KAAK,CAAC;QACf,MAAM,eAAe,GAA+B;YAClD,GAAG,EAAE,UAAU,CAAC,GAAG;YACnB,IAAI,EAAE,UAAU,CAAC,IAAI;YACrB,QAAQ,EAAE,UAAU,CAA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AClD,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;;AAlTD;;;;;;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 if (!sourceJSON.formatId)\n return false;\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: 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,4 +1,11 @@
|
|
|
1
1
|
import { ITwinIdArg, PreferenceArg, PreferenceKeyArg, UserPreferencesAccess } from "@itwin/core-frontend";
|
|
2
|
+
/** Index signature holding preferences content
|
|
3
|
+
*
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
interface KeyContentProps {
|
|
7
|
+
[preferenceKey: string]: any;
|
|
8
|
+
}
|
|
2
9
|
/**
|
|
3
10
|
* @beta
|
|
4
11
|
*/
|
|
@@ -28,9 +35,9 @@ export declare class PreferencesBrowserStorage implements UserPreferencesAccess
|
|
|
28
35
|
constructor(storageItemKeyPrefix: string, opts?: PreferencesBrowserStorageOptions);
|
|
29
36
|
private getStorageItemKey;
|
|
30
37
|
private static getPreferenceKey;
|
|
31
|
-
|
|
32
|
-
get(arg: PreferenceKeyArg & ITwinIdArg): Promise<any[] | undefined>;
|
|
38
|
+
get(arg: PreferenceKeyArg & ITwinIdArg): Promise<KeyContentProps[] | undefined>;
|
|
33
39
|
delete(arg: PreferenceKeyArg & ITwinIdArg): Promise<void>;
|
|
34
40
|
save(arg: PreferenceArg & ITwinIdArg): Promise<void>;
|
|
35
41
|
}
|
|
42
|
+
export {};
|
|
36
43
|
//# sourceMappingURL=PreferencesBrowserStorage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PreferencesBrowserStorage.d.ts","sourceRoot":"","sources":["../../src/PreferencesBrowserStorage.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"PreferencesBrowserStorage.d.ts","sourceRoot":"","sources":["../../src/PreferencesBrowserStorage.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAG1G;;;GAGG;AACH,UAAU,eAAe;IACvB,CAAC,aAAa,EAAE,MAAM,GAAG,GAAG,CAAC;CAC9B;AAED;;EAEE;AACF,MAAM,WAAW,gCAAgC;IAC/C,yGAAyG;IACzG,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AAED;;;;;;;;;;;;;;;EAeE;AACF,qBAAa,yBAA0B,YAAW,qBAAqB;IAErE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA+C;IACxE,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAS;gBAEnC,oBAAoB,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,gCAAgC;IAKjF,OAAO,CAAC,iBAAiB;IAMzB,OAAO,CAAC,MAAM,CAAC,gBAAgB;IASlB,GAAG,CAAC,GAAG,EAAE,gBAAgB,GAAG,UAAU;IAKtC,MAAM,CAAC,GAAG,EAAE,gBAAgB,GAAG,UAAU;IAKzC,IAAI,CAAC,GAAG,EAAE,aAAa,GAAG,UAAU;CAIlD"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BrowserStorage } from "./BrowserStorage";
|
|
1
2
|
/** User preferences implementation using browser's local storage.
|
|
2
3
|
* It creates storage item key in the form of:
|
|
3
4
|
* <storageItemKeyPrefix>.<itwin_guid?>.<imodel_guid?>
|
|
@@ -25,64 +26,23 @@ export class PreferencesBrowserStorage {
|
|
|
25
26
|
return `${this._storageItemKeyPrefix}${itwinIdStr}${imodelIdStr}`;
|
|
26
27
|
}
|
|
27
28
|
static getPreferenceKey(arg) {
|
|
28
|
-
const nsStr = arg.namespace ? `${arg.namespace}.` : "";
|
|
29
|
-
return `${nsStr}${arg.key}`;
|
|
30
|
-
}
|
|
31
|
-
loadFromStorage(arg) {
|
|
32
|
-
const storage = window.localStorage;
|
|
33
|
-
let map = {};
|
|
34
|
-
const itemStr = storage.getItem(this.getStorageItemKey(arg));
|
|
35
|
-
if (itemStr === null) {
|
|
36
|
-
return undefined;
|
|
37
|
-
}
|
|
38
|
-
if (!itemStr || itemStr === "{}")
|
|
39
|
-
return map;
|
|
40
|
-
map = JSON.parse(itemStr);
|
|
41
|
-
return map;
|
|
42
|
-
}
|
|
43
|
-
async get(arg) {
|
|
44
|
-
const map = this.loadFromStorage(arg);
|
|
45
|
-
if (map === undefined)
|
|
46
|
-
return undefined;
|
|
47
29
|
if (arg.key) {
|
|
48
|
-
if (!Object.keys(map).includes(arg.key))
|
|
49
|
-
return undefined;
|
|
50
30
|
const nsStr = arg.namespace ? `${arg.namespace}.` : "";
|
|
51
|
-
|
|
52
|
-
return [map[prefKey]];
|
|
53
|
-
}
|
|
54
|
-
else { // No key provided, return all objects
|
|
55
|
-
const values = [];
|
|
56
|
-
for (const [_key, value] of Object.entries(map))
|
|
57
|
-
values.push(value);
|
|
58
|
-
return values;
|
|
31
|
+
return `${nsStr}${arg.key}`;
|
|
59
32
|
}
|
|
33
|
+
return "";
|
|
34
|
+
}
|
|
35
|
+
async get(arg) {
|
|
36
|
+
const storage = new BrowserStorage({ itemKeyName: this.getStorageItemKey(arg) });
|
|
37
|
+
return storage.get(PreferencesBrowserStorage.getPreferenceKey(arg));
|
|
60
38
|
}
|
|
61
39
|
async delete(arg) {
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
if (this._options?.throwOnDeleteMissingKey)
|
|
65
|
-
throw new Error("Could not find key from storage.");
|
|
66
|
-
else
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
const prefKey = PreferencesBrowserStorage.getPreferenceKey(arg);
|
|
70
|
-
if (!Object.keys(map).includes(prefKey)) {
|
|
71
|
-
if (this._options?.throwOnDeleteMissingKey)
|
|
72
|
-
throw Error("Could not find key from storage.");
|
|
73
|
-
else
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
delete map[prefKey];
|
|
77
|
-
window.localStorage.setItem(this.getStorageItemKey(arg), JSON.stringify(map));
|
|
40
|
+
const storage = new BrowserStorage({ itemKeyName: this.getStorageItemKey(arg) });
|
|
41
|
+
storage.delete(PreferencesBrowserStorage.getPreferenceKey(arg));
|
|
78
42
|
}
|
|
79
43
|
async save(arg) {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
map = {};
|
|
83
|
-
map[PreferencesBrowserStorage.getPreferenceKey(arg)] = arg.content;
|
|
84
|
-
const itemValue = JSON.stringify(map);
|
|
85
|
-
window.localStorage.setItem(this.getStorageItemKey(arg), itemValue);
|
|
44
|
+
const storage = new BrowserStorage({ itemKeyName: this.getStorageItemKey(arg) });
|
|
45
|
+
storage.save(PreferencesBrowserStorage.getPreferenceKey(arg), arg.content);
|
|
86
46
|
}
|
|
87
47
|
}
|
|
88
48
|
//# sourceMappingURL=PreferencesBrowserStorage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PreferencesBrowserStorage.js","sourceRoot":"","sources":["../../src/PreferencesBrowserStorage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PreferencesBrowserStorage.js","sourceRoot":"","sources":["../../src/PreferencesBrowserStorage.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAkBlD;;;;;;;;;;;;;;;EAeE;AACF,MAAM,OAAO,yBAAyB;IAKpC,YAAY,oBAA4B,EAAE,IAAuC;QAC/E,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,qBAAqB,GAAG,oBAAoB,CAAC;IACpD,CAAC;IAEO,iBAAiB,CAAC,GAAe;QACvC,MAAM,UAAU,GAAG,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACxD,MAAM,WAAW,GAAG,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3D,OAAO,GAAG,IAAI,CAAC,qBAAqB,GAAG,UAAU,GAAG,WAAW,EAAE,CAAC;IACpE,CAAC;IAEO,MAAM,CAAC,gBAAgB,CAAC,GAAqB;QACnD,IAAI,GAAG,CAAC,GAAG,EAAE;YACX,MAAM,KAAK,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;YACvD,OAAO,GAAG,KAAK,GAAG,GAAG,CAAC,GAAG,EAAE,CAAC;SAC7B;QAED,OAAO,EAAE,CAAC;IACZ,CAAC;IAEM,KAAK,CAAC,GAAG,CAAC,GAAkC;QACjD,MAAM,OAAO,GAAG,IAAI,cAAc,CAAkB,EAAC,WAAW,EAAE,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,EAAC,CAAC,CAAC;QAChG,OAAO,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC;IACtE,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,GAAkC;QACpD,MAAM,OAAO,GAAG,IAAI,cAAc,CAAkB,EAAC,WAAW,EAAE,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,EAAC,CAAC,CAAC;QAChG,OAAO,CAAC,MAAM,CAAC,yBAAyB,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC;IAClE,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,GAA+B;QAC/C,MAAM,OAAO,GAAG,IAAI,cAAc,CAAkB,EAAC,WAAW,EAAE,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,EAAC,CAAC,CAAC;QAChG,OAAO,CAAC,IAAI,CAAC,yBAAyB,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IAC7E,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { ITwinIdArg, PreferenceArg, PreferenceKeyArg, UserPreferencesAccess } from \"@itwin/core-frontend\";\nimport { BrowserStorage } from \"./BrowserStorage\";\n\n/** Index signature holding preferences content\n *\n * @internal\n */\ninterface KeyContentProps {\n [preferenceKey: string]: any;\n}\n\n/**\n* @beta\n*/\nexport interface PreferencesBrowserStorageOptions {\n /** indicate whether or not delete function should throw an error if the provided key cannot be found. */\n throwOnDeleteMissingKey?: boolean;\n}\n\n/** User preferences implementation using browser's local storage.\n * It creates storage item key in the form of:\n * <storageItemKeyPrefix>.<itwin_guid?>.<imodel_guid?>\n *\n * <itwin_guid> and <imodel_guid> being optional.\n *\n * Each entry in the storage is a serialized JSON of the following index signature:\n * {\n * \"<preference_namespace?>.<preference_key>\": {\n * ...\n * <preferences_json_content>\n * },\n * ...\n * }\n * @beta\n*/\nexport class PreferencesBrowserStorage implements UserPreferencesAccess {\n\n private readonly _options: PreferencesBrowserStorageOptions | undefined;\n private readonly _storageItemKeyPrefix: string;\n\n constructor(storageItemKeyPrefix: string, opts?: PreferencesBrowserStorageOptions) {\n this._options = opts;\n this._storageItemKeyPrefix = storageItemKeyPrefix;\n }\n\n private getStorageItemKey(arg: ITwinIdArg) {\n const itwinIdStr = arg.iTwinId ? `.${arg.iTwinId}` : \"\";\n const imodelIdStr = arg.iModelId ? `.${arg.iModelId}` : \"\";\n return `${this._storageItemKeyPrefix}${itwinIdStr}${imodelIdStr}`;\n }\n\n private static getPreferenceKey(arg: PreferenceKeyArg) {\n if (arg.key) {\n const nsStr = arg.namespace ? `${arg.namespace}.` : \"\";\n return `${nsStr}${arg.key}`;\n }\n\n return \"\";\n }\n\n public async get(arg: PreferenceKeyArg & ITwinIdArg) {\n const storage = new BrowserStorage<KeyContentProps>({itemKeyName: this.getStorageItemKey(arg)});\n return storage.get(PreferencesBrowserStorage.getPreferenceKey(arg));\n }\n\n public async delete(arg: PreferenceKeyArg & ITwinIdArg) {\n const storage = new BrowserStorage<KeyContentProps>({itemKeyName: this.getStorageItemKey(arg)});\n storage.delete(PreferencesBrowserStorage.getPreferenceKey(arg));\n }\n\n public async save(arg: PreferenceArg & ITwinIdArg) {\n const storage = new BrowserStorage<KeyContentProps>({itemKeyName: this.getStorageItemKey(arg)});\n storage.save(PreferencesBrowserStorage.getPreferenceKey(arg), arg.content);\n }\n}\n"]}
|
|
@@ -23,6 +23,28 @@
|
|
|
23
23
|
"AllOn": "Select All",
|
|
24
24
|
"AllOff": "Select None"
|
|
25
25
|
},
|
|
26
|
+
"CustomParamEditDialog":
|
|
27
|
+
{
|
|
28
|
+
"DialogTitleAdd": "Add custom query parameter",
|
|
29
|
+
"DialogTitleEdit": "Edit custom query parameter",
|
|
30
|
+
"NameExists": "Name already exists",
|
|
31
|
+
"ParamKeyLabel": "Key",
|
|
32
|
+
"ParamNameLabel": "Name",
|
|
33
|
+
"ParamValueLabel": "Value",
|
|
34
|
+
"ParamValueNonPrivateMessage": "Value should not contain sensitive data",
|
|
35
|
+
"PrivateToggleTooltip": "Private query parameters won't be saved part of the iTwin",
|
|
36
|
+
"PrivateToggleLabel": "Keep query parameter private"
|
|
37
|
+
},
|
|
38
|
+
"CustomParamSelect":
|
|
39
|
+
{
|
|
40
|
+
"DisabledTitle": "Custom query parameter can be configured in the advanced settings"
|
|
41
|
+
},
|
|
42
|
+
"CustomParamSettings":
|
|
43
|
+
{
|
|
44
|
+
"DeleteButtonTitle": "Delete custom parameter",
|
|
45
|
+
"EditButtonTitle": "Edit custom parameter",
|
|
46
|
+
"SectionLabel": "Custom parameters"
|
|
47
|
+
},
|
|
26
48
|
"MapLayerActionButtons": {
|
|
27
49
|
"ShowAllLabel": "Show all",
|
|
28
50
|
"HideAllLabel": "Hide all",
|
|
@@ -38,9 +60,10 @@
|
|
|
38
60
|
"AttachCustomLayer": "Add New Layer",
|
|
39
61
|
"AttacheInfo": "Map layer attached from URL:",
|
|
40
62
|
"Custom": "New",
|
|
63
|
+
"CustomParamsLabel": "Custom Query Parameters",
|
|
41
64
|
"LoadingMapSources": "Loading Map Sources",
|
|
42
65
|
"EditCustomLayer": "Edit Layer",
|
|
43
|
-
"EditLayerDefButtonTitle": "Edit
|
|
66
|
+
"EditLayerDefButtonTitle": "Edit layer definition",
|
|
44
67
|
"ErrorLoadingLayers": "Error retrieving map layers stored in the settings service",
|
|
45
68
|
"ErrorRetrieveUserModel": "Could not get saved Map Layers for user by model: {{errorMessage}}",
|
|
46
69
|
"ErrorRetrieveUserITwin": "Could not get saved Map Layers for user by iTwin: {{errorMessage}}",
|
|
@@ -53,6 +76,7 @@
|
|
|
53
76
|
"ExternalLoginWaiting": "Waiting for external login process to complete...",
|
|
54
77
|
"InvalidCredentials": "Invalid credentials provided",
|
|
55
78
|
"InvalidCoordinateSystem": "Map layer geographic coordinate system is not supported",
|
|
79
|
+
"InvalidType": "Invalid Type",
|
|
56
80
|
"MissingCredentials": "This layer requires credentials to be provided",
|
|
57
81
|
"Name": "Name",
|
|
58
82
|
"NameInputPlaceHolder": "Enter Map Name",
|
|
@@ -66,7 +90,6 @@
|
|
|
66
90
|
"SelectLayersToCreate": "Select Layers To Add",
|
|
67
91
|
"StoreOnModelSettings": "Store on Model Settings",
|
|
68
92
|
"StoreOnITwinSettings": "Store on iTwin Settings",
|
|
69
|
-
"TechPreviewBadgeTooltip": "Technology preview",
|
|
70
93
|
"TooManyLayersSelected": "{{layerCount}} layers selected; performance may be affected.",
|
|
71
94
|
"Type": "Type",
|
|
72
95
|
"URL": "URL",
|
|
@@ -80,6 +103,9 @@
|
|
|
80
103
|
"Username": "Username",
|
|
81
104
|
"UsernameRequired": "Username required"
|
|
82
105
|
},
|
|
106
|
+
"Labels" : {
|
|
107
|
+
"TechPreviewBadgeTooltip": "Technology preview"
|
|
108
|
+
},
|
|
83
109
|
"Messages": {
|
|
84
110
|
"NotSupported": "No active viewport or geo-located iModel available.",
|
|
85
111
|
"NoRangeDefined": "No range is defined for Map Layer",
|
|
@@ -155,4 +181,4 @@
|
|
|
155
181
|
"Street" : "Bing Maps: Streets"
|
|
156
182
|
}
|
|
157
183
|
}
|
|
158
|
-
}
|
|
184
|
+
}
|
|
@@ -15,7 +15,7 @@ export declare class FeatureInfoUiItemsProvider implements UiItemsProvider {
|
|
|
15
15
|
icon: JSX.Element;
|
|
16
16
|
content: JSX.Element;
|
|
17
17
|
defaultState: WidgetState;
|
|
18
|
-
|
|
18
|
+
badge: BadgeType;
|
|
19
19
|
}[];
|
|
20
20
|
}
|
|
21
21
|
//# sourceMappingURL=FeatureInfoUiItemsProvider.d.ts.map
|
|
@@ -44,7 +44,7 @@ export class FeatureInfoUiItemsProvider {
|
|
|
44
44
|
icon: React.createElement(SvgMapInfo, null),
|
|
45
45
|
content: React.createElement(MapFeatureInfoWidget, { featureInfoOpts: this._featureInfoOpts }),
|
|
46
46
|
defaultState: WidgetState.Hidden,
|
|
47
|
-
|
|
47
|
+
badge: BadgeType.TechnicalPreview,
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
return widgets;
|
|
@@ -1 +1 @@
|
|
|
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,EAAE,WAAW,EAAmB,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAChM,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,SAAS,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,oBAAoB,IAAC,eAAe,EAAE,IAAI,CAAC,gBAAgB,GAAI;gBACzE,YAAY,EAAE,WAAW,CAAC,MAAM;gBAChC,KAAK,EAAE,SAAS,CAAC,gBAAgB;aAClC,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, ToolItemDef, UiItemsProvider, WidgetState } from \"@itwin/appui-react\";\nimport { MapFeatureInfoWidget } from \"./widget/FeatureInfoWidget\";\nimport { MapFeatureInfoOptions } from \"./Interfaces\";\nimport { MapLayersUI } from \"../mapLayers\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport { MapFeatureInfoTool } from \"@itwin/map-layers-formats\";\nimport { SvgMapInfo } from \"@itwin/itwinui-icons-react\";\nimport { BadgeType } from \"@itwin/appui-abstract\";\n\nexport const getMapFeatureInfoToolItemDef = (): ToolItemDef =>\n new ToolItemDef({\n toolId: MapFeatureInfoTool.toolId,\n iconSpec: <SvgMapInfo/>,\n label: MapLayersUI.localization.getLocalizedString(\"mapLayers:FeatureInfoWidget.Label\"),\n description: () => MapFeatureInfoTool.description,\n execute: async () => { await IModelApp.tools.run(MapFeatureInfoTool.toolId); },\n badgeType: BadgeType.TechnicalPreview,\n });\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 return [\n ToolbarHelper.createToolbarItemFromItemDef(60, getMapFeatureInfoToolItemDef()),\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: <SvgMapInfo/>,\n content: <MapFeatureInfoWidget featureInfoOpts={this._featureInfoOpts} />,\n defaultState: WidgetState.Hidden,\n badge: BadgeType.TechnicalPreview,\n });\n }\n\n return widgets;\n }\n}\n"]}
|
|
@@ -35,6 +35,8 @@ export interface MapLayerOptions {
|
|
|
35
35
|
mapTypeOptions?: MapTypesOptions;
|
|
36
36
|
/** Optional list of base map-layers to display in the base map select control */
|
|
37
37
|
baseMapLayers?: BaseMapLayerSettings[];
|
|
38
|
+
/** Optionally show the user preferences storage options(i.e. iTwin vs iModel). Defaults to false */
|
|
39
|
+
showUserPreferencesStorageOptions?: boolean;
|
|
38
40
|
}
|
|
39
41
|
export interface MapFeatureInfoPropertyGridOptions {
|
|
40
42
|
isPropertySelectionEnabled?: boolean;
|
|
@@ -45,4 +47,13 @@ export interface MapFeatureInfoOptions {
|
|
|
45
47
|
showLoadProgressAnimation?: boolean;
|
|
46
48
|
propertyGridOptions?: MapFeatureInfoPropertyGridOptions;
|
|
47
49
|
}
|
|
50
|
+
export interface CustomParamItem {
|
|
51
|
+
name: string;
|
|
52
|
+
key: string;
|
|
53
|
+
value: string;
|
|
54
|
+
secret: boolean;
|
|
55
|
+
}
|
|
56
|
+
export interface CustomParamsMappingItem {
|
|
57
|
+
customParamNames: string[];
|
|
58
|
+
}
|
|
48
59
|
//# sourceMappingURL=Interfaces.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Interfaces.d.ts","sourceRoot":"","sources":["../../../src/ui/Interfaces.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,
|
|
1
|
+
{"version":3,"file":"Interfaces.d.ts","sourceRoot":"","sources":["../../../src/ui/Interfaces.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,SAAS,EAAE,uBAAuB,EAAE,+BAA+B,EAAE,MAAM,sBAAsB,CAAC;AAE3G,MAAM,WAAW,qBAAqB;IACpC,WAAW;IACX,IAAI,EAAE,MAAM,CAAC;IACb,qFAAqF;IACrF,MAAM,EAAE,MAAM,CAAC;IACf,mCAAmC;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,EAAE,+BAA+B,CAAC;IAChD,2MAA2M;IAC3M,YAAY,EAAE,MAAM,CAAC;IACrB,6BAA6B;IAC7B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,qCAAqC;IACrC,SAAS,EAAE,OAAO,CAAC;IACnB,kCAAkC;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,8BAA8B;IAC9B,SAAS,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC/B,iCAAiC;IACjC,aAAa,EAAE,OAAO,CAAC;IACvB,uEAAuE;IACvE,QAAQ,CAAC,EAAE,uBAAuB,CAAC;IAEnC,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,wBAAwB,EAAE,OAAO,CAAC;CAC5C;AAED,MAAM,WAAW,eAAe;IAC9B,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,cAAc,CAAC,EAAE,eAAe,CAAC;IAEjC,iFAAiF;IACjF,aAAa,CAAC,EAAE,oBAAoB,EAAE,CAAC;IAEvC,qGAAqG;IACrG,iCAAiC,CAAC,EAAE,OAAO,CAAC;CAC7C;AAED,MAAM,WAAW,iCAAiC;IAChD,0BAA0B,CAAC,EAAE,OAAO,CAAC;CACtC;AAED,oBAAY,WAAW,GAAG,OAAO,CAAC,CAAC,GAAG,EAAE,SAAS,KAAK,IAAI,CAAC,CAAC;AAE5D,MAAM,WAAW,qBAAqB;IACpC,6BAA6B,CAAC,EAAE,OAAO,CAAC;IACxC,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,mBAAmB,CAAC,EAAE,iCAAiC,CAAC;CACzD;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,uBAAuB;IACtC,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Interfaces.js","sourceRoot":"","sources":["../../../src/ui/Interfaces.ts"],"names":[],"mappings":"","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 { BeEvent } from \"@itwin/core-bentley\";\nimport {
|
|
1
|
+
{"version":3,"file":"Interfaces.js","sourceRoot":"","sources":["../../../src/ui/Interfaces.ts"],"names":[],"mappings":"","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 { BeEvent } from \"@itwin/core-bentley\";\nimport { BaseMapLayerSettings, MapSubLayerProps } from \"@itwin/core-common\";\nimport { HitDetail, MapLayerImageryProvider, MapTileTreeScaleRangeVisibility } from \"@itwin/core-frontend\";\n\nexport interface StyleMapLayerSettings {\n /** Name */\n name: string;\n /** source (i.URL for ImageMapLayerSettings or modelId for ModelMapLayerSettings) */\n source: string;\n /** Controls visibility of layer */\n visible: boolean;\n treeVisibility: MapTileTreeScaleRangeVisibility;\n /** 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. */\n transparency: number;\n /** Transparent background */\n transparentBackground: boolean;\n /** set map as underlay or overlay */\n isOverlay: boolean;\n /** layer index in the viewport */\n layerIndex: number;\n /** Available map sub-layer */\n subLayers?: MapSubLayerProps[];\n /** sub-layer panel displayed. */\n showSubLayers: boolean;\n /** Some format can publish only a single layer at a time (i.e WMTS) */\n provider?: MapLayerImageryProvider;\n\n selected: boolean;\n}\n\nexport interface MapTypesOptions {\n readonly supportTileUrl: boolean;\n readonly supportWmsAuthentication: boolean;\n}\n\nexport interface MapLayerOptions {\n hideExternalMapLayers?: boolean;\n fetchPublicMapLayerSources?: boolean;\n mapTypeOptions?: MapTypesOptions;\n\n /** Optional list of base map-layers to display in the base map select control */\n baseMapLayers?: BaseMapLayerSettings[];\n\n /** Optionally show the user preferences storage options(i.e. iTwin vs iModel). Defaults to false */\n showUserPreferencesStorageOptions?: boolean;\n}\n\nexport interface MapFeatureInfoPropertyGridOptions {\n isPropertySelectionEnabled?: boolean;\n}\n\nexport type MapHitEvent = BeEvent<(hit: HitDetail) => void>;\n\nexport interface MapFeatureInfoOptions {\n disableDefaultFeatureInfoTool?: boolean;\n showLoadProgressAnimation?: boolean;\n propertyGridOptions?: MapFeatureInfoPropertyGridOptions;\n}\n\nexport interface CustomParamItem {\n name: string;\n key: string;\n value: string;\n secret: boolean;\n}\n\nexport interface CustomParamsMappingItem {\n customParamNames: string[];\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttachLayerPopupButton.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/AttachLayerPopupButton.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"AttachLayerPopupButton.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/AttachLayerPopupButton.tsx"],"names":[],"mappings":";AA2cA,gBAAgB;AAChB,oBAAY,qBAAqB;IAC/B,OAAO,IAAA;IACP,IAAI,IAAA;IACJ,IAAI,IAAA;CACL;AACD,MAAM,WAAW,2BAA2B;IAC1C,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,qBAAqB,CAAC;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,gBAAgB;AAEhB,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,2BAA2B,eAkHxE"}
|
|
@@ -59,7 +59,6 @@ function AttachLayerPanel({ isOverlay, onLayerAttached, onHandleOutsideClick })
|
|
|
59
59
|
setSourceFilterString(event.target.value);
|
|
60
60
|
}, []);
|
|
61
61
|
const { loadingSources, sources, activeViewport, backgroundLayers, overlayLayers, mapLayerOptions } = useSourceMapContext();
|
|
62
|
-
const mapTypesOptions = mapLayerOptions?.mapTypeOptions;
|
|
63
62
|
const iTwinId = activeViewport?.iModel?.iTwinId;
|
|
64
63
|
const iModelId = activeViewport?.iModel?.iModelId;
|
|
65
64
|
const attachLayer = React.useCallback((source, subLayers, oneMapLayerPerSubLayer) => {
|
|
@@ -82,6 +81,8 @@ function AttachLayerPanel({ isOverlay, onLayerAttached, onHandleOutsideClick })
|
|
|
82
81
|
if (clonedSource !== undefined) {
|
|
83
82
|
clonedSource.userName = source.userName;
|
|
84
83
|
clonedSource.password = source.password;
|
|
84
|
+
clonedSource.unsavedQueryParams = { ...source.unsavedQueryParams };
|
|
85
|
+
clonedSource.savedQueryParams = { ...source.savedQueryParams };
|
|
85
86
|
sourceToAdd = clonedSource;
|
|
86
87
|
}
|
|
87
88
|
}
|
|
@@ -106,7 +107,7 @@ function AttachLayerPanel({ isOverlay, onLayerAttached, onHandleOutsideClick })
|
|
|
106
107
|
}
|
|
107
108
|
}
|
|
108
109
|
else {
|
|
109
|
-
const attachedLayerName = doAttachLayer(source.name);
|
|
110
|
+
const attachedLayerName = doAttachLayer(source.name, undefined);
|
|
110
111
|
if (attachedLayerName !== undefined) {
|
|
111
112
|
const msg = IModelApp.localization.getLocalizedString("mapLayers:Messages.MapLayerAttached", { sourceName: attachedLayerName });
|
|
112
113
|
IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, msg));
|
|
@@ -176,36 +177,39 @@ function AttachLayerPanel({ isOverlay, onLayerAttached, onHandleOutsideClick })
|
|
|
176
177
|
async function attemptToAddLayer() {
|
|
177
178
|
if (layerNameToAdd && activeViewport) {
|
|
178
179
|
// if the layer is not in the style add it now.
|
|
179
|
-
const
|
|
180
|
-
if (
|
|
180
|
+
const foundSource = sources?.find((source) => source.name === layerNameToAdd);
|
|
181
|
+
if (foundSource === undefined) {
|
|
181
182
|
return;
|
|
182
183
|
}
|
|
183
184
|
try {
|
|
184
185
|
if (isMounted.current) {
|
|
185
186
|
setLoading(true);
|
|
186
187
|
}
|
|
187
|
-
const sourceValidation = await
|
|
188
|
+
const sourceValidation = await foundSource.validateSource();
|
|
188
189
|
if (sourceValidation.status === MapLayerSourceStatus.Valid || sourceValidation.status === MapLayerSourceStatus.RequireAuth) {
|
|
189
190
|
if (sourceValidation.status === MapLayerSourceStatus.Valid) {
|
|
190
|
-
if (sourceValidation.subLayers && needsFeatureSelection(
|
|
191
|
-
openFeatureSelectionDialog(sourceValidation.subLayers,
|
|
191
|
+
if (sourceValidation.subLayers && needsFeatureSelection(foundSource, sourceValidation)) {
|
|
192
|
+
openFeatureSelectionDialog(sourceValidation.subLayers, foundSource);
|
|
192
193
|
if (onHandleOutsideClick) {
|
|
193
194
|
onHandleOutsideClick(false);
|
|
194
195
|
}
|
|
195
196
|
}
|
|
196
197
|
else {
|
|
197
|
-
attachLayer(
|
|
198
|
+
attachLayer(foundSource, sourceValidation.subLayers, false);
|
|
198
199
|
}
|
|
199
200
|
}
|
|
200
201
|
else if (sourceValidation.status === MapLayerSourceStatus.RequireAuth && isMounted.current) {
|
|
201
|
-
|
|
202
|
+
const layer = foundSource.toLayerSettings();
|
|
203
|
+
if (layer) {
|
|
204
|
+
UiFramework.dialogs.modal.open(React.createElement(MapUrlDialog, { activeViewport: activeViewport, isOverlay: isOverlay, signInModeArgs: { layer, validation: sourceValidation, source: foundSource }, onOkResult: (sourceState) => handleModalUrlDialogOk(LayerAction.New, sourceState), onCancelResult: handleModalUrlDialogCancel, ...mapLayerOptions }));
|
|
205
|
+
}
|
|
202
206
|
if (onHandleOutsideClick) {
|
|
203
207
|
onHandleOutsideClick(false);
|
|
204
208
|
}
|
|
205
209
|
}
|
|
206
210
|
}
|
|
207
211
|
else {
|
|
208
|
-
const msg = IModelApp.localization.getLocalizedString("mapLayers:Messages.MapLayerValidationFailed", { sourceUrl:
|
|
212
|
+
const msg = IModelApp.localization.getLocalizedString("mapLayers:Messages.MapLayerValidationFailed", { sourceUrl: foundSource.url });
|
|
209
213
|
IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));
|
|
210
214
|
if (isMounted.current) {
|
|
211
215
|
setLoading(false);
|
|
@@ -216,7 +220,7 @@ function AttachLayerPanel({ isOverlay, onLayerAttached, onHandleOutsideClick })
|
|
|
216
220
|
if (isMounted.current) {
|
|
217
221
|
setLoading(false);
|
|
218
222
|
}
|
|
219
|
-
const msg = IModelApp.localization.getLocalizedString("mapLayers:Messages.MapLayerAttachError", { error: err, sourceName:
|
|
223
|
+
const msg = IModelApp.localization.getLocalizedString("mapLayers:Messages.MapLayerAttachError", { error: err, sourceName: foundSource.name });
|
|
220
224
|
IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));
|
|
221
225
|
}
|
|
222
226
|
}
|
|
@@ -226,9 +230,7 @@ function AttachLayerPanel({ isOverlay, onLayerAttached, onHandleOutsideClick })
|
|
|
226
230
|
if (isMounted.current) {
|
|
227
231
|
setLayerNameToAdd(undefined);
|
|
228
232
|
}
|
|
229
|
-
}, [attachLayer, needsFeatureSelection, setLayerNameToAdd, layerNameToAdd, activeViewport, sources, backgroundLayers, isOverlay, overlayLayers,
|
|
230
|
-
onLayerAttached, handleModalUrlDialogOk, handleSelectFeaturesCancel, handleSelectFeaturesOk, mapTypesOptions,
|
|
231
|
-
handleModalUrlDialogCancel, onHandleOutsideClick, openFeatureSelectionDialog]);
|
|
233
|
+
}, [attachLayer, needsFeatureSelection, setLayerNameToAdd, layerNameToAdd, activeViewport, sources, backgroundLayers, isOverlay, overlayLayers, onLayerAttached, handleModalUrlDialogOk, handleSelectFeaturesCancel, handleSelectFeaturesOk, handleModalUrlDialogCancel, onHandleOutsideClick, openFeatureSelectionDialog, mapLayerOptions]);
|
|
232
234
|
const options = React.useMemo(() => sources, [sources]);
|
|
233
235
|
const filteredOptions = React.useMemo(() => {
|
|
234
236
|
if (undefined === sourceFilterString || 0 === sourceFilterString.length) {
|
|
@@ -239,12 +241,12 @@ function AttachLayerPanel({ isOverlay, onLayerAttached, onHandleOutsideClick })
|
|
|
239
241
|
}
|
|
240
242
|
}, [options, sourceFilterString]);
|
|
241
243
|
const handleAddNewMapSource = React.useCallback(() => {
|
|
242
|
-
UiFramework.dialogs.modal.open(React.createElement(MapUrlDialog, { activeViewport: activeViewport, isOverlay: isOverlay, onOkResult: (result) => handleModalUrlDialogOk(LayerAction.New, result), onCancelResult: handleModalUrlDialogCancel,
|
|
244
|
+
UiFramework.dialogs.modal.open(React.createElement(MapUrlDialog, { activeViewport: activeViewport, isOverlay: isOverlay, onOkResult: (result) => handleModalUrlDialogOk(LayerAction.New, result), onCancelResult: handleModalUrlDialogCancel, ...mapLayerOptions }));
|
|
243
245
|
if (onHandleOutsideClick) {
|
|
244
246
|
onHandleOutsideClick(false);
|
|
245
247
|
}
|
|
246
248
|
return;
|
|
247
|
-
}, [activeViewport, handleModalUrlDialogCancel, handleModalUrlDialogOk, isOverlay,
|
|
249
|
+
}, [activeViewport, handleModalUrlDialogCancel, handleModalUrlDialogOk, isOverlay, mapLayerOptions, onHandleOutsideClick]);
|
|
248
250
|
const handleAttach = React.useCallback((mapName) => {
|
|
249
251
|
setLayerNameToAdd(mapName);
|
|
250
252
|
}, []);
|
|
@@ -304,11 +306,11 @@ function AttachLayerPanel({ isOverlay, onLayerAttached, onHandleOutsideClick })
|
|
|
304
306
|
if (matchingSource === undefined) {
|
|
305
307
|
return;
|
|
306
308
|
}
|
|
307
|
-
UiFramework.dialogs.modal.open(React.createElement(MapUrlDialog, { activeViewport: activeViewport, isOverlay: isOverlay, mapLayerSourceToEdit: matchingSource, onOkResult: (result) => handleModalUrlDialogOk(LayerAction.Edit, result), onCancelResult: handleModalUrlDialogCancel,
|
|
309
|
+
UiFramework.dialogs.modal.open(React.createElement(MapUrlDialog, { activeViewport: activeViewport, isOverlay: isOverlay, mapLayerSourceToEdit: matchingSource, onOkResult: (result) => handleModalUrlDialogOk(LayerAction.Edit, result), onCancelResult: handleModalUrlDialogCancel, ...mapLayerOptions }));
|
|
308
310
|
if (onHandleOutsideClick) {
|
|
309
311
|
onHandleOutsideClick(false);
|
|
310
312
|
}
|
|
311
|
-
}, [activeViewport, handleModalUrlDialogCancel, handleModalUrlDialogOk, isOverlay,
|
|
313
|
+
}, [activeViewport, handleModalUrlDialogCancel, handleModalUrlDialogOk, isOverlay, mapLayerOptions, onHandleOutsideClick, sources]);
|
|
312
314
|
return (React.createElement("div", { className: "map-manager-header" },
|
|
313
315
|
(loading || loadingSources) && React.createElement(UiCore.LoadingSpinner, { message: loadingMapSources }),
|
|
314
316
|
React.createElement("div", { className: "map-manager-source-listbox-header" },
|