qwc2 2025.10.13 → 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/actions/redliningPick.js
CHANGED
|
@@ -4,4 +4,15 @@
|
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import ReducerIndex from '../reducers/index';
|
|
10
|
+
import redliningPickReducer from '../reducers/redliningPick';
|
|
11
|
+
ReducerIndex.register("redliningPick", redliningPickReducer);
|
|
12
|
+
export var CHANGE_REDLINING_PICK_STATE = 'CHANGE_REDLINING_PICK_STATE';
|
|
13
|
+
export function changeRedliningPickState(data) {
|
|
14
|
+
return {
|
|
15
|
+
type: CHANGE_REDLINING_PICK_STATE,
|
|
16
|
+
data: data
|
|
17
|
+
};
|
|
18
|
+
}
|
package/actions/search.js
CHANGED
|
@@ -4,4 +4,15 @@
|
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import ReducerIndex from '../reducers/index';
|
|
10
|
+
import searchReducer from '../reducers/search';
|
|
11
|
+
ReducerIndex.register("search", searchReducer);
|
|
12
|
+
export var SET_CURRENT_SEARCH_RESULT = 'SET_CURRENT_SEARCH_RESULT';
|
|
13
|
+
export function setCurrentSearchResult(result) {
|
|
14
|
+
return {
|
|
15
|
+
type: SET_CURRENT_SEARCH_RESULT,
|
|
16
|
+
result: result
|
|
17
|
+
};
|
|
18
|
+
}
|
package/actions/serviceinfo.js
CHANGED
|
@@ -4,4 +4,15 @@
|
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import ReducerIndex from '../reducers/index';
|
|
10
|
+
import serviceinfoReducer from '../reducers/serviceinfo';
|
|
11
|
+
ReducerIndex.register("serviceinfo", serviceinfoReducer);
|
|
12
|
+
export var SET_ACTIVE_SERVICEINFO = 'SET_ACTIVE_SERVICEINFO';
|
|
13
|
+
export function setActiveServiceInfo(service) {
|
|
14
|
+
return {
|
|
15
|
+
type: SET_ACTIVE_SERVICEINFO,
|
|
16
|
+
service: service
|
|
17
|
+
};
|
|
18
|
+
}
|
package/actions/task.js
CHANGED
|
@@ -4,6 +4,58 @@
|
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import ReducerIndex from '../reducers/index';
|
|
10
|
+
import taskReducer from '../reducers/task';
|
|
11
|
+
import ConfigUtils from '../utils/ConfigUtils';
|
|
12
|
+
ReducerIndex.register("task", taskReducer);
|
|
13
|
+
export var SET_CURRENT_TASK = 'SET_CURRENT_TASK';
|
|
14
|
+
export var SET_CURRENT_TASK_BLOCKED = 'SET_CURRENT_TASK_BLOCKED';
|
|
15
|
+
export function setCurrentTask(task) {
|
|
16
|
+
var mode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
17
|
+
var mapClickAction = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
18
|
+
var data = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
19
|
+
return function (dispatch, getState) {
|
|
20
|
+
// Don't do anything if current task is blocked
|
|
21
|
+
if (getState().task && getState().task.blocked === true) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
// Attempt to read mapClickAction from plugin configuration block if not set
|
|
25
|
+
if (!mapClickAction) {
|
|
26
|
+
var _find, _getState$localConfig;
|
|
27
|
+
var device = ConfigUtils.isMobile() ? 'mobile' : 'desktop';
|
|
28
|
+
mapClickAction = (_find = (((_getState$localConfig = getState().localConfig) === null || _getState$localConfig === void 0 || (_getState$localConfig = _getState$localConfig.plugins) === null || _getState$localConfig === void 0 ? void 0 : _getState$localConfig[device]) || []).find(function (config) {
|
|
29
|
+
return config.name === task;
|
|
30
|
+
})) === null || _find === void 0 ? void 0 : _find.mapClickAction;
|
|
31
|
+
}
|
|
32
|
+
dispatch({
|
|
33
|
+
type: SET_CURRENT_TASK,
|
|
34
|
+
id: task,
|
|
35
|
+
mode: mode,
|
|
36
|
+
data: data,
|
|
37
|
+
unsetOnMapClick: mapClickAction === 'unset',
|
|
38
|
+
identifyEnabled: task === null || mapClickAction === 'identify'
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
var beforeUnloadListener = null;
|
|
43
|
+
export function setCurrentTaskBlocked(blocked) {
|
|
44
|
+
var unloadmsg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
45
|
+
if (beforeUnloadListener) {
|
|
46
|
+
window.removeEventListener('beforeunload', beforeUnloadListener);
|
|
47
|
+
beforeUnloadListener = null;
|
|
48
|
+
}
|
|
49
|
+
if (blocked && unloadmsg !== null) {
|
|
50
|
+
beforeUnloadListener = function beforeUnloadListener(event) {
|
|
51
|
+
event.preventDefault();
|
|
52
|
+
event.returnValue = unloadmsg;
|
|
53
|
+
return unloadmsg;
|
|
54
|
+
};
|
|
55
|
+
window.addEventListener('beforeunload', beforeUnloadListener);
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
type: SET_CURRENT_TASK_BLOCKED,
|
|
59
|
+
blocked: blocked
|
|
60
|
+
};
|
|
61
|
+
}
|
package/actions/theme.js
CHANGED
|
@@ -1,24 +1,344 @@
|
|
|
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 _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
3
|
+
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."); }
|
|
4
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
5
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
6
|
+
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; } } }; }
|
|
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 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; }
|
|
10
|
+
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; }
|
|
11
|
+
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; }
|
|
12
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
13
|
+
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); }
|
|
14
|
+
/**
|
|
2
15
|
* Copyright 2016-2024 Sourcepole AG
|
|
3
16
|
* All rights reserved.
|
|
4
17
|
*
|
|
5
18
|
* This source code is licensed under the BSD-style license found in the
|
|
6
19
|
* LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import ReducerIndex from '../reducers/index';
|
|
23
|
+
import themeReducer from '../reducers/theme';
|
|
24
|
+
ReducerIndex.register("theme", themeReducer);
|
|
25
|
+
import isEmpty from 'lodash.isempty';
|
|
26
|
+
import { setView3dMode, View3DMode } from '../actions/display';
|
|
27
|
+
import { setCurrentTask } from '../actions/task';
|
|
28
|
+
import ConfigUtils from '../utils/ConfigUtils';
|
|
29
|
+
import CoordinatesUtils from '../utils/CoordinatesUtils';
|
|
30
|
+
import LayerUtils from '../utils/LayerUtils';
|
|
31
|
+
import LocaleUtils from '../utils/LocaleUtils';
|
|
32
|
+
import MapUtils from '../utils/MapUtils';
|
|
33
|
+
import { UrlParams } from '../utils/PermaLinkUtils';
|
|
34
|
+
import ServiceLayerUtils from '../utils/ServiceLayerUtils';
|
|
35
|
+
import ThemeUtils from '../utils/ThemeUtils';
|
|
36
|
+
import { LayerRole, addLayer, removeLayer, removeAllLayers, replacePlaceholderLayer, setSwipe } from './layers';
|
|
37
|
+
import { configureMap } from './map';
|
|
38
|
+
import { showNotification, NotificationType } from './windows';
|
|
39
|
+
export var THEMES_LOADED = 'THEMES_LOADED';
|
|
40
|
+
export var SET_THEME_LAYERS_LIST = 'SET_THEME_LAYERS_LIST';
|
|
41
|
+
export var SET_CURRENT_THEME = 'SET_CURRENT_THEME';
|
|
42
|
+
export var SWITCHING_THEME = 'SWITCHING_THEME';
|
|
43
|
+
export function themesLoaded(themes) {
|
|
44
|
+
return {
|
|
45
|
+
type: THEMES_LOADED,
|
|
46
|
+
themes: themes
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export function setThemeLayersList(theme) {
|
|
50
|
+
return {
|
|
51
|
+
type: SET_THEME_LAYERS_LIST,
|
|
52
|
+
themelist: theme
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
export function finishThemeSetup(dispatch, theme, themes, layerConfigs, insertPos, permalinkLayers, externalLayerRestorer, visibleBgLayer, initialTheme) {
|
|
56
|
+
var _theme$config;
|
|
57
|
+
var initialView = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : null;
|
|
58
|
+
// Create layer
|
|
59
|
+
var themeLayer = ThemeUtils.createThemeLayer(theme, themes);
|
|
60
|
+
var layers = [themeLayer];
|
|
61
|
+
|
|
62
|
+
// Restore theme layer configuration, create placeholders for missing layers
|
|
63
|
+
var externalLayers = {};
|
|
64
|
+
if (!isEmpty(permalinkLayers) && ConfigUtils.getConfigProp("storeAllLayersInPermalink")) {
|
|
65
|
+
layers = permalinkLayers;
|
|
66
|
+
} else {
|
|
67
|
+
if (layerConfigs) {
|
|
68
|
+
if (ConfigUtils.getConfigProp("allowReorderingLayers", theme) !== true) {
|
|
69
|
+
layers = LayerUtils.restoreLayerParams(themeLayer, layerConfigs, permalinkLayers, externalLayers);
|
|
70
|
+
} else {
|
|
71
|
+
layers = LayerUtils.restoreOrderedLayerParams(themeLayer, layerConfigs, permalinkLayers, externalLayers);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (isEmpty(layers)) {
|
|
75
|
+
layers = [_objectSpread(_objectSpread({}, themeLayer), {}, {
|
|
76
|
+
sublayers: []
|
|
77
|
+
})];
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Add background layers for theme
|
|
82
|
+
var haveVisibleBg = false;
|
|
83
|
+
var bgLayers = ThemeUtils.createThemeBackgroundLayers(theme.backgroundLayers || [], themes, visibleBgLayer, externalLayers);
|
|
84
|
+
if (initialTheme && visibleBgLayer) {
|
|
85
|
+
var _bgLayers$find;
|
|
86
|
+
var visibleLayer = (_bgLayers$find = bgLayers.find(function (entry) {
|
|
87
|
+
return entry.visibility;
|
|
88
|
+
})) === null || _bgLayers$find === void 0 ? void 0 : _bgLayers$find.name;
|
|
89
|
+
if (visibleLayer !== visibleBgLayer) {
|
|
90
|
+
dispatch(showNotification("missingbglayer", LocaleUtils.tr("app.missingbg", visibleBgLayer), NotificationType.WARN, true));
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
var _iterator = _createForOfIteratorHelper(bgLayers),
|
|
94
|
+
_step;
|
|
95
|
+
try {
|
|
96
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
97
|
+
var bgLayer = _step.value;
|
|
98
|
+
haveVisibleBg |= bgLayer.visibility;
|
|
99
|
+
dispatch(addLayer(bgLayer));
|
|
100
|
+
}
|
|
101
|
+
} catch (err) {
|
|
102
|
+
_iterator.e(err);
|
|
103
|
+
} finally {
|
|
104
|
+
_iterator.f();
|
|
105
|
+
}
|
|
106
|
+
if (!haveVisibleBg) {
|
|
107
|
+
UrlParams.updateParams({
|
|
108
|
+
bl: ""
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
var _iterator2 = _createForOfIteratorHelper(layers.reverse()),
|
|
112
|
+
_step2;
|
|
113
|
+
try {
|
|
114
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
115
|
+
var layer = _step2.value;
|
|
116
|
+
dispatch(addLayer(layer, insertPos));
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// Restore external layers
|
|
120
|
+
} catch (err) {
|
|
121
|
+
_iterator2.e(err);
|
|
122
|
+
} finally {
|
|
123
|
+
_iterator2.f();
|
|
124
|
+
}
|
|
125
|
+
if (externalLayerRestorer) {
|
|
126
|
+
externalLayerRestorer(externalLayers, themes, function (source, layer) {
|
|
127
|
+
dispatch(replacePlaceholderLayer(source, layer));
|
|
128
|
+
});
|
|
129
|
+
} else {
|
|
130
|
+
for (var _i = 0, _Object$keys = Object.keys(externalLayers); _i < _Object$keys.length; _i++) {
|
|
131
|
+
var key = _Object$keys[_i];
|
|
132
|
+
var idx = key.indexOf(":");
|
|
133
|
+
var service = key.slice(0, idx);
|
|
134
|
+
var serviceUrl = key.slice(idx + 1);
|
|
135
|
+
ServiceLayerUtils.findLayers(service, serviceUrl, externalLayers[key], theme.mapCrs, function (id, layer) {
|
|
136
|
+
// Don't expose sublayers
|
|
137
|
+
if (layer) {
|
|
138
|
+
layer.sublayers = null;
|
|
139
|
+
}
|
|
140
|
+
dispatch(replacePlaceholderLayer(id, layer));
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
dispatch({
|
|
145
|
+
type: SET_CURRENT_THEME,
|
|
146
|
+
theme: theme
|
|
147
|
+
});
|
|
148
|
+
if (initialView === null) {
|
|
149
|
+
if (theme.startupView === "2d") {
|
|
150
|
+
dispatch(setView3dMode(View3DMode.DISABLED));
|
|
151
|
+
} else if (theme.startupView === "3d2d") {
|
|
152
|
+
dispatch(setView3dMode(View3DMode.SPLITSCREEN));
|
|
153
|
+
} else if (theme.startupView === "3d") {
|
|
154
|
+
dispatch(setView3dMode(View3DMode.FULLSCREEN));
|
|
155
|
+
}
|
|
156
|
+
} else {
|
|
157
|
+
UrlParams.updateParams({
|
|
158
|
+
v: initialView
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
dispatch({
|
|
162
|
+
type: SWITCHING_THEME,
|
|
163
|
+
switching: false
|
|
164
|
+
});
|
|
165
|
+
var task = (_theme$config = theme.config) === null || _theme$config === void 0 ? void 0 : _theme$config.startupTask;
|
|
166
|
+
if (task) {
|
|
167
|
+
var mapClickAction = ConfigUtils.getPluginConfig(task.key).mapClickAction;
|
|
168
|
+
dispatch(setCurrentTask(task.key, task.mode, mapClickAction));
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
export function setCurrentTheme(theme, themes) {
|
|
172
|
+
var preserve = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
173
|
+
var initialExtent = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
174
|
+
var layerParams = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
|
|
175
|
+
var visibleBgLayer = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null;
|
|
176
|
+
var permalinkLayers = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
|
|
177
|
+
var themeLayerRestorer = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
|
|
178
|
+
var externalLayerRestorer = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : null;
|
|
179
|
+
var initialView = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : null;
|
|
180
|
+
return function (dispatch, getState) {
|
|
181
|
+
var _getState$layers;
|
|
182
|
+
var curLayers = ((_getState$layers = getState().layers) === null || _getState$layers === void 0 ? void 0 : _getState$layers.flat) || [];
|
|
183
|
+
var mapCrs = theme.mapCrs || themes.defaultMapCrs || "EPSG:3857";
|
|
184
|
+
if (!(mapCrs in CoordinatesUtils.getAvailableCRS())) {
|
|
185
|
+
dispatch(showNotification("missingprojection", LocaleUtils.tr("app.missingprojection", theme.title, mapCrs), NotificationType.WARN, true));
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
var initialTheme = !getState().theme.current;
|
|
189
|
+
dispatch({
|
|
190
|
+
type: SWITCHING_THEME,
|
|
191
|
+
switching: true
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
// Get current background layer if it needs to be preserved
|
|
195
|
+
if (preserve && visibleBgLayer === null && ConfigUtils.getConfigProp("preserveBackgroundOnThemeSwitch", theme) === true) {
|
|
196
|
+
var curBgLayer = curLayers.find(function (layer) {
|
|
197
|
+
return layer.role === LayerRole.BACKGROUND && layer.visibility === true;
|
|
198
|
+
});
|
|
199
|
+
visibleBgLayer = curBgLayer ? curBgLayer.name : null;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// Remove old layers
|
|
203
|
+
var insertPos = 0;
|
|
204
|
+
if (preserve && ConfigUtils.getConfigProp("preserveNonThemeLayersOnThemeSwitch", theme) === true) {
|
|
205
|
+
// Compute insertion position of new theme layers by counting how many non-theme layers remain
|
|
206
|
+
insertPos = curLayers.filter(function (layer) {
|
|
207
|
+
return layer.role === LayerRole.USERLAYER;
|
|
208
|
+
}).length;
|
|
209
|
+
var removeLayers = curLayers.filter(function (layer) {
|
|
210
|
+
return layer.role !== LayerRole.USERLAYER;
|
|
211
|
+
}).map(function (layer) {
|
|
212
|
+
return layer.id;
|
|
213
|
+
});
|
|
214
|
+
var _iterator3 = _createForOfIteratorHelper(removeLayers),
|
|
215
|
+
_step3;
|
|
216
|
+
try {
|
|
217
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
218
|
+
var layerId = _step3.value;
|
|
219
|
+
dispatch(removeLayer(layerId));
|
|
220
|
+
}
|
|
221
|
+
} catch (err) {
|
|
222
|
+
_iterator3.e(err);
|
|
223
|
+
} finally {
|
|
224
|
+
_iterator3.f();
|
|
225
|
+
}
|
|
226
|
+
} else {
|
|
227
|
+
dispatch(removeAllLayers());
|
|
228
|
+
}
|
|
229
|
+
dispatch(setSwipe(null));
|
|
230
|
+
if (!theme) {
|
|
231
|
+
dispatch({
|
|
232
|
+
type: SWITCHING_THEME,
|
|
233
|
+
switching: false
|
|
234
|
+
});
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// Inherit defaults if necessary
|
|
239
|
+
theme = _objectSpread(_objectSpread({}, theme), {}, {
|
|
240
|
+
mapCrs: mapCrs,
|
|
241
|
+
version: theme.version || themes.defaultWMSVersion || "1.3.0",
|
|
242
|
+
scales: theme.scales || themes.defaultScales || MapUtils.getGoogleMercatorScales(0, 21),
|
|
243
|
+
printScales: theme.printScales || themes.defaultPrintScales || undefined,
|
|
244
|
+
printResolutions: theme.printResolutions || themes.defaultPrintResolutions || undefined,
|
|
245
|
+
printGrid: theme.printGrid || themes.defaultPrintGrid || undefined,
|
|
246
|
+
searchProviders: theme.searchProviders || themes.defaultSearchProviders || undefined,
|
|
247
|
+
backgroundLayers: theme.backgroundLayers || themes.defaultBackgroundLayers || [],
|
|
248
|
+
defaultDisplayCrs: theme.defaultDisplayCrs || themes.defaultDisplayCrs || undefined
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
// Preserve extent if desired and possible
|
|
252
|
+
if (getState().display.view3dMode !== View3DMode.FULLSCREEN) {
|
|
253
|
+
var curCrs = getState().map.projection;
|
|
254
|
+
if (preserve && !initialExtent && curCrs === theme.mapCrs) {
|
|
255
|
+
var curBounds = getState().map.bbox.bounds;
|
|
256
|
+
if (ConfigUtils.getConfigProp("preserveExtentOnThemeSwitch", theme) === true) {
|
|
257
|
+
// If theme bbox (b1) includes current bbox (b2), keep current extent
|
|
258
|
+
var b1 = CoordinatesUtils.reprojectBbox(theme.bbox.bounds, theme.bbox.crs, curCrs);
|
|
259
|
+
var b2 = curBounds;
|
|
260
|
+
if (b2[0] >= b1[0] && b2[1] >= b1[1] && b2[2] <= b1[2] && b2[3] <= b1[3]) {
|
|
261
|
+
// theme bbox (b1) includes current bbox (b2)
|
|
262
|
+
initialExtent = {
|
|
263
|
+
bounds: curBounds,
|
|
264
|
+
crs: curCrs
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
} else if (ConfigUtils.getConfigProp("preserveExtentOnThemeSwitch", theme) === "force") {
|
|
268
|
+
initialExtent = {
|
|
269
|
+
bounds: curBounds,
|
|
270
|
+
crs: curCrs
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
// Reconfigure map
|
|
277
|
+
dispatch(configureMap(theme.mapCrs, theme.scales, initialExtent || theme.initialBbox, theme.defaultDisplayCrs));
|
|
278
|
+
var layerConfigs = layerParams ? layerParams.map(function (param) {
|
|
279
|
+
return LayerUtils.splitLayerUrlParam(param);
|
|
280
|
+
}) : null;
|
|
281
|
+
if (layerConfigs) {
|
|
282
|
+
layerConfigs = LayerUtils.replaceLayerGroups(layerConfigs, theme);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
// Restore missing theme layers
|
|
286
|
+
var missingThemeLayers = null;
|
|
287
|
+
if (layerConfigs) {
|
|
288
|
+
var layerNames = LayerUtils.getSublayerNames(theme);
|
|
289
|
+
missingThemeLayers = layerConfigs.reduce(function (missing, layerConfig) {
|
|
290
|
+
if (layerConfig.type === 'theme' && !layerNames.includes(layerConfig.name)) {
|
|
291
|
+
return _objectSpread(_objectSpread({}, missing), {}, _defineProperty({}, layerConfig.name, layerConfig));
|
|
292
|
+
} else {
|
|
293
|
+
return missing;
|
|
294
|
+
}
|
|
295
|
+
}, {});
|
|
296
|
+
}
|
|
297
|
+
if (themeLayerRestorer && !isEmpty(missingThemeLayers)) {
|
|
298
|
+
themeLayerRestorer(Object.keys(missingThemeLayers), theme, function (newLayers, newLayerNames) {
|
|
299
|
+
var newTheme = LayerUtils.mergeSubLayers(theme, {
|
|
300
|
+
sublayers: newLayers
|
|
301
|
+
});
|
|
302
|
+
if (newLayerNames) {
|
|
303
|
+
layerConfigs = layerConfigs.reduce(function (res, layerConfig) {
|
|
304
|
+
if (layerConfig.name in newLayerNames) {
|
|
305
|
+
// If layerConfig exactly matches a restored theme layer, return unchanged config
|
|
306
|
+
if (newLayerNames[layerConfig.name].length === 1 && newLayerNames[layerConfig.name][0] === layerConfig.name) {
|
|
307
|
+
return [].concat(_toConsumableArray(res), [layerConfig]);
|
|
308
|
+
}
|
|
309
|
+
// Else, in case multiple theme layers were returned (i.e. layerConfig.name specifies a group)
|
|
310
|
+
// generate layerConfigs based on the group layerConfig, preserving the opacity/visibility/etc of the sublayer
|
|
311
|
+
return [].concat(_toConsumableArray(res), _toConsumableArray(newLayerNames[layerConfig.name].map(function (sublayername) {
|
|
312
|
+
var _sublayer$opacity, _sublayer$visibility;
|
|
313
|
+
var sublayer = LayerUtils.searchSubLayer({
|
|
314
|
+
sublayers: newLayers
|
|
315
|
+
}, "name", sublayername);
|
|
316
|
+
return _objectSpread(_objectSpread({}, layerConfig), {}, {
|
|
317
|
+
name: sublayername,
|
|
318
|
+
opacity: (_sublayer$opacity = sublayer.opacity) !== null && _sublayer$opacity !== void 0 ? _sublayer$opacity : 255,
|
|
319
|
+
visibility: (_sublayer$visibility = sublayer.visibility) !== null && _sublayer$visibility !== void 0 ? _sublayer$visibility : true,
|
|
320
|
+
tristate: sublayer.tristate || false,
|
|
321
|
+
style: sublayer.style
|
|
322
|
+
});
|
|
323
|
+
})));
|
|
324
|
+
} else {
|
|
325
|
+
return [].concat(_toConsumableArray(res), [layerConfig]);
|
|
326
|
+
}
|
|
327
|
+
}, []);
|
|
328
|
+
var diff = Object.keys(missingThemeLayers).filter(function (entry) {
|
|
329
|
+
return isEmpty(newLayerNames[entry]);
|
|
330
|
+
});
|
|
331
|
+
if (!isEmpty(diff)) {
|
|
332
|
+
dispatch(showNotification("missinglayers", LocaleUtils.tr("app.missinglayers", diff.join(", ")), NotificationType.WARN, true));
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
finishThemeSetup(dispatch, newTheme, themes, layerConfigs, insertPos, permalinkLayers, externalLayerRestorer, visibleBgLayer, initialTheme, initialView);
|
|
336
|
+
});
|
|
337
|
+
} else {
|
|
338
|
+
if (!isEmpty(missingThemeLayers)) {
|
|
339
|
+
dispatch(showNotification("missinglayers", LocaleUtils.tr("app.missinglayers", Object.keys(missingThemeLayers).join(", ")), NotificationType.WARN, true));
|
|
340
|
+
}
|
|
341
|
+
finishThemeSetup(dispatch, theme, themes, layerConfigs, insertPos, permalinkLayers, externalLayerRestorer, visibleBgLayer, initialTheme, initialView);
|
|
342
|
+
}
|
|
343
|
+
};
|
|
344
|
+
}
|