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

ldmap

Package Overview
Dependencies
Maintainers
1
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.77 to 0.0.78

plugins/popup.js

2

core/utils.js

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

function b(c){var a=Math.floor(Math.random()*1e7),b=new Date().getTime();return c+'_'+b+'_'+a}function k(d,c){c||(c=p(d.target)),c=p(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(e){var c=e.length,a=0,d=n.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 d(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 e(d,e,f){var a=e.target,b=a.__data,c='child-'+d;f.fire(c,{layer:a,data:b})}function f(a,b,c,d){return typeof a==='function'?a(b,c,d):a}function g(e,h){var f,a,b,c,d=0;for(var g in e)f=e[g],a=f[h],d===0&&(b=c=a),b=Math.min(b,a),c=Math.max(c,a),d++;return[b,c]}function h(b,c){if(!b)return console.log('节点不存在');for(var a in c)b.style[a]=c[a]}function i(a){return typeof a==='number'?a.toFixed(6):a.length>7?a.substring(0,7):a}function j(a,b,c){return a=i(a),c?'<a href="#'+a+'">'+a+'</a><br>':'<div style="'+s+'"> <div style="'+s+'">'+b+': </div> <a href="#'+a+'" style="'+t+'">'+a+'</a> </div><br>'}function a(a){var e=typeof a==='array',b,c='';for(var d in a){if(b=a[d],typeof b==='object')continue;c+=j(b,d,e)}return c}var l=require('aliyun-map-utils'),m=require('./l_utils'),n=require('leaflet'),o=n.dmap=n.dmap||{},p=require('jquery'),q=require('./projection'),r=require('./curve_util'),s='margin-right:5px; color:#999;white-space:nowrap; display:inline-block;',t='white-space:nowrap;color:#fff;display:inline-block;font-weight:bold;text-decoration:none;';module.exports=o.Utils=l.merge(l,q,r,m,{getId:b,getPt:k,getRange:g,geodesicArea:c,getLengthPolyline:d,popupFromObject:a,fireEvent:e,getValue:f,applyCss:h})
function b(c){var a=Math.floor(Math.random()*1e7),b=new Date().getTime();return c+'_'+b+'_'+a}function l(d,c){c||(c=p(d.target)),c=p(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(e){var c=e.length,a=0,d=n.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 d(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 e(d,e,f){var a=e.target,b=a.__data,c='child-'+d;f.fire(c,{layer:a,data:b})}function f(a,b,c,d){return typeof a==='function'?a(b,c,d):a}function g(e,h){var f,a,b,c,d=0;for(var g in e)f=e[g],a=f[h],d===0&&(b=c=a),b=Math.min(b,a),c=Math.max(c,a),d++;return[b,c]}function h(b,c){if(!b)return console.log('节点不存在');for(var a in c)b.style[a]=c[a]}function i(a){return typeof a==='number'&&(a=a.toString()),a.length>7?a.substring(0,7):a}function j(a,b,c){return a=i(a),c?'<a href="#'+a+'">'+a+'</a><br>':'<div style="'+u+'"> <div style="'+u+'">'+b+': </div> <a href="#'+a+'" style="'+v+'">'+a+'</a> </div><br>'}function k(a){var e=typeof a==='array',b,c='';for(var d in a){if(b=a[d],typeof b==='object')continue;c+=j(b,d,e)}return c}var a=require('aliyun-map-utils'),m=require('./l_utils'),n=require('leaflet'),o=n.dmap=n.dmap||{},p=require('jquery'),q=require('./projection'),r=require('./curve_util'),s=['click','mousedown','mouseup','mouseover','mouseout'],t=['click','mouseover','mouseout'],u='margin-right:5px; color:#999;white-space:nowrap; display:inline-block;',v='white-space:nowrap;color:#fff;display:inline-block;font-weight:bold;text-decoration:none;';module.exports=o.Utils=a.merge(a,q,r,m,{getId:b,getPt:l,getRange:g,geodesicArea:c,getLengthPolyline:d,popupFromObject:k,fireEvent:e,getValue:f,applyCss:h,EVENTS:s,EVENTSBasic:t})

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

'use strict';function a(a,b,c,d,e){return typeof a==='function'?a(b,c,d,e):a}var b=require('leaflet'),c=require('./../core/utils'),d=c.isNone,e=require('./../core/utils').getColorFunc,f=e({from:'#002170',to:'#c5f2e7',easing:'Quadratic.Out.1.1',space:'rgb'}),g=b.Class.extend({includes:[b.Mixin.Events],addTo:function(a){return this._map=a,this.geojson&&this.initGeojson(),this},geoJson:function(a){if(!a)return;this.geojson=a;var b=this._map;if(!b)return;this.initGeojson()},initGeojson:function(){var a=this.options,d=this.genStyle(a.style),e=this.geojson,f=a.geoid.bind(a),g=this.layers=[],h=this,c=this.geojsonLayer=b.geoJson(e,{style:d,onEachFeature:function(a,b){var c=f(a);g[c]=b,h.initEventChild(b,a)}});c.addTo(this._map),c.bringToBack()},initEventChild:function(a,b){var d={feature:b,layer:a},f=this,g,e=this.options.popup,h=this._map,i=['mouseover','click','mouseout','mousedown'];i.forEach(function(b){a.on(b,function(){a.__data&&(d.data=a.__data),f.fire('child-'+b,d)})}),a.on('mousedown',function(i){var f=a.__data;if(e){var d=c.getTopPoint(b);g=e(f,b),h.openPopup(g,[d[1],d[0]])}})},initialize:function(a){this.options=c.deepMerge(g.options,a)},getLayer:function(a){return a&&this.layers?this.layers[a]:void 0},genStyle:function(d,e,f,g,h){var b={};for(var c in d)b[c]=a(d[c],e,f,g,h);return b},each:function(c){if(!c)return;var a=this.layers;for(var b in a)c(a[b],b)},data:function(c){this._data=c;var e=this.options.value,f,b,g,h,a=this.range=[];for(var i in c){if(f=c[i],b=e(f),d(b))continue;d(a[0])&&(a[0]=a[1]=b),g=a[0],h=a[1],b>h&&(a[1]=b),b<g&&(a[0]=b)}},render:function(a){a&&this.data(a),this.draw()},updateOptions:function(a){a=this.options=c.deepMerge(this.options,a),this.draw()},draw:function(){var d=this._data,a=this.options,i=a.style,l=a.id.bind(a),f=a.value.bind(a),c,h,b,j,k=this.layers,e=this.range;for(var g in d)c=d[g],j=f(c),h=l(c),b=k[h],b&&b.setStyle(this.genStyle(i,j,e[0],e[1])),b&&(b.__data=c)},hide:function(){console.log('目前无效')},getBounds:function(a){return this._map?this.geojsonLayer.getBounds():void 0},destory:function(){this.geojsonLayer&&this._map.removeLayer(this.geojsonLayer)}});g.options={geoid:function(b){var c=b.id||b.adcode;if(c)return c;var a=b.properties;return a?a.id||a.adcode:void 0},id:function(a){return a.id||a.adcode},value:function(a){return a.value},style:{fillColor:function(a,b,d){if(!a)return'rgba(0,150,200,1)';var c=(a-b)/(d-b);return f(c)},color:'transparent',weight:2,opacity:1,fillOpacity:1},popup:function(b,a){return a.adcode}};var h=b.dmap=b.dmap||{};h.Area=g,h.area=function(a){return new g(a)},module.exports=g
'use strict';function a(a,b,c,d,e){return typeof a==='function'?a(b,c,d,e):a}var b=require('./../leaflet'),c=require('./../core/utils'),d=c.isNone,e=require('./../core/utils').getColorFunc,f=e({from:'#002170',to:'#c5f2e7',easing:'Quadratic.Out.1.1',space:'rgb'}),g=b.Class.extend({includes:[b.Mixin.Events],addTo:function(a){return this._map=a,this.geojson&&this.initGeojson(),this},geoJson:function(a){if(!a)return;this.geojson=a;var b=this._map;if(!b)return;this.initGeojson()},initGeojson:function(){var a=this.options,d=this.genStyle(a.style),e=this.geojson,f=a.geoid.bind(a),g=this.layers=[],h=this,c=this.geojsonLayer=b.geoJson(e,{style:d,draggable:!1,onEachFeature:function(a,b){var c=f(a);g[c]=b,h.initEventChild(b,a)}});c.addTo(this._map),c.bringToBack()},initEventChild:function(a,b){var d={feature:b,layer:a},g=this,e,f=this.options.popup,h=this._map,i=c.EVENTSBasic;i.forEach(function(b){a.on(b,function(){return a.__data&&(d.data=a.__data),g.fire('child-'+b,d),!0})}),a.on('click',function(i){var g=a.__data;if(f){var d=c.getTopPoint(b);e=''+f(g,b),e&&h.openPopup(e,[d[1],d[0]])}})},initialize:function(a){this.options=c.deepMerge(g.options,a)},getLayer:function(a){return a&&this.layers?this.layers[a]:void 0},genStyle:function(d,e,f,g,h){var b={};for(var c in d)b[c]=a(d[c],e,f,g,h);return b},each:function(c){if(!c)return;var a=this.layers;for(var b in a)c(a[b],b)},data:function(c){this._data=c;var e=this.options.value,f,b,g,h,a=this.range=[];for(var i in c){if(f=c[i],b=e(f),d(b))continue;d(a[0])&&(a[0]=a[1]=b),g=a[0],h=a[1],b>h&&(a[1]=b),b<g&&(a[0]=b)}},render:function(a){a&&this.data(a),this.draw()},updateOptions:function(a){a=this.options=c.deepMerge(this.options,a),this.draw()},draw:function(){var d=this._data,a=this.options,i=a.style,l=a.id.bind(a),f=a.value.bind(a),c,h,b,j,k=this.layers,e=this.range;for(var g in d)c=d[g],j=f(c),h=l(c),b=k[h],b&&b.setStyle(this.genStyle(i,j,e[0],e[1])),b&&(b.__data=c)},hide:function(){console.log('目前无效')},getBounds:function(a){return this._map?this.geojsonLayer.getBounds():void 0},destory:function(){this.geojsonLayer&&this._map.removeLayer(this.geojsonLayer)}});g.options={geoid:function(b){var c=b.id||b.adcode;if(c)return c;var a=b.properties;return a?a.id||a.adcode:void 0},id:function(a){return a.id||a.adcode},value:function(a){return a.value},style:{fillColor:function(a,b,d){if(!a)return'rgba(0,150,200,1)';var c=(a-b)/(d-b);return f(c)},color:'transparent',weight:2,opacity:1,fillOpacity:1},popup:function(a,b){return a.adcode||a.id}};var h=b.dmap=b.dmap||{};h.Area=g,h.area=function(a){return new g(a)},module.exports=g

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

var a=require('leaflet'),b=require('jquery'),c=a.dmap=a.dmap||{},d=require('./../core/utils'),e=a.Class.extend({isRotateZ:!1,options:{column:{color:'red',width:10,height:30,deg:50,opacity:1},popuper:{color:'blue',width:75,height:15,borderRadius:1,opacity:1,top:20,left:-30}},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},init:function(){var c=this.columns,d=this._data,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.initEventsMap()},render:function(){var a=this.columnOpts,c=a.width,d=a.color,e=2;b('.linedrawer').css({'background-color':d,width:c+'px',height:e+'px',opacity:this.columnOpts.opacity}),this.updatePos(),this.rotate()},updatePos:function(f){var c=this._data,d=this._map,e=a.latLng(c.lng,c.lat);this.heightTrans=c.value||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';this.linedrawerNode.css({height:this.heightTrans});var 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()})},popUpper:function(){var d=this._data,g=this._map,e=this.popuperNode,f=d.value,c=b('<div class="text-rotator"><span class="span-text">value is '+f+'</span></div>');e.append(c);var a=this.popuperOpts;c.css({transform:'translate3d('+a.left+'px'+','+a.top+'px'+','+0+'px'+')'+' '+'rotateX('+180+'deg)','background-color':a.color,width:a.width+'px',height:a.height+'px','border-radius':a.borderRadius+'px',opacity:a.opacity})},initEventsColumn:function(){b('.line3d').on('mouseover',function(a){b(a.currentTarget).find('.popuper').css('visibility','visible')}),b('.line3d').on('mouseout',function(a){b(a.currentTarget).find('.popuper').css('visibility','hidden')})},rotate:function(){this.angle=0,this.xdrag=0;var a=this,c=b(this._map._container);this._map.on('rotate',function(c,d){var b=-c.rotation;a.linedrawerNode.css({transform:'rotateY('+b+'deg)'}),console.log(b),a.popuperNode.css({transform:'rotateY('+b+'deg)'})})}});c.Bar3D=e,c.bar3d=function(a){return new c.Bar3D(a)},module.exports=e
var a=require('./../leaflet'),b=require('jquery'),c=a.dmap=a.dmap||{},d=require('./../core/utils'),e=a.Class.extend({isRotateZ:!1,options:{column:{color:'red',width:10,height:30,deg:50,opacity:1},popuper:{color:'blue',width:75,height:15,borderRadius:1,opacity:1,top:20,left:-30}},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},init:function(){var c=this.columns,d=this._data,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.initEventsMap()},render:function(){var a=this.columnOpts,c=a.width,d=a.color,e=2;b('.linedrawer').css({'background-color':d,width:c+'px',height:e+'px',opacity:this.columnOpts.opacity}),this.updatePos(),this.rotate()},updatePos:function(f){var c=this._data,d=this._map,e=a.latLng(c.lng,c.lat);this.heightTrans=c.value||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';this.linedrawerNode.css({height:this.heightTrans});var 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()})},popUpper:function(){var d=this._data,g=this._map,e=this.popuperNode,f=d.value,c=b('<div class="text-rotator"><span class="span-text">value is '+f+'</span></div>');e.append(c);var a=this.popuperOpts;c.css({transform:'translate3d('+a.left+'px'+','+a.top+'px'+','+0+'px'+')'+' '+'rotateX('+180+'deg)','background-color':a.color,width:a.width+'px',height:a.height+'px','border-radius':a.borderRadius+'px',opacity:a.opacity})},initEventsColumn:function(){b('.line3d').on('mouseover',function(a){b(a.currentTarget).find('.popuper').css('visibility','visible')}),b('.line3d').on('mouseout',function(a){b(a.currentTarget).find('.popuper').css('visibility','hidden')})},rotate:function(){this.angle=0,this.xdrag=0;var a=this,c=b(this._map._container);this._map.on('rotate',function(c,d){var b=-c.rotation;a.linedrawerNode.css({transform:'rotateY('+b+'deg)'}),console.log(b),a.popuperNode.css({transform:'rotateY('+b+'deg)'})})}});c.Bar3D=e,c.bar3d=function(a){return new c.Bar3D(a)},module.exports=e

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

var a=require('./../map/map');require('./edit_circle.css');var b=require('bcore/utils'),c=L.Circle.extend({options:{infoNode:{className:'leaflet-edit-node no-events'}},initialize:function(b,c,a){L.Circle.prototype.initialize.call(this,b,c,a),opt=L.setOptions(a),this.id=this.options.id},addTo:function(a){return L.Circle.prototype.addTo.call(this,a),this._initEditDot(),this.addEvents(),this.addEventsEditDot(),this._onMovingEnd(),this._initInfoMarker(),this._updateCommon(),this},addEvents:function(){var a=this,b=this._container;b.addEventListener('mousedown',function(b){a._disableMarker(),a.isDown=!0}),b.addEventListener('mousemove',a._onMoving.bind(a)),b.addEventListener('mouseover',a._onHover.bind(a)),b.addEventListener('mouseout',a._onMovingEnd.bind(a)),b.addEventListener('mouseup',function(b){a.isDown=!1,a.infoMarker&&(a.infoMarker._icon.innerHTML='')})},addInfo:function(a){if(!a)return;this.info=a},addEventsEditDot:function(){var a=this,c=this.editRadiusDot,b=c._container,d=this._map;b.addEventListener('mouseover',function(a){c.setStyle({fillOpacity:.9}),a.stopPropagation(),L.DomEvent.stopPropagation(a)}),b.addEventListener('mousedown',function(b){a._initInfoMarker(),a._disableMarker(),a.isDotDown=!0,b.stopPropagation(),L.DomEvent.stopPropagation(b)}),b.addEventListener('mousemove',a._onScaling.bind(a)),b.addEventListener('mouseup',function(b){a.isDotDown=!1}),b.addEventListener('mouseout',function(b){a._onScalingEnd()})},_initEditDot:function(){var a=this.editRadiusDot=L.circleMarker(this._latlng,{radius:15,weight:0,fillColor:'#0ff',fillOpacity:0}).addTo(this._map);this._updateEditDotPos()},_initInfoMarker:function(){if(this.infoMarker)return;var a;if(!(a=this.options.infoNode))return;var b=this.icon=L.divIcon({className:a.className,html:'',iconSize:null});this.infoMarker=L.marker(this._latlng,{icon:b}).addTo(this._map)},_onHover:function(b){if(this.isEdit)return;var a=this.infoMarker._icon;a.setAttribute('class','leaflet-edit-node leaflet-edit-node-submit'),a.innerHTML='删除',this.editRadiusDot.setStyle({fillOpacity:.8}),this.setStyle({dashArray:'12, 6',weight:'2',color:'#0ff'}),b.stopPropagation()},_onMoving:function(a){if(a.stopPropagation(),L.DomEvent.stopPropagation(a),!this.isDown)return;this.isEdit=!0,this._updateCenterPos(a),this._updateInfoMoving(),this.updateEditing()},_disableMarker:function(){var a=this.infoMarker._icon;a.setAttribute('class','leaflet-edit-node no-events')},_updateMarkerPos:function(a){this.infoMarker.setLatLng(a)},_updateCenterPos:function(c){var a=this._map,d=a.mouseEventToContainerPoint(c),e=a.containerPointToLayerPoint(d),b=a.layerPointToLatLng(e);this.setLatLng(b),this._updateMarkerPos(b),c.stopPropagation(),this._updateEditDotPos()},_updateEditDotPos:function(){var b=this._getLngRadius(),a=this._latlng,c=L.latLng(a.lat,a.lng+b);this.editRadiusDot.setLatLng(c)},_onMovingEnd:function(a){if(this.isDown=!1,this.isEdit)return this.updateEdited();this.editRadiusDot.setStyle({fillOpacity:0}),this.setStyle({weight:2,dashArray:'',color:'#0ff'}),a&&L.DomEvent.stopPropagation(a),a&&a.stopPropagation()},_onScaling:function(d){if(!this.isDotDown)return;this.isEdit=!0;var e=this.editRadiusDot,a=this._map,f=a.mouseEventToContainerPoint(d),g=a.containerPointToLayerPoint(f),b=a.layerPointToLatLng(g);e.setLatLng(b);var c=this._latlng,h=c.distanceTo(L.latLng(c.lat,b.lng));this.setRadius(h),this._updateInfoScaling(),d.stopPropagation(),this.updateEditing()},_onScalingEnd:function(){if(this.isDotDown=!1,this.isEdit)return this.updateEdited();this._updateCommon()},_updateInfoMoving:function(){var a='经度'+this._latlng.lat.toFixed(5)+' | '+'纬度'+this._latlng.lng.toFixed(5);this.infoMarker._icon.innerHTML=a},_updateInfoScaling:function(){var a='半径 '+parseInt(this.getRadius())+'米';this.infoMarker._icon.innerHTML=a},_updateCommon:function(){this.editRadiusDot.setStyle({fillColor:'#0ff'}),this.setStyle({color:'#0ff',dashArray:''});var a=this.infoMarker._icon;a.setAttribute('class','leaflet-edit-node no-events'),a.innerHTML='',this._addButtonDeleteEvent()},updateEditing:function(){this.editRadiusDot.setStyle({fillColor:'#930'}),this.setStyle({color:'#930',dashArray:'12, 6'})},updateEdited:function(){if(this.editRadiusDot.setStyle({fillColor:'#930'}),this.setStyle({color:'#930',dashArray:'12, 6'}),this.infoMarker){var a=this.infoMarker._icon;a.setAttribute('class','leaflet-edit-node leaflet-edit-node-submit'),a.innerHTML=this.isUploading?'上传中..':'提交',this._addButtonSubmitEvent()}},_onOperationEnd:function(){if(this.isEdit)return this.updateEdited();this._updateCommon()},_addButtonSubmitEvent:function(){this.infoMarker._icon.removeEventListener('click'),this.infoMarker._icon.addEventListener('click',this._onSubmit.bind(this))},_addButtonDeleteEvent:function(){this.infoMarker._icon.removeEventListener('click'),this.infoMarker._icon.addEventListener('click',this._onDelete.bind(this))},_onDelete:function(){this.isUploading=!0,this.infoMarker._icon.innerHTML='删除中..',this.fire('delete')},_onSubmit:function(){this.isUploading=!0,console.log(this.infoMarker,this),this.infoMarker._icon.innerHTML='上传中..',this.fire('upload')},onCreateCallback:function(a){this.id=a,this.isUploading=!1,this.isEdit=!1,this.infoMarker._icon.removeEventListener('click'),this._updateCommon()},onModifyCallback:function(a){this.isUploading=!1,this.isEdit=!1,this.infoMarker._icon.removeEventListener('click'),this._updateCommon()},_onDeleteCallback:function(){this.destory()},destory:function(){var a=this._map;this.editRadiusDot&&a.removeLayer(this.editRadiusDot),this.infoMarker&&a.removeLayer(this.infoMarker),a.removeLayer(this)}});module.exports=c
var a=require('./../map/map'),b=require('./../leaflet');require('./edit_circle.css');var c=require('bcore/utils'),d=b.Circle.extend({options:{infoNode:{className:'leaflet-edit-node no-events'}},initialize:function(c,d,a){b.Circle.prototype.initialize.call(this,c,d,a),opt=b.setOptions(a),this.id=this.options.id},addTo:function(a){return b.Circle.prototype.addTo.call(this,a),this._initEditDot(),this.addEvents(),this.addEventsEditDot(),this._onMovingEnd(),this._initInfoMarker(),this._updateCommon(),this},addEvents:function(){var a=this,b=this._container;b.addEventListener('mousedown',function(b){a._disableMarker(),a.isDown=!0}),b.addEventListener('mousemove',a._onMoving.bind(a)),b.addEventListener('mouseover',a._onHover.bind(a)),b.addEventListener('mouseout',a._onMovingEnd.bind(a)),b.addEventListener('mouseup',function(b){a.isDown=!1,a.infoMarker&&(a.infoMarker._icon.innerHTML='')})},addInfo:function(a){if(!a)return;this.info=a},addEventsEditDot:function(){var a=this,d=this.editRadiusDot,c=d._container,e=this._map;c.addEventListener('mouseover',function(a){d.setStyle({fillOpacity:.9}),a.stopPropagation(),b.DomEvent.stopPropagation(a)}),c.addEventListener('mousedown',function(c){a._initInfoMarker(),a._disableMarker(),a.isDotDown=!0,c.stopPropagation(),b.DomEvent.stopPropagation(c)}),c.addEventListener('mousemove',a._onScaling.bind(a)),c.addEventListener('mouseup',function(b){a.isDotDown=!1}),c.addEventListener('mouseout',function(b){a._onScalingEnd()})},_initEditDot:function(){var a=this.editRadiusDot=b.circleMarker(this._latlng,{radius:15,weight:0,fillColor:'#0ff',fillOpacity:0}).addTo(this._map);this._updateEditDotPos()},_initInfoMarker:function(){if(this.infoMarker)return;var a;if(!(a=this.options.infoNode))return;var c=this.icon=b.divIcon({className:a.className,html:'',iconSize:null});this.infoMarker=b.marker(this._latlng,{icon:c}).addTo(this._map)},_onHover:function(b){if(this.isEdit)return;var a=this.infoMarker._icon;a.setAttribute('class','leaflet-edit-node leaflet-edit-node-submit'),a.innerHTML='删除',this.editRadiusDot.setStyle({fillOpacity:.8}),this.setStyle({dashArray:'12, 6',weight:'2',color:'#0ff'}),b.stopPropagation()},_onMoving:function(a){if(a.stopPropagation(),b.DomEvent.stopPropagation(a),!this.isDown)return;this.isEdit=!0,this._updateCenterPos(a),this._updateInfoMoving(),this.updateEditing()},_disableMarker:function(){var a=this.infoMarker._icon;a.setAttribute('class','leaflet-edit-node no-events')},_updateMarkerPos:function(a){this.infoMarker.setLatLng(a)},_updateCenterPos:function(c){var a=this._map,d=a.mouseEventToContainerPoint(c),e=a.containerPointToLayerPoint(d),b=a.layerPointToLatLng(e);this.setLatLng(b),this._updateMarkerPos(b),c.stopPropagation(),this._updateEditDotPos()},_updateEditDotPos:function(){var c=this._getLngRadius(),a=this._latlng,d=b.latLng(a.lat,a.lng+c);this.editRadiusDot.setLatLng(d)},_onMovingEnd:function(a){if(this.isDown=!1,this.isEdit)return this.updateEdited();this.editRadiusDot.setStyle({fillOpacity:0}),this.setStyle({weight:2,dashArray:'',color:'#0ff'}),a&&b.DomEvent.stopPropagation(a),a&&a.stopPropagation()},_onScaling:function(e){if(!this.isDotDown)return;this.isEdit=!0;var f=this.editRadiusDot,a=this._map,g=a.mouseEventToContainerPoint(e),h=a.containerPointToLayerPoint(g),c=a.layerPointToLatLng(h);f.setLatLng(c);var d=this._latlng,i=d.distanceTo(b.latLng(d.lat,c.lng));this.setRadius(i),this._updateInfoScaling(),e.stopPropagation(),this.updateEditing()},_onScalingEnd:function(){if(this.isDotDown=!1,this.isEdit)return this.updateEdited();this._updateCommon()},_updateInfoMoving:function(){var a='经度'+this._latlng.lat.toFixed(5)+' | '+'纬度'+this._latlng.lng.toFixed(5);this.infoMarker._icon.innerHTML=a},_updateInfoScaling:function(){var a='半径 '+parseInt(this.getRadius())+'米';this.infoMarker._icon.innerHTML=a},_updateCommon:function(){this.editRadiusDot.setStyle({fillColor:'#0ff'}),this.setStyle({color:'#0ff',dashArray:''});var a=this.infoMarker._icon;a.setAttribute('class','leaflet-edit-node no-events'),a.innerHTML='',this._addButtonDeleteEvent()},updateEditing:function(){this.editRadiusDot.setStyle({fillColor:'#930'}),this.setStyle({color:'#930',dashArray:'12, 6'})},updateEdited:function(){if(this.editRadiusDot.setStyle({fillColor:'#930'}),this.setStyle({color:'#930',dashArray:'12, 6'}),this.infoMarker){var a=this.infoMarker._icon;a.setAttribute('class','leaflet-edit-node leaflet-edit-node-submit'),a.innerHTML=this.isUploading?'上传中..':'提交',this._addButtonSubmitEvent()}},_onOperationEnd:function(){if(this.isEdit)return this.updateEdited();this._updateCommon()},_addButtonSubmitEvent:function(){this.infoMarker._icon.removeEventListener('click'),this.infoMarker._icon.addEventListener('click',this._onSubmit.bind(this))},_addButtonDeleteEvent:function(){this.infoMarker._icon.removeEventListener('click'),this.infoMarker._icon.addEventListener('click',this._onDelete.bind(this))},_onDelete:function(){this.isUploading=!0,this.infoMarker._icon.innerHTML='删除中..',this.fire('delete')},_onSubmit:function(){this.isUploading=!0,console.log(this.infoMarker,this),this.infoMarker._icon.innerHTML='上传中..',this.fire('upload')},onCreateCallback:function(a){this.id=a,this.isUploading=!1,this.isEdit=!1,this.infoMarker._icon.removeEventListener('click'),this._updateCommon()},onModifyCallback:function(a){this.isUploading=!1,this.isEdit=!1,this.infoMarker._icon.removeEventListener('click'),this._updateCommon()},_onDeleteCallback:function(){this.destory()},destory:function(){var a=this._map;this.editRadiusDot&&a.removeLayer(this.editRadiusDot),this.infoMarker&&a.removeLayer(this.infoMarker),a.removeLayer(this)}});module.exports=d

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

var a=require('./../map/map'),b=require('bcore/event'),c=require('bcore/utils'),d=require('./edit_circle'),e=b.extend({options:{},initialize:function(a){a=this.options=c.deepMerge(this.options,a)},addTo:function(a){this._map=a},addCircle:function(e){var a=this._map,b=1e3,c=new d(e,b,{id:null}).addTo(a);this.initEventsCircle(c)},render:function(e){var f=this.circles=[],a,g,b,c,h,i=this._map;for(var j in e)a=e[j],b=a.id,c=a.center,h=a.radius,g=f[b]=new d([c.lat,c.lng],h,{id:b}).addTo(i),this.initEventsCircle(g)},initEventsCircle:function(b){var a=this;b.on('upload',function(){var c=this._latlng,f=this.getRadius(),d={type:'circle',unit:'m',lat:c.lat,lng:c.lng,radius:f},e={query:d,circle:b};if(this.id)return d.id=this.id,a.emit('modify',e);a.emit('create',e)}).on('delete',function(){if(this._onDeleteCallback(),this.id===null||this.id===undefined)return;a.emit('delete',{id:this.id})})}});L.dmap=L.dmap||{},L.dmap.editCircles=function(a){return new e(a)},module.exports=e
var a=require('./../map/map'),b=require('bcore/event'),c=require('bcore/utils'),d=require('./edit_circle'),e=require('./../leaflet'),f=b.extend({options:{},initialize:function(a){a=this.options=c.deepMerge(this.options,a)},addTo:function(a){this._map=a},addCircle:function(e){var a=this._map,b=1e3,c=new d(e,b,{id:null}).addTo(a);this.initEventsCircle(c)},render:function(e){var f=this.circles=[],a,g,b,c,h,i=this._map;for(var j in e)a=e[j],b=a.id,c=a.center,h=a.radius,g=f[b]=new d([c.lat,c.lng],h,{id:b}).addTo(i),this.initEventsCircle(g)},initEventsCircle:function(b){var a=this;b.on('upload',function(){var c=this._latlng,f=this.getRadius(),d={type:'circle',unit:'m',lat:c.lat,lng:c.lng,radius:f},e={query:d,circle:b};if(this.id)return d.id=this.id,a.emit('modify',e);a.emit('create',e)}).on('delete',function(){if(this._onDeleteCallback(),this.id===null||this.id===undefined)return;a.emit('delete',{id:this.id})})}});e.dmap=e.dmap||{},e.dmap.editCircles=function(a){return new f(a)},module.exports=f

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

function a(b){b=this.options=d.deepMerge(a.options,b),b.interactiveLine.kHeight=b.kHeight,b.displayLine.kHeight=b.kHeight,this.initialize(b)}var b=require('leaflet'),c=require('./flyingLinePath'),d=require('./../core/utils'),e=b.dmap=b.dmap||{},f=require('./../core/anim_view');a.options={isAutoStart:!1,lifeMin:0,lifeMax:1,isPopupHover:0,lifeEnd:'destroy',range:.8,lifeSpeed:.08,kHeight:.5,interactiveLine:{weight:5,color:'rgba(250,150,50,0.0)',colorHover:'rgba(250,150,50,0.1)'},displayLine:{weight:1}},a.options=d.deepMerge(f.options,a.options),a=f.extend(a,{isInit:!1,life:0,initialize:function(a){this._map&&this.addTo(this._map),this.id=this.options.id||d.getId('flyingLine'),this.isLive=!1,this.isLooping=!0},checkIfEnd:function(){this.life>=this.options.lifeMax+this.options.range&&this._onLifeEnd()},addTo:function(a){return this._map=a,this.init(),this.initEvents(),this},init:function(){if(this.isInit||!this._map)return;this.initInteractiveLine(),this.initDisplayLine(),this.isInit=!0},initDisplayLine:function(){throw'必须实现initDisplayLine方法'},initInteractiveLine:function(){var f=this.options,g=this._map,a=this,b=f.interactiveLine;if(b.kHeight=f.kHeight,!b)return;var e=this.interactivePath=new c(b);e.addTo(g);var d=e._path;d.setAttribute('fill','none'),d.setAttribute('stroke',b.color),d.setAttribute('stroke-width',b.weight),d.setAttribute('stroke-linecap','round'),d.setAttribute('stroke-linejoin','round'),e.on('mouseover',function(c){d.setAttribute('stroke',b.colorHover),a.emit('mouseover',a.record),f.isPopupHover&&e.openPopup()}).on('mouseout',function(c){d.setAttribute('stroke',b.color),f.isPopupHover&&e.closePopup(),a.emit('mouseout',a.record)}).on('mousedown',function(b){a.resume(),a.fireEvent('mouseout',e),a.emit('mousedown',a.record)}).on('click',function(b){a.emit('click',a.record)})},setPopupContent:function(a){this.interactivePath&&this.interactivePath.setPopupContent(a)},data:function(a){if(!(a&&a.from&&a.to))return console.log('无数据/数据格式有问题');this._data=a,this.updateData(a),this.bindPopup(),this.reset(),this.options.isAutoStart&&this.resume(),this.record={data:a,layer:this}},render:function(a){a&&this.data(a),this.draw()},draw:function(){this.fireEvent('lifestart',{latlng:this.displayPath.from,data:this._data}),this.startAnim()},initEvents:function(){this.on('update',this.updateLife.bind(this)).on('lifeEnd',function(b){var a=this.options.lifeEnd;return a==='loop'?this.restart():a==='hide'?this.hide():a==='destroy'?this.destroy():void 0})},updateOptions:function(a){a=this.options=d.deepMerge(this.options,a),this.updateOptionsInteractiveLine&&this.updateOptionsInteractiveLine(),this.updateOptionsDisplayLine&&this.updateOptionsDisplayLine(),a.interactiveLine.kHeight=a.kHeight,this.interactivePath&&this.interactivePath.updateOptions(a.interactiveLine),a.displayLine.kHeight=a.kHeight,this.displayPath&&this.displayPath.updateOptions(a.displayLine)},updateLife:function(a){if(!this.isLive)return;this.updateInteractiveLine&&this.updateInteractiveLine(a),this.updateDisplayLine&&this.updateDisplayLine(a)},updateData:function(a){this.interactivePath&&this.interactivePath.data(a),this.displayPath&&this.displayPath.data(a)},bindPopup:function(a,b){if(a=a||this.bindHTML,!a)return;if(!this._data)return this.bindHTML=a;b=d.deepMerge({maxWidth:800,autoPan:!1},b),typeof a==='function'&&(a=a(this._data||{})),this.interactivePath.bindPopup(a,b),this.bindHTML=null},hide:function(){this.life=0,this.isLive=!1,this.interactivePath&&this.interactivePath.hide(),this.displayPath&&this.displayPath.hide(),this.fire('hide')},pause:function(){this.isLooping=!1,this.isLive=!1,cancelAnimationFrame(this.loopid),this.loopid=null,this.fire('pause')},resume:function(){if(this.isLive)return;var a=this.options;setTimeout(function(){}.bind(this)),this.isLive=!0,this.loop(),this.fire('resume')},loop:function(){if(!this.isLooping)return;this._updateLife(),this.loopid=requestAnimationFrame(this.loop.bind(this))},isEnd:function(){return this.life>this.options.lifeMax},reset:function(){var a=this.options;this.life=a.lifeMin},destroy:function(){this.pause(),this.off(),this.life=0,this.isLive=!1,this.interactivePath&&this.interactivePath.destroy(),this.displayPath&&this.displayPath.destroy()}}),e.FlyingLine=a,e.flyingLine=function(b){return new a(b)},module.exports=a
function a(b){b=this.options=d.deepMerge(a.options,b),b.interactiveLine.kHeight=b.kHeight,b.displayLine.kHeight=b.kHeight,this.initialize(b)}var b=require('./../leaflet'),c=require('./flyingLinePath'),d=require('./../core/utils'),e=b.dmap=b.dmap||{},f=require('./../core/anim_view');a.options={isAutoStart:!1,lifeMin:0,lifeMax:1,isPopupHover:0,lifeEnd:'destroy',range:.8,lifeSpeed:.08,kHeight:.5,interactiveLine:{weight:5,color:'rgba(250,150,50,0.0)',colorHover:'rgba(250,150,50,0.1)'},displayLine:{weight:1}},a.options=d.deepMerge(f.options,a.options),a=f.extend(a,{isInit:!1,life:0,initialize:function(a){this._map&&this.addTo(this._map),this.id=this.options.id||d.getId('flyingLine'),this.isLive=!1,this.isLooping=!0},checkIfEnd:function(){this.life>=this.options.lifeMax+this.options.range&&this._onLifeEnd()},addTo:function(a){return this._map=a,this.init(),this.initEvents(),this},init:function(){if(this.isInit||!this._map)return;this.initInteractiveLine(),this.initDisplayLine(),this.isInit=!0},initDisplayLine:function(){throw'必须实现initDisplayLine方法'},initInteractiveLine:function(){var f=this.options,g=this._map,a=this,b=f.interactiveLine;if(b.kHeight=f.kHeight,!b)return;var e=this.interactivePath=new c(b);e.addTo(g);var d=e._path;d.setAttribute('fill','none'),d.setAttribute('stroke',b.color),d.setAttribute('stroke-width',b.weight),d.setAttribute('stroke-linecap','round'),d.setAttribute('stroke-linejoin','round'),e.on('mouseover',function(c){d.setAttribute('stroke',b.colorHover),a.emit('mouseover',a.record),f.isPopupHover&&e.openPopup()}).on('mouseout',function(c){d.setAttribute('stroke',b.color),f.isPopupHover&&e.closePopup(),a.emit('mouseout',a.record)}).on('mousedown',function(b){a.resume(),a.fireEvent('mouseout',e),a.emit('mousedown',a.record)}).on('click',function(b){a.emit('click',a.record)})},setPopupContent:function(a){this.interactivePath&&this.interactivePath.setPopupContent(a)},data:function(a){if(!(a&&a.from&&a.to))return console.log('无数据/数据格式有问题');this._data=a,this.updateData(a),this.bindPopup(),this.reset(),this.options.isAutoStart&&this.resume(),this.record={data:a,layer:this}},render:function(a){a&&this.data(a),this.draw()},draw:function(){this.fireEvent('lifestart',{latlng:this.displayPath.from,data:this._data}),this.startAnim()},initEvents:function(){this.on('update',this.updateLife.bind(this)).on('lifeEnd',function(b){var a=this.options.lifeEnd;return a==='loop'?this.restart():a==='hide'?this.hide():a==='destroy'?this.destroy():void 0})},updateOptions:function(a){a=this.options=d.deepMerge(this.options,a),this.updateOptionsInteractiveLine&&this.updateOptionsInteractiveLine(),this.updateOptionsDisplayLine&&this.updateOptionsDisplayLine(),a.interactiveLine.kHeight=a.kHeight,this.interactivePath&&this.interactivePath.updateOptions(a.interactiveLine),a.displayLine.kHeight=a.kHeight,this.displayPath&&this.displayPath.updateOptions(a.displayLine)},updateLife:function(a){if(!this.isLive)return;this.updateInteractiveLine&&this.updateInteractiveLine(a),this.updateDisplayLine&&this.updateDisplayLine(a)},updateData:function(a){this.interactivePath&&this.interactivePath.data(a),this.displayPath&&this.displayPath.data(a)},bindPopup:function(a,b){if(a=a||this.bindHTML,!a)return;if(!this._data)return this.bindHTML=a;b=d.deepMerge({maxWidth:800,autoPan:!1},b),typeof a==='function'&&(a=a(this._data||{})),this.interactivePath.bindPopup(a,b),this.bindHTML=null},hide:function(){this.life=0,this.isLive=!1,this.interactivePath&&this.interactivePath.hide(),this.displayPath&&this.displayPath.hide(),this.fire('hide')},pause:function(){this.isLooping=!1,this.isLive=!1,cancelAnimationFrame(this.loopid),this.loopid=null,this.fire('pause')},resume:function(){if(this.isLive)return;var a=this.options;setTimeout(function(){}.bind(this)),this.isLive=!0,this.loop(),this.fire('resume')},loop:function(){if(!this.isLooping)return;this._updateLife(),this.loopid=requestAnimationFrame(this.loop.bind(this))},isEnd:function(){return this.life>this.options.lifeMax},reset:function(){var a=this.options;this.life=a.lifeMin},destroy:function(){this.pause(),this.off(),this.life=0,this.isLive=!1,this.interactivePath&&this.interactivePath.destroy(),this.displayPath&&this.displayPath.destroy()}}),e.FlyingLine=a,e.flyingLine=function(b){return new a(b)},module.exports=a

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

function a(b){b=this.options=e.deepMerge(a.options,b),this.initialize(b)}var b=require('leaflet'),c=require('./flyingLine'),d=require('./flyingLinePath'),e=require('./../core/utils'),f=b.dmap=b.dmap||{};a.options={interactiveLine:{weight:5,color:'rgba(250,150,50,0.0)',colorHover:'rgba(250,150,50,0.2)'},displayLine:{dashSpeed:30,dashArray:'2,4,8,16',color:'rgba(250,150,50,1)',weight:3}},a.options=e.deepMerge(c.options,a.options),a=c.extend(a,{initialize:function(b){var b=e.deepMerge(a.options,b);c.prototype.initialize.call(this,b)},initDisplayLine:function(){var e=this._map,f=this.options,g=this._data,b=f.displayLine,c=this.displayPath=new d(this.opt);c.addTo(e),c.data(g);var a=c._path;a.setAttribute('pointer-events','none'),a.setAttribute('fill','none'),a.setAttribute('stroke',b.color),a.setAttribute('stroke-width',b.weight),a.setAttribute('stroke-dasharray',b.dashArray),a.setAttribute('stroke-linecap','round'),a.setAttribute('stroke-linejoin','round')},updateDisplayLine:function(){var a=this.life,b=Math.floor(a*this.options.displayLine.dashSpeed);this.displayPath._path.setAttribute('stroke-dashoffset',-b)}}),f.FlyingLineDash=a,f.flyingLineDash=function(a){return new f.FlyingLineDash(a)},module.exports=a
function a(b){b=this.options=e.deepMerge(a.options,b),this.initialize(b)}var b=require('./../leaflet'),c=require('./flyingLine'),d=require('./flyingLinePath'),e=require('./../core/utils'),f=b.dmap=b.dmap||{};a.options={interactiveLine:{weight:5,color:'rgba(250,150,50,0.0)',colorHover:'rgba(250,150,50,0.2)'},displayLine:{dashSpeed:30,dashArray:'2,4,8,16',color:'rgba(250,150,50,1)',weight:3}},a.options=e.deepMerge(c.options,a.options),a=c.extend(a,{initialize:function(b){var b=e.deepMerge(a.options,b);c.prototype.initialize.call(this,b)},initDisplayLine:function(){var e=this._map,f=this.options,g=this._data,b=f.displayLine,c=this.displayPath=new d(this.opt);c.addTo(e),c.data(g);var a=c._path;a.setAttribute('pointer-events','none'),a.setAttribute('fill','none'),a.setAttribute('stroke',b.color),a.setAttribute('stroke-width',b.weight),a.setAttribute('stroke-dasharray',b.dashArray),a.setAttribute('stroke-linecap','round'),a.setAttribute('stroke-linejoin','round')},updateDisplayLine:function(){var a=this.life,b=Math.floor(a*this.options.displayLine.dashSpeed);this.displayPath._path.setAttribute('stroke-dashoffset',-b)}}),f.FlyingLineDash=a,f.flyingLineDash=function(a){return new f.FlyingLineDash(a)},module.exports=a

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

function a(b){b=this.options=c.deepMerge(a.options,b),b.interactiveLine.kHeight=b.kHeight,b.displayLine.kHeight=b.kHeight,this.initialize(b)}var b=require('leaflet'),c=require('./../core/utils'),d=require('./flyingLine'),e=require('./flyingLinePath');a.options={opacity:1,displayLine:{colorTo:'rgba(250,150,50,1)',colorFrom:'rgba(255,0,0,0)',colorNormal:'rgba(250,250,250,0.2)'}},a.options=c.deepMerge(d.options,a.options),a=d.extend(a,{initDisplayLine:function(){var d=this._map,h=this._data,b=this.displayPath=new e(this.options.displayLine);b.addTo(d);var i=b.id,c=b._path,f=this.options,g=b.linearGradientId;this.linearGradient=b.linearGradient;var a=f.displayLine;this.createStop('a',{offset:'0%','stop-color':a.colorNormal}).createStop('b',{offset:'0%','stop-color':a.colorNormal}).createStop('c',{offset:'0%','stop-color':a.colorFrom}).createStop('d',{offset:'0%','stop-color':a.colorTo}).createStop('e',{offset:'0%','stop-color':a.colorNormal}).createStop('f',{offset:'100%','stop-color':a.colorNormal}),c.setAttribute('pointer-events','none'),c.setAttribute('fill','none'),c.setAttribute('stroke','url(#'+g+')'),c.setAttribute('stroke-linecap','round'),c.setAttribute('stroke-linejoin','round')},updateOptionsDisplayLine:function(){var a=this.options.displayLine;this.stop1a&&this.stop1a.setAttribute('stop-color',a.colorNormal),this.stop1b&&this.stop1b.setAttribute('stop-color',a.colorNormal),this.stop1c&&this.stop1c.setAttribute('stop-color',a.colorFrom),this.stop1d&&this.stop1d.setAttribute('stop-color',a.colorTo),this.stop1e&&this.stop1e.setAttribute('stop-color',a.colorNormal),this.stop1f&&this.stop1f.setAttribute('stop-color',a.colorNormal)},createStop:function(b,d){var e=this.id+'stop1',f=this['stop1'+b+'ID']=e+b,g='stop1'+b,h=this.linearGradient,a=this[g]=document.createElementNS('http://www.w3.org/2000/svg','stop');a.setAttribute('id',f);for(var c in d)a.setAttribute(c,d[c]);return h.appendChild(a),this},updateDisplayLine:function(a){if(!a)return;var e=this.options,d=e.range,c,b;if(d>a?(c=0,b=a):a<1?(c=a-d,b=a):a>1&&a<1+d&&(c=a-d,b=1),!b)return;c=Math.floor(c*100)+'%',b=Math.floor(b*100)+'%',this.stop1b&&this.stop1b.setAttribute('offset',c),this.stop1c&&this.stop1c.setAttribute('offset',c),this.stop1d&&this.stop1d.setAttribute('offset',b),this.stop1e&&this.stop1e.setAttribute('offset',b)},genOptions:function(){return a.prototype.options=c.deepMerge(d.prototype.genOptions(),a.prototype.options)}},d),a.prototype.genOptions();var f=b.dmap=b.dmap||{};f.FlyingLineGradient=a,f.flyingLineGradient=function(b){return new a(b)},module.exports=a
function a(b){b=this.options=c.deepMerge(a.options,b),b.interactiveLine.kHeight=b.kHeight,b.displayLine.kHeight=b.kHeight,this.initialize(b)}var b=require('./../leaflet'),c=require('./../core/utils'),d=require('./flyingLine'),e=require('./flyingLinePath');a.options={opacity:1,displayLine:{colorTo:'rgba(250,150,50,1)',colorFrom:'rgba(255,0,0,0)',colorNormal:'rgba(250,250,250,0.2)'}},a.options=c.deepMerge(d.options,a.options),a=d.extend(a,{initDisplayLine:function(){var d=this._map,h=this._data,b=this.displayPath=new e(this.options.displayLine);b.addTo(d);var i=b.id,c=b._path,f=this.options,g=b.linearGradientId;this.linearGradient=b.linearGradient;var a=f.displayLine;this.createStop('a',{offset:'0%','stop-color':a.colorNormal}).createStop('b',{offset:'0%','stop-color':a.colorNormal}).createStop('c',{offset:'0%','stop-color':a.colorFrom}).createStop('d',{offset:'0%','stop-color':a.colorTo}).createStop('e',{offset:'0%','stop-color':a.colorNormal}).createStop('f',{offset:'100%','stop-color':a.colorNormal}),c.setAttribute('pointer-events','none'),c.setAttribute('fill','none'),c.setAttribute('stroke','url(#'+g+')'),c.setAttribute('stroke-linecap','round'),c.setAttribute('stroke-linejoin','round')},updateOptionsDisplayLine:function(){var a=this.options.displayLine;this.stop1a&&this.stop1a.setAttribute('stop-color',a.colorNormal),this.stop1b&&this.stop1b.setAttribute('stop-color',a.colorNormal),this.stop1c&&this.stop1c.setAttribute('stop-color',a.colorFrom),this.stop1d&&this.stop1d.setAttribute('stop-color',a.colorTo),this.stop1e&&this.stop1e.setAttribute('stop-color',a.colorNormal),this.stop1f&&this.stop1f.setAttribute('stop-color',a.colorNormal)},createStop:function(b,d){var e=this.id+'stop1',f=this['stop1'+b+'ID']=e+b,g='stop1'+b,h=this.linearGradient,a=this[g]=document.createElementNS('http://www.w3.org/2000/svg','stop');a.setAttribute('id',f);for(var c in d)a.setAttribute(c,d[c]);return h.appendChild(a),this},updateDisplayLine:function(a){if(!a)return;var e=this.options,d=e.range,c,b;if(d>a?(c=0,b=a):a<1?(c=a-d,b=a):a>1&&a<1+d&&(c=a-d,b=1),!b)return;c=Math.floor(c*100)+'%',b=Math.floor(b*100)+'%',this.stop1b&&this.stop1b.setAttribute('offset',c),this.stop1c&&this.stop1c.setAttribute('offset',c),this.stop1d&&this.stop1d.setAttribute('offset',b),this.stop1e&&this.stop1e.setAttribute('offset',b)},genOptions:function(){return a.prototype.options=c.deepMerge(d.prototype.genOptions(),a.prototype.options)}},d),a.prototype.genOptions();var f=b.dmap=b.dmap||{};f.FlyingLineGradient=a,f.flyingLineGradient=function(b){return new a(b)},module.exports=a

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

var a=require('leaflet'),b=require('./../core/utils'),c=a.dmap=a.dmap||{},d=a.Path.extend({options:{weight:10,opacity:1,color:'blue',kHeight:.5},initialize:function(c){this.options=b.deepMerge(this.options,c),this.isInit=!1,a.Path.prototype.initialize.call(this,c)},initSvg:function(){if(this.isInit)return;var f=this.options,g=b.getId('flyingPath2d'),i=f.color,h=this.linearGradientId=g+'grad',d=document.getElementsByTagName('svg')[0];if(!d)return console.log('svg节点尚未建立');var c=document.getElementsByTagName('defs')[0];c||(c=document.createElementNS('http://www.w3.org/2000/svg','defs'),d.appendChild(c));var e=this._path;if(!e)return console.log('path不存在');var a=this.linearGradient=document.createElementNS('http://www.w3.org/2000/svg','linearGradient');this.direction==='left'&&(a.setAttribute('x1','100%'),a.setAttribute('y1','0%'),a.setAttribute('x2','0%'),a.setAttribute('y2','0%')),a.setAttribute('id',h),c.appendChild(a),this._init&&this._init(e,a),this.isInit=!0},updateOptions:function(a){a=this.options=b.deepMerge(this.options,a),this._path.setAttribute('stroke-width',a.weight),this.updatePath(),this.redraw()},data:function(b){if(!(b&&b.from&&b.to))return;this._data=b;var d=this.from=a.latLng(b.from.lat,b.from.lng),e=this.to=a.latLng(b.to.lat,b.to.lng);this._latlngs=[d,e];var c=this.linearGradient;e.lng>d.lng?(this.direction='right',c.setAttribute('x1','0%'),c.setAttribute('x2','100%')):(this.direction='left',c.setAttribute('x1','100%'),c.setAttribute('x2','0%')),this.wake(),this.updatePath(),this.redraw(),this.addEventsMap()},addTo:function(a){return a?(this._map=a,a.addLayer(this),this.initSvg(),this.updatePath(),this.redraw(),this):void 0},addEventsMap:function(){this._map.on('viewreset',this.updatePath.bind(this)),this.updatePath()},updatePath:function(){var d=this.from,c=this.to,g=this.options;if(!(d&&c))return;var e=this._map,j=g.kHeight,a=this.fromPt=e.latLngToLayerPoint([d.lat,d.lng]),b=this.toPt=e.latLngToLayerPoint([c.lat,c.lng]),i=(b.x+a.x)/2,f=(b.y+a.y)/2,k=b.x-a.x,h=k*j;f+=-Math.abs(h),this._customData='M'+a.x+' '+a.y+' '+'Q'+' '+i+' '+f+' '+b.x+' '+b.y,this.getPathString()},getPathString:function(){var a=this._customData;return a instanceof Array?a.join(' '):a},hide:function(){this._path.setAttribute('display','none')},wake:function(){this._path.setAttribute('display','block')},destroy:function(){var a=document.getElementsByTagName('defs')[0],b=document.getElementById(this.linearGradientId);b&&a&&a.removeChild(b);var e=this._path,c=e.parentNode,d=document.getElementsByTagName('svg')[0];if(c&&d)try{d.removeChild(c)}catch(a){}}});c.FlyingLinePath=d,c.flyingLinePath=function(a){return new c.FlyingLinePath(a)},module.exports=d
var a=require('./../leaflet'),b=require('./../core/utils'),c=a.dmap=a.dmap||{},d=a.Path.extend({options:{weight:10,opacity:1,color:'blue',kHeight:.5},initialize:function(c){this.options=b.deepMerge(this.options,c),this.isInit=!1,a.Path.prototype.initialize.call(this,c)},initSvg:function(){if(this.isInit)return;var f=this.options,g=b.getId('flyingPath2d'),i=f.color,h=this.linearGradientId=g+'grad',d=document.getElementsByTagName('svg')[0];if(!d)return console.log('svg节点尚未建立');var c=document.getElementsByTagName('defs')[0];c||(c=document.createElementNS('http://www.w3.org/2000/svg','defs'),d.appendChild(c));var e=this._path;if(!e)return console.log('path不存在');var a=this.linearGradient=document.createElementNS('http://www.w3.org/2000/svg','linearGradient');this.direction==='left'&&(a.setAttribute('x1','100%'),a.setAttribute('y1','0%'),a.setAttribute('x2','0%'),a.setAttribute('y2','0%')),a.setAttribute('id',h),c.appendChild(a),this._init&&this._init(e,a),this.isInit=!0},updateOptions:function(a){a=this.options=b.deepMerge(this.options,a),this._path.setAttribute('stroke-width',a.weight),this.updatePath(),this.redraw()},data:function(b){if(!(b&&b.from&&b.to))return;this._data=b;var d=this.from=a.latLng(b.from.lat,b.from.lng),e=this.to=a.latLng(b.to.lat,b.to.lng);this._latlngs=[d,e];var c=this.linearGradient;e.lng>d.lng?(this.direction='right',c.setAttribute('x1','0%'),c.setAttribute('x2','100%')):(this.direction='left',c.setAttribute('x1','100%'),c.setAttribute('x2','0%')),this.wake(),this.updatePath(),this.redraw(),this.addEventsMap()},addTo:function(a){return a?(this._map=a,a.addLayer(this),this.initSvg(),this.updatePath(),this.redraw(),this):void 0},addEventsMap:function(){this._map.on('viewreset',this.updatePath.bind(this)),this.updatePath()},updatePath:function(){var d=this.from,c=this.to,g=this.options;if(!(d&&c))return;var e=this._map,j=g.kHeight,a=this.fromPt=e.latLngToLayerPoint([d.lat,d.lng]),b=this.toPt=e.latLngToLayerPoint([c.lat,c.lng]),i=(b.x+a.x)/2,f=(b.y+a.y)/2,k=b.x-a.x,h=k*j;f+=-Math.abs(h),this._customData='M'+a.x+' '+a.y+' '+'Q'+' '+i+' '+f+' '+b.x+' '+b.y,this.getPathString()},getPathString:function(){var a=this._customData;return a instanceof Array?a.join(' '):a},hide:function(){this._path.setAttribute('display','none')},wake:function(){this._path.setAttribute('display','block')},destroy:function(){var a=document.getElementsByTagName('defs')[0],b=document.getElementById(this.linearGradientId);b&&a&&a.removeChild(b);var e=this._path,c=e.parentNode,d=document.getElementsByTagName('svg')[0];if(c&&d)try{d.removeChild(c)}catch(a){}}});c.FlyingLinePath=d,c.flyingLinePath=function(a){return new c.FlyingLinePath(a)},module.exports=d

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

function a(b){b=this.options=f.deepMerge(a.options,b)}var b=require('leaflet'),c=require('./flyingLineGradient'),d=require('./flyingLineDash'),e=require('bcore/event'),f=require('bcore/utils'),g=b.dmap=b.dmap||{};a.options={lineN:100,type:'gradient',flying:{lifeEnd:'hide',lifeSpeed:.01,kHeight:1.3,displayLine:{colorTo:'rgba(250,150,50,1)',colorFrom:'rgba(255,0,0,1)',colorNormal:'rgba(250,250,250,0.1)'},interactiveLine:{}}},a=e.extend(a,{isInit:!1,isLive:!0,life:0,addTo:function(a){return this._map=a,this.init(),this.initEvents(),this},init:function(){var b=this.options,f=b.lineN,g=b.flying,h=this._map,i={gradient:c,dash:d}[b.type],j=this.unusing=[];this.using=[];var k=this.lines=[],a;for(var e=0;e<f;e++)a=new i(g),a.addTo(h),this.initEventsLine(a),j.push(a),k.push(a);this.loop()},data:function(a){this._data=a},render:function(a){a&&this.data(a),this.draw()},draw:function(){var b=this._data,c,a,e=this.using,d=this.unusing;for(var f in b)c=b[f],d.length&&c&&(a=d.pop(),a.data(c),a.resume(),e.push(a))},checkLine:function(a,b,c){if(a.life<=a.options.lifeMax+a.options.range-a.options.lifeSpeed*2)return;this.disableLine(a,b,c)},disableLine:function(a,b,c){c.splice(b,1),a.pause(),a.hide(),this.unusing.push(a)},initEventsLine:function(b){var a=this;b.on('mouseover',function(c){b.pause(),a.emit('child-mouseover',c)}).on('mouseout',function(c){b.resume(),a.emit('child-mouseout',c)}).on('click',function(b){a.emit('child-click',b)})},update:function(){this.updateLife()},updateOptions:function(a){this.options=f.deepMerge(this.options,a),this.each(function(b){b.updateOptions(a.flying)})},initEvents:function(){},loop:function(){this.update(),window.requestAnimationFrame(this.loop.bind(this))},updateLife:function(){var b=this.using,c;for(var a=b.length-1;a>=0;a--)c=b[a],c.isLive&&c._updateLife(),this.checkLine(c,a,b)},each:function(a){return this.lines.forEach(a)}}),g.FlyingLines=a,g.flyingLine=function(b){return new a(b)},module.exports=a
function a(b){b=this.options=f.deepMerge(a.options,b)}var b=require('./../leaflet'),c=require('./flyingLineGradient'),d=require('./flyingLineDash'),e=require('bcore/event'),f=require('bcore/utils'),g=b.dmap=b.dmap||{};a.options={lineN:100,type:'gradient',flying:{lifeEnd:'hide',lifeSpeed:.01,kHeight:1.3,displayLine:{colorTo:'rgba(250,150,50,1)',colorFrom:'rgba(255,0,0,1)',colorNormal:'rgba(250,250,250,0.1)'},interactiveLine:{}}},a=e.extend(a,{isInit:!1,isLive:!0,life:0,addTo:function(a){return this._map=a,this.init(),this.initEvents(),this},init:function(){var b=this.options,f=b.lineN,g=b.flying,h=this._map,i={gradient:c,dash:d}[b.type],j=this.unusing=[];this.using=[];var k=this.lines=[],a;for(var e=0;e<f;e++)a=new i(g),a.addTo(h),this.initEventsLine(a),j.push(a),k.push(a);this.loop()},data:function(a){this._data=a},render:function(a){a&&this.data(a),this.draw()},draw:function(){var b=this._data,c,a,e=this.using,d=this.unusing;for(var f in b)c=b[f],d.length&&c&&(a=d.pop(),a.data(c),a.resume(),e.push(a))},checkLine:function(a,b,c){if(a.life<=a.options.lifeMax+a.options.range-a.options.lifeSpeed*2)return;this.disableLine(a,b,c)},disableLine:function(a,b,c){c.splice(b,1),a.pause(),a.hide(),this.unusing.push(a)},initEventsLine:function(b){var a=this;b.on('mouseover',function(c){b.pause(),a.emit('child-mouseover',c)}).on('mouseout',function(c){b.resume(),a.emit('child-mouseout',c)}).on('click',function(b){a.emit('child-click',b)})},update:function(){this.updateLife()},updateOptions:function(a){this.options=f.deepMerge(this.options,a),this.each(function(b){b.updateOptions(a.flying)})},initEvents:function(){},loop:function(){this.update(),window.requestAnimationFrame(this.loop.bind(this))},updateLife:function(){var b=this.using,c;for(var a=b.length-1;a>=0;a--)c=b[a],c.isLive&&c._updateLife(),this.checkLine(c,a,b)},each:function(a){return this.lines.forEach(a)}}),g.FlyingLines=a,g.flyingLine=function(b){return new a(b)},module.exports=a

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

function a(a,b){return typeof a==='function'?a(b):a}function b(a){a=this.options=f.deepMerge(b.options,a),this.updateStyle()}var c=require('leaflet'),e=require('bcore/event'),f=require('bcore/utils'),g=require('./../render/canvas'),h=require('./../core/utils').getColorFunc,i=c.dmap=c.dmap||{};b.options={container:'overlayPane',featureId:function(a,b){return a.properties&&a.properties.adcode?a.properties.adcode:b},id:function(){return d.adcode},value:function(a){return a.value},lat:function(a){return a[1]},lng:function(a){return a[0]},style:{lineWidth:2,fill:function(a){return'#0ff'}}},b=e.extend(b,{init:function(){this.initCanvas()},initCanvas:function(){var b=this._map,a=this.options,c=a.container,d=this.dCanvas=new g(b,c,a);this.ctx=d.ctx},addTo:function(a){this._map=a,this.init(),this.initEventsMap()},updateStyle:function(){var a=this.options.style;a.fill&&(a.fill=h(a.fill)),a.stroke&&(a.stroke=h(a.stroke))},geojson:function(g){var b=g.features,e=this.options,c={};for(var a=0;a<b.length;a++){var d=b[a],f=e.featureId(d,a);c[f]=d}this.features=c},data:function(a){var e=this.options;if(Array.isArray(a)){var c,f,d={};for(var b=0;b<a.length;b++)c=a[b],f=e.id(c),d[f]=c;a=d}this._data=a},render:function(a){a&&this.data(a),this.draw()},draw:function(){var d=this.options,h=this._data||{},a=this.features;if(!a)return console.log('没有地理数据 -> geojsonCanvas.geojson(geojson)');var e,b,f,i=d.value.bind(d),g,c=0;for(id in a)e=a[id],b=e.geometry||e,g=h[id],g&&(c=i(g)),f=b.type,f==='MultiPolygon'?this.renderMultiPolygon(b,c):f==='Polygon'&&this.renderPolygon(b,c)},initEventsMap:function(){this.dCanvas.onUpdate(function(){this.draw()}.bind(this))},renderMultiPolygon:function(t,s){var b=this.ctx,r=this._map,g=this.options,q=g.lat,n=g.lng,e=g.style;e.fill&&(b.fillStyle=a(e.fill,s)),e.stroke&&(b.strokeStyle=a(e.stroke,s));var k=t.coordinates,m,i,l,d,o,p;for(var h=0;h<k.length;h++){m=k[h];for(var f=0;f<m.length;f++){i=m[f],b.beginPath();var j;for(var c=0;c<i.length;c++)l=i[c],o=q(l),p=n(l),d=r.latLngToContainerPoint({lat:o,lng:p}),c===0?(b.moveTo(d.x,d.y),j=d):b.lineTo(d.x,d.y),c===i.length-1&&b.lineTo(j.x,j.y);b.fill(),b.stroke(),b.closePath()}}},renderPolygon:function(q,n){var b=this.ctx,m=this._map,g=this.options,k=g.lat,l=g.lng,c=g.style;c.fill&&(b.fillStyle=a(c.fill,n)),c.stroke&&(b.strokeStyle=a(c.stroke,n)),c.lineWidth&&(b.lineWidth=c.lineWidth);var i=q.coordinates,h,j,d,o,p;for(var f=0;f<i.length;f++){h=i[f],b.beginPath();for(var e=0;e<h.length;e++)j=h[e],o=k(j),p=l(j),d=m.latLngToContainerPoint({lat:o,lng:p}),e===0?b.moveTo(d.x,d.y):b.lineTo(d.x,d.y);b.fill(),b.stroke(),b.closePath()}}}),b.prototype.geoJson=b.prototype.geojson,c.dmap.geoJsonCanvas=function(a){return new b(a)},c.dmap.GeoJsonCanvas=b,module.exports=b
function a(a,b){return typeof a==='function'?a(b):a}function b(a){a=this.options=f.deepMerge(b.options,a),this.updateStyle()}var c=require('./../leaflet'),e=require('bcore/event'),f=require('bcore/utils'),g=require('./../render/canvas'),h=require('./../core/utils').getColorFunc,i=c.dmap=c.dmap||{};b.options={container:'overlayPane',featureId:function(a,b){return a.properties&&a.properties.adcode?a.properties.adcode:b},id:function(){return d.adcode},value:function(a){return a.value},lat:function(a){return a[1]},lng:function(a){return a[0]},style:{lineWidth:2,fill:function(a){return'#0ff'}}},b=e.extend(b,{init:function(){this.initCanvas()},initCanvas:function(){var b=this._map,a=this.options,c=a.container,d=this.dCanvas=new g(b,c,a);this.ctx=d.ctx},addTo:function(a){this._map=a,this.init(),this.initEventsMap()},updateStyle:function(){var a=this.options.style;a.fill&&(a.fill=h(a.fill)),a.stroke&&(a.stroke=h(a.stroke))},geojson:function(g){var b=g.features,e=this.options,c={};for(var a=0;a<b.length;a++){var d=b[a],f=e.featureId(d,a);c[f]=d}this.features=c},data:function(a){var e=this.options;if(Array.isArray(a)){var c,f,d={};for(var b=0;b<a.length;b++)c=a[b],f=e.id(c),d[f]=c;a=d}this._data=a},render:function(a){a&&this.data(a),this.draw()},draw:function(){var d=this.options,h=this._data||{},a=this.features;if(!a)return console.log('没有地理数据 -> geojsonCanvas.geojson(geojson)');var e,b,f,i=d.value.bind(d),g,c=0;for(id in a)e=a[id],b=e.geometry||e,g=h[id],g&&(c=i(g)),f=b.type,f==='MultiPolygon'?this.renderMultiPolygon(b,c):f==='Polygon'&&this.renderPolygon(b,c)},initEventsMap:function(){this.dCanvas.onUpdate(function(){this.draw()}.bind(this))},renderMultiPolygon:function(t,s){var b=this.ctx,r=this._map,g=this.options,q=g.lat,n=g.lng,e=g.style;e.fill&&(b.fillStyle=a(e.fill,s)),e.stroke&&(b.strokeStyle=a(e.stroke,s));var k=t.coordinates,m,i,l,d,o,p;for(var h=0;h<k.length;h++){m=k[h];for(var f=0;f<m.length;f++){i=m[f],b.beginPath();var j;for(var c=0;c<i.length;c++)l=i[c],o=q(l),p=n(l),d=r.latLngToContainerPoint({lat:o,lng:p}),c===0?(b.moveTo(d.x,d.y),j=d):b.lineTo(d.x,d.y),c===i.length-1&&b.lineTo(j.x,j.y);b.fill(),b.stroke(),b.closePath()}}},renderPolygon:function(q,n){var b=this.ctx,m=this._map,g=this.options,k=g.lat,l=g.lng,c=g.style;c.fill&&(b.fillStyle=a(c.fill,n)),c.stroke&&(b.strokeStyle=a(c.stroke,n)),c.lineWidth&&(b.lineWidth=c.lineWidth);var i=q.coordinates,h,j,d,o,p;for(var f=0;f<i.length;f++){h=i[f],b.beginPath();for(var e=0;e<h.length;e++)j=h[e],o=k(j),p=l(j),d=m.latLngToContainerPoint({lat:o,lng:p}),e===0?b.moveTo(d.x,d.y):b.lineTo(d.x,d.y);b.fill(),b.stroke(),b.closePath()}}}),b.prototype.geoJson=b.prototype.geojson,c.dmap.geoJsonCanvas=function(a){return new b(a)},c.dmap.GeoJsonCanvas=b,module.exports=b

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

'use strict';var a=require('leaflet'),b=require('@ali/map-utils'),c=b.Grid,d=b.getColorFunc,e=a.Class.extend({aggregatedData:{},includes:[a.Mixin.Events],initialize:function(a){a=this.options=b.deepMerge(e.options,a),this.check(),this.getMax=a.getMax,this.grids=[]},check:function(){var a=this.options;if(!a.appid)throw'必须要设定 appid';if(!a.mapid)throw'必须要设定 mapid';if(!a.data)throw'必须要设定 热力图接口'},addTo:function(b){if(this._map||!b)return;this._map=b;var d=this.options.grid;this.gridEncoder=new c().transform(function(i,m){var d=b.getSize(),e=d.x/2,f=d.y/2,h=e-i,j=f+m,k=e+i,l=f-m,g=b.containerPointToLatLng(a.point(h,j)),c=b.containerPointToLatLng(a.point(k,l));return{dlat:c.lat-g.lat,dlng:c.lng-g.lng}}).shape('rect').rx(d.rx).ry(d.ry).update(),this.initEventsMap(),this.refresh()},data:function(a){if(!a)return this._data;this._data=a;var b=this.options;b.isAutoUpdate&&this._map&&this.draw(),this.updateColor()},initEventsMap:function(){this._map.on('moveend',this.refresh.bind(this))},refresh:function(e){var b=this,a=this.options,c=a.data,d={appid:a.appid,bbox:this.getBounds(),indicator:a.indicator,zoom:this._map.getZoom()};c(d,b.render.bind(this))},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[[a.lat-d,b.lat+d],[a.lng-e,b.lng+e]]},updateColor:function(d,h,i,j){if(!d)return;var e=this.getColor=b.getColorFunc(d,h,i,j),a=this.gridMap,c,f;for(var g in a)c=a[g],f=c._value,c.setStyle({fillColor:e(f)})},_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)})},render:function(a){a&&this.data(a),this.draw()},clean:function(){var a=this.grids,b=this._map;for(var c in a)b.removeLayer(a[c]);this.grids=[]},draw:function(){this.clean();var l=this.grids,f=this.options,t=this.gridEncoder,m=f.grid.normal,n=d(f.color),o=f.value,g=this._data,s=this.gridMap,p=this._map,c,h,i,j,k;for(var r in g){var b=g[r];j=b[0],h=b[1],k=b[2],i=b[3];var q=[a.latLng(h,j),a.latLng(i,j),a.latLng(i,k),a.latLng(h,k)],e=o(b);if(c=a.polygon(q,m).addTo(p),c.setStyle({fillColor:n(e)}),c._value=e,c._heatdata=b,l.push(c),this.initEventsGrid(c),!this.scaleGridFunc)continue;this.scaleGridFunc(c,e)}},initEventsGrid:function(a){var c=this,j=this.aggregatedData,d=this.options.grid,e=d.click||{},g=d.mouseover||{},f=d.normal||{},h=a._gridid,i=a._heatdata,b={gridid:h,data:i};a.on('mouseover',function(d){g&&a.setStyle(g),c.fire('grid-mouseover',b),a.bringToFront()}).on('mouseout',function(d){f&&a.setStyle(f),c.fire('grid-mouseout',b)}).on('mousedown',function(d){e&&a.setStyle(e),c.fire('grid-click',b)}).on('dblclick',function(a){c.fire('grid-dblclick',b)})}});e.options={appid:null,mapid:null,clusterStepByZoom:1,isAutoUpdate:!0,isNeedAggregate:!0,grid:{mouseover:{opacity:1,color:'#fff',fillOpacity:1},normal:{opacity:0,weight:1,fillOpacity:1},click:{},rx:30,ry:25},color:d('rgba(62,18,0,0.8)','rgba(255,208,122,0.8)','hsl','linear.Out.1.4'),lng:b.getLng,lat:b.getLat,scale:function(a){return 1},value:function(a,b,c){return a[4]}};var f=a.dmap=a.dmap||{};f.HeatmapGrid=e,f.heatmapGrid=function(a){return e(a)},e.getSizeList=function(u,s,d){var w=d.getCenter(),q=d.getSize(),k=q.x/2,j=q.y/2,v=k-u,i=j+s,m=k+u,t=j-s,h=d.containerPointToLatLng(a.point(v,i)),f=d.containerPointToLatLng(a.point(m,t)),l=d.containerPointToLatLng(a.point(m,i)),r=f.lat-h.lat,n=f.lng-h.lng,o=h.distanceTo(l),p=f.distanceTo(l),e=d.getZoom(),g=[];for(var b=1;b<e;b++){var c=Math.pow(2,e-b);g[b]={zoom:b,dx:o*c,dy:p*c,dlat:r*c,dlng:n*c}}for(var b=e;b<19;b++){var c=Math.pow(.5,b-e);g[b]={zoom:b,dx:o*c,dy:p*c,dlat:r*c,dlng:n*c}}return g},module.exports=e
'use strict';var a=require('./../leaflet'),b=require('@ali/map-utils'),c=b.Grid,d=b.getColorFunc,e=a.Class.extend({aggregatedData:{},includes:[a.Mixin.Events],initialize:function(a){a=this.options=b.deepMerge(e.options,a),this.check(),this.getMax=a.getMax,this.grids=[]},check:function(){var a=this.options;if(!a.appid)throw'必须要设定 appid';if(!a.mapid)throw'必须要设定 mapid';if(!a.data)throw'必须要设定 热力图接口'},addTo:function(b){if(this._map||!b)return;this._map=b;var d=this.options.grid;this.gridEncoder=new c().transform(function(i,m){var d=b.getSize(),e=d.x/2,f=d.y/2,h=e-i,j=f+m,k=e+i,l=f-m,g=b.containerPointToLatLng(a.point(h,j)),c=b.containerPointToLatLng(a.point(k,l));return{dlat:c.lat-g.lat,dlng:c.lng-g.lng}}).shape('rect').rx(d.rx).ry(d.ry).update(),this.initEventsMap(),this.refresh()},data:function(a){if(!a)return this._data;this._data=a;var b=this.options;b.isAutoUpdate&&this._map&&this.draw(),this.updateColor()},initEventsMap:function(){this._map.on('moveend',this.refresh.bind(this))},refresh:function(e){var b=this,a=this.options,c=a.data,d={appid:a.appid,bbox:this.getBounds(),indicator:a.indicator,zoom:this._map.getZoom()};c(d,b.render.bind(this))},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[[a.lat-d,b.lat+d],[a.lng-e,b.lng+e]]},updateColor:function(d,h,i,j){if(!d)return;var e=this.getColor=b.getColorFunc(d,h,i,j),a=this.gridMap,c,f;for(var g in a)c=a[g],f=c._value,c.setStyle({fillColor:e(f)})},_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)})},render:function(a){a&&this.data(a),this.draw()},clean:function(){var a=this.grids,b=this._map;for(var c in a)b.removeLayer(a[c]);this.grids=[]},draw:function(){this.clean();var l=this.grids,f=this.options,t=this.gridEncoder,m=f.grid.normal,n=d(f.color),o=f.value,g=this._data,s=this.gridMap,p=this._map,c,h,i,j,k;for(var r in g){var b=g[r];j=b[0],h=b[1],k=b[2],i=b[3];var q=[a.latLng(h,j),a.latLng(i,j),a.latLng(i,k),a.latLng(h,k)],e=o(b);if(c=a.polygon(q,m).addTo(p),c.setStyle({fillColor:n(e)}),c._value=e,c._heatdata=b,l.push(c),this.initEventsGrid(c),!this.scaleGridFunc)continue;this.scaleGridFunc(c,e)}},initEventsGrid:function(a){var c=this,j=this.aggregatedData,d=this.options.grid,e=d.click||{},g=d.mouseover||{},f=d.normal||{},h=a._gridid,i=a._heatdata,b={gridid:h,data:i};a.on('mouseover',function(d){g&&a.setStyle(g),c.fire('grid-mouseover',b),a.bringToFront()}).on('mouseout',function(d){f&&a.setStyle(f),c.fire('grid-mouseout',b)}).on('mousedown',function(d){e&&a.setStyle(e),c.fire('grid-click',b)}).on('dblclick',function(a){c.fire('grid-dblclick',b)})}});e.options={appid:null,mapid:null,clusterStepByZoom:1,isAutoUpdate:!0,isNeedAggregate:!0,grid:{mouseover:{opacity:1,color:'#fff',fillOpacity:1},normal:{opacity:0,weight:1,fillOpacity:1},click:{},rx:30,ry:25},color:d('rgba(62,18,0,0.8)','rgba(255,208,122,0.8)','hsl','linear.Out.1.4'),lng:b.getLng,lat:b.getLat,scale:function(a){return 1},value:function(a,b,c){return a[4]}};var f=a.dmap=a.dmap||{};f.HeatmapGrid=e,f.heatmapGrid=function(a){return e(a)},e.getSizeList=function(u,s,d){var w=d.getCenter(),q=d.getSize(),k=q.x/2,j=q.y/2,v=k-u,i=j+s,m=k+u,t=j-s,h=d.containerPointToLatLng(a.point(v,i)),f=d.containerPointToLatLng(a.point(m,t)),l=d.containerPointToLatLng(a.point(m,i)),r=f.lat-h.lat,n=f.lng-h.lng,o=h.distanceTo(l),p=f.distanceTo(l),e=d.getZoom(),g=[];for(var b=1;b<e;b++){var c=Math.pow(2,e-b);g[b]={zoom:b,dx:o*c,dy:p*c,dlat:r*c,dlng:n*c}}for(var b=e;b<19;b++){var c=Math.pow(.5,b-e);g[b]={zoom:b,dx:o*c,dy:p*c,dlat:r*c,dlng:n*c}}return g},module.exports=e

@@ -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('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=f.extend(a,{initialize:function(a){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.getColor=c.getColorFunc(a.shape.color||a.color),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 f=this.drawid='id_'+Math.floor(Math.random()*1e10),j=this.options,u=this.gridEncoder,p=j.shape.style,r=this.getColor,t=j.value,k=this.aggregatedData,c=this.gridMap,i=this._map,e=this.getBounds(),a,w=e.latMax,x=e.latMin,y=e.lngMax,z=e.lngMin;for(var d in k){var s=k[d],l=u.decode(d),m=l.center,v=l.pts,n=m[0],o=m[1];if(n<x||o<z||n>w||o>y)continue;var h=t(s),q=r(h);a=c[d],a?(a.setStyle({fillColor:q}),a._drawid=f):(p.fillColor=q,a=c[d]=b.polygon(v,p).addTo(i),a._value=h,a._gridid=d,a._drawid=f,this.initEventsGrid(a),this.scaleGridFunc&&this.scaleGridFunc(a,h))}for(var g in c)c[g]._drawid!==f&&(i.removeLayer(c[g]),delete c[g]);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.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 g=b.dmap=b.dmap||{};g.HeatmapGrid=a,g.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('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=f.extend(a,{initialize:function(a){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.getColor=c.getColorFunc(a.shape.color||a.color),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 f=this.drawid='id_'+Math.floor(Math.random()*1e10),j=this.options,u=this.gridEncoder,p=j.shape.style,r=this.getColor,t=j.value,k=this.aggregatedData,c=this.gridMap,i=this._map,e=this.getBounds(),a,w=e.latMax,x=e.latMin,y=e.lngMax,z=e.lngMin;for(var d in k){var s=k[d],l=u.decode(d),m=l.center,v=l.pts,n=m[0],o=m[1];if(n<x||o<z||n>w||o>y)continue;var h=t(s),q=r(h);a=c[d],a?(a.setStyle({fillColor:q}),a._drawid=f):(p.fillColor=q,a=c[d]=b.polygon(v,p).addTo(i),a._value=h,a._gridid=d,a._drawid=f,this.initEventsGrid(a),this.scaleGridFunc&&this.scaleGridFunc(a,h))}for(var g in c)c[g]._drawid!==f&&(i.removeLayer(c[g]),delete c[g]);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.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 g=b.dmap=b.dmap||{};g.HeatmapGrid=a,g.heatmapGrid=function(b){return a(b)},module.exports=a

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

'use strict';var a=require('leaflet'),b=require('@ali/map-utils'),c=b.Grid,d=b.getColorFunc,e=a.Class.extend({lines:[{id:'format'},{id:'bind'},{id:'events'}],nodes:{data:{schema:{shapeHash:{type:'string',desc:'类似geohash 对形态的编码'}}},shape:{pts:['lat','lng']}},emits:{'grid-resize':{desc:'格子大小发生变化'},'grid-mouseover':{desc:'鼠标移至格子范围'},'grid-dblclick':{desc:'双击格子'},'grid-mouseout':{desc:'鼠标移出格子范围'},'grid-click':{desc:'点击某个格子'}},options:{clusterStepByZoom:1,isAutoUpdate:!0,isNeedAggregate:!0,grid:{mouseover:{fillOpacity:.8,color:'rgba(255,255,255,0.9)'},mouseout:{fillOpacity:1,color:'rgba(255,255,255,0.0)'},click:{},weight:1,color:'rgba(255,255,255,0)',fillOpacity:1,rx:30,ry:25},getColor:d('rgba(62,18,0,0.8)','rgba(255,208,122,0.8)','hsl','linear.Out.1.4'),lng:b.getLng,lat:b.getLat,scale:function(a){return 1},value:function(a,b,c){return Math.min(1,a.length/b)}},gridMap:{},aggregatedData:{},includes:[a.Mixin.Events],initialize:function(a){a=b.deepMerge(this.options,a),this.getMax=a.getMax,this.getColor=b.getColorFunc(a.getColor),this.getScale=b.getColorFunc(a.scale)},addTo:function(b){if(this._map||!b)return;this._map=b;var d=this.options.grid;this.gridEncoder=new c().transform(function(i,m){var d=b.getSize(),e=d.x/2,f=d.y/2,h=e-i,j=f+m,k=e+i,l=f-m,g=b.containerPointToLatLng(a.point(h,j)),c=b.containerPointToLatLng(a.point(k,l));return{dlat:c.lat-g.lat,dlng:c.lng-g.lng}}).shape('rect').rx(d.rx).ry(d.ry).update(),this.initEventsMap(),this._data&&this.updateZoom()},data:function(a){if(!a)return this._data;this._data=a;var b=this.options;b.isAutoUpdate&&this._map&&this.updateZoom(),this.updateColor()},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,c=a.clusterStepByZoom,d=this._map;if(a.isNeedAggregate){var e=d.getZoom(),b=Math.floor(e/c);if(b===this.zoomLevel)return;this.gridEncoder.update(),this.zoomLevel=b,this.clean(),this.aggregate(),this.fire('grid-resize'),this._updateTransformOrigin()}},aggregate:function(){var h=this.gridEncoder,c,d=this.options,e=this.aggregatedData,b,f=this._data,a,i=d.lat,j=d.lng;for(var g in f)a=f[g],b=h.encode(i(a),j(a)),c=e[b],c?c.push(a):e[b]=[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]}this.aggregatedData={}},remove:function(){this.clean()},link:function(){},updateColor:function(d,h,i,j){if(!d)return;var e=this.getColor=b.getColorFunc(d,h,i,j),a=this.gridMap,c,f;for(var g in a)c=a[g],f=c._value,c.setStyle({fillColor:e(f)})},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)})},render:function(a){a&&this.data(a),this.draw()},draw:function(){var m=this.options,n=this.gridEncoder,h=m.grid,u=this.getColor,w=m.value,g=this.aggregatedData,i=this.gridMap,t=this._map,c=this.getBounds(),d,x=c.latMax,r=c.latMin,o=c.lngMax,p=c.lngMin,q=40;for(var b in g){var s=g[b],j=n.decode(b),k=j.center,v=j.pts,l=k[0],f=k[1];if(l<r||f<p||l>x||f>o)continue;var e=w(s,q,0);if(!i[b]){if(h.fillColor=u(e),d=i[b]=a.polygon(v,h).addTo(t),d._value=e,d._gridid=b,this.initEventsGrid(d),!this.scaleGridFunc)continue;this.scaleGridFunc(d,e)}}},initEventsGrid:function(a){var b=this,i=this.aggregatedData,d=this.options.grid,e=d.click||{},f=d.mouseover||{},g=d.mouseout||{},h=a._gridid,c={gridid:h,data:i[h]};a.on('mouseover',function(d){f&&a.setStyle(f),b.fire('grid-mouseover',c),a.bringToFront()}).on('mouseout',function(d){g&&a.setStyle(g),b.fire('grid-mouseout',c)}).on('mousedown',function(d){e&&a.setStyle(e),b.fire('grid-click',c)}).on('dblclick',function(a){b.fire('grid-dblclick',c)})}}),f=a.dmap=a.dmap||{};f.HeatmapGrid=e,f.heatmapGrid=function(a){return e(a)},module.exports=e
'use strict';var a=require('./../leaflet'),b=require('@ali/map-utils'),c=b.Grid,d=b.getColorFunc,e=a.Class.extend({lines:[{id:'format'},{id:'bind'},{id:'events'}],nodes:{data:{schema:{shapeHash:{type:'string',desc:'类似geohash 对形态的编码'}}},shape:{pts:['lat','lng']}},emits:{'grid-resize':{desc:'格子大小发生变化'},'grid-mouseover':{desc:'鼠标移至格子范围'},'grid-dblclick':{desc:'双击格子'},'grid-mouseout':{desc:'鼠标移出格子范围'},'grid-click':{desc:'点击某个格子'}},options:{clusterStepByZoom:1,isAutoUpdate:!0,isNeedAggregate:!0,grid:{mouseover:{fillOpacity:.8,color:'rgba(255,255,255,0.9)'},mouseout:{fillOpacity:1,color:'rgba(255,255,255,0.0)'},click:{},weight:1,color:'rgba(255,255,255,0)',fillOpacity:1,rx:30,ry:25},getColor:d('rgba(62,18,0,0.8)','rgba(255,208,122,0.8)','hsl','linear.Out.1.4'),lng:b.getLng,lat:b.getLat,scale:function(a){return 1},value:function(a,b,c){return Math.min(1,a.length/b)}},gridMap:{},aggregatedData:{},includes:[a.Mixin.Events],initialize:function(a){a=b.deepMerge(this.options,a),this.getMax=a.getMax,this.getColor=b.getColorFunc(a.getColor),this.getScale=b.getColorFunc(a.scale)},addTo:function(b){if(this._map||!b)return;this._map=b;var d=this.options.grid;this.gridEncoder=new c().transform(function(i,m){var d=b.getSize(),e=d.x/2,f=d.y/2,h=e-i,j=f+m,k=e+i,l=f-m,g=b.containerPointToLatLng(a.point(h,j)),c=b.containerPointToLatLng(a.point(k,l));return{dlat:c.lat-g.lat,dlng:c.lng-g.lng}}).shape('rect').rx(d.rx).ry(d.ry).update(),this.initEventsMap(),this._data&&this.updateZoom()},data:function(a){if(!a)return this._data;this._data=a;var b=this.options;b.isAutoUpdate&&this._map&&this.updateZoom(),this.updateColor()},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,c=a.clusterStepByZoom,d=this._map;if(a.isNeedAggregate){var e=d.getZoom(),b=Math.floor(e/c);if(b===this.zoomLevel)return;this.gridEncoder.update(),this.zoomLevel=b,this.clean(),this.aggregate(),this.fire('grid-resize'),this._updateTransformOrigin()}},aggregate:function(){var h=this.gridEncoder,c,d=this.options,e=this.aggregatedData,b,f=this._data,a,i=d.lat,j=d.lng;for(var g in f)a=f[g],b=h.encode(i(a),j(a)),c=e[b],c?c.push(a):e[b]=[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]}this.aggregatedData={}},remove:function(){this.clean()},link:function(){},updateColor:function(d,h,i,j){if(!d)return;var e=this.getColor=b.getColorFunc(d,h,i,j),a=this.gridMap,c,f;for(var g in a)c=a[g],f=c._value,c.setStyle({fillColor:e(f)})},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)})},render:function(a){a&&this.data(a),this.draw()},draw:function(){var m=this.options,n=this.gridEncoder,h=m.grid,u=this.getColor,w=m.value,g=this.aggregatedData,i=this.gridMap,t=this._map,c=this.getBounds(),d,x=c.latMax,r=c.latMin,o=c.lngMax,p=c.lngMin,q=40;for(var b in g){var s=g[b],j=n.decode(b),k=j.center,v=j.pts,l=k[0],f=k[1];if(l<r||f<p||l>x||f>o)continue;var e=w(s,q,0);if(!i[b]){if(h.fillColor=u(e),d=i[b]=a.polygon(v,h).addTo(t),d._value=e,d._gridid=b,this.initEventsGrid(d),!this.scaleGridFunc)continue;this.scaleGridFunc(d,e)}}},initEventsGrid:function(a){var b=this,i=this.aggregatedData,d=this.options.grid,e=d.click||{},f=d.mouseover||{},g=d.mouseout||{},h=a._gridid,c={gridid:h,data:i[h]};a.on('mouseover',function(d){f&&a.setStyle(f),b.fire('grid-mouseover',c),a.bringToFront()}).on('mouseout',function(d){g&&a.setStyle(g),b.fire('grid-mouseout',c)}).on('mousedown',function(d){e&&a.setStyle(e),b.fire('grid-click',c)}).on('dblclick',function(a){b.fire('grid-dblclick',c)})}}),f=a.dmap=a.dmap||{};f.HeatmapGrid=e,f.heatmapGrid=function(a){return e(a)},module.exports=e

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

