You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2 lines
3.5 KiB
JavaScript
2 lines
3.5 KiB
JavaScript
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[7069],{18312:function(e,n,t){var o,r=t(41376),a=t(54354),i=t(69039),l=t(77975),c=t(720),s=t(77138),g=t(40729),u=t(79072),w=t(64498),d=t(61038),f=t(5265),Z=t(75469),m=t(79847),b=t(95783),h=t(42010),p=t(41372),y=t(51318),x=document.getElementById("type"),k=document.getElementById("segments"),v=document.getElementById("clear"),P=new i.ZP({fill:new l.Z({color:"rgba(255, 255, 255, 0.2)"}),stroke:new c.Z({color:"rgba(0, 0, 0, 0.5)",lineDash:[10,10],width:2}),image:new s.Z({radius:5,stroke:new c.Z({color:"rgba(0, 0, 0, 0.7)"}),fill:new l.Z({color:"rgba(255, 255, 255, 0.2)"})})}),C=new i.ZP({text:new g.Z({font:"14px Calibri,sans-serif",fill:new l.Z({color:"rgba(255, 255, 255, 1)"}),backgroundFill:new l.Z({color:"rgba(0, 0, 0, 0.7)"}),padding:[3,3,3,3],textBaseline:"bottom",offsetY:-15}),image:new u.Z({radius:8,points:3,angle:Math.PI,displacement:[0,10],fill:new l.Z({color:"rgba(0, 0, 0, 0.7)"})})}),I=new i.ZP({text:new g.Z({font:"12px Calibri,sans-serif",fill:new l.Z({color:"rgba(255, 255, 255, 1)"}),backgroundFill:new l.Z({color:"rgba(0, 0, 0, 0.4)"}),padding:[2,2,2,2],textAlign:"left",offsetX:15})}),A=new i.ZP({image:new s.Z({radius:5,stroke:new c.Z({color:"rgba(0, 0, 0, 0.7)"}),fill:new l.Z({color:"rgba(0, 0, 0, 0.4)"})}),text:new g.Z({text:"Drag to modify",font:"12px Calibri,sans-serif",fill:new l.Z({color:"rgba(255, 255, 255, 1)"}),backgroundFill:new l.Z({color:"rgba(0, 0, 0, 0.7)"}),padding:[2,2,2,2],textAlign:"left",offsetX:15})}),T=new i.ZP({text:new g.Z({font:"12px Calibri,sans-serif",fill:new l.Z({color:"rgba(255, 255, 255, 1)"}),backgroundFill:new l.Z({color:"rgba(0, 0, 0, 0.4)"}),padding:[2,2,2,2],textBaseline:"bottom",offsetY:-12}),image:new u.Z({radius:6,points:3,angle:Math.PI,displacement:[0,8],fill:new l.Z({color:"rgba(0, 0, 0, 0.4)"})})}),M=[T],B=function(e){var n=(0,y.xA)(e);return n>100?Math.round(n/1e3*100)/100+" km":Math.round(100*n)/100+" m"},F=new h.Z({source:new m.Z}),G=new b.Z,E=new w.Z({source:G,style:A});function S(e,n,t,r){var a,i,l,c,s,g=[P],u=e.getGeometry(),w=u.getType();if(t&&t!==w||("Polygon"===w?(a=u.getInteriorPoint(),c=u,i=(s=(0,y.bg)(c))>1e4?Math.round(s/1e6*100)/100+" km²":Math.round(100*s)/100+" m²",l=new f.Z(u.getCoordinates()[0])):"LineString"===w&&(a=new Z.Z(u.getLastCoordinate()),i=B(u),l=u)),n&&l){var d=0;l.forEachSegment((function(e,n){var t=new f.Z([e,n]),o=B(t);M.length-1<d&&M.push(T.clone());var r=new Z.Z(t.getCoordinateAt(.5));M[d].setGeometry(r),M[d].getText().setText(o),g.push(M[d]),d++}))}return i&&(C.setGeometry(a),C.getText().setText(i),g.push(C)),r&&"Point"===w&&!E.getOverlay().getSource().getFeatures().length&&(o=u,I.getText().setText(r),g.push(I)),g}var D,L=new p.Z({source:G,style:function(e){return S(e,k.checked)}}),O=new r.Z({layers:[F,L],target:"map",view:new a.ZP({center:[-11e6,46e5],zoom:15})});function X(){var e=x.value,n="Click to continue drawing the "+("Polygon"===e?"polygon":"line"),t="Click to start measuring",r=t;(D=new d.ZP({source:G,type:e,style:function(n){return S(n,k.checked,e,r)}})).on("drawstart",(function(){v.checked&&G.clear(),E.setActive(!1),r=n})),D.on("drawend",(function(){A.setGeometry(o),E.setActive(!0),O.once("pointermove",(function(){A.setGeometry()})),r=t})),E.setActive(!0),O.addInteraction(D)}O.addInteraction(E),x.onchange=function(){O.removeInteraction(D),X()},X(),k.onchange=function(){L.changed(),D.getOverlay().changed()}}},function(e){var n=function(n){return e(e.s=n)};n(9877),n(18312)}]);
|
|
//# sourceMappingURL=measure-style.js.map
|