@itwin/map-layers 4.0.0-dev.48 → 4.0.0-dev.49
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/lib/cjs/MapLayerPreferences.js +2 -1
- package/lib/cjs/MapLayerPreferences.js.map +1 -1
- package/lib/cjs/mapLayers.js +3 -2
- package/lib/cjs/mapLayers.js.map +1 -1
- package/lib/cjs/ui/FeatureInfoUiItemsProvider.js +3 -2
- package/lib/cjs/ui/FeatureInfoUiItemsProvider.js.map +1 -1
- package/lib/cjs/ui/MapLayersUiItemsProvider.js +2 -2
- package/lib/cjs/ui/MapLayersUiItemsProvider.js.map +1 -1
- package/lib/cjs/ui/widget/AttachLayerPopupButton.js +15 -12
- 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/ConfirmMessageDialog.js +7 -4
- package/lib/cjs/ui/widget/ConfirmMessageDialog.js.map +1 -1
- package/lib/cjs/ui/widget/FeatureInfoDataProvider.js +4 -3
- package/lib/cjs/ui/widget/FeatureInfoDataProvider.js.map +1 -1
- package/lib/cjs/ui/widget/FeatureInfoWidget.js +16 -10
- package/lib/cjs/ui/widget/FeatureInfoWidget.js.map +1 -1
- package/lib/cjs/ui/widget/MapLayerDroppable.js +7 -4
- package/lib/cjs/ui/widget/MapLayerDroppable.js.map +1 -1
- package/lib/cjs/ui/widget/MapLayerManager.js +19 -17
- package/lib/cjs/ui/widget/MapLayerManager.js.map +1 -1
- package/lib/cjs/ui/widget/MapLayerSettingsMenu.js +3 -2
- package/lib/cjs/ui/widget/MapLayerSettingsMenu.js.map +1 -1
- package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.js +2 -2
- package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.js.map +1 -1
- package/lib/cjs/ui/widget/MapLayersWidget.js +4 -4
- package/lib/cjs/ui/widget/MapLayersWidget.js.map +1 -1
- package/lib/cjs/ui/widget/MapUrlDialog.js +27 -24
- package/lib/cjs/ui/widget/MapUrlDialog.js.map +1 -1
- package/lib/cjs/ui/widget/SelectMapFormat.js +12 -7
- package/lib/cjs/ui/widget/SelectMapFormat.js.map +1 -1
- package/lib/cjs/ui/widget/SubLayersDataProvider.js +5 -4
- package/lib/cjs/ui/widget/SubLayersDataProvider.js.map +1 -1
- package/lib/cjs/ui/widget/SubLayersTree.js +34 -28
- package/lib/cjs/ui/widget/SubLayersTree.js.map +1 -1
- package/lib/esm/MapLayerPreferences.js +2 -1
- package/lib/esm/MapLayerPreferences.js.map +1 -1
- package/lib/esm/mapLayers.js +3 -2
- package/lib/esm/mapLayers.js.map +1 -1
- package/lib/esm/ui/FeatureInfoUiItemsProvider.js +3 -2
- package/lib/esm/ui/FeatureInfoUiItemsProvider.js.map +1 -1
- package/lib/esm/ui/MapLayersUiItemsProvider.js +2 -2
- package/lib/esm/ui/MapLayersUiItemsProvider.js.map +1 -1
- package/lib/esm/ui/widget/AttachLayerPopupButton.js +15 -12
- 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/ConfirmMessageDialog.js +7 -4
- package/lib/esm/ui/widget/ConfirmMessageDialog.js.map +1 -1
- package/lib/esm/ui/widget/FeatureInfoDataProvider.js +4 -3
- package/lib/esm/ui/widget/FeatureInfoDataProvider.js.map +1 -1
- package/lib/esm/ui/widget/FeatureInfoWidget.js +16 -10
- package/lib/esm/ui/widget/FeatureInfoWidget.js.map +1 -1
- package/lib/esm/ui/widget/MapLayerDroppable.js +7 -4
- package/lib/esm/ui/widget/MapLayerDroppable.js.map +1 -1
- package/lib/esm/ui/widget/MapLayerManager.js +19 -17
- package/lib/esm/ui/widget/MapLayerManager.js.map +1 -1
- package/lib/esm/ui/widget/MapLayerSettingsMenu.js +3 -2
- package/lib/esm/ui/widget/MapLayerSettingsMenu.js.map +1 -1
- package/lib/esm/ui/widget/MapLayerSettingsPopupButton.js +2 -2
- package/lib/esm/ui/widget/MapLayerSettingsPopupButton.js.map +1 -1
- package/lib/esm/ui/widget/MapLayersWidget.js +4 -4
- package/lib/esm/ui/widget/MapLayersWidget.js.map +1 -1
- package/lib/esm/ui/widget/MapUrlDialog.js +27 -24
- package/lib/esm/ui/widget/MapUrlDialog.js.map +1 -1
- package/lib/esm/ui/widget/SelectMapFormat.js +12 -7
- package/lib/esm/ui/widget/SelectMapFormat.js.map +1 -1
- package/lib/esm/ui/widget/SubLayersDataProvider.js +5 -4
- package/lib/esm/ui/widget/SubLayersDataProvider.js.map +1 -1
- package/lib/esm/ui/widget/SubLayersTree.js +34 -28
- package/lib/esm/ui/widget/SubLayersTree.js.map +1 -1
- package/package.json +29 -22
|
@@ -21,13 +21,14 @@ const getWindow = () => {
|
|
|
21
21
|
const useResizeObserver = (onResize) => {
|
|
22
22
|
const resizeObserver = React.useRef();
|
|
23
23
|
const elementRef = React.useCallback((element) => {
|
|
24
|
-
|
|
24
|
+
var _a, _b, _c;
|
|
25
|
+
if (!((_a = getWindow()) === null || _a === void 0 ? void 0 : _a.ResizeObserver)) {
|
|
25
26
|
return;
|
|
26
27
|
}
|
|
27
|
-
resizeObserver.current
|
|
28
|
+
(_b = resizeObserver.current) === null || _b === void 0 ? void 0 : _b.disconnect();
|
|
28
29
|
if (element) {
|
|
29
30
|
resizeObserver.current = new ResizeObserver(([{ contentRect }]) => onResize(contentRect));
|
|
30
|
-
resizeObserver.current
|
|
31
|
+
(_c = resizeObserver.current) === null || _c === void 0 ? void 0 : _c.observe(element);
|
|
31
32
|
}
|
|
32
33
|
}, [onResize]);
|
|
33
34
|
return [elementRef, resizeObserver.current];
|
|
@@ -85,6 +86,7 @@ function getStyleMapLayerSettings(settings, isOverlay, layerIndex, treeVisibilit
|
|
|
85
86
|
*/
|
|
86
87
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
87
88
|
function SubLayersTree(props) {
|
|
89
|
+
var _a;
|
|
88
90
|
const [placeholderLabel] = React.useState(mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:SubLayers.SearchPlaceholder"));
|
|
89
91
|
const [allOnLabel] = React.useState(mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:SubLayers.AllOn"));
|
|
90
92
|
const [allOffLabel] = React.useState(mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:SubLayers.AllOff"));
|
|
@@ -104,7 +106,7 @@ function SubLayersTree(props) {
|
|
|
104
106
|
const treeModel = (0, components_react_1.useTreeModel)(modelSource);
|
|
105
107
|
const showAll = React.useCallback(async () => {
|
|
106
108
|
const vp = core_frontend_1.IModelApp.viewManager.selectedView;
|
|
107
|
-
const displayStyle = vp
|
|
109
|
+
const displayStyle = vp === null || vp === void 0 ? void 0 : vp.displayStyle;
|
|
108
110
|
if (displayStyle && vp) {
|
|
109
111
|
const indexInDisplayStyle = displayStyle ? displayStyle.findMapLayerIndexByNameAndSource(mapLayer.name, mapLayer.source, mapLayer.isOverlay) : -1;
|
|
110
112
|
displayStyle.changeMapSubLayerProps({ visible: true }, -1, indexInDisplayStyle, mapLayer.isOverlay);
|
|
@@ -120,7 +122,7 @@ function SubLayersTree(props) {
|
|
|
120
122
|
}, [mapLayer]);
|
|
121
123
|
const hideAll = React.useCallback(async () => {
|
|
122
124
|
const vp = core_frontend_1.IModelApp.viewManager.selectedView;
|
|
123
|
-
const displayStyle = vp
|
|
125
|
+
const displayStyle = vp === null || vp === void 0 ? void 0 : vp.displayStyle;
|
|
124
126
|
if (displayStyle && vp) {
|
|
125
127
|
const indexInDisplayStyle = displayStyle ? displayStyle.findMapLayerIndexByNameAndSource(mapLayer.name, mapLayer.source, mapLayer.isOverlay) : -1;
|
|
126
128
|
displayStyle.changeMapSubLayerProps({ visible: false }, -1, indexInDisplayStyle, mapLayer.isOverlay);
|
|
@@ -138,7 +140,7 @@ function SubLayersTree(props) {
|
|
|
138
140
|
const { width, height, ref: containerRef } = useResizeDetector();
|
|
139
141
|
return React.createElement(React.Fragment, null,
|
|
140
142
|
React.createElement("div", { className: "map-manager-sublayer-tree" },
|
|
141
|
-
React.createElement(Toolbar, { searchField: React.createElement(itwinui_react_1.Input, { type: "text", className: "map-manager-source-list-filter", placeholder: placeholderLabel, value: layerFilterString, onChange: handleFilterTextChanged, size: "small" }) }, mapLayer.provider
|
|
143
|
+
React.createElement(Toolbar, { searchField: React.createElement(itwinui_react_1.Input, { type: "text", className: "map-manager-source-list-filter", placeholder: placeholderLabel, value: layerFilterString, onChange: handleFilterTextChanged, size: "small" }) }, ((_a = mapLayer.provider) === null || _a === void 0 ? void 0 : _a.mutualExclusiveSubLayer) ? undefined : [
|
|
142
144
|
React.createElement(itwinui_react_1.Button, { size: "small", styleType: "borderless", key: "show-all-btn", title: allOnLabel, onClick: showAll },
|
|
143
145
|
React.createElement(core_react_1.WebFontIcon, { iconName: "icon-visibility" })),
|
|
144
146
|
React.createElement(itwinui_react_1.Button, { size: "small", styleType: "borderless", key: "hide-all-btn", title: allOffLabel, onClick: hideAll },
|
|
@@ -195,10 +197,10 @@ class SubLayerCheckboxHandler extends components_react_1.TreeEventHandler {
|
|
|
195
197
|
}
|
|
196
198
|
applyMutualExclusiveState(model, nodeId) {
|
|
197
199
|
const changedNode = model.getNode(nodeId);
|
|
198
|
-
if (changedNode
|
|
200
|
+
if ((changedNode === null || changedNode === void 0 ? void 0 : changedNode.checkbox.state) === core_react_1.CheckBoxState.Off)
|
|
199
201
|
return;
|
|
200
202
|
for (const node of model.iterateTreeModelNodes()) {
|
|
201
|
-
if (node.id === changedNode
|
|
203
|
+
if (node.id === (changedNode === null || changedNode === void 0 ? void 0 : changedNode.id))
|
|
202
204
|
continue;
|
|
203
205
|
if (node && node.checkbox.state === core_react_1.CheckBoxState.On)
|
|
204
206
|
node.checkbox.state = core_react_1.CheckBoxState.Off;
|
|
@@ -211,6 +213,7 @@ class SubLayerCheckboxHandler extends components_react_1.TreeEventHandler {
|
|
|
211
213
|
}
|
|
212
214
|
// Ensure the state of changed node matches the state of its parent.
|
|
213
215
|
syncNodeStateWithParent(model, changedNode) {
|
|
216
|
+
var _a, _b, _c, _d, _e, _f;
|
|
214
217
|
// Lookup node parent. If non exists, I assume thats the root node,
|
|
215
218
|
// and it must have a proper initial state.
|
|
216
219
|
const parentNode = changedNode.parentId ? model.getNode(changedNode.parentId) : undefined;
|
|
@@ -218,8 +221,8 @@ class SubLayerCheckboxHandler extends components_react_1.TreeEventHandler {
|
|
|
218
221
|
return;
|
|
219
222
|
if (!changedNode.checkbox)
|
|
220
223
|
return; // don't see why this would happen, but if there is no checkbox, we cant do much here.
|
|
221
|
-
const parentLayerId = undefined !== parentNode.item.extendedData
|
|
222
|
-
const parentSubLayer = this._mapLayer.subLayers
|
|
224
|
+
const parentLayerId = undefined !== ((_a = parentNode.item.extendedData) === null || _a === void 0 ? void 0 : _a.subLayerId) ? (_b = parentNode.item.extendedData) === null || _b === void 0 ? void 0 : _b.subLayerId : parentNode.item.id;
|
|
225
|
+
const parentSubLayer = (_c = this._mapLayer.subLayers) === null || _c === void 0 ? void 0 : _c.find((subLayer) => subLayer.id === parentLayerId);
|
|
223
226
|
// If parent is disabled, then children must be too.
|
|
224
227
|
// Also, Non-visible unnamed group must have their children disabled (unamed groups have visibility inherence)
|
|
225
228
|
if (parentNode.checkbox.isDisabled || (SubLayerCheckboxHandler.isUnnamedGroup(parentSubLayer) && parentNode.checkbox.state === core_react_1.CheckBoxState.Off)) {
|
|
@@ -228,10 +231,10 @@ class SubLayerCheckboxHandler extends components_react_1.TreeEventHandler {
|
|
|
228
231
|
}
|
|
229
232
|
else {
|
|
230
233
|
// Visibility state from StyleMapLayerSettings applies
|
|
231
|
-
const subLayerId = undefined !== changedNode.item.extendedData
|
|
232
|
-
const foundSubLayer = this._mapLayer.subLayers
|
|
234
|
+
const subLayerId = undefined !== ((_d = changedNode.item.extendedData) === null || _d === void 0 ? void 0 : _d.subLayerId) ? (_e = changedNode.item.extendedData) === null || _e === void 0 ? void 0 : _e.subLayerId : changedNode.item.id;
|
|
235
|
+
const foundSubLayer = (_f = this._mapLayer.subLayers) === null || _f === void 0 ? void 0 : _f.find((subLayer) => subLayer.id === subLayerId);
|
|
233
236
|
changedNode.checkbox.isDisabled = false;
|
|
234
|
-
changedNode.checkbox.state = foundSubLayer
|
|
237
|
+
changedNode.checkbox.state = (foundSubLayer === null || foundSubLayer === void 0 ? void 0 : foundSubLayer.visible) ? core_react_1.CheckBoxState.On : core_react_1.CheckBoxState.Off;
|
|
235
238
|
}
|
|
236
239
|
}
|
|
237
240
|
/** Changes nodes checkboxes states until event is handled or handler is disposed */
|
|
@@ -242,21 +245,22 @@ class SubLayerCheckboxHandler extends components_react_1.TreeEventHandler {
|
|
|
242
245
|
const selectionHandling = stateChanges.subscribe({
|
|
243
246
|
next: (changes) => {
|
|
244
247
|
const vp = core_frontend_1.IModelApp.viewManager.selectedView;
|
|
245
|
-
const displayStyle = vp
|
|
248
|
+
const displayStyle = vp === null || vp === void 0 ? void 0 : vp.displayStyle;
|
|
246
249
|
const indexInDisplayStyle = displayStyle ? displayStyle.findMapLayerIndexByNameAndSource(this._mapLayer.name, this._mapLayer.source, this._mapLayer.isOverlay) : -1;
|
|
247
250
|
changes.forEach((change) => {
|
|
251
|
+
var _a, _b, _c, _d, _e;
|
|
248
252
|
const isSelected = (change.newState === core_react_1.CheckBoxState.On);
|
|
249
|
-
const subLayerId = undefined !== change.nodeItem.extendedData
|
|
253
|
+
const subLayerId = undefined !== ((_a = change.nodeItem.extendedData) === null || _a === void 0 ? void 0 : _a.subLayerId) ? (_b = change.nodeItem.extendedData) === null || _b === void 0 ? void 0 : _b.subLayerId : change.nodeItem.id;
|
|
250
254
|
// Get the previously visible node if any
|
|
251
255
|
let prevVisibleLayer;
|
|
252
|
-
if (this._mapLayer.provider
|
|
253
|
-
prevVisibleLayer = this._mapLayer.subLayers
|
|
256
|
+
if ((_c = this._mapLayer.provider) === null || _c === void 0 ? void 0 : _c.mutualExclusiveSubLayer) {
|
|
257
|
+
prevVisibleLayer = (_d = this._mapLayer.subLayers) === null || _d === void 0 ? void 0 : _d.find((subLayer) => subLayer.visible && subLayer.id !== subLayerId);
|
|
254
258
|
}
|
|
255
259
|
// Update sublayer object, otherwise state would get out of sync with DisplayStyle each time the TreeView is re-rendered
|
|
256
|
-
const foundSubLayer = this._mapLayer.subLayers
|
|
260
|
+
const foundSubLayer = (_e = this._mapLayer.subLayers) === null || _e === void 0 ? void 0 : _e.find((subLayer) => subLayer.id === subLayerId);
|
|
257
261
|
if (foundSubLayer)
|
|
258
262
|
foundSubLayer.visible = isSelected;
|
|
259
|
-
if (prevVisibleLayer
|
|
263
|
+
if (prevVisibleLayer === null || prevVisibleLayer === void 0 ? void 0 : prevVisibleLayer.visible)
|
|
260
264
|
prevVisibleLayer.visible = false;
|
|
261
265
|
// Update displaystyle state
|
|
262
266
|
if (-1 !== indexInDisplayStyle && displayStyle) {
|
|
@@ -266,7 +270,8 @@ class SubLayerCheckboxHandler extends components_react_1.TreeEventHandler {
|
|
|
266
270
|
}
|
|
267
271
|
// Cascade state
|
|
268
272
|
this.modelSource.modifyModel((model) => {
|
|
269
|
-
|
|
273
|
+
var _a;
|
|
274
|
+
if ((_a = this._mapLayer.provider) === null || _a === void 0 ? void 0 : _a.mutualExclusiveSubLayer)
|
|
270
275
|
this.applyMutualExclusiveState(model, change.nodeItem.id);
|
|
271
276
|
this.cascadeStateToAllChildren(model, change.nodeItem.id);
|
|
272
277
|
});
|
|
@@ -276,7 +281,7 @@ class SubLayerCheckboxHandler extends components_react_1.TreeEventHandler {
|
|
|
276
281
|
},
|
|
277
282
|
});
|
|
278
283
|
// stop handling selection when checkboxes handling is stopped
|
|
279
|
-
baseHandling
|
|
284
|
+
baseHandling === null || baseHandling === void 0 ? void 0 : baseHandling.add(selectionHandling);
|
|
280
285
|
return baseHandling;
|
|
281
286
|
}
|
|
282
287
|
}
|
|
@@ -329,7 +334,7 @@ class FullTreeHierarchy {
|
|
|
329
334
|
}
|
|
330
335
|
async initNode(parent) {
|
|
331
336
|
const nodes = await this._dataProvider.getNodes(parent);
|
|
332
|
-
this._hierarchy.set(parent
|
|
337
|
+
this._hierarchy.set(parent === null || parent === void 0 ? void 0 : parent.id, nodes);
|
|
333
338
|
for (const node of nodes) {
|
|
334
339
|
await this.initNode(node);
|
|
335
340
|
}
|
|
@@ -359,7 +364,7 @@ class FilteredTreeHierarchy {
|
|
|
359
364
|
/** Initializes `this._filtered` field. Returns a node if it matches a filter. */
|
|
360
365
|
filterNodes(hierarchy, current) {
|
|
361
366
|
const matches = current ? this.matchesFilter(current) : false;
|
|
362
|
-
const children = hierarchy.get(current
|
|
367
|
+
const children = hierarchy.get(current === null || current === void 0 ? void 0 : current.id);
|
|
363
368
|
if (!children)
|
|
364
369
|
return matches ? current : undefined;
|
|
365
370
|
const matchedChildren = new Array();
|
|
@@ -371,7 +376,7 @@ class FilteredTreeHierarchy {
|
|
|
371
376
|
const included = matches || hasChildren;
|
|
372
377
|
let filtered;
|
|
373
378
|
if (included) {
|
|
374
|
-
this._filtered.set(current
|
|
379
|
+
this._filtered.set(current === null || current === void 0 ? void 0 : current.id, matchedChildren);
|
|
375
380
|
// Return a modified copy of current node (to persist initial hierarchy when filter is cleared).
|
|
376
381
|
if (current) {
|
|
377
382
|
filtered = {
|
|
@@ -384,9 +389,10 @@ class FilteredTreeHierarchy {
|
|
|
384
389
|
return filtered;
|
|
385
390
|
}
|
|
386
391
|
matchesFilter(node) {
|
|
392
|
+
var _a;
|
|
387
393
|
if (node.label.value.valueFormat !== appui_abstract_1.PropertyValueFormat.Primitive)
|
|
388
394
|
return false;
|
|
389
|
-
const value = node.label.value.displayValue
|
|
395
|
+
const value = (_a = node.label.value.displayValue) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
390
396
|
if (!value)
|
|
391
397
|
return false;
|
|
392
398
|
return value.includes(this._filter.toLowerCase());
|
|
@@ -402,13 +408,13 @@ class FilteredTreeDataProvider {
|
|
|
402
408
|
}
|
|
403
409
|
async getNodes(parent) {
|
|
404
410
|
const hierarchy = await this._hierarchy.getHierarchy();
|
|
405
|
-
const nodes = hierarchy.get(parent
|
|
411
|
+
const nodes = hierarchy.get(parent === null || parent === void 0 ? void 0 : parent.id);
|
|
406
412
|
return nodes || [];
|
|
407
413
|
}
|
|
408
414
|
async getNodesCount(parent) {
|
|
409
415
|
const hierarchy = await this._hierarchy.getHierarchy();
|
|
410
|
-
const nodes = hierarchy.get(parent
|
|
411
|
-
return nodes
|
|
416
|
+
const nodes = hierarchy.get(parent === null || parent === void 0 ? void 0 : parent.id);
|
|
417
|
+
return (nodes === null || nodes === void 0 ? void 0 : nodes.length) || 0;
|
|
412
418
|
}
|
|
413
419
|
}
|
|
414
420
|
//# sourceMappingURL=SubLayersTree.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubLayersTree.js","sourceRoot":"","sources":["../../../../src/ui/widget/SubLayersTree.tsx"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,0DAA4D;AAC5D,8DAMiC;AACjC,oDAAkG;AAClG,wDAAkG;AAClG,kDAAsH;AACtH,wDAAqD;AACrD,+BAA+B;AAE/B,mEAAgE;AAChE,gCAA8B;AAC9B,+CAA8C;AAE9C,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,OAAO,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC;AAC5D,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAG,CACxB,QAAyC,EACzC,EAAE;IACF,MAAM,cAAc,GAAG,KAAK,CAAC,MAAM,EAAkB,CAAC;IAEtD,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,CAClC,CAAC,OAAiB,EAAE,EAAE;QACpB,IAAI,CAAC,SAAS,EAAE,EAAE,cAAc,EA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CAAC,QAAQ,CAAC,MAAqB;QACzC,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC;QACvD,MAAM,KAAK,GAAG,SAAS,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QACxC,OAAO,KAAK,IAAI,EAAE,CAAC;IACrB,CAAC;IAEM,KAAK,CAAC,aAAa,CAAC,MAAqB;QAC9C,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC;QACvD,MAAM,KAAK,GAAG,SAAS,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QACxC,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC,CAAC;IAC5B,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport {\n AbstractTreeNodeLoaderWithProvider, ControlledTree, DelayLoadedTreeNodeItem, HighlightableTreeProps, ITreeDataProvider,\n MutableTreeModel,\n MutableTreeModelNode,\n SelectionMode, TreeCheckboxStateChangeEventArgs, TreeDataProvider, TreeEventHandler, TreeImageLoader, TreeModel, TreeModelChanges, TreeModelSource, TreeNodeItem, TreeNodeLoader,\n TreeNodeRenderer, TreeNodeRendererProps, TreeRenderer, TreeRendererProps, useTreeModel,\n} from \"@itwin/components-react\";\nimport { ImageMapLayerSettings, MapSubLayerProps, MapSubLayerSettings } from \"@itwin/core-common\";\nimport { IModelApp, MapTileTreeScaleRangeVisibility, ScreenViewport } from \"@itwin/core-frontend\";\nimport { CheckBoxState, ImageCheckBox, NodeCheckboxRenderProps, useDisposable, WebFontIcon } from \"@itwin/core-react\";\nimport { Button, Input } from \"@itwin/itwinui-react\";\nimport * as React from \"react\";\nimport { StyleMapLayerSettings } from \"../Interfaces\";\nimport { SubLayersDataProvider } from \"./SubLayersDataProvider\";\nimport \"./SubLayersTree.scss\";\nimport { MapLayersUI } from \"../../mapLayers\";\n\nconst getWindow = () => {\n return typeof window === \"undefined\" ? undefined : window;\n};\n\nconst useResizeObserver = <T extends HTMLElement>(\n onResize: (size: DOMRectReadOnly) => void,\n) => {\n const resizeObserver = React.useRef<ResizeObserver>();\n\n const elementRef = React.useCallback(\n (element: T | null) => {\n if (!getWindow()?.ResizeObserver) {\n return;\n }\n\n resizeObserver.current?.disconnect();\n if (element) {\n resizeObserver.current = new ResizeObserver(([{ contentRect }]) =>\n onResize(contentRect),\n );\n resizeObserver.current?.observe(element);\n }\n },\n [onResize],\n );\n\n return [elementRef, resizeObserver.current] as const;\n};\n\n/**\n Mimic processing of `react-resize-detector` to return width and height.\n* @internal\n */\nfunction useResizeDetector(): { width: number | undefined, height: number | undefined, ref: React.Ref<HTMLDivElement> } {\n const [width, setWidth] = React.useState<number>();\n const [height, setHeight] = React.useState<number>();\n const [ref] = useResizeObserver(React.useCallback((size: DOMRectReadOnly) => {\n setWidth(size.width);\n setHeight(size.height);\n }, []));\n return { width, height, ref };\n}\n\ninterface ToolbarProps {\n searchField?: React.ReactNode;\n children?: React.ReactNode[];\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction Toolbar(props: ToolbarProps) {\n return (\n <div className=\"map-manager-sublayer-tree-toolbar\">\n <div className=\"tree-toolbar-action-buttons\">\n {props.children}\n </div>\n {props.searchField && <div className=\"tree-toolbar-searchbox\">\n {props.searchField}\n </div>}\n </div>\n );\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function SubLayersPanel({ mapLayer, viewport }: { mapLayer: StyleMapLayerSettings, viewport: ScreenViewport | undefined }) {\n const [noneAvailableLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:SubLayers.NoSubLayers\"));\n if (!viewport || (undefined === mapLayer.subLayers || 0 === mapLayer.subLayers.length)) {\n return <div className=\"map-manager-sublayer-panel\">\n <div>{noneAvailableLabel}</div>\n </div>;\n }\n\n return (\n <SubLayersTree mapLayer={mapLayer} />\n );\n}\n\nfunction getSubLayerProps(subLayerSettings: MapSubLayerSettings[]): MapSubLayerProps[] {\n return subLayerSettings.map((subLayer) => subLayer.toJSON());\n}\n\nfunction getStyleMapLayerSettings(settings: ImageMapLayerSettings, isOverlay: boolean, layerIndex: number, treeVisibility: MapTileTreeScaleRangeVisibility): StyleMapLayerSettings {\n return {\n visible: settings.visible,\n name: settings.name,\n source: settings.source,\n transparency: settings.transparency,\n transparentBackground: settings.transparentBackground,\n subLayers: settings.subLayers ? getSubLayerProps(settings.subLayers) : undefined,\n showSubLayers: true,\n isOverlay,\n layerIndex,\n provider: IModelApp.mapLayerFormatRegistry.createImageryProvider(settings),\n treeVisibility,\n };\n}\n\n/**\n * Tree Control that displays sub-layer hierarchy\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function SubLayersTree(props: { mapLayer: StyleMapLayerSettings }) {\n const [placeholderLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:SubLayers.SearchPlaceholder\"));\n const [allOnLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:SubLayers.AllOn\"));\n const [allOffLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:SubLayers.AllOff\"));\n const [mapLayer, setMapLayer] = React.useState(props.mapLayer);\n const [layerFilterString, setLayerFilterString] = React.useState<string>(\"\");\n\n // create data provider to get some nodes to show in tree\n // `React.useMemo' is used avoid creating new object on each render cycle\n const dataProvider = React.useMemo(() => new SubLayersDataProvider(mapLayer), [mapLayer]);\n\n const {\n modelSource,\n nodeLoader,\n nodeHighlightingProps,\n } = useTreeFiltering(dataProvider, layerFilterString);\n\n // create custom event handler. It handles all tree event same as `TreeEventHandler` but additionally\n // it selects/deselects node when checkbox is checked/unchecked and vice versa.\n // `useDisposable` takes care of disposing old event handler when new is created in case 'nodeLoader' has changed\n // `React.useCallback` is used to avoid creating new callback that creates handler on each render\n const eventHandler = useDisposable(React.useCallback(() => new SubLayerCheckboxHandler(mapLayer, nodeLoader), [nodeLoader, mapLayer]));\n\n // Get an immutable tree model from the model source. The model is regenerated every time the model source\n // emits the `onModelChanged` event.\n const treeModel = useTreeModel(modelSource);\n\n const showAll = React.useCallback(async () => {\n const vp = IModelApp.viewManager.selectedView;\n const displayStyle = vp?.displayStyle;\n if (displayStyle && vp) {\n const indexInDisplayStyle = displayStyle ? displayStyle.findMapLayerIndexByNameAndSource(mapLayer.name, mapLayer.source, mapLayer.isOverlay) : -1;\n displayStyle.changeMapSubLayerProps({ visible: true }, -1, indexInDisplayStyle, mapLayer.isOverlay);\n vp.invalidateRenderPlan();\n const updatedMapLayer = displayStyle.mapLayerAtIndex(indexInDisplayStyle, mapLayer.isOverlay);\n if (updatedMapLayer) {\n if (updatedMapLayer instanceof ImageMapLayerSettings) {\n const treeVisibility = vp.getMapLayerScaleRangeVisibility(indexInDisplayStyle, mapLayer.isOverlay);\n setMapLayer(getStyleMapLayerSettings(updatedMapLayer, mapLayer.isOverlay, indexInDisplayStyle, treeVisibility));\n }\n\n }\n }\n }, [mapLayer]);\n\n const hideAll = React.useCallback(async () => {\n const vp = IModelApp.viewManager.selectedView;\n const displayStyle = vp?.displayStyle;\n if (displayStyle && vp) {\n const indexInDisplayStyle = displayStyle ? displayStyle.findMapLayerIndexByNameAndSource(mapLayer.name, mapLayer.source, mapLayer.isOverlay) : -1;\n displayStyle.changeMapSubLayerProps({ visible: false }, -1, indexInDisplayStyle, mapLayer.isOverlay);\n const updatedMapLayer = displayStyle.mapLayerAtIndex(indexInDisplayStyle, mapLayer.isOverlay);\n if (updatedMapLayer && updatedMapLayer instanceof ImageMapLayerSettings) {\n const treeVisibility = vp.getMapLayerScaleRangeVisibility(indexInDisplayStyle, mapLayer.isOverlay);\n setMapLayer(getStyleMapLayerSettings(updatedMapLayer, mapLayer.isOverlay, indexInDisplayStyle, treeVisibility));\n }\n vp.invalidateRenderPlan();\n }\n }, [mapLayer]);\n\n const handleFilterTextChanged = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\n setLayerFilterString(event.target.value);\n }, []);\n\n const { width, height, ref: containerRef } = useResizeDetector();\n\n return <>\n <div className=\"map-manager-sublayer-tree\">\n <Toolbar\n searchField={\n <Input type=\"text\" className=\"map-manager-source-list-filter\"\n placeholder={placeholderLabel}\n value={layerFilterString}\n onChange={handleFilterTextChanged}\n size=\"small\" />\n }\n >\n {mapLayer.provider?.mutualExclusiveSubLayer ? undefined : [\n <Button size=\"small\" styleType=\"borderless\" key=\"show-all-btn\" title={allOnLabel} onClick={showAll}>\n <WebFontIcon iconName=\"icon-visibility\" />\n </Button>,\n <Button size=\"small\" styleType=\"borderless\" key=\"hide-all-btn\" title={allOffLabel} onClick={hideAll}>\n <WebFontIcon iconName=\"icon-visibility-hide-2\" />\n </Button>,\n ]}\n </Toolbar>\n <div ref={containerRef} className=\"map-manager-sublayer-tree-content\">\n {width !== undefined && height !== undefined && <ControlledTree\n nodeLoader={nodeLoader}\n selectionMode={SelectionMode.None}\n eventsHandler={eventHandler}\n model={treeModel}\n treeRenderer={nodeWithEyeCheckboxTreeRenderer}\n nodeHighlightingProps={nodeHighlightingProps}\n width={width}\n height={height}\n />}\n </div>\n </div>\n </>;\n}\n\n/** TreeEventHandler derived class that handler processing changes to subLayer visibility */\nclass SubLayerCheckboxHandler extends TreeEventHandler {\n private _removeModelChangedListener: () => void;\n\n constructor(private _mapLayer: StyleMapLayerSettings, nodeLoader: AbstractTreeNodeLoaderWithProvider<TreeDataProvider>) {\n super({ modelSource: nodeLoader.modelSource, nodeLoader, collapsedChildrenDisposalEnabled: true });\n this._removeModelChangedListener = this.modelSource.onModelChanged.addListener(this.onModelChanged);\n }\n\n public override dispose() {\n this._removeModelChangedListener();\n super.dispose();\n }\n\n // Cascade state\n // Children on unnamed groups must get disabled in the tree view, because\n // they get rendered anyway.\n private cascadeStateToAllChildren(model: MutableTreeModel, parentId?: string) {\n const children = model.getChildren(parentId);\n if (children === undefined)\n return;\n\n for (const childID of children) {\n const childNode = childID ? model.getNode(childID) : undefined;\n\n if (childNode)\n this.syncNodeStateWithParent(model, childNode);\n\n // Drill down the tree.\n this.cascadeStateToAllChildren(model, childID);\n }\n }\n\n private applyMutualExclusiveState(model: MutableTreeModel, nodeId: string) {\n const changedNode = model.getNode(nodeId);\n if (changedNode?.checkbox.state === CheckBoxState.Off)\n return;\n\n for (const node of model.iterateTreeModelNodes()) {\n if (node.id === changedNode?.id)\n continue;\n\n if (node && node.checkbox.state === CheckBoxState.On)\n node.checkbox.state = CheckBoxState.Off;\n }\n }\n\n //-----------------------------------------------------------------------\n // Listen to model changes\n //------------------------------------------------------------------------\n // This is required because nodes are delay loaded in the model until\n // they are made visible (i.e. parent node is expanded). So even though\n // you might have created nodes in the data provided with a proper\n // initial state, by the time it gets loaded, their state might have became\n // out of date in the TreeView's active model. So whenever a node\n // is added, when must confirm its state matches the current model\n // (i.e. state of their parent.)\n public onModelChanged = (args: [TreeModel, TreeModelChanges]) => {\n this.modelSource.modifyModel((model) => {\n const addedNodes = args[1].addedNodeIds.map((id) => model.getNode(id));\n addedNodes.forEach((node) => {\n if (!node)\n return;\n\n this.syncNodeStateWithParent(model, node);\n });\n });\n };\n\n private static isUnnamedGroup(subLayer: MapSubLayerProps | undefined): boolean {\n if (!subLayer)\n return false;\n\n return (!subLayer.name || subLayer.name.length === 0) && (subLayer.children !== undefined && subLayer.children.length > 0);\n }\n\n // Ensure the state of changed node matches the state of its parent.\n private syncNodeStateWithParent(model: MutableTreeModel, changedNode: MutableTreeModelNode) {\n // Lookup node parent. If non exists, I assume thats the root node,\n // and it must have a proper initial state.\n const parentNode = changedNode.parentId ? model.getNode(changedNode.parentId) : undefined;\n if (!parentNode)\n return;\n\n if (!changedNode.checkbox)\n return; // don't see why this would happen, but if there is no checkbox, we cant do much here.\n\n const parentLayerId = undefined !== parentNode.item.extendedData?.subLayerId ? parentNode.item.extendedData?.subLayerId : parentNode.item.id;\n const parentSubLayer = this._mapLayer.subLayers?.find((subLayer) => subLayer.id === parentLayerId);\n\n // If parent is disabled, then children must be too.\n // Also, Non-visible unnamed group must have their children disabled (unamed groups have visibility inherence)\n if (parentNode.checkbox.isDisabled || (SubLayerCheckboxHandler.isUnnamedGroup(parentSubLayer) && parentNode.checkbox.state === CheckBoxState.Off)) {\n changedNode.checkbox.isDisabled = true;\n changedNode.checkbox.state = CheckBoxState.Off;\n } else {\n // Visibility state from StyleMapLayerSettings applies\n const subLayerId = undefined !== changedNode.item.extendedData?.subLayerId ? changedNode.item.extendedData?.subLayerId : changedNode.item.id;\n const foundSubLayer = this._mapLayer.subLayers?.find((subLayer) => subLayer.id === subLayerId);\n changedNode.checkbox.isDisabled = false;\n changedNode.checkbox.state = foundSubLayer?.visible ? CheckBoxState.On : CheckBoxState.Off;\n }\n }\n\n /** Changes nodes checkboxes states until event is handled or handler is disposed */\n public override onCheckboxStateChanged({ stateChanges }: TreeCheckboxStateChangeEventArgs) {\n // call base checkbox handling\n const baseHandling = super.onCheckboxStateChanged({ stateChanges });\n\n // subscribe to checkbox state changes to new checkbox states and do some additional work with them\n const selectionHandling = stateChanges.subscribe({\n next: (changes) => {\n const vp = IModelApp.viewManager.selectedView;\n const displayStyle = vp?.displayStyle;\n const indexInDisplayStyle = displayStyle ? displayStyle.findMapLayerIndexByNameAndSource(this._mapLayer.name, this._mapLayer.source, this._mapLayer.isOverlay) : -1;\n changes.forEach((change) => {\n const isSelected = (change.newState === CheckBoxState.On);\n\n const subLayerId = undefined !== change.nodeItem.extendedData?.subLayerId ? change.nodeItem.extendedData?.subLayerId : change.nodeItem.id;\n\n // Get the previously visible node if any\n let prevVisibleLayer: MapSubLayerProps | undefined;\n if (this._mapLayer.provider?.mutualExclusiveSubLayer) {\n prevVisibleLayer = this._mapLayer.subLayers?.find((subLayer) => subLayer.visible && subLayer.id !== subLayerId);\n }\n\n // Update sublayer object, otherwise state would get out of sync with DisplayStyle each time the TreeView is re-rendered\n const foundSubLayer = this._mapLayer.subLayers?.find((subLayer) => subLayer.id === subLayerId);\n if (foundSubLayer)\n foundSubLayer.visible = isSelected;\n if (prevVisibleLayer?.visible)\n prevVisibleLayer.visible = false;\n\n // Update displaystyle state\n if (-1 !== indexInDisplayStyle && displayStyle) {\n if (prevVisibleLayer && prevVisibleLayer.id !== undefined)\n displayStyle.changeMapSubLayerProps({ visible: false }, prevVisibleLayer.id, indexInDisplayStyle, this._mapLayer.isOverlay);\n displayStyle.changeMapSubLayerProps({ visible: isSelected }, subLayerId, indexInDisplayStyle, this._mapLayer.isOverlay);\n }\n\n // Cascade state\n this.modelSource.modifyModel((model) => {\n if (this._mapLayer.provider?.mutualExclusiveSubLayer)\n this.applyMutualExclusiveState(model, change.nodeItem.id);\n this.cascadeStateToAllChildren(model, change.nodeItem.id);\n });\n });\n\n if (vp)\n vp.invalidateRenderPlan();\n },\n });\n // stop handling selection when checkboxes handling is stopped\n baseHandling?.add(selectionHandling);\n return baseHandling;\n }\n}\n\n/** Custom checkbox renderer that renders checkbox as an eye */\nconst eyeCheckboxRenderer = (props: NodeCheckboxRenderProps) => (\n <ImageCheckBox\n checked={props.checked}\n disabled={props.disabled}\n imageOn=\"icon-visibility\"\n imageOff=\"icon-visibility-hide-2\"\n onClick={props.onChange}\n tooltip={props.title}\n />\n);\n\n/** Custom node renderer. It uses default 'TreeNodeRenderer' but overrides default checkbox renderer to render checkbox as an eye */\nconst imageLoader = new TreeImageLoader();\nconst nodeWithEyeCheckboxRenderer = (props: TreeNodeRendererProps) => (\n <TreeNodeRenderer\n {...props}\n checkboxRenderer={eyeCheckboxRenderer}\n imageLoader={imageLoader}\n />\n);\n\n/** Custom tree renderer. It uses default `TreeRenderer` but overrides default node renderer to render node with custom checkbox */\nconst nodeWithEyeCheckboxTreeRenderer = (props: TreeRendererProps) => (\n <TreeRenderer\n {...props}\n nodeRenderer={nodeWithEyeCheckboxRenderer}\n />\n);\n\nfunction useTreeFiltering(\n dataProvider: ITreeDataProvider,\n filter: string,\n) {\n const nodeLoader = useFilteredProvider(dataProvider, filter);\n const nodeHighlightingProps = useNodeHighlightingProps(filter);\n return {\n nodeLoader,\n modelSource: nodeLoader.modelSource,\n nodeHighlightingProps,\n };\n}\n\nfunction useFilteredProvider(\n dataProvider: ITreeDataProvider,\n filter: string,\n) {\n const filteredProvider = React.useMemo(() => {\n return new FilteredTreeDataProvider(dataProvider, filter);\n }, [dataProvider, filter]);\n\n const nodeLoader = React.useMemo(() => {\n return new TreeNodeLoader(filteredProvider, new TreeModelSource());\n }, [filteredProvider]);\n\n return nodeLoader;\n}\n\nfunction useNodeHighlightingProps(\n filter: string,\n) {\n const [nodeHighlightingProps, setNodeHighlightingProps] = React.useState<HighlightableTreeProps>();\n\n React.useEffect(() => {\n if (filter === \"\") {\n setNodeHighlightingProps(undefined);\n return;\n }\n setNodeHighlightingProps({\n searchText: filter,\n activeMatch: undefined,\n });\n }, [filter]);\n\n return nodeHighlightingProps;\n}\n\nclass FullTreeHierarchy {\n private _dataProvider: ITreeDataProvider;\n private _hierarchy = new Map<string | undefined, DelayLoadedTreeNodeItem[]>();\n private _init: Promise<void>;\n\n public constructor(dataProvider: ITreeDataProvider) {\n this._dataProvider = dataProvider;\n\n this._init = (async () => {\n await this.initNode();\n })();\n }\n\n private async initNode(parent?: TreeNodeItem) {\n const nodes = await this._dataProvider.getNodes(parent);\n this._hierarchy.set(parent?.id, nodes);\n for (const node of nodes) {\n await this.initNode(node);\n }\n }\n\n public async getHierarchy() {\n await this._init;\n return this._hierarchy;\n }\n}\n\nclass FilteredTreeHierarchy {\n private _fullHierarchy: FullTreeHierarchy;\n private _filter: string;\n private _filtered = new Map<string | undefined, DelayLoadedTreeNodeItem[]>();\n private _init: Promise<void>;\n\n public constructor(dataProvider: ITreeDataProvider, filter: string) {\n this._fullHierarchy = new FullTreeHierarchy(dataProvider);\n this._filter = filter;\n\n this._init = (async () => {\n await this.init();\n })();\n }\n\n private async init() {\n const hierarchy = await this._fullHierarchy.getHierarchy();\n if (this._filter === \"\") {\n this._filtered = hierarchy;\n return;\n }\n this.filterNodes(hierarchy);\n }\n\n /** Initializes `this._filtered` field. Returns a node if it matches a filter. */\n private filterNodes(hierarchy: Map<string | undefined, DelayLoadedTreeNodeItem[]>, current?: DelayLoadedTreeNodeItem): DelayLoadedTreeNodeItem | undefined {\n const matches = current ? this.matchesFilter(current) : false;\n const children = hierarchy.get(current?.id);\n if (!children)\n return matches ? current : undefined;\n\n const matchedChildren = new Array<DelayLoadedTreeNodeItem>();\n for (const child of children) {\n const matchedChild = this.filterNodes(hierarchy, child);\n matchedChild && matchedChildren.push(matchedChild);\n }\n\n const hasChildren = matchedChildren.length > 0;\n const included = matches || hasChildren;\n let filtered: DelayLoadedTreeNodeItem | undefined;\n if (included) {\n this._filtered.set(current?.id, matchedChildren);\n\n // Return a modified copy of current node (to persist initial hierarchy when filter is cleared).\n if (current) {\n filtered = {\n ...current,\n hasChildren,\n autoExpand: hasChildren ? true : current.autoExpand,\n };\n }\n }\n return filtered;\n }\n\n private matchesFilter(node: TreeNodeItem) {\n if (node.label.value.valueFormat !== PropertyValueFormat.Primitive)\n return false;\n\n const value = node.label.value.displayValue?.toLowerCase();\n if (!value)\n return false;\n return value.includes(this._filter.toLowerCase());\n }\n\n public async getHierarchy() {\n await this._init;\n return this._filtered;\n }\n}\n\nclass FilteredTreeDataProvider implements ITreeDataProvider {\n private _hierarchy: FilteredTreeHierarchy;\n\n public constructor(\n parentDataProvider: ITreeDataProvider,\n filter: string,\n ) {\n this._hierarchy = new FilteredTreeHierarchy(parentDataProvider, filter);\n }\n\n public async getNodes(parent?: TreeNodeItem) {\n const hierarchy = await this._hierarchy.getHierarchy();\n const nodes = hierarchy.get(parent?.id);\n return nodes || [];\n }\n\n public async getNodesCount(parent?: TreeNodeItem) {\n const hierarchy = await this._hierarchy.getHierarchy();\n const nodes = hierarchy.get(parent?.id);\n return nodes?.length || 0;\n }\n}\n"]}
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AS,CAAC,GAAG,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,EAAE,CAAC,CAAC;QACxC,OAAO,KAAK,IAAI,EAAE,CAAC;IACrB,CAAC;IAEM,KAAK,CAAC,aAAa,CAAC,MAAqB;QAC9C,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC;QACvD,MAAM,KAAK,GAAG,SAAS,CAAC,GAAG,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,EAAE,CAAC,CAAC;QACxC,OAAO,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,MAAM,KAAI,CAAC,CAAC;IAC5B,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport {\n AbstractTreeNodeLoaderWithProvider, ControlledTree, DelayLoadedTreeNodeItem, HighlightableTreeProps, ITreeDataProvider,\n MutableTreeModel,\n MutableTreeModelNode,\n SelectionMode, TreeCheckboxStateChangeEventArgs, TreeDataProvider, TreeEventHandler, TreeImageLoader, TreeModel, TreeModelChanges, TreeModelSource, TreeNodeItem, TreeNodeLoader,\n TreeNodeRenderer, TreeNodeRendererProps, TreeRenderer, TreeRendererProps, useTreeModel,\n} from \"@itwin/components-react\";\nimport { ImageMapLayerSettings, MapSubLayerProps, MapSubLayerSettings } from \"@itwin/core-common\";\nimport { IModelApp, MapTileTreeScaleRangeVisibility, ScreenViewport } from \"@itwin/core-frontend\";\nimport { CheckBoxState, ImageCheckBox, NodeCheckboxRenderProps, useDisposable, WebFontIcon } from \"@itwin/core-react\";\nimport { Button, Input } from \"@itwin/itwinui-react\";\nimport * as React from \"react\";\nimport { StyleMapLayerSettings } from \"../Interfaces\";\nimport { SubLayersDataProvider } from \"./SubLayersDataProvider\";\nimport \"./SubLayersTree.scss\";\nimport { MapLayersUI } from \"../../mapLayers\";\n\nconst getWindow = () => {\n return typeof window === \"undefined\" ? undefined : window;\n};\n\nconst useResizeObserver = <T extends HTMLElement>(\n onResize: (size: DOMRectReadOnly) => void,\n) => {\n const resizeObserver = React.useRef<ResizeObserver>();\n\n const elementRef = React.useCallback(\n (element: T | null) => {\n if (!getWindow()?.ResizeObserver) {\n return;\n }\n\n resizeObserver.current?.disconnect();\n if (element) {\n resizeObserver.current = new ResizeObserver(([{ contentRect }]) =>\n onResize(contentRect),\n );\n resizeObserver.current?.observe(element);\n }\n },\n [onResize],\n );\n\n return [elementRef, resizeObserver.current] as const;\n};\n\n/**\n Mimic processing of `react-resize-detector` to return width and height.\n* @internal\n */\nfunction useResizeDetector(): { width: number | undefined, height: number | undefined, ref: React.Ref<HTMLDivElement> } {\n const [width, setWidth] = React.useState<number>();\n const [height, setHeight] = React.useState<number>();\n const [ref] = useResizeObserver(React.useCallback((size: DOMRectReadOnly) => {\n setWidth(size.width);\n setHeight(size.height);\n }, []));\n return { width, height, ref };\n}\n\ninterface ToolbarProps {\n searchField?: React.ReactNode;\n children?: React.ReactNode[];\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction Toolbar(props: ToolbarProps) {\n return (\n <div className=\"map-manager-sublayer-tree-toolbar\">\n <div className=\"tree-toolbar-action-buttons\">\n {props.children}\n </div>\n {props.searchField && <div className=\"tree-toolbar-searchbox\">\n {props.searchField}\n </div>}\n </div>\n );\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function SubLayersPanel({ mapLayer, viewport }: { mapLayer: StyleMapLayerSettings, viewport: ScreenViewport | undefined }) {\n const [noneAvailableLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:SubLayers.NoSubLayers\"));\n if (!viewport || (undefined === mapLayer.subLayers || 0 === mapLayer.subLayers.length)) {\n return <div className=\"map-manager-sublayer-panel\">\n <div>{noneAvailableLabel}</div>\n </div>;\n }\n\n return (\n <SubLayersTree mapLayer={mapLayer} />\n );\n}\n\nfunction getSubLayerProps(subLayerSettings: MapSubLayerSettings[]): MapSubLayerProps[] {\n return subLayerSettings.map((subLayer) => subLayer.toJSON());\n}\n\nfunction getStyleMapLayerSettings(settings: ImageMapLayerSettings, isOverlay: boolean, layerIndex: number, treeVisibility: MapTileTreeScaleRangeVisibility): StyleMapLayerSettings {\n return {\n visible: settings.visible,\n name: settings.name,\n source: settings.source,\n transparency: settings.transparency,\n transparentBackground: settings.transparentBackground,\n subLayers: settings.subLayers ? getSubLayerProps(settings.subLayers) : undefined,\n showSubLayers: true,\n isOverlay,\n layerIndex,\n provider: IModelApp.mapLayerFormatRegistry.createImageryProvider(settings),\n treeVisibility,\n };\n}\n\n/**\n * Tree Control that displays sub-layer hierarchy\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function SubLayersTree(props: { mapLayer: StyleMapLayerSettings }) {\n const [placeholderLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:SubLayers.SearchPlaceholder\"));\n const [allOnLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:SubLayers.AllOn\"));\n const [allOffLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:SubLayers.AllOff\"));\n const [mapLayer, setMapLayer] = React.useState(props.mapLayer);\n const [layerFilterString, setLayerFilterString] = React.useState<string>(\"\");\n\n // create data provider to get some nodes to show in tree\n // `React.useMemo' is used avoid creating new object on each render cycle\n const dataProvider = React.useMemo(() => new SubLayersDataProvider(mapLayer), [mapLayer]);\n\n const {\n modelSource,\n nodeLoader,\n nodeHighlightingProps,\n } = useTreeFiltering(dataProvider, layerFilterString);\n\n // create custom event handler. It handles all tree event same as `TreeEventHandler` but additionally\n // it selects/deselects node when checkbox is checked/unchecked and vice versa.\n // `useDisposable` takes care of disposing old event handler when new is created in case 'nodeLoader' has changed\n // `React.useCallback` is used to avoid creating new callback that creates handler on each render\n const eventHandler = useDisposable(React.useCallback(() => new SubLayerCheckboxHandler(mapLayer, nodeLoader), [nodeLoader, mapLayer]));\n\n // Get an immutable tree model from the model source. The model is regenerated every time the model source\n // emits the `onModelChanged` event.\n const treeModel = useTreeModel(modelSource);\n\n const showAll = React.useCallback(async () => {\n const vp = IModelApp.viewManager.selectedView;\n const displayStyle = vp?.displayStyle;\n if (displayStyle && vp) {\n const indexInDisplayStyle = displayStyle ? displayStyle.findMapLayerIndexByNameAndSource(mapLayer.name, mapLayer.source, mapLayer.isOverlay) : -1;\n displayStyle.changeMapSubLayerProps({ visible: true }, -1, indexInDisplayStyle, mapLayer.isOverlay);\n vp.invalidateRenderPlan();\n const updatedMapLayer = displayStyle.mapLayerAtIndex(indexInDisplayStyle, mapLayer.isOverlay);\n if (updatedMapLayer) {\n if (updatedMapLayer instanceof ImageMapLayerSettings) {\n const treeVisibility = vp.getMapLayerScaleRangeVisibility(indexInDisplayStyle, mapLayer.isOverlay);\n setMapLayer(getStyleMapLayerSettings(updatedMapLayer, mapLayer.isOverlay, indexInDisplayStyle, treeVisibility));\n }\n\n }\n }\n }, [mapLayer]);\n\n const hideAll = React.useCallback(async () => {\n const vp = IModelApp.viewManager.selectedView;\n const displayStyle = vp?.displayStyle;\n if (displayStyle && vp) {\n const indexInDisplayStyle = displayStyle ? displayStyle.findMapLayerIndexByNameAndSource(mapLayer.name, mapLayer.source, mapLayer.isOverlay) : -1;\n displayStyle.changeMapSubLayerProps({ visible: false }, -1, indexInDisplayStyle, mapLayer.isOverlay);\n const updatedMapLayer = displayStyle.mapLayerAtIndex(indexInDisplayStyle, mapLayer.isOverlay);\n if (updatedMapLayer && updatedMapLayer instanceof ImageMapLayerSettings) {\n const treeVisibility = vp.getMapLayerScaleRangeVisibility(indexInDisplayStyle, mapLayer.isOverlay);\n setMapLayer(getStyleMapLayerSettings(updatedMapLayer, mapLayer.isOverlay, indexInDisplayStyle, treeVisibility));\n }\n vp.invalidateRenderPlan();\n }\n }, [mapLayer]);\n\n const handleFilterTextChanged = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\n setLayerFilterString(event.target.value);\n }, []);\n\n const { width, height, ref: containerRef } = useResizeDetector();\n\n return <>\n <div className=\"map-manager-sublayer-tree\">\n <Toolbar\n searchField={\n <Input type=\"text\" className=\"map-manager-source-list-filter\"\n placeholder={placeholderLabel}\n value={layerFilterString}\n onChange={handleFilterTextChanged}\n size=\"small\" />\n }\n >\n {mapLayer.provider?.mutualExclusiveSubLayer ? undefined : [\n <Button size=\"small\" styleType=\"borderless\" key=\"show-all-btn\" title={allOnLabel} onClick={showAll}>\n <WebFontIcon iconName=\"icon-visibility\" />\n </Button>,\n <Button size=\"small\" styleType=\"borderless\" key=\"hide-all-btn\" title={allOffLabel} onClick={hideAll}>\n <WebFontIcon iconName=\"icon-visibility-hide-2\" />\n </Button>,\n ]}\n </Toolbar>\n <div ref={containerRef} className=\"map-manager-sublayer-tree-content\">\n {width !== undefined && height !== undefined && <ControlledTree\n nodeLoader={nodeLoader}\n selectionMode={SelectionMode.None}\n eventsHandler={eventHandler}\n model={treeModel}\n treeRenderer={nodeWithEyeCheckboxTreeRenderer}\n nodeHighlightingProps={nodeHighlightingProps}\n width={width}\n height={height}\n />}\n </div>\n </div>\n </>;\n}\n\n/** TreeEventHandler derived class that handler processing changes to subLayer visibility */\nclass SubLayerCheckboxHandler extends TreeEventHandler {\n private _removeModelChangedListener: () => void;\n\n constructor(private _mapLayer: StyleMapLayerSettings, nodeLoader: AbstractTreeNodeLoaderWithProvider<TreeDataProvider>) {\n super({ modelSource: nodeLoader.modelSource, nodeLoader, collapsedChildrenDisposalEnabled: true });\n this._removeModelChangedListener = this.modelSource.onModelChanged.addListener(this.onModelChanged);\n }\n\n public override dispose() {\n this._removeModelChangedListener();\n super.dispose();\n }\n\n // Cascade state\n // Children on unnamed groups must get disabled in the tree view, because\n // they get rendered anyway.\n private cascadeStateToAllChildren(model: MutableTreeModel, parentId?: string) {\n const children = model.getChildren(parentId);\n if (children === undefined)\n return;\n\n for (const childID of children) {\n const childNode = childID ? model.getNode(childID) : undefined;\n\n if (childNode)\n this.syncNodeStateWithParent(model, childNode);\n\n // Drill down the tree.\n this.cascadeStateToAllChildren(model, childID);\n }\n }\n\n private applyMutualExclusiveState(model: MutableTreeModel, nodeId: string) {\n const changedNode = model.getNode(nodeId);\n if (changedNode?.checkbox.state === CheckBoxState.Off)\n return;\n\n for (const node of model.iterateTreeModelNodes()) {\n if (node.id === changedNode?.id)\n continue;\n\n if (node && node.checkbox.state === CheckBoxState.On)\n node.checkbox.state = CheckBoxState.Off;\n }\n }\n\n //-----------------------------------------------------------------------\n // Listen to model changes\n //------------------------------------------------------------------------\n // This is required because nodes are delay loaded in the model until\n // they are made visible (i.e. parent node is expanded). So even though\n // you might have created nodes in the data provided with a proper\n // initial state, by the time it gets loaded, their state might have became\n // out of date in the TreeView's active model. So whenever a node\n // is added, when must confirm its state matches the current model\n // (i.e. state of their parent.)\n public onModelChanged = (args: [TreeModel, TreeModelChanges]) => {\n this.modelSource.modifyModel((model) => {\n const addedNodes = args[1].addedNodeIds.map((id) => model.getNode(id));\n addedNodes.forEach((node) => {\n if (!node)\n return;\n\n this.syncNodeStateWithParent(model, node);\n });\n });\n };\n\n private static isUnnamedGroup(subLayer: MapSubLayerProps | undefined): boolean {\n if (!subLayer)\n return false;\n\n return (!subLayer.name || subLayer.name.length === 0) && (subLayer.children !== undefined && subLayer.children.length > 0);\n }\n\n // Ensure the state of changed node matches the state of its parent.\n private syncNodeStateWithParent(model: MutableTreeModel, changedNode: MutableTreeModelNode) {\n // Lookup node parent. If non exists, I assume thats the root node,\n // and it must have a proper initial state.\n const parentNode = changedNode.parentId ? model.getNode(changedNode.parentId) : undefined;\n if (!parentNode)\n return;\n\n if (!changedNode.checkbox)\n return; // don't see why this would happen, but if there is no checkbox, we cant do much here.\n\n const parentLayerId = undefined !== parentNode.item.extendedData?.subLayerId ? parentNode.item.extendedData?.subLayerId : parentNode.item.id;\n const parentSubLayer = this._mapLayer.subLayers?.find((subLayer) => subLayer.id === parentLayerId);\n\n // If parent is disabled, then children must be too.\n // Also, Non-visible unnamed group must have their children disabled (unamed groups have visibility inherence)\n if (parentNode.checkbox.isDisabled || (SubLayerCheckboxHandler.isUnnamedGroup(parentSubLayer) && parentNode.checkbox.state === CheckBoxState.Off)) {\n changedNode.checkbox.isDisabled = true;\n changedNode.checkbox.state = CheckBoxState.Off;\n } else {\n // Visibility state from StyleMapLayerSettings applies\n const subLayerId = undefined !== changedNode.item.extendedData?.subLayerId ? changedNode.item.extendedData?.subLayerId : changedNode.item.id;\n const foundSubLayer = this._mapLayer.subLayers?.find((subLayer) => subLayer.id === subLayerId);\n changedNode.checkbox.isDisabled = false;\n changedNode.checkbox.state = foundSubLayer?.visible ? CheckBoxState.On : CheckBoxState.Off;\n }\n }\n\n /** Changes nodes checkboxes states until event is handled or handler is disposed */\n public override onCheckboxStateChanged({ stateChanges }: TreeCheckboxStateChangeEventArgs) {\n // call base checkbox handling\n const baseHandling = super.onCheckboxStateChanged({ stateChanges });\n\n // subscribe to checkbox state changes to new checkbox states and do some additional work with them\n const selectionHandling = stateChanges.subscribe({\n next: (changes) => {\n const vp = IModelApp.viewManager.selectedView;\n const displayStyle = vp?.displayStyle;\n const indexInDisplayStyle = displayStyle ? displayStyle.findMapLayerIndexByNameAndSource(this._mapLayer.name, this._mapLayer.source, this._mapLayer.isOverlay) : -1;\n changes.forEach((change) => {\n const isSelected = (change.newState === CheckBoxState.On);\n\n const subLayerId = undefined !== change.nodeItem.extendedData?.subLayerId ? change.nodeItem.extendedData?.subLayerId : change.nodeItem.id;\n\n // Get the previously visible node if any\n let prevVisibleLayer: MapSubLayerProps | undefined;\n if (this._mapLayer.provider?.mutualExclusiveSubLayer) {\n prevVisibleLayer = this._mapLayer.subLayers?.find((subLayer) => subLayer.visible && subLayer.id !== subLayerId);\n }\n\n // Update sublayer object, otherwise state would get out of sync with DisplayStyle each time the TreeView is re-rendered\n const foundSubLayer = this._mapLayer.subLayers?.find((subLayer) => subLayer.id === subLayerId);\n if (foundSubLayer)\n foundSubLayer.visible = isSelected;\n if (prevVisibleLayer?.visible)\n prevVisibleLayer.visible = false;\n\n // Update displaystyle state\n if (-1 !== indexInDisplayStyle && displayStyle) {\n if (prevVisibleLayer && prevVisibleLayer.id !== undefined)\n displayStyle.changeMapSubLayerProps({ visible: false }, prevVisibleLayer.id, indexInDisplayStyle, this._mapLayer.isOverlay);\n displayStyle.changeMapSubLayerProps({ visible: isSelected }, subLayerId, indexInDisplayStyle, this._mapLayer.isOverlay);\n }\n\n // Cascade state\n this.modelSource.modifyModel((model) => {\n if (this._mapLayer.provider?.mutualExclusiveSubLayer)\n this.applyMutualExclusiveState(model, change.nodeItem.id);\n this.cascadeStateToAllChildren(model, change.nodeItem.id);\n });\n });\n\n if (vp)\n vp.invalidateRenderPlan();\n },\n });\n // stop handling selection when checkboxes handling is stopped\n baseHandling?.add(selectionHandling);\n return baseHandling;\n }\n}\n\n/** Custom checkbox renderer that renders checkbox as an eye */\nconst eyeCheckboxRenderer = (props: NodeCheckboxRenderProps) => (\n <ImageCheckBox\n checked={props.checked}\n disabled={props.disabled}\n imageOn=\"icon-visibility\"\n imageOff=\"icon-visibility-hide-2\"\n onClick={props.onChange}\n tooltip={props.title}\n />\n);\n\n/** Custom node renderer. It uses default 'TreeNodeRenderer' but overrides default checkbox renderer to render checkbox as an eye */\nconst imageLoader = new TreeImageLoader();\nconst nodeWithEyeCheckboxRenderer = (props: TreeNodeRendererProps) => (\n <TreeNodeRenderer\n {...props}\n checkboxRenderer={eyeCheckboxRenderer}\n imageLoader={imageLoader}\n />\n);\n\n/** Custom tree renderer. It uses default `TreeRenderer` but overrides default node renderer to render node with custom checkbox */\nconst nodeWithEyeCheckboxTreeRenderer = (props: TreeRendererProps) => (\n <TreeRenderer\n {...props}\n nodeRenderer={nodeWithEyeCheckboxRenderer}\n />\n);\n\nfunction useTreeFiltering(\n dataProvider: ITreeDataProvider,\n filter: string,\n) {\n const nodeLoader = useFilteredProvider(dataProvider, filter);\n const nodeHighlightingProps = useNodeHighlightingProps(filter);\n return {\n nodeLoader,\n modelSource: nodeLoader.modelSource,\n nodeHighlightingProps,\n };\n}\n\nfunction useFilteredProvider(\n dataProvider: ITreeDataProvider,\n filter: string,\n) {\n const filteredProvider = React.useMemo(() => {\n return new FilteredTreeDataProvider(dataProvider, filter);\n }, [dataProvider, filter]);\n\n const nodeLoader = React.useMemo(() => {\n return new TreeNodeLoader(filteredProvider, new TreeModelSource());\n }, [filteredProvider]);\n\n return nodeLoader;\n}\n\nfunction useNodeHighlightingProps(\n filter: string,\n) {\n const [nodeHighlightingProps, setNodeHighlightingProps] = React.useState<HighlightableTreeProps>();\n\n React.useEffect(() => {\n if (filter === \"\") {\n setNodeHighlightingProps(undefined);\n return;\n }\n setNodeHighlightingProps({\n searchText: filter,\n activeMatch: undefined,\n });\n }, [filter]);\n\n return nodeHighlightingProps;\n}\n\nclass FullTreeHierarchy {\n private _dataProvider: ITreeDataProvider;\n private _hierarchy = new Map<string | undefined, DelayLoadedTreeNodeItem[]>();\n private _init: Promise<void>;\n\n public constructor(dataProvider: ITreeDataProvider) {\n this._dataProvider = dataProvider;\n\n this._init = (async () => {\n await this.initNode();\n })();\n }\n\n private async initNode(parent?: TreeNodeItem) {\n const nodes = await this._dataProvider.getNodes(parent);\n this._hierarchy.set(parent?.id, nodes);\n for (const node of nodes) {\n await this.initNode(node);\n }\n }\n\n public async getHierarchy() {\n await this._init;\n return this._hierarchy;\n }\n}\n\nclass FilteredTreeHierarchy {\n private _fullHierarchy: FullTreeHierarchy;\n private _filter: string;\n private _filtered = new Map<string | undefined, DelayLoadedTreeNodeItem[]>();\n private _init: Promise<void>;\n\n public constructor(dataProvider: ITreeDataProvider, filter: string) {\n this._fullHierarchy = new FullTreeHierarchy(dataProvider);\n this._filter = filter;\n\n this._init = (async () => {\n await this.init();\n })();\n }\n\n private async init() {\n const hierarchy = await this._fullHierarchy.getHierarchy();\n if (this._filter === \"\") {\n this._filtered = hierarchy;\n return;\n }\n this.filterNodes(hierarchy);\n }\n\n /** Initializes `this._filtered` field. Returns a node if it matches a filter. */\n private filterNodes(hierarchy: Map<string | undefined, DelayLoadedTreeNodeItem[]>, current?: DelayLoadedTreeNodeItem): DelayLoadedTreeNodeItem | undefined {\n const matches = current ? this.matchesFilter(current) : false;\n const children = hierarchy.get(current?.id);\n if (!children)\n return matches ? current : undefined;\n\n const matchedChildren = new Array<DelayLoadedTreeNodeItem>();\n for (const child of children) {\n const matchedChild = this.filterNodes(hierarchy, child);\n matchedChild && matchedChildren.push(matchedChild);\n }\n\n const hasChildren = matchedChildren.length > 0;\n const included = matches || hasChildren;\n let filtered: DelayLoadedTreeNodeItem | undefined;\n if (included) {\n this._filtered.set(current?.id, matchedChildren);\n\n // Return a modified copy of current node (to persist initial hierarchy when filter is cleared).\n if (current) {\n filtered = {\n ...current,\n hasChildren,\n autoExpand: hasChildren ? true : current.autoExpand,\n };\n }\n }\n return filtered;\n }\n\n private matchesFilter(node: TreeNodeItem) {\n if (node.label.value.valueFormat !== PropertyValueFormat.Primitive)\n return false;\n\n const value = node.label.value.displayValue?.toLowerCase();\n if (!value)\n return false;\n return value.includes(this._filter.toLowerCase());\n }\n\n public async getHierarchy() {\n await this._init;\n return this._filtered;\n }\n}\n\nclass FilteredTreeDataProvider implements ITreeDataProvider {\n private _hierarchy: FilteredTreeHierarchy;\n\n public constructor(\n parentDataProvider: ITreeDataProvider,\n filter: string,\n ) {\n this._hierarchy = new FilteredTreeHierarchy(parentDataProvider, filter);\n }\n\n public async getNodes(parent?: TreeNodeItem) {\n const hierarchy = await this._hierarchy.getHierarchy();\n const nodes = hierarchy.get(parent?.id);\n return nodes || [];\n }\n\n public async getNodesCount(parent?: TreeNodeItem) {\n const hierarchy = await this._hierarchy.getHierarchy();\n const nodes = hierarchy.get(parent?.id);\n return nodes?.length || 0;\n }\n}\n"]}
|
|
@@ -226,6 +226,7 @@ export class MapLayerPreferences {
|
|
|
226
226
|
* @param iModelId
|
|
227
227
|
*/
|
|
228
228
|
static async getByUrl(url, iTwinId, iModelId) {
|
|
229
|
+
var _a;
|
|
229
230
|
if (!MapLayersUI.iTwinConfig)
|
|
230
231
|
return undefined;
|
|
231
232
|
const accessToken = undefined !== IModelApp.authorizationClient ? (await IModelApp.authorizationClient.getAccessToken()) : undefined;
|
|
@@ -239,7 +240,7 @@ export class MapLayerPreferences {
|
|
|
239
240
|
if (undefined === settingResponse || 0 === settingResponse.length)
|
|
240
241
|
return undefined;
|
|
241
242
|
let savedMapLayer;
|
|
242
|
-
settingResponse.settingsMap
|
|
243
|
+
(_a = settingResponse.settingsMap) === null || _a === void 0 ? void 0 : _a.forEach((savedLayer) => {
|
|
243
244
|
if (savedLayer.url === url) {
|
|
244
245
|
savedMapLayer = savedLayer;
|
|
245
246
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapLayerPreferences.js","sourceRoot":"","sources":["../../src/MapLayerPreferences.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC9G,OAAO,EAAE,OAAO,EAAc,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAU1C,gBAAgB;AAChB,MAAM,CAAN,IAAY,wBAIX;AAJD,WAAY,wBAAwB;IAClC,yEAAS,CAAA;IACT,6EAAW,CAAA;IACX,+EAAY,CAAA;AACd,CAAC,EAJW,wBAAwB,KAAxB,wBAAwB,QAInC;AASD;;;;;GAKG;AACH,MAAM,OAAO,mBAAmB;IAU9B;;;;;;OAMG;IACI,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,MAAsB,EAAE,OAAmB,EAAE,QAAqB,EAAE,aAAuB;QACzH,IAAI,CAAC,WAAW,CAAC,WAAW;YAC1B,OAAO,KAAK,CAAC;QACf,MA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,CAAC,oBAAoB;gBACnD,GAAG,EAAE,EAAE;gBACP,OAAO;gBACP,QAAQ;aACT,CAAC,CAAC;YACH,IAAI,SAAS,KAAK,kBAAkB;gBAClC,YAAY,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;SACzC;QAAC,OAAO,GAAQ,EAAE;YACjB,MAAM,IAAI,KAAK,CAAC,SAAS,CAAC,YAAY,CAAC,kBAAkB,CAAC,iDAAiD,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;SACtI;QAED,MAAM,oBAAoB,GAAqB,EAAE,CAAC;QAClD,KAAK,MAAM,QAAQ,IAAI,YAAY,EAAE;YACnC,QAAQ,CAAC,OAAO,CAAC,CAAC,UAAe,EAAE,EAAE;gBACnC,MAAM,cAAc,GAAG,cAAc,CAAC,QAAQ,CAAC,UAAwC,CAAC,CAAC;gBACzF,IAAI,cAAc;oBAChB,oBAAoB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;YAC9C,CAAC,CAAC,CAAC;SACJ;QACD,OAAO,oBAAoB,CAAC;IAC9B,CAAC;IAEO,MAAM,KAAK,oBAAoB;QACrC,OAAO,gCAAgC,CAAC;IAC1C,CAAC;;AAhTD;;;;;;GAMG;AACoB,wCAAoB,GAAG,IAAI,OAAO,EAA0G,CAAC,CAAC,mFAAmF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nimport { IModelApp, MapLayerSource, NotifyMessageDetails, OutputMessagePriority } from \"@itwin/core-frontend\";\nimport { BeEvent, GuidString } from \"@itwin/core-bentley\";\nimport { MapLayersUI } from \"./mapLayers\";\n\n/** @internal */\nexport interface MapLayerPreferencesContent {\n url: string;\n name: string;\n formatId: string;\n transparentBackground: boolean | undefined;\n}\n\n/** @internal */\nexport enum MapLayerSourceChangeType {\n Added = 0,\n Removed = 1,\n Replaced = 2,\n}\n\n/** @internal */\nexport interface MapLayerSourceArg {\n readonly source: MapLayerSource;\n readonly iTwinId: GuidString;\n readonly iModelId: GuidString;\n}\n\n/** A wrapper around user preferences to provide a way to store [[MapLayerSettings]].\n *\n * Note: This is currently internal only and used directly by the MapLayersExtension. It makes use of the IModelApp.authorizationClient if it exists.\n *\n * @internal\n */\nexport class MapLayerPreferences {\n /** Event raised whenever a source is added, replaced or removed:\n * changeType : Type of changed occurred.\n * oldSource : Source that was removed or replaced.\n * newSource : Source that was added or replacement of oldSource.\n *\n * @see [[MapLayerSourceChangeType]]\n */\n public static readonly onLayerSourceChanged = new BeEvent<(changeType: MapLayerSourceChangeType, oldSource?: MapLayerSource, newSource?: MapLayerSource) => void>(); // Used to notify the frontend that it needs to update its list of available layers\n\n /** Store the Map Layer source preference. If the same setting exists at a higher level, an error will be thrown and the setting will not be updated.\n *\n * Returns false if the settings object would override some other settings object in a larger scope i.e. storing settings on model when\n * a project setting exists with same name or map layer url.\n * @param source source to be stored on the setting service\n * @param storeOnIModel if true store the settings object on the model, if false store it on the project\n */\n public static async storeSource(source: MapLayerSource, iTwinId: GuidString, iModelId?: GuidString, storeOnIModel?: boolean): Promise<boolean> {\n if (!MapLayersUI.iTwinConfig)\n return false;\n const accessToken = undefined !== IModelApp.authorizationClient ? (await IModelApp.authorizationClient.getAccessToken()) : undefined;\n\n const sourceJSON = source.toJSON();\n const mapLayerSetting: MapLayerPreferencesContent = {\n url: sourceJSON.url,\n name: sourceJSON.name,\n formatId: sourceJSON.formatId,\n transparentBackground: sourceJSON.transparentBackground,\n };\n\n const result: boolean = await MapLayerPreferences.delete(sourceJSON.url, sourceJSON.name, iTwinId, iModelId, storeOnIModel);\n if (result) {\n await MapLayersUI.iTwinConfig.save({\n accessToken,\n content: mapLayerSetting,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: sourceJSON.name,\n iTwinId,\n iModelId: storeOnIModel ? iModelId : undefined,\n });\n MapLayerPreferences.onLayerSourceChanged.raiseEvent(MapLayerSourceChangeType.Added, undefined, MapLayerSource.fromJSON(mapLayerSetting));\n return true;\n } else {\n return false;\n }\n }\n\n /** Replace the old map layer source with a new map layer source.\n *\n * The source is replaced at the same level that the original source is defined. (i.e. if the old source is defined at a project level, the new source will also be defined there.)\n *\n * @param oldSource\n * @param newSource\n * @param iTwinId\n * @param iModelId\n */\n public static async replaceSource(oldSource: MapLayerSource, newSource: MapLayerSource, iTwinId: GuidString, iModelId?: GuidString): Promise<void> {\n if (!MapLayersUI.iTwinConfig)\n return;\n const accessToken = undefined !== IModelApp.authorizationClient ? (await IModelApp.authorizationClient.getAccessToken()) : undefined;\n\n let storeOnIModel = false;\n try {\n await MapLayersUI.iTwinConfig.delete({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: oldSource.name,\n iTwinId,\n iModelId,\n });\n } catch (_err) {\n await MapLayersUI.iTwinConfig.delete({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: oldSource.name,\n iTwinId,\n });\n storeOnIModel = true;\n }\n\n const mapLayerSetting: MapLayerPreferencesContent = {\n url: newSource.url,\n name: newSource.name,\n formatId: newSource.formatId,\n transparentBackground: newSource.transparentBackground,\n };\n\n await MapLayersUI.iTwinConfig.save({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: `${MapLayerPreferences._preferenceNamespace}.${newSource.name}`,\n iTwinId,\n iModelId: storeOnIModel ? iModelId : undefined,\n content: mapLayerSetting,\n });\n\n MapLayerPreferences.onLayerSourceChanged.raiseEvent(MapLayerSourceChangeType.Replaced, oldSource, newSource);\n }\n\n /** Deletes the provided MapLayerSource by name from both the iTwin or iModel level.\n *\n * @param source The source to delete. The name is used to identify the source.\n * @param iTwinId\n * @param iModelId\n */\n public static async deleteByName(source: MapLayerSource, iTwinId: GuidString, iModelId?: GuidString): Promise<void> {\n if (!MapLayersUI.iTwinConfig)\n return;\n const accessToken = undefined !== IModelApp.authorizationClient ? (await IModelApp.authorizationClient.getAccessToken()) : undefined;\n\n try {\n await MapLayersUI.iTwinConfig.delete({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: source.name,\n iTwinId,\n iModelId,\n });\n } catch (_err) {\n // failed to store based on iModelId, attempt using iTwinId\n await MapLayersUI.iTwinConfig.delete({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: source.name,\n iTwinId,\n });\n }\n\n MapLayerPreferences.onLayerSourceChanged.raiseEvent(MapLayerSourceChangeType.Removed, source, undefined);\n }\n\n /** Deletes the current setting with the provided key if it is defined at the same preference level.\n *\n * If the preference is defined within a different level, false will be returned indicating the setting should not be overriden.\n *\n * The two potential preference levels are iTwin and iModel.\n *\n * @param url\n * @param name\n * @param iTwinId\n * @param iModelId\n * @param storeOnIModel\n */\n private static async delete(url: string, name: string, iTwinId: GuidString, iModelId?: GuidString, storeOnIModel?: boolean): Promise<boolean> {\n if (!MapLayersUI.iTwinConfig)\n return true;\n const accessToken = undefined !== IModelApp.authorizationClient ? (await IModelApp.authorizationClient.getAccessToken()) : undefined;\n\n const iTwinPreferenceByName = await MapLayersUI.iTwinConfig.get({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: name,\n iTwinId,\n });\n\n if (undefined !== iTwinPreferenceByName && storeOnIModel) {\n const errorMessage = IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.LayerExistsAsProjectSetting\", { layer: iTwinPreferenceByName.name });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, errorMessage));\n return false;\n } else if (iTwinPreferenceByName) {\n const infoMessage = IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.LayerExistsOverwriting\", { layer: iTwinPreferenceByName.name });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, infoMessage));\n await MapLayersUI.iTwinConfig.delete({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: iTwinPreferenceByName.name,\n iTwinId,\n });\n }\n\n // check if setting with url already exists, if it does, delete it\n const settingFromUrl = await MapLayerPreferences.getByUrl(url, iTwinId, undefined);\n if (settingFromUrl && storeOnIModel) {\n const errorMessage = IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.LayerWithUrlExistsAsProjectSetting\", { url: settingFromUrl.url, name: settingFromUrl.name });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, errorMessage));\n return false;\n } else if (settingFromUrl) {\n const infoMessage = IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.LayerWithUrlExistsOverwriting\", { url: settingFromUrl.url, oldName: settingFromUrl.name, newName: name });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, infoMessage));\n await MapLayersUI.iTwinConfig.delete({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: settingFromUrl.name,\n iTwinId,\n });\n }\n\n if (iModelId) { // delete any settings on model so user can update them if theres collisions\n const settingOnIModelFromName = await MapLayersUI.iTwinConfig.get({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: name,\n iTwinId,\n iModelId,\n });\n const settingFromUrlOnIModel = await MapLayerPreferences.getByUrl(url, iTwinId, iModelId);\n if (settingOnIModelFromName) {\n const infoMessage = IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.LayerExistsOverwriting\", { layer: settingOnIModelFromName.name });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, infoMessage));\n await MapLayersUI.iTwinConfig.delete({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: settingOnIModelFromName.name,\n iTwinId,\n iModelId,\n });\n }\n if (settingFromUrlOnIModel) {\n const infoMessage = IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.LayerWithUrlExistsOverwriting\", { url: settingFromUrlOnIModel.url, oldName: settingFromUrlOnIModel.name, newName: name });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, infoMessage));\n await MapLayersUI.iTwinConfig.delete({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: settingFromUrlOnIModel.name,\n iTwinId,\n iModelId,\n });\n }\n }\n return true;\n }\n\n /** Attempts to get a map layer based off a specific url.\n * @param url\n * @param iTwinId\n * @param iModelId\n */\n public static async getByUrl(url: string, iTwinId: string, iModelId?: string): Promise<MapLayerPreferencesContent | undefined> {\n if (!MapLayersUI.iTwinConfig)\n return undefined;\n\n const accessToken = undefined !== IModelApp.authorizationClient ? (await IModelApp.authorizationClient.getAccessToken()) : undefined;\n\n const settingResponse = await MapLayersUI.iTwinConfig.get({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: \"\",\n iTwinId,\n iModelId,\n });\n\n if (undefined === settingResponse || 0 === settingResponse.length)\n return undefined;\n\n let savedMapLayer;\n settingResponse.settingsMap?.forEach((savedLayer: any) => {\n if (savedLayer.url === url) {\n savedMapLayer = savedLayer;\n }\n });\n return savedMapLayer;\n }\n\n /** Get all MapLayerSources from the user's preferences, iTwin setting and iModel settings.\n * @param iTwinId id of the iTwin\n * @param iModelId id of the iModel\n * @throws if any of the calls to grab settings fail.\n */\n public static async getSources(iTwinId: GuidString, iModelId?: GuidString): Promise<MapLayerSource[]> {\n if (!MapLayersUI.iTwinConfig)\n return [];\n const accessToken = undefined !== IModelApp.authorizationClient ? (await IModelApp.authorizationClient.getAccessToken()) : undefined;\n\n const mapLayerList = [];\n\n try {\n const userResultByProject = await MapLayersUI.iTwinConfig.get({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: \"\",\n iTwinId,\n });\n if (undefined !== userResultByProject)\n mapLayerList.push(userResultByProject);\n } catch (err: any) {\n throw new Error(IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.ErrorRetrieveUserProject\", { errorMessage: err }));\n }\n\n try {\n const userResultByIModel = await MapLayersUI.iTwinConfig.get({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: \"\",\n iTwinId,\n iModelId,\n });\n if (undefined !== userResultByIModel)\n mapLayerList.push(userResultByIModel);\n } catch (err: any) {\n throw new Error(IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.ErrorRetrieveUserProject\", { errorMessage: err }));\n }\n\n const savedMapLayerSources: MapLayerSource[] = [];\n for (const mapLayer of mapLayerList) {\n mapLayer.forEach((savedLayer: any) => {\n const mapLayerSource = MapLayerSource.fromJSON(savedLayer as MapLayerPreferencesContent);\n if (mapLayerSource)\n savedMapLayerSources.push(mapLayerSource);\n });\n }\n return savedMapLayerSources;\n }\n\n private static get _preferenceNamespace() {\n return \"MapLayerSource-SettingsService\";\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"MapLayerPreferences.js","sourceRoot":"","sources":["../../src/MapLayerPreferences.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC9G,OAAO,EAAE,OAAO,EAAc,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAU1C,gBAAgB;AAChB,MAAM,CAAN,IAAY,wBAIX;AAJD,WAAY,wBAAwB;IAClC,yEAAS,CAAA;IACT,6EAAW,CAAA;IACX,+EAAY,CAAA;AACd,CAAC,EAJW,wBAAwB,KAAxB,wBAAwB,QAInC;AASD;;;;;GAKG;AACH,MAAM,OAAO,mBAAmB;IAU9B;;;;;;OAMG;IACI,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,MAAsB,EAAE,OAAmB,EAAE,QAAqB,EAAE,aAAuB;QACzH,IAAI,CAAC,WAAW,CAAC,WAAW;YAC1B,OAAO,KAAK,CAAC;QACf,MAAM,WAAW,GAAG,SAAS,KAAK,SAAS,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,MAAM,SAAS,CAAC,mBAAmB,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,CAAC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C,IAAI,CAAC,kBAAkB,CAAC,CAAC;SACzC;QAAC,OAAO,GAAQ,EAAE;YACjB,MAAM,IAAI,KAAK,CAAC,SAAS,CAAC,YAAY,CAAC,kBAAkB,CAAC,iDAAiD,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;SACtI;QAED,MAAM,oBAAoB,GAAqB,EAAE,CAAC;QAClD,KAAK,MAAM,QAAQ,IAAI,YAAY,EAAE;YACnC,QAAQ,CAAC,OAAO,CAAC,CAAC,UAAe,EAAE,EAAE;gBACnC,MAAM,cAAc,GAAG,cAAc,CAAC,QAAQ,CAAC,UAAwC,CAAC,CAAC;gBACzF,IAAI,cAAc;oBAChB,oBAAoB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;YAC9C,CAAC,CAAC,CAAC;SACJ;QACD,OAAO,oBAAoB,CAAC;IAC9B,CAAC;IAEO,MAAM,KAAK,oBAAoB;QACrC,OAAO,gCAAgC,CAAC;IAC1C,CAAC;;AAhTD;;;;;;GAMG;AACoB,wCAAoB,GAAG,IAAI,OAAO,EAA0G,CAAC,CAAC,mFAAmF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nimport { IModelApp, MapLayerSource, NotifyMessageDetails, OutputMessagePriority } from \"@itwin/core-frontend\";\nimport { BeEvent, GuidString } from \"@itwin/core-bentley\";\nimport { MapLayersUI } from \"./mapLayers\";\n\n/** @internal */\nexport interface MapLayerPreferencesContent {\n url: string;\n name: string;\n formatId: string;\n transparentBackground: boolean | undefined;\n}\n\n/** @internal */\nexport enum MapLayerSourceChangeType {\n Added = 0,\n Removed = 1,\n Replaced = 2,\n}\n\n/** @internal */\nexport interface MapLayerSourceArg {\n readonly source: MapLayerSource;\n readonly iTwinId: GuidString;\n readonly iModelId: GuidString;\n}\n\n/** A wrapper around user preferences to provide a way to store [[MapLayerSettings]].\n *\n * Note: This is currently internal only and used directly by the MapLayersExtension. It makes use of the IModelApp.authorizationClient if it exists.\n *\n * @internal\n */\nexport class MapLayerPreferences {\n /** Event raised whenever a source is added, replaced or removed:\n * changeType : Type of changed occurred.\n * oldSource : Source that was removed or replaced.\n * newSource : Source that was added or replacement of oldSource.\n *\n * @see [[MapLayerSourceChangeType]]\n */\n public static readonly onLayerSourceChanged = new BeEvent<(changeType: MapLayerSourceChangeType, oldSource?: MapLayerSource, newSource?: MapLayerSource) => void>(); // Used to notify the frontend that it needs to update its list of available layers\n\n /** Store the Map Layer source preference. If the same setting exists at a higher level, an error will be thrown and the setting will not be updated.\n *\n * Returns false if the settings object would override some other settings object in a larger scope i.e. storing settings on model when\n * a project setting exists with same name or map layer url.\n * @param source source to be stored on the setting service\n * @param storeOnIModel if true store the settings object on the model, if false store it on the project\n */\n public static async storeSource(source: MapLayerSource, iTwinId: GuidString, iModelId?: GuidString, storeOnIModel?: boolean): Promise<boolean> {\n if (!MapLayersUI.iTwinConfig)\n return false;\n const accessToken = undefined !== IModelApp.authorizationClient ? (await IModelApp.authorizationClient.getAccessToken()) : undefined;\n\n const sourceJSON = source.toJSON();\n const mapLayerSetting: MapLayerPreferencesContent = {\n url: sourceJSON.url,\n name: sourceJSON.name,\n formatId: sourceJSON.formatId,\n transparentBackground: sourceJSON.transparentBackground,\n };\n\n const result: boolean = await MapLayerPreferences.delete(sourceJSON.url, sourceJSON.name, iTwinId, iModelId, storeOnIModel);\n if (result) {\n await MapLayersUI.iTwinConfig.save({\n accessToken,\n content: mapLayerSetting,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: sourceJSON.name,\n iTwinId,\n iModelId: storeOnIModel ? iModelId : undefined,\n });\n MapLayerPreferences.onLayerSourceChanged.raiseEvent(MapLayerSourceChangeType.Added, undefined, MapLayerSource.fromJSON(mapLayerSetting));\n return true;\n } else {\n return false;\n }\n }\n\n /** Replace the old map layer source with a new map layer source.\n *\n * The source is replaced at the same level that the original source is defined. (i.e. if the old source is defined at a project level, the new source will also be defined there.)\n *\n * @param oldSource\n * @param newSource\n * @param iTwinId\n * @param iModelId\n */\n public static async replaceSource(oldSource: MapLayerSource, newSource: MapLayerSource, iTwinId: GuidString, iModelId?: GuidString): Promise<void> {\n if (!MapLayersUI.iTwinConfig)\n return;\n const accessToken = undefined !== IModelApp.authorizationClient ? (await IModelApp.authorizationClient.getAccessToken()) : undefined;\n\n let storeOnIModel = false;\n try {\n await MapLayersUI.iTwinConfig.delete({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: oldSource.name,\n iTwinId,\n iModelId,\n });\n } catch (_err) {\n await MapLayersUI.iTwinConfig.delete({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: oldSource.name,\n iTwinId,\n });\n storeOnIModel = true;\n }\n\n const mapLayerSetting: MapLayerPreferencesContent = {\n url: newSource.url,\n name: newSource.name,\n formatId: newSource.formatId,\n transparentBackground: newSource.transparentBackground,\n };\n\n await MapLayersUI.iTwinConfig.save({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: `${MapLayerPreferences._preferenceNamespace}.${newSource.name}`,\n iTwinId,\n iModelId: storeOnIModel ? iModelId : undefined,\n content: mapLayerSetting,\n });\n\n MapLayerPreferences.onLayerSourceChanged.raiseEvent(MapLayerSourceChangeType.Replaced, oldSource, newSource);\n }\n\n /** Deletes the provided MapLayerSource by name from both the iTwin or iModel level.\n *\n * @param source The source to delete. The name is used to identify the source.\n * @param iTwinId\n * @param iModelId\n */\n public static async deleteByName(source: MapLayerSource, iTwinId: GuidString, iModelId?: GuidString): Promise<void> {\n if (!MapLayersUI.iTwinConfig)\n return;\n const accessToken = undefined !== IModelApp.authorizationClient ? (await IModelApp.authorizationClient.getAccessToken()) : undefined;\n\n try {\n await MapLayersUI.iTwinConfig.delete({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: source.name,\n iTwinId,\n iModelId,\n });\n } catch (_err) {\n // failed to store based on iModelId, attempt using iTwinId\n await MapLayersUI.iTwinConfig.delete({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: source.name,\n iTwinId,\n });\n }\n\n MapLayerPreferences.onLayerSourceChanged.raiseEvent(MapLayerSourceChangeType.Removed, source, undefined);\n }\n\n /** Deletes the current setting with the provided key if it is defined at the same preference level.\n *\n * If the preference is defined within a different level, false will be returned indicating the setting should not be overriden.\n *\n * The two potential preference levels are iTwin and iModel.\n *\n * @param url\n * @param name\n * @param iTwinId\n * @param iModelId\n * @param storeOnIModel\n */\n private static async delete(url: string, name: string, iTwinId: GuidString, iModelId?: GuidString, storeOnIModel?: boolean): Promise<boolean> {\n if (!MapLayersUI.iTwinConfig)\n return true;\n const accessToken = undefined !== IModelApp.authorizationClient ? (await IModelApp.authorizationClient.getAccessToken()) : undefined;\n\n const iTwinPreferenceByName = await MapLayersUI.iTwinConfig.get({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: name,\n iTwinId,\n });\n\n if (undefined !== iTwinPreferenceByName && storeOnIModel) {\n const errorMessage = IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.LayerExistsAsProjectSetting\", { layer: iTwinPreferenceByName.name });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, errorMessage));\n return false;\n } else if (iTwinPreferenceByName) {\n const infoMessage = IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.LayerExistsOverwriting\", { layer: iTwinPreferenceByName.name });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, infoMessage));\n await MapLayersUI.iTwinConfig.delete({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: iTwinPreferenceByName.name,\n iTwinId,\n });\n }\n\n // check if setting with url already exists, if it does, delete it\n const settingFromUrl = await MapLayerPreferences.getByUrl(url, iTwinId, undefined);\n if (settingFromUrl && storeOnIModel) {\n const errorMessage = IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.LayerWithUrlExistsAsProjectSetting\", { url: settingFromUrl.url, name: settingFromUrl.name });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, errorMessage));\n return false;\n } else if (settingFromUrl) {\n const infoMessage = IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.LayerWithUrlExistsOverwriting\", { url: settingFromUrl.url, oldName: settingFromUrl.name, newName: name });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, infoMessage));\n await MapLayersUI.iTwinConfig.delete({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: settingFromUrl.name,\n iTwinId,\n });\n }\n\n if (iModelId) { // delete any settings on model so user can update them if theres collisions\n const settingOnIModelFromName = await MapLayersUI.iTwinConfig.get({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: name,\n iTwinId,\n iModelId,\n });\n const settingFromUrlOnIModel = await MapLayerPreferences.getByUrl(url, iTwinId, iModelId);\n if (settingOnIModelFromName) {\n const infoMessage = IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.LayerExistsOverwriting\", { layer: settingOnIModelFromName.name });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, infoMessage));\n await MapLayersUI.iTwinConfig.delete({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: settingOnIModelFromName.name,\n iTwinId,\n iModelId,\n });\n }\n if (settingFromUrlOnIModel) {\n const infoMessage = IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.LayerWithUrlExistsOverwriting\", { url: settingFromUrlOnIModel.url, oldName: settingFromUrlOnIModel.name, newName: name });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, infoMessage));\n await MapLayersUI.iTwinConfig.delete({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: settingFromUrlOnIModel.name,\n iTwinId,\n iModelId,\n });\n }\n }\n return true;\n }\n\n /** Attempts to get a map layer based off a specific url.\n * @param url\n * @param iTwinId\n * @param iModelId\n */\n public static async getByUrl(url: string, iTwinId: string, iModelId?: string): Promise<MapLayerPreferencesContent | undefined> {\n if (!MapLayersUI.iTwinConfig)\n return undefined;\n\n const accessToken = undefined !== IModelApp.authorizationClient ? (await IModelApp.authorizationClient.getAccessToken()) : undefined;\n\n const settingResponse = await MapLayersUI.iTwinConfig.get({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: \"\",\n iTwinId,\n iModelId,\n });\n\n if (undefined === settingResponse || 0 === settingResponse.length)\n return undefined;\n\n let savedMapLayer;\n settingResponse.settingsMap?.forEach((savedLayer: any) => {\n if (savedLayer.url === url) {\n savedMapLayer = savedLayer;\n }\n });\n return savedMapLayer;\n }\n\n /** Get all MapLayerSources from the user's preferences, iTwin setting and iModel settings.\n * @param iTwinId id of the iTwin\n * @param iModelId id of the iModel\n * @throws if any of the calls to grab settings fail.\n */\n public static async getSources(iTwinId: GuidString, iModelId?: GuidString): Promise<MapLayerSource[]> {\n if (!MapLayersUI.iTwinConfig)\n return [];\n const accessToken = undefined !== IModelApp.authorizationClient ? (await IModelApp.authorizationClient.getAccessToken()) : undefined;\n\n const mapLayerList = [];\n\n try {\n const userResultByProject = await MapLayersUI.iTwinConfig.get({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: \"\",\n iTwinId,\n });\n if (undefined !== userResultByProject)\n mapLayerList.push(userResultByProject);\n } catch (err: any) {\n throw new Error(IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.ErrorRetrieveUserProject\", { errorMessage: err }));\n }\n\n try {\n const userResultByIModel = await MapLayersUI.iTwinConfig.get({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: \"\",\n iTwinId,\n iModelId,\n });\n if (undefined !== userResultByIModel)\n mapLayerList.push(userResultByIModel);\n } catch (err: any) {\n throw new Error(IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.ErrorRetrieveUserProject\", { errorMessage: err }));\n }\n\n const savedMapLayerSources: MapLayerSource[] = [];\n for (const mapLayer of mapLayerList) {\n mapLayer.forEach((savedLayer: any) => {\n const mapLayerSource = MapLayerSource.fromJSON(savedLayer as MapLayerPreferencesContent);\n if (mapLayerSource)\n savedMapLayerSources.push(mapLayerSource);\n });\n }\n return savedMapLayerSources;\n }\n\n private static get _preferenceNamespace() {\n return \"MapLayerSource-SettingsService\";\n }\n}\n"]}
|
package/lib/esm/mapLayers.js
CHANGED
|
@@ -11,10 +11,11 @@ export class MapLayersUI {
|
|
|
11
11
|
}
|
|
12
12
|
/** Used to initialize the Map Layers */
|
|
13
13
|
static async initialize(config) {
|
|
14
|
+
var _a;
|
|
14
15
|
// register namespace containing localized strings for this package
|
|
15
|
-
MapLayersUI.localization = config
|
|
16
|
+
MapLayersUI.localization = (_a = config === null || config === void 0 ? void 0 : config.localization) !== null && _a !== void 0 ? _a : IModelApp.localization;
|
|
16
17
|
await MapLayersUI.localization.registerNamespace(MapLayersUI.localizationNamespace);
|
|
17
|
-
MapLayersUI._iTwinConfig = config
|
|
18
|
+
MapLayersUI._iTwinConfig = config === null || config === void 0 ? void 0 : config.iTwinConfig;
|
|
18
19
|
}
|
|
19
20
|
/** Unregisters internationalization service namespace and UiItemManager */
|
|
20
21
|
static terminate() {
|
package/lib/esm/mapLayers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapLayers.js","sourceRoot":"","sources":["../../src/mapLayers.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAyB,MAAM,sBAAsB,CAAC;AAUxE;;;;;GAKG;AACH,MAAM,OAAO,WAAW;IAMf,MAAM,KAAK,WAAW;QAC3B,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED,wCAAwC;IACjC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,MAAwB
|
|
1
|
+
{"version":3,"file":"mapLayers.js","sourceRoot":"","sources":["../../src/mapLayers.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAyB,MAAM,sBAAsB,CAAC;AAUxE;;;;;GAKG;AACH,MAAM,OAAO,WAAW;IAMf,MAAM,KAAK,WAAW;QAC3B,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED,wCAAwC;IACjC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,MAAwB;;QACrD,mEAAmE;QACnE,WAAW,CAAC,YAAY,GAAG,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,YAAY,mCAAI,SAAS,CAAC,YAAY,CAAC;QAC1E,MAAM,WAAW,CAAC,YAAY,CAAC,iBAAiB,CAC9C,WAAW,CAAC,qBAAqB,CAClC,CAAC;QAEF,WAAW,CAAC,YAAY,GAAG,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,WAAW,CAAC;IACjD,CAAC;IAED,4EAA4E;IACrE,MAAM,CAAC,SAAS;QACrB,SAAS,CAAC,YAAY,CAAC,mBAAmB,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC;IAChF,CAAC;IAED,kDAAkD;IAC3C,MAAM,KAAK,qBAAqB;QACrC,OAAO,WAAW,CAAC,UAAU,CAAC;IAChC,CAAC;;AA5Bc,sBAAU,GAAG,WAAW,CAAC;AAEzB,+BAAmB,GAAa,EAAE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { Localization } from \"@itwin/core-common\";\nimport { IModelApp, UserPreferencesAccess } from \"@itwin/core-frontend\";\n// import { MapLayersUiItemsProvider } from \"./ui/MapLayersUiItemsProvider\";\n// import { FeatureInfoUiItemsProvider } from \"./ui/FeatureInfoUiItemsProvider\";\n\nexport interface MapLayersConfig {\n localization?: Localization;\n /** If an iTwinConfig is provided, it will be used to load the MapLayerSources that are stored. */\n iTwinConfig?: UserPreferencesAccess;\n}\n\n/** MapLayersUI is use when the package is used as a dependency to another app.\n * '''ts\n * await MapLayersUI.initialize({...MapLayersInitProps});\n * '''\n * @beta\n */\nexport class MapLayersUI {\n private static _defaultNs = \"mapLayers\";\n public static localization: Localization;\n private static _uiItemsProvidersId: string[] = [];\n private static _iTwinConfig?: UserPreferencesAccess;\n\n public static get iTwinConfig(): UserPreferencesAccess | undefined {\n return this._iTwinConfig;\n }\n\n /** Used to initialize the Map Layers */\n public static async initialize(config?: MapLayersConfig): Promise<void> {\n // register namespace containing localized strings for this package\n MapLayersUI.localization = config?.localization ?? IModelApp.localization;\n await MapLayersUI.localization.registerNamespace(\n MapLayersUI.localizationNamespace\n );\n\n MapLayersUI._iTwinConfig = config?.iTwinConfig;\n }\n\n /** Unregisters internationalization service namespace and UiItemManager */\n public static terminate() {\n IModelApp.localization.unregisterNamespace(MapLayersUI.localizationNamespace);\n }\n\n /** The internationalization service namespace. */\n public static get localizationNamespace(): string {\n return MapLayersUI._defaultNs;\n }\n}\n"]}
|
|
@@ -13,7 +13,8 @@ export class FeatureInfoUiItemsProvider {
|
|
|
13
13
|
this.id = "FeatureInfoUiItemsProvider";
|
|
14
14
|
}
|
|
15
15
|
provideToolbarItems(_stageId, stageUsage, toolbarUsage, toolbarOrientation) {
|
|
16
|
-
|
|
16
|
+
var _a;
|
|
17
|
+
if (!((_a = this._featureInfoOpts) === null || _a === void 0 ? void 0 : _a.disableDefaultFeatureInfoTool) &&
|
|
17
18
|
stageUsage === StageUsage.General &&
|
|
18
19
|
toolbarUsage === ToolbarUsage.ContentManipulation &&
|
|
19
20
|
toolbarOrientation === ToolbarOrientation.Vertical) {
|
|
@@ -26,7 +27,7 @@ export class FeatureInfoUiItemsProvider {
|
|
|
26
27
|
}
|
|
27
28
|
provideWidgets(_stageId, stageUsage, location, section) {
|
|
28
29
|
const widgets = [];
|
|
29
|
-
const tmpSection = section
|
|
30
|
+
const tmpSection = section !== null && section !== void 0 ? section : StagePanelSection.End;
|
|
30
31
|
if (tmpSection === StagePanelSection.End && stageUsage === StageUsage.General && location === StagePanelLocation.Right) {
|
|
31
32
|
widgets.push({
|
|
32
33
|
id: FeatureInfoUiItemsProvider.widgetId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeatureInfoUiItemsProvider.js","sourceRoot":"","sources":["../../../src/ui/FeatureInfoUiItemsProvider.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,UAAU,EAAE,aAAa,EAAe,kBAAkB,EAAE,YAAY,EAAmB,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACnL,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,yBAAyB,EAAE,mCAAmC,EAAE,MAAM,sBAAsB,CAAC;AAEtG,MAAM,OAAO,0BAA0B;IAIrC,YAA2B,gBAAuC;QAAvC,qBAAgB,GAAhB,gBAAgB,CAAuB;QAHlD,OAAE,GAAG,4BAA4B,CAAC;IAGoB,CAAC;IAEhE,mBAAmB,CACxB,QAAgB,EAChB,UAAkB,EAClB,YAA0B,EAC1B,kBAAsC
|
|
1
|
+
{"version":3,"file":"FeatureInfoUiItemsProvider.js","sourceRoot":"","sources":["../../../src/ui/FeatureInfoUiItemsProvider.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,UAAU,EAAE,aAAa,EAAe,kBAAkB,EAAE,YAAY,EAAmB,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACnL,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3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AY,EAAE,WAAW,CAAC,MAAM;aACjC,CAAC,CAAC;SACJ;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;;AAxCsB,mCAAQ,GAAG,iCAAiC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nimport * as React from \"react\";\nimport { StagePanelLocation, StagePanelSection, StageUsage, ToolbarHelper, ToolbarItem, ToolbarOrientation, ToolbarUsage, UiItemsProvider, WidgetState } from \"@itwin/appui-react\";\nimport { MapFeatureInfoWidget } from \"./widget/FeatureInfoWidget\";\nimport { MapFeatureInfoOptions } from \"./Interfaces\";\nimport { MapLayersUI } from \"../mapLayers\";\nimport { DefaultMapFeatureInfoTool, getDefaultMapFeatureInfoToolItemDef } from \"./MapFeatureInfoTool\";\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 DefaultMapFeatureInfoTool.register(MapLayersUI.localizationNamespace);\n return [\n ToolbarHelper.createToolbarItemFromItemDef(60, getDefaultMapFeatureInfoToolItemDef()),\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: \"icon-map\",\n content: <MapFeatureInfoWidget featureInfoOpts={this._featureInfoOpts} />,\n defaultState: WidgetState.Closed,\n });\n }\n\n return widgets;\n }\n}\n"]}
|