var a=require('leaflet'),b=a.dmap=a.dmap||{};a.MarkerClusterGroup=a.FeatureGroup.extend({options:{maxClusterRadius:80,iconCreateFunction:null,spiderfyOnMaxZoom:!0,showCoverageOnHover:!0,zoomToBoundsOnClick:!0,singleMarkerMode:!1,disableClusteringAtZoom:null,removeOutsideVisibleBounds:!0,animateAddingMarkers:!1,spiderfyDistanceMultiplier:1,polygonOptions:{}},initialize:function(b){a.Util.setOptions(this,b),this.options.iconCreateFunction||(this.options.iconCreateFunction=this._defaultIconCreateFunction),this._featureGroup=a.featureGroup(),this._featureGroup.on(a.FeatureGroup.EVENTS,this._propagateEvent,this),this._nonPointGroup=a.featureGroup(),this._nonPointGroup.on(a.FeatureGroup.EVENTS,this._propagateEvent,this),this._inZoomAnimation=0,this._needsClustering=[],this._needsRemoving=[],this._currentShownBounds=null,this._queue=[]},addLayer:function(b){if(b instanceof a.LayerGroup){var d=[];for(var e in b._layers)d.push(b._layers[e]);return this.addLayers(d)}if(!b.getLatLng)return this._nonPointGroup.addLayer(b),this;if(!this._map)return this._needsClustering.push(b),this;if(this.hasLayer(b))return this;this._unspiderfy&&this._unspiderfy(),this._addLayer(b,this._maxZoom);var c=b,f=this._map.getZoom();if(b.__parent)while(c.__parent._zoom>=f)c=c.__parent;return this._currentShownBounds.contains(c.getLatLng())&&(this.options.animateAddingMarkers?this._animationAddLayer(b,c):this._animationAddLayerNonAnimated(b,c)),this},removeLayer:function(b){if(b instanceof a.LayerGroup){var c=[];for(var d in b._layers)c.push(b._layers[d]);return this.removeLayers(c)}return b.getLatLng?this._map?b.__parent?(this._unspiderfy&&(this._unspiderfy(),this._unspiderfyLayer(b)),this._removeLayer(b,!0),this._featureGroup.hasLayer(b)&&(this._featureGroup.removeLayer(b),b.setOpacity&&b.setOpacity(1)),this):this:(!this._arraySplice(this._needsClustering,b)&&this.hasLayer(b)&&this._needsRemoving.push(b),this):(this._nonPointGroup.removeLayer(b),this)},addLayers:function(g){var c,h,b,e=this._map,f=this._featureGroup,i=this._nonPointGroup;for(c=0,h=g.length;c<h;c++){if(b=g[c],!b.getLatLng){i.addLayer(b);continue}if(this.hasLayer(b))continue;if(!e){this._needsClustering.push(b);continue}if(this._addLayer(b,this._maxZoom),b.__parent&&b.__parent.getChildCount()===2){var d=b.__parent.getAllChildMarkers(),j=d[0]===b?d[1]:d[0];f.removeLayer(j)}}return e&&(f.eachLayer(function(b){b instanceof a.MarkerCluster&&b._iconNeedsUpdate&&b._updateIcon()}),this._topClusterLevel._recursivelyAddChildrenToMap(null,this._zoom,this._currentShownBounds)),this},removeLayers:function(d){var c,e,b,f=this._featureGroup,g=this._nonPointGroup;if(!this._map){for(c=0,e=d.length;c<e;c++)b=d[c],this._arraySplice(this._needsClustering,b),g.removeLayer(b);return this}for(c=0,e=d.length;c<e;c++){if(b=d[c],!b.__parent){g.removeLayer(b);continue}this._removeLayer(b,!0,!0),f.hasLayer(b)&&(f.removeLayer(b),b.setOpacity&&b.setOpacity(1))}return this._topClusterLevel._recursivelyAddChildrenToMap(null,this._zoom,this._currentShownBounds),f.eachLayer(function(b){b instanceof a.MarkerCluster&&b._updateIcon()}),this},clearLayers:function(){return this._map||(this._needsClustering=[],delete this._gridClusters,delete this._gridUnclustered),this._noanimationUnspiderfy&&this._noanimationUnspiderfy(),this._featureGroup.clearLayers(),this._nonPointGroup.clearLayers(),this.eachLayer(function(a){delete a.__parent}),this._map&&this._generateInitialClusters(),this},getBounds:function(){var b=new a.LatLngBounds;if(this._topClusterLevel)b.extend(this._topClusterLevel._bounds);else for(var c=this._needsClustering.length-1;c>=0;c--)b.extend(this._needsClustering[c].getLatLng());return b.extend(this._nonPointGroup.getBounds()),b},eachLayer:function(c,d){var a=this._needsClustering.slice(),b;for(this._topClusterLevel&&this._topClusterLevel.getAllChildMarkers(a),b=a.length-1;b>=0;b--)c.call(d,a[b]);this._nonPointGroup.eachLayer(c,d)},getLayers:function(){var a=[];return this.eachLayer(function(b){a.push(b)}),a},getLayer:function(c){var b=null;return this.eachLayer(function(d){a.stamp(d)===c&&(b=d)}),b},hasLayer:function(b){if(!b)return!1;var a,c=this._needsClustering;for(a=c.length-1;a>=0;a--)if(c[a]===b)return!0;for(c=this._needsRemoving,a=c.length-1;a>=0;a--)if(c[a]===b)return!1;return!!(b.__parent&&b.__parent._group===this)||this._nonPointGroup.hasLayer(b)},zoomToShowLayer:function(a,c){var b=function(){if((a._icon||a.__parent._icon)&&!this._inZoomAnimation)if(this._map.off('moveend',b,this),this.off('animationend',b,this),a._icon)c();else if(a.__parent._icon){var d=function(){this.off('spiderfied',d,this),c()};this.on('spiderfied',d,this),a.__parent.spiderfy()}};a._icon&&this._map.getBounds().contains(a.getLatLng())?c():a.__parent._zoom<this._map.getZoom()?(this._map.on('moveend',b,this),this._map.panTo(a.getLatLng())):(this._map.on('moveend',b,this),this.on('animationend',b,this),this._map.setView(a.getLatLng(),a.__parent._zoom+1),a.__parent.zoomToBounds())},onAdd:function(d){this._map=d;var a,c,b;if(!isFinite(this._map.getMaxZoom()))throw'Map has no maxZoom specified';for(this._featureGroup.onAdd(d),this._nonPointGroup.onAdd(d),this._gridClusters||this._generateInitialClusters(),a=0,c=this._needsRemoving.length;a<c;a++)b=this._needsRemoving[a],this._removeLayer(b,!0);for(this._needsRemoving=[],a=0,c=this._needsClustering.length;a<c;a++){if(b=this._needsClustering[a],!b.getLatLng){this._featureGroup.addLayer(b);continue}if(b.__parent)continue;this._addLayer(b,this._maxZoom)}this._needsClustering=[],this._map.on('zoomend',this._zoomEnd,this),this._map.on('moveend',this._moveEnd,this),this._spiderfierOnAdd&&this._spiderfierOnAdd(),this._bindEvents(),this._zoom=this._map.getZoom(),this._currentShownBounds=this._getExpandedVisibleBounds(),this._topClusterLevel._recursivelyAddChildrenToMap(null,this._zoom,this._currentShownBounds)},onRemove:function(a){a.off('zoomend',this._zoomEnd,this),a.off('moveend',this._moveEnd,this),this._unbindEvents(),this._map._mapPane.className=this._map._mapPane.className.replace(' leaflet-cluster-anim',''),this._spiderfierOnRemove&&this._spiderfierOnRemove(),this._hideCoverage(),this._featureGroup.onRemove(a),this._nonPointGroup.onRemove(a),this._featureGroup.clearLayers(),this._map=null},getVisibleParent:function(b){var a=b;while(a&&!a._icon)a=a.__parent;return a||null},_arraySplice:function(b,c){for(var a=b.length-1;a>=0;a--)if(b[a]===c)return b.splice(a,1),!0},_removeLayer:function(c,j,i){var h=this._gridClusters,f=this._gridUnclustered,g=this._featureGroup,e=this._map;if(j)for(var d=this._maxZoom;d>=0;d--)if(!f[d].removeObject(c,e.project(c.getLatLng(),d)))break;var a=c.__parent,k=a._markers,b;this._arraySplice(k,c);while(a){if(a._childCount--,a._zoom<0)break;else j&&a._childCount<=1?(b=a._markers[0]===c?a._markers[1]:a._markers[0],h[a._zoom].removeObject(a,e.project(a._cLatLng,a._zoom)),f[a._zoom].addObject(b,e.project(b.getLatLng(),a._zoom)),this._arraySplice(a.__parent._childClusters,a),a.__parent._markers.push(b),b.__parent=a.__parent,a._icon&&(g.removeLayer(a),i||g.addLayer(b))):(a._recalculateBounds(),i&&a._icon||a._updateIcon());a=a.__parent}delete c.__parent},_isOrIsParent:function(b,a){while(a){if(b===a)return!0;a=a.parentNode}return!1},_propagateEvent:function(b){if(b.layer instanceof a.MarkerCluster){if(b.originalEvent&&this._isOrIsParent(b.layer._icon,b.originalEvent.relatedTarget))return;b.type='cluster'+b.type}this.fire(b.type,b)},_defaultIconCreateFunction:function(d){var c=d.getChildCount(),b=' marker-cluster-';return c<10?b+='small':c<100?b+='medium':b+='large',new a.DivIcon({html:'<div><span>'+c+'</span></div>',className:'marker-cluster'+b,iconSize:new a.Point(40,40)})},_bindEvents:function(){var a=this._map,b=this.options.spiderfyOnMaxZoom,c=this.options.showCoverageOnHover,d=this.options.zoomToBoundsOnClick;(b||d)&&this.on('clusterclick',this._zoomOrSpiderfy,this),c&&(this.on('clustermouseover',this._showCoverage,this),this.on('clustermouseout',this._hideCoverage,this),a.on('zoomend',this._hideCoverage,this))},_zoomOrSpiderfy:function(a){var b=this._map;b.getMaxZoom()===b.getZoom()?this.options.spiderfyOnMaxZoom&&a.layer.spiderfy():this.options.zoomToBoundsOnClick&&a.layer.zoomToBounds(),a.originalEvent&&a.originalEvent.keyCode===13&&b._container.focus()},_showCoverage:function(b){var c=this._map;if(this._inZoomAnimation)return;this._shownPolygon&&c.removeLayer(this._shownPolygon),b.layer.getChildCount()>2&&b.layer!==this._spiderfied&&(this._shownPolygon=new a.Polygon(b.layer.getConvexHull(),this.options.polygonOptions),c.addLayer(this._shownPolygon))},_hideCoverage:function(){this._shownPolygon&&(this._map.removeLayer(this._shownPolygon),this._shownPolygon=null)},_unbindEvents:function(){var a=this.options.spiderfyOnMaxZoom,b=this.options.showCoverageOnHover,c=this.options.zoomToBoundsOnClick,d=this._map;(a||c)&&this.off('clusterclick',this._zoomOrSpiderfy,this),b&&(this.off('clustermouseover',this._showCoverage,this),this.off('clustermouseout',this._hideCoverage,this),d.off('zoomend',this._hideCoverage,this))},_zoomEnd:function(){if(!this._map)return;this._mergeSplitClusters(),this._zoom=this._map._zoom,this._currentShownBounds=this._getExpandedVisibleBounds()},_moveEnd:function(){if(this._inZoomAnimation)return;var a=this._getExpandedVisibleBounds();this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds,this._zoom,a),this._topClusterLevel._recursivelyAddChildrenToMap(null,this._map._zoom,a),this._currentShownBounds=a;return},_generateInitialClusters:function(){var c=this._map.getMaxZoom(),d=this.options.maxClusterRadius;this.options.disableClusteringAtZoom&&(c=this.options.disableClusteringAtZoom-1),this._maxZoom=c,this._gridClusters={},this._gridUnclustered={};for(var b=c;b>=0;b--)this._gridClusters[b]=new a.DistanceGrid(d),this._gridUnclustered[b]=new a.DistanceGrid(d);this._topClusterLevel=new a.MarkerCluster(this,-1)},_addLayer:function(e,c){var h=this._gridClusters,i=this._gridUnclustered,k,d;for(this.options.singleMarkerMode&&(e.options.icon=this.options.iconCreateFunction({getChildCount:function(){return 1},getAllChildMarkers:function(){return[e]}}));c>=0;c--){k=this._map.project(e.getLatLng(),c);var b=h[c].getNearObject(k);if(b){b._addChild(e),e.__parent=b;return}if(b=i[c].getNearObject(k),b){var j=b.__parent;j&&this._removeLayer(b,!1);var f=new a.MarkerCluster(this,c,b,e);h[c].addObject(f,this._map.project(f._cLatLng,c)),b.__parent=f,e.__parent=f;var g=f;for(d=c-1;d>j._zoom;d--)g=new a.MarkerCluster(this,d,g),h[d].addObject(g,this._map.project(b.getLatLng(),d));for(j._addChild(g),d=c;d>=0;d--)if(!i[d].removeObject(b,this._map.project(b.getLatLng(),d)))break;return}i[c].addObject(e,k)}this._topClusterLevel._addChild(e),e.__parent=this._topClusterLevel;return},_enqueue:function(b){this._queue.push(b),this._queueTimeout||(this._queueTimeout=setTimeout(a.bind(this._processQueue,this),300))},_processQueue:function(){for(var a=0;a<this._queue.length;a++)this._queue[a].call(this);this._queue.length=0,clearTimeout(this._queueTimeout),this._queueTimeout=null},_mergeSplitClusters:function(){this._processQueue(),this._zoom<this._map._zoom&&this._currentShownBounds.contains(this._getExpandedVisibleBounds())?(this._animationStart(),this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds,this._zoom,this._getExpandedVisibleBounds()),this._animationZoomIn(this._zoom,this._map._zoom)):this._zoom>this._map._zoom?(this._animationStart(),this._animationZoomOut(this._zoom,this._map._zoom)):this._moveEnd()},_getExpandedVisibleBounds:function(){if(!this.options.removeOutsideVisibleBounds)return this.getBounds();var g=this._map,d=g.getBounds(),b=d._southWest,c=d._northEast,e=a.Browser.mobile?0:Math.abs(b.lat-c.lat),f=a.Browser.mobile?0:Math.abs(b.lng-c.lng);return new a.LatLngBounds(new a.LatLng(b.lat-e,b.lng-f,!0),new a.LatLng(c.lat+e,c.lng+f,!0))},_animationAddLayerNonAnimated:function(c,a){if(a===c)this._featureGroup.addLayer(c);else if(a._childCount===2){a._addToMap();var b=a.getAllChildMarkers();this._featureGroup.removeLayer(b[0]),this._featureGroup.removeLayer(b[1])}else a._updateIcon()}}),a.MarkerClusterGroup.include(a.DomUtil.TRANSITION?{_animationStart:function(){this._map._mapPane.className+=' leaflet-cluster-anim',this._inZoomAnimation++},_animationEnd:function(){this._map&&(this._map._mapPane.className=this._map._mapPane.className.replace(' leaflet-cluster-anim','')),this._inZoomAnimation--,this.fire('animationend')},_animationZoomIn:function(e,c){var b=this._getExpandedVisibleBounds(),d=this._featureGroup,f;this._topClusterLevel._recursively(b,e,0,function(a){var g=a._latlng,h=a._markers,i;for(b.contains(g)||(g=null),a._isSingleParent()&&e+1===c?(d.removeLayer(a),a._recursivelyAddChildrenToMap(null,c,b)):(a.setOpacity(0),a._recursivelyAddChildrenToMap(g,c,b)),f=h.length-1;f>=0;f--)i=h[f],b.contains(i._latlng)||d.removeLayer(i)}),this._forceLayout(),this._topClusterLevel._recursivelyBecomeVisible(b,c),d.eachLayer(function(b){!(b instanceof a.MarkerCluster)&&b._icon&&b.setOpacity(1)}),this._topClusterLevel._recursively(b,e,c,function(a){a._recursivelyRestoreChildPositions(c)}),this._enqueue(function(){this._topClusterLevel._recursively(b,e,0,function(a){d.removeLayer(a),a.setOpacity(1)}),this._animationEnd()})},_animationZoomOut:function(a,b){this._animationZoomOutSingle(this._topClusterLevel,a-1,b),this._topClusterLevel._recursivelyAddChildrenToMap(null,b,this._getExpandedVisibleBounds()),this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds,a,this._getExpandedVisibleBounds())},_animationZoomOutSingle:function(a,d,c){var b=this._getExpandedVisibleBounds();a._recursivelyAnimateChildrenInAndAddSelfToMap(b,d+1,c);var e=this;this._forceLayout(),a._recursivelyBecomeVisible(b,c),this._enqueue(function(){if(a._childCount===1){var f=a._markers[0];f.setLatLng(f.getLatLng()),f.setOpacity(1)}else a._recursively(b,c,0,function(a){a._recursivelyRemoveChildrenFromMap(b,d+1)});e._animationEnd()})},_animationAddLayer:function(a,b){var c=this,d=this._featureGroup;d.addLayer(a),b!==a&&(b._childCount>2?(b._updateIcon(),this._forceLayout(),this._animationStart(),a._setPos(this._map.latLngToLayerPoint(b.getLatLng())),a.setOpacity(0),this._enqueue(function(){d.removeLayer(a),a.setOpacity(1),c._animationEnd()})):(this._forceLayout(),c._animationStart(),c._animationZoomOutSingle(b,this._map.getMaxZoom(),this._map.getZoom())))},_forceLayout:function(){a.Util.falseFn(document.body.offsetWidth)}}:{_animationStart:function(){},_animationZoomIn:function(a,b){this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds,a),this._topClusterLevel._recursivelyAddChildrenToMap(null,b,this._getExpandedVisibleBounds())},_animationZoomOut:function(a,b){this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds,a),this._topClusterLevel._recursivelyAddChildrenToMap(null,b,this._getExpandedVisibleBounds())},_animationAddLayer:function(a,b){this._animationAddLayerNonAnimated(a,b)}}),a.markerClusterGroup=function(b){return new a.MarkerClusterGroup(b)},a.MarkerCluster=a.Marker.extend({initialize:function(d,e,b,c){a.Marker.prototype.initialize.call(this,b?b._cLatLng||b.getLatLng():new a.LatLng(0,0),{icon:this}),this._group=d,this._zoom=e,this._markers=[],this._childClusters=[],this._childCount=0,this._iconNeedsUpdate=!0,this._bounds=new a.LatLngBounds,b&&this._addChild(b),c&&this._addChild(c)},getAllChildMarkers:function(a){a=a||[];for(var b=this._childClusters.length-1;b>=0;b--)this._childClusters[b].getAllChildMarkers(a);for(var c=this._markers.length-1;c>=0;c--)a.push(this._markers[c]);return a},getChildCount:function(){return this._childCount},zoomToBounds:function(){var a=this._childClusters.slice(),f=this._group._map,c=f.getBoundsZoom(this._bounds),b=this._zoom+1,g=f.getZoom(),d;while(a.length>0&&c>b){b++;var e=[];for(d=0;d<a.length;d++)e=e.concat(a[d]._childClusters);a=e}c>b?this._group._map.setView(this._latlng,b):c<=g?this._group._map.setView(this._latlng,g+1):this._group._map.fitBounds(this._bounds)},getBounds:function(){var b=new a.LatLngBounds;return b.extend(this._bounds),b},_updateIcon:function(){this._iconNeedsUpdate=!0,this._icon&&this.setIcon(this)},createIcon:function(){return this._iconNeedsUpdate&&(this._iconObj=this._group.options.iconCreateFunction(this),this._iconNeedsUpdate=!1),this._iconObj.createIcon()},createShadow:function(){return this._iconObj.createShadow()},_addChild:function(b,c){this._iconNeedsUpdate=!0,this._expandBounds(b),b instanceof a.MarkerCluster?(c||(this._childClusters.push(b),b.__parent=this),this._childCount+=b._childCount):(c||this._markers.push(b),this._childCount++),this.__parent&&this.__parent._addChild(b,!0)},_expandBounds:function(c){var d,b=c._wLatLng||c._latlng;c instanceof a.MarkerCluster?(this._bounds.extend(c._bounds),d=c._childCount):(this._bounds.extend(b),d=1),this._cLatLng||(this._cLatLng=c._cLatLng||b);var e=this._childCount+d;this._wLatLng?(this._wLatLng.lat=(b.lat*d+this._wLatLng.lat*this._childCount)/e,this._wLatLng.lng=(b.lng*d+this._wLatLng.lng*this._childCount)/e):this._latlng=this._wLatLng=new a.LatLng(b.lat,b.lng)},_addToMap:function(a){a&&(this._backupLatlng=this._latlng,this.setLatLng(a)),this._group._featureGroup.addLayer(this)},_recursivelyAnimateChildrenIn:function(b,a,c){this._recursively(b,0,c-1,function(e){var d=e._markers,b,c;for(b=d.length-1;b>=0;b--)c=d[b],c._icon&&(c._setPos(a),c.setOpacity(0))},function(e){var d=e._childClusters,b,c;for(b=d.length-1;b>=0;b--)c=d[b],c._icon&&(c._setPos(a),c.setOpacity(0))})},_recursivelyAnimateChildrenInAndAddSelfToMap:function(a,b,c){this._recursively(a,c,0,function(d){d._recursivelyAnimateChildrenIn(a,d._group._map.latLngToLayerPoint(d.getLatLng()).round(),b),d._isSingleParent()&&b-1===c?(d.setOpacity(1),d._recursivelyRemoveChildrenFromMap(a,b)):d.setOpacity(0),d._addToMap()})},_recursivelyBecomeVisible:function(a,b){this._recursively(a,0,b,null,function(a){a.setOpacity(1)})},_recursivelyAddChildrenToMap:function(a,b,c){this._recursively(c,-1,b,function(e){if(b===e._zoom)return;for(var f=e._markers.length-1;f>=0;f--){var d=e._markers[f];if(!c.contains(d._latlng))continue;a&&(d._backupLatlng=d.getLatLng(),d.setLatLng(a),d.setOpacity&&d.setOpacity(0)),e._group._featureGroup.addLayer(d)}},function(b){b._addToMap(a)})},_recursivelyRestoreChildPositions:function(e){for(var b=this._markers.length-1;b>=0;b--){var a=this._markers[b];a._backupLatlng&&(a.setLatLng(a._backupLatlng),delete a._backupLatlng)}if(e-1===this._zoom)for(var c=this._childClusters.length-1;c>=0;c--)this._childClusters[c]._restorePosition();else for(var d=this._childClusters.length-1;d>=0;d--)this._childClusters[d]._recursivelyRestoreChildPositions(e)},_restorePosition:function(){this._backupLatlng&&(this.setLatLng(this._backupLatlng),delete this._backupLatlng)},_recursivelyRemoveChildrenFromMap:function(d,e,c){var a,b;this._recursively(d,-1,e-1,function(d){for(b=d._markers.length-1;b>=0;b--)a=d._markers[b],c&&c.contains(a._latlng)||(d._group._featureGroup.removeLayer(a),a.setOpacity&&a.setOpacity(1))},function(d){for(b=d._childClusters.length-1;b>=0;b--)a=d._childClusters[b],c&&c.contains(a._latlng)||(d._group._featureGroup.removeLayer(a),a.setOpacity&&a.setOpacity(1))})},_recursively:function(d,h,e,f,g){var c=this._childClusters,i=this._zoom,a,b;if(h>i)for(a=c.length-1;a>=0;a--)b=c[a],d.intersects(b._bounds)&&b._recursively(d,h,e,f,g);else if(f&&f(this),g&&this._zoom===e&&g(this),e>i)for(a=c.length-1;a>=0;a--)b=c[a],d.intersects(b._bounds)&&b._recursively(d,h,e,f,g)},_recalculateBounds:function(){var c=this._markers,d=this._childClusters,b;for(this._bounds=new a.LatLngBounds,delete this._wLatLng,b=c.length-1;b>=0;b--)this._expandBounds(c[b]);for(b=d.length-1;b>=0;b--)this._expandBounds(d[b])},_isSingleParent:function(){return this._childClusters.length>0&&this._childClusters[0]._childCount===this._childCount}}),a.DistanceGrid=function(a){this._cellSize=a,this._sqCellSize=a*a,this._grid={},this._objectPoint={}},a.DistanceGrid.prototype={addObject:function(g,b){var c=this._getCoord(b.x),d=this._getCoord(b.y),e=this._grid,f=e[d]=e[d]||{},h=f[c]=f[c]||[],i=a.Util.stamp(g);this._objectPoint[i]=b,h.push(g)},updateObject:function(a,b){this.removeObject(a),this.addObject(a,b)},removeObject:function(i,j){var c=this._getCoord(j.x),f=this._getCoord(j.y),g=this._grid,d=g[f]=g[f]||{},e=d[c]=d[c]||[],b,h;for(delete this._objectPoint[a.Util.stamp(i)],b=0,h=e.length;b<h;b++)if(e[b]===i)return e.splice(b,1),h===1&&delete d[c],!0},eachObject:function(i,j){var g,f,a,e,d,c,h,b=this._grid;for(g in b){d=b[g];for(f in d)for(c=d[f],a=0,e=c.length;a<e;a++)h=i.call(j,c[a]),h&&(a--,e--)}},getNearObject:function(i){var g=this._getCoord(i.x),h=this._getCoord(i.y),b,c,d,f,e,o,l,m,n=this._objectPoint,k=this._sqCellSize,j=null;for(b=h-1;b<=h+1;b++)if(f=this._grid[b],f)for(c=g-1;c<=g+1;c++)if(e=f[c],e)for(d=0,o=e.length;d<o;d++)l=e[d],m=this._sqDist(n[a.Util.stamp(l)],i),m<k&&(k=m,j=l);return j},_getCoord:function(a){return Math.floor(a/this._cellSize)},_sqDist:function(c,d){var a=d.x-c.x,b=d.y-c.y;return a*a+b*b}},function(){a.QuickHull={getDistant:function(b,a){var c=a[1].lat-a[0].lat,d=a[0].lng-a[1].lng;return d*(b.lat-a[0].lat)+c*(b.lng-a[0].lng)},findMostDistantPointFromBaseLine:function(h,g){var d=0,e=null,f=[],a,b,c;for(a=g.length-1;a>=0;a--){if(b=g[a],c=this.getDistant(b,h),!(c>0))continue;f.push(b),c>d&&(d=c,e=b)}return{maxPoint:e,newPoints:f}},buildConvexHull:function(c,d){var a=[],b=this.findMostDistantPointFromBaseLine(c,d);return b.maxPoint?(a=a.concat(this.buildConvexHull([c[0],b.maxPoint],b.newPoints)),a=a.concat(this.buildConvexHull([b.maxPoint,c[1]],b.newPoints)),a):[c[0]]},getConvexHull:function(b){var c=!1,d=!1,e=null,f=null,g;for(g=b.length-1;g>=0;g--){var a=b[g];(c===!1||a.lat>c)&&(e=a,c=a.lat),(d===!1||a.lat<d)&&(f=a,d=a.lat)}var h=[].concat(this.buildConvexHull([f,e],b),this.buildConvexHull([e,f],b));return h}}}(),a.MarkerCluster.include({getConvexHull:function(){var c=this.getAllChildMarkers(),d=[],e,b;for(b=c.length-1;b>=0;b--)e=c[b].getLatLng(),d.push(e);return a.QuickHull.getConvexHull(d)}}),a.MarkerCluster.include({_2PI:Math.PI*2,_circleFootSeparation:25,_circleStartAngle:Math.PI/6,_spiralFootSeparation:28,_spiralLengthStart:11,_spiralLengthFactor:5,_circleSpiralSwitchover:9,spiderfy:function(){if(this._group._spiderfied===this||this._group._inZoomAnimation)return;var a=this.getAllChildMarkers(),d=this._group,e=d._map,b=e.latLngToLayerPoint(this._latlng),c;this._group._unspiderfy(),this._group._spiderfied=this,a.length>=this._circleSpiralSwitchover?c=this._generatePointsSpiral(a.length,b):(b.y+=10,c=this._generatePointsCircle(a.length,b)),this._animationSpiderfy(a,c)},unspiderfy:function(a){if(this._group._inZoomAnimation)return;this._animationUnspiderfy(a),this._group._spiderfied=null},_generatePointsCircle:function(c,g){var h=this._group.options.spiderfyDistanceMultiplier*this._circleFootSeparation*(2+c),e=h/this._2PI,i=this._2PI/c,d=[],b,f;for(d.length=c,b=c-1;b>=0;b--)f=this._circleStartAngle+b*i,d[b]=new a.Point(g.x+e*Math.cos(f),g.y+e*Math.sin(f))._round();return d},_generatePointsSpiral:function(f,g){var b=this._group.options.spiderfyDistanceMultiplier*this._spiralLengthStart,h=this._group.options.spiderfyDistanceMultiplier*this._spiralFootSeparation,i=this._group.options.spiderfyDistanceMultiplier*this._spiralLengthFactor,c=0,e=[],d;for(e.length=f,d=f-1;d>=0;d--)c+=h/b+d*5e-4,e[d]=new a.Point(g.x+b*Math.cos(c),g.y+b*Math.sin(c))._round(),b+=this._2PI*i/c;return e},_noanimationUnspiderfy:function(){var b=this._group,e=b._map,f=b._featureGroup,d=this.getAllChildMarkers(),a,c;for(this.setOpacity(1),c=d.length-1;c>=0;c--)a=d[c],f.removeLayer(a),a._preSpiderfyLatlng&&(a.setLatLng(a._preSpiderfyLatlng),delete a._preSpiderfyLatlng),a.setZIndexOffset&&a.setZIndexOffset(0),a._spiderLeg&&(e.removeLayer(a._spiderLeg),delete a._spiderLeg);b._spiderfied=null}}),a.MarkerCluster.include(a.DomUtil.TRANSITION?{SVG_ANIMATION:function(){return document.createElementNS('http://www.w3.org/2000/svg','animate').toString().indexOf('SVGAnimate')>-1}(),_animationSpiderfy:function(g,p){var m=this,e=this._group,h=e._map,j=e._featureGroup,n=h.latLngToLayerPoint(this._latlng),d,c,f,k;for(d=g.length-1;d>=0;d--)c=g[d],c.setOpacity?(c.setZIndexOffset(1e6),c.setOpacity(0),j.addLayer(c),c._setPos(n)):j.addLayer(c);e._forceLayout(),e._animationStart();var o=a.Path.SVG?0:.3,l=a.Path.SVG_NS;for(d=g.length-1;d>=0;d--){if(k=h.layerPointToLatLng(p[d]),c=g[d],c._preSpiderfyLatlng=c._latlng,c.setLatLng(k),c.setOpacity&&c.setOpacity(1),f=new a.Polyline([m._latlng,k],{weight:1.5,color:'#222',opacity:o}),h.addLayer(f),c._spiderLeg=f,!(a.Path.SVG&&this.SVG_ANIMATION))continue;var i=f._path.getTotalLength();f._path.setAttribute('stroke-dasharray',i+','+i);var b=document.createElementNS(l,'animate');b.setAttribute('attributeName','stroke-dashoffset'),b.setAttribute('begin','indefinite'),b.setAttribute('from',i),b.setAttribute('to',0),b.setAttribute('dur',.25),f._path.appendChild(b),b.beginElement(),b=document.createElementNS(l,'animate'),b.setAttribute('attributeName','stroke-opacity'),b.setAttribute('attributeName','stroke-opacity'),b.setAttribute('begin','indefinite'),b.setAttribute('from',0),b.setAttribute('to',.5),b.setAttribute('dur',.25),f._path.appendChild(b),b.beginElement()}if(m.setOpacity(.3),a.Path.SVG)for(this._group._forceLayout(),d=g.length-1;d>=0;d--)c=g[d]._spiderLeg,c.options.opacity=.5,c._path.setAttribute('stroke-opacity',.5);setTimeout(function(){e._animationEnd(),e.fire('spiderfied')},200)},_animationUnspiderfy:function(i){var f=this._group,g=f._map,h=f._featureGroup,j=i?g._latLngToNewLayerPoint(this._latlng,i.zoom,i.center):g.latLngToLayerPoint(this._latlng),e=this.getAllChildMarkers(),k=a.Path.SVG&&this.SVG_ANIMATION,b,c,d;for(f._animationStart(),this.setOpacity(1),c=e.length-1;c>=0;c--){if(b=e[c],!b._preSpiderfyLatlng)continue;b.setLatLng(b._preSpiderfyLatlng),delete b._preSpiderfyLatlng,b.setOpacity?(b._setPos(j),b.setOpacity(0)):h.removeLayer(b),k&&(d=b._spiderLeg._path.childNodes[0],d.setAttribute('to',d.getAttribute('from')),d.setAttribute('from',0),d.beginElement(),d=b._spiderLeg._path.childNodes[1],d.setAttribute('from',.5),d.setAttribute('to',0),d.setAttribute('stroke-opacity',0),d.beginElement(),b._spiderLeg._path.setAttribute('stroke-opacity',0))}setTimeout(function(){var a=0;for(c=e.length-1;c>=0;c--)b=e[c],b._spiderLeg&&a++;for(c=e.length-1;c>=0;c--){if(b=e[c],!b._spiderLeg)continue;b.setOpacity&&(b.setOpacity(1),b.setZIndexOffset(0)),a>1&&h.removeLayer(b),g.removeLayer(b._spiderLeg),delete b._spiderLeg}f._animationEnd()},200)}}:{_animationSpiderfy:function(h,j){var d=this._group,e=d._map,i=d._featureGroup,c,b,f,g;for(c=h.length-1;c>=0;c--)g=e.layerPointToLatLng(j[c]),b=h[c],b._preSpiderfyLatlng=b._latlng,b.setLatLng(g),b.setZIndexOffset&&b.setZIndexOffset(1e6),i.addLayer(b),f=new a.Polyline([this._latlng,g],{weight:1.5,color:'#222'}),e.addLayer(f),b._spiderLeg=f;this.setOpacity(.3),d.fire('spiderfied')},_animationUnspiderfy:function(){this._noanimationUnspiderfy()}}),a.MarkerClusterGroup.include({_spiderfied:null,_spiderfierOnAdd:function(){this._map.on('click',this._unspiderfyWrapper,this),this._map.options.zoomAnimation&&this._map.on('zoomstart',this._unspiderfyZoomStart,this),this._map.on('zoomend',this._noanimationUnspiderfy,this),a.Path.SVG&&!a.Browser.touch&&this._map._initPathRoot()},_spiderfierOnRemove:function(){this._map.off('click',this._unspiderfyWrapper,this),this._map.off('zoomstart',this._unspiderfyZoomStart,this),this._map.off('zoomanim',this._unspiderfyZoomAnim,this),this._unspiderfy()},_unspiderfyZoomStart:function(){if(!this._map)return;this._map.on('zoomanim',this._unspiderfyZoomAnim,this)},_unspiderfyZoomAnim:function(b){if(a.DomUtil.hasClass(this._map._mapPane,'leaflet-touching'))return;this._map.off('zoomanim',this._unspiderfyZoomAnim,this),this._unspiderfy(b)},_unspiderfyWrapper:function(){this._unspiderfy()},_unspiderfy:function(a){this._spiderfied&&this._spiderfied.unspiderfy(a)},_noanimationUnspiderfy:function(){this._spiderfied&&this._spiderfied._noanimationUnspiderfy()},_unspiderfyLayer:function(a){a._spiderLeg&&(this._featureGroup.removeLayer(a),a.setOpacity(1),a.setZIndexOffset(0),this._map.removeLayer(a._spiderLeg),delete a._spiderLeg)}})
var a=require('./../leaflet'),b=a.dmap=a.dmap||{};a.MarkerClusterGroup=a.FeatureGroup.extend({options:{maxClusterRadius:80,iconCreateFunction:null,spiderfyOnMaxZoom:!0,showCoverageOnHover:!0,zoomToBoundsOnClick:!0,singleMarkerMode:!1,disableClusteringAtZoom:null,removeOutsideVisibleBounds:!0,animateAddingMarkers:!1,spiderfyDistanceMultiplier:1,polygonOptions:{}},initialize:function(b){a.Util.setOptions(this,b),this.options.iconCreateFunction||(this.options.iconCreateFunction=this._defaultIconCreateFunction),this._featureGroup=a.featureGroup(),this._featureGroup.on(a.FeatureGroup.EVENTS,this._propagateEvent,this),this._nonPointGroup=a.featureGroup(),this._nonPointGroup.on(a.FeatureGroup.EVENTS,this._propagateEvent,this),this._inZoomAnimation=0,this._needsClustering=[],this._needsRemoving=[],this._currentShownBounds=null,this._queue=[]},addLayer:function(b){if(b instanceof a.LayerGroup){var d=[];for(var e in b._layers)d.push(b._layers[e]);return this.addLayers(d)}if(!b.getLatLng)return this._nonPointGroup.addLayer(b),this;if(!this._map)return this._needsClustering.push(b),this;if(this.hasLayer(b))return this;this._unspiderfy&&this._unspiderfy(),this._addLayer(b,this._maxZoom);var c=b,f=this._map.getZoom();if(b.__parent)while(c.__parent._zoom>=f)c=c.__parent;return this._currentShownBounds.contains(c.getLatLng())&&(this.options.animateAddingMarkers?this._animationAddLayer(b,c):this._animationAddLayerNonAnimated(b,c)),this},removeLayer:function(b){if(b instanceof a.LayerGroup){var c=[];for(var d in b._layers)c.push(b._layers[d]);return this.removeLayers(c)}return b.getLatLng?this._map?b.__parent?(this._unspiderfy&&(this._unspiderfy(),this._unspiderfyLayer(b)),this._removeLayer(b,!0),this._featureGroup.hasLayer(b)&&(this._featureGroup.removeLayer(b),b.setOpacity&&b.setOpacity(1)),this):this:(!this._arraySplice(this._needsClustering,b)&&this.hasLayer(b)&&this._needsRemoving.push(b),this):(this._nonPointGroup.removeLayer(b),this)},addLayers:function(g){var c,h,b,e=this._map,f=this._featureGroup,i=this._nonPointGroup;for(c=0,h=g.length;c<h;c++){if(b=g[c],!b.getLatLng){i.addLayer(b);continue}if(this.hasLayer(b))continue;if(!e){this._needsClustering.push(b);continue}if(this._addLayer(b,this._maxZoom),b.__parent&&b.__parent.getChildCount()===2){var d=b.__parent.getAllChildMarkers(),j=d[0]===b?d[1]:d[0];f.removeLayer(j)}}return e&&(f.eachLayer(function(b){b instanceof a.MarkerCluster&&b._iconNeedsUpdate&&b._updateIcon()}),this._topClusterLevel._recursivelyAddChildrenToMap(null,this._zoom,this._currentShownBounds)),this},removeLayers:function(d){var c,e,b,f=this._featureGroup,g=this._nonPointGroup;if(!this._map){for(c=0,e=d.length;c<e;c++)b=d[c],this._arraySplice(this._needsClustering,b),g.removeLayer(b);return this}for(c=0,e=d.length;c<e;c++){if(b=d[c],!b.__parent){g.removeLayer(b);continue}this._removeLayer(b,!0,!0),f.hasLayer(b)&&(f.removeLayer(b),b.setOpacity&&b.setOpacity(1))}return this._topClusterLevel._recursivelyAddChildrenToMap(null,this._zoom,this._currentShownBounds),f.eachLayer(function(b){b instanceof a.MarkerCluster&&b._updateIcon()}),this},clearLayers:function(){return this._map||(this._needsClustering=[],delete this._gridClusters,delete this._gridUnclustered),this._noanimationUnspiderfy&&this._noanimationUnspiderfy(),this._featureGroup.clearLayers(),this._nonPointGroup.clearLayers(),this.eachLayer(function(a){delete a.__parent}),this._map&&this._generateInitialClusters(),this},getBounds:function(){var b=new a.LatLngBounds;if(this._topClusterLevel)b.extend(this._topClusterLevel._bounds);else for(var c=this._needsClustering.length-1;c>=0;c--)b.extend(this._needsClustering[c].getLatLng());return b.extend(this._nonPointGroup.getBounds()),b},eachLayer:function(c,d){var a=this._needsClustering.slice(),b;for(this._topClusterLevel&&this._topClusterLevel.getAllChildMarkers(a),b=a.length-1;b>=0;b--)c.call(d,a[b]);this._nonPointGroup.eachLayer(c,d)},getLayers:function(){var a=[];return this.eachLayer(function(b){a.push(b)}),a},getLayer:function(c){var b=null;return this.eachLayer(function(d){a.stamp(d)===c&&(b=d)}),b},hasLayer:function(b){if(!b)return!1;var a,c=this._needsClustering;for(a=c.length-1;a>=0;a--)if(c[a]===b)return!0;for(c=this._needsRemoving,a=c.length-1;a>=0;a--)if(c[a]===b)return!1;return!!(b.__parent&&b.__parent._group===this)||this._nonPointGroup.hasLayer(b)},zoomToShowLayer:function(a,c){var b=function(){if((a._icon||a.__parent._icon)&&!this._inZoomAnimation)if(this._map.off('moveend',b,this),this.off('animationend',b,this),a._icon)c();else if(a.__parent._icon){var d=function(){this.off('spiderfied',d,this),c()};this.on('spiderfied',d,this),a.__parent.spiderfy()}};a._icon&&this._map.getBounds().contains(a.getLatLng())?c():a.__parent._zoom<this._map.getZoom()?(this._map.on('moveend',b,this),this._map.panTo(a.getLatLng())):(this._map.on('moveend',b,this),this.on('animationend',b,this),this._map.setView(a.getLatLng(),a.__parent._zoom+1),a.__parent.zoomToBounds())},onAdd:function(d){this._map=d;var a,c,b;if(!isFinite(this._map.getMaxZoom()))throw'Map has no maxZoom specified';for(this._featureGroup.onAdd(d),this._nonPointGroup.onAdd(d),this._gridClusters||this._generateInitialClusters(),a=0,c=this._needsRemoving.length;a<c;a++)b=this._needsRemoving[a],this._removeLayer(b,!0);for(this._needsRemoving=[],a=0,c=this._needsClustering.length;a<c;a++){if(b=this._needsClustering[a],!b.getLatLng){this._featureGroup.addLayer(b);continue}if(b.__parent)continue;this._addLayer(b,this._maxZoom)}this._needsClustering=[],this._map.on('zoomend',this._zoomEnd,this),this._map.on('moveend',this._moveEnd,this),this._spiderfierOnAdd&&this._spiderfierOnAdd(),this._bindEvents(),this._zoom=this._map.getZoom(),this._currentShownBounds=this._getExpandedVisibleBounds(),this._topClusterLevel._recursivelyAddChildrenToMap(null,this._zoom,this._currentShownBounds)},onRemove:function(a){a.off('zoomend',this._zoomEnd,this),a.off('moveend',this._moveEnd,this),this._unbindEvents(),this._map._mapPane.className=this._map._mapPane.className.replace(' leaflet-cluster-anim',''),this._spiderfierOnRemove&&this._spiderfierOnRemove(),this._hideCoverage(),this._featureGroup.onRemove(a),this._nonPointGroup.onRemove(a),this._featureGroup.clearLayers(),this._map=null},getVisibleParent:function(b){var a=b;while(a&&!a._icon)a=a.__parent;return a||null},_arraySplice:function(b,c){for(var a=b.length-1;a>=0;a--)if(b[a]===c)return b.splice(a,1),!0},_removeLayer:function(c,j,i){var h=this._gridClusters,f=this._gridUnclustered,g=this._featureGroup,e=this._map;if(j)for(var d=this._maxZoom;d>=0;d--)if(!f[d].removeObject(c,e.project(c.getLatLng(),d)))break;var a=c.__parent,k=a._markers,b;this._arraySplice(k,c);while(a){if(a._childCount--,a._zoom<0)break;else j&&a._childCount<=1?(b=a._markers[0]===c?a._markers[1]:a._markers[0],h[a._zoom].removeObject(a,e.project(a._cLatLng,a._zoom)),f[a._zoom].addObject(b,e.project(b.getLatLng(),a._zoom)),this._arraySplice(a.__parent._childClusters,a),a.__parent._markers.push(b),b.__parent=a.__parent,a._icon&&(g.removeLayer(a),i||g.addLayer(b))):(a._recalculateBounds(),i&&a._icon||a._updateIcon());a=a.__parent}delete c.__parent},_isOrIsParent:function(b,a){while(a){if(b===a)return!0;a=a.parentNode}return!1},_propagateEvent:function(b){if(b.layer instanceof a.MarkerCluster){if(b.originalEvent&&this._isOrIsParent(b.layer._icon,b.originalEvent.relatedTarget))return;b.type='cluster'+b.type}this.fire(b.type,b)},_defaultIconCreateFunction:function(d){var c=d.getChildCount(),b=' marker-cluster-';return c<10?b+='small':c<100?b+='medium':b+='large',new a.DivIcon({html:'<div><span>'+c+'</span></div>',className:'marker-cluster'+b,iconSize:new a.Point(40,40)})},_bindEvents:function(){var a=this._map,b=this.options.spiderfyOnMaxZoom,c=this.options.showCoverageOnHover,d=this.options.zoomToBoundsOnClick;(b||d)&&this.on('clusterclick',this._zoomOrSpiderfy,this),c&&(this.on('clustermouseover',this._showCoverage,this),this.on('clustermouseout',this._hideCoverage,this),a.on('zoomend',this._hideCoverage,this))},_zoomOrSpiderfy:function(a){var b=this._map;b.getMaxZoom()===b.getZoom()?this.options.spiderfyOnMaxZoom&&a.layer.spiderfy():this.options.zoomToBoundsOnClick&&a.layer.zoomToBounds(),a.originalEvent&&a.originalEvent.keyCode===13&&b._container.focus()},_showCoverage:function(b){var c=this._map;if(this._inZoomAnimation)return;this._shownPolygon&&c.removeLayer(this._shownPolygon),b.layer.getChildCount()>2&&b.layer!==this._spiderfied&&(this._shownPolygon=new a.Polygon(b.layer.getConvexHull(),this.options.polygonOptions),c.addLayer(this._shownPolygon))},_hideCoverage:function(){this._shownPolygon&&(this._map.removeLayer(this._shownPolygon),this._shownPolygon=null)},_unbindEvents:function(){var a=this.options.spiderfyOnMaxZoom,b=this.options.showCoverageOnHover,c=this.options.zoomToBoundsOnClick,d=this._map;(a||c)&&this.off('clusterclick',this._zoomOrSpiderfy,this),b&&(this.off('clustermouseover',this._showCoverage,this),this.off('clustermouseout',this._hideCoverage,this),d.off('zoomend',this._hideCoverage,this))},_zoomEnd:function(){if(!this._map)return;this._mergeSplitClusters(),this._zoom=this._map._zoom,this._currentShownBounds=this._getExpandedVisibleBounds()},_moveEnd:function(){if(this._inZoomAnimation)return;var a=this._getExpandedVisibleBounds();this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds,this._zoom,a),this._topClusterLevel._recursivelyAddChildrenToMap(null,this._map._zoom,a),this._currentShownBounds=a;return},_generateInitialClusters:function(){var c=this._map.getMaxZoom(),d=this.options.maxClusterRadius;this.options.disableClusteringAtZoom&&(c=this.options.disableClusteringAtZoom-1),this._maxZoom=c,this._gridClusters={},this._gridUnclustered={};for(var b=c;b>=0;b--)this._gridClusters[b]=new a.DistanceGrid(d),this._gridUnclustered[b]=new a.DistanceGrid(d);this._topClusterLevel=new a.MarkerCluster(this,-1)},_addLayer:function(e,c){var h=this._gridClusters,i=this._gridUnclustered,k,d;for(this.options.singleMarkerMode&&(e.options.icon=this.options.iconCreateFunction({getChildCount:function(){return 1},getAllChildMarkers:function(){return[e]}}));c>=0;c--){k=this._map.project(e.getLatLng(),c);var b=h[c].getNearObject(k);if(b){b._addChild(e),e.__parent=b;return}if(b=i[c].getNearObject(k),b){var j=b.__parent;j&&this._removeLayer(b,!1);var f=new a.MarkerCluster(this,c,b,e);h[c].addObject(f,this._map.project(f._cLatLng,c)),b.__parent=f,e.__parent=f;var g=f;for(d=c-1;d>j._zoom;d--)g=new a.MarkerCluster(this,d,g),h[d].addObject(g,this._map.project(b.getLatLng(),d));for(j._addChild(g),d=c;d>=0;d--)if(!i[d].removeObject(b,this._map.project(b.getLatLng(),d)))break;return}i[c].addObject(e,k)}this._topClusterLevel._addChild(e),e.__parent=this._topClusterLevel;return},_enqueue:function(b){this._queue.push(b),this._queueTimeout||(this._queueTimeout=setTimeout(a.bind(this._processQueue,this),300))},_processQueue:function(){for(var a=0;a<this._queue.length;a++)this._queue[a].call(this);this._queue.length=0,clearTimeout(this._queueTimeout),this._queueTimeout=null},_mergeSplitClusters:function(){this._processQueue(),this._zoom<this._map._zoom&&this._currentShownBounds.contains(this._getExpandedVisibleBounds())?(this._animationStart(),this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds,this._zoom,this._getExpandedVisibleBounds()),this._animationZoomIn(this._zoom,this._map._zoom)):this._zoom>this._map._zoom?(this._animationStart(),this._animationZoomOut(this._zoom,this._map._zoom)):this._moveEnd()},_getExpandedVisibleBounds:function(){if(!this.options.removeOutsideVisibleBounds)return this.getBounds();var g=this._map,d=g.getBounds(),b=d._southWest,c=d._northEast,e=a.Browser.mobile?0:Math.abs(b.lat-c.lat),f=a.Browser.mobile?0:Math.abs(b.lng-c.lng);return new a.LatLngBounds(new a.LatLng(b.lat-e,b.lng-f,!0),new a.LatLng(c.lat+e,c.lng+f,!0))},_animationAddLayerNonAnimated:function(c,a){if(a===c)this._featureGroup.addLayer(c);else if(a._childCount===2){a._addToMap();var b=a.getAllChildMarkers();this._featureGroup.removeLayer(b[0]),this._featureGroup.removeLayer(b[1])}else a._updateIcon()}}),a.MarkerClusterGroup.include(a.DomUtil.TRANSITION?{_animationStart:function(){this._map._mapPane.className+=' leaflet-cluster-anim',this._inZoomAnimation++},_animationEnd:function(){this._map&&(this._map._mapPane.className=this._map._mapPane.className.replace(' leaflet-cluster-anim','')),this._inZoomAnimation--,this.fire('animationend')},_animationZoomIn:function(e,c){var b=this._getExpandedVisibleBounds(),d=this._featureGroup,f;this._topClusterLevel._recursively(b,e,0,function(a){var g=a._latlng,h=a._markers,i;for(b.contains(g)||(g=null),a._isSingleParent()&&e+1===c?(d.removeLayer(a),a._recursivelyAddChildrenToMap(null,c,b)):(a.setOpacity(0),a._recursivelyAddChildrenToMap(g,c,b)),f=h.length-1;f>=0;f--)i=h[f],b.contains(i._latlng)||d.removeLayer(i)}),this._forceLayout(),this._topClusterLevel._recursivelyBecomeVisible(b,c),d.eachLayer(function(b){!(b instanceof a.MarkerCluster)&&b._icon&&b.setOpacity(1)}),this._topClusterLevel._recursively(b,e,c,function(a){a._recursivelyRestoreChildPositions(c)}),this._enqueue(function(){this._topClusterLevel._recursively(b,e,0,function(a){d.removeLayer(a),a.setOpacity(1)}),this._animationEnd()})},_animationZoomOut:function(a,b){this._animationZoomOutSingle(this._topClusterLevel,a-1,b),this._topClusterLevel._recursivelyAddChildrenToMap(null,b,this._getExpandedVisibleBounds()),this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds,a,this._getExpandedVisibleBounds())},_animationZoomOutSingle:function(a,d,c){var b=this._getExpandedVisibleBounds();a._recursivelyAnimateChildrenInAndAddSelfToMap(b,d+1,c);var e=this;this._forceLayout(),a._recursivelyBecomeVisible(b,c),this._enqueue(function(){if(a._childCount===1){var f=a._markers[0];f.setLatLng(f.getLatLng()),f.setOpacity(1)}else a._recursively(b,c,0,function(a){a._recursivelyRemoveChildrenFromMap(b,d+1)});e._animationEnd()})},_animationAddLayer:function(a,b){var c=this,d=this._featureGroup;d.addLayer(a),b!==a&&(b._childCount>2?(b._updateIcon(),this._forceLayout(),this._animationStart(),a._setPos(this._map.latLngToLayerPoint(b.getLatLng())),a.setOpacity(0),this._enqueue(function(){d.removeLayer(a),a.setOpacity(1),c._animationEnd()})):(this._forceLayout(),c._animationStart(),c._animationZoomOutSingle(b,this._map.getMaxZoom(),this._map.getZoom())))},_forceLayout:function(){a.Util.falseFn(document.body.offsetWidth)}}:{_animationStart:function(){},_animationZoomIn:function(a,b){this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds,a),this._topClusterLevel._recursivelyAddChildrenToMap(null,b,this._getExpandedVisibleBounds())},_animationZoomOut:function(a,b){this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds,a),this._topClusterLevel._recursivelyAddChildrenToMap(null,b,this._getExpandedVisibleBounds())},_animationAddLayer:function(a,b){this._animationAddLayerNonAnimated(a,b)}}),a.markerClusterGroup=function(b){return new a.MarkerClusterGroup(b)},a.MarkerCluster=a.Marker.extend({initialize:function(d,e,b,c){a.Marker.prototype.initialize.call(this,b?b._cLatLng||b.getLatLng():new a.LatLng(0,0),{icon:this}),this._group=d,this._zoom=e,this._markers=[],this._childClusters=[],this._childCount=0,this._iconNeedsUpdate=!0,this._bounds=new a.LatLngBounds,b&&this._addChild(b),c&&this._addChild(c)},getAllChildMarkers:function(a){a=a||[];for(var b=this._childClusters.length-1;b>=0;b--)this._childClusters[b].getAllChildMarkers(a);for(var c=this._markers.length-1;c>=0;c--)a.push(this._markers[c]);return a},getChildCount:function(){return this._childCount},zoomToBounds:function(){var a=this._childClusters.slice(),f=this._group._map,c=f.getBoundsZoom(this._bounds),b=this._zoom+1,g=f.getZoom(),d;while(a.length>0&&c>b){b++;var e=[];for(d=0;d<a.length;d++)e=e.concat(a[d]._childClusters);a=e}c>b?this._group._map.setView(this._latlng,b):c<=g?this._group._map.setView(this._latlng,g+1):this._group._map.fitBounds(this._bounds)},getBounds:function(){var b=new a.LatLngBounds;return b.extend(this._bounds),b},_updateIcon:function(){this._iconNeedsUpdate=!0,this._icon&&this.setIcon(this)},createIcon:function(){return this._iconNeedsUpdate&&(this._iconObj=this._group.options.iconCreateFunction(this),this._iconNeedsUpdate=!1),this._iconObj.createIcon()},createShadow:function(){return this._iconObj.createShadow()},_addChild:function(b,c){this._iconNeedsUpdate=!0,this._expandBounds(b),b instanceof a.MarkerCluster?(c||(this._childClusters.push(b),b.__parent=this),this._childCount+=b._childCount):(c||this._markers.push(b),this._childCount++),this.__parent&&this.__parent._addChild(b,!0)},_expandBounds:function(c){var d,b=c._wLatLng||c._latlng;c instanceof a.MarkerCluster?(this._bounds.extend(c._bounds),d=c._childCount):(this._bounds.extend(b),d=1),this._cLatLng||(this._cLatLng=c._cLatLng||b);var e=this._childCount+d;this._wLatLng?(this._wLatLng.lat=(b.lat*d+this._wLatLng.lat*this._childCount)/e,this._wLatLng.lng=(b.lng*d+this._wLatLng.lng*this._childCount)/e):this._latlng=this._wLatLng=new a.LatLng(b.lat,b.lng)},_addToMap:function(a){a&&(this._backupLatlng=this._latlng,this.setLatLng(a)),this._group._featureGroup.addLayer(this)},_recursivelyAnimateChildrenIn:function(b,a,c){this._recursively(b,0,c-1,function(e){var d=e._markers,b,c;for(b=d.length-1;b>=0;b--)c=d[b],c._icon&&(c._setPos(a),c.setOpacity(0))},function(e){var d=e._childClusters,b,c;for(b=d.length-1;b>=0;b--)c=d[b],c._icon&&(c._setPos(a),c.setOpacity(0))})},_recursivelyAnimateChildrenInAndAddSelfToMap:function(a,b,c){this._recursively(a,c,0,function(d){d._recursivelyAnimateChildrenIn(a,d._group._map.latLngToLayerPoint(d.getLatLng()).round(),b),d._isSingleParent()&&b-1===c?(d.setOpacity(1),d._recursivelyRemoveChildrenFromMap(a,b)):d.setOpacity(0),d._addToMap()})},_recursivelyBecomeVisible:function(a,b){this._recursively(a,0,b,null,function(a){a.setOpacity(1)})},_recursivelyAddChildrenToMap:function(a,b,c){this._recursively(c,-1,b,function(e){if(b===e._zoom)return;for(var f=e._markers.length-1;f>=0;f--){var d=e._markers[f];if(!c.contains(d._latlng))continue;a&&(d._backupLatlng=d.getLatLng(),d.setLatLng(a),d.setOpacity&&d.setOpacity(0)),e._group._featureGroup.addLayer(d)}},function(b){b._addToMap(a)})},_recursivelyRestoreChildPositions:function(e){for(var b=this._markers.length-1;b>=0;b--){var a=this._markers[b];a._backupLatlng&&(a.setLatLng(a._backupLatlng),delete a._backupLatlng)}if(e-1===this._zoom)for(var c=this._childClusters.length-1;c>=0;c--)this._childClusters[c]._restorePosition();else for(var d=this._childClusters.length-1;d>=0;d--)this._childClusters[d]._recursivelyRestoreChildPositions(e)},_restorePosition:function(){this._backupLatlng&&(this.setLatLng(this._backupLatlng),delete this._backupLatlng)},_recursivelyRemoveChildrenFromMap:function(d,e,c){var a,b;this._recursively(d,-1,e-1,function(d){for(b=d._markers.length-1;b>=0;b--)a=d._markers[b],c&&c.contains(a._latlng)||(d._group._featureGroup.removeLayer(a),a.setOpacity&&a.setOpacity(1))},function(d){for(b=d._childClusters.length-1;b>=0;b--)a=d._childClusters[b],c&&c.contains(a._latlng)||(d._group._featureGroup.removeLayer(a),a.setOpacity&&a.setOpacity(1))})},_recursively:function(d,h,e,f,g){var c=this._childClusters,i=this._zoom,a,b;if(h>i)for(a=c.length-1;a>=0;a--)b=c[a],d.intersects(b._bounds)&&b._recursively(d,h,e,f,g);else if(f&&f(this),g&&this._zoom===e&&g(this),e>i)for(a=c.length-1;a>=0;a--)b=c[a],d.intersects(b._bounds)&&b._recursively(d,h,e,f,g)},_recalculateBounds:function(){var c=this._markers,d=this._childClusters,b;for(this._bounds=new a.LatLngBounds,delete this._wLatLng,b=c.length-1;b>=0;b--)this._expandBounds(c[b]);for(b=d.length-1;b>=0;b--)this._expandBounds(d[b])},_isSingleParent:function(){return this._childClusters.length>0&&this._childClusters[0]._childCount===this._childCount}}),a.DistanceGrid=function(a){this._cellSize=a,this._sqCellSize=a*a,this._grid={},this._objectPoint={}},a.DistanceGrid.prototype={addObject:function(g,b){var c=this._getCoord(b.x),d=this._getCoord(b.y),e=this._grid,f=e[d]=e[d]||{},h=f[c]=f[c]||[],i=a.Util.stamp(g);this._objectPoint[i]=b,h.push(g)},updateObject:function(a,b){this.removeObject(a),this.addObject(a,b)},removeObject:function(i,j){var c=this._getCoord(j.x),f=this._getCoord(j.y),g=this._grid,d=g[f]=g[f]||{},e=d[c]=d[c]||[],b,h;for(delete this._objectPoint[a.Util.stamp(i)],b=0,h=e.length;b<h;b++)if(e[b]===i)return e.splice(b,1),h===1&&delete d[c],!0},eachObject:function(i,j){var g,f,a,e,d,c,h,b=this._grid;for(g in b){d=b[g];for(f in d)for(c=d[f],a=0,e=c.length;a<e;a++)h=i.call(j,c[a]),h&&(a--,e--)}},getNearObject:function(i){var g=this._getCoord(i.x),h=this._getCoord(i.y),b,c,d,f,e,o,l,m,n=this._objectPoint,k=this._sqCellSize,j=null;for(b=h-1;b<=h+1;b++)if(f=this._grid[b],f)for(c=g-1;c<=g+1;c++)if(e=f[c],e)for(d=0,o=e.length;d<o;d++)l=e[d],m=this._sqDist(n[a.Util.stamp(l)],i),m<k&&(k=m,j=l);return j},_getCoord:function(a){return Math.floor(a/this._cellSize)},_sqDist:function(c,d){var a=d.x-c.x,b=d.y-c.y;return a*a+b*b}},function(){a.QuickHull={getDistant:function(b,a){var c=a[1].lat-a[0].lat,d=a[0].lng-a[1].lng;return d*(b.lat-a[0].lat)+c*(b.lng-a[0].lng)},findMostDistantPointFromBaseLine:function(h,g){var d=0,e=null,f=[],a,b,c;for(a=g.length-1;a>=0;a--){if(b=g[a],c=this.getDistant(b,h),!(c>0))continue;f.push(b),c>d&&(d=c,e=b)}return{maxPoint:e,newPoints:f}},buildConvexHull:function(c,d){var a=[],b=this.findMostDistantPointFromBaseLine(c,d);return b.maxPoint?(a=a.concat(this.buildConvexHull([c[0],b.maxPoint],b.newPoints)),a=a.concat(this.buildConvexHull([b.maxPoint,c[1]],b.newPoints)),a):[c[0]]},getConvexHull:function(b){var c=!1,d=!1,e=null,f=null,g;for(g=b.length-1;g>=0;g--){var a=b[g];(c===!1||a.lat>c)&&(e=a,c=a.lat),(d===!1||a.lat<d)&&(f=a,d=a.lat)}var h=[].concat(this.buildConvexHull([f,e],b),this.buildConvexHull([e,f],b));return h}}}(),a.MarkerCluster.include({getConvexHull:function(){var c=this.getAllChildMarkers(),d=[],e,b;for(b=c.length-1;b>=0;b--)e=c[b].getLatLng(),d.push(e);return a.QuickHull.getConvexHull(d)}}),a.MarkerCluster.include({_2PI:Math.PI*2,_circleFootSeparation:25,_circleStartAngle:Math.PI/6,_spiralFootSeparation:28,_spiralLengthStart:11,_spiralLengthFactor:5,_circleSpiralSwitchover:9,spiderfy:function(){if(this._group._spiderfied===this||this._group._inZoomAnimation)return;var a=this.getAllChildMarkers(),d=this._group,e=d._map,b=e.latLngToLayerPoint(this._latlng),c;this._group._unspiderfy(),this._group._spiderfied=this,a.length>=this._circleSpiralSwitchover?c=this._generatePointsSpiral(a.length,b):(b.y+=10,c=this._generatePointsCircle(a.length,b)),this._animationSpiderfy(a,c)},unspiderfy:function(a){if(this._group._inZoomAnimation)return;this._animationUnspiderfy(a),this._group._spiderfied=null},_generatePointsCircle:function(c,g){var h=this._group.options.spiderfyDistanceMultiplier*this._circleFootSeparation*(2+c),e=h/this._2PI,i=this._2PI/c,d=[],b,f;for(d.length=c,b=c-1;b>=0;b--)f=this._circleStartAngle+b*i,d[b]=new a.Point(g.x+e*Math.cos(f),g.y+e*Math.sin(f))._round();return d},_generatePointsSpiral:function(f,g){var b=this._group.options.spiderfyDistanceMultiplier*this._spiralLengthStart,h=this._group.options.spiderfyDistanceMultiplier*this._spiralFootSeparation,i=this._group.options.spiderfyDistanceMultiplier*this._spiralLengthFactor,c=0,e=[],d;for(e.length=f,d=f-1;d>=0;d--)c+=h/b+d*5e-4,e[d]=new a.Point(g.x+b*Math.cos(c),g.y+b*Math.sin(c))._round(),b+=this._2PI*i/c;return e},_noanimationUnspiderfy:function(){var b=this._group,e=b._map,f=b._featureGroup,d=this.getAllChildMarkers(),a,c;for(this.setOpacity(1),c=d.length-1;c>=0;c--)a=d[c],f.removeLayer(a),a._preSpiderfyLatlng&&(a.setLatLng(a._preSpiderfyLatlng),delete a._preSpiderfyLatlng),a.setZIndexOffset&&a.setZIndexOffset(0),a._spiderLeg&&(e.removeLayer(a._spiderLeg),delete a._spiderLeg);b._spiderfied=null}}),a.MarkerCluster.include(a.DomUtil.TRANSITION?{SVG_ANIMATION:function(){return document.createElementNS('http://www.w3.org/2000/svg','animate').toString().indexOf('SVGAnimate')>-1}(),_animationSpiderfy:function(g,p){var m=this,e=this._group,h=e._map,j=e._featureGroup,n=h.latLngToLayerPoint(this._latlng),d,c,f,k;for(d=g.length-1;d>=0;d--)c=g[d],c.setOpacity?(c.setZIndexOffset(1e6),c.setOpacity(0),j.addLayer(c),c._setPos(n)):j.addLayer(c);e._forceLayout(),e._animationStart();var o=a.Path.SVG?0:.3,l=a.Path.SVG_NS;for(d=g.length-1;d>=0;d--){if(k=h.layerPointToLatLng(p[d]),c=g[d],c._preSpiderfyLatlng=c._latlng,c.setLatLng(k),c.setOpacity&&c.setOpacity(1),f=new a.Polyline([m._latlng,k],{weight:1.5,color:'#222',opacity:o}),h.addLayer(f),c._spiderLeg=f,!(a.Path.SVG&&this.SVG_ANIMATION))continue;var i=f._path.getTotalLength();f._path.setAttribute('stroke-dasharray',i+','+i);var b=document.createElementNS(l,'animate');b.setAttribute('attributeName','stroke-dashoffset'),b.setAttribute('begin','indefinite'),b.setAttribute('from',i),b.setAttribute('to',0),b.setAttribute('dur',.25),f._path.appendChild(b),b.beginElement(),b=document.createElementNS(l,'animate'),b.setAttribute('attributeName','stroke-opacity'),b.setAttribute('attributeName','stroke-opacity'),b.setAttribute('begin','indefinite'),b.setAttribute('from',0),b.setAttribute('to',.5),b.setAttribute('dur',.25),f._path.appendChild(b),b.beginElement()}if(m.setOpacity(.3),a.Path.SVG)for(this._group._forceLayout(),d=g.length-1;d>=0;d--)c=g[d]._spiderLeg,c.options.opacity=.5,c._path.setAttribute('stroke-opacity',.5);setTimeout(function(){e._animationEnd(),e.fire('spiderfied')},200)},_animationUnspiderfy:function(i){var f=this._group,g=f._map,h=f._featureGroup,j=i?g._latLngToNewLayerPoint(this._latlng,i.zoom,i.center):g.latLngToLayerPoint(this._latlng),e=this.getAllChildMarkers(),k=a.Path.SVG&&this.SVG_ANIMATION,b,c,d;for(f._animationStart(),this.setOpacity(1),c=e.length-1;c>=0;c--){if(b=e[c],!b._preSpiderfyLatlng)continue;b.setLatLng(b._preSpiderfyLatlng),delete b._preSpiderfyLatlng,b.setOpacity?(b._setPos(j),b.setOpacity(0)):h.removeLayer(b),k&&(d=b._spiderLeg._path.childNodes[0],d.setAttribute('to',d.getAttribute('from')),d.setAttribute('from',0),d.beginElement(),d=b._spiderLeg._path.childNodes[1],d.setAttribute('from',.5),d.setAttribute('to',0),d.setAttribute('stroke-opacity',0),d.beginElement(),b._spiderLeg._path.setAttribute('stroke-opacity',0))}setTimeout(function(){var a=0;for(c=e.length-1;c>=0;c--)b=e[c],b._spiderLeg&&a++;for(c=e.length-1;c>=0;c--){if(b=e[c],!b._spiderLeg)continue;b.setOpacity&&(b.setOpacity(1),b.setZIndexOffset(0)),a>1&&h.removeLayer(b),g.removeLayer(b._spiderLeg),delete b._spiderLeg}f._animationEnd()},200)}}:{_animationSpiderfy:function(h,j){var d=this._group,e=d._map,i=d._featureGroup,c,b,f,g;for(c=h.length-1;c>=0;c--)g=e.layerPointToLatLng(j[c]),b=h[c],b._preSpiderfyLatlng=b._latlng,b.setLatLng(g),b.setZIndexOffset&&b.setZIndexOffset(1e6),i.addLayer(b),f=new a.Polyline([this._latlng,g],{weight:1.5,color:'#222'}),e.addLayer(f),b._spiderLeg=f;this.setOpacity(.3),d.fire('spiderfied')},_animationUnspiderfy:function(){this._noanimationUnspiderfy()}}),a.MarkerClusterGroup.include({_spiderfied:null,_spiderfierOnAdd:function(){this._map.on('click',this._unspiderfyWrapper,this),this._map.options.zoomAnimation&&this._map.on('zoomstart',this._unspiderfyZoomStart,this),this._map.on('zoomend',this._noanimationUnspiderfy,this),a.Path.SVG&&!a.Browser.touch&&this._map._initPathRoot()},_spiderfierOnRemove:function(){this._map.off('click',this._unspiderfyWrapper,this),this._map.off('zoomstart',this._unspiderfyZoomStart,this),this._map.off('zoomanim',this._unspiderfyZoomAnim,this),this._unspiderfy()},_unspiderfyZoomStart:function(){if(!this._map)return;this._map.on('zoomanim',this._unspiderfyZoomAnim,this)},_unspiderfyZoomAnim:function(b){if(a.DomUtil.hasClass(this._map._mapPane,'leaflet-touching'))return;this._map.off('zoomanim',this._unspiderfyZoomAnim,this),this._unspiderfy(b)},_unspiderfyWrapper:function(){this._unspiderfy()},_unspiderfy:function(a){this._spiderfied&&this._spiderfied.unspiderfy(a)},_noanimationUnspiderfy:function(){this._spiderfied&&this._spiderfied._noanimationUnspiderfy()},_unspiderfyLayer:function(a){a._spiderLeg&&(this._featureGroup.removeLayer(a),a.setOpacity(1),a.setZIndexOffset(0),this._map.removeLayer(a._spiderLeg),delete a._spiderLeg)}})

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

