map-core-func 0.2.19 → 0.2.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -191,4 +191,4 @@ Original MIT license applies
191
191
  * maptalks.animatemarker v0.4.1
192
192
  * LICENSE : MIT
193
193
  * (c) 2016-2017 maptalks.org
194
- */function vQ(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function mQ(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function AQ(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):function(t,e){for(var r=Object.getOwnPropertyNames(e),n=0;n<r.length;n++){var i=r[n],o=Object.getOwnPropertyDescriptor(e,i);o&&o.configurable&&void 0===t[i]&&Object.defineProperty(t,i,o)}}(t,e))}var _Q={markerType:"ellipse",markerFill:function(t){return{type:"radial",colorStops:[[.7,"rgba("+t.join()+", 0.5)"],[.3,"rgba("+t.join()+", 1)"],[.2,"rgba("+t.join()+", 1)"],[0,"rgba("+t.join()+", 0)"]]}}([135,196,240]),markerFillOpacity:.8,markerLineWidth:0,markerWidth:16,markerHeight:16},xQ=function(e){function r(){return vQ(this,r),mQ(this,e.apply(this,arguments))}return AQ(r,e),r.prototype.addGeometry=function(r){return r instanceof t.Geometry&&(r=[r]),r.forEach((function(e,r){if(!(e instanceof t.Marker))throw new Error("The geometry at "+r+" to add is not a maptalks.Marker")})),e.prototype.addGeometry.apply(this,arguments)},r.fromJSON=function(e){if(!e||"AnimateMarkerLayer"!==e.type)return null;for(var n=new r(e.id,e.options),i=e.geometries,o=[],s=0;s<i.length;s++){var a=t.Geometry.fromJSON(i[s]);a&&o.push(a)}return n.addGeometry(o),e.style&&n.setStyle(e.style),n},r}(t.VectorLayer);xQ.mergeOptions({animation:"scale,fade",randomAnimation:!0,animationDuration:3e3}),xQ.registerJSONType("AnimateMarkerLayer"),xQ.registerRenderer("canvas",function(e){function r(){return vQ(this,r),mQ(this,e.apply(this,arguments))}return AQ(r,e),r.prototype.draw=function(){this._needUpdate&&(this._prepare(),this._needUpdate=!1),this.prepareCanvas();var t=this.getMap(),e=this._currentMarkers;this._drawnExtent&&t.getExtent().equals(this._drawnExtent)&&(e=this._drawnMarkers),this._drawAllMarkers(e),this._drawnExtent=t.getExtent(),this.layer.isLoaded()||this.completeRender()},r.prototype.drawOnInteracting=function(){this._drawnMarkers&&0!==this._drawnMarkers.length&&this._drawAllMarkers(this._drawnMarkers)},r.prototype.needToRedraw=function(){return!!this.layer.options.animation||e.prototype.needToRedraw.call(this)},r.prototype.onCanvasCreate=function(){this._prepare()},r.prototype.onGeometryAdd=function(){this._redraw()},r.prototype.onGeometryRemove=function(){this._redraw()},r.prototype.onGeometrySymbolChange=function(){this._redraw()},r.prototype.onGeometryPositionChange=function(){this._redraw()},r.prototype.onGeometryShow=function(){this._redraw()},r.prototype.onGeometryHide=function(){this._redraw()},r.prototype.onGeometryPropertiesChange=function(t){if(t&&this.layer.getStyle())for(var e=0;e<t.length;e++)this.layer._styleGeometry(t[e])},r.prototype._redraw=function(){delete this._drawnMarkers,delete this._drawnExtent,this._needUpdate=!0},r.prototype._drawAllMarkers=function(t){var e=this,r=this.getMap(),n=r.getContainerExtent(),i=this._drawnTime=Date.now(),o=this._drawnAnim=this._getAnimation(),s=t!==this._drawnMarkers;s&&(this._drawnMarkers=[]),t.forEach((function(t){if(s){if(t.g.isVisible()){var a=r._prjToContainerPoint(t.coordinates);n.contains(a)&&(e._drawMarker(t,a,o,i),e._drawnMarkers.push(t))}}else{var u=r._prjToContainerPoint(t.coordinates);e._drawMarker(t,u,o,i)}}),this)},r.prototype._drawMarker=function(t,e,r,n){var i=this.layer.options.animationDuration,o=this.context,s=o.globalAlpha,a=(n-t.start)%i/i,u=r.fade&&a>=.5?2-2*a:1,l=r.scale?a:1,h=t.cacheKey,c=this._spriteCache[h],f=c.offset,p=c.canvas.width,d=c.canvas.height;c&&u>0&&(o.globalAlpha=s*u,o.drawImage(c.canvas,e.x+f.x-p*l/2,e.y+f.y-d*l/2,p*l,d*l),o.globalAlpha=s)},r.prototype._prepare=function(){var t=this,e=[],r={},n=this.getMap().getProjection();this.layer.forEach((function(i){t._currentGeo=i;var o=i._getInternalSymbol()===i.options.symbol?_Q:i._getInternalSymbol(),s=JSON.stringify(o);r[s]||(r[s]=o),e.push({coordinates:n.project(i.getCoordinates()),cacheKey:s,start:t.layer.options.randomAnimation?Math.random()*t.layer.options.animationDuration:0,g:i})})),this._prepareSprites(r),this._currentMarkers=e},r.prototype._prepareSprites=function(e){for(var r in this._spriteCache={},e){var n=e[r],i=new t.Marker([0,0],{symbol:n})._getSprite(this.resources);this._spriteCache[r]=i}},r.prototype.onRemove=function(){delete this._spriteCache,delete this._currentMarkers,delete this._drawnMarkers,delete this._drawnExtent},r.prototype._getAnimation=function(){for(var t,e={fade:!1,scale:!1},r=this.layer.options.animation?this.layer.options.animation.split(","):[],n=0;n<r.length;n++){var i=(t=r[n]).trim?t.trim():t.replace(/^\s+|\s+$/g,"");"fade"===i?e.fade=!0:"scale"===i&&(e.scale=!0)}return e},r}(t.renderer.OverlayLayerCanvasRenderer)),"undefined"!=typeof console&&console.log("maptalks.animatemarker v0.4.1, requires maptalks@>=0.25.0.");var wQ=function(){return f((function t(e,r,i){l(this,t),this.map=i;var o=r.color||[255,0,0],s=r.opacity||.8,a=r.width||20,u=r.height||20,h=r.animationDuration||3e3,c=r.markerDx||0,f=r.markerDy||0,p=n.GeoJSON.toGeometry(e);this.layer=new xQ(n.Util.GUID(),p,{animation:"scale,fade",animationDuration:h,randomAnimation:!0,geometryEvents:!1,hitDetect:!1}).setStyle([{symbol:{markerType:"ellipse",markerLineWidth:0,markerFill:this.getGradient(o),markerFillOpacity:s,markerWidth:a,markerHeight:u,markerDx:c,markerDy:f}}]).addTo(i)}),[{key:"getGradient",value:function(t){return{type:"radial",colorStops:[[.7,"rgba("+t.join()+", 0.5)"],[.3,"rgba("+t.join()+", 1)"],[.2,"rgba("+t.join()+", 1)"],[0,"rgba("+t.join()+", 0)"]]}}},{key:"hide",value:function(){var t;null===(t=this.layer)||void 0===t||t.hide()}},{key:"show",value:function(){this.layer.show()}},{key:"setZIndex",value:function(t){this.layer.setZIndex(t)}},{key:"dispose",value:function(){this.map.removeLayer(this.layer),delete this.layer}}])}();exports.Arrow3D=uN,exports.B3DMLoader=bB,exports.B3DMLoaderBase=CM,exports.BaseObject=H,exports.CMPTLoader=NB,exports.CMPTLoaderBase=OB,exports.CUSTOM_COLOR=9,exports.CesiumIonTilesRenderer=VL,exports.CoordinateTransform=gQ,exports.DEPTH=4,exports.DISTANCE=3,exports.DebugCesiumIonTilesRenderer=qL,exports.DebugGoogleTilesRenderer=zL,exports.DebugTilesRenderer=DP,exports.EffectComposer=NN,exports.Ellipsoid=xT,exports.EllipsoidRegion=PT,exports.EllipsoidRegionHelper=MP,exports.EllipsoidRegionLineHelper=SP,exports.EnvironmentControls=AR,exports.FAILED=4,exports.GEOMETRIC_ERROR=2,exports.GLTFCesiumRTCExtension=FB,exports.GLTFExtensionLoader=UB,exports.GLTFMeshFeaturesExtension=RL,exports.GLTFStructuralMetadataExtension=CL,exports.GeoUtils=uT,exports.GlobeControls=NR,exports.GoogleTilesRenderer=GL,exports.I3DMLoader=DB,exports.I3DMLoaderBase=SB,exports.IS_LEAF=6,exports.LOADED=3,exports.LOADING=1,exports.LOAD_ORDER=10,exports.LRUCache=rM,exports.Line2=XO,exports.LineGeometry=YO,exports.LineMaterial=IO,exports.LoaderBase=EM,exports.NONE=0,exports.PARSING=2,exports.PNTSLoader=CB,exports.PNTSLoaderBase=EB,exports.PriorityQueue=nM,exports.RANDOM_COLOR=7,exports.RANDOM_NODE_COLOR=8,exports.RELATIVE_DEPTH=5,exports.RenderPass=AF,exports.SCREEN_ERROR=1,exports.SphereHelper=_P,exports.TextureAnimator=TS,exports.TilesRenderer=vP,exports.TilesRendererBase=AM,exports.UNLOADED=0,exports.WGS84_ELLIPSOID=DL,exports.WGS84_FLATTENING=oM,exports.WGS84_HEIGHT=sM,exports.WGS84_RADIUS=iM,exports.bloomClass=kF,exports.bloomLine=IN,exports.calIntersection=aS,exports.calPointColor=cS,exports.drawTool=dQ,exports.extrudePolygon=xN,exports.getCenterOfPoints=ZC,exports.getCirGeojson=function(t,e,r,n,o){for(var s=o.map,a=o.coordinateToVector3([t,e],0),u=(new i.Matrix4).makeTranslation(a.x,a.y,0),l=o.distanceToVector3(r,r).x,h=[],c=0;c<=360;c++){var f=new i.Vector3(Math.sin(c*(Math.PI/180))*l,Math.cos(c*(Math.PI/180))*l,0);f=f.applyMatrix4(u);var p=s.pointAtResToCoord(f,s.getGLRes());h.push([p.x,p.y])}return{type:"FeatureCollection",name:"net",crs:{type:"name",properties:{name:"urn:ogc:def:crs:OGC:1.3:CRS84"}},features:[{type:"Feature",properties:{Id:0,color:n.color||"#fff"},geometry:{type:"MultiPolygon",coordinates:[[h]]}}]}},exports.getCirGeojson1=function(t,e,r,n,o){for(var s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,a=o.map,u=o.coordinateToVector3([t,e],0),l=(new i.Matrix4).makeTranslation(u.x,u.y,0),h=o.distanceToVector3(r,r).x,c=[],f=0;f<=360;f+=s){var p=new i.Vector3(Math.sin(f*(Math.PI/180))*h,Math.cos(f*(Math.PI/180))*h,0);p=p.applyMatrix4(l);var d=a.pointAtResToCoord(p,a.getGLRes());c.push([d.x,d.y])}return{type:"FeatureCollection",name:"net",crs:{type:"name",properties:{name:"urn:ogc:def:crs:OGC:1.3:CRS84"}},features:[{type:"Feature",properties:{Id:0,color:n.color||"#fff"},geometry:{type:"MultiPolygon",coordinates:[[c]]}}]}},exports.getPsByCircle=function(t,e,r,n,o){for(var s,a,u=[],l=o.map,h=o.coordinateToVector3([t,e],0),c=(new i.Matrix4).makeTranslation(h.x,h.y,0),f=o.distanceToVector3(r,r).x,p=0;p<=360;){var d=(a=void 0,a=0,(s=p)<=90?a=-s:s>90&&s<=180||s>180&&s<=270?a=180-s:s>270&&s<360&&(a=360-s),{rotation:a}),g=iS(p,f,c),y=l.pointAtResToCoord(g,l.getGLRes());u.push({coord:[y.x,y.y],rotation:d.rotation}),p+=n}return u},exports.getUUid=YC,exports.getVPointGeojson=sS,exports.gisCommon=OS,exports.gltfLoadClass=vD,exports.groupClass=mD,exports.imgClass=vS,exports.layerClass=fQ,exports.layerClassNoOverride=pQ,exports.line2Object=sN,exports.line2Polygon=function(t,e){for(var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:50,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:6,o=[],s=[],a=0;a<t.length-1;a++){var u=[],l=a+1,h=sS(t[a][0],t[a][1],t[l][0],t[l][1],r,0,e);u.push(h.features[0].geometry.coordinates[0][0][0]),u.push(h.features[0].geometry.coordinates[0][0][1]);var c=sS(t[l][0],t[l][1],t[a][0],t[a][1],r,0,e);u.push(c.features[0].geometry.coordinates[0][0][0]),u.push(c.features[0].geometry.coordinates[0][0][1]),u.push(h.features[0].geometry.coordinates[0][0][0]);var f={type:"FeatureCollection",features:[{type:"Feature",properties:{_draw_type:"line"},geometry:{type:"MultiPolygon",coordinates:[[u]]}}]};o.push(u);var p=new n.MultiPolygon(f.features[0].geometry.coordinates);s.push(p)}var d=[];d.push(o[0][0]),d.push(o[0][1]);for(var g=0;g<o.length-1;g++){var y=s[g],v=s[g+1],m=o[g],A=o[g+1],_=aS(y,v);if(uS(_,0===g?m[2]:A[1])){var x=hS(_,m,A,t,i);d.push(x)}else d.push(m[2]),d.push(A[1])}d.push(o[o.length-1][2]),d.push(o[o.length-1][3]);for(var w=o.length-1;w>0;w--){var b=s[w],E=s[w-1],I=o[w],C=o[w-1],S=aS(b,E);if(uS(S,I[4])){var M=hS(S,I,C,t,i);d.push(M)}else d.push(I[4]),d.push(C[3])}return d.push(o[0][0]),d},exports.line2Polygon1=function(t,e){for(var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:50,n=[],i=0;i<t.length-1;i++){var o=[],s=i+1,a=sS(t[i][0],t[i][1],t[s][0],t[s][1],r,0,e);o.push(a.features[0].geometry.coordinates[0][0][0]),o.push(a.features[0].geometry.coordinates[0][0][1]);var u=sS(t[s][0],t[s][1],t[i][0],t[i][1],r,0,e);o.push(u.features[0].geometry.coordinates[0][0][0]),o.push(u.features[0].geometry.coordinates[0][0][1]),o.push(a.features[0].geometry.coordinates[0][0][0]),n.push(o)}return n},exports.lineLength=nS,exports.outlineBloomClass=PF,exports.overLayer=yQ,exports.planeGifClass=eN,exports.planeHeightClass=OF,exports.planeMark=ZS,exports.planeSectorClass=kS,exports.polygonClass=mN,exports.polylineClass=CO,exports.pyramidClass=sQ,exports.radarClass=_S,exports.rippleWallClass=_O,exports.sectorClass=SS,exports.shockClass=RS,exports.shockMarkerClass=wQ,exports.sleep=XC,exports.tileClass=dD,exports.tripHeight=lN,exports.tripHeight1=hN,exports.tripLineClass=cN,exports.tubeClass=iN,exports.turf=zC,exports.verticalFatLineClass=ZO,exports.wallClass=xO;
194
+ */function vQ(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function mQ(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function AQ(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):function(t,e){for(var r=Object.getOwnPropertyNames(e),n=0;n<r.length;n++){var i=r[n],o=Object.getOwnPropertyDescriptor(e,i);o&&o.configurable&&void 0===t[i]&&Object.defineProperty(t,i,o)}}(t,e))}var _Q={markerType:"ellipse",markerFill:function(t){return{type:"radial",colorStops:[[.7,"rgba("+t.join()+", 0.5)"],[.3,"rgba("+t.join()+", 1)"],[.2,"rgba("+t.join()+", 1)"],[0,"rgba("+t.join()+", 0)"]]}}([135,196,240]),markerFillOpacity:.8,markerLineWidth:0,markerWidth:16,markerHeight:16},xQ=function(e){function r(){return vQ(this,r),mQ(this,e.apply(this,arguments))}return AQ(r,e),r.prototype.addGeometry=function(r){return r instanceof t.Geometry&&(r=[r]),r.forEach((function(e,r){if(!(e instanceof t.Marker))throw new Error("The geometry at "+r+" to add is not a maptalks.Marker")})),e.prototype.addGeometry.apply(this,arguments)},r.fromJSON=function(e){if(!e||"AnimateMarkerLayer"!==e.type)return null;for(var n=new r(e.id,e.options),i=e.geometries,o=[],s=0;s<i.length;s++){var a=t.Geometry.fromJSON(i[s]);a&&o.push(a)}return n.addGeometry(o),e.style&&n.setStyle(e.style),n},r}(t.VectorLayer);xQ.mergeOptions({animation:"scale,fade",randomAnimation:!0,animationDuration:3e3}),xQ.registerJSONType("AnimateMarkerLayer"),xQ.registerRenderer("canvas",function(e){function r(){return vQ(this,r),mQ(this,e.apply(this,arguments))}return AQ(r,e),r.prototype.draw=function(){this._needUpdate&&(this._prepare(),this._needUpdate=!1),this.prepareCanvas();var t=this.getMap(),e=this._currentMarkers;this._drawnExtent&&t.getExtent().equals(this._drawnExtent)&&(e=this._drawnMarkers),this._drawAllMarkers(e),this._drawnExtent=t.getExtent(),this.layer.isLoaded()||this.completeRender()},r.prototype.drawOnInteracting=function(){this._drawnMarkers&&0!==this._drawnMarkers.length&&this._drawAllMarkers(this._drawnMarkers)},r.prototype.needToRedraw=function(){return!!this.layer.options.animation||e.prototype.needToRedraw.call(this)},r.prototype.onCanvasCreate=function(){this._prepare()},r.prototype.onGeometryAdd=function(){this._redraw()},r.prototype.onGeometryRemove=function(){this._redraw()},r.prototype.onGeometrySymbolChange=function(){this._redraw()},r.prototype.onGeometryPositionChange=function(){this._redraw()},r.prototype.onGeometryShow=function(){this._redraw()},r.prototype.onGeometryHide=function(){this._redraw()},r.prototype.onGeometryPropertiesChange=function(t){if(t&&this.layer.getStyle())for(var e=0;e<t.length;e++)this.layer._styleGeometry(t[e])},r.prototype._redraw=function(){delete this._drawnMarkers,delete this._drawnExtent,this._needUpdate=!0},r.prototype._drawAllMarkers=function(t){var e=this,r=this.getMap(),n=r.getContainerExtent(),i=this._drawnTime=Date.now(),o=this._drawnAnim=this._getAnimation(),s=t!==this._drawnMarkers;s&&(this._drawnMarkers=[]),t.forEach((function(t){if(s){if(t.g.isVisible()){var a=r._prjToContainerPoint(t.coordinates);n.contains(a)&&(e._drawMarker(t,a,o,i),e._drawnMarkers.push(t))}}else{var u=r._prjToContainerPoint(t.coordinates);e._drawMarker(t,u,o,i)}}),this)},r.prototype._drawMarker=function(t,e,r,n){var i=this.layer.options.animationDuration,o=this.context,s=o.globalAlpha,a=(n-t.start)%i/i,u=r.fade&&a>=.5?2-2*a:1,l=r.scale?a:1,h=t.cacheKey,c=this._spriteCache[h],f=c.offset,p=c.canvas.width,d=c.canvas.height;c&&u>0&&(o.globalAlpha=s*u,o.drawImage(c.canvas,e.x+f.x-p*l/2,e.y+f.y-d*l/2,p*l,d*l),o.globalAlpha=s)},r.prototype._prepare=function(){var t=this,e=[],r={},n=this.getMap().getProjection();this.layer.forEach((function(i){t._currentGeo=i;var o=i._getInternalSymbol()===i.options.symbol?_Q:i._getInternalSymbol(),s=JSON.stringify(o);r[s]||(r[s]=o),e.push({coordinates:n.project(i.getCoordinates()),cacheKey:s,start:t.layer.options.randomAnimation?Math.random()*t.layer.options.animationDuration:0,g:i})})),this._prepareSprites(r),this._currentMarkers=e},r.prototype._prepareSprites=function(e){for(var r in this._spriteCache={},e){var n=e[r],i=new t.Marker([0,0],{symbol:n})._getSprite(this.resources);this._spriteCache[r]=i}},r.prototype.onRemove=function(){delete this._spriteCache,delete this._currentMarkers,delete this._drawnMarkers,delete this._drawnExtent},r.prototype._getAnimation=function(){for(var t,e={fade:!1,scale:!1},r=this.layer.options.animation?this.layer.options.animation.split(","):[],n=0;n<r.length;n++){var i=(t=r[n]).trim?t.trim():t.replace(/^\s+|\s+$/g,"");"fade"===i?e.fade=!0:"scale"===i&&(e.scale=!0)}return e},r}(t.renderer.OverlayLayerCanvasRenderer)),"undefined"!=typeof console&&console.log("maptalks.animatemarker v0.4.1, requires maptalks@>=0.25.0.");var wQ=function(){return f((function t(e,r,i){l(this,t),this.map=i;var o=r.color||[255,0,0],s=r.opacity||.8,a=r.width||20,u=r.height||20,h=r.animationDuration||3e3,c=r.markerDx||0,f=r.markerDy||0,p=n.GeoJSON.toGeometry(e);this.layer=new xQ(n.Util.GUID(),p,{animation:"scale,fade",animationDuration:h,randomAnimation:!0,geometryEvents:!1,hitDetect:!1}).setStyle([{symbol:{markerType:"ellipse",markerLineWidth:0,markerFill:this.getGradient(o),markerFillOpacity:s,markerWidth:a,markerHeight:u,markerDx:c,markerDy:f}}]).addTo(i)}),[{key:"getGradient",value:function(t){return{type:"radial",colorStops:[[.7,"rgba("+t.join()+", 0.5)"],[.3,"rgba("+t.join()+", 1)"],[.2,"rgba("+t.join()+", 1)"],[0,"rgba("+t.join()+", 0)"]]}}},{key:"hide",value:function(){var t;null===(t=this.layer)||void 0===t||t.hide()}},{key:"show",value:function(){this.layer.show()}},{key:"setZIndex",value:function(t){this.layer.setZIndex(t)}},{key:"dispose",value:function(){this.map.removeLayer(this.layer),delete this.layer}}])}(),bQ=function(){return f((function t(e,r,n){l(this,t),this.threeLayer=e.threeLayer,this.layerClass=r,this.map=n,this.x=e.x,this.y=e.y,this.z=e.z,this.rateX=(null==e?void 0:e.rateX)||.5,this.rateY=(null==e?void 0:e.rateY)||.5;var i=this.threeLayer.distanceToVector3(this.z,this.z).x;this.vector=this.threeLayer.coordinateToVector3([this.x,this.y],i),this.camera=this.threeLayer.getCamera(),this.render=this.threeLayer.getRenderer().context,this.canvas=this.render.domElement,this.layerClass.updatables.push(this)}),[{key:"tick",value:function(t){var e;if("none"!==(null===(e=this._container)||void 0===e||null===(e=e.style)||void 0===e?void 0:e.display)){var r=this.vector.clone();r.project(this.camera),r.x=Math.round((this.rateX+r.x/2)*(this.canvas.width/window.devicePixelRatio)),r.y=Math.round((this.rateY-r.y/2)*(this.canvas.height/window.devicePixelRatio)),this._container.style.top="".concat(r.y,"px"),this._container.style.left="".concat(r.x,"px")}}},{key:"setContent",value:function(t){if(!this._container){var e=this._container=n.DomUtil.createEl("div",n.Util.GUID());e.style.cssText="position:absolute;",this.map._panels.frontStatic.appendChild(e),e.style.display="none"}this._container.innerHTML=t}},{key:"changeRate",value:function(t,e){this.rateX=t,this.rateY=e}},{key:"show",value:function(){this._container.style.display=""}},{key:"hide",value:function(){this._container.style.display="none"}},{key:"removeAnimation",value:function(){var t=this.layerClass.updatables.indexOf(this);t>-1&&this.layerClass.updatables.splice(t,1)}},{key:"dispose",value:function(){this.removeAnimation(),this.map._panels.frontStatic.removeChild(this._container)}}])}();exports.Arrow3D=uN,exports.B3DMLoader=bB,exports.B3DMLoaderBase=CM,exports.BaseObject=H,exports.CMPTLoader=NB,exports.CMPTLoaderBase=OB,exports.CUSTOM_COLOR=9,exports.CesiumIonTilesRenderer=VL,exports.CoordinateTransform=gQ,exports.DEPTH=4,exports.DISTANCE=3,exports.DebugCesiumIonTilesRenderer=qL,exports.DebugGoogleTilesRenderer=zL,exports.DebugTilesRenderer=DP,exports.EffectComposer=NN,exports.Ellipsoid=xT,exports.EllipsoidRegion=PT,exports.EllipsoidRegionHelper=MP,exports.EllipsoidRegionLineHelper=SP,exports.EnvironmentControls=AR,exports.FAILED=4,exports.GEOMETRIC_ERROR=2,exports.GLTFCesiumRTCExtension=FB,exports.GLTFExtensionLoader=UB,exports.GLTFMeshFeaturesExtension=RL,exports.GLTFStructuralMetadataExtension=CL,exports.GeoUtils=uT,exports.GlobeControls=NR,exports.GoogleTilesRenderer=GL,exports.I3DMLoader=DB,exports.I3DMLoaderBase=SB,exports.IS_LEAF=6,exports.LOADED=3,exports.LOADING=1,exports.LOAD_ORDER=10,exports.LRUCache=rM,exports.Line2=XO,exports.LineGeometry=YO,exports.LineMaterial=IO,exports.LoaderBase=EM,exports.NONE=0,exports.PARSING=2,exports.PNTSLoader=CB,exports.PNTSLoaderBase=EB,exports.PriorityQueue=nM,exports.RANDOM_COLOR=7,exports.RANDOM_NODE_COLOR=8,exports.RELATIVE_DEPTH=5,exports.RenderPass=AF,exports.SCREEN_ERROR=1,exports.SimpleInfoWindow=bQ,exports.SphereHelper=_P,exports.TextureAnimator=TS,exports.ThreeLayer=Bo,exports.ThreeRenderer=ko,exports.TilesRenderer=vP,exports.TilesRendererBase=AM,exports.UNLOADED=0,exports.WGS84_ELLIPSOID=DL,exports.WGS84_FLATTENING=oM,exports.WGS84_HEIGHT=sM,exports.WGS84_RADIUS=iM,exports.bloomClass=kF,exports.bloomLine=IN,exports.calIntersection=aS,exports.calPointColor=cS,exports.drawTool=dQ,exports.extrudePolygon=xN,exports.getCenterOfPoints=ZC,exports.getCirGeojson=function(t,e,r,n,o){for(var s=o.map,a=o.coordinateToVector3([t,e],0),u=(new i.Matrix4).makeTranslation(a.x,a.y,0),l=o.distanceToVector3(r,r).x,h=[],c=0;c<=360;c++){var f=new i.Vector3(Math.sin(c*(Math.PI/180))*l,Math.cos(c*(Math.PI/180))*l,0);f=f.applyMatrix4(u);var p=s.pointAtResToCoord(f,s.getGLRes());h.push([p.x,p.y])}return{type:"FeatureCollection",name:"net",crs:{type:"name",properties:{name:"urn:ogc:def:crs:OGC:1.3:CRS84"}},features:[{type:"Feature",properties:{Id:0,color:n.color||"#fff"},geometry:{type:"MultiPolygon",coordinates:[[h]]}}]}},exports.getCirGeojson1=function(t,e,r,n,o){for(var s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,a=o.map,u=o.coordinateToVector3([t,e],0),l=(new i.Matrix4).makeTranslation(u.x,u.y,0),h=o.distanceToVector3(r,r).x,c=[],f=0;f<=360;f+=s){var p=new i.Vector3(Math.sin(f*(Math.PI/180))*h,Math.cos(f*(Math.PI/180))*h,0);p=p.applyMatrix4(l);var d=a.pointAtResToCoord(p,a.getGLRes());c.push([d.x,d.y])}return{type:"FeatureCollection",name:"net",crs:{type:"name",properties:{name:"urn:ogc:def:crs:OGC:1.3:CRS84"}},features:[{type:"Feature",properties:{Id:0,color:n.color||"#fff"},geometry:{type:"MultiPolygon",coordinates:[[c]]}}]}},exports.getPsByCircle=function(t,e,r,n,o){for(var s,a,u=[],l=o.map,h=o.coordinateToVector3([t,e],0),c=(new i.Matrix4).makeTranslation(h.x,h.y,0),f=o.distanceToVector3(r,r).x,p=0;p<=360;){var d=(a=void 0,a=0,(s=p)<=90?a=-s:s>90&&s<=180||s>180&&s<=270?a=180-s:s>270&&s<360&&(a=360-s),{rotation:a}),g=iS(p,f,c),y=l.pointAtResToCoord(g,l.getGLRes());u.push({coord:[y.x,y.y],rotation:d.rotation}),p+=n}return u},exports.getUUid=YC,exports.getVPointGeojson=sS,exports.gisCommon=OS,exports.gltfLoadClass=vD,exports.groupClass=mD,exports.imgClass=vS,exports.layerClass=fQ,exports.layerClassNoOverride=pQ,exports.line2Object=sN,exports.line2Polygon=function(t,e){for(var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:50,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:6,o=[],s=[],a=0;a<t.length-1;a++){var u=[],l=a+1,h=sS(t[a][0],t[a][1],t[l][0],t[l][1],r,0,e);u.push(h.features[0].geometry.coordinates[0][0][0]),u.push(h.features[0].geometry.coordinates[0][0][1]);var c=sS(t[l][0],t[l][1],t[a][0],t[a][1],r,0,e);u.push(c.features[0].geometry.coordinates[0][0][0]),u.push(c.features[0].geometry.coordinates[0][0][1]),u.push(h.features[0].geometry.coordinates[0][0][0]);var f={type:"FeatureCollection",features:[{type:"Feature",properties:{_draw_type:"line"},geometry:{type:"MultiPolygon",coordinates:[[u]]}}]};o.push(u);var p=new n.MultiPolygon(f.features[0].geometry.coordinates);s.push(p)}var d=[];d.push(o[0][0]),d.push(o[0][1]);for(var g=0;g<o.length-1;g++){var y=s[g],v=s[g+1],m=o[g],A=o[g+1],_=aS(y,v);if(uS(_,0===g?m[2]:A[1])){var x=hS(_,m,A,t,i);d.push(x)}else d.push(m[2]),d.push(A[1])}d.push(o[o.length-1][2]),d.push(o[o.length-1][3]);for(var w=o.length-1;w>0;w--){var b=s[w],E=s[w-1],I=o[w],C=o[w-1],S=aS(b,E);if(uS(S,I[4])){var M=hS(S,I,C,t,i);d.push(M)}else d.push(I[4]),d.push(C[3])}return d.push(o[0][0]),d},exports.line2Polygon1=function(t,e){for(var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:50,n=[],i=0;i<t.length-1;i++){var o=[],s=i+1,a=sS(t[i][0],t[i][1],t[s][0],t[s][1],r,0,e);o.push(a.features[0].geometry.coordinates[0][0][0]),o.push(a.features[0].geometry.coordinates[0][0][1]);var u=sS(t[s][0],t[s][1],t[i][0],t[i][1],r,0,e);o.push(u.features[0].geometry.coordinates[0][0][0]),o.push(u.features[0].geometry.coordinates[0][0][1]),o.push(a.features[0].geometry.coordinates[0][0][0]),n.push(o)}return n},exports.lineLength=nS,exports.outlineBloomClass=PF,exports.overLayer=yQ,exports.planeGifClass=eN,exports.planeHeightClass=OF,exports.planeMark=ZS,exports.planeSectorClass=kS,exports.polygonClass=mN,exports.polylineClass=CO,exports.pyramidClass=sQ,exports.radarClass=_S,exports.rippleWallClass=_O,exports.sectorClass=SS,exports.shockClass=RS,exports.shockMarkerClass=wQ,exports.sleep=XC,exports.tileClass=dD,exports.tripHeight=lN,exports.tripHeight1=hN,exports.tripLineClass=cN,exports.tubeClass=iN,exports.turf=zC,exports.verticalFatLineClass=ZO,exports.wallClass=xO;
@@ -191,4 +191,4 @@ Original MIT license applies
191
191
  * maptalks.animatemarker v0.4.1
