qwc2 2025.12.24 → 2026.1.6
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/components/IdentifyViewer.js +3 -1
- package/components/LinkFeatureForm.js +3 -20
- package/components/widgets/TextInput.js +10 -6
- package/package.json +1 -1
- package/plugins/Editing.js +2 -10
- package/plugins/ObliqueView.js +8 -27
- package/plugins/map/EditingSupport.js +82 -32
- package/reducers/editing.js +3 -8
- package/scripts/themesConfig.js +0 -3
- package/scripts/themesConfig.py +0 -2
- package/utils/LayerUtils.js +20 -20
- package/utils/PermaLinkUtils.js +52 -1
- package/utils/ThemeUtils.js +1 -1
|
@@ -1126,7 +1126,9 @@ var IdentifyViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1126
1126
|
});
|
|
1127
1127
|
_defineProperty(_this, "parsedContent", function (text) {
|
|
1128
1128
|
text = DOMPurify.sanitize(text, {
|
|
1129
|
-
ADD_ATTR: ['target']
|
|
1129
|
+
ADD_ATTR: ['target'],
|
|
1130
|
+
ADD_TAGS: ["iframe"],
|
|
1131
|
+
FORCE_BODY: true
|
|
1130
1132
|
}).replace(' ', '<br />');
|
|
1131
1133
|
var options = {
|
|
1132
1134
|
replace: function replace(node) {
|
|
@@ -23,7 +23,6 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import React from 'react';
|
|
26
|
-
import ReactDOM from 'react-dom';
|
|
27
26
|
import { connect } from 'react-redux';
|
|
28
27
|
import PropTypes from 'prop-types';
|
|
29
28
|
import { setEditContext } from '../actions/editing';
|
|
@@ -32,8 +31,6 @@ import { getFeatureTemplate } from '../utils/EditingUtils';
|
|
|
32
31
|
import LocaleUtils from '../utils/LocaleUtils';
|
|
33
32
|
import MapUtils from '../utils/MapUtils';
|
|
34
33
|
import AttributeForm from './AttributeForm';
|
|
35
|
-
import MeasureSwitcher from './MeasureSwitcher';
|
|
36
|
-
import { BottomToolPortalContext } from './PluginsContainer';
|
|
37
34
|
import './style/LinkFeatureForm.css';
|
|
38
35
|
var LinkFeatureForm = /*#__PURE__*/function (_React$Component) {
|
|
39
36
|
function LinkFeatureForm() {
|
|
@@ -48,12 +45,6 @@ var LinkFeatureForm = /*#__PURE__*/function (_React$Component) {
|
|
|
48
45
|
pickedFeatures: null,
|
|
49
46
|
highlightedFeature: null
|
|
50
47
|
});
|
|
51
|
-
_defineProperty(_this, "changeMeasurementState", function (diff) {
|
|
52
|
-
var editContext = _this.props.editing.contexts[_this.props.editContextId];
|
|
53
|
-
_this.props.setEditContext(_this.props.editContextId, {
|
|
54
|
-
measurements: _objectSpread(_objectSpread({}, editContext.measurements), diff)
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
48
|
_defineProperty(_this, "childPickQuery", function (coordinate) {
|
|
58
49
|
var scale = Math.round(MapUtils.computeForZoom(_this.props.map.scales, _this.props.map.zoom));
|
|
59
50
|
_this.props.iface.getFeature(_this.props.editConfig, coordinate, _this.props.map.projection, scale, 96, function (featureCollection) {
|
|
@@ -211,11 +202,9 @@ var LinkFeatureForm = /*#__PURE__*/function (_React$Component) {
|
|
|
211
202
|
onClick: this.finish
|
|
212
203
|
}, LocaleUtils.tr("common.cancel"))));
|
|
213
204
|
} else if (editContext.feature) {
|
|
214
|
-
var _editContext$feature;
|
|
215
205
|
var drawing = editContext.action === 'Draw' && !editContext.feature.geometry && this.props.editConfig.geomType;
|
|
216
|
-
return
|
|
217
|
-
className: "link-feature-form"
|
|
218
|
-
key: "LinkFeatureForm"
|
|
206
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
207
|
+
className: "link-feature-form"
|
|
219
208
|
}, drawing ? /*#__PURE__*/React.createElement("div", {
|
|
220
209
|
className: "link-feature-form-hint"
|
|
221
210
|
}, /*#__PURE__*/React.createElement("span", null, LocaleUtils.tr("linkfeatureform.drawhint"))) : /*#__PURE__*/React.createElement(AttributeForm, {
|
|
@@ -231,19 +220,13 @@ var LinkFeatureForm = /*#__PURE__*/function (_React$Component) {
|
|
|
231
220
|
className: "button",
|
|
232
221
|
disabled: editContext.changed,
|
|
233
222
|
onClick: this.finish
|
|
234
|
-
}, drawing ? LocaleUtils.tr("common.cancel") : LocaleUtils.tr("common.close"))))
|
|
235
|
-
changeMeasureState: this.changeMeasurementState,
|
|
236
|
-
geomType: editContext.geomType,
|
|
237
|
-
iconSize: "large",
|
|
238
|
-
measureState: editContext.measurements
|
|
239
|
-
}), this.context) : null];
|
|
223
|
+
}, drawing ? LocaleUtils.tr("common.cancel") : LocaleUtils.tr("common.close"))));
|
|
240
224
|
} else {
|
|
241
225
|
return null;
|
|
242
226
|
}
|
|
243
227
|
}
|
|
244
228
|
}]);
|
|
245
229
|
}(React.Component);
|
|
246
|
-
_defineProperty(LinkFeatureForm, "contextType", BottomToolPortalContext);
|
|
247
230
|
_defineProperty(LinkFeatureForm, "propTypes", {
|
|
248
231
|
action: PropTypes.string,
|
|
249
232
|
addLayerFeatures: PropTypes.func,
|
|
@@ -47,6 +47,15 @@ var TextInput = /*#__PURE__*/function (_React$Component) {
|
|
|
47
47
|
_this.input.innerHTML = DOMPurify.sanitize(value.replaceAll('\n', _this.props.multiline ? '<br />' : ''));
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
|
+
_defineProperty(_this, "storeRef", function (el) {
|
|
51
|
+
if (el) {
|
|
52
|
+
_this.input = el;
|
|
53
|
+
_this.setDefaultValue(_this.state.value, _this.state.valueRev, -1);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
_defineProperty(_this, "setInputContents", function () {
|
|
57
|
+
_this.input.innerHTML = _this.state.value.replaceAll('\n', _this.props.multiline ? '<br />' : '');
|
|
58
|
+
});
|
|
50
59
|
_defineProperty(_this, "onCopy", function (ev, cut) {
|
|
51
60
|
ev.preventDefault();
|
|
52
61
|
var selection = window.getSelection();
|
|
@@ -243,9 +252,6 @@ var TextInput = /*#__PURE__*/function (_React$Component) {
|
|
|
243
252
|
}) : null, /*#__PURE__*/React.createElement("pre", {
|
|
244
253
|
className: preClassName,
|
|
245
254
|
contentEditable: !this.props.disabled && !this.props.readOnly,
|
|
246
|
-
dangerouslySetInnerHTML: {
|
|
247
|
-
__html: this.state.value.replaceAll('\n', this.props.multiline ? '<br />' : '')
|
|
248
|
-
},
|
|
249
255
|
onBlur: this.onBlur,
|
|
250
256
|
onChange: this.onChange,
|
|
251
257
|
onCopy: function onCopy(ev) {
|
|
@@ -260,9 +266,7 @@ var TextInput = /*#__PURE__*/function (_React$Component) {
|
|
|
260
266
|
onMouseDown: this.onMouseDown,
|
|
261
267
|
onMouseLeave: this.onMouseLeave,
|
|
262
268
|
onMouseMove: this.onMouseMove,
|
|
263
|
-
ref:
|
|
264
|
-
_this2.input = el;
|
|
265
|
-
},
|
|
269
|
+
ref: this.storeRef,
|
|
266
270
|
style: style
|
|
267
271
|
}), !this.state.curValue ? /*#__PURE__*/React.createElement("div", {
|
|
268
272
|
className: "text-input-placeholder"
|
package/package.json
CHANGED
package/plugins/Editing.js
CHANGED
|
@@ -33,7 +33,6 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
33
33
|
*/
|
|
34
34
|
|
|
35
35
|
import React from 'react';
|
|
36
|
-
import ReactDOM from 'react-dom';
|
|
37
36
|
import { connect } from 'react-redux';
|
|
38
37
|
import { parseNumber } from '@norbulcz/num-parse';
|
|
39
38
|
import dateParser from 'any-date-parser';
|
|
@@ -47,7 +46,6 @@ import { setSnappingConfig } from '../actions/map';
|
|
|
47
46
|
import { setCurrentTask, setCurrentTaskBlocked } from '../actions/task';
|
|
48
47
|
import AttributeForm from '../components/AttributeForm';
|
|
49
48
|
import Icon from '../components/Icon';
|
|
50
|
-
import MeasureSwitcher from '../components/MeasureSwitcher';
|
|
51
49
|
import PickFeature from '../components/PickFeature';
|
|
52
50
|
import { BottomToolPortalContext } from '../components/PluginsContainer';
|
|
53
51
|
import SideBar from '../components/SideBar';
|
|
@@ -643,8 +641,7 @@ var Editing = /*#__PURE__*/function (_React$Component) {
|
|
|
643
641
|
}, {
|
|
644
642
|
key: "render",
|
|
645
643
|
value: function render() {
|
|
646
|
-
var _this3 = this
|
|
647
|
-
_this$props$editConte3;
|
|
644
|
+
var _this3 = this;
|
|
648
645
|
var minMaxTooltip = this.state.minimized ? LocaleUtils.tr("window.maximize") : LocaleUtils.tr("window.minimize");
|
|
649
646
|
var extraTitlebarContent = /*#__PURE__*/React.createElement(Icon, {
|
|
650
647
|
className: "editing-minimize-maximize",
|
|
@@ -678,12 +675,7 @@ var Editing = /*#__PURE__*/function (_React$Component) {
|
|
|
678
675
|
featureFilter: this.pickFilter,
|
|
679
676
|
featurePicked: this.geomPicked,
|
|
680
677
|
key: "FeaturePicker"
|
|
681
|
-
}) : null
|
|
682
|
-
changeMeasureState: this.changeMeasurementState,
|
|
683
|
-
geomType: this.props.editContext.geomType,
|
|
684
|
-
iconSize: "large",
|
|
685
|
-
measureState: this.props.editContext.measurements
|
|
686
|
-
}), this.context) : null];
|
|
678
|
+
}) : null];
|
|
687
679
|
}
|
|
688
680
|
}]);
|
|
689
681
|
}(React.Component);
|
package/plugins/ObliqueView.js
CHANGED
|
@@ -46,26 +46,7 @@ import './style/ObliqueView.css';
|
|
|
46
46
|
/**
|
|
47
47
|
* Display oblique satellite imagery.
|
|
48
48
|
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
* You can configure oblique imagery datasets in the `obliqueDatasets` entry in a QWC theme configuration as follows:
|
|
52
|
-
* ```
|
|
53
|
-
* {
|
|
54
|
-
* ...
|
|
55
|
-
* "obliqueDatasets": [{
|
|
56
|
-
* {
|
|
57
|
-
* "name": "<dataset_name>",
|
|
58
|
-
* "default": <false|true>,
|
|
59
|
-
* "backgroundLayer": "<background_layer_name>",
|
|
60
|
-
* "backgroundOpacity": <0-255>,
|
|
61
|
-
* "title": "<dataset_title>",
|
|
62
|
-
* "titleMsgId": "<dataset_title_msgid>"
|
|
63
|
-
* },
|
|
64
|
-
* ...
|
|
65
|
-
* ]
|
|
66
|
-
* }
|
|
67
|
-
* ```
|
|
68
|
-
* where `dataset_name` is the the name of a dataset configured in the `qwc-oblique-imagery-service`.
|
|
49
|
+
* See [Oblique View](../../topics/ObliqueView).
|
|
69
50
|
*/
|
|
70
51
|
var ObliqueView = /*#__PURE__*/function (_React$Component) {
|
|
71
52
|
function ObliqueView(props) {
|
|
@@ -287,11 +268,11 @@ var ObliqueView = /*#__PURE__*/function (_React$Component) {
|
|
|
287
268
|
this.props.setViewMode(ViewMode._Oblique);
|
|
288
269
|
}
|
|
289
270
|
if (this.props.viewMode === ViewMode._Oblique && this.props.theme && (this.props.theme !== prevProps.theme || prevProps.viewMode !== ViewMode._Oblique)) {
|
|
290
|
-
var _datasets$find$
|
|
271
|
+
var _datasets$find$datase, _datasets$find, _datasets$;
|
|
291
272
|
var datasets = this.props.theme.obliqueDatasets || [];
|
|
292
|
-
var defaultDataset = (_datasets$find$
|
|
273
|
+
var defaultDataset = (_datasets$find$datase = (_datasets$find = datasets.find(function (entry) {
|
|
293
274
|
return entry["default"];
|
|
294
|
-
})) === null || _datasets$find === void 0 ? void 0 : _datasets$find.
|
|
275
|
+
})) === null || _datasets$find === void 0 ? void 0 : _datasets$find.dataset) !== null && _datasets$find$datase !== void 0 ? _datasets$find$datase : (_datasets$ = datasets[0]) === null || _datasets$ === void 0 ? void 0 : _datasets$.dataset;
|
|
295
276
|
this.setState({
|
|
296
277
|
selectedDataset: defaultDataset,
|
|
297
278
|
datasetConfig: null,
|
|
@@ -353,7 +334,7 @@ var ObliqueView = /*#__PURE__*/function (_React$Component) {
|
|
|
353
334
|
active: this.state.viewsLocked
|
|
354
335
|
}];
|
|
355
336
|
var obliqueConfig = (_this$props$theme = this.props.theme) === null || _this$props$theme === void 0 || (_this$props$theme = _this$props$theme.obliqueDatasets) === null || _this$props$theme === void 0 || (_this$props$theme$fin = _this$props$theme.find) === null || _this$props$theme$fin === void 0 ? void 0 : _this$props$theme$fin.call(_this$props$theme, function (entry) {
|
|
356
|
-
return entry.
|
|
337
|
+
return entry.dataset === _this2.state.selectedDataset;
|
|
357
338
|
});
|
|
358
339
|
var basemap = (_this$props$themes = this.props.themes) === null || _this$props$themes === void 0 || (_this$props$themes = _this$props$themes.backgroundLayers) === null || _this$props$themes === void 0 || (_this$props$themes$fi = _this$props$themes.find) === null || _this$props$themes$fi === void 0 ? void 0 : _this$props$themes$fi.call(_this$props$themes, function (entry) {
|
|
359
340
|
return entry.name === (obliqueConfig === null || obliqueConfig === void 0 ? void 0 : obliqueConfig.backgroundLayer);
|
|
@@ -467,9 +448,9 @@ var ObliqueView = /*#__PURE__*/function (_React$Component) {
|
|
|
467
448
|
}, (((_this$props$theme2 = this.props.theme) === null || _this$props$theme2 === void 0 ? void 0 : _this$props$theme2.obliqueDatasets) || []).map(function (entry) {
|
|
468
449
|
var _entry$title;
|
|
469
450
|
return /*#__PURE__*/React.createElement("option", {
|
|
470
|
-
key: entry.
|
|
471
|
-
value: entry.
|
|
472
|
-
}, LocaleUtils.trWithFallback(entry.titleMsgId, (_entry$title = entry.title) !== null && _entry$title !== void 0 ? _entry$title : entry.
|
|
451
|
+
key: entry.dataset,
|
|
452
|
+
value: entry.dataset
|
|
453
|
+
}, LocaleUtils.trWithFallback(entry.titleMsgId, (_entry$title = entry.title) !== null && _entry$title !== void 0 ? _entry$title : entry.dataset));
|
|
473
454
|
})), /*#__PURE__*/React.createElement("span", {
|
|
474
455
|
className: "obliqueview-bottombar-spacer"
|
|
475
456
|
}), this.renderScaleChooser(), /*#__PURE__*/React.createElement("span", {
|
|
@@ -29,11 +29,14 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
31
|
import React from 'react';
|
|
32
|
+
import ReactDOM from 'react-dom';
|
|
32
33
|
import { connect } from 'react-redux';
|
|
33
34
|
import ol from 'openlayers';
|
|
34
35
|
import PropTypes from 'prop-types';
|
|
35
36
|
import { setEditContext } from '../../actions/editing';
|
|
36
37
|
import LocationRecorder from '../../components/LocationRecorder';
|
|
38
|
+
import MeasureSwitcher from '../../components/MeasureSwitcher';
|
|
39
|
+
import { BottomToolPortalContext } from '../../components/PluginsContainer';
|
|
37
40
|
import FeatureStyles from "../../utils/FeatureStyles";
|
|
38
41
|
import MeasureUtils from '../../utils/MeasureUtils';
|
|
39
42
|
|
|
@@ -46,7 +49,19 @@ var EditingSupport = /*#__PURE__*/function (_React$Component) {
|
|
|
46
49
|
_classCallCheck(this, EditingSupport);
|
|
47
50
|
_this = _callSuper(this, EditingSupport, [props]);
|
|
48
51
|
_defineProperty(_this, "state", {
|
|
49
|
-
showRecordLocation: false
|
|
52
|
+
showRecordLocation: false,
|
|
53
|
+
measurements: {
|
|
54
|
+
showmeasurements: false,
|
|
55
|
+
lenUnit: 'metric',
|
|
56
|
+
areaUnit: 'metric'
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
_defineProperty(_this, "changeMeasurementState", function (diff) {
|
|
60
|
+
_this.setState(function (state) {
|
|
61
|
+
return {
|
|
62
|
+
measurements: _objectSpread(_objectSpread({}, state.measurements), diff)
|
|
63
|
+
};
|
|
64
|
+
});
|
|
50
65
|
});
|
|
51
66
|
_defineProperty(_this, "editStyle", function (feature) {
|
|
52
67
|
var geometryFunction = function geometryFunction(f) {
|
|
@@ -69,23 +84,25 @@ var EditingSupport = /*#__PURE__*/function (_React$Component) {
|
|
|
69
84
|
geometryFunction: geometryFunction
|
|
70
85
|
}, _this.props.editContext.vertexStyle))].flat();
|
|
71
86
|
});
|
|
72
|
-
_defineProperty(_this, "
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
87
|
+
_defineProperty(_this, "setCurrentLayer", function () {
|
|
88
|
+
if (!(_this.props.editContext.id in _this.layers)) {
|
|
89
|
+
_this.layers[_this.props.editContext.id] = new ol.layer.Vector({
|
|
90
|
+
source: new ol.source.Vector(),
|
|
91
|
+
zIndex: 1000000,
|
|
92
|
+
style: _this.editStyle
|
|
93
|
+
});
|
|
94
|
+
_this.props.map.addLayer(_this.layers[_this.props.editContext.id]);
|
|
95
|
+
}
|
|
96
|
+
_this.currentLayer = _this.layers[_this.props.editContext.id];
|
|
80
97
|
});
|
|
81
98
|
_defineProperty(_this, "addDrawInteraction", function () {
|
|
82
99
|
_this.reset();
|
|
83
|
-
_this.
|
|
100
|
+
_this.setCurrentLayer();
|
|
84
101
|
var geomType = _this.props.editContext.geomType.replace(/Z$/, '');
|
|
85
102
|
var drawInteraction = new ol.interaction.Draw({
|
|
86
103
|
stopClick: true,
|
|
87
104
|
type: geomType,
|
|
88
|
-
source: _this.
|
|
105
|
+
source: _this.currentLayer.getSource(),
|
|
89
106
|
condition: function condition(event) {
|
|
90
107
|
return event.originalEvent.buttons === 1;
|
|
91
108
|
},
|
|
@@ -111,12 +128,12 @@ var EditingSupport = /*#__PURE__*/function (_React$Component) {
|
|
|
111
128
|
});
|
|
112
129
|
_defineProperty(_this, "addEditInteraction", function () {
|
|
113
130
|
_this.reset();
|
|
114
|
-
_this.
|
|
131
|
+
_this.setCurrentLayer();
|
|
115
132
|
var format = new ol.format.GeoJSON();
|
|
116
133
|
_this.currentFeature = format.readFeature(_this.props.editContext.feature);
|
|
117
134
|
_this.currentFeature.on('change', _this.updateMeasurements);
|
|
118
135
|
_this.updateMeasurements();
|
|
119
|
-
_this.
|
|
136
|
+
_this.currentLayer.getSource().addFeature(_this.currentFeature);
|
|
120
137
|
var modifyInteraction = new ol.interaction.Modify({
|
|
121
138
|
features: new ol.Collection([_this.currentFeature]),
|
|
122
139
|
condition: function condition(event) {
|
|
@@ -139,18 +156,18 @@ var EditingSupport = /*#__PURE__*/function (_React$Component) {
|
|
|
139
156
|
_this.interaction = modifyInteraction;
|
|
140
157
|
});
|
|
141
158
|
_defineProperty(_this, "updateMeasurements", function () {
|
|
142
|
-
var _this$
|
|
159
|
+
var _this$state$measureme;
|
|
143
160
|
if (!_this.currentFeature) {
|
|
144
161
|
return;
|
|
145
|
-
} else if (!((_this$
|
|
162
|
+
} else if (!((_this$state$measureme = _this.state.measurements) !== null && _this$state$measureme !== void 0 && _this$state$measureme.showmeasurements)) {
|
|
146
163
|
_this.currentFeature.set('measurements', undefined);
|
|
147
164
|
_this.currentFeature.set('segment_labels', undefined);
|
|
148
165
|
_this.currentFeature.set('label', undefined);
|
|
149
166
|
} else {
|
|
150
167
|
var settings = {
|
|
151
168
|
displayCrs: _this.props.displayCrs,
|
|
152
|
-
lenUnit: _this.
|
|
153
|
-
areaUnit: _this.
|
|
169
|
+
lenUnit: _this.state.measurements.lenUnit,
|
|
170
|
+
areaUnit: _this.state.measurements.areaUnit
|
|
154
171
|
};
|
|
155
172
|
MeasureUtils.updateFeatureMeasurements(_this.currentFeature, _this.props.editContext.geomType, _this.props.mapCrs, settings);
|
|
156
173
|
}
|
|
@@ -186,67 +203,100 @@ var EditingSupport = /*#__PURE__*/function (_React$Component) {
|
|
|
186
203
|
_this.currentFeature.un('change', _this.updateMeasurements);
|
|
187
204
|
}
|
|
188
205
|
_this.currentFeature = null;
|
|
189
|
-
if (_this.
|
|
190
|
-
_this.props.
|
|
206
|
+
if (_this.layers[_this.props.editContext.id]) {
|
|
207
|
+
_this.layers[_this.props.editContext.id].getSource().clear();
|
|
191
208
|
}
|
|
192
|
-
|
|
209
|
+
});
|
|
210
|
+
_defineProperty(_this, "cleanupLayers", function (prevContexts) {
|
|
211
|
+
var currentContexts = new Set(Object.keys(_this.props.editContexts));
|
|
212
|
+
var removedContexts = Object.keys(prevContexts).filter(function (item) {
|
|
213
|
+
return !currentContexts.has(item);
|
|
214
|
+
});
|
|
215
|
+
removedContexts.forEach(function (id) {
|
|
216
|
+
if (_this.layers[id]) {
|
|
217
|
+
_this.props.map.removeLayer(_this.layers[id]);
|
|
218
|
+
delete _this.layers[id];
|
|
219
|
+
}
|
|
220
|
+
});
|
|
193
221
|
});
|
|
194
222
|
_this.interaction = null;
|
|
195
|
-
_this.
|
|
223
|
+
_this.layers = {};
|
|
224
|
+
_this.currentLayer = null;
|
|
196
225
|
_this.currentFeature = null;
|
|
197
226
|
return _this;
|
|
198
227
|
}
|
|
199
228
|
_inherits(EditingSupport, _React$Component);
|
|
200
229
|
return _createClass(EditingSupport, [{
|
|
201
230
|
key: "componentDidUpdate",
|
|
202
|
-
value: function componentDidUpdate(prevProps) {
|
|
203
|
-
|
|
231
|
+
value: function componentDidUpdate(prevProps, prevState) {
|
|
232
|
+
var curContext = this.props.editContext;
|
|
233
|
+
var prevContext = prevProps.editContext;
|
|
234
|
+
if (curContext === prevContext) {
|
|
204
235
|
// pass
|
|
205
|
-
} else if (
|
|
206
|
-
this.updateMeasurements();
|
|
207
|
-
} else if (this.props.editContext.action === 'Pick' && this.props.editContext.feature) {
|
|
236
|
+
} else if (curContext.action === 'Pick' && curContext.feature) {
|
|
208
237
|
// If a feature without geometry was picked, enter draw mode, otherwise enter edit mode
|
|
209
|
-
if (!
|
|
238
|
+
if (!curContext.feature.geometry && curContext.geomType) {
|
|
210
239
|
this.addDrawInteraction();
|
|
211
240
|
} else {
|
|
212
241
|
this.addEditInteraction();
|
|
213
242
|
}
|
|
214
|
-
} else if (
|
|
243
|
+
} else if (curContext.action === 'Draw' && curContext.geomType) {
|
|
215
244
|
// Usually, draw mode starts without a feature, but draw also can start with a pre-set geometry
|
|
216
|
-
if (!(
|
|
245
|
+
if (!(curContext.feature || {}).geometry || prevContext.id === curContext.id && prevContext.geomType !== curContext.geomType) {
|
|
217
246
|
this.addDrawInteraction();
|
|
218
|
-
} else if ((
|
|
247
|
+
} else if ((curContext.feature || {}).geometry) {
|
|
219
248
|
this.addEditInteraction();
|
|
220
249
|
}
|
|
221
250
|
} else {
|
|
222
251
|
this.reset();
|
|
223
252
|
}
|
|
253
|
+
if (this.state.measurements !== prevState.measurements) {
|
|
254
|
+
this.updateMeasurements();
|
|
255
|
+
}
|
|
256
|
+
if (this.props.editContexts !== prevProps.editContexts) {
|
|
257
|
+
this.cleanupLayers(prevProps.editContexts);
|
|
258
|
+
}
|
|
224
259
|
}
|
|
225
260
|
}, {
|
|
226
261
|
key: "render",
|
|
227
262
|
value: function render() {
|
|
263
|
+
var _this$props$editConte;
|
|
264
|
+
var locationRecorder = null;
|
|
265
|
+
var measureSwitcher = null;
|
|
228
266
|
if (this.state.showRecordLocation && this.props.editContext.geomType) {
|
|
229
267
|
var geomType = this.props.editContext.geomType.replace(/Z$/, '');
|
|
230
|
-
|
|
268
|
+
locationRecorder = /*#__PURE__*/React.createElement(LocationRecorder, {
|
|
231
269
|
drawInteraction: this.interaction,
|
|
232
270
|
geomType: geomType,
|
|
233
271
|
key: "LocationRecorder",
|
|
234
272
|
map: this.props.map
|
|
235
273
|
});
|
|
236
274
|
}
|
|
237
|
-
|
|
275
|
+
if (this.props.editContext.action === "Draw" || (_this$props$editConte = this.props.editContext.feature) !== null && _this$props$editConte !== void 0 && _this$props$editConte.geometry) {
|
|
276
|
+
measureSwitcher = /*#__PURE__*/ReactDOM.createPortal(/*#__PURE__*/React.createElement(MeasureSwitcher, {
|
|
277
|
+
changeMeasureState: this.changeMeasurementState,
|
|
278
|
+
geomType: this.props.editContext.geomType,
|
|
279
|
+
iconSize: "large",
|
|
280
|
+
key: "MeasureSwitcher",
|
|
281
|
+
measureState: this.state.measurements
|
|
282
|
+
}), this.context);
|
|
283
|
+
}
|
|
284
|
+
return [measureSwitcher, locationRecorder];
|
|
238
285
|
}
|
|
239
286
|
}]);
|
|
240
287
|
}(React.Component);
|
|
288
|
+
_defineProperty(EditingSupport, "contextType", BottomToolPortalContext);
|
|
241
289
|
_defineProperty(EditingSupport, "propTypes", {
|
|
242
290
|
displayCrs: PropTypes.string,
|
|
243
291
|
editContext: PropTypes.object,
|
|
292
|
+
editContexts: PropTypes.object,
|
|
244
293
|
map: PropTypes.object,
|
|
245
294
|
mapCrs: PropTypes.string,
|
|
246
295
|
setEditContext: PropTypes.func
|
|
247
296
|
});
|
|
248
297
|
export default connect(function (state) {
|
|
249
298
|
return {
|
|
299
|
+
editContexts: state.editing.contexts,
|
|
250
300
|
editContext: state.editing.contexts[state.editing.currentContext] || {},
|
|
251
301
|
displayCrs: state.map.displayCrs,
|
|
252
302
|
mapCrs: state.map.projection
|
package/reducers/editing.js
CHANGED
|
@@ -44,20 +44,15 @@ export default function editing() {
|
|
|
44
44
|
switch (action.type) {
|
|
45
45
|
case SET_EDIT_CONTEXT:
|
|
46
46
|
{
|
|
47
|
-
var _action$
|
|
48
|
-
var editConfig = (_action$
|
|
47
|
+
var _action$editContext$e, _action$editContext, _state$contexts$actio, _editConfig$permissio2;
|
|
48
|
+
var editConfig = (_action$editContext$e = (_action$editContext = action.editContext) === null || _action$editContext === void 0 ? void 0 : _action$editContext.editConfig) !== null && _action$editContext$e !== void 0 ? _action$editContext$e : (_state$contexts$actio = state.contexts[action.contextId]) === null || _state$contexts$actio === void 0 ? void 0 : _state$contexts$actio.editConfig;
|
|
49
49
|
return {
|
|
50
50
|
contexts: _objectSpread(_objectSpread({}, state.contexts), {}, _defineProperty({}, action.contextId, _objectSpread(_objectSpread(_objectSpread({
|
|
51
51
|
action: null,
|
|
52
52
|
feature: null,
|
|
53
53
|
changed: false,
|
|
54
54
|
mapPrefix: null,
|
|
55
|
-
editConfig: null
|
|
56
|
-
measurements: {
|
|
57
|
-
showmeasurements: false,
|
|
58
|
-
lenUnit: 'metric',
|
|
59
|
-
areaUnit: 'metric'
|
|
60
|
-
}
|
|
55
|
+
editConfig: null
|
|
61
56
|
}, state.contexts[action.contextId]), action.editContext), {}, {
|
|
62
57
|
geomNonZeroZ: checkNonZeroZ(state.contexts[action.contextId], action.editContext),
|
|
63
58
|
geomReadOnly: checkGeomReadOnly(editConfig),
|
package/scripts/themesConfig.js
CHANGED
|
@@ -528,9 +528,6 @@ function getTheme(config, configItem, result, resultItem, proxy) {
|
|
|
528
528
|
resultItem.print = printTemplates;
|
|
529
529
|
}
|
|
530
530
|
resultItem.drawingOrder = drawingOrder;
|
|
531
|
-
if (configItem.extraDxfParameters) {
|
|
532
|
-
resultItem.extraDxfParameters = configItem.extraDxfParameters;
|
|
533
|
-
}
|
|
534
531
|
if (configItem.extraPrintParameters) {
|
|
535
532
|
resultItem.extraPrintParameters = configItem.extraPrintParameters;
|
|
536
533
|
}
|
package/scripts/themesConfig.py
CHANGED
|
@@ -496,8 +496,6 @@ def getTheme(config, configItem, result, resultItem):
|
|
|
496
496
|
if printTemplates:
|
|
497
497
|
resultItem["print"] = printTemplates
|
|
498
498
|
resultItem["drawingOrder"] = drawingOrder
|
|
499
|
-
if "extraDxfParameters" in configItem:
|
|
500
|
-
resultItem["extraDxfParameters"] = configItem["extraDxfParameters"]
|
|
501
499
|
if "extraPrintParameters" in configItem:
|
|
502
500
|
resultItem["extraPrintParameters"] = configItem["extraPrintParameters"]
|
|
503
501
|
extraLegenParams = configItem["extraLegendParameters"] if "extraLegendParameters" in configItem else ""
|
package/utils/LayerUtils.js
CHANGED
|
@@ -1464,37 +1464,37 @@ var LayerUtils = {
|
|
|
1464
1464
|
});
|
|
1465
1465
|
return reports;
|
|
1466
1466
|
},
|
|
1467
|
-
|
|
1468
|
-
var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
1467
|
+
computeVisibilityPreset: function computeVisibilityPreset(layers) {
|
|
1469
1468
|
var result = {};
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1469
|
+
var _collectLayerVisibilities = function collectLayerVisibilities(layer, path) {
|
|
1470
|
+
if (layer.sublayers) {
|
|
1471
|
+
var istoplevel = !!layer.url;
|
|
1472
|
+
layer.sublayers.forEach(function (sublayer) {
|
|
1473
|
+
return _collectLayerVisibilities(sublayer, !istoplevel ? path + layer.name + "/" : "");
|
|
1474
|
+
});
|
|
1475
|
+
if (layer.visibility && !istoplevel) {
|
|
1476
|
+
result[path + layer.name] = "";
|
|
1477
|
+
}
|
|
1478
|
+
} else if (layer.visibility) {
|
|
1479
|
+
result[path + layer.name] = layer.style;
|
|
1477
1480
|
}
|
|
1478
|
-
}
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1481
|
+
};
|
|
1482
|
+
layers.forEach(function (layer) {
|
|
1483
|
+
if (layer.role === LayerRole.THEME) {
|
|
1484
|
+
_collectLayerVisibilities(layer);
|
|
1485
|
+
}
|
|
1486
|
+
});
|
|
1482
1487
|
},
|
|
1483
1488
|
getActiveVisibilityPreset: function getActiveVisibilityPreset(layers, presets) {
|
|
1484
1489
|
if (isEmpty(presets)) {
|
|
1485
1490
|
return null;
|
|
1486
1491
|
}
|
|
1487
|
-
var
|
|
1488
|
-
layers.forEach(function (layer) {
|
|
1489
|
-
if (layer.role === LayerRole.THEME) {
|
|
1490
|
-
Object.assign(result, LayerUtils.computeVisbilityPreset(layer));
|
|
1491
|
-
}
|
|
1492
|
-
});
|
|
1492
|
+
var currentPreset = LayerUtils.computeVisibilityPreset(layers);
|
|
1493
1493
|
for (var _i4 = 0, _Object$entries = Object.entries(presets); _i4 < _Object$entries.length; _i4++) {
|
|
1494
1494
|
var _Object$entries$_i = _slicedToArray(_Object$entries[_i4], 2),
|
|
1495
1495
|
name = _Object$entries$_i[0],
|
|
1496
1496
|
preset = _Object$entries$_i[1];
|
|
1497
|
-
if (isEqual(preset,
|
|
1497
|
+
if (isEqual(preset, currentPreset)) {
|
|
1498
1498
|
return name;
|
|
1499
1499
|
}
|
|
1500
1500
|
}
|
package/utils/PermaLinkUtils.js
CHANGED
|
@@ -296,7 +296,7 @@ export function resolveBookmark(bookmarkKey, callback) {
|
|
|
296
296
|
var data = response.data;
|
|
297
297
|
callback(_objectSpread({}, data.query || {}), data.state || {}, !!data.query);
|
|
298
298
|
})["catch"](function () {
|
|
299
|
-
callback(
|
|
299
|
+
callback({}, {}, false);
|
|
300
300
|
});
|
|
301
301
|
}
|
|
302
302
|
export function getUserBookmarks(user, callback) {
|
|
@@ -428,4 +428,55 @@ export function removeBookmark(bkey, callback) {
|
|
|
428
428
|
return callback(false);
|
|
429
429
|
});
|
|
430
430
|
}
|
|
431
|
+
}
|
|
432
|
+
export function resolveVisibilityPreset(vpKey, callback) {
|
|
433
|
+
axios.get(ConfigUtils.getConfigProp("permalinkServiceUrl").replace(/\/$/, '') + "/visibility_presets/" + vpKey).then(function (response) {
|
|
434
|
+
callback(response.data);
|
|
435
|
+
})["catch"](function () {
|
|
436
|
+
callback(null);
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
export function getVisibilityPresets(callback) {
|
|
440
|
+
var _ConfigUtils$getConfi, _ConfigUtils$getConfi2;
|
|
441
|
+
var permalinkServiceUrl = (_ConfigUtils$getConfi = ConfigUtils.getConfigProp("permalinkServiceUrl")) === null || _ConfigUtils$getConfi === void 0 || (_ConfigUtils$getConfi2 = _ConfigUtils$getConfi.replace) === null || _ConfigUtils$getConfi2 === void 0 ? void 0 : _ConfigUtils$getConfi2.call(_ConfigUtils$getConfi, /\/$/, '');
|
|
442
|
+
axios.get(permalinkServiceUrl + "/visibility_presets/").then(function (response) {
|
|
443
|
+
callback(response.data || []);
|
|
444
|
+
})["catch"](function () {
|
|
445
|
+
callback([]);
|
|
446
|
+
});
|
|
447
|
+
}
|
|
448
|
+
export function storeVisibilityPreset(description, callback) {
|
|
449
|
+
var _ConfigUtils$getConfi3, _ConfigUtils$getConfi4;
|
|
450
|
+
var permalinkServiceUrl = (_ConfigUtils$getConfi3 = ConfigUtils.getConfigProp("permalinkServiceUrl")) === null || _ConfigUtils$getConfi3 === void 0 || (_ConfigUtils$getConfi4 = _ConfigUtils$getConfi3.replace) === null || _ConfigUtils$getConfi4 === void 0 ? void 0 : _ConfigUtils$getConfi4.call(_ConfigUtils$getConfi3, /\/$/, '');
|
|
451
|
+
if (!permalinkServiceUrl) {
|
|
452
|
+
callback(false);
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
var state = StandardApp.store.getState();
|
|
456
|
+
var preset = LayerUtils.computeVisibilityPreset(state.layers.flat);
|
|
457
|
+
axios.post(permalinkServiceUrl + "/visibility_presets/?description=" + description, preset).then(function () {
|
|
458
|
+
return callback(true);
|
|
459
|
+
})["catch"](function () {
|
|
460
|
+
return callback(false);
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
export function updateVisibilityPreset(key, description, callback) {
|
|
464
|
+
var _ConfigUtils$getConfi5, _ConfigUtils$getConfi6;
|
|
465
|
+
var permalinkServiceUrl = (_ConfigUtils$getConfi5 = ConfigUtils.getConfigProp("permalinkServiceUrl")) === null || _ConfigUtils$getConfi5 === void 0 || (_ConfigUtils$getConfi6 = _ConfigUtils$getConfi5.replace) === null || _ConfigUtils$getConfi6 === void 0 ? void 0 : _ConfigUtils$getConfi6.call(_ConfigUtils$getConfi5, /\/$/, '');
|
|
466
|
+
var state = StandardApp.store.getState();
|
|
467
|
+
var preset = LayerUtils.computeVisibilityPreset(state.layers.flat);
|
|
468
|
+
axios.put(permalinkServiceUrl + "/visibility_presets/" + key + "?description=" + description, preset).then(function () {
|
|
469
|
+
return callback(true);
|
|
470
|
+
})["catch"](function () {
|
|
471
|
+
return callback(false);
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
export function removeVisibilityPreset(key, callback) {
|
|
475
|
+
var _ConfigUtils$getConfi7, _ConfigUtils$getConfi8;
|
|
476
|
+
var permalinkServiceUrl = (_ConfigUtils$getConfi7 = ConfigUtils.getConfigProp("permalinkServiceUrl")) === null || _ConfigUtils$getConfi7 === void 0 || (_ConfigUtils$getConfi8 = _ConfigUtils$getConfi7.replace) === null || _ConfigUtils$getConfi8 === void 0 ? void 0 : _ConfigUtils$getConfi8.call(_ConfigUtils$getConfi7, /\/$/, '');
|
|
477
|
+
axios["delete"](permalinkServiceUrl + "/visibility_presets/" + key).then(function () {
|
|
478
|
+
return callback(true);
|
|
479
|
+
})["catch"](function () {
|
|
480
|
+
return callback(false);
|
|
481
|
+
});
|
|
431
482
|
}
|
package/utils/ThemeUtils.js
CHANGED
|
@@ -176,7 +176,7 @@ var ThemeUtils = {
|
|
|
176
176
|
LayerUtils.completeExternalLayer(res[cur.internalLayer], LayerUtils.searchSubLayer(theme, 'name', cur.internalLayer));
|
|
177
177
|
return res;
|
|
178
178
|
}, {})),
|
|
179
|
-
translations: deepmerge(commonTranslations, theme.translations),
|
|
179
|
+
translations: deepmerge(commonTranslations, theme.translations || {}),
|
|
180
180
|
editConfig: theme.editConfig,
|
|
181
181
|
wms_name: theme.wms_name
|
|
182
182
|
};
|