Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ldmap

Package Overview
Dependencies
Maintainers
3
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ldmap - npm Package Compare versions

Comparing version 0.0.97 to 0.1.1

polyfills/index.js

2

core/projection.js

@@ -1,1 +0,1 @@

function a(f,g){var c=Math.PI*3e3/180,a=parseFloat(g)-.0065,b=parseFloat(f)-.006,d=Math.sqrt(a*a+b*b)-2e-5*Math.sin(b*c),e=Math.atan2(b,a)-3e-6*Math.cos(a*c);return{lat:parseFloat((d*Math.sin(e)).toFixed(5),10),lng:parseFloat((d*Math.cos(e)).toFixed(5),10)}}function b(a,b){var c=Math.sqrt(b*b+a*a)+2e-5*Math.sin(a*x_PI),d=Math.atan2(a,b)+3e-6*Math.cos(b*x_PI);return{lat:c*Math.cos(d)+.0065,lng:c*Math.sin(d)+.006}}var c=function(a,b){this.a=6378245,this.ee=.006693421622965943,this.pi=3.141592653589793,this.transform=function(a,b){var c,d;return this.outOfChina(a,b)?(c=a,d=b,[c,d]):(dLat=this.transformLat(b-105,a-35),dLon=this.transformLon(b-105,a-35),radLat=a/180*this.pi,magic=Math.sin(radLat),magic=1-this.ee*magic*magic,sqrtMagic=Math.sqrt(magic),dLat=dLat*180/(this.a*(1-this.ee)/(magic*sqrtMagic)*this.pi),dLon=dLon*180/(this.a/sqrtMagic*Math.cos(radLat)*this.pi),c=a+dLat,d=b+dLon,[c,d])},this.outOfChina=function(a,b){return b<72.004||b>137.8347?!0:a<.8293||a>55.8271?!0:!1},this.transformLat=function(b,a){return ret=-100+2*b+3*a+.2*a*a+.1*b*a+.2*Math.sqrt(Math.abs(b)),ret+=(20*Math.sin(6*b*this.pi)+20*Math.sin(2*b*this.pi))*2/3,ret+=(20*Math.sin(a*this.pi)+40*Math.sin(a/3*this.pi))*2/3,ret+=(160*Math.sin(a/12*this.pi)+320*Math.sin(a*this.pi/30))*2/3,ret},this.transformLon=function(a,b){return ret=300+a+2*b+.1*a*a+.1*a*b+.1*Math.sqrt(Math.abs(a)),ret+=(20*Math.sin(6*a*this.pi)+20*Math.sin(2*a*this.pi))*2/3,ret+=(20*Math.sin(a*this.pi)+40*Math.sin(a/3*this.pi))*2/3,ret+=(150*Math.sin(a/12*this.pi)+300*Math.sin(a/30*this.pi))*2/3,ret},a=Number(a),b=Number(b);var c=this.transform(a,b);return{lat:c[0],lng:c[1]}},d=52.35987755982988;module.exports={WGS2GCJ:c,BD092GCJ:a,GCJ2BD09:b}
function a(f,g){var c=Math.PI*3e3/180,a=parseFloat(g)-.0065,b=parseFloat(f)-.006,d=Math.sqrt(a*a+b*b)-2e-5*Math.sin(b*c),e=Math.atan2(b,a)-3e-6*Math.cos(a*c);return{lat:parseFloat((d*Math.sin(e)).toFixed(5),10),lng:parseFloat((d*Math.cos(e)).toFixed(5),10)}}function b(a,b){var c=Math.sqrt(b*b+a*a)+2e-5*Math.sin(a*d),e=Math.atan2(a,b)+3e-6*Math.cos(b*d);return{lng:c*Math.cos(e)+.0065,lat:c*Math.sin(e)+.006}}var c=function(a,b){this.a=6378245,this.ee=.006693421622965943,this.pi=3.141592653589793,this.transform=function(a,b){var c,d;return this.outOfChina(a,b)?(c=a,d=b,[c,d]):(dLat=this.transformLat(b-105,a-35),dLon=this.transformLon(b-105,a-35),radLat=a/180*this.pi,magic=Math.sin(radLat),magic=1-this.ee*magic*magic,sqrtMagic=Math.sqrt(magic),dLat=dLat*180/(this.a*(1-this.ee)/(magic*sqrtMagic)*this.pi),dLon=dLon*180/(this.a/sqrtMagic*Math.cos(radLat)*this.pi),c=a+dLat,d=b+dLon,[c,d])},this.outOfChina=function(a,b){return b<72.004||b>137.8347?!0:a<.8293||a>55.8271?!0:!1},this.transformLat=function(b,a){return ret=-100+2*b+3*a+.2*a*a+.1*b*a+.2*Math.sqrt(Math.abs(b)),ret+=(20*Math.sin(6*b*this.pi)+20*Math.sin(2*b*this.pi))*2/3,ret+=(20*Math.sin(a*this.pi)+40*Math.sin(a/3*this.pi))*2/3,ret+=(160*Math.sin(a/12*this.pi)+320*Math.sin(a*this.pi/30))*2/3,ret},this.transformLon=function(a,b){return ret=300+a+2*b+.1*a*a+.1*a*b+.1*Math.sqrt(Math.abs(a)),ret+=(20*Math.sin(6*a*this.pi)+20*Math.sin(2*a*this.pi))*2/3,ret+=(20*Math.sin(a*this.pi)+40*Math.sin(a/3*this.pi))*2/3,ret+=(150*Math.sin(a/12*this.pi)+300*Math.sin(a/30*this.pi))*2/3,ret},a=Number(a),b=Number(b);var c=this.transform(a,b);return{lat:c[0],lng:c[1]}},d=52.35987755982988;module.exports={WGS2GCJ:c,BD092GCJ:a,GCJ2BD09:b}

@@ -1,1 +0,1 @@

