Comparing version 0.0.66 to 0.0.67
@@ -1,1 +0,1 @@ | ||
function a(a,f,g){f=f||'#0cc',g=g||'#bbb';var c='',b,d,h='display:inline-block;white-space:nowrap;',j=h+'color:'+g+';margin-right:5px;',i=h+'color:'+f+';font-weight:normal';if(Array.isArray(a))a.forEach(function(a,d){typeof a=='string'&&(b='<a style="'+i+'">'+a+'</a><br>',c+=b)});else if(typeof a==='object')for(var e in a){var b=a[e];typeof b==='string'&&(d='<a style="'+j+'">'+e+': </a><a style="'+i+'">'+b+'</a><br>',c+=d)}return c}module.exports={parseContent:a} | ||
function a(a,f,g){f=f||'#0cc',g=g||'#bbb';var c='',b,d,h='display:inline-block;white-space:nowrap;',j=h+'color:'+g+';margin-right:5px;',i=h+'color:'+f+';font-weight:normal';if(Array.isArray(a))a.forEach(function(a,d){typeof a=='string'&&(b='<a style="'+i+'">'+a+'</a><br>',c+=b)});else if(typeof a==='object')for(var e in a){var b=a[e];typeof b==='string'&&(d='<a style="'+j+'">'+e+': </a><a style="'+i+'">'+b+'</a><br>',c+=d)}return c}function b(a){return typeof a[0]==='object'?!1:!0}function c(a){return a===undefined}function d(c,a){return a=a||{},c.forEach(function(f){if(b(f)){var c=f[0],e=f[1];a.latMax=Math.max(a.latMax||e,e),a.lngMax=Math.max(a.lngMax||c,c),a.latMin=Math.min(a.latMin||e,e),a.lngMin=Math.min(a.lngMin||c,c)}else d(f,a)}),a}function e(b){var a={};return b.forEach(function(e){var c=e.geometry.coordinates,b=d(c);a.latMax=Math.max(a.latMax||b.latMax,b.latMax),a.lngMax=Math.max(a.lngMax||b.lngMax,b.lngMax),a.latMin=Math.min(a.latMin||b.latMin,b.latMin),a.lngMin=Math.min(a.lngMin||b.lngMin,b.lngMin)}),a}function f(a){if(a.features)return e(a.features);if(a.type&&a.type.toLowerCase()==='feature'){var b=a.geometry;if(!b)return;var c=b.coordinates;return c?d(c):void 0}}function g(c,a){return a=a||[],c.forEach(function(c){if(b(c)){var e=c[0],d=c[1];(a[0]===undefined||a[0]===null)&&(a=c),d>a[1]&&(a[0]=c[0],a[1]=c[1])}else a=g(c,a)}),a}function h(b){var a=g(b.map(function(a){return g(a.geometry.coordinates)}));return a}function i(a){if(a.features)return h(a.features);if(a.type&&a.type.toLowerCase()==='feature'){var b=a.geometry;if(!b)return;var c=b.coordinates;return c?g(c):void 0}return g(a)}module.exports={parseContent:a,getTopPoint:i,getBBox:f} |
@@ -1,1 +0,1 @@ | ||
function b(c){var a=Math.floor(Math.random()*1e7),b=new Date().getTime();return c+'_'+b+'_'+a}function g(d,c){c||(c=k(d.target)),c=k(c);var i=c.width(),j=c.height(),e=c.offset(),g=e.left,h=e.top,a,b;if(d.type.indexOf('mouse')!==-1)return a=d.x||d.pageX,b=d.y||d.pageY,[a-g,b-h];var f=window.event.touches[0];return a=f.pageX-g,b=f.pageY-h,a=a<i?a:i,a=a>0?a:1,b=b<j?b:j,b=b>0?b:1,[a,b]}function c(e){var c=e.length,a=0,d=i.LatLng.DEG_TO_RAD,f,g;if(c>2){for(var b=0;b<c;b++)f=e[b],g=e[(b+1)%c],a+=(g.lng-f.lng)*d*(2+Math.sin(f.lat*d)+Math.sin(g.lat*d));a=a*6378137*6378137/2}return Math.abs(a)}function d(b){var c=0,d=b.length;for(var a=0;a<d;a++){var e=(a+1)%d;c+=b[a].distanceTo(b[e])}return c}function e(d,e,f){var a=e.target,b=a.__data,c='child-'+d;f.fire(c,{layer:a,data:b})}function f(a,b,c,d){return typeof a==='function'?a(b,c,d):a}var a=require('aliyun-map-utils'),h=require('./l_utils'),i=require('leaflet'),j=i.dmap=i.dmap||{},k=require('jquery'),l=require('./projection'),m=require('./curve_util');module.exports=j.Utils=a.merge(a,l,m,h,{getId:b,getPt:g,geodesicArea:c,getLengthPolyline:d,fireEvent:e,getValue:f}) | ||
function b(c){var a=Math.floor(Math.random()*1e7),b=new Date().getTime();return c+'_'+b+'_'+a}function k(d,c){c||(c=p(d.target)),c=p(c);var i=c.width(),j=c.height(),e=c.offset(),g=e.left,h=e.top,a,b;if(d.type.indexOf('mouse')!==-1)return a=d.x||d.pageX,b=d.y||d.pageY,[a-g,b-h];var f=window.event.touches[0];return a=f.pageX-g,b=f.pageY-h,a=a<i?a:i,a=a>0?a:1,b=b<j?b:j,b=b>0?b:1,[a,b]}function c(e){var c=e.length,a=0,d=n.LatLng.DEG_TO_RAD,f,g;if(c>2){for(var b=0;b<c;b++)f=e[b],g=e[(b+1)%c],a+=(g.lng-f.lng)*d*(2+Math.sin(f.lat*d)+Math.sin(g.lat*d));a=a*6378137*6378137/2}return Math.abs(a)}function d(b){var c=0,d=b.length;for(var a=0;a<d;a++){var e=(a+1)%d;c+=b[a].distanceTo(b[e])}return c}function e(d,e,f){var a=e.target,b=a.__data,c='child-'+d;f.fire(c,{layer:a,data:b})}function f(a,b,c,d){return typeof a==='function'?a(b,c,d):a}function g(e,h){var f,a,b,c,d=0;for(var g in e)f=e[g],a=f[h],d===0&&(b=c=a),b=Math.min(b,a),c=Math.max(c,a),d++;return[b,c]}function h(b,c){if(!b)return console.log('节点不存在');for(var a in c)b.style[a]=c[a]}function i(a){return typeof a==='number'?a.toFixed(6):a.length>7?a.substring(0,7):a}function j(a,b,c){return a=i(a),c?'<a href="#'+a+'">'+a+'</a><br>':'<div style="'+s+'"> <div style="'+s+'">'+b+': </div> <a href="#'+a+'" style="'+t+'">'+a+'</a> </div><br>'}function a(a){var d=typeof a==='array',e,b='';for(var c in a)e=a[c],b+=j(e,c,d);return b}var l=require('aliyun-map-utils'),m=require('./l_utils'),n=require('leaflet'),o=n.dmap=n.dmap||{},p=require('jquery'),q=require('./projection'),r=require('./curve_util'),s='margin-right:5px; color:#999;white-space:nowrap; display:inline-block;',t='white-space:nowrap;color:#fff;display:inline-block;font-weight:bold;text-decoration:none;';module.exports=o.Utils=l.merge(l,q,r,m,{getId:b,getPt:k,getRange:g,geodesicArea:c,getLengthPolyline:d,popupFromObject:a,fireEvent:e,getValue:f,applyCss:h}) |
@@ -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,i=this.geojsonLayer=b.geoJson(e,{style:d,onEachFeature:function(a,b){var d=f(a);g[d]=b,h.initEventChild(b,a);var e=c(a,null);c&&b.bindPopup(e)}});i.addTo(this._map)},initEventChild:function(a,e){var b={feature:e,layer:a},c=this,d=['mouseover','click','mouseout','mousedown'];d.forEach(function(d){a.on(d,function(){c.fire('child-'+b,b)})})},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 | ||
'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.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=this.genStyle(a.style),d=this.geojson,e=a.geoid.bind(a),f=this.layers=[],g=this,h=this.geojsonLayer=b.geoJson(d,{style:c,onEachFeature:function(a,b){var c=e(a);f[c]=b,g.initEventChild(b,a)}});h.addTo(this._map)},initEventChild:function(a,e){var b={feature:e,layer:a},c=this,f,d=this.options.popup,g=this._map,h=['mouseover','click','mouseout','mousedown'];h.forEach(function(d){a.on(d,function(){a.__data&&(b.data=a.__data),c.fire('child-'+b,b)})}),a.on('mousedown',function(i){var d=a.__data;if(b){var h=c.getTopLatlng(a);f=b(d,e),g.openPopup(f,h)}})},getTopLatlng:function(c){var b=c._latlngs,a;return b.forEach(function(b){a||(a=b),b.lat>a.lat&&(a=b)}),a},initialize:function(a){this.options=c.deepMerge(g.options,a)},getLayer:function(a){return a&&this.layers?this.layers[a]:void 0},genStyle:function(d,e,f,g,h){var b={};for(var c in d)b[c]=a(d[c],e,f,g,h);return b},each:function(c){if(!c)return;var a=this.layers;for(var b in a)c(a[b],b)},data:function(c){this._data=c;var e=this.options.value,f,b,g,h,a=this.range=[];for(var i in c){if(f=c[i],b=e(f),d(b))continue;d(a[0])&&(a[0]=a[1]=b),g=a[0],h=a[1],b>h&&(a[1]=b),b<g&&(a[0]=b)}},render:function(a){a&&this.data(a),this.draw()},draw:function(){var d=this._data,a=this.options,i=a.style,l=a.id.bind(a),f=a.value.bind(a),c,h,b,j,k=this.layers,e=this.range;for(var g in d)c=d[g],j=f(c),h=l(c),b=k[h],b&&b.setStyle(this.genStyle(i,j,e[0],e[1])),b&&(b.__data=c)},hide:function(){console.log('目前无效')},getBounds:function(a){return this._map?this.geojsonLayer.getBounds():void 0},destory:function(){this.geojsonLayer&&this._map.removeLayer(this.geojsonLayer)}});g.options={geoid:function(b){var c=b.id||b.adcode;if(c)return c;var a=b.properties;return a?a.id||a.adcode:void 0},id:function(a){return a.id||a.adcode},value:function(a){return a.value},style:{fillColor:function(a,b,d){if(!a)return'rgba(0,150,200,1)';var c=(a-b)/(d-b);return f(c)},color:'transparent',weight:2,opacity:1,fillOpacity:1},popup:function(a,b){return a.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 @@ | ||
function a(b){b=this.options=d.deepMerge(a.options,b),this.initialize(b)}var b=require('leaflet');require('./../render/canvas'),require('./../core/utils');var c=b.dmap=b.dmap||{},d=c.Utils,e=require('bcore/event');require('./../index.css'),require('./scatter_marker.css');var f=b.Marker,a=e.extend(a,{initialize:function(a){this.initDom()},initDom:function(){var a=this.options,c=b.divIcon({className:'circle-node'}),e=this.marker=new f([0,0],{icon:c}),d=a.popup.bind(this);d&&this.marker.bindPopup('<p class="person-label">loading...</p>',{offset:[0,-20]})},addTo:function(a){if(!a)return;this._map=a,this.marker.addTo(a),this.initDomIcon(),this.initEventsMarker()},initEventsMarker:function(){var a=this;this.marker.on('click',function(){a.emit('click',{id:a.id,com:a})})},initDomIcon:function(){var a=this.options.shape.html.bind(this);if(!a)return;var b=this.marker,c=this.container=b._icon;a(c)},data:function(a){if(!a)return;this._data=a,this.updateData(a)},updateData:function(c){c=c||this._data;var a=this.options,i=a.id,d=i(c);d!==null&&d!==undefined&&(this.id=d);var l=a.lng,m=a.lat,n=m(c),j=l(c);this.updateCenter(n,j);var e=a.text.bind(a);if(e){var k=e(c,this.textNode);this.updateText(k)}var f=(a.css||a.applyCss).bind(this),g=a.range;if(f)var o=f(c,this.textNode,g[0],g[1]);var h=a.popup.bind(this);if(h){var b=h(c);if(b===undefined||b===null)return;if(typeof b==='string'||b==='number')return this.marker.bindPopup(b);this.marker.bindPopup(b.text,{offset:b.offset})}},updateZIndex:function(){this._zIndex&&(this.container.style.zIndex=this._zIndex)},updateText:function(a){if(a===this._text)return;this._text=a;var b=this.textNode;b&&(b.innerHTML=a)},updateCenter:function(a,c){if(!(a&&c)||a===this._clat&&c===this._clng)return;this._clat=a,this._clng=c,this.marker.setLatLng(b.latLng(a,c))},render:function(a){a&&this.data(a)},destroy:function(){this.marker.off(),this._map.removeLayer(this.marker)}});a.options={lat:d.getLat,lng:d.getLng,id:function(a){return a.id},css:function(c,d){var a=10,b='#fff';return{background:b,left:-a,top:-a,width:2*a,height:2*a,'line-height':2*a+'px','border-radius':2*a}},text:function(a){return a.count},popup:function(a){this.marker.bindPopup(a[5],{offset:[0,-this.radius||-25]})},shape:{html:function(b){var a=document.createElement('div');a.className='alarm-circle interactive-circle',b.appendChild(a),this.textNode=a}}},c.ScatterMarker=a,c.scatterMarker=function(b){return new a(b)},module.exports=a | ||
function a(b){b=this.options=d.deepMerge(a.options,b),this.initialize(b)}var b=require('leaflet');require('./../render/canvas'),require('./../core/utils');var c=b.dmap=b.dmap||{},d=c.Utils,e=require('bcore/event');require('./../index.css'),require('./scatter_marker.css');var f=b.Marker,a=e.extend(a,{initialize:function(a){this.initDom()},initDom:function(){var c=this.options,a=b.divIcon({className:'circle-node'}),d=this.marker=new f([0,0],{icon:a})},addTo:function(a){if(!a)return;this._map=a,this.marker.addTo(a),this.initDomIcon(),this.initEventsMarker()},initEventsMarker:function(){var a=this;this.marker.on('click',function(){a.emit('click',{id:a.id,com:a})})},initDomIcon:function(){var a=this.options.shape.html.bind(this);if(!a)return;var b=this.marker,c=this.container=b._icon;a(c)},updateOptions:function(a){this.options=d.deepMerge(this.options,a)},data:function(a){if(!a)return;this._data=a,this.updateData(a)},updateData:function(b){b=b||this._data;var a=this.options,i=a.id,d=i(b);d!==null&&d!==undefined&&(this.id=d);var l=a.lng,m=a.lat,n=m(b),j=l(b);this.updateCenter(n,j);var e=a.text.bind(a);if(e){var k=e(b,this.textNode);this.updateText(k)}var f=(a.css||a.applyCss).bind(this),g=a.range||[];f&&f(b,this.textNode,g[0],g[1]);var h=a.popup.bind(this),o=[-5,-10];if(h){var c=h(b);if(c===undefined||c===null)return;if(typeof c==='string'||c==='number')return this.marker.bindPopup(c,{offset:o});this.marker.bindPopup(c.text,{offset:[0,10]})}},updateZIndex:function(){this._zIndex&&(this.container.style.zIndex=this._zIndex)},updateText:function(a){if(a===this._text)return;this._text=a;var b=this.textNode;b&&(b.innerHTML=a)},updateCenter:function(a,c){if(!(a&&c)||a===this._clat&&c===this._clng)return;this._clat=a,this._clng=c,this.marker.setLatLng(b.latLng(a,c))},render:function(a){a&&this.data(a)},destroy:function(){this.marker.off(),this._map.removeLayer(this.marker)}});a.options={lat:d.getLat,lng:d.getLng,id:function(a){return a.id},css:function(c,d){var a=10,b='#fff';return{background:b,left:-a,top:-a,width:2*a,height:2*a,'line-height':2*a+'px','border-radius':2*a}},text:function(a){return a.count},popup:function(a){this.marker.bindPopup(a[5],{offset:[0,-this.radius||-25]})},shape:{html:function(b){var a=document.createElement('div');a.className='alarm-circle interactive-circle',b.appendChild(a),this.textNode=a}}},c.ScatterMarker=a,c.scatterMarker=function(b){return new a(b)},module.exports=a |
@@ -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){this._data=a},clean:function(){var a=this.cache,c,b;if(!a)return;for(var d in a)c=a[d],b=c.visual,b&&b.destroy&&(b.destroy(),delete c.visual)},updateData:function(a){this.processing(a),this.cleanOld()},updateFilter:function(a){if(typeof a!=='function')return;this.options.filter=a,this.updateMap()},cleanOld:function(){var c=this.versionID,b=this.cache,d,a,f;if(!(c&&b))return;for(var e in b)d=b[e],f=d.versionID,f!==c&&(a=d.visual,a&&(a.off&&a.off(),a.destroy&&a.destroy()),delete b[e])},processing:function(y){var t=this.versionID=Math.random(),j=this._map;if(!j)return;var 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){a&&this.data(a),a=this._data,this.updateData(a)},enable:function(){this.isable=!0},disable:function(){this.isable=!1},isInZoom:function(){var a=this.options.zoom;if(!a)return!0;var c=this._map,d=a.max,e=a.min,b=c.getZoom();return b>d||b<e?!1:!0},isInView:function(b,c,a){a=a||this._map.getBounds();var d=a._northEast.lng,e=a._northEast.lat,f=a._southWest.lng,g=a._southWest.lat;return b<e&&b>g&&c<d&&c>f},updateOptions:function(a){a=this.options=f.deepMerge(this.options,a),this.draw()},draw:function(){var f=this.options,g=this.cache,e,a,l,h,b,j=f.lng,k=f.lat,c,m,n=f.filter,o=this._map.getZoom(),p,q=this.isInZoom(),t=f.groups;if(!q)return this.clean();if(!g)return;if(!this.isable)return;var s=this.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)},updateMap:function(){this.draw()},updateRange:function(){var c=this.cache,d=this.ranges=this.ranges||{},e=this.options.value,a=d.value=[];for(var f in c){var g=c[f].data,b=e(g);a[0]||(a=[b,b]),b<a[0]&&(a[0]=b),b>a[1]&&(a[1]=b)}},initEventsMap:function(){this._map.on('moveend',this.updateMap.bind(this))},initEventsScatter:function(b){var a=this;b.on('click',function(b){a.emit('click-scatter',b)})},destroy:function(){this.clean(),this.cache={}}}),e.ScatterMarkers=a,e.scatterMarkers=function(b){return new a(b)},module.exports=a | ||
function a(b){b=this.options=f.deepMerge(a.options,b),this.initialize(b)}var b=require('leaflet');require('./../core/utils');var c=require('bcore/event'),d=require('./scatter_marker'),e=b.dmap=b.dmap||{},f=e.Utils;a.options={lat:f.getLat,lng:f.getLng,filter:function(a,b){return!0},range:[0,1],id:function(a,b){return a.id||b},text:function(a){return a.text},value:function(a){return a.value||a.num||a[0]},zoom:{max:15,min:3},child:{size:function(a,b,c){return 15},shape:{normal:{}}}},a=c.extend(a,{initialize:function(a){this.cache={},this.isable=!0},addTo:function(a){if(!a)return;this._map=a,this.initEventsMap()},data:function(a){this._data=a},clean:function(){var a=this.cache,c,b;if(!a)return;for(var d in a)c=a[d],b=c.visual,b&&b.destroy&&(b.destroy(),delete c.visual)},updateData:function(a){this.processing(a),this.cleanOld()},updateFilter:function(a){if(typeof a!=='function')return;this.options.filter=a,this.updateMap()},cleanOld:function(){var c=this.versionID,b=this.cache,d,a,f;if(!(c&&b))return;for(var e in b)d=b[e],f=d.versionID,f!==c&&(a=d.visual,a&&(a.off&&a.off(),a.destroy&&a.destroy()),delete b[e])},processing:function(y){var t=this.versionID=Math.random(),j=this._map;if(!j)return;var c=this.options,w=this.getChildOptions(),a,i,u,v,e,b,n=this.isInZoom(),o=this._map.getZoom(),p=c.id,q=c.lat,r=c.lng,s=c.filter,g=c.groups,k,h,l=this.cache,m=this.isable;for(var f in y){if(a=y[f],c.processing&&c.processing(a),i=p(a,f),u=q(a),v=r(a),e=l[i],k=!0,k=s(a,o),h=!0,g){h=!1;for(var f in g){var x=g[f];if(x.filter(a)){h=!0;break}}}if(e?e.data=a:e=l[i]={data:a},e.versionID=t,n&&k&&h&&this.isInView(u,v)&&m){var b=e.visual;b?b.updateData(a):m&&(b=e.visual=new d(w),b.addTo(j),b.render(a),this.initEventsScatter(b))}}this.updateRange()},render:function(a){a&&this.data(a),a=this._data,this.updateData(a)},enable:function(){this.isable=!0},disable:function(){this.isable=!1},isInZoom:function(){var a=this.options.zoom;if(!a)return!0;var c=this._map,d=a.max,e=a.min,b=c.getZoom();return b>d||b<e?!1:!0},isInView:function(b,c,a){a=a||this._map.getBounds();var d=a._northEast.lng,e=a._northEast.lat,f=a._southWest.lng,g=a._southWest.lat;return b<e&&b>g&&c<d&&c>f},each:function(c){var a=this.cache;for(var b in a)c(a[b])},getChildOptions:function(){var a=this.options;return{id:a.child.id||a.id,text:a.child.text||a.text,lat:a.child.lat||a.lat,lng:a.child.lng||a.lng,range:a.child.range||a.range,value:a.child.value||a.value,css:a.child.css||a.css,popup:a.child.popup||a.popup}},updateOptions:function(a){a=this.options=f.deepMerge(this.options,a);var b=this.getChildOptions();this.each(function(a){a.visual&&a.visual.updateOptions(b)}),this.draw()},draw:function(){var f=this.options,g=this.cache,e,a,l,h,b,j=f.lng,k=f.lat,c,m,n=f.filter,o=this._map.getZoom(),p,q=this.isInZoom(),t=f.groups;if(!q)return this.clean();if(!g)return;if(!this.isable)return;var s=this.getChildOptions(),r=this._map;for(var i in g)e=g[i],b=e.data,l=k(b),h=j(b),p=this.isInView(l,h),c=!0,c=n(b,o),m=!0,c=c&&m,a=e.visual,p&&c?a?(a.updateData(b),a.updateZIndex()):(a=e.visual=new d(s),a.addTo(r),a.render(b),this.initEventsScatter(a)):a&&(a.off&&a.off(),a.destroy&&a.destroy(),delete e.visual)},updateMap:function(){this.draw()},updateRange:function(){var c=this.cache,d=this.ranges=this.ranges||{},e=this.options.value,a=d.value=[];for(var f in c){var g=c[f].data,b=e(g);a[0]||(a=[b,b]),b<a[0]&&(a[0]=b),b>a[1]&&(a[1]=b)}},initEventsMap:function(){this._map.on('moveend',this.updateMap.bind(this))},initEventsScatter:function(b){var a=this;b.on('click',function(b){a.emit('click-scatter',b)})},destroy:function(){this.clean(),this.cache={}}}),e.ScatterMarkers=a,e.scatterMarkers=function(b){return new a(b)},module.exports=a |
@@ -1,1 +0,1 @@ | ||
var a=require('jquery'),b=require('leaflet'),c=b.Map.extend({options:{isRotateZ:!1,background:null,crs:b.CRS.EPSG3857,fadeAnimation:b.DomUtil.TRANSITION&&!b.Browser.android23,trackResize:!0,markerZoomAnimation:b.DomUtil.TRANSITION&&b.Browser.any3d,view3dOptions:{x:50,y:0,z:0}},initOverlay:function(){this.overlayNode=a('<div style="position:absolute;width:100%;height:100%;top:0;left:0;pointer-events:none;"></div>').appendTo(this._container)},initUIContainer:function(){return this.uiNode=a('<div style="position:absolute;width:100%;height:100%;top:0;left:0;pointer-events:none;z-index:1000;"></div>').appendTo(this._container)},getUIContainer:function(){var a=this.uiNode;return a||(a=this.uiNode=this.initUIContainer()),a},getOverlay:function(){return this.overlayNode},initialize:function(c,e){var d;typeof c==='string'?d=c:c.attr&&c.attr('id')?d=c.attr('id'):(c=a(c),d='map-'+Math.floor(Math.random()*1e9)),e=b.setOptions(this,e),b.Map.prototype.initialize.call(this,d,e);var f=this.options.background;this.initOverlay(),f&&this.setBgColor(f)},getPixelBounds:function(){var c=this._getTopLeftPoint(),a=new b.Bounds(c,c.add(this.getSize())),d=this.offsetBoundX||0,e=this.offsetBoundY||0;return a.min.x=a.min.x-d,a.min.y=a.min.y-d,a.max.x=a.max.x+e,a.max.y=a.max.y+e,a},init3d:function(){if(this.isInit3d)return;this.offsetBoundX=1e3,this.offsetBoundY=1e3;var b=this._container;a(b).css({overflow:'visible'}),this.addHooks3dLayer(),this.initEvents3d(),this.isInit3d=!0},addHooks3dLayer:function(){this.on('move',this._update3dLayers,this)},removeHooks3dLayer:function(){this.off('move',this._update3dLayers,this)},_getTransformOrigin:function(c){var a=this._size,b=this._getMapPanePos();return-b.x+a.x/2+'px '+(-b.y+a.y/2+c*1)+'px'},_update3dLayer:function(d,e){var b=this._getTransformOrigin(e),c='rotateX('+this.options.view3dOptions.x+'deg)';d.css({transformOrigin:b,transform:c,zIndex:0}),a('.leaflet-marker-pane').show()},_update2dLayer:function(c,d){var a=this._getTransformOrigin(d),b='rotateX(0deg)';c.css({transformOrigin:a,transform:b+'translateZ(10px)',zIndex:0})},_update3dLayers:function(){this.init3d();var c=1200,b=this.panes=a(this._container).find('.leaflet-map-pane');b.css({webkitPerspective:c,perspective:c,perspectiveOrigin:this._getTransformOrigin(0)}),this._update3dLayer(b.find('.leaflet-objects-pane'),1),this._update3dLayer(b.find('.leaflet-tile-pane'),1)},_update2dLayers:function(){var b=this.panes=a(this._container).find('.leaflet-map-pane'),c=1200;b.css({webkitPerspective:c,perspective:c,perspectiveOrigin:this._getTransformOrigin(0)}),this._update2dLayer(b.find('.leaflet-objects-pane'),1),this._update2dLayer(b.find('.leaflet-tile-pane'),1)},view3d:function(a){var a=b.Util.extend(this.options.view3dOptions,a);this._update3dLayers()},view2d:function(){this._update2dLayers(),this.cancel3d(),this.hideMarkerPane(),this.disableRotate()},cancel3d:function(){this.offsetBoundX=0,this.offsetBoundY=0,this.removeHooks3dLayer()},hideMarkerPane:function(){a('.leaflet-marker-pane').hide(),a('.leaflet-marker-pane').css('transform','rotateZ(0deg)')},setDomStyle:function(b){b&&typeof b==='object'&&a(this._container).css(b)},setBgColor:function(a){this.setDomStyle({'background-color':a})},detect:function(){this.on('moveend',function(){console.log(this.getCenter(),this.getZoom())})},disableRotate:function(){this.isRotateZ=!1,this.dragging.enable(),a('.leaflet-layer').attr('style','transform:rotateZ(0deg)'),a('.leaflet-marker-pane').css('transform','rotateZ(0deg)'),this.fire('rotate',{rotation:0})},enableRotate:function(){this.isRotateZ=!0,this.dragging.disable()},initEvents3d:function(){this.angle=0,this.xdrag=0;var b=this,c=!1,d=0,e=a('#map-container');e.on('mousedown',function(a){if(!b.isRotateZ)return;d=a.pageX,c=!0,b.fire('rotatestart')}).on('mousemove',function(h){if(!(b.isRotateZ&&c))return;b.xdrag=(d-h.pageX)/4;var f='rotateZ('+(b.angle+b.xdrag)%360+'deg)',e=b._getTransformOrigin(0),g={'-webkit-transform':f,transform:f,'transform-origin':e,'-webkit-transform-origin':e};a('.leaflet-layer').css(g),a('.leaflet-marker-pane').css(g),a('.leaflet-objects-pane').css('transform-origin',e),a('.leaflet-tile-pane').css('transform-origin',e),b.fire('rotate',{rotation:b.angle+b.xdrag})}).on('mouseup',function(){if(!b.isRotateZ)return;c=!1,b.fire('rotateend'),b.angle=b.angle+b.xdrag})}}),d=b.dmap=b.dmap||{};d.Map=c,d.map=function(a,b){return new c(a,b)},module.exports=c | ||
var a=require('jquery'),b=require('leaflet'),c=require('./../core/utils'),d=b.Map.extend({options:{isRotateZ:!1,background:null,crs:b.CRS.EPSG3857,fadeAnimation:b.DomUtil.TRANSITION&&!b.Browser.android23,trackResize:!0,markerZoomAnimation:b.DomUtil.TRANSITION&&b.Browser.any3d,view3dOptions:{x:50,y:0,z:0}},initOverlay:function(){this.overlayNode=a('<div style="position:absolute;width:100%;height:100%;top:0;left:0;pointer-events:none;"></div>').appendTo(this._container)},initUIContainer:function(){return this.uiNode=a('<div style="position:absolute;width:100%;height:100%;top:0;left:0;pointer-events:none;z-index:1000;"></div>').appendTo(this._container)},getUIContainer:function(){var a=this.uiNode;return a||(a=this.uiNode=this.initUIContainer()),a},getOverlay:function(){return this.overlayNode},initialize:function(a,e){if(a=c.getContainer(a),!a)return console.log('map container错误');var d=a.getAttribute('id');d||(d='map-'+Math.floor(Math.random()*1e9),a.setAttribute('id',d)),e=b.setOptions(this,e),b.Map.prototype.initialize.call(this,d,e);var f=this.options.background;this.initOverlay(),f&&this.setBgColor(f)},getPixelBounds:function(){var c=this._getTopLeftPoint(),a=new b.Bounds(c,c.add(this.getSize())),d=this.offsetBoundX||0,e=this.offsetBoundY||0;return a.min.x=a.min.x-d,a.min.y=a.min.y-d,a.max.x=a.max.x+e,a.max.y=a.max.y+e,a},init3d:function(){if(this.isInit3d)return;this.offsetBoundX=1e3,this.offsetBoundY=1e3;var b=this._container;a(b).css({overflow:'visible'}),this.addHooks3dLayer(),this.initEvents3d(),this.isInit3d=!0},addHooks3dLayer:function(){this.on('move',this._update3dLayers,this)},removeHooks3dLayer:function(){this.off('move',this._update3dLayers,this)},_getTransformOrigin:function(c){var a=this._size,b=this._getMapPanePos();return-b.x+a.x/2+'px '+(-b.y+a.y/2+c*1)+'px'},_update3dLayer:function(d,e){var b=this._getTransformOrigin(e),c='rotateX('+this.options.view3dOptions.x+'deg)';d.css({transformOrigin:b,transform:c,zIndex:0}),a('.leaflet-marker-pane').show()},_update2dLayer:function(c,d){var a=this._getTransformOrigin(d),b='rotateX(0deg)';c.css({transformOrigin:a,transform:b+'translateZ(10px)',zIndex:0})},_update3dLayers:function(){this.init3d();var c=1200,b=this.panes=a(this._container).find('.leaflet-map-pane');b.css({webkitPerspective:c,perspective:c,perspectiveOrigin:this._getTransformOrigin(0)}),this._update3dLayer(b.find('.leaflet-objects-pane'),1),this._update3dLayer(b.find('.leaflet-tile-pane'),1)},_update2dLayers:function(){var b=this.panes=a(this._container).find('.leaflet-map-pane'),c=1200;b.css({webkitPerspective:c,perspective:c,perspectiveOrigin:this._getTransformOrigin(0)}),this._update2dLayer(b.find('.leaflet-objects-pane'),1),this._update2dLayer(b.find('.leaflet-tile-pane'),1)},view3d:function(a){var a=b.Util.extend(this.options.view3dOptions,a);this._update3dLayers()},view2d:function(){this._update2dLayers(),this.cancel3d(),this.hideMarkerPane(),this.disableRotate()},cancel3d:function(){this.offsetBoundX=0,this.offsetBoundY=0,this.removeHooks3dLayer()},hideMarkerPane:function(){a('.leaflet-marker-pane').hide(),a('.leaflet-marker-pane').css('transform','rotateZ(0deg)')},setDomStyle:function(b){b&&typeof b==='object'&&a(this._container).css(b)},setBgColor:function(a){this.setDomStyle({'background-color':a})},detect:function(){this.on('moveend',function(){console.log(this.getCenter(),this.getZoom())})},disableRotate:function(){this.isRotateZ=!1,this.dragging.enable(),a('.leaflet-layer').attr('style','transform:rotateZ(0deg)'),a('.leaflet-marker-pane').css('transform','rotateZ(0deg)'),this.fire('rotate',{rotation:0})},enableRotate:function(){this.isRotateZ=!0,this.dragging.disable()},initEvents3d:function(){this.angle=0,this.xdrag=0;var b=this,c=!1,d=0,e=a('#map-container');e.on('mousedown',function(a){if(!b.isRotateZ)return;d=a.pageX,c=!0,b.fire('rotatestart')}).on('mousemove',function(h){if(!(b.isRotateZ&&c))return;b.xdrag=(d-h.pageX)/4;var f='rotateZ('+(b.angle+b.xdrag)%360+'deg)',e=b._getTransformOrigin(0),g={'-webkit-transform':f,transform:f,'transform-origin':e,'-webkit-transform-origin':e};a('.leaflet-layer').css(g),a('.leaflet-marker-pane').css(g),a('.leaflet-objects-pane').css('transform-origin',e),a('.leaflet-tile-pane').css('transform-origin',e),b.fire('rotate',{rotation:b.angle+b.xdrag})}).on('mouseup',function(){if(!b.isRotateZ)return;c=!1,b.fire('rotateend'),b.angle=b.angle+b.xdrag})}}),e=b.dmap=b.dmap||{};e.Map=d,e.map=function(a,b){return new d(a,b)},module.exports=d |
@@ -5,3 +5,3 @@ { | ||
"description": "2d map visualization lib", | ||
"version": "0.0.66", | ||
"version": "0.0.67", | ||
"scripts": { | ||
@@ -8,0 +8,0 @@ "test": "mocha -r jscoverage test" |
@@ -1,1 +0,1 @@ | ||
function a(b,d){this.tilelayer=b,this.container=e(b._container),this._map=b._map;var f=this;b._filter=f,d=this.options=c.deepMerge(a.options,d),this.initEvents(b),this.updateStyle()}var b=require('bcore/event'),c=require('bcore/utils'),d=require('leaflet'),e=require('jquery');d.dmap=d.dmap||{},a.options={hueRotate:0,saturate:100,contrast:100,brightness:100,grayscale:0,opacity:1,anim:0,blur:0,sepia:0,invert:0},a=b.extend(a,{initEvents:function(a){a.on('tileload',this.updateStyle.bind(this))},updateStyle:function(){var a=this.options,b='';a.saturate!=100&&(b+='saturate('+a.saturate+'%)'+' '),a.grayscale!=0&&(b+='grayscale('+a.grayscale+'%)'+' '),a.hueRotate!=0&&(b+='hue-rotate('+a.hueRotate+'deg)'+' '),a.contrast!=0&&(b+='contrast('+a.contrast+'%)'+' '),a.brightness!=0&&(b+='brightness('+a.brightness+'%)'+' '),a.blur!=0&&(b+='blur('+a.blur+'px)'+' '),a.sepia!=0&&(b+='sepia('+a.sepia+'%)'+' '),a.invert!=0&&(b+='invert('+a.invert+'%)'+' ');var c=a.opacity,d=a.anim,e=this._map.getPanes().tilePane;this.container.css({'-webkit-filter':b,filter:b,transition:d+'s',opacity:c})},cleanStyle:function(){var b=a.options,d=this.options;for(var c in b)d[c]=b[c];this.updateStyle()}}),d.dmap.Filter=a,d.dmap.filter=function(b,c){return new a(b,c)},module.exports=a | ||
function a(b,d){this.tilelayer=b,this.container=e(b._container),this._map=b._map;var f=this;b._filter=f,d=this.options=c.deepMerge(a.options,d),this.initEvents(b),this.updateStyle()}var b=require('bcore/event'),c=require('bcore/utils'),d=require('leaflet'),e=require('jquery');d.dmap=d.dmap||{},a.options={hueRotate:0,saturate:100,contrast:100,brightness:100,grayscale:0,opacity:1,anim:0,blur:0,sepia:0,invert:0},a=b.extend(a,{initEvents:function(a){a.on('tileload',this.updateStyle.bind(this))},updateOptions:function(a){a=this.options=c.deepMerge(this.options,a),this.updateStyle()},updateStyle:function(){var a=this.options,b='';a.saturate!=100&&(b+='saturate('+a.saturate+'%)'+' '),a.grayscale!=0&&(b+='grayscale('+a.grayscale+'%)'+' '),a.hueRotate!=0&&(b+='hue-rotate('+a.hueRotate+'deg)'+' '),a.contrast!=0&&(b+='contrast('+a.contrast+'%)'+' '),a.brightness!=0&&(b+='brightness('+a.brightness+'%)'+' '),a.blur!=0&&(b+='blur('+a.blur+'px)'+' '),a.sepia!=0&&(b+='sepia('+a.sepia+'%)'+' '),a.invert!=0&&(b+='invert('+a.invert+'%)'+' ');var c=a.opacity,d=a.anim,e=this._map.getPanes().tilePane;this.container.css({'-webkit-filter':b,filter:b,transition:d+'s',opacity:c})},cleanStyle:function(){var b=a.options,d=this.options;for(var c in b)d[c]=b[c];this.updateStyle()}}),d.dmap.Filter=a,d.dmap.filter=function(b,c){return new a(b,c)},module.exports=a |
312842