function a(a,b,c,d){return typeof a==='function'?a(b,c,d):a}var b=require('leaflet'),c=require('./../render/canvas');require('./../core/utils');var d=b.dmap=b.dmap||{},e=d.Utils,f=e.getSprite,g=b.Class.extend({includes:[b.Mixin.Events],initialize:function(a){a=this.options=e.deepMerge(g.options,a),this.isable=!0,this.sprite=this.updateSprite(a.sprite),this.updateGroups(a.groups)},disable:function(){this.isable=!1},enable:function(){this.isable=!0},addTo:function(a){if(this._map||!a)return;this._map=a,this.initCanvas(),this.initEventsMap(),this.updateBlending()},initCanvas:function(){var b=this._map,a=this.options,d=a.container;this.dCanvas=new c(b,d,a)},data:function(d,a){a=a||{};var e=this.map,c=this;this._data=d,this.transfer=a.transfer||function(a,d){return c._map.latLngToContainerPoint(b.latLng(a,d))},this.valueFunc=function(a){return a.value}},updateOptions:function(a){a&&(this.options=e.deepMerge(this.options,a)),this.sprite=this.updateSprite(),this.updateBlending(),this.draw()},updateSprite:function(a){return a=a||this.options.sprite,a=f(a),a},updateGroups:function(b){if(!b)return;for(var c in b){var a=b[c];a.sprite&&(a.sprite=this.updateSprite(a.sprite))}},updateFilter:function(a){if(!a||typeof a!=='function')return;this.options.filter=a,this.draw()},updateBlending:function(a){if(a)return this.dCanvas.ctx.globalCompositeOperation=this.options.blending=a;this.dCanvas.ctx.globalCompositeOperation=this.options.blending},render:function(a,b){a&&this.data(a),this.draw(b)},draw:function(y){y||this.clean();var B=this._map,k=this._map.getZoom(),c=this.options,m=!0,n=this.options.filter;if(!this.isable)return;var v=this.transfer,j=this._data,A=this.valueFunc,e,z=this.sprites,g=this.dCanvas,o=c.lng.bind(c),l=c.lat.bind(c),u=g.w,t=g.h,b,r,q,p,f,d,s,i=c.groups;for(var w in j){if(b=j[w],!b)continue;if(n&&(m=n(b)),!m)continue;if(r=o?o(b):b.lng,q=l?l(b):b.lat,!(r&&q))continue;if(p=v(q,r),f=p.x,d=p.y,f<0||f>u||d<0||d>t)continue;if(i)for(var x in i){var h=i[x];if(s=h.size(b,k),e=h.sprite,s&&e&&h.filter(b)){g.pt(e,f,d,s);break}}else e=this.sprite,g.pt(e,f,d,a(c.size,b,k))}},clean:function(a){this.dCanvas.clear(a)},initEventsMap:function(){this.dCanvas.onUpdate(function(){this.draw()}.bind(this))},destroy:function(){this.dCanvas.destroy()}});g.options={lng:e.getLng,lat:e.getLat,refreshInterval:1,size:function(a){return 40},blending:'lighter',clearAlpha:1,container:'tilePane',sprite:{drawN:1.15,color:{from:'rgba(245,230,0,0.3)',to:'rgba(245,245,0,0.04)',easing:'Linear.None.1.7',space:'rgb'}}},d.ScatterCanvas=g,d.scatterCanvas=function(a){return new g(a)},module.exports=g
function a(a,b,c,d){return typeof a==='function'?a(b,c,d):a}var b=require('./../leaflet'),c=require('./../render/canvas');require('./../core/utils');var d=b.dmap=b.dmap||{},e=d.Utils,f=e.getSprite,g=b.Class.extend({includes:[b.Mixin.Events],initialize:function(a){a=this.options=e.deepMerge(g.options,a),this.isable=!0,this.sprite=this.updateSprite(a.sprite),this.updateGroups(a.groups)},disable:function(){this.isable=!1},enable:function(){this.isable=!0},addTo:function(a){if(this._map||!a)return;this._map=a,this.initCanvas(),this.initEventsMap(),this.updateBlending()},initCanvas:function(){var b=this._map,a=this.options,d=a.container;this.dCanvas=new c(b,d,a)},data:function(d,a){a=a||{};var e=this.map,c=this;this._data=d,this.transfer=a.transfer||function(a,d){return c._map.latLngToContainerPoint(b.latLng(a,d))},this.valueFunc=function(a){return a.value}},updateOptions:function(a){a&&(this.options=e.deepMerge(this.options,a)),this.sprite=this.updateSprite(),this.updateBlending(),this.draw()},updateSprite:function(a){return a=a||this.options.sprite,a=f(a),a},updateGroups:function(b){if(!b)return;for(var c in b){var a=b[c];a.sprite&&(a.sprite=this.updateSprite(a.sprite))}},updateFilter:function(a){if(!a||typeof a!=='function')return;this.options.filter=a,this.draw()},updateBlending:function(a){if(a)return this.dCanvas.ctx.globalCompositeOperation=this.options.blending=a;this.dCanvas.ctx.globalCompositeOperation=this.options.blending},render:function(a,b){a&&this.data(a),this.draw(b)},draw:function(y){y||this.clean();var B=this._map,k=this._map.getZoom(),c=this.options,m=!0,n=this.options.filter;if(!this.isable)return;var v=this.transfer,j=this._data,A=this.valueFunc,e,z=this.sprites,g=this.dCanvas,o=c.lng.bind(c),l=c.lat.bind(c),u=g.w,t=g.h,b,r,q,p,f,d,s,i=c.groups;for(var w in j){if(b=j[w],!b)continue;if(n&&(m=n(b)),!m)continue;if(r=o?o(b):b.lng,q=l?l(b):b.lat,!(r&&q))continue;if(p=v(q,r),f=p.x,d=p.y,f<0||f>u||d<0||d>t)continue;if(i)for(var x in i){var h=i[x];if(s=h.size(b,k),e=h.sprite,s&&e&&h.filter(b)){g.pt(e,f,d,s);break}}else e=this.sprite,g.pt(e,f,d,a(c.size,b,k))}},clean:function(a){this.dCanvas.clear(a)},initEventsMap:function(){this.dCanvas.onUpdate(function(){this.draw()}.bind(this))},destroy:function(){this.dCanvas.destroy()}});g.options={lng:e.getLng,lat:e.getLat,refreshInterval:1,size:function(a){return 40},blending:'lighter',clearAlpha:1,container:'tilePane',sprite:{drawN:1.15,color:{from:'rgba(245,230,0,0.3)',to:'rgba(245,245,0,0.04)',easing:'Linear.None.1.7',space:'rgb'}}},d.ScatterCanvas=g,d.scatterCanvas=function(a){return new g(a)},module.exports=g

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

