qwc2 2025.5.7 → 2025.5.15
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/windows.js +1 -1
- package/components/IdentifyViewer.js +5 -5
- package/components/MapButton.js +7 -0
- package/components/PluginsContainer.js +7 -2
- package/components/SearchBox.js +10 -13
- package/components/StandardApp.js +2 -7
- package/components/map/layers/MVTLayer.js +1 -1
- package/components/map3d/Draw3D.js +2 -2
- package/components/map3d/HideObjects3D.js +5 -3
- package/components/map3d/Map3D.js +5 -5
- package/components/map3d/Map3DLight.js +1 -1
- package/components/map3d/MapControls3D.js +10 -8
- package/components/map3d/Measure3D.js +2 -2
- package/components/map3d/View3DSwitcher.js +1 -1
- package/components/map3d/drawtool/CreateTool3D.js +1 -1
- package/components/map3d/drawtool/EditTool3D.js +5 -4
- package/components/map3d/style/Draw3D.css +1 -13
- package/components/map3d/style/Map3D.css +1 -2
- package/components/map3d/style/Map3DLight.css +11 -3
- package/components/map3d/style/View3DSwitcher.css +8 -20
- package/components/map3d/utils/Tiles3DStyle.js +1 -2
- package/components/style/App.css +6 -1
- package/{plugins/style/Buttons.css → components/style/MapButton.css} +9 -27
- package/components/style/PluginsContainer.css +23 -2
- package/components/style/SearchBox.css +1 -2
- package/components/timeline/style/InfiniteTimeline.css +1 -0
- package/components/widgets/NumberInput.js +1 -1
- package/components/widgets/style/ButtonBar.css +0 -5
- package/components/widgets/style/MenuButton.css +1 -0
- package/components/widgets/style/NumberInput.css +0 -1
- package/components/widgets/style/ToggleSwitch.css +1 -0
- package/package.json +2 -2
- package/plugins/BackgroundSwitcher.js +3 -3
- package/plugins/HomeButton.js +2 -2
- package/plugins/Identify.js +1 -1
- package/plugins/LocateButton.js +2 -2
- package/plugins/MapExport.js +1 -1
- package/plugins/MapFilter.js +2 -2
- package/plugins/Measure.js +1 -1
- package/plugins/Panoramax.js +2 -8
- package/plugins/Redlining.js +2 -2
- package/plugins/Share.js +1 -1
- package/plugins/TaskButton.js +1 -1
- package/plugins/TopBar.js +2 -2
- package/plugins/View3D.js +4 -3
- package/plugins/ZoomButtons.js +2 -2
- package/plugins/style/BackgroundSwitcher.css +25 -21
- package/plugins/style/Bookmark.css +1 -1
- package/plugins/style/Editing.css +5 -1
- package/plugins/style/MapFilter.css +5 -1
- package/plugins/style/Measure.css +2 -6
- package/plugins/style/Panoramax.css +12 -4
- package/plugins/style/Redlining.css +12 -56
- package/plugins/style/Reports.css +4 -0
- package/plugins/style/Routing.css +1 -0
- package/plugins/style/ValueTool.css +4 -0
- package/reducers/windows.js +1 -1
- package/scripts/wmts_config_generator.py +3 -0
- package/static/translations/bg-BG.json +3 -0
- package/static/translations/ca-ES.json +3 -0
- package/static/translations/cs-CZ.json +3 -0
- package/static/translations/de-CH.json +4 -1
- package/static/translations/de-DE.json +4 -1
- package/static/translations/en-US.json +4 -1
- package/static/translations/es-ES.json +3 -0
- package/static/translations/fi-FI.json +3 -0
- package/static/translations/fr-FR.json +4 -1
- package/static/translations/hu-HU.json +3 -0
- package/static/translations/it-IT.json +4 -1
- package/static/translations/ja-JP.json +3 -0
- package/static/translations/nl-NL.json +3 -0
- package/static/translations/no-NO.json +3 -0
- package/static/translations/pl-PL.json +3 -0
- package/static/translations/pt-BR.json +3 -0
- package/static/translations/pt-PT.json +3 -0
- package/static/translations/ro-RO.json +3 -0
- package/static/translations/ru-RU.json +3 -0
- package/static/translations/sv-SE.json +3 -0
- package/static/translations/tr-TR.json +3 -0
- package/static/translations/tsconfig.json +3 -0
- package/utils/LayerUtils.js +1 -1
- package/utils/SearchProviders.js +2 -2
- package/utils/ServiceLayerUtils.js +1 -1
|
@@ -1,9 +1,10 @@
|
|
|
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 _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
|
|
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 _readOnlyError(r){throw new TypeError("\""+r+"\" is read-only")}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 _superPropGet(t,o,e,r){var p=_get(_getPrototypeOf(1&r?t.prototype:t),o,e);return 2&r&&"function"==typeof p?function(t){return p.apply(e,t)}:p}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var p=_superPropBase(e,t);if(p){var n=Object.getOwnPropertyDescriptor(p,t);return n.get?n.get.call(arguments.length<3?e:r):n.value}},_get.apply(null,arguments)}function _superPropBase(t,o){for(;!{}.hasOwnProperty.call(t,o)&&null!==(t=_getPrototypeOf(t)););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 2025 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 PropTypes from"prop-types";import{Color,Group,Vector3}from"three";import{TransformControls}from"three/addons/controls/TransformControls";import{CSG}from"three-csg-ts";import LocaleUtils from"../../../utils/LocaleUtils";import Icon from"../../Icon";import ButtonBar from"../../widgets/ButtonBar";import ColorButton from"../../widgets/ColorButton";import TextInput from"../../widgets/TextInput";import NumericInput3D from"./NumericInput3D";var GroupSelection=/*#__PURE__*/function(_Group){function GroupSelection(){var _this;_classCallCheck(this,GroupSelection);_this=_callSuper(this,GroupSelection);_defineProperty(_this,"hasObject",function(object){return _this.children.indexOf(object)>=0});_defineProperty(_this,"addToSelection",function(object){_this.children.forEach(function(child){child.position.add(_this.position)});_this.add(object);object.userData.originalColor=object.material.color.clone();object.material.color.set(16711680);_this.recomputePosition()});_defineProperty(_this,"removeFromSelection",function(object){_this.parent.attach(object);object.material.color.set(object.userData.originalColor);delete object.userData.originalColor;_this.children.forEach(function(child){child.position.add(_this.position)});_this.recomputePosition()});_defineProperty(_this,"dissolve",function(){
|
|
8
|
-
var object=
|
|
9
|
-
var
|
|
7
|
+
*/import React from"react";import PropTypes from"prop-types";import{Color,Group,Vector3}from"three";import{TransformControls}from"three/addons/controls/TransformControls";import{CSG}from"three-csg-ts";import LocaleUtils from"../../../utils/LocaleUtils";import Icon from"../../Icon";import ButtonBar from"../../widgets/ButtonBar";import ColorButton from"../../widgets/ColorButton";import TextInput from"../../widgets/TextInput";import NumericInput3D from"./NumericInput3D";var GroupSelection=/*#__PURE__*/function(_Group){function GroupSelection(){var _this;_classCallCheck(this,GroupSelection);_this=_callSuper(this,GroupSelection);_defineProperty(_this,"hasObject",function(object){return _this.children.indexOf(object)>=0});_defineProperty(_this,"addToSelection",function(object){_this.children.forEach(function(child){child.position.add(_this.position)});_this.add(object);object.userData.originalColor=object.material.color.clone();object.material.color.set(16711680);_this.recomputePosition()});_defineProperty(_this,"removeFromSelection",function(object){_this.parent.attach(object);object.material.color.set(object.userData.originalColor);delete object.userData.originalColor;_this.children.forEach(function(child){child.position.add(_this.position)});_this.recomputePosition()});_defineProperty(_this,"dissolve",function(){if(_this.parent===null){// Group has already been removed from scene
|
|
8
|
+
return}while(_this.children.length){var object=_this.children.pop();object.material.color.set(object.userData.originalColor);delete object.userData.originalColor;_this.parent.attach(object)}_this.removeFromParent()});_defineProperty(_this,"recomputePosition",function(){if(_this.children.length===0){_this.position.set(0,0,0)}else{var center=new Vector3;_this.children.forEach(function(child){center.add(child.position)});center.divideScalar(_this.children.length);_this.position.copy(center);_this.updateMatrixWorld();_this.children.forEach(function(child){child.position.sub(_this.position);child.updateMatrixWorld()})}});_this.isGroupSelection=true;return _this}_inherits(GroupSelection,_Group);return _createClass(GroupSelection,[{key:"clone",value:function clone(){var clone=_superPropGet(GroupSelection,"clone",this,3)([]);clone.isGroupSelection=true;return clone}}])}(Group);var EditTool3D=/*#__PURE__*/function(_React$Component){function EditTool3D(){var _this2;_classCallCheck(this,EditTool3D);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key]}_this2=_callSuper(this,EditTool3D,[].concat(args));_defineProperty(_this2,"state",{mode:"translate",numericInput:false,selectCount:0,csgBackup:null,label:""});_defineProperty(_this2,"toolButtonClicked",function(key){if(key==="NumericInput"){_this2.toggleNumericInput()}else if(key==="clone"){_this2.cloneSelectedObject()}});_defineProperty(_this2,"selectShapeOnRelease",function(ev){if(ev.button===0&&!_this2.transformControls.dragging){var renderer=_this2.props.sceneContext.scene.renderer;renderer.domElement.addEventListener("pointerup",_this2.selectShape,{once:true});renderer.domElement.addEventListener("pointermove",function(){renderer.domElement.removeEventListener("pointerup",_this2.selectShape)})}});_defineProperty(_this2,"selectShape",function(ev){var rect=ev.target.getBoundingClientRect();var x=(ev.clientX-rect.left)/rect.width*2-1;var y=-((ev.clientY-rect.top)/rect.height)*2+1;var intersection=_this2.props.sceneContext.getSceneIntersection(x,y);if(intersection){// Check if closest (first) intersected object is within the current draw group
|
|
9
|
+
var object=intersection.object;var drawGroup=_this2.props.sceneContext.getSceneObject(_this2.props.drawGroupId);for(var parent=object.parent;parent;parent=parent.parent){if(parent===drawGroup){if(ev.ctrlKey&&_this2.props.selectedObject){_this2.addRemoveFromSelection(object)}else{_this2.dissolveSelectionGroup();_this2.props.objectPicked(object)}return}}}if(!ev.ctrlKey){_this2.dissolveSelectionGroup();_this2.props.objectPicked(null)}});_defineProperty(_this2,"addRemoveFromSelection",function(object){if(_this2.props.selectedObject===object){_this2.props.objectPicked(null)}else if(_this2.props.selectedObject.isGroupSelection){if(_this2.props.selectedObject.hasObject(object)){_this2.props.selectedObject.removeFromSelection(object);if(_this2.props.selectedObject.children.length===1){var child=_this2.props.selectedObject.children[0];_this2.props.selectedObject.dissolve();_this2.props.objectPicked(child)}}else{_this2.props.selectedObject.addToSelection(object)}_this2.setState({selectCount:_this2.props.selectedObject.children.length});_this2.updateTransformHelper()}else{var groupSelection=new GroupSelection;object.parent.add(groupSelection);groupSelection.addToSelection(object);if(_this2.props.selectedObject&&_this2.props.selectedObject!==object){groupSelection.addToSelection(_this2.props.selectedObject)}_this2.props.objectPicked(groupSelection)}});_defineProperty(_this2,"dissolveSelectionGroup",function(){var _this2$props$selected;if((_this2$props$selected=_this2.props.selectedObject)!==null&&_this2$props$selected!==void 0&&_this2$props$selected.isGroupSelection){_this2.props.selectedObject.dissolve()}});_defineProperty(_this2,"updateTransformHelper",function(){_this2.transformControls.getHelper().updateMatrixWorld();_this2.props.sceneContext.scene.notifyChange()});_defineProperty(_this2,"toolChanged",function(){var _this2$props$selected2,_this2$props$selected3;(_this2$props$selected2=_this2.props.selectedObject)===null||_this2$props$selected2===void 0||(_this2$props$selected3=_this2$props$selected2.updateMatrixWorld)===null||_this2$props$selected3===void 0||_this2$props$selected3.call(_this2$props$selected2);_this2.transformControls.getHelper().updateMatrixWorld();_this2.props.sceneContext.scene.notifyChange()});_defineProperty(_this2,"onKeyDown",function(ev){if(ev.key==="Escape"){_this2.transformControls.reset()}else if(ev.key==="Control"){_this2.transformControls.enabled=false}});_defineProperty(_this2,"onKeyUp",function(ev){if(ev.key==="Control"){_this2.transformControls.enabled=true}});_defineProperty(_this2,"toggleNumericInput",function(){_this2.setState(function(state){return{numericInput:!state.numericInput}})});_defineProperty(_this2,"applyCsgOperation",function(operation){var result=null;var children=_toConsumableArray(_this2.props.selectedObject.children);if(operation==="union"){result=CSG.union.apply(CSG,_toConsumableArray(children))}else if(operation==="subtract"){result=CSG.subtract.apply(CSG,_toConsumableArray(children))}else if(operation==="intersect"){result=CSG.intersect.apply(CSG,_toConsumableArray(children))}if(result){var parent=_this2.props.selectedObject.parent;result.position.add(_this2.props.selectedObject.position);_this2.props.selectedObject.dissolve();children[0].removeFromParent();children[1].removeFromParent();result.material.color=new Color().lerpColors(children[0].material.color,children[1].material.color,0.5);result.userData.originalChildren=children;parent.attach(result);// Re-center object
|
|
10
|
+
var offset=result.geometry.boundingBox.getCenter(new Vector3);offset.applyQuaternion(result.quaternion);result.position.add(offset);result.geometry.center();_this2.props.objectPicked(result)}});_defineProperty(_this2,"undoCsgOperation",function(){var parent=_this2.props.selectedObject.parent;var children=_this2.state.csgBackup;parent.attach(children[0]);parent.attach(children[1]);_this2.props.selectedObject.removeFromParent();var group=new GroupSelection;group.addToSelection(children[0]);group.addToSelection(children[1]);parent.add(group);_this2.props.objectPicked(group)});_defineProperty(_this2,"clearCsgBackup",function(){_this2.setState({csgBackup:null})});_defineProperty(_this2,"setLabel",function(text){_this2.setState({label:text});_this2.props.selectedObject.userData.label=text;_this2.props.sceneContext.updateObjectLabel(_this2.props.selectedObject)});_defineProperty(_this2,"cloneSelectedObject",function(){if(_this2.props.selectedObject){var clonedObject=_this2.deepClone(_this2.props.selectedObject);clonedObject.position.x+=10;clonedObject.position.y+=10;clonedObject.updateMatrixWorld();_this2.props.selectedObject.parent.add(clonedObject);_this2.props.objectPicked(clonedObject)}});_defineProperty(_this2,"deepClone",function(object){var clone=object.clone(false);if(object.geometry){clone.geometry=object.geometry.clone()}if(object.material){if(Array.isArray(object.material)){clone.material=object.material.map(function(mat){return mat.clone()})}else{clone.material=object.material.clone()}}object.children.forEach(function(child){clone.add(_this2.deepClone(child))});return clone});return _this2}_inherits(EditTool3D,_React$Component);return _createClass(EditTool3D,[{key:"componentDidMount",value:function componentDidMount(){var _this3=this;var camera=this.props.sceneContext.scene.view.camera;var renderer=this.props.sceneContext.scene.renderer;this.transformControls=new TransformControls(camera,renderer.domElement);this.props.sceneContext.scene.add(this.transformControls.getHelper());this.transformControls.setMode(this.state.mode);this.transformControls.addEventListener("change",this.toolChanged);this.transformControls.addEventListener("mouseUp",this.toolChanged);this.transformControls.addEventListener("mouseUp",this.clearCsgBackup);this.transformControls.addEventListener("dragging-changed",function(event){_this3.props.sceneContext.scene.view.controls.enabled=!event.value});renderer.domElement.addEventListener("pointerdown",this.selectShapeOnRelease);renderer.domElement.addEventListener("keydown",this.onKeyDown);renderer.domElement.addEventListener("keyup",this.onKeyUp);if(this.props.selectedObject){var _this$props$selectedO;this.transformControls.attach(this.props.selectedObject);this.transformControls.getHelper().updateMatrixWorld();this.props.colorChanged(this.props.selectedObject.material.color.toArray().map(function(c){return c*255}));this.setState({label:((_this$props$selectedO=this.props.selectedObject.userData)===null||_this$props$selectedO===void 0?void 0:_this$props$selectedO.label)||"",selectCount:1})}this.props.sceneContext.scene.view.controls.addEventListener("change",this.updateTransformHelper);this.props.sceneContext.scene.notifyChange()}},{key:"componentDidUpdate",value:function componentDidUpdate(prevProps,prevState){var _this4=this;if(this.props.selectedObject!==prevProps.selectedObject){var _prevProps$selectedOb;if((_prevProps$selectedOb=prevProps.selectedObject)!==null&&_prevProps$selectedOb!==void 0&&_prevProps$selectedOb.isGroupSelection){prevProps.selectedObject.dissolve()}if(prevProps.selectedObject){this.transformControls.detach();this.clearCsgBackup()}var selectCount=0;if(this.props.selectedObject){var _this$props$selectedO2;this.transformControls.attach(this.props.selectedObject);if(!this.props.selectedObject.isGroupSelection){selectCount=1;this.props.colorChanged(this.props.selectedObject.material.color.toArray().map(function(c){return c*255}))}else{selectCount=this.props.selectedObject.children.length}if(this.props.selectedObject.userData.originalChildren){this.setState({csgBackup:this.props.selectedObject.userData.originalChildren});delete this.props.selectedObject.userData.originalChildren}this.setState({label:((_this$props$selectedO2=this.props.selectedObject.userData)===null||_this$props$selectedO2===void 0?void 0:_this$props$selectedO2.label)||""})}this.transformControls.getHelper().updateMatrixWorld();this.props.sceneContext.scene.notifyChange();this.setState({selectCount:selectCount})}if(this.state.mode!==prevState.mode){this.transformControls.setMode(this.state.mode);this.transformControls.getHelper().updateMatrixWorld();this.props.sceneContext.scene.notifyChange()}if(this.props.color!==prevProps.color&&this.props.selectedObject){if(!this.props.selectedObject.isGroupSelection){var _this$props$selectedO3;(_this$props$selectedO3=this.props.selectedObject.material.color).setRGB.apply(_this$props$selectedO3,_toConsumableArray(this.props.color.map(function(c){return c/255})))}else{this.props.selectedObject.children.forEach(function(child){var _child$userData$origi;(_child$userData$origi=child.userData.originalColor).setRGB.apply(_child$userData$origi,_toConsumableArray(_this4.props.color.map(function(c){return c/255})))})}this.props.sceneContext.scene.notifyChange()}}},{key:"componentWillUnmount",value:function componentWillUnmount(){this.clearCsgBackup();this.dissolveSelectionGroup();this.transformControls.detach();this.props.sceneContext.scene.remove(this.transformControls.getHelper());this.transformControls.dispose();var domElement=this.props.sceneContext.scene.renderer.domElement;this.props.sceneContext.scene.view.controls.removeEventListener("change",this.updateTransformHelper);domElement.removeEventListener("pointerdown",this.selectShapeOnRelease);domElement.removeEventListener("keydown",this.onKeyDown);this.props.sceneContext.scene.notifyChange()}},{key:"render",value:function render(){var _this5=this;var editButtons=[{key:"translate",label:LocaleUtils.tr("draw3d.translate")},{key:"scale",label:LocaleUtils.tr("draw3d.scale")},{key:"rotate",label:LocaleUtils.tr("draw3d.rotate")}];var extraButtons=[{key:"clone",tooltip:LocaleUtils.tr("draw3d.clone"),icon:"clone"},{key:"NumericInput",tooltip:LocaleUtils.tr("draw3d.numericinput"),icon:"numericinput"}];var csgButtons=[{key:"union",label:LocaleUtils.tr("draw3d.union")},{key:"subtract",label:LocaleUtils.tr("draw3d.subtract")},{key:"intersect",label:LocaleUtils.tr("draw3d.intersect")}];return[/*#__PURE__*/React.createElement("div",{className:"redlining-controlsbar",key:"BasicControls"},/*#__PURE__*/React.createElement("div",{className:"redlining-control"},/*#__PURE__*/React.createElement(Icon,{className:"redlining-control-icon",icon:"pen",size:"large"}),/*#__PURE__*/React.createElement(ColorButton,{alpha:false,color:this.props.color,onColorChanged:this.props.colorChanged})),/*#__PURE__*/React.createElement("div",{className:"redlining-control"},/*#__PURE__*/React.createElement(ButtonBar,{active:this.state.mode,buttons:editButtons,onClick:function onClick(mode){return _this5.setState({mode:mode})}})),/*#__PURE__*/React.createElement("div",{className:"redlining-control"},/*#__PURE__*/React.createElement(ButtonBar,{active:this.state.numericInput?"NumericInput":null,buttons:extraButtons,onClick:this.toolButtonClicked})),this.state.numericInput?/*#__PURE__*/React.createElement(NumericInput3D,{sceneContext:this.props.sceneContext,selectedObject:this.props.selectedObject,toggleNumericInput:this.toggleNumericInput,transformControls:this.transformControls}):null),this.state.selectCount===0?/*#__PURE__*/React.createElement("div",{className:"redlining-message",key:"CtrlHint"},LocaleUtils.tr("draw3d.ctrlhint")):null,this.state.selectCount===1?/*#__PURE__*/React.createElement("div",{className:"redlining-controlsbar",key:"Label"},/*#__PURE__*/React.createElement("div",{className:"redlining-control redlining-control-fill controlgroup"},/*#__PURE__*/React.createElement("span",null,LocaleUtils.tr("draw3d.label"),": "),/*#__PURE__*/React.createElement(TextInput,{className:"controlgroup-fillitem",onChange:this.setLabel,value:this.state.label}))):null,this.state.selectCount===2?/*#__PURE__*/React.createElement("div",{className:"redlining-controlsbar",key:"CSGControls"},/*#__PURE__*/React.createElement("div",{className:"redlining-control redlining-control-fill"},/*#__PURE__*/React.createElement(ButtonBar,{buttons:csgButtons,onClick:this.applyCsgOperation}))):null,this.state.csgBackup?/*#__PURE__*/React.createElement("div",{className:"redlining-controlsbar",key:"CSGControls"},/*#__PURE__*/React.createElement("div",{className:"redlining-control redlining-control-fill"},/*#__PURE__*/React.createElement(ButtonBar,{buttons:[{key:"undo",label:LocaleUtils.tr("draw3d.undoBool")}],onClick:this.undoCsgOperation}))):null]}}])}(React.Component);_defineProperty(EditTool3D,"propTypes",{color:PropTypes.array,colorChanged:PropTypes.func,drawGroupId:PropTypes.string,objectPicked:PropTypes.func,sceneContext:PropTypes.object,selectedObject:PropTypes.object});export{EditTool3D as default};
|
|
@@ -1,16 +1,4 @@
|
|
|
1
|
-
div.draw3d-numeric-input-body {
|
|
2
|
-
font-size: 90%;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
1
|
div.draw3d-numeric-input-body > table {
|
|
6
2
|
width: 100%;
|
|
3
|
+
font-size: 90%;
|
|
7
4
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
div.draw3d-label-controls {
|
|
11
|
-
display: flex;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
div.draw3d-label-controls > div.TextInput {
|
|
15
|
-
flex: 1 1 auto;
|
|
16
|
-
}
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
div.map3d-animation-slider {
|
|
18
18
|
display: flex;
|
|
19
|
+
align-items: flex-end;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
div.map3d-animation-slider > span.icon {
|
|
@@ -52,14 +53,21 @@ div.maplight3d-slider {
|
|
|
52
53
|
padding: 0 1em;
|
|
53
54
|
}
|
|
54
55
|
|
|
55
|
-
div.maplight3d-slider > input {
|
|
56
|
-
margin-top: -0.
|
|
57
|
-
margin-bottom: 0.5em;
|
|
56
|
+
div.maplight3d-slider > input[type=range] {
|
|
57
|
+
margin-top: -0.25em;
|
|
58
58
|
width: 100%;
|
|
59
59
|
outline: none;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
div.maplight3d-slider > input[type=time],
|
|
63
|
+
div.maplight3d-slider > input[type=date] {
|
|
64
|
+
margin-top: -0.5em;
|
|
65
|
+
font-size: 80%;
|
|
66
|
+
text-align: center;
|
|
67
|
+
}
|
|
68
|
+
|
|
62
69
|
div.maplight3d-slider-label {
|
|
70
|
+
margin-top: 0.5em;
|
|
63
71
|
position: relative;
|
|
64
72
|
pointer-events: none;
|
|
65
73
|
}
|
|
@@ -1,27 +1,15 @@
|
|
|
1
|
-
div.
|
|
1
|
+
div.view3d-switcher-buttons > button {
|
|
2
|
+
transition: right 0.25s;
|
|
2
3
|
position: absolute;
|
|
3
|
-
height: 3em;
|
|
4
|
-
width: 3em;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
div.View3DSwitcher > button {
|
|
8
|
-
bottom: 0;
|
|
9
4
|
right: 0;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
div.View3DSwitcher.view3d-switcher-expanded {
|
|
14
|
-
width: 11em;
|
|
5
|
+
bottom: 0;
|
|
6
|
+
z-index: -1;
|
|
15
7
|
}
|
|
16
8
|
|
|
17
|
-
div.
|
|
18
|
-
|
|
9
|
+
div.view3d-switcher-buttons-expanded > button:nth-child(1) {
|
|
10
|
+
right: 3.5em;
|
|
19
11
|
}
|
|
20
12
|
|
|
21
|
-
div.
|
|
22
|
-
right:
|
|
13
|
+
div.view3d-switcher-buttons-expanded > button:nth-child(2) {
|
|
14
|
+
right: 7em;
|
|
23
15
|
}
|
|
24
|
-
|
|
25
|
-
div.View3DSwitcher.view3d-switcher-expanded > button:nth-child(3) {
|
|
26
|
-
right: 8em;
|
|
27
|
-
}
|
|
@@ -7,5 +7,4 @@ function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,
|
|
|
7
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-object-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
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
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.entries(labels).forEach(function(_ref){var _ref2=_slicedToArray(_ref,2),batchId=_ref2[0],entry=_ref2[1];var pos=new Vector3(entry.pos[0]/entry.count,entry.pos[1]/entry.count,entry.pos[2]+10).applyMatrix4(entry.matrix);tileLabels[batchId]={pos:pos,label:entry.label};labelObjects.add(
|
|
11
|
-
if(visible&&group.userData.tileLabels){var labelObjects=new Group;Object.values(group.userData.tileLabels).forEach(function(entry){labelObjects.add(createLabelObject(entry))});group.add(labelObjects)}}};export default Tiles3DStyle;
|
|
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.entries(labels).forEach(function(_ref){var _ref2=_slicedToArray(_ref,2),batchId=_ref2[0],entry=_ref2[1];var pos=new Vector3(entry.pos[0]/entry.count,entry.pos[1]/entry.count,entry.pos[2]+10).applyMatrix4(entry.matrix);tileLabels[batchId]={pos:pos,label:entry.label};tileLabels[batchId].labelObject=createLabelObject(tileLabels[batchId]);labelObjects.add(tileLabels[batchId].labelObject)});group.userData.tileLabels=tileLabels;group.add(labelObjects)}}};export default Tiles3DStyle;
|
package/components/style/App.css
CHANGED
|
@@ -161,7 +161,7 @@ button.button:not(:disabled):active > * {
|
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
button.button > span:not(.icon) {
|
|
164
|
-
margin: 0 0.
|
|
164
|
+
margin: 0 0.25em;
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
button.button > div.spinner {
|
|
@@ -174,6 +174,11 @@ div.controlgroup {
|
|
|
174
174
|
align-items: center;
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
+
div.controlgroup > .controlgroup-fillitem {
|
|
178
|
+
flex: 1 1 auto;
|
|
179
|
+
width: 0;
|
|
180
|
+
}
|
|
181
|
+
|
|
177
182
|
div.controlgroup > *:not(:last-child):not(span) {
|
|
178
183
|
margin-right: -1px;
|
|
179
184
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
div.map-button-container {
|
|
2
|
+
position: relative;
|
|
3
|
+
pointer-events: initial;
|
|
4
|
+
}
|
|
5
|
+
|
|
1
6
|
button.map-button {
|
|
2
7
|
display: flex;
|
|
3
8
|
justify-content: center;
|
|
4
9
|
align-items: center;
|
|
5
|
-
z-index: 2;
|
|
6
|
-
position: absolute !important;
|
|
7
|
-
right: 1.5em;
|
|
8
10
|
background-color: var(--map-button-bg-color);
|
|
9
11
|
width: 3em;
|
|
10
12
|
height: 3em;
|
|
@@ -12,8 +14,9 @@ button.map-button {
|
|
|
12
14
|
color: var(--map-button-text-color);
|
|
13
15
|
border: none;
|
|
14
16
|
box-shadow: 0px 5px 10px rgba(136, 136, 136, 0.5);
|
|
15
|
-
transition: background-color 0.
|
|
17
|
+
transition: background-color 0.25s, color 0.25s;
|
|
16
18
|
cursor: pointer;
|
|
19
|
+
margin: 0.5em;
|
|
17
20
|
}
|
|
18
21
|
|
|
19
22
|
button.map-button:hover {
|
|
@@ -36,33 +39,12 @@ button.map-button-disabled:hover {
|
|
|
36
39
|
color: var(--map-button-text-color);
|
|
37
40
|
}
|
|
38
41
|
|
|
39
|
-
button.map-button
|
|
40
|
-
opacity: 0.7;
|
|
41
|
-
cursor: default;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
button.map-button.locate-button-PERMISSION_DENIED:hover {
|
|
45
|
-
background-color: var(--map-button-bg-color);
|
|
46
|
-
color: var(--map-button-text-color);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
button.map-button.locate-button-LOCATING,
|
|
50
|
-
button.map-button.locate-button-ENABLED {
|
|
51
|
-
background-color: var(--map-button-text-color);
|
|
52
|
-
color: var(--map-button-bg-color);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
button.map-button.locate-button-FOLLOWING {
|
|
42
|
+
button.map-button-engaged {
|
|
56
43
|
background-color: yellow;
|
|
57
44
|
color: var(--map-button-bg-color);
|
|
58
45
|
}
|
|
59
46
|
|
|
60
|
-
button.map-button
|
|
47
|
+
button.map-button > div.spinner {
|
|
61
48
|
width: 1.5em;
|
|
62
49
|
height: 1.5em;
|
|
63
50
|
}
|
|
64
|
-
|
|
65
|
-
button.map-button-engaged {
|
|
66
|
-
background-color: yellow;
|
|
67
|
-
color: var(--map-button-bg-color);
|
|
68
|
-
}
|
|
@@ -1,4 +1,25 @@
|
|
|
1
1
|
div.PluginsContainer {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
position: absolute;
|
|
3
|
+
left: 0;
|
|
4
|
+
top: 0;
|
|
5
|
+
right: 0;
|
|
6
|
+
bottom: 0;
|
|
4
7
|
}
|
|
8
|
+
|
|
9
|
+
div.map-buttons-container {
|
|
10
|
+
position: absolute;
|
|
11
|
+
pointer-events: none;
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-direction: column-reverse;
|
|
14
|
+
align-items: flex-start;
|
|
15
|
+
align-content: flex-start;
|
|
16
|
+
justify-content: flex-start;
|
|
17
|
+
flex-wrap: wrap-reverse;
|
|
18
|
+
z-index: 2;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
div.map-buttons-spacer {
|
|
22
|
+
display: inline-block;
|
|
23
|
+
width: 3em;
|
|
24
|
+
height: 3em;
|
|
25
|
+
}
|
|
@@ -132,7 +132,6 @@ div.searchbox-filter-options {
|
|
|
132
132
|
border-right: 1px solid var(--border-color);
|
|
133
133
|
border-bottom: 1px solid var(--border-color);
|
|
134
134
|
box-shadow: 0px 2px 4px rgba(136, 136, 136, 0.5);
|
|
135
|
-
padding: 0.25em;
|
|
136
135
|
}
|
|
137
136
|
|
|
138
137
|
div.searchbox-filter-options > table {
|
|
@@ -140,7 +139,7 @@ div.searchbox-filter-options > table {
|
|
|
140
139
|
}
|
|
141
140
|
|
|
142
141
|
div.searchbox-filter-options > table td {
|
|
143
|
-
padding: 0.
|
|
142
|
+
padding: 0.25em;
|
|
144
143
|
white-space: nowrap;
|
|
145
144
|
}
|
|
146
145
|
|
|
@@ -6,4 +6,4 @@ function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/import React from"react";import classNames from"classnames";import PropTypes from"prop-types";import Icon from"../Icon";import"./style/NumberInput.css";var NumberInput=/*#__PURE__*/function(_React$Component){function NumberInput(){var _this;_classCallCheck(this,NumberInput);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key]}_this=_callSuper(this,NumberInput,[].concat(args));_defineProperty(_this,"state",{propValue:"",value:"",changed:false,valid:false});_defineProperty(_this,"onChange",function(ev){var len=ev.target.value.length;var value=ev.target.value.substring(_this.props.prefix.length,len-_this.props.suffix.length);_this.setState({value:value,changed:true})});_defineProperty(_this,"currentFloatValue",function(){var floatValue=parseFloat(_this.state.value);return isNaN(floatValue)?null:floatValue});_defineProperty(_this,"startStep",function(delta){if(_this.props.disabled||_this.props.readOnly){return}_this.props.onChange(_this.constrainValue(_this.currentFloatValue()+delta));var stepInterval=null;var stepTimeout=setTimeout(function(){stepInterval=setInterval(function(){_this.props.onChange(_this.constrainValue(_this.currentFloatValue()+delta))},50)},500);document.addEventListener("mouseup",function(){clearTimeout(stepTimeout);clearInterval(stepInterval)},{once:true})});_defineProperty(_this,"onKeyDown",function(ev){if(ev.key==="Enter"){_this.commit()}// Ensure prefix/suffix isn't changed
|
|
8
8
|
var selStart=ev.target.selectionStart;var selEnd=ev.target.selectionEnd;var len=ev.target.value.length;var startOffset=ev.key==="Backspace"&&selStart===selEnd?1:0;var endOffset=ev.key==="Delete"&&selStart===selEnd?1:0;if(selStart<_this.props.prefix.length+startOffset||selEnd>len-_this.props.suffix.length-endOffset){ev.preventDefault()}});_defineProperty(_this,"commit",function(){if(_this.state.changed){var value=_this.constrainValue(_this.currentFloatValue());_this.setState({value:value===null?"":value.toFixed(_this.props.decimals)});_this.props.onChange(value)}});_defineProperty(_this,"constrainValue",function(value){if(value===null){return null}if(_this.props.min!==undefined){value=Math.max(_this.props.min,value)}if(_this.props.max!==undefined){value=Math.min(_this.props.max,value)}var k=Math.pow(10,_this.props.decimals);return Math.round(value*k)/k});_defineProperty(_this,"setupSelectionListener",function(event){var input=event.target;var selectionHandler=function selectionHandler(ev){if(ev.target===input){// Ensure prefix/suffix isn't selected
|
|
9
|
-
var len=input.value.length;var prefixLen=_this.props.prefix.length;var suffixLen=_this.props.suffix.length;var selStart=Math.min(Math.max(input.selectionStart,prefixLen),len-suffixLen);var selEnd=Math.max(Math.min(input.selectionEnd,len-suffixLen),prefixLen);if(selStart!==input.selectionStart||selEnd!==input.selectionEnd){input.setSelectionRange(selStart,selEnd)}}};document.addEventListener("selectionchange",selectionHandler);input.addEventListener("blur",function(){document.removeEventListener("selectionchange",selectionHandler)},{once:true})});return _this}_inherits(NumberInput,_React$Component);return _createClass(NumberInput,[{key:"render",value:function render(){var _this$props$step,_this2=this;var className=classNames({"number-input":true,"number-input-mobile":this.props.mobile,"number-input-normal":!this.props.mobile,"number-input-disabled":this.props.disabled||this.props.readOnly,"number-input-invalid":this.props.required&&!this.state.value});var paddingLength=(this.props.mobile?4:1.5)+"em";var prefixSuffixLength=this.props.prefix.length+this.props.suffix.length+"ch";var numberLength=2+Math.max((this.props.min||0).toFixed(this.props.decimals).length,(this.props.max||0).toFixed(this.props.decimals).length)+"ch";var style={
|
|
9
|
+
var len=input.value.length;var prefixLen=_this.props.prefix.length;var suffixLen=_this.props.suffix.length;var selStart=Math.min(Math.max(input.selectionStart,prefixLen),len-suffixLen);var selEnd=Math.max(Math.min(input.selectionEnd,len-suffixLen),prefixLen);if(selStart!==input.selectionStart||selEnd!==input.selectionEnd){input.setSelectionRange(selStart,selEnd)}}};document.addEventListener("selectionchange",selectionHandler);input.addEventListener("blur",function(){document.removeEventListener("selectionchange",selectionHandler)},{once:true})});return _this}_inherits(NumberInput,_React$Component);return _createClass(NumberInput,[{key:"render",value:function render(){var _this$props$step,_this2=this;var className=classNames({"number-input":true,"number-input-mobile":this.props.mobile,"number-input-normal":!this.props.mobile,"number-input-disabled":this.props.disabled||this.props.readOnly,"number-input-invalid":this.props.required&&!this.state.value});var paddingLength=(this.props.mobile?4:1.5)+"em";var prefixSuffixLength=this.props.prefix.length+this.props.suffix.length+"ch";var numberLength=2+Math.max((this.props.min||0).toFixed(this.props.decimals).length,(this.props.max||0).toFixed(this.props.decimals).length)+"ch";var style={minWidth:"calc(".concat(paddingLength," + ").concat(prefixSuffixLength," + ").concat(numberLength,")")};var step=(_this$props$step=this.props.step)!==null&&_this$props$step!==void 0?_this$props$step:Math.pow(10,-this.props.decimals);var plusIcon=this.props.mobile?"plus":"chevron-up";var minusIcon=this.props.mobile?"minus":"chevron-down";return/*#__PURE__*/React.createElement("div",{className:className+" "+this.props.className},/*#__PURE__*/React.createElement("input",{disabled:this.props.disabled,onBlur:this.commit,onChange:this.onChange,onFocus:this.setupSelectionListener,onKeyDown:this.onKeyDown,placeholder:this.props.placeholder,readOnly:this.props.readOnly,required:this.props.required,style:style,type:"text",value:this.props.prefix+this.state.value+this.props.suffix}),/*#__PURE__*/React.createElement("input",{name:this.props.name,required:this.props.required,type:"hidden",value:this.state.value}),/*#__PURE__*/React.createElement(Icon,{icon:plusIcon,onMouseDown:function onMouseDown(){return _this2.startStep(+step)}}),/*#__PURE__*/React.createElement(Icon,{icon:minusIcon,onMouseDown:function onMouseDown(){return _this2.startStep(-step)}}))}}],[{key:"getDerivedStateFromProps",value:function getDerivedStateFromProps(nextProps,state){if(state.propValue!==nextProps.value){return{propValue:nextProps.value,value:typeof nextProps.value==="number"?nextProps.value.toFixed(nextProps.decimals):"",changed:false}}return null}}])}(React.Component);_defineProperty(NumberInput,"propTypes",{className:PropTypes.string,decimals:PropTypes.number,disabled:PropTypes.bool,max:PropTypes.number,min:PropTypes.number,mobile:PropTypes.bool,name:PropTypes.string,onChange:PropTypes.func,placeholder:PropTypes.string,prefix:PropTypes.string,readOnly:PropTypes.bool,required:PropTypes.bool,step:PropTypes.number,style:PropTypes.object,suffix:PropTypes.string,value:PropTypes.number});_defineProperty(NumberInput,"defaultProps",{className:"",decimals:0,mobile:false,prefix:"",suffix:""});export{NumberInput as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qwc2",
|
|
3
|
-
"version": "2025.05.
|
|
3
|
+
"version": "2025.05.15",
|
|
4
4
|
"description": "QGIS Web Client",
|
|
5
5
|
"author": "Sourcepole AG",
|
|
6
6
|
"license": "BSD-2-Clause",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"@loaders.gl/core": "^4.3.3",
|
|
23
23
|
"@loaders.gl/shapefile": "^4.3.3",
|
|
24
24
|
"@loaders.gl/zip": "^4.3.3",
|
|
25
|
-
"@panoramax/web-viewer": "^
|
|
25
|
+
"@panoramax/web-viewer": "^4.0.1",
|
|
26
26
|
"@reduxjs/toolkit": "^2.4.0",
|
|
27
27
|
"@turf/buffer": "^6.5.0",
|
|
28
28
|
"@turf/helpers": "^6.5.0",
|
|
@@ -4,7 +4,7 @@ function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof
|
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/import React from"react";import{connect}from"react-redux";import classnames from"classnames";import isEmpty from"lodash.isempty";import PropTypes from"prop-types";import{LayerRole,changeLayerProperty}from"../actions/layers";import Icon from"../components/Icon";import ConfigUtils from"../utils/ConfigUtils";import LocaleUtils from"../utils/LocaleUtils";import"./style/BackgroundSwitcher.css";/**
|
|
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{LayerRole,changeLayerProperty}from"../actions/layers";import Icon from"../components/Icon";import MapButton from"../components/MapButton";import ConfigUtils from"../utils/ConfigUtils";import LocaleUtils from"../utils/LocaleUtils";import"./style/BackgroundSwitcher.css";/**
|
|
8
8
|
* Map button for switching the background layer.
|
|
9
|
-
*/export var BackgroundSwitcher=/*#__PURE__*/function(_React$Component){function BackgroundSwitcher(){var _this;_classCallCheck(this,BackgroundSwitcher);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key]}_this=_callSuper(this,BackgroundSwitcher,[].concat(args));_defineProperty(_this,"state",{visible:false});_defineProperty(_this,"itemTitle",function(item){var _item$title;return item.titleMsgId?LocaleUtils.tr(item.titleMsgId):(_item$title=item.title)!==null&&_item$title!==void 0?_item$title:item.name});_defineProperty(_this,"renderLayerItem",function(layer,visible){var assetsPath=ConfigUtils.getAssetsPath();var itemclasses=classnames({"background-switcher-item":true,"background-switcher-item-active":visible});return/*#__PURE__*/React.createElement("div",{className:itemclasses,key:layer?layer.name:"empty",onClick:function onClick(){return _this.backgroundLayerClicked(layer)}},/*#__PURE__*/React.createElement("div",{className:"background-
|
|
10
|
-
var idx=0;var indices=backgroundLayers.reduce(function(res,l){var name=l.group||l.name;if(!res[name]){res[name]=++idx}return res},{});backgroundLayers.sort(function(a,b){return indices[a.group||a.name]-indices[b.group||b.name]});var entries=backgroundLayers.reduce(function(res,layer){if(!isEmpty(res)&&layer.group&&layer.group===res[res.length-1].group){res[res.length-1].layers.push(layer)}else if(layer.group){res.push({group:layer.group,layers:[layer]})}else{res.push(layer)}return res},[]);if(entries.length>0){
|
|
9
|
+
*/export var BackgroundSwitcher=/*#__PURE__*/function(_React$Component){function BackgroundSwitcher(){var _this;_classCallCheck(this,BackgroundSwitcher);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key]}_this=_callSuper(this,BackgroundSwitcher,[].concat(args));_defineProperty(_this,"state",{visible:false});_defineProperty(_this,"itemTitle",function(item){var _item$title;return item.titleMsgId?LocaleUtils.tr(item.titleMsgId):(_item$title=item.title)!==null&&_item$title!==void 0?_item$title:item.name});_defineProperty(_this,"renderLayerItem",function(layer,visible){var assetsPath=ConfigUtils.getAssetsPath();var itemclasses=classnames({"background-switcher-item":true,"background-switcher-item-active":visible});return/*#__PURE__*/React.createElement("div",{className:itemclasses,key:layer?layer.name:"empty",onClick:function onClick(){return _this.backgroundLayerClicked(layer)}},/*#__PURE__*/React.createElement("div",{className:"background-switcher-item-title"},layer?/*#__PURE__*/React.createElement("span",{title:_this.itemTitle(layer)},_this.itemTitle(layer)):/*#__PURE__*/React.createElement("span",null,LocaleUtils.tr("bgswitcher.nobg"))),/*#__PURE__*/React.createElement("div",{className:"background-switcher-item-thumbnail"},/*#__PURE__*/React.createElement("img",{src:layer?assetsPath+"/"+layer.thumbnail:"data:image/gif;base64,R0lGODlhAQABAIAAAP7//wAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw=="})))});_defineProperty(_this,"renderGroupItem",function(entry){var assetsPath=ConfigUtils.getAssetsPath();var layer=entry.layers.find(function(l){return l.visibility===true})||entry.layers.find(function(l){return l["default"]===true})||entry.layers[entry.layers.length-1];var itemclasses=classnames({"background-switcher-item":true,"background-switcher-item-active":layer.visibility});return/*#__PURE__*/React.createElement("div",{className:itemclasses,key:layer.name},/*#__PURE__*/React.createElement("div",{className:"background-switcher-item-title"},/*#__PURE__*/React.createElement("span",{title:_this.itemTitle(layer)},_this.itemTitle(layer)),/*#__PURE__*/React.createElement(Icon,{icon:"chevron-down"})),/*#__PURE__*/React.createElement("div",{className:"background-switcher-item-thumbnail"},/*#__PURE__*/React.createElement("img",{onClick:function onClick(){return _this.backgroundLayerClicked(layer)},src:assetsPath+"/"+layer.thumbnail})),/*#__PURE__*/React.createElement("div",{className:"background-switcher-group"},entry.layers.map(function(l){var menuitemclasses=classnames({"background-switcher-group-item":true,"background-switcher-group-item-active":l.visibility});return/*#__PURE__*/React.createElement("div",{className:menuitemclasses,key:l.name,onClick:function onClick(){return _this.backgroundLayerClicked(l)},onMouseEnter:function onMouseEnter(ev){return _this.updateGroupItem(ev,l)},onMouseLeave:function onMouseLeave(ev){return _this.updateGroupItem(ev,layer)},title:_this.itemTitle(l)},_this.itemTitle(l))})))});_defineProperty(_this,"updateGroupItem",function(ev,layer){var assetsPath=ConfigUtils.getAssetsPath();ev.target.parentElement.parentElement.childNodes[0].firstChild.innerText=_this.itemTitle(layer);ev.target.parentElement.parentElement.childNodes[1].firstChild.src=assetsPath+"/"+layer.thumbnail});_defineProperty(_this,"buttonClicked",function(){_this.setState(function(state){return{visible:!state.visible}})});_defineProperty(_this,"backgroundLayerClicked",function(layer){if(layer){_this.props.changeLayerVisibility(layer,true)}else{var visible=_this.props.layers.find(function(l){return l.visibility});if(visible){_this.props.changeLayerVisibility(visible,false)}}_this.setState({visible:false})});return _this}_inherits(BackgroundSwitcher,_React$Component);return _createClass(BackgroundSwitcher,[{key:"render",value:function render(){var _this2=this;var backgroundLayers=this.props.layers.slice(0).reverse();// Re-sort layers, ensuring grouped layers are grouped together
|
|
10
|
+
var idx=0;var indices=backgroundLayers.reduce(function(res,l){var name=l.group||l.name;if(!res[name]){res[name]=++idx}return res},{});backgroundLayers.sort(function(a,b){return indices[a.group||a.name]-indices[b.group||b.name]});var entries=backgroundLayers.reduce(function(res,layer){if(!isEmpty(res)&&layer.group&&layer.group===res[res.length-1].group){res[res.length-1].layers.push(layer)}else if(layer.group){res.push({group:layer.group,layers:[layer]})}else{res.push(layer)}return res},[]);if(entries.length>0){return/*#__PURE__*/React.createElement(MapButton,{active:this.state.visible,icon:"bglayer",onClick:this.buttonClicked,position:this.props.position,tooltip:LocaleUtils.tr("tooltip.background")},/*#__PURE__*/React.createElement("div",{className:"background-switcher "+(this.state.visible?"background-switcher-active":"")},this.renderLayerItem(null,backgroundLayers.filter(function(layer){return layer.visibility===true}).length===0),entries.map(function(entry){return entry.group?_this2.renderGroupItem(entry):_this2.renderLayerItem(entry,entry.visibility===true)})))}return null}}])}(React.Component);_defineProperty(BackgroundSwitcher,"propTypes",{changeLayerVisibility:PropTypes.func,layers:PropTypes.array,/** The position slot index of the map button, from the bottom (0: bottom slot). */position:PropTypes.number});_defineProperty(BackgroundSwitcher,"defaultProps",{position:0});var selector=function selector(state){return{layers:state.layers.flat.filter(function(layer){return layer.role===LayerRole.BACKGROUND})}};export default connect(selector,{changeLayerVisibility:function changeLayerVisibility(layer,visibility){return changeLayerProperty(layer.uuid,"visibility",visibility)}})(BackgroundSwitcher);
|
package/plugins/HomeButton.js
CHANGED
|
@@ -4,6 +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{connect}from"react-redux";import PropTypes from"prop-types";import{zoomToExtent}from"../actions/map";import
|
|
7
|
+
*/import React from"react";import{connect}from"react-redux";import PropTypes from"prop-types";import{zoomToExtent}from"../actions/map";import MapButton from"../components/MapButton";import LocaleUtils from"../utils/LocaleUtils";import ThemeUtils from"../utils/ThemeUtils";/**
|
|
8
8
|
* Map button for reverting to the home extent of the theme.
|
|
9
|
-
*/var HomeButton=/*#__PURE__*/function(_React$Component){function HomeButton(){var _this;_classCallCheck(this,HomeButton);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key]}_this=_callSuper(this,HomeButton,[].concat(args));_defineProperty(_this,"resetExtent",function(){if(_this.props.theme){var bbox=_this.props.theme.initialBbox;_this.props.zoomToExtent(bbox.bounds,bbox.crs)}});return _this}_inherits(HomeButton,_React$Component);return _createClass(HomeButton,[{key:"render",value:function render(){if(!ThemeUtils.themeFlagsAllowed(this.props.theme,this.props.themeFlagWhitelist,this.props.themeFlagBlacklist)){return null}var
|
|
9
|
+
*/var HomeButton=/*#__PURE__*/function(_React$Component){function HomeButton(){var _this;_classCallCheck(this,HomeButton);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key]}_this=_callSuper(this,HomeButton,[].concat(args));_defineProperty(_this,"resetExtent",function(){if(_this.props.theme){var bbox=_this.props.theme.initialBbox;_this.props.zoomToExtent(bbox.bounds,bbox.crs)}});return _this}_inherits(HomeButton,_React$Component);return _createClass(HomeButton,[{key:"render",value:function render(){if(!ThemeUtils.themeFlagsAllowed(this.props.theme,this.props.themeFlagWhitelist,this.props.themeFlagBlacklist)){return null}var tooltip=LocaleUtils.tr("tooltip.home");return/*#__PURE__*/React.createElement(MapButton,{icon:"home",onClick:this.resetExtent,position:this.props.position,tooltip:tooltip})}}])}(React.Component);_defineProperty(HomeButton,"propTypes",{/** The position slot index of the map button, from the bottom (0: bottom slot). */position:PropTypes.number,theme:PropTypes.object,/** Omit the button in themes matching one of these flags. */themeFlagBlacklist:PropTypes.arrayOf(PropTypes.string),/** Only show the button in themes matching one of these flags. */themeFlagWhitelist:PropTypes.arrayOf(PropTypes.string),zoomToExtent:PropTypes.func});_defineProperty(HomeButton,"defaultProps",{position:5});export default connect(function(state){return{theme:state.theme.current}},{zoomToExtent:zoomToExtent})(HomeButton);
|
package/plugins/Identify.js
CHANGED
|
@@ -15,4 +15,4 @@ function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof
|
|
|
15
15
|
* for customized queries and templates for the result presentation.
|
|
16
16
|
*/var Identify=/*#__PURE__*/function(_React$Component){function Identify(){var _this;_classCallCheck(this,Identify);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key]}_this=_callSuper(this,Identify,[].concat(args));_defineProperty(_this,"state",{mode:"Point",identifyResults:null,pendingRequests:0,radius:0,radiusUnits:_this.props.initialRadiusUnits,exitTaskOnResultsClose:null,filterGeom:null,filterGeomModifiers:{}});_defineProperty(_this,"identifyPoint",function(clickPoint){if(clickPoint){_this.setState(function(state){// Remove any search selection layer to avoid confusion
|
|
17
17
|
_this.props.removeLayer("searchselection");var pendingRequests=0;var identifyResults=_this.props.click.modifiers.ctrl!==true?{}:state.identifyResults;var queryableLayers=[];queryableLayers=IdentifyUtils.getQueryLayers(_this.props.layers,_this.props.map);queryableLayers.forEach(function(l){var request=IdentifyUtils.buildRequest(l,l.queryLayers.join(","),clickPoint,_this.props.map,_this.props.params);++pendingRequests;IdentifyUtils.sendRequest(request,function(response){_this.setState(function(state2){return{pendingRequests:state2.pendingRequests-1}});if(response){_this.parseResult(response,l,request.params.info_format,clickPoint)}})});if(!isEmpty(_this.props.click.features)){_this.props.click.features.forEach(function(feature){var layer=_this.props.layers.find(function(l){return l.id===feature.layerId});if((layer===null||layer===void 0?void 0:layer.role)===LayerRole.USERLAYER){var _layer$features$find,_layer$features,_layer$features$find2,_layer$projection;var queryFeature=_objectSpread({},(_layer$features$find=(_layer$features=layer.features)===null||_layer$features===void 0||(_layer$features$find2=_layer$features.find)===null||_layer$features$find2===void 0?void 0:_layer$features$find2.call(_layer$features,function(f){return f.id===feature.id}))!==null&&_layer$features$find!==void 0?_layer$features$find:feature);if(!(queryFeature!==null&&queryFeature!==void 0&&queryFeature.properties)){return}if(!identifyResults[layer.name]){identifyResults[layer.name]=[]}queryFeature.crs=(_layer$projection=layer.projection)!==null&&_layer$projection!==void 0?_layer$projection:_this.props.map.projection;queryFeature.displayname=queryFeature.properties.name||queryFeature.properties.Name||queryFeature.properties.NAME||queryFeature.properties.label||queryFeature.properties.id||queryFeature.id;queryFeature.layertitle=layer.title||layer.name||layer.id;queryFeature.properties=Object.entries(queryFeature.properties).reduce(function(res,_ref){var _ref2=_slicedToArray(_ref,2),key=_ref2[0],val=_ref2[1];return _objectSpread(_objectSpread({},res),{},_defineProperty({},key,_typeof(val)==="object"?JSON.stringify(val):val))},{});identifyResults[layer.name].push(queryFeature)}})}_this.props.addMarker("identify",clickPoint,"",_this.props.map.projection);return{identifyResults:identifyResults,pendingRequests:pendingRequests}})}});_defineProperty(_this,"queryPoint",function(prevProps){if(_this.props.click.button!==0||_this.props.click===prevProps.click||(_this.props.click.features||[]).find(function(feature){return feature.id==="startupposmarker"})){return null}var searchMarker=(_this.props.click.features||[]).find(function(feature){return feature.id==="searchmarker"});if(searchMarker&&searchMarker.geometry.type==="Point"){return searchMarker.geometry.coordinates}return _this.props.click.coordinate});_defineProperty(_this,"identifyRegion",function(){var queryableLayers=IdentifyUtils.getQueryLayers(_this.props.layers,_this.props.map);var poly=_this.state.filterGeom.coordinates[0];if(poly.length<3||isEmpty(queryableLayers)){return}var identifyResults=_this.state.filterGeomModifiers.ctrl!==true?{}:_this.state.identifyResults;var center=[0,0];poly.forEach(function(point){center[0]+=point[0];center[1]+=point[1]});center[0]/=poly.length;center[1]/=poly.length;var filter=VectorLayerUtils.geoJSONGeomToWkt(_this.state.filterGeom);var pendingRequests=0;var params=_objectSpread({},_this.props.params);if(_this.props.params.region_feature_count){params.feature_count=_this.props.params.region_feature_count;delete params.region_feature_count}queryableLayers.forEach(function(layer){var request=IdentifyUtils.buildFilterRequest(layer,layer.queryLayers.join(","),filter,_this.props.map,params);++pendingRequests;IdentifyUtils.sendRequest(request,function(response){_this.setState(function(state){return{pendingRequests:state.pendingRequests-1}});if(response){_this.parseResult(response,layer,request.params.info_format,center)}});_this.setState({identifyResults:identifyResults,pendingRequests:pendingRequests})})});_defineProperty(_this,"identifyRadius",function(){var clickPoint=_this.state.filterGeom.center;var queryableLayers=IdentifyUtils.getQueryLayers(_this.props.layers,_this.props.map);if(isEmpty(queryableLayers)){return}var identifyResults=_this.state.filterGeomModifiers.ctrl!==true?{}:_this.state.identifyResults;var filter=VectorLayerUtils.geoJSONGeomToWkt(_this.state.filterGeom);var pendingRequests=0;var params=_objectSpread({},_this.props.params);if(_this.props.params.radius_feature_count){params.feature_count=_this.props.params.radius_feature_count;delete params.radius_feature_count}queryableLayers.forEach(function(layer){var request=IdentifyUtils.buildFilterRequest(layer,layer.queryLayers.join(","),filter,_this.props.map,params);++pendingRequests;IdentifyUtils.sendRequest(request,function(response){_this.setState(function(state){return{pendingRequests:state.pendingRequests-1}});if(response){_this.parseResult(response,layer,request.params.info_format,clickPoint)}});_this.setState({identifyResults:identifyResults,pendingRequests:pendingRequests})});_this.props.addMarker("identify",clickPoint,"",_this.props.map.projection)});_defineProperty(_this,"changeBufferUnit",function(ev){_this.setState({radiusUnits:ev.target.value})});_defineProperty(_this,"parseResult",function(response,layer,format,clickPoint){var newResults=IdentifyUtils.parseResponse(response,layer,format,clickPoint,_this.props.map.projection,_this.props.featureInfoReturnsLayerName,_this.props.layers);// Merge with previous
|
|
18
|
-
_this.setState(function(state){var identifyResults=_objectSpread({},state.identifyResults);Object.keys(newResults).forEach(function(layername){var existingFeatures=identifyResults[layername]||[];newResults[layername].forEach(function(newFeature){var featureIndex=existingFeatures.findIndex(function(feature){return feature.id===newFeature.id});if(featureIndex===-1){existingFeatures.push(newFeature)}});identifyResults[layername]=existingFeatures});return{identifyResults:identifyResults}})});_defineProperty(_this,"onShow",function(mode,data){_this.setState({mode:mode||"Point",exitTaskOnResultsClose:data===null||data===void 0?void 0:data.exitTaskOnResultsClose});if(mode==="Point"&&data!==null&&data!==void 0&&data.pos){_this.identifyPoint(data.pos)}});_defineProperty(_this,"onToolClose",function(){_this.setState({mode:"Point",exitTaskOnResultsClose:null,filterGeom:null});if(_this.props.clearResultsOnClose){_this.clearResults()}});_defineProperty(_this,"onWindowClose",function(){_this.clearResults();if(_this.state.exitTaskOnResultsClose||_this.props.exitTaskOnResultsClose){_this.props.setCurrentTask(null)}});_defineProperty(_this,"clearResults",function(){_this.props.removeMarker("identify");_this.props.removeLayer("identifyslection");_this.props.removeLayer("identifyradiusbuffer");_this.setState({identifyResults:null,pendingRequests:0})});_defineProperty(_this,"updateRadius",function(radius,units){_this.setState(function(state){return{radius:radius,radiusUnits:units,filterGeom:_objectSpread(_objectSpread({},state.filterGeom),{},{radius:MeasureUtils.convertLength(radius,units,"m")})}})});_defineProperty(_this,"renderBody",function(){if(_this.state.mode==="Point"){return LocaleUtils.tr("infotool.clickhelpPoint")}else if(_this.state.mode==="Region"){return LocaleUtils.tr("infotool.clickhelpPolygon")}else if(_this.state.mode==="Radius"){var text=LocaleUtils.tr("infotool.clickhelpRadius");return/*#__PURE__*/React.createElement("div",null,/*#__PURE__*/React.createElement("div",null,text),/*#__PURE__*/React.createElement("div",{className:"identify-radius-controls controlgroup"},/*#__PURE__*/React.createElement("span",null,LocaleUtils.tr("infotool.radius"),":\xA0"),/*#__PURE__*/React.createElement(NumberInput,{disabled:!_this.state.filterGeom,max:1000000,min:1,mobile:true,onChange:function onChange(rad){return _this.updateRadius(rad,_this.state.radiusUnits)},value:_this.state.radius}),/*#__PURE__*/React.createElement("select",{onChange:function onChange(ev){return _this.updateRadius(_this.state.radius,ev.target.value)},value:_this.state.radiusUnits},/*#__PURE__*/React.createElement("option",{value:"m"},"m"),/*#__PURE__*/React.createElement("option",{value:"ft"},"ft"),/*#__PURE__*/React.createElement("option",{value:"km"},"km"),/*#__PURE__*/React.createElement("option",{value:"mi"},"mi"))))}return null});return _this}_inherits(Identify,_React$Component);return _createClass(Identify,[{key:"componentDidUpdate",value:function componentDidUpdate(prevProps,prevState){if(this.props.theme!==prevProps.theme){this.clearResults()}else if(!this.props.enabled&&prevProps.enabled){if(this.props.clearResultsOnClose){this.clearResults()}}if(this.props.enabled){if(this.state.mode==="Point"){var clickPoint=this.queryPoint(prevProps);this.identifyPoint(clickPoint)}else if(this.state.mode==="Region"){if(this.state.filterGeom&&this.state.filterGeom!==prevState.filterGeom){this.identifyRegion()}}else if(this.state.mode==="Radius"){if(this.state.filterGeom&&this.state.filterGeom!==prevState.filterGeom){this.setState(function(state){return{radius:MeasureUtils.convertLength(state.filterGeom.radius,"m",state.radiusUnits)}});this.identifyRadius()}}}}},{key:"render",value:function render(){var _this2=this;var resultWindow=null;if(this.state.pendingRequests>0||this.state.identifyResults!==null){var body=null;if(isEmpty(this.state.identifyResults)){if(this.state.pendingRequests>0){body=/*#__PURE__*/React.createElement("div",{className:"identify-body",role:"body"},/*#__PURE__*/React.createElement("span",{className:"identify-body-message"},LocaleUtils.tr("identify.querying")))}else{body=/*#__PURE__*/React.createElement("div",{className:"identify-body",role:"body"},/*#__PURE__*/React.createElement("span",{className:"identify-body-message"},LocaleUtils.tr("identify.noresults")))}}else{body=/*#__PURE__*/React.createElement(IdentifyViewer,{attributeCalculator:this.props.attributeCalculator,attributeTransform:this.props.attributeTransform,customExporters:this.props.customExporters,displayResultTree:this.props.displayResultTree,enableExport:this.props.enableExport,exportGeometry:this.props.exportGeometry,highlightAllResults:this.props.highlightAllResults,identifyResults:this.state.identifyResults,iframeDialogsInitiallyDocked:this.props.iframeDialogsInitiallyDocked,longAttributesDisplay:this.props.longAttributesDisplay,replaceImageUrls:this.props.replaceImageUrls,role:"body",showLayerSelector:this.props.showLayerSelector})}resultWindow=/*#__PURE__*/React.createElement(ResizeableWindow,{busyIcon:this.state.pendingRequests>0,dockable:this.props.geometry.side,icon:"info-sign",initialHeight:this.props.geometry.initialHeight,initialWidth:this.props.geometry.initialWidth,initialX:this.props.geometry.initialX,initialY:this.props.geometry.initialY,initiallyDocked:this.props.geometry.initiallyDocked,key:"IdentifyWindow",onClose:this.onWindowClose,title:LocaleUtils.tr("identify.title")},body)}return[resultWindow,/*#__PURE__*/React.createElement(TaskBar,{key:"IdentifyTaskBar",onHide:this.onToolClose,onShow:this.onShow,task:"Identify"},function(){return{body:_this2.renderBody()}}),this.state.mode==="Region"||this.state.mode==="Radius"?/*#__PURE__*/React.createElement(MapSelection,{active:true,geomType:this.state.mode==="Radius"?"Circle":"Polygon",geometry:this.state.filterGeom,geometryChanged:function geometryChanged(geom,mod){return _this2.setState({filterGeom:geom,filterGeomModifiers:mod})},key:"MapSelection",measure:this.state.mode==="Radius"}):null]}}])}(React.Component);_defineProperty(Identify,"propTypes",{addLayerFeatures:PropTypes.func,addMarker:PropTypes.func,/** Optional function for computing derived attributes. See js/IdentifyExtensions.js for details. This prop can be specified in the appConfig.js cfg section. */attributeCalculator:PropTypes.func,/** Optional function for transforming attribute values. See js/IdentifyExtensions.js for details. This prop can be specified in the appConfig.js cfg section. */attributeTransform:PropTypes.func,/** Whether to clear the identify results when exiting the identify tool. */clearResultsOnClose:PropTypes.bool,click:PropTypes.object,currentIdentifyTool:PropTypes.string,currentTask:PropTypes.string,/** Optional list of custom exporters to offer along with the built-in exporters. See js/IdentifyExtensions.js for details. This prop can be specified in the appConfig.js cfg section. */customExporters:PropTypes.array,/** Whether to display a tree overview of results (as opposed to a flat list of results). */displayResultTree:PropTypes.bool,/** Whether to enable the aggregated report download button. */enableAggregatedReports:PropTypes.bool,/** Whether to enable the export functionality. Either `true|false` or a list of single allowed formats (builtin formats: `json`, `geojson`, `csv`, `csvzip`) */enableExport:PropTypes.oneOfType([PropTypes.bool,PropTypes.array]),enabled:PropTypes.bool,/** Whether to clear the task when the results window is closed. */exitTaskOnResultsClose:PropTypes.bool,/** Whether to include the geometry in exported features. Default: `true`. */exportGeometry:PropTypes.bool,/** Whether to assume that XML GetFeatureInfo responses specify the technical layer name in the `name` attribute, rather than the layer title. */featureInfoReturnsLayerName:PropTypes.bool,/** Default window geometry with size, position and docking status. Positive position values (including '0') are related to top (InitialY) and left (InitialX), negative values (including '-0') to bottom (InitialY) and right (InitialX). */geometry:PropTypes.shape({initialWidth:PropTypes.number,initialHeight:PropTypes.number,initialX:PropTypes.number,initialY:PropTypes.number,initiallyDocked:PropTypes.bool,side:PropTypes.string}),/** Whether to highlight all results if no result is hovered */highlightAllResults:PropTypes.bool,iframeDialogsInitiallyDocked:PropTypes.bool,/** The initial radius units of the identify dialog in radius mode. One of 'm', 'ft', 'km', 'mi'. */initialRadiusUnits:PropTypes.string,layers:PropTypes.array,longAttributesDisplay:PropTypes.string,map:PropTypes.object,/** Extra params to append to the GetFeatureInfo request (i.e. `FI_POINT_TOLERANCE`, `FI_LINE_TOLERANCE`, `feature_count`, ...). Additionally, `region_feature_count` and `radius_feature_count` are supported. */params:PropTypes.object,removeLayer:PropTypes.func,removeMarker:PropTypes.func,/** Whether to replace an attribute value containing an URL to an image with an inline image. */replaceImageUrls:PropTypes.bool,selection:PropTypes.object,setCurrentTask:PropTypes.func,/** Whether to show a layer selector to filter the identify results by layer. */showLayerSelector:PropTypes.bool,theme:PropTypes.object});_defineProperty(Identify,"defaultProps",{enableAggregatedReports:true,enableExport:true,exportGeometry:true,clearResultsOnClose:true,customExporters:[],longAttributesDisplay:"ellipsis",displayResultTree:true,replaceImageUrls:true,featureInfoReturnsLayerName:true,geometry:{initialWidth:240,initialHeight:320,initialX:0,initialY:0,initiallyDocked:false,side:"left"},initialRadiusUnits:"m",highlightAllResults:true,showLayerSelector:true});export default connect(function(state){var enabled=state.task.id==="Identify"||state.task.identifyEnabled&&ConfigUtils.getConfigProp("identifyTool",state.theme.current,"Identify")==="Identify";return{click:state.map.click||{modifiers:{}},enabled:enabled,layers:state.layers.flat,map:state.map,selection:state.selection,theme:state.theme.current}},{addLayerFeatures:addLayerFeatures,addMarker:addMarker,removeMarker:removeMarker,removeLayer:removeLayer,setCurrentTask:setCurrentTask})(Identify);
|
|
18
|
+
_this.setState(function(state){var identifyResults=_objectSpread({},state.identifyResults);Object.keys(newResults).forEach(function(layername){var existingFeatures=identifyResults[layername]||[];newResults[layername].forEach(function(newFeature){var featureIndex=existingFeatures.findIndex(function(feature){return feature.id===newFeature.id});if(featureIndex===-1){existingFeatures.push(newFeature)}});identifyResults[layername]=existingFeatures});return{identifyResults:identifyResults}})});_defineProperty(_this,"onShow",function(mode,data){_this.setState({mode:mode||"Point",exitTaskOnResultsClose:data===null||data===void 0?void 0:data.exitTaskOnResultsClose});if(mode==="Point"&&data!==null&&data!==void 0&&data.pos){_this.identifyPoint(data.pos)}});_defineProperty(_this,"onToolClose",function(){_this.setState({mode:"Point",exitTaskOnResultsClose:null,filterGeom:null});if(_this.props.clearResultsOnClose){_this.clearResults()}});_defineProperty(_this,"onWindowClose",function(){_this.clearResults();if(_this.state.exitTaskOnResultsClose||_this.props.exitTaskOnResultsClose){_this.props.setCurrentTask(null)}});_defineProperty(_this,"clearResults",function(){_this.props.removeMarker("identify");_this.props.removeLayer("identifyslection");_this.props.removeLayer("identifyradiusbuffer");_this.setState({identifyResults:null,pendingRequests:0})});_defineProperty(_this,"updateRadius",function(radius,units){_this.setState(function(state){return{radius:radius,radiusUnits:units,filterGeom:_objectSpread(_objectSpread({},state.filterGeom),{},{radius:MeasureUtils.convertLength(radius,units,"m")})}})});_defineProperty(_this,"renderBody",function(){if(_this.state.mode==="Point"){return LocaleUtils.tr("infotool.clickhelpPoint")}else if(_this.state.mode==="Region"){return LocaleUtils.tr("infotool.clickhelpPolygon")}else if(_this.state.mode==="Radius"){var text=LocaleUtils.tr("infotool.clickhelpRadius");return/*#__PURE__*/React.createElement("div",null,/*#__PURE__*/React.createElement("div",null,text),/*#__PURE__*/React.createElement("div",{className:"identify-radius-controls controlgroup"},/*#__PURE__*/React.createElement("span",null,LocaleUtils.tr("infotool.radius"),":\xA0"),/*#__PURE__*/React.createElement(NumberInput,{disabled:!_this.state.filterGeom,max:1000000,min:1,mobile:true,onChange:function onChange(rad){return _this.updateRadius(rad,_this.state.radiusUnits)},value:_this.state.radius}),/*#__PURE__*/React.createElement("select",{onChange:function onChange(ev){return _this.updateRadius(_this.state.radius,ev.target.value)},value:_this.state.radiusUnits},/*#__PURE__*/React.createElement("option",{value:"m"},"m"),/*#__PURE__*/React.createElement("option",{value:"ft"},"ft"),/*#__PURE__*/React.createElement("option",{value:"km"},"km"),/*#__PURE__*/React.createElement("option",{value:"mi"},"mi"))))}return null});return _this}_inherits(Identify,_React$Component);return _createClass(Identify,[{key:"componentDidUpdate",value:function componentDidUpdate(prevProps,prevState){if(this.props.theme!==prevProps.theme){this.clearResults()}else if(!this.props.enabled&&prevProps.enabled){if(this.props.clearResultsOnClose){this.clearResults()}}if(this.props.enabled){if(this.state.mode==="Point"){var clickPoint=this.queryPoint(prevProps);this.identifyPoint(clickPoint)}else if(this.state.mode==="Region"){if(this.state.filterGeom&&this.state.filterGeom!==prevState.filterGeom){this.identifyRegion()}}else if(this.state.mode==="Radius"){if(this.state.filterGeom&&this.state.filterGeom!==prevState.filterGeom){this.setState(function(state){return{radius:MeasureUtils.convertLength(state.filterGeom.radius,"m",state.radiusUnits)}});this.identifyRadius()}}}}},{key:"render",value:function render(){var _this2=this;var resultWindow=null;if(this.state.pendingRequests>0||this.state.identifyResults!==null){var body=null;if(isEmpty(this.state.identifyResults)){if(this.state.pendingRequests>0){body=/*#__PURE__*/React.createElement("div",{className:"identify-body",role:"body"},/*#__PURE__*/React.createElement("span",{className:"identify-body-message"},LocaleUtils.tr("identify.querying")))}else{body=/*#__PURE__*/React.createElement("div",{className:"identify-body",role:"body"},/*#__PURE__*/React.createElement("span",{className:"identify-body-message"},LocaleUtils.tr("identify.noresults")))}}else{body=/*#__PURE__*/React.createElement(IdentifyViewer,{attributeCalculator:this.props.attributeCalculator,attributeTransform:this.props.attributeTransform,customExporters:this.props.customExporters,displayResultTree:this.props.displayResultTree,enableAggregatedReports:this.props.enableAggregatedReports,enableExport:this.props.enableExport,exportGeometry:this.props.exportGeometry,highlightAllResults:this.props.highlightAllResults,identifyResults:this.state.identifyResults,iframeDialogsInitiallyDocked:this.props.iframeDialogsInitiallyDocked,longAttributesDisplay:this.props.longAttributesDisplay,replaceImageUrls:this.props.replaceImageUrls,role:"body",showLayerSelector:this.props.showLayerSelector})}resultWindow=/*#__PURE__*/React.createElement(ResizeableWindow,{busyIcon:this.state.pendingRequests>0,dockable:this.props.geometry.side,icon:"info-sign",initialHeight:this.props.geometry.initialHeight,initialWidth:this.props.geometry.initialWidth,initialX:this.props.geometry.initialX,initialY:this.props.geometry.initialY,initiallyDocked:this.props.geometry.initiallyDocked,key:"IdentifyWindow",onClose:this.onWindowClose,title:LocaleUtils.tr("identify.title")},body)}return[resultWindow,/*#__PURE__*/React.createElement(TaskBar,{key:"IdentifyTaskBar",onHide:this.onToolClose,onShow:this.onShow,task:"Identify"},function(){return{body:_this2.renderBody()}}),this.state.mode==="Region"||this.state.mode==="Radius"?/*#__PURE__*/React.createElement(MapSelection,{active:true,geomType:this.state.mode==="Radius"?"Circle":"Polygon",geometry:this.state.filterGeom,geometryChanged:function geometryChanged(geom,mod){return _this2.setState({filterGeom:geom,filterGeomModifiers:mod})},key:"MapSelection",measure:this.state.mode==="Radius"}):null]}}])}(React.Component);_defineProperty(Identify,"propTypes",{addLayerFeatures:PropTypes.func,addMarker:PropTypes.func,/** Optional function for computing derived attributes. See js/IdentifyExtensions.js for details. This prop can be specified in the appConfig.js cfg section. */attributeCalculator:PropTypes.func,/** Optional function for transforming attribute values. See js/IdentifyExtensions.js for details. This prop can be specified in the appConfig.js cfg section. */attributeTransform:PropTypes.func,/** Whether to clear the identify results when exiting the identify tool. */clearResultsOnClose:PropTypes.bool,click:PropTypes.object,currentIdentifyTool:PropTypes.string,currentTask:PropTypes.string,/** Optional list of custom exporters to offer along with the built-in exporters. See js/IdentifyExtensions.js for details. This prop can be specified in the appConfig.js cfg section. */customExporters:PropTypes.array,/** Whether to display a tree overview of results (as opposed to a flat list of results). */displayResultTree:PropTypes.bool,/** Whether to enable the aggregated report download button. */enableAggregatedReports:PropTypes.bool,/** Whether to enable the export functionality. Either `true|false` or a list of single allowed formats (builtin formats: `json`, `geojson`, `csv`, `csvzip`) */enableExport:PropTypes.oneOfType([PropTypes.bool,PropTypes.array]),enabled:PropTypes.bool,/** Whether to clear the task when the results window is closed. */exitTaskOnResultsClose:PropTypes.bool,/** Whether to include the geometry in exported features. Default: `true`. */exportGeometry:PropTypes.bool,/** Whether to assume that XML GetFeatureInfo responses specify the technical layer name in the `name` attribute, rather than the layer title. */featureInfoReturnsLayerName:PropTypes.bool,/** Default window geometry with size, position and docking status. Positive position values (including '0') are related to top (InitialY) and left (InitialX), negative values (including '-0') to bottom (InitialY) and right (InitialX). */geometry:PropTypes.shape({initialWidth:PropTypes.number,initialHeight:PropTypes.number,initialX:PropTypes.number,initialY:PropTypes.number,initiallyDocked:PropTypes.bool,side:PropTypes.string}),/** Whether to highlight all results if no result is hovered */highlightAllResults:PropTypes.bool,iframeDialogsInitiallyDocked:PropTypes.bool,/** The initial radius units of the identify dialog in radius mode. One of 'm', 'ft', 'km', 'mi'. */initialRadiusUnits:PropTypes.string,layers:PropTypes.array,longAttributesDisplay:PropTypes.string,map:PropTypes.object,/** Extra params to append to the GetFeatureInfo request (i.e. `FI_POINT_TOLERANCE`, `FI_LINE_TOLERANCE`, `feature_count`, ...). Additionally, `region_feature_count` and `radius_feature_count` are supported. */params:PropTypes.object,removeLayer:PropTypes.func,removeMarker:PropTypes.func,/** Whether to replace an attribute value containing an URL to an image with an inline image. */replaceImageUrls:PropTypes.bool,selection:PropTypes.object,setCurrentTask:PropTypes.func,/** Whether to show a layer selector to filter the identify results by layer. */showLayerSelector:PropTypes.bool,theme:PropTypes.object});_defineProperty(Identify,"defaultProps",{enableAggregatedReports:true,enableExport:true,exportGeometry:true,clearResultsOnClose:true,customExporters:[],longAttributesDisplay:"ellipsis",displayResultTree:true,replaceImageUrls:true,featureInfoReturnsLayerName:true,geometry:{initialWidth:240,initialHeight:320,initialX:0,initialY:0,initiallyDocked:false,side:"left"},initialRadiusUnits:"m",highlightAllResults:true,showLayerSelector:true});export default connect(function(state){var enabled=state.task.id==="Identify"||state.task.identifyEnabled&&ConfigUtils.getConfigProp("identifyTool",state.theme.current,"Identify")==="Identify";return{click:state.map.click||{modifiers:{}},enabled:enabled,layers:state.layers.flat,map:state.map,selection:state.selection,theme:state.theme.current}},{addLayerFeatures:addLayerFeatures,addMarker:addMarker,removeMarker:removeMarker,removeLayer:removeLayer,setCurrentTask:setCurrentTask})(Identify);
|