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
package/plugins/LocateButton.js
CHANGED
|
@@ -1,10 +1,101 @@
|
|
|
1
|
-
function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:
|
|
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 _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); } }
|
|
3
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
4
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
5
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
6
|
+
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); }
|
|
7
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
8
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
9
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
10
|
+
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); }
|
|
11
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
12
|
+
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; }
|
|
13
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
14
|
+
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); }
|
|
15
|
+
/**
|
|
2
16
|
* Copyright 2015-2016 GeoSolutions Sas
|
|
3
17
|
* Copyright 2016-2024 Sourcepole AG
|
|
4
18
|
* All rights reserved.
|
|
5
19
|
*
|
|
6
20
|
* This source code is licensed under the BSD-style license found in the
|
|
7
21
|
* LICENSE file in the root directory of this source tree.
|
|
8
|
-
*/
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import React from 'react';
|
|
25
|
+
import { connect } from 'react-redux';
|
|
26
|
+
import PropTypes from 'prop-types';
|
|
27
|
+
import { changeLocateState } from '../actions/locate';
|
|
28
|
+
import MapButton from '../components/MapButton';
|
|
29
|
+
import LocaleUtils from '../utils/LocaleUtils';
|
|
30
|
+
import ThemeUtils from '../utils/ThemeUtils';
|
|
31
|
+
|
|
32
|
+
/**
|
|
9
33
|
* Map button for controling the locate (GPS) state.
|
|
10
|
-
*/
|
|
34
|
+
*/
|
|
35
|
+
var LocateButton = /*#__PURE__*/function (_React$Component) {
|
|
36
|
+
function LocateButton() {
|
|
37
|
+
var _this;
|
|
38
|
+
_classCallCheck(this, LocateButton);
|
|
39
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
40
|
+
args[_key] = arguments[_key];
|
|
41
|
+
}
|
|
42
|
+
_this = _callSuper(this, LocateButton, [].concat(args));
|
|
43
|
+
_defineProperty(_this, "onClick", function () {
|
|
44
|
+
if (_this.props.locateState === "DISABLED") {
|
|
45
|
+
_this.props.changeLocateState("ENABLED");
|
|
46
|
+
} else if (_this.props.locateState === "ENABLED") {
|
|
47
|
+
_this.props.changeLocateState("FOLLOWING");
|
|
48
|
+
} else {
|
|
49
|
+
_this.props.changeLocateState("DISABLED");
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
_defineProperty(_this, "render", function () {
|
|
53
|
+
if (!ThemeUtils.themeFlagsAllowed(_this.props.theme, _this.props.themeFlagWhitelist, _this.props.themeFlagBlacklist)) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
var tooltipMsg = {
|
|
57
|
+
DISABLED: LocaleUtils.tr("locate.statustooltip.DISABLED"),
|
|
58
|
+
ENABLED: LocaleUtils.tr("locate.statustooltip.ENABLED"),
|
|
59
|
+
FOLLOWING: LocaleUtils.tr("locate.statustooltip.FOLLOWING"),
|
|
60
|
+
LOCATING: LocaleUtils.tr("locate.statustooltip.LOCATING"),
|
|
61
|
+
PERMISSION_DENIED: LocaleUtils.tr("locate.statustooltip.PERMISSION_DENIED")
|
|
62
|
+
};
|
|
63
|
+
return /*#__PURE__*/React.createElement(MapButton, {
|
|
64
|
+
active: ["LOCATING", "ENABLED"].includes(_this.props.locateState),
|
|
65
|
+
busy: _this.props.locateState === "LOCATING",
|
|
66
|
+
className: "locate-button-" + _this.props.locateState,
|
|
67
|
+
disabled: _this.props.locateState === "PERMISSION_DENIED",
|
|
68
|
+
engaged: _this.props.locateState === "FOLLOWING",
|
|
69
|
+
icon: "screenshot",
|
|
70
|
+
onClick: _this.onClick,
|
|
71
|
+
position: _this.props.position,
|
|
72
|
+
title: tooltipMsg[_this.props.locateState]
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
return _this;
|
|
76
|
+
}
|
|
77
|
+
_inherits(LocateButton, _React$Component);
|
|
78
|
+
return _createClass(LocateButton);
|
|
79
|
+
}(React.Component);
|
|
80
|
+
_defineProperty(LocateButton, "propTypes", {
|
|
81
|
+
changeLocateState: PropTypes.func,
|
|
82
|
+
locateState: PropTypes.string,
|
|
83
|
+
/** The position slot index of the map button, from the bottom (0: bottom slot). */
|
|
84
|
+
position: PropTypes.number,
|
|
85
|
+
theme: PropTypes.object,
|
|
86
|
+
/** Omit the button in themes matching one of these flags. */
|
|
87
|
+
themeFlagBlacklist: PropTypes.arrayOf(PropTypes.string),
|
|
88
|
+
/** Only show the button in themes matching one of these flags. */
|
|
89
|
+
themeFlagWhitelist: PropTypes.arrayOf(PropTypes.string)
|
|
90
|
+
});
|
|
91
|
+
_defineProperty(LocateButton, "defaultProps", {
|
|
92
|
+
position: 2
|
|
93
|
+
});
|
|
94
|
+
export default connect(function (state) {
|
|
95
|
+
return {
|
|
96
|
+
locateState: state.locate.state,
|
|
97
|
+
theme: state.theme.current
|
|
98
|
+
};
|
|
99
|
+
}, {
|
|
100
|
+
changeLocateState: changeLocateState
|
|
101
|
+
})(LocateButton);
|
package/plugins/Map.js
CHANGED
|
@@ -1,23 +1,327 @@
|
|
|
1
|
-
function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){
|
|
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 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; }
|
|
3
|
+
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; }
|
|
4
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
5
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
6
|
+
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."); }
|
|
7
|
+
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; } }
|
|
8
|
+
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; }
|
|
9
|
+
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; } }
|
|
10
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
11
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
12
|
+
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); } }
|
|
13
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
14
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
15
|
+
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); }
|
|
16
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
17
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
18
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
19
|
+
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); }
|
|
20
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
21
|
+
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; }
|
|
22
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
23
|
+
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); }
|
|
24
|
+
/**
|
|
2
25
|
* Copyright 2016 GeoSolutions Sas
|
|
3
26
|
* Copyright 2016-2024 Sourcepole AG
|
|
4
27
|
* All rights reserved.
|
|
5
28
|
*
|
|
6
29
|
* This source code is licensed under the BSD-style license found in the
|
|
7
30
|
* LICENSE file in the root directory of this source tree.
|
|
8
|
-
*/
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
import React from 'react';
|
|
34
|
+
import ReactDOM from 'react-dom';
|
|
35
|
+
import { connect } from 'react-redux';
|
|
36
|
+
import isEmpty from 'lodash.isempty';
|
|
37
|
+
import PropTypes from 'prop-types';
|
|
38
|
+
import { LayerRole } from '../actions/layers';
|
|
39
|
+
import { MapContainerPortalContext } from '../components/PluginsContainer';
|
|
40
|
+
import OlLayer from '../components/map/OlLayer';
|
|
41
|
+
import OlMap from '../components/map/OlMap';
|
|
42
|
+
import Spinner from '../components/widgets/Spinner';
|
|
43
|
+
import LayerUtils from '../utils/LayerUtils';
|
|
44
|
+
import LocaleUtils from '../utils/LocaleUtils';
|
|
45
|
+
import './style/Map.css';
|
|
46
|
+
|
|
47
|
+
/**
|
|
9
48
|
* The main map component.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
49
|
+
*/
|
|
50
|
+
var Map = /*#__PURE__*/function (_React$Component) {
|
|
51
|
+
function Map(props) {
|
|
52
|
+
var _this;
|
|
53
|
+
_classCallCheck(this, Map);
|
|
54
|
+
_this = _callSuper(this, Map, [props]);
|
|
55
|
+
_defineProperty(_this, "state", {
|
|
56
|
+
renderLayers: [],
|
|
57
|
+
swipeLayer: null
|
|
58
|
+
});
|
|
59
|
+
_defineProperty(_this, "renderLayers", function () {
|
|
60
|
+
var zIndex = 0;
|
|
61
|
+
var usedKeys = new Set();
|
|
62
|
+
return _this.state.renderLayers.map(function (layer) {
|
|
63
|
+
var _layer$zIndex;
|
|
64
|
+
if (layer.type === "placeholder") {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
++zIndex;
|
|
68
|
+
var swipe = _this.props.swipe !== null && layer === _this.state.swipeLayer;
|
|
69
|
+
var key = layer.id;
|
|
70
|
+
for (var i = 0; usedKeys.has(key); ++i) {
|
|
71
|
+
key = layer.id + ":" + i;
|
|
72
|
+
}
|
|
73
|
+
usedKeys.add(key);
|
|
74
|
+
return /*#__PURE__*/React.createElement(OlLayer, {
|
|
75
|
+
key: key,
|
|
76
|
+
options: layer,
|
|
77
|
+
swipe: swipe ? _this.props.swipe : null,
|
|
78
|
+
zIndex: (_layer$zIndex = layer.zIndex) !== null && _layer$zIndex !== void 0 ? _layer$zIndex : zIndex
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
_defineProperty(_this, "renderSupportTools", function () {
|
|
83
|
+
return Object.entries(_this.props.tools).map(function (_ref) {
|
|
84
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
85
|
+
key = _ref2[0],
|
|
86
|
+
Tool = _ref2[1];
|
|
87
|
+
var options = _this.props.toolsOptions[key] || {};
|
|
88
|
+
return /*#__PURE__*/React.createElement(Tool, _extends({
|
|
89
|
+
key: key
|
|
90
|
+
}, options));
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
_this.loadingEl = null;
|
|
94
|
+
return _this;
|
|
95
|
+
}
|
|
96
|
+
_inherits(Map, _React$Component);
|
|
97
|
+
return _createClass(Map, [{
|
|
98
|
+
key: "componentDidUpdate",
|
|
99
|
+
value: function componentDidUpdate(prevProps) {
|
|
100
|
+
var _this2 = this;
|
|
101
|
+
if (this.props.layers !== prevProps.layers || this.props.swipe !== null !== (prevProps.swipe !== null)) {
|
|
102
|
+
var renderLayers = [];
|
|
103
|
+
|
|
104
|
+
// Inject external layers
|
|
105
|
+
this.props.layers.slice(0).reverse().forEach(function (layer) {
|
|
106
|
+
if (layer.type === "wms" && layer.role === LayerRole.THEME) {
|
|
107
|
+
var sublayers = layer.params.LAYERS.split(",");
|
|
108
|
+
var opacities = layer.params.OPACITIES.split(",");
|
|
109
|
+
var styles = (layer.params.STYLES || "").split(",");
|
|
110
|
+
for (var i = 0; i < sublayers.length; ++i) {
|
|
111
|
+
if (layer.externalLayerMap && layer.externalLayerMap[sublayers[i]]) {
|
|
112
|
+
// Sublayer is mapped to an external layer
|
|
113
|
+
var sublayer = LayerUtils.searchSubLayer(layer, "name", sublayers[i]);
|
|
114
|
+
if (sublayer.visibility) {
|
|
115
|
+
var extlayer = _objectSpread(_objectSpread({}, layer.externalLayerMap[sublayers[i]]), {}, {
|
|
116
|
+
rev: layer.rev,
|
|
117
|
+
opacity: parseInt(opacities[i], 10),
|
|
118
|
+
visibility: true,
|
|
119
|
+
role: LayerRole.THEME,
|
|
120
|
+
minScale: sublayer.minScale,
|
|
121
|
+
maxScale: sublayer.maxScale
|
|
122
|
+
});
|
|
123
|
+
if (extlayer.type === "wms") {
|
|
124
|
+
extlayer.params = _objectSpread(_objectSpread(_objectSpread({}, layer.params), layer.externalLayerMap[sublayers[i]].params), {}, {
|
|
125
|
+
OPACITIES: opacities[i],
|
|
126
|
+
STYLES: ""
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
renderLayers.push(extlayer);
|
|
130
|
+
}
|
|
131
|
+
} else if (renderLayers.length > 0 && renderLayers[renderLayers.length - 1].id === layer.id) {
|
|
132
|
+
// Compress with previous renderlayer
|
|
133
|
+
renderLayers[renderLayers.length - 1].params.LAYERS += "," + sublayers[i];
|
|
134
|
+
renderLayers[renderLayers.length - 1].params.OPACITIES += "," + opacities[i];
|
|
135
|
+
renderLayers[renderLayers.length - 1].params.STYLES += "," + (styles[i] || "");
|
|
136
|
+
} else {
|
|
137
|
+
// Add new renderlayer
|
|
138
|
+
renderLayers.push(_objectSpread(_objectSpread({}, layer), {}, {
|
|
139
|
+
params: _objectSpread(_objectSpread({}, layer.params), {}, {
|
|
140
|
+
LAYERS: sublayers[i],
|
|
141
|
+
OPACITIES: opacities[i],
|
|
142
|
+
STYLES: styles[i] || ""
|
|
143
|
+
})
|
|
144
|
+
}));
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
} else {
|
|
148
|
+
renderLayers.push(layer);
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
// Break out swipe layer if necessary
|
|
153
|
+
var swipeLayer = null;
|
|
154
|
+
var swipeLayerNameBlacklist = this.props.swipeLayerNameBlacklist.map(function (entry) {
|
|
155
|
+
return new RegExp('^' + entry.split(/\*+/).map(function (s) {
|
|
156
|
+
return s.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&');
|
|
157
|
+
}).join('.*') + '$');
|
|
158
|
+
});
|
|
159
|
+
if (renderLayers.length > 0 && this.props.swipe !== null && renderLayers[renderLayers.length - 1].role > LayerRole.BACKGROUND) {
|
|
160
|
+
var _loop = function _loop() {
|
|
161
|
+
var layer = renderLayers[i];
|
|
162
|
+
if (layer.role > LayerRole.USERLAYER) {
|
|
163
|
+
return 0; // continue
|
|
164
|
+
} else if (layer.type === "wms" && layer.params.LAYERS.split(",").length >= 1) {
|
|
165
|
+
var paramLayers = layer.params.LAYERS.split(",");
|
|
166
|
+
var paramOpacities = layer.params.OPACITIES.split(",");
|
|
167
|
+
var paramStyles = (layer.params.STYLES || "").split(",");
|
|
168
|
+
var _loop2 = function _loop2() {
|
|
169
|
+
var layerName = paramLayers[j];
|
|
170
|
+
if (swipeLayerNameBlacklist.find(function (entry) {
|
|
171
|
+
return layerName.match(entry);
|
|
172
|
+
})) {
|
|
173
|
+
return 0; // continue
|
|
174
|
+
}
|
|
175
|
+
var sublayer = LayerUtils.searchSubLayer(layer, "name", layerName);
|
|
176
|
+
if (sublayer && _this2.props.swipeGeometryTypeBlacklist.includes((sublayer.geometryType || "").replace(/[ZM]+$/, ""))) {
|
|
177
|
+
return 0; // continue
|
|
178
|
+
}
|
|
179
|
+
var newLayers = [];
|
|
180
|
+
if (j > 0) {
|
|
181
|
+
newLayers.push(_objectSpread(_objectSpread({}, layer), {}, {
|
|
182
|
+
id: layer.id + ":0",
|
|
183
|
+
params: {
|
|
184
|
+
LAYERS: paramLayers.slice(0, j).join(","),
|
|
185
|
+
OPACITIES: paramOpacities.slice(0, j).join(","),
|
|
186
|
+
STYLES: paramStyles.slice(0, j).join(",")
|
|
187
|
+
}
|
|
188
|
+
}));
|
|
189
|
+
}
|
|
190
|
+
swipeLayer = _objectSpread(_objectSpread({}, layer), {}, {
|
|
191
|
+
id: layer.id + ":1",
|
|
192
|
+
params: {
|
|
193
|
+
LAYERS: paramLayers[j],
|
|
194
|
+
OPACITIES: paramOpacities[j],
|
|
195
|
+
STYLES: paramStyles[j]
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
newLayers.push(swipeLayer);
|
|
199
|
+
if (j < paramLayers.length - 1) {
|
|
200
|
+
newLayers.push(_objectSpread(_objectSpread({}, layer), {}, {
|
|
201
|
+
id: layer.id + ":2",
|
|
202
|
+
params: {
|
|
203
|
+
LAYERS: paramLayers.slice(j + 1).join(","),
|
|
204
|
+
OPACITIES: paramOpacities.slice(j + 1).join(","),
|
|
205
|
+
STYLES: paramStyles.slice(j + 1).join(",")
|
|
206
|
+
}
|
|
207
|
+
}));
|
|
208
|
+
}
|
|
209
|
+
renderLayers.splice.apply(renderLayers, [i, 1].concat(newLayers));
|
|
210
|
+
return 1; // break
|
|
211
|
+
},
|
|
212
|
+
_ret2;
|
|
213
|
+
for (var j = paramLayers.length - 1; j >= 0; --j) {
|
|
214
|
+
_ret2 = _loop2();
|
|
215
|
+
if (_ret2 === 0) continue;
|
|
216
|
+
if (_ret2 === 1) break;
|
|
217
|
+
}
|
|
218
|
+
} else {
|
|
219
|
+
if (swipeLayerNameBlacklist.find(function (entry) {
|
|
220
|
+
return layer.name.match(entry);
|
|
221
|
+
})) {
|
|
222
|
+
return 0; // continue
|
|
223
|
+
}
|
|
224
|
+
if (_this2.props.swipeGeometryTypeBlacklist.includes((layer.geometryType || "").replace(/[ZM]+$/, ""))) {
|
|
225
|
+
return 0; // continue
|
|
226
|
+
}
|
|
227
|
+
swipeLayer = layer;
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
_ret;
|
|
231
|
+
// Pick candidate swipe layer according to rules
|
|
232
|
+
for (var i = renderLayers.length - 1; swipeLayer === null && i >= 0; --i) {
|
|
233
|
+
_ret = _loop();
|
|
234
|
+
if (_ret === 0) continue;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
this.setState({
|
|
238
|
+
renderLayers: renderLayers,
|
|
239
|
+
swipeLayer: swipeLayer
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}, {
|
|
244
|
+
key: "render",
|
|
245
|
+
value: function render() {
|
|
246
|
+
var _this3 = this,
|
|
247
|
+
_this$props$theme;
|
|
248
|
+
var loadingIndicator = null;
|
|
249
|
+
if (this.props.showLoading && !isEmpty(this.props.loadingLayers)) {
|
|
250
|
+
loadingIndicator = /*#__PURE__*/React.createElement("span", {
|
|
251
|
+
className: "map-loading-indicator",
|
|
252
|
+
key: "map-loading",
|
|
253
|
+
ref: function ref(el) {
|
|
254
|
+
_this3.loadingEl = el;
|
|
255
|
+
}
|
|
256
|
+
}, /*#__PURE__*/React.createElement(Spinner, {
|
|
257
|
+
className: "spinner"
|
|
258
|
+
}), LocaleUtils.tr("map.loading"));
|
|
259
|
+
setTimeout(function () {
|
|
260
|
+
if (_this3.loadingEl) {
|
|
261
|
+
_this3.loadingEl.style.opacity = 1;
|
|
262
|
+
}
|
|
263
|
+
}, 1000);
|
|
264
|
+
}
|
|
265
|
+
return /*#__PURE__*/ReactDOM.createPortal([/*#__PURE__*/React.createElement("div", {
|
|
266
|
+
className: "map-contents",
|
|
267
|
+
id: "map",
|
|
268
|
+
key: "map",
|
|
269
|
+
tabIndex: "0"
|
|
270
|
+
}, /*#__PURE__*/React.createElement(OlMap, _extends({
|
|
271
|
+
id: "map",
|
|
272
|
+
key: "map",
|
|
273
|
+
mapOptions: this.props.mapOptions
|
|
274
|
+
}, this.props.map, {
|
|
275
|
+
fullExtent: (_this$props$theme = this.props.theme) === null || _this$props$theme === void 0 ? void 0 : _this$props$theme.bbox
|
|
276
|
+
}), this.renderLayers(), this.renderSupportTools())), loadingIndicator], this.context);
|
|
277
|
+
}
|
|
278
|
+
}]);
|
|
279
|
+
}(React.Component);
|
|
280
|
+
_defineProperty(Map, "contextType", MapContainerPortalContext);
|
|
281
|
+
_defineProperty(Map, "propTypes", {
|
|
282
|
+
layers: PropTypes.array,
|
|
283
|
+
loadingLayers: PropTypes.array,
|
|
284
|
+
map: PropTypes.object,
|
|
285
|
+
/** Zoom duration in ms, rotation in degrees, panStepSize and panPageSize as fraction of map width/height. */
|
|
286
|
+
mapOptions: PropTypes.shape({
|
|
287
|
+
zoomDuration: PropTypes.number,
|
|
288
|
+
enableRotation: PropTypes.bool,
|
|
289
|
+
rotation: PropTypes.number,
|
|
290
|
+
panStepSize: PropTypes.number,
|
|
291
|
+
panPageSize: PropTypes.number,
|
|
292
|
+
constrainExtent: PropTypes.bool,
|
|
293
|
+
kineticPanParams: PropTypes.object
|
|
294
|
+
}),
|
|
295
|
+
/** Whether to display the loading spinner when layers are loading. */
|
|
296
|
+
showLoading: PropTypes.bool,
|
|
297
|
+
swipe: PropTypes.number,
|
|
298
|
+
/** A list of layer geometry types to ignore when determining the top-most layer to compare. */
|
|
299
|
+
swipeGeometryTypeBlacklist: PropTypes.arrayOf(PropTypes.string),
|
|
300
|
+
/** A list of layer names to ignore when determining the top-most layer to compare. You can use `*` as a wildcard character. */
|
|
301
|
+
swipeLayerNameBlacklist: PropTypes.arrayOf(PropTypes.string),
|
|
302
|
+
theme: PropTypes.object,
|
|
303
|
+
tools: PropTypes.object,
|
|
304
|
+
/** Options to pass to the map support plugins, in the form `{"<Name>": {<options>}}`.
|
|
305
|
+
* Refer to the documentation of the <a href="#mapSupportPlugins">Map support plugins</a> for settable options. */
|
|
306
|
+
toolsOptions: PropTypes.object
|
|
307
|
+
});
|
|
308
|
+
_defineProperty(Map, "defaultProps", {
|
|
309
|
+
mapOptions: {},
|
|
310
|
+
showLoading: true,
|
|
311
|
+
swipeGeometryTypeBlacklist: [],
|
|
312
|
+
swipeLayerNameBlacklist: [],
|
|
313
|
+
tools: {},
|
|
314
|
+
toolsOptions: {}
|
|
315
|
+
});
|
|
316
|
+
export default (function (tools) {
|
|
317
|
+
return connect(function (state) {
|
|
318
|
+
return {
|
|
319
|
+
map: state.map,
|
|
320
|
+
layers: state.layers.flat,
|
|
321
|
+
loadingLayers: state.layers.loading,
|
|
322
|
+
swipe: state.layers.swipe,
|
|
323
|
+
theme: state.theme.current,
|
|
324
|
+
tools: tools
|
|
325
|
+
};
|
|
326
|
+
})(Map);
|
|
327
|
+
});
|
package/plugins/MapCompare.js
CHANGED
|
@@ -1,11 +1,102 @@
|
|
|
1
|
-
function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){
|
|
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 _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
3
|
+
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); } }
|
|
4
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
5
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
6
|
+
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); }
|
|
7
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
8
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
9
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
10
|
+
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); }
|
|
11
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
12
|
+
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; }
|
|
13
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
14
|
+
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); }
|
|
15
|
+
/**
|
|
2
16
|
* Copyright 2018-2024 Sourcepole AG
|
|
3
17
|
* All rights reserved.
|
|
4
18
|
*
|
|
5
19
|
* This source code is licensed under the BSD-style license found in the
|
|
6
20
|
* LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import React from 'react';
|
|
24
|
+
import ReactDOM from 'react-dom';
|
|
25
|
+
import { connect } from 'react-redux';
|
|
26
|
+
import PropTypes from 'prop-types';
|
|
27
|
+
import { setSwipe } from '../actions/layers';
|
|
28
|
+
import Icon from '../components/Icon';
|
|
29
|
+
import { MapContainerPortalContext } from '../components/PluginsContainer';
|
|
30
|
+
import './style/MapCompare.css';
|
|
31
|
+
|
|
32
|
+
/**
|
|
8
33
|
* Allows comparing the top layer with the rest of the map.
|
|
9
34
|
*
|
|
10
35
|
* Activated through a checkbox in the LayerTree.
|
|
11
|
-
*/
|
|
36
|
+
*/
|
|
37
|
+
var MapCompare = /*#__PURE__*/function (_React$Component) {
|
|
38
|
+
function MapCompare() {
|
|
39
|
+
var _this;
|
|
40
|
+
_classCallCheck(this, MapCompare);
|
|
41
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
42
|
+
args[_key] = arguments[_key];
|
|
43
|
+
}
|
|
44
|
+
_this = _callSuper(this, MapCompare, [].concat(args));
|
|
45
|
+
_defineProperty(_this, "startDragHandle", function (ev) {
|
|
46
|
+
var rect = ev.currentTarget.getBoundingClientRect();
|
|
47
|
+
var parentRect = ev.currentTarget.parentElement.getBoundingClientRect();
|
|
48
|
+
var clickOffset = ev.clientX - rect.left;
|
|
49
|
+
var moveHandle = function moveHandle(ev2) {
|
|
50
|
+
var perc = (ev2.clientX - clickOffset - parentRect.left) / parentRect.width * 100;
|
|
51
|
+
perc = Math.min(100, Math.max(0, perc));
|
|
52
|
+
_this.props.setSwipe(perc);
|
|
53
|
+
};
|
|
54
|
+
ev.view.document.body.style.userSelect = 'none';
|
|
55
|
+
ev.view.addEventListener("pointermove", moveHandle);
|
|
56
|
+
ev.view.addEventListener("pointerup", function () {
|
|
57
|
+
ev.view.document.body.style.userSelect = '';
|
|
58
|
+
ev.view.removeEventListener("pointermove", moveHandle);
|
|
59
|
+
}, {
|
|
60
|
+
once: true
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
return _this;
|
|
64
|
+
}
|
|
65
|
+
_inherits(MapCompare, _React$Component);
|
|
66
|
+
return _createClass(MapCompare, [{
|
|
67
|
+
key: "render",
|
|
68
|
+
value: function render() {
|
|
69
|
+
if (this.props.swipe === null) {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
var style = {
|
|
73
|
+
left: this.props.swipe + "%"
|
|
74
|
+
};
|
|
75
|
+
return /*#__PURE__*/ReactDOM.createPortal(/*#__PURE__*/React.createElement("div", {
|
|
76
|
+
id: "MapCompare",
|
|
77
|
+
onPointerDown: this.startDragHandle,
|
|
78
|
+
style: style
|
|
79
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
80
|
+
className: "map-compare-handle"
|
|
81
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
82
|
+
className: "map-compare-handle-icon",
|
|
83
|
+
icon: "triangle-left"
|
|
84
|
+
}), /*#__PURE__*/React.createElement(Icon, {
|
|
85
|
+
className: "map-compare-handle-icon",
|
|
86
|
+
icon: "triangle-right"
|
|
87
|
+
}))), this.context);
|
|
88
|
+
}
|
|
89
|
+
}]);
|
|
90
|
+
}(React.Component);
|
|
91
|
+
_defineProperty(MapCompare, "contextType", MapContainerPortalContext);
|
|
92
|
+
_defineProperty(MapCompare, "propTypes", {
|
|
93
|
+
setSwipe: PropTypes.func,
|
|
94
|
+
swipe: PropTypes.number
|
|
95
|
+
});
|
|
96
|
+
export default connect(function (state) {
|
|
97
|
+
return {
|
|
98
|
+
swipe: state.layers.swipe
|
|
99
|
+
};
|
|
100
|
+
}, {
|
|
101
|
+
setSwipe: setSwipe
|
|
102
|
+
})(MapCompare);
|