@itwin/map-layers 5.2.2 → 5.2.4

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 (43) hide show
  1. package/CHANGELOG.md +18 -1
  2. package/lib/cjs/public/locales/en/mapLayers.json +9 -2
  3. package/lib/cjs/ui/FeatureInfoUiItemsProvider.js +1 -1
  4. package/lib/cjs/ui/FeatureInfoUiItemsProvider.js.map +1 -1
  5. package/lib/cjs/ui/Interfaces.d.ts +4 -2
  6. package/lib/cjs/ui/Interfaces.d.ts.map +1 -1
  7. package/lib/cjs/ui/Interfaces.js.map +1 -1
  8. package/lib/cjs/ui/widget/BasemapPanel.d.ts.map +1 -1
  9. package/lib/cjs/ui/widget/BasemapPanel.js +79 -52
  10. package/lib/cjs/ui/widget/BasemapPanel.js.map +1 -1
  11. package/lib/cjs/ui/widget/FeatureInfoWidget.d.ts +1 -0
  12. package/lib/cjs/ui/widget/FeatureInfoWidget.d.ts.map +1 -1
  13. package/lib/cjs/ui/widget/FeatureInfoWidget.js +17 -1
  14. package/lib/cjs/ui/widget/FeatureInfoWidget.js.map +1 -1
  15. package/lib/cjs/ui/widget/MapLayerManager.d.ts +4 -1
  16. package/lib/cjs/ui/widget/MapLayerManager.d.ts.map +1 -1
  17. package/lib/cjs/ui/widget/MapLayerManager.js +10 -6
  18. package/lib/cjs/ui/widget/MapLayerManager.js.map +1 -1
  19. package/lib/cjs/ui/widget/MapUrlDialog.d.ts.map +1 -1
  20. package/lib/cjs/ui/widget/MapUrlDialog.js +22 -11
  21. package/lib/cjs/ui/widget/MapUrlDialog.js.map +1 -1
  22. package/lib/esm/public/locales/en/mapLayers.json +9 -2
  23. package/lib/esm/ui/FeatureInfoUiItemsProvider.js +1 -1
  24. package/lib/esm/ui/FeatureInfoUiItemsProvider.js.map +1 -1
  25. package/lib/esm/ui/Interfaces.d.ts +4 -2
  26. package/lib/esm/ui/Interfaces.d.ts.map +1 -1
  27. package/lib/esm/ui/Interfaces.js.map +1 -1
  28. package/lib/esm/ui/widget/BasemapPanel.d.ts.map +1 -1
  29. package/lib/esm/ui/widget/BasemapPanel.js +80 -53
  30. package/lib/esm/ui/widget/BasemapPanel.js.map +1 -1
  31. package/lib/esm/ui/widget/FeatureInfoWidget.d.ts +1 -0
  32. package/lib/esm/ui/widget/FeatureInfoWidget.d.ts.map +1 -1
  33. package/lib/esm/ui/widget/FeatureInfoWidget.js +15 -0
  34. package/lib/esm/ui/widget/FeatureInfoWidget.js.map +1 -1
  35. package/lib/esm/ui/widget/MapLayerManager.d.ts +4 -1
  36. package/lib/esm/ui/widget/MapLayerManager.d.ts.map +1 -1
  37. package/lib/esm/ui/widget/MapLayerManager.js +10 -6
  38. package/lib/esm/ui/widget/MapLayerManager.js.map +1 -1
  39. package/lib/esm/ui/widget/MapUrlDialog.d.ts.map +1 -1
  40. package/lib/esm/ui/widget/MapUrlDialog.js +22 -11
  41. package/lib/esm/ui/widget/MapUrlDialog.js.map +1 -1
  42. package/lib/public/locales/en/mapLayers.json +9 -2
  43. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"BasemapPanel.js","sourceRoot":"","sources":["../../../../src/ui/widget/BasemapPanel.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,4CAA4C;AAC5C,2CAA2C;AAE3C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAqC,oBAAoB,EAAE,WAAW,EAAE,QAAQ,EAAE,qBAAqB,EAAqC,MAAM,oBAAoB,CAAC;AAC9K,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAChF,OAAO,EAAE,MAAM,EAAE,MAAM,EAAgB,MAAM,sBAAsB,CAAC;AACpE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAA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BAAuB;YACpC,oBAAC,MAAM,IAAC,SAAS,EAAC,4DAA4D,EAAC,IAAI,EAAC,OAAO,EAAC,SAAS,EAAC,YAAY,EAAC,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,sBAAsB,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,CAAC,cAAc,IAAI,CAAC,CAAC,cAAc,CAAC,YAAY,CAAC,iBAAiB,YAAY,qBAAqB,CAAC;gBAC3S,oBAAC,WAAW,IAAC,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,wBAAwB,GAAI,CACjF;YACT,8BAAM,SAAS,EAAC,wBAAwB,IAAE,cAAc,CAAQ;YAChE,oBAAC,MAAM,IAAC,SAAS,EAAC,8BAA8B,EAC9C,OAAO,EAAE,cAAc,EACvB,WAAW,EAAE,kBAAkB,EAC/B,KAAK,EAAE,oBAAoB,CAAC,KAAK,EACjC,QAAQ,EAAE,sBAAsB,EAAE,IAAI,EAAC,OAAO,EAC9C,QAAQ,EAAE,KAAK,CAAC,QAAQ,GACxB;YAEA,WAAW;gBACX,oBAAC,WAAW,IAAC,SAAS,EAAC,6BAA6B,EAAC,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,kBAAkB,GAAI;YAE9I,oBAAC,uBAAuB,IAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,YAAY,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,+BAA+B,GAAI,CAChJ,CACL,CACJ,CAAC;AACJ,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/* eslint-disable deprecation/deprecation */\n// cSpell:ignore droppable Sublayer Basemap\n\nimport { UiFramework } from \"@itwin/appui-react\";\nimport { BaseLayerProps, BaseLayerSettings, BaseMapLayerSettings, ColorByName, ColorDef, ImageMapLayerSettings, MapImagerySettings, MapLayerProps } from \"@itwin/core-common\";\nimport { WebFontIcon } from \"@itwin/core-react\";\nimport { ColorPickerDialog, ColorSwatch } from \"@itwin/imodel-components-react\";\nimport { Button, Select, SelectOption } from \"@itwin/itwinui-react\";\nimport * as React from \"react\";\nimport { MapLayersUI } from \"../../mapLayers\";\nimport { useSourceMapContext } from \"./MapLayerManager\";\nimport { TransparencyPopupButton } from \"./TransparencyPopupButton\";\nimport \"./BasemapPanel.scss\";\n\nfunction getBaseMapFromStyle(backgroundBase: BaseLayerSettings | undefined) {\n if (!backgroundBase)\n return undefined;\n\n if (backgroundBase instanceof ImageMapLayerSettings || backgroundBase instanceof ColorDef)\n return backgroundBase.toJSON();\n\n return undefined;\n}\n\ninterface BasemapPanelProps {\n disabled?: boolean;\n}\n\n/** @internal */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function BasemapPanel(props: BasemapPanelProps) {\n const [useColorLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Basemap.ColorFill\"));\n const { activeViewport, bases } = useSourceMapContext();\n const [selectedBaseMap, setSelectedBaseMap] = React.useState<BaseLayerProps | undefined>(getBaseMapFromStyle(activeViewport?.displayStyle.settings.mapImagery.backgroundBase));\n const [baseMapTransparencyValue, setBaseMapTransparencyValue] = React.useState(() => {\n if (activeViewport) {\n const mapImagery = activeViewport.displayStyle.settings.mapImagery;\n if (mapImagery.backgroundBase instanceof ImageMapLayerSettings) {\n return mapImagery.backgroundBase.transparency;\n } else if (mapImagery.backgroundBase instanceof ColorDef ) {\n return mapImagery.backgroundBase.getAlpha()/255;\n } else {\n return 0;\n }\n } else {\n return 0;\n }\n });\n\n const [baseMapVisible, setBaseMapVisible] = React.useState(() => {\n if (activeViewport && activeViewport.displayStyle.backgroundMapBase instanceof ImageMapLayerSettings) {\n return activeViewport.displayStyle.backgroundMapBase.visible;\n }\n return false;\n });\n\n const handleMapImageryChanged = React.useCallback((args: Readonly<MapImagerySettings>) => {\n // selectedBaseMap\n const baseMap = getBaseMapFromStyle(args.backgroundBase);\n if (JSON.stringify(baseMap) !== JSON.stringify(selectedBaseMap))\n setSelectedBaseMap(baseMap);\n\n // baseMapTransparencyValue\n if (args.backgroundBase instanceof ImageMapLayerSettings && args.backgroundBase.transparency !== baseMapTransparencyValue) {\n setBaseMapTransparencyValue(args.backgroundBase.transparency);\n } else if (args.backgroundBase instanceof ColorDef && args.backgroundBase.getAlpha() !== baseMapTransparencyValue ) {\n setBaseMapTransparencyValue(args.backgroundBase.getAlpha()/255);\n }\n\n // baseMapVisible\n if (args.backgroundBase instanceof ImageMapLayerSettings && args.backgroundBase.visible !== baseMapVisible) {\n setBaseMapVisible(args.backgroundBase.visible);\n }\n }, [baseMapTransparencyValue, baseMapVisible, selectedBaseMap, setBaseMapTransparencyValue, setBaseMapVisible, setSelectedBaseMap]);\n\n // Monitor display style's onMapImageryChanged event\n React.useEffect(() => {\n return activeViewport?.displayStyle.settings.onMapImageryChanged.addListener(handleMapImageryChanged);\n }, [activeViewport, handleMapImageryChanged]);\n\n // Monitor viewport updates, and refresh the widget accordingly.\n // Note: This is needed for multiple viewport applications.\n React.useEffect(() => {\n if (activeViewport) {\n handleMapImageryChanged(activeViewport.displayStyle.settings.mapImagery);\n }\n }, [activeViewport, handleMapImageryChanged]);\n\n const handleBasemapTransparencyChange = React.useCallback((transparency: number) => {\n if (activeViewport) {\n activeViewport.displayStyle.changeBaseMapTransparency(transparency);\n setBaseMapTransparencyValue(transparency);\n }\n }, [activeViewport]);\n\n const baseMapOptions = React.useMemo<SelectOption<string>[]>(() => {\n const baseOptions: SelectOption<string>[] = [];\n\n baseOptions.push({ value: useColorLabel, label: useColorLabel });\n\n if (bases)\n baseOptions.push(...bases.map((value) => ({ value: value.name, label: value.name })));\n return baseOptions;\n }, [bases, useColorLabel]);\n\n const [presetColors] = React.useState([\n ColorDef.create(ColorByName.grey),\n ColorDef.create(ColorByName.lightGrey),\n ColorDef.create(ColorByName.darkGrey),\n ColorDef.create(ColorByName.lightBlue),\n ColorDef.create(ColorByName.lightGreen),\n ColorDef.create(ColorByName.darkGreen),\n ColorDef.create(ColorByName.tan),\n ColorDef.create(ColorByName.darkBrown),\n ]);\n\n const baseIsColor = React.useMemo(() => typeof selectedBaseMap === \"number\", [selectedBaseMap]);\n const baseIsMap = React.useMemo(() => !baseIsColor && (selectedBaseMap !== undefined), [baseIsColor, selectedBaseMap]);\n const bgColor = React.useMemo(() => baseIsColor ? selectedBaseMap as number : presetColors[0].toJSON(), [baseIsColor, selectedBaseMap, presetColors]);\n const [colorDialogTitle] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:ColorDialog.Title\"));\n const selectedBaseMapValue = React.useMemo(() => {\n if (baseIsMap) {\n const mapName = (selectedBaseMap! as MapLayerProps).name;\n const foundItem = baseMapOptions.find((value) => value.label === mapName);\n if (foundItem)\n return foundItem;\n }\n return baseMapOptions[0];\n }, [selectedBaseMap, baseMapOptions, baseIsMap]);\n\n const handleBackgroundColorDialogOk = React.useCallback((bgColorDef: ColorDef) => {\n UiFramework.dialogs.modal.close();\n if (activeViewport) {\n // change color and make sure previously set transparency is not lost.\n const curTransparency = activeViewport.displayStyle.backgroundMapBase instanceof ColorDef ? activeViewport.displayStyle.backgroundMapBase.getTransparency() : 0;\n activeViewport.displayStyle.backgroundMapBase = bgColorDef.withTransparency(curTransparency);\n setSelectedBaseMap(bgColorDef.toJSON());\n }\n }, [activeViewport]);\n\n const handleBackgroundColorDialogCancel = React.useCallback(() => {\n UiFramework.dialogs.modal.close();\n }, []);\n\n const handleBgColorClick = React.useCallback((newColor: ColorDef, e: React.MouseEvent<Element, MouseEvent>) => {\n e.preventDefault();\n UiFramework.dialogs.modal.open(<ColorPickerDialog dialogTitle={colorDialogTitle} color={newColor} colorPresets={presetColors} colorInputType={\"rgb\"}\n onOkResult={handleBackgroundColorDialogOk} onCancelResult={handleBackgroundColorDialogCancel} />);\n }, [presetColors, handleBackgroundColorDialogOk]); // eslint-disable-line react-hooks/exhaustive-deps\n\n const handleBaseMapSelection = React.useCallback((value: string) => {\n if (bases && activeViewport && value) {\n const baseMap = bases.find((map) => map.name === value);\n if (baseMap) {\n const baseProps: MapLayerProps = baseMap.toJSON();\n if (activeViewport.displayStyle.backgroundMapBase instanceof BaseMapLayerSettings) {\n activeViewport.displayStyle.backgroundMapBase = activeViewport.displayStyle.backgroundMapBase.clone({...baseProps, visible: baseMapVisible});\n } else {\n activeViewport.displayStyle.backgroundMapBase = BaseMapLayerSettings.fromJSON({...baseProps, visible: baseMapVisible});\n }\n setSelectedBaseMap(baseProps);\n } else {\n const bgColorDef = ColorDef.fromJSON(bgColor);\n const curTransparency = activeViewport.displayStyle.backgroundMapBase instanceof ColorDef ? activeViewport.displayStyle.backgroundMapBase.getTransparency() : 0;\n activeViewport.displayStyle.backgroundMapBase = bgColorDef.withTransparency(curTransparency);\n setSelectedBaseMap(bgColorDef.toJSON());\n }\n }\n }, [baseMapVisible, bases, activeViewport, bgColor]);\n\n const handleVisibilityChange = React.useCallback(() => {\n if (activeViewport) {\n const newState = !baseMapVisible;\n // BaseMap visibility is only support when backgroundBase is an instance of BaseMapLayerSettings (i.e not a color)...\n if (activeViewport.displayStyle.backgroundMapBase instanceof BaseMapLayerSettings) {\n activeViewport.displayStyle.backgroundMapBase = activeViewport.displayStyle.backgroundMapBase.clone({ visible: newState });\n }\n setBaseMapVisible(newState);\n }\n }, [baseMapVisible, activeViewport]);\n\n const [baseLayerLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Basemap.BaseLayer\"));\n const [selectBaseMapLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Basemap.SelectBaseMap\"));\n const [toggleVisibility] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.ToggleVisibility\"));\n\n return (\n <>\n <div className=\"map-manager-base-item\" >\n <Button className=\"map-manager-basemap-visibility map-manager-visibility-icon\" size=\"small\" styleType=\"borderless\" title={toggleVisibility} onClick={handleVisibilityChange} disabled={props.disabled || !activeViewport || !(activeViewport.displayStyle.backgroundMapBase instanceof ImageMapLayerSettings)}>\n <WebFontIcon iconName={baseMapVisible ? \"icon-visibility\" : \"icon-visibility-hide-2\"} />\n </Button>\n <span className=\"map-manager-base-label\">{baseLayerLabel}</span>\n <Select className=\"map-manager-base-item-select\"\n options={baseMapOptions}\n placeholder={selectBaseMapLabel}\n value={selectedBaseMapValue.value}\n onChange={handleBaseMapSelection} size=\"small\"\n disabled={props.disabled}\n />\n {\n baseIsColor &&\n <ColorSwatch className=\"map-manager-base-item-color\" colorDef={ColorDef.fromJSON(bgColor)} round={false} onColorPick={handleBgColorClick} />\n }\n <TransparencyPopupButton disabled={props.disabled} transparency={baseMapTransparencyValue} onTransparencyChange={handleBasemapTransparencyChange} />\n </div>\n </>\n );\n}\n"]}
