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
6.1 KiB
JavaScript

"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[3465],{23053:function(e,t,r){var n=r(12739),o=r(41376),a=r(75469),i=r(25691),u=r(5265),c=r(59193),f=r(90776);function y(e,t,r,n,o,a){var i,u;void 0!==o?(i=o,u=void 0!==a?a:0):(i=[],u=0);for(var c=t;c<r;){var f=e[c++];i[u++]=e[c++],i[u++]=f;for(var y=2;y<n;++y)i[u++]=e[c++]}return i.length=u,i}var l=r(12810),s=r(86877),p=r(55721),m=r(32025);function h(e){return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function v(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function w(e,t){return(w=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function d(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=b(e);if(t){var o=b(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return g(this,r)}}function g(e,t){if(t&&("object"===h(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function b(e){return(b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Z(e){for(var t,r="";e>=32;)t=63+(32|31&e),r+=String.fromCharCode(t),e>>=5;return t=e+63,r+=String.fromCharCode(t)}var k=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&w(e,t)}(c,e);var t,r,o,a=d(c);function c(e){var t;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c);var r=e||{};return(t=a.call(this)).dataProjection=(0,l.U2)("EPSG:4326"),t.factor_=r.factor?r.factor:1e5,t.geometryLayout_=r.geometryLayout?r.geometryLayout:i.Z.XY,t}return t=c,(r=[{key:"readFeatureFromText",value:function(e,t){var r=this.readGeometryFromText(e,t);return new n.Z(r)}},{key:"readFeaturesFromText",value:function(e,t){return[this.readFeatureFromText(e,t)]}},{key:"readGeometryFromText",value:function(e,t){var r=(0,s.tP)(this.geometryLayout_),n=function(e,t,r){var n,o=r||1e5,a=new Array(t);for(n=0;n<t;++n)a[n]=0;for(var i=function(e,t){for(var r=t||1e5,n=function(e){for(var t=function(e){for(var t=[],r=0,n=0,o=0,a=e.length;o<a;++o){var i=e.charCodeAt(o)-63;r|=(31&i)<<n,i<32?(t.push(r),r=0,n=0):n+=5}return t}(e),r=0,n=t.length;r<n;++r){var o=t[r];t[r]=1&o?~(o>>1):o>>1}return t}(e),o=0,a=n.length;o<a;++o)n[o]/=r;return n}(e,o),u=0,c=i.length;u<c;)for(n=0;n<t;++n,++u)a[n]+=i[u],i[u]=a[n];return i}(e,r,this.factor_);y(n,0,n.length,r,n);var o=(0,p.Ml)(n,0,n.length,r),a=new u.Z(o,this.geometryLayout_);return(0,m.fI)(a,!1,this.adaptOptions(t))}},{key:"writeFeatureText",value:function(e,t){var r=e.getGeometry();return r?this.writeGeometryText(r,t):((0,f.h)(!1,40),"")}},{key:"writeFeaturesText",value:function(e,t){return this.writeFeatureText(e[0],t)}},{key:"writeGeometryText",value:function(e,t){var r=(e=(0,m.fI)(e,!0,this.adaptOptions(t))).getFlatCoordinates(),n=e.getStride();return y(r,0,r.length,n,r),function(e,t,r){var n,o=r||1e5,a=new Array(t);for(n=0;n<t;++n)a[n]=0;for(var i=0,u=e.length;i<u;)for(n=0;n<t;++n,++i){var c=e[i],f=c-a[n];a[n]=c,e[i]=f}return function(e,t){for(var r=t||1e5,n=0,o=e.length;n<o;++n)e[n]=Math.round(e[n]*r);return function(e){for(var t=0,r=e.length;t<r;++t){var n=e[t];e[t]=n<0?~(n<<1):n<<1}return function(e){for(var t="",r=0,n=e.length;r<n;++r)t+=Z(e[r]);return t}(e)}(e)}(e,o)}(r,n,this.factor_)}}])&&v(t.prototype,r),o&&v(t,o),Object.defineProperty(t,"prototype",{writable:!1}),c}(c.Z),P=r(95783),_=r(54354),S=r(31998),O=r(69039),j=r(720),x=r(24598),T=r(77138),C=r(77975),G=r(42010),F=r(41372),E=r(31250),L=new o.Z({target:document.getElementById("map"),view:new _.ZP({center:[-5639523.95,-3501274.52],zoom:10,minZoom:2,maxZoom:19}),layers:[new G.Z({source:new S.Z({attributions:'<a href="https://www.maptiler.com/copyright/" target="_blank">&copy; MapTiler</a> <a href="https://www.openstreetmap.org/copyright" target="_blank">&copy; OpenStreetMap contributors</a>',url:"https://api.maptiler.com/maps/hybrid/{z}/{x}/{y}.jpg?key=get_your_own_D6rA4zTHduk6KOKTXzGB",tileSize:512})})]});fetch("data/polyline/route.json").then((function(e){e.json().then((function(e){var t=e.routes[0].geometry,r=new k({factor:1e6}).readGeometry(t,{dataProjection:"EPSG:4326",featureProjection:"EPSG:3857"}),o=new n.Z({type:"route",geometry:r}),i=new n.Z({type:"icon",geometry:new a.Z(r.getFirstCoordinate())}),u=new n.Z({type:"icon",geometry:new a.Z(r.getLastCoordinate())}),c=i.getGeometry().clone(),f=new n.Z({type:"geoMarker",geometry:c}),y={route:new O.ZP({stroke:new j.Z({width:6,color:[237,212,0,.8]})}),icon:new O.ZP({image:new x.Z({anchor:[.5,1],src:"data/icon.png"})}),geoMarker:new O.ZP({image:new T.Z({radius:7,fill:new C.Z({color:"black"}),stroke:new j.Z({color:"white",width:2})})})},l=new F.Z({source:new P.Z({features:[o,f,i,u]}),style:function(e){return y[e.get("type")]}});L.addLayer(l);var s,p=document.getElementById("speed"),m=document.getElementById("start-animation"),h=!1,v=0;function w(e){var t=Number(p.value),n=e.frameState.time;v=(v+t*(n-s)/1e6)%2,s=n;var o=r.getCoordinateAt(v>1?2-v:v);c.setCoordinates(o);var a=(0,E.u3)(e);a.setStyle(y.geoMarker),a.drawGeometry(c),L.render()}m.addEventListener("click",(function(){h?(h=!1,m.textContent="Start Animation",f.setGeometry(c),l.un("postrender",w)):(h=!0,s=Date.now(),m.textContent="Stop Animation",l.on("postrender",w),f.setGeometry(null))}))}))}))}},function(e){var t=function(t){return e(e.s=t)};t(9877),t(23053)}]);
//# sourceMappingURL=feature-move-animation.js.map