function b(c){var a=Math.floor(Math.random()*1e7),b=new Date().getTime();return c+'_'+b+'_'+a}function p(d,c){c||(c=y(d.target)),c=y(c);var i=c.width(),j=c.height(),e=c.offset(),g=e.left,h=e.top,a,b;if(d.type.indexOf('mouse')!==-1)return a=d.x||d.pageX,b=d.y||d.pageY,[a-g,b-h];var f=window.event.touches[0];return a=f.pageX-g,b=f.pageY-h,a=a<i?a:i,a=a>0?a:1,b=b<j?b:j,b=b>0?b:1,[a,b]}function c(b){if(b.fromLat&&b.fromLng)return{lat:b.fromLat,lng:b.fromLng};if(b.from){var a=b.from;return typeof a==='string'&&a.indexOf(',')!==-1?(a=a.split(',')[1],{lat:a[1],lng:a[0]}):a}}function d(b){if(b.toLat&&b.toLng)return{lat:b.toLat,lng:b.toLng};if(b.to){var a=b.to;return typeof a==='string'&&a.indexOf(',')!==-1?(a=a.split(',')[1],{lat:a[1],lng:a[0]}):a}}function e(e){var c=e.length,a=0,d=w.LatLng.DEG_TO_RAD,f,g;if(c>2){for(var b=0;b<c;b++)f=e[b],g=e[(b+1)%c],a+=(g.lng-f.lng)*d*(2+Math.sin(f.lat*d)+Math.sin(g.lat*d));a=a*6378137*6378137/2}return Math.abs(a)}function f(b){var c=0,d=b.length;for(var a=0;a<d;a++){var e=(a+1)%d;c+=b[a].distanceTo(b[e])}return c}function g(d,e,f){var a=e.target,b=a.__data,c='child-'+d;f.fire(c,{layer:a,data:b})}function h(a,b,c,d){return typeof a==='function'?a(b,c,d):a}function i(e,h){var f,a,b,c,d=0;for(var g in e){if(f=e[g],a=f[h],a===undefined||a===null)continue;d===0&&(b=c=a),b=Math.min(b,a),c=Math.max(c,a),d++}return[b,c]}function j(b,c){if(!b)return console.log('节点不存在');for(var a in c)b.style[a]=c[a]}function k(a){return typeof a==='number'&&(a=a.toString()),a.length>20?a.substring(0,20):a}function l(b){if(typeof b!=='string')return!1;var a=['http://','https://','www.'];for(var c in a)if(b.indexOf(a[c])!==-1)return!0}function m(a,c,d,e){var b;return l(a)?b=a:a=k(a),d?b?'<a href="'+b+'">点击查看</a><br>':'<div>'+a+'</div><br>':b?'<div style="'+D+'"> <div style="'+D+'">'+c+': </div> <a style="'+E+'" href="'+b+'">『点击查看』</a> </div><br>':'<div style="'+D+'"> <div style="'+D+'">'+c+': </div> <a style="'+E+'">'+a+'</a> </div><br>'}function n(a,f){var e=typeof a==='array',b,c='';for(var d in a){if(b=a[d],typeof b==='object')continue;c+=m(b,d,e,f)}return c}function o(a,b){return function(e){var d={};for(var f in a){var c=a[f];c in e&&(d[c]=e[c])}return n(d,b)}}function a(c){var a=u.getLat(c),b=u.getLng(c);return a&&b?z.BD092GCJ(a,b).lat:void 0}function q(c){var a=u.getLat(c),b=u.getLng(c);return a&&b?z.BD092GCJ(a,b).lng:void 0}function r(c){var a=u.getLat(c),b=u.getLng(c);return a&&b?z.WGS2GCJ(a,b).lat:void 0}function s(c){var a=u.getLat(c),b=u.getLng(c);return a&&b?z.WGS2GCJ(a,b).lng:void 0}function t(f,c,d,b,a){b=b||0,a=a===null||a===undefined?1:a;var e=(Math.max(c,Math.min(d,f))-c)/(d-c);return b+e*(a-b)}var u=require('aliyun-map-utils'),v=require('./l_utils'),w=require('leaflet'),x=w.dmap=w.dmap||{},y=require('jquery'),z=require('./projection'),A=require('./curve_util'),B=['click','mousedown','mouseup','mouseover','mouseout'],C=['click','mouseover','mouseout','mousedown'],D='margin-right:5px; color:#999;white-space:nowrap; display:inline-block;',E='white-space:nowrap;color:#fff;display:inline-block;font-weight:bold;text-decoration:none;';module.exports=x.Utils=u.merge(u,z,A,v,{getLngBA:q,getLatBA:a,getLngBA:s,getLatBA:r,getFrom:c,getTo:d,getId:b,getPt:p,getRange:i,geodesicArea:e,getLengthPolyline:f,genPopupFromObject:o,popupFromObject:n,fireEvent:g,getValue:h,applyCss:j,EVENTS:B,EVENTSBasic:C,map:t})
function b(c){var a=Math.floor(Math.random()*1e7),b=new Date().getTime();return c+'_'+b+'_'+a}function q(d,c){c||(c=A(d.target)),c=A(c);var i=c.width(),j=c.height(),e=c.offset(),g=e.left,h=e.top,a,b;if(d.type.indexOf('mouse')!==-1)return a=d.x||d.pageX,b=d.y||d.pageY,[a-g,b-h];var f=window.event.touches[0];return a=f.pageX-g,b=f.pageY-h,a=a<i?a:i,a=a>0?a:1,b=b<j?b:j,b=b>0?b:1,[a,b]}function c(b){if(b.fromLat&&b.fromLng)return{lat:b.fromLat,lng:b.fromLng};if(b.from){var a=b.from;return typeof a==='string'&&a.indexOf(',')!==-1?(a=a.split(',')[1],{lat:a[1],lng:a[0]}):a}}function d(b){if(b.toLat&&b.toLng)return{lat:b.toLat,lng:b.toLng};if(b.to){var a=b.to;return typeof a==='string'&&a.indexOf(',')!==-1?(a=a.split(',')[1],{lat:a[1],lng:a[0]}):a}}function e(e){var c=e.length,a=0,d=y.LatLng.DEG_TO_RAD,f,g;if(c>2){for(var b=0;b<c;b++)f=e[b],g=e[(b+1)%c],a+=(g.lng-f.lng)*d*(2+Math.sin(f.lat*d)+Math.sin(g.lat*d));a=a*6378137*6378137/2}return Math.abs(a)}function f(b){var c=0,d=b.length;for(var a=0;a<d;a++){var e=(a+1)%d;c+=b[a].distanceTo(b[e])}return c}function g(d,e,f){var a=e.target,b=a.__data,c='child-'+d;f.fire(c,{layer:a,data:b})}function h(a,b,c,d){return typeof a==='function'?a(b,c,d):a}function i(e,h){var f,a,b,c,d=0;for(var g in e){if(f=e[g],a=f[h],a===undefined||a===null)continue;d===0&&(b=c=a),b=Math.min(b,a),c=Math.max(c,a),d++}return[b,c]}function j(b,c){if(!b)return console.log('节点不存在');for(var a in c)b.style[a]=c[a]}function k(a){return typeof a==='number'&&(a=a.toString()),a.length>20?a.substring(0,20):a}function l(b){if(typeof b!=='string')return!1;var a=['http://','https://','www.'];for(var c in a)if(b.indexOf(a[c])!==-1)return!0}function m(a,c,d,e){var b;return l(a)?b=a:a=k(a),d?b?'<a href="'+b+'">点击查看</a><br>':'<div>'+a+'</div><br>':b?'<div style="'+F+'"> <div style="'+F+'">'+c+': </div> <a style="'+G+'" href="'+b+'">『点击查看』</a> </div><br>':'<div style="'+F+'"> <div style="'+F+'">'+c+': </div> <a style="'+G+'">'+a+'</a> </div><br>'}function n(a,f){var e=typeof a==='array',b,c='';for(var d in a){if(b=a[d],typeof b==='object')continue;c+=m(b,d,e,f)}return c}function o(a,b){return function(e){var d={};for(var f in a){var c=a[f];c in e&&(d[c]=e[c])}return n(d,b)}}function p(c){var a=w.getLat(c),b=w.getLng(c);return a&&b?B.BD092GCJ(a,b).lat:void 0}function a(c){var a=w.getLat(c),b=w.getLng(c);return a&&b?B.BD092GCJ(a,b).lng:void 0}function r(c){var a=w.getLat(c),b=w.getLng(c);return a&&b?B.WGS2GCJ(a,b).lat:void 0}function s(c){var a=w.getLat(c),b=w.getLng(c);return a&&b?B.WGS2GCJ(a,b).lng:void 0}function t(c){var a=w.getLat(c),b=w.getLng(c);return a&&b?B.GCJ2BD09(a,b).lat:void 0}function u(c){var a=w.getLat(c),b=w.getLng(c);return a&&b?B.GCJ2BD09(a,b).lng:void 0}function v(f,c,d,b,a){b=b||0,a=a===null||a===undefined?1:a;var e=(Math.max(c,Math.min(d,f))-c)/(d-c);return b+e*(a-b)}var w=require('aliyun-map-utils'),x=require('./l_utils'),y=require('leaflet'),z=y.dmap=y.dmap||{},A=require('jquery'),B=require('./projection'),C=require('./curve_util'),D=['click','mousedown','mouseup','mouseover','mouseout'],E=['click','mouseover','mouseout','mousedown'],F='margin-right:5px; color:#999;white-space:nowrap; display:inline-block;',G='white-space:nowrap;color:#fff;display:inline-block;font-weight:bold;text-decoration:none;';module.exports=z.Utils=w.merge(w,B,C,x,{getLngBA:a,getLatBA:p,getLngAB:u,getLatAB:t,getLngWA:s,getLatWA:r,getFrom:c,getTo:d,getId:b,getPt:q,getRange:i,geodesicArea:e,getLengthPolyline:f,genPopupFromObject:o,popupFromObject:n,fireEvent:g,getValue:h,applyCss:j,EVENTS:D,EVENTSBasic:E,map:v})

@@ -1,1 +0,1 @@

var a=require('jquery'),b=require('leaflet'),c=require('./core/utils');require('leaflet/dist/leaflet.css'),require('./index.css'),b.Utils=c.merge(b.Util,c);var d=b.dmap=b.dmap||{};b.dmap.Utils=c,require('./layer/areas'),require('./render/canvas'),require('./layer/tilelayer'),require('./layer/scatter_canvas'),require('./layer/scatter_markers'),require('./layer/scatter_marker'),require('./layer/flyingLineGradient'),require('./layer/flyingLineDash'),require('./layer/markercluster'),require('./layer/heatmap_grid_new'),require('./layer/trails_canvas'),require('./layer/scatter_konva'),require('./plugins/geo_coding_popup'),require('./plugins/filter/tilelayer'),require('./plugins/url_hash'),require('./map/map');var e=require('./layer/geojson_canvas');module.exports=b
var a=require('jquery'),b=require('./leaflet.js'),c=require('./core/utils');require('leaflet/dist/leaflet.css'),require('./index.css'),b.Utils=c.merge(b.Util,c);var d=b.dmap=b.dmap||{};b.dmap.Utils=c,require('./layer/areas'),require('./render/canvas'),require('./layer/tilelayer'),require('./layer/scatter_canvas'),require('./layer/scatter_markers'),require('./layer/scatter_marker'),require('./layer/flyingLineGradient'),require('./layer/flyingLineDash'),require('./layer/markercluster'),require('./layer/heatmap_grid_new'),require('./layer/trails_canvas'),require('./layer/scatter_konva'),require('./plugins/geo_coding_popup'),require('./plugins/filter/tilelayer'),require('./plugins/url_hash'),require('./map/map');var e=require('./layer/geojson_canvas');module.exports=b

@@ -1,1 +0,1 @@