function a(a,b,c,d){return typeof a==='function'?a(b,c,d):a}var b=require('leaflet'),c=require('konva'),d=require('lodash'),e=require('./../render/leaflet_layer_konva'),f=require('./../core/utils'),g=f.getSprite,h=f.fireEvent,a=f.getValue,i=b.Class.extend({includes:[b.Mixin.Events],initialize:function(a){a=this.options=f.deepMerge(i.options,a),this.resetVariables()},resetVariables:function(){this.isable=!0},disable:function(){this.isable=!1,this.kLeafLayer.disable()},enable:function(){this.isable=!0,this.kLeafLayer.enable()},addTo:function(a){if(this._map||!a)return;this._map=a,this.initCanvas(),this.initEventsMap(),this.initEventsShapes()},initEventsShapes:function(){var d=this,b=this.options.hoverScale||1,a,c=this.kLeafLayer.onKonva('dragstart',function(a){}).onKonva('mouseover touchstart',function(c){a=c.target,a.setAttrs({scale:{x:b,y:b}}),a.parent.draw()}).onKonva('mouseout',function(b){a=b.target,a.setAttrs({scale:{x:1,y:1}}),a.parent.draw()}).onKonva('mouseout mouseup touchend',function(a){setTimeout(function(){c.enableMapEvents()})}).onKonva('mousedown touchstart',this.onMouseDown.bind(this)),e=['mouseout','mousedown','mouseover','mouseout','touchstart','touchend','touchup'];e.forEach(function(a){c.onKonva(a,function(b){h(a,b,d)})})},onMouseDown:function(g){var c=this.options,e=this._map,d=g.target,f=d.__data,a=c.popup;if(a&&(a=a.bind(c)),a||(a=c.child.popup,a&&(a=a.bind(c.child))),!a)return;popupText=a(f),setTimeout(function(){if(f){var a=f.getClientRect(),d=a.x+a.width/2,e=a.y,c=g.containerPointToLatLng(b.point(d,e));g.openPopup(popupText,b.latLng(c.lat,c.lng))}}.bind(this)),this.kLeafLayer.disableMapEvents()},initCanvas:function(){var b=this._map,a=this.options,d=b.getSize(),f=new c.Stage({container:a.container,width:d.x,height:d.y}),g=this.kLeafLayer=new e(f,{transition:a.lazyFresh.transition,blending:a.blending,ptNPerLayer:a.ptNPerLayer});g.addTo(b),this.initEditor()},data:function(c){this._data=c;var a=this.options,b=a.zIndex||a.child.zIndex;b&&(this._data=d.sortBy(c,b))},updateOptions:function(a){var b=this.kLeafLayer;b.resetOffset(),a&&(this.options=f.deepMerge(this.options,a)),b.hideLayers(),b.updateOptions({transition:a.lazyFresh.transition,blending:a.blending,ptNPerLayer:a.ptNPerLayer}),this.draw()},updateFilter:function(a){if(!a||typeof a!=='function')return;this.options.filter=a,this.draw()},render:function(a){a&&this.data(a),a&&this.kLeafLayer.beginDraw(),this.draw(),a&&this.kLeafLayer.endDraw()},createShapeAttr:function(e,n){if(!this.isable)return;var d=this.options,i=d.lat.bind(d),l=d.lng.bind(d),k=a(d.id.bind(d),e),f=a(d.size,e)||1,m=i(e),j=l(e),h=this._map.latLngToContainerPoint(b.latLng(m,j));return{data:e,Constructor:c.Image,index:n,id:k,attrs:{x:h.x,y:h.y,offset:{x:f/2,y:f/2},image:g(d.sprite||d.child.sprite,e),width:f,height:f,draggable:!1}}},draw:function(){var b=this._data;if(!b)return;if(!this.isable)return;var d,f,c=this.kLeafLayer,e=this.options.filter;for(var a=b.length-1;a>-1;a--){if(d=b[a],e&&!e(d,a))continue;f=this.createShapeAttr(d,a),c.addOrSetShape(f)}c.stopLazyFresh(),c.lazyFresh()},initEventsMap:function(){this._map.on('zoomend',this.draw.bind(this)).on('moveend',this.draw.bind(this))},destroy:function(){this.kLeafLayer.destroy()},initEditor:function(){this.eidtList=[],this.kLeafLayer.initEditor(),this.initEventEditor()},enableEditor:function(){this.kLeafLayer.enableEditor()},disableEditor:function(){this.kLeafLayer.disableEditor()},initEventEditor:function(){var a=this;this.kLeafLayer.on('shape-dragged',function(b){a.onShapeDragged(b.shape)})},onShapeDragged:function(e){var a=e.getClientRect(),f=a.x+a.width/2,g=a.y+a.height/2,h=this._map.containerPointToLatLng(b.point(f,g)),i=this.options,d=i.editor.setLatLng;if(!d)return console.log('请设置options.editor.setLatLng');var c=e.__data;d(h,c),this.kLeafLayer.addOrSetShape(c,null,!0),this.eidtList.push(c),this.fire('data-edited',c)},isEdited:function(){return this.eidtList.length>0},submitEdit:function(){var a=this.options,b=this.eidtList}});i.options={lng:f.getLng,lat:f.getLat,refreshInterval:1,ptNPerLayer:1e3,lazyFresh:{transition:'opacity 0.4s'},size:function(a){return 40},id:function(a,b){return a.id||b},hoverScale:1.2,blending:'lighter',container:'tilePane',sprite:{drawN:1.15,color:{from:'rgba(245,230,0,1)',to:'rgba(205,0,0, 0.6)',easing:'Linear.None.1.7',space:'rgb'}},child:{},editor:{setLatLng:function(b,a){if(!a)return;a.lat=b.lat,a.lng=b.lng}}};var j=b.dmap=b.dmap||{};j.ScatterKonva=i,j.scatterKonva=function(a){return new i(a)},module.exports=i
function a(a,b,c,d){return typeof a==='function'?a(b,c,d):a}var b=require('./../leaflet'),c=require('konva'),d=require('lodash'),e=require('./../render/leaflet_layer_konva'),f=require('./../core/utils'),g=f.getSprite,h=f.fireEvent,a=f.getValue,i=b.Class.extend({includes:[b.Mixin.Events],initialize:function(a){a=this.options=f.deepMerge(i.options,a),this.resetVariables()},resetVariables:function(){this.isable=!0},disable:function(){this.isable=!1,this.kLeafLayer.disable()},enable:function(){this.isable=!0,this.kLeafLayer.enable()},addTo:function(a){if(this._map||!a)return;this._map=a,this.initCanvas(),this.initEventsMap(),this.initEventsShapes()},initEventsShapes:function(){var d=this,b=this.options.hoverScale||1,a,c=this.kLeafLayer.onKonva('dragstart',function(a){}).onKonva('mouseover touchstart',function(c){a=c.target,a.setAttrs({scale:{x:b,y:b}}),a.parent.draw()}).onKonva('mouseout',function(b){a=b.target,a.setAttrs({scale:{x:1,y:1}}),a.parent.draw()}).onKonva('mouseout mouseup touchend',function(a){setTimeout(function(){c.enableMapEvents()})}).onKonva('mousedown touchstart',this.onMouseDown.bind(this)),e=['mouseout','mousedown','mouseover','mouseout','touchstart','touchend','touchup'];e.forEach(function(a){c.onKonva(a,function(b){h(a,b,d)})})},onMouseDown:function(g){var c=this.options,e=this._map,d=g.target,f=d.__data,a=c.popup;if(a&&(a=a.bind(c)),a||(a=c.child.popup,a&&(a=a.bind(c.child))),!a)return;popupText=a(f),setTimeout(function(){if(f){var a=f.getClientRect(),d=a.x+a.width/2,e=a.y,c=g.containerPointToLatLng(b.point(d,e));g.openPopup(popupText,b.latLng(c.lat,c.lng))}}.bind(this)),this.kLeafLayer.disableMapEvents()},initCanvas:function(){var b=this._map,a=this.options,d=b.getSize(),f=new c.Stage({container:a.container,width:d.x,height:d.y}),g=this.kLeafLayer=new e(f,{transition:a.lazyFresh.transition,blending:a.blending,ptNPerLayer:a.ptNPerLayer});g.addTo(b),this.initEditor()},data:function(c){this._data=c;var a=this.options,b=a.zIndex||a.child.zIndex;b&&(this._data=d.sortBy(c,b))},updateOptions:function(a){var b=this.kLeafLayer;b.resetOffset(),a&&(this.options=f.deepMerge(this.options,a)),b.hideLayers(),b.updateOptions({transition:a.lazyFresh.transition,blending:a.blending,ptNPerLayer:a.ptNPerLayer}),this.draw()},updateFilter:function(a){if(!a||typeof a!=='function')return;this.options.filter=a,this.draw()},render:function(a){a&&this.data(a),a&&this.kLeafLayer.beginDraw(),this.draw(),a&&this.kLeafLayer.endDraw()},createShapeAttr:function(e,n){if(!this.isable)return;var d=this.options,i=d.lat.bind(d),l=d.lng.bind(d),k=a(d.id.bind(d),e),f=a(d.size,e)||1,m=i(e),j=l(e),h=this._map.latLngToContainerPoint(b.latLng(m,j));return{data:e,Constructor:c.Image,index:n,id:k,attrs:{x:h.x,y:h.y,offset:{x:f/2,y:f/2},image:g(d.sprite||d.child.sprite,e),width:f,height:f,draggable:!1}}},draw:function(){var b=this._data;if(!b)return;if(!this.isable)return;var d,f,c=this.kLeafLayer,e=this.options.filter;for(var a=b.length-1;a>-1;a--){if(d=b[a],e&&!e(d,a))continue;f=this.createShapeAttr(d,a),c.addOrSetShape(f)}c.stopLazyFresh(),c.lazyFresh()},initEventsMap:function(){this._map.on('zoomend',this.draw.bind(this)).on('moveend',this.draw.bind(this))},destroy:function(){this.kLeafLayer.destroy()},initEditor:function(){this.eidtList=[],this.kLeafLayer.initEditor(),this.initEventEditor()},enableEditor:function(){this.kLeafLayer.enableEditor()},disableEditor:function(){this.kLeafLayer.disableEditor()},initEventEditor:function(){var a=this;this.kLeafLayer.on('shape-dragged',function(b){a.onShapeDragged(b.shape)})},onShapeDragged:function(e){var a=e.getClientRect(),f=a.x+a.width/2,g=a.y+a.height/2,h=this._map.containerPointToLatLng(b.point(f,g)),i=this.options,d=i.editor.setLatLng;if(!d)return console.log('请设置options.editor.setLatLng');var c=e.__data;d(h,c),this.kLeafLayer.addOrSetShape(c,null,!0),this.eidtList.push(c),this.fire('data-edited',c)},isEdited:function(){return this.eidtList.length>0},submitEdit:function(){var a=this.options,b=this.eidtList}});i.options={lng:f.getLng,lat:f.getLat,refreshInterval:1,ptNPerLayer:1e3,lazyFresh:{transition:'opacity 0.4s'},size:function(a){return 40},id:function(a,b){return a.id||b},hoverScale:1.2,blending:'lighter',container:'tilePane',sprite:{drawN:1.15,color:{from:'rgba(245,230,0,1)',to:'rgba(205,0,0, 0.6)',easing:'Linear.None.1.7',space:'rgb'}},child:{},editor:{setLatLng:function(b,a){if(!a)return;a.lat=b.lat,a.lng=b.lng}}};var j=b.dmap=b.dmap||{};j.ScatterKonva=i,j.scatterKonva=function(a){return new i(a)},module.exports=i

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

