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/Cyclomedia.js
CHANGED
|
@@ -1,11 +1,448 @@
|
|
|
1
|
-
function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
3
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
4
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
5
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
6
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
7
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
8
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
9
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
10
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
11
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
12
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
13
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
14
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
15
|
+
/**
|
|
2
16
|
* Copyright 2024 Sourcepole AG
|
|
3
17
|
* All rights reserved.
|
|
4
18
|
*
|
|
5
19
|
* This source code is licensed under the BSD-style license found in the
|
|
6
20
|
* LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import React from 'react';
|
|
24
|
+
import { connect } from 'react-redux';
|
|
25
|
+
import PropTypes from 'prop-types';
|
|
26
|
+
import { addLayer, addLayerFeatures, changeLayerProperty, removeLayer, LayerRole } from '../actions/layers';
|
|
27
|
+
import { setCurrentTask } from '../actions/task';
|
|
28
|
+
import ResizeableWindow from '../components/ResizeableWindow';
|
|
29
|
+
import Spinner from '../components/widgets/Spinner';
|
|
30
|
+
import CoordinatesUtils from '../utils/CoordinatesUtils';
|
|
31
|
+
import LocaleUtils from '../utils/LocaleUtils';
|
|
32
|
+
import MapUtils from '../utils/MapUtils';
|
|
33
|
+
import ResourceRegistry from '../utils/ResourceRegistry';
|
|
34
|
+
import './style/Cyclomedia.css';
|
|
35
|
+
var Status = {
|
|
36
|
+
LOGIN: 0,
|
|
37
|
+
INITIALIZING: 1,
|
|
38
|
+
INITIALIZED: 2,
|
|
39
|
+
ERROR: 3,
|
|
40
|
+
LOADPOS: 4,
|
|
41
|
+
HAVEPOS: 5
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
8
45
|
* Cyclomedia integration for QWC2.
|
|
9
|
-
*/var Cyclomedia=/*#__PURE__*/function(_React$Component){function Cyclomedia(props){var _this;_classCallCheck(this,Cyclomedia);_this=_callSuper(this,Cyclomedia,[props]);_defineProperty(_this,"state",{status:Status.LOGIN,message:"",username:"",password:"",loginFailed:false});_defineProperty(_this,"onClose",function(){_this.props.setCurrentTask(null);_this.setState({status:Status.LOGIN,loginFailed:false});_this.iframe=null});_defineProperty(_this,"setIframeRef",function(iframe){if(iframe&&iframe!==_this.iframe){_this.iframe=iframe;clearInterval(_this.iframePollIntervall);_this.iframePollIntervall=setInterval(function(){return _this.setupIframe(iframe)},500)}});_defineProperty(_this,"setupIframe",function(iframe){if(!iframe.getAttribute("content-set")){if(iframe.contentWindow&&iframe.contentWindow.document){iframe.setAttribute("content-set",true);iframe.contentWindow.document.open();iframe.contentWindow.document.write(_this.cyclomediaIndexHtml());iframe.contentWindow.document.close();_this.iframe=iframe}}else if(!iframe.getAttribute("callback-registered")){if(iframe.contentWindow&&iframe.contentWindow.registerCallbacks){iframe.setAttribute("callback-registered",true);iframe.contentWindow.registerCallbacks(_this.apiInitialized,_this.panoramaPositionChanged,_this.measurementChanged)}}else if(!iframe.getAttribute("init-called")){if(iframe.contentWindow&&iframe.contentWindow.StreetSmartApi){iframe.setAttribute("init-called",true);iframe.contentWindow.initApi()}}else{clearInterval(_this.iframePollIntervall)}});_defineProperty(_this,"apiInitialized",function(success){var message=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"";_this.setState({status:success?Status.INITIALIZED:Status.LOGIN,message:message,loginFailed:!success})});_defineProperty(_this,"panoramaPositionChanged",function(posData){if(_this.state.status!==Status.HAVEPOS){_this.setState({status:Status.HAVEPOS})}var scale=50;var angle=posData.hFov/2;var width=Math.sin(angle);var length=Math.sqrt(1-width*width);var size=scale/Math.sqrt(width*length);var coordinates=[[0,0],[size*width*2,0],[size*width,size*length]];var dimensions=[coordinates[1][0]+0.5,coordinates[2][1]+0.5];var canvas=document.createElement("canvas");canvas.width=dimensions[0];canvas.height=dimensions[1];var context=canvas.getContext("2d");context.fillStyle="rgba(255, 0, 0, 0.5)";context.strokeStyle="#FF0000";context.lineWidth=1;context.beginPath();context.moveTo(coordinates[0][0],coordinates[0][1]);coordinates.slice(1).forEach(function(coo){return context.lineTo(coo[0],coo[1])});context.closePath();context.fill();ResourceRegistry.addResource("cyclomedia-cone",context.canvas.toDataURL());var feature={geometry:{type:"Point",coordinates:posData.pos},crs:posData.crs,styleName:"image",styleOptions:{img:"cyclomedia-cone",rotation:posData.yaw,size:dimensions}};var layer={id:"cyclomedia-cone",role:LayerRole.MARKER};_this.props.addLayerFeatures(layer,[feature],true)});_defineProperty(_this,"measurementChanged",function(measurement){if(_this.props.displayMeasurements){if(measurement){var layer={id:"cyclomedia-measurements",role:LayerRole.MARKER,crs:measurement.crs.properties.name,styleOptions:{strokeColor:"red",strokeWidth:4,fillColor:[255,0,0,0.25],strokeDash:[]}};_this.props.addLayerFeatures(layer,measurement.features,true)}else{_this.props.removeLayer("cyclomedia-measurements")}}});_defineProperty(_this,"cyclomediaIndexHtml",function(){var supportedLang=["de","en-GB","en-US","fi","fr","nl","tr","pl"];var lang=LocaleUtils.lang();if(supportedLang.indexOf(lang)<0){lang=lang.slice(0,2);if(supportedLang.indexOf(lang)<0){lang="en-US"}}var loginOauth=!!_this.props.clientId&&!_this.state.loginFailed;return"\n <!DOCTYPE html>\n <html>\n <head>\n <script type=\"text/javascript\" src=\"https://unpkg.com/react@16.12.0/umd/react.production.min.js\"></script>\n <script type=\"text/javascript\" src=\"https://unpkg.com/react-dom@16.12.0/umd/react-dom.production.min.js\"></script>\n <script type=\"text/javascript\" src=\"https://streetsmart.cyclomedia.com/api/v".concat(_this.props.cyclomediaVersion,"/StreetSmartApi.js\"></script>\n <script type=\"text/javascript\">\n let apiInitialized = false;\n let initCallback = null;\n let posCallback = null;\n let measureCallback = null;\n\n function initApi() {\n StreetSmartApi.init({\n targetElement: document.getElementById(\"streetsmartApi\"),\n username: \"").concat(_this.state.username||undefined,"\",\n password: \"").concat(_this.state.password||undefined,"\",\n apiKey: \"").concat(_this.props.apikey,"\",\n clientId: \"").concat(_this.props.clientId,"\",\n loginOauth: ").concat(loginOauth,",\n loginRedirectUri: \"").concat(_this.props.loginRedirectUri,"\",\n logoutRedirectUri: \"").concat(_this.props.logoutRedirectUri,"\",\n srs: \"").concat(_this.props.projection,"\",\n locale: \"").concat(lang,"\",\n configurationUrl: 'https://atlas.cyclomedia.com/configuration',\n addressSettings: {\n locale: \"us\",\n database: \"Nokia\"\n }\n }).then(() => {\n apiInitialized = true;\n if (initCallback) {\n initCallback(true);\n }\n }, (e) => {\n apiInitialized = false;\n if (initCallback) {\n initCallback(false, e.message);\n }\n });\n }\n function openImage(posStr, crs) {\n if (!apiInitialized) {\n return;\n }\n StreetSmartApi.open(posStr, {\n viewerType: StreetSmartApi.ViewerType.PANORAMA,\n srs: crs,\n panoramaViewer: {\n closable: false,\n maximizable: true,\n replace: true,\n recordingsVisible: true,\n navbarVisible: true,\n timeTravelVisible: true,\n measureTypeButtonVisible: true,\n measureTypeButtonStart: true,\n measureTypeButtonToggle: true,\n },\n }).then((result) => {\n if (result && result[0]){\n window.panoramaViewer = result[0];\n window.panoramaViewer.on(StreetSmartApi.Events.panoramaViewer.IMAGE_CHANGE, changeView);\n window.panoramaViewer.on(StreetSmartApi.Events.panoramaViewer.VIEW_CHANGE, changeView);\n StreetSmartApi.on(StreetSmartApi.Events.measurement.MEASUREMENT_CHANGED, changeMeasurement);\n StreetSmartApi.on(StreetSmartApi.Events.measurement.MEASUREMENT_STOPPED, stopMeasurement);\n }\n }).catch((reason) => {\n console.log('Failed to create component(s) through API: ' + reason);\n });\n }\n function changeView() {\n if (posCallback) {\n const recording = window.panoramaViewer.getRecording();\n const orientation = window.panoramaViewer.getOrientation();\n const pos = recording.xyz;\n const posData = {\n pos: [pos[0], pos[1]],\n crs: recording.srs,\n yaw: orientation.yaw * Math.PI / 180,\n hFov: orientation.hFov * Math.PI / 180.0\n }\n posCallback(posData);\n }\n }\n function changeMeasurement(e) {\n measureCallback(e.detail.activeMeasurement);\n }\n function stopMeasurement() {\n measureCallback(null);\n }\n function registerCallbacks(_initCallback, _posCallback, _measureCallback) {\n initCallback = _initCallback;\n posCallback = _posCallback;\n measureCallback = _measureCallback;\n }\n </script>\n <style>\n html, body, #streetsmartApi {height: 100%;}\n </style>\n </head>\n <body style=\"margin: 0\">\n <div id=\"streetsmartApi\">\n </div>\n </body>\n </html>\n ")});_defineProperty(_this,"addRecordingsWFS",function(){var layer={id:"cyclomedia-recordings",type:"wfs",loader:function loader(vectorSource,extent,resolution,projection,success,failure){var bbox=CoordinatesUtils.reprojectBbox(extent,projection.getCode(),_this.props.mapCrs);var bboxstr=bbox.join(",");var reqUrl="https://atlasapi.cyclomedia.com/api/recording/wfs?service=WFS&version=1.1.0&request=GetFeature&typename=atlas:Recording&srsname=".concat(_this.props.mapCrs,"&bbox=").concat(bboxstr,"&maxFeatures=10000000");var xhr=new XMLHttpRequest;xhr.open("GET",reqUrl);xhr.setRequestHeader("Authorization","Basic "+btoa(_this.state.username+":"+_this.state.password));var onError=function onError(){vectorSource.removeLoadedExtent(extent);failure()};xhr.onerror=onError;xhr.onload=function(){if(xhr.status===200){var features=vectorSource.getFormat().readFeatures(xhr.responseText,{dataProjection:_this.props.mapCrs,featureProjection:projection.getCode()});vectorSource.addFeatures(features);success(features)}else{onError()}};xhr.send()},name:"atlas:Recording",version:"1.1.0",projection:_this.props.mapCrs,formats:["text/xml; subtype=gml/3.1.1"],invertAxisOrientation:true,role:LayerRole.SELECTION,color:"#6666FF",visibility:_this.props.mapScale<=_this.props.maxMapScale};_this.props.addLayer(layer)});_defineProperty(_this,"queryPoint",function(prevProps){if(_this.props.click===prevProps.click){return null}var cmFeature=_this.props.click.features.find(function(feature){return feature.layerId==="cyclomedia-recordings"});return cmFeature?cmFeature.geometry.coordinates:null});_this.iframe=null;_this.iframePollIntervall=null;if(props.credentialUserInfoFields){_this.state.username=props.userInfos[props.credentialUserInfoFields.username];_this.state.password=props.userInfos[props.credentialUserInfoFields.password]}return _this}_inherits(Cyclomedia,_React$Component);return _createClass(Cyclomedia,[{key:"componentDidUpdate",value:function componentDidUpdate(prevProps,prevState){if(!prevProps.active&&this.props.active){this.setState({status:this.props.clientId?Status.INITIALIZING:Status.LOGIN,loginFailed:false})}else if(prevProps.active&&!this.props.active||prevProps.theme&&!this.props.theme){this.onClose()}// Load WFS when loading
|
|
10
|
-
|
|
11
|
-
|
|
46
|
+
*/
|
|
47
|
+
var Cyclomedia = /*#__PURE__*/function (_React$Component) {
|
|
48
|
+
function Cyclomedia(props) {
|
|
49
|
+
var _this;
|
|
50
|
+
_classCallCheck(this, Cyclomedia);
|
|
51
|
+
_this = _callSuper(this, Cyclomedia, [props]);
|
|
52
|
+
_defineProperty(_this, "state", {
|
|
53
|
+
status: Status.LOGIN,
|
|
54
|
+
message: "",
|
|
55
|
+
username: "",
|
|
56
|
+
password: "",
|
|
57
|
+
loginFailed: false
|
|
58
|
+
});
|
|
59
|
+
_defineProperty(_this, "onClose", function () {
|
|
60
|
+
_this.props.setCurrentTask(null);
|
|
61
|
+
_this.setState({
|
|
62
|
+
status: Status.LOGIN,
|
|
63
|
+
loginFailed: false
|
|
64
|
+
});
|
|
65
|
+
_this.iframe = null;
|
|
66
|
+
});
|
|
67
|
+
_defineProperty(_this, "setIframeRef", function (iframe) {
|
|
68
|
+
if (iframe && iframe !== _this.iframe) {
|
|
69
|
+
_this.iframe = iframe;
|
|
70
|
+
clearInterval(_this.iframePollIntervall);
|
|
71
|
+
_this.iframePollIntervall = setInterval(function () {
|
|
72
|
+
return _this.setupIframe(iframe);
|
|
73
|
+
}, 500);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
_defineProperty(_this, "setupIframe", function (iframe) {
|
|
77
|
+
if (!iframe.getAttribute("content-set")) {
|
|
78
|
+
if (iframe.contentWindow && iframe.contentWindow.document) {
|
|
79
|
+
iframe.setAttribute("content-set", true);
|
|
80
|
+
iframe.contentWindow.document.open();
|
|
81
|
+
iframe.contentWindow.document.write(_this.cyclomediaIndexHtml());
|
|
82
|
+
iframe.contentWindow.document.close();
|
|
83
|
+
_this.iframe = iframe;
|
|
84
|
+
}
|
|
85
|
+
} else if (!iframe.getAttribute("callback-registered")) {
|
|
86
|
+
if (iframe.contentWindow && iframe.contentWindow.registerCallbacks) {
|
|
87
|
+
iframe.setAttribute("callback-registered", true);
|
|
88
|
+
iframe.contentWindow.registerCallbacks(_this.apiInitialized, _this.panoramaPositionChanged, _this.measurementChanged);
|
|
89
|
+
}
|
|
90
|
+
} else if (!iframe.getAttribute("init-called")) {
|
|
91
|
+
if (iframe.contentWindow && iframe.contentWindow.StreetSmartApi) {
|
|
92
|
+
iframe.setAttribute("init-called", true);
|
|
93
|
+
iframe.contentWindow.initApi();
|
|
94
|
+
}
|
|
95
|
+
} else {
|
|
96
|
+
clearInterval(_this.iframePollIntervall);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
_defineProperty(_this, "apiInitialized", function (success) {
|
|
100
|
+
var message = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
101
|
+
_this.setState({
|
|
102
|
+
status: success ? Status.INITIALIZED : Status.LOGIN,
|
|
103
|
+
message: message,
|
|
104
|
+
loginFailed: !success
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
_defineProperty(_this, "panoramaPositionChanged", function (posData) {
|
|
108
|
+
if (_this.state.status !== Status.HAVEPOS) {
|
|
109
|
+
_this.setState({
|
|
110
|
+
status: Status.HAVEPOS
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
var scale = 50;
|
|
114
|
+
var angle = posData.hFov / 2.0;
|
|
115
|
+
var width = Math.sin(angle);
|
|
116
|
+
var length = Math.sqrt(1.0 - width * width);
|
|
117
|
+
var size = scale / Math.sqrt(width * length);
|
|
118
|
+
var coordinates = [[0, 0], [size * width * 2, 0], [size * width, size * length]];
|
|
119
|
+
var dimensions = [coordinates[1][0] + 0.5, coordinates[2][1] + 0.5];
|
|
120
|
+
var canvas = document.createElement('canvas');
|
|
121
|
+
canvas.width = dimensions[0];
|
|
122
|
+
canvas.height = dimensions[1];
|
|
123
|
+
var context = canvas.getContext('2d');
|
|
124
|
+
context.fillStyle = 'rgba(255, 0, 0, 0.5)';
|
|
125
|
+
context.strokeStyle = '#FF0000';
|
|
126
|
+
context.lineWidth = 1;
|
|
127
|
+
context.beginPath();
|
|
128
|
+
context.moveTo(coordinates[0][0], coordinates[0][1]);
|
|
129
|
+
coordinates.slice(1).forEach(function (coo) {
|
|
130
|
+
return context.lineTo(coo[0], coo[1]);
|
|
131
|
+
});
|
|
132
|
+
context.closePath();
|
|
133
|
+
context.fill();
|
|
134
|
+
ResourceRegistry.addResource("cyclomedia-cone", context.canvas.toDataURL());
|
|
135
|
+
var feature = {
|
|
136
|
+
geometry: {
|
|
137
|
+
type: 'Point',
|
|
138
|
+
coordinates: posData.pos
|
|
139
|
+
},
|
|
140
|
+
crs: posData.crs,
|
|
141
|
+
styleName: 'image',
|
|
142
|
+
styleOptions: {
|
|
143
|
+
img: "cyclomedia-cone",
|
|
144
|
+
rotation: posData.yaw,
|
|
145
|
+
size: dimensions
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
var layer = {
|
|
149
|
+
id: "cyclomedia-cone",
|
|
150
|
+
role: LayerRole.MARKER
|
|
151
|
+
};
|
|
152
|
+
_this.props.addLayerFeatures(layer, [feature], true);
|
|
153
|
+
});
|
|
154
|
+
_defineProperty(_this, "measurementChanged", function (measurement) {
|
|
155
|
+
if (_this.props.displayMeasurements) {
|
|
156
|
+
if (measurement) {
|
|
157
|
+
var layer = {
|
|
158
|
+
id: "cyclomedia-measurements",
|
|
159
|
+
role: LayerRole.MARKER,
|
|
160
|
+
crs: measurement.crs.properties.name,
|
|
161
|
+
styleOptions: {
|
|
162
|
+
strokeColor: 'red',
|
|
163
|
+
strokeWidth: 4,
|
|
164
|
+
fillColor: [255, 0, 0, 0.25],
|
|
165
|
+
strokeDash: []
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
_this.props.addLayerFeatures(layer, measurement.features, true);
|
|
169
|
+
} else {
|
|
170
|
+
_this.props.removeLayer("cyclomedia-measurements");
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
_defineProperty(_this, "cyclomediaIndexHtml", function () {
|
|
175
|
+
var supportedLang = ["de", "en-GB", "en-US", "fi", "fr", "nl", "tr", "pl"];
|
|
176
|
+
var lang = LocaleUtils.lang();
|
|
177
|
+
if (supportedLang.indexOf(lang) < 0) {
|
|
178
|
+
lang = lang.slice(0, 2);
|
|
179
|
+
if (supportedLang.indexOf(lang) < 0) {
|
|
180
|
+
lang = "en-US";
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
var loginOauth = !!_this.props.clientId && !_this.state.loginFailed;
|
|
184
|
+
return "\n <!DOCTYPE html>\n <html>\n <head>\n <script type=\"text/javascript\" src=\"https://unpkg.com/react@16.12.0/umd/react.production.min.js\"></script>\n <script type=\"text/javascript\" src=\"https://unpkg.com/react-dom@16.12.0/umd/react-dom.production.min.js\"></script>\n <script type=\"text/javascript\" src=\"https://streetsmart.cyclomedia.com/api/v".concat(_this.props.cyclomediaVersion, "/StreetSmartApi.js\"></script>\n <script type=\"text/javascript\">\n let apiInitialized = false;\n let initCallback = null;\n let posCallback = null;\n let measureCallback = null;\n\n function initApi() {\n StreetSmartApi.init({\n targetElement: document.getElementById(\"streetsmartApi\"),\n username: \"").concat(_this.state.username || undefined, "\",\n password: \"").concat(_this.state.password || undefined, "\",\n apiKey: \"").concat(_this.props.apikey, "\",\n clientId: \"").concat(_this.props.clientId, "\",\n loginOauth: ").concat(loginOauth, ",\n loginRedirectUri: \"").concat(_this.props.loginRedirectUri, "\",\n logoutRedirectUri: \"").concat(_this.props.logoutRedirectUri, "\",\n srs: \"").concat(_this.props.projection, "\",\n locale: \"").concat(lang, "\",\n configurationUrl: 'https://atlas.cyclomedia.com/configuration',\n addressSettings: {\n locale: \"us\",\n database: \"Nokia\"\n }\n }).then(() => {\n apiInitialized = true;\n if (initCallback) {\n initCallback(true);\n }\n }, (e) => {\n apiInitialized = false;\n if (initCallback) {\n initCallback(false, e.message);\n }\n });\n }\n function openImage(posStr, crs) {\n if (!apiInitialized) {\n return;\n }\n StreetSmartApi.open(posStr, {\n viewerType: StreetSmartApi.ViewerType.PANORAMA,\n srs: crs,\n panoramaViewer: {\n closable: false,\n maximizable: true,\n replace: true,\n recordingsVisible: true,\n navbarVisible: true,\n timeTravelVisible: true,\n measureTypeButtonVisible: true,\n measureTypeButtonStart: true,\n measureTypeButtonToggle: true,\n },\n }).then((result) => {\n if (result && result[0]){\n window.panoramaViewer = result[0];\n window.panoramaViewer.on(StreetSmartApi.Events.panoramaViewer.IMAGE_CHANGE, changeView);\n window.panoramaViewer.on(StreetSmartApi.Events.panoramaViewer.VIEW_CHANGE, changeView);\n StreetSmartApi.on(StreetSmartApi.Events.measurement.MEASUREMENT_CHANGED, changeMeasurement);\n StreetSmartApi.on(StreetSmartApi.Events.measurement.MEASUREMENT_STOPPED, stopMeasurement);\n }\n }).catch((reason) => {\n console.log('Failed to create component(s) through API: ' + reason);\n });\n }\n function changeView() {\n if (posCallback) {\n const recording = window.panoramaViewer.getRecording();\n const orientation = window.panoramaViewer.getOrientation();\n const pos = recording.xyz;\n const posData = {\n pos: [pos[0], pos[1]],\n crs: recording.srs,\n yaw: orientation.yaw * Math.PI / 180,\n hFov: orientation.hFov * Math.PI / 180.0\n }\n posCallback(posData);\n }\n }\n function changeMeasurement(e) {\n measureCallback(e.detail.activeMeasurement);\n }\n function stopMeasurement() {\n measureCallback(null);\n }\n function registerCallbacks(_initCallback, _posCallback, _measureCallback) {\n initCallback = _initCallback;\n posCallback = _posCallback;\n measureCallback = _measureCallback;\n }\n </script>\n <style>\n html, body, #streetsmartApi {height: 100%;}\n </style>\n </head>\n <body style=\"margin: 0\">\n <div id=\"streetsmartApi\">\n </div>\n </body>\n </html>\n ");
|
|
185
|
+
});
|
|
186
|
+
_defineProperty(_this, "addRecordingsWFS", function () {
|
|
187
|
+
var layer = {
|
|
188
|
+
id: 'cyclomedia-recordings',
|
|
189
|
+
type: 'wfs',
|
|
190
|
+
loader: function loader(vectorSource, extent, resolution, projection, success, failure) {
|
|
191
|
+
var bbox = CoordinatesUtils.reprojectBbox(extent, projection.getCode(), _this.props.mapCrs);
|
|
192
|
+
var bboxstr = bbox.join(",");
|
|
193
|
+
var reqUrl = "https://atlasapi.cyclomedia.com/api/recording/wfs?service=WFS&version=1.1.0&request=GetFeature&typename=atlas:Recording&srsname=".concat(_this.props.mapCrs, "&bbox=").concat(bboxstr, "&maxFeatures=10000000");
|
|
194
|
+
var xhr = new XMLHttpRequest();
|
|
195
|
+
xhr.open('GET', reqUrl);
|
|
196
|
+
xhr.setRequestHeader("Authorization", "Basic " + btoa(_this.state.username + ":" + _this.state.password));
|
|
197
|
+
var onError = function onError() {
|
|
198
|
+
vectorSource.removeLoadedExtent(extent);
|
|
199
|
+
failure();
|
|
200
|
+
};
|
|
201
|
+
xhr.onerror = onError;
|
|
202
|
+
xhr.onload = function () {
|
|
203
|
+
if (xhr.status === 200) {
|
|
204
|
+
var features = vectorSource.getFormat().readFeatures(xhr.responseText, {
|
|
205
|
+
dataProjection: _this.props.mapCrs,
|
|
206
|
+
featureProjection: projection.getCode()
|
|
207
|
+
});
|
|
208
|
+
vectorSource.addFeatures(features);
|
|
209
|
+
success(features);
|
|
210
|
+
} else {
|
|
211
|
+
onError();
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
xhr.send();
|
|
215
|
+
},
|
|
216
|
+
name: 'atlas:Recording',
|
|
217
|
+
version: '1.1.0',
|
|
218
|
+
projection: _this.props.mapCrs,
|
|
219
|
+
formats: ['text/xml; subtype=gml/3.1.1'],
|
|
220
|
+
invertAxisOrientation: true,
|
|
221
|
+
role: LayerRole.SELECTION,
|
|
222
|
+
color: '#6666FF',
|
|
223
|
+
visibility: _this.props.mapScale <= _this.props.maxMapScale
|
|
224
|
+
};
|
|
225
|
+
_this.props.addLayer(layer);
|
|
226
|
+
});
|
|
227
|
+
_defineProperty(_this, "queryPoint", function (prevProps) {
|
|
228
|
+
if (_this.props.click === prevProps.click) {
|
|
229
|
+
return null;
|
|
230
|
+
}
|
|
231
|
+
var cmFeature = _this.props.click.features.find(function (feature) {
|
|
232
|
+
return feature.layerId === 'cyclomedia-recordings';
|
|
233
|
+
});
|
|
234
|
+
return cmFeature ? cmFeature.geometry.coordinates : null;
|
|
235
|
+
});
|
|
236
|
+
_this.iframe = null;
|
|
237
|
+
_this.iframePollIntervall = null;
|
|
238
|
+
if (props.credentialUserInfoFields) {
|
|
239
|
+
_this.state.username = props.userInfos[props.credentialUserInfoFields.username];
|
|
240
|
+
_this.state.password = props.userInfos[props.credentialUserInfoFields.password];
|
|
241
|
+
}
|
|
242
|
+
return _this;
|
|
243
|
+
}
|
|
244
|
+
_inherits(Cyclomedia, _React$Component);
|
|
245
|
+
return _createClass(Cyclomedia, [{
|
|
246
|
+
key: "componentDidUpdate",
|
|
247
|
+
value: function componentDidUpdate(prevProps, prevState) {
|
|
248
|
+
if (!prevProps.active && this.props.active) {
|
|
249
|
+
this.setState({
|
|
250
|
+
status: this.props.clientId ? Status.INITIALIZING : Status.LOGIN,
|
|
251
|
+
loginFailed: false
|
|
252
|
+
});
|
|
253
|
+
} else if (prevProps.active && !this.props.active || prevProps.theme && !this.props.theme) {
|
|
254
|
+
this.onClose();
|
|
255
|
+
}
|
|
256
|
+
// Load WFS when loading
|
|
257
|
+
if (this.state.status === Status.INITIALIZING && prevState.status < Status.INITIALIZING) {
|
|
258
|
+
this.addRecordingsWFS();
|
|
259
|
+
}
|
|
260
|
+
// Handle map click events
|
|
261
|
+
if ((this.state.status === Status.INITIALIZED || this.state.status === Status.HAVEPOS) && this.iframe) {
|
|
262
|
+
var clickPoint = this.queryPoint(prevProps);
|
|
263
|
+
if (clickPoint) {
|
|
264
|
+
var posStr = clickPoint[0] + "," + clickPoint[1];
|
|
265
|
+
this.iframe.contentWindow.openImage(posStr, this.props.mapCrs);
|
|
266
|
+
if (this.state.status !== Status.LOADPOS) {
|
|
267
|
+
this.setState({
|
|
268
|
+
status: Status.LOADPOS
|
|
269
|
+
});
|
|
270
|
+
this.props.removeLayer('cyclomedia-cone');
|
|
271
|
+
this.props.removeLayer('cyclomedia-measurements');
|
|
272
|
+
ResourceRegistry.removeResource("cyclomedia-cone");
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
if (this.props.active && this.props.mapScale !== prevProps.mapScale) {
|
|
277
|
+
this.props.changeLayerProperty('cyclomedia-recordings', 'visibility', this.props.mapScale <= this.props.maxMapScale);
|
|
278
|
+
}
|
|
279
|
+
if (this.state.status === Status.LOGIN && prevState.status > Status.LOGIN) {
|
|
280
|
+
this.props.removeLayer('cyclomedia-recordings');
|
|
281
|
+
this.props.removeLayer('cyclomedia-cone');
|
|
282
|
+
this.props.removeLayer('cyclomedia-measurements');
|
|
283
|
+
ResourceRegistry.removeResource("cyclomedia-cone");
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}, {
|
|
287
|
+
key: "render",
|
|
288
|
+
value: function render() {
|
|
289
|
+
var _this2 = this;
|
|
290
|
+
if (!this.props.active) {
|
|
291
|
+
return null;
|
|
292
|
+
}
|
|
293
|
+
var overlay = null;
|
|
294
|
+
if (this.state.status === Status.LOGIN) {
|
|
295
|
+
overlay = /*#__PURE__*/React.createElement("div", {
|
|
296
|
+
className: "cyclomedia-body-overlay"
|
|
297
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
298
|
+
className: "cyclomedia-login"
|
|
299
|
+
}, /*#__PURE__*/React.createElement("table", null, /*#__PURE__*/React.createElement("tbody", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, "Username:"), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("input", {
|
|
300
|
+
onChange: function onChange(ev) {
|
|
301
|
+
return _this2.setState({
|
|
302
|
+
username: ev.target.value
|
|
303
|
+
});
|
|
304
|
+
},
|
|
305
|
+
type: "text",
|
|
306
|
+
value: this.state.username
|
|
307
|
+
}))), /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, "Password:"), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("input", {
|
|
308
|
+
onChange: function onChange(ev) {
|
|
309
|
+
return _this2.setState({
|
|
310
|
+
password: ev.target.value
|
|
311
|
+
});
|
|
312
|
+
},
|
|
313
|
+
type: "password",
|
|
314
|
+
value: this.state.password
|
|
315
|
+
}))), /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", {
|
|
316
|
+
colSpan: "2"
|
|
317
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
318
|
+
className: "button",
|
|
319
|
+
disabled: !this.state.username,
|
|
320
|
+
onClick: function onClick() {
|
|
321
|
+
return _this2.setState({
|
|
322
|
+
status: Status.INITIALIZING
|
|
323
|
+
});
|
|
324
|
+
},
|
|
325
|
+
type: "button"
|
|
326
|
+
}, LocaleUtils.tr("cyclomedia.login")))), /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", {
|
|
327
|
+
className: "cyclomedia-login-message",
|
|
328
|
+
colSpan: "2"
|
|
329
|
+
}, this.state.message))))));
|
|
330
|
+
} else if (this.state.status === Status.INITIALIZING) {
|
|
331
|
+
overlay = /*#__PURE__*/React.createElement("div", {
|
|
332
|
+
className: "cyclomedia-body-overlay"
|
|
333
|
+
}, /*#__PURE__*/React.createElement(Spinner, null), /*#__PURE__*/React.createElement("span", null, LocaleUtils.tr("cyclomedia.initializing")));
|
|
334
|
+
} else if (this.state.status === Status.ERROR) {
|
|
335
|
+
overlay = /*#__PURE__*/React.createElement("div", {
|
|
336
|
+
className: "cyclomedia-body-overlay"
|
|
337
|
+
}, /*#__PURE__*/React.createElement("span", null, LocaleUtils.tr("cyclomedia.loaderror")));
|
|
338
|
+
} else if (this.state.status === Status.INITIALIZED) {
|
|
339
|
+
overlay = /*#__PURE__*/React.createElement("div", {
|
|
340
|
+
className: "cyclomedia-body-overlay"
|
|
341
|
+
}, /*#__PURE__*/React.createElement("span", null, LocaleUtils.tr("cyclomedia.clickonmap")));
|
|
342
|
+
} else if (this.state.status === Status.LOADPOS) {
|
|
343
|
+
overlay = /*#__PURE__*/React.createElement("div", {
|
|
344
|
+
className: "cyclomedia-body-overlay"
|
|
345
|
+
}, /*#__PURE__*/React.createElement(Spinner, null), /*#__PURE__*/React.createElement("span", null, LocaleUtils.tr("cyclomedia.loading")));
|
|
346
|
+
}
|
|
347
|
+
return /*#__PURE__*/React.createElement(ResizeableWindow, {
|
|
348
|
+
dockable: this.props.geometry.side,
|
|
349
|
+
icon: "cyclomedia",
|
|
350
|
+
initialHeight: this.props.geometry.initialHeight,
|
|
351
|
+
initialWidth: this.props.geometry.initialWidth,
|
|
352
|
+
initialX: this.props.geometry.initialX,
|
|
353
|
+
initialY: this.props.geometry.initialY,
|
|
354
|
+
initiallyDocked: this.props.geometry.initiallyDocked,
|
|
355
|
+
onClose: this.onClose,
|
|
356
|
+
splitScreenWhenDocked: true,
|
|
357
|
+
title: LocaleUtils.tr("cyclomedia.title"),
|
|
358
|
+
usePortal: false
|
|
359
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
360
|
+
className: "cyclomedia-body",
|
|
361
|
+
role: "body"
|
|
362
|
+
}, this.props.mapScale > this.props.maxMapScale && this.state.status > Status.LOGIN ? /*#__PURE__*/React.createElement("div", {
|
|
363
|
+
className: "cyclomedia-scale-hint"
|
|
364
|
+
}, LocaleUtils.tr("cyclomedia.scalehint", this.props.maxMapScale)) : null, this.state.status > Status.LOGIN ? /*#__PURE__*/React.createElement("iframe", {
|
|
365
|
+
className: "cyclomedia-frame",
|
|
366
|
+
onLoad: function onLoad(ev) {
|
|
367
|
+
return _this2.setupIframe(ev.target);
|
|
368
|
+
},
|
|
369
|
+
ref: function ref(el) {
|
|
370
|
+
return _this2.setIframeRef(el);
|
|
371
|
+
}
|
|
372
|
+
}) : null, overlay));
|
|
373
|
+
}
|
|
374
|
+
}]);
|
|
375
|
+
}(React.Component);
|
|
376
|
+
_defineProperty(Cyclomedia, "propTypes", {
|
|
377
|
+
active: PropTypes.bool,
|
|
378
|
+
addLayer: PropTypes.func,
|
|
379
|
+
addLayerFeatures: PropTypes.func,
|
|
380
|
+
/** The Cyclomedia API key */
|
|
381
|
+
apikey: PropTypes.string,
|
|
382
|
+
changeLayerProperty: PropTypes.func,
|
|
383
|
+
click: PropTypes.object,
|
|
384
|
+
/** OAuth client ID. */
|
|
385
|
+
clientId: PropTypes.string,
|
|
386
|
+
/** Fields from user_infos which contain username and password which will be pre-inserted into the login form. */
|
|
387
|
+
credentialUserInfoFields: PropTypes.shape({
|
|
388
|
+
username: PropTypes.string,
|
|
389
|
+
password: PropTypes.string
|
|
390
|
+
}),
|
|
391
|
+
/** The cyclomedia version. */
|
|
392
|
+
cyclomediaVersion: PropTypes.string,
|
|
393
|
+
/** Whether to display Cyclomedia measurement geometries on the map. */
|
|
394
|
+
displayMeasurements: PropTypes.bool,
|
|
395
|
+
/** Default window geometry with size, position and docking status. Positive position values (including '0') are related to top (InitialY) and left (InitialX), negative values (including '-0') to bottom (InitialY) and right (InitialX). */
|
|
396
|
+
geometry: PropTypes.shape({
|
|
397
|
+
initialWidth: PropTypes.number,
|
|
398
|
+
initialHeight: PropTypes.number,
|
|
399
|
+
initialX: PropTypes.number,
|
|
400
|
+
initialY: PropTypes.number,
|
|
401
|
+
initiallyDocked: PropTypes.bool,
|
|
402
|
+
side: PropTypes.string
|
|
403
|
+
}),
|
|
404
|
+
/** The relative path to the redirect login handling of oauth. */
|
|
405
|
+
loginRedirectUri: PropTypes.string,
|
|
406
|
+
/** The relative path to the redirect logout handling of oauth. */
|
|
407
|
+
logoutRedirectUri: PropTypes.string,
|
|
408
|
+
mapCrs: PropTypes.string,
|
|
409
|
+
mapScale: PropTypes.number,
|
|
410
|
+
/** The maximum map scale above which the recordings WFS won't be displayed. */
|
|
411
|
+
maxMapScale: PropTypes.number,
|
|
412
|
+
/** The projection to use for Cyclomedia. */
|
|
413
|
+
projection: PropTypes.string,
|
|
414
|
+
removeLayer: PropTypes.func,
|
|
415
|
+
setCurrentTask: PropTypes.func,
|
|
416
|
+
theme: PropTypes.object,
|
|
417
|
+
userInfos: PropTypes.object
|
|
418
|
+
});
|
|
419
|
+
_defineProperty(Cyclomedia, "defaultProps", {
|
|
420
|
+
cyclomediaVersion: '24.1',
|
|
421
|
+
displayMeasurements: true,
|
|
422
|
+
geometry: {
|
|
423
|
+
initialWidth: 480,
|
|
424
|
+
initialHeight: 640,
|
|
425
|
+
initialX: 0,
|
|
426
|
+
initialY: 0,
|
|
427
|
+
initiallyDocked: false,
|
|
428
|
+
side: 'left'
|
|
429
|
+
},
|
|
430
|
+
maxMapScale: 5000,
|
|
431
|
+
projection: 'EPSG:3857'
|
|
432
|
+
});
|
|
433
|
+
export default connect(function (state) {
|
|
434
|
+
return {
|
|
435
|
+
active: state.task.id === "Cyclomedia",
|
|
436
|
+
click: state.map.click,
|
|
437
|
+
mapCrs: state.map.projection,
|
|
438
|
+
mapScale: MapUtils.computeForZoom(state.map.scales, state.map.zoom),
|
|
439
|
+
theme: state.theme.current,
|
|
440
|
+
userInfos: state.localConfig.user_infos
|
|
441
|
+
};
|
|
442
|
+
}, {
|
|
443
|
+
addLayer: addLayer,
|
|
444
|
+
addLayerFeatures: addLayerFeatures,
|
|
445
|
+
changeLayerProperty: changeLayerProperty,
|
|
446
|
+
removeLayer: removeLayer,
|
|
447
|
+
setCurrentTask: setCurrentTask
|
|
448
|
+
})(Cyclomedia);
|