'use strict';function a(b){this.options=c.deepMerge(a.options,b),this.initialize(b)}var b=require('./../leaflet'),c=require('./../core/utils'),d=c.Grid,e=c.getColorFunc,f=require('lodash'),g=require('bcore/event');a.options={clusterStepByZoom:1,isAutoUpdate:!0,isNeedAggregate:!0,shape:{type:'hex',rx:20,ry:18,mouseover:{fillOpacity:.8,color:'rgba(255,255,255,0.9)'},mouseout:{fillOpacity:1,color:'rgba(255,255,255,0.0)'},style:{weight:0,fillOpacity:1,color:'rgba(255,255,255,0.0)'},click:{}},color:e('rgba(62,18,0,0.8)','rgba(255,208,122,0.8)','hsl','linear.Out.1.4'),scale:function(a){return 1},value:function(a,b,c){return Math.min(1,a.length/40)},lng:c.getLng,lat:c.getLat,popup:function(a){return'区域内有: '+a.length+'点'}},a=g.extend(a,{initialize:function(){var a=this.options;this.events={'grid-resize':{desc:'格子大小发生变化'},'grid-mouseover':{desc:'鼠标移至格子范围'},'grid-dblclick':{desc:'双击格子'},'grid-mouseout':{desc:'鼠标移出格子范围'},'grid-click':{desc:'点击某个格子'}},this.gridMap={},this.aggregatedData={},this.getMax=a.getMax,this.getScale=c.getColorFunc(a.shape.scale||a.scale),this.isable=!0},addTo:function(a){if(this._map||!a)return;this._map=a,this.initDataProcesser(),this._data&&this.updateZoom()},initDataProcesser:function(){var a=this._map,c=this.options.shape;this.gridEncoder=new d().transform(function(i,m){var d=a.getSize(),e=d.x/2,f=d.y/2,h=e-i,j=f+m,k=e+i,l=f-m,g=a.containerPointToLatLng(b.point(h,j)),c=a.containerPointToLatLng(b.point(k,l));return{dlat:c.lat-g.lat,dlng:c.lng-g.lng}}).shape(c.type).rx(c.rx).ry(c.ry).update(),this.initEventsMap()},initEventsMap:function(){var a=this;this._map.on('moveend',function(){this.render()}.bind(this)).on('zoomend',function(){a.updateZoom()})},updateZoom:function(){var a=this.options,d=a.clusterStepByZoom,b=this._map;if(a.isNeedAggregate){var e=b.getZoom(),c=Math.floor(e/d);if(c===this.zoomLevel)return;b.closePopup(),this.gridEncoder.update(),this.zoomLevel=c,this.clean(),this.aggregate(),this.fire('grid-resize'),this._updateTransformOrigin()}},aggregate:function(){if(!this.isable)return;var b=this.gridEncoder,a=this.options,f=this._data,d=a.lat,e=a.lng;this.aggregatedData=c.mapReduce(this._data,{map:function(c,a){return{key:b.encode(d(a),e(a)),value:a}}})},getBounds:function(){var c=this._map.getBounds(),a=c._southWest,b=c._northEast,d=.5*(b.lat-a.lat),e=.5*(b.lng-a.lng);return{latMin:a.lat-d,latMax:b.lat+d,lngMin:a.lng-e,lngMax:b.lng+e}},clean:function(){var a=this.gridMap,c=this._map;for(var b in a){var d=a[b];c.removeLayer(d),delete a[b]}},disable:function(){this.isable=!1,this.clean()},enable:function(){this.isable=!0,this.draw()},link:function(){},updateShape:function(){this.clean();var b=this.options.shape,c=b.type,d=b.rx,e=b.ry,a=this.gridEncoder;this._map.closePopup(),a.shape(c),a.rx(d),a.ry(e),a.update(),this.aggregate(),this.draw()},updateColor:function(a,h,i,j){a||(a=this.options.color);var e=this.getColor=c.getColorFunc(a,h,i,j),b=this.gridMap,d,f;for(var g in b)d=b[g],f=d._value,d.setStyle({fillColor:e(f)})},updateOptions:function(a){this.options=c.deepMerge(this.options,a),this.updateColor(),this.updateShape()},updateScale:function(a){if(!a)return;this.scaleGridFunc=function(e,f){if(!e)return;var b=e._container;this._updateTranformOriginGird(b);var c=a(f),d='scale3d('+c+','+c+',1)';b.style.transform=d,b.style['-webkit-transform']=d,this.getScale=a}},_updateTranformOriginGird:function(b){if(!b)return;var a=b.getBBox(),c=a.width/2+a.x+'px '+(a.height/2+a.y)+'px 0px';b.style['transform-origin']=c,b.style['-webkit-transform-origin']=c},_updateTransformOrigin:function(){if(!this.scaleGridFunc)return;var a=this.gridMap,b=this;setTimeout(function(){for(var c in a)b._updateTranformOriginGird(a[c]._container)})},data:function(b){if(!b)return this._data;this._data=b;var a=this.options;a.isAutoUpdate&&this._map&&this.aggregate(),this.updateColor();var c=a.shape},render:function(a){a&&this.data(a),this.draw()},each:function(d){var a=this.gridMap;for(var b in a){var c=a[b];d(c,b)}},draw:function(){if(!this.isable)return;var l=this.drawid='id_'+Math.floor(Math.random()*1e10),j=this.options,x=this.gridEncoder,u=j.shape.style,B=c.getColorFunc(j.shape.color||j.color),p=j.value,h=this.aggregatedData,f=this.gridMap,o=this._map,i=this.getBounds(),a,C=i.latMax,D=i.latMin,A=i.lngMax,y=i.lngMin,g,k;for(var d in h){var e=p(h[d]);g||(g=e),k||(k=e),g=Math.min(e,g),k=Math.max(e,k)}for(var d in h){var w=h[d],q=x.decode(d),r=q.center,z=q.pts,s=r[0],t=r[1];if(s<D||t<y||s>C||t>A)continue;var e=p(w)||0,n=(e-g)/(k-g)||0,v=B(n);a=f[d],a?(a.setStyle({fillColor:v}),a._drawid=l):(u.fillColor=v,a=f[d]=b.polygon(z,u).addTo(o),a._value=n,a._gridid=d,a._drawid=l,this.initEventsGrid(a),this.scaleGridFunc&&this.scaleGridFunc(a,n))}for(var m in f)f[m]._drawid!==l&&(o.removeLayer(f[m]),delete f[m]);this._updateTransformOrigin()},initEventsGrid:function(a){var c=this,n=this.aggregatedData,g=this.options.shape,e=g.click||{},m=g.mouseover||{},i=g.mouseout||{},h=a._gridid,k=this._map,l=n[h],d={gridid:h,data:l,layer:a},f=a.getBounds(),o=f._northEast.lat,p=(f._southWest.lng+f._northEast.lng)/2,q=b.latLng(o,p),j;this.options.popup&&(j=this.options.popup(l,a)),a.on('mouseover',function(b){m&&a.setStyle(m),c.fire('grid-mouseover',d),a.bringToFront()}).on('mouseout',function(b){i&&a.setStyle(i),c.fire('grid-mouseout',d)}).on('mousedown',function(b){e&&a.setStyle(e),c.fire('grid-mousedown',d),k.closePopup(),j&&setTimeout(function(){k.openPopup(j,q)},10)}).on('click',function(){e&&a.setStyle(e),c.fire('grid-click',d)}).on('dblclick',function(a){c.fire('grid-dblclick',d)})}});var h=b.dmap=b.dmap||{};h.HeatmapGrid=a,h.heatmapGrid=function(b){return a(b)},module.exports=a
'use strict';function a(b){this.options=c.deepMerge(a.options,b),this.initialize(b)}var b=require('./../leaflet'),c=require('./../core/utils'),d=c.Grid,e=c.getColorFunc,f=require('lodash'),g=require('bcore/event');a.options={clusterStepByZoom:1,isAutoUpdate:!0,isNeedAggregate:!0,shape:{type:'hex',rx:20,ry:18,mouseover:{fillOpacity:.8,color:'rgba(255,255,255,0.9)'},mouseout:{fillOpacity:1,color:'rgba(255,255,255,0.0)'},style:{weight:0,fillOpacity:1,color:'rgba(255,255,255,0.0)'},click:{}},color:e('rgba(62,18,0,0.8)','rgba(255,208,122,0.8)','hsl','linear.Out.1.4'),scale:function(a){return 1},value:function(a,b,c){return Math.min(1,a.length/40)},lng:c.getLng,lat:c.getLat,popup:function(a){return'区域内有: '+a.length+'点'}},a=g.extend(a,{initialize:function(){var a=this.options;this.events={'grid-resize':{desc:'格子大小发生变化'},'grid-mouseover':{desc:'鼠标移至格子范围'},'grid-dblclick':{desc:'双击格子'},'grid-mouseout':{desc:'鼠标移出格子范围'},'grid-click':{desc:'点击某个格子'}},this.gridMap={},this.aggregatedData={},this.getMax=a.getMax,this.getScale=c.getColorFunc(a.shape.scale||a.scale),this.isable=!0},addTo:function(a){if(this._map||!a)return;this._map=a,this.initDataProcesser(),this._data&&this.updateZoom()},initDataProcesser:function(){var a=this._map,c=this.options.shape;this.gridEncoder=new d().transform(function(i,m){var d=a.getSize(),e=d.x/2,f=d.y/2,h=e-i,j=f+m,k=e+i,l=f-m,g=a.containerPointToLatLng(b.point(h,j)),c=a.containerPointToLatLng(b.point(k,l));return{dlat:c.lat-g.lat,dlng:c.lng-g.lng}}).shape(c.type).rx(c.rx).ry(c.ry).update(),this.initEventsMap()},initEventsMap:function(){var a=this;this._map.on('moveend',function(){this.render()}.bind(this)).on('zoomend',function(){a.updateZoom()})},updateZoom:function(){var a=this.options,d=a.clusterStepByZoom,b=this._map;if(a.isNeedAggregate){var e=b.getZoom(),c=Math.floor(e/d);if(c===this.zoomLevel)return;b.closePopup(),this.gridEncoder.update(),this.zoomLevel=c,this.clean(),this.aggregate(),this.fire('grid-resize'),this._updateTransformOrigin()}},aggregate:function(){if(!this.isable)return;var b=this.gridEncoder,a=this.options,f=this._data,d=a.lat,e=a.lng;this.aggregatedData=c.mapReduce(this._data,{map:function(c,a){return{key:b.encode(d(a),e(a)),value:a}}})},getBounds:function(){var c=this._map.getBounds(),a=c._southWest,b=c._northEast,d=.5*(b.lat-a.lat),e=.5*(b.lng-a.lng);return{latMin:a.lat-d,latMax:b.lat+d,lngMin:a.lng-e,lngMax:b.lng+e}},clean:function(){var a=this.gridMap,c=this._map;for(var b in a){var d=a[b];c.removeLayer(d),delete a[b]}},disable:function(){this.isable=!1,this.clean()},enable:function(){this.isable=!0,this.draw()},link:function(){},updateShape:function(){this.clean();var b=this.options.shape,c=b.type,d=b.rx,e=b.ry,a=this.gridEncoder;this._map.closePopup(),a.shape(c),a.rx(d),a.ry(e),a.update(),this.aggregate(),this.draw()},updateColor:function(a,h,i,j){a||(a=this.options.color);var e=this.getColor=c.getColorFunc(a,h,i,j),b=this.gridMap,d,f;for(var g in b)d=b[g],f=d._value,d.setStyle({fillColor:e(f)})},updateOptions:function(a){this.options=c.deepMerge(this.options,a),this.updateColor(),this.updateShape()},updateScale:function(a){if(!a)return;this.scaleGridFunc=function(e,f){if(!e)return;var b=e._container;this._updateTranformOriginGird(b);var c=a(f),d='scale3d('+c+','+c+',1)';b.style.transform=d,b.style['-webkit-transform']=d,this.getScale=a}},_updateTranformOriginGird:function(b){if(!b)return;var a=b.getBBox(),c=a.width/2+a.x+'px '+(a.height/2+a.y)+'px 0px';b.style['transform-origin']=c,b.style['-webkit-transform-origin']=c},_updateTransformOrigin:function(){if(!this.scaleGridFunc)return;var a=this.gridMap,b=this;setTimeout(function(){for(var c in a)b._updateTranformOriginGird(a[c]._container)})},data:function(b){if(!b)return this._data;this._data=b;var a=this.options;a.isAutoUpdate&&this._map&&this.aggregate(),this.updateColor();var c=a.shape},render:function(a){a&&this.data(a),this.draw()},each:function(d){var a=this.gridMap;for(var b in a){var c=a[b];d(c,b)}},draw:function(){if(!this.isable)return;var l=this.drawid='id_'+Math.floor(Math.random()*1e10),j=this.options,x=this.gridEncoder,u=j.shape.style,B=c.getColorFunc(j.shape.color||j.color),p=j.value,h=this.aggregatedData,f=this.gridMap,o=this._map,i=this.getBounds(),a,C=i.latMax,D=i.latMin,A=i.lngMax,y=i.lngMin,g,k;for(var d in h){var e=p(h[d]);g||(g=e),k||(k=e),g=Math.min(e,g),k=Math.max(e,k)}for(var d in h){var w=h[d],q=x.decode(d),r=q.center,z=q.pts,s=r[0],t=r[1];if(s<D||t<y||s>C||t>A)continue;var e=p(w)||0,n=(e-g)/(k-g)||0,v=B(n);a=f[d],a?(a.setStyle({fillColor:v}),a._drawid=l):(u.fillColor=v,a=f[d]=b.polygon(z,u).addTo(o),a._value=n,a._gridid=d,a._drawid=l,this.initEventsGrid(a),this.scaleGridFunc&&this.scaleGridFunc(a,n))}for(var m in f)f[m]._drawid!==l&&(o.removeLayer(f[m]),delete f[m]);this._updateTransformOrigin()},initEventsGrid:function(a){var c=this,n=this.aggregatedData,g=this.options.shape,e=g.click||{},m=g.mouseover||{},i=g.mouseout||{},h=a._gridid,k=this._map,l=n[h],d={gridid:h,data:l,layer:a},f=a.getBounds(),o=f._northEast.lat,p=(f._southWest.lng+f._northEast.lng)/2,q=b.latLng(o,p),j;this.options.popup&&(j=this.options.popup(l,a)),a.on('mouseover',function(e){return m&&a.setStyle(m),c.fire('child-mouseover',d),b.DomEvent.stopPropagation(e),b.DomEvent.preventDefault(e),a.bringToFront(),!0}).on('mouseout',function(e){return i&&a.setStyle(i),c.fire('child-mouseout',d),b.DomEvent.stopPropagation(e),b.DomEvent.preventDefault(e),!0}).on('mousedown',function(f){return e&&a.setStyle(e),c.fire('grid-mousedown',d),k.closePopup(),j&&setTimeout(function(){k.openPopup(j,q)},100),b.DomEvent.stopPropagation(f),b.DomEvent.preventDefault(f),!0}).on('click',function(f){return e&&a.setStyle(e),c.fire('child-click',d),b.DomEvent.stopPropagation(f),b.DomEvent.preventDefault(f),!0}).on('dblclick',function(a){return c.fire('child-dblclick',d),b.DomEvent.stopPropagation(a),b.DomEvent.preventDefault(a),!0})}});var h=b.dmap=b.dmap||{};h.HeatmapGrid=a,h.heatmapGrid=function(b){return a(b)},module.exports=a