1
+ {"version":3,"file":"BasemapPanel.js","sourceRoot":"","sources":["../../../../src/ui/widget/BasemapPanel.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,4CAA4C;AAC5C,2CAA2C;AAE3C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAqB,oBAAoB,EAAE,WAAW,EAAE,QAAQ,EAAE,qBAAqB,EAAqC,MAAM,oBAAoB,CAAC;AACjL,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAChF,OAAO,EAAE,MAAM,EAAE,MAAM,EAAgB,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,KAAK,M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KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,sBAAsB,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,CAAC,cAAc,IAAI,CAAC,CAAC,cAAc,CAAC,YAAY,CAAC,iBAAiB,YAAY,qBAAqB,CAAC;gBAC3S,oBAAC,WAAW,IAAC,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,wBAAwB,GAAI,CACjF;YACT,oBAAC,MAAM,IAAC,SAAS,EAAC,8BAA8B,EAC9C,OAAO,EAAE,cAAc,EACvB,WAAW,EAAE,kBAAkB,EAC/B,KAAK,EAAE,oBAAoB,CAAC,KAAK,EACjC,QAAQ,EAAE,sBAAsB,EAAE,IAAI,EAAC,OAAO,EAC9C,QAAQ,EAAE,KAAK,CAAC,QAAQ,GACxB;YAEA,WAAW;gBACX,oBAAC,WAAW,IAAC,SAAS,EAAC,6BAA6B,EAAC,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,kBAAkB,GAAI;YAE9I,oBAAC,uBAAuB,IAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,YAAY,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,+BAA+B,GAAI,CAChJ,CACL,CACJ,CAAC;AACJ,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/* eslint-disable deprecation/deprecation */\n// cSpell:ignore droppable Sublayer Basemap\n\nimport { UiFramework } from \"@itwin/appui-react\";\nimport { BackgroundMapType, BaseLayerSettings, BaseMapLayerSettings, ColorByName, ColorDef, ImageMapLayerSettings, MapImagerySettings, MapLayerProps } from \"@itwin/core-common\";\nimport { WebFontIcon } from \"@itwin/core-react\";\nimport { ColorPickerDialog, ColorSwatch } from \"@itwin/imodel-components-react\";\nimport { Button, Select, SelectOption } from \"@itwin/itwinui-react\";\nimport { MapLayersUI } from \"../../mapLayers\";\nimport { useSourceMapContext } from \"./MapLayerManager\";\nimport { TransparencyPopupButton } from \"./TransparencyPopupButton\";\nimport * as React from \"react\";\nimport \"./BasemapPanel.scss\";\nimport { Viewport } from \"@itwin/core-frontend\";\n\nconst customBaseMapValue = \"customBaseMap\";\nconst getSelectKeyFromProvider = (base: BaseMapLayerSettings) => `${base.provider ? `${base.provider.name}.${BackgroundMapType[base.provider.type]}` : `${base.name}`}`;\n\ninterface BasemapPanelProps {\n disabled?: boolean;\n}\n\n/** @internal */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function BasemapPanel(props: BasemapPanelProps) {\n const [useColorLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Basemap.ColorFill\"));\n const { activeViewport, bases } = useSourceMapContext();\n const [selectedBaseMap, setSelectedBaseMap] = React.useState<BaseLayerSettings | undefined>(activeViewport?.displayStyle.settings.mapImagery.backgroundBase);\n const [baseMapTransparencyValue, setBaseMapTransparencyValue] = React.useState(() => {\n if (activeViewport) {\n const mapImagery = activeViewport.displayStyle.settings.mapImagery;\n if (mapImagery.backgroundBase instanceof ImageMapLayerSettings) {\n return mapImagery.backgroundBase.transparency;\n } else if (mapImagery.backgroundBase instanceof ColorDef ) {\n return mapImagery.backgroundBase.getAlpha()/255;\n } else {\n return 0;\n }\n } else {\n return 0;\n }\n });\n const [customBaseMap, setCustomBaseMap] = React.useState<BaseMapLayerSettings|undefined>();\n const [baseMapVisible, setBaseMapVisible] = React.useState(() => {\n if (activeViewport && activeViewport.displayStyle.backgroundMapBase instanceof ImageMapLayerSettings) {\n return activeViewport.displayStyle.backgroundMapBase.visible;\n }\n return false;\n });\n\n const handleMapImageryChanged = React.useCallback((args: Readonly<MapImagerySettings>) => {\n const baseMap = args.backgroundBase;\n\n // Optimization: If serialized 'backgroundBase' objects are identical, skip refresh\n if (JSON.stringify(baseMap.toJSON()) === JSON.stringify(selectedBaseMap?.toJSON()))\n return;\n\n setSelectedBaseMap(baseMap); // cache current base map objects\n\n if (baseMap instanceof ImageMapLayerSettings) {\n if (baseMap.transparency !== baseMapTransparencyValue)\n setBaseMapTransparencyValue(baseMap.transparency);\n\n if (baseMap.visible !== baseMapVisible)\n setBaseMapVisible(baseMap.visible);\n\n } else if (baseMap instanceof ColorDef) {\n if (baseMap.getAlpha() !== baseMapTransparencyValue ) {\n setBaseMapTransparencyValue(baseMap.getAlpha()/255);\n }\n }\n }, [baseMapTransparencyValue, baseMapVisible, selectedBaseMap]);\n\n React.useEffect(() => {\n const handleDisplayStyleChange = (vp: Viewport) => {\n handleMapImageryChanged(vp.displayStyle.settings.mapImagery);\n };\n return activeViewport?.onDisplayStyleChanged.addListener(handleDisplayStyleChange);\n }, [activeViewport, handleMapImageryChanged]);\n\n // Monitor display style's onMapImageryChanged event\n React.useEffect(() => {\n return activeViewport?.displayStyle.settings.onMapImageryChanged.addListener(handleMapImageryChanged);\n }, [activeViewport, handleMapImageryChanged]);\n\n // Monitor viewport updates, and refresh the widget accordingly .\n // Note: This is needed for multiple viewport applications.\n React.useEffect(() => {\n if (activeViewport) {\n handleMapImageryChanged(activeViewport.displayStyle.settings.mapImagery);\n }\n }, [activeViewport, handleMapImageryChanged]);\n\n const handleBasemapTransparencyChange = React.useCallback((transparency: number) => {\n if (activeViewport) {\n activeViewport.displayStyle.changeBaseMapTransparency(transparency);\n setBaseMapTransparencyValue(transparency);\n }\n }, [activeViewport]);\n\n const baseMapOptions = React.useMemo<SelectOption<string>[]>(() => {\n const baseOptions: SelectOption<string>[] = [];\n\n baseOptions.push({ value: useColorLabel, label: useColorLabel });\n\n if (bases) {\n baseOptions.push(...bases.map((bgProvider) => {\n const value = getSelectKeyFromProvider(bgProvider);\n const label = MapLayersUI.translate(`WellKnownBaseMaps.${value}`);\n return { value, label };\n } ));\n }\n if (customBaseMap) {\n baseOptions.push({value: customBaseMapValue, label: customBaseMap.name});\n }\n return baseOptions;\n }, [bases, useColorLabel, customBaseMap]);\n\n const [presetColors] = React.useState([\n ColorDef.create(ColorByName.grey),\n ColorDef.create(ColorByName.lightGrey),\n ColorDef.create(ColorByName.darkGrey),\n ColorDef.create(ColorByName.lightBlue),\n ColorDef.create(ColorByName.lightGreen),\n ColorDef.create(ColorByName.darkGreen),\n ColorDef.create(ColorByName.tan),\n ColorDef.create(ColorByName.darkBrown),\n ]);\n\n const baseIsColor = React.useMemo(() => selectedBaseMap instanceof ColorDef, [selectedBaseMap]);\n const baseIsMap = React.useMemo(() => !baseIsColor && (selectedBaseMap !== undefined), [baseIsColor, selectedBaseMap]);\n const bgColor = React.useMemo(() => baseIsColor ? (selectedBaseMap as ColorDef).toJSON(): presetColors[0].toJSON(),\n [baseIsColor, selectedBaseMap, presetColors]);\n const [colorDialogTitle] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:ColorDialog.Title\"));\n const selectedBaseMapValue = React.useMemo(() => {\n if (baseIsMap) {\n if (selectedBaseMap instanceof BaseMapLayerSettings && selectedBaseMap.provider) {\n const mapName = getSelectKeyFromProvider(selectedBaseMap);\n const foundItem = baseMapOptions.find((value) => value.value === mapName);\n if (foundItem)\n return foundItem;\n } else if (selectedBaseMap instanceof BaseMapLayerSettings) {\n // We got a custom base map, create en entry for it.\n setCustomBaseMap(selectedBaseMap);\n return {value: customBaseMapValue, label: selectedBaseMap.name};\n }\n } else if (baseIsColor) {\n return baseMapOptions[0];\n }\n return {value: \"\", label: \"\"}; // will display the place holder\n\n }, [baseIsMap, baseIsColor, selectedBaseMap, baseMapOptions]);\n\n const handleBackgroundColorDialogOk = React.useCallback((bgColorDef: ColorDef) => {\n UiFramework.dialogs.modal.close();\n if (activeViewport) {\n // change color and make sure previously set transparency is not lost.\n const curTransparency = activeViewport.displayStyle.backgroundMapBase instanceof ColorDef ? activeViewport.displayStyle.backgroundMapBase.getTransparency() : 0;\n activeViewport.displayStyle.backgroundMapBase = bgColorDef.withTransparency(curTransparency);\n setSelectedBaseMap(bgColorDef);\n }\n }, [activeViewport]);\n\n const handleBackgroundColorDialogCancel = React.useCallback(() => {\n UiFramework.dialogs.modal.close();\n }, []);\n\n const handleBgColorClick = React.useCallback((newColor: ColorDef, e: React.MouseEvent<Element, MouseEvent>) => {\n e.preventDefault();\n UiFramework.dialogs.modal.open(<ColorPickerDialog dialogTitle={colorDialogTitle} color={newColor} colorPresets={presetColors} colorInputType={\"rgb\"}\n onOkResult={handleBackgroundColorDialogOk} onCancelResult={handleBackgroundColorDialogCancel} />);\n }, [presetColors, handleBackgroundColorDialogOk]); // eslint-disable-line react-hooks/exhaustive-deps\n\n const handleBaseMapSelection = React.useCallback((value: string) => {\n if (activeViewport && value) {\n if (value === customBaseMapValue && customBaseMap) {\n setSelectedBaseMap(customBaseMap);\n activeViewport.displayStyle.backgroundMapBase = customBaseMap;\n } else if (bases) {\n const baseMap = bases.find((provider) => getSelectKeyFromProvider(provider) === value);\n if (baseMap) {\n const baseProps: MapLayerProps = baseMap.toJSON();\n if (activeViewport.displayStyle.backgroundMapBase instanceof BaseMapLayerSettings) {\n activeViewport.displayStyle.backgroundMapBase = activeViewport.displayStyle.backgroundMapBase.clone({...baseProps, visible: baseMapVisible});\n } else {\n activeViewport.displayStyle.backgroundMapBase = BaseMapLayerSettings.fromJSON({...baseProps, visible: baseMapVisible});\n }\n setSelectedBaseMap(baseMap);\n } else {\n const bgColorDef = ColorDef.fromJSON(bgColor);\n const curTransparency = activeViewport.displayStyle.backgroundMapBase instanceof ColorDef ? activeViewport.displayStyle.backgroundMapBase.getTransparency() : 0;\n activeViewport.displayStyle.backgroundMapBase = bgColorDef.withTransparency(curTransparency);\n setSelectedBaseMap(bgColorDef);\n }\n }\n }\n }, [activeViewport, bases, customBaseMap, baseMapVisible, bgColor]);\n\n const handleVisibilityChange = React.useCallback(() => {\n if (activeViewport) {\n const newState = !baseMapVisible;\n // BaseMap visibility is only support when backgroundBase is an instance of BaseMapLayerSettings (i.e not a color)...\n if (activeViewport.displayStyle.backgroundMapBase instanceof BaseMapLayerSettings) {\n activeViewport.displayStyle.backgroundMapBase = activeViewport.displayStyle.backgroundMapBase.clone({ visible: newState });\n }\n setBaseMapVisible(newState);\n }\n }, [baseMapVisible, activeViewport]);\n\n const [baseLayerLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Basemap.BaseLayer\"));\n const [selectBaseMapLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Basemap.SelectBaseMap\"));\n const [toggleVisibility] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.ToggleVisibility\"));\n\n return (\n <>\n <span className=\"map-manager-base-label\">{baseLayerLabel}</span>\n <div className=\"map-manager-base-item\" >\n <Button className=\"map-manager-basemap-visibility map-manager-visibility-icon\" size=\"small\" styleType=\"borderless\" title={toggleVisibility} onClick={handleVisibilityChange} disabled={props.disabled || !activeViewport || !(activeViewport.displayStyle.backgroundMapBase instanceof ImageMapLayerSettings)}>\n <WebFontIcon iconName={baseMapVisible ? \"icon-visibility\" : \"icon-visibility-hide-2\"} />\n </Button>\n <Select className=\"map-manager-base-item-select\"\n options={baseMapOptions}\n placeholder={selectBaseMapLabel}\n value={selectedBaseMapValue.value}\n onChange={handleBaseMapSelection} size=\"small\"\n disabled={props.disabled}\n />\n {\n baseIsColor &&\n <ColorSwatch className=\"map-manager-base-item-color\" colorDef={ColorDef.fromJSON(bgColor)} round={false} onColorPick={handleBgColorClick} />\n }\n <TransparencyPopupButton disabled={props.disabled} transparency={baseMapTransparencyValue} onTransparencyChange={handleBasemapTransparencyChange} />\n </div>\n </>\n );\n}\n"]}
@@ -1,4 +1,5 @@
1
1
  import { MapFeatureInfoOptions } from "../Interfaces";
