Comparing version 0.0.56 to 0.0.57
@@ -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('bcore/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.initEvents(),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,c=a.popup,d=this.genStyle(a.style),e=this.geojson,f=a.geoid.bind(a),g=this.layers=[],h=this.geojsonLayer=b.geoJson(e,{style:d,onEachFeature:function(a,b){var d=f(a);g[d]=b;var e=c(a,null);c&&b.bindPopup(e)}});h.addTo(this._map)},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]=e(d[c],e,f,g,h);return b},initEvents:function(){},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),f(b))continue;f(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()},draw:function(){var c=this._data,a=this.options,i=a.style,l=a.id.bind(a),f=a.value.bind(a),b,h,d,j,k=this.layers,e=this.range;for(var g in c)b=c[g],j=f(b),h=l(b),d=k[h],d&&d.setStyle(this.genStyle(i,j,e[0],e[1]))},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.properties.name}};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('bcore/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.initEvents(),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,c=a.popup,d=this.genStyle(a.style),e=this.geojson,f=a.geoid.bind(a),g=this.layers=[],h=this.geojsonLayer=b.geoJson(e,{style:d,onEachFeature:function(a,b){var d=f(a);g[d]=b;var e=c(a,null);c&&b.bindPopup(e)}});h.addTo(this._map)},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},initEvents:function(){},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()},draw:function(){var c=this._data,a=this.options,i=a.style,l=a.id.bind(a),f=a.value.bind(a),b,h,d,j,k=this.layers,e=this.range;for(var g in c)b=c[g],j=f(b),h=l(b),d=k[h],d&&d.setStyle(this.genStyle(i,j,e[0],e[1]))},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.properties.name}};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('./../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 a([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=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 |
@@ -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=h.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=b(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},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()},data:function(b){if(!b)return this._data;this._data=b;var a=this.options;a.isAutoUpdate&&this._map&&this.updateZoom(),this.updateColor();var c=a.shape},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(){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;a.shape(c),a.rx(d),a.ry(e),a.update(),this.aggregate(),this.draw()},updateColor:function(d,h,i,j){if(!d)return;var e=this.getColor=i.getColorFunc(d,h,i,j),a=this.gridMap,b,f;for(var g in a)b=a[g],f=b._value,b.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()},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 m=this.options,w=this.gridEncoder,h=m.shape.style,t=this.getColor,v=m.value,g=this.aggregatedData,i=this.gridMap,s=this._map,c=this.getBounds(),d,q=c.latMax,n=c.latMin,o=c.lngMax,p=c.lngMin;for(var a in g){var r=g[a],j=w.decode(a),k=j.center,u=j.pts,l=k[0],f=k[1];if(l<n||f<p||l>q||f>o)continue;var e=v(r);if(!i[a]){if(h.fillColor=t(e),d=i[a]=b.polygon(u,h).addTo(s),d._value=e,d._gridid=a,this.initEventsGrid(d),!this.scaleGridFunc)continue;this.scaleGridFunc(d,e)}}},initEventsGrid:function(a){var b=this,i=this.aggregatedData,d=this.options.shape,e=d.click||{},f=d.mouseover||{},g=d.mouseout||{},h=a._gridid,c={gridid:h,data:i[h],layer:a};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)})}});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},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()},data:function(b){if(!b)return this._data;this._data=b;var a=this.options;a.isAutoUpdate&&this._map&&this.updateZoom(),this.updateColor();var c=a.shape},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(){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;a.shape(c),a.rx(d),a.ry(e),a.update(),this.aggregate(),this.draw()},updateColor:function(d,h,i,j){if(!d)return;var e=this.getColor=c.getColorFunc(d,h,i,j),a=this.gridMap,b,f;for(var g in a)b=a[g],f=b._value,b.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()},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 m=this.options,w=this.gridEncoder,h=m.shape.style,t=this.getColor,v=m.value,g=this.aggregatedData,i=this.gridMap,s=this._map,c=this.getBounds(),d,q=c.latMax,n=c.latMin,o=c.lngMax,p=c.lngMin;for(var a in g){var r=g[a],j=w.decode(a),k=j.center,u=j.pts,l=k[0],f=k[1];if(l<n||f<p||l>q||f>o)continue;var e=v(r);if(!i[a]){if(h.fillColor=t(e),d=i[a]=b.polygon(u,h).addTo(s),d._value=e,d._gridid=a,this.initEventsGrid(d),!this.scaleGridFunc)continue;this.scaleGridFunc(d,e)}}},initEventsGrid:function(a){var b=this,i=this.aggregatedData,d=this.options.shape,e=d.click||{},f=d.mouseover||{},g=d.mouseout||{},h=a._gridid,c={gridid:h,data:i[h],layer:a};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)})}});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=h.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){b.Marker.prototype.initialize.call(this,b?b._cLatLng||b.getLatLng():new b.LatLng(0,0),{icon:this}),this._group=d,this._zoom=e,this._markers=[],this._childClusters=[],this._childCount=0,this._iconNeedsUpdate=!0,this._bounds=new b.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=d.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(b){b=this.options=f.deepMerge(a.options,b),this.initialize(b),b.child.id=b.child.id||b.id,b.child.text=b.child.text||b.text,b.child.lat=b.child.lat||b.lat,b.child.lng=b.child.lng||b.lng,b.child.range=b.child.range||b.range,b.child.value=b.child.value||b.value,b.child.css=b.child.css||b.css}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){},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 b=this.options,w=b.child,a,i,u,v,e,c,n=this.isInZoom(),o=this._map.getZoom(),p=b.id,q=b.lat,r=b.lng,s=b.filter,g=b.groups,k,h,l=this.cache,m=this.isable;for(var f in y){if(a=y[f],b.processing&&b.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 c=e.visual;c?c.updateData(a):m&&(c=e.visual=new a(w),c.addTo(j),c.render(a),this.initEventsScatter(c))}}this.updateRange()},render:function(a){if(!a)return;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},updateMap: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.options.child,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 b(s),a.addTo(r),a.render(b),this.initEventsScatter(a)):a&&(a.off&&a.off(),a.destroy&&a.destroy(),delete e.visual)},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(){}}),e.ScatterMarkers=a,e.scatterMarkers=function(b){return new a(b)},module.exports=a | ||
function a(b){b=this.options=f.deepMerge(a.options,b),this.initialize(b),b.child.id=b.child.id||b.id,b.child.text=b.child.text||b.text,b.child.lat=b.child.lat||b.lat,b.child.lng=b.child.lng||b.lng,b.child.range=b.child.range||b.range,b.child.value=b.child.value||b.value,b.child.css=b.child.css||b.css}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){},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 b=this.options,w=b.child,a,i,u,v,e,c,n=this.isInZoom(),o=this._map.getZoom(),p=b.id,q=b.lat,r=b.lng,s=b.filter,g=b.groups,k,h,l=this.cache,m=this.isable;for(var f in y){if(a=y[f],b.processing&&b.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 c=e.visual;c?c.updateData(a):m&&(c=e.visual=new d(w),c.addTo(j),c.render(a),this.initEventsScatter(c))}}this.updateRange()},render:function(a){if(!a)return;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},updateMap: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.options.child,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)},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(){}}),e.ScatterMarkers=a,e.scatterMarkers=function(b){return new a(b)},module.exports=a |
@@ -1,1 +0,1 @@ | ||
function a(a){this.initialize(a)}var b=require('bcore/event'),c=require('./../core/utils'),d=require('./../render/leaflet_layer_konva'),e=require('konva'),f=require('./../leaflet'),g=require('lodash'),h=c.fireEvent,i=c.getValue;a.options={ptNPerLayer:2e3,lazyFresh:{transition:'opacity 0.4s'},blending:'lighter',lng:c.getLng,lat:c.getLat,id:function(a,b){return a.id||b},radius:10,angle:10,rotation:0,stroke:'transparent',strokeWidth:0,fill:'rgba(0,190,190,0.2)',hoverScale:1.2,zIndex:function(a){return-a.value}},a=b.extend(a,{addTo:function(a){this._map=a,this.initCanvas(),this.initEventsMap(),this.initEventsShapes()},initialize:function(b){b=this.options=c.deepMerge(a.options,b),this.resetVariables()},resetVariables:function(){this.isable=!0},disable:function(){this.isable=!1,this.kLeafLayer.disable()},enable:function(){this.isable=!0,this.kLeafLayer.enable()},initCanvas:function(){var b=this._map,a=this.options,c=b.getSize(),f=new e.Stage({container:a.container,width:c.x,height:c.y}),g=this.kLeafLayer=new d(f,{transition:a.lazyFresh.transition,blending:a.blending,ptNPerLayer:a.ptNPerLayer});g.addTo(b)},data:function(c){this._data=c;var a=this.options,b=a.zIndex||a.child.zIndex;b&&(this._data=g.sortBy(c,b))},createShapeAttr:function(b,g){if(!this.isable)return;var a=this.options,c=this._map.getZoom(),h=g(a.lat,b),j=g(a.lng,b),k=g(a.id.bind(a),b,g),l=g(a.radius,b,c)||1,m=g(a.angle,b,c)||1,n=g(a.rotation,b,c),o=g(a.fill,b,c),p=g(a.stroke,b,c),q=g(a.strokeWidth,b,c),d=this._map.latLngToContainerPoint(f.latLng(h,j));return{data:b,Constructor:e.Wedge,index:g,id:k,attrs:{x:d.x,y:d.y,radius:l,rotation:n,angle:m,stroke:p,strokeWidth:q,fill:o}}},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()},render:function(a){a&&this.data(a),this.draw()},initEventsMap:function(){this._map.on('zoomend',this.draw.bind(this)).on('moveend',this.draw.bind(this))},onMouseDown:function(g){var b=this.options,c=this._map,d=g.target,e=d.__data,a=b.popup;if(a&&(a=a.bind(b)),a||(a=b.child.popup,a&&(a=a.bind(b.child))),!a)return;popupText=a(e),setTimeout(function(){var a=e.getClientRect(),d=a.x+a.width/2,g=a.y+a.height/2,b=c.containerPointToLatLng(f.point(d,g));c.openPopup(popupText,f.latLng(b.lat,b.lng))}.bind(this)),this.kLeafLayer.disableMapEvents()},initEventsShapes:function(){var d=this,b=this.options.hoverScale||1,a,c=this.kLeafLayer.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)})})}}),module.exports=a | ||
function a(a){this.initialize(a)}var b=require('bcore/event'),c=require('./../core/utils'),d=require('./../render/leaflet_layer_konva'),e=require('konva'),f=require('./../leaflet'),g=require('lodash'),h=c.fireEvent,i=c.getValue;a.options={ptNPerLayer:2e3,lazyFresh:{transition:'opacity 0.4s'},blending:'lighter',lng:c.getLng,lat:c.getLat,id:function(a,b){return a.id||b},radius:10,angle:10,rotation:0,stroke:'transparent',strokeWidth:0,fill:'rgba(0,190,190,0.2)',hoverScale:1.2,zIndex:function(a){return-a.value}},a=b.extend(a,{addTo:function(a){this._map=a,this.initCanvas(),this.initEventsMap(),this.initEventsShapes()},initialize:function(b){b=this.options=c.deepMerge(a.options,b),this.resetVariables()},resetVariables:function(){this.isable=!0},disable:function(){this.isable=!1,this.kLeafLayer.disable()},enable:function(){this.isable=!0,this.kLeafLayer.enable()},initCanvas:function(){var b=this._map,a=this.options,c=b.getSize(),f=new e.Stage({container:a.container,width:c.x,height:c.y}),g=this.kLeafLayer=new d(f,{transition:a.lazyFresh.transition,blending:a.blending,ptNPerLayer:a.ptNPerLayer});g.addTo(b)},data:function(c){this._data=c;var a=this.options,b=a.zIndex||a.child.zIndex;b&&(this._data=g.sortBy(c,b))},createShapeAttr:function(b,g){if(!this.isable)return;var a=this.options,c=this._map.getZoom(),h=i(a.lat,b),j=i(a.lng,b),k=i(a.id.bind(a),b,g),l=i(a.radius,b,c)||1,m=i(a.angle,b,c)||1,n=i(a.rotation,b,c),o=i(a.fill,b,c),p=i(a.stroke,b,c),q=i(a.strokeWidth,b,c),d=this._map.latLngToContainerPoint(f.latLng(h,j));return{data:b,Constructor:e.Wedge,index:g,id:k,attrs:{x:d.x,y:d.y,radius:l,rotation:n,angle:m,stroke:p,strokeWidth:q,fill:o}}},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()},render:function(a){a&&this.data(a),this.draw()},initEventsMap:function(){this._map.on('zoomend',this.draw.bind(this)).on('moveend',this.draw.bind(this))},onMouseDown:function(g){var b=this.options,c=this._map,d=g.target,e=d.__data,a=b.popup;if(a&&(a=a.bind(b)),a||(a=b.child.popup,a&&(a=a.bind(b.child))),!a)return;popupText=a(e),setTimeout(function(){var a=e.getClientRect(),d=a.x+a.width/2,g=a.y+a.height/2,b=c.containerPointToLatLng(f.point(d,g));c.openPopup(popupText,f.latLng(b.lat,b.lng))}.bind(this)),this.kLeafLayer.disableMapEvents()},initEventsShapes:function(){var d=this,b=this.options.hoverScale||1,a,c=this.kLeafLayer.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)})})}}),module.exports=a |
@@ -1,1 +0,1 @@ | ||
'use strict';function b(a,b){return a.length<b?a:a.substring(0,b)}function h(a,b){this.initialize(a,b)}var c=require('./../libs/event'),d=require('./../core/utils'),e=d.prevent,f=d.getPt,g=require('jquery'),a=require('./parser'),i=require('./node'),j=require('./sub_node');require('./gui.css');var k=require('./link_ui_global'),l=require('./link'),m=require('./link_process'),n=require('./panel_link'),o=g('body');c.extend(h,{options:{},initialize:function(b,c){this.options=d.deepMerge(this.options,c),this.container=b||o,this.initDom(),this.parser=a(),this.linkProcess=new m,this.panelLink=new n(this.visualerContainer,{}),this.initEvents()},initEvents:function(){this.initEventsDrag(),this.on('link-processing',function(a){this.linkProcess.process(a)})},parseData:function(b){var a,c;for(a in b){c=b[a];break}this.renderDataColumn({key:a,values:c})},parse:function(b){this.linkProcess.linkTo(b);var a=this.parser.parse(b);this.renderDataFormatedColumn(a.data2format),this.renderShapeColumn(a.shapes)},initDom:function(){var a=this.visualerContainer=g(' <div class="component-visualer"> <div class="data-column column"> <div class="header">原始数据</div> <div class="nodes"> <div class="data-group"></div> </div> </div> <div class="formated-column column"> <div class="header">标准化数据</div> <div class="nodes"></div> </div> <div class="shape-column column"> <div class="header">图形</div> <div class="nodes"></div> </div> </div>').appendTo(this.container);this.dataColumn=a.find('.data-group'),this.formatedColumn=a.find('.formated-column').find('.nodes'),this.shapeColumn=a.find('.shape-column').find('.nodes'),setTimeout(this.initSvg.bind(this))},initSvg:function(){var b=this.visualerContainer,a=this.svg=document.createElementNS('http://www.w3.org/2000/svg','svg');a.setAttribute('width',b.width()),a.setAttribute('height',b.height()),a.style.position='absolute',a.style.left='0',a.style.top='0',a.style.width='100%',a.style.height='100%',a.style.zIndex=1,a.style.pointerEvents='none',b[0].appendChild(a)},renderDataColumn:function(a){var h=a.key,g,c=a.values,d=this.dataColumn,e=this.visualerContainer,k=new f(d,{type:'data',text:a.key,mainContainer:e});for(var f in c)g=c[f],new j(d,{type:'data',text:f+': '+b(g.toString(),7),mainContainer:e})},renderDataFormatedColumn:function(b){var c=this.formatedColumn,d=this.visualerContainer;for(var a in b){var e=b[a];new i(c,{type:'data-formated',text:a,mainContainer:d})}},renderShapeColumn:function(b){var c=this.visualerContainer,d=this.shapeColumn;for(var a in b){var e=b[a];new i(d,{type:'shape',text:a,mainContainer:c})}},initEventsLink:function(b){if(!b)return console.log('没有link');var a=this.panelLink;b.on('link-end',function(){a.clear(),a.in()})},initEventsDrag:function(){var a=this,d=!1;this.isLinking=!1;var c,h,i,b;window.linkUIGlobal&&k.on('node-action',function(b){a.isLinking||(a.isLinking=!0,i=b)}).on('node-over',function(c){a.isLinking&&(b=c)}).on('node-leave',function(a){b===a&&(b=null)});var e=this.visualerContainer;e.on('mousedown touchstart',function(b){b.target===g(this)[0]&&window.linkUIGlobal&&k.trigger('panel_com_tap'),h=a.ptS=f(b,e),d=!0,c=new l(a.svg,{x:h[0],y:h[1]}),a.initEventsLink(c)}).on('mousemove touchmove',function(g){if(!d)return;if(a.isLinking){a.emit('add-link'),a.isLinking=!0;var b=f(g,e);c.update(b[0],b[1])}}).on('mouseup touchend',function(e){d=!1,a.isLinking=!1,b?(a.emit('link-processing',{from:i,to:b,link:c}),c.end(b)):c.break(),i=null,b=null})}}),module.exports=h | ||
'use strict';function b(a,b){return a.length<b?a:a.substring(0,b)}function h(a,b){this.initialize(a,b)}var c=require('./../libs/event'),d=require('./../core/utils'),e=d.prevent,f=d.getPt,g=require('jquery'),a=require('./parser'),i=require('./node'),j=require('./sub_node');require('./gui.css');var k=require('./link_ui_global'),l=require('./link'),m=require('./link_process'),n=require('./panel_link'),o=g('body');c.extend(h,{options:{},initialize:function(b,c){this.options=d.deepMerge(this.options,c),this.container=b||o,this.initDom(),this.parser=a(),this.linkProcess=new m,this.panelLink=new n(this.visualerContainer,{}),this.initEvents()},initEvents:function(){this.initEventsDrag(),this.on('link-processing',function(a){this.linkProcess.process(a)})},parseData:function(b){var a,c;for(a in b){c=b[a];break}this.renderDataColumn({key:a,values:c})},parse:function(b){this.linkProcess.linkTo(b);var a=this.parser.parse(b);this.renderDataFormatedColumn(a.data2format),this.renderShapeColumn(a.shapes)},initDom:function(){var a=this.visualerContainer=g(' <div class="component-visualer"> <div class="data-column column"> <div class="header">原始数据</div> <div class="nodes"> <div class="data-group"></div> </div> </div> <div class="formated-column column"> <div class="header">标准化数据</div> <div class="nodes"></div> </div> <div class="shape-column column"> <div class="header">图形</div> <div class="nodes"></div> </div> </div>').appendTo(this.container);this.dataColumn=a.find('.data-group'),this.formatedColumn=a.find('.formated-column').find('.nodes'),this.shapeColumn=a.find('.shape-column').find('.nodes'),setTimeout(this.initSvg.bind(this))},initSvg:function(){var b=this.visualerContainer,a=this.svg=document.createElementNS('http://www.w3.org/2000/svg','svg');a.setAttribute('width',b.width()),a.setAttribute('height',b.height()),a.style.position='absolute',a.style.left='0',a.style.top='0',a.style.width='100%',a.style.height='100%',a.style.zIndex=1,a.style.pointerEvents='none',b[0].appendChild(a)},renderDataColumn:function(a){var h=a.key,g,c=a.values,d=this.dataColumn,e=this.visualerContainer,k=new i(d,{type:'data',text:a.key,mainContainer:e});for(var f in c)g=c[f],new j(d,{type:'data',text:f+': '+b(g.toString(),7),mainContainer:e})},renderDataFormatedColumn:function(b){var c=this.formatedColumn,d=this.visualerContainer;for(var a in b){var e=b[a];new i(c,{type:'data-formated',text:a,mainContainer:d})}},renderShapeColumn:function(b){var c=this.visualerContainer,d=this.shapeColumn;for(var a in b){var e=b[a];new i(d,{type:'shape',text:a,mainContainer:c})}},initEventsLink:function(b){if(!b)return console.log('没有link');var a=this.panelLink;b.on('link-end',function(){a.clear(),a.in()})},initEventsDrag:function(){var a=this,d=!1;this.isLinking=!1;var c,h,i,b;window.linkUIGlobal&&k.on('node-action',function(b){a.isLinking||(a.isLinking=!0,i=b)}).on('node-over',function(c){a.isLinking&&(b=c)}).on('node-leave',function(a){b===a&&(b=null)});var e=this.visualerContainer;e.on('mousedown touchstart',function(b){b.target===g(this)[0]&&window.linkUIGlobal&&k.trigger('panel_com_tap'),h=a.ptS=f(b,e),d=!0,c=new l(a.svg,{x:h[0],y:h[1]}),a.initEventsLink(c)}).on('mousemove touchmove',function(g){if(!d)return;if(a.isLinking){a.emit('add-link'),a.isLinking=!0;var b=f(g,e);c.update(b[0],b[1])}}).on('mouseup touchend',function(e){d=!1,a.isLinking=!1,b?(a.emit('link-processing',{from:i,to:b,link:c}),c.end(b)):c.break(),i=null,b=null})}}),module.exports=h |
{ | ||
"author": "zhouningyi <zny@918@126.com>", | ||
"author": "zhouningyi <ningyi.zny@alibaba-inc.com>", | ||
"name": "ldmap", | ||
"description": "2d map visualization lib", | ||
"version": "0.0.56", | ||
"version": "0.0.57", | ||
"scripts": { | ||
@@ -44,4 +44,5 @@ "test": "mocha -r jscoverage test" | ||
"moduleMap": { | ||
} | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
310153