@@ -1,1 +0,1 @@

function a(b){b=this.options=c.deepMerge(a.options,b),this.getChildOptions(),this.initialize(b)}var b=require('leaflet'),c=require('./../core/utils'),d=c.EVENTS,e=require('bcore/event'),f=require('./scatter_marker'),g=b.dmap=b.dmap||{};a.options={lat:c.getLat,lng:c.getLng,filter:function(a,b){return!0},popupText:'loading...',range:[0,1],id:function(a,b){return a.id||b},text:function(a){return a.text},value:function(a){return a.value||a.num||a[0]},zoom:{max:15,min:3},child:{size:function(a,b,c){return 15},shape:{normal:{}}}},a=e.extend(a,{initialize:function(a){this.cache={},this.isable=!0},addTo:function(a){if(!a)return;this._map=a,this.initEventsMap(),this.initPopUp()},initPopUp:function(){var a=this._map;a||(a._popup=b.popup('...'))},data:function(a){this._data=a},clean:function(){var a=this.cache,c,b;if(!a)return;for(var d in a)c=a[d],b=c.visual,b&&b.destroy&&(b.destroy(),delete c.visual)},updateData:function(a){this.processing(a),this.cleanOld()},updateFilter:function(a){if(typeof a!=='function')return;this.options.filter=a,this.updateMap()},cleanOld:function(){var c=this.versionID,b=this.cache,d,a,f;if(!(c&&b))return;for(var e in b)d=b[e],f=d.versionID,f!==c&&(a=d.visual,a&&(a.off&&a.off(),a.destroy&&a.destroy()),delete b[e])},processing:function(y){var t=this.versionID=Math.random(),j=this._map;if(!j)return;var c=this.options,w=this.getChildOptions(),a,i,u,v,d,b,n=this.isInZoom(),o=this._map.getZoom(),p=c.id,q=c.lat,r=c.lng,s=c.filter,g=c.groups,k,h,l=this.cache,m=this.isable;for(var e in y){if(a=y[e],c.processing&&c.processing(a),i=p(a,e),u=q(a),v=r(a),d=l[i],k=!0,k=s(a,o),h=!0,g){h=!1;for(var e in g){var x=g[e];if(x.filter(a)){h=!0;break}}}if(d?d.data=a:d=l[i]={data:a},d.versionID=t,n&&k&&h&&this.isInView(u,v)&&m){var b=d.visual;b?b.updateData(a):m&&(b=d.visual=new f(w),b.addTo(j),b.render(a),this.initEventsScatter(b))}}this.updateRange()},render:function(a){a&&this.data(a),a=this._data,this.updateData(a)},enable:function(){this.isable=!0},disable:function(){this.isable=!1},isInZoom:function(){var a=this.options.zoom;if(!a)return!0;var c=this._map,d=a.max,e=a.min,b=c.getZoom();return b>d||b<e?!1:!0},isInView:function(b,c,a){a=a||this._map.getBounds();var d=a._northEast.lng,e=a._northEast.lat,f=a._southWest.lng,g=a._southWest.lat;return b<e&&b>g&&c<d&&c>f},each:function(c){var a=this.cache;for(var b in a)c(a[b])},getOptionsValue:function(b){var a=this.options;return a.child[b]||a[b]},getChildOptions:function(){var a={},b=this;return['id','text','lat','lng','range','value','css','popupText','popup'].forEach(function(c){a[c]=b.options[c]=this.getOptionsValue(c)}.bind(this)),a},updateOptions:function(b){b=this.options=c.deepMerge(this.options,b);var a,d=this.getChildOptions(),e=b.popup;this.each(function(c){var b=c.visual;b&&(b.updateOptions(d),a=b.popupGroup,a&&a.updateOptions&&a.updateOptions(e))}),this.draw()},draw:function(){var e=this.options,g=this.cache,d,a,l,h,b,j=e.lng,k=e.lat,c,m,n=e.filter,o=this._map.getZoom(),p,q=this.isInZoom(),t=e.groups;if(!q)return this.clean();if(!g)return;if(!this.isable)return;var s=this.getChildOptions(),r=this._map;for(var i in g)d=g[i],b=d.data,l=k(b),h=j(b),p=this.isInView(l,h),c=!0,c=n(b,o),m=!0,c=c&&m,a=d.visual,p&&c?a?(a.updateData(b),a.updateZIndex()):(a=d.visual=new f(s),a.addTo(r),a.render(b),this.initEventsScatter(a)):a&&(a.off&&a.off(),a.destroy&&a.destroy(),delete d.visual)},updateMap:function(){this.draw()},updateRange:function(){var c=this.cache,d=this.ranges=this.ranges||{},e=this.options.value,a=d.value=[];for(var f in c){var g=c[f].data,b=e(g);a[0]||(a=[b,b]),b<a[0]&&(a[0]=b),b>a[1]&&(a[1]=b)}},initEventsPopup:function(a){var b=this._map;c.initEventsPopup({parent:this,child:a,map:b,datas:[a._data],popup:this.options.popup}),b.on('zoomend',function(){a.updatePopupPostion()}.bind(this))},initEventsMap:function(){this._map.on('moveend',this.updateMap.bind(this))},initEventsScatter:function(a){var b=this;d.forEach(function(c){a.on(c,function(a){b.emit('child-'+c,a)})}),this.initEventsPopup(a)},destroy:function(){this.clean(),this.cache={}}}),g.ScatterMarkers=a,g.scatterMarkers=function(b){return new a(b)},module.exports=a
function a(b){b=this.options=c.deepMerge(a.options,b),this.getChildOptions(),this.initialize(b)}var b=require('./../leaflet'),c=require('./../core/utils'),d=c.EVENTS,e=require('bcore/event'),f=require('./scatter_marker'),g=b.dmap=b.dmap||{};a.options={lat:c.getLat,lng:c.getLng,filter:function(a,b){return!0},popupText:'loading...',range:[0,1],id:function(a,b){return a.id||b},text:function(a){return a.text},value:function(a){return a.value||a.num||a[0]},zoom:{max:18,min:3},child:{size:function(a,b,c){return 15},shape:{normal:{}}}},a=e.extend(a,{initialize:function(a){this.cache={},this.isable=!0},addTo:function(a){if(!a)return;this._map=a,this.initEventsMap(),this.initPopUp()},initPopUp:function(){var a=this._map;a||(a._popup=b.popup('...'))},data:function(a){this._data=a},clean:function(){var a=this.cache,c,b;if(!a)return;for(var d in a)c=a[d],b=c.visual,b&&b.destroy&&(b.destroy(),delete c.visual)},updateData:function(a){this.processing(a),this.cleanOld()},updateFilter:function(a){if(typeof a!=='function')return;this.options.filter=a,this.updateMap()},cleanOld:function(){var c=this.versionID,b=this.cache,d,a,f;if(!(c&&b))return;for(var e in b)d=b[e],f=d.versionID,f!==c&&(a=d.visual,a&&(a.off&&a.off(),a.destroy&&a.destroy()),delete b[e])},processing:function(y){var t=this.versionID=Math.random(),j=this._map;if(!j)return;var c=this.options,w=this.getChildOptions(),a,i,u,v,d,b,n=this.isInZoom(),o=this._map.getZoom(),p=c.id,q=c.lat,r=c.lng,s=c.filter,g=c.groups,k,h,l=this.cache,m=this.isable;for(var e in y){if(a=y[e],c.processing&&c.processing(a),i=p(a,e),u=q(a),v=r(a),d=l[i],k=!0,k=s(a,o),h=!0,g){h=!1;for(var e in g){var x=g[e];if(x.filter(a)){h=!0;break}}}if(d?d.data=a:d=l[i]={data:a},d.versionID=t,n&&k&&h&&this.isInView(u,v)&&m){var b=d.visual;b?b.updateData(a):m&&(b=d.visual=new f(w),b.addTo(j),b.render(a),this.initEventsScatter(b))}}this.updateRange()},render:function(a){a&&this.data(a),a=this._data,this.updateData(a)},enable:function(){this.isable=!0},disable:function(){this.isable=!1},isInZoom:function(){var a=this.options.zoom;if(!a)return!0;var c=this._map,d=a.max,e=a.min,b=c.getZoom();return b>d||b<e?!1:!0},isInView:function(b,c,a){a=a||this._map.getBounds();var d=a._northEast.lng,e=a._northEast.lat,f=a._southWest.lng,g=a._southWest.lat;return b<e&&b>g&&c<d&&c>f},each:function(c){var a=this.cache;for(var b in a)c(a[b])},getOptionsValue:function(b){var a=this.options;return a.child[b]||a[b]},getChildOptions:function(){var a={},b=this;return['id','text','lat','lng','range','value','css','popupText','popup'].forEach(function(c){a[c]=b.options[c]=this.getOptionsValue(c)}.bind(this)),a},updateOptions:function(b){b=this.options=c.deepMerge(this.options,b);var a,d=this.getChildOptions(),e=b.popup;this.each(function(c){var b=c.visual;b&&(b.updateOptions(d),a=b.popupGroup,a&&a.updateOptions&&a.updateOptions(e))}),this.draw()},draw:function(){var e=this.options,g=this.cache,d,a,l,h,b,j=e.lng,k=e.lat,c,m,n=e.filter,o=this._map.getZoom(),p,q=this.isInZoom(),t=e.groups;if(!q)return this.clean();if(!g)return;if(!this.isable)return;var s=this.getChildOptions(),r=this._map;for(var i in g)d=g[i],b=d.data,l=k(b),h=j(b),p=this.isInView(l,h),c=!0,c=n(b,o),m=!0,c=c&&m,a=d.visual,p&&c?a?(a.updateData(b),a.updateZIndex()):(a=d.visual=new f(s),a.addTo(r),a.render(b),this.initEventsScatter(a)):a&&(a.off&&a.off(),a.destroy&&a.destroy(),delete d.visual)},updateMap:function(){this.draw()},updateRange:function(){var c=this.cache,d=this.ranges=this.ranges||{},e=this.options.value,a=d.value=[];for(var f in c){var g=c[f].data,b=e(g);a[0]||(a=[b,b]),b<a[0]&&(a[0]=b),b>a[1]&&(a[1]=b)}},initEventsPopup:function(a){var b=this._map;c.initEventsPopup({parent:this,child:a,map:b,datas:[a._data],popup:this.options.popup}),b.on('zoomend',function(){a.updatePopupPostion()}.bind(this))},initEventsMap:function(){this._map.on('moveend',this.updateMap.bind(this))},initEventsScatter:function(a){var b=this;d.forEach(function(c){a.on(c,function(a){b.emit('child-'+c,a)})}),this.initEventsPopup(a)},destroy:function(){this.clean(),this.cache={}}}),g.ScatterMarkers=a,g.scatterMarkers=function(b){return new a(b)},module.exports=a