2
+ export declare function useSpecificWidgetDef(id: string): import("@itwin/appui-react").WidgetDef | undefined;
2
3
  interface MapFeatureInfoWidgetProps {
3
4
  featureInfoOpts: MapFeatureInfoOptions;
4
5
  }
@@ -1 +1 @@
1
- {"version":3,"file":"FeatureInfoWidget.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/FeatureInfoWidget.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAGtD,UAAU,yBAAyB;IACjC,eAAe,EAAE,qBAAqB,CAAC;CACxC;AAGD,wBAAgB,oBAAoB,CAAC,EAAE,eAAe,EAAE,EAAE,yBAAyB,eAkDlF"}
1
+ {"version":3,"file":"FeatureInfoWidget.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/FeatureInfoWidget.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAKtD,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,MAAM,sDAG9C;AAGD,UAAU,yBAAyB;IACjC,eAAe,EAAE,qBAAqB,CAAC;CACxC;AAGD,wBAAgB,oBAAoB,CAAC,EAAE,eAAe,EAAE,EAAE,yBAAyB,eA4DlF"}
@@ -7,6 +7,12 @@ import { VirtualizedPropertyGridWithDataProvider } from "@itwin/components-react
7
7
  import { FillCentered, Orientation, ResizableContainerObserver } from "@itwin/core-react";