function a(b){b=this.options=d.deepMerge(a.options,b),this.initialize(b)}var b=require('leaflet');require('./../render/canvas'),require('./../core/utils');var c=b.dmap=b.dmap||{},d=c.Utils,e=require('bcore/event');require('./../index.css'),require('./scatter_marker.css');var f=b.Marker,a=e.extend(a,{initialize:function(a){this.initDom()},initDom:function(){var c=this.options,a=b.divIcon({className:'circle-node'}),d=this.marker=new f([0,0],{icon:a})},addTo:function(a){if(!a)return;this._map=a,this.marker.addTo(a),this.initDomIcon(),this.initEventsMarker()},initEventsMarker:function(){var a=this;this.marker.on('click',function(){a.emit('click',{id:a.id,com:a})})},initDomIcon:function(){var a=this.options.shape.html.bind(this);if(!a)return;var b=this.marker,c=this.container=b._icon;a(c)},updateOptions:function(a){this.options=d.deepMerge(this.options,a)},data:function(a){if(!a)return;this._data=a,this.updateData(a)},updateData:function(b){b=b||this._data;var a=this.options,i=a.id,d=i(b);d!==null&&d!==undefined&&(this.id=d);var l=a.lng,m=a.lat,n=m(b),j=l(b);this.updateCenter(n,j);var e=a.text.bind(a);if(e){var k=e(b,this.textNode);this.updateText(k)}var f=(a.css||a.applyCss).bind(this),g=a.range||[];f&&f(b,this.textNode,g[0],g[1]);var h=a.popup.bind(this),o=[-5,-10];if(h){var c=h(b);if(c===undefined||c===null)return;if(typeof c==='string'||c==='number')return this.marker.bindPopup(c,{offset:o});this.marker.bindPopup(c.text,{offset:[0,10]})}},updateZIndex:function(){this._zIndex&&(this.container.style.zIndex=this._zIndex)},updateText:function(a){if(a===this._text)return;this._text=a;var b=this.textNode;b&&(b.innerHTML=a)},updateCenter:function(a,c){if(!(a&&c)||a===this._clat&&c===this._clng)return;this._clat=a,this._clng=c,this.marker.setLatLng(b.latLng(a,c))},render:function(a){a&&this.data(a)},destroy:function(){this.marker.off(),this._map.removeLayer(this.marker)}});a.options={lat:d.getLat,lng:d.getLng,id:function(a){return a.id},css:function(c,d){var a=10,b='#fff';return{background:b,left:-a,top:-a,width:2*a,height:2*a,'line-height':2*a+'px','border-radius':2*a}},text:function(a){return a.count},popup:function(a){this.marker.bindPopup(a[5],{offset:[0,-this.radius||-25]})},shape:{html:function(b){var a=document.createElement('div');a.className='alarm-circle interactive-circle',b.appendChild(a),this.textNode=a}}},c.ScatterMarker=a,c.scatterMarker=function(b){return new a(b)},module.exports=a
function a(c){c=this.options=b.deepMerge(a.options,c),this.initialize(c)}var c=require('./../leaflet');require('./../render/canvas');var b=require('./../core/utils'),d=c.dmap=c.dmap||{},b=d.Utils,e=require('bcore/event'),f=b.EVENTS;require('./../index.css'),require('./scatter_marker.css');var g=c.Marker,a=e.extend(a,{initialize:function(a){this.initDom()},initDom:function(){var b=this.options,a=c.divIcon({className:'circle-node'}),d=this.marker=new g([0,0],{icon:a})},addTo:function(a){if(!a)return;this._map=a,this.marker.addTo(a),this.initDomIcon(),this.initEvents()},initEvents:function(){var a=this,b=this.marker;f.forEach(function(c){b.on(c,function(){a.emit(c,{id:a.id,layer:a,data:a._data})})})},initDomIcon:function(){var a=this.options.shape.html.bind(this);if(!a)return;var b=this.marker,c=this.container=b._icon;a(c)},updateOptions:function(a){this.options=b.deepMerge(this.options,a)},data:function(a){if(!a)return;this._data=a,this.updateData(a)},updateData:function(b){b=b||this._data;var a=this.options,n=a.id,c=this.id=n(b);c!==null&&c!==undefined&&(this.id=c);var l=a.lng,m=a.lat,h=m(b),i=l(b);this.updateCenter(h,i);var d=a.text.bind(a);if(d){var k=d(b,this.textNode);this.updateText(k)}var e=(a.css||a.applyCss).bind(this),f=a.range||[];e&&e(b,this.textNode,f[0],f[1]);var g=a.popup.bind(this);if(g){var j=g(b);this.marker.__popup=j}},updateZIndex:function(){this._zIndex&&(this.container.style.zIndex=this._zIndex)},updateText:function(a){if(a===this._text)return;this._text=a;var b=this.textNode;b&&(b.innerHTML=a)},updateCenter:function(a,b){if(!(a&&b)||a===this._clat&&b===this._clng)return;this._clat=a,this._clng=b,this.marker.setLatLng(c.latLng(a,b))},render:function(a){a&&this.data(a)},destroy:function(){this.marker.off(),this._map.removeLayer(this.marker)}});a.options={lat:b.getLat,lng:b.getLng,id:function(a){return a.id},css:function(c,d){var a=10,b='#fff';return{background:b,left:-a,top:-a,width:2*a,height:2*a,'line-height':2*a+'px','border-radius':2*a}},text:function(a){return a.count},popup:function(a){return},shape:{html:function(b){var a=document.createElement('div');a.className='alarm-circle interactive-circle',b.appendChild(a),this.textNode=a}}},d.ScatterMarker=a,d.scatterMarker=function(b){return new a(b)},module.exports=a

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

function a(b){b=this.options=f.deepMerge(a.options,b),this.initialize(b)}var b=require('leaflet');require('./../core/utils');var c=require('bcore/event'),d=require('./scatter_marker'),e=b.dmap=b.dmap||{},f=e.Utils;a.options={lat:f.getLat,lng:f.getLng,filter:function(a,b){return!0},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=c.extend(a,{initialize:function(a){this.cache={},this.isable=!0},addTo:function(a){if(!a)return;this._map=a,this.initEventsMap()},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,e,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 f in y){if(a=y[f],c.processing&&c.processing(a),i=p(a,f),u=q(a),v=r(a),e=l[i],k=!0,k=s(a,o),h=!0,g){h=!1;for(var f in g){var x=g[f];if(x.filter(a)){h=!0;break}}}if(e?e.data=a:e=l[i]={data:a},e.versionID=t,n&&k&&h&&this.isInView(u,v)&&m){var b=e.visual;b?b.updateData(a):m&&(b=e.visual=new d(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])},getChildOptions:function(){var a=this.options;return{id:a.child.id||a.id,text:a.child.text||a.text,lat:a.child.lat||a.lat,lng:a.child.lng||a.lng,range:a.child.range||a.range,value:a.child.value||a.value,css:a.child.css||a.css,popup:a.child.popup||a.popup}},updateOptions:function(a){a=this.options=f.deepMerge(this.options,a);var b=this.getChildOptions();this.each(function(a){a.visual&&a.visual.updateOptions(b)}),this.draw()},draw:function(){var f=this.options,g=this.cache,e,a,l,h,b,j=f.lng,k=f.lat,c,m,n=f.filter,o=this._map.getZoom(),p,q=this.isInZoom(),t=f.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)e=g[i],b=e.data,l=k(b),h=j(b),p=this.isInView(l,h),c=!0,c=n(b,o),m=!0,c=c&&m,a=e.visual,p&&c?a?(a.updateData(b),a.updateZIndex()):(a=e.visual=new d(s),a.addTo(r),a.render(b),this.initEventsScatter(a)):a&&(a.off&&a.off(),a.destroy&&a.destroy(),delete e.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)}},initEventsMap:function(){this._map.on('moveend',this.updateMap.bind(this))},initEventsScatter:function(b){var a=this;b.on('click',function(b){a.emit('click-scatter',b)})},destroy:function(){this.clean(),this.cache={}}}),e.ScatterMarkers=a,e.scatterMarkers=function(b){return new a(b)},module.exports=a
function a(b){b=this.options=c.deepMerge(a.options,b),this.initialize(b)}var b=require('leaflet'),c=require('./../core/utils'),d=require('bcore/event'),e=require('./scatter_marker'),f=b.dmap=b.dmap||{};a.options={lat:c.getLat,lng:c.getLng,filter:function(a,b){return!0},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=d.extend(a,{initialize:function(a){this.cache={},this.isable=!0},addTo:function(a){if(!a)return;this._map=a,this.initEventsMap()},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 f in y){if(a=y[f],c.processing&&c.processing(a),i=p(a,f),u=q(a),v=r(a),d=l[i],k=!0,k=s(a,o),h=!0,g){h=!1;for(var f in g){var x=g[f];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 e(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])},getChildOptions:function(){var a=this.options;return{id:a.child.id||a.id,text:a.child.text||a.text,lat:a.child.lat||a.lat,lng:a.child.lng||a.lng,range:a.child.range||a.range,value:a.child.value||a.value,css:a.child.css||a.css,popup:a.child.popup||a.popup}},updateOptions:function(a){a=this.options=c.deepMerge(this.options,a);var b=this.getChildOptions();this.each(function(a){a.visual&&a.visual.updateOptions(b)}),this.draw()},draw:function(){var f=this.options,g=this.cache,d,a,l,h,b,j=f.lng,k=f.lat,c,m,n=f.filter,o=this._map.getZoom(),p,q=this.isInZoom(),t=f.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 e(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)}},initEventsMap:function(){this._map.on('moveend',this.updateMap.bind(this))},initEventsScatter:function(b){var a=this;b.on('click',function(b){console.log(b),a.emit('click-scatter',b)})},initEvents:function(){},destroy:function(){this.clean(),this.cache={}}}),f.ScatterMarkers=a,f.scatterMarkers=function(b){return new a(b)},module.exports=a

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

