qwc2 2026.5.6 → 2026.5.10
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/icons/label.svg +77 -0
- package/package.json +1 -1
- package/plugins/MapExport.js +1 -1
- package/plugins/Redlining.js +3 -2
- package/plugins/map/RedliningSupport.js +10 -7
- package/plugins/redlining/RedliningFeatureLabelSupport.js +261 -0
- package/plugins/style/Redlining.css +4 -1
- package/static/translations/bg-BG.json +3 -0
- package/static/translations/ca-ES.json +3 -0
- package/static/translations/cs-CZ.json +3 -0
- package/static/translations/de-CH.json +3 -0
- package/static/translations/de-DE.json +3 -0
- package/static/translations/en-US.json +3 -0
- package/static/translations/es-ES.json +3 -0
- package/static/translations/fi-FI.json +3 -0
- package/static/translations/fr-FR.json +3 -0
- package/static/translations/hu-HU.json +3 -0
- package/static/translations/it-IT.json +3 -0
- package/static/translations/ja-JP.json +3 -0
- package/static/translations/nl-NL.json +3 -0
- package/static/translations/no-NO.json +3 -0
- package/static/translations/pl-PL.json +3 -0
- package/static/translations/pt-BR.json +3 -0
- package/static/translations/pt-PT.json +3 -0
- package/static/translations/ro-RO.json +3 -0
- package/static/translations/ru-RU.json +3 -0
- package/static/translations/sv-SE.json +3 -0
- package/static/translations/tr-TR.json +3 -0
- package/static/translations/tsconfig.json +3 -0
- package/static/translations/uk-UA.json +3 -0
- package/utils/CoordinatesUtils.js +8 -0
- package/utils/EditingInterface.js +1 -1
- package/utils/EditingUtils.js +50 -0
- package/utils/FeatureStyles.js +31 -0
- package/utils/MiscUtils.js +10 -0
- package/utils/ThemeUtils.js +1 -0
- package/utils/VectorLayerUtils.js +68 -21
- package/utils/expr_grammar/grammar.js +75 -23
- package/utils/expr_grammar/grammar.ne +1 -0
package/icons/label.svg
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<svg
|
|
3
|
+
width="24"
|
|
4
|
+
height="24"
|
|
5
|
+
viewBox="0 0 24 24"
|
|
6
|
+
version="1.1"
|
|
7
|
+
id="svg8"
|
|
8
|
+
inkscape:version="1.4.3 (0d15f75042, 2025-12-25)"
|
|
9
|
+
sodipodi:docname="label.svg"
|
|
10
|
+
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
|
11
|
+
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
|
12
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
13
|
+
xmlns:svg="http://www.w3.org/2000/svg"
|
|
14
|
+
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
|
15
|
+
xmlns:cc="http://creativecommons.org/ns#"
|
|
16
|
+
xmlns:dc="http://purl.org/dc/elements/1.1/">
|
|
17
|
+
<defs
|
|
18
|
+
id="defs2" />
|
|
19
|
+
<sodipodi:namedview
|
|
20
|
+
id="base"
|
|
21
|
+
pagecolor="#ffffff"
|
|
22
|
+
bordercolor="#666666"
|
|
23
|
+
borderopacity="1.0"
|
|
24
|
+
inkscape:pageopacity="0.0"
|
|
25
|
+
inkscape:pageshadow="2"
|
|
26
|
+
inkscape:zoom="15.839192"
|
|
27
|
+
inkscape:cx="17.488266"
|
|
28
|
+
inkscape:cy="13.037281"
|
|
29
|
+
inkscape:document-units="px"
|
|
30
|
+
inkscape:current-layer="layer1"
|
|
31
|
+
showgrid="true"
|
|
32
|
+
inkscape:window-width="1920"
|
|
33
|
+
inkscape:window-height="1172"
|
|
34
|
+
inkscape:window-x="0"
|
|
35
|
+
inkscape:window-y="0"
|
|
36
|
+
inkscape:window-maximized="1"
|
|
37
|
+
inkscape:snap-bbox="true"
|
|
38
|
+
inkscape:bbox-paths="true"
|
|
39
|
+
inkscape:bbox-nodes="true"
|
|
40
|
+
inkscape:snap-bbox-edge-midpoints="true"
|
|
41
|
+
inkscape:snap-bbox-midpoints="true"
|
|
42
|
+
units="px"
|
|
43
|
+
inkscape:document-rotation="0"
|
|
44
|
+
inkscape:showpageshadow="2"
|
|
45
|
+
inkscape:pagecheckerboard="0"
|
|
46
|
+
inkscape:deskcolor="#d1d1d1">
|
|
47
|
+
<inkscape:grid
|
|
48
|
+
type="xygrid"
|
|
49
|
+
id="grid4231"
|
|
50
|
+
originx="0"
|
|
51
|
+
originy="0"
|
|
52
|
+
spacingy="1"
|
|
53
|
+
spacingx="1"
|
|
54
|
+
units="px" />
|
|
55
|
+
</sodipodi:namedview>
|
|
56
|
+
<metadata
|
|
57
|
+
id="metadata5">
|
|
58
|
+
<rdf:RDF>
|
|
59
|
+
<cc:Work
|
|
60
|
+
rdf:about="">
|
|
61
|
+
<dc:format>image/svg+xml</dc:format>
|
|
62
|
+
<dc:type
|
|
63
|
+
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
|
64
|
+
</cc:Work>
|
|
65
|
+
</rdf:RDF>
|
|
66
|
+
</metadata>
|
|
67
|
+
<g
|
|
68
|
+
inkscape:label="Layer 1"
|
|
69
|
+
inkscape:groupmode="layer"
|
|
70
|
+
id="layer1"
|
|
71
|
+
transform="translate(0,-290.65)">
|
|
72
|
+
<path
|
|
73
|
+
style="baseline-shift:baseline;display:inline;overflow:visible;opacity:1;vector-effect:none;stroke-linecap:round;stroke-linejoin:round;enable-background:accumulate;stop-color:#000000;stop-opacity:1"
|
|
74
|
+
d="m 4.3007813,292.43097 c -1.8095107,0 -3.30078138,1.48932 -3.3007813,3.29883 v 11 c -8e-8,1.80951 1.4912706,3.30078 3.3007813,3.30078 h 3.4882812 c 0.2921367,6e-5 0.5708031,0.11566 0.7773437,0.32227 l 1.8789068,1.87695 a 1.10011,1.10011 0 0 0 0,0.002 c 0.849893,0.84964 2.259481,0.84964 3.109375,0 a 1.10011,1.10011 0 0 0 0,-0.002 l 1.878906,-1.87695 c 0.20654,-0.20661 0.485207,-0.32221 0.777344,-0.32227 h 3.488281 C 21.508729,310.03058 23,308.53931 23,306.7298 v -11 c 0,-1.80951 -1.491271,-3.29883 -3.300781,-3.29883 z m 0,2.19922 H 19.699219 c 0.620542,0 1.101562,0.47907 1.101562,1.09961 v 11 c 0,0.62054 -0.48102,1.10156 -1.101562,1.10156 h -3.488281 c -0.874721,1.9e-4 -1.715558,0.34818 -2.333985,0.9668 L 12,310.67511 10.123047,308.79816 c -0.6184275,-0.61862 -1.459264,-0.96661 -2.3339845,-0.9668 H 4.3007813 c -0.6205423,0 -1.1015626,-0.48102 -1.1015625,-1.10156 v -11 c -1e-7,-0.62054 0.4810202,-1.09961 1.1015625,-1.09961 z"
|
|
75
|
+
id="path1" />
|
|
76
|
+
</g>
|
|
77
|
+
</svg>
|
package/package.json
CHANGED
package/plugins/MapExport.js
CHANGED
|
@@ -351,7 +351,7 @@ var MapExport = /*#__PURE__*/function (_React$Component) {
|
|
|
351
351
|
params.WIDTH = width;
|
|
352
352
|
params.HEIGHT = height;
|
|
353
353
|
params.filename = fileName;
|
|
354
|
-
params.FILTER_GEOM = VectorLayerUtils.geoJSONGeomToWkt(VectorLayerUtils.reprojectGeometry(_this.props.filter.filterGeom, _this.props.map.projection, crs));
|
|
354
|
+
params.FILTER_GEOM = _this.props.filter.filterGeom ? VectorLayerUtils.geoJSONGeomToWkt(VectorLayerUtils.reprojectGeometry(_this.props.filter.filterGeom, _this.props.map.projection, crs)) : "";
|
|
355
355
|
|
|
356
356
|
// Dimension values
|
|
357
357
|
_this.props.layers.forEach(function (layer) {
|
package/plugins/Redlining.js
CHANGED
|
@@ -257,7 +257,8 @@ var Redlining = /*#__PURE__*/function (_React$Component) {
|
|
|
257
257
|
for (var _i = 0, _Object$values = Object.values(_this.props.plugins || {}); _i < _Object$values.length; _i++) {
|
|
258
258
|
var plugin = _Object$values[_i];
|
|
259
259
|
if (toolEnabled(plugin.cfg.key)) {
|
|
260
|
-
|
|
260
|
+
var buttonGroup = plugin.cfg.tooltype === 'draw' ? drawButtons : editButtons;
|
|
261
|
+
buttonGroup.push(_objectSpread(_objectSpread({}, plugin.cfg), {}, {
|
|
261
262
|
tooltip: plugin.cfg.tooltip ? LocaleUtils.tr(plugin.cfg.tooltip) : undefined
|
|
262
263
|
}));
|
|
263
264
|
}
|
|
@@ -638,7 +639,7 @@ _defineProperty(Redlining, "propTypes", {
|
|
|
638
639
|
defaultTextFillColor: PropTypes.array,
|
|
639
640
|
/** Default text outline color. In format `[r, g, b, a]`. */
|
|
640
641
|
defaultTextOutlineColor: PropTypes.array,
|
|
641
|
-
/** Tools to hide. Available tools: `Circle`, `Ellipse`, `Square`, `Box`, `HandDrawing`, `Transform`, `NumericInput`, `Buffer`, `Export`. */
|
|
642
|
+
/** Tools to hide. Available tools: `Circle`, `Ellipse`, `Square`, `Box`, `HandDrawing`, `Transform`, `NumericInput`, `Buffer`, `FeatureLabel`, `Export`. */
|
|
642
643
|
hiddenTools: PropTypes.array,
|
|
643
644
|
layers: PropTypes.array,
|
|
644
645
|
mapCrs: PropTypes.string,
|
|
@@ -176,11 +176,12 @@ var RedliningSupport = /*#__PURE__*/function (_React$Component) {
|
|
|
176
176
|
return _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, isText ? "textOutlineColor" : "borderColor", styleOptions.strokeColor), "strokeDash", styleOptions.strokeDash), "size", (styleOptions.strokeWidth - 1) * 2), isText ? "textFillColor" : "fillColor", styleOptions.fillColor), "text", label), "headmarker", styleOptions.headmarker), "tailmarker", styleOptions.tailmarker);
|
|
177
177
|
});
|
|
178
178
|
_defineProperty(_this, "updateFeatureStyle", function (feature) {
|
|
179
|
+
var _feature$get;
|
|
179
180
|
_this.blockOnChange = true;
|
|
180
181
|
var styleProps = _this.props.redlining.style;
|
|
181
182
|
var isText = feature.get("shape") === "Text";
|
|
182
|
-
var styleName = isText ? "text" : "default";
|
|
183
|
-
var opts = _this.styleOptions(styleProps, isText);
|
|
183
|
+
var styleName = (_feature$get = feature.get("styleName")) !== null && _feature$get !== void 0 ? _feature$get : isText ? "text" : "default";
|
|
184
|
+
var opts = _objectSpread(_objectSpread({}, feature.get('styleOptions')), _this.styleOptions(styleProps, isText));
|
|
184
185
|
if (!feature.get('measurements') && _this.selectedFeatures.length <= 1 && !(isText && !styleProps.text)) {
|
|
185
186
|
feature.set('label', styleProps.text);
|
|
186
187
|
}
|
|
@@ -220,13 +221,16 @@ var RedliningSupport = /*#__PURE__*/function (_React$Component) {
|
|
|
220
221
|
_defineProperty(_this, "styleFunction", function (feature) {
|
|
221
222
|
var styleOptions = feature.get("styleOptions");
|
|
222
223
|
var styleName = feature.get("styleName");
|
|
224
|
+
var shape = feature.get('shape');
|
|
223
225
|
var styles = [];
|
|
224
|
-
|
|
226
|
+
styles.push.apply(styles, _toConsumableArray(FeatureStyles[styleName](feature, styleOptions)));
|
|
227
|
+
if (shape === "Text") {
|
|
225
228
|
styles.push(_this.selectedTextStyle(feature, styleOptions));
|
|
226
229
|
}
|
|
227
|
-
styles.push.apply(styles, _toConsumableArray(FeatureStyles[styleName](feature, styleOptions)));
|
|
228
|
-
var shape = feature.get('shape');
|
|
229
230
|
var geomTypeConfig = GeomTypeConfig[shape];
|
|
231
|
+
if (shape === "Text" && styleName === "textlabel") {
|
|
232
|
+
styles.push(_this.selectedTextStyle(feature, styleOptions));
|
|
233
|
+
}
|
|
230
234
|
if ((geomTypeConfig || {}).drawNodes !== false) {
|
|
231
235
|
styles.push(_this.selectedStyle);
|
|
232
236
|
}
|
|
@@ -618,8 +622,7 @@ var RedliningSupport = /*#__PURE__*/function (_React$Component) {
|
|
|
618
622
|
}
|
|
619
623
|
});
|
|
620
624
|
_defineProperty(_this, "deselectFeature", function (feature, updateState) {
|
|
621
|
-
var
|
|
622
|
-
var style = FeatureStyles[styleName](feature, feature.get('styleOptions'));
|
|
625
|
+
var style = FeatureStyles[feature.get("styleName")](feature, feature.get('styleOptions'));
|
|
623
626
|
feature.setStyle(style);
|
|
624
627
|
feature.un('change', _this.updateMeasurements);
|
|
625
628
|
_this.selectedFeatures = _this.selectedFeatures.filter(function (f) {
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
5
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
6
|
+
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; } }
|
|
7
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
8
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
9
|
+
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; }
|
|
10
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
11
|
+
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); } }
|
|
12
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
13
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
14
|
+
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); }
|
|
15
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
16
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
17
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
18
|
+
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); }
|
|
19
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
20
|
+
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; }
|
|
21
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
22
|
+
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); }
|
|
23
|
+
/**
|
|
24
|
+
* Copyright 2026 Sourcepole AG
|
|
25
|
+
* All rights reserved.
|
|
26
|
+
*
|
|
27
|
+
* This source code is licensed under the BSD-style license found in the
|
|
28
|
+
* LICENSE file in the root directory of this source tree.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
import React from 'react';
|
|
32
|
+
import { connect } from 'react-redux';
|
|
33
|
+
import PropTypes from 'prop-types';
|
|
34
|
+
import { addLayer, addLayerFeatures, removeLayerFeatures, removeLayer, LayerRole } from '../../actions/layers';
|
|
35
|
+
import Icon from '../../components/Icon';
|
|
36
|
+
import PickFeature from '../../components/PickFeature';
|
|
37
|
+
import ComboBox from '../../components/widgets/ComboBox';
|
|
38
|
+
import TextInput from '../../components/widgets/TextInput';
|
|
39
|
+
import { parseExpression } from '../../utils/EditingUtils';
|
|
40
|
+
import LocaleUtils from '../../utils/LocaleUtils';
|
|
41
|
+
import VectorLayerUtils from '../../utils/VectorLayerUtils';
|
|
42
|
+
var RedliningFeatureLabelSupport = /*#__PURE__*/function (_React$Component) {
|
|
43
|
+
function RedliningFeatureLabelSupport() {
|
|
44
|
+
var _this;
|
|
45
|
+
_classCallCheck(this, RedliningFeatureLabelSupport);
|
|
46
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
47
|
+
args[_key] = arguments[_key];
|
|
48
|
+
}
|
|
49
|
+
_this = _callSuper(this, RedliningFeatureLabelSupport, [].concat(args));
|
|
50
|
+
_defineProperty(_this, "state", {
|
|
51
|
+
cur: null,
|
|
52
|
+
currentProfile: null
|
|
53
|
+
});
|
|
54
|
+
_defineProperty(_this, "featurePicked", function (layer, feature, map) {
|
|
55
|
+
var _this$props$layers$fi, _this$props$layers$fi2;
|
|
56
|
+
var sellayer = {
|
|
57
|
+
id: "__redliningfeaturelabelhighlight",
|
|
58
|
+
role: LayerRole.SELECTION
|
|
59
|
+
};
|
|
60
|
+
_this.props.addLayerFeatures(sellayer, [feature], true);
|
|
61
|
+
var profiles = _toConsumableArray((_this$props$layers$fi = (_this$props$layers$fi2 = _this.props.layers.find(function (l) {
|
|
62
|
+
return l.wms_name === map;
|
|
63
|
+
})) === null || _this$props$layers$fi2 === void 0 || (_this$props$layers$fi2 = _this$props$layers$fi2.labelProfiles) === null || _this$props$layers$fi2 === void 0 ? void 0 : _this$props$layers$fi2[layer]) !== null && _this$props$layers$fi !== void 0 ? _this$props$layers$fi : []);
|
|
64
|
+
profiles.push({
|
|
65
|
+
name: "__custom",
|
|
66
|
+
expression: "",
|
|
67
|
+
title: LocaleUtils.tr("common.custom")
|
|
68
|
+
});
|
|
69
|
+
_this.setState({
|
|
70
|
+
cur: {
|
|
71
|
+
layer: layer,
|
|
72
|
+
feature: feature,
|
|
73
|
+
map: map,
|
|
74
|
+
profiles: profiles
|
|
75
|
+
},
|
|
76
|
+
currentProfile: profiles[0].name
|
|
77
|
+
}, _this.updateLabelFeature);
|
|
78
|
+
});
|
|
79
|
+
_defineProperty(_this, "setCurrentProfile", function (value) {
|
|
80
|
+
_this.setState({
|
|
81
|
+
currentProfile: value
|
|
82
|
+
}, _this.updateLabelFeature);
|
|
83
|
+
});
|
|
84
|
+
_defineProperty(_this, "setProfileExpression", function (value) {
|
|
85
|
+
_this.setState(function (state) {
|
|
86
|
+
return {
|
|
87
|
+
cur: _objectSpread(_objectSpread({}, state.cur), {}, {
|
|
88
|
+
profiles: state.cur.profiles.map(function (profile) {
|
|
89
|
+
return _objectSpread(_objectSpread({}, profile), {}, {
|
|
90
|
+
expression: profile.name === state.currentProfile ? value : profile.expression
|
|
91
|
+
});
|
|
92
|
+
})
|
|
93
|
+
})
|
|
94
|
+
};
|
|
95
|
+
}, _this.updateLabelFeature);
|
|
96
|
+
});
|
|
97
|
+
_defineProperty(_this, "updateLabelFeature", function () {
|
|
98
|
+
var _this$props$layers$fi3;
|
|
99
|
+
var cur = _this.state.cur;
|
|
100
|
+
var layer = {
|
|
101
|
+
id: _this.props.redlining.layer,
|
|
102
|
+
title: _this.props.redlining.layerTitle,
|
|
103
|
+
role: LayerRole.USERLAYER
|
|
104
|
+
};
|
|
105
|
+
var featureId = "label::".concat(cur.map, "::").concat(cur.layer, "::").concat(cur.feature.id);
|
|
106
|
+
var expression = cur.profiles.find(function (profile) {
|
|
107
|
+
return profile.name === _this.state.currentProfile;
|
|
108
|
+
}).expression;
|
|
109
|
+
if (!expression) {
|
|
110
|
+
_this.props.removeLayerFeatures(layer, [featureId]);
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
var fakeEditConfig = {
|
|
114
|
+
layerName: _this.state.cur.layer
|
|
115
|
+
};
|
|
116
|
+
var text = parseExpression(expression, _this.state.cur.feature, fakeEditConfig, null, _this.state.cur.map, _this.props.projection, _this.updateLabelFeature);
|
|
117
|
+
if (text === null) {
|
|
118
|
+
text = expression;
|
|
119
|
+
} else {
|
|
120
|
+
text = String(text);
|
|
121
|
+
}
|
|
122
|
+
var center = VectorLayerUtils.getFeatureCenter(_this.state.cur.feature);
|
|
123
|
+
var feature = (((_this$props$layers$fi3 = _this.props.layers.find(function (l) {
|
|
124
|
+
return l.id === _this.props.redlining.layer;
|
|
125
|
+
})) === null || _this$props$layers$fi3 === void 0 ? void 0 : _this$props$layers$fi3.features) || []).find(function (f) {
|
|
126
|
+
return f.id === featureId;
|
|
127
|
+
});
|
|
128
|
+
if (feature) {
|
|
129
|
+
feature = _objectSpread(_objectSpread({}, feature), {}, {
|
|
130
|
+
properties: {
|
|
131
|
+
label: text
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
} else {
|
|
135
|
+
feature = {
|
|
136
|
+
id: featureId,
|
|
137
|
+
type: "Feature",
|
|
138
|
+
geometry: {
|
|
139
|
+
type: "Point",
|
|
140
|
+
coordinates: center
|
|
141
|
+
},
|
|
142
|
+
properties: {
|
|
143
|
+
label: text
|
|
144
|
+
},
|
|
145
|
+
shape: "Text",
|
|
146
|
+
styleName: "textlabel",
|
|
147
|
+
styleOptions: {
|
|
148
|
+
strokeWidth: 2,
|
|
149
|
+
fillColor: [255, 255, 255, 1],
|
|
150
|
+
textFillColor: [0, 0, 0, 1],
|
|
151
|
+
strokeColor: [0, 0, 0, 1],
|
|
152
|
+
strokeDash: [],
|
|
153
|
+
anchor: center
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
_this.props.addLayerFeatures(layer, [feature]);
|
|
158
|
+
});
|
|
159
|
+
return _this;
|
|
160
|
+
}
|
|
161
|
+
_inherits(RedliningFeatureLabelSupport, _React$Component);
|
|
162
|
+
return _createClass(RedliningFeatureLabelSupport, [{
|
|
163
|
+
key: "componentDidUpdate",
|
|
164
|
+
value: function componentDidUpdate(prevProps) {
|
|
165
|
+
if (this.props.redlining.action !== "FeatureLabel" && prevProps.redlining.action === "FeatureLabel") {
|
|
166
|
+
this.setState({
|
|
167
|
+
cur: null,
|
|
168
|
+
currentProfile: null
|
|
169
|
+
});
|
|
170
|
+
this.props.removeLayer("__redliningfeaturelabelhighlight");
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}, {
|
|
174
|
+
key: "componentWillUnmount",
|
|
175
|
+
value: function componentWillUnmount() {
|
|
176
|
+
this.props.removeLayer("__redliningfeaturelabelhighlight");
|
|
177
|
+
}
|
|
178
|
+
}, {
|
|
179
|
+
key: "render",
|
|
180
|
+
value: function render() {
|
|
181
|
+
var _this2 = this;
|
|
182
|
+
var control = null;
|
|
183
|
+
if (this.state.cur) {
|
|
184
|
+
var selectedProfile = this.state.cur.profiles.find(function (profile) {
|
|
185
|
+
return profile.name === _this2.state.currentProfile;
|
|
186
|
+
});
|
|
187
|
+
var isCustomProfile = this.state.currentProfile === "__custom";
|
|
188
|
+
control = /*#__PURE__*/React.createElement("div", {
|
|
189
|
+
className: "controlgroup",
|
|
190
|
+
key: "Control"
|
|
191
|
+
}, this.state.cur.profiles.length > 1 ? /*#__PURE__*/React.createElement(ComboBox, {
|
|
192
|
+
onChange: this.setCurrentProfile,
|
|
193
|
+
value: this.state.currentProfile
|
|
194
|
+
}, this.state.cur.profiles.map(function (profile) {
|
|
195
|
+
var _profile$title;
|
|
196
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
197
|
+
key: profile.name,
|
|
198
|
+
value: profile.name
|
|
199
|
+
}, (_profile$title = profile.title) !== null && _profile$title !== void 0 ? _profile$title : profile.name);
|
|
200
|
+
})) : null, /*#__PURE__*/React.createElement(TextInput, {
|
|
201
|
+
className: "controlgroup-expanditem",
|
|
202
|
+
multiline: true,
|
|
203
|
+
onChange: this.setProfileExpression,
|
|
204
|
+
placeholder: "'Text: ' || \"fieldname\"",
|
|
205
|
+
readOnly: !isCustomProfile,
|
|
206
|
+
value: selectedProfile === null || selectedProfile === void 0 ? void 0 : selectedProfile.expression
|
|
207
|
+
}), isCustomProfile ? /*#__PURE__*/React.createElement("button", {
|
|
208
|
+
className: "button",
|
|
209
|
+
type: "button"
|
|
210
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
211
|
+
icon: "ok"
|
|
212
|
+
})) : null);
|
|
213
|
+
} else {
|
|
214
|
+
control = /*#__PURE__*/React.createElement("div", {
|
|
215
|
+
className: "redlining-message",
|
|
216
|
+
key: "Control"
|
|
217
|
+
}, LocaleUtils.tr("redlining.labelselectfeature"));
|
|
218
|
+
}
|
|
219
|
+
return [control, /*#__PURE__*/React.createElement(PickFeature, {
|
|
220
|
+
featurePicked: this.featurePicked,
|
|
221
|
+
key: "FeaturePicker",
|
|
222
|
+
layerFilterFunc: function layerFilterFunc(layer) {
|
|
223
|
+
return layer.type === "wms";
|
|
224
|
+
}
|
|
225
|
+
})];
|
|
226
|
+
}
|
|
227
|
+
}]);
|
|
228
|
+
}(React.Component);
|
|
229
|
+
_defineProperty(RedliningFeatureLabelSupport, "propTypes", {
|
|
230
|
+
addLayer: PropTypes.func,
|
|
231
|
+
addLayerFeatures: PropTypes.func,
|
|
232
|
+
layers: PropTypes.array,
|
|
233
|
+
projection: PropTypes.string,
|
|
234
|
+
redlining: PropTypes.object,
|
|
235
|
+
removeLayer: PropTypes.func,
|
|
236
|
+
removeLayerFeatures: PropTypes.func
|
|
237
|
+
});
|
|
238
|
+
export default {
|
|
239
|
+
cfg: {
|
|
240
|
+
key: "FeatureLabel",
|
|
241
|
+
tooltip: LocaleUtils.trmsg("redlining.featurelabel"),
|
|
242
|
+
tooltype: "draw",
|
|
243
|
+
icon: "label",
|
|
244
|
+
data: {
|
|
245
|
+
action: "FeatureLabel",
|
|
246
|
+
geomType: null
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
controls: connect(function (state) {
|
|
250
|
+
return {
|
|
251
|
+
projection: state.map.projection,
|
|
252
|
+
layers: state.layers.flat,
|
|
253
|
+
redlining: state.redlining
|
|
254
|
+
};
|
|
255
|
+
}, {
|
|
256
|
+
addLayerFeatures: addLayerFeatures,
|
|
257
|
+
removeLayer: removeLayer,
|
|
258
|
+
removeLayerFeatures: removeLayerFeatures,
|
|
259
|
+
addLayer: addLayer
|
|
260
|
+
})(RedliningFeatureLabelSupport)
|
|
261
|
+
};
|
|
@@ -123,6 +123,7 @@
|
|
|
123
123
|
"clone": "",
|
|
124
124
|
"close": "Затвори",
|
|
125
125
|
"compute": "",
|
|
126
|
+
"custom": "",
|
|
126
127
|
"date": "",
|
|
127
128
|
"delete": "Изтриване на",
|
|
128
129
|
"download": "Изтегляне",
|
|
@@ -567,8 +568,10 @@
|
|
|
567
568
|
"ctrlhint": "",
|
|
568
569
|
"draw": "Начертайте",
|
|
569
570
|
"edit": "Редактиране на",
|
|
571
|
+
"featurelabel": "",
|
|
570
572
|
"freehand": "Рисуване със свободна ръка",
|
|
571
573
|
"label": "Етикет",
|
|
574
|
+
"labelselectfeature": "",
|
|
572
575
|
"layer": "Слой",
|
|
573
576
|
"layertitle": "Redlining",
|
|
574
577
|
"markers": "Маркери",
|
|
@@ -123,6 +123,7 @@
|
|
|
123
123
|
"clone": "Clonar",
|
|
124
124
|
"close": "Tancar",
|
|
125
125
|
"compute": "",
|
|
126
|
+
"custom": "",
|
|
126
127
|
"date": "",
|
|
127
128
|
"delete": "Eliminar",
|
|
128
129
|
"download": "Descarregar",
|
|
@@ -567,8 +568,10 @@
|
|
|
567
568
|
"ctrlhint": "Utilitza Ctrl per a la multiselecció...",
|
|
568
569
|
"draw": "Dibuixa",
|
|
569
570
|
"edit": "Edita",
|
|
571
|
+
"featurelabel": "",
|
|
570
572
|
"freehand": "Dibuix a mà alçada",
|
|
571
573
|
"label": "Etiqueta",
|
|
574
|
+
"labelselectfeature": "",
|
|
572
575
|
"layer": "Capa",
|
|
573
576
|
"layertitle": "Redlining",
|
|
574
577
|
"markers": "Marcadors",
|
|
@@ -123,6 +123,7 @@
|
|
|
123
123
|
"clone": "",
|
|
124
124
|
"close": "Zavřít",
|
|
125
125
|
"compute": "",
|
|
126
|
+
"custom": "",
|
|
126
127
|
"date": "",
|
|
127
128
|
"delete": "",
|
|
128
129
|
"download": "",
|
|
@@ -567,8 +568,10 @@
|
|
|
567
568
|
"ctrlhint": "",
|
|
568
569
|
"draw": "",
|
|
569
570
|
"edit": "",
|
|
571
|
+
"featurelabel": "",
|
|
570
572
|
"freehand": "",
|
|
571
573
|
"label": "Popisek",
|
|
574
|
+
"labelselectfeature": "",
|
|
572
575
|
"layer": "Vrstva",
|
|
573
576
|
"layertitle": "",
|
|
574
577
|
"markers": "",
|
|
@@ -123,6 +123,7 @@
|
|
|
123
123
|
"clone": "Kopieren",
|
|
124
124
|
"close": "Schliessen",
|
|
125
125
|
"compute": "Berenchnen",
|
|
126
|
+
"custom": "Benutzerdefiniert",
|
|
126
127
|
"date": "Datum",
|
|
127
128
|
"delete": "Löschen",
|
|
128
129
|
"download": "Herunterladen",
|
|
@@ -567,8 +568,10 @@
|
|
|
567
568
|
"ctrlhint": "Mehrfachselektion mit Ctrl...",
|
|
568
569
|
"draw": "Zeichnen",
|
|
569
570
|
"edit": "Bearbeiten",
|
|
571
|
+
"featurelabel": "Objekt beschriften",
|
|
570
572
|
"freehand": "Freihand",
|
|
571
573
|
"label": "Beschriftung",
|
|
574
|
+
"labelselectfeature": "Zu beschrieftendes Objekt auswählen...",
|
|
572
575
|
"layer": "Ebene",
|
|
573
576
|
"layertitle": "Zeichnung",
|
|
574
577
|
"markers": "Spitzen",
|
|
@@ -123,6 +123,7 @@
|
|
|
123
123
|
"clone": "Kopieren",
|
|
124
124
|
"close": "Schließen",
|
|
125
125
|
"compute": "Berechnen",
|
|
126
|
+
"custom": "Benutzerdefiniert",
|
|
126
127
|
"date": "Datum",
|
|
127
128
|
"delete": "Löschen",
|
|
128
129
|
"download": "Herunterladen",
|
|
@@ -567,8 +568,10 @@
|
|
|
567
568
|
"ctrlhint": "Mehrfachselektion mit Ctrl...",
|
|
568
569
|
"draw": "Zeichnen",
|
|
569
570
|
"edit": "Bearbeiten",
|
|
571
|
+
"featurelabel": "Objekt beschriften",
|
|
570
572
|
"freehand": "Freihand",
|
|
571
573
|
"label": "Beschriftung",
|
|
574
|
+
"labelselectfeature": "Zu beschrieftendes Objekt auswählen...",
|
|
572
575
|
"layer": "Ebene",
|
|
573
576
|
"layertitle": "Zeichnung",
|
|
574
577
|
"markers": "Spitzen",
|
|
@@ -123,6 +123,7 @@
|
|
|
123
123
|
"clone": "Clone",
|
|
124
124
|
"close": "Close",
|
|
125
125
|
"compute": "Compute",
|
|
126
|
+
"custom": "Custom",
|
|
126
127
|
"date": "Date",
|
|
127
128
|
"delete": "Delete",
|
|
128
129
|
"download": "Download",
|
|
@@ -567,8 +568,10 @@
|
|
|
567
568
|
"ctrlhint": "Use Ctrl for multiselection...",
|
|
568
569
|
"draw": "Draw",
|
|
569
570
|
"edit": "Edit",
|
|
571
|
+
"featurelabel": "Label feature",
|
|
570
572
|
"freehand": "Freehand drawing",
|
|
571
573
|
"label": "Label",
|
|
574
|
+
"labelselectfeature": "Select a feature to label...",
|
|
572
575
|
"layer": "Layer",
|
|
573
576
|
"layertitle": "Redlining",
|
|
574
577
|
"markers": "Markers",
|
|
@@ -123,6 +123,7 @@
|
|
|
123
123
|
"clone": "Clonar",
|
|
124
124
|
"close": "Cerrar",
|
|
125
125
|
"compute": "",
|
|
126
|
+
"custom": "",
|
|
126
127
|
"date": "",
|
|
127
128
|
"delete": "Eliminar",
|
|
128
129
|
"download": "Descargar",
|
|
@@ -567,8 +568,10 @@
|
|
|
567
568
|
"ctrlhint": "Abrir con Ctrl+Click",
|
|
568
569
|
"draw": "Dibujar",
|
|
569
570
|
"edit": "Editar",
|
|
571
|
+
"featurelabel": "",
|
|
570
572
|
"freehand": "Dibujo a mano alzada",
|
|
571
573
|
"label": "Etiqueta",
|
|
574
|
+
"labelselectfeature": "",
|
|
572
575
|
"layer": "Capa",
|
|
573
576
|
"layertitle": "Línea de demarcación",
|
|
574
577
|
"markers": "Marcadores",
|
|
@@ -123,6 +123,7 @@
|
|
|
123
123
|
"clone": "",
|
|
124
124
|
"close": "",
|
|
125
125
|
"compute": "",
|
|
126
|
+
"custom": "",
|
|
126
127
|
"date": "",
|
|
127
128
|
"delete": "",
|
|
128
129
|
"download": "",
|
|
@@ -567,8 +568,10 @@
|
|
|
567
568
|
"ctrlhint": "",
|
|
568
569
|
"draw": "Piirrä",
|
|
569
570
|
"edit": "Editoi",
|
|
571
|
+
"featurelabel": "",
|
|
570
572
|
"freehand": "Vapaa piirto",
|
|
571
573
|
"label": "Selite",
|
|
574
|
+
"labelselectfeature": "",
|
|
572
575
|
"layer": "Taso",
|
|
573
576
|
"layertitle": "",
|
|
574
577
|
"markers": "",
|
|
@@ -123,6 +123,7 @@
|
|
|
123
123
|
"clone": "Copier",
|
|
124
124
|
"close": "Fermer",
|
|
125
125
|
"compute": "Calculer",
|
|
126
|
+
"custom": "Personnalisé",
|
|
126
127
|
"date": "Date",
|
|
127
128
|
"delete": "Effacer",
|
|
128
129
|
"download": "Télécharger",
|
|
@@ -567,8 +568,10 @@
|
|
|
567
568
|
"ctrlhint": "Ctrl pour sélection multiple...",
|
|
568
569
|
"draw": "Dessiner",
|
|
569
570
|
"edit": "Editer",
|
|
571
|
+
"featurelabel": "Étiqueter objet",
|
|
570
572
|
"freehand": "Dessin à main libre",
|
|
571
573
|
"label": "Texte",
|
|
574
|
+
"labelselectfeature": "Sélectionner l'objet à étiqueter...",
|
|
572
575
|
"layer": "Couche",
|
|
573
576
|
"layertitle": "Dessin",
|
|
574
577
|
"markers": "Pointes",
|
|
@@ -123,6 +123,7 @@
|
|
|
123
123
|
"clone": "",
|
|
124
124
|
"close": "",
|
|
125
125
|
"compute": "",
|
|
126
|
+
"custom": "",
|
|
126
127
|
"date": "",
|
|
127
128
|
"delete": "",
|
|
128
129
|
"download": "",
|
|
@@ -567,8 +568,10 @@
|
|
|
567
568
|
"ctrlhint": "",
|
|
568
569
|
"draw": "",
|
|
569
570
|
"edit": "",
|
|
571
|
+
"featurelabel": "",
|
|
570
572
|
"freehand": "",
|
|
571
573
|
"label": "Címke",
|
|
574
|
+
"labelselectfeature": "",
|
|
572
575
|
"layer": "",
|
|
573
576
|
"layertitle": "",
|
|
574
577
|
"markers": "",
|
|
@@ -123,6 +123,7 @@
|
|
|
123
123
|
"clone": "Copia",
|
|
124
124
|
"close": "Chiudi",
|
|
125
125
|
"compute": "Calcola",
|
|
126
|
+
"custom": "Personalizzato",
|
|
126
127
|
"date": "Data",
|
|
127
128
|
"delete": "Elimina",
|
|
128
129
|
"download": "Scarica",
|
|
@@ -567,8 +568,10 @@
|
|
|
567
568
|
"ctrlhint": "Ctrl per selezione multipla...",
|
|
568
569
|
"draw": "Disegna",
|
|
569
570
|
"edit": "Modifica",
|
|
571
|
+
"featurelabel": "Ettichetta oggetto",
|
|
570
572
|
"freehand": "Mano libera",
|
|
571
573
|
"label": "Ettichetta",
|
|
574
|
+
"labelselectfeature": "Selezionare oggetto da ettichettare...",
|
|
572
575
|
"layer": "Layer",
|
|
573
576
|
"layertitle": "Disegno",
|
|
574
577
|
"markers": "Punte",
|