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
|
@@ -1,26 +1,577 @@
|
|
|
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 _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
3
|
+
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."); }
|
|
4
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
5
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
6
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
7
|
+
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; }
|
|
8
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
9
|
+
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); } }
|
|
10
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
11
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
12
|
+
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); }
|
|
13
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
14
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
15
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
16
|
+
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); }
|
|
17
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
18
|
+
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; }
|
|
19
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
20
|
+
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); }
|
|
21
|
+
/**
|
|
2
22
|
* Copyright 2024 Sourcepole AG
|
|
3
23
|
* All rights reserved.
|
|
4
24
|
*
|
|
5
25
|
* This source code is licensed under the BSD-style license found in the
|
|
6
26
|
* LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
import React from 'react';
|
|
30
|
+
import ColorLayer from '@giro3d/giro3d/core/layer/ColorLayer';
|
|
31
|
+
import Shape from '@giro3d/giro3d/entities/Shape';
|
|
32
|
+
import DrawTool, { conditions } from "@giro3d/giro3d/interactions/DrawTool.js";
|
|
33
|
+
import VectorSource from '@giro3d/giro3d/sources/VectorSource';
|
|
34
|
+
import ol from 'openlayers';
|
|
35
|
+
import pointInPolygon from 'point-in-polygon';
|
|
36
|
+
import PropTypes from 'prop-types';
|
|
37
|
+
import { CurvePath, LineCurve, Vector2, Vector3 } from 'three';
|
|
38
|
+
import TaskBar from '../../components/TaskBar';
|
|
39
|
+
import HeightProfile3D from '../../components/map3d/HeightProfile3D';
|
|
40
|
+
import ButtonBar from '../../components/widgets/ButtonBar';
|
|
41
|
+
import CopyButton from '../../components/widgets/CopyButton';
|
|
42
|
+
import ConfigUtils from '../../utils/ConfigUtils';
|
|
43
|
+
import CoordinatesUtils from '../../utils/CoordinatesUtils';
|
|
44
|
+
import LocaleUtils from '../../utils/LocaleUtils';
|
|
45
|
+
import MeasureUtils from '../../utils/MeasureUtils';
|
|
46
|
+
import '../../plugins/style/Measure.css';
|
|
47
|
+
|
|
48
|
+
/**
|
|
8
49
|
* Measure in the 3D map.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
_this
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
50
|
+
*/
|
|
51
|
+
var Measure3D = /*#__PURE__*/function (_React$Component) {
|
|
52
|
+
function Measure3D(props) {
|
|
53
|
+
var _this;
|
|
54
|
+
_classCallCheck(this, Measure3D);
|
|
55
|
+
_this = _callSuper(this, Measure3D, [props]);
|
|
56
|
+
_defineProperty(_this, "state", {
|
|
57
|
+
mode: null,
|
|
58
|
+
result: null,
|
|
59
|
+
lenUnit: 'metric',
|
|
60
|
+
areaUnit: 'metric',
|
|
61
|
+
elevUnit: 'absolute'
|
|
62
|
+
});
|
|
63
|
+
_defineProperty(_this, "onShow", function (mode) {
|
|
64
|
+
_this.setState({
|
|
65
|
+
mode: mode !== null && mode !== void 0 ? mode : 'Point'
|
|
66
|
+
});
|
|
67
|
+
_this.abortController = new AbortController();
|
|
68
|
+
_this.measureTool = new DrawTool({
|
|
69
|
+
instance: _this.props.sceneContext.scene
|
|
70
|
+
});
|
|
71
|
+
_this.drawLayer = new ColorLayer({
|
|
72
|
+
source: new VectorSource({
|
|
73
|
+
data: [],
|
|
74
|
+
format: new ol.format.GeoJSON(),
|
|
75
|
+
style: _this.featureStyleFunction
|
|
76
|
+
})
|
|
77
|
+
});
|
|
78
|
+
_this.props.sceneContext.map.addLayer(_this.drawLayer);
|
|
79
|
+
_this.props.sceneContext.scene.domElement.addEventListener('pointerdown', _this.clearResultOnUp);
|
|
80
|
+
});
|
|
81
|
+
_defineProperty(_this, "onHide", function () {
|
|
82
|
+
_this.clearResult();
|
|
83
|
+
_this.setState({
|
|
84
|
+
mode: null
|
|
85
|
+
});
|
|
86
|
+
_this.abortController.abort();
|
|
87
|
+
_this.abortController = null;
|
|
88
|
+
_this.measureTool.dispose();
|
|
89
|
+
_this.measureTool = null;
|
|
90
|
+
_this.props.sceneContext.map.removeLayer(_this.drawLayer, {
|
|
91
|
+
dispose: true
|
|
92
|
+
});
|
|
93
|
+
_this.drawLayer = null;
|
|
94
|
+
_this.props.sceneContext.scene.domElement.removeEventListener('pointerdown', _this.clearResultOnUp);
|
|
95
|
+
});
|
|
96
|
+
_defineProperty(_this, "renderModeSwitcher", function () {
|
|
97
|
+
var buttons = [{
|
|
98
|
+
key: "Point",
|
|
99
|
+
label: LocaleUtils.tr("measureComponent.pointLabel")
|
|
100
|
+
}, {
|
|
101
|
+
key: "HeightDiff",
|
|
102
|
+
label: LocaleUtils.tr("measureComponent.heightDiffLabel")
|
|
103
|
+
}, {
|
|
104
|
+
key: "LineString",
|
|
105
|
+
label: LocaleUtils.tr("measureComponent.lengthLabel")
|
|
106
|
+
}, {
|
|
107
|
+
key: "Polygon",
|
|
108
|
+
label: LocaleUtils.tr("measureComponent.areaLabel")
|
|
109
|
+
}];
|
|
110
|
+
return /*#__PURE__*/React.createElement(ButtonBar, {
|
|
111
|
+
active: _this.state.mode,
|
|
112
|
+
buttons: buttons,
|
|
113
|
+
onClick: function onClick(mode) {
|
|
114
|
+
return _this.setState({
|
|
115
|
+
mode: mode,
|
|
116
|
+
result: null
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
_defineProperty(_this, "renderResult", function () {
|
|
122
|
+
if (!_this.state.result) {
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
var text = "";
|
|
126
|
+
var unitSelector = null;
|
|
127
|
+
if (_this.state.mode === "Point") {
|
|
128
|
+
text = CoordinatesUtils.getFormattedCoordinate(_this.state.result.pos.slice(0, 2), _this.props.sceneContext.mapCrs);
|
|
129
|
+
var prec = ConfigUtils.getConfigProp("measurementPrecision");
|
|
130
|
+
text += ", " + (_this.state.result.ground > 0 && _this.state.elevUnit === 'ground' ? _this.state.result.ground : _this.state.result.pos[2]).toFixed(prec);
|
|
131
|
+
if (_this.state.result.ground > 0) {
|
|
132
|
+
unitSelector = /*#__PURE__*/React.createElement("select", {
|
|
133
|
+
onChange: function onChange(ev) {
|
|
134
|
+
return _this.setState({
|
|
135
|
+
elevUnit: ev.target.value
|
|
136
|
+
});
|
|
137
|
+
},
|
|
138
|
+
value: _this.state.elevUnit
|
|
139
|
+
}, /*#__PURE__*/React.createElement("option", {
|
|
140
|
+
value: "ground"
|
|
141
|
+
}, LocaleUtils.tr("measureComponent.ground")), /*#__PURE__*/React.createElement("option", {
|
|
142
|
+
value: "absolute"
|
|
143
|
+
}, LocaleUtils.tr("measureComponent.absolute")));
|
|
144
|
+
} else {
|
|
145
|
+
unitSelector = /*#__PURE__*/React.createElement("span", {
|
|
146
|
+
className: "measure-unit-label"
|
|
147
|
+
}, LocaleUtils.tr("measureComponent.absolute"));
|
|
148
|
+
}
|
|
149
|
+
} else if (_this.state.mode === "HeightDiff") {
|
|
150
|
+
text = (_this.state.result || []).length === 2 ? MeasureUtils.formatMeasurement(Math.abs(_this.state.result[1].z - _this.state.result[0].z), false, _this.state.lenUnit) : "";
|
|
151
|
+
unitSelector = /*#__PURE__*/React.createElement("select", {
|
|
152
|
+
onChange: function onChange(ev) {
|
|
153
|
+
return _this.setState({
|
|
154
|
+
lenUnit: ev.target.value
|
|
155
|
+
});
|
|
156
|
+
},
|
|
157
|
+
value: _this.state.lenUnit
|
|
158
|
+
}, /*#__PURE__*/React.createElement("option", {
|
|
159
|
+
value: "metric"
|
|
160
|
+
}, LocaleUtils.tr("measureComponent.metric")), /*#__PURE__*/React.createElement("option", {
|
|
161
|
+
value: "imperial"
|
|
162
|
+
}, LocaleUtils.tr("measureComponent.imperial")), /*#__PURE__*/React.createElement("option", {
|
|
163
|
+
value: "m"
|
|
164
|
+
}, "m"), /*#__PURE__*/React.createElement("option", {
|
|
165
|
+
value: "km"
|
|
166
|
+
}, "km"), /*#__PURE__*/React.createElement("option", {
|
|
167
|
+
value: "ft"
|
|
168
|
+
}, "ft"), /*#__PURE__*/React.createElement("option", {
|
|
169
|
+
value: "mi"
|
|
170
|
+
}, "mi"));
|
|
171
|
+
} else if (_this.state.mode === "LineString") {
|
|
172
|
+
text = MeasureUtils.formatMeasurement(_this.state.result.length, false, _this.state.lenUnit);
|
|
173
|
+
unitSelector = /*#__PURE__*/React.createElement("select", {
|
|
174
|
+
onChange: function onChange(ev) {
|
|
175
|
+
return _this.setState({
|
|
176
|
+
lenUnit: ev.target.value
|
|
177
|
+
});
|
|
178
|
+
},
|
|
179
|
+
value: _this.state.lenUnit
|
|
180
|
+
}, /*#__PURE__*/React.createElement("option", {
|
|
181
|
+
value: "metric"
|
|
182
|
+
}, LocaleUtils.tr("measureComponent.metric")), /*#__PURE__*/React.createElement("option", {
|
|
183
|
+
value: "imperial"
|
|
184
|
+
}, LocaleUtils.tr("measureComponent.imperial")), /*#__PURE__*/React.createElement("option", {
|
|
185
|
+
value: "m"
|
|
186
|
+
}, "m"), /*#__PURE__*/React.createElement("option", {
|
|
187
|
+
value: "km"
|
|
188
|
+
}, "km"), /*#__PURE__*/React.createElement("option", {
|
|
189
|
+
value: "ft"
|
|
190
|
+
}, "ft"), /*#__PURE__*/React.createElement("option", {
|
|
191
|
+
value: "mi"
|
|
192
|
+
}, "mi"));
|
|
193
|
+
} else if (_this.state.mode === "Polygon") {
|
|
194
|
+
text = MeasureUtils.formatMeasurement(_this.state.result, true, _this.state.areaUnit);
|
|
195
|
+
unitSelector = /*#__PURE__*/React.createElement("select", {
|
|
196
|
+
onChange: function onChange(ev) {
|
|
197
|
+
return _this.setState({
|
|
198
|
+
areaUnit: ev.target.value
|
|
199
|
+
});
|
|
200
|
+
},
|
|
201
|
+
value: _this.state.areaUnit
|
|
202
|
+
}, /*#__PURE__*/React.createElement("option", {
|
|
203
|
+
value: "metric"
|
|
204
|
+
}, LocaleUtils.tr("measureComponent.metric")), /*#__PURE__*/React.createElement("option", {
|
|
205
|
+
value: "imperial"
|
|
206
|
+
}, LocaleUtils.tr("measureComponent.imperial")), /*#__PURE__*/React.createElement("option", {
|
|
207
|
+
value: "sqm"
|
|
208
|
+
}, "m\xB2"), /*#__PURE__*/React.createElement("option", {
|
|
209
|
+
value: "ha"
|
|
210
|
+
}, "ha"), /*#__PURE__*/React.createElement("option", {
|
|
211
|
+
value: "sqkm"
|
|
212
|
+
}, "km\xB2"), /*#__PURE__*/React.createElement("option", {
|
|
213
|
+
value: "sqft"
|
|
214
|
+
}, "ft\xB2"), /*#__PURE__*/React.createElement("option", {
|
|
215
|
+
value: "acre"
|
|
216
|
+
}, "acre"), /*#__PURE__*/React.createElement("option", {
|
|
217
|
+
value: "sqmi"
|
|
218
|
+
}, "mi\xB2"));
|
|
219
|
+
}
|
|
220
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
221
|
+
className: "measure-result controlgroup"
|
|
222
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
223
|
+
className: "measure-result-field",
|
|
224
|
+
readOnly: true,
|
|
225
|
+
type: "text",
|
|
226
|
+
value: text
|
|
227
|
+
}), unitSelector, /*#__PURE__*/React.createElement(CopyButton, {
|
|
228
|
+
text: text
|
|
229
|
+
}));
|
|
230
|
+
});
|
|
231
|
+
_defineProperty(_this, "featureStyleFunction", function () {
|
|
232
|
+
return [new ol.style.Style({
|
|
233
|
+
fill: new ol.style.Fill({
|
|
234
|
+
color: [255, 0, 0, 0.5]
|
|
235
|
+
})
|
|
236
|
+
}), new ol.style.Style({
|
|
237
|
+
stroke: new ol.style.Stroke({
|
|
238
|
+
color: [255, 0, 0],
|
|
239
|
+
width: 4
|
|
240
|
+
})
|
|
241
|
+
}), new ol.style.Style({
|
|
242
|
+
stroke: new ol.style.Stroke({
|
|
243
|
+
color: [255, 0, 0],
|
|
244
|
+
width: 1.5
|
|
245
|
+
})
|
|
246
|
+
})];
|
|
247
|
+
});
|
|
248
|
+
_defineProperty(_this, "clearResultOnUp", function (ev) {
|
|
249
|
+
ev.view.addEventListener("pointermove", function () {
|
|
250
|
+
ev.view.removeEventListener("pointerup", _this.clearResult);
|
|
251
|
+
}, {
|
|
252
|
+
once: true
|
|
253
|
+
});
|
|
254
|
+
ev.view.addEventListener("pointerup", _this.clearResult, {
|
|
255
|
+
once: true
|
|
256
|
+
});
|
|
257
|
+
});
|
|
258
|
+
_defineProperty(_this, "clearResult", function () {
|
|
259
|
+
_this.drawLayer.source.clear();
|
|
260
|
+
_this.measurementObjects.forEach(function (object) {
|
|
261
|
+
_this.props.sceneContext.scene.remove(object);
|
|
262
|
+
});
|
|
263
|
+
_this.measurementObjects = [];
|
|
264
|
+
_this.setState({
|
|
265
|
+
result: null
|
|
266
|
+
});
|
|
267
|
+
});
|
|
268
|
+
_defineProperty(_this, "restart", function () {
|
|
269
|
+
if (_this.abortController) {
|
|
270
|
+
_this.abortController.abort();
|
|
271
|
+
}
|
|
272
|
+
_this.abortController = new AbortController();
|
|
273
|
+
var terrainPick = function terrainPick(e) {
|
|
274
|
+
return _this.props.sceneContext.scene.pickObjectsAt(e, {
|
|
275
|
+
sortByDistance: true,
|
|
276
|
+
where: [_this.props.sceneContext.getMap()]
|
|
277
|
+
});
|
|
278
|
+
};
|
|
279
|
+
var options = {
|
|
280
|
+
color: '#ff0000',
|
|
281
|
+
signal: _this.abortController.signal,
|
|
282
|
+
endCondition: conditions.doubleClick,
|
|
283
|
+
pick: null // default pick
|
|
284
|
+
};
|
|
285
|
+
if (_this.state.mode === 'Point') {
|
|
286
|
+
_this.measureTool.createPoint(options).then(_this.measurePoint)["catch"](function () {});
|
|
287
|
+
} else if (_this.state.mode === 'LineString') {
|
|
288
|
+
options.pick = terrainPick;
|
|
289
|
+
_this.measureTool.createLineString(options).then(_this.measureLine)["catch"](function () {});
|
|
290
|
+
} else if (_this.state.mode === 'Polygon') {
|
|
291
|
+
options.pick = terrainPick;
|
|
292
|
+
_this.measureTool.createPolygon(options).then(_this.measureArea)["catch"](function () {});
|
|
293
|
+
} else if (_this.state.mode === 'HeightDiff') {
|
|
294
|
+
_this.measureTool.createPoint(options).then(_this.measureHeightDiff)["catch"](function () {});
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
_defineProperty(_this, "measurePoint", function (point) {
|
|
298
|
+
if (point === null) {
|
|
299
|
+
_this.restart();
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
_this.clearResult();
|
|
303
|
+
var pos = point.points[0];
|
|
304
|
+
|
|
305
|
+
// Measure point above terrain
|
|
306
|
+
_this.props.sceneContext.getTerrainHeightFromDTM([pos.x, pos.y]).then(function (elevation) {
|
|
307
|
+
var ground = pos.z - elevation > 0.3 ? pos.z - elevation : 0;
|
|
308
|
+
var elevationLabelFormatter = function elevationLabelFormatter(options) {
|
|
309
|
+
if (options.index === 0) {
|
|
310
|
+
return MeasureUtils.formatMeasurement(elevation, false, "m") + " " + LocaleUtils.tr("measureComponent.absolute");
|
|
311
|
+
} else if (ground > 0 && _this.state.elevUnit === "ground") {
|
|
312
|
+
return MeasureUtils.formatMeasurement(pos.z - elevation, false, "m") + " " + LocaleUtils.tr("measureComponent.ground");
|
|
313
|
+
} else {
|
|
314
|
+
return MeasureUtils.formatMeasurement(pos.z, false, LocaleUtils.tr("measureComponent.absolute"));
|
|
315
|
+
}
|
|
316
|
+
};
|
|
317
|
+
var shape = null;
|
|
318
|
+
if (ground > 0) {
|
|
319
|
+
// Add line
|
|
320
|
+
shape = new Shape({
|
|
321
|
+
showVertexLabels: true,
|
|
322
|
+
showLine: true,
|
|
323
|
+
showVertices: true,
|
|
324
|
+
vertexLabelFormatter: elevationLabelFormatter
|
|
325
|
+
});
|
|
326
|
+
shape.setPoints([new Vector3(pos.x, pos.y, elevation), pos]);
|
|
327
|
+
} else {
|
|
328
|
+
// Add point
|
|
329
|
+
shape = new Shape({
|
|
330
|
+
showVertexLabels: true,
|
|
331
|
+
showLine: false,
|
|
332
|
+
showVertices: true,
|
|
333
|
+
vertexLabelFormatter: elevationLabelFormatter
|
|
334
|
+
});
|
|
335
|
+
shape.setPoints([new Vector3(pos.x, pos.y, pos.z)]);
|
|
336
|
+
}
|
|
337
|
+
_this.props.sceneContext.scene.add(shape);
|
|
338
|
+
_this.measurementObjects.push(shape);
|
|
339
|
+
_this.props.sceneContext.scene.remove(point);
|
|
340
|
+
_this.setState({
|
|
341
|
+
result: {
|
|
342
|
+
pos: [pos.x, pos.y, pos.z],
|
|
343
|
+
ground: ground
|
|
344
|
+
}
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
// Setup for next measurement
|
|
348
|
+
_this.restart();
|
|
349
|
+
});
|
|
350
|
+
});
|
|
351
|
+
_defineProperty(_this, "measureHeightDiff", function (point) {
|
|
352
|
+
if (point === null) {
|
|
353
|
+
_this.restart();
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
if ((_this.state.result || []).length >= 2) {
|
|
357
|
+
_this.clearResult();
|
|
358
|
+
}
|
|
359
|
+
var pos = point.points[0];
|
|
360
|
+
if ((_this.state.result || []).length === 1) {
|
|
361
|
+
// Add line if two points drawn
|
|
362
|
+
var points = [_this.state.result[0], pos];
|
|
363
|
+
if (points[0].z > points[1].z) {
|
|
364
|
+
points.reverse();
|
|
365
|
+
}
|
|
366
|
+
var line = new Shape({
|
|
367
|
+
showVertexLabels: true,
|
|
368
|
+
vertexLabelFormatter: function vertexLabelFormatter(options) {
|
|
369
|
+
return options.index === 2 ? MeasureUtils.formatMeasurement(points[1].z - points[0].z, false, _this.state.lenUnit) : null;
|
|
370
|
+
},
|
|
371
|
+
showLine: true
|
|
372
|
+
});
|
|
373
|
+
line.setPoints([new Vector3(points[0].x, points[0].y, points[0].z), new Vector3(points[1].x, points[1].y, points[0].z), new Vector3(points[1].x, points[1].y, points[1].z)]);
|
|
374
|
+
_this.props.sceneContext.scene.add(line);
|
|
375
|
+
_this.measurementObjects.push(line);
|
|
376
|
+
} else {
|
|
377
|
+
// Add first drawn point
|
|
378
|
+
var shape = new Shape({
|
|
379
|
+
showVertices: true
|
|
380
|
+
});
|
|
381
|
+
shape.setPoints([new Vector3(pos.x, pos.y, pos.z)]);
|
|
382
|
+
_this.props.sceneContext.scene.add(shape);
|
|
383
|
+
_this.measurementObjects.push(shape);
|
|
384
|
+
}
|
|
385
|
+
_this.props.sceneContext.scene.remove(point);
|
|
386
|
+
_this.setState(function (state) {
|
|
387
|
+
return {
|
|
388
|
+
result: [].concat(_toConsumableArray(state.result || []), [{
|
|
389
|
+
x: pos.x,
|
|
390
|
+
y: pos.y,
|
|
391
|
+
z: pos.z
|
|
392
|
+
}])
|
|
393
|
+
};
|
|
394
|
+
});
|
|
395
|
+
_this.restart();
|
|
396
|
+
});
|
|
397
|
+
_defineProperty(_this, "measureLine", function (lineString) {
|
|
398
|
+
if (lineString === null) {
|
|
399
|
+
_this.restart();
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
_this.clearResult();
|
|
403
|
+
var features = new ol.format.GeoJSON().readFeatures(lineString.toGeoJSON(), {
|
|
404
|
+
dataProjection: "EPSG:4326",
|
|
405
|
+
featureProjection: _this.props.sceneContext.mapCrs
|
|
406
|
+
});
|
|
407
|
+
_this.drawLayer.source.addFeatures(features);
|
|
408
|
+
_this.props.sceneContext.scene.remove(lineString);
|
|
409
|
+
|
|
410
|
+
// Compute 2d length and nSamples spaced points
|
|
411
|
+
var path = new CurvePath();
|
|
412
|
+
var len2d = 0;
|
|
413
|
+
for (var i = 0; i < lineString.points.length - 1; i++) {
|
|
414
|
+
var v0 = lineString.points[i];
|
|
415
|
+
var v1 = lineString.points[i + 1];
|
|
416
|
+
var line = new LineCurve(new Vector2(v0.x, v0.y), new Vector2(v1.x, v1.y));
|
|
417
|
+
path.add(line);
|
|
418
|
+
len2d += Math.sqrt((v1.x - v0.x) * (v1.x - v0.x) + (v1.y - v0.y) * (v1.y - v0.y));
|
|
419
|
+
}
|
|
420
|
+
var nSamples = Math.min(_this.props.maxSampleCount, Math.round(len2d / _this.props.minMeasureLength));
|
|
421
|
+
var points = path.getSpacedPoints(nSamples - 1);
|
|
422
|
+
var line3d = new Array(nSamples);
|
|
423
|
+
line3d[0] = [points[0].x, points[0].y, _this.getElevation([points[0].x, points[0].y]), 0];
|
|
424
|
+
var len3d = 0;
|
|
425
|
+
for (var _i = 1; _i < nSamples; ++_i) {
|
|
426
|
+
line3d[_i] = [points[_i].x, points[_i].y, _this.getElevation([points[_i].x, points[_i].y]), 0];
|
|
427
|
+
var dx = line3d[_i][0] - line3d[_i - 1][0];
|
|
428
|
+
var dy = line3d[_i][1] - line3d[_i - 1][1];
|
|
429
|
+
var dz = line3d[_i][2] - line3d[_i - 1][2];
|
|
430
|
+
len3d += Math.sqrt(dx * dx + dy * dy + dz * dz);
|
|
431
|
+
line3d[_i][3] = len3d; // Also store incremental length for height profie
|
|
432
|
+
}
|
|
433
|
+
_this.setState({
|
|
434
|
+
result: {
|
|
435
|
+
length: len3d,
|
|
436
|
+
profile: line3d
|
|
437
|
+
}
|
|
438
|
+
});
|
|
439
|
+
_this.restart();
|
|
440
|
+
});
|
|
441
|
+
_defineProperty(_this, "measureArea", function (polygon) {
|
|
442
|
+
if (polygon === null) {
|
|
443
|
+
_this.restart();
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
446
|
+
_this.clearResult();
|
|
447
|
+
var features = new ol.format.GeoJSON().readFeatures(polygon.toGeoJSON(), {
|
|
448
|
+
dataProjection: "EPSG:4326",
|
|
449
|
+
featureProjection: _this.props.sceneContext.mapCrs
|
|
450
|
+
});
|
|
451
|
+
_this.drawLayer.source.addFeatures(features);
|
|
452
|
+
_this.props.sceneContext.scene.remove(polygon);
|
|
453
|
+
|
|
454
|
+
// Compute boundingbox of polygon, divide boundingbox into quads,
|
|
455
|
+
// compute quad area on terrain for each quad in polygon
|
|
456
|
+
var bbox = [polygon.points[0].x, polygon.points[0].y, polygon.points[0].x, polygon.points[0].y];
|
|
457
|
+
var coordinates = polygon.points.map(function (v) {
|
|
458
|
+
bbox[0] = Math.min(bbox[0], v.x);
|
|
459
|
+
bbox[1] = Math.min(bbox[1], v.y);
|
|
460
|
+
bbox[2] = Math.max(bbox[2], v.x);
|
|
461
|
+
bbox[3] = Math.max(bbox[3], v.y);
|
|
462
|
+
return [v.x, v.y];
|
|
463
|
+
});
|
|
464
|
+
var quadSize = _this.props.minMeasureLength;
|
|
465
|
+
var numX = Math.min(_this.props.maxSampleCount, Math.round((bbox[2] - bbox[0]) / quadSize));
|
|
466
|
+
var numY = Math.min(_this.props.maxSampleCount, Math.round((bbox[3] - bbox[1]) / quadSize));
|
|
467
|
+
var deltaX = (bbox[2] - bbox[0]) / numX;
|
|
468
|
+
var deltaY = (bbox[3] - bbox[1]) / numY;
|
|
469
|
+
var area = 0;
|
|
470
|
+
var elevationCache = new Array(numX * numY);
|
|
471
|
+
for (var iX = 0; iX < numX; ++iX) {
|
|
472
|
+
for (var iY = 0; iY < numY; ++iY) {
|
|
473
|
+
var _elevationCache, _elevationCache2, _elevationCache3, _elevationCache4;
|
|
474
|
+
// If quad center lies in polygon, consider it
|
|
475
|
+
var p = [bbox[0] + iX * deltaX, bbox[1] + iY * deltaY];
|
|
476
|
+
var c = [p[0] + 0.5 * deltaX, p[1] + 0.5 * deltaY];
|
|
477
|
+
if (!pointInPolygon(c, coordinates)) {
|
|
478
|
+
continue;
|
|
479
|
+
}
|
|
480
|
+
// Get elevations
|
|
481
|
+
var z1 = (_elevationCache = elevationCache[iY * numX + iX]) !== null && _elevationCache !== void 0 ? _elevationCache : elevationCache[iY * numX + iX] = _this.getElevation(p);
|
|
482
|
+
var z2 = (_elevationCache2 = elevationCache[iY * numX + iX + 1]) !== null && _elevationCache2 !== void 0 ? _elevationCache2 : elevationCache[iY * numX + iX + 1] = _this.getElevation([p[0] + deltaX, p[1]]);
|
|
483
|
+
var z3 = (_elevationCache3 = elevationCache[(iY + 1) * numX + iX + 1]) !== null && _elevationCache3 !== void 0 ? _elevationCache3 : elevationCache[(iY + 1) * numX + iX + 1] = _this.getElevation([p[0] + deltaX, p[1] + deltaY]);
|
|
484
|
+
var z4 = (_elevationCache4 = elevationCache[(iY + 1) * numX + iX]) !== null && _elevationCache4 !== void 0 ? _elevationCache4 : elevationCache[(iY + 1) * numX + iX] = _this.getElevation([p[0], p[1] + deltaY]);
|
|
485
|
+
// Divide quad along diagonal with smaller elevation difference
|
|
486
|
+
var dz1 = Math.abs(z3 - z1);
|
|
487
|
+
var dz2 = Math.abs(z4 - z2);
|
|
488
|
+
if (dz1 < dz2) {
|
|
489
|
+
var area1 = _this.triangleArea([-deltaX, 0, z1 - z2], [0, deltaY, z3 - z2]);
|
|
490
|
+
var area2 = _this.triangleArea([0, -deltaY, z1 - z4], [deltaX, 0, z3 - z4]);
|
|
491
|
+
area += area1 + area2;
|
|
492
|
+
} else {
|
|
493
|
+
var _area = _this.triangleArea([deltaX, 0, z2 - z1], [0, deltaY, z4 - z1]);
|
|
494
|
+
var _area2 = _this.triangleArea([-deltaX, 0, z4 - z3], [0, -deltaY, z1 - z3]);
|
|
495
|
+
area += _area + _area2;
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
_this.setState({
|
|
500
|
+
result: area
|
|
501
|
+
});
|
|
502
|
+
|
|
503
|
+
// Setup for next measurement
|
|
504
|
+
_this.restart();
|
|
505
|
+
});
|
|
506
|
+
_defineProperty(_this, "measureHeight", function (lineString) {
|
|
507
|
+
if (lineString === null) {
|
|
508
|
+
_this.restart();
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
_this.clearResult();
|
|
512
|
+
_this.measurementObjects.push(lineString);
|
|
513
|
+
|
|
514
|
+
// Setup for next measurement
|
|
515
|
+
_this.restart();
|
|
516
|
+
});
|
|
517
|
+
_defineProperty(_this, "getElevation", function (point) {
|
|
518
|
+
var _this$props$sceneCont;
|
|
519
|
+
return (_this$props$sceneCont = _this.props.sceneContext.getTerrainHeightFromMap(point)) !== null && _this$props$sceneCont !== void 0 ? _this$props$sceneCont : 0;
|
|
520
|
+
});
|
|
521
|
+
_defineProperty(_this, "triangleArea", function (u, v) {
|
|
522
|
+
var cross = [u[1] * v[2] - u[2] * v[1], u[0] * v[2] - u[2] * v[0], u[0] * v[1] - u[1] * v[0]];
|
|
523
|
+
return 0.5 * Math.sqrt(cross[0] * cross[0] + cross[1] * cross[1] + cross[2] * cross[2]);
|
|
524
|
+
});
|
|
525
|
+
_this.measureTool = null;
|
|
526
|
+
_this.drawLayer = null;
|
|
527
|
+
_this.measurementObjects = [];
|
|
528
|
+
return _this;
|
|
529
|
+
}
|
|
530
|
+
_inherits(Measure3D, _React$Component);
|
|
531
|
+
return _createClass(Measure3D, [{
|
|
532
|
+
key: "componentDidUpdate",
|
|
533
|
+
value: function componentDidUpdate(prevProps, prevState) {
|
|
534
|
+
if (this.state.mode && this.state.mode !== prevState.mode) {
|
|
535
|
+
this.clearResult();
|
|
536
|
+
this.restart();
|
|
537
|
+
}
|
|
538
|
+
if (this.state.elevUnit !== prevState.elevUnit) {
|
|
539
|
+
// Re-render height label
|
|
540
|
+
this.measurementObjects[0].rebuildLabels();
|
|
541
|
+
this.props.sceneContext.scene.notifyChange();
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
}, {
|
|
545
|
+
key: "render",
|
|
546
|
+
value: function render() {
|
|
547
|
+
var _this2 = this,
|
|
548
|
+
_this$state$result;
|
|
549
|
+
return [/*#__PURE__*/React.createElement(TaskBar, {
|
|
550
|
+
key: "TaskBar",
|
|
551
|
+
onHide: this.onHide,
|
|
552
|
+
onShow: this.onShow,
|
|
553
|
+
task: "Measure3D"
|
|
554
|
+
}, function () {
|
|
555
|
+
return {
|
|
556
|
+
body: /*#__PURE__*/React.createElement("div", {
|
|
557
|
+
className: "measure-body"
|
|
558
|
+
}, _this2.renderModeSwitcher(), _this2.renderResult())
|
|
559
|
+
};
|
|
560
|
+
}), (_this$state$result = this.state.result) !== null && _this$state$result !== void 0 && _this$state$result.profile ? /*#__PURE__*/React.createElement(HeightProfile3D, {
|
|
561
|
+
data: this.state.result.profile,
|
|
562
|
+
key: "HeightProfile",
|
|
563
|
+
sceneContext: this.props.sceneContext
|
|
564
|
+
}) : null];
|
|
565
|
+
}
|
|
566
|
+
}]);
|
|
567
|
+
}(React.Component);
|
|
568
|
+
_defineProperty(Measure3D, "propTypes", {
|
|
569
|
+
maxSampleCount: PropTypes.number,
|
|
570
|
+
minMeasureLength: PropTypes.number,
|
|
571
|
+
sceneContext: PropTypes.object
|
|
572
|
+
});
|
|
573
|
+
_defineProperty(Measure3D, "defaultProps", {
|
|
574
|
+
maxSampleCount: 500,
|
|
575
|
+
minMeasureLength: 1
|
|
576
|
+
});
|
|
577
|
+
export { Measure3D as default };
|