@itwin/map-layers 5.0.0-dev.3 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -1
- package/lib/cjs/MapLayerPreferences.js +1 -1
- package/lib/cjs/MapLayerPreferences.js.map +1 -1
- package/lib/cjs/MapLayersPrefBrowserStorage.d.ts +5 -0
- package/lib/cjs/MapLayersPrefBrowserStorage.d.ts.map +1 -0
- package/lib/cjs/MapLayersPrefBrowserStorage.js +16 -0
- package/lib/cjs/MapLayersPrefBrowserStorage.js.map +1 -0
- package/lib/cjs/PreferencesBrowserStorage.d.ts +36 -0
- package/lib/cjs/PreferencesBrowserStorage.d.ts.map +1 -0
- package/lib/cjs/PreferencesBrowserStorage.js +92 -0
- package/lib/cjs/PreferencesBrowserStorage.js.map +1 -0
- package/lib/cjs/map-layers.d.ts +1 -0
- package/lib/cjs/map-layers.d.ts.map +1 -1
- package/lib/cjs/map-layers.js +1 -0
- package/lib/cjs/map-layers.js.map +1 -1
- package/lib/cjs/public/locales/en/mapLayers.json +7 -2
- package/lib/cjs/ui/widget/AttachLayerPopupButton.d.ts.map +1 -1
- package/lib/cjs/ui/widget/AttachLayerPopupButton.js +144 -64
- package/lib/cjs/ui/widget/AttachLayerPopupButton.js.map +1 -1
- package/lib/cjs/ui/widget/BasemapPanel.d.ts.map +1 -1
- package/lib/cjs/ui/widget/BasemapPanel.js +44 -15
- package/lib/cjs/ui/widget/BasemapPanel.js.map +1 -1
- package/lib/cjs/ui/widget/MapLayerDroppable.d.ts.map +1 -1
- package/lib/cjs/ui/widget/MapLayerDroppable.js +31 -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 +35 -57
- package/lib/cjs/ui/widget/MapLayerManager.js.map +1 -1
- package/lib/cjs/ui/widget/MapLayerManager.scss +2 -8
- package/lib/cjs/ui/widget/MapSelectFeaturesDialog.d.ts +11 -0
- package/lib/cjs/ui/widget/MapSelectFeaturesDialog.d.ts.map +1 -0
- package/lib/cjs/ui/widget/MapSelectFeaturesDialog.js +58 -0
- package/lib/cjs/ui/widget/MapSelectFeaturesDialog.js.map +1 -0
- package/lib/cjs/ui/widget/MapSelectFeaturesDialog.scss +17 -0
- package/lib/cjs/ui/widget/MapUrlDialog.d.ts +7 -2
- package/lib/cjs/ui/widget/MapUrlDialog.d.ts.map +1 -1
- package/lib/cjs/ui/widget/MapUrlDialog.js +38 -134
- package/lib/cjs/ui/widget/MapUrlDialog.js.map +1 -1
- package/lib/cjs/ui/widget/MapUrlDialog.scss +10 -10
- package/lib/cjs/ui/widget/SubLayersDataProvider.d.ts +3 -3
- package/lib/cjs/ui/widget/SubLayersDataProvider.d.ts.map +1 -1
- package/lib/cjs/ui/widget/SubLayersDataProvider.js +4 -5
- package/lib/cjs/ui/widget/SubLayersDataProvider.js.map +1 -1
- package/lib/cjs/ui/widget/SubLayersPopupButton.d.ts +3 -7
- package/lib/cjs/ui/widget/SubLayersPopupButton.d.ts.map +1 -1
- package/lib/cjs/ui/widget/SubLayersPopupButton.js +2 -2
- package/lib/cjs/ui/widget/SubLayersPopupButton.js.map +1 -1
- package/lib/cjs/ui/widget/SubLayersTree.d.ts +17 -9
- package/lib/cjs/ui/widget/SubLayersTree.d.ts.map +1 -1
- package/lib/cjs/ui/widget/SubLayersTree.js +59 -112
- package/lib/cjs/ui/widget/SubLayersTree.js.map +1 -1
- package/lib/cjs/ui/widget/SubLayersTree.scss +12 -3
- package/lib/esm/MapLayerPreferences.js +1 -1
- package/lib/esm/MapLayerPreferences.js.map +1 -1
- package/lib/esm/MapLayersPrefBrowserStorage.d.ts +5 -0
- package/lib/esm/MapLayersPrefBrowserStorage.d.ts.map +1 -0
- package/lib/esm/MapLayersPrefBrowserStorage.js +12 -0
- package/lib/esm/MapLayersPrefBrowserStorage.js.map +1 -0
- package/lib/esm/PreferencesBrowserStorage.d.ts +36 -0
- package/lib/esm/PreferencesBrowserStorage.d.ts.map +1 -0
- package/lib/esm/PreferencesBrowserStorage.js +88 -0
- package/lib/esm/PreferencesBrowserStorage.js.map +1 -0
- package/lib/esm/map-layers.d.ts +1 -0
- package/lib/esm/map-layers.d.ts.map +1 -1
- package/lib/esm/map-layers.js +1 -0
- package/lib/esm/map-layers.js.map +1 -1
- package/lib/esm/public/locales/en/mapLayers.json +7 -2
- package/lib/esm/ui/widget/AttachLayerPopupButton.d.ts.map +1 -1
- package/lib/esm/ui/widget/AttachLayerPopupButton.js +145 -65
- package/lib/esm/ui/widget/AttachLayerPopupButton.js.map +1 -1
- package/lib/esm/ui/widget/BasemapPanel.d.ts.map +1 -1
- package/lib/esm/ui/widget/BasemapPanel.js +44 -15
- package/lib/esm/ui/widget/BasemapPanel.js.map +1 -1
- package/lib/esm/ui/widget/MapLayerDroppable.d.ts.map +1 -1
- package/lib/esm/ui/widget/MapLayerDroppable.js +32 -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 +36 -58
- package/lib/esm/ui/widget/MapLayerManager.js.map +1 -1
- package/lib/esm/ui/widget/MapLayerManager.scss +2 -8
- package/lib/esm/ui/widget/MapSelectFeaturesDialog.d.ts +11 -0
- package/lib/esm/ui/widget/MapSelectFeaturesDialog.d.ts.map +1 -0
- package/lib/esm/ui/widget/MapSelectFeaturesDialog.js +54 -0
- package/lib/esm/ui/widget/MapSelectFeaturesDialog.js.map +1 -0
- package/lib/esm/ui/widget/MapSelectFeaturesDialog.scss +17 -0
- package/lib/esm/ui/widget/MapUrlDialog.d.ts +7 -2
- package/lib/esm/ui/widget/MapUrlDialog.d.ts.map +1 -1
- package/lib/esm/ui/widget/MapUrlDialog.js +38 -134
- package/lib/esm/ui/widget/MapUrlDialog.js.map +1 -1
- package/lib/esm/ui/widget/MapUrlDialog.scss +10 -10
- package/lib/esm/ui/widget/SubLayersDataProvider.d.ts +3 -3
- package/lib/esm/ui/widget/SubLayersDataProvider.d.ts.map +1 -1
- package/lib/esm/ui/widget/SubLayersDataProvider.js +4 -5
- package/lib/esm/ui/widget/SubLayersDataProvider.js.map +1 -1
- package/lib/esm/ui/widget/SubLayersPopupButton.d.ts +3 -7
- package/lib/esm/ui/widget/SubLayersPopupButton.d.ts.map +1 -1
- package/lib/esm/ui/widget/SubLayersPopupButton.js +2 -2
- package/lib/esm/ui/widget/SubLayersPopupButton.js.map +1 -1
- package/lib/esm/ui/widget/SubLayersTree.d.ts +17 -9
- package/lib/esm/ui/widget/SubLayersTree.d.ts.map +1 -1
- package/lib/esm/ui/widget/SubLayersTree.js +60 -113
- package/lib/esm/ui/widget/SubLayersTree.js.map +1 -1
- package/lib/esm/ui/widget/SubLayersTree.scss +12 -3
- package/lib/public/locales/en/mapLayers.json +7 -2
- package/package.json +26 -25
|
@@ -259,13 +259,8 @@ $default-font-size: --iui-font-size-1;
|
|
|
259
259
|
.map-layer-source-item-warnMessage-icon {
|
|
260
260
|
background-color: transparent;
|
|
261
261
|
border: none;
|
|
262
|
-
color:
|
|
262
|
+
color: var(--iui-color-icon-warning);
|
|
263
263
|
background-color: transparent;
|
|
264
|
-
|
|
265
|
-
&:hover {
|
|
266
|
-
color: $hovered-icon-color;
|
|
267
|
-
}
|
|
268
|
-
|
|
269
264
|
&:focus {
|
|
270
265
|
outline: none;
|
|
271
266
|
box-shadow: rgba(var(--iui-color-border-accent), var(--iui-opacity-4)) 0px 0px 0px 2px;
|
|
@@ -279,8 +274,7 @@ $default-font-size: --iui-font-size-1;
|
|
|
279
274
|
}
|
|
280
275
|
|
|
281
276
|
.map-manager-sublayer-panel {
|
|
282
|
-
width: 400px;
|
|
283
|
-
height: 400px;
|
|
277
|
+
width: 400px; // Ideally I would let the popup's content drives the width, unfortunately without an explicit width, the popup location is not consistent.
|
|
284
278
|
color: $buic-foreground-body;
|
|
285
279
|
font-size: $default-font-size;
|
|
286
280
|
padding: 4px;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import "./MapSelectFeaturesDialog.scss";
|
|
2
|
+
import { MapLayerSource } from "@itwin/core-frontend";
|
|
3
|
+
import { MapSubLayerProps } from "@itwin/core-common";
|
|
4
|
+
export interface MapSelectFeaturesProps {
|
|
5
|
+
source: MapLayerSource;
|
|
6
|
+
subLayers: MapSubLayerProps[];
|
|
7
|
+
handleOk: (subLayers: MapSubLayerProps[]) => void;
|
|
8
|
+
handleCancel: () => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function MapSelectFeaturesDialog(props: MapSelectFeaturesProps): JSX.Element;
|
|
11
|
+
//# sourceMappingURL=MapSelectFeaturesDialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MapSelectFeaturesDialog.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/MapSelectFeaturesDialog.tsx"],"names":[],"mappings":"AAQA,OAAO,gCAAgC,CAAC;AAIxC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,cAAc,CAAC;IACvB,SAAS,EAAE,gBAAgB,EAAE,CAAC;IAC9B,QAAQ,EAAE,CAAC,SAAS,EAAE,gBAAgB,EAAE,KAAK,IAAI,CAAC;IAClD,YAAY,EAAE,MAAM,IAAI,CAAC;CAC1B;AAKD,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,sBAAsB,eAqEpE"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
// cSpell:ignore Modeless WMTS
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.MapSelectFeaturesDialog = void 0;
|
|
9
|
+
const core_react_1 = require("@itwin/core-react");
|
|
10
|
+
const React = require("react");
|
|
11
|
+
require("./MapSelectFeaturesDialog.scss");
|
|
12
|
+
const appui_abstract_1 = require("@itwin/appui-abstract");
|
|
13
|
+
const mapLayers_1 = require("../../mapLayers");
|
|
14
|
+
const SubLayersTree_1 = require("./SubLayersTree");
|
|
15
|
+
const minHeight = 250;
|
|
16
|
+
const maxSubLayers = 30;
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
18
|
+
function MapSelectFeaturesDialog(props) {
|
|
19
|
+
const [subLayers, setSubLayers] = React.useState(props.subLayers);
|
|
20
|
+
const [NoLayersSelectedMsg] = React.useState(() => mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:CustomAttach.NoLayersSelected"));
|
|
21
|
+
const [dialogTitle] = React.useState(mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:CustomAttach.SelectLayersToCreate"));
|
|
22
|
+
const dialogContainer = React.useRef(null);
|
|
23
|
+
const handleOk = React.useCallback(() => {
|
|
24
|
+
props.handleOk(subLayers);
|
|
25
|
+
}, [props, subLayers]);
|
|
26
|
+
const handleCancel = React.useCallback(() => {
|
|
27
|
+
props.handleCancel();
|
|
28
|
+
}, [props]);
|
|
29
|
+
const hasVisibleLayers = () => subLayers.some((entry) => entry.visible);
|
|
30
|
+
const hasTooManyVisibleLayers = () => subLayers.filter((entry) => entry.visible).length > maxSubLayers;
|
|
31
|
+
const readyToSave = () => hasVisibleLayers();
|
|
32
|
+
const buttonCluster = [
|
|
33
|
+
{ type: appui_abstract_1.DialogButtonType.OK, onClick: handleOk, disabled: !readyToSave() },
|
|
34
|
+
{ type: appui_abstract_1.DialogButtonType.Cancel, onClick: handleCancel },
|
|
35
|
+
];
|
|
36
|
+
function renderWarningMessage() {
|
|
37
|
+
let warningMessage;
|
|
38
|
+
// Get the proper warning message
|
|
39
|
+
if (!hasVisibleLayers()) {
|
|
40
|
+
warningMessage = NoLayersSelectedMsg;
|
|
41
|
+
}
|
|
42
|
+
else if (hasTooManyVisibleLayers()) {
|
|
43
|
+
warningMessage = mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:CustomAttach.TooManyLayersSelected", { layerCount: subLayers.filter((entry) => entry.visible).length });
|
|
44
|
+
}
|
|
45
|
+
if (warningMessage !== undefined) {
|
|
46
|
+
return (React.createElement("div", { className: "map-layer-source-warnMessage" },
|
|
47
|
+
React.createElement(core_react_1.Icon, { className: "map-layer-source-warnMessage-icon", iconSpec: "icon-status-warning" }),
|
|
48
|
+
React.createElement("span", { className: "map-layer-source-warnMessage-label" }, warningMessage)));
|
|
49
|
+
}
|
|
50
|
+
return React.createElement(React.Fragment, null);
|
|
51
|
+
}
|
|
52
|
+
return (React.createElement("div", { ref: dialogContainer },
|
|
53
|
+
React.createElement(core_react_1.Dialog, { className: "map-layer-select-features-dialog", title: dialogTitle, opened: true, resizable: true, movable: true, modal: true, buttonCluster: buttonCluster, onClose: handleCancel, onEscape: handleCancel, minHeight: minHeight, maxWidth: 600, titleStyle: { paddingLeft: "10px" }, footerStyle: { paddingBottom: "10px", paddingRight: "10px" }, trapFocus: false },
|
|
54
|
+
React.createElement(SubLayersTree_1.SubLayersTree, { expandMode: "full", checkboxStyle: "standard", subLayers: subLayers, onSubLayerStateChange: () => setSubLayers([...subLayers]) }),
|
|
55
|
+
renderWarningMessage())));
|
|
56
|
+
}
|
|
57
|
+
exports.MapSelectFeaturesDialog = MapSelectFeaturesDialog;
|
|
58
|
+
//# sourceMappingURL=MapSelectFeaturesDialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MapSelectFeaturesDialog.js","sourceRoot":"","sources":["../../../../src/ui/widget/MapSelectFeaturesDialog.tsx"],"names":[],"mappings":"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","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n// cSpell:ignore Modeless WMTS\n\nimport { Dialog, Icon } from \"@itwin/core-react\";\nimport * as React from \"react\";\nimport \"./MapSelectFeaturesDialog.scss\";\n\nimport { DialogButtonType } from \"@itwin/appui-abstract\";\nimport { MapLayersUI } from \"../../mapLayers\";\nimport { MapLayerSource } from \"@itwin/core-frontend\";\nimport { MapSubLayerProps } from \"@itwin/core-common\";\nimport { SubLayersTree } from \"./SubLayersTree\";\n\nexport interface MapSelectFeaturesProps {\n source: MapLayerSource;\n subLayers: MapSubLayerProps[];\n handleOk: (subLayers: MapSubLayerProps[]) => void;\n handleCancel: () => void;\n}\nconst minHeight = 250;\nconst maxSubLayers = 30;\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function MapSelectFeaturesDialog(props: MapSelectFeaturesProps) {\n const [subLayers, setSubLayers] = React.useState(props.subLayers);\n const [NoLayersSelectedMsg] = React.useState(()=>MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.NoLayersSelected\"));\n const [dialogTitle] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.SelectLayersToCreate\"));\n\n const dialogContainer = React.useRef<HTMLDivElement>(null);\n\n const handleOk = React.useCallback(() => {\n props.handleOk(subLayers);\n }, [props, subLayers]);\n\n const handleCancel = React.useCallback(() => {\n props.handleCancel();\n }, [props]);\n\n const hasVisibleLayers = () => subLayers.some((entry)=>entry.visible);\n const hasTooManyVisibleLayers = () => subLayers.filter((entry)=>entry.visible).length > maxSubLayers;\n const readyToSave = () => hasVisibleLayers();\n const buttonCluster = [\n { type: DialogButtonType.OK, onClick: handleOk, disabled: !readyToSave() },\n { type: DialogButtonType.Cancel, onClick: handleCancel },\n ];\n\n function renderWarningMessage(): React.ReactNode {\n let warningMessage: string | undefined;\n\n // Get the proper warning message\n if (!hasVisibleLayers()) {\n warningMessage = NoLayersSelectedMsg;\n } else if (hasTooManyVisibleLayers()) {\n warningMessage = MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.TooManyLayersSelected\", { layerCount: subLayers.filter((entry)=>entry.visible).length});\n }\n\n if (warningMessage !== undefined) {\n return (\n <div className=\"map-layer-source-warnMessage\">\n <Icon className=\"map-layer-source-warnMessage-icon\" iconSpec=\"icon-status-warning\" />\n <span className=\"map-layer-source-warnMessage-label\">{warningMessage}</span >\n </div>);\n }\n return <></>;\n }\n\n return (\n <div ref={dialogContainer}>\n <Dialog\n className=\"map-layer-select-features-dialog\"\n title={dialogTitle}\n opened={true}\n resizable={true}\n movable={true}\n modal={true}\n buttonCluster={buttonCluster}\n onClose={handleCancel}\n onEscape={handleCancel}\n minHeight={minHeight}\n maxWidth={600}\n titleStyle={{ paddingLeft: \"10px\" }}\n footerStyle={{ paddingBottom: \"10px\", paddingRight: \"10px\" }}\n trapFocus={false}\n >\n {/* 'onSubLayerStateChange' is used to trigger hook state change only, no need to update subLayer objects */}\n <SubLayersTree expandMode=\"full\" checkboxStyle=\"standard\" subLayers={subLayers} onSubLayerStateChange={() => setSubLayers([...subLayers])}/>\n\n {/* Warning message */}\n {renderWarningMessage()}\n </Dialog>\n </div >\n );\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
|
|
6
|
+
.map-layer-select-features-dialog {
|
|
7
|
+
z-Index: 21000;
|
|
8
|
+
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.map-layer-select-features-dialog.core-dialog .core-dialog-container .core-dialog-area > .core-dialog-content {
|
|
12
|
+
overflow: hidden;
|
|
13
|
+
}
|
|
14
|
+
.map-layer-select-features-dialog .map-manager-sublayer-tree-content {
|
|
15
|
+
min-height: 200px;
|
|
16
|
+
}
|
|
17
|
+
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ImageMapLayerProps } from "@itwin/core-common";
|
|
2
|
-
import { MapLayerSource, ScreenViewport } from "@itwin/core-frontend";
|
|
2
|
+
import { MapLayerSource, MapLayerSourceValidation, ScreenViewport } from "@itwin/core-frontend";
|
|
3
3
|
import { MapTypesOptions } from "../Interfaces";
|
|
4
4
|
import "./MapUrlDialog.scss";
|
|
5
5
|
export declare const MAP_TYPES: {
|
|
@@ -9,15 +9,20 @@ export declare const MAP_TYPES: {
|
|
|
9
9
|
tileUrl: string;
|
|
10
10
|
arcGisFeature: string;
|
|
11
11
|
};
|
|
12
|
+
export declare type LayerCreationMode = "single" | "multiple";
|
|
12
13
|
interface MapUrlDialogProps {
|
|
13
14
|
activeViewport?: ScreenViewport;
|
|
14
15
|
isOverlay: boolean;
|
|
15
|
-
onOkResult: () => void;
|
|
16
|
+
onOkResult: (result?: SourceState) => void;
|
|
16
17
|
onCancelResult?: () => void;
|
|
17
18
|
mapTypesOptions?: MapTypesOptions;
|
|
18
19
|
layerRequiringCredentials?: ImageMapLayerProps;
|
|
19
20
|
mapLayerSourceToEdit?: MapLayerSource;
|
|
20
21
|
}
|
|
22
|
+
export interface SourceState {
|
|
23
|
+
source: MapLayerSource;
|
|
24
|
+
validation: MapLayerSourceValidation;
|
|
25
|
+
}
|
|
21
26
|
export declare function MapUrlDialog(props: MapUrlDialogProps): JSX.Element;
|
|
22
27
|
export {};
|
|
23
28
|
//# sourceMappingURL=MapUrlDialog.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapUrlDialog.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/MapUrlDialog.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MapUrlDialog.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/MapUrlDialog.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAC4B,cAAc,EACzB,wBAAwB,EAA+C,cAAc,EAC5G,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAGhD,OAAO,qBAAqB,CAAC;AAE7B,eAAO,MAAM,SAAS;;;;;;CAMrB,CAAC;AAEF,oBAAY,iBAAiB,GAAG,QAAQ,GAAC,UAAU,CAAC;AACpD,UAAU,iBAAiB;IACzB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,CAAC,MAAM,CAAC,EAAE,WAAW,KAAK,IAAI,CAAC;IAC3C,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,eAAe,CAAC,EAAE,eAAe,CAAC;IAGlC,yBAAyB,CAAC,EAAE,kBAAkB,CAAC;IAE/C,oBAAoB,CAAC,EAAE,cAAc,CAAC;CACvC;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,cAAc,CAAC;IACvB,UAAU,EAAE,wBAAwB,CAAC;CACtC;AAGD,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,eA+fpD"}
|
|
@@ -7,16 +7,15 @@
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
8
|
exports.MapUrlDialog = exports.MAP_TYPES = void 0;
|
|
9
9
|
const appui_abstract_1 = require("@itwin/appui-abstract");
|
|
10
|
-
const appui_react_1 = require("@itwin/appui-react");
|
|
11
10
|
const itwinui_react_1 = require("@itwin/itwinui-react");
|
|
12
11
|
const core_frontend_1 = require("@itwin/core-frontend");
|
|
13
12
|
const core_react_1 = require("@itwin/core-react");
|
|
14
13
|
const React = require("react");
|
|
15
14
|
const MapLayerPreferences_1 = require("../../MapLayerPreferences");
|
|
16
15
|
const mapLayers_1 = require("../../mapLayers");
|
|
17
|
-
require("./MapUrlDialog.scss");
|
|
18
16
|
const core_bentley_1 = require("@itwin/core-bentley");
|
|
19
17
|
const SelectMapFormat_1 = require("./SelectMapFormat");
|
|
18
|
+
require("./MapUrlDialog.scss");
|
|
20
19
|
exports.MAP_TYPES = {
|
|
21
20
|
wms: "WMS",
|
|
22
21
|
arcGis: "ArcGIS",
|
|
@@ -26,7 +25,7 @@ exports.MAP_TYPES = {
|
|
|
26
25
|
};
|
|
27
26
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
28
27
|
function MapUrlDialog(props) {
|
|
29
|
-
const {
|
|
28
|
+
const { onOkResult, mapTypesOptions } = props;
|
|
30
29
|
const getMapUrlFromProps = React.useCallback(() => {
|
|
31
30
|
if (props.mapLayerSourceToEdit) {
|
|
32
31
|
return props.mapLayerSourceToEdit.url;
|
|
@@ -104,27 +103,11 @@ function MapUrlDialog(props) {
|
|
|
104
103
|
&& props.activeViewport.iModel.iTwinId !== core_bentley_1.Guid.empty
|
|
105
104
|
&& props?.activeViewport?.iModel?.iModelId !== undefined
|
|
106
105
|
&& props?.activeViewport.iModel.iModelId !== core_bentley_1.Guid.empty);
|
|
107
|
-
// Even though the settings storage is available,
|
|
108
|
-
// we don't always want to enable it in the UI.
|
|
109
|
-
const [settingsStorageDisabled] = React.useState(!isSettingsStorageAvailable || props.mapLayerSourceToEdit !== undefined || props.layerRequiringCredentials !== undefined);
|
|
110
|
-
const [layerRequiringCredentialsIdx] = React.useState(() => {
|
|
111
|
-
if (props.layerRequiringCredentials === undefined || !props.layerRequiringCredentials.name || !props.layerRequiringCredentials.url) {
|
|
112
|
-
return undefined;
|
|
113
|
-
}
|
|
114
|
-
const indexInDisplayStyle = props.activeViewport?.displayStyle.findMapLayerIndexByNameAndSource(props.layerRequiringCredentials.name, props.layerRequiringCredentials.url, isOverlay);
|
|
115
|
-
if (indexInDisplayStyle === undefined || indexInDisplayStyle < 0) {
|
|
116
|
-
return undefined;
|
|
117
|
-
}
|
|
118
|
-
else {
|
|
119
|
-
return indexInDisplayStyle;
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
106
|
const handleCancel = React.useCallback(() => {
|
|
123
107
|
if (props.onCancelResult) {
|
|
124
108
|
props.onCancelResult();
|
|
125
109
|
return;
|
|
126
110
|
}
|
|
127
|
-
appui_react_1.UiFramework.dialogs.modal.close();
|
|
128
111
|
}, [props]);
|
|
129
112
|
const onUsernameChange = React.useCallback((event) => {
|
|
130
113
|
setUserName(event.target.value);
|
|
@@ -170,105 +153,6 @@ function MapUrlDialog(props) {
|
|
|
170
153
|
}
|
|
171
154
|
return sourceRequireAuth || invalidCredentials;
|
|
172
155
|
}, [accessClient, invalidCredentialsProvided]);
|
|
173
|
-
const updateAttachedLayer = React.useCallback(async (source, validation) => {
|
|
174
|
-
const vp = props?.activeViewport;
|
|
175
|
-
if (vp === undefined || source === undefined || layerRequiringCredentialsIdx === undefined) {
|
|
176
|
-
const error = mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:Messages.MapLayerAttachMissingViewOrSource");
|
|
177
|
-
const msg = mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:Messages.MapLayerAttachError", { error, sourceUrl: source.url });
|
|
178
|
-
core_frontend_1.IModelApp.notifications.outputMessage(new core_frontend_1.NotifyMessageDetails(core_frontend_1.OutputMessagePriority.Error, msg));
|
|
179
|
-
return true;
|
|
180
|
-
}
|
|
181
|
-
// Layer is already attached,
|
|
182
|
-
// This calls invalidateRenderPlan()
|
|
183
|
-
vp.displayStyle.changeMapLayerProps({
|
|
184
|
-
subLayers: validation.subLayers,
|
|
185
|
-
}, { index: layerRequiringCredentialsIdx, isOverlay });
|
|
186
|
-
vp.displayStyle.changeMapLayerCredentials({ index: layerRequiringCredentialsIdx, isOverlay }, source.userName, source.password);
|
|
187
|
-
// Either initial attach/initialize failed or the layer failed to load at least one tile
|
|
188
|
-
// because of an invalid token; in both cases tile tree needs to be fully reset
|
|
189
|
-
const provider = vp.getMapLayerImageryProvider({ index: layerRequiringCredentialsIdx, isOverlay });
|
|
190
|
-
provider?.resetStatus();
|
|
191
|
-
vp.resetMapLayer({ index: layerRequiringCredentialsIdx, isOverlay });
|
|
192
|
-
// This handler will close the layer source handler, and therefore the MapUrl dialog.
|
|
193
|
-
// don't call it if the dialog needs to remains open.
|
|
194
|
-
onOkResult();
|
|
195
|
-
return true;
|
|
196
|
-
}, [isOverlay, layerRequiringCredentialsIdx, onOkResult, props.activeViewport]);
|
|
197
|
-
// Returns true if no further input is needed from end-user.
|
|
198
|
-
const doAttach = React.useCallback(async (source, validation) => {
|
|
199
|
-
const vp = props?.activeViewport;
|
|
200
|
-
if (vp === undefined || source === undefined) {
|
|
201
|
-
const error = mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:Messages.MapLayerAttachMissingViewOrSource");
|
|
202
|
-
const msg = mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:Messages.MapLayerAttachError", { error, sourceUrl: source.url });
|
|
203
|
-
core_frontend_1.IModelApp.notifications.outputMessage(new core_frontend_1.NotifyMessageDetails(core_frontend_1.OutputMessagePriority.Error, msg));
|
|
204
|
-
return true;
|
|
205
|
-
}
|
|
206
|
-
// Update service settings if storage is available and we are not prompting user for credentials
|
|
207
|
-
if (!settingsStorageDisabled && !props.layerRequiringCredentials) {
|
|
208
|
-
const storeOnIModel = (hasImodelContext ? "Model" === settingsStorage : undefined);
|
|
209
|
-
if (vp.iModel.iTwinId && !(await MapLayerPreferences_1.MapLayerPreferences.storeSource(source, vp.iModel.iTwinId, vp.iModel.iModelId, storeOnIModel))) {
|
|
210
|
-
const msgError = mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:Messages.MapLayerPreferencesStoreFailed");
|
|
211
|
-
core_frontend_1.IModelApp.notifications.outputMessage(new core_frontend_1.NotifyMessageDetails(core_frontend_1.OutputMessagePriority.Error, msgError));
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
// Some sources have a single non-visible sub-layer (i.e. ArcGIS World Topo Map); to avoid having a layer with no content (and no way to change the sub-layer visibility)
|
|
215
|
-
// we force the sub-layer visibility to ON.
|
|
216
|
-
let subLayers = validation.subLayers;
|
|
217
|
-
if (validation.subLayers && validation.subLayers.length === 1 && validation.subLayers[0].visible === false) {
|
|
218
|
-
subLayers = [{ ...validation.subLayers[0], visible: true }];
|
|
219
|
-
}
|
|
220
|
-
const settings = source.toLayerSettings(subLayers);
|
|
221
|
-
if (settings) {
|
|
222
|
-
vp.displayStyle.attachMapLayer({ settings, mapLayerIndex: { index: -1, isOverlay } });
|
|
223
|
-
const msg = core_frontend_1.IModelApp.localization.getLocalizedString("mapLayers:Messages.MapLayerAttached", { sourceName: source.name, sourceUrl: source.url });
|
|
224
|
-
core_frontend_1.IModelApp.notifications.outputMessage(new core_frontend_1.NotifyMessageDetails(core_frontend_1.OutputMessagePriority.Info, msg));
|
|
225
|
-
}
|
|
226
|
-
else {
|
|
227
|
-
const msgError = mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:Messages.MapLayerLayerSettingsConversionError");
|
|
228
|
-
const msg = mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:CustomAttach.MapLayerAttachError", { error: msgError, sourceUrl: source.url });
|
|
229
|
-
core_frontend_1.IModelApp.notifications.outputMessage(new core_frontend_1.NotifyMessageDetails(core_frontend_1.OutputMessagePriority.Error, msg));
|
|
230
|
-
}
|
|
231
|
-
// This handler will close the layer source handler, and therefore the MapUrl dialog.
|
|
232
|
-
// don't call it if the dialog needs to remains open.
|
|
233
|
-
onOkResult();
|
|
234
|
-
return true;
|
|
235
|
-
}, [hasImodelContext, isOverlay, onOkResult, props?.activeViewport, props.layerRequiringCredentials, settingsStorage, settingsStorageDisabled]);
|
|
236
|
-
// Validate the layer source and attempt to attach (or update) the layer.
|
|
237
|
-
// Returns true if no further input is needed from end-user (i.e. close the dialog)
|
|
238
|
-
const attemptAttachSource = React.useCallback(async (source) => {
|
|
239
|
-
try {
|
|
240
|
-
const validation = await source.validateSource(true);
|
|
241
|
-
if (validation.status === core_frontend_1.MapLayerSourceStatus.Valid) {
|
|
242
|
-
if (layerRequiringCredentialsIdx === undefined) {
|
|
243
|
-
return await doAttach(source, validation);
|
|
244
|
-
}
|
|
245
|
-
else {
|
|
246
|
-
return await updateAttachedLayer(source, validation);
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
else if (validation.status === core_frontend_1.MapLayerSourceStatus.InvalidCoordinateSystem) {
|
|
250
|
-
const msg = mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:CustomAttach.InvalidCoordinateSystem");
|
|
251
|
-
core_frontend_1.IModelApp.notifications.outputMessage(new core_frontend_1.NotifyMessageDetails(core_frontend_1.OutputMessagePriority.Error, msg));
|
|
252
|
-
return true;
|
|
253
|
-
}
|
|
254
|
-
else {
|
|
255
|
-
const authNeeded = await updateAuthState(source, validation);
|
|
256
|
-
if (authNeeded) {
|
|
257
|
-
return false;
|
|
258
|
-
}
|
|
259
|
-
else {
|
|
260
|
-
const msg = mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:CustomAttach.ValidationError");
|
|
261
|
-
core_frontend_1.IModelApp.notifications.outputMessage(new core_frontend_1.NotifyMessageDetails(core_frontend_1.OutputMessagePriority.Error, `${msg} ${source.url}`));
|
|
262
|
-
return true;
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
catch (error) {
|
|
267
|
-
const msg = mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:Messages.MapLayerAttachError", { error, sourceUrl: source.url });
|
|
268
|
-
core_frontend_1.IModelApp.notifications.outputMessage(new core_frontend_1.NotifyMessageDetails(core_frontend_1.OutputMessagePriority.Error, msg));
|
|
269
|
-
return true;
|
|
270
|
-
}
|
|
271
|
-
}, [updateAuthState, doAttach, layerRequiringCredentialsIdx, updateAttachedLayer]);
|
|
272
156
|
const onNameChange = React.useCallback((event) => {
|
|
273
157
|
setMapName(event.target.value);
|
|
274
158
|
}, [setMapName]);
|
|
@@ -297,12 +181,11 @@ function MapUrlDialog(props) {
|
|
|
297
181
|
const handleOk = React.useCallback(() => {
|
|
298
182
|
const source = createSource();
|
|
299
183
|
if (source === undefined || props.mapLayerSourceToEdit) {
|
|
300
|
-
appui_react_1.UiFramework.dialogs.modal.close();
|
|
301
184
|
onOkResult();
|
|
302
185
|
if (source === undefined) {
|
|
303
186
|
// Close the dialog and inform end user something went wrong.
|
|
304
187
|
const msgError = mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:Messages.MapLayerLayerSourceCreationFailed");
|
|
305
|
-
const msg = mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:Messages.MapLayerAttachError", { error: msgError,
|
|
188
|
+
const msg = mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:Messages.MapLayerAttachError", { error: msgError, sourceName: mapName });
|
|
306
189
|
core_frontend_1.IModelApp.notifications.outputMessage(new core_frontend_1.NotifyMessageDetails(core_frontend_1.OutputMessagePriority.Error, msg));
|
|
307
190
|
return;
|
|
308
191
|
}
|
|
@@ -324,27 +207,47 @@ function MapUrlDialog(props) {
|
|
|
324
207
|
return;
|
|
325
208
|
}
|
|
326
209
|
}
|
|
327
|
-
setLayerAttachPending(true);
|
|
328
210
|
// Attach source asynchronously.
|
|
329
211
|
void (async () => {
|
|
330
212
|
try {
|
|
331
|
-
|
|
213
|
+
setLayerAttachPending(true);
|
|
214
|
+
const validation = await source.validateSource(true);
|
|
332
215
|
if (isMounted.current) {
|
|
333
216
|
setLayerAttachPending(false);
|
|
334
217
|
}
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
218
|
+
if (validation.status === core_frontend_1.MapLayerSourceStatus.Valid) {
|
|
219
|
+
// Update service settings if storage is available and we are not prompting user for credentials
|
|
220
|
+
if (isSettingsStorageAvailable && !props.layerRequiringCredentials) {
|
|
221
|
+
const storeOnIModel = (hasImodelContext ? "Model" === settingsStorage : undefined);
|
|
222
|
+
const vp = props.activeViewport;
|
|
223
|
+
if (vp?.iModel.iTwinId && !(await MapLayerPreferences_1.MapLayerPreferences.storeSource(source, vp.iModel.iTwinId, vp.iModel.iModelId, storeOnIModel))) {
|
|
224
|
+
const msgError = mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:Messages.MapLayerPreferencesStoreFailed");
|
|
225
|
+
core_frontend_1.IModelApp.notifications.outputMessage(new core_frontend_1.NotifyMessageDetails(core_frontend_1.OutputMessagePriority.Error, msgError));
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
onOkResult({ source, validation });
|
|
229
|
+
}
|
|
230
|
+
else if (validation.status === core_frontend_1.MapLayerSourceStatus.InvalidCoordinateSystem) {
|
|
231
|
+
const msg = mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:CustomAttach.InvalidCoordinateSystem");
|
|
232
|
+
core_frontend_1.IModelApp.notifications.outputMessage(new core_frontend_1.NotifyMessageDetails(core_frontend_1.OutputMessagePriority.Error, msg));
|
|
233
|
+
onOkResult({ source, validation });
|
|
234
|
+
}
|
|
235
|
+
else {
|
|
236
|
+
const authNeeded = await updateAuthState(source, validation);
|
|
237
|
+
if (!authNeeded) {
|
|
238
|
+
const msg = mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:CustomAttach.ValidationError");
|
|
239
|
+
core_frontend_1.IModelApp.notifications.outputMessage(new core_frontend_1.NotifyMessageDetails(core_frontend_1.OutputMessagePriority.Error, `${msg} ${source.url}`));
|
|
240
|
+
onOkResult({ source, validation });
|
|
241
|
+
}
|
|
340
242
|
}
|
|
341
243
|
}
|
|
342
|
-
catch (
|
|
244
|
+
catch (error) {
|
|
245
|
+
const msg = mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:Messages.MapLayerAttachError", { error, sourceName: source.name });
|
|
246
|
+
core_frontend_1.IModelApp.notifications.outputMessage(new core_frontend_1.NotifyMessageDetails(core_frontend_1.OutputMessagePriority.Error, msg));
|
|
343
247
|
onOkResult();
|
|
344
|
-
appui_react_1.UiFramework.dialogs.modal.close();
|
|
345
248
|
}
|
|
346
249
|
})();
|
|
347
|
-
}, [createSource, props.mapLayerSourceToEdit, props.activeViewport, onOkResult,
|
|
250
|
+
}, [createSource, mapName, props.mapLayerSourceToEdit, props.activeViewport, onOkResult, isSettingsStorageAvailable, updateAuthState, hasImodelContext, props.layerRequiringCredentials, settingsStorage]);
|
|
348
251
|
React.useEffect(() => {
|
|
349
252
|
const handleOAuthProcessEnd = (success, _state) => {
|
|
350
253
|
onOauthProcessEnd.raiseEvent(success, _state);
|
|
@@ -515,11 +418,12 @@ function MapUrlDialog(props) {
|
|
|
515
418
|
React.createElement(itwinui_react_1.LabeledInput, { className: "map-layer-source-input", displayStyle: "inline", placeholder: serverRequireCredentials ? userNameRequiredLabel : userNameLabel, status: (!userName && serverRequireCredentials) || invalidCredentialsProvided ? "warning" : undefined, disabled: layerAttachPending || layerAuthPending, onChange: onUsernameChange, value: userName, size: "small" }),
|
|
516
419
|
React.createElement("span", { className: "map-layer-source-label" }, passwordLabel),
|
|
517
420
|
React.createElement(itwinui_react_1.LabeledInput, { className: "map-layer-source-input", displayStyle: "inline", type: "password", placeholder: serverRequireCredentials ? passwordRequiredLabel : passwordLabel, status: (!password && serverRequireCredentials) || invalidCredentialsProvided ? "warning" : undefined, disabled: layerAttachPending || layerAuthPending, onChange: onPasswordChange, onKeyPress: handleOnKeyDown, value: password, size: "small" })),
|
|
518
|
-
|
|
519
|
-
|
|
421
|
+
!props.layerRequiringCredentials
|
|
422
|
+
&& !props.mapLayerSourceToEdit
|
|
423
|
+
&& React.createElement("div", { title: !isSettingsStorageAvailable ? noSaveSettingsWarning : "" }, hasImodelContext &&
|
|
520
424
|
React.createElement("div", null,
|
|
521
|
-
React.createElement(itwinui_react_1.Radio, { disabled:
|
|
522
|
-
React.createElement(itwinui_react_1.Radio, { disabled:
|
|
425
|
+
React.createElement(itwinui_react_1.Radio, { disabled: !isSettingsStorageAvailable, name: "settingsStorage", value: "iTwin", label: iTwinSettingsLabel, checked: settingsStorage === "iTwin", onChange: onRadioChange }),
|
|
426
|
+
React.createElement(itwinui_react_1.Radio, { disabled: !isSettingsStorageAvailable, name: "settingsStorage", value: "Model", label: modelSettingsLabel, checked: settingsStorage === "Model", onChange: onRadioChange }))))),
|
|
523
427
|
renderWarningMessage(),
|
|
524
428
|
(layerAttachPending || layerAuthPending) &&
|
|
525
429
|
React.createElement("div", { className: "map-layer-source-progressBar" },
|