function a(g,d,i){var a=e.deepMerge(g.options,i),c=g.variants,b;if(!c)return a;if(d&&d.length===2){var f=d[1];return b=c[f],a[f]=b.value,a}if(a.variant&&c){var h=a.variant;if(b=c[h],!b)return a;a.variant=typeof b==='string'?b:b.value,b.options&&(a=e.deepMerge(a,b.options))}return a}function b(a){var c=a.attribution;return c?c.indexOf('{attribution.')===-1?a:(a.attribution=c.replace(/\{attribution.(\w*)\}/,function(c,a){return b(d[a].options)}),a):a}var c=require('leaflet'),d=require('./tilelayer_data');delete d.__filename;var e=require('./../core/utils'),f=e.switchValue,g=c.TileLayer.extend({initialize:function(a,b){this.update(a,b,!0)},update:function(f,e,j){if(typeof f==='object'&&(e=f,f=e.url),f.indexOf('{')===-1&&(this.tileName=f),this._options=e,this.tData=d,typeof f!=='string')return console.log('输入必须为字符形式');if(f.indexOf('{')!==-1)return c.TileLayer.prototype.initialize.call(this,f,e),j?void 0:c.TileLayer.prototype.setUrl.call(this,f,e);var g=f.split('.'),k=g[0],h=d[k]||d.AtlasLight,i=h.url;if(e=a(h,g,e),e=b(e),c.TileLayer.prototype.initialize.call(this,i,e),j)return;this.setUrl(i,e),this.redraw()},help:function(){console.log('L.dmap.tileLayer(name, options)\n---name可以是:\n\n\n');for(var a in d){var b=d[a].options,c=b.name;console.log(a+' | '+c)}},setVariables:function(){}}),h=c.dmap=c.dmap||{};h.TileLayer=g,h.tileLayer=function(a,b){return new h.TileLayer(a,b)},module.exports=g
function a(g,d,i){var a=e.deepMerge(g.options,i),c=g.variants,b;if(!c)return a;if(d&&d.length===2){var f=d[1];return b=c[f],a[f]=b.value,a}if(a.variant&&c){var h=a.variant;if(b=c[h],!b)return a;a.variant=typeof b==='string'?b:b.value,b.options&&(a=e.deepMerge(a,b.options))}return a}function b(a){var c=a.attribution;return c?c.indexOf('{attribution.')===-1?a:(a.attribution=c.replace(/\{attribution.(\w*)\}/,function(c,a){return b(d[a].options)}),a):a}var c=require('./../leaflet'),d=require('./tilelayer_data');delete d.__filename;var e=require('./../core/utils'),f=e.switchValue,g=c.TileLayer.extend({initialize:function(a,b){this.update(a,b,!0)},update:function(f,e,j){if(typeof f==='object'&&(e=f,f=e.url),f.indexOf('{')===-1&&(this.tileName=f),this._options=e,this.tData=d,typeof f!=='string')return console.log('输入必须为字符形式');if(f.indexOf('{')!==-1)return c.TileLayer.prototype.initialize.call(this,f,e),j?void 0:c.TileLayer.prototype.setUrl.call(this,f,e);var g=f.split('.'),k=g[0],h=d[k]||d.AtlasLight,i=h.url;if(e=a(h,g,e),e=b(e),c.TileLayer.prototype.initialize.call(this,i,e),j)return;this.setUrl(i,e),this.redraw()},help:function(){console.log('L.dmap.tileLayer(name, options)\n---name可以是:\n\n\n');for(var a in d){var b=d[a].options,c=b.name;console.log(a+' | '+c)}},setVariables:function(){}}),h=c.dmap=c.dmap||{};h.TileLayer=g,h.tileLayer=function(a,b){return new h.TileLayer(a,b)},module.exports=g

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

