qwc2 2025.4.10 → 2025.4.22

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 (53) hide show
  1. package/components/AppMenu.js +1 -1
  2. package/components/AttributeTableWidget.js +16 -0
  3. package/components/AutoEditForm.js +1 -1
  4. package/components/EditUploadField.js +2 -2
  5. package/components/QtDesignerForm.js +1 -1
  6. package/components/WindowManager.js +1 -1
  7. package/components/map3d/ExportObjects3D.js +6 -3
  8. package/components/map3d/Identify3D.js +4 -4
  9. package/components/map3d/Map3D.js +9 -8
  10. package/components/map3d/Measure3D.js +7 -5
  11. package/components/map3d/style/Map3D.css +9 -0
  12. package/components/map3d/style/SearchField3D.css +4 -3
  13. package/components/map3d/utils/Tiles3DStyle.js +11 -1
  14. package/components/style/AppMenu.css +19 -5
  15. package/components/style/AttributeTableWidget.css +214 -0
  16. package/package.json +4 -3
  17. package/plugins/API.js +2 -2
  18. package/plugins/AttributeTable.js +3 -12
  19. package/plugins/BackgroundSwitcher.js +1 -1
  20. package/plugins/Bookmark.js +1 -1
  21. package/plugins/HeightProfile.js +9 -8
  22. package/plugins/MapInfoTooltip.js +5 -3
  23. package/plugins/View3D.js +29 -4
  24. package/plugins/style/AttributeTable.css +1 -215
  25. package/plugins/style/Portal.css +2 -6
  26. package/reducers/layers.js +2 -1
  27. package/scripts/dist.sh +7 -1
  28. package/static/translations/bg-BG.json +7 -0
  29. package/static/translations/ca-ES.json +7 -0
  30. package/static/translations/cs-CZ.json +7 -0
  31. package/static/translations/de-CH.json +7 -0
  32. package/static/translations/de-DE.json +7 -0
  33. package/static/translations/en-US.json +7 -0
  34. package/static/translations/es-ES.json +7 -0
  35. package/static/translations/fi-FI.json +7 -0
  36. package/static/translations/fr-FR.json +7 -0
  37. package/static/translations/hu-HU.json +7 -0
  38. package/static/translations/it-IT.json +7 -0
  39. package/static/translations/ja-JP.json +7 -0
  40. package/static/translations/nl-NL.json +7 -0
  41. package/static/translations/no-NO.json +7 -0
  42. package/static/translations/pl-PL.json +7 -0
  43. package/static/translations/pt-BR.json +7 -0
  44. package/static/translations/pt-PT.json +7 -0
  45. package/static/translations/ro-RO.json +7 -0
  46. package/static/translations/ru-RU.json +7 -0
  47. package/static/translations/sv-SE.json +7 -0
  48. package/static/translations/tr-TR.json +7 -0
  49. package/static/translations/tsconfig.json +6 -1
  50. package/utils/EditingInterface.js +4 -1
  51. package/utils/ElevationInterface.js +25 -0
  52. package/utils/SearchProviders.js +1 -1
  53. package/utils/ServiceLayerUtils.js +2 -2
