qwc2 2025.8.14 → 2025.8.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/actions/localConfig.js +1 -1
- package/components/MessageBar.js +7 -0
- package/components/PluginsContainer.js +3 -2
- package/components/SideBar.js +3 -3
- package/components/StandardApp.js +2 -2
- package/components/TaskBar.js +2 -2
- package/components/map/OlMap.js +2 -2
- package/components/map3d/ImportObjects3D.js +1 -1
- package/components/map3d/Map3D.js +6 -6
- package/components/map3d/MapControls3D.js +2 -2
- package/components/map3d/SearchField3D.js +3 -3
- package/components/map3d/drawtool/NumericInput3D.js +3 -3
- package/components/map3d/layers/VectorLayer3D.js +1 -1
- package/components/map3d/style/MapControls3D.css +9 -16
- package/components/map3d/utils/MiscUtils3D.js +7 -2
- package/components/map3d/utils/OrbitControls3D.js +1 -4
- package/components/map3d/utils/Tiles3DStyle.js +4 -4
- package/components/style/AppMenu.css +2 -3
- package/components/style/IdentifyViewer.css +0 -6
- package/components/style/{TaskBar.css → MessageBar.css} +4 -4
- package/components/style/PluginsContainer.css +1 -1
- package/components/style/SearchBox.css +1 -2
- package/components/style/SideBar.css +11 -9
- package/components/style/WindowManager.css +0 -5
- package/icons/above_terr.svg +81 -0
- package/icons/above_zero.svg +80 -0
- package/package.json +1 -1
- package/plugins/API.js +1 -1
- package/plugins/AttributeTable.js +3 -3
- package/plugins/LayerTree.js +2 -2
- package/plugins/Map.js +4 -3
- package/plugins/MapCompare.js +1 -1
- package/plugins/MapCopyright.js +1 -1
- package/plugins/TourGuide.js +3 -1
- package/plugins/View3D.js +26 -20
- package/plugins/map/LocateSupport.js +3 -5
- package/plugins/map/style/LocateSupport.css +33 -0
- package/plugins/map3d/BackgroundSwitcher3D.js +1 -1
- package/plugins/map3d/BottomBar3D.js +3 -1
- package/plugins/map3d/Compare3D.js +4 -2
- package/plugins/map3d/Draw3D.js +4 -2
- package/plugins/map3d/ExportObjects3D.js +13 -12
- package/plugins/map3d/HideObjects3D.js +12 -8
- package/plugins/map3d/Identify3D.js +12 -7
- package/plugins/map3d/LayerTree3D.js +3 -1
- package/plugins/map3d/MapCopyright3D.js +11 -0
- package/plugins/map3d/MapExport3D.js +4 -2
- package/plugins/map3d/MapLight3D.js +11 -0
- package/plugins/map3d/Measure3D.js +4 -2
- package/plugins/map3d/OverviewMap3D.js +2 -2
- package/plugins/map3d/Settings3D.js +3 -1
- package/plugins/map3d/TopBar3D.js +9 -1
- package/plugins/style/Bookmark.css +1 -3
- package/plugins/style/Editing.css +1 -3
- package/plugins/style/FeatureSearch.css +1 -8
- package/plugins/style/LayerTree.css +3 -11
- package/plugins/style/MapCopyright.css +3 -3
- package/plugins/style/Portal.css +1 -1
- package/plugins/style/View3D.css +0 -4
- package/reducers/localConfig.js +1 -1
- package/scripts/gen-plugin-docs.js +2 -2
- package/selectors/searchproviders.js +3 -7
- package/static/translations/bg-BG.json +2 -0
- package/static/translations/ca-ES.json +2 -0
- package/static/translations/cs-CZ.json +2 -0
- package/static/translations/de-CH.json +3 -1
- package/static/translations/de-DE.json +3 -1
- package/static/translations/en-US.json +3 -1
- package/static/translations/es-ES.json +2 -0
- package/static/translations/fi-FI.json +2 -0
- package/static/translations/fr-FR.json +3 -1
- package/static/translations/hu-HU.json +2 -0
- package/static/translations/it-IT.json +3 -1
- package/static/translations/ja-JP.json +2 -0
- package/static/translations/nl-NL.json +2 -0
- package/static/translations/no-NO.json +2 -0
- package/static/translations/pl-PL.json +2 -0
- package/static/translations/pt-BR.json +2 -0
- package/static/translations/pt-PT.json +2 -0
- package/static/translations/ro-RO.json +2 -0
- package/static/translations/ru-RU.json +2 -0
- package/static/translations/sv-SE.json +2 -0
- package/static/translations/tr-TR.json +2 -0
- package/static/translations/tsconfig.json +2 -0
- package/static/translations/uk-UA.json +2 -0
- package/utils/SearchProviders.js +8 -3
- package/components/map/OlLocate.css +0 -56
- package/components/map/OlLocate.js +0 -17
- package/components/map3d/Map3DLight.js +0 -11
- package/plugins/style/AttributeTable.css +0 -6
- /package/{components/map3d/style/Map3DLight.css → plugins/map3d/style/MapLight3D.css} +0 -0
|
@@ -0,0 +1,11 @@
|
|
|
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 ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,o)}return t}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach(function(r){_defineProperty(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}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
|
+
* Copyright 2024 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 React from"react";import Sun from"@giro3d/giro3d/core/geographic/Sun.js";import{MapLightingMode}from"@giro3d/giro3d/entities/MapLightingOptions";import PropTypes from"prop-types";import suncalc from"suncalc";import{AmbientLight,BasicShadowMap,CameraHelper,DirectionalLight,DirectionalLightHelper,PCFShadowMap,PCFSoftShadowMap,VSMShadowMap}from"three";import Icon from"../../components/Icon";import SideBar from"../../components/SideBar";import Input from"../../components/widgets/Input";import NumberInput from"../../components/widgets/NumberInput";import ToggleSwitch from"../../components/widgets/ToggleSwitch";import CoordinatesUtils from"../../utils/CoordinatesUtils";import LocaleUtils from"../../utils/LocaleUtils";import"./style/MapLight3D.css";var MapLight3D=/*#__PURE__*/function(_React$Component){function MapLight3D(props){var _this;_classCallCheck(this,MapLight3D);_this=_callSuper(this,MapLight3D,[props]);_defineProperty(_this,"state",{showAdvanced:false,lightParams:{day:182,time:720,helpersVisible:false,moonLightIntensity:0.02,sunLightIntensity:3.5,zFactor:1,lightElevationLayersOnly:false,shadowsEnabled:true,shadowType:PCFShadowMap,shadowMapSize:4096,shadowBias:-0.0001,sunDistance:80000,normalBias:0,shadowIntensity:1,shadowVolumeNear:60000,shadowVolumeFar:100000},dayAnimation:false,dayAnimationSettings:false,dayStep:30,timeAnimation:false,timeAnimationSettings:false,timeStep:30});_defineProperty(_this,"onHide",function(){clearInterval(_this.animationInterval);_this.setState({dayAnimation:false,timeAnimation:false})});_defineProperty(_this,"renderBody",function(){var lightParams=_this.state.lightParams;var dateValue=new Date(new Date().getFullYear(),0,1+lightParams.day).toISOString().split("T")[0];var dateToDay=function dateToDay(date){var d=new Date(date);return 1+(d-new Date(Date.UTC(d.getUTCFullYear(),0,1)))/(1000*60*60*24)};var isLeapYear=function isLeapYear(year){return new Date(year,1,29).getDate()===29};var timeValue="".concat(String(Math.trunc(lightParams.time/60)).padStart(2,"0"),":").concat(String(Math.floor(lightParams.time%60)).padStart(2,"0"));var timeToMin=function timeToMin(time){var parts=time.split(":");return parseInt(parts[0],10)*60+parseInt(parts[1],10)};return/*#__PURE__*/React.createElement("div",{className:"maplight3d-body"},/*#__PURE__*/React.createElement("table",null,/*#__PURE__*/React.createElement("tbody",null,/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("maplight3d.date")),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement("div",{className:"map3d-animation-slider"},/*#__PURE__*/React.createElement(Icon,{icon:_this.state.dayAnimation?"square":"triangle-right",onClick:_this.toggleDayAnimation}),/*#__PURE__*/React.createElement("div",{className:"maplight3d-slider"},/*#__PURE__*/React.createElement("input",{max:365+isLeapYear(),min:1,onChange:function onChange(ev){return _this.updateLightParams("day",parseInt(ev.target.value,10))},step:1,type:"range",value:lightParams.day}),/*#__PURE__*/React.createElement(Input,{allowEmpty:false,onChange:function onChange(value){return _this.updateLightParams("day",dateToDay(value))},type:"date",value:dateValue})),/*#__PURE__*/React.createElement(Icon,{className:_this.state.dayAnimationSettings?"map3d-animation-settings-active":"",icon:"cog",onClick:function onClick(){return _this.setState(function(state){return{dayAnimationSettings:!state.dayAnimationSettings}})}})))),_this.state.dayAnimationSettings?/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",{colSpan:"2"},/*#__PURE__*/React.createElement("div",{className:"maplight3d-animation-settings"},/*#__PURE__*/React.createElement("span",null,LocaleUtils.tr("maplight3d.animationstep"),":"),/*#__PURE__*/React.createElement(NumberInput,{max:60,min:1,onChange:function onChange(dayStep){return _this.setState({dayStep:dayStep})},suffix:" "+LocaleUtils.tr("maplight3d.dayspersec"),value:_this.state.dayStep})))):null,/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("maplight3d.time")),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement("div",{className:"map3d-animation-slider"},/*#__PURE__*/React.createElement(Icon,{icon:_this.state.timeAnimation?"square":"triangle-right",onClick:_this.toggleTimeAnimation}),/*#__PURE__*/React.createElement("div",{className:"maplight3d-slider"},/*#__PURE__*/React.createElement("input",{max:1439,min:0,onChange:function onChange(ev){return _this.updateLightParams("time",parseInt(ev.target.value,10))},step:1,type:"range",value:lightParams.time}),/*#__PURE__*/React.createElement(Input,{allowEmpty:false,onChange:function onChange(value){return _this.updateLightParams("time",timeToMin(value))},type:"time",value:timeValue})),/*#__PURE__*/React.createElement(Icon,{className:_this.state.timeAnimationSettings?"map3d-animation-settings-active":"",icon:"cog",onClick:function onClick(){return _this.setState(function(state){return{timeAnimationSettings:!state.timeAnimationSettings}})}})))),_this.state.timeAnimationSettings?/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",{colSpan:"2"},/*#__PURE__*/React.createElement("div",{className:"maplight3d-animation-settings"},/*#__PURE__*/React.createElement("span",null,LocaleUtils.tr("maplight3d.animationstep"),":"),/*#__PURE__*/React.createElement(NumberInput,{max:60,min:1,onChange:function onChange(timeStep){return _this.setState({timeStep:timeStep})},suffix:" "+LocaleUtils.tr("maplight3d.minspersec"),value:_this.state.timeStep})))):null,/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("maplight3d.sunLightIntensity")),/*#__PURE__*/React.createElement("td",null,_this.renderSlider("sunLightIntensity",0,10,0.1))),/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("maplight3d.moonLightIntensity")),/*#__PURE__*/React.createElement("td",null,_this.renderSlider("moonLightIntensity",0,0.5,0.01))),/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("maplight3d.shadows")),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement(ToggleSwitch,{active:lightParams.shadowsEnabled,onChange:function onChange(value){return _this.updateLightParams("shadowsEnabled",value)}}))),/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("maplight3d.shadowintensity")),/*#__PURE__*/React.createElement("td",null,_this.renderSlider("shadowIntensity",0,2,0.1))),/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",{className:"maplight3d-advanced",colSpan:"2"},/*#__PURE__*/React.createElement("label",null,/*#__PURE__*/React.createElement("input",{checked:_this.state.showAdvanced,onChange:function onChange(ev){return _this.setState(function(state){return{showAdvanced:!state.showAdvanced}})},type:"checkbox"})," ",LocaleUtils.tr("maplight3d.showadvanced")))),_this.state.showAdvanced?[/*#__PURE__*/React.createElement("tr",{key:"helpersVisible"},/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("maplight3d.helpersVisible")),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement(ToggleSwitch,{active:lightParams.helpersVisible,onChange:function onChange(value){return _this.updateLightParams("helpersVisible",value)}}))),/*#__PURE__*/React.createElement("tr",{key:"zFactor"},/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("maplight3d.zFactor")),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement("input",{max:10,min:0,onChange:function onChange(ev){return _this.updateLightParams("zFactor",ev.target.value)},step:0.1,type:"range",value:lightParams.zFactor}))),/*#__PURE__*/React.createElement("tr",{key:"shadowType"},/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("maplight3d.shadowType")),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement("select",{onChange:function onChange(ev){return _this.updateLightParams("shadowType",parseInt(ev.target.value,10))},value:lightParams.shadowType},/*#__PURE__*/React.createElement("option",{value:BasicShadowMap},"BasicShadowMap"),/*#__PURE__*/React.createElement("option",{value:PCFShadowMap},"PCFShadowMap"),/*#__PURE__*/React.createElement("option",{value:PCFSoftShadowMap},"PCFSoftShadowMap"),/*#__PURE__*/React.createElement("option",{value:VSMShadowMap},"VSMShadowMap")))),/*#__PURE__*/React.createElement("tr",{key:"shadowMapSize"},/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("maplight3d.shadowMapSize")),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement(NumberInput,{decimals:0,max:8192,min:64,onChange:function onChange(value){return _this.updateLightParams("shadowMapSize",value)},value:lightParams.shadowMapSize}))),/*#__PURE__*/React.createElement("tr",{key:"shadowBias"},/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("maplight3d.shadowBias")),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement(NumberInput,{decimals:5,max:0.01,min:-0.01,onChange:function onChange(value){return _this.updateLightParams("shadowBias",value)},value:lightParams.shadowBias}))),/*#__PURE__*/React.createElement("tr",{key:"normalBias"},/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("maplight3d.normalBias")),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement(NumberInput,{decimals:1,max:10,min:-10,onChange:function onChange(value){return _this.updateLightParams("normalBias",value)},value:lightParams.normalBias}))),/*#__PURE__*/React.createElement("tr",{key:"shadowVolumeNear"},/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("maplight3d.shadowVolumeNear")),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement(NumberInput,{decimals:0,max:100000,min:100,onChange:function onChange(value){return _this.updateLightParams("shadowVolumeNear",value)},value:lightParams.shadowVolumeNear}))),/*#__PURE__*/React.createElement("tr",{key:"shadowVolumeFar"},/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("maplight3d.shadowVolumeFar")),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement(NumberInput,{decimals:0,max:100000,min:100,onChange:function onChange(value){return _this.updateLightParams("shadowVolumeFar",value)},value:lightParams.shadowVolumeFar})))]:null)))});_defineProperty(_this,"toggleDayAnimation",function(){_this.setState(function(state){return{dayAnimation:!state.dayAnimation,timeAnimation:false}},function(){clearInterval(_this.animationInterval);if(_this.state.dayAnimation){_this.animationInterval=setInterval(function(){_this.updateLightParams("day",(_this.state.lightParams.day+_this.state.dayStep/10)%365)},100)}})});_defineProperty(_this,"toggleTimeAnimation",function(){_this.setState(function(state){return{timeAnimation:!state.timeAnimation,dayAnimation:false}},function(){clearInterval(_this.animationInterval);if(_this.state.timeAnimation){_this.animationInterval=setInterval(function(){_this.updateLightParams("time",(_this.state.lightParams.time+_this.state.timeStep/10)%1440)},100)}})});_defineProperty(_this,"renderSlider",function(key,min,max,step){var labelFormatter=arguments.length>4&&arguments[4]!==undefined?arguments[4]:undefined;var value=_this.state.lightParams[key];var parseValue=function parseValue(x){return Number.isInteger(step)?parseInt(x,10):parseFloat(x)};labelFormatter=labelFormatter!==null&&labelFormatter!==void 0?labelFormatter:function(x){return x.toFixed(-Math.log10(step))};return/*#__PURE__*/React.createElement("div",{className:"maplight3d-slider"},/*#__PURE__*/React.createElement("input",{max:max,min:min,onChange:function onChange(ev){return _this.updateLightParams(key,parseValue(ev.target.value))},step:step,type:"range",value:value}),/*#__PURE__*/React.createElement("div",{className:"maplight3d-slider-label"},/*#__PURE__*/React.createElement("span",{style:{left:(value-min)*100/(max-min)+"%"}},labelFormatter(value))))});_defineProperty(_this,"updateLightParams",function(key,value){_this.setState(function(state){return{lightParams:_objectSpread(_objectSpread({},state.lightParams),{},_defineProperty({},key,value))}})});_defineProperty(_this,"configureShadows",function(sunLight,lightParams,shadowIntensityK){if(!lightParams.shadowsEnabled){_this.props.sceneContext.scene.renderer.shadowMap.enabled=false;sunLight.castShadow=false;return}var cameraHeight=_this.props.sceneContext.scene.view.camera.position.z;var targetHeight=_this.props.sceneContext.scene.view.controls.target.z;var volumeSize=Math.min(20000,Math.max(1000,cameraHeight-targetHeight));sunLight.shadow.camera.top=volumeSize;sunLight.shadow.camera.bottom=-volumeSize;sunLight.shadow.camera.left=-volumeSize;sunLight.shadow.camera.right=volumeSize;sunLight.shadow.camera.near=lightParams.shadowVolumeNear;sunLight.shadow.camera.far=lightParams.shadowVolumeFar;sunLight.shadow.camera.updateProjectionMatrix();sunLight.shadow.mapSize.set(lightParams.shadowMapSize,lightParams.shadowMapSize);sunLight.shadow.bias=lightParams.shadowBias;sunLight.shadow.normalBias=lightParams.normalBias;sunLight.shadow.intensity=lightParams.shadowIntensity*shadowIntensityK;_this.props.sceneContext.scene.renderer.shadowMap.enabled=true;sunLight.castShadow=true});_defineProperty(_this,"setLighting",function(){var sceneContext=_this.props.sceneContext;var lightParams=_this.state.lightParams;var ambientLight=sceneContext.getSceneObject("__ambientLight");var sunLight=sceneContext.getSceneObject("__sunLight");var moonLight=sceneContext.getSceneObject("__moonLight");var lightTarget=sceneContext.scene.view.controls.target.clone();lightTarget.z=0;// Compute azimuth / zenith and sun position
|
|
8
|
+
var date=new Date(new Date().getFullYear(),0,lightParams.day,Math.trunc(lightParams.time/60),lightParams.time%60);var latlon=CoordinatesUtils.reproject([lightTarget.x,lightTarget.y],sceneContext.mapCrs,"EPSG:4326");var sunPos=suncalc.getPosition(date,latlon[1],latlon[0]);var zenith=90-sunPos.altitude/Math.PI*180;var azimuth=180+sunPos.azimuth/Math.PI*180;var sunLocalPos=Sun.getLocalPosition({point:lightTarget,zenith:Math.min(90,zenith),azimuth:azimuth,distance:lightParams.sunDistance});// Compute dynamic params
|
|
9
|
+
var noonColor={r:1,g:0.98,b:0.98};var horizonColor={r:1,g:0.5,b:0.3};var duskColor={r:0.15,g:0.22,b:0.35};var lerpColor=function lerpColor(a,b,t){return{r:(1-t)*a.r+t*b.r,g:(1-t)*a.g+t*b.g,b:(1-t)*a.b+t*b.b}};var sunColor=noonColor;var ambientIntensity=0;var shadowIntensityK=0;var sunLightIntensityK=Math.min(1,(98-Math.min(98,zenith))/16);var moonLightIntensityK=1-Math.min(1,(90-Math.min(90,zenith))/16);if(zenith<90){var k=Math.pow(zenith/90,3);sunColor=lerpColor(noonColor,horizonColor,k);ambientIntensity=(1-zenith/90)*1.5;shadowIntensityK=(1-k)*0.9+0.2*k}else if(zenith<102){var _k=(zenith-90)/12;sunColor=lerpColor(horizonColor,duskColor,_k);shadowIntensityK=0.2*(1-_k)}// Set lighting params
|
|
10
|
+
sceneContext.map.lighting.enabled=true;sceneContext.map.lighting.mode=lightParams.shadowsEnabled?MapLightingMode.LightBased:MapLightingMode.Hillshade;sceneContext.map.lighting.elevationLayersOnly=lightParams.lightElevationLayersOnly;sceneContext.map.lighting.hillshadeAzimuth=azimuth;sceneContext.map.lighting.hillshadeZenith=Math.min(90,zenith);sceneContext.map.lighting.zFactor=lightParams.zFactor;sceneContext.scene.notifyChange(sceneContext.map);sceneContext.scene.renderer.shadowMap.type=lightParams.shadowType;ambientLight.intensity=ambientIntensity;sunLight.position.copy(sunLocalPos);sunLight.intensity=lightParams.sunLightIntensity*sunLightIntensityK;sunLight.color=sunColor;sunLight.target.position.copy(lightTarget);sunLight.updateMatrixWorld(true);sunLight.target.updateMatrixWorld(true);_this.configureShadows(sunLight,lightParams,shadowIntensityK);// NOTE: just a top-down light
|
|
11
|
+
moonLight.position.set(lightTarget.x,lightTarget.y,8000);moonLight.intensity=lightParams.moonLightIntensity*moonLightIntensityK;moonLight.target.position.copy(lightTarget);moonLight.updateMatrixWorld(true);moonLight.target.updateMatrixWorld(true);if(lightParams.helpersVisible){var sunLightHelper=sceneContext.getSceneObject("__sunLightHelper");sunLightHelper.update();sunLightHelper.updateMatrixWorld(true);var shadowCameraHelper=sceneContext.getSceneObject("__shadowCameraHelper");shadowCameraHelper.update();shadowCameraHelper.updateMatrixWorld(true)}sceneContext.scene.notifyChange()});_this.state.lightParams.day=props.defaultDay;var _parts=props.defaultTime.split(":").slice(0,2).map(Number);_this.state.lightParams.time=_parts[0]*60+_parts[1];return _this}_inherits(MapLight3D,_React$Component);return _createClass(MapLight3D,[{key:"componentDidMount",value:function componentDidMount(){this.animationInterval=null;this.componentDidUpdate({})}},{key:"componentDidUpdate",value:function componentDidUpdate(prevProps,prevState){var _prevProps$sceneConte;if(this.props.sceneContext.scene!==((_prevProps$sceneConte=prevProps.sceneContext)===null||_prevProps$sceneConte===void 0?void 0:_prevProps$sceneConte.scene)){var ambientLight=new AmbientLight(16777215,1);this.props.sceneContext.addSceneObject("__ambientLight",ambientLight);var sunLight=new DirectionalLight(16777215,this.state.sunLightIntensity);this.props.sceneContext.addSceneObject("__sunLight",sunLight);var moonLight=new DirectionalLight(16777215,this.state.moonLightIntensity);this.props.sceneContext.addSceneObject("__moonLight",moonLight);if(this.state.lightParams.helpersVisible){var sunLightHelper=new DirectionalLightHelper(sunLight,200,"white");this.props.sceneContext.addSceneObject("__sunLightHelper",sunLightHelper);var shadowCameraHelper=new CameraHelper(sunLight.shadow.camera);this.props.sceneContext.addSceneObject("__shadowCameraHelper",shadowCameraHelper)}this.props.sceneContext.scene.view.controls.addEventListener("change",this.setLighting);this.setLighting()}else if(this.state.lightParams!==prevState.lightParams){if(this.state.lightParams.helpersVisible&&!prevState.lightParams.helpersVisible){var _sunLight=this.props.sceneContext.getSceneObject("__sunLight");var _sunLightHelper=new DirectionalLightHelper(_sunLight,200,"white");this.props.sceneContext.addSceneObject("__sunLightHelper",_sunLightHelper);var _shadowCameraHelper=new CameraHelper(_sunLight.shadow.camera);this.props.sceneContext.addSceneObject("__shadowCameraHelper",_shadowCameraHelper)}else if(prevState.lightParams.helpersVisible&&!this.state.lightParams.helpersVisible){this.props.sceneContext.removeSceneObject("__sunLightHelper");this.props.sceneContext.removeSceneObject("__shadowCameraHelper")}this.setLighting()}}},{key:"componentWillUnmount",value:function componentWillUnmount(){clearInterval(this.lightPositionInterval);this.props.sceneContext.removeSceneObject("__sunLight");this.props.sceneContext.removeSceneObject("__moonLight");this.props.sceneContext.removeSceneObject("__sunLightHelper");this.props.sceneContext.removeSceneObject("__shadowCameraHelper")}},{key:"render",value:function render(){var _this2=this;return/*#__PURE__*/React.createElement(SideBar,{icon:"light",id:"MapLight3D",onHide:this.onHide,title:LocaleUtils.tr("appmenu.items.MapLight3D"),width:"25em"},function(){return{body:_this2.renderBody()}})}}])}(React.Component);_defineProperty(MapLight3D,"propTypes",{/** Default viewer day (1-365) */defaultDay:PropTypes.number,/** Default viewer time (00:00-23:59) */defaultTime:PropTypes.string,sceneContext:PropTypes.object});_defineProperty(MapLight3D,"defaultProps",{defaultDay:182,defaultTime:"12:00"});export{MapLight3D as default};
|
|
@@ -4,7 +4,9 @@ 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 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 TaskBar from"../../components/TaskBar";import HeightProfile3D from"../../components/map3d/HeightProfile3D";import ButtonBar from"../../components/widgets/ButtonBar";import CopyButton from"../../components/widgets/CopyButton";import ConfigUtils from"../../utils/ConfigUtils";import CoordinatesUtils from"../../utils/CoordinatesUtils";import LocaleUtils from"../../utils/LocaleUtils";import MeasureUtils from"../../utils/MeasureUtils";import"../../plugins/style/Measure.css"
|
|
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 TaskBar from"../../components/TaskBar";import HeightProfile3D from"../../components/map3d/HeightProfile3D";import ButtonBar from"../../components/widgets/ButtonBar";import CopyButton from"../../components/widgets/CopyButton";import ConfigUtils from"../../utils/ConfigUtils";import CoordinatesUtils from"../../utils/CoordinatesUtils";import LocaleUtils from"../../utils/LocaleUtils";import MeasureUtils from"../../utils/MeasureUtils";import"../../plugins/style/Measure.css";/**
|
|
8
|
+
* Measure in the 3D map.
|
|
9
|
+
*/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);_this.props.sceneContext.scene.domElement.addEventListener("pointerdown",_this.clearResultOnUp)});_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;_this.props.sceneContext.scene.domElement.removeEventListener("pointerdown",_this.clearResultOnUp)});_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:"measure-result controlgroup"},/*#__PURE__*/React.createElement("input",{className:"measure-result-field",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:[255,0,0,0.5]})}),new ol.style.Style({stroke:new ol.style.Stroke({color:[255,0,0],width:4})}),new ol.style.Style({stroke:new ol.style.Stroke({color:[255,0,0],width:1.5})})]});_defineProperty(_this,"clearResultOnUp",function(ev){ev.view.addEventListener("pointermove",function(){ev.view.removeEventListener("pointerup",_this.clearResult)},{once:true});ev.view.addEventListener("pointerup",_this.clearResult,{once:true})});_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={color:"#ff0000",signal:_this.abortController.signal,endCondition:conditions.doubleClick,pick:null// default pick
|
|
8
10
|
};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
11
|
_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
12
|
shape=new Shape({showVertexLabels:true,showLine:true,showVertices:true,vertexLabelFormatter:elevationLabelFormatter});shape.setPoints([new Vector3(pos.x,pos.y,elevation),pos])}else{// Add point
|
|
@@ -21,4 +23,4 @@ var z1=(_elevationCache=elevationCache[iY*numX+iX])!==null&&_elevationCache!==vo
|
|
|
21
23
|
var dz1=Math.abs(z3-z1);var dz2=Math.abs(z4-z2);if(dz1<dz2){var area1=_this.triangleArea([-deltaX,0,z1-z2],[0,deltaY,z3-z2]);var area2=_this.triangleArea([0,-deltaY,z1-z4],[deltaX,0,z3-z4]);area+=area1+area2}else{var _area=_this.triangleArea([deltaX,0,z2-z1],[0,deltaY,z4-z1]);var _area2=_this.triangleArea([-deltaX,0,z4-z3],[0,-deltaY,z1-z3]);area+=_area+_area2}}}_this.setState({result:area});// Setup for next measurement
|
|
22
24
|
_this.restart()});_defineProperty(_this,"measureHeight",function(lineString){if(lineString===null){_this.restart();return}_this.clearResult();_this.measurementObjects.push(lineString);// Setup for next measurement
|
|
23
25
|
_this.restart()});_defineProperty(_this,"getElevation",function(point){return _this.props.sceneContext.getTerrainHeightFromMap(point)});_defineProperty(_this,"triangleArea",function(u,v){var cross=[u[1]*v[2]-u[2]*v[1],u[0]*v[2]-u[2]*v[0],u[0]*v[1]-u[1]*v[0]];return 0.5*Math.sqrt(cross[0]*cross[0]+cross[1]*cross[1]+cross[2]*cross[2])});_this.measureTool=null;_this.drawLayer=null;_this.measurementObjects=[];return _this}_inherits(Measure3D,_React$Component);return _createClass(Measure3D,[{key:"componentDidUpdate",value:function componentDidUpdate(prevProps,prevState){if(this.state.mode&&this.state.mode!==prevState.mode){this.clearResult();this.restart()}if(this.state.elevUnit!==prevState.elevUnit){// Re-render height label
|
|
24
|
-
this.measurementObjects[0].rebuildLabels();this.props.sceneContext.scene.notifyChange()}}},{key:"render",value:function render(){var _this2=this,_this$state$result;return[/*#__PURE__*/React.createElement(TaskBar,{key:"TaskBar",onHide:this.onHide,onShow:this.onShow,task:"Measure3D"},function(){return{body:/*#__PURE__*/React.createElement("div",{className:"measure-body"},_this2.renderModeSwitcher(),_this2.renderResult())}}),(_this$state$result=this.state.result)!==null&&_this$state$result!==void 0&&_this$state$result.profile?/*#__PURE__*/React.createElement(HeightProfile3D,{data:this.state.result.profile,key:"HeightProfile",sceneContext:this.props.sceneContext}):null]}}])}(React.Component);_defineProperty(Measure3D,"
|
|
26
|
+
this.measurementObjects[0].rebuildLabels();this.props.sceneContext.scene.notifyChange()}}},{key:"render",value:function render(){var _this2=this,_this$state$result;return[/*#__PURE__*/React.createElement(TaskBar,{key:"TaskBar",onHide:this.onHide,onShow:this.onShow,task:"Measure3D"},function(){return{body:/*#__PURE__*/React.createElement("div",{className:"measure-body"},_this2.renderModeSwitcher(),_this2.renderResult())}}),(_this$state$result=this.state.result)!==null&&_this$state$result!==void 0&&_this$state$result.profile?/*#__PURE__*/React.createElement(HeightProfile3D,{data:this.state.result.profile,key:"HeightProfile",sceneContext:this.props.sceneContext}):null]}}])}(React.Component);_defineProperty(Measure3D,"propTypes",{maxSampleCount:PropTypes.number,minMeasureLength:PropTypes.number,sceneContext:PropTypes.object});_defineProperty(Measure3D,"defaultProps",{maxSampleCount:500,minMeasureLength:1});export{Measure3D as default};
|
|
@@ -5,5 +5,5 @@ function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof
|
|
|
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
7
|
*/import React from"react";import ol from"openlayers";import PropTypes from"prop-types";import OlLayer from"../../components/map/OlLayer";import viewconeIcon from"../../resources/viewcone.svg";import"./style/OverviewMap3D.css";/**
|
|
8
|
-
* Overview map
|
|
9
|
-
*/var OverviewMap3D=/*#__PURE__*/function(_React$Component){function OverviewMap3D(props){var _this;_classCallCheck(this,OverviewMap3D);_this=_callSuper(this,OverviewMap3D,[props]);_defineProperty(_this,"state",{collapsed:true});_defineProperty(_this,"initOverviewMap",function(el){if(el){_this.map=new ol.Map({layers:[_this.viewConeLayer],controls:[],target:el});_this.setupView()}});_defineProperty(_this,"setupView",function(){var overviewView=new ol.View({enableRotation:false,projection:_this.props.sceneContext.mapCrs});_this.map.setView(overviewView);_this.updateViewCone()});_defineProperty(_this,"updateViewCone",function(){var _scene$view$controls$,_scene$view$controls,_scene$view$controls$2;if(!_this.map){return}var scene=_this.props.sceneContext.scene;var x=scene.view.camera.position.x;var y=scene.view.camera.position.y;var azimuth=(_scene$view$controls$=(_scene$view$controls=scene.view.controls)===null||_scene$view$controls===void 0||(_scene$view$controls$2=_scene$view$controls.getAzimuthalAngle)===null||_scene$view$controls$2===void 0?void 0:_scene$view$controls$2.call(_scene$view$controls))!==null&&_scene$view$controls$!==void 0?_scene$view$controls$:0;var cameraHeight=scene.view.camera.position.z;var resolution=cameraHeight/100;_this.map.getView().setCenter([x,y]);_this.map.getView().setResolution(resolution);_this.viewConeFeature.getGeometry().setCoordinates([x,y]);_this.viewConeFeature.set("rotation",-azimuth,true);_this.viewConeLayer.getSource().changed()});_this.map=null;_this.viewConeFeature=new ol.Feature(new ol.geom.Point([0,0]));_this.viewConeLayer=new ol.layer.Vector({source:new ol.source.Vector({features:[_this.viewConeFeature]}),style:function style(feature){return new ol.style.Style({fill:new ol.style.Fill({color:"white"}),stroke:new ol.style.Stroke({color:"red",width:2}),image:new ol.style.Icon({anchor:[0.5,1],anchorXUnits:"fraction",anchorYUnits:"fraction",src:viewconeIcon,rotation:feature.get("rotation"),scale:2})})},zIndex:10000});return _this}_inherits(OverviewMap3D,_React$Component);return _createClass(OverviewMap3D,[{key:"componentDidMount",value:function componentDidMount(){this.props.sceneContext.scene.view.controls.addEventListener("change",this.updateViewCone)}},{key:"componentDidUpdate",value:function componentDidUpdate(prevProps,prevState){if(this.props.sceneContext.mapCrs!==prevProps.sceneContext.mapCrs){this.setupView()}if(this.map){if(this.state.center!==prevState.center||this.state.azimuth!==prevState.azimuth){this.map.getView().setCenter(this.state.center);this.viewConeFeature.getGeometry().setCoordinates(this.state.center);this.viewConeFeature.set("rotation",-this.state.azimuth,true);this.viewConeLayer.getSource().changed()}if(this.state.resolution!==prevState.resolution){this.map.getView().setResolution(this.state.resolution)}}}},{key:"render",value:function render(){var _this$props$sceneCont,_this2=this;var style={display:this.state.collapsed?"none":"initial"};var baseLayer=this.props.sceneContext.baseLayers.find(function(l){return l.visibility===true});var overviewLayer=(_this$props$sceneCont=this.props.sceneContext.baseLayers.find(function(l){return l.overview===true}))!==null&&_this$props$sceneCont!==void 0?_this$props$sceneCont:baseLayer;return[/*#__PURE__*/React.createElement("div",{className:"overview-map-3d",key:"map3d-overview-map"},/*#__PURE__*/React.createElement("div",{className:"ol-overviewmap-map-3d",ref:this.initOverviewMap,style:style}),/*#__PURE__*/React.createElement("button",{onClick:function onClick(){return _this2.setState(function(state){return{collapsed:!state.collapsed}})},type:"button"},this.state.collapsed?"\xAB":"\xBB")),this.map&&overviewLayer?/*#__PURE__*/React.createElement(OlLayer,{key:overviewLayer.name,map:this.map,options:_objectSpread(_objectSpread({},overviewLayer),{},{visibility:true}),projection:this.props.sceneContext.mapCrs}):null]}}])}(React.Component);_defineProperty(OverviewMap3D,"
|
|
8
|
+
* Overview map for the 3D map.
|
|
9
|
+
*/var OverviewMap3D=/*#__PURE__*/function(_React$Component){function OverviewMap3D(props){var _this;_classCallCheck(this,OverviewMap3D);_this=_callSuper(this,OverviewMap3D,[props]);_defineProperty(_this,"state",{collapsed:true});_defineProperty(_this,"initOverviewMap",function(el){if(el){_this.map=new ol.Map({layers:[_this.viewConeLayer],controls:[],target:el});_this.setupView()}});_defineProperty(_this,"setupView",function(){var overviewView=new ol.View({enableRotation:false,projection:_this.props.sceneContext.mapCrs});_this.map.setView(overviewView);_this.updateViewCone()});_defineProperty(_this,"updateViewCone",function(){var _scene$view$controls$,_scene$view$controls,_scene$view$controls$2;if(!_this.map){return}var scene=_this.props.sceneContext.scene;var x=scene.view.camera.position.x;var y=scene.view.camera.position.y;var azimuth=(_scene$view$controls$=(_scene$view$controls=scene.view.controls)===null||_scene$view$controls===void 0||(_scene$view$controls$2=_scene$view$controls.getAzimuthalAngle)===null||_scene$view$controls$2===void 0?void 0:_scene$view$controls$2.call(_scene$view$controls))!==null&&_scene$view$controls$!==void 0?_scene$view$controls$:0;var cameraHeight=scene.view.camera.position.z;var resolution=cameraHeight/100;_this.map.getView().setCenter([x,y]);_this.map.getView().setResolution(resolution);_this.viewConeFeature.getGeometry().setCoordinates([x,y]);_this.viewConeFeature.set("rotation",-azimuth,true);_this.viewConeLayer.getSource().changed()});_this.map=null;_this.viewConeFeature=new ol.Feature(new ol.geom.Point([0,0]));_this.viewConeLayer=new ol.layer.Vector({source:new ol.source.Vector({features:[_this.viewConeFeature]}),style:function style(feature){return new ol.style.Style({fill:new ol.style.Fill({color:"white"}),stroke:new ol.style.Stroke({color:"red",width:2}),image:new ol.style.Icon({anchor:[0.5,1],anchorXUnits:"fraction",anchorYUnits:"fraction",src:viewconeIcon,rotation:feature.get("rotation"),scale:2})})},zIndex:10000});return _this}_inherits(OverviewMap3D,_React$Component);return _createClass(OverviewMap3D,[{key:"componentDidMount",value:function componentDidMount(){this.props.sceneContext.scene.view.controls.addEventListener("change",this.updateViewCone)}},{key:"componentDidUpdate",value:function componentDidUpdate(prevProps,prevState){if(this.props.sceneContext.mapCrs!==prevProps.sceneContext.mapCrs){this.setupView()}if(this.map){if(this.state.center!==prevState.center||this.state.azimuth!==prevState.azimuth){this.map.getView().setCenter(this.state.center);this.viewConeFeature.getGeometry().setCoordinates(this.state.center);this.viewConeFeature.set("rotation",-this.state.azimuth,true);this.viewConeLayer.getSource().changed()}if(this.state.resolution!==prevState.resolution){this.map.getView().setResolution(this.state.resolution)}}}},{key:"render",value:function render(){var _this$props$sceneCont,_this2=this;var style={display:this.state.collapsed?"none":"initial"};var baseLayer=this.props.sceneContext.baseLayers.find(function(l){return l.visibility===true});var overviewLayer=(_this$props$sceneCont=this.props.sceneContext.baseLayers.find(function(l){return l.overview===true}))!==null&&_this$props$sceneCont!==void 0?_this$props$sceneCont:baseLayer;return[/*#__PURE__*/React.createElement("div",{className:"overview-map-3d",key:"map3d-overview-map"},/*#__PURE__*/React.createElement("div",{className:"ol-overviewmap-map-3d",ref:this.initOverviewMap,style:style}),/*#__PURE__*/React.createElement("button",{onClick:function onClick(){return _this2.setState(function(state){return{collapsed:!state.collapsed}})},type:"button"},this.state.collapsed?"\xAB":"\xBB")),this.map&&overviewLayer?/*#__PURE__*/React.createElement(OlLayer,{key:overviewLayer.name,map:this.map,options:_objectSpread(_objectSpread({},overviewLayer),{},{visibility:true}),projection:this.props.sceneContext.mapCrs}):null]}}])}(React.Component);_defineProperty(OverviewMap3D,"propTypes",{sceneContext:PropTypes.object});export{OverviewMap3D as default};
|
|
@@ -4,4 +4,6 @@ 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 PropTypes from"prop-types";import SideBar from"../../components/SideBar";import Input from"../../components/widgets/Input";import LocaleUtils from"../../utils/LocaleUtils";import"./style/Settings3D.css"
|
|
7
|
+
*/import React from"react";import PropTypes from"prop-types";import SideBar from"../../components/SideBar";import Input from"../../components/widgets/Input";import LocaleUtils from"../../utils/LocaleUtils";import"./style/Settings3D.css";/**
|
|
8
|
+
* Settings panel for the 3D map.
|
|
9
|
+
*/var Settings3D=/*#__PURE__*/function(_React$Component){function Settings3D(){var _this;_classCallCheck(this,Settings3D);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key]}_this=_callSuper(this,Settings3D,[].concat(args));_defineProperty(_this,"renderBody",function(){return/*#__PURE__*/React.createElement("div",{className:"settings3d-body"},/*#__PURE__*/React.createElement("table",null,/*#__PURE__*/React.createElement("tbody",null,/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("settings3d.quality")),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement(Input,{max:100,min:20,onChange:_this.qualityChanged,step:20,type:"range",value:_this.props.sceneContext.settings.sceneQuality}))))))});_defineProperty(_this,"qualityChanged",function(value){_this.props.sceneContext.setSetting("sceneQuality",parseInt(value,10))});return _this}_inherits(Settings3D,_React$Component);return _createClass(Settings3D,[{key:"render",value:function render(){var _this2=this;return/*#__PURE__*/React.createElement(SideBar,{icon:"cog",id:"Settings3D",title:LocaleUtils.tr("appmenu.items.Settings3D"),width:"20em"},function(){return{body:_this2.renderBody()}})}}])}(React.Component);_defineProperty(Settings3D,"propTypes",{sceneContext:PropTypes.object});export{Settings3D as default};
|
|
@@ -4,4 +4,12 @@ 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 classNames from"classnames";import PropTypes from"prop-types";import{toggleFullscreen,View3DMode}from"../../actions/display";import{openExternalUrl,setTopbarHeight}from"../../actions/windows";import AppMenu from"../../components/AppMenu";import FullscreenSwitcher from"../../components/FullscreenSwitcher";import{Swipeable}from"../../components/Swipeable";import Toolbar from"../../components/Toolbar";import SearchField3D from"../../components/map3d/SearchField3D";import ConfigUtils from"../../utils/ConfigUtils";import LocaleUtils from"../../utils/LocaleUtils";import ThemeUtils from"../../utils/ThemeUtils"
|
|
7
|
+
*/import React from"react";import{connect}from"react-redux";import classNames from"classnames";import isEmpty from"lodash.isempty";import PropTypes from"prop-types";import{toggleFullscreen,View3DMode}from"../../actions/display";import{openExternalUrl,setTopbarHeight}from"../../actions/windows";import AppMenu from"../../components/AppMenu";import FullscreenSwitcher from"../../components/FullscreenSwitcher";import{Swipeable}from"../../components/Swipeable";import Toolbar from"../../components/Toolbar";import SearchField3D from"../../components/map3d/SearchField3D";import ConfigUtils from"../../utils/ConfigUtils";import LocaleUtils from"../../utils/LocaleUtils";import ThemeUtils from"../../utils/ThemeUtils";/**
|
|
8
|
+
* Bottom bar of the 3D map, including the search bar, tool bar and menu.
|
|
9
|
+
*/var TopBar3D=/*#__PURE__*/function(_React$Component){function TopBar3D(){var _this;_classCallCheck(this,TopBar3D);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key]}_this=_callSuper(this,TopBar3D,[].concat(args));_defineProperty(_this,"state",{allowedMenuItems:[],allowedToolbarItems:[]});_defineProperty(_this,"filter2DItems",function(item){var pluginConf=ConfigUtils.getPluginConfig(item.key);return isEmpty(pluginConf)||_this.props.view3dMode===View3DMode.FULLSCREEN&&pluginConf.availableIn3D});_defineProperty(_this,"storeHeight",function(el){if(el){_this.props.setTopbarHeight(el.clientHeight)}});_defineProperty(_this,"openUrl",function(url,target,title,icon){if(target==="iframe"){target=":iframedialog:externallinkiframe"}_this.props.openExternalUrl(url,target,{title:title,icon:icon})});_defineProperty(_this,"addGenericMenuItems",function(menuItems,inputConfig){inputConfig.forEach(function(entry){if(entry.subitems){var group=[];_this.addGenericMenuItems(group,entry.subitems);if(group.length>0){menuItems.push(_objectSpread(_objectSpread({},entry),{},{subitems:group}))}}else{var pluginConfig=ConfigUtils.getPluginConfig(entry.key);if(entry.url||pluginConfig.availableIn3D){menuItems.push(entry)}}})});return _this}_inherits(TopBar3D,_React$Component);return _createClass(TopBar3D,[{key:"componentDidMount",value:function componentDidMount(){this.componentDidUpdate({})}},{key:"componentDidUpdate",value:function componentDidUpdate(prevProps){if(this.props.currentTheme!==prevProps.currentTheme||this.props.view3dMode!==prevProps.view3dMode){this.setState({allowedToolbarItems:ThemeUtils.allowedItems(this.props.toolbarItems,this.props.currentTheme,this.filter2DItems),allowedMenuItems:ThemeUtils.allowedItems(this.props.menuItems,this.props.currentTheme,this.filter2DItems)})}}},{key:"render",value:function render(){var _ConfigUtils$getPlugi,_this2=this;var config=((_ConfigUtils$getPlugi=ConfigUtils.getPluginConfig("TopBar"))===null||_ConfigUtils$getPlugi===void 0?void 0:_ConfigUtils$getPlugi.cfg)||{};var logo;var assetsPath=ConfigUtils.getAssetsPath();var isMobile=ConfigUtils.isMobile();if(isMobile){logo=assetsPath+"/img/logo-mobile."+(config.logoFormat||"svg")}else{logo=assetsPath+"/img/logo."+(config.logoFormat||"svg")}var logoEl=/*#__PURE__*/React.createElement("img",{className:"topbar-logo",src:config.logoSrc||logo});if(config.logoUrl){logoEl=/*#__PURE__*/React.createElement("a",{href:config.logoUrl,rel:"noreferrer",target:"_blank"},logoEl)}var menuCompact=!isMobile?config.appMenuCompact:false;var classes=classNames({TopBar:true,mobile:isMobile,fullscreen:this.props.fullscreen});return/*#__PURE__*/React.createElement(Swipeable,{onSwipedDown:function onSwipedDown(){return _this2.props.toggleFullscreen(false)},onSwipedUp:function onSwipedUp(){return _this2.props.toggleFullscreen(true)}},/*#__PURE__*/React.createElement("div",{className:classes,ref:this.storeHeight},logoEl,/*#__PURE__*/React.createElement("div",{className:"topbar-center-span"},/*#__PURE__*/React.createElement("div",{className:"topbar-search-container"},/*#__PURE__*/React.createElement(SearchField3D,{sceneContext:this.props.sceneContext,searchOptions:this.props.searchOptions})),/*#__PURE__*/React.createElement(Toolbar,{openExternalUrl:this.openUrl,toolbarItems:this.state.allowedToolbarItems})),/*#__PURE__*/React.createElement(AppMenu,{appMenuClearsTask:config.appMenuClearsTask,appMenuShortcut:config.appMenuShortcut,buttonLabel:LocaleUtils.tr("appmenu.menulabel"),keepMenuOpen:menuCompact,menuCompact:menuCompact,menuItems:this.state.allowedMenuItems,openExternalUrl:this.openUrl,showFilterField:config.appMenuFilterField}),this.props.view3dMode===View3DMode.FULLSCREEN?/*#__PURE__*/React.createElement(FullscreenSwitcher,null):null))}}])}(React.Component);_defineProperty(TopBar3D,"propTypes",{currentTheme:PropTypes.object,fullscreen:PropTypes.bool,/** The menu items, in the same format as the 2D `TopBar` menu items.
|
|
10
|
+
* You can include entries for the View3D plugins.
|
|
11
|
+
* You can also include entries for 2D plugins which are compatible with the 3D view (i.e. `ThemeSwitcher`, `Share`, etc.),
|
|
12
|
+
* these will be displayed only in fullsceen 3D mode. */menuItems:PropTypes.array,openExternalUrl:PropTypes.func,sceneContext:PropTypes.object,/** Options passed down to the search component. */searchOptions:PropTypes.shape({/** Minimum scale denominator when zooming to search result. */minScaleDenom:PropTypes.number}),setTopbarHeight:PropTypes.func,toggleFullscreen:PropTypes.func,/** The toolbar, in the same format as the 2D `TopBar` toolbar items.
|
|
13
|
+
* You can include entries for the View3D plugins.
|
|
14
|
+
* You can also include entries for 2D plugins which are compatible with the 3D view (i.e. `ThemeSwitcher`, `Share`, etc.),
|
|
15
|
+
* these will be displayed only in fullsceen 3D mode. */toolbarItems:PropTypes.array,view3dMode:PropTypes.number});_defineProperty(TopBar3D,"defaultProps",{searchOptions:{minScaleDenom:1000}});export default connect(function(state){return{currentTheme:state.theme.current,fullscreen:state.display.fullscreen,view3dMode:state.display.view3dMode}},{setTopbarHeight:setTopbarHeight,toggleFullscreen:toggleFullscreen,openExternalUrl:openExternalUrl})(TopBar3D);
|
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
padding: 0.5em;
|
|
3
3
|
display: flex;
|
|
4
4
|
flex-direction: column;
|
|
5
|
-
|
|
6
|
-
max-height: calc(100vh - 2.5em - var(--topbar-height) - var(--bottombar-height)); /* viewport - sidebar_titlebar - topbar - bottombar*/
|
|
7
|
-
max-height: calc(var(--vh, 1vh) * 100 - 2.5em - var(--topbar-height) - var(--bottombar-height)); /* viewport - sidebar_titlebar - topbar - bottombar*/
|
|
5
|
+
min-height: 0;
|
|
8
6
|
}
|
|
9
7
|
|
|
10
8
|
div.bookmark-create > input {
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
#Editing div.editing-body {
|
|
2
2
|
padding: 0.25em;
|
|
3
3
|
position: relative;
|
|
4
|
-
|
|
5
|
-
max-height: calc(100vh - 2.5em - var(--topbar-height) - var(--bottombar-height)); /* viewport - sidebar_titlebar - topbar - bottombar*/
|
|
6
|
-
max-height: calc(var(--vh, 1vh) * 100 - 2.5em - var(--topbar-height) - var(--bottombar-height)); /* viewport - sidebar_titlebar - topbar - bottombar*/
|
|
4
|
+
min-height: 0;
|
|
7
5
|
display: flex;
|
|
8
6
|
flex-direction: column;
|
|
9
7
|
height: 100%;
|
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
div#FeatureSearch div.sidebar-body {
|
|
2
|
-
overflow: hidden;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
1
|
div.feature-search-body {
|
|
6
|
-
|
|
7
|
-
max-height: calc(100vh - 2.5em - var(--topbar-height) - var(--bottombar-height)); /* viewport - sidebar_titlebar - topbar - bottombar*/
|
|
8
|
-
max-height: calc(var(--vh, 1vh) * 100 - 2.5em - var(--topbar-height) - var(--bottombar-height)); /* viewport - sidebar_titlebar - topbar - bottombar*/
|
|
9
|
-
|
|
2
|
+
min-height: 0;
|
|
10
3
|
padding: 0.25em;
|
|
11
4
|
display: flex;
|
|
12
5
|
flex-direction: column;
|
|
@@ -71,20 +71,12 @@
|
|
|
71
71
|
color: var(--titlebar-bg-color);
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
/* https://github.com/philipwalton/flexbugs/issues/216 */
|
|
75
|
-
#LayerTree div.layertree-container-wrapper {
|
|
76
|
-
display: flex;
|
|
77
|
-
flex-direction: row;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
74
|
#LayerTree div.layertree-container {
|
|
81
|
-
flex:
|
|
82
|
-
max-width: 100%;
|
|
75
|
+
flex: 1 1 auto;
|
|
83
76
|
display: flex;
|
|
77
|
+
max-width: 100%;
|
|
84
78
|
flex-direction: column;
|
|
85
|
-
|
|
86
|
-
max-height: calc(100vh - 2.5em - var(--topbar-height) - var(--bottombar-height)); /* viewport - sidebar_titlebar - topbar - bottombar*/
|
|
87
|
-
max-height: calc(var(--vh, 1vh) * 100 - 2.5em - var(--topbar-height) - var(--bottombar-height)); /* viewport - sidebar_titlebar - topbar - bottombar*/
|
|
79
|
+
min-height: 0;
|
|
88
80
|
}
|
|
89
81
|
|
|
90
82
|
#LayerTree div.layertree-tree {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
div.MapCopyright {
|
|
2
2
|
position: absolute;
|
|
3
3
|
right: 0.25em;
|
|
4
4
|
bottom: 0.25em;
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
font-size: x-small;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
div.MapCopyright > span {
|
|
15
15
|
padding: 0 0.5em;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
div.MapCopyright span:not(:first-child) {
|
|
19
19
|
border-left: 1px solid var(--panel-text-color);
|
|
20
20
|
}
|
package/plugins/style/Portal.css
CHANGED
|
@@ -32,7 +32,7 @@ span.portal-topbar-spacer {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
div.portal-topbar div.AppMenu div.appmenu-menu-container {
|
|
35
|
-
height: calc(
|
|
35
|
+
height: calc(var(--plugins-container-height) - var(--topbar-height) - var(--bottombar-height));
|
|
36
36
|
background-color: var(--app-menu-bg-color);
|
|
37
37
|
}
|
|
38
38
|
|
package/plugins/style/View3D.css
CHANGED
package/reducers/localConfig.js
CHANGED
|
@@ -5,4 +5,4 @@ function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof
|
|
|
5
5
|
*
|
|
6
6
|
* This source code is licensed under the BSD-style license found in the
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
8
|
-
*/import{LOCAL_CONFIG_LOADED,SET_STARTUP_PARAMETERS,SET_COLOR_SCHEME,SET_USER_INFO_FIELDS,SET_PERMALINK_PARAMETERS,REGISTER_CUSTOM_PLUGIN,UNREGISTER_CUSTOM_PLUGIN}from"../actions/localConfig";import ConfigUtils from"../utils/ConfigUtils";import{UrlParams}from"../utils/PermaLinkUtils";var defaultState=_objectSpread(_objectSpread({},ConfigUtils.getDefaults()),{},{customPlugins:[],startupParams:{},startupState:{},permalinkParams:{},colorScheme:"default"});export default function localConfig(){var state=arguments.length>0&&arguments[0]!==undefined?arguments[0]:defaultState;var action=arguments.length>1?arguments[1]:undefined;switch(action.type){case LOCAL_CONFIG_LOADED:{return _objectSpread(_objectSpread({},state),action.config)}case SET_STARTUP_PARAMETERS:{return _objectSpread(_objectSpread({},state),{},{startupParams:action.params,startupState:action.state})}case SET_COLOR_SCHEME:{var root=document.querySelector(":root");if(state.colorScheme){root.classList.remove(state.colorScheme)}var newColorScheme=action.colorScheme||state.defaultColorScheme||"default";if(newColorScheme){root.classList.add(newColorScheme)}if(UrlParams.getParam("style")){UrlParams.updateParams({style:newColorScheme})}if(action.storeInLocalStorage){localStorage.setItem("qwc2-color-scheme",newColorScheme)}return _objectSpread(_objectSpread({},state),{},{colorScheme:newColorScheme})}case SET_USER_INFO_FIELDS:{return _objectSpread(_objectSpread({},state),{},{user_infos:_objectSpread(_objectSpread({},state.user_infos),action.fields)})}case SET_PERMALINK_PARAMETERS:{return _objectSpread(_objectSpread({},state),{},{permalinkParams:Object.entries(_objectSpread(_objectSpread({},state.permalinkParams),action.params)).reduce(function(res,_ref){var _ref2=_slicedToArray(_ref,2),key=_ref2[0],value=_ref2[1];if(value!==undefined){res[key]=value}return res},{})})}case REGISTER_CUSTOM_PLUGIN:{return _objectSpread(_objectSpread({},state),{},{customPlugins:[].concat(_toConsumableArray(state.customPlugins),_toConsumableArray(action.name)),plugins:{desktop:state.plugins.desktop.map(function(entry){if(entry.name===action.name){return _objectSpread(_objectSpread({},entry),{},{
|
|
8
|
+
*/import{LOCAL_CONFIG_LOADED,SET_STARTUP_PARAMETERS,SET_COLOR_SCHEME,SET_USER_INFO_FIELDS,SET_PERMALINK_PARAMETERS,REGISTER_CUSTOM_PLUGIN,UNREGISTER_CUSTOM_PLUGIN}from"../actions/localConfig";import ConfigUtils from"../utils/ConfigUtils";import{UrlParams}from"../utils/PermaLinkUtils";var defaultState=_objectSpread(_objectSpread({},ConfigUtils.getDefaults()),{},{customPlugins:[],startupParams:{},startupState:{},permalinkParams:{},colorScheme:"default"});export default function localConfig(){var state=arguments.length>0&&arguments[0]!==undefined?arguments[0]:defaultState;var action=arguments.length>1?arguments[1]:undefined;switch(action.type){case LOCAL_CONFIG_LOADED:{return _objectSpread(_objectSpread({},state),action.config)}case SET_STARTUP_PARAMETERS:{return _objectSpread(_objectSpread({},state),{},{startupParams:action.params,startupState:action.state})}case SET_COLOR_SCHEME:{var root=document.querySelector(":root");if(state.colorScheme){root.classList.remove(state.colorScheme)}var newColorScheme=action.colorScheme||state.defaultColorScheme||"default";if(newColorScheme){root.classList.add(newColorScheme)}if(UrlParams.getParam("style")){UrlParams.updateParams({style:newColorScheme})}if(action.storeInLocalStorage){localStorage.setItem("qwc2-color-scheme",newColorScheme)}return _objectSpread(_objectSpread({},state),{},{colorScheme:newColorScheme})}case SET_USER_INFO_FIELDS:{return _objectSpread(_objectSpread({},state),{},{user_infos:_objectSpread(_objectSpread({},state.user_infos),action.fields)})}case SET_PERMALINK_PARAMETERS:{return _objectSpread(_objectSpread({},state),{},{permalinkParams:Object.entries(_objectSpread(_objectSpread({},state.permalinkParams),action.params)).reduce(function(res,_ref){var _ref2=_slicedToArray(_ref,2),key=_ref2[0],value=_ref2[1];if(value!==undefined){res[key]=value}return res},{})})}case REGISTER_CUSTOM_PLUGIN:{return _objectSpread(_objectSpread({},state),{},{customPlugins:[].concat(_toConsumableArray(state.customPlugins),_toConsumableArray(action.name)),plugins:{desktop:state.plugins.desktop.map(function(entry){if(entry.name===action.name){return _objectSpread(_objectSpread({},entry),{},{availableIn3D:action.availableIn3D})}return entry}),mobile:state.plugins.mobile.map(function(entry){if(entry.name===action.name){return _objectSpread(_objectSpread({},entry),{},{availableIn3D:action.availableIn3D})}return entry})}})}case UNREGISTER_CUSTOM_PLUGIN:{return _objectSpread(_objectSpread({},state),{},{customPlugins:state.customPlugins.filter(function(el){return el!==action.name})})}default:return state}}
|
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
*
|
|
6
6
|
* This source code is licensed under the BSD-style license found in the
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
8
|
-
*/function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure 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 _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 _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l){if(Object(t)!==t)return;f=!1}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r}finally{try{if(!f&&null!=t["return"]&&(u=t["return"](),Object(u)!==u))return}finally{if(o)throw n}}return a}}function _arrayWithHoles(r){if(Array.isArray(r))return r}var fs=require("fs");var path=require("path");var reactDocs=require("react-docgen");var qwcPluginDir=__dirname+"/../plugins";var pluginData=[];fs.readdirSync(qwcPluginDir).forEach(function(entry){if(entry.endsWith(".jsx")){var file=path.resolve(qwcPluginDir,entry);var contents=fs.readFileSync(file);pluginData.push(reactDocs.parse(contents,reactDocs.resolver.findAllComponentDefinitions))}});fs.readdirSync(qwcPluginDir+"/map").forEach(function(entry){if(entry.endsWith(".jsx")){var file=path.resolve(qwcPluginDir,"map",entry);var contents=fs.readFileSync(file);
|
|
9
|
-
var output="";output+="Plugin reference\n";output+="================\n";output+="\n";pluginData.forEach(function(plugin){if(!plugin.description){return}output+="* [".concat(plugin.displayName,"](#").concat(plugin.displayName.toLowerCase(),")\n")});output+="\n";output+="
|
|
8
|
+
*/function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure 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 _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 _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l){if(Object(t)!==t)return;f=!1}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r}finally{try{if(!f&&null!=t["return"]&&(u=t["return"](),Object(u)!==u))return}finally{if(o)throw n}}return a}}function _arrayWithHoles(r){if(Array.isArray(r))return r}var fs=require("fs");var path=require("path");var reactDocs=require("react-docgen");var qwcPluginDir=__dirname+"/../plugins";var pluginData=[];fs.readdirSync(qwcPluginDir).forEach(function(entry){if(entry.endsWith(".jsx")){var file=path.resolve(qwcPluginDir,entry);var contents=fs.readFileSync(file);pluginData.push(reactDocs.parse(contents,reactDocs.resolver.findAllComponentDefinitions))}});pluginData=pluginData.flat();var mapToolPluginData=[];fs.readdirSync(qwcPluginDir+"/map").forEach(function(entry){if(entry.endsWith(".jsx")){var file=path.resolve(qwcPluginDir,"map",entry);var contents=fs.readFileSync(file);mapToolPluginData.push(reactDocs.parse(contents,reactDocs.resolver.findAllComponentDefinitions))}});mapToolPluginData=mapToolPluginData.flat();var plugin3dData=[];fs.readdirSync(qwcPluginDir+"/map3d").forEach(function(entry){if(entry.endsWith(".jsx")){var file=path.resolve(qwcPluginDir,"map3d",entry);var contents=fs.readFileSync(file);plugin3dData.push(reactDocs.parse(contents,reactDocs.resolver.findAllComponentDefinitions))}});plugin3dData=plugin3dData.flat();function parsePropType(type){if(type.name==="shape"){return"{\n"+Object.entries(type.value).map(function(_ref){var _ref2=_slicedToArray(_ref,2),key=_ref2[0],value=_ref2[1];return" "+key+": "+parsePropType(value)+",\n"}).join("")+"}"}else if(type.name==="arrayOf"){return"["+parsePropType(type.value)+"]"}else if(type.name==="union"){return"{"+type.value.map(function(entry){return parsePropType(entry)}).join(", ")+"}"}else{return type.name}}function genPluginDoc(plugin){var output="";if(!plugin.description){return""}output+="".concat(plugin.displayName,"<a name=\"").concat(plugin.displayName.toLowerCase(),"\"></a>\n");output+="----------------------------------------------------------------\n";output+=plugin.description+"\n\n";var props=Object.entries(plugin.props||{}).filter(function(entry){return entry[1].description});if(props.length>0){output+="| Property | Type | Description | Default value |\n";output+="|----------|------|-------------|---------------|\n";props.forEach(function(_ref3){var _ref4=_slicedToArray(_ref3,2),name=_ref4[0],prop=_ref4[1];if(!prop.description){return}var defaultValue=prop.defaultValue?prop.defaultValue.value.split("\n").map(function(x){return"`"+x.replace(" ","\xA0")+"`"}).join("<br />"):"`undefined`";var type="`"+parsePropType(prop.type).replaceAll(" ","\xA0").replaceAll("\n","`<br />`")+"`";output+="| ".concat(name," | ").concat(type," | ").concat(prop.description.replaceAll("\n","<br />")," | ").concat(defaultValue," |\n")});output+="\n"}plugin.methods.forEach(function(method){if(method.docblock){var params=method.params.map(function(param){return param.name}).join(",");output+="**".concat(method.name,"(").concat(params,")**\n\n");output+=(method.docblock||"")+"\n";output+="\n"}});return output}// Write markdown output
|
|
9
|
+
var output="";output+="Plugin reference\n";output+="================\n";output+="\n";pluginData.forEach(function(plugin){if(!plugin.description){return}output+="* [".concat(plugin.displayName,"](#").concat(plugin.displayName.toLowerCase(),")\n")});output+="\n";output+="Map support plugins\n";output+="\n";mapToolPluginData.forEach(function(plugin){if(!plugin.description){return}output+="* [".concat(plugin.displayName,"](#").concat(plugin.displayName.toLowerCase(),")\n")});output+="\n";output+="3D Plugins\n";output+="\n";plugin3dData.forEach(function(plugin){if(!plugin.description){return}output+="* [".concat(plugin.displayName,"](#").concat(plugin.displayName.toLowerCase(),")\n")});output+="\n";output+="---\n";pluginData.forEach(function(plugin){output+=genPluginDoc(plugin)});output+="---\n";output+="# Map support plugins<a name=\"mapSupportPlugins\"></a>\n";output+="\n";output+="These plugins must be listed as children of the [Map](#map) plugin.";output+="\n";mapToolPluginData.forEach(function(plugin){output+=genPluginDoc(plugin)});output+="---\n";output+="# 3D Plugins<a name=\"plugins3d\"></a>\n";output+="\n";output+="These plugins must be listed as children of the [View3D](#view3d) plugin.";output+="\n";plugin3dData.forEach(function(plugin){output+=genPluginDoc(plugin)});fs.writeFileSync(__dirname+"/../doc/plugins.md",output);/* eslint-disable-next-line */console.log("Plugin documentation written to doc/plugins.md!");
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
2
|
* Copyright 2020-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{createSelector}from"reselect";import
|
|
8
|
-
|
|
9
|
-
var searchTerms=[];var activeLayers=[];var mapScale=MapUtils.computeForZoom(scales,zoom);var _iterator=_createForOfIteratorHelper(LayerUtils.explodeLayers(layers)),_step;try{for(_iterator.s();!(_step=_iterator.n()).done;){var entry=_step.value;if(entry.layer.role===LayerRole.THEME&&entry.sublayer.visibility===true&&LayerUtils.layerScaleInRange(entry.sublayer,mapScale)){searchTerms=searchTerms.concat(entry.sublayer.searchterms||[]);activeLayers.push(entry.sublayer.name)}}}catch(err){_iterator.e(err)}finally{_iterator.f()}var searchProviders=_objectSpread(_objectSpread({},SearchProviders),window.QWC2SearchProviders||{});var availableProviders={};var themeLayerNames=layers.map(function(layer){return layer.role===LayerRole.THEME?layer.params.LAYERS:""}).join(",").split(",").filter(function(entry){return entry});var providerKeys=new Set;var _iterator2=_createForOfIteratorHelper((theme===null||theme===void 0?void 0:theme.searchProviders)||[]),_step2;try{var _loop=function _loop(){var _entry;var entry=_step2.value;if(typeof entry==="string"){entry={provider:entry}}// Omit qgis provider with field configuration, this is only supported through the FeatureSearch plugin
|
|
10
|
-
if(entry.provider==="qgis"&&(_entry=entry)!==null&&_entry!==void 0&&(_entry=_entry.params)!==null&&_entry!==void 0&&_entry.fields){return 0;// continue
|
|
11
|
-
}var provider=searchProviders[entry.provider];if(provider){var _entry$key,_entry$label,_entry$labelmsgid;if(provider.requiresLayer&&!themeLayerNames.includes(provider.requiresLayer)){return 0;// continue
|
|
12
|
-
}var key=(_entry$key=entry.key)!==null&&_entry$key!==void 0?_entry$key:entry.provider;if(providerKeys.has(key)){var i=0;for(i=0;providerKeys.has(key+"_"+i);++i);key=key+"_"+i}providerKeys.add(key);availableProviders[key]=_objectSpread(_objectSpread({},provider),{},{label:(_entry$label=entry.label)!==null&&_entry$label!==void 0?_entry$label:provider.label,labelmsgid:(_entry$labelmsgid=entry.labelmsgid)!==null&&_entry$labelmsgid!==void 0?_entry$labelmsgid:provider.labelmsgid,getResultGeometry:provider.getResultGeometry?function(item,callback){return getResultGeometry(provider,item,callback)}:null,cfgParams:entry.params||{},params:{searchTerms:searchTerms,activeLayers:activeLayers,theme:theme}})}},_ret;for(_iterator2.s();!(_step2=_iterator2.n()).done;){_ret=_loop();if(_ret===0)continue}}catch(err){_iterator2.e(err)}finally{_iterator2.f()}if(ConfigUtils.getConfigProp("searchThemes",theme)){availableProviders.themes={labelmsgid:LocaleUtils.trmsg("search.themes"),onSearch:function onSearch(text,options,callback){callback({results:ThemeUtils.searchThemes(themes.themes,text)})}}}if(ConfigUtils.getConfigProp("searchThemeLayers",theme)){availableProviders.themelayers={labelmsgid:LocaleUtils.trmsg("search.themelayers"),onSearch:function onSearch(text,options,callback){callback({results:ThemeUtils.searchThemeLayers(themes.themes,text)})}}}return availableProviders});
|
|
7
|
+
*/import{createSelector}from"reselect";import ConfigUtils from"../utils/ConfigUtils";import LocaleUtils from"../utils/LocaleUtils";import MapUtils from"../utils/MapUtils";import{collectSearchProviders}from"../utils/SearchProviders";import ThemeUtils from"../utils/ThemeUtils";export default createSelector([function(state){return state.theme.current},function(state){return state.theme},function(state){return state.layers.flat},function(state){return state.map.scales},function(state){return state.map.zoom}],function(theme,themes,layers,scales,zoom){// Collect active layers/search terms
|
|
8
|
+
var mapScale=MapUtils.computeForZoom(scales,zoom);var availableProviders=collectSearchProviders(theme,layers,mapScale);if(ConfigUtils.getConfigProp("searchThemes",theme)){availableProviders.themes={labelmsgid:LocaleUtils.trmsg("search.themes"),onSearch:function onSearch(text,options,callback){callback({results:ThemeUtils.searchThemes(themes.themes,text)})}}}if(ConfigUtils.getConfigProp("searchThemeLayers",theme)){availableProviders.themelayers={labelmsgid:LocaleUtils.trmsg("search.themelayers"),onSearch:function onSearch(text,options,callback){callback({results:ThemeUtils.searchThemeLayers(themes.themes,text)})}}}return availableProviders});
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"Print": "Drucken",
|
|
27
27
|
"Reports": "Berichte",
|
|
28
28
|
"Settings": "Einstellungen",
|
|
29
|
-
"Settings3D": "Einstellungen",
|
|
29
|
+
"Settings3D": "3D Einstellungen",
|
|
30
30
|
"Share": "Teilen",
|
|
31
31
|
"ThemeSwitcher": "Themen",
|
|
32
32
|
"AttributeTable": "Attributtabelle",
|
|
@@ -110,6 +110,8 @@
|
|
|
110
110
|
"compare3d": {
|
|
111
111
|
"clipplane": "Schnittebene",
|
|
112
112
|
"compare_objects": "Objekte vergleichen",
|
|
113
|
+
"info_message": "Objektvergleich ist aktiv",
|
|
114
|
+
"modify": "Ändern",
|
|
113
115
|
"toggleall": "Alle"
|
|
114
116
|
},
|
|
115
117
|
"cookiepopup": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"Print": "Drucken",
|
|
27
27
|
"Reports": "Berichte",
|
|
28
28
|
"Settings": "Einstellungen",
|
|
29
|
-
"Settings3D": "Einstellungen",
|
|
29
|
+
"Settings3D": "3D Einstellungen",
|
|
30
30
|
"Share": "Teilen",
|
|
31
31
|
"ThemeSwitcher": "Themen",
|
|
32
32
|
"AttributeTable": "Attributtabelle",
|
|
@@ -110,6 +110,8 @@
|
|
|
110
110
|
"compare3d": {
|
|
111
111
|
"clipplane": "Schnittebene",
|
|
112
112
|
"compare_objects": "Objekte vergleichen",
|
|
113
|
+
"info_message": "Objektvergleich ist aktiv",
|
|
114
|
+
"modify": "Ändern",
|
|
113
115
|
"toggleall": "Alle"
|
|
114
116
|
},
|
|
115
117
|
"cookiepopup": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"Print": "Print",
|
|
27
27
|
"Reports": "Reports",
|
|
28
28
|
"Settings": "Settings",
|
|
29
|
-
"Settings3D": "Settings",
|
|
29
|
+
"Settings3D": "3D Settings",
|
|
30
30
|
"Share": "Share Link",
|
|
31
31
|
"ThemeSwitcher": "Theme",
|
|
32
32
|
"AttributeTable": "Attribute Table",
|
|
@@ -110,6 +110,8 @@
|
|
|
110
110
|
"compare3d": {
|
|
111
111
|
"clipplane": "Clipping plane",
|
|
112
112
|
"compare_objects": "Compare objects",
|
|
113
|
+
"info_message": "Object comparison is active",
|
|
114
|
+
"modify": "Modify",
|
|
113
115
|
"toggleall": "Toggle all"
|
|
114
116
|
},
|
|
115
117
|
"cookiepopup": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"Print": "Imprimer",
|
|
27
27
|
"Reports": "Rapports",
|
|
28
28
|
"Settings": "Paramètres",
|
|
29
|
-
"Settings3D": "Paramètres",
|
|
29
|
+
"Settings3D": "Paramètres 3D",
|
|
30
30
|
"Share": "Partager",
|
|
31
31
|
"ThemeSwitcher": "Thèmes",
|
|
32
32
|
"AttributeTable": "Table d'attributs",
|
|
@@ -110,6 +110,8 @@
|
|
|
110
110
|
"compare3d": {
|
|
111
111
|
"clipplane": "Plan d'écrêtage",
|
|
112
112
|
"compare_objects": "Comparer objets",
|
|
113
|
+
"info_message": "La comparaison d'objets est active",
|
|
114
|
+
"modify": "Modifier",
|
|
113
115
|
"toggleall": "Tous"
|
|
114
116
|
},
|
|
115
117
|
"cookiepopup": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"Print": "Stampa",
|
|
27
27
|
"Reports": "Rapporti",
|
|
28
28
|
"Settings": "Impostazioni",
|
|
29
|
-
"Settings3D": "Impostazioni",
|
|
29
|
+
"Settings3D": "Impostazioni 3D",
|
|
30
30
|
"Share": "Condividi",
|
|
31
31
|
"ThemeSwitcher": "Temi",
|
|
32
32
|
"AttributeTable": "Tabella attributi",
|
|
@@ -110,6 +110,8 @@
|
|
|
110
110
|
"compare3d": {
|
|
111
111
|
"clipplane": "Piano di taglio",
|
|
112
112
|
"compare_objects": "Confronta oggetti",
|
|
113
|
+
"info_message": "Il confronto tra oggetti è attivo",
|
|
114
|
+
"modify": "Modifica",
|
|
113
115
|
"toggleall": "Tutti"
|
|
114
116
|
},
|
|
115
117
|
"cookiepopup": {
|