@itwin/map-layers 5.0.0 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/CHANGELOG.md +12 -1
  2. package/lib/cjs/public/locales/en/mapLayers.json +7 -2
  3. package/lib/cjs/ui/widget/AttachLayerPopupButton.d.ts.map +1 -1
  4. package/lib/cjs/ui/widget/AttachLayerPopupButton.js +144 -64
  5. package/lib/cjs/ui/widget/AttachLayerPopupButton.js.map +1 -1
  6. package/lib/cjs/ui/widget/BasemapPanel.d.ts.map +1 -1
  7. package/lib/cjs/ui/widget/BasemapPanel.js +44 -15
  8. package/lib/cjs/ui/widget/BasemapPanel.js.map +1 -1
  9. package/lib/cjs/ui/widget/MapLayerDroppable.d.ts.map +1 -1
  10. package/lib/cjs/ui/widget/MapLayerDroppable.js +26 -3
  11. package/lib/cjs/ui/widget/MapLayerDroppable.js.map +1 -1
  12. package/lib/cjs/ui/widget/MapLayerManager.d.ts.map +1 -1
  13. package/lib/cjs/ui/widget/MapLayerManager.js +35 -57
  14. package/lib/cjs/ui/widget/MapLayerManager.js.map +1 -1
  15. package/lib/cjs/ui/widget/MapLayerManager.scss +2 -8
  16. package/lib/cjs/ui/widget/MapSelectFeaturesDialog.d.ts +11 -0
  17. package/lib/cjs/ui/widget/MapSelectFeaturesDialog.d.ts.map +1 -0
  18. package/lib/cjs/ui/widget/MapSelectFeaturesDialog.js +58 -0
  19. package/lib/cjs/ui/widget/MapSelectFeaturesDialog.js.map +1 -0
  20. package/lib/cjs/ui/widget/MapSelectFeaturesDialog.scss +17 -0
  21. package/lib/cjs/ui/widget/MapUrlDialog.d.ts +7 -2
  22. package/lib/cjs/ui/widget/MapUrlDialog.d.ts.map +1 -1
  23. package/lib/cjs/ui/widget/MapUrlDialog.js +38 -134
  24. package/lib/cjs/ui/widget/MapUrlDialog.js.map +1 -1
  25. package/lib/cjs/ui/widget/MapUrlDialog.scss +10 -10
  26. package/lib/cjs/ui/widget/SubLayersDataProvider.d.ts +3 -1
  27. package/lib/cjs/ui/widget/SubLayersDataProvider.d.ts.map +1 -1
  28. package/lib/cjs/ui/widget/SubLayersDataProvider.js +3 -3
  29. package/lib/cjs/ui/widget/SubLayersDataProvider.js.map +1 -1
  30. package/lib/cjs/ui/widget/SubLayersPopupButton.js +1 -1
  31. package/lib/cjs/ui/widget/SubLayersPopupButton.js.map +1 -1
  32. package/lib/cjs/ui/widget/SubLayersTree.d.ts +5 -0
  33. package/lib/cjs/ui/widget/SubLayersTree.d.ts.map +1 -1
  34. package/lib/cjs/ui/widget/SubLayersTree.js +12 -36
  35. package/lib/cjs/ui/widget/SubLayersTree.js.map +1 -1
  36. package/lib/cjs/ui/widget/SubLayersTree.scss +12 -3
  37. package/lib/esm/public/locales/en/mapLayers.json +7 -2
  38. package/lib/esm/ui/widget/AttachLayerPopupButton.d.ts.map +1 -1
  39. package/lib/esm/ui/widget/AttachLayerPopupButton.js +145 -65
  40. package/lib/esm/ui/widget/AttachLayerPopupButton.js.map +1 -1
  41. package/lib/esm/ui/widget/BasemapPanel.d.ts.map +1 -1
  42. package/lib/esm/ui/widget/BasemapPanel.js +44 -15
  43. package/lib/esm/ui/widget/BasemapPanel.js.map +1 -1
  44. package/lib/esm/ui/widget/MapLayerDroppable.d.ts.map +1 -1
  45. package/lib/esm/ui/widget/MapLayerDroppable.js +27 -4
  46. package/lib/esm/ui/widget/MapLayerDroppable.js.map +1 -1
  47. package/lib/esm/ui/widget/MapLayerManager.d.ts.map +1 -1
  48. package/lib/esm/ui/widget/MapLayerManager.js +36 -58
  49. package/lib/esm/ui/widget/MapLayerManager.js.map +1 -1
  50. package/lib/esm/ui/widget/MapLayerManager.scss +2 -8
  51. package/lib/esm/ui/widget/MapSelectFeaturesDialog.d.ts +11 -0
  52. package/lib/esm/ui/widget/MapSelectFeaturesDialog.d.ts.map +1 -0
  53. package/lib/esm/ui/widget/MapSelectFeaturesDialog.js +54 -0
  54. package/lib/esm/ui/widget/MapSelectFeaturesDialog.js.map +1 -0
  55. package/lib/esm/ui/widget/MapSelectFeaturesDialog.scss +17 -0
  56. package/lib/esm/ui/widget/MapUrlDialog.d.ts +7 -2
  57. package/lib/esm/ui/widget/MapUrlDialog.d.ts.map +1 -1
  58. package/lib/esm/ui/widget/MapUrlDialog.js +38 -134
  59. package/lib/esm/ui/widget/MapUrlDialog.js.map +1 -1
  60. package/lib/esm/ui/widget/MapUrlDialog.scss +10 -10
  61. package/lib/esm/ui/widget/SubLayersDataProvider.d.ts +3 -1
  62. package/lib/esm/ui/widget/SubLayersDataProvider.d.ts.map +1 -1
  63. package/lib/esm/ui/widget/SubLayersDataProvider.js +3 -3
  64. package/lib/esm/ui/widget/SubLayersDataProvider.js.map +1 -1
  65. package/lib/esm/ui/widget/SubLayersPopupButton.js +1 -1
  66. package/lib/esm/ui/widget/SubLayersPopupButton.js.map +1 -1
  67. package/lib/esm/ui/widget/SubLayersTree.d.ts +5 -0
  68. package/lib/esm/ui/widget/SubLayersTree.d.ts.map +1 -1
  69. package/lib/esm/ui/widget/SubLayersTree.js +13 -37
  70. package/lib/esm/ui/widget/SubLayersTree.js.map +1 -1
  71. package/lib/esm/ui/widget/SubLayersTree.scss +12 -3
  72. package/lib/public/locales/en/mapLayers.json +7 -2
  73. package/package.json +16 -15