@@ -1,1 +0,1 @@

'use strict';function a(b){b=this.options=c.deepMerge(a.options,b),this.initialize(b)}var b=require('leaflet'),c=require('./../core/utils'),d=require('./../render/canvas'),e=c.getColorFunc,f=require('./../core/animator'),g=require('./trail_canvas');a.options={lifeSpeed:.1,isAutoUpdate:!0,lifeMin:0,lifeMax:100,trail:{lengthLimit:60,isAutoUpdate:!1,spriteW:200,spriteH:20,flying:{isable:!0,blending:'lighter',type:'line',ptsN:29,weight:function(a){return 8*Math.pow(a,3)},isSpriteHead:!0,container:'#canvas-container'},bgLine:{container:'#canvas-container',isable:!1,blending:'source-over',opacity:1,color:'rgba(250,100,50,0.3)',weight:2},color:{to:'rgba(255,150,0,0.4)',from:'rgba(255,150,0,0.4)',space:'hsl',easing:'linear.Out.1'},value:function(a,b,c){return Math.min(1,a.length/40)},lng:c.getLng,lat:c.getLat,time:c.getTime},pts:function(a){return a.p},id:c.getID};var a=f.extend(a,{events:{},initialize:function(a){this.isable=!0;var b=a.trail;this.lifeMax=a.lifeMax,this.lifeMin=a.lifeMin,this.life=this.lifeMin,this.initSpriteFlying(),b.bgLine&&this.initSpriteBgLine(),b.flying&&this.initSpriteFlyingHead(),a.isAutoUpdate&&this.initEventsAnim()},initCanvas:function(){var g=this.options,e=g.trail,a=e.bgLine;if(a){var h=a.opacity,i=a.blending;this.lcanvasBg=new d(this._map,a.container,{});var c=this.ctxBg=this.lcanvasBg.ctx;c.globalAlpha=h,c.globalCompositeOperation=i,a.ctx=c}var b=e.flying;if(b){var j=b.blending;this.lcanvas=new d(this._map,b.container,{});var f=this.ctxFlying=this.lcanvas.ctx;f.globalCompositeOperation=j,b.ctx=f}},addTo:function(a){if(this._map||!a)return;this._map=a,this.initCanvas(),this.initEventsMap(),this._data&&this.updateZoom()},initCacheColor:function(){},data:function(a){if(!a)return this._data;this._data=a,this.trailsInView={},this.trailsEnable={},this.initTrails(),this.options.isAutoUpdate&&this._map&&this.startAnim()},initTrails:function(){var b=this.options,d=b.trail,j=b.pts,m=b.id,e=this._data,h=this._map,i=this.trails=[];d.flying.ctx=this.ctxFlying;var l=this.ctxBg,k,f,a;for(var c in e)k=e[c],f=j(k),a=new g(d),a.addTo(h),a.data(f),i.push({id:c,data:f,trail:a});this.updateMap()},render:function(){},reset:function(){var c=this.using;for(var b=0;b<c.length;b++){var a=c[b];a.stop&&a.stop(),a.pause&&a.pause()}this.using=[],this.unsing=this.trails},restart:function(){var a=this.trails;for(var b in a){var c=a[b];c.trail.resetVariables()}this.life=this.options.lifeMin,this.resume()},updateAnim:function(d){if(!this.isable)return;var a=this.ctxFlying;a&&a.clearRect(0,0,a.canvas.width,a.canvas.height),d=d||this.life;var e=this.trails;for(var b=0;b<e.length;b++){var c=e[b];c=c.trail,c.updateAnim(d)}},updateMap:function(){if(!this.isable)return;var a=this.ctxBg;a&&a.clearRect(0,0,a.canvas.width,a.canvas.height);var b=this.ctxFlying;b&&b.clearRect(0,0,b.canvas.width,b.canvas.height);var f=this._map.getBounds(),e=this.trails;for(var d=0;d<e.length;d++){var c=e[d];c=c.trail,c&&c.updateMap(f)}},clean:function(){var a=this.ctxBg;a&&a.clearRect(0,0,a.canvas.width,a.canvas.height);var b=this.ctxFlying;b&&b.clearRect(0,0,b.canvas.width,b.canvas.height)},enable:function(){this.isable=!0,this.resume(),this.updateMap()},disable:function(){this.clean(),this.pause(),this.isable=!1},initEventsMap:function(){var a=this;this._map.on('movestart',function(){a.clean()}).on('moveend',function(){a.updateMap()}.bind(this))},initSpriteFlying:function(){var b=this.options.trail,k=e(b.color),a=document.createElement('canvas'),f=this.spriteW=a.width=b.spriteW,h=this.spriteH=a.height=b.spriteH,d=a.getContext('2d'),i,j=d.createLinearGradient(0,0,f,h),g=100;for(var c=0;c<g;c++)i=c/g,j.addColorStop(i,k(i));d.fillStyle=j,d.fillRect(0,0,f,h),this.spriteFlying=a,b.flying.sprite=a},initSpriteFlyingHead:function(){var d=this.options.trail,f=e(d.color),a=document.createElement('canvas'),g=a.width=a.height=50,b=g/2,c=a.getContext('2d');return c.fillStyle=f(1),c.arc(b,b,b,0,Math.PI*2),c.fill(),this.spriteFlyingHead=a,d.flying.spriteHead=a,a},select:function(d){var a,e,c=this.trails;this.clean();for(var b=0;b<c.length;b++)a=c[b],e=a.id,d&&e in d?(a.trail.enable(),a.trail.updateBgLine()):a.trail.disable()},unselect:function(){var a,c=this.trails;this.clean();for(var b=0;b<c.length;b++)a=c[b],a.trail&&a.trail.enable('flying'),a.trail&&a.trail.disable('bgLine')},initSpriteBgLine:function(){var b=this.options.trail;if(!b.bgLine)return;var a=document.createElement('canvas'),d=this.spriteW=a.width=b.spriteW,e=this.spriteH=a.height=b.spriteH,c=a.getContext('2d');return c.fillStyle=this.options.trail.bgLine.color,c.fillRect(0,0,d,e),this.spriteBgLine=a,b.bgLine.sprite=a,a},initEventsAnim:function(){this.on('lifeEnd',function(){this.pause()}).on('update',function(a){this.updateAnim(a)})},genOptions:function(){return a.prototype.options=c.deepMerge(f.prototype.genOptions(),a.prototype.options)}}),h=b.dmap=b.dmap||{};h.TrailsCanvas=a,h.trailsCanvas=function(b){return new a(b)},a.prototype.genOptions(),module.exports=a
'use strict';function a(b){b=this.options=c.deepMerge(a.options,b),this.initialize(b)}var b=require('./../leaflet'),c=require('./../core/utils'),d=require('./../render/canvas'),e=c.getColorFunc,f=require('./../core/animator'),g=require('./trail_canvas');a.options={lifeSpeed:.1,isAutoUpdate:!0,lifeMin:0,lifeMax:100,trail:{lengthLimit:60,isAutoUpdate:!1,spriteW:200,spriteH:20,flying:{isable:!0,blending:'lighter',type:'line',ptsN:29,weight:function(a){return 8*Math.pow(a,3)},isSpriteHead:!0,container:'#canvas-container'},bgLine:{container:'#canvas-container',isable:!1,blending:'source-over',opacity:1,color:'rgba(250,100,50,0.3)',weight:2},color:{to:'rgba(255,150,0,0.4)',from:'rgba(255,150,0,0.4)',space:'hsl',easing:'linear.Out.1'},value:function(a,b,c){return Math.min(1,a.length/40)},lng:c.getLng,lat:c.getLat,time:c.getTime},pts:function(a){return a.p},id:c.getID};var a=f.extend(a,{events:{},initialize:function(a){this.isable=!0;var b=a.trail;this.lifeMax=a.lifeMax,this.lifeMin=a.lifeMin,this.life=this.lifeMin,this.initSpriteFlying(),b.bgLine&&this.initSpriteBgLine(),b.flying&&this.initSpriteFlyingHead(),a.isAutoUpdate&&this.initEventsAnim()},initCanvas:function(){var g=this.options,e=g.trail,a=e.bgLine;if(a){var h=a.opacity,i=a.blending;this.lcanvasBg=new d(this._map,a.container,{});var c=this.ctxBg=this.lcanvasBg.ctx;c.globalAlpha=h,c.globalCompositeOperation=i,a.ctx=c}var b=e.flying;if(b){var j=b.blending;this.lcanvas=new d(this._map,b.container,{});var f=this.ctxFlying=this.lcanvas.ctx;f.globalCompositeOperation=j,b.ctx=f}},addTo:function(a){if(this._map||!a)return;this._map=a,this.initCanvas(),this.initEventsMap(),this._data&&this.updateZoom()},initCacheColor:function(){},data:function(a){if(!a)return this._data;this._data=a,this.trailsInView={},this.trailsEnable={},this.initTrails(),this.options.isAutoUpdate&&this._map&&this.startAnim()},initTrails:function(){var b=this.options,d=b.trail,j=b.pts,m=b.id,e=this._data,h=this._map,i=this.trails=[];d.flying.ctx=this.ctxFlying;var l=this.ctxBg,k,f,a;for(var c in e)k=e[c],f=j(k),a=new g(d),a.addTo(h),a.data(f),i.push({id:c,data:f,trail:a});this.updateMap()},render:function(){},reset:function(){var c=this.using;for(var b=0;b<c.length;b++){var a=c[b];a.stop&&a.stop(),a.pause&&a.pause()}this.using=[],this.unsing=this.trails},restart:function(){var a=this.trails;for(var b in a){var c=a[b];c.trail.resetVariables()}this.life=this.options.lifeMin,this.resume()},updateAnim:function(d){if(!this.isable)return;var a=this.ctxFlying;a&&a.clearRect(0,0,a.canvas.width,a.canvas.height),d=d||this.life;var e=this.trails;for(var b=0;b<e.length;b++){var c=e[b];c=c.trail,c.updateAnim(d)}},updateMap:function(){if(!this.isable)return;var a=this.ctxBg;a&&a.clearRect(0,0,a.canvas.width,a.canvas.height);var b=this.ctxFlying;b&&b.clearRect(0,0,b.canvas.width,b.canvas.height);var f=this._map.getBounds(),e=this.trails;for(var d=0;d<e.length;d++){var c=e[d];c=c.trail,c&&c.updateMap(f)}},clean:function(){var a=this.ctxBg;a&&a.clearRect(0,0,a.canvas.width,a.canvas.height);var b=this.ctxFlying;b&&b.clearRect(0,0,b.canvas.width,b.canvas.height)},enable:function(){this.isable=!0,this.resume(),this.updateMap()},disable:function(){this.clean(),this.pause(),this.isable=!1},initEventsMap:function(){var a=this;this._map.on('movestart',function(){a.clean()}).on('moveend',function(){a.updateMap()}.bind(this))},initSpriteFlying:function(){var b=this.options.trail,k=e(b.color),a=document.createElement('canvas'),f=this.spriteW=a.width=b.spriteW,h=this.spriteH=a.height=b.spriteH,d=a.getContext('2d'),i,j=d.createLinearGradient(0,0,f,h),g=100;for(var c=0;c<g;c++)i=c/g,j.addColorStop(i,k(i));d.fillStyle=j,d.fillRect(0,0,f,h),this.spriteFlying=a,b.flying.sprite=a},initSpriteFlyingHead:function(){var d=this.options.trail,f=e(d.color),a=document.createElement('canvas'),g=a.width=a.height=50,b=g/2,c=a.getContext('2d');return c.fillStyle=f(1),c.arc(b,b,b,0,Math.PI*2),c.fill(),this.spriteFlyingHead=a,d.flying.spriteHead=a,a},select:function(d){var a,e,c=this.trails;this.clean();for(var b=0;b<c.length;b++)a=c[b],e=a.id,d&&e in d?(a.trail.enable(),a.trail.updateBgLine()):a.trail.disable()},unselect:function(){var a,c=this.trails;this.clean();for(var b=0;b<c.length;b++)a=c[b],a.trail&&a.trail.enable('flying'),a.trail&&a.trail.disable('bgLine')},initSpriteBgLine:function(){var b=this.options.trail;if(!b.bgLine)return;var a=document.createElement('canvas'),d=this.spriteW=a.width=b.spriteW,e=this.spriteH=a.height=b.spriteH,c=a.getContext('2d');return c.fillStyle=this.options.trail.bgLine.color,c.fillRect(0,0,d,e),this.spriteBgLine=a,b.bgLine.sprite=a,a},initEventsAnim:function(){this.on('lifeEnd',function(){this.pause()}).on('update',function(a){this.updateAnim(a)})},genOptions:function(){return a.prototype.options=c.deepMerge(f.prototype.genOptions(),a.prototype.options)}}),h=b.dmap=b.dmap||{};h.TrailsCanvas=a,h.trailsCanvas=function(b){return new a(b)},a.prototype.genOptions(),module.exports=a

