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
2.6 KiB
JavaScript
2 lines
2.6 KiB
JavaScript
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[259],{80648:function(e,t,o){var n,r,i=o(41376),c=o(54354),s=o(69039),a=o(77975),u=o(720),f=o(77138),m=o(64498),g=o(61038),y=o(99247),l=o(68675),w=o(85528),d=o(75469),G=o(79847),Z=o(95783),v=o(42010),P=o(41372),E=o(51318),S=o(12810),C=new v.Z({source:new G.Z}),p=new Z.Z,h=new s.ZP({fill:new a.Z({color:"rgba(255, 255, 255, 0.2)"}),stroke:new u.Z({color:"#33cc33",width:2}),image:new f.Z({radius:7,fill:new a.Z({color:"#ffcc33"})})}),k=new s.ZP({geometry:function(e){return e.get("modifyGeometry")||e.getGeometry()},fill:new a.Z({color:"rgba(255, 255, 255, 0.2)"}),stroke:new u.Z({color:"#ff3333",width:2}),image:new f.Z({radius:7,fill:new a.Z({color:"rgba(0, 0, 0, 0)"})})}),I=new P.Z({source:p,style:function(e){return"GeometryCollection"===e.getGeometry().getType()?k:h}}),b=new i.Z({layers:[C,I],target:"map",view:new c.ZP({center:[-11e6,66e5],zoom:3})}),F=new m.Z({source:p}).getOverlay().getStyleFunction(),T=new m.Z({source:p,style:function(e){return e.get("features").forEach((function(t){var o=t.get("modifyGeometry");if(o){var n,r,i,c=e.getGeometry().getCoordinates(),s=t.getGeometry().getGeometries(),a=s[0].getCoordinates()[0],u=s[1].getCoordinates(),f=b.getView().getProjection();c[0]===u[0]&&c[1]===u[1]?(n=(0,S.vs)(a[0],f,"EPSG:4326"),r=(0,S.vs)(a[(a.length-1)/2],f,"EPSG:4326"),i=(0,E.Sp)(n,r)/2):(n=(0,S.vs)(u,f,"EPSG:4326"),r=(0,S.vs)(c,f,"EPSG:4326"),i=(0,E.Sp)(n,r));var m=(0,w.iu)((0,S.vs)(u,f,"EPSG:4326"),i,128);m.transform("EPSG:4326",f),s[0].setCoordinates(m.getCoordinates()),o.setGeometries(s)}})),F(e)}});T.on("modifystart",(function(e){e.features.forEach((function(e){var t=e.getGeometry();"GeometryCollection"===t.getType()&&e.set("modifyGeometry",t.clone(),!0)}))})),T.on("modifyend",(function(e){e.features.forEach((function(e){var t=e.get("modifyGeometry");t&&(e.setGeometry(t),e.unset("modifyGeometry",!0))}))})),b.addInteraction(T);var j=document.getElementById("type");function z(){var e,t=j.value;"Geodesic"===t&&(t="Circle",e=function(e,t,o){t||(t=new l.Z([new w.ZP([]),new d.Z(e[0])]));var n=t.getGeometries(),r=(0,S.vs)(e[0],o,"EPSG:4326"),i=(0,S.vs)(e[1],o,"EPSG:4326"),c=(0,E.Sp)(r,i),s=(0,w.iu)(r,c,128);return s.transform("EPSG:4326",o),n[0].setCoordinates(s.getCoordinates()),t.setGeometries(n),t}),n=new g.ZP({source:p,type:t,geometryFunction:e}),b.addInteraction(n),r=new y.Z({source:p}),b.addInteraction(r)}j.onchange=function(){b.removeInteraction(n),b.removeInteraction(r),z()},z()}},function(e){var t=function(t){return e(e.s=t)};t(9877),t(80648)}]);
|
|
//# sourceMappingURL=draw-and-modify-geodesic.js.map
|