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.4 KiB
JavaScript

"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[5440],{5518:function(e,t,n){var a=n(41376),r=n(42010),o=n(54354),i=n(35975),s=n(49912),l=n(83384),c=n(45830),d=n(81769),u=n(12810),g=n(15421);l.Z.defs("EPSG:27700","+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +towgs84=446.448,-125.157,542.06,0.15,0.247,0.842,-20.489 +units=m +no_defs"),(0,g.z)(l.Z);var p=(0,u.U2)("EPSG:27700");p.setExtent([0,0,7e5,13e5]);var m=new r.Z;fetch("https://tiles.arcgis.com/tiles/qHLhLQrcvEnxjtPr/arcgis/rest/services/OS_Open_Raster/MapServer/WMTS").then((function(e){return e.text()})).then((function(e){var t=(new s.Z).read(e),n=(0,i.B)(t,{layer:"OS_Open_Raster"});n.attributions="Contains OS data © Crown Copyright and database right "+(new Date).getFullYear(),n.crossOrigin="",n.projection=p,n.wrapX=!1,m.setSource(new i.Z(n))}));var h=new a.Z({layers:[m],controls:(0,c.ce)({attributionOptions:{collapsible:!1}}),target:"map",view:new o.ZP({center:[373500,436500],projection:p,zoom:7})}),w=new d.Z({bar:!0,text:!0,minWidth:125});h.addControl(w);var f={a0:[1189,841],a1:[841,594],a2:[594,420],a3:[420,297],a4:[297,210],a5:[210,148]},v={useCORS:!0,ignoreElements:function(e){var t=e.className||"";return!(-1===t.indexOf("ol-control")||t.indexOf("ol-scale")>-1||t.indexOf("ol-attribution")>-1&&t.indexOf("ol-uncollapsible"))}},y=document.getElementById("export-pdf");y.addEventListener("click",(function(){y.disabled=!0,document.body.style.cursor="progress";var e=document.getElementById("format").value,t=document.getElementById("resolution").value,n=document.getElementById("scale").value,a=f[e],r=Math.round(a[0]*t/25.4),o=Math.round(a[1]*t/25.4),i=h.getView().getResolution(),s=n/(0,u._Q)(h.getView().getProjection(),t/25.4,h.getView().getCenter());h.once("rendercomplete",(function(){v.width=r,v.height=o,html2canvas(h.getViewport(),v).then((function(t){var n=new jspdf.jsPDF("landscape",void 0,e);n.addImage(t.toDataURL("image/jpeg"),"JPEG",0,0,a[0],a[1]),n.save("map.pdf"),w.setDpi(),h.getTargetElement().style.width="",h.getTargetElement().style.height="",h.updateSize(),h.getView().setResolution(i),y.disabled=!1,document.body.style.cursor="auto"}))})),w.setDpi(t),h.getTargetElement().style.width=r+"px",h.getTargetElement().style.height=o+"px",h.updateSize(),h.getView().setResolution(s)}),!1)}},function(e){var t=function(t){return e(e.s=t)};t(9877),t(5518)}]);
//# sourceMappingURL=print-to-scale.js.map