qwc2 2025.10.16 → 2025.10.25
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/locate.js +3 -2
- package/components/AttributeTableWidget.js +24 -15
- package/components/FeatureAttributesWindow.js +178 -0
- package/components/IdentifyViewer.js +80 -39
- package/components/LocationRecorder.js +138 -0
- package/components/NumericInputWindow.js +30 -22
- package/components/PickFeature.js +87 -26
- package/components/PluginsContainer.js +16 -3
- package/components/map/OlLayer.js +2 -1
- package/components/map/layers/MVTLayer.js +3 -0
- package/components/map/layers/VectorLayer.js +66 -65
- package/components/map3d/HeightProfile3D.js +2 -0
- package/components/map3d/drawtool/EditTool3D.js +1 -1
- package/components/style/App.css +14 -0
- package/components/style/AttributeTableWidget.css +1 -1
- package/components/style/FeatureAttributesWindow.css +16 -0
- package/components/style/IdentifyViewer.css +5 -0
- package/components/style/LocationRecorder.css +10 -0
- package/components/style/NumericInputWindow.css +22 -0
- package/components/style/PluginsContainer.css +16 -0
- package/components/widgets/LayerCatalogWidget.js +40 -16
- package/components/widgets/NavBar.js +10 -3
- package/components/widgets/TextInput.js +4 -2
- package/icons/circle_full.svg +75 -0
- package/package.json +1 -1
- package/plugins/AttributeTable.js +4 -0
- package/plugins/GeometryDigitizer.js +3 -0
- package/plugins/HeightProfile.js +5 -1
- package/plugins/Identify.js +7 -3
- package/plugins/ObjectList.js +116 -0
- package/plugins/Redlining.js +21 -56
- package/plugins/map/EditingSupport.js +22 -1
- package/plugins/map/LocateSupport.js +8 -1
- package/plugins/map/RedliningSupport.js +374 -224
- package/plugins/map/SnappingSupport.js +11 -6
- package/plugins/map/style/SnappingSupport.css +2 -13
- package/reducers/locate.js +4 -2
- package/reducers/redlining.js +7 -4
- package/scripts/updateTranslations.js +1 -1
- package/static/translations/bg-BG.json +15 -2
- package/static/translations/ca-ES.json +15 -2
- package/static/translations/cs-CZ.json +15 -2
- package/static/translations/de-CH.json +15 -2
- package/static/translations/de-DE.json +15 -2
- package/static/translations/en-US.json +15 -2
- package/static/translations/es-ES.json +15 -2
- package/static/translations/fi-FI.json +15 -2
- package/static/translations/fr-FR.json +15 -2
- package/static/translations/hu-HU.json +15 -2
- package/static/translations/it-IT.json +15 -2
- package/static/translations/ja-JP.json +15 -2
- package/static/translations/nl-NL.json +15 -2
- package/static/translations/no-NO.json +15 -2
- package/static/translations/pl-PL.json +15 -2
- package/static/translations/pt-BR.json +15 -2
- package/static/translations/pt-PT.json +15 -2
- package/static/translations/ro-RO.json +15 -2
- package/static/translations/ru-RU.json +15 -2
- package/static/translations/sv-SE.json +15 -2
- package/static/translations/tr-TR.json +15 -2
- package/static/translations/tsconfig.json +12 -2
- package/static/translations/uk-UA.json +15 -2
- package/utils/EditingInterface.js +18 -4
- package/utils/EditingUtils.js +3 -1
- package/utils/LayerUtils.js +16 -6
- package/utils/MiscUtils.js +65 -0
- package/utils/expr_grammar/grammar.js +104 -22
- package/utils/expr_grammar/grammar.ne +2 -0
- package/utils/expr_grammar/test.js +21 -4
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
3
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
4
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
5
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
6
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
7
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
8
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
9
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
10
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
11
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
12
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
13
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
14
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
15
|
+
/**
|
|
16
|
+
* Copyright 2015 Sourcepole AG
|
|
17
|
+
* All rights reserved.
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the BSD-style license found in the
|
|
20
|
+
* LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import React from 'react';
|
|
24
|
+
import ReactDOM from 'react-dom';
|
|
25
|
+
import { connect } from 'react-redux';
|
|
26
|
+
import classNames from 'classnames';
|
|
27
|
+
import PropTypes from 'prop-types';
|
|
28
|
+
import LocaleUtils from '../utils/LocaleUtils';
|
|
29
|
+
import Icon from './Icon';
|
|
30
|
+
import { BottomToolPortalContext } from './PluginsContainer';
|
|
31
|
+
import NumberInput from './widgets/NumberInput';
|
|
32
|
+
import './style/LocationRecorder.css';
|
|
33
|
+
var LocationRecorder = /*#__PURE__*/function (_React$Component) {
|
|
34
|
+
function LocationRecorder(props) {
|
|
35
|
+
var _this;
|
|
36
|
+
_classCallCheck(this, LocationRecorder);
|
|
37
|
+
_this = _callSuper(this, LocationRecorder, [props]);
|
|
38
|
+
_defineProperty(_this, "state", {
|
|
39
|
+
recording: false,
|
|
40
|
+
interval: 1
|
|
41
|
+
});
|
|
42
|
+
_defineProperty(_this, "toggleRecording", function () {
|
|
43
|
+
if (_this.state.recording) {
|
|
44
|
+
_this.stopRecording();
|
|
45
|
+
} else {
|
|
46
|
+
_this.props.drawInteraction.abortDrawing();
|
|
47
|
+
_this.props.drawInteraction.setActive(false);
|
|
48
|
+
// Re-add overlay to map, removed by setActive(false), to ensure traced feature is visibile
|
|
49
|
+
_this.props.drawInteraction.getOverlay().setMap(_this.props.map);
|
|
50
|
+
_this.setState({
|
|
51
|
+
recording: true
|
|
52
|
+
});
|
|
53
|
+
if (!navigator.geolocation) {
|
|
54
|
+
_this.stopRecording();
|
|
55
|
+
/* eslint-disable-next-line */
|
|
56
|
+
console.error("Geolocation not supported");
|
|
57
|
+
} else {
|
|
58
|
+
_this.props.drawInteraction.appendCoordinates([_this.props.locatePosition]);
|
|
59
|
+
if (_this.props.geomType === "Point") {
|
|
60
|
+
_this.stopRecording();
|
|
61
|
+
} else {
|
|
62
|
+
_this.pollInterval = setInterval(function () {
|
|
63
|
+
_this.props.drawInteraction.appendCoordinates([_this.props.locatePosition]);
|
|
64
|
+
}, _this.state.interval * 1000);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
_defineProperty(_this, "stopRecording", function () {
|
|
70
|
+
_this.setState({
|
|
71
|
+
recording: false
|
|
72
|
+
}, _this.finishDrawing);
|
|
73
|
+
clearInterval(_this.pollInterval);
|
|
74
|
+
});
|
|
75
|
+
_defineProperty(_this, "finishDrawing", function () {
|
|
76
|
+
_this.props.drawInteraction.finishDrawing();
|
|
77
|
+
_this.props.drawInteraction.setActive(true);
|
|
78
|
+
});
|
|
79
|
+
_this.pollInterval = null;
|
|
80
|
+
return _this;
|
|
81
|
+
}
|
|
82
|
+
_inherits(LocationRecorder, _React$Component);
|
|
83
|
+
return _createClass(LocationRecorder, [{
|
|
84
|
+
key: "componentWillUnmount",
|
|
85
|
+
value: function componentWillUnmount() {
|
|
86
|
+
this.stopRecording();
|
|
87
|
+
}
|
|
88
|
+
}, {
|
|
89
|
+
key: "render",
|
|
90
|
+
value: function render() {
|
|
91
|
+
var _this2 = this;
|
|
92
|
+
if (!this.props.locateEnabled || !this.props.locatePosition) {
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
var buttonClasses = classNames({
|
|
96
|
+
button: true,
|
|
97
|
+
pressed: this.state.recording
|
|
98
|
+
});
|
|
99
|
+
return /*#__PURE__*/ReactDOM.createPortal(/*#__PURE__*/React.createElement("div", {
|
|
100
|
+
className: "LocationRecorder"
|
|
101
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
102
|
+
icon: "screenshot"
|
|
103
|
+
}), /*#__PURE__*/React.createElement("button", {
|
|
104
|
+
className: buttonClasses,
|
|
105
|
+
onClick: this.toggleRecording
|
|
106
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
107
|
+
icon: this.state.recording ? "square" : "circle_full"
|
|
108
|
+
}), /*#__PURE__*/React.createElement("span", null, this.state.recording ? LocaleUtils.tr("locationrecorder.stop") : LocaleUtils.tr("locationrecorder.record"))), /*#__PURE__*/React.createElement(NumberInput, {
|
|
109
|
+
decimals: 1,
|
|
110
|
+
max: 30,
|
|
111
|
+
min: 0.5,
|
|
112
|
+
mobile: true,
|
|
113
|
+
onChange: function onChange(value) {
|
|
114
|
+
return _this2.setState({
|
|
115
|
+
interval: value
|
|
116
|
+
});
|
|
117
|
+
},
|
|
118
|
+
step: 0.5,
|
|
119
|
+
suffix: "s",
|
|
120
|
+
value: this.state.interval
|
|
121
|
+
})), this.context);
|
|
122
|
+
}
|
|
123
|
+
}]);
|
|
124
|
+
}(React.Component);
|
|
125
|
+
_defineProperty(LocationRecorder, "contextType", BottomToolPortalContext);
|
|
126
|
+
_defineProperty(LocationRecorder, "propTypes", {
|
|
127
|
+
drawInteraction: PropTypes.object,
|
|
128
|
+
geomType: PropTypes.string,
|
|
129
|
+
locateEnabled: PropTypes.bool,
|
|
130
|
+
locatePosition: PropTypes.array,
|
|
131
|
+
map: PropTypes.object
|
|
132
|
+
});
|
|
133
|
+
export default connect(function (state) {
|
|
134
|
+
return {
|
|
135
|
+
locateEnabled: ["ENABLED", "FOLLOWING"].includes(state.locate.state),
|
|
136
|
+
locatePosition: state.locate.mapPos
|
|
137
|
+
};
|
|
138
|
+
})(LocationRecorder);
|
|
@@ -68,6 +68,7 @@ var NumericInputWindow = /*#__PURE__*/function (_React$Component) {
|
|
|
68
68
|
onChange: function onChange(text) {
|
|
69
69
|
return _this.onValueChanged(text, decimals, _onChange);
|
|
70
70
|
},
|
|
71
|
+
showClear: false,
|
|
71
72
|
value: value
|
|
72
73
|
});
|
|
73
74
|
});
|
|
@@ -79,6 +80,7 @@ var NumericInputWindow = /*#__PURE__*/function (_React$Component) {
|
|
|
79
80
|
onChange: function onChange(text) {
|
|
80
81
|
return _this.onValueChanged(text, decimals, _onChange2);
|
|
81
82
|
},
|
|
83
|
+
showClear: false,
|
|
82
84
|
value: value
|
|
83
85
|
});
|
|
84
86
|
});
|
|
@@ -91,9 +93,9 @@ var NumericInputWindow = /*#__PURE__*/function (_React$Component) {
|
|
|
91
93
|
});
|
|
92
94
|
_defineProperty(_this, "renderPointInputForm", function () {
|
|
93
95
|
var coordinates = _this.state.geometry.coordinates;
|
|
94
|
-
return /*#__PURE__*/React.createElement("table", null, /*#__PURE__*/React.createElement("tbody", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, "x
|
|
96
|
+
return /*#__PURE__*/React.createElement("table", null, /*#__PURE__*/React.createElement("tbody", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("span", null, "x")), /*#__PURE__*/React.createElement("td", null, _this.renderOrdinateInput(coordinates[0], function (value) {
|
|
95
97
|
return _this.updatePoint(value, 0);
|
|
96
|
-
})), /*#__PURE__*/React.createElement("td", null, "y
|
|
98
|
+
})), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("span", null, "y")), /*#__PURE__*/React.createElement("td", null, _this.renderOrdinateInput(coordinates[1], function (value) {
|
|
97
99
|
return _this.updatePoint(value, 1);
|
|
98
100
|
})))));
|
|
99
101
|
});
|
|
@@ -116,27 +118,33 @@ var NumericInputWindow = /*#__PURE__*/function (_React$Component) {
|
|
|
116
118
|
onMouseLeave: function onMouseLeave() {
|
|
117
119
|
return _this.clearListCoordinateHighlight(idx);
|
|
118
120
|
}
|
|
119
|
-
}, /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement(
|
|
120
|
-
|
|
121
|
+
}, /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("button", {
|
|
122
|
+
className: "button",
|
|
121
123
|
onClick: function onClick() {
|
|
122
124
|
return _this.insertCoordinate(idx);
|
|
123
125
|
}
|
|
124
|
-
}
|
|
126
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
127
|
+
icon: "plus"
|
|
128
|
+
}))), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("span", null, "x")), /*#__PURE__*/React.createElement("td", null, _this.renderOrdinateInput(coordinates[idx][0], function (value) {
|
|
125
129
|
return _this.updateListCoordinate(value, idx, 0);
|
|
126
|
-
})), /*#__PURE__*/React.createElement("td", null, "y
|
|
130
|
+
})), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("span", null, "y")), /*#__PURE__*/React.createElement("td", null, _this.renderOrdinateInput(coordinates[idx][1], function (value) {
|
|
127
131
|
return _this.updateListCoordinate(value, idx, 1);
|
|
128
|
-
})), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement(
|
|
129
|
-
|
|
132
|
+
})), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("button", {
|
|
133
|
+
className: "button",
|
|
130
134
|
onClick: function onClick() {
|
|
131
135
|
return _this.removeCoordinate(idx);
|
|
132
136
|
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
|
|
137
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
138
|
+
icon: "trash"
|
|
139
|
+
}))));
|
|
140
|
+
}), /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("button", {
|
|
141
|
+
className: "button",
|
|
136
142
|
onClick: function onClick() {
|
|
137
143
|
return _this.insertCoordinate(coordinates.length);
|
|
138
144
|
}
|
|
139
|
-
}
|
|
145
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
146
|
+
icon: "plus"
|
|
147
|
+
}))), /*#__PURE__*/React.createElement("td", {
|
|
140
148
|
colSpan: "5"
|
|
141
149
|
}))));
|
|
142
150
|
});
|
|
@@ -219,11 +227,11 @@ var NumericInputWindow = /*#__PURE__*/function (_React$Component) {
|
|
|
219
227
|
_defineProperty(_this, "renderCircleInputForm", function () {
|
|
220
228
|
var circleParams = _this.state.feature.circleParams;
|
|
221
229
|
var center = CoordinatesUtils.reproject(circleParams.center, _this.props.mapCrs, _this.state.displayCrs);
|
|
222
|
-
return /*#__PURE__*/React.createElement("table", null, /*#__PURE__*/React.createElement("tbody", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, "x
|
|
230
|
+
return /*#__PURE__*/React.createElement("table", null, /*#__PURE__*/React.createElement("tbody", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("span", null, "x")), /*#__PURE__*/React.createElement("td", null, _this.renderOrdinateInput(center[0], function (value) {
|
|
223
231
|
return _this.updateCircle(value, center[1], circleParams.radius);
|
|
224
|
-
}))), /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, "y
|
|
232
|
+
}))), /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("span", null, "y")), /*#__PURE__*/React.createElement("td", null, _this.renderOrdinateInput(center[1], function (value) {
|
|
225
233
|
return _this.updateCircle(center[0], value, circleParams.radius);
|
|
226
|
-
}))), /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, "r
|
|
234
|
+
}))), /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("span", null, "r")), /*#__PURE__*/React.createElement("td", null, _this.renderMeasureInput(circleParams.radius, function (value) {
|
|
227
235
|
return _this.updateCircle(center[0], center[1], value);
|
|
228
236
|
})))));
|
|
229
237
|
});
|
|
@@ -254,21 +262,21 @@ var NumericInputWindow = /*#__PURE__*/function (_React$Component) {
|
|
|
254
262
|
d2y = Math.abs(coordinates[2][1] - coordinates[1][1]);
|
|
255
263
|
h = Math.sqrt(d2x * d2x + d2y * d2y);
|
|
256
264
|
}
|
|
257
|
-
return /*#__PURE__*/React.createElement("table", null, /*#__PURE__*/React.createElement("tbody", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, "x
|
|
265
|
+
return /*#__PURE__*/React.createElement("table", null, /*#__PURE__*/React.createElement("tbody", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("span", null, "x")), /*#__PURE__*/React.createElement("td", null, _this.renderOrdinateInput(x, function (value) {
|
|
258
266
|
return _this.updateBox(value, y, w, h, r);
|
|
259
|
-
}))), /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, "y
|
|
267
|
+
}))), /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("span", null, "y")), /*#__PURE__*/React.createElement("td", null, _this.renderOrdinateInput(y, function (value) {
|
|
260
268
|
return _this.updateBox(x, value, w, h, r);
|
|
261
269
|
}))), shape === "Box" ? [/*#__PURE__*/React.createElement("tr", {
|
|
262
270
|
key: "w"
|
|
263
|
-
}, /*#__PURE__*/React.createElement("td", null, LocaleUtils.tr("numericinput.width")
|
|
271
|
+
}, /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("span", null, LocaleUtils.tr("numericinput.width"))), /*#__PURE__*/React.createElement("td", null, _this.renderMeasureInput(w, function (value) {
|
|
264
272
|
return _this.updateBox(x, y, value, h, r);
|
|
265
273
|
}))), /*#__PURE__*/React.createElement("tr", {
|
|
266
274
|
key: "h"
|
|
267
|
-
}, /*#__PURE__*/React.createElement("td", null, LocaleUtils.tr("numericinput.height")
|
|
275
|
+
}, /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("span", null, LocaleUtils.tr("numericinput.height"))), /*#__PURE__*/React.createElement("td", null, _this.renderMeasureInput(h, function (value) {
|
|
268
276
|
return _this.updateBox(x, y, w, value, r);
|
|
269
|
-
})))] : /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, LocaleUtils.tr("numericinput.side")
|
|
277
|
+
})))] : /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("span", null, LocaleUtils.tr("numericinput.side"))), /*#__PURE__*/React.createElement("td", null, _this.renderMeasureInput(w, function (value) {
|
|
270
278
|
return _this.updateBox(x, y, value, value, r);
|
|
271
|
-
}))), /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, LocaleUtils.tr("numericinput.angle")
|
|
279
|
+
}))), /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("span", null, LocaleUtils.tr("numericinput.angle"))), /*#__PURE__*/React.createElement("td", null, _this.renderMeasureInput(r, function (value) {
|
|
272
280
|
return _this.updateBox(x, y, w, h, value);
|
|
273
281
|
}, 1)))));
|
|
274
282
|
});
|
|
@@ -310,7 +318,7 @@ var NumericInputWindow = /*#__PURE__*/function (_React$Component) {
|
|
|
310
318
|
};
|
|
311
319
|
var body = null;
|
|
312
320
|
if (!this.state.geometry) {
|
|
313
|
-
body = /*#__PURE__*/React.createElement("span", null, LocaleUtils.tr("numericinput.
|
|
321
|
+
body = /*#__PURE__*/React.createElement("span", null, LocaleUtils.tr("numericinput.nofeatureormultiple"));
|
|
314
322
|
} else if (shapeInputForms[this.state.feature.shape]) {
|
|
315
323
|
body = shapeInputForms[this.state.feature.shape]();
|
|
316
324
|
} else {
|
|
@@ -31,6 +31,9 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
31
31
|
import React from 'react';
|
|
32
32
|
import { connect } from 'react-redux';
|
|
33
33
|
import isEmpty from 'lodash.isempty';
|
|
34
|
+
import ol from 'openlayers';
|
|
35
|
+
import pointInPolygon from 'point-in-polygon';
|
|
36
|
+
import polygonIntersectTest from 'polygon-intersect-test';
|
|
34
37
|
import PropTypes from 'prop-types';
|
|
35
38
|
import { v4 as uuidv4 } from 'uuid';
|
|
36
39
|
import { LayerRole, addLayerFeatures, clearLayer } from '../actions/layers';
|
|
@@ -121,29 +124,40 @@ var PickFeature = /*#__PURE__*/function (_React$Component) {
|
|
|
121
124
|
value: function componentDidUpdate(prevProps, prevState) {
|
|
122
125
|
var _this2 = this;
|
|
123
126
|
if (this.state.pickGeom && this.state.pickGeom !== prevState.pickGeom) {
|
|
124
|
-
var
|
|
127
|
+
var queryWmsLayers = [];
|
|
128
|
+
var queryVectorLayers = [];
|
|
125
129
|
if (this.props.layerFilter) {
|
|
126
|
-
|
|
130
|
+
queryWmsLayers = [this.props.layers.find(function (l) {
|
|
127
131
|
return l.url === _this2.props.layerFilter.url;
|
|
128
132
|
})].filter(Boolean);
|
|
129
133
|
} else {
|
|
130
|
-
|
|
134
|
+
queryWmsLayers = IdentifyUtils.getQueryLayers(this.props.layers, this.props.map);
|
|
135
|
+
queryVectorLayers = this.props.layers.filter(function (layer) {
|
|
136
|
+
return layer.visibility && LayerRole.USERLAYER && (layer.type === 'vector' || layer.type === 'wfs');
|
|
137
|
+
});
|
|
131
138
|
}
|
|
132
|
-
if (
|
|
133
|
-
this.
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
139
|
+
if (this.props.layerFilterFunc) {
|
|
140
|
+
queryWmsLayers = queryWmsLayers.filter(this.props.layerFilterFunc);
|
|
141
|
+
queryVectorLayers = queryVectorLayers.filter(this.props.layerFilterFunc);
|
|
142
|
+
}
|
|
143
|
+
if (isEmpty(queryWmsLayers) && isEmpty(queryVectorLayers)) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
this.setState(function (state) {
|
|
147
|
+
var coordinates = _this2.props.pickGeomType === "Point" ? [[state.pickGeom.coordinates]] : state.pickGeom.coordinates;
|
|
148
|
+
var maxX = coordinates[0][0][0];
|
|
149
|
+
var maxY = coordinates[0][0][1];
|
|
150
|
+
for (var i = 1; i < coordinates[0].length; ++i) {
|
|
151
|
+
if (coordinates[0][i][0] > maxX) {
|
|
152
|
+
maxX = coordinates[0][i][0];
|
|
153
|
+
maxY = coordinates[0][i][1];
|
|
143
154
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
155
|
+
}
|
|
156
|
+
var reqId = uuidv4();
|
|
157
|
+
var getPixelFromCoordinate = MapUtils.getHook(MapUtils.GET_PIXEL_FROM_COORDINATES_HOOK);
|
|
158
|
+
var clickPos = getPixelFromCoordinate([maxX, maxY], false);
|
|
159
|
+
if (!isEmpty(queryWmsLayers)) {
|
|
160
|
+
queryWmsLayers.forEach(function (layer) {
|
|
147
161
|
var request = null;
|
|
148
162
|
if (_this2.props.pickGeomType === 'Point') {
|
|
149
163
|
var _this2$props$layerFil;
|
|
@@ -159,14 +173,58 @@ var PickFeature = /*#__PURE__*/function (_React$Component) {
|
|
|
159
173
|
return _this2.handleIdentifyResponse(response, reqId, layer, request.params.info_format);
|
|
160
174
|
});
|
|
161
175
|
});
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
176
|
+
}
|
|
177
|
+
var pickResults = {};
|
|
178
|
+
if (!isEmpty(queryVectorLayers)) {
|
|
179
|
+
var olMap = MapUtils.getHook(MapUtils.GET_MAP);
|
|
180
|
+
var layerMap = queryVectorLayers.reduce(function (res, layer) {
|
|
181
|
+
return _objectSpread(_objectSpread({}, res), {}, _defineProperty({}, layer.id, layer));
|
|
182
|
+
}, {});
|
|
183
|
+
var format = new ol.format.GeoJSON();
|
|
184
|
+
if (_this2.props.pickGeomType === 'Point') {
|
|
185
|
+
olMap.forEachFeatureAtPixel(clickPos, function (feature, layer) {
|
|
186
|
+
var _layer$get;
|
|
187
|
+
var layerid = layer === null || layer === void 0 || (_layer$get = layer.get) === null || _layer$get === void 0 ? void 0 : _layer$get.call(layer, 'id');
|
|
188
|
+
if (layerid in layerMap) {
|
|
189
|
+
var featureObj = format.writeFeatureObject(feature);
|
|
190
|
+
var layername = layerMap[layerid].name;
|
|
191
|
+
pickResults[layername] = pickResults[layername] || [];
|
|
192
|
+
pickResults[layername].push(featureObj);
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
} else if (_this2.props.pickGeomType === 'Polygon') {
|
|
196
|
+
var extent = ol.extent.boundingExtent(coordinates[0]);
|
|
197
|
+
olMap.getLayers().forEach(function (layer) {
|
|
198
|
+
if (!(layer.get('id') in layerMap)) {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
layer.getSource().forEachFeatureIntersectingExtent(extent, function (feature) {
|
|
202
|
+
var intersects = false;
|
|
203
|
+
if (feature.getGeometry().getType() === "Point") {
|
|
204
|
+
intersects = pointInPolygon(feature.getGeometry().getCoordinates(), coordinates[0]);
|
|
205
|
+
} else if (feature.getGeometry().getType() === "LineString") {
|
|
206
|
+
intersects = true; // TODO
|
|
207
|
+
} else if (feature.getGeometry().getType() === "Polygon") {
|
|
208
|
+
intersects = polygonIntersectTest(feature.getGeometry().getCoordinates()[0], coordinates[0]);
|
|
209
|
+
}
|
|
210
|
+
if (!intersects) {
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
var featureObj = format.writeFeatureObject(feature);
|
|
214
|
+
var layername = layerMap[layer.get('id')].name;
|
|
215
|
+
pickResults[layername] = pickResults[layername] || [];
|
|
216
|
+
pickResults[layername].push(featureObj);
|
|
217
|
+
});
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
return {
|
|
222
|
+
pickResults: pickResults,
|
|
223
|
+
clickPos: clickPos,
|
|
224
|
+
pendingQueries: queryWmsLayers.length,
|
|
225
|
+
reqId: reqId
|
|
226
|
+
};
|
|
227
|
+
});
|
|
170
228
|
}
|
|
171
229
|
}
|
|
172
230
|
}, {
|
|
@@ -186,6 +244,7 @@ var PickFeature = /*#__PURE__*/function (_React$Component) {
|
|
|
186
244
|
layername = _ref6[0],
|
|
187
245
|
features = _ref6[1];
|
|
188
246
|
return features.map(function (feature) {
|
|
247
|
+
var _feature$displayname;
|
|
189
248
|
return /*#__PURE__*/React.createElement("div", {
|
|
190
249
|
key: layername + ":" + feature.id,
|
|
191
250
|
onClickCapture: function onClickCapture() {
|
|
@@ -197,7 +256,7 @@ var PickFeature = /*#__PURE__*/function (_React$Component) {
|
|
|
197
256
|
onMouseOver: function onMouseOver() {
|
|
198
257
|
return _this3.highlightFeature(layername, feature);
|
|
199
258
|
}
|
|
200
|
-
}, layername + ": " + feature.displayname);
|
|
259
|
+
}, layername + ": " + ((_feature$displayname = feature.displayname) !== null && _feature$displayname !== void 0 ? _feature$displayname : feature.id));
|
|
201
260
|
});
|
|
202
261
|
}) : /*#__PURE__*/React.createElement("div", {
|
|
203
262
|
className: "pick-feature-menu-querying"
|
|
@@ -240,6 +299,8 @@ _defineProperty(PickFeature, "propTypes", {
|
|
|
240
299
|
url: PropTypes.string,
|
|
241
300
|
name: PropTypes.string
|
|
242
301
|
}),
|
|
302
|
+
/** Optional: Filter function to restrict pick layers */
|
|
303
|
+
layerFilterFunc: PropTypes.func,
|
|
243
304
|
layers: PropTypes.array,
|
|
244
305
|
map: PropTypes.object,
|
|
245
306
|
/** Pick geometry type: Point, Polygon, ... (default: Point) */
|
|
@@ -40,6 +40,7 @@ import './style/PluginsContainer.css';
|
|
|
40
40
|
export var MapButtonPortalContext = /*#__PURE__*/React.createContext(null);
|
|
41
41
|
export var MapContainerPortalContext = /*#__PURE__*/React.createContext(null);
|
|
42
42
|
export var AppInfosPortalContext = /*#__PURE__*/React.createContext(null);
|
|
43
|
+
export var BottomToolPortalContext = /*#__PURE__*/React.createContext(null);
|
|
43
44
|
var PluginsContainer = /*#__PURE__*/function (_React$Component) {
|
|
44
45
|
function PluginsContainer() {
|
|
45
46
|
var _this;
|
|
@@ -51,7 +52,8 @@ var PluginsContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
51
52
|
_defineProperty(_this, "state", {
|
|
52
53
|
mapButtonsContainerRef: null,
|
|
53
54
|
mapContainerRef: null,
|
|
54
|
-
appInfosContainerRef: null
|
|
55
|
+
appInfosContainerRef: null,
|
|
56
|
+
bottomToolContainerRef: null
|
|
55
57
|
});
|
|
56
58
|
_defineProperty(_this, "renderPlugins", function () {
|
|
57
59
|
var device = ConfigUtils.isMobile() ? 'mobile' : 'desktop';
|
|
@@ -134,6 +136,11 @@ var PluginsContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
134
136
|
appInfosContainerRef: el
|
|
135
137
|
});
|
|
136
138
|
});
|
|
139
|
+
_defineProperty(_this, "setBottomToolContanerRef", function (el) {
|
|
140
|
+
_this.setState({
|
|
141
|
+
bottomToolContainerRef: el
|
|
142
|
+
});
|
|
143
|
+
});
|
|
137
144
|
_defineProperty(_this, "setButtonContainerRef", function (el) {
|
|
138
145
|
_this.setState({
|
|
139
146
|
mapButtonsContainerRef: el
|
|
@@ -190,7 +197,7 @@ var PluginsContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
190
197
|
right: 'calc(' + right + 'px)',
|
|
191
198
|
bottom: 'calc(var(--bottombar-height) + ' + bottom + 'px)'
|
|
192
199
|
};
|
|
193
|
-
var haveRefs = this.state.mapButtonsContainerRef && this.state.mapContainerRef && this.state.appInfosContainerRef;
|
|
200
|
+
var haveRefs = this.state.mapButtonsContainerRef && this.state.mapContainerRef && this.state.appInfosContainerRef && this.state.bottomToolContainerRef;
|
|
194
201
|
return /*#__PURE__*/React.createElement("div", {
|
|
195
202
|
className: "plugins-container " + ((_this$props$className = this.props.className) !== null && _this$props$className !== void 0 ? _this$props$className : ""),
|
|
196
203
|
ref: this.setupTouchEvents
|
|
@@ -200,7 +207,9 @@ var PluginsContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
200
207
|
value: this.state.mapButtonsContainerRef
|
|
201
208
|
}, /*#__PURE__*/React.createElement(MapContainerPortalContext.Provider, {
|
|
202
209
|
value: this.state.mapContainerRef
|
|
203
|
-
},
|
|
210
|
+
}, /*#__PURE__*/React.createElement(BottomToolPortalContext.Provider, {
|
|
211
|
+
value: this.state.bottomToolContainerRef
|
|
212
|
+
}, haveRefs ? this.renderPlugins() : null, haveRefs ? this.props.children : null)))), /*#__PURE__*/React.createElement(WindowManager, null), /*#__PURE__*/React.createElement("div", {
|
|
204
213
|
className: "map-container",
|
|
205
214
|
ref: this.setMapContainerRef,
|
|
206
215
|
style: mapContainerStyle
|
|
@@ -212,6 +221,10 @@ var PluginsContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
212
221
|
className: "app-infos-container",
|
|
213
222
|
ref: this.setAppInfosContainerRef,
|
|
214
223
|
style: mapContainerStyle
|
|
224
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
225
|
+
className: "map-bottom-tool-container",
|
|
226
|
+
ref: this.setBottomToolContanerRef,
|
|
227
|
+
style: mapContainerStyle
|
|
215
228
|
}));
|
|
216
229
|
}
|
|
217
230
|
}]);
|
|
@@ -252,7 +252,8 @@ _defineProperty(OlLayer, "propTypes", {
|
|
|
252
252
|
refreshLayer: PropTypes.func,
|
|
253
253
|
setLayerLoading: PropTypes.func,
|
|
254
254
|
swipe: PropTypes.number,
|
|
255
|
-
zIndex: PropTypes.number
|
|
255
|
+
zIndex: PropTypes.number,
|
|
256
|
+
zoomToExtent: PropTypes.func
|
|
256
257
|
});
|
|
257
258
|
export default connect(function () {
|
|
258
259
|
return {};
|
|
@@ -43,6 +43,9 @@ export default {
|
|
|
43
43
|
var layer = createLayer();
|
|
44
44
|
applyStyle(layer, glStyle, styleSource, options.styleOptions).then(function () {
|
|
45
45
|
group.getLayers().push(layer);
|
|
46
|
+
})["catch"](function (e) {
|
|
47
|
+
/* eslint-disable-next-line */
|
|
48
|
+
console.warn("Unable to apply style " + options.style + ": " + String(e));
|
|
46
49
|
});
|
|
47
50
|
});
|
|
48
51
|
})["catch"](function (e) {
|