192
192
  * LICENSE : MIT
193
193
  * (c) 2016-2017 maptalks.org
194
- */function Mj(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Bj(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function Tj(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):function(t,e){for(var n=Object.getOwnPropertyNames(e),r=0;r<n.length;r++){var i=n[r],o=Object.getOwnPropertyDescriptor(e,i);o&&o.configurable&&void 0===t[i]&&Object.defineProperty(t,i,o)}}(t,e))}var kj={markerType:"ellipse",markerFill:function(t){return{type:"radial",colorStops:[[.7,"rgba("+t.join()+", 0.5)"],[.3,"rgba("+t.join()+", 1)"],[.2,"rgba("+t.join()+", 1)"],[0,"rgba("+t.join()+", 0)"]]}}([135,196,240]),markerFillOpacity:.8,markerLineWidth:0,markerWidth:16,markerHeight:16},Pj=function(t){function r(){return Mj(this,r),Bj(this,t.apply(this,arguments))}return Tj(r,t),r.prototype.addGeometry=function(r){return r instanceof n&&(r=[r]),r.forEach((function(t,n){if(!(t instanceof e))throw new Error("The geometry at "+n+" to add is not a maptalks.Marker")})),t.prototype.addGeometry.apply(this,arguments)},r.fromJSON=function(t){if(!t||"AnimateMarkerLayer"!==t.type)return null;for(var e=new r(t.id,t.options),i=t.geometries,o=[],s=0;s<i.length;s++){var a=n.fromJSON(i[s]);a&&o.push(a)}return e.addGeometry(o),t.style&&e.setStyle(t.style),e},r}(r);Pj.mergeOptions({animation:"scale,fade",randomAnimation:!0,animationDuration:3e3}),Pj.registerJSONType("AnimateMarkerLayer"),Pj.registerRenderer("canvas",function(t){function n(){return Mj(this,n),Bj(this,t.apply(this,arguments))}return Tj(n,t),n.prototype.draw=function(){this._needUpdate&&(this._prepare(),this._needUpdate=!1),this.prepareCanvas();var t=this.getMap(),e=this._currentMarkers;this._drawnExtent&&t.getExtent().equals(this._drawnExtent)&&(e=this._drawnMarkers),this._drawAllMarkers(e),this._drawnExtent=t.getExtent(),this.layer.isLoaded()||this.completeRender()},n.prototype.drawOnInteracting=function(){this._drawnMarkers&&0!==this._drawnMarkers.length&&this._drawAllMarkers(this._drawnMarkers)},n.prototype.needToRedraw=function(){return!!this.layer.options.animation||t.prototype.needToRedraw.call(this)},n.prototype.onCanvasCreate=function(){this._prepare()},n.prototype.onGeometryAdd=function(){this._redraw()},n.prototype.onGeometryRemove=function(){this._redraw()},n.prototype.onGeometrySymbolChange=function(){this._redraw()},n.prototype.onGeometryPositionChange=function(){this._redraw()},n.prototype.onGeometryShow=function(){this._redraw()},n.prototype.onGeometryHide=function(){this._redraw()},n.prototype.onGeometryPropertiesChange=function(t){if(t&&this.layer.getStyle())for(var e=0;e<t.length;e++)this.layer._styleGeometry(t[e])},n.prototype._redraw=function(){delete this._drawnMarkers,delete this._drawnExtent,this._needUpdate=!0},n.prototype._drawAllMarkers=function(t){var e=this,n=this.getMap(),r=n.getContainerExtent(),i=this._drawnTime=Date.now(),o=this._drawnAnim=this._getAnimation(),s=t!==this._drawnMarkers;s&&(this._drawnMarkers=[]),t.forEach((function(t){if(s){if(t.g.isVisible()){var a=n._prjToContainerPoint(t.coordinates);r.contains(a)&&(e._drawMarker(t,a,o,i),e._drawnMarkers.push(t))}}else{var u=n._prjToContainerPoint(t.coordinates);e._drawMarker(t,u,o,i)}}),this)},n.prototype._drawMarker=function(t,e,n,r){var i=this.layer.options.animationDuration,o=this.context,s=o.globalAlpha,a=(r-t.start)%i/i,u=n.fade&&a>=.5?2-2*a:1,l=n.scale?a:1,h=t.cacheKey,c=this._spriteCache[h],f=c.offset,p=c.canvas.width,d=c.canvas.height;c&&u>0&&(o.globalAlpha=s*u,o.drawImage(c.canvas,e.x+f.x-p*l/2,e.y+f.y-d*l/2,p*l,d*l),o.globalAlpha=s)},n.prototype._prepare=function(){var t=this,e=[],n={},r=this.getMap().getProjection();this.layer.forEach((function(i){t._currentGeo=i;var o=i._getInternalSymbol()===i.options.symbol?kj:i._getInternalSymbol(),s=JSON.stringify(o);n[s]||(n[s]=o),e.push({coordinates:r.project(i.getCoordinates()),cacheKey:s,start:t.layer.options.randomAnimation?Math.random()*t.layer.options.animationDuration:0,g:i})})),this._prepareSprites(n),this._currentMarkers=e},n.prototype._prepareSprites=function(t){for(var n in this._spriteCache={},t){var r=t[n],i=new e([0,0],{symbol:r})._getSprite(this.resources);this._spriteCache[n]=i}},n.prototype.onRemove=function(){delete this._spriteCache,delete this._currentMarkers,delete this._drawnMarkers,delete this._drawnExtent},n.prototype._getAnimation=function(){for(var t,e={fade:!1,scale:!1},n=this.layer.options.animation?this.layer.options.animation.split(","):[],r=0;r<n.length;r++){var i=(t=n[r]).trim?t.trim():t.replace(/^\s+|\s+$/g,"");"fade"===i?e.fade=!0:"scale"===i&&(e.scale=!0)}return e},n}(i.OverlayLayerCanvasRenderer)),"undefined"!=typeof console&&console.log("maptalks.animatemarker v0.4.1, requires maptalks@>=0.25.0.");var Lj=function(){return rn((function e(n,r,i){tn(this,e),this.map=i;var o=r.color||[255,0,0],s=r.opacity||.8,a=r.width||20,u=r.height||20,l=r.animationDuration||3e3,h=r.markerDx||0,c=r.markerDy||0,f=t.GeoJSON.toGeometry(n);this.layer=new Pj(t.Util.GUID(),f,{animation:"scale,fade",animationDuration:l,randomAnimation:!0,geometryEvents:!1,hitDetect:!1}).setStyle([{symbol:{markerType:"ellipse",markerLineWidth:0,markerFill:this.getGradient(o),markerFillOpacity:s,markerWidth:a,markerHeight:u,markerDx:h,markerDy:c}}]).addTo(i)}),[{key:"getGradient",value:function(t){return{type:"radial",colorStops:[[.7,"rgba("+t.join()+", 0.5)"],[.3,"rgba("+t.join()+", 1)"],[.2,"rgba("+t.join()+", 1)"],[0,"rgba("+t.join()+", 0)"]]}}},{key:"hide",value:function(){var t;null===(t=this.layer)||void 0===t||t.hide()}},{key:"show",value:function(){this.layer.show()}},{key:"setZIndex",value:function(t){this.layer.setZIndex(t)}},{key:"dispose",value:function(){this.map.removeLayer(this.layer),delete this.layer}}])}();export{AQ as Arrow3D,EP as B3DMLoader,Sk as B3DMLoaderBase,Fn as BaseObject,FP as CMPTLoader,NP as CMPTLoaderBase,VD as CUSTOM_COLOR,eN as CesiumIonTilesRenderer,Cj as CoordinateTransform,UD as DEPTH,FD as DISTANCE,nN as DebugCesiumIonTilesRenderer,$O as DebugGoogleTilesRenderer,WD as DebugTilesRenderer,YQ as EffectComposer,wL as Ellipsoid,LL as EllipsoidRegion,BD as EllipsoidRegionHelper,MD as EllipsoidRegionLineHelper,TN as EnvironmentControls,ik as FAILED,ND as GEOMETRIC_ERROR,UP as GLTFCesiumRTCExtension,QP as GLTFExtensionLoader,qO as GLTFMeshFeaturesExtension,NO as GLTFStructuralMetadataExtension,lL as GeoUtils,YN as GlobeControls,ZO as GoogleTilesRenderer,OP as I3DMLoader,MP as I3DMLoaderBase,GD as IS_LEAF,rk as LOADED,ek as LOADING,qD as LOAD_ORDER,ZT as LRUCache,sQ as Line2,oQ as LineGeometry,OU as LineMaterial,Ik as LoaderBase,DD as NONE,nk as PARSING,SP as PNTSLoader,IP as PNTSLoaderBase,$T as PriorityQueue,zD as RANDOM_COLOR,jD as RANDOM_NODE_COLOR,QD as RELATIVE_DEPTH,TG as RenderPass,OD as SCREEN_ERROR,xD as SphereHelper,CT as TextureAnimator,mD as TilesRenderer,_k as TilesRendererBase,tk as UNLOADED,HO as WGS84_ELLIPSOID,sk as WGS84_FLATTENING,ak as WGS84_HEIGHT,ok as WGS84_RADIUS,zG as bloomClass,OQ as bloomLine,eT as calIntersection,aT as calPointColor,Ij as drawTool,PQ as extrudePolygon,jB as getCenterOfPoints,KB as getCirGeojson,ZB as getCirGeojson1,JB as getPsByCircle,UB as getUUid,tT as getVPointGeojson,PT as gisCommon,MF as gltfLoadClass,BF as groupClass,pT as imgClass,bj as layerClass,Ej as layerClassNoOverride,vQ as line2Object,sT as line2Polygon,oT as line2Polygon1,YB as lineLength,jG as outlineBloomClass,Sj as overLayer,fQ as planeGifClass,WG as planeHeightClass,YT as planeMark,ST as planeSectorClass,BQ as polygonClass,NU as polylineClass,vj as pyramidClass,yT as radarClass,kU as rippleWallClass,bT as sectorClass,TT as shockClass,Lj as shockMarkerClass,QB as sleep,IF as tileClass,_Q as tripHeight,xQ as tripHeight1,wQ as tripLineClass,gQ as tubeClass,LB as turf,lQ as verticalFatLineClass,PU as wallClass};
194
+ */function Mj(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Bj(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function Tj(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):function(t,e){for(var n=Object.getOwnPropertyNames(e),r=0;r<n.length;r++){var i=n[r],o=Object.getOwnPropertyDescriptor(e,i);o&&o.configurable&&void 0===t[i]&&Object.defineProperty(t,i,o)}}(t,e))}var kj={markerType:"ellipse",markerFill:function(t){return{type:"radial",colorStops:[[.7,"rgba("+t.join()+", 0.5)"],[.3,"rgba("+t.join()+", 1)"],[.2,"rgba("+t.join()+", 1)"],[0,"rgba("+t.join()+", 0)"]]}}([135,196,240]),markerFillOpacity:.8,markerLineWidth:0,markerWidth:16,markerHeight:16},Pj=function(t){function r(){return Mj(this,r),Bj(this,t.apply(this,arguments))}return Tj(r,t),r.prototype.addGeometry=function(r){return r instanceof n&&(r=[r]),r.forEach((function(t,n){if(!(t instanceof e))throw new Error("The geometry at "+n+" to add is not a maptalks.Marker")})),t.prototype.addGeometry.apply(this,arguments)},r.fromJSON=function(t){if(!t||"AnimateMarkerLayer"!==t.type)return null;for(var e=new r(t.id,t.options),i=t.geometries,o=[],s=0;s<i.length;s++){var a=n.fromJSON(i[s]);a&&o.push(a)}return e.addGeometry(o),t.style&&e.setStyle(t.style),e},r}(r);Pj.mergeOptions({animation:"scale,fade",randomAnimation:!0,animationDuration:3e3}),Pj.registerJSONType("AnimateMarkerLayer"),Pj.registerRenderer("canvas",function(t){function n(){return Mj(this,n),Bj(this,t.apply(this,arguments))}return Tj(n,t),n.prototype.draw=function(){this._needUpdate&&(this._prepare(),this._needUpdate=!1),this.prepareCanvas();var t=this.getMap(),e=this._currentMarkers;this._drawnExtent&&t.getExtent().equals(this._drawnExtent)&&(e=this._drawnMarkers),this._drawAllMarkers(e),this._drawnExtent=t.getExtent(),this.layer.isLoaded()||this.completeRender()},n.prototype.drawOnInteracting=function(){this._drawnMarkers&&0!==this._drawnMarkers.length&&this._drawAllMarkers(this._drawnMarkers)},n.prototype.needToRedraw=function(){return!!this.layer.options.animation||t.prototype.needToRedraw.call(this)},n.prototype.onCanvasCreate=function(){this._prepare()},n.prototype.onGeometryAdd=function(){this._redraw()},n.prototype.onGeometryRemove=function(){this._redraw()},n.prototype.onGeometrySymbolChange=function(){this._redraw()},n.prototype.onGeometryPositionChange=function(){this._redraw()},n.prototype.onGeometryShow=function(){this._redraw()},n.prototype.onGeometryHide=function(){this._redraw()},n.prototype.onGeometryPropertiesChange=function(t){if(t&&this.layer.getStyle())for(var e=0;e<t.length;e++)this.layer._styleGeometry(t[e])},n.prototype._redraw=function(){delete this._drawnMarkers,delete this._drawnExtent,this._needUpdate=!0},n.prototype._drawAllMarkers=function(t){var e=this,n=this.getMap(),r=n.getContainerExtent(),i=this._drawnTime=Date.now(),o=this._drawnAnim=this._getAnimation(),s=t!==this._drawnMarkers;s&&(this._drawnMarkers=[]),t.forEach((function(t){if(s){if(t.g.isVisible()){var a=n._prjToContainerPoint(t.coordinates);r.contains(a)&&(e._drawMarker(t,a,o,i),e._drawnMarkers.push(t))}}else{var u=n._prjToContainerPoint(t.coordinates);e._drawMarker(t,u,o,i)}}),this)},n.prototype._drawMarker=function(t,e,n,r){var i=this.layer.options.animationDuration,o=this.context,s=o.globalAlpha,a=(r-t.start)%i/i,u=n.fade&&a>=.5?2-2*a:1,l=n.scale?a:1,h=t.cacheKey,c=this._spriteCache[h],f=c.offset,p=c.canvas.width,d=c.canvas.height;c&&u>0&&(o.globalAlpha=s*u,o.drawImage(c.canvas,e.x+f.x-p*l/2,e.y+f.y-d*l/2,p*l,d*l),o.globalAlpha=s)},n.prototype._prepare=function(){var t=this,e=[],n={},r=this.getMap().getProjection();this.layer.forEach((function(i){t._currentGeo=i;var o=i._getInternalSymbol()===i.options.symbol?kj:i._getInternalSymbol(),s=JSON.stringify(o);n[s]||(n[s]=o),e.push({coordinates:r.project(i.getCoordinates()),cacheKey:s,start:t.layer.options.randomAnimation?Math.random()*t.layer.options.animationDuration:0,g:i})})),this._prepareSprites(n),this._currentMarkers=e},n.prototype._prepareSprites=function(t){for(var n in this._spriteCache={},t){var r=t[n],i=new e([0,0],{symbol:r})._getSprite(this.resources);this._spriteCache[n]=i}},n.prototype.onRemove=function(){delete this._spriteCache,delete this._currentMarkers,delete this._drawnMarkers,delete this._drawnExtent},n.prototype._getAnimation=function(){for(var t,e={fade:!1,scale:!1},n=this.layer.options.animation?this.layer.options.animation.split(","):[],r=0;r<n.length;r++){var i=(t=n[r]).trim?t.trim():t.replace(/^\s+|\s+$/g,"");"fade"===i?e.fade=!0:"scale"===i&&(e.scale=!0)}return e},n}(i.OverlayLayerCanvasRenderer)),"undefined"!=typeof console&&console.log("maptalks.animatemarker v0.4.1, requires maptalks@>=0.25.0.");var Lj=function(){return rn((function e(n,r,i){tn(this,e),this.map=i;var o=r.color||[255,0,0],s=r.opacity||.8,a=r.width||20,u=r.height||20,l=r.animationDuration||3e3,h=r.markerDx||0,c=r.markerDy||0,f=t.GeoJSON.toGeometry(n);this.layer=new Pj(t.Util.GUID(),f,{animation:"scale,fade",animationDuration:l,randomAnimation:!0,geometryEvents:!1,hitDetect:!1}).setStyle([{symbol:{markerType:"ellipse",markerLineWidth:0,markerFill:this.getGradient(o),markerFillOpacity:s,markerWidth:a,markerHeight:u,markerDx:h,markerDy:c}}]).addTo(i)}),[{key:"getGradient",value:function(t){return{type:"radial",colorStops:[[.7,"rgba("+t.join()+", 0.5)"],[.3,"rgba("+t.join()+", 1)"],[.2,"rgba("+t.join()+", 1)"],[0,"rgba("+t.join()+", 0)"]]}}},{key:"hide",value:function(){var t;null===(t=this.layer)||void 0===t||t.hide()}},{key:"show",value:function(){this.layer.show()}},{key:"setZIndex",value:function(t){this.layer.setZIndex(t)}},{key:"dispose",value:function(){this.map.removeLayer(this.layer),delete this.layer}}])}(),Rj=function(){return rn((function t(e,n,r){tn(this,t),this.threeLayer=e.threeLayer,this.layerClass=n,this.map=r,this.x=e.x,this.y=e.y,this.z=e.z,this.rateX=(null==e?void 0:e.rateX)||.5,this.rateY=(null==e?void 0:e.rateY)||.5;var i=this.threeLayer.distanceToVector3(this.z,this.z).x;this.vector=this.threeLayer.coordinateToVector3([this.x,this.y],i),this.camera=this.threeLayer.getCamera(),this.render=this.threeLayer.getRenderer().context,this.canvas=this.render.domElement,this.layerClass.updatables.push(this)}),[{key:"tick",value:function(t){var e;if("none"!==(null===(e=this._container)||void 0===e||null===(e=e.style)||void 0===e?void 0:e.display)){var n=this.vector.clone();n.project(this.camera),n.x=Math.round((this.rateX+n.x/2)*(this.canvas.width/window.devicePixelRatio)),n.y=Math.round((this.rateY-n.y/2)*(this.canvas.height/window.devicePixelRatio)),this._container.style.top="".concat(n.y,"px"),this._container.style.left="".concat(n.x,"px")}}},{key:"setContent",value:function(e){if(!this._container){var n=this._container=t.DomUtil.createEl("div",t.Util.GUID());n.style.cssText="position:absolute;",this.map._panels.frontStatic.appendChild(n),n.style.display="none"}this._container.innerHTML=e}},{key:"changeRate",value:function(t,e){this.rateX=t,this.rateY=e}},{key:"show",value:function(){this._container.style.display=""}},{key:"hide",value:function(){this._container.style.display="none"}},{key:"removeAnimation",value:function(){var t=this.layerClass.updatables.indexOf(this);t>-1&&this.layerClass.updatables.splice(t,1)}},{key:"dispose",value:function(){this.removeAnimation(),this.map._panels.frontStatic.removeChild(this._container)}}])}();export{AQ as Arrow3D,EP as B3DMLoader,Sk as B3DMLoaderBase,Fn as BaseObject,FP as CMPTLoader,NP as CMPTLoaderBase,VD as CUSTOM_COLOR,eN as CesiumIonTilesRenderer,Cj as CoordinateTransform,UD as DEPTH,FD as DISTANCE,nN as DebugCesiumIonTilesRenderer,$O as DebugGoogleTilesRenderer,WD as DebugTilesRenderer,YQ as EffectComposer,wL as Ellipsoid,LL as EllipsoidRegion,BD as EllipsoidRegionHelper,MD as EllipsoidRegionLineHelper,TN as EnvironmentControls,ik as FAILED,ND as GEOMETRIC_ERROR,UP as GLTFCesiumRTCExtension,QP as GLTFExtensionLoader,qO as GLTFMeshFeaturesExtension,NO as GLTFStructuralMetadataExtension,lL as GeoUtils,YN as GlobeControls,ZO as GoogleTilesRenderer,OP as I3DMLoader,MP as I3DMLoaderBase,GD as IS_LEAF,rk as LOADED,ek as LOADING,qD as LOAD_ORDER,ZT as LRUCache,sQ as Line2,oQ as LineGeometry,OU as LineMaterial,Ik as LoaderBase,DD as NONE,nk as PARSING,SP as PNTSLoader,IP as PNTSLoaderBase,$T as PriorityQueue,zD as RANDOM_COLOR,jD as RANDOM_NODE_COLOR,QD as RELATIVE_DEPTH,TG as RenderPass,OD as SCREEN_ERROR,Rj as SimpleInfoWindow,xD as SphereHelper,CT as TextureAnimator,_u as ThreeLayer,wu as ThreeRenderer,mD as TilesRenderer,_k as TilesRendererBase,tk as UNLOADED,HO as WGS84_ELLIPSOID,sk as WGS84_FLATTENING,ak as WGS84_HEIGHT,ok as WGS84_RADIUS,zG as bloomClass,OQ as bloomLine,eT as calIntersection,aT as calPointColor,Ij as drawTool,PQ as extrudePolygon,jB as getCenterOfPoints,KB as getCirGeojson,ZB as getCirGeojson1,JB as getPsByCircle,UB as getUUid,tT as getVPointGeojson,PT as gisCommon,MF as gltfLoadClass,BF as groupClass,pT as imgClass,bj as layerClass,Ej as layerClassNoOverride,vQ as line2Object,sT as line2Polygon,oT as line2Polygon1,YB as lineLength,jG as outlineBloomClass,Sj as overLayer,fQ as planeGifClass,WG as planeHeightClass,YT as planeMark,ST as planeSectorClass,BQ as polygonClass,NU as polylineClass,vj as pyramidClass,yT as radarClass,kU as rippleWallClass,bT as sectorClass,TT as shockClass,Lj as shockMarkerClass,QB as sleep,IF as tileClass,_Q as tripHeight,xQ as tripHeight1,wQ as tripLineClass,gQ as tubeClass,LB as turf,lQ as verticalFatLineClass,PU as wallClass};