qwc2 2025.10.9 → 2025.10.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/actions/display.js +30 -1
- package/actions/editing.js +22 -1
- package/actions/layerinfo.js +13 -1
- package/actions/layers.js +213 -3
- package/actions/localConfig.js +58 -1
- package/actions/locale.js +21 -1
- package/actions/locate.js +26 -1
- package/actions/logging.js +10 -1
- package/actions/map.js +105 -2
- package/actions/measurement.js +12 -1
- package/actions/processNotifications.js +37 -1
- package/actions/redlining.js +18 -1
- package/actions/redliningPick.js +12 -1
- package/actions/search.js +12 -1
- package/actions/serviceinfo.js +12 -1
- package/actions/task.js +55 -3
- package/actions/theme.js +339 -19
- package/actions/windows.js +164 -5
- package/components/AppMenu.js +435 -3
- package/components/AttributeForm.js +928 -32
- package/components/AttributeTableWidget.js +1105 -13
- package/components/AutoEditForm.js +189 -3
- package/components/CoordinateDisplayer.js +78 -2
- package/components/EditComboField.js +190 -6
- package/components/EditUploadField.js +315 -3
- package/components/ExportSelection.js +203 -2
- package/components/FullscreenSwitcher.js +90 -3
- package/components/Icon.js +81 -2
- package/components/IdentifyViewer.js +1161 -6
- package/components/ImportLayer.js +718 -20
- package/components/LayerInfoWindow.js +145 -2
- package/components/LinkFeatureForm.js +246 -5
- package/components/MapButton.js +88 -2
- package/components/MapSelection.js +287 -8
- package/components/MessageBar.js +68 -2
- package/components/NumericInputWindow.js +359 -2
- package/components/PickFeature.js +266 -2
- package/components/PluginsContainer.js +227 -8
- package/components/PrintSelection.js +620 -49
- package/components/ProcessNotifications.js +104 -2
- package/components/QtDesignerForm.js +1137 -18
- package/components/ResizeableWindow.js +591 -8
- package/components/SearchBox.js +1307 -20
- package/components/ServiceInfoWindow.js +107 -2
- package/components/SideBar.js +204 -4
- package/components/StandardApp.js +381 -20
- package/components/Swipeable.js +15 -1
- package/components/TaskBar.js +85 -2
- package/components/ThemeLayersListWindow.js +216 -4
- package/components/ThemeList.js +381 -7
- package/components/Toolbar.js +106 -2
- package/components/WindowManager.js +178 -2
- package/components/map/OlLayer.js +257 -6
- package/components/map/OlMap.js +405 -5
- package/components/map/layers/BingLayer.js +31 -2
- package/components/map/layers/GoogleLayer.js +222 -19
- package/components/map/layers/GraticuleLayer.js +21 -1
- package/components/map/layers/ImageLayer.js +15 -1
- package/components/map/layers/MVTLayer.js +52 -2
- package/components/map/layers/OSMLayer.js +24 -2
- package/components/map/layers/OverlayLayer.js +55 -3
- package/components/map/layers/VectorLayer.js +173 -8
- package/components/map/layers/WFSLayer.js +220 -6
- package/components/map/layers/WMSLayer.js +180 -6
- package/components/map/layers/WMTSLayer.js +67 -3
- package/components/map/layers/XYZLayer.js +24 -2
- package/components/map/layers/index.js +28 -1
- package/components/map3d/EditDataset3D.js +190 -3
- package/components/map3d/HeightProfile3D.js +402 -3
- package/components/map3d/ImportObjects3D.js +162 -2
- package/components/map3d/Map3D.js +1304 -38
- package/components/map3d/MapControls3D.js +392 -7
- package/components/map3d/SearchField3D.js +183 -11
- package/components/map3d/View3DSwitcher.js +98 -2
- package/components/map3d/drawtool/CreateTool3D.js +174 -4
- package/components/map3d/drawtool/EditTool3D.js +590 -6
- package/components/map3d/drawtool/NumericInput3D.js +336 -4
- package/components/map3d/layers/GeoTIFFLayer3D.js +15 -1
- package/components/map3d/layers/VectorLayer3D.js +53 -2
- package/components/map3d/layers/WFSLayer3D.js +109 -3
- package/components/map3d/layers/WMSLayer3D.js +70 -2
- package/components/map3d/layers/WMTSLayer3D.js +27 -3
- package/components/map3d/layers/index.js +14 -1
- package/components/map3d/utils/FirstPersonControls3D.js +423 -16
- package/components/map3d/utils/MiscUtils3D.js +221 -13
- package/components/map3d/utils/OrbitControls3D.js +176 -5
- package/components/map3d/utils/Tiles3DStyle.js +238 -9
- package/components/share/ShareLink.js +54 -2
- package/components/share/ShareQRCode.js +62 -2
- package/components/share/ShareSocials.js +125 -3
- package/components/timeline/FixedTimeline.js +236 -5
- package/components/timeline/InfiniteTimeline.js +347 -8
- package/components/timeline/TimelineFeaturesSlider.js +439 -5
- package/components/widgets/AccordeonWidget.js +96 -2
- package/components/widgets/ButtonBar.js +124 -2
- package/components/widgets/ColorButton.js +201 -3
- package/components/widgets/ComboBox.js +166 -2
- package/components/widgets/CopyButton.js +110 -2
- package/components/widgets/DateTimeInput.js +100 -3
- package/components/widgets/EditableSelect.js +230 -3
- package/components/widgets/FileSelector.js +128 -4
- package/components/widgets/Input.js +124 -2
- package/components/widgets/InputContainer.js +96 -2
- package/components/widgets/LayerCatalogWidget.js +219 -3
- package/components/widgets/MenuButton.js +157 -1
- package/components/widgets/ModalDialog.js +64 -2
- package/components/widgets/NavBar.js +119 -2
- package/components/widgets/NumberInput.js +226 -4
- package/components/widgets/PopupMenu.js +72 -1
- package/components/widgets/Primitives.js +6 -1
- package/components/widgets/ReCaptchaWidget.js +55 -1
- package/components/widgets/SearchWidget.js +255 -2
- package/components/widgets/Spinner.js +44 -2
- package/components/widgets/SuggestionInput.js +77 -2
- package/components/widgets/TextInput.js +308 -2
- package/components/widgets/ToggleSwitch.js +85 -2
- package/components/widgets/VectorLayerPicker.js +85 -3
- package/libs/openlayers.js +225 -5
- package/package.json +1 -1
- package/plugins/API.js +358 -15
- package/plugins/AttributeTable.js +109 -3
- package/plugins/Authentication.js +130 -5
- package/plugins/BackgroundSwitcher.js +218 -4
- package/plugins/Bookmark.js +289 -3
- package/plugins/BottomBar.js +298 -4
- package/plugins/CookiePopup.js +67 -3
- package/plugins/Cyclomedia.js +442 -5
- package/plugins/Editing.js +497 -9
- package/plugins/FeatureForm.js +366 -4
- package/plugins/FeatureSearch.js +458 -3
- package/plugins/GeometryDigitizer.js +664 -7
- package/plugins/HeightProfile.js +763 -15
- package/plugins/Help.js +102 -3
- package/plugins/HomeButton.js +80 -3
- package/plugins/Identify.js +543 -5
- package/plugins/LayerCatalog.js +215 -4
- package/plugins/LayerTree.js +1194 -6
- package/plugins/LocateButton.js +94 -3
- package/plugins/Map.js +320 -16
- package/plugins/MapCompare.js +94 -3
- package/plugins/MapCopyright.js +127 -5
- package/plugins/MapExport.js +613 -20
- package/plugins/MapFilter.js +868 -12
- package/plugins/MapInfoTooltip.js +277 -3
- package/plugins/MapLegend.js +253 -4
- package/plugins/MapTip.js +290 -4
- package/plugins/Measure.js +220 -4
- package/plugins/NewsPopup.js +137 -3
- package/plugins/OverviewMap.js +167 -7
- package/plugins/Panoramax.js +340 -2
- package/plugins/Portal.js +199 -4
- package/plugins/Print.js +1231 -15
- package/plugins/Redlining.js +750 -6
- package/plugins/Reports.js +332 -3
- package/plugins/Routing.js +1278 -15
- package/plugins/ScratchDrawing.js +173 -5
- package/plugins/Settings.js +241 -4
- package/plugins/Share.js +198 -3
- package/plugins/StartupMarker.js +84 -4
- package/plugins/TaskButton.js +88 -3
- package/plugins/ThemeSwitcher.js +164 -4
- package/plugins/TimeManager.js +971 -10
- package/plugins/TopBar.js +300 -7
- package/plugins/TourGuide.js +213 -2
- package/plugins/ValueTool.js +419 -4
- package/plugins/View3D.js +519 -14
- package/plugins/ZoomButtons.js +165 -3
- package/plugins/map/EditingSupport.js +199 -7
- package/plugins/map/LocateSupport.js +260 -4
- package/plugins/map/MeasurementSupport.js +216 -8
- package/plugins/map/RedliningPickSupport.js +201 -7
- package/plugins/map/RedliningSupport.js +726 -17
- package/plugins/map/SnapInteraction.js +101 -1
- package/plugins/map/SnapSupport.js +210 -2
- package/plugins/map/SnappingSupport.js +356 -17
- package/plugins/map3d/BackgroundSwitcher3D.js +44 -3
- package/plugins/map3d/BottomBar3D.js +118 -3
- package/plugins/map3d/Compare3D.js +422 -8
- package/plugins/map3d/Draw3D.js +353 -6
- package/plugins/map3d/ExportObjects3D.js +393 -18
- package/plugins/map3d/HideObjects3D.js +313 -12
- package/plugins/map3d/Identify3D.js +283 -12
- package/plugins/map3d/LayerTree3D.js +323 -3
- package/plugins/map3d/MapCopyright3D.js +128 -5
- package/plugins/map3d/MapExport3D.js +590 -10
- package/plugins/map3d/MapLight3D.js +553 -6
- package/plugins/map3d/Measure3D.js +571 -20
- package/plugins/map3d/OverviewMap3D.js +169 -3
- package/plugins/map3d/Settings3D.js +73 -3
- package/plugins/map3d/TopBar3D.js +207 -9
- package/plugins/redlining/RedliningBufferSupport.js +206 -3
- package/reducers/display.js +34 -2
- package/reducers/editing.js +68 -3
- package/reducers/index.js +9 -1
- package/reducers/layerinfo.js +26 -2
- package/reducers/layers.js +456 -9
- package/reducers/localConfig.js +122 -2
- package/reducers/locale.js +38 -2
- package/reducers/locate.js +40 -2
- package/reducers/map.js +176 -5
- package/reducers/measurement.js +42 -2
- package/reducers/processNotifications.js +49 -2
- package/reducers/redlining.js +50 -2
- package/reducers/redliningPick.js +27 -2
- package/reducers/search.js +20 -1
- package/reducers/serviceinfo.js +25 -2
- package/reducers/task.js +45 -2
- package/reducers/theme.js +51 -2
- package/reducers/windows.js +203 -2
- package/scripts/dist.sh +1 -1
- package/scripts/gen-plugin-docs.js +152 -2
- package/scripts/makeIconkit.js +85 -6
- package/scripts/themesConfig.js +742 -40
- package/scripts/updateTranslations.js +251 -10
- package/selectors/searchproviders.js +44 -2
- package/stores/StandardStore.js +42 -2
- package/utils/ConfigUtils.js +84 -3
- package/utils/CoordinatesUtils.js +234 -23
- package/utils/DxfUtils.js +237 -11
- package/utils/EditingInterface.js +421 -87
- package/utils/EditingUtils.js +357 -13
- package/utils/ElevationInterface.js +83 -22
- package/utils/FeatureStyles.js +429 -5
- package/utils/IdentifyUtils.js +443 -7
- package/utils/ImageEditor.js +79 -9
- package/utils/LayerUtils.js +1516 -50
- package/utils/LocaleUtils.js +117 -7
- package/utils/MapUtils.js +241 -59
- package/utils/MeasureUtils.js +323 -2
- package/utils/MiscUtils.js +189 -11
- package/utils/PermaLinkUtils.js +429 -6
- package/utils/PluginStore.js +27 -1
- package/utils/ResourceRegistry.js +15 -1
- package/utils/RoutingInterface.js +307 -7
- package/utils/SearchProviders.js +722 -19
- package/utils/ServiceLayerUtils.js +669 -14
- package/utils/Signal.js +32 -2
- package/utils/ThemeUtils.js +341 -7
- package/utils/VectorLayerUtils.js +589 -15
- package/utils/expr_grammar/grammar.js +2239 -2
- package/utils/expr_grammar/test.js +65 -3
package/plugins/Redlining.js
CHANGED
|
@@ -1,12 +1,756 @@
|
|
|
1
|
-
function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
3
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
5
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
6
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
7
|
+
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."); }
|
|
8
|
+
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; } }
|
|
9
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
10
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
11
|
+
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; }
|
|
12
|
+
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; }
|
|
13
|
+
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; }
|
|
14
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
15
|
+
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); } }
|
|
16
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
17
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
18
|
+
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); }
|
|
19
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
20
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
21
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
22
|
+
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); }
|
|
23
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
24
|
+
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; }
|
|
25
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
26
|
+
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); }
|
|
27
|
+
/**
|
|
2
28
|
* Copyright 2017-2024 Sourcepole AG
|
|
3
29
|
* All rights reserved.
|
|
4
30
|
*
|
|
5
31
|
* This source code is licensed under the BSD-style license found in the
|
|
6
32
|
* LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
import React from 'react';
|
|
36
|
+
import { connect } from 'react-redux';
|
|
37
|
+
import FileSaver from 'file-saver';
|
|
38
|
+
import ol from 'openlayers';
|
|
39
|
+
import PropTypes from 'prop-types';
|
|
40
|
+
import { LayerRole, addLayer } from '../actions/layers';
|
|
41
|
+
import { setSnappingConfig } from '../actions/map';
|
|
42
|
+
import { changeRedliningState, resetRedliningState } from '../actions/redlining';
|
|
43
|
+
import Icon from '../components/Icon';
|
|
44
|
+
import TaskBar from '../components/TaskBar';
|
|
45
|
+
import ButtonBar from '../components/widgets/ButtonBar';
|
|
46
|
+
import ColorButton from '../components/widgets/ColorButton';
|
|
47
|
+
import ComboBox from '../components/widgets/ComboBox';
|
|
48
|
+
import MenuButton from '../components/widgets/MenuButton';
|
|
49
|
+
import NumberInput from '../components/widgets/NumberInput';
|
|
50
|
+
import VectorLayerPicker from '../components/widgets/VectorLayerPicker';
|
|
51
|
+
import ConfigUtils from '../utils/ConfigUtils';
|
|
52
|
+
import { END_MARKERS } from '../utils/FeatureStyles';
|
|
53
|
+
import LocaleUtils from '../utils/LocaleUtils';
|
|
54
|
+
import MapUtils from '../utils/MapUtils';
|
|
55
|
+
import VectorLayerUtils from '../utils/VectorLayerUtils';
|
|
56
|
+
import './style/Redlining.css';
|
|
57
|
+
|
|
58
|
+
/**
|
|
8
59
|
* Allows drawing figures and text labels on the map.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
if(feature.getGeometry()instanceof ol.geom.Circle){feature=feature.clone();feature.setGeometry(ol.geom.polygonFromCircle(feature.getGeometry()))}return feature});var data=kmlFormat.writeFeatures(features,{featureProjection:_this.props.mapCrs});FileSaver.saveAs(new Blob([data],{type:"application/vnd.google-earth.kml+xml"}),_layer.title+".kml")}});_defineProperty(_this,"renderStandardControls",function(){var sizeLabel=LocaleUtils.tr("redlining.line");var showDash=true;if(["Text","Point"].includes(_this.props.redlining.geomType)){sizeLabel=LocaleUtils.tr("redlining.size");showDash=false}var labelPlaceholder=LocaleUtils.tr("redlining.label");if(_this.props.redlining.geomType==="Text"){labelPlaceholder=LocaleUtils.tr("redlining.text")}if(_this.props.redlining.action!=="Draw"&&!_this.props.redlining.selectedFeature){return null}return/*#__PURE__*/React.createElement("div",{className:"redlining-controlsbar"},/*#__PURE__*/React.createElement("div",{className:"redlining-control"},/*#__PURE__*/React.createElement(Icon,{className:"redlining-control-icon",icon:"pen",size:"large"}),_this.props.redlining.geomType==="Text"?/*#__PURE__*/React.createElement(ColorButton,{color:_this.props.redlining.style.textOutlineColor,defaultColors:_this.props.predefinedBorderColors,onColorChanged:function onColorChanged(color){return _this.updateRedliningStyle({textOutlineColor:color})}}):/*#__PURE__*/React.createElement(ColorButton,{color:_this.props.redlining.style.borderColor,defaultColors:_this.props.predefinedBorderColors,onColorChanged:function onColorChanged(color){return _this.updateRedliningStyle({borderColor:color})}})),_this.props.redlining.geomType==="LineString"?null:/*#__PURE__*/React.createElement("div",{className:"redlining-control"},/*#__PURE__*/React.createElement(Icon,{className:"redlining-control-icon",icon:"fill",size:"large"}),_this.props.redlining.geomType==="Text"?/*#__PURE__*/React.createElement(ColorButton,{color:_this.props.redlining.style.textFillColor,defaultColors:_this.props.predefinedFillColors,onColorChanged:function onColorChanged(color){return _this.updateRedliningStyle({textFillColor:color})}}):/*#__PURE__*/React.createElement(ColorButton,{color:_this.props.redlining.style.fillColor,defaultColors:_this.props.predefinedFillColors,onColorChanged:function onColorChanged(color){return _this.updateRedliningStyle({fillColor:color})}})),/*#__PURE__*/React.createElement("div",{className:"redlining-control"},/*#__PURE__*/React.createElement("span",null,sizeLabel,":\xA0"),/*#__PURE__*/React.createElement(NumberInput,{max:99,min:1,mobile:true,onChange:function onChange(nr){return _this.updateRedliningStyle({size:nr})},value:_this.props.redlining.style.size}),showDash?/*#__PURE__*/React.createElement(ComboBox,{onChange:function onChange(value){return _this.updateRedliningStyle({strokeDash:value.split(":").filter(Boolean).map(Number)})},value:_this.props.redlining.style.strokeDash.join(":")},_this.props.predefinedDashPatterns.map(function(pattern){var value=pattern.join(":");return/*#__PURE__*/React.createElement("div",{className:"redlining-dash-combo-entry",key:value,value:value},/*#__PURE__*/React.createElement("img",{src:_this.dashIcons[value]}))})):null),_this.props.redlining.geomType==="LineString"?/*#__PURE__*/React.createElement("div",{className:"redlining-control"},/*#__PURE__*/React.createElement("span",null,LocaleUtils.tr("redlining.markers"),":\xA0"),/*#__PURE__*/React.createElement("div",{className:"controlgroup"},/*#__PURE__*/React.createElement(ComboBox,{className:"redlining-marker-combo",onChange:function onChange(value){return _this.updateRedliningStyle({headmarker:value})},value:_this.props.redlining.style.headmarker||""},/*#__PURE__*/React.createElement("div",{className:"redlining-marker-combo-entry",value:""}),Object.entries(END_MARKERS).map(function(_ref){var _ref2=_slicedToArray(_ref,2),key=_ref2[0],params=_ref2[1];return/*#__PURE__*/React.createElement("div",{className:"redlining-marker-combo-entry",key:key,value:key},/*#__PURE__*/React.createElement("img",{src:params.src,style:{transform:"rotate("+params.baserotation+"deg)"}}))})),/*#__PURE__*/React.createElement(ComboBox,{className:"redlining-marker-combo",onChange:function onChange(value){return _this.updateRedliningStyle({tailmarker:value})},value:_this.props.redlining.style.tailmarker||""},/*#__PURE__*/React.createElement("div",{className:"redlining-marker-combo-entry",value:""}),Object.entries(END_MARKERS).map(function(_ref3){var _ref4=_slicedToArray(_ref3,2),key=_ref4[0],params=_ref4[1];return/*#__PURE__*/React.createElement("div",{className:"redlining-marker-combo-entry",key:key,value:key},/*#__PURE__*/React.createElement("img",{src:params.src,style:{transform:"rotate("+(180+params.baserotation)+"deg)"}}))})))):null,/*#__PURE__*/React.createElement("div",{className:"redlining-control redlining-control-fill"},/*#__PURE__*/React.createElement("div",{className:"controlgroup"},_this.props.redlining.geomType!=="Text"&&_this.props.allowGeometryLabels?/*#__PURE__*/React.createElement("button",{className:"button"+(_this.props.redlining.measurements?" pressed":""),onClick:function onClick(){return _this.props.changeRedliningState({measurements:!_this.props.redlining.measurements,style:_objectSpread(_objectSpread({},_this.props.redlining.style),{},{text:""})})},title:LocaleUtils.tr("redlining.measurements")},/*#__PURE__*/React.createElement(Icon,{icon:"measure"})):null,(_this.props.redlining.geomType==="Text"||_this.props.allowGeometryLabels)&&!_this.props.redlining.measurements?/*#__PURE__*/React.createElement("input",{className:"controlgroup-fillitem",onChange:function onChange(ev){return _this.updateRedliningStyle({text:ev.target.value})},placeholder:labelPlaceholder,readOnly:_this.props.redlining.measurements,ref:function ref(el){return _this.setLabelRef(el)},type:"text",value:_this.props.redlining.style.text}):null,_this.props.redlining.measurements&&["LineString","Circle"].includes(_this.props.redlining.geomType)?/*#__PURE__*/React.createElement("select",{className:"controlgroup-fillitem",onChange:function onChange(ev){return _this.props.changeRedliningState({lenUnit:ev.target.value})},value:_this.props.redlining.lenUnit},/*#__PURE__*/React.createElement("option",{value:"metric"},LocaleUtils.tr("measureComponent.metric")),/*#__PURE__*/React.createElement("option",{value:"imperial"},LocaleUtils.tr("measureComponent.imperial")),/*#__PURE__*/React.createElement("option",{value:"m"},"m"),/*#__PURE__*/React.createElement("option",{value:"km"},"km"),/*#__PURE__*/React.createElement("option",{value:"ft"},"ft"),/*#__PURE__*/React.createElement("option",{value:"mi"},"mi")):null,_this.props.redlining.measurements&&["Polygon","Ellipse","Square","Box"].includes(_this.props.redlining.geomType)?/*#__PURE__*/React.createElement("select",{className:"controlgroup-fillitem",onChange:function onChange(ev){return _this.props.changeRedliningState({areaUnit:ev.target.value})},value:_this.props.redlining.areaUnit},/*#__PURE__*/React.createElement("option",{value:"metric"},LocaleUtils.tr("measureComponent.metric")),/*#__PURE__*/React.createElement("option",{value:"imperial"},LocaleUtils.tr("measureComponent.imperial")),/*#__PURE__*/React.createElement("option",{value:"sqm"},"m\xB2"),/*#__PURE__*/React.createElement("option",{value:"ha"},"ha"),/*#__PURE__*/React.createElement("option",{value:"sqkm"},"km\xB2"),/*#__PURE__*/React.createElement("option",{value:"sqft"},"ft\xB2"),/*#__PURE__*/React.createElement("option",{value:"acre"},"acre"),/*#__PURE__*/React.createElement("option",{value:"sqmi"},"mi\xB2")):null)))});_defineProperty(_this,"setLabelRef",function(el){_this.labelInput=el;if(el&&_this.state.selectText){el.focus();el.select();_this.setState({selectText:false})}});_defineProperty(_this,"actionChanged",function(data){if(data.action==="Draw"&&data.geomType==="Text"){data=_objectSpread(_objectSpread({},data),{},{style:{text:LocaleUtils.tr("redlining.text")}})}else if(!_this.props.allowGeometryLabels){data=_objectSpread(_objectSpread({},data),{},{style:{text:""}})}_this.props.changeRedliningState(data)});_defineProperty(_this,"changeRedliningLayer",function(layer){var action=["Draw","Pick","Transform"].includes(_this.props.redlining.action)?_this.props.redlining.action:"Pick";_this.props.changeRedliningState({layer:layer.id,layerTitle:layer.title,action:action})});_this.labelInput=null;_this.dashIcons={};return _this}_inherits(Redlining,_React$Component);return _createClass(Redlining,[{key:"componentDidMount",value:function componentDidMount(){this.componentDidUpdate({redlining:{}})}},{key:"componentDidUpdate",value:function componentDidUpdate(prevProps){var _this2=this;if(this.props.defaultBorderColor!==prevProps.defaultBorderColor||this.props.defaultFillColor!==prevProps.defaultFillColor||this.props.defaultLengthUnit!==prevProps.defaultLengthUnit||this.props.defaultAreaUnit!==prevProps.defaultAreaUnit||this.props.defaultTextFillColor!==prevProps.defaultTextFillColor||this.props.defaultTextOutlineColor!==prevProps.defaultTextOutlineColor){this.props.changeRedliningState(this.redliningStateDefaults())}if(prevProps.redlining.geomType!==this.props.redlining.geomType&&this.props.redlining.geomType==="Text"&&!this.state.selectText){this.setState({selectText:true})}if(!this.props.layers.find(function(layer){return layer.id===_this2.props.redlining.layer})){var vectorLayers=this.props.layers.filter(function(layer){return layer.type==="vector"&&layer.role===LayerRole.USERLAYER&&!layer.readonly});if(vectorLayers.length>=1){this.props.changeRedliningState({layer:vectorLayers[0].id,layerTitle:vectorLayers[0].title})}else if(this.props.redlining.layer!=="redlining"){this.props.changeRedliningState({layer:"redlining",layerTitle:LocaleUtils.tr("redlining.layertitle")})}}if(this.props.predefinedDashPatterns!==prevProps.predefinedDashPatterns){this.generateDashIcons()}}},{key:"render",value:function render(){var _this3=this;return/*#__PURE__*/React.createElement(TaskBar,{onHide:this.onHide,onShow:this.onShow,task:"Redlining"},function(){return{body:_this3.renderBody()}})}}])}(React.Component);_defineProperty(Redlining,"propTypes",{addLayer:PropTypes.func,/** Whether to allow labeling geometric figures. */allowGeometryLabels:PropTypes.bool,changeRedliningState:PropTypes.func,/** Default area unit. Options: `metric`, `imperial`, `sqm`, `ha`, `sqkm`, `sqft`, `acre`, `sqmi` */defaultAreaUnit:PropTypes.string,/** Default border color. In format `[r, g, b, a]`. */defaultBorderColor:PropTypes.array,/** Default fill color. In format `[r, g, b, a]`. */defaultFillColor:PropTypes.array,/** Default length unit. Options: `metric`, `imperial`, `m`, `km`, `ft`, `mi` */defaultLengthUnit:PropTypes.string,/** Default text fill color. In format `[r, g, b, a]`. */defaultTextFillColor:PropTypes.array,/** Default text outline color. In format `[r, g, b, a]`. */defaultTextOutlineColor:PropTypes.array,/** Tools to hide. Available tools: `Circle`, `Ellipse`, `Square`, `Box`, `HandDrawing`, `Transform`, `NumericInput`, `Buffer`, `Export`. */hiddenTools:PropTypes.array,layers:PropTypes.array,mapCrs:PropTypes.string,plugins:PropTypes.object,/** Predefined border colors. In format `[[r, g, b, a], ...]`. */predefinedBorderColors:PropTypes.arrayOf(PropTypes.array),/** Predefined dash patterns. In format `[<dash-array>, ...]`, where a dash-array is list of alternating dash and gap widths, i.e. `[8 4]` for long dashes followed by shorter gaps. */predefinedDashPatterns:PropTypes.arrayOf(PropTypes.array),/** Predefined fill colors. In format `[[r, g, b, a], ...]`. */predefinedFillColors:PropTypes.arrayOf(PropTypes.array),redlining:PropTypes.object,resetRedliningState:PropTypes.func,setCurrentTask:PropTypes.func,setSnappingConfig:PropTypes.func,/** Whether snapping is available when editing. */snapping:PropTypes.bool,/** Whether snapping is enabled by default when editing.
|
|
12
|
-
|
|
60
|
+
*/
|
|
61
|
+
var Redlining = /*#__PURE__*/function (_React$Component) {
|
|
62
|
+
function Redlining(props) {
|
|
63
|
+
var _this;
|
|
64
|
+
_classCallCheck(this, Redlining);
|
|
65
|
+
_this = _callSuper(this, Redlining, [props]);
|
|
66
|
+
_defineProperty(_this, "state", {
|
|
67
|
+
selectText: false
|
|
68
|
+
});
|
|
69
|
+
_defineProperty(_this, "onShow", function (mode, data) {
|
|
70
|
+
var _data$geomType;
|
|
71
|
+
_this.props.changeRedliningState(_objectSpread({
|
|
72
|
+
action: mode !== null && mode !== void 0 ? mode : 'Pick',
|
|
73
|
+
geomType: (_data$geomType = data === null || data === void 0 ? void 0 : data.geomType) !== null && _data$geomType !== void 0 ? _data$geomType : null
|
|
74
|
+
}, _this.redliningStateDefaults()));
|
|
75
|
+
_this.props.setSnappingConfig(_this.props.snapping, _this.props.snappingActive);
|
|
76
|
+
if (data && data.layerId) {
|
|
77
|
+
var layer = _this.props.layers.find(function (l) {
|
|
78
|
+
return l.id === data.layerId;
|
|
79
|
+
});
|
|
80
|
+
if (layer) {
|
|
81
|
+
_this.changeRedliningLayer(layer);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
_defineProperty(_this, "onHide", function () {
|
|
86
|
+
_this.props.resetRedliningState();
|
|
87
|
+
});
|
|
88
|
+
_defineProperty(_this, "redliningStateDefaults", function () {
|
|
89
|
+
return {
|
|
90
|
+
style: _objectSpread(_objectSpread({}, _this.props.redlining.style), {}, {
|
|
91
|
+
borderColor: _this.props.defaultBorderColor,
|
|
92
|
+
fillColor: _this.props.defaultFillColor,
|
|
93
|
+
textOutlineColor: _this.props.defaultTextOutlineColor,
|
|
94
|
+
textFillColor: _this.props.defaultTextFillColor
|
|
95
|
+
}),
|
|
96
|
+
lenUnit: _this.props.defaultLengthUnit,
|
|
97
|
+
areaUnit: _this.props.defaultAreaUnit
|
|
98
|
+
};
|
|
99
|
+
});
|
|
100
|
+
_defineProperty(_this, "generateDashIcons", function () {
|
|
101
|
+
_this.dashIcons = _this.props.predefinedDashPatterns.reduce(function (res, pattern) {
|
|
102
|
+
var svg = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"32\" height=\"16\"><line x1=\"0\" y1=\"8\" x2=\"32\" y2=\"8\" stroke=\"black\" stroke-width=\"2\" stroke-dasharray=\"".concat(pattern.join(" "), "\"></line></svg>");
|
|
103
|
+
res[pattern.join(":")] = "data:image/svg+xml;base64,".concat(btoa(svg));
|
|
104
|
+
return res;
|
|
105
|
+
}, {});
|
|
106
|
+
});
|
|
107
|
+
_defineProperty(_this, "updateRedliningStyle", function (diff) {
|
|
108
|
+
var newStyle = _objectSpread(_objectSpread({}, _this.props.redlining.style), diff);
|
|
109
|
+
_this.props.changeRedliningState({
|
|
110
|
+
style: newStyle
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
_defineProperty(_this, "renderBody", function () {
|
|
114
|
+
var _this$props$layers$fi;
|
|
115
|
+
var toolEnabled = function toolEnabled(tool) {
|
|
116
|
+
return !_this.props.hiddenTools.includes(tool);
|
|
117
|
+
};
|
|
118
|
+
var activeButton = _this.props.redlining.action === "Draw" ? _this.props.redlining.geomType : _this.props.redlining.action;
|
|
119
|
+
var drawButtons = [{
|
|
120
|
+
key: "Point",
|
|
121
|
+
tooltip: LocaleUtils.tr("redlining.point"),
|
|
122
|
+
icon: "point",
|
|
123
|
+
data: {
|
|
124
|
+
action: "Draw",
|
|
125
|
+
geomType: "Point",
|
|
126
|
+
text: ""
|
|
127
|
+
}
|
|
128
|
+
}, {
|
|
129
|
+
key: "LineString",
|
|
130
|
+
tooltip: LocaleUtils.tr("redlining.line"),
|
|
131
|
+
icon: "line",
|
|
132
|
+
data: {
|
|
133
|
+
action: "Draw",
|
|
134
|
+
geomType: "LineString",
|
|
135
|
+
text: ""
|
|
136
|
+
}
|
|
137
|
+
}, {
|
|
138
|
+
key: "Polygon",
|
|
139
|
+
tooltip: LocaleUtils.tr("redlining.polygon"),
|
|
140
|
+
icon: "polygon",
|
|
141
|
+
data: {
|
|
142
|
+
action: "Draw",
|
|
143
|
+
geomType: "Polygon",
|
|
144
|
+
text: ""
|
|
145
|
+
}
|
|
146
|
+
}, [toolEnabled("Circle") ? {
|
|
147
|
+
key: "Circle",
|
|
148
|
+
tooltip: LocaleUtils.tr("redlining.circle"),
|
|
149
|
+
icon: "circle",
|
|
150
|
+
data: {
|
|
151
|
+
action: "Draw",
|
|
152
|
+
geomType: "Circle",
|
|
153
|
+
text: ""
|
|
154
|
+
}
|
|
155
|
+
} : null, toolEnabled("Ellipse") ? {
|
|
156
|
+
key: "Ellipse",
|
|
157
|
+
tooltip: LocaleUtils.tr("redlining.ellipse"),
|
|
158
|
+
icon: "ellipse",
|
|
159
|
+
data: {
|
|
160
|
+
action: "Draw",
|
|
161
|
+
geomType: "Ellipse",
|
|
162
|
+
text: ""
|
|
163
|
+
}
|
|
164
|
+
} : null, toolEnabled("Square") ? {
|
|
165
|
+
key: "Square",
|
|
166
|
+
tooltip: LocaleUtils.tr("redlining.square"),
|
|
167
|
+
icon: "box",
|
|
168
|
+
data: {
|
|
169
|
+
action: "Draw",
|
|
170
|
+
geomType: "Square",
|
|
171
|
+
text: ""
|
|
172
|
+
}
|
|
173
|
+
} : null, toolEnabled("Box") ? {
|
|
174
|
+
key: "Box",
|
|
175
|
+
tooltip: LocaleUtils.tr("redlining.rectangle"),
|
|
176
|
+
icon: "rect",
|
|
177
|
+
data: {
|
|
178
|
+
action: "Draw",
|
|
179
|
+
geomType: "Box",
|
|
180
|
+
text: ""
|
|
181
|
+
}
|
|
182
|
+
} : null].filter(Boolean), {
|
|
183
|
+
key: "Text",
|
|
184
|
+
tooltip: LocaleUtils.tr("redlining.text"),
|
|
185
|
+
icon: "text",
|
|
186
|
+
data: {
|
|
187
|
+
action: "Draw",
|
|
188
|
+
geomType: "Text",
|
|
189
|
+
text: "",
|
|
190
|
+
measurements: false
|
|
191
|
+
}
|
|
192
|
+
}];
|
|
193
|
+
if (ConfigUtils.isMobile()) {
|
|
194
|
+
drawButtons = [drawButtons.flat()];
|
|
195
|
+
}
|
|
196
|
+
var activeFreeHand = _this.props.redlining.freehand ? "HandDrawing" : null;
|
|
197
|
+
var freehandButtons = toolEnabled("HandWriting") ? [{
|
|
198
|
+
key: "HandDrawing",
|
|
199
|
+
tooltip: LocaleUtils.tr("redlining.freehand"),
|
|
200
|
+
icon: "freehand",
|
|
201
|
+
data: {
|
|
202
|
+
action: "Draw",
|
|
203
|
+
geomType: _this.props.redlining.geomType,
|
|
204
|
+
text: "",
|
|
205
|
+
freehand: !_this.props.redlining.freehand
|
|
206
|
+
},
|
|
207
|
+
disabled: _this.props.redlining.geomType !== "LineString" && _this.props.redlining.geomType !== "Polygon"
|
|
208
|
+
}] : [];
|
|
209
|
+
var editButtons = [{
|
|
210
|
+
key: "Pick",
|
|
211
|
+
tooltip: LocaleUtils.tr("redlining.pick"),
|
|
212
|
+
icon: "nodetool",
|
|
213
|
+
data: {
|
|
214
|
+
action: "Pick",
|
|
215
|
+
geomType: null,
|
|
216
|
+
text: ""
|
|
217
|
+
}
|
|
218
|
+
}, toolEnabled("Transform") ? {
|
|
219
|
+
key: "Transform",
|
|
220
|
+
tooltip: LocaleUtils.tr("redlining.transform"),
|
|
221
|
+
icon: "transformtool",
|
|
222
|
+
data: {
|
|
223
|
+
action: "Transform",
|
|
224
|
+
geomType: null,
|
|
225
|
+
text: ""
|
|
226
|
+
}
|
|
227
|
+
} : null, {
|
|
228
|
+
key: "Delete",
|
|
229
|
+
tooltip: LocaleUtils.tr("redlining.delete"),
|
|
230
|
+
icon: "trash",
|
|
231
|
+
data: {
|
|
232
|
+
action: "Delete",
|
|
233
|
+
geomType: null
|
|
234
|
+
},
|
|
235
|
+
disabled: !_this.props.redlining.selectedFeature
|
|
236
|
+
}].filter(Boolean);
|
|
237
|
+
var extraButtons = toolEnabled("NumericInput") ? [{
|
|
238
|
+
key: "NumericInput",
|
|
239
|
+
tooltip: LocaleUtils.tr("redlining.numericinput"),
|
|
240
|
+
icon: "numericinput"
|
|
241
|
+
}] : [];
|
|
242
|
+
for (var _i = 0, _Object$values = Object.values(_this.props.plugins || {}); _i < _Object$values.length; _i++) {
|
|
243
|
+
var plugin = _Object$values[_i];
|
|
244
|
+
if (toolEnabled(plugin.cfg.key)) {
|
|
245
|
+
editButtons.push(_objectSpread(_objectSpread({}, plugin.cfg), {}, {
|
|
246
|
+
tooltip: plugin.cfg.tooltip ? LocaleUtils.tr(plugin.cfg.tooltip) : undefined
|
|
247
|
+
}));
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
var vectorLayers = _this.props.layers.filter(function (layer) {
|
|
251
|
+
return layer.type === "vector" && layer.role === LayerRole.USERLAYER && !layer.readonly;
|
|
252
|
+
});
|
|
253
|
+
// Ensure list always contains at least a "Redlining" layer
|
|
254
|
+
if (vectorLayers.length === 0) {
|
|
255
|
+
vectorLayers = [{
|
|
256
|
+
id: 'redlining',
|
|
257
|
+
title: LocaleUtils.tr('redlining.layertitle')
|
|
258
|
+
}].concat(_toConsumableArray(vectorLayers));
|
|
259
|
+
}
|
|
260
|
+
var haveLayer = (((_this$props$layers$fi = _this.props.layers.find(function (l) {
|
|
261
|
+
return l.id === _this.props.redlining.layer;
|
|
262
|
+
})) === null || _this$props$layers$fi === void 0 || (_this$props$layers$fi = _this$props$layers$fi.features) === null || _this$props$layers$fi === void 0 ? void 0 : _this$props$layers$fi.length) || 0) > 0;
|
|
263
|
+
var activePlugin = Object.values(_this.props.plugins || {}).find(function (plugin) {
|
|
264
|
+
return plugin.cfg.key === _this.props.redlining.action;
|
|
265
|
+
});
|
|
266
|
+
var controls = activePlugin ? /*#__PURE__*/React.createElement(activePlugin.controls, null) : _this.renderStandardControls();
|
|
267
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
268
|
+
className: "redlining-controlsbar"
|
|
269
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
270
|
+
className: "redlining-groupcontrol"
|
|
271
|
+
}, /*#__PURE__*/React.createElement("div", null, LocaleUtils.tr("redlining.layer")), /*#__PURE__*/React.createElement(VectorLayerPicker, {
|
|
272
|
+
addLayer: _this.props.addLayer,
|
|
273
|
+
layers: vectorLayers,
|
|
274
|
+
onChange: _this.changeRedliningLayer,
|
|
275
|
+
value: _this.props.redlining.layer
|
|
276
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
277
|
+
className: "redlining-groupcontrol"
|
|
278
|
+
}, /*#__PURE__*/React.createElement("div", null, LocaleUtils.tr("redlining.draw")), /*#__PURE__*/React.createElement("div", {
|
|
279
|
+
className: "controlgroup"
|
|
280
|
+
}, /*#__PURE__*/React.createElement(ButtonBar, {
|
|
281
|
+
active: activeButton,
|
|
282
|
+
buttons: drawButtons,
|
|
283
|
+
onClick: function onClick(key, data) {
|
|
284
|
+
return _this.actionChanged(data);
|
|
285
|
+
}
|
|
286
|
+
}), _this.props.redlining.action === "Draw" && (_this.props.redlining.geomType === "LineString" || _this.props.redlining.geomType === "Polygon") ? /*#__PURE__*/React.createElement(ButtonBar, {
|
|
287
|
+
active: activeFreeHand,
|
|
288
|
+
buttons: freehandButtons,
|
|
289
|
+
onClick: function onClick(key, data) {
|
|
290
|
+
return _this.actionChanged(data);
|
|
291
|
+
}
|
|
292
|
+
}) : null)), /*#__PURE__*/React.createElement("div", {
|
|
293
|
+
className: "redlining-groupcontrol"
|
|
294
|
+
}, /*#__PURE__*/React.createElement("div", null, LocaleUtils.tr("redlining.edit")), /*#__PURE__*/React.createElement(ButtonBar, {
|
|
295
|
+
active: activeButton,
|
|
296
|
+
buttons: editButtons,
|
|
297
|
+
onClick: function onClick(key, data) {
|
|
298
|
+
return _this.actionChanged(data);
|
|
299
|
+
}
|
|
300
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
301
|
+
className: "redlining-groupcontrol"
|
|
302
|
+
}, /*#__PURE__*/React.createElement("div", null, "\xA0"), /*#__PURE__*/React.createElement(ButtonBar, {
|
|
303
|
+
active: _this.props.redlining.numericInput ? "NumericInput" : null,
|
|
304
|
+
buttons: extraButtons,
|
|
305
|
+
onClick: function onClick() {
|
|
306
|
+
return _this.props.changeRedliningState({
|
|
307
|
+
numericInput: !_this.props.redlining.numericInput
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
})), toolEnabled("Export") ? /*#__PURE__*/React.createElement("div", {
|
|
311
|
+
className: "redlining-groupcontrol"
|
|
312
|
+
}, /*#__PURE__*/React.createElement("div", null, "\xA0"), /*#__PURE__*/React.createElement(MenuButton, {
|
|
313
|
+
className: "redlining-export-menu",
|
|
314
|
+
disabled: !haveLayer,
|
|
315
|
+
menuIcon: "export",
|
|
316
|
+
onActivate: _this["export"],
|
|
317
|
+
tooltip: LocaleUtils.tr("redlining.export")
|
|
318
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
319
|
+
className: "redlining-export-menu-entry",
|
|
320
|
+
key: "GeoJSON",
|
|
321
|
+
value: "geojson"
|
|
322
|
+
}, "GeoJSON"), /*#__PURE__*/React.createElement("div", {
|
|
323
|
+
className: "redlining-export-menu-entry",
|
|
324
|
+
key: "KML",
|
|
325
|
+
value: "kml"
|
|
326
|
+
}, "KML"))) : null), controls);
|
|
327
|
+
});
|
|
328
|
+
_defineProperty(_this, "export", function (type) {
|
|
329
|
+
if (type === "geojson") {
|
|
330
|
+
var layer = _this.props.layers.find(function (l) {
|
|
331
|
+
return l.id === _this.props.redlining.layer;
|
|
332
|
+
});
|
|
333
|
+
if (!layer) {
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
var geojson = JSON.stringify({
|
|
337
|
+
type: "FeatureCollection",
|
|
338
|
+
features: layer.features.map(function (feature) {
|
|
339
|
+
var newFeature = _objectSpread(_objectSpread({}, feature), {}, {
|
|
340
|
+
geometry: VectorLayerUtils.reprojectGeometry(feature.geometry, feature.crs || _this.props.mapCrs, 'EPSG:4326')
|
|
341
|
+
});
|
|
342
|
+
delete newFeature.crs;
|
|
343
|
+
return newFeature;
|
|
344
|
+
})
|
|
345
|
+
}, null, ' ');
|
|
346
|
+
FileSaver.saveAs(new Blob([geojson], {
|
|
347
|
+
type: "text/plain;charset=utf-8"
|
|
348
|
+
}), layer.title + ".json");
|
|
349
|
+
} else if (type === "kml") {
|
|
350
|
+
var getNativeLayer = MapUtils.getHook(MapUtils.GET_NATIVE_LAYER);
|
|
351
|
+
var _layer = _this.props.layers.find(function (l) {
|
|
352
|
+
return l.id === _this.props.redlining.layer;
|
|
353
|
+
});
|
|
354
|
+
var nativeLayer = getNativeLayer(_this.props.redlining.layer);
|
|
355
|
+
if (!nativeLayer) {
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
var kmlFormat = new ol.format.KML();
|
|
359
|
+
var features = nativeLayer.getSource().getFeatures().map(function (feature) {
|
|
360
|
+
// Circle is not supported by kml format
|
|
361
|
+
if (feature.getGeometry() instanceof ol.geom.Circle) {
|
|
362
|
+
feature = feature.clone();
|
|
363
|
+
feature.setGeometry(ol.geom.polygonFromCircle(feature.getGeometry()));
|
|
364
|
+
}
|
|
365
|
+
return feature;
|
|
366
|
+
});
|
|
367
|
+
var data = kmlFormat.writeFeatures(features, {
|
|
368
|
+
featureProjection: _this.props.mapCrs
|
|
369
|
+
});
|
|
370
|
+
FileSaver.saveAs(new Blob([data], {
|
|
371
|
+
type: "application/vnd.google-earth.kml+xml"
|
|
372
|
+
}), _layer.title + ".kml");
|
|
373
|
+
}
|
|
374
|
+
});
|
|
375
|
+
_defineProperty(_this, "renderStandardControls", function () {
|
|
376
|
+
var sizeLabel = LocaleUtils.tr("redlining.line");
|
|
377
|
+
var showDash = true;
|
|
378
|
+
if (["Text", "Point"].includes(_this.props.redlining.geomType)) {
|
|
379
|
+
sizeLabel = LocaleUtils.tr("redlining.size");
|
|
380
|
+
showDash = false;
|
|
381
|
+
}
|
|
382
|
+
var labelPlaceholder = LocaleUtils.tr("redlining.label");
|
|
383
|
+
if (_this.props.redlining.geomType === "Text") {
|
|
384
|
+
labelPlaceholder = LocaleUtils.tr("redlining.text");
|
|
385
|
+
}
|
|
386
|
+
if (_this.props.redlining.action !== 'Draw' && !_this.props.redlining.selectedFeature) {
|
|
387
|
+
return null;
|
|
388
|
+
}
|
|
389
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
390
|
+
className: "redlining-controlsbar"
|
|
391
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
392
|
+
className: "redlining-control"
|
|
393
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
394
|
+
className: "redlining-control-icon",
|
|
395
|
+
icon: "pen",
|
|
396
|
+
size: "large"
|
|
397
|
+
}), _this.props.redlining.geomType === 'Text' ? /*#__PURE__*/React.createElement(ColorButton, {
|
|
398
|
+
color: _this.props.redlining.style.textOutlineColor,
|
|
399
|
+
defaultColors: _this.props.predefinedBorderColors,
|
|
400
|
+
onColorChanged: function onColorChanged(color) {
|
|
401
|
+
return _this.updateRedliningStyle({
|
|
402
|
+
textOutlineColor: color
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
}) : /*#__PURE__*/React.createElement(ColorButton, {
|
|
406
|
+
color: _this.props.redlining.style.borderColor,
|
|
407
|
+
defaultColors: _this.props.predefinedBorderColors,
|
|
408
|
+
onColorChanged: function onColorChanged(color) {
|
|
409
|
+
return _this.updateRedliningStyle({
|
|
410
|
+
borderColor: color
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
})), _this.props.redlining.geomType === 'LineString' ? null : /*#__PURE__*/React.createElement("div", {
|
|
414
|
+
className: "redlining-control"
|
|
415
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
416
|
+
className: "redlining-control-icon",
|
|
417
|
+
icon: "fill",
|
|
418
|
+
size: "large"
|
|
419
|
+
}), _this.props.redlining.geomType === 'Text' ? /*#__PURE__*/React.createElement(ColorButton, {
|
|
420
|
+
color: _this.props.redlining.style.textFillColor,
|
|
421
|
+
defaultColors: _this.props.predefinedFillColors,
|
|
422
|
+
onColorChanged: function onColorChanged(color) {
|
|
423
|
+
return _this.updateRedliningStyle({
|
|
424
|
+
textFillColor: color
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
}) : /*#__PURE__*/React.createElement(ColorButton, {
|
|
428
|
+
color: _this.props.redlining.style.fillColor,
|
|
429
|
+
defaultColors: _this.props.predefinedFillColors,
|
|
430
|
+
onColorChanged: function onColorChanged(color) {
|
|
431
|
+
return _this.updateRedliningStyle({
|
|
432
|
+
fillColor: color
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
436
|
+
className: "redlining-control"
|
|
437
|
+
}, /*#__PURE__*/React.createElement("span", null, sizeLabel, ":\xA0"), /*#__PURE__*/React.createElement(NumberInput, {
|
|
438
|
+
max: 99,
|
|
439
|
+
min: 1,
|
|
440
|
+
mobile: true,
|
|
441
|
+
onChange: function onChange(nr) {
|
|
442
|
+
return _this.updateRedliningStyle({
|
|
443
|
+
size: nr
|
|
444
|
+
});
|
|
445
|
+
},
|
|
446
|
+
value: _this.props.redlining.style.size
|
|
447
|
+
}), showDash ? /*#__PURE__*/React.createElement(ComboBox, {
|
|
448
|
+
onChange: function onChange(value) {
|
|
449
|
+
return _this.updateRedliningStyle({
|
|
450
|
+
strokeDash: value.split(":").filter(Boolean).map(Number)
|
|
451
|
+
});
|
|
452
|
+
},
|
|
453
|
+
value: _this.props.redlining.style.strokeDash.join(":")
|
|
454
|
+
}, _this.props.predefinedDashPatterns.map(function (pattern) {
|
|
455
|
+
var value = pattern.join(":");
|
|
456
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
457
|
+
className: "redlining-dash-combo-entry",
|
|
458
|
+
key: value,
|
|
459
|
+
value: value
|
|
460
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
461
|
+
src: _this.dashIcons[value]
|
|
462
|
+
}));
|
|
463
|
+
})) : null), _this.props.redlining.geomType === 'LineString' ? /*#__PURE__*/React.createElement("div", {
|
|
464
|
+
className: "redlining-control"
|
|
465
|
+
}, /*#__PURE__*/React.createElement("span", null, LocaleUtils.tr("redlining.markers"), ":\xA0"), /*#__PURE__*/React.createElement("div", {
|
|
466
|
+
className: "controlgroup"
|
|
467
|
+
}, /*#__PURE__*/React.createElement(ComboBox, {
|
|
468
|
+
className: "redlining-marker-combo",
|
|
469
|
+
onChange: function onChange(value) {
|
|
470
|
+
return _this.updateRedliningStyle({
|
|
471
|
+
headmarker: value
|
|
472
|
+
});
|
|
473
|
+
},
|
|
474
|
+
value: _this.props.redlining.style.headmarker || ""
|
|
475
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
476
|
+
className: "redlining-marker-combo-entry",
|
|
477
|
+
value: ""
|
|
478
|
+
}), Object.entries(END_MARKERS).map(function (_ref) {
|
|
479
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
480
|
+
key = _ref2[0],
|
|
481
|
+
params = _ref2[1];
|
|
482
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
483
|
+
className: "redlining-marker-combo-entry",
|
|
484
|
+
key: key,
|
|
485
|
+
value: key
|
|
486
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
487
|
+
src: params.src,
|
|
488
|
+
style: {
|
|
489
|
+
transform: 'rotate(' + params.baserotation + 'deg)'
|
|
490
|
+
}
|
|
491
|
+
}));
|
|
492
|
+
})), /*#__PURE__*/React.createElement(ComboBox, {
|
|
493
|
+
className: "redlining-marker-combo",
|
|
494
|
+
onChange: function onChange(value) {
|
|
495
|
+
return _this.updateRedliningStyle({
|
|
496
|
+
tailmarker: value
|
|
497
|
+
});
|
|
498
|
+
},
|
|
499
|
+
value: _this.props.redlining.style.tailmarker || ""
|
|
500
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
501
|
+
className: "redlining-marker-combo-entry",
|
|
502
|
+
value: ""
|
|
503
|
+
}), Object.entries(END_MARKERS).map(function (_ref3) {
|
|
504
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
|
505
|
+
key = _ref4[0],
|
|
506
|
+
params = _ref4[1];
|
|
507
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
508
|
+
className: "redlining-marker-combo-entry",
|
|
509
|
+
key: key,
|
|
510
|
+
value: key
|
|
511
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
512
|
+
src: params.src,
|
|
513
|
+
style: {
|
|
514
|
+
transform: 'rotate(' + (180 + params.baserotation) + 'deg)'
|
|
515
|
+
}
|
|
516
|
+
}));
|
|
517
|
+
})))) : null, /*#__PURE__*/React.createElement("div", {
|
|
518
|
+
className: "redlining-control redlining-control-fill"
|
|
519
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
520
|
+
className: "controlgroup"
|
|
521
|
+
}, _this.props.redlining.geomType !== 'Text' && _this.props.allowGeometryLabels ? /*#__PURE__*/React.createElement("button", {
|
|
522
|
+
className: "button" + (_this.props.redlining.measurements ? " pressed" : ""),
|
|
523
|
+
onClick: function onClick() {
|
|
524
|
+
return _this.props.changeRedliningState({
|
|
525
|
+
measurements: !_this.props.redlining.measurements,
|
|
526
|
+
style: _objectSpread(_objectSpread({}, _this.props.redlining.style), {}, {
|
|
527
|
+
text: ''
|
|
528
|
+
})
|
|
529
|
+
});
|
|
530
|
+
},
|
|
531
|
+
title: LocaleUtils.tr("redlining.measurements")
|
|
532
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
533
|
+
icon: "measure"
|
|
534
|
+
})) : null, (_this.props.redlining.geomType === 'Text' || _this.props.allowGeometryLabels) && !_this.props.redlining.measurements ? /*#__PURE__*/React.createElement("input", {
|
|
535
|
+
className: "controlgroup-fillitem",
|
|
536
|
+
onChange: function onChange(ev) {
|
|
537
|
+
return _this.updateRedliningStyle({
|
|
538
|
+
text: ev.target.value
|
|
539
|
+
});
|
|
540
|
+
},
|
|
541
|
+
placeholder: labelPlaceholder,
|
|
542
|
+
readOnly: _this.props.redlining.measurements,
|
|
543
|
+
ref: function ref(el) {
|
|
544
|
+
return _this.setLabelRef(el);
|
|
545
|
+
},
|
|
546
|
+
type: "text",
|
|
547
|
+
value: _this.props.redlining.style.text
|
|
548
|
+
}) : null, _this.props.redlining.measurements && ['LineString', 'Circle'].includes(_this.props.redlining.geomType) ? /*#__PURE__*/React.createElement("select", {
|
|
549
|
+
className: "controlgroup-fillitem",
|
|
550
|
+
onChange: function onChange(ev) {
|
|
551
|
+
return _this.props.changeRedliningState({
|
|
552
|
+
lenUnit: ev.target.value
|
|
553
|
+
});
|
|
554
|
+
},
|
|
555
|
+
value: _this.props.redlining.lenUnit
|
|
556
|
+
}, /*#__PURE__*/React.createElement("option", {
|
|
557
|
+
value: "metric"
|
|
558
|
+
}, LocaleUtils.tr("measureComponent.metric")), /*#__PURE__*/React.createElement("option", {
|
|
559
|
+
value: "imperial"
|
|
560
|
+
}, LocaleUtils.tr("measureComponent.imperial")), /*#__PURE__*/React.createElement("option", {
|
|
561
|
+
value: "m"
|
|
562
|
+
}, "m"), /*#__PURE__*/React.createElement("option", {
|
|
563
|
+
value: "km"
|
|
564
|
+
}, "km"), /*#__PURE__*/React.createElement("option", {
|
|
565
|
+
value: "ft"
|
|
566
|
+
}, "ft"), /*#__PURE__*/React.createElement("option", {
|
|
567
|
+
value: "mi"
|
|
568
|
+
}, "mi")) : null, _this.props.redlining.measurements && ['Polygon', 'Ellipse', 'Square', 'Box'].includes(_this.props.redlining.geomType) ? /*#__PURE__*/React.createElement("select", {
|
|
569
|
+
className: "controlgroup-fillitem",
|
|
570
|
+
onChange: function onChange(ev) {
|
|
571
|
+
return _this.props.changeRedliningState({
|
|
572
|
+
areaUnit: ev.target.value
|
|
573
|
+
});
|
|
574
|
+
},
|
|
575
|
+
value: _this.props.redlining.areaUnit
|
|
576
|
+
}, /*#__PURE__*/React.createElement("option", {
|
|
577
|
+
value: "metric"
|
|
578
|
+
}, LocaleUtils.tr("measureComponent.metric")), /*#__PURE__*/React.createElement("option", {
|
|
579
|
+
value: "imperial"
|
|
580
|
+
}, LocaleUtils.tr("measureComponent.imperial")), /*#__PURE__*/React.createElement("option", {
|
|
581
|
+
value: "sqm"
|
|
582
|
+
}, "m\xB2"), /*#__PURE__*/React.createElement("option", {
|
|
583
|
+
value: "ha"
|
|
584
|
+
}, "ha"), /*#__PURE__*/React.createElement("option", {
|
|
585
|
+
value: "sqkm"
|
|
586
|
+
}, "km\xB2"), /*#__PURE__*/React.createElement("option", {
|
|
587
|
+
value: "sqft"
|
|
588
|
+
}, "ft\xB2"), /*#__PURE__*/React.createElement("option", {
|
|
589
|
+
value: "acre"
|
|
590
|
+
}, "acre"), /*#__PURE__*/React.createElement("option", {
|
|
591
|
+
value: "sqmi"
|
|
592
|
+
}, "mi\xB2")) : null)));
|
|
593
|
+
});
|
|
594
|
+
_defineProperty(_this, "setLabelRef", function (el) {
|
|
595
|
+
_this.labelInput = el;
|
|
596
|
+
if (el && _this.state.selectText) {
|
|
597
|
+
el.focus();
|
|
598
|
+
el.select();
|
|
599
|
+
_this.setState({
|
|
600
|
+
selectText: false
|
|
601
|
+
});
|
|
602
|
+
}
|
|
603
|
+
});
|
|
604
|
+
_defineProperty(_this, "actionChanged", function (data) {
|
|
605
|
+
if (data.action === "Draw" && data.geomType === "Text") {
|
|
606
|
+
data = _objectSpread(_objectSpread({}, data), {}, {
|
|
607
|
+
style: {
|
|
608
|
+
text: LocaleUtils.tr("redlining.text")
|
|
609
|
+
}
|
|
610
|
+
});
|
|
611
|
+
} else if (!_this.props.allowGeometryLabels) {
|
|
612
|
+
data = _objectSpread(_objectSpread({}, data), {}, {
|
|
613
|
+
style: {
|
|
614
|
+
text: ''
|
|
615
|
+
}
|
|
616
|
+
});
|
|
617
|
+
}
|
|
618
|
+
_this.props.changeRedliningState(data);
|
|
619
|
+
});
|
|
620
|
+
_defineProperty(_this, "changeRedliningLayer", function (layer) {
|
|
621
|
+
var action = ["Draw", "Pick", "Transform"].includes(_this.props.redlining.action) ? _this.props.redlining.action : "Pick";
|
|
622
|
+
_this.props.changeRedliningState({
|
|
623
|
+
layer: layer.id,
|
|
624
|
+
layerTitle: layer.title,
|
|
625
|
+
action: action
|
|
626
|
+
});
|
|
627
|
+
});
|
|
628
|
+
_this.labelInput = null;
|
|
629
|
+
_this.dashIcons = {};
|
|
630
|
+
return _this;
|
|
631
|
+
}
|
|
632
|
+
_inherits(Redlining, _React$Component);
|
|
633
|
+
return _createClass(Redlining, [{
|
|
634
|
+
key: "componentDidMount",
|
|
635
|
+
value: function componentDidMount() {
|
|
636
|
+
this.componentDidUpdate({
|
|
637
|
+
redlining: {}
|
|
638
|
+
});
|
|
639
|
+
}
|
|
640
|
+
}, {
|
|
641
|
+
key: "componentDidUpdate",
|
|
642
|
+
value: function componentDidUpdate(prevProps) {
|
|
643
|
+
var _this2 = this;
|
|
644
|
+
if (this.props.defaultBorderColor !== prevProps.defaultBorderColor || this.props.defaultFillColor !== prevProps.defaultFillColor || this.props.defaultLengthUnit !== prevProps.defaultLengthUnit || this.props.defaultAreaUnit !== prevProps.defaultAreaUnit || this.props.defaultTextFillColor !== prevProps.defaultTextFillColor || this.props.defaultTextOutlineColor !== prevProps.defaultTextOutlineColor) {
|
|
645
|
+
this.props.changeRedliningState(this.redliningStateDefaults());
|
|
646
|
+
}
|
|
647
|
+
if (prevProps.redlining.geomType !== this.props.redlining.geomType && this.props.redlining.geomType === 'Text' && !this.state.selectText) {
|
|
648
|
+
this.setState({
|
|
649
|
+
selectText: true
|
|
650
|
+
});
|
|
651
|
+
}
|
|
652
|
+
if (!this.props.layers.find(function (layer) {
|
|
653
|
+
return layer.id === _this2.props.redlining.layer;
|
|
654
|
+
})) {
|
|
655
|
+
var vectorLayers = this.props.layers.filter(function (layer) {
|
|
656
|
+
return layer.type === "vector" && layer.role === LayerRole.USERLAYER && !layer.readonly;
|
|
657
|
+
});
|
|
658
|
+
if (vectorLayers.length >= 1) {
|
|
659
|
+
this.props.changeRedliningState({
|
|
660
|
+
layer: vectorLayers[0].id,
|
|
661
|
+
layerTitle: vectorLayers[0].title
|
|
662
|
+
});
|
|
663
|
+
} else if (this.props.redlining.layer !== 'redlining') {
|
|
664
|
+
this.props.changeRedliningState({
|
|
665
|
+
layer: 'redlining',
|
|
666
|
+
layerTitle: LocaleUtils.tr('redlining.layertitle')
|
|
667
|
+
});
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
if (this.props.predefinedDashPatterns !== prevProps.predefinedDashPatterns) {
|
|
671
|
+
this.generateDashIcons();
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
}, {
|
|
675
|
+
key: "render",
|
|
676
|
+
value: function render() {
|
|
677
|
+
var _this3 = this;
|
|
678
|
+
return /*#__PURE__*/React.createElement(TaskBar, {
|
|
679
|
+
onHide: this.onHide,
|
|
680
|
+
onShow: this.onShow,
|
|
681
|
+
task: "Redlining"
|
|
682
|
+
}, function () {
|
|
683
|
+
return {
|
|
684
|
+
body: _this3.renderBody()
|
|
685
|
+
};
|
|
686
|
+
});
|
|
687
|
+
}
|
|
688
|
+
}]);
|
|
689
|
+
}(React.Component);
|
|
690
|
+
_defineProperty(Redlining, "propTypes", {
|
|
691
|
+
addLayer: PropTypes.func,
|
|
692
|
+
/** Whether to allow labeling geometric figures. */
|
|
693
|
+
allowGeometryLabels: PropTypes.bool,
|
|
694
|
+
changeRedliningState: PropTypes.func,
|
|
695
|
+
/** Default area unit. Options: `metric`, `imperial`, `sqm`, `ha`, `sqkm`, `sqft`, `acre`, `sqmi` */
|
|
696
|
+
defaultAreaUnit: PropTypes.string,
|
|
697
|
+
/** Default border color. In format `[r, g, b, a]`. */
|
|
698
|
+
defaultBorderColor: PropTypes.array,
|
|
699
|
+
/** Default fill color. In format `[r, g, b, a]`. */
|
|
700
|
+
defaultFillColor: PropTypes.array,
|
|
701
|
+
/** Default length unit. Options: `metric`, `imperial`, `m`, `km`, `ft`, `mi` */
|
|
702
|
+
defaultLengthUnit: PropTypes.string,
|
|
703
|
+
/** Default text fill color. In format `[r, g, b, a]`. */
|
|
704
|
+
defaultTextFillColor: PropTypes.array,
|
|
705
|
+
/** Default text outline color. In format `[r, g, b, a]`. */
|
|
706
|
+
defaultTextOutlineColor: PropTypes.array,
|
|
707
|
+
/** Tools to hide. Available tools: `Circle`, `Ellipse`, `Square`, `Box`, `HandDrawing`, `Transform`, `NumericInput`, `Buffer`, `Export`. */
|
|
708
|
+
hiddenTools: PropTypes.array,
|
|
709
|
+
layers: PropTypes.array,
|
|
710
|
+
mapCrs: PropTypes.string,
|
|
711
|
+
plugins: PropTypes.object,
|
|
712
|
+
/** Predefined border colors. In format `[[r, g, b, a], ...]`. */
|
|
713
|
+
predefinedBorderColors: PropTypes.arrayOf(PropTypes.array),
|
|
714
|
+
/** Predefined dash patterns. In format `[<dash-array>, ...]`, where a dash-array is list of alternating dash and gap widths, i.e. `[8 4]` for long dashes followed by shorter gaps. */
|
|
715
|
+
predefinedDashPatterns: PropTypes.arrayOf(PropTypes.array),
|
|
716
|
+
/** Predefined fill colors. In format `[[r, g, b, a], ...]`. */
|
|
717
|
+
predefinedFillColors: PropTypes.arrayOf(PropTypes.array),
|
|
718
|
+
redlining: PropTypes.object,
|
|
719
|
+
resetRedliningState: PropTypes.func,
|
|
720
|
+
setCurrentTask: PropTypes.func,
|
|
721
|
+
setSnappingConfig: PropTypes.func,
|
|
722
|
+
/** Whether snapping is available when editing. */
|
|
723
|
+
snapping: PropTypes.bool,
|
|
724
|
+
/** Whether snapping is enabled by default when editing.
|
|
725
|
+
* Either `false`, `edge`, `vertex` or `true` (i.e. both vertex and edge). */
|
|
726
|
+
snappingActive: PropTypes.oneOfType([PropTypes.bool, PropTypes.string])
|
|
727
|
+
});
|
|
728
|
+
_defineProperty(Redlining, "defaultProps", {
|
|
729
|
+
allowGeometryLabels: true,
|
|
730
|
+
hiddenTools: [],
|
|
731
|
+
snapping: true,
|
|
732
|
+
snappingActive: true,
|
|
733
|
+
plugins: [],
|
|
734
|
+
defaultBorderColor: [255, 0, 0, 1],
|
|
735
|
+
defaultFillColor: [255, 255, 255, 1],
|
|
736
|
+
defaultTextFillColor: [0, 0, 0, 1],
|
|
737
|
+
defaultTextOutlineColor: [255, 255, 255, 1],
|
|
738
|
+
defaultAreaUnit: 'metric',
|
|
739
|
+
defaultLengthUnit: 'metric',
|
|
740
|
+
predefinedDashPatterns: [[], [8, 8], [1, 8], [8, 8, 1, 8]]
|
|
741
|
+
});
|
|
742
|
+
export default (function (plugins) {
|
|
743
|
+
return connect(function (state) {
|
|
744
|
+
return {
|
|
745
|
+
layers: state.layers.flat,
|
|
746
|
+
redlining: state.redlining,
|
|
747
|
+
mapCrs: state.map.projection,
|
|
748
|
+
plugins: plugins
|
|
749
|
+
};
|
|
750
|
+
}, {
|
|
751
|
+
changeRedliningState: changeRedliningState,
|
|
752
|
+
addLayer: addLayer,
|
|
753
|
+
resetRedliningState: resetRedliningState,
|
|
754
|
+
setSnappingConfig: setSnappingConfig
|
|
755
|
+
})(Redlining);
|
|
756
|
+
});
|