qwc2 2025.10.13 → 2025.10.15
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 +768 -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,94 +1,428 @@
|
|
|
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 _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
3
|
+
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."); }
|
|
4
|
+
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; } }
|
|
5
|
+
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; }
|
|
6
|
+
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; } }
|
|
7
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
8
|
+
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; }
|
|
9
|
+
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; }
|
|
10
|
+
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; }
|
|
11
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
12
|
+
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); }
|
|
13
|
+
/**
|
|
2
14
|
* Copyright 2017-2024 Sourcepole AG
|
|
3
15
|
* All rights reserved.
|
|
4
16
|
*
|
|
5
17
|
* This source code is licensed under the BSD-style license found in the
|
|
6
18
|
* LICENSE file in the root directory of this source tree.
|
|
7
|
-
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
8
22
|
* NOTE: This sample editing interface is designed to work with the counterpart at
|
|
9
23
|
* https://github.com/qwc-services/qwc-data-service
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
24
|
+
*/
|
|
25
|
+
import axios from 'axios';
|
|
26
|
+
import isEmpty from 'lodash.isempty';
|
|
27
|
+
import ConfigUtils from './ConfigUtils';
|
|
28
|
+
import { computeExpressionFields } from './EditingUtils';
|
|
29
|
+
import LocaleUtils from './LocaleUtils';
|
|
30
|
+
var EditingInterface = {
|
|
31
|
+
buildErrMsg: function buildErrMsg(err) {
|
|
32
|
+
var message = LocaleUtils.tr("editing.commitfailed");
|
|
33
|
+
if (err.response && err.response.data && err.response.data.message) {
|
|
34
|
+
message = err.response.data.message;
|
|
35
|
+
if (!isEmpty(err.response.data.geometry_errors)) {
|
|
36
|
+
message += ":\n";
|
|
37
|
+
message += err.response.data.geometry_errors.map(function (entry) {
|
|
38
|
+
var entrymsg = " - " + entry.reason;
|
|
39
|
+
if (entry.location) {
|
|
40
|
+
entrymsg += " at " + entry.location;
|
|
41
|
+
}
|
|
42
|
+
return entrymsg;
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
if (!isEmpty(err.response.data.data_errors)) {
|
|
46
|
+
message += ":\n - " + err.response.data.data_errors.join("\n - ");
|
|
47
|
+
}
|
|
48
|
+
if (!isEmpty(err.response.data.validation_errors)) {
|
|
49
|
+
message += ":\n - " + err.response.data.validation_errors.join("\n - ");
|
|
50
|
+
}
|
|
51
|
+
if (!isEmpty(err.response.data.attachment_errors)) {
|
|
52
|
+
message += ":\n - " + err.response.data.attachment_errors.join("\n - ");
|
|
53
|
+
}
|
|
54
|
+
} else if (err.response && err.response.statusText) {
|
|
55
|
+
message += ": " + err.response.statusText;
|
|
56
|
+
}
|
|
57
|
+
return message;
|
|
58
|
+
},
|
|
59
|
+
/**
|
|
60
|
+
* Gets features at the specified map position.
|
|
61
|
+
*
|
|
62
|
+
* @param editConfig The edit config of the dataset to query features from
|
|
63
|
+
* @param mapPos The [x, y] map position
|
|
64
|
+
* @param mapCrs The CRS of the map, as an EPSG code
|
|
65
|
+
* @param mapScale The scale denominator, used to compute the pick tolerance
|
|
66
|
+
* @param dpi The screen dpi, used to compute the pick tolerance
|
|
67
|
+
* @param callback Callback invoked with the picked features, taking `{features: [...]}` on success and `null` on failure
|
|
68
|
+
* @param filter An optional feature attribute filter expression
|
|
69
|
+
* @param filterGeom An optional filter geometry
|
|
70
|
+
*/
|
|
71
|
+
getFeature: function getFeature(editConfig, mapPos, mapCrs, mapScale, dpi, callback) {
|
|
72
|
+
var filter = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
|
|
73
|
+
var filterGeom = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
|
|
74
|
+
var editServiceUrl = ConfigUtils.getConfigProp("editServiceUrl").replace(/\/$/, '');
|
|
75
|
+
var requestUrl = editServiceUrl + '/' + editConfig.editDataset + '/';
|
|
76
|
+
|
|
77
|
+
// 10px tolerance
|
|
78
|
+
var tol = 10.0 / dpi * 0.0254 * mapScale;
|
|
79
|
+
var bbox = mapPos[0] - tol + "," + (mapPos[1] - tol) + "," + (mapPos[0] + tol) + "," + (mapPos[1] + tol);
|
|
80
|
+
var params = {
|
|
81
|
+
bbox: bbox,
|
|
82
|
+
crs: mapCrs,
|
|
83
|
+
filter: filter ? JSON.stringify(filter) : undefined,
|
|
84
|
+
filter_geom: filterGeom ? JSON.stringify(_objectSpread(_objectSpread({}, filterGeom), {}, {
|
|
85
|
+
crs: {
|
|
86
|
+
type: "name",
|
|
87
|
+
properties: {
|
|
88
|
+
name: mapCrs
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
})) : undefined
|
|
92
|
+
};
|
|
93
|
+
var headers = {
|
|
94
|
+
"Accept-Language": LocaleUtils.lang()
|
|
95
|
+
};
|
|
96
|
+
axios.get(requestUrl, {
|
|
97
|
+
headers: headers,
|
|
98
|
+
params: params
|
|
99
|
+
}).then(function (response) {
|
|
100
|
+
var _response$data;
|
|
101
|
+
if (!isEmpty(response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.features)) {
|
|
102
|
+
var version = +new Date();
|
|
103
|
+
var promises = response.data.features.map(function (feature) {
|
|
104
|
+
return new Promise(function (resolve) {
|
|
105
|
+
computeExpressionFields(editConfig, feature, EditingInterface, mapCrs, function (newfeature) {
|
|
106
|
+
return resolve(_objectSpread(_objectSpread({}, newfeature), {}, {
|
|
107
|
+
__version__: version
|
|
108
|
+
}));
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
Promise.all(promises).then(function (features) {
|
|
113
|
+
return callback({
|
|
114
|
+
features: features
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
} else {
|
|
118
|
+
callback(null);
|
|
119
|
+
}
|
|
120
|
+
})["catch"](function () {
|
|
121
|
+
callback(null);
|
|
122
|
+
});
|
|
123
|
+
},
|
|
124
|
+
/**
|
|
125
|
+
* Queries a feature by id
|
|
126
|
+
*
|
|
127
|
+
* @param editConfig The edit config of the dataset to query the feature from
|
|
128
|
+
* @param featureId The feature id
|
|
129
|
+
* @param mapCrs The CRS of the map, as an EPSG code
|
|
130
|
+
* @param callback Callback invoked with the picked feature, taking `{<feature>}` on success and `null` on failure
|
|
131
|
+
*/
|
|
132
|
+
getFeatureById: function getFeatureById(editConfig, featureId, mapCrs, callback) {
|
|
133
|
+
var editServiceUrl = ConfigUtils.getConfigProp("editServiceUrl").replace(/\/$/, '');
|
|
134
|
+
var requestUrl = editServiceUrl + '/' + editConfig.editDataset + '/' + featureId;
|
|
135
|
+
var params = {
|
|
136
|
+
crs: mapCrs
|
|
137
|
+
};
|
|
138
|
+
var headers = {
|
|
139
|
+
"Accept-Language": LocaleUtils.lang()
|
|
140
|
+
};
|
|
141
|
+
axios.get(requestUrl, {
|
|
142
|
+
headers: headers,
|
|
143
|
+
params: params
|
|
144
|
+
}).then(function (response) {
|
|
145
|
+
computeExpressionFields(editConfig, response.data, EditingInterface, mapCrs, function (newfeature) {
|
|
146
|
+
return callback(_objectSpread(_objectSpread({}, newfeature), {}, {
|
|
147
|
+
__version__: +new Date()
|
|
148
|
+
}));
|
|
149
|
+
});
|
|
150
|
+
})["catch"](function () {
|
|
151
|
+
callback(null);
|
|
152
|
+
});
|
|
153
|
+
},
|
|
154
|
+
/**
|
|
155
|
+
* Gets the dataset features
|
|
156
|
+
*
|
|
157
|
+
* @param editConfig The edit config of the dataset to query features from
|
|
158
|
+
* @param mapCrs The CRS of the map, as an EPSG code
|
|
159
|
+
* @param callback Callback invoked with the picked features, taking `{features: [...]}` on success and `null` on failure
|
|
160
|
+
* @param filter An optional feature attribute filter expression
|
|
161
|
+
* @param filterGeom An optional filter geometry
|
|
162
|
+
*/
|
|
163
|
+
getFeatures: function getFeatures(editConfig, mapCrs, callback) {
|
|
164
|
+
var bbox = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
165
|
+
var filter = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
|
|
166
|
+
var filterGeom = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null;
|
|
167
|
+
var editServiceUrl = ConfigUtils.getConfigProp("editServiceUrl").replace(/\/$/, '');
|
|
168
|
+
var requestUrl = editServiceUrl + '/' + editConfig.editDataset + '/';
|
|
169
|
+
var params = {
|
|
170
|
+
crs: mapCrs,
|
|
171
|
+
bbox: bbox ? bbox.join(",") : undefined,
|
|
172
|
+
filter: filter ? JSON.stringify(filter) : undefined,
|
|
173
|
+
filter_geom: filterGeom ? JSON.stringify(_objectSpread(_objectSpread({}, filterGeom), {}, {
|
|
174
|
+
crs: {
|
|
175
|
+
type: "name",
|
|
176
|
+
properties: {
|
|
177
|
+
name: mapCrs
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
})) : undefined
|
|
181
|
+
};
|
|
182
|
+
var headers = {
|
|
183
|
+
"Accept-Language": LocaleUtils.lang()
|
|
184
|
+
};
|
|
185
|
+
axios.get(requestUrl, {
|
|
186
|
+
headers: headers,
|
|
187
|
+
params: params
|
|
188
|
+
}).then(function (response) {
|
|
189
|
+
var _response$data2;
|
|
190
|
+
if (Array.isArray(response === null || response === void 0 || (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : _response$data2.features)) {
|
|
191
|
+
var version = +new Date();
|
|
192
|
+
var promises = response.data.features.map(function (feature) {
|
|
193
|
+
return new Promise(function (resolve) {
|
|
194
|
+
computeExpressionFields(editConfig, feature, EditingInterface, mapCrs, function (newfeature) {
|
|
195
|
+
return resolve(_objectSpread(_objectSpread({}, newfeature), {}, {
|
|
196
|
+
__version__: version
|
|
197
|
+
}));
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
});
|
|
201
|
+
Promise.all(promises).then(function (features) {
|
|
202
|
+
return callback({
|
|
203
|
+
features: features
|
|
204
|
+
});
|
|
205
|
+
});
|
|
206
|
+
} else {
|
|
207
|
+
callback(null);
|
|
208
|
+
}
|
|
209
|
+
})["catch"](function () {
|
|
210
|
+
return callback(null);
|
|
211
|
+
});
|
|
212
|
+
},
|
|
213
|
+
/**
|
|
214
|
+
* Query the extent of the dataset features
|
|
215
|
+
* @param editConfig The edit config of the dataset to query features from
|
|
216
|
+
* @param mapCrs The CRS of the map, as an EPSG code
|
|
217
|
+
* @param callback Callback invoked with the feature extent, taking `{bbox: [xmin, ymin, xmax, ymax]}` on success and `null` on failure
|
|
218
|
+
* @param filter An optional feature attribute filter expression
|
|
219
|
+
* @param filterGeom An optional filter geometry
|
|
220
|
+
*/
|
|
221
|
+
getExtent: function getExtent(editConfig, mapCrs, callback) {
|
|
222
|
+
var filter = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
223
|
+
var filterGeom = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
|
|
224
|
+
var editServiceUrl = ConfigUtils.getConfigProp("editServiceUrl").replace(/\/$/, '');
|
|
225
|
+
var requestUrl = editServiceUrl + '/' + editConfig.editDataset + "/extent";
|
|
226
|
+
var params = {
|
|
227
|
+
crs: mapCrs,
|
|
228
|
+
filter: filter ? JSON.stringify(filter) : undefined,
|
|
229
|
+
filter_geom: filterGeom ? JSON.stringify(_objectSpread(_objectSpread({}, filterGeom), {}, {
|
|
230
|
+
crs: {
|
|
231
|
+
type: "name",
|
|
232
|
+
properties: {
|
|
233
|
+
name: mapCrs
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
})) : undefined
|
|
237
|
+
};
|
|
238
|
+
var headers = {
|
|
239
|
+
"Accept-Language": LocaleUtils.lang()
|
|
240
|
+
};
|
|
241
|
+
axios.get(requestUrl, {
|
|
242
|
+
headers: headers,
|
|
243
|
+
params: params
|
|
244
|
+
}).then(function (response) {
|
|
245
|
+
callback(response.data);
|
|
246
|
+
})["catch"](function () {
|
|
247
|
+
callback(null);
|
|
248
|
+
});
|
|
249
|
+
},
|
|
250
|
+
/**
|
|
251
|
+
* Adds a feature to the dataset
|
|
252
|
+
* @param editConfig The edit config of the dataset to add the feature to
|
|
253
|
+
* @param mapCrs The CRS of the map, as an EPSG code
|
|
254
|
+
* @param featureData A FormData instance, with:
|
|
255
|
+
* - A 'feature' entry containing the GeoJSON serialized feature
|
|
256
|
+
* - Zero or more 'file:' prefixed file upload entries
|
|
257
|
+
* - Zero or more 'relfile:' prefixed file upload entries
|
|
258
|
+
* - Optionally a 'g-recaptcha-response' entry with the captcha response
|
|
259
|
+
* @param callback Callback invoked with the added feature, taking `(true, {<feature>}` on success and `(false, <Error Message>}` on failure
|
|
260
|
+
*/
|
|
261
|
+
addFeatureMultipart: function addFeatureMultipart(editConfig, mapCrs, featureData, callback) {
|
|
262
|
+
var editServiceUrl = ConfigUtils.getConfigProp("editServiceUrl").replace(/\/$/, '');
|
|
263
|
+
var requestUrl = editServiceUrl + '/' + editConfig.editDataset + '/multipart';
|
|
264
|
+
var headers = {
|
|
265
|
+
"Content-Type": "multipart/form-data",
|
|
266
|
+
"Accept-Language": LocaleUtils.lang()
|
|
267
|
+
};
|
|
268
|
+
axios.post(requestUrl, featureData, {
|
|
269
|
+
headers: headers
|
|
270
|
+
}).then(function (response) {
|
|
271
|
+
computeExpressionFields(editConfig, response.data, EditingInterface, mapCrs, function (newfeature) {
|
|
272
|
+
return callback(true, _objectSpread(_objectSpread({}, newfeature), {}, {
|
|
273
|
+
__version__: +new Date()
|
|
274
|
+
}));
|
|
275
|
+
});
|
|
276
|
+
})["catch"](function (err) {
|
|
277
|
+
callback(false, EditingInterface.buildErrMsg(err));
|
|
278
|
+
});
|
|
279
|
+
},
|
|
280
|
+
/**
|
|
281
|
+
* Edits a feature of the dataset
|
|
282
|
+
* @param editConfig The edit config of the edited dataset
|
|
283
|
+
* @param mapCrs The CRS of the map, as an EPSG code
|
|
284
|
+
* @param featureId The ID of the edited feature
|
|
285
|
+
* @param featureData A FormData instance, with:
|
|
286
|
+
* - A 'feature' entry containing the GeoJSON serialized feature
|
|
287
|
+
* - Zero or more 'file:' prefixed file upload entries
|
|
288
|
+
* - Zero or more 'relfile:' prefixed file upload entries
|
|
289
|
+
* - Optionally a 'g-recaptcha-response' entry with the captcha response
|
|
290
|
+
* @param callback Callback invoked with the edited feature, taking `(true, {<feature>}` on success and `(false, <Error Message>}` on failure
|
|
291
|
+
*/
|
|
292
|
+
editFeatureMultipart: function editFeatureMultipart(editConfig, mapCrs, featureId, featureData, callback) {
|
|
293
|
+
var editServiceUrl = ConfigUtils.getConfigProp("editServiceUrl").replace(/\/$/, '');
|
|
294
|
+
var requestUrl = editServiceUrl + '/' + editConfig.editDataset + '/multipart/' + featureId;
|
|
295
|
+
var headers = {
|
|
296
|
+
"Content-Type": "multipart/form-data",
|
|
297
|
+
"Accept-Language": LocaleUtils.lang()
|
|
298
|
+
};
|
|
299
|
+
axios.put(requestUrl, featureData, {
|
|
300
|
+
headers: headers
|
|
301
|
+
}).then(function (response) {
|
|
302
|
+
computeExpressionFields(editConfig, response.data, EditingInterface, mapCrs, function (newfeature) {
|
|
303
|
+
return callback(true, _objectSpread(_objectSpread({}, newfeature), {}, {
|
|
304
|
+
__version__: +new Date()
|
|
305
|
+
}));
|
|
306
|
+
});
|
|
307
|
+
})["catch"](function (err) {
|
|
308
|
+
callback(false, EditingInterface.buildErrMsg(err));
|
|
309
|
+
});
|
|
310
|
+
},
|
|
311
|
+
/*
|
|
312
|
+
layerId: The edit layer id
|
|
313
|
+
featureId: The id of the feature to delete
|
|
314
|
+
callback: function(success, result), if success = true, result is null, if success = false, result is an error message
|
|
315
|
+
recaptchaResponse: Optional, captcha challenge response
|
|
316
|
+
*/
|
|
317
|
+
/**
|
|
318
|
+
* Deletes a feature from the dataset
|
|
319
|
+
* @param editConfig The edit config of the dataset from which to delete the feature
|
|
320
|
+
* @param featureId The ID of the edited feature
|
|
321
|
+
* @param callback Callback invoked with the id of the deleted feature, taking `(true, <feature_id>` on success and `(false, <Error Message>}` on failure
|
|
322
|
+
* @param recaptchaResponse Optional captcha challenge response
|
|
323
|
+
*/
|
|
324
|
+
deleteFeature: function deleteFeature(editConfig, featureId, callback) {
|
|
325
|
+
var recaptchaResponse = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
326
|
+
var editServiceUrl = ConfigUtils.getConfigProp("editServiceUrl").replace(/\/$/, '');
|
|
327
|
+
var req = editServiceUrl + '/' + editConfig.editDataset + '/' + featureId;
|
|
328
|
+
var headers = {
|
|
329
|
+
"Accept-Language": LocaleUtils.lang()
|
|
330
|
+
};
|
|
331
|
+
var data = {};
|
|
332
|
+
if (recaptchaResponse) {
|
|
333
|
+
data['g-recaptcha-response'] = recaptchaResponse;
|
|
334
|
+
}
|
|
335
|
+
axios["delete"](req, {
|
|
336
|
+
headers: headers,
|
|
337
|
+
data: data
|
|
338
|
+
}).then(function () {
|
|
339
|
+
callback(true, featureId);
|
|
340
|
+
})["catch"](function (err) {
|
|
341
|
+
callback(false, EditingInterface.buildErrMsg(err));
|
|
342
|
+
});
|
|
343
|
+
},
|
|
344
|
+
/**
|
|
345
|
+
* Queries relation values of a feature
|
|
346
|
+
* @param editConfig The edit config of the feature dataset
|
|
347
|
+
* @param featureId The feature ID
|
|
348
|
+
* @param mapCrs The CRS of the map, as an EPSG code
|
|
349
|
+
* @param tables Comma separated string of relation table names
|
|
350
|
+
* @param editConfigs The theme editConfig block, containing all theme dataset edit configs
|
|
351
|
+
* @param callback Callback invoked with the relation values, taking `{<tablename>: {<relation_values>}}` on success and `{}` on failure
|
|
352
|
+
*/
|
|
353
|
+
getRelations: function getRelations(editConfig, featureId, mapCrs, tables, editConfigs, callback) {
|
|
354
|
+
var editServiceUrl = ConfigUtils.getConfigProp("editServiceUrl").replace(/\/$/, '');
|
|
355
|
+
var req = editServiceUrl + '/' + editConfig.editDataset + '/' + featureId + "/relations";
|
|
356
|
+
var params = {
|
|
357
|
+
tables: tables,
|
|
358
|
+
crs: mapCrs
|
|
359
|
+
};
|
|
360
|
+
var headers = {
|
|
361
|
+
"Accept-Language": LocaleUtils.lang()
|
|
362
|
+
};
|
|
363
|
+
axios.get(req, {
|
|
364
|
+
headers: headers,
|
|
365
|
+
params: params
|
|
366
|
+
}).then(function (response) {
|
|
367
|
+
Promise.all(Object.entries(response.data).map(function (_ref) {
|
|
368
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
369
|
+
reldataset = _ref2[0],
|
|
370
|
+
relvalues = _ref2[1];
|
|
371
|
+
return new Promise(function (resolveTable) {
|
|
372
|
+
Promise.all(relvalues.features.map(function (feature) {
|
|
373
|
+
return new Promise(function (resolveFeature) {
|
|
374
|
+
var relEditConfig = Object.values(editConfigs).find(function (entry) {
|
|
375
|
+
return entry.editDataset === reldataset;
|
|
376
|
+
});
|
|
377
|
+
computeExpressionFields(relEditConfig, feature, EditingInterface, mapCrs, resolveFeature);
|
|
378
|
+
});
|
|
379
|
+
})).then(function (newfeatures) {
|
|
380
|
+
return resolveTable([reldataset, _objectSpread(_objectSpread({}, relvalues), {}, {
|
|
381
|
+
features: newfeatures
|
|
382
|
+
})]);
|
|
383
|
+
});
|
|
384
|
+
});
|
|
385
|
+
})).then(function (entries) {
|
|
386
|
+
return callback(Object.fromEntries(entries));
|
|
387
|
+
});
|
|
388
|
+
})["catch"](function () {
|
|
389
|
+
return callback({});
|
|
390
|
+
});
|
|
391
|
+
},
|
|
392
|
+
/**
|
|
393
|
+
* Query key-value-pairs of a key-value-relation
|
|
394
|
+
* @param keyvalues The keyval string `<keyvaldataset>:<keyfield>:<valuefield>`
|
|
395
|
+
* @param callback Callback invoked with the key-value pairs, taking `{keyvalues: {<keyvaldataset>: [{key: <key>, value: <value>}]}}` on success and `{}` on failure
|
|
396
|
+
* @param filter An optional filter expression, as `[[["<name>", "<op>", <value>],"and|or",["<name>","<op>",<value>],...]]` (one filter expr per keyvalue entry)
|
|
397
|
+
*/
|
|
398
|
+
getKeyValues: function getKeyValues(keyvalues, callback) {
|
|
399
|
+
var filter = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
400
|
+
var editServiceUrl = ConfigUtils.getConfigProp("editServiceUrl").replace(/\/$/, '');
|
|
401
|
+
var req = editServiceUrl + '/' + "keyvals?tables=" + keyvalues;
|
|
402
|
+
var params = {
|
|
403
|
+
filter: filter ? JSON.stringify(filter) : undefined
|
|
404
|
+
};
|
|
405
|
+
var headers = {
|
|
406
|
+
"Accept-Language": LocaleUtils.lang()
|
|
407
|
+
};
|
|
408
|
+
axios.get(req, {
|
|
409
|
+
headers: headers,
|
|
410
|
+
params: params
|
|
411
|
+
}).then(function (response) {
|
|
412
|
+
callback(response.data);
|
|
413
|
+
})["catch"](function () {
|
|
414
|
+
return callback({});
|
|
415
|
+
});
|
|
416
|
+
},
|
|
417
|
+
/**
|
|
418
|
+
* Resolve an attachment value to a full URL
|
|
419
|
+
*
|
|
420
|
+
* @param dataset The dataset name
|
|
421
|
+
* @param fileValue The attachment value
|
|
422
|
+
*/
|
|
423
|
+
resolveAttachmentUrl: function resolveAttachmentUrl(dataset, fileValue) {
|
|
424
|
+
var editServiceUrl = ConfigUtils.getConfigProp("editServiceUrl").replace(/\/$/, '');
|
|
425
|
+
return editServiceUrl + '/' + dataset + "/attachment?file=" + encodeURIComponent(fileValue);
|
|
426
|
+
}
|
|
427
|
+
};
|
|
428
|
+
export default EditingInterface;
|