qwc2 2025.8.7 → 2025.8.20
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/actions/locale.js +1 -6
- package/components/LayerInfoWindow.js +1 -1
- package/components/MessageBar.js +7 -0
- package/components/PluginsContainer.js +3 -2
- package/components/ResizeableWindow.js +2 -2
- package/components/SearchBox.js +1 -1
- package/components/ServiceInfoWindow.js +1 -1
- package/components/SideBar.js +2 -2
- package/components/StandardApp.js +12 -16
- package/components/TaskBar.js +2 -2
- package/components/ThemeList.js +1 -1
- package/components/map/OlMap.js +2 -2
- package/components/map3d/ImportObjects3D.js +1 -1
- package/components/map3d/Map3D.js +12 -11
- 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/style/MapControls3D.css +9 -16
- package/components/map3d/utils/MiscUtils3D.js +7 -2
- package/components/map3d/utils/OrbitControls3D.js +2 -1
- package/components/map3d/utils/Tiles3DStyle.js +4 -4
- package/components/style/{TaskBar.css → MessageBar.css} +4 -4
- package/components/style/PluginsContainer.css +1 -1
- package/components/widgets/TextInput.js +1 -1
- package/icons/above_terr.svg +81 -0
- package/icons/above_zero.svg +80 -0
- package/package.json +3 -2
- package/plugins/API.js +3 -3
- package/plugins/AttributeTable.js +1 -1
- package/plugins/BottomBar.js +1 -1
- package/plugins/HeightProfile.js +10 -7
- package/plugins/Map.js +4 -3
- package/plugins/MapCompare.js +1 -1
- package/plugins/MapCopyright.js +2 -2
- package/plugins/MapExport.js +1 -1
- package/plugins/Reports.js +1 -1
- package/plugins/Routing.js +1 -1
- package/plugins/TopBar.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/{components/map3d/Settings3D.js → plugins/map3d/BackgroundSwitcher3D.js} +3 -1
- package/{components → plugins}/map3d/BottomBar3D.js +3 -1
- package/plugins/map3d/Compare3D.js +14 -0
- package/{components → plugins}/map3d/Draw3D.js +3 -1
- package/{components → plugins}/map3d/ExportObjects3D.js +12 -11
- package/plugins/map3d/HideObjects3D.js +18 -0
- package/{components → plugins}/map3d/Identify3D.js +10 -6
- package/plugins/map3d/LayerTree3D.js +9 -0
- package/plugins/map3d/MapCopyright3D.js +11 -0
- package/{components → plugins}/map3d/MapExport3D.js +3 -1
- package/plugins/map3d/MapLight3D.js +11 -0
- package/{components → plugins}/map3d/Measure3D.js +3 -1
- package/{components → plugins}/map3d/OverviewMap3D.js +3 -3
- package/plugins/map3d/Settings3D.js +9 -0
- package/plugins/map3d/TopBar3D.js +15 -0
- package/plugins/style/HeightProfile.css +10 -0
- package/plugins/style/MapCopyright.css +3 -3
- package/plugins/style/View3D.css +0 -4
- package/reducers/localConfig.js +1 -1
- package/reducers/windows.js +1 -1
- package/scripts/gen-plugin-docs.js +2 -2
- package/selectors/searchproviders.js +3 -7
- 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 +5 -1
- package/static/translations/uk-UA.json +747 -0
- package/utils/LayerUtils.js +1 -1
- package/utils/LocaleUtils.js +6 -1
- package/utils/PluginStore.js +1 -0
- package/utils/SearchProviders.js +8 -3
- package/utils/ThemeUtils.js +2 -2
- package/components/map/OlLocate.css +0 -56
- package/components/map/OlLocate.js +0 -17
- package/components/map3d/Compare3D.js +0 -12
- package/components/map3d/HideObjects3D.js +0 -14
- package/components/map3d/LayerTree3D.js +0 -7
- package/components/map3d/Map3DLight.js +0 -11
- package/components/map3d/TopBar3D.js +0 -7
- package/components/map3d/img/viewcone.svg +0 -124
- package/components/map3d/models/arrow.glb +0 -0
- package/components/map3d/models/pin.glb +0 -0
- package/utils/img/person.png +0 -0
- /package/{components → plugins}/map3d/style/BottomBar3D.css +0 -0
- /package/{components → plugins}/map3d/style/Compare3D.css +0 -0
- /package/{components → plugins}/map3d/style/HideObjects3D.css +0 -0
- /package/{components → plugins}/map3d/style/LayerTree3D.css +0 -0
- /package/{components/map3d/style/Map3DLight.css → plugins/map3d/style/MapLight3D.css} +0 -0
- /package/{components → plugins}/map3d/style/OverviewMap3D.css +0 -0
- /package/{components → plugins}/map3d/style/Settings3D.css +0 -0
|
@@ -4,11 +4,11 @@ function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,
|
|
|
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{Parser as ExprParser}from"expr-eval";import isEmpty from"lodash.isempty";import parseCssColor from"parse-css-color";import{Float32BufferAttribute,Group,Vector3}from"three";import MiscUtils from"../../../utils/MiscUtils";import{createLabelObject}from"./MiscUtils3D";var styleExpressionParser=new ExprParser;styleExpressionParser.functions.color=function(name){var alpha=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;var color=parseCssColor(name);return[].concat(_toConsumableArray(color.values.map(function(c){return c/255})),[alpha])};styleExpressionParser.functions.rgb=function(r,g,b){return[r/255,g/255,g/255,1]};styleExpressionParser.functions.rgba=function(r,g,b,a){return[r/255,g/255,g/255,a]};styleExpressionParser.functions.hsl=function(h,s,l){return[].concat(_toConsumableArray(MiscUtils.hslToRgb(h,s,l)),[1])};styleExpressionParser.functions.hsla=function(h,s,l,a){return[].concat(_toConsumableArray(MiscUtils.hslToRgb(h,s,l)),[a])};function
|
|
8
|
-
var
|
|
9
|
-
var label=
|
|
7
|
+
*/import{Parser as ExprParser}from"expr-eval";import isEmpty from"lodash.isempty";import parseCssColor from"parse-css-color";import{Float32BufferAttribute,Group,Vector3}from"three";import MiscUtils from"../../../utils/MiscUtils";import{createLabelObject,TileMeshHelper}from"./MiscUtils3D";var styleExpressionParser=new ExprParser;styleExpressionParser.functions.color=function(name){var alpha=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;var color=parseCssColor(name);return[].concat(_toConsumableArray(color.values.map(function(c){return c/255})),[alpha])};styleExpressionParser.functions.rgb=function(r,g,b){return[r/255,g/255,g/255,1]};styleExpressionParser.functions.rgba=function(r,g,b,a){return[r/255,g/255,g/255,a]};styleExpressionParser.functions.hsl=function(h,s,l){return[].concat(_toConsumableArray(MiscUtils.hslToRgb(h,s,l)),[1])};styleExpressionParser.functions.hsla=function(h,s,l,a){return[].concat(_toConsumableArray(MiscUtils.hslToRgb(h,s,l)),[a])};function featureColor(objectId,featureProperties,context){var _context$featureStyle,_context$featureStyle2;if(((_context$featureStyle=(_context$featureStyle2=context.featureStyles)===null||_context$featureStyle2===void 0||(_context$featureStyle2=_context$featureStyle2[objectId])===null||_context$featureStyle2===void 0?void 0:_context$featureStyle2.color)!==null&&_context$featureStyle!==void 0?_context$featureStyle:null)!==null){var color=parseCssColor(context.featureStyles[objectId].color);return[].concat(_toConsumableArray(color.values.map(function(c){return c/255})),[color.alpha])}else if(context.colorExpressions.length){try{for(var i=0;i<context.colorExpressions.length;++i){var condition=context.colorExpressions[i][0].evaluate(featureProperties);if(condition){return context.colorExpressions[i][1].evaluate(featureProperties)}}}catch(e){/* eslint-disable-next-line */console.warn("Failed to parse color expression: "+String(e))}return null}else if(featureProperties[context.colorAttr]){var _featureProperties$co;var _color=featureProperties[context.colorAttr];var alpha=context.alphaAttr?(_featureProperties$co=featureProperties[context.alphaAttr])!==null&&_featureProperties$co!==void 0?_featureProperties$co: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 featureLabel(objectId,featureProperties,context){var _context$featureStyle3,_context$featureStyle4;if(((_context$featureStyle3=(_context$featureStyle4=context.featureStyles)===null||_context$featureStyle4===void 0||(_context$featureStyle4=_context$featureStyle4[objectId])===null||_context$featureStyle4===void 0?void 0:_context$featureStyle4.label)!==null&&_context$featureStyle3!==void 0?_context$featureStyle3:null)!==null){var _context$featureStyle5;return{text:context.featureStyles[objectId].label,offset:(_context$featureStyle5=context.featureStyles[objectId].labelOffset)!==null&&_context$featureStyle5!==void 0?_context$featureStyle5:80}}else if(context.labelAttr){return featureProperties[context.labelAttr]}else{return null}}var Tiles3DStyle={applyTileStyle:function applyTileStyle(group,config,sceneContext){var _config$idAttr,_config$tilesetStyle,_config$tilesetStyle2;var featureColorCache={};var featureLabelCache={};var labels={};var idAttr=(_config$idAttr=config.idAttr)!==null&&_config$idAttr!==void 0?_config$idAttr:"id";var context={colorExpressions:[],featureStyles:(_config$tilesetStyle=config.tilesetStyle)===null||_config$tilesetStyle===void 0?void 0:_config$tilesetStyle.featureStyles,colorAttr:config.colorAttr,alphaAttr:config.alphaAttr,labelAttr:config.labelAttr};var baseColor=[1,1,1,1];var customBaseColor=false;if(config.baseColor){var color=parseCssColor(config.baseColor);baseColor=[].concat(_toConsumableArray(color.values.map(function(x){return x/255})),[color.alpha]);customBaseColor=true}var colorRules=(_config$tilesetStyle2=config.tilesetStyle)===null||_config$tilesetStyle2===void 0?void 0:_config$tilesetStyle2.color;var parseExpr=function parseExpr(expr){var cleanExpr=expr.replace(/\$\{(\w+)\}/g,"$1").replaceAll("===","==").replaceAll("!==","==");return styleExpressionParser.parse(cleanExpr)};if(colorRules!==null&&colorRules!==void 0&&colorRules.conditions){colorRules===null||colorRules===void 0||colorRules.conditions.map(function(cond){context.colorExpressions.push([parseExpr(cond[0]),parseExpr(cond[1])])})}else if(typeof colorRules==="string"){context.colorExpressions.push([parseExpr("true"),parseExpr(colorRules)])}group.traverse(function(c){if(c.geometry){var helper=new TileMeshHelper(c);var featureIdAttr=helper.getFeatureIdAttr();if(!featureIdAttr){return}var posAttr=c.geometry.getAttribute("position");var rgbaColors=[];var rgbColors=[];var haveColor=customBaseColor;var haveAlpha=baseColor[3]<1;for(var idx=0;idx<featureIdAttr.count;++idx){var featureId=featureIdAttr.getX(idx);var featureProperties=helper.getFeatureProperties(featureId);var objectId=String(featureProperties[idAttr]);// Handle color
|
|
8
|
+
var _color2=featureColorCache[featureId];if(_color2===undefined){_color2=featureColorCache[featureId]=featureColor(objectId,featureProperties,context)}if(_color2){haveColor=true;haveAlpha|=_color2[3]<1;rgbaColors.push.apply(rgbaColors,_toConsumableArray(_color2));rgbColors.push.apply(rgbColors,_toConsumableArray(_color2.slice(0,3)))}else{rgbaColors.push.apply(rgbaColors,_toConsumableArray(baseColor));rgbColors.push.apply(rgbColors,_toConsumableArray(baseColor.slice(0,3)))}// Handle label
|
|
9
|
+
var label=featureLabelCache[featureId];if(label===undefined){label=featureLabelCache[featureId]=featureLabel(objectId,featureProperties,context)}if(label){var pos=posAttr.array.slice(3*idx,3*idx+3);var entry=labels[featureId];if(!entry){entry=labels[featureId]={label:label.text,labelOffset:label.offset,pos:pos,ymax:pos[1],count:1,matrix:c.matrixWorld}}else{entry.pos[0]+=pos[0];entry.pos[1]+=pos[1];entry.pos[2]+=pos[2];entry.ymax=Math.max(entry.ymax,pos[1]);++entry.count}}}// NOTE: Also update color buffers if they were previously colored
|
|
10
10
|
if(haveColor||group.userData.haveColor){if(haveAlpha){c.geometry.setAttribute("color",new Float32BufferAttribute(rgbaColors,4))}else{// Discard alpha
|
|
11
11
|
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;group.userData.haveColor=haveColor}}});// Clear previous labels
|
|
12
12
|
if(group.userData.labelGroup){group.remove(group.children.find(function(child){return child.uuid===group.userData.labelGroup}));// Explicitly remove label DOM elements
|
|
13
13
|
Object.values(group.userData.tileLabels).forEach(function(entry){entry.labelObject.element.parentNode.removeChild(entry.labelObject.element)});delete group.userData.tileLabels;delete group.userData.labelGroup}// Add new labels
|
|
14
|
-
if(!isEmpty(labels)){var tileLabels={};var labelObjects=new Group;Object.entries(labels).forEach(function(_ref){var _ref2=_slicedToArray(_ref,2),
|
|
14
|
+
if(!isEmpty(labels)){var tileLabels={};var labelObjects=new Group;Object.entries(labels).forEach(function(_ref){var _ref2=_slicedToArray(_ref,2),featureId=_ref2[0],entry=_ref2[1];var pos=new Vector3(entry.pos[0]/entry.count,entry.pos[1]/entry.count,entry.pos[2]/entry.count).applyMatrix4(entry.matrix);var maxpos=new Vector3(entry.pos[0]/entry.count,entry.ymax,entry.pos[2]/entry.count).applyMatrix4(entry.matrix);tileLabels[featureId]={pos:pos,label:entry.label,labelOffset:entry.labelOffset};tileLabels[featureId].labelObject=createLabelObject(entry.label,pos,sceneContext,0,entry.labelOffset+(maxpos.y-pos.y));labelObjects.add(tileLabels[featureId].labelObject)});group.userData.tileLabels=tileLabels;group.userData.labelGroup=labelObjects.uuid;group.add(labelObjects)}}};export default Tiles3DStyle;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
div.
|
|
1
|
+
div.messagebar-container {
|
|
2
2
|
position: absolute;
|
|
3
3
|
left: 0;
|
|
4
4
|
right: 0;
|
|
@@ -8,7 +8,7 @@ div.taskbar-container {
|
|
|
8
8
|
z-index: 3;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
div.
|
|
11
|
+
div.messagebar {
|
|
12
12
|
position: relative;
|
|
13
13
|
flex: 0 0 auto;
|
|
14
14
|
pointer-events: initial;
|
|
@@ -20,12 +20,12 @@ div.taskbar {
|
|
|
20
20
|
border-top: 1px solid rgba(136, 136, 136, 0.5);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
div.
|
|
23
|
+
div.messagebar > div.body {
|
|
24
24
|
padding: 0.25em 0.5em 0.25em 0.25em;
|
|
25
25
|
display: inline-block;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
div.
|
|
28
|
+
div.messagebar > span.closewrapper {
|
|
29
29
|
position: absolute;
|
|
30
30
|
right: 0;
|
|
31
31
|
top: 0;
|
|
@@ -4,4 +4,4 @@ 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 classNames from"classnames";import PropTypes from"prop-types";import LocaleUtils from"../../utils/LocaleUtils";import MiscUtils from"../../utils/MiscUtils";import Icon from"../Icon";import"./style/TextInput.css";var TextInput=/*#__PURE__*/function(_React$Component){function TextInput(props){var _this;_classCallCheck(this,TextInput);_this=_callSuper(this,TextInput,[props]);_defineProperty(_this,"state",{focus:false,value:"",valueRev:0,curValue:"",changed:false});_defineProperty(_this,"setDefaultValue",function(value,valueRev,prevValueRef){if(valueRev>prevValueRef){_this.input.innerHTML=value.replaceAll("\n",_this.props.multiline?"<br />":"")}});_defineProperty(_this,"onCopy",function(ev,cut){ev.preventDefault();var selection=window.getSelection();var plainText=selection.toString();if(ev.clipboardData){ev.clipboardData.setData("text/plain",plainText)}if(cut){_this.clear()}});_defineProperty(_this,"clear",function(){var clearValue=_this.props.clearValue;_this.props.onChange(clearValue);_this.setState(function(state){return{curValue:_this.props.clearValue,changed:state.value!==clearValue}});_this.input.innerHTML=clearValue});_defineProperty(_this,"onChange",function(ev){var curValue=ev.target.innerText.replace(/<br\s*\/?>$/,"").replace(/\n$/,"");if(!_this.props.multiline){curValue=curValue.replace("\n","")}_this.setState({curValue:curValue,changed:true})});_defineProperty(_this,"onBlur",function(){_this.setState({focus:false});if(!_this.skipNextCommitOnBlur){_this.commit()}});_defineProperty(_this,"onFocus",function(ev){_this.setState({focus:true});window.setTimeout(function(){if(window.getSelection&&document.createRange){var range=document.createRange();range.selectNodeContents(ev.target);var sel=window.getSelection();sel.removeAllRanges();sel.addRange(range)}else if(document.body.createTextRange){var _range=document.body.createTextRange();_range.moveToElementText(ev.target);_range.select()}},1)});_defineProperty(_this,"onMouseDown",function(ev){var el=document.elementFromPoint(ev.clientX,ev.clientY);if((el===null||el===void 0?void 0:el.nodeName)==="A"&&ev.ctrlKey){window.open(el.href,el.target)}});_defineProperty(_this,"onMouseMove",function(ev){var isTouch="ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0;clearTimeout(_this.tooltipTimeout);var editable=!_this.props.disabled&&!_this.props.readOnly;if(!isTouch&&editable&&ev.target.nodeName==="A"){var rect=ev.target.getBoundingClientRect();var left=rect.left+window.scrollX;var bottom=rect.bottom+window.scrollY+2;_this.tooltipTimeout=setTimeout(function(){if(!_this.tooltipEl){_this.tooltipEl=document.createElement("span");_this.tooltipEl.className="text-input-link-tooltip";_this.tooltipEl.innerHTML=LocaleUtils.tr("misc.ctrlclickhint");_this.tooltipEl.style.position="absolute";_this.tooltipEl.style.zIndex=10000000000;document.body.appendChild(_this.tooltipEl)}_this.tooltipEl.style.left=left+"px";_this.tooltipEl.style.top=bottom+"px";_this.tooltipTimeout=null},250)}else if(_this.tooltipEl){document.body.removeChild(_this.tooltipEl);_this.tooltipEl=null}});_defineProperty(_this,"onMouseLeave",function(){clearTimeout(_this.tooltipTimeout);if(_this.tooltipEl){document.body.removeChild(_this.tooltipEl);_this.tooltipEl=null}});_defineProperty(_this,"onKeyDown",function(ev){if(ev.key==="Enter"&&!_this.props.multiline){ev.preventDefault();_this.commit()}else if(ev.key==="Escape"){_this.setState(function(state){return{value:_this.props.value,valueRev:state.valueRev+1,curValue:_this.props.value||"",changed:false}});_this.skipNextCommitOnBlur=true;ev.target.blur()}});_defineProperty(_this,"commit",function(){if(_this.state.changed){if(_this.props.addLinkAnchors){var valueWithLinks=MiscUtils.addLinkAnchors(_this.state.curValue);_this.props.onChange(valueWithLinks)}else{_this.props.onChange(_this.state.curValue)}}});_defineProperty(_this,"storeInitialHeight",function(el){if(el){_this.initialHeight=el.offsetHeight}});_defineProperty(_this,"startResize",function(ev){var container=ev.target.parentElement;if(!container){return}var startHeight=container.offsetHeight;var startMouseY=ev.clientY;var resizeInput=function resizeInput(event){container.style.height=Math.max(_this.initialHeight,startHeight+(event.clientY-startMouseY))+"px"};document.body.style.userSelect="none";ev.view.addEventListener("pointermove",resizeInput);ev.view.addEventListener("pointerup",function(){document.body.style.userSelect="";ev.view.removeEventListener("pointermove",resizeInput)},{once:true})});_this.skipNextCommitOnBlur=false;_this.focusEnterClick=false;_this.initialHeight=null;_this.input=null;_this.tooltipEl=null;_this.tooltipTimeout=null;return _this}_inherits(TextInput,_React$Component);return _createClass(TextInput,[{key:"componentDidUpdate",value:function componentDidUpdate(prevProps,prevState){this.setDefaultValue(this.state.value,this.state.valueRev,prevState.valueRev)}},{key:"render",value:function render(){var _this2=this;var wrapperClassName=classNames({"TextInput":true,"text-input-wrapper":true,"text-input-wrapper-multiline":this.props.multiline,"text-input-wrapper-focused":this.state.focus});var preClassName=classNames({"text-input":true,"text-input-disabled":this.props.disabled,"text-input-readonly":this.props.readOnly||!this.state.curValue,"text-input-invalid":this.props.required&&!this.state.curValue});var showClear=this.state.focus&&!this.props.multiline&&!this.props.disabled&&!this.props.readOnly&&this.state.curValue;var style=_objectSpread({},this.props.style);if(showClear){style.marginRight="1.5em"}return/*#__PURE__*/React.createElement("div",{className:wrapperClassName+" "+(this.props.className||""),ref:this.storeInitialHeight},this.props.name?/*#__PURE__*/React.createElement("textarea",{className:"text-input-form-el",name:this.props.name,onChange:function onChange(){},required:this.props.required,tabIndex:"-1",value:this.state.curValue}):null,/*#__PURE__*/React.createElement("pre",{className:preClassName,contentEditable:!this.props.disabled&&!this.props.readOnly,dangerouslySetInnerHTML:{__html:this.state.value.replaceAll("\n",this.props.multiline?"<br />":"")},onBlur:this.onBlur,onChange:this.onChange,onCopy:function onCopy(ev){return _this2.onCopy(ev,false)},onCut:function onCut(ev){return _this2.onCopy(ev,true)},onFocus:this.onFocus,onInput:this.onChange,onKeyDown:this.onKeyDown,onMouseDown:this.onMouseDown,onMouseLeave:this.onMouseLeave,onMouseMove:this.onMouseMove,ref:function ref(el){_this2.input=el},style:style}),!this.state.curValue?/*#__PURE__*/React.createElement("div",{className:"text-input-placeholder"},this.props.placeholder):null,this.props.multiline?/*#__PURE__*/React.createElement("div",{className:"text-input-resize-handle",onPointerDown:this.startResize}):null,showClear?/*#__PURE__*/React.createElement("div",{className:"text-input-clear-icon"},/*#__PURE__*/React.createElement(Icon,{icon:"clear",onClick:this.clear,onMouseDown:MiscUtils.killEvent})):null)}}],[{key:"getDerivedStateFromProps",value:function getDerivedStateFromProps(nextProps,state){if(state.value!==nextProps.value){return{value:nextProps.value,valueRev:state.valueRev+1,curValue:nextProps.value||"",changed:false}}return null}}])}(React.Component);_defineProperty(TextInput,"propTypes",{addLinkAnchors:PropTypes.bool,className:PropTypes.string,clearValue:PropTypes.string,disabled:PropTypes.bool,multiline:PropTypes.bool,name:PropTypes.string,onChange:PropTypes.func,placeholder:PropTypes.string,readOnly:PropTypes.bool,required:PropTypes.bool,style:PropTypes.object,value:PropTypes.string});_defineProperty(TextInput,"defaultProps",{clearValue:"",placeholder:""});export{TextInput as default};
|
|
7
|
+
*/import React from"react";import classNames from"classnames";import DOMPurify from"dompurify";import PropTypes from"prop-types";import LocaleUtils from"../../utils/LocaleUtils";import MiscUtils from"../../utils/MiscUtils";import Icon from"../Icon";import"./style/TextInput.css";var TextInput=/*#__PURE__*/function(_React$Component){function TextInput(props){var _this;_classCallCheck(this,TextInput);_this=_callSuper(this,TextInput,[props]);_defineProperty(_this,"state",{focus:false,value:"",valueRev:0,curValue:"",changed:false});_defineProperty(_this,"setDefaultValue",function(value,valueRev,prevValueRef){if(valueRev>prevValueRef){_this.input.innerHTML=DOMPurify.sanitize(value.replaceAll("\n",_this.props.multiline?"<br />":""))}});_defineProperty(_this,"onCopy",function(ev,cut){ev.preventDefault();var selection=window.getSelection();var plainText=selection.toString();if(ev.clipboardData){ev.clipboardData.setData("text/plain",plainText)}if(cut){_this.clear()}});_defineProperty(_this,"clear",function(){var clearValue=_this.props.clearValue;_this.props.onChange(clearValue);_this.setState(function(state){return{curValue:_this.props.clearValue,changed:state.value!==clearValue}});_this.input.innerHTML=clearValue});_defineProperty(_this,"onChange",function(ev){var curValue=DOMPurify.sanitize(ev.target.innerText.replace(/<br\s*\/?>$/,"").replace(/\n$/,""));if(!_this.props.multiline){curValue=curValue.replace("\n","")}_this.setState({curValue:curValue,changed:true})});_defineProperty(_this,"onBlur",function(){_this.setState({focus:false});if(!_this.skipNextCommitOnBlur){_this.commit()}});_defineProperty(_this,"onFocus",function(ev){_this.setState({focus:true});window.setTimeout(function(){if(window.getSelection&&document.createRange){var range=document.createRange();range.selectNodeContents(ev.target);var sel=window.getSelection();sel.removeAllRanges();sel.addRange(range)}else if(document.body.createTextRange){var _range=document.body.createTextRange();_range.moveToElementText(ev.target);_range.select()}},1)});_defineProperty(_this,"onMouseDown",function(ev){var el=document.elementFromPoint(ev.clientX,ev.clientY);if((el===null||el===void 0?void 0:el.nodeName)==="A"&&ev.ctrlKey){window.open(el.href,el.target)}});_defineProperty(_this,"onMouseMove",function(ev){var isTouch="ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0;clearTimeout(_this.tooltipTimeout);var editable=!_this.props.disabled&&!_this.props.readOnly;if(!isTouch&&editable&&ev.target.nodeName==="A"){var rect=ev.target.getBoundingClientRect();var left=rect.left+window.scrollX;var bottom=rect.bottom+window.scrollY+2;_this.tooltipTimeout=setTimeout(function(){if(!_this.tooltipEl){_this.tooltipEl=document.createElement("span");_this.tooltipEl.className="text-input-link-tooltip";_this.tooltipEl.innerHTML=LocaleUtils.tr("misc.ctrlclickhint");_this.tooltipEl.style.position="absolute";_this.tooltipEl.style.zIndex=10000000000;document.body.appendChild(_this.tooltipEl)}_this.tooltipEl.style.left=left+"px";_this.tooltipEl.style.top=bottom+"px";_this.tooltipTimeout=null},250)}else if(_this.tooltipEl){document.body.removeChild(_this.tooltipEl);_this.tooltipEl=null}});_defineProperty(_this,"onMouseLeave",function(){clearTimeout(_this.tooltipTimeout);if(_this.tooltipEl){document.body.removeChild(_this.tooltipEl);_this.tooltipEl=null}});_defineProperty(_this,"onKeyDown",function(ev){if(ev.key==="Enter"&&!_this.props.multiline){ev.preventDefault();_this.commit()}else if(ev.key==="Escape"){_this.setState(function(state){return{value:_this.props.value,valueRev:state.valueRev+1,curValue:_this.props.value||"",changed:false}});_this.skipNextCommitOnBlur=true;ev.target.blur()}});_defineProperty(_this,"commit",function(){if(_this.state.changed){if(_this.props.addLinkAnchors){var valueWithLinks=MiscUtils.addLinkAnchors(_this.state.curValue);_this.props.onChange(valueWithLinks)}else{_this.props.onChange(_this.state.curValue)}}});_defineProperty(_this,"storeInitialHeight",function(el){if(el){_this.initialHeight=el.offsetHeight}});_defineProperty(_this,"startResize",function(ev){var container=ev.target.parentElement;if(!container){return}var startHeight=container.offsetHeight;var startMouseY=ev.clientY;var resizeInput=function resizeInput(event){container.style.height=Math.max(_this.initialHeight,startHeight+(event.clientY-startMouseY))+"px"};document.body.style.userSelect="none";ev.view.addEventListener("pointermove",resizeInput);ev.view.addEventListener("pointerup",function(){document.body.style.userSelect="";ev.view.removeEventListener("pointermove",resizeInput)},{once:true})});_this.skipNextCommitOnBlur=false;_this.focusEnterClick=false;_this.initialHeight=null;_this.input=null;_this.tooltipEl=null;_this.tooltipTimeout=null;return _this}_inherits(TextInput,_React$Component);return _createClass(TextInput,[{key:"componentDidUpdate",value:function componentDidUpdate(prevProps,prevState){this.setDefaultValue(this.state.value,this.state.valueRev,prevState.valueRev)}},{key:"render",value:function render(){var _this2=this;var wrapperClassName=classNames({"TextInput":true,"text-input-wrapper":true,"text-input-wrapper-multiline":this.props.multiline,"text-input-wrapper-focused":this.state.focus});var preClassName=classNames({"text-input":true,"text-input-disabled":this.props.disabled,"text-input-readonly":this.props.readOnly||!this.state.curValue,"text-input-invalid":this.props.required&&!this.state.curValue});var showClear=this.state.focus&&!this.props.multiline&&!this.props.disabled&&!this.props.readOnly&&this.state.curValue;var style=_objectSpread({},this.props.style);if(showClear){style.marginRight="1.5em"}return/*#__PURE__*/React.createElement("div",{className:wrapperClassName+" "+(this.props.className||""),ref:this.storeInitialHeight},this.props.name?/*#__PURE__*/React.createElement("textarea",{className:"text-input-form-el",name:this.props.name,onChange:function onChange(){},required:this.props.required,tabIndex:"-1",value:this.state.curValue}):null,/*#__PURE__*/React.createElement("pre",{className:preClassName,contentEditable:!this.props.disabled&&!this.props.readOnly,dangerouslySetInnerHTML:{__html:this.state.value.replaceAll("\n",this.props.multiline?"<br />":"")},onBlur:this.onBlur,onChange:this.onChange,onCopy:function onCopy(ev){return _this2.onCopy(ev,false)},onCut:function onCut(ev){return _this2.onCopy(ev,true)},onFocus:this.onFocus,onInput:this.onChange,onKeyDown:this.onKeyDown,onMouseDown:this.onMouseDown,onMouseLeave:this.onMouseLeave,onMouseMove:this.onMouseMove,ref:function ref(el){_this2.input=el},style:style}),!this.state.curValue?/*#__PURE__*/React.createElement("div",{className:"text-input-placeholder"},this.props.placeholder):null,this.props.multiline?/*#__PURE__*/React.createElement("div",{className:"text-input-resize-handle",onPointerDown:this.startResize}):null,showClear?/*#__PURE__*/React.createElement("div",{className:"text-input-clear-icon"},/*#__PURE__*/React.createElement(Icon,{icon:"clear",onClick:this.clear,onMouseDown:MiscUtils.killEvent})):null)}}],[{key:"getDerivedStateFromProps",value:function getDerivedStateFromProps(nextProps,state){if(state.value!==nextProps.value){return{value:nextProps.value,valueRev:state.valueRev+1,curValue:DOMPurify.sanitize(nextProps.value||""),changed:false}}return null}}])}(React.Component);_defineProperty(TextInput,"propTypes",{addLinkAnchors:PropTypes.bool,className:PropTypes.string,clearValue:PropTypes.string,disabled:PropTypes.bool,multiline:PropTypes.bool,name:PropTypes.string,onChange:PropTypes.func,placeholder:PropTypes.string,readOnly:PropTypes.bool,required:PropTypes.bool,style:PropTypes.object,value:PropTypes.string});_defineProperty(TextInput,"defaultProps",{clearValue:"",placeholder:""});export{TextInput as default};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<svg
|
|
3
|
+
version="1.1"
|
|
4
|
+
width="24"
|
|
5
|
+
height="24"
|
|
6
|
+
viewBox="0 0 24 24"
|
|
7
|
+
id="svg6"
|
|
8
|
+
sodipodi:docname="above_terr.svg"
|
|
9
|
+
inkscape:version="1.4.2 (ebf0e940d0, 2025-05-08)"
|
|
10
|
+
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
|
11
|
+
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
|
12
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
13
|
+
xmlns:svg="http://www.w3.org/2000/svg"
|
|
14
|
+
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
|
15
|
+
xmlns:cc="http://creativecommons.org/ns#"
|
|
16
|
+
xmlns:dc="http://purl.org/dc/elements/1.1/">
|
|
17
|
+
<metadata
|
|
18
|
+
id="metadata12">
|
|
19
|
+
<rdf:RDF>
|
|
20
|
+
<cc:Work
|
|
21
|
+
rdf:about="">
|
|
22
|
+
<dc:format>image/svg+xml</dc:format>
|
|
23
|
+
<dc:type
|
|
24
|
+
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
|
25
|
+
<dc:title>uniE080</dc:title>
|
|
26
|
+
</cc:Work>
|
|
27
|
+
</rdf:RDF>
|
|
28
|
+
</metadata>
|
|
29
|
+
<defs
|
|
30
|
+
id="defs10" />
|
|
31
|
+
<sodipodi:namedview
|
|
32
|
+
pagecolor="#ffffff"
|
|
33
|
+
bordercolor="#666666"
|
|
34
|
+
borderopacity="1"
|
|
35
|
+
objecttolerance="10"
|
|
36
|
+
gridtolerance="10"
|
|
37
|
+
guidetolerance="10"
|
|
38
|
+
inkscape:pageopacity="0"
|
|
39
|
+
inkscape:pageshadow="2"
|
|
40
|
+
inkscape:window-width="1920"
|
|
41
|
+
inkscape:window-height="1172"
|
|
42
|
+
id="namedview8"
|
|
43
|
+
showgrid="true"
|
|
44
|
+
inkscape:zoom="20.85965"
|
|
45
|
+
inkscape:cx="5.0815809"
|
|
46
|
+
inkscape:cy="9.0845244"
|
|
47
|
+
inkscape:window-x="0"
|
|
48
|
+
inkscape:window-y="0"
|
|
49
|
+
inkscape:window-maximized="1"
|
|
50
|
+
inkscape:current-layer="g1132"
|
|
51
|
+
inkscape:document-rotation="0"
|
|
52
|
+
inkscape:pagecheckerboard="0"
|
|
53
|
+
inkscape:showpageshadow="2"
|
|
54
|
+
inkscape:deskcolor="#d1d1d1">
|
|
55
|
+
<inkscape:grid
|
|
56
|
+
type="xygrid"
|
|
57
|
+
id="grid908"
|
|
58
|
+
originx="0"
|
|
59
|
+
originy="0"
|
|
60
|
+
spacingy="1"
|
|
61
|
+
spacingx="1"
|
|
62
|
+
units="px" />
|
|
63
|
+
</sodipodi:namedview>
|
|
64
|
+
<title
|
|
65
|
+
id="title2">uniE080</title>
|
|
66
|
+
<g
|
|
67
|
+
id="g3356"
|
|
68
|
+
transform="translate(4.2175145,-1.0000001)">
|
|
69
|
+
<g
|
|
70
|
+
id="g1132">
|
|
71
|
+
<path
|
|
72
|
+
id="rect847"
|
|
73
|
+
style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:2;stop-color:#000000"
|
|
74
|
+
d="m 11.782485,2.0000002 -5.9999995,6 H 9.782485 V 19 C 7.9468654,17.587985 4.7824855,16 2.7824855,16 c -2,0 -3.50228637,1.078682 -6,3 v 4 c 1.9467076,-1.753851 3.73681103,-3 6,-3 2.263189,0 5,3 7,3 2.0000005,0 2.0000005,0 4.0000005,0 2,0 2.997711,-0.498856 3.999999,-1 v -4 c -1.999999,1 -2.999999,1 -4,1 V 8.0000002 h 4 z"
|
|
75
|
+
sodipodi:nodetypes="cccczcczzscccccc" />
|
|
76
|
+
<g
|
|
77
|
+
id="g1126"
|
|
78
|
+
transform="rotate(45,7.2573571,13.510407)" />
|
|
79
|
+
</g>
|
|
80
|
+
</g>
|
|
81
|
+
</svg>
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<svg
|
|
3
|
+
version="1.1"
|
|
4
|
+
width="24"
|
|
5
|
+
height="24"
|
|
6
|
+
viewBox="0 0 24 24"
|
|
7
|
+
id="svg6"
|
|
8
|
+
sodipodi:docname="above_zero.svg"
|
|
9
|
+
inkscape:version="1.4.2 (ebf0e940d0, 2025-05-08)"
|
|
10
|
+
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
|
11
|
+
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
|
12
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
13
|
+
xmlns:svg="http://www.w3.org/2000/svg"
|
|
14
|
+
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
|
15
|
+
xmlns:cc="http://creativecommons.org/ns#"
|
|
16
|
+
xmlns:dc="http://purl.org/dc/elements/1.1/">
|
|
17
|
+
<metadata
|
|
18
|
+
id="metadata12">
|
|
19
|
+
<rdf:RDF>
|
|
20
|
+
<cc:Work
|
|
21
|
+
rdf:about="">
|
|
22
|
+
<dc:format>image/svg+xml</dc:format>
|
|
23
|
+
<dc:type
|
|
24
|
+
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
|
25
|
+
<dc:title>uniE080</dc:title>
|
|
26
|
+
</cc:Work>
|
|
27
|
+
</rdf:RDF>
|
|
28
|
+
</metadata>
|
|
29
|
+
<defs
|
|
30
|
+
id="defs10" />
|
|
31
|
+
<sodipodi:namedview
|
|
32
|
+
pagecolor="#ffffff"
|
|
33
|
+
bordercolor="#666666"
|
|
34
|
+
borderopacity="1"
|
|
35
|
+
objecttolerance="10"
|
|
36
|
+
gridtolerance="10"
|
|
37
|
+
guidetolerance="10"
|
|
38
|
+
inkscape:pageopacity="0"
|
|
39
|
+
inkscape:pageshadow="2"
|
|
40
|
+
inkscape:window-width="1920"
|
|
41
|
+
inkscape:window-height="1172"
|
|
42
|
+
id="namedview8"
|
|
43
|
+
showgrid="true"
|
|
44
|
+
inkscape:zoom="20.85965"
|
|
45
|
+
inkscape:cx="5.0815809"
|
|
46
|
+
inkscape:cy="9.0845244"
|
|
47
|
+
inkscape:window-x="0"
|
|
48
|
+
inkscape:window-y="0"
|
|
49
|
+
inkscape:window-maximized="1"
|
|
50
|
+
inkscape:current-layer="g1132"
|
|
51
|
+
inkscape:document-rotation="0"
|
|
52
|
+
inkscape:pagecheckerboard="0"
|
|
53
|
+
inkscape:showpageshadow="2"
|
|
54
|
+
inkscape:deskcolor="#d1d1d1">
|
|
55
|
+
<inkscape:grid
|
|
56
|
+
type="xygrid"
|
|
57
|
+
id="grid908"
|
|
58
|
+
originx="0"
|
|
59
|
+
originy="0"
|
|
60
|
+
spacingy="1"
|
|
61
|
+
spacingx="1"
|
|
62
|
+
units="px" />
|
|
63
|
+
</sodipodi:namedview>
|
|
64
|
+
<title
|
|
65
|
+
id="title2">uniE080</title>
|
|
66
|
+
<g
|
|
67
|
+
id="g3356"
|
|
68
|
+
transform="translate(4.2175145,-1.0000001)">
|
|
69
|
+
<g
|
|
70
|
+
id="g1132">
|
|
71
|
+
<path
|
|
72
|
+
id="rect847"
|
|
73
|
+
style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:2;stop-color:#000000"
|
|
74
|
+
d="M 12.282485 2.5000001 L 6.2824855 8.5000001 L 10.282485 8.5000001 L 10.282485 19.5 L -2.7175145 19.5 L -2.7175145 23.5 L 18.282485 23.5 L 18.282485 19.5 L 14.282485 19.5 L 14.282485 8.5000001 L 18.282485 8.5000001 L 12.282485 2.5000001 z M 1.7824855 7.5468751 C -1.2041736 7.5468751 -2.4850926 10.359329 -2.4850926 12.972656 C -2.4850926 15.585983 -1.2175069 18.400391 1.7824855 18.400391 C 4.7824779 18.400391 6.0500636 15.585983 6.0500636 12.972656 C 6.0500636 10.359329 4.7691446 7.5468751 1.7824855 7.5468751 z M 1.7824855 9.8535157 C 3.1291488 9.8535157 3.4485011 11.987607 3.4485011 12.960938 C 3.4485011 13.934269 3.1291488 16.09375 1.7824855 16.09375 C 0.43582227 16.09375 0.11646987 13.934269 0.11646987 12.960938 C 0.11646987 11.987607 0.43582227 9.8535157 1.7824855 9.8535157 z " />
|
|
75
|
+
<g
|
|
76
|
+
id="g1126"
|
|
77
|
+
transform="rotate(45,7.2573571,13.510407)" />
|
|
78
|
+
</g>
|
|
79
|
+
</g>
|
|
80
|
+
</svg>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qwc2",
|
|
3
|
-
"version": "2025.08.
|
|
3
|
+
"version": "2025.08.20",
|
|
4
4
|
"description": "QGIS Web Client",
|
|
5
5
|
"author": "Sourcepole AG",
|
|
6
6
|
"license": "BSD-2-Clause",
|
|
@@ -27,13 +27,14 @@
|
|
|
27
27
|
"@turf/buffer": "^6.5.0",
|
|
28
28
|
"@turf/helpers": "^6.5.0",
|
|
29
29
|
"any-date-parser": "^1.5.4",
|
|
30
|
-
"axios": "^1.
|
|
30
|
+
"axios": "^1.11.0",
|
|
31
31
|
"chart.js": "^4.4.7",
|
|
32
32
|
"classnames": "^2.5.1",
|
|
33
33
|
"clone": "^2.1.2",
|
|
34
34
|
"dayjs": "^1.11.13",
|
|
35
35
|
"deepmerge": "^4.3.1",
|
|
36
36
|
"diacritics": "^1.3.0",
|
|
37
|
+
"dompurify": "^3.2.6",
|
|
37
38
|
"driver.js": "^1.3.6",
|
|
38
39
|
"expr-eval": "^2.0.2",
|
|
39
40
|
"fast-xml-parser": "^4.5.0",
|
package/plugins/API.js
CHANGED
|
@@ -4,7 +4,7 @@ function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var
|
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/import React from"react";import ReactDOM from"react-dom";import{connect}from"react-redux";import axios from"axios";import ol from"openlayers";import PropTypes from"prop-types";import url from"url";import*as uuid from"uuid";import*as displayActions from"../actions/display";import*as editingActions from"../actions/editing";import{LayerRole}from"../actions/layers";import*as layerActions from"../actions/layers";import{registerCustomPlugin,unregisterCustomPlugin}from"../actions/localConfig";import*as localeActions from"../actions/locale";import*as locateActions from"../actions/locate";import*as mapActions from"../actions/map";import*as taskActions from"../actions/task";import*as themeActions from"../actions/theme";import*as windowsActions from"../actions/windows";import AppMenu from"../components/AppMenu";import AttributeForm from"../components/AttributeForm";import AttributeTableWidget from"../components/AttributeTableWidget";import AutoEditForm from"../components/AutoEditForm";import CoordinateDisplayer from"../components/CoordinateDisplayer";import EditComboField from"../components/EditComboField";import EditUploadField from"../components/EditUploadField";import FullscreenSwitcher from"../components/FullscreenSwitcher";import Icon from"../components/Icon";import IdentifyViewer from"../components/IdentifyViewer";import ImportLayer from"../components/ImportLayer";import LayerInfoWindow from"../components/LayerInfoWindow";import LinkFeatureForm from"../components/LinkFeatureForm";import MapSelection from"../components/MapSelection";import NumericInputWindow from"../components/NumericInputWindow";import PickFeature from"../components/PickFeature";import PluginsContainer from"../components/PluginsContainer";import PrintSelection from"../components/PrintSelection";import QtDesignerForm from"../components/QtDesignerForm";import ResizeableWindow from"../components/ResizeableWindow";import SearchBox from"../components/SearchBox";import ServiceInfoWindow from"../components/ServiceInfoWindow";import SideBar from"../components/SideBar";import{Swipeable}from"../components/Swipeable";import TaskBar from"../components/TaskBar";import ThemeLayersListWindow from"../components/ThemeLayersListWindow";import ThemeList from"../components/ThemeList";import Toolbar from"../components/Toolbar";import ShareLink from"../components/share/ShareLink";import ShareQRCode from"../components/share/ShareQRCode";import ShareSocials from"../components/share/ShareSocials";import FixedTimeline from"../components/timeline/FixedTimeline";import InfiniteTimeline from"../components/timeline/InfiniteTimeline";import TimelineFeaturesSlider from"../components/timeline/TimelineFeaturesSlider";import AccordeonWidget from"../components/widgets/AccordeonWidget";import ButtonBar from"../components/widgets/ButtonBar";import ColorButton from"../components/widgets/ColorButton";import ComboBox from"../components/widgets/ComboBox";import CopyButton from"../components/widgets/CopyButton";import DateTimeInput from"../components/widgets/DateTimeInput";import EditableSelect from"../components/widgets/EditableSelect";import FileSelector from"../components/widgets/FileSelector";import Input from"../components/widgets/Input";import InputContainer from"../components/widgets/InputContainer";import LayerCatalogWidget from"../components/widgets/LayerCatalogWidget";import MenuButton from"../components/widgets/MenuButton";import ModalDialog from"../components/widgets/ModalDialog";import NavBar from"../components/widgets/NavBar";import NumberInput from"../components/widgets/NumberInput";import PopupMenu from"../components/widgets/PopupMenu";import{Image}from"../components/widgets/Primitives";import SearchWidget from"../components/widgets/SearchWidget";import Spinner from"../components/widgets/Spinner";import SuggestionInput from"../components/widgets/SuggestionInput";import TextInput from"../components/widgets/TextInput";import ToggleSwitch from"../components/widgets/ToggleSwitch";import VectorLayerPicker from"../components/widgets/VectorLayerPicker";import ConfigUtils from"../utils/ConfigUtils";import CoordinatesUtils from"../utils/CoordinatesUtils";import EditingInterface from"../utils/EditingInterface";import*as EditingUtils from"../utils/EditingUtils";import LayerUtils from"../utils/LayerUtils";import LocaleUtils from"../utils/LocaleUtils";import MapUtils from"../utils/MapUtils";import*as PermaLinkUtils from"../utils/PermaLinkUtils";import{SearchResultType}from"../utils/SearchProviders";import ServiceLayerUtils from"../utils/ServiceLayerUtils";import VectorLayerUtils from"../utils/VectorLayerUtils";/**
|
|
7
|
+
*/import React from"react";import ReactDOM from"react-dom";import{connect}from"react-redux";import axios from"axios";import ol from"openlayers";import PropTypes from"prop-types";import url from"url";import*as uuid from"uuid";import*as displayActions from"../actions/display";import*as editingActions from"../actions/editing";import{LayerRole}from"../actions/layers";import*as layerActions from"../actions/layers";import{registerCustomPlugin,unregisterCustomPlugin}from"../actions/localConfig";import*as localeActions from"../actions/locale";import*as locateActions from"../actions/locate";import*as mapActions from"../actions/map";import*as taskActions from"../actions/task";import*as themeActions from"../actions/theme";import*as windowsActions from"../actions/windows";import AppMenu from"../components/AppMenu";import AttributeForm from"../components/AttributeForm";import AttributeTableWidget from"../components/AttributeTableWidget";import AutoEditForm from"../components/AutoEditForm";import CoordinateDisplayer from"../components/CoordinateDisplayer";import EditComboField from"../components/EditComboField";import EditUploadField from"../components/EditUploadField";import FullscreenSwitcher from"../components/FullscreenSwitcher";import Icon from"../components/Icon";import IdentifyViewer from"../components/IdentifyViewer";import ImportLayer from"../components/ImportLayer";import LayerInfoWindow from"../components/LayerInfoWindow";import LinkFeatureForm from"../components/LinkFeatureForm";import MapSelection from"../components/MapSelection";import NumericInputWindow from"../components/NumericInputWindow";import PickFeature from"../components/PickFeature";import PluginsContainer from"../components/PluginsContainer";import PrintSelection from"../components/PrintSelection";import QtDesignerForm from"../components/QtDesignerForm";import ResizeableWindow from"../components/ResizeableWindow";import SearchBox from"../components/SearchBox";import ServiceInfoWindow from"../components/ServiceInfoWindow";import SideBar from"../components/SideBar";import{Swipeable}from"../components/Swipeable";import TaskBar from"../components/TaskBar";import ThemeLayersListWindow from"../components/ThemeLayersListWindow";import ThemeList from"../components/ThemeList";import Toolbar from"../components/Toolbar";import ShareLink from"../components/share/ShareLink";import ShareQRCode from"../components/share/ShareQRCode";import ShareSocials from"../components/share/ShareSocials";import FixedTimeline from"../components/timeline/FixedTimeline";import InfiniteTimeline from"../components/timeline/InfiniteTimeline";import TimelineFeaturesSlider from"../components/timeline/TimelineFeaturesSlider";import AccordeonWidget from"../components/widgets/AccordeonWidget";import ButtonBar from"../components/widgets/ButtonBar";import ColorButton from"../components/widgets/ColorButton";import ComboBox from"../components/widgets/ComboBox";import CopyButton from"../components/widgets/CopyButton";import DateTimeInput from"../components/widgets/DateTimeInput";import EditableSelect from"../components/widgets/EditableSelect";import FileSelector from"../components/widgets/FileSelector";import Input from"../components/widgets/Input";import InputContainer from"../components/widgets/InputContainer";import LayerCatalogWidget from"../components/widgets/LayerCatalogWidget";import MenuButton from"../components/widgets/MenuButton";import ModalDialog from"../components/widgets/ModalDialog";import NavBar from"../components/widgets/NavBar";import NumberInput from"../components/widgets/NumberInput";import PopupMenu from"../components/widgets/PopupMenu";import{Image}from"../components/widgets/Primitives";import SearchWidget from"../components/widgets/SearchWidget";import Spinner from"../components/widgets/Spinner";import SuggestionInput from"../components/widgets/SuggestionInput";import TextInput from"../components/widgets/TextInput";import ToggleSwitch from"../components/widgets/ToggleSwitch";import VectorLayerPicker from"../components/widgets/VectorLayerPicker";import ConfigUtils from"../utils/ConfigUtils";import CoordinatesUtils from"../utils/CoordinatesUtils";import EditingInterface from"../utils/EditingInterface";import*as EditingUtils from"../utils/EditingUtils";import LayerUtils from"../utils/LayerUtils";import LocaleUtils from"../utils/LocaleUtils";import MapUtils from"../utils/MapUtils";import*as PermaLinkUtils from"../utils/PermaLinkUtils";import PluginStore from"../utils/PluginStore";import{SearchResultType}from"../utils/SearchProviders";import ServiceLayerUtils from"../utils/ServiceLayerUtils";import VectorLayerUtils from"../utils/VectorLayerUtils";/**
|
|
8
8
|
* Exposes an API for interacting with QWC2 via `window.qwc2`.
|
|
9
9
|
*
|
|
10
10
|
* You can interact with the API as soon as the `QWC2ApiReady` event is dispatched.
|
|
@@ -85,11 +85,11 @@ function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var
|
|
|
85
85
|
* * `name`: An identifier
|
|
86
86
|
* * `plugin`: The plugin component class
|
|
87
87
|
* * `translations`: The plugin translation messages: `{"<lang>": {<messages>}, ...}`
|
|
88
|
-
*/_defineProperty(_this,"addPlugin",function(name,plugin){var translations=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};
|
|
88
|
+
*/_defineProperty(_this,"addPlugin",function(name,plugin){var _plugin$WrappedCompon,_component$availableI;var translations=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};var component=(_plugin$WrappedCompon=plugin.WrappedComponent)!==null&&_plugin$WrappedCompon!==void 0?_plugin$WrappedCompon:plugin;var availableIn3D=(_component$availableI=component.availableIn3D)!==null&&_component$availableI!==void 0?_component$availableI:false;PluginStore.addCustomPlugin(name,plugin);window.qwc2.addTranslations(translations);_this.props.registerCustomPlugin(name,availableIn3D)});/**
|
|
89
89
|
* Remove custom plugin
|
|
90
90
|
*
|
|
91
91
|
* * `name`: The identifier
|
|
92
|
-
*/_defineProperty(_this,"removePlugin",function(name){_this.props.unregisterCustomPlugin(name)
|
|
92
|
+
*/_defineProperty(_this,"removePlugin",function(name){PluginStore.removeCustomPlugin(name);_this.props.unregisterCustomPlugin(name)});/**
|
|
93
93
|
* Add custom attribute calculator
|
|
94
94
|
* (i.e. computed attributes which are added to GetFeatureInfo responses).
|
|
95
95
|
*
|
|
@@ -13,4 +13,4 @@ function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof
|
|
|
13
13
|
*
|
|
14
14
|
* This plugin queries the dataset via the editing service specified by
|
|
15
15
|
* `editServiceUrl` in `config.json` (by default the `qwc-data-service`).
|
|
16
|
-
*/var AttributeTable=/*#__PURE__*/function(_React$Component){function AttributeTable(){var _this;_classCallCheck(this,AttributeTable);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key]}_this=_callSuper(this,AttributeTable,[].concat(args));_defineProperty(_this,"onClose",function(){if(!_this.props.blocked){_this.props.setCurrentTask(null)}});return _this}_inherits(AttributeTable,_React$Component);return _createClass(AttributeTable,[{key:"render",value:function render(){var _this$props$taskData;if(!this.props.active){return null}return/*#__PURE__*/React.createElement(ResizeableWindow,{dockable:"bottom",icon:"editing",initialHeight:480,initialWidth:800,initiallyDocked:true,onClose:this.onClose,splitScreenWhenDocked:true,title:LocaleUtils.tr("attribtable.title")},/*#__PURE__*/React.createElement(AttributeTableWidget,{allowAddForGeometryLayers:this.props.allowAddForGeometryLayers,iface:this.props.iface,initialLayer:(_this$props$taskData=this.props.taskData)===null||_this$props$taskData===void 0?void 0:_this$props$taskData.layer,role:"body",showEditFormButton:this.props.showEditFormButton,showLimitToExtent:this.props.showLimitToExtent,zoomLevel:this.props.zoomLevel}))}}])}(React.Component);_defineProperty(AttributeTable,"propTypes",{active:PropTypes.bool,/** Whether to allow adding records for datasets which have a geometry column. */allowAddForGeometryLayers:PropTypes.bool,blocked:PropTypes.bool,iface:PropTypes.object,setCurrentTask:PropTypes.func,/** Whether to show a button to open the edit form for selected layer. Requires the Editing plugin to be enabled. */showEditFormButton:PropTypes.bool,/** Whether to show the "Limit to extent" checkbox */showLimitToExtent:PropTypes.bool,taskData:PropTypes.object,/** The zoom level for zooming to point features. */zoomLevel:PropTypes.number});_defineProperty(AttributeTable,"defaultProps",{zoomLevel:1000,showEditFormButton:true});export default(function(){var iface=arguments.length>0&&arguments[0]!==undefined?arguments[0]:EditingInterface;return connect(function(state){return{active:state.task.id==="AttributeTable",blocked:state.task.id==="AttributeTable"&&state.task.blocked,iface:iface,taskData:state.task.id==="AttributeTable"?state.task.data:null}},{setCurrentTask:setCurrentTask})(AttributeTable)});
|
|
16
|
+
*/var AttributeTable=/*#__PURE__*/function(_React$Component){function AttributeTable(){var _this;_classCallCheck(this,AttributeTable);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key]}_this=_callSuper(this,AttributeTable,[].concat(args));_defineProperty(_this,"onClose",function(){if(!_this.props.blocked){_this.props.setCurrentTask(null)}});return _this}_inherits(AttributeTable,_React$Component);return _createClass(AttributeTable,[{key:"render",value:function render(){var _this$props$taskData;if(!this.props.active){return null}return/*#__PURE__*/React.createElement(ResizeableWindow,{dockable:"bottom",icon:"editing",initialHeight:480,initialWidth:800,initiallyDocked:true,onClose:this.onClose,splitScreenWhenDocked:true,title:LocaleUtils.tr("attribtable.title")},/*#__PURE__*/React.createElement(AttributeTableWidget,{allowAddForGeometryLayers:this.props.allowAddForGeometryLayers,iface:this.props.iface,initialLayer:(_this$props$taskData=this.props.taskData)===null||_this$props$taskData===void 0?void 0:_this$props$taskData.layer,role:"body",showEditFormButton:this.props.showEditFormButton,showLimitToExtent:this.props.showLimitToExtent,zoomLevel:this.props.zoomLevel}))}}])}(React.Component);_defineProperty(AttributeTable,"propTypes",{active:PropTypes.bool,/** Whether to allow adding records for datasets which have a geometry column. */allowAddForGeometryLayers:PropTypes.bool,blocked:PropTypes.bool,iface:PropTypes.object,setCurrentTask:PropTypes.func,/** Whether to show a button to open the edit form for selected layer. Requires the Editing plugin to be enabled. */showEditFormButton:PropTypes.bool,/** Whether to show the "Limit to extent" checkbox */showLimitToExtent:PropTypes.bool,taskData:PropTypes.object,/** The zoom level for zooming to point features. */zoomLevel:PropTypes.number});_defineProperty(AttributeTable,"defaultProps",{zoomLevel:1000,showEditFormButton:true,showLimitToExtent:true});export default(function(){var iface=arguments.length>0&&arguments[0]!==undefined?arguments[0]:EditingInterface;return connect(function(state){return{active:state.task.id==="AttributeTable",blocked:state.task.id==="AttributeTable"&&state.task.blocked,iface:iface,taskData:state.task.id==="AttributeTable"?state.task.data:null}},{setCurrentTask:setCurrentTask})(AttributeTable)});
|
package/plugins/BottomBar.js
CHANGED
|
@@ -7,4 +7,4 @@ function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof
|
|
|
7
7
|
*/import React from"react";import{connect}from"react-redux";import ol from"openlayers";import PropTypes from"prop-types";import{changeZoomLevel,setDisplayCrs}from"../actions/map";import{openExternalUrl,setBottombarHeight}from"../actions/windows";import CoordinateDisplayer from"../components/CoordinateDisplayer";import InputContainer from"../components/widgets/InputContainer";import CoordinatesUtils from"../utils/CoordinatesUtils";import LocaleUtils from"../utils/LocaleUtils";import MapUtils from"../utils/MapUtils";import"./style/BottomBar.css";/**
|
|
8
8
|
* Bottom bar, displaying mouse coordinate, scale, etc.
|
|
9
9
|
*/var BottomBar=/*#__PURE__*/function(_React$Component){function BottomBar(){var _this;_classCallCheck(this,BottomBar);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key]}_this=_callSuper(this,BottomBar,[].concat(args));_defineProperty(_this,"state",{scale:0});_defineProperty(_this,"renderLink",function(entry){var _entry$labelMsgId;return/*#__PURE__*/React.createElement("a",{href:entry.url,key:(_entry$labelMsgId=entry.labelMsgId)!==null&&_entry$labelMsgId!==void 0?_entry$labelMsgId:entry.label,onClick:function onClick(ev){return _this.openUrl(ev,entry.url,entry.urlTarget,entry.labelMsgId?LocaleUtils.tr(entry.labelMsgId):entry.label,entry.icon)}},/*#__PURE__*/React.createElement("span",{className:"extra_label"},entry.labelMsgId?LocaleUtils.tr(entry.labelMsgId):entry.label))});_defineProperty(_this,"initScaleBar",function(el){_this.scalebar=new ol.control.ScaleLine(_objectSpread({className:"bottombar-scalebar",target:el,minWidth:64,units:"metric"},_this.props.scalebarOptions));MapUtils.getHook(MapUtils.GET_MAP).addControl(_this.scalebar)});_defineProperty(_this,"openUrl",function(ev,url,target,title,icon){if(target==="iframe"){target=":iframedialog:externallinkiframe"}_this.props.openExternalUrl(url,target,{title:title,icon:icon});ev.preventDefault()});_defineProperty(_this,"setScale",function(value){var scale=parseInt(value,10);if(!isNaN(scale)){var zoom=MapUtils.computeZoom(_this.props.map.scales,scale);_this.props.changeZoomLevel(zoom)}else{_this.props.changeZoomLevel(_this.props.map.zoom)}});_defineProperty(_this,"storeHeight",function(el){if(el){_this.props.setBottombarHeight(el.clientHeight)}});return _this}_inherits(BottomBar,_React$Component);return _createClass(BottomBar,[{key:"componentWillUnmount",value:function componentWillUnmount(){if(this.scalebar){var _MapUtils$getHook,_MapUtils$getHook$rem;(_MapUtils$getHook=MapUtils.getHook(MapUtils.GET_MAP))===null||_MapUtils$getHook===void 0||(_MapUtils$getHook$rem=_MapUtils$getHook.removeControl)===null||_MapUtils$getHook$rem===void 0||_MapUtils$getHook$rem.call(_MapUtils$getHook,this.scalebar)}}},{key:"componentDidUpdate",value:function componentDidUpdate(prevProps){if(this.props.map!==prevProps.map){this.setState({scale:Math.round(MapUtils.computeForZoom(this.props.map.scales,this.props.map.zoom))})}}},{key:"render",value:function render(){var _this2=this;if(this.props.fullscreen){return null}var leftBottomLinks=(this.props.additionalBottomBarLinks||[]).filter(function(entry){return entry.side==="left"}).map(this.renderLink);var rightBottomLinks=(this.props.additionalBottomBarLinks||[]).filter(function(entry){return entry.side!=="left"}).map(this.renderLink);if(this.props.viewertitleUrl){var entry={url:this.props.viewertitleUrl,urlTarget:this.props.viewertitleUrlTarget,label:LocaleUtils.tr("bottombar.viewertitle_label"),icon:this.props.viewertitleUrlIcon};rightBottomLinks.push(this.renderLink(entry))}if(this.props.termsUrl){var _entry={url:this.props.termsUrl,urlTarget:this.props.termsUrlTarget,label:LocaleUtils.tr("bottombar.terms_label"),icon:this.props.termsUrlIcon};rightBottomLinks.push(this.renderLink(_entry))}var enabledMouseCrs=[].concat(_toConsumableArray(this.props.additionalMouseCrs||[]),[this.props.map.projection,"EPSG:4326"]);// eslint-disable-next-line no-unused-vars
|
|
10
|
-
var availableCRS=Object.fromEntries(Object.entries(CoordinatesUtils.getAvailableCRS()).filter(function(_ref){var _ref2=_slicedToArray(_ref,2),key=_ref2[0],value=_ref2[1];return enabledMouseCrs.includes(key)}));var scalebar=null;if(this.props.displayScalebar){scalebar=/*#__PURE__*/React.createElement("div",{className:"bottombar-scalebar-container",ref:this.initScaleBar})}var coordinates=null;if(this.props.displayCoordinates){coordinates=/*#__PURE__*/React.createElement("div",{className:"controlgroup"},/*#__PURE__*/React.createElement("span",{className:"bottombar-mousepos-label"},LocaleUtils.tr("bottombar.mousepos_label"),":\xA0"),/*#__PURE__*/React.createElement(CoordinateDisplayer,{className:"bottombar-mousepos",coordinateFormatter:this.props.coordinateFormatter,displayCrs:this.props.map.displayCrs,mapCrs:this.props.map.projection}),/*#__PURE__*/React.createElement("select",{onChange:function onChange(ev){return _this2.props.setDisplayCrs(ev.target.value)},value:this.props.map.displayCrs},Object.keys(availableCRS).map(function(crs){return/*#__PURE__*/React.createElement("option",{key:crs,value:crs},availableCRS[crs].label)})))}var scales=null;if(this.props.displayScales){scales=/*#__PURE__*/React.createElement("div",null,/*#__PURE__*/React.createElement("span",{className:"bottombar-scales-label"},LocaleUtils.tr("bottombar.scale_label"),":\xA0"),/*#__PURE__*/React.createElement(InputContainer,{className:"bottombar-scale-combo"},/*#__PURE__*/React.createElement("span",{className:"bottombar-scale-combo-prefix",role:"prefix"}," 1 : "),/*#__PURE__*/React.createElement("select",{onChange:function onChange(ev){return _this2.props.changeZoomLevel(parseInt(ev.target.value,10))},role:"input",value:Math.round(this.props.map.zoom)},this.props.map.scales.map(function(item,index){return/*#__PURE__*/React.createElement("option",{key:index,value:index},LocaleUtils.toLocaleFixed(item,0))})),/*#__PURE__*/React.createElement("input",{onBlur:function onBlur(ev){return _this2.setScale(ev.target.value)},onChange:function onChange(ev){return _this2.setState({scale:ev.target.value})},onKeyUp:function onKeyUp(ev){if(ev.key==="Enter")_this2.setScale(ev.target.value)},role:"input",type:"text",value:LocaleUtils.toLocaleFixed(this.state.scale,0)})))}var style=
|
|
10
|
+
var availableCRS=Object.fromEntries(Object.entries(CoordinatesUtils.getAvailableCRS()).filter(function(_ref){var _ref2=_slicedToArray(_ref,2),key=_ref2[0],value=_ref2[1];return enabledMouseCrs.includes(key)}));var scalebar=null;if(this.props.displayScalebar){scalebar=/*#__PURE__*/React.createElement("div",{className:"bottombar-scalebar-container",ref:this.initScaleBar})}var coordinates=null;if(this.props.displayCoordinates){coordinates=/*#__PURE__*/React.createElement("div",{className:"controlgroup"},/*#__PURE__*/React.createElement("span",{className:"bottombar-mousepos-label"},LocaleUtils.tr("bottombar.mousepos_label"),":\xA0"),/*#__PURE__*/React.createElement(CoordinateDisplayer,{className:"bottombar-mousepos",coordinateFormatter:this.props.coordinateFormatter,displayCrs:this.props.map.displayCrs,mapCrs:this.props.map.projection}),/*#__PURE__*/React.createElement("select",{onChange:function onChange(ev){return _this2.props.setDisplayCrs(ev.target.value)},value:this.props.map.displayCrs},Object.keys(availableCRS).map(function(crs){return/*#__PURE__*/React.createElement("option",{key:crs,value:crs},availableCRS[crs].label)})))}var scales=null;if(this.props.displayScales){scales=/*#__PURE__*/React.createElement("div",null,/*#__PURE__*/React.createElement("span",{className:"bottombar-scales-label"},LocaleUtils.tr("bottombar.scale_label"),":\xA0"),/*#__PURE__*/React.createElement(InputContainer,{className:"bottombar-scale-combo"},/*#__PURE__*/React.createElement("span",{className:"bottombar-scale-combo-prefix",role:"prefix"}," 1 : "),/*#__PURE__*/React.createElement("select",{onChange:function onChange(ev){return _this2.props.changeZoomLevel(parseInt(ev.target.value,10))},role:"input",value:Math.round(this.props.map.zoom)},this.props.map.scales.map(function(item,index){return/*#__PURE__*/React.createElement("option",{key:index,value:index},LocaleUtils.toLocaleFixed(item,0))})),/*#__PURE__*/React.createElement("input",{onBlur:function onBlur(ev){return _this2.setScale(ev.target.value)},onChange:function onChange(ev){return _this2.setState({scale:ev.target.value})},onKeyUp:function onKeyUp(ev){if(ev.key==="Enter")_this2.setScale(ev.target.value)},role:"input",type:"text",value:LocaleUtils.toLocaleFixed(this.state.scale,0)})))}var style={marginLeft:this.props.mapMargins.outerLeft+"px",marginRight:this.props.mapMargins.outerRight+"px"};return/*#__PURE__*/React.createElement("div",{id:"BottomBar",ref:this.storeHeight,style:style},scalebar,/*#__PURE__*/React.createElement("span",{className:"bottombar-links"},leftBottomLinks),/*#__PURE__*/React.createElement("span",{className:"bottombar-spacer"}),coordinates,scales,/*#__PURE__*/React.createElement("span",{className:"bottombar-spacer"}),/*#__PURE__*/React.createElement("span",{className:"bottombar-links"},rightBottomLinks))}}])}(React.Component);_defineProperty(BottomBar,"propTypes",{/** Additional bottombar links.`side` can be `left` or `right` (default). */additionalBottomBarLinks:PropTypes.arrayOf(PropTypes.shape({label:PropTypes.string,labelMsgId:PropTypes.string,side:PropTypes.string,url:PropTypes.string,urlTarget:PropTypes.string,icon:PropTypes.string})),additionalMouseCrs:PropTypes.array,changeZoomLevel:PropTypes.func,/** Custom coordinate formatter, as `(coordinate, crs) => string`. */coordinateFormatter:PropTypes.func,/** Whether to display the coordinates in the bottom bar. */displayCoordinates:PropTypes.bool,/** Whether to display the scalebar in the bottom bar. */displayScalebar:PropTypes.bool,/** Whether to display the scale in the bottom bar. */displayScales:PropTypes.bool,fullscreen:PropTypes.bool,map:PropTypes.object,mapMargins:PropTypes.object,openExternalUrl:PropTypes.func,/** See [OpenLayers API doc](https://openlayers.org/en/latest/apidoc/module-ol_control_ScaleLine-ScaleLine.html) */scalebarOptions:PropTypes.object,setBottombarHeight:PropTypes.func,setDisplayCrs:PropTypes.func,/** The URL of the terms label anchor. */termsUrl:PropTypes.string,/** Icon of the terms inline window. Relevant only when `termsUrlTarget` is `iframe`. */termsUrlIcon:PropTypes.string,/** The target where to open the terms URL. If `iframe`, it will be displayed in an inline window, otherwise in a new tab. You can also use the `:iframedialog:<dialogname>:<options>` syntax to set up the inline window. */termsUrlTarget:PropTypes.string,/** The URL of the viewer title label anchor. */viewertitleUrl:PropTypes.string,/** Icon of the viewer title inline window. Relevant only when `viewertitleUrl` is `iframe`. */viewertitleUrlIcon:PropTypes.string,/** The target where to open the viewer title URL. If `iframe`, it will be displayed in an inline window, otherwise in a new tab. You can also use the `:iframedialog:<dialogname>:<options>` syntax to set up the inline window. */viewertitleUrlTarget:PropTypes.string});_defineProperty(BottomBar,"defaultProps",{displayCoordinates:true,displayScalebar:true,displayScales:true});export default connect(function(state){var _state$display,_state$theme$current$,_state$theme$current;return{map:state.map,fullscreen:(_state$display=state.display)===null||_state$display===void 0?void 0:_state$display.fullscreen,mapMargins:state.windows.mapMargins,additionalMouseCrs:(_state$theme$current$=(_state$theme$current=state.theme.current)===null||_state$theme$current===void 0?void 0:_state$theme$current.additionalMouseCrs)!==null&&_state$theme$current$!==void 0?_state$theme$current$:[]}},{changeZoomLevel:changeZoomLevel,openExternalUrl:openExternalUrl,setBottombarHeight:setBottombarHeight,setDisplayCrs:setDisplayCrs})(BottomBar);
|
package/plugins/HeightProfile.js
CHANGED
|
@@ -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{Line}from"react-chartjs-2";import ReactDOM from"react-dom";import{connect}from"react-redux";import axios from"axios";import{Chart as ChartJS,CategoryScale,LinearScale,PointElement,LineElement,Title,Tooltip,Filler,BubbleController}from"chart.js";import FileSaver from"file-saver";import isEmpty from"lodash.isempty";import PropTypes from"prop-types";import{v1 as uuidv1}from"uuid";import{addMarker,removeMarker}from"../actions/layers";import{changeMeasurementState}from"../actions/measurement";import ResizeableWindow from"../components/ResizeableWindow";import Spinner from"../components/widgets/Spinner";import{getElevationInterface}from"../utils/ElevationInterface";import LayerUtils from"../utils/LayerUtils";import LocaleUtils from"../utils/LocaleUtils";import MapUtils from"../utils/MapUtils";import MeasureUtils from"../utils/MeasureUtils";import MiscUtils from"../utils/MiscUtils";import VectorLayerUtils from"../utils/VectorLayerUtils";import"./style/HeightProfile.css";ChartJS.register(CategoryScale,LinearScale,PointElement,LineElement,Title,Tooltip,Filler,BubbleController);var HeightProfilePrintDialog_=/*#__PURE__*/function(_React$PureComponent){function HeightProfilePrintDialog_(props){var _this;_classCallCheck(this,HeightProfilePrintDialog_);_this=_callSuper(this,HeightProfilePrintDialog_,[props]);_defineProperty(_this,"state",{initialized:false,imageUrl:""});_defineProperty(_this,"closePrintWindow",function(){_this.externalWindow.close()});_defineProperty(_this,"setWindowContent",function(){_this.externalWindow.addEventListener("beforeunload",_this.props.onClose,false);var container=_this.externalWindow.document.getElementById("heightprofilecontainer");if(container){var printBtn=_this.externalWindow.document.createElement("div");printBtn.id="print";printBtn.style.marginBottom="1em";printBtn.innerHTML="<style type=\"text/css\">@media print{ #print { display: none; }}</style>"+"<button onClick=\"(function(){window.print();})()\">"+LocaleUtils.tr("heightprofile.print")+"</button>";container.appendChild(printBtn);_this.imageEl=_this.externalWindow.document.createElement("div");_this.imageEl.id="map";_this.imageEl.innerHTML=LocaleUtils.tr("heightprofile.loadingimage");container.appendChild(_this.imageEl);_this.portalEl=_this.externalWindow.document.createElement("div");_this.portalEl.id="profile";container.appendChild(_this.portalEl);_this.setState({initialized:true});_this.externalWindow.document.body.style.overflowX="hidden"}else{_this.externalWindow.document.body.innerHTML="Broken template. An element with id=heightprofilecontainer must exist."}});_defineProperty(_this,"refreshImage",function(){var measurement=_this.props.measurement;var layer={type:"vector",opacity:255,features:[{type:"Feature",geometry:{coordinates:measurement.coordinates,type:"LineString"},styleOptions:{strokeColor:[255,0,0,1],strokeWidth:4},properties:{segment_labels:measurement.segment_lengths.map(function(length){return MeasureUtils.formatMeasurement(length,false,measurement.lenUnit)})}}]};var mapCrs=_this.props.map.projection;var scale=Math.round(MapUtils.computeForZoom(_this.props.map.scales,_this.props.map.zoom));var exportParams=LayerUtils.collectPrintParams(_this.props.layers,_this.props.theme,scale,mapCrs,true,false);var highlightParams=VectorLayerUtils.createPrintHighlighParams([layer],mapCrs);var imageParams=_objectSpread({SERVICE:"WMS",VERSION:"1.3.0",REQUEST:"GetMap",TRANSPARENT:"true",TILED:"false",CRS:_this.props.map.projection,BBOX:_this.props.map.bbox.bounds,WIDTH:_this.props.map.size.width,HEIGHT:_this.props.map.size.height,HIGHLIGHT_GEOM:highlightParams.geoms.join(";"),HIGHLIGHT_SYMBOL:highlightParams.styles.join(";"),HIGHLIGHT_LABELSTRING:highlightParams.labels.join(";"),HIGHLIGHT_LABELCOLOR:highlightParams.labelFillColors.join(";"),HIGHLIGHT_LABELBUFFERCOLOR:highlightParams.labelOutlineColors.join(";"),HIGHLIGHT_LABELBUFFERSIZE:highlightParams.labelOutlineSizes.join(";"),HIGHLIGHT_LABELSIZE:highlightParams.labelSizes.join(";"),HIGHLIGHT_LABEL_DISTANCE:highlightParams.labelDist.join(";"),HIGHLIGHT_LABEL_ROTATION:highlightParams.labelRotations.join(";"),csrf_token:MiscUtils.getCsrfToken()},exportParams);var baseUrl=_this.props.theme.url.split("?")[0];var query=Object.entries(imageParams).map(function(_ref){var _ref2=_slicedToArray(_ref,2),k=_ref2[0],v=_ref2[1];return"".concat(encodeURIComponent(k),"=").concat(encodeURIComponent(v))}).join("&");var src=baseUrl+"?"+query;if(src===_this.state.imageUrl){return}_this.setState({imageUrl:src});var options={headers:{"content-type":"application/x-www-form-urlencoded"},responseType:"blob"};axios.post(baseUrl,query,options).then(function(response){var reader=new FileReader;reader.readAsDataURL(response.data);reader.onload=function(){_this.imageEl.innerHTML="<img src=\"".concat(reader.result,"\" style=\"width: 100%\" />")}})["catch"](function(){// Fall back to GET
|
|
7
|
+
*/import React from"react";import{Line}from"react-chartjs-2";import ReactDOM from"react-dom";import{connect}from"react-redux";import axios from"axios";import{Chart as ChartJS,CategoryScale,LinearScale,PointElement,LineElement,Title,Tooltip,Filler,BubbleController}from"chart.js";import FileSaver from"file-saver";import isEmpty from"lodash.isempty";import PropTypes from"prop-types";import{v1 as uuidv1}from"uuid";import{addMarker,removeMarker}from"../actions/layers";import{changeMeasurementState}from"../actions/measurement";import Icon from"../components/Icon";import ResizeableWindow from"../components/ResizeableWindow";import Spinner from"../components/widgets/Spinner";import{getElevationInterface}from"../utils/ElevationInterface";import LayerUtils from"../utils/LayerUtils";import LocaleUtils from"../utils/LocaleUtils";import MapUtils from"../utils/MapUtils";import MeasureUtils from"../utils/MeasureUtils";import MiscUtils from"../utils/MiscUtils";import VectorLayerUtils from"../utils/VectorLayerUtils";import"./style/HeightProfile.css";ChartJS.register(CategoryScale,LinearScale,PointElement,LineElement,Title,Tooltip,Filler,BubbleController);var HeightProfilePrintDialog_=/*#__PURE__*/function(_React$PureComponent){function HeightProfilePrintDialog_(props){var _this;_classCallCheck(this,HeightProfilePrintDialog_);_this=_callSuper(this,HeightProfilePrintDialog_,[props]);_defineProperty(_this,"state",{initialized:false,imageUrl:""});_defineProperty(_this,"closePrintWindow",function(){_this.externalWindow.close()});_defineProperty(_this,"setWindowContent",function(){_this.externalWindow.addEventListener("beforeunload",_this.props.onClose,false);var container=_this.externalWindow.document.getElementById("heightprofilecontainer");if(container){var printBtn=_this.externalWindow.document.createElement("div");printBtn.id="print";printBtn.style.marginBottom="1em";printBtn.innerHTML="<style type=\"text/css\">@media print{ #print { display: none; }}</style>"+"<button onClick=\"(function(){window.print();})()\">"+LocaleUtils.tr("heightprofile.print")+"</button>";container.appendChild(printBtn);_this.imageEl=_this.externalWindow.document.createElement("div");_this.imageEl.id="map";_this.imageEl.innerHTML=LocaleUtils.tr("heightprofile.loadingimage");container.appendChild(_this.imageEl);_this.portalEl=_this.externalWindow.document.createElement("div");_this.portalEl.id="profile";container.appendChild(_this.portalEl);_this.setState({initialized:true});_this.externalWindow.document.body.style.overflowX="hidden"}else{_this.externalWindow.document.body.innerHTML="Broken template. An element with id=heightprofilecontainer must exist."}});_defineProperty(_this,"refreshImage",function(){var measurement=_this.props.measurement;var layer={type:"vector",opacity:255,features:[{type:"Feature",geometry:{coordinates:measurement.coordinates,type:"LineString"},styleOptions:{strokeColor:[255,0,0,1],strokeWidth:4},properties:{segment_labels:measurement.segment_lengths.map(function(length){return MeasureUtils.formatMeasurement(length,false,measurement.lenUnit)})}}]};var mapCrs=_this.props.map.projection;var scale=Math.round(MapUtils.computeForZoom(_this.props.map.scales,_this.props.map.zoom));var exportParams=LayerUtils.collectPrintParams(_this.props.layers,_this.props.theme,scale,mapCrs,true,false);var highlightParams=VectorLayerUtils.createPrintHighlighParams([layer],mapCrs);var imageParams=_objectSpread({SERVICE:"WMS",VERSION:"1.3.0",REQUEST:"GetMap",TRANSPARENT:"true",TILED:"false",CRS:_this.props.map.projection,BBOX:_this.props.map.bbox.bounds,WIDTH:_this.props.map.size.width,HEIGHT:_this.props.map.size.height,HIGHLIGHT_GEOM:highlightParams.geoms.join(";"),HIGHLIGHT_SYMBOL:highlightParams.styles.join(";"),HIGHLIGHT_LABELSTRING:highlightParams.labels.join(";"),HIGHLIGHT_LABELCOLOR:highlightParams.labelFillColors.join(";"),HIGHLIGHT_LABELBUFFERCOLOR:highlightParams.labelOutlineColors.join(";"),HIGHLIGHT_LABELBUFFERSIZE:highlightParams.labelOutlineSizes.join(";"),HIGHLIGHT_LABELSIZE:highlightParams.labelSizes.join(";"),HIGHLIGHT_LABEL_DISTANCE:highlightParams.labelDist.join(";"),HIGHLIGHT_LABEL_ROTATION:highlightParams.labelRotations.join(";"),csrf_token:MiscUtils.getCsrfToken()},exportParams);var baseUrl=_this.props.theme.url.split("?")[0];var query=Object.entries(imageParams).map(function(_ref){var _ref2=_slicedToArray(_ref,2),k=_ref2[0],v=_ref2[1];return"".concat(encodeURIComponent(k),"=").concat(encodeURIComponent(v))}).join("&");var src=baseUrl+"?"+query;if(src===_this.state.imageUrl){return}_this.setState({imageUrl:src});var options={headers:{"content-type":"application/x-www-form-urlencoded"},responseType:"blob"};axios.post(baseUrl,query,options).then(function(response){var reader=new FileReader;reader.readAsDataURL(response.data);reader.onload=function(){_this.imageEl.innerHTML="<img src=\"".concat(reader.result,"\" style=\"width: 100%\" />")}})["catch"](function(){// Fall back to GET
|
|
8
8
|
_this.imageEl.innerHTML="<img src=\"".concat(src,"\" style=\"width: 100%\" />")})});_defineProperty(_this,"windowResized",function(){if(_this.chart){_this.chart.resize()}});_this.externalWindow=null;_this.chart=null;_this.portalEl=null;_this.imageEl=null;return _this}_inherits(HeightProfilePrintDialog_,_React$PureComponent);return _createClass(HeightProfilePrintDialog_,[{key:"componentDidMount",value:function componentDidMount(){var templatePath=MiscUtils.resolveAssetsPath(this.props.templatePath);this.externalWindow=window.open(templatePath,LocaleUtils.tr("heightprofile.title"),"toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes");this.externalWindow.addEventListener("load",this.setWindowContent,false);this.externalWindow.addEventListener("resize",this.windowResized,false);window.addEventListener("beforeunload",this.closePrintWindow)}},{key:"componentDidUpdate",value:function componentDidUpdate(prevProps,prevState){if(this.props.layers!==prevProps.layers||this.props.map.bbox!==prevProps.map.bbox||this.state.initialized&&!prevState.initialized){this.refreshImage()}}},{key:"componentWillUnmount",value:function componentWillUnmount(){this.closePrintWindow();window.removeEventListener("beforeunload",this.closePrintWindow)}},{key:"render",value:function render(){var _this2=this;if(!this.state.initialized){return null}return/*#__PURE__*/ReactDOM.createPortal(this.props.children(function(el){_this2.chart=el},false),this.portalEl)}}])}(React.PureComponent);_defineProperty(HeightProfilePrintDialog_,"propTypes",{children:PropTypes.func,layers:PropTypes.array,map:PropTypes.object,measurement:PropTypes.object,onClose:PropTypes.func,templatePath:PropTypes.string,theme:PropTypes.object});var HeightProfilePrintDialog=connect(function(state){return{layers:state.layers.flat,map:state.map,theme:state.theme.current}},{})(HeightProfilePrintDialog_);/**
|
|
9
9
|
* Displays a height profile along a measured line.
|
|
10
10
|
*
|
|
@@ -16,12 +16,15 @@ _this.imageEl.innerHTML="<img src=\"".concat(src,"\" style=\"width: 100%\" />")}
|
|
|
16
16
|
*
|
|
17
17
|
* The print height profile functionality requires a template located by default at `assets/templates/heightprofileprint.html`
|
|
18
18
|
* with containing a container element with `id=heightprofilecontainer`.
|
|
19
|
-
*/var HeightProfile=/*#__PURE__*/function(_React$Component){function HeightProfile(props){var _this3;_classCallCheck(this,HeightProfile);_this3=_callSuper(this,HeightProfile,[props]);_defineProperty(_this3,"state",{data:{},
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
*/var HeightProfile=/*#__PURE__*/function(_React$Component){function HeightProfile(props){var _this3;_classCallCheck(this,HeightProfile);_this3=_callSuper(this,HeightProfile,[props]);_defineProperty(_this3,"state",{data:{},selectedDatasetIndices:[0],reqId:null,drawnodes:true,printdialog:false});_defineProperty(_this3,"onClose",function(){_this3.setState({data:{},isloading:false});_this3.props.changeMeasurementState(_objectSpread(_objectSpread({},_this3.props.measurement),{},{pickPositionCallback:null}))});_defineProperty(_this3,"renderHeightProfile",function(saveRef,interactive){var _this3$state$selected2;if(_this3.props.measurement.drawing){return null}if(_this3.state.data.error){return/*#__PURE__*/React.createElement("div",{className:"height-profile-error",role:"body"},LocaleUtils.tr("heightprofile.error")+": "+_this3.state.data.error)}var distanceStr=LocaleUtils.tr("heightprofile.distance");var heightStr=LocaleUtils.tr("heightprofile.height");var aslStr=LocaleUtils.tr("heightprofile.asl");var _this3$state$selected=_this3.state.selectedDatasetIndices,selectedDatasetIndices=_this3$state$selected===void 0?[]:_this3$state$selected;var datasets=selectedDatasetIndices.flatMap(function(idx){return[{label:_this3.state.data[idx].dataset,data:_this3.state.data[idx].y.map(function(y,i){return{x:_this3.state.data[idx].x[i],y:y}}),fill:true,backgroundColor:"rgba(255,0,0,0.5)",borderColor:"rgb(255,0,0)",borderWidth:2,pointRadius:0,order:1},{type:"bubble",data:_this3.state.data[idx].nodes,backgroundColor:"rgb(255, 255, 255)",borderColor:"rgb(255, 0, 0)",borderWidth:2,radius:5,hoverRadius:0,hoverBorderWidth:2,order:0,hidden:!_this3.state.drawnodes}]});var data={labels:_this3.state.data[0].x,// X-axis labels are all the same
|
|
20
|
+
datasets:datasets};var sampleDataset=_this3.state.data[(_this3$state$selected2=_this3.state.selectedDatasetIndices[0])!==null&&_this3$state$selected2!==void 0?_this3$state$selected2:0];// first selected dataset for chart scale etc.
|
|
21
|
+
// Approx 10 ticks
|
|
22
|
+
var stepSizeFact=Math.pow(10,Math.ceil(Math.log10(sampleDataset.totLength/10)));var stepSize=Math.round(sampleDataset.totLength/stepSizeFact)*stepSizeFact/10;var prec=_this3.props.heightProfilePrecision;var options={responsive:true,maintainAspectRatio:false,animation:{duration:0},plugins:{legend:{display:false},tooltip:{enabled:interactive,intersect:false,displayColors:false,bodyFont:{weight:"bold"},callbacks:{title:function title(ctx){return distanceStr+": "+MeasureUtils.formatMeasurement(ctx[0].parsed.x,false,"metric")},label:function label(ctx){return _this3.state.data.length>1?"".concat(heightStr," (").concat(ctx.dataset.label,"): ").concat(ctx.parsed.y.toFixed(prec)," m ").concat(aslStr):"".concat(heightStr,": ").concat(ctx.parsed.y.toFixed(prec)," m ").concat(aslStr)}}}},scales:{x:{type:"linear",ticks:{stepSize:stepSize,font:{size:10},callback:function callback(value){return value}},title:{display:true,text:distanceStr+" [m]",padding:0},max:Math.ceil(sampleDataset.totLength)},y:{ticks:{font:{size:10},callback:function callback(value){return value.toFixed(prec)}},title:{display:true,text:heightStr+" [m "+aslStr+"]"},max:Math.ceil(Math.max.apply(Math,_toConsumableArray(selectedDatasetIndices.map(function(idx){var _this3$state$data$idx;return(_this3$state$data$idx=_this3.state.data[idx])===null||_this3$state$data$idx===void 0?void 0:_this3$state$data$idx.maxY})))),min:Math.floor(Math.min.apply(Math,_toConsumableArray(selectedDatasetIndices.map(function(idx){var _this3$state$data$idx2;return(_this3$state$data$idx2=_this3.state.data[idx])===null||_this3$state$data$idx2===void 0?void 0:_this3$state$data$idx2.minY}))))}},onHover:interactive?function(evt,activeEls,chart){var chartArea=chart.chartArea;var chartX=Math.min(Math.max(evt.x-chartArea.left),chartArea.width);_this3.updateMarker(chartX/chartArea.width*sampleDataset.totLength)}:undefined};var datasetSelector=null;if(_this3.state.data.length>1){datasetSelector=/*#__PURE__*/React.createElement("div",{className:"height-profile-dataset-select"},_this3.state.data.map(function(dataset,idx){var _this3$state$selected3;var isSelected=(_this3$state$selected3=_this3.state.selectedDatasetIndices)===null||_this3$state$selected3===void 0?void 0:_this3$state$selected3.includes(idx);return/*#__PURE__*/React.createElement("div",{key:"".concat(dataset.dataset,"-").concat(idx)},/*#__PURE__*/React.createElement(Icon,{icon:isSelected?"checked":"unchecked",onClick:function onClick(){var selected=new Set(_this3.state.selectedDatasetIndices||[]);if(isSelected){selected["delete"](idx)}else{selected.add(idx)}_this3.setState({selectedDatasetIndices:Array.from(selected)})}}),/*#__PURE__*/React.createElement("span",null,dataset.dataset))}))}return/*#__PURE__*/React.createElement("div",{className:"height-profile-chart-container",role:"body",style:{position:"relative"}},datasetSelector,/*#__PURE__*/React.createElement(Line,{data:data,options:options,ref:saveRef}))});_defineProperty(_this3,"resizeChart",function(){if(_this3.chart){_this3.chart.resize()}});_defineProperty(_this3,"updateMarker",function(x){var segmentLengths=_this3.props.measurement.segment_lengths;var coo=_this3.props.measurement.coordinates;if(isEmpty(segmentLengths)||isEmpty(coo)){return}var i=0;var runl=0;while(i<segmentLengths.length-1&&x>runl+segmentLengths[i]){runl+=segmentLengths[i++]}var lambda=(x-runl)/segmentLengths[i];var p=[coo[i][0]+lambda*(coo[i+1][0]-coo[i][0]),coo[i][1]+lambda*(coo[i+1][1]-coo[i][1])];_this3.props.addMarker("heightprofile",p,"",_this3.props.projection,1000001);// 1000001: one higher than the zIndex in MeasurementSupport...
|
|
23
|
+
});_defineProperty(_this3,"showTooltip",function(idx){if(!_this3.chart){return}var chartArea=_this3.chart.chartArea;var activeElements=_this3.chart.data.datasets.map(function(ds,i){return{ds:ds,i:i}}).filter(function(_ref3){var ds=_ref3.ds;return ds.type!=="bubble"}).map(function(_ref4){var i=_ref4.i;return{datasetIndex:i,index:idx}});_this3.chart.tooltip.setActiveElements(activeElements,{x:(chartArea.left+chartArea.right)/2,y:(chartArea.top+chartArea.bottom)/2});_this3.chart.update()});_defineProperty(_this3,"clearMarkerAndTooltip",function(){_this3.props.removeMarker("heightprofile");if(_this3.chart){_this3.chart.tooltip.setActiveElements([],{x:0,y:0})}});_defineProperty(_this3,"pickPositionCallback",function(pos){var _this3$state$selected4;if(!pos||isEmpty(_this3.state.data)){_this3.clearMarkerAndTooltip();return}var data=_this3.state.data[(_this3$state$selected4=_this3.state.selectedDatasetIndices[0])!==null&&_this3$state$selected4!==void 0?_this3$state$selected4:0];// Find sample index
|
|
22
24
|
var segmentLengths=_this3.props.measurement.segment_lengths;var coo=_this3.props.measurement.coordinates;var x=0;for(var iSegment=0;iSegment<coo.length-1;++iSegment){if(_this3.pointOnSegment(pos,coo[iSegment],coo[iSegment+1])){var len=MeasureUtils.computeSegmentLengths([pos,coo[iSegment]],_this3.props.projection,_this3.props.measurement.geodesic)[0];x+=len;break}else{x+=segmentLengths[iSegment]}}var k=Math.min(1,x/data.totLength);var idx=Math.min(data.y.length-1,Math.floor(k*_this3.props.samples));_this3.showTooltip(idx)});_defineProperty(_this3,"pointOnSegment",function(q,p1,p2){var tol=1E-3;// Determine whether points lie on same line: cross-product (P2-P1) x (Q - P1) zero?
|
|
23
25
|
var cross=(p2[0]-p1[0])*(q[1]-p1[1])-(q[0]-p1[0])*(p2[1]-p1[1]);if(Math.abs(cross)>tol){return false}// Determine if coordinates lie within segment coordinates
|
|
24
|
-
if(Math.abs(p1[0]-p2[0])>tol){return p1[0]<=q[0]&&q[0]<=p2[0]||p2[0]<=q[0]&&q[0]<=p1[0]}else{return p1[1]<=q[1]&&q[1]<=p2[1]||p2[1]<=q[1]&&q[1]<=p1[1]}});_defineProperty(_this3,"exportProfile",function(){
|
|
26
|
+
if(Math.abs(p1[0]-p2[0])>tol){return p1[0]<=q[0]&&q[0]<=p2[0]||p2[0]<=q[0]&&q[0]<=p1[0]}else{return p1[1]<=q[1]&&q[1]<=p2[1]||p2[1]<=q[1]&&q[1]<=p1[1]}});_defineProperty(_this3,"exportProfile",function(){// const data = this.state.data[this.state.selectedDatasetIndex];
|
|
27
|
+
_this3.state.selectedDatasetIndices.forEach(function(index){var data=_this3.state.data[index];if(!data.x){return}var csv="";csv+="index"+"\t"+"distance"+"\t"+"elevation"+"\n";data.x.forEach(function(x,idx){var sample={x:x,y:data.y[idx]};var prec=_this3.props.heightProfilePrecision;var distance=Math.round(sample.x*Math.pow(10,prec))/Math.pow(10,prec);var height=Math.round(sample.y*Math.pow(10,prec))/Math.pow(10,prec);csv+=String(idx).replace("\"","\"\"")+"\t"+String(distance)+"\t"+String(height)+"\n"});FileSaver.saveAs(new Blob([csv],{type:"text/plain;charset=utf-8"}),_this3.state.data.length>1?"heightprofile-".concat(data.dataset,".csv"):"heightprofile.csv")})});_this3.chart=null;_this3.profilePrintWindow=null;return _this3}_inherits(HeightProfile,_React$Component);return _createClass(HeightProfile,[{key:"componentDidUpdate",value:function componentDidUpdate(prevProps){if(this.props.measurement.coordinates!==prevProps.measurement.coordinates){if(this.props.measurement.drawing===false&&this.props.measurement.geomType==="LineString"&&!isEmpty(this.props.measurement.coordinates)){this.queryElevations(this.props.measurement.coordinates,this.props.measurement.segment_lengths,this.props.projection)}else if(!isEmpty(this.state.data)){this.setState({data:{}});this.props.changeMeasurementState(_objectSpread(_objectSpread({},this.props.measurement),{},{pickPositionCallback:null}))}}}},{key:"queryElevations",value:function queryElevations(coordinates,distances,projection){var _this4=this;var reqId=uuidv1();this.setState({reqId:reqId});var totLength=this.props.measurement.length;getElevationInterface().getProfile(coordinates,distances,projection,this.props.samples).then(function(response){// Request changed
|
|
25
28
|
if(_this4.state.reqId!==reqId){return}var elevationsList=response.list;if(!elevationsList){elevationsList=[{elevations:response,dataset:null}]}var data=elevationsList.map(function(entry,index){var elevations=entry.elevations;// Compute x-axis distances and get node points
|
|
26
|
-
var nodes=[];var cumDist=distances[0];var distIdx=0;var y=elevations;var x=y.map(function(value,idx,a){var dist=
|
|
27
|
-
nodes.unshift({x:x[0],y:y[0]});nodes.push({x:x[x.length-1],y:y[y.length-1]});return{dataset:entry.dataset,x:x,y:elevations,maxY:Math.max.apply(Math,_toConsumableArray(elevations)),totLength:totLength,nodes:nodes}});_this4.setState(function(prevState){return{reqId:null,data:data,
|
|
29
|
+
var nodes=[];var cumDist=distances[0];var distIdx=0;var y=elevations;var x=y.map(function(value,idx,a){var dist=idx/(a.length-1)*totLength;if(dist>=cumDist){nodes.push({x:dist,y:y[idx]});cumDist+=distances[++distIdx]}return dist});// First and last node
|
|
30
|
+
nodes.unshift({x:x[0],y:y[0]});nodes.push({x:x[x.length-1],y:y[y.length-1]});var nonZeroElevations=elevations.filter(function(elev){return elev!==0});if(nonZeroElevations.length>0){return{dataset:entry.dataset||"".concat(LocaleUtils.tr("heightprofile.dhmdefaultname")," ").concat(index+1),x:x,y:elevations,maxY:Math.max.apply(Math,_toConsumableArray(elevations)),minY:Math.min.apply(Math,_toConsumableArray(nonZeroElevations)),totLength:totLength,nodes:nodes}}return null}).filter(function(entry){return entry!==null});_this4.setState(function(prevState){return{reqId:null,data:data,selectedDatasetIndices:prevState.selectedDatasetIndices.filter(function(i){return i<data.length})?prevState.selectedDatasetIndices:[0]}});_this4.props.changeMeasurementState(_objectSpread(_objectSpread({},_this4.props.measurement),{},{pickPositionCallback:_this4.pickPositionCallback}))})["catch"](function(error){_this4.setState({reqId:null,data:error?{error:error}:{}})})}},{key:"render",value:function render(){var _this5=this;if(isEmpty(this.state.data)&&!this.state.isloading){return null}var extraControls=[{icon:"circle",active:this.state.drawnodes,callback:function callback(){return _this5.setState(function(state){return{drawnodes:!state.drawnodes}})},title:LocaleUtils.tr("heightprofile.drawnodes")},{icon:"export",callback:this.exportProfile,title:LocaleUtils.tr("heightprofile.export")},{icon:"print",active:this.state.printdialog,callback:function callback(){return _this5.setState(function(state){return{printdialog:!state.printdialog}})},title:LocaleUtils.tr("heightprofile.print")}];return[/*#__PURE__*/React.createElement(ResizeableWindow,{dockable:"bottom",extraControls:extraControls,icon:"line",initialHeight:this.props.height,initialWidth:600,initiallyDocked:true,key:"ProfileDialog",onClose:this.onClose,onExternalWindowResized:this.resizeChart,splitScreenWhenDocked:true,title:LocaleUtils.tr("heightprofile.title"),usePortal:false},this.state.isloading?/*#__PURE__*/React.createElement("div",{className:"height-profile-loading-indicator",role:"body"},/*#__PURE__*/React.createElement(Spinner,{className:"spinner"})," ",LocaleUtils.tr("heightprofile.loading")):this.renderHeightProfile(function(el){_this5.chart=el},true)),this.state.printdialog?/*#__PURE__*/React.createElement(HeightProfilePrintDialog,{key:"ProfilePrintDialog",measurement:this.props.measurement,onClose:function onClose(){return _this5.setState({printdialog:false})},templatePath:this.props.templatePath},this.renderHeightProfile):null]}}])}(React.Component);_defineProperty(HeightProfile,"propTypes",{addMarker:PropTypes.func,changeMeasurementState:PropTypes.func,/** The height of the height profile widget in pixels. */height:PropTypes.number,/** The precision of displayed and exported values (0: no decimals, 1: 1 decimal position, etc). */heightProfilePrecision:PropTypes.number,measurement:PropTypes.object,projection:PropTypes.string,removeMarker:PropTypes.func,/** The number of elevation samples to query. */samples:PropTypes.number,/** Template location for the height profile print functionality */templatePath:PropTypes.string});_defineProperty(HeightProfile,"defaultProps",{samples:500,heightProfilePrecision:0,height:150,templatePath:":/templates/heightprofileprint.html"});export default connect(function(state){return{measurement:state.measurement,projection:state.map.projection}},{addMarker:addMarker,changeMeasurementState:changeMeasurementState,removeMarker:removeMarker})(HeightProfile);
|