'use strict';function a(b){b=this.options=c.deepMerge(a.options,b),this.id=Math.floor(Math.random()*1e7)+'_'+new Date().getTime(),this.initialize(b)}var b=require('leaflet'),c=require('./../core/utils'),d=require('./../render/canvas'),e=c.getColorFunc,f=c.switchValue,g=require('bcore/event'),h=require('./../core/utils').getSprite;a.options={container:null,lengthLimit:15,lifeSpeed:.5,delay:30,isAutoUpdate:!0,lineSegmentLonger:1,container:null,blending:'lighter',sprite:{type:'linear',isContinue:!0,width:200,height:20,color:{from:'rgba(0,233,233,0.3)',to:'rgba(0,233,233,0.3)',space:'hsl',easing:'linear.Out.3'}},isable:!0,isableDraw:!0,type:'line',ptsN:9,weight:function(b,a){return 5*Math.pow(a,1)},pts:function(a){return a.pts},color:e('rgba(0,150,150,0.8)','rgba(0,100,255, 1)','rgb','linear.Out.1'),scale:function(a){return 1},size:function(a,b){return 15},value:function(a,b,c){return Math.min(1,a.length/40)},lng:c.getLng,lat:c.getLat,time:c.getTime},a=g.extend(a,{events:{},includes:[b.Mixin.Events],initialize:function(a){},addTo:function(a){if(this._map||!a)return;this._map=a,this.initCanvas(),this._data&&this.draw()},initCanvas:function(){var a=this.options;if(a.ctx)return this.ctx=a.ctx;this.lcanvas=new d(this._map,a.container,{clearAlpha:1});var b=this.ctx=this.lcanvas.ctx;b.globalCompositeOperation=a.blending,this.ctx=b},processing:function(){var a=this.pts,c=this.options,q=c.time,p=c.lat,o=c.lng,m,j,i,n=m=q(a[0],0),k=j=o(a[0],0),l=i=p(a[0],0),g,f,e,d;for(var h=0;h<a.length;h++){if(g=a[h],!g)continue;f=p(g),e=o(g),d=q(g,h),d>m&&(m=d),d<n&&(n=d),f>i&&(i=f),f<l&&(l=f),e>j&&(j=e),e<k&&(k=e)}this.lifeMax=c.lifeMax=m,this.lifeMin=c.lifeMin=n;var s=b.latLng(l,k),r=b.latLng(i,j);this.bounds=b.latLngBounds(s,r)},getBBox:function(){return this.bounds},isInView:function(a){a=a||this._map.getBounds();var b=this.bounds,d=b._northEast.lng,e=b._northEast.lat,c=b._southWest.lng,g=b._southWest.lat,h=a._northEast.lng,i=a._northEast.lat,j=a._southWest.lng,f=a._southWest.lat;return!(j<c&&h<c||j>d&&h>d||f<g&&i<g||f>e&&i>e)},data:function(a){if(!a)return this._data;var b=this.options,c=b.pts.bind(b);this._data=a,this.pts=c(a),this.processing(),this.resetVariables()},append:function(a){if(!this._data)return console.log('初始数据没有');this.pts.append(a)},render:function(a){a&&this.data(a),this.draw()},updateOptions:function(a){a=this.options=c.deepMerge(this.options,a)},resetVariables:function(){this.enable(),this.life=this.options.lifeMin||this.lifeMin},enable:function(){this.options.isable=!0},disable:function(){this.options.isable=!1},enableDraw:function(){this.options.isableDraw=!0},disableDraw:function(){this.options.isableDraw=!1},equalTo:function(a){return this.id===a.id?!0:!1},draw:function(){var a=this.options;if(!(a.isable&&a.isableDraw))return;var F=a.lengthLimit,E=a.lineSegmentLonger,c=this.ctx,n=h(a.sprite),u=this._map.latLngToContainerPoint.bind(this._map),g=this.pts;if(!g)return;var i=g.length,j,r,e,m,v,A,k,l,p,q=n.width,w=n.height,x=1/ i*q*1,y=a.lat.bind(a),z=a.lng.bind(a);for(var d=0;d<i;d++){j=g[d];var B=y(j),C=z(j),s=u(b.latLng(B,C)),t=s.x,o=s.y;if(r=(d-1)/ i,e||m){k=t-e,l=o-m,v=Math.atan2(l,k),A=Math.sqrt(k*k+l*l)+E,p=f(a.weight,j,r),c.save(),c.translate(e,m),c.rotate(v);var D=r*q;c.drawImage(n,D,0,x,w,0,-p/2,A,p),c.restore()}e=t,m=o}},isEnd:function(){return this.life>=this.lifeMax+(this.options.delay||0)},updateMap:function(a){this.draw()}});var i=b.dmap=b.dmap||{};i.TrailCanvasBg=a,i.trailCanvasBg=function(b){return new a(b)},module.exports=a
'use strict';function a(b){b=this.options=c.deepMerge(a.options,b),this.id=Math.floor(Math.random()*1e7)+'_'+new Date().getTime(),this.initialize(b)}var b=require('./../leaflet'),c=require('./../core/utils'),d=require('./../render/canvas'),e=c.getColorFunc,f=c.switchValue,g=require('bcore/event'),h=require('./../core/utils').getSprite;a.options={container:null,lengthLimit:15,lifeSpeed:.5,delay:30,isAutoUpdate:!0,lineSegmentLonger:1,container:null,blending:'lighter',sprite:{type:'linear',isContinue:!0,width:200,height:20,color:{from:'rgba(0,233,233,0.3)',to:'rgba(0,233,233,0.3)',space:'hsl',easing:'linear.Out.3'}},isable:!0,isableDraw:!0,type:'line',ptsN:9,weight:function(b,a){return 5*Math.pow(a,1)},pts:function(a){return a.pts},color:e('rgba(0,150,150,0.8)','rgba(0,100,255, 1)','rgb','linear.Out.1'),scale:function(a){return 1},size:function(a,b){return 15},value:function(a,b,c){return Math.min(1,a.length/40)},lng:c.getLng,lat:c.getLat,time:c.getTime},a=g.extend(a,{events:{},includes:[b.Mixin.Events],initialize:function(a){},addTo:function(a){if(this._map||!a)return;this._map=a,this.initCanvas(),this._data&&this.draw()},initCanvas:function(){var a=this.options;if(a.ctx)return this.ctx=a.ctx;this.lcanvas=new d(this._map,a.container,{clearAlpha:1});var b=this.ctx=this.lcanvas.ctx;b.globalCompositeOperation=a.blending,this.ctx=b},processing:function(){var a=this.pts,c=this.options,q=c.time,p=c.lat,o=c.lng,m,j,i,n=m=q(a[0],0),k=j=o(a[0],0),l=i=p(a[0],0),g,f,e,d;for(var h=0;h<a.length;h++){if(g=a[h],!g)continue;f=p(g),e=o(g),d=q(g,h),d>m&&(m=d),d<n&&(n=d),f>i&&(i=f),f<l&&(l=f),e>j&&(j=e),e<k&&(k=e)}this.lifeMax=c.lifeMax=m,this.lifeMin=c.lifeMin=n;var s=b.latLng(l,k),r=b.latLng(i,j);this.bounds=b.latLngBounds(s,r)},getBBox:function(){return this.bounds},isInView:function(a){a=a||this._map.getBounds();var b=this.bounds,d=b._northEast.lng,e=b._northEast.lat,c=b._southWest.lng,g=b._southWest.lat,h=a._northEast.lng,i=a._northEast.lat,j=a._southWest.lng,f=a._southWest.lat;return!(j<c&&h<c||j>d&&h>d||f<g&&i<g||f>e&&i>e)},data:function(a){if(!a)return this._data;var b=this.options,c=b.pts.bind(b);this._data=a,this.pts=c(a),this.processing(),this.resetVariables()},append:function(a){if(!this._data)return console.log('初始数据没有');this.pts.append(a)},render:function(a){a&&this.data(a),this.draw()},updateOptions:function(a){a=this.options=c.deepMerge(this.options,a)},resetVariables:function(){this.enable(),this.life=this.options.lifeMin||this.lifeMin},enable:function(){this.options.isable=!0},disable:function(){this.options.isable=!1},enableDraw:function(){this.options.isableDraw=!0},disableDraw:function(){this.options.isableDraw=!1},equalTo:function(a){return this.id===a.id?!0:!1},draw:function(){var a=this.options;if(!(a.isable&&a.isableDraw))return;var F=a.lengthLimit,E=a.lineSegmentLonger,c=this.ctx,n=h(a.sprite),u=this._map.latLngToContainerPoint.bind(this._map),g=this.pts;if(!g)return;var i=g.length,j,r,e,m,v,A,k,l,p,q=n.width,w=n.height,x=1/ i*q*1,y=a.lat.bind(a),z=a.lng.bind(a);for(var d=0;d<i;d++){j=g[d];var B=y(j),C=z(j),s=u(b.latLng(B,C)),t=s.x,o=s.y;if(r=(d-1)/ i,e||m){k=t-e,l=o-m,v=Math.atan2(l,k),A=Math.sqrt(k*k+l*l)+E,p=f(a.weight,j,r),c.save(),c.translate(e,m),c.rotate(v);var D=r*q;c.drawImage(n,D,0,x,w,0,-p/2,A,p),c.restore()}e=t,m=o}},isEnd:function(){return this.life>=this.lifeMax+(this.options.delay||0)},updateMap:function(a){this.draw()}});var i=b.dmap=b.dmap||{};i.TrailCanvasBg=a,i.trailCanvasBg=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.id=Math.floor(Math.random()*1e7)+'_'+new Date().getTime(),this.initialize(b)}var b=require('leaflet'),c=require('./../core/utils'),d=require('./../render/canvas'),e=c.getColorFunc,f=c.switchValue,g=require('./../core/animator'),h=require('./../core/utils').getSprite;a.options={lengthLimit:15,lifeSpeed:.5,delay:30,isAutoUpdate:!0,lineSegmentLonger:1,spriteW:200,spriteH:20,container:null,isable:!0,isableDraw:!0,type:'line',ptsN:9,weight:function(b,a){return 5*Math.pow(a,3)},pts:function(a){return a.pts},spriteHead:!0,color:e('rgba(0,150,150,0.8)','rgba(0,100,255, 1)','rgb','linear.Out.1'),scale:function(a){return 1},size:function(a,b){return 15},value:function(a,b,c){return Math.min(1,a.length/40)},lng:c.getLng,lat:c.getLat,time:c.getTime},a.options=c.deepMerge(g.options,a.options),a=g.extend(a,{events:{},includes:[b.Mixin.Events],initialize:function(a){this.ctx=a.ctx,a.spriteHead&&(this.spriteHead=a.spriteHead||this.initSpriteFlyingHead()),a.isAutoUpdate&&this.initEventsAnim()},addTo:function(a){if(this._map||!a)return;this._map=a,this._data&&this.updateZoom()},processing:function(){var a=this.pts,c=this.options,q=c.time,p=c.lat,o=c.lng,m,j,i,n=m=q(a[0],0),k=j=o(a[0],0),l=i=p(a[0],0),g,f,e,d;for(var h=0;h<a.length;h++){if(g=a[h],!g)continue;f=p(g),e=o(g),d=q(g,h),d>m&&(m=d),d<n&&(n=d),f>i&&(i=f),f<l&&(l=f),e>j&&(j=e),e<k&&(k=e)}this.lifeMax=c.lifeMax=m,this.lifeMin=c.lifeMin=n;var s=b.latLng(l,k),r=b.latLng(i,j);this.bounds=b.latLngBounds(s,r)},getBBox:function(){return this.bounds},isInView:function(a){a=a||this._map.getBounds();var b=this.bounds,d=b._northEast.lng,e=b._northEast.lat,c=b._southWest.lng,g=b._southWest.lat,h=a._northEast.lng,i=a._northEast.lat,j=a._southWest.lng,f=a._southWest.lat;return!(j<c&&h<c||j>d&&h>d||f<g&&i<g||f>e&&i>e)},data:function(a){if(!a)return this._data;var b=this.options,c=b.pts.bind(b);this._data=a,this.pts=c(a),this.processing(),this.resetVariables(),this.options.isAutoUpdate&&this._map&&this.startAnim()},append:function(a){if(!this._data)return console.log('初始数据没有');this.pts.append(a)},render:function(a){a&&this.data(a),this.startAnim()},updateFlying:function(){var d=this.options;if(!this.options.isable)return;var e=this.life,c=this.pts,f=d.time,g=this.indexLast||0,h,b;for(var a=g;a<c.length;a++){if(b=c[a],!b)continue;if(h=f(b,a),h>e){this.indexLast=a;break}this._addFlyingPt(b)}this._drawFlying()},updateOptions:function(a){a=this.options=c.deepMerge(this.options,a)},resetVariables:function(){this.indexLast=0,this.flyingPts=[],this.enable('flying'),this.life=this.options.lifeMin||this.lifeMin},enable:function(){this.options.isable=!0},disable:function(){this.options.isable=!1},enableDraw:function(){this.options.isableDraw=!0},disableDraw:function(){this.options.isableDraw=!1},_addFlyingPt:function(b){this.curPoint=b;var a=this.options,c=a.ptsN,d=a.lat,e=a.lng;this.flyingPts.push({lat:d(b),lng:e(b)}),this.flyingPts.length>c&&this.flyingPts.splice(0,1)},equalTo:function(a){return this.id===a.id?!0:!1},_drawFlying:function(){var o=this._map,G=o.getZoom(),d=this.options,F=d.lengthLimit,z=d.lineSegmentLonger;if(!(d.isable&&this.options.isableDraw))return;var D=d.spriteFlying,C=d.spriteHead,p=h(D),w=h(C),x=p.width,E=p.height,j=this.flyingPts,v=o.latLngToContainerPoint.bind(o),a=this.ctx,e,t,m=j.length,q,r,A,y,s,n,B=1/m*x*1;for(var l=m-1;l>=0;l--){e=j[l];var c=v(b.latLng(e.lat,e.lng)),i=c.x,g=c.y;if((q||r)&&(t=(l-1)/m,s=i-q,n=g-r,A=Math.atan2(n,s),y=Math.sqrt(s*s+n*n)+z,y<F)){var u=f(d.weight,e,t);a.save(),a.translate(q,r),a.rotate(A);var H=t*x;a.drawImage(p,H,0,B,E,0,-u/2,y,u),a.restore()}q=i,r=g}if(w&&m){e=j[j.length-1];var c=v(b.latLng(e.lat,e.lng)),i=c.x,g=c.y;a.save();var I=a.globalCompositeOperation;a.globalCompositeOperation='destination-over',a.beginPath();var k=f(d.size,c,G);a.drawImage(w,i-k,g-k,k*2,k*2),a.closePath(),a.globalCompositeOperation=I,a.restore()}},updateAnim:function(a){if(!this.isInView())return;if(this.life=a=a||this.life||0,this.isEnd())return this.emit('lifeEnd');this.updateFlying()},isEnd:function(){return this.life>=this.lifeMax+(this.options.delay||0)},updateMap:function(a){},initEventsAnim:function(){this.off('lifeEnd').on('lifeEnd',function(){this.pause()}).off('update').on('update',this.updateAnim.bind(this))},genOptions:function(){return a.prototype.options=c.deepMerge(g.prototype.genOptions(),a.prototype.options)}}),a.prototype.genOptions();var i=b.dmap=b.dmap||{};i.TrailCanvas=a,i.trailCanvas=function(b){return new a(b)},module.exports=a
'use strict';function a(b){b=this.options=c.deepMerge(a.options,b),this.id=Math.floor(Math.random()*1e7)+'_'+new Date().getTime(),this.initialize(b)}var b=require('./../leaflet'),c=require('./../core/utils'),d=require('./../render/canvas'),e=c.getColorFunc,f=c.switchValue,g=require('./../core/animator'),h=require('./../core/utils').getSprite;a.options={lengthLimit:15,lifeSpeed:.5,delay:30,isAutoUpdate:!0,lineSegmentLonger:1,spriteW:200,spriteH:20,container:null,isable:!0,isableDraw:!0,type:'line',ptsN:9,weight:function(b,a){return 5*Math.pow(a,3)},pts:function(a){return a.pts},spriteHead:!0,color:e('rgba(0,150,150,0.8)','rgba(0,100,255, 1)','rgb','linear.Out.1'),scale:function(a){return 1},size:function(a,b){return 15},value:function(a,b,c){return Math.min(1,a.length/40)},lng:c.getLng,lat:c.getLat,time:c.getTime},a.options=c.deepMerge(g.options,a.options),a=g.extend(a,{events:{},includes:[b.Mixin.Events],initialize:function(a){this.ctx=a.ctx,a.spriteHead&&(this.spriteHead=a.spriteHead||this.initSpriteFlyingHead()),a.isAutoUpdate&&this.initEventsAnim()},addTo:function(a){if(this._map||!a)return;this._map=a,this._data&&this.updateZoom()},processing:function(){var a=this.pts,c=this.options,q=c.time,p=c.lat,o=c.lng,m,j,i,n=m=q(a[0],0),k=j=o(a[0],0),l=i=p(a[0],0),g,f,e,d;for(var h=0;h<a.length;h++){if(g=a[h],!g)continue;f=p(g),e=o(g),d=q(g,h),d>m&&(m=d),d<n&&(n=d),f>i&&(i=f),f<l&&(l=f),e>j&&(j=e),e<k&&(k=e)}this.lifeMax=c.lifeMax=m,this.lifeMin=c.lifeMin=n;var s=b.latLng(l,k),r=b.latLng(i,j);this.bounds=b.latLngBounds(s,r)},getBBox:function(){return this.bounds},isInView:function(a){a=a||this._map.getBounds();var b=this.bounds,d=b._northEast.lng,e=b._northEast.lat,c=b._southWest.lng,g=b._southWest.lat,h=a._northEast.lng,i=a._northEast.lat,j=a._southWest.lng,f=a._southWest.lat;return!(j<c&&h<c||j>d&&h>d||f<g&&i<g||f>e&&i>e)},data:function(a){if(!a)return this._data;var b=this.options,c=b.pts.bind(b);this._data=a,this.pts=c(a),this.processing(),this.resetVariables(),this.options.isAutoUpdate&&this._map&&this.startAnim()},append:function(a){if(!this._data)return console.log('初始数据没有');this.pts.append(a)},render:function(a){a&&this.data(a),this.startAnim()},updateFlying:function(){var d=this.options;if(!this.options.isable)return;var e=this.life,c=this.pts,f=d.time,g=this.indexLast||0,h,b;for(var a=g;a<c.length;a++){if(b=c[a],!b)continue;if(h=f(b,a),h>e){this.indexLast=a;break}this._addFlyingPt(b)}this._drawFlying()},updateOptions:function(a){a=this.options=c.deepMerge(this.options,a)},resetVariables:function(){this.indexLast=0,this.flyingPts=[],this.enable('flying'),this.life=this.options.lifeMin||this.lifeMin},enable:function(){this.options.isable=!0},disable:function(){this.options.isable=!1},enableDraw:function(){this.options.isableDraw=!0},disableDraw:function(){this.options.isableDraw=!1},_addFlyingPt:function(b){this.curPoint=b;var a=this.options,c=a.ptsN,d=a.lat,e=a.lng;this.flyingPts.push({lat:d(b),lng:e(b)}),this.flyingPts.length>c&&this.flyingPts.splice(0,1)},equalTo:function(a){return this.id===a.id?!0:!1},_drawFlying:function(){var o=this._map,G=o.getZoom(),d=this.options,F=d.lengthLimit,z=d.lineSegmentLonger;if(!(d.isable&&this.options.isableDraw))return;var D=d.spriteFlying,C=d.spriteHead,p=h(D),w=h(C),x=p.width,E=p.height,j=this.flyingPts,v=o.latLngToContainerPoint.bind(o),a=this.ctx,e,t,m=j.length,q,r,A,y,s,n,B=1/m*x*1;for(var l=m-1;l>=0;l--){e=j[l];var c=v(b.latLng(e.lat,e.lng)),i=c.x,g=c.y;if((q||r)&&(t=(l-1)/m,s=i-q,n=g-r,A=Math.atan2(n,s),y=Math.sqrt(s*s+n*n)+z,y<F)){var u=f(d.weight,e,t);a.save(),a.translate(q,r),a.rotate(A);var H=t*x;a.drawImage(p,H,0,B,E,0,-u/2,y,u),a.restore()}q=i,r=g}if(w&&m){e=j[j.length-1];var c=v(b.latLng(e.lat,e.lng)),i=c.x,g=c.y;a.save();var I=a.globalCompositeOperation;a.globalCompositeOperation='destination-over',a.beginPath();var k=f(d.size,c,G);a.drawImage(w,i-k,g-k,k*2,k*2),a.closePath(),a.globalCompositeOperation=I,a.restore()}},updateAnim:function(a){if(!this.isInView())return;if(this.life=a=a||this.life||0,this.isEnd())return this.emit('lifeEnd');this.updateFlying()},isEnd:function(){return this.life>=this.lifeMax+(this.options.delay||0)},updateMap:function(a){},initEventsAnim:function(){this.off('lifeEnd').on('lifeEnd',function(){this.pause()}).off('update').on('update',this.updateAnim.bind(this))},genOptions:function(){return a.prototype.options=c.deepMerge(g.prototype.genOptions(),a.prototype.options)}}),a.prototype.genOptions();var i=b.dmap=b.dmap||{};i.TrailCanvas=a,i.trailCanvas=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.id=Math.floor(Math.random()*1e7)+'_'+new Date().getTime(),this.initialize(b)}var b=require('leaflet'),c=require('./../core/utils'),d=require('./../render/canvas'),e=c.getColorFunc,f=require('./../core/animator');a.options={lengthLimit:15,lifeSpeed:.5,delay:30,isAutoUpdate:!0,lineSegmentLonger:1,spriteW:200,spriteH:20,flying:{isable:!0,type:'line',ptsN:9,weight:function(a){return 5*Math.pow(a,3)},spriteHead:null},bgLine:{isable:!1,opacity:1,color:'rgba(105,105,105,1)',weight:5},color:e('rgba(0,150,150,0.8)','rgba(0,100,255, 1)','rgb','linear.Out.1'),scale:function(a){return 1},value:function(a,b,c){return Math.min(1,a.length/40)},lng:c.getLng,lat:c.getLat,time:c.getTime},a.options=c.deepMerge(f.options,a.options),a=f.extend(a,{events:{},includes:[b.Mixin.Events],initialize:function(a){var b=a.flying;b&&(this.spriteFlying=b.sprite||this.initSpriteFlying(),this.ctxFlying=b.ctx,a.flying.isSpriteHead&&(this.spriteFlyingHead=a.flying.spriteHead||this.initSpriteFlyingHead()));var c=a.bgLine;c&&(this.ctxBgLine=c.ctx,this.spriteBgLine=c.sprite||this.initSpriteBgLine()),a.isAutoUpdate&&this.initEventsAnim(),this.isable=!0},addTo:function(a){if(this._map||!a)return;this._map=a,this._data&&this.updateZoom()},processing:function(){var a=this._data,c=this.options,q=c.time,p=c.lat,o=c.lng,m,j,i,n=m=q(a[0],0),k=j=o(a[0],0),l=i=p(a[0],0),g,f,e,d;for(var h=0;h<a.length;h++){if(g=a[h],!g)continue;f=p(g),e=o(g),d=q(g,h),d>m&&(m=d),d<n&&(n=d),f>i&&(i=f),f<l&&(l=f),e>j&&(j=e),e<k&&(k=e)}this.lifeMax=c.lifeMax=m,this.lifeMin=c.lifeMin=n;var s=b.latLng(l,k),r=b.latLng(i,j);this.bounds=b.latLngBounds(s,r)},getBBox:function(){return this.bounds},isInView:function(a){a=a||this._map.getBounds();var b=this.bounds,d=b._northEast.lng,e=b._northEast.lat,c=b._southWest.lng,g=b._southWest.lat,h=a._northEast.lng,i=a._northEast.lat,j=a._southWest.lng,f=a._southWest.lat;return!(j<c&&h<c||j>d&&h>d||f<g&&i<g||f>e&&i>e)},data:function(a){if(!a)return this._data;this._data=a,this.processing(),this.resetVariables(),this.options.isAutoUpdate&&this._map&&this.startAnim()},render:function(a){a&&this.data(a),this.startAnim()},updateFlying:function(){var c=this.options,e=c.flying;if(!(e&&this.isable))return;var f=this.life,d=this._data,g=c.time,h=this.indexLast||0,i,b;for(var a=h;a<d.length;a++){if(b=d[a],!b)continue;if(i=g(b,a),i>f){this.indexLast=a;break}this._addFlyingPt(b)}this._drawFlying()},updateOptions:function(a){a=this.options=c.deepMerge(this.options,a)},resetVariables:function(){this.indexLast=0,this.flyingPts=[],this.enable('flying'),this.life=this.options.lifeMin||this.lifeMin},enable:function(a){(!a||a==='')&&(this.enable('flying'),this.enable('bgLine')),a==='bgLine'&&this.options.bgLine&&(this.options.bgLine.isable=!0),a==='flying'&&this.options.flying&&(this.options.flying.isable=!0)},disable:function(a){(!a||a==='')&&(this.disable('flying'),this.disable('bgLine')),a==='bgLine'&&this.options.bgLine&&(this.options.bgLine.isable=!1),a==='flying'&&this.options.flying&&(this.options.flying.isable=!1)},_addFlyingPt:function(b){var a=this.options,c=a.flying.ptsN,d=a.lat,e=a.lng;this.flyingPts.push({lat:d(b),lng:e(b)}),this.flyingPts.length>c&&this.flyingPts.splice(0,1)},equalTo:function(a){return this.id===a.id?!0:!1},_drawFlying:function(){var m=this.options,D=m.lengthLimit,z=m.lineSegmentLonger,l=m.flying;if(!(l&&l.isable&&this.isable))return;var i=this.spriteFlying,k=this.spriteFlyingHead,v=i.width,C=i.height,u=this.flyingPts,w=this._map.latLngToContainerPoint.bind(this._map),a=this.ctxFlying,s,r,e=u.length,p,h,A,q,o,n,j=l.weight,x=typeof j==='function'?j:function(){return j},y=1/e*v*1;for(var d=e-1;d>=0;d--){s=u[d];var t=w(b.latLng(s.lat,s.lng)),g=t.x,f=t.y;if((p||h)&&(r=(d-1)/e,o=g-p,n=f-h,A=Math.atan2(n,o),q=Math.sqrt(o*o+n*n)+z,q<D)){var c=x(r);a.save(),a.translate(p,h),a.rotate(A);var E=r*v;if(a.drawImage(i,E,0,y,C,0,-c/2,q,c),a.restore(),k&&d>=e-1){var F=k.width;a.save();var B=a.globalCompositeOperation;a.globalCompositeOperation='destination-over',a.beginPath(),console.log('11'),a.drawImage(k,g-c/2,f-c/2,c,c),a.closePath(),a.globalCompositeOperation=B,a.restore()}}p=g,h=f}},initSpriteFlying:function(){var i=this.options.color,a=document.createElement('canvas'),d=this.spriteW=a.width=1e3,e=this.spriteH=a.height=20,b=a.getContext('2d'),f,g=b.createLinearGradient(0,0,d,e),h=300;for(var c=0;c<h;c++)f=c/h,g.addColorStop(f,i(f));return b.fillStyle=g,b.fillRect(0,0,d,e),this.spriteFlying=a,a},initSpriteFlyingHead:function(){var d=this.options.color,a=document.createElement('canvas'),b=a.width=a.height=50,c=a.getContext('2d');return c.fillStyle=d(1),c.arc(b/2,b/2,b,0,Math.PI*2),c.fill(),this.spriteFlyingHead=a,a},initSpriteBgLine:function(){var a=document.createElement('canvas'),c=this.spriteW=a.width=1e3,d=this.spriteH=a.height=20,b=a.getContext('2d');return b.fillStyle=this.options.bgLine.color,b.fillRect(0,0,c,d),this.spriteBgLine=a,a},updateBgLine:function(){this._drawBgLine()},_drawBgLine:function(){var c=this.options,h=c.bgLine;if(!h)return;if(!(this.isable&&h.isable))return;var u=c.lengthLimit,A=c.lineSegmentLonger,a=this.ctxBgLine,n=c.spriteW,v=c.spriteH,x=this.spriteBgLine,y=this._map.latLngToContainerPoint.bind(this._map),p=this._data,f=p.length,m,s,g,e,z,l,i,j,o=h.weight,w=1/f*n*1;for(var d=0;d<f;d++){m=p[d];var q=y(b.latLng(m.lat,m.lng)),r=q.x,k=q.y;if(s=(d-1)/f,(g||e)&&(i=r-g,j=k-e,z=Math.atan2(j,i),l=Math.sqrt(i*i+j*j)+A,u>l)){a.save(),a.translate(g,e),a.rotate(z);var t=s*n;a.drawImage(x,t,0,w,v,0,-o/2,l,o),a.restore()}g=r,e=k}},updateAnim:function(a){if(!this.isInView())return;if(this.life=a=a||this.life||0,this.isEnd())return this.emit('lifeEnd');this.updateFlying()},isEnd:function(){return this.life>=this.lifeMax+(this.options.delay||0)},updateMap:function(a){this.isInView(a)&&this._drawBgLine()},initEventsAnim:function(){this.off('lifeEnd').on('lifeEnd',function(){this.pause()}).off('update').on('update',this.updateAnim.bind(this))},genOptions:function(){return a.prototype.options=c.deepMerge(f.prototype.genOptions(),a.prototype.options)}}),a.prototype.genOptions();var g=b.dmap=b.dmap||{};g.TrailCanvas=a,g.trailCanvas=function(b){return new a(b)},module.exports=a
'use strict';function a(b){b=this.options=c.deepMerge(a.options,b),this.id=Math.floor(Math.random()*1e7)+'_'+new Date().getTime(),this.initialize(b)}var b=require('./../leaflet'),c=require('./../core/utils'),d=require('./../render/canvas'),e=c.getColorFunc,f=require('./../core/animator');a.options={lengthLimit:15,lifeSpeed:.5,delay:30,isAutoUpdate:!0,lineSegmentLonger:1,spriteW:200,spriteH:20,flying:{isable:!0,type:'line',ptsN:9,weight:function(a){return 5*Math.pow(a,3)},spriteHead:null},bgLine:{isable:!1,opacity:1,color:'rgba(105,105,105,1)',weight:5},color:e('rgba(0,150,150,0.8)','rgba(0,100,255, 1)','rgb','linear.Out.1'),scale:function(a){return 1},value:function(a,b,c){return Math.min(1,a.length/40)},lng:c.getLng,lat:c.getLat,time:c.getTime},a.options=c.deepMerge(f.options,a.options),a=f.extend(a,{events:{},includes:[b.Mixin.Events],initialize:function(a){var b=a.flying;b&&(this.spriteFlying=b.sprite||this.initSpriteFlying(),this.ctxFlying=b.ctx,a.flying.isSpriteHead&&(this.spriteFlyingHead=a.flying.spriteHead||this.initSpriteFlyingHead()));var c=a.bgLine;c&&(this.ctxBgLine=c.ctx,this.spriteBgLine=c.sprite||this.initSpriteBgLine()),a.isAutoUpdate&&this.initEventsAnim(),this.isable=!0},addTo:function(a){if(this._map||!a)return;this._map=a,this._data&&this.updateZoom()},processing:function(){var a=this._data,c=this.options,q=c.time,p=c.lat,o=c.lng,m,j,i,n=m=q(a[0],0),k=j=o(a[0],0),l=i=p(a[0],0),g,f,e,d;for(var h=0;h<a.length;h++){if(g=a[h],!g)continue;f=p(g),e=o(g),d=q(g,h),d>m&&(m=d),d<n&&(n=d),f>i&&(i=f),f<l&&(l=f),e>j&&(j=e),e<k&&(k=e)}this.lifeMax=c.lifeMax=m,this.lifeMin=c.lifeMin=n;var s=b.latLng(l,k),r=b.latLng(i,j);this.bounds=b.latLngBounds(s,r)},getBBox:function(){return this.bounds},isInView:function(a){a=a||this._map.getBounds();var b=this.bounds,d=b._northEast.lng,e=b._northEast.lat,c=b._southWest.lng,g=b._southWest.lat,h=a._northEast.lng,i=a._northEast.lat,j=a._southWest.lng,f=a._southWest.lat;return!(j<c&&h<c||j>d&&h>d||f<g&&i<g||f>e&&i>e)},data:function(a){if(!a)return this._data;this._data=a,this.processing(),this.resetVariables(),this.options.isAutoUpdate&&this._map&&this.startAnim()},render:function(a){a&&this.data(a),this.startAnim()},updateFlying:function(){var c=this.options,e=c.flying;if(!(e&&this.isable))return;var f=this.life,d=this._data,g=c.time,h=this.indexLast||0,i,b;for(var a=h;a<d.length;a++){if(b=d[a],!b)continue;if(i=g(b,a),i>f){this.indexLast=a;break}this._addFlyingPt(b)}this._drawFlying()},updateOptions:function(a){a=this.options=c.deepMerge(this.options,a)},resetVariables:function(){this.indexLast=0,this.flyingPts=[],this.enable('flying'),this.life=this.options.lifeMin||this.lifeMin},enable:function(a){(!a||a==='')&&(this.enable('flying'),this.enable('bgLine')),a==='bgLine'&&this.options.bgLine&&(this.options.bgLine.isable=!0),a==='flying'&&this.options.flying&&(this.options.flying.isable=!0)},disable:function(a){(!a||a==='')&&(this.disable('flying'),this.disable('bgLine')),a==='bgLine'&&this.options.bgLine&&(this.options.bgLine.isable=!1),a==='flying'&&this.options.flying&&(this.options.flying.isable=!1)},_addFlyingPt:function(b){var a=this.options,c=a.flying.ptsN,d=a.lat,e=a.lng;this.flyingPts.push({lat:d(b),lng:e(b)}),this.flyingPts.length>c&&this.flyingPts.splice(0,1)},equalTo:function(a){return this.id===a.id?!0:!1},_drawFlying:function(){var m=this.options,D=m.lengthLimit,z=m.lineSegmentLonger,l=m.flying;if(!(l&&l.isable&&this.isable))return;var i=this.spriteFlying,k=this.spriteFlyingHead,v=i.width,C=i.height,u=this.flyingPts,w=this._map.latLngToContainerPoint.bind(this._map),a=this.ctxFlying,s,r,e=u.length,p,h,A,q,o,n,j=l.weight,x=typeof j==='function'?j:function(){return j},y=1/e*v*1;for(var d=e-1;d>=0;d--){s=u[d];var t=w(b.latLng(s.lat,s.lng)),g=t.x,f=t.y;if((p||h)&&(r=(d-1)/e,o=g-p,n=f-h,A=Math.atan2(n,o),q=Math.sqrt(o*o+n*n)+z,q<D)){var c=x(r);a.save(),a.translate(p,h),a.rotate(A);var E=r*v;if(a.drawImage(i,E,0,y,C,0,-c/2,q,c),a.restore(),k&&d>=e-1){var F=k.width;a.save();var B=a.globalCompositeOperation;a.globalCompositeOperation='destination-over',a.beginPath(),console.log('11'),a.drawImage(k,g-c/2,f-c/2,c,c),a.closePath(),a.globalCompositeOperation=B,a.restore()}}p=g,h=f}},initSpriteFlying:function(){var i=this.options.color,a=document.createElement('canvas'),d=this.spriteW=a.width=1e3,e=this.spriteH=a.height=20,b=a.getContext('2d'),f,g=b.createLinearGradient(0,0,d,e),h=300;for(var c=0;c<h;c++)f=c/h,g.addColorStop(f,i(f));return b.fillStyle=g,b.fillRect(0,0,d,e),this.spriteFlying=a,a},initSpriteFlyingHead:function(){var d=this.options.color,a=document.createElement('canvas'),b=a.width=a.height=50,c=a.getContext('2d');return c.fillStyle=d(1),c.arc(b/2,b/2,b,0,Math.PI*2),c.fill(),this.spriteFlyingHead=a,a},initSpriteBgLine:function(){var a=document.createElement('canvas'),c=this.spriteW=a.width=1e3,d=this.spriteH=a.height=20,b=a.getContext('2d');return b.fillStyle=this.options.bgLine.color,b.fillRect(0,0,c,d),this.spriteBgLine=a,a},updateBgLine:function(){this._drawBgLine()},_drawBgLine:function(){var c=this.options,h=c.bgLine;if(!h)return;if(!(this.isable&&h.isable))return;var u=c.lengthLimit,A=c.lineSegmentLonger,a=this.ctxBgLine,n=c.spriteW,v=c.spriteH,x=this.spriteBgLine,y=this._map.latLngToContainerPoint.bind(this._map),p=this._data,f=p.length,m,s,g,e,z,l,i,j,o=h.weight,w=1/f*n*1;for(var d=0;d<f;d++){m=p[d];var q=y(b.latLng(m.lat,m.lng)),r=q.x,k=q.y;if(s=(d-1)/f,(g||e)&&(i=r-g,j=k-e,z=Math.atan2(j,i),l=Math.sqrt(i*i+j*j)+A,u>l)){a.save(),a.translate(g,e),a.rotate(z);var t=s*n;a.drawImage(x,t,0,w,v,0,-o/2,l,o),a.restore()}g=r,e=k}},updateAnim:function(a){if(!this.isInView())return;if(this.life=a=a||this.life||0,this.isEnd())return this.emit('lifeEnd');this.updateFlying()},isEnd:function(){return this.life>=this.lifeMax+(this.options.delay||0)},updateMap:function(a){this.isInView(a)&&this._drawBgLine()},initEventsAnim:function(){this.off('lifeEnd').on('lifeEnd',function(){this.pause()}).off('update').on('update',this.updateAnim.bind(this))},genOptions:function(){return a.prototype.options=c.deepMerge(f.prototype.genOptions(),a.prototype.options)}}),a.prototype.genOptions();var g=b.dmap=b.dmap||{};g.TrailCanvas=a,g.trailCanvas=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=require('./../core/animator'),f=require('./trail_canvas_flying');a.options={lineN:1e3,lifeSpeed:1,isAutoUpdate:!0,type:'flying',isable:!0,container:'#canvas',id:function(a){return a.id},id:c.getID,lifeMin:0,lifeMax:1e11,child:{spriteFlying:{type:'linear',isContinue:!0,width:200,height:20,color:{from:'rgba(233,0,0,0.3)',to:'#f2f7b8',space:'hsl',easing:'linear.Out.3'}},spriteHead:{type:'radian',isContinue:!1,width:100,height:100,color:{to:'rgba(255,150,0,0.4)',from:'rgba(255,150,0,0.4)',space:'hsl',easing:'linear.Out.1'}},size:function(a,b){return 6},delay:2,lengthLimit:60,lineSegmentLonger:0,isAutoUpdate:!1,isable:!0,blending:'lighter',type:'line',ptsN:25,weight:function(b,a){return 5*Math.pow(a,3)},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.pts}}};var a=e.extend(a,{events:{},initialize:function(a){this.isable=!0,this.lifeMax=a.lifeMax,this.lifeMin=a.lifeMin,this.life=this.lifeMin,a.isAutoUpdate&&this.initEventsAnim()},initCanvas:function(){var a=this.options,b=a.child,e=b.blending||a.blending;this.lcanvas=new d(this._map,a.container,{clearAlpha:1});var c=this.ctx=this.lcanvas.ctx;c.globalCompositeOperation=e,b.ctx=c},addTo:function(a){if(this._map||!a)return;this._map=a,this.initCanvas(),this.initTrails(),this.initEventsMap(),this._data&&this.updateZoom()},clear:function(){var b=this.using,a=this.unusing,d;for(var e in b)d=b[e],d.reset();this.using={},a=[];var c=this.trails;for(var f in c)a.push(c[f]);this.unusing=a},reset:function(){var c=this.unusing=[];this.using={};var a=this.trails;for(var d in a){var b=a[d];b.stop&&b.stop(),b.pause&&b.pause(),b.resetVariables()}this.life=this.options.lifeMin;var a=this.trails;for(var e in a)c.push(a[e]);this.resume()},initCacheColor:function(){},mergeData:function(e){var f=this.options,g=f.id.bind(f),a=e.d,b,c=this._data=this._data||{};for(var d=0;d<e.length;d++)a=e[d],b=g(a),c[b]?c[b].pts.push(a):c[b]={pts:[a],id:b};this.resetOrUpdateTrails(),this.options.isAutoUpdate&&this._map&&!this.loopid&&this.startAnim()},data:function(c){if(!c)return this._data;var b=this.unusing,d=this.using;if(!(b&&b.length))return;var a=b.pop(),e=this.options,f=e.child.pts,g=f(c);a.updateOptions({lifeMin:0,lifeMax:g.length}),a.data(c),d[a.id]=a,this.options.isAutoUpdate&&this._map&&!this.loopid&&this.startAnim()},resetOrUpdateTrails:function(){var c=this._data,d=this.using,h=this.unusing,e=this.options,i=e.child.pts.bind(e.child),f,a,g;for(var b in c)f=c[b],a=d[b],g=i(f),a?a.processing():(a=h.pop(),g&&g.length>3&&(a.data(f),a.id=b,d[b]=a))},datas:function(a){if(!a)return this._data;this._data=a;for(var b in a)this.data(a[b])},initTrails:function(){var a=this.options,b=a.child;b.lifeSpeed=a.lifeSpeed,b.isable=a.isable,b.container=a.container,this.using={};var e=this.unusing=[],g=this._map,h=this.trails=[],i=a.lineN,c;for(var d=0;d<i;d++)c=new f(b),c.addTo(g),this.initEventsTrail(c),h.push(c),e.push(c)},each:function(c){var a=this.using;for(var b in a)c(a[b],b)},checkTrail:function(b){if(!b.isEnd())return;var a=this.using,c=!1;for(var d in a)if(a[d].equalTo(b)){c=!0,delete a[d];break}c&&this.unusing.push(b)},initEventsTrail:function(a){var b=this;a.on('lifeEnd',function(c){b.emit('flying-end',a._data)})},updateOptions:function(a){a=this.options=c.deepMerge(this.options,a,!0);var b=a.child;b.lifeSpeed=a.lifeSpeed;var d=this.trails;this.each(function(a,c){a.updateOptions(b)})},render:function(b,a){a=a||'group',a==='group'?this.datas(b):a==='flatten'&&this.mergeData(b)},updateAnim:function(a){if(!this.isable)return;if(this.iii=this.iii||0,this.lcanvas.clear(),a=a||this.life,a+=this.options.lifeSpeed,a>this.options.lifeMax)return this.life=this.options.lifeMax,this.disable();var c=this.using;for(var d in c){var b=c[d];b.life=a,b.updateAnim(a),this.checkTrail(b)}},updateMap:function(){if(!this.isable)return;var a=this.ctx;a&&a.clearRect(0,0,a.canvas.width,a.canvas.height);var d=this._map.getBounds(),b=this.using;for(var e in b){var c=b[e];c&&c.updateMap(d)}},clean:function(){var a=this.ctx;a&&a.clearRect(0,0,a.canvas.width,a.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(){}).on('moveend',function(){a.updateMap()}.bind(this))},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.enable(),a.updateBgLine()):a.disable()},hide:function(a){this.each(function(b,c){a(b,b._data)&&b.hide()})},unselect:function(){var b,c=this.trails;this.clean();for(var a=0;a<c.length;a++)b=c[a],b&&b.enable()},initEventsAnim:function(){this.on('update',function(a){this.updateAnim(a)})}}),g=b.dmap=b.dmap||{};g.TrailsCanvas=a,g.trailsCanvas=function(b){return new a(b)},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=require('./../core/animator'),f=require('./trail_canvas_flying');a.options={lineN:1e3,lifeSpeed:1,isAutoUpdate:!0,type:'flying',isable:!0,container:'#canvas',id:function(a){return a.id},id:c.getID,lifeMin:0,lifeMax:1e11,child:{spriteFlying:{type:'linear',isContinue:!0,width:200,height:20,color:{from:'rgba(233,0,0,0.3)',to:'#f2f7b8',space:'hsl',easing:'linear.Out.3'}},spriteHead:{type:'radian',isContinue:!1,width:100,height:100,color:{to:'rgba(255,150,0,0.4)',from:'rgba(255,150,0,0.4)',space:'hsl',easing:'linear.Out.1'}},size:function(a,b){return 6},delay:2,lengthLimit:60,lineSegmentLonger:0,isAutoUpdate:!1,isable:!0,blending:'lighter',type:'line',ptsN:25,weight:function(b,a){return 5*Math.pow(a,3)},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.pts}}};var a=e.extend(a,{events:{},initialize:function(a){this.isable=!0,this.lifeMax=a.lifeMax,this.lifeMin=a.lifeMin,this.life=this.lifeMin,a.isAutoUpdate&&this.initEventsAnim()},initCanvas:function(){var a=this.options,b=a.child,e=b.blending||a.blending;this.lcanvas=new d(this._map,a.container,{clearAlpha:1});var c=this.ctx=this.lcanvas.ctx;c.globalCompositeOperation=e,b.ctx=c},addTo:function(a){if(this._map||!a)return;this._map=a,this.initCanvas(),this.initTrails(),this.initEventsMap(),this._data&&this.updateZoom()},clear:function(){var b=this.using,a=this.unusing,d;for(var e in b)d=b[e],d.reset();this.using={},a=[];var c=this.trails;for(var f in c)a.push(c[f]);this.unusing=a},reset:function(){var c=this.unusing=[];this.using={};var a=this.trails;for(var d in a){var b=a[d];b.stop&&b.stop(),b.pause&&b.pause(),b.resetVariables()}this.life=this.options.lifeMin;var a=this.trails;for(var e in a)c.push(a[e]);this.resume()},initCacheColor:function(){},mergeData:function(e){var f=this.options,g=f.id.bind(f),a=e.d,b,c=this._data=this._data||{};for(var d=0;d<e.length;d++)a=e[d],b=g(a),c[b]?c[b].pts.push(a):c[b]={pts:[a],id:b};this.resetOrUpdateTrails(),this.options.isAutoUpdate&&this._map&&!this.loopid&&this.startAnim()},data:function(c){if(!c)return this._data;var b=this.unusing,d=this.using;if(!(b&&b.length))return;var a=b.pop(),e=this.options,f=e.child.pts,g=f(c);a.updateOptions({lifeMin:0,lifeMax:g.length}),a.data(c),d[a.id]=a,this.options.isAutoUpdate&&this._map&&!this.loopid&&this.startAnim()},resetOrUpdateTrails:function(){var c=this._data,d=this.using,h=this.unusing,e=this.options,i=e.child.pts.bind(e.child),f,a,g;for(var b in c)f=c[b],a=d[b],g=i(f),a?a.processing():(a=h.pop(),g&&g.length>3&&(a.data(f),a.id=b,d[b]=a))},datas:function(a){if(!a)return this._data;this._data=a;for(var b in a)this.data(a[b])},initTrails:function(){var a=this.options,b=a.child;b.lifeSpeed=a.lifeSpeed,b.isable=a.isable,b.container=a.container,this.using={};var e=this.unusing=[],g=this._map,h=this.trails=[],i=a.lineN,c;for(var d=0;d<i;d++)c=new f(b),c.addTo(g),this.initEventsTrail(c),h.push(c),e.push(c)},each:function(c){var a=this.using;for(var b in a)c(a[b],b)},checkTrail:function(b){if(!b.isEnd())return;var a=this.using,c=!1;for(var d in a)if(a[d].equalTo(b)){c=!0,delete a[d];break}c&&this.unusing.push(b)},initEventsTrail:function(a){var b=this;a.on('lifeEnd',function(c){b.emit('flying-end',a._data)})},updateOptions:function(a){a=this.options=c.deepMerge(this.options,a,!0);var b=a.child;b.lifeSpeed=a.lifeSpeed;var d=this.trails;this.each(function(a,c){a.updateOptions(b)})},render:function(b,a){a=a||'group',a==='group'?this.datas(b):a==='flatten'&&this.mergeData(b)},updateAnim:function(a){if(!this.isable)return;if(this.iii=this.iii||0,this.lcanvas.clear(),a=a||this.life,a+=this.options.lifeSpeed,a>this.options.lifeMax)return this.life=this.options.lifeMax,this.disable();var c=this.using;for(var d in c){var b=c[d];b.life=a,b.updateAnim(a),this.checkTrail(b)}},updateMap:function(){if(!this.isable)return;var a=this.ctx;a&&a.clearRect(0,0,a.canvas.width,a.canvas.height);var d=this._map.getBounds(),b=this.using;for(var e in b){var c=b[e];c&&c.updateMap(d)}},clean:function(){var a=this.ctx;a&&a.clearRect(0,0,a.canvas.width,a.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(){}).on('moveend',function(){a.updateMap()}.bind(this))},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.enable(),a.updateBgLine()):a.disable()},hide:function(a){this.each(function(b,c){a(b,b._data)&&b.hide()})},unselect:function(){var b,c=this.trails;this.clean();for(var a=0;a<c.length;a++)b=c[a],b&&b.enable()},initEventsAnim:function(){this.on('update',function(a){this.updateAnim(a)})}}),g=b.dmap=b.dmap||{};g.TrailsCanvas=a,g.trailsCanvas=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=require('./../core/animator'),f=require('./trail_canvas_bg');a.options={lineN:1e3,lifeSpeed:1,isAutoUpdate:!0,type:'flying',isable:!0,container:'#canvas',id:function(a){return a.id},id:c.getID,lifeMin:0,lifeMax:1e11,child:{spriteFlying:{type:'linear',isContinue:!0,width:200,height:20,color:{from:'rgba(233,0,0,0.3)',to:'#f2f7b8',space:'hsl',easing:'linear.Out.3'}},spriteHead:{type:'radian',isContinue:!1,width:100,height:100,color:{to:'rgba(255,150,0,0.4)',from:'rgba(255,150,0,0.4)',space:'hsl',easing:'linear.Out.1'}},size:function(a,b){return 6},delay:2,lengthLimit:60,lineSegmentLonger:0,isAutoUpdate:!1,isable:!0,blending:'lighter',type:'line',ptsN:25,weight:function(b,a){return 5*Math.pow(a,3)},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.pts}}};var g=e.extend(g,{events:{},initialize:function(a){this.isable=!0,this.lifeMax=a.lifeMax,this.lifeMin=a.lifeMin,this.life=this.lifeMin,a.isAutoUpdate&&this.initEventsAnim()},initCanvas:function(){var a=this.options,b=a.child,e=b.blending||a.blending;this.lcanvas=new d(this._map,a.container,{clearAlpha:1});var c=this.ctx=this.lcanvas.ctx;c.globalCompositeOperation=e,b.ctx=c},addTo:function(a){if(this._map||!a)return;this._map=a,this.initCanvas(),this.initTrails(),this.initEventsMap(),this._data&&this.updateZoom()},clear:function(){var b=this.using,a=this.unusing,d;for(var e in b)d=b[e],d.reset();this.using={},a=[];var c=this.trails;for(var f in c)a.push(c[f]);this.unusing=a},reset:function(){var c=this.unusing=[];this.using={};var a=this.trails;for(var d in a){var b=a[d];b.stop&&b.stop(),b.pause&&b.pause(),b.resetVariables()}this.life=this.options.lifeMin;var a=this.trails;for(var e in a)c.push(a[e]);this.resume()},initCacheColor:function(){},mergeData:function(e){var f=this.options,g=f.id.bind(f),a=e.d,b,c=this._data=this._data||{};for(var d=0;d<e.length;d++)a=e[d],b=g(a),c[b]?c[b].pts.push(a):c[b]={pts:[a],id:b};this.resetOrUpdateTrails(),this.options.isAutoUpdate&&this._map&&!this.loopid&&this.startAnim()},data:function(d){if(!d)return this._data;var b=this.unusing,e=this.using;if(!(b&&b.length))return;var a=b.pop(),f=this.options,g=f.child.pts,c=g(d);a.updateOptions({lifeMin:0,lifeMax:c.length}),a.data(c),e[a.id]=a,this.options.isAutoUpdate&&this._map&&!this.loopid&&this.startAnim()},resetOrUpdateTrails:function(){var c=this._data,d=this.using,h=this.unusing,e=this.options,i=e.child.pts.bind(e.child),f,a,g;for(var b in c)f=c[b],a=d[b],g=i(f),a?a.processing():(a=h.pop(),g&&g.length>3&&(a.data(f),a.id=b,d[b]=a))},datas:function(a){if(!a)return this._data;for(var b in a)this.data(a[b])},initTrails:function(){var a=this.options,b=a.child;b.lifeSpeed=a.lifeSpeed,b.isable=a.isable,b.container=a.container,this.using={};var e=this.unusing=[],g=this._map,h=this.trails=[],i=a.lineN,c;for(var d=0;d<i;d++)c=new f(b),c.addTo(g),this.initEventsTrail(c),h.push(c),e.push(c)},each:function(c){var a=this.using;for(var b in a)c(a[b],b)},checkTrail:function(b){if(!b.isEnd())return;var a=this.using,c=!1;for(var d in a)if(a[d].equalTo(b)){c=!0,delete a[d];break}c&&this.unusing.push(b)},initEventsTrail:function(a){var b=this;a.on('lifeEnd',function(c){b.emit('flying-end',a._data)})},updateOptions:function(a){a=this.options=c.deepMerge(this.options,a,!0);var b=a.child;b.lifeSpeed=a.lifeSpeed;var d=this.trails;this.each(function(a,c){a.updateOptions(b)})},render:function(b,a){a=a||'group',a==='group'?this.datas(b):a==='flatten'&&this.mergeData(b)},updateAnim:function(a){if(!this.isable)return;if(this.iii=this.iii||0,this.lcanvas.clear(),a=a||this.life,a+=this.options.lifeSpeed,a>this.options.lifeMax)return this.life=this.options.lifeMax,this.disable();var c=this.using;for(var d in c){var b=c[d];b.life=a,b.updateAnim(a),this.checkTrail(b)}},updateMap:function(){if(!this.isable)return;var a=this.ctx;a&&a.clearRect(0,0,a.canvas.width,a.canvas.height);var d=this._map.getBounds(),b=this.using;for(var e in b){var c=b[e];c&&c.updateMap(d)}},clean:function(){var a=this.ctx;a&&a.clearRect(0,0,a.canvas.width,a.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(){}).on('moveend',function(){a.updateMap()}.bind(this))},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.enable(),a.updateBgLine()):a.disable()},hide:function(a){this.each(function(b,c){a(b,b._data)&&a.hide()})},unselect:function(){var b,c=this.trails;this.clean();for(var a=0;a<c.length;a++)b=c[a],b&&b.enable()}}),h=b.dmap=b.dmap||{};h.TrailsCanvasStatic=a,h.trailsCanvasStatic=function(b){return new a(b)},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=require('./../core/animator'),f=require('./trail_canvas_bg');a.options={lineN:1e3,lifeSpeed:1,isAutoUpdate:!0,type:'flying',isable:!0,container:'#canvas',id:function(a){return a.id},id:c.getID,lifeMin:0,lifeMax:1e11,child:{spriteFlying:{type:'linear',isContinue:!0,width:200,height:20,color:{from:'rgba(233,0,0,0.3)',to:'#f2f7b8',space:'hsl',easing:'linear.Out.3'}},spriteHead:{type:'radian',isContinue:!1,width:100,height:100,color:{to:'rgba(255,150,0,0.4)',from:'rgba(255,150,0,0.4)',space:'hsl',easing:'linear.Out.1'}},size:function(a,b){return 6},delay:2,lengthLimit:60,lineSegmentLonger:0,isAutoUpdate:!1,isable:!0,blending:'lighter',type:'line',ptsN:25,weight:function(b,a){return 5*Math.pow(a,3)},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.pts}}};var g=e.extend(g,{events:{},initialize:function(a){this.isable=!0,this.lifeMax=a.lifeMax,this.lifeMin=a.lifeMin,this.life=this.lifeMin,a.isAutoUpdate&&this.initEventsAnim()},initCanvas:function(){var a=this.options,b=a.child,e=b.blending||a.blending;this.lcanvas=new d(this._map,a.container,{clearAlpha:1});var c=this.ctx=this.lcanvas.ctx;c.globalCompositeOperation=e,b.ctx=c},addTo:function(a){if(this._map||!a)return;this._map=a,this.initCanvas(),this.initTrails(),this.initEventsMap(),this._data&&this.updateZoom()},clear:function(){var b=this.using,a=this.unusing,d;for(var e in b)d=b[e],d.reset();this.using={},a=[];var c=this.trails;for(var f in c)a.push(c[f]);this.unusing=a},reset:function(){var c=this.unusing=[];this.using={};var a=this.trails;for(var d in a){var b=a[d];b.stop&&b.stop(),b.pause&&b.pause(),b.resetVariables()}this.life=this.options.lifeMin;var a=this.trails;for(var e in a)c.push(a[e]);this.resume()},initCacheColor:function(){},mergeData:function(e){var f=this.options,g=f.id.bind(f),a=e.d,b,c=this._data=this._data||{};for(var d=0;d<e.length;d++)a=e[d],b=g(a),c[b]?c[b].pts.push(a):c[b]={pts:[a],id:b};this.resetOrUpdateTrails(),this.options.isAutoUpdate&&this._map&&!this.loopid&&this.startAnim()},data:function(d){if(!d)return this._data;var b=this.unusing,e=this.using;if(!(b&&b.length))return;var a=b.pop(),f=this.options,g=f.child.pts,c=g(d);a.updateOptions({lifeMin:0,lifeMax:c.length}),a.data(c),e[a.id]=a,this.options.isAutoUpdate&&this._map&&!this.loopid&&this.startAnim()},resetOrUpdateTrails:function(){var c=this._data,d=this.using,h=this.unusing,e=this.options,i=e.child.pts.bind(e.child),f,a,g;for(var b in c)f=c[b],a=d[b],g=i(f),a?a.processing():(a=h.pop(),g&&g.length>3&&(a.data(f),a.id=b,d[b]=a))},datas:function(a){if(!a)return this._data;for(var b in a)this.data(a[b])},initTrails:function(){var a=this.options,b=a.child;b.lifeSpeed=a.lifeSpeed,b.isable=a.isable,b.container=a.container,this.using={};var e=this.unusing=[],g=this._map,h=this.trails=[],i=a.lineN,c;for(var d=0;d<i;d++)c=new f(b),c.addTo(g),this.initEventsTrail(c),h.push(c),e.push(c)},each:function(c){var a=this.using;for(var b in a)c(a[b],b)},checkTrail:function(b){if(!b.isEnd())return;var a=this.using,c=!1;for(var d in a)if(a[d].equalTo(b)){c=!0,delete a[d];break}c&&this.unusing.push(b)},initEventsTrail:function(a){var b=this;a.on('lifeEnd',function(c){b.emit('flying-end',a._data)})},updateOptions:function(a){a=this.options=c.deepMerge(this.options,a,!0);var b=a.child;b.lifeSpeed=a.lifeSpeed;var d=this.trails;this.each(function(a,c){a.updateOptions(b)})},render:function(b,a){a=a||'group',a==='group'?this.datas(b):a==='flatten'&&this.mergeData(b)},updateAnim:function(a){if(!this.isable)return;if(this.iii=this.iii||0,this.lcanvas.clear(),a=a||this.life,a+=this.options.lifeSpeed,a>this.options.lifeMax)return this.life=this.options.lifeMax,this.disable();var c=this.using;for(var d in c){var b=c[d];b.life=a,b.updateAnim(a),this.checkTrail(b)}},updateMap:function(){if(!this.isable)return;var a=this.ctx;a&&a.clearRect(0,0,a.canvas.width,a.canvas.height);var d=this._map.getBounds(),b=this.using;for(var e in b){var c=b[e];c&&c.updateMap(d)}},clean:function(){var a=this.ctx;a&&a.clearRect(0,0,a.canvas.width,a.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(){}).on('moveend',function(){a.updateMap()}.bind(this))},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.enable(),a.updateBgLine()):a.disable()},hide:function(a){this.each(function(b,c){a(b,b._data)&&a.hide()})},unselect:function(){var b,c=this.trails;this.clean();for(var a=0;a<c.length;a++)b=c[a],b&&b.enable()}}),h=b.dmap=b.dmap||{};h.TrailsCanvasStatic=a,h.trailsCanvasStatic=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={lineN:1e3,lifeSpeed:1,isAutoUpdate:!0,trail:{delay:2,lifeSpeed:1.5,lengthLimit:60,lineSegmentLonger:0,isAutoUpdate:!1,spriteW:200,spriteH:20,flying:{container:'#canvas',isable:!0,blending:'lighter',type:'line',ptsN:25,weight:function(a){return 5*Math.pow(a,3)},isSpriteHead:!0},color:e('rgba(150,0,0,0.3)','rgba(250,150,0, 1)','rgb','linear.Out.2'),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,lifeMin:0,lifeMax:1e11};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.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,{clearAlpha:.9});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,{clearAlpha:1});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.initTrails(),this.initEventsMap(),this._data&&this.updateZoom()},clear:function(){var b=this.using,a=this.unusing,e;for(var f in b)e=b[f],e.reset();this.using=[],a=[];var c=this.trails;for(var d in c)a[d]=c[d];this.unusing=a},reset:function(){var e=this.unusing=[];this.using=[];var a=this.trails;for(var c=0;c<a.length;c++){var b=a[c];b.stop&&b.stop(),b.pause&&b.pause(),b.resetVariables()}this.life=this.options.lifeMin,this.using=[];var a=this.trails;for(var d=0;d<a.length;d++)e.push(a[d]);this.resume()},initCacheColor:function(){},data:function(d){if(!d)return this._data;var a=this.unusing,e=this.using;if(!(a&&a.length))return;var b=a.pop(),f=this.options,g=f.pts,c=g(d);b.updateOptions({lifeMin:0,lifeMax:c.length}),b.data(c),e.push(b),this.options.isAutoUpdate&&this._map&&!this.loopid&&this.startAnim()},datas:function(a){if(!a)return this._data;for(var b in a)this.data(a[b])},initTrails:function(){var b=this.options,d=b.trail,j=this.using=[],e=this.unusing=[],f=this._map,h=this.trails=[],i=b.lineN,a;for(var c=0;c<i;c++)a=new g(d),a.addTo(f),this.initEventsTrail(a),h.push(a),e.push(a)},checkTrail:function(b){if(!b.isEnd())return;var a=this.using,c=!1;for(var d in a)if(a[d].equalTo(b)){c=!0,a.splice(d,1);break}c&&this.unusing.push(b)},initEventsTrail:function(a){var b=this;a.on('lifeEnd',function(c){b.emit('flying-end',a._data)})},updateOptions:function(){var b=this.options,c,a=this.trails;for(var d in a)c=a[d],c.updateOptions(b)},render:function(){},updateAnim:function(a){if(!this.isable)return;this.iii=this.iii||0;var f=this.ctxFlying;this.lcanvas.clear(),a=a||this.life;var d=this.using,e=this.options.trail;for(var b=d.length-1;b>=0;b--){var c=d[b];a=c.life+e.lifeSpeed,c.updateAnim(a),this.checkTrail(c)}},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(),d=this.using;for(var c=0;c<d.length;c++){var e=d[c];e&&e.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,j=b.color,a=document.createElement('canvas'),e=this.spriteW=a.width=b.spriteW,g=this.spriteH=a.height=b.spriteH,d=a.getContext('2d'),h,i=d.createLinearGradient(0,0,e,g),f=100;for(var c=0;c<f;c++)h=c/f,i.addColorStop(h,j(h));d.fillStyle=i,d.fillRect(0,0,e,g),this.spriteFlying=a,b.flying.sprite=a},initSpriteFlyingHead:function(){var d=this.options.trail,e=d.color,a=document.createElement('canvas'),f=a.width=a.height=50,b=f/2,c=a.getContext('2d');return c.fillStyle=e(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.enable(),a.updateBgLine()):a.disable()},unselect:function(){var a,c=this.trails;this.clean();for(var b=0;b<c.length;b++)a=c[b],a&&a.enable('flying'),a&&a.disable('bgLine')},initEventsAnim:function(){this.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={lineN:1e3,lifeSpeed:1,isAutoUpdate:!0,trail:{delay:2,lifeSpeed:1.5,lengthLimit:60,lineSegmentLonger:0,isAutoUpdate:!1,spriteW:200,spriteH:20,flying:{container:'#canvas',isable:!0,blending:'lighter',type:'line',ptsN:25,weight:function(a){return 5*Math.pow(a,3)},isSpriteHead:!0},color:e('rgba(150,0,0,0.3)','rgba(250,150,0, 1)','rgb','linear.Out.2'),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,lifeMin:0,lifeMax:1e11};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.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,{clearAlpha:.9});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,{clearAlpha:1});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.initTrails(),this.initEventsMap(),this._data&&this.updateZoom()},clear:function(){var b=this.using,a=this.unusing,e;for(var f in b)e=b[f],e.reset();this.using=[],a=[];var c=this.trails;for(var d in c)a[d]=c[d];this.unusing=a},reset:function(){var e=this.unusing=[];this.using=[];var a=this.trails;for(var c=0;c<a.length;c++){var b=a[c];b.stop&&b.stop(),b.pause&&b.pause(),b.resetVariables()}this.life=this.options.lifeMin,this.using=[];var a=this.trails;for(var d=0;d<a.length;d++)e.push(a[d]);this.resume()},initCacheColor:function(){},data:function(d){if(!d)return this._data;var a=this.unusing,e=this.using;if(!(a&&a.length))return;var b=a.pop(),f=this.options,g=f.pts,c=g(d);b.updateOptions({lifeMin:0,lifeMax:c.length}),b.data(c),e.push(b),this.options.isAutoUpdate&&this._map&&!this.loopid&&this.startAnim()},datas:function(a){if(!a)return this._data;for(var b in a)this.data(a[b])},initTrails:function(){var b=this.options,d=b.trail,j=this.using=[],e=this.unusing=[],f=this._map,h=this.trails=[],i=b.lineN,a;for(var c=0;c<i;c++)a=new g(d),a.addTo(f),this.initEventsTrail(a),h.push(a),e.push(a)},checkTrail:function(b){if(!b.isEnd())return;var a=this.using,c=!1;for(var d in a)if(a[d].equalTo(b)){c=!0,a.splice(d,1);break}c&&this.unusing.push(b)},initEventsTrail:function(a){var b=this;a.on('lifeEnd',function(c){b.emit('flying-end',a._data)})},updateOptions:function(){var b=this.options,c,a=this.trails;for(var d in a)c=a[d],c.updateOptions(b)},render:function(){},updateAnim:function(a){if(!this.isable)return;this.iii=this.iii||0;var f=this.ctxFlying;this.lcanvas.clear(),a=a||this.life;var d=this.using,e=this.options.trail;for(var b=d.length-1;b>=0;b--){var c=d[b];a=c.life+e.lifeSpeed,c.updateAnim(a),this.checkTrail(c)}},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(),d=this.using;for(var c=0;c<d.length;c++){var e=d[c];e&&e.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,j=b.color,a=document.createElement('canvas'),e=this.spriteW=a.width=b.spriteW,g=this.spriteH=a.height=b.spriteH,d=a.getContext('2d'),h,i=d.createLinearGradient(0,0,e,g),f=100;for(var c=0;c<f;c++)h=c/f,i.addColorStop(h,j(h));d.fillStyle=i,d.fillRect(0,0,e,g),this.spriteFlying=a,b.flying.sprite=a},initSpriteFlyingHead:function(){var d=this.options.trail,e=d.color,a=document.createElement('canvas'),f=a.width=a.height=50,b=f/2,c=a.getContext('2d');return c.fillStyle=e(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.enable(),a.updateBgLine()):a.disable()},unselect:function(){var a,c=this.trails;this.clean();for(var b=0;b<c.length;b++)a=c[b],a&&a.enable('flying'),a&&a.disable('bgLine')},initEventsAnim:function(){this.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 @@

function e(a){var a=this.options=l.deepMerge(e.options,a)}var h,a,d,b,f,g,c,i,j,k=require('./gl/texture');__indexOf=[].indexOf||function(c){for(var a=0,b=this.length;a<b;a++)if(a in this&&this[a]===c)return a;return-1};var l=require('./../core/utils'),m=require('bcore/event'),n=require('leaflet'),o=require('./../render/canvas'),a=require('./gl/heights'),b=require('./gl/shader');j=require('./gl/vertexShaderBlit'),g=require('./gl/fragmentShaderBlit'),c=function(){var a,d,b,c;return window.WebGLRenderingContext!=null?(c=['WEBKIT','MOZ','MS','O'],b=/^WEBKIT_(.*)|MOZ_(.*)|MS_(.*)|O_(.*)/,a=WebGLRenderingContext.prototype.getExtension,WebGLRenderingContext.prototype.getExtension=function(e){var d,g,h,f,i;if(g=e.match(b),g!==null&&(e=g[1]),d=a.call(this,e),d===null){for(f=0,i=c.length;f<i;f++)if(h=c[f],d=a.call(this,h+'_'+e),d!==null)return d;return null}else return d},d=WebGLRenderingContext.prototype.getSupportedExtensions,WebGLRenderingContext.prototype.getSupportedExtensions=function(){var a,f,c,g,e,h;for(g=d.call(this),c=[],e=0,h=g.length;e<h;e++)a=g[e],f=a.match(b),f!==null&&(a=f[1]),__indexOf.call(c,a)<0&&c.push(a);return c}):void 0},i=function(){var e,f,l,d,j,m,k,g,a,c,b,h,i,n;if(j=function(){var a,b,c;return a=document.createElement('canvas'),a.width=2,a.height=2,b=a.getContext('2d'),c=b.getImageData(0,0,2,2),c.data.set(new Uint8ClampedArray([0,0,0,0,255,255,255,255,0,0,0,0,255,255,255,255])),b.putImageData(c,0,0),a},j(),f=function(a,q){var f,m,d,g,h,b,i,l,k,n,o,e,c,p;if(b=a.createProgram(),c=a.createShader(a.VERTEX_SHADER),a.attachShader(b,c),a.shaderSource(c,'attribute vec2 position;\nvoid main(){\n gl_Position = vec4(position, 0.0, 1.0);\n}'),a.compileShader(c),!a.getShaderParameter(c,a.COMPILE_STATUS))throw a.getShaderInfoLog(c);if(d=a.createShader(a.FRAGMENT_SHADER),a.attachShader(b,d),a.shaderSource(d,'uniform sampler2D source;\nvoid main(){\n gl_FragColor = texture2D(source, vec2(1.0, 1.0));\n}'),a.compileShader(d),!a.getShaderParameter(d,a.COMPILE_STATUS))throw a.getShaderInfoLog(d);if(a.linkProgram(b),!a.getProgramParameter(b,a.LINK_STATUS))throw a.getProgramInfoLog(b);return a.useProgram(b),m=function(){return a.deleteShader(d),a.deleteShader(c),a.deleteProgram(b),a.deleteBuffer(f),a.deleteTexture(k),a.deleteTexture(e),a.deleteFramebuffer(g),a.bindBuffer(a.ARRAY_BUFFER,null),a.useProgram(null),a.bindTexture(a.TEXTURE_2D,null),a.bindFramebuffer(a.FRAMEBUFFER,null)},e=a.createTexture(),a.bindTexture(a.TEXTURE_2D,e),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,2,2,0,a.RGBA,a.UNSIGNED_BYTE,null),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR),g=a.createFramebuffer(),a.bindFramebuffer(a.FRAMEBUFFER,g),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,e,0),n=j(),k=a.createTexture(),a.bindTexture(a.TEXTURE_2D,k),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,q,n),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR),p=new Float32Array([1,1,-1,1,-1,-1,1,1,-1,-1,1,-1]),f=a.createBuffer(),a.bindBuffer(a.ARRAY_BUFFER,f),a.bufferData(a.ARRAY_BUFFER,p,a.STATIC_DRAW),h=a.getAttribLocation(b,'position'),o=a.getUniformLocation(b,'source'),a.enableVertexAttribArray(h),a.vertexAttribPointer(h,2,a.FLOAT,!1,0,0),a.uniform1i(o,0),a.drawArrays(a.TRIANGLES,0,6),i=new Uint8Array(16),a.readPixels(0,0,2,2,a.RGBA,a.UNSIGNED_BYTE,i),l=Math.abs(i[0]-127)<10,m(),l},d=function(a,c){var b;return b=a.createTexture(),a.bindTexture(a.TEXTURE_2D,b),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,2,2,0,a.RGBA,c,null),a.getError()===0?(a.deleteTexture(b),!0):(a.deleteTexture(b),!1)},e=function(a,e){var d,c,b;return b=a.createTexture(),a.bindTexture(a.TEXTURE_2D,b),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,2,2,0,a.RGBA,e,null),c=a.createFramebuffer(),a.bindFramebuffer(a.FRAMEBUFFER,c),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,b,0),d=a.checkFramebufferStatus(a.FRAMEBUFFER),a.deleteTexture(b),a.deleteFramebuffer(c),a.bindTexture(a.TEXTURE_2D,null),a.bindFramebuffer(a.FRAMEBUFFER,null),d===a.FRAMEBUFFER_COMPLETE?!0:!1},a=[],c={},b=[],l=function(){var l,h,g,i,j,m,k;l=document.createElement('canvas'),g=null;try{g=l.getContext('experimental-webgl'),g===null&&(g=l.getContext('webgl'))}catch(a){}return g!=null&&(m=g.getExtension('OES_texture_float'),m===null?d(g,g.FLOAT)?(k=!0,a.push('OES_texture_float'),c.OES_texture_float={shim:!0}):(k=!1,b.push('OES_texture_float')):d(g,g.FLOAT)?(k=!0,a.push('OES_texture_float')):(k=!1,b.push('OES_texture_float')),k&&(h=g.getExtension('WEBGL_color_buffer_float'),h===null?e(g,g.FLOAT)?(a.push('WEBGL_color_buffer_float'),c.WEBGL_color_buffer_float={shim:!0,RGBA32F_EXT:34836,RGB32F_EXT:34837,FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT:33297,UNSIGNED_NORMALIZED_EXT:35863}):b.push('WEBGL_color_buffer_float'):e(g,g.FLOAT)?a.push('WEBGL_color_buffer_float'):b.push('WEBGL_color_buffer_float'),h=g.getExtension('OES_texture_float_linear'),h===null?f(g,g.FLOAT)?(a.push('OES_texture_float_linear'),c.OES_texture_float_linear={shim:!0}):b.push('OES_texture_float_linear'):f(g,g.FLOAT)?a.push('OES_texture_float_linear'):b.push('OES_texture_float_linear')),i=g.getExtension('OES_texture_half_float'),i===null?d(g,36193)?(j=!0,a.push('OES_texture_half_float'),i=c.OES_texture_half_float={HALF_FLOAT_OES:36193,shim:!0}):(j=!1,b.push('OES_texture_half_float')):d(g,i.HALF_FLOAT_OES)?(j=!0,a.push('OES_texture_half_float')):(j=!1,b.push('OES_texture_half_float')),j)?(h=g.getExtension('EXT_color_buffer_half_float'),h===null?e(g,i.HALF_FLOAT_OES)?(a.push('EXT_color_buffer_half_float'),c.EXT_color_buffer_half_float={shim:!0,RGBA16F_EXT:34842,RGB16F_EXT:34843,FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT:33297,UNSIGNED_NORMALIZED_EXT:35863}):b.push('EXT_color_buffer_half_float'):e(g,i.HALF_FLOAT_OES)?a.push('EXT_color_buffer_half_float'):b.push('EXT_color_buffer_half_float'),h=g.getExtension('OES_texture_half_float_linear'),h===null?f(g,i.HALF_FLOAT_OES)?(a.push('OES_texture_half_float_linear'),c.OES_texture_half_float_linear={shim:!0}):b.push('OES_texture_half_float_linear'):f(g,i.HALF_FLOAT_OES)?a.push('OES_texture_half_float_linear'):b.push('OES_texture_half_float_linear')):void 0},window.WebGLRenderingContext!=null){for(l(),h={},i=0,n=b.length;i<n;i++)g=b[i],h[g]=!0;return m=WebGLRenderingContext.prototype.getExtension,WebGLRenderingContext.prototype.getExtension=function(a){var b;return b=c[a],b===void 0?h[a]?null:m.call(this,a):b},k=WebGLRenderingContext.prototype.getSupportedExtensions,WebGLRenderingContext.prototype.getSupportedExtensions=function(){var b,c,f,d,e,g,i;for(f=k.call(this),c=[],d=0,g=f.length;d<g;d++)b=f[d],h[b]===void 0&&c.push(b);for(e=0,i=a.length;e<i;e++)b=a[e],__indexOf.call(c,b)<0&&c.push(b);return c},WebGLRenderingContext.prototype.getFloatExtension=function(b){var c,d,l,B,t,e,f,r,s,a,k,z,u,q,n,h,i,j,v,w,x,y,o,A,p,m;for(b.prefer==null&&(b.prefer=['half']),b.require==null&&(b.require=[]),b.throws==null&&(b.throws=!0),q=this.getExtension('OES_texture_float'),e=this.getExtension('OES_texture_half_float'),z=this.getExtension('WEBGL_color_buffer_float'),B=this.getExtension('EXT_color_buffer_half_float'),u=this.getExtension('OES_texture_float_linear'),t=this.getExtension('OES_texture_half_float_linear'),k={texture:q!==null,filterable:u!==null,renderable:z!==null,score:0,precision:'single',half:!1,single:!0,type:this.FLOAT},l={texture:e!==null,filterable:t!==null,renderable:B!==null,score:0,precision:'half',half:!0,single:!1,type:(A=e!=null?e.HALF_FLOAT_OES:void 0)!=null?A:null},d=[],k.texture&&d.push(k),l.texture&&d.push(l),a=[],h=0,v=d.length;h<v;h++){for(c=d[h],n=!0,p=b.require,i=0,w=p.length;i<w;i++)g=p[i],c[g]===!1&&(n=!1);n&&a.push(c)}for(j=0,x=a.length;j<x;j++)for(c=a[j],m=b.prefer,f=o=0,y=m.length;o<y;f=++o)s=m[f],r=Math.pow(2,b.prefer.length-f-1),c[s]&&(c.score+=r);if(a.sort(function(a,b){return a.score===b.score?0:a.score<b.score?1:a.score>b.score?-1:void 0}),a.length===0)if(b.throws)throw'No floating point texture support that is '+b.require.join(', ');else return null;else return a=a[0],{filterable:a.filterable,renderable:a.renderable,type:a.type,precision:a.precision}}}},c(),i(),f=function(){function c(o){var r,l,q,i,c,f,h,m,p,e,d,n;d=o!=null?o:{},this.canvas=d.canvas,this.width=d.width,this.height=d.height,h=d.intensityToAlpha,c=d.gradientTexture,l=d.alphaRange,this.canvas||(this.canvas=document.createElement('canvas'));try{if(this.gl=this.canvas.getContext('experimental-webgl',{depth:!1,antialias:!1}),this.gl===null&&(this.gl=this.canvas.getContext('webgl',{depth:!1,antialias:!1}),this.gl===null))throw'WebGL not supported'}catch(a){throw'WebGL not supported'}window.WebGLDebugUtils!=null&&(console.log('debugging mode'),this.gl=WebGLDebugUtils.makeDebugContext(this.gl,function(a,b,c){throw WebGLDebugUtils.glEnumToString(a)+' was caused by call to: '+b})),this.gl.enableVertexAttribArray(0),this.gl.blendFunc(this.gl.ONE,this.gl.ONE),c?(e=this.gradientTexture=new k(this.gl,{channels:'rgba'}).bind(0).setSize(2,2).nearest().clampToEdge(),typeof c==='string'?(f=new Image,f.onload=function(){return e.bind().upload(f)},f.src=c):c.width>0&&c.height>0?e.upload(c):c.onload=function(){return e.upload(c)},i='uniform sampler2D gradientTexture;\nvec3 getColor(float intensity){\n return texture2D(gradientTexture, vec2(intensity, 0.0)).rgb;\n}'):(e=null,i='vec3 getColor(float intensity){\n vec3 blue = vec3(0.0, 0.0, 1.0);\n vec3 cyan = vec3(0.0, 1.0, 1.0);\n vec3 green = vec3(0.0, 1.0, 0.0);\n vec3 yellow = vec3(1.0, 1.0, 0.0);\n vec3 red = vec3(1.0, 0.0, 0.0);\n\n vec3 color = (\n fade(-0.25, 0.25, intensity)*blue +\n fade(0.0, 0.5, intensity)*cyan +\n fade(0.25, 0.75, intensity)*green +\n fade(0.5, 1.0, intensity)*yellow +\n smoothstep(0.75, 1.0, intensity)*red\n );\n return color;\n}'),h==null&&(h=!0),h?(n=l!=null?l:[0,1],q=n[0],r=n[1],m='vec4 alphaFun(vec3 color, float intensity){\n float alpha = smoothstep('+q.toFixed(8)+', '+r.toFixed(8)+', intensity);\n return vec4(color*alpha, alpha);\n}'):m='vec4 alphaFun(vec3 color, float intensity){\n return vec4(color, 1.0);\n}',this.shader=new b(this.gl,{vertex:j,fragment:g+('float linstep(float low, float high, float value){\n return clamp((value-low)/(high-low), 0.0, 1.0);\n}\n\nfloat fade(float low, float high, float value){\n float mid = (low+high)*0.5;\n float range = (high-low)*0.5;\n float x = 1.0 - clamp(abs(mid-value)/range, 0.0, 1.0);\n return smoothstep(0.0, 1.0, x);\n}\n\n'+i+'\n'+m+'\n\nvoid main(){\n float intensity = smoothstep(0.0, 1.0, texture2D(source, texcoord).r);\n vec3 color = getColor(intensity);\n gl_FragColor = alphaFun(color, intensity);\n}')}),this.width==null&&(this.width=this.canvas.offsetWidth||2),this.height==null&&(this.height=this.canvas.offsetHeight||2),this.canvas.width=this.width,this.canvas.height=this.height,this.gl.viewport(0,0,this.width,this.height),this.quad=this.gl.createBuffer(),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.quad),p=new Float32Array([-1,-1,0,1,1,-1,0,1,-1,1,0,1,-1,1,0,1,1,-1,0,1,1,1,0,1]),this.gl.bufferData(this.gl.ARRAY_BUFFER,p,this.gl.STATIC_DRAW),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,null),this.heights=new a(this,this.gl,this.width,this.height)}return c.prototype.adjustSize=function(){var a,b;return b=this.canvas.offsetWidth||2,a=this.canvas.offsetHeight||2,this.width!==b||this.height!==a?(this.gl.viewport(0,0,b,a),this.canvas.width=b,this.canvas.height=a,this.width=b,this.height=a,this.heights.resize(this.width,this.height)):void 0},c.prototype.display=function(){return this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.quad),this.gl.vertexAttribPointer(0,4,this.gl.FLOAT,!1,0,0),this.heights.nodeFront.bind(0),this.gradientTexture&&this.gradientTexture.bind(1),this.shader.use().int('source',0).int('gradientTexture',1),this.gl.drawArrays(this.gl.TRIANGLES,0,6)},c.prototype.update=function(){return this.heights.update()},c.prototype.clear=function(){return this.heights.clear()},c.prototype.clamp=function(a,b){return a==null&&(a=0),b==null&&(b=1),this.heights.clamp(a,b)},c.prototype.multiply=function(a){return a==null&&(a=.95),this.heights.multiply(a)},c.prototype.blur=function(){return this.heights.blur()},c.prototype.addPoint=function(a,b,c,d){return this.heights.addPoint(a,b,c,d)},c.prototype.addPoints=function(d){var a,b,e,c;for(c=[],b=0,e=d.length;b<e;b++)a=d[b],c.push(this.addPoint(a.x,a.y,a.size,a.intensity));return c},c}(),e.options={intensity:.2,lat:l.getLat,lng:l.getLng,size:function(){return 3},quality:1,container:'tilePane',clearPhi:0},e=m.extend(e,{addTo:function(a){if(!a)return;this._map=a,this.transfer=a.latLngToContainerPoint.bind(a),this.initialize()},initialize:function(){var g=this.options,b=g.container,c;if(typeof b==='string'){var d,e,i=this._map.getPanes();b=i[b]}else b=l.getContainer(b);var h=this._map.getSize(),d=h.x,e=h.y,c=g.quality,a=document.createElement('<canvas width="'+d*c+'" height="'+e*c+'"><canvas>');a.style.position='absolute',a.style.left='0',a.style.top='0',a.style.pointerEvents='none',a.style.width=d+'px',a.style.height=e+'px',b.appendChild(a),this.heatmap=new f({canvas:a}),this.initEvents()},data:function(a){this._data=a},render:function(c){c&&this.data(c);var a=this.options,i=this.transfer,b=this.heatmap;b.multiply(a.clearPhi);var o=a.intensity,g=a.lat,h=a.lng,f=a.size;c=this._data;var j=this._map.getZoom(),d,l,m,e,p;for(var k in c)d=c[k],l=g(d),m=h(d),latlng=n.latLng(l,m),e=i(latlng),p=f(d,j),b.addPoint(e.x,e.y,p,o);b.update(),b.display()},resetPos:function(){var b=this.canvas[0],a=n.DomUtil.getPosition(this._map.getPanes().mapPane);a&&n.DomUtil.setPosition(b,{x:-a.x,y:-a.y})},clean:function(){var a=this.heatmap;a.multiply(0),a.update(),a.display()},initEvents:function(){var a=this,b=this.heatmap;this._map.on('moveend',function(){a.resetPos(),a.render()}).on('zoomstart',function(){a.clean()})}}),n=n||{},n.dmap=n.dmap||{},n.dmap.webGLHeatmap=function(a){return new e(a)},module.exports=e
function e(a){var a=this.options=l.deepMerge(e.options,a)}var h,a,d,b,f,g,c,i,j,k=require('./gl/texture');__indexOf=[].indexOf||function(c){for(var a=0,b=this.length;a<b;a++)if(a in this&&this[a]===c)return a;return-1};var l=require('./../core/utils'),m=require('bcore/event'),n=require('./../leaflet'),o=require('./../render/canvas'),a=require('./gl/heights'),b=require('./gl/shader');j=require('./gl/vertexShaderBlit'),g=require('./gl/fragmentShaderBlit'),c=function(){var a,d,b,c;return window.WebGLRenderingContext!=null?(c=['WEBKIT','MOZ','MS','O'],b=/^WEBKIT_(.*)|MOZ_(.*)|MS_(.*)|O_(.*)/,a=WebGLRenderingContext.prototype.getExtension,WebGLRenderingContext.prototype.getExtension=function(e){var d,g,h,f,i;if(g=e.match(b),g!==null&&(e=g[1]),d=a.call(this,e),d===null){for(f=0,i=c.length;f<i;f++)if(h=c[f],d=a.call(this,h+'_'+e),d!==null)return d;return null}else return d},d=WebGLRenderingContext.prototype.getSupportedExtensions,WebGLRenderingContext.prototype.getSupportedExtensions=function(){var a,f,c,g,e,h;for(g=d.call(this),c=[],e=0,h=g.length;e<h;e++)a=g[e],f=a.match(b),f!==null&&(a=f[1]),__indexOf.call(c,a)<0&&c.push(a);return c}):void 0},i=function(){var e,f,l,d,j,m,k,g,a,c,b,h,i,n;if(j=function(){var a,b,c;return a=document.createElement('canvas'),a.width=2,a.height=2,b=a.getContext('2d'),c=b.getImageData(0,0,2,2),c.data.set(new Uint8ClampedArray([0,0,0,0,255,255,255,255,0,0,0,0,255,255,255,255])),b.putImageData(c,0,0),a},j(),f=function(a,q){var f,m,d,g,h,b,i,l,k,n,o,e,c,p;if(b=a.createProgram(),c=a.createShader(a.VERTEX_SHADER),a.attachShader(b,c),a.shaderSource(c,'attribute vec2 position;\nvoid main(){\n gl_Position = vec4(position, 0.0, 1.0);\n}'),a.compileShader(c),!a.getShaderParameter(c,a.COMPILE_STATUS))throw a.getShaderInfoLog(c);if(d=a.createShader(a.FRAGMENT_SHADER),a.attachShader(b,d),a.shaderSource(d,'uniform sampler2D source;\nvoid main(){\n gl_FragColor = texture2D(source, vec2(1.0, 1.0));\n}'),a.compileShader(d),!a.getShaderParameter(d,a.COMPILE_STATUS))throw a.getShaderInfoLog(d);if(a.linkProgram(b),!a.getProgramParameter(b,a.LINK_STATUS))throw a.getProgramInfoLog(b);return a.useProgram(b),m=function(){return a.deleteShader(d),a.deleteShader(c),a.deleteProgram(b),a.deleteBuffer(f),a.deleteTexture(k),a.deleteTexture(e),a.deleteFramebuffer(g),a.bindBuffer(a.ARRAY_BUFFER,null),a.useProgram(null),a.bindTexture(a.TEXTURE_2D,null),a.bindFramebuffer(a.FRAMEBUFFER,null)},e=a.createTexture(),a.bindTexture(a.TEXTURE_2D,e),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,2,2,0,a.RGBA,a.UNSIGNED_BYTE,null),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR),g=a.createFramebuffer(),a.bindFramebuffer(a.FRAMEBUFFER,g),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,e,0),n=j(),k=a.createTexture(),a.bindTexture(a.TEXTURE_2D,k),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,q,n),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR),p=new Float32Array([1,1,-1,1,-1,-1,1,1,-1,-1,1,-1]),f=a.createBuffer(),a.bindBuffer(a.ARRAY_BUFFER,f),a.bufferData(a.ARRAY_BUFFER,p,a.STATIC_DRAW),h=a.getAttribLocation(b,'position'),o=a.getUniformLocation(b,'source'),a.enableVertexAttribArray(h),a.vertexAttribPointer(h,2,a.FLOAT,!1,0,0),a.uniform1i(o,0),a.drawArrays(a.TRIANGLES,0,6),i=new Uint8Array(16),a.readPixels(0,0,2,2,a.RGBA,a.UNSIGNED_BYTE,i),l=Math.abs(i[0]-127)<10,m(),l},d=function(a,c){var b;return b=a.createTexture(),a.bindTexture(a.TEXTURE_2D,b),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,2,2,0,a.RGBA,c,null),a.getError()===0?(a.deleteTexture(b),!0):(a.deleteTexture(b),!1)},e=function(a,e){var d,c,b;return b=a.createTexture(),a.bindTexture(a.TEXTURE_2D,b),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,2,2,0,a.RGBA,e,null),c=a.createFramebuffer(),a.bindFramebuffer(a.FRAMEBUFFER,c),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,b,0),d=a.checkFramebufferStatus(a.FRAMEBUFFER),a.deleteTexture(b),a.deleteFramebuffer(c),a.bindTexture(a.TEXTURE_2D,null),a.bindFramebuffer(a.FRAMEBUFFER,null),d===a.FRAMEBUFFER_COMPLETE?!0:!1},a=[],c={},b=[],l=function(){var l,h,g,i,j,m,k;l=document.createElement('canvas'),g=null;try{g=l.getContext('experimental-webgl'),g===null&&(g=l.getContext('webgl'))}catch(a){}return g!=null&&(m=g.getExtension('OES_texture_float'),m===null?d(g,g.FLOAT)?(k=!0,a.push('OES_texture_float'),c.OES_texture_float={shim:!0}):(k=!1,b.push('OES_texture_float')):d(g,g.FLOAT)?(k=!0,a.push('OES_texture_float')):(k=!1,b.push('OES_texture_float')),k&&(h=g.getExtension('WEBGL_color_buffer_float'),h===null?e(g,g.FLOAT)?(a.push('WEBGL_color_buffer_float'),c.WEBGL_color_buffer_float={shim:!0,RGBA32F_EXT:34836,RGB32F_EXT:34837,FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT:33297,UNSIGNED_NORMALIZED_EXT:35863}):b.push('WEBGL_color_buffer_float'):e(g,g.FLOAT)?a.push('WEBGL_color_buffer_float'):b.push('WEBGL_color_buffer_float'),h=g.getExtension('OES_texture_float_linear'),h===null?f(g,g.FLOAT)?(a.push('OES_texture_float_linear'),c.OES_texture_float_linear={shim:!0}):b.push('OES_texture_float_linear'):f(g,g.FLOAT)?a.push('OES_texture_float_linear'):b.push('OES_texture_float_linear')),i=g.getExtension('OES_texture_half_float'),i===null?d(g,36193)?(j=!0,a.push('OES_texture_half_float'),i=c.OES_texture_half_float={HALF_FLOAT_OES:36193,shim:!0}):(j=!1,b.push('OES_texture_half_float')):d(g,i.HALF_FLOAT_OES)?(j=!0,a.push('OES_texture_half_float')):(j=!1,b.push('OES_texture_half_float')),j)?(h=g.getExtension('EXT_color_buffer_half_float'),h===null?e(g,i.HALF_FLOAT_OES)?(a.push('EXT_color_buffer_half_float'),c.EXT_color_buffer_half_float={shim:!0,RGBA16F_EXT:34842,RGB16F_EXT:34843,FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT:33297,UNSIGNED_NORMALIZED_EXT:35863}):b.push('EXT_color_buffer_half_float'):e(g,i.HALF_FLOAT_OES)?a.push('EXT_color_buffer_half_float'):b.push('EXT_color_buffer_half_float'),h=g.getExtension('OES_texture_half_float_linear'),h===null?f(g,i.HALF_FLOAT_OES)?(a.push('OES_texture_half_float_linear'),c.OES_texture_half_float_linear={shim:!0}):b.push('OES_texture_half_float_linear'):f(g,i.HALF_FLOAT_OES)?a.push('OES_texture_half_float_linear'):b.push('OES_texture_half_float_linear')):void 0},window.WebGLRenderingContext!=null){for(l(),h={},i=0,n=b.length;i<n;i++)g=b[i],h[g]=!0;return m=WebGLRenderingContext.prototype.getExtension,WebGLRenderingContext.prototype.getExtension=function(a){var b;return b=c[a],b===void 0?h[a]?null:m.call(this,a):b},k=WebGLRenderingContext.prototype.getSupportedExtensions,WebGLRenderingContext.prototype.getSupportedExtensions=function(){var b,c,f,d,e,g,i;for(f=k.call(this),c=[],d=0,g=f.length;d<g;d++)b=f[d],h[b]===void 0&&c.push(b);for(e=0,i=a.length;e<i;e++)b=a[e],__indexOf.call(c,b)<0&&c.push(b);return c},WebGLRenderingContext.prototype.getFloatExtension=function(b){var c,d,l,B,t,e,f,r,s,a,k,z,u,q,n,h,i,j,v,w,x,y,o,A,p,m;for(b.prefer==null&&(b.prefer=['half']),b.require==null&&(b.require=[]),b.throws==null&&(b.throws=!0),q=this.getExtension('OES_texture_float'),e=this.getExtension('OES_texture_half_float'),z=this.getExtension('WEBGL_color_buffer_float'),B=this.getExtension('EXT_color_buffer_half_float'),u=this.getExtension('OES_texture_float_linear'),t=this.getExtension('OES_texture_half_float_linear'),k={texture:q!==null,filterable:u!==null,renderable:z!==null,score:0,precision:'single',half:!1,single:!0,type:this.FLOAT},l={texture:e!==null,filterable:t!==null,renderable:B!==null,score:0,precision:'half',half:!0,single:!1,type:(A=e!=null?e.HALF_FLOAT_OES:void 0)!=null?A:null},d=[],k.texture&&d.push(k),l.texture&&d.push(l),a=[],h=0,v=d.length;h<v;h++){for(c=d[h],n=!0,p=b.require,i=0,w=p.length;i<w;i++)g=p[i],c[g]===!1&&(n=!1);n&&a.push(c)}for(j=0,x=a.length;j<x;j++)for(c=a[j],m=b.prefer,f=o=0,y=m.length;o<y;f=++o)s=m[f],r=Math.pow(2,b.prefer.length-f-1),c[s]&&(c.score+=r);if(a.sort(function(a,b){return a.score===b.score?0:a.score<b.score?1:a.score>b.score?-1:void 0}),a.length===0)if(b.throws)throw'No floating point texture support that is '+b.require.join(', ');else return null;else return a=a[0],{filterable:a.filterable,renderable:a.renderable,type:a.type,precision:a.precision}}}},c(),i(),f=function(){function c(o){var r,l,q,i,c,f,h,m,p,e,d,n;d=o!=null?o:{},this.canvas=d.canvas,this.width=d.width,this.height=d.height,h=d.intensityToAlpha,c=d.gradientTexture,l=d.alphaRange,this.canvas||(this.canvas=document.createElement('canvas'));try{if(this.gl=this.canvas.getContext('experimental-webgl',{depth:!1,antialias:!1}),this.gl===null&&(this.gl=this.canvas.getContext('webgl',{depth:!1,antialias:!1}),this.gl===null))throw'WebGL not supported'}catch(a){throw'WebGL not supported'}window.WebGLDebugUtils!=null&&(console.log('debugging mode'),this.gl=WebGLDebugUtils.makeDebugContext(this.gl,function(a,b,c){throw WebGLDebugUtils.glEnumToString(a)+' was caused by call to: '+b})),this.gl.enableVertexAttribArray(0),this.gl.blendFunc(this.gl.ONE,this.gl.ONE),c?(e=this.gradientTexture=new k(this.gl,{channels:'rgba'}).bind(0).setSize(2,2).nearest().clampToEdge(),typeof c==='string'?(f=new Image,f.onload=function(){return e.bind().upload(f)},f.src=c):c.width>0&&c.height>0?e.upload(c):c.onload=function(){return e.upload(c)},i='uniform sampler2D gradientTexture;\nvec3 getColor(float intensity){\n return texture2D(gradientTexture, vec2(intensity, 0.0)).rgb;\n}'):(e=null,i='vec3 getColor(float intensity){\n vec3 blue = vec3(0.0, 0.0, 1.0);\n vec3 cyan = vec3(0.0, 1.0, 1.0);\n vec3 green = vec3(0.0, 1.0, 0.0);\n vec3 yellow = vec3(1.0, 1.0, 0.0);\n vec3 red = vec3(1.0, 0.0, 0.0);\n\n vec3 color = (\n fade(-0.25, 0.25, intensity)*blue +\n fade(0.0, 0.5, intensity)*cyan +\n fade(0.25, 0.75, intensity)*green +\n fade(0.5, 1.0, intensity)*yellow +\n smoothstep(0.75, 1.0, intensity)*red\n );\n return color;\n}'),h==null&&(h=!0),h?(n=l!=null?l:[0,1],q=n[0],r=n[1],m='vec4 alphaFun(vec3 color, float intensity){\n float alpha = smoothstep('+q.toFixed(8)+', '+r.toFixed(8)+', intensity);\n return vec4(color*alpha, alpha);\n}'):m='vec4 alphaFun(vec3 color, float intensity){\n return vec4(color, 1.0);\n}',this.shader=new b(this.gl,{vertex:j,fragment:g+('float linstep(float low, float high, float value){\n return clamp((value-low)/(high-low), 0.0, 1.0);\n}\n\nfloat fade(float low, float high, float value){\n float mid = (low+high)*0.5;\n float range = (high-low)*0.5;\n float x = 1.0 - clamp(abs(mid-value)/range, 0.0, 1.0);\n return smoothstep(0.0, 1.0, x);\n}\n\n'+i+'\n'+m+'\n\nvoid main(){\n float intensity = smoothstep(0.0, 1.0, texture2D(source, texcoord).r);\n vec3 color = getColor(intensity);\n gl_FragColor = alphaFun(color, intensity);\n}')}),this.width==null&&(this.width=this.canvas.offsetWidth||2),this.height==null&&(this.height=this.canvas.offsetHeight||2),this.canvas.width=this.width,this.canvas.height=this.height,this.gl.viewport(0,0,this.width,this.height),this.quad=this.gl.createBuffer(),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.quad),p=new Float32Array([-1,-1,0,1,1,-1,0,1,-1,1,0,1,-1,1,0,1,1,-1,0,1,1,1,0,1]),this.gl.bufferData(this.gl.ARRAY_BUFFER,p,this.gl.STATIC_DRAW),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,null),this.heights=new a(this,this.gl,this.width,this.height)}return c.prototype.adjustSize=function(){var a,b;return b=this.canvas.offsetWidth||2,a=this.canvas.offsetHeight||2,this.width!==b||this.height!==a?(this.gl.viewport(0,0,b,a),this.canvas.width=b,this.canvas.height=a,this.width=b,this.height=a,this.heights.resize(this.width,this.height)):void 0},c.prototype.display=function(){return this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.quad),this.gl.vertexAttribPointer(0,4,this.gl.FLOAT,!1,0,0),this.heights.nodeFront.bind(0),this.gradientTexture&&this.gradientTexture.bind(1),this.shader.use().int('source',0).int('gradientTexture',1),this.gl.drawArrays(this.gl.TRIANGLES,0,6)},c.prototype.update=function(){return this.heights.update()},c.prototype.clear=function(){return this.heights.clear()},c.prototype.clamp=function(a,b){return a==null&&(a=0),b==null&&(b=1),this.heights.clamp(a,b)},c.prototype.multiply=function(a){return a==null&&(a=.95),this.heights.multiply(a)},c.prototype.blur=function(){return this.heights.blur()},c.prototype.addPoint=function(a,b,c,d){return this.heights.addPoint(a,b,c,d)},c.prototype.addPoints=function(d){var a,b,e,c;for(c=[],b=0,e=d.length;b<e;b++)a=d[b],c.push(this.addPoint(a.x,a.y,a.size,a.intensity));return c},c}(),e.options={intensity:.2,lat:l.getLat,lng:l.getLng,size:function(){return 3},quality:1,container:'tilePane',clearPhi:0},e=m.extend(e,{addTo:function(a){if(!a)return;this._map=a,this.transfer=a.latLngToContainerPoint.bind(a),this.initialize()},initialize:function(){var g=this.options,b=g.container,c;if(typeof b==='string'){var d,e,i=this._map.getPanes();b=i[b]}else b=l.getContainer(b);var h=this._map.getSize(),d=h.x,e=h.y,c=g.quality,a=document.createElement('<canvas width="'+d*c+'" height="'+e*c+'"><canvas>');a.style.position='absolute',a.style.left='0',a.style.top='0',a.style.pointerEvents='none',a.style.width=d+'px',a.style.height=e+'px',b.appendChild(a),this.heatmap=new f({canvas:a}),this.initEvents()},data:function(a){this._data=a},render:function(c){c&&this.data(c);var a=this.options,i=this.transfer,b=this.heatmap;b.multiply(a.clearPhi);var o=a.intensity,g=a.lat,h=a.lng,f=a.size;c=this._data;var j=this._map.getZoom(),d,l,m,e,p;for(var k in c)d=c[k],l=g(d),m=h(d),latlng=n.latLng(l,m),e=i(latlng),p=f(d,j),b.addPoint(e.x,e.y,p,o);b.update(),b.display()},resetPos:function(){var b=this.canvas[0],a=n.DomUtil.getPosition(this._map.getPanes().mapPane);a&&n.DomUtil.setPosition(b,{x:-a.x,y:-a.y})},clean:function(){var a=this.heatmap;a.multiply(0),a.update(),a.display()},initEvents:function(){var a=this,b=this.heatmap;this._map.on('moveend',function(){a.resetPos(),a.render()}).on('zoomstart',function(){a.clean()})}}),n=n||{},n.dmap=n.dmap||{},n.dmap.webGLHeatmap=function(a){return new e(a)},module.exports=e

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

