qwc2 2025.10.9 → 2025.10.14
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/actions/display.js +30 -1
- package/actions/editing.js +22 -1
- package/actions/layerinfo.js +13 -1
- package/actions/layers.js +213 -3
- package/actions/localConfig.js +58 -1
- package/actions/locale.js +21 -1
- package/actions/locate.js +26 -1
- package/actions/logging.js +10 -1
- package/actions/map.js +105 -2
- package/actions/measurement.js +12 -1
- package/actions/processNotifications.js +37 -1
- package/actions/redlining.js +18 -1
- package/actions/redliningPick.js +12 -1
- package/actions/search.js +12 -1
- package/actions/serviceinfo.js +12 -1
- package/actions/task.js +55 -3
- package/actions/theme.js +339 -19
- package/actions/windows.js +164 -5
- package/components/AppMenu.js +435 -3
- package/components/AttributeForm.js +928 -32
- package/components/AttributeTableWidget.js +1105 -13
- package/components/AutoEditForm.js +189 -3
- package/components/CoordinateDisplayer.js +78 -2
- package/components/EditComboField.js +190 -6
- package/components/EditUploadField.js +315 -3
- package/components/ExportSelection.js +203 -2
- package/components/FullscreenSwitcher.js +90 -3
- package/components/Icon.js +81 -2
- package/components/IdentifyViewer.js +1161 -6
- package/components/ImportLayer.js +718 -20
- package/components/LayerInfoWindow.js +145 -2
- package/components/LinkFeatureForm.js +246 -5
- package/components/MapButton.js +88 -2
- package/components/MapSelection.js +287 -8
- package/components/MessageBar.js +68 -2
- package/components/NumericInputWindow.js +359 -2
- package/components/PickFeature.js +266 -2
- package/components/PluginsContainer.js +227 -8
- package/components/PrintSelection.js +620 -49
- package/components/ProcessNotifications.js +104 -2
- package/components/QtDesignerForm.js +1137 -18
- package/components/ResizeableWindow.js +591 -8
- package/components/SearchBox.js +1307 -20
- package/components/ServiceInfoWindow.js +107 -2
- package/components/SideBar.js +204 -4
- package/components/StandardApp.js +381 -20
- package/components/Swipeable.js +15 -1
- package/components/TaskBar.js +85 -2
- package/components/ThemeLayersListWindow.js +216 -4
- package/components/ThemeList.js +381 -7
- package/components/Toolbar.js +106 -2
- package/components/WindowManager.js +178 -2
- package/components/map/OlLayer.js +257 -6
- package/components/map/OlMap.js +405 -5
- package/components/map/layers/BingLayer.js +31 -2
- package/components/map/layers/GoogleLayer.js +222 -19
- package/components/map/layers/GraticuleLayer.js +21 -1
- package/components/map/layers/ImageLayer.js +15 -1
- package/components/map/layers/MVTLayer.js +52 -2
- package/components/map/layers/OSMLayer.js +24 -2
- package/components/map/layers/OverlayLayer.js +55 -3
- package/components/map/layers/VectorLayer.js +173 -8
- package/components/map/layers/WFSLayer.js +220 -6
- package/components/map/layers/WMSLayer.js +180 -6
- package/components/map/layers/WMTSLayer.js +67 -3
- package/components/map/layers/XYZLayer.js +24 -2
- package/components/map/layers/index.js +28 -1
- package/components/map3d/EditDataset3D.js +190 -3
- package/components/map3d/HeightProfile3D.js +402 -3
- package/components/map3d/ImportObjects3D.js +162 -2
- package/components/map3d/Map3D.js +1304 -38
- package/components/map3d/MapControls3D.js +392 -7
- package/components/map3d/SearchField3D.js +183 -11
- package/components/map3d/View3DSwitcher.js +98 -2
- package/components/map3d/drawtool/CreateTool3D.js +174 -4
- package/components/map3d/drawtool/EditTool3D.js +590 -6
- package/components/map3d/drawtool/NumericInput3D.js +336 -4
- package/components/map3d/layers/GeoTIFFLayer3D.js +15 -1
- package/components/map3d/layers/VectorLayer3D.js +53 -2
- package/components/map3d/layers/WFSLayer3D.js +109 -3
- package/components/map3d/layers/WMSLayer3D.js +70 -2
- package/components/map3d/layers/WMTSLayer3D.js +27 -3
- package/components/map3d/layers/index.js +14 -1
- package/components/map3d/utils/FirstPersonControls3D.js +423 -16
- package/components/map3d/utils/MiscUtils3D.js +221 -13
- package/components/map3d/utils/OrbitControls3D.js +176 -5
- package/components/map3d/utils/Tiles3DStyle.js +238 -9
- package/components/share/ShareLink.js +54 -2
- package/components/share/ShareQRCode.js +62 -2
- package/components/share/ShareSocials.js +125 -3
- package/components/timeline/FixedTimeline.js +236 -5
- package/components/timeline/InfiniteTimeline.js +347 -8
- package/components/timeline/TimelineFeaturesSlider.js +439 -5
- package/components/widgets/AccordeonWidget.js +96 -2
- package/components/widgets/ButtonBar.js +124 -2
- package/components/widgets/ColorButton.js +201 -3
- package/components/widgets/ComboBox.js +166 -2
- package/components/widgets/CopyButton.js +110 -2
- package/components/widgets/DateTimeInput.js +100 -3
- package/components/widgets/EditableSelect.js +230 -3
- package/components/widgets/FileSelector.js +128 -4
- package/components/widgets/Input.js +124 -2
- package/components/widgets/InputContainer.js +96 -2
- package/components/widgets/LayerCatalogWidget.js +219 -3
- package/components/widgets/MenuButton.js +157 -1
- package/components/widgets/ModalDialog.js +64 -2
- package/components/widgets/NavBar.js +119 -2
- package/components/widgets/NumberInput.js +226 -4
- package/components/widgets/PopupMenu.js +72 -1
- package/components/widgets/Primitives.js +6 -1
- package/components/widgets/ReCaptchaWidget.js +55 -1
- package/components/widgets/SearchWidget.js +255 -2
- package/components/widgets/Spinner.js +44 -2
- package/components/widgets/SuggestionInput.js +77 -2
- package/components/widgets/TextInput.js +308 -2
- package/components/widgets/ToggleSwitch.js +85 -2
- package/components/widgets/VectorLayerPicker.js +85 -3
- package/libs/openlayers.js +225 -5
- package/package.json +1 -1
- package/plugins/API.js +358 -15
- package/plugins/AttributeTable.js +109 -3
- package/plugins/Authentication.js +130 -5
- package/plugins/BackgroundSwitcher.js +218 -4
- package/plugins/Bookmark.js +289 -3
- package/plugins/BottomBar.js +298 -4
- package/plugins/CookiePopup.js +67 -3
- package/plugins/Cyclomedia.js +442 -5
- package/plugins/Editing.js +497 -9
- package/plugins/FeatureForm.js +366 -4
- package/plugins/FeatureSearch.js +458 -3
- package/plugins/GeometryDigitizer.js +664 -7
- package/plugins/HeightProfile.js +763 -15
- package/plugins/Help.js +102 -3
- package/plugins/HomeButton.js +80 -3
- package/plugins/Identify.js +543 -5
- package/plugins/LayerCatalog.js +215 -4
- package/plugins/LayerTree.js +1194 -6
- package/plugins/LocateButton.js +94 -3
- package/plugins/Map.js +320 -16
- package/plugins/MapCompare.js +94 -3
- package/plugins/MapCopyright.js +127 -5
- package/plugins/MapExport.js +613 -20
- package/plugins/MapFilter.js +868 -12
- package/plugins/MapInfoTooltip.js +277 -3
- package/plugins/MapLegend.js +253 -4
- package/plugins/MapTip.js +290 -4
- package/plugins/Measure.js +220 -4
- package/plugins/NewsPopup.js +137 -3
- package/plugins/OverviewMap.js +167 -7
- package/plugins/Panoramax.js +340 -2
- package/plugins/Portal.js +199 -4
- package/plugins/Print.js +1231 -15
- package/plugins/Redlining.js +750 -6
- package/plugins/Reports.js +332 -3
- package/plugins/Routing.js +1278 -15
- package/plugins/ScratchDrawing.js +173 -5
- package/plugins/Settings.js +241 -4
- package/plugins/Share.js +198 -3
- package/plugins/StartupMarker.js +84 -4
- package/plugins/TaskButton.js +88 -3
- package/plugins/ThemeSwitcher.js +164 -4
- package/plugins/TimeManager.js +971 -10
- package/plugins/TopBar.js +300 -7
- package/plugins/TourGuide.js +213 -2
- package/plugins/ValueTool.js +419 -4
- package/plugins/View3D.js +519 -14
- package/plugins/ZoomButtons.js +165 -3
- package/plugins/map/EditingSupport.js +199 -7
- package/plugins/map/LocateSupport.js +260 -4
- package/plugins/map/MeasurementSupport.js +216 -8
- package/plugins/map/RedliningPickSupport.js +201 -7
- package/plugins/map/RedliningSupport.js +726 -17
- package/plugins/map/SnapInteraction.js +101 -1
- package/plugins/map/SnapSupport.js +210 -2
- package/plugins/map/SnappingSupport.js +356 -17
- package/plugins/map3d/BackgroundSwitcher3D.js +44 -3
- package/plugins/map3d/BottomBar3D.js +118 -3
- package/plugins/map3d/Compare3D.js +422 -8
- package/plugins/map3d/Draw3D.js +353 -6
- package/plugins/map3d/ExportObjects3D.js +393 -18
- package/plugins/map3d/HideObjects3D.js +313 -12
- package/plugins/map3d/Identify3D.js +283 -12
- package/plugins/map3d/LayerTree3D.js +323 -3
- package/plugins/map3d/MapCopyright3D.js +128 -5
- package/plugins/map3d/MapExport3D.js +590 -10
- package/plugins/map3d/MapLight3D.js +553 -6
- package/plugins/map3d/Measure3D.js +571 -20
- package/plugins/map3d/OverviewMap3D.js +169 -3
- package/plugins/map3d/Settings3D.js +73 -3
- package/plugins/map3d/TopBar3D.js +207 -9
- package/plugins/redlining/RedliningBufferSupport.js +206 -3
- package/reducers/display.js +34 -2
- package/reducers/editing.js +68 -3
- package/reducers/index.js +9 -1
- package/reducers/layerinfo.js +26 -2
- package/reducers/layers.js +456 -9
- package/reducers/localConfig.js +122 -2
- package/reducers/locale.js +38 -2
- package/reducers/locate.js +40 -2
- package/reducers/map.js +176 -5
- package/reducers/measurement.js +42 -2
- package/reducers/processNotifications.js +49 -2
- package/reducers/redlining.js +50 -2
- package/reducers/redliningPick.js +27 -2
- package/reducers/search.js +20 -1
- package/reducers/serviceinfo.js +25 -2
- package/reducers/task.js +45 -2
- package/reducers/theme.js +51 -2
- package/reducers/windows.js +203 -2
- package/scripts/dist.sh +1 -1
- package/scripts/gen-plugin-docs.js +152 -2
- package/scripts/makeIconkit.js +85 -6
- package/scripts/themesConfig.js +742 -40
- package/scripts/updateTranslations.js +251 -10
- package/selectors/searchproviders.js +44 -2
- package/stores/StandardStore.js +42 -2
- package/utils/ConfigUtils.js +84 -3
- package/utils/CoordinatesUtils.js +234 -23
- package/utils/DxfUtils.js +237 -11
- package/utils/EditingInterface.js +421 -87
- package/utils/EditingUtils.js +357 -13
- package/utils/ElevationInterface.js +83 -22
- package/utils/FeatureStyles.js +429 -5
- package/utils/IdentifyUtils.js +443 -7
- package/utils/ImageEditor.js +79 -9
- package/utils/LayerUtils.js +1516 -50
- package/utils/LocaleUtils.js +117 -7
- package/utils/MapUtils.js +241 -59
- package/utils/MeasureUtils.js +323 -2
- package/utils/MiscUtils.js +189 -11
- package/utils/PermaLinkUtils.js +429 -6
- package/utils/PluginStore.js +27 -1
- package/utils/ResourceRegistry.js +15 -1
- package/utils/RoutingInterface.js +307 -7
- package/utils/SearchProviders.js +722 -19
- package/utils/ServiceLayerUtils.js +669 -14
- package/utils/Signal.js +32 -2
- package/utils/ThemeUtils.js +341 -7
- package/utils/VectorLayerUtils.js +589 -15
- package/utils/expr_grammar/grammar.js +2239 -2
- package/utils/expr_grammar/test.js +65 -3
|
@@ -1,11 +1,1166 @@
|
|
|
1
|
-
function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
3
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
4
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
5
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
6
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
7
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
8
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
9
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
10
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
11
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
12
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
13
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
14
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
15
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
16
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
17
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
18
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
19
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
20
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
21
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
22
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
23
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
24
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
25
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
26
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
27
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
28
|
+
/**
|
|
2
29
|
* Copyright 2016-2024 Sourcepole AG
|
|
3
30
|
* All rights reserved.
|
|
4
31
|
*
|
|
5
32
|
* This source code is licensed under the BSD-style license found in the
|
|
6
33
|
* LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
|
-
delete newFeature.styleName;delete newFeature.styleOptions;return newFeature});if(!isEmpty(results)){var layer={id:"__identifyviewerhighlight",role:LayerRole.SELECTION};_this.props.addLayerFeatures(layer,results,true)}else{_this.props.removeLayer("__identifyviewerhighlight")}});_defineProperty(_this,"getExpandedClass",function(path,deflt){var expanded=_this.state.expanded[path]!==undefined?_this.state.expanded[path]:deflt;return expanded?"identify-layer-expandable identify-layer-expanded":"identify-layer-expandable"});_defineProperty(_this,"toggleExpanded",function(path,deflt){var newstate=_this.state.expanded[path]!==undefined?!_this.state.expanded[path]:!deflt;var diff={};diff[path]=newstate;if(_this.state.currentLayer===path&&!newstate){_this.setState(function(state){return _objectSpread(_objectSpread({},state),{},{expanded:_objectSpread(_objectSpread({},state.expanded),diff),currentResult:null,currentLayer:null})})}else{_this.setState(function(state){return _objectSpread(_objectSpread({},state),{},{expanded:_objectSpread(_objectSpread({},state.expanded),diff)})})}});_defineProperty(_this,"setCurrentResult",function(layer,result){if(_this.state.currentResult===result){_this.setState({currentResult:null,currentLayer:null})}else{_this.setState({currentResult:result,currentLayer:layer});_this.scrollIntoView=true}});_defineProperty(_this,"removeResultLayer",function(layer){_this.setState(function(state){var newResultTree=_objectSpread({},state.resultTree);delete newResultTree[layer];_this.setState({resultTree:newResultTree,currentResult:state.currentLayer===layer?null:state.currentResult,currentLayer:state.currentLayer===layer?null:state.currentLayer})})});_defineProperty(_this,"removeResult",function(layer,result){_this.setState(function(state){var newResultTree=_objectSpread({},state.resultTree);newResultTree[layer]=state.resultTree[layer].filter(function(item){return item!==result});if(isEmpty(newResultTree[layer])){delete newResultTree[layer]}var selectedLayer=isEmpty(newResultTree[layer])?"":state.selectedLayer;return{resultTree:newResultTree,currentResult:state.currentResult===result?null:state.currentResult,selectedLayer:selectedLayer}})});_defineProperty(_this,"exportResults",function(){var clipboard=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;var filteredResults={};Object.keys(_this.state.selectedLayer!==""?_defineProperty({},_this.state.selectedLayer,_this.state.resultTree[_this.state.selectedLayer]):_this.state.resultTree).map(function(key){if(!isEmpty(_this.state.resultTree[key])){filteredResults[key]=_this.state.resultTree[key]}});_this["export"](filteredResults,clipboard)});_defineProperty(_this,"exportResultLayer",function(layer){_this["export"](_defineProperty({},layer,_this.state.resultTree[layer]))});_defineProperty(_this,"exportResult",function(layer,result){_this["export"](_defineProperty({},layer,[result]))});_defineProperty(_this,"export",function(json){var clipboard=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var exporter=_this.getExporters().find(function(entry){return entry.id===_this.state.exportFormat});if(exporter){if(!_this.props.exportGeometry){json=Object.entries(json).reduce(function(res,_ref13){var _ref14=_slicedToArray(_ref13,2),layerId=_ref14[0],features=_ref14[1];return _objectSpread(_objectSpread({},res),{},_defineProperty({},layerId,features.map(function(feature){return omit(feature,["geometry"])})))},{})}exporter["export"](json,function(result){if(clipboard&&exporter.allowClipboard){navigator.clipboard.writeText(result.data)}else{FileSaver.saveAs(new Blob([result.data],{type:result.type}),result.filename)}})}});_defineProperty(_this,"renderLayer",function(layer){var results=_this.state.resultTree[layer];if(results.length===0){return null}return/*#__PURE__*/React.createElement("div",{className:_this.getExpandedClass(layer,true),key:layer},/*#__PURE__*/React.createElement("div",{className:"identify-result-entry",onMouseEnter:function onMouseEnter(){return _this.setHighlightedResults(results,_this.state.resultTree)},onMouseLeave:function onMouseLeave(){return _this.setHighlightedResults(_this.state.currentResult===null?null:[_this.state.currentResult],_this.state.resultTree)}},/*#__PURE__*/React.createElement("span",{className:"clickable",onClick:function onClick(){return _this.toggleExpanded(layer,true)}},/*#__PURE__*/React.createElement("b",null,results[0].layertitle)),/*#__PURE__*/React.createElement(Icon,{className:"identify-remove-result",icon:"minus-sign",onClick:function onClick(){return _this.removeResultLayer(layer)}}),_this.props.enableExport===true||!isEmpty(_this.props.enableExport)?/*#__PURE__*/React.createElement(Icon,{className:"identify-export-result",icon:"export",onClick:function onClick(){return _this.exportResultLayer(layer)}}):null),/*#__PURE__*/React.createElement("div",{className:"identify-layer-entries"},results.map(function(result){return _this.renderResult(layer,result)})))});_defineProperty(_this,"renderResult",function(layer,result){var ref=_this.state.currentResult===result&&_this.scrollIntoView?function(el){_this.currentResultElRef=el}:null;return/*#__PURE__*/React.createElement("div",{className:"identify-result-entry",key:result.id,onMouseEnter:function onMouseEnter(){return _this.setHighlightedResults([result],_this.state.resultTree)},onMouseLeave:function onMouseLeave(){return _this.setHighlightedResults(_this.state.currentResult===null?null:[_this.state.currentResult],_this.state.resultTree)}},/*#__PURE__*/React.createElement("span",{className:_this.state.currentResult===result?"active clickable":"clickable",onClick:function onClick(){return _this.setCurrentResult(layer,result)},ref:ref},result.displayname),/*#__PURE__*/React.createElement(Icon,{className:"identify-remove-result",icon:"minus-sign",onClick:function onClick(){return _this.removeResult(layer,result)}}),_this.props.enableExport===true||!isEmpty(_this.props.enableExport)?/*#__PURE__*/React.createElement(Icon,{className:"identify-export-result",icon:"export",onClick:function onClick(){return _this.exportResult(layer,result)}}):null)});_defineProperty(_this,"renderResultAttributes",function(layer,result,resultClass){if(!result){return null}var resultbox=null;var extraattribs=null;var inlineExtaAttribs=false;var featureReports=_this.state.reports[layer]||[];if(result.featureReport){featureReports.push({title:result.layertitle,template:result.featureReport})}if(result.type==="text"){resultbox=/*#__PURE__*/React.createElement("pre",{className:"identify-result-box"},result.text)}else if(result.type==="html"){resultbox=/*#__PURE__*/React.createElement("iframe",{className:"identify-result-box",onLoad:function onLoad(ev){return _this.setIframeContent(ev.target,result.text)},ref:function ref(el){return _this.pollIframe(el,result.text)}})}else if(result.properties.htmlContent){if(result.properties.htmlContentInline){resultbox=/*#__PURE__*/React.createElement("div",{className:"identify-result-box"},_this.parsedContent(result.properties.htmlContent))}else{resultbox=/*#__PURE__*/React.createElement("iframe",{className:"identify-result-box",onLoad:function onLoad(ev){return _this.setIframeContent(ev.target,result.properties.htmlContent)},ref:function ref(el){return _this.pollIframe(el,result.properties.htmlContent)}})}}else{var _rows;inlineExtaAttribs=true;var properties=Object.keys(result.properties)||[];var rows=[];if(properties.length===1&&result.properties.maptip){rows=properties.map(function(attrib){return/*#__PURE__*/React.createElement("tr",{key:attrib},/*#__PURE__*/React.createElement("td",{className:"identify-attr-value"},_this.attribValue(result.properties[attrib],attrib,layer,result)))})}else{rows=properties.map(function(attrib){if(_this.props.theme.skipEmptyFeatureAttributes&&(result.properties[attrib]===""||result.properties[attrib]===null||result.properties[attrib]==="NULL")){return null}return/*#__PURE__*/React.createElement("tr",{key:attrib},/*#__PURE__*/React.createElement("td",{className:"identify-attr-title "+_this.props.longAttributesDisplay},/*#__PURE__*/React.createElement("i",null,attrib)),/*#__PURE__*/React.createElement("td",{className:"identify-attr-value "+_this.props.longAttributesDisplay},_this.attribValue(result.properties[attrib],attrib,layer,result)))})}(_rows=rows).push.apply(_rows,_toConsumableArray(_this.computeExtraAttributes(layer,result)));featureReports.forEach(function(report,idx){rows.push(/*#__PURE__*/React.createElement("tr",{key:"__featurereport"+idx},/*#__PURE__*/React.createElement("td",{className:"identify-attr-title "+_this.props.longAttributesDisplay},/*#__PURE__*/React.createElement("i",null,LocaleUtils.tr("identify.featureReport")+": "+report.title)),/*#__PURE__*/React.createElement("td",{className:"identify-attr-value "+_this.props.longAttributesDisplay},/*#__PURE__*/React.createElement("a",{href:_this.getFeatureReportUrl(report,result)},LocaleUtils.tr("identify.link")))))});if(isEmpty(rows)){rows=/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",{className:"identify-attr-value"},/*#__PURE__*/React.createElement("i",null,LocaleUtils.tr("identify.noattributes"))))}resultbox=/*#__PURE__*/React.createElement("div",{className:"identify-result-box"},/*#__PURE__*/React.createElement("table",{className:"attribute-list"},/*#__PURE__*/React.createElement("tbody",null,rows)))}if(!inlineExtaAttribs&&(_this.props.attributeCalculator||!isEmpty(_this.state.reports[layer]))){extraattribs=/*#__PURE__*/React.createElement("div",{className:"identify-result-box"},/*#__PURE__*/React.createElement("table",{className:"attribute-list"},/*#__PURE__*/React.createElement("tbody",null,_this.computeExtraAttributes(layer,result),featureReports.map(function(report,idx){return/*#__PURE__*/React.createElement("tr",{key:"report"+idx},/*#__PURE__*/React.createElement("td",{className:"identify-attr-title "+_this.props.longAttributesDisplay},/*#__PURE__*/React.createElement("i",null,LocaleUtils.tr("identify.featureReport")+": "+report.title)),/*#__PURE__*/React.createElement("td",{className:"identify-attr-value "+_this.props.longAttributesDisplay},/*#__PURE__*/React.createElement("a",{href:_this.getFeatureReportUrl(report,result),rel:"noreferrer",target:"_blank"},LocaleUtils.tr("identify.link"))))}))))}var zoomToFeatureButton=null;if(result.bbox&&result.crs){zoomToFeatureButton=/*#__PURE__*/React.createElement(Icon,{icon:"zoom",onClick:function onClick(){return _this.zoomToResult(result)}})}var key=result+":"+result.id;var expanded=_this.state.expandedResults[key];return/*#__PURE__*/React.createElement("div",{className:resultClass,key:"results-attributes"},/*#__PURE__*/React.createElement("div",{className:"identify-result-title"},_this.props.collapsible?/*#__PURE__*/React.createElement(Icon,{icon:expanded?"triangle-down":"triangle-right",onClick:function onClick(){return _this.setState(function(state){return{expandedResults:_objectSpread(_objectSpread({},state.expandedResults),{},_defineProperty({},key,!expanded))}})}}):null,/*#__PURE__*/React.createElement("span",null,(_this.props.showLayerTitles?result.layertitle+": ":"")+result.displayname),zoomToFeatureButton,/*#__PURE__*/React.createElement(Icon,{icon:"info-sign",onClick:function onClick(){return _this.showLayerInfo(layer)}}),/*#__PURE__*/React.createElement(Icon,{icon:"trash",onClick:function onClick(){return _this.removeResult(layer,result)}})),_this.props.collapsible&&!expanded?null:/*#__PURE__*/React.createElement("div",{className:"identify-result-container"},resultbox,extraattribs))});_defineProperty(_this,"computeExtraAttributes",function(layer,result){var _window$qwc;var rows=[];Object.values(((_window$qwc=window.qwc2)===null||_window$qwc===void 0?void 0:_window$qwc.__attributeCalculators)||{}).forEach(function(calc,idx){var row=calc(layer,result);if(row.length===2){rows.push(/*#__PURE__*/React.createElement("tr",{key:"custom-attr-"+idx},/*#__PURE__*/React.createElement("td",{className:"identify-attr-title"},/*#__PURE__*/React.createElement("i",null,row[0])),/*#__PURE__*/React.createElement("td",{className:"identify-attr-value"},row[1])))}else if(row.length===1){rows.push(/*#__PURE__*/React.createElement("tr",{key:"custom-attr-"+idx},/*#__PURE__*/React.createElement("td",{colSpan:"2"},row[0])))}});if(_this.props.attributeCalculator){rows.push.apply(rows,_toConsumableArray(_this.props.attributeCalculator(layer,result)))}return rows});_defineProperty(_this,"getExporters",function(){var _window$qwc2;return[].concat(BuiltinExporters,_toConsumableArray(_this.props.customExporters),_toConsumableArray(Object.values(((_window$qwc2=window.qwc2)===null||_window$qwc2===void 0?void 0:_window$qwc2.__identifyExportes)||[])))});_defineProperty(_this,"setIframeContent",function(iframe,html){if(iframe.getAttribute("identify-content-set")){return}iframe.setAttribute("identify-content-set",true);iframe.contentWindow.document.open();iframe.contentWindow.document.write(html);iframe.contentWindow.document.close()});_defineProperty(_this,"pollIframe",function(iframe,html){if(iframe&&!iframe.getAttribute("identify-content-set")){var interval=setInterval(function(){if(iframe.getAttribute("identify-content-set")){return clearInterval(interval)}if(iframe.contentWindow&&iframe.contentWindow.document){iframe.setAttribute("identify-content-set",true);iframe.contentWindow.document.open();iframe.contentWindow.document.write(html);iframe.contentWindow.document.close();clearInterval(interval)}return true},500)}});_defineProperty(_this,"collectFeatureReportTemplates",function(entry){var reports={};if(entry.sublayers){var _iterator=_createForOfIteratorHelper(entry.sublayers),_step;try{for(_iterator.s();!(_step=_iterator.n()).done;){var sublayer=_step.value;reports=_objectSpread(_objectSpread({},reports),_this.collectFeatureReportTemplates(sublayer))}}catch(err){_iterator.e(err)}finally{_iterator.f()}}else if(entry.featureReport){reports[entry.name]=entry.featureReport}return reports});_defineProperty(_this,"findFeatureReportTemplate",function(layer){var reports={};_this.props.layers.filter(function(l){return l.role===LayerRole.THEME}).forEach(function(themeLayer){reports=_objectSpread(_objectSpread({},reports),_this.collectFeatureReportTemplates(themeLayer))});return reports[layer]||null});_defineProperty(_this,"getFeatureReportUrl",function(report,result){var serviceUrl=ConfigUtils.getConfigProp("documentServiceUrl").replace(/\/$/,"");var params={feature:result.id,x:result.clickPos[0],y:result.clickPos[1],crs:_this.props.map.projection,single_report:report.single_report||false};var path="/"+report.template+"."+(report.format||"pdf");var query=Object.keys(params).map(function(key){return encodeURIComponent(key)+"="+encodeURIComponent(params[key])}).join("&");return serviceUrl+path+"?"+query});_defineProperty(_this,"downloadAggregatedReport",function(){var _this$state$selectedA=_this.state.selectedAggregatedReport.split("::"),_this$state$selectedA2=_slicedToArray(_this$state$selectedA,2),layername=_this$state$selectedA2[0],idx=_this$state$selectedA2[1];var report=_this.state.reports[layername][idx];var results=_this.state.resultTree[layername];var serviceUrl=ConfigUtils.getConfigProp("documentServiceUrl").replace(/\/$/,"");var params={feature:results.map(function(result){return result.id}).join(","),x:results[0].clickPos[0],y:results[0].clickPos[1],crs:_this.props.map.projection,single_report:report.single_report||false};_this.setState({generatingReport:true});var url=serviceUrl+"/"+report.template;axios.get(url,{params:params,responseType:"arraybuffer"}).then(function(response){var filename=(report.filename||report.title.replace(" ","_"))+"."+(report.format||"pdf");FileSaver.saveAs(new Blob([response.data],{type:"application/pdf"}),filename);_this.setState({generatingReport:false})})["catch"](function(){/* eslint-disable-next-line */alert(LocaleUtils.tr("identify.reportfail"));_this.setState({generatingReport:false})})});_defineProperty(_this,"showLayerInfo",function(layer){var _layer$split=layer.split("#"),_layer$split2=_slicedToArray(_layer$split,2),layerUrl=_layer$split2[0],layerName=_layer$split2[1];var match=LayerUtils.searchLayer(_this.props.layers,layerUrl,layerName);if(match){_this.props.setActiveLayerInfo(match.layer,match.sublayer)}});_defineProperty(_this,"attribValue",function(text,attrName,layer,result){if(_typeof(text)==="object"){text=JSON.stringify(text)}if(_this.props.replaceImageUrls&&/^https?:\/\/.*\.(jpg|jpeg|png|bmp)$/i.exec(text)){return/*#__PURE__*/React.createElement("a",{href:text,rel:"noreferrer",target:"_blank"},/*#__PURE__*/React.createElement("img",{src:text}))}text=""+text;// Ensure text is a string
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
34
|
+
*/
|
|
35
|
+
import React from 'react';
|
|
36
|
+
import { connect } from 'react-redux';
|
|
37
|
+
import axios from 'axios';
|
|
38
|
+
import clone from 'clone';
|
|
39
|
+
import DOMPurify from 'dompurify';
|
|
40
|
+
import FileSaver from 'file-saver';
|
|
41
|
+
import htmlReactParser, { domToReact } from 'html-react-parser';
|
|
42
|
+
import JSZip from 'jszip';
|
|
43
|
+
import isEmpty from 'lodash.isempty';
|
|
44
|
+
import omit from 'lodash.omit';
|
|
45
|
+
import PropTypes from 'prop-types';
|
|
46
|
+
import { setActiveLayerInfo } from '../actions/layerinfo';
|
|
47
|
+
import { LayerRole, addLayerFeatures, removeLayer, changeLayerProperty } from '../actions/layers';
|
|
48
|
+
import { zoomToPoint } from '../actions/map';
|
|
49
|
+
import { openExternalUrl } from '../actions/windows';
|
|
50
|
+
import ConfigUtils from '../utils/ConfigUtils';
|
|
51
|
+
import CoordinatesUtils from '../utils/CoordinatesUtils';
|
|
52
|
+
import LayerUtils from '../utils/LayerUtils';
|
|
53
|
+
import LocaleUtils from '../utils/LocaleUtils';
|
|
54
|
+
import MapUtils from '../utils/MapUtils';
|
|
55
|
+
import MiscUtils from '../utils/MiscUtils';
|
|
56
|
+
import VectorLayerUtils from '../utils/VectorLayerUtils';
|
|
57
|
+
import Icon from './Icon';
|
|
58
|
+
import Spinner from './widgets/Spinner';
|
|
59
|
+
import './style/IdentifyViewer.css';
|
|
60
|
+
var EXCLUDE_PROPS = ['featurereport', 'displayfield', 'layername', 'layertitle', 'layerinfo', 'attribnames', 'clickPos', 'displayname', 'bbox'];
|
|
61
|
+
var EXCLUDE_ATTRS = ['htmlContent', 'htmlContentInline'];
|
|
62
|
+
var BuiltinExporters = [{
|
|
63
|
+
id: 'json',
|
|
64
|
+
title: 'json',
|
|
65
|
+
allowClipboard: true,
|
|
66
|
+
"export": function _export(json, callback) {
|
|
67
|
+
var data = JSON.stringify(json, null, ' ');
|
|
68
|
+
callback({
|
|
69
|
+
data: data,
|
|
70
|
+
type: "text/plain;charset=utf-8",
|
|
71
|
+
filename: "results.json"
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}, {
|
|
75
|
+
id: 'geojson',
|
|
76
|
+
title: 'geojson',
|
|
77
|
+
allowClipboard: true,
|
|
78
|
+
"export": function _export(json, callback) {
|
|
79
|
+
var featureCollection = {
|
|
80
|
+
type: "FeatureCollection",
|
|
81
|
+
features: Object.values(json).flat().map(function (entry) {
|
|
82
|
+
var feature = omit(entry, EXCLUDE_PROPS);
|
|
83
|
+
feature.properties = omit(feature.properties, EXCLUDE_ATTRS);
|
|
84
|
+
if (feature.geometry) {
|
|
85
|
+
feature.crs = {
|
|
86
|
+
type: "name",
|
|
87
|
+
properties: {
|
|
88
|
+
name: CoordinatesUtils.toOgcUrnCrs(entry.crs)
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
return feature;
|
|
93
|
+
})
|
|
94
|
+
};
|
|
95
|
+
var data = JSON.stringify(featureCollection, null, ' ');
|
|
96
|
+
callback({
|
|
97
|
+
data: data,
|
|
98
|
+
type: "application/geo+json;charset=utf-8",
|
|
99
|
+
filename: "results.json"
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}, {
|
|
103
|
+
id: 'csv',
|
|
104
|
+
title: 'CSV',
|
|
105
|
+
allowClipboard: true,
|
|
106
|
+
"export": function _export(json, callback) {
|
|
107
|
+
var dataset = [];
|
|
108
|
+
Object.entries(json).forEach(function (_ref) {
|
|
109
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
110
|
+
layerName = _ref2[0],
|
|
111
|
+
features = _ref2[1];
|
|
112
|
+
features.forEach(function (feature) {
|
|
113
|
+
dataset.push([feature.layertitle + ": " + feature.displayname]);
|
|
114
|
+
Object.entries(feature.properties || {}).forEach(function (_ref3) {
|
|
115
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
|
116
|
+
attrib = _ref4[0],
|
|
117
|
+
value = _ref4[1];
|
|
118
|
+
if (!EXCLUDE_ATTRS.includes(attrib)) {
|
|
119
|
+
dataset.push(["", attrib, String(value)]);
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
if (feature.geometry) {
|
|
123
|
+
dataset.push(["", "geometry", VectorLayerUtils.geoJSONGeomToWkt(feature.geometry)]);
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
var csv = dataset.map(function (row) {
|
|
128
|
+
return row.map(function (field) {
|
|
129
|
+
return field ? "\"".concat(field.replace('"', '""'), "\"") : "";
|
|
130
|
+
}).join("\t");
|
|
131
|
+
}).join("\n");
|
|
132
|
+
callback({
|
|
133
|
+
data: csv,
|
|
134
|
+
type: "text/plain;charset=utf-8",
|
|
135
|
+
filename: "results.csv"
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
}, {
|
|
139
|
+
id: 'csvzip',
|
|
140
|
+
title: 'CSV+ZIP',
|
|
141
|
+
allowClipboard: false,
|
|
142
|
+
"export": function _export(json, callback) {
|
|
143
|
+
var data = [];
|
|
144
|
+
var filenames = [];
|
|
145
|
+
Object.entries(json).forEach(function (_ref5) {
|
|
146
|
+
var _features$0$propertie, _features$;
|
|
147
|
+
var _ref6 = _slicedToArray(_ref5, 2),
|
|
148
|
+
layerName = _ref6[0],
|
|
149
|
+
features = _ref6[1];
|
|
150
|
+
var exportAttrs = Object.keys((_features$0$propertie = (_features$ = features[0]) === null || _features$ === void 0 ? void 0 : _features$.properties) !== null && _features$0$propertie !== void 0 ? _features$0$propertie : {}).filter(function (attr) {
|
|
151
|
+
return !EXCLUDE_ATTRS.includes(attr);
|
|
152
|
+
});
|
|
153
|
+
var dataset = [_toConsumableArray(exportAttrs)];
|
|
154
|
+
if (features[0].geometry) {
|
|
155
|
+
dataset[0].push("geometry");
|
|
156
|
+
}
|
|
157
|
+
features.forEach(function (feature) {
|
|
158
|
+
var row = exportAttrs.map(function (attr) {
|
|
159
|
+
return String(feature.properties[attr]);
|
|
160
|
+
});
|
|
161
|
+
if (feature.geometry) {
|
|
162
|
+
row.push(VectorLayerUtils.geoJSONGeomToWkt(feature.geometry));
|
|
163
|
+
}
|
|
164
|
+
dataset.push(row);
|
|
165
|
+
});
|
|
166
|
+
var csv = dataset.map(function (row) {
|
|
167
|
+
return row.map(function (field) {
|
|
168
|
+
return "\"".concat(field.replace('"', '""'), "\"");
|
|
169
|
+
}).join(";");
|
|
170
|
+
}).join("\n");
|
|
171
|
+
data.push(csv);
|
|
172
|
+
filenames.push(features[0].layername);
|
|
173
|
+
});
|
|
174
|
+
if (data.length > 1) {
|
|
175
|
+
var zip = new JSZip();
|
|
176
|
+
for (var i = 0; i < data.length; i++) {
|
|
177
|
+
var blob = new Blob([data[i]], {
|
|
178
|
+
type: "text/csv;charset=utf-8"
|
|
179
|
+
});
|
|
180
|
+
zip.file(filenames[i] + ".csv", blob);
|
|
181
|
+
}
|
|
182
|
+
zip.generateAsync({
|
|
183
|
+
type: "arraybuffer"
|
|
184
|
+
}).then(function (result) {
|
|
185
|
+
callback({
|
|
186
|
+
data: result,
|
|
187
|
+
type: "application/zip",
|
|
188
|
+
filename: "results.zip"
|
|
189
|
+
});
|
|
190
|
+
});
|
|
191
|
+
} else {
|
|
192
|
+
callback({
|
|
193
|
+
data: data[0],
|
|
194
|
+
type: "text/csv;charset=utf-8",
|
|
195
|
+
filename: filenames[0] + ".csv"
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}, {
|
|
200
|
+
id: 'shapefile',
|
|
201
|
+
title: 'Shapefile',
|
|
202
|
+
allowClipboard: false,
|
|
203
|
+
"export": function _export(json, callback) {
|
|
204
|
+
import("@mapbox/shp-write").then(function (shpwriteMod) {
|
|
205
|
+
var shpwrite = shpwriteMod["default"];
|
|
206
|
+
var layers = Object.entries(json);
|
|
207
|
+
var options = {
|
|
208
|
+
outputType: 'arraybuffer',
|
|
209
|
+
types: {
|
|
210
|
+
point: 'points',
|
|
211
|
+
polygon: 'polygons',
|
|
212
|
+
polyline: 'lines'
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
var promises = layers.map(function (_ref7) {
|
|
216
|
+
var _features$2;
|
|
217
|
+
var _ref8 = _slicedToArray(_ref7, 2),
|
|
218
|
+
layerName = _ref8[0],
|
|
219
|
+
features = _ref8[1];
|
|
220
|
+
var geojson = {
|
|
221
|
+
type: "FeatureCollection",
|
|
222
|
+
features: features.map(function (entry) {
|
|
223
|
+
return omit(entry, EXCLUDE_PROPS);
|
|
224
|
+
})
|
|
225
|
+
};
|
|
226
|
+
var layerOptions = _objectSpread(_objectSpread({}, options), {}, {
|
|
227
|
+
folder: layerName
|
|
228
|
+
});
|
|
229
|
+
var crs = (_features$2 = features[0]) === null || _features$2 === void 0 ? void 0 : _features$2.crs;
|
|
230
|
+
if (crs) {
|
|
231
|
+
var wkt = CoordinatesUtils.getEsriWktFromCrs(crs);
|
|
232
|
+
if (wkt) {
|
|
233
|
+
layerOptions.prj = wkt;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
return shpwrite.zip(geojson, layerOptions).then(function (shpData) {
|
|
237
|
+
return {
|
|
238
|
+
layerName: layerName,
|
|
239
|
+
shpData: shpData
|
|
240
|
+
};
|
|
241
|
+
});
|
|
242
|
+
});
|
|
243
|
+
Promise.all(promises).then(function (results) {
|
|
244
|
+
if (results.length === 1) {
|
|
245
|
+
callback({
|
|
246
|
+
data: results[0].shpData,
|
|
247
|
+
type: "application/zip",
|
|
248
|
+
filename: results[0].layerName + ".zip"
|
|
249
|
+
});
|
|
250
|
+
} else {
|
|
251
|
+
var zip = new JSZip();
|
|
252
|
+
results.forEach(function (_ref9) {
|
|
253
|
+
var layerName = _ref9.layerName,
|
|
254
|
+
shpData = _ref9.shpData;
|
|
255
|
+
zip.file(layerName + ".zip", shpData);
|
|
256
|
+
});
|
|
257
|
+
zip.generateAsync({
|
|
258
|
+
type: "arraybuffer"
|
|
259
|
+
}).then(function (result) {
|
|
260
|
+
callback({
|
|
261
|
+
data: result,
|
|
262
|
+
type: "application/zip",
|
|
263
|
+
filename: "shapefiles.zip"
|
|
264
|
+
});
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
}, {
|
|
271
|
+
id: 'xlsx',
|
|
272
|
+
title: 'XLSX',
|
|
273
|
+
allowClipboard: false,
|
|
274
|
+
"export": function _export(json, callback) {
|
|
275
|
+
import('xlsx').then(function (xlsx) {
|
|
276
|
+
var document = xlsx.utils.book_new();
|
|
277
|
+
Object.entries(json).forEach(function (_ref10) {
|
|
278
|
+
var _features$0$propertie2, _features$3;
|
|
279
|
+
var _ref11 = _slicedToArray(_ref10, 2),
|
|
280
|
+
layerName = _ref11[0],
|
|
281
|
+
features = _ref11[1];
|
|
282
|
+
var exportAttrs = Object.keys((_features$0$propertie2 = (_features$3 = features[0]) === null || _features$3 === void 0 ? void 0 : _features$3.properties) !== null && _features$0$propertie2 !== void 0 ? _features$0$propertie2 : {}).filter(function (attr) {
|
|
283
|
+
return !EXCLUDE_ATTRS.includes(attr);
|
|
284
|
+
});
|
|
285
|
+
var dataset = [_toConsumableArray(exportAttrs)];
|
|
286
|
+
if (features[0].geometry) {
|
|
287
|
+
dataset[0].push("geometry");
|
|
288
|
+
}
|
|
289
|
+
features.forEach(function (feature) {
|
|
290
|
+
var row = exportAttrs.map(function (attr) {
|
|
291
|
+
return feature.properties[attr];
|
|
292
|
+
});
|
|
293
|
+
if (feature.geometry) {
|
|
294
|
+
var geomWkt = VectorLayerUtils.geoJSONGeomToWkt(feature.geometry);
|
|
295
|
+
if (geomWkt.length < 32768) {
|
|
296
|
+
row.push(geomWkt);
|
|
297
|
+
} else {
|
|
298
|
+
row.push("Geometry too large");
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
dataset.push(row);
|
|
302
|
+
});
|
|
303
|
+
var worksheet = xlsx.utils.aoa_to_sheet(dataset);
|
|
304
|
+
var sheetName = features[0].layertitle.slice(0, 30).replace(/[\\/?*[]]?/g, '_');
|
|
305
|
+
xlsx.utils.book_append_sheet(document, worksheet, sheetName);
|
|
306
|
+
});
|
|
307
|
+
var data = xlsx.write(document, {
|
|
308
|
+
type: "buffer"
|
|
309
|
+
});
|
|
310
|
+
callback({
|
|
311
|
+
data: data,
|
|
312
|
+
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
313
|
+
filename: "results.xlsx"
|
|
314
|
+
});
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
}];
|
|
318
|
+
var IdentifyViewer = /*#__PURE__*/function (_React$Component) {
|
|
319
|
+
function IdentifyViewer(props) {
|
|
320
|
+
var _this;
|
|
321
|
+
_classCallCheck(this, IdentifyViewer);
|
|
322
|
+
_this = _callSuper(this, IdentifyViewer, [props]);
|
|
323
|
+
_defineProperty(_this, "state", {
|
|
324
|
+
expanded: {},
|
|
325
|
+
expandedResults: {},
|
|
326
|
+
resultTree: {},
|
|
327
|
+
reports: {},
|
|
328
|
+
currentResult: null,
|
|
329
|
+
currentLayer: null,
|
|
330
|
+
exportFormat: 'geojson',
|
|
331
|
+
selectedAggregatedReport: "",
|
|
332
|
+
generatingReport: false,
|
|
333
|
+
selectedLayer: ''
|
|
334
|
+
});
|
|
335
|
+
_defineProperty(_this, "updateResultTree", function () {
|
|
336
|
+
var layers = Object.keys(_this.props.identifyResults);
|
|
337
|
+
var currentResult = null;
|
|
338
|
+
var currentLayer = null;
|
|
339
|
+
if (layers.length === 1 && _this.props.identifyResults[layers[0]].length === 1) {
|
|
340
|
+
currentLayer = layers[0];
|
|
341
|
+
currentResult = _this.props.identifyResults[layers[0]][0];
|
|
342
|
+
}
|
|
343
|
+
_this.setState({
|
|
344
|
+
resultTree: clone(_this.props.identifyResults),
|
|
345
|
+
currentResult: currentResult,
|
|
346
|
+
currentLayer: currentLayer,
|
|
347
|
+
reports: LayerUtils.collectFeatureReports(_this.props.layers)
|
|
348
|
+
});
|
|
349
|
+
});
|
|
350
|
+
_defineProperty(_this, "setHighlightedResults", function (results, resultTree) {
|
|
351
|
+
if (!results && _this.props.highlightAllResults) {
|
|
352
|
+
var selectedLayer = _this.state.selectedLayer || '';
|
|
353
|
+
results = Object.keys(resultTree).reduce(function (res, layer) {
|
|
354
|
+
var layerData = resultTree[selectedLayer || layer];
|
|
355
|
+
return res.concat(layerData.map(function (result) {
|
|
356
|
+
return _objectSpread(_objectSpread({}, result), {}, {
|
|
357
|
+
id: "".concat(selectedLayer || layer, ".").concat(result.id)
|
|
358
|
+
});
|
|
359
|
+
}));
|
|
360
|
+
}, []);
|
|
361
|
+
}
|
|
362
|
+
results = (results || []).filter(function (result) {
|
|
363
|
+
return result.type.toLowerCase() === "feature";
|
|
364
|
+
}).map(function (feature) {
|
|
365
|
+
var newFeature = _objectSpread(_objectSpread({}, feature), {}, {
|
|
366
|
+
properties: {}
|
|
367
|
+
});
|
|
368
|
+
// Ensure selection style is used
|
|
369
|
+
delete newFeature.styleName;
|
|
370
|
+
delete newFeature.styleOptions;
|
|
371
|
+
return newFeature;
|
|
372
|
+
});
|
|
373
|
+
if (!isEmpty(results)) {
|
|
374
|
+
var layer = {
|
|
375
|
+
id: "__identifyviewerhighlight",
|
|
376
|
+
role: LayerRole.SELECTION
|
|
377
|
+
};
|
|
378
|
+
_this.props.addLayerFeatures(layer, results, true);
|
|
379
|
+
} else {
|
|
380
|
+
_this.props.removeLayer("__identifyviewerhighlight");
|
|
381
|
+
}
|
|
382
|
+
});
|
|
383
|
+
_defineProperty(_this, "getExpandedClass", function (path, deflt) {
|
|
384
|
+
var expanded = _this.state.expanded[path] !== undefined ? _this.state.expanded[path] : deflt;
|
|
385
|
+
return expanded ? "identify-layer-expandable identify-layer-expanded" : "identify-layer-expandable";
|
|
386
|
+
});
|
|
387
|
+
_defineProperty(_this, "toggleExpanded", function (path, deflt) {
|
|
388
|
+
var newstate = _this.state.expanded[path] !== undefined ? !_this.state.expanded[path] : !deflt;
|
|
389
|
+
var diff = {};
|
|
390
|
+
diff[path] = newstate;
|
|
391
|
+
if (_this.state.currentLayer === path && !newstate) {
|
|
392
|
+
_this.setState(function (state) {
|
|
393
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
394
|
+
expanded: _objectSpread(_objectSpread({}, state.expanded), diff),
|
|
395
|
+
currentResult: null,
|
|
396
|
+
currentLayer: null
|
|
397
|
+
});
|
|
398
|
+
});
|
|
399
|
+
} else {
|
|
400
|
+
_this.setState(function (state) {
|
|
401
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
402
|
+
expanded: _objectSpread(_objectSpread({}, state.expanded), diff)
|
|
403
|
+
});
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
});
|
|
407
|
+
_defineProperty(_this, "setCurrentResult", function (layer, result) {
|
|
408
|
+
if (_this.state.currentResult === result) {
|
|
409
|
+
_this.setState({
|
|
410
|
+
currentResult: null,
|
|
411
|
+
currentLayer: null
|
|
412
|
+
});
|
|
413
|
+
} else {
|
|
414
|
+
_this.setState({
|
|
415
|
+
currentResult: result,
|
|
416
|
+
currentLayer: layer
|
|
417
|
+
});
|
|
418
|
+
_this.scrollIntoView = true;
|
|
419
|
+
}
|
|
420
|
+
});
|
|
421
|
+
_defineProperty(_this, "removeResultLayer", function (layer) {
|
|
422
|
+
_this.setState(function (state) {
|
|
423
|
+
var newResultTree = _objectSpread({}, state.resultTree);
|
|
424
|
+
delete newResultTree[layer];
|
|
425
|
+
_this.setState({
|
|
426
|
+
resultTree: newResultTree,
|
|
427
|
+
currentResult: state.currentLayer === layer ? null : state.currentResult,
|
|
428
|
+
currentLayer: state.currentLayer === layer ? null : state.currentLayer
|
|
429
|
+
});
|
|
430
|
+
});
|
|
431
|
+
});
|
|
432
|
+
_defineProperty(_this, "removeResult", function (layer, result) {
|
|
433
|
+
_this.setState(function (state) {
|
|
434
|
+
var newResultTree = _objectSpread({}, state.resultTree);
|
|
435
|
+
newResultTree[layer] = state.resultTree[layer].filter(function (item) {
|
|
436
|
+
return item !== result;
|
|
437
|
+
});
|
|
438
|
+
if (isEmpty(newResultTree[layer])) {
|
|
439
|
+
delete newResultTree[layer];
|
|
440
|
+
}
|
|
441
|
+
var selectedLayer = isEmpty(newResultTree[layer]) ? '' : state.selectedLayer;
|
|
442
|
+
return {
|
|
443
|
+
resultTree: newResultTree,
|
|
444
|
+
currentResult: state.currentResult === result ? null : state.currentResult,
|
|
445
|
+
selectedLayer: selectedLayer
|
|
446
|
+
};
|
|
447
|
+
});
|
|
448
|
+
});
|
|
449
|
+
_defineProperty(_this, "exportResults", function () {
|
|
450
|
+
var clipboard = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
451
|
+
var filteredResults = {};
|
|
452
|
+
Object.keys(_this.state.selectedLayer !== '' ? _defineProperty({}, _this.state.selectedLayer, _this.state.resultTree[_this.state.selectedLayer]) : _this.state.resultTree).map(function (key) {
|
|
453
|
+
if (!isEmpty(_this.state.resultTree[key])) {
|
|
454
|
+
filteredResults[key] = _this.state.resultTree[key];
|
|
455
|
+
}
|
|
456
|
+
});
|
|
457
|
+
_this["export"](filteredResults, clipboard);
|
|
458
|
+
});
|
|
459
|
+
_defineProperty(_this, "exportResultLayer", function (layer) {
|
|
460
|
+
_this["export"](_defineProperty({}, layer, _this.state.resultTree[layer]));
|
|
461
|
+
});
|
|
462
|
+
_defineProperty(_this, "exportResult", function (layer, result) {
|
|
463
|
+
_this["export"](_defineProperty({}, layer, [result]));
|
|
464
|
+
});
|
|
465
|
+
_defineProperty(_this, "export", function (json) {
|
|
466
|
+
var clipboard = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
467
|
+
var exporter = _this.getExporters().find(function (entry) {
|
|
468
|
+
return entry.id === _this.state.exportFormat;
|
|
469
|
+
});
|
|
470
|
+
if (exporter) {
|
|
471
|
+
if (!_this.props.exportGeometry) {
|
|
472
|
+
json = Object.entries(json).reduce(function (res, _ref13) {
|
|
473
|
+
var _ref14 = _slicedToArray(_ref13, 2),
|
|
474
|
+
layerId = _ref14[0],
|
|
475
|
+
features = _ref14[1];
|
|
476
|
+
return _objectSpread(_objectSpread({}, res), {}, _defineProperty({}, layerId, features.map(function (feature) {
|
|
477
|
+
return omit(feature, ['geometry']);
|
|
478
|
+
})));
|
|
479
|
+
}, {});
|
|
480
|
+
}
|
|
481
|
+
exporter["export"](json, function (result) {
|
|
482
|
+
if (clipboard && exporter.allowClipboard) {
|
|
483
|
+
navigator.clipboard.writeText(result.data);
|
|
484
|
+
} else {
|
|
485
|
+
FileSaver.saveAs(new Blob([result.data], {
|
|
486
|
+
type: result.type
|
|
487
|
+
}), result.filename);
|
|
488
|
+
}
|
|
489
|
+
});
|
|
490
|
+
}
|
|
491
|
+
});
|
|
492
|
+
_defineProperty(_this, "renderLayer", function (layer) {
|
|
493
|
+
var results = _this.state.resultTree[layer];
|
|
494
|
+
if (results.length === 0) {
|
|
495
|
+
return null;
|
|
496
|
+
}
|
|
497
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
498
|
+
className: _this.getExpandedClass(layer, true),
|
|
499
|
+
key: layer
|
|
500
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
501
|
+
className: "identify-result-entry",
|
|
502
|
+
onMouseEnter: function onMouseEnter() {
|
|
503
|
+
return _this.setHighlightedResults(results, _this.state.resultTree);
|
|
504
|
+
},
|
|
505
|
+
onMouseLeave: function onMouseLeave() {
|
|
506
|
+
return _this.setHighlightedResults(_this.state.currentResult === null ? null : [_this.state.currentResult], _this.state.resultTree);
|
|
507
|
+
}
|
|
508
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
509
|
+
className: "clickable",
|
|
510
|
+
onClick: function onClick() {
|
|
511
|
+
return _this.toggleExpanded(layer, true);
|
|
512
|
+
}
|
|
513
|
+
}, /*#__PURE__*/React.createElement("b", null, results[0].layertitle)), /*#__PURE__*/React.createElement(Icon, {
|
|
514
|
+
className: "identify-remove-result",
|
|
515
|
+
icon: "minus-sign",
|
|
516
|
+
onClick: function onClick() {
|
|
517
|
+
return _this.removeResultLayer(layer);
|
|
518
|
+
}
|
|
519
|
+
}), _this.props.enableExport === true || !isEmpty(_this.props.enableExport) ? /*#__PURE__*/React.createElement(Icon, {
|
|
520
|
+
className: "identify-export-result",
|
|
521
|
+
icon: "export",
|
|
522
|
+
onClick: function onClick() {
|
|
523
|
+
return _this.exportResultLayer(layer);
|
|
524
|
+
}
|
|
525
|
+
}) : null), /*#__PURE__*/React.createElement("div", {
|
|
526
|
+
className: "identify-layer-entries"
|
|
527
|
+
}, results.map(function (result) {
|
|
528
|
+
return _this.renderResult(layer, result);
|
|
529
|
+
})));
|
|
530
|
+
});
|
|
531
|
+
_defineProperty(_this, "renderResult", function (layer, result) {
|
|
532
|
+
var ref = _this.state.currentResult === result && _this.scrollIntoView ? function (el) {
|
|
533
|
+
_this.currentResultElRef = el;
|
|
534
|
+
} : null;
|
|
535
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
536
|
+
className: "identify-result-entry",
|
|
537
|
+
key: result.id,
|
|
538
|
+
onMouseEnter: function onMouseEnter() {
|
|
539
|
+
return _this.setHighlightedResults([result], _this.state.resultTree);
|
|
540
|
+
},
|
|
541
|
+
onMouseLeave: function onMouseLeave() {
|
|
542
|
+
return _this.setHighlightedResults(_this.state.currentResult === null ? null : [_this.state.currentResult], _this.state.resultTree);
|
|
543
|
+
}
|
|
544
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
545
|
+
className: _this.state.currentResult === result ? "active clickable" : "clickable",
|
|
546
|
+
onClick: function onClick() {
|
|
547
|
+
return _this.setCurrentResult(layer, result);
|
|
548
|
+
},
|
|
549
|
+
ref: ref
|
|
550
|
+
}, result.displayname), /*#__PURE__*/React.createElement(Icon, {
|
|
551
|
+
className: "identify-remove-result",
|
|
552
|
+
icon: "minus-sign",
|
|
553
|
+
onClick: function onClick() {
|
|
554
|
+
return _this.removeResult(layer, result);
|
|
555
|
+
}
|
|
556
|
+
}), _this.props.enableExport === true || !isEmpty(_this.props.enableExport) ? /*#__PURE__*/React.createElement(Icon, {
|
|
557
|
+
className: "identify-export-result",
|
|
558
|
+
icon: "export",
|
|
559
|
+
onClick: function onClick() {
|
|
560
|
+
return _this.exportResult(layer, result);
|
|
561
|
+
}
|
|
562
|
+
}) : null);
|
|
563
|
+
});
|
|
564
|
+
_defineProperty(_this, "renderResultAttributes", function (layer, result, resultClass) {
|
|
565
|
+
if (!result) {
|
|
566
|
+
return null;
|
|
567
|
+
}
|
|
568
|
+
var resultbox = null;
|
|
569
|
+
var extraattribs = null;
|
|
570
|
+
var inlineExtaAttribs = false;
|
|
571
|
+
var featureReports = _this.state.reports[layer] || [];
|
|
572
|
+
if (result.featureReport) {
|
|
573
|
+
featureReports.push({
|
|
574
|
+
title: result.layertitle,
|
|
575
|
+
template: result.featureReport
|
|
576
|
+
});
|
|
577
|
+
}
|
|
578
|
+
if (result.type === "text") {
|
|
579
|
+
resultbox = /*#__PURE__*/React.createElement("pre", {
|
|
580
|
+
className: "identify-result-box"
|
|
581
|
+
}, result.text);
|
|
582
|
+
} else if (result.type === "html") {
|
|
583
|
+
resultbox = /*#__PURE__*/React.createElement("iframe", {
|
|
584
|
+
className: "identify-result-box",
|
|
585
|
+
onLoad: function onLoad(ev) {
|
|
586
|
+
return _this.setIframeContent(ev.target, result.text);
|
|
587
|
+
},
|
|
588
|
+
ref: function ref(el) {
|
|
589
|
+
return _this.pollIframe(el, result.text);
|
|
590
|
+
}
|
|
591
|
+
});
|
|
592
|
+
} else if (result.properties.htmlContent) {
|
|
593
|
+
if (result.properties.htmlContentInline) {
|
|
594
|
+
resultbox = /*#__PURE__*/React.createElement("div", {
|
|
595
|
+
className: "identify-result-box"
|
|
596
|
+
}, _this.parsedContent(result.properties.htmlContent));
|
|
597
|
+
} else {
|
|
598
|
+
resultbox = /*#__PURE__*/React.createElement("iframe", {
|
|
599
|
+
className: "identify-result-box",
|
|
600
|
+
onLoad: function onLoad(ev) {
|
|
601
|
+
return _this.setIframeContent(ev.target, result.properties.htmlContent);
|
|
602
|
+
},
|
|
603
|
+
ref: function ref(el) {
|
|
604
|
+
return _this.pollIframe(el, result.properties.htmlContent);
|
|
605
|
+
}
|
|
606
|
+
});
|
|
607
|
+
}
|
|
608
|
+
} else {
|
|
609
|
+
var _rows;
|
|
610
|
+
inlineExtaAttribs = true;
|
|
611
|
+
var properties = Object.keys(result.properties) || [];
|
|
612
|
+
var rows = [];
|
|
613
|
+
if (properties.length === 1 && result.properties.maptip) {
|
|
614
|
+
rows = properties.map(function (attrib) {
|
|
615
|
+
return /*#__PURE__*/React.createElement("tr", {
|
|
616
|
+
key: attrib
|
|
617
|
+
}, /*#__PURE__*/React.createElement("td", {
|
|
618
|
+
className: "identify-attr-value"
|
|
619
|
+
}, _this.attribValue(result.properties[attrib], attrib, layer, result)));
|
|
620
|
+
});
|
|
621
|
+
} else {
|
|
622
|
+
rows = properties.map(function (attrib) {
|
|
623
|
+
if (_this.props.theme.skipEmptyFeatureAttributes && (result.properties[attrib] === "" || result.properties[attrib] === null || result.properties[attrib] === "NULL")) {
|
|
624
|
+
return null;
|
|
625
|
+
}
|
|
626
|
+
return /*#__PURE__*/React.createElement("tr", {
|
|
627
|
+
key: attrib
|
|
628
|
+
}, /*#__PURE__*/React.createElement("td", {
|
|
629
|
+
className: "identify-attr-title " + _this.props.longAttributesDisplay
|
|
630
|
+
}, /*#__PURE__*/React.createElement("i", null, attrib)), /*#__PURE__*/React.createElement("td", {
|
|
631
|
+
className: "identify-attr-value " + _this.props.longAttributesDisplay
|
|
632
|
+
}, _this.attribValue(result.properties[attrib], attrib, layer, result)));
|
|
633
|
+
});
|
|
634
|
+
}
|
|
635
|
+
(_rows = rows).push.apply(_rows, _toConsumableArray(_this.computeExtraAttributes(layer, result)));
|
|
636
|
+
featureReports.forEach(function (report, idx) {
|
|
637
|
+
rows.push(/*#__PURE__*/React.createElement("tr", {
|
|
638
|
+
key: "__featurereport" + idx
|
|
639
|
+
}, /*#__PURE__*/React.createElement("td", {
|
|
640
|
+
className: "identify-attr-title " + _this.props.longAttributesDisplay
|
|
641
|
+
}, /*#__PURE__*/React.createElement("i", null, LocaleUtils.tr("identify.featureReport") + ": " + report.title)), /*#__PURE__*/React.createElement("td", {
|
|
642
|
+
className: "identify-attr-value " + _this.props.longAttributesDisplay
|
|
643
|
+
}, /*#__PURE__*/React.createElement("a", {
|
|
644
|
+
href: _this.getFeatureReportUrl(report, result)
|
|
645
|
+
}, LocaleUtils.tr("identify.link")))));
|
|
646
|
+
});
|
|
647
|
+
if (isEmpty(rows)) {
|
|
648
|
+
rows = /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", {
|
|
649
|
+
className: "identify-attr-value"
|
|
650
|
+
}, /*#__PURE__*/React.createElement("i", null, LocaleUtils.tr("identify.noattributes"))));
|
|
651
|
+
}
|
|
652
|
+
resultbox = /*#__PURE__*/React.createElement("div", {
|
|
653
|
+
className: "identify-result-box"
|
|
654
|
+
}, /*#__PURE__*/React.createElement("table", {
|
|
655
|
+
className: "attribute-list"
|
|
656
|
+
}, /*#__PURE__*/React.createElement("tbody", null, rows)));
|
|
657
|
+
}
|
|
658
|
+
if (!inlineExtaAttribs && (_this.props.attributeCalculator || !isEmpty(_this.state.reports[layer]))) {
|
|
659
|
+
extraattribs = /*#__PURE__*/React.createElement("div", {
|
|
660
|
+
className: "identify-result-box"
|
|
661
|
+
}, /*#__PURE__*/React.createElement("table", {
|
|
662
|
+
className: "attribute-list"
|
|
663
|
+
}, /*#__PURE__*/React.createElement("tbody", null, _this.computeExtraAttributes(layer, result), featureReports.map(function (report, idx) {
|
|
664
|
+
return /*#__PURE__*/React.createElement("tr", {
|
|
665
|
+
key: "report" + idx
|
|
666
|
+
}, /*#__PURE__*/React.createElement("td", {
|
|
667
|
+
className: "identify-attr-title " + _this.props.longAttributesDisplay
|
|
668
|
+
}, /*#__PURE__*/React.createElement("i", null, LocaleUtils.tr("identify.featureReport") + ": " + report.title)), /*#__PURE__*/React.createElement("td", {
|
|
669
|
+
className: "identify-attr-value " + _this.props.longAttributesDisplay
|
|
670
|
+
}, /*#__PURE__*/React.createElement("a", {
|
|
671
|
+
href: _this.getFeatureReportUrl(report, result),
|
|
672
|
+
rel: "noreferrer",
|
|
673
|
+
target: "_blank"
|
|
674
|
+
}, LocaleUtils.tr("identify.link"))));
|
|
675
|
+
}))));
|
|
676
|
+
}
|
|
677
|
+
var zoomToFeatureButton = null;
|
|
678
|
+
if (result.bbox && result.crs) {
|
|
679
|
+
zoomToFeatureButton = /*#__PURE__*/React.createElement(Icon, {
|
|
680
|
+
icon: "zoom",
|
|
681
|
+
onClick: function onClick() {
|
|
682
|
+
return _this.zoomToResult(result);
|
|
683
|
+
}
|
|
684
|
+
});
|
|
685
|
+
}
|
|
686
|
+
var key = result + ":" + result.id;
|
|
687
|
+
var expanded = _this.state.expandedResults[key];
|
|
688
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
689
|
+
className: resultClass,
|
|
690
|
+
key: "results-attributes"
|
|
691
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
692
|
+
className: "identify-result-title"
|
|
693
|
+
}, _this.props.collapsible ? /*#__PURE__*/React.createElement(Icon, {
|
|
694
|
+
icon: expanded ? "triangle-down" : "triangle-right",
|
|
695
|
+
onClick: function onClick() {
|
|
696
|
+
return _this.setState(function (state) {
|
|
697
|
+
return {
|
|
698
|
+
expandedResults: _objectSpread(_objectSpread({}, state.expandedResults), {}, _defineProperty({}, key, !expanded))
|
|
699
|
+
};
|
|
700
|
+
});
|
|
701
|
+
}
|
|
702
|
+
}) : null, /*#__PURE__*/React.createElement("span", null, (_this.props.showLayerTitles ? result.layertitle + ": " : "") + result.displayname), zoomToFeatureButton, /*#__PURE__*/React.createElement(Icon, {
|
|
703
|
+
icon: "info-sign",
|
|
704
|
+
onClick: function onClick() {
|
|
705
|
+
return _this.showLayerInfo(layer);
|
|
706
|
+
}
|
|
707
|
+
}), /*#__PURE__*/React.createElement(Icon, {
|
|
708
|
+
icon: "trash",
|
|
709
|
+
onClick: function onClick() {
|
|
710
|
+
return _this.removeResult(layer, result);
|
|
711
|
+
}
|
|
712
|
+
})), _this.props.collapsible && !expanded ? null : /*#__PURE__*/React.createElement("div", {
|
|
713
|
+
className: "identify-result-container"
|
|
714
|
+
}, resultbox, extraattribs));
|
|
715
|
+
});
|
|
716
|
+
_defineProperty(_this, "computeExtraAttributes", function (layer, result) {
|
|
717
|
+
var _window$qwc;
|
|
718
|
+
var rows = [];
|
|
719
|
+
Object.values(((_window$qwc = window.qwc2) === null || _window$qwc === void 0 ? void 0 : _window$qwc.__attributeCalculators) || {}).forEach(function (calc, idx) {
|
|
720
|
+
var row = calc(layer, result);
|
|
721
|
+
if (row.length === 2) {
|
|
722
|
+
rows.push(/*#__PURE__*/React.createElement("tr", {
|
|
723
|
+
key: "custom-attr-" + idx
|
|
724
|
+
}, /*#__PURE__*/React.createElement("td", {
|
|
725
|
+
className: "identify-attr-title"
|
|
726
|
+
}, /*#__PURE__*/React.createElement("i", null, row[0])), /*#__PURE__*/React.createElement("td", {
|
|
727
|
+
className: "identify-attr-value"
|
|
728
|
+
}, row[1])));
|
|
729
|
+
} else if (row.length === 1) {
|
|
730
|
+
rows.push(/*#__PURE__*/React.createElement("tr", {
|
|
731
|
+
key: "custom-attr-" + idx
|
|
732
|
+
}, /*#__PURE__*/React.createElement("td", {
|
|
733
|
+
colSpan: "2"
|
|
734
|
+
}, row[0])));
|
|
735
|
+
}
|
|
736
|
+
});
|
|
737
|
+
if (_this.props.attributeCalculator) {
|
|
738
|
+
rows.push.apply(rows, _toConsumableArray(_this.props.attributeCalculator(layer, result)));
|
|
739
|
+
}
|
|
740
|
+
return rows;
|
|
741
|
+
});
|
|
742
|
+
_defineProperty(_this, "getExporters", function () {
|
|
743
|
+
var _window$qwc2;
|
|
744
|
+
return [].concat(BuiltinExporters, _toConsumableArray(_this.props.customExporters), _toConsumableArray(Object.values(((_window$qwc2 = window.qwc2) === null || _window$qwc2 === void 0 ? void 0 : _window$qwc2.__identifyExportes) || [])));
|
|
745
|
+
});
|
|
746
|
+
_defineProperty(_this, "setIframeContent", function (iframe, html) {
|
|
747
|
+
if (iframe.getAttribute("identify-content-set")) {
|
|
748
|
+
return;
|
|
749
|
+
}
|
|
750
|
+
iframe.setAttribute("identify-content-set", true);
|
|
751
|
+
iframe.contentWindow.document.open();
|
|
752
|
+
iframe.contentWindow.document.write(html);
|
|
753
|
+
iframe.contentWindow.document.close();
|
|
754
|
+
});
|
|
755
|
+
_defineProperty(_this, "pollIframe", function (iframe, html) {
|
|
756
|
+
if (iframe && !iframe.getAttribute("identify-content-set")) {
|
|
757
|
+
var interval = setInterval(function () {
|
|
758
|
+
if (iframe.getAttribute("identify-content-set")) {
|
|
759
|
+
return clearInterval(interval);
|
|
760
|
+
}
|
|
761
|
+
if (iframe.contentWindow && iframe.contentWindow.document) {
|
|
762
|
+
iframe.setAttribute("identify-content-set", true);
|
|
763
|
+
iframe.contentWindow.document.open();
|
|
764
|
+
iframe.contentWindow.document.write(html);
|
|
765
|
+
iframe.contentWindow.document.close();
|
|
766
|
+
clearInterval(interval);
|
|
767
|
+
}
|
|
768
|
+
return true;
|
|
769
|
+
}, 500);
|
|
770
|
+
}
|
|
771
|
+
});
|
|
772
|
+
_defineProperty(_this, "collectFeatureReportTemplates", function (entry) {
|
|
773
|
+
var reports = {};
|
|
774
|
+
if (entry.sublayers) {
|
|
775
|
+
var _iterator = _createForOfIteratorHelper(entry.sublayers),
|
|
776
|
+
_step;
|
|
777
|
+
try {
|
|
778
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
779
|
+
var sublayer = _step.value;
|
|
780
|
+
reports = _objectSpread(_objectSpread({}, reports), _this.collectFeatureReportTemplates(sublayer));
|
|
781
|
+
}
|
|
782
|
+
} catch (err) {
|
|
783
|
+
_iterator.e(err);
|
|
784
|
+
} finally {
|
|
785
|
+
_iterator.f();
|
|
786
|
+
}
|
|
787
|
+
} else if (entry.featureReport) {
|
|
788
|
+
reports[entry.name] = entry.featureReport;
|
|
789
|
+
}
|
|
790
|
+
return reports;
|
|
791
|
+
});
|
|
792
|
+
_defineProperty(_this, "findFeatureReportTemplate", function (layer) {
|
|
793
|
+
var reports = {};
|
|
794
|
+
_this.props.layers.filter(function (l) {
|
|
795
|
+
return l.role === LayerRole.THEME;
|
|
796
|
+
}).forEach(function (themeLayer) {
|
|
797
|
+
reports = _objectSpread(_objectSpread({}, reports), _this.collectFeatureReportTemplates(themeLayer));
|
|
798
|
+
});
|
|
799
|
+
return reports[layer] || null;
|
|
800
|
+
});
|
|
801
|
+
_defineProperty(_this, "getFeatureReportUrl", function (report, result) {
|
|
802
|
+
var serviceUrl = ConfigUtils.getConfigProp("documentServiceUrl").replace(/\/$/, "");
|
|
803
|
+
var params = {
|
|
804
|
+
feature: result.id,
|
|
805
|
+
x: result.clickPos[0],
|
|
806
|
+
y: result.clickPos[1],
|
|
807
|
+
crs: _this.props.map.projection,
|
|
808
|
+
single_report: report.single_report || false
|
|
809
|
+
};
|
|
810
|
+
var path = "/" + report.template + "." + (report.format || "pdf");
|
|
811
|
+
var query = Object.keys(params).map(function (key) {
|
|
812
|
+
return encodeURIComponent(key) + "=" + encodeURIComponent(params[key]);
|
|
813
|
+
}).join("&");
|
|
814
|
+
return serviceUrl + path + "?" + query;
|
|
815
|
+
});
|
|
816
|
+
_defineProperty(_this, "downloadAggregatedReport", function () {
|
|
817
|
+
var _this$state$selectedA = _this.state.selectedAggregatedReport.split("::"),
|
|
818
|
+
_this$state$selectedA2 = _slicedToArray(_this$state$selectedA, 2),
|
|
819
|
+
layername = _this$state$selectedA2[0],
|
|
820
|
+
idx = _this$state$selectedA2[1];
|
|
821
|
+
var report = _this.state.reports[layername][idx];
|
|
822
|
+
var results = _this.state.resultTree[layername];
|
|
823
|
+
var serviceUrl = ConfigUtils.getConfigProp("documentServiceUrl").replace(/\/$/, "");
|
|
824
|
+
var params = {
|
|
825
|
+
feature: results.map(function (result) {
|
|
826
|
+
return result.id;
|
|
827
|
+
}).join(","),
|
|
828
|
+
x: results[0].clickPos[0],
|
|
829
|
+
y: results[0].clickPos[1],
|
|
830
|
+
crs: _this.props.map.projection,
|
|
831
|
+
single_report: report.single_report || false
|
|
832
|
+
};
|
|
833
|
+
_this.setState({
|
|
834
|
+
generatingReport: true
|
|
835
|
+
});
|
|
836
|
+
var url = serviceUrl + "/" + report.template;
|
|
837
|
+
axios.get(url, {
|
|
838
|
+
params: params,
|
|
839
|
+
responseType: "arraybuffer"
|
|
840
|
+
}).then(function (response) {
|
|
841
|
+
var filename = (report.filename || report.title.replace(" ", "_")) + "." + (report.format || "pdf");
|
|
842
|
+
FileSaver.saveAs(new Blob([response.data], {
|
|
843
|
+
type: "application/pdf"
|
|
844
|
+
}), filename);
|
|
845
|
+
_this.setState({
|
|
846
|
+
generatingReport: false
|
|
847
|
+
});
|
|
848
|
+
})["catch"](function () {
|
|
849
|
+
/* eslint-disable-next-line */
|
|
850
|
+
alert(LocaleUtils.tr("identify.reportfail"));
|
|
851
|
+
_this.setState({
|
|
852
|
+
generatingReport: false
|
|
853
|
+
});
|
|
854
|
+
});
|
|
855
|
+
});
|
|
856
|
+
_defineProperty(_this, "showLayerInfo", function (layer) {
|
|
857
|
+
var _layer$split = layer.split('#'),
|
|
858
|
+
_layer$split2 = _slicedToArray(_layer$split, 2),
|
|
859
|
+
layerUrl = _layer$split2[0],
|
|
860
|
+
layerName = _layer$split2[1];
|
|
861
|
+
var match = LayerUtils.searchLayer(_this.props.layers, layerUrl, layerName);
|
|
862
|
+
if (match) {
|
|
863
|
+
_this.props.setActiveLayerInfo(match.layer, match.sublayer);
|
|
864
|
+
}
|
|
865
|
+
});
|
|
866
|
+
_defineProperty(_this, "attribValue", function (text, attrName, layer, result) {
|
|
867
|
+
if (_typeof(text) === 'object') {
|
|
868
|
+
text = JSON.stringify(text);
|
|
869
|
+
}
|
|
870
|
+
if (_this.props.replaceImageUrls && /^https?:\/\/.*\.(jpg|jpeg|png|bmp)$/i.exec(text)) {
|
|
871
|
+
return /*#__PURE__*/React.createElement("a", {
|
|
872
|
+
href: text,
|
|
873
|
+
rel: "noreferrer",
|
|
874
|
+
target: "_blank"
|
|
875
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
876
|
+
src: text
|
|
877
|
+
}));
|
|
878
|
+
}
|
|
879
|
+
text = "" + text; // Ensure text is a string
|
|
880
|
+
text = _this.props.attributeTransform(attrName, text, layer, result);
|
|
881
|
+
text = MiscUtils.addLinkAnchors(text);
|
|
882
|
+
return _this.parsedContent(text);
|
|
883
|
+
});
|
|
884
|
+
_defineProperty(_this, "parsedContent", function (text) {
|
|
885
|
+
text = DOMPurify.sanitize(text, {
|
|
886
|
+
ADD_ATTR: ['target']
|
|
887
|
+
}).replace(' ', '<br />');
|
|
888
|
+
var options = {
|
|
889
|
+
replace: function replace(node) {
|
|
890
|
+
if (node.name === "a") {
|
|
891
|
+
return /*#__PURE__*/React.createElement("a", {
|
|
892
|
+
href: node.attribs.href,
|
|
893
|
+
onClick: _this.attributeLinkClicked,
|
|
894
|
+
target: node.attribs.target || "_blank"
|
|
895
|
+
}, domToReact(node.children, options));
|
|
896
|
+
}
|
|
897
|
+
return undefined;
|
|
898
|
+
}
|
|
899
|
+
};
|
|
900
|
+
return htmlReactParser(text, options);
|
|
901
|
+
});
|
|
902
|
+
_defineProperty(_this, "attributeLinkClicked", function (ev) {
|
|
903
|
+
_this.props.openExternalUrl(ev.target.href, ev.target.target, {
|
|
904
|
+
docked: _this.props.iframeDialogsInitiallyDocked
|
|
905
|
+
});
|
|
906
|
+
ev.preventDefault();
|
|
907
|
+
});
|
|
908
|
+
_defineProperty(_this, "zoomToResult", function (result) {
|
|
909
|
+
var zoom = 0;
|
|
910
|
+
var maxZoom = MapUtils.computeZoom(_this.props.map.scales, _this.props.theme.minSearchScaleDenom || 1000);
|
|
911
|
+
if (result.bbox[0] !== result.bbox[2] && result.bbox[1] !== result.bbox[3]) {
|
|
912
|
+
zoom = Math.max(0, MapUtils.getZoomForExtent(result.bbox, _this.props.map.resolutions, _this.props.map.size, 0, maxZoom + 1) - 1);
|
|
913
|
+
} else {
|
|
914
|
+
zoom = maxZoom;
|
|
915
|
+
}
|
|
916
|
+
var x = 0.5 * (result.bbox[0] + result.bbox[2]);
|
|
917
|
+
var y = 0.5 * (result.bbox[1] + result.bbox[3]);
|
|
918
|
+
_this.props.zoomToPoint([x, y], zoom, _this.props.map.projection);
|
|
919
|
+
var path = [];
|
|
920
|
+
var sublayer = null;
|
|
921
|
+
var layer = _this.props.layers.find(function (l) {
|
|
922
|
+
return l.role === LayerRole.THEME && (sublayer = LayerUtils.searchSubLayer(l, 'name', result.layername, path));
|
|
923
|
+
});
|
|
924
|
+
if (layer && sublayer) {
|
|
925
|
+
_this.props.changeLayerProperty(layer.id, "visibility", true, path);
|
|
926
|
+
}
|
|
927
|
+
});
|
|
928
|
+
_this.currentResultElRef = null;
|
|
929
|
+
_this.scrollIntoView = false;
|
|
930
|
+
_this.state.exportFormat = !Array.isArray(props.enableExport) ? 'geojson' : props.enableExport[0];
|
|
931
|
+
return _this;
|
|
932
|
+
}
|
|
933
|
+
_inherits(IdentifyViewer, _React$Component);
|
|
934
|
+
return _createClass(IdentifyViewer, [{
|
|
935
|
+
key: "componentDidMount",
|
|
936
|
+
value: function componentDidMount() {
|
|
937
|
+
this.updateResultTree();
|
|
938
|
+
}
|
|
939
|
+
}, {
|
|
940
|
+
key: "componentDidUpdate",
|
|
941
|
+
value: function componentDidUpdate(prevProps, prevState) {
|
|
942
|
+
if (this.props.identifyResults !== prevProps.identifyResults) {
|
|
943
|
+
this.updateResultTree();
|
|
944
|
+
}
|
|
945
|
+
if (prevState.currentResult !== this.state.currentResult || prevState.resultTree !== this.state.resultTree) {
|
|
946
|
+
this.setHighlightedResults(this.state.currentResult === null ? null : [this.state.currentResult], this.state.resultTree);
|
|
947
|
+
}
|
|
948
|
+
// Scroll to selected result
|
|
949
|
+
if (this.state.currentResult && this.state.currentResult !== prevState.currentResult && this.currentResultElRef && this.scrollIntoView) {
|
|
950
|
+
this.currentResultElRef.parentNode.scrollTop = this.currentResultElRef.offsetTop - this.currentResultElRef.parentNode.offsetTop;
|
|
951
|
+
this.scrollIntoView = false;
|
|
952
|
+
this.currentResultElRef = null;
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
}, {
|
|
956
|
+
key: "componentWillUnmount",
|
|
957
|
+
value: function componentWillUnmount() {
|
|
958
|
+
this.props.removeLayer("__identifyviewerhighlight");
|
|
959
|
+
}
|
|
960
|
+
}, {
|
|
961
|
+
key: "render",
|
|
962
|
+
value: function render() {
|
|
963
|
+
var _this2 = this,
|
|
964
|
+
_exporters$this$state;
|
|
965
|
+
var tree = this.props.displayResultTree;
|
|
966
|
+
var body = null;
|
|
967
|
+
if (tree) {
|
|
968
|
+
var contents = Object.keys(this.state.resultTree).map(function (layer) {
|
|
969
|
+
return _this2.renderLayer(layer);
|
|
970
|
+
});
|
|
971
|
+
var attributes = this.renderResultAttributes(this.state.currentLayer, this.state.currentResult, 'identify-result-tree-frame');
|
|
972
|
+
var resultsContainerStyle = {
|
|
973
|
+
maxHeight: attributes ? '10em' : 'initial'
|
|
974
|
+
};
|
|
975
|
+
body = [/*#__PURE__*/React.createElement("div", {
|
|
976
|
+
className: "identify-results-container",
|
|
977
|
+
key: "results-container",
|
|
978
|
+
style: resultsContainerStyle
|
|
979
|
+
}, contents), attributes];
|
|
980
|
+
} else {
|
|
981
|
+
body = /*#__PURE__*/React.createElement("div", {
|
|
982
|
+
className: "identify-flat-results-list"
|
|
983
|
+
}, this.props.showLayerSelector ? /*#__PURE__*/React.createElement("div", {
|
|
984
|
+
className: "identify-selectbox"
|
|
985
|
+
}, /*#__PURE__*/React.createElement("select", {
|
|
986
|
+
className: "identify-layer-select",
|
|
987
|
+
onChange: function onChange(e) {
|
|
988
|
+
var selectedLayer = e.target.value;
|
|
989
|
+
_this2.setState({
|
|
990
|
+
selectedLayer: selectedLayer
|
|
991
|
+
});
|
|
992
|
+
}
|
|
993
|
+
}, /*#__PURE__*/React.createElement("option", {
|
|
994
|
+
value: ""
|
|
995
|
+
}, LocaleUtils.tr("identify.layerall")), Object.keys(this.state.resultTree).filter(function (key) {
|
|
996
|
+
return _this2.state.resultTree[key].length;
|
|
997
|
+
}).map(function (layer) {
|
|
998
|
+
return /*#__PURE__*/React.createElement("option", {
|
|
999
|
+
key: layer,
|
|
1000
|
+
value: layer
|
|
1001
|
+
}, _this2.state.resultTree[layer][0].layertitle);
|
|
1002
|
+
})), /*#__PURE__*/React.createElement("span", {
|
|
1003
|
+
className: "identify-buttonbox-spacer"
|
|
1004
|
+
}), /*#__PURE__*/React.createElement("span", null, LocaleUtils.tr("identify.featurecount"), ": ", Object.values(this.state.selectedLayer !== '' ? this.state.resultTree[this.state.selectedLayer] : this.state.resultTree).flat().length)) : null, Object.keys(this.state.selectedLayer !== '' ? _defineProperty({}, this.state.selectedLayer, this.state.resultTree[this.state.selectedLayer]) : this.state.resultTree).map(function (layer) {
|
|
1005
|
+
var layerResults = _this2.state.resultTree[layer];
|
|
1006
|
+
return layerResults.map(function (result) {
|
|
1007
|
+
var resultClass = _this2.state.currentResult === result ? 'identify-result-frame-highlighted' : 'identify-result-frame-normal';
|
|
1008
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
1009
|
+
key: result.id,
|
|
1010
|
+
onMouseEnter: function onMouseEnter() {
|
|
1011
|
+
return _this2.setState({
|
|
1012
|
+
currentResult: result,
|
|
1013
|
+
currentLayer: layer
|
|
1014
|
+
});
|
|
1015
|
+
},
|
|
1016
|
+
onMouseLeave: function onMouseLeave() {
|
|
1017
|
+
return _this2.setState({
|
|
1018
|
+
currentResult: null,
|
|
1019
|
+
currentLayer: null
|
|
1020
|
+
});
|
|
1021
|
+
}
|
|
1022
|
+
}, _this2.renderResultAttributes(layer, result, resultClass));
|
|
1023
|
+
});
|
|
1024
|
+
}));
|
|
1025
|
+
}
|
|
1026
|
+
// "el.style.background='inherit'": HACK to trigger an additional repaint, since Safari/Chrome on iOS render the element cut off the first time
|
|
1027
|
+
var exporters = Object.fromEntries(this.getExporters().map(function (exporter) {
|
|
1028
|
+
return [exporter.id, exporter];
|
|
1029
|
+
}));
|
|
1030
|
+
var enabledExporters = Array.isArray(this.props.enableExport) ? this.props.enableExport : Object.keys(exporters);
|
|
1031
|
+
var clipboardExportDisabled = ((_exporters$this$state = exporters[this.state.exportFormat]) === null || _exporters$this$state === void 0 ? void 0 : _exporters$this$state.allowClipboard) !== true;
|
|
1032
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
1033
|
+
className: "identify-body",
|
|
1034
|
+
ref: function ref(el) {
|
|
1035
|
+
if (el) el.style.background = 'inherit';
|
|
1036
|
+
}
|
|
1037
|
+
}, body, this.props.enableExport === true || !isEmpty(this.props.enableExport) ? /*#__PURE__*/React.createElement("div", {
|
|
1038
|
+
className: "identify-buttonbox"
|
|
1039
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
1040
|
+
className: "identify-buttonbox-spacer"
|
|
1041
|
+
}), /*#__PURE__*/React.createElement("span", null, LocaleUtils.tr("identify.export"), ":\xA0"), /*#__PURE__*/React.createElement("div", {
|
|
1042
|
+
className: "controlgroup"
|
|
1043
|
+
}, /*#__PURE__*/React.createElement("select", {
|
|
1044
|
+
className: "combo identify-export-format",
|
|
1045
|
+
onChange: function onChange(ev) {
|
|
1046
|
+
return _this2.setState({
|
|
1047
|
+
exportFormat: ev.target.value
|
|
1048
|
+
});
|
|
1049
|
+
},
|
|
1050
|
+
value: this.state.exportFormat
|
|
1051
|
+
}, enabledExporters.map(function (id) {
|
|
1052
|
+
var _exporters$id$title;
|
|
1053
|
+
return /*#__PURE__*/React.createElement("option", {
|
|
1054
|
+
key: id,
|
|
1055
|
+
value: id
|
|
1056
|
+
}, (_exporters$id$title = exporters[id].title) !== null && _exporters$id$title !== void 0 ? _exporters$id$title : LocaleUtils.tr(exporters[id].titleMsgId));
|
|
1057
|
+
})), /*#__PURE__*/React.createElement("button", {
|
|
1058
|
+
className: "button",
|
|
1059
|
+
onClick: function onClick() {
|
|
1060
|
+
return _this2.exportResults();
|
|
1061
|
+
},
|
|
1062
|
+
title: LocaleUtils.tr("identify.download")
|
|
1063
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
1064
|
+
icon: "export"
|
|
1065
|
+
})), /*#__PURE__*/React.createElement("button", {
|
|
1066
|
+
className: "button",
|
|
1067
|
+
disabled: clipboardExportDisabled,
|
|
1068
|
+
onClick: function onClick() {
|
|
1069
|
+
return _this2.exportResults(true);
|
|
1070
|
+
},
|
|
1071
|
+
title: LocaleUtils.tr("identify.clipboard")
|
|
1072
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
1073
|
+
icon: "copy"
|
|
1074
|
+
})))) : null, this.props.enableAggregatedReports && Object.keys(this.state.reports).length > 0 ? /*#__PURE__*/React.createElement("div", {
|
|
1075
|
+
className: "identify-buttonbox"
|
|
1076
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
1077
|
+
className: "identify-buttonbox-spacer"
|
|
1078
|
+
}), /*#__PURE__*/React.createElement("span", null, LocaleUtils.tr("identify.aggregatedreport"), ":\xA0"), /*#__PURE__*/React.createElement("div", {
|
|
1079
|
+
className: "controlgroup"
|
|
1080
|
+
}, /*#__PURE__*/React.createElement("select", {
|
|
1081
|
+
className: "combo identify-export-format",
|
|
1082
|
+
onChange: function onChange(ev) {
|
|
1083
|
+
return _this2.setState({
|
|
1084
|
+
selectedAggregatedReport: ev.target.value
|
|
1085
|
+
});
|
|
1086
|
+
},
|
|
1087
|
+
value: this.state.selectedAggregatedReport
|
|
1088
|
+
}, /*#__PURE__*/React.createElement("option", {
|
|
1089
|
+
disabled: true,
|
|
1090
|
+
value: ""
|
|
1091
|
+
}, LocaleUtils.tr("identify.selectreport")), Object.entries(this.state.reports).map(function (_ref16) {
|
|
1092
|
+
var _ref17 = _slicedToArray(_ref16, 2),
|
|
1093
|
+
layername = _ref17[0],
|
|
1094
|
+
reports = _ref17[1];
|
|
1095
|
+
return reports.map(function (report, idx) {
|
|
1096
|
+
return /*#__PURE__*/React.createElement("option", {
|
|
1097
|
+
key: layername + "::" + idx,
|
|
1098
|
+
value: layername + "::" + idx
|
|
1099
|
+
}, report.title);
|
|
1100
|
+
});
|
|
1101
|
+
})), /*#__PURE__*/React.createElement("button", {
|
|
1102
|
+
className: "button",
|
|
1103
|
+
disabled: !this.state.selectedAggregatedReport || this.state.generatingReport,
|
|
1104
|
+
onClick: this.downloadAggregatedReport
|
|
1105
|
+
}, this.state.generatingReport ? /*#__PURE__*/React.createElement(Spinner, null) : /*#__PURE__*/React.createElement(Icon, {
|
|
1106
|
+
icon: "report"
|
|
1107
|
+
})))) : null);
|
|
1108
|
+
}
|
|
1109
|
+
}]);
|
|
1110
|
+
}(React.Component);
|
|
1111
|
+
_defineProperty(IdentifyViewer, "propTypes", {
|
|
1112
|
+
addLayerFeatures: PropTypes.func,
|
|
1113
|
+
attributeCalculator: PropTypes.func,
|
|
1114
|
+
attributeTransform: PropTypes.func,
|
|
1115
|
+
changeLayerProperty: PropTypes.func,
|
|
1116
|
+
collapsible: PropTypes.bool,
|
|
1117
|
+
customExporters: PropTypes.array,
|
|
1118
|
+
displayResultTree: PropTypes.bool,
|
|
1119
|
+
enableAggregatedReports: PropTypes.bool,
|
|
1120
|
+
enableExport: PropTypes.oneOfType([PropTypes.bool, PropTypes.array]),
|
|
1121
|
+
exportGeometry: PropTypes.bool,
|
|
1122
|
+
highlightAllResults: PropTypes.bool,
|
|
1123
|
+
identifyResults: PropTypes.object,
|
|
1124
|
+
iframeDialogsInitiallyDocked: PropTypes.bool,
|
|
1125
|
+
layers: PropTypes.array,
|
|
1126
|
+
longAttributesDisplay: PropTypes.oneOf(['ellipsis', 'wrap']),
|
|
1127
|
+
map: PropTypes.object,
|
|
1128
|
+
openExternalUrl: PropTypes.func,
|
|
1129
|
+
removeLayer: PropTypes.func,
|
|
1130
|
+
replaceImageUrls: PropTypes.bool,
|
|
1131
|
+
setActiveLayerInfo: PropTypes.func,
|
|
1132
|
+
showLayerSelector: PropTypes.bool,
|
|
1133
|
+
showLayerTitles: PropTypes.bool,
|
|
1134
|
+
theme: PropTypes.object,
|
|
1135
|
+
zoomToPoint: PropTypes.func
|
|
1136
|
+
});
|
|
1137
|
+
_defineProperty(IdentifyViewer, "defaultProps", {
|
|
1138
|
+
longAttributesDisplay: 'ellipsis',
|
|
1139
|
+
customExporters: [],
|
|
1140
|
+
displayResultTree: true,
|
|
1141
|
+
attributeCalculator: function attributeCalculator(/* layer, feature */) {
|
|
1142
|
+
return [];
|
|
1143
|
+
},
|
|
1144
|
+
attributeTransform: function attributeTransform(name, value /* , layer, feature */) {
|
|
1145
|
+
return value;
|
|
1146
|
+
},
|
|
1147
|
+
enableAggregatedReports: true,
|
|
1148
|
+
showLayerTitles: true,
|
|
1149
|
+
showLayerSelector: true,
|
|
1150
|
+
highlightAllResults: true
|
|
1151
|
+
});
|
|
1152
|
+
var selector = function selector(state) {
|
|
1153
|
+
return {
|
|
1154
|
+
theme: state.theme.current,
|
|
1155
|
+
layers: state.layers.flat,
|
|
1156
|
+
map: state.map
|
|
1157
|
+
};
|
|
1158
|
+
};
|
|
1159
|
+
export default connect(selector, {
|
|
1160
|
+
addLayerFeatures: addLayerFeatures,
|
|
1161
|
+
changeLayerProperty: changeLayerProperty,
|
|
1162
|
+
removeLayer: removeLayer,
|
|
1163
|
+
setActiveLayerInfo: setActiveLayerInfo,
|
|
1164
|
+
openExternalUrl: openExternalUrl,
|
|
1165
|
+
zoomToPoint: zoomToPoint
|
|
1166
|
+
})(IdentifyViewer);
|