8
8
  import { FeatureInfoDataProvider } from "./FeatureInfoDataProvider";
9
9
  import { MapLayersUI } from "../../mapLayers";
10
+ import { useActiveFrontstageDef, WidgetState } from "@itwin/appui-react";
11
+ import { FeatureInfoUiItemsProvider } from "../FeatureInfoUiItemsProvider";
12
+ export function useSpecificWidgetDef(id) {
13
+ const frontstageDef = useActiveFrontstageDef();
14
+ return frontstageDef?.findWidgetDef(id);
15
+ }
10
16
  // eslint-disable-next-line @typescript-eslint/naming-convention
11
17
  export function MapFeatureInfoWidget({ featureInfoOpts }) {
12
18
  const dataProvider = React.useRef();
@@ -22,6 +28,15 @@ export function MapFeatureInfoWidget({ featureInfoOpts }) {
22
28
  dataProvider?.current?.onUnload();
23
29
  };
24
30
  }, []);
31
+ const widgetDef = useSpecificWidgetDef(FeatureInfoUiItemsProvider.widgetId);
32
+ React.useEffect(() => {
33
+ if (hasData) {
34
+ widgetDef?.setWidgetState(WidgetState.Open);
35
+ }
36
+ else {
37
+ widgetDef?.setWidgetState(WidgetState.Hidden);
38
+ }
39
+ }, [widgetDef, hasData]);
25
40
  React.useEffect(() => {
26
41
  dataProvider.current?.onDataChanged.addListener(handleDataChanged);
27
42
  return () => {
@@ -1 +1 @@
1
- {"version":3,"file":"FeatureInfoWidget.js","sourceRoot":"","sources":["../../../../src/ui/widget/FeatureInfoWidget.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,uCAAuC,EAAE,MAAM,yBAAyB,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAE1F,OAAO,EAAE,uBAAuB,EAAC,MAAM,2BAA2B,CAAC;AAEnE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAM9C,gEAAgE;AAChE,MAAM,UAAU,oBAAoB,CAAC,EAAE,eAAe,EAA6B;IAEjF,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,EAA2B,CAAC;IAC7D,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAU,KAAK,CAAC,CAAC;IAE7D,MAAM,CAAC,gBAAgB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,uCAAuC,CAAC,CAAC,CAAC;IAEhI,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;IAE7E,MAAM,iBAAiB,GAAG,GAAG,EAAE;QAC7B,UAAU,CAAC,YAAY,CAAC,OAAO,KAAK,SAA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,yCAAK,CAAC,CAAC;KAClB;AACH,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport * as React from \"react\";\n\nimport { VirtualizedPropertyGridWithDataProvider } from \"@itwin/components-react\";\nimport { FillCentered, Orientation, ResizableContainerObserver } from \"@itwin/core-react\";\n\nimport { FeatureInfoDataProvider} from \"./FeatureInfoDataProvider\";\nimport { MapFeatureInfoOptions } from \"../Interfaces\";\nimport { MapLayersUI } from \"../../mapLayers\";\n\ninterface MapFeatureInfoWidgetProps {\n featureInfoOpts: MapFeatureInfoOptions;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function MapFeatureInfoWidget({ featureInfoOpts }: MapFeatureInfoWidgetProps) {\n\n const dataProvider = React.useRef<FeatureInfoDataProvider>();\n const [hasData, setHasData] = React.useState<boolean>(false);\n\n const [noRecordsMessage] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:FeatureInfoWidget.NoRecords\"));\n\n const [{ width, height }, setSize] = React.useState({ width: 0, height: 0 });\n\n const handleDataChanged = () => {\n setHasData(dataProvider.current !== undefined && dataProvider.current.hasRecords);\n };\n\n React.useEffect(() => {\n dataProvider.current = new FeatureInfoDataProvider();\n return () => {\n dataProvider?.current?.onUnload();\n };\n }, []);\n\n React.useEffect(() => {\n\n dataProvider.current?.onDataChanged.addListener(handleDataChanged);\n return () => {\n dataProvider.current?.onDataChanged.removeListener(handleDataChanged);\n };\n\n }, []);\n\n const handleResize = React.useCallback((w: number, h: number) => {\n setSize({ width: w, height: h });\n }, []);\n\n if (!hasData) {\n return (<FillCentered><span><i>{noRecordsMessage}</i></span></FillCentered>);\n } else {\n if (dataProvider.current)\n return (\n <ResizableContainerObserver onResize={handleResize}>\n <VirtualizedPropertyGridWithDataProvider\n width={width}\n height={height}\n dataProvider={dataProvider.current}\n orientation={Orientation.Vertical}\n isPropertySelectionEnabled={featureInfoOpts?.propertyGridOptions?.isPropertySelectionEnabled} />\n </ResizableContainerObserver>\n );\n else\n return (<></>);\n }\n}\n"]}
1
+ {"version":3,"file":"FeatureInfoWidget.js","sourceRoot":"","sources":["../../../../src/ui/widget/FeatureInfoWidget.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,uCAAuC,EAAE,MAAM,yBAAyB,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAE1F,OAAO,EAAE,uBAAuB,EAAC,MAAM,2BAA2B,CAAC;AAEnE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,sBAAsB,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAE3E,MAAM,UAAU,oBAAoB,CAAC,EAAU;IAC7C,MAAM,aAAa,GAAG,sBAAsB,EAAE,CAAC;IAC/C,OAAO,aAAa,EAAE,aAAa,CAAC,EAAE,CAAC,CAAC;AAC1C,CAAC;AAOD,gEAAgE;AAChE,MAAM,UAAU,oBAAoB,CAAC,EAAE,eAAe,EAA6B;IAEjF,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,EAA2B,CAAC;IAC7D,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAU,KAAK,CAAC,CAAC;IAE7D,MAAM,CAAC,gBAAgB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,uCAAuC,CAAC,CAAC,CAAC;IAEhI,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,EAAE,KAA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,EAAE,CAAC,CAAC;IAEP,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,CAAC,oBAAC,YAAY;YAAC;gBAAM,+BAAI,gBAAgB,CAAK,CAAO,CAAe,CAAC,CAAC;KAC9E;SAAM;QACL,IAAI,YAAY,CAAC,OAAO;YACtB,OAAO,CACL,oBAAC,0BAA0B,IAAC,QAAQ,EAAE,YAAY;gBAChD,oBAAC,uCAAuC,IACtC,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,YAAY,CAAC,OAAO,EAClC,WAAW,EAAE,WAAW,CAAC,QAAQ,EACjC,0BAA0B,EAAE,eAAe,EAAE,mBAAmB,EAAE,0BAA0B,GAAI,CACvE,CAC9B,CAAC;;YAEF,OAAO,CAAC,yCAAK,CAAC,CAAC;KAClB;AACH,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport * as React from \"react\";\n\nimport { VirtualizedPropertyGridWithDataProvider } from \"@itwin/components-react\";\nimport { FillCentered, Orientation, ResizableContainerObserver } from \"@itwin/core-react\";\n\nimport { FeatureInfoDataProvider} from \"./FeatureInfoDataProvider\";\nimport { MapFeatureInfoOptions } from \"../Interfaces\";\nimport { MapLayersUI } from \"../../mapLayers\";\nimport { useActiveFrontstageDef, WidgetState } from \"@itwin/appui-react\";\nimport { FeatureInfoUiItemsProvider } from \"../FeatureInfoUiItemsProvider\";\n\nexport function useSpecificWidgetDef(id: string) {\n const frontstageDef = useActiveFrontstageDef();\n return frontstageDef?.findWidgetDef(id);\n}\n\n// MapFeatureInfoWidgetProps\ninterface MapFeatureInfoWidgetProps {\n featureInfoOpts: MapFeatureInfoOptions;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function MapFeatureInfoWidget({ featureInfoOpts }: MapFeatureInfoWidgetProps) {\n\n const dataProvider = React.useRef<FeatureInfoDataProvider>();\n const [hasData, setHasData] = React.useState<boolean>(false);\n\n const [noRecordsMessage] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:FeatureInfoWidget.NoRecords\"));\n\n const [{ width, height }, setSize] = React.useState({ width: 0, height: 0 });\n\n const handleDataChanged = () => {\n setHasData(dataProvider.current !== undefined && dataProvider.current.hasRecords);\n };\n\n React.useEffect(() => {\n dataProvider.current = new FeatureInfoDataProvider();\n return () => {\n dataProvider?.current?.onUnload();\n };\n }, []);\n\n const widgetDef = useSpecificWidgetDef(FeatureInfoUiItemsProvider.widgetId);\n\n React.useEffect(() => {\n if (hasData) {\n widgetDef?.setWidgetState(WidgetState.Open);\n } else {\n widgetDef?.setWidgetState(WidgetState.Hidden);\n }\n }, [widgetDef, hasData]);\n\n React.useEffect(() => {\n\n dataProvider.current?.onDataChanged.addListener(handleDataChanged);\n return () => {\n dataProvider.current?.onDataChanged.removeListener(handleDataChanged);\n };\n\n }, []);\n\n const handleResize = React.useCallback((w: number, h: number) => {\n setSize({ width: w, height: h });\n }, []);\n\n if (!hasData) {\n return (<FillCentered><span><i>{noRecordsMessage}</i></span></FillCentered>);\n } else {\n if (dataProvider.current)\n return (\n <ResizableContainerObserver onResize={handleResize}>\n <VirtualizedPropertyGridWithDataProvider\n width={width}\n height={height}\n dataProvider={dataProvider.current}\n orientation={Orientation.Vertical}\n isPropertySelectionEnabled={featureInfoOpts?.propertyGridOptions?.isPropertySelectionEnabled} />\n </ResizableContainerObserver>\n );\n else\n return (<></>);\n }\n}\n"]}
@@ -1,3 +1,4 @@
1
+ import { BaseMapLayerSettings } from "@itwin/core-common";
1
2
  import { MapLayerSource, ScreenViewport } from "@itwin/core-frontend";
2
3
  import * as React from "react";
3
4
  import { MapLayerOptions, StyleMapLayerSettings } from "../Interfaces";
@@ -6,7 +7,7 @@ import "./MapLayerManager.scss";
6
7
  export interface SourceMapContextProps {
7
8
  readonly sources: MapLayerSource[];
8
9
  readonly loadingSources: boolean;
9
- readonly bases: MapLayerSource[];
10
+ readonly bases: BaseMapLayerSettings[];
10
11
  readonly refreshFromStyle: () => void;
11
12
  readonly activeViewport?: ScreenViewport;
12
13
  readonly backgroundLayers?: StyleMapLayerSettings[];
@@ -14,6 +15,8 @@ export interface SourceMapContextProps {
14
15
  readonly mapLayerOptions?: MapLayerOptions;
15
16
  }
16
17
  /** @internal */
18
+ export declare const defaultBaseMapLayers: BaseMapLayerSettings[];
19
+ /** @internal */
17
20
  export declare const SourceMapContext: React.Context<SourceMapContextProps>;
18
21
  /** @internal */
19
22
  export declare function useSourceMapContext(): SourceMapContextProps;
@@ -1 +1 @@
1
- {"version":3,"file":"MapLayerManager.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/MapLayerManager.tsx"],"names":[],"mappings":"AAWA,OAAO,EACiF,cAAc,EACpG,cAAc,EACf,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAGvE,OAAO,wBAAwB,CAAC;AAMhC,gBAAgB;AAChB,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,OAAO,EAAE,cAAc,EAAE,CAAC;IACnC,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,cAAc,EAAE,CAAC;IACjC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,IAAI,CAAC;IACtC,QAAQ,CAAC,cAAc,CAAC,EAAE,cAAc,CAAC;IACzC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,qBAAqB,EAAE,CAAC;IACpD,QAAQ,CAAC,aAAa,CAAC,EAAE,qBAAqB,EAAE,CAAC;IACjD,QAAQ,CAAC,eAAe,CAAC,EAAE,eAAe,CAAC;CAC5C;AAED,gBAAgB;AAChB,eAAO,MAAM,gBAAgB,sCAK3B,CAAC;AAEH,gBAAgB;AAChB,wBAAgB,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EAAE,MAAM,WAAW,CAAC;IACxC,cAAc,EAAE,cAAc,CAAC;IAC/B,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC;AAGD,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,eAoe1D"}
@@ -6,7 +6,7 @@
6
6
  // the following quiet warning caused by react-beautiful-dnd package
7
7
  /* eslint-disable @typescript-eslint/unbound-method */
8
8
  import { BentleyError, compareStrings } from "@itwin/core-bentley";
9
- import { ImageMapLayerSettings } from "@itwin/core-common";
9
+ import { BackgroundMapProvider, BackgroundMapType, BaseMapLayerSettings, ImageMapLayerSettings } from "@itwin/core-common";
10
10
  import { ImageryMapTileTree, IModelApp, MapLayerSources, NotifyMessageDetails, OutputMessagePriority, } from "@itwin/core-frontend";
11
11
  import { ToggleSwitch } from "@itwin/itwinui-react";
12
12
  import * as React from "react";
@@ -20,6 +20,12 @@ import { MapLayerActionButtons } from "./MapLayerActionButtons";
20
20
  import { MapManagerLayersHeader } from "./MapManagerMapLayersHeader";
21
21
  import { MapLayerSettingsPopupButton } from "./MapLayerSettingsPopupButton";
22
22
  /** @internal */
23
+ export const defaultBaseMapLayers = [
24
+ BaseMapLayerSettings.fromProvider(BackgroundMapProvider.fromJSON({ name: "BingProvider", type: BackgroundMapType.Aerial })),
25
+ BaseMapLayerSettings.fromProvider(BackgroundMapProvider.fromJSON({ name: "BingProvider", type: BackgroundMapType.Hybrid })),
26
+ BaseMapLayerSettings.fromProvider(BackgroundMapProvider.fromJSON({ name: "BingProvider", type: BackgroundMapType.Street })),
27
+ ];
28
+ /** @internal */
23
29
  export const SourceMapContext = React.createContext({
24
30
  sources: [],
25
31
  loadingSources: false,
@@ -67,7 +73,7 @@ function getMapLayerSettingsFromViewport(viewport, getBackgroundMap, populateSub
67
73
  export function MapLayerManager(props) {
68
74
  const [mapSources, setMapSources] = React.useState();
69
75
  const [loadingSources, setLoadingSources] = React.useState(false);
70
- const [baseSources, setBaseSources] = React.useState();
76
+ const [bgProviders] = React.useState(props.mapLayerOptions?.baseMapLayers ?? defaultBaseMapLayers);
71
77
  const [overlaysLabel] = React.useState(MapLayersUI.localization.getLocalizedString("mapLayers:Widget.OverlayLayers"));
72
78
  const [underlaysLabel] = React.useState(MapLayersUI.localization.getLocalizedString("mapLayers:Widget.BackgroundLayers"));
73
79
  const { activeViewport, mapLayerOptions } = props;
@@ -177,8 +183,7 @@ export function MapLayerManager(props) {
177
183
  }
178
184
  // This is where the list of layers first gets populated...
179
185
  const sources = [];
180
- const bases = [];
181
- const addSource = (source) => source.baseMap ? bases.push(source) : sources.push(source);
186
+ const addSource = (source) => !source.baseMap && sources.push(source); // No longer let MapLayerSources drive bg maps.
182
187
  sourceLayers?.allSource.forEach(addSource);
183
188
  preferenceSources.forEach((source) => {
184
189
  // Do not add duplicate
@@ -187,7 +192,6 @@ export function MapLayerManager(props) {
187
192
  });
188
193
  sources.sort((a, b) => compareStrings(a.name.toLowerCase(), b.name.toLowerCase()));
189
194
  setMapSources(sources);
190
- setBaseSources(bases);
191
195
  }
192
196
  setLoadingSources(true);
193
197
  fetchSources().then(() => {
@@ -411,7 +415,7 @@ export function MapLayerManager(props) {
411
415
  activeViewport,
412
416
  loadingSources,
413
417
  sources: mapSources ? mapSources : [],
414
- bases: baseSources ? baseSources : [],
418
+ bases: bgProviders,
415
419
  refreshFromStyle: handleRefreshFromStyle,
416
420
  backgroundLayers: backgroundMapLayers,
417
421
  overlayLayers: overlayMapLayers,
@@ -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,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAA6D,MAAM,oBAAoB,CAAC;AACtH,OAAO,EACL,kBAAkB,EAAE,SAAS,EAAyE,eAAe,EAA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AAC,EAAC,SAAS,EAAE,KAAK,EAAC,CAAC;wBACvC,mBAAmB,CAAC,EAAC,SAAS,EAAE,IAAI,EAAC,CAAC,CACvB,CACd,CAED,CACoB,CAC9B,CAAC;AACJ,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// 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 { BasemapPanel } from \"./BasemapPanel\";\nimport { MapLayerDroppable } from \"./MapLayerDroppable\";\nimport \"./MapLayerManager.scss\";\nimport { MapLayersUI } from \"../../mapLayers\";\nimport { MapLayerActionButtons } from \"./MapLayerActionButtons\";\nimport { MapManagerLayersHeader } from \"./MapManagerMapLayersHeader\";\nimport { MapLayerSettingsPopupButton } from \"./MapLayerSettingsPopupButton\";\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 selected: false,\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 handleItemSelected = React.useCallback((isOverlay: boolean, _index: number) => {\n if (isOverlay ) {\n if (overlayMapLayers)\n setOverlayMapLayers([...overlayMapLayers]);\n } else {\n if (backgroundMapLayers)\n setBackgroundMapLayers([...backgroundMapLayers]);\n }\n }, [backgroundMapLayers, overlayMapLayers]);\n\n const hasItemSelected = React.useCallback((isOverlay: boolean) => {\n const layerList = (isOverlay ? overlayMapLayers : backgroundMapLayers);\n if (!layerList)\n return false;\n return undefined !== layerList?.find((value) => value.selected === true);\n }, [backgroundMapLayers, overlayMapLayers]);\n\n const changeLayerVisibility = React.useCallback((visible: boolean, index: number, isOverlay: boolean) => {\n activeViewport.displayStyle.changeMapLayerProps({ visible }, {index, isOverlay});\n }, [activeViewport]);\n\n const changeAllLayerVisibility = React.useCallback(async (visible: boolean, isOverlay?: boolean) => {\n if (isOverlay === undefined || !isOverlay)\n backgroundMapLayers?.forEach((layer) => changeLayerVisibility(visible, layer.layerIndex, layer.isOverlay));\n\n if (isOverlay === undefined || isOverlay)\n overlayMapLayers?.forEach((layer) => changeLayerVisibility(visible, layer.layerIndex, layer.isOverlay));\n }, [backgroundMapLayers, overlayMapLayers, changeLayerVisibility]);\n\n const invertAllLayerVisibility = React.useCallback(async (isOverlay?: boolean) => {\n if (isOverlay === undefined || !isOverlay)\n backgroundMapLayers?.forEach((layer) => changeLayerVisibility(!layer.visible, layer.layerIndex, layer.isOverlay));\n\n if (isOverlay === undefined || isOverlay)\n overlayMapLayers?.forEach((layer) => changeLayerVisibility(!layer.visible, layer.layerIndex, layer.isOverlay));\n }, [backgroundMapLayers, overlayMapLayers, changeLayerVisibility]);\n\n const detachSelectedLayers = React.useCallback(async (isOverlay: boolean) => {\n const layerList = (isOverlay ? overlayMapLayers : backgroundMapLayers);\n if (!layerList || layerList.length === 0)\n return;\n\n for (let i=0; i<layerList.length; i++) {\n if (layerList[i].selected) {\n const index = (layerList.length -1) - i; // Layers are reverted order is display style\n activeViewport.displayStyle.detachMapLayerByIndex({isOverlay, index});\n }\n }\n\n }, [activeViewport, overlayMapLayers, backgroundMapLayers]);\n\n const selectAllLayers = React.useCallback(async (isOverlay: boolean) => {\n if (!overlayMapLayers || !backgroundMapLayers)\n return;\n\n const layerList = (isOverlay ? [...overlayMapLayers] : [...backgroundMapLayers]);\n const hasCheckedLayer = undefined !== layerList?.find((value) => value.selected === true);\n layerList.forEach((layer) => {layer.selected = !hasCheckedLayer;} );\n\n if (isOverlay)\n setOverlayMapLayers(layerList);\n else\n setBackgroundMapLayers(layerList);\n\n }, [overlayMapLayers, backgroundMapLayers]);\n\n const renderMapLayersList = React.useCallback((options: {isOverlay: boolean}): React.ReactElement<HTMLElement> => {\n if (!overlayMapLayers || !backgroundMapLayers)\n return <></>;\n\n const {isOverlay} = options;\n const layerList = (isOverlay ? [...overlayMapLayers] : [...backgroundMapLayers]);\n\n const label = (isOverlay ? overlaysLabel : underlaysLabel);\n return (\n <div className=\"map-manager-layer-wrapper\" data-testid={\"map-manager-layer-section\"}>\n <MapManagerLayersHeader\n label={label}\n isOverlay={isOverlay}\n disabled={!backgroundMapVisible}\n />\n {(layerList && layerList.length > 0) &&\n <>\n <MapLayerActionButtons\n disabled={!backgroundMapVisible}\n disabledUnlink={!hasItemSelected(isOverlay)}\n hideAll={async () => changeAllLayerVisibility(false, isOverlay)}\n showAll={async () => changeAllLayerVisibility(true, isOverlay)}\n invert={async ()=>invertAllLayerVisibility(isOverlay)}\n selectAll={async ()=>selectAllLayers(isOverlay)}\n unlink={async ()=>detachSelectedLayers(isOverlay)}\n checked={hasItemSelected(isOverlay)}\n />\n </>\n }\n <MapLayerDroppable\n disabled={!backgroundMapVisible}\n isOverlay={isOverlay}\n layersList={layerList}\n mapTypesOptions={props.mapLayerOptions?.mapTypeOptions}\n getContainerForClone={props.getContainerForClone as any}\n activeViewport={props.activeViewport}\n onMenuItemSelected={handleOnMenuItemSelection}\n onItemVisibilityToggleClicked={handleLayerVisibilityChange}\n onItemSelected={handleItemSelected}\n onItemEdited={handleRefreshFromStyle} />\n </div>\n );\n\n },[backgroundMapLayers, backgroundMapVisible, changeAllLayerVisibility, detachSelectedLayers, handleItemSelected, handleLayerVisibilityChange, handleOnMenuItemSelection, handleRefreshFromStyle, hasItemSelected, invertAllLayerVisibility, overlayMapLayers, overlaysLabel, props.activeViewport, props.getContainerForClone, props.mapLayerOptions?.mapTypeOptions, selectAllLayers, underlaysLabel]);\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 {/* Header*/}\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 {/* Base map*/}\n <div className=\"map-manager-basemap\">\n <BasemapPanel disabled={!backgroundMapVisible} />\n </div>\n\n {/* List of Layers (droppable) */}\n {!hideExternalMapLayersSection &&\n <div>\n <DragDropContext onDragEnd={handleOnMapLayerDragEnd}>\n {renderMapLayersList({isOverlay: false})}\n {renderMapLayersList({isOverlay: true})}\n </DragDropContext>\n </div>\n }\n </div >\n </SourceMapContext.Provider >\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,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,qBAAqB,EAA6D,MAAM,oBAAoB,CAAC;AACtL,OAAO,EACL,kBAAkB,EAAE,SAAS,EAAyE,eAAe,EAAE,oBAAoB,EAAE,qBAAqB,GAEnK,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAc,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAE1F,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,E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AE,uBAAuB;wBAChD,mBAAmB,CAAC,EAAC,SAAS,EAAE,KAAK,EAAC,CAAC;wBACvC,mBAAmB,CAAC,EAAC,SAAS,EAAE,IAAI,EAAC,CAAC,CACvB,CACd,CAED,CACoB,CAC9B,CAAC;AACJ,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// 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 { BackgroundMapProvider, BackgroundMapType, BaseMapLayerSettings, 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 { BasemapPanel } from \"./BasemapPanel\";\nimport { MapLayerDroppable } from \"./MapLayerDroppable\";\nimport \"./MapLayerManager.scss\";\nimport { MapLayersUI } from \"../../mapLayers\";\nimport { MapLayerActionButtons } from \"./MapLayerActionButtons\";\nimport { MapManagerLayersHeader } from \"./MapManagerMapLayersHeader\";\nimport { MapLayerSettingsPopupButton } from \"./MapLayerSettingsPopupButton\";\n\n/** @internal */\nexport interface SourceMapContextProps {\n readonly sources: MapLayerSource[];\n readonly loadingSources: boolean;\n readonly bases: BaseMapLayerSettings[];\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 defaultBaseMapLayers = [\n BaseMapLayerSettings.fromProvider(BackgroundMapProvider.fromJSON({name: \"BingProvider\", type: BackgroundMapType.Aerial})),\n BaseMapLayerSettings.fromProvider(BackgroundMapProvider.fromJSON({name: \"BingProvider\", type: BackgroundMapType.Hybrid})),\n BaseMapLayerSettings.fromProvider(BackgroundMapProvider.fromJSON({name: \"BingProvider\", type: BackgroundMapType.Street})),\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 selected: false,\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 [bgProviders] = React.useState<BaseMapLayerSettings[]>(props.mapLayerOptions?.baseMapLayers ?? defaultBaseMapLayers);\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 addSource = (source: MapLayerSource) => !source.baseMap && sources.push(source); // No longer let MapLayerSources drive bg maps.\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 }\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 handleItemSelected = React.useCallback((isOverlay: boolean, _index: number) => {\n if (isOverlay ) {\n if (overlayMapLayers)\n setOverlayMapLayers([...overlayMapLayers]);\n } else {\n if (backgroundMapLayers)\n setBackgroundMapLayers([...backgroundMapLayers]);\n }\n }, [backgroundMapLayers, overlayMapLayers]);\n\n const hasItemSelected = React.useCallback((isOverlay: boolean) => {\n const layerList = (isOverlay ? overlayMapLayers : backgroundMapLayers);\n if (!layerList)\n return false;\n return undefined !== layerList?.find((value) => value.selected === true);\n }, [backgroundMapLayers, overlayMapLayers]);\n\n const changeLayerVisibility = React.useCallback((visible: boolean, index: number, isOverlay: boolean) => {\n activeViewport.displayStyle.changeMapLayerProps({ visible }, {index, isOverlay});\n }, [activeViewport]);\n\n const changeAllLayerVisibility = React.useCallback(async (visible: boolean, isOverlay?: boolean) => {\n if (isOverlay === undefined || !isOverlay)\n backgroundMapLayers?.forEach((layer) => changeLayerVisibility(visible, layer.layerIndex, layer.isOverlay));\n\n if (isOverlay === undefined || isOverlay)\n overlayMapLayers?.forEach((layer) => changeLayerVisibility(visible, layer.layerIndex, layer.isOverlay));\n }, [backgroundMapLayers, overlayMapLayers, changeLayerVisibility]);\n\n const invertAllLayerVisibility = React.useCallback(async (isOverlay?: boolean) => {\n if (isOverlay === undefined || !isOverlay)\n backgroundMapLayers?.forEach((layer) => changeLayerVisibility(!layer.visible, layer.layerIndex, layer.isOverlay));\n\n if (isOverlay === undefined || isOverlay)\n overlayMapLayers?.forEach((layer) => changeLayerVisibility(!layer.visible, layer.layerIndex, layer.isOverlay));\n }, [backgroundMapLayers, overlayMapLayers, changeLayerVisibility]);\n\n const detachSelectedLayers = React.useCallback(async (isOverlay: boolean) => {\n const layerList = (isOverlay ? overlayMapLayers : backgroundMapLayers);\n if (!layerList || layerList.length === 0)\n return;\n\n for (let i=0; i<layerList.length; i++) {\n if (layerList[i].selected) {\n const index = (layerList.length -1) - i; // Layers are reverted order is display style\n activeViewport.displayStyle.detachMapLayerByIndex({isOverlay, index});\n }\n }\n\n }, [activeViewport, overlayMapLayers, backgroundMapLayers]);\n\n const selectAllLayers = React.useCallback(async (isOverlay: boolean) => {\n if (!overlayMapLayers || !backgroundMapLayers)\n return;\n\n const layerList = (isOverlay ? [...overlayMapLayers] : [...backgroundMapLayers]);\n const hasCheckedLayer = undefined !== layerList?.find((value) => value.selected === true);\n layerList.forEach((layer) => {layer.selected = !hasCheckedLayer;} );\n\n if (isOverlay)\n setOverlayMapLayers(layerList);\n else\n setBackgroundMapLayers(layerList);\n\n }, [overlayMapLayers, backgroundMapLayers]);\n\n const renderMapLayersList = React.useCallback((options: {isOverlay: boolean}): React.ReactElement<HTMLElement> => {\n if (!overlayMapLayers || !backgroundMapLayers)\n return <></>;\n\n const {isOverlay} = options;\n const layerList = (isOverlay ? [...overlayMapLayers] : [...backgroundMapLayers]);\n\n const label = (isOverlay ? overlaysLabel : underlaysLabel);\n return (\n <div className=\"map-manager-layer-wrapper\" data-testid={\"map-manager-layer-section\"}>\n <MapManagerLayersHeader\n label={label}\n isOverlay={isOverlay}\n disabled={!backgroundMapVisible}\n />\n {(layerList && layerList.length > 0) &&\n <>\n <MapLayerActionButtons\n disabled={!backgroundMapVisible}\n disabledUnlink={!hasItemSelected(isOverlay)}\n hideAll={async () => changeAllLayerVisibility(false, isOverlay)}\n showAll={async () => changeAllLayerVisibility(true, isOverlay)}\n invert={async ()=>invertAllLayerVisibility(isOverlay)}\n selectAll={async ()=>selectAllLayers(isOverlay)}\n unlink={async ()=>detachSelectedLayers(isOverlay)}\n checked={hasItemSelected(isOverlay)}\n />\n </>\n }\n <MapLayerDroppable\n disabled={!backgroundMapVisible}\n isOverlay={isOverlay}\n layersList={layerList}\n mapTypesOptions={props.mapLayerOptions?.mapTypeOptions}\n getContainerForClone={props.getContainerForClone as any}\n activeViewport={props.activeViewport}\n onMenuItemSelected={handleOnMenuItemSelection}\n onItemVisibilityToggleClicked={handleLayerVisibilityChange}\n onItemSelected={handleItemSelected}\n onItemEdited={handleRefreshFromStyle} />\n </div>\n );\n\n },[backgroundMapLayers, backgroundMapVisible, changeAllLayerVisibility, detachSelectedLayers, handleItemSelected, handleLayerVisibilityChange, handleOnMenuItemSelection, handleRefreshFromStyle, hasItemSelected, invertAllLayerVisibility, overlayMapLayers, overlaysLabel, props.activeViewport, props.getContainerForClone, props.mapLayerOptions?.mapTypeOptions, selectAllLayers, underlaysLabel]);\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: bgProviders,\n refreshFromStyle: handleRefreshFromStyle,\n backgroundLayers: backgroundMapLayers,\n overlayLayers: overlayMapLayers,\n mapLayerOptions,\n }}>\n {/* Header*/}\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 {/* Base map*/}\n <div className=\"map-manager-basemap\">\n <BasemapPanel disabled={!backgroundMapVisible} />\n </div>\n\n {/* List of Layers (droppable) */}\n {!hideExternalMapLayersSection &&\n <div>\n <DragDropContext onDragEnd={handleOnMapLayerDragEnd}>\n {renderMapLayersList({isOverlay: false})}\n {renderMapLayersList({isOverlay: true})}\n </DragDropContext>\n </div>\n }\n </div >\n </SourceMapContext.Provider >\n );\n}\n"]}
@@ -1 +1 @@
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;AAG7B,eAAO,MAAM,SAAS;;;;;;CAM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C,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,eAoiBpD"}
@@ -86,6 +86,7 @@ export function MapUrlDialog(props) {
86
86
  const [onOauthProcessEnd] = React.useState(new BeEvent());
87
87
  const [accessClient, setAccessClient] = React.useState();
88
88
  const [isAccessClientInitialized, setAccessClientInitialized] = React.useState(false);
89
+ const [shouldAutoAttachSource, setShouldAutoAttachSource] = React.useState(true);
89
90
  const [mapType, setMapType] = React.useState(getFormatFromProps() ?? "ArcGIS");
90
91
  // 'isMounted' is used to prevent any async operation once the hook has been
91
92
  // unloaded. Otherwise we get a 'Can't perform a React state update on an unmounted component.' warning in the console.
@@ -127,8 +128,9 @@ export function MapUrlDialog(props) {
127
128
  // return true if authorization is needed
128
129
  const updateAuthState = React.useCallback(async (source, sourceValidation) => {
129
130
  const sourceRequireAuth = (sourceValidation.status === MapLayerSourceStatus.RequireAuth);
130
- const invalidCredentials = (sourceValidation.status === MapLayerSourceStatus.InvalidCredentials);
131
+ let invalidCredentials = (sourceValidation.status === MapLayerSourceStatus.InvalidCredentials);
131
132
  if (sourceRequireAuth) {
133
+ let hasTokenEndPoint = false;
132
134
  const settings = source.toLayerSettings();
133
135
  if (accessClient !== undefined && accessClient.getTokenServiceEndPoint !== undefined && settings !== undefined) {
134
136
  try {
@@ -136,11 +138,20 @@ export function MapUrlDialog(props) {
136
138
  if (tokenEndpoint !== undefined) {
137
139
  const loginUrl = tokenEndpoint.getLoginUrl();
138
140
  setExternalLoginUrl(loginUrl);
141
+ hasTokenEndPoint = true;
139
142
  }
140
143
  }
141
144
  catch (_error) {
142
145
  }
143
146
  }
147
+ else if (userName.length > 0 || password.length > 0) {
148
+ // This is a patch until @itwin\core-frontend return the expected 'InvalidCredentials' status.
149
+ invalidCredentials = true;
150
+ }
151
+ if (!hasTokenEndPoint && (userName.length > 0 || password.length > 0)) {
152
+ // This is a patch until @itwin\core-frontend return the expected 'InvalidCredentials' status.
153
+ invalidCredentials = true;
154
+ }
144
155
  }
145
156
  setServerRequireCredentials(sourceRequireAuth || invalidCredentials);
146
157
  if (invalidCredentials) {
@@ -150,7 +161,7 @@ export function MapUrlDialog(props) {
150
161
  setInvalidCredentialsProvided(false); // flag reset
151
162
  }
152
163
  return sourceRequireAuth || invalidCredentials;
153
- }, [accessClient, invalidCredentialsProvided]);
164
+ }, [accessClient, invalidCredentialsProvided, password.length, userName.length]);
154
165
  const onNameChange = React.useCallback((event) => {
155
166
  setMapName(event.target.value);
156
167
  }, [setMapName]);
@@ -250,8 +261,7 @@ export function MapUrlDialog(props) {
250
261
  const handleOAuthProcessEnd = (success, _state) => {
251
262
  onOauthProcessEnd.raiseEvent(success, _state);
252
263
  };
253
- // Currently only arcgis support AccessClient
254
- const ac = IModelApp.mapLayerFormatRegistry.getAccessClient(MAP_TYPES.arcGis);
264
+ const ac = IModelApp.mapLayerFormatRegistry.getAccessClient(mapType);
255
265
  if (ac?.onOAuthProcessEnd) {
256
266
  setAccessClient(ac); // cache it, so we dont need to make another lookup;
257
267
  ac.onOAuthProcessEnd.addListener(handleOAuthProcessEnd);
@@ -280,7 +290,10 @@ export function MapUrlDialog(props) {
280
290
  React.useEffect(() => {
281
291
  // Attach source asynchronously.
282
292
  void (async () => {
283
- if (isAccessClientInitialized && props.layerRequiringCredentials?.url !== undefined && props.layerRequiringCredentials?.name !== undefined) {
293
+ if (isAccessClientInitialized
294
+ && shouldAutoAttachSource
295
+ && props.layerRequiringCredentials?.url !== undefined
296
+ && props.layerRequiringCredentials?.name !== undefined) {
284
297
  try {
285
298
  const source = MapLayerSource.fromJSON({
286
299
  url: props.layerRequiringCredentials.url,
@@ -289,6 +302,7 @@ export function MapUrlDialog(props) {
289
302
  });
290
303
  if (source !== undefined) {
291
304
  setLayerAttachPending(true);
305
+ setShouldAutoAttachSource(false);
292
306
  const validation = await source.validateSource(true);
293
307
  if (isMounted.current) {
294
308
  setLayerAttachPending(false);
@@ -299,19 +313,16 @@ export function MapUrlDialog(props) {
299
313
  catch (_error) { }
300
314
  }
301
315
  })();
302
- }, [isAccessClientInitialized,
303
- props.layerRequiringCredentials?.formatId,
304
- props.layerRequiringCredentials?.name,
305
- props.layerRequiringCredentials?.url,
306
- updateAuthState]);
316
+ }, [isAccessClientInitialized, props.layerRequiringCredentials?.formatId, props.layerRequiringCredentials?.name, props.layerRequiringCredentials?.url, shouldAutoAttachSource, updateAuthState]);
307
317
  const dialogContainer = React.useRef(null);
308
318
  const readyToSave = React.useCallback(() => {
309
319
  const credentialsSet = !!userName && !!password;
310
- return (!!mapUrl && !!mapName)
320
+ const ready = (!!mapUrl && !!mapName)
311
321
  && !layerAttachPending
312
322
  && (!serverRequireCredentials || credentialsSet)
313
323
  && !invalidCredentialsProvided
314
324
  && (externalLoginUrl === undefined || (externalLoginUrl !== undefined && oauthProcessSucceeded));
325
+ return ready;
315
326
  }, [userName, password, mapUrl, mapName, serverRequireCredentials, layerAttachPending, invalidCredentialsProvided, externalLoginUrl, oauthProcessSucceeded]);
316
327
  // const buttonCluster = React.useMemo(() => [
317
328
  // { type: DialogButtonType.OK, onClick: handleOk, disabled: !readyToSave() },