@itwin/map-layers 3.1.0-dev.32 → 3.1.0-dev.35
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/map-layers.d.ts +1 -0
- package/lib/cjs/map-layers.d.ts.map +1 -1
- package/lib/cjs/map-layers.js +1 -0
- package/lib/cjs/map-layers.js.map +1 -1
- package/lib/cjs/mapLayers.d.ts +11 -2
- package/lib/cjs/mapLayers.d.ts.map +1 -1
- package/lib/cjs/mapLayers.js +15 -4
- package/lib/cjs/mapLayers.js.map +1 -1
- package/lib/cjs/public/locales/en/mapLayers.json +4 -0
- package/lib/cjs/ui/FeatureInfoUiItemsProvider.d.ts +17 -0
- package/lib/cjs/ui/FeatureInfoUiItemsProvider.d.ts.map +1 -0
- package/lib/cjs/ui/FeatureInfoUiItemsProvider.js +42 -0
- package/lib/cjs/ui/FeatureInfoUiItemsProvider.js.map +1 -0
- package/lib/cjs/ui/Interfaces.d.ts +7 -0
- package/lib/cjs/ui/Interfaces.d.ts.map +1 -1
- package/lib/cjs/ui/Interfaces.js.map +1 -1
- package/lib/cjs/ui/widget/AttachLayerPopupButton.d.ts.map +1 -1
- package/lib/cjs/ui/widget/AttachLayerPopupButton.js +1 -1
- package/lib/cjs/ui/widget/AttachLayerPopupButton.js.map +1 -1
- package/lib/cjs/ui/widget/FeatureInfoDataProvider.d.ts +42 -0
- package/lib/cjs/ui/widget/FeatureInfoDataProvider.d.ts.map +1 -0
- package/lib/cjs/ui/widget/FeatureInfoDataProvider.js +147 -0
- package/lib/cjs/ui/widget/FeatureInfoDataProvider.js.map +1 -0
- package/lib/cjs/ui/widget/FeatureInfoWidget.d.ts +8 -0
- package/lib/cjs/ui/widget/FeatureInfoWidget.d.ts.map +1 -0
- package/lib/cjs/ui/widget/FeatureInfoWidget.js +70 -0
- package/lib/cjs/ui/widget/FeatureInfoWidget.js.map +1 -0
- package/lib/esm/map-layers.d.ts +1 -0
- package/lib/esm/map-layers.d.ts.map +1 -1
- package/lib/esm/map-layers.js +1 -0
- package/lib/esm/map-layers.js.map +1 -1
- package/lib/esm/mapLayers.d.ts +11 -2
- package/lib/esm/mapLayers.d.ts.map +1 -1
- package/lib/esm/mapLayers.js +15 -4
- package/lib/esm/mapLayers.js.map +1 -1
- package/lib/esm/public/locales/en/mapLayers.json +4 -0
- package/lib/esm/ui/FeatureInfoUiItemsProvider.d.ts +17 -0
- package/lib/esm/ui/FeatureInfoUiItemsProvider.d.ts.map +1 -0
- package/lib/esm/ui/FeatureInfoUiItemsProvider.js +37 -0
- package/lib/esm/ui/FeatureInfoUiItemsProvider.js.map +1 -0
- package/lib/esm/ui/Interfaces.d.ts +7 -0
- package/lib/esm/ui/Interfaces.d.ts.map +1 -1
- package/lib/esm/ui/Interfaces.js.map +1 -1
- package/lib/esm/ui/widget/AttachLayerPopupButton.d.ts.map +1 -1
- package/lib/esm/ui/widget/AttachLayerPopupButton.js +1 -1
- package/lib/esm/ui/widget/AttachLayerPopupButton.js.map +1 -1
- package/lib/esm/ui/widget/FeatureInfoDataProvider.d.ts +42 -0
- package/lib/esm/ui/widget/FeatureInfoDataProvider.d.ts.map +1 -0
- package/lib/esm/ui/widget/FeatureInfoDataProvider.js +143 -0
- package/lib/esm/ui/widget/FeatureInfoDataProvider.js.map +1 -0
- package/lib/esm/ui/widget/FeatureInfoWidget.d.ts +8 -0
- package/lib/esm/ui/widget/FeatureInfoWidget.d.ts.map +1 -0
- package/lib/esm/ui/widget/FeatureInfoWidget.js +66 -0
- package/lib/esm/ui/widget/FeatureInfoWidget.js.map +1 -0
- package/lib/public/locales/en/mapLayers.json +4 -0
- package/package.json +26 -26
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
/** @packageDocumentation
|
|
7
|
+
* @module PropertyGrid
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.FeatureInfoDataProvider = exports.MapFeatureInfoLoadState = void 0;
|
|
11
|
+
const appui_abstract_1 = require("@itwin/appui-abstract");
|
|
12
|
+
const components_react_1 = require("@itwin/components-react");
|
|
13
|
+
const core_bentley_1 = require("@itwin/core-bentley");
|
|
14
|
+
const mapLayers_1 = require("../../mapLayers");
|
|
15
|
+
// import { IPropertyDataProvider, PropertyCategory, PropertyData, PropertyDataChangeEvent } from ""
|
|
16
|
+
/**
|
|
17
|
+
* Implementation of [IPropertyDataProvider] that uses an associative array.
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
var MapFeatureInfoLoadState;
|
|
21
|
+
(function (MapFeatureInfoLoadState) {
|
|
22
|
+
MapFeatureInfoLoadState[MapFeatureInfoLoadState["DataLoadStart"] = 0] = "DataLoadStart";
|
|
23
|
+
MapFeatureInfoLoadState[MapFeatureInfoLoadState["DataLoadEnd"] = 1] = "DataLoadEnd";
|
|
24
|
+
})(MapFeatureInfoLoadState = exports.MapFeatureInfoLoadState || (exports.MapFeatureInfoLoadState = {}));
|
|
25
|
+
class FeatureInfoDataProvider {
|
|
26
|
+
constructor() {
|
|
27
|
+
var _a;
|
|
28
|
+
this.label = appui_abstract_1.PropertyRecord.fromString("");
|
|
29
|
+
this.categories = [];
|
|
30
|
+
this.records = {};
|
|
31
|
+
this.onDataChanged = new components_react_1.PropertyDataChangeEvent();
|
|
32
|
+
this.onDataLoadStateChanged = new core_bentley_1.BeEvent();
|
|
33
|
+
this.onDataUpdated = new core_bentley_1.BeEvent();
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
35
|
+
(_a = mapLayers_1.MapLayersUI.onMapHit) === null || _a === void 0 ? void 0 : _a.addListener(this.handleMapHit, this);
|
|
36
|
+
}
|
|
37
|
+
onUnload() {
|
|
38
|
+
var _a;
|
|
39
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
40
|
+
(_a = mapLayers_1.MapLayersUI.onMapHit) === null || _a === void 0 ? void 0 : _a.removeListener(this.handleMapHit);
|
|
41
|
+
}
|
|
42
|
+
async handleMapHit(mapHit) {
|
|
43
|
+
var _a, _b;
|
|
44
|
+
this.records = {};
|
|
45
|
+
this.categories = [];
|
|
46
|
+
let recordCount = 0;
|
|
47
|
+
if (mapHit === null || mapHit === void 0 ? void 0 : mapHit.isMapHit) {
|
|
48
|
+
this.onDataLoadStateChanged.raiseEvent(MapFeatureInfoLoadState.DataLoadStart);
|
|
49
|
+
const mapInfo = await mapHit.viewport.getMapFeatureInfo(mapHit);
|
|
50
|
+
this.onDataLoadStateChanged.raiseEvent(MapFeatureInfoLoadState.DataLoadEnd);
|
|
51
|
+
if (mapInfo.layerInfo !== undefined) {
|
|
52
|
+
for (const curLayerInfo of mapInfo.layerInfo) {
|
|
53
|
+
const layerCatIdx = this.findCategoryIndexByName(curLayerInfo.layerName);
|
|
54
|
+
let nbRecords = 0;
|
|
55
|
+
const layerCategory = (layerCatIdx === -1 ?
|
|
56
|
+
{ name: curLayerInfo.layerName, label: curLayerInfo.layerName, expand: true, childCategories: [] }
|
|
57
|
+
: this.categories[layerCatIdx]);
|
|
58
|
+
if (curLayerInfo.info && !(curLayerInfo.info instanceof HTMLElement)) {
|
|
59
|
+
// This is not an HTMLElement, so iterate over each sub-layer info
|
|
60
|
+
for (const subLayerInfo of curLayerInfo.info) {
|
|
61
|
+
nbRecords++;
|
|
62
|
+
const subCatIdx = (_a = layerCategory.childCategories) === null || _a === void 0 ? void 0 : _a.findIndex((testCategory) => {
|
|
63
|
+
return testCategory.name === subLayerInfo.subLayerName;
|
|
64
|
+
});
|
|
65
|
+
let subLayerCategory;
|
|
66
|
+
if (subCatIdx === -1) {
|
|
67
|
+
subLayerCategory = { name: subLayerInfo.subLayerName, label: subLayerInfo.subLayerName, expand: true };
|
|
68
|
+
this.addSubCategory(subLayerCategory.name);
|
|
69
|
+
(_b = layerCategory.childCategories) === null || _b === void 0 ? void 0 : _b.push(subLayerCategory);
|
|
70
|
+
}
|
|
71
|
+
if (subLayerInfo.records) {
|
|
72
|
+
for (const record of subLayerInfo.records) {
|
|
73
|
+
// Always use the string value for now
|
|
74
|
+
this.addProperty(record, subLayerInfo.subLayerName);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (layerCatIdx === -1 && nbRecords > 0)
|
|
80
|
+
this.addCategory(layerCategory);
|
|
81
|
+
recordCount = recordCount + nbRecords;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
this.onDataUpdated.raiseEvent({ recordCount });
|
|
86
|
+
this.onDataChanged.raiseEvent();
|
|
87
|
+
}
|
|
88
|
+
addSubCategory(categoryName) {
|
|
89
|
+
this.records[categoryName] = [];
|
|
90
|
+
}
|
|
91
|
+
addCategory(category) {
|
|
92
|
+
const categoryIdx = this.categories.push(category) - 1;
|
|
93
|
+
this.records[this.categories[categoryIdx].name] = [];
|
|
94
|
+
return categoryIdx;
|
|
95
|
+
}
|
|
96
|
+
findCategoryIndex(category) {
|
|
97
|
+
const index = this.categories.findIndex((testCategory) => {
|
|
98
|
+
return testCategory.name === category.name;
|
|
99
|
+
});
|
|
100
|
+
return index;
|
|
101
|
+
}
|
|
102
|
+
findCategoryIndexByName(name) {
|
|
103
|
+
const index = this.categories.findIndex((testCategory) => {
|
|
104
|
+
return testCategory.name === name;
|
|
105
|
+
});
|
|
106
|
+
return index;
|
|
107
|
+
}
|
|
108
|
+
addProperty(propertyRecord, categoryName) {
|
|
109
|
+
const idx = this.records[categoryName].findIndex((prop) => prop.property.name === propertyRecord.property.name);
|
|
110
|
+
if (idx === -1) {
|
|
111
|
+
this.records[categoryName].push(propertyRecord);
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
this.records[categoryName][idx].isMerged = true;
|
|
115
|
+
this.records[categoryName][idx].isReadonly = true;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
removeProperty(propertyRecord, categoryIdx) {
|
|
119
|
+
const index = this.records[this.categories[categoryIdx].name].findIndex((record) => {
|
|
120
|
+
return record === propertyRecord;
|
|
121
|
+
});
|
|
122
|
+
let result = false;
|
|
123
|
+
if (index >= 0) {
|
|
124
|
+
this.records[this.categories[categoryIdx].name].splice(index, 1);
|
|
125
|
+
this.onDataChanged.raiseEvent();
|
|
126
|
+
result = true;
|
|
127
|
+
}
|
|
128
|
+
return result;
|
|
129
|
+
}
|
|
130
|
+
replaceProperty(propertyRecord, categoryIdx, newRecord) {
|
|
131
|
+
const index = this.records[this.categories[categoryIdx].name].findIndex((record) => {
|
|
132
|
+
return record === propertyRecord;
|
|
133
|
+
});
|
|
134
|
+
let result = false;
|
|
135
|
+
// istanbul ignore else
|
|
136
|
+
if (index >= 0) {
|
|
137
|
+
this.records[this.categories[categoryIdx].name].splice(index, 1, newRecord);
|
|
138
|
+
result = true;
|
|
139
|
+
}
|
|
140
|
+
return result;
|
|
141
|
+
}
|
|
142
|
+
async getData() {
|
|
143
|
+
return this;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
exports.FeatureInfoDataProvider = FeatureInfoDataProvider;
|
|
147
|
+
//# sourceMappingURL=FeatureInfoDataProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FeatureInfoDataProvider.js","sourceRoot":"","sources":["../../../../src/ui/widget/FeatureInfoDataProvider.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,0DAAwD;AACxD,8DAAyH;AACzH,sDAA8C;AAE9C,+CAA8C;AAC9C,oGAAoG;AAEpG;;;GAGG;AAEH,IAAY,uBAAoD;AAAhE,WAAY,uBAAuB;IAAE,uFAAa,CAAA;IAAE,mFAAW,CAAA;AAAA,CAAC,EAApD,uBAAuB,G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,CAAC,CAAC,CAAC;QAEH,IAAI,MAAM,GAAG,KAAK,CAAC;QAEnB,uBAAuB;QACvB,IAAI,KAAK,IAAI,CAAC,EAAE;YACd,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC;YAC5E,MAAM,GAAG,IAAI,CAAC;SACf;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAEM,KAAK,CAAC,OAAO;QAClB,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AArID,0DAqIC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module PropertyGrid\r\n */\r\n\r\nimport { PropertyRecord } from \"@itwin/appui-abstract\";\r\nimport { IPropertyDataProvider, PropertyCategory, PropertyData, PropertyDataChangeEvent } from \"@itwin/components-react\";\r\nimport { BeEvent } from \"@itwin/core-bentley\";\r\nimport { HitDetail } from \"@itwin/core-frontend\";\r\nimport { MapLayersUI } from \"../../mapLayers\";\r\n// import { IPropertyDataProvider, PropertyCategory, PropertyData, PropertyDataChangeEvent } from \"\"\r\n\r\n/**\r\n * Implementation of [IPropertyDataProvider] that uses an associative array.\r\n * @public\r\n */\r\n\r\nexport enum MapFeatureInfoLoadState {DataLoadStart, DataLoadEnd}\r\nexport declare type MapFeatureInfoLoadListener = (state: MapFeatureInfoLoadState) => void;\r\n\r\nexport interface MapFeatureInfoDataUpdate {\r\n recordCount: number;\r\n}\r\nexport declare type MapFeatureInfoDataUpdatedListener = (data: MapFeatureInfoDataUpdate) => void;\r\n\r\nexport class FeatureInfoDataProvider implements IPropertyDataProvider, PropertyData {\r\n public label: PropertyRecord = PropertyRecord.fromString(\"\");\r\n public description?: string;\r\n public categories: PropertyCategory[] = [];\r\n public records: { [categoryName: string]: PropertyRecord[] } = {};\r\n public onDataChanged = new PropertyDataChangeEvent();\r\n public onDataLoadStateChanged = new BeEvent<MapFeatureInfoLoadListener>();\r\n public onDataUpdated = new BeEvent<MapFeatureInfoDataUpdatedListener>();\r\n constructor() {\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n MapLayersUI.onMapHit?.addListener(this.handleMapHit, this);\r\n }\r\n\r\n public onUnload() {\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n MapLayersUI.onMapHit?.removeListener(this.handleMapHit);\r\n }\r\n\r\n private async handleMapHit(mapHit: HitDetail) {\r\n this.records = {};\r\n this.categories = [];\r\n let recordCount = 0;\r\n if (mapHit?.isMapHit) {\r\n this.onDataLoadStateChanged.raiseEvent(MapFeatureInfoLoadState.DataLoadStart);\r\n const mapInfo = await mapHit.viewport.getMapFeatureInfo(mapHit);\r\n this.onDataLoadStateChanged.raiseEvent(MapFeatureInfoLoadState.DataLoadEnd);\r\n if (mapInfo.layerInfo !== undefined ) {\r\n for (const curLayerInfo of mapInfo.layerInfo) {\r\n const layerCatIdx = this.findCategoryIndexByName(curLayerInfo.layerName);\r\n let nbRecords = 0;\r\n const layerCategory = (\r\n layerCatIdx === -1 ?\r\n {name:curLayerInfo.layerName, label:curLayerInfo.layerName, expand:true, childCategories:[]}\r\n : this.categories[layerCatIdx] );\r\n\r\n if (curLayerInfo.info && !(curLayerInfo.info instanceof HTMLElement)) {\r\n // This is not an HTMLElement, so iterate over each sub-layer info\r\n for (const subLayerInfo of curLayerInfo.info) {\r\n nbRecords++;\r\n const subCatIdx = layerCategory.childCategories?.findIndex((testCategory: PropertyCategory) => {\r\n return testCategory.name === subLayerInfo.subLayerName;\r\n });\r\n let subLayerCategory;\r\n if (subCatIdx === -1) {\r\n subLayerCategory = {name:subLayerInfo.subLayerName, label:subLayerInfo.subLayerName, expand:true};\r\n this.addSubCategory(subLayerCategory.name);\r\n layerCategory.childCategories?.push(subLayerCategory);\r\n }\r\n if (subLayerInfo.records) {\r\n for (const record of subLayerInfo.records) {\r\n // Always use the string value for now\r\n this.addProperty(record, subLayerInfo.subLayerName);\r\n\r\n }\r\n }\r\n }\r\n }\r\n if (layerCatIdx === -1 && nbRecords>0)\r\n this.addCategory(layerCategory);\r\n\r\n recordCount = recordCount + nbRecords;\r\n }\r\n }\r\n }\r\n this.onDataUpdated.raiseEvent({recordCount});\r\n this.onDataChanged.raiseEvent();\r\n }\r\n\r\n public addSubCategory(categoryName: string) {\r\n this.records[categoryName] = [];\r\n }\r\n public addCategory(category: PropertyCategory): number {\r\n const categoryIdx = this.categories.push(category) - 1;\r\n this.records[this.categories[categoryIdx].name] = [];\r\n return categoryIdx;\r\n }\r\n\r\n public findCategoryIndex(category: PropertyCategory): number {\r\n const index = this.categories.findIndex((testCategory: PropertyCategory) => {\r\n return testCategory.name === category.name;\r\n });\r\n return index;\r\n }\r\n public findCategoryIndexByName(name: string): number {\r\n const index = this.categories.findIndex((testCategory: PropertyCategory) => {\r\n return testCategory.name === name;\r\n });\r\n return index;\r\n }\r\n\r\n public addProperty(propertyRecord: PropertyRecord, categoryName: string): void {\r\n const idx = this.records[categoryName].findIndex((prop)=> prop.property.name === propertyRecord.property.name);\r\n if (idx === -1) {\r\n this.records[categoryName].push(propertyRecord);\r\n } else {\r\n this.records[categoryName][idx].isMerged = true;\r\n this.records[categoryName][idx].isReadonly = true;\r\n }\r\n }\r\n\r\n public removeProperty(propertyRecord: PropertyRecord, categoryIdx: number): boolean {\r\n const index = this.records[this.categories[categoryIdx].name].findIndex((record: PropertyRecord) => {\r\n return record === propertyRecord;\r\n });\r\n\r\n let result = false;\r\n\r\n if (index >= 0) {\r\n this.records[this.categories[categoryIdx].name].splice(index, 1);\r\n this.onDataChanged.raiseEvent();\r\n result = true;\r\n }\r\n return result;\r\n }\r\n\r\n public replaceProperty(propertyRecord: PropertyRecord, categoryIdx: number, newRecord: PropertyRecord): boolean {\r\n const index = this.records[this.categories[categoryIdx].name].findIndex((record: PropertyRecord) => {\r\n return record === propertyRecord;\r\n });\r\n\r\n let result = false;\r\n\r\n // istanbul ignore else\r\n if (index >= 0) {\r\n this.records[this.categories[categoryIdx].name].splice(index, 1, newRecord);\r\n result = true;\r\n }\r\n return result;\r\n }\r\n\r\n public async getData(): Promise<PropertyData> {\r\n return this;\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { MapFeatureInfoOptions } from "../Interfaces";
|
|
3
|
+
interface MapFeatureInfoWidgetProps {
|
|
4
|
+
featureInfoOpts?: MapFeatureInfoOptions;
|
|
5
|
+
}
|
|
6
|
+
export declare function MapFeatureInfoWidget(props: MapFeatureInfoWidgetProps): JSX.Element;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=FeatureInfoWidget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FeatureInfoWidget.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/FeatureInfoWidget.tsx"],"names":[],"mappings":";AAWA,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAGtD,UAAU,yBAAyB;IACjC,eAAe,CAAC,EAAE,qBAAqB,CAAC;CACzC;AAGD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,eAoDpE"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MapFeatureInfoWidget = void 0;
|
|
4
|
+
/*---------------------------------------------------------------------------------------------
|
|
5
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
6
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
7
|
+
*--------------------------------------------------------------------------------------------*/
|
|
8
|
+
const React = require("react");
|
|
9
|
+
const components_react_1 = require("@itwin/components-react");
|
|
10
|
+
const core_react_1 = require("@itwin/core-react");
|
|
11
|
+
const FeatureInfoDataProvider_1 = require("./FeatureInfoDataProvider");
|
|
12
|
+
const itwinui_react_1 = require("@itwin/itwinui-react");
|
|
13
|
+
const MapLayersUiItemsProvider_1 = require("../MapLayersUiItemsProvider");
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
15
|
+
function MapFeatureInfoWidget(props) {
|
|
16
|
+
var _a, _b, _c;
|
|
17
|
+
const dataProvider = React.useRef();
|
|
18
|
+
const [loadingData, setLoadingData] = React.useState(false);
|
|
19
|
+
const [hasData, setHasData] = React.useState(false);
|
|
20
|
+
const [noRecordsMessage] = React.useState(MapLayersUiItemsProvider_1.MapLayersUiItemsProvider.localization.getLocalizedString("mapLayers:FeatureInfoWidget.NoRecords"));
|
|
21
|
+
const handleLoadStateChange = (state) => {
|
|
22
|
+
setLoadingData(state === FeatureInfoDataProvider_1.MapFeatureInfoLoadState.DataLoadStart);
|
|
23
|
+
};
|
|
24
|
+
const handleDataUpdated = (state) => {
|
|
25
|
+
setHasData(state.recordCount !== 0);
|
|
26
|
+
};
|
|
27
|
+
React.useEffect(() => {
|
|
28
|
+
dataProvider.current = new FeatureInfoDataProvider_1.FeatureInfoDataProvider();
|
|
29
|
+
return () => {
|
|
30
|
+
var _a;
|
|
31
|
+
(_a = dataProvider === null || dataProvider === void 0 ? void 0 : dataProvider.current) === null || _a === void 0 ? void 0 : _a.onUnload();
|
|
32
|
+
};
|
|
33
|
+
}, []);
|
|
34
|
+
React.useEffect(() => {
|
|
35
|
+
var _a;
|
|
36
|
+
(_a = dataProvider.current) === null || _a === void 0 ? void 0 : _a.onDataUpdated.addListener(handleDataUpdated);
|
|
37
|
+
return () => {
|
|
38
|
+
var _a;
|
|
39
|
+
(_a = dataProvider.current) === null || _a === void 0 ? void 0 : _a.onDataUpdated.removeListener(handleDataUpdated);
|
|
40
|
+
};
|
|
41
|
+
}, []);
|
|
42
|
+
React.useEffect(() => {
|
|
43
|
+
var _a, _b;
|
|
44
|
+
if ((_a = props.featureInfoOpts) === null || _a === void 0 ? void 0 : _a.showLoadProgressAnimation) {
|
|
45
|
+
(_b = dataProvider.current) === null || _b === void 0 ? void 0 : _b.onDataLoadStateChanged.addListener(handleLoadStateChange);
|
|
46
|
+
return () => {
|
|
47
|
+
var _a;
|
|
48
|
+
(_a = dataProvider.current) === null || _a === void 0 ? void 0 : _a.onDataLoadStateChanged.removeListener(handleLoadStateChange);
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
return;
|
|
52
|
+
}, [(_a = props.featureInfoOpts) === null || _a === void 0 ? void 0 : _a.showLoadProgressAnimation]);
|
|
53
|
+
if (loadingData) {
|
|
54
|
+
return (React.createElement(core_react_1.FillCentered, null,
|
|
55
|
+
React.createElement(itwinui_react_1.ProgressRadial, { indeterminate: true })));
|
|
56
|
+
}
|
|
57
|
+
else if (!hasData) {
|
|
58
|
+
return (React.createElement(core_react_1.FillCentered, null,
|
|
59
|
+
React.createElement("span", null,
|
|
60
|
+
React.createElement("i", null, noRecordsMessage))));
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
if (dataProvider.current)
|
|
64
|
+
return (React.createElement(components_react_1.PropertyGrid, { dataProvider: dataProvider.current, orientation: core_react_1.Orientation.Vertical, isPropertySelectionEnabled: (_c = (_b = props.featureInfoOpts) === null || _b === void 0 ? void 0 : _b.propertyGridOptions) === null || _c === void 0 ? void 0 : _c.isPropertySelectionEnabled }));
|
|
65
|
+
else
|
|
66
|
+
return (React.createElement(React.Fragment, null));
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
exports.MapFeatureInfoWidget = MapFeatureInfoWidget;
|
|
70
|
+
//# sourceMappingURL=FeatureInfoWidget.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FeatureInfoWidget.js","sourceRoot":"","sources":["../../../../src/ui/widget/FeatureInfoWidget.tsx"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,+BAA+B;AAE/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,iBAAiB,CAAC,CAAC;QACxE,CAAC,CAAC;IAEJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;;QACnB,IAAI,MAAA,KAAK,CAAC,eAAe,0CAAE,yBAAyB,EAAE;YACpD,MAAA,YAAY,CAAC,OAAO,0CAAE,sBAAsB,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC;YAChF,OAAO,GAAG,EAAE;;gBACV,MAAA,YAAY,CAAC,OAAO,0CAAE,sBAAsB,CAAC,cAAc,CAAC,qBAAqB,CAAC,CAAC;YACrF,CAAC,CAAC;SACH;QACD,OAAO;IAET,CAAC,EAAE,CAAE,MAAA,KAAK,CAAC,eAAe,0CAAE,yBAAyB,CAAC,CAAC,CAAC;IAExD,IAAI,WAAW,EAAE;QACf,OAAO,CAAC,oBAAC,yBAAY;YAAC,oBAAC,8BAAc,IAAC,aAAa,EAAE,IAAI,GAAmB,CAAe,CAAC,CAAC;KAC9F;SAAM,IAAI,CAAC,OAAO,EAAE;QACnB,OAAO,CAAC,oBAAC,yBAAY;YAAC;gBAAM,+BAAI,gBAAgB,CAAK,CAAO,CAAe,CAAC,CAAC;KAC9E;SAAK;QACJ,IAAI,YAAY,CAAC,OAAO;YACtB,OAAO,CAAC,oBAAC,+BAAY,IAAC,YAAY,EAAE,YAAY,CAAC,OAAO,EAAE,WAAW,EAAE,wBAAW,CAAC,QAAQ,EACzF,0BAA0B,EAAE,MAAA,MAAA,KAAK,CAAC,eAAe,0CAAE,mBAAmB,0CAAE,0BAA0B,GAAI,CAAC,CAAC;;YAE1G,OAAO,CAAC,yCAAK,CAAC,CAAC;KAClB;AACH,CAAC;AApDD,oDAoDC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport * as React from \"react\";\r\n\r\nimport { PropertyGrid} from \"@itwin/components-react\";\r\nimport { FillCentered, Orientation } from \"@itwin/core-react\";\r\n\r\nimport { FeatureInfoDataProvider, MapFeatureInfoDataUpdate, MapFeatureInfoLoadState } from \"./FeatureInfoDataProvider\";\r\nimport { ProgressRadial } from \"@itwin/itwinui-react\";\r\nimport { MapFeatureInfoOptions } from \"../Interfaces\";\r\nimport { MapLayersUiItemsProvider } from \"../MapLayersUiItemsProvider\";\r\n\r\ninterface MapFeatureInfoWidgetProps {\r\n featureInfoOpts?: MapFeatureInfoOptions;\r\n}\r\n\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function MapFeatureInfoWidget(props: MapFeatureInfoWidgetProps) {\r\n\r\n const dataProvider = React.useRef<FeatureInfoDataProvider>();\r\n const [loadingData, setLoadingData] = React.useState<boolean>(false);\r\n const [hasData, setHasData] = React.useState<boolean>(false);\r\n const [noRecordsMessage] = React.useState(MapLayersUiItemsProvider.localization.getLocalizedString(\"mapLayers:FeatureInfoWidget.NoRecords\"));\r\n\r\n const handleLoadStateChange = (state: MapFeatureInfoLoadState) => {\r\n setLoadingData(state === MapFeatureInfoLoadState.DataLoadStart);\r\n };\r\n const handleDataUpdated = (state: MapFeatureInfoDataUpdate) => {\r\n setHasData(state.recordCount !== 0);\r\n };\r\n\r\n React.useEffect(() => {\r\n dataProvider.current = new FeatureInfoDataProvider();\r\n return () => {\r\n dataProvider?.current?.onUnload();\r\n };\r\n }, []);\r\n\r\n React.useEffect(() => {\r\n\r\n dataProvider.current?.onDataUpdated.addListener(handleDataUpdated);\r\n return () => {\r\n dataProvider.current?.onDataUpdated.removeListener(handleDataUpdated);\r\n };\r\n\r\n }, []);\r\n\r\n React.useEffect(() => {\r\n if (props.featureInfoOpts?.showLoadProgressAnimation) {\r\n dataProvider.current?.onDataLoadStateChanged.addListener(handleLoadStateChange);\r\n return () => {\r\n dataProvider.current?.onDataLoadStateChanged.removeListener(handleLoadStateChange);\r\n };\r\n }\r\n return;\r\n\r\n }, [ props.featureInfoOpts?.showLoadProgressAnimation]);\r\n\r\n if (loadingData) {\r\n return (<FillCentered><ProgressRadial indeterminate={true}></ProgressRadial></FillCentered>);\r\n } else if (!hasData) {\r\n return (<FillCentered><span><i>{noRecordsMessage}</i></span></FillCentered>);\r\n } else{\r\n if (dataProvider.current)\r\n return (<PropertyGrid dataProvider={dataProvider.current} orientation={Orientation.Vertical}\r\n isPropertySelectionEnabled={props.featureInfoOpts?.propertyGridOptions?.isPropertySelectionEnabled} />);\r\n else\r\n return (<></>);\r\n }\r\n}\r\n"]}
|
package/lib/esm/map-layers.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map-layers.d.ts","sourceRoot":"","sources":["../../src/map-layers.ts"],"names":[],"mappings":"AAIA,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC"}
|
|
1
|
+
{"version":3,"file":"map-layers.d.ts","sourceRoot":"","sources":["../../src/map-layers.ts"],"names":[],"mappings":"AAIA,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC"}
|
package/lib/esm/map-layers.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map-layers.js","sourceRoot":"","sources":["../../src/map-layers.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nexport * from \"./mapLayers\";\r\nexport * from \"./ui/Interfaces\";\r\nexport * from \"./ui/MapLayersUiItemsProvider\";\r\nexport * from \"./ui/widget/MapLayersWidget\";\r\n"]}
|
|
1
|
+
{"version":3,"file":"map-layers.js","sourceRoot":"","sources":["../../src/map-layers.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nexport * from \"./mapLayers\";\r\nexport * from \"./ui/Interfaces\";\r\nexport * from \"./ui/MapLayersUiItemsProvider\";\r\nexport * from \"./ui/FeatureInfoUiItemsProvider\";\r\nexport * from \"./ui/widget/MapLayersWidget\";\r\n"]}
|
package/lib/esm/mapLayers.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import { UserPreferencesAccess } from "@itwin/core-frontend";
|
|
1
|
+
import { HitDetail, UserPreferencesAccess } from "@itwin/core-frontend";
|
|
2
|
+
import { BeEvent } from "@itwin/core-bentley";
|
|
3
|
+
export declare type MapHitEvent = BeEvent<(hit: HitDetail) => void>;
|
|
4
|
+
export interface FeatureInfoOpts {
|
|
5
|
+
onMapHit: MapHitEvent;
|
|
6
|
+
}
|
|
2
7
|
/** MapLayersUI is use when the package is used as a dependency to another app.
|
|
3
8
|
* '''ts
|
|
4
9
|
* await MapLayersUI.initialize(registerItemsProvider);
|
|
@@ -7,10 +12,14 @@ import { UserPreferencesAccess } from "@itwin/core-frontend";
|
|
|
7
12
|
*/
|
|
8
13
|
export declare class MapLayersUI {
|
|
9
14
|
private static _defaultNs;
|
|
15
|
+
private static _mapLayersItemsProvider;
|
|
16
|
+
private static _mapFeatureInfoItemsProvider;
|
|
10
17
|
private static _uiItemsProvider;
|
|
11
18
|
private static _itemsProviderRegistered?;
|
|
12
19
|
private static _iTwinConfig?;
|
|
20
|
+
private static _onMapHit?;
|
|
13
21
|
static get iTwinConfig(): UserPreferencesAccess | undefined;
|
|
22
|
+
static get onMapHit(): MapHitEvent | undefined;
|
|
14
23
|
/** Used to initialize the Map Layers.
|
|
15
24
|
*
|
|
16
25
|
* If `registerItemsProvider` is true, the UiItemsProvider will automatically insert the UI items into the host applications UI.
|
|
@@ -23,7 +32,7 @@ export declare class MapLayersUI {
|
|
|
23
32
|
*
|
|
24
33
|
* If an iTwinConfig is provided, it will be used to load the MapLayerSources that are stored.
|
|
25
34
|
*/
|
|
26
|
-
static initialize(registerItemsProvider?: boolean, iTwinConfig?: UserPreferencesAccess): Promise<void>;
|
|
35
|
+
static initialize(registerItemsProvider?: boolean, iTwinConfig?: UserPreferencesAccess, fInfoOps?: FeatureInfoOpts): Promise<void>;
|
|
27
36
|
/** Unregisters internationalization service namespace and UiItemManager / control */
|
|
28
37
|
static terminate(): void;
|
|
29
38
|
/** The internationalization service namespace. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapLayers.d.ts","sourceRoot":"","sources":["../../src/mapLayers.ts"],"names":[],"mappings":"AAIA,OAAO,EAAa,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"mapLayers.d.ts","sourceRoot":"","sources":["../../src/mapLayers.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAa,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAGnF,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAG9C,oBAAY,WAAW,GAAG,OAAO,CAAC,CAAC,GAAG,EAAE,SAAS,KAAK,IAAI,CAAC,CAAC;AAC5D,MAAM,WAAW,eAAe;IAK9B,QAAQ,EAAE,WAAW,CAAC;CACvB;AAED;;;;;GAKG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAC,UAAU,CAAe;IACxC,OAAO,CAAC,MAAM,CAAC,uBAAuB,CAA2B;IACjE,OAAO,CAAC,MAAM,CAAC,4BAA4B,CAA6B;IACxE,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAA2B;IAC1D,OAAO,CAAC,MAAM,CAAC,wBAAwB,CAAC,CAAU;IAElD,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,CAAwB;IACpD,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAc;IAEvC,WAAkB,WAAW,IAAI,qBAAqB,GAAG,SAAS,CAA8B;IAChG,WAAkB,QAAQ,IAAI,WAAW,GAAG,SAAS,CAA2B;IAEhF;;;;;;;;;;;OAWG;WACiB,UAAU,CAC5B,qBAAqB,UAAO,EAC5B,WAAW,CAAC,EAAE,qBAAqB,EACnC,QAAQ,CAAC,EAAE,eAAe,GACzB,OAAO,CAAC,IAAI,CAAC;IAuBhB,qFAAqF;WACvE,SAAS;IAevB,kDAAkD;IAClD,WAAkB,qBAAqB,IAAI,MAAM,CAEhD;CACF"}
|
package/lib/esm/mapLayers.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import { IModelApp } from "@itwin/core-frontend";
|
|
6
6
|
import { MapLayersUiItemsProvider } from "./ui/MapLayersUiItemsProvider";
|
|
7
7
|
import { UiItemsManager } from "@itwin/appui-abstract";
|
|
8
|
+
import { FeatureInfoUiItemsProvider } from "./ui/FeatureInfoUiItemsProvider";
|
|
8
9
|
/** MapLayersUI is use when the package is used as a dependency to another app.
|
|
9
10
|
* '''ts
|
|
10
11
|
* await MapLayersUI.initialize(registerItemsProvider);
|
|
@@ -13,6 +14,7 @@ import { UiItemsManager } from "@itwin/appui-abstract";
|
|
|
13
14
|
*/
|
|
14
15
|
export class MapLayersUI {
|
|
15
16
|
static get iTwinConfig() { return this._iTwinConfig; }
|
|
17
|
+
static get onMapHit() { return this._onMapHit; }
|
|
16
18
|
/** Used to initialize the Map Layers.
|
|
17
19
|
*
|
|
18
20
|
* If `registerItemsProvider` is true, the UiItemsProvider will automatically insert the UI items into the host applications UI.
|
|
@@ -25,14 +27,20 @@ export class MapLayersUI {
|
|
|
25
27
|
*
|
|
26
28
|
* If an iTwinConfig is provided, it will be used to load the MapLayerSources that are stored.
|
|
27
29
|
*/
|
|
28
|
-
static async initialize(registerItemsProvider = true, iTwinConfig) {
|
|
30
|
+
static async initialize(registerItemsProvider = true, iTwinConfig, fInfoOps) {
|
|
29
31
|
MapLayersUI._iTwinConfig = iTwinConfig;
|
|
32
|
+
MapLayersUI._onMapHit = fInfoOps === null || fInfoOps === void 0 ? void 0 : fInfoOps.onMapHit;
|
|
30
33
|
// register namespace containing localized strings for this package
|
|
31
34
|
await IModelApp.localization.registerNamespace(this.localizationNamespace);
|
|
32
35
|
// _uiItemsProvider always created to provide access to localization.
|
|
33
|
-
MapLayersUI.
|
|
36
|
+
MapLayersUI._mapLayersItemsProvider = new MapLayersUiItemsProvider(IModelApp.localization);
|
|
37
|
+
MapLayersUI._mapFeatureInfoItemsProvider = new FeatureInfoUiItemsProvider(IModelApp.localization);
|
|
34
38
|
if (registerItemsProvider) {
|
|
35
|
-
UiItemsManager.register(MapLayersUI.
|
|
39
|
+
UiItemsManager.register(MapLayersUI._mapLayersItemsProvider);
|
|
40
|
+
// Register the FeatureInfo widget only if MapHit was provided.
|
|
41
|
+
if (MapLayersUI._onMapHit) {
|
|
42
|
+
UiItemsManager.register(MapLayersUI._mapFeatureInfoItemsProvider);
|
|
43
|
+
}
|
|
36
44
|
}
|
|
37
45
|
MapLayersUI._itemsProviderRegistered = registerItemsProvider;
|
|
38
46
|
}
|
|
@@ -41,7 +49,10 @@ export class MapLayersUI {
|
|
|
41
49
|
IModelApp.localization.unregisterNamespace(this.localizationNamespace);
|
|
42
50
|
if (MapLayersUI._itemsProviderRegistered !== undefined) {
|
|
43
51
|
if (MapLayersUI._itemsProviderRegistered) {
|
|
44
|
-
UiItemsManager.unregister(MapLayersUI.
|
|
52
|
+
UiItemsManager.unregister(MapLayersUI._mapLayersItemsProvider.id);
|
|
53
|
+
if (MapLayersUI._onMapHit) {
|
|
54
|
+
UiItemsManager.unregister(MapLayersUI._mapFeatureInfoItemsProvider.id);
|
|
55
|
+
}
|
|
45
56
|
}
|
|
46
57
|
MapLayersUI._itemsProviderRegistered = undefined;
|
|
47
58
|
}
|
package/lib/esm/mapLayers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapLayers.js","sourceRoot":"","sources":["../../src/mapLayers.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,
|
|
1
|
+
{"version":3,"file":"mapLayers.js","sourceRoot":"","sources":["../../src/mapLayers.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAa,SAAS,EAAyB,MAAM,sBAAsB,CAAC;AACnF,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAW7E;;;;;GAKG;AACH,MAAM,OAAO,WAAW;IAUf,MAAM,KAAK,WAAW,KAAwC,OAAO,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;IACzF,MAAM,KAAK,QAAQ,KAA8B,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IAEhF;;;;;;;;;;;OAWG;IACI,MAAM,CAAC,KAAK,CAAC,UAAU,CAC5B,qBAAqB,GAAG,IAAI,EAC5B,WAAmC,EACnC,QAA0B;QAG1B,WAAW,CAAC,YAAY,GAAG,WAAW,CAAC;QACvC,WAAW,CAAC,SAAS,GAAG,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,QAAQ,CAAC;QAE3C,mEAAmE;QACnE,MAAM,SAAS,CAAC,YAAY,CAAC,iBAAiB,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;QAE3E,qEAAqE;QACrE,WAAW,CAAC,uBAAuB,GAAG,IAAI,wBAAwB,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;QAC3F,WAAW,CAAC,4BAA4B,GAAG,IAAI,0BAA0B,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;QAClG,IAAI,qBAAqB,EAAE;YACzB,cAAc,CAAC,QAAQ,CAAC,WAAW,CAAC,uBAAuB,CAAC,CAAC;YAE7D,+DAA+D;YAC/D,IAAI,WAAW,CAAC,SAAS,EAAE;gBACzB,cAAc,CAAC,QAAQ,CAAC,WAAW,CAAC,4BAA4B,CAAC,CAAC;aACnE;SACF;QAED,WAAW,CAAC,wBAAwB,GAAG,qBAAqB,CAAC;IAC/D,CAAC;IAED,qFAAqF;IAC9E,MAAM,CAAC,SAAS;QACrB,SAAS,CAAC,YAAY,CAAC,mBAAmB,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;QAEvE,IAAI,WAAW,CAAC,wBAAwB,KAAK,SAAS,EAAE;YACtD,IAAI,WAAW,CAAC,wBAAwB,EAAE;gBACxC,cAAc,CAAC,UAAU,CAAC,WAAW,CAAC,uBAAuB,CAAC,EAAE,CAAC,CAAC;gBAElE,IAAI,WAAW,CAAC,SAAS,EAAE;oBACzB,cAAc,CAAC,UAAU,CAAC,WAAW,CAAC,4BAA4B,CAAC,EAAE,CAAC,CAAC;iBACxE;aACF;YACD,WAAW,CAAC,wBAAwB,GAAG,SAAS,CAAC;SAClD;IACH,CAAC;IAED,kDAAkD;IAC3C,MAAM,KAAK,qBAAqB;QACrC,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;;AAtEc,sBAAU,GAAG,WAAW,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport { HitDetail, IModelApp, UserPreferencesAccess } from \"@itwin/core-frontend\";\r\nimport { MapLayersUiItemsProvider } from \"./ui/MapLayersUiItemsProvider\";\r\nimport { UiItemsManager } from \"@itwin/appui-abstract\";\r\nimport { BeEvent } from \"@itwin/core-bentley\";\r\nimport { FeatureInfoUiItemsProvider } from \"./ui/FeatureInfoUiItemsProvider\";\r\n\r\nexport type MapHitEvent = BeEvent<(hit: HitDetail) => void>;\r\nexport interface FeatureInfoOpts\r\n{\r\n // HitDetail Event whenever the map is clicked.\r\n // Typically the HitDetail object is provided by ElementLocateManager.doLocate.\r\n // Every time this event is raised, FeatureInfoWidget will attempt to retrieve data from MapLayerImageryProviders.\r\n onMapHit: MapHitEvent;\r\n}\r\n\r\n/** MapLayersUI is use when the package is used as a dependency to another app.\r\n * '''ts\r\n * await MapLayersUI.initialize(registerItemsProvider);\r\n * '''\r\n * @beta\r\n */\r\nexport class MapLayersUI {\r\n private static _defaultNs = \"mapLayers\";\r\n private static _mapLayersItemsProvider: MapLayersUiItemsProvider;\r\n private static _mapFeatureInfoItemsProvider: FeatureInfoUiItemsProvider;\r\n private static _uiItemsProvider: MapLayersUiItemsProvider;\r\n private static _itemsProviderRegistered?: boolean;\r\n\r\n private static _iTwinConfig?: UserPreferencesAccess;\r\n private static _onMapHit?: MapHitEvent;\r\n\r\n public static get iTwinConfig(): UserPreferencesAccess | undefined { return this._iTwinConfig; }\r\n public static get onMapHit(): MapHitEvent | undefined { return this._onMapHit; }\r\n\r\n /** Used to initialize the Map Layers.\r\n *\r\n * If `registerItemsProvider` is true, the UiItemsProvider will automatically insert the UI items into the host applications UI.\r\n * If it is false, explicitly add widget definition to a specific FrontStage definition using the following syntax.\r\n *\r\n * ```tsx\r\n * <Widget id={MapLayersWidgetControl.id} label={MapLayersWidgetControl.label} control={MapLayersWidgetControl}\r\n * iconSpec={MapLayersWidgetControl.iconSpec} />,\r\n * ```\r\n *\r\n * If an iTwinConfig is provided, it will be used to load the MapLayerSources that are stored.\r\n */\r\n public static async initialize(\r\n registerItemsProvider = true,\r\n iTwinConfig?: UserPreferencesAccess,\r\n fInfoOps?: FeatureInfoOpts\r\n ): Promise<void> {\r\n\r\n MapLayersUI._iTwinConfig = iTwinConfig;\r\n MapLayersUI._onMapHit = fInfoOps?.onMapHit;\r\n\r\n // register namespace containing localized strings for this package\r\n await IModelApp.localization.registerNamespace(this.localizationNamespace);\r\n\r\n // _uiItemsProvider always created to provide access to localization.\r\n MapLayersUI._mapLayersItemsProvider = new MapLayersUiItemsProvider(IModelApp.localization);\r\n MapLayersUI._mapFeatureInfoItemsProvider = new FeatureInfoUiItemsProvider(IModelApp.localization);\r\n if (registerItemsProvider) {\r\n UiItemsManager.register(MapLayersUI._mapLayersItemsProvider);\r\n\r\n // Register the FeatureInfo widget only if MapHit was provided.\r\n if (MapLayersUI._onMapHit) {\r\n UiItemsManager.register(MapLayersUI._mapFeatureInfoItemsProvider);\r\n }\r\n }\r\n\r\n MapLayersUI._itemsProviderRegistered = registerItemsProvider;\r\n }\r\n\r\n /** Unregisters internationalization service namespace and UiItemManager / control */\r\n public static terminate() {\r\n IModelApp.localization.unregisterNamespace(this.localizationNamespace);\r\n\r\n if (MapLayersUI._itemsProviderRegistered !== undefined) {\r\n if (MapLayersUI._itemsProviderRegistered) {\r\n UiItemsManager.unregister(MapLayersUI._mapLayersItemsProvider.id);\r\n\r\n if (MapLayersUI._onMapHit) {\r\n UiItemsManager.unregister(MapLayersUI._mapFeatureInfoItemsProvider.id);\r\n }\r\n }\r\n MapLayersUI._itemsProviderRegistered = undefined;\r\n }\r\n }\r\n\r\n /** The internationalization service namespace. */\r\n public static get localizationNamespace(): string {\r\n return this._defaultNs;\r\n }\r\n}\r\n"]}
|
|
@@ -77,6 +77,10 @@
|
|
|
77
77
|
"ToggleVisibility": "Toggle Visibility",
|
|
78
78
|
"SettingsButtonTooltip": "Settings"
|
|
79
79
|
},
|
|
80
|
+
"FeatureInfoWidget": {
|
|
81
|
+
"Label": "Map Layers Info",
|
|
82
|
+
"NoRecords": "No Results"
|
|
83
|
+
},
|
|
80
84
|
"LayerMenu": {
|
|
81
85
|
"Detach": "Detach",
|
|
82
86
|
"ZoomToLayer": "Zoom to layer"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AbstractWidgetProps, StagePanelLocation, StagePanelSection, UiItemsProvider } from "@itwin/appui-abstract";
|
|
2
|
+
import { Localization } from "@itwin/core-common";
|
|
3
|
+
import { ConfigurableCreateInfo, WidgetControl } from "@itwin/appui-react";
|
|
4
|
+
import { MapFeatureInfoOptions } from "./Interfaces";
|
|
5
|
+
export declare class FeatureInfoUiItemsProvider implements UiItemsProvider {
|
|
6
|
+
readonly id = "FeatureInfoUiItemsProvider";
|
|
7
|
+
static localization: Localization;
|
|
8
|
+
constructor(localization: Localization);
|
|
9
|
+
provideWidgets(_stageId: string, stageUsage: string, location: StagePanelLocation, section: StagePanelSection | undefined): ReadonlyArray<AbstractWidgetProps>;
|
|
10
|
+
}
|
|
11
|
+
export declare class FeatureInfoWidgetControl extends WidgetControl {
|
|
12
|
+
static id: string;
|
|
13
|
+
static iconSpec: string;
|
|
14
|
+
static label: string;
|
|
15
|
+
constructor(info: ConfigurableCreateInfo, featureInfoOpts: MapFeatureInfoOptions);
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=FeatureInfoUiItemsProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FeatureInfoUiItemsProvider.d.ts","sourceRoot":"","sources":["../../../src/ui/FeatureInfoUiItemsProvider.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,iBAAiB,EAAc,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAChI,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAE3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAGrD,qBAAc,0BAA2B,YAAW,eAAe;IACjE,SAAgB,EAAE,gCAAgC;IAClD,OAAc,YAAY,EAAE,YAAY,CAAC;gBAEtB,YAAY,EAAE,YAAY;IAItC,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,kBAAkB,EAAE,OAAO,EAAE,iBAAiB,GAAG,SAAS,GAAG,aAAa,CAAC,mBAAmB,CAAC;CActK;AAED,qBAAa,wBAAyB,SAAQ,aAAa;IACzD,OAAc,EAAE,SAAuB;IACvC,OAAc,QAAQ,SAAc;IACpC,OAAc,KAAK,SAA8B;gBACrC,IAAI,EAAE,sBAAsB,EAAE,eAAe,EAAE,qBAAqB;CAKjF"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { StagePanelLocation, StagePanelSection, StageUsage } from "@itwin/appui-abstract";
|
|
7
|
+
import { WidgetControl } from "@itwin/appui-react";
|
|
8
|
+
import { IModelApp } from "@itwin/core-frontend";
|
|
9
|
+
import { MapFeatureInfoWidget } from "./widget/FeatureInfoWidget";
|
|
10
|
+
export class FeatureInfoUiItemsProvider {
|
|
11
|
+
constructor(localization) {
|
|
12
|
+
this.id = "FeatureInfoUiItemsProvider";
|
|
13
|
+
FeatureInfoUiItemsProvider.localization = localization;
|
|
14
|
+
}
|
|
15
|
+
provideWidgets(_stageId, stageUsage, location, section) {
|
|
16
|
+
const widgets = [];
|
|
17
|
+
if (stageUsage === StageUsage.General && location === StagePanelLocation.Right && section === StagePanelSection.End) {
|
|
18
|
+
widgets.push({
|
|
19
|
+
id: "map-layers:mapFeatureInfoWidget",
|
|
20
|
+
label: IModelApp.localization.getLocalizedString("mapLayers:FeatureInfoWidget.Label"),
|
|
21
|
+
icon: "icon-map",
|
|
22
|
+
getWidgetContent: () => React.createElement(MapFeatureInfoWidget, { featureInfoOpts: { showLoadProgressAnimation: true } }), // eslint-disable-line react/display-name
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
return widgets;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export class FeatureInfoWidgetControl extends WidgetControl {
|
|
29
|
+
constructor(info, featureInfoOpts) {
|
|
30
|
+
super(info, featureInfoOpts);
|
|
31
|
+
super.reactNode = React.createElement(MapFeatureInfoWidget, { featureInfoOpts: featureInfoOpts });
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
FeatureInfoWidgetControl.id = "FeatureInfoWidget";
|
|
35
|
+
FeatureInfoWidgetControl.iconSpec = "icon-map";
|
|
36
|
+
FeatureInfoWidgetControl.label = "FeatureInfoWidgetControl";
|
|
37
|
+
//# sourceMappingURL=FeatureInfoUiItemsProvider.js.map
|
|
@@ -0,0 +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,EAAuB,kBAAkB,EAAE,iBAAiB,EAAE,UAAU,EAAmB,MAAM,uBAAuB,CAAC;AAEhI,OAAO,EAA0B,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,MAAM,OAAQ,0BAA0B;IAItC,YAAmB,YAA0B;QAH7B,OAAE,GAAG,4BAA4B,CAAC;QAIhD,0BAA0B,CAAC,YAAY,GAAG,YAAY,CAAC;IACzD,CAAC;IAEM,cAAc,CAAC,QAAgB,EAAE,UAAkB,EAAE,QAA4B,EAAE,OAAsC;QAC9H,MAAM,OAAO,GAA0B,EAAE,CAAC;QAE1C,IAAI,UAAU,KAAK,UAAU,CAAC,OAAO,IAAI,QAAQ,KAAK,kBAAkB,CAAC,KAAK,IAAI,OAAO,KAAK,iBAAiB,CAAC,GAAG,EAAE;YACnH,OAAO,CAAC,IAAI,CAAC;gBACX,EAAE,EAAE,iCAAiC;gBACrC,KAAK,EAAE,SAAS,CAAC,YAAY,CAAC,kBAAkB,CAAC,mCAAmC,CAAC;gBACrF,IAAI,EAAE,UAAU;gBAChB,gBAAgB,EAAE,GAAG,EAAE,CAAC,oBAAC,oBAAoB,IAAC,eAAe,EAAE,EAAC,yBAAyB,EAAE,IAAI,EAAC,GAAG,EAAE,yCAAyC;aAC/I,CAAC,CAAC;SACJ;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AAED,MAAM,OAAO,wBAAyB,SAAQ,aAAa;IAIzD,YAAY,IAA4B,EAAE,eAAsC;QAC9E,KAAK,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;QAE7B,KAAK,CAAC,SAAS,GAAG,oBAAC,oBAAoB,IAAC,eAAe,EAAE,eAAe,GAAG,CAAC;IAC9E,CAAC;;AAPa,2BAAE,GAAG,mBAAmB,CAAC;AACzB,iCAAQ,GAAG,UAAU,CAAC;AACtB,8BAAK,GAAG,0BAA0B,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nimport * as React from \"react\";\r\nimport { AbstractWidgetProps, StagePanelLocation, StagePanelSection, StageUsage, UiItemsProvider } from \"@itwin/appui-abstract\";\r\nimport { Localization } from \"@itwin/core-common\";\r\nimport { ConfigurableCreateInfo, WidgetControl } from \"@itwin/appui-react\";\r\nimport { IModelApp } from \"@itwin/core-frontend\";\r\nimport { MapFeatureInfoOptions } from \"./Interfaces\";\r\nimport { MapFeatureInfoWidget } from \"./widget/FeatureInfoWidget\";\r\n\r\nexport class FeatureInfoUiItemsProvider implements UiItemsProvider {\r\n public readonly id = \"FeatureInfoUiItemsProvider\";\r\n public static localization: Localization;\r\n\r\n public constructor(localization: Localization) {\r\n FeatureInfoUiItemsProvider.localization = localization;\r\n }\r\n\r\n public provideWidgets(_stageId: string, stageUsage: string, location: StagePanelLocation, section: StagePanelSection | undefined): ReadonlyArray<AbstractWidgetProps> {\r\n const widgets: AbstractWidgetProps[] = [];\r\n\r\n if (stageUsage === StageUsage.General && location === StagePanelLocation.Right && section === StagePanelSection.End) {\r\n widgets.push({\r\n id: \"map-layers:mapFeatureInfoWidget\",\r\n label: IModelApp.localization.getLocalizedString(\"mapLayers:FeatureInfoWidget.Label\"),\r\n icon: \"icon-map\",\r\n getWidgetContent: () => <MapFeatureInfoWidget featureInfoOpts={{showLoadProgressAnimation: true}}/>, // eslint-disable-line react/display-name\r\n });\r\n }\r\n\r\n return widgets;\r\n }\r\n}\r\n\r\nexport class FeatureInfoWidgetControl extends WidgetControl {\r\n public static id = \"FeatureInfoWidget\";\r\n public static iconSpec = \"icon-map\";\r\n public static label = \"FeatureInfoWidgetControl\";\r\n constructor(info: ConfigurableCreateInfo, featureInfoOpts: MapFeatureInfoOptions) {\r\n super(info, featureInfoOpts);\r\n\r\n super.reactNode = <MapFeatureInfoWidget featureInfoOpts={featureInfoOpts}/>;\r\n }\r\n}\r\n"]}
|
|
@@ -29,4 +29,11 @@ export interface MapLayerOptions {
|
|
|
29
29
|
fetchPublicMapLayerSources?: boolean;
|
|
30
30
|
mapTypeOptions?: MapTypesOptions;
|
|
31
31
|
}
|
|
32
|
+
export interface MapFeatureInfoPropertyGridOptions {
|
|
33
|
+
isPropertySelectionEnabled?: boolean;
|
|
34
|
+
}
|
|
35
|
+
export interface MapFeatureInfoOptions {
|
|
36
|
+
showLoadProgressAnimation?: boolean;
|
|
37
|
+
propertyGridOptions?: MapFeatureInfoPropertyGridOptions;
|
|
38
|
+
}
|
|
32
39
|
//# sourceMappingURL=Interfaces.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Interfaces.d.ts","sourceRoot":"","sources":["../../../src/ui/Interfaces.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAE/D,MAAM,WAAW,qBAAqB;IACpC,WAAW;IACX,IAAI,EAAE,MAAM,CAAC;IACb,oFAAoF;IACpF,MAAM,EAAE,MAAM,CAAC;IACf,mCAAmC;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,2MAA2M;IAC3M,YAAY,EAAE,MAAM,CAAC;IACrB,6BAA6B;IAC7B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,qCAAqC;IACrC,SAAS,EAAE,OAAO,CAAC;IACnB,8BAA8B;IAC9B,SAAS,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC/B,iCAAiC;IACjC,aAAa,EAAE,OAAO,CAAC;IACvB,uEAAuE;IACvE,QAAQ,CAAC,EAAE,uBAAuB,CAAC;CACpC;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,wBAAwB,EAAE,OAAO,CAAC;CAC5C;AAED,MAAM,WAAW,eAAe;IAC9B,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,cAAc,CAAC,EAAE,eAAe,CAAC;CAClC"}
|
|
1
|
+
{"version":3,"file":"Interfaces.d.ts","sourceRoot":"","sources":["../../../src/ui/Interfaces.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAE/D,MAAM,WAAW,qBAAqB;IACpC,WAAW;IACX,IAAI,EAAE,MAAM,CAAC;IACb,oFAAoF;IACpF,MAAM,EAAE,MAAM,CAAC;IACf,mCAAmC;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,2MAA2M;IAC3M,YAAY,EAAE,MAAM,CAAC;IACrB,6BAA6B;IAC7B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,qCAAqC;IACrC,SAAS,EAAE,OAAO,CAAC;IACnB,8BAA8B;IAC9B,SAAS,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC/B,iCAAiC;IACjC,aAAa,EAAE,OAAO,CAAC;IACvB,uEAAuE;IACvE,QAAQ,CAAC,EAAE,uBAAuB,CAAC;CACpC;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,wBAAwB,EAAE,OAAO,CAAC;CAC5C;AAED,MAAM,WAAW,eAAe;IAC9B,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,cAAc,CAAC,EAAE,eAAe,CAAC;CAClC;AAED,MAAM,WAAW,iCAAiC;IAChD,0BAA0B,CAAC,EAAE,OAAO,CAAC;CACtC;AAED,MAAM,WAAW,qBAAqB;IACpC,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,mBAAmB,CAAC,EAAE,iCAAiC,CAAC;CACzD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Interfaces.js","sourceRoot":"","sources":["../../../src/ui/Interfaces.ts"],"names":[],"mappings":"","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport { MapSubLayerProps } from \"@itwin/core-common\";\r\nimport { MapLayerImageryProvider } from \"@itwin/core-frontend\";\r\n\r\nexport interface StyleMapLayerSettings {\r\n /** Name */\r\n name: string;\r\n /** source (i.URL for ImageMapLayerSettings or modelId for ModelMapLayerSettings) */\r\n source: string;\r\n /** Controls visibility of layer */\r\n visible: boolean;\r\n /** A transparency value from 0.0 (fully opaque) to 1.0 (fully transparent) to apply to map graphics when drawing, or false to indicate the transparency should not be overridden. Default value: false. */\r\n transparency: number;\r\n /** Transparent background */\r\n transparentBackground: boolean;\r\n /** set map as underlay or overlay */\r\n isOverlay: boolean;\r\n /** Available map sub-layer */\r\n subLayers?: MapSubLayerProps[];\r\n /** sub-layer panel displayed. */\r\n showSubLayers: boolean;\r\n /** Some format can publish only a single layer at a time (i.e WMTS) */\r\n provider?: MapLayerImageryProvider;\r\n}\r\n\r\nexport interface MapTypesOptions {\r\n readonly supportTileUrl: boolean;\r\n readonly supportWmsAuthentication: boolean;\r\n}\r\n\r\nexport interface MapLayerOptions {\r\n hideExternalMapLayers?: boolean;\r\n fetchPublicMapLayerSources?: boolean;\r\n mapTypeOptions?: MapTypesOptions;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"Interfaces.js","sourceRoot":"","sources":["../../../src/ui/Interfaces.ts"],"names":[],"mappings":"","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport { MapSubLayerProps } from \"@itwin/core-common\";\r\nimport { MapLayerImageryProvider } from \"@itwin/core-frontend\";\r\n\r\nexport interface StyleMapLayerSettings {\r\n /** Name */\r\n name: string;\r\n /** source (i.URL for ImageMapLayerSettings or modelId for ModelMapLayerSettings) */\r\n source: string;\r\n /** Controls visibility of layer */\r\n visible: boolean;\r\n /** A transparency value from 0.0 (fully opaque) to 1.0 (fully transparent) to apply to map graphics when drawing, or false to indicate the transparency should not be overridden. Default value: false. */\r\n transparency: number;\r\n /** Transparent background */\r\n transparentBackground: boolean;\r\n /** set map as underlay or overlay */\r\n isOverlay: boolean;\r\n /** Available map sub-layer */\r\n subLayers?: MapSubLayerProps[];\r\n /** sub-layer panel displayed. */\r\n showSubLayers: boolean;\r\n /** Some format can publish only a single layer at a time (i.e WMTS) */\r\n provider?: MapLayerImageryProvider;\r\n}\r\n\r\nexport interface MapTypesOptions {\r\n readonly supportTileUrl: boolean;\r\n readonly supportWmsAuthentication: boolean;\r\n}\r\n\r\nexport interface MapLayerOptions {\r\n hideExternalMapLayers?: boolean;\r\n fetchPublicMapLayerSources?: boolean;\r\n mapTypeOptions?: MapTypesOptions;\r\n}\r\n\r\nexport interface MapFeatureInfoPropertyGridOptions {\r\n isPropertySelectionEnabled?: boolean;\r\n}\r\n\r\nexport interface MapFeatureInfoOptions {\r\n showLoadProgressAnimation?: boolean;\r\n propertyGridOptions?: MapFeatureInfoPropertyGridOptions;\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttachLayerPopupButton.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/AttachLayerPopupButton.tsx"],"names":[],"mappings":";AA0TA,gBAAgB;AAChB,oBAAY,qBAAqB;IAC/B,OAAO,IAAA;IACP,IAAI,IAAA;IACJ,IAAI,IAAA;CACL;AACD,MAAM,WAAW,2BAA2B;IAC1C,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,qBAAqB,CAAC;CACpC;AAED,gBAAgB;AAEhB,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,2BAA2B,
|
|
1
|
+
{"version":3,"file":"AttachLayerPopupButton.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/AttachLayerPopupButton.tsx"],"names":[],"mappings":";AA0TA,gBAAgB;AAChB,oBAAY,qBAAqB;IAC/B,OAAO,IAAA;IACP,IAAI,IAAA;IACJ,IAAI,IAAA;CACL;AACD,MAAM,WAAW,2BAA2B;IAC1C,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,qBAAqB,CAAC;CACpC;AAED,gBAAgB;AAEhB,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,2BAA2B,eAsHxE"}
|
|
@@ -303,7 +303,7 @@ export function AttachLayerPopupButton(props) {
|
|
|
303
303
|
}
|
|
304
304
|
return (React.createElement(React.Fragment, null,
|
|
305
305
|
renderButton(),
|
|
306
|
-
React.createElement(UiCore.Popup, { isOpen: popupOpen, position: RelativePosition.BottomRight, onClose: handleClosePopup, onOutsideClick: handleOutsideClick, target: buttonRef.current, closeOnEnter: false },
|
|
306
|
+
React.createElement(UiCore.Popup, { isOpen: popupOpen, position: RelativePosition.BottomRight, onClose: handleClosePopup, onOutsideClick: handleOutsideClick, target: buttonRef.current, closeOnEnter: false, closeOnContextMenu: false },
|
|
307
307
|
React.createElement("div", { ref: panelRef, className: "map-sources-popup-panel" },
|
|
308
308
|
React.createElement(AttachLayerPanel, { isOverlay: props.isOverlay, onLayerAttached: handleLayerAttached })))));
|
|
309
309
|
}
|