qwc2 2025.9.16 → 2025.9.24

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.
Files changed (42) hide show
  1. package/components/PluginsContainer.js +2 -2
  2. package/components/StandardApp.js +2 -2
  3. package/components/style/PluginsContainer.css +30 -0
  4. package/package.json +1 -1
  5. package/plugins/Authentication.js +2 -2
  6. package/plugins/MapLegend.js +1 -1
  7. package/plugins/Routing.js +4 -4
  8. package/plugins/ThemeSwitcher.js +2 -2
  9. package/plugins/TopBar.js +1 -1
  10. package/plugins/View3D.js +2 -2
  11. package/plugins/style/Authentication.css +1 -14
  12. package/plugins/style/ThemeSwitcher.css +4 -0
  13. package/resources/arrow.glb +0 -0
  14. package/resources/person.png +0 -0
  15. package/resources/person.svg +45 -0
  16. package/resources/pin.glb +0 -0
  17. package/resources/viewcone.svg +124 -0
  18. package/scripts/dist.sh +2 -0
  19. package/static/translations/bg-BG.json +2 -0
  20. package/static/translations/ca-ES.json +2 -0
  21. package/static/translations/cs-CZ.json +2 -0
  22. package/static/translations/de-CH.json +2 -0
  23. package/static/translations/de-DE.json +2 -0
  24. package/static/translations/en-US.json +2 -0
  25. package/static/translations/es-ES.json +2 -0
  26. package/static/translations/fi-FI.json +2 -0
  27. package/static/translations/fr-FR.json +2 -0
  28. package/static/translations/hu-HU.json +2 -0
  29. package/static/translations/it-IT.json +2 -0
  30. package/static/translations/ja-JP.json +2 -0
  31. package/static/translations/nl-NL.json +2 -0
  32. package/static/translations/no-NO.json +2 -0
  33. package/static/translations/pl-PL.json +2 -0
  34. package/static/translations/pt-BR.json +2 -0
  35. package/static/translations/pt-PT.json +2 -0
  36. package/static/translations/ro-RO.json +2 -0
  37. package/static/translations/ru-RU.json +2 -0
  38. package/static/translations/sv-SE.json +2 -0
  39. package/static/translations/tr-TR.json +2 -0
  40. package/static/translations/tsconfig.json +2 -0
  41. package/static/translations/uk-UA.json +2 -0
  42. package/utils/ThemeUtils.js +1 -1
@@ -5,10 +5,10 @@ function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof
5
5
  *
6
6
  * This source code is licensed under the BSD-style license found in the
7
7
  * LICENSE file in the root directory of this source tree.
8
- */import React from"react";import{connect}from"react-redux";import PropTypes from"prop-types";import ConfigUtils from"../utils/ConfigUtils";import PluginStore from"../utils/PluginStore";import ProcessNotifications from"./ProcessNotifications";import WindowManager from"./WindowManager";import"./style/PluginsContainer.css";export var MapButtonPortalContext=/*#__PURE__*/React.createContext(null);export var MapContainerPortalContext=/*#__PURE__*/React.createContext(null);var PluginsContainer=/*#__PURE__*/function(_React$Component){function PluginsContainer(){var _this;_classCallCheck(this,PluginsContainer);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key]}_this=_callSuper(this,PluginsContainer,[].concat(args));_defineProperty(_this,"state",{mapButtonsContainerRef:null,mapContainerRef:null});_defineProperty(_this,"renderPlugins",function(){var device=ConfigUtils.isMobile()?"mobile":"desktop";var plugins=PluginStore.getPlugins();return _this.props.pluginsConfig.map(function(pluginConf){var _this$props$theme,_this$props$theme2,_pluginConf$key;var Plugin=plugins[pluginConf.name+"Plugin"];if(!Plugin){return null}var themeDevicePluginConfig=((_this$props$theme=_this.props.theme)===null||_this$props$theme===void 0||(_this$props$theme=_this$props$theme.config)===null||_this$props$theme===void 0||(_this$props$theme=_this$props$theme[device])===null||_this$props$theme===void 0||(_this$props$theme=_this$props$theme.plugins)===null||_this$props$theme===void 0?void 0:_this$props$theme[pluginConf.name])||{};var themePluginConfig=((_this$props$theme2=_this.props.theme)===null||_this$props$theme2===void 0||(_this$props$theme2=_this$props$theme2.config)===null||_this$props$theme2===void 0||(_this$props$theme2=_this$props$theme2.plugins)===null||_this$props$theme2===void 0?void 0:_this$props$theme2[pluginConf.name])||{};var cfg=_objectSpread(_objectSpread(_objectSpread({},pluginConf.cfg||{}),themePluginConfig),themeDevicePluginConfig);return/*#__PURE__*/React.createElement(Plugin,_extends({key:(_pluginConf$key=pluginConf.key)!==null&&_pluginConf$key!==void 0?_pluginConf$key:pluginConf.name},cfg))})});_defineProperty(_this,"setupTouchEvents",function(el){if(el){el.addEventListener("touchstart",function(ev){_this.touchY=ev.targetTouches[0].clientY},{passive:false});el.addEventListener("touchmove",_this.preventOverscroll,{passive:false});var resizeObserver=new ResizeObserver(function(entries){var contentRectEntry=entries.find(function(entry){return entry.contentRect});if(contentRectEntry){var height=contentRectEntry.contentRect.height;el.style.setProperty("--plugins-container-height","".concat(height,"px"))}});resizeObserver.observe(el)}});_defineProperty(_this,"preventOverscroll",function(ev){if(ev.touches[0].touchType!=="direct"){// Don't do anything for stylus inputs
8
+ */import React from"react";import{connect}from"react-redux";import PropTypes from"prop-types";import ConfigUtils from"../utils/ConfigUtils";import PluginStore from"../utils/PluginStore";import ProcessNotifications from"./ProcessNotifications";import WindowManager from"./WindowManager";import"./style/PluginsContainer.css";export var MapButtonPortalContext=/*#__PURE__*/React.createContext(null);export var MapContainerPortalContext=/*#__PURE__*/React.createContext(null);export var AppInfosPortalContext=/*#__PURE__*/React.createContext(null);var PluginsContainer=/*#__PURE__*/function(_React$Component){function PluginsContainer(){var _this;_classCallCheck(this,PluginsContainer);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key]}_this=_callSuper(this,PluginsContainer,[].concat(args));_defineProperty(_this,"state",{mapButtonsContainerRef:null,mapContainerRef:null,appInfosContainerRef:null});_defineProperty(_this,"renderPlugins",function(){var device=ConfigUtils.isMobile()?"mobile":"desktop";var plugins=PluginStore.getPlugins();return _this.props.pluginsConfig.map(function(pluginConf){var _this$props$theme,_this$props$theme2,_pluginConf$key;var Plugin=plugins[pluginConf.name+"Plugin"];if(!Plugin){return null}var themeDevicePluginConfig=((_this$props$theme=_this.props.theme)===null||_this$props$theme===void 0||(_this$props$theme=_this$props$theme.config)===null||_this$props$theme===void 0||(_this$props$theme=_this$props$theme[device])===null||_this$props$theme===void 0||(_this$props$theme=_this$props$theme.plugins)===null||_this$props$theme===void 0?void 0:_this$props$theme[pluginConf.name])||{};var themePluginConfig=((_this$props$theme2=_this.props.theme)===null||_this$props$theme2===void 0||(_this$props$theme2=_this$props$theme2.config)===null||_this$props$theme2===void 0||(_this$props$theme2=_this$props$theme2.plugins)===null||_this$props$theme2===void 0?void 0:_this$props$theme2[pluginConf.name])||{};var cfg=_objectSpread(_objectSpread(_objectSpread({},pluginConf.cfg||{}),themePluginConfig),themeDevicePluginConfig);return/*#__PURE__*/React.createElement(Plugin,_extends({key:(_pluginConf$key=pluginConf.key)!==null&&_pluginConf$key!==void 0?_pluginConf$key:pluginConf.name},cfg))})});_defineProperty(_this,"setupTouchEvents",function(el){if(el){el.addEventListener("touchstart",function(ev){_this.touchY=ev.targetTouches[0].clientY},{passive:false});el.addEventListener("touchmove",_this.preventOverscroll,{passive:false});var resizeObserver=new ResizeObserver(function(entries){var contentRectEntry=entries.find(function(entry){return entry.contentRect});if(contentRectEntry){var height=contentRectEntry.contentRect.height;el.style.setProperty("--plugins-container-height","".concat(height,"px"))}});resizeObserver.observe(el)}});_defineProperty(_this,"preventOverscroll",function(ev){if(ev.touches[0].touchType!=="direct"){// Don't do anything for stylus inputs
9
9
  return}var scrollEvent=false;var element=ev.target;var direction=ev.targetTouches[0].clientY-_this.touchY;_this.touchY=ev.targetTouches[0].clientY;while(!scrollEvent&&element){var scrollable=element.scrollHeight>element.clientHeight;// Workaround for resizeable-window having scrollHeight > clientHeight even though it has no scrollbar
10
10
  if(element.classList.contains("resizeable-window")){scrollable=false}if(element.type==="range"){// If it is a range element, treat it as a scroll event
11
11
  scrollEvent=true}else if(scrollable&&element.scrollTop+element.clientHeight<element.scrollHeight&&direction<0){// User scrolls down and element is not at end of scroll
12
12
  scrollEvent=true}else if(scrollable&&element.scrollTop>0&&direction>0){// User scrolls up and element is not at start of scroll
13
- scrollEvent=true}else{element=element.parentElement}}if(!scrollEvent){ev.preventDefault()}});_defineProperty(_this,"setMapContainerRef",function(el){_this.setState({mapContainerRef:el})});_defineProperty(_this,"setButtonContainerRef",function(el){_this.setState({mapButtonsContainerRef:el});if(el){var resizeObserver=new ResizeObserver(function(entries){var contentRectEntry=entries.find(function(entry){return entry.contentRect});if(contentRectEntry){var width=contentRectEntry.contentRect.width;var height=contentRectEntry.contentRect.height;el.style.setProperty("--buttons-container-width","".concat(width,"px"));el.style.setProperty("--buttons-container-height","".concat(height,"px"))}});resizeObserver.observe(el);el.recomputeSpacers=function(){var slots=new Set;Array.from(el.childNodes).forEach(function(child){if(child.dataset.spacer){el.removeChild(child)}else{slots.add(child.dataset.slot)}});var maxSlot=Math.max.apply(Math,_toConsumableArray(slots));for(var i=0;i<maxSlot;++i){if(!slots.has(String(i))){var child=document.createElement("div");child.className="map-buttons-spacer";child.dataset.spacer=1;child.style.order=i;el.appendChild(child)}}}}});return _this}_inherits(PluginsContainer,_React$Component);return _createClass(PluginsContainer,[{key:"render",value:function render(){var _this$props$className;var left=this.props.mapMargins.left+this.props.mapMargins.outerLeft;var top=this.props.mapMargins.top;var right=this.props.mapMargins.right+this.props.mapMargins.outerRight;var bottom=this.props.mapMargins.bottom;var mapContainerStyle={left:"calc("+left+"px)",top:"calc(var(--topbar-height) + "+top+"px)",right:"calc("+right+"px)",bottom:"calc(var(--bottombar-height) + "+bottom+"px)"};var haveRefs=this.state.mapButtonsContainerRef&&this.state.mapContainerRef;return/*#__PURE__*/React.createElement("div",{className:"plugins-container "+((_this$props$className=this.props.className)!==null&&_this$props$className!==void 0?_this$props$className:""),ref:this.setupTouchEvents},/*#__PURE__*/React.createElement(MapButtonPortalContext.Provider,{value:this.state.mapButtonsContainerRef},/*#__PURE__*/React.createElement(MapContainerPortalContext.Provider,{value:this.state.mapContainerRef},haveRefs?this.renderPlugins():null,haveRefs?this.props.children:null)),/*#__PURE__*/React.createElement(WindowManager,null),/*#__PURE__*/React.createElement("div",{className:"map-container",ref:this.setMapContainerRef,style:mapContainerStyle},/*#__PURE__*/React.createElement(ProcessNotifications,null)),/*#__PURE__*/React.createElement("div",{className:"map-buttons-container",ref:this.setButtonContainerRef,style:mapContainerStyle}))}}])}(React.Component);_defineProperty(PluginsContainer,"propTypes",{children:PropTypes.oneOfType([PropTypes.node,PropTypes.func]),className:PropTypes.string,mapMargins:PropTypes.object,pluginsConfig:PropTypes.array,theme:PropTypes.object});export default connect(function(state){return{// Just to trigger re-render when custom plugins change
13
+ scrollEvent=true}else{element=element.parentElement}}if(!scrollEvent){ev.preventDefault()}});_defineProperty(_this,"setMapContainerRef",function(el){_this.setState({mapContainerRef:el})});_defineProperty(_this,"setAppInfosContainerRef",function(el){_this.setState({appInfosContainerRef:el})});_defineProperty(_this,"setButtonContainerRef",function(el){_this.setState({mapButtonsContainerRef:el});if(el){var resizeObserver=new ResizeObserver(function(entries){var contentRectEntry=entries.find(function(entry){return entry.contentRect});if(contentRectEntry){var width=contentRectEntry.contentRect.width;var height=contentRectEntry.contentRect.height;el.style.setProperty("--buttons-container-width","".concat(width,"px"));el.style.setProperty("--buttons-container-height","".concat(height,"px"))}});resizeObserver.observe(el);el.recomputeSpacers=function(){var slots=new Set;Array.from(el.childNodes).forEach(function(child){if(child.dataset.spacer){el.removeChild(child)}else{slots.add(child.dataset.slot)}});var maxSlot=Math.max.apply(Math,_toConsumableArray(slots));for(var i=0;i<maxSlot;++i){if(!slots.has(String(i))){var child=document.createElement("div");child.className="map-buttons-spacer";child.dataset.spacer=1;child.style.order=i;el.appendChild(child)}}}}});return _this}_inherits(PluginsContainer,_React$Component);return _createClass(PluginsContainer,[{key:"render",value:function render(){var _this$props$className;var left=this.props.mapMargins.left+this.props.mapMargins.outerLeft;var top=this.props.mapMargins.top;var right=this.props.mapMargins.right+this.props.mapMargins.outerRight;var bottom=this.props.mapMargins.bottom;var mapContainerStyle={left:"calc("+left+"px)",top:"calc(var(--topbar-height) + "+top+"px)",right:"calc("+right+"px)",bottom:"calc(var(--bottombar-height) + "+bottom+"px)"};var haveRefs=this.state.mapButtonsContainerRef&&this.state.mapContainerRef&&this.state.appInfosContainerRef;return/*#__PURE__*/React.createElement("div",{className:"plugins-container "+((_this$props$className=this.props.className)!==null&&_this$props$className!==void 0?_this$props$className:""),ref:this.setupTouchEvents},/*#__PURE__*/React.createElement(AppInfosPortalContext.Provider,{value:this.state.appInfosContainerRef},/*#__PURE__*/React.createElement(MapButtonPortalContext.Provider,{value:this.state.mapButtonsContainerRef},/*#__PURE__*/React.createElement(MapContainerPortalContext.Provider,{value:this.state.mapContainerRef},haveRefs?this.renderPlugins():null,haveRefs?this.props.children:null))),/*#__PURE__*/React.createElement(WindowManager,null),/*#__PURE__*/React.createElement("div",{className:"map-container",ref:this.setMapContainerRef,style:mapContainerStyle},/*#__PURE__*/React.createElement(ProcessNotifications,null)),/*#__PURE__*/React.createElement("div",{className:"map-buttons-container",ref:this.setButtonContainerRef,style:mapContainerStyle}),/*#__PURE__*/React.createElement("div",{className:"app-infos-container",ref:this.setAppInfosContainerRef,style:mapContainerStyle}))}}])}(React.Component);_defineProperty(PluginsContainer,"propTypes",{children:PropTypes.oneOfType([PropTypes.node,PropTypes.func]),className:PropTypes.string,mapMargins:PropTypes.object,pluginsConfig:PropTypes.array,theme:PropTypes.object});export default connect(function(state){return{// Just to trigger re-render when custom plugins change
14
14
  customPlugins:state.localConfig.customPlugins,mapMargins:state.windows.mapMargins,theme:state.theme.current}})(PluginsContainer);
@@ -8,9 +8,9 @@ function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof
8
8
  */import React from"react";import{Provider,connect}from"react-redux";import axios from"axios";import deepmerge from"deepmerge";import{register as olProj4Register}from"ol/proj/proj4";import Proj4js from"proj4";import PropTypes from"prop-types";import{localConfigLoaded,setStartupParameters,setColorScheme}from"../actions/localConfig";import{changeLocale}from"../actions/locale";import{setCurrentTask}from"../actions/task";import{themesLoaded,setCurrentTheme}from"../actions/theme";import{NotificationType,showNotification,setBottombarHeight,setTopbarHeight}from"../actions/windows";import ReducerIndex from"../reducers/index";import{createStore}from"../stores/StandardStore";import ConfigUtils from"../utils/ConfigUtils";import CoordinatesUtils from"../utils/CoordinatesUtils";import LocaleUtils from"../utils/LocaleUtils";import MapUtils from"../utils/MapUtils";import MiscUtils from"../utils/MiscUtils";import{UrlParams,resolvePermaLink}from"../utils/PermaLinkUtils";import PluginStore from"../utils/PluginStore";import ThemeUtils from"../utils/ThemeUtils";import PluginsContainer from"./PluginsContainer";import"./style/App.css";import"./style/DefaultColorScheme.css";var CSRF_TOKEN=MiscUtils.getCsrfToken();if(CSRF_TOKEN){axios.interceptors.request.use(function(config){if(["POST","PUT","PATCH","DELETE"].includes(config.method.toUpperCase())){config.headers["X-CSRF-TOKEN"]=CSRF_TOKEN}return config},function(error){return Promise.reject(error)})}var AppContainerComponent=/*#__PURE__*/function(_React$Component){function AppContainerComponent(props){var _this;_classCallCheck(this,AppContainerComponent);_this=_callSuper(this,AppContainerComponent,[props]);_defineProperty(_this,"loadThemes",function(){_this.themesLoaded=true;var _this$props$startupCo=_this.props.startupConfig,state=_this$props$startupCo.state,permalinkInvalid=_this$props$startupCo.permalinkInvalid;var params=_objectSpread({},_this.props.startupConfig.params);// Clone as changed below
9
9
  // Warn if permalink key is invalid
10
10
  if(permalinkInvalid){_this.props.showNotification("missingtheme",LocaleUtils.tr("app.missingpermalink"),NotificationType.WARN,true)}// Load themes.json
11
- axios.get("themes.json",{params:{lang:_this.props.locale}}).then(function(response){var _this$props$appConfig,_this$props$appConfig2,_theme;var themes=ThemeUtils.applyTranslations(response.data.themes||{});(_this$props$appConfig=(_this$props$appConfig2=_this.props.appConfig).themePreprocessor)===null||_this$props$appConfig===void 0||_this$props$appConfig.call(_this$props$appConfig2,themes);_this.props.themesLoaded(themes);var theme=ThemeUtils.getThemeById(themes,params.t);if((!theme||theme.restricted)&&!ConfigUtils.getConfigProp("dontLoadDefaultTheme")){if(params.t){_this.props.showNotification("missingtheme",LocaleUtils.tr("app.missingtheme",params.t),NotificationType.WARN,true);params.l=undefined}var defaultTheme=Object.fromEntries(_this.props.defaultUrlParams.split("&").map(function(x){return x.split("=")})).t||themes.defaultTheme;theme=ThemeUtils.getThemeById(themes,defaultTheme);params.t=defaultTheme}if(theme){var _params$bl;// Compute initial view
11
+ axios.get("themes.json",{params:{lang:_this.props.locale}}).then(function(response){var _this$props$appConfig,_this$props$appConfig2,_theme;var themes=ThemeUtils.applyTranslations(response.data.themes||{});(_this$props$appConfig=(_this$props$appConfig2=_this.props.appConfig).themePreprocessor)===null||_this$props$appConfig===void 0||_this$props$appConfig.call(_this$props$appConfig2,themes);_this.props.themesLoaded(themes);var theme=ThemeUtils.getThemeById(themes,params.t);if((!theme||theme.restricted)&&!ConfigUtils.getConfigProp("dontLoadDefaultTheme")&&!ConfigUtils.havePlugin("Portal")){if(params.t){_this.props.showNotification("missingtheme",LocaleUtils.tr("app.missingtheme",params.t),NotificationType.WARN,true);params.l=undefined}var defaultTheme=Object.fromEntries(_this.props.defaultUrlParams.split("&").map(function(x){return x.split("=")})).t||themes.defaultTheme;theme=ThemeUtils.getThemeById(themes,defaultTheme);params.t=defaultTheme}if(theme){var _params$bl;// Compute initial view
12
12
  var initialView=params.v;var initialExtent=null;if(params.c&&params.s!==undefined){var coords=params.c.split(/[;,]/g).map(function(x){return parseFloat(x)||0});var scales=theme.scales||themes.defaultScales;var zoom=MapUtils.computeZoom(scales,params.s);if(coords.length===2){var p=CoordinatesUtils.reproject(coords,params.crs||theme.mapCrs,theme.bbox.crs);var bounds=theme.bbox.bounds;// Only accept c if it is within the theme bounds
13
- if(bounds[0]<=p[0]&&p[0]<=bounds[2]&&bounds[1]<=p[1]&&p[1]<=bounds[3]){initialExtent={center:coords,zoom:zoom,crs:params.crs||theme.mapCrs}}else{initialExtent={center:[0.5*(bounds[0]+bounds[2]),0.5*(bounds[1]+bounds[3])],zoom:zoom,crs:theme.bbox.crs}}}}else if(params.e){var _bounds=params.e.split(/[;,]/g).map(function(x){return parseFloat(x)||0});if(CoordinatesUtils.isValidExtent(_bounds)){initialExtent={bounds:_bounds,crs:params.crs||theme.mapCrs}}}var layerParams=params.l!==undefined?params.l.split(",").filter(function(entry){return entry}):null;if(layerParams&&ConfigUtils.getConfigProp("urlReverseLayerOrder")){layerParams.reverse()}_this.props.setCurrentTheme(theme,themes,false,initialExtent,layerParams,(_params$bl=params.bl)!==null&&_params$bl!==void 0?_params$bl:null,state.layers,_this.props.appConfig.themeLayerRestorer,_this.props.appConfig.externalLayerRestorer,initialView)}var task=ConfigUtils.getConfigProp("startupTask");if(task&&!((_theme=theme)!==null&&_theme!==void 0&&(_theme=_theme.config)!==null&&_theme!==void 0&&_theme.startupTask)){var mapClickAction=ConfigUtils.getPluginConfig(task.key).mapClickAction;_this.props.setCurrentTask(task.key,task.mode,mapClickAction)}})});_this.themesLoaded=false;// Set initial bottom/topbar height to zero in case not topbar/bottombar is enabled
13
+ if(bounds[0]<=p[0]&&p[0]<=bounds[2]&&bounds[1]<=p[1]&&p[1]<=bounds[3]){initialExtent={center:coords,zoom:zoom,crs:params.crs||theme.mapCrs}}else{initialExtent={center:[0.5*(bounds[0]+bounds[2]),0.5*(bounds[1]+bounds[3])],zoom:zoom,crs:theme.bbox.crs}}}}else if(params.e){var _bounds=params.e.split(/[;,]/g).map(function(x){return parseFloat(x)||0});if(CoordinatesUtils.isValidExtent(_bounds)){initialExtent={bounds:_bounds,crs:params.crs||theme.mapCrs}}}var layerParams=params.l!==undefined?params.l.split(",").filter(function(entry){return entry}):null;if(layerParams&&ConfigUtils.getConfigProp("urlReverseLayerOrder")){layerParams.reverse()}_this.props.setCurrentTheme(theme,themes,false,initialExtent,layerParams,(_params$bl=params.bl)!==null&&_params$bl!==void 0?_params$bl:null,state.layers,_this.props.appConfig.themeLayerRestorer,_this.props.appConfig.externalLayerRestorer,initialView)}else if(!ConfigUtils.havePlugin("Portal")){_this.props.showNotification("missingdefaulttheme",LocaleUtils.tr("app.missingdefaulttheme",params.t),NotificationType.WARN,true)}var task=ConfigUtils.getConfigProp("startupTask");if(task&&!((_theme=theme)!==null&&_theme!==void 0&&(_theme=_theme.config)!==null&&_theme!==void 0&&_theme.startupTask)){var mapClickAction=ConfigUtils.getPluginConfig(task.key).mapClickAction;_this.props.setCurrentTask(task.key,task.mode,mapClickAction)}})});_this.themesLoaded=false;// Set initial bottom/topbar height to zero in case not topbar/bottombar is enabled
14
14
  // The components will set the proper height if and when initialized
15
15
  props.setTopbarHeight(0);props.setBottombarHeight(0);return _this}_inherits(AppContainerComponent,_React$Component);return _createClass(AppContainerComponent,[{key:"componentDidMount",value:function componentDidMount(){this.componentDidUpdate({})}},{key:"componentDidUpdate",value:function componentDidUpdate(prevProps){// The map component needs to have finished loading before theme initialization can proceed
16
16
  if(this.props.haveMapSize&&!this.themesLoaded){this.loadThemes()}}},{key:"render",value:function render(){// Filter 2D plugins
@@ -10,6 +10,36 @@ div.map-container {
10
10
  position: absolute;
11
11
  }
12
12
 
13
+ div.app-infos-container {
14
+ position: absolute;
15
+ pointer-events: none;
16
+ display: flex;
17
+ flex-direction: column;
18
+ align-items: flex-start;
19
+ align-content: flex-start;
20
+ justify-content: flex-start;
21
+ flex-wrap: wrap-reverse;
22
+ z-index: 2;
23
+ overflow: hidden;
24
+ padding: 1em 1em 2.5em 1em;
25
+ row-gap: 0.25em;
26
+ }
27
+
28
+ div.app-info {
29
+ z-index: 1;
30
+ color: var(--panel-text-color);
31
+ background-color: var(--panel-bg-color);
32
+ box-shadow: 0 0 4px rgba(136, 136, 136, 0.5);
33
+ padding: 0.25em 0em 0.125em 0em;
34
+ display: flex;
35
+ }
36
+
37
+ div.app-info > span {
38
+ flex: 0 0 auto;
39
+ padding: 0 0.25em;
40
+ }
41
+
42
+
13
43
  div.map-buttons-container {
14
44
  position: absolute;
15
45
  pointer-events: none;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qwc2",
3
- "version": "2025.09.16",
3
+ "version": "2025.09.24",
4
4
  "description": "QGIS Web Client",
5
5
  "author": "Sourcepole AG",
6
6
  "license": "BSD-2-Clause",
@@ -4,10 +4,10 @@ function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof
4
4
  *
5
5
  * This source code is licensed under the BSD-style license found in the
6
6
  * LICENSE file in the root directory of this source tree.
7
- */import React from"react";import ReactDOM from"react-dom";import{connect}from"react-redux";import PropTypes from"prop-types";import url from"url";import Icon from"../components/Icon";import{MapContainerPortalContext}from"../components/PluginsContainer";import ConfigUtils from"../utils/ConfigUtils";import"./style/Authentication.css";/**
7
+ */import React from"react";import ReactDOM from"react-dom";import{connect}from"react-redux";import PropTypes from"prop-types";import url from"url";import Icon from"../components/Icon";import{AppInfosPortalContext}from"../components/PluginsContainer";import ConfigUtils from"../utils/ConfigUtils";import"./style/Authentication.css";/**
8
8
  * Handles authentication
9
9
  *
10
10
  * Invokes the the authentication service specified by `authServiceUrl` in `config.json`.
11
11
  */var Authentication=/*#__PURE__*/function(_React$Component){function Authentication(props){var _this;_classCallCheck(this,Authentication);_this=_callSuper(this,Authentication,[props]);_defineProperty(_this,"showLogin",function(){var urlObj=url.parse(window.location.href,true);if(_this.props.clearLayerParam){delete urlObj.query.l}urlObj.search=undefined;window.location.href=ConfigUtils.getConfigProp("authServiceUrl")+"login?url="+encodeURIComponent(url.format(urlObj))});_defineProperty(_this,"resetIdleTimer",function(){if(_this.idleTimer){clearTimeout(_this.idleTimer);_this.idleTimer=setTimeout(_this.idleAutologout,_this.props.idleTimeout*1000)}});_defineProperty(_this,"idleAutologout",function(){var urlObj=url.parse(window.location.href,true);urlObj.search=undefined;var loginUrl=ConfigUtils.getConfigProp("authServiceUrl")+"login?url="+encodeURIComponent(url.format(urlObj));window.location.href=ConfigUtils.getConfigProp("authServiceUrl")+"logout?url="+encodeURIComponent(loginUrl)});_this.idleTimer=null;return _this}_inherits(Authentication,_React$Component);return _createClass(Authentication,[{key:"componentDidMount",value:function componentDidMount(){var username=ConfigUtils.getConfigProp("username");if(this.props.requireLogin&&!username){this.showLogin()}if(this.props.idleTimeout&&username){this.idleTimer=setTimeout(this.idleAutologout,this.props.idleTimeout*1000);window.addEventListener("keydown",this.resetIdleTimer,{passive:true});window.addEventListener("mousedown",this.resetIdleTimer,{passive:true});window.addEventListener("wheel",this.resetIdleTimer,{passive:true})}}},{key:"componentDidUpdate",value:function componentDidUpdate(prevProps){var task=this.props.task;if(task!==prevProps.task){// "Login" and "Logout" task ids are legacy
12
12
  if(task.id==="Login"||task.id==="Authentication"&&task.mode==="Login"){this.showLogin()}else if(task.id==="Logout"||task.id==="Authentication"&&task.mode==="Logout"){// logout and redirect to custom logoutTargetUrl or current location if not set
13
- window.location.href=ConfigUtils.getConfigProp("authServiceUrl")+"logout?url="+encodeURIComponent(this.props.logoutTargetUrl||window.location.href)}}}},{key:"render",value:function render(){if(!this.props.showLoginUser){return null}var username=ConfigUtils.getConfigProp("username");if(!username){return null}return/*#__PURE__*/ReactDOM.createPortal(/*#__PURE__*/React.createElement("div",{className:"login-user"},/*#__PURE__*/React.createElement(Icon,{icon:"login"}),/*#__PURE__*/React.createElement("span",null,username)),this.context)}}])}(React.Component);_defineProperty(Authentication,"contextType",MapContainerPortalContext);_defineProperty(Authentication,"availableIn3D",true);_defineProperty(Authentication,"propTypes",{/** Whether to clear the layer parameter from the URL on login. */clearLayerParam:PropTypes.bool,/** An idle timeout in seconds after which the user is automatically logged of. */idleTimeout:PropTypes.number,/** An URL to redirect to on logout, instead of the viewer URL. */logoutTargetUrl:PropTypes.string,/** Whether authentication is required, i.e. the viewer automatically redirects to the login page if no user is authenticated. */requireLogin:PropTypes.bool,/** Whether to display the currently logged in user below the application menu button. */showLoginUser:PropTypes.bool,task:PropTypes.object});export default connect(function(state){return{task:state.task}},{})(Authentication);
13
+ window.location.href=ConfigUtils.getConfigProp("authServiceUrl")+"logout?url="+encodeURIComponent(this.props.logoutTargetUrl||window.location.href)}}}},{key:"render",value:function render(){if(!this.props.showLoginUser){return null}var username=ConfigUtils.getConfigProp("username");if(!username){return null}return/*#__PURE__*/ReactDOM.createPortal(/*#__PURE__*/React.createElement("div",{className:"app-info login-user"},/*#__PURE__*/React.createElement(Icon,{icon:"login"}),/*#__PURE__*/React.createElement("span",null,username)),this.context)}}])}(React.Component);_defineProperty(Authentication,"contextType",AppInfosPortalContext);_defineProperty(Authentication,"availableIn3D",true);_defineProperty(Authentication,"propTypes",{/** Whether to clear the layer parameter from the URL on login. */clearLayerParam:PropTypes.bool,/** An idle timeout in seconds after which the user is automatically logged of. */idleTimeout:PropTypes.number,/** An URL to redirect to on logout, instead of the viewer URL. */logoutTargetUrl:PropTypes.string,/** Whether authentication is required, i.e. the viewer automatically redirects to the login page if no user is authenticated. */requireLogin:PropTypes.bool,/** Whether to display the currently logged in user below the application menu button. */showLoginUser:PropTypes.bool,task:PropTypes.object});export default connect(function(state){return{task:state.task}},{})(Authentication);
@@ -10,5 +10,5 @@ function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof
10
10
  * The user can toggle whether to display only layers which are enabled, visible in the current extent and/or visible at the current scale.
11
11
  *
12
12
  * See https://docs.qgis.org/3.28/en/docs/server_manual/services/wms.html#wms-getlegendgraphic for supported extra legend params.
13
- */var MapLegend=/*#__PURE__*/function(_React$Component){function MapLegend(props){var _this;_classCallCheck(this,MapLegend);_this=_callSuper(this,MapLegend,[props]);_defineProperty(_this,"state",{onlyVisibleLegend:false,bboxDependentLegend:false,scaleDependentLegend:false,visible:false});_defineProperty(_this,"onClose",function(){_this.setState({visible:false})});_defineProperty(_this,"printLayerLegend",function(layer,sublayer,mapScale){var isCategorized=(sublayer.sublayers||[]).find(function(entry){return entry.category_sublayer===true});if(_this.props.excludeLayers.includes(sublayer.name)){return null}else if(sublayer.sublayers&&!isCategorized&&(!_this.state.onlyVisibleLegend||sublayer.visibility)){if(_this.props.addGroupTitles){var children=sublayer.sublayers.map(function(subsublayer){return _this.printLayerLegend(layer,subsublayer,mapScale)}).filter(function(x){return x});if(isEmpty(children)){return null}else{return/*#__PURE__*/React.createElement("div",{className:"map-legend-group",key:sublayer.name},/*#__PURE__*/React.createElement("div",{className:"map-legend-group-title"},sublayer.title||sublayer.name),/*#__PURE__*/React.createElement("div",{className:"map-legend-group-entries"},sublayer.sublayers.map(function(subsublayer){return _this.printLayerLegend(layer,subsublayer,mapScale)})))}}else{return sublayer.sublayers.map(function(subsublayer){return _this.printLayerLegend(layer,subsublayer,mapScale)})}}else{if(_this.state.onlyVisibleLegend&&!sublayer.visibility){return null}if((_this.state.onlyVisibleLegend||_this.state.scaleDependentLegend)&&!LayerUtils.layerScaleInRange(sublayer,mapScale)){return null}var request=LayerUtils.getLegendUrl(layer,{name:sublayer.name},mapScale,_this.props.map,_this.state.bboxDependentLegend,_this.state.scaleDependentLegend,_this.props.extraLegendParameters);return request?/*#__PURE__*/React.createElement("div",{className:"map-legend-legend-entry",key:sublayer.name},/*#__PURE__*/React.createElement("div",null,_this.props.addLayerTitles&&!sublayer.category_sublayer?/*#__PURE__*/React.createElement("div",{className:"map-legend-entry-title"},sublayer.title||sublayer.name):null,/*#__PURE__*/React.createElement("div",{className:"map-legend-entry-image"},/*#__PURE__*/React.createElement(Image,{src:request})))):null}});_this.state.onlyVisibleLegend=props.onlyVisibleLegend;_this.state.bboxDependentLegend=props.bboxDependentLegend;_this.state.scaleDependentLegend=props.scaleDependentLegend;return _this}_inherits(MapLegend,_React$Component);return _createClass(MapLegend,[{key:"componentDidUpdate",value:function componentDidUpdate(prevProps){if(this.props.active&&!prevProps.active){this.setState({visible:true});// Clear task immediately, visibility is stored as state
13
+ */var MapLegend=/*#__PURE__*/function(_React$Component){function MapLegend(props){var _this;_classCallCheck(this,MapLegend);_this=_callSuper(this,MapLegend,[props]);_defineProperty(_this,"state",{onlyVisibleLegend:false,bboxDependentLegend:false,scaleDependentLegend:false,visible:false});_defineProperty(_this,"onClose",function(){_this.setState({visible:false})});_defineProperty(_this,"printLayerLegend",function(layer,sublayer,mapScale){var isCategorized=(sublayer.sublayers||[]).find(function(entry){return entry.category_sublayer===true});if(_this.props.excludeLayers.includes(sublayer.name)){return null}else if(sublayer.sublayers&&!isCategorized&&(!_this.state.onlyVisibleLegend||sublayer.visibility)){if(_this.props.addGroupTitles){var children=sublayer.sublayers.map(function(subsublayer){return _this.printLayerLegend(layer,subsublayer,mapScale)}).filter(function(x){return x});if(isEmpty(children)){return null}else{return/*#__PURE__*/React.createElement("div",{className:"map-legend-group",key:sublayer.name},/*#__PURE__*/React.createElement("div",{className:"map-legend-group-title"},sublayer.title||sublayer.name),/*#__PURE__*/React.createElement("div",{className:"map-legend-group-entries"},sublayer.sublayers.map(function(subsublayer){return _this.printLayerLegend(layer,subsublayer,mapScale)})))}}else{return sublayer.sublayers.map(function(subsublayer){return _this.printLayerLegend(layer,subsublayer,mapScale)})}}else{if(_this.state.onlyVisibleLegend&&!sublayer.visibility){return null}if((_this.state.onlyVisibleLegend||_this.state.scaleDependentLegend)&&!LayerUtils.layerScaleInRange(sublayer,mapScale)){return null}var request=LayerUtils.getLegendUrl(layer,sublayer,mapScale,_this.props.map,_this.state.bboxDependentLegend,_this.state.scaleDependentLegend,_this.props.extraLegendParameters);return request?/*#__PURE__*/React.createElement("div",{className:"map-legend-legend-entry",key:sublayer.name},/*#__PURE__*/React.createElement("div",null,_this.props.addLayerTitles&&!sublayer.category_sublayer?/*#__PURE__*/React.createElement("div",{className:"map-legend-entry-title"},sublayer.title||sublayer.name):null,/*#__PURE__*/React.createElement("div",{className:"map-legend-entry-image"},/*#__PURE__*/React.createElement(Image,{src:request})))):null}});_this.state.onlyVisibleLegend=props.onlyVisibleLegend;_this.state.bboxDependentLegend=props.bboxDependentLegend;_this.state.scaleDependentLegend=props.scaleDependentLegend;return _this}_inherits(MapLegend,_React$Component);return _createClass(MapLegend,[{key:"componentDidUpdate",value:function componentDidUpdate(prevProps){if(this.props.active&&!prevProps.active){this.setState({visible:true});// Clear task immediately, visibility is stored as state
14
14
  this.props.setCurrentTask(null)}}},{key:"render",value:function render(){var _this2=this;if(!this.state.visible&&!this.props.lockedWindow){return null}var mapScale=MapUtils.computeForZoom(this.props.map.scales,this.props.map.zoom);var extraControls=[{icon:"eye",callback:function callback(){return _this2.setState(function(state){return{onlyVisibleLegend:!state.onlyVisibleLegend}})},active:this.state.onlyVisibleLegend,title:LocaleUtils.tr("maplegend.onlyvisible")},{icon:"box",callback:function callback(){return _this2.setState(function(state){return{bboxDependentLegend:!state.bboxDependentLegend}})},active:this.state.bboxDependentLegend,title:LocaleUtils.tr("maplegend.bboxdependent")},{icon:"scale",callback:function callback(){return _this2.setState(function(state){return{scaleDependentLegend:!state.scaleDependentLegend}})},active:this.state.scaleDependentLegend,title:LocaleUtils.tr("maplegend.scaledependent")}];return/*#__PURE__*/React.createElement(ResizeableWindow,{dockable:this.props.lockedWindow?false:this.props.geometry.side,extraControls:extraControls,icon:"list-alt",initialHeight:this.props.geometry.initialHeight,initialWidth:this.props.geometry.initialWidth,initialX:this.props.geometry.initialX,initialY:this.props.geometry.initialY,initiallyDocked:this.props.geometry.initiallyDocked,maximizeable:false,onClose:this.props.lockedWindow?null:this.onClose,title:LocaleUtils.tr("maplegend.windowtitle")},/*#__PURE__*/React.createElement("div",{className:"map-legend",role:"body"},this.props.layers.map(function(layer){if(_this2.state.onlyVisibleLegend&&!layer.visibility){return null}else if(layer.legendUrl){return _this2.printLayerLegend(layer,layer,mapScale)}else if(layer.color){return/*#__PURE__*/React.createElement("div",{className:"map-legend-legend-entry",key:layer.name},/*#__PURE__*/React.createElement("span",{className:"map-legend-color-box",style:{backgroundColor:layer.color}}),/*#__PURE__*/React.createElement("span",{className:"map-legend-entry-title"},layer.title||layer.name))}else{return null}})))}}])}(React.Component);_defineProperty(MapLegend,"propTypes",{active:PropTypes.bool,/** Whether to add group titles to the legend. */addGroupTitles:PropTypes.bool,/** Whether to add layer titles to the legend. Note that often the legend image itself already contains the layer title. */addLayerTitles:PropTypes.bool,/** Whether to display a BBOX-dependent legend by default. */bboxDependentLegend:PropTypes.bool,/** List of layernames to exclude from the legend. */excludeLayers:PropTypes.array,/** Extra parameters to add to the GetLegendGraphics request. */extraLegendParameters:PropTypes.string,/** Default window geometry with size, position and docking status. A locked window is not closeable and not resizeable. Positive position values (including '0') are related to top (InitialY) and left (InitialX), negative values (including '-0') to bottom (InitialY) and right (InitialX). */geometry:PropTypes.shape({initialWidth:PropTypes.number,initialHeight:PropTypes.number,initialX:PropTypes.number,initialY:PropTypes.number,initiallyDocked:PropTypes.bool,side:PropTypes.string}),layers:PropTypes.array,/** Whether the legend window is locked (always visible, not moveable or closeable). Set position and size via `geometry`. */lockedWindow:PropTypes.bool,map:PropTypes.object,/** Whether to only include enabled layers in the legend by default. */onlyVisibleLegend:PropTypes.bool,/** Whether to display a scale-dependent legend by default. */scaleDependentLegend:PropTypes.bool,setCurrentTask:PropTypes.func});_defineProperty(MapLegend,"defaultProps",{addGroupTitles:false,addLayerTitles:false,bboxDependentLegend:false,excludeLayers:[],onlyVisibleLegend:false,scaleDependentLegend:false,geometry:{initialWidth:320,initialHeight:320,initialX:0,initialY:0,initiallyDocked:false,side:"left"}});export default connect(function(state){return{active:state.task.id==="MapLegend",layers:state.layers.flat,map:state.map}},{setCurrentTask:setCurrentTask})(MapLegend);
@@ -4,14 +4,14 @@ function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof
4
4
  *
5
5
  * This source code is licensed under the BSD-style license found in the
6
6
  * LICENSE file in the root directory of this source tree.
7
- */import React from"react";import{connect}from"react-redux";import Sortable from"react-sortablejs";import FileSaver from"file-saver";import PropTypes from"prop-types";import{createSelector}from"reselect";import{LayerRole,addLayerFeatures,removeLayer}from"../actions/layers";import{zoomToExtent}from"../actions/map";import{setCurrentTask}from"../actions/task";import Icon from"../components/Icon";import ResizeableWindow from"../components/ResizeableWindow";import ButtonBar from"../components/widgets/ButtonBar";import DateTimeInput from"../components/widgets/DateTimeInput";import NumberInput from"../components/widgets/NumberInput";import SearchWidget from"../components/widgets/SearchWidget";import Spinner from"../components/widgets/Spinner";import ToggleSwitch from"../components/widgets/ToggleSwitch";import VectorLayerPicker from"../components/widgets/VectorLayerPicker";import searchProvidersSelector from"../selectors/searchproviders";import ConfigUtils from"../utils/ConfigUtils";import CoordinatesUtils from"../utils/CoordinatesUtils";import LocaleUtils from"../utils/LocaleUtils";import MeasureUtils from"../utils/MeasureUtils";import RoutingInterface from"../utils/RoutingInterface";import VectorLayerUtils from"../utils/VectorLayerUtils";import"./style/Routing.css";/**
7
+ */import React from"react";import{connect}from"react-redux";import Sortable from"react-sortablejs";import FileSaver from"file-saver";import PropTypes from"prop-types";import{createSelector}from"reselect";import{v4 as uuidv4}from"uuid";import{LayerRole,addLayerFeatures,removeLayer}from"../actions/layers";import{zoomToExtent}from"../actions/map";import{setCurrentTask}from"../actions/task";import Icon from"../components/Icon";import ResizeableWindow from"../components/ResizeableWindow";import ButtonBar from"../components/widgets/ButtonBar";import DateTimeInput from"../components/widgets/DateTimeInput";import NumberInput from"../components/widgets/NumberInput";import SearchWidget from"../components/widgets/SearchWidget";import Spinner from"../components/widgets/Spinner";import ToggleSwitch from"../components/widgets/ToggleSwitch";import VectorLayerPicker from"../components/widgets/VectorLayerPicker";import searchProvidersSelector from"../selectors/searchproviders";import ConfigUtils from"../utils/ConfigUtils";import CoordinatesUtils from"../utils/CoordinatesUtils";import LocaleUtils from"../utils/LocaleUtils";import MeasureUtils from"../utils/MeasureUtils";import RoutingInterface from"../utils/RoutingInterface";import VectorLayerUtils from"../utils/VectorLayerUtils";import"./style/Routing.css";/**
8
8
  * Compute routes and isochrones.
9
9
  *
10
10
  * Requires `routingServiceUrl` in `config.json` pointing to a Valhalla routing service.
11
- */var Routing=/*#__PURE__*/function(_React$Component){function Routing(props){var _this;_classCallCheck(this,Routing);_this=_callSuper(this,Routing,[props]);_defineProperty(_this,"state",{visible:false,currentTab:"Route",mode:"auto",settings:{auto:{method:"fastest",maxSpeed:130,useFerries:true,useHighways:true,useTollways:true},heavyvehicle:{method:"fastest",maxSpeed:100,useFerries:true,useHighways:true,useTollways:true},transit:{timepoint:"now",time:""},bicycle:{method:"fastest",maxSpeed:25,useFerries:true},pedestrian:{method:"fastest",maxSpeed:4,useFerries:true}},settingsPopup:false,routeConfig:{points:[{text:"",pos:null,crs:null},{text:"",pos:null,crs:null}],result:null,roundtrip:false,optimized_route:false,excludeLayer:null},isoConfig:{points:[{text:"",pos:null,crs:null}],mode:"time",units:{time:"min",distance:"km"},intervals:"5, 10",result:null},searchProviders:[],searchParams:{},highlightId:null});_defineProperty(_this,"renderSettings",function(){var settings=_this.state.settings[_this.state.mode];return/*#__PURE__*/React.createElement("div",{className:"routing-settings-menu"},/*#__PURE__*/React.createElement("table",{className:"routing-settings-menu-entries"},/*#__PURE__*/React.createElement("tbody",null,settings.method!==undefined?/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("routing.method"),":"),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement("select",{onChange:function onChange(ev){return _this.updateSetting(_this.state.mode,{method:ev.target.value})},value:settings.method},/*#__PURE__*/React.createElement("option",{value:"fastest"},LocaleUtils.tr("routing.fastest")),/*#__PURE__*/React.createElement("option",{value:"shortest"},LocaleUtils.tr("routing.shortest"))))):null,settings.maxSpeed!==undefined?/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("routing.maxspeed"),":"),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement(NumberInput,{max:350,min:1,mobile:true,onChange:function onChange(value){return _this.updateSetting(_this.state.mode,{maxSpeed:value})},suffix:" km/h",value:settings.maxSpeed}))):null,settings.useFerries!==undefined?/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("routing.useferries"),":"),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement(ToggleSwitch,{active:settings.useFerries,onChange:function onChange(value){return _this.updateSetting(_this.state.mode,{useFerries:value})}}))):null,settings.useHighways!==undefined?/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("routing.usehighways"),":"),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement(ToggleSwitch,{active:settings.useHighways,onChange:function onChange(value){return _this.updateSetting(_this.state.mode,{useHighways:value})}}))):null,settings.useTollways!==undefined?/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("routing.usetollways"),":"),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement(ToggleSwitch,{active:settings.useTollways,onChange:function onChange(value){return _this.updateSetting(_this.state.mode,{useTollways:value})}}))):null)))});_defineProperty(_this,"renderRouteWidget",function(){var routeConfig=_this.state.routeConfig;var vectorLayers=_this.props.layers.filter(function(layer){return layer.type==="vector"&&layer.role===LayerRole.USERLAYER&&!layer.readonly});var numpoints=routeConfig.points.length;return/*#__PURE__*/React.createElement("div",{className:"routing-tab-widget"},/*#__PURE__*/React.createElement("div",{className:"routing-input"},/*#__PURE__*/React.createElement("div",{className:"routing-points"},/*#__PURE__*/React.createElement(Sortable,{onChange:_this.onSortChange,options:{ghostClass:"drop-ghost",delay:200}},routeConfig.points.map(function(entry,idx){var placeholder=LocaleUtils.tr("routing.addviapoint");if(idx===0){placeholder=LocaleUtils.tr("routing.fromhere")}else if(idx===routeConfig.points.length-1){placeholder=LocaleUtils.tr("routing.tohere")}return _this.renderSearchField(entry,idx,"routeConfig",idx>0&&idx<numpoints-1,placeholder)})),/*#__PURE__*/React.createElement("div",null,/*#__PURE__*/React.createElement(Icon,{icon:"up-down-arrow",onClick:_this.reverseRoutePts}))),/*#__PURE__*/React.createElement("div",{className:"routing-points-commands"},/*#__PURE__*/React.createElement("a",{href:"#",onClick:function onClick(){return _this.addPoint("routeConfig",-1)}},/*#__PURE__*/React.createElement(Icon,{icon:"plus"})," ",LocaleUtils.tr("routing.add")),/*#__PURE__*/React.createElement("span",{className:"routing-points-commands-spacer"}),_this.renderImportButton("routeConfig"),/*#__PURE__*/React.createElement("span",{className:"routing-points-commands-spacer"}),/*#__PURE__*/React.createElement("a",{href:"#",onClick:function onClick(){return _this.clearConfig("routeConfig")}},/*#__PURE__*/React.createElement(Icon,{icon:"clear"})," ",LocaleUtils.tr("routing.clear"))),_this.state.mode==="transit"?/*#__PURE__*/React.createElement("div",{className:"routing-time-settings"},/*#__PURE__*/React.createElement("select",{onChange:_this.updateTransitTimepoint,value:_this.state.settings.transit.timepoint},/*#__PURE__*/React.createElement("option",{value:"now"},LocaleUtils.tr("routing.leavenow")),/*#__PURE__*/React.createElement("option",{value:"leaveat"},LocaleUtils.tr("routing.leaveat")),/*#__PURE__*/React.createElement("option",{value:"arriveat"},LocaleUtils.tr("routing.arriveat"))),_this.state.settings.transit.timepoint!=="now"?/*#__PURE__*/React.createElement(DateTimeInput,{onChange:function onChange(value){return _this.updateSetting("transit",{time:value})},value:_this.state.settings.transit.time}):null):null,/*#__PURE__*/React.createElement("div",{className:"routing-points-commands"},/*#__PURE__*/React.createElement("label",null,/*#__PURE__*/React.createElement("input",{onChange:function onChange(ev){return _this.updateRouteConfig({roundtrip:ev.target.checked})},type:"checkbox",value:routeConfig.roundtrip})," ",LocaleUtils.tr("routing.roundtrip"))),_this.state.mode!=="transit"?/*#__PURE__*/React.createElement("div",{className:"routing-points-commands"},/*#__PURE__*/React.createElement("label",null,/*#__PURE__*/React.createElement("input",{onChange:function onChange(ev){return _this.updateRouteConfig({optimized_route:ev.target.checked})},type:"checkbox",value:routeConfig.optimized_route})," ",LocaleUtils.tr("routing.optimized_route"))):null,ConfigUtils.havePlugin("Redlining")?/*#__PURE__*/React.createElement("div",{className:"routing-points-commands controlgroup"},/*#__PURE__*/React.createElement("span",null,LocaleUtils.tr("routing.excludepolygons"),":\xA0"),/*#__PURE__*/React.createElement(VectorLayerPicker,{layers:vectorLayers,onChange:function onChange(layer){return _this.updateRouteConfig({excludeLayer:(layer||{}).id})},showNone:true,value:routeConfig.excludeLayer||""}),/*#__PURE__*/React.createElement("button",{className:"button",onClick:_this.setRedliningTool},/*#__PURE__*/React.createElement(Icon,{icon:"draw"}))):null),routeConfig.busy?/*#__PURE__*/React.createElement("div",{className:"routing-busy"},/*#__PURE__*/React.createElement(Spinner,null)," ",LocaleUtils.tr("routing.computing")):null,routeConfig.result?_this.renderRouteResult(routeConfig):null)});_defineProperty(_this,"updateTransitTimepoint",function(ev){var diff={timepoint:ev.target.value};if(ev.target.value!=="now"&&_this.state.settings.transit.timepoint==="now"){var tzoffset=new Date().getTimezoneOffset()*60000;diff.time=new Date(Date.now()-tzoffset).toISOString().slice(0,-1)}_this.updateSetting("transit",diff)});_defineProperty(_this,"setRedliningTool",function(){_this.props.setCurrentTask("Redlining",null,null,{layerId:_this.state.routeConfig.excludeLayer})});_defineProperty(_this,"renderRouteResult",function(routeConfig){if(routeConfig.result.success===false){return/*#__PURE__*/React.createElement("div",{className:"routing-status-failure"},routeConfig.result.data.errorMsgId?LocaleUtils.tr(routeConfig.result.data.errorMsgId):routeConfig.result.data.error)}else{return/*#__PURE__*/React.createElement("div",{className:"routing-result"},/*#__PURE__*/React.createElement("div",{className:"routing-result-summary"},/*#__PURE__*/React.createElement("span",null,/*#__PURE__*/React.createElement(Icon,{icon:"clock"})," ",MeasureUtils.formatDuration(routeConfig.result.data.summary.time)),/*#__PURE__*/React.createElement("span",{className:"routing-result-spacer"}),/*#__PURE__*/React.createElement("span",null,/*#__PURE__*/React.createElement(Icon,{icon:"measure"})," ",MeasureUtils.formatMeasurement(routeConfig.result.data.summary.length,false)),/*#__PURE__*/React.createElement("span",{className:"routing-result-spacer"}),/*#__PURE__*/React.createElement("span",null,/*#__PURE__*/React.createElement(Icon,{icon:"export"})," ",/*#__PURE__*/React.createElement("a",{href:"#",onClick:_this.exportRoute},LocaleUtils.tr("routing.export")))),/*#__PURE__*/React.createElement("div",{className:"routing-result-instructions"},routeConfig.result.data.legs.map(function(leg,lidx){return leg.maneuvers.map(function(entry,eidx){return/*#__PURE__*/React.createElement("div",{className:"routing-result-instruction",key:"instr"+lidx+":"+eidx,onMouseEnter:function onMouseEnter(){return _this.highlightRouteSection(lidx+":"+eidx,entry,leg)},onMouseLeave:function onMouseLeave(){return _this.clearRouteSectionHighlight(lidx+":"+eidx)}},/*#__PURE__*/React.createElement("div",null,/*#__PURE__*/React.createElement(Icon,{icon:entry.icon}),/*#__PURE__*/React.createElement("b",null,entry.instruction)),/*#__PURE__*/React.createElement("div",{className:"routing-result-instruction-summary"},/*#__PURE__*/React.createElement("span",null,/*#__PURE__*/React.createElement(Icon,{icon:"clock"})," ",MeasureUtils.formatDuration(entry.time)),/*#__PURE__*/React.createElement("span",{className:"routing-result-spacer"}),/*#__PURE__*/React.createElement("span",null,/*#__PURE__*/React.createElement(Icon,{icon:"measure"})," ",MeasureUtils.formatMeasurement(entry.length,false))))})})))}});_defineProperty(_this,"highlightRouteSection",function(id,entry,leg){_this.setState({highlightId:id});var feature={type:"Feature",crs:"EPSG:4326",geometry:{type:"LineString",coordinates:leg.coordinates.slice(entry.geom_indices[0],entry.geom_indices[1]+1)}};var sellayer={id:"routingselection",role:LayerRole.SELECTION,styleOptions:{strokeWidth:3,strokeColor:[255,255,0,1],strokeDash:[]}};_this.props.addLayerFeatures(sellayer,[feature],true)});_defineProperty(_this,"clearRouteSectionHighlight",function(id){if(_this.state.highlightId===id){_this.setState({highlightId:null});_this.props.removeLayer("routingselection")}});_defineProperty(_this,"renderIsochroneWidget",function(){var isoConfig=_this.state.isoConfig;var intervalValid=!!isoConfig.intervals.match(/^\d+(,\s*\d+)*$/);return/*#__PURE__*/React.createElement("div",{className:"routing-tab-widget"},/*#__PURE__*/React.createElement("div",{className:"routing-input"},/*#__PURE__*/React.createElement("div",null,isoConfig.points.map(function(entry,idx){return _this.renderSearchField(entry,idx,"isoConfig",idx>0)})),/*#__PURE__*/React.createElement("table",{className:"routing-iso-settings"},/*#__PURE__*/React.createElement("tbody",null,/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("routing.iso_mode"),": "),/*#__PURE__*/React.createElement("td",{colSpan:"2"},/*#__PURE__*/React.createElement("select",{onChange:function onChange(ev){return _this.updateIsoConfig({mode:ev.target.value})},value:isoConfig.mode},/*#__PURE__*/React.createElement("option",{value:"time"},LocaleUtils.tr("routing.iso_mode_time")),/*#__PURE__*/React.createElement("option",{value:"distance"},LocaleUtils.tr("routing.iso_mode_distance"))))),/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("routing.iso_intervals"),": "),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement("input",{className:isoConfig.intervals&&!intervalValid?"routing-input-invalid":"",onChange:function onChange(ev){return _this.updateIsoConfig({intervals:ev.target.value})},placeholder:"5, 10, 15",type:"text",value:isoConfig.intervals})),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement("select",{onChange:function onChange(ev){_this.setState(function(state){return{isoConfig:_objectSpread(_objectSpread({},state.isoConfig),{},{units:_objectSpread(_objectSpread({},state.isoConfig.units),{},_defineProperty({},state.isoConfig.mode,ev.target.value))})}});_this.recomputeIfNeeded()},value:isoConfig.units[isoConfig.mode]},Object.keys(_this.props.units[isoConfig.mode]).map(function(unit){return/*#__PURE__*/React.createElement("option",{key:unit,value:unit},unit)})))))),/*#__PURE__*/React.createElement("div",{className:"routing-points-commands"},/*#__PURE__*/React.createElement("a",{href:"#",onClick:function onClick(){return _this.addPoint("isoConfig",isoConfig.points.length)}},/*#__PURE__*/React.createElement(Icon,{icon:"plus"})," ",LocaleUtils.tr("routing.add")),/*#__PURE__*/React.createElement("span",{className:"routing-points-commands-spacer"}),_this.renderImportButton("isoConfig"),/*#__PURE__*/React.createElement("span",{className:"routing-points-commands-spacer"}),/*#__PURE__*/React.createElement("a",{href:"#",onClick:function onClick(){return _this.clearConfig("isoConfig")}},/*#__PURE__*/React.createElement(Icon,{icon:"clear"})," ",LocaleUtils.tr("routing.clear")))),isoConfig.busy?/*#__PURE__*/React.createElement("div",{className:"routing-busy"},/*#__PURE__*/React.createElement(Spinner,null)," ",LocaleUtils.tr("routing.computing")):null,isoConfig.result?_this.renderIsochroneResult(isoConfig):null)});_defineProperty(_this,"renderIsochroneResult",function(isoConfig){if(isoConfig.result.success===false){return/*#__PURE__*/React.createElement("div",{className:"routing-status-failure"},isoConfig.result.data.errorMsgId?LocaleUtils.tr(isoConfig.result.data.errorMsgId):isoConfig.result.data.error)}else{return/*#__PURE__*/React.createElement("div",{className:"routing-result"},/*#__PURE__*/React.createElement("div",{className:"routing-result-summary"},/*#__PURE__*/React.createElement(Icon,{icon:"export"})," ",/*#__PURE__*/React.createElement("a",{href:"#",onClick:_this.exportIsochrone},LocaleUtils.tr("routing.export"))))}});_defineProperty(_this,"renderSearchField",function(entry,idx,config,removeable){var placeholder=arguments.length>4&&arguments[4]!==undefined?arguments[4]:null;return/*#__PURE__*/React.createElement("div",{className:"routing-search-field controlgroup",key:"field"+idx},/*#__PURE__*/React.createElement(SearchWidget,{placeholder:placeholder,resultSelected:function resultSelected(result){return _this.searchResultSelected(config,idx,result)},role:"input",searchParams:_this.state.searchParams,searchProviders:_this.state.searchProviders,value:entry.text}),idx===0?/*#__PURE__*/React.createElement("button",{className:"button",disabled:!_this.props.locatePos,onClick:function onClick(){return _this.updatePoint(config,0,_this.locatePos())},role:"suffix"},/*#__PURE__*/React.createElement(Icon,{icon:"screenshot"})):null,removeable?/*#__PURE__*/React.createElement("button",{className:"button",onClick:function onClick(){return _this.removePoint(config,idx)},role:"suffix"},/*#__PURE__*/React.createElement(Icon,{icon:"remove"})):null)});_defineProperty(_this,"renderImportButton",function(config){return/*#__PURE__*/React.createElement("label",{className:"routing-import-button",title:LocaleUtils.tr("routing.importhint")},/*#__PURE__*/React.createElement(Icon,{icon:"import"})," ",LocaleUtils.tr("routing.importpoints"),/*#__PURE__*/React.createElement("input",{onChange:function onChange(ev){return _this.importPoints(ev,config)},type:"file"}))});_defineProperty(_this,"locatePos",function(){return{pos:_toConsumableArray(_this.props.locatePos),text:_this.props.locatePos.map(function(x){return x.toFixed(4)}).join(", "),crs:"EPSG:4326"}});_defineProperty(_this,"updateSetting",function(mode,diff){_this.setState(function(state){return{settings:_objectSpread(_objectSpread({},state.settings),{},_defineProperty({},mode,_objectSpread(_objectSpread({},state.settings[mode]),diff)))}});_this.recomputeIfNeeded()});_defineProperty(_this,"addPoint",function(config){var index=arguments.length>1&&arguments[1]!==undefined?arguments[1]:-1;var entry=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{text:"",pos:null};_this.setState(function(state){return _defineProperty({},config,_objectSpread(_objectSpread({},state[config]),{},{points:[].concat(_toConsumableArray(state[config].points.slice(0,index)),[entry],_toConsumableArray(state[config].points.slice(index)))}))});if(entry.pos){_this.recomputeIfNeeded()}});_defineProperty(_this,"updatePoint",function(config,idx,diff){_this.setState(function(state){return _defineProperty({},config,_objectSpread(_objectSpread({},state[config]),{},{points:[].concat(_toConsumableArray(state[config].points.slice(0,idx)),[_objectSpread(_objectSpread({},state[config].points[idx]),diff)],_toConsumableArray(state[config].points.slice(idx+1)))}))});_this.recomputeIfNeeded()});_defineProperty(_this,"importPoints",function(ev,config){var reader=new FileReader;reader.onload=function(loadev){try{var obj=JSON.parse(loadev.target.result);var crs="EPSG:4326";if(obj.crs&&obj.crs.properties){crs=CoordinatesUtils.fromOgcUrnCrs(obj.crs.properties.name)}var prec=CoordinatesUtils.getPrecision(crs);_this.setState(function(state){return _defineProperty({},config,_objectSpread(_objectSpread({},state[config]),{},{points:obj.features.map(function(feature){var coordinates=feature.geometry.coordinates;return{text:coordinates.map(function(x){return x.toFixed(prec)}).join(", ")+" ("+crs+")",pos:coordinates,crs:crs}})}))});_this.recomputeIfNeeded()}catch(e){// eslint-disable-next-line
11
+ */var Routing=/*#__PURE__*/function(_React$Component){function Routing(props){var _this;_classCallCheck(this,Routing);_this=_callSuper(this,Routing,[props]);_defineProperty(_this,"state",{visible:false,currentTab:"Route",mode:"auto",settings:{auto:{method:"fastest",maxSpeed:130,useFerries:true,useHighways:true,useTollways:true},heavyvehicle:{method:"fastest",maxSpeed:100,useFerries:true,useHighways:true,useTollways:true},transit:{timepoint:"now",time:""},bicycle:{method:"fastest",maxSpeed:25,useFerries:true},pedestrian:{method:"fastest",maxSpeed:4,useFerries:true}},settingsPopup:false,routeConfig:{points:[{text:"",pos:null,crs:null},{text:"",pos:null,crs:null}],result:null,roundtrip:false,optimized_route:false,excludeLayer:null},isoConfig:{points:[{text:"",pos:null,crs:null}],mode:"time",units:{time:"min",distance:"km"},intervals:"5, 10",result:null},searchProviders:[],searchParams:{},highlightId:null});_defineProperty(_this,"renderSettings",function(){var settings=_this.state.settings[_this.state.mode];return/*#__PURE__*/React.createElement("div",{className:"routing-settings-menu"},/*#__PURE__*/React.createElement("table",{className:"routing-settings-menu-entries"},/*#__PURE__*/React.createElement("tbody",null,settings.method!==undefined?/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("routing.method"),":"),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement("select",{onChange:function onChange(ev){return _this.updateSetting(_this.state.mode,{method:ev.target.value})},value:settings.method},/*#__PURE__*/React.createElement("option",{value:"fastest"},LocaleUtils.tr("routing.fastest")),/*#__PURE__*/React.createElement("option",{value:"shortest"},LocaleUtils.tr("routing.shortest"))))):null,settings.maxSpeed!==undefined?/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("routing.maxspeed"),":"),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement(NumberInput,{max:350,min:1,mobile:true,onChange:function onChange(value){return _this.updateSetting(_this.state.mode,{maxSpeed:value})},suffix:" km/h",value:settings.maxSpeed}))):null,settings.useFerries!==undefined?/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("routing.useferries"),":"),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement(ToggleSwitch,{active:settings.useFerries,onChange:function onChange(value){return _this.updateSetting(_this.state.mode,{useFerries:value})}}))):null,settings.useHighways!==undefined?/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("routing.usehighways"),":"),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement(ToggleSwitch,{active:settings.useHighways,onChange:function onChange(value){return _this.updateSetting(_this.state.mode,{useHighways:value})}}))):null,settings.useTollways!==undefined?/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("routing.usetollways"),":"),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement(ToggleSwitch,{active:settings.useTollways,onChange:function onChange(value){return _this.updateSetting(_this.state.mode,{useTollways:value})}}))):null)))});_defineProperty(_this,"renderRouteWidget",function(){var routeConfig=_this.state.routeConfig;var vectorLayers=_this.props.layers.filter(function(layer){return layer.type==="vector"&&layer.role===LayerRole.USERLAYER&&!layer.readonly});var numpoints=routeConfig.points.length;return/*#__PURE__*/React.createElement("div",{className:"routing-tab-widget"},/*#__PURE__*/React.createElement("div",{className:"routing-input"},/*#__PURE__*/React.createElement("div",{className:"routing-points"},/*#__PURE__*/React.createElement(Sortable,{onChange:_this.onSortChange,options:{ghostClass:"drop-ghost",delay:200}},routeConfig.points.map(function(entry,idx){var placeholder=LocaleUtils.tr("routing.addviapoint");if(idx===0){placeholder=LocaleUtils.tr("routing.fromhere")}else if(idx===routeConfig.points.length-1){placeholder=LocaleUtils.tr("routing.tohere")}return _this.renderSearchField(entry,idx,"routeConfig",idx>0&&idx<numpoints-1,placeholder)})),/*#__PURE__*/React.createElement("div",null,/*#__PURE__*/React.createElement(Icon,{icon:"up-down-arrow",onClick:_this.reverseRoutePts}))),/*#__PURE__*/React.createElement("div",{className:"routing-points-commands"},/*#__PURE__*/React.createElement("a",{href:"#",onClick:function onClick(){return _this.addPoint("routeConfig",-1)}},/*#__PURE__*/React.createElement(Icon,{icon:"plus"})," ",LocaleUtils.tr("routing.add")),/*#__PURE__*/React.createElement("span",{className:"routing-points-commands-spacer"}),_this.renderImportButton("routeConfig"),/*#__PURE__*/React.createElement("span",{className:"routing-points-commands-spacer"}),/*#__PURE__*/React.createElement("a",{href:"#",onClick:function onClick(){return _this.clearConfig("routeConfig")}},/*#__PURE__*/React.createElement(Icon,{icon:"clear"})," ",LocaleUtils.tr("routing.clear"))),_this.state.mode==="transit"?/*#__PURE__*/React.createElement("div",{className:"routing-time-settings"},/*#__PURE__*/React.createElement("select",{onChange:_this.updateTransitTimepoint,value:_this.state.settings.transit.timepoint},/*#__PURE__*/React.createElement("option",{value:"now"},LocaleUtils.tr("routing.leavenow")),/*#__PURE__*/React.createElement("option",{value:"leaveat"},LocaleUtils.tr("routing.leaveat")),/*#__PURE__*/React.createElement("option",{value:"arriveat"},LocaleUtils.tr("routing.arriveat"))),_this.state.settings.transit.timepoint!=="now"?/*#__PURE__*/React.createElement(DateTimeInput,{onChange:function onChange(value){return _this.updateSetting("transit",{time:value})},value:_this.state.settings.transit.time}):null):null,/*#__PURE__*/React.createElement("div",{className:"routing-points-commands"},/*#__PURE__*/React.createElement("label",null,/*#__PURE__*/React.createElement("input",{onChange:function onChange(ev){return _this.updateRouteConfig({roundtrip:ev.target.checked})},type:"checkbox",value:routeConfig.roundtrip})," ",LocaleUtils.tr("routing.roundtrip"))),_this.state.mode!=="transit"?/*#__PURE__*/React.createElement("div",{className:"routing-points-commands"},/*#__PURE__*/React.createElement("label",null,/*#__PURE__*/React.createElement("input",{onChange:function onChange(ev){return _this.updateRouteConfig({optimized_route:ev.target.checked})},type:"checkbox",value:routeConfig.optimized_route})," ",LocaleUtils.tr("routing.optimized_route"))):null,ConfigUtils.havePlugin("Redlining")?/*#__PURE__*/React.createElement("div",{className:"routing-points-commands controlgroup"},/*#__PURE__*/React.createElement("span",null,LocaleUtils.tr("routing.excludepolygons"),":\xA0"),/*#__PURE__*/React.createElement(VectorLayerPicker,{layers:vectorLayers,onChange:function onChange(layer){return _this.updateRouteConfig({excludeLayer:(layer||{}).id})},showNone:true,value:routeConfig.excludeLayer||""}),/*#__PURE__*/React.createElement("button",{className:"button",onClick:_this.setRedliningTool},/*#__PURE__*/React.createElement(Icon,{icon:"draw"}))):null),routeConfig.busy?/*#__PURE__*/React.createElement("div",{className:"routing-busy"},/*#__PURE__*/React.createElement(Spinner,null)," ",LocaleUtils.tr("routing.computing")):null,routeConfig.result?_this.renderRouteResult(routeConfig):null)});_defineProperty(_this,"updateTransitTimepoint",function(ev){var diff={timepoint:ev.target.value};if(ev.target.value!=="now"&&_this.state.settings.transit.timepoint==="now"){var tzoffset=new Date().getTimezoneOffset()*60000;diff.time=new Date(Date.now()-tzoffset).toISOString().slice(0,-1)}_this.updateSetting("transit",diff)});_defineProperty(_this,"setRedliningTool",function(){_this.props.setCurrentTask("Redlining",null,null,{layerId:_this.state.routeConfig.excludeLayer})});_defineProperty(_this,"renderRouteResult",function(routeConfig){if(routeConfig.result.success===false){return/*#__PURE__*/React.createElement("div",{className:"routing-status-failure"},routeConfig.result.data.errorMsgId?LocaleUtils.tr(routeConfig.result.data.errorMsgId):routeConfig.result.data.error)}else{return/*#__PURE__*/React.createElement("div",{className:"routing-result"},/*#__PURE__*/React.createElement("div",{className:"routing-result-summary"},/*#__PURE__*/React.createElement("span",null,/*#__PURE__*/React.createElement(Icon,{icon:"clock"})," ",MeasureUtils.formatDuration(routeConfig.result.data.summary.time)),/*#__PURE__*/React.createElement("span",{className:"routing-result-spacer"}),/*#__PURE__*/React.createElement("span",null,/*#__PURE__*/React.createElement(Icon,{icon:"measure"})," ",MeasureUtils.formatMeasurement(routeConfig.result.data.summary.length,false)),/*#__PURE__*/React.createElement("span",{className:"routing-result-spacer"}),/*#__PURE__*/React.createElement("span",null,/*#__PURE__*/React.createElement(Icon,{icon:"export"})," ",/*#__PURE__*/React.createElement("a",{href:"#",onClick:_this.exportRoute},LocaleUtils.tr("routing.export"))),/*#__PURE__*/React.createElement("span",{className:"routing-result-spacer"}),/*#__PURE__*/React.createElement("span",null,/*#__PURE__*/React.createElement(Icon,{icon:"layers"})," ",/*#__PURE__*/React.createElement("a",{href:"#",onClick:_this.addRouteLayer},LocaleUtils.tr("routing.addlayer")))),/*#__PURE__*/React.createElement("div",{className:"routing-result-instructions"},routeConfig.result.data.legs.map(function(leg,lidx){return leg.maneuvers.map(function(entry,eidx){return/*#__PURE__*/React.createElement("div",{className:"routing-result-instruction",key:"instr"+lidx+":"+eidx,onMouseEnter:function onMouseEnter(){return _this.highlightRouteSection(lidx+":"+eidx,entry,leg)},onMouseLeave:function onMouseLeave(){return _this.clearRouteSectionHighlight(lidx+":"+eidx)}},/*#__PURE__*/React.createElement("div",null,/*#__PURE__*/React.createElement(Icon,{icon:entry.icon}),/*#__PURE__*/React.createElement("b",null,entry.instruction)),/*#__PURE__*/React.createElement("div",{className:"routing-result-instruction-summary"},/*#__PURE__*/React.createElement("span",null,/*#__PURE__*/React.createElement(Icon,{icon:"clock"})," ",MeasureUtils.formatDuration(entry.time)),/*#__PURE__*/React.createElement("span",{className:"routing-result-spacer"}),/*#__PURE__*/React.createElement("span",null,/*#__PURE__*/React.createElement(Icon,{icon:"measure"})," ",MeasureUtils.formatMeasurement(entry.length,false))))})})))}});_defineProperty(_this,"highlightRouteSection",function(id,entry,leg){_this.setState({highlightId:id});var feature={type:"Feature",crs:"EPSG:4326",geometry:{type:"LineString",coordinates:leg.coordinates.slice(entry.geom_indices[0],entry.geom_indices[1]+1)}};var sellayer={id:"routingselection",role:LayerRole.SELECTION,styleOptions:{strokeWidth:3,strokeColor:[255,255,0,1],strokeDash:[]}};_this.props.addLayerFeatures(sellayer,[feature],true)});_defineProperty(_this,"clearRouteSectionHighlight",function(id){if(_this.state.highlightId===id){_this.setState({highlightId:null});_this.props.removeLayer("routingselection")}});_defineProperty(_this,"renderIsochroneWidget",function(){var isoConfig=_this.state.isoConfig;var intervalValid=!!isoConfig.intervals.match(/^\d+(,\s*\d+)*$/);return/*#__PURE__*/React.createElement("div",{className:"routing-tab-widget"},/*#__PURE__*/React.createElement("div",{className:"routing-input"},/*#__PURE__*/React.createElement("div",null,isoConfig.points.map(function(entry,idx){return _this.renderSearchField(entry,idx,"isoConfig",idx>0)})),/*#__PURE__*/React.createElement("table",{className:"routing-iso-settings"},/*#__PURE__*/React.createElement("tbody",null,/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("routing.iso_mode"),": "),/*#__PURE__*/React.createElement("td",{colSpan:"2"},/*#__PURE__*/React.createElement("select",{onChange:function onChange(ev){return _this.updateIsoConfig({mode:ev.target.value})},value:isoConfig.mode},/*#__PURE__*/React.createElement("option",{value:"time"},LocaleUtils.tr("routing.iso_mode_time")),/*#__PURE__*/React.createElement("option",{value:"distance"},LocaleUtils.tr("routing.iso_mode_distance"))))),/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("routing.iso_intervals"),": "),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement("input",{className:isoConfig.intervals&&!intervalValid?"routing-input-invalid":"",onChange:function onChange(ev){return _this.updateIsoConfig({intervals:ev.target.value})},placeholder:"5, 10, 15",type:"text",value:isoConfig.intervals})),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement("select",{onChange:function onChange(ev){_this.setState(function(state){return{isoConfig:_objectSpread(_objectSpread({},state.isoConfig),{},{units:_objectSpread(_objectSpread({},state.isoConfig.units),{},_defineProperty({},state.isoConfig.mode,ev.target.value))})}});_this.recomputeIfNeeded()},value:isoConfig.units[isoConfig.mode]},Object.keys(_this.props.units[isoConfig.mode]).map(function(unit){return/*#__PURE__*/React.createElement("option",{key:unit,value:unit},unit)})))))),/*#__PURE__*/React.createElement("div",{className:"routing-points-commands"},/*#__PURE__*/React.createElement("a",{href:"#",onClick:function onClick(){return _this.addPoint("isoConfig",isoConfig.points.length)}},/*#__PURE__*/React.createElement(Icon,{icon:"plus"})," ",LocaleUtils.tr("routing.add")),/*#__PURE__*/React.createElement("span",{className:"routing-points-commands-spacer"}),_this.renderImportButton("isoConfig"),/*#__PURE__*/React.createElement("span",{className:"routing-points-commands-spacer"}),/*#__PURE__*/React.createElement("a",{href:"#",onClick:function onClick(){return _this.clearConfig("isoConfig")}},/*#__PURE__*/React.createElement(Icon,{icon:"clear"})," ",LocaleUtils.tr("routing.clear")))),isoConfig.busy?/*#__PURE__*/React.createElement("div",{className:"routing-busy"},/*#__PURE__*/React.createElement(Spinner,null)," ",LocaleUtils.tr("routing.computing")):null,isoConfig.result?_this.renderIsochroneResult(isoConfig):null)});_defineProperty(_this,"renderIsochroneResult",function(isoConfig){if(isoConfig.result.success===false){return/*#__PURE__*/React.createElement("div",{className:"routing-status-failure"},isoConfig.result.data.errorMsgId?LocaleUtils.tr(isoConfig.result.data.errorMsgId):isoConfig.result.data.error)}else{return/*#__PURE__*/React.createElement("div",{className:"routing-result"},/*#__PURE__*/React.createElement("div",{className:"routing-result-summary"},/*#__PURE__*/React.createElement("span",null,/*#__PURE__*/React.createElement(Icon,{icon:"export"})," ",/*#__PURE__*/React.createElement("a",{href:"#",onClick:_this.exportIsochrone},LocaleUtils.tr("routing.export"))),/*#__PURE__*/React.createElement("span",{className:"routing-result-spacer"}),/*#__PURE__*/React.createElement("span",null,/*#__PURE__*/React.createElement(Icon,{icon:"layers"})," ",/*#__PURE__*/React.createElement("a",{href:"#",onClick:_this.addIsochroneLayer},LocaleUtils.tr("routing.addlayer")))))}});_defineProperty(_this,"renderSearchField",function(entry,idx,config,removeable){var placeholder=arguments.length>4&&arguments[4]!==undefined?arguments[4]:null;return/*#__PURE__*/React.createElement("div",{className:"routing-search-field controlgroup",key:"field"+idx},/*#__PURE__*/React.createElement(SearchWidget,{placeholder:placeholder,resultSelected:function resultSelected(result){return _this.searchResultSelected(config,idx,result)},role:"input",searchParams:_this.state.searchParams,searchProviders:_this.state.searchProviders,value:entry.text}),idx===0?/*#__PURE__*/React.createElement("button",{className:"button",disabled:!_this.props.locatePos,onClick:function onClick(){return _this.updatePoint(config,0,_this.locatePos())},role:"suffix"},/*#__PURE__*/React.createElement(Icon,{icon:"screenshot"})):null,removeable?/*#__PURE__*/React.createElement("button",{className:"button",onClick:function onClick(){return _this.removePoint(config,idx)},role:"suffix"},/*#__PURE__*/React.createElement(Icon,{icon:"remove"})):null)});_defineProperty(_this,"renderImportButton",function(config){return/*#__PURE__*/React.createElement("label",{className:"routing-import-button",title:LocaleUtils.tr("routing.importhint")},/*#__PURE__*/React.createElement(Icon,{icon:"import"})," ",LocaleUtils.tr("routing.importpoints"),/*#__PURE__*/React.createElement("input",{onChange:function onChange(ev){return _this.importPoints(ev,config)},type:"file"}))});_defineProperty(_this,"locatePos",function(){return{pos:_toConsumableArray(_this.props.locatePos),text:_this.props.locatePos.map(function(x){return x.toFixed(4)}).join(", "),crs:"EPSG:4326"}});_defineProperty(_this,"updateSetting",function(mode,diff){_this.setState(function(state){return{settings:_objectSpread(_objectSpread({},state.settings),{},_defineProperty({},mode,_objectSpread(_objectSpread({},state.settings[mode]),diff)))}});_this.recomputeIfNeeded()});_defineProperty(_this,"addPoint",function(config){var index=arguments.length>1&&arguments[1]!==undefined?arguments[1]:-1;var entry=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{text:"",pos:null};_this.setState(function(state){return _defineProperty({},config,_objectSpread(_objectSpread({},state[config]),{},{points:[].concat(_toConsumableArray(state[config].points.slice(0,index)),[entry],_toConsumableArray(state[config].points.slice(index)))}))});if(entry.pos){_this.recomputeIfNeeded()}});_defineProperty(_this,"updatePoint",function(config,idx,diff){_this.setState(function(state){return _defineProperty({},config,_objectSpread(_objectSpread({},state[config]),{},{points:[].concat(_toConsumableArray(state[config].points.slice(0,idx)),[_objectSpread(_objectSpread({},state[config].points[idx]),diff)],_toConsumableArray(state[config].points.slice(idx+1)))}))});_this.recomputeIfNeeded()});_defineProperty(_this,"importPoints",function(ev,config){var reader=new FileReader;reader.onload=function(loadev){try{var obj=JSON.parse(loadev.target.result);var crs="EPSG:4326";if(obj.crs&&obj.crs.properties){crs=CoordinatesUtils.fromOgcUrnCrs(obj.crs.properties.name)}var prec=CoordinatesUtils.getPrecision(crs);_this.setState(function(state){return _defineProperty({},config,_objectSpread(_objectSpread({},state[config]),{},{points:obj.features.map(function(feature){var coordinates=feature.geometry.coordinates;return{text:coordinates.map(function(x){return x.toFixed(prec)}).join(", ")+" ("+crs+")",pos:coordinates,crs:crs}})}))});_this.recomputeIfNeeded()}catch(e){// eslint-disable-next-line
12
12
  alert(LocaleUtils.tr("routing.importerror"))}};reader.readAsText(ev.target.files[0])});_defineProperty(_this,"removePoint",function(config,idx){_this.setState(function(state){return _defineProperty({},config,_objectSpread(_objectSpread({},state[config]),{},{points:[].concat(_toConsumableArray(state[config].points.slice(0,idx)),_toConsumableArray(state[config].points.slice(idx+1)))}))});_this.recomputeIfNeeded()});_defineProperty(_this,"clearConfig",function(config){var newPoints=config==="routeConfig"?[{text:"",pos:null,crs:null},{text:"",pos:null,crs:null}]:[{text:"",pos:null,crs:null}];_this.setState(function(state){return _defineProperty({},config,_objectSpread(_objectSpread({},state[config]),{},{points:newPoints,result:null}))});_this.props.removeLayer("routinggeometries");_this.props.removeLayer("routingmarkers");_this.recomputeIfNeeded()});_defineProperty(_this,"reverseRoutePts",function(){_this.setState(function(state){return{routeConfig:_objectSpread(_objectSpread({},state.routeConfig),{},{points:state.routeConfig.points.reverse()})}});_this.recomputeIfNeeded()});_defineProperty(_this,"updateRouteConfig",function(diff){var recompute=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;_this.setState(function(state){return{routeConfig:_objectSpread(_objectSpread({},state.routeConfig),diff)}});if(recompute){_this.recomputeIfNeeded()}});_defineProperty(_this,"updateIsoConfig",function(diff){var recompute=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;_this.setState(function(state){return{isoConfig:_objectSpread(_objectSpread({},state.isoConfig),diff)}});if(recompute){_this.recomputeIfNeeded()}});_defineProperty(_this,"searchResultSelected",function(config,idx,result){if(result){_this.updatePoint(config,idx,{text:result.text,pos:[result.x,result.y],crs:result.crs})}else{_this.updatePoint(config,idx,{text:"",pos:null,crs:null})}});_defineProperty(_this,"updateRoutingMarkers",function(){var points=[];if(_this.state.currentTab==="Route"){points=_this.state.routeConfig.points}else{points=_this.state.isoConfig.points}var layer={id:"routingmarkers",role:LayerRole.MARKER,styleName:"marker"};var features=points.filter(function(point){return point.pos}).map(function(point,idx){return{type:"Feature",crs:point.crs,geometry:{type:"Point",coordinates:point.pos},properties:{label:_this.props.showPinLabels&&_this.state.routeConfig.result?String(idx+1):null}}});_this.props.addLayerFeatures(layer,features,true)});_defineProperty(_this,"computeRoute",function(){var locations=_this.state.routeConfig.points.filter(function(entry){return entry.pos}).map(function(entry){return CoordinatesUtils.reproject(entry.pos,entry.crs,"EPSG:4326")});_this.props.removeLayer("routinggeometries");_this.updateRouteConfig({busy:locations.length>=2,result:null},false);if(locations.length<2){return}if(_this.state.routeConfig.roundtrip){locations.push(locations[0])}var settings=_objectSpread({},_this.state.settings[_this.state.mode]);if(_this.state.routeConfig.excludeLayer){var layer=_this.props.layers.find(function(l){return l.id===_this.state.routeConfig.excludeLayer});if(layer){settings.exclude_polygons=layer.features.filter(function(feature){return feature.geometry.type==="Polygon"}).map(function(feature){return VectorLayerUtils.reprojectGeometry(feature.geometry,_this.props.mapCrs,"EPSG:4326").coordinates[0]})}}settings.optimized_route=_this.state.routeConfig.optimized_route;RoutingInterface.computeRoute(_this.state.mode,locations,settings,function(success,result){if(success){// Add routing leg geometries
13
13
  var _layer={id:"routinggeometries",role:LayerRole.SELECTION,styleName:"default",styleOptions:{strokeColor:[10,10,255,1],strokeWidth:4,strokeDash:[]}};var features=[];result.legs.forEach(function(leg){leg.maneuvers.forEach(function(man){features.push({type:"Feature",crs:"EPSG:4326",styleOptions:{strokeColor:man.color},geometry:{type:"LineString",coordinates:leg.coordinates.slice(man.geom_indices[0],man.geom_indices[1]+1)}})})});_this.props.addLayerFeatures(_layer,features,true);// Reorder locations based on routing result, keeping null entries
14
- var _this$state$routeConf=_this.state.routeConfig.points.reduce(function(res,point,idx){return point.pos?_objectSpread(_objectSpread({},res),{},{points:[].concat(_toConsumableArray(res.points),[point])}):_objectSpread(_objectSpread({},res),{},{nullPoints:[].concat(_toConsumableArray(res.nullPoints),[{point:point,idx:idx}])})},{points:[],nullPoints:[]}),points=_this$state$routeConf.points,nullPoints=_this$state$routeConf.nullPoints;var reorderedPoints=result.locations.map(function(location){return points[location.orig_idx]}).filter(Boolean);nullPoints.forEach(function(entry){reorderedPoints.splice(entry.idx,0,entry.point)});_this.updateRouteConfig({points:reorderedPoints,result:{success:success,data:result},busy:false},false);if(_this.props.zoomAuto){_this.props.zoomToExtent(result.summary.bounds,"EPSG:4326",-1)}}else{_this.updateRouteConfig({result:{success:success,data:result},busy:false},false)}})});_defineProperty(_this,"computeIsochrone",function(){var intervalValid=!!_this.state.isoConfig.intervals.match(/^\d+(,\s*\d+)*$/);if(!intervalValid){return}var locations=_this.state.isoConfig.points.filter(function(entry){return entry.pos}).map(function(entry){return CoordinatesUtils.reproject(entry.pos,entry.crs,"EPSG:4326")});_this.props.removeLayer("routinggeometries");_this.updateIsoConfig({busy:true,result:null},false);var unitsFactor=_this.props.units[_this.state.isoConfig.mode][_this.state.isoConfig.units[_this.state.isoConfig.mode]];var contourOptions={mode:_this.state.isoConfig.mode,intervals:_this.state.isoConfig.intervals.split(",").map(function(entry){return parseInt(entry.trim(),10)/unitsFactor}).sort()};RoutingInterface.computeIsochrone(_this.state.mode,locations,contourOptions,_this.state.settings[_this.state.mode],function(success,result){if(success){var layer={id:"routinggeometries",role:LayerRole.SELECTION,styleOptions:{strokeColor:[10,10,255,1],fillColor:[10,10,255,0.5],strokeWidth:4,strokeDash:[]}};var features=result.areas.map(function(area){return{type:"Feature",crs:"EPSG:4326",geometry:{type:"Polygon",coordinates:[area]}}});_this.props.addLayerFeatures(layer,features,true);if(_this.props.zoomAuto){_this.props.zoomToExtent(result.bounds,"EPSG:4326",-0.5)}}_this.updateIsoConfig({result:{success:success,data:result},busy:false},false)})});_defineProperty(_this,"recomputeIfNeeded",function(){clearTimeout(_this.recomputeTimeout);_this.recomputeTimeout=setTimeout(function(){if(_this.state.currentTab==="Route"&&_this.state.routeConfig.points.filter(function(entry){return entry.pos}).length>=2){_this.computeRoute()}else if(_this.state.currentTab==="Reachability"&&_this.state.isoConfig.points.filter(function(entry){return entry.pos}).length>0){_this.computeIsochrone()}_this.recomputeTimeout=null},750)});_defineProperty(_this,"exportRoute",function(){var data=JSON.stringify({type:"FeatureCollection",features:_this.state.routeConfig.result.data.legs.map(function(leg){return{type:"Feature",properties:{time:leg.time,length:leg.length},geometry:{type:"LineString",coordinates:leg.coordinates}}})});FileSaver.saveAs(new Blob([data],{type:"text/plain;charset=utf-8"}),"route.json")});_defineProperty(_this,"exportIsochrone",function(){var data=JSON.stringify({type:"FeatureCollection",features:_this.state.isoConfig.result.data.areas.map(function(area){return{type:"Feature",geometry:{type:"Polygon",coordinates:[area]}}})});FileSaver.saveAs(new Blob([data],{type:"text/plain;charset=utf-8"}),"isochrone.json")});_defineProperty(_this,"onSortChange",function(order,sortable,ev){var newpoints=_this.state.routeConfig.points.slice(0);var moved=newpoints.splice(ev.oldIndex,1)[0];newpoints.splice(ev.newIndex,0,moved);_this.updateRouteConfig({points:newpoints})});_this.recomputeTimeout=null;_this.state.mode=_this.props.enabledModes[0];return _this}_inherits(Routing,_React$Component);return _createClass(Routing,[{key:"componentDidUpdate",value:function componentDidUpdate(prevProps,prevState){var _this2=this;// Recollect search providers
14
+ var _this$state$routeConf=_this.state.routeConfig.points.reduce(function(res,point,idx){return point.pos?_objectSpread(_objectSpread({},res),{},{points:[].concat(_toConsumableArray(res.points),[point])}):_objectSpread(_objectSpread({},res),{},{nullPoints:[].concat(_toConsumableArray(res.nullPoints),[{point:point,idx:idx}])})},{points:[],nullPoints:[]}),points=_this$state$routeConf.points,nullPoints=_this$state$routeConf.nullPoints;var reorderedPoints=result.locations.map(function(location){return points[location.orig_idx]}).filter(Boolean);nullPoints.forEach(function(entry){reorderedPoints.splice(entry.idx,0,entry.point)});_this.updateRouteConfig({points:reorderedPoints,result:{success:success,data:result},busy:false},false);if(_this.props.zoomAuto){_this.props.zoomToExtent(result.summary.bounds,"EPSG:4326",-1)}}else{_this.updateRouteConfig({result:{success:success,data:result},busy:false},false)}})});_defineProperty(_this,"computeIsochrone",function(){var intervalValid=!!_this.state.isoConfig.intervals.match(/^\d+(,\s*\d+)*$/);if(!intervalValid){return}var locations=_this.state.isoConfig.points.filter(function(entry){return entry.pos}).map(function(entry){return CoordinatesUtils.reproject(entry.pos,entry.crs,"EPSG:4326")});_this.props.removeLayer("routinggeometries");_this.updateIsoConfig({busy:true,result:null},false);var unitsFactor=_this.props.units[_this.state.isoConfig.mode][_this.state.isoConfig.units[_this.state.isoConfig.mode]];var contourOptions={mode:_this.state.isoConfig.mode,intervals:_this.state.isoConfig.intervals.split(",").map(function(entry){return parseInt(entry.trim(),10)/unitsFactor}).sort()};RoutingInterface.computeIsochrone(_this.state.mode,locations,contourOptions,_this.state.settings[_this.state.mode],function(success,result){if(success){var layer={id:"routinggeometries",role:LayerRole.SELECTION,styleOptions:{strokeColor:[10,10,255,1],fillColor:[10,10,255,0.5],strokeWidth:4,strokeDash:[]}};var features=result.areas.map(function(area){return{type:"Feature",crs:"EPSG:4326",geometry:{type:"Polygon",coordinates:[area]}}});_this.props.addLayerFeatures(layer,features,true);if(_this.props.zoomAuto){_this.props.zoomToExtent(result.bounds,"EPSG:4326",-0.5)}}_this.updateIsoConfig({result:{success:success,data:result},busy:false},false)})});_defineProperty(_this,"recomputeIfNeeded",function(){clearTimeout(_this.recomputeTimeout);_this.recomputeTimeout=setTimeout(function(){if(_this.state.currentTab==="Route"&&_this.state.routeConfig.points.filter(function(entry){return entry.pos}).length>=2){_this.computeRoute()}else if(_this.state.currentTab==="Reachability"&&_this.state.isoConfig.points.filter(function(entry){return entry.pos}).length>0){_this.computeIsochrone()}_this.recomputeTimeout=null},750)});_defineProperty(_this,"collectRoutingFeatures",function(){return _this.state.routeConfig.result.data.legs.map(function(leg){return{type:"Feature",properties:{time:leg.time,length:leg.length},geometry:{type:"LineString",coordinates:leg.coordinates},styleName:"default",styleOptions:{strokeColor:[10,10,255,1],strokeWidth:4,strokeDash:[]}}})});_defineProperty(_this,"exportRoute",function(){var data=JSON.stringify({type:"FeatureCollection",features:_this.collectRoutingFeatures()});FileSaver.saveAs(new Blob([data],{type:"text/plain;charset=utf-8"}),"route.json")});_defineProperty(_this,"addRouteLayer",function(){var layer={id:uuidv4(),crs:"EPSG:4326",title:LocaleUtils.tr("routing.route"),type:"vector"};_this.props.addLayerFeatures(layer,_this.collectRoutingFeatures());_this.props.setCurrentTask("LayerTree")});_defineProperty(_this,"collectIsochroneFeatures",function(){return _this.state.isoConfig.result.data.areas.map(function(area){return{type:"Feature",geometry:{type:"Polygon",coordinates:[area]},styleName:"default",styleOptions:{strokeColor:[10,10,255,1],fillColor:[10,10,255,0.5],strokeWidth:4,strokeDash:[]}}})});_defineProperty(_this,"exportIsochrone",function(){var data=JSON.stringify({type:"FeatureCollection",features:_this.collectIsochroneFeatures()});FileSaver.saveAs(new Blob([data],{type:"text/plain;charset=utf-8"}),"isochrone.json")});_defineProperty(_this,"addIsochroneLayer",function(){var layer={id:uuidv4(),crs:"EPSG:4326",title:LocaleUtils.tr("routing.reachability"),type:"vector"};_this.props.addLayerFeatures(layer,[_this.collectIsochroneFeatures()]);_this.props.setCurrentTask("LayerTree")});_defineProperty(_this,"onSortChange",function(order,sortable,ev){var newpoints=_this.state.routeConfig.points.slice(0);var moved=newpoints.splice(ev.oldIndex,1)[0];newpoints.splice(ev.newIndex,0,moved);_this.updateRouteConfig({points:newpoints})});_this.recomputeTimeout=null;_this.state.mode=_this.props.enabledModes[0];return _this}_inherits(Routing,_React$Component);return _createClass(Routing,[{key:"componentDidUpdate",value:function componentDidUpdate(prevProps,prevState){var _this2=this;// Recollect search providers
15
15
  if(this.props.searchProviders!==prevProps.searchProviders){this.setState({searchProviders:this.props.enabledProviders.map(function(key){return _this2.props.searchProviders[key]}).filter(Boolean),searchParams:{mapcrs:this.props.mapCrs,displaycrs:this.props.displayCrs}})}// Activated / message
16
16
  if(this.props.task.id==="Routing"){this.props.setCurrentTask(null);if(!this.state.visible){this.setState({visible:true})}var taskData=this.props.task.data||{};if(taskData.from){this.setState({currentTab:"Route"});this.updatePoint("routeConfig",0,taskData.from)}if(taskData.to){this.setState({currentTab:"Route"});this.updatePoint("routeConfig",this.state.routeConfig.points.length-1,taskData.to)}if(taskData.via){this.setState({currentTab:"Route"});this.addPoint("routeConfig",-1,taskData.via)}if(taskData.isocenter){this.setState({currentTab:"Reachability"});this.updateIsoConfig({points:[taskData.isocenter]})}if(taskData.isoextracenter){this.setState({currentTab:"Reachability"});this.updateIsoConfig({points:[].concat(_toConsumableArray(this.state.isoConfig.points),[taskData.isoextracenter])})}}// Window closed
17
17
  if(!this.state.visible&&prevState.visible){this.props.removeLayer("routinggeometries");this.props.removeLayer("routingmarkers");this.updateRouteConfig({points:[{text:"",pos:null,crs:null},{text:"",pos:null,crs:null}],result:null},false);this.updateIsoConfig({point:{text:"",pos:null,crs:null},result:null},false)}// No further processing beyond here if not visible
@@ -20,4 +20,4 @@ if(this.state.currentTab!==prevState.currentTab){this.props.removeLayer("routing
20
20
  if(this.state.mode!==prevState.mode){this.recomputeIfNeeded()}// Routing markers
21
21
  if(this.state.currentTab!==prevState.currentTab||this.state.routeConfig.points!==prevState.routeConfig.points||this.state.isoConfig.points!==prevState.isoConfig.points){this.updateRoutingMarkers()}// Theme changed
22
22
  if(this.props.theme!==prevProps.theme){this.setState({visible:false})}// Recompute when exclude layer changes
23
- if(this.state.currentTab==="Route"&&this.state.routeConfig.excludeLayer&&this.props.layers!==prevProps.layers){var newlayer=this.props.layers.find(function(layer){return layer.id===_this2.state.routeConfig.excludeLayer});var prevLayer=prevProps.layers.find(function(layer){return layer.id===_this2.state.routeConfig.excludeLayer});if(newlayer!==prevLayer){this.recomputeIfNeeded()}}}},{key:"render",value:function render(){var _this3=this;if(!this.state.visible){return null}var tabButtons=[{key:"Route",label:LocaleUtils.tr("routing.route")},{key:"Reachability",label:LocaleUtils.tr("routing.reachability")}];var tabRenderers={Route:this.renderRouteWidget,Reachability:this.renderIsochroneWidget};var buttons=[{key:"auto",icon:"routing-car",tooltip:LocaleUtils.tr("routing.mode_auto")},{key:"heavyvehicle",icon:"routing-truck",tooltip:LocaleUtils.tr("routing.mode_heavyvehicle")},{key:"transit",icon:"routing-train",tooltip:LocaleUtils.tr("routing.mode_transit")},{key:"bicycle",icon:"routing-bicycle",tooltip:LocaleUtils.tr("routing.mode_bicycle")},{key:"pedestrian",icon:"routing-walking",tooltip:LocaleUtils.tr("routing.mode_walking")}];var enabledButtons=this.props.enabledModes.map(function(entry){return buttons.find(function(button){return button.key===entry})});return/*#__PURE__*/React.createElement(ResizeableWindow,{dockable:this.props.geometry.side,icon:"routing",initialHeight:this.props.geometry.initialHeight,initialWidth:this.props.geometry.initialWidth,initialX:this.props.geometry.initialX,initialY:this.props.geometry.initialY,initiallyDocked:this.props.geometry.initiallyDocked,onClose:function onClose(){return _this3.setState({visible:false})},title:LocaleUtils.tr("routing.windowtitle")},/*#__PURE__*/React.createElement("div",{className:"routing-body",role:"body"},/*#__PURE__*/React.createElement(ButtonBar,{active:this.state.currentTab,buttons:tabButtons,className:"routing-buttonbar",onClick:function onClick(key){return _this3.setState({currentTab:key})}}),/*#__PURE__*/React.createElement("div",{className:"routing-frame"},/*#__PURE__*/React.createElement("div",{className:"routing-buttons controlgroup"},/*#__PURE__*/React.createElement(ButtonBar,{active:this.state.mode,buttons:enabledButtons,onClick:function onClick(key){return _this3.setState({mode:key})}}),/*#__PURE__*/React.createElement("button",{className:"button"+(this.state.settingsPopup?" pressed":""),onClick:function onClick(){return _this3.setState(function(state){return{settingsPopup:!state.settingsPopup}})}},/*#__PURE__*/React.createElement(Icon,{icon:"cog"})),this.state.settingsPopup?this.renderSettings():null),tabRenderers[this.state.currentTab]())))}}])}(React.Component);_defineProperty(Routing,"propTypes",{addLayerFeatures:PropTypes.func,displayCrs:PropTypes.string,/** List of enabled routing modes. */enabledModes:PropTypes.arrayOf(PropTypes.string),/** List of search providers to use for routing location search. */enabledProviders:PropTypes.arrayOf(PropTypes.string),/** 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). */geometry:PropTypes.shape({initialWidth:PropTypes.number,initialHeight:PropTypes.number,initialX:PropTypes.number,initialY:PropTypes.number,initiallyDocked:PropTypes.bool,side:PropTypes.string}),layers:PropTypes.array,locatePos:PropTypes.array,mapCrs:PropTypes.string,removeLayer:PropTypes.func,searchProviders:PropTypes.object,setCurrentTask:PropTypes.func,/** Whether to label the routing waypoint pins with the route point number. */showPinLabels:PropTypes.bool,task:PropTypes.object,theme:PropTypes.object,/** Set of units for isochrone time/distance intervals to use. */units:PropTypes.object,/** Automatically zoom to the extent of the route */zoomAuto:PropTypes.bool,zoomToExtent:PropTypes.func});_defineProperty(Routing,"defaultProps",{enabledModes:["auto","heavyvehicle","transit","bicycle","pedestrian"],enabledProviders:["coordinates","nominatim"],geometry:{initialWidth:320,initialHeight:640,initialX:0,initialY:0,initiallyDocked:true,side:"left"},showPinLabels:true,units:{time:{min:1,s:60},distance:{km:1,m:1000}},zoomAuto:true});export default connect(createSelector([function(state){return state},searchProvidersSelector],function(state,searchProviders){return{displayCrs:state.map.displayCrs,layers:state.layers.flat,locatePos:state.locate.position,mapCrs:state.map.projection,searchProviders:searchProviders,task:state.task,theme:state.theme.current}}),{addLayerFeatures:addLayerFeatures,removeLayer:removeLayer,setCurrentTask:setCurrentTask,zoomToExtent:zoomToExtent})(Routing);
23
+ if(this.state.currentTab==="Route"&&this.state.routeConfig.excludeLayer&&this.props.layers!==prevProps.layers){var newlayer=this.props.layers.find(function(layer){return layer.id===_this2.state.routeConfig.excludeLayer});var prevLayer=prevProps.layers.find(function(layer){return layer.id===_this2.state.routeConfig.excludeLayer});if(newlayer!==prevLayer){this.recomputeIfNeeded()}}}},{key:"render",value:function render(){var _this3=this;if(!this.state.visible){return null}var tabButtons=[{key:"Route",label:LocaleUtils.tr("routing.route")},{key:"Reachability",label:LocaleUtils.tr("routing.reachability")}];var tabRenderers={Route:this.renderRouteWidget,Reachability:this.renderIsochroneWidget};var buttons=[{key:"auto",icon:"routing-car",tooltip:LocaleUtils.tr("routing.mode_auto")},{key:"heavyvehicle",icon:"routing-truck",tooltip:LocaleUtils.tr("routing.mode_heavyvehicle")},{key:"transit",icon:"routing-train",tooltip:LocaleUtils.tr("routing.mode_transit")},{key:"bicycle",icon:"routing-bicycle",tooltip:LocaleUtils.tr("routing.mode_bicycle")},{key:"pedestrian",icon:"routing-walking",tooltip:LocaleUtils.tr("routing.mode_walking")}];var enabledButtons=this.props.enabledModes.map(function(entry){return buttons.find(function(button){return button.key===entry})});return/*#__PURE__*/React.createElement(ResizeableWindow,{dockable:this.props.geometry.side,icon:"routing",initialHeight:this.props.geometry.initialHeight,initialWidth:this.props.geometry.initialWidth,initialX:this.props.geometry.initialX,initialY:this.props.geometry.initialY,initiallyDocked:this.props.geometry.initiallyDocked,onClose:function onClose(){return _this3.setState({visible:false})},title:LocaleUtils.tr("routing.windowtitle")},/*#__PURE__*/React.createElement("div",{className:"routing-body",role:"body"},/*#__PURE__*/React.createElement(ButtonBar,{active:this.state.currentTab,buttons:tabButtons,className:"routing-buttonbar",onClick:function onClick(key){return _this3.setState({currentTab:key})}}),/*#__PURE__*/React.createElement("div",{className:"routing-frame"},/*#__PURE__*/React.createElement("div",{className:"routing-buttons controlgroup"},/*#__PURE__*/React.createElement(ButtonBar,{active:this.state.mode,buttons:enabledButtons,onClick:function onClick(key){return _this3.setState({mode:key})}}),/*#__PURE__*/React.createElement("button",{className:"button"+(this.state.settingsPopup?" pressed":""),onClick:function onClick(){return _this3.setState(function(state){return{settingsPopup:!state.settingsPopup}})}},/*#__PURE__*/React.createElement(Icon,{icon:"cog"})),this.state.settingsPopup?this.renderSettings():null),tabRenderers[this.state.currentTab]())))}}])}(React.Component);_defineProperty(Routing,"propTypes",{addLayerFeatures:PropTypes.func,displayCrs:PropTypes.string,/** List of enabled routing modes. */enabledModes:PropTypes.arrayOf(PropTypes.string),/** List of search providers to use for routing location search. */enabledProviders:PropTypes.arrayOf(PropTypes.string),/** 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). */geometry:PropTypes.shape({initialWidth:PropTypes.number,initialHeight:PropTypes.number,initialX:PropTypes.number,initialY:PropTypes.number,initiallyDocked:PropTypes.bool,side:PropTypes.string}),layers:PropTypes.array,locatePos:PropTypes.array,mapCrs:PropTypes.string,removeLayer:PropTypes.func,searchProviders:PropTypes.object,setCurrentTask:PropTypes.func,/** Whether to label the routing waypoint pins with the route point number. */showPinLabels:PropTypes.bool,task:PropTypes.object,theme:PropTypes.object,/** Set of units for isochrone time/distance intervals to use. */units:PropTypes.object,/** Automatically zoom to the extent of the route */zoomAuto:PropTypes.bool,zoomToExtent:PropTypes.func});_defineProperty(Routing,"defaultProps",{enabledModes:["auto","heavyvehicle","transit","bicycle","pedestrian"],enabledProviders:["coordinates","nominatim"],geometry:{initialWidth:480,initialHeight:640,initialX:0,initialY:0,initiallyDocked:true,side:"left"},showPinLabels:true,units:{time:{min:1,s:60},distance:{km:1,m:1000}},zoomAuto:true});export default connect(createSelector([function(state){return state},searchProvidersSelector],function(state,searchProviders){return{displayCrs:state.map.displayCrs,layers:state.layers.flat,locatePos:state.locate.position,mapCrs:state.map.projection,searchProviders:searchProviders,task:state.task,theme:state.theme.current}}),{addLayerFeatures:addLayerFeatures,removeLayer:removeLayer,setCurrentTask:setCurrentTask,zoomToExtent:zoomToExtent})(Routing);
@@ -4,7 +4,7 @@ function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof
4
4
  *
5
5
  * This source code is licensed under the BSD-style license found in the
6
6
  * LICENSE file in the root directory of this source tree.
7
- */import React from"react";import{connect}from"react-redux";import PropTypes from"prop-types";import Icon from"../components/Icon";import SideBar from"../components/SideBar";import ThemeLayersListWindow from"../components/ThemeLayersListWindow";import ThemeList from"../components/ThemeList";import InputContainer from"../components/widgets/InputContainer";import ConfigUtils from"../utils/ConfigUtils";import LocaleUtils from"../utils/LocaleUtils";import"./style/ThemeSwitcher.css";/**
7
+ */import React from"react";import ReactDOM from"react-dom";import{connect}from"react-redux";import PropTypes from"prop-types";import Icon from"../components/Icon";import{AppInfosPortalContext}from"../components/PluginsContainer";import SideBar from"../components/SideBar";import ThemeLayersListWindow from"../components/ThemeLayersListWindow";import ThemeList from"../components/ThemeList";import InputContainer from"../components/widgets/InputContainer";import ConfigUtils from"../utils/ConfigUtils";import LocaleUtils from"../utils/LocaleUtils";import"./style/ThemeSwitcher.css";/**
8
8
  * Theme switcher panel.
9
9
  */var ThemeSwitcher=/*#__PURE__*/function(_React$Component){function ThemeSwitcher(){var _this;_classCallCheck(this,ThemeSwitcher);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key]}_this=_callSuper(this,ThemeSwitcher,[].concat(args));_defineProperty(_this,"state",{filter:""});_defineProperty(_this,"focusFilterField",function(el){if(el){// Need to wait until slide in transition is over
10
- setTimeout(function(){if(_this.props.currentTask&&_this.props.currentTask.id==="ThemeSwitcher"){el.focus()}},500)}});return _this}_inherits(ThemeSwitcher,_React$Component);return _createClass(ThemeSwitcher,[{key:"render",value:function render(){var _this2=this;var allowAddingOtherThemes=ConfigUtils.getConfigProp("allowAddingOtherThemes",this.props.activeTheme)===true;var showAddThemeButton=allowAddingOtherThemes&&!this.props.hideAddThemeButton;var showAddThemeLayersButton=allowAddingOtherThemes&&!this.props.hideAddThemeLayersButton;var themeFilter=this.props.showThemeFilter?/*#__PURE__*/React.createElement(InputContainer,{className:"theme-switcher-filter"},/*#__PURE__*/React.createElement("input",{onChange:function onChange(ev){return _this2.setState({filter:ev.target.value})},placeholder:LocaleUtils.tr("themeswitcher.filter"),ref:this.focusFilterField,role:"input",type:"text",value:this.state.filter}),/*#__PURE__*/React.createElement(Icon,{icon:"remove",onClick:function onClick(){return _this2.setState({filter:""})},role:"suffix"})):null;var extraTitlebarContent=themeFilter;return/*#__PURE__*/React.createElement("div",null,/*#__PURE__*/React.createElement(SideBar,{extraTitlebarContent:extraTitlebarContent,icon:"themes",id:"ThemeSwitcher",minWidth:"16em",side:this.props.side,title:LocaleUtils.tr("appmenu.items.ThemeSwitcher"),width:this.props.width},function(){return{body:/*#__PURE__*/React.createElement(ThemeList,{activeTheme:_this2.props.activeTheme,allowAddingOtherThemeLayers:showAddThemeLayersButton,allowAddingOtherThemes:showAddThemeButton,collapsibleGroups:_this2.props.collapsibleGroups,filter:_this2.state.filter,showDefaultThemeSelector:_this2.props.showDefaultThemeSelector,showLayerAfterChangeTheme:_this2.props.showLayerAfterChangeTheme})}}),showAddThemeLayersButton?/*#__PURE__*/React.createElement(ThemeLayersListWindow,{windowSize:this.props.themeLayersListWindowSize}):null)}}])}(React.Component);_defineProperty(ThemeSwitcher,"availableIn3D",true);_defineProperty(ThemeSwitcher,"propTypes",{activeTheme:PropTypes.object,/** Whether to allow collapsing theme groups. */collapsibleGroups:PropTypes.bool,currentTask:PropTypes.object,/** Whether to hide the add theme button. Note: the button will also be hidden if the global option `allowAddingOtherThemes` is `false`. */hideAddThemeButton:PropTypes.bool,/** Whether to hide the add theme layers button. Note: the button will also be hidden if the global option `allowAddingOtherThemes` is `false`. */hideAddThemeLayersButton:PropTypes.bool,/** Whether to show an icon to select the default theme/bookmark (of a logged in user). */showDefaultThemeSelector:PropTypes.bool,/** Whether to show the LayerTree by default after switching the theme. */showLayerAfterChangeTheme:PropTypes.bool,/** Wether to show the theme filter field in the top bar. */showThemeFilter:PropTypes.bool,/** The side of the application on which to display the sidebar. */side:PropTypes.string,/** The default window size for the theme layers dialog. */themeLayersListWindowSize:PropTypes.shape({width:PropTypes.number,height:PropTypes.number}),/** Default width as a CSS string. */width:PropTypes.string});_defineProperty(ThemeSwitcher,"defaultProps",{width:"50%",showThemeFilter:true,showDefaultThemeSelector:true,showLayerAfterChangeTheme:false,themeLayersListWindowSize:{width:400,height:300},side:"right"});var selector=function selector(state){return{activeTheme:state.theme.current}};export default connect(selector,{})(ThemeSwitcher);
10
+ setTimeout(function(){if(_this.props.currentTask&&_this.props.currentTask.id==="ThemeSwitcher"){el.focus()}},500)}});return _this}_inherits(ThemeSwitcher,_React$Component);return _createClass(ThemeSwitcher,[{key:"render",value:function render(){var _this2=this;var allowAddingOtherThemes=ConfigUtils.getConfigProp("allowAddingOtherThemes",this.props.activeTheme)===true;var showAddThemeButton=allowAddingOtherThemes&&!this.props.hideAddThemeButton;var showAddThemeLayersButton=allowAddingOtherThemes&&!this.props.hideAddThemeLayersButton;var themeFilter=this.props.showThemeFilter?/*#__PURE__*/React.createElement(InputContainer,{className:"theme-switcher-filter"},/*#__PURE__*/React.createElement("input",{onChange:function onChange(ev){return _this2.setState({filter:ev.target.value})},placeholder:LocaleUtils.tr("themeswitcher.filter"),ref:this.focusFilterField,role:"input",type:"text",value:this.state.filter}),/*#__PURE__*/React.createElement(Icon,{icon:"remove",onClick:function onClick(){return _this2.setState({filter:""})},role:"suffix"})):null;var extraTitlebarContent=themeFilter;return/*#__PURE__*/React.createElement("div",null,/*#__PURE__*/React.createElement(SideBar,{extraTitlebarContent:extraTitlebarContent,icon:"themes",id:"ThemeSwitcher",minWidth:"16em",side:this.props.side,title:LocaleUtils.tr("appmenu.items.ThemeSwitcher"),width:this.props.width},function(){return{body:/*#__PURE__*/React.createElement(ThemeList,{activeTheme:_this2.props.activeTheme,allowAddingOtherThemeLayers:showAddThemeLayersButton,allowAddingOtherThemes:showAddThemeButton,collapsibleGroups:_this2.props.collapsibleGroups,filter:_this2.state.filter,showDefaultThemeSelector:_this2.props.showDefaultThemeSelector,showLayerAfterChangeTheme:_this2.props.showLayerAfterChangeTheme})}}),showAddThemeLayersButton?/*#__PURE__*/React.createElement(ThemeLayersListWindow,{windowSize:this.props.themeLayersListWindowSize}):null,this.props.showActiveTheme&&this.props.activeTheme?(/*#__PURE__*/ReactDOM.createPortal(/*#__PURE__*/React.createElement("div",{className:"app-info active-theme"},/*#__PURE__*/React.createElement(Icon,{icon:"themes"}),/*#__PURE__*/React.createElement("span",null,this.props.activeTheme.title||this.props.activeTheme.name||this.props.activeTheme.id)),this.context)):null)}}])}(React.Component);_defineProperty(ThemeSwitcher,"contextType",AppInfosPortalContext);_defineProperty(ThemeSwitcher,"availableIn3D",true);_defineProperty(ThemeSwitcher,"propTypes",{activeTheme:PropTypes.object,/** Whether to allow collapsing theme groups. */collapsibleGroups:PropTypes.bool,currentTask:PropTypes.object,/** Whether to hide the add theme button. Note: the button will also be hidden if the global option `allowAddingOtherThemes` is `false`. */hideAddThemeButton:PropTypes.bool,/** Whether to hide the add theme layers button. Note: the button will also be hidden if the global option `allowAddingOtherThemes` is `false`. */hideAddThemeLayersButton:PropTypes.bool,/** Whether to display the currently active theme below the application menu button. Default: false */showActiveTheme:PropTypes.bool,/** Whether to show an icon to select the default theme/bookmark (of a logged in user). */showDefaultThemeSelector:PropTypes.bool,/** Whether to show the LayerTree by default after switching the theme. */showLayerAfterChangeTheme:PropTypes.bool,/** Wether to show the theme filter field in the top bar. */showThemeFilter:PropTypes.bool,/** The side of the application on which to display the sidebar. */side:PropTypes.string,/** The default window size for the theme layers dialog. */themeLayersListWindowSize:PropTypes.shape({width:PropTypes.number,height:PropTypes.number}),/** Default width as a CSS string. */width:PropTypes.string});_defineProperty(ThemeSwitcher,"defaultProps",{width:"50%",showActiveTheme:false,showThemeFilter:true,showDefaultThemeSelector:true,showLayerAfterChangeTheme:false,themeLayersListWindowSize:{width:400,height:300},side:"right"});var selector=function selector(state){return{activeTheme:state.theme.current}};export default connect(selector,{})(ThemeSwitcher);
package/plugins/TopBar.js CHANGED
@@ -6,7 +6,7 @@ function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  */import React from"react";import{connect}from"react-redux";import classnames from"classnames";import PropTypes from"prop-types";import{toggleFullscreen}from"../actions/display";import{openExternalUrl,setTopbarHeight}from"../actions/windows";import{Swipeable}from"../components/Swipeable";import ConfigUtils from"../utils/ConfigUtils";import LocaleUtils from"../utils/LocaleUtils";import ThemeUtils from"../utils/ThemeUtils";import"./style/TopBar.css";/**
8
8
  * Top bar, containing the logo, searchbar, task buttons and app menu.
9
- */var TopBar=/*#__PURE__*/function(_React$Component){function TopBar(){var _this;_classCallCheck(this,TopBar);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key]}_this=_callSuper(this,TopBar,[].concat(args));_defineProperty(_this,"state",{allowedMenuItems:[],allowedToolbarItems:[]});_defineProperty(_this,"openUrl",function(url,target,title,icon){if(target==="iframe"){target=":iframedialog:externallinkiframe"}_this.props.openExternalUrl(url,target,{title:title,icon:icon})});_defineProperty(_this,"storeHeight",function(el){if(el){_this.props.setTopbarHeight(el.clientHeight)}});return _this}_inherits(TopBar,_React$Component);return _createClass(TopBar,[{key:"componentDidMount",value:function componentDidMount(){this.setState({allowedToolbarItems:ThemeUtils.allowedItems(this.props.toolbarItems,this.props.currentTheme),allowedMenuItems:ThemeUtils.allowedItems(this.props.menuItems,this.props.currentTheme)})}},{key:"componentDidUpdate",value:function componentDidUpdate(prevProps){if(this.props.currentTheme!==prevProps.currentTheme){this.setState({allowedToolbarItems:ThemeUtils.allowedItems(this.props.toolbarItems,this.props.currentTheme),allowedMenuItems:ThemeUtils.allowedItems(this.props.menuItems,this.props.currentTheme)})}}},{key:"render",value:function render(){var _this2=this;var logo;var assetsPath=ConfigUtils.getAssetsPath();var isMobile=ConfigUtils.isMobile();if(isMobile||this.props.appMenuCompact){logo=assetsPath+"/img/logo-mobile."+this.props.logoFormat}else{logo=assetsPath+"/img/logo."+this.props.logoFormat}var classes=classnames({TopBar:true,mobile:isMobile,fullscreen:this.props.fullscreen});var logoEl=/*#__PURE__*/React.createElement("img",{className:"topbar-logo",src:this.props.logoSrc||logo});if(this.props.logoUrl){logoEl=/*#__PURE__*/React.createElement("a",{href:this.props.logoUrl,rel:"noreferrer",target:"_blank"},logoEl)}// Convert legacy minScale option to minScaleDenom
9
+ */var TopBar=/*#__PURE__*/function(_React$Component){function TopBar(){var _this;_classCallCheck(this,TopBar);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key]}_this=_callSuper(this,TopBar,[].concat(args));_defineProperty(_this,"state",{allowedMenuItems:[],allowedToolbarItems:[]});_defineProperty(_this,"openUrl",function(url,target,title,icon){if(target==="iframe"){target=":iframedialog:externallinkiframe"}_this.props.openExternalUrl(url,target,{title:title,icon:icon})});_defineProperty(_this,"storeHeight",function(el){if(el){_this.props.setTopbarHeight(el.clientHeight)}});return _this}_inherits(TopBar,_React$Component);return _createClass(TopBar,[{key:"componentDidMount",value:function componentDidMount(){this.setState({allowedToolbarItems:ThemeUtils.allowedItems(this.props.toolbarItems,this.props.currentTheme),allowedMenuItems:ThemeUtils.allowedItems(this.props.menuItems,this.props.currentTheme)})}},{key:"componentDidUpdate",value:function componentDidUpdate(prevProps){if(this.props.currentTheme!==prevProps.currentTheme){this.setState({allowedToolbarItems:ThemeUtils.allowedItems(this.props.toolbarItems,this.props.currentTheme),allowedMenuItems:ThemeUtils.allowedItems(this.props.menuItems,this.props.currentTheme)})}}},{key:"render",value:function render(){var _this2=this;var logo;var assetsPath=ConfigUtils.getAssetsPath();var isMobile=ConfigUtils.isMobile();if(isMobile){logo=assetsPath+"/img/logo-mobile."+this.props.logoFormat}else{logo=assetsPath+"/img/logo."+this.props.logoFormat}var classes=classnames({TopBar:true,mobile:isMobile,fullscreen:this.props.fullscreen});var logoEl=/*#__PURE__*/React.createElement("img",{className:"topbar-logo",src:this.props.logoSrc||logo});if(this.props.logoUrl){logoEl=/*#__PURE__*/React.createElement("a",{href:this.props.logoUrl,rel:"noreferrer",target:"_blank"},logoEl)}// Convert legacy minScale option to minScaleDenom
10
10
  var searchOptions=_objectSpread(_objectSpread({},TopBar.defaultProps.searchOptions),this.props.searchOptions);searchOptions.minScaleDenom=searchOptions.minScaleDenom||searchOptions.minScale;delete searchOptions.minScale;// Menu compact only available for desktop client
11
11
  var menuCompact=!isMobile?this.props.appMenuCompact:false;// Keep menu open when appMenu is in compact mode (Visible on Hover)
12
12
  var keepMenuOpen=menuCompact;// Menu should be visible on startup when appMenu is in compact mode (Visible on Hover)
package/plugins/View3D.js CHANGED
@@ -13,10 +13,10 @@ if(_this.state.viewsLocked&&_this.focusedMap==="map3d"){var rotation=undefined;i
13
13
  var _ReducerIndex$reducer=ReducerIndex.reducers,processNotifications=_ReducerIndex$reducer.processNotifications,task=_ReducerIndex$reducer.task,windows=_ReducerIndex$reducer.windows;// Reducer for syncronization with parent store
14
14
  var forwardReducer=function forwardReducer(key,forwardActions,syncAction){return function(){var state=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var action=arguments.length>1?arguments[1]:undefined;if(forwardActions.includes(action.type)){// Forward to parent store
15
15
  StandardApp.store.dispatch(action);return state}else{return action.type===syncAction?action[key]:state}}};var displayActions=Object.values(displayExports).filter(function(x){return typeof x==="string"});var layersActions=Object.values(layersExports).filter(function(x){return typeof x==="string"});var mapActions=Object.values(mapExports).filter(function(x){return typeof x==="string"});var themeActions=Object.values(themeExports).filter(function(x){return typeof x==="string"});var display=forwardReducer("display",displayActions,"SYNC_DISPLAY_FROM_PARENT_STORE");var layers=forwardReducer("layers",layersActions,"SYNC_LAYERS_FROM_PARENT_STORE");var map=forwardReducer("map",mapActions,"SYNC_MAP_FROM_PARENT_STORE");var localConfig=forwardReducer("localConfig",[],"SYNC_LOCAL_CONFIG_FROM_PARENT_STORE");var theme=forwardReducer("theme",themeActions,"SYNC_THEME_FROM_PARENT_STORE");_this.store=createStore({display:display,layers:layers,localConfig:localConfig,map:map,processNotifications:processNotifications,theme:theme,task:task,windows:windows});// Set stored state
16
- var storedState=_objectSpread({},props.startupState.map3d);if(props.startupParams.v3d){var values=props.startupParams.v3d.split(",").map(parseFloat).filter(function(x){return!isNaN(x)});if(values.length>=6){var _values$;storedState.camera=[values[0],values[1],values[2]];storedState.target=[values[3],values[4],values[5]];storedState.personHeight=(_values$=values[6])!==null&&_values$!==void 0?_values$:0}}if(props.startupParams.bl3d!==undefined){storedState.baseLayer=props.startupParams.bl3d}_this.state.storedState=storedState;return _this}_inherits(View3D,_React$Component);return _createClass(View3D,[{key:"componentDidMount",value:function componentDidMount(){if(this.props.startupParams.v==="3d"){this.props.setView3dMode(View3DMode.FULLSCREEN)}else if(this.props.startupParams.v==="3d2d"){this.props.setView3dMode(View3DMode.SPLITSCREEN)}window.addEventListener("focus",this.trackFocus,true);this.syncParentStore({})}},{key:"componentWillUnmount",value:function componentWillUnmount(){window.removeEventListener("focus",this.trackFocus)}},{key:"componentDidUpdate",value:function componentDidUpdate(prevProps,prevState){var _this2=this,_this$props$theme$cur;if(this.props.view3dMode!==View3DMode.DISABLED&&prevProps.view3dMode===View3DMode.DISABLED){import("../components/map3d/Map3D").then(function(component){_this2.map3dComponent=component["default"];_this2.map3dComponentRef=null;_this2.setState({componentLoaded:true})})}else if(this.props.view3dMode===View3DMode.DISABLING&&prevProps.view3dMode!==View3DMode.DISABLING){if(this.map3dComponentRef){this.map3dComponentRef.store3dState().then(function(storedState){_this2.setState({storedState:storedState});UrlParams.updateParams({v3d:undefined,bl3d:undefined});_this2.props.setView3dMode(View3DMode.DISABLED)})}else{UrlParams.updateParams({v3d:undefined,bl3d:undefined});this.props.setView3dMode(View3DMode.DISABLED)}}else if(this.props.view3dMode===View3DMode.DISABLED&&prevProps.view3dMode!==View3DMode.DISABLED){this.map3dComponent=null;this.map3dComponentRef=null;this.setState({componentLoaded:false});if(this.firstPersonMarker){this.props.removeLayer("view3d-firstperson-marker");this.firstPersonMarker=false}}// Sync parts of parent store
16
+ var storedState=_objectSpread({},props.startupState.map3d);if(props.startupParams.v3d){var values=props.startupParams.v3d.split(",").map(parseFloat).filter(function(x){return!isNaN(x)});if(values.length>=6){var _values$;storedState.camera=[values[0],values[1],values[2]];storedState.target=[values[3],values[4],values[5]];storedState.personHeight=(_values$=values[6])!==null&&_values$!==void 0?_values$:0}}if(props.startupParams.bl3d!==undefined){storedState.baseLayer=props.startupParams.bl3d}_this.state.storedState=storedState;return _this}_inherits(View3D,_React$Component);return _createClass(View3D,[{key:"componentDidMount",value:function componentDidMount(){if(this.props.startupParams.v==="3d"){this.props.setView3dMode(View3DMode.FULLSCREEN)}else if(this.props.startupParams.v==="3d2d"){this.props.setView3dMode(View3DMode.SPLITSCREEN)}window.addEventListener("focus",this.trackFocus,true);this.syncParentStore({})}},{key:"componentWillUnmount",value:function componentWillUnmount(){window.removeEventListener("focus",this.trackFocus)}},{key:"componentDidUpdate",value:function componentDidUpdate(prevProps,prevState){var _this2=this,_this$props$theme$cur;if(this.props.view3dMode!==View3DMode.DISABLED&&prevProps.view3dMode===View3DMode.DISABLED){import("../components/map3d/Map3D").then(function(component){_this2.map3dComponent=component["default"];_this2.map3dComponentRef=null;_this2.setState({componentLoaded:true})});this.syncParentStore(this.props,true)}else if(this.props.view3dMode===View3DMode.DISABLING&&prevProps.view3dMode!==View3DMode.DISABLING){if(this.map3dComponentRef){this.map3dComponentRef.store3dState().then(function(storedState){_this2.setState({storedState:storedState});UrlParams.updateParams({v3d:undefined,bl3d:undefined});_this2.props.setView3dMode(View3DMode.DISABLED)})}else{UrlParams.updateParams({v3d:undefined,bl3d:undefined});this.props.setView3dMode(View3DMode.DISABLED)}}else if(this.props.view3dMode===View3DMode.DISABLED&&prevProps.view3dMode!==View3DMode.DISABLED){this.map3dComponent=null;this.map3dComponentRef=null;this.setState({componentLoaded:false});if(this.firstPersonMarker){this.props.removeLayer("view3d-firstperson-marker");this.firstPersonMarker=false}}// Sync parts of parent store
17
17
  this.syncParentStore(prevProps);// Handle view mode change
18
18
  if(this.props.view3dMode!==prevProps.view3dMode){if(this.props.view3dMode===View3DMode.FULLSCREEN){UrlParams.updateParams({v:"3d"});this.setState({viewsLocked:false})}else if(this.props.view3dMode===View3DMode.SPLITSCREEN){UrlParams.updateParams({v:"3d2d"})}else{UrlParams.updateParams({v:"2d"})}}// Switch to 2D mode if new theme has no 3D configuration
19
19
  if(this.props.theme.current!==prevProps.theme.current&&!((_this$props$theme$cur=this.props.theme.current)!==null&&_this$props$theme$cur!==void 0&&_this$props$theme$cur.map3d)&&this.props.view3dMode!==View3DMode.DISABLED){this.props.setView3dMode(View3D.DISABLED)}// Lock views
20
20
  if(this.state.viewsLocked&&this.props.map.bbox!==prevProps.map.bbox&&this.focusedMap==="map"){this.sync2DExtent()}// Clear stored state when switching away from a theme
21
- if(prevProps.theme.current&&this.props.theme.current!==prevProps.theme.current){this.setState({storedState:null})}}},{key:"syncParentStore",value:function syncParentStore(prevProps){if(this.props.display!==prevProps.display){this.store.dispatch({type:"SYNC_DISPLAY_FROM_PARENT_STORE",display:this.props.display})}if(this.props.theme!==prevProps.theme){this.store.dispatch({type:"SYNC_THEME_FROM_PARENT_STORE",theme:this.props.theme})}if(this.props.localConfig!==prevProps.localConfig){this.store.dispatch({type:"SYNC_LOCAL_CONFIG_FROM_PARENT_STORE",localConfig:this.props.localConfig})}if(this.props.layers!==prevProps.layers){this.store.dispatch({type:"SYNC_LAYERS_FROM_PARENT_STORE",layers:this.props.layers})}if(this.props.map!==prevProps.map){this.store.dispatch({type:"SYNC_MAP_FROM_PARENT_STORE",map:this.props.map})}}},{key:"render",value:function render(){var _this$props$theme$cur2;var button=(_this$props$theme$cur2=this.props.theme.current)!==null&&_this$props$theme$cur2!==void 0&&_this$props$theme$cur2.map3d?/*#__PURE__*/React.createElement(View3DSwitcher,{key:"View3DButton",position:this.props.buttonPosition}):null;return[button,this.render3DWindow()]}}])}(React.Component);_defineProperty(View3D,"propTypes",{addLayerFeatures:PropTypes.func,/** The position slot index of the 3d switch map button, from the bottom (0: bottom slot). */buttonPosition:PropTypes.number,/** The position of the navigation controls. Either `top` or `bottom`. */controlsPosition:PropTypes.string,/** The default scene quality factor (`20`: min, `100`: max). */defaultSceneQuality:PropTypes.number,display:PropTypes.object,/** Default window geometry. */geometry:PropTypes.shape({initialWidth:PropTypes.number,initialHeight:PropTypes.number,initialX:PropTypes.number,initialY:PropTypes.number,initiallyDocked:PropTypes.bool}),layers:PropTypes.object,localConfig:PropTypes.object,map:PropTypes.object,/** Mouse buttons assignment. You can assign `pan`, `rotate`, `zoom` to each button. */mouseButtons:PropTypes.shape({left:PropTypes.string,middle:PropTypes.string,right:PropTypes.string}),panTo:PropTypes.func,/** Options to pass to the 3D plugins, in the form `{"<PluginName>": {<options>}}`.
21
+ if(prevProps.theme.current&&this.props.theme.current!==prevProps.theme.current){this.setState({storedState:null})}}},{key:"syncParentStore",value:function syncParentStore(prevProps){var force=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;if(this.props.view3dMode===View3DMode.DISABLED){return}if(this.props.display!==prevProps.display||force){this.store.dispatch({type:"SYNC_DISPLAY_FROM_PARENT_STORE",display:this.props.display})}if(this.props.theme!==prevProps.theme||force){this.store.dispatch({type:"SYNC_THEME_FROM_PARENT_STORE",theme:this.props.theme})}if(this.props.localConfig!==prevProps.localConfig||force){this.store.dispatch({type:"SYNC_LOCAL_CONFIG_FROM_PARENT_STORE",localConfig:this.props.localConfig})}if(this.props.layers!==prevProps.layers||force){this.store.dispatch({type:"SYNC_LAYERS_FROM_PARENT_STORE",layers:this.props.layers})}if(this.props.map!==prevProps.map||force){this.store.dispatch({type:"SYNC_MAP_FROM_PARENT_STORE",map:this.props.map})}}},{key:"render",value:function render(){var _this$props$theme$cur2;var button=(_this$props$theme$cur2=this.props.theme.current)!==null&&_this$props$theme$cur2!==void 0&&_this$props$theme$cur2.map3d?/*#__PURE__*/React.createElement(View3DSwitcher,{key:"View3DButton",position:this.props.buttonPosition}):null;return[button,this.render3DWindow()]}}])}(React.Component);_defineProperty(View3D,"propTypes",{addLayerFeatures:PropTypes.func,/** The position slot index of the 3d switch map button, from the bottom (0: bottom slot). */buttonPosition:PropTypes.number,/** The position of the navigation controls. Either `top` or `bottom`. */controlsPosition:PropTypes.string,/** The default scene quality factor (`20`: min, `100`: max). */defaultSceneQuality:PropTypes.number,display:PropTypes.object,/** Default window geometry. */geometry:PropTypes.shape({initialWidth:PropTypes.number,initialHeight:PropTypes.number,initialX:PropTypes.number,initialY:PropTypes.number,initiallyDocked:PropTypes.bool}),layers:PropTypes.object,localConfig:PropTypes.object,map:PropTypes.object,/** Mouse buttons assignment. You can assign `pan`, `rotate`, `zoom` to each button. */mouseButtons:PropTypes.shape({left:PropTypes.string,middle:PropTypes.string,right:PropTypes.string}),panTo:PropTypes.func,/** Options to pass to the 3D plugins, in the form `{"<PluginName>": {<options>}}`.
22
22
  * Refer to the documentation of the <a href="#plugins3d">3D plugins</a> for settable options. */pluginOptions:PropTypes.object,plugins3d:PropTypes.object,removeLayer:PropTypes.func,searchProviders:PropTypes.object,setView3dMode:PropTypes.func,startupParams:PropTypes.object,startupState:PropTypes.object,theme:PropTypes.object,view3dMode:PropTypes.number,zoomToPoint:PropTypes.func});_defineProperty(View3D,"defaultProps",{buttonPosition:6,controlsPosition:"top",geometry:{initialWidth:600,initialHeight:800,initialX:0,initialY:0,initiallyDocked:true},pluginOptions:{},mouseButtons:{left:"pan",middle:"zoom",right:"rotate"}});export default(function(plugins3d){return connect(function(state){return{plugins3d:plugins3d,display:state.display,map:state.map,layers:state.layers,theme:state.theme,localConfig:state.localConfig,view3dMode:state.display.view3dMode,startupParams:state.localConfig.startupParams,startupState:state.localConfig.startupState}},{addLayerFeatures:addLayerFeatures,removeLayer:removeLayer,panTo:panTo,zoomToPoint:zoomToPoint,setView3dMode:setView3dMode})(View3D)});
@@ -1,16 +1,3 @@
1
1
  div.login-user {
2
- position: absolute;
3
- right: 0.25em;
4
- top: 0.25em;
5
- z-index: 1;
6
- color: var(--panel-text-color);
7
- background-color: var(--panel-bg-color);
8
- box-shadow: 0 0 4px rgba(136, 136, 136, 0.5);
9
- padding: 0.25em 0em 0.125em 0em;
10
- display: flex;
11
- }
12
-
13
- div.login-user > span {
14
- flex: 0 0 auto;
15
- padding: 0 0.25em;
2
+ order: 1;
16
3
  }
@@ -5,3 +5,7 @@ div.theme-switcher-filter {
5
5
  color: var(--text-color);
6
6
  margin: 0 0.5em;
7
7
  }
8
+
9
+ div.active-theme {
10
+ order: 0;
11
+ }
Binary file
Binary file
@@ -0,0 +1,45 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
3
+
4
+ <svg
5
+ fill="#000000"
6
+ version="1.1"
7
+ id="Capa_1"
8
+ width="24"
9
+ height="24"
10
+ viewBox="0 0 3.7559999 3.756"
11
+ xml:space="preserve"
12
+ sodipodi:docname="person.svg"
13
+ inkscape:version="1.4.2 (ebf0e940d0, 2025-05-08)"
14
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
15
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
16
+ xmlns="http://www.w3.org/2000/svg"
17
+ xmlns:svg="http://www.w3.org/2000/svg"><defs
18
+ id="defs1" /><sodipodi:namedview
19
+ id="namedview1"
20
+ pagecolor="#aaaaaa"
21
+ bordercolor="#666666"
22
+ borderopacity="1.0"
23
+ inkscape:showpageshadow="2"
24
+ inkscape:pageopacity="0.0"
25
+ inkscape:pagecheckerboard="0"
26
+ inkscape:deskcolor="#d1d1d1"
27
+ inkscape:zoom="8"
28
+ inkscape:cx="5.25"
29
+ inkscape:cy="15.1875"
30
+ inkscape:window-width="1920"
31
+ inkscape:window-height="1172"
32
+ inkscape:window-x="0"
33
+ inkscape:window-y="0"
34
+ inkscape:window-maximized="1"
35
+ inkscape:current-layer="g1" />
36
+ <g
37
+ id="g1"
38
+ transform="matrix(0.0275,0,0,0.0275,0.15651372,0.15649997)">
39
+ <path
40
+ id="path1"
41
+ d="M 62.55504 1.0151515e-06 A 15.7 15.7 0 0 0 46.849465 15.694461 A 15.7 15.7 0 0 0 62.55504 31.400036 A 15.7 15.7 0 0 0 78.2495 15.694461 A 15.7 15.7 0 0 0 62.55504 1.0151515e-06 z M 43.248187 37.202096 C 39.948187 37.202096 37.246056 39.904226 37.246056 43.204226 L 37.246056 80.306285 C 37.246056 83.605285 39.948187 86.297301 43.248187 86.297301 L 46.649394 86.297301 L 46.649394 119.19787 C 46.649394 122.49787 49.251524 125.2 52.651524 125.2 L 72.547476 125.2 C 75.847476 125.2 78.549607 122.49787 78.549607 119.19787 L 78.549607 86.297301 L 81.950814 86.297301 C 85.251814 86.297301 87.952944 83.605285 87.952944 80.306285 L 87.952944 43.204226 C 87.952944 39.904226 85.251814 37.202096 81.950814 37.202096 L 43.248187 37.202096 z "
42
+ style="stroke-width:5.69090902;stroke-dasharray:none;stroke:#ffffff;stroke-opacity:1" />
43
+
44
+ </g>
45
+ </svg>
Binary file
@@ -0,0 +1,124 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!-- Created with Inkscape (http://www.inkscape.org/) -->
3
+
4
+ <svg
5
+ width="32"
6
+ height="32"
7
+ viewBox="0 0 8.4666665 8.4666663"
8
+ version="1.1"
9
+ id="svg1"
10
+ inkscape:version="1.3.2 (091e20ef0f, 2023-11-25)"
11
+ sodipodi:docname="viewcone.svg"
12
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
13
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
14
+ xmlns:xlink="http://www.w3.org/1999/xlink"
15
+ xmlns="http://www.w3.org/2000/svg"
16
+ xmlns:svg="http://www.w3.org/2000/svg">
17
+ <sodipodi:namedview
18
+ id="namedview1"
19
+ pagecolor="#ffffff"
20
+ bordercolor="#666666"
21
+ borderopacity="1.0"
22
+ inkscape:showpageshadow="2"
23
+ inkscape:pageopacity="0.0"
24
+ inkscape:pagecheckerboard="0"
25
+ inkscape:deskcolor="#d1d1d1"
26
+ inkscape:document-units="mm"
27
+ showgrid="true"
28
+ inkscape:zoom="26.084066"
29
+ inkscape:cx="14.089061"
30
+ inkscape:cy="15.929265"
31
+ inkscape:window-width="1920"
32
+ inkscape:window-height="1172"
33
+ inkscape:window-x="0"
34
+ inkscape:window-y="0"
35
+ inkscape:window-maximized="1"
36
+ inkscape:current-layer="layer1">
37
+ <inkscape:grid
38
+ id="grid1"
39
+ units="px"
40
+ originx="0"
41
+ originy="0"
42
+ spacingx="0.26458333"
43
+ spacingy="0.26458334"
44
+ empcolor="#0099e5"
45
+ empopacity="0.30196078"
46
+ color="#0099e5"
47
+ opacity="0.14901961"
48
+ empspacing="5"
49
+ dotted="false"
50
+ gridanglex="30"
51
+ gridanglez="30"
52
+ visible="true" />
53
+ </sodipodi:namedview>
54
+ <defs
55
+ id="defs1">
56
+ <linearGradient
57
+ id="linearGradient3"
58
+ inkscape:collect="always">
59
+ <stop
60
+ style="stop-color:#ff0000;stop-opacity:1;"
61
+ offset="0"
62
+ id="stop3" />
63
+ <stop
64
+ style="stop-color:#000000;stop-opacity:0;"
65
+ offset="1"
66
+ id="stop4" />
67
+ </linearGradient>
68
+ <linearGradient
69
+ id="linearGradient1"
70
+ inkscape:collect="always">
71
+ <stop
72
+ style="stop-color:#ff0000;stop-opacity:1;"
73
+ offset="0"
74
+ id="stop1" />
75
+ <stop
76
+ style="stop-color:#000000;stop-opacity:0;"
77
+ offset="1"
78
+ id="stop2" />
79
+ </linearGradient>
80
+ <linearGradient
81
+ inkscape:collect="always"
82
+ xlink:href="#linearGradient1"
83
+ id="linearGradient2"
84
+ x1="179.91667"
85
+ y1="162.89131"
86
+ x2="179.91672"
87
+ y2="141.63925"
88
+ gradientUnits="userSpaceOnUse"
89
+ gradientTransform="matrix(0.06962172,0,0,0.12996055,47.319103,94.305006)" />
90
+ <linearGradient
91
+ inkscape:collect="always"
92
+ xlink:href="#linearGradient3"
93
+ id="linearGradient4"
94
+ x1="59.845215"
95
+ y1="116.68127"
96
+ x2="59.845215"
97
+ y2="112.71252"
98
+ gradientUnits="userSpaceOnUse"
99
+ gradientTransform="translate(3.8828532e-7)" />
100
+ </defs>
101
+ <g
102
+ inkscape:label="Layer 1"
103
+ inkscape:groupmode="layer"
104
+ id="layer1"
105
+ transform="translate(-55.611881,-111.12502)">
106
+ <path
107
+ style="opacity:0.65;fill:url(#linearGradient2);fill-opacity:1;stroke:none;stroke-width:0.0629188;stroke-linecap:round;stroke-opacity:1"
108
+ id="path1"
109
+ sodipodi:type="arc"
110
+ sodipodi:cx="59.845215"
111
+ sodipodi:cy="119.06251"
112
+ sodipodi:rx="5.5262241"
113
+ sodipodi:ry="10.315619"
114
+ sodipodi:start="3.8397244"
115
+ sodipodi:end="5.5850536"
116
+ sodipodi:arc-type="slice"
117
+ d="m 55.611882,112.43175 a 5.5262241,10.315619 0 0 1 4.233333,-3.68486 5.5262241,10.315619 0 0 1 4.233333,3.68487 l -4.233333,6.63075 z" />
118
+ <path
119
+ style="fill:none;stroke:url(#linearGradient4);stroke-width:0.3;stroke-linecap:butt;stroke-linejoin:miter;stroke-dasharray:none"
120
+ d="m 55.611881,112.71252 4.233333,6.61458 4.233333,-6.61459"
121
+ id="path2"
122
+ sodipodi:nodetypes="ccc" />
123
+ </g>
124
+ </svg>
package/scripts/dist.sh CHANGED
@@ -9,7 +9,9 @@ npx babel $dir --copy-files --out-dir dist/$dir --extensions ".js,.jsx" --minifi
9
9
  done
10
10
  mkdir -p dist/static/translations
11
11
  mkdir -p dist/icons
12
+ mkdir -p dist/resources
12
13
  cp -a icons/*.svg dist/icons/
14
+ cp -a resources/* dist/resources/
13
15
  cp -a static/translations/*.json dist/static/translations/
14
16
  cp -a package.json dist/
15
17
  cp -a LICENSE dist/
@@ -3,6 +3,7 @@
3
3
  "messages": {
4
4
  "app": {
5
5
  "missingbg": "Не може да се намери фонът \"{0}\", показва се фонът по подразбиране.",
6
+ "missingdefaulttheme": "",
6
7
  "missinglayers": "Не мога да намеря следните слоеве: {0}.",
7
8
  "missingpermalink": "Посоченият пермалък или маркер е невалиден или е изтекъл.",
8
9
  "missingprojection": "Невъзможно е да се зареди темата \"{0}\": проекцията {1} не е дефинирана.",
@@ -518,6 +519,7 @@
518
519
  },
519
520
  "routing": {
520
521
  "add": "Добавяне на точка",
522
+ "addlayer": "",
521
523
  "addviapoint": "Чрез тук",
522
524
  "arriveat": "Пристигнете в",
523
525
  "clear": "Clear",
@@ -3,6 +3,7 @@
3
3
  "messages": {
4
4
  "app": {
5
5
  "missingbg": "No s'ha pogut trobar el fons \"{0}\", es mostra el fons per defecte.",
6
+ "missingdefaulttheme": "",
6
7
  "missinglayers": "No s'han pogut trobar les següents capes: {0}.",
7
8
  "missingpermalink": "L'enllaç permanent o marcador especificat no és vàlid o ha caducat.",
8
9
  "missingprojection": "No s'ha pogut carregar el tema \"{0}\": la projecció {1} no està definida.",
@@ -518,6 +519,7 @@
518
519
  },
519
520
  "routing": {
520
521
  "add": "Afegir punt",
522
+ "addlayer": "",
521
523
  "addviapoint": "Passar per aquí",
522
524
  "arriveat": "Arribar a",
523
525
  "clear": "Netejar",
@@ -3,6 +3,7 @@
3
3
  "messages": {
4
4
  "app": {
5
5
  "missingbg": "",
6
+ "missingdefaulttheme": "",
6
7
  "missinglayers": "",
7
8
  "missingpermalink": "",
8
9
  "missingprojection": "",
@@ -518,6 +519,7 @@
518
519
  },
519
520
  "routing": {
520
521
  "add": "",
522
+ "addlayer": "",
521
523
  "addviapoint": "Přes tento bod",
522
524
  "arriveat": "",
523
525
  "clear": "",
@@ -3,6 +3,7 @@
3
3
  "messages": {
4
4
  "app": {
5
5
  "missingbg": "Der Hintergrund \"{0}\" konnte nicht gefunden werden, der Standardhintergrund wird angezeigt.",
6
+ "missingdefaulttheme": "Das Standardthema konnte nicht geladen werden.",
6
7
  "missinglayers": "Die folgenden Ebenen können nicht gefunden werden: {0}.",
7
8
  "missingpermalink": "Der Permalink oder das Lesezeichen ist ungültig oder abgelaufen.",
8
9
  "missingprojection": "Das Thema \"{0}\" konnte nicht geladen werden: die Projektion {1} ist nicht definiert.",
@@ -518,6 +519,7 @@
518
519
  },
519
520
  "routing": {
520
521
  "add": "Hinzufügen",
522
+ "addlayer": "Als Ebene exportieren",
521
523
  "addviapoint": "Routenpunkt hinzufügen",
522
524
  "arriveat": "Ankunft bis",
523
525
  "clear": "Zurücksetzen",
@@ -3,6 +3,7 @@
3
3
  "messages": {
4
4
  "app": {
5
5
  "missingbg": "Der Hintergrund \"{0}\" konnte nicht gefunden werden, der Standardhintergrund wird angezeigt.",
6
+ "missingdefaulttheme": "Das Standardthema konnte nicht geladen werden.",
6
7
  "missinglayers": "Die folgenden Ebenen können nicht gefunden werden: {0}.",
7
8
  "missingpermalink": "Der Permalink oder das Lesezeichen ist ungültig oder abgelaufen.",
8
9
  "missingprojection": "Das Thema \"{0}\" konnte nicht geladen werden: die Projektion {1} ist nicht definiert.",
@@ -518,6 +519,7 @@
518
519
  },
519
520
  "routing": {
520
521
  "add": "Hinzufügen",
522
+ "addlayer": "Als Ebene exportieren",
521
523
  "addviapoint": "Über hier",
522
524
  "arriveat": "Ankunft bis",
523
525
  "clear": "Zurücksetzen",
@@ -3,6 +3,7 @@
3
3
  "messages": {
4
4
  "app": {
5
5
  "missingbg": "Unable to find the background \"{0}\", displaying the default background.",
6
+ "missingdefaulttheme": "Unable to load the default theme.",
6
7
  "missinglayers": "Unable to find the following layers: {0}.",
7
8
  "missingpermalink": "The specified permalink or bookmark is invalid or expired.",
8
9
  "missingprojection": "Unable to load the theme \"{0}\": the projection {1} is not defined.",
@@ -518,6 +519,7 @@
518
519
  },
519
520
  "routing": {
520
521
  "add": "Add point",
522
+ "addlayer": "Export as layer",
521
523
  "addviapoint": "Via here",
522
524
  "arriveat": "Arrive at",
523
525
  "clear": "Clear",
@@ -3,6 +3,7 @@
3
3
  "messages": {
4
4
  "app": {
5
5
  "missingbg": "No se pudo encontrar el fondo \"{0}\", mostrando el fondo predeterminado.",
6
+ "missingdefaulttheme": "",
6
7
  "missinglayers": "No se pudieron encontrar las siguientes capas: {0}.",
7
8
  "missingpermalink": "El enlace permanente o marcador especificado es inválido o ha expirado.",
8
9
  "missingprojection": "No se pudo cargar el tema \"{0}\": la proyección {1} no está definida.",
@@ -518,6 +519,7 @@
518
519
  },
519
520
  "routing": {
520
521
  "add": "Añadir punto",
522
+ "addlayer": "",
521
523
  "addviapoint": "Pasar por aquí",
522
524
  "arriveat": "Llegar a",
523
525
  "clear": "Limpiar",
@@ -3,6 +3,7 @@
3
3
  "messages": {
4
4
  "app": {
5
5
  "missingbg": "",
6
+ "missingdefaulttheme": "",
6
7
  "missinglayers": "",
7
8
  "missingpermalink": "",
8
9
  "missingprojection": "",
@@ -518,6 +519,7 @@
518
519
  },
519
520
  "routing": {
520
521
  "add": "",
522
+ "addlayer": "",
521
523
  "addviapoint": "",
522
524
  "arriveat": "",
523
525
  "clear": "",
@@ -3,6 +3,7 @@
3
3
  "messages": {
4
4
  "app": {
5
5
  "missingbg": "Impossible de trouver le fond \"{0}\", affichage du fond par défaut.",
6
+ "missingdefaulttheme": "Le thème par défaut n'a pas pu être chargé.",
6
7
  "missinglayers": "Impossible de trouver les couches suivantes: {0}.",
7
8
  "missingpermalink": "Le permalien ou le signet n'est pas valide ou a expiré.",
8
9
  "missingprojection": "Impossible de charger le thème \"{0}\": la projection {1} n'est pas définie.",
@@ -518,6 +519,7 @@
518
519
  },
519
520
  "routing": {
520
521
  "add": "Ajouter",
522
+ "addlayer": "Exporter en couche",
521
523
  "addviapoint": "Par ici",
522
524
  "arriveat": "Arriver à",
523
525
  "clear": "Réinitialiser",
@@ -3,6 +3,7 @@
3
3
  "messages": {
4
4
  "app": {
5
5
  "missingbg": "",
6
+ "missingdefaulttheme": "",
6
7
  "missinglayers": "",
7
8
  "missingpermalink": "",
8
9
  "missingprojection": "",
@@ -518,6 +519,7 @@
518
519
  },
519
520
  "routing": {
520
521
  "add": "",
522
+ "addlayer": "",
521
523
  "addviapoint": "",
522
524
  "arriveat": "",
523
525
  "clear": "",
@@ -3,6 +3,7 @@
3
3
  "messages": {
4
4
  "app": {
5
5
  "missingbg": "Impossibile trovare lo sfondo \"{0}\", viene visualizzato lo sfondo predefinito.",
6
+ "missingdefaulttheme": "",
6
7
  "missinglayers": "Impossibile trovare i seguenti livelli: {0}.",
7
8
  "missingpermalink": "Il permalink o il segnalibro non è valido o è scaduto.",
8
9
  "missingprojection": "Impossibile caricare il tema \"{0}\": la proiezione {1} non è definita.",
@@ -518,6 +519,7 @@
518
519
  },
519
520
  "routing": {
520
521
  "add": "Aggiungi",
522
+ "addlayer": "Esporta a livello",
521
523
  "addviapoint": "Via qui",
522
524
  "arriveat": "Arrivo il",
523
525
  "clear": "Azzera",
@@ -3,6 +3,7 @@
3
3
  "messages": {
4
4
  "app": {
5
5
  "missingbg": "背景が見付かりません \"{0}\", デフォルトの背景を表示します。",
6
+ "missingdefaulttheme": "",
6
7
  "missinglayers": "以下のレイヤが見付かりません: {0}。",
7
8
  "missingpermalink": "指定された永続リンクは無効または期限切れです。",
8
9
  "missingprojection": "テーマをロード出来ません \"{0}\": 投影法 {1} は定義されていません。",
@@ -518,6 +519,7 @@
518
519
  },
519
520
  "routing": {
520
521
  "add": "点を追加",
522
+ "addlayer": "",
521
523
  "addviapoint": "ここを経由",
522
524
  "arriveat": "目的地点",
523
525
  "clear": "クリア",
@@ -3,6 +3,7 @@
3
3
  "messages": {
4
4
  "app": {
5
5
  "missingbg": "Kan de achtergrond \"{0}\" niet vinden, Standaard achtergrond wordt weergegeven.",
6
+ "missingdefaulttheme": "",
6
7
  "missinglayers": "Kan de volgende lagen niet vinden: {0}.",
7
8
  "missingpermalink": "De opgegeven permalink of bladwijzer is ongeldig of verlopen.",
8
9
  "missingprojection": "Kan de kaart \"{0}\": de projectie {1} is niet gedefinieerd.",
@@ -518,6 +519,7 @@
518
519
  },
519
520
  "routing": {
520
521
  "add": "Punt toevoegen",
522
+ "addlayer": "",
521
523
  "addviapoint": "Via hier",
522
524
  "arriveat": "Aankomen om",
523
525
  "clear": "Wissen",
@@ -3,6 +3,7 @@
3
3
  "messages": {
4
4
  "app": {
5
5
  "missingbg": "",
6
+ "missingdefaulttheme": "",
6
7
  "missinglayers": "",
7
8
  "missingpermalink": "",
8
9
  "missingprojection": "",
@@ -518,6 +519,7 @@
518
519
  },
519
520
  "routing": {
520
521
  "add": "",
522
+ "addlayer": "",
521
523
  "addviapoint": "",
522
524
  "arriveat": "",
523
525
  "clear": "",
@@ -3,6 +3,7 @@
3
3
  "messages": {
4
4
  "app": {
5
5
  "missingbg": "",
6
+ "missingdefaulttheme": "",
6
7
  "missinglayers": "",
7
8
  "missingpermalink": "",
8
9
  "missingprojection": "",
@@ -518,6 +519,7 @@
518
519
  },
519
520
  "routing": {
520
521
  "add": "",
522
+ "addlayer": "",
521
523
  "addviapoint": "",
522
524
  "arriveat": "",
523
525
  "clear": "",
@@ -3,6 +3,7 @@
3
3
  "messages": {
4
4
  "app": {
5
5
  "missingbg": "Faltando fundo",
6
+ "missingdefaulttheme": "",
6
7
  "missinglayers": "Faltando camadas",
7
8
  "missingpermalink": "Faltando link permanente",
8
9
  "missingprojection": "",
@@ -518,6 +519,7 @@
518
519
  },
519
520
  "routing": {
520
521
  "add": "Adcionar",
522
+ "addlayer": "",
521
523
  "addviapoint": "Adicionar ponto de via",
522
524
  "arriveat": "Chegada",
523
525
  "clear": "Limpar",
@@ -3,6 +3,7 @@
3
3
  "messages": {
4
4
  "app": {
5
5
  "missingbg": "Fundo em falta",
6
+ "missingdefaulttheme": "",
6
7
  "missinglayers": "Camadas em falta",
7
8
  "missingpermalink": "Permalink em falta",
8
9
  "missingprojection": "",
@@ -518,6 +519,7 @@
518
519
  },
519
520
  "routing": {
520
521
  "add": "Adicionar",
522
+ "addlayer": "",
521
523
  "addviapoint": "Adicionar ponto de passagem",
522
524
  "arriveat": "Chegar a",
523
525
  "clear": "Limpar",
@@ -3,6 +3,7 @@
3
3
  "messages": {
4
4
  "app": {
5
5
  "missingbg": "",
6
+ "missingdefaulttheme": "",
6
7
  "missinglayers": "",
7
8
  "missingpermalink": "",
8
9
  "missingprojection": "",
@@ -518,6 +519,7 @@
518
519
  },
519
520
  "routing": {
520
521
  "add": "Adaugă punct",
522
+ "addlayer": "",
521
523
  "addviapoint": "Punct intermediar",
522
524
  "arriveat": "Punct de sosire",
523
525
  "clear": "Curățare",
@@ -3,6 +3,7 @@
3
3
  "messages": {
4
4
  "app": {
5
5
  "missingbg": "",
6
+ "missingdefaulttheme": "",
6
7
  "missinglayers": "",
7
8
  "missingpermalink": "",
8
9
  "missingprojection": "",
@@ -518,6 +519,7 @@
518
519
  },
519
520
  "routing": {
520
521
  "add": "",
522
+ "addlayer": "",
521
523
  "addviapoint": "",
522
524
  "arriveat": "",
523
525
  "clear": "",
@@ -3,6 +3,7 @@
3
3
  "messages": {
4
4
  "app": {
5
5
  "missingbg": "",
6
+ "missingdefaulttheme": "",
6
7
  "missinglayers": "",
7
8
  "missingpermalink": "",
8
9
  "missingprojection": "",
@@ -518,6 +519,7 @@
518
519
  },
519
520
  "routing": {
520
521
  "add": "",
522
+ "addlayer": "",
521
523
  "addviapoint": "",
522
524
  "arriveat": "",
523
525
  "clear": "",
@@ -3,6 +3,7 @@
3
3
  "messages": {
4
4
  "app": {
5
5
  "missingbg": "Arkaplan bulunamadı \"{0}\", varsayılan arkaplan gösteriliyor.",
6
+ "missingdefaulttheme": "",
6
7
  "missinglayers": "Bu katmanlar bulunamıyor: {0}.",
7
8
  "missingpermalink": "Belirtilen yer işareti ya da bağlantı geçerli değil.",
8
9
  "missingprojection": "Tema yüklenemedi \"{0}\": projeksiyon {1} tanımlı değil.",
@@ -518,6 +519,7 @@
518
519
  },
519
520
  "routing": {
520
521
  "add": "Nokta ekle",
522
+ "addlayer": "",
521
523
  "addviapoint": "Burası üzerinden",
522
524
  "arriveat": "Varış noktası",
523
525
  "clear": "Temizle",
@@ -61,6 +61,7 @@
61
61
  ],
62
62
  "strings": [
63
63
  "app.missingbg",
64
+ "app.missingdefaulttheme",
64
65
  "app.missinglayers",
65
66
  "app.missingpermalink",
66
67
  "app.missingprojection",
@@ -446,6 +447,7 @@
446
447
  "reports.region",
447
448
  "reports.selectlayer",
448
449
  "routing.add",
450
+ "routing.addlayer",
449
451
  "routing.addviapoint",
450
452
  "routing.arriveat",
451
453
  "routing.clear",
@@ -3,6 +3,7 @@
3
3
  "messages": {
4
4
  "app": {
5
5
  "missingbg": "",
6
+ "missingdefaulttheme": "",
6
7
  "missinglayers": "",
7
8
  "missingpermalink": "",
8
9
  "missingprojection": "",
@@ -518,6 +519,7 @@
518
519
  },
519
520
  "routing": {
520
521
  "add": "",
522
+ "addlayer": "",
521
523
  "addviapoint": "",
522
524
  "arriveat": "",
523
525
  "clear": "",
@@ -9,4 +9,4 @@ function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof
9
9
  console.warn("Could not find background layer "+entry.name)}};for(_iterator.s();!(_step=_iterator.n()).done;){if(_loop())continue}}catch(err){_iterator.e(err)}finally{_iterator.f()}if(visibleIdx>=0){bgLayers[visibleIdx].visibility=true}else if(defaultVisibleIdx>=0&&visibleLayer!==""){bgLayers[defaultVisibleIdx].visibility=true}return bgLayers},createThemeLayer:function createThemeLayer(theme,themes){var role=arguments.length>2&&arguments[2]!==undefined?arguments[2]:LayerRole.THEME;var subLayers=arguments.length>3&&arguments[3]!==undefined?arguments[3]:null;var urlParts=url.parse(theme.url,true);// Resolve relative urls
10
10
  if(!urlParts.host){var locationParts=url.parse(window.location.href);urlParts.protocol=locationParts.protocol;urlParts.host=locationParts.host}var sublayerNames=LayerUtils.getSublayerNames({sublayers:subLayers!==null&&subLayers!==void 0?subLayers:theme.sublayers});var baseParams=urlParts.query;var layer={type:"wms",id:theme.id,url:url.format(urlParts),version:theme.version||themes.defaultWMSVersion||"1.3.0",visibility:true,expanded:theme.expanded,name:theme.name,title:theme.title,bbox:theme.bbox,sublayers:subLayers!==null&&subLayers!==void 0?subLayers:theme.sublayers,tiled:theme.tiled,tileSize:theme.tileSize,ratio:!theme.tiled?1:undefined,serverType:"qgis",format:theme.format,rev:+new Date,role:role,attribution:theme.attribution,legendUrl:ThemeUtils.inheritBaseUrlParams(theme.legendUrl,theme.url,baseParams),printUrl:ThemeUtils.inheritBaseUrlParams(theme.printUrl,theme.url,baseParams),featureInfoUrl:ThemeUtils.inheritBaseUrlParams(theme.featureInfoUrl,theme.url,baseParams),infoFormats:theme.infoFormats,mapFormats:theme.availableFormats,layerTreeHiddenSublayers:theme.layerTreeHiddenSublayers,predefinedFilters:(theme.predefinedFilters||[]).filter(function(entry){return Object.keys(entry.filter).find(function(name){return sublayerNames.includes(name)})}),externalLayerMap:_objectSpread(_objectSpread({},theme.externalLayerMap),(theme.externalLayers||[]).reduce(function(res,cur){res[cur.internalLayer]=_objectSpread({},themes.externalLayers.find(function(entry){return entry.name===cur.name}));LayerUtils.completeExternalLayer(res[cur.internalLayer],LayerUtils.searchSubLayer(theme,"name",cur.internalLayer));return res},{})),translations:theme.translations};layer=LayerUtils.recomputeLayerBBox(layer);// Drawing order only makes sense if layer reordering is disabled
11
11
  if(ConfigUtils.getConfigProp("allowReorderingLayers",theme)!==true){layer.drawingOrder=theme.drawingOrder}return layer},inheritBaseUrlParams:function inheritBaseUrlParams(capabilityUrl,baseUrl,baseParams){if(!capabilityUrl){return baseUrl}if(capabilityUrl.split("?")[0]===baseUrl.split("?")[0]){var parts=url.parse(capabilityUrl,true);parts.query=_objectSpread(_objectSpread({},baseParams),parts.query);return url.format(parts)}return capabilityUrl},searchThemes:function searchThemes(themes,searchtext){var filter=new RegExp(removeDiacritics(searchtext).replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&"),"i");var matches=[];var _searchThemeGroup=function searchThemeGroup(themeGroup){(themeGroup.subdirs||[]).forEach(function(subdir){return _searchThemeGroup(subdir,filter)});matches.push.apply(matches,_toConsumableArray((themeGroup.items||[]).filter(function(item){return removeDiacritics(item.title).match(filter)||removeDiacritics(item.keywords||"").match(filter)||removeDiacritics(item["abstract"]||"").match(filter)})))};_searchThemeGroup(themes,filter);return isEmpty(matches)?[]:[{id:"themes",titlemsgid:"search.themes",type:SearchResultType.THEME,items:matches.map(function(theme){return{id:theme.id,text:theme.title,theme:theme,layer:ThemeUtils.createThemeLayer(theme,themes),thumbnail:ConfigUtils.getAssetsPath()+"/"+theme.thumbnail}})}]},searchThemeLayers:function searchThemeLayers(themes,searchtext){var filter=new RegExp(removeDiacritics(searchtext).replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&"),"i");var matches=[];var _searchLayer=function searchLayer(theme,layer){var path=arguments.length>2&&arguments[2]!==undefined?arguments[2]:[];(layer.sublayers||[]).forEach(function(sublayer,idx){var subpath=[].concat(_toConsumableArray(path),[idx]);if(removeDiacritics(sublayer.name).match(filter)||removeDiacritics(sublayer.title).match(filter)){// Clone theme, ensuring path to layer is visible
12
- var newtheme=_objectSpread({},theme);var cur=newtheme;var _loop2=function _loop2(i){var isMutuallyExclusive=cur.mutuallyExclusive;cur.sublayers=cur.sublayers.map(function(entry,j){return _objectSpread(_objectSpread({},entry),{},{visibility:j===subpath[i]||entry.visibility&&!isMutuallyExclusive})});cur=cur.sublayers[subpath[i]]};for(var i=0;i<subpath.length;++i){_loop2(i)}matches.push({theme:newtheme,layer:ThemeUtils.createThemeLayer(newtheme,themes,LayerRole.USERLAYER,[cur])})}_searchLayer(theme,sublayer,subpath)})};var _searchThemeGroup2=function searchThemeGroup(themeGroup){(themeGroup.subdirs||[]).forEach(function(subdir){return _searchThemeGroup2(subdir,filter)});(themeGroup.items||[]).forEach(function(item){return _searchLayer(item,item)})};_searchThemeGroup2(themes,filter);return isEmpty(matches)?[]:[{id:"themelayers",titlemsgid:"search.themelayers",type:SearchResultType.THEMELAYER,items:matches.map(function(result){return{id:result.layer.id+":"+result.layer.sublayers[0].name,text:result.layer.title+": "+result.layer.sublayers[0].title,layer:result.layer,theme:result.theme}})}]},getThemeNames:function getThemeNames(themes){var names=(themes.items||[]).reduce(function(res,theme){return _objectSpread(_objectSpread({},res),{},_defineProperty({},theme.id,theme.title))},{});(themes.subdirs||[]).forEach(function(group){Object.assign(names,ThemeUtils.getThemeNames(group))});return names},themeFlagsAllowed:function themeFlagsAllowed(theme,flagWhitelist,flagBlacklist){var themeFlags=(theme===null||theme===void 0?void 0:theme.flags)||[];if(flagBlacklist&&flagBlacklist.find(function(flag){return themeFlags.includes(flag)})!==undefined){return false}if(flagWhitelist&&flagWhitelist.find(function(flag){return themeFlags.includes(flag)})===undefined){return false}return true},allowedItems:function allowedItems(items,theme){var filter=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;return(items||[]).map(function(item){if(item.subitems){var subitems=ThemeUtils.allowedItems(item.subitems,items,filter).filter(Boolean);if(!isEmpty(subitems)){return _objectSpread(_objectSpread({},item),{},{subitems:subitems})}else{return null}}else{if(filter&&!filter(item)){return null}if(theme){if(!ThemeUtils.themeFlagsAllowed(theme,item.themeFlagWhitelist,item.themeFlagBlacklist)){return null}if(item.themeBlacklist&&(item.themeBlacklist.includes(theme.title)||item.themeBlacklist.includes(theme.name))){return null}if(item.themeWhitelist&&!(item.themeWhitelist.includes(theme.title)||item.themeWhitelist.includes(theme.name))){return null}if(item.requireAuth&&!ConfigUtils.getConfigProp("username")){return null}}return item}}).filter(Boolean)},applyTranslations:function applyTranslations(group){return _objectSpread(_objectSpread({},group),{},{subdirs:group.subdirs?group.subdirs.map(ThemeUtils.applyTranslations):null,items:group.items?group.items.map(function(item){var _item$translations$th,_item$translations;return _objectSpread(_objectSpread({},LayerUtils.applyTranslations(item,item.translations)),{},{title:(_item$translations$th=(_item$translations=item.translations)===null||_item$translations===void 0||(_item$translations=_item$translations.theme)===null||_item$translations===void 0?void 0:_item$translations.title)!==null&&_item$translations$th!==void 0?_item$translations$th:item.title})}):null})}};export default ThemeUtils;
12
+ var newtheme=_objectSpread({},theme);var cur=newtheme;var _loop2=function _loop2(i){var isMutuallyExclusive=cur.mutuallyExclusive;cur.sublayers=cur.sublayers.map(function(entry,j){return _objectSpread(_objectSpread({},entry),{},{visibility:j===subpath[i]||entry.visibility&&!isMutuallyExclusive})});cur=cur.sublayers[subpath[i]]};for(var i=0;i<subpath.length;++i){_loop2(i)}matches.push({theme:newtheme,layer:ThemeUtils.createThemeLayer(newtheme,themes,LayerRole.USERLAYER,[cur])})}_searchLayer(theme,sublayer,subpath)})};var _searchThemeGroup2=function searchThemeGroup(themeGroup){(themeGroup.subdirs||[]).forEach(function(subdir){return _searchThemeGroup2(subdir,filter)});(themeGroup.items||[]).forEach(function(item){return _searchLayer(item,item)})};_searchThemeGroup2(themes,filter);return isEmpty(matches)?[]:[{id:"themelayers",titlemsgid:"search.themelayers",type:SearchResultType.THEMELAYER,items:matches.map(function(result){return{id:result.layer.id+":"+result.layer.sublayers[0].name,text:result.layer.title+": "+result.layer.sublayers[0].title,layer:result.layer,theme:result.theme}})}]},getThemeNames:function getThemeNames(themes){var names=(themes.items||[]).reduce(function(res,theme){return _objectSpread(_objectSpread({},res),{},_defineProperty({},theme.id,theme.title))},{});(themes.subdirs||[]).forEach(function(group){Object.assign(names,ThemeUtils.getThemeNames(group))});return names},themeFlagsAllowed:function themeFlagsAllowed(theme,flagWhitelist,flagBlacklist){var themeFlags=(theme===null||theme===void 0?void 0:theme.flags)||[];if(flagBlacklist&&flagBlacklist.find(function(flag){return themeFlags.includes(flag)})!==undefined){return false}if(flagWhitelist&&flagWhitelist.find(function(flag){return themeFlags.includes(flag)})===undefined){return false}return true},allowedItems:function allowedItems(items,theme){var filter=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;return(items||[]).map(function(item){if(item.subitems){var subitems=ThemeUtils.allowedItems(item.subitems,theme,filter).filter(Boolean);if(!isEmpty(subitems)){return _objectSpread(_objectSpread({},item),{},{subitems:subitems})}else{return null}}else{if(filter&&!filter(item)){return null}if(theme){if(!ThemeUtils.themeFlagsAllowed(theme,item.themeFlagWhitelist,item.themeFlagBlacklist)){return null}if(item.themeBlacklist&&(item.themeBlacklist.includes(theme.title)||item.themeBlacklist.includes(theme.name))){return null}if(item.themeWhitelist&&!(item.themeWhitelist.includes(theme.title)||item.themeWhitelist.includes(theme.name))){return null}if(item.requireAuth&&!ConfigUtils.getConfigProp("username")){return null}}return item}}).filter(Boolean)},applyTranslations:function applyTranslations(group){return _objectSpread(_objectSpread({},group),{},{subdirs:group.subdirs?group.subdirs.map(ThemeUtils.applyTranslations):null,items:group.items?group.items.map(function(item){var _item$translations$th,_item$translations;return _objectSpread(_objectSpread({},LayerUtils.applyTranslations(item,item.translations)),{},{title:(_item$translations$th=(_item$translations=item.translations)===null||_item$translations===void 0||(_item$translations=_item$translations.theme)===null||_item$translations===void 0?void 0:_item$translations.title)!==null&&_item$translations$th!==void 0?_item$translations$th:item.title})}):null})}};export default ThemeUtils;