@@ -1,1 +0,1 @@

var a=require('leaflet'),b=require('jquery'),c=a.dmap=a.dmap||{},d=require('./../core/utils'),e=require('./../demo/lib/simplify'),f=a.Class.extend({isRotateZ:!1,options:{simplifyScale:0,collSpace:80,lifeSpeed:100,dataType:'simplifyData',column:{color:'rgba(253, 239, 239, 0.901961)',width:10,height:30,deg:50,opacity:.6}},initialize:function(a){this.options=d.deepMerge(this.options,a),this.columnOpts=this.options.column,this.popuperOpts=this.options.popuper},addTo:function(a){if(!a)return;this._map=a},data:function(a){this._data=a,this.columnOpts=this.options.column,this.index=0},processing:function(){return this[this.options.dataType]()},simplifyData:function(){var c=this._data,d=[],f=this.options.simplifyScale;for(var b=0;b<c.length;b++){var g=c[b].lng,h=c[b].lat,i=new a.LatLng(h,g);d.push(i)}var j=e(d,f);this.processData(j)},originalData:function(){var c=this._data,j=this.newDataCollader=[];for(var b=0;b<c.length-1;b++){var n=c[b].lng,g=c[b].lat,h=c[b+1].lng,i=c[b+1].lat,d=new a.latLng(g,n),k=new a.latLng(i,h),l=d.distanceTo(k);if(c[b].time)var e=new Date(c[b].time),f=new Date(c[b+1].time);else var e=b,f=b+1;var o=(f-e)/36e5,p=l/1e3,m=p/o;d.speed=m,j.push(d)}this.goView3D()},processData:function(c){var n=this.newDataCollader=[],k=this.options.collSpace;for(var b=0;b<c.length;b++){if(c[b+1]===undefined)var f=a.latLng(c[b].lng,c[b].lat),g=a.latLng(c[b].lng,c[b].lat);else var f=a.latLng(c[b].lng,c[b].lat),g=a.latLng(c[b+1].lng,c[b+1].lat);var m=f.distanceTo(g),e=Math.round(m/k)||1,o=c[b],l=Math.floor((Math.random()+1)/2*100);for(var d=0;d<=e-1;d++){if(c[b+1]===undefined)var i=c[b].lat+(c[b].lat-c[b].lat)*(d/e),h=c[b].lng+(c[b].lng-c[b].lng)*(d/e);else var i=c[b].lat+(c[b+1].lat-c[b].lat)*(d/e),h=c[b].lng+(c[b+1].lng-c[b].lng)*(d/e);var j=new a.LatLng(i,h);j.speed=l,n.push(j)}}this.goView3D()},goView3D:function(){console.log('asdasdasdasdasdasdasd');var c=this.map,d=this.newDataCollader,a=this;a.goView3dOpts(),b('.leaflet-marker-pane').find('.line3d').remove(),this.render3D()},goView3dOpts:function(){b('.leaflet-overlay-pane svg').css('visibility','hidden'),b('.leaflet-marker-pane').css('visibility','visible')},render3D:function(){var d=this.columns=undefined,e=this.newDataCollader;if(!this.columns){d=this.columns=[];for(var c=0;c<e.length;c++){var a=d[c]=b(' <div class="line3d"> <div class="linedrawer"></div> <div class="popuper"></div> <div class="circlebottom"></div> <div class="circletop"></div> </div>');b('.leaflet-marker-pane').append(a),this.line3dNode=a.find('.line3d'),this.linedrawerNode=a.find('.linedrawer'),this.popuperNode=a.find('.popuper')}b('.line3d').on('mouseover',function(b){var a=b.currentTarget.children[1].style;a.visibility='visible'}),b('.line3d').on('mouseout',function(b){var a=b.currentTarget.children[1].style;a.visibility='hidden'}),this.updateValue(),this.render()}},render:function(){var a=this.columnOpts,d=a.width,c=a.color;b('.linedrawer').css({'background-color':c,opacity:this.columnOpts.opacity}),this.updatePos(),this.rotate()},updatePos:function(f){var d=this.newDataCollader,e=this._map;for(var a=0;a<d.length;a++){this.heightTrans=40;var c;f?c=e._latLngToNewLayerPoint(d[a],f.zoom,f.center).round():c=e.latLngToLayerPoint(d[a]);var g=c.x,h=c.y,i='translate3d('+g+'px'+','+h+'px'+','+'0'+')',j=g+'px '+h+'px';b('.linedrawer').css({height:2});var k=this.columns;k[a].css({transform:'rotateX(90deg)'+i,'-webkitTransform':'rotateX(90deg)'+i,'-webkitTransformOrigin':j,transformOrigin:j})}},initEventsMap:function(){var a=this.updatePos.bind(this);this._map.on('zoomanim',a),requestAnimationFrame(function(){a()})},rotate:function(){this.angle=0,this.xdrag=0;var a=b(this._map._container);this._map.on('rotate',function(i,j){var c=-i.rotation,d=b('.linedrawer'),f=b('.popuper');for(var a=0;a<d.length;a++){var e=b(d[a]),g=e.attr('ytrans');e.css({transform:'rotateY('+c+'deg)'+' '+g});var h=b(f[a]);h.css('transform','rotateY('+c+'deg)')}})},updateValue:function(){var e=this.columns,g=this.newDataCollader;if(e&&this.index<e.length){var a=g[this.index].speed,f=e[this.index].find('.linedrawer');if(a>170){var c=150;f.css({transform:'scaleY('+c+')'}),f.attr('ytrans','scaleY('+c+')')}else f.css({transform:'scaleY('+a+')'}),f.attr('ytrans','scaleY('+a+')');var h=e[this.index].find('.popuper');if(a>170)var d=b('<div class="text-rotator"> <span class="span-text1">时速: 超速</span></div>');else var d=b('<div class="text-rotator"> <span class="span-text1">时速: '+Math.floor(a)+'mph'+'</span></div>');if(h.append(d),a>170){var c=150;d.css({transform:'translate3d(-60px,'+(c*2+5)+'px'+','+0+'px'+')'+' '+'rotateX('+190+'deg)'})}else d.css({transform:'translate3d(-60px,'+(a*2+5)+'px'+','+0+'px'+')'+' '+'rotateX('+190+'deg)'})}this.index++,setTimeout(this.updateValue.bind(this),this.options.lifeSpeed)}});c.TransLine=f,c.transLine=function(a){return new c.TransLine(a)},module.exports=f
var a=require('./../leaflet'),b=require('jquery'),c=a.dmap=a.dmap||{},d=require('./../core/utils'),e=require('./../demo/lib/simplify'),f=a.Class.extend({isRotateZ:!1,options:{simplifyScale:0,collSpace:80,lifeSpeed:100,dataType:'simplifyData',column:{color:'rgba(253, 239, 239, 0.901961)',width:10,height:30,deg:50,opacity:.6}},initialize:function(a){this.options=d.deepMerge(this.options,a),this.columnOpts=this.options.column,this.popuperOpts=this.options.popuper},addTo:function(a){if(!a)return;this._map=a},data:function(a){this._data=a,this.columnOpts=this.options.column,this.index=0},processing:function(){return this[this.options.dataType]()},simplifyData:function(){var c=this._data,d=[],f=this.options.simplifyScale;for(var b=0;b<c.length;b++){var g=c[b].lng,h=c[b].lat,i=new a.LatLng(h,g);d.push(i)}var j=e(d,f);this.processData(j)},originalData:function(){var c=this._data,j=this.newDataCollader=[];for(var b=0;b<c.length-1;b++){var n=c[b].lng,g=c[b].lat,h=c[b+1].lng,i=c[b+1].lat,d=new a.latLng(g,n),k=new a.latLng(i,h),l=d.distanceTo(k);if(c[b].time)var e=new Date(c[b].time),f=new Date(c[b+1].time);else var e=b,f=b+1;var o=(f-e)/36e5,p=l/1e3,m=p/o;d.speed=m,j.push(d)}this.goView3D()},processData:function(c){var n=this.newDataCollader=[],k=this.options.collSpace;for(var b=0;b<c.length;b++){if(c[b+1]===undefined)var f=a.latLng(c[b].lng,c[b].lat),g=a.latLng(c[b].lng,c[b].lat);else var f=a.latLng(c[b].lng,c[b].lat),g=a.latLng(c[b+1].lng,c[b+1].lat);var m=f.distanceTo(g),e=Math.round(m/k)||1,o=c[b],l=Math.floor((Math.random()+1)/2*100);for(var d=0;d<=e-1;d++){if(c[b+1]===undefined)var i=c[b].lat+(c[b].lat-c[b].lat)*(d/e),h=c[b].lng+(c[b].lng-c[b].lng)*(d/e);else var i=c[b].lat+(c[b+1].lat-c[b].lat)*(d/e),h=c[b].lng+(c[b+1].lng-c[b].lng)*(d/e);var j=new a.LatLng(i,h);j.speed=l,n.push(j)}}this.goView3D()},goView3D:function(){console.log('asdasdasdasdasdasdasd');var c=this.map,d=this.newDataCollader,a=this;a.goView3dOpts(),b('.leaflet-marker-pane').find('.line3d').remove(),this.render3D()},goView3dOpts:function(){b('.leaflet-overlay-pane svg').css('visibility','hidden'),b('.leaflet-marker-pane').css('visibility','visible')},render3D:function(){var d=this.columns=undefined,e=this.newDataCollader;if(!this.columns){d=this.columns=[];for(var c=0;c<e.length;c++){var a=d[c]=b(' <div class="line3d"> <div class="linedrawer"></div> <div class="popuper"></div> <div class="circlebottom"></div> <div class="circletop"></div> </div>');b('.leaflet-marker-pane').append(a),this.line3dNode=a.find('.line3d'),this.linedrawerNode=a.find('.linedrawer'),this.popuperNode=a.find('.popuper')}b('.line3d').on('mouseover',function(b){var a=b.currentTarget.children[1].style;a.visibility='visible'}),b('.line3d').on('mouseout',function(b){var a=b.currentTarget.children[1].style;a.visibility='hidden'}),this.updateValue(),this.render()}},render:function(){var a=this.columnOpts,d=a.width,c=a.color;b('.linedrawer').css({'background-color':c,opacity:this.columnOpts.opacity}),this.updatePos(),this.rotate()},updatePos:function(f){var d=this.newDataCollader,e=this._map;for(var a=0;a<d.length;a++){this.heightTrans=40;var c;f?c=e._latLngToNewLayerPoint(d[a],f.zoom,f.center).round():c=e.latLngToLayerPoint(d[a]);var g=c.x,h=c.y,i='translate3d('+g+'px'+','+h+'px'+','+'0'+')',j=g+'px '+h+'px';b('.linedrawer').css({height:2});var k=this.columns;k[a].css({transform:'rotateX(90deg)'+i,'-webkitTransform':'rotateX(90deg)'+i,'-webkitTransformOrigin':j,transformOrigin:j})}},initEventsMap:function(){var a=this.updatePos.bind(this);this._map.on('zoomanim',a),requestAnimationFrame(function(){a()})},rotate:function(){this.angle=0,this.xdrag=0;var a=b(this._map._container);this._map.on('rotate',function(i,j){var c=-i.rotation,d=b('.linedrawer'),f=b('.popuper');for(var a=0;a<d.length;a++){var e=b(d[a]),g=e.attr('ytrans');e.css({transform:'rotateY('+c+'deg)'+' '+g});var h=b(f[a]);h.css('transform','rotateY('+c+'deg)')}})},updateValue:function(){var e=this.columns,g=this.newDataCollader;if(e&&this.index<e.length){var a=g[this.index].speed,f=e[this.index].find('.linedrawer');if(a>170){var c=150;f.css({transform:'scaleY('+c+')'}),f.attr('ytrans','scaleY('+c+')')}else f.css({transform:'scaleY('+a+')'}),f.attr('ytrans','scaleY('+a+')');var h=e[this.index].find('.popuper');if(a>170)var d=b('<div class="text-rotator"> <span class="span-text1">时速: 超速</span></div>');else var d=b('<div class="text-rotator"> <span class="span-text1">时速: '+Math.floor(a)+'mph'+'</span></div>');if(h.append(d),a>170){var c=150;d.css({transform:'translate3d(-60px,'+(c*2+5)+'px'+','+0+'px'+')'+' '+'rotateX('+190+'deg)'})}else d.css({transform:'translate3d(-60px,'+(a*2+5)+'px'+','+0+'px'+')'+' '+'rotateX('+190+'deg)'})}this.index++,setTimeout(this.updateValue.bind(this),this.options.lifeSpeed)}});c.TransLine=f,c.transLine=function(a){return new c.TransLine(a)},module.exports=f