@@ -4,26 +4,27 @@ 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 Instance from"@giro3d/giro3d/core/Instance.js";import Coordinates from"@giro3d/giro3d/core/geographic/Coordinates";import Extent from"@giro3d/giro3d/core/geographic/Extent.js";import ElevationLayer from"@giro3d/giro3d/core/layer/ElevationLayer.js";import FeatureCollection from"@giro3d/giro3d/entities/FeatureCollection.js";import Map from"@giro3d/giro3d/entities/Map.js";import Tiles3D from"@giro3d/giro3d/entities/Tiles3D.js";import Inspector from"@giro3d/giro3d/gui/Inspector.js";import GeoTIFFSource from"@giro3d/giro3d/sources/GeoTIFFSource.js";import{fromUrl}from"geotiff";import isEmpty from"lodash.isempty";import PropTypes from"prop-types";import{Vector2,CubeTextureLoader,Group,Raycaster,Mesh}from"three";import{GLTFExporter}from"three/addons/exporters/GLTFExporter.js";import{GLTFLoader}from"three/addons/loaders/GLTFLoader";import{v4 as uuidv4}from"uuid";import{LayerRole}from"../../actions/layers";import{setCurrentTask}from"../../actions/task";import{BackgroundSwitcher}from"../../plugins/BackgroundSwitcher";import ConfigUtils from"../../utils/ConfigUtils";import CoordinatesUtils from"../../utils/CoordinatesUtils";import{registerPermalinkDataStoreHook,unregisterPermalinkDataStoreHook,UrlParams}from"../../utils/PermaLinkUtils";import BottomBar3D from"./BottomBar3D";import Compare3D from"./Compare3D";import Draw3D from"./Draw3D";import ExportObjects3D from"./ExportObjects3D";import HideObjects3D from"./HideObjects3D";import Identify3D from"./Identify3D";import LayerTree3D from"./LayerTree3D";import Map3DLight from"./Map3DLight";import MapControls3D from"./MapControls3D";import MapExport3D from"./MapExport3D";import Measure3D from"./Measure3D";import OverviewMap3D from"./OverviewMap3D";import TopBar3D from"./TopBar3D";import View3DSwitcher from"./View3DSwitcher";import LayerRegistry from"./layers/index";import Tiles3DStyle from"./utils/Tiles3DStyle";import"./style/Map3D.css";var UnloadWrapper=/*#__PURE__*/function(_React$Component){function UnloadWrapper(){var _this;_classCallCheck(this,UnloadWrapper);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key]}_this=_callSuper(this,UnloadWrapper,[].concat(args));_defineProperty(_this,"onUnload",function(el){if(!el){_this.props.onUnload(_this.props.sceneId)}});return _this}_inherits(UnloadWrapper,_React$Component);return _createClass(UnloadWrapper,[{key:"render",value:function render(){return/*#__PURE__*/React.createElement("div",null,this.props.children,/*#__PURE__*/React.createElement("span",{ref:this.onUnload}))}}])}(React.Component);_defineProperty(UnloadWrapper,"propTypes",{children:PropTypes.oneOfType([PropTypes.node,PropTypes.func]),onUnload:PropTypes.func,sceneId:PropTypes.string});var Map3D=/*#__PURE__*/function(_React$Component2){function Map3D(props){var _this2;_classCallCheck(this,Map3D);_this2=_callSuper(this,Map3D,[props]);_defineProperty(_this2,"state",{sceneContext:_objectSpread(_objectSpread({},Map3D.defaultSceneState),{},{addLayer:function addLayer(layer){},getLayer:function getLayer(layerId){},removeLayer:function removeLayer(layerId){},updateColorLayer:function updateColorLayer(layerId,options){},addSceneObject:function addSceneObject(objectId,object){var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{}},getSceneObject:function getSceneObject(objectId){},removeSceneObject:function removeSceneObject(objectId){},updateSceneObject:function updateSceneObject(objectId,options){},getMap:function getMap(){},setViewToExtent:function setViewToExtent(bounds,angle){},getTerrainHeightFromDTM:function getTerrainHeightFromDTM(scenePos){},getTerrainHeightFromMap:function getTerrainHeightFromMap(scenePos){},getSceneIntersection:function getSceneIntersection(x,y){}}),sceneId:null});_defineProperty(_this2,"applyBaseLayer",function(){var baseLayer=_this2.state.sceneContext.baseLayers.find(function(e){return e.visibility===true});_this2.removeLayer("__baselayer");if(!baseLayer){return}var layerCreator=LayerRegistry[baseLayer.type];if(layerCreator!==null&&layerCreator!==void 0&&layerCreator.create3d){var layer3d=layerCreator.create3d(baseLayer,_this2.state.sceneContext.mapCrs);_this2.addLayer("__baselayer",layer3d);_this2.map.insertLayerAfter(layer3d,null)}});_defineProperty(_this2,"setBaseLayer",function(layer,visibility){_this2.setState(function(state){return{sceneContext:_objectSpread(_objectSpread({},state.sceneContext),{},{baseLayers:state.sceneContext.baseLayers.map(function(entry){return _objectSpread(_objectSpread({},entry),{},{visibility:entry.name===layer.name?visibility:false})})})}})});_defineProperty(_this2,"collectColorLayers",function(prevColorLayers){return _this2.props.layers.reduce(function(colorLayers,layer){var _prevOptions$visibili,_prevOptions$opacity,_prevOptions$extrusio;if(layer.role!==LayerRole.THEME&&layer.role!==LayerRole.USERLAYER){return colorLayers}var layerCreator=LayerRegistry[layer.type];if(!layerCreator||!layerCreator.create3d){return colorLayers}var prevOptions=prevColorLayers[layer.uuid];colorLayers[layer.uuid]=_objectSpread(_objectSpread({},layer),{},{visibility:(_prevOptions$visibili=prevOptions===null||prevOptions===void 0?void 0:prevOptions.visibility)!==null&&_prevOptions$visibili!==void 0?_prevOptions$visibili:false,opacity:(_prevOptions$opacity=prevOptions===null||prevOptions===void 0?void 0:prevOptions.opacity)!==null&&_prevOptions$opacity!==void 0?_prevOptions$opacity:255,extrusionHeight:(_prevOptions$extrusio=prevOptions===null||prevOptions===void 0?void 0:prevOptions.extrusionHeight)!==null&&_prevOptions$extrusio!==void 0?_prevOptions$extrusio:["vector","wfs"].includes(layer.type)?0:undefined});return colorLayers},{})});_defineProperty(_this2,"applyColorLayerUpdates",function(colorLayers,prevColorLayers){// Add-update new layers
7
+ */import React from"react";import{connect}from"react-redux";import Instance from"@giro3d/giro3d/core/Instance.js";import Coordinates from"@giro3d/giro3d/core/geographic/Coordinates";import Extent from"@giro3d/giro3d/core/geographic/Extent.js";import ElevationLayer from"@giro3d/giro3d/core/layer/ElevationLayer.js";import FeatureCollection from"@giro3d/giro3d/entities/FeatureCollection.js";import Map from"@giro3d/giro3d/entities/Map.js";import Tiles3D from"@giro3d/giro3d/entities/Tiles3D.js";import Inspector from"@giro3d/giro3d/gui/Inspector.js";import GeoTIFFSource from"@giro3d/giro3d/sources/GeoTIFFSource.js";import axios from"axios";import{fromUrl}from"geotiff";import isEmpty from"lodash.isempty";import PropTypes from"prop-types";import{Vector2,CubeTextureLoader,Group,Raycaster,Mesh}from"three";import{GLTFExporter}from"three/addons/exporters/GLTFExporter.js";import{GLTFLoader}from"three/addons/loaders/GLTFLoader";import{v4 as uuidv4}from"uuid";import{LayerRole}from"../../actions/layers";import{setCurrentTask}from"../../actions/task";import{BackgroundSwitcher}from"../../plugins/BackgroundSwitcher";import ConfigUtils from"../../utils/ConfigUtils";import CoordinatesUtils from"../../utils/CoordinatesUtils";import MiscUtils from"../../utils/MiscUtils";import{registerPermalinkDataStoreHook,unregisterPermalinkDataStoreHook,UrlParams}from"../../utils/PermaLinkUtils";import BottomBar3D from"./BottomBar3D";import Compare3D from"./Compare3D";import Draw3D from"./Draw3D";import ExportObjects3D from"./ExportObjects3D";import HideObjects3D from"./HideObjects3D";import Identify3D from"./Identify3D";import LayerTree3D from"./LayerTree3D";import Map3DLight from"./Map3DLight";import MapControls3D from"./MapControls3D";import MapExport3D from"./MapExport3D";import Measure3D from"./Measure3D";import OverviewMap3D from"./OverviewMap3D";import TopBar3D from"./TopBar3D";import View3DSwitcher from"./View3DSwitcher";import LayerRegistry from"./layers/index";import Tiles3DStyle from"./utils/Tiles3DStyle";import"./style/Map3D.css";var UnloadWrapper=/*#__PURE__*/function(_React$Component){function UnloadWrapper(){var _this;_classCallCheck(this,UnloadWrapper);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key]}_this=_callSuper(this,UnloadWrapper,[].concat(args));_defineProperty(_this,"onUnload",function(el){if(!el){_this.props.onUnload(_this.props.sceneId)}});return _this}_inherits(UnloadWrapper,_React$Component);return _createClass(UnloadWrapper,[{key:"render",value:function render(){return/*#__PURE__*/React.createElement("div",null,this.props.children,/*#__PURE__*/React.createElement("span",{ref:this.onUnload}))}}])}(React.Component);_defineProperty(UnloadWrapper,"propTypes",{children:PropTypes.oneOfType([PropTypes.node,PropTypes.func]),onUnload:PropTypes.func,sceneId:PropTypes.string});var Map3D=/*#__PURE__*/function(_React$Component2){function Map3D(props){var _this2;_classCallCheck(this,Map3D);_this2=_callSuper(this,Map3D,[props]);_defineProperty(_this2,"state",{sceneContext:_objectSpread(_objectSpread({},Map3D.defaultSceneState),{},{addLayer:function addLayer(layer){},getLayer:function getLayer(layerId){},removeLayer:function removeLayer(layerId){},updateColorLayer:function updateColorLayer(layerId,options){},addSceneObject:function addSceneObject(objectId,object){var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{}},getSceneObject:function getSceneObject(objectId){},removeSceneObject:function removeSceneObject(objectId){},updateSceneObject:function updateSceneObject(objectId,options){},getMap:function getMap(){},setViewToExtent:function setViewToExtent(bounds,angle){},getTerrainHeightFromDTM:function getTerrainHeightFromDTM(scenePos){},getTerrainHeightFromMap:function getTerrainHeightFromMap(scenePos){},getSceneIntersection:function getSceneIntersection(x,y){}}),sceneId:null});_defineProperty(_this2,"applyBaseLayer",function(){var baseLayer=_this2.state.sceneContext.baseLayers.find(function(e){return e.visibility===true});_this2.removeLayer("__baselayer");if(!baseLayer){return}var layerCreator=LayerRegistry[baseLayer.type];if(layerCreator!==null&&layerCreator!==void 0&&layerCreator.create3d){var layer3d=layerCreator.create3d(baseLayer,_this2.state.sceneContext.mapCrs);_this2.addLayer("__baselayer",layer3d);_this2.map.insertLayerAfter(layer3d,null)}});_defineProperty(_this2,"setBaseLayer",function(layer,visibility){_this2.setState(function(state){return{sceneContext:_objectSpread(_objectSpread({},state.sceneContext),{},{baseLayers:state.sceneContext.baseLayers.map(function(entry){return _objectSpread(_objectSpread({},entry),{},{visibility:entry.name===layer.name?visibility:false})})})}})});_defineProperty(_this2,"collectColorLayers",function(prevColorLayers){return _this2.props.layers.reduce(function(colorLayers,layer){var _prevOptions$visibili,_prevOptions$opacity,_prevOptions$extrusio;if(layer.role!==LayerRole.THEME&&layer.role!==LayerRole.USERLAYER){return colorLayers}var layerCreator=LayerRegistry[layer.type];if(!layerCreator||!layerCreator.create3d){return colorLayers}var prevOptions=prevColorLayers[layer.uuid];colorLayers[layer.uuid]=_objectSpread(_objectSpread({},layer),{},{visibility:(_prevOptions$visibili=prevOptions===null||prevOptions===void 0?void 0:prevOptions.visibility)!==null&&_prevOptions$visibili!==void 0?_prevOptions$visibili:false,opacity:(_prevOptions$opacity=prevOptions===null||prevOptions===void 0?void 0:prevOptions.opacity)!==null&&_prevOptions$opacity!==void 0?_prevOptions$opacity:255,extrusionHeight:(_prevOptions$extrusio=prevOptions===null||prevOptions===void 0?void 0:prevOptions.extrusionHeight)!==null&&_prevOptions$extrusio!==void 0?_prevOptions$extrusio:["vector","wfs"].includes(layer.type)?0:undefined});return colorLayers},{})});_defineProperty(_this2,"applyColorLayerUpdates",function(colorLayers,prevColorLayers){// Add-update new layers
8
8
  var layerBelow=_this2.getLayer("__baselayer");Object.entries(colorLayers).reverse().forEach(function(_ref){var _ref2=_slicedToArray(_ref,2),layerId=_ref2[0],options=_ref2[1];var prevOptions=prevColorLayers[layerId];var layerCreator=LayerRegistry[options.type];var mapLayer=_this2.getLayer(layerId);if(mapLayer){layerCreator.update3d(mapLayer.source,options,prevOptions,_this2.state.sceneContext.mapCrs)}else{mapLayer=layerCreator.create3d(options,_this2.state.sceneContext.mapCrs);_this2.addLayer(layerId,mapLayer)}_this2.map.insertLayerAfter(mapLayer,layerBelow);mapLayer.visible=options.visibility;mapLayer.opacity=options.opacity/255;layerBelow=mapLayer;if(options.extrusionHeight>0){_this2.createUpdateExtrudedLayer(mapLayer,options,options.features!==(prevOptions===null||prevOptions===void 0?void 0:prevOptions.features))}else if((prevOptions===null||prevOptions===void 0?void 0:prevOptions.extrusionHeight)>0){_this2.removeExtrudedLayer(options.uuid)}});// Remove old layers
9
9
  Object.entries(prevColorLayers).forEach(function(_ref3){var _ref4=_slicedToArray(_ref3,2),layerId=_ref4[0],options=_ref4[1];if(!(layerId in colorLayers)){if(options.extrusionHeight){_this2.removeExtrudedLayer(options.uuid)}_this2.removeLayer(layerId)}});_this2.instance.notifyChange(_this2.map)});_defineProperty(_this2,"createUpdateExtrudedLayer",function(mapLayer,options){var _options$features,_options$features$red;var forceCreate=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var bounds=options.bbox.bounds;var extent=new Extent(options.bbox.crs,bounds[0],bounds[2],bounds[1],bounds[3]);var objId=options.uuid+":extruded";var makeColor=function makeColor(c){if(Array.isArray(c)){return c[0]<<16|c[1]<<8|c[2]}else if(typeof c==="string"){return parseInt(c.replace("#",""),16)}else{return c}};var obj=_this2.objectMap[objId];if(!obj||forceCreate){var _options$color;if(obj){_this2.instance.remove(obj)}var layercolor=makeColor((_options$color=options.color)!==null&&_options$color!==void 0?_options$color:"#FF0000");obj=new FeatureCollection({source:mapLayer.source.source,extent:extent,elevation:function elevation(feature){var coordinates=feature.getGeometry().getCoordinates();while(Array.isArray(coordinates[0])){coordinates=coordinates[0]}return coordinates[2]||_this2.getTerrainHeightFromMap(coordinates)||0},extrusionOffset:function extrusionOffset(){return obj.userData.extrusionHeight},style:function style(feature){var _obj$userData$feature,_obj$userData$feature2;return(_obj$userData$feature=(_obj$userData$feature2=obj.userData.featureStyles)===null||_obj$userData$feature2===void 0?void 0:_obj$userData$feature2[feature.getId()])!==null&&_obj$userData$feature!==void 0?_obj$userData$feature:{fill:{color:layercolor,shading:true}}}});obj.castShadow=true;obj.receiveShadow=true;_this2.instance.add(obj);_this2.objectMap[objId]=obj}obj.userData.extrusionHeight=options.extrusionHeight;obj.userData.featureStyles=(_options$features=options.features)===null||_options$features===void 0||(_options$features$red=_options$features.reduce)===null||_options$features$red===void 0?void 0:_options$features$red.call(_options$features,function(res,feature){return _objectSpread(_objectSpread({},res),{},_defineProperty({},feature.id,{fill:{color:makeColor(feature.styleOptions.fillColor),shading:true}}))},{});obj.traverse(function(mesh){mesh.castShadow=true;mesh.receiveShadow=true});obj.opacity=mapLayer.opacity;obj.visible=mapLayer.visible;obj.updateStyles()});_defineProperty(_this2,"removeExtrudedLayer",function(layerId){var objId=layerId+":extruded";if(_this2.objectMap[objId]){_this2.instance.remove(_this2.objectMap[objId]);delete _this2.objectMap[objId]}_this2.instance.notifyChange()});_defineProperty(_this2,"applySceneObjectUpdates",function(sceneObjects){Object.entries(sceneObjects).forEach(function(_ref5){var _ref6=_slicedToArray(_ref5,2),objectId=_ref6[0],options=_ref6[1];var object=_this2.objectMap[objectId];object.visible=options.visibility&&options.opacity>0;if(object.opacity!==undefined){object.opacity=options.opacity/255}else{object.traverse(function(child){if(child instanceof Mesh){child.material.transparent=options.opacity<255;child.material.opacity=options.opacity/255;child.material.needsUpdate=true}})}_this2.instance.notifyChange(object)})});_defineProperty(_this2,"addLayer",function(layerId,layer){layer.userData.layerId=layerId;_this2.map.addLayer(layer)});_defineProperty(_this2,"getLayer",function(layerId){var _this2$map$getLayers$;return(_this2$map$getLayers$=_this2.map.getLayers(function(l){return l.userData.layerId===layerId})[0])!==null&&_this2$map$getLayers$!==void 0?_this2$map$getLayers$:null});_defineProperty(_this2,"removeLayer",function(layerId){_this2.map.getLayers(function(l){return l.userData.layerId===layerId}).forEach(function(layer){_this2.map.removeLayer(layer,{dispose:true})})});_defineProperty(_this2,"updateColorLayer",function(layerId,options){_this2.setState(function(state){return{sceneContext:_objectSpread(_objectSpread({},state.sceneContext),{},{colorLayers:_objectSpread(_objectSpread({},state.sceneContext.colorLayers),{},_defineProperty({},layerId,_objectSpread(_objectSpread({},state.sceneContext.colorLayers[layerId]),options)))})}})});_defineProperty(_this2,"addSceneObject",function(objectId,object){var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};_this2.sceneObjectGroup.add(object);_this2.objectMap[objectId]=object;_this2.setState(function(state){var objectState=_objectSpread({visibility:true,opacity:255,layertree:false},options);return{sceneContext:_objectSpread(_objectSpread({},state.sceneContext),{},{sceneObjects:_objectSpread(_objectSpread({},state.sceneContext.sceneObjects),{},_defineProperty({},objectId,objectState))})}})});_defineProperty(_this2,"getSceneObject",function(objectId){return _this2.objectMap[objectId]});_defineProperty(_this2,"removeSceneObject",function(objectId){if(!_this2.objectMap[objectId]){return}_this2.sceneObjectGroup.remove(_this2.objectMap[objectId]);delete _this2.objectMap[objectId];_this2.setState(function(state){var newSceneObjects=_objectSpread({},state.sceneContext.sceneObjects);delete newSceneObjects[objectId];return{sceneContext:_objectSpread(_objectSpread({},state.sceneContext),{},{sceneObjects:newSceneObjects})}})});_defineProperty(_this2,"updateSceneObject",function(objectId,options){_this2.setState(function(state){return{sceneContext:_objectSpread(_objectSpread({},state.sceneContext),{},{sceneObjects:_objectSpread(_objectSpread({},state.sceneContext.sceneObjects),{},_defineProperty({},objectId,_objectSpread(_objectSpread({},state.sceneContext.sceneObjects[objectId]),options)))})}})});_defineProperty(_this2,"getMap",function(){return _this2.map});_defineProperty(_this2,"setupContainer",function(el){if(el){_this2.container=el;_this2.setupInstance()}});_defineProperty(_this2,"setupInstance",function(){var _this2$props$theme$ma,_this2$props$theme$ma2,_this2$props$theme$ma3,_this2$props$theme$ma6,_this2$props$theme$ma7;if(_this2.instance){_this2.disposeInstance()}var projection=_this2.props.theme.mapCrs;// Setup instance
10
10
  _this2.instance=new Instance({target:_this2.container,crs:projection,renderer:{clearColor:0,preserveDrawingBuffer:true}});_this2.sceneObjectGroup=new Group;_this2.instance.add(_this2.sceneObjectGroup);// Setup map
11
11
  var bounds=CoordinatesUtils.reprojectBbox(_this2.props.theme.initialBbox.bounds,_this2.props.theme.initialBbox.crs,projection);var extent=new Extent(projection,bounds[0],bounds[2],bounds[1],bounds[3]);_this2.map=new Map({extent:extent,backgroundColor:"white"});_this2.instance.add(_this2.map);// Setup camera
12
12
  var center=extent.center();_this2.instance.view.camera.position.set(center.x,center.y,0.5*(extent.east-extent.west));// Skybox
13
13
  var cubeTextureLoader=new CubeTextureLoader;cubeTextureLoader.setPath(ConfigUtils.getAssetsPath()+"/3d/skybox/");var cubeTexture=cubeTextureLoader.load(["px.jpg","nx.jpg","py.jpg","ny.jpg","pz.jpg","nz.jpg"]);_this2.instance.scene.background=cubeTexture;// Setup elevation
14
- var demUrl=(_this2$props$theme$ma=(_this2$props$theme$ma2=_this2.props.theme.map3d)===null||_this2$props$theme$ma2===void 0||(_this2$props$theme$ma2=_this2$props$theme$ma2.dtm)===null||_this2$props$theme$ma2===void 0?void 0:_this2$props$theme$ma2.url)!==null&&_this2$props$theme$ma!==void 0?_this2$props$theme$ma:"";if(demUrl.startsWith(":")){demUrl=location.href.split("?")[0]+ConfigUtils.getAssetsPath()+demUrl.substr(1)}var demCrs=((_this2$props$theme$ma3=_this2.props.theme.map3d)===null||_this2$props$theme$ma3===void 0||(_this2$props$theme$ma3=_this2$props$theme$ma3.dtm)===null||_this2$props$theme$ma3===void 0?void 0:_this2$props$theme$ma3.crs)||"EPSG:3857";if(demUrl){var _this2$props$theme$ma4,_this2$props$theme$ma5;var demSource=new GeoTIFFSource({url:demUrl,crs:demCrs});var demMin=(_this2$props$theme$ma4=_this2.props.theme.map3d.dtm.min)!==null&&_this2$props$theme$ma4!==void 0?_this2$props$theme$ma4:undefined;var demMax=(_this2$props$theme$ma5=_this2.props.theme.map3d.dtm.max)!==null&&_this2$props$theme$ma5!==void 0?_this2$props$theme$ma5:undefined;var elevationLayer=new ElevationLayer({name:"dem",extent:extent,source:demSource,minmax:demMin!==undefined&&demMax!==undefined?{demMin:demMin,demMax:demMax}:undefined});_this2.addLayer("__dtm",elevationLayer)}// Collect baselayers
14
+ var demUrl=MiscUtils.resolveAssetsPath((_this2$props$theme$ma=(_this2$props$theme$ma2=_this2.props.theme.map3d)===null||_this2$props$theme$ma2===void 0||(_this2$props$theme$ma2=_this2$props$theme$ma2.dtm)===null||_this2$props$theme$ma2===void 0?void 0:_this2$props$theme$ma2.url)!==null&&_this2$props$theme$ma!==void 0?_this2$props$theme$ma:"");var demCrs=((_this2$props$theme$ma3=_this2.props.theme.map3d)===null||_this2$props$theme$ma3===void 0||(_this2$props$theme$ma3=_this2$props$theme$ma3.dtm)===null||_this2$props$theme$ma3===void 0?void 0:_this2$props$theme$ma3.crs)||"EPSG:3857";if(demUrl){var _this2$props$theme$ma4,_this2$props$theme$ma5;var demSource=new GeoTIFFSource({url:demUrl,crs:demCrs});var demMin=(_this2$props$theme$ma4=_this2.props.theme.map3d.dtm.min)!==null&&_this2$props$theme$ma4!==void 0?_this2$props$theme$ma4:undefined;var demMax=(_this2$props$theme$ma5=_this2.props.theme.map3d.dtm.max)!==null&&_this2$props$theme$ma5!==void 0?_this2$props$theme$ma5:undefined;var elevationLayer=new ElevationLayer({name:"dem",extent:extent,source:demSource,minmax:demMin!==undefined&&demMax!==undefined?{demMin:demMin,demMax:demMax}:undefined});_this2.addLayer("__dtm",elevationLayer)}// Collect baselayers
15
15
  var visibleBaseLayer=null;var baseLayers=(((_this2$props$theme$ma6=_this2.props.theme.map3d)===null||_this2$props$theme$ma6===void 0?void 0:_this2$props$theme$ma6.basemaps)||[]).map(function(e){var baseLayer=_objectSpread(_objectSpread({},_this2.props.layers.find(function(bl){return bl.name===e.name})),{},{visibility:e.visibility===true});if(baseLayer.visibility){visibleBaseLayer=baseLayer}return baseLayer});if(visibleBaseLayer){_this2.setBaseLayer(visibleBaseLayer,true)}// Collect color layers
16
16
  var colorLayers=_this2.collectColorLayers([]);// Add 3d tiles
17
- _this2.objectMap={};var sceneObjects={};(((_this2$props$theme$ma7=_this2.props.theme.map3d)===null||_this2$props$theme$ma7===void 0?void 0:_this2$props$theme$ma7.tiles3d)||[]).forEach(function(entry){var _entry$title;var tilesUrl=entry.url;if(tilesUrl.startsWith(":")){tilesUrl=location.href.split("?")[0]+ConfigUtils.getAssetsPath()+tilesUrl.substr(1)}var tiles=new Tiles3D({url:tilesUrl});tiles.tiles.addEventListener("load-model",function(_ref7){var scene=_ref7.scene;return Tiles3DStyle.applyDeclarativeStyle(scene,entry)});tiles.castShadow=true;tiles.receiveShadow=true;tiles.userData.layertree=true;_this2.instance.add(tiles);_this2.objectMap[entry.name]=tiles;sceneObjects[entry.name]={visibility:true,opacity:255,layertree:true,title:(_entry$title=entry.title)!==null&&_entry$title!==void 0?_entry$title:entry.name}});_this2.setState(function(state){return{sceneContext:_objectSpread(_objectSpread({},state.sceneContext),{},{scene:_this2.instance,map:_this2.map,mapCrs:projection,dtmUrl:demUrl,dtmCrs:demCrs,baseLayers:baseLayers,colorLayers:colorLayers,sceneObjects:sceneObjects}),sceneId:uuidv4()}});// Inspector
18
- if(["1","true"].includes((UrlParams.getParam("inspector")||"").toLowerCase())){_this2.inspector=new Inspector(_this2.container.previousElementSibling,_this2.instance)}});_defineProperty(_this2,"disposeInstance",function(){if(_this2.inspector){_this2.inspector.detach()}_this2.map.dispose({disposeLayers:true});Object.values(_this2.objectMap).forEach(function(object){_this2.instance.remove(object)});_this2.instance.dispose();_this2.inspector=null;_this2.map=null;_this2.objectMap={};_this2.sceneObjectGroup=null;_this2.instance=null;_this2.setState(function(state){return{sceneContext:_objectSpread(_objectSpread({},state.sceneContext),Map3D.defaultSceneState)}});_this2.props.setCurrentTask(null)});_defineProperty(_this2,"onUnload",function(key){// Ensure scene has not already been disposed
17
+ _this2.objectMap={};var sceneObjects={};(((_this2$props$theme$ma7=_this2.props.theme.map3d)===null||_this2$props$theme$ma7===void 0?void 0:_this2$props$theme$ma7.tiles3d)||[]).forEach(function(entry){if(entry.tilesetStyleUrl){axios.get(MiscUtils.resolveAssetsPath(entry.tilesetStyleUrl)).then(function(response){_this2.add3dTiles(_objectSpread(_objectSpread({},entry),{},{tilesetStyle:response.data}))})["catch"](function(){/* eslint-disable-next-line */console.warn("Failed to load tilset style");_this2.add3dTiles(entry)})}else{// Delay one cycle, to ensure setState below executed
18
+ setTimeout(function(){_this2.add3dTiles(entry)},0)}});_this2.setState(function(state){return{sceneContext:_objectSpread(_objectSpread({},state.sceneContext),{},{scene:_this2.instance,map:_this2.map,mapCrs:projection,dtmUrl:demUrl,dtmCrs:demCrs,baseLayers:baseLayers,colorLayers:colorLayers,sceneObjects:sceneObjects}),sceneId:uuidv4()}});// Inspector
19
+ if(["1","true"].includes((UrlParams.getParam("inspector")||"").toLowerCase())){_this2.inspector=new Inspector(_this2.container.previousElementSibling,_this2.instance)}});_defineProperty(_this2,"add3dTiles",function(entry){var tiles=new Tiles3D({url:MiscUtils.resolveAssetsPath(entry.url),errorTarget:32});tiles.tiles.addEventListener("load-model",function(_ref7){var _entry$idAttr;var scene=_ref7.scene;scene.userData.tilesetName=entry.name;scene.userData.batchIdAttr=(_entry$idAttr=entry.idAttr)!==null&&_entry$idAttr!==void 0?_entry$idAttr:"id";Tiles3DStyle.handleModelLoad(scene,entry)});tiles.tiles.addEventListener("tile-visibility-change",function(_ref8){var scene=_ref8.scene,visible=_ref8.visible;Tiles3DStyle.handleTileVisibilityChange(scene,visible)});tiles.castShadow=true;tiles.receiveShadow=true;tiles.userData.layertree=true;_this2.instance.add(tiles);_this2.objectMap[entry.name]=tiles;_this2.setState(function(state){var _entry$title;var objectState={visibility:true,opacity:255,layertree:true,title:(_entry$title=entry.title)!==null&&_entry$title!==void 0?_entry$title:entry.name};return{sceneContext:_objectSpread(_objectSpread({},state.sceneContext),{},{sceneObjects:_objectSpread(_objectSpread({},state.sceneContext.sceneObjects),{},_defineProperty({},entry.name,objectState))})}})});_defineProperty(_this2,"disposeInstance",function(){if(_this2.inspector){_this2.inspector.detach()}_this2.map.dispose({disposeLayers:true});Object.values(_this2.objectMap).forEach(function(object){_this2.instance.remove(object)});_this2.instance.dispose();_this2.inspector=null;_this2.map=null;_this2.objectMap={};_this2.sceneObjectGroup=null;_this2.instance=null;_this2.setState(function(state){return{sceneContext:_objectSpread(_objectSpread({},state.sceneContext),Map3D.defaultSceneState)}});_this2.props.setCurrentTask(null)});_defineProperty(_this2,"onUnload",function(key){// Ensure scene has not already been disposed
19
20
  if(_this2.state.sceneId===key){_this2.disposeInstance()}});_defineProperty(_this2,"setupControls",function(instance){_this2.setState(function(state){return{sceneContext:_objectSpread(_objectSpread({},state.sceneContext),{},{setViewToExtent:instance===null||instance===void 0?void 0:instance.setViewToExtent})}},_this2.props.onMapInitialized)});_defineProperty(_this2,"getTerrainHeightFromDTM",function(scenePos){var returnArray=true;if(!Array.isArray(scenePos[0])){returnArray=false;scenePos=[scenePos]}var dtmPos=scenePos.map(function(p){return CoordinatesUtils.reproject(p,_this2.state.sceneContext.mapCrs,_this2.state.sceneContext.dtmCrs)});var dtmExt=[Infinity,Infinity,-Infinity,-Infinity];dtmPos.forEach(function(p){dtmExt[0]=Math.min(dtmExt[0],p[0]);dtmExt[1]=Math.min(dtmExt[1],p[1]);dtmExt[2]=Math.max(dtmExt[2],p[0]);dtmExt[3]=Math.max(dtmExt[3],p[1])});return new Promise(function(resolve){fromUrl(_this2.state.sceneContext.dtmUrl).then(function(tiff){tiff.getImage().then(function(image){var _image$fileDirectory=image.fileDirectory,ModelTiepoint=_image$fileDirectory.ModelTiepoint,ModelPixelScale=_image$fileDirectory.ModelPixelScale;// Extract scale and tiepoint values
20
- var _ref8=[ModelPixelScale[0],ModelPixelScale[1]],scaleX=_ref8[0],scaleY=_ref8[1];var _ref9=[ModelTiepoint[3],ModelTiepoint[4]],tiepointX=_ref9[0],tiepointY=_ref9[1];// Tiepoint world coordinates
21
+ var _ref9=[ModelPixelScale[0],ModelPixelScale[1]],scaleX=_ref9[0],scaleY=_ref9[1];var _ref10=[ModelTiepoint[3],ModelTiepoint[4]],tiepointX=_ref10[0],tiepointY=_ref10[1];// Tiepoint world coordinates
21
22
  // Calculate pixel indices (rounded to nearest integers)
22
23
  var minPixelX=Math.round((dtmExt[0]-tiepointX)/scaleX);var minPixelY=Math.round((tiepointY-dtmExt[3])/scaleY);// Inverted Y-axis in image
23
24
  var maxPixelY=Math.round((tiepointY-dtmExt[1])/scaleY)+1;// Inverted Y-axis in image
24
25
  var maxPixelX=Math.round((dtmExt[2]-tiepointX)/scaleX)+1;var width=maxPixelX-minPixelX;var height=maxPixelY-minPixelY;image.readRasters({window:[minPixelX,minPixelY,maxPixelX,maxPixelY]}).then(function(raster){if(!returnArray){resolve(raster[0][0])}else{var h=dtmPos.map(function(p){var x=Math.round((p[0]-dtmExt[0])/(dtmExt[2]-dtmExt[0])*(width-1));var y=Math.round((1-(p[1]-dtmExt[1])/(dtmExt[3]-dtmExt[1]))*(height-1));return raster[0][x+y*width]});resolve(h)}})})})})});_defineProperty(_this2,"getTerrainHeightFromMap",function(scenePos){var _elevationResult$samp;var coordinates=new Coordinates(_this2.state.sceneContext.mapCrs,scenePos[0],scenePos[1],0);var elevationResult=_this2.state.sceneContext.map.getElevation({coordinates:coordinates});elevationResult.samples.sort(function(a,b){return b.resolution-a.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
25
- var intersectionObjects=objects?Object.entries(_this2.state.sceneContext.sceneObjects).map(function(_ref10){var _ref11=_slicedToArray(_ref10,2),objId=_ref11[0],options=_ref11[1];if(options.layertree&&options.visibility){var _obj$tiles$group,_obj$tiles;var obj=_this2.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):null;var objInter=objects?raycaster.intersectObjects(intersectionObjects,true)[0]:undefined;// Query highest resolution terrain tile (i.e. tile with no children)
26
+ var intersectionObjects=objects?Object.entries(_this2.state.sceneContext.sceneObjects).map(function(_ref11){var _ref12=_slicedToArray(_ref11,2),objId=_ref12[0],options=_ref12[1];if(options.layertree&&options.visibility){var _obj$tiles$group,_obj$tiles;var obj=_this2.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):null;var objInter=objects?raycaster.intersectObjects(intersectionObjects,true)[0]:undefined;// Query highest resolution terrain tile (i.e. tile with no children)
26
27
  var terrInter=raycaster.intersectObjects([_this2.map.object3d]).filter(function(result){return result.object.children.length===0})[0];// Return closest result
27
- if(objInter&&terrInter){return objInter.distance<terrInter.distance?objInter:terrInter}return objInter!==null&&objInter!==void 0?objInter:terrInter});_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(_ref12){var _ref13=_slicedToArray(_ref12,2),objectId=_ref13[0],entry=_ref13[1];if(!entry.layertree){return null}return new Promise(function(resolve){if(entry.drawGroup){var exporter=new GLTFExporter;exporter.parse(_this2.state.sceneContext.getSceneObject(objectId),function(result){resolve({id:objectId,options:entry,data:result})})}else{resolve({id:objectId,options:entry})}})}).filter(Boolean);return new Promise(function(resolve){Promise.all(promises).then(function(objects){var cameraPos=_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(_ref14){var _ref15=_slicedToArray(_ref14,2),layerId=_ref15[0],options=_ref15[1];return{id:layerId,options:{visibility:options.visibility,opacity:options.opacity,extrusionHeight:options.extrusionHeight}}});resolve({objects:objects,colorLayers:layers,cameraPos:[cameraPos.x,cameraPos.y,cameraPos.z],center:[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(obj){if(obj.isMesh){obj.castShadow=true;obj.receiveShadow=true}});_this2.state.sceneContext.addSceneObject(item.id,gltf.scene,item.options)})}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)}});if(data.cameraPos&&data.center){var cameraPos=_this2.state.sceneContext.scene.view.camera.position;cameraPos.x=data.cameraPos[0];cameraPos.y=data.cameraPos[1];cameraPos.z=data.cameraPos[2];var controlsTarget=_this2.state.sceneContext.scene.view.controls.target;controlsTarget.x=data.center[0];controlsTarget.y=data.center[1];controlsTarget.z=data.center[2]}_this2.state.sceneContext.scene.notifyChange()});_this2.container=null;_this2.inspector=null;_this2.instance=null;_this2.map=null;_this2.sceneObjectGroup=null;_this2.objectMap={};_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.addSceneObject=_this2.addSceneObject;_this2.state.sceneContext.getSceneObject=_this2.getSceneObject;_this2.state.sceneContext.removeSceneObject=_this2.removeSceneObject;_this2.state.sceneContext.updateSceneObject=_this2.updateSceneObject;_this2.state.sceneContext.getMap=_this2.getMap;_this2.state.sceneContext.getTerrainHeightFromDTM=_this2.getTerrainHeightFromDTM;_this2.state.sceneContext.getTerrainHeightFromMap=_this2.getTerrainHeightFromMap;_this2.state.sceneContext.getSceneIntersection=_this2.getSceneIntersection;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
28
+ if(objInter&&terrInter){return objInter.distance<terrInter.distance?objInter:terrInter}return objInter!==null&&objInter!==void 0?objInter:terrInter});_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(_ref13){var _ref14=_slicedToArray(_ref13,2),objectId=_ref14[0],entry=_ref14[1];if(!entry.layertree){return null}return new Promise(function(resolve){if(entry.drawGroup){var exporter=new GLTFExporter;exporter.parse(_this2.state.sceneContext.getSceneObject(objectId),function(result){resolve({id:objectId,options:entry,data:result})})}else{resolve({id:objectId,options:entry})}})}).filter(Boolean);return new Promise(function(resolve){Promise.all(promises).then(function(objects){var cameraPos=_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(_ref15){var _ref16=_slicedToArray(_ref15,2),layerId=_ref16[0],options=_ref16[1];return{id:layerId,options:{visibility:options.visibility,opacity:options.opacity,extrusionHeight:options.extrusionHeight}}});resolve({objects:objects,colorLayers:layers,cameraPos:[cameraPos.x,cameraPos.y,cameraPos.z],center:[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(obj){if(obj.isMesh){obj.castShadow=true;obj.receiveShadow=true}});_this2.state.sceneContext.addSceneObject(item.id,gltf.scene,item.options)})}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)}});if(data.cameraPos&&data.center){var cameraPos=_this2.state.sceneContext.scene.view.camera.position;cameraPos.x=data.cameraPos[0];cameraPos.y=data.cameraPos[1];cameraPos.z=data.cameraPos[2];var controlsTarget=_this2.state.sceneContext.scene.view.controls.target;controlsTarget.x=data.center[0];controlsTarget.y=data.center[1];controlsTarget.z=data.center[2]}_this2.state.sceneContext.scene.notifyChange()});_this2.container=null;_this2.inspector=null;_this2.instance=null;_this2.map=null;_this2.sceneObjectGroup=null;_this2.objectMap={};_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.addSceneObject=_this2.addSceneObject;_this2.state.sceneContext.getSceneObject=_this2.getSceneObject;_this2.state.sceneContext.removeSceneObject=_this2.removeSceneObject;_this2.state.sceneContext.updateSceneObject=_this2.updateSceneObject;_this2.state.sceneContext.getMap=_this2.getMap;_this2.state.sceneContext.getTerrainHeightFromDTM=_this2.getTerrainHeightFromDTM;_this2.state.sceneContext.getTerrainHeightFromMap=_this2.getTerrainHeightFromMap;_this2.state.sceneContext.getSceneIntersection=_this2.getSceneIntersection;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
28
29
  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