"description": "2d map visualization lib",
"version": "0.0.77",
"version": "0.0.78",
"scripts": {

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

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

function a(c,d,b){b=this.options=e.deepMerge(a.options,b),this.map=c,this.init(d,b),this.styles(b),this.onDefaults()}var b=require('leaflet'),c=require('jquery'),d=b.dmap=b.dmap||{},e=require('bcore/utils'),f=window.requestAnimationFrame||window.mozRequestAnimationFrame||function(a){return window.setTimeout(a,16.666666666666668)},g=window.cancelAnimationFrame||window.cancelRequestAnimationFrame||window.mozCancelAnimationFrame||function(a){window.clearTimeout(a)};a.options={clearAlpha:1},a.prototype.init=function(a,d){var g=this.map;if(typeof a==='string'){var h=g.getPanes();if(h[a]){a=h[a];var i=g.getSize();d.width=i.x,d.height=i.y,this.isMapPane=1}}a=c(a);var f=this.w=d.width||a.width(),j=this.h=d.height||a.height(),b;if(a.is('div')){var e=this.quality=d.quality||2;b=c('<canvas width="'+f*e+'" height="'+j*e+'"><canvas>').css({position:'absolute',left:'0',top:'0',pointerEvents:'none',width:f+'px',height:j+'px'}),a.append(b),b=this.canvas=b[0];var l=this.ctx=b.getContext('2d');l.scale(e,e)}a.is('canvas')&&(b=this.canvas=a[0],this.ctx=b.getContext('2d'));var k=this.canvasTmp=c('<canvas width="'+b.width+'" height="'+b.height+'"><canvas>')[0];this.ctxTmp=k.getContext('2d')},a.prototype.styles=function(b){b=b||{};var d=b.lighter,a=this.ctx;d&&a&&(a.globalCompositeOperation='lighter');var c=b.opacity;c!==undefined&&c!==null&&a&&(a.globalAlpha=c)},a.prototype.onDefaults=function(){var b=this,c=this.clear.bind(this),a=this.resetPos.bind(this);this.map.on('zoomstart',function(){b.clear(1)}).on('zoomend',a).on('movestart',function(){}).on('resize',function(){c(1),a()}).on('moveend',a)},a.prototype.bind=function(a,b){this[a]&&this.map.off(a,this[a].bind(this)),this[a]=b,this.map.on(a,b.bind(this))},a.prototype.onZoomstart=function(a){this.bind('zoomstart',a)},a.prototype.onMovestart=function(a){this.bind('movestart',a)},a.prototype.onMoveend=function(a){this.bind('moveend',a)},a.prototype.onZoomend=function(a){this.bind('zoomend',a)},a.prototype.onUpdate=function(a){this.bind('moveend',a),this.bind('resize',a)},a.prototype.resetPos=function(){var c=this.canvas;if(this.isMapPane){var a=b.DomUtil.getPosition(this.map.getPanes().mapPane);a&&b.DomUtil.setPosition(c,{x:-a.x,y:-a.y})}this.clear(1)},a.prototype.clear=function(b){if((b===undefined||b===null)&&(b=this.options.clearAlpha),b===1)return this.ctx.clearRect(0,0,this.w,this.h);var e=this.canvasTmp,c=this.ctxTmp,a=this.canvas,d=this.ctx;c.globalAlpha=b,c.drawImage(a,0,0,this.w,this.h),d.clearRect(0,0,a.width,a.height),d.drawImage(e,0,0,a.width,a.height),c.clearRect(0,0,this.w,this.h)},a.prototype.destroy=function(){this.canvas.remove()},a.prototype.pt=function(c,d,e,b,a){a=a||b,this.ctx.drawImage(c,d-b/2,e-a/2,b,a)},a.prototype.test=function(a){this.ctx.fillStyle='#900',this.ctx.fillRect(20,202,333+Math.random()*100,33),this.ctx.fillRect(24,223,33,333)},d.Canvas=a,d.canvas=function(b,c,d){return new a(b,c,d)},module.exports=a
function a(c,d,b){b=this.options=e.deepMerge(a.options,b),this.map=c,this.init(d,b),this.styles(b),this.onDefaults()}var b=require('./../leaflet'),c=require('jquery'),d=b.dmap=b.dmap||{},e=require('bcore/utils'),f=window.requestAnimationFrame||window.mozRequestAnimationFrame||function(a){return window.setTimeout(a,16.666666666666668)},g=window.cancelAnimationFrame||window.cancelRequestAnimationFrame||window.mozCancelAnimationFrame||function(a){window.clearTimeout(a)};a.options={clearAlpha:1},a.prototype.init=function(a,d){var g=this.map;if(typeof a==='string'){var h=g.getPanes();if(h[a]){a=h[a];var i=g.getSize();d.width=i.x,d.height=i.y,this.isMapPane=1}}a=c(a);var f=this.w=d.width||a.width(),j=this.h=d.height||a.height(),b;if(a.is('div')){var e=this.quality=d.quality||2;b=c('<canvas width="'+f*e+'" height="'+j*e+'"><canvas>').css({position:'absolute',left:'0',top:'0',pointerEvents:'none',width:f+'px',height:j+'px'}),a.append(b),b=this.canvas=b[0];var l=this.ctx=b.getContext('2d');l.scale(e,e)}a.is('canvas')&&(b=this.canvas=a[0],this.ctx=b.getContext('2d'));var k=this.canvasTmp=c('<canvas width="'+b.width+'" height="'+b.height+'"><canvas>')[0];this.ctxTmp=k.getContext('2d')},a.prototype.styles=function(b){b=b||{};var d=b.lighter,a=this.ctx;d&&a&&(a.globalCompositeOperation='lighter');var c=b.opacity;c!==undefined&&c!==null&&a&&(a.globalAlpha=c)},a.prototype.onDefaults=function(){var b=this,c=this.clear.bind(this),a=this.resetPos.bind(this);this.map.on('zoomstart',function(){b.clear(1)}).on('zoomend',a).on('movestart',function(){}).on('resize',function(){c(1),a()}).on('moveend',a)},a.prototype.bind=function(a,b){this[a]&&this.map.off(a,this[a].bind(this)),this[a]=b,this.map.on(a,b.bind(this))},a.prototype.onZoomstart=function(a){this.bind('zoomstart',a)},a.prototype.onMovestart=function(a){this.bind('movestart',a)},a.prototype.onMoveend=function(a){this.bind('moveend',a)},a.prototype.onZoomend=function(a){this.bind('zoomend',a)},a.prototype.onUpdate=function(a){this.bind('moveend',a),this.bind('resize',a)},a.prototype.resetPos=function(){var c=this.canvas;if(this.isMapPane){var a=b.DomUtil.getPosition(this.map.getPanes().mapPane);a&&b.DomUtil.setPosition(c,{x:-a.x,y:-a.y})}this.clear(1)},a.prototype.clear=function(b){if((b===undefined||b===null)&&(b=this.options.clearAlpha),b===1)return this.ctx.clearRect(0,0,this.w,this.h);var e=this.canvasTmp,c=this.ctxTmp,a=this.canvas,d=this.ctx;c.globalAlpha=b,c.drawImage(a,0,0,this.w,this.h),d.clearRect(0,0,a.width,a.height),d.drawImage(e,0,0,a.width,a.height),c.clearRect(0,0,this.w,this.h)},a.prototype.destroy=function(){this.canvas.remove()},a.prototype.pt=function(c,d,e,b,a){a=a||b,this.ctx.drawImage(c,d-b/2,e-a/2,b,a)},a.prototype.test=function(a){this.ctx.fillStyle='#900',this.ctx.fillRect(20,202,333+Math.random()*100,33),this.ctx.fillRect(24,223,33,333)},d.Canvas=a,d.canvas=function(b,c,d){return new a(b,c,d)},module.exports=a

Sorry, the diff of this file is not supported yet

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