@@ -1 +1 @@
1
- {"version":3,"file":"MapLayerManager.js","sourceRoot":"","sources":["../../../../src/ui/widget/MapLayerManager.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F,2CAA2C;;;AAE3C,oEAAoE;AACpE,sDAAsD;AAEtD,sDAA2D;AAC3D,oDAAsH;AACtH,wDAG8B;AAC9B,wDAAoD;AACpD,+BAA+B;AAC/B,6DAAkE;AAClE,mEAA0F;AAE1F,qEAAkE;AAClE,iDAA8C;AAC9C,2DAAwD;AACxD,kCAAgC;AAChC,+EAA4E;AAC5E,+CAA8C;AAc9C,gBAAgB;AACH,QAAA,gBAAgB,GAAG,KAAK,CAA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AC,oBAAoB,EAC/B,SAAS,EAAE,IAAI,EACf,UAAU,EAAE,gBAAgB,EAC5B,eAAe,EAAE,KAAK,CAAC,eAAe,EAAE,cAAc,EACtD,oBAAoB,EAAE,KAAK,CAAC,oBAA2B,EACvD,cAAc,EAAE,KAAK,CAAC,cAAc,EACpC,kBAAkB,EAAE,yBAAyB,EAC7C,6BAA6B,EAAE,2BAA2B,EAC1D,YAAY,EAAE,sBAAsB,GAAI,CACtC,CACU,CAEf,CACoB,CAC9B,CAAC;AACJ,CAAC;AApaD,0CAoaC","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// cSpell:ignore droppable Sublayer Basemap\n\n// the following quiet warning caused by react-beautiful-dnd package\n/* eslint-disable @typescript-eslint/unbound-method */\n\nimport { assert, BentleyError } from \"@itwin/core-bentley\";\nimport { ImageMapLayerSettings, MapImagerySettings, MapSubLayerProps, MapSubLayerSettings } from \"@itwin/core-common\";\nimport {\n ImageryMapTileTree, IModelApp, MapLayerImageryProvider, MapLayerScaleRangeVisibility, MapLayerSource, MapLayerSources, NotifyMessageDetails, OutputMessagePriority,\n ScreenViewport, TileTreeOwner, Viewport,\n} from \"@itwin/core-frontend\";\nimport { ToggleSwitch } from \"@itwin/itwinui-react\";\nimport * as React from \"react\";\nimport { DragDropContext, DropResult } from \"react-beautiful-dnd\";\nimport { MapLayerPreferences, MapLayerSourceChangeType } from \"../../MapLayerPreferences\";\nimport { MapLayerOptions, StyleMapLayerSettings } from \"../Interfaces\";\nimport { AttachLayerPopupButton } from \"./AttachLayerPopupButton\";\nimport { BasemapPanel } from \"./BasemapPanel\";\nimport { MapLayerDroppable } from \"./MapLayerDroppable\";\nimport \"./MapLayerManager.scss\";\nimport { MapLayerSettingsPopupButton } from \"./MapLayerSettingsPopupButton\";\nimport { MapLayersUI } from \"../../mapLayers\";\n\n/** @internal */\nexport interface SourceMapContextProps {\n readonly sources: MapLayerSource[];\n readonly loadingSources: boolean;\n readonly bases: MapLayerSource[];\n readonly refreshFromStyle: () => void;\n readonly activeViewport?: ScreenViewport;\n readonly backgroundLayers?: StyleMapLayerSettings[];\n readonly overlayLayers?: StyleMapLayerSettings[];\n readonly mapLayerOptions?: MapLayerOptions;\n}\n\n/** @internal */\nexport const SourceMapContext = React.createContext<SourceMapContextProps>({ // eslint-disable-line @typescript-eslint/naming-convention\n sources: [],\n loadingSources: false,\n bases: [],\n refreshFromStyle: () => { },\n});\n\n/** @internal */\nexport function useSourceMapContext(): SourceMapContextProps {\n return React.useContext(SourceMapContext);\n}\n\nfunction getSubLayerProps(subLayerSettings: MapSubLayerSettings[]): MapSubLayerProps[] {\n return subLayerSettings.map((subLayer) => subLayer.toJSON());\n}\n\nfunction getMapLayerSettingsFromViewport(viewport: Viewport, getBackgroundMap: boolean, populateSubLayers = true): StyleMapLayerSettings[] | undefined {\n const displayStyle = viewport.displayStyle;\n if (!displayStyle)\n return undefined;\n\n const layers = new Array<StyleMapLayerSettings>();\n\n const displayStyleLayers = (getBackgroundMap ? displayStyle.settings.mapImagery.backgroundLayers : displayStyle.settings.mapImagery.overlayLayers);\n for (let layerIndex = 0; layerIndex < displayStyleLayers.length; layerIndex++) {\n const layerSettings = displayStyleLayers[layerIndex];\n const isOverlay = !getBackgroundMap;\n const layerProvider = viewport.getMapLayerImageryProvider({index: layerIndex, isOverlay});\n const treeVisibility = viewport.getMapLayerScaleRangeVisibility({index: layerIndex, isOverlay});\n const popSubLayers = populateSubLayers && (layerSettings instanceof ImageMapLayerSettings);\n layers.push({\n visible: layerSettings.visible,\n treeVisibility,\n name: layerSettings.name,\n source: layerSettings.source,\n transparency: layerSettings.transparency,\n transparentBackground: layerSettings.transparentBackground,\n subLayers: popSubLayers ? getSubLayerProps(layerSettings.subLayers) : undefined,\n showSubLayers: false,\n isOverlay,\n layerIndex,\n provider: layerProvider,\n });\n }\n\n // since we want to display higher level maps above lower maps in UI reverse their order here.\n return layers.reverse();\n}\n\ninterface MapLayerManagerProps {\n getContainerForClone: () => HTMLElement;\n activeViewport: ScreenViewport;\n mapLayerOptions?: MapLayerOptions;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function MapLayerManager(props: MapLayerManagerProps) {\n const [mapSources, setMapSources] = React.useState<MapLayerSource[] | undefined>();\n const [loadingSources, setLoadingSources] = React.useState(false);\n const [baseSources, setBaseSources] = React.useState<MapLayerSource[] | undefined>();\n const [overlaysLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.OverlayLayers\"));\n const [underlaysLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.BackgroundLayers\"));\n const { activeViewport, mapLayerOptions } = props;\n const hideExternalMapLayersSection = mapLayerOptions?.hideExternalMapLayers ? mapLayerOptions.hideExternalMapLayers : false;\n const fetchPublicMapLayerSources = mapLayerOptions?.fetchPublicMapLayerSources ? mapLayerOptions.fetchPublicMapLayerSources : false;\n\n // map layer settings from display style\n const [backgroundMapLayers, setBackgroundMapLayers] = React.useState<StyleMapLayerSettings[] | undefined>(getMapLayerSettingsFromViewport(activeViewport, true));\n const [overlayMapLayers, setOverlayMapLayers] = React.useState<StyleMapLayerSettings[] | undefined>(getMapLayerSettingsFromViewport(activeViewport, false));\n\n const loadMapLayerSettingsFromViewport = React.useCallback((viewport: Viewport) => {\n setBackgroundMapLayers(getMapLayerSettingsFromViewport(viewport, true));\n setOverlayMapLayers(getMapLayerSettingsFromViewport(viewport, false));\n }, [setBackgroundMapLayers, setOverlayMapLayers]);\n\n const [backgroundMapVisible, setBackgroundMapVisible] = React.useState(() => {\n if (activeViewport) {\n return activeViewport.viewFlags.backgroundMap;\n }\n return false;\n });\n\n React.useEffect(() => {\n const updateBackgroundMapVisible = () => setBackgroundMapVisible(activeViewport.viewFlags.backgroundMap);\n return activeViewport.onDisplayStyleChanged.addListener(updateBackgroundMapVisible);\n }, [activeViewport]);\n\n // 'isMounted' is used to prevent any async operation once the hook has been\n // unloaded. Otherwise we get a 'Can't perform a React state update on an unmounted component.' warning in the console.\n const isMounted = React.useRef(false);\n React.useEffect(() => {\n isMounted.current = true;\n return () => {\n isMounted.current = false;\n };\n });\n\n // Setup onTileTreeLoad events listening.\n // This is needed because we need to know when the imagery provider\n // is created, and be able to monitor to status change.\n React.useEffect(() => {\n const handleTileTreeLoad = (args: TileTreeOwner) => {\n\n // Ignore non-map tile trees\n if (args.tileTree instanceof ImageryMapTileTree) {\n loadMapLayerSettingsFromViewport(activeViewport);\n }\n };\n\n IModelApp.tileAdmin.onTileTreeLoad.addListener(handleTileTreeLoad);\n\n return () => {\n IModelApp.tileAdmin.onTileTreeLoad.removeListener(handleTileTreeLoad);\n };\n\n }, [activeViewport, loadMapLayerSettingsFromViewport]);\n\n React.useEffect(() => {\n const handleScaleRangeVisibilityChanged = (layerIndexes: MapLayerScaleRangeVisibility[]) => {\n const updateLayers = (array: StyleMapLayerSettings[] | undefined) => {\n if (array === undefined)\n return undefined;\n\n return array.map((curStyledLayer) => {\n const foundScaleRangeVisibility = layerIndexes.find((layerIdx) => layerIdx.index === curStyledLayer.layerIndex && layerIdx.isOverlay === curStyledLayer.isOverlay);\n if (undefined === foundScaleRangeVisibility)\n return curStyledLayer;\n else\n return { ...curStyledLayer, treeVisibility: foundScaleRangeVisibility.visibility };\n });\n\n };\n setBackgroundMapLayers(updateLayers(backgroundMapLayers));\n setOverlayMapLayers(updateLayers(overlayMapLayers));\n\n };\n activeViewport.onMapLayerScaleRangeVisibilityChanged.addListener(handleScaleRangeVisibilityChanged);\n\n return () => {\n activeViewport.onMapLayerScaleRangeVisibilityChanged.removeListener(handleScaleRangeVisibilityChanged);\n };\n\n }, [activeViewport, backgroundMapLayers, loadMapLayerSettingsFromViewport, overlayMapLayers]);\n\n // Setup onMapImageryChanged events listening.\n\n React.useEffect(() => {\n const handleMapImageryChanged = (args: Readonly<MapImagerySettings>) => {\n\n if (args.backgroundLayers.length !== (backgroundMapLayers ? backgroundMapLayers.length : 0)\n || args.overlayLayers.length !== (overlayMapLayers ? overlayMapLayers.length : 0)) {\n loadMapLayerSettingsFromViewport(activeViewport);\n }\n };\n activeViewport?.displayStyle.settings.onMapImageryChanged.addListener(handleMapImageryChanged);\n\n return () => {\n activeViewport?.displayStyle.settings.onMapImageryChanged.removeListener(handleMapImageryChanged);\n };\n }, [activeViewport, backgroundMapLayers, loadMapLayerSettingsFromViewport, overlayMapLayers]);\n\n const handleProviderStatusChanged = React.useCallback((_args: MapLayerImageryProvider) => {\n loadMapLayerSettingsFromViewport(activeViewport);\n }, [loadMapLayerSettingsFromViewport, activeViewport]);\n\n // Triggered whenever a provider status change\n React.useEffect(() => {\n backgroundMapLayers?.forEach((layer) => { layer.provider?.onStatusChanged.addListener(handleProviderStatusChanged); });\n overlayMapLayers?.forEach((layer) => { layer.provider?.onStatusChanged.addListener(handleProviderStatusChanged); });\n\n return () => {\n backgroundMapLayers?.forEach((layer) => { layer.provider?.onStatusChanged.removeListener(handleProviderStatusChanged); });\n overlayMapLayers?.forEach((layer) => { layer.provider?.onStatusChanged.removeListener(handleProviderStatusChanged); });\n };\n\n }, [backgroundMapLayers, overlayMapLayers, activeViewport, loadMapLayerSettingsFromViewport, handleProviderStatusChanged]);\n\n // Monitor viewport updates, and refresh the widget accordingly.\n // Note: This is needed for multiple viewport applications.\n React.useEffect(() => {\n // Update background map status\n setBackgroundMapVisible(activeViewport.viewFlags.backgroundMap);\n\n // Refresh list of layers\n loadMapLayerSettingsFromViewport(activeViewport);\n\n }, [activeViewport, loadMapLayerSettingsFromViewport]);\n\n React.useEffect(() => {\n async function fetchWmsMapData() {\n const sources: MapLayerSource[] = [];\n const bases: MapLayerSource[] = [];\n const sourceLayers = await MapLayerSources.create(undefined, (fetchPublicMapLayerSources && !hideExternalMapLayersSection));\n\n const iModel = IModelApp.viewManager.selectedView ? IModelApp.viewManager.selectedView.iModel : undefined;\n try {\n const preferenceSources = (iModel?.iTwinId === undefined\n ? []\n : await MapLayerPreferences.getSources(iModel?.iTwinId, iModel?.iModelId)\n );\n for (const source of preferenceSources)\n await MapLayerSources.addSourceToMapLayerSources(source);\n } catch (err) {\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.ErrorLoadingLayers\"), BentleyError.getErrorMessage(err)));\n }\n\n if (!isMounted.current) {\n return;\n }\n\n // This is where the list of layers first gets populated... I need to update it\n // MapUrlDialog gets around knowing MapLayerManager exists and vice versa by affecting the viewports displayStyle which MapLayerManager is listening for\n // We know when displayStyle changes we've added a layer, this layer may not be a custom layer\n sourceLayers?.layers.forEach((source: MapLayerSource) => { sources.push(source); });\n setMapSources(sources);\n sourceLayers?.bases.forEach((source: MapLayerSource) => { bases.push(source); });\n setBaseSources(bases);\n }\n\n setLoadingSources(true);\n fetchWmsMapData().then(() => {\n if (isMounted.current) {\n setLoadingSources(false);\n }\n\n }).catch(() => {\n if (isMounted.current) {\n setLoadingSources(false);\n }\n });\n }, [setMapSources, fetchPublicMapLayerSources, hideExternalMapLayersSection]);\n\n const updateMapSources = React.useCallback(() => {\n const newSources: MapLayerSource[] = [];\n MapLayerSources.getInstance()?.layers?.forEach((sourceLayer: MapLayerSource) => { newSources.push(sourceLayer); });\n setMapSources(newSources);\n }, [setMapSources]);\n\n /**\n * Handle change events in the MapLayerPreferences\n */\n React.useEffect(() => {\n const handleLayerSourceChange = async (changeType: MapLayerSourceChangeType, oldSource?: MapLayerSource, newSource?: MapLayerSource) => {\n const removeSourceOnly = (changeType === MapLayerSourceChangeType.Removed);\n const removeSource = (changeType === MapLayerSourceChangeType.Replaced || changeType === MapLayerSourceChangeType.Removed);\n const addSource = (changeType === MapLayerSourceChangeType.Replaced || changeType === MapLayerSourceChangeType.Added);\n\n if (removeSource) {\n if (oldSource) {\n const succeeded = MapLayerSources.removeLayerByName(oldSource.name);\n assert(succeeded);\n if (!succeeded) {\n return;\n }\n\n if (removeSourceOnly) {\n updateMapSources();\n return;\n }\n }\n }\n\n if (addSource) {\n const sources = await MapLayerSources.addSourceToMapLayerSources(newSource);\n assert(sources !== undefined);\n if (sources) {\n updateMapSources();\n }\n }\n };\n MapLayerPreferences.onLayerSourceChanged.addListener(handleLayerSourceChange);\n return (() => {\n MapLayerPreferences.onLayerSourceChanged.removeListener(handleLayerSourceChange);\n });\n }, [updateMapSources]);\n\n // update when a different display style is loaded.\n React.useEffect(() => {\n const handleDisplayStyleChange = (vp: Viewport) => {\n loadMapLayerSettingsFromViewport(vp);\n };\n activeViewport?.onDisplayStyleChanged.addListener(handleDisplayStyleChange);\n return () => {\n activeViewport?.onDisplayStyleChanged.removeListener(handleDisplayStyleChange);\n };\n }, [activeViewport, loadMapLayerSettingsFromViewport]);\n\n const handleOnMenuItemSelection = React.useCallback((action: string, mapLayerSettings: StyleMapLayerSettings) => {\n if (!activeViewport || !activeViewport.displayStyle)\n return;\n\n const indexInDisplayStyle = activeViewport.displayStyle.findMapLayerIndexByNameAndSource(mapLayerSettings.name, mapLayerSettings.source, mapLayerSettings.isOverlay);\n if (indexInDisplayStyle < 0)\n return;\n\n switch (action) {\n case \"delete\":\n activeViewport.displayStyle.detachMapLayerByIndex({index: indexInDisplayStyle, isOverlay: mapLayerSettings.isOverlay});\n break;\n case \"zoom-to-layer\":\n activeViewport.viewMapLayerRange({index: indexInDisplayStyle, isOverlay: mapLayerSettings.isOverlay}, activeViewport).then((status) => {\n if (!status) {\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.NoRangeDefined\");\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, `${msg} [${mapLayerSettings.name}]`));\n }\n }).catch((_error) => { });\n break;\n }\n\n // force UI to update\n loadMapLayerSettingsFromViewport(activeViewport);\n }, [activeViewport, loadMapLayerSettingsFromViewport]);\n\n const handleLayerVisibilityChange = React.useCallback((mapLayerSettings: StyleMapLayerSettings) => {\n if (activeViewport) {\n const isVisible = !mapLayerSettings.visible;\n\n const displayStyle = activeViewport.displayStyle;\n const indexInDisplayStyle = displayStyle.findMapLayerIndexByNameAndSource(mapLayerSettings.name, mapLayerSettings.source, mapLayerSettings.isOverlay);\n if (-1 !== indexInDisplayStyle) {\n // update the display style\n displayStyle.changeMapLayerProps({ visible: isVisible }, {index: indexInDisplayStyle, isOverlay: mapLayerSettings.isOverlay});\n\n // force UI to update\n loadMapLayerSettingsFromViewport(activeViewport);\n }\n }\n }, [activeViewport, loadMapLayerSettingsFromViewport]);\n\n const handleMapLayersToggle = React.useCallback(() => {\n if (activeViewport) {\n const newState = !backgroundMapVisible;\n activeViewport.viewFlags = activeViewport.viewFlags.with(\"backgroundMap\", newState);\n setBackgroundMapVisible(newState);\n }\n }, [backgroundMapVisible, setBackgroundMapVisible, activeViewport]);\n\n const handleOnMapLayerDragEnd = React.useCallback((result: DropResult /* , _provided: ResponderProvided*/) => {\n const { destination, source } = result;\n\n if (!destination) // dropped outside of list\n return;\n\n // item was not moved\n if (destination.droppableId === source.droppableId && destination.index === source.index)\n return;\n\n let fromMapLayer: StyleMapLayerSettings | undefined;\n if (source.droppableId === \"overlayMapLayers\" && overlayMapLayers)\n fromMapLayer = overlayMapLayers[source.index];\n else if (source.droppableId === \"backgroundMapLayers\" && backgroundMapLayers)\n fromMapLayer = backgroundMapLayers[source.index];\n\n if (!fromMapLayer || !activeViewport)\n return;\n\n const displayStyle = activeViewport.displayStyle;\n let toMapLayer: StyleMapLayerSettings | undefined;\n let toIndexInDisplayStyle = -1;\n\n // If destination.index is undefined then the user dropped the map at the end of list of maps. To get the \"actual\" index in the style, look up index in style by name.\n // We need to do this because the order of layers in UI are reversed so higher layers appear above lower layers.\n if (undefined !== destination.index) {\n if (destination.droppableId === \"overlayMapLayers\" && overlayMapLayers)\n toMapLayer = overlayMapLayers[destination.index];\n else if (destination.droppableId === \"backgroundMapLayers\" && backgroundMapLayers)\n toMapLayer = backgroundMapLayers[destination.index];\n if (toMapLayer)\n toIndexInDisplayStyle = displayStyle.findMapLayerIndexByNameAndSource(toMapLayer.name, toMapLayer.source, toMapLayer.isOverlay);\n }\n\n const fromIndexInDisplayStyle = displayStyle.findMapLayerIndexByNameAndSource(fromMapLayer.name, fromMapLayer.source, fromMapLayer.isOverlay);\n if (fromIndexInDisplayStyle < 0)\n return;\n\n if (destination.droppableId !== source.droppableId) {\n // see if we moved from \"overlayMapLayers\" to \"backgroundMapLayers\" or vice-versa\n const settings = activeViewport.displayStyle.mapLayerAtIndex({index: fromIndexInDisplayStyle, isOverlay: fromMapLayer.isOverlay});\n if (settings) {\n activeViewport.displayStyle.detachMapLayerByIndex({index: fromIndexInDisplayStyle, isOverlay: fromMapLayer.isOverlay});\n\n // Manually reverse index when moved from one section to the other\n if (fromMapLayer.isOverlay && backgroundMapLayers) {\n toIndexInDisplayStyle = displayStyle.settings.mapImagery.backgroundLayers.length - destination.index;\n } else if (!fromMapLayer.isOverlay && overlayMapLayers) {\n toIndexInDisplayStyle = overlayMapLayers.length - destination.index;\n }\n\n activeViewport.displayStyle.attachMapLayer({ settings, mapLayerIndex: {isOverlay: !fromMapLayer.isOverlay, index: toIndexInDisplayStyle} });\n }\n } else {\n if (undefined === destination.index) {\n displayStyle.moveMapLayerToBottom({index: fromIndexInDisplayStyle, isOverlay: destination.droppableId === \"overlayMapLayers\"});\n } else {\n if (toMapLayer) {\n if (toIndexInDisplayStyle !== -1)\n displayStyle.moveMapLayerToIndex(fromIndexInDisplayStyle, toIndexInDisplayStyle, toMapLayer.isOverlay);\n }\n }\n }\n // Note: display style change is automatically applied to view via DisplayStyleState._synchBackgroundMapImagery()\n // So no need to call Viewport.invalidateRenderPlan() here\n\n // force UI to update\n loadMapLayerSettingsFromViewport(activeViewport);\n }, [loadMapLayerSettingsFromViewport, activeViewport, overlayMapLayers, backgroundMapLayers]);\n\n const handleRefreshFromStyle = React.useCallback(() => {\n if (activeViewport)\n loadMapLayerSettingsFromViewport(activeViewport);\n }, [activeViewport, loadMapLayerSettingsFromViewport]);\n\n const [baseMapPanelLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Basemap.BaseMapPanelTitle\"));\n\n return (\n <SourceMapContext.Provider value={{\n activeViewport,\n loadingSources,\n sources: mapSources ? mapSources : [],\n bases: baseSources ? baseSources : [],\n refreshFromStyle: handleRefreshFromStyle,\n backgroundLayers: backgroundMapLayers,\n overlayLayers: overlayMapLayers,\n mapLayerOptions,\n }}>\n <div className=\"map-manager-top-header\">\n <span className=\"map-manager-header-label\">{baseMapPanelLabel}</span>\n <div className=\"map-manager-header-buttons-group\">\n <ToggleSwitch className=\"map-manager-toggle\" checked={backgroundMapVisible} onChange={handleMapLayersToggle} />\n <MapLayerSettingsPopupButton disabled={!backgroundMapVisible} />\n </div>\n </div>\n\n <div className=\"map-manager-container\">\n\n <div className=\"map-manager-basemap\">\n <BasemapPanel disabled={!backgroundMapVisible} />\n </div>\n {!hideExternalMapLayersSection &&\n <DragDropContext onDragEnd={handleOnMapLayerDragEnd}>\n <div className=\"map-manager-layer-wrapper\">\n <div className=\"map-manager-underlays\" >\n <span className=\"map-manager-underlays-label\">{underlaysLabel}</span><AttachLayerPopupButton disabled={!backgroundMapVisible} isOverlay={false} />\n </div>\n <MapLayerDroppable\n disabled={!backgroundMapVisible}\n isOverlay={false}\n layersList={backgroundMapLayers}\n mapTypesOptions={props.mapLayerOptions?.mapTypeOptions}\n getContainerForClone={props.getContainerForClone as any}\n activeViewport={props.activeViewport}\n onMenuItemSelected={handleOnMenuItemSelection}\n onItemVisibilityToggleClicked={handleLayerVisibilityChange}\n onItemEdited={handleRefreshFromStyle} />\n </div>\n\n <div className=\"map-manager-layer-wrapper\">\n <div className=\"map-manager-overlays\" >\n <span className=\"map-manager-overlays-label\">{overlaysLabel}</span><AttachLayerPopupButton disabled={!backgroundMapVisible} isOverlay={true} />\n </div>\n <MapLayerDroppable\n disabled={!backgroundMapVisible}\n isOverlay={true}\n layersList={overlayMapLayers}\n mapTypesOptions={props.mapLayerOptions?.mapTypeOptions}\n getContainerForClone={props.getContainerForClone as any}\n activeViewport={props.activeViewport}\n onMenuItemSelected={handleOnMenuItemSelection}\n onItemVisibilityToggleClicked={handleLayerVisibilityChange}\n onItemEdited={handleRefreshFromStyle} />\n </div>\n </DragDropContext>\n }\n </div >\n </SourceMapContext.Provider >\n );\n}\n\n"]}
1
+ {"version":3,"file":"MapLayerManager.js","sourceRoot":"","sources":["../../../../src/ui/widget/MapLayerManager.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F,2CAA2C;;;AAE3C,oEAAoE;AACpE,sDAAsD;AAEtD,sDAAmE;AACnE,oDAAsH;AACtH,wDAG8B;AAC9B,wDAAoD;AACpD,+BAA+B;AAC/B,6DAAkE;AAClE,mEAA0F;AAE1F,qEAAkE;AAClE,iDAA8C;AAC9C,2DAAwD;AACxD,kCAAgC;AAChC,+EAA4E;AAC5E,+CAA8C;AAc9C,gBAAgB;AACH,QAAA,gBAAgB,GAAG,KAAK,CAAC,aAAa,CAAwB;IACzE,OAAO,EAAE,EAAE;IACX,cAAc,EAAE,KAAK;IACrB,KAAK,EAAE,EAAE;IACT,gBAAgB,EAAE,GAAG,EAAE,GAAG,CAAC;CAC5B,CAAC,CAAC;AAEH,gBAAgB;AAChB,SAAgB,mBAAmB;IACjC,OAAO,KAAK,CAAC,UAAU,CAAC,wBAAgB,CAAC,CAAC;AAC5C,CAAC;AAFD,kDAEC;AAED,SAAS,gBAAgB,CAAC,gBAAuC;IAC/D,OAAO,gBAAgB,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;AAC/D,CAAC;AAED,SAAS,+BAA+B,CAAC,QAAkB,EAAE,gBAAyB,EAAE,iBAAiB,GAAG,IAAI;IAC9G,MAAM,YAAY,GAAG,QAAQ,CAAC,YAAY,CAAC;IAC3C,IAAI,CAAC,YAAY;QACf,OAAO,SAAS,CAAC;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,2BAA2B;wBACxC,6BAAK,SAAS,EAAC,sBAAsB;4BACnC,8BAAM,SAAS,EAAC,4BAA4B,IAAE,aAAa,CAAQ;4BAAA,oBAAC,+CAAsB,IAAC,QAAQ,EAAE,CAAC,oBAAoB,EAAE,SAAS,EAAE,IAAI,GAAI,CAC3I;wBACN,oBAAC,qCAAiB,IAChB,QAAQ,EAAE,CAAC,oBAAoB,EAC/B,SAAS,EAAE,IAAI,EACf,UAAU,EAAE,gBAAgB,EAC5B,eAAe,EAAE,KAAK,CAAC,eAAe,EAAE,cAAc,EACtD,oBAAoB,EAAE,KAAK,CAAC,oBAA2B,EACvD,cAAc,EAAE,KAAK,CAAC,cAAc,EACpC,kBAAkB,EAAE,yBAAyB,EAC7C,6BAA6B,EAAE,2BAA2B,EAC1D,YAAY,EAAE,sBAAsB,GAAI,CACtC,CACU,CAEf,CACoB,CAC9B,CAAC;AACJ,CAAC;AA9YD,0CA8YC","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// cSpell:ignore droppable Sublayer Basemap\n\n// the following quiet warning caused by react-beautiful-dnd package\n/* eslint-disable @typescript-eslint/unbound-method */\n\nimport { BentleyError, compareStrings } from \"@itwin/core-bentley\";\nimport { ImageMapLayerSettings, MapImagerySettings, MapSubLayerProps, MapSubLayerSettings } from \"@itwin/core-common\";\nimport {\n ImageryMapTileTree, IModelApp, MapLayerImageryProvider, MapLayerScaleRangeVisibility, MapLayerSource, MapLayerSources, NotifyMessageDetails, OutputMessagePriority,\n ScreenViewport, TileTreeOwner, Viewport,\n} from \"@itwin/core-frontend\";\nimport { ToggleSwitch } from \"@itwin/itwinui-react\";\nimport * as React from \"react\";\nimport { DragDropContext, DropResult } from \"react-beautiful-dnd\";\nimport { MapLayerPreferences, MapLayerSourceChangeType } from \"../../MapLayerPreferences\";\nimport { MapLayerOptions, StyleMapLayerSettings } from \"../Interfaces\";\nimport { AttachLayerPopupButton } from \"./AttachLayerPopupButton\";\nimport { BasemapPanel } from \"./BasemapPanel\";\nimport { MapLayerDroppable } from \"./MapLayerDroppable\";\nimport \"./MapLayerManager.scss\";\nimport { MapLayerSettingsPopupButton } from \"./MapLayerSettingsPopupButton\";\nimport { MapLayersUI } from \"../../mapLayers\";\n\n/** @internal */\nexport interface SourceMapContextProps {\n readonly sources: MapLayerSource[];\n readonly loadingSources: boolean;\n readonly bases: MapLayerSource[];\n readonly refreshFromStyle: () => void;\n readonly activeViewport?: ScreenViewport;\n readonly backgroundLayers?: StyleMapLayerSettings[];\n readonly overlayLayers?: StyleMapLayerSettings[];\n readonly mapLayerOptions?: MapLayerOptions;\n}\n\n/** @internal */\nexport const SourceMapContext = React.createContext<SourceMapContextProps>({ // eslint-disable-line @typescript-eslint/naming-convention\n sources: [],\n loadingSources: false,\n bases: [],\n refreshFromStyle: () => { },\n});\n\n/** @internal */\nexport function useSourceMapContext(): SourceMapContextProps {\n return React.useContext(SourceMapContext);\n}\n\nfunction getSubLayerProps(subLayerSettings: MapSubLayerSettings[]): MapSubLayerProps[] {\n return subLayerSettings.map((subLayer) => subLayer.toJSON());\n}\n\nfunction getMapLayerSettingsFromViewport(viewport: Viewport, getBackgroundMap: boolean, populateSubLayers = true): StyleMapLayerSettings[] | undefined {\n const displayStyle = viewport.displayStyle;\n if (!displayStyle)\n return undefined;\n\n const layers = new Array<StyleMapLayerSettings>();\n\n const displayStyleLayers = (getBackgroundMap ? displayStyle.settings.mapImagery.backgroundLayers : displayStyle.settings.mapImagery.overlayLayers);\n for (let layerIndex = 0; layerIndex < displayStyleLayers.length; layerIndex++) {\n const layerSettings = displayStyleLayers[layerIndex];\n const isOverlay = !getBackgroundMap;\n const layerProvider = viewport.getMapLayerImageryProvider({index: layerIndex, isOverlay});\n const treeVisibility = viewport.getMapLayerScaleRangeVisibility({index: layerIndex, isOverlay});\n const popSubLayers = populateSubLayers && (layerSettings instanceof ImageMapLayerSettings);\n layers.push({\n visible: layerSettings.visible,\n treeVisibility,\n name: layerSettings.name,\n source: layerSettings.source,\n transparency: layerSettings.transparency,\n transparentBackground: layerSettings.transparentBackground,\n subLayers: popSubLayers ? getSubLayerProps(layerSettings.subLayers) : undefined,\n showSubLayers: false,\n isOverlay,\n layerIndex,\n provider: layerProvider,\n });\n }\n\n // since we want to display higher level maps above lower maps in UI reverse their order here.\n return layers.reverse();\n}\n\ninterface MapLayerManagerProps {\n getContainerForClone: () => HTMLElement;\n activeViewport: ScreenViewport;\n mapLayerOptions?: MapLayerOptions;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function MapLayerManager(props: MapLayerManagerProps) {\n const [mapSources, setMapSources] = React.useState<MapLayerSource[] | undefined>();\n const [loadingSources, setLoadingSources] = React.useState(false);\n const [baseSources, setBaseSources] = React.useState<MapLayerSource[] | undefined>();\n const [overlaysLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.OverlayLayers\"));\n const [underlaysLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.BackgroundLayers\"));\n const { activeViewport, mapLayerOptions } = props;\n const hideExternalMapLayersSection = mapLayerOptions?.hideExternalMapLayers ? mapLayerOptions.hideExternalMapLayers : false;\n const fetchPublicMapLayerSources = mapLayerOptions?.fetchPublicMapLayerSources ? mapLayerOptions.fetchPublicMapLayerSources : false;\n\n // map layer settings from display style\n const [backgroundMapLayers, setBackgroundMapLayers] = React.useState<StyleMapLayerSettings[] | undefined>(getMapLayerSettingsFromViewport(activeViewport, true));\n const [overlayMapLayers, setOverlayMapLayers] = React.useState<StyleMapLayerSettings[] | undefined>(getMapLayerSettingsFromViewport(activeViewport, false));\n\n const loadMapLayerSettingsFromViewport = React.useCallback((viewport: Viewport) => {\n setBackgroundMapLayers(getMapLayerSettingsFromViewport(viewport, true));\n setOverlayMapLayers(getMapLayerSettingsFromViewport(viewport, false));\n }, [setBackgroundMapLayers, setOverlayMapLayers]);\n\n const [backgroundMapVisible, setBackgroundMapVisible] = React.useState(() => {\n if (activeViewport) {\n return activeViewport.viewFlags.backgroundMap;\n }\n return false;\n });\n\n React.useEffect(() => {\n const updateBackgroundMapVisible = () => setBackgroundMapVisible(activeViewport.viewFlags.backgroundMap);\n return activeViewport.onDisplayStyleChanged.addListener(updateBackgroundMapVisible);\n }, [activeViewport]);\n\n // 'isMounted' is used to prevent any async operation once the hook has been\n // unloaded. Otherwise we get a 'Can't perform a React state update on an unmounted component.' warning in the console.\n const isMounted = React.useRef(false);\n React.useEffect(() => {\n isMounted.current = true;\n return () => {\n isMounted.current = false;\n };\n });\n\n // Setup onTileTreeLoad events listening.\n // This is needed because we need to know when the imagery provider\n // is created, and be able to monitor to status change.\n React.useEffect(() => {\n const handleTileTreeLoad = (args: TileTreeOwner) => {\n\n // Ignore non-map tile trees\n if (args.tileTree instanceof ImageryMapTileTree) {\n loadMapLayerSettingsFromViewport(activeViewport);\n }\n };\n\n return IModelApp.tileAdmin.onTileTreeLoad.addListener(handleTileTreeLoad);\n\n }, [activeViewport, loadMapLayerSettingsFromViewport]);\n\n React.useEffect(() => {\n const handleScaleRangeVisibilityChanged = (layerIndexes: MapLayerScaleRangeVisibility[]) => {\n const updateLayers = (array: StyleMapLayerSettings[] | undefined) => {\n if (array === undefined)\n return undefined;\n\n return array.map((curStyledLayer) => {\n const foundScaleRangeVisibility = layerIndexes.find((layerIdx) => layerIdx.index === curStyledLayer.layerIndex && layerIdx.isOverlay === curStyledLayer.isOverlay);\n if (undefined === foundScaleRangeVisibility)\n return curStyledLayer;\n else\n return { ...curStyledLayer, treeVisibility: foundScaleRangeVisibility.visibility };\n });\n\n };\n setBackgroundMapLayers(updateLayers(backgroundMapLayers));\n setOverlayMapLayers(updateLayers(overlayMapLayers));\n\n };\n\n return activeViewport.onMapLayerScaleRangeVisibilityChanged.addListener(handleScaleRangeVisibilityChanged);\n\n }, [activeViewport, backgroundMapLayers, loadMapLayerSettingsFromViewport, overlayMapLayers]);\n\n // Setup onMapImageryChanged events listening.\n\n React.useEffect(() => {\n const handleMapImageryChanged = (args: Readonly<MapImagerySettings>) => {\n\n if (args.backgroundLayers.length !== (backgroundMapLayers ? backgroundMapLayers.length : 0)\n || args.overlayLayers.length !== (overlayMapLayers ? overlayMapLayers.length : 0)) {\n loadMapLayerSettingsFromViewport(activeViewport);\n }\n };\n return activeViewport?.displayStyle.settings.onMapImageryChanged.addListener(handleMapImageryChanged);\n }, [activeViewport, backgroundMapLayers, loadMapLayerSettingsFromViewport, overlayMapLayers]);\n\n const handleProviderStatusChanged = React.useCallback((_args: MapLayerImageryProvider) => {\n loadMapLayerSettingsFromViewport(activeViewport);\n }, [loadMapLayerSettingsFromViewport, activeViewport]);\n\n // Triggered whenever a provider status change\n React.useEffect(() => {\n backgroundMapLayers?.forEach((layer) => { layer.provider?.onStatusChanged.addListener(handleProviderStatusChanged); });\n overlayMapLayers?.forEach((layer) => { layer.provider?.onStatusChanged.addListener(handleProviderStatusChanged); });\n\n return () => {\n backgroundMapLayers?.forEach((layer) => { layer.provider?.onStatusChanged.removeListener(handleProviderStatusChanged); });\n overlayMapLayers?.forEach((layer) => { layer.provider?.onStatusChanged.removeListener(handleProviderStatusChanged); });\n };\n\n }, [backgroundMapLayers, overlayMapLayers, activeViewport, loadMapLayerSettingsFromViewport, handleProviderStatusChanged]);\n\n // Monitor viewport updates, and refresh the widget accordingly.\n // Note: This is needed for multiple viewport applications.\n React.useEffect(() => {\n // Update background map status\n setBackgroundMapVisible(activeViewport.viewFlags.backgroundMap);\n\n // Refresh list of layers\n loadMapLayerSettingsFromViewport(activeViewport);\n\n }, [activeViewport, loadMapLayerSettingsFromViewport]);\n\n React.useEffect(() => {\n async function fetchSources() {\n\n let preferenceSources: MapLayerSource[] = [];\n const sourceLayers = await MapLayerSources.create(undefined, (fetchPublicMapLayerSources && !hideExternalMapLayersSection));\n\n const iModel = activeViewport.iModel;\n try {\n if (iModel?.iTwinId !== undefined) {\n preferenceSources = await MapLayerPreferences.getSources(iModel.iTwinId, iModel.iModelId);\n }\n } catch (err) {\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.ErrorLoadingLayers\"), BentleyError.getErrorMessage(err)));\n }\n\n if (!isMounted.current) {\n return;\n }\n\n // This is where the list of layers first gets populated...\n const sources: MapLayerSource[] = [];\n const bases: MapLayerSource[] = [];\n const addSource = (source: MapLayerSource) => source.baseMap ? bases.push(source) : sources.push(source);\n sourceLayers?.allSource.forEach(addSource);\n preferenceSources.forEach((source) => {\n // Do not add duplicate\n if (!sources.find((curSource) => source.name === curSource.name))\n addSource(source);\n });\n sources.sort((a: MapLayerSource, b: MapLayerSource) => compareStrings(a.name.toLowerCase(), b.name.toLowerCase()));\n\n setMapSources(sources);\n setBaseSources(bases);\n }\n\n setLoadingSources(true);\n\n fetchSources().then(() => {\n if (isMounted.current) {\n setLoadingSources(false);\n }\n\n }).catch(() => {\n if (isMounted.current) {\n setLoadingSources(false);\n }\n });\n }, [setMapSources, fetchPublicMapLayerSources, hideExternalMapLayersSection, activeViewport.iModel]);\n\n /**\n * Handle change events in the MapLayerPreferences\n */\n React.useEffect(() => {\n const handleLayerSourceChange = async (changeType: MapLayerSourceChangeType, oldSource?: MapLayerSource, newSource?: MapLayerSource) => {\n const removeSource = (changeType === MapLayerSourceChangeType.Replaced || changeType === MapLayerSourceChangeType.Removed);\n const addSource = (changeType === MapLayerSourceChangeType.Replaced || changeType === MapLayerSourceChangeType.Added);\n\n let tmpSources = (mapSources ? [...mapSources] : undefined);\n if (removeSource) {\n if (oldSource && tmpSources) {\n tmpSources = tmpSources.filter((source) => source.name !== oldSource.name);\n\n // We don't update state in case of replacement... it will be done when the source is re-added right after.\n if (changeType !== MapLayerSourceChangeType.Replaced )\n setMapSources(tmpSources);\n }\n }\n\n if (addSource) {\n if (tmpSources && newSource && !tmpSources.find((curSource) => newSource.name === curSource.name)) {\n tmpSources.push(newSource);\n tmpSources.sort((a: MapLayerSource, b: MapLayerSource) => compareStrings(a.name.toLowerCase(), b.name.toLowerCase()));\n setMapSources(tmpSources);\n }\n }\n };\n return MapLayerPreferences.onLayerSourceChanged.addListener(handleLayerSourceChange);\n\n }, [setMapSources, mapSources]);\n\n // update when a different display style is loaded.\n React.useEffect(() => {\n const handleDisplayStyleChange = (vp: Viewport) => {\n loadMapLayerSettingsFromViewport(vp);\n };\n return activeViewport?.onDisplayStyleChanged.addListener(handleDisplayStyleChange);\n }, [activeViewport, loadMapLayerSettingsFromViewport]);\n\n const handleOnMenuItemSelection = React.useCallback((action: string, mapLayerSettings: StyleMapLayerSettings) => {\n if (!activeViewport || !activeViewport.displayStyle)\n return;\n\n const indexInDisplayStyle = activeViewport.displayStyle.findMapLayerIndexByNameAndSource(mapLayerSettings.name, mapLayerSettings.source, mapLayerSettings.isOverlay);\n if (indexInDisplayStyle < 0)\n return;\n\n switch (action) {\n case \"delete\":\n activeViewport.displayStyle.detachMapLayerByIndex({index: indexInDisplayStyle, isOverlay: mapLayerSettings.isOverlay});\n break;\n case \"zoom-to-layer\":\n activeViewport.viewMapLayerRange({index: indexInDisplayStyle, isOverlay: mapLayerSettings.isOverlay}, activeViewport).then((status) => {\n if (!status) {\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.NoRangeDefined\");\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, `${msg} [${mapLayerSettings.name}]`));\n }\n }).catch((_error) => { });\n break;\n }\n\n // force UI to update\n loadMapLayerSettingsFromViewport(activeViewport);\n }, [activeViewport, loadMapLayerSettingsFromViewport]);\n\n const handleLayerVisibilityChange = React.useCallback((mapLayerSettings: StyleMapLayerSettings) => {\n if (activeViewport) {\n const isVisible = !mapLayerSettings.visible;\n\n const displayStyle = activeViewport.displayStyle;\n const indexInDisplayStyle = displayStyle.findMapLayerIndexByNameAndSource(mapLayerSettings.name, mapLayerSettings.source, mapLayerSettings.isOverlay);\n if (-1 !== indexInDisplayStyle) {\n // update the display style\n displayStyle.changeMapLayerProps({ visible: isVisible }, {index: indexInDisplayStyle, isOverlay: mapLayerSettings.isOverlay});\n\n // force UI to update\n loadMapLayerSettingsFromViewport(activeViewport);\n }\n }\n }, [activeViewport, loadMapLayerSettingsFromViewport]);\n\n const handleMapLayersToggle = React.useCallback(() => {\n if (activeViewport) {\n const newState = !backgroundMapVisible;\n activeViewport.viewFlags = activeViewport.viewFlags.with(\"backgroundMap\", newState);\n setBackgroundMapVisible(newState);\n }\n }, [backgroundMapVisible, setBackgroundMapVisible, activeViewport]);\n\n const handleOnMapLayerDragEnd = React.useCallback((result: DropResult /* , _provided: ResponderProvided*/) => {\n const { destination, source } = result;\n\n if (!destination) // dropped outside of list\n return;\n\n // item was not moved\n if (destination.droppableId === source.droppableId && destination.index === source.index)\n return;\n\n let fromMapLayer: StyleMapLayerSettings | undefined;\n if (source.droppableId === \"overlayMapLayers\" && overlayMapLayers)\n fromMapLayer = overlayMapLayers[source.index];\n else if (source.droppableId === \"backgroundMapLayers\" && backgroundMapLayers)\n fromMapLayer = backgroundMapLayers[source.index];\n\n if (!fromMapLayer || !activeViewport)\n return;\n\n const displayStyle = activeViewport.displayStyle;\n let toMapLayer: StyleMapLayerSettings | undefined;\n let toIndexInDisplayStyle = -1;\n\n // If destination.index is undefined then the user dropped the map at the end of list of maps. To get the \"actual\" index in the style, look up index in style by name.\n // We need to do this because the order of layers in UI are reversed so higher layers appear above lower layers.\n if (undefined !== destination.index) {\n if (destination.droppableId === \"overlayMapLayers\" && overlayMapLayers)\n toMapLayer = overlayMapLayers[destination.index];\n else if (destination.droppableId === \"backgroundMapLayers\" && backgroundMapLayers)\n toMapLayer = backgroundMapLayers[destination.index];\n if (toMapLayer)\n toIndexInDisplayStyle = displayStyle.findMapLayerIndexByNameAndSource(toMapLayer.name, toMapLayer.source, toMapLayer.isOverlay);\n }\n\n const fromIndexInDisplayStyle = displayStyle.findMapLayerIndexByNameAndSource(fromMapLayer.name, fromMapLayer.source, fromMapLayer.isOverlay);\n if (fromIndexInDisplayStyle < 0)\n return;\n\n if (destination.droppableId !== source.droppableId) {\n // see if we moved from \"overlayMapLayers\" to \"backgroundMapLayers\" or vice-versa\n const settings = activeViewport.displayStyle.mapLayerAtIndex({index: fromIndexInDisplayStyle, isOverlay: fromMapLayer.isOverlay});\n if (settings) {\n activeViewport.displayStyle.detachMapLayerByIndex({index: fromIndexInDisplayStyle, isOverlay: fromMapLayer.isOverlay});\n\n // Manually reverse index when moved from one section to the other\n if (fromMapLayer.isOverlay && backgroundMapLayers) {\n toIndexInDisplayStyle = displayStyle.settings.mapImagery.backgroundLayers.length - destination.index;\n } else if (!fromMapLayer.isOverlay && overlayMapLayers) {\n toIndexInDisplayStyle = overlayMapLayers.length - destination.index;\n }\n\n activeViewport.displayStyle.attachMapLayer({ settings, mapLayerIndex: {isOverlay: !fromMapLayer.isOverlay, index: toIndexInDisplayStyle} });\n }\n } else {\n if (undefined === destination.index) {\n displayStyle.moveMapLayerToBottom({index: fromIndexInDisplayStyle, isOverlay: destination.droppableId === \"overlayMapLayers\"});\n } else {\n if (toMapLayer) {\n if (toIndexInDisplayStyle !== -1)\n displayStyle.moveMapLayerToIndex(fromIndexInDisplayStyle, toIndexInDisplayStyle, toMapLayer.isOverlay);\n }\n }\n }\n // Note: display style change is automatically applied to view via DisplayStyleState._synchBackgroundMapImagery()\n // So no need to call Viewport.invalidateRenderPlan() here\n\n // force UI to update\n loadMapLayerSettingsFromViewport(activeViewport);\n }, [loadMapLayerSettingsFromViewport, activeViewport, overlayMapLayers, backgroundMapLayers]);\n\n const handleRefreshFromStyle = React.useCallback(() => {\n if (activeViewport)\n loadMapLayerSettingsFromViewport(activeViewport);\n }, [activeViewport, loadMapLayerSettingsFromViewport]);\n\n const [baseMapPanelLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Basemap.BaseMapPanelTitle\"));\n\n return (\n <SourceMapContext.Provider value={{\n activeViewport,\n loadingSources,\n sources: mapSources ? mapSources : [],\n bases: baseSources ? baseSources : [],\n refreshFromStyle: handleRefreshFromStyle,\n backgroundLayers: backgroundMapLayers,\n overlayLayers: overlayMapLayers,\n mapLayerOptions,\n }}>\n <div className=\"map-manager-top-header\">\n <span className=\"map-manager-header-label\">{baseMapPanelLabel}</span>\n <div className=\"map-manager-header-buttons-group\">\n <ToggleSwitch className=\"map-manager-toggle\" checked={backgroundMapVisible} onChange={handleMapLayersToggle} />\n <MapLayerSettingsPopupButton disabled={!backgroundMapVisible} />\n </div>\n </div>\n\n <div className=\"map-manager-container\">\n\n <div className=\"map-manager-basemap\">\n <BasemapPanel disabled={!backgroundMapVisible} />\n </div>\n {!hideExternalMapLayersSection &&\n <DragDropContext onDragEnd={handleOnMapLayerDragEnd}>\n <div className=\"map-manager-layer-wrapper\">\n <div className=\"map-manager-underlays\" >\n <span className=\"map-manager-underlays-label\">{underlaysLabel}</span><AttachLayerPopupButton disabled={!backgroundMapVisible} isOverlay={false} />\n </div>\n <MapLayerDroppable\n disabled={!backgroundMapVisible}\n isOverlay={false}\n layersList={backgroundMapLayers}\n mapTypesOptions={props.mapLayerOptions?.mapTypeOptions}\n getContainerForClone={props.getContainerForClone as any}\n activeViewport={props.activeViewport}\n onMenuItemSelected={handleOnMenuItemSelection}\n onItemVisibilityToggleClicked={handleLayerVisibilityChange}\n onItemEdited={handleRefreshFromStyle} />\n </div>\n\n <div className=\"map-manager-layer-wrapper\">\n <div className=\"map-manager-overlays\" >\n <span className=\"map-manager-overlays-label\">{overlaysLabel}</span><AttachLayerPopupButton disabled={!backgroundMapVisible} isOverlay={true} />\n </div>\n <MapLayerDroppable\n disabled={!backgroundMapVisible}\n isOverlay={true}\n layersList={overlayMapLayers}\n mapTypesOptions={props.mapLayerOptions?.mapTypeOptions}\n getContainerForClone={props.getContainerForClone as any}\n activeViewport={props.activeViewport}\n onMenuItemSelected={handleOnMenuItemSelection}\n onItemVisibilityToggleClicked={handleLayerVisibilityChange}\n onItemEdited={handleRefreshFromStyle} />\n </div>\n </DragDropContext>\n }\n </div >\n </SourceMapContext.Provider >\n );\n}\n\n"]}
@@ -259,13 +259,8 @@ $default-font-size: --iui-font-size-1;
259
259
  .map-layer-source-item-warnMessage-icon {
260
260
  background-color: transparent;
261
261
  border: none;
262
- color: $buic-foreground-warning;
262
+ color: var(--iui-color-icon-warning);
263
263
  background-color: transparent;
264
-
265
- &:hover {
266
- color: $hovered-icon-color;
267
- }
268
-
269
264
  &:focus {
270
265
  outline: none;
271
266
  box-shadow: rgba(var(--iui-color-border-accent), var(--iui-opacity-4)) 0px 0px 0px 2px;
@@ -279,8 +274,7 @@ $default-font-size: --iui-font-size-1;
279
274
  }
280
275
 
281
276
  .map-manager-sublayer-panel {
282
- width: 400px;
283
- height: 400px;
277
+ width: 400px; // Ideally I would let the popup's content drives the width, unfortunately without an explicit width, the popup location is not consistent.
284
278
  color: $buic-foreground-body;
285
279
  font-size: $default-font-size;
286
280
  padding: 4px;
@@ -0,0 +1,11 @@
1
+ import "./MapSelectFeaturesDialog.scss";
2
+ import { MapLayerSource } from "@itwin/core-frontend";
3
+ import { MapSubLayerProps } from "@itwin/core-common";
4
+ export interface MapSelectFeaturesProps {
5
+ source: MapLayerSource;
6
+ subLayers: MapSubLayerProps[];
7
+ handleOk: (subLayers: MapSubLayerProps[]) => void;
8
+ handleCancel: () => void;
9
+ }
10
+ export declare function MapSelectFeaturesDialog(props: MapSelectFeaturesProps): JSX.Element;
11
+ //# sourceMappingURL=MapSelectFeaturesDialog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MapSelectFeaturesDialog.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/MapSelectFeaturesDialog.tsx"],"names":[],"mappings":"AAQA,OAAO,gCAAgC,CAAC;AAIxC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,cAAc,CAAC;IACvB,SAAS,EAAE,gBAAgB,EAAE,CAAC;IAC9B,QAAQ,EAAE,CAAC,SAAS,EAAE,gBAAgB,EAAE,KAAK,IAAI,CAAC;IAClD,YAAY,EAAE,MAAM,IAAI,CAAC;CAC1B;AAKD,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,sBAAsB,eAqEpE"}
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ // cSpell:ignore Modeless WMTS
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.MapSelectFeaturesDialog = void 0;
9
+ const core_react_1 = require("@itwin/core-react");
10
+ const React = require("react");
11
+ require("./MapSelectFeaturesDialog.scss");
12
+ const appui_abstract_1 = require("@itwin/appui-abstract");
13
+ const mapLayers_1 = require("../../mapLayers");
14
+ const SubLayersTree_1 = require("./SubLayersTree");
15
+ const minHeight = 250;
16
+ const maxSubLayers = 30;
17
+ // eslint-disable-next-line @typescript-eslint/naming-convention
18
+ function MapSelectFeaturesDialog(props) {
19
+ const [subLayers, setSubLayers] = React.useState(props.subLayers);
20
+ const [NoLayersSelectedMsg] = React.useState(() => mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:CustomAttach.NoLayersSelected"));
21
+ const [dialogTitle] = React.useState(mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:CustomAttach.SelectLayersToCreate"));
22
+ const dialogContainer = React.useRef(null);
23
+ const handleOk = React.useCallback(() => {
24
+ props.handleOk(subLayers);
25
+ }, [props, subLayers]);
26
+ const handleCancel = React.useCallback(() => {
27
+ props.handleCancel();
28
+ }, [props]);
29
+ const hasVisibleLayers = () => subLayers.some((entry) => entry.visible);
30
+ const hasTooManyVisibleLayers = () => subLayers.filter((entry) => entry.visible).length > maxSubLayers;
31
+ const readyToSave = () => hasVisibleLayers();
32
+ const buttonCluster = [
33
+ { type: appui_abstract_1.DialogButtonType.OK, onClick: handleOk, disabled: !readyToSave() },
34
+ { type: appui_abstract_1.DialogButtonType.Cancel, onClick: handleCancel },
35
+ ];
36
+ function renderWarningMessage() {
37
+ let warningMessage;
38
+ // Get the proper warning message
39
+ if (!hasVisibleLayers()) {
40
+ warningMessage = NoLayersSelectedMsg;
41
+ }
42
+ else if (hasTooManyVisibleLayers()) {
43
+ warningMessage = mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:CustomAttach.TooManyLayersSelected", { layerCount: subLayers.filter((entry) => entry.visible).length });
44
+ }
45
+ if (warningMessage !== undefined) {
46
+ return (React.createElement("div", { className: "map-layer-source-warnMessage" },
47
+ React.createElement(core_react_1.Icon, { className: "map-layer-source-warnMessage-icon", iconSpec: "icon-status-warning" }),
48
+ React.createElement("span", { className: "map-layer-source-warnMessage-label" }, warningMessage)));
49
+ }
50
+ return React.createElement(React.Fragment, null);
51
+ }
52
+ return (React.createElement("div", { ref: dialogContainer },
53
+ React.createElement(core_react_1.Dialog, { className: "map-layer-select-features-dialog", title: dialogTitle, opened: true, resizable: true, movable: true, modal: true, buttonCluster: buttonCluster, onClose: handleCancel, onEscape: handleCancel, minHeight: minHeight, maxWidth: 600, titleStyle: { paddingLeft: "10px" }, footerStyle: { paddingBottom: "10px", paddingRight: "10px" }, trapFocus: false },
54
+ React.createElement(SubLayersTree_1.SubLayersTree, { expandMode: "full", checkboxStyle: "standard", subLayers: subLayers, onSubLayerStateChange: () => setSubLayers([...subLayers]) }),
55
+ renderWarningMessage())));
56
+ }
57
+ exports.MapSelectFeaturesDialog = MapSelectFeaturesDialog;
58
+ //# sourceMappingURL=MapSelectFeaturesDialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MapSelectFeaturesDialog.js","sourceRoot":"","sources":["../../../../src/ui/widget/MapSelectFeaturesDialog.tsx"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AAa,EAAE,aAAa,EAC5B,OAAO,EAAE,YAAY,EACrB,QAAQ,EAAE,YAAY,EACtB,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,GAAG,EACb,UAAU,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,EACnC,WAAW,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,EAC5D,SAAS,EAAE,KAAK;YAGhB,oBAAC,6BAAa,IAAC,UAAU,EAAC,MAAM,EAAC,aAAa,EAAC,UAAU,EAAC,SAAS,EAAE,SAAS,EAAE,qBAAqB,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,GAAG;YAG3I,oBAAoB,EAAE,CAChB,CACJ,CACR,CAAC;AACJ,CAAC;AArED,0DAqEC","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// cSpell:ignore Modeless WMTS\n\nimport { Dialog, Icon } from \"@itwin/core-react\";\nimport * as React from \"react\";\nimport \"./MapSelectFeaturesDialog.scss\";\n\nimport { DialogButtonType } from \"@itwin/appui-abstract\";\nimport { MapLayersUI } from \"../../mapLayers\";\nimport { MapLayerSource } from \"@itwin/core-frontend\";\nimport { MapSubLayerProps } from \"@itwin/core-common\";\nimport { SubLayersTree } from \"./SubLayersTree\";\n\nexport interface MapSelectFeaturesProps {\n source: MapLayerSource;\n subLayers: MapSubLayerProps[];\n handleOk: (subLayers: MapSubLayerProps[]) => void;\n handleCancel: () => void;\n}\nconst minHeight = 250;\nconst maxSubLayers = 30;\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function MapSelectFeaturesDialog(props: MapSelectFeaturesProps) {\n const [subLayers, setSubLayers] = React.useState(props.subLayers);\n const [NoLayersSelectedMsg] = React.useState(()=>MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.NoLayersSelected\"));\n const [dialogTitle] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.SelectLayersToCreate\"));\n\n const dialogContainer = React.useRef<HTMLDivElement>(null);\n\n const handleOk = React.useCallback(() => {\n props.handleOk(subLayers);\n }, [props, subLayers]);\n\n const handleCancel = React.useCallback(() => {\n props.handleCancel();\n }, [props]);\n\n const hasVisibleLayers = () => subLayers.some((entry)=>entry.visible);\n const hasTooManyVisibleLayers = () => subLayers.filter((entry)=>entry.visible).length > maxSubLayers;\n const readyToSave = () => hasVisibleLayers();\n const buttonCluster = [\n { type: DialogButtonType.OK, onClick: handleOk, disabled: !readyToSave() },\n { type: DialogButtonType.Cancel, onClick: handleCancel },\n ];\n\n function renderWarningMessage(): React.ReactNode {\n let warningMessage: string | undefined;\n\n // Get the proper warning message\n if (!hasVisibleLayers()) {\n warningMessage = NoLayersSelectedMsg;\n } else if (hasTooManyVisibleLayers()) {\n warningMessage = MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.TooManyLayersSelected\", { layerCount: subLayers.filter((entry)=>entry.visible).length});\n }\n\n if (warningMessage !== undefined) {\n return (\n <div className=\"map-layer-source-warnMessage\">\n <Icon className=\"map-layer-source-warnMessage-icon\" iconSpec=\"icon-status-warning\" />\n <span className=\"map-layer-source-warnMessage-label\">{warningMessage}</span >\n </div>);\n }\n return <></>;\n }\n\n return (\n <div ref={dialogContainer}>\n <Dialog\n className=\"map-layer-select-features-dialog\"\n title={dialogTitle}\n opened={true}\n resizable={true}\n movable={true}\n modal={true}\n buttonCluster={buttonCluster}\n onClose={handleCancel}\n onEscape={handleCancel}\n minHeight={minHeight}\n maxWidth={600}\n titleStyle={{ paddingLeft: \"10px\" }}\n footerStyle={{ paddingBottom: \"10px\", paddingRight: \"10px\" }}\n trapFocus={false}\n >\n {/* 'onSubLayerStateChange' is used to trigger hook state change only, no need to update subLayer objects */}\n <SubLayersTree expandMode=\"full\" checkboxStyle=\"standard\" subLayers={subLayers} onSubLayerStateChange={() => setSubLayers([...subLayers])}/>\n\n {/* Warning message */}\n {renderWarningMessage()}\n </Dialog>\n </div >\n );\n}\n"]}
@@ -0,0 +1,17 @@
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
+
6
+ .map-layer-select-features-dialog {
7
+ z-Index: 21000;
8
+
9
+ }
10
+
11
+ .map-layer-select-features-dialog.core-dialog .core-dialog-container .core-dialog-area > .core-dialog-content {
12
+ overflow: hidden;
13
+ }
14
+ .map-layer-select-features-dialog .map-manager-sublayer-tree-content {
15
+ min-height: 200px;
16
+ }
17
+
@@ -1,5 +1,5 @@
1
1
  import { ImageMapLayerProps } from "@itwin/core-common";
2
- import { MapLayerSource, ScreenViewport } from "@itwin/core-frontend";
2
+ import { MapLayerSource, MapLayerSourceValidation, ScreenViewport } from "@itwin/core-frontend";
3
3
  import { MapTypesOptions } from "../Interfaces";
4
4
  import "./MapUrlDialog.scss";
5
5
  export declare const MAP_TYPES: {
@@ -9,15 +9,20 @@ export declare const MAP_TYPES: {
9
9
  tileUrl: string;
10
10
  arcGisFeature: string;
11
11
  };
12
+ export declare type LayerCreationMode = "single" | "multiple";
12
13
  interface MapUrlDialogProps {
13
14
  activeViewport?: ScreenViewport;
14
15
  isOverlay: boolean;
15
- onOkResult: () => void;
16
+ onOkResult: (result?: SourceState) => void;
16
17
  onCancelResult?: () => void;
17
18
  mapTypesOptions?: MapTypesOptions;
18
19
  layerRequiringCredentials?: ImageMapLayerProps;
19
20
  mapLayerSourceToEdit?: MapLayerSource;
20
21
  }
22
+ export interface SourceState {
23
+ source: MapLayerSource;
24
+ validation: MapLayerSourceValidation;
25
+ }
21
26
  export declare function MapUrlDialog(props: MapUrlDialogProps): JSX.Element;
22
27
  export {};
23
28
  //# sourceMappingURL=MapUrlDialog.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MapUrlDialog.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/MapUrlDialog.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAC4B,cAAc,EAC8C,cAAc,EAC5G,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,qBAAqB,CAAC;AAI7B,eAAO,MAAM,SAAS;;;;;;CAMrB,CAAC;AAEF,UAAU,iBAAiB;IACzB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,eAAe,CAAC,EAAE,eAAe,CAAC;IAGlC,yBAAyB,CAAC,EAAE,kBAAkB,CAAC;IAE/C,oBAAoB,CAAC,EAAE,cAAc,CAAC;CACvC;AAGD,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,eA0mBpD"}
1
+ {"version":3,"file":"MapUrlDialog.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/MapUrlDialog.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAC4B,cAAc,EACzB,wBAAwB,EAA+C,cAAc,EAC5G,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAGhD,OAAO,qBAAqB,CAAC;AAE7B,eAAO,MAAM,SAAS;;;;;;CAMrB,CAAC;AAEF,oBAAY,iBAAiB,GAAG,QAAQ,GAAC,UAAU,CAAC;AACpD,UAAU,iBAAiB;IACzB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,CAAC,MAAM,CAAC,EAAE,WAAW,KAAK,IAAI,CAAC;IAC3C,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,eAAe,CAAC,EAAE,eAAe,CAAC;IAGlC,yBAAyB,CAAC,EAAE,kBAAkB,CAAC;IAE/C,oBAAoB,CAAC,EAAE,cAAc,CAAC;CACvC;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,cAAc,CAAC;IACvB,UAAU,EAAE,wBAAwB,CAAC;CACtC;AAGD,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,eA+fpD"}
@@ -7,16 +7,15 @@
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.MapUrlDialog = exports.MAP_TYPES = void 0;
9
9
  const appui_abstract_1 = require("@itwin/appui-abstract");
10
- const appui_react_1 = require("@itwin/appui-react");
11
10
  const itwinui_react_1 = require("@itwin/itwinui-react");
12
11
  const core_frontend_1 = require("@itwin/core-frontend");
13
12
  const core_react_1 = require("@itwin/core-react");
14
13
  const React = require("react");
15
14
  const MapLayerPreferences_1 = require("../../MapLayerPreferences");
16
15
  const mapLayers_1 = require("../../mapLayers");
17
- require("./MapUrlDialog.scss");
18
16
  const core_bentley_1 = require("@itwin/core-bentley");
19
17
  const SelectMapFormat_1 = require("./SelectMapFormat");
18
+ require("./MapUrlDialog.scss");
20
19
  exports.MAP_TYPES = {
21
20
  wms: "WMS",
22
21
  arcGis: "ArcGIS",
@@ -26,7 +25,7 @@ exports.MAP_TYPES = {
26
25
  };
27
26
  // eslint-disable-next-line @typescript-eslint/naming-convention
28
27
  function MapUrlDialog(props) {
29
- const { isOverlay, onOkResult, mapTypesOptions } = props;
28
+ const { onOkResult, mapTypesOptions } = props;
30
29
  const getMapUrlFromProps = React.useCallback(() => {
31
30
  if (props.mapLayerSourceToEdit) {
32
31
  return props.mapLayerSourceToEdit.url;
@@ -104,27 +103,11 @@ function MapUrlDialog(props) {
104
103
  && props.activeViewport.iModel.iTwinId !== core_bentley_1.Guid.empty
105
104
  && props?.activeViewport?.iModel?.iModelId !== undefined
106
105
  && props?.activeViewport.iModel.iModelId !== core_bentley_1.Guid.empty);
107
- // Even though the settings storage is available,
108
- // we don't always want to enable it in the UI.
109
- const [settingsStorageDisabled] = React.useState(!isSettingsStorageAvailable || props.mapLayerSourceToEdit !== undefined || props.layerRequiringCredentials !== undefined);
110
- const [layerRequiringCredentialsIdx] = React.useState(() => {
111
- if (props.layerRequiringCredentials === undefined || !props.layerRequiringCredentials.name || !props.layerRequiringCredentials.url) {
112
- return undefined;
113
- }
114
- const indexInDisplayStyle = props.activeViewport?.displayStyle.findMapLayerIndexByNameAndSource(props.layerRequiringCredentials.name, props.layerRequiringCredentials.url, isOverlay);
115
- if (indexInDisplayStyle === undefined || indexInDisplayStyle < 0) {
116
- return undefined;
117
- }
118
- else {
119
- return indexInDisplayStyle;
120
- }
121
- });
122
106
  const handleCancel = React.useCallback(() => {
123
107
  if (props.onCancelResult) {
124
108
  props.onCancelResult();
125
109
  return;
126
110
  }
127
- appui_react_1.UiFramework.dialogs.modal.close();
128
111
  }, [props]);
129
112
  const onUsernameChange = React.useCallback((event) => {
130
113
  setUserName(event.target.value);
@@ -170,105 +153,6 @@ function MapUrlDialog(props) {
170
153
  }
171
154
  return sourceRequireAuth || invalidCredentials;
172
155
  }, [accessClient, invalidCredentialsProvided]);
173
- const updateAttachedLayer = React.useCallback(async (source, validation) => {
174
- const vp = props?.activeViewport;
175
- if (vp === undefined || source === undefined || layerRequiringCredentialsIdx === undefined) {
176
- const error = mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:Messages.MapLayerAttachMissingViewOrSource");
177
- const msg = mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:Messages.MapLayerAttachError", { error, sourceUrl: source.url });
178
- core_frontend_1.IModelApp.notifications.outputMessage(new core_frontend_1.NotifyMessageDetails(core_frontend_1.OutputMessagePriority.Error, msg));
179
- return true;
180
- }
181
- // Layer is already attached,
182
- // This calls invalidateRenderPlan()
183
- vp.displayStyle.changeMapLayerProps({
184
- subLayers: validation.subLayers,
185
- }, { index: layerRequiringCredentialsIdx, isOverlay });
186
- vp.displayStyle.changeMapLayerCredentials({ index: layerRequiringCredentialsIdx, isOverlay }, source.userName, source.password);
187
- // Either initial attach/initialize failed or the layer failed to load at least one tile
188
- // because of an invalid token; in both cases tile tree needs to be fully reset
189
- const provider = vp.getMapLayerImageryProvider({ index: layerRequiringCredentialsIdx, isOverlay });
190
- provider?.resetStatus();
191
- vp.resetMapLayer({ index: layerRequiringCredentialsIdx, isOverlay });
192
- // This handler will close the layer source handler, and therefore the MapUrl dialog.
193
- // don't call it if the dialog needs to remains open.
194
- onOkResult();
195
- return true;
196
- }, [isOverlay, layerRequiringCredentialsIdx, onOkResult, props.activeViewport]);
197
- // Returns true if no further input is needed from end-user.
198
- const doAttach = React.useCallback(async (source, validation) => {
199
- const vp = props?.activeViewport;
200
- if (vp === undefined || source === undefined) {
201
- const error = mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:Messages.MapLayerAttachMissingViewOrSource");
202
- const msg = mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:Messages.MapLayerAttachError", { error, sourceUrl: source.url });
203
- core_frontend_1.IModelApp.notifications.outputMessage(new core_frontend_1.NotifyMessageDetails(core_frontend_1.OutputMessagePriority.Error, msg));
204
- return true;
205
- }
206
- // Update service settings if storage is available and we are not prompting user for credentials
207
- if (!settingsStorageDisabled && !props.layerRequiringCredentials) {
208
- const storeOnIModel = (hasImodelContext ? "Model" === settingsStorage : undefined);
209
- if (vp.iModel.iTwinId && !(await MapLayerPreferences_1.MapLayerPreferences.storeSource(source, vp.iModel.iTwinId, vp.iModel.iModelId, storeOnIModel))) {
210
- const msgError = mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:Messages.MapLayerPreferencesStoreFailed");
211
- core_frontend_1.IModelApp.notifications.outputMessage(new core_frontend_1.NotifyMessageDetails(core_frontend_1.OutputMessagePriority.Error, msgError));
212
- }
213
- }
214
- // Some sources have a single non-visible sub-layer (i.e. ArcGIS World Topo Map); to avoid having a layer with no content (and no way to change the sub-layer visibility)
215
- // we force the sub-layer visibility to ON.
216
- let subLayers = validation.subLayers;
217
- if (validation.subLayers && validation.subLayers.length === 1 && validation.subLayers[0].visible === false) {
218
- subLayers = [{ ...validation.subLayers[0], visible: true }];
219
- }
220
- const settings = source.toLayerSettings(subLayers);
221
- if (settings) {
222
- vp.displayStyle.attachMapLayer({ settings, mapLayerIndex: { index: -1, isOverlay } });
223
- const msg = core_frontend_1.IModelApp.localization.getLocalizedString("mapLayers:Messages.MapLayerAttached", { sourceName: source.name, sourceUrl: source.url });
224
- core_frontend_1.IModelApp.notifications.outputMessage(new core_frontend_1.NotifyMessageDetails(core_frontend_1.OutputMessagePriority.Info, msg));
225
- }
226
- else {
227
- const msgError = mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:Messages.MapLayerLayerSettingsConversionError");
228
- const msg = mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:CustomAttach.MapLayerAttachError", { error: msgError, sourceUrl: source.url });
229
- core_frontend_1.IModelApp.notifications.outputMessage(new core_frontend_1.NotifyMessageDetails(core_frontend_1.OutputMessagePriority.Error, msg));
230
- }
231
- // This handler will close the layer source handler, and therefore the MapUrl dialog.
232
- // don't call it if the dialog needs to remains open.
233
- onOkResult();
234
- return true;
235
- }, [hasImodelContext, isOverlay, onOkResult, props?.activeViewport, props.layerRequiringCredentials, settingsStorage, settingsStorageDisabled]);
236
- // Validate the layer source and attempt to attach (or update) the layer.
237
- // Returns true if no further input is needed from end-user (i.e. close the dialog)
238
- const attemptAttachSource = React.useCallback(async (source) => {
239
- try {
240
- const validation = await source.validateSource(true);
241
- if (validation.status === core_frontend_1.MapLayerSourceStatus.Valid) {
242
- if (layerRequiringCredentialsIdx === undefined) {
243
- return await doAttach(source, validation);
244
- }
245
- else {
246
- return await updateAttachedLayer(source, validation);
247
- }
248
- }
249
- else if (validation.status === core_frontend_1.MapLayerSourceStatus.InvalidCoordinateSystem) {
250
- const msg = mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:CustomAttach.InvalidCoordinateSystem");
251
- core_frontend_1.IModelApp.notifications.outputMessage(new core_frontend_1.NotifyMessageDetails(core_frontend_1.OutputMessagePriority.Error, msg));
252
- return true;
253
- }
254
- else {
255
- const authNeeded = await updateAuthState(source, validation);
256
- if (authNeeded) {
257
- return false;
258
- }
259
- else {
260
- const msg = mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:CustomAttach.ValidationError");
261
- core_frontend_1.IModelApp.notifications.outputMessage(new core_frontend_1.NotifyMessageDetails(core_frontend_1.OutputMessagePriority.Error, `${msg} ${source.url}`));
262
- return true;
263
- }
264
- }
265
- }
266
- catch (error) {
267
- const msg = mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:Messages.MapLayerAttachError", { error, sourceUrl: source.url });
268
- core_frontend_1.IModelApp.notifications.outputMessage(new core_frontend_1.NotifyMessageDetails(core_frontend_1.OutputMessagePriority.Error, msg));
269
- return true;
270
- }
271
- }, [updateAuthState, doAttach, layerRequiringCredentialsIdx, updateAttachedLayer]);
272
156
  const onNameChange = React.useCallback((event) => {
273
157
  setMapName(event.target.value);
274
158
  }, [setMapName]);
@@ -297,12 +181,11 @@ function MapUrlDialog(props) {
297
181
  const handleOk = React.useCallback(() => {
298
182
  const source = createSource();
299
183
  if (source === undefined || props.mapLayerSourceToEdit) {
300
- appui_react_1.UiFramework.dialogs.modal.close();
301
184
  onOkResult();
302
185
  if (source === undefined) {
303
186
  // Close the dialog and inform end user something went wrong.
304
187
  const msgError = mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:Messages.MapLayerLayerSourceCreationFailed");
305
- const msg = mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:Messages.MapLayerAttachError", { error: msgError, sourceUrl: mapUrl });
188
+ const msg = mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:Messages.MapLayerAttachError", { error: msgError, sourceName: mapName });
306
189
  core_frontend_1.IModelApp.notifications.outputMessage(new core_frontend_1.NotifyMessageDetails(core_frontend_1.OutputMessagePriority.Error, msg));
307
190
  return;
308
191
  }
@@ -324,27 +207,47 @@ function MapUrlDialog(props) {
324
207
  return;
325
208
  }
326
209
  }
327
- setLayerAttachPending(true);
328
210
  // Attach source asynchronously.
329
211
  void (async () => {
330
212
  try {
331
- const closeDialog = await attemptAttachSource(source);
213
+ setLayerAttachPending(true);
214
+ const validation = await source.validateSource(true);
332
215
  if (isMounted.current) {
333
216
  setLayerAttachPending(false);
334
217
  }
335
- // In theory the modal dialog should always get closed by the parent
336
- // AttachLayerPanel's 'onOkResult' handler. We close it here just in case.
337
- if (closeDialog) {
338
- appui_react_1.UiFramework.dialogs.modal.close();
339
- onOkResult();
218
+ if (validation.status === core_frontend_1.MapLayerSourceStatus.Valid) {
219
+ // Update service settings if storage is available and we are not prompting user for credentials
220
+ if (isSettingsStorageAvailable && !props.layerRequiringCredentials) {
221
+ const storeOnIModel = (hasImodelContext ? "Model" === settingsStorage : undefined);
222
+ const vp = props.activeViewport;
223
+ if (vp?.iModel.iTwinId && !(await MapLayerPreferences_1.MapLayerPreferences.storeSource(source, vp.iModel.iTwinId, vp.iModel.iModelId, storeOnIModel))) {
224
+ const msgError = mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:Messages.MapLayerPreferencesStoreFailed");
225
+ core_frontend_1.IModelApp.notifications.outputMessage(new core_frontend_1.NotifyMessageDetails(core_frontend_1.OutputMessagePriority.Error, msgError));
226
+ }
227
+ }
228
+ onOkResult({ source, validation });
229
+ }
230
+ else if (validation.status === core_frontend_1.MapLayerSourceStatus.InvalidCoordinateSystem) {
231
+ const msg = mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:CustomAttach.InvalidCoordinateSystem");
232
+ core_frontend_1.IModelApp.notifications.outputMessage(new core_frontend_1.NotifyMessageDetails(core_frontend_1.OutputMessagePriority.Error, msg));
233
+ onOkResult({ source, validation });
234
+ }
235
+ else {
236
+ const authNeeded = await updateAuthState(source, validation);
237
+ if (!authNeeded) {
238
+ const msg = mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:CustomAttach.ValidationError");
239
+ core_frontend_1.IModelApp.notifications.outputMessage(new core_frontend_1.NotifyMessageDetails(core_frontend_1.OutputMessagePriority.Error, `${msg} ${source.url}`));
240
+ onOkResult({ source, validation });
241
+ }
340
242
  }
341
243
  }
342
- catch (_error) {
244
+ catch (error) {
245
+ const msg = mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:Messages.MapLayerAttachError", { error, sourceName: source.name });
246
+ core_frontend_1.IModelApp.notifications.outputMessage(new core_frontend_1.NotifyMessageDetails(core_frontend_1.OutputMessagePriority.Error, msg));
343
247
  onOkResult();
344
- appui_react_1.UiFramework.dialogs.modal.close();
345
248
  }
346
249
  })();
347
- }, [createSource, props.mapLayerSourceToEdit, props.activeViewport, onOkResult, mapUrl, isSettingsStorageAvailable, attemptAttachSource]);
250
+ }, [createSource, mapName, props.mapLayerSourceToEdit, props.activeViewport, onOkResult, isSettingsStorageAvailable, updateAuthState, hasImodelContext, props.layerRequiringCredentials, settingsStorage]);
348
251
  React.useEffect(() => {
349
252
  const handleOAuthProcessEnd = (success, _state) => {
350
253
  onOauthProcessEnd.raiseEvent(success, _state);
@@ -515,11 +418,12 @@ function MapUrlDialog(props) {
515
418
  React.createElement(itwinui_react_1.LabeledInput, { className: "map-layer-source-input", displayStyle: "inline", placeholder: serverRequireCredentials ? userNameRequiredLabel : userNameLabel, status: (!userName && serverRequireCredentials) || invalidCredentialsProvided ? "warning" : undefined, disabled: layerAttachPending || layerAuthPending, onChange: onUsernameChange, value: userName, size: "small" }),
516
419
  React.createElement("span", { className: "map-layer-source-label" }, passwordLabel),
517
420
  React.createElement(itwinui_react_1.LabeledInput, { className: "map-layer-source-input", displayStyle: "inline", type: "password", placeholder: serverRequireCredentials ? passwordRequiredLabel : passwordLabel, status: (!password && serverRequireCredentials) || invalidCredentialsProvided ? "warning" : undefined, disabled: layerAttachPending || layerAuthPending, onChange: onPasswordChange, onKeyPress: handleOnKeyDown, value: password, size: "small" })),
518
- isSettingsStorageAvailable &&
519
- React.createElement("div", { title: settingsStorageDisabled ? noSaveSettingsWarning : "" }, hasImodelContext &&
421
+ !props.layerRequiringCredentials
422
+ && !props.mapLayerSourceToEdit
423
+ && React.createElement("div", { title: !isSettingsStorageAvailable ? noSaveSettingsWarning : "" }, hasImodelContext &&
520
424
  React.createElement("div", null,
521
- React.createElement(itwinui_react_1.Radio, { disabled: settingsStorageDisabled, name: "settingsStorage", value: "iTwin", label: iTwinSettingsLabel, checked: settingsStorage === "iTwin", onChange: onRadioChange }),
522
- React.createElement(itwinui_react_1.Radio, { disabled: settingsStorageDisabled, name: "settingsStorage", value: "Model", label: modelSettingsLabel, checked: settingsStorage === "Model", onChange: onRadioChange }))))),
425
+ React.createElement(itwinui_react_1.Radio, { disabled: !isSettingsStorageAvailable, name: "settingsStorage", value: "iTwin", label: iTwinSettingsLabel, checked: settingsStorage === "iTwin", onChange: onRadioChange }),
426
+ React.createElement(itwinui_react_1.Radio, { disabled: !isSettingsStorageAvailable, name: "settingsStorage", value: "Model", label: modelSettingsLabel, checked: settingsStorage === "Model", onChange: onRadioChange }))))),
523
427
  renderWarningMessage(),
524
428
  (layerAttachPending || layerAuthPending) &&
525
429
  React.createElement("div", { className: "map-layer-source-progressBar" },