@@ -1,1 +0,1 @@

var a=require('leaflet'),b=require('jquery'),c=a.dmap=a.dmap||{},d=require('./../core/utils'),e=require('./../demo/lib/simplify'),f=a.Class.extend({isRotateZ:!1,options:{simplifyScale:0,collSpace:80,column:{color:'white',width:10,height:30,deg:50,opacity:.6}},initialize:function(a){this.options=d.deepMerge(this.options,a),this.columnOpts=this.options.column,this.popuperOpts=this.options.popuper},addTo:function(a){if(!a)return;this._map=a},data:function(a){this._data=a,this.columnOpts=this.options.column,this.index=0},simplifyData:function(){var c=this.data=this._data,k=this.map,d=[],f=this.options.simplifyScale;for(var b=0;b<c.length;b++){var g=c[b].lat,h=c[b].lng,i=new a.LatLng(h,g);d.push(i)}var j=e(d,f);this.processData(j)},processData:function(c){var n=this.newDataCollader=[],k=this.options.collSpace;for(var b=0;b<c.length;b++){if(c[b+1]===undefined)var f=a.latLng(c[b].lat,c[b].lng),g=a.latLng(c[b].lat,c[b].lng);else var f=a.latLng(c[b].lat,c[b].lng),g=a.latLng(c[b+1].lat,c[b+1].lng);var m=f.distanceTo(g),e=Math.round(m/k)||1,o=c[b],l=Math.floor((Math.random()+1)/2*100);for(var d=0;d<=e-1;d++){if(c[b+1]===undefined)var i=c[b].lat+(c[b].lat-c[b].lat)*(d/e),h=c[b].lng+(c[b].lng-c[b].lng)*(d/e);else var i=c[b].lat+(c[b+1].lat-c[b].lat)*(d/e),h=c[b].lng+(c[b+1].lng-c[b].lng)*(d/e);var j=new a.LatLng(i,h);j.speed=l,n.push(j)}}this.switchView()},switchView:function(){this.goView3D()},goView2D:function(){var c=this.map,d=this.newDataCollader,e=b('.leaflet-zoom-animated').children();b('#maprotor.titled').css('-webkit-transform','rotateX(0deg)'),b('#view-3d').css('visibility','hidden');var a=this;b('#view-3d').on('click',function(){a.goView2dOpts(),b('.leaflet-marker-pane').find('.line3d').remove()})},goView3D:function(){var e=this.map,c=this.newDataCollader,d=this;d.goView3dOpts(),b('.leaflet-marker-pane').find('.line3d').remove();for(var a=0;a<c.length;a++)this.render3D(c[a])},goView2dOpts:function(){b('#view-3d').css('visibility','hidden'),b('#view-2d').css('visibility','visible'),b('.leaflet-overlay-pane svg').css('visibility','visible'),b('.leaflet-marker-pane').css('visibility','hidden'),map.dragging.enable();var c=b('.linedrawer');for(var a=0;a<c.length;a++){var d=b(c[a]),e=d.attr('ytrans');d.css({transform:'rotateY(0deg) '+e})}},goView3dOpts:function(){b('.leaflet-overlay-pane svg').css('visibility','hidden'),b('.leaflet-marker-pane').css('visibility','visible')},render3D:function(c){var d=this.columns,c=this.singleData=c,a=this.columns=b(' <div class="line3d"> <div class="linedrawer"></div> <div class="popuper"></div> <div class="circlebottom"></div> <div class="circletop"></div> </div>');b('.leaflet-marker-pane').append(a),this.line3dNode=a.find('.line3d'),this.linedrawerNode=a.find('.linedrawer'),this.popuperNode=a.find('.popuper'),this.updateValue(),this.render()},render:function(){var a=this.columnOpts,d=a.width,c=a.color;b('.linedrawer').css({'background-color':c,opacity:this.columnOpts.opacity}),this.updatePos(),this.rotate()},updatePos:function(f){var c=this.singleData,d=this._map,e=a.latLng(c.lat,c.lng);this.heightTrans=40;var b;f?b=d._latLngToNewLayerPoint(e,f.zoom,f.center).round():b=d.latLngToLayerPoint(e);var g=b.x,h=b.y,i='translate3d('+g+'px'+','+h+'px'+','+'0'+')',j=g+'px '+h+'px',k=this.columns;k.css({transform:'rotateX(90deg)'+i,'-webkitTransform':'rotateX(90deg)'+i,'-webkitTransformOrigin':j,transformOrigin:j})},initEventsMap:function(){var a=this.updatePos.bind(this);this._map.on('zoomanim',a),requestAnimationFrame(function(){a()})},rotate:function(){this.angle=0,this.xdrag=0;var a=b(this._map._container);this._map.on('rotate',function(c,d){var a=-c.rotation;b('.linedrawer').css({transform:'rotateY('+a+'deg)'}),b('.linedrawer').css({transform:'rotateY('+a+'deg)'})})},updateValue:function(){var c=this.columns,d=this.newDataCollader;if(this.index<d.length){var a=d[this.index].speed;a=a;var f=c.find('.linedrawer');this.linedrawerNode.css({height:2}),console.log('asd'),f.css({transform:'scaleY('+a+')'});var g=c.find('.popuper'),e=b('<div class="text-rotator"> <span class="span-text1">时速: '+Math.floor(a/6-4)+'mph'+'</span></div>');g.append(e),e.css({transform:'translate3d(-50px,'+(a*2+5)+'px'+','+0+'px'+')'+' '+'rotateX('+190+'deg)'})}this.index++,setTimeout(this.updateValue.bind(this),100)}});c.TransLine=f,c.transLine=function(a){return new c.TransLine(a)},module.exports=f
var a=require('./../leaflet'),b=require('jquery'),c=a.dmap=a.dmap||{},d=require('./../core/utils'),e=require('./../demo/lib/simplify'),f=a.Class.extend({isRotateZ:!1,options:{simplifyScale:0,collSpace:80,column:{color:'white',width:10,height:30,deg:50,opacity:.6}},initialize:function(a){this.options=d.deepMerge(this.options,a),this.columnOpts=this.options.column,this.popuperOpts=this.options.popuper},addTo:function(a){if(!a)return;this._map=a},data:function(a){this._data=a,this.columnOpts=this.options.column,this.index=0},simplifyData:function(){var c=this.data=this._data,k=this.map,d=[],f=this.options.simplifyScale;for(var b=0;b<c.length;b++){var g=c[b].lat,h=c[b].lng,i=new a.LatLng(h,g);d.push(i)}var j=e(d,f);this.processData(j)},processData:function(c){var n=this.newDataCollader=[],k=this.options.collSpace;for(var b=0;b<c.length;b++){if(c[b+1]===undefined)var f=a.latLng(c[b].lat,c[b].lng),g=a.latLng(c[b].lat,c[b].lng);else var f=a.latLng(c[b].lat,c[b].lng),g=a.latLng(c[b+1].lat,c[b+1].lng);var m=f.distanceTo(g),e=Math.round(m/k)||1,o=c[b],l=Math.floor((Math.random()+1)/2*100);for(var d=0;d<=e-1;d++){if(c[b+1]===undefined)var i=c[b].lat+(c[b].lat-c[b].lat)*(d/e),h=c[b].lng+(c[b].lng-c[b].lng)*(d/e);else var i=c[b].lat+(c[b+1].lat-c[b].lat)*(d/e),h=c[b].lng+(c[b+1].lng-c[b].lng)*(d/e);var j=new a.LatLng(i,h);j.speed=l,n.push(j)}}this.switchView()},switchView:function(){this.goView3D()},goView2D:function(){var c=this.map,d=this.newDataCollader,e=b('.leaflet-zoom-animated').children();b('#maprotor.titled').css('-webkit-transform','rotateX(0deg)'),b('#view-3d').css('visibility','hidden');var a=this;b('#view-3d').on('click',function(){a.goView2dOpts(),b('.leaflet-marker-pane').find('.line3d').remove()})},goView3D:function(){var e=this.map,c=this.newDataCollader,d=this;d.goView3dOpts(),b('.leaflet-marker-pane').find('.line3d').remove();for(var a=0;a<c.length;a++)this.render3D(c[a])},goView2dOpts:function(){b('#view-3d').css('visibility','hidden'),b('#view-2d').css('visibility','visible'),b('.leaflet-overlay-pane svg').css('visibility','visible'),b('.leaflet-marker-pane').css('visibility','hidden'),map.dragging.enable();var c=b('.linedrawer');for(var a=0;a<c.length;a++){var d=b(c[a]),e=d.attr('ytrans');d.css({transform:'rotateY(0deg) '+e})}},goView3dOpts:function(){b('.leaflet-overlay-pane svg').css('visibility','hidden'),b('.leaflet-marker-pane').css('visibility','visible')},render3D:function(c){var d=this.columns,c=this.singleData=c,a=this.columns=b(' <div class="line3d"> <div class="linedrawer"></div> <div class="popuper"></div> <div class="circlebottom"></div> <div class="circletop"></div> </div>');b('.leaflet-marker-pane').append(a),this.line3dNode=a.find('.line3d'),this.linedrawerNode=a.find('.linedrawer'),this.popuperNode=a.find('.popuper'),this.updateValue(),this.render()},render:function(){var a=this.columnOpts,d=a.width,c=a.color;b('.linedrawer').css({'background-color':c,opacity:this.columnOpts.opacity}),this.updatePos(),this.rotate()},updatePos:function(f){var c=this.singleData,d=this._map,e=a.latLng(c.lat,c.lng);this.heightTrans=40;var b;f?b=d._latLngToNewLayerPoint(e,f.zoom,f.center).round():b=d.latLngToLayerPoint(e);var g=b.x,h=b.y,i='translate3d('+g+'px'+','+h+'px'+','+'0'+')',j=g+'px '+h+'px',k=this.columns;k.css({transform:'rotateX(90deg)'+i,'-webkitTransform':'rotateX(90deg)'+i,'-webkitTransformOrigin':j,transformOrigin:j})},initEventsMap:function(){var a=this.updatePos.bind(this);this._map.on('zoomanim',a),requestAnimationFrame(function(){a()})},rotate:function(){this.angle=0,this.xdrag=0;var a=b(this._map._container);this._map.on('rotate',function(c,d){var a=-c.rotation;b('.linedrawer').css({transform:'rotateY('+a+'deg)'}),b('.linedrawer').css({transform:'rotateY('+a+'deg)'})})},updateValue:function(){var c=this.columns,d=this.newDataCollader;if(this.index<d.length){var a=d[this.index].speed;a=a;var f=c.find('.linedrawer');this.linedrawerNode.css({height:2}),console.log('asd'),f.css({transform:'scaleY('+a+')'});var g=c.find('.popuper'),e=b('<div class="text-rotator"> <span class="span-text1">时速: '+Math.floor(a/6-4)+'mph'+'</span></div>');g.append(e),e.css({transform:'translate3d(-50px,'+(a*2+5)+'px'+','+0+'px'+')'+' '+'rotateX('+190+'deg)'})}this.index++,setTimeout(this.updateValue.bind(this),100)}});c.TransLine=f,c.transLine=function(a){return new c.TransLine(a)},module.exports=f

@@ -1,1 +0,1 @@

require('leaflet/dist/leaflet.css'),require('./index.css'),module.exports=require('leaflet')
require('leaflet/dist/leaflet.css'),require('./index.css'),module.exports=require('./polyfills/index.js')

@@ -5,3 +5,3 @@ {

"description": "2d map visualization lib",
"version": "0.0.97",
"version": "0.1.1",
"scripts": {

@@ -8,0 +8,0 @@ "test": "mocha -r jscoverage test"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc