qwc2 2025.8.25 → 2025.8.26

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.
@@ -37,7 +37,7 @@ var maxPixelX=Math.round((dtmExt[2]-tiepointX)/scaleX)+1;var width=maxPixelX-min
37
37
  elevationResult.samples.sort(function(a,b){return a.resolution-b.resolution});return(_elevationResult$samp=elevationResult.samples[0])===null||_elevationResult$samp===void 0?void 0:_elevationResult$samp.elevation});_defineProperty(_this2,"getSceneIntersection",function(x,y){var objects=arguments.length>2&&arguments[2]!==undefined?arguments[2]:true;var raycaster=new Raycaster;var camera=_this2.instance.view.camera;raycaster.setFromCamera(new Vector2(x,y),camera);// Query object intersection
38
38
  var objInter=objects?raycaster.intersectObjects(_this2.state.sceneContext.collisionObjects,true)[0]:undefined;// Query highest resolution terrain tile (i.e. tile with no children)
39
39
  var terrInter=raycaster.intersectObjects([_this2.map.object3d]).filter(function(result){return result.object.children.length===0})[0];// Return closest result
40
- if(objInter&&terrInter){return objInter.distance<terrInter.distance?objInter:terrInter}return objInter!==null&&objInter!==void 0?objInter:terrInter});_defineProperty(_this2,"getSetting",function(key){return _this2.state.sceneContext.settings[key]});_defineProperty(_this2,"setSetting",function(key,value){_this2.setState(function(state){return{sceneContext:_objectSpread(_objectSpread({},state.sceneContext),{},{settings:_objectSpread(_objectSpread({},state.sceneContext.settings),{},_defineProperty({},key,value))})}})});_defineProperty(_this2,"redrawScene",function(ev){var width=ev.target.innerWidth;var height=ev.target.innerHeight;_this2.instance.renderer.setSize(width,height);_this2.instance.view.camera.aspect=width/height;_this2.instance.view.camera.updateProjectionMatrix();_this2.instance.renderer.render(_this2.instance.scene,_this2.instance.view.camera)});_defineProperty(_this2,"setViewToExtent",function(bounds,rotation){_this2.state.sceneContext.setViewToExtent(bounds,rotation)});_defineProperty(_this2,"store3dState",function(){var promises=Object.entries(_this2.state.sceneContext.sceneObjects).map(function(_ref20){var _ref21=_slicedToArray(_ref20,2),objectId=_ref21[0],entry=_ref21[1];if(!entry.layertree){return null}return new Promise(function(resolve){var object=_this2.state.sceneContext.getSceneObject(objectId);if(entry.drawGroup){var exporter=new GLTFExporter;exporter.parse(object,function(result){resolve({id:objectId,options:entry,data:result})})}else if(entry.imported&&object.tiles){var container=object.tiles.group.parent;var tileset={matrix:container.matrix.elements,label:container.userData.label,url:object.tiles.rootURL};resolve({id:objectId,options:entry,tileset:tileset})}else{resolve({id:objectId,options:entry})}})}).filter(Boolean);return new Promise(function(resolve){Promise.all(promises).then(function(objects){var _this2$state$sceneCon2,_this2$state$sceneCon3;var camera=_this2.state.sceneContext.scene.view.camera.position;var target=_this2.state.sceneContext.scene.view.controls.target;var layers=Object.entries(_this2.state.sceneContext.colorLayers).map(function(_ref22){var _ref23=_slicedToArray(_ref22,2),layerId=_ref23[0],options=_ref23[1];return{id:layerId,options:{visibility:options.visibility,opacity:options.opacity,extrusionHeight:options.extrusionHeight}}});resolve({objects:objects,colorLayers:layers,baseLayer:((_this2$state$sceneCon2=_this2.state.sceneContext.baseLayers.find(function(layer){return layer.visibility===true}))===null||_this2$state$sceneCon2===void 0?void 0:_this2$state$sceneCon2.name)||"",personHeight:(_this2$state$sceneCon3=_this2.state.sceneContext.scene.view.controls.personHeight)!==null&&_this2$state$sceneCon3!==void 0?_this2$state$sceneCon3:0,camera:[camera.x,camera.y,camera.z],target:[target.x,target.y,target.z]})})})});_defineProperty(_this2,"restore3dState",function(data){if(isEmpty(data)){return}(data.objects||[]).forEach(function(item){if(item.data){var loader=new GLTFLoader;loader.parse(item.data,ConfigUtils.getAssetsPath(),function(gltf){gltf.scene.traverse(function(c){if(c.isMesh){c.castShadow=true;c.receiveShadow=true}updateObjectLabel(c,_this2.state.sceneContext)});_this2.state.sceneContext.addSceneObject(item.id,gltf.scene,item.options)})}else if(item.tileset){_this2.add3dTiles(item.tileset.url,item.id,item.options,false,new Matrix4().fromArray(item.tileset.matrix),item.tileset.label)}else if(item.id in _this2.state.sceneContext.sceneObjects){_this2.state.sceneContext.updateSceneObject(item.id,item.options)}});(data.colorLayers||[]).forEach(function(item){if(item.id in _this2.state.sceneContext.colorLayers){_this2.state.sceneContext.updateColorLayer(item.id,item.options)}});_this2.state.sceneContext.restoreView(data);if(data.baseLayer!==undefined){_this2.setState(function(state){return{sceneContext:_objectSpread(_objectSpread({},state.sceneContext),{},{baseLayers:state.sceneContext.baseLayers.map(function(l){return _objectSpread(_objectSpread({},l),{},{visibility:l.name===data.baseLayer})})})}});UrlParams.updateParams({bl3d:data.baseLayer})}_this2.state.sceneContext.scene.notifyChange()});_this2.container=null;_this2.inspector=null;_this2.instance=null;_this2.map=null;_this2.sceneObjectGroup=null;_this2.objectMap={};_this2.tilesetStyles={};_this2.sceneSettings={};_this2.state.sceneContext.addLayer=_this2.addLayer;_this2.state.sceneContext.getLayer=_this2.getLayer;_this2.state.sceneContext.removeLayer=_this2.removeLayer;_this2.state.sceneContext.updateColorLayer=_this2.updateColorLayer;_this2.state.sceneContext.setBaseLayer=_this2.setBaseLayer;_this2.state.sceneContext.add3dTiles=_this2.add3dTiles;_this2.state.sceneContext.addSceneObject=_this2.addSceneObject;_this2.state.sceneContext.getSceneObject=_this2.getSceneObject;_this2.state.sceneContext.removeSceneObject=_this2.removeSceneObject;_this2.state.sceneContext.updateSceneObject=_this2.updateSceneObject;_this2.state.sceneContext.zoomToObject=_this2.zoomToObject;_this2.state.sceneContext.getMap=_this2.getMap;_this2.state.sceneContext.getTerrainHeightFromDTM=_this2.getTerrainHeightFromDTM;_this2.state.sceneContext.getTerrainHeightFromMap=_this2.getTerrainHeightFromMap;_this2.state.sceneContext.getSceneIntersection=_this2.getSceneIntersection;_this2.state.sceneContext.getSetting=_this2.getSetting;_this2.state.sceneContext.setSetting=_this2.setSetting;registerPermalinkDataStoreHook("map3d",_this2.store3dState);return _this2}_inherits(Map3D,_React$Component2);return _createClass(Map3D,[{key:"componentDidMount",value:function componentDidMount(){this.props.innerRef(this)}},{key:"componentWillUnmount",value:function componentWillUnmount(){unregisterPermalinkDataStoreHook("map3d")}},{key:"componentDidUpdate",value:function componentDidUpdate(prevProps,prevState){var _this3=this;if(this.props.theme!==prevProps.theme){this.setupInstance()}else if(this.props.layers!==prevProps.layers){this.setState(function(state){return{sceneContext:_objectSpread(_objectSpread({},state.sceneContext),{},{colorLayers:_this3.collectColorLayers(state.sceneContext.colorLayers)})}})}// Update map layers
40
+ if(objInter&&terrInter){return objInter.distance<terrInter.distance?objInter:terrInter}return objInter!==null&&objInter!==void 0?objInter:terrInter});_defineProperty(_this2,"getSetting",function(key){return _this2.state.sceneContext.settings[key]});_defineProperty(_this2,"setSetting",function(key,value){_this2.setState(function(state){return{sceneContext:_objectSpread(_objectSpread({},state.sceneContext),{},{settings:_objectSpread(_objectSpread({},state.sceneContext.settings),{},_defineProperty({},key,value))})}})});_defineProperty(_this2,"redrawScene",function(ev){var width=ev.target.innerWidth;var height=ev.target.innerHeight;_this2.instance.renderer.setSize(width,height);_this2.instance.view.camera.aspect=width/height;_this2.instance.view.camera.updateProjectionMatrix();_this2.instance.renderer.render(_this2.instance.scene,_this2.instance.view.camera)});_defineProperty(_this2,"setViewToExtent",function(bounds,rotation){_this2.state.sceneContext.setViewToExtent(bounds,rotation)});_defineProperty(_this2,"store3dState",function(){var promises=Object.entries(_this2.state.sceneContext.sceneObjects).map(function(_ref20){var _ref21=_slicedToArray(_ref20,2),objectId=_ref21[0],entry=_ref21[1];if(!entry.layertree){return null}return new Promise(function(resolve){var object=_this2.state.sceneContext.getSceneObject(objectId);if(entry.drawGroup){var exporter=new GLTFExporter;exporter.parse(object,function(result){resolve({id:objectId,options:entry,data:result})})}else if(entry.imported&&object.tiles){var container=object.tiles.group.parent;var tileset={matrix:container.matrix.elements,label:container.userData.label,url:object.tiles.rootURL};resolve({id:objectId,options:entry,tileset:tileset})}else{resolve({id:objectId,options:entry})}})}).filter(Boolean);return new Promise(function(resolve){Promise.all(promises).then(function(objects){var _this2$state$sceneCon2,_this2$state$sceneCon3;var camera=_this2.state.sceneContext.scene.view.camera.position;var target=_this2.state.sceneContext.scene.view.controls.target;var layers=Object.entries(_this2.state.sceneContext.colorLayers).map(function(_ref22){var _ref23=_slicedToArray(_ref22,2),layerId=_ref23[0],options=_ref23[1];return{id:layerId,options:{visibility:options.visibility,opacity:options.opacity,extrusionHeight:options.extrusionHeight}}});resolve({objects:objects,colorLayers:layers,baseLayer:((_this2$state$sceneCon2=_this2.state.sceneContext.baseLayers.find(function(layer){return layer.visibility===true}))===null||_this2$state$sceneCon2===void 0?void 0:_this2$state$sceneCon2.name)||"",personHeight:(_this2$state$sceneCon3=_this2.state.sceneContext.scene.view.controls.personHeight)!==null&&_this2$state$sceneCon3!==void 0?_this2$state$sceneCon3:0,camera:[camera.x,camera.y,camera.z],target:[target.x,target.y,target.z]})})})});_defineProperty(_this2,"restore3dState",function(data){if(isEmpty(data)){return}(data.objects||[]).forEach(function(item){if(item.data){var loader=new GLTFLoader;loader.parse(item.data,ConfigUtils.getAssetsPath(),function(gltf){gltf.scene.traverse(function(c){if(c.isMesh){c.castShadow=true;c.receiveShadow=true}updateObjectLabel(c,_this2.state.sceneContext)});_this2.state.sceneContext.addSceneObject(item.id,gltf.scene,item.options)})}else if(item.tileset){_this2.add3dTiles(item.tileset.url,item.id,item.options,false,new Matrix4().fromArray(item.tileset.matrix),item.tileset.label)}else if(item.id in _this2.state.sceneContext.sceneObjects){_this2.state.sceneContext.updateSceneObject(item.id,item.options)}});(data.colorLayers||[]).forEach(function(item){if(item.id in _this2.state.sceneContext.colorLayers){_this2.state.sceneContext.updateColorLayer(item.id,item.options)}});_this2.state.sceneContext.restoreView(data);if(data.baseLayer!==undefined){_this2.setState(function(state){return{sceneContext:_objectSpread(_objectSpread({},state.sceneContext),{},{baseLayers:state.sceneContext.baseLayers.map(function(l){return _objectSpread(_objectSpread({},l),{},{visibility:l.name===data.baseLayer})})})}});UrlParams.updateParams({bl3d:data.baseLayer})}_this2.state.sceneContext.scene.notifyChange()});_this2.container=null;_this2.inspector=null;_this2.instance=null;_this2.map=null;_this2.sceneObjectGroup=null;_this2.objectMap={};_this2.tilesetStyles={};_this2.state.sceneContext.addLayer=_this2.addLayer;_this2.state.sceneContext.getLayer=_this2.getLayer;_this2.state.sceneContext.removeLayer=_this2.removeLayer;_this2.state.sceneContext.updateColorLayer=_this2.updateColorLayer;_this2.state.sceneContext.setBaseLayer=_this2.setBaseLayer;_this2.state.sceneContext.add3dTiles=_this2.add3dTiles;_this2.state.sceneContext.addSceneObject=_this2.addSceneObject;_this2.state.sceneContext.getSceneObject=_this2.getSceneObject;_this2.state.sceneContext.removeSceneObject=_this2.removeSceneObject;_this2.state.sceneContext.updateSceneObject=_this2.updateSceneObject;_this2.state.sceneContext.zoomToObject=_this2.zoomToObject;_this2.state.sceneContext.getMap=_this2.getMap;_this2.state.sceneContext.getTerrainHeightFromDTM=_this2.getTerrainHeightFromDTM;_this2.state.sceneContext.getTerrainHeightFromMap=_this2.getTerrainHeightFromMap;_this2.state.sceneContext.getSceneIntersection=_this2.getSceneIntersection;_this2.state.sceneContext.getSetting=_this2.getSetting;_this2.state.sceneContext.setSetting=_this2.setSetting;_this2.state.sceneContext.settings.sceneQuality=props.defaultSceneQuality;registerPermalinkDataStoreHook("map3d",_this2.store3dState);return _this2}_inherits(Map3D,_React$Component2);return _createClass(Map3D,[{key:"componentDidMount",value:function componentDidMount(){this.props.innerRef(this)}},{key:"componentWillUnmount",value:function componentWillUnmount(){unregisterPermalinkDataStoreHook("map3d")}},{key:"componentDidUpdate",value:function componentDidUpdate(prevProps,prevState){var _this3=this;if(this.props.theme!==prevProps.theme){this.setupInstance()}else if(this.props.layers!==prevProps.layers){this.setState(function(state){return{sceneContext:_objectSpread(_objectSpread({},state.sceneContext),{},{colorLayers:_this3.collectColorLayers(state.sceneContext.colorLayers)})}})}// Update map layers
41
41
  if(this.state.sceneContext.baseLayers!==prevState.sceneContext.baseLayers){this.applyBaseLayer()}if(this.state.sceneContext.colorLayers!==prevState.sceneContext.colorLayers){this.applyColorLayerUpdates(this.state.sceneContext.colorLayers,prevState.sceneContext.colorLayers)}// Update scene objects
42
42
  if(this.state.sceneContext.sceneObjects!==prevState.sceneContext.sceneObjects){this.applySceneObjectUpdates(this.state.sceneContext.sceneObjects,prevState.sceneContext.sceneObjects);// Update collision objects
43
- this.setState(function(state){return{sceneContext:_objectSpread(_objectSpread({},state.sceneContext),{},{collisionObjects:Object.entries(state.sceneContext.sceneObjects).map(function(_ref24){var _ref25=_slicedToArray(_ref24,2),objId=_ref25[0],options=_ref25[1];if(options.layertree&&options.visibility){var _obj$tiles$group,_obj$tiles;var obj=_this3.objectMap[objId];return(_obj$tiles$group=(_obj$tiles=obj.tiles)===null||_obj$tiles===void 0?void 0:_obj$tiles.group)!==null&&_obj$tiles$group!==void 0?_obj$tiles$group:obj}return null}).filter(Boolean)})}})}if(this.state.sceneContext.settings.sceneQuality!==prevState.sceneContext.settings.sceneQuality){var quality=Math.max(20,this.state.sceneContext.settings.sceneQuality);this.map.segments=Math.pow(2,Math.floor(quality/20));this.instance.notifyChange(this.instance.view.camera)}}},{key:"render",value:function render(){var _this4=this;return[/*#__PURE__*/ReactDOM.createPortal(/*#__PURE__*/React.createElement("div",{className:"map3d-map",id:"map3d",key:"Map3D",ref:this.setupContainer}),this.context),this.state.sceneContext.scene?/*#__PURE__*/React.createElement(UnloadWrapper,{key:this.state.sceneId,onUnload:this.onUnload,sceneId:this.state.sceneId},/*#__PURE__*/React.createElement(MapControls3D,{controlsPosition:this.props.controlsPosition,onCameraChanged:this.props.onCameraChanged,onControlsSet:this.setupControls,sceneContext:this.state.sceneContext},/*#__PURE__*/React.createElement(EditDataset3D,{sceneContext:this.state.sceneContext}),/*#__PURE__*/React.createElement(View3DSwitcher,{position:1}),Object.entries(this.props.plugins3d).map(function(_ref26){var _ref27=_slicedToArray(_ref26,2),name=_ref27[0],Component=_ref27[1];return/*#__PURE__*/React.createElement(Suspense,{key:name},/*#__PURE__*/React.createElement(Component,_extends({sceneContext:_this4.state.sceneContext},_this4.props.pluginOptions[name])))}))):null]}}])}(React.Component);_defineProperty(Map3D,"contextType",MapContainerPortalContext);_defineProperty(Map3D,"propTypes",{controlsPosition:PropTypes.string,innerRef:PropTypes.func,layers:PropTypes.array,onCameraChanged:PropTypes.func,onMapInitialized:PropTypes.func,pluginOptions:PropTypes.object,plugins3d:PropTypes.object,setCurrentTask:PropTypes.func,theme:PropTypes.object,themes:PropTypes.object});_defineProperty(Map3D,"defaultProps",{geometry:{initialWidth:600,initialHeight:800,initialX:0,initialY:0,initiallyDocked:true}});_defineProperty(Map3D,"defaultSceneState",{scene:null,map:null,mapCrs:null,dtmUrl:null,dtmCrs:null,baseLayers:[],colorLayers:{},sceneObjects:{},collisionObjects:[],settings:{sceneQuality:100}});export default connect(function(state){return{theme:state.theme.current,themes:state.theme.themes,layers:state.layers.flat}},{setCurrentTask:setCurrentTask})(Map3D);
43
+ this.setState(function(state){return{sceneContext:_objectSpread(_objectSpread({},state.sceneContext),{},{collisionObjects:Object.entries(state.sceneContext.sceneObjects).map(function(_ref24){var _ref25=_slicedToArray(_ref24,2),objId=_ref25[0],options=_ref25[1];if(options.layertree&&options.visibility){var _obj$tiles$group,_obj$tiles;var obj=_this3.objectMap[objId];return(_obj$tiles$group=(_obj$tiles=obj.tiles)===null||_obj$tiles===void 0?void 0:_obj$tiles.group)!==null&&_obj$tiles$group!==void 0?_obj$tiles$group:obj}return null}).filter(Boolean)})}})}if(this.state.sceneContext.settings.sceneQuality!==prevState.sceneContext.settings.sceneQuality){var quality=Math.max(20,this.state.sceneContext.settings.sceneQuality);this.map.segments=Math.pow(2,Math.floor(quality/20));this.instance.notifyChange(this.instance.view.camera)}}},{key:"render",value:function render(){var _this4=this;return[/*#__PURE__*/ReactDOM.createPortal(/*#__PURE__*/React.createElement("div",{className:"map3d-map",id:"map3d",key:"Map3D",ref:this.setupContainer}),this.context),this.state.sceneContext.scene?/*#__PURE__*/React.createElement(UnloadWrapper,{key:this.state.sceneId,onUnload:this.onUnload,sceneId:this.state.sceneId},/*#__PURE__*/React.createElement(MapControls3D,{controlsPosition:this.props.controlsPosition,onCameraChanged:this.props.onCameraChanged,onControlsSet:this.setupControls,sceneContext:this.state.sceneContext},/*#__PURE__*/React.createElement(EditDataset3D,{sceneContext:this.state.sceneContext}),/*#__PURE__*/React.createElement(View3DSwitcher,{position:1}),Object.entries(this.props.plugins3d).map(function(_ref26){var _ref27=_slicedToArray(_ref26,2),name=_ref27[0],Component=_ref27[1];return/*#__PURE__*/React.createElement(Suspense,{key:name},/*#__PURE__*/React.createElement(Component,_extends({sceneContext:_this4.state.sceneContext},_this4.props.pluginOptions[name])))}))):null]}}])}(React.Component);_defineProperty(Map3D,"contextType",MapContainerPortalContext);_defineProperty(Map3D,"propTypes",{controlsPosition:PropTypes.string,defaultSceneQuality:PropTypes.number,innerRef:PropTypes.func,layers:PropTypes.array,onCameraChanged:PropTypes.func,onMapInitialized:PropTypes.func,pluginOptions:PropTypes.object,plugins3d:PropTypes.object,setCurrentTask:PropTypes.func,theme:PropTypes.object,themes:PropTypes.object});_defineProperty(Map3D,"defaultProps",{geometry:{initialWidth:600,initialHeight:800,initialX:0,initialY:0,initiallyDocked:true}});_defineProperty(Map3D,"defaultSceneState",{scene:null,map:null,mapCrs:null,dtmUrl:null,dtmCrs:null,baseLayers:[],colorLayers:{},sceneObjects:{},collisionObjects:[],settings:{sceneQuality:100}});export default connect(function(state){return{theme:state.theme.current,themes:state.theme.themes,layers:state.layers.flat}},{setCurrentTask:setCurrentTask})(Map3D);
@@ -6,4 +6,4 @@ 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 classNames from"classnames";import PropTypes from"prop-types";import Icon from"../Icon";import"./style/NumberInput.css";var NumberInput=/*#__PURE__*/function(_React$Component){function NumberInput(){var _this;_classCallCheck(this,NumberInput);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key]}_this=_callSuper(this,NumberInput,[].concat(args));_defineProperty(_this,"state",{propValue:"",value:"",changed:false,valid:false});_defineProperty(_this,"onChange",function(ev){var len=ev.target.value.length;var value=ev.target.value.substring(_this.props.prefix.length,len-_this.props.suffix.length);_this.setState({value:value,changed:true})});_defineProperty(_this,"currentFloatValue",function(){var floatValue=parseFloat(_this.state.value);return isNaN(floatValue)?null:floatValue});_defineProperty(_this,"startStep",function(delta){if(_this.props.disabled||_this.props.readOnly){return}_this.props.onChange(_this.constrainValue(_this.currentFloatValue()+delta));var stepInterval=null;var stepTimeout=setTimeout(function(){stepInterval=setInterval(function(){_this.props.onChange(_this.constrainValue(_this.currentFloatValue()+delta))},50)},500);document.addEventListener("pointerup",function(){clearTimeout(stepTimeout);clearInterval(stepInterval)},{once:true})});_defineProperty(_this,"onKeyDown",function(ev){if(ev.key==="Enter"){_this.commit()}// Ensure prefix/suffix isn't changed
8
8
  var selStart=ev.target.selectionStart;var selEnd=ev.target.selectionEnd;var len=ev.target.value.length;var startOffset=ev.key==="Backspace"&&selStart===selEnd?1:0;var endOffset=ev.key==="Delete"&&selStart===selEnd?1:0;if(selStart<_this.props.prefix.length+startOffset||selEnd>len-_this.props.suffix.length-endOffset){ev.preventDefault()}});_defineProperty(_this,"commit",function(){if(_this.state.changed){var value=_this.constrainValue(_this.currentFloatValue());_this.setState({value:value===null?"":value.toFixed(_this.props.decimals)});_this.props.onChange(value)}});_defineProperty(_this,"constrainValue",function(value){if(value===null){return null}if(_this.props.min!==undefined){value=Math.max(_this.props.min,value)}if(_this.props.max!==undefined){value=Math.min(_this.props.max,value)}var k=Math.pow(10,_this.props.decimals);return Math.round(value*k)/k});_defineProperty(_this,"setupSelectionListener",function(event){var input=event.target;var selectionHandler=function selectionHandler(ev){if(ev.target===input){// Ensure prefix/suffix isn't selected
9
- var len=input.value.length;var prefixLen=_this.props.prefix.length;var suffixLen=_this.props.suffix.length;var selStart=Math.min(Math.max(input.selectionStart,prefixLen),len-suffixLen);var selEnd=Math.max(Math.min(input.selectionEnd,len-suffixLen),prefixLen);if(selStart!==input.selectionStart||selEnd!==input.selectionEnd){input.setSelectionRange(selStart,selEnd)}}};document.addEventListener("selectionchange",selectionHandler);input.addEventListener("blur",function(){document.removeEventListener("selectionchange",selectionHandler)},{once:true})});return _this}_inherits(NumberInput,_React$Component);return _createClass(NumberInput,[{key:"render",value:function render(){var _this$props$step,_this2=this;var className=classNames({"number-input":true,"number-input-mobile":this.props.mobile,"number-input-normal":!this.props.mobile,"number-input-disabled":this.props.disabled||this.props.readOnly,"number-input-invalid":this.props.required&&!this.state.value});var style={};if(!this.props.fitParent){var paddingLength=(this.props.mobile?4:1.5)+"em";var prefixSuffixLength=this.props.prefix.length+this.props.suffix.length+"ch";var numberLength=2+Math.max((this.props.min||0).toFixed(this.props.decimals).length,(this.props.max||0).toFixed(this.props.decimals).length)+"ch";style.minWidth="calc(".concat(paddingLength," + ").concat(prefixSuffixLength," + ").concat(numberLength,")")}var step=(_this$props$step=this.props.step)!==null&&_this$props$step!==void 0?_this$props$step:Math.pow(10,-this.props.decimals);var plusIcon=this.props.mobile?"plus":"chevron-up";var minusIcon=this.props.mobile?"minus":"chevron-down";return/*#__PURE__*/React.createElement("div",{className:className+" "+this.props.className},/*#__PURE__*/React.createElement("input",{disabled:this.props.disabled,inputMode:"numeric",onBlur:this.commit,onChange:this.onChange,onFocus:this.setupSelectionListener,onKeyDown:this.onKeyDown,placeholder:this.props.placeholder,readOnly:this.props.readOnly,required:this.props.required,style:style,type:"text",value:this.props.prefix+this.state.value+this.props.suffix}),/*#__PURE__*/React.createElement("input",{name:this.props.name,required:this.props.required,type:"hidden",value:this.state.value}),this.props.hideArrows?[/*#__PURE__*/React.createElement(Icon,{icon:plusIcon,key:"ArrowPlus",onPointerDown:function onPointerDown(){return _this2.startStep(+step)}}),/*#__PURE__*/React.createElement(Icon,{icon:minusIcon,key:"ArrowMinus",onPointerDown:function onPointerDown(){return _this2.startStep(-step)}})]:null)}}],[{key:"getDerivedStateFromProps",value:function getDerivedStateFromProps(nextProps,state){if(state.propValue!==nextProps.value){return{propValue:nextProps.value,value:typeof nextProps.value==="number"?nextProps.value.toFixed(nextProps.decimals):"",changed:false}}return null}}])}(React.Component);_defineProperty(NumberInput,"propTypes",{className:PropTypes.string,decimals:PropTypes.number,disabled:PropTypes.bool,fitParent:PropTypes.bool,hideArrows:PropTypes.bool,max:PropTypes.number,min:PropTypes.number,mobile:PropTypes.bool,name:PropTypes.string,onChange:PropTypes.func,placeholder:PropTypes.string,prefix:PropTypes.string,readOnly:PropTypes.bool,required:PropTypes.bool,step:PropTypes.number,style:PropTypes.object,suffix:PropTypes.string,value:PropTypes.number});_defineProperty(NumberInput,"defaultProps",{className:"",decimals:0,mobile:false,prefix:"",suffix:""});export{NumberInput as default};
9
+ var len=input.value.length;var prefixLen=_this.props.prefix.length;var suffixLen=_this.props.suffix.length;var selStart=Math.min(Math.max(input.selectionStart,prefixLen),len-suffixLen);var selEnd=Math.max(Math.min(input.selectionEnd,len-suffixLen),prefixLen);if(selStart!==input.selectionStart||selEnd!==input.selectionEnd){input.setSelectionRange(selStart,selEnd)}}};document.addEventListener("selectionchange",selectionHandler);input.addEventListener("blur",function(){document.removeEventListener("selectionchange",selectionHandler)},{once:true})});return _this}_inherits(NumberInput,_React$Component);return _createClass(NumberInput,[{key:"render",value:function render(){var _this$props$step,_this2=this;var className=classNames({"number-input":true,"number-input-mobile":this.props.mobile&&!this.props.hideArrows,"number-input-normal":!this.props.mobile&&!this.props.hideArrows,"number-input-noarrows":this.props.hideArrows,"number-input-disabled":this.props.disabled||this.props.readOnly,"number-input-invalid":this.props.required&&!this.state.value});var style={};if(!this.props.fitParent){var paddingLength=(this.props.mobile?4:1.5)+"em";var prefixSuffixLength=this.props.prefix.length+this.props.suffix.length+"ch";var numberLength=2+Math.max((this.props.min||0).toFixed(this.props.decimals).length,(this.props.max||0).toFixed(this.props.decimals).length)+"ch";style.minWidth="calc(".concat(paddingLength," + ").concat(prefixSuffixLength," + ").concat(numberLength,")")}var step=(_this$props$step=this.props.step)!==null&&_this$props$step!==void 0?_this$props$step:Math.pow(10,-this.props.decimals);var plusIcon=this.props.mobile?"plus":"chevron-up";var minusIcon=this.props.mobile?"minus":"chevron-down";return/*#__PURE__*/React.createElement("div",{className:className+" "+this.props.className},/*#__PURE__*/React.createElement("input",{disabled:this.props.disabled,inputMode:"numeric",onBlur:this.commit,onChange:this.onChange,onFocus:this.setupSelectionListener,onKeyDown:this.onKeyDown,placeholder:this.props.placeholder,readOnly:this.props.readOnly,required:this.props.required,style:style,type:"text",value:this.props.prefix+this.state.value+this.props.suffix}),/*#__PURE__*/React.createElement("input",{name:this.props.name,required:this.props.required,type:"hidden",value:this.state.value}),!this.props.hideArrows?[/*#__PURE__*/React.createElement(Icon,{icon:plusIcon,key:"ArrowPlus",onPointerDown:function onPointerDown(){return _this2.startStep(+step)}}),/*#__PURE__*/React.createElement(Icon,{icon:minusIcon,key:"ArrowMinus",onPointerDown:function onPointerDown(){return _this2.startStep(-step)}})]:null)}}],[{key:"getDerivedStateFromProps",value:function getDerivedStateFromProps(nextProps,state){if(state.propValue!==nextProps.value){return{propValue:nextProps.value,value:typeof nextProps.value==="number"?nextProps.value.toFixed(nextProps.decimals):"",changed:false}}return null}}])}(React.Component);_defineProperty(NumberInput,"propTypes",{className:PropTypes.string,decimals:PropTypes.number,disabled:PropTypes.bool,fitParent:PropTypes.bool,hideArrows:PropTypes.bool,max:PropTypes.number,min:PropTypes.number,mobile:PropTypes.bool,name:PropTypes.string,onChange:PropTypes.func,placeholder:PropTypes.string,prefix:PropTypes.string,readOnly:PropTypes.bool,required:PropTypes.bool,step:PropTypes.number,style:PropTypes.object,suffix:PropTypes.string,value:PropTypes.number});_defineProperty(NumberInput,"defaultProps",{className:"",decimals:0,mobile:false,prefix:"",suffix:""});export{NumberInput as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qwc2",
3
- "version": "2025.08.25",
3
+ "version": "2025.08.26",
4
4
  "description": "QGIS Web Client",
5
5
  "author": "Sourcepole AG",
6
6
  "license": "BSD-2-Clause",
@@ -7,4 +7,4 @@ function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof
7
7
  */import React from"react";import{connect}from"react-redux";import ol from"openlayers";import PropTypes from"prop-types";import{changeZoomLevel,setDisplayCrs}from"../actions/map";import{openExternalUrl,setBottombarHeight}from"../actions/windows";import CoordinateDisplayer from"../components/CoordinateDisplayer";import InputContainer from"../components/widgets/InputContainer";import NumberInput from"../components/widgets/NumberInput";import CoordinatesUtils from"../utils/CoordinatesUtils";import LocaleUtils from"../utils/LocaleUtils";import MapUtils from"../utils/MapUtils";import"./style/BottomBar.css";/**
8
8
  * Bottom bar, displaying mouse coordinate, scale, etc.
9
9
  */var BottomBar=/*#__PURE__*/function(_React$Component){function BottomBar(){var _this;_classCallCheck(this,BottomBar);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key]}_this=_callSuper(this,BottomBar,[].concat(args));_defineProperty(_this,"state",{scale:0});_defineProperty(_this,"renderLink",function(entry){var _entry$labelMsgId;return/*#__PURE__*/React.createElement("a",{href:entry.url,key:(_entry$labelMsgId=entry.labelMsgId)!==null&&_entry$labelMsgId!==void 0?_entry$labelMsgId:entry.label,onClick:function onClick(ev){return _this.openUrl(ev,entry.url,entry.urlTarget,entry.labelMsgId?LocaleUtils.tr(entry.labelMsgId):entry.label,entry.icon)}},/*#__PURE__*/React.createElement("span",{className:"extra_label"},entry.labelMsgId?LocaleUtils.tr(entry.labelMsgId):entry.label))});_defineProperty(_this,"initScaleBar",function(el){_this.scalebar=new ol.control.ScaleLine(_objectSpread({className:"bottombar-scalebar",target:el,minWidth:64,units:"metric"},_this.props.scalebarOptions));MapUtils.getHook(MapUtils.GET_MAP).addControl(_this.scalebar)});_defineProperty(_this,"openUrl",function(ev,url,target,title,icon){if(target==="iframe"){target=":iframedialog:externallinkiframe"}_this.props.openExternalUrl(url,target,{title:title,icon:icon});ev.preventDefault()});_defineProperty(_this,"setScale",function(value){var scale=parseInt(value,10);if(!isNaN(scale)){var zoom=MapUtils.computeZoom(_this.props.map.scales,scale);_this.props.changeZoomLevel(zoom)}else{_this.props.changeZoomLevel(_this.props.map.zoom)}});_defineProperty(_this,"storeHeight",function(el){if(el){_this.props.setBottombarHeight(el.clientHeight)}});return _this}_inherits(BottomBar,_React$Component);return _createClass(BottomBar,[{key:"componentWillUnmount",value:function componentWillUnmount(){if(this.scalebar){var _MapUtils$getHook,_MapUtils$getHook$rem;(_MapUtils$getHook=MapUtils.getHook(MapUtils.GET_MAP))===null||_MapUtils$getHook===void 0||(_MapUtils$getHook$rem=_MapUtils$getHook.removeControl)===null||_MapUtils$getHook$rem===void 0||_MapUtils$getHook$rem.call(_MapUtils$getHook,this.scalebar)}}},{key:"componentDidUpdate",value:function componentDidUpdate(prevProps){if(this.props.map!==prevProps.map){this.setState({scale:Math.round(MapUtils.computeForZoom(this.props.map.scales,this.props.map.zoom))})}}},{key:"render",value:function render(){var _this2=this;if(this.props.fullscreen){return null}var leftBottomLinks=(this.props.additionalBottomBarLinks||[]).filter(function(entry){return entry.side==="left"}).map(this.renderLink);var rightBottomLinks=(this.props.additionalBottomBarLinks||[]).filter(function(entry){return entry.side!=="left"}).map(this.renderLink);if(this.props.viewertitleUrl){var entry={url:this.props.viewertitleUrl,urlTarget:this.props.viewertitleUrlTarget,label:LocaleUtils.tr("bottombar.viewertitle_label"),icon:this.props.viewertitleUrlIcon};rightBottomLinks.push(this.renderLink(entry))}if(this.props.termsUrl){var _entry={url:this.props.termsUrl,urlTarget:this.props.termsUrlTarget,label:LocaleUtils.tr("bottombar.terms_label"),icon:this.props.termsUrlIcon};rightBottomLinks.push(this.renderLink(_entry))}var enabledMouseCrs=[].concat(_toConsumableArray(this.props.additionalMouseCrs||[]),[this.props.map.projection,"EPSG:4326"]);// eslint-disable-next-line no-unused-vars
10
- var availableCRS=Object.fromEntries(Object.entries(CoordinatesUtils.getAvailableCRS()).filter(function(_ref){var _ref2=_slicedToArray(_ref,2),key=_ref2[0],value=_ref2[1];return enabledMouseCrs.includes(key)}));var scalebar=null;if(this.props.displayScalebar){scalebar=/*#__PURE__*/React.createElement("div",{className:"bottombar-scalebar-container",ref:this.initScaleBar})}var coordinates=null;if(this.props.displayCoordinates){coordinates=/*#__PURE__*/React.createElement("div",{className:"controlgroup"},/*#__PURE__*/React.createElement("span",{className:"bottombar-mousepos-label"},LocaleUtils.tr("bottombar.mousepos_label"),":\xA0"),/*#__PURE__*/React.createElement(CoordinateDisplayer,{className:"bottombar-mousepos",coordinateFormatter:this.props.coordinateFormatter,displayCrs:this.props.map.displayCrs,mapCrs:this.props.map.projection}),/*#__PURE__*/React.createElement("select",{onChange:function onChange(ev){return _this2.props.setDisplayCrs(ev.target.value)},value:this.props.map.displayCrs},Object.keys(availableCRS).map(function(crs){return/*#__PURE__*/React.createElement("option",{key:crs,value:crs},availableCRS[crs].label)})))}var scales=null;if(this.props.displayScales){scales=/*#__PURE__*/React.createElement("div",null,/*#__PURE__*/React.createElement("span",{className:"bottombar-scales-label"},LocaleUtils.tr("bottombar.scale_label"),":\xA0"),/*#__PURE__*/React.createElement(InputContainer,{className:"bottombar-scale-combo"},/*#__PURE__*/React.createElement("span",{className:"bottombar-scale-combo-prefix",role:"prefix"}," 1 : "),/*#__PURE__*/React.createElement("select",{onChange:function onChange(ev){return _this2.props.changeZoomLevel(parseInt(ev.target.value,10))},role:"input",value:Math.round(this.props.map.zoom)},this.props.map.scales.map(function(item,index){return/*#__PURE__*/React.createElement("option",{key:index,value:index},LocaleUtils.toLocaleFixed(item,0))})),/*#__PURE__*/React.createElement(NumberInput,{decimals:0,onChange:this.setScale,role:"input",value:this.state.scale})))}var style={marginLeft:this.props.mapMargins.outerLeft+"px",marginRight:this.props.mapMargins.outerRight+"px"};return/*#__PURE__*/React.createElement("div",{id:"BottomBar",ref:this.storeHeight,style:style},scalebar,/*#__PURE__*/React.createElement("span",{className:"bottombar-links"},leftBottomLinks),/*#__PURE__*/React.createElement("span",{className:"bottombar-spacer"}),coordinates,scales,/*#__PURE__*/React.createElement("span",{className:"bottombar-spacer"}),/*#__PURE__*/React.createElement("span",{className:"bottombar-links"},rightBottomLinks))}}])}(React.Component);_defineProperty(BottomBar,"propTypes",{/** Additional bottombar links.`side` can be `left` or `right` (default). */additionalBottomBarLinks:PropTypes.arrayOf(PropTypes.shape({label:PropTypes.string,labelMsgId:PropTypes.string,side:PropTypes.string,url:PropTypes.string,urlTarget:PropTypes.string,icon:PropTypes.string})),additionalMouseCrs:PropTypes.array,changeZoomLevel:PropTypes.func,/** Custom coordinate formatter, as `(coordinate, crs) => string`. */coordinateFormatter:PropTypes.func,/** Whether to display the coordinates in the bottom bar. */displayCoordinates:PropTypes.bool,/** Whether to display the scalebar in the bottom bar. */displayScalebar:PropTypes.bool,/** Whether to display the scale in the bottom bar. */displayScales:PropTypes.bool,fullscreen:PropTypes.bool,map:PropTypes.object,mapMargins:PropTypes.object,openExternalUrl:PropTypes.func,/** See [OpenLayers API doc](https://openlayers.org/en/latest/apidoc/module-ol_control_ScaleLine-ScaleLine.html) */scalebarOptions:PropTypes.object,setBottombarHeight:PropTypes.func,setDisplayCrs:PropTypes.func,/** The URL of the terms label anchor. */termsUrl:PropTypes.string,/** Icon of the terms inline window. Relevant only when `termsUrlTarget` is `iframe`. */termsUrlIcon:PropTypes.string,/** The target where to open the terms URL. If `iframe`, it will be displayed in an inline window, otherwise in a new tab. You can also use the `:iframedialog:<dialogname>:<options>` syntax to set up the inline window. */termsUrlTarget:PropTypes.string,/** The URL of the viewer title label anchor. */viewertitleUrl:PropTypes.string,/** Icon of the viewer title inline window. Relevant only when `viewertitleUrl` is `iframe`. */viewertitleUrlIcon:PropTypes.string,/** The target where to open the viewer title URL. If `iframe`, it will be displayed in an inline window, otherwise in a new tab. You can also use the `:iframedialog:<dialogname>:<options>` syntax to set up the inline window. */viewertitleUrlTarget:PropTypes.string});_defineProperty(BottomBar,"defaultProps",{displayCoordinates:true,displayScalebar:true,displayScales:true});export default connect(function(state){var _state$display,_state$theme$current$,_state$theme$current;return{map:state.map,fullscreen:(_state$display=state.display)===null||_state$display===void 0?void 0:_state$display.fullscreen,mapMargins:state.windows.mapMargins,additionalMouseCrs:(_state$theme$current$=(_state$theme$current=state.theme.current)===null||_state$theme$current===void 0?void 0:_state$theme$current.additionalMouseCrs)!==null&&_state$theme$current$!==void 0?_state$theme$current$:[]}},{changeZoomLevel:changeZoomLevel,openExternalUrl:openExternalUrl,setBottombarHeight:setBottombarHeight,setDisplayCrs:setDisplayCrs})(BottomBar);
10
+ var availableCRS=Object.fromEntries(Object.entries(CoordinatesUtils.getAvailableCRS()).filter(function(_ref){var _ref2=_slicedToArray(_ref,2),key=_ref2[0],value=_ref2[1];return enabledMouseCrs.includes(key)}));var scalebar=null;if(this.props.displayScalebar){scalebar=/*#__PURE__*/React.createElement("div",{className:"bottombar-scalebar-container",ref:this.initScaleBar})}var coordinates=null;if(this.props.displayCoordinates){coordinates=/*#__PURE__*/React.createElement("div",{className:"controlgroup"},/*#__PURE__*/React.createElement("span",{className:"bottombar-mousepos-label"},LocaleUtils.tr("bottombar.mousepos_label"),":\xA0"),/*#__PURE__*/React.createElement(CoordinateDisplayer,{className:"bottombar-mousepos",coordinateFormatter:this.props.coordinateFormatter,displayCrs:this.props.map.displayCrs,mapCrs:this.props.map.projection}),/*#__PURE__*/React.createElement("select",{onChange:function onChange(ev){return _this2.props.setDisplayCrs(ev.target.value)},value:this.props.map.displayCrs},Object.keys(availableCRS).map(function(crs){return/*#__PURE__*/React.createElement("option",{key:crs,value:crs},availableCRS[crs].label)})))}var scales=null;if(this.props.displayScales){scales=/*#__PURE__*/React.createElement("div",null,/*#__PURE__*/React.createElement("span",{className:"bottombar-scales-label"},LocaleUtils.tr("bottombar.scale_label"),":\xA0"),/*#__PURE__*/React.createElement(InputContainer,{className:"bottombar-scale-combo"},/*#__PURE__*/React.createElement("span",{className:"bottombar-scale-combo-prefix",role:"prefix"}," 1 : "),/*#__PURE__*/React.createElement("select",{onChange:function onChange(ev){return _this2.props.changeZoomLevel(parseInt(ev.target.value,10))},role:"input",value:Math.round(this.props.map.zoom)},this.props.map.scales.map(function(item,index){return/*#__PURE__*/React.createElement("option",{key:index,value:index},LocaleUtils.toLocaleFixed(item,0))})),/*#__PURE__*/React.createElement(NumberInput,{decimals:0,hideArrows:true,onChange:this.setScale,role:"input",value:this.state.scale})))}var style={marginLeft:this.props.mapMargins.outerLeft+"px",marginRight:this.props.mapMargins.outerRight+"px"};return/*#__PURE__*/React.createElement("div",{id:"BottomBar",ref:this.storeHeight,style:style},scalebar,/*#__PURE__*/React.createElement("span",{className:"bottombar-links"},leftBottomLinks),/*#__PURE__*/React.createElement("span",{className:"bottombar-spacer"}),coordinates,scales,/*#__PURE__*/React.createElement("span",{className:"bottombar-spacer"}),/*#__PURE__*/React.createElement("span",{className:"bottombar-links"},rightBottomLinks))}}])}(React.Component);_defineProperty(BottomBar,"propTypes",{/** Additional bottombar links.`side` can be `left` or `right` (default). */additionalBottomBarLinks:PropTypes.arrayOf(PropTypes.shape({label:PropTypes.string,labelMsgId:PropTypes.string,side:PropTypes.string,url:PropTypes.string,urlTarget:PropTypes.string,icon:PropTypes.string})),additionalMouseCrs:PropTypes.array,changeZoomLevel:PropTypes.func,/** Custom coordinate formatter, as `(coordinate, crs) => string`. */coordinateFormatter:PropTypes.func,/** Whether to display the coordinates in the bottom bar. */displayCoordinates:PropTypes.bool,/** Whether to display the scalebar in the bottom bar. */displayScalebar:PropTypes.bool,/** Whether to display the scale in the bottom bar. */displayScales:PropTypes.bool,fullscreen:PropTypes.bool,map:PropTypes.object,mapMargins:PropTypes.object,openExternalUrl:PropTypes.func,/** See [OpenLayers API doc](https://openlayers.org/en/latest/apidoc/module-ol_control_ScaleLine-ScaleLine.html) */scalebarOptions:PropTypes.object,setBottombarHeight:PropTypes.func,setDisplayCrs:PropTypes.func,/** The URL of the terms label anchor. */termsUrl:PropTypes.string,/** Icon of the terms inline window. Relevant only when `termsUrlTarget` is `iframe`. */termsUrlIcon:PropTypes.string,/** The target where to open the terms URL. If `iframe`, it will be displayed in an inline window, otherwise in a new tab. You can also use the `:iframedialog:<dialogname>:<options>` syntax to set up the inline window. */termsUrlTarget:PropTypes.string,/** The URL of the viewer title label anchor. */viewertitleUrl:PropTypes.string,/** Icon of the viewer title inline window. Relevant only when `viewertitleUrl` is `iframe`. */viewertitleUrlIcon:PropTypes.string,/** The target where to open the viewer title URL. If `iframe`, it will be displayed in an inline window, otherwise in a new tab. You can also use the `:iframedialog:<dialogname>:<options>` syntax to set up the inline window. */viewertitleUrlTarget:PropTypes.string});_defineProperty(BottomBar,"defaultProps",{displayCoordinates:true,displayScalebar:true,displayScales:true});export default connect(function(state){var _state$display,_state$theme$current$,_state$theme$current;return{map:state.map,fullscreen:(_state$display=state.display)===null||_state$display===void 0?void 0:_state$display.fullscreen,mapMargins:state.windows.mapMargins,additionalMouseCrs:(_state$theme$current$=(_state$theme$current=state.theme.current)===null||_state$theme$current===void 0?void 0:_state$theme$current.additionalMouseCrs)!==null&&_state$theme$current$!==void 0?_state$theme$current$:[]}},{changeZoomLevel:changeZoomLevel,openExternalUrl:openExternalUrl,setBottombarHeight:setBottombarHeight,setDisplayCrs:setDisplayCrs})(BottomBar);
package/plugins/View3D.js CHANGED
@@ -96,7 +96,7 @@ function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof
96
96
  * ### Import
97
97
  *
98
98
  * To import scene objects in formats other than GLTF, a `ogcProcessesUrl` in `config.json` needs to point to a BBOX OGC processes server.
99
- */var View3D=/*#__PURE__*/function(_React$Component){function View3D(props){var _this;_classCallCheck(this,View3D);_this=_callSuper(this,View3D,[props]);_defineProperty(_this,"state",{componentLoaded:false,windowDetached:false,viewsLocked:false,storedState:null});_defineProperty(_this,"render3DWindow",function(){if(_this.props.view3dMode>View3DMode.DISABLED){var extraControls=[{icon:"sync",callback:_this.sync2DExtent,title:LocaleUtils.tr("map3d.syncview")},{icon:"lock",callback:_this.setLockViews,title:LocaleUtils.tr("map3d.lockview"),active:_this.state.viewsLocked}];if(!_this.state.windowDetached){extraControls.push({icon:"maximize",callback:function callback(){return _this.props.setView3dMode(View3DMode.FULLSCREEN)},title:LocaleUtils.tr("window.maximize")})}var Map3D=_this.map3dComponent;var device=ConfigUtils.isMobile()?"mobile":"desktop";var pluginsConfig=_this.props.view3dMode===View3DMode.FULLSCREEN?_this.props.localConfig.plugins[device].filter(function(entry){return entry.availableIn3D}):[];return/*#__PURE__*/React.createElement(ResizeableWindow,{extraControls:extraControls,fullscreen:_this.props.view3dMode===View3DMode.FULLSCREEN,icon:"map3d",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,key:"View3DWindow",maximizeable:false,onClose:_this.onClose,onExternalWindowResized:_this.redrawScene,onFocusChanged:_this.windowFocusChanged,onGeometryChanged:_this.onGeometryChanged,splitScreenWhenDocked:true,splitTopAndBottomBar:true,title:LocaleUtils.tr("map3d.title")},_this.state.componentLoaded?/*#__PURE__*/React.createElement(Provider,{role:"body",store:_this.store},/*#__PURE__*/React.createElement(PluginsContainer,{pluginsConfig:pluginsConfig},/*#__PURE__*/React.createElement(Map3D,{controlsPosition:_this.props.controlsPosition,innerRef:_this.setRef,onCameraChanged:_this.onCameraChanged,onMapInitialized:_this.setupMap,pluginOptions:_this.props.pluginOptions,plugins3d:_this.props.plugins3d,searchProviders:_this.props.searchProviders,theme:_this.props.theme}),_this.props.view3dMode===View3DMode.DISABLING?/*#__PURE__*/React.createElement("div",{className:"view3d-busy-overlay"},/*#__PURE__*/React.createElement(Spinner,null),/*#__PURE__*/React.createElement("span",null,LocaleUtils.tr("view3d.storingstate"))):null)):null)}return null});_defineProperty(_this,"onClose",function(){_this.props.setView3dMode(View3DMode.DISABLING)});_defineProperty(_this,"onGeometryChanged",function(geometry){if(geometry.maximized&&_this.props.view3dMode!==View3DMode.FULLSCREEN){_this.props.setView3dMode(View3DMode.FULLSCREEN)}_this.setState({windowDetached:geometry.detached})});_defineProperty(_this,"onCameraChanged",function(center,camera,fov){// Note: If camera pos is NULL, we are in first-person-view
99
+ */var View3D=/*#__PURE__*/function(_React$Component){function View3D(props){var _this;_classCallCheck(this,View3D);_this=_callSuper(this,View3D,[props]);_defineProperty(_this,"state",{componentLoaded:false,windowDetached:false,viewsLocked:false,storedState:null});_defineProperty(_this,"render3DWindow",function(){if(_this.props.view3dMode>View3DMode.DISABLED){var extraControls=[{icon:"sync",callback:_this.sync2DExtent,title:LocaleUtils.tr("map3d.syncview")},{icon:"lock",callback:_this.setLockViews,title:LocaleUtils.tr("map3d.lockview"),active:_this.state.viewsLocked}];if(!_this.state.windowDetached){extraControls.push({icon:"maximize",callback:function callback(){return _this.props.setView3dMode(View3DMode.FULLSCREEN)},title:LocaleUtils.tr("window.maximize")})}var Map3D=_this.map3dComponent;var device=ConfigUtils.isMobile()?"mobile":"desktop";var pluginsConfig=_this.props.view3dMode===View3DMode.FULLSCREEN?_this.props.localConfig.plugins[device].filter(function(entry){return entry.availableIn3D}):[];return/*#__PURE__*/React.createElement(ResizeableWindow,{extraControls:extraControls,fullscreen:_this.props.view3dMode===View3DMode.FULLSCREEN,icon:"map3d",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,key:"View3DWindow",maximizeable:false,onClose:_this.onClose,onExternalWindowResized:_this.redrawScene,onFocusChanged:_this.windowFocusChanged,onGeometryChanged:_this.onGeometryChanged,splitScreenWhenDocked:true,splitTopAndBottomBar:true,title:LocaleUtils.tr("map3d.title")},_this.state.componentLoaded?/*#__PURE__*/React.createElement(Provider,{role:"body",store:_this.store},/*#__PURE__*/React.createElement(PluginsContainer,{pluginsConfig:pluginsConfig},/*#__PURE__*/React.createElement(Map3D,{controlsPosition:_this.props.controlsPosition,defaultSceneQuality:_this.props.defaultSceneQuality,innerRef:_this.setRef,onCameraChanged:_this.onCameraChanged,onMapInitialized:_this.setupMap,pluginOptions:_this.props.pluginOptions,plugins3d:_this.props.plugins3d,searchProviders:_this.props.searchProviders,theme:_this.props.theme}),_this.props.view3dMode===View3DMode.DISABLING?/*#__PURE__*/React.createElement("div",{className:"view3d-busy-overlay"},/*#__PURE__*/React.createElement(Spinner,null),/*#__PURE__*/React.createElement("span",null,LocaleUtils.tr("view3d.storingstate"))):null)):null)}return null});_defineProperty(_this,"onClose",function(){_this.props.setView3dMode(View3DMode.DISABLING)});_defineProperty(_this,"onGeometryChanged",function(geometry){if(geometry.maximized&&_this.props.view3dMode!==View3DMode.FULLSCREEN){_this.props.setView3dMode(View3DMode.FULLSCREEN)}_this.setState({windowDetached:geometry.detached})});_defineProperty(_this,"onCameraChanged",function(center,camera,fov){// Note: If camera pos is NULL, we are in first-person-view
100
100
  if(_this.state.viewsLocked&&_this.focusedMap==="map3d"){var rotation=undefined;if(camera){rotation=Math.atan2(center[1]-camera[1],center[0]-camera[0])-0.5*Math.PI;var distance=Math.sqrt((camera[0]-center[0])*(camera[0]-center[0])+(camera[1]-center[1])*(camera[1]-center[1])+(camera[2]-center[2])*(camera[2]-center[2]));var fovrad=fov/180*Math.PI;var bboxWidth=distance*(2*Math.tan(fovrad/2));var bbox=[-0.5*bboxWidth,0,0.5*bboxWidth,0];var zoom=MapUtils.getZoomForExtent(bbox,_this.props.map.resolutions,_this.props.map.size,0,_this.props.map.scales.length-1);_this.props.zoomToPoint(center.slice(0,2),zoom,_this.props.theme.mapCrs,rotation);if(_this.firstPersonMarker){_this.props.removeLayer("view3d-firstperson-cone");_this.firstPersonMarker=false}}else{_this.props.panTo(center.slice(0,2),_this.props.theme.mapCrs,rotation);var feature={geometry:{type:"Point",coordinates:center.slice(0,2)},crs:_this.props.theme.mapCrs,styleName:"marker",styleOptions:{iconSrc:personIcon}};var layer={id:"view3d-firstperson-marker",role:LayerRole.MARKER};_this.props.addLayerFeatures(layer,[feature],true);_this.firstPersonMarker=true}}else if(_this.firstPersonMarker){_this.props.removeLayer("view3d-firstperson-marker");_this.firstPersonMarker=false}});_defineProperty(_this,"setRef",function(ref){_this.map3dComponentRef=ref});_defineProperty(_this,"sync2DExtent",function(){if(_this.map3dComponentRef){_this.map3dComponentRef.setViewToExtent(_this.props.map.bbox.bounds,_this.props.map.bbox.rotation)}});_defineProperty(_this,"setLockViews",function(){_this.setState(function(state){return{viewsLocked:!state.viewsLocked}});if(_this.firstPersonMarker){_this.props.removeLayer("view3d-firstperson-marker");_this.firstPersonMarker=false}});_defineProperty(_this,"setupMap",function(){if(_this.map3dComponentRef){if(!isEmpty(_this.state.storedState)){_this.map3dComponentRef.restore3dState(_this.state.storedState)}else if(_this.props.theme.current.map3d.initialView){_this.map3dComponentRef.restore3dState(_this.props.theme.current.map3d.initialView)}else{_this.sync2DExtent()}}});_defineProperty(_this,"redrawScene",function(ev){if(_this.map3dComponentRef){_this.map3dComponentRef.redrawScene(ev)}});_defineProperty(_this,"trackFocus",function(ev){var _mapEl$contains,_map3dEl$contains;var mapEl=document.getElementById("map");var map3dEl=document.getElementById("map3d");if(mapEl!==null&&mapEl!==void 0&&(_mapEl$contains=mapEl.contains)!==null&&_mapEl$contains!==void 0&&_mapEl$contains.call(mapEl,document.activeElement)){_this.focusedMap="map"}else if(map3dEl!==null&&map3dEl!==void 0&&(_map3dEl$contains=map3dEl.contains)!==null&&_map3dEl$contains!==void 0&&_map3dEl$contains.call(map3dEl,document.activeElement)){_this.focusedMap="map3d"}else{_this.focusedMap=null}});_this.map3dComponent=null;_this.map3dComponentRef=null;_this.focusedMap=null;_this.firstPersonMarker=true;// Subset of 2d reducers
101
101
  var _ReducerIndex$reducer=ReducerIndex.reducers,processNotifications=_ReducerIndex$reducer.processNotifications,task=_ReducerIndex$reducer.task,windows=_ReducerIndex$reducer.windows;// Reducer for syncronization with parent store
102
102
  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
@@ -106,5 +106,5 @@ this.syncParentStore(prevProps);// Handle view mode change
106
106
  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:undefined})}}// Switch to 2D mode if new theme has no 3D configuration
107
107
  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
108
108
  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
109
- 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,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,panTo:PropTypes.func,/** Options to pass to the 3D plugins, in the form `{"<PluginName>": {<options>}}`.
109
+ 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,panTo:PropTypes.func,/** Options to pass to the 3D plugins, in the form `{"<PluginName>": {<options>}}`.
110
110
  * 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:{}});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)});