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
4.5 KiB
JavaScript
2 lines
4.5 KiB
JavaScript
(window.webpackJsonp=window.webpackJsonp||[]).push([[43],{424:function(e,t,r){"use strict";r.r(t);var o=r(16),n=r(3),a=r(25),i=r(23),c=r(36),u=r(170),p=r(22);function f(e,t,r,o,n,a){var i,c;void 0!==n?(i=n,c=void 0!==a?a:0):(i=[],c=0);for(var u=t;u<r;){var p=e[u++];i[c++]=e[u++],i[c++]=p;for(var f=2;f<o;++f)i[c++]=e[u++]}return i.length=c,i}var g=r(4),y=r(80),s=r(90),w=r(41);function d(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 m=function(e){function t(t){e.call(this);var r=t||{};this.dataProjection=Object(g.j)("EPSG:4326"),this.factor_=r.factor?r.factor:1e5,this.geometryLayout_=r.geometryLayout?r.geometryLayout:i.a.XY}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.readFeatureFromText=function(e,t){var r=this.readGeometryFromText(e,t);return new o.a(r)},t.prototype.readFeaturesFromText=function(e,t){return[this.readFeatureFromText(e,t)]},t.prototype.readGeometryFromText=function(e,t){var r=Object(y.b)(this.geometryLayout_),o=function(e,t,r){var o,n=r||1e5,a=new Array(t);for(o=0;o<t;++o)a[o]=0;for(var i=function(e,t){for(var r=t||1e5,o=function(e){for(var t=function(e){for(var t=[],r=0,o=0,n=0,a=e.length;n<a;++n){var i=e.charCodeAt(n)-63;r|=(31&i)<<o,i<32?(t.push(r),r=0,o=0):o+=5}return t}(e),r=0,o=t.length;r<o;++r){var n=t[r];t[r]=1&n?~(n>>1):n>>1}return t}(e),n=0,a=o.length;n<a;++n)o[n]/=r;return o}(e,n),c=0,u=i.length;c<u;)for(o=0;o<t;++o,++c)a[o]+=i[c],i[c]=a[o];return i}(e,r,this.factor_);f(o,0,o.length,r,o);var n=Object(s.a)(o,0,o.length,r),a=new c.a(n,this.geometryLayout_);return Object(w.c)(a,!1,this.adaptOptions(t))},t.prototype.writeFeatureText=function(e,t){var r=e.getGeometry();return r?this.writeGeometryText(r,t):(Object(p.a)(!1,40),"")},t.prototype.writeFeaturesText=function(e,t){return this.writeFeatureText(e[0],t)},t.prototype.writeGeometryText=function(e,t){var r=(e=Object(w.c)(e,!0,this.adaptOptions(t))).getFlatCoordinates(),o=e.getStride();return f(r,0,r.length,o,r),function(e,t,r){var o,n=r||1e5,a=new Array(t);for(o=0;o<t;++o)a[o]=0;for(var i=0,c=e.length;i<c;)for(o=0;o<t;++o,++i){var u=e[i],p=u-a[o];a[o]=u,e[i]=p}return function(e,t){for(var r=t||1e5,o=0,n=e.length;o<n;++o)e[o]=Math.round(e[o]*r);return function(e){for(var t=0,r=e.length;t<r;++t){var o=e[t];e[t]=o<0?~(o<<1):o<<1}return function(e){for(var t="",r=0,o=e.length;r<o;++r)t+=d(e[r]);return t}(e)}(e)}(e,n)}(r,o,this.factor_)},t}(u.a),h=r(10),l=r(2),v=r(27),b=r(11),C=r(15),j=r(76),_=r(48),k=r(21),x=r(5),T=r(19),F=r(51),O=[-5639523.95,-3501274.52],A=new n.a({target:document.getElementById("map"),view:new l.a({center:O,zoom:10,minZoom:2,maxZoom:19}),layers:[new x.a({source:new v.a({attributions:'<a href="https://www.maptiler.com/copyright/" target="_blank">© MapTiler</a> <a href="https://www.openstreetmap.org/copyright" target="_blank">© 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,r,n=e.routes[0].geometry,i=new m({factor:1e6}).readGeometry(n,{dataProjection:"EPSG:4326",featureProjection:"EPSG:3857"}),c=new o.a({type:"route",geometry:i}),u=new o.a({type:"geoMarker",geometry:new a.a(i.getCoordinateAt(0))}),p=new o.a({type:"icon",geometry:new a.a(i.getCoordinateAt(0))}),f=new o.a({type:"icon",geometry:new a.a(i.getCoordinateAt(1))}),g={route:new b.c({stroke:new C.a({width:6,color:[237,212,0,.8]})}),icon:new b.c({image:new j.a({anchor:[.5,1],src:"data/icon.png"})}),geoMarker:new b.c({image:new _.a({radius:7,fill:new k.a({color:"black"}),stroke:new C.a({color:"white",width:2})})})},y=!1,s=new T.a({source:new h.a({features:[c,u,p,f]}),style:function(e){return y&&"geoMarker"===e.get("type")?null:g[e.get("type")]}});A.addLayer(s);var w=document.getElementById("speed"),d=document.getElementById("start-animation");function l(e){var n=Object(F.b)(e),c=e.frameState;if(y){var u=c.time-r,p=t*u/1e6;if(p>=1)return void v(!0);var f=new a.a(i.getCoordinateAt(p)),s=new o.a(f);n.drawFeature(s,g.geoMarker)}A.render()}function v(e){y=!1,d.textContent="Start Animation";var t=i.getCoordinateAt(e?1:0);u.getGeometry().setCoordinates(t),s.un("postrender",l)}d.addEventListener("click",(function(){y?v(!1):(y=!0,r=(new Date).getTime(),t=w.value,d.textContent="Cancel Animation",u.changed(),A.getView().setCenter(O),s.on("postrender",l),A.render())}),!1)}))}))}},[[424,0]]]);
|
|
//# sourceMappingURL=feature-move-animation.js.map
|