29
- if(this.state.sceneContext.sceneObjects!==prevState.sceneContext.sceneObjects){this.applySceneObjectUpdates(this.state.sceneContext.sceneObjects)}}},{key:"render",value:function render(){var baseLayer=this.state.sceneContext.baseLayers.find(function(l){return l.visibility===true});var style={marginTop:this.props.mapMargins.top,marginRight:this.props.mapMargins.right,marginBottom:this.props.mapMargins.bottom,marginLeft:this.props.mapMargins.left};return/*#__PURE__*/React.createElement("div",{className:"map3d-body"},/*#__PURE__*/React.createElement("div",{className:"map3d-inspector"}),/*#__PURE__*/React.createElement("div",{className:"map3d-map",onMouseDown:this.stopAnimations,ref:this.setupContainer,style:style}),/*#__PURE__*/React.createElement(View3DSwitcher,{position:2}),this.state.sceneContext.scene?/*#__PURE__*/React.createElement(UnloadWrapper,{key:this.state.sceneId,onUnload:this.onUnload,sceneId:this.state.sceneId},/*#__PURE__*/React.createElement(MapControls3D,{onControlsSet:this.setupControls,sceneContext:this.state.sceneContext}),/*#__PURE__*/React.createElement(BackgroundSwitcher,{changeLayerVisibility:this.setBaseLayer,layers:this.state.sceneContext.baseLayers,mapMargins:this.props.mapMargins}),/*#__PURE__*/React.createElement(TopBar3D,{options:this.props.options,sceneContext:this.state.sceneContext,searchProviders:this.props.searchProviders}),/*#__PURE__*/React.createElement(LayerTree3D,{sceneContext:this.state.sceneContext}),/*#__PURE__*/React.createElement(BottomBar3D,{sceneContext:this.state.sceneContext}),/*#__PURE__*/React.createElement(OverviewMap3D,{baseLayer:baseLayer,sceneContext:this.state.sceneContext}),/*#__PURE__*/React.createElement(Map3DLight,{sceneContext:this.state.sceneContext}),/*#__PURE__*/React.createElement(Measure3D,{sceneContext:this.state.sceneContext}),/*#__PURE__*/React.createElement(Identify3D,{sceneContext:this.state.sceneContext}),/*#__PURE__*/React.createElement(Compare3D,{sceneContext:this.state.sceneContext}),/*#__PURE__*/React.createElement(Draw3D,{sceneContext:this.state.sceneContext}),/*#__PURE__*/React.createElement(MapExport3D,{sceneContext:this.state.sceneContext}),/*#__PURE__*/React.createElement(ExportObjects3D,{sceneContext:this.state.sceneContext}),/*#__PURE__*/React.createElement(HideObjects3D,{sceneContext:this.state.sceneContext})):null)}}])}(React.Component);_defineProperty(Map3D,"propTypes",{innerRef:PropTypes.func,layers:PropTypes.array,mapMargins:PropTypes.object,onMapInitialized:PropTypes.func,options:PropTypes.object,searchProviders:PropTypes.object,setCurrentTask:PropTypes.func,theme:PropTypes.object});_defineProperty(Map3D,"defaultProps",{geometry:{initialWidth:600,initialHeight:800,initialX:0,initialY:0,initiallyDocked:true},options:{searchMinScaleDenom:1000}});_defineProperty(Map3D,"defaultSceneState",{scene:null,map:null,mapCrs:null,dtmUrl:null,dtmCrs:null,baseLayers:[],colorLayers:{},sceneObjects:{}});export default connect(function(state){return{mapMargins:state.windows.mapMargins,theme:state.theme.current,layers:state.layers.flat}},{setCurrentTask:setCurrentTask})(Map3D);
30
+ if(this.state.sceneContext.sceneObjects!==prevState.sceneContext.sceneObjects){this.applySceneObjectUpdates(this.state.sceneContext.sceneObjects)}}},{key:"render",value:function render(){var baseLayer=this.state.sceneContext.baseLayers.find(function(l){return l.visibility===true});var style={marginTop:this.props.mapMargins.top,marginRight:this.props.mapMargins.right,marginBottom:this.props.mapMargins.bottom,marginLeft:this.props.mapMargins.left};return/*#__PURE__*/React.createElement("div",{className:"map3d-body"},/*#__PURE__*/React.createElement("div",{className:"map3d-inspector"}),/*#__PURE__*/React.createElement("div",{className:"map3d-map",onMouseDown:this.stopAnimations,ref:this.setupContainer,style:style}),/*#__PURE__*/React.createElement(View3DSwitcher,{position:2}),this.state.sceneContext.scene?/*#__PURE__*/React.createElement(UnloadWrapper,{key:this.state.sceneId,onUnload:this.onUnload,sceneId:this.state.sceneId},/*#__PURE__*/React.createElement(MapControls3D,{onControlsSet:this.setupControls,sceneContext:this.state.sceneContext}),/*#__PURE__*/React.createElement(BackgroundSwitcher,{changeLayerVisibility:this.setBaseLayer,layers:this.state.sceneContext.baseLayers,mapMargins:this.props.mapMargins}),/*#__PURE__*/React.createElement(TopBar3D,{options:this.props.options,sceneContext:this.state.sceneContext,searchProviders:this.props.searchProviders}),/*#__PURE__*/React.createElement(LayerTree3D,{sceneContext:this.state.sceneContext}),/*#__PURE__*/React.createElement(BottomBar3D,{sceneContext:this.state.sceneContext}),/*#__PURE__*/React.createElement(OverviewMap3D,{baseLayer:baseLayer,sceneContext:this.state.sceneContext}),/*#__PURE__*/React.createElement(Map3DLight,{sceneContext:this.state.sceneContext}),/*#__PURE__*/React.createElement(Measure3D,{sceneContext:this.state.sceneContext}),/*#__PURE__*/React.createElement(Identify3D,{sceneContext:this.state.sceneContext,tileInfoServiceUrl:this.props.options.tileInfoServiceUrl}),/*#__PURE__*/React.createElement(Compare3D,{sceneContext:this.state.sceneContext}),/*#__PURE__*/React.createElement(Draw3D,{sceneContext:this.state.sceneContext}),/*#__PURE__*/React.createElement(MapExport3D,{sceneContext:this.state.sceneContext}),/*#__PURE__*/React.createElement(ExportObjects3D,{sceneContext:this.state.sceneContext}),/*#__PURE__*/React.createElement(HideObjects3D,{sceneContext:this.state.sceneContext})):null)}}])}(React.Component);_defineProperty(Map3D,"propTypes",{innerRef:PropTypes.func,layers:PropTypes.array,mapMargins:PropTypes.object,onMapInitialized:PropTypes.func,options:PropTypes.object,searchProviders:PropTypes.object,setCurrentTask:PropTypes.func,theme:PropTypes.object});_defineProperty(Map3D,"defaultProps",{geometry:{initialWidth:600,initialHeight:800,initialX:0,initialY:0,initiallyDocked:true},options:{searchMinScaleDenom:1000}});_defineProperty(Map3D,"defaultSceneState",{scene:null,map:null,mapCrs:null,dtmUrl:null,dtmCrs:null,baseLayers:[],colorLayers:{},sceneObjects:{}});export default connect(function(state){return{mapMargins:state.windows.mapMargins,theme:state.theme.current,layers:state.layers.flat}},{setCurrentTask:setCurrentTask})(Map3D);
@@ -1,15 +1,17 @@
1
- function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof(o)}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o)}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e))}function _possibleConstructorReturn(t,e){if(e&&("object"==_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t})()}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_getPrototypeOf(t)}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e)}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_setPrototypeOf(t,e)}function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+""}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}/**
1
+ function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof(o)}function _toConsumableArray(r){return _arrayWithoutHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0}}function _iterableToArray(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r)}function _arrayWithoutHoles(r){if(Array.isArray(r))return _arrayLikeToArray(r)}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o)}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e))}function _possibleConstructorReturn(t,e){if(e&&("object"==_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t})()}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_getPrototypeOf(t)}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e)}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_setPrototypeOf(t,e)}function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+""}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}/**
2
2
  * Copyright 2024 Sourcepole AG
3
3
  * All rights reserved.
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 ColorLayer from"@giro3d/giro3d/core/layer/ColorLayer";import Shape from"@giro3d/giro3d/entities/Shape";import DrawTool,{conditions}from"@giro3d/giro3d/interactions/DrawTool.js";import VectorSource from"@giro3d/giro3d/sources/VectorSource";import ol from"openlayers";import pointInPolygon from"point-in-polygon";import PropTypes from"prop-types";import{CurvePath,LineCurve,Vector2,Vector3}from"three";import ConfigUtils from"../../utils/ConfigUtils";import CoordinatesUtils from"../../utils/CoordinatesUtils";import LocaleUtils from"../../utils/LocaleUtils";import MeasureUtils from"../../utils/MeasureUtils";import TaskBar from"../TaskBar";import ButtonBar from"../widgets/ButtonBar";import CopyButton from"../widgets/CopyButton";import HeightProfile3D from"./HeightProfile3D";import"../../plugins/style/Measure.css";var Measure3D=/*#__PURE__*/function(_React$Component){function Measure3D(props){var _this;_classCallCheck(this,Measure3D);_this=_callSuper(this,Measure3D,[props]);_defineProperty(_this,"state",{mode:null,result:null,lenUnit:"metric",areaUnit:"metric",elevUnit:"absolute"});_defineProperty(_this,"onShow",function(mode){_this.setState({mode:mode!==null&&mode!==void 0?mode:"Point"});_this.abortController=new AbortController;_this.measureTool=new DrawTool({instance:_this.props.sceneContext.scene});_this.drawLayer=new ColorLayer({source:new VectorSource({data:[],format:new ol.format.GeoJSON,style:_this.featureStyleFunction})});_this.props.sceneContext.map.addLayer(_this.drawLayer)});_defineProperty(_this,"onHide",function(){_this.clearResult();_this.setState({mode:null});_this.abortController.abort();_this.abortController=null;_this.measureTool.dispose();_this.measureTool=null;_this.props.sceneContext.map.removeLayer(_this.drawLayer,{dispose:true});_this.drawLayer=null});_defineProperty(_this,"renderModeSwitcher",function(){var buttons=[{key:"Point",label:LocaleUtils.tr("measureComponent.pointLabel")},{key:"LineString",label:LocaleUtils.tr("measureComponent.lengthLabel")},{key:"Polygon",label:LocaleUtils.tr("measureComponent.areaLabel")}];return/*#__PURE__*/React.createElement(ButtonBar,{active:_this.state.mode,buttons:buttons,onClick:function onClick(mode){return _this.setState({mode:mode,result:null})}})});_defineProperty(_this,"renderResult",function(){if(!_this.state.result){return null}var text="";var unitSelector=null;if(_this.state.mode==="Point"){text=CoordinatesUtils.getFormattedCoordinate(_this.state.result.pos.slice(0,2),_this.props.sceneContext.mapCrs);var prec=ConfigUtils.getConfigProp("measurementPrecision");text+=", "+(_this.state.result.ground>0&&_this.state.elevUnit==="ground"?_this.state.result.ground:_this.state.result.pos[2]).toFixed(prec);if(_this.state.result.ground>0){unitSelector=/*#__PURE__*/React.createElement("select",{onChange:function onChange(ev){return _this.setState({elevUnit:ev.target.value})},value:_this.state.elevUnit},/*#__PURE__*/React.createElement("option",{value:"ground"},LocaleUtils.tr("measureComponent.ground")),/*#__PURE__*/React.createElement("option",{value:"absolute"},LocaleUtils.tr("measureComponent.absolute")))}else{unitSelector=/*#__PURE__*/React.createElement("span",{className:"measure-unit-label"},LocaleUtils.tr("measureComponent.absolute"))}}else if(_this.state.mode==="LineString"){text=MeasureUtils.formatMeasurement(_this.state.result.length,false,_this.state.lenUnit);unitSelector=/*#__PURE__*/React.createElement("select",{onChange:function onChange(ev){return _this.setState({lenUnit:ev.target.value})},value:_this.state.lenUnit},/*#__PURE__*/React.createElement("option",{value:"metric"},LocaleUtils.tr("measureComponent.metric")),/*#__PURE__*/React.createElement("option",{value:"imperial"},LocaleUtils.tr("measureComponent.imperial")),/*#__PURE__*/React.createElement("option",{value:"m"},"m"),/*#__PURE__*/React.createElement("option",{value:"km"},"km"),/*#__PURE__*/React.createElement("option",{value:"ft"},"ft"),/*#__PURE__*/React.createElement("option",{value:"mi"},"mi"))}else if(_this.state.mode==="Polygon"){text=MeasureUtils.formatMeasurement(_this.state.result,true,_this.state.areaUnit);unitSelector=/*#__PURE__*/React.createElement("select",{onChange:function onChange(ev){return _this.setState({areaUnit:ev.target.value})},value:_this.state.areaUnit},/*#__PURE__*/React.createElement("option",{value:"metric"},LocaleUtils.tr("measureComponent.metric")),/*#__PURE__*/React.createElement("option",{value:"imperial"},LocaleUtils.tr("measureComponent.imperial")),/*#__PURE__*/React.createElement("option",{value:"sqm"},"m\xB2"),/*#__PURE__*/React.createElement("option",{value:"ha"},"ha"),/*#__PURE__*/React.createElement("option",{value:"sqkm"},"km\xB2"),/*#__PURE__*/React.createElement("option",{value:"sqft"},"ft\xB2"),/*#__PURE__*/React.createElement("option",{value:"acre"},"acre"),/*#__PURE__*/React.createElement("option",{value:"sqmi"},"mi\xB2"))}return/*#__PURE__*/React.createElement("div",{className:"controlgroup"},/*#__PURE__*/React.createElement("input",{className:"measure-result",readOnly:true,type:"text",value:text}),unitSelector,/*#__PURE__*/React.createElement(CopyButton,{text:text}))});_defineProperty(_this,"featureStyleFunction",function(){return[new ol.style.Style({fill:new ol.style.Fill({color:[41,120,180,0.5]})}),new ol.style.Style({stroke:new ol.style.Stroke({color:[255,255,255],width:4})}),new ol.style.Style({stroke:new ol.style.Stroke({color:[41,120,180],width:1.5})})]});_defineProperty(_this,"clearResult",function(){_this.drawLayer.source.clear();_this.measurementObjects.forEach(function(object){_this.props.sceneContext.scene.remove(object)});_this.measurementObjects=[];_this.setState({result:null})});_defineProperty(_this,"restart",function(){if(_this.abortController){_this.abortController.abort()}_this.abortController=new AbortController;var pick=_this.state.mode==="Point"?null// default pick
8
- :function(e){return _this.props.sceneContext.scene.pickObjectsAt(e,{sortByDistance:true,where:[_this.props.sceneContext.getMap()]})};var options={signal:_this.abortController.signal,endCondition:conditions.doubleClick,pick:pick};if(_this.state.mode==="Point"){_this.measureTool.createPoint(options).then(_this.measurePoint)["catch"](function(){})}else if(_this.state.mode==="LineString"){_this.measureTool.createLineString(options).then(_this.measureLine)["catch"](function(){})}else if(_this.state.mode==="Polygon"){_this.measureTool.createPolygon(options).then(_this.measureArea)["catch"](function(){})}else if(_this.state.mode==="Height"){_this.measureTool.createVerticalMeasure(options).then(_this.measureHeight)["catch"](function(){})}});_defineProperty(_this,"measurePoint",function(point){if(point===null){_this.restart();return}_this.clearResult();var pos=point.points[0];// Measure point above terrain
9
- _this.props.sceneContext.getTerrainHeightFromDTM([pos.x,pos.y]).then(function(elevation){var ground=pos.z-elevation>0.3?pos.z-elevation:0;var elevationLabelFormatter=function elevationLabelFormatter(options){if(options.index===0){return MeasureUtils.formatMeasurement(elevation,false,LocaleUtils.tr("measureComponent.absolute"))}else if(ground>0&&_this.state.elevUnit==="ground"){return MeasureUtils.formatMeasurement(pos.z-elevation,false,LocaleUtils.tr("measureComponent.ground"))}else{return MeasureUtils.formatMeasurement(pos.z,false,LocaleUtils.tr("measureComponent.absolute"))}};var shape=null;if(ground>0){// Add line
7
+ */import React from"react";import ColorLayer from"@giro3d/giro3d/core/layer/ColorLayer";import Shape from"@giro3d/giro3d/entities/Shape";import DrawTool,{conditions}from"@giro3d/giro3d/interactions/DrawTool.js";import VectorSource from"@giro3d/giro3d/sources/VectorSource";import ol from"openlayers";import pointInPolygon from"point-in-polygon";import PropTypes from"prop-types";import{CurvePath,LineCurve,Vector2,Vector3}from"three";import ConfigUtils from"../../utils/ConfigUtils";import CoordinatesUtils from"../../utils/CoordinatesUtils";import LocaleUtils from"../../utils/LocaleUtils";import MeasureUtils from"../../utils/MeasureUtils";import TaskBar from"../TaskBar";import ButtonBar from"../widgets/ButtonBar";import CopyButton from"../widgets/CopyButton";import HeightProfile3D from"./HeightProfile3D";import"../../plugins/style/Measure.css";var Measure3D=/*#__PURE__*/function(_React$Component){function Measure3D(props){var _this;_classCallCheck(this,Measure3D);_this=_callSuper(this,Measure3D,[props]);_defineProperty(_this,"state",{mode:null,result:null,lenUnit:"metric",areaUnit:"metric",elevUnit:"absolute"});_defineProperty(_this,"onShow",function(mode){_this.setState({mode:mode!==null&&mode!==void 0?mode:"Point"});_this.abortController=new AbortController;_this.measureTool=new DrawTool({instance:_this.props.sceneContext.scene});_this.drawLayer=new ColorLayer({source:new VectorSource({data:[],format:new ol.format.GeoJSON,style:_this.featureStyleFunction})});_this.props.sceneContext.map.addLayer(_this.drawLayer)});_defineProperty(_this,"onHide",function(){_this.clearResult();_this.setState({mode:null});_this.abortController.abort();_this.abortController=null;_this.measureTool.dispose();_this.measureTool=null;_this.props.sceneContext.map.removeLayer(_this.drawLayer,{dispose:true});_this.drawLayer=null});_defineProperty(_this,"renderModeSwitcher",function(){var buttons=[{key:"Point",label:LocaleUtils.tr("measureComponent.pointLabel")},{key:"HeightDiff",label:LocaleUtils.tr("measureComponent.heightDiffLabel")},{key:"LineString",label:LocaleUtils.tr("measureComponent.lengthLabel")},{key:"Polygon",label:LocaleUtils.tr("measureComponent.areaLabel")}];return/*#__PURE__*/React.createElement(ButtonBar,{active:_this.state.mode,buttons:buttons,onClick:function onClick(mode){return _this.setState({mode:mode,result:null})}})});_defineProperty(_this,"renderResult",function(){if(!_this.state.result){return null}var text="";var unitSelector=null;if(_this.state.mode==="Point"){text=CoordinatesUtils.getFormattedCoordinate(_this.state.result.pos.slice(0,2),_this.props.sceneContext.mapCrs);var prec=ConfigUtils.getConfigProp("measurementPrecision");text+=", "+(_this.state.result.ground>0&&_this.state.elevUnit==="ground"?_this.state.result.ground:_this.state.result.pos[2]).toFixed(prec);if(_this.state.result.ground>0){unitSelector=/*#__PURE__*/React.createElement("select",{onChange:function onChange(ev){return _this.setState({elevUnit:ev.target.value})},value:_this.state.elevUnit},/*#__PURE__*/React.createElement("option",{value:"ground"},LocaleUtils.tr("measureComponent.ground")),/*#__PURE__*/React.createElement("option",{value:"absolute"},LocaleUtils.tr("measureComponent.absolute")))}else{unitSelector=/*#__PURE__*/React.createElement("span",{className:"measure-unit-label"},LocaleUtils.tr("measureComponent.absolute"))}}else if(_this.state.mode==="HeightDiff"){text=(_this.state.result||[]).length===2?MeasureUtils.formatMeasurement(Math.abs(_this.state.result[1].z-_this.state.result[0].z),false,_this.state.lenUnit):"";unitSelector=/*#__PURE__*/React.createElement("select",{onChange:function onChange(ev){return _this.setState({lenUnit:ev.target.value})},value:_this.state.lenUnit},/*#__PURE__*/React.createElement("option",{value:"metric"},LocaleUtils.tr("measureComponent.metric")),/*#__PURE__*/React.createElement("option",{value:"imperial"},LocaleUtils.tr("measureComponent.imperial")),/*#__PURE__*/React.createElement("option",{value:"m"},"m"),/*#__PURE__*/React.createElement("option",{value:"km"},"km"),/*#__PURE__*/React.createElement("option",{value:"ft"},"ft"),/*#__PURE__*/React.createElement("option",{value:"mi"},"mi"))}else if(_this.state.mode==="LineString"){text=MeasureUtils.formatMeasurement(_this.state.result.length,false,_this.state.lenUnit);unitSelector=/*#__PURE__*/React.createElement("select",{onChange:function onChange(ev){return _this.setState({lenUnit:ev.target.value})},value:_this.state.lenUnit},/*#__PURE__*/React.createElement("option",{value:"metric"},LocaleUtils.tr("measureComponent.metric")),/*#__PURE__*/React.createElement("option",{value:"imperial"},LocaleUtils.tr("measureComponent.imperial")),/*#__PURE__*/React.createElement("option",{value:"m"},"m"),/*#__PURE__*/React.createElement("option",{value:"km"},"km"),/*#__PURE__*/React.createElement("option",{value:"ft"},"ft"),/*#__PURE__*/React.createElement("option",{value:"mi"},"mi"))}else if(_this.state.mode==="Polygon"){text=MeasureUtils.formatMeasurement(_this.state.result,true,_this.state.areaUnit);unitSelector=/*#__PURE__*/React.createElement("select",{onChange:function onChange(ev){return _this.setState({areaUnit:ev.target.value})},value:_this.state.areaUnit},/*#__PURE__*/React.createElement("option",{value:"metric"},LocaleUtils.tr("measureComponent.metric")),/*#__PURE__*/React.createElement("option",{value:"imperial"},LocaleUtils.tr("measureComponent.imperial")),/*#__PURE__*/React.createElement("option",{value:"sqm"},"m\xB2"),/*#__PURE__*/React.createElement("option",{value:"ha"},"ha"),/*#__PURE__*/React.createElement("option",{value:"sqkm"},"km\xB2"),/*#__PURE__*/React.createElement("option",{value:"sqft"},"ft\xB2"),/*#__PURE__*/React.createElement("option",{value:"acre"},"acre"),/*#__PURE__*/React.createElement("option",{value:"sqmi"},"mi\xB2"))}return/*#__PURE__*/React.createElement("div",{className:"controlgroup"},/*#__PURE__*/React.createElement("input",{className:"measure-result",readOnly:true,type:"text",value:text}),unitSelector,/*#__PURE__*/React.createElement(CopyButton,{text:text}))});_defineProperty(_this,"featureStyleFunction",function(){return[new ol.style.Style({fill:new ol.style.Fill({color:[41,120,180,0.5]})}),new ol.style.Style({stroke:new ol.style.Stroke({color:[255,255,255],width:4})}),new ol.style.Style({stroke:new ol.style.Stroke({color:[41,120,180],width:1.5})})]});_defineProperty(_this,"clearResult",function(){_this.drawLayer.source.clear();_this.measurementObjects.forEach(function(object){_this.props.sceneContext.scene.remove(object)});_this.measurementObjects=[];_this.setState({result:null})});_defineProperty(_this,"restart",function(){if(_this.abortController){_this.abortController.abort()}_this.abortController=new AbortController;var terrainPick=function terrainPick(e){return _this.props.sceneContext.scene.pickObjectsAt(e,{sortByDistance:true,where:[_this.props.sceneContext.getMap()]})};var options={signal:_this.abortController.signal,endCondition:conditions.doubleClick,pick:null// default pick
8
+ };if(_this.state.mode==="Point"){_this.measureTool.createPoint(options).then(_this.measurePoint)["catch"](function(){})}else if(_this.state.mode==="LineString"){options.pick=terrainPick;_this.measureTool.createLineString(options).then(_this.measureLine)["catch"](function(){})}else if(_this.state.mode==="Polygon"){options.pick=terrainPick;_this.measureTool.createPolygon(options).then(_this.measureArea)["catch"](function(){})}else if(_this.state.mode==="HeightDiff"){_this.measureTool.createPoint(options).then(_this.measureHeightDiff)["catch"](function(){})}});_defineProperty(_this,"measurePoint",function(point){if(point===null){_this.restart();return}_this.clearResult();var pos=point.points[0];// Measure point above terrain
9
+ _this.props.sceneContext.getTerrainHeightFromDTM([pos.x,pos.y]).then(function(elevation){var ground=pos.z-elevation>0.3?pos.z-elevation:0;var elevationLabelFormatter=function elevationLabelFormatter(options){if(options.index===0){return MeasureUtils.formatMeasurement(elevation,false,"m")+" "+LocaleUtils.tr("measureComponent.absolute")}else if(ground>0&&_this.state.elevUnit==="ground"){return MeasureUtils.formatMeasurement(pos.z-elevation,false,"m")+" "+LocaleUtils.tr("measureComponent.ground")}else{return MeasureUtils.formatMeasurement(pos.z,false,LocaleUtils.tr("measureComponent.absolute"))}};var shape=null;if(ground>0){// Add line
10
10
  shape=new Shape({showVertexLabels:true,showLine:true,showVertices:true,vertexLabelFormatter:elevationLabelFormatter});shape.setPoints([new Vector3(pos.x,pos.y,elevation),pos])}else{// Add point
11
11
  shape=new Shape({showVertexLabels:true,showLine:false,showVertices:true,vertexLabelFormatter:elevationLabelFormatter});shape.setPoints([new Vector3(pos.x,pos.y,pos.z)])}_this.props.sceneContext.scene.add(shape);_this.measurementObjects.push(shape);_this.props.sceneContext.scene.remove(point);_this.setState({result:{pos:[pos.x,pos.y,pos.z],ground:ground}});// Setup for next measurement
12
- _this.restart()})});_defineProperty(_this,"measureLine",function(lineString){if(lineString===null){_this.restart();return}_this.clearResult();var features=new ol.format.GeoJSON().readFeatures(lineString.toGeoJSON(),{dataProjection:"EPSG:4326",featureProjection:_this.props.sceneContext.mapCrs});_this.drawLayer.source.addFeatures(features);_this.props.sceneContext.scene.remove(lineString);// Compute 2d length and nSamples spaced points
12
+ _this.restart()})});_defineProperty(_this,"measureHeightDiff",function(point){if(point===null){_this.restart();return}if((_this.state.result||[]).length>=2){_this.clearResult()}var pos=point.points[0];if((_this.state.result||[]).length===1){// Add line if two points drawn
13
+ var points=[_this.state.result[0],pos];if(points[0].z>points[1].z){points.reverse()}var line=new Shape({showVertexLabels:true,vertexLabelFormatter:function vertexLabelFormatter(options){return options.index===2?MeasureUtils.formatMeasurement(points[1].z-points[0].z,false,_this.state.lenUnit):null},showLine:true});line.setPoints([new Vector3(points[0].x,points[0].y,points[0].z),new Vector3(points[1].x,points[1].y,points[0].z),new Vector3(points[1].x,points[1].y,points[1].z)]);_this.props.sceneContext.scene.add(line);_this.measurementObjects.push(line)}else{// Add first drawn point
14
+ var shape=new Shape({showVertices:true});shape.setPoints([new Vector3(pos.x,pos.y,pos.z)]);_this.props.sceneContext.scene.add(shape);_this.measurementObjects.push(shape)}_this.props.sceneContext.scene.remove(point);_this.setState(function(state){return{result:[].concat(_toConsumableArray(state.result||[]),[{x:pos.x,y:pos.y,z:pos.z}])}});_this.restart()});_defineProperty(_this,"measureLine",function(lineString){if(lineString===null){_this.restart();return}_this.clearResult();var features=new ol.format.GeoJSON().readFeatures(lineString.toGeoJSON(),{dataProjection:"EPSG:4326",featureProjection:_this.props.sceneContext.mapCrs});_this.drawLayer.source.addFeatures(features);_this.props.sceneContext.scene.remove(lineString);// Compute 2d length and nSamples spaced points
13
15
  var path=new CurvePath;var len2d=0;for(var i=0;i<lineString.points.length-1;i++){var v0=lineString.points[i];var v1=lineString.points[i+1];var line=new LineCurve(new Vector2(v0.x,v0.y),new Vector2(v1.x,v1.y));path.add(line);len2d+=Math.sqrt((v1.x-v0.x)*(v1.x-v0.x)+(v1.y-v0.y)*(v1.y-v0.y))}var nSamples=Math.min(_this.props.maxSampleCount,Math.round(len2d/_this.props.minMeasureLength));var points=path.getSpacedPoints(nSamples-1).map(function(p){return[p.x,p.y]});_this.props.sceneContext.getTerrainHeightFromDTM(points).then(function(elevations){var line3d=points.map(function(p,i){return[p[0],p[1],elevations[i],0]});var len3d=0;for(var _i=1;_i<nSamples;++_i){var dx=line3d[_i][0]-line3d[_i-1][0];var dy=line3d[_i][1]-line3d[_i-1][1];var dz=line3d[_i][2]-line3d[_i-1][2];len3d+=Math.sqrt(dx*dx+dy*dy+dz*dz);line3d[_i][3]=len3d;// Also store incremental length for height profie
14
16
  }_this.setState({result:{length:len3d,profile:line3d}});// Setup for next measurement
15
17
  _this.restart()})});_defineProperty(_this,"measureArea",function(polygon){if(polygon===null){_this.restart();return}_this.clearResult();var features=new ol.format.GeoJSON().readFeatures(polygon.toGeoJSON(),{dataProjection:"EPSG:4326",featureProjection:_this.props.sceneContext.mapCrs});_this.drawLayer.source.addFeatures(features);_this.props.sceneContext.scene.remove(polygon);// Compute boundingbox of polygon, divide boundingbox into quads,
@@ -39,4 +39,13 @@ div.map3d-inspector {
39
39
 
40
40
  div.map3d-inspector input {
41
41
  color: black!important;
42
+ }
43
+
44
+ span.map3d-tile-batch-label {
45
+ background-color: rgba(41, 120, 180, 0.75);
46
+ border: 1px solid white;
47
+ color: white;
48
+ font-weight: bold;
49
+ padding: 0.25em 0.5em;
50
+ border-radius: 8px;
42
51
  }
@@ -1,7 +1,8 @@
1
1
  span.map3d-search-pin-label {
2
- -webkit-text-stroke: 0.8px black;
3
- text-stroke: 0.8px black;
2
+ background-color: rgba(41, 120, 180, 0.75);
3
+ border: 1px solid white;
4
4
  color: white;
5
5
  font-weight: bold;
6
- font-size: 16px;
6
+ padding: 0.25em 0.5em;
7
+ border-radius: 8px;
7
8
  }
@@ -1 +1,11 @@
1
- function _toConsumableArray(r){return _arrayWithoutHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0}}function _iterableToArray(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r)}function _arrayWithoutHoles(r){if(Array.isArray(r))return _arrayLikeToArray(r)}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n}import{Float32BufferAttribute}from"three";var Tiles3DStyle={getBatchColor:function getBatchColor(group,batchId){var _group$batchTable$get;var colorAttr=group.userData.batchColorAttr;if(!colorAttr){return 16777215}return(_group$batchTable$get=group.batchTable.getDataFromId(batchId)[colorAttr])!==null&&_group$batchTable$get!==void 0?_group$batchTable$get:16777215},applyDeclarativeStyle:function applyDeclarativeStyle(group,tilesetConfig){group.userData.batchColorAttr=tilesetConfig.colorAttr;var batchColorCache={};var batchColor=function batchColor(batchId){if(!batchColorCache[batchId]){var color=Tiles3DStyle.getBatchColor(group,batchId);var r=(color>>16&255)/255;var g=(color>>8&255)/255;var b=(color&255)/255;batchColorCache[batchId]=[r,g,b]}return batchColorCache[batchId]};group.traverse(function(c){if(c.geometry){if(tilesetConfig.colorAttr){var batchidAttr=c.geometry.getAttribute("_batchid");var colors=[];batchidAttr.array.forEach(function(batchId){colors.push.apply(colors,_toConsumableArray(batchColor(batchId)))});c.geometry.setAttribute("color",new Float32BufferAttribute(colors,3));c.material.vertexColors=true}}})}};export default Tiles3DStyle;
1
+ function _toConsumableArray(r){return _arrayWithoutHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0}}function _iterableToArray(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r)}function _arrayWithoutHoles(r){if(Array.isArray(r))return _arrayLikeToArray(r)}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n}/**
2
+ * Copyright 2025 Sourcepole AG
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */import isEmpty from"lodash.isempty";import parseCssColor from"parse-css-color";import{Float32BufferAttribute,Group,Vector3}from"three";import{CSS2DObject}from"three/addons/renderers/CSS2DRenderer";function createLabelObject(entry){var labelEl=document.createElement("span");labelEl.innerText=entry.label;labelEl.className="map3d-tile-batch-label";var label=new CSS2DObject(labelEl);label.position.copy(entry.pos);label.updateMatrixWorld();return label}function batchColor(batchId,batchAttr,config){var _config$tilesetStyle$,_config$tilesetStyle;if(((_config$tilesetStyle$=(_config$tilesetStyle=config.tilesetStyle)===null||_config$tilesetStyle===void 0||(_config$tilesetStyle=_config$tilesetStyle[batchId])===null||_config$tilesetStyle===void 0?void 0:_config$tilesetStyle.color)!==null&&_config$tilesetStyle$!==void 0?_config$tilesetStyle$:null)!==null){var color=parseCssColor(config.tilesetStyle[batchId].color);return[].concat(_toConsumableArray(color.values.map(function(c){return c/255})),[color.alpha])}else if(batchAttr[config.colorAttr]){var _batchAttr$config$alp;var _color=batchAttr[config.colorAttr];var alpha=config.alphaAttr?(_batchAttr$config$alp=batchAttr[config.alphaAttr])!==null&&_batchAttr$config$alp!==void 0?_batchAttr$config$alp:255:255;var r=(_color>>16&255)/255;var g=(_color>>8&255)/255;var b=(_color&255)/255;return[r,g,b,alpha/255]}else{return null}}function batchLabel(batchId,batchAttr,config){var _config$tilesetStyle$2,_config$tilesetStyle2;if(((_config$tilesetStyle$2=(_config$tilesetStyle2=config.tilesetStyle)===null||_config$tilesetStyle2===void 0||(_config$tilesetStyle2=_config$tilesetStyle2[batchId])===null||_config$tilesetStyle2===void 0?void 0:_config$tilesetStyle2.label)!==null&&_config$tilesetStyle$2!==void 0?_config$tilesetStyle$2:null)!==null){return config.tilesetStyle[batchId].label}else if(config.labelAttr){return batchAttr[config.labelAttr]}else{return null}}var Tiles3DStyle={handleModelLoad:function handleModelLoad(group,config){var _config$idAttr;var batchColorCache={};var batchLabelCache={};var labels={};var idAttr=(_config$idAttr=config.idAttr)!==null&&_config$idAttr!==void 0?_config$idAttr:"id";group.traverse(function(c){if(c.geometry){var batchidxAttr=c.geometry.getAttribute("_batchid");var batchPosAttr=c.geometry.getAttribute("position");var rgbaColors=[];var rgbColors=[];var haveColor=false;var haveAlpha=false;batchidxAttr.array.forEach(function(batchIdx,idx){var batchAttr=group.batchTable.getDataFromId(batchIdx);var batchId=String(batchAttr[idAttr]);// Handle color
8
+ var color=batchColorCache[batchIdx];if(color===undefined){color=batchColorCache[batchIdx]=batchColor(batchId,batchAttr,config)}if(color){haveColor=true;haveAlpha|=color[3]<1;rgbaColors.push.apply(rgbaColors,_toConsumableArray(color));rgbColors.push.apply(rgbColors,_toConsumableArray(color.slice(0,3)))}else{rgbaColors.push.apply(rgbaColors,[1,1,1,1]);rgbColors.push.apply(rgbColors,[1,1,1])}// Handle label
9
+ var label=batchLabelCache[batchIdx];if(label===undefined){label=batchLabelCache[batchIdx]=batchLabel(batchId,batchAttr,config)}if(label){var pos=batchPosAttr.array.slice(3*idx,3*idx+3);var entry=labels[batchIdx];if(!entry){entry=labels[batchIdx]={label:label,pos:pos,count:1,matrix:c.matrixWorld}}else{entry.pos[0]+=pos[0];entry.pos[1]+=pos[1];entry.pos[2]=Math.max(entry.pos[2],pos[2]);++entry.count}}});if(haveColor){if(haveAlpha){c.geometry.setAttribute("color",new Float32BufferAttribute(rgbaColors,4))}else{// Discard alpha
10
+ var count=rgbaColors.length/4;var bufAttr=new Float32BufferAttribute(count*3,3);for(var i=0,j=0;i<count;++i){bufAttr.array[j++]=rgbaColors[4*i];bufAttr.array[j++]=rgbaColors[4*i+1];bufAttr.array[j++]=rgbaColors[4*i+2]}c.geometry.setAttribute("color",bufAttr)}c.material.vertexColors=true;c.material.transparent=haveAlpha}}});if(!isEmpty(labels)){var tileLabels=[];var labelObjects=new Group;Object.values(labels).forEach(function(entry){var pos=new Vector3(entry.pos[0]/entry.count,entry.pos[1]/entry.count,entry.pos[2]+10).applyMatrix4(entry.matrix);tileLabels.push({pos:pos,label:entry.label});labelObjects.add(createLabelObject(tileLabels[tileLabels.length-1]))});group.userData.tileLabels=tileLabels;group.add(labelObjects)}},handleTileVisibilityChange:function handleTileVisibilityChange(group,visible){// Re-add labels
11
+ if(visible&&group.userData.tileLabels){var labelObjects=new Group;group.userData.tileLabels.forEach(function(entry){labelObjects.add(createLabelObject(entry))});group.add(labelObjects)}}};export default Tiles3DStyle;
@@ -6,7 +6,13 @@ div.AppMenu {
6
6
  overflow: hidden;
7
7
  display: flex;
8
8
  align-items: center;
9
+ justify-content: right;
9
10
  height: 100%;
11
+ flex: 0 1 20em;
12
+ }
13
+
14
+ div.AppMenu.appmenu-nolabel {
15
+ flex: 0 0 auto;
10
16
  }
11
17
 
12
18
  div.AppMenu.appmenu-visible {
@@ -15,23 +21,31 @@ div.AppMenu.appmenu-visible {
15
21
  overflow: visible;
16
22
  }
17
23
 
24
+ div.AppMenu .appmenu-button {
25
+ display: flex;
26
+ align-items: center;
27
+ }
28
+
18
29
  div.AppMenu .appmenu-label {
19
30
  font-weight: bold;
20
31
  transition: color 0.25s;
21
- width: 16.2em;
22
- display: inline-block;
32
+ color: var(--app-menu-text-color);
33
+ }
34
+
35
+ div.AppMenu.appmenu-visible .appmenu-label {
36
+ color: var(--app-submenu-text-color-hover);
23
37
  }
24
38
 
25
- div.AppMenu .appmenu-icon {
39
+ div.AppMenu .appmenu-icon > span.icon {
26
40
  color: var(--app-menu-text-color);
27
41
  padding: 0.25em;
28
42
  margin: 0 1em;
29
- width: 1.8em;
30
43
  border: 2px solid var(--app-menu-text-color);
31
44
  transition: color 0.25s, border-color 0.25s, background-color 0.25s;
32
45
  }
33
46
 
34
- div.AppMenu.appmenu-visible .appmenu-icon {
47
+
48
+ div.AppMenu.appmenu-visible .appmenu-icon > span.icon {
35
49
  color: var(--app-submenu-text-color-hover);
36
50
  border-color: var(--app-submenu-text-color-hover);
37
51
  background-color: inherit;
@@ -0,0 +1,214 @@
1
+ div.AttributeTable {
2
+ display: flex;
3
+ flex-direction: column;
4
+ height: 100%;
5
+ position: relative;
6
+ }
7
+
8
+ div.attribtable-overlay {
9
+ position: absolute;
10
+ left: 0;
11
+ right: 0;
12
+ top: 2.25em;
13
+ bottom: 0;
14
+ display: flex;
15
+ align-items: center;
16
+ justify-content: center;
17
+ background-color: rgba(200, 200, 200);
18
+ z-index: 4;
19
+ }
20
+
21
+ div.attribtable-overlay > div.spinner {
22
+ width: 4em;
23
+ height: 4em;
24
+ margin-right: 1em;
25
+ }
26
+
27
+ div.attribtable-toolbar {
28
+ display: flex;
29
+ align-items: center;
30
+ margin-bottom: 0.125em;
31
+ }
32
+
33
+ div.attribtable-toolbar > * {
34
+ margin: 0.125em;
35
+ }
36
+
37
+ div.attribtable-contents {
38
+ flex: 1 1 auto;
39
+ background-color: var(--list-bg-color);
40
+ overflow: auto;
41
+ border: 1px solid var(--border-color);
42
+ }
43
+
44
+ table.attribtable-table {
45
+ min-width: 100%;
46
+ }
47
+
48
+ table.attribtable-table th {
49
+ position: sticky;
50
+ top: 0;
51
+ z-index: 2;
52
+ padding: 0;
53
+ background-color: var(--button-bg-color);
54
+ color: var(--button-text-color);
55
+ box-shadow: inset -1px 0 0 var(--border-color),
56
+ inset 0 -1px 0 var(--border-color);
57
+ overflow: hidden;
58
+ }
59
+
60
+ table.attribtable-table th:first-child {
61
+ position: sticky;
62
+ left: 0;
63
+ z-index: 3;
64
+ width: 2em;
65
+ }
66
+
67
+ table.attribtable-table th > span {
68
+ margin: 0 0 -1px -1px;
69
+ padding: 0.25em;
70
+ display: flex;
71
+ align-items: center;
72
+ position: relative;
73
+ }
74
+
75
+ table.attribtable-table th > span > span.icon {
76
+ position: absolute;
77
+ right: 1px;
78
+ background-color: var(--button-bg-color);
79
+ }
80
+
81
+ span.attribtable-table-headername {
82
+ flex: 1 1 auto;
83
+ text-align: left;
84
+ }
85
+
86
+ table.attribtable-table th > span > span.icon {
87
+ flex: 0 0 auto;
88
+ margin-left: 0.5em;
89
+ }
90
+
91
+ table.attribtable-table tr:nth-child(even) {
92
+ background-color: var(--list-item-bg-color-even);
93
+ }
94
+
95
+ table.attribtable-table tr:hover:not(.row-disabled) {
96
+ background-color: var(--list-item-bg-color-hover);
97
+ color: var(--list-item-text-color-hover);
98
+ }
99
+
100
+ table.attribtable-table td:first-child {
101
+ background-color: var(--button-bg-color);
102
+ color: var(--button-text-color);
103
+ align-items: center;
104
+ padding: 0.25em 0.5em;
105
+ background-clip: padding-box;
106
+ position: sticky;
107
+ left: 0;
108
+ z-index: 1;
109
+ width: 2.5em;
110
+ }
111
+
112
+ span.attribtable-table-ldraghandle,
113
+ span.attribtable-table-rdraghandle {
114
+ display: block;
115
+ position: absolute;
116
+ width: 4px;
117
+ top: 0;
118
+ bottom: 0;
119
+ cursor: ew-resize;
120
+ }
121
+
122
+ span.attribtable-table-ldraghandle {
123
+ left: -1px;
124
+ }
125
+
126
+ span.attribtable-table-rdraghandle {
127
+ right: 0px;
128
+ }
129
+
130
+ span.attribtable-table-tdraghandle,
131
+ span.attribtable-table-bdraghandle {
132
+ display: block;
133
+ position: absolute;
134
+ height: 4px;
135
+ left: 0;
136
+ right: 0;
137
+ cursor: ns-resize;
138
+ }
139
+
140
+ span.attribtable-table-tdraghandle {
141
+ top: -1px;
142
+ }
143
+
144
+ span.attribtable-table-bdraghandle {
145
+ bottom: 0px;
146
+ }
147
+
148
+ table.attribtable-table {
149
+ table-layout: fixed;
150
+ width: 100%;
151
+ }
152
+
153
+ table.attribtable-table td {
154
+ border: 1px solid var(--border-color);
155
+ text-align: center;
156
+ height: 2em;
157
+ }
158
+
159
+ table.attribtable-table td:first-child {
160
+ border-left-width: 0;
161
+ }
162
+
163
+ table.attribtable-table td > input:not([type=checkbox]),
164
+ table.attribtable-table td > select,
165
+ table.attribtable-table td > div.TextInput,
166
+ table.attribtable-table td > div.number-input,
167
+ table.attribtable-table td > span.edit-upload-field,
168
+ table.attribtable-table td > span.edit-upload-field-input {
169
+ min-width: 100%;
170
+ width: 0;
171
+ border: none!important;
172
+ background-color: transparent!important;
173
+ margin: 0;
174
+ height: 100%;
175
+ }
176
+
177
+ table.attribtable-table td > div.TextInput,
178
+ table.attribtable-table td > div.TextInput > pre {
179
+ min-height: 2em;
180
+ }
181
+
182
+ table.attribtable-table td > *:disabled,
183
+ table.attribtable-table tr.row-disabled,
184
+ table.attribtable-table tr.row-disabled * {
185
+ color: var(--text-color-disabled);
186
+ cursor: not-allowed!important;
187
+ }
188
+
189
+ div.attribtable-footbar {
190
+ display: flex;
191
+ align-items: center;
192
+ }
193
+
194
+ div.attribtable-footbar > div {
195
+ margin: 0.25em;
196
+ }
197
+
198
+ div.attribtable-filter {
199
+ flex: 1 1 auto;
200
+ }
201
+
202
+ div.attribtable-filter div.TextInput {
203
+ flex: 1 1 auto;
204
+ }
205
+
206
+ body.ewresizing, body.ewresizing * {
207
+ cursor: ew-resize!important;
208
+ user-select: none;
209
+ }
210
+
211
+ body.nsresizing, body.nsresizing * {
212
+ cursor: ns-resize!important;
213
+ user-select: none;
214
+ }
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "qwc2",
3
- "version": "2025.04.10",
3
+ "version": "2025.04.22",
4
4
  "description": "QGIS Web Client",
5
5
  "author": "Sourcepole AG",
6
6
  "license": "BSD-2-Clause",
7
- "repository": "git@github.com:qgis/qwc2.git",
7
+ "repository": "git+ssh://git@github.com/qgis/qwc2.git",
8
8
  "homepage": "https://https://qwc-services.github.io/",
9
9
  "bugs": {
10
10
  "url": "https://github.com/qgis/qwc2/issues"
@@ -17,7 +17,7 @@
17
17
  ],
18
18
  "dependencies": {
19
19
  "@furkot/webfonts-generator": "^2.0.2",
20
- "@giro3d/giro3d": "^0.42.2",
20
+ "@giro3d/giro3d": "^0.42.4",
21
21
  "@kayahr/text-encoding": "^2.0.0",
22
22
  "@loaders.gl/core": "^4.3.3",
23
23
  "@loaders.gl/shapefile": "^4.3.3",
@@ -55,6 +55,7 @@
55
55
  "ol-ext": "^4.0.24",
56
56
  "ol-mapbox-style": "^12.3.5",
57
57
  "painterro": "^1.2.87",
58
+ "parse-css-color": "^0.2.1",
58
59
  "path-browserify": "^1.0.1",
59
60
  "pdf-lib": "^1.17.1",
60
61
  "pdfjs-dist": "^4.9.155",