@itwin/map-layers 5.1.2 → 5.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -1
- package/lib/cjs/map-layers.d.ts +0 -1
- package/lib/cjs/map-layers.d.ts.map +1 -1
- package/lib/cjs/map-layers.js +0 -1
- package/lib/cjs/map-layers.js.map +1 -1
- package/lib/cjs/public/locales/en/mapLayers.json +6 -0
- package/lib/cjs/ui/FeatureInfoUiItemsProvider.d.ts +3 -2
- package/lib/cjs/ui/FeatureInfoUiItemsProvider.d.ts.map +1 -1
- package/lib/cjs/ui/FeatureInfoUiItemsProvider.js +14 -5
- package/lib/cjs/ui/FeatureInfoUiItemsProvider.js.map +1 -1
- package/lib/cjs/ui/Interfaces.d.ts +1 -6
- package/lib/cjs/ui/Interfaces.d.ts.map +1 -1
- package/lib/cjs/ui/Interfaces.js.map +1 -1
- package/lib/cjs/ui/widget/AttachLayerPopupButton.d.ts.map +1 -1
- package/lib/cjs/ui/widget/AttachLayerPopupButton.js +3 -2
- package/lib/cjs/ui/widget/AttachLayerPopupButton.js.map +1 -1
- package/lib/cjs/ui/widget/BasemapPanel.js +1 -1
- package/lib/cjs/ui/widget/BasemapPanel.js.map +1 -1
- package/lib/cjs/ui/widget/FeatureInfoDataProvider.d.ts +10 -18
- package/lib/cjs/ui/widget/FeatureInfoDataProvider.d.ts.map +1 -1
- package/lib/cjs/ui/widget/FeatureInfoDataProvider.js +59 -45
- package/lib/cjs/ui/widget/FeatureInfoDataProvider.js.map +1 -1
- package/lib/cjs/ui/widget/FeatureInfoWidget.d.ts.map +1 -1
- package/lib/cjs/ui/widget/FeatureInfoWidget.js +7 -27
- package/lib/cjs/ui/widget/FeatureInfoWidget.js.map +1 -1
- package/lib/cjs/ui/widget/MapLayerActionButtons.d.ts +13 -0
- package/lib/cjs/ui/widget/MapLayerActionButtons.d.ts.map +1 -0
- package/lib/cjs/ui/widget/MapLayerActionButtons.js +31 -0
- package/lib/cjs/ui/widget/MapLayerActionButtons.js.map +1 -0
- package/lib/cjs/ui/widget/MapLayerDroppable.d.ts +1 -0
- package/lib/cjs/ui/widget/MapLayerDroppable.d.ts.map +1 -1
- package/lib/cjs/ui/widget/MapLayerDroppable.js +13 -3
- package/lib/cjs/ui/widget/MapLayerDroppable.js.map +1 -1
- package/lib/cjs/ui/widget/MapLayerManager.d.ts.map +1 -1
- package/lib/cjs/ui/widget/MapLayerManager.js +74 -15
- package/lib/cjs/ui/widget/MapLayerManager.js.map +1 -1
- package/lib/cjs/ui/widget/MapLayerManager.scss +42 -17
- package/lib/cjs/ui/widget/MapLayerSettingsMenu.js +1 -1
- package/lib/cjs/ui/widget/MapLayerSettingsMenu.js.map +1 -1
- package/lib/cjs/ui/widget/MapManagerMapLayersHeader.d.ts +9 -0
- package/lib/cjs/ui/widget/MapManagerMapLayersHeader.d.ts.map +1 -0
- package/lib/cjs/ui/widget/MapManagerMapLayersHeader.js +19 -0
- package/lib/cjs/ui/widget/MapManagerMapLayersHeader.js.map +1 -0
- package/lib/esm/map-layers.d.ts +0 -1
- package/lib/esm/map-layers.d.ts.map +1 -1
- package/lib/esm/map-layers.js +0 -1
- package/lib/esm/map-layers.js.map +1 -1
- package/lib/esm/public/locales/en/mapLayers.json +6 -0
- package/lib/esm/ui/FeatureInfoUiItemsProvider.d.ts +3 -2
- package/lib/esm/ui/FeatureInfoUiItemsProvider.d.ts.map +1 -1
- package/lib/esm/ui/FeatureInfoUiItemsProvider.js +13 -5
- package/lib/esm/ui/FeatureInfoUiItemsProvider.js.map +1 -1
- package/lib/esm/ui/Interfaces.d.ts +1 -6
- package/lib/esm/ui/Interfaces.d.ts.map +1 -1
- package/lib/esm/ui/Interfaces.js.map +1 -1
- package/lib/esm/ui/widget/AttachLayerPopupButton.d.ts.map +1 -1
- package/lib/esm/ui/widget/AttachLayerPopupButton.js +4 -3
- package/lib/esm/ui/widget/AttachLayerPopupButton.js.map +1 -1
- package/lib/esm/ui/widget/BasemapPanel.js +1 -1
- package/lib/esm/ui/widget/BasemapPanel.js.map +1 -1
- package/lib/esm/ui/widget/FeatureInfoDataProvider.d.ts +10 -18
- package/lib/esm/ui/widget/FeatureInfoDataProvider.d.ts.map +1 -1
- package/lib/esm/ui/widget/FeatureInfoDataProvider.js +58 -44
- package/lib/esm/ui/widget/FeatureInfoDataProvider.js.map +1 -1
- package/lib/esm/ui/widget/FeatureInfoWidget.d.ts.map +1 -1
- package/lib/esm/ui/widget/FeatureInfoWidget.js +8 -28
- package/lib/esm/ui/widget/FeatureInfoWidget.js.map +1 -1
- package/lib/esm/ui/widget/MapLayerActionButtons.d.ts +13 -0
- package/lib/esm/ui/widget/MapLayerActionButtons.d.ts.map +1 -0
- package/lib/esm/ui/widget/MapLayerActionButtons.js +27 -0
- package/lib/esm/ui/widget/MapLayerActionButtons.js.map +1 -0
- package/lib/esm/ui/widget/MapLayerDroppable.d.ts +1 -0
- package/lib/esm/ui/widget/MapLayerDroppable.d.ts.map +1 -1
- package/lib/esm/ui/widget/MapLayerDroppable.js +14 -4
- package/lib/esm/ui/widget/MapLayerDroppable.js.map +1 -1
- package/lib/esm/ui/widget/MapLayerManager.d.ts.map +1 -1
- package/lib/esm/ui/widget/MapLayerManager.js +74 -15
- package/lib/esm/ui/widget/MapLayerManager.js.map +1 -1
- package/lib/esm/ui/widget/MapLayerManager.scss +42 -17
- package/lib/esm/ui/widget/MapLayerSettingsMenu.js +1 -1
- package/lib/esm/ui/widget/MapLayerSettingsMenu.js.map +1 -1
- package/lib/esm/ui/widget/MapManagerMapLayersHeader.d.ts +9 -0
- package/lib/esm/ui/widget/MapManagerMapLayersHeader.d.ts.map +1 -0
- package/lib/esm/ui/widget/MapManagerMapLayersHeader.js +15 -0
- package/lib/esm/ui/widget/MapManagerMapLayersHeader.js.map +1 -0
- package/lib/public/locales/en/mapLayers.json +6 -0
- package/package.json +34 -15
- package/lib/cjs/ui/MapFeatureInfoTool.d.ts +0 -14
- package/lib/cjs/ui/MapFeatureInfoTool.d.ts.map +0 -1
- package/lib/cjs/ui/MapFeatureInfoTool.js +0 -51
- package/lib/cjs/ui/MapFeatureInfoTool.js.map +0 -1
- package/lib/esm/ui/MapFeatureInfoTool.d.ts +0 -14
- package/lib/esm/ui/MapFeatureInfoTool.d.ts.map +0 -1
- package/lib/esm/ui/MapFeatureInfoTool.js +0 -46
- package/lib/esm/ui/MapFeatureInfoTool.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
# Change Log - @itwin/map-layers
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Fri, 29 Sep 2023 20:08:20 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 5.2.0
|
|
6
|
+
Fri, 29 Sep 2023 20:08:20 GMT
|
|
7
|
+
|
|
8
|
+
### Minor changes
|
|
9
|
+
|
|
10
|
+
- Updated Feature Selection UI to consume new itwin.js API
|
|
4
11
|
|
|
5
12
|
## 5.1.2
|
|
6
13
|
Tue, 12 Sep 2023 14:07:42 GMT
|
package/lib/cjs/map-layers.d.ts
CHANGED
|
@@ -3,6 +3,5 @@ export * from "./MapLayersPrefBrowserStorage";
|
|
|
3
3
|
export * from "./ui/Interfaces";
|
|
4
4
|
export * from "./ui/MapLayersUiItemsProvider";
|
|
5
5
|
export * from "./ui/FeatureInfoUiItemsProvider";
|
|
6
|
-
export * from "./ui/MapFeatureInfoTool";
|
|
7
6
|
export * from "./ui/widget/MapLayersWidget";
|
|
8
7
|
//# sourceMappingURL=map-layers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map-layers.d.ts","sourceRoot":"","sources":["../../src/map-layers.ts"],"names":[],"mappings":"AAIA,cAAc,aAAa,CAAC;AAC5B,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iBAAiB,CAAC;AAChC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,
|
|
1
|
+
{"version":3,"file":"map-layers.d.ts","sourceRoot":"","sources":["../../src/map-layers.ts"],"names":[],"mappings":"AAIA,cAAc,aAAa,CAAC;AAC5B,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iBAAiB,CAAC;AAChC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC"}
|
package/lib/cjs/map-layers.js
CHANGED
|
@@ -19,6 +19,5 @@ __exportStar(require("./MapLayersPrefBrowserStorage"), exports);
|
|
|
19
19
|
__exportStar(require("./ui/Interfaces"), exports);
|
|
20
20
|
__exportStar(require("./ui/MapLayersUiItemsProvider"), exports);
|
|
21
21
|
__exportStar(require("./ui/FeatureInfoUiItemsProvider"), exports);
|
|
22
|
-
__exportStar(require("./ui/MapFeatureInfoTool"), exports);
|
|
23
22
|
__exportStar(require("./ui/widget/MapLayersWidget"), exports);
|
|
24
23
|
//# sourceMappingURL=map-layers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map-layers.js","sourceRoot":"","sources":["../../src/map-layers.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,8CAA4B;AAC5B,gEAA8C;AAC9C,kDAAgC;AAChC,gEAA8C;AAC9C,kEAAgD;AAChD,
|
|
1
|
+
{"version":3,"file":"map-layers.js","sourceRoot":"","sources":["../../src/map-layers.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,8CAA4B;AAC5B,gEAA8C;AAC9C,kDAAgC;AAChC,gEAA8C;AAC9C,kEAAgD;AAChD,8DAA4C","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nexport * from \"./mapLayers\";\r\nexport * from \"./MapLayersPrefBrowserStorage\";\r\nexport * from \"./ui/Interfaces\";\r\nexport * from \"./ui/MapLayersUiItemsProvider\";\r\nexport * from \"./ui/FeatureInfoUiItemsProvider\";\r\nexport * from \"./ui/widget/MapLayersWidget\";\r\n"]}
|
|
@@ -12,6 +12,12 @@
|
|
|
12
12
|
"ColorDialog": {
|
|
13
13
|
"Title": "Specify Base Color"
|
|
14
14
|
},
|
|
15
|
+
"MapLayerActionButtons": {
|
|
16
|
+
"ShowAllLabel": "Show all",
|
|
17
|
+
"HideAllLabel": "Hide all",
|
|
18
|
+
"InvertAllLabel": "Invert visibility",
|
|
19
|
+
"DetachSelectedLabel": "Detach selected map layers"
|
|
20
|
+
},
|
|
15
21
|
"CustomAttach": {
|
|
16
22
|
"LayerWithUrlExistsOverwriting": "Map layer with URL: {{url}} already exists. Updating name from {{oldName}} to {{newName}}.",
|
|
17
23
|
"LayerWithUrlExistsAsITwinSetting": "Map Layer with URL: {{url}} already exists as a iTwin setting under name {{name}}. Cannot overwrite with a model setting!",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { StagePanelLocation, StagePanelSection, ToolbarItem, ToolbarOrientation, ToolbarUsage, UiItemsProvider, WidgetState } from "@itwin/appui-react";
|
|
1
|
+
import { StagePanelLocation, StagePanelSection, ToolbarItem, ToolbarOrientation, ToolbarUsage, ToolItemDef, UiItemsProvider, WidgetState } from "@itwin/appui-react";
|
|
2
2
|
import { MapFeatureInfoOptions } from "./Interfaces";
|
|
3
|
+
export declare const getMapFeatureInfoToolItemDef: () => ToolItemDef;
|
|
3
4
|
export declare class FeatureInfoUiItemsProvider implements UiItemsProvider {
|
|
4
5
|
private _featureInfoOpts;
|
|
5
6
|
readonly id = "FeatureInfoUiItemsProvider";
|
|
@@ -9,7 +10,7 @@ export declare class FeatureInfoUiItemsProvider implements UiItemsProvider {
|
|
|
9
10
|
provideWidgets(_stageId: string, stageUsage: string, location: StagePanelLocation, section?: StagePanelSection): {
|
|
10
11
|
id: string;
|
|
11
12
|
label: string;
|
|
12
|
-
icon:
|
|
13
|
+
icon: JSX.Element;
|
|
13
14
|
content: JSX.Element;
|
|
14
15
|
defaultState: WidgetState;
|
|
15
16
|
}[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeatureInfoUiItemsProvider.d.ts","sourceRoot":"","sources":["../../../src/ui/FeatureInfoUiItemsProvider.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAA6B,WAAW,EAAE,kBAAkB,EAAE,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"FeatureInfoUiItemsProvider.d.ts","sourceRoot":"","sources":["../../../src/ui/FeatureInfoUiItemsProvider.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAA6B,WAAW,EAAE,kBAAkB,EAAE,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEhM,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAMrD,eAAO,MAAM,4BAA4B,QAAO,WAO5C,CAAC;AAEL,qBAAa,0BAA2B,YAAW,eAAe;IAI7C,OAAO,CAAC,gBAAgB;IAH3C,SAAgB,EAAE,gCAAgC;IAClD,gBAAuB,QAAQ,qCAAqC;gBAEzC,gBAAgB,EAAE,qBAAqB;IAE3D,mBAAmB,CACxB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,YAAY,EAC1B,kBAAkB,EAAE,kBAAkB,GACrC,aAAa,CAAC,WAAW,CAAC;IAetB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,iBAAiB;;;;;;;CAgBtH"}
|
|
@@ -4,12 +4,22 @@
|
|
|
4
4
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
5
|
*--------------------------------------------------------------------------------------------*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.FeatureInfoUiItemsProvider = void 0;
|
|
7
|
+
exports.FeatureInfoUiItemsProvider = exports.getMapFeatureInfoToolItemDef = void 0;
|
|
8
8
|
const React = require("react");
|
|
9
9
|
const appui_react_1 = require("@itwin/appui-react");
|
|
10
10
|
const FeatureInfoWidget_1 = require("./widget/FeatureInfoWidget");
|
|
11
11
|
const mapLayers_1 = require("../mapLayers");
|
|
12
|
-
const
|
|
12
|
+
const core_frontend_1 = require("@itwin/core-frontend");
|
|
13
|
+
const map_layers_formats_1 = require("@itwin/map-layers-formats");
|
|
14
|
+
const itwinui_icons_react_1 = require("@itwin/itwinui-icons-react");
|
|
15
|
+
const getMapFeatureInfoToolItemDef = () => new appui_react_1.ToolItemDef({
|
|
16
|
+
toolId: map_layers_formats_1.MapFeatureInfoTool.toolId,
|
|
17
|
+
iconSpec: React.createElement(itwinui_icons_react_1.SvgMapInfo, null),
|
|
18
|
+
label: mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:FeatureInfoWidget.Label"),
|
|
19
|
+
description: () => map_layers_formats_1.MapFeatureInfoTool.description,
|
|
20
|
+
execute: async () => { await core_frontend_1.IModelApp.tools.run(map_layers_formats_1.MapFeatureInfoTool.toolId); },
|
|
21
|
+
});
|
|
22
|
+
exports.getMapFeatureInfoToolItemDef = getMapFeatureInfoToolItemDef;
|
|
13
23
|
class FeatureInfoUiItemsProvider {
|
|
14
24
|
constructor(_featureInfoOpts) {
|
|
15
25
|
this._featureInfoOpts = _featureInfoOpts;
|
|
@@ -20,9 +30,8 @@ class FeatureInfoUiItemsProvider {
|
|
|
20
30
|
stageUsage === appui_react_1.StageUsage.General &&
|
|
21
31
|
toolbarUsage === appui_react_1.ToolbarUsage.ContentManipulation &&
|
|
22
32
|
toolbarOrientation === appui_react_1.ToolbarOrientation.Vertical) {
|
|
23
|
-
MapFeatureInfoTool_1.DefaultMapFeatureInfoTool.register(mapLayers_1.MapLayersUI.localizationNamespace);
|
|
24
33
|
return [
|
|
25
|
-
appui_react_1.ToolbarHelper.createToolbarItemFromItemDef(60, (0,
|
|
34
|
+
appui_react_1.ToolbarHelper.createToolbarItemFromItemDef(60, (0, exports.getMapFeatureInfoToolItemDef)()),
|
|
26
35
|
];
|
|
27
36
|
}
|
|
28
37
|
return [];
|
|
@@ -34,7 +43,7 @@ class FeatureInfoUiItemsProvider {
|
|
|
34
43
|
widgets.push({
|
|
35
44
|
id: FeatureInfoUiItemsProvider.widgetId,
|
|
36
45
|
label: mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:FeatureInfoWidget.Label"),
|
|
37
|
-
icon:
|
|
46
|
+
icon: React.createElement(itwinui_icons_react_1.SvgMapInfo, null),
|
|
38
47
|
content: React.createElement(FeatureInfoWidget_1.MapFeatureInfoWidget, { featureInfoOpts: this._featureInfoOpts }),
|
|
39
48
|
defaultState: appui_react_1.WidgetState.Closed,
|
|
40
49
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeatureInfoUiItemsProvider.js","sourceRoot":"","sources":["../../../src/ui/FeatureInfoUiItemsProvider.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,+BAA+B;AAC/B,
|
|
1
|
+
{"version":3,"file":"FeatureInfoUiItemsProvider.js","sourceRoot":"","sources":["../../../src/ui/FeatureInfoUiItemsProvider.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,+BAA+B;AAC/B,oDAAgM;AAChM,kEAAkE;AAElE,4CAA2C;AAC3C,wDAAiD;AACjD,kEAA+D;AAC/D,oEAAwD;AAEjD,MAAM,4BAA4B,GAAG,GAAgB,EAAE,CAC5D,IAAI,yBAAW,CAAC;IACd,MAAM,EAAE,uCAAkB,CAAC,MAAM;IACjC,QAAQ,EAAE,oBAAC,gCAAU,OAAE;IACvB,KAAK,EAAE,uBAAW,CAAC,YAAY,CAAC,kBAAk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C,gCAAU,OAAE;gBACnB,OAAO,EAAE,oBAAC,wCAAoB,IAAC,eAAe,EAAE,IAAI,CAAC,gBAAgB,GAAI;gBACzE,YAAY,EAAE,yBAAW,CAAC,MAAM;aACjC,CAAC,CAAC;SACJ;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;;AAzCH,gEA0CC;AAxCwB,mCAAQ,GAAG,iCAAiC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nimport * as React from \"react\";\nimport { StagePanelLocation, StagePanelSection, StageUsage, ToolbarHelper, ToolbarItem, ToolbarOrientation, ToolbarUsage, ToolItemDef, UiItemsProvider, WidgetState } from \"@itwin/appui-react\";\nimport { MapFeatureInfoWidget } from \"./widget/FeatureInfoWidget\";\nimport { MapFeatureInfoOptions } from \"./Interfaces\";\nimport { MapLayersUI } from \"../mapLayers\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport { MapFeatureInfoTool } from \"@itwin/map-layers-formats\";\nimport { SvgMapInfo } from \"@itwin/itwinui-icons-react\";\n\nexport const getMapFeatureInfoToolItemDef = (): ToolItemDef =>\n new ToolItemDef({\n toolId: MapFeatureInfoTool.toolId,\n iconSpec: <SvgMapInfo/>,\n label: MapLayersUI.localization.getLocalizedString(\"mapLayers:FeatureInfoWidget.Label\"),\n description: () => MapFeatureInfoTool.description,\n execute: async () => { await IModelApp.tools.run(MapFeatureInfoTool.toolId); },\n });\n\nexport class FeatureInfoUiItemsProvider implements UiItemsProvider { // eslint-disable-line deprecation/deprecation\n public readonly id = \"FeatureInfoUiItemsProvider\";\n public static readonly widgetId = \"map-layers:mapFeatureInfoWidget\";\n\n public constructor(private _featureInfoOpts: MapFeatureInfoOptions) { }\n\n public provideToolbarItems(\n _stageId: string,\n stageUsage: string,\n toolbarUsage: ToolbarUsage,\n toolbarOrientation: ToolbarOrientation,\n ): ReadonlyArray<ToolbarItem> {\n if (\n !this._featureInfoOpts?.disableDefaultFeatureInfoTool &&\n stageUsage === StageUsage.General &&\n toolbarUsage === ToolbarUsage.ContentManipulation &&\n toolbarOrientation === ToolbarOrientation.Vertical\n ) {\n return [\n ToolbarHelper.createToolbarItemFromItemDef(60, getMapFeatureInfoToolItemDef()),\n ];\n }\n\n return [];\n }\n\n public provideWidgets(_stageId: string, stageUsage: string, location: StagePanelLocation, section?: StagePanelSection) {\n const widgets = [];\n\n const tmpSection = section ?? StagePanelSection.End;\n if (tmpSection === StagePanelSection.End && stageUsage === StageUsage.General && location === StagePanelLocation.Right ) {\n widgets.push({\n id: FeatureInfoUiItemsProvider.widgetId,\n label: MapLayersUI.localization.getLocalizedString(\"mapLayers:FeatureInfoWidget.Label\"),\n icon: <SvgMapInfo/>,\n content: <MapFeatureInfoWidget featureInfoOpts={this._featureInfoOpts} />,\n defaultState: WidgetState.Closed,\n });\n }\n\n return widgets;\n }\n}\n"]}
|
|
@@ -23,6 +23,7 @@ export interface StyleMapLayerSettings {
|
|
|
23
23
|
showSubLayers: boolean;
|
|
24
24
|
/** Some format can publish only a single layer at a time (i.e WMTS) */
|
|
25
25
|
provider?: MapLayerImageryProvider;
|
|
26
|
+
selected: boolean;
|
|
26
27
|
}
|
|
27
28
|
export interface MapTypesOptions {
|
|
28
29
|
readonly supportTileUrl: boolean;
|
|
@@ -38,12 +39,6 @@ export interface MapFeatureInfoPropertyGridOptions {
|
|
|
38
39
|
}
|
|
39
40
|
export declare type MapHitEvent = BeEvent<(hit: HitDetail) => void>;
|
|
40
41
|
export interface MapFeatureInfoOptions {
|
|
41
|
-
/**
|
|
42
|
-
* HitDetail Event whenever the map is clicked.
|
|
43
|
-
* Typically the HitDetail object is provided by ElementLocateManager.doLocate.
|
|
44
|
-
* Every time this event is raised, FeatureInfoWidget will attempt to retrieve data from MapLayerImageryProviders.
|
|
45
|
-
*/
|
|
46
|
-
onMapHit: MapHitEvent;
|
|
47
42
|
disableDefaultFeatureInfoTool?: boolean;
|
|
48
43
|
showLoadProgressAnimation?: boolean;
|
|
49
44
|
propertyGridOptions?: MapFeatureInfoPropertyGridOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Interfaces.d.ts","sourceRoot":"","sources":["../../../src/ui/Interfaces.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAG,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,uBAAuB,EAAE,+BAA+B,EAAE,MAAM,sBAAsB,CAAC;AAE3G,MAAM,WAAW,qBAAqB;IACpC,WAAW;IACX,IAAI,EAAE,MAAM,CAAC;IACb,oFAAoF;IACpF,MAAM,EAAE,MAAM,CAAC;IACf,mCAAmC;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,EAAE,+BAA+B,CAAC;IAChD,2MAA2M;IAC3M,YAAY,EAAE,MAAM,CAAC;IACrB,6BAA6B;IAC7B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,qCAAqC;IACrC,SAAS,EAAE,OAAO,CAAC;IACnB,kCAAkC;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,8BAA8B;IAC9B,SAAS,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC/B,iCAAiC;IACjC,aAAa,EAAE,OAAO,CAAC;IACvB,uEAAuE;IACvE,QAAQ,CAAC,EAAE,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"Interfaces.d.ts","sourceRoot":"","sources":["../../../src/ui/Interfaces.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAG,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,uBAAuB,EAAE,+BAA+B,EAAE,MAAM,sBAAsB,CAAC;AAE3G,MAAM,WAAW,qB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Content":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { BeEvent } from \"@itwin/core-bentley\";\nimport { MapSubLayerProps } from \"@itwin/core-common\";\nimport { HitDetail, MapLayerImageryProvider, MapTileTreeScaleRangeVisibility } from \"@itwin/core-frontend\";\n\nexport interface StyleMapLayerSettings {\n /** Name */\n name: string;\n /** source (i.URL for ImageMapLayerSettings or modelId for ModelMapLayerSettings) */\n source: string;\n /** Controls visibility of layer */\n visible: boolean;\n treeVisibility: MapTileTreeScaleRangeVisibility;\n /** A transparency value from 0.0 (fully opaque) to 1.0 (fully transparent) to apply to map graphics when drawing, or false to indicate the transparency should not be overridden. Default value: false. */\n transparency: number;\n /** Transparent background */\n transparentBackground: boolean;\n /** set map as underlay or overlay */\n isOverlay: boolean;\n /** layer index in the viewport */\n layerIndex: number;\n /** Available map sub-layer */\n subLayers?: MapSubLayerProps[];\n /** sub-layer panel displayed. */\n showSubLayers: boolean;\n /** Some format can publish only a single layer at a time (i.e WMTS) */\n provider?: MapLayerImageryProvider;\n}\n\nexport interface MapTypesOptions {\n readonly supportTileUrl: boolean;\n readonly supportWmsAuthentication: boolean;\n}\n\nexport interface MapLayerOptions {\n hideExternalMapLayers?: boolean;\n fetchPublicMapLayerSources?: boolean;\n mapTypeOptions?: MapTypesOptions;\n}\n\nexport interface MapFeatureInfoPropertyGridOptions {\n isPropertySelectionEnabled?: boolean;\n}\n\nexport type MapHitEvent = BeEvent<(hit: HitDetail) => void>;\n\nexport interface MapFeatureInfoOptions {\n
|
|
1
|
+
{"version":3,"file":"Interfaces.js","sourceRoot":"","sources":["../../../src/ui/Interfaces.ts"],"names":[],"mappings":"","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { BeEvent } from \"@itwin/core-bentley\";\nimport { MapSubLayerProps } from \"@itwin/core-common\";\nimport { HitDetail, MapLayerImageryProvider, MapTileTreeScaleRangeVisibility } from \"@itwin/core-frontend\";\n\nexport interface StyleMapLayerSettings {\n /** Name */\n name: string;\n /** source (i.URL for ImageMapLayerSettings or modelId for ModelMapLayerSettings) */\n source: string;\n /** Controls visibility of layer */\n visible: boolean;\n treeVisibility: MapTileTreeScaleRangeVisibility;\n /** A transparency value from 0.0 (fully opaque) to 1.0 (fully transparent) to apply to map graphics when drawing, or false to indicate the transparency should not be overridden. Default value: false. */\n transparency: number;\n /** Transparent background */\n transparentBackground: boolean;\n /** set map as underlay or overlay */\n isOverlay: boolean;\n /** layer index in the viewport */\n layerIndex: number;\n /** Available map sub-layer */\n subLayers?: MapSubLayerProps[];\n /** sub-layer panel displayed. */\n showSubLayers: boolean;\n /** Some format can publish only a single layer at a time (i.e WMTS) */\n provider?: MapLayerImageryProvider;\n\n selected: boolean;\n}\n\nexport interface MapTypesOptions {\n readonly supportTileUrl: boolean;\n readonly supportWmsAuthentication: boolean;\n}\n\nexport interface MapLayerOptions {\n hideExternalMapLayers?: boolean;\n fetchPublicMapLayerSources?: boolean;\n mapTypeOptions?: MapTypesOptions;\n}\n\nexport interface MapFeatureInfoPropertyGridOptions {\n isPropertySelectionEnabled?: boolean;\n}\n\nexport type MapHitEvent = BeEvent<(hit: HitDetail) => void>;\n\nexport interface MapFeatureInfoOptions {\n disableDefaultFeatureInfoTool?: boolean;\n showLoadProgressAnimation?: boolean;\n propertyGridOptions?: MapFeatureInfoPropertyGridOptions;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttachLayerPopupButton.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/AttachLayerPopupButton.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AttachLayerPopupButton.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/AttachLayerPopupButton.tsx"],"names":[],"mappings":"AAqcA,gBAAgB;AAChB,oBAAY,qBAAqB;IAC/B,OAAO,IAAA;IACP,IAAI,IAAA;IACJ,IAAI,IAAA;CACL;AACD,MAAM,WAAW,2BAA2B;IAC1C,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,qBAAqB,CAAC;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,gBAAgB;AAEhB,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,2BAA2B,eAkHxE"}
|
|
@@ -17,6 +17,7 @@ const itwinui_react_1 = require("@itwin/itwinui-react");
|
|
|
17
17
|
const MapLayerPreferences_1 = require("../../MapLayerPreferences");
|
|
18
18
|
const mapLayers_1 = require("../../mapLayers");
|
|
19
19
|
const MapSelectFeaturesDialog_1 = require("./MapSelectFeaturesDialog");
|
|
20
|
+
const itwinui_icons_react_1 = require("@itwin/itwinui-icons-react");
|
|
20
21
|
// cSpell:ignore droppable Sublayer
|
|
21
22
|
var LayerAction;
|
|
22
23
|
(function (LayerAction) {
|
|
@@ -387,8 +388,8 @@ function AttachLayerPopupButton(props) {
|
|
|
387
388
|
function renderButton() {
|
|
388
389
|
let button;
|
|
389
390
|
if (props.buttonType === undefined || props.buttonType === AttachLayerButtonType.Icon) {
|
|
390
|
-
button = (React.createElement(itwinui_react_1.
|
|
391
|
-
React.createElement(
|
|
391
|
+
button = (React.createElement(itwinui_react_1.IconButton, { disabled: props.disabled, size: "small", styleType: "borderless", ref: buttonRef, className: "map-manager-attach-layer-button", title: popupOpen ? hideAttachLayerLabel : showAttachLayerLabel, onClick: togglePopup },
|
|
392
|
+
React.createElement(itwinui_icons_react_1.SvgAdd, null)));
|
|
392
393
|
}
|
|
393
394
|
else {
|
|
394
395
|
const determineStyleType = () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttachLayerPopupButton.js","sourceRoot":"","sources":["../../../../src/ui/widget/AttachLayerPopupButton.tsx"],"names":[],"mappings":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AS,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,oBAAoB,EACpI,OAAO,EAAE,WAAW,IAAG,yBAAyB,CAAU,CAC7D,CAAC;SACH;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,CACL;QACG,YAAY,EAAE;QACf,oBAAC,MAAM,CAAC,KAAK,IACX,MAAM,EAAE,SAAS,EACjB,QAAQ,EAAE,iCAAgB,CAAC,WAAW,EACtC,OAAO,EAAE,gBAAgB,EACzB,cAAc,EAAE,oBAAoB,EACpC,YAAY,EAAE,KAAK,EACnB,MAAM,EAAE,SAAS,CAAC,OAAO,EACzB,YAAY,EAAE,KAAK,EACnB,kBAAkB,EAAE,KAAK;YAEzB,6BAAK,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAC,yBAAyB;gBACrD,oBAAC,gBAAgB,IACf,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,eAAe,EAAE,mBAAmB,EACpC,oBAAoB,EAAE,qBAAqB,GAAI,CAC7C,CACQ,CACf,CACJ,CAAC;AACJ,CAAC;AAlHD,wDAkHC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport * as React from \"react\";\r\nimport { IModelApp, MapLayerSource, MapLayerSourceStatus, MapLayerSourceValidation, NotifyMessageDetails, OutputMessagePriority } from \"@itwin/core-frontend\";\r\nimport { RelativePosition } from \"@itwin/appui-abstract\";\r\nimport * as UiCore from \"@itwin/core-react\";\r\nimport { UiFramework } from \"@itwin/appui-react\";\r\nimport { useSourceMapContext } from \"./MapLayerManager\";\r\nimport { MapUrlDialog, SourceState } from \"./MapUrlDialog\";\r\nimport { ConfirmMessageDialog } from \"./ConfirmMessageDialog\";\r\nimport { Button, Input } from \"@itwin/itwinui-react\";\r\nimport { MapLayerPreferences } from \"../../MapLayerPreferences\";\r\nimport { MapLayersUI } from \"../../mapLayers\";\r\nimport { MapSelectFeaturesDialog } from \"./MapSelectFeaturesDialog\";\r\nimport { MapSubLayerProps } from \"@itwin/core-common\";\r\n\r\n// cSpell:ignore droppable Sublayer\r\n\r\nenum LayerAction {\r\n New,\r\n Edit\r\n}\r\n\r\ninterface AttachLayerPanelProps {\r\n isOverlay: boolean;\r\n onLayerAttached: () => void;\r\n onHandleOutsideClick?: (shouldHandle: boolean) => void;\r\n}\r\n\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nfunction AttachLayerPanel({ isOverlay, onLayerAttached, onHandleOutsideClick }: AttachLayerPanelProps) {\r\n const [layerNameToAdd, setLayerNameToAdd] = React.useState<string | undefined>();\r\n const [sourceFilterString, setSourceFilterString] = React.useState<string | undefined>();\r\n\r\n const { placeholderLabel, addCustomLayerLabel, addCustomLayerToolTip, loadingMapSources, removeLayerDefButtonTitle, editLayerDefButtonTitle, removeLayerDefDialogTitle } = React.useMemo(() => {\r\n return {\r\n placeholderLabel: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.SearchPlaceholder\"),\r\n addCustomLayerLabel: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.Custom\"),\r\n addCustomLayerToolTip: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.AttachCustomLayer\"),\r\n loadingMapSources: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.LoadingMapSources\"),\r\n removeLayerDefButtonTitle: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.RemoveLayerDefButtonTitle\"),\r\n editLayerDefButtonTitle: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.EditLayerDefButtonTitle\"),\r\n removeLayerDefDialogTitle: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.RemoveLayerDefDialogTitle\"),\r\n };\r\n }, []);\r\n\r\n const [loading, setLoading] = React.useState(false);\r\n const [layerNameUnderCursor, setLayerNameUnderCursor] = React.useState<string | undefined>();\r\n\r\n const resumeOutsideClick = React.useCallback(() => {\r\n if (onHandleOutsideClick) {\r\n onHandleOutsideClick(true);\r\n }\r\n }, [onHandleOutsideClick]);\r\n\r\n // 'isMounted' is used to prevent any async operation once the hook has been\r\n // unloaded. Otherwise we get a 'Can't perform a React state update on an unmounted component.' warning in the console.\r\n const isMounted = React.useRef(false);\r\n React.useEffect(() => {\r\n isMounted.current = true;\r\n return () => {\r\n isMounted.current = false;\r\n\r\n // We close any open dialogs that we might have opened\r\n // This was added because the modal dialog remained remained displayed after the session expired.\r\n UiFramework.dialogs.modal.close();\r\n };\r\n }, []);\r\n\r\n const handleFilterTextChanged = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\r\n setSourceFilterString(event.target.value);\r\n }, []);\r\n\r\n const { loadingSources, sources, activeViewport, backgroundLayers, overlayLayers, mapLayerOptions } = useSourceMapContext();\r\n const mapTypesOptions = mapLayerOptions?.mapTypeOptions;\r\n const iTwinId = activeViewport?.iModel?.iTwinId;\r\n const iModelId = activeViewport?.iModel?.iModelId;\r\n\r\n const attachLayer = React.useCallback((source: MapLayerSource, subLayers: MapSubLayerProps[]|undefined, oneMapLayerPerSubLayer: boolean) => {\r\n if (activeViewport) {\r\n const generateUniqueMapLayerName = (layerName: string) => {\r\n let uniqueLayerName = layerName;\r\n let layerNameIdx = 1;\r\n while (\r\n (backgroundLayers && backgroundLayers.some((layer) => uniqueLayerName === layer.name))\r\n || (overlayLayers && overlayLayers.some((layer) => uniqueLayerName === layer.name)) ) {\r\n uniqueLayerName = `${layerName} (${layerNameIdx++})`;\r\n }\r\n return {layerNameUpdate: layerNameIdx>1, uniqueLayerName};\r\n };\r\n\r\n const doAttachLayer = (layerName: string, subLayer?: MapSubLayerProps) => {\r\n const generatedName = generateUniqueMapLayerName(layerName);\r\n let sourceToAdd = source;\r\n if (generatedName.layerNameUpdate || sourceToAdd.name !== generatedName.uniqueLayerName) {\r\n // create a source with a unique name\r\n const clonedSource = MapLayerSource.fromJSON({...source.toJSON(), name: generatedName.uniqueLayerName});\r\n if (clonedSource !== undefined) {\r\n clonedSource.userName = source.userName;\r\n clonedSource.password = source.password;\r\n sourceToAdd = clonedSource;\r\n }\r\n\r\n }\r\n\r\n const settings = sourceToAdd.toLayerSettings(subLayer ? [subLayer] : subLayers);\r\n if (settings) {\r\n activeViewport.displayStyle.attachMapLayer({ settings, mapLayerIndex: {index: -1, isOverlay} });\r\n return generatedName.uniqueLayerName;\r\n }\r\n return undefined;\r\n };\r\n\r\n if (oneMapLayerPerSubLayer && subLayers) {\r\n const layerNamesAttached: string[] = [];\r\n for (const subLayer of subLayers) {\r\n\r\n const attachedLayerName = doAttachLayer(`${source.name} - ${subLayer.name}`, subLayer);\r\n if (attachedLayerName !== undefined) {\r\n layerNamesAttached.push(attachedLayerName);\r\n }\r\n }\r\n\r\n if (layerNamesAttached.length > 0) {\r\n const msg = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayersAttached\", { layerNames: layerNamesAttached.join(\", \") });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, msg));\r\n }\r\n } else {\r\n const attachedLayerName = doAttachLayer(source.name);\r\n if (attachedLayerName !== undefined) {\r\n const msg = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttached\", { sourceName: attachedLayerName });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, msg));\r\n }\r\n }\r\n\r\n if (isMounted.current) {\r\n setLoading(false);\r\n }\r\n }\r\n onLayerAttached();\r\n resumeOutsideClick();\r\n }, [activeViewport, backgroundLayers, isOverlay, onLayerAttached, overlayLayers, resumeOutsideClick]);\r\n\r\n const handleSelectFeaturesCancel = React.useCallback( () => {\r\n if (isMounted.current) {\r\n setLoading(false);\r\n }\r\n resumeOutsideClick();\r\n UiFramework.dialogs.modal.close();\r\n\r\n }, [resumeOutsideClick, setLoading]);\r\n\r\n const handleSelectFeaturesOk = React.useCallback((source: MapLayerSource, sourceSubLayers: MapSubLayerProps[], selectedSubLayers: MapSubLayerProps[] ) => {\r\n // keep only visible subLayers\r\n const visibleSubLayers = selectedSubLayers.filter((value) => value.visible);\r\n\r\n // Re-apply default visibility from the source validation\r\n visibleSubLayers.forEach((visible) => {\r\n const found = sourceSubLayers.find((value) => {visible.name === value.name;});\r\n if (found)\r\n visible.visible = found?.visible;\r\n });\r\n attachLayer(source, visibleSubLayers, true);\r\n\r\n }, [attachLayer]);\r\n\r\n const openFeatureSelectionDialog = React.useCallback((subLayers: MapSubLayerProps[], source: MapLayerSource ) => {\r\n // Keep leafs sub-layers and force default visibility to false\r\n const noGroupLayers = subLayers.filter((value: MapSubLayerProps) => value.children === undefined);\r\n const visibleLayers = noGroupLayers.map((value: MapSubLayerProps) => {return {...value, visible: false};});\r\n UiFramework.dialogs.modal.open(\r\n <MapSelectFeaturesDialog\r\n handleOk={(selectedLayers) => {handleSelectFeaturesOk(source, subLayers, selectedLayers);}}\r\n handleCancel={handleSelectFeaturesCancel}\r\n source={source}\r\n subLayers={visibleLayers}/>);\r\n }, [handleSelectFeaturesCancel, handleSelectFeaturesOk]);\r\n\r\n const needsFeatureSelection = React.useCallback((source: MapLayerSource, validation: MapLayerSourceValidation ) => {\r\n return (source.formatId === \"ArcGISFeature\" || source.formatId === \"WMTS\") // TODO, replace this with a flag in MapLayerSourceStatus\r\n && validation.subLayers\r\n && validation.subLayers.length > 1;\r\n }, []);\r\n\r\n const handleModalUrlDialogOk = React.useCallback((action: LayerAction, sourceState?: SourceState) => {\r\n UiFramework.dialogs.modal.close();\r\n if (LayerAction.New === action\r\n && sourceState\r\n && (sourceState.validation.status === MapLayerSourceStatus.Valid)) {\r\n if (needsFeatureSelection(sourceState.source, sourceState.validation)) {\r\n openFeatureSelectionDialog(sourceState.validation.subLayers!, sourceState.source);\r\n } else {\r\n attachLayer(sourceState.source, sourceState.validation.subLayers, false);\r\n }\r\n } else {\r\n resumeOutsideClick();\r\n }\r\n }, [attachLayer, needsFeatureSelection, openFeatureSelectionDialog, resumeOutsideClick]);\r\n\r\n const handleModalUrlDialogCancel = React.useCallback(() => {\r\n // close popup and refresh UI\r\n setLoading(false);\r\n UiFramework.dialogs.modal.close();\r\n resumeOutsideClick();\r\n }, [setLoading, resumeOutsideClick]);\r\n\r\n React.useEffect(() => {\r\n async function attemptToAddLayer() {\r\n if (layerNameToAdd && activeViewport) {\r\n // if the layer is not in the style add it now.\r\n const mapLayerSettings = sources?.find((source) => source.name === layerNameToAdd);\r\n if (mapLayerSettings === undefined) {\r\n return;\r\n }\r\n\r\n try {\r\n if (isMounted.current) {\r\n setLoading(true);\r\n }\r\n\r\n const sourceValidation = await mapLayerSettings.validateSource();\r\n if (sourceValidation.status === MapLayerSourceStatus.Valid || sourceValidation.status === MapLayerSourceStatus.RequireAuth) {\r\n if (sourceValidation.status === MapLayerSourceStatus.Valid) {\r\n if (sourceValidation.subLayers && needsFeatureSelection(mapLayerSettings, sourceValidation)) {\r\n openFeatureSelectionDialog(sourceValidation.subLayers, mapLayerSettings);\r\n if (onHandleOutsideClick) {\r\n onHandleOutsideClick(false);\r\n }\r\n } else {\r\n attachLayer(mapLayerSettings, sourceValidation.subLayers, false);\r\n }\r\n } else if (sourceValidation.status === MapLayerSourceStatus.RequireAuth && isMounted.current) {\r\n UiFramework.dialogs.modal.open(\r\n <MapUrlDialog\r\n activeViewport={activeViewport}\r\n isOverlay={isOverlay}\r\n layerRequiringCredentials={mapLayerSettings.toJSON()}\r\n onOkResult={(sourceState?: SourceState) => handleModalUrlDialogOk(LayerAction.New, sourceState)}\r\n onCancelResult={handleModalUrlDialogCancel}\r\n mapTypesOptions={mapTypesOptions} />\r\n );\r\n if (onHandleOutsideClick) {\r\n onHandleOutsideClick(false);\r\n }\r\n }\r\n\r\n } else {\r\n const msg = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayerValidationFailed\", { sourceUrl: mapLayerSettings.url });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\r\n if (isMounted.current) {\r\n setLoading(false);\r\n }\r\n }\r\n } catch (err) {\r\n if (isMounted.current) {\r\n setLoading(false);\r\n }\r\n const msg = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttachError\", { error: err, sourceName: mapLayerSettings.name });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\r\n }\r\n }\r\n return;\r\n }\r\n\r\n attemptToAddLayer(); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n\r\n if (isMounted.current) {\r\n setLayerNameToAdd(undefined);\r\n }\r\n }, [attachLayer, needsFeatureSelection, setLayerNameToAdd, layerNameToAdd, activeViewport, sources, backgroundLayers, isOverlay, overlayLayers,\r\n onLayerAttached, handleModalUrlDialogOk, handleSelectFeaturesCancel, handleSelectFeaturesOk, mapTypesOptions,\r\n handleModalUrlDialogCancel, onHandleOutsideClick, openFeatureSelectionDialog]);\r\n\r\n const options = React.useMemo(() => sources, [sources]);\r\n\r\n const filteredOptions = React.useMemo(() => {\r\n if (undefined === sourceFilterString || 0 === sourceFilterString.length) {\r\n return options;\r\n } else {\r\n return options?.filter((option) => option.name.toLowerCase().includes(sourceFilterString?.toLowerCase()));\r\n }\r\n }, [options, sourceFilterString]);\r\n\r\n const handleAddNewMapSource = React.useCallback(() => {\r\n UiFramework.dialogs.modal.open(<MapUrlDialog\r\n activeViewport={activeViewport}\r\n isOverlay={isOverlay}\r\n onOkResult={(result?: SourceState) => handleModalUrlDialogOk(LayerAction.New, result)}\r\n onCancelResult={handleModalUrlDialogCancel}\r\n mapTypesOptions={mapTypesOptions} />);\r\n if (onHandleOutsideClick) {\r\n onHandleOutsideClick(false);\r\n }\r\n return;\r\n }, [activeViewport, handleModalUrlDialogCancel, handleModalUrlDialogOk, isOverlay, mapTypesOptions, onHandleOutsideClick]);\r\n\r\n const handleAttach = React.useCallback((mapName: string) => {\r\n setLayerNameToAdd(mapName);\r\n }, []);\r\n\r\n const handleKeypressOnSourceList = React.useCallback((event: React.KeyboardEvent<HTMLUListElement>) => {\r\n const key = event.key;\r\n if (key === \"Enter\") {\r\n event.preventDefault();\r\n const mapName = event.currentTarget?.dataset?.value;\r\n if (mapName && mapName.length) {\r\n handleAttach(mapName);\r\n }\r\n }\r\n }, [handleAttach]);\r\n\r\n const onListboxValueChange = React.useCallback((mapName: string) => {\r\n setLayerNameToAdd(mapName);\r\n }, []);\r\n\r\n const handleNoConfirmation = React.useCallback((_layerName: string) => {\r\n UiFramework.dialogs.modal.close();\r\n resumeOutsideClick();\r\n }, [resumeOutsideClick]);\r\n\r\n const handleYesConfirmation = React.useCallback(async (source: MapLayerSource) => {\r\n const layerName = source.name;\r\n if (!!iTwinId) {\r\n try {\r\n await MapLayerPreferences.deleteByName(source, iTwinId, iModelId);\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.RemoveLayerDefSuccess\", { layerName });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, msg));\r\n } catch (err: any) {\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.RemoveLayerDefError\", { layerName });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\r\n }\r\n }\r\n\r\n UiFramework.dialogs.modal.close();\r\n resumeOutsideClick();\r\n }, [iTwinId, iModelId, resumeOutsideClick]);\r\n\r\n /*\r\n Handle Remove layer button clicked\r\n */\r\n const onItemRemoveButtonClicked = React.useCallback((source, event) => {\r\n event.stopPropagation(); // We don't want the owning ListBox to react on mouse click.\r\n\r\n const layerName = source.name;\r\n\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.RemoveLayerDefDialogMessage\", { layerName });\r\n UiFramework.dialogs.modal.open(\r\n <ConfirmMessageDialog\r\n className=\"map-sources-delete-confirmation\"\r\n title={removeLayerDefDialogTitle}\r\n message={msg}\r\n maxWidth={400}\r\n onClose={() => handleNoConfirmation(layerName)}\r\n onEscape={() => handleNoConfirmation(layerName)}\r\n onYesResult={async () => handleYesConfirmation(source)}\r\n onNoResult={() => handleNoConfirmation(layerName)}\r\n />\r\n );\r\n if (onHandleOutsideClick) {\r\n onHandleOutsideClick(false);\r\n }\r\n }, [handleNoConfirmation, handleYesConfirmation, onHandleOutsideClick, removeLayerDefDialogTitle]);\r\n\r\n /*\r\n Handle Edit layer button clicked\r\n */\r\n const onItemEditButtonClicked = React.useCallback((event) => {\r\n event.stopPropagation(); // We don't want the owning ListBox to react on mouse click.\r\n\r\n const targetLayerName = event?.currentTarget?.parentNode?.dataset?.value;\r\n const matchingSource = sources.find((layerSource) => layerSource.name === targetLayerName);\r\n\r\n // we expect a single layer source matching this name\r\n if (matchingSource === undefined) {\r\n return;\r\n }\r\n UiFramework.dialogs.modal.open(<MapUrlDialog\r\n activeViewport={activeViewport}\r\n isOverlay={isOverlay}\r\n mapLayerSourceToEdit={matchingSource}\r\n onOkResult={(result?: SourceState) => handleModalUrlDialogOk(LayerAction.Edit, result)}\r\n onCancelResult={handleModalUrlDialogCancel}\r\n mapTypesOptions={mapTypesOptions} />);\r\n\r\n if (onHandleOutsideClick) {\r\n onHandleOutsideClick(false);\r\n }\r\n }, [activeViewport, handleModalUrlDialogCancel, handleModalUrlDialogOk, isOverlay, mapTypesOptions, onHandleOutsideClick, sources]);\r\n\r\n return (\r\n <div className=\"map-manager-header\">\r\n {(loading || loadingSources) && <UiCore.LoadingSpinner message={loadingMapSources} />}\r\n <div className=\"map-manager-source-listbox-header\">\r\n <Input type=\"text\" className=\"map-manager-source-list-filter\"\r\n placeholder={placeholderLabel}\r\n value={sourceFilterString}\r\n onChange={handleFilterTextChanged}\r\n size=\"small\" />\r\n <Button className=\"map-manager-add-source-button\" title={addCustomLayerToolTip} onClick={handleAddNewMapSource}>\r\n {addCustomLayerLabel}</Button>\r\n </div>\r\n <div className=\"map-manager-sources\">\r\n <UiCore.Listbox\r\n id=\"map-sources\"\r\n selectedValue={layerNameToAdd}\r\n className=\"map-manager-source-list\"\r\n onKeyPress={handleKeypressOnSourceList}\r\n onListboxValueChange={onListboxValueChange} >\r\n {\r\n filteredOptions?.map((source) =>\r\n <UiCore.ListboxItem\r\n key={source.name}\r\n className=\"map-source-list-entry\"\r\n value={source.name}\r\n onMouseEnter={() => setLayerNameUnderCursor(source.name)}\r\n onMouseLeave={() => setLayerNameUnderCursor(undefined)}>\r\n <span className=\"map-source-list-entry-name\" title={source.name}>{source.name}</span>\r\n\r\n { // Display the delete icon only when the mouse over a specific item\r\n // otherwise list feels cluttered.\r\n (!!iTwinId && layerNameUnderCursor && layerNameUnderCursor === source.name) &&\r\n <>\r\n <Button\r\n size=\"small\"\r\n styleType=\"borderless\"\r\n className=\"map-source-list-entry-button\"\r\n title={editLayerDefButtonTitle}\r\n onClick={onItemEditButtonClicked}>\r\n <UiCore.Icon iconSpec=\"icon-edit\" />\r\n </Button>\r\n <Button\r\n size=\"small\"\r\n styleType=\"borderless\"\r\n className=\"map-source-list-entry-button\"\r\n title={removeLayerDefButtonTitle}\r\n onClick={(event: React.MouseEvent) => { onItemRemoveButtonClicked(source, event); }}>\r\n <UiCore.Icon iconSpec=\"icon-delete\" />\r\n </Button>\r\n </>}\r\n\r\n </UiCore.ListboxItem>\r\n )\r\n }\r\n </UiCore.Listbox>\r\n </div>\r\n </div>\r\n\r\n );\r\n}\r\n\r\n/** @internal */\r\nexport enum AttachLayerButtonType {\r\n Primary,\r\n Blue,\r\n Icon\r\n}\r\nexport interface AttachLayerPopupButtonProps {\r\n isOverlay: boolean;\r\n buttonType?: AttachLayerButtonType;\r\n disabled?: boolean;\r\n}\r\n\r\n/** @internal */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function AttachLayerPopupButton(props: AttachLayerPopupButtonProps) {\r\n const { showAttachLayerLabel, hideAttachLayerLabel, addCustomLayerButtonLabel } = React.useMemo(() => {\r\n return {\r\n showAttachLayerLabel: MapLayersUI.localization.getLocalizedString(\"mapLayers:AttachLayerPopup.Attach\"),\r\n hideAttachLayerLabel: MapLayersUI.localization.getLocalizedString(\"mapLayers:AttachLayerPopup.Close\"),\r\n addCustomLayerButtonLabel: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.AddCustomLayerButtonLabel\"),\r\n };\r\n }, []);\r\n\r\n const [handleOutsideClick, setHandleOutsideClick] = React.useState(true);\r\n const [popupOpen, setPopupOpen] = React.useState(false);\r\n const buttonRef = React.useRef<HTMLButtonElement>(null);\r\n const panelRef = React.useRef<HTMLDivElement>(null);\r\n\r\n // 'isMounted' is used to prevent any async operation once the hook has been\r\n // unloaded. Otherwise we get a 'Can't perform a React state update on an unmounted component.' warning in the console.\r\n const isMounted = React.useRef(false);\r\n React.useEffect(() => {\r\n isMounted.current = true;\r\n return () => {\r\n isMounted.current = false;\r\n };\r\n }, []);\r\n\r\n const togglePopup = React.useCallback(() => {\r\n setPopupOpen(!popupOpen);\r\n }, [popupOpen]);\r\n\r\n const handleClosePopup = React.useCallback(() => {\r\n setPopupOpen(false);\r\n }, []);\r\n\r\n const onHandleOutsideClick = React.useCallback((event: MouseEvent) => {\r\n if (!handleOutsideClick) {\r\n return;\r\n }\r\n\r\n // If clicking on button that open panel - don't trigger outside click processing\r\n if (buttonRef?.current && buttonRef?.current.contains(event.target as Node)) {\r\n return;\r\n }\r\n\r\n // If clicking the panel, this is not an outside clicked\r\n if (panelRef.current && panelRef?.current.contains(event.target as Node)) {\r\n return;\r\n }\r\n\r\n // If we reach this point, we got an outside clicked, no close the popup\r\n setPopupOpen(false);\r\n\r\n }, [handleOutsideClick]);\r\n\r\n const { refreshFromStyle } = useSourceMapContext();\r\n\r\n const handleLayerAttached = React.useCallback(() => {\r\n if (!isMounted.current) {\r\n return;\r\n }\r\n setPopupOpen(false);\r\n refreshFromStyle();\r\n }, [refreshFromStyle]);\r\n\r\n function renderButton(): React.ReactNode {\r\n let button: React.ReactNode;\r\n\r\n if (props.buttonType === undefined || props.buttonType === AttachLayerButtonType.Icon) {\r\n button = (\r\n <Button disabled={props.disabled} size=\"small\" styleType=\"borderless\" ref={buttonRef} className=\"map-manager-attach-layer-button\" title={popupOpen ? hideAttachLayerLabel : showAttachLayerLabel}\r\n onClick={togglePopup}>\r\n <UiCore.WebFontIcon iconName=\"icon-add\" />\r\n </Button>\r\n );\r\n } else {\r\n const determineStyleType = () => {\r\n switch (props.buttonType) {\r\n case AttachLayerButtonType.Blue:\r\n return \"high-visibility\";\r\n case AttachLayerButtonType.Primary:\r\n default:\r\n return \"cta\";\r\n }\r\n };\r\n const styleType = determineStyleType();\r\n button = (\r\n <Button disabled={props.disabled} ref={buttonRef} styleType={styleType} title={popupOpen ? hideAttachLayerLabel : showAttachLayerLabel}\r\n onClick={togglePopup}>{addCustomLayerButtonLabel}</Button>\r\n );\r\n }\r\n\r\n return button;\r\n }\r\n\r\n return (\r\n <>\r\n {renderButton()}\r\n <UiCore.Popup\r\n isOpen={popupOpen}\r\n position={RelativePosition.BottomRight}\r\n onClose={handleClosePopup}\r\n onOutsideClick={onHandleOutsideClick}\r\n closeOnWheel={false}\r\n target={buttonRef.current}\r\n closeOnEnter={false}\r\n closeOnContextMenu={false}\r\n >\r\n <div ref={panelRef} className=\"map-sources-popup-panel\" >\r\n <AttachLayerPanel\r\n isOverlay={props.isOverlay}\r\n onLayerAttached={handleLayerAttached}\r\n onHandleOutsideClick={setHandleOutsideClick} />\r\n </div>\r\n </UiCore.Popup >\r\n </>\r\n );\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"AttachLayerPopupButton.js","sourceRoot":"","sources":["../../../../src/ui/widget/AttachLayerPopupButton.tsx"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,+BAA+B;AAC/B,wDAA8J;AAC9J,0DAAyD;AACzD,4CAA4C;AAC5C,oDAAiD;AACjD,uDAAwD;AACxD,iDAA2D;AAC3D,iEAA8D;AAC9D,wDAAiE;AAC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,CAAC;IAChB,CAAC;IAED,OAAO,CACL;QACG,YAAY,EAAE;QACf,oBAAC,MAAM,CAAC,KAAK,IACX,MAAM,EAAE,SAAS,EACjB,QAAQ,EAAE,iCAAgB,CAAC,WAAW,EACtC,OAAO,EAAE,gBAAgB,EACzB,cAAc,EAAE,oBAAoB,EACpC,YAAY,EAAE,KAAK,EACnB,MAAM,EAAE,SAAS,CAAC,OAAO,EACzB,YAAY,EAAE,KAAK,EACnB,kBAAkB,EAAE,KAAK;YAEzB,6BAAK,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAC,yBAAyB;gBACrD,oBAAC,gBAAgB,IACf,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,eAAe,EAAE,mBAAmB,EACpC,oBAAoB,EAAE,qBAAqB,GAAI,CAC7C,CACQ,CACf,CACJ,CAAC;AACJ,CAAC;AAlHD,wDAkHC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport * as React from \"react\";\r\nimport { IModelApp, MapLayerSource, MapLayerSourceStatus, MapLayerSourceValidation, NotifyMessageDetails, OutputMessagePriority } from \"@itwin/core-frontend\";\r\nimport { RelativePosition } from \"@itwin/appui-abstract\";\r\nimport * as UiCore from \"@itwin/core-react\";\r\nimport { UiFramework } from \"@itwin/appui-react\";\r\nimport { useSourceMapContext } from \"./MapLayerManager\";\r\nimport { MapUrlDialog, SourceState } from \"./MapUrlDialog\";\r\nimport { ConfirmMessageDialog } from \"./ConfirmMessageDialog\";\r\nimport { Button, IconButton, Input } from \"@itwin/itwinui-react\";\r\nimport { MapLayerPreferences } from \"../../MapLayerPreferences\";\r\nimport { MapLayersUI } from \"../../mapLayers\";\r\nimport { MapSelectFeaturesDialog } from \"./MapSelectFeaturesDialog\";\r\nimport { MapSubLayerProps } from \"@itwin/core-common\";\r\nimport { SvgAdd } from \"@itwin/itwinui-icons-react\";\r\n\r\n// cSpell:ignore droppable Sublayer\r\n\r\nenum LayerAction {\r\n New,\r\n Edit\r\n}\r\n\r\ninterface AttachLayerPanelProps {\r\n isOverlay: boolean;\r\n onLayerAttached: () => void;\r\n onHandleOutsideClick?: (shouldHandle: boolean) => void;\r\n}\r\n\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nfunction AttachLayerPanel({ isOverlay, onLayerAttached, onHandleOutsideClick }: AttachLayerPanelProps) {\r\n const [layerNameToAdd, setLayerNameToAdd] = React.useState<string | undefined>();\r\n const [sourceFilterString, setSourceFilterString] = React.useState<string | undefined>();\r\n\r\n const { placeholderLabel, addCustomLayerLabel, addCustomLayerToolTip, loadingMapSources, removeLayerDefButtonTitle, editLayerDefButtonTitle, removeLayerDefDialogTitle } = React.useMemo(() => {\r\n return {\r\n placeholderLabel: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.SearchPlaceholder\"),\r\n addCustomLayerLabel: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.Custom\"),\r\n addCustomLayerToolTip: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.AttachCustomLayer\"),\r\n loadingMapSources: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.LoadingMapSources\"),\r\n removeLayerDefButtonTitle: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.RemoveLayerDefButtonTitle\"),\r\n editLayerDefButtonTitle: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.EditLayerDefButtonTitle\"),\r\n removeLayerDefDialogTitle: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.RemoveLayerDefDialogTitle\"),\r\n };\r\n }, []);\r\n\r\n const [loading, setLoading] = React.useState(false);\r\n const [layerNameUnderCursor, setLayerNameUnderCursor] = React.useState<string | undefined>();\r\n\r\n const resumeOutsideClick = React.useCallback(() => {\r\n if (onHandleOutsideClick) {\r\n onHandleOutsideClick(true);\r\n }\r\n }, [onHandleOutsideClick]);\r\n\r\n // 'isMounted' is used to prevent any async operation once the hook has been\r\n // unloaded. Otherwise we get a 'Can't perform a React state update on an unmounted component.' warning in the console.\r\n const isMounted = React.useRef(false);\r\n React.useEffect(() => {\r\n isMounted.current = true;\r\n return () => {\r\n isMounted.current = false;\r\n\r\n // We close any open dialogs that we might have opened\r\n // This was added because the modal dialog remained remained displayed after the session expired.\r\n UiFramework.dialogs.modal.close();\r\n };\r\n }, []);\r\n\r\n const handleFilterTextChanged = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\r\n setSourceFilterString(event.target.value);\r\n }, []);\r\n\r\n const { loadingSources, sources, activeViewport, backgroundLayers, overlayLayers, mapLayerOptions } = useSourceMapContext();\r\n const mapTypesOptions = mapLayerOptions?.mapTypeOptions;\r\n const iTwinId = activeViewport?.iModel?.iTwinId;\r\n const iModelId = activeViewport?.iModel?.iModelId;\r\n\r\n const attachLayer = React.useCallback((source: MapLayerSource, subLayers: MapSubLayerProps[]|undefined, oneMapLayerPerSubLayer: boolean) => {\r\n if (activeViewport) {\r\n const generateUniqueMapLayerName = (layerName: string) => {\r\n let uniqueLayerName = layerName;\r\n let layerNameIdx = 1;\r\n while (\r\n (backgroundLayers && backgroundLayers.some((layer) => uniqueLayerName === layer.name))\r\n || (overlayLayers && overlayLayers.some((layer) => uniqueLayerName === layer.name)) ) {\r\n uniqueLayerName = `${layerName} (${layerNameIdx++})`;\r\n }\r\n return {layerNameUpdate: layerNameIdx>1, uniqueLayerName};\r\n };\r\n\r\n const doAttachLayer = (layerName: string, subLayer?: MapSubLayerProps) => {\r\n const generatedName = generateUniqueMapLayerName(layerName);\r\n let sourceToAdd = source;\r\n if (generatedName.layerNameUpdate || sourceToAdd.name !== generatedName.uniqueLayerName) {\r\n // create a source with a unique name\r\n const clonedSource = MapLayerSource.fromJSON({...source.toJSON(), name: generatedName.uniqueLayerName});\r\n if (clonedSource !== undefined) {\r\n clonedSource.userName = source.userName;\r\n clonedSource.password = source.password;\r\n sourceToAdd = clonedSource;\r\n }\r\n\r\n }\r\n\r\n const settings = sourceToAdd.toLayerSettings(subLayer ? [subLayer] : subLayers);\r\n if (settings) {\r\n activeViewport.displayStyle.attachMapLayer({ settings, mapLayerIndex: {index: -1, isOverlay} });\r\n return generatedName.uniqueLayerName;\r\n }\r\n return undefined;\r\n };\r\n\r\n if (oneMapLayerPerSubLayer && subLayers) {\r\n const layerNamesAttached: string[] = [];\r\n for (const subLayer of subLayers) {\r\n\r\n const attachedLayerName = doAttachLayer(`${source.name} - ${subLayer.name}`, subLayer);\r\n if (attachedLayerName !== undefined) {\r\n layerNamesAttached.push(attachedLayerName);\r\n }\r\n }\r\n\r\n if (layerNamesAttached.length > 0) {\r\n const msg = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayersAttached\", { layerNames: layerNamesAttached.join(\", \") });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, msg));\r\n }\r\n } else {\r\n const attachedLayerName = doAttachLayer(source.name);\r\n if (attachedLayerName !== undefined) {\r\n const msg = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttached\", { sourceName: attachedLayerName });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, msg));\r\n }\r\n }\r\n\r\n if (isMounted.current) {\r\n setLoading(false);\r\n }\r\n }\r\n onLayerAttached();\r\n resumeOutsideClick();\r\n }, [activeViewport, backgroundLayers, isOverlay, onLayerAttached, overlayLayers, resumeOutsideClick]);\r\n\r\n const handleSelectFeaturesCancel = React.useCallback( () => {\r\n if (isMounted.current) {\r\n setLoading(false);\r\n }\r\n resumeOutsideClick();\r\n UiFramework.dialogs.modal.close();\r\n\r\n }, [resumeOutsideClick, setLoading]);\r\n\r\n const handleSelectFeaturesOk = React.useCallback((source: MapLayerSource, sourceSubLayers: MapSubLayerProps[], selectedSubLayers: MapSubLayerProps[] ) => {\r\n // keep only visible subLayers\r\n const visibleSubLayers = selectedSubLayers.filter((value) => value.visible);\r\n\r\n // Re-apply default visibility from the source validation\r\n visibleSubLayers.forEach((visible) => {\r\n const found = sourceSubLayers.find((value) => {visible.name === value.name;});\r\n if (found)\r\n visible.visible = found?.visible;\r\n });\r\n attachLayer(source, visibleSubLayers, true);\r\n\r\n }, [attachLayer]);\r\n\r\n const openFeatureSelectionDialog = React.useCallback((subLayers: MapSubLayerProps[], source: MapLayerSource ) => {\r\n // Keep leafs sub-layers and force default visibility to false\r\n const noGroupLayers = subLayers.filter((value: MapSubLayerProps) => value.children === undefined);\r\n const visibleLayers = noGroupLayers.map((value: MapSubLayerProps) => {return {...value, visible: false};});\r\n UiFramework.dialogs.modal.open(\r\n <MapSelectFeaturesDialog\r\n handleOk={(selectedLayers) => {handleSelectFeaturesOk(source, subLayers, selectedLayers);}}\r\n handleCancel={handleSelectFeaturesCancel}\r\n source={source}\r\n subLayers={visibleLayers}/>);\r\n }, [handleSelectFeaturesCancel, handleSelectFeaturesOk]);\r\n\r\n const needsFeatureSelection = React.useCallback((source: MapLayerSource, validation: MapLayerSourceValidation ) => {\r\n return (source.formatId === \"ArcGISFeature\" || source.formatId === \"WMTS\") // TODO, replace this with a flag in MapLayerSourceStatus\r\n && validation.subLayers\r\n && validation.subLayers.length > 1;\r\n }, []);\r\n\r\n const handleModalUrlDialogOk = React.useCallback((action: LayerAction, sourceState?: SourceState) => {\r\n UiFramework.dialogs.modal.close();\r\n if (LayerAction.New === action\r\n && sourceState\r\n && (sourceState.validation.status === MapLayerSourceStatus.Valid)) {\r\n if (needsFeatureSelection(sourceState.source, sourceState.validation)) {\r\n openFeatureSelectionDialog(sourceState.validation.subLayers!, sourceState.source);\r\n } else {\r\n attachLayer(sourceState.source, sourceState.validation.subLayers, false);\r\n }\r\n } else {\r\n resumeOutsideClick();\r\n }\r\n }, [attachLayer, needsFeatureSelection, openFeatureSelectionDialog, resumeOutsideClick]);\r\n\r\n const handleModalUrlDialogCancel = React.useCallback(() => {\r\n // close popup and refresh UI\r\n setLoading(false);\r\n UiFramework.dialogs.modal.close();\r\n resumeOutsideClick();\r\n }, [setLoading, resumeOutsideClick]);\r\n\r\n React.useEffect(() => {\r\n async function attemptToAddLayer() {\r\n if (layerNameToAdd && activeViewport) {\r\n // if the layer is not in the style add it now.\r\n const mapLayerSettings = sources?.find((source) => source.name === layerNameToAdd);\r\n if (mapLayerSettings === undefined) {\r\n return;\r\n }\r\n\r\n try {\r\n if (isMounted.current) {\r\n setLoading(true);\r\n }\r\n\r\n const sourceValidation = await mapLayerSettings.validateSource();\r\n if (sourceValidation.status === MapLayerSourceStatus.Valid || sourceValidation.status === MapLayerSourceStatus.RequireAuth) {\r\n if (sourceValidation.status === MapLayerSourceStatus.Valid) {\r\n if (sourceValidation.subLayers && needsFeatureSelection(mapLayerSettings, sourceValidation)) {\r\n openFeatureSelectionDialog(sourceValidation.subLayers, mapLayerSettings);\r\n if (onHandleOutsideClick) {\r\n onHandleOutsideClick(false);\r\n }\r\n } else {\r\n attachLayer(mapLayerSettings, sourceValidation.subLayers, false);\r\n }\r\n } else if (sourceValidation.status === MapLayerSourceStatus.RequireAuth && isMounted.current) {\r\n UiFramework.dialogs.modal.open(\r\n <MapUrlDialog\r\n activeViewport={activeViewport}\r\n isOverlay={isOverlay}\r\n layerRequiringCredentials={mapLayerSettings.toJSON()}\r\n onOkResult={(sourceState?: SourceState) => handleModalUrlDialogOk(LayerAction.New, sourceState)}\r\n onCancelResult={handleModalUrlDialogCancel}\r\n mapTypesOptions={mapTypesOptions} />\r\n );\r\n if (onHandleOutsideClick) {\r\n onHandleOutsideClick(false);\r\n }\r\n }\r\n\r\n } else {\r\n const msg = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayerValidationFailed\", { sourceUrl: mapLayerSettings.url });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\r\n if (isMounted.current) {\r\n setLoading(false);\r\n }\r\n }\r\n } catch (err) {\r\n if (isMounted.current) {\r\n setLoading(false);\r\n }\r\n const msg = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttachError\", { error: err, sourceName: mapLayerSettings.name });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\r\n }\r\n }\r\n return;\r\n }\r\n\r\n attemptToAddLayer(); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n\r\n if (isMounted.current) {\r\n setLayerNameToAdd(undefined);\r\n }\r\n }, [attachLayer, needsFeatureSelection, setLayerNameToAdd, layerNameToAdd, activeViewport, sources, backgroundLayers, isOverlay, overlayLayers,\r\n onLayerAttached, handleModalUrlDialogOk, handleSelectFeaturesCancel, handleSelectFeaturesOk, mapTypesOptions,\r\n handleModalUrlDialogCancel, onHandleOutsideClick, openFeatureSelectionDialog]);\r\n\r\n const options = React.useMemo(() => sources, [sources]);\r\n\r\n const filteredOptions = React.useMemo(() => {\r\n if (undefined === sourceFilterString || 0 === sourceFilterString.length) {\r\n return options;\r\n } else {\r\n return options?.filter((option) => option.name.toLowerCase().includes(sourceFilterString?.toLowerCase()));\r\n }\r\n }, [options, sourceFilterString]);\r\n\r\n const handleAddNewMapSource = React.useCallback(() => {\r\n UiFramework.dialogs.modal.open(<MapUrlDialog\r\n activeViewport={activeViewport}\r\n isOverlay={isOverlay}\r\n onOkResult={(result?: SourceState) => handleModalUrlDialogOk(LayerAction.New, result)}\r\n onCancelResult={handleModalUrlDialogCancel}\r\n mapTypesOptions={mapTypesOptions} />);\r\n if (onHandleOutsideClick) {\r\n onHandleOutsideClick(false);\r\n }\r\n return;\r\n }, [activeViewport, handleModalUrlDialogCancel, handleModalUrlDialogOk, isOverlay, mapTypesOptions, onHandleOutsideClick]);\r\n\r\n const handleAttach = React.useCallback((mapName: string) => {\r\n setLayerNameToAdd(mapName);\r\n }, []);\r\n\r\n const handleKeypressOnSourceList = React.useCallback((event: React.KeyboardEvent<HTMLUListElement>) => {\r\n const key = event.key;\r\n if (key === \"Enter\") {\r\n event.preventDefault();\r\n const mapName = event.currentTarget?.dataset?.value;\r\n if (mapName && mapName.length) {\r\n handleAttach(mapName);\r\n }\r\n }\r\n }, [handleAttach]);\r\n\r\n const onListboxValueChange = React.useCallback((mapName: string) => {\r\n setLayerNameToAdd(mapName);\r\n }, []);\r\n\r\n const handleNoConfirmation = React.useCallback((_layerName: string) => {\r\n UiFramework.dialogs.modal.close();\r\n resumeOutsideClick();\r\n }, [resumeOutsideClick]);\r\n\r\n const handleYesConfirmation = React.useCallback(async (source: MapLayerSource) => {\r\n const layerName = source.name;\r\n if (!!iTwinId) {\r\n try {\r\n await MapLayerPreferences.deleteByName(source, iTwinId, iModelId);\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.RemoveLayerDefSuccess\", { layerName });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, msg));\r\n } catch (err: any) {\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.RemoveLayerDefError\", { layerName });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\r\n }\r\n }\r\n\r\n UiFramework.dialogs.modal.close();\r\n resumeOutsideClick();\r\n }, [iTwinId, iModelId, resumeOutsideClick]);\r\n\r\n /*\r\n Handle Remove layer button clicked\r\n */\r\n const onItemRemoveButtonClicked = React.useCallback((source, event) => {\r\n event.stopPropagation(); // We don't want the owning ListBox to react on mouse click.\r\n\r\n const layerName = source.name;\r\n\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.RemoveLayerDefDialogMessage\", { layerName });\r\n UiFramework.dialogs.modal.open(\r\n <ConfirmMessageDialog\r\n className=\"map-sources-delete-confirmation\"\r\n title={removeLayerDefDialogTitle}\r\n message={msg}\r\n maxWidth={400}\r\n onClose={() => handleNoConfirmation(layerName)}\r\n onEscape={() => handleNoConfirmation(layerName)}\r\n onYesResult={async () => handleYesConfirmation(source)}\r\n onNoResult={() => handleNoConfirmation(layerName)}\r\n />\r\n );\r\n if (onHandleOutsideClick) {\r\n onHandleOutsideClick(false);\r\n }\r\n }, [handleNoConfirmation, handleYesConfirmation, onHandleOutsideClick, removeLayerDefDialogTitle]);\r\n\r\n /*\r\n Handle Edit layer button clicked\r\n */\r\n const onItemEditButtonClicked = React.useCallback((event) => {\r\n event.stopPropagation(); // We don't want the owning ListBox to react on mouse click.\r\n\r\n const targetLayerName = event?.currentTarget?.parentNode?.dataset?.value;\r\n const matchingSource = sources.find((layerSource) => layerSource.name === targetLayerName);\r\n\r\n // we expect a single layer source matching this name\r\n if (matchingSource === undefined) {\r\n return;\r\n }\r\n UiFramework.dialogs.modal.open(<MapUrlDialog\r\n activeViewport={activeViewport}\r\n isOverlay={isOverlay}\r\n mapLayerSourceToEdit={matchingSource}\r\n onOkResult={(result?: SourceState) => handleModalUrlDialogOk(LayerAction.Edit, result)}\r\n onCancelResult={handleModalUrlDialogCancel}\r\n mapTypesOptions={mapTypesOptions} />);\r\n\r\n if (onHandleOutsideClick) {\r\n onHandleOutsideClick(false);\r\n }\r\n }, [activeViewport, handleModalUrlDialogCancel, handleModalUrlDialogOk, isOverlay, mapTypesOptions, onHandleOutsideClick, sources]);\r\n\r\n return (\r\n <div className=\"map-manager-header\">\r\n {(loading || loadingSources) && <UiCore.LoadingSpinner message={loadingMapSources} />}\r\n <div className=\"map-manager-source-listbox-header\">\r\n <Input type=\"text\" className=\"map-manager-source-list-filter\"\r\n placeholder={placeholderLabel}\r\n value={sourceFilterString}\r\n onChange={handleFilterTextChanged}\r\n size=\"small\" />\r\n <Button className=\"map-manager-add-source-button\" title={addCustomLayerToolTip} onClick={handleAddNewMapSource}>\r\n {addCustomLayerLabel}</Button>\r\n </div>\r\n <div className=\"map-manager-sources\">\r\n <UiCore.Listbox\r\n id=\"map-sources\"\r\n selectedValue={layerNameToAdd}\r\n className=\"map-manager-source-list\"\r\n onKeyPress={handleKeypressOnSourceList}\r\n onListboxValueChange={onListboxValueChange} >\r\n {\r\n filteredOptions?.map((source) =>\r\n <UiCore.ListboxItem\r\n key={source.name}\r\n className=\"map-source-list-entry\"\r\n value={source.name}\r\n onMouseEnter={() => setLayerNameUnderCursor(source.name)}\r\n onMouseLeave={() => setLayerNameUnderCursor(undefined)}>\r\n <span className=\"map-source-list-entry-name\" title={source.name}>{source.name}</span>\r\n\r\n { // Display the delete icon only when the mouse over a specific item\r\n // otherwise list feels cluttered.\r\n (!!iTwinId && layerNameUnderCursor && layerNameUnderCursor === source.name) &&\r\n <>\r\n <Button\r\n size=\"small\"\r\n styleType=\"borderless\"\r\n className=\"map-source-list-entry-button\"\r\n title={editLayerDefButtonTitle}\r\n onClick={onItemEditButtonClicked}>\r\n <UiCore.Icon iconSpec=\"icon-edit\" />\r\n </Button>\r\n <Button\r\n size=\"small\"\r\n styleType=\"borderless\"\r\n className=\"map-source-list-entry-button\"\r\n title={removeLayerDefButtonTitle}\r\n onClick={(event: React.MouseEvent) => { onItemRemoveButtonClicked(source, event); }}>\r\n <UiCore.Icon iconSpec=\"icon-delete\" />\r\n </Button>\r\n </>}\r\n\r\n </UiCore.ListboxItem>\r\n )\r\n }\r\n </UiCore.Listbox>\r\n </div>\r\n </div>\r\n\r\n );\r\n}\r\n\r\n/** @internal */\r\nexport enum AttachLayerButtonType {\r\n Primary,\r\n Blue,\r\n Icon\r\n}\r\nexport interface AttachLayerPopupButtonProps {\r\n isOverlay: boolean;\r\n buttonType?: AttachLayerButtonType;\r\n disabled?: boolean;\r\n}\r\n\r\n/** @internal */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function AttachLayerPopupButton(props: AttachLayerPopupButtonProps) {\r\n const { showAttachLayerLabel, hideAttachLayerLabel, addCustomLayerButtonLabel } = React.useMemo(() => {\r\n return {\r\n showAttachLayerLabel: MapLayersUI.localization.getLocalizedString(\"mapLayers:AttachLayerPopup.Attach\"),\r\n hideAttachLayerLabel: MapLayersUI.localization.getLocalizedString(\"mapLayers:AttachLayerPopup.Close\"),\r\n addCustomLayerButtonLabel: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.AddCustomLayerButtonLabel\"),\r\n };\r\n }, []);\r\n\r\n const [handleOutsideClick, setHandleOutsideClick] = React.useState(true);\r\n const [popupOpen, setPopupOpen] = React.useState(false);\r\n const buttonRef = React.useRef<HTMLButtonElement>(null);\r\n const panelRef = React.useRef<HTMLDivElement>(null);\r\n\r\n // 'isMounted' is used to prevent any async operation once the hook has been\r\n // unloaded. Otherwise we get a 'Can't perform a React state update on an unmounted component.' warning in the console.\r\n const isMounted = React.useRef(false);\r\n React.useEffect(() => {\r\n isMounted.current = true;\r\n return () => {\r\n isMounted.current = false;\r\n };\r\n }, []);\r\n\r\n const togglePopup = React.useCallback(() => {\r\n setPopupOpen(!popupOpen);\r\n }, [popupOpen]);\r\n\r\n const handleClosePopup = React.useCallback(() => {\r\n setPopupOpen(false);\r\n }, []);\r\n\r\n const onHandleOutsideClick = React.useCallback((event: MouseEvent) => {\r\n if (!handleOutsideClick) {\r\n return;\r\n }\r\n\r\n // If clicking on button that open panel - don't trigger outside click processing\r\n if (buttonRef?.current && buttonRef?.current.contains(event.target as Node)) {\r\n return;\r\n }\r\n\r\n // If clicking the panel, this is not an outside clicked\r\n if (panelRef.current && panelRef?.current.contains(event.target as Node)) {\r\n return;\r\n }\r\n\r\n // If we reach this point, we got an outside clicked, no close the popup\r\n setPopupOpen(false);\r\n\r\n }, [handleOutsideClick]);\r\n\r\n const { refreshFromStyle } = useSourceMapContext();\r\n\r\n const handleLayerAttached = React.useCallback(() => {\r\n if (!isMounted.current) {\r\n return;\r\n }\r\n setPopupOpen(false);\r\n refreshFromStyle();\r\n }, [refreshFromStyle]);\r\n\r\n function renderButton(): React.ReactNode {\r\n let button: React.ReactNode;\r\n\r\n if (props.buttonType === undefined || props.buttonType === AttachLayerButtonType.Icon) {\r\n button = (\r\n <IconButton disabled={props.disabled} size=\"small\" styleType=\"borderless\" ref={buttonRef} className=\"map-manager-attach-layer-button\" title={popupOpen ? hideAttachLayerLabel : showAttachLayerLabel}\r\n onClick={togglePopup}>\r\n <SvgAdd/>\r\n </IconButton>\r\n );\r\n } else {\r\n const determineStyleType = () => {\r\n switch (props.buttonType) {\r\n case AttachLayerButtonType.Blue:\r\n return \"high-visibility\";\r\n case AttachLayerButtonType.Primary:\r\n default:\r\n return \"cta\";\r\n }\r\n };\r\n const styleType = determineStyleType();\r\n button = (\r\n <Button disabled={props.disabled} ref={buttonRef} styleType={styleType} title={popupOpen ? hideAttachLayerLabel : showAttachLayerLabel}\r\n onClick={togglePopup}>{addCustomLayerButtonLabel}</Button>\r\n );\r\n }\r\n\r\n return button;\r\n }\r\n\r\n return (\r\n <>\r\n {renderButton()}\r\n <UiCore.Popup\r\n isOpen={popupOpen}\r\n position={RelativePosition.BottomRight}\r\n onClose={handleClosePopup}\r\n onOutsideClick={onHandleOutsideClick}\r\n closeOnWheel={false}\r\n target={buttonRef.current}\r\n closeOnEnter={false}\r\n closeOnContextMenu={false}\r\n >\r\n <div ref={panelRef} className=\"map-sources-popup-panel\" >\r\n <AttachLayerPanel\r\n isOverlay={props.isOverlay}\r\n onLayerAttached={handleLayerAttached}\r\n onHandleOutsideClick={setHandleOutsideClick} />\r\n </div>\r\n </UiCore.Popup >\r\n </>\r\n );\r\n}\r\n"]}
|
|
@@ -169,7 +169,7 @@ function BasemapPanel(props) {
|
|
|
169
169
|
const [toggleVisibility] = React.useState(mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:Widget.ToggleVisibility"));
|
|
170
170
|
return (React.createElement(React.Fragment, null,
|
|
171
171
|
React.createElement("div", { className: "map-manager-base-item" },
|
|
172
|
-
React.createElement(itwinui_react_1.Button, { size: "small", styleType: "borderless", title: toggleVisibility, onClick: handleVisibilityChange, disabled: props.disabled || !activeViewport || !(activeViewport.displayStyle.backgroundMapBase instanceof core_common_1.ImageMapLayerSettings) },
|
|
172
|
+
React.createElement(itwinui_react_1.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 core_common_1.ImageMapLayerSettings) },
|
|
173
173
|
React.createElement(core_react_1.WebFontIcon, { iconName: baseMapVisible ? "icon-visibility" : "icon-visibility-hide-2" })),
|
|
174
174
|
React.createElement("span", { className: "map-manager-base-label" }, baseLayerLabel),
|
|
175
175
|
React.createElement(itwinui_react_1.Select, { className: "map-manager-base-item-select", options: baseMapOptions, placeholder: selectBaseMapLabel, value: selectedBaseMapValue.value, onChange: handleBaseMapSelection, size: "small", disabled: props.disabled }),
|
|
@@ -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,oDAAiD;AACjD,oDAA8K;AAC9K,kDAAgD;AAChD,4EAAgF;AAChF,wDAAoE;AACpE,+BAA+B;AAC/B,+CAA8C;AAC9C,uDAAwD;AACxD,uEAAoE;AACpE,+BAA6B;AAE7B,SAAS,mBAAmB,CAAC,cAA6C;IACxE,IAAI,CAAC,cAAc;QACjB,OAAO,SAAS,CAAC;IAEnB,IAAI,cAAc,YAAY,mCAAqB,IAAI,cAAc,YAAY,sBAAQ;QACvF,OAAO,cAAc,CAAC,MAAM,EAAE,CAAC;IAEjC,OAAO,SAAS,CAAC;AACnB,CAAC;AAMD,gBAAgB;AAChB,gEAAgE;AAChE,SAAgB,YAAY,CAAC,KAAwB;IACnD,MAAM,CAAC,aAAa,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,uBAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,6BAA6B,CAAC,CAAC,CAAC;IACnH,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,GAAG,IAAA,qCAAmB,GAAE,CAAC;IACxD,MAAM,CAAC,eAA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AO,EAC9C,QAAQ,EAAE,KAAK,CAAC,QAAQ,GACxB;YAEA,WAAW;gBACX,oBAAC,qCAAW,IAAC,SAAS,EAAC,6BAA6B,EAAC,QAAQ,EAAE,sBAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,kBAAkB,GAAI;YAE9I,oBAAC,iDAAuB,IAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,YAAY,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,+BAA+B,GAAI,CAChJ,CACL,CACJ,CAAC;AACJ,CAAC;AAjLD,oCAiLC","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 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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AAQ,CAAC,uBAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,mCAAmC,CAAC,CAAC,CAAC;IAE5H,OAAO,CACL;QACE,6BAAK,SAAS,EAAC,uBAAuB;YACpC,oBAAC,sBAAM,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,mCAAqB,CAAC;gBAC3S,oBAAC,wBAAW,IAAC,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,wBAAwB,GAAI,CACjF;YACT,8BAAM,SAAS,EAAC,wBAAwB,IAAE,cAAc,CAAQ;YAChE,oBAAC,sBAAM,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,qCAAW,IAAC,SAAS,EAAC,6BAA6B,EAAC,QAAQ,EAAE,sBAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,kBAAkB,GAAI;YAE9I,oBAAC,iDAAuB,IAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,YAAY,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,+BAA+B,GAAI,CAChJ,CACL,CACJ,CAAC;AACJ,CAAC;AAjLD,oCAiLC","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,29 +1,21 @@
|
|
|
1
1
|
import { PropertyRecord } from "@itwin/appui-abstract";
|
|
2
2
|
import { IPropertyDataProvider, PropertyCategory, PropertyData, PropertyDataChangeEvent } from "@itwin/components-react";
|
|
3
|
-
import {
|
|
4
|
-
import { MapHitEvent } from "../Interfaces";
|
|
3
|
+
import { MapSubLayerFeatureInfo } from "@itwin/core-frontend";
|
|
5
4
|
/**
|
|
6
|
-
*
|
|
7
|
-
* @public
|
|
5
|
+
* @internal
|
|
8
6
|
*/
|
|
9
|
-
export declare enum MapFeatureInfoLoadState {
|
|
10
|
-
DataLoadStart = 0,
|
|
11
|
-
DataLoadEnd = 1
|
|
12
|
-
}
|
|
13
|
-
export declare type MapFeatureInfoLoadListener = (state: MapFeatureInfoLoadState) => void;
|
|
14
|
-
export interface MapFeatureInfoDataUpdate {
|
|
15
|
-
recordCount: number;
|
|
16
|
-
}
|
|
17
|
-
export declare type MapFeatureInfoDataUpdatedListener = (data: MapFeatureInfoDataUpdate) => void;
|
|
18
7
|
export declare class FeatureInfoDataProvider implements IPropertyDataProvider {
|
|
19
|
-
private
|
|
8
|
+
private _detachActiveToolListener;
|
|
9
|
+
private readonly _detachToolAdminListener;
|
|
20
10
|
onDataChanged: PropertyDataChangeEvent;
|
|
21
|
-
onDataLoadStateChanged: BeEvent<MapFeatureInfoLoadListener>;
|
|
22
|
-
onDataUpdated: BeEvent<MapFeatureInfoDataUpdatedListener>;
|
|
23
11
|
private _data;
|
|
24
|
-
constructor(
|
|
12
|
+
constructor();
|
|
13
|
+
private handleActiveToolChanged;
|
|
14
|
+
private handleOnInfoReadyChanged;
|
|
25
15
|
onUnload(): void;
|
|
26
|
-
|
|
16
|
+
get hasRecords(): boolean;
|
|
17
|
+
private setInfo;
|
|
18
|
+
addSubLayerCategory(subLayerInfo: MapSubLayerFeatureInfo, layerCategory: PropertyCategory): void;
|
|
27
19
|
addSubCategory(categoryName: string): void;
|
|
28
20
|
addCategory(category: PropertyCategory): number;
|
|
29
21
|
findCategoryIndex(category: PropertyCategory): number;
|