Comparing version 0.1.22 to 0.1.23
@@ -1,1 +0,1 @@ | ||
var a=require('jquery'),b=require('lodash'),c=require('leaflet'),d=c.Control.extend({options:{position:'topleft',draw:{},edit:!1}}) | ||
var b=require('jquery'),c=require('lodash'),a=require('leaflet'),d=a.Control.extend({options:{position:'topleft',draw:{},edit:!1}}) |
@@ -1,1 +0,1 @@ | ||
function a(a){a=this.options=Util.deepMerge(this.options,a)}var b=require('./view'),c=require('./animator'),d=require('bcore/utils');a=b.extend(a),d.merge(a.prototype,c.prototype);var e=d.deepMerge(c.options||{},b.options);a.options=d.deepMerge(e,a.options),module.exports=a | ||
function a(a){a=this.options=Util.deepMerge(this.options,a)}var c=require('./view'),d=require('./animator'),b=require('bcore/utils');a=c.extend(a),b.merge(a.prototype,d.prototype);var e=b.deepMerge(d.options||{},c.options);a.options=b.deepMerge(e,a.options),module.exports=a |
@@ -1,1 +0,1 @@ | ||
function a(b){b=this.options=c.deepMerge(a.options,b),this.initialize(b)}var b=require('./../core/event'),c=require('./utils'),d=c.requestAnimationFrame,e=c.cancelAnimationFrame;a.options={isLoop:!1,isAutoStart:!0,isAutoDestroy:!0,tween:null,delayStart:0,delayEnd:0,lifeSpeed:.01,lifeMin:0,lifeMax:1},a=b.extend(a,{life:null,initialize:function(a){this._initEventsAnim(),this.resetVariables(),this.options.isAutoStart&&this.startAnim()},genOptions:function(){return a.prototype.options},_initEventsAnim:function(){this.options.isAutoDestroy&&this.on('end',this.destoryAnim.bind(this))},initEventsAnim:function(){},resetVariables:function(){this.life=this.life||this.options.lifeMin,this.lifeLength=this.options.lifeMax-this.options.lifeMin},startAnim:function(){var a=this.options.delayStart;if(!a)return this.restart();setTimeout(this.restart.bind(this),a)},loop:function(){if(!this.isLooping)return;this._updateLife(),this.loopid=d(this.loop.bind(this))},_updateLife:function(){this.life+=this.options.lifeSpeed;var a=this.tween?this.getTweenValue():this.life;this.emit('update',a),this.updateLife(a),this.checkIfEnd()},checkIfEnd:function(){this.life>=this.options.lifeMax&&this._onLifeEnd()},updateLife:function(){},_onLifeEnd:function(){var a=this.options.delayEnd;a?setTimeout(this._onEnd.bind(this),a):this._onEnd(),this.emit('lifeEnd')},to:function(b,a){a=a||'life',a==='life'&&this.toLife(b)},toLife:function(a){if(a===undefined||a===null)return;this.life=a},_onEnd:function(){if(this.isLoop)return this.restart();this.end(),this.emit('end')},end:function(){},getTweenValue:function(){return this.tween((this.life-this.options.lifeMin)/this.lifeLength)},pause:function(){this.isLooping=!1,e(this.loopid),this.loopid=null},resume:function(){if(this.isLooping)return;this.isLooping=!0,this.loop()},reset:function(){},restart:function(){this.resetVariables(),this.life=this.options.lifeMin||0,this.resume()},destoryAnim:function(){this.pause()},genOptions:function(){return a.prototype.options}}),module.exports=a | ||
function a(c){c=this.options=b.deepMerge(a.options,c),this.initialize(c)}var c=require('./../core/event'),b=require('./utils'),d=b.requestAnimationFrame,e=b.cancelAnimationFrame;a.options={isLoop:!1,isAutoStart:!0,isAutoDestroy:!0,tween:null,delayStart:0,delayEnd:0,lifeSpeed:.01,lifeMin:0,lifeMax:1},a=c.extend(a,{life:null,initialize:function(a){this._initEventsAnim(),this.resetVariables(),this.options.isAutoStart&&this.startAnim()},genOptions:function(){return a.prototype.options},_initEventsAnim:function(){this.options.isAutoDestroy&&this.on('end',this.destoryAnim.bind(this))},initEventsAnim:function(){},resetVariables:function(){this.life=this.life||this.options.lifeMin,this.lifeLength=this.options.lifeMax-this.options.lifeMin},startAnim:function(){var a=this.options.delayStart;if(!a)return this.restart();setTimeout(this.restart.bind(this),a)},loop:function(){if(!this.isLooping)return;this._updateLife(),this.loopid=d(this.loop.bind(this))},_updateLife:function(){this.life+=this.options.lifeSpeed;var a=this.tween?this.getTweenValue():this.life;this.emit('update',a),this.updateLife(a),this.checkIfEnd()},checkIfEnd:function(){this.life>=this.options.lifeMax&&this._onLifeEnd()},updateLife:function(){},_onLifeEnd:function(){var a=this.options.delayEnd;a?setTimeout(this._onEnd.bind(this),a):this._onEnd(),this.emit('lifeEnd')},to:function(b,a){a=a||'life',a==='life'&&this.toLife(b)},toLife:function(a){if(a===undefined||a===null)return;this.life=a},_onEnd:function(){if(this.isLoop)return this.restart();this.end(),this.emit('end')},end:function(){},getTweenValue:function(){return this.tween((this.life-this.options.lifeMin)/this.lifeLength)},pause:function(){this.isLooping=!1,e(this.loopid),this.loopid=null},resume:function(){if(this.isLooping)return;this.isLooping=!0,this.loop()},reset:function(){},restart:function(){this.resetVariables(),this.life=this.options.lifeMin||0,this.resume()},destoryAnim:function(){this.pause()},genOptions:function(){return a.prototype.options}}),module.exports=a |
@@ -1,1 +0,1 @@ | ||
function b(a,b){return a&&b?[a[0]-b[0],a[1]-b[1]]:void 0}function g(a,b){return a&&b?[a[0]+b[0],a[1]+b[1]]:void 0}function c(a,b){return a?[a[0]*b,a[1]*b]:void 0}function d(j,k){var c,d;for(var h in j){c=j[h];var e=c.length;if(e<2)continue;var g=[],b,i;for(var a=0;a<e;a++)d=c[a],ptNext=c[a+1],ptPrev=c[a-1],b=f(ptPrev,d,ptNext,k),b[0]&&b[1]||(b=i||b),g.push(b),i=b;for(var a=e-1;a>=0;a--)d=c[a],b=g[a],d[0]+=b[0]||0,d[1]+=b[1]||0}}function e(c){if(!c)return[0,0];var a=c[0],b=c[1],d=Math.sqrt(a*a+b*b);return[a/d,b/d]}function f(l,h,m,k){var a,d;if(a=b(m,h),d=b(h,l),!(a&&d))return i(e(a||d),k);a=e(a),a=j(a),d=e(d),d=j(d);var f=g(a,d);return f=e(f),c(f,k)}function a(c){var b=[];for(var a=c.length-1;a>=0;a--)b.push(c[a]);return b}function h(b,c){if(!c)return b;var d=b[0],e=b[b.length-1],f=Math.abs(d[0]-c[0])+Math.abs(d[1]-c[1]),g=Math.abs(e[0]-c[0])+Math.abs(e[1]-c[1]);return f>g?a(b):b}function i(a,b){return[a[1]*b,-a[0]*b]}function j(a){return[a[1],-a[0]]}function k(a){return JSON.parse(JSON.stringify(a))}function l(a,f,g){a=k(a);var b=a.features,c=[];for(var e in b)c.push(b[e].geometry.coordinates);return d(c,f),a}module.exports={getOffsetDashedFeatures:d,getOffsetGeojson:l} | ||
function b(a,b){return a&&b?[a[0]-b[0],a[1]-b[1]]:void 0}function g(a,b){return a&&b?[a[0]+b[0],a[1]+b[1]]:void 0}function e(a,b){return a?[a[0]*b,a[1]*b]:void 0}function c(j,k){var c,d;for(var h in j){c=j[h];var e=c.length;if(e<2)continue;var g=[],b,i;for(var a=0;a<e;a++)d=c[a],ptNext=c[a+1],ptPrev=c[a-1],b=f(ptPrev,d,ptNext,k),b[0]&&b[1]||(b=i||b),g.push(b),i=b;for(var a=e-1;a>=0;a--)d=c[a],b=g[a],d[0]+=b[0]||0,d[1]+=b[1]||0}}function a(c){if(!c)return[0,0];var a=c[0],b=c[1],d=Math.sqrt(a*a+b*b);return[a/d,b/d]}function f(l,j,m,k){var c,f;if(c=b(m,j),f=b(j,l),!(c&&f))return i(a(c||f),k);c=a(c),c=d(c),f=a(f),f=d(f);var h=g(c,f);return h=a(h),e(h,k)}function k(c){var b=[];for(var a=c.length-1;a>=0;a--)b.push(c[a]);return b}function l(a,b){if(!b)return a;var c=a[0],d=a[a.length-1],e=Math.abs(c[0]-b[0])+Math.abs(c[1]-b[1]),f=Math.abs(d[0]-b[0])+Math.abs(d[1]-b[1]);return e>f?k(a):a}function i(a,b){return[a[1]*b,-a[0]*b]}function d(a){return[a[1],-a[0]]}function h(a){return JSON.parse(JSON.stringify(a))}function j(a,f,g){a=h(a);var b=a.features,d=[];for(var e in b)d.push(b[e].geometry.coordinates);return c(d,f),a}module.exports={getOffsetDashedFeatures:c,getOffsetGeojson:j} |
@@ -1,1 +0,1 @@ | ||
function b(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,b){typeof a=='string'&&(d='<a style="'+i+'">'+a+'</a><br>',c+=d)});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 h(a){return typeof a[0]==='object'?!1:!0}function c(a){return a===undefined}function d(b,a){return a=a||{},b.forEach(function(e){if(h(e)){var b=e[0],c=e[1];a.latMax=Math.max(a.latMax||c,c),a.lngMax=Math.max(a.lngMax||b,b),a.latMin=Math.min(a.latMin||c,c),a.lngMin=Math.min(a.lngMin||b,b)}else d(e,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(b,a){return a=a||[],b.forEach(function(b){if(h(b)){var d=b[0],c=b[1];(a[0]===undefined||a[0]===null)&&(a=b),c>a[1]&&(a[0]=b[0],a[1]=b[1])}else a=g(b,a)}),a}function a(b){var a=g(b.map(function(a){return g(a.geometry.coordinates)}));return a}function i(b){if(b.features)return a(b.features);if(b.type&&b.type.toLowerCase()==='feature'){var c=b.geometry;if(!c)return;var d=c.coordinates;return d?g(d):void 0}return g(b)}function j(c,d,f,g){var a=typeof c;if(a==='function'){var b=c(f,g);return typeof b==='string'||typeof b==='number'?d.innerHTML=b:b}if(a==='string'||a==='number')return d.innerHTML=c;if(a==='object'){var e=new m(d,c);return e.render(f),e}}function k(b){if(!b)return;var f=b.parent,a=b.child,g=b.map,d=b.datas,e=b.popup;if(!g)return console.log('map 缺少...');if(!d)return console.log('datas 缺少...');if(!e)return;var c=e.eventType||'click';a.off(c).on(c,function(o){var k=a.popupPosition||o.latlng;g.openPopup(b,k);var b=g._popup;if(e){var h=typeof d==='function'?d():d,l=h[0],m=h[1],n=b._container.getElementsByClassName('leaflet-popup-content')[0],i=a.popupGroup=j(e,n,l,m);if(setTimeout(function(){b._updateLayout(),b._updatePosition()}),typeof i!=='object')return;i.on(c,function(b){(a.emit||a.fire).bind(a)('popup-'+c,b),(f.emit||f.fire).bind(f)('child-popup-'+c,b)})}})}function l(b){var b=n.getContainer(b),a=document.createElement('div');return a.style.width=a.style.height='100%',b.appendChild(a),a}var m=require('./../plugins/popup'),n=require('bcore/utils');module.exports={parseContent:b,getTopPoint:i,getBBox:f,initEventsPopup:k,createContainer:l} | ||
function g(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,b){typeof a=='string'&&(d='<a style="'+i+'">'+a+'</a><br>',c+=d)});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 e(a){return typeof a[0]==='object'?!1:!0}function n(a){return a===undefined}function b(c,a){return a=a||{},c.forEach(function(f){if(e(f)){var c=f[0],d=f[1];a.latMax=Math.max(a.latMax||d,d),a.lngMax=Math.max(a.lngMax||c,c),a.latMin=Math.min(a.latMin||d,d),a.lngMin=Math.min(a.lngMin||c,c)}else b(f,a)}),a}function h(c){var a={};return c.forEach(function(e){var d=e.geometry.coordinates,c=b(d);a.latMax=Math.max(a.latMax||c.latMax,c.latMax),a.lngMax=Math.max(a.lngMax||c.lngMax,c.lngMax),a.latMin=Math.min(a.latMin||c.latMin,c.latMin),a.lngMin=Math.min(a.lngMin||c.lngMin,c.lngMin)}),a}function f(a){if(a.features)return h(a.features);if(a.type&&a.type.toLowerCase()==='feature'){var c=a.geometry;if(!c)return;var d=c.coordinates;return d?b(d):void 0}}function a(c,b){return b=b||[],c.forEach(function(c){if(e(c)){var f=c[0],d=c[1];(b[0]===undefined||b[0]===null)&&(b=c),d>b[1]&&(b[0]=c[0],b[1]=c[1])}else b=a(c,b)}),b}function m(c){var b=a(c.map(function(b){return a(b.geometry.coordinates)}));return b}function i(b){if(b.features)return m(b.features);if(b.type&&b.type.toLowerCase()==='feature'){var c=b.geometry;if(!c)return;var d=c.coordinates;return d?a(d):void 0}return a(b)}function j(c,e,g,h){var a=typeof c;if(a==='function'){var b=c(g,h);return typeof b==='string'||typeof b==='number'?e.innerHTML=b:b}if(a==='string'||a==='number')return e.innerHTML=c;if(a==='object'){var f=new d(e,c);return f.render(g),f}}function k(b){if(!b)return;var f=b.parent,a=b.child,g=b.map,d=b.datas,e=b.popup;if(!g)return console.log('map 缺少...');if(!d)return console.log('datas 缺少...');if(!e)return;var c=e.eventType||'click';a.off(c).on(c,function(o){var k=a.popupPosition||o.latlng;g.openPopup(b,k);var b=g._popup;if(e){var h=typeof d==='function'?d():d,l=h[0],m=h[1],n=b._container.getElementsByClassName('leaflet-popup-content')[0],i=a.popupGroup=j(e,n,l,m);if(setTimeout(function(){b._updateLayout(),b._updatePosition()}),typeof i!=='object')return;i.on(c,function(b){(a.emit||a.fire).bind(a)('popup-'+c,b),(f.emit||f.fire).bind(f)('child-popup-'+c,b)})}})}function l(b){var b=c.getContainer(b),a=document.createElement('div');return a.style.width=a.style.height='100%',b.appendChild(a),a}var d=require('./../plugins/popup'),c=require('bcore/utils');module.exports={parseContent:g,getTopPoint:i,getBBox:f,initEventsPopup:k,createContainer:l} |
@@ -1,1 +0,1 @@ | ||
function a(f,g){var c=Math.PI*3e3/180,a=parseFloat(g)-.0065,b=parseFloat(f)-.006,d=Math.sqrt(a*a+b*b)-2e-5*Math.sin(b*c),e=Math.atan2(b,a)-3e-6*Math.cos(a*c);return{lat:parseFloat((d*Math.sin(e)).toFixed(5),10),lng:parseFloat((d*Math.cos(e)).toFixed(5),10)}}function b(a,b){var c=Math.sqrt(b*b+a*a)+2e-5*Math.sin(a*d),e=Math.atan2(a,b)+3e-6*Math.cos(b*d);return{lng:c*Math.cos(e)+.0065,lat:c*Math.sin(e)+.006}}var c=function(a,b){this.a=6378245,this.ee=.006693421622965943,this.pi=3.141592653589793,this.transform=function(a,b){var c,d;return this.outOfChina(a,b)?(c=a,d=b,[c,d]):(dLat=this.transformLat(b-105,a-35),dLon=this.transformLon(b-105,a-35),radLat=a/180*this.pi,magic=Math.sin(radLat),magic=1-this.ee*magic*magic,sqrtMagic=Math.sqrt(magic),dLat=dLat*180/(this.a*(1-this.ee)/(magic*sqrtMagic)*this.pi),dLon=dLon*180/(this.a/sqrtMagic*Math.cos(radLat)*this.pi),c=a+dLat,d=b+dLon,[c,d])},this.outOfChina=function(a,b){return b<72.004||b>137.8347?!0:a<.8293||a>55.8271?!0:!1},this.transformLat=function(b,a){return ret=-100+2*b+3*a+.2*a*a+.1*b*a+.2*Math.sqrt(Math.abs(b)),ret+=(20*Math.sin(6*b*this.pi)+20*Math.sin(2*b*this.pi))*2/3,ret+=(20*Math.sin(a*this.pi)+40*Math.sin(a/3*this.pi))*2/3,ret+=(160*Math.sin(a/12*this.pi)+320*Math.sin(a*this.pi/30))*2/3,ret},this.transformLon=function(a,b){return ret=300+a+2*b+.1*a*a+.1*a*b+.1*Math.sqrt(Math.abs(a)),ret+=(20*Math.sin(6*a*this.pi)+20*Math.sin(2*a*this.pi))*2/3,ret+=(20*Math.sin(a*this.pi)+40*Math.sin(a/3*this.pi))*2/3,ret+=(150*Math.sin(a/12*this.pi)+300*Math.sin(a/30*this.pi))*2/3,ret},a=Number(a),b=Number(b);var c=this.transform(a,b);return{lat:c[0],lng:c[1]}},d=52.35987755982988;module.exports={WGS2GCJ:c,BD092GCJ:a,GCJ2BD09:b} | ||
function c(f,g){var c=Math.PI*3e3/180,a=parseFloat(g)-.0065,b=parseFloat(f)-.006,d=Math.sqrt(a*a+b*b)-2e-5*Math.sin(b*c),e=Math.atan2(b,a)-3e-6*Math.cos(a*c);return{lat:parseFloat((d*Math.sin(e)).toFixed(5),10),lng:parseFloat((d*Math.cos(e)).toFixed(5),10)}}function d(b,c){var d=Math.sqrt(c*c+b*b)+2e-5*Math.sin(b*a),e=Math.atan2(b,c)+3e-6*Math.cos(c*a);return{lng:d*Math.cos(e)+.0065,lat:d*Math.sin(e)+.006}}var b=function(a,b){this.a=6378245,this.ee=.006693421622965943,this.pi=3.141592653589793,this.transform=function(a,b){var c,d;return this.outOfChina(a,b)?(c=a,d=b,[c,d]):(dLat=this.transformLat(b-105,a-35),dLon=this.transformLon(b-105,a-35),radLat=a/180*this.pi,magic=Math.sin(radLat),magic=1-this.ee*magic*magic,sqrtMagic=Math.sqrt(magic),dLat=dLat*180/(this.a*(1-this.ee)/(magic*sqrtMagic)*this.pi),dLon=dLon*180/(this.a/sqrtMagic*Math.cos(radLat)*this.pi),c=a+dLat,d=b+dLon,[c,d])},this.outOfChina=function(a,b){return b<72.004||b>137.8347?!0:a<.8293||a>55.8271?!0:!1},this.transformLat=function(b,a){return ret=-100+2*b+3*a+.2*a*a+.1*b*a+.2*Math.sqrt(Math.abs(b)),ret+=(20*Math.sin(6*b*this.pi)+20*Math.sin(2*b*this.pi))*2/3,ret+=(20*Math.sin(a*this.pi)+40*Math.sin(a/3*this.pi))*2/3,ret+=(160*Math.sin(a/12*this.pi)+320*Math.sin(a*this.pi/30))*2/3,ret},this.transformLon=function(a,b){return ret=300+a+2*b+.1*a*a+.1*a*b+.1*Math.sqrt(Math.abs(a)),ret+=(20*Math.sin(6*a*this.pi)+20*Math.sin(2*a*this.pi))*2/3,ret+=(20*Math.sin(a*this.pi)+40*Math.sin(a/3*this.pi))*2/3,ret+=(150*Math.sin(a/12*this.pi)+300*Math.sin(a/30*this.pi))*2/3,ret},a=Number(a),b=Number(b);var c=this.transform(a,b);return{lat:c[0],lng:c[1]}},a=52.35987755982988;module.exports={WGS2GCJ:b,BD092GCJ:c,GCJ2BD09:d} |
@@ -1,1 +0,1 @@ | ||
'use strict';function a(b){var a=0;for(var c in b)a++;return a}function b(a){return a===null||a===undefined||isNaN(a)}function c(a){this.options=e.deepMerge(this.options,a),this.localDatas={}}var d=require('bcore/event'),e=require('./utils');d.extend(c,{options:{isDeleteDiff:!0,getCellID:function(a,b,c){return c==='array'?a.id||'id_'+Math.floor(Math.random()*1e14):a.id||b||'id_'+Math.floor(Math.random()*1e14)}},dataN:0,datasN:0,valueMax:null,valueMin:null,versionIdCount:0,getValue:function(a){return a.value},getVersionId:function(){return'version_id_'+this.versionIdCount++},write:function(c){if(!c)return;var f=this.getVersionId(),d=this.localDatas,g={},h=this.options.getCellID,e,b,a;if(Array.isArray(c))for(a=0;a<c.length;a++)e=c[a],b=h(e,a,'array'),this.wrapper(b,e,d,f,g);else for(a in c)c.hasOwnProperty(a)&&(e=c[a],b=h(e,a,'object'),this.wrapper(b,e,d,f,g));if(this.options.isDeleteDiff)for(b in d)d[b]&&d[b].version!==f&&this.destroy(b);this.emit('update-data',g),this.emit('all-data',d),this.datasN++},updateRange:function(d){var c=!1;if(!this.getValue)return;var a=this.getValue(d);if(b(a))return;b(this.valueMax)&&(this.valueMax=a),b(this.valueMin)&&(this.valueMin=a),this.valueMax<a&&(this.valueMax=a,c=!0),this.valueMin>a&&(c=!0,this.valueMin=a),c&&this.emit('update-range',{max:this.valueMax,min:this.valueMin})},wrapper:function(b,c,d,e,f){this.updateRange(c);var a=d[b];a?(a.data=c,a.version=e,a.action='update'):a=d[b]={id:b,data:c,version:e,action:'new'},f[b]=a,this.emit('update-row',a),this.dataN++},destroy:function(b){var a=this.localDatas;if(a){var c=a[b];this.emit('delete-row',c),delete a[b]}},destroyAll:function(){var a=this.localDatas;if(a)for(var b in a)this.destroy(b)}}),module.exports=c | ||
'use strict';function e(b){var a=0;for(var c in b)a++;return a}function a(a){return a===null||a===undefined||isNaN(a)}function b(a){this.options=d.deepMerge(this.options,a),this.localDatas={}}var c=require('bcore/event'),d=require('./utils');c.extend(b,{options:{isDeleteDiff:!0,getCellID:function(a,b,c){return c==='array'?a.id||'id_'+Math.floor(Math.random()*1e14):a.id||b||'id_'+Math.floor(Math.random()*1e14)}},dataN:0,datasN:0,valueMax:null,valueMin:null,versionIdCount:0,getValue:function(a){return a.value},getVersionId:function(){return'version_id_'+this.versionIdCount++},write:function(c){if(!c)return;var f=this.getVersionId(),d=this.localDatas,g={},h=this.options.getCellID,e,b,a;if(Array.isArray(c))for(a=0;a<c.length;a++)e=c[a],b=h(e,a,'array'),this.wrapper(b,e,d,f,g);else for(a in c)c.hasOwnProperty(a)&&(e=c[a],b=h(e,a,'object'),this.wrapper(b,e,d,f,g));if(this.options.isDeleteDiff)for(b in d)d[b]&&d[b].version!==f&&this.destroy(b);this.emit('update-data',g),this.emit('all-data',d),this.datasN++},updateRange:function(d){var c=!1;if(!this.getValue)return;var b=this.getValue(d);if(a(b))return;a(this.valueMax)&&(this.valueMax=b),a(this.valueMin)&&(this.valueMin=b),this.valueMax<b&&(this.valueMax=b,c=!0),this.valueMin>b&&(c=!0,this.valueMin=b),c&&this.emit('update-range',{max:this.valueMax,min:this.valueMin})},wrapper:function(b,c,d,e,f){this.updateRange(c);var a=d[b];a?(a.data=c,a.version=e,a.action='update'):a=d[b]={id:b,data:c,version:e,action:'new'},f[b]=a,this.emit('update-row',a),this.dataN++},destroy:function(b){var a=this.localDatas;if(a){var c=a[b];this.emit('delete-row',c),delete a[b]}},destroyAll:function(){var a=this.localDatas;if(a)for(var b in a)this.destroy(b)}}),module.exports=b |
@@ -1,1 +0,1 @@ | ||
function b(c){var a=Math.floor(Math.random()*1e7),b=new Date().getTime();return c+'_'+b+'_'+a}function q(d,c){c||(c=A(d.target)),c=A(c);var i=c.width(),j=c.height(),e=c.offset(),g=e.left,h=e.top,a,b;if(d.type.indexOf('mouse')!==-1)return a=d.x||d.pageX,b=d.y||d.pageY,[a-g,b-h];var f=window.event.touches[0];return a=f.pageX-g,b=f.pageY-h,a=a<i?a:i,a=a>0?a:1,b=b<j?b:j,b=b>0?b:1,[a,b]}function c(b){if(b.fromLat&&b.fromLng)return{lat:b.fromLat,lng:b.fromLng};if(b.from){var a=b.from;return typeof a==='string'&&a.indexOf(',')!==-1?(a=a.split(',')[1],{lat:a[1],lng:a[0]}):a}}function d(b){if(b.toLat&&b.toLng)return{lat:b.toLat,lng:b.toLng};if(b.to){var a=b.to;return typeof a==='string'&&a.indexOf(',')!==-1?(a=a.split(',')[1],{lat:a[1],lng:a[0]}):a}}function e(e){var c=e.length,a=0,d=y.LatLng.DEG_TO_RAD,f,g;if(c>2){for(var b=0;b<c;b++)f=e[b],g=e[(b+1)%c],a+=(g.lng-f.lng)*d*(2+Math.sin(f.lat*d)+Math.sin(g.lat*d));a=a*6378137*6378137/2}return Math.abs(a)}function f(b){var c=0,d=b.length;for(var a=0;a<d;a++){var e=(a+1)%d;c+=b[a].distanceTo(b[e])}return c}function g(d,e,f){var a=e.target,b=a.__data,c='child-'+d;f.fire(c,{layer:a,data:b})}function h(a,b,c,d){return typeof a==='function'?a(b,c,d):a}function i(e,h){var f,a,b,c,d=0;for(var g in e){if(f=e[g],a=f[h],a===undefined||a===null)continue;d===0&&(b=c=a),b=Math.min(b,a),c=Math.max(c,a),d++}return[b,c]}function j(b,c){if(!b)return console.log('节点不存在');for(var a in c)b.style[a]=c[a]}function k(a){return typeof a==='number'&&(a=a.toString()),a.length>20?a.substring(0,20):a}function l(b){if(typeof b!=='string')return!1;var a=['http://','https://','www.'];for(var c in a)if(b.indexOf(a[c])!==-1)return!0}function m(a,c,d,e){var b;return l(a)?b=a:a=k(a),d?b?'<a href="'+b+'">点击查看</a><br>':'<div>'+a+'</div><br>':b?'<div style="'+F+'"> <div style="'+F+'">'+c+': </div> <a style="'+G+'" href="'+b+'">『点击查看』</a> </div><br>':'<div style="'+F+'"> <div style="'+F+'">'+c+': </div> <a style="'+G+'">'+a+'</a> </div><br>'}function n(a,f){var e=typeof a==='array',b,c='';for(var d in a){if(b=a[d],typeof b==='object')continue;c+=m(b,d,e,f)}return c}function o(a,b){return function(e){var d={};for(var f in a){var c=a[f];c in e&&(d[c]=e[c])}return n(d,b)}}function p(c){var a=w.getLat(c),b=w.getLng(c);return a&&b?B.BD092GCJ(a,b).lat:void 0}function a(c){var a=w.getLat(c),b=w.getLng(c);return a&&b?B.BD092GCJ(a,b).lng:void 0}function r(c){var a=w.getLat(c),b=w.getLng(c);return a&&b?B.WGS2GCJ(a,b).lat:void 0}function s(c){var a=w.getLat(c),b=w.getLng(c);return a&&b?B.WGS2GCJ(a,b).lng:void 0}function t(c){var a=w.getLat(c),b=w.getLng(c);return a&&b?B.GCJ2BD09(a,b).lat:void 0}function u(c){var a=w.getLat(c),b=w.getLng(c);return a&&b?B.GCJ2BD09(a,b).lng:void 0}function v(f,c,d,b,a){b=b||0,a=a===null||a===undefined?1:a;var e=(Math.max(c,Math.min(d,f))-c)/(d-c);return b+e*(a-b)}var w=require('aliyun-map-utils'),x=require('./l_utils'),y=require('leaflet'),z=y.dmap=y.dmap||{},A=require('jquery'),B=require('./projection'),C=require('./curve_util'),D=['click','mousedown','mouseup','mouseover','mouseout'],E=['click','mouseover','mouseout','mousedown'],F='margin-right:5px; color:#999;white-space:nowrap; display:inline-block;',G='white-space:nowrap;color:#fff;display:inline-block;font-weight:bold;text-decoration:none;';module.exports=z.Utils=w.merge(w,B,C,x,{getLngBA:a,getLatBA:p,getLngAB:u,getLatAB:t,getLngWA:s,getLatWA:r,getFrom:c,getTo:d,getId:b,getPt:q,getRange:i,geodesicArea:e,getLengthPolyline:f,genPopupFromObject:o,popupFromObject:n,fireEvent:g,getValue:h,applyCss:j,EVENTS:D,EVENTSBasic:E,map:v}) | ||
function n(c){var a=Math.floor(Math.random()*1e7),b=new Date().getTime();return c+'_'+b+'_'+a}function q(d,c){c||(c=f(d.target)),c=f(c);var j=c.width(),k=c.height(),e=c.offset(),h=e.left,i=e.top,a,b;if(d.type.indexOf('mouse')!==-1)return a=d.x||d.pageX,b=d.y||d.pageY,[a-h,b-i];var g=window.event.touches[0];return a=g.pageX-h,b=g.pageY-i,a=a<j?a:j,a=a>0?a:1,b=b<k?b:k,b=b>0?b:1,[a,b]}function w(b){if(b.fromLat&&b.fromLng)return{lat:b.fromLat,lng:b.fromLng};if(b.from){var a=b.from;return typeof a==='string'&&a.indexOf(',')!==-1?(a=a.split(',')[1],{lat:a[1],lng:a[0]}):a}}function x(b){if(b.toLat&&b.toLng)return{lat:b.toLat,lng:b.toLng};if(b.to){var a=b.to;return typeof a==='string'&&a.indexOf(',')!==-1?(a=a.split(',')[1],{lat:a[1],lng:a[0]}):a}}function y(f){var c=f.length,a=0,e=d.LatLng.DEG_TO_RAD,g,h;if(c>2){for(var b=0;b<c;b++)g=f[b],h=f[(b+1)%c],a+=(h.lng-g.lng)*e*(2+Math.sin(g.lat*e)+Math.sin(h.lat*e));a=a*6378137*6378137/2}return Math.abs(a)}function z(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 A(d,e,f){var a=e.target,b=a.__data,c='child-'+d;f.fire(c,{layer:a,data:b})}function B(a,b,c,d){return typeof a==='function'?a(b,c,d):a}function C(e,h){var f,a,b,c,d=0;for(var g in e){if(f=e[g],a=f[h],a===undefined||a===null)continue;d===0&&(b=c=a),b=Math.min(b,a),c=Math.max(c,a),d++}return[b,c]}function D(b,c){if(!b)return console.log('节点不存在');for(var a in c)b.style[a]=c[a]}function E(a){return typeof a==='number'&&(a=a.toString()),a.length>20?a.substring(0,20):a}function F(b){if(typeof b!=='string')return!1;var a=['http://','https://','www.'];for(var c in a)if(b.indexOf(a[c])!==-1)return!0}function m(a,d,f,g){var b;return F(a)?b=a:a=E(a),f?b?'<a href="'+b+'">点击查看</a><br>':'<div>'+a+'</div><br>':b?'<div style="'+c+'"> <div style="'+c+'">'+d+': </div> <a style="'+e+'" href="'+b+'">『点击查看』</a> </div><br>':'<div style="'+c+'"> <div style="'+c+'">'+d+': </div> <a style="'+e+'">'+a+'</a> </div><br>'}function h(a,f){var e=typeof a==='array',b,c='';for(var d in a){if(b=a[d],typeof b==='object')continue;c+=m(b,d,e,f)}return c}function o(a,b){return function(e){var d={};for(var f in a){var c=a[f];c in e&&(d[c]=e[c])}return h(d,b)}}function p(e){var c=a.getLat(e),d=a.getLng(e);return c&&d?b.BD092GCJ(c,d).lat:void 0}function G(e){var c=a.getLat(e),d=a.getLng(e);return c&&d?b.BD092GCJ(c,d).lng:void 0}function r(e){var c=a.getLat(e),d=a.getLng(e);return c&&d?b.WGS2GCJ(c,d).lat:void 0}function s(e){var c=a.getLat(e),d=a.getLng(e);return c&&d?b.WGS2GCJ(c,d).lng:void 0}function t(e){var c=a.getLat(e),d=a.getLng(e);return c&&d?b.GCJ2BD09(c,d).lat:void 0}function u(e){var c=a.getLat(e),d=a.getLng(e);return c&&d?b.GCJ2BD09(c,d).lng:void 0}function v(f,c,d,b,a){b=b||0,a=a===null||a===undefined?1:a;var e=(Math.max(c,Math.min(d,f))-c)/(d-c);return b+e*(a-b)}var a=require('aliyun-map-utils'),i=require('./l_utils'),d=require('leaflet'),g=d.dmap=d.dmap||{},f=require('jquery'),b=require('./projection'),j=require('./curve_util'),k=['click','mousedown','mouseup','mouseover','mouseout'],l=['click','mouseover','mouseout','mousedown'],c='margin-right:5px; color:#999;white-space:nowrap; display:inline-block;',e='white-space:nowrap;color:#fff;display:inline-block;font-weight:bold;text-decoration:none;';module.exports=g.Utils=a.merge(a,b,j,i,{getLngBA:G,getLatBA:p,getLngAB:u,getLatAB:t,getLngWA:s,getLatWA:r,getFrom:w,getTo:x,getId:n,getPt:q,getRange:C,geodesicArea:y,getLengthPolyline:z,genPopupFromObject:o,popupFromObject:h,fireEvent:A,getValue:B,applyCss:D,EVENTS:k,EVENTSBasic:l,map:v}) |
@@ -1,1 +0,1 @@ | ||
var a=require('jquery'),b=require('./leaflet.js'),c=require('./core/utils');require('leaflet/dist/leaflet.css'),require('./index.css'),b.Utils=c.merge(b.Util,c);var d=b.dmap=b.dmap||{};b.dmap.Utils=c,require('./layer/areas'),require('./render/canvas'),require('./layer/tilelayer'),require('./layer/scatter_canvas'),require('./layer/scatter_markers'),require('./layer/scatter_marker'),require('./layer/flyingLineGradient'),require('./layer/flyingLineDash'),require('./layer/markercluster'),require('./layer/heatmap_grid_new'),require('./layer/trails_canvas'),require('./layer/scatter_konva'),require('./layer/webgl_heatmap/HeatMapLayer.js'),require('./layer/bubbles'),require('./plugins/geo_coding_popup'),require('./plugins/filter/tilelayer'),require('./plugins/url_hash'),require('./map/map');var e=require('./layer/geojson_canvas');module.exports=b | ||
var c=require('jquery'),a=require('./leaflet.js'),b=require('./core/utils');require('leaflet/dist/leaflet.css'),require('./index.css'),a.Utils=b.merge(a.Util,b);var d=a.dmap=a.dmap||{};a.dmap.Utils=b,require('./layer/areas'),require('./render/canvas'),require('./layer/tilelayer'),require('./layer/scatter_canvas'),require('./layer/scatter_markers'),require('./layer/scatter_marker'),require('./layer/flyingLineGradient'),require('./layer/flyingLineDash'),require('./layer/markercluster'),require('./layer/heatmap_grid_new'),require('./layer/trails_canvas'),require('./layer/scatter_konva'),require('./layer/webgl_heatmap/HeatMapLayer.js'),require('./layer/bubbles'),require('./plugins/geo_coding_popup'),require('./plugins/filter/tilelayer'),require('./plugins/url_hash'),require('./map/map');var e=require('./layer/geojson_canvas');module.exports=a |
@@ -1,1 +0,1 @@ | ||
'use strict';function a(a,b,c,d,e){return typeof a==='function'?a(b,c,d,e):a}var b=require('./../leaflet'),c=require('./../core/utils'),d=c.isNone,e=require('./../core/utils').getColorFunc,f=e({from:'#002170',to:'#c5f2e7',easing:'Quadratic.Out.1.1',space:'rgb'}),g=b.Class.extend({includes:[b.Mixin.Events],addTo:function(a){return this._map=a,this.geojson&&this.initGeojson(),this},geoJson:function(a){if(!a)return;this.geojson=a;var b=this._map;if(!b)return;this.removeGeojson(),this.initGeojson()},removeGeojson:function(a){a=a||this.geojsonLayer,a&&this._map.removeLayer(a)},initGeojson:function(){var a=this.options,d=this.genStyle(a.style),e=this.geojson,f=a.geoid.bind(a),g=this.layers={},h=this,c=this.geojsonLayer=b.geoJson(e,{style:d,draggable:!1,onEachFeature:function(a,b){var c=f(a)||Math.random().toString(36).substr(2);g[c]=b,b.__feature=a,h.initEventChild(b,a)}});c.addTo(this._map),c.bringToBack()},initEventChild:function(a,f){var e=this.options.popup,b=this._map,c=this.options,d=c.style.hover;d&&a.on('mouseover',function(){b.closePopup(),a.setStyle(this.options.style.hover)},this).on('mouseout',function(b){b.target.setStyle(a.__style)},this)},initEventsPopup:function(){var a=this._map,b=this.options.popup;this.each(function(d){if(!d)return;this.updatePopupPostion(d),c.initEventsPopup({parent:this,child:d,map:a,datas:[d.__feature,d.__data],popup:b})}.bind(this))},updatePopupPostion:function(d){var e=this._map,a=c.getTopPoint(d.__feature);d.popupPosition=b.latLng(a[1],a[0])},initialize:function(a){this.options=c.deepMerge(g.options,a)},getLayer:function(a){return a&&this.layers?this.layers[a]:void 0},genStyle:function(d,e,f,g,h){var b={};for(var c in d)b[c]=a(d[c],e,f,g,h);return b},each:function(c){if(!c)return;var a=this.layers;for(var b in a)c(a[b],b)},data:function(a){this._data=a,this.updateRange()},updateRange:function(){var g=this._data,e=this.options,k=e.value,f=e.filter,c,a,i,j,b=this.range=[];for(var h in g){if(c=g[h],a=k(c),d(a))continue;if(f&&!f(c))continue;typeof a!=='number'&&(a=parseFloat(a)),d(b[0])&&(b[0]=b[1]=a),i=b[0],j=b[1],a>j&&(b[1]=a),a<i&&(b[0]=a)}},render:function(a){a&&this.data(a),this.draw()},updateOptions:function(a){a=this.options=c.deepMerge(this.options,a),this.draw()},draw:function(){var a,m,h,e=this._data,f=this.dataObj={},b=this.options,c=b.filter,i=b.style,j=b.id.bind(b),k=b.value.bind(b);for(var l in e)a=e[l],m=j(a),f[m]=a;var n=this.layers,g,d=this.range;this.each(function(b,e){if(a=f[e]||{},c&&!c(a))return;h=k(a),g=this.genStyle(i,h,d[0],d[1]),b.setStyle(g),b.__style=g,b.unbindPopup&&b.unbindPopup(),b.bindPopup&&b.bindPopup(this.options.popup(a,e,b.feature)),b&&(b.__data=a)}.bind(this))},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||a.name:void 0},id:function(a){return a.id||a.adcode||a.name},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,dashArray:null},popup:function(b,c,a){return b.info||a.properties.name||a.properties.info||'数据无info字段'}};var h=b.dmap=b.dmap||{};h.Area=g,h.area=function(a){return new g(a)},module.exports=g | ||
'use strict';function h(a,b,c,d,e){return typeof a==='function'?a(b,c,d,e):a}var a=require('./../leaflet'),b=require('./../core/utils'),d=b.isNone,f=require('./../core/utils').getColorFunc,g=f({from:'#002170',to:'#c5f2e7',easing:'Quadratic.Out.1.1',space:'rgb'}),c=a.Class.extend({includes:[a.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.removeGeojson(),this.initGeojson()},removeGeojson:function(a){a=a||this.geojsonLayer,a&&this._map.removeLayer(a)},initGeojson:function(){var b=this.options,d=this.genStyle(b.style),e=this.geojson,f=b.geoid.bind(b),g=this.layers={},h=this,c=this.geojsonLayer=a.geoJson(e,{style:d,draggable:!1,onEachFeature:function(a,b){var c=f(a)||Math.random().toString(36).substr(2);g[c]=b,b.__feature=a,h.initEventChild(b,a)}});c.addTo(this._map),c.bringToBack()},initEventChild:function(a,f){var e=this.options.popup,b=this._map,c=this.options,d=c.style.hover;d&&a.on('mouseover',function(){b.closePopup(),a.setStyle(this.options.style.hover)},this).on('mouseout',function(b){b.target.setStyle(a.__style)},this)},initEventsPopup:function(){var a=this._map,c=this.options.popup;this.each(function(d){if(!d)return;this.updatePopupPostion(d),b.initEventsPopup({parent:this,child:d,map:a,datas:[d.__feature,d.__data],popup:c})}.bind(this))},updatePopupPostion:function(d){var e=this._map,c=b.getTopPoint(d.__feature);d.popupPosition=a.latLng(c[1],c[0])},initialize:function(a){this.options=b.deepMerge(c.options,a)},getLayer:function(a){return a&&this.layers?this.layers[a]:void 0},genStyle:function(c,d,e,f,g){var a={};for(var b in c)a[b]=h(c[b],d,e,f,g);return a},each:function(c){if(!c)return;var a=this.layers;for(var b in a)c(a[b],b)},data:function(a){this._data=a,this.updateRange()},updateRange:function(){var g=this._data,e=this.options,k=e.value,f=e.filter,c,a,i,j,b=this.range=[];for(var h in g){if(c=g[h],a=k(c),d(a))continue;if(f&&!f(c))continue;typeof a!=='number'&&(a=parseFloat(a)),d(b[0])&&(b[0]=b[1]=a),i=b[0],j=b[1],a>j&&(b[1]=a),a<i&&(b[0]=a)}},render:function(a){a&&this.data(a),this.draw()},updateOptions:function(a){a=this.options=b.deepMerge(this.options,a),this.draw()},draw:function(){var a,m,h,e=this._data,f=this.dataObj={},b=this.options,c=b.filter,i=b.style,j=b.id.bind(b),k=b.value.bind(b);for(var l in e)a=e[l],m=j(a),f[m]=a;var n=this.layers,g,d=this.range;this.each(function(b,e){if(a=f[e]||{},c&&!c(a))return;h=k(a),g=this.genStyle(i,h,d[0],d[1]),b.setStyle(g),b.__style=g,b.unbindPopup&&b.unbindPopup(),b.bindPopup&&b.bindPopup(this.options.popup(a,e,b.feature)),b&&(b.__data=a)}.bind(this))},hide:function(){console.log('目前无效')},getBounds:function(a){return this._map?this.geojsonLayer.getBounds():void 0},destory:function(){this.geojsonLayer&&this._map.removeLayer(this.geojsonLayer)}});c.options={geoid:function(b){var c=b.id||b.adcode;if(c)return c;var a=b.properties;return a?a.id||a.adcode||a.name:void 0},id:function(a){return a.id||a.adcode||a.name},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 g(c)},color:'transparent',weight:2,opacity:1,fillOpacity:1,dashArray:null},popup:function(b,c,a){return b.info||a.properties.name||a.properties.info||'数据无info字段'}};var e=a.dmap=a.dmap||{};e.Area=c,e.area=function(a){return new c(a)},module.exports=c |
@@ -1,1 +0,1 @@ | ||
var a=require('./../leaflet'),b=require('jquery'),c=a.dmap=a.dmap||{},d=require('./../core/utils'),e=a.Class.extend({isRotateZ:!1,options:{column:{color:['red','blue'],width:10,height:30,deg:50,opacity:1},popuper:{color:'blue',width:75,height:15,borderRadius:1,opacity:1,top:20,left:-30}},initialize:function(a){this.options=d.deepMerge(this.options,a),this.columnOpts=this.options.column,this.popuperOpts=this.options.popuper},addTo:function(a){if(!a)return;this._map=a},data:function(a){this._data=a},init:function(){var c=this.columns,d=this._data,a=this.columns=b(' <div class="line3d"> <div class="linedrawer"> <div class="lineLeft"></div> <div class="lineRight"></div> </div> <div class="popuper"></div> <div class="circlebottom"></div> <div class="circletop"></div> </div>');b('.leaflet-marker-pane').append(a),this.line3dNode=a.find('.line3d'),this.linedrawerNode=a.find('.linedrawer'),this.lineLeft=a.find('.lineLeft'),this.lineRight=a.find('.lineRight'),this.popuperNode=a.find('.popuper'),this.initEventsMap()},render:function(){var c=this.columnOpts,a=c.width,d=c.color,e=2;b('.line3d').css({width:a*2+'px'}),b('.linedrawer').css({width:a*2+'px',height:e+'px',opacity:this.columnOpts.opacity}),b('.lineLeft').css({'background-color':d[0],width:a+'px'}),b('.lineRight').css({'background-color':d[1],'margin-left':a+'px',width:a+'px'}),this.updatePos(),this.rotate()},updatePos:function(f){var b=this._data,d=this._map,e=a.latLng(b.lng,b.lat);this.heightTransLeft=b.value[0]||40,this.heightTransRight=b.value[1]||40;var c;f?c=d._latLngToNewLayerPoint(e,f.zoom,f.center).round():c=d.latLngToLayerPoint(e);var g=c.x,h=c.y,i='translate3d('+g+'px'+','+h+'px'+','+'0'+')',j=g+'px '+h+'px';this.linedrawerNode.css({height:this.heightTransLeft>this.heightTransRight?this.heightTransLeft:this.heightTransRight}),this.lineLeft.css({height:this.heightTransLeft}),this.lineRight.css({height:this.heightTransRight,'margin-top':'-'+this.heightTransLeft+'px'});var k=this.columns;k.css({transform:'rotateX(90deg)'+i,'-webkitTransform':'rotateX(90deg)'+i,'-webkitTransformOrigin':j,transformOrigin:j})},initEventsMap:function(){var a=this.updatePos.bind(this);this._map.on('zoomanim',a),requestAnimationFrame(function(){a()})},popUpper:function(){var c=this._data,g=this._map,d=this.popuperNode,e=c.value[0],f=c.value[1];textRotator=b('<div class="text-rotator"><span class="span-text">value1 is '+e+' value2 is '+f+'</span></div>'),d.append(textRotator);var a=this.popuperOpts;textRotator.css({transform:'translate3d('+a.left+'px'+','+a.top+'px'+','+0+'px'+')'+' '+'rotateX('+180+'deg)','background-color':a.color,width:a.width+'px',height:a.height+'px','border-radius':a.borderRadius+'px',opacity:a.opacity})},initEventsColumn:function(){b('.line3d').on('mouseover',function(a){b(a.currentTarget).find('.popuper').css('visibility','visible')}),b('.line3d').on('mouseout',function(a){b(a.currentTarget).find('.popuper').css('visibility','hidden')})},rotate:function(){this.angle=0,this.xdrag=0;var a=this,c=b(this._map._container);this._map.on('rotate',function(c,d){var b=-c.rotation;a.linedrawerNode.css({transform:'rotateY('+b+'deg)'}),a.popuperNode.css({transform:'rotateY('+b+'deg)'})})}});c.Bar3D=e,c.bar3d=function(a){return new c.Bar3D(a)},module.exports=e | ||
var b=require('./../leaflet'),a=require('jquery'),c=b.dmap=b.dmap||{},e=require('./../core/utils'),d=b.Class.extend({isRotateZ:!1,options:{column:{color:['red','blue'],width:10,height:30,deg:50,opacity:1},popuper:{color:'blue',width:75,height:15,borderRadius:1,opacity:1,top:20,left:-30}},initialize:function(a){this.options=e.deepMerge(this.options,a),this.columnOpts=this.options.column,this.popuperOpts=this.options.popuper},addTo:function(a){if(!a)return;this._map=a},data:function(a){this._data=a},init:function(){var c=this.columns,d=this._data,b=this.columns=a(' <div class="line3d"> <div class="linedrawer"> <div class="lineLeft"></div> <div class="lineRight"></div> </div> <div class="popuper"></div> <div class="circlebottom"></div> <div class="circletop"></div> </div>');a('.leaflet-marker-pane').append(b),this.line3dNode=b.find('.line3d'),this.linedrawerNode=b.find('.linedrawer'),this.lineLeft=b.find('.lineLeft'),this.lineRight=b.find('.lineRight'),this.popuperNode=b.find('.popuper'),this.initEventsMap()},render:function(){var c=this.columnOpts,b=c.width,d=c.color,e=2;a('.line3d').css({width:b*2+'px'}),a('.linedrawer').css({width:b*2+'px',height:e+'px',opacity:this.columnOpts.opacity}),a('.lineLeft').css({'background-color':d[0],width:b+'px'}),a('.lineRight').css({'background-color':d[1],'margin-left':b+'px',width:b+'px'}),this.updatePos(),this.rotate()},updatePos:function(f){var a=this._data,d=this._map,e=b.latLng(a.lng,a.lat);this.heightTransLeft=a.value[0]||40,this.heightTransRight=a.value[1]||40;var c;f?c=d._latLngToNewLayerPoint(e,f.zoom,f.center).round():c=d.latLngToLayerPoint(e);var g=c.x,h=c.y,i='translate3d('+g+'px'+','+h+'px'+','+'0'+')',j=g+'px '+h+'px';this.linedrawerNode.css({height:this.heightTransLeft>this.heightTransRight?this.heightTransLeft:this.heightTransRight}),this.lineLeft.css({height:this.heightTransLeft}),this.lineRight.css({height:this.heightTransRight,'margin-top':'-'+this.heightTransLeft+'px'});var k=this.columns;k.css({transform:'rotateX(90deg)'+i,'-webkitTransform':'rotateX(90deg)'+i,'-webkitTransformOrigin':j,transformOrigin:j})},initEventsMap:function(){var a=this.updatePos.bind(this);this._map.on('zoomanim',a),requestAnimationFrame(function(){a()})},popUpper:function(){var c=this._data,g=this._map,d=this.popuperNode,e=c.value[0],f=c.value[1];textRotator=a('<div class="text-rotator"><span class="span-text">value1 is '+e+' value2 is '+f+'</span></div>'),d.append(textRotator);var b=this.popuperOpts;textRotator.css({transform:'translate3d('+b.left+'px'+','+b.top+'px'+','+0+'px'+')'+' '+'rotateX('+180+'deg)','background-color':b.color,width:b.width+'px',height:b.height+'px','border-radius':b.borderRadius+'px',opacity:b.opacity})},initEventsColumn:function(){a('.line3d').on('mouseover',function(b){a(b.currentTarget).find('.popuper').css('visibility','visible')}),a('.line3d').on('mouseout',function(b){a(b.currentTarget).find('.popuper').css('visibility','hidden')})},rotate:function(){this.angle=0,this.xdrag=0;var b=this,c=a(this._map._container);this._map.on('rotate',function(c,d){var a=-c.rotation;b.linedrawerNode.css({transform:'rotateY('+a+'deg)'}),b.popuperNode.css({transform:'rotateY('+a+'deg)'})})}});c.Bar3D=d,c.bar3d=function(a){return new c.Bar3D(a)},module.exports=d |
@@ -1,1 +0,1 @@ | ||
function a(b){this.options=c.deepMergeWithoutArray(a.options,b),this.ratio=0,this.reverseRatio=0,this.index=0,this.fade=1,this.reverseFade=0}var b=require('bcore/event'),c=require('bcore/utils'),d=require('leaflet');a.options={getLat:function(a){return a.lat},getLng:function(a){return a.lng},getValue:function(a){return a.value},getType:function(a){return a.type||'1'},offset:10,speed:.2,maxSize:30,minSize:10,opacity:1,animationType:'breathe',size:function(c,a,d){var b=(c-a)/(d-a);return b*(this.options.maxSize-this.options.minSize)+this.options.minSize}},a=b.extend(a,{addTo:function(a){if(!a)return;this.map=a,a.on('move',this.move,this),this.initCanvas()},initCanvas:function(){var a=this.map,b=a.getSize();this.canvas=d.DomUtil.create('canvas','leaflet-layer leaflet-zoom-hide'),this.canvas.width=b.x,this.canvas.height=b.y,this.canvas.style.pointerEvents='none',this.canvas.style.zIndex=301,a.getPanes().overlayPane.appendChild(this.canvas),this.ctx=this.canvas.getContext('2d')},resize:function(){var b=this.map.getSize();this.canvas.width=b.x,this.canvas.height=b.y;var a=d.DomUtil.getPosition(this.map.getPanes().mapPane);a&&d.DomUtil.setPosition(this.canvas,{x:-a.x,y:-a.y})},move:function(a){this.resize(),this.redraw()},render:function(a){if(!a)return;this.data(a)},data:function(d){if(!(d&&Array.isArray(d)))return;var f=this.options,g=f.getValue;this._data=d;var a,h,b,c;for(var e=0;e<d.length;e++)h=d[e],a=g(h),(b===null||b===undefined)&&(b=a),(c===null||c===undefined)&&(c=a),b>a&&(b=a),c<a&&(c=a);this.max=c,this.min=b,this.redraw()},redraw:function(){this.clear();var b=this.options,s=b.animationType,e=b.ratio,o=b.size.bind(this),t=b.getType,u=b.getValue,c=this.ctx,i,k,p,g,f,r,a,j,e,q,n,h=this._data,m=this.max,l=this.min;if(!h)return;switch(s){case'breathe':e=this.ratio;q=this.reverseRatio;break;case'fade':e=q=0;break;default:break}for(var d=0;d<h.length;d++)i=h[d],k=this.latLngToContainerPoint(i),g=k[0],f=k[1],j=u(i),r=t(i),d%2===0?(a=o(j,l,m)+q,n=this.fade):(a=o(j,l,m)+e,n=this.reverseFade),a=a<0?-a:a,p=c.createRadialGradient(g,f,0,g,f,a),this.addColorStop(r,p,n),c.fillStyle=p,c.beginPath(),c.arc(g,f,a,0,2*Math.PI),c.fill()},addColorStop:function(h,e,i){if(!e)return;var f=this.options,b=f.typeSeries,c,g,d;if(b.length)for(var a=0;a<b.length;a++)if(h===b[a].bubbleType){d=b[a].colorSeries;break}d||(d=b[0].colorSeries);for(var a=0;a<d.length;a++)serie=d[a],c=serie.percent,c>1&&(c=1),c<0&&(c=0),g=this.prefixColor(serie.color,i),e.addColorStop(c,g)},prefixColor:function(f,g){var b=f.match(/\d+/g),c=b[0]||255,d=b[1]||255,e=b[2]||255,a=b[3]||.9999,a=a>1?a/10:a,a=a>1?a/10:a,a=a*g;return'rgba('+c+','+d+','+e+','+a+')'},latLngToContainerPoint:function(a){if(!a)return;var b=this.options,e=b.getLat,f=b.getLng,g=this.map,c=g.latLngToContainerPoint(new d.LatLng(e(a),f(a)));return[c.x,c.y]},clear:function(){var a=this.ctx,b=a.canvas.width,c=a.canvas.height;a.clearRect(0,0,b,c)},updateOptions:function(a){a&&(this.options=c.deepMergeWithoutArray(this.options,a))},update:function(){var b=this.options,a=b.offset,c=b.speed,d=b.opacity,e=b.animationType;this.index<a?(this.ratio+=c,this.index+=c):a<=this.index&&this.index<2*a?(this.ratio-=c,this.index+=c):this.index>2*a&&(this.ratio=0,this.index=0),this.reverseRatio=a-this.ratio;switch(e){case'breathe':this.fade=d;this.reverseFade=d;break;case'fade':var f=2*a;this.fade=d*(this.ratio/a);this.reverseFade=+(d-this.fade);break;default:break}this.redraw()},remove:function(){this.map.getPanes().overlayPane.removeChild(this.canvas),this.map.off('move',this.move,this),this.canvas=null,this._data=null,this.ratio=0,this.reverseRatio=0,this.index=0,this.fade=1,this.reverseFade=0}});var e=d.dmap=d.dmap||{};e.Bubbles=a,e.bubbles=function(b){return new a(b)},module.exports=a | ||
function a(b){this.options=d.deepMergeWithoutArray(a.options,b),this.ratio=0,this.reverseRatio=0,this.index=0,this.fade=1,this.reverseFade=0}var f=require('bcore/event'),d=require('bcore/utils'),b=require('leaflet'),c=require('chroma-js');a.options={getLat:function(a){return a.lat},getLng:function(a){return a.lng},getValue:function(a){return a.value},getType:function(a){return a.type||'1'},offset:10,speed:.2,maxSize:30,minSize:10,opacity:1,animationType:'breathe',size:function(c,a,d){var b=(c-a)/(d-a);return b*(this.options.maxSize-this.options.minSize)+this.options.minSize}},a=f.extend(a,{addTo:function(a){if(!a)return;this.map=a,a.on('move',this.move,this),this.initCanvas()},initCanvas:function(){var a=this.map,c=a.getSize();this.canvas=b.DomUtil.create('canvas','leaflet-layer leaflet-zoom-hide'),this.canvas.width=c.x,this.canvas.height=c.y,this.canvas.style.pointerEvents='none',this.canvas.style.zIndex=301,a.getPanes().overlayPane.appendChild(this.canvas),this.ctx=this.canvas.getContext('2d')},resize:function(){var c=this.map.getSize();this.canvas.width=c.x,this.canvas.height=c.y;var a=b.DomUtil.getPosition(this.map.getPanes().mapPane);a&&b.DomUtil.setPosition(this.canvas,{x:-a.x,y:-a.y})},move:function(a){this.resize(),this.redraw()},render:function(a){if(!a)return;this.data(a)},data:function(d){if(!(d&&Array.isArray(d)))return;var f=this.options,g=f.getValue;this._data=d;var a,h,b,c;for(var e=0;e<d.length;e++)h=d[e],a=g(h),(b===null||b===undefined)&&(b=a),(c===null||c===undefined)&&(c=a),b>a&&(b=a),c<a&&(c=a);this.max=c,this.min=b,this.redraw()},redraw:function(){this.clear();var b=this.options,s=b.animationType,e=b.ratio,o=b.size.bind(this),t=b.getType,u=b.getValue,c=this.ctx,i,k,p,g,f,r,a,j,e,q,n,h=this._data,m=this.max,l=this.min;if(!h)return;switch(s){case'breathe':e=this.ratio;q=this.reverseRatio;break;case'fade':e=q=0;break;default:break}for(var d=0;d<h.length;d++)i=h[d],k=this.latLngToContainerPoint(i),g=k[0],f=k[1],j=u(i),r=t(i),d%2===0?(a=o(j,l,m)+q,n=this.fade):(a=o(j,l,m)+e,n=this.reverseFade),a=a<0?-a:a,p=c.createRadialGradient(g,f,0,g,f,a),this.addColorStop(r,p,n),c.fillStyle=p,c.beginPath(),c.arc(g,f,a,0,2*Math.PI),c.fill()},addColorStop:function(h,e,i){if(!e)return;var f=this.options,b=f.typeSeries,c,g,d;if(b.length)for(var a=0;a<b.length;a++)if(h===b[a].bubbleType){d=b[a].colorSeries;break}d||(d=b[0].colorSeries);for(var a=0;a<d.length;a++)serie=d[a],c=serie.percent,c>1&&(c=1),c<0&&(c=0),g=this.prefixColor(serie.color,i),e.addColorStop(c,g)},prefixColor:function(b,g){var d=c(b).get('rgba.r'),e=c(b).get('rgba.g'),f=c(b).get('rgba.b'),a=c(b).alpha(),a=a*g;return'rgba('+d+','+e+','+f+','+a+')'},latLngToContainerPoint:function(a){if(!a)return;var c=this.options,e=c.getLat,f=c.getLng,g=this.map,d=g.latLngToContainerPoint(new b.LatLng(e(a),f(a)));return[d.x,d.y]},clear:function(){var a=this.ctx,b=a.canvas.width,c=a.canvas.height;a.clearRect(0,0,b,c)},updateOptions:function(a){a&&(this.options=d.deepMergeWithoutArray(this.options,a))},update:function(){var b=this.options,a=b.offset,c=b.speed,d=b.opacity,e=b.animationType;this.index<a?(this.ratio+=c,this.index+=c):a<=this.index&&this.index<2*a?(this.ratio-=c,this.index+=c):this.index>2*a&&(this.ratio=0,this.index=0),this.reverseRatio=a-this.ratio;switch(e){case'breathe':this.fade=d;this.reverseFade=d;break;case'fade':var f=2*a;this.fade=d*(this.ratio/a);this.reverseFade=+(d-this.fade);break;default:break}this.redraw()},remove:function(){this.map.getPanes().overlayPane.removeChild(this.canvas),this.map.off('move',this.move,this),this.canvas=null,this._data=null,this.ratio=0,this.reverseRatio=0,this.index=0,this.fade=1,this.reverseFade=0}});var e=b.dmap=b.dmap||{};e.Bubbles=a,e.bubbles=function(b){return new a(b)},module.exports=a |
@@ -1,1 +0,1 @@ | ||
'use strict';function b(){return new Date().getTime()/1e3}function g(a){return a&&a.touches&&a.touches.length>1}var c=require('./../leaflet'),d=require('./../core/utils'),e=d.isNone,f=require('./../core/utils').getColorFunc,a=require('turf-distance'),h=require('turf-line-distance'),i=require('turf-simplify'),j=require('concaveman'),k=c.Class.extend({includes:[c.Mixin.Events],initialize:function(a){this.options=d.deepMerge(k.options,a)},addTo:function(a){return this._map=a,this.initEvents(),this},initEvents:function(){var b=this._map,a=b._container;c.Browser.touch?(c.DomEvent.on(a,'touchstart',this.onMousedown,this),c.DomEvent.on(a,'touchmove',this.onMousemove,this),c.DomEvent.on(a,'touchend',this.onMouseup,this)):b.on('mousedown',this.onMousedown.bind(this)).on('mousemove',this.onMousemove.bind(this)).on('mouseup',this.onMouseup.bind(this))},getLatlng:function(e){var b=e.touches[0],a=this._map,c=a.mouseEventToContainerPoint({clientX:b.clientX,clientY:b.clientY}),d=a.containerPointToLayerPoint(c);return a.layerPointToLatLng(d)},onMousedown:function(a){if(!this.isable||g(a))return;this.fire('draw-start'),this.isdown=!0;var c=a.latlng||this.getLatlng(a);this.latlngs=[c],this.curT=b()},onMousemove:function(a){if(!(this.isable&&this.isdown)||g(a))return;var b=a.latlng||this.getLatlng(a);this.latlngs.push(b),this.curCurve?this.curCurve.setLatLngs(this.latlngs):this.curCurve=c.polyline(this.latlngs,this.options.editing).addTo(this._map)},onMouseup:function(a){if(this.isdown=!1,!this.isable||g(a))return;this.finalize(this.curCurve)},finalize:function(h){var a=this.options;if(!h&&a.point.isable){var f=this.latlngs[0];if(!f)return;var d=a.point.normal,g=c.circleMarker(f,d).addTo(this._map);g.setRadius(d.radius||d.r),g.on('mousedown',function(a){return c.DomEvent.stopPropagation(a),!1});return}var j=this.getFactor(),b=h.toGeoJSON(),k=this.isPolygon(b),e=i(b,j,!0);a.printAfterMouseDown&&console.log(JSON.stringify(e)),this.fire('draw-end',{data:e});var b=c.geoJson(e,{style:k?a.polygon.normal:a.polyline.normal}).addTo(this._map);this.latlngs=[],this._map.removeLayer(this.curCurve),this.curCurve=null},isPolygon:function(e){var f,g=h(e,'meters'),a=e.geometry.coordinates,b=a[0],d=a[a.length-1];return f=c.latLng(b[1],b[0]).distanceTo(c.latLng(d[1],d[0])),f/g<this.options.polygonK?(a.push(b),!0):!1},getFactor:function(){var d=this.options.digits,a=this._map,c=a.getCenter(),e=a.latLngToContainerPoint(c),b=e.clone();b.x=b.x+d;var f=a.containerPointToLatLng(b);return f.lng-c.lng},enable:function(){this.isable=!0,this.disableMap()},disable:function(){this.isable=!1,this.enableMap()},switch:function(){return this.isable?this.disable():this.enable()},enableMap:function(){var a=this._map;if(!a)return;a.dragging.enable()},disableMap:function(){var a=this._map;if(!a)return;a.dragging.disable()}});k.options={digits:4,polygonK:.1,printAfterMouseDown:!1,editing:{dashArray:'2,9',weight:2,opacity:.8,color:'#f00'},polyline:{isable:!0,normal:{weight:5,opacity:1,color:'#0ff'}},polygon:{isable:!0,normal:{weight:2,opacity:1,fillOpacity:.5,color:'rgba(0,200,200,0.8)',fill:'rgba(0,200,200,0.8)'}},point:{isable:!0,normal:{r:10,fillColor:'rgba(0,200,200,0.8)',color:'transparent',fillOpacity:.8}}};var l=c.dmap=c.dmap||{};l.Draw=k,l.draw=function(a){return new k(a)},module.exports=k | ||
'use strict';function k(){return new Date().getTime()/1e3}function e(a){return a&&a.touches&&a.touches.length>1}var a=require('./../leaflet'),d=require('./../core/utils'),h=d.isNone,i=require('./../core/utils').getColorFunc,l=require('turf-distance'),f=require('turf-line-distance'),g=require('turf-simplify'),j=require('concaveman'),b=a.Class.extend({includes:[a.Mixin.Events],initialize:function(a){this.options=d.deepMerge(b.options,a)},addTo:function(a){return this._map=a,this.initEvents(),this},initEvents:function(){var c=this._map,b=c._container;a.Browser.touch?(a.DomEvent.on(b,'touchstart',this.onMousedown,this),a.DomEvent.on(b,'touchmove',this.onMousemove,this),a.DomEvent.on(b,'touchend',this.onMouseup,this)):c.on('mousedown',this.onMousedown.bind(this)).on('mousemove',this.onMousemove.bind(this)).on('mouseup',this.onMouseup.bind(this))},getLatlng:function(e){var b=e.touches[0],a=this._map,c=a.mouseEventToContainerPoint({clientX:b.clientX,clientY:b.clientY}),d=a.containerPointToLayerPoint(c);return a.layerPointToLatLng(d)},onMousedown:function(a){if(!this.isable||e(a))return;this.fire('draw-start'),this.isdown=!0;var b=a.latlng||this.getLatlng(a);this.latlngs=[b],this.curT=k()},onMousemove:function(b){if(!(this.isable&&this.isdown)||e(b))return;var c=b.latlng||this.getLatlng(b);this.latlngs.push(c),this.curCurve?this.curCurve.setLatLngs(this.latlngs):this.curCurve=a.polyline(this.latlngs,this.options.editing).addTo(this._map)},onMouseup:function(a){if(this.isdown=!1,!this.isable||e(a))return;this.finalize(this.curCurve)},finalize:function(i){var b=this.options;if(!i&&b.point.isable){var f=this.latlngs[0];if(!f)return;var d=b.point.normal,h=a.circleMarker(f,d).addTo(this._map);h.setRadius(d.radius||d.r),h.on('mousedown',function(b){return a.DomEvent.stopPropagation(b),!1});return}var j=this.getFactor(),c=i.toGeoJSON(),k=this.isPolygon(c),e=g(c,j,!0);b.printAfterMouseDown&&console.log(JSON.stringify(e)),this.fire('draw-end',{data:e});var c=a.geoJson(e,{style:k?b.polygon.normal:b.polyline.normal}).addTo(this._map);this.latlngs=[],this._map.removeLayer(this.curCurve),this.curCurve=null},isPolygon:function(e){var g,h=f(e,'meters'),b=e.geometry.coordinates,c=b[0],d=b[b.length-1];return g=a.latLng(c[1],c[0]).distanceTo(a.latLng(d[1],d[0])),g/h<this.options.polygonK?(b.push(c),!0):!1},getFactor:function(){var d=this.options.digits,a=this._map,c=a.getCenter(),e=a.latLngToContainerPoint(c),b=e.clone();b.x=b.x+d;var f=a.containerPointToLatLng(b);return f.lng-c.lng},enable:function(){this.isable=!0,this.disableMap()},disable:function(){this.isable=!1,this.enableMap()},switch:function(){return this.isable?this.disable():this.enable()},enableMap:function(){var a=this._map;if(!a)return;a.dragging.enable()},disableMap:function(){var a=this._map;if(!a)return;a.dragging.disable()}});b.options={digits:4,polygonK:.1,printAfterMouseDown:!1,editing:{dashArray:'2,9',weight:2,opacity:.8,color:'#f00'},polyline:{isable:!0,normal:{weight:5,opacity:1,color:'#0ff'}},polygon:{isable:!0,normal:{weight:2,opacity:1,fillOpacity:.5,color:'rgba(0,200,200,0.8)',fill:'rgba(0,200,200,0.8)'}},point:{isable:!0,normal:{r:10,fillColor:'rgba(0,200,200,0.8)',color:'transparent',fillOpacity:.8}}};var c=a.dmap=a.dmap||{};c.Draw=b,c.draw=function(a){return new b(a)},module.exports=b |
@@ -1,1 +0,1 @@ | ||
var a=require('./../map/map'),b=require('./../leaflet');require('./edit_circle.css');var c=require('bcore/utils'),d=b.Circle.extend({options:{infoNode:{className:'leaflet-edit-node no-events'}},initialize:function(c,d,a){b.Circle.prototype.initialize.call(this,c,d,a),opt=b.setOptions(a),this.id=this.options.id},addTo:function(a){return b.Circle.prototype.addTo.call(this,a),this._initEditDot(),this.addEvents(),this.addEventsEditDot(),this._onMovingEnd(),this._initInfoMarker(),this._updateCommon(),this},addEvents:function(){var a=this,b=this._container;b.addEventListener('mousedown',function(b){a._disableMarker(),a.isDown=!0}),b.addEventListener('mousemove',a._onMoving.bind(a)),b.addEventListener('mouseover',a._onHover.bind(a)),b.addEventListener('mouseout',a._onMovingEnd.bind(a)),b.addEventListener('mouseup',function(b){a.isDown=!1,a.infoMarker&&(a.infoMarker._icon.innerHTML='')})},addInfo:function(a){if(!a)return;this.info=a},addEventsEditDot:function(){var a=this,d=this.editRadiusDot,c=d._container,e=this._map;c.addEventListener('mouseover',function(a){d.setStyle({fillOpacity:.9}),a.stopPropagation(),b.DomEvent.stopPropagation(a)}),c.addEventListener('mousedown',function(c){a._initInfoMarker(),a._disableMarker(),a.isDotDown=!0,c.stopPropagation(),b.DomEvent.stopPropagation(c)}),c.addEventListener('mousemove',a._onScaling.bind(a)),c.addEventListener('mouseup',function(b){a.isDotDown=!1}),c.addEventListener('mouseout',function(b){a._onScalingEnd()})},_initEditDot:function(){var a=this.editRadiusDot=b.circleMarker(this._latlng,{radius:15,weight:0,fillColor:'#0ff',fillOpacity:0}).addTo(this._map);this._updateEditDotPos()},_initInfoMarker:function(){if(this.infoMarker)return;var a;if(!(a=this.options.infoNode))return;var c=this.icon=b.divIcon({className:a.className,html:'',iconSize:null});this.infoMarker=b.marker(this._latlng,{icon:c}).addTo(this._map)},_onHover:function(b){if(this.isEdit)return;var a=this.infoMarker._icon;a.setAttribute('class','leaflet-edit-node leaflet-edit-node-submit'),a.innerHTML='删除',this.editRadiusDot.setStyle({fillOpacity:.8}),this.setStyle({dashArray:'12, 6',weight:'2',color:'#0ff'}),b.stopPropagation()},_onMoving:function(a){if(a.stopPropagation(),b.DomEvent.stopPropagation(a),!this.isDown)return;this.isEdit=!0,this._updateCenterPos(a),this._updateInfoMoving(),this.updateEditing()},_disableMarker:function(){var a=this.infoMarker._icon;a.setAttribute('class','leaflet-edit-node no-events')},_updateMarkerPos:function(a){this.infoMarker.setLatLng(a)},_updateCenterPos:function(c){var a=this._map,d=a.mouseEventToContainerPoint(c),e=a.containerPointToLayerPoint(d),b=a.layerPointToLatLng(e);this.setLatLng(b),this._updateMarkerPos(b),c.stopPropagation(),this._updateEditDotPos()},_updateEditDotPos:function(){var c=this._getLngRadius(),a=this._latlng,d=b.latLng(a.lat,a.lng+c);this.editRadiusDot.setLatLng(d)},_onMovingEnd:function(a){if(this.isDown=!1,this.isEdit)return this.updateEdited();this.editRadiusDot.setStyle({fillOpacity:0}),this.setStyle({weight:2,dashArray:'',color:'#0ff'}),a&&b.DomEvent.stopPropagation(a),a&&a.stopPropagation()},_onScaling:function(e){if(!this.isDotDown)return;this.isEdit=!0;var f=this.editRadiusDot,a=this._map,g=a.mouseEventToContainerPoint(e),h=a.containerPointToLayerPoint(g),c=a.layerPointToLatLng(h);f.setLatLng(c);var d=this._latlng,i=d.distanceTo(b.latLng(d.lat,c.lng));this.setRadius(i),this._updateInfoScaling(),e.stopPropagation(),this.updateEditing()},_onScalingEnd:function(){if(this.isDotDown=!1,this.isEdit)return this.updateEdited();this._updateCommon()},_updateInfoMoving:function(){var a='经度'+this._latlng.lat.toFixed(5)+' | '+'纬度'+this._latlng.lng.toFixed(5);this.infoMarker._icon.innerHTML=a},_updateInfoScaling:function(){var a='半径 '+parseInt(this.getRadius())+'米';this.infoMarker._icon.innerHTML=a},_updateCommon:function(){this.editRadiusDot.setStyle({fillColor:'#0ff'}),this.setStyle({color:'#0ff',dashArray:''});var a=this.infoMarker._icon;a.setAttribute('class','leaflet-edit-node no-events'),a.innerHTML='',this._addButtonDeleteEvent()},updateEditing:function(){this.editRadiusDot.setStyle({fillColor:'#930'}),this.setStyle({color:'#930',dashArray:'12, 6'})},updateEdited:function(){if(this.editRadiusDot.setStyle({fillColor:'#930'}),this.setStyle({color:'#930',dashArray:'12, 6'}),this.infoMarker){var a=this.infoMarker._icon;a.setAttribute('class','leaflet-edit-node leaflet-edit-node-submit'),a.innerHTML=this.isUploading?'上传中..':'提交',this._addButtonSubmitEvent()}},_onOperationEnd:function(){if(this.isEdit)return this.updateEdited();this._updateCommon()},_addButtonSubmitEvent:function(){this.infoMarker._icon.removeEventListener('click'),this.infoMarker._icon.addEventListener('click',this._onSubmit.bind(this))},_addButtonDeleteEvent:function(){this.infoMarker._icon.removeEventListener('click'),this.infoMarker._icon.addEventListener('click',this._onDelete.bind(this))},_onDelete:function(){this.isUploading=!0,this.infoMarker._icon.innerHTML='删除中..',this.fire('delete')},_onSubmit:function(){this.isUploading=!0,console.log(this.infoMarker,this),this.infoMarker._icon.innerHTML='上传中..',this.fire('upload')},onCreateCallback:function(a){this.id=a,this.isUploading=!1,this.isEdit=!1,this.infoMarker._icon.removeEventListener('click'),this._updateCommon()},onModifyCallback:function(a){this.isUploading=!1,this.isEdit=!1,this.infoMarker._icon.removeEventListener('click'),this._updateCommon()},_onDeleteCallback:function(){this.destory()},destory:function(){var a=this._map;this.editRadiusDot&&a.removeLayer(this.editRadiusDot),this.infoMarker&&a.removeLayer(this.infoMarker),a.removeLayer(this)}});module.exports=d | ||
var c=require('./../map/map'),a=require('./../leaflet');require('./edit_circle.css');var d=require('bcore/utils'),b=a.Circle.extend({options:{infoNode:{className:'leaflet-edit-node no-events'}},initialize:function(c,d,b){a.Circle.prototype.initialize.call(this,c,d,b),opt=a.setOptions(b),this.id=this.options.id},addTo:function(b){return a.Circle.prototype.addTo.call(this,b),this._initEditDot(),this.addEvents(),this.addEventsEditDot(),this._onMovingEnd(),this._initInfoMarker(),this._updateCommon(),this},addEvents:function(){var a=this,b=this._container;b.addEventListener('mousedown',function(b){a._disableMarker(),a.isDown=!0}),b.addEventListener('mousemove',a._onMoving.bind(a)),b.addEventListener('mouseover',a._onHover.bind(a)),b.addEventListener('mouseout',a._onMovingEnd.bind(a)),b.addEventListener('mouseup',function(b){a.isDown=!1,a.infoMarker&&(a.infoMarker._icon.innerHTML='')})},addInfo:function(a){if(!a)return;this.info=a},addEventsEditDot:function(){var b=this,d=this.editRadiusDot,c=d._container,e=this._map;c.addEventListener('mouseover',function(b){d.setStyle({fillOpacity:.9}),b.stopPropagation(),a.DomEvent.stopPropagation(b)}),c.addEventListener('mousedown',function(c){b._initInfoMarker(),b._disableMarker(),b.isDotDown=!0,c.stopPropagation(),a.DomEvent.stopPropagation(c)}),c.addEventListener('mousemove',b._onScaling.bind(b)),c.addEventListener('mouseup',function(a){b.isDotDown=!1}),c.addEventListener('mouseout',function(a){b._onScalingEnd()})},_initEditDot:function(){var b=this.editRadiusDot=a.circleMarker(this._latlng,{radius:15,weight:0,fillColor:'#0ff',fillOpacity:0}).addTo(this._map);this._updateEditDotPos()},_initInfoMarker:function(){if(this.infoMarker)return;var b;if(!(b=this.options.infoNode))return;var c=this.icon=a.divIcon({className:b.className,html:'',iconSize:null});this.infoMarker=a.marker(this._latlng,{icon:c}).addTo(this._map)},_onHover:function(b){if(this.isEdit)return;var a=this.infoMarker._icon;a.setAttribute('class','leaflet-edit-node leaflet-edit-node-submit'),a.innerHTML='删除',this.editRadiusDot.setStyle({fillOpacity:.8}),this.setStyle({dashArray:'12, 6',weight:'2',color:'#0ff'}),b.stopPropagation()},_onMoving:function(b){if(b.stopPropagation(),a.DomEvent.stopPropagation(b),!this.isDown)return;this.isEdit=!0,this._updateCenterPos(b),this._updateInfoMoving(),this.updateEditing()},_disableMarker:function(){var a=this.infoMarker._icon;a.setAttribute('class','leaflet-edit-node no-events')},_updateMarkerPos:function(a){this.infoMarker.setLatLng(a)},_updateCenterPos:function(c){var a=this._map,d=a.mouseEventToContainerPoint(c),e=a.containerPointToLayerPoint(d),b=a.layerPointToLatLng(e);this.setLatLng(b),this._updateMarkerPos(b),c.stopPropagation(),this._updateEditDotPos()},_updateEditDotPos:function(){var c=this._getLngRadius(),b=this._latlng,d=a.latLng(b.lat,b.lng+c);this.editRadiusDot.setLatLng(d)},_onMovingEnd:function(b){if(this.isDown=!1,this.isEdit)return this.updateEdited();this.editRadiusDot.setStyle({fillOpacity:0}),this.setStyle({weight:2,dashArray:'',color:'#0ff'}),b&&a.DomEvent.stopPropagation(b),b&&b.stopPropagation()},_onScaling:function(e){if(!this.isDotDown)return;this.isEdit=!0;var f=this.editRadiusDot,b=this._map,g=b.mouseEventToContainerPoint(e),h=b.containerPointToLayerPoint(g),c=b.layerPointToLatLng(h);f.setLatLng(c);var d=this._latlng,i=d.distanceTo(a.latLng(d.lat,c.lng));this.setRadius(i),this._updateInfoScaling(),e.stopPropagation(),this.updateEditing()},_onScalingEnd:function(){if(this.isDotDown=!1,this.isEdit)return this.updateEdited();this._updateCommon()},_updateInfoMoving:function(){var a='经度'+this._latlng.lat.toFixed(5)+' | '+'纬度'+this._latlng.lng.toFixed(5);this.infoMarker._icon.innerHTML=a},_updateInfoScaling:function(){var a='半径 '+parseInt(this.getRadius())+'米';this.infoMarker._icon.innerHTML=a},_updateCommon:function(){this.editRadiusDot.setStyle({fillColor:'#0ff'}),this.setStyle({color:'#0ff',dashArray:''});var a=this.infoMarker._icon;a.setAttribute('class','leaflet-edit-node no-events'),a.innerHTML='',this._addButtonDeleteEvent()},updateEditing:function(){this.editRadiusDot.setStyle({fillColor:'#930'}),this.setStyle({color:'#930',dashArray:'12, 6'})},updateEdited:function(){if(this.editRadiusDot.setStyle({fillColor:'#930'}),this.setStyle({color:'#930',dashArray:'12, 6'}),this.infoMarker){var a=this.infoMarker._icon;a.setAttribute('class','leaflet-edit-node leaflet-edit-node-submit'),a.innerHTML=this.isUploading?'上传中..':'提交',this._addButtonSubmitEvent()}},_onOperationEnd:function(){if(this.isEdit)return this.updateEdited();this._updateCommon()},_addButtonSubmitEvent:function(){this.infoMarker._icon.removeEventListener('click'),this.infoMarker._icon.addEventListener('click',this._onSubmit.bind(this))},_addButtonDeleteEvent:function(){this.infoMarker._icon.removeEventListener('click'),this.infoMarker._icon.addEventListener('click',this._onDelete.bind(this))},_onDelete:function(){this.isUploading=!0,this.infoMarker._icon.innerHTML='删除中..',this.fire('delete')},_onSubmit:function(){this.isUploading=!0,console.log(this.infoMarker,this),this.infoMarker._icon.innerHTML='上传中..',this.fire('upload')},onCreateCallback:function(a){this.id=a,this.isUploading=!1,this.isEdit=!1,this.infoMarker._icon.removeEventListener('click'),this._updateCommon()},onModifyCallback:function(a){this.isUploading=!1,this.isEdit=!1,this.infoMarker._icon.removeEventListener('click'),this._updateCommon()},_onDeleteCallback:function(){this.destory()},destory:function(){var a=this._map;this.editRadiusDot&&a.removeLayer(this.editRadiusDot),this.infoMarker&&a.removeLayer(this.infoMarker),a.removeLayer(this)}});module.exports=b |
@@ -1,1 +0,1 @@ | ||
var a=require('./../map/map'),b=require('bcore/event'),c=require('bcore/utils'),d=require('./edit_circle'),e=require('./../leaflet'),f=b.extend({options:{},initialize:function(a){a=this.options=c.deepMerge(this.options,a)},addTo:function(a){this._map=a},addCircle:function(e){var a=this._map,b=1e3,c=new d(e,b,{id:null}).addTo(a);this.initEventsCircle(c)},render:function(e){var f=this.circles=[],a,g,b,c,h,i=this._map;for(var j in e)a=e[j],b=a.id,c=a.center,h=a.radius,g=f[b]=new d([c.lat,c.lng],h,{id:b}).addTo(i),this.initEventsCircle(g)},initEventsCircle:function(b){var a=this;b.on('upload',function(){var c=this._latlng,f=this.getRadius(),d={type:'circle',unit:'m',lat:c.lat,lng:c.lng,radius:f},e={query:d,circle:b};if(this.id)return d.id=this.id,a.emit('modify',e);a.emit('create',e)}).on('delete',function(){if(this._onDeleteCallback(),this.id===null||this.id===undefined)return;a.emit('delete',{id:this.id})})}});e.dmap=e.dmap||{},e.dmap.editCircles=function(a){return new f(a)},module.exports=f | ||
var f=require('./../map/map'),d=require('bcore/event'),e=require('bcore/utils'),b=require('./edit_circle'),a=require('./../leaflet'),c=d.extend({options:{},initialize:function(a){a=this.options=e.deepMerge(this.options,a)},addTo:function(a){this._map=a},addCircle:function(e){var a=this._map,c=1e3,d=new b(e,c,{id:null}).addTo(a);this.initEventsCircle(d)},render:function(e){var f=this.circles=[],a,g,c,d,h,i=this._map;for(var j in e)a=e[j],c=a.id,d=a.center,h=a.radius,g=f[c]=new b([d.lat,d.lng],h,{id:c}).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})})}});a.dmap=a.dmap||{},a.dmap.editCircles=function(a){return new c(a)},module.exports=c |
@@ -1,1 +0,1 @@ | ||
function a(a,b,c,d){return typeof a==='function'?a(b,c,d):a}var b=require('./../leaflet'),c=require('./../render/canvas');require('./../core/utils');var d=b.dmap=b.dmap||{},e=d.Utils,f=e.getSprite,g=b.Class.extend({includes:[b.Mixin.Events],initialize:function(a){a=this.options=e.deepMerge(g.options,a),this.isable=!0},disable:function(){this.isable=!1},enable:function(){this.isable=!0},addTo:function(a){if(this._map||!a)return;this._map=a,this.initCanvas(),this.initEventsMap(),this.updateBlending()},initCanvas:function(){var b=this._map,a=this.options,d=a.container;this.dCanvas=new c(b,d,a)},data:function(a,c){var d=this.options.sort;a=_.sortBy(a,d),c=c||{};var f=this.map,e=this;this._data=a,this.transfer=c.transfer||function(a,c){return e._map.latLngToContainerPoint(b.latLng(a,c))},this.valueFunc=function(a){return a.value}},updateOptions:function(a){a&&(this.options=e.deepMerge(this.options,a)),this.updateBlending(),this.draw()},updateSprite:function(a){return a=a||this.options.sprite,a=f(a),a},updateFilter:function(a){if(!a||typeof a!=='function')return;this.options.filter=a,this.draw()},updateBlending:function(a){if(a)return this.dCanvas.ctx.globalCompositeOperation=this.options.blending=a;this.dCanvas.ctx.globalCompositeOperation=this.options.blending},render:function(a,b){a&&this.data(a),this.draw(b)},updateGrid:function(){var c=this._data;if(!c)return;var a=500,b={};c.forEach(function(d){var f=Math.floor(d.lat*a)/a+'_'+Math.floor(d.lng*a)/a,c=b[f];if(c){var e=c.count+1;c.vx=(c.vx*c.count+d.vx)/e,c.vy=(c.vy*c.count+d.vy)/e,c.lat=(c.lat*c.count+d.lat)/e,c.lng=(c.lng*c.count+d.lng)/e,c.count=e}else b[f]={vx:d.vx,vy:d.vy,lat:d.lat,lng:d.lng,count:1}}),this.dataAggregate=_.values(b)},draw:function(t){(t===!0||t===undefined)&&this.clean();var J=this._map,I=this._map.getZoom(),a=this.options,i=!0,n=this.options.filter;if(!this.isable)return;var s=this.transfer;this.updateGrid();var j=this.dataAggregate,H=this.valueFunc,G=this.sprites,d=this.dCanvas,y=a.lng,z=a.lat,p=a.vx,q=a.vy,F=d.w,E=d.h,c,g,k,l,m,f,o,A,B=e.getColorFunc(a.stroke),D=a.groups;for(var C in j){if(c=j[C],!c)continue;if(n&&(i=n(c)),!i)continue;if(g=e.switchValue(y,c),k=e.switchValue(z,c),o=e.switchValue(p,c),A=e.switchValue(q,c),l=s(k,g),!(g&&k))continue;m=l.x,f=l.y;var b=d.ctx;b.beginPath();var h=a.maxLength,w=Math.max(Math.min(1,o/1e3),-1),v=w*h,r=Math.max(Math.min(1,A/1e3),-1),x=r*h,u=Math.max(Math.min(1,(Math.abs(o)+Math.abs(f))/800),0);b.strokeStyle=B(u),b.lineWidth=a.weight,b.moveTo(m,f),b.lineTo(m+v,f+x),b.stroke(),b.closePath()}},clean:function(a){this.dCanvas.clear(a)},initEventsMap:function(){this.dCanvas.onUpdate(function(){this.draw()}.bind(this))},destroy:function(){this.dCanvas.destroy()}});g.options={lng:e.getLng,lat:e.getLat,vx:function(a){return a.vx},vy:function(a){return a.vy},filter:function(a){return 1},weight:1,blending:'source-over',container:'tilePane',stroke:{from:'rgba(0,233,333,0.2)',to:'rgba(233, 0, 0, 0.5)',space:'hsl',easing:'linear.Out.3'},maxLength:30,sort:function(a){return-Math.abs(a.vx)+Math.abs(a.vy)},sprite:{drawN:1.15,color:{from:'rgba(245,230,0,0.3)',to:'rgba(245,245,0,0.04)',easing:'Linear.None.1.7',space:'rgb'}}},d.FlowGrid=g,d.flowGrid=function(a){return new g(a)},module.exports=g | ||
function g(a,b,c,d){return typeof a==='function'?a(b,c,d):a}var b=require('./../leaflet'),e=require('./../render/canvas');require('./../core/utils');var d=b.dmap=b.dmap||{},a=d.Utils,f=a.getSprite,c=b.Class.extend({includes:[b.Mixin.Events],initialize:function(b){b=this.options=a.deepMerge(c.options,b),this.isable=!0},disable:function(){this.isable=!1},enable:function(){this.isable=!0},addTo:function(a){if(this._map||!a)return;this._map=a,this.initCanvas(),this.initEventsMap(),this.updateBlending()},initCanvas:function(){var b=this._map,a=this.options,c=a.container;this.dCanvas=new e(b,c,a)},data:function(a,c){var d=this.options.sort;a=_.sortBy(a,d),c=c||{};var f=this.map,e=this;this._data=a,this.transfer=c.transfer||function(a,c){return e._map.latLngToContainerPoint(b.latLng(a,c))},this.valueFunc=function(a){return a.value}},updateOptions:function(b){b&&(this.options=a.deepMerge(this.options,b)),this.updateBlending(),this.draw()},updateSprite:function(a){return a=a||this.options.sprite,a=f(a),a},updateFilter:function(a){if(!a||typeof a!=='function')return;this.options.filter=a,this.draw()},updateBlending:function(a){if(a)return this.dCanvas.ctx.globalCompositeOperation=this.options.blending=a;this.dCanvas.ctx.globalCompositeOperation=this.options.blending},render:function(a,b){a&&this.data(a),this.draw(b)},updateGrid:function(){var c=this._data;if(!c)return;var a=500,b={};c.forEach(function(d){var f=Math.floor(d.lat*a)/a+'_'+Math.floor(d.lng*a)/a,c=b[f];if(c){var e=c.count+1;c.vx=(c.vx*c.count+d.vx)/e,c.vy=(c.vy*c.count+d.vy)/e,c.lat=(c.lat*c.count+d.lat)/e,c.lng=(c.lng*c.count+d.lng)/e,c.count=e}else b[f]={vx:d.vx,vy:d.vy,lat:d.lat,lng:d.lng,count:1}}),this.dataAggregate=_.values(b)},draw:function(t){(t===!0||t===undefined)&&this.clean();var J=this._map,I=this._map.getZoom(),b=this.options,i=!0,n=this.options.filter;if(!this.isable)return;var s=this.transfer;this.updateGrid();var j=this.dataAggregate,H=this.valueFunc,G=this.sprites,e=this.dCanvas,y=b.lng,z=b.lat,p=b.vx,q=b.vy,F=e.w,E=e.h,d,g,k,l,m,f,o,A,B=a.getColorFunc(b.stroke),D=b.groups;for(var C in j){if(d=j[C],!d)continue;if(n&&(i=n(d)),!i)continue;if(g=a.switchValue(y,d),k=a.switchValue(z,d),o=a.switchValue(p,d),A=a.switchValue(q,d),l=s(k,g),!(g&&k))continue;m=l.x,f=l.y;var c=e.ctx;c.beginPath();var h=b.maxLength,w=Math.max(Math.min(1,o/1e3),-1),v=w*h,r=Math.max(Math.min(1,A/1e3),-1),x=r*h,u=Math.max(Math.min(1,(Math.abs(o)+Math.abs(f))/800),0);c.strokeStyle=B(u),c.lineWidth=b.weight,c.moveTo(m,f),c.lineTo(m+v,f+x),c.stroke(),c.closePath()}},clean:function(a){this.dCanvas.clear(a)},initEventsMap:function(){this.dCanvas.onUpdate(function(){this.draw()}.bind(this))},destroy:function(){this.dCanvas.destroy()}});c.options={lng:a.getLng,lat:a.getLat,vx:function(a){return a.vx},vy:function(a){return a.vy},filter:function(a){return 1},weight:1,blending:'source-over',container:'tilePane',stroke:{from:'rgba(0,233,333,0.2)',to:'rgba(233, 0, 0, 0.5)',space:'hsl',easing:'linear.Out.3'},maxLength:30,sort:function(a){return-Math.abs(a.vx)+Math.abs(a.vy)},sprite:{drawN:1.15,color:{from:'rgba(245,230,0,0.3)',to:'rgba(245,245,0,0.04)',easing:'Linear.None.1.7',space:'rgb'}}},d.FlowGrid=c,d.flowGrid=function(a){return new c(a)},module.exports=c |
@@ -1,1 +0,1 @@ | ||
function b(a,b){this.u=a,this.v=b,this.m=Math.sqrt(a*a+b*b)}function i(a,b,c,d){this.grid=a,this.extent=b,this.dx=c,this.dy=d}function c(a,b,c){this.x=a,this.y=b,this.oldX=-1,this.oldY=-1,this.life=c}var d=require('./webgl_heatmap/CanvasLayerBase.js'),e=require('chroma-js'),f=d.extend({options:{start_color:'rgba(0, 255, 255, 0.5)',end_color:'rgba(255, 30, 219, 0.5)',fade:1,maxIntensity:17,velocityScale:1,lineWidth:2,fadeFillStyle:'rgba(0, 0, 0, 0.97)',life:80,strokeStyle:'rgb(227, 238, 238)',particles_factor:1},initialize:function(a){L.setOptions(this,a)},updateOptions:function(a){L.setOptions(this,a),this._reset()},setData:function(a){this.data=a,this._initVectorField(),this._reset()},_initVectorField:function(){var a=this.data;if(!(a&&a.data&&a.data.length>0))return;var s=a.lo1||0,t=a.la1||90,m=a.lo2||359,n=a.la2||-90,f=a.dx||1,r=a.dy||1,g=a.nx||360,l=a.ny||181,h=[],j=0,o=a.data,p=Math.floor(g*f)>=360;for(var d=0;d<l;d++){var c=[];for(var e=0;e<g;e++,j++){var k=o[j];c[e]=new b(k[0],k[1])}p&&c.push(c[0]),h[d]=c}var q={lng_min:s,lat_min:n,lng_max:m,lat_max:t};this.vectorField=new i(h,q,f,r)},interpolateLngLat:function(t,s){if(Math.abs(s)>=85.0511287798)return new b(NaN,NaN);var c=this.vectorField,q=c.extent,h=g(t-q.lng_min,360)/c.dx,i=(q.lat_max-s)/c.dy,d=Math.floor(h),f=d+1,e=Math.floor(i),r=e+1,o=c.grid,a;if(a=o[e]){var n=a[d],l=a[f];if(j(n)&&j(l)&&(a=o[r])){var k=a[d],m=a[f];if(j(k)&&j(m))return p(h-d,i-e,n,l,k,m)}}return new b(NaN,NaN)},columns:[],_initColumns:function(){var d=this.getMapBounds(),h=this.columns,o=(d.south-d.north)*(d.west-d.east),j=this._map.getBounds(),m=this.width*180/(20037508.34*(j.getEast()-j.getWest())),n=this.options.velocityScale*1e-6/m;for(var a=0;a<=this.width;a+=2){var f=[];for(var b=0;b<=this.height;b+=2){var l=this._map.containerPointToLatLng([a,b]),g=[l.lng,l.lat];if(g){var e=g[0],i=g[1];if(isFinite(e)){var c=this.interpolateLngLat(e,i);c&&!Array.isArray(c)&&(c=k(e,i,a,b,n,c,d)),f[b+1]=f[b]=c}}}h[a+1]=h[a]=f}},getVectorAtXY:function(b,c){var a=this._map.containerPointToLatLng(L.point(b,c));return this.interpolateLngLat(a.lng,a.lat)},getField:function(c,d){var a=this.columns[Math.round(c)];return a&&a[Math.round(d)]||new b(NaN,NaN)},particles:[],generateParticles:function(){var a=this.getMapBounds(),c=(a.south-a.north)*(a.west-a.east),d=Math.round(this._canvas.width*this._canvas.height*this.options.particles_factor*Math.pow(c,.24)/200);for(var b=0;b<d;b++)this.particles.push(this.randomParticle())},randomParticle:function(){var a,b,d=0;do a=Math.round(Math.floor(Math.random()*this._canvas.width)),b=Math.round(Math.floor(Math.random()*this._canvas.height));while(isNaN(this.getField(a,b).m)&&d++<30);return new c(a,b,1+this.options.life*Math.random())},_reset:function(){var b=this._map.containerPointToLayerPoint([0,0]);L.DomUtil.setPosition(this._canvas,b);var a=this.data;a&&a.data&&a.data.length>0&&(this._clear(),this._initColumns(),this.generateParticles(),this.initColorStyles(),this.start())},_resize:function(a){this._setCanvasSize(a.newSize),this._reset()},_clear:function(){this.particles=[],this.columns=[],this.frame&&L.Util.cancelAnimFrame(this.frame),this._canvas.getContext('2d').clearRect(0,0,this.width,this.height)},getMapBounds:function(){var a=this._map.getBounds(),b=[[a._southWest.lng,a._southWest.lat],[a._northEast.lng,a._northEast.lat]];return{south:h(b[0][1]),north:h(b[1][1]),east:h(b[1][0]),west:h(b[0][0]),height:this.height,width:this.width}},initColorStyles:function(){var a=e.scale([this.options.start_color,this.options.end_color]).colors(8),b=this;a.indexFor=function(c){return Math.floor(Math.min(c,b.options.maxIntensity)/b.options.maxIntensity*(a.length-1))},this.colorStyles=a},updateParticles:function(){var d=1,e=this.particles,f=this.colorStyles;for(var b=0;b<e.length;b++){var a=e[b];if(a.color='#eee',a.life>0){var c=this.getField(a.x,a.y);isNaN(c.m)?this.particles[b]=this.randomParticle():(a.x+=d*c.u,a.y+=d*c.v,isNaN(this.getField(a.x,a.y).m)?this.particles[b]=this.randomParticle():a.color=this.colorStyles[this.colorStyles.indexFor(c.m)]),a.life--}else this.particles[b]=this.randomParticle()}},draw:function(a){var d=this._canvas.width,f=this._canvas.height,g=a.globalCompositeOperation;a.globalCompositeOperation='destination-in',a.fillStyle=e('#000').alpha(1-this.options.fade/10).css(),a.fillRect(0,0,d,f),a.globalCompositeOperation=g;for(var c=0;c<this.particles.length;c++){var b=this.particles[c];b.oldX!=-1&&(a.beginPath(),a.lineWidth=this.options.lineWidth,a.strokeStyle=b.color,a.moveTo(b.oldX,b.oldY),a.lineTo(b.x,b.y),a.stroke()),b.oldX=b.x,b.oldY=b.y}},start:function(){this.updateParticles(),this._redraw(),this.frame=L.Util.requestAnimFrame(this.start,this)},destory:function(){this._clear(),this.onRemove(this._map),this._map.off('resize',this.onResize,this),this.data=[]}}),g=function(a,b){return a-b*Math.floor(a/b)},h=function(a){return a/180*Math.PI},a=function(a){return a/(Math.PI/180)},j=function(a){return a!==null&&a!==undefined},k=function(f,j,i,g,e,b,h){var d=b.u*e,c=b.v*e,a=l(f,j,i,g,h);return b.u=a[0]*d+a[2]*c,b.v=a[1]*d+a[3]*c,b},l=function(f,b,l,i,j){var k=2*Math.PI,a=Math.pow(10,-5.2),c=f<0?a:-a,d=b<0?a:-a,g=n(b,f+c,j),h=n(b+d,f,j),e=Math.cos(b/360*k);return[(g[0]-l)/c/e,(g[1]-i)/c/e,(h[0]-l)/d,(h[1]-i)/d]},m=function(a){return Math.log(Math.tan(a/2+Math.PI/4))},n=function(i,j,a){var d=m(a.south),c=m(a.north),e=a.width/(a.east-a.west),f=a.height/(c-d),b=m(h(i)),g=(h(j)-a.west)*e,b=(c-b)*f;return[g,b]},o=function(j,k,b){var d=b.east-b.west,c=b.width/a(d)*360/(2*Math.PI),h=c/2*Math.log((1+Math.sin(b.south))/(1-Math.sin(b.south))),i=b.height+h,g=(i-k)/c,f=180/Math.PI*(2*Math.atan(Math.exp(g))-Math.PI/2),e=a(b.west)+j/b.width*a(d);return[e,f]},p=function(d,c,j,k,l,m){var a=1-d,e=1-c,f=a*e,g=d*e,h=a*c,i=d*c,o=j.u*f+k.u*g+l.u*h+m.u*i,n=j.v*f+k.v*g+l.v*h+m.v*i;return new b(o,n)},q=L.dmap=L.dmap||{};q.Flow=f,q.flow=function(a){return new f(a)},module.exports=f | ||
function b(a,b){this.u=a,this.v=b,this.m=Math.sqrt(a*a+b*b)}function q(a,b,c,d){this.grid=a,this.extent=b,this.dx=c,this.dy=d}function o(a,b,c){this.x=a,this.y=b,this.oldX=-1,this.oldY=-1,this.life=c}var j=require('./webgl_heatmap/CanvasLayerBase.js'),h=require('chroma-js'),f=j.extend({options:{start_color:'rgba(0, 255, 255, 0.5)',end_color:'rgba(255, 30, 219, 0.5)',fade:1,maxIntensity:17,velocityScale:1,lineWidth:2,fadeFillStyle:'rgba(0, 0, 0, 0.97)',life:80,strokeStyle:'rgb(227, 238, 238)',particles_factor:1},initialize:function(a){L.setOptions(this,a)},updateOptions:function(a){L.setOptions(this,a),this._reset()},setData:function(a){this.data=a,this._initVectorField(),this._reset()},_initVectorField:function(){var a=this.data;if(!(a&&a.data&&a.data.length>0))return;var s=a.lo1||0,t=a.la1||90,l=a.lo2||359,m=a.la2||-90,f=a.dx||1,r=a.dy||1,g=a.nx||360,k=a.ny||181,h=[],i=0,n=a.data,o=Math.floor(g*f)>=360;for(var d=0;d<k;d++){var c=[];for(var e=0;e<g;e++,i++){var j=n[i];c[e]=new b(j[0],j[1])}o&&c.push(c[0]),h[d]=c}var p={lng_min:s,lat_min:m,lng_max:l,lat_max:t};this.vectorField=new q(h,p,f,r)},interpolateLngLat:function(t,s){if(Math.abs(s)>=85.0511287798)return new b(NaN,NaN);var d=this.vectorField,q=d.extent,h=l(t-q.lng_min,360)/d.dx,i=(q.lat_max-s)/d.dy,e=Math.floor(h),g=e+1,f=Math.floor(i),r=f+1,p=d.grid,a;if(a=p[f]){var o=a[e],k=a[g];if(c(o)&&c(k)&&(a=p[r])){var j=a[e],n=a[g];if(c(j)&&c(n))return m(h-e,i-f,o,k,j,n)}}return new b(NaN,NaN)},columns:[],_initColumns:function(){var d=this.getMapBounds(),h=this.columns,o=(d.south-d.north)*(d.west-d.east),j=this._map.getBounds(),m=this.width*180/(20037508.34*(j.getEast()-j.getWest())),n=this.options.velocityScale*1e-6/m;for(var a=0;a<=this.width;a+=2){var f=[];for(var b=0;b<=this.height;b+=2){var l=this._map.containerPointToLatLng([a,b]),g=[l.lng,l.lat];if(g){var e=g[0],i=g[1];if(isFinite(e)){var c=this.interpolateLngLat(e,i);c&&!Array.isArray(c)&&(c=k(e,i,a,b,n,c,d)),f[b+1]=f[b]=c}}}h[a+1]=h[a]=f}},getVectorAtXY:function(b,c){var a=this._map.containerPointToLatLng(L.point(b,c));return this.interpolateLngLat(a.lng,a.lat)},getField:function(c,d){var a=this.columns[Math.round(c)];return a&&a[Math.round(d)]||new b(NaN,NaN)},particles:[],generateParticles:function(){var a=this.getMapBounds(),c=(a.south-a.north)*(a.west-a.east),d=Math.round(this._canvas.width*this._canvas.height*this.options.particles_factor*Math.pow(c,.24)/200);for(var b=0;b<d;b++)this.particles.push(this.randomParticle())},randomParticle:function(){var a,b,c=0;do a=Math.round(Math.floor(Math.random()*this._canvas.width)),b=Math.round(Math.floor(Math.random()*this._canvas.height));while(isNaN(this.getField(a,b).m)&&c++<30);return new o(a,b,1+this.options.life*Math.random())},_reset:function(){var b=this._map.containerPointToLayerPoint([0,0]);L.DomUtil.setPosition(this._canvas,b);var a=this.data;a&&a.data&&a.data.length>0&&(this._clear(),this._initColumns(),this.generateParticles(),this.initColorStyles(),this.start())},_resize:function(a){this._setCanvasSize(a.newSize),this._reset()},_clear:function(){this.particles=[],this.columns=[],this.frame&&L.Util.cancelAnimFrame(this.frame),this._canvas.getContext('2d').clearRect(0,0,this.width,this.height)},getMapBounds:function(){var b=this._map.getBounds(),c=[[b._southWest.lng,b._southWest.lat],[b._northEast.lng,b._northEast.lat]];return{south:a(c[0][1]),north:a(c[1][1]),east:a(c[1][0]),west:a(c[0][0]),height:this.height,width:this.width}},initColorStyles:function(){var a=h.scale([this.options.start_color,this.options.end_color]).colors(8),b=this;a.indexFor=function(c){return Math.floor(Math.min(c,b.options.maxIntensity)/b.options.maxIntensity*(a.length-1))},this.colorStyles=a},updateParticles:function(){var d=1,e=this.particles,f=this.colorStyles;for(var b=0;b<e.length;b++){var a=e[b];if(a.color='#eee',a.life>0){var c=this.getField(a.x,a.y);isNaN(c.m)?this.particles[b]=this.randomParticle():(a.x+=d*c.u,a.y+=d*c.v,isNaN(this.getField(a.x,a.y).m)?this.particles[b]=this.randomParticle():a.color=this.colorStyles[this.colorStyles.indexFor(c.m)]),a.life--}else this.particles[b]=this.randomParticle()}},draw:function(a){var d=this._canvas.width,e=this._canvas.height,f=a.globalCompositeOperation;a.globalCompositeOperation='destination-in',a.fillStyle=h('#000').alpha(1-this.options.fade/10).css(),a.fillRect(0,0,d,e),a.globalCompositeOperation=f;for(var c=0;c<this.particles.length;c++){var b=this.particles[c];b.oldX!=-1&&(a.beginPath(),a.lineWidth=this.options.lineWidth,a.strokeStyle=b.color,a.moveTo(b.oldX,b.oldY),a.lineTo(b.x,b.y),a.stroke()),b.oldX=b.x,b.oldY=b.y}},start:function(){this.updateParticles(),this._redraw(),this.frame=L.Util.requestAnimFrame(this.start,this)},destory:function(){this._clear(),this.onRemove(this._map),this._map.off('resize',this.onResize,this),this.data=[]}}),l=function(a,b){return a-b*Math.floor(a/b)},a=function(a){return a/180*Math.PI},d=function(a){return a/(Math.PI/180)},c=function(a){return a!==null&&a!==undefined},k=function(f,j,i,g,e,b,h){var d=b.u*e,c=b.v*e,a=n(f,j,i,g,h);return b.u=a[0]*d+a[2]*c,b.v=a[1]*d+a[3]*c,b},n=function(f,b,m,j,k){var l=2*Math.PI,a=Math.pow(10,-5.2),c=f<0?a:-a,d=b<0?a:-a,g=i(b,f+c,k),h=i(b+d,f,k),e=Math.cos(b/360*l);return[(g[0]-m)/c/e,(g[1]-j)/c/e,(h[0]-m)/d,(h[1]-j)/d]},e=function(a){return Math.log(Math.tan(a/2+Math.PI/4))},i=function(j,k,b){var f=e(b.south),d=e(b.north),g=b.width/(b.east-b.west),h=b.height/(d-f),c=e(a(j)),i=(a(k)-b.west)*g,c=(d-c)*h;return[i,c]},p=function(j,k,a){var c=a.east-a.west,b=a.width/d(c)*360/(2*Math.PI),h=b/2*Math.log((1+Math.sin(a.south))/(1-Math.sin(a.south))),i=a.height+h,g=(i-k)/b,f=180/Math.PI*(2*Math.atan(Math.exp(g))-Math.PI/2),e=d(a.west)+j/a.width*d(c);return[e,f]},m=function(d,c,j,k,l,m){var a=1-d,e=1-c,f=a*e,g=d*e,h=a*c,i=d*c,o=j.u*f+k.u*g+l.u*h+m.u*i,n=j.v*f+k.v*g+l.v*h+m.v*i;return new b(o,n)},g=L.dmap=L.dmap||{};g.Flow=f,g.flow=function(a){return new f(a)},module.exports=f |
@@ -1,1 +0,1 @@ | ||
function a(b){this.options=c.deepMerge(a.options,b)}var b=require('bcore/event'),c=require('bcore/utils'),d=require('leaflet'),e=require('./flying_line_canvas.js');a.options={lineN:100,getLat:function(a){return a.lat},getLng:function(a){return a.lng},ptsN:400,step:80,speed:1,height:2.5,style:{strokeColor:function(n,p,a,o){var b=n.match(/\d+/g),e=parseInt(b[0]),f=parseInt(b[1]),d=parseInt(b[2]),c=p.match(/\d+/g),k=parseInt(c[0]),l=parseInt(c[1]),m=parseInt(c[2]),i=~~((k-e)*a+e),h=~~((l-f)*a+f),j=~~((m-d)*a+d),g=Math.pow(a,o);return'rgba('+i+','+h+','+j+','+g+')'},fromColor:'rgba(255, 255, 255, 1.0)',toColor:'rgba(0, 0, 0, 1.0)',flareColor:'rgba(100, 227, 249, 1.0)',k:4,lineWidth:2,fillColor:'rgba(0, 0, 0, 0.96)'}},a=b.extend(a,{addTo:function(a,b,c){if(!a)return;this.map=a,a.on('move',this.move,this),this.initCanvas(),this.initLines(),this.loop()},initCanvas:function(){var e=this.map,a=e.getSize(),b=this.canvasFlyingLine=d.DomUtil.create('canvas','leaflet-layer leaflet-zoom-hide');b.width=a.x,b.height=a.y,e.getPanes().overlayPane.appendChild(b),this.ctx=b.getContext('2d');var c=this.canvasFlare=d.DomUtil.create('canvas','leaflet-layer leaflet-zoom-hide');c.width=a.x,c.height=a.y,e.getPanes().overlayPane.appendChild(c),this.ctxFlare=c.getContext('2d')},resize:function(){var b=this.map.getSize();this.canvasFlyingLine.width=b.x,this.canvasFlyingLine.height=b.y,this.canvasFlare.width=b.x,this.canvasFlare.height=b.y;var a=d.DomUtil.getPosition(this.map.getPanes().mapPane);a&&(d.DomUtil.setPosition(this.canvasFlyingLine,{x:-a.x,y:-a.y}),d.DomUtil.setPosition(this.canvasFlare,{x:-a.x,y:-a.y}))},move:function(){this.resize(),this.clean()},clean:function(){var a=this.using,c=this.unusing,b,d;if(!a)return;for(var e in a)b=a[e],d=b.lineIndex,b.reset(),c.push(b),delete a[d]},render:function(a){if(!(this.unusing.length&&a))return;this.data(a)},data:function(d){if(!d)return;var f=this.using,e=this.unusing;for(var b=0;b<d.length;b++){var c=d[b];if(e.length&&c){var a=e.pop();a.data(c),a.od=c,this.initStartEvents(a),f[a.lineIndex]=a}}},initStartEvents:function(a){this.emit('start',{location:a.od.from,id:a.lineIndex})},initEndEvents:function(a){this.emit('end',{location:a.od.to,id:a.lineIndex})},initLines:function(){var a=this.options,d=a.lineN,f=this.map,g=this.ctx,i=this.using={},h=this.unusing=[];for(var b=0;b<d;b++){var c=new e({getLat:a.getLat,getLng:a.getLng,ptsN:a.ptsN,step:a.step,height:a.height,style:a.style});c.set(f,g,b),h.push(c)}},cleanUsedPath:function(){var b=this.using,c=this.unusing,a,d;if(!b)return;for(var e in b)a=b[e],d=a.lineIndex,a.ptsStart>=a.step+a.pathLength&&(a.reset(),this.initEndEvents(a),c.push(a),delete b[d])},loop:function(){this.cleanUsedPath(),this.update(),this.loopId=window.requestAnimationFrame(this.loop.bind(this))},update:function(){var a=this.using;if(!a)return;var c=this.ds=[];for(var d in a){var b=a[d];b.update(),c.push(b.outData())}this.draw(),this.drawFlare()},drawFlare:function(){var i=this.ds,a=this.ctxFlare,l=a.canvas,p=a.canvas.width,o=a.canvas.height,f=this.options,n=f.style.fillColor,k=f.style.flareWidth,d=f.style.flareColor;a.clearRect(0,0,l.width,l.height);for(var g=0;g<i.length;g++){var e=i[g],h=e.length,c=e[h-1];if(!c)continue;if(a.save(),a.translate(c[0],c[1]),e.length>=2){var j=e[h-2],m=Math.atan2(c[1]-j[1],c[0]-j[0]);a.rotate(m)}a.scale(3,1),a.beginPath(),a.arc(0,0,k,0,Math.PI*2),a.closePath();var b=a.createRadialGradient(0,0,0,0,0,k);b.addColorStop(0,this.prefixColor(d,1)),b.addColorStop(.5,this.prefixColor(d,.9)),b.addColorStop(.8,this.prefixColor(d,.2)),b.addColorStop(1,this.prefixColor(d,.01)),a.fillStyle=b,a.fill(),a.restore()}},draw:function(){var i=this.ds,a=this.ctx,t=this.ctxFlare,h=a.canvas,k=a.canvas.width,p=a.canvas.height,b=this.options,r=b.style.fillColor,j=b.style.strokeColor,q=b.style.lineWidth,l=b.style.k,m=b.style.fromColor,n=b.style.toColor;a.clearRect(0,0,h.width,h.height);var o=a.globalCompositeOperation;a.globalCompositeOperation='destination-in',a.fillStyle=r,a.fillRect(0,0,k,p),a.globalCompositeOperation=o;for(var g=0;g<i.length;g++){var d=i[g];for(var c=0;c<d.length-1;c++){var s=c/d.length,f=d[c],e=d[c+1];if(!(f&&e))continue;a.beginPath(),a.lineWidth=q,a.strokeStyle=j(m,n,s,l),a.moveTo(f[0],f[1]),a.lineTo(e[0],e[1]),a.stroke()}}},prefixColor:function(f,g){var a=f.match(/\d+/g),b=a[0]||255,c=a[1]||255,d=a[2]||255,e=g||1;return'rgba('+b+','+c+','+d+','+e+')'},updateOptions:function(a){a&&(a=this.options=c.deepMerge(this.options,a)),a=this.options;var b,d=this.using;for(var f in d)b=d[f],b.updateOptions(a);var e=this.unusing;for(var g in e)b=e[g],b.updateOptions(a)},remove:function(){window.cancelAnimationFrame(this.loopId),this.map.getPanes().overlayPane.removeChild(this.canvasFlyingLine),this.map.getPanes().overlayPane.removeChild(this.canvasFlare),this.map.off('move',this.move,this),this.canvasFlyingLine=null,this.canvasFlare=null,this.using=null,this.unusing=null}});var f=d.dmap=d.dmap||{};f.FlyingLinesCanvas=a,f.flyingLinesCanvas=function(b){return new a(b)},module.exports=a | ||
function b(a){this.options=c.deepMerge(b.options,a)}var e=require('bcore/event'),c=require('bcore/utils'),a=require('leaflet'),f=require('./flying_line_canvas.js');b.options={lineN:100,getLat:function(a){return a.lat},getLng:function(a){return a.lng},ptsN:400,step:80,speed:1,height:2.5,style:{strokeColor:function(n,p,a,o){var b=n.match(/\d+/g),e=parseInt(b[0]),f=parseInt(b[1]),d=parseInt(b[2]),c=p.match(/\d+/g),k=parseInt(c[0]),l=parseInt(c[1]),m=parseInt(c[2]),i=~~((k-e)*a+e),h=~~((l-f)*a+f),j=~~((m-d)*a+d),g=Math.pow(a,o);return'rgba('+i+','+h+','+j+','+g+')'},fromColor:'rgba(255, 255, 255, 1.0)',toColor:'rgba(0, 0, 0, 1.0)',flareColor:'rgba(100, 227, 249, 1.0)',k:4,lineWidth:2,fillColor:'rgba(0, 0, 0, 0.96)'}},b=e.extend(b,{addTo:function(a,b,c){if(!a)return;this.map=a,a.on('move',this.move,this),this.initCanvas(),this.initLines(),this.loop()},initCanvas:function(){var e=this.map,b=e.getSize(),c=this.canvasFlyingLine=a.DomUtil.create('canvas','leaflet-layer leaflet-zoom-hide');c.width=b.x,c.height=b.y,e.getPanes().overlayPane.appendChild(c),this.ctx=c.getContext('2d');var d=this.canvasFlare=a.DomUtil.create('canvas','leaflet-layer leaflet-zoom-hide');d.width=b.x,d.height=b.y,e.getPanes().overlayPane.appendChild(d),this.ctxFlare=d.getContext('2d')},resize:function(){var c=this.map.getSize();this.canvasFlyingLine.width=c.x,this.canvasFlyingLine.height=c.y,this.canvasFlare.width=c.x,this.canvasFlare.height=c.y;var b=a.DomUtil.getPosition(this.map.getPanes().mapPane);b&&(a.DomUtil.setPosition(this.canvasFlyingLine,{x:-b.x,y:-b.y}),a.DomUtil.setPosition(this.canvasFlare,{x:-b.x,y:-b.y}))},move:function(){this.resize(),this.clean()},clean:function(){var a=this.using,c=this.unusing,b,d;if(!a)return;for(var e in a)b=a[e],d=b.lineIndex,b.reset(),c.push(b),delete a[d]},render:function(a){if(!(this.unusing.length&&a))return;this.data(a)},data:function(d){if(!d)return;var f=this.using,e=this.unusing;for(var b=0;b<d.length;b++){var c=d[b];if(e.length&&c){var a=e.pop();a.data(c),a.od=c,this.initStartEvents(a),f[a.lineIndex]=a}}},initStartEvents:function(a){this.emit('start',{location:a.od.from,id:a.lineIndex})},initEndEvents:function(a){this.emit('end',{location:a.od.to,id:a.lineIndex})},initLines:function(){var a=this.options,d=a.lineN,e=this.map,g=this.ctx,i=this.using={},h=this.unusing=[];for(var b=0;b<d;b++){var c=new f({getLat:a.getLat,getLng:a.getLng,ptsN:a.ptsN,step:a.step,height:a.height,style:a.style});c.set(e,g,b),h.push(c)}},cleanUsedPath:function(){var b=this.using,c=this.unusing,a,d;if(!b)return;for(var e in b)a=b[e],d=a.lineIndex,a.ptsStart>=a.step+a.pathLength&&(a.reset(),this.initEndEvents(a),c.push(a),delete b[d])},loop:function(){this.cleanUsedPath(),this.update(),this.loopId=window.requestAnimationFrame(this.loop.bind(this))},update:function(){var a=this.using;if(!a)return;var c=this.ds=[];for(var d in a){var b=a[d];b.update(),c.push(b.outData())}this.draw(),this.drawFlare()},drawFlare:function(){var i=this.ds,a=this.ctxFlare,l=a.canvas,p=a.canvas.width,o=a.canvas.height,f=this.options,n=f.style.fillColor,k=f.style.flareWidth,d=f.style.flareColor;a.clearRect(0,0,l.width,l.height);for(var g=0;g<i.length;g++){var e=i[g],h=e.length,c=e[h-1];if(!c)continue;if(a.save(),a.translate(c[0],c[1]),e.length>=2){var j=e[h-2],m=Math.atan2(c[1]-j[1],c[0]-j[0]);a.rotate(m)}a.scale(3,1),a.beginPath(),a.arc(0,0,k,0,Math.PI*2),a.closePath();var b=a.createRadialGradient(0,0,0,0,0,k);b.addColorStop(0,this.prefixColor(d,1)),b.addColorStop(.5,this.prefixColor(d,.9)),b.addColorStop(.8,this.prefixColor(d,.2)),b.addColorStop(1,this.prefixColor(d,.01)),a.fillStyle=b,a.fill(),a.restore()}},draw:function(){var i=this.ds,a=this.ctx,t=this.ctxFlare,h=a.canvas,k=a.canvas.width,p=a.canvas.height,b=this.options,r=b.style.fillColor,j=b.style.strokeColor,q=b.style.lineWidth,l=b.style.k,m=b.style.fromColor,n=b.style.toColor;a.clearRect(0,0,h.width,h.height);var o=a.globalCompositeOperation;a.globalCompositeOperation='destination-in',a.fillStyle=r,a.fillRect(0,0,k,p),a.globalCompositeOperation=o;for(var g=0;g<i.length;g++){var d=i[g];for(var c=0;c<d.length-1;c++){var s=c/d.length,f=d[c],e=d[c+1];if(!(f&&e))continue;a.beginPath(),a.lineWidth=q,a.strokeStyle=j(m,n,s,l),a.moveTo(f[0],f[1]),a.lineTo(e[0],e[1]),a.stroke()}}},prefixColor:function(f,g){var a=f.match(/\d+/g),b=a[0]||255,c=a[1]||255,d=a[2]||255,e=g||1;return'rgba('+b+','+c+','+d+','+e+')'},updateOptions:function(a){a&&(a=this.options=c.deepMerge(this.options,a)),a=this.options;var b,d=this.using;for(var f in d)b=d[f],b.updateOptions(a);var e=this.unusing;for(var g in e)b=e[g],b.updateOptions(a)},remove:function(){window.cancelAnimationFrame(this.loopId),this.map.getPanes().overlayPane.removeChild(this.canvasFlyingLine),this.map.getPanes().overlayPane.removeChild(this.canvasFlare),this.map.off('move',this.move,this),this.canvasFlyingLine=null,this.canvasFlare=null,this.using=null,this.unusing=null}});var d=a.dmap=a.dmap||{};d.FlyingLinesCanvas=b,d.flyingLinesCanvas=function(a){return new b(a)},module.exports=b |
@@ -1,1 +0,1 @@ | ||
function a(b){b=this.options=e.deepMerge(a.options,b),b.interactiveLine.kHeight=b.kHeight,b.displayLine.kHeight=b.kHeight,this.initialize(b)}function b(a){if(typeof a==='string'&&a.indexOf(',')!==-1){a=a.split(',');var b=+a[1]||0,c=+a[0]||0;return{lat:b,lng:c}}return a}var c=require('./../leaflet'),d=require('./flyingLinePath'),e=require('./../core/utils'),f=c.dmap=c.dmap||{},g=require('./../core/anim_view');a.options={isAutoStart:!1,lifeMin:0,lifeMax:1,isPopupHover:0,lifeEnd:'destroy',range:.8,lifeSpeed:.08,kHeight:.5,interactiveLine:{weight:5,color:'rgba(250,150,50,0.0)',colorHover:'rgba(250,150,50,0.1)'},displayLine:{weight:1}},a.options=e.deepMerge(g.options,a.options),a=g.extend(a,{isInit:!1,life:0,initialize:function(a){this._map&&this.addTo(this._map),this.id=this.options.id||e.getId('flyingLine'),this.isLive=!1,this.isLooping=!0},checkIfEnd:function(){this.life>=this.options.lifeMax+this.options.range&&this._onLifeEnd()},addTo:function(a){return this._map=a,this.init(),this.initEvents(),this},init:function(){if(this.isInit||!this._map)return;this.initInteractiveLine(),this.initDisplayLine(),this.isInit=!0},initDisplayLine:function(){throw'必须实现initDisplayLine方法'},initInteractiveLine:function(){var f=this.options,g=this._map,a=this,b=f.interactiveLine;if(b.kHeight=f.kHeight,!b)return;var e=this.interactivePath=new d(b);e.addTo(g);var c=e._path;c.setAttribute('fill','none'),c.setAttribute('stroke',b.color),c.setAttribute('stroke-width',b.weight),c.setAttribute('stroke-linecap','round'),c.setAttribute('stroke-linejoin','round'),e.on('mouseover',function(d){c.setAttribute('stroke',b.colorHover),a.emit('mouseover',a.record),f.isPopupHover&&e.openPopup()}).on('mouseout',function(d){c.setAttribute('stroke',b.color),f.isPopupHover&&e.closePopup(),a.emit('mouseout',a.record)}).on('mousedown',function(b){a.resume(),a.fireEvent('mouseout',e),a.emit('mousedown',a.record)}).on('click',function(b){a.emit('click',a.record)})},setPopupContent:function(a){this.interactivePath&&this.interactivePath.setPopupContent(a)},data:function(a){if(!(a&&a.from&&a.to))return console.log('无数据/数据格式有问题');a.from=b(a.from),a.to=b(a.to),this._data=a,this.updateData(a),this.bindPopup(),this.reset(),this.options.isAutoStart&&this.resume(),this.record={data:a,layer:this}},render:function(a){a&&this.data(a),this.draw()},draw:function(){this.fireEvent('lifestart',{latlng:this.displayPath.from,data:this._data}),this.startAnim()},initEvents:function(){this.on('update',this.updateLife.bind(this)).on('lifeEnd',function(b){var a=this.options.lifeEnd;return a==='loop'?this.restart():a==='hide'?this.hide():a==='destroy'?this.destroy():void 0})},updateOptions:function(a){a=this.options=e.deepMerge(this.options,a),this.updateOptionsInteractiveLine&&this.updateOptionsInteractiveLine(),this.updateOptionsDisplayLine&&this.updateOptionsDisplayLine(),a.interactiveLine.kHeight=a.kHeight,this.interactivePath&&this.interactivePath.updateOptions(a.interactiveLine),a.displayLine.kHeight=a.kHeight,this.displayPath&&this.displayPath.updateOptions(a.displayLine)},updateLife:function(a){if(!this.isLive)return;this.updateInteractiveLine&&this.updateInteractiveLine(a),this.updateDisplayLine&&this.updateDisplayLine(a)},updateData:function(a){this.interactivePath&&this.interactivePath.data(a),this.displayPath&&this.displayPath.data(a)},bindPopup:function(a,b){if(a=a||this.bindHTML,!a)return;if(!this._data)return this.bindHTML=a;b=e.deepMerge({maxWidth:800,autoPan:!1},b),typeof a==='function'&&(a=a(this._data||{})),this.interactivePath.bindPopup(a,b),this.bindHTML=null},hide:function(){this.life=0,this.isLive=!1,this.interactivePath&&this.interactivePath.hide(),this.displayPath&&this.displayPath.hide(),this.fire('hide')},pause:function(){this.isLooping=!1,this.isLive=!1,cancelAnimationFrame(this.loopid),this.loopid=null,this.fire('pause')},resume:function(){if(this.isLive)return;var a=this.options;setTimeout(function(){}.bind(this)),this.isLive=!0,this.loop(),this.fire('resume')},loop:function(){if(!this.isLooping)return;this._updateLife(),this.loopid=requestAnimationFrame(this.loop.bind(this))},isEnd:function(){return this.life>this.options.lifeMax},reset:function(){var a=this.options;this.life=a.lifeMin},destroy:function(){this.pause(),this.off(),this.life=0,this.isLive=!1,this.interactivePath&&this.interactivePath.destroy(),this.displayPath&&this.displayPath.destroy()}}),f.FlyingLine=a,f.flyingLine=function(b){return new a(b)},module.exports=a | ||
function a(c){c=this.options=b.deepMerge(a.options,c),c.interactiveLine.kHeight=c.kHeight,c.displayLine.kHeight=c.kHeight,this.initialize(c)}function f(a){if(typeof a==='string'&&a.indexOf(',')!==-1){a=a.split(',');var b=+a[1]||0,c=+a[0]||0;return{lat:b,lng:c}}return a}var c=require('./../leaflet'),g=require('./flyingLinePath'),b=require('./../core/utils'),d=c.dmap=c.dmap||{},e=require('./../core/anim_view');a.options={isAutoStart:!1,lifeMin:0,lifeMax:1,isPopupHover:0,lifeEnd:'destroy',range:.8,lifeSpeed:.08,kHeight:.5,interactiveLine:{weight:5,color:'rgba(250,150,50,0.0)',colorHover:'rgba(250,150,50,0.1)'},displayLine:{weight:1}},a.options=b.deepMerge(e.options,a.options),a=e.extend(a,{isInit:!1,life:0,initialize:function(a){this._map&&this.addTo(this._map),this.id=this.options.id||b.getId('flyingLine'),this.isLive=!1,this.isLooping=!0},checkIfEnd:function(){this.life>=this.options.lifeMax+this.options.range&&this._onLifeEnd()},addTo:function(a){return this._map=a,this.init(),this.initEvents(),this},init:function(){if(this.isInit||!this._map)return;this.initInteractiveLine(),this.initDisplayLine(),this.isInit=!0},initDisplayLine:function(){throw'必须实现initDisplayLine方法'},initInteractiveLine:function(){var e=this.options,f=this._map,a=this,b=e.interactiveLine;if(b.kHeight=e.kHeight,!b)return;var d=this.interactivePath=new g(b);d.addTo(f);var c=d._path;c.setAttribute('fill','none'),c.setAttribute('stroke',b.color),c.setAttribute('stroke-width',b.weight),c.setAttribute('stroke-linecap','round'),c.setAttribute('stroke-linejoin','round'),d.on('mouseover',function(f){c.setAttribute('stroke',b.colorHover),a.emit('mouseover',a.record),e.isPopupHover&&d.openPopup()}).on('mouseout',function(f){c.setAttribute('stroke',b.color),e.isPopupHover&&d.closePopup(),a.emit('mouseout',a.record)}).on('mousedown',function(b){a.resume(),a.fireEvent('mouseout',d),a.emit('mousedown',a.record)}).on('click',function(b){a.emit('click',a.record)})},setPopupContent:function(a){this.interactivePath&&this.interactivePath.setPopupContent(a)},data:function(a){if(!(a&&a.from&&a.to))return console.log('无数据/数据格式有问题');a.from=f(a.from),a.to=f(a.to),this._data=a,this.updateData(a),this.bindPopup(),this.reset(),this.options.isAutoStart&&this.resume(),this.record={data:a,layer:this}},render:function(a){a&&this.data(a),this.draw()},draw:function(){this.fireEvent('lifestart',{latlng:this.displayPath.from,data:this._data}),this.startAnim()},initEvents:function(){this.on('update',this.updateLife.bind(this)).on('lifeEnd',function(b){var a=this.options.lifeEnd;return a==='loop'?this.restart():a==='hide'?this.hide():a==='destroy'?this.destroy():void 0})},updateOptions:function(a){a=this.options=b.deepMerge(this.options,a),this.updateOptionsInteractiveLine&&this.updateOptionsInteractiveLine(),this.updateOptionsDisplayLine&&this.updateOptionsDisplayLine(),a.interactiveLine.kHeight=a.kHeight,this.interactivePath&&this.interactivePath.updateOptions(a.interactiveLine),a.displayLine.kHeight=a.kHeight,this.displayPath&&this.displayPath.updateOptions(a.displayLine)},updateLife:function(a){if(!this.isLive)return;this.updateInteractiveLine&&this.updateInteractiveLine(a),this.updateDisplayLine&&this.updateDisplayLine(a)},updateData:function(a){this.interactivePath&&this.interactivePath.data(a),this.displayPath&&this.displayPath.data(a)},bindPopup:function(a,c){if(a=a||this.bindHTML,!a)return;if(!this._data)return this.bindHTML=a;c=b.deepMerge({maxWidth:800,autoPan:!1},c),typeof a==='function'&&(a=a(this._data||{})),this.interactivePath.bindPopup(a,c),this.bindHTML=null},hide:function(){this.life=0,this.isLive=!1,this.interactivePath&&this.interactivePath.hide(),this.displayPath&&this.displayPath.hide(),this.fire('hide')},pause:function(){this.isLooping=!1,this.isLive=!1,cancelAnimationFrame(this.loopid),this.loopid=null,this.fire('pause')},resume:function(){if(this.isLive)return;var a=this.options;setTimeout(function(){}.bind(this)),this.isLive=!0,this.loop(),this.fire('resume')},loop:function(){if(!this.isLooping)return;this._updateLife(),this.loopid=requestAnimationFrame(this.loop.bind(this))},isEnd:function(){return this.life>this.options.lifeMax},reset:function(){var a=this.options;this.life=a.lifeMin},destroy:function(){this.pause(),this.off(),this.life=0,this.isLive=!1,this.interactivePath&&this.interactivePath.destroy(),this.displayPath&&this.displayPath.destroy()}}),d.FlyingLine=a,d.flyingLine=function(b){return new a(b)},module.exports=a |
@@ -1,1 +0,1 @@ | ||
function a(b){b=this.options=e.deepMerge(a.options,b),this.initialize(b)}var b=require('./../leaflet'),c=require('./flyingLine'),d=require('./flyingLinePath'),e=require('./../core/utils'),f=b.dmap=b.dmap||{};a.options={interactiveLine:{weight:5,color:'rgba(250,150,50,0.0)',colorHover:'rgba(250,150,50,0.2)'},displayLine:{dashSpeed:30,dashArray:'2,4,8,16',color:'rgba(250,150,50,1)',weight:3}},a.options=e.deepMerge(c.options,a.options),a=c.extend(a,{initialize:function(b){var b=e.deepMerge(a.options,b);c.prototype.initialize.call(this,b)},initDisplayLine:function(){var e=this._map,f=this.options,g=this._data,b=f.displayLine,c=this.displayPath=new d(this.opt);c.addTo(e),c.data(g);var a=c._path;a.setAttribute('pointer-events','none'),a.setAttribute('fill','none'),a.setAttribute('stroke',b.color),a.setAttribute('stroke-width',b.weight),a.setAttribute('stroke-dasharray',b.dashArray),a.setAttribute('stroke-linecap','round'),a.setAttribute('stroke-linejoin','round')},updateDisplayLine:function(){var a=this.life,b=Math.floor(a*this.options.displayLine.dashSpeed);this.displayPath._path.setAttribute('stroke-dashoffset',-b)}}),f.FlyingLineDash=a,f.flyingLineDash=function(a){return new f.FlyingLineDash(a)},module.exports=a | ||
function a(b){b=this.options=c.deepMerge(a.options,b),this.initialize(b)}var e=require('./../leaflet'),b=require('./flyingLine'),f=require('./flyingLinePath'),c=require('./../core/utils'),d=e.dmap=e.dmap||{};a.options={interactiveLine:{weight:5,color:'rgba(250,150,50,0.0)',colorHover:'rgba(250,150,50,0.2)'},displayLine:{dashSpeed:30,dashArray:'2,4,8,16',color:'rgba(250,150,50,1)',weight:3}},a.options=c.deepMerge(b.options,a.options),a=b.extend(a,{initialize:function(d){var d=c.deepMerge(a.options,d);b.prototype.initialize.call(this,d)},initDisplayLine:function(){var d=this._map,e=this.options,g=this._data,b=e.displayLine,c=this.displayPath=new f(this.opt);c.addTo(d),c.data(g);var a=c._path;a.setAttribute('pointer-events','none'),a.setAttribute('fill','none'),a.setAttribute('stroke',b.color),a.setAttribute('stroke-width',b.weight),a.setAttribute('stroke-dasharray',b.dashArray),a.setAttribute('stroke-linecap','round'),a.setAttribute('stroke-linejoin','round')},updateDisplayLine:function(){var a=this.life,b=Math.floor(a*this.options.displayLine.dashSpeed);this.displayPath._path.setAttribute('stroke-dashoffset',-b)}}),d.FlyingLineDash=a,d.flyingLineDash=function(a){return new d.FlyingLineDash(a)},module.exports=a |
@@ -1,1 +0,1 @@ | ||
function a(b){b=this.options=c.deepMerge(a.options,b),b.interactiveLine.kHeight=b.kHeight,b.displayLine.kHeight=b.kHeight,this.initialize(b)}var b=require('./../leaflet'),c=require('./../core/utils'),d=require('./flyingLine'),e=require('./flyingLinePath');a.options={opacity:1,displayLine:{colorTo:'rgba(250,150,50,1)',colorFrom:'rgba(255,0,0,0)',colorNormal:'rgba(250,250,250,0.2)'}},a.options=c.deepMerge(d.options,a.options),a=d.extend(a,{initDisplayLine:function(){var d=this._map,h=this._data,b=this.displayPath=new e(this.options.displayLine);b.addTo(d);var i=b.id,c=b._path,f=this.options,g=b.linearGradientId;this.linearGradient=b.linearGradient;var a=f.displayLine;this.createStop('a',{offset:'0%','stop-color':a.colorNormal}).createStop('b',{offset:'0%','stop-color':a.colorNormal}).createStop('c',{offset:'0%','stop-color':a.colorFrom}).createStop('d',{offset:'0%','stop-color':a.colorTo}).createStop('e',{offset:'0%','stop-color':a.colorNormal}).createStop('f',{offset:'100%','stop-color':a.colorNormal}),c.setAttribute('pointer-events','none'),c.setAttribute('fill','none'),c.setAttribute('stroke','url(#'+g+')'),c.setAttribute('stroke-linecap','round'),c.setAttribute('stroke-linejoin','round')},updateOptionsDisplayLine:function(){var a=this.options.displayLine;this.stop1a&&this.stop1a.setAttribute('stop-color',a.colorNormal),this.stop1b&&this.stop1b.setAttribute('stop-color',a.colorNormal),this.stop1c&&this.stop1c.setAttribute('stop-color',a.colorFrom),this.stop1d&&this.stop1d.setAttribute('stop-color',a.colorTo),this.stop1e&&this.stop1e.setAttribute('stop-color',a.colorNormal),this.stop1f&&this.stop1f.setAttribute('stop-color',a.colorNormal)},createStop:function(b,d){var e=this.id+'stop1',f=this['stop1'+b+'ID']=e+b,g='stop1'+b,h=this.linearGradient,a=this[g]=document.createElementNS('http://www.w3.org/2000/svg','stop');a.setAttribute('id',f);for(var c in d)a.setAttribute(c,d[c]);return h.appendChild(a),this},updateDisplayLine:function(a){if(!a)return;var e=this.options,d=e.range,c,b;if(d>a?(c=0,b=a):a<1?(c=a-d,b=a):a>1&&a<1+d&&(c=a-d,b=1),!b)return;c=Math.floor(c*100)+'%',b=Math.floor(b*100)+'%',this.stop1b&&this.stop1b.setAttribute('offset',c),this.stop1c&&this.stop1c.setAttribute('offset',c),this.stop1d&&this.stop1d.setAttribute('offset',b),this.stop1e&&this.stop1e.setAttribute('offset',b)},genOptions:function(){return a.prototype.options=c.deepMerge(d.prototype.genOptions(),a.prototype.options)}},d),a.prototype.genOptions();var f=b.dmap=b.dmap||{};f.FlyingLineGradient=a,f.flyingLineGradient=function(b){return new a(b)},module.exports=a | ||
function a(b){b=this.options=c.deepMerge(a.options,b),b.interactiveLine.kHeight=b.kHeight,b.displayLine.kHeight=b.kHeight,this.initialize(b)}var d=require('./../leaflet'),c=require('./../core/utils'),b=require('./flyingLine'),f=require('./flyingLinePath');a.options={opacity:1,displayLine:{colorTo:'rgba(250,150,50,1)',colorFrom:'rgba(255,0,0,0)',colorNormal:'rgba(250,250,250,0.2)'}},a.options=c.deepMerge(b.options,a.options),a=b.extend(a,{initDisplayLine:function(){var d=this._map,h=this._data,b=this.displayPath=new f(this.options.displayLine);b.addTo(d);var i=b.id,c=b._path,e=this.options,g=b.linearGradientId;this.linearGradient=b.linearGradient;var a=e.displayLine;this.createStop('a',{offset:'0%','stop-color':a.colorNormal}).createStop('b',{offset:'0%','stop-color':a.colorNormal}).createStop('c',{offset:'0%','stop-color':a.colorFrom}).createStop('d',{offset:'0%','stop-color':a.colorTo}).createStop('e',{offset:'0%','stop-color':a.colorNormal}).createStop('f',{offset:'100%','stop-color':a.colorNormal}),c.setAttribute('pointer-events','none'),c.setAttribute('fill','none'),c.setAttribute('stroke','url(#'+g+')'),c.setAttribute('stroke-linecap','round'),c.setAttribute('stroke-linejoin','round')},updateOptionsDisplayLine:function(){var a=this.options.displayLine;this.stop1a&&this.stop1a.setAttribute('stop-color',a.colorNormal),this.stop1b&&this.stop1b.setAttribute('stop-color',a.colorNormal),this.stop1c&&this.stop1c.setAttribute('stop-color',a.colorFrom),this.stop1d&&this.stop1d.setAttribute('stop-color',a.colorTo),this.stop1e&&this.stop1e.setAttribute('stop-color',a.colorNormal),this.stop1f&&this.stop1f.setAttribute('stop-color',a.colorNormal)},createStop:function(b,d){var e=this.id+'stop1',f=this['stop1'+b+'ID']=e+b,g='stop1'+b,h=this.linearGradient,a=this[g]=document.createElementNS('http://www.w3.org/2000/svg','stop');a.setAttribute('id',f);for(var c in d)a.setAttribute(c,d[c]);return h.appendChild(a),this},updateDisplayLine:function(a){if(!a)return;var e=this.options,d=e.range,c,b;if(d>a?(c=0,b=a):a<1?(c=a-d,b=a):a>1&&a<1+d&&(c=a-d,b=1),!b)return;c=Math.floor(c*100)+'%',b=Math.floor(b*100)+'%',this.stop1b&&this.stop1b.setAttribute('offset',c),this.stop1c&&this.stop1c.setAttribute('offset',c),this.stop1d&&this.stop1d.setAttribute('offset',b),this.stop1e&&this.stop1e.setAttribute('offset',b)},genOptions:function(){return a.prototype.options=c.deepMerge(b.prototype.genOptions(),a.prototype.options)}},b),a.prototype.genOptions();var e=d.dmap=d.dmap||{};e.FlyingLineGradient=a,e.flyingLineGradient=function(b){return new a(b)},module.exports=a |
@@ -1,1 +0,1 @@ | ||
function a(b){b=this.options=f.deepMerge(a.options,b)}var b=require('./../leaflet'),c=require('./flyingLineGradient'),d=require('./flyingLineDash'),e=require('bcore/event'),f=require('bcore/utils'),g=b.dmap=b.dmap||{};a.options={lineN:100,type:'gradient',flying:{lifeEnd:'hide',lifeSpeed:.01,kHeight:1.3,displayLine:{colorTo:'rgba(250,150,50,1)',colorFrom:'rgba(255,0,0,1)',colorNormal:'rgba(250,250,250,0.1)'},interactiveLine:{}}},a=e.extend(a,{isInit:!1,isLive:!0,life:0,addTo:function(a){return this._map=a,this.isable=!0,this.init(),this.initEvents(),this},init:function(){var b=this.options,f=b.lineN,g=b.flying,h=this._map,i={gradient:c,dash:d}[b.type],j=this.unusing=[];this.using=[];var k=this.lines=[],a;for(var e=0;e<f;e++)a=new i(g),a.addTo(h),this.initEventsLine(a),j.push(a),k.push(a);this.loop()},data:function(a){this._data=a},render:function(a){a&&this.data(a),this.draw()},draw:function(){var b=this._data,c,a,e=this.using,d=this.unusing;for(var f in b)c=b[f],d.length&&c&&(a=d.pop(),a.data(c),a.resume(),e.push(a))},checkLine:function(a,b,c){if(a.life<=a.options.lifeMax+a.options.range-a.options.lifeSpeed*2)return;this.disableLine(a,b,c)},disableLine:function(a,b,c){c.splice(b,1),a.pause(),a.hide(),this.unusing.push(a)},disable:function(){this.isable=!1},enable:function(){this.isable=!0},initEventsLine:function(b){var a=this;b.on('mouseover',function(c){b.pause(),a.emit('child-mouseover',c)}).on('mouseout',function(c){b.resume(),a.emit('child-mouseout',c)}).on('click',function(b){a.emit('child-click',b)})},update:function(){this.updateLife()},updateOptions:function(a){this.options=f.deepMerge(this.options,a),this.each(function(b){b.updateOptions(a.flying)})},initEvents:function(){},loop:function(){this.update(),this.isable&&window.requestAnimationFrame(this.loop.bind(this))},updateLife:function(){var b=this.using,c;for(var a=b.length-1;a>=0;a--)c=b[a],c.isLive&&c._updateLife(),this.checkLine(c,a,b)},remove:function(){this.using=[],this.unusing=[];var a=this._map;this.lines.forEach(function(c){var a=c.displayPath;a&&a.destroy();var b=c.interactivePath;b&&b.destroy()}),this.disable(),this.lines=[],this._data=null},each:function(a){return this.lines.forEach(a)}}),g.FlyingLines=a,g.flyingLine=function(b){return new a(b)},module.exports=a | ||
function a(b){b=this.options=c.deepMerge(a.options,b)}var b=require('./../leaflet'),e=require('./flyingLineGradient'),f=require('./flyingLineDash'),g=require('bcore/event'),c=require('bcore/utils'),d=b.dmap=b.dmap||{};a.options={lineN:100,type:'gradient',flying:{lifeEnd:'hide',lifeSpeed:.01,kHeight:1.3,displayLine:{colorTo:'rgba(250,150,50,1)',colorFrom:'rgba(255,0,0,1)',colorNormal:'rgba(250,250,250,0.1)'},interactiveLine:{}}},a=g.extend(a,{isInit:!1,isLive:!0,life:0,addTo:function(a){return this._map=a,this.isable=!0,this.init(),this.initEvents(),this},init:function(){var b=this.options,d=b.lineN,g=b.flying,h=this._map,i={gradient:e,dash:f}[b.type],j=this.unusing=[];this.using=[];var k=this.lines=[],a;for(var c=0;c<d;c++)a=new i(g),a.addTo(h),this.initEventsLine(a),j.push(a),k.push(a);this.loop()},data:function(a){this._data=a},render:function(a){a&&this.data(a),this.draw()},draw:function(){var b=this._data,c,a,e=this.using,d=this.unusing;for(var f in b)c=b[f],d.length&&c&&(a=d.pop(),a.data(c),a.resume(),e.push(a))},checkLine:function(a,b,c){if(a.life<=a.options.lifeMax+a.options.range-a.options.lifeSpeed*2)return;this.disableLine(a,b,c)},disableLine:function(a,b,c){c.splice(b,1),a.pause(),a.hide(),this.unusing.push(a)},disable:function(){this.isable=!1},enable:function(){this.isable=!0},initEventsLine:function(b){var a=this;b.on('mouseover',function(c){b.pause(),a.emit('child-mouseover',c)}).on('mouseout',function(c){b.resume(),a.emit('child-mouseout',c)}).on('click',function(b){a.emit('child-click',b)})},update:function(){this.updateLife()},updateOptions:function(a){this.options=c.deepMerge(this.options,a),this.each(function(b){b.updateOptions(a.flying)})},initEvents:function(){},loop:function(){this.update(),this.isable&&window.requestAnimationFrame(this.loop.bind(this))},updateLife:function(){var b=this.using,c;for(var a=b.length-1;a>=0;a--)c=b[a],c.isLive&&c._updateLife(),this.checkLine(c,a,b)},remove:function(){this.using=[],this.unusing=[];var a=this._map;this.lines.forEach(function(c){var a=c.displayPath;a&&a.destroy();var b=c.interactivePath;b&&b.destroy()}),this.disable(),this.lines=[],this._data=null},each:function(a){return this.lines.forEach(a)}}),d.FlyingLines=a,d.flyingLine=function(b){return new a(b)},module.exports=a |
@@ -1,1 +0,1 @@ | ||
function a(a,b){return typeof a==='function'?a(b):a}function b(a){a=this.options=f.deepMerge(b.options,a),this.updateStyle()}var c=require('./../leaflet'),e=require('bcore/event'),f=require('bcore/utils'),g=require('./../render/canvas'),h=require('./../core/utils').getColorFunc,i=c.dmap=c.dmap||{};b.options={container:'overlayPane',featureId:function(a,b){return a.properties&&a.properties.adcode?a.properties.adcode:b},id:function(){return d.adcode},value:function(a){return a.value},lat:function(a){return a[1]},lng:function(a){return a[0]},style:{lineWidth:2,fill:function(a){return'#0ff'}}},b=e.extend(b,{init:function(){this.initCanvas()},initCanvas:function(){var b=this._map,a=this.options,c=a.container,d=this.dCanvas=new g(b,c,a);this.ctx=d.ctx},addTo:function(a){this._map=a,this.init(),this.initEventsMap()},updateStyle:function(){var a=this.options.style;a.fill&&(a.fill=h(a.fill)),a.stroke&&(a.stroke=h(a.stroke))},geojson:function(g){var b=g.features,e=this.options,c={};for(var a=0;a<b.length;a++){var d=b[a],f=e.featureId(d,a);c[f]=d}this.features=c},data:function(a){var e=this.options;if(Array.isArray(a)){var c,f,d={};for(var b=0;b<a.length;b++)c=a[b],f=e.id(c),d[f]=c;a=d}this._data=a},render:function(a){a&&this.data(a),this.draw()},draw:function(){var d=this.options,h=this._data||{},a=this.features;if(!a)return console.log('没有地理数据 -> geojsonCanvas.geojson(geojson)');var e,b,f,i=d.value.bind(d),g,c=0;for(id in a)e=a[id],b=e.geometry||e,g=h[id],g&&(c=i(g)),f=b.type,f==='MultiPolygon'?this.renderMultiPolygon(b,c):f==='Polygon'&&this.renderPolygon(b,c)},initEventsMap:function(){this.dCanvas.onUpdate(function(){this.draw()}.bind(this))},renderMultiPolygon:function(t,s){var b=this.ctx,r=this._map,g=this.options,q=g.lat,n=g.lng,e=g.style;e.fill&&(b.fillStyle=a(e.fill,s)),e.stroke&&(b.strokeStyle=a(e.stroke,s));var k=t.coordinates,m,i,l,d,o,p;for(var h=0;h<k.length;h++){m=k[h];for(var f=0;f<m.length;f++){i=m[f],b.beginPath();var j;for(var c=0;c<i.length;c++)l=i[c],o=q(l),p=n(l),d=r.latLngToContainerPoint({lat:o,lng:p}),c===0?(b.moveTo(d.x,d.y),j=d):b.lineTo(d.x,d.y),c===i.length-1&&b.lineTo(j.x,j.y);b.fill(),b.stroke(),b.closePath()}}},renderPolygon:function(q,n){var b=this.ctx,m=this._map,g=this.options,k=g.lat,l=g.lng,c=g.style;c.fill&&(b.fillStyle=a(c.fill,n)),c.stroke&&(b.strokeStyle=a(c.stroke,n)),c.lineWidth&&(b.lineWidth=c.lineWidth);var i=q.coordinates,h,j,d,o,p;for(var f=0;f<i.length;f++){h=i[f],b.beginPath();for(var e=0;e<h.length;e++)j=h[e],o=k(j),p=l(j),d=m.latLngToContainerPoint({lat:o,lng:p}),e===0?b.moveTo(d.x,d.y):b.lineTo(d.x,d.y);b.fill(),b.stroke(),b.closePath()}}}),b.prototype.geoJson=b.prototype.geojson,c.dmap.geoJsonCanvas=function(a){return new b(a)},c.dmap.GeoJsonCanvas=b,module.exports=b | ||
function c(a,b){return typeof a==='function'?a(b):a}function a(b){b=this.options=g.deepMerge(a.options,b),this.updateStyle()}var b=require('./../leaflet'),f=require('bcore/event'),g=require('bcore/utils'),h=require('./../render/canvas'),e=require('./../core/utils').getColorFunc,i=b.dmap=b.dmap||{};a.options={container:'overlayPane',featureId:function(a,b){return a.properties&&a.properties.adcode?a.properties.adcode:b},id:function(){return d.adcode},value:function(a){return a.value},lat:function(a){return a[1]},lng:function(a){return a[0]},style:{lineWidth:2,fill:function(a){return'#0ff'}}},a=f.extend(a,{init:function(){this.initCanvas()},initCanvas:function(){var b=this._map,a=this.options,c=a.container,d=this.dCanvas=new h(b,c,a);this.ctx=d.ctx},addTo:function(a){this._map=a,this.init(),this.initEventsMap()},updateStyle:function(){var a=this.options.style;a.fill&&(a.fill=e(a.fill)),a.stroke&&(a.stroke=e(a.stroke))},geojson:function(g){var b=g.features,e=this.options,c={};for(var a=0;a<b.length;a++){var d=b[a],f=e.featureId(d,a);c[f]=d}this.features=c},data:function(a){var e=this.options;if(Array.isArray(a)){var c,f,d={};for(var b=0;b<a.length;b++)c=a[b],f=e.id(c),d[f]=c;a=d}this._data=a},render:function(a){a&&this.data(a),this.draw()},draw:function(){var d=this.options,h=this._data||{},a=this.features;if(!a)return console.log('没有地理数据 -> geojsonCanvas.geojson(geojson)');var e,b,f,i=d.value.bind(d),g,c=0;for(id in a)e=a[id],b=e.geometry||e,g=h[id],g&&(c=i(g)),f=b.type,f==='MultiPolygon'?this.renderMultiPolygon(b,c):f==='Polygon'&&this.renderPolygon(b,c)},initEventsMap:function(){this.dCanvas.onUpdate(function(){this.draw()}.bind(this))},renderMultiPolygon:function(t,s){var a=this.ctx,r=this._map,g=this.options,q=g.lat,n=g.lng,e=g.style;e.fill&&(a.fillStyle=c(e.fill,s)),e.stroke&&(a.strokeStyle=c(e.stroke,s));var k=t.coordinates,m,i,l,d,o,p;for(var h=0;h<k.length;h++){m=k[h];for(var f=0;f<m.length;f++){i=m[f],a.beginPath();var j;for(var b=0;b<i.length;b++)l=i[b],o=q(l),p=n(l),d=r.latLngToContainerPoint({lat:o,lng:p}),b===0?(a.moveTo(d.x,d.y),j=d):a.lineTo(d.x,d.y),b===i.length-1&&a.lineTo(j.x,j.y);a.fill(),a.stroke(),a.closePath()}}},renderPolygon:function(q,n){var a=this.ctx,m=this._map,g=this.options,k=g.lat,l=g.lng,b=g.style;b.fill&&(a.fillStyle=c(b.fill,n)),b.stroke&&(a.strokeStyle=c(b.stroke,n)),b.lineWidth&&(a.lineWidth=b.lineWidth);var i=q.coordinates,h,j,d,o,p;for(var f=0;f<i.length;f++){h=i[f],a.beginPath();for(var e=0;e<h.length;e++)j=h[e],o=k(j),p=l(j),d=m.latLngToContainerPoint({lat:o,lng:p}),e===0?a.moveTo(d.x,d.y):a.lineTo(d.x,d.y);a.fill(),a.stroke(),a.closePath()}}}),a.prototype.geoJson=a.prototype.geojson,b.dmap.geoJsonCanvas=function(b){return new a(b)},b.dmap.GeoJsonCanvas=a,module.exports=a |
@@ -1,1 +0,1 @@ | ||
function a(h,i,j,k){var g,a,f;for(this.heatmap=h,this.gl=i,this.width=j,this.height=k,this.shader=new e(this.gl,{vertex:'attribute vec4 position, intensity;\nvarying vec2 off, dim;\nvarying float vIntensity;\nuniform vec2 viewport;\n\nvoid main(){\n dim = abs(position.zw);\n off = position.zw;\n vec2 pos = position.xy + position.zw;\n vIntensity = intensity.x;\n gl_Position = vec4((pos/viewport)*2.0-1.0, 0.0, 1.0);\n}',fragment:'#ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp int;\n precision highp float;\n#else\n precision mediump int;\n precision mediump float;\n#endif\nvarying vec2 off, dim;\nvarying float vIntensity;\nvoid main(){\n float falloff = (1.0 - smoothstep(0.0, 1.0, length(off/dim)));\n float intensity = falloff*vIntensity;\n gl_FragColor = vec4(intensity);\n}'}),this.clampShader=new e(this.gl,{vertex:b,fragment:c+'uniform float low, high;\nvoid main(){\n gl_FragColor = vec4(clamp(texture2D(source, texcoord).rgb, low, high), 1.0);\n}'}),this.multiplyShader=new e(this.gl,{vertex:b,fragment:c+'uniform float value;\nvoid main(){\n gl_FragColor = vec4(texture2D(source, texcoord).rgb*value, 1.0);\n}'}),this.blurShader=new e(this.gl,{vertex:b,fragment:c+'uniform vec2 viewport;\nvoid main(){\n vec4 result = vec4(0.0);\n for(int x=-1; x<=1; x++){\n for(int y=-1; y<=1; y++){\n vec2 off = vec2(x,y)/viewport;\n //float factor = 1.0 - smoothstep(0.0, 1.5, length(off));\n float factor = 1.0;\n result += vec4(texture2D(source, texcoord+off).rgb*factor, factor);\n }\n }\n gl_FragColor = vec4(result.rgb/result.w, 1.0);\n}'}),this.nodeBack=new d(this.gl,this.width,this.height),this.nodeFront=new d(this.gl,this.width,this.height),this.vertexBuffer=this.gl.createBuffer(),this.vertexSize=8,this.maxPointCount=10240,this.vertexBufferData=new Float32Array(this.maxPointCount*this.vertexSize*6),this.vertexBufferViews=[],g=a=0,f=this.maxPointCount;0<=f?a<f:a>f;g=0<=f?++a:--a)this.vertexBufferViews.push(new Float32Array(this.vertexBufferData.buffer,0,g*this.vertexSize*6));this.bufferIndex=0,this.pointCount=0}var b=require('./vertexShaderBlit'),c=require('./fragmentShaderBlit'),d=require('./node'),e=require('./shader');a.prototype.resize=function(a,b){return this.width=a,this.height=b,this.nodeBack.resize(this.width,this.height),this.nodeFront.resize(this.width,this.height)},a.prototype.update=function(){var a,b;return this.pointCount>0?(this.gl.enable(this.gl.BLEND),this.nodeFront.use(),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.vertexBuffer),this.gl.bufferData(this.gl.ARRAY_BUFFER,this.vertexBufferViews[this.pointCount],this.gl.STREAM_DRAW),b=this.shader.attribLocation('position'),a=this.shader.attribLocation('intensity'),this.gl.enableVertexAttribArray(1),this.gl.vertexAttribPointer(b,4,this.gl.FLOAT,!1,32,0),this.gl.vertexAttribPointer(a,4,this.gl.FLOAT,!1,32,16),this.shader.use().vec2('viewport',this.width,this.height),this.gl.drawArrays(this.gl.TRIANGLES,0,this.pointCount*6),this.gl.disableVertexAttribArray(1),this.pointCount=0,this.bufferIndex=0,this.nodeFront.end(),this.gl.disable(this.gl.BLEND)):void 0},a.prototype.clear=function(){return this.nodeFront.use(),this.gl.clearColor(0,0,0,1),this.gl.clear(this.gl.COLOR_BUFFER_BIT),this.nodeFront.end()},a.prototype.clamp=function(a,b){return this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.heatmap.quad),this.gl.vertexAttribPointer(0,4,this.gl.FLOAT,!1,0,0),this.nodeFront.bind(0),this.nodeBack.use(),this.clampShader.use().int('source',0).float('low',a).float('high',b),this.gl.drawArrays(this.gl.TRIANGLES,0,6),this.nodeBack.end(),this.swap()},a.prototype.multiply=function(a){return this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.heatmap.quad),this.gl.vertexAttribPointer(0,4,this.gl.FLOAT,!1,0,0),this.nodeFront.bind(0),this.nodeBack.use(),this.multiplyShader.use().int('source',0).float('value',a),this.gl.drawArrays(this.gl.TRIANGLES,0,6),this.nodeBack.end(),this.swap()},a.prototype.blur=function(){return this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.heatmap.quad),this.gl.vertexAttribPointer(0,4,this.gl.FLOAT,!1,0,0),this.nodeFront.bind(0),this.nodeBack.use(),this.blurShader.use().int('source',0).vec2('viewport',this.width,this.height),this.gl.drawArrays(this.gl.TRIANGLES,0,6),this.nodeBack.end(),this.swap()},a.prototype.swap=function(){var a;return a=this.nodeFront,this.nodeFront=this.nodeBack,this.nodeBack=a},a.prototype.addVertex=function(b,c,d,e,a){return this.vertexBufferData[this.bufferIndex++]=b,this.vertexBufferData[this.bufferIndex++]=c,this.vertexBufferData[this.bufferIndex++]=d,this.vertexBufferData[this.bufferIndex++]=e,this.vertexBufferData[this.bufferIndex++]=a,this.vertexBufferData[this.bufferIndex++]=a,this.vertexBufferData[this.bufferIndex++]=a,this.vertexBufferData[this.bufferIndex++]=a},a.prototype.addPoint=function(d,b,e,c){var a;return e==null&&(e=50),c==null&&(c=.2),this.pointCount>=this.maxPointCount-1&&this.update(),b=this.height-b,a=e/2,this.addVertex(d,b,-a,-a,c),this.addVertex(d,b,+a,-a,c),this.addVertex(d,b,-a,+a,c),this.addVertex(d,b,-a,+a,c),this.addVertex(d,b,+a,-a,c),this.addVertex(d,b,+a,+a,c),this.pointCount+=1},module.exports=a | ||
function a(h,i,j,k){var g,a,f;for(this.heatmap=h,this.gl=i,this.width=j,this.height=k,this.shader=new b(this.gl,{vertex:'attribute vec4 position, intensity;\nvarying vec2 off, dim;\nvarying float vIntensity;\nuniform vec2 viewport;\n\nvoid main(){\n dim = abs(position.zw);\n off = position.zw;\n vec2 pos = position.xy + position.zw;\n vIntensity = intensity.x;\n gl_Position = vec4((pos/viewport)*2.0-1.0, 0.0, 1.0);\n}',fragment:'#ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp int;\n precision highp float;\n#else\n precision mediump int;\n precision mediump float;\n#endif\nvarying vec2 off, dim;\nvarying float vIntensity;\nvoid main(){\n float falloff = (1.0 - smoothstep(0.0, 1.0, length(off/dim)));\n float intensity = falloff*vIntensity;\n gl_FragColor = vec4(intensity);\n}'}),this.clampShader=new b(this.gl,{vertex:c,fragment:d+'uniform float low, high;\nvoid main(){\n gl_FragColor = vec4(clamp(texture2D(source, texcoord).rgb, low, high), 1.0);\n}'}),this.multiplyShader=new b(this.gl,{vertex:c,fragment:d+'uniform float value;\nvoid main(){\n gl_FragColor = vec4(texture2D(source, texcoord).rgb*value, 1.0);\n}'}),this.blurShader=new b(this.gl,{vertex:c,fragment:d+'uniform vec2 viewport;\nvoid main(){\n vec4 result = vec4(0.0);\n for(int x=-1; x<=1; x++){\n for(int y=-1; y<=1; y++){\n vec2 off = vec2(x,y)/viewport;\n //float factor = 1.0 - smoothstep(0.0, 1.5, length(off));\n float factor = 1.0;\n result += vec4(texture2D(source, texcoord+off).rgb*factor, factor);\n }\n }\n gl_FragColor = vec4(result.rgb/result.w, 1.0);\n}'}),this.nodeBack=new e(this.gl,this.width,this.height),this.nodeFront=new e(this.gl,this.width,this.height),this.vertexBuffer=this.gl.createBuffer(),this.vertexSize=8,this.maxPointCount=10240,this.vertexBufferData=new Float32Array(this.maxPointCount*this.vertexSize*6),this.vertexBufferViews=[],g=a=0,f=this.maxPointCount;0<=f?a<f:a>f;g=0<=f?++a:--a)this.vertexBufferViews.push(new Float32Array(this.vertexBufferData.buffer,0,g*this.vertexSize*6));this.bufferIndex=0,this.pointCount=0}var c=require('./vertexShaderBlit'),d=require('./fragmentShaderBlit'),e=require('./node'),b=require('./shader');a.prototype.resize=function(a,b){return this.width=a,this.height=b,this.nodeBack.resize(this.width,this.height),this.nodeFront.resize(this.width,this.height)},a.prototype.update=function(){var a,b;return this.pointCount>0?(this.gl.enable(this.gl.BLEND),this.nodeFront.use(),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.vertexBuffer),this.gl.bufferData(this.gl.ARRAY_BUFFER,this.vertexBufferViews[this.pointCount],this.gl.STREAM_DRAW),b=this.shader.attribLocation('position'),a=this.shader.attribLocation('intensity'),this.gl.enableVertexAttribArray(1),this.gl.vertexAttribPointer(b,4,this.gl.FLOAT,!1,32,0),this.gl.vertexAttribPointer(a,4,this.gl.FLOAT,!1,32,16),this.shader.use().vec2('viewport',this.width,this.height),this.gl.drawArrays(this.gl.TRIANGLES,0,this.pointCount*6),this.gl.disableVertexAttribArray(1),this.pointCount=0,this.bufferIndex=0,this.nodeFront.end(),this.gl.disable(this.gl.BLEND)):void 0},a.prototype.clear=function(){return this.nodeFront.use(),this.gl.clearColor(0,0,0,1),this.gl.clear(this.gl.COLOR_BUFFER_BIT),this.nodeFront.end()},a.prototype.clamp=function(a,b){return this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.heatmap.quad),this.gl.vertexAttribPointer(0,4,this.gl.FLOAT,!1,0,0),this.nodeFront.bind(0),this.nodeBack.use(),this.clampShader.use().int('source',0).float('low',a).float('high',b),this.gl.drawArrays(this.gl.TRIANGLES,0,6),this.nodeBack.end(),this.swap()},a.prototype.multiply=function(a){return this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.heatmap.quad),this.gl.vertexAttribPointer(0,4,this.gl.FLOAT,!1,0,0),this.nodeFront.bind(0),this.nodeBack.use(),this.multiplyShader.use().int('source',0).float('value',a),this.gl.drawArrays(this.gl.TRIANGLES,0,6),this.nodeBack.end(),this.swap()},a.prototype.blur=function(){return this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.heatmap.quad),this.gl.vertexAttribPointer(0,4,this.gl.FLOAT,!1,0,0),this.nodeFront.bind(0),this.nodeBack.use(),this.blurShader.use().int('source',0).vec2('viewport',this.width,this.height),this.gl.drawArrays(this.gl.TRIANGLES,0,6),this.nodeBack.end(),this.swap()},a.prototype.swap=function(){var a;return a=this.nodeFront,this.nodeFront=this.nodeBack,this.nodeBack=a},a.prototype.addVertex=function(b,c,d,e,a){return this.vertexBufferData[this.bufferIndex++]=b,this.vertexBufferData[this.bufferIndex++]=c,this.vertexBufferData[this.bufferIndex++]=d,this.vertexBufferData[this.bufferIndex++]=e,this.vertexBufferData[this.bufferIndex++]=a,this.vertexBufferData[this.bufferIndex++]=a,this.vertexBufferData[this.bufferIndex++]=a,this.vertexBufferData[this.bufferIndex++]=a},a.prototype.addPoint=function(d,b,e,c){var a;return e==null&&(e=50),c==null&&(c=.2),this.pointCount>=this.maxPointCount-1&&this.update(),b=this.height-b,a=e/2,this.addVertex(d,b,-a,-a,c),this.addVertex(d,b,+a,-a,c),this.addVertex(d,b,-a,+a,c),this.addVertex(d,b,-a,+a,c),this.addVertex(d,b,+a,-a,c),this.addVertex(d,b,+a,+a,c),this.pointCount+=1},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({aggregatedData:{},includes:[a.Mixin.Events],initialize:function(a){a=this.options=b.deepMerge(e.options,a),this.check(),this.getMax=a.getMax,this.grids=[]},check:function(){var a=this.options;if(!a.appid)throw'必须要设定 appid';if(!a.mapid)throw'必须要设定 mapid';if(!a.data)throw'必须要设定 热力图接口'},addTo:function(b){if(this._map||!b)return;this._map=b;var d=this.options.grid;this.gridEncoder=new c().transform(function(i,m){var d=b.getSize(),e=d.x/2,f=d.y/2,h=e-i,j=f+m,k=e+i,l=f-m,g=b.containerPointToLatLng(a.point(h,j)),c=b.containerPointToLatLng(a.point(k,l));return{dlat:c.lat-g.lat,dlng:c.lng-g.lng}}).shape('rect').rx(d.rx).ry(d.ry).update(),this.initEventsMap(),this.refresh()},data:function(a){if(!a)return this._data;this._data=a;var b=this.options;b.isAutoUpdate&&this._map&&this.draw(),this.updateColor()},initEventsMap:function(){this._map.on('moveend',this.refresh.bind(this))},refresh:function(e){var b=this,a=this.options,c=a.data,d={appid:a.appid,bbox:this.getBounds(),indicator:a.indicator,zoom:this._map.getZoom()};c(d,b.render.bind(this))},getBounds:function(){var c=this._map.getBounds(),a=c._southWest,b=c._northEast,d=.5*(b.lat-a.lat),e=.5*(b.lng-a.lng);return[[a.lat-d,b.lat+d],[a.lng-e,b.lng+e]]},updateColor:function(d,h,i,j){if(!d)return;var e=this.getColor=b.getColorFunc(d,h,i,j),a=this.gridMap,c,f;for(var g in a)c=a[g],f=c._value,c.setStyle({fillColor:e(f)})},_updateTranformOriginGird:function(b){if(!b)return;var a=b.getBBox(),c=a.width/2+a.x+'px '+(a.height/2+a.y)+'px 0px';b.style['transform-origin']=c,b.style['-webkit-transform-origin']=c},_updateTransformOrigin:function(){if(!this.scaleGridFunc)return;var a=this.gridMap,b=this;setTimeout(function(){for(var c in a)b._updateTranformOriginGird(a[c]._container)})},render:function(a){a&&this.data(a),this.draw()},clean:function(){var a=this.grids,b=this._map;for(var c in a)b.removeLayer(a[c]);this.grids=[]},draw:function(){this.clean();var l=this.grids,f=this.options,t=this.gridEncoder,m=f.grid.normal,n=d(f.color),o=f.value,g=this._data,s=this.gridMap,p=this._map,c,h,i,j,k;for(var r in g){var b=g[r];j=b[0],h=b[1],k=b[2],i=b[3];var q=[a.latLng(h,j),a.latLng(i,j),a.latLng(i,k),a.latLng(h,k)],e=o(b);if(c=a.polygon(q,m).addTo(p),c.setStyle({fillColor:n(e)}),c._value=e,c._heatdata=b,l.push(c),this.initEventsGrid(c),!this.scaleGridFunc)continue;this.scaleGridFunc(c,e)}},initEventsGrid:function(a){var c=this,j=this.aggregatedData,d=this.options.grid,e=d.click||{},g=d.mouseover||{},f=d.normal||{},h=a._gridid,i=a._heatdata,b={gridid:h,data:i};a.on('mouseover',function(d){g&&a.setStyle(g),c.fire('grid-mouseover',b),a.bringToFront()}).on('mouseout',function(d){f&&a.setStyle(f),c.fire('grid-mouseout',b)}).on('mousedown',function(d){e&&a.setStyle(e),c.fire('grid-click',b)}).on('dblclick',function(a){c.fire('grid-dblclick',b)})}});e.options={appid:null,mapid:null,clusterStepByZoom:1,isAutoUpdate:!0,isNeedAggregate:!0,grid:{mouseover:{opacity:1,color:'#fff',fillOpacity:1},normal:{opacity:0,weight:1,fillOpacity:1},click:{},rx:30,ry:25},color:d('rgba(62,18,0,0.8)','rgba(255,208,122,0.8)','hsl','linear.Out.1.4'),lng:b.getLng,lat:b.getLat,scale:function(a){return 1},value:function(a,b,c){return a[4]}};var f=a.dmap=a.dmap||{};f.HeatmapGrid=e,f.heatmapGrid=function(a){return e(a)},e.getSizeList=function(u,s,d){var w=d.getCenter(),q=d.getSize(),k=q.x/2,j=q.y/2,v=k-u,i=j+s,m=k+u,t=j-s,h=d.containerPointToLatLng(a.point(v,i)),f=d.containerPointToLatLng(a.point(m,t)),l=d.containerPointToLatLng(a.point(m,i)),r=f.lat-h.lat,n=f.lng-h.lng,o=h.distanceTo(l),p=f.distanceTo(l),e=d.getZoom(),g=[];for(var b=1;b<e;b++){var c=Math.pow(2,e-b);g[b]={zoom:b,dx:o*c,dy:p*c,dlat:r*c,dlng:n*c}}for(var b=e;b<19;b++){var c=Math.pow(.5,b-e);g[b]={zoom:b,dx:o*c,dy:p*c,dlat:r*c,dlng:n*c}}return g},module.exports=e | ||
'use strict';var a=require('./../leaflet'),b=require('@ali/map-utils'),f=b.Grid,d=b.getColorFunc,c=a.Class.extend({aggregatedData:{},includes:[a.Mixin.Events],initialize:function(a){a=this.options=b.deepMerge(c.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 c=this.options.grid;this.gridEncoder=new f().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(c.rx).ry(c.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)})}});c.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 e=a.dmap=a.dmap||{};e.HeatmapGrid=c,e.heatmapGrid=function(a){return c(a)},c.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=c |
@@ -1,1 +0,1 @@ | ||
'use strict';function a(b){this.options=c.deepMerge(a.options,b),this.initialize(b)}var b=require('./../leaflet'),c=require('./../core/utils'),d=c.Grid,e=c.getColorFunc,f=require('lodash'),g=require('bcore/event');a.options={clusterStepByZoom:1,isAutoUpdate:!0,isNeedAggregate:!0,shape:{type:'hex',rx:20,ry:18,mouseover:{fillOpacity:.8,color:'rgba(255,255,255,0.9)'},mouseout:{fillOpacity:1,color:'rgba(255,255,255,0.0)'},style:{weight:0,fillOpacity:1,color:'rgba(255,255,255,0.0)'},click:{}},color:e('rgba(62,18,0,0.8)','rgba(255,208,122,0.8)','hsl','linear.Out.1.4'),scale:function(a){return 1},value:function(a,b,c){return Math.min(1,a.length/40)},lng:c.getLng,lat:c.getLat,popup:function(a){return'区域内有: '+a.length+'点'}},a=g.extend(a,{initialize:function(){var a=this.options;this.events={'grid-resize':{desc:'格子大小发生变化'},'grid-mouseover':{desc:'鼠标移至格子范围'},'grid-dblclick':{desc:'双击格子'},'grid-mouseout':{desc:'鼠标移出格子范围'},'grid-click':{desc:'点击某个格子'}},this.gridMap={},this.aggregatedData={},this.getMax=a.getMax,this.getScale=c.getColorFunc(a.shape.scale||a.scale),this.isable=!0},addTo:function(a){if(this._map||!a)return;this._map=a,this.initDataProcesser(),this._data&&this.updateZoom()},initDataProcesser:function(){var a=this._map,c=this.options.shape;this.gridEncoder=new d().transform(function(i,m){var d=a.getSize(),e=d.x/2,f=d.y/2,h=e-i,j=f+m,k=e+i,l=f-m,g=a.containerPointToLatLng(b.point(h,j)),c=a.containerPointToLatLng(b.point(k,l));return{dlat:c.lat-g.lat,dlng:c.lng-g.lng}}).shape(c.type).rx(c.rx).ry(c.ry).update(),this.initEventsMap()},initEventsMap:function(){var a=this;this._map.on('moveend',function(){this.render()}.bind(this)).on('zoomend',function(){a.updateZoom()})},updateZoom:function(){var a=this.options,d=a.clusterStepByZoom,b=this._map;if(a.isNeedAggregate){var e=b.getZoom(),c=Math.floor(e/d);if(c===this.zoomLevel)return;b.closePopup(),this.gridEncoder.update(),this.zoomLevel=c,this.clean(),this.aggregate(),this.fire('grid-resize'),this._updateTransformOrigin()}},aggregate:function(){if(!this.isable)return;var b=this.gridEncoder,a=this.options,f=this._data,d=a.lat,e=a.lng;this.aggregatedData=c.mapReduce(this._data,{map:function(c,a){return{key:b.encode(d(a),e(a)),value:a}}})},getBounds:function(){var c=this._map.getBounds(),a=c._southWest,b=c._northEast,d=.5*(b.lat-a.lat),e=.5*(b.lng-a.lng);return{latMin:a.lat-d,latMax:b.lat+d,lngMin:a.lng-e,lngMax:b.lng+e}},clean:function(){var a=this.gridMap,c=this._map;for(var b in a){var d=a[b];c.removeLayer(d),delete a[b]}},disable:function(){this.isable=!1,this.clean()},enable:function(){this.isable=!0,this.draw()},link:function(){},updateShape:function(){this.clean();var b=this.options.shape,c=b.type,d=b.rx,e=b.ry,a=this.gridEncoder;this._map.closePopup(),a.shape(c),a.rx(d),a.ry(e),a.update(),this.aggregate(),this.draw()},updateColor:function(a,h,i,j){a||(a=this.options.color);var e=this.getColor=c.getColorFunc(a,h,i,j),b=this.gridMap,d,f;for(var g in b)d=b[g],f=d._value,d.setStyle({fillColor:e(f)})},updateOptions:function(a){this.options=c.deepMerge(this.options,a),this.updateColor(),this.updateShape()},updateScale:function(a){if(!a)return;this.scaleGridFunc=function(e,f){if(!e)return;var b=e._container;this._updateTranformOriginGird(b);var c=a(f),d='scale3d('+c+','+c+',1)';b.style.transform=d,b.style['-webkit-transform']=d,this.getScale=a}},_updateTranformOriginGird:function(b){if(!b)return;var a=b.getBBox(),c=a.width/2+a.x+'px '+(a.height/2+a.y)+'px 0px';b.style['transform-origin']=c,b.style['-webkit-transform-origin']=c},_updateTransformOrigin:function(){if(!this.scaleGridFunc)return;var a=this.gridMap,b=this;setTimeout(function(){for(var c in a)b._updateTranformOriginGird(a[c]._container)})},data:function(b){if(!b)return this._data;this._data=b;var a=this.options;a.isAutoUpdate&&this._map&&this.aggregate(),this.updateColor();var c=a.shape},render:function(a){a&&this.data(a),this.draw()},each:function(d){var a=this.gridMap;for(var b in a){var c=a[b];d(c,b)}},draw:function(){if(!this.isable)return;var l=this.drawid='id_'+Math.floor(Math.random()*1e10),j=this.options,x=this.gridEncoder,u=j.shape.style,B=c.getColorFunc(j.shape.color||j.color),p=j.value,h=this.aggregatedData,f=this.gridMap,o=this._map,i=this.getBounds(),a,C=i.latMax,D=i.latMin,A=i.lngMax,y=i.lngMin,g,k;for(var d in h){var e=p(h[d]);g||(g=e),k||(k=e),g=Math.min(e,g),k=Math.max(e,k)}for(var d in h){var w=h[d],q=x.decode(d),r=q.center,z=q.pts,s=r[0],t=r[1];if(s<D||t<y||s>C||t>A)continue;var e=p(w)||0,n=(e-g)/(k-g)||0,v=B(n);a=f[d],a?(a.setStyle({fillColor:v}),a._drawid=l):(u.fillColor=v,a=f[d]=b.polygon(z,u).addTo(o),a._value=n,a._gridid=d,a._drawid=l,this.initEventsGrid(a),this.scaleGridFunc&&this.scaleGridFunc(a,n))}for(var m in f)f[m]._drawid!==l&&(o.removeLayer(f[m]),delete f[m]);this._updateTransformOrigin()},initEventsGrid:function(a){var c=this,n=this.aggregatedData,g=this.options.shape,e=g.click||{},m=g.mouseover||{},i=g.mouseout||{},h=a._gridid,k=this._map,l=n[h],d={gridid:h,data:l,layer:a},f=a.getBounds(),o=f._northEast.lat,p=(f._southWest.lng+f._northEast.lng)/2,q=b.latLng(o,p),j;this.options.popup&&(j=this.options.popup(l,a)),a.on('mouseover',function(e){return m&&a.setStyle(m),c.fire('child-mouseover',d),b.DomEvent.stopPropagation(e),b.DomEvent.preventDefault(e),a.bringToFront(),!0}).on('mouseout',function(e){return i&&a.setStyle(i),c.fire('child-mouseout',d),b.DomEvent.stopPropagation(e),b.DomEvent.preventDefault(e),!0}).on('mousedown',function(f){return e&&a.setStyle(e),c.fire('grid-mousedown',d),k.closePopup(),j&&setTimeout(function(){k.openPopup(j,q)},100),b.DomEvent.stopPropagation(f),b.DomEvent.preventDefault(f),!0}).on('click',function(f){return e&&a.setStyle(e),c.fire('child-click',d),b.DomEvent.stopPropagation(f),b.DomEvent.preventDefault(f),!0}).on('dblclick',function(a){return c.fire('child-dblclick',d),b.DomEvent.stopPropagation(a),b.DomEvent.preventDefault(a),!0})}});var h=b.dmap=b.dmap||{};h.HeatmapGrid=a,h.heatmapGrid=function(b){return a(b)},module.exports=a | ||
'use strict';function c(a){this.options=b.deepMerge(c.options,a),this.initialize(a)}var a=require('./../leaflet'),b=require('./../core/utils'),e=b.Grid,f=b.getColorFunc,h=require('lodash'),g=require('bcore/event');c.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:f('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:b.getLng,lat:b.getLat,popup:function(a){return'区域内有: '+a.length+'点'}},c=g.extend(c,{initialize:function(){var a=this.options;this.events={'grid-resize':{desc:'格子大小发生变化'},'grid-mouseover':{desc:'鼠标移至格子范围'},'grid-dblclick':{desc:'双击格子'},'grid-mouseout':{desc:'鼠标移出格子范围'},'grid-click':{desc:'点击某个格子'}},this.gridMap={},this.aggregatedData={},this.getMax=a.getMax,this.getScale=b.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 b=this._map,c=this.options.shape;this.gridEncoder=new e().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(c.type).rx(c.rx).ry(c.ry).update(),this.initEventsMap()},initEventsMap:function(){var a=this;this._map.on('moveend',function(){this.render()}.bind(this)).on('zoomend',function(){a.updateZoom()})},updateZoom:function(){var a=this.options,d=a.clusterStepByZoom,b=this._map;if(a.isNeedAggregate){var e=b.getZoom(),c=Math.floor(e/d);if(c===this.zoomLevel)return;b.closePopup(),this.gridEncoder.update(),this.zoomLevel=c,this.clean(),this.aggregate(),this.fire('grid-resize'),this._updateTransformOrigin()}},aggregate:function(){if(!this.isable)return;var c=this.gridEncoder,a=this.options,f=this._data,d=a.lat,e=a.lng;this.aggregatedData=b.mapReduce(this._data,{map:function(b,a){return{key:c.encode(d(a),e(a)),value:a}}})},getBounds:function(){var c=this._map.getBounds(),a=c._southWest,b=c._northEast,d=.5*(b.lat-a.lat),e=.5*(b.lng-a.lng);return{latMin:a.lat-d,latMax:b.lat+d,lngMin:a.lng-e,lngMax:b.lng+e}},clean:function(){var a=this.gridMap,c=this._map;for(var b in a){var d=a[b];c.removeLayer(d),delete a[b]}},disable:function(){this.isable=!1,this.clean()},enable:function(){this.isable=!0,this.draw()},link:function(){},updateShape:function(){this.clean();var b=this.options.shape,c=b.type,d=b.rx,e=b.ry,a=this.gridEncoder;this._map.closePopup(),a.shape(c),a.rx(d),a.ry(e),a.update(),this.aggregate(),this.draw()},updateColor:function(a,h,i,j){a||(a=this.options.color);var e=this.getColor=b.getColorFunc(a,h,i,j),c=this.gridMap,d,f;for(var g in c)d=c[g],f=d._value,d.setStyle({fillColor:e(f)})},updateOptions:function(a){this.options=b.deepMerge(this.options,a),this.updateColor(),this.updateShape()},updateScale:function(a){if(!a)return;this.scaleGridFunc=function(e,f){if(!e)return;var b=e._container;this._updateTranformOriginGird(b);var c=a(f),d='scale3d('+c+','+c+',1)';b.style.transform=d,b.style['-webkit-transform']=d,this.getScale=a}},_updateTranformOriginGird:function(b){if(!b)return;var a=b.getBBox(),c=a.width/2+a.x+'px '+(a.height/2+a.y)+'px 0px';b.style['transform-origin']=c,b.style['-webkit-transform-origin']=c},_updateTransformOrigin:function(){if(!this.scaleGridFunc)return;var a=this.gridMap,b=this;setTimeout(function(){for(var c in a)b._updateTranformOriginGird(a[c]._container)})},data:function(b){if(!b)return this._data;this._data=b;var a=this.options;a.isAutoUpdate&&this._map&&this.aggregate(),this.updateColor();var c=a.shape},render:function(a){a&&this.data(a),this.draw()},each:function(d){var a=this.gridMap;for(var b in a){var c=a[b];d(c,b)}},draw:function(){if(!this.isable)return;var l=this.drawid='id_'+Math.floor(Math.random()*1e10),j=this.options,x=this.gridEncoder,u=j.shape.style,B=b.getColorFunc(j.shape.color||j.color),p=j.value,h=this.aggregatedData,f=this.gridMap,o=this._map,i=this.getBounds(),c,C=i.latMax,D=i.latMin,A=i.lngMax,y=i.lngMin,g,k;for(var d in h){var e=p(h[d]);g||(g=e),k||(k=e),g=Math.min(e,g),k=Math.max(e,k)}for(var d in h){var w=h[d],q=x.decode(d),r=q.center,z=q.pts,s=r[0],t=r[1];if(s<D||t<y||s>C||t>A)continue;var e=p(w)||0,n=(e-g)/(k-g)||0,v=B(n);c=f[d],c?(c.setStyle({fillColor:v}),c._drawid=l):(u.fillColor=v,c=f[d]=a.polygon(z,u).addTo(o),c._value=n,c._gridid=d,c._drawid=l,this.initEventsGrid(c),this.scaleGridFunc&&this.scaleGridFunc(c,n))}for(var m in f)f[m]._drawid!==l&&(o.removeLayer(f[m]),delete f[m]);this._updateTransformOrigin()},initEventsGrid:function(b){var c=this,n=this.aggregatedData,g=this.options.shape,e=g.click||{},m=g.mouseover||{},i=g.mouseout||{},h=b._gridid,k=this._map,l=n[h],d={gridid:h,data:l,layer:b},f=b.getBounds(),o=f._northEast.lat,p=(f._southWest.lng+f._northEast.lng)/2,q=a.latLng(o,p),j;this.options.popup&&(j=this.options.popup(l,b)),b.on('mouseover',function(e){return m&&b.setStyle(m),c.fire('child-mouseover',d),a.DomEvent.stopPropagation(e),a.DomEvent.preventDefault(e),b.bringToFront(),!0}).on('mouseout',function(e){return i&&b.setStyle(i),c.fire('child-mouseout',d),a.DomEvent.stopPropagation(e),a.DomEvent.preventDefault(e),!0}).on('mousedown',function(f){return e&&b.setStyle(e),c.fire('grid-mousedown',d),k.closePopup(),j&&setTimeout(function(){k.openPopup(j,q)},100),a.DomEvent.stopPropagation(f),a.DomEvent.preventDefault(f),!0}).on('click',function(f){return e&&b.setStyle(e),c.fire('child-click',d),a.DomEvent.stopPropagation(f),a.DomEvent.preventDefault(f),!0}).on('dblclick',function(b){return c.fire('child-dblclick',d),a.DomEvent.stopPropagation(b),a.DomEvent.preventDefault(b),!0})}});var d=a.dmap=a.dmap||{};d.HeatmapGrid=c,d.heatmapGrid=function(a){return c(a)},module.exports=c |
@@ -1,1 +0,1 @@ | ||
'use strict';var a=require('./../leaflet'),b=require('@ali/map-utils'),c=b.Grid,d=b.getColorFunc,e=a.Class.extend({lines:[{id:'format'},{id:'bind'},{id:'events'}],nodes:{data:{schema:{shapeHash:{type:'string',desc:'类似geohash 对形态的编码'}}},shape:{pts:['lat','lng']}},emits:{'grid-resize':{desc:'格子大小发生变化'},'grid-mouseover':{desc:'鼠标移至格子范围'},'grid-dblclick':{desc:'双击格子'},'grid-mouseout':{desc:'鼠标移出格子范围'},'grid-click':{desc:'点击某个格子'}},options:{clusterStepByZoom:1,isAutoUpdate:!0,isNeedAggregate:!0,grid:{mouseover:{fillOpacity:.8,color:'rgba(255,255,255,0.9)'},mouseout:{fillOpacity:1,color:'rgba(255,255,255,0.0)'},click:{},weight:1,color:'rgba(255,255,255,0)',fillOpacity:1,rx:30,ry:25},getColor:d('rgba(62,18,0,0.8)','rgba(255,208,122,0.8)','hsl','linear.Out.1.4'),lng:b.getLng,lat:b.getLat,scale:function(a){return 1},value:function(a,b,c){return Math.min(1,a.length/b)}},gridMap:{},aggregatedData:{},includes:[a.Mixin.Events],initialize:function(a){a=b.deepMerge(this.options,a),this.getMax=a.getMax,this.getColor=b.getColorFunc(a.getColor),this.getScale=b.getColorFunc(a.scale)},addTo:function(b){if(this._map||!b)return;this._map=b;var d=this.options.grid;this.gridEncoder=new c().transform(function(i,m){var d=b.getSize(),e=d.x/2,f=d.y/2,h=e-i,j=f+m,k=e+i,l=f-m,g=b.containerPointToLatLng(a.point(h,j)),c=b.containerPointToLatLng(a.point(k,l));return{dlat:c.lat-g.lat,dlng:c.lng-g.lng}}).shape('rect').rx(d.rx).ry(d.ry).update(),this.initEventsMap(),this._data&&this.updateZoom()},data:function(a){if(!a)return this._data;this._data=a;var b=this.options;b.isAutoUpdate&&this._map&&this.updateZoom(),this.updateColor()},initEventsMap:function(){var a=this;this._map.on('moveend',function(){this.render()}.bind(this)).on('zoomend',function(){a.updateZoom()})},updateZoom:function(){var a=this.options,c=a.clusterStepByZoom,d=this._map;if(a.isNeedAggregate){var e=d.getZoom(),b=Math.floor(e/c);if(b===this.zoomLevel)return;this.gridEncoder.update(),this.zoomLevel=b,this.clean(),this.aggregate(),this.fire('grid-resize'),this._updateTransformOrigin()}},aggregate:function(){var h=this.gridEncoder,c,d=this.options,e=this.aggregatedData,b,f=this._data,a,i=d.lat,j=d.lng;for(var g in f)a=f[g],b=h.encode(i(a),j(a)),c=e[b],c?c.push(a):e[b]=[a]},getBounds:function(){var c=this._map.getBounds(),a=c._southWest,b=c._northEast,d=.5*(b.lat-a.lat),e=.5*(b.lng-a.lng);return{latMin:a.lat-d,latMax:b.lat+d,lngMin:a.lng-e,lngMax:b.lng+e}},clean:function(){var a=this.gridMap,c=this._map;for(var b in a){var d=a[b];c.removeLayer(d),delete a[b]}this.aggregatedData={}},remove:function(){this.clean()},link:function(){},updateColor:function(d,h,i,j){if(!d)return;var e=this.getColor=b.getColorFunc(d,h,i,j),a=this.gridMap,c,f;for(var g in a)c=a[g],f=c._value,c.setStyle({fillColor:e(f)})},updateScale:function(a){if(!a)return;this.scaleGridFunc=function(e,f){if(!e)return;var b=e._container;this._updateTranformOriginGird(b);var c=a(f),d='scale3d('+c+','+c+',1)';b.style.transform=d,b.style['-webkit-transform']=d,this.getScale=a}},_updateTranformOriginGird:function(b){if(!b)return;var a=b.getBBox(),c=a.width/2+a.x+'px '+(a.height/2+a.y)+'px 0px';b.style['transform-origin']=c,b.style['-webkit-transform-origin']=c},_updateTransformOrigin:function(){if(!this.scaleGridFunc)return;var a=this.gridMap,b=this;setTimeout(function(){for(var c in a)b._updateTranformOriginGird(a[c]._container)})},render:function(a){a&&this.data(a),this.draw()},draw:function(){var m=this.options,n=this.gridEncoder,h=m.grid,u=this.getColor,w=m.value,g=this.aggregatedData,i=this.gridMap,t=this._map,c=this.getBounds(),d,x=c.latMax,r=c.latMin,o=c.lngMax,p=c.lngMin,q=40;for(var b in g){var s=g[b],j=n.decode(b),k=j.center,v=j.pts,l=k[0],f=k[1];if(l<r||f<p||l>x||f>o)continue;var e=w(s,q,0);if(!i[b]){if(h.fillColor=u(e),d=i[b]=a.polygon(v,h).addTo(t),d._value=e,d._gridid=b,this.initEventsGrid(d),!this.scaleGridFunc)continue;this.scaleGridFunc(d,e)}}},initEventsGrid:function(a){var b=this,i=this.aggregatedData,d=this.options.grid,e=d.click||{},f=d.mouseover||{},g=d.mouseout||{},h=a._gridid,c={gridid:h,data:i[h]};a.on('mouseover',function(d){f&&a.setStyle(f),b.fire('grid-mouseover',c),a.bringToFront()}).on('mouseout',function(d){g&&a.setStyle(g),b.fire('grid-mouseout',c)}).on('mousedown',function(d){e&&a.setStyle(e),b.fire('grid-click',c)}).on('dblclick',function(a){b.fire('grid-dblclick',c)})}}),f=a.dmap=a.dmap||{};f.HeatmapGrid=e,f.heatmapGrid=function(a){return e(a)},module.exports=e | ||
'use strict';var b=require('./../leaflet'),a=require('@ali/map-utils'),e=a.Grid,f=a.getColorFunc,c=b.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:f('rgba(62,18,0,0.8)','rgba(255,208,122,0.8)','hsl','linear.Out.1.4'),lng:a.getLng,lat:a.getLat,scale:function(a){return 1},value:function(a,b,c){return Math.min(1,a.length/b)}},gridMap:{},aggregatedData:{},includes:[b.Mixin.Events],initialize:function(b){b=a.deepMerge(this.options,b),this.getMax=b.getMax,this.getColor=a.getColorFunc(b.getColor),this.getScale=a.getColorFunc(b.scale)},addTo:function(a){if(this._map||!a)return;this._map=a;var c=this.options.grid;this.gridEncoder=new e().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('rect').rx(c.rx).ry(c.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=a.getColorFunc(d,h,i,j),b=this.gridMap,c,f;for(var g in b)c=b[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 a in g){var s=g[a],j=n.decode(a),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[a]){if(h.fillColor=u(e),d=i[a]=b.polygon(v,h).addTo(t),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.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)})}}),d=b.dmap=b.dmap||{};d.HeatmapGrid=c,d.heatmapGrid=function(a){return c(a)},module.exports=c |
@@ -1,1 +0,1 @@ | ||
function a(b){this.options=c.deepMergeWithoutArray(a.options,b)}var b=require('bcore/event'),c=require('bcore/utils'),d=require('leaflet');a.options={opacity:1},a=b.extend(a,{addTo:function(a){if(!a)return;this.map=a},render:function(a){if(!a)return;this.data(a)},data:function(a){if(a=a[0],a.length>1)return console.log('目前只支持一张图片');if(!(a.leftbottom&&a.righttop))return console.log('数据格式不正确');this.southWest=[a.leftbottom.lat,a.leftbottom.lng],this.northEast=[a.righttop.lat,a.righttop.lng],this.imageUrl=a.url,this.draw()},draw:function(){var a=this.options;this.imageOverLayer&&this.map.removeLayer(this.imageOverLayer);var b=[this.southWest,this.northEast],c=this.imageUrl;this.imageOverLayer=d.imageOverlay(c,b).addTo(this.map),this.imageOverLayer.setOpacity(a.opacity)},updateOptions:function(a){a&&(this.options=c.deepMergeWithoutArray(this.options,a)),this.updateOpacity()},updateOpacity:function(){var a=this.options,b=a.opacity;this.imageOverLayer&&this.imageOverLayer.setOpacity(b)},remove:function(){this.map.removeLayer(this.imageOverLayer),this.southWest=null,this.northEast=null,this.imageUrl=null}});var e=d.dmap=d.dmap||{};e.ImageLayer=a,e.imageLayer=function(b){return new a(b)},module.exports=a | ||
function a(b){this.options=c.deepMergeWithoutArray(a.options,b)}var e=require('bcore/event'),c=require('bcore/utils'),b=require('leaflet');a.options={opacity:1},a=e.extend(a,{addTo:function(a){if(!a)return;this.map=a},render:function(a){if(!a)return;this.data(a)},data:function(a){if(a=a[0],a.length>1)return console.log('目前只支持一张图片');if(!(a.leftbottom&&a.righttop))return console.log('数据格式不正确');this.southWest=[a.leftbottom.lat,a.leftbottom.lng],this.northEast=[a.righttop.lat,a.righttop.lng],this.imageUrl=a.url,this.draw()},draw:function(){var a=this.options;this.imageOverLayer&&this.map.removeLayer(this.imageOverLayer);var c=[this.southWest,this.northEast],d=this.imageUrl;this.imageOverLayer=b.imageOverlay(d,c).addTo(this.map),this.imageOverLayer.setOpacity(a.opacity)},updateOptions:function(a){a&&(this.options=c.deepMergeWithoutArray(this.options,a)),this.updateOpacity()},updateOpacity:function(){var a=this.options,b=a.opacity;this.imageOverLayer&&this.imageOverLayer.setOpacity(b)},remove:function(){this.map.removeLayer(this.imageOverLayer),this.southWest=null,this.northEast=null,this.imageUrl=null}});var d=b.dmap=b.dmap||{};d.ImageLayer=a,d.imageLayer=function(b){return new a(b)},module.exports=a |
@@ -1,1 +0,1 @@ | ||
function a(a){this.options=c.deepMerge(this.options,a),this.options.classes=a.classes}var b=require('bcore/event'),c=require('bcore/utils'),d=require('leaflet'),e=require('geojson-extent'),f=require('chroma-js'),a=b.extend(a,{options:{zIndex:10,opacity:.8,classifyType:'linear',colors:10,classes:[],cellWidth:1e6,dweight:.5,defaultColor:'rgba(255,255,255,0.5)',startColor:'#cbf01e',middleColor:'#ff0',endColor:'#fa1d00',getLat:function(a){return a.lat},getLng:function(a){return a.lng},getValue:function(a){return a.value}},init:function(){this.initCanvas()},initCanvas:function(){var a=this.map;this.canvas=d.DomUtil.create('canvas','leaflet-layer leaflet-zoom-hide'),this.canvas.style.pointerEvents='none',this.canvas.style.zIndex=this.options.zIndex,this.canvas.style.opacity=this.options.opacity;var b=a.getSize();this.canvas.width=b.x,this.canvas.height=b.y,a.getPanes().overlayPane.appendChild(this.canvas)},setClipGeo:function(a){a&&a.features?(this.clipGeo=a,this.genGrid(),this.render()):(this.clipGeo=null,this.genGrid(),this.render())},setData:function(a){this.data=a,this.genGrid(),this.render()},distance:function(i,h,o){var k={kilometers:1,miles:.621371192237334,nauticalmiles:.5399568034557235,meters:1e3,metres:1e3,yards:1093.6132983377079,feet:3280.839895013123,inches:39370.078740157485},f=o?k[o]:1,j=(i[1]+h[1])/2,a=Math.cos(j*Math.PI/180),b=2*a*a-1,c=2*a*b-a,e=2*a*c-b,l=2*a*e-c,m=f*(111.41513*a-.09455*c+12e-5*l),n=f*(111.13209-.56605*b+.0012*e),d=(i[0]-h[0])*m,g=(i[1]-h[1])*n;return Math.sqrt(d*d+g*g)},getExtent:function(){var c,a=this.data,b=this;if(this.clipGeo)c=e(this.clipGeo);else{var d,f,g,h;d=Math.min.apply(null,a.map(function(a){return b.options.getLng(a)})),f=Math.min.apply(null,a.map(function(a){return b.options.getLat(a)})),g=Math.max.apply(null,a.map(function(a){return b.options.getLng(a)})),h=Math.max.apply(null,a.map(function(a){return b.options.getLat(a)})),c=[d,f,g,h]}return c},genGrid:function(){var l=this.data;if(!l||l.length===0)return;var a=this.getExtent(),o=this.options.cellWidth,s=o/this.distance([a[0],a[1]],[a[2],a[1]],'meters'),g=this.cellWidth=s*(a[2]-a[0]),r=o/this.distance([a[0],a[1]],[a[0],a[3]],'meters'),i=this.cellHeight=r*(a[3]-a[1]),q=Math.ceil((a[2]-a[0])/g)*Math.ceil((a[3]-a[1])/ i),j=this.idwResults=new Float64Array(q*3),e=a[0];this.index=0,this.minZ=Infinity,this.maxZ=-Infinity;while(e<=a[2]){var d=a[1];while(d<=a[3]){var m,h=0,n=0;for(var k=this.data.length-1;k>=0;k--){var c=this.data[k],p=this.distance([this.options.getLng(c),this.options.getLat(c)],[e+g/2,d+i/2],'meters');if(p===0){h=this.options.getValue(c);return}m=1/Math.pow(p,this.options.dweight),n+=m,h+=m*this.options.getValue(c)}var b=h/n;this.minZ=b<this.minZ?b:this.minZ,this.maxZ=b>this.maxZ?b:this.maxZ,j[this.index*3+0]=e,j[this.index*3+1]=d,j[this.index*3+2]=b,d+=i,this.index++}e+=g}this.colorScale=f.scale([this.options.startColor,this.options.middleColor,this.options.endColor]).mode('hsl').domain([this.minZ,this.maxZ]).classes(this.options.colors)},addTo:function(a){this.map=a,a.on('moveend',this.onmoveend,this),this.init()},resize:function(){var b=this.map.getSize();this.canvas.width=b.x,this.canvas.height=b.y;var a=d.DomUtil.getPosition(this.map.getPanes().mapPane);a&&d.DomUtil.setPosition(this.canvas,{x:-a.x,y:-a.y})},render:function(){if(!this.idwResults)return;var i=this.map,f=this.map.getSize(),a=this.canvas.getContext('2d');if(a.clearRect(0,0,f.x,f.y),a.save(),this.clipGeo){var g=this;a.beginPath(),a.fillStyle='rgba(0,0,0,0)',this.clipGeo.features.forEach(function(b){switch(b.geometry.type){case'Polygon':g.renderPolygon(a,b.geometry.coordinates[0]);break;case'MultiPolygon':b.geometry.coordinates.forEach(function(b){g.renderPolygon(a,b[0])});break}}),a.clip()}for(var e=0;e<this.index;e++){var b=this.idwResults[e*3+0],c=this.idwResults[e*3+1],j=this.idwResults[e*3+2];if(!i.getBounds().intersects([d.latLng(c,b),d.latLng(c+this.cellHeight,b+this.cellWidth)]))continue;var k=[[b,c],[b,c+this.cellHeight],[b+this.cellWidth,c+this.cellHeight],[b+this.cellWidth,c],[b,c]],h=this.genColor(j);a.beginPath(),a.fillStyle=h,this.renderPolygon(a,k),a.fill()}a.restore()},renderPolygon:function(f,a){var b=this.map,c=b.latLngToContainerPoint(d.latLng(a[0][1],a[0][0]));for(f.moveTo(~~(.5+c.x),~~(.5+c.y)),j=1;j<a.length;j++){var e=b.latLngToContainerPoint(d.latLng(a[j][1],a[j][0]));f.lineTo(~~(.5+e.x),~~(.5+e.y))}},genColor:function(c){var f=this.minZ,g=this.maxZ;if(this.options.classifyType==='piecewise'){var d=this.options.classes;for(var a=d.length-1;a>=0;a--){var e=d[a],b=e.domain.split(',').sort(function(a,b){return a-b}).slice();if(b.length<2)return this.options.defaultColor;if(c>=+b[0]&&c<=+b[1])return e.color}return this.options.defaultColor}else return this.colorScale(c).css()},onmoveend:function(a){this.resize(),this.render()},updateOptions:function(a){setTimeout(function(){this.options=c.deepMerge(this.options,a),this.canvas.style.zIndex=this.options.zIndex,this.canvas.style.opacity=this.options.opacity,this.options.classes=a.classes,this.genGrid(),this.render()}.bind(this),0)},destory:function(){this.idwResults=null,this.data=null,this.clipGeo=null,this.colorScale=null,this.map.getPanes().overlayPane.removeChild(this.canvas),this.canvas=null,this.map.off('moveend',this.onmoveend,this)}}),g=d.dmap=d.dmap||{};g.IsosurfaceLayer=a,g.isosurfaceLayer=function(b){return new a(b)},module.exports=a | ||
function b(a){this.options=c.deepMerge(this.options,a),this.options.classes=a.classes}var e=require('bcore/event'),c=require('bcore/utils'),a=require('leaflet'),f=require('geojson-extent'),g=require('chroma-js'),b=e.extend(b,{options:{zIndex:10,opacity:.8,classifyType:'linear',colors:10,classes:[],cellWidth:1e6,dweight:.5,defaultColor:'rgba(255,255,255,0.5)',startColor:'#cbf01e',middleColor:'#ff0',endColor:'#fa1d00',getLat:function(a){return a.lat},getLng:function(a){return a.lng},getValue:function(a){return a.value}},init:function(){this.initCanvas()},initCanvas:function(){var b=this.map;this.canvas=a.DomUtil.create('canvas','leaflet-layer leaflet-zoom-hide'),this.canvas.style.pointerEvents='none',this.canvas.style.zIndex=this.options.zIndex,this.canvas.style.opacity=this.options.opacity;var c=b.getSize();this.canvas.width=c.x,this.canvas.height=c.y,b.getPanes().overlayPane.appendChild(this.canvas)},setClipGeo:function(a){a&&a.features?(this.clipGeo=a,this.genGrid(),this.render()):(this.clipGeo=null,this.genGrid(),this.render())},setData:function(a){this.data=a,this.genGrid(),this.render()},distance:function(i,h,o){var k={kilometers:1,miles:.621371192237334,nauticalmiles:.5399568034557235,meters:1e3,metres:1e3,yards:1093.6132983377079,feet:3280.839895013123,inches:39370.078740157485},f=o?k[o]:1,j=(i[1]+h[1])/2,a=Math.cos(j*Math.PI/180),b=2*a*a-1,c=2*a*b-a,e=2*a*c-b,l=2*a*e-c,m=f*(111.41513*a-.09455*c+12e-5*l),n=f*(111.13209-.56605*b+.0012*e),d=(i[0]-h[0])*m,g=(i[1]-h[1])*n;return Math.sqrt(d*d+g*g)},getExtent:function(){var c,a=this.data,b=this;if(this.clipGeo)c=f(this.clipGeo);else{var d,e,g,h;d=Math.min.apply(null,a.map(function(a){return b.options.getLng(a)})),e=Math.min.apply(null,a.map(function(a){return b.options.getLat(a)})),g=Math.max.apply(null,a.map(function(a){return b.options.getLng(a)})),h=Math.max.apply(null,a.map(function(a){return b.options.getLat(a)})),c=[d,e,g,h]}return c},genGrid:function(){var l=this.data;if(!l||l.length===0)return;var a=this.getExtent(),o=this.options.cellWidth,s=o/this.distance([a[0],a[1]],[a[2],a[1]],'meters'),f=this.cellWidth=s*(a[2]-a[0]),r=o/this.distance([a[0],a[1]],[a[0],a[3]],'meters'),i=this.cellHeight=r*(a[3]-a[1]),q=Math.ceil((a[2]-a[0])/f)*Math.ceil((a[3]-a[1])/ i),j=this.idwResults=new Float64Array(q*3),e=a[0];this.index=0,this.minZ=Infinity,this.maxZ=-Infinity;while(e<=a[2]){var d=a[1];while(d<=a[3]){var m,h=0,n=0;for(var k=this.data.length-1;k>=0;k--){var c=this.data[k],p=this.distance([this.options.getLng(c),this.options.getLat(c)],[e+f/2,d+i/2],'meters');if(p===0){h=this.options.getValue(c);return}m=1/Math.pow(p,this.options.dweight),n+=m,h+=m*this.options.getValue(c)}var b=h/n;this.minZ=b<this.minZ?b:this.minZ,this.maxZ=b>this.maxZ?b:this.maxZ,j[this.index*3+0]=e,j[this.index*3+1]=d,j[this.index*3+2]=b,d+=i,this.index++}e+=f}this.colorScale=g.scale([this.options.startColor,this.options.middleColor,this.options.endColor]).mode('hsl').domain([this.minZ,this.maxZ]).classes(this.options.colors)},addTo:function(a){this.map=a,a.on('moveend',this.onmoveend,this),this.init()},resize:function(){var c=this.map.getSize();this.canvas.width=c.x,this.canvas.height=c.y;var b=a.DomUtil.getPosition(this.map.getPanes().mapPane);b&&a.DomUtil.setPosition(this.canvas,{x:-b.x,y:-b.y})},render:function(){if(!this.idwResults)return;var i=this.map,f=this.map.getSize(),b=this.canvas.getContext('2d');if(b.clearRect(0,0,f.x,f.y),b.save(),this.clipGeo){var g=this;b.beginPath(),b.fillStyle='rgba(0,0,0,0)',this.clipGeo.features.forEach(function(a){switch(a.geometry.type){case'Polygon':g.renderPolygon(b,a.geometry.coordinates[0]);break;case'MultiPolygon':a.geometry.coordinates.forEach(function(a){g.renderPolygon(b,a[0])});break}}),b.clip()}for(var e=0;e<this.index;e++){var c=this.idwResults[e*3+0],d=this.idwResults[e*3+1],j=this.idwResults[e*3+2];if(!i.getBounds().intersects([a.latLng(d,c),a.latLng(d+this.cellHeight,c+this.cellWidth)]))continue;var k=[[c,d],[c,d+this.cellHeight],[c+this.cellWidth,d+this.cellHeight],[c+this.cellWidth,d],[c,d]],h=this.genColor(j);b.beginPath(),b.fillStyle=h,this.renderPolygon(b,k),b.fill()}b.restore()},renderPolygon:function(f,b){var c=this.map,d=c.latLngToContainerPoint(a.latLng(b[0][1],b[0][0]));for(f.moveTo(~~(.5+d.x),~~(.5+d.y)),j=1;j<b.length;j++){var e=c.latLngToContainerPoint(a.latLng(b[j][1],b[j][0]));f.lineTo(~~(.5+e.x),~~(.5+e.y))}},genColor:function(c){var f=this.minZ,g=this.maxZ;if(this.options.classifyType==='piecewise'){var d=this.options.classes;for(var a=d.length-1;a>=0;a--){var e=d[a],b=e.domain.split(',').sort(function(a,b){return a-b}).slice();if(b.length<2)return this.options.defaultColor;if(c>=+b[0]&&c<=+b[1])return e.color}return this.options.defaultColor}else return this.colorScale(c).css()},onmoveend:function(a){this.resize(),this.render()},updateOptions:function(a){setTimeout(function(){this.options=c.deepMerge(this.options,a),this.canvas.style.zIndex=this.options.zIndex,this.canvas.style.opacity=this.options.opacity,this.options.classes=a.classes,this.genGrid(),this.render()}.bind(this),0)},destory:function(){this.idwResults=null,this.data=null,this.clipGeo=null,this.colorScale=null,this.map.getPanes().overlayPane.removeChild(this.canvas),this.canvas=null,this.map.off('moveend',this.onmoveend,this)}}),d=a.dmap=a.dmap||{};d.IsosurfaceLayer=b,d.isosurfaceLayer=function(a){return new b(a)},module.exports=b |
@@ -1,1 +0,1 @@ | ||
function b(a){a=this.options=f.deepMerge(b.options,a)}function g(a){return!a[0][0][0]}function c(a){return a.type&&a.type.toLowerCase().indexOf('feature')!==-1||a.features}var d=require('./../leaflet'),e=require('bcore/event'),f=require('./../core/utils'),a=f.isNone,h=f.fireEvent,i=require('konva'),j=d.dmap=d.dmap||{},k=require('./../render/leaflet_layer_konva'),l=f.getColorFunc({from:'rgba(245,230,0,1)',to:'rgba(205,0,0, 0.6)',none:'rgba(200,200,200, 0.6)',easing:'Linear.None.1.7',space:'rgb'});b.options={container:'.leaflet-overlay-pane',value:function(a){return a.value},lazyFresh:{transition:'opacity 0.1s'},popup:function(a){return'test'},blending:'source-over',color:function(a,b,d){if(!a)return l(null);var c=(a.value-b)/(d-b);return l(c)},id:function(a,b){return a.id||a[0]||b},style:{stroke:'#fff',strokeWidth:2,lineCap:'round',lineJoin:'round'},value:function(a){return a.value},geoId:function(a,b){return a.properties?a.properties.id||b:a.id||b},lat:f.getLat,lng:f.getLng},b=e.extend(b,{initCanvas:function(){var b=this._map,a=this.options,d=f.createContainer(a.container),c=b.getSize(),e=new i.Stage({container:d,width:c.x,height:c.y}),g=this.kLeafLayer=new k(e,{transition:a.lazyFresh.transition,blending:a.blending,ptNPerLayer:a.ptNPerLayer});g.addTo(b)},addTo:function(a){return a?(a._map&&(a=a._map),this._map=a,this.isable=!0,this.initCanvas(),this.initEvents(),this.initEventsMap(),this):void 0},geojson:function(a){if(!a)return console.log('地理数据缺失');this._geodata=a,this.processGeoData(a),this.draw()},processGeoData:function(d){var e=this.features={},a=this.options,f=a.geoId,g=a.lng,h=a.lat,b;if(c(d)){var i=d.features;i.forEach(function(a,c){b=f(a,c),e[b]=a})}else d.forEach(function(a){var d=a.latlngs||a.coords||a.coordinates,c=[];d.forEach(function(a){c.push([g(a),h(a)])}),b=f(a),e[b]={type:'feature',geometry:{type:'LineString',coordinates:c}}})},draw:function(){var f=this,j=this.dataObj||{},e=this.features,i=this.layers={},h,c,d;this.lineIndex=0;for(var a in e){h=e[a].geometry,c=h.coordinates,d=j[a];var k=i[a]=[],b=0;g(c)?this.createLineAttr(c,a,b,d):c.forEach(function(c){if(Array.isArray(c[0]))return b++,f.createLineAttr(c,a,b,d);c.forEach(function(c){b++,f.createLineAttr(c,a,b,d)})})}this.kLeafLayer.stopLazyFresh(),this.kLeafLayer.lazyFresh()},createLineAttr:function(l,o,n,e){if(!this.isable)return;this.lineIndex+=1;var a=this.getChildOptions(),h=f.getValue(a.weight,e)||1;a.strokeWidth=h;var k=this._map.latLngToContainerPoint.bind(this._map),g=this.range||[],m=a.stroke=f.getValue(this.options.color,e,g[0],g[1]),b=a.points=[];l.forEach(function(c){var a=k(d.latLng(c[1],c[0]));b.push(a.x,a.y)});var c=Math.floor(b.length/4),j={x:b[c*2],y:b[c*2+1]};this.kLeafLayer.addOrSetShape({data:e,top:j,Constructor:i.Line,index:this.lineIndex,id:o+'-'+n,attrs:a})},getChildOptions:function(){var a=this.options;return a.style},updateRange:function(){var g=this._data,e=this.options,k=e.value,f=e.filter,d,b,i,j,c=this.range=[];for(var h in g){if(d=g[h],b=k(d),a(b))continue;if(f&&!f(d))continue;typeof b!=='number'&&(b=parseFloat(b)),a(c[0])&&(c[0]=c[1]=b),i=c[0],j=c[1],b>j&&(c[1]=b),b<i&&(c[0]=b)}},initEventsMap:function(){this._map.on('zoomend',this.draw.bind(this)).on('moveend',this.draw.bind(this))},initEvents:function(){var c=this,a,b=this.kLeafLayer.onKonva('dragstart',function(a){}).onKonva('mouseover touchstart',function(b){a=b.target,a.setAttrs({opacity:.8}),a.parent.draw()}).onKonva('mouseout',function(b){a=b.target,a.setAttrs({opacity:1}),a.parent.draw()}).onKonva('mouseout mouseup touchend',function(a){setTimeout(function(){b.enableMapEvents()})}).onKonva('mousedown touchstart',this.onMouseDown.bind(this)),d=['mouseout','mousedown','mouseover','mouseout','touchstart','touchend','touchup'];d.forEach(function(a){b.onKonva(a,function(b){h(a,b,c)})})},onMouseDown:function(g){var b=this.options,e=this._map,c=g.target,f=c.__data,a=b.popup;if(a&&(a=a.bind(b)),a||(a=b.popup,a&&(a=a.bind(b))),!a)return;popupText=a(f),setTimeout(function(){if(c){var a=c.__options.top,b=e.containerPointToLatLng(d.point(a.x,a.y));e.openPopup(popupText,d.latLng(b.lat,b.lng))}}.bind(this)),this.kLeafLayer.disableMapEvents()},each:function(a){},data:function(a){if(!a)return console.log('没数据...');this._data=a,this.processing(a),this.updateRange()},processing:function(b){var c=this.options.id,a,d,e=this.dataObj={};for(var f in b)a=b[f],d=c(a),e[d]=a},render:function(a){a&&this.data(a),this.draw()},disable:function(){this.isable=!1,this.kLeafLayer.disable()},enable:function(){this.isable=!0,this.kLeafLayer.enable()},update:function(){this.updateLife()},updateOptions:function(a){this.options=f.deepMerge(this.options,a),this.draw()},remove:function(){}}),j.LinesKonva=b,j.linesKonva=function(a){return new b(a)},module.exports=b | ||
function b(c){c=this.options=a.deepMerge(b.options,c)}function k(a){return!a[0][0][0]}function l(a){return a.type&&a.type.toLowerCase().indexOf('feature')!==-1||a.features}var c=require('./../leaflet'),i=require('bcore/event'),a=require('./../core/utils'),g=a.isNone,h=a.fireEvent,e=require('konva'),f=c.dmap=c.dmap||{},j=require('./../render/leaflet_layer_konva'),d=a.getColorFunc({from:'rgba(245,230,0,1)',to:'rgba(205,0,0, 0.6)',none:'rgba(200,200,200, 0.6)',easing:'Linear.None.1.7',space:'rgb'});b.options={container:'.leaflet-overlay-pane',value:function(a){return a.value},lazyFresh:{transition:'opacity 0.1s'},popup:function(a){return'test'},blending:'source-over',color:function(a,b,e){if(!a)return d(null);var c=(a.value-b)/(e-b);return d(c)},id:function(a,b){return a.id||a[0]||b},style:{stroke:'#fff',strokeWidth:2,lineCap:'round',lineJoin:'round'},value:function(a){return a.value},geoId:function(a,b){return a.properties?a.properties.id||b:a.id||b},lat:a.getLat,lng:a.getLng},b=i.extend(b,{initCanvas:function(){var c=this._map,b=this.options,f=a.createContainer(b.container),d=c.getSize(),g=new e.Stage({container:f,width:d.x,height:d.y}),h=this.kLeafLayer=new j(g,{transition:b.lazyFresh.transition,blending:b.blending,ptNPerLayer:b.ptNPerLayer});h.addTo(c)},addTo:function(a){return a?(a._map&&(a=a._map),this._map=a,this.isable=!0,this.initCanvas(),this.initEvents(),this.initEventsMap(),this):void 0},geojson:function(a){if(!a)return console.log('地理数据缺失');this._geodata=a,this.processGeoData(a),this.draw()},processGeoData:function(c){var d=this.features={},a=this.options,e=a.geoId,f=a.lng,g=a.lat,b;if(l(c)){var h=c.features;h.forEach(function(a,c){b=e(a,c),d[b]=a})}else c.forEach(function(a){var h=a.latlngs||a.coords||a.coordinates,c=[];h.forEach(function(a){c.push([f(a),g(a)])}),b=e(a),d[b]={type:'feature',geometry:{type:'LineString',coordinates:c}}})},draw:function(){var f=this,i=this.dataObj||{},e=this.features,h=this.layers={},g,c,d;this.lineIndex=0;for(var a in e){g=e[a].geometry,c=g.coordinates,d=i[a];var j=h[a]=[],b=0;k(c)?this.createLineAttr(c,a,b,d):c.forEach(function(c){if(Array.isArray(c[0]))return b++,f.createLineAttr(c,a,b,d);c.forEach(function(c){b++,f.createLineAttr(c,a,b,d)})})}this.kLeafLayer.stopLazyFresh(),this.kLeafLayer.lazyFresh()},createLineAttr:function(l,o,n,g){if(!this.isable)return;this.lineIndex+=1;var b=this.getChildOptions(),i=a.getValue(b.weight,g)||1;b.strokeWidth=i;var k=this._map.latLngToContainerPoint.bind(this._map),h=this.range||[],m=b.stroke=a.getValue(this.options.color,g,h[0],h[1]),d=b.points=[];l.forEach(function(b){var a=k(c.latLng(b[1],b[0]));d.push(a.x,a.y)});var f=Math.floor(d.length/4),j={x:d[f*2],y:d[f*2+1]};this.kLeafLayer.addOrSetShape({data:g,top:j,Constructor:e.Line,index:this.lineIndex,id:o+'-'+n,attrs:b})},getChildOptions:function(){var a=this.options;return a.style},updateRange:function(){var f=this._data,d=this.options,k=d.value,e=d.filter,c,a,i,j,b=this.range=[];for(var h in f){if(c=f[h],a=k(c),g(a))continue;if(e&&!e(c))continue;typeof a!=='number'&&(a=parseFloat(a)),g(b[0])&&(b[0]=b[1]=a),i=b[0],j=b[1],a>j&&(b[1]=a),a<i&&(b[0]=a)}},initEventsMap:function(){this._map.on('zoomend',this.draw.bind(this)).on('moveend',this.draw.bind(this))},initEvents:function(){var c=this,a,b=this.kLeafLayer.onKonva('dragstart',function(a){}).onKonva('mouseover touchstart',function(b){a=b.target,a.setAttrs({opacity:.8}),a.parent.draw()}).onKonva('mouseout',function(b){a=b.target,a.setAttrs({opacity:1}),a.parent.draw()}).onKonva('mouseout mouseup touchend',function(a){setTimeout(function(){b.enableMapEvents()})}).onKonva('mousedown touchstart',this.onMouseDown.bind(this)),d=['mouseout','mousedown','mouseover','mouseout','touchstart','touchend','touchup'];d.forEach(function(a){b.onKonva(a,function(b){h(a,b,c)})})},onMouseDown:function(g){var b=this.options,e=this._map,d=g.target,f=d.__data,a=b.popup;if(a&&(a=a.bind(b)),a||(a=b.popup,a&&(a=a.bind(b))),!a)return;popupText=a(f),setTimeout(function(){if(d){var a=d.__options.top,b=e.containerPointToLatLng(c.point(a.x,a.y));e.openPopup(popupText,c.latLng(b.lat,b.lng))}}.bind(this)),this.kLeafLayer.disableMapEvents()},each:function(a){},data:function(a){if(!a)return console.log('没数据...');this._data=a,this.processing(a),this.updateRange()},processing:function(b){var c=this.options.id,a,d,e=this.dataObj={};for(var f in b)a=b[f],d=c(a),e[d]=a},render:function(a){a&&this.data(a),this.draw()},disable:function(){this.isable=!1,this.kLeafLayer.disable()},enable:function(){this.isable=!0,this.kLeafLayer.enable()},update:function(){this.updateLife()},updateOptions:function(b){this.options=a.deepMerge(this.options,b),this.draw()},remove:function(){}}),f.LinesKonva=b,f.linesKonva=function(a){return new b(a)},module.exports=b |
@@ -1,1 +0,1 @@ | ||
function a(a,b,c,d){return typeof a==='function'?a(b,c,d):a}var b=require('./../leaflet'),c=require('konva'),d=require('lodash'),e=require('./../render/leaflet_layer_konva'),f=require('./../core/utils'),g=f.getSprite,h=f.fireEvent,a=f.getValue,i=b.Class.extend({includes:[b.Mixin.Events],initialize:function(a){a=this.options=f.deepMerge(i.options,a),this.resetVariables()},resetVariables:function(){this.isable=!0},disable:function(){this.isable=!1,this.kLeafLayer.disable()},enable:function(){this.isable=!0,this.kLeafLayer.enable()},addTo:function(a){if(this._map||!a)return;this._map=a,this.initCanvas(),this.initEventsMap(),this.initEventsShapes()},initEventsShapes:function(){var c=this,e=this.options.hoverScale||1,a,b=this.kLeafLayer.onKonva('dragstart',function(a){}).onKonva('mouseover touchstart',function(b){a=b.target,a.setAttrs({opacity:.8}),a.parent.draw()}).onKonva('mouseout',function(b){a=b.target,a.setAttrs({opacity:1}),a.parent.draw()}).onKonva('mouseout mouseup touchend',function(a){setTimeout(function(){b.enableMapEvents()})}).onKonva('mousedown touchstart',this.onMouseDown.bind(this)),d=['mouseout','mousedown','mouseover','mouseout','touchstart','touchend','touchup'];d.forEach(function(a){b.onKonva(a,function(b){h(a,b,c)})})},onMouseDown:function(g){var c=this.options,e=this._map,d=g.target,f=d.__data,a=c.popup;if(a&&(a=a.bind(c)),a||(a=c.child.popup,a&&(a=a.bind(c.child))),!a)return;popupText=a(f),setTimeout(function(){if(d){var a=d.__options.top,c=e.containerPointToLatLng(b.point(a.x,a.y));e.openPopup(popupText,b.latLng(c.lat,c.lng))}}.bind(this)),this.kLeafLayer.disableMapEvents()},initCanvas:function(){var b=this._map,a=this.options,d=b.getSize(),g=f.createContainer(a.container),h=new c.Stage({container:g,width:d.x,height:d.y}),i=this.kLeafLayer=new e(h,{transition:a.lazyFresh.transition,blending:a.blending,ptNPerLayer:a.ptNPerLayer});i.addTo(b)},data:function(a){this._data=a,this.updateDataZindex()},updateDataZindex:function(){var a=this.options,b=a.zIndex||a.child.zIndex;b&&(this._data=d.sortBy(this._data,b))},updateOptions:function(a){var b=this.kLeafLayer;b.resetOffset(),a=this.options=f.deepMerge(this.options,a),b.hideLayers(),b.updateOptions({transition:a.lazyFresh.transition,blending:a.blending,ptNPerLayer:a.ptNPerLayer}),this.draw()},updateFilter:function(a){if(!a||typeof a!=='function')return;this.options.filter=a,this.draw()},render:function(a){a&&this.data(a),a&&this.kLeafLayer.beginDraw(),this.draw(),a&&this.kLeafLayer.endDraw()},createShapeAttr:function(f,d){if(!this.isable)return;var e=this.options,p=a(e.from,f),l=a(e.to,f),u=a(e.id.bind(e),f,d),s=a(e.weight,f)||1,i=this._map.latLngToContainerPoint(b.latLng(p.lat,p.lng)),j=this._map.latLngToContainerPoint(b.latLng(l.lat,l.lng)),g=i.x,k=i.y,m=j.x,v=j.y,r=Math.abs(m-g),y=(i.x+j.x)/2,x=(i.y+j.y)/2-r*e.kHeight,h=m-g,q=v-k,w=a(e.color,f),o=[],n=e.kHeight;for(var d=0;d<=1;d+=.1)o.push(g+h*d,k+q*d-Math.abs(d*(1-d)*h*n));var t={x:g+h/2,y:k+q/2-Math.abs(.25*h*n)};return{data:f,Constructor:c.Line,index:d,id:u,top:t,attrs:{points:o,stroke:w,strokeWidth:s,lineCap:'round',lineJoin:'round'}}},draw:function(){var b=this._data;if(!(b&&this.isable))return;var d,f,c=this.kLeafLayer,e=this.options.filter;for(var a=b.length-1;a>-1;a--){if(d=b[a],e&&!e(d,a))continue;f=this.createShapeAttr(d,a),c.addOrSetShape(f)}c.stopLazyFresh(),c.lazyFresh()},initEventsMap:function(){this._map.on('zoomend',this.draw.bind(this)).on('moveend',this.draw.bind(this))},destroy:function(){this.kLeafLayer.destroy()},clean:function(){this.kLeafLayer.clean()}});i.options={zIndex:null,kHeight:.8,refreshInterval:1,ptNPerLayer:1e3,lazyFresh:{transition:'opacity 0.4s'},weight:function(a){return 4},id:function(a,b){return a.id||b},color:function(a){return'rgba(0,180,180,0.5)'},onPopupOpen:function(a,b){},from:f.getFrom,to:f.getTo,hoverScale:.2,blending:'lighter',container:'.leaflet-overlay-pane',sprite:{drawN:1.15,color:{from:'rgba(245,230,0,1)',to:'rgba(205,0,0, 0.6)',easing:'Linear.None.1.7',space:'rgb'}},child:{}};var j=b.dmap=b.dmap||{};j.LinkKonva=i,j.linkKonva=function(a){return new i(a)},module.exports=i | ||
function c(a,b,c,d){return typeof a==='function'?a(b,c,d):a}var a=require('./../leaflet'),e=require('konva'),g=require('lodash'),h=require('./../render/leaflet_layer_konva'),b=require('./../core/utils'),j=b.getSprite,i=b.fireEvent,c=b.getValue,d=a.Class.extend({includes:[a.Mixin.Events],initialize:function(a){a=this.options=b.deepMerge(d.options,a),this.resetVariables()},resetVariables:function(){this.isable=!0},disable:function(){this.isable=!1,this.kLeafLayer.disable()},enable:function(){this.isable=!0,this.kLeafLayer.enable()},addTo:function(a){if(this._map||!a)return;this._map=a,this.initCanvas(),this.initEventsMap(),this.initEventsShapes()},initEventsShapes:function(){var c=this,e=this.options.hoverScale||1,a,b=this.kLeafLayer.onKonva('dragstart',function(a){}).onKonva('mouseover touchstart',function(b){a=b.target,a.setAttrs({opacity:.8}),a.parent.draw()}).onKonva('mouseout',function(b){a=b.target,a.setAttrs({opacity:1}),a.parent.draw()}).onKonva('mouseout mouseup touchend',function(a){setTimeout(function(){b.enableMapEvents()})}).onKonva('mousedown touchstart',this.onMouseDown.bind(this)),d=['mouseout','mousedown','mouseover','mouseout','touchstart','touchend','touchup'];d.forEach(function(a){b.onKonva(a,function(b){i(a,b,c)})})},onMouseDown:function(g){var c=this.options,e=this._map,d=g.target,f=d.__data,b=c.popup;if(b&&(b=b.bind(c)),b||(b=c.child.popup,b&&(b=b.bind(c.child))),!b)return;popupText=b(f),setTimeout(function(){if(d){var b=d.__options.top,c=e.containerPointToLatLng(a.point(b.x,b.y));e.openPopup(popupText,a.latLng(c.lat,c.lng))}}.bind(this)),this.kLeafLayer.disableMapEvents()},initCanvas:function(){var c=this._map,a=this.options,d=c.getSize(),f=b.createContainer(a.container),g=new e.Stage({container:f,width:d.x,height:d.y}),i=this.kLeafLayer=new h(g,{transition:a.lazyFresh.transition,blending:a.blending,ptNPerLayer:a.ptNPerLayer});i.addTo(c)},data:function(a){this._data=a,this.updateDataZindex()},updateDataZindex:function(){var a=this.options,b=a.zIndex||a.child.zIndex;b&&(this._data=g.sortBy(this._data,b))},updateOptions:function(a){var c=this.kLeafLayer;c.resetOffset(),a=this.options=b.deepMerge(this.options,a),c.hideLayers(),c.updateOptions({transition:a.lazyFresh.transition,blending:a.blending,ptNPerLayer:a.ptNPerLayer}),this.draw()},updateFilter:function(a){if(!a||typeof a!=='function')return;this.options.filter=a,this.draw()},render:function(a){a&&this.data(a),a&&this.kLeafLayer.beginDraw(),this.draw(),a&&this.kLeafLayer.endDraw()},createShapeAttr:function(f,b){if(!this.isable)return;var d=this.options,p=c(d.from,f),l=c(d.to,f),u=c(d.id.bind(d),f,b),s=c(d.weight,f)||1,i=this._map.latLngToContainerPoint(a.latLng(p.lat,p.lng)),j=this._map.latLngToContainerPoint(a.latLng(l.lat,l.lng)),g=i.x,k=i.y,m=j.x,v=j.y,r=Math.abs(m-g),y=(i.x+j.x)/2,x=(i.y+j.y)/2-r*d.kHeight,h=m-g,q=v-k,w=c(d.color,f),o=[],n=d.kHeight;for(var b=0;b<=1;b+=.1)o.push(g+h*b,k+q*b-Math.abs(b*(1-b)*h*n));var t={x:g+h/2,y:k+q/2-Math.abs(.25*h*n)};return{data:f,Constructor:e.Line,index:b,id:u,top:t,attrs:{points:o,stroke:w,strokeWidth:s,lineCap:'round',lineJoin:'round'}}},draw:function(){var b=this._data;if(!(b&&this.isable))return;var d,f,c=this.kLeafLayer,e=this.options.filter;for(var a=b.length-1;a>-1;a--){if(d=b[a],e&&!e(d,a))continue;f=this.createShapeAttr(d,a),c.addOrSetShape(f)}c.stopLazyFresh(),c.lazyFresh()},initEventsMap:function(){this._map.on('zoomend',this.draw.bind(this)).on('moveend',this.draw.bind(this))},destroy:function(){this.kLeafLayer.destroy()},clean:function(){this.kLeafLayer.clean()}});d.options={zIndex:null,kHeight:.8,refreshInterval:1,ptNPerLayer:1e3,lazyFresh:{transition:'opacity 0.4s'},weight:function(a){return 4},id:function(a,b){return a.id||b},color:function(a){return'rgba(0,180,180,0.5)'},onPopupOpen:function(a,b){},from:b.getFrom,to:b.getTo,hoverScale:.2,blending:'lighter',container:'.leaflet-overlay-pane',sprite:{drawN:1.15,color:{from:'rgba(245,230,0,1)',to:'rgba(205,0,0, 0.6)',easing:'Linear.None.1.7',space:'rgb'}},child:{}};var f=a.dmap=a.dmap||{};f.LinkKonva=d,f.linkKonva=function(a){return new d(a)},module.exports=d |
@@ -1,1 +0,1 @@ | ||
var a=require('./../leaflet'),b=require('konva'),c=require('point-geometry'),d=require('vector-tile').VectorTile,e=require('pbf'),f=require('./../core/utils'),g=a.TileLayer.extend({initialize:function(a){optionsO=f.deepMerge(this.options,g.options),a=this.options=f.deepMerge(optionsO,a),console.log('options is ',a),this._url=this.options.url,this.activeTiles={},this.loadedTileDatas={},this.features={}},_getShapeStyle:function(a){return this.options.style[a]},_storeFeatures:function(){},onAdd:function(b){var c=this;c.map=b,a.TileLayer.prototype.onAdd.call(this,b)},updateStyles:function(){var b=this.features,c,a;for(var e in b){c=b[e].shapes;for(var d in c){var f=d.split(':')[0];f==this._map._zoom&&(a=c[d],a.clearCache(),style=this._getShapeStyle(a.__featureType),a.setAttrs(style.normal),a.draw())}}},drawTile:function(d,c,e){var f=new b.Stage({container:d,width:this.options.tileSize,height:this.options.tileSize}),g=new b.Shape,a={id:[e,c.x,c.y].join(':'),konva:d,stage:f,tile:c,zoom:e,tileSize:this.options.tileSize,shapes:{},datas:{}};this.activeTiles[a.id]=a,this.loadedTileDatas[a.id]?this._updateOldTile(a):this._draw(a)},_draw:function(a){var b=this,f=b.options,g=f.reqType;if(!f.url)return;var h=b.getTileUrl({x:a.tile.x,y:a.tile.y,z:a.zoom}),c=new XMLHttpRequest;c.open(g,h,!0),c.onerror=function(){console.error('xhr error: ',c.status)},c.responseType='arraybuffer',c.send(),c.onload=function(){if(c.status=='200'){if(!c.response)return;var n=new Uint8Array(c.response),o=new e(n),l=new d(o);if(b.map&&b.map.getZoom()!=a.zoom){console.log('Fetched tile for zoom level '+a.zoom+'. Map is at zoom level '+b._map.getZoom());return}for(var m in l.layers){var i=a.datas[m]=l.layers[m];i.features={};for(var j=0;j<i._features.length;j++){var g=i.feature(j),k=g.properties[f.idField];g.coordinates=g.loadGeometry(),i.features[k]=g;var h=b.features[k];h||(h=b.features[k]={}),h.datas||(h.datas={}),h.datas[a.id]=g,b._drawFeatures(a,g)}}b.loadedTileDatas[a.id]=a.datas}}},_drawFeatures:function(j,g){var a=this,h=a.options.filter;if(typeof h==='function'&&h(j,g)===!1)return;var i=j.id,d=g.properties[a.options.idField],f=g.coordinates,m=j.stage,k=new b.Layer,c=new b.Shape,l=c.__featureType=g.type;switch(l){case 1:a._drawPoint(c,f,d);break;case 2:a._drawLine(c,f);break;case 3:a._drawPolygon(c,f);break;default:console.log('Feature type is ',l)}a._renderShape(c,d);var e=a.features[d];e||(e=a.features[d]={}),e.shapes||(e.shapes={}),e.shapes[i]=c,a.activeTiles[i].shapes[d]=c,k.add(c),m.add(k),a.initEventShape(c,d)},_renderShape:function(b,e){var a=this,c=a.features[e],d=b.__featureType;c&&c.status=='selected'?b.setAttrs(a.options.style[d].selected):b.setAttrs(a.options.style[d].normal)},initEventShape:function(c,d){var a=this,b=a._getShapeStyle(c.__featureType);c.on('click',function(i){var e=a.features[d],f=e.shapes,h=e.status;if(h==='selected'){for(var c in f){var g=c.split(':')[0];g==a._map._zoom&&(shp=f[c],shp.setAttrs(b.normal),shp.draw())}e.status='normal'}else{for(var c in f){var g=c.split(':')[0];g==a._map._zoom&&(shp=f[c],shp.setAttrs(b.selected),shp.draw())}e.status='selected'}})},_drawPoint:function(c,d,f){if(!c)return;if(!d)return;var a=this,b,e;c.sceneFunc(function(c){b=a.features[f],e=b.status,b&&e=='selected'?radius=a.options.style[1].selected.radius:radius=a.options.style[1].normal.radius,c.clearRect(0,0,c.canvas.width,c.canvas.height);var g=a._tilePoint(d[0][0]);c.clearRect(0,0,c.canvas.width,c.canvas.height),c.beginPath(),c.arc(g.x,g.y,radius,0,Math.PI*2),c.closePath(),c.fillStrokeShape(this)})},_drawLine:function(b,a){if(!b)return;if(!a)return;var c=this;b.sceneFunc(function(b){b.clearRect(0,0,b.canvas.width,b.canvas.height),b.beginPath();for(var g in a){var e=a[g];for(var d=0;d<e.length;d++){var h=d===0?'moveTo':'lineTo',f=c._tilePoint(e[d]);b[h](f.x,f.y)}}b.stroke(),b.fillStrokeShape(this)})},_drawPolygon:function(b,a){if(!b)return;if(!a)return;var c=this;b.sceneFunc(function(b){b.clearRect(0,0,b.canvas.width,b.canvas.height),b.beginPath();for(var g in a){var e=a[g];for(var d=0;d<e.length;d++){var h=d===0?'moveTo':'lineTo',f=c._tilePoint(e[d]);b[h](f.x,f.y)}}b.closePath(),b.fillStrokeShape(this)})},_loadTile:function(a,b){a._layer=this,a._tilePoint=b;var c=this._map._zoom+':'+b.x+':'+b.y;this._redrawTile(a,c),this.options.async||this.tileDrawn(a)},_redrawTile:function(a,b){this._removeOldTile(),this.drawTile(a,a._tilePoint,this._map._zoom)},_removeOldTile:function(){for(var a in this.activeTiles){var b=a.split(':')[0];if(b!=this._map._zoom){var c=this.activeTiles[a].stage;c.remove(),delete this.activeTiles[a]}}},_updateOldTile:function(c){var a=this.loadedTileDatas[c.id],b,d;if(c.datas=a,a){for(var e in a)if(b=a[e].features,b)for(key in b)d=b[key],this._drawFeatures(c,d);return}},tileDrawn:function(a){this._tileOnLoad.call(a)},_createTile:function(){var b=a.DomUtil.create('div','leaflet-tile');return b.style.width=b.style.height=this._getTileSize()+'px',b.onselectstart=b.onmousemove=a.Util.falseFn,b},_tilePoint:function(c){var b=16;return new a.Point(c.x/b,c.y/b)},getKonva:function(){},_createKonva:function(){}});g.options={url:'',tileSize:256,visibleLayers:[],async:!1,filter:function(){},reqType:'GET',idField:'id'},a.dmap=a.dmap||{},a.dmap.MVTKonva=g,a.dmap.mVTKonva=function(a,b){return new g(a,b)},module.exports=g | ||
var a=require('./../leaflet'),c=require('konva'),g=require('point-geometry'),e=require('vector-tile').VectorTile,f=require('pbf'),d=require('./../core/utils'),b=a.TileLayer.extend({initialize:function(a){optionsO=d.deepMerge(this.options,b.options),a=this.options=d.deepMerge(optionsO,a),console.log('options is ',a),this._url=this.options.url,this.activeTiles={},this.loadedTileDatas={},this.features={}},_getShapeStyle:function(a){return this.options.style[a]},_storeFeatures:function(){},onAdd:function(b){var c=this;c.map=b,a.TileLayer.prototype.onAdd.call(this,b)},updateStyles:function(){var b=this.features,c,a;for(var e in b){c=b[e].shapes;for(var d in c){var f=d.split(':')[0];f==this._map._zoom&&(a=c[d],a.clearCache(),style=this._getShapeStyle(a.__featureType),a.setAttrs(style.normal),a.draw())}}},drawTile:function(d,b,e){var f=new c.Stage({container:d,width:this.options.tileSize,height:this.options.tileSize}),g=new c.Shape,a={id:[e,b.x,b.y].join(':'),konva:d,stage:f,tile:b,zoom:e,tileSize:this.options.tileSize,shapes:{},datas:{}};this.activeTiles[a.id]=a,this.loadedTileDatas[a.id]?this._updateOldTile(a):this._draw(a)},_draw:function(a){var b=this,d=b.options,g=d.reqType;if(!d.url)return;var h=b.getTileUrl({x:a.tile.x,y:a.tile.y,z:a.zoom}),c=new XMLHttpRequest;c.open(g,h,!0),c.onerror=function(){console.error('xhr error: ',c.status)},c.responseType='arraybuffer',c.send(),c.onload=function(){if(c.status=='200'){if(!c.response)return;var n=new Uint8Array(c.response),o=new f(n),l=new e(o);if(b.map&&b.map.getZoom()!=a.zoom){console.log('Fetched tile for zoom level '+a.zoom+'. Map is at zoom level '+b._map.getZoom());return}for(var m in l.layers){var i=a.datas[m]=l.layers[m];i.features={};for(var j=0;j<i._features.length;j++){var g=i.feature(j),k=g.properties[d.idField];g.coordinates=g.loadGeometry(),i.features[k]=g;var h=b.features[k];h||(h=b.features[k]={}),h.datas||(h.datas={}),h.datas[a.id]=g,b._drawFeatures(a,g)}}b.loadedTileDatas[a.id]=a.datas}}},_drawFeatures:function(j,g){var a=this,h=a.options.filter;if(typeof h==='function'&&h(j,g)===!1)return;var i=j.id,d=g.properties[a.options.idField],f=g.coordinates,m=j.stage,k=new c.Layer,b=new c.Shape,l=b.__featureType=g.type;switch(l){case 1:a._drawPoint(b,f,d);break;case 2:a._drawLine(b,f);break;case 3:a._drawPolygon(b,f);break;default:console.log('Feature type is ',l)}a._renderShape(b,d);var e=a.features[d];e||(e=a.features[d]={}),e.shapes||(e.shapes={}),e.shapes[i]=b,a.activeTiles[i].shapes[d]=b,k.add(b),m.add(k),a.initEventShape(b,d)},_renderShape:function(b,e){var a=this,c=a.features[e],d=b.__featureType;c&&c.status=='selected'?b.setAttrs(a.options.style[d].selected):b.setAttrs(a.options.style[d].normal)},initEventShape:function(c,d){var a=this,b=a._getShapeStyle(c.__featureType);c.on('click',function(i){var e=a.features[d],f=e.shapes,h=e.status;if(h==='selected'){for(var c in f){var g=c.split(':')[0];g==a._map._zoom&&(shp=f[c],shp.setAttrs(b.normal),shp.draw())}e.status='normal'}else{for(var c in f){var g=c.split(':')[0];g==a._map._zoom&&(shp=f[c],shp.setAttrs(b.selected),shp.draw())}e.status='selected'}})},_drawPoint:function(c,d,f){if(!c)return;if(!d)return;var a=this,b,e;c.sceneFunc(function(c){b=a.features[f],e=b.status,b&&e=='selected'?radius=a.options.style[1].selected.radius:radius=a.options.style[1].normal.radius,c.clearRect(0,0,c.canvas.width,c.canvas.height);var g=a._tilePoint(d[0][0]);c.clearRect(0,0,c.canvas.width,c.canvas.height),c.beginPath(),c.arc(g.x,g.y,radius,0,Math.PI*2),c.closePath(),c.fillStrokeShape(this)})},_drawLine:function(b,a){if(!b)return;if(!a)return;var c=this;b.sceneFunc(function(b){b.clearRect(0,0,b.canvas.width,b.canvas.height),b.beginPath();for(var g in a){var e=a[g];for(var d=0;d<e.length;d++){var h=d===0?'moveTo':'lineTo',f=c._tilePoint(e[d]);b[h](f.x,f.y)}}b.stroke(),b.fillStrokeShape(this)})},_drawPolygon:function(b,a){if(!b)return;if(!a)return;var c=this;b.sceneFunc(function(b){b.clearRect(0,0,b.canvas.width,b.canvas.height),b.beginPath();for(var g in a){var e=a[g];for(var d=0;d<e.length;d++){var h=d===0?'moveTo':'lineTo',f=c._tilePoint(e[d]);b[h](f.x,f.y)}}b.closePath(),b.fillStrokeShape(this)})},_loadTile:function(a,b){a._layer=this,a._tilePoint=b;var c=this._map._zoom+':'+b.x+':'+b.y;this._redrawTile(a,c),this.options.async||this.tileDrawn(a)},_redrawTile:function(a,b){this._removeOldTile(),this.drawTile(a,a._tilePoint,this._map._zoom)},_removeOldTile:function(){for(var a in this.activeTiles){var b=a.split(':')[0];if(b!=this._map._zoom){var c=this.activeTiles[a].stage;c.remove(),delete this.activeTiles[a]}}},_updateOldTile:function(c){var a=this.loadedTileDatas[c.id],b,d;if(c.datas=a,a){for(var e in a)if(b=a[e].features,b)for(key in b)d=b[key],this._drawFeatures(c,d);return}},tileDrawn:function(a){this._tileOnLoad.call(a)},_createTile:function(){var b=a.DomUtil.create('div','leaflet-tile');return b.style.width=b.style.height=this._getTileSize()+'px',b.onselectstart=b.onmousemove=a.Util.falseFn,b},_tilePoint:function(c){var b=16;return new a.Point(c.x/b,c.y/b)},getKonva:function(){},_createKonva:function(){}});b.options={url:'',tileSize:256,visibleLayers:[],async:!1,filter:function(){},reqType:'GET',idField:'id'},a.dmap=a.dmap||{},a.dmap.MVTKonva=b,a.dmap.mVTKonva=function(a,c){return new b(a,c)},module.exports=b |
@@ -1,1 +0,1 @@ | ||
function a(a,b,c,d){return typeof a==='function'?a(b,c,d):a}var b=require('./../leaflet'),c=require('./../render/canvas');require('./../core/utils');var d=b.dmap=b.dmap||{},e=d.Utils,f=e.getSprite,g=b.Class.extend({includes:[b.Mixin.Events],initialize:function(a){a=this.options=e.deepMerge(g.options,a),this.isable=!0,this.sprite=this.updateSprite(a.sprite),this.updateGroups(a.groups)},disable:function(){this.isable=!1},enable:function(){this.isable=!0},addTo:function(a){if(this._map||!a)return;this._map=a,this.initCanvas(),this.initEventsMap(),this.updateBlending()},initCanvas:function(){var b=this._map,a=this.options,d=a.container;this.dCanvas=new c(b,d,a)},data:function(d,a){a=a||{};var e=this.map,c=this;this._data=d,this.transfer=a.transfer||function(a,d){return c._map.latLngToContainerPoint(b.latLng(a,d))},this.valueFunc=function(a){return a.value}},updateOptions:function(a){a&&(this.options=e.deepMerge(this.options,a)),this.sprite=this.updateSprite(),this.updateBlending(),this.draw()},updateSprite:function(a){return a=a||this.options.sprite,a=f(a),a},updateGroups:function(b){if(!b)return;for(var c in b){var a=b[c];a.sprite&&(a.sprite=this.updateSprite(a.sprite))}},updateFilter:function(a){if(!a||typeof a!=='function')return;this.options.filter=a,this.draw()},updateBlending:function(a){if(a)return this.dCanvas.ctx.globalCompositeOperation=this.options.blending=a;this.dCanvas.ctx.globalCompositeOperation=this.options.blending},render:function(a,b){a&&this.data(a),this.draw(b)},draw:function(y){y||this.clean();var B=this._map,k=this._map.getZoom(),c=this.options,m=!0,n=this.options.filter;if(!this.isable)return;var v=this.transfer,j=this._data,A=this.valueFunc,e,z=this.sprites,g=this.dCanvas,o=c.lng.bind(c),l=c.lat.bind(c),u=g.w,t=g.h,b,r,q,p,f,d,s,i=c.groups;for(var w in j){if(b=j[w],!b)continue;if(n&&(m=n(b)),!m)continue;if(r=o?o(b):b.lng,q=l?l(b):b.lat,!(r&&q))continue;if(p=v(q,r),f=p.x,d=p.y,f<0||f>u||d<0||d>t)continue;if(i)for(var x in i){var h=i[x];if(s=h.size(b,k),e=h.sprite,s&&e&&h.filter(b)){g.pt(e,f,d,s);break}}else e=this.sprite,g.pt(e,f,d,a(c.size,b,k))}},clean:function(a){this.dCanvas.clear(a)},initEventsMap:function(){this.dCanvas.onUpdate(function(){this.draw()}.bind(this))},destroy:function(){this.dCanvas.destroy()}});g.options={lng:e.getLng,lat:e.getLat,refreshInterval:1,size:function(a){return 40},blending:'lighter',clearAlpha:1,container:'tilePane',sprite:{drawN:1.15,color:{from:'rgba(245,230,0,0.3)',to:'rgba(245,245,0,0.04)',easing:'Linear.None.1.7',space:'rgb'}}},d.ScatterCanvas=g,d.scatterCanvas=function(a){return new g(a)},module.exports=g | ||
function g(a,b,c,d){return typeof a==='function'?a(b,c,d):a}var a=require('./../leaflet'),e=require('./../render/canvas');require('./../core/utils');var d=a.dmap=a.dmap||{},b=d.Utils,f=b.getSprite,c=a.Class.extend({includes:[a.Mixin.Events],initialize:function(a){a=this.options=b.deepMerge(c.options,a),this.isable=!0,this.sprite=this.updateSprite(a.sprite),this.updateGroups(a.groups)},disable:function(){this.isable=!1},enable:function(){this.isable=!0},addTo:function(a){if(this._map||!a)return;this._map=a,this.initCanvas(),this.initEventsMap(),this.updateBlending()},initCanvas:function(){var b=this._map,a=this.options,c=a.container;this.dCanvas=new e(b,c,a)},data:function(d,b){b=b||{};var e=this.map,c=this;this._data=d,this.transfer=b.transfer||function(b,d){return c._map.latLngToContainerPoint(a.latLng(b,d))},this.valueFunc=function(a){return a.value}},updateOptions:function(a){a&&(this.options=b.deepMerge(this.options,a)),this.sprite=this.updateSprite(),this.updateBlending(),this.draw()},updateSprite:function(a){return a=a||this.options.sprite,a=f(a),a},updateGroups:function(b){if(!b)return;for(var c in b){var a=b[c];a.sprite&&(a.sprite=this.updateSprite(a.sprite))}},updateFilter:function(a){if(!a||typeof a!=='function')return;this.options.filter=a,this.draw()},updateBlending:function(a){if(a)return this.dCanvas.ctx.globalCompositeOperation=this.options.blending=a;this.dCanvas.ctx.globalCompositeOperation=this.options.blending},render:function(a,b){a&&this.data(a),this.draw(b)},draw:function(y){y||this.clean();var B=this._map,k=this._map.getZoom(),b=this.options,m=!0,n=this.options.filter;if(!this.isable)return;var v=this.transfer,j=this._data,A=this.valueFunc,d,z=this.sprites,f=this.dCanvas,o=b.lng.bind(b),l=b.lat.bind(b),u=f.w,t=f.h,a,r,q,p,e,c,s,i=b.groups;for(var w in j){if(a=j[w],!a)continue;if(n&&(m=n(a)),!m)continue;if(r=o?o(a):a.lng,q=l?l(a):a.lat,!(r&&q))continue;if(p=v(q,r),e=p.x,c=p.y,e<0||e>u||c<0||c>t)continue;if(i)for(var x in i){var h=i[x];if(s=h.size(a,k),d=h.sprite,s&&d&&h.filter(a)){f.pt(d,e,c,s);break}}else d=this.sprite,f.pt(d,e,c,g(b.size,a,k))}},clean:function(a){this.dCanvas.clear(a)},initEventsMap:function(){this.dCanvas.onUpdate(function(){this.draw()}.bind(this))},destroy:function(){this.dCanvas.destroy()}});c.options={lng:b.getLng,lat:b.getLat,refreshInterval:1,size:function(a){return 40},blending:'lighter',clearAlpha:1,container:'tilePane',sprite:{drawN:1.15,color:{from:'rgba(245,230,0,0.3)',to:'rgba(245,245,0,0.04)',easing:'Linear.None.1.7',space:'rgb'}}},d.ScatterCanvas=c,d.scatterCanvas=function(a){return new c(a)},module.exports=c |
@@ -1,1 +0,1 @@ | ||
function a(a,b,c,d){return typeof a==='function'?a(b,c,d):a}var b=require('./../leaflet'),c=require('konva'),d=require('lodash'),e=require('./../render/leaflet_layer_konva'),f=require('./../core/utils'),g=f.getSprite,h=f.fireEvent,a=f.getValue,i=b.Class.extend({includes:[b.Mixin.Events],initialize:function(a){a=this.options=f.deepMerge(i.options,a),this.resetVariables()},resetVariables:function(){this.isable=!0},disable:function(){this.isable=!1,this.kLeafLayer.disable()},enable:function(){this.isable=!0,this.kLeafLayer.enable()},addTo:function(a){if(this._map||!a)return;this._map=a,this.initCanvas(),this.initEventsMap(),this.initEventsShapes()},initEventsShapes:function(){var d=this,b=this.options.hoverScale||1,a,c=this.kLeafLayer.onKonva('dragstart',function(a){}).onKonva('mouseover touchstart',function(c){a=c.target,a.setAttrs({scale:{x:b,y:b}}),a.parent.draw()}).onKonva('mouseout',function(b){a=b.target,a.setAttrs({scale:{x:1,y:1}}),a.parent.draw()}).onKonva('mouseout mouseup touchend',function(a){setTimeout(function(){c.enableMapEvents()})}).onKonva('mousedown touchstart',this.onMouseDown.bind(this)),e=['mouseout','mousedown','mouseover','mouseout','touchstart','touchend','touchup'];e.forEach(function(a){c.onKonva(a,function(b){h(a,b,d)})})},onMouseDown:function(g){var c=this.options,e=this._map,d=g.target,f=d.__data,a=c.popup;if(a&&(a=a.bind(c)),a||(a=c.child.popup,a&&(a=a.bind(c.child))),!a)return;popupText=a(f),setTimeout(function(){if(d){var a=d.getClientRect(),f=a.x+a.width/2,g=a.y,c=e.containerPointToLatLng(b.point(f,g));e.openPopup(popupText,b.latLng(c.lat,c.lng))}}.bind(this)),this.kLeafLayer.disableMapEvents()},initCanvas:function(){var b=this._map,a=this.options,d=b.getSize(),g=f.createContainer(a.container),h=new c.Stage({container:g,width:d.x,height:d.y}),i=this.kLeafLayer=new e(h,{transition:a.lazyFresh.transition,blending:a.blending,ptNPerLayer:a.ptNPerLayer});i.addTo(b),this.initEditor()},data:function(a){this._data=a,this.updateDataZindex()},updateDataZindex:function(){var a=this.options,b=a.zIndex||a.child.zIndex;b&&(this._data=d.sortBy(this._data,b))},updateOptions:function(a){var b=this.kLeafLayer;b.resetOffset(),a=this.options=f.deepMerge(this.options,a),b.hideLayers(),b.updateOptions({transition:a.lazyFresh.transition,blending:a.blending,ptNPerLayer:a.ptNPerLayer}),this.draw()},updateFilter:function(a){if(!a||typeof a!=='function')return;this.options.filter=a,this.draw()},render:function(a){a&&this.data(a),a&&this.kLeafLayer.beginDraw(),this.draw(),a&&this.kLeafLayer.endDraw()},createShapeAttr:function(e,l){if(!this.isable)return;var d=this.options,p=d.lat.bind(d),k=d.lng.bind(d),m=a(d.id.bind(d),e,l),i=a(d.size,e)||1,n=p(e),o=k(e),j=this._map.latLngToContainerPoint(b.latLng(n,o));h=d.sprite||d.child.sprite;var h=f.switchValue(h,e);return h=f.getSprite(h),{data:e,Constructor:c.Image,index:l,id:m,attrs:{x:j.x,y:j.y,offset:{x:i/2,y:i/2},image:g(h,e),width:i,height:i,draggable:!1}}},draw:function(){var b=this._data;if(!b)return;if(!this.isable)return;var d,f,c=this.kLeafLayer,e=this.options.filter;for(var a=b.length-1;a>-1;a--){if(d=b[a],e&&!e(d,a))continue;f=this.createShapeAttr(d,a),c.addOrSetShape(f)}c.stopLazyFresh(),c.lazyFresh()},initEventsMap:function(){this._map.on('zoomend',this.draw.bind(this)).on('moveend',this.draw.bind(this))},destroy:function(){this.kLeafLayer.destroy()},clean:function(){this.kLeafLayer.clean()},initEditor:function(){this.eidtList=[],this.kLeafLayer.initEditor(),this.initEventEditor()},enableEditor:function(){this.kLeafLayer.enableEditor()},disableEditor:function(){this.kLeafLayer.disableEditor()},initEventEditor:function(){var a=this;this.kLeafLayer.on('shape-dragged',function(b){a.onShapeDragged(b.shape)})},onShapeDragged:function(e){var a=e.getClientRect(),f=a.x+a.width/2,g=a.y+a.height/2,h=this._map.containerPointToLatLng(b.point(f,g)),i=this.options,d=i.editor.setLatLng;if(!d)return console.log('请设置options.editor.setLatLng');var c=e.__data;d(h,c),this.kLeafLayer.addOrSetShape(c,null,!0),this.eidtList.push(c),this.fire('data-edited',c)},isEdited:function(){return this.eidtList.length>0},submitEdit:function(){var a=this.options,b=this.eidtList}});i.options={lng:f.getLng,lat:f.getLat,zIndex:null,refreshInterval:1,ptNPerLayer:1e3,lazyFresh:{transition:'opacity 0.4s'},size:function(a){return 40},id:function(a,b){return a.id||b},onPopupOpen:function(a,b){console.log(a,b)},hoverScale:1.2,blending:'lighter',container:'tilePane',sprite:{drawN:1.15,color:{from:'rgba(245,230,0,1)',to:'rgba(205,0,0, 0.6)',easing:'Linear.None.1.7',space:'rgb'}},child:{},editor:{setLatLng:function(b,a){if(!a)return;a.lat=b.lat,a.lng=b.lng}}};var j=b.dmap=b.dmap||{};j.ScatterKonva=i,j.scatterKonva=function(a){return new i(a)},module.exports=i | ||
function d(a,b,c,d){return typeof a==='function'?a(b,c,d):a}var b=require('./../leaflet'),e=require('konva'),g=require('lodash'),h=require('./../render/leaflet_layer_konva'),a=require('./../core/utils'),i=a.getSprite,j=a.fireEvent,d=a.getValue,c=b.Class.extend({includes:[b.Mixin.Events],initialize:function(b){b=this.options=a.deepMerge(c.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()},addTo:function(a){if(this._map||!a)return;this._map=a,this.initCanvas(),this.initEventsMap(),this.initEventsShapes()},initEventsShapes:function(){var d=this,b=this.options.hoverScale||1,a,c=this.kLeafLayer.onKonva('dragstart',function(a){}).onKonva('mouseover touchstart',function(c){a=c.target,a.setAttrs({scale:{x:b,y:b}}),a.parent.draw()}).onKonva('mouseout',function(b){a=b.target,a.setAttrs({scale:{x:1,y:1}}),a.parent.draw()}).onKonva('mouseout mouseup touchend',function(a){setTimeout(function(){c.enableMapEvents()})}).onKonva('mousedown touchstart',this.onMouseDown.bind(this)),e=['mouseout','mousedown','mouseover','mouseout','touchstart','touchend','touchup'];e.forEach(function(a){c.onKonva(a,function(b){j(a,b,d)})})},onMouseDown:function(g){var c=this.options,e=this._map,d=g.target,f=d.__data,a=c.popup;if(a&&(a=a.bind(c)),a||(a=c.child.popup,a&&(a=a.bind(c.child))),!a)return;popupText=a(f),setTimeout(function(){if(d){var a=d.getClientRect(),f=a.x+a.width/2,g=a.y,c=e.containerPointToLatLng(b.point(f,g));e.openPopup(popupText,b.latLng(c.lat,c.lng))}}.bind(this)),this.kLeafLayer.disableMapEvents()},initCanvas:function(){var c=this._map,b=this.options,d=c.getSize(),f=a.createContainer(b.container),g=new e.Stage({container:f,width:d.x,height:d.y}),i=this.kLeafLayer=new h(g,{transition:b.lazyFresh.transition,blending:b.blending,ptNPerLayer:b.ptNPerLayer});i.addTo(c),this.initEditor()},data:function(a){this._data=a,this.updateDataZindex()},updateDataZindex:function(){var a=this.options,b=a.zIndex||a.child.zIndex;b&&(this._data=g.sortBy(this._data,b))},updateOptions:function(b){var c=this.kLeafLayer;c.resetOffset(),b=this.options=a.deepMerge(this.options,b),c.hideLayers(),c.updateOptions({transition:b.lazyFresh.transition,blending:b.blending,ptNPerLayer:b.ptNPerLayer}),this.draw()},updateFilter:function(a){if(!a||typeof a!=='function')return;this.options.filter=a,this.draw()},render:function(a){a&&this.data(a),a&&this.kLeafLayer.beginDraw(),this.draw(),a&&this.kLeafLayer.endDraw()},createShapeAttr:function(f,l){if(!this.isable)return;var c=this.options,p=c.lat.bind(c),k=c.lng.bind(c),m=d(c.id.bind(c),f,l),h=d(c.size,f)||1,n=p(f),o=k(f),j=this._map.latLngToContainerPoint(b.latLng(n,o));g=c.sprite||c.child.sprite;var g=a.switchValue(g,f);return g=a.getSprite(g),{data:f,Constructor:e.Image,index:l,id:m,attrs:{x:j.x,y:j.y,offset:{x:h/2,y:h/2},image:i(g,f),width:h,height:h,draggable:!1}}},draw:function(){var b=this._data;if(!b)return;if(!this.isable)return;var d,f,c=this.kLeafLayer,e=this.options.filter;for(var a=b.length-1;a>-1;a--){if(d=b[a],e&&!e(d,a))continue;f=this.createShapeAttr(d,a),c.addOrSetShape(f)}c.stopLazyFresh(),c.lazyFresh()},initEventsMap:function(){this._map.on('zoomend',this.draw.bind(this)).on('moveend',this.draw.bind(this))},destroy:function(){this.kLeafLayer.destroy()},clean:function(){this.kLeafLayer.clean()},initEditor:function(){this.eidtList=[],this.kLeafLayer.initEditor(),this.initEventEditor()},enableEditor:function(){this.kLeafLayer.enableEditor()},disableEditor:function(){this.kLeafLayer.disableEditor()},initEventEditor:function(){var a=this;this.kLeafLayer.on('shape-dragged',function(b){a.onShapeDragged(b.shape)})},onShapeDragged:function(e){var a=e.getClientRect(),f=a.x+a.width/2,g=a.y+a.height/2,h=this._map.containerPointToLatLng(b.point(f,g)),i=this.options,d=i.editor.setLatLng;if(!d)return console.log('请设置options.editor.setLatLng');var c=e.__data;d(h,c),this.kLeafLayer.addOrSetShape(c,null,!0),this.eidtList.push(c),this.fire('data-edited',c)},isEdited:function(){return this.eidtList.length>0},submitEdit:function(){var a=this.options,b=this.eidtList}});c.options={lng:a.getLng,lat:a.getLat,zIndex:null,refreshInterval:1,ptNPerLayer:1e3,lazyFresh:{transition:'opacity 0.4s'},size:function(a){return 40},id:function(a,b){return a.id||b},onPopupOpen:function(a,b){console.log(a,b)},hoverScale:1.2,blending:'lighter',container:'tilePane',sprite:{drawN:1.15,color:{from:'rgba(245,230,0,1)',to:'rgba(205,0,0, 0.6)',easing:'Linear.None.1.7',space:'rgb'}},child:{},editor:{setLatLng:function(b,a){if(!a)return;a.lat=b.lat,a.lng=b.lng}}};var f=b.dmap=b.dmap||{};f.ScatterKonva=c,f.scatterKonva=function(a){return new c(a)},module.exports=c |
@@ -1,1 +0,1 @@ | ||
function a(b){b=this.options=c.deepMerge(a.options,b),this.getChildOptions(),this.initialize(b)}var b=require('./../leaflet'),c=require('./../core/utils'),d=c.EVENTS,e=require('bcore/event'),f=require('./scatter_marker'),g=b.dmap=b.dmap||{};a.options={isInteractive:!0,lat:c.getLat,lng:c.getLng,filter:function(a,b){return!0},popupText:'loading...',range:[0,1],id:function(a,b){return a.id||b},text:function(a){return a.text},value:function(a){return a.value||a.num||a[0]},zoom:{max:18,min:3},child:{size:function(a,b,c){return 15},shape:{normal:{}}}},a=e.extend(a,{initialize:function(a){this.cache={},this.isable=!0},addTo:function(a){if(!a)return;this._map=a,this.initEventsMap(),this.initPopUp()},initPopUp:function(){var a=this._map;a||(a._popup=b.popup('...'))},data:function(a){this._data=a},clean:function(){var a=this.cache,c,b;if(!a)return;for(var d in a)c=a[d],b=c.visual,b&&b.destroy&&(b.destroy(),delete c.visual)},updateData:function(a){this.processing(a),this.cleanOld()},updateFilter:function(a){if(typeof a!=='function')return;this.options.filter=a,this.updateMap()},cleanOld:function(){var c=this.versionID,b=this.cache,d,a,f;if(!(c&&b))return;for(var e in b)d=b[e],f=d.versionID,f!==c&&(a=d.visual,a&&(a.off&&a.off(),a.destroy&&a.destroy()),delete b[e])},processing:function(y){var t=this.versionID=Math.random(),j=this._map;if(!j)return;var c=this.options,w=this.getChildOptions(),a,i,u,v,d,b,n=this.isInZoom(),o=this._map.getZoom(),p=c.id,q=c.lat,r=c.lng,s=c.filter,g=c.groups,k,h,l=this.cache,m=this.isable;for(var e in y){if(a=y[e],c.processing&&c.processing(a),i=p(a,e),u=q(a),v=r(a),d=l[i],k=!0,k=s(a,o),h=!0,g){h=!1;for(var e in g){var x=g[e];if(x.filter(a)){h=!0;break}}}if(d?d.data=a:d=l[i]={data:a},d.versionID=t,n&&k&&h&&this.isInView(u,v)&&m){var b=d.visual;b?b.data(a):m&&(b=d.visual=new f(w),b.addTo(j),b.render(a),this.initEventsScatter(b))}}this.updateRange()},render:function(a){a&&this.data(a),a=this._data,this.updateData(a)},enable:function(){this.isable=!0},disable:function(){this.isable=!1},isInZoom:function(){var a=this.options.zoom;if(!a)return!0;var c=this._map,d=a.max,e=a.min,b=c.getZoom();return b>d||b<e?!1:!0},isInView:function(b,c,a){a=a||this._map.getBounds();var d=a._northEast.lng,e=a._northEast.lat,f=a._southWest.lng,g=a._southWest.lat;return b<e&&b>g&&c<d&&c>f},each:function(c){var a=this.cache;for(var b in a)c(a[b])},getOptionsValue:function(b){var a=this.options;return a.child[b]||a[b]},getChildOptions:function(){var a={},b=this;return['id','text','lat','lng','range','value','css','popupText','popup','isInteractive'].forEach(function(c){a[c]=b.options[c]=this.getOptionsValue(c)}.bind(this)),a},updateOptions:function(b){b=this.options=c.deepMerge(this.options,b);var a,d=this.getChildOptions(),e=b.popup;this.each(function(c){var b=c.visual;b&&(b.updateOptions(d),a=b.popupGroup,a&&a.updateOptions&&a.updateOptions(e))}),this.draw()},draw:function(){var e=this.options,g=this.cache,d,a,l,h,b,j=e.lng,k=e.lat,c,m,n=e.filter,o=this._map.getZoom(),p,q=this.isInZoom(),t=e.groups;if(!q)return this.clean();if(!g)return;if(!this.isable)return;var s=this.getChildOptions(),r=this._map;for(var i in g)d=g[i],b=d.data,l=k(b),h=j(b),p=this.isInView(l,h),c=!0,c=n(b,o),m=!0,c=c&&m,a=d.visual,p&&c?a?(a.data(b),a.updateZIndex()):(a=d.visual=new f(s),a.addTo(r),a.render(b),this.initEventsScatter(a)):a&&(a.off&&a.off(),a.destroy&&a.destroy(),delete d.visual)},updateMap:function(){this.draw()},updateRange:function(){var c=this.cache,d=this.ranges=this.ranges||{},e=this.options.value,a=d.value=[];for(var f in c){var g=c[f].data,b=e(g);a[0]||(a=[b,b]),b<a[0]&&(a[0]=b),b>a[1]&&(a[1]=b)}},initEventsPopup:function(a){var b=this._map;c.initEventsPopup({parent:this,child:a,map:b,datas:function(){return[a._data]},popup:this.options.popup}),b.on('zoomend',function(){a.updatePopupPostion()}.bind(this))},initEventsMap:function(){this._map.on('moveend',this.updateMap.bind(this))},initEventsScatter:function(a){var b=this;d.forEach(function(c){a.on(c,function(a){b.emit('child-'+c,a)})}),this.initEventsPopup(a)},destroy:function(){this.clean(),this.cache={}}}),g.ScatterMarkers=a,g.scatterMarkers=function(b){return new a(b)},module.exports=a | ||
function a(c){c=this.options=b.deepMerge(a.options,c),this.getChildOptions(),this.initialize(c)}var c=require('./../leaflet'),b=require('./../core/utils'),f=b.EVENTS,g=require('bcore/event'),d=require('./scatter_marker'),e=c.dmap=c.dmap||{};a.options={isInteractive:!0,lat:b.getLat,lng:b.getLng,filter:function(a,b){return!0},popupText:'loading...',range:[0,1],id:function(a,b){return a.id||b},text:function(a){return a.text},value:function(a){return a.value||a.num||a[0]},zoom:{max:18,min:3},child:{size:function(a,b,c){return 15},shape:{normal:{}}}},a=g.extend(a,{initialize:function(a){this.cache={},this.isable=!0},addTo:function(a){if(!a)return;this._map=a,this.initEventsMap(),this.initPopUp()},initPopUp:function(){var a=this._map;a||(a._popup=c.popup('...'))},data:function(a){this._data=a},clean:function(){var a=this.cache,c,b;if(!a)return;for(var d in a)c=a[d],b=c.visual,b&&b.destroy&&(b.destroy(),delete c.visual)},updateData:function(a){this.processing(a),this.cleanOld()},updateFilter:function(a){if(typeof a!=='function')return;this.options.filter=a,this.updateMap()},cleanOld:function(){var c=this.versionID,b=this.cache,d,a,f;if(!(c&&b))return;for(var e in b)d=b[e],f=d.versionID,f!==c&&(a=d.visual,a&&(a.off&&a.off(),a.destroy&&a.destroy()),delete b[e])},processing:function(y){var t=this.versionID=Math.random(),j=this._map;if(!j)return;var c=this.options,w=this.getChildOptions(),a,i,u,v,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.data(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])},getOptionsValue:function(b){var a=this.options;return a.child[b]||a[b]},getChildOptions:function(){var a={},b=this;return['id','text','lat','lng','range','value','css','popupText','popup','isInteractive'].forEach(function(c){a[c]=b.options[c]=this.getOptionsValue(c)}.bind(this)),a},updateOptions:function(c){c=this.options=b.deepMerge(this.options,c);var a,d=this.getChildOptions(),e=c.popup;this.each(function(c){var b=c.visual;b&&(b.updateOptions(d),a=b.popupGroup,a&&a.updateOptions&&a.updateOptions(e))}),this.draw()},draw:function(){var 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.data(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)}},initEventsPopup:function(a){var c=this._map;b.initEventsPopup({parent:this,child:a,map:c,datas:function(){return[a._data]},popup:this.options.popup}),c.on('zoomend',function(){a.updatePopupPostion()}.bind(this))},initEventsMap:function(){this._map.on('moveend',this.updateMap.bind(this))},initEventsScatter:function(a){var b=this;f.forEach(function(c){a.on(c,function(a){b.emit('child-'+c,a)})}),this.initEventsPopup(a)},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='© <a href="//www.amap.com/">高德地图</a>',b='© <a href="//map.qq.com/">腾讯地图</a>',c='Map tiles by <a href="//stamen.com">Stamen Design</a>, <a href="//creativecommons.org/licenses/by/3.0">CC BY 3.0</a> — Map data {attribution.OpenStreetMap}',d={road:{name:'道路',ename:'road',value:4},roadLabel:{name:'道路标注',ename:'roadLabel',value:2},region:{name:'区域',ename:'region',value:8},poi:{name:'道路',ename:'poi',value:2}};module.exports={AtlasLight:{url:'//42.120.180.211:8080/mapservice?t=1&c={variant}&x={x}&y={y}&z={z}&size=1&v=light',options:{attribution:a,minZoom:2,maxZoom:15,variant:'road',name:'Atlas白(高德)'},variants:d},AtlasDark:{url:'//42.120.180.211:8080/mapservice?t=1&c={variant}&x={x}&y={y}&z={z}&size=1&v=dark',options:{attribution:a,minZoom:2,maxZoom:15,variant:'road',name:'Atlas深灰(高德)'},variants:d},AtlasBlue:{url:'//42.120.180.211:8080/mapservice?t=1&c={variant}&x={x}&y={y}&z={z}&size=1&v=blue',options:{attribution:a,minZoom:2,maxZoom:15,variant:'road',name:'Atlas蓝(高德)'},variants:d},SatelliteAMap:{url:'//webst02.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}',options:{attribution:a,minZoom:2,maxZoom:18,name:'卫星(高德)'}},HeatmapAMap:{url:function(h,j,i){var a=new Date;a.setHours(a.getHours()-1);var b=function(a,b){return b-=a.toString().length,b>0?new Array(b+(/\./.test(a)?2:1)).join('0')+a:a+''},g=a.getFullYear(),f=b(a.getMonth()+1,2),d=b(a.getDate(),2),c=b(a.getHours(),2),e=''+g+f+d+c;return'http://heatmap.amap.com/api/showmap/pvheatmap?x='+h+'&y='+j+'&z='+i+'&showmap=equal&htime='+e},options:{attribution:a,minZoom:2,maxZoom:18,name:'热力图(高德)'}},SatelliteTMap:{url:function(b,a,c){return a=Math.pow(2,c)-a-1,'http://p'+Math.floor(Math.random()*4)+'.map.gtimg.com/sateTiles/'+c+'/'+Math.floor(b/16)+'/'+Math.floor(a/16)+'/'+b+'_'+a+'.jpg'},options:{attribution:b,minZoom:2,maxZoom:18,name:'卫星(腾讯)'}},SatelliteGoogle:{url:'http://mt3.google.cn/vt/lyrs=s&hl=zh-CN&gl=cn&x={x}&y={y}&z={z}',options:{attribution:a,minZoom:2,maxZoom:18,name:'卫星(谷歌)'}},TMapTerrain:{url:function(b,a,c){return a=Math.pow(2,c)-a-1,'http://p'+Math.floor(Math.random()*4)+'.map.gtimg.com/demTiles/'+c+'/'+Math.floor(b/16)+'/'+Math.floor(a/16)+'/'+b+'_'+a+'.jpg'},options:{attribution:b,minZoom:2,maxZoom:18,name:'地形(腾讯)'}},TianDiMap:{url:'//t0.tianditu.com/DataServer?T=vec_w&x={x}&y={y}&l={z}',options:{minZoom:2,maxZoom:18,name:'天地图'}},SatelliteEsri:{url:'//server.arcgisonline.com/arcgis/rest/services/world_imagery/mapserver/tile/{z}/{y}/{x}',options:{attribution:'© <a href="//maps.esri.com/">esri</a>',minZoom:0,maxZoom:20,name:'卫星(esri)'}},TMapRoad:{url:function(b,c,a){var d=''+Date.parse(new Date),e='abc'.charAt(~~(Math.random()*3));return b=b.toString(),c=c.toString(),a=a.toString(),'//rtt2'+e+'.map.qq.com/rtt/?z='+a+'&x='+b+'&y='+(Math.pow(2,+a)-1-c)+'&timeKey='+d.substring(0,d.length-4)},options:{attribution:b,minZoom:2,maxZoom:18,name:'路网(腾讯)'}},NormalAMap1:{url:'//webrd03.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=7&x={x}&y={y}&z={z}',options:{attribution:a,minZoom:2,maxZoom:18,name:'简单(高德)'}},NormalAMap:{url:'//webrd03.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}',options:{attribution:a,minZoom:2,maxZoom:18,name:'普通(高德)'}},GeoQBlue:{url:'//map.geoq.cn/ArcGIS/rest/services/ChinaOnlineStreetPurplishBlue/MapServer/tile/{z}/{y}/{x}',options:{attribution:'© <a href="./">geoq</a>',minZoom:0,maxZoom:20,name:'蓝色(geoQ)'}},GeoQGray:{url:'//map.geoq.cn/ArcGIS/rest/services/ChinaOnlineStreetGray/MapServer/tile/{z}/{y}/{x}',options:{attribution:'© <a href="./">geoq</a>',minZoom:0,maxZoom:20,name:'灰色(geoQ)'}},GeoQBound:{url:'//thematic.geoq.cn/arcgis/rest/services/ThematicMaps/administrative_division_boundaryandlabel/MapServer/tile/{z}/{y}/{x}',options:{attribution:'© <a href="./">geoq</a>',minZoom:0,maxZoom:20,name:'边界(geoQ)'}},GeoQColorplate:{url:'//map.geoq.cn/ArcGIS/rest/services/ChinaOnlineCommunity/MapServer/tile/{z}/{y}/{x}',options:{attribution:'© <a href="./">geoq</a>',minZoom:0,maxZoom:20,name:'彩色(geoQ)'}},GeoQBoundOnly:{url:'http://30.9.160.123:8887/v2/tiles/{z}/{x}/{y}.pbf',options:{attribution:'© <a href="./">geoq</a>',minZoom:0,maxZoom:20,name:'仅边界(geoQ)'}},GeoQWater:{url:'//thematic.geoq.cn/arcgis/rest/services/ThematicMaps/WorldHydroMap/MapServer/tile/{z}/{y}/{x}',options:{attribution:'© <a href="./">geoq</a>',minZoom:0,maxZoom:20,name:'水系(geoQ)'}},GeoQRailway:{url:'//thematic.geoq.cn/arcgis/rest/services/ThematicMaps/Subway/MapServer/tile/{z}/{y}/{x}',options:{attribution:'© <a href="./">geoq</a>',minZoom:0,maxZoom:20,name:'地铁(geoQ)'}},OpenStreetMap:{disable:!0,url:'//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',options:{attribution:'© <a href="//www.openstreetmap.org/copyright">OpenStreetMap</a>',name:'OSM'},variants:{Mapnik:{},BlackAndWhite:{url:'//{s}.tiles.wmflabs.org/bw-mapnik/{z}/{x}/{y}.png'},DE:{url:'//{s}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png'},HOT:{url:'//{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png',options:{attribution:'{attribution.OpenStreetMap}, Tiles courtesy of <a href="//hot.openstreetmap.org/" target="_blank">Humanitarian OpenStreetMap Team</a>'}}}},StamenToner:{url:'//{s}.tile.stamen.com/toner/{z}/{x}/{y}.png',options:{attribution:c,subdomains:'abcd',minZoom:0,maxZoom:20,name:'木刻(stamen)'}},StamenWaterColor:{url:'//{s}.tile.stamen.com/watercolor/{z}/{x}/{y}.png',options:{attribution:c,subdomains:'abcd',minZoom:1,maxZoom:16,name:'水彩(stamen)'}},OpenTopoMap:{url:'//{s}.tile.opentopomap.org/{z}/{x}/{y}.png',options:{attribution:'© <a href="//opentopomap.org/">opentopomap</a>',subdomains:'abcd',minZoom:0,maxZoom:20,name:'高程(OTM)',desc:'免费地图,数据来自OpenStreetMap和SRTM高程数据'}}} | ||
var a='© <a href="//www.amap.com/">高德地图</a>',b='© <a href="//map.qq.com/">腾讯地图</a>',d='Map tiles by <a href="//stamen.com">Stamen Design</a>, <a href="//creativecommons.org/licenses/by/3.0">CC BY 3.0</a> — Map data {attribution.OpenStreetMap}',c={road:{name:'道路',ename:'road',value:4},roadLabel:{name:'道路标注',ename:'roadLabel',value:2},region:{name:'区域',ename:'region',value:8},poi:{name:'道路',ename:'poi',value:2}};module.exports={AtlasLight:{url:'//42.120.180.211:8080/mapservice?t=1&c={variant}&x={x}&y={y}&z={z}&size=1&v=light',options:{attribution:a,minZoom:2,maxZoom:15,variant:'road',name:'Atlas白(高德)'},variants:c},AtlasDark:{url:'//42.120.180.211:8080/mapservice?t=1&c={variant}&x={x}&y={y}&z={z}&size=1&v=dark',options:{attribution:a,minZoom:2,maxZoom:15,variant:'road',name:'Atlas深灰(高德)'},variants:c},AtlasBlue:{url:'//42.120.180.211:8080/mapservice?t=1&c={variant}&x={x}&y={y}&z={z}&size=1&v=blue',options:{attribution:a,minZoom:2,maxZoom:15,variant:'road',name:'Atlas蓝(高德)'},variants:c},SatelliteAMap:{url:'//webst02.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}',options:{attribution:a,minZoom:2,maxZoom:18,name:'卫星(高德)'}},HeatmapAMap:{url:function(h,j,i){var a=new Date;a.setHours(a.getHours()-1);var b=function(a,b){return b-=a.toString().length,b>0?new Array(b+(/\./.test(a)?2:1)).join('0')+a:a+''},g=a.getFullYear(),f=b(a.getMonth()+1,2),d=b(a.getDate(),2),c=b(a.getHours(),2),e=''+g+f+d+c;return'http://heatmap.amap.com/api/showmap/pvheatmap?x='+h+'&y='+j+'&z='+i+'&showmap=equal&htime='+e},options:{attribution:a,minZoom:2,maxZoom:18,name:'热力图(高德)'}},SatelliteTMap:{url:function(b,a,c){return a=Math.pow(2,c)-a-1,'http://p'+Math.floor(Math.random()*4)+'.map.gtimg.com/sateTiles/'+c+'/'+Math.floor(b/16)+'/'+Math.floor(a/16)+'/'+b+'_'+a+'.jpg'},options:{attribution:b,minZoom:2,maxZoom:18,name:'卫星(腾讯)'}},SatelliteGoogle:{url:'http://mt3.google.cn/vt/lyrs=s&hl=zh-CN&gl=cn&x={x}&y={y}&z={z}',options:{attribution:a,minZoom:2,maxZoom:18,name:'卫星(谷歌)'}},TMapTerrain:{url:function(b,a,c){return a=Math.pow(2,c)-a-1,'http://p'+Math.floor(Math.random()*4)+'.map.gtimg.com/demTiles/'+c+'/'+Math.floor(b/16)+'/'+Math.floor(a/16)+'/'+b+'_'+a+'.jpg'},options:{attribution:b,minZoom:2,maxZoom:18,name:'地形(腾讯)'}},TianDiMap:{url:'//t0.tianditu.com/DataServer?T=vec_w&x={x}&y={y}&l={z}',options:{minZoom:2,maxZoom:18,name:'天地图'}},SatelliteEsri:{url:'//server.arcgisonline.com/arcgis/rest/services/world_imagery/mapserver/tile/{z}/{y}/{x}',options:{attribution:'© <a href="//maps.esri.com/">esri</a>',minZoom:0,maxZoom:20,name:'卫星(esri)'}},TMapRoad:{url:function(b,c,a){var d=''+Date.parse(new Date),e='abc'.charAt(~~(Math.random()*3));return b=b.toString(),c=c.toString(),a=a.toString(),'//rtt2'+e+'.map.qq.com/rtt/?z='+a+'&x='+b+'&y='+(Math.pow(2,+a)-1-c)+'&timeKey='+d.substring(0,d.length-4)},options:{attribution:b,minZoom:2,maxZoom:18,name:'路网(腾讯)'}},NormalAMap1:{url:'//webrd03.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=7&x={x}&y={y}&z={z}',options:{attribution:a,minZoom:2,maxZoom:18,name:'简单(高德)'}},NormalAMap:{url:'//webrd03.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}',options:{attribution:a,minZoom:2,maxZoom:18,name:'普通(高德)'}},GeoQBlue:{url:'//map.geoq.cn/ArcGIS/rest/services/ChinaOnlineStreetPurplishBlue/MapServer/tile/{z}/{y}/{x}',options:{attribution:'© <a href="./">geoq</a>',minZoom:0,maxZoom:20,name:'蓝色(geoQ)'}},GeoQGray:{url:'//map.geoq.cn/ArcGIS/rest/services/ChinaOnlineStreetGray/MapServer/tile/{z}/{y}/{x}',options:{attribution:'© <a href="./">geoq</a>',minZoom:0,maxZoom:20,name:'灰色(geoQ)'}},GeoQBound:{url:'//thematic.geoq.cn/arcgis/rest/services/ThematicMaps/administrative_division_boundaryandlabel/MapServer/tile/{z}/{y}/{x}',options:{attribution:'© <a href="./">geoq</a>',minZoom:0,maxZoom:20,name:'边界(geoQ)'}},GeoQColorplate:{url:'//map.geoq.cn/ArcGIS/rest/services/ChinaOnlineCommunity/MapServer/tile/{z}/{y}/{x}',options:{attribution:'© <a href="./">geoq</a>',minZoom:0,maxZoom:20,name:'彩色(geoQ)'}},GeoQBoundOnly:{url:'http://30.9.160.123:8887/v2/tiles/{z}/{x}/{y}.pbf',options:{attribution:'© <a href="./">geoq</a>',minZoom:0,maxZoom:20,name:'仅边界(geoQ)'}},GeoQWater:{url:'//thematic.geoq.cn/arcgis/rest/services/ThematicMaps/WorldHydroMap/MapServer/tile/{z}/{y}/{x}',options:{attribution:'© <a href="./">geoq</a>',minZoom:0,maxZoom:20,name:'水系(geoQ)'}},GeoQRailway:{url:'//thematic.geoq.cn/arcgis/rest/services/ThematicMaps/Subway/MapServer/tile/{z}/{y}/{x}',options:{attribution:'© <a href="./">geoq</a>',minZoom:0,maxZoom:20,name:'地铁(geoQ)'}},OpenStreetMap:{disable:!0,url:'//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',options:{attribution:'© <a href="//www.openstreetmap.org/copyright">OpenStreetMap</a>',name:'OSM'},variants:{Mapnik:{},BlackAndWhite:{url:'//{s}.tiles.wmflabs.org/bw-mapnik/{z}/{x}/{y}.png'},DE:{url:'//{s}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png'},HOT:{url:'//{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png',options:{attribution:'{attribution.OpenStreetMap}, Tiles courtesy of <a href="//hot.openstreetmap.org/" target="_blank">Humanitarian OpenStreetMap Team</a>'}}}},StamenToner:{url:'//{s}.tile.stamen.com/toner/{z}/{x}/{y}.png',options:{attribution:d,subdomains:'abcd',minZoom:0,maxZoom:20,name:'木刻(stamen)'}},StamenWaterColor:{url:'//{s}.tile.stamen.com/watercolor/{z}/{x}/{y}.png',options:{attribution:d,subdomains:'abcd',minZoom:1,maxZoom:16,name:'水彩(stamen)'}},OpenTopoMap:{url:'//{s}.tile.opentopomap.org/{z}/{x}/{y}.png',options:{attribution:'© <a href="//opentopomap.org/">opentopomap</a>',subdomains:'abcd',minZoom:0,maxZoom:20,name:'高程(OTM)',desc:'免费地图,数据来自OpenStreetMap和SRTM高程数据'}}} |
@@ -1,1 +0,1 @@ | ||
function a(g,d,i){var a=f.deepMerge(g.options,i),c=g.variants,b;if(!c)return a;if(d&&d.length===2){var e=d[1];return b=c[e],a[e]=b.value,a}if(a.variant&&c){var h=a.variant;if(b=c[h],!b)return a;a.variant=typeof b==='string'?b:b.value,b.options&&(a=f.deepMerge(a,b.options))}return a}function b(a){var c=a.attribution;return c?c.indexOf('{attribution.')===-1?a:(a.attribution=c.replace(/\{attribution.(\w*)\}/,function(c,a){return b(e[a].options)}),a):a}function c(a){return a===undefined||a===null}var d=require('./../leaflet'),e=require('./tilelayer_data');delete e.__filename;var f=require('./../core/utils'),g=f.switchValue,h=d.TileLayer.extend({initialize:function(c,a){var b=f.deepMerge(h.options,a);a=this.options=f.deepMerge(this.options,b),a.maxNativeZoom=16,this.update(c,a,!0)},update:function(f,c,k){if(c=undefined,typeof f==='object'&&(c=f,f=c.url),f.indexOf('{')===-1&&(this.tileName=f),this.tData=e,typeof f!=='string')return console.log('输入必须为字符形式');if(f.indexOf('{')!==-1)return d.TileLayer.prototype.initialize.call(this,f,c),k?void 0:d.TileLayer.prototype.setUrl.call(this,f,c);var h=f.split('.'),l=h[0],i=e[l]||e.GeoQBlue,j=this.options.isCache?null:'ldmap='+Math.floor(Math.random()*1e7),g=i.url;if(g&&typeof g==='string'&&j){var m=g.indexOf('?')===-1?'?':'&';g+=m+j}if(c=a(i,h,c),c=b(c),d.TileLayer.prototype.initialize.call(this,g,c),k)return;this.setUrl(g,c),this.redraw()},help:function(){console.log('L.dmap.tileLayer(name, options)\n---name可以是:\n\n\n');for(var a in e){var b=e[a].options,c=b.name;console.log(a+' | '+c)}},getTileUrl:function(a){var b=a.x,e=a.y,f=a.z;return c(a.x)||c(a.y)||c(a.z)?void 0:typeof this._url==='function'?this._url(b,e,f):d.Util.template(this._url,d.extend({s:this._getSubdomain(a),z:a.z,x:a.x,y:a.y},this.options))},setVariables:function(){}});h.options={isCache:!1};var i=d.dmap=d.dmap||{};i.TileLayer=h,i.tileLayer=function(a,b){return new i.TileLayer(a,b)},module.exports=h | ||
function h(g,e,i){var a=c.deepMerge(g.options,i),d=g.variants,b;if(!d)return a;if(e&&e.length===2){var f=e[1];return b=d[f],a[f]=b.value,a}if(a.variant&&d){var h=a.variant;if(b=d[h],!b)return a;a.variant=typeof b==='string'?b:b.value,b.options&&(a=c.deepMerge(a,b.options))}return a}function g(a){var c=a.attribution;return c?c.indexOf('{attribution.')===-1?a:(a.attribution=c.replace(/\{attribution.(\w*)\}/,function(c,a){return g(b[a].options)}),a):a}function f(a){return a===undefined||a===null}var a=require('./../leaflet'),b=require('./tilelayer_data');delete b.__filename;var c=require('./../core/utils'),i=c.switchValue,d=a.TileLayer.extend({initialize:function(e,a){var b=c.deepMerge(d.options,a);a=this.options=c.deepMerge(this.options,b),a.maxNativeZoom=16,this.update(e,a,!0)},update:function(d,c,k){if(c=undefined,typeof d==='object'&&(c=d,d=c.url),d.indexOf('{')===-1&&(this.tileName=d),this.tData=b,typeof d!=='string')return console.log('输入必须为字符形式');if(d.indexOf('{')!==-1)return a.TileLayer.prototype.initialize.call(this,d,c),k?void 0:a.TileLayer.prototype.setUrl.call(this,d,c);var f=d.split('.'),l=f[0],i=b[l]||b.GeoQBlue,j=this.options.isCache?null:'ldmap='+Math.floor(Math.random()*1e7),e=i.url;if(e&&typeof e==='string'&&j){var m=e.indexOf('?')===-1?'?':'&';e+=m+j}if(c=h(i,f,c),c=g(c),a.TileLayer.prototype.initialize.call(this,e,c),k)return;this.setUrl(e,c),this.redraw()},help:function(){console.log('L.dmap.tileLayer(name, options)\n---name可以是:\n\n\n');for(var a in b){var c=b[a].options,d=c.name;console.log(a+' | '+d)}},getTileUrl:function(b){var c=b.x,d=b.y,e=b.z;return f(b.x)||f(b.y)||f(b.z)?void 0:typeof this._url==='function'?this._url(c,d,e):a.Util.template(this._url,a.extend({s:this._getSubdomain(b),z:b.z,x:b.x,y:b.y},this.options))},setVariables:function(){}});d.options={isCache:!1};var e=a.dmap=a.dmap||{};e.TileLayer=d,e.tileLayer=function(a,b){return new e.TileLayer(a,b)},module.exports=d |
@@ -1,1 +0,1 @@ | ||
'use strict';function a(b){b=this.options=c.deepMerge(a.options,b),this.id=Math.floor(Math.random()*1e7)+'_'+new Date().getTime(),this.initialize(b)}var b=require('./../leaflet'),c=require('./../core/utils'),d=require('./../render/canvas'),e=c.getColorFunc,f=c.switchValue,g=require('bcore/event'),h=require('./../core/utils').getSprite;a.options={container:null,lengthLimit:15,lifeSpeed:.5,delay:30,isAutoUpdate:!0,lineSegmentLonger:1,container:null,blending:'lighter',sprite:{type:'linear',isContinue:!0,width:200,height:20,color:{from:'rgba(0,233,233,0.3)',to:'rgba(0,233,233,0.3)',space:'hsl',easing:'linear.Out.3'}},isable:!0,isableDraw:!0,type:'line',ptsN:9,weight:function(b,a){return 5*Math.pow(a,1)},pts:function(a){return a.pts},color:e('rgba(0,150,150,0.8)','rgba(0,100,255, 1)','rgb','linear.Out.1'),scale:function(a){return 1},size:function(a,b){return 15},value:function(a,b,c){return Math.min(1,a.length/40)},lng:c.getLng,lat:c.getLat,time:c.getTime},a=g.extend(a,{events:{},includes:[b.Mixin.Events],initialize:function(a){},addTo:function(a){if(this._map||!a)return;this._map=a,this.initCanvas(),this._data&&this.draw()},initCanvas:function(){var a=this.options;if(a.ctx)return this.ctx=a.ctx;this.lcanvas=new d(this._map,a.container,{clearAlpha:1});var b=this.ctx=this.lcanvas.ctx;b.globalCompositeOperation=a.blending,this.ctx=b},processing:function(){var a=this.pts,c=this.options,q=c.time,p=c.lat,o=c.lng,m,j,i,n=m=q(a[0],0),k=j=o(a[0],0),l=i=p(a[0],0),g,f,e,d;for(var h=0;h<a.length;h++){if(g=a[h],!g)continue;f=p(g),e=o(g),d=q(g,h),d>m&&(m=d),d<n&&(n=d),f>i&&(i=f),f<l&&(l=f),e>j&&(j=e),e<k&&(k=e)}this.lifeMax=c.lifeMax=m,this.lifeMin=c.lifeMin=n;var s=b.latLng(l,k),r=b.latLng(i,j);this.bounds=b.latLngBounds(s,r)},getBBox:function(){return this.bounds},isInView:function(a){a=a||this._map.getBounds();var b=this.bounds,d=b._northEast.lng,e=b._northEast.lat,c=b._southWest.lng,g=b._southWest.lat,h=a._northEast.lng,i=a._northEast.lat,j=a._southWest.lng,f=a._southWest.lat;return!(j<c&&h<c||j>d&&h>d||f<g&&i<g||f>e&&i>e)},data:function(a){if(!a)return this._data;var b=this.options,c=b.pts.bind(b);this._data=a,this.pts=c(a),this.processing(),this.resetVariables()},append:function(a){if(!this._data)return console.log('初始数据没有');this.pts.append(a)},render:function(a){a&&this.data(a),this.draw()},updateOptions:function(a){a=this.options=c.deepMerge(this.options,a)},resetVariables:function(){this.enable(),this.life=this.options.lifeMin||this.lifeMin},enable:function(){this.options.isable=!0},disable:function(){this.options.isable=!1},enableDraw:function(){this.options.isableDraw=!0},disableDraw:function(){this.options.isableDraw=!1},equalTo:function(a){return this.id===a.id?!0:!1},draw:function(){var a=this.options;if(!(a.isable&&a.isableDraw))return;var F=a.lengthLimit,E=a.lineSegmentLonger,c=this.ctx,n=h(a.sprite),u=this._map.latLngToContainerPoint.bind(this._map),g=this.pts;if(!g)return;var i=g.length,j,r,e,m,v,A,k,l,p,q=n.width,w=n.height,x=1/ i*q*1,y=a.lat.bind(a),z=a.lng.bind(a);for(var d=0;d<i;d++){j=g[d];var B=y(j),C=z(j),s=u(b.latLng(B,C)),t=s.x,o=s.y;if(r=(d-1)/ i,e||m){k=t-e,l=o-m,v=Math.atan2(l,k),A=Math.sqrt(k*k+l*l)+E,p=f(a.weight,j,r),c.save(),c.translate(e,m),c.rotate(v);var D=r*q;c.drawImage(n,D,0,x,w,0,-p/2,A,p),c.restore()}e=t,m=o}},isEnd:function(){return this.life>=this.lifeMax+(this.options.delay||0)},updateMap:function(a){this.draw()}});var i=b.dmap=b.dmap||{};i.TrailCanvasBg=a,i.trailCanvasBg=function(b){return new a(b)},module.exports=a | ||
'use strict';function c(a){a=this.options=b.deepMerge(c.options,a),this.id=Math.floor(Math.random()*1e7)+'_'+new Date().getTime(),this.initialize(a)}var a=require('./../leaflet'),b=require('./../core/utils'),e=require('./../render/canvas'),f=b.getColorFunc,g=b.switchValue,h=require('bcore/event'),i=require('./../core/utils').getSprite;c.options={container:null,lengthLimit:15,lifeSpeed:.5,delay:30,isAutoUpdate:!0,lineSegmentLonger:1,container:null,blending:'lighter',sprite:{type:'linear',isContinue:!0,width:200,height:20,color:{from:'rgba(0,233,233,0.3)',to:'rgba(0,233,233,0.3)',space:'hsl',easing:'linear.Out.3'}},isable:!0,isableDraw:!0,type:'line',ptsN:9,weight:function(b,a){return 5*Math.pow(a,1)},pts:function(a){return a.pts},color:f('rgba(0,150,150,0.8)','rgba(0,100,255, 1)','rgb','linear.Out.1'),scale:function(a){return 1},size:function(a,b){return 15},value:function(a,b,c){return Math.min(1,a.length/40)},lng:b.getLng,lat:b.getLat,time:b.getTime},c=h.extend(c,{events:{},includes:[a.Mixin.Events],initialize:function(a){},addTo:function(a){if(this._map||!a)return;this._map=a,this.initCanvas(),this._data&&this.draw()},initCanvas:function(){var a=this.options;if(a.ctx)return this.ctx=a.ctx;this.lcanvas=new e(this._map,a.container,{clearAlpha:1});var b=this.ctx=this.lcanvas.ctx;b.globalCompositeOperation=a.blending,this.ctx=b},processing:function(){var b=this.pts,c=this.options,q=c.time,p=c.lat,o=c.lng,m,j,i,n=m=q(b[0],0),k=j=o(b[0],0),l=i=p(b[0],0),g,f,e,d;for(var h=0;h<b.length;h++){if(g=b[h],!g)continue;f=p(g),e=o(g),d=q(g,h),d>m&&(m=d),d<n&&(n=d),f>i&&(i=f),f<l&&(l=f),e>j&&(j=e),e<k&&(k=e)}this.lifeMax=c.lifeMax=m,this.lifeMin=c.lifeMin=n;var s=a.latLng(l,k),r=a.latLng(i,j);this.bounds=a.latLngBounds(s,r)},getBBox:function(){return this.bounds},isInView:function(a){a=a||this._map.getBounds();var b=this.bounds,d=b._northEast.lng,e=b._northEast.lat,c=b._southWest.lng,g=b._southWest.lat,h=a._northEast.lng,i=a._northEast.lat,j=a._southWest.lng,f=a._southWest.lat;return!(j<c&&h<c||j>d&&h>d||f<g&&i<g||f>e&&i>e)},data:function(a){if(!a)return this._data;var b=this.options,c=b.pts.bind(b);this._data=a,this.pts=c(a),this.processing(),this.resetVariables()},append:function(a){if(!this._data)return console.log('初始数据没有');this.pts.append(a)},render:function(a){a&&this.data(a),this.draw()},updateOptions:function(a){a=this.options=b.deepMerge(this.options,a)},resetVariables:function(){this.enable(),this.life=this.options.lifeMin||this.lifeMin},enable:function(){this.options.isable=!0},disable:function(){this.options.isable=!1},enableDraw:function(){this.options.isableDraw=!0},disableDraw:function(){this.options.isableDraw=!1},equalTo:function(a){return this.id===a.id?!0:!1},draw:function(){var b=this.options;if(!(b.isable&&b.isableDraw))return;var F=b.lengthLimit,E=b.lineSegmentLonger,c=this.ctx,n=i(b.sprite),u=this._map.latLngToContainerPoint.bind(this._map),f=this.pts;if(!f)return;var h=f.length,j,r,e,m,v,A,k,l,p,q=n.width,w=n.height,x=1/h*q*1,y=b.lat.bind(b),z=b.lng.bind(b);for(var d=0;d<h;d++){j=f[d];var B=y(j),C=z(j),s=u(a.latLng(B,C)),t=s.x,o=s.y;if(r=(d-1)/h,e||m){k=t-e,l=o-m,v=Math.atan2(l,k),A=Math.sqrt(k*k+l*l)+E,p=g(b.weight,j,r),c.save(),c.translate(e,m),c.rotate(v);var D=r*q;c.drawImage(n,D,0,x,w,0,-p/2,A,p),c.restore()}e=t,m=o}},isEnd:function(){return this.life>=this.lifeMax+(this.options.delay||0)},updateMap:function(a){this.draw()}});var d=a.dmap=a.dmap||{};d.TrailCanvasBg=c,d.trailCanvasBg=function(a){return new c(a)},module.exports=c |
@@ -1,1 +0,1 @@ | ||
'use strict';function a(b){b=this.options=c.deepMerge(a.options,b),this.id=Math.floor(Math.random()*1e7)+'_'+new Date().getTime(),this.initialize(b)}var b=require('./../leaflet'),c=require('./../core/utils'),d=require('./../render/canvas'),e=c.getColorFunc,f=c.switchValue,g=require('./../core/animator'),h=require('./../core/utils').getSprite;a.options={lengthLimit:15,lifeSpeed:.5,delay:30,isAutoUpdate:!0,lineSegmentLonger:1,spriteW:200,spriteH:20,container:null,isable:!0,isableDraw:!0,type:'line',ptsN:9,weight:function(b,a){return 5*Math.pow(a,3)},pts:function(a){return a.pts},spriteHead:!0,color:e('rgba(0,150,150,0.8)','rgba(0,100,255, 1)','rgb','linear.Out.1'),scale:function(a){return 1},size:function(a,b){return 15},value:function(a,b,c){return Math.min(1,a.length/40)},lng:c.getLng,lat:c.getLat,time:c.getTime},a.options=c.deepMerge(g.options,a.options),a=g.extend(a,{events:{},includes:[b.Mixin.Events],initialize:function(a){this.ctx=a.ctx,a.spriteHead&&(this.spriteHead=a.spriteHead||this.initSpriteFlyingHead()),a.isAutoUpdate&&this.initEventsAnim()},addTo:function(a){if(this._map||!a)return;this._map=a,this._data&&this.updateZoom()},processing:function(){var a=this.pts,c=this.options,q=c.time,p=c.lat,o=c.lng,m,j,i,n=m=q(a[0],0),k=j=o(a[0],0),l=i=p(a[0],0),g,f,e,d;for(var h=0;h<a.length;h++){if(g=a[h],!g)continue;f=p(g),e=o(g),d=q(g,h),d>m&&(m=d),d<n&&(n=d),f>i&&(i=f),f<l&&(l=f),e>j&&(j=e),e<k&&(k=e)}this.lifeMax=c.lifeMax=m,this.lifeMin=c.lifeMin=n;var s=b.latLng(l,k),r=b.latLng(i,j);this.bounds=b.latLngBounds(s,r)},getBBox:function(){return this.bounds},isInView:function(a){a=a||this._map.getBounds();var b=this.bounds,d=b._northEast.lng,e=b._northEast.lat,c=b._southWest.lng,g=b._southWest.lat,h=a._northEast.lng,i=a._northEast.lat,j=a._southWest.lng,f=a._southWest.lat;return!(j<c&&h<c||j>d&&h>d||f<g&&i<g||f>e&&i>e)},data:function(a){if(!a)return this._data;var b=this.options,c=b.pts.bind(b);this._data=a,this.pts=c(a),this.processing(),this.resetVariables(),this.options.isAutoUpdate&&this._map&&this.startAnim()},append:function(a){if(!this._data)return console.log('初始数据没有');this.pts.append(a)},render:function(a){a&&this.data(a),this.startAnim()},updateFlying:function(){var d=this.options;if(!this.options.isable)return;var e=this.life,c=this.pts,f=d.time,g=this.indexLast||0,h,b;for(var a=g;a<c.length;a++){if(b=c[a],!b)continue;if(h=f(b,a),h>e){this.indexLast=a;break}this._addFlyingPt(b)}this._drawFlying()},updateOptions:function(a){a=this.options=c.deepMerge(this.options,a)},resetVariables:function(){this.indexLast=0,this.flyingPts=[],this.enable('flying'),this.life=this.options.lifeMin||this.lifeMin},enable:function(){this.options.isable=!0},disable:function(){this.options.isable=!1},enableDraw:function(){this.options.isableDraw=!0},disableDraw:function(){this.options.isableDraw=!1},_addFlyingPt:function(b){this.curPoint=b;var a=this.options,c=a.ptsN,d=a.lat,e=a.lng;this.flyingPts.push({lat:d(b),lng:e(b)}),this.flyingPts.length>c&&this.flyingPts.splice(0,1)},equalTo:function(a){return this.id===a.id?!0:!1},_drawFlying:function(){var o=this._map,G=o.getZoom(),d=this.options,F=d.lengthLimit,z=d.lineSegmentLonger;if(!(d.isable&&this.options.isableDraw))return;var D=d.spriteFlying,C=d.spriteHead,p=h(D),w=h(C),x=p.width,E=p.height,j=this.flyingPts,v=o.latLngToContainerPoint.bind(o),a=this.ctx,e,t,m=j.length,q,r,A,y,s,n,B=1/m*x*1;for(var l=m-1;l>=0;l--){e=j[l];var c=v(b.latLng(e.lat,e.lng)),i=c.x,g=c.y;if((q||r)&&(t=(l-1)/m,s=i-q,n=g-r,A=Math.atan2(n,s),y=Math.sqrt(s*s+n*n)+z,y<F)){var u=f(d.weight,e,t);a.save(),a.translate(q,r),a.rotate(A);var H=t*x;a.drawImage(p,H,0,B,E,0,-u/2,y,u),a.restore()}q=i,r=g}if(w&&m){e=j[j.length-1];var c=v(b.latLng(e.lat,e.lng)),i=c.x,g=c.y;a.save();var I=a.globalCompositeOperation;a.globalCompositeOperation='destination-over',a.beginPath();var k=f(d.size,c,G);a.drawImage(w,i-k,g-k,k*2,k*2),a.closePath(),a.globalCompositeOperation=I,a.restore()}},updateAnim:function(a){if(!this.isInView())return;if(this.life=a=a||this.life||0,this.isEnd())return this.emit('lifeEnd');this.updateFlying()},isEnd:function(){return this.life>=this.lifeMax+(this.options.delay||0)},updateMap:function(a){},initEventsAnim:function(){this.off('lifeEnd').on('lifeEnd',function(){this.pause()}).off('update').on('update',this.updateAnim.bind(this))},genOptions:function(){return a.prototype.options=c.deepMerge(g.prototype.genOptions(),a.prototype.options)}}),a.prototype.genOptions();var i=b.dmap=b.dmap||{};i.TrailCanvas=a,i.trailCanvas=function(b){return new a(b)},module.exports=a | ||
'use strict';function a(c){c=this.options=b.deepMerge(a.options,c),this.id=Math.floor(Math.random()*1e7)+'_'+new Date().getTime(),this.initialize(c)}var c=require('./../leaflet'),b=require('./../core/utils'),i=require('./../render/canvas'),h=b.getColorFunc,e=b.switchValue,d=require('./../core/animator'),f=require('./../core/utils').getSprite;a.options={lengthLimit:15,lifeSpeed:.5,delay:30,isAutoUpdate:!0,lineSegmentLonger:1,spriteW:200,spriteH:20,container:null,isable:!0,isableDraw:!0,type:'line',ptsN:9,weight:function(b,a){return 5*Math.pow(a,3)},pts:function(a){return a.pts},spriteHead:!0,color:h('rgba(0,150,150,0.8)','rgba(0,100,255, 1)','rgb','linear.Out.1'),scale:function(a){return 1},size:function(a,b){return 15},value:function(a,b,c){return Math.min(1,a.length/40)},lng:b.getLng,lat:b.getLat,time:b.getTime},a.options=b.deepMerge(d.options,a.options),a=d.extend(a,{events:{},includes:[c.Mixin.Events],initialize:function(a){this.ctx=a.ctx,a.spriteHead&&(this.spriteHead=a.spriteHead||this.initSpriteFlyingHead()),a.isAutoUpdate&&this.initEventsAnim()},addTo:function(a){if(this._map||!a)return;this._map=a,this._data&&this.updateZoom()},processing:function(){var a=this.pts,b=this.options,q=b.time,p=b.lat,o=b.lng,m,j,i,n=m=q(a[0],0),k=j=o(a[0],0),l=i=p(a[0],0),g,f,e,d;for(var h=0;h<a.length;h++){if(g=a[h],!g)continue;f=p(g),e=o(g),d=q(g,h),d>m&&(m=d),d<n&&(n=d),f>i&&(i=f),f<l&&(l=f),e>j&&(j=e),e<k&&(k=e)}this.lifeMax=b.lifeMax=m,this.lifeMin=b.lifeMin=n;var s=c.latLng(l,k),r=c.latLng(i,j);this.bounds=c.latLngBounds(s,r)},getBBox:function(){return this.bounds},isInView:function(a){a=a||this._map.getBounds();var b=this.bounds,d=b._northEast.lng,e=b._northEast.lat,c=b._southWest.lng,g=b._southWest.lat,h=a._northEast.lng,i=a._northEast.lat,j=a._southWest.lng,f=a._southWest.lat;return!(j<c&&h<c||j>d&&h>d||f<g&&i<g||f>e&&i>e)},data:function(a){if(!a)return this._data;var b=this.options,c=b.pts.bind(b);this._data=a,this.pts=c(a),this.processing(),this.resetVariables(),this.options.isAutoUpdate&&this._map&&this.startAnim()},append:function(a){if(!this._data)return console.log('初始数据没有');this.pts.append(a)},render:function(a){a&&this.data(a),this.startAnim()},updateFlying:function(){var d=this.options;if(!this.options.isable)return;var e=this.life,c=this.pts,f=d.time,g=this.indexLast||0,h,b;for(var a=g;a<c.length;a++){if(b=c[a],!b)continue;if(h=f(b,a),h>e){this.indexLast=a;break}this._addFlyingPt(b)}this._drawFlying()},updateOptions:function(a){a=this.options=b.deepMerge(this.options,a)},resetVariables:function(){this.indexLast=0,this.flyingPts=[],this.enable('flying'),this.life=this.options.lifeMin||this.lifeMin},enable:function(){this.options.isable=!0},disable:function(){this.options.isable=!1},enableDraw:function(){this.options.isableDraw=!0},disableDraw:function(){this.options.isableDraw=!1},_addFlyingPt:function(b){this.curPoint=b;var a=this.options,c=a.ptsN,d=a.lat,e=a.lng;this.flyingPts.push({lat:d(b),lng:e(b)}),this.flyingPts.length>c&&this.flyingPts.splice(0,1)},equalTo:function(a){return this.id===a.id?!0:!1},_drawFlying:function(){var o=this._map,G=o.getZoom(),d=this.options,F=d.lengthLimit,z=d.lineSegmentLonger;if(!(d.isable&&this.options.isableDraw))return;var D=d.spriteFlying,C=d.spriteHead,p=f(D),w=f(C),x=p.width,E=p.height,j=this.flyingPts,v=o.latLngToContainerPoint.bind(o),a=this.ctx,g,t,m=j.length,q,r,A,y,s,n,B=1/m*x*1;for(var l=m-1;l>=0;l--){g=j[l];var b=v(c.latLng(g.lat,g.lng)),i=b.x,h=b.y;if((q||r)&&(t=(l-1)/m,s=i-q,n=h-r,A=Math.atan2(n,s),y=Math.sqrt(s*s+n*n)+z,y<F)){var u=e(d.weight,g,t);a.save(),a.translate(q,r),a.rotate(A);var H=t*x;a.drawImage(p,H,0,B,E,0,-u/2,y,u),a.restore()}q=i,r=h}if(w&&m){g=j[j.length-1];var b=v(c.latLng(g.lat,g.lng)),i=b.x,h=b.y;a.save();var I=a.globalCompositeOperation;a.globalCompositeOperation='destination-over',a.beginPath();var k=e(d.size,b,G);a.drawImage(w,i-k,h-k,k*2,k*2),a.closePath(),a.globalCompositeOperation=I,a.restore()}},updateAnim:function(a){if(!this.isInView())return;if(this.life=a=a||this.life||0,this.isEnd())return this.emit('lifeEnd');this.updateFlying()},isEnd:function(){return this.life>=this.lifeMax+(this.options.delay||0)},updateMap:function(a){},initEventsAnim:function(){this.off('lifeEnd').on('lifeEnd',function(){this.pause()}).off('update').on('update',this.updateAnim.bind(this))},genOptions:function(){return a.prototype.options=b.deepMerge(d.prototype.genOptions(),a.prototype.options)}}),a.prototype.genOptions();var g=c.dmap=c.dmap||{};g.TrailCanvas=a,g.trailCanvas=function(b){return new a(b)},module.exports=a |
@@ -1,1 +0,1 @@ | ||
'use strict';function a(b){b=this.options=c.deepMerge(a.options,b),this.id=Math.floor(Math.random()*1e7)+'_'+new Date().getTime(),this.initialize(b)}var b=require('./../leaflet'),c=require('./../core/utils'),d=require('./../render/canvas'),e=c.getColorFunc,f=require('./../core/animator');a.options={lengthLimit:15,lifeSpeed:.5,delay:30,isAutoUpdate:!0,lineSegmentLonger:1,spriteW:200,spriteH:20,flying:{isable:!0,type:'line',ptsN:9,weight:function(a){return 5*Math.pow(a,3)},spriteHead:null},bgLine:{isable:!1,opacity:1,color:'rgba(105,105,105,1)',weight:5},color:e('rgba(0,150,150,0.8)','rgba(0,100,255, 1)','rgb','linear.Out.1'),scale:function(a){return 1},value:function(a,b,c){return Math.min(1,a.length/40)},lng:c.getLng,lat:c.getLat,time:c.getTime},a.options=c.deepMerge(f.options,a.options),a=f.extend(a,{events:{},includes:[b.Mixin.Events],initialize:function(a){var b=a.flying;b&&(this.spriteFlying=b.sprite||this.initSpriteFlying(),this.ctxFlying=b.ctx,a.flying.isSpriteHead&&(this.spriteFlyingHead=a.flying.spriteHead||this.initSpriteFlyingHead()));var c=a.bgLine;c&&(this.ctxBgLine=c.ctx,this.spriteBgLine=c.sprite||this.initSpriteBgLine()),a.isAutoUpdate&&this.initEventsAnim(),this.isable=!0},addTo:function(a){if(this._map||!a)return;this._map=a,this._data&&this.updateZoom()},processing:function(){var a=this._data,c=this.options,q=c.time,p=c.lat,o=c.lng,m,j,i,n=m=q(a[0],0),k=j=o(a[0],0),l=i=p(a[0],0),g,f,e,d;for(var h=0;h<a.length;h++){if(g=a[h],!g)continue;f=p(g),e=o(g),d=q(g,h),d>m&&(m=d),d<n&&(n=d),f>i&&(i=f),f<l&&(l=f),e>j&&(j=e),e<k&&(k=e)}this.lifeMax=c.lifeMax=m,this.lifeMin=c.lifeMin=n;var s=b.latLng(l,k),r=b.latLng(i,j);this.bounds=b.latLngBounds(s,r)},getBBox:function(){return this.bounds},isInView:function(a){a=a||this._map.getBounds();var b=this.bounds,d=b._northEast.lng,e=b._northEast.lat,c=b._southWest.lng,g=b._southWest.lat,h=a._northEast.lng,i=a._northEast.lat,j=a._southWest.lng,f=a._southWest.lat;return!(j<c&&h<c||j>d&&h>d||f<g&&i<g||f>e&&i>e)},data:function(a){if(!a)return this._data;this._data=a,this.processing(),this.resetVariables(),this.options.isAutoUpdate&&this._map&&this.startAnim()},render:function(a){a&&this.data(a),this.startAnim()},updateFlying:function(){var c=this.options,e=c.flying;if(!(e&&this.isable))return;var f=this.life,d=this._data,g=c.time,h=this.indexLast||0,i,b;for(var a=h;a<d.length;a++){if(b=d[a],!b)continue;if(i=g(b,a),i>f){this.indexLast=a;break}this._addFlyingPt(b)}this._drawFlying()},updateOptions:function(a){a=this.options=c.deepMerge(this.options,a)},resetVariables:function(){this.indexLast=0,this.flyingPts=[],this.enable('flying'),this.life=this.options.lifeMin||this.lifeMin},enable:function(a){(!a||a==='')&&(this.enable('flying'),this.enable('bgLine')),a==='bgLine'&&this.options.bgLine&&(this.options.bgLine.isable=!0),a==='flying'&&this.options.flying&&(this.options.flying.isable=!0)},disable:function(a){(!a||a==='')&&(this.disable('flying'),this.disable('bgLine')),a==='bgLine'&&this.options.bgLine&&(this.options.bgLine.isable=!1),a==='flying'&&this.options.flying&&(this.options.flying.isable=!1)},_addFlyingPt:function(b){var a=this.options,c=a.flying.ptsN,d=a.lat,e=a.lng;this.flyingPts.push({lat:d(b),lng:e(b)}),this.flyingPts.length>c&&this.flyingPts.splice(0,1)},equalTo:function(a){return this.id===a.id?!0:!1},_drawFlying:function(){var m=this.options,D=m.lengthLimit,z=m.lineSegmentLonger,l=m.flying;if(!(l&&l.isable&&this.isable))return;var i=this.spriteFlying,k=this.spriteFlyingHead,v=i.width,C=i.height,u=this.flyingPts,w=this._map.latLngToContainerPoint.bind(this._map),a=this.ctxFlying,s,r,e=u.length,p,h,A,q,o,n,j=l.weight,x=typeof j==='function'?j:function(){return j},y=1/e*v*1;for(var d=e-1;d>=0;d--){s=u[d];var t=w(b.latLng(s.lat,s.lng)),g=t.x,f=t.y;if((p||h)&&(r=(d-1)/e,o=g-p,n=f-h,A=Math.atan2(n,o),q=Math.sqrt(o*o+n*n)+z,q<D)){var c=x(r);a.save(),a.translate(p,h),a.rotate(A);var E=r*v;if(a.drawImage(i,E,0,y,C,0,-c/2,q,c),a.restore(),k&&d>=e-1){var F=k.width;a.save();var B=a.globalCompositeOperation;a.globalCompositeOperation='destination-over',a.beginPath(),console.log('11'),a.drawImage(k,g-c/2,f-c/2,c,c),a.closePath(),a.globalCompositeOperation=B,a.restore()}}p=g,h=f}},initSpriteFlying:function(){var i=this.options.color,a=document.createElement('canvas'),d=this.spriteW=a.width=1e3,e=this.spriteH=a.height=20,b=a.getContext('2d'),f,g=b.createLinearGradient(0,0,d,e),h=300;for(var c=0;c<h;c++)f=c/h,g.addColorStop(f,i(f));return b.fillStyle=g,b.fillRect(0,0,d,e),this.spriteFlying=a,a},initSpriteFlyingHead:function(){var d=this.options.color,a=document.createElement('canvas'),b=a.width=a.height=50,c=a.getContext('2d');return c.fillStyle=d(1),c.arc(b/2,b/2,b,0,Math.PI*2),c.fill(),this.spriteFlyingHead=a,a},initSpriteBgLine:function(){var a=document.createElement('canvas'),c=this.spriteW=a.width=1e3,d=this.spriteH=a.height=20,b=a.getContext('2d');return b.fillStyle=this.options.bgLine.color,b.fillRect(0,0,c,d),this.spriteBgLine=a,a},updateBgLine:function(){this._drawBgLine()},_drawBgLine:function(){var c=this.options,h=c.bgLine;if(!h)return;if(!(this.isable&&h.isable))return;var u=c.lengthLimit,A=c.lineSegmentLonger,a=this.ctxBgLine,n=c.spriteW,v=c.spriteH,x=this.spriteBgLine,y=this._map.latLngToContainerPoint.bind(this._map),p=this._data,f=p.length,m,s,g,e,z,l,i,j,o=h.weight,w=1/f*n*1;for(var d=0;d<f;d++){m=p[d];var q=y(b.latLng(m.lat,m.lng)),r=q.x,k=q.y;if(s=(d-1)/f,(g||e)&&(i=r-g,j=k-e,z=Math.atan2(j,i),l=Math.sqrt(i*i+j*j)+A,u>l)){a.save(),a.translate(g,e),a.rotate(z);var t=s*n;a.drawImage(x,t,0,w,v,0,-o/2,l,o),a.restore()}g=r,e=k}},updateAnim:function(a){if(!this.isInView())return;if(this.life=a=a||this.life||0,this.isEnd())return this.emit('lifeEnd');this.updateFlying()},isEnd:function(){return this.life>=this.lifeMax+(this.options.delay||0)},updateMap:function(a){this.isInView(a)&&this._drawBgLine()},initEventsAnim:function(){this.off('lifeEnd').on('lifeEnd',function(){this.pause()}).off('update').on('update',this.updateAnim.bind(this))},genOptions:function(){return a.prototype.options=c.deepMerge(f.prototype.genOptions(),a.prototype.options)}}),a.prototype.genOptions();var g=b.dmap=b.dmap||{};g.TrailCanvas=a,g.trailCanvas=function(b){return new a(b)},module.exports=a | ||
'use strict';function a(b){b=this.options=c.deepMerge(a.options,b),this.id=Math.floor(Math.random()*1e7)+'_'+new Date().getTime(),this.initialize(b)}var b=require('./../leaflet'),c=require('./../core/utils'),g=require('./../render/canvas'),f=c.getColorFunc,d=require('./../core/animator');a.options={lengthLimit:15,lifeSpeed:.5,delay:30,isAutoUpdate:!0,lineSegmentLonger:1,spriteW:200,spriteH:20,flying:{isable:!0,type:'line',ptsN:9,weight:function(a){return 5*Math.pow(a,3)},spriteHead:null},bgLine:{isable:!1,opacity:1,color:'rgba(105,105,105,1)',weight:5},color:f('rgba(0,150,150,0.8)','rgba(0,100,255, 1)','rgb','linear.Out.1'),scale:function(a){return 1},value:function(a,b,c){return Math.min(1,a.length/40)},lng:c.getLng,lat:c.getLat,time:c.getTime},a.options=c.deepMerge(d.options,a.options),a=d.extend(a,{events:{},includes:[b.Mixin.Events],initialize:function(a){var b=a.flying;b&&(this.spriteFlying=b.sprite||this.initSpriteFlying(),this.ctxFlying=b.ctx,a.flying.isSpriteHead&&(this.spriteFlyingHead=a.flying.spriteHead||this.initSpriteFlyingHead()));var c=a.bgLine;c&&(this.ctxBgLine=c.ctx,this.spriteBgLine=c.sprite||this.initSpriteBgLine()),a.isAutoUpdate&&this.initEventsAnim(),this.isable=!0},addTo:function(a){if(this._map||!a)return;this._map=a,this._data&&this.updateZoom()},processing:function(){var a=this._data,c=this.options,q=c.time,p=c.lat,o=c.lng,m,j,i,n=m=q(a[0],0),k=j=o(a[0],0),l=i=p(a[0],0),g,f,e,d;for(var h=0;h<a.length;h++){if(g=a[h],!g)continue;f=p(g),e=o(g),d=q(g,h),d>m&&(m=d),d<n&&(n=d),f>i&&(i=f),f<l&&(l=f),e>j&&(j=e),e<k&&(k=e)}this.lifeMax=c.lifeMax=m,this.lifeMin=c.lifeMin=n;var s=b.latLng(l,k),r=b.latLng(i,j);this.bounds=b.latLngBounds(s,r)},getBBox:function(){return this.bounds},isInView:function(a){a=a||this._map.getBounds();var b=this.bounds,d=b._northEast.lng,e=b._northEast.lat,c=b._southWest.lng,g=b._southWest.lat,h=a._northEast.lng,i=a._northEast.lat,j=a._southWest.lng,f=a._southWest.lat;return!(j<c&&h<c||j>d&&h>d||f<g&&i<g||f>e&&i>e)},data:function(a){if(!a)return this._data;this._data=a,this.processing(),this.resetVariables(),this.options.isAutoUpdate&&this._map&&this.startAnim()},render:function(a){a&&this.data(a),this.startAnim()},updateFlying:function(){var c=this.options,e=c.flying;if(!(e&&this.isable))return;var f=this.life,d=this._data,g=c.time,h=this.indexLast||0,i,b;for(var a=h;a<d.length;a++){if(b=d[a],!b)continue;if(i=g(b,a),i>f){this.indexLast=a;break}this._addFlyingPt(b)}this._drawFlying()},updateOptions:function(a){a=this.options=c.deepMerge(this.options,a)},resetVariables:function(){this.indexLast=0,this.flyingPts=[],this.enable('flying'),this.life=this.options.lifeMin||this.lifeMin},enable:function(a){(!a||a==='')&&(this.enable('flying'),this.enable('bgLine')),a==='bgLine'&&this.options.bgLine&&(this.options.bgLine.isable=!0),a==='flying'&&this.options.flying&&(this.options.flying.isable=!0)},disable:function(a){(!a||a==='')&&(this.disable('flying'),this.disable('bgLine')),a==='bgLine'&&this.options.bgLine&&(this.options.bgLine.isable=!1),a==='flying'&&this.options.flying&&(this.options.flying.isable=!1)},_addFlyingPt:function(b){var a=this.options,c=a.flying.ptsN,d=a.lat,e=a.lng;this.flyingPts.push({lat:d(b),lng:e(b)}),this.flyingPts.length>c&&this.flyingPts.splice(0,1)},equalTo:function(a){return this.id===a.id?!0:!1},_drawFlying:function(){var m=this.options,D=m.lengthLimit,z=m.lineSegmentLonger,l=m.flying;if(!(l&&l.isable&&this.isable))return;var i=this.spriteFlying,k=this.spriteFlyingHead,v=i.width,C=i.height,u=this.flyingPts,w=this._map.latLngToContainerPoint.bind(this._map),a=this.ctxFlying,s,r,e=u.length,p,h,A,q,o,n,j=l.weight,x=typeof j==='function'?j:function(){return j},y=1/e*v*1;for(var d=e-1;d>=0;d--){s=u[d];var t=w(b.latLng(s.lat,s.lng)),g=t.x,f=t.y;if((p||h)&&(r=(d-1)/e,o=g-p,n=f-h,A=Math.atan2(n,o),q=Math.sqrt(o*o+n*n)+z,q<D)){var c=x(r);a.save(),a.translate(p,h),a.rotate(A);var E=r*v;if(a.drawImage(i,E,0,y,C,0,-c/2,q,c),a.restore(),k&&d>=e-1){var F=k.width;a.save();var B=a.globalCompositeOperation;a.globalCompositeOperation='destination-over',a.beginPath(),console.log('11'),a.drawImage(k,g-c/2,f-c/2,c,c),a.closePath(),a.globalCompositeOperation=B,a.restore()}}p=g,h=f}},initSpriteFlying:function(){var i=this.options.color,a=document.createElement('canvas'),d=this.spriteW=a.width=1e3,e=this.spriteH=a.height=20,b=a.getContext('2d'),f,g=b.createLinearGradient(0,0,d,e),h=300;for(var c=0;c<h;c++)f=c/h,g.addColorStop(f,i(f));return b.fillStyle=g,b.fillRect(0,0,d,e),this.spriteFlying=a,a},initSpriteFlyingHead:function(){var d=this.options.color,a=document.createElement('canvas'),b=a.width=a.height=50,c=a.getContext('2d');return c.fillStyle=d(1),c.arc(b/2,b/2,b,0,Math.PI*2),c.fill(),this.spriteFlyingHead=a,a},initSpriteBgLine:function(){var a=document.createElement('canvas'),c=this.spriteW=a.width=1e3,d=this.spriteH=a.height=20,b=a.getContext('2d');return b.fillStyle=this.options.bgLine.color,b.fillRect(0,0,c,d),this.spriteBgLine=a,a},updateBgLine:function(){this._drawBgLine()},_drawBgLine:function(){var c=this.options,h=c.bgLine;if(!h)return;if(!(this.isable&&h.isable))return;var u=c.lengthLimit,A=c.lineSegmentLonger,a=this.ctxBgLine,n=c.spriteW,v=c.spriteH,x=this.spriteBgLine,y=this._map.latLngToContainerPoint.bind(this._map),p=this._data,f=p.length,m,s,g,e,z,l,i,j,o=h.weight,w=1/f*n*1;for(var d=0;d<f;d++){m=p[d];var q=y(b.latLng(m.lat,m.lng)),r=q.x,k=q.y;if(s=(d-1)/f,(g||e)&&(i=r-g,j=k-e,z=Math.atan2(j,i),l=Math.sqrt(i*i+j*j)+A,u>l)){a.save(),a.translate(g,e),a.rotate(z);var t=s*n;a.drawImage(x,t,0,w,v,0,-o/2,l,o),a.restore()}g=r,e=k}},updateAnim:function(a){if(!this.isInView())return;if(this.life=a=a||this.life||0,this.isEnd())return this.emit('lifeEnd');this.updateFlying()},isEnd:function(){return this.life>=this.lifeMax+(this.options.delay||0)},updateMap:function(a){this.isInView(a)&&this._drawBgLine()},initEventsAnim:function(){this.off('lifeEnd').on('lifeEnd',function(){this.pause()}).off('update').on('update',this.updateAnim.bind(this))},genOptions:function(){return a.prototype.options=c.deepMerge(d.prototype.genOptions(),a.prototype.options)}}),a.prototype.genOptions();var e=b.dmap=b.dmap||{};e.TrailCanvas=a,e.trailCanvas=function(b){return new a(b)},module.exports=a |
@@ -1,1 +0,1 @@ | ||
'use strict';function a(b){b=this.options=c.deepMerge(a.options,b),this.initialize(b)}var b=require('./../leaflet'),c=require('./../core/utils'),d=require('./../render/canvas'),e=require('./../core/animator'),f=require('./trail_canvas_flying');a.options={lineN:1e3,lifeSpeed:1,isAutoUpdate:!0,type:'flying',isable:!0,container:'#canvas',id:function(a){return a.id},id:c.getID,lifeMin:0,lifeMax:1e11,child:{spriteFlying:{type:'linear',isContinue:!0,width:200,height:20,color:{from:'rgba(233,0,0,0.3)',to:'#f2f7b8',space:'hsl',easing:'linear.Out.3'}},spriteHead:{type:'radian',isContinue:!1,width:100,height:100,color:{to:'rgba(255,150,0,0.4)',from:'rgba(255,150,0,0.4)',space:'hsl',easing:'linear.Out.1'}},size:function(a,b){return 6},delay:2,lengthLimit:60,lineSegmentLonger:0,isAutoUpdate:!1,isable:!0,blending:'lighter',type:'line',ptsN:25,weight:function(b,a){return 5*Math.pow(a,3)},value:function(a,b,c){return Math.min(1,a.length/40)},lng:c.getLng,lat:c.getLat,time:c.getTime,pts:function(a){return a.pts}}};var a=e.extend(a,{events:{},initialize:function(a){this.isable=!0,this.lifeMax=a.lifeMax,this.lifeMin=a.lifeMin,this.life=this.lifeMin,a.isAutoUpdate&&this.initEventsAnim()},initCanvas:function(){var a=this.options,b=a.child,e=b.blending||a.blending;this.lcanvas=new d(this._map,a.container,{clearAlpha:1});var c=this.ctx=this.lcanvas.ctx;c.globalCompositeOperation=e,b.ctx=c},addTo:function(a){if(this._map||!a)return;this._map=a,this.initCanvas(),this.initTrails(),this.initEventsMap(),this._data&&this.updateZoom()},clear:function(){var b=this.using,a=this.unusing,d;for(var e in b)d=b[e],d.reset();this.using={},a=[];var c=this.trails;for(var f in c)a.push(c[f]);this.unusing=a},reset:function(){var c=this.unusing=[];this.using={};var a=this.trails;for(var d in a){var b=a[d];b.stop&&b.stop(),b.pause&&b.pause(),b.resetVariables()}this.life=this.options.lifeMin;var a=this.trails;for(var e in a)c.push(a[e]);this.resume()},initCacheColor:function(){},mergeData:function(e){var f=this.options,g=f.id.bind(f),a=e.d,b,c=this._data=this._data||{};for(var d=0;d<e.length;d++)a=e[d],b=g(a),c[b]?c[b].pts.push(a):c[b]={pts:[a],id:b};this.resetOrUpdateTrails(),this.options.isAutoUpdate&&this._map&&!this.loopid&&this.startAnim()},data:function(c){if(!c)return this._data;var b=this.unusing,d=this.using;if(!(b&&b.length))return;var a=b.pop(),e=this.options,f=e.child.pts,g=f(c);a.updateOptions({lifeMin:0,lifeMax:g.length}),a.data(c),d[a.id]=a,this.options.isAutoUpdate&&this._map&&!this.loopid&&this.startAnim()},resetOrUpdateTrails:function(){var c=this._data,d=this.using,h=this.unusing,e=this.options,i=e.child.pts.bind(e.child),f,a,g;for(var b in c)f=c[b],a=d[b],g=i(f),a?a.processing():(a=h.pop(),g&&g.length>3&&(a.data(f),a.id=b,d[b]=a))},datas:function(a){if(!a)return this._data;this._data=a;for(var b in a)this.data(a[b])},initTrails:function(){var a=this.options,b=a.child;b.lifeSpeed=a.lifeSpeed,b.isable=a.isable,b.container=a.container,this.using={};var e=this.unusing=[],g=this._map,h=this.trails=[],i=a.lineN,c;for(var d=0;d<i;d++)c=new f(b),c.addTo(g),this.initEventsTrail(c),h.push(c),e.push(c)},each:function(c){var a=this.using;for(var b in a)c(a[b],b)},checkTrail:function(b){if(!b.isEnd())return;var a=this.using,c=!1;for(var d in a)if(a[d].equalTo(b)){c=!0,delete a[d];break}c&&this.unusing.push(b)},initEventsTrail:function(a){var b=this;a.on('lifeEnd',function(c){b.emit('flying-end',a._data)})},updateOptions:function(a){a=this.options=c.deepMerge(this.options,a,!0);var b=a.child;b.lifeSpeed=a.lifeSpeed;var d=this.trails;this.each(function(a,c){a.updateOptions(b)})},render:function(b,a){a=a||'group',a==='group'?this.datas(b):a==='flatten'&&this.mergeData(b)},updateAnim:function(a){if(!this.isable)return;if(this.iii=this.iii||0,this.lcanvas.clear(),a=a||this.life,a+=this.options.lifeSpeed,a>this.options.lifeMax)return this.life=this.options.lifeMax,this.disable();var c=this.using;for(var d in c){var b=c[d];b.life=a,b.updateAnim(a),this.checkTrail(b)}},updateMap:function(){if(!this.isable)return;var a=this.ctx;a&&a.clearRect(0,0,a.canvas.width,a.canvas.height);var d=this._map.getBounds(),b=this.using;for(var e in b){var c=b[e];c&&c.updateMap(d)}},clean:function(){var a=this.ctx;a&&a.clearRect(0,0,a.canvas.width,a.canvas.height)},enable:function(){this.isable=!0,this.resume(),this.updateMap()},disable:function(){this.clean(),this.pause(),this.isable=!1},initEventsMap:function(){var a=this;this._map.on('movestart',function(){}).on('moveend',function(){a.updateMap()}.bind(this))},select:function(d){var a,e,c=this.trails;this.clean();for(var b=0;b<c.length;b++)a=c[b],e=a.id,d&&e in d?(a.enable(),a.updateBgLine()):a.disable()},hide:function(a){this.each(function(b,c){a(b,b._data)&&b.hide()})},unselect:function(){var b,c=this.trails;this.clean();for(var a=0;a<c.length;a++)b=c[a],b&&b.enable()},initEventsAnim:function(){this.on('update',function(a){this.updateAnim(a)})}}),g=b.dmap=b.dmap||{};g.TrailsCanvas=a,g.trailsCanvas=function(b){return new a(b)},module.exports=a | ||
'use strict';function a(c){c=this.options=b.deepMerge(a.options,c),this.initialize(c)}var c=require('./../leaflet'),b=require('./../core/utils'),e=require('./../render/canvas'),f=require('./../core/animator'),g=require('./trail_canvas_flying');a.options={lineN:1e3,lifeSpeed:1,isAutoUpdate:!0,type:'flying',isable:!0,container:'#canvas',id:function(a){return a.id},id:b.getID,lifeMin:0,lifeMax:1e11,child:{spriteFlying:{type:'linear',isContinue:!0,width:200,height:20,color:{from:'rgba(233,0,0,0.3)',to:'#f2f7b8',space:'hsl',easing:'linear.Out.3'}},spriteHead:{type:'radian',isContinue:!1,width:100,height:100,color:{to:'rgba(255,150,0,0.4)',from:'rgba(255,150,0,0.4)',space:'hsl',easing:'linear.Out.1'}},size:function(a,b){return 6},delay:2,lengthLimit:60,lineSegmentLonger:0,isAutoUpdate:!1,isable:!0,blending:'lighter',type:'line',ptsN:25,weight:function(b,a){return 5*Math.pow(a,3)},value:function(a,b,c){return Math.min(1,a.length/40)},lng:b.getLng,lat:b.getLat,time:b.getTime,pts:function(a){return a.pts}}};var a=f.extend(a,{events:{},initialize:function(a){this.isable=!0,this.lifeMax=a.lifeMax,this.lifeMin=a.lifeMin,this.life=this.lifeMin,a.isAutoUpdate&&this.initEventsAnim()},initCanvas:function(){var a=this.options,b=a.child,d=b.blending||a.blending;this.lcanvas=new e(this._map,a.container,{clearAlpha:1});var c=this.ctx=this.lcanvas.ctx;c.globalCompositeOperation=d,b.ctx=c},addTo:function(a){if(this._map||!a)return;this._map=a,this.initCanvas(),this.initTrails(),this.initEventsMap(),this._data&&this.updateZoom()},clear:function(){var b=this.using,a=this.unusing,d;for(var e in b)d=b[e],d.reset();this.using={},a=[];var c=this.trails;for(var f in c)a.push(c[f]);this.unusing=a},reset:function(){var c=this.unusing=[];this.using={};var a=this.trails;for(var d in a){var b=a[d];b.stop&&b.stop(),b.pause&&b.pause(),b.resetVariables()}this.life=this.options.lifeMin;var a=this.trails;for(var e in a)c.push(a[e]);this.resume()},initCacheColor:function(){},mergeData:function(e){var f=this.options,g=f.id.bind(f),a=e.d,b,c=this._data=this._data||{};for(var d=0;d<e.length;d++)a=e[d],b=g(a),c[b]?c[b].pts.push(a):c[b]={pts:[a],id:b};this.resetOrUpdateTrails(),this.options.isAutoUpdate&&this._map&&!this.loopid&&this.startAnim()},data:function(c){if(!c)return this._data;var b=this.unusing,d=this.using;if(!(b&&b.length))return;var a=b.pop(),e=this.options,f=e.child.pts,g=f(c);a.updateOptions({lifeMin:0,lifeMax:g.length}),a.data(c),d[a.id]=a,this.options.isAutoUpdate&&this._map&&!this.loopid&&this.startAnim()},resetOrUpdateTrails:function(){var c=this._data,d=this.using,h=this.unusing,e=this.options,i=e.child.pts.bind(e.child),f,a,g;for(var b in c)f=c[b],a=d[b],g=i(f),a?a.processing():(a=h.pop(),g&&g.length>3&&(a.data(f),a.id=b,d[b]=a))},datas:function(a){if(!a)return this._data;this._data=a;for(var b in a)this.data(a[b])},initTrails:function(){var a=this.options,b=a.child;b.lifeSpeed=a.lifeSpeed,b.isable=a.isable,b.container=a.container,this.using={};var e=this.unusing=[],f=this._map,h=this.trails=[],i=a.lineN,c;for(var d=0;d<i;d++)c=new g(b),c.addTo(f),this.initEventsTrail(c),h.push(c),e.push(c)},each:function(c){var a=this.using;for(var b in a)c(a[b],b)},checkTrail:function(b){if(!b.isEnd())return;var a=this.using,c=!1;for(var d in a)if(a[d].equalTo(b)){c=!0,delete a[d];break}c&&this.unusing.push(b)},initEventsTrail:function(a){var b=this;a.on('lifeEnd',function(c){b.emit('flying-end',a._data)})},updateOptions:function(a){a=this.options=b.deepMerge(this.options,a,!0);var c=a.child;c.lifeSpeed=a.lifeSpeed;var d=this.trails;this.each(function(a,b){a.updateOptions(c)})},render:function(b,a){a=a||'group',a==='group'?this.datas(b):a==='flatten'&&this.mergeData(b)},updateAnim:function(a){if(!this.isable)return;if(this.iii=this.iii||0,this.lcanvas.clear(),a=a||this.life,a+=this.options.lifeSpeed,a>this.options.lifeMax)return this.life=this.options.lifeMax,this.disable();var c=this.using;for(var d in c){var b=c[d];b.life=a,b.updateAnim(a),this.checkTrail(b)}},updateMap:function(){if(!this.isable)return;var a=this.ctx;a&&a.clearRect(0,0,a.canvas.width,a.canvas.height);var d=this._map.getBounds(),b=this.using;for(var e in b){var c=b[e];c&&c.updateMap(d)}},clean:function(){var a=this.ctx;a&&a.clearRect(0,0,a.canvas.width,a.canvas.height)},enable:function(){this.isable=!0,this.resume(),this.updateMap()},disable:function(){this.clean(),this.pause(),this.isable=!1},initEventsMap:function(){var a=this;this._map.on('movestart',function(){}).on('moveend',function(){a.updateMap()}.bind(this))},select:function(d){var a,e,c=this.trails;this.clean();for(var b=0;b<c.length;b++)a=c[b],e=a.id,d&&e in d?(a.enable(),a.updateBgLine()):a.disable()},hide:function(a){this.each(function(b,c){a(b,b._data)&&b.hide()})},unselect:function(){var b,c=this.trails;this.clean();for(var a=0;a<c.length;a++)b=c[a],b&&b.enable()},initEventsAnim:function(){this.on('update',function(a){this.updateAnim(a)})}}),d=c.dmap=c.dmap||{};d.TrailsCanvas=a,d.trailsCanvas=function(b){return new a(b)},module.exports=a |
@@ -1,1 +0,1 @@ | ||
'use strict';function a(b){b=this.options=c.deepMerge(a.options,b),this.initialize(b)}var b=require('./../leaflet'),c=require('./../core/utils'),d=require('./../render/canvas'),e=require('./../core/animator'),f=require('./trail_canvas_bg');a.options={lineN:1e3,lifeSpeed:1,isAutoUpdate:!0,type:'flying',isable:!0,container:'#canvas',id:function(a){return a.id},id:c.getID,lifeMin:0,lifeMax:1e11,child:{spriteFlying:{type:'linear',isContinue:!0,width:200,height:20,color:{from:'rgba(233,0,0,0.3)',to:'#f2f7b8',space:'hsl',easing:'linear.Out.3'}},spriteHead:{type:'radian',isContinue:!1,width:100,height:100,color:{to:'rgba(255,150,0,0.4)',from:'rgba(255,150,0,0.4)',space:'hsl',easing:'linear.Out.1'}},size:function(a,b){return 6},delay:2,lengthLimit:60,lineSegmentLonger:0,isAutoUpdate:!1,isable:!0,blending:'lighter',type:'line',ptsN:25,weight:function(b,a){return 5*Math.pow(a,3)},value:function(a,b,c){return Math.min(1,a.length/40)},lng:c.getLng,lat:c.getLat,time:c.getTime,pts:function(a){return a.pts}}};var g=e.extend(g,{events:{},initialize:function(a){this.isable=!0,this.lifeMax=a.lifeMax,this.lifeMin=a.lifeMin,this.life=this.lifeMin,a.isAutoUpdate&&this.initEventsAnim()},initCanvas:function(){var a=this.options,b=a.child,e=b.blending||a.blending;this.lcanvas=new d(this._map,a.container,{clearAlpha:1});var c=this.ctx=this.lcanvas.ctx;c.globalCompositeOperation=e,b.ctx=c},addTo:function(a){if(this._map||!a)return;this._map=a,this.initCanvas(),this.initTrails(),this.initEventsMap(),this._data&&this.updateZoom()},clear:function(){var b=this.using,a=this.unusing,d;for(var e in b)d=b[e],d.reset();this.using={},a=[];var c=this.trails;for(var f in c)a.push(c[f]);this.unusing=a},reset:function(){var c=this.unusing=[];this.using={};var a=this.trails;for(var d in a){var b=a[d];b.stop&&b.stop(),b.pause&&b.pause(),b.resetVariables()}this.life=this.options.lifeMin;var a=this.trails;for(var e in a)c.push(a[e]);this.resume()},initCacheColor:function(){},mergeData:function(e){var f=this.options,g=f.id.bind(f),a=e.d,b,c=this._data=this._data||{};for(var d=0;d<e.length;d++)a=e[d],b=g(a),c[b]?c[b].pts.push(a):c[b]={pts:[a],id:b};this.resetOrUpdateTrails(),this.options.isAutoUpdate&&this._map&&!this.loopid&&this.startAnim()},data:function(d){if(!d)return this._data;var b=this.unusing,e=this.using;if(!(b&&b.length))return;var a=b.pop(),f=this.options,g=f.child.pts,c=g(d);a.updateOptions({lifeMin:0,lifeMax:c.length}),a.data(c),e[a.id]=a,this.options.isAutoUpdate&&this._map&&!this.loopid&&this.startAnim()},resetOrUpdateTrails:function(){var c=this._data,d=this.using,h=this.unusing,e=this.options,i=e.child.pts.bind(e.child),f,a,g;for(var b in c)f=c[b],a=d[b],g=i(f),a?a.processing():(a=h.pop(),g&&g.length>3&&(a.data(f),a.id=b,d[b]=a))},datas:function(a){if(!a)return this._data;for(var b in a)this.data(a[b])},initTrails:function(){var a=this.options,b=a.child;b.lifeSpeed=a.lifeSpeed,b.isable=a.isable,b.container=a.container,this.using={};var e=this.unusing=[],g=this._map,h=this.trails=[],i=a.lineN,c;for(var d=0;d<i;d++)c=new f(b),c.addTo(g),this.initEventsTrail(c),h.push(c),e.push(c)},each:function(c){var a=this.using;for(var b in a)c(a[b],b)},checkTrail:function(b){if(!b.isEnd())return;var a=this.using,c=!1;for(var d in a)if(a[d].equalTo(b)){c=!0,delete a[d];break}c&&this.unusing.push(b)},initEventsTrail:function(a){var b=this;a.on('lifeEnd',function(c){b.emit('flying-end',a._data)})},updateOptions:function(a){a=this.options=c.deepMerge(this.options,a,!0);var b=a.child;b.lifeSpeed=a.lifeSpeed;var d=this.trails;this.each(function(a,c){a.updateOptions(b)})},render:function(b,a){a=a||'group',a==='group'?this.datas(b):a==='flatten'&&this.mergeData(b)},updateAnim:function(a){if(!this.isable)return;if(this.iii=this.iii||0,this.lcanvas.clear(),a=a||this.life,a+=this.options.lifeSpeed,a>this.options.lifeMax)return this.life=this.options.lifeMax,this.disable();var c=this.using;for(var d in c){var b=c[d];b.life=a,b.updateAnim(a),this.checkTrail(b)}},updateMap:function(){if(!this.isable)return;var a=this.ctx;a&&a.clearRect(0,0,a.canvas.width,a.canvas.height);var d=this._map.getBounds(),b=this.using;for(var e in b){var c=b[e];c&&c.updateMap(d)}},clean:function(){var a=this.ctx;a&&a.clearRect(0,0,a.canvas.width,a.canvas.height)},enable:function(){this.isable=!0,this.resume(),this.updateMap()},disable:function(){this.clean(),this.pause(),this.isable=!1},initEventsMap:function(){var a=this;this._map.on('movestart',function(){}).on('moveend',function(){a.updateMap()}.bind(this))},select:function(d){var a,e,c=this.trails;this.clean();for(var b=0;b<c.length;b++)a=c[b],e=a.id,d&&e in d?(a.enable(),a.updateBgLine()):a.disable()},hide:function(a){this.each(function(b,c){a(b,b._data)&&a.hide()})},unselect:function(){var b,c=this.trails;this.clean();for(var a=0;a<c.length;a++)b=c[a],b&&b.enable()}}),h=b.dmap=b.dmap||{};h.TrailsCanvasStatic=a,h.trailsCanvasStatic=function(b){return new a(b)},module.exports=a | ||
'use strict';function b(c){c=this.options=a.deepMerge(b.options,c),this.initialize(c)}var c=require('./../leaflet'),a=require('./../core/utils'),e=require('./../render/canvas'),f=require('./../core/animator'),g=require('./trail_canvas_bg');b.options={lineN:1e3,lifeSpeed:1,isAutoUpdate:!0,type:'flying',isable:!0,container:'#canvas',id:function(a){return a.id},id:a.getID,lifeMin:0,lifeMax:1e11,child:{spriteFlying:{type:'linear',isContinue:!0,width:200,height:20,color:{from:'rgba(233,0,0,0.3)',to:'#f2f7b8',space:'hsl',easing:'linear.Out.3'}},spriteHead:{type:'radian',isContinue:!1,width:100,height:100,color:{to:'rgba(255,150,0,0.4)',from:'rgba(255,150,0,0.4)',space:'hsl',easing:'linear.Out.1'}},size:function(a,b){return 6},delay:2,lengthLimit:60,lineSegmentLonger:0,isAutoUpdate:!1,isable:!0,blending:'lighter',type:'line',ptsN:25,weight:function(b,a){return 5*Math.pow(a,3)},value:function(a,b,c){return Math.min(1,a.length/40)},lng:a.getLng,lat:a.getLat,time:a.getTime,pts:function(a){return a.pts}}};var h=f.extend(h,{events:{},initialize:function(a){this.isable=!0,this.lifeMax=a.lifeMax,this.lifeMin=a.lifeMin,this.life=this.lifeMin,a.isAutoUpdate&&this.initEventsAnim()},initCanvas:function(){var a=this.options,b=a.child,d=b.blending||a.blending;this.lcanvas=new e(this._map,a.container,{clearAlpha:1});var c=this.ctx=this.lcanvas.ctx;c.globalCompositeOperation=d,b.ctx=c},addTo:function(a){if(this._map||!a)return;this._map=a,this.initCanvas(),this.initTrails(),this.initEventsMap(),this._data&&this.updateZoom()},clear:function(){var b=this.using,a=this.unusing,d;for(var e in b)d=b[e],d.reset();this.using={},a=[];var c=this.trails;for(var f in c)a.push(c[f]);this.unusing=a},reset:function(){var c=this.unusing=[];this.using={};var a=this.trails;for(var d in a){var b=a[d];b.stop&&b.stop(),b.pause&&b.pause(),b.resetVariables()}this.life=this.options.lifeMin;var a=this.trails;for(var e in a)c.push(a[e]);this.resume()},initCacheColor:function(){},mergeData:function(e){var f=this.options,g=f.id.bind(f),a=e.d,b,c=this._data=this._data||{};for(var d=0;d<e.length;d++)a=e[d],b=g(a),c[b]?c[b].pts.push(a):c[b]={pts:[a],id:b};this.resetOrUpdateTrails(),this.options.isAutoUpdate&&this._map&&!this.loopid&&this.startAnim()},data:function(d){if(!d)return this._data;var b=this.unusing,e=this.using;if(!(b&&b.length))return;var a=b.pop(),f=this.options,g=f.child.pts,c=g(d);a.updateOptions({lifeMin:0,lifeMax:c.length}),a.data(c),e[a.id]=a,this.options.isAutoUpdate&&this._map&&!this.loopid&&this.startAnim()},resetOrUpdateTrails:function(){var c=this._data,d=this.using,h=this.unusing,e=this.options,i=e.child.pts.bind(e.child),f,a,g;for(var b in c)f=c[b],a=d[b],g=i(f),a?a.processing():(a=h.pop(),g&&g.length>3&&(a.data(f),a.id=b,d[b]=a))},datas:function(a){if(!a)return this._data;for(var b in a)this.data(a[b])},initTrails:function(){var a=this.options,b=a.child;b.lifeSpeed=a.lifeSpeed,b.isable=a.isable,b.container=a.container,this.using={};var e=this.unusing=[],f=this._map,h=this.trails=[],i=a.lineN,c;for(var d=0;d<i;d++)c=new g(b),c.addTo(f),this.initEventsTrail(c),h.push(c),e.push(c)},each:function(c){var a=this.using;for(var b in a)c(a[b],b)},checkTrail:function(b){if(!b.isEnd())return;var a=this.using,c=!1;for(var d in a)if(a[d].equalTo(b)){c=!0,delete a[d];break}c&&this.unusing.push(b)},initEventsTrail:function(a){var b=this;a.on('lifeEnd',function(c){b.emit('flying-end',a._data)})},updateOptions:function(b){b=this.options=a.deepMerge(this.options,b,!0);var c=b.child;c.lifeSpeed=b.lifeSpeed;var d=this.trails;this.each(function(a,b){a.updateOptions(c)})},render:function(b,a){a=a||'group',a==='group'?this.datas(b):a==='flatten'&&this.mergeData(b)},updateAnim:function(a){if(!this.isable)return;if(this.iii=this.iii||0,this.lcanvas.clear(),a=a||this.life,a+=this.options.lifeSpeed,a>this.options.lifeMax)return this.life=this.options.lifeMax,this.disable();var c=this.using;for(var d in c){var b=c[d];b.life=a,b.updateAnim(a),this.checkTrail(b)}},updateMap:function(){if(!this.isable)return;var a=this.ctx;a&&a.clearRect(0,0,a.canvas.width,a.canvas.height);var d=this._map.getBounds(),b=this.using;for(var e in b){var c=b[e];c&&c.updateMap(d)}},clean:function(){var a=this.ctx;a&&a.clearRect(0,0,a.canvas.width,a.canvas.height)},enable:function(){this.isable=!0,this.resume(),this.updateMap()},disable:function(){this.clean(),this.pause(),this.isable=!1},initEventsMap:function(){var a=this;this._map.on('movestart',function(){}).on('moveend',function(){a.updateMap()}.bind(this))},select:function(d){var a,e,c=this.trails;this.clean();for(var b=0;b<c.length;b++)a=c[b],e=a.id,d&&e in d?(a.enable(),a.updateBgLine()):a.disable()},hide:function(a){this.each(function(b,c){a(b,b._data)&&a.hide()})},unselect:function(){var b,c=this.trails;this.clean();for(var a=0;a<c.length;a++)b=c[a],b&&b.enable()}}),d=c.dmap=c.dmap||{};d.TrailsCanvasStatic=b,d.trailsCanvasStatic=function(a){return new b(a)},module.exports=b |
@@ -1,1 +0,1 @@ | ||
'use strict';function a(b){b=this.options=c.deepMerge(a.options,b),this.initialize(b)}var b=require('./../leaflet'),c=require('./../core/utils'),d=require('./../render/canvas'),e=c.getColorFunc,f=require('./../core/animator'),g=require('./trail_canvas');a.options={lineN:1e3,lifeSpeed:1,isAutoUpdate:!0,trail:{delay:2,lifeSpeed:1.5,lengthLimit:60,lineSegmentLonger:0,isAutoUpdate:!1,spriteW:200,spriteH:20,flying:{container:'#canvas',isable:!0,blending:'lighter',type:'line',ptsN:25,weight:function(a){return 5*Math.pow(a,3)},isSpriteHead:!0},color:e('rgba(150,0,0,0.3)','rgba(250,150,0, 1)','rgb','linear.Out.2'),value:function(a,b,c){return Math.min(1,a.length/40)},lng:c.getLng,lat:c.getLat,time:c.getTime},pts:function(a){return a.p},id:c.getID,lifeMin:0,lifeMax:1e11};var a=f.extend(a,{events:{},initialize:function(a){this.isable=!0;var b=a.trail;this.lifeMax=a.lifeMax,this.lifeMin=a.lifeMin,this.life=this.lifeMin,this.initSpriteFlying(),b.flying&&this.initSpriteFlyingHead(),a.isAutoUpdate&&this.initEventsAnim()},initCanvas:function(){var g=this.options,e=g.trail,a=e.bgLine;if(a){var h=a.opacity,i=a.blending;this.lcanvasBg=new d(this._map,a.container,{clearAlpha:.9});var c=this.ctxBg=this.lcanvasBg.ctx;c.globalAlpha=h,c.globalCompositeOperation=i,a.ctx=c}var b=e.flying;if(b){var j=b.blending;this.lcanvas=new d(this._map,b.container,{clearAlpha:1});var f=this.ctxFlying=this.lcanvas.ctx;f.globalCompositeOperation=j,b.ctx=f}},addTo:function(a){if(this._map||!a)return;this._map=a,this.initCanvas(),this.initTrails(),this.initEventsMap(),this._data&&this.updateZoom()},clear:function(){var b=this.using,a=this.unusing,e;for(var f in b)e=b[f],e.reset();this.using=[],a=[];var c=this.trails;for(var d in c)a[d]=c[d];this.unusing=a},reset:function(){var e=this.unusing=[];this.using=[];var a=this.trails;for(var c=0;c<a.length;c++){var b=a[c];b.stop&&b.stop(),b.pause&&b.pause(),b.resetVariables()}this.life=this.options.lifeMin,this.using=[];var a=this.trails;for(var d=0;d<a.length;d++)e.push(a[d]);this.resume()},initCacheColor:function(){},data:function(d){if(!d)return this._data;var a=this.unusing,e=this.using;if(!(a&&a.length))return;var b=a.pop(),f=this.options,g=f.pts,c=g(d);b.updateOptions({lifeMin:0,lifeMax:c.length}),b.data(c),e.push(b),this.options.isAutoUpdate&&this._map&&!this.loopid&&this.startAnim()},datas:function(a){if(!a)return this._data;for(var b in a)this.data(a[b])},initTrails:function(){var b=this.options,d=b.trail,j=this.using=[],e=this.unusing=[],f=this._map,h=this.trails=[],i=b.lineN,a;for(var c=0;c<i;c++)a=new g(d),a.addTo(f),this.initEventsTrail(a),h.push(a),e.push(a)},checkTrail:function(b){if(!b.isEnd())return;var a=this.using,c=!1;for(var d in a)if(a[d].equalTo(b)){c=!0,a.splice(d,1);break}c&&this.unusing.push(b)},initEventsTrail:function(a){var b=this;a.on('lifeEnd',function(c){b.emit('flying-end',a._data)})},updateOptions:function(){var b=this.options,c,a=this.trails;for(var d in a)c=a[d],c.updateOptions(b)},render:function(){},updateAnim:function(a){if(!this.isable)return;this.iii=this.iii||0;var f=this.ctxFlying;this.lcanvas.clear(),a=a||this.life;var d=this.using,e=this.options.trail;for(var b=d.length-1;b>=0;b--){var c=d[b];a=c.life+e.lifeSpeed,c.updateAnim(a),this.checkTrail(c)}},updateMap:function(){if(!this.isable)return;var a=this.ctxBg;a&&a.clearRect(0,0,a.canvas.width,a.canvas.height);var b=this.ctxFlying;b&&b.clearRect(0,0,b.canvas.width,b.canvas.height);var f=this._map.getBounds(),d=this.using;for(var c=0;c<d.length;c++){var e=d[c];e&&e.updateMap(f)}},clean:function(){var a=this.ctxBg;a&&a.clearRect(0,0,a.canvas.width,a.canvas.height);var b=this.ctxFlying;b&&b.clearRect(0,0,b.canvas.width,b.canvas.height)},enable:function(){this.isable=!0,this.resume(),this.updateMap()},disable:function(){this.clean(),this.pause(),this.isable=!1},initEventsMap:function(){var a=this;this._map.on('movestart',function(){a.clean()}).on('moveend',function(){a.updateMap()}.bind(this))},initSpriteFlying:function(){var b=this.options.trail,j=b.color,a=document.createElement('canvas'),e=this.spriteW=a.width=b.spriteW,g=this.spriteH=a.height=b.spriteH,d=a.getContext('2d'),h,i=d.createLinearGradient(0,0,e,g),f=100;for(var c=0;c<f;c++)h=c/f,i.addColorStop(h,j(h));d.fillStyle=i,d.fillRect(0,0,e,g),this.spriteFlying=a,b.flying.sprite=a},initSpriteFlyingHead:function(){var d=this.options.trail,e=d.color,a=document.createElement('canvas'),f=a.width=a.height=50,b=f/2,c=a.getContext('2d');return c.fillStyle=e(1),c.arc(b,b,b,0,Math.PI*2),c.fill(),this.spriteFlyingHead=a,d.flying.spriteHead=a,a},select:function(d){var a,e,c=this.trails;this.clean();for(var b=0;b<c.length;b++)a=c[b],e=a.id,d&&e in d?(a.enable(),a.updateBgLine()):a.disable()},unselect:function(){var a,c=this.trails;this.clean();for(var b=0;b<c.length;b++)a=c[b],a&&a.enable('flying'),a&&a.disable('bgLine')},initEventsAnim:function(){this.on('update',function(a){this.updateAnim(a)})},genOptions:function(){return a.prototype.options=c.deepMerge(f.prototype.genOptions(),a.prototype.options)}}),h=b.dmap=b.dmap||{};h.TrailsCanvas=a,h.trailsCanvas=function(b){return new a(b)},a.prototype.genOptions(),module.exports=a | ||
'use strict';function a(c){c=this.options=b.deepMerge(a.options,c),this.initialize(c)}var c=require('./../leaflet'),b=require('./../core/utils'),d=require('./../render/canvas'),g=b.getColorFunc,e=require('./../core/animator'),h=require('./trail_canvas');a.options={lineN:1e3,lifeSpeed:1,isAutoUpdate:!0,trail:{delay:2,lifeSpeed:1.5,lengthLimit:60,lineSegmentLonger:0,isAutoUpdate:!1,spriteW:200,spriteH:20,flying:{container:'#canvas',isable:!0,blending:'lighter',type:'line',ptsN:25,weight:function(a){return 5*Math.pow(a,3)},isSpriteHead:!0},color:g('rgba(150,0,0,0.3)','rgba(250,150,0, 1)','rgb','linear.Out.2'),value:function(a,b,c){return Math.min(1,a.length/40)},lng:b.getLng,lat:b.getLat,time:b.getTime},pts:function(a){return a.p},id:b.getID,lifeMin:0,lifeMax:1e11};var a=e.extend(a,{events:{},initialize:function(a){this.isable=!0;var b=a.trail;this.lifeMax=a.lifeMax,this.lifeMin=a.lifeMin,this.life=this.lifeMin,this.initSpriteFlying(),b.flying&&this.initSpriteFlyingHead(),a.isAutoUpdate&&this.initEventsAnim()},initCanvas:function(){var g=this.options,e=g.trail,a=e.bgLine;if(a){var h=a.opacity,i=a.blending;this.lcanvasBg=new d(this._map,a.container,{clearAlpha:.9});var c=this.ctxBg=this.lcanvasBg.ctx;c.globalAlpha=h,c.globalCompositeOperation=i,a.ctx=c}var b=e.flying;if(b){var j=b.blending;this.lcanvas=new d(this._map,b.container,{clearAlpha:1});var f=this.ctxFlying=this.lcanvas.ctx;f.globalCompositeOperation=j,b.ctx=f}},addTo:function(a){if(this._map||!a)return;this._map=a,this.initCanvas(),this.initTrails(),this.initEventsMap(),this._data&&this.updateZoom()},clear:function(){var b=this.using,a=this.unusing,e;for(var f in b)e=b[f],e.reset();this.using=[],a=[];var c=this.trails;for(var d in c)a[d]=c[d];this.unusing=a},reset:function(){var e=this.unusing=[];this.using=[];var a=this.trails;for(var c=0;c<a.length;c++){var b=a[c];b.stop&&b.stop(),b.pause&&b.pause(),b.resetVariables()}this.life=this.options.lifeMin,this.using=[];var a=this.trails;for(var d=0;d<a.length;d++)e.push(a[d]);this.resume()},initCacheColor:function(){},data:function(d){if(!d)return this._data;var a=this.unusing,e=this.using;if(!(a&&a.length))return;var b=a.pop(),f=this.options,g=f.pts,c=g(d);b.updateOptions({lifeMin:0,lifeMax:c.length}),b.data(c),e.push(b),this.options.isAutoUpdate&&this._map&&!this.loopid&&this.startAnim()},datas:function(a){if(!a)return this._data;for(var b in a)this.data(a[b])},initTrails:function(){var b=this.options,d=b.trail,j=this.using=[],e=this.unusing=[],f=this._map,g=this.trails=[],i=b.lineN,a;for(var c=0;c<i;c++)a=new h(d),a.addTo(f),this.initEventsTrail(a),g.push(a),e.push(a)},checkTrail:function(b){if(!b.isEnd())return;var a=this.using,c=!1;for(var d in a)if(a[d].equalTo(b)){c=!0,a.splice(d,1);break}c&&this.unusing.push(b)},initEventsTrail:function(a){var b=this;a.on('lifeEnd',function(c){b.emit('flying-end',a._data)})},updateOptions:function(){var b=this.options,c,a=this.trails;for(var d in a)c=a[d],c.updateOptions(b)},render:function(){},updateAnim:function(a){if(!this.isable)return;this.iii=this.iii||0;var f=this.ctxFlying;this.lcanvas.clear(),a=a||this.life;var d=this.using,e=this.options.trail;for(var b=d.length-1;b>=0;b--){var c=d[b];a=c.life+e.lifeSpeed,c.updateAnim(a),this.checkTrail(c)}},updateMap:function(){if(!this.isable)return;var a=this.ctxBg;a&&a.clearRect(0,0,a.canvas.width,a.canvas.height);var b=this.ctxFlying;b&&b.clearRect(0,0,b.canvas.width,b.canvas.height);var f=this._map.getBounds(),d=this.using;for(var c=0;c<d.length;c++){var e=d[c];e&&e.updateMap(f)}},clean:function(){var a=this.ctxBg;a&&a.clearRect(0,0,a.canvas.width,a.canvas.height);var b=this.ctxFlying;b&&b.clearRect(0,0,b.canvas.width,b.canvas.height)},enable:function(){this.isable=!0,this.resume(),this.updateMap()},disable:function(){this.clean(),this.pause(),this.isable=!1},initEventsMap:function(){var a=this;this._map.on('movestart',function(){a.clean()}).on('moveend',function(){a.updateMap()}.bind(this))},initSpriteFlying:function(){var b=this.options.trail,j=b.color,a=document.createElement('canvas'),e=this.spriteW=a.width=b.spriteW,g=this.spriteH=a.height=b.spriteH,d=a.getContext('2d'),h,i=d.createLinearGradient(0,0,e,g),f=100;for(var c=0;c<f;c++)h=c/f,i.addColorStop(h,j(h));d.fillStyle=i,d.fillRect(0,0,e,g),this.spriteFlying=a,b.flying.sprite=a},initSpriteFlyingHead:function(){var d=this.options.trail,e=d.color,a=document.createElement('canvas'),f=a.width=a.height=50,b=f/2,c=a.getContext('2d');return c.fillStyle=e(1),c.arc(b,b,b,0,Math.PI*2),c.fill(),this.spriteFlyingHead=a,d.flying.spriteHead=a,a},select:function(d){var a,e,c=this.trails;this.clean();for(var b=0;b<c.length;b++)a=c[b],e=a.id,d&&e in d?(a.enable(),a.updateBgLine()):a.disable()},unselect:function(){var a,c=this.trails;this.clean();for(var b=0;b<c.length;b++)a=c[b],a&&a.enable('flying'),a&&a.disable('bgLine')},initEventsAnim:function(){this.on('update',function(a){this.updateAnim(a)})},genOptions:function(){return a.prototype.options=b.deepMerge(e.prototype.genOptions(),a.prototype.options)}}),f=c.dmap=c.dmap||{};f.TrailsCanvas=a,f.trailsCanvas=function(b){return new a(b)},a.prototype.genOptions(),module.exports=a |
@@ -1,1 +0,1 @@ | ||
'use strict';function a(b){b=this.options=c.deepMerge(a.options,b),this.initialize(b)}var b=require('./../leaflet'),c=require('./../core/utils'),d=require('./../render/canvas'),e=c.getColorFunc,f=require('./../core/animator'),g=require('./trail_canvas');a.options={lifeSpeed:.1,isAutoUpdate:!0,lifeMin:0,lifeMax:100,trail:{lengthLimit:60,isAutoUpdate:!1,spriteW:200,spriteH:20,flying:{isable:!0,blending:'lighter',type:'line',ptsN:29,weight:function(a){return 8*Math.pow(a,3)},isSpriteHead:!0,container:'#canvas-container'},bgLine:{container:'#canvas-container',isable:!1,blending:'source-over',opacity:1,color:'rgba(250,100,50,0.3)',weight:2},color:{to:'rgba(255,150,0,0.4)',from:'rgba(255,150,0,0.4)',space:'hsl',easing:'linear.Out.1'},value:function(a,b,c){return Math.min(1,a.length/40)},lng:c.getLng,lat:c.getLat,time:c.getTime},pts:function(a){return a.p},id:c.getID};var a=f.extend(a,{events:{},initialize:function(a){this.isable=!0;var b=a.trail;this.lifeMax=a.lifeMax,this.lifeMin=a.lifeMin,this.life=this.lifeMin,this.initSpriteFlying(),b.bgLine&&this.initSpriteBgLine(),b.flying&&this.initSpriteFlyingHead(),a.isAutoUpdate&&this.initEventsAnim()},initCanvas:function(){var g=this.options,e=g.trail,a=e.bgLine;if(a){var h=a.opacity,i=a.blending;this.lcanvasBg=new d(this._map,a.container,{});var c=this.ctxBg=this.lcanvasBg.ctx;c.globalAlpha=h,c.globalCompositeOperation=i,a.ctx=c}var b=e.flying;if(b){var j=b.blending;this.lcanvas=new d(this._map,b.container,{});var f=this.ctxFlying=this.lcanvas.ctx;f.globalCompositeOperation=j,b.ctx=f}},addTo:function(a){if(this._map||!a)return;this._map=a,this.initCanvas(),this.initEventsMap(),this._data&&this.updateZoom()},initCacheColor:function(){},data:function(a){if(!a)return this._data;this._data=a,this.trailsInView={},this.trailsEnable={},this.initTrails(),this.options.isAutoUpdate&&this._map&&this.startAnim()},initTrails:function(){var b=this.options,d=b.trail,j=b.pts,m=b.id,e=this._data,h=this._map,i=this.trails=[];d.flying.ctx=this.ctxFlying;var l=this.ctxBg,k,f,a;for(var c in e)k=e[c],f=j(k),a=new g(d),a.addTo(h),a.data(f),i.push({id:c,data:f,trail:a});this.updateMap()},render:function(){},reset:function(){var c=this.using;for(var b=0;b<c.length;b++){var a=c[b];a.stop&&a.stop(),a.pause&&a.pause()}this.using=[],this.unsing=this.trails},restart:function(){var a=this.trails;for(var b in a){var c=a[b];c.trail.resetVariables()}this.life=this.options.lifeMin,this.resume()},updateAnim:function(d){if(!this.isable)return;var a=this.ctxFlying;a&&a.clearRect(0,0,a.canvas.width,a.canvas.height),d=d||this.life;var e=this.trails;for(var b=0;b<e.length;b++){var c=e[b];c=c.trail,c.updateAnim(d)}},updateMap:function(){if(!this.isable)return;var a=this.ctxBg;a&&a.clearRect(0,0,a.canvas.width,a.canvas.height);var b=this.ctxFlying;b&&b.clearRect(0,0,b.canvas.width,b.canvas.height);var f=this._map.getBounds(),e=this.trails;for(var d=0;d<e.length;d++){var c=e[d];c=c.trail,c&&c.updateMap(f)}},clean:function(){var a=this.ctxBg;a&&a.clearRect(0,0,a.canvas.width,a.canvas.height);var b=this.ctxFlying;b&&b.clearRect(0,0,b.canvas.width,b.canvas.height)},enable:function(){this.isable=!0,this.resume(),this.updateMap()},disable:function(){this.clean(),this.pause(),this.isable=!1},initEventsMap:function(){var a=this;this._map.on('movestart',function(){a.clean()}).on('moveend',function(){a.updateMap()}.bind(this))},initSpriteFlying:function(){var b=this.options.trail,k=e(b.color),a=document.createElement('canvas'),f=this.spriteW=a.width=b.spriteW,h=this.spriteH=a.height=b.spriteH,d=a.getContext('2d'),i,j=d.createLinearGradient(0,0,f,h),g=100;for(var c=0;c<g;c++)i=c/g,j.addColorStop(i,k(i));d.fillStyle=j,d.fillRect(0,0,f,h),this.spriteFlying=a,b.flying.sprite=a},initSpriteFlyingHead:function(){var d=this.options.trail,f=e(d.color),a=document.createElement('canvas'),g=a.width=a.height=50,b=g/2,c=a.getContext('2d');return c.fillStyle=f(1),c.arc(b,b,b,0,Math.PI*2),c.fill(),this.spriteFlyingHead=a,d.flying.spriteHead=a,a},select:function(d){var a,e,c=this.trails;this.clean();for(var b=0;b<c.length;b++)a=c[b],e=a.id,d&&e in d?(a.trail.enable(),a.trail.updateBgLine()):a.trail.disable()},unselect:function(){var a,c=this.trails;this.clean();for(var b=0;b<c.length;b++)a=c[b],a.trail&&a.trail.enable('flying'),a.trail&&a.trail.disable('bgLine')},initSpriteBgLine:function(){var b=this.options.trail;if(!b.bgLine)return;var a=document.createElement('canvas'),d=this.spriteW=a.width=b.spriteW,e=this.spriteH=a.height=b.spriteH,c=a.getContext('2d');return c.fillStyle=this.options.trail.bgLine.color,c.fillRect(0,0,d,e),this.spriteBgLine=a,b.bgLine.sprite=a,a},initEventsAnim:function(){this.on('lifeEnd',function(){this.pause()}).on('update',function(a){this.updateAnim(a)})},genOptions:function(){return a.prototype.options=c.deepMerge(f.prototype.genOptions(),a.prototype.options)}}),h=b.dmap=b.dmap||{};h.TrailsCanvas=a,h.trailsCanvas=function(b){return new a(b)},a.prototype.genOptions(),module.exports=a | ||
'use strict';function a(c){c=this.options=b.deepMerge(a.options,c),this.initialize(c)}var c=require('./../leaflet'),b=require('./../core/utils'),d=require('./../render/canvas'),e=b.getColorFunc,f=require('./../core/animator'),h=require('./trail_canvas');a.options={lifeSpeed:.1,isAutoUpdate:!0,lifeMin:0,lifeMax:100,trail:{lengthLimit:60,isAutoUpdate:!1,spriteW:200,spriteH:20,flying:{isable:!0,blending:'lighter',type:'line',ptsN:29,weight:function(a){return 8*Math.pow(a,3)},isSpriteHead:!0,container:'#canvas-container'},bgLine:{container:'#canvas-container',isable:!1,blending:'source-over',opacity:1,color:'rgba(250,100,50,0.3)',weight:2},color:{to:'rgba(255,150,0,0.4)',from:'rgba(255,150,0,0.4)',space:'hsl',easing:'linear.Out.1'},value:function(a,b,c){return Math.min(1,a.length/40)},lng:b.getLng,lat:b.getLat,time:b.getTime},pts:function(a){return a.p},id:b.getID};var a=f.extend(a,{events:{},initialize:function(a){this.isable=!0;var b=a.trail;this.lifeMax=a.lifeMax,this.lifeMin=a.lifeMin,this.life=this.lifeMin,this.initSpriteFlying(),b.bgLine&&this.initSpriteBgLine(),b.flying&&this.initSpriteFlyingHead(),a.isAutoUpdate&&this.initEventsAnim()},initCanvas:function(){var g=this.options,e=g.trail,a=e.bgLine;if(a){var h=a.opacity,i=a.blending;this.lcanvasBg=new d(this._map,a.container,{});var c=this.ctxBg=this.lcanvasBg.ctx;c.globalAlpha=h,c.globalCompositeOperation=i,a.ctx=c}var b=e.flying;if(b){var j=b.blending;this.lcanvas=new d(this._map,b.container,{});var f=this.ctxFlying=this.lcanvas.ctx;f.globalCompositeOperation=j,b.ctx=f}},addTo:function(a){if(this._map||!a)return;this._map=a,this.initCanvas(),this.initEventsMap(),this._data&&this.updateZoom()},initCacheColor:function(){},data:function(a){if(!a)return this._data;this._data=a,this.trailsInView={},this.trailsEnable={},this.initTrails(),this.options.isAutoUpdate&&this._map&&this.startAnim()},initTrails:function(){var b=this.options,d=b.trail,j=b.pts,m=b.id,e=this._data,g=this._map,i=this.trails=[];d.flying.ctx=this.ctxFlying;var l=this.ctxBg,k,f,a;for(var c in e)k=e[c],f=j(k),a=new h(d),a.addTo(g),a.data(f),i.push({id:c,data:f,trail:a});this.updateMap()},render:function(){},reset:function(){var c=this.using;for(var b=0;b<c.length;b++){var a=c[b];a.stop&&a.stop(),a.pause&&a.pause()}this.using=[],this.unsing=this.trails},restart:function(){var a=this.trails;for(var b in a){var c=a[b];c.trail.resetVariables()}this.life=this.options.lifeMin,this.resume()},updateAnim:function(d){if(!this.isable)return;var a=this.ctxFlying;a&&a.clearRect(0,0,a.canvas.width,a.canvas.height),d=d||this.life;var e=this.trails;for(var b=0;b<e.length;b++){var c=e[b];c=c.trail,c.updateAnim(d)}},updateMap:function(){if(!this.isable)return;var a=this.ctxBg;a&&a.clearRect(0,0,a.canvas.width,a.canvas.height);var b=this.ctxFlying;b&&b.clearRect(0,0,b.canvas.width,b.canvas.height);var f=this._map.getBounds(),e=this.trails;for(var d=0;d<e.length;d++){var c=e[d];c=c.trail,c&&c.updateMap(f)}},clean:function(){var a=this.ctxBg;a&&a.clearRect(0,0,a.canvas.width,a.canvas.height);var b=this.ctxFlying;b&&b.clearRect(0,0,b.canvas.width,b.canvas.height)},enable:function(){this.isable=!0,this.resume(),this.updateMap()},disable:function(){this.clean(),this.pause(),this.isable=!1},initEventsMap:function(){var a=this;this._map.on('movestart',function(){a.clean()}).on('moveend',function(){a.updateMap()}.bind(this))},initSpriteFlying:function(){var b=this.options.trail,k=e(b.color),a=document.createElement('canvas'),f=this.spriteW=a.width=b.spriteW,h=this.spriteH=a.height=b.spriteH,d=a.getContext('2d'),i,j=d.createLinearGradient(0,0,f,h),g=100;for(var c=0;c<g;c++)i=c/g,j.addColorStop(i,k(i));d.fillStyle=j,d.fillRect(0,0,f,h),this.spriteFlying=a,b.flying.sprite=a},initSpriteFlyingHead:function(){var d=this.options.trail,f=e(d.color),a=document.createElement('canvas'),g=a.width=a.height=50,b=g/2,c=a.getContext('2d');return c.fillStyle=f(1),c.arc(b,b,b,0,Math.PI*2),c.fill(),this.spriteFlyingHead=a,d.flying.spriteHead=a,a},select:function(d){var a,e,c=this.trails;this.clean();for(var b=0;b<c.length;b++)a=c[b],e=a.id,d&&e in d?(a.trail.enable(),a.trail.updateBgLine()):a.trail.disable()},unselect:function(){var a,c=this.trails;this.clean();for(var b=0;b<c.length;b++)a=c[b],a.trail&&a.trail.enable('flying'),a.trail&&a.trail.disable('bgLine')},initSpriteBgLine:function(){var b=this.options.trail;if(!b.bgLine)return;var a=document.createElement('canvas'),d=this.spriteW=a.width=b.spriteW,e=this.spriteH=a.height=b.spriteH,c=a.getContext('2d');return c.fillStyle=this.options.trail.bgLine.color,c.fillRect(0,0,d,e),this.spriteBgLine=a,b.bgLine.sprite=a,a},initEventsAnim:function(){this.on('lifeEnd',function(){this.pause()}).on('update',function(a){this.updateAnim(a)})},genOptions:function(){return a.prototype.options=b.deepMerge(f.prototype.genOptions(),a.prototype.options)}}),g=c.dmap=c.dmap||{};g.TrailsCanvas=a,g.trailsCanvas=function(b){return new a(b)},a.prototype.genOptions(),module.exports=a |
@@ -1,1 +0,1 @@ | ||
var a=require('./../leaflet'),b=require('jquery'),c=a.dmap=a.dmap||{},d=require('./../core/utils'),e=require('./../demo/lib/simplify'),f=a.Class.extend({isRotateZ:!1,options:{simplifyScale:0,collSpace:80,lifeSpeed:100,dataType:'simplifyData',column:{color:'rgba(253, 239, 239, 0.901961)',width:10,height:30,deg:50,opacity:.6}},initialize:function(a){this.options=d.deepMerge(this.options,a),this.columnOpts=this.options.column,this.popuperOpts=this.options.popuper},addTo:function(a){if(!a)return;this._map=a},data:function(a){this._data=a,this.columnOpts=this.options.column,this.index=0},processing:function(){return this[this.options.dataType]()},simplifyData:function(){var c=this._data,d=[],f=this.options.simplifyScale;for(var b=0;b<c.length;b++){var g=c[b].lng,h=c[b].lat,i=new a.LatLng(h,g);d.push(i)}var j=e(d,f);this.processData(j)},originalData:function(){var c=this._data,j=this.newDataCollader=[];for(var b=0;b<c.length-1;b++){var n=c[b].lng,g=c[b].lat,h=c[b+1].lng,i=c[b+1].lat,d=new a.latLng(g,n),k=new a.latLng(i,h),l=d.distanceTo(k);if(c[b].time)var e=new Date(c[b].time),f=new Date(c[b+1].time);else var e=b,f=b+1;var o=(f-e)/36e5,p=l/1e3,m=p/o;d.speed=m,j.push(d)}this.goView3D()},processData:function(c){var n=this.newDataCollader=[],k=this.options.collSpace;for(var b=0;b<c.length;b++){if(c[b+1]===undefined)var f=a.latLng(c[b].lng,c[b].lat),g=a.latLng(c[b].lng,c[b].lat);else var f=a.latLng(c[b].lng,c[b].lat),g=a.latLng(c[b+1].lng,c[b+1].lat);var m=f.distanceTo(g),e=Math.round(m/k)||1,o=c[b],l=Math.floor((Math.random()+1)/2*100);for(var d=0;d<=e-1;d++){if(c[b+1]===undefined)var i=c[b].lat+(c[b].lat-c[b].lat)*(d/e),h=c[b].lng+(c[b].lng-c[b].lng)*(d/e);else var i=c[b].lat+(c[b+1].lat-c[b].lat)*(d/e),h=c[b].lng+(c[b+1].lng-c[b].lng)*(d/e);var j=new a.LatLng(i,h);j.speed=l,n.push(j)}}this.goView3D()},goView3D:function(){console.log('asdasdasdasdasdasdasd');var c=this.map,d=this.newDataCollader,a=this;a.goView3dOpts(),b('.leaflet-marker-pane').find('.line3d').remove(),this.render3D()},goView3dOpts:function(){b('.leaflet-overlay-pane svg').css('visibility','hidden'),b('.leaflet-marker-pane').css('visibility','visible')},render3D:function(){var d=this.columns=undefined,e=this.newDataCollader;if(!this.columns){d=this.columns=[];for(var c=0;c<e.length;c++){var a=d[c]=b(' <div class="line3d"> <div class="linedrawer"></div> <div class="popuper"></div> <div class="circlebottom"></div> <div class="circletop"></div> </div>');b('.leaflet-marker-pane').append(a),this.line3dNode=a.find('.line3d'),this.linedrawerNode=a.find('.linedrawer'),this.popuperNode=a.find('.popuper')}b('.line3d').on('mouseover',function(b){var a=b.currentTarget.children[1].style;a.visibility='visible'}),b('.line3d').on('mouseout',function(b){var a=b.currentTarget.children[1].style;a.visibility='hidden'}),this.updateValue(),this.render()}},render:function(){var a=this.columnOpts,d=a.width,c=a.color;b('.linedrawer').css({'background-color':c,opacity:this.columnOpts.opacity}),this.updatePos(),this.rotate()},updatePos:function(f){var d=this.newDataCollader,e=this._map;for(var a=0;a<d.length;a++){this.heightTrans=40;var c;f?c=e._latLngToNewLayerPoint(d[a],f.zoom,f.center).round():c=e.latLngToLayerPoint(d[a]);var g=c.x,h=c.y,i='translate3d('+g+'px'+','+h+'px'+','+'0'+')',j=g+'px '+h+'px';b('.linedrawer').css({height:2});var k=this.columns;k[a].css({transform:'rotateX(90deg)'+i,'-webkitTransform':'rotateX(90deg)'+i,'-webkitTransformOrigin':j,transformOrigin:j})}},initEventsMap:function(){var a=this.updatePos.bind(this);this._map.on('zoomanim',a),requestAnimationFrame(function(){a()})},rotate:function(){this.angle=0,this.xdrag=0;var a=b(this._map._container);this._map.on('rotate',function(i,j){var c=-i.rotation,d=b('.linedrawer'),f=b('.popuper');for(var a=0;a<d.length;a++){var e=b(d[a]),g=e.attr('ytrans');e.css({transform:'rotateY('+c+'deg)'+' '+g});var h=b(f[a]);h.css('transform','rotateY('+c+'deg)')}})},updateValue:function(){var e=this.columns,g=this.newDataCollader;if(e&&this.index<e.length){var a=g[this.index].speed,f=e[this.index].find('.linedrawer');if(a>170){var c=150;f.css({transform:'scaleY('+c+')'}),f.attr('ytrans','scaleY('+c+')')}else f.css({transform:'scaleY('+a+')'}),f.attr('ytrans','scaleY('+a+')');var h=e[this.index].find('.popuper');if(a>170)var d=b('<div class="text-rotator"> <span class="span-text1">时速: 超速</span></div>');else var d=b('<div class="text-rotator"> <span class="span-text1">时速: '+Math.floor(a)+'mph'+'</span></div>');if(h.append(d),a>170){var c=150;d.css({transform:'translate3d(-60px,'+(c*2+5)+'px'+','+0+'px'+')'+' '+'rotateX('+190+'deg)'})}else d.css({transform:'translate3d(-60px,'+(a*2+5)+'px'+','+0+'px'+')'+' '+'rotateX('+190+'deg)'})}this.index++,setTimeout(this.updateValue.bind(this),this.options.lifeSpeed)}});c.TransLine=f,c.transLine=function(a){return new c.TransLine(a)},module.exports=f | ||
var b=require('./../leaflet'),a=require('jquery'),c=b.dmap=b.dmap||{},e=require('./../core/utils'),f=require('./../demo/lib/simplify'),d=b.Class.extend({isRotateZ:!1,options:{simplifyScale:0,collSpace:80,lifeSpeed:100,dataType:'simplifyData',column:{color:'rgba(253, 239, 239, 0.901961)',width:10,height:30,deg:50,opacity:.6}},initialize:function(a){this.options=e.deepMerge(this.options,a),this.columnOpts=this.options.column,this.popuperOpts=this.options.popuper},addTo:function(a){if(!a)return;this._map=a},data:function(a){this._data=a,this.columnOpts=this.options.column,this.index=0},processing:function(){return this[this.options.dataType]()},simplifyData:function(){var c=this._data,d=[],e=this.options.simplifyScale;for(var a=0;a<c.length;a++){var g=c[a].lng,h=c[a].lat,i=new b.LatLng(h,g);d.push(i)}var j=f(d,e);this.processData(j)},originalData:function(){var c=this._data,j=this.newDataCollader=[];for(var a=0;a<c.length-1;a++){var n=c[a].lng,g=c[a].lat,h=c[a+1].lng,i=c[a+1].lat,d=new b.latLng(g,n),k=new b.latLng(i,h),l=d.distanceTo(k);if(c[a].time)var e=new Date(c[a].time),f=new Date(c[a+1].time);else var e=a,f=a+1;var o=(f-e)/36e5,p=l/1e3,m=p/o;d.speed=m,j.push(d)}this.goView3D()},processData:function(c){var n=this.newDataCollader=[],k=this.options.collSpace;for(var a=0;a<c.length;a++){if(c[a+1]===undefined)var f=b.latLng(c[a].lng,c[a].lat),g=b.latLng(c[a].lng,c[a].lat);else var f=b.latLng(c[a].lng,c[a].lat),g=b.latLng(c[a+1].lng,c[a+1].lat);var m=f.distanceTo(g),e=Math.round(m/k)||1,o=c[a],l=Math.floor((Math.random()+1)/2*100);for(var d=0;d<=e-1;d++){if(c[a+1]===undefined)var i=c[a].lat+(c[a].lat-c[a].lat)*(d/e),h=c[a].lng+(c[a].lng-c[a].lng)*(d/e);else var i=c[a].lat+(c[a+1].lat-c[a].lat)*(d/e),h=c[a].lng+(c[a+1].lng-c[a].lng)*(d/e);var j=new b.LatLng(i,h);j.speed=l,n.push(j)}}this.goView3D()},goView3D:function(){console.log('asdasdasdasdasdasdasd');var c=this.map,d=this.newDataCollader,b=this;b.goView3dOpts(),a('.leaflet-marker-pane').find('.line3d').remove(),this.render3D()},goView3dOpts:function(){a('.leaflet-overlay-pane svg').css('visibility','hidden'),a('.leaflet-marker-pane').css('visibility','visible')},render3D:function(){var d=this.columns=undefined,e=this.newDataCollader;if(!this.columns){d=this.columns=[];for(var c=0;c<e.length;c++){var b=d[c]=a(' <div class="line3d"> <div class="linedrawer"></div> <div class="popuper"></div> <div class="circlebottom"></div> <div class="circletop"></div> </div>');a('.leaflet-marker-pane').append(b),this.line3dNode=b.find('.line3d'),this.linedrawerNode=b.find('.linedrawer'),this.popuperNode=b.find('.popuper')}a('.line3d').on('mouseover',function(b){var a=b.currentTarget.children[1].style;a.visibility='visible'}),a('.line3d').on('mouseout',function(b){var a=b.currentTarget.children[1].style;a.visibility='hidden'}),this.updateValue(),this.render()}},render:function(){var b=this.columnOpts,d=b.width,c=b.color;a('.linedrawer').css({'background-color':c,opacity:this.columnOpts.opacity}),this.updatePos(),this.rotate()},updatePos:function(f){var d=this.newDataCollader,e=this._map;for(var b=0;b<d.length;b++){this.heightTrans=40;var c;f?c=e._latLngToNewLayerPoint(d[b],f.zoom,f.center).round():c=e.latLngToLayerPoint(d[b]);var g=c.x,h=c.y,i='translate3d('+g+'px'+','+h+'px'+','+'0'+')',j=g+'px '+h+'px';a('.linedrawer').css({height:2});var k=this.columns;k[b].css({transform:'rotateX(90deg)'+i,'-webkitTransform':'rotateX(90deg)'+i,'-webkitTransformOrigin':j,transformOrigin:j})}},initEventsMap:function(){var a=this.updatePos.bind(this);this._map.on('zoomanim',a),requestAnimationFrame(function(){a()})},rotate:function(){this.angle=0,this.xdrag=0;var b=a(this._map._container);this._map.on('rotate',function(i,j){var c=-i.rotation,d=a('.linedrawer'),f=a('.popuper');for(var b=0;b<d.length;b++){var e=a(d[b]),g=e.attr('ytrans');e.css({transform:'rotateY('+c+'deg)'+' '+g});var h=a(f[b]);h.css('transform','rotateY('+c+'deg)')}})},updateValue:function(){var e=this.columns,g=this.newDataCollader;if(e&&this.index<e.length){var b=g[this.index].speed,f=e[this.index].find('.linedrawer');if(b>170){var c=150;f.css({transform:'scaleY('+c+')'}),f.attr('ytrans','scaleY('+c+')')}else f.css({transform:'scaleY('+b+')'}),f.attr('ytrans','scaleY('+b+')');var h=e[this.index].find('.popuper');if(b>170)var d=a('<div class="text-rotator"> <span class="span-text1">时速: 超速</span></div>');else var d=a('<div class="text-rotator"> <span class="span-text1">时速: '+Math.floor(b)+'mph'+'</span></div>');if(h.append(d),b>170){var c=150;d.css({transform:'translate3d(-60px,'+(c*2+5)+'px'+','+0+'px'+')'+' '+'rotateX('+190+'deg)'})}else d.css({transform:'translate3d(-60px,'+(b*2+5)+'px'+','+0+'px'+')'+' '+'rotateX('+190+'deg)'})}this.index++,setTimeout(this.updateValue.bind(this),this.options.lifeSpeed)}});c.TransLine=d,c.transLine=function(a){return new c.TransLine(a)},module.exports=d |
@@ -1,1 +0,1 @@ | ||
var a=require('./../leaflet'),b=require('jquery'),c=a.dmap=a.dmap||{},d=require('./../core/utils'),e=require('./../demo/lib/simplify'),f=a.Class.extend({isRotateZ:!1,options:{simplifyScale:0,collSpace:80,column:{color:'white',width:10,height:30,deg:50,opacity:.6}},initialize:function(a){this.options=d.deepMerge(this.options,a),this.columnOpts=this.options.column,this.popuperOpts=this.options.popuper},addTo:function(a){if(!a)return;this._map=a},data:function(a){this._data=a,this.columnOpts=this.options.column,this.index=0},simplifyData:function(){var c=this.data=this._data,k=this.map,d=[],f=this.options.simplifyScale;for(var b=0;b<c.length;b++){var g=c[b].lat,h=c[b].lng,i=new a.LatLng(h,g);d.push(i)}var j=e(d,f);this.processData(j)},processData:function(c){var n=this.newDataCollader=[],k=this.options.collSpace;for(var b=0;b<c.length;b++){if(c[b+1]===undefined)var f=a.latLng(c[b].lat,c[b].lng),g=a.latLng(c[b].lat,c[b].lng);else var f=a.latLng(c[b].lat,c[b].lng),g=a.latLng(c[b+1].lat,c[b+1].lng);var m=f.distanceTo(g),e=Math.round(m/k)||1,o=c[b],l=Math.floor((Math.random()+1)/2*100);for(var d=0;d<=e-1;d++){if(c[b+1]===undefined)var i=c[b].lat+(c[b].lat-c[b].lat)*(d/e),h=c[b].lng+(c[b].lng-c[b].lng)*(d/e);else var i=c[b].lat+(c[b+1].lat-c[b].lat)*(d/e),h=c[b].lng+(c[b+1].lng-c[b].lng)*(d/e);var j=new a.LatLng(i,h);j.speed=l,n.push(j)}}this.switchView()},switchView:function(){this.goView3D()},goView2D:function(){var c=this.map,d=this.newDataCollader,e=b('.leaflet-zoom-animated').children();b('#maprotor.titled').css('-webkit-transform','rotateX(0deg)'),b('#view-3d').css('visibility','hidden');var a=this;b('#view-3d').on('click',function(){a.goView2dOpts(),b('.leaflet-marker-pane').find('.line3d').remove()})},goView3D:function(){var e=this.map,c=this.newDataCollader,d=this;d.goView3dOpts(),b('.leaflet-marker-pane').find('.line3d').remove();for(var a=0;a<c.length;a++)this.render3D(c[a])},goView2dOpts:function(){b('#view-3d').css('visibility','hidden'),b('#view-2d').css('visibility','visible'),b('.leaflet-overlay-pane svg').css('visibility','visible'),b('.leaflet-marker-pane').css('visibility','hidden'),map.dragging.enable();var c=b('.linedrawer');for(var a=0;a<c.length;a++){var d=b(c[a]),e=d.attr('ytrans');d.css({transform:'rotateY(0deg) '+e})}},goView3dOpts:function(){b('.leaflet-overlay-pane svg').css('visibility','hidden'),b('.leaflet-marker-pane').css('visibility','visible')},render3D:function(c){var d=this.columns,c=this.singleData=c,a=this.columns=b(' <div class="line3d"> <div class="linedrawer"></div> <div class="popuper"></div> <div class="circlebottom"></div> <div class="circletop"></div> </div>');b('.leaflet-marker-pane').append(a),this.line3dNode=a.find('.line3d'),this.linedrawerNode=a.find('.linedrawer'),this.popuperNode=a.find('.popuper'),this.updateValue(),this.render()},render:function(){var a=this.columnOpts,d=a.width,c=a.color;b('.linedrawer').css({'background-color':c,opacity:this.columnOpts.opacity}),this.updatePos(),this.rotate()},updatePos:function(f){var c=this.singleData,d=this._map,e=a.latLng(c.lat,c.lng);this.heightTrans=40;var b;f?b=d._latLngToNewLayerPoint(e,f.zoom,f.center).round():b=d.latLngToLayerPoint(e);var g=b.x,h=b.y,i='translate3d('+g+'px'+','+h+'px'+','+'0'+')',j=g+'px '+h+'px',k=this.columns;k.css({transform:'rotateX(90deg)'+i,'-webkitTransform':'rotateX(90deg)'+i,'-webkitTransformOrigin':j,transformOrigin:j})},initEventsMap:function(){var a=this.updatePos.bind(this);this._map.on('zoomanim',a),requestAnimationFrame(function(){a()})},rotate:function(){this.angle=0,this.xdrag=0;var a=b(this._map._container);this._map.on('rotate',function(c,d){var a=-c.rotation;b('.linedrawer').css({transform:'rotateY('+a+'deg)'}),b('.linedrawer').css({transform:'rotateY('+a+'deg)'})})},updateValue:function(){var c=this.columns,d=this.newDataCollader;if(this.index<d.length){var a=d[this.index].speed;a=a;var f=c.find('.linedrawer');this.linedrawerNode.css({height:2}),console.log('asd'),f.css({transform:'scaleY('+a+')'});var g=c.find('.popuper'),e=b('<div class="text-rotator"> <span class="span-text1">时速: '+Math.floor(a/6-4)+'mph'+'</span></div>');g.append(e),e.css({transform:'translate3d(-50px,'+(a*2+5)+'px'+','+0+'px'+')'+' '+'rotateX('+190+'deg)'})}this.index++,setTimeout(this.updateValue.bind(this),100)}});c.TransLine=f,c.transLine=function(a){return new c.TransLine(a)},module.exports=f | ||
var b=require('./../leaflet'),a=require('jquery'),c=b.dmap=b.dmap||{},e=require('./../core/utils'),f=require('./../demo/lib/simplify'),d=b.Class.extend({isRotateZ:!1,options:{simplifyScale:0,collSpace:80,column:{color:'white',width:10,height:30,deg:50,opacity:.6}},initialize:function(a){this.options=e.deepMerge(this.options,a),this.columnOpts=this.options.column,this.popuperOpts=this.options.popuper},addTo:function(a){if(!a)return;this._map=a},data:function(a){this._data=a,this.columnOpts=this.options.column,this.index=0},simplifyData:function(){var c=this.data=this._data,k=this.map,d=[],e=this.options.simplifyScale;for(var a=0;a<c.length;a++){var g=c[a].lat,h=c[a].lng,i=new b.LatLng(h,g);d.push(i)}var j=f(d,e);this.processData(j)},processData:function(c){var n=this.newDataCollader=[],k=this.options.collSpace;for(var a=0;a<c.length;a++){if(c[a+1]===undefined)var f=b.latLng(c[a].lat,c[a].lng),g=b.latLng(c[a].lat,c[a].lng);else var f=b.latLng(c[a].lat,c[a].lng),g=b.latLng(c[a+1].lat,c[a+1].lng);var m=f.distanceTo(g),e=Math.round(m/k)||1,o=c[a],l=Math.floor((Math.random()+1)/2*100);for(var d=0;d<=e-1;d++){if(c[a+1]===undefined)var i=c[a].lat+(c[a].lat-c[a].lat)*(d/e),h=c[a].lng+(c[a].lng-c[a].lng)*(d/e);else var i=c[a].lat+(c[a+1].lat-c[a].lat)*(d/e),h=c[a].lng+(c[a+1].lng-c[a].lng)*(d/e);var j=new b.LatLng(i,h);j.speed=l,n.push(j)}}this.switchView()},switchView:function(){this.goView3D()},goView2D:function(){var c=this.map,d=this.newDataCollader,e=a('.leaflet-zoom-animated').children();a('#maprotor.titled').css('-webkit-transform','rotateX(0deg)'),a('#view-3d').css('visibility','hidden');var b=this;a('#view-3d').on('click',function(){b.goView2dOpts(),a('.leaflet-marker-pane').find('.line3d').remove()})},goView3D:function(){var e=this.map,c=this.newDataCollader,d=this;d.goView3dOpts(),a('.leaflet-marker-pane').find('.line3d').remove();for(var b=0;b<c.length;b++)this.render3D(c[b])},goView2dOpts:function(){a('#view-3d').css('visibility','hidden'),a('#view-2d').css('visibility','visible'),a('.leaflet-overlay-pane svg').css('visibility','visible'),a('.leaflet-marker-pane').css('visibility','hidden'),map.dragging.enable();var c=a('.linedrawer');for(var b=0;b<c.length;b++){var d=a(c[b]),e=d.attr('ytrans');d.css({transform:'rotateY(0deg) '+e})}},goView3dOpts:function(){a('.leaflet-overlay-pane svg').css('visibility','hidden'),a('.leaflet-marker-pane').css('visibility','visible')},render3D:function(c){var d=this.columns,c=this.singleData=c,b=this.columns=a(' <div class="line3d"> <div class="linedrawer"></div> <div class="popuper"></div> <div class="circlebottom"></div> <div class="circletop"></div> </div>');a('.leaflet-marker-pane').append(b),this.line3dNode=b.find('.line3d'),this.linedrawerNode=b.find('.linedrawer'),this.popuperNode=b.find('.popuper'),this.updateValue(),this.render()},render:function(){var b=this.columnOpts,d=b.width,c=b.color;a('.linedrawer').css({'background-color':c,opacity:this.columnOpts.opacity}),this.updatePos(),this.rotate()},updatePos:function(f){var c=this.singleData,d=this._map,e=b.latLng(c.lat,c.lng);this.heightTrans=40;var a;f?a=d._latLngToNewLayerPoint(e,f.zoom,f.center).round():a=d.latLngToLayerPoint(e);var g=a.x,h=a.y,i='translate3d('+g+'px'+','+h+'px'+','+'0'+')',j=g+'px '+h+'px',k=this.columns;k.css({transform:'rotateX(90deg)'+i,'-webkitTransform':'rotateX(90deg)'+i,'-webkitTransformOrigin':j,transformOrigin:j})},initEventsMap:function(){var a=this.updatePos.bind(this);this._map.on('zoomanim',a),requestAnimationFrame(function(){a()})},rotate:function(){this.angle=0,this.xdrag=0;var b=a(this._map._container);this._map.on('rotate',function(c,d){var b=-c.rotation;a('.linedrawer').css({transform:'rotateY('+b+'deg)'}),a('.linedrawer').css({transform:'rotateY('+b+'deg)'})})},updateValue:function(){var c=this.columns,d=this.newDataCollader;if(this.index<d.length){var b=d[this.index].speed;b=b;var f=c.find('.linedrawer');this.linedrawerNode.css({height:2}),console.log('asd'),f.css({transform:'scaleY('+b+')'});var g=c.find('.popuper'),e=a('<div class="text-rotator"> <span class="span-text1">时速: '+Math.floor(b/6-4)+'mph'+'</span></div>');g.append(e),e.css({transform:'translate3d(-50px,'+(b*2+5)+'px'+','+0+'px'+')'+' '+'rotateX('+190+'deg)'})}this.index++,setTimeout(this.updateValue.bind(this),100)}});c.TransLine=d,c.transLine=function(a){return new c.TransLine(a)},module.exports=d |
@@ -1,1 +0,1 @@ | ||
function e(a){var a=this.options=l.deepMerge(e.options,a)}var h,a,d,b,f,g,c,i,j,k=require('./gl/texture');__indexOf=[].indexOf||function(c){for(var a=0,b=this.length;a<b;a++)if(a in this&&this[a]===c)return a;return-1};var l=require('./../core/utils'),m=require('bcore/event'),n=require('./../leaflet'),o=require('./../render/canvas'),a=require('./gl/heights'),b=require('./gl/shader');j=require('./gl/vertexShaderBlit'),g=require('./gl/fragmentShaderBlit'),c=function(){var a,d,b,c;return window.WebGLRenderingContext!=null?(c=['WEBKIT','MOZ','MS','O'],b=/^WEBKIT_(.*)|MOZ_(.*)|MS_(.*)|O_(.*)/,a=WebGLRenderingContext.prototype.getExtension,WebGLRenderingContext.prototype.getExtension=function(e){var d,g,h,f,i;if(g=e.match(b),g!==null&&(e=g[1]),d=a.call(this,e),d===null){for(f=0,i=c.length;f<i;f++)if(h=c[f],d=a.call(this,h+'_'+e),d!==null)return d;return null}else return d},d=WebGLRenderingContext.prototype.getSupportedExtensions,WebGLRenderingContext.prototype.getSupportedExtensions=function(){var a,f,c,g,e,h;for(g=d.call(this),c=[],e=0,h=g.length;e<h;e++)a=g[e],f=a.match(b),f!==null&&(a=f[1]),__indexOf.call(c,a)<0&&c.push(a);return c}):void 0},i=function(){var e,f,l,d,j,m,k,g,a,c,b,h,i,n;if(j=function(){var a,b,c;return a=document.createElement('canvas'),a.width=2,a.height=2,b=a.getContext('2d'),c=b.getImageData(0,0,2,2),c.data.set(new Uint8ClampedArray([0,0,0,0,255,255,255,255,0,0,0,0,255,255,255,255])),b.putImageData(c,0,0),a},j(),f=function(a,q){var f,m,d,g,h,b,i,l,k,n,o,e,c,p;if(b=a.createProgram(),c=a.createShader(a.VERTEX_SHADER),a.attachShader(b,c),a.shaderSource(c,'attribute vec2 position;\nvoid main(){\n gl_Position = vec4(position, 0.0, 1.0);\n}'),a.compileShader(c),!a.getShaderParameter(c,a.COMPILE_STATUS))throw a.getShaderInfoLog(c);if(d=a.createShader(a.FRAGMENT_SHADER),a.attachShader(b,d),a.shaderSource(d,'uniform sampler2D source;\nvoid main(){\n gl_FragColor = texture2D(source, vec2(1.0, 1.0));\n}'),a.compileShader(d),!a.getShaderParameter(d,a.COMPILE_STATUS))throw a.getShaderInfoLog(d);if(a.linkProgram(b),!a.getProgramParameter(b,a.LINK_STATUS))throw a.getProgramInfoLog(b);return a.useProgram(b),m=function(){return a.deleteShader(d),a.deleteShader(c),a.deleteProgram(b),a.deleteBuffer(f),a.deleteTexture(k),a.deleteTexture(e),a.deleteFramebuffer(g),a.bindBuffer(a.ARRAY_BUFFER,null),a.useProgram(null),a.bindTexture(a.TEXTURE_2D,null),a.bindFramebuffer(a.FRAMEBUFFER,null)},e=a.createTexture(),a.bindTexture(a.TEXTURE_2D,e),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,2,2,0,a.RGBA,a.UNSIGNED_BYTE,null),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR),g=a.createFramebuffer(),a.bindFramebuffer(a.FRAMEBUFFER,g),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,e,0),n=j(),k=a.createTexture(),a.bindTexture(a.TEXTURE_2D,k),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,q,n),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR),p=new Float32Array([1,1,-1,1,-1,-1,1,1,-1,-1,1,-1]),f=a.createBuffer(),a.bindBuffer(a.ARRAY_BUFFER,f),a.bufferData(a.ARRAY_BUFFER,p,a.STATIC_DRAW),h=a.getAttribLocation(b,'position'),o=a.getUniformLocation(b,'source'),a.enableVertexAttribArray(h),a.vertexAttribPointer(h,2,a.FLOAT,!1,0,0),a.uniform1i(o,0),a.drawArrays(a.TRIANGLES,0,6),i=new Uint8Array(16),a.readPixels(0,0,2,2,a.RGBA,a.UNSIGNED_BYTE,i),l=Math.abs(i[0]-127)<10,m(),l},d=function(a,c){var b;return b=a.createTexture(),a.bindTexture(a.TEXTURE_2D,b),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,2,2,0,a.RGBA,c,null),a.getError()===0?(a.deleteTexture(b),!0):(a.deleteTexture(b),!1)},e=function(a,e){var d,c,b;return b=a.createTexture(),a.bindTexture(a.TEXTURE_2D,b),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,2,2,0,a.RGBA,e,null),c=a.createFramebuffer(),a.bindFramebuffer(a.FRAMEBUFFER,c),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,b,0),d=a.checkFramebufferStatus(a.FRAMEBUFFER),a.deleteTexture(b),a.deleteFramebuffer(c),a.bindTexture(a.TEXTURE_2D,null),a.bindFramebuffer(a.FRAMEBUFFER,null),d===a.FRAMEBUFFER_COMPLETE?!0:!1},a=[],c={},b=[],l=function(){var l,h,g,i,j,m,k;l=document.createElement('canvas'),g=null;try{g=l.getContext('experimental-webgl'),g===null&&(g=l.getContext('webgl'))}catch(a){}return g!=null&&(m=g.getExtension('OES_texture_float'),m===null?d(g,g.FLOAT)?(k=!0,a.push('OES_texture_float'),c.OES_texture_float={shim:!0}):(k=!1,b.push('OES_texture_float')):d(g,g.FLOAT)?(k=!0,a.push('OES_texture_float')):(k=!1,b.push('OES_texture_float')),k&&(h=g.getExtension('WEBGL_color_buffer_float'),h===null?e(g,g.FLOAT)?(a.push('WEBGL_color_buffer_float'),c.WEBGL_color_buffer_float={shim:!0,RGBA32F_EXT:34836,RGB32F_EXT:34837,FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT:33297,UNSIGNED_NORMALIZED_EXT:35863}):b.push('WEBGL_color_buffer_float'):e(g,g.FLOAT)?a.push('WEBGL_color_buffer_float'):b.push('WEBGL_color_buffer_float'),h=g.getExtension('OES_texture_float_linear'),h===null?f(g,g.FLOAT)?(a.push('OES_texture_float_linear'),c.OES_texture_float_linear={shim:!0}):b.push('OES_texture_float_linear'):f(g,g.FLOAT)?a.push('OES_texture_float_linear'):b.push('OES_texture_float_linear')),i=g.getExtension('OES_texture_half_float'),i===null?d(g,36193)?(j=!0,a.push('OES_texture_half_float'),i=c.OES_texture_half_float={HALF_FLOAT_OES:36193,shim:!0}):(j=!1,b.push('OES_texture_half_float')):d(g,i.HALF_FLOAT_OES)?(j=!0,a.push('OES_texture_half_float')):(j=!1,b.push('OES_texture_half_float')),j)?(h=g.getExtension('EXT_color_buffer_half_float'),h===null?e(g,i.HALF_FLOAT_OES)?(a.push('EXT_color_buffer_half_float'),c.EXT_color_buffer_half_float={shim:!0,RGBA16F_EXT:34842,RGB16F_EXT:34843,FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT:33297,UNSIGNED_NORMALIZED_EXT:35863}):b.push('EXT_color_buffer_half_float'):e(g,i.HALF_FLOAT_OES)?a.push('EXT_color_buffer_half_float'):b.push('EXT_color_buffer_half_float'),h=g.getExtension('OES_texture_half_float_linear'),h===null?f(g,i.HALF_FLOAT_OES)?(a.push('OES_texture_half_float_linear'),c.OES_texture_half_float_linear={shim:!0}):b.push('OES_texture_half_float_linear'):f(g,i.HALF_FLOAT_OES)?a.push('OES_texture_half_float_linear'):b.push('OES_texture_half_float_linear')):void 0},window.WebGLRenderingContext!=null){for(l(),h={},i=0,n=b.length;i<n;i++)g=b[i],h[g]=!0;return m=WebGLRenderingContext.prototype.getExtension,WebGLRenderingContext.prototype.getExtension=function(a){var b;return b=c[a],b===void 0?h[a]?null:m.call(this,a):b},k=WebGLRenderingContext.prototype.getSupportedExtensions,WebGLRenderingContext.prototype.getSupportedExtensions=function(){var b,c,f,d,e,g,i;for(f=k.call(this),c=[],d=0,g=f.length;d<g;d++)b=f[d],h[b]===void 0&&c.push(b);for(e=0,i=a.length;e<i;e++)b=a[e],__indexOf.call(c,b)<0&&c.push(b);return c},WebGLRenderingContext.prototype.getFloatExtension=function(b){var c,d,l,B,t,e,f,r,s,a,k,z,u,q,n,h,i,j,v,w,x,y,o,A,p,m;for(b.prefer==null&&(b.prefer=['half']),b.require==null&&(b.require=[]),b.throws==null&&(b.throws=!0),q=this.getExtension('OES_texture_float'),e=this.getExtension('OES_texture_half_float'),z=this.getExtension('WEBGL_color_buffer_float'),B=this.getExtension('EXT_color_buffer_half_float'),u=this.getExtension('OES_texture_float_linear'),t=this.getExtension('OES_texture_half_float_linear'),k={texture:q!==null,filterable:u!==null,renderable:z!==null,score:0,precision:'single',half:!1,single:!0,type:this.FLOAT},l={texture:e!==null,filterable:t!==null,renderable:B!==null,score:0,precision:'half',half:!0,single:!1,type:(A=e!=null?e.HALF_FLOAT_OES:void 0)!=null?A:null},d=[],k.texture&&d.push(k),l.texture&&d.push(l),a=[],h=0,v=d.length;h<v;h++){for(c=d[h],n=!0,p=b.require,i=0,w=p.length;i<w;i++)g=p[i],c[g]===!1&&(n=!1);n&&a.push(c)}for(j=0,x=a.length;j<x;j++)for(c=a[j],m=b.prefer,f=o=0,y=m.length;o<y;f=++o)s=m[f],r=Math.pow(2,b.prefer.length-f-1),c[s]&&(c.score+=r);if(a.sort(function(a,b){return a.score===b.score?0:a.score<b.score?1:a.score>b.score?-1:void 0}),a.length===0)if(b.throws)throw'No floating point texture support that is '+b.require.join(', ');else return null;else return a=a[0],{filterable:a.filterable,renderable:a.renderable,type:a.type,precision:a.precision}}}},c(),i(),f=function(){function c(o){var r,l,q,i,c,f,h,m,p,e,d,n;d=o!=null?o:{},this.canvas=d.canvas,this.width=d.width,this.height=d.height,h=d.intensityToAlpha,c=d.gradientTexture,l=d.alphaRange,this.canvas||(this.canvas=document.createElement('canvas'));try{if(this.gl=this.canvas.getContext('experimental-webgl',{depth:!1,antialias:!1}),this.gl===null&&(this.gl=this.canvas.getContext('webgl',{depth:!1,antialias:!1}),this.gl===null))throw'WebGL not supported'}catch(a){throw'WebGL not supported'}window.WebGLDebugUtils!=null&&(console.log('debugging mode'),this.gl=WebGLDebugUtils.makeDebugContext(this.gl,function(a,b,c){throw WebGLDebugUtils.glEnumToString(a)+' was caused by call to: '+b})),this.gl.enableVertexAttribArray(0),this.gl.blendFunc(this.gl.ONE,this.gl.ONE),c?(e=this.gradientTexture=new k(this.gl,{channels:'rgba'}).bind(0).setSize(2,2).nearest().clampToEdge(),typeof c==='string'?(f=new Image,f.onload=function(){return e.bind().upload(f)},f.src=c):c.width>0&&c.height>0?e.upload(c):c.onload=function(){return e.upload(c)},i='uniform sampler2D gradientTexture;\nvec3 getColor(float intensity){\n return texture2D(gradientTexture, vec2(intensity, 0.0)).rgb;\n}'):(e=null,i='vec3 getColor(float intensity){\n vec3 blue = vec3(0.0, 0.0, 1.0);\n vec3 cyan = vec3(0.0, 1.0, 1.0);\n vec3 green = vec3(0.0, 1.0, 0.0);\n vec3 yellow = vec3(1.0, 1.0, 0.0);\n vec3 red = vec3(1.0, 0.0, 0.0);\n\n vec3 color = (\n fade(-0.25, 0.25, intensity)*blue +\n fade(0.0, 0.5, intensity)*cyan +\n fade(0.25, 0.75, intensity)*green +\n fade(0.5, 1.0, intensity)*yellow +\n smoothstep(0.75, 1.0, intensity)*red\n );\n return color;\n}'),h==null&&(h=!0),h?(n=l!=null?l:[0,1],q=n[0],r=n[1],m='vec4 alphaFun(vec3 color, float intensity){\n float alpha = smoothstep('+q.toFixed(8)+', '+r.toFixed(8)+', intensity);\n return vec4(color*alpha, alpha);\n}'):m='vec4 alphaFun(vec3 color, float intensity){\n return vec4(color, 1.0);\n}',this.shader=new b(this.gl,{vertex:j,fragment:g+('float linstep(float low, float high, float value){\n return clamp((value-low)/(high-low), 0.0, 1.0);\n}\n\nfloat fade(float low, float high, float value){\n float mid = (low+high)*0.5;\n float range = (high-low)*0.5;\n float x = 1.0 - clamp(abs(mid-value)/range, 0.0, 1.0);\n return smoothstep(0.0, 1.0, x);\n}\n\n'+i+'\n'+m+'\n\nvoid main(){\n float intensity = smoothstep(0.0, 1.0, texture2D(source, texcoord).r);\n vec3 color = getColor(intensity);\n gl_FragColor = alphaFun(color, intensity);\n}')}),this.width==null&&(this.width=this.canvas.offsetWidth||2),this.height==null&&(this.height=this.canvas.offsetHeight||2),this.canvas.width=this.width,this.canvas.height=this.height,this.gl.viewport(0,0,this.width,this.height),this.quad=this.gl.createBuffer(),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.quad),p=new Float32Array([-1,-1,0,1,1,-1,0,1,-1,1,0,1,-1,1,0,1,1,-1,0,1,1,1,0,1]),this.gl.bufferData(this.gl.ARRAY_BUFFER,p,this.gl.STATIC_DRAW),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,null),this.heights=new a(this,this.gl,this.width,this.height)}return c.prototype.adjustSize=function(){var a,b;return b=this.canvas.offsetWidth||2,a=this.canvas.offsetHeight||2,this.width!==b||this.height!==a?(this.gl.viewport(0,0,b,a),this.canvas.width=b,this.canvas.height=a,this.width=b,this.height=a,this.heights.resize(this.width,this.height)):void 0},c.prototype.display=function(){return this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.quad),this.gl.vertexAttribPointer(0,4,this.gl.FLOAT,!1,0,0),this.heights.nodeFront.bind(0),this.gradientTexture&&this.gradientTexture.bind(1),this.shader.use().int('source',0).int('gradientTexture',1),this.gl.drawArrays(this.gl.TRIANGLES,0,6)},c.prototype.update=function(){return this.heights.update()},c.prototype.clear=function(){return this.heights.clear()},c.prototype.clamp=function(a,b){return a==null&&(a=0),b==null&&(b=1),this.heights.clamp(a,b)},c.prototype.multiply=function(a){return a==null&&(a=.95),this.heights.multiply(a)},c.prototype.blur=function(){return this.heights.blur()},c.prototype.addPoint=function(a,b,c,d){return this.heights.addPoint(a,b,c,d)},c.prototype.addPoints=function(d){var a,b,e,c;for(c=[],b=0,e=d.length;b<e;b++)a=d[b],c.push(this.addPoint(a.x,a.y,a.size,a.intensity));return c},c}(),e.options={intensity:.2,lat:l.getLat,lng:l.getLng,size:function(){return 3},quality:1,container:'tilePane',clearPhi:0},e=m.extend(e,{addTo:function(a){if(!a)return;this._map=a,this.transfer=a.latLngToContainerPoint.bind(a),this.initialize()},initialize:function(){var g=this.options,b=g.container,c;if(typeof b==='string'){var d,e,i=this._map.getPanes();b=i[b]}else b=l.getContainer(b);var h=this._map.getSize(),d=h.x,e=h.y,c=g.quality,a=document.createElement('<canvas width="'+d*c+'" height="'+e*c+'"><canvas>');a.style.position='absolute',a.style.left='0',a.style.top='0',a.style.pointerEvents='none',a.style.width=d+'px',a.style.height=e+'px',b.appendChild(a),this.heatmap=new f({canvas:a}),this.initEvents()},data:function(a){this._data=a},render:function(c){c&&this.data(c);var a=this.options,i=this.transfer,b=this.heatmap;b.multiply(a.clearPhi);var o=a.intensity,g=a.lat,h=a.lng,f=a.size;c=this._data;var j=this._map.getZoom(),d,l,m,e,p;for(var k in c)d=c[k],l=g(d),m=h(d),latlng=n.latLng(l,m),e=i(latlng),p=f(d,j),b.addPoint(e.x,e.y,p,o);b.update(),b.display()},resetPos:function(){var b=this.canvas[0],a=n.DomUtil.getPosition(this._map.getPanes().mapPane);a&&n.DomUtil.setPosition(b,{x:-a.x,y:-a.y})},clean:function(){var a=this.heatmap;a.multiply(0),a.update(),a.display()},initEvents:function(){var a=this,b=this.heatmap;this._map.on('moveend',function(){a.resetPos(),a.render()}).on('zoomstart',function(){a.clean()})}}),n=n||{},n.dmap=n.dmap||{},n.dmap.webGLHeatmap=function(a){return new e(a)},module.exports=e | ||
function b(a){var a=this.options=c.deepMerge(b.options,a)}var n,d,o,e,f,g,l,i,j,k=require('./gl/texture');__indexOf=[].indexOf||function(c){for(var a=0,b=this.length;a<b;a++)if(a in this&&this[a]===c)return a;return-1};var c=require('./../core/utils'),h=require('bcore/event'),a=require('./../leaflet'),m=require('./../render/canvas'),d=require('./gl/heights'),e=require('./gl/shader');j=require('./gl/vertexShaderBlit'),g=require('./gl/fragmentShaderBlit'),l=function(){var a,d,b,c;return window.WebGLRenderingContext!=null?(c=['WEBKIT','MOZ','MS','O'],b=/^WEBKIT_(.*)|MOZ_(.*)|MS_(.*)|O_(.*)/,a=WebGLRenderingContext.prototype.getExtension,WebGLRenderingContext.prototype.getExtension=function(e){var d,g,h,f,i;if(g=e.match(b),g!==null&&(e=g[1]),d=a.call(this,e),d===null){for(f=0,i=c.length;f<i;f++)if(h=c[f],d=a.call(this,h+'_'+e),d!==null)return d;return null}else return d},d=WebGLRenderingContext.prototype.getSupportedExtensions,WebGLRenderingContext.prototype.getSupportedExtensions=function(){var a,f,c,g,e,h;for(g=d.call(this),c=[],e=0,h=g.length;e<h;e++)a=g[e],f=a.match(b),f!==null&&(a=f[1]),__indexOf.call(c,a)<0&&c.push(a);return c}):void 0},i=function(){var e,f,l,d,j,m,k,g,a,c,b,h,i,n;if(j=function(){var a,b,c;return a=document.createElement('canvas'),a.width=2,a.height=2,b=a.getContext('2d'),c=b.getImageData(0,0,2,2),c.data.set(new Uint8ClampedArray([0,0,0,0,255,255,255,255,0,0,0,0,255,255,255,255])),b.putImageData(c,0,0),a},j(),f=function(a,q){var f,m,d,g,h,b,i,l,k,n,o,e,c,p;if(b=a.createProgram(),c=a.createShader(a.VERTEX_SHADER),a.attachShader(b,c),a.shaderSource(c,'attribute vec2 position;\nvoid main(){\n gl_Position = vec4(position, 0.0, 1.0);\n}'),a.compileShader(c),!a.getShaderParameter(c,a.COMPILE_STATUS))throw a.getShaderInfoLog(c);if(d=a.createShader(a.FRAGMENT_SHADER),a.attachShader(b,d),a.shaderSource(d,'uniform sampler2D source;\nvoid main(){\n gl_FragColor = texture2D(source, vec2(1.0, 1.0));\n}'),a.compileShader(d),!a.getShaderParameter(d,a.COMPILE_STATUS))throw a.getShaderInfoLog(d);if(a.linkProgram(b),!a.getProgramParameter(b,a.LINK_STATUS))throw a.getProgramInfoLog(b);return a.useProgram(b),m=function(){return a.deleteShader(d),a.deleteShader(c),a.deleteProgram(b),a.deleteBuffer(f),a.deleteTexture(k),a.deleteTexture(e),a.deleteFramebuffer(g),a.bindBuffer(a.ARRAY_BUFFER,null),a.useProgram(null),a.bindTexture(a.TEXTURE_2D,null),a.bindFramebuffer(a.FRAMEBUFFER,null)},e=a.createTexture(),a.bindTexture(a.TEXTURE_2D,e),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,2,2,0,a.RGBA,a.UNSIGNED_BYTE,null),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR),g=a.createFramebuffer(),a.bindFramebuffer(a.FRAMEBUFFER,g),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,e,0),n=j(),k=a.createTexture(),a.bindTexture(a.TEXTURE_2D,k),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,q,n),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR),p=new Float32Array([1,1,-1,1,-1,-1,1,1,-1,-1,1,-1]),f=a.createBuffer(),a.bindBuffer(a.ARRAY_BUFFER,f),a.bufferData(a.ARRAY_BUFFER,p,a.STATIC_DRAW),h=a.getAttribLocation(b,'position'),o=a.getUniformLocation(b,'source'),a.enableVertexAttribArray(h),a.vertexAttribPointer(h,2,a.FLOAT,!1,0,0),a.uniform1i(o,0),a.drawArrays(a.TRIANGLES,0,6),i=new Uint8Array(16),a.readPixels(0,0,2,2,a.RGBA,a.UNSIGNED_BYTE,i),l=Math.abs(i[0]-127)<10,m(),l},d=function(a,c){var b;return b=a.createTexture(),a.bindTexture(a.TEXTURE_2D,b),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,2,2,0,a.RGBA,c,null),a.getError()===0?(a.deleteTexture(b),!0):(a.deleteTexture(b),!1)},e=function(a,e){var d,c,b;return b=a.createTexture(),a.bindTexture(a.TEXTURE_2D,b),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,2,2,0,a.RGBA,e,null),c=a.createFramebuffer(),a.bindFramebuffer(a.FRAMEBUFFER,c),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,b,0),d=a.checkFramebufferStatus(a.FRAMEBUFFER),a.deleteTexture(b),a.deleteFramebuffer(c),a.bindTexture(a.TEXTURE_2D,null),a.bindFramebuffer(a.FRAMEBUFFER,null),d===a.FRAMEBUFFER_COMPLETE?!0:!1},a=[],c={},b=[],l=function(){var l,h,g,i,j,m,k;l=document.createElement('canvas'),g=null;try{g=l.getContext('experimental-webgl'),g===null&&(g=l.getContext('webgl'))}catch(a){}return g!=null&&(m=g.getExtension('OES_texture_float'),m===null?d(g,g.FLOAT)?(k=!0,a.push('OES_texture_float'),c.OES_texture_float={shim:!0}):(k=!1,b.push('OES_texture_float')):d(g,g.FLOAT)?(k=!0,a.push('OES_texture_float')):(k=!1,b.push('OES_texture_float')),k&&(h=g.getExtension('WEBGL_color_buffer_float'),h===null?e(g,g.FLOAT)?(a.push('WEBGL_color_buffer_float'),c.WEBGL_color_buffer_float={shim:!0,RGBA32F_EXT:34836,RGB32F_EXT:34837,FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT:33297,UNSIGNED_NORMALIZED_EXT:35863}):b.push('WEBGL_color_buffer_float'):e(g,g.FLOAT)?a.push('WEBGL_color_buffer_float'):b.push('WEBGL_color_buffer_float'),h=g.getExtension('OES_texture_float_linear'),h===null?f(g,g.FLOAT)?(a.push('OES_texture_float_linear'),c.OES_texture_float_linear={shim:!0}):b.push('OES_texture_float_linear'):f(g,g.FLOAT)?a.push('OES_texture_float_linear'):b.push('OES_texture_float_linear')),i=g.getExtension('OES_texture_half_float'),i===null?d(g,36193)?(j=!0,a.push('OES_texture_half_float'),i=c.OES_texture_half_float={HALF_FLOAT_OES:36193,shim:!0}):(j=!1,b.push('OES_texture_half_float')):d(g,i.HALF_FLOAT_OES)?(j=!0,a.push('OES_texture_half_float')):(j=!1,b.push('OES_texture_half_float')),j)?(h=g.getExtension('EXT_color_buffer_half_float'),h===null?e(g,i.HALF_FLOAT_OES)?(a.push('EXT_color_buffer_half_float'),c.EXT_color_buffer_half_float={shim:!0,RGBA16F_EXT:34842,RGB16F_EXT:34843,FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT:33297,UNSIGNED_NORMALIZED_EXT:35863}):b.push('EXT_color_buffer_half_float'):e(g,i.HALF_FLOAT_OES)?a.push('EXT_color_buffer_half_float'):b.push('EXT_color_buffer_half_float'),h=g.getExtension('OES_texture_half_float_linear'),h===null?f(g,i.HALF_FLOAT_OES)?(a.push('OES_texture_half_float_linear'),c.OES_texture_half_float_linear={shim:!0}):b.push('OES_texture_half_float_linear'):f(g,i.HALF_FLOAT_OES)?a.push('OES_texture_half_float_linear'):b.push('OES_texture_half_float_linear')):void 0},window.WebGLRenderingContext!=null){for(l(),h={},i=0,n=b.length;i<n;i++)g=b[i],h[g]=!0;return m=WebGLRenderingContext.prototype.getExtension,WebGLRenderingContext.prototype.getExtension=function(a){var b;return b=c[a],b===void 0?h[a]?null:m.call(this,a):b},k=WebGLRenderingContext.prototype.getSupportedExtensions,WebGLRenderingContext.prototype.getSupportedExtensions=function(){var b,c,f,d,e,g,i;for(f=k.call(this),c=[],d=0,g=f.length;d<g;d++)b=f[d],h[b]===void 0&&c.push(b);for(e=0,i=a.length;e<i;e++)b=a[e],__indexOf.call(c,b)<0&&c.push(b);return c},WebGLRenderingContext.prototype.getFloatExtension=function(b){var c,d,l,B,t,e,f,r,s,a,k,z,u,q,n,h,i,j,v,w,x,y,o,A,p,m;for(b.prefer==null&&(b.prefer=['half']),b.require==null&&(b.require=[]),b.throws==null&&(b.throws=!0),q=this.getExtension('OES_texture_float'),e=this.getExtension('OES_texture_half_float'),z=this.getExtension('WEBGL_color_buffer_float'),B=this.getExtension('EXT_color_buffer_half_float'),u=this.getExtension('OES_texture_float_linear'),t=this.getExtension('OES_texture_half_float_linear'),k={texture:q!==null,filterable:u!==null,renderable:z!==null,score:0,precision:'single',half:!1,single:!0,type:this.FLOAT},l={texture:e!==null,filterable:t!==null,renderable:B!==null,score:0,precision:'half',half:!0,single:!1,type:(A=e!=null?e.HALF_FLOAT_OES:void 0)!=null?A:null},d=[],k.texture&&d.push(k),l.texture&&d.push(l),a=[],h=0,v=d.length;h<v;h++){for(c=d[h],n=!0,p=b.require,i=0,w=p.length;i<w;i++)g=p[i],c[g]===!1&&(n=!1);n&&a.push(c)}for(j=0,x=a.length;j<x;j++)for(c=a[j],m=b.prefer,f=o=0,y=m.length;o<y;f=++o)s=m[f],r=Math.pow(2,b.prefer.length-f-1),c[s]&&(c.score+=r);if(a.sort(function(a,b){return a.score===b.score?0:a.score<b.score?1:a.score>b.score?-1:void 0}),a.length===0)if(b.throws)throw'No floating point texture support that is '+b.require.join(', ');else return null;else return a=a[0],{filterable:a.filterable,renderable:a.renderable,type:a.type,precision:a.precision}}}},l(),i(),f=function(){function a(o){var r,l,q,i,a,f,h,m,p,c,b,n;b=o!=null?o:{},this.canvas=b.canvas,this.width=b.width,this.height=b.height,h=b.intensityToAlpha,a=b.gradientTexture,l=b.alphaRange,this.canvas||(this.canvas=document.createElement('canvas'));try{if(this.gl=this.canvas.getContext('experimental-webgl',{depth:!1,antialias:!1}),this.gl===null&&(this.gl=this.canvas.getContext('webgl',{depth:!1,antialias:!1}),this.gl===null))throw'WebGL not supported'}catch(a){throw'WebGL not supported'}window.WebGLDebugUtils!=null&&(console.log('debugging mode'),this.gl=WebGLDebugUtils.makeDebugContext(this.gl,function(a,b,c){throw WebGLDebugUtils.glEnumToString(a)+' was caused by call to: '+b})),this.gl.enableVertexAttribArray(0),this.gl.blendFunc(this.gl.ONE,this.gl.ONE),a?(c=this.gradientTexture=new k(this.gl,{channels:'rgba'}).bind(0).setSize(2,2).nearest().clampToEdge(),typeof a==='string'?(f=new Image,f.onload=function(){return c.bind().upload(f)},f.src=a):a.width>0&&a.height>0?c.upload(a):a.onload=function(){return c.upload(a)},i='uniform sampler2D gradientTexture;\nvec3 getColor(float intensity){\n return texture2D(gradientTexture, vec2(intensity, 0.0)).rgb;\n}'):(c=null,i='vec3 getColor(float intensity){\n vec3 blue = vec3(0.0, 0.0, 1.0);\n vec3 cyan = vec3(0.0, 1.0, 1.0);\n vec3 green = vec3(0.0, 1.0, 0.0);\n vec3 yellow = vec3(1.0, 1.0, 0.0);\n vec3 red = vec3(1.0, 0.0, 0.0);\n\n vec3 color = (\n fade(-0.25, 0.25, intensity)*blue +\n fade(0.0, 0.5, intensity)*cyan +\n fade(0.25, 0.75, intensity)*green +\n fade(0.5, 1.0, intensity)*yellow +\n smoothstep(0.75, 1.0, intensity)*red\n );\n return color;\n}'),h==null&&(h=!0),h?(n=l!=null?l:[0,1],q=n[0],r=n[1],m='vec4 alphaFun(vec3 color, float intensity){\n float alpha = smoothstep('+q.toFixed(8)+', '+r.toFixed(8)+', intensity);\n return vec4(color*alpha, alpha);\n}'):m='vec4 alphaFun(vec3 color, float intensity){\n return vec4(color, 1.0);\n}',this.shader=new e(this.gl,{vertex:j,fragment:g+('float linstep(float low, float high, float value){\n return clamp((value-low)/(high-low), 0.0, 1.0);\n}\n\nfloat fade(float low, float high, float value){\n float mid = (low+high)*0.5;\n float range = (high-low)*0.5;\n float x = 1.0 - clamp(abs(mid-value)/range, 0.0, 1.0);\n return smoothstep(0.0, 1.0, x);\n}\n\n'+i+'\n'+m+'\n\nvoid main(){\n float intensity = smoothstep(0.0, 1.0, texture2D(source, texcoord).r);\n vec3 color = getColor(intensity);\n gl_FragColor = alphaFun(color, intensity);\n}')}),this.width==null&&(this.width=this.canvas.offsetWidth||2),this.height==null&&(this.height=this.canvas.offsetHeight||2),this.canvas.width=this.width,this.canvas.height=this.height,this.gl.viewport(0,0,this.width,this.height),this.quad=this.gl.createBuffer(),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.quad),p=new Float32Array([-1,-1,0,1,1,-1,0,1,-1,1,0,1,-1,1,0,1,1,-1,0,1,1,1,0,1]),this.gl.bufferData(this.gl.ARRAY_BUFFER,p,this.gl.STATIC_DRAW),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,null),this.heights=new d(this,this.gl,this.width,this.height)}return a.prototype.adjustSize=function(){var a,b;return b=this.canvas.offsetWidth||2,a=this.canvas.offsetHeight||2,this.width!==b||this.height!==a?(this.gl.viewport(0,0,b,a),this.canvas.width=b,this.canvas.height=a,this.width=b,this.height=a,this.heights.resize(this.width,this.height)):void 0},a.prototype.display=function(){return this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.quad),this.gl.vertexAttribPointer(0,4,this.gl.FLOAT,!1,0,0),this.heights.nodeFront.bind(0),this.gradientTexture&&this.gradientTexture.bind(1),this.shader.use().int('source',0).int('gradientTexture',1),this.gl.drawArrays(this.gl.TRIANGLES,0,6)},a.prototype.update=function(){return this.heights.update()},a.prototype.clear=function(){return this.heights.clear()},a.prototype.clamp=function(a,b){return a==null&&(a=0),b==null&&(b=1),this.heights.clamp(a,b)},a.prototype.multiply=function(a){return a==null&&(a=.95),this.heights.multiply(a)},a.prototype.blur=function(){return this.heights.blur()},a.prototype.addPoint=function(a,b,c,d){return this.heights.addPoint(a,b,c,d)},a.prototype.addPoints=function(d){var a,b,e,c;for(c=[],b=0,e=d.length;b<e;b++)a=d[b],c.push(this.addPoint(a.x,a.y,a.size,a.intensity));return c},a}(),b.options={intensity:.2,lat:c.getLat,lng:c.getLng,size:function(){return 3},quality:1,container:'tilePane',clearPhi:0},b=h.extend(b,{addTo:function(a){if(!a)return;this._map=a,this.transfer=a.latLngToContainerPoint.bind(a),this.initialize()},initialize:function(){var h=this.options,b=h.container,d;if(typeof b==='string'){var e,g,j=this._map.getPanes();b=j[b]}else b=c.getContainer(b);var i=this._map.getSize(),e=i.x,g=i.y,d=h.quality,a=document.createElement('<canvas width="'+e*d+'" height="'+g*d+'"><canvas>');a.style.position='absolute',a.style.left='0',a.style.top='0',a.style.pointerEvents='none',a.style.width=e+'px',a.style.height=g+'px',b.appendChild(a),this.heatmap=new f({canvas:a}),this.initEvents()},data:function(a){this._data=a},render:function(d){d&&this.data(d);var b=this.options,j=this.transfer,c=this.heatmap;c.multiply(b.clearPhi);var o=b.intensity,h=b.lat,i=b.lng,g=b.size;d=this._data;var k=this._map.getZoom(),e,m,n,f,p;for(var l in d)e=d[l],m=h(e),n=i(e),latlng=a.latLng(m,n),f=j(latlng),p=g(e,k),c.addPoint(f.x,f.y,p,o);c.update(),c.display()},resetPos:function(){var c=this.canvas[0],b=a.DomUtil.getPosition(this._map.getPanes().mapPane);b&&a.DomUtil.setPosition(c,{x:-b.x,y:-b.y})},clean:function(){var a=this.heatmap;a.multiply(0),a.update(),a.display()},initEvents:function(){var a=this,b=this.heatmap;this._map.on('moveend',function(){a.resetPos(),a.render()}).on('zoomstart',function(){a.clean()})}}),a=a||{},a.dmap=a.dmap||{},a.dmap.webGLHeatmap=function(a){return new b(a)},module.exports=b |
@@ -1,1 +0,1 @@ | ||
var a=require('../../leaflet.js'),b=require('./CanvasLayerBase.js'),c=require('./webgl-heatmap.js'),d=require('lodash'),e=b.extend({options:{colorStop1:'rgb(0,0,255)',colorStop2:'rgb(0,255,255)',colorStop3:'rgb(0,255,0)',colorStop4:'rgb(255,255,0)',colorStop5:'rgb(255,0,0)',multiply:1,opacity:1,size:15,units:'px',alphaStart:0,alphaEnd:1,intensity:.2,getLat:function(a){return a[1]},getLng:function(a){return a[0]},getValue:function(a){return a[2]||1}},initialize:function(b){a.setOptions(this,b)},updateOptions:function(b){a.setOptions(this,b),this._canvas.style.opacity=this.options.opacity,this.updateHeatmapOptions(),this._redraw()},_initColorPalette:function(){var c=this.options,d=[c.colorStop1,c.colorStop2,c.colorStop3,c.colorStop4,c.colorStop5],a=document.createElement('canvas'),e=a.getContext('2d');a.width=512,a.height=10;var b=e.createLinearGradient(0,0,a.width,0);return b.addColorStop(.2,d[0]),b.addColorStop(.4,d[1]),b.addColorStop(.6,d[2]),b.addColorStop(.8,d[3]),b.addColorStop(1,d[4]),e.fillStyle=b,e.fillRect(0,0,a.width,a.height),this.gradientTexture=a,a},updateHeatmapOptions:function(){var a=this._initColorPalette();this.heatmap.updateOptions(a,this.options.alphaStart,this.options.alphaEnd)},otherInit:function(){this._initColorPalette(),this.heatmap=new c({canvas:this._canvas,gradientTexture:this.gradientTexture,intensityToAlpha:!0,alphaRange:[this.options.alphaStart,this.options.alphaEnd]})},setData:function(a){if(!a)return;this.data=a,this._redraw()},addPoint:function(a){this.data.push(a),this._redraw()},_redraw:function(){var b=this.heatmap;b.clear();var c=this._map,f=c.getBounds();if(!this.data.length)return;var g=this.options.getLat,h=this.options.getLng,i=this.options.getValue,e=this;d.forEach(this.data,function(d){var j=g(d),k=h(d),n=i(d),l=a.latLng(j,k);if(f.contains([j,k])){var m=c.latLngToContainerPoint(l);b.addPoint(Math.floor(m.x),Math.floor(m.y),e._scale(l),e.options.intensity*n)}}),b.update(),b.multiply(this.options.multiply),b.display()},_scale:function(b){if(this.options.units=='px')return this.options.size;var c=this._map,d=this.options.size/40075017*360/Math.cos(a.LatLng.DEG_TO_RAD*b.lat),e=new a.LatLng(b.lat,b.lng-d),f=c.latLngToLayerPoint(b),g=c.latLngToLayerPoint(e);return Math.max(Math.round(f.x-g.x),1)},onResize:function(){this.heatmap.adjustSize()},destory:function(){this.onRemove(this._map),this._map.off('resize',this.onResize,this),this.data=[],this.gradientTexture=null},initEvents:function(){this._map.on('resize',this.onResize,this)}}),f=a.dmap=a.dmap||{};f.HeatMapLayer=e,f.heatMapLayer=function(a){return new e(a)},module.exports=e | ||
var a=require('../../leaflet.js'),d=require('./CanvasLayerBase.js'),e=require('./webgl-heatmap.js'),f=require('lodash'),b=d.extend({options:{colorStop1:'rgb(0,0,255)',colorStop2:'rgb(0,255,255)',colorStop3:'rgb(0,255,0)',colorStop4:'rgb(255,255,0)',colorStop5:'rgb(255,0,0)',multiply:1,opacity:1,size:15,units:'px',alphaStart:0,alphaEnd:1,intensity:.2,getLat:function(a){return a[1]},getLng:function(a){return a[0]},getValue:function(a){return a[2]||1}},initialize:function(b){a.setOptions(this,b)},updateOptions:function(b){a.setOptions(this,b),this._canvas.style.opacity=this.options.opacity,this.updateHeatmapOptions(),this._redraw()},_initColorPalette:function(){var c=this.options,d=[c.colorStop1,c.colorStop2,c.colorStop3,c.colorStop4,c.colorStop5],a=document.createElement('canvas'),e=a.getContext('2d');a.width=512,a.height=10;var b=e.createLinearGradient(0,0,a.width,0);return b.addColorStop(.2,d[0]),b.addColorStop(.4,d[1]),b.addColorStop(.6,d[2]),b.addColorStop(.8,d[3]),b.addColorStop(1,d[4]),e.fillStyle=b,e.fillRect(0,0,a.width,a.height),this.gradientTexture=a,a},updateHeatmapOptions:function(){var a=this._initColorPalette();this.heatmap.updateOptions(a,this.options.alphaStart,this.options.alphaEnd)},otherInit:function(){this._initColorPalette(),this.heatmap=new e({canvas:this._canvas,gradientTexture:this.gradientTexture,intensityToAlpha:!0,alphaRange:[this.options.alphaStart,this.options.alphaEnd]})},setData:function(a){if(!a)return;this.data=a,this._redraw()},addPoint:function(a){this.data.push(a),this._redraw()},_redraw:function(){var b=this.heatmap;b.clear();var c=this._map,e=c.getBounds();if(!this.data.length)return;var g=this.options.getLat,h=this.options.getLng,i=this.options.getValue,d=this;f.forEach(this.data,function(f){var j=g(f),k=h(f),n=i(f),l=a.latLng(j,k);if(e.contains([j,k])){var m=c.latLngToContainerPoint(l);b.addPoint(Math.floor(m.x),Math.floor(m.y),d._scale(l),d.options.intensity*n)}}),b.update(),b.multiply(this.options.multiply),b.display()},_scale:function(b){if(this.options.units=='px')return this.options.size;var c=this._map,d=this.options.size/40075017*360/Math.cos(a.LatLng.DEG_TO_RAD*b.lat),e=new a.LatLng(b.lat,b.lng-d),f=c.latLngToLayerPoint(b),g=c.latLngToLayerPoint(e);return Math.max(Math.round(f.x-g.x),1)},onResize:function(){this.heatmap.adjustSize()},destory:function(){this.onRemove(this._map),this._map.off('resize',this.onResize,this),this.data=[],this.gradientTexture=null},initEvents:function(){this._map.on('resize',this.onResize,this)}}),c=a.dmap=a.dmap||{};c.HeatMapLayer=b,c.heatMapLayer=function(a){return new b(a)},module.exports=b |
@@ -1,1 +0,1 @@ | ||
var b,f,c,d,e,a,g,h,i,j,k=[].indexOf||function(c){for(var a=0,b=this.length;a<b;a++)if(a in this&&this[a]===c)return a;return-1};h=function(){var a,d,b,c;return window.WebGLRenderingContext!=null?(c=['WEBKIT','MOZ','MS','O'],b=/^WEBKIT_(.*)|MOZ_(.*)|MS_(.*)|O_(.*)/,a=WebGLRenderingContext.prototype.getExtension,WebGLRenderingContext.prototype.getExtension=function(e){var d,g,h,f,i;if(g=e.match(b),g!==null&&(e=g[1]),d=a.call(this,e),d===null){for(f=0,i=c.length;f<i;f++)if(h=c[f],d=a.call(this,h+'_'+e),d!==null)return d;return null}else return d},d=WebGLRenderingContext.prototype.getSupportedExtensions,WebGLRenderingContext.prototype.getSupportedExtensions=function(){var a,f,c,g,e,h;for(g=d.call(this),c=[],e=0,h=g.length;e<h;e++)a=g[e],f=a.match(b),f!==null&&(a=f[1]),k.call(c,a)<0&&c.push(a);return c}):void 0},i=function(){var e,f,m,d,j,n,l,g,a,c,b,h,i,o;if(j=function(){var a,b,c;return a=document.createElement('canvas'),a.width=2,a.height=2,b=a.getContext('2d'),c=b.getImageData(0,0,2,2),c.data.set(new Uint8ClampedArray([0,0,0,0,255,255,255,255,0,0,0,0,255,255,255,255])),b.putImageData(c,0,0),a},j(),f=function(a,q){var f,m,d,g,h,b,i,l,k,n,o,e,c,p;if(b=a.createProgram(),c=a.createShader(a.VERTEX_SHADER),a.attachShader(b,c),a.shaderSource(c,'attribute vec2 position;\nvoid main(){\n gl_Position = vec4(position, 0.0, 1.0);\n}'),a.compileShader(c),!a.getShaderParameter(c,a.COMPILE_STATUS))throw a.getShaderInfoLog(c);if(d=a.createShader(a.FRAGMENT_SHADER),a.attachShader(b,d),a.shaderSource(d,'uniform sampler2D source;\nvoid main(){\n gl_FragColor = texture2D(source, vec2(1.0, 1.0));\n}'),a.compileShader(d),!a.getShaderParameter(d,a.COMPILE_STATUS))throw a.getShaderInfoLog(d);if(a.linkProgram(b),!a.getProgramParameter(b,a.LINK_STATUS))throw a.getProgramInfoLog(b);return a.useProgram(b),m=function(){return a.deleteShader(d),a.deleteShader(c),a.deleteProgram(b),a.deleteBuffer(f),a.deleteTexture(k),a.deleteTexture(e),a.deleteFramebuffer(g),a.bindBuffer(a.ARRAY_BUFFER,null),a.useProgram(null),a.bindTexture(a.TEXTURE_2D,null),a.bindFramebuffer(a.FRAMEBUFFER,null)},e=a.createTexture(),a.bindTexture(a.TEXTURE_2D,e),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,2,2,0,a.RGBA,a.UNSIGNED_BYTE,null),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR),g=a.createFramebuffer(),a.bindFramebuffer(a.FRAMEBUFFER,g),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,e,0),n=j(),k=a.createTexture(),a.bindTexture(a.TEXTURE_2D,k),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,q,n),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR),p=new Float32Array([1,1,-1,1,-1,-1,1,1,-1,-1,1,-1]),f=a.createBuffer(),a.bindBuffer(a.ARRAY_BUFFER,f),a.bufferData(a.ARRAY_BUFFER,p,a.STATIC_DRAW),h=a.getAttribLocation(b,'position'),o=a.getUniformLocation(b,'source'),a.enableVertexAttribArray(h),a.vertexAttribPointer(h,2,a.FLOAT,!1,0,0),a.uniform1i(o,0),a.drawArrays(a.TRIANGLES,0,6),i=new Uint8Array(16),a.readPixels(0,0,2,2,a.RGBA,a.UNSIGNED_BYTE,i),l=Math.abs(i[0]-127)<10,m(),l},d=function(a,c){var b;return b=a.createTexture(),a.bindTexture(a.TEXTURE_2D,b),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,2,2,0,a.RGBA,c,null),a.getError()===0?(a.deleteTexture(b),!0):(a.deleteTexture(b),!1)},e=function(a,e){var d,c,b;return b=a.createTexture(),a.bindTexture(a.TEXTURE_2D,b),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,2,2,0,a.RGBA,e,null),c=a.createFramebuffer(),a.bindFramebuffer(a.FRAMEBUFFER,c),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,b,0),d=a.checkFramebufferStatus(a.FRAMEBUFFER),a.deleteTexture(b),a.deleteFramebuffer(c),a.bindTexture(a.TEXTURE_2D,null),a.bindFramebuffer(a.FRAMEBUFFER,null),d===a.FRAMEBUFFER_COMPLETE?!0:!1},a=[],c={},b=[],m=function(){var l,h,g,i,j,m,k;l=document.createElement('canvas'),g=null;try{g=l.getContext('experimental-webgl'),g===null&&(g=l.getContext('webgl'))}catch(a){}return g!=null&&(m=g.getExtension('OES_texture_float'),m===null?d(g,g.FLOAT)?(k=!0,a.push('OES_texture_float'),c.OES_texture_float={shim:!0}):(k=!1,b.push('OES_texture_float')):d(g,g.FLOAT)?(k=!0,a.push('OES_texture_float')):(k=!1,b.push('OES_texture_float')),k&&(h=g.getExtension('WEBGL_color_buffer_float'),h===null?e(g,g.FLOAT)?(a.push('WEBGL_color_buffer_float'),c.WEBGL_color_buffer_float={shim:!0,RGBA32F_EXT:34836,RGB32F_EXT:34837,FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT:33297,UNSIGNED_NORMALIZED_EXT:35863}):b.push('WEBGL_color_buffer_float'):e(g,g.FLOAT)?a.push('WEBGL_color_buffer_float'):b.push('WEBGL_color_buffer_float'),h=g.getExtension('OES_texture_float_linear'),h===null?f(g,g.FLOAT)?(a.push('OES_texture_float_linear'),c.OES_texture_float_linear={shim:!0}):b.push('OES_texture_float_linear'):f(g,g.FLOAT)?a.push('OES_texture_float_linear'):b.push('OES_texture_float_linear')),i=g.getExtension('OES_texture_half_float'),i===null?d(g,36193)?(j=!0,a.push('OES_texture_half_float'),i=c.OES_texture_half_float={HALF_FLOAT_OES:36193,shim:!0}):(j=!1,b.push('OES_texture_half_float')):d(g,i.HALF_FLOAT_OES)?(j=!0,a.push('OES_texture_half_float')):(j=!1,b.push('OES_texture_half_float')),j)?(h=g.getExtension('EXT_color_buffer_half_float'),h===null?e(g,i.HALF_FLOAT_OES)?(a.push('EXT_color_buffer_half_float'),c.EXT_color_buffer_half_float={shim:!0,RGBA16F_EXT:34842,RGB16F_EXT:34843,FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT:33297,UNSIGNED_NORMALIZED_EXT:35863}):b.push('EXT_color_buffer_half_float'):e(g,i.HALF_FLOAT_OES)?a.push('EXT_color_buffer_half_float'):b.push('EXT_color_buffer_half_float'),h=g.getExtension('OES_texture_half_float_linear'),h===null?f(g,i.HALF_FLOAT_OES)?(a.push('OES_texture_half_float_linear'),c.OES_texture_half_float_linear={shim:!0}):b.push('OES_texture_half_float_linear'):f(g,i.HALF_FLOAT_OES)?a.push('OES_texture_half_float_linear'):b.push('OES_texture_half_float_linear')):void 0},window.WebGLRenderingContext!=null){for(m(),h={},i=0,o=b.length;i<o;i++)g=b[i],h[g]=!0;return n=WebGLRenderingContext.prototype.getExtension,WebGLRenderingContext.prototype.getExtension=function(a){var b;return b=c[a],b===void 0?h[a]?null:n.call(this,a):b},l=WebGLRenderingContext.prototype.getSupportedExtensions,WebGLRenderingContext.prototype.getSupportedExtensions=function(){var b,c,f,d,e,g,i;for(f=l.call(this),c=[],d=0,g=f.length;d<g;d++)b=f[d],h[b]===void 0&&c.push(b);for(e=0,i=a.length;e<i;e++)b=a[e],k.call(c,b)<0&&c.push(b);return c},WebGLRenderingContext.prototype.getFloatExtension=function(b){var c,d,l,B,t,e,f,r,s,a,k,z,u,q,n,h,i,j,v,w,x,y,o,A,p,m;for(b.prefer==null&&(b.prefer=['half']),b.require==null&&(b.require=[]),b.throws==null&&(b.throws=!0),q=this.getExtension('OES_texture_float'),e=this.getExtension('OES_texture_half_float'),z=this.getExtension('WEBGL_color_buffer_float'),B=this.getExtension('EXT_color_buffer_half_float'),u=this.getExtension('OES_texture_float_linear'),t=this.getExtension('OES_texture_half_float_linear'),k={texture:q!==null,filterable:u!==null,renderable:z!==null,score:0,precision:'single',half:!1,single:!0,type:this.FLOAT},l={texture:e!==null,filterable:t!==null,renderable:B!==null,score:0,precision:'half',half:!0,single:!1,type:(A=e!=null?e.HALF_FLOAT_OES:void 0)!=null?A:null},d=[],k.texture&&d.push(k),l.texture&&d.push(l),a=[],h=0,v=d.length;h<v;h++){for(c=d[h],n=!0,p=b.require,i=0,w=p.length;i<w;i++)g=p[i],c[g]===!1&&(n=!1);n&&a.push(c)}for(j=0,x=a.length;j<x;j++)for(c=a[j],m=b.prefer,f=o=0,y=m.length;o<y;f=++o)s=m[f],r=Math.pow(2,b.prefer.length-f-1),c[s]&&(c.score+=r);if(a.sort(function(a,b){return a.score===b.score?0:a.score<b.score?1:a.score>b.score?-1:void 0}),a.length===0)if(b.throws)throw'No floating point texture support that is '+b.require.join(', ');else return null;else return a=a[0],{filterable:a.filterable,renderable:a.renderable,type:a.type,precision:a.precision}}}},h(),i(),d=function(){function a(d,a){var b,c;this.gl=d,c=a.vertex,b=a.fragment,this.program=this.gl.createProgram(),this.vs=this.gl.createShader(this.gl.VERTEX_SHADER),this.fs=this.gl.createShader(this.gl.FRAGMENT_SHADER),this.gl.attachShader(this.program,this.vs),this.gl.attachShader(this.program,this.fs),this.compileShader(this.vs,c),this.compileShader(this.fs,b),this.link(),this.value_cache={},this.uniform_cache={},this.attribCache={}}return a.prototype.attribLocation=function(b){var a;return a=this.attribCache[b],a===void 0&&(a=this.attribCache[b]=this.gl.getAttribLocation(this.program,b)),a},a.prototype.compileShader=function(a,b){if(this.gl.shaderSource(a,b),this.gl.compileShader(a),!this.gl.getShaderParameter(a,this.gl.COMPILE_STATUS))throw'Shader Compile Error: '+this.gl.getShaderInfoLog(a)},a.prototype.link=function(){if(this.gl.linkProgram(this.program),!this.gl.getProgramParameter(this.program,this.gl.LINK_STATUS))throw'Shader Link Error: '+this.gl.getProgramInfoLog(this.program)},a.prototype.use=function(){return this.gl.useProgram(this.program),this},a.prototype.uniformLoc=function(b){var a;return a=this.uniform_cache[b],a===void 0&&(a=this.uniform_cache[b]=this.gl.getUniformLocation(this.program,b)),a},a.prototype.int=function(a,b){var d,c;return d=this.value_cache[a],d!==b&&(this.value_cache[a]=b,c=this.uniformLoc(a),c&&this.gl.uniform1i(c,b)),this},a.prototype.vec2=function(b,c,d){var a;return a=this.uniformLoc(b),a&&this.gl.uniform2f(a,c,d),this},a.prototype.float=function(a,b){var d,c;return d=this.value_cache[a],d!==b&&(this.value_cache[a]=b,c=this.uniformLoc(a),c&&this.gl.uniform1f(c,b)),this},a}(),b=function(){function a(a){this.gl=a,this.buffer=this.gl.createFramebuffer()}return a.prototype.destroy=function(){return this.gl.deleteFRamebuffer(this.buffer)},a.prototype.bind=function(){return this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,this.buffer),this},a.prototype.unbind=function(){return this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,null),this},a.prototype.check=function(){var a;a=this.gl.checkFramebufferStatus(this.gl.FRAMEBUFFER);switch(a){case this.gl.FRAMEBUFFER_UNSUPPORTED:throw'Framebuffer is unsupported';case this.gl.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:throw'Framebuffer incomplete attachment';case this.gl.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:throw'Framebuffer incomplete dimensions';case this.gl.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:throw'Framebuffer incomplete missing attachment'}return this},a.prototype.color=function(a){return this.gl.framebufferTexture2D(this.gl.FRAMEBUFFER,this.gl.COLOR_ATTACHMENT0,a.target,a.handle,0),this.check(),this},a.prototype.depth=function(a){return this.gl.framebufferRenderbuffer(this.gl.FRAMEBUFFER,this.gl.DEPTH_ATTACHMENT,this.gl.RENDERBUFFER,a.id),this.check(),this},a.prototype.destroy=function(){return this.gl.deleteFramebuffer(this.buffer)},a}(),e=function(){function a(d,a){var b,c;this.gl=d,a==null&&(a={}),this.channels=this.gl[((b=a.channels)!=null?b:'rgba').toUpperCase()],typeof a.type==='number'?this.type=a.type:this.type=this.gl[((c=a.type)!=null?c:'unsigned_byte').toUpperCase()];switch(this.channels){case this.gl.RGBA:this.chancount=4;break;case this.gl.RGB:this.chancount=3;break;case this.gl.LUMINANCE_ALPHA:this.chancount=2;break;default:this.chancount=1}this.target=this.gl.TEXTURE_2D,this.handle=this.gl.createTexture()}return a.prototype.destroy=function(){return this.gl.deleteTexture(this.handle)},a.prototype.bind=function(a){if(a==null&&(a=0),a>15)throw'Texture unit too large: '+a;return this.gl.activeTexture(this.gl.TEXTURE0+a),this.gl.bindTexture(this.target,this.handle),this},a.prototype.setSize=function(a,b){return this.width=a,this.height=b,this.gl.texImage2D(this.target,0,this.channels,this.width,this.height,0,this.channels,this.type,null),this},a.prototype.upload=function(a){return this.width=a.width,this.height=a.height,this.gl.texImage2D(this.target,0,this.channels,this.channels,this.type,a),this},a.prototype.linear=function(){return this.gl.texParameteri(this.target,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.target,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this},a.prototype.nearest=function(){return this.gl.texParameteri(this.target,this.gl.TEXTURE_MAG_FILTER,this.gl.NEAREST),this.gl.texParameteri(this.target,this.gl.TEXTURE_MIN_FILTER,this.gl.NEAREST),this},a.prototype.clampToEdge=function(){return this.gl.texParameteri(this.target,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.target,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this},a.prototype.repeat=function(){return this.gl.texParameteri(this.target,this.gl.TEXTURE_WRAP_S,this.gl.REPEAT),this.gl.texParameteri(this.target,this.gl.TEXTURE_WRAP_T,this.gl.REPEAT),this},a}(),c=function(){function a(c,d,f){var a;this.gl=c,this.width=d,this.height=f,a=this.gl.getFloatExtension({require:['renderable']}),this.texture=new e(this.gl,{type:a.type}).bind(0).setSize(this.width,this.height).nearest().clampToEdge(),this.fbo=new b(this.gl).bind().color(this.texture).unbind()}return a.prototype.use=function(){return this.fbo.bind()},a.prototype.bind=function(a){return this.texture.bind(a)},a.prototype.end=function(){return this.fbo.unbind()},a.prototype.resize=function(a,b){return this.width=a,this.height=b,this.texture.bind(0).setSize(this.width,this.height)},a}(),j='attribute vec4 position;\nvarying vec2 texcoord;\nvoid main(){\n texcoord = position.xy*0.5+0.5;\n gl_Position = position;\n}',g='#ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp int;\n precision highp float;\n#else\n precision mediump int;\n precision mediump float;\n#endif\nuniform sampler2D source;\nvarying vec2 texcoord;',f=function(){function a(f,h,i,k){var e,a,b;for(this.heatmap=f,this.gl=h,this.width=i,this.height=k,this.shader=new d(this.gl,{vertex:'attribute vec4 position, intensity;\nvarying vec2 off, dim;\nvarying float vIntensity;\nuniform vec2 viewport;\n\nvoid main(){\n dim = abs(position.zw);\n off = position.zw;\n vec2 pos = position.xy + position.zw;\n vIntensity = intensity.x;\n gl_Position = vec4((pos/viewport)*2.0-1.0, 0.0, 1.0);\n}',fragment:'#ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp int;\n precision highp float;\n#else\n precision mediump int;\n precision mediump float;\n#endif\nvarying vec2 off, dim;\nvarying float vIntensity;\nvoid main(){\n float falloff = (1.0 - smoothstep(0.0, 1.0, length(off/dim)));\n float intensity = falloff*vIntensity;\n gl_FragColor = vec4(intensity);\n}'}),this.clampShader=new d(this.gl,{vertex:j,fragment:g+'uniform float low, high;\nvoid main(){\n gl_FragColor = vec4(clamp(texture2D(source, texcoord).rgb, low, high), 1.0);\n}'}),this.multiplyShader=new d(this.gl,{vertex:j,fragment:g+'uniform float value;\nvoid main(){\n gl_FragColor = vec4(texture2D(source, texcoord).rgb*value, 1.0);\n}'}),this.blurShader=new d(this.gl,{vertex:j,fragment:g+'uniform vec2 viewport;\nvoid main(){\n vec4 result = vec4(0.0);\n for(int x=-1; x<=1; x++){\n for(int y=-1; y<=1; y++){\n vec2 off = vec2(x,y)/viewport;\n //float factor = 1.0 - smoothstep(0.0, 1.5, length(off));\n float factor = 1.0;\n result += vec4(texture2D(source, texcoord+off).rgb*factor, factor);\n }\n }\n gl_FragColor = vec4(result.rgb/result.w, 1.0);\n}'}),this.nodeBack=new c(this.gl,this.width,this.height),this.nodeFront=new c(this.gl,this.width,this.height),this.vertexBuffer=this.gl.createBuffer(),this.vertexSize=8,this.maxPointCount=10240,this.vertexBufferData=new Float32Array(this.maxPointCount*this.vertexSize*6),this.vertexBufferViews=[],e=a=0,b=this.maxPointCount;0<=b?a<b:a>b;e=0<=b?++a:--a)this.vertexBufferViews.push(new Float32Array(this.vertexBufferData.buffer,0,e*this.vertexSize*6));this.bufferIndex=0,this.pointCount=0}return a.prototype.resize=function(a,b){return this.width=a,this.height=b,this.nodeBack.resize(this.width,this.height),this.nodeFront.resize(this.width,this.height)},a.prototype.update=function(){var a,b;return this.pointCount>0?(this.gl.enable(this.gl.BLEND),this.nodeFront.use(),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.vertexBuffer),this.gl.bufferData(this.gl.ARRAY_BUFFER,this.vertexBufferViews[this.pointCount],this.gl.STREAM_DRAW),b=this.shader.attribLocation('position'),a=this.shader.attribLocation('intensity'),this.gl.enableVertexAttribArray(1),this.gl.vertexAttribPointer(b,4,this.gl.FLOAT,!1,32,0),this.gl.vertexAttribPointer(a,4,this.gl.FLOAT,!1,32,16),this.shader.use().vec2('viewport',this.width,this.height),this.gl.drawArrays(this.gl.TRIANGLES,0,this.pointCount*6),this.gl.disableVertexAttribArray(1),this.pointCount=0,this.bufferIndex=0,this.nodeFront.end(),this.gl.disable(this.gl.BLEND)):void 0},a.prototype.clear=function(){return this.nodeFront.use(),this.gl.clearColor(0,0,0,1),this.gl.clear(this.gl.COLOR_BUFFER_BIT),this.nodeFront.end()},a.prototype.clamp=function(a,b){return this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.heatmap.quad),this.gl.vertexAttribPointer(0,4,this.gl.FLOAT,!1,0,0),this.nodeFront.bind(0),this.nodeBack.use(),this.clampShader.use().int('source',0).float('low',a).float('high',b),this.gl.drawArrays(this.gl.TRIANGLES,0,6),this.nodeBack.end(),this.swap()},a.prototype.multiply=function(a){return this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.heatmap.quad),this.gl.vertexAttribPointer(0,4,this.gl.FLOAT,!1,0,0),this.nodeFront.bind(0),this.nodeBack.use(),this.multiplyShader.use().int('source',0).float('value',a),this.gl.drawArrays(this.gl.TRIANGLES,0,6),this.nodeBack.end(),this.swap()},a.prototype.blur=function(){return this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.heatmap.quad),this.gl.vertexAttribPointer(0,4,this.gl.FLOAT,!1,0,0),this.nodeFront.bind(0),this.nodeBack.use(),this.blurShader.use().int('source',0).vec2('viewport',this.width,this.height),this.gl.drawArrays(this.gl.TRIANGLES,0,6),this.nodeBack.end(),this.swap()},a.prototype.swap=function(){var a;return a=this.nodeFront,this.nodeFront=this.nodeBack,this.nodeBack=a},a.prototype.addVertex=function(b,c,d,e,a){return this.vertexBufferData[this.bufferIndex++]=b,this.vertexBufferData[this.bufferIndex++]=c,this.vertexBufferData[this.bufferIndex++]=d,this.vertexBufferData[this.bufferIndex++]=e,this.vertexBufferData[this.bufferIndex++]=a,this.vertexBufferData[this.bufferIndex++]=a,this.vertexBufferData[this.bufferIndex++]=a,this.vertexBufferData[this.bufferIndex++]=a},a.prototype.addPoint=function(d,b,e,c){var a;return e==null&&(e=50),c==null&&(c=.2),this.pointCount>=this.maxPointCount-1&&this.update(),b=this.height-b,a=e/2,this.addVertex(d,b,-a,-a,c),this.addVertex(d,b,+a,-a,c),this.addVertex(d,b,-a,+a,c),this.addVertex(d,b,-a,+a,c),this.addVertex(d,b,+a,-a,c),this.addVertex(d,b,+a,+a,c),this.pointCount+=1},a}(),a=function(){function a(o){var r,l,q,n,a,h,k,i,p,c,b,m;b=o!=null?o:{},this.canvas=b.canvas,this.width=b.width,this.height=b.height,k=b.intensityToAlpha,a=b.gradientTexture,l=b.alphaRange,this.canvas||(this.canvas=document.createElement('canvas'));try{if(this.gl=this.canvas.getContext('experimental-webgl',{depth:!1,antialias:!1}),this.gl===null&&(this.gl=this.canvas.getContext('webgl',{depth:!1,antialias:!1}),this.gl===null))throw'WebGL not supported'}catch(a){throw'WebGL not supported'}window.WebGLDebugUtils!=null&&(console.log('debugging mode'),this.gl=WebGLDebugUtils.makeDebugContext(this.gl,function(a,b,c){throw WebGLDebugUtils.glEnumToString(a)+' was caused by call to: '+b})),this.gl.enableVertexAttribArray(0),this.gl.blendFunc(this.gl.ONE,this.gl.ONE),a?(c=this.gradientTexture=new e(this.gl,{channels:'rgba'}).bind(0).setSize(2,2).nearest().clampToEdge(),typeof a==='string'?(h=new Image,h.onload=function(){return c.bind().upload(h)},h.src=a):a.width>0&&a.height>0?c.upload(a):a.onload=function(){return c.upload(a)},n='uniform sampler2D gradientTexture;\nvec3 getColor(float intensity){\n return texture2D(gradientTexture, vec2(intensity, 0.0)).rgb;\n}'):(c=null,n='vec3 getColor(float intensity){\n vec3 blue = vec3(0.0, 0.0, 1.0);\n vec3 cyan = vec3(0.0, 1.0, 1.0);\n vec3 green = vec3(0.0, 1.0, 0.0);\n vec3 yellow = vec3(1.0, 1.0, 0.0);\n vec3 red = vec3(1.0, 0.0, 0.0);\n\n vec3 color = (\n fade(-0.25, 0.25, intensity)*blue +\n fade(0.0, 0.5, intensity)*cyan +\n fade(0.25, 0.75, intensity)*green +\n fade(0.5, 1.0, intensity)*yellow +\n smoothstep(0.75, 1.0, intensity)*red\n );\n return color;\n}'),k==null&&(k=!0),k?(m=l!=null?l:[0,1],q=m[0],r=m[1],i='vec4 alphaFun(vec3 color, float intensity){\n float alpha = smoothstep('+q.toFixed(8)+', '+r.toFixed(8)+', intensity);\n return vec4(color*alpha, alpha);\n}'):i='vec4 alphaFun(vec3 color, float intensity){\n return vec4(color, 1.0);\n}',this.output=i,this.shader=new d(this.gl,{vertex:j,fragment:g+('float linstep(float low, float high, float value){\n return clamp((value-low)/(high-low), 0.0, 1.0);\n}\n\nfloat fade(float low, float high, float value){\n float mid = (low+high)*0.5;\n float range = (high-low)*0.5;\n float x = 1.0 - clamp(abs(mid-value)/range, 0.0, 1.0);\n return smoothstep(0.0, 1.0, x);\n}\n\n'+n+'\n'+i+'\n\nvoid main(){\n float intensity = smoothstep(0.0, 1.0, texture2D(source, texcoord).r);\n vec3 color = getColor(intensity);\n gl_FragColor = alphaFun(color, intensity);\n}')}),this.width==null&&(this.width=this.canvas.offsetWidth||2),this.height==null&&(this.height=this.canvas.offsetHeight||2),this.canvas.width=this.width,this.canvas.height=this.height,this.gl.viewport(0,0,this.width,this.height),this.quad=this.gl.createBuffer(),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.quad),p=new Float32Array([-1,-1,0,1,1,-1,0,1,-1,1,0,1,-1,1,0,1,1,-1,0,1,1,1,0,1]),this.gl.bufferData(this.gl.ARRAY_BUFFER,p,this.gl.STATIC_DRAW),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,null),this.heights=new f(this,this.gl,this.width,this.height)}return a.prototype.adjustSize=function(){var a,b;return b=this.canvas.offsetWidth||2,a=this.canvas.offsetHeight||2,this.width!==b||this.height!==a?(this.gl.viewport(0,0,b,a),this.canvas.width=b,this.canvas.height=a,this.width=b,this.height=a,this.heights.resize(this.width,this.height)):void 0},a.prototype.display=function(){return this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.quad),this.gl.vertexAttribPointer(0,4,this.gl.FLOAT,!1,0,0),this.heights.nodeFront.bind(0),this.gradientTexture&&this.gradientTexture.bind(1),this.shader.use().int('source',0).int('gradientTexture',1),this.gl.drawArrays(this.gl.TRIANGLES,0,6)},a.prototype.update=function(){return this.heights.update()},a.prototype.clear=function(){return this.heights.clear()},a.prototype.clamp=function(a,b){return a==null&&(a=0),b==null&&(b=1),this.heights.clamp(a,b)},a.prototype.multiply=function(a){return a==null&&(a=.95),this.heights.multiply(a)},a.prototype.blur=function(){return this.heights.blur()},a.prototype.addPoint=function(a,b,c,d){return this.heights.addPoint(a,b,c,d)},a.prototype.addPoints=function(d){var a,b,e,c;for(c=[],b=0,e=d.length;b<e;b++)a=d[b],c.push(this.addPoint(a.x,a.y,a.size,a.intensity));return c},a.prototype.updateOptions=function(a,b,c){a?(textureGradient=this.gradientTexture=new e(this.gl,{channels:'rgba'}).bind(0).setSize(2,2).nearest().clampToEdge(),typeof a==='string'?(image=new Image,image.onload=function(){return textureGradient.bind().upload(image)},image.src=a):a.width>0&&a.height>0?textureGradient.upload(a):a.onload=function(){return textureGradient.upload(a)},getColorFun='uniform sampler2D gradientTexture;\nvec3 getColor(float intensity){\n return texture2D(gradientTexture, vec2(intensity, 0.0)).rgb;\n}'):(textureGradient=null,getColorFun='vec3 getColor(float intensity){\n vec3 blue = vec3(0.0, 0.0, 1.0);\n vec3 cyan = vec3(0.0, 1.0, 1.0);\n vec3 green = vec3(0.0, 1.0, 0.0);\n vec3 yellow = vec3(1.0, 1.0, 0.0);\n vec3 red = vec3(1.0, 0.0, 0.0);\n\n vec3 color = (\n fade(-0.25, 0.25, intensity)*blue +\n fade(0.0, 0.5, intensity)*cyan +\n fade(0.25, 0.75, intensity)*green +\n fade(0.5, 1.0, intensity)*yellow +\n smoothstep(0.75, 1.0, intensity)*red\n );\n return color;\n}'),this.output='vec4 alphaFun(vec3 color, float intensity){\n float alpha = smoothstep('+b.toFixed(8)+', '+c.toFixed(8)+', intensity);\n return vec4(color*alpha, alpha);\n}',this.shader=new d(this.gl,{vertex:j,fragment:g+('float linstep(float low, float high, float value){\n return clamp((value-low)/(high-low), 0.0, 1.0);\n}\n\nfloat fade(float low, float high, float value){\n float mid = (low+high)*0.5;\n float range = (high-low)*0.5;\n float x = 1.0 - clamp(abs(mid-value)/range, 0.0, 1.0);\n return smoothstep(0.0, 1.0, x);\n}\n\n'+getColorFun+'\n'+this.output+'\n\nvoid main(){\n float intensity = smoothstep(0.0, 1.0, texture2D(source, texcoord).r);\n vec3 color = getColor(intensity);\n gl_FragColor = alphaFun(color, intensity);\n}')})},a}(),module.exports=a | ||
var g,j,f,a,d,k,b,h,i,c,e=[].indexOf||function(c){for(var a=0,b=this.length;a<b;a++)if(a in this&&this[a]===c)return a;return-1};h=function(){var a,d,b,c;return window.WebGLRenderingContext!=null?(c=['WEBKIT','MOZ','MS','O'],b=/^WEBKIT_(.*)|MOZ_(.*)|MS_(.*)|O_(.*)/,a=WebGLRenderingContext.prototype.getExtension,WebGLRenderingContext.prototype.getExtension=function(e){var d,g,h,f,i;if(g=e.match(b),g!==null&&(e=g[1]),d=a.call(this,e),d===null){for(f=0,i=c.length;f<i;f++)if(h=c[f],d=a.call(this,h+'_'+e),d!==null)return d;return null}else return d},d=WebGLRenderingContext.prototype.getSupportedExtensions,WebGLRenderingContext.prototype.getSupportedExtensions=function(){var a,g,c,h,f,i;for(h=d.call(this),c=[],f=0,i=h.length;f<i;f++)a=h[f],g=a.match(b),g!==null&&(a=g[1]),e.call(c,a)<0&&c.push(a);return c}):void 0},i=function(){var f,g,m,d,k,n,l,h,a,c,b,i,j,o;if(k=function(){var a,b,c;return a=document.createElement('canvas'),a.width=2,a.height=2,b=a.getContext('2d'),c=b.getImageData(0,0,2,2),c.data.set(new Uint8ClampedArray([0,0,0,0,255,255,255,255,0,0,0,0,255,255,255,255])),b.putImageData(c,0,0),a},k(),g=function(a,q){var f,m,d,g,h,b,i,l,j,n,o,e,c,p;if(b=a.createProgram(),c=a.createShader(a.VERTEX_SHADER),a.attachShader(b,c),a.shaderSource(c,'attribute vec2 position;\nvoid main(){\n gl_Position = vec4(position, 0.0, 1.0);\n}'),a.compileShader(c),!a.getShaderParameter(c,a.COMPILE_STATUS))throw a.getShaderInfoLog(c);if(d=a.createShader(a.FRAGMENT_SHADER),a.attachShader(b,d),a.shaderSource(d,'uniform sampler2D source;\nvoid main(){\n gl_FragColor = texture2D(source, vec2(1.0, 1.0));\n}'),a.compileShader(d),!a.getShaderParameter(d,a.COMPILE_STATUS))throw a.getShaderInfoLog(d);if(a.linkProgram(b),!a.getProgramParameter(b,a.LINK_STATUS))throw a.getProgramInfoLog(b);return a.useProgram(b),m=function(){return a.deleteShader(d),a.deleteShader(c),a.deleteProgram(b),a.deleteBuffer(f),a.deleteTexture(j),a.deleteTexture(e),a.deleteFramebuffer(g),a.bindBuffer(a.ARRAY_BUFFER,null),a.useProgram(null),a.bindTexture(a.TEXTURE_2D,null),a.bindFramebuffer(a.FRAMEBUFFER,null)},e=a.createTexture(),a.bindTexture(a.TEXTURE_2D,e),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,2,2,0,a.RGBA,a.UNSIGNED_BYTE,null),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR),g=a.createFramebuffer(),a.bindFramebuffer(a.FRAMEBUFFER,g),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,e,0),n=k(),j=a.createTexture(),a.bindTexture(a.TEXTURE_2D,j),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,q,n),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR),p=new Float32Array([1,1,-1,1,-1,-1,1,1,-1,-1,1,-1]),f=a.createBuffer(),a.bindBuffer(a.ARRAY_BUFFER,f),a.bufferData(a.ARRAY_BUFFER,p,a.STATIC_DRAW),h=a.getAttribLocation(b,'position'),o=a.getUniformLocation(b,'source'),a.enableVertexAttribArray(h),a.vertexAttribPointer(h,2,a.FLOAT,!1,0,0),a.uniform1i(o,0),a.drawArrays(a.TRIANGLES,0,6),i=new Uint8Array(16),a.readPixels(0,0,2,2,a.RGBA,a.UNSIGNED_BYTE,i),l=Math.abs(i[0]-127)<10,m(),l},d=function(a,c){var b;return b=a.createTexture(),a.bindTexture(a.TEXTURE_2D,b),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,2,2,0,a.RGBA,c,null),a.getError()===0?(a.deleteTexture(b),!0):(a.deleteTexture(b),!1)},f=function(a,e){var d,c,b;return b=a.createTexture(),a.bindTexture(a.TEXTURE_2D,b),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,2,2,0,a.RGBA,e,null),c=a.createFramebuffer(),a.bindFramebuffer(a.FRAMEBUFFER,c),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,b,0),d=a.checkFramebufferStatus(a.FRAMEBUFFER),a.deleteTexture(b),a.deleteFramebuffer(c),a.bindTexture(a.TEXTURE_2D,null),a.bindFramebuffer(a.FRAMEBUFFER,null),d===a.FRAMEBUFFER_COMPLETE?!0:!1},a=[],c={},b=[],m=function(){var l,h,e,i,j,m,k;l=document.createElement('canvas'),e=null;try{e=l.getContext('experimental-webgl'),e===null&&(e=l.getContext('webgl'))}catch(a){}return e!=null&&(m=e.getExtension('OES_texture_float'),m===null?d(e,e.FLOAT)?(k=!0,a.push('OES_texture_float'),c.OES_texture_float={shim:!0}):(k=!1,b.push('OES_texture_float')):d(e,e.FLOAT)?(k=!0,a.push('OES_texture_float')):(k=!1,b.push('OES_texture_float')),k&&(h=e.getExtension('WEBGL_color_buffer_float'),h===null?f(e,e.FLOAT)?(a.push('WEBGL_color_buffer_float'),c.WEBGL_color_buffer_float={shim:!0,RGBA32F_EXT:34836,RGB32F_EXT:34837,FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT:33297,UNSIGNED_NORMALIZED_EXT:35863}):b.push('WEBGL_color_buffer_float'):f(e,e.FLOAT)?a.push('WEBGL_color_buffer_float'):b.push('WEBGL_color_buffer_float'),h=e.getExtension('OES_texture_float_linear'),h===null?g(e,e.FLOAT)?(a.push('OES_texture_float_linear'),c.OES_texture_float_linear={shim:!0}):b.push('OES_texture_float_linear'):g(e,e.FLOAT)?a.push('OES_texture_float_linear'):b.push('OES_texture_float_linear')),i=e.getExtension('OES_texture_half_float'),i===null?d(e,36193)?(j=!0,a.push('OES_texture_half_float'),i=c.OES_texture_half_float={HALF_FLOAT_OES:36193,shim:!0}):(j=!1,b.push('OES_texture_half_float')):d(e,i.HALF_FLOAT_OES)?(j=!0,a.push('OES_texture_half_float')):(j=!1,b.push('OES_texture_half_float')),j)?(h=e.getExtension('EXT_color_buffer_half_float'),h===null?f(e,i.HALF_FLOAT_OES)?(a.push('EXT_color_buffer_half_float'),c.EXT_color_buffer_half_float={shim:!0,RGBA16F_EXT:34842,RGB16F_EXT:34843,FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT:33297,UNSIGNED_NORMALIZED_EXT:35863}):b.push('EXT_color_buffer_half_float'):f(e,i.HALF_FLOAT_OES)?a.push('EXT_color_buffer_half_float'):b.push('EXT_color_buffer_half_float'),h=e.getExtension('OES_texture_half_float_linear'),h===null?g(e,i.HALF_FLOAT_OES)?(a.push('OES_texture_half_float_linear'),c.OES_texture_half_float_linear={shim:!0}):b.push('OES_texture_half_float_linear'):g(e,i.HALF_FLOAT_OES)?a.push('OES_texture_half_float_linear'):b.push('OES_texture_half_float_linear')):void 0},window.WebGLRenderingContext!=null){for(m(),i={},j=0,o=b.length;j<o;j++)h=b[j],i[h]=!0;return n=WebGLRenderingContext.prototype.getExtension,WebGLRenderingContext.prototype.getExtension=function(a){var b;return b=c[a],b===void 0?i[a]?null:n.call(this,a):b},l=WebGLRenderingContext.prototype.getSupportedExtensions,WebGLRenderingContext.prototype.getSupportedExtensions=function(){var b,c,g,d,f,h,j;for(g=l.call(this),c=[],d=0,h=g.length;d<h;d++)b=g[d],i[b]===void 0&&c.push(b);for(f=0,j=a.length;f<j;f++)b=a[f],e.call(c,b)<0&&c.push(b);return c},WebGLRenderingContext.prototype.getFloatExtension=function(b){var c,d,l,B,t,e,f,r,s,a,k,z,u,q,n,g,i,j,v,w,x,y,o,A,p,m;for(b.prefer==null&&(b.prefer=['half']),b.require==null&&(b.require=[]),b.throws==null&&(b.throws=!0),q=this.getExtension('OES_texture_float'),e=this.getExtension('OES_texture_half_float'),z=this.getExtension('WEBGL_color_buffer_float'),B=this.getExtension('EXT_color_buffer_half_float'),u=this.getExtension('OES_texture_float_linear'),t=this.getExtension('OES_texture_half_float_linear'),k={texture:q!==null,filterable:u!==null,renderable:z!==null,score:0,precision:'single',half:!1,single:!0,type:this.FLOAT},l={texture:e!==null,filterable:t!==null,renderable:B!==null,score:0,precision:'half',half:!0,single:!1,type:(A=e!=null?e.HALF_FLOAT_OES:void 0)!=null?A:null},d=[],k.texture&&d.push(k),l.texture&&d.push(l),a=[],g=0,v=d.length;g<v;g++){for(c=d[g],n=!0,p=b.require,i=0,w=p.length;i<w;i++)h=p[i],c[h]===!1&&(n=!1);n&&a.push(c)}for(j=0,x=a.length;j<x;j++)for(c=a[j],m=b.prefer,f=o=0,y=m.length;o<y;f=++o)s=m[f],r=Math.pow(2,b.prefer.length-f-1),c[s]&&(c.score+=r);if(a.sort(function(a,b){return a.score===b.score?0:a.score<b.score?1:a.score>b.score?-1:void 0}),a.length===0)if(b.throws)throw'No floating point texture support that is '+b.require.join(', ');else return null;else return a=a[0],{filterable:a.filterable,renderable:a.renderable,type:a.type,precision:a.precision}}}},h(),i(),a=function(){function a(d,a){var b,c;this.gl=d,c=a.vertex,b=a.fragment,this.program=this.gl.createProgram(),this.vs=this.gl.createShader(this.gl.VERTEX_SHADER),this.fs=this.gl.createShader(this.gl.FRAGMENT_SHADER),this.gl.attachShader(this.program,this.vs),this.gl.attachShader(this.program,this.fs),this.compileShader(this.vs,c),this.compileShader(this.fs,b),this.link(),this.value_cache={},this.uniform_cache={},this.attribCache={}}return a.prototype.attribLocation=function(b){var a;return a=this.attribCache[b],a===void 0&&(a=this.attribCache[b]=this.gl.getAttribLocation(this.program,b)),a},a.prototype.compileShader=function(a,b){if(this.gl.shaderSource(a,b),this.gl.compileShader(a),!this.gl.getShaderParameter(a,this.gl.COMPILE_STATUS))throw'Shader Compile Error: '+this.gl.getShaderInfoLog(a)},a.prototype.link=function(){if(this.gl.linkProgram(this.program),!this.gl.getProgramParameter(this.program,this.gl.LINK_STATUS))throw'Shader Link Error: '+this.gl.getProgramInfoLog(this.program)},a.prototype.use=function(){return this.gl.useProgram(this.program),this},a.prototype.uniformLoc=function(b){var a;return a=this.uniform_cache[b],a===void 0&&(a=this.uniform_cache[b]=this.gl.getUniformLocation(this.program,b)),a},a.prototype.int=function(a,b){var d,c;return d=this.value_cache[a],d!==b&&(this.value_cache[a]=b,c=this.uniformLoc(a),c&&this.gl.uniform1i(c,b)),this},a.prototype.vec2=function(b,c,d){var a;return a=this.uniformLoc(b),a&&this.gl.uniform2f(a,c,d),this},a.prototype.float=function(a,b){var d,c;return d=this.value_cache[a],d!==b&&(this.value_cache[a]=b,c=this.uniformLoc(a),c&&this.gl.uniform1f(c,b)),this},a}(),g=function(){function a(a){this.gl=a,this.buffer=this.gl.createFramebuffer()}return a.prototype.destroy=function(){return this.gl.deleteFRamebuffer(this.buffer)},a.prototype.bind=function(){return this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,this.buffer),this},a.prototype.unbind=function(){return this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,null),this},a.prototype.check=function(){var a;a=this.gl.checkFramebufferStatus(this.gl.FRAMEBUFFER);switch(a){case this.gl.FRAMEBUFFER_UNSUPPORTED:throw'Framebuffer is unsupported';case this.gl.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:throw'Framebuffer incomplete attachment';case this.gl.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:throw'Framebuffer incomplete dimensions';case this.gl.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:throw'Framebuffer incomplete missing attachment'}return this},a.prototype.color=function(a){return this.gl.framebufferTexture2D(this.gl.FRAMEBUFFER,this.gl.COLOR_ATTACHMENT0,a.target,a.handle,0),this.check(),this},a.prototype.depth=function(a){return this.gl.framebufferRenderbuffer(this.gl.FRAMEBUFFER,this.gl.DEPTH_ATTACHMENT,this.gl.RENDERBUFFER,a.id),this.check(),this},a.prototype.destroy=function(){return this.gl.deleteFramebuffer(this.buffer)},a}(),d=function(){function a(d,a){var b,c;this.gl=d,a==null&&(a={}),this.channels=this.gl[((b=a.channels)!=null?b:'rgba').toUpperCase()],typeof a.type==='number'?this.type=a.type:this.type=this.gl[((c=a.type)!=null?c:'unsigned_byte').toUpperCase()];switch(this.channels){case this.gl.RGBA:this.chancount=4;break;case this.gl.RGB:this.chancount=3;break;case this.gl.LUMINANCE_ALPHA:this.chancount=2;break;default:this.chancount=1}this.target=this.gl.TEXTURE_2D,this.handle=this.gl.createTexture()}return a.prototype.destroy=function(){return this.gl.deleteTexture(this.handle)},a.prototype.bind=function(a){if(a==null&&(a=0),a>15)throw'Texture unit too large: '+a;return this.gl.activeTexture(this.gl.TEXTURE0+a),this.gl.bindTexture(this.target,this.handle),this},a.prototype.setSize=function(a,b){return this.width=a,this.height=b,this.gl.texImage2D(this.target,0,this.channels,this.width,this.height,0,this.channels,this.type,null),this},a.prototype.upload=function(a){return this.width=a.width,this.height=a.height,this.gl.texImage2D(this.target,0,this.channels,this.channels,this.type,a),this},a.prototype.linear=function(){return this.gl.texParameteri(this.target,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.target,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this},a.prototype.nearest=function(){return this.gl.texParameteri(this.target,this.gl.TEXTURE_MAG_FILTER,this.gl.NEAREST),this.gl.texParameteri(this.target,this.gl.TEXTURE_MIN_FILTER,this.gl.NEAREST),this},a.prototype.clampToEdge=function(){return this.gl.texParameteri(this.target,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.target,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this},a.prototype.repeat=function(){return this.gl.texParameteri(this.target,this.gl.TEXTURE_WRAP_S,this.gl.REPEAT),this.gl.texParameteri(this.target,this.gl.TEXTURE_WRAP_T,this.gl.REPEAT),this},a}(),f=function(){function a(b,c,e){var a;this.gl=b,this.width=c,this.height=e,a=this.gl.getFloatExtension({require:['renderable']}),this.texture=new d(this.gl,{type:a.type}).bind(0).setSize(this.width,this.height).nearest().clampToEdge(),this.fbo=new g(this.gl).bind().color(this.texture).unbind()}return a.prototype.use=function(){return this.fbo.bind()},a.prototype.bind=function(a){return this.texture.bind(a)},a.prototype.end=function(){return this.fbo.unbind()},a.prototype.resize=function(a,b){return this.width=a,this.height=b,this.texture.bind(0).setSize(this.width,this.height)},a}(),c='attribute vec4 position;\nvarying vec2 texcoord;\nvoid main(){\n texcoord = position.xy*0.5+0.5;\n gl_Position = position;\n}',b='#ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp int;\n precision highp float;\n#else\n precision mediump int;\n precision mediump float;\n#endif\nuniform sampler2D source;\nvarying vec2 texcoord;',j=function(){function d(h,i,j,k){var g,d,e;for(this.heatmap=h,this.gl=i,this.width=j,this.height=k,this.shader=new a(this.gl,{vertex:'attribute vec4 position, intensity;\nvarying vec2 off, dim;\nvarying float vIntensity;\nuniform vec2 viewport;\n\nvoid main(){\n dim = abs(position.zw);\n off = position.zw;\n vec2 pos = position.xy + position.zw;\n vIntensity = intensity.x;\n gl_Position = vec4((pos/viewport)*2.0-1.0, 0.0, 1.0);\n}',fragment:'#ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp int;\n precision highp float;\n#else\n precision mediump int;\n precision mediump float;\n#endif\nvarying vec2 off, dim;\nvarying float vIntensity;\nvoid main(){\n float falloff = (1.0 - smoothstep(0.0, 1.0, length(off/dim)));\n float intensity = falloff*vIntensity;\n gl_FragColor = vec4(intensity);\n}'}),this.clampShader=new a(this.gl,{vertex:c,fragment:b+'uniform float low, high;\nvoid main(){\n gl_FragColor = vec4(clamp(texture2D(source, texcoord).rgb, low, high), 1.0);\n}'}),this.multiplyShader=new a(this.gl,{vertex:c,fragment:b+'uniform float value;\nvoid main(){\n gl_FragColor = vec4(texture2D(source, texcoord).rgb*value, 1.0);\n}'}),this.blurShader=new a(this.gl,{vertex:c,fragment:b+'uniform vec2 viewport;\nvoid main(){\n vec4 result = vec4(0.0);\n for(int x=-1; x<=1; x++){\n for(int y=-1; y<=1; y++){\n vec2 off = vec2(x,y)/viewport;\n //float factor = 1.0 - smoothstep(0.0, 1.5, length(off));\n float factor = 1.0;\n result += vec4(texture2D(source, texcoord+off).rgb*factor, factor);\n }\n }\n gl_FragColor = vec4(result.rgb/result.w, 1.0);\n}'}),this.nodeBack=new f(this.gl,this.width,this.height),this.nodeFront=new f(this.gl,this.width,this.height),this.vertexBuffer=this.gl.createBuffer(),this.vertexSize=8,this.maxPointCount=10240,this.vertexBufferData=new Float32Array(this.maxPointCount*this.vertexSize*6),this.vertexBufferViews=[],g=d=0,e=this.maxPointCount;0<=e?d<e:d>e;g=0<=e?++d:--d)this.vertexBufferViews.push(new Float32Array(this.vertexBufferData.buffer,0,g*this.vertexSize*6));this.bufferIndex=0,this.pointCount=0}return d.prototype.resize=function(a,b){return this.width=a,this.height=b,this.nodeBack.resize(this.width,this.height),this.nodeFront.resize(this.width,this.height)},d.prototype.update=function(){var a,b;return this.pointCount>0?(this.gl.enable(this.gl.BLEND),this.nodeFront.use(),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.vertexBuffer),this.gl.bufferData(this.gl.ARRAY_BUFFER,this.vertexBufferViews[this.pointCount],this.gl.STREAM_DRAW),b=this.shader.attribLocation('position'),a=this.shader.attribLocation('intensity'),this.gl.enableVertexAttribArray(1),this.gl.vertexAttribPointer(b,4,this.gl.FLOAT,!1,32,0),this.gl.vertexAttribPointer(a,4,this.gl.FLOAT,!1,32,16),this.shader.use().vec2('viewport',this.width,this.height),this.gl.drawArrays(this.gl.TRIANGLES,0,this.pointCount*6),this.gl.disableVertexAttribArray(1),this.pointCount=0,this.bufferIndex=0,this.nodeFront.end(),this.gl.disable(this.gl.BLEND)):void 0},d.prototype.clear=function(){return this.nodeFront.use(),this.gl.clearColor(0,0,0,1),this.gl.clear(this.gl.COLOR_BUFFER_BIT),this.nodeFront.end()},d.prototype.clamp=function(a,b){return this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.heatmap.quad),this.gl.vertexAttribPointer(0,4,this.gl.FLOAT,!1,0,0),this.nodeFront.bind(0),this.nodeBack.use(),this.clampShader.use().int('source',0).float('low',a).float('high',b),this.gl.drawArrays(this.gl.TRIANGLES,0,6),this.nodeBack.end(),this.swap()},d.prototype.multiply=function(a){return this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.heatmap.quad),this.gl.vertexAttribPointer(0,4,this.gl.FLOAT,!1,0,0),this.nodeFront.bind(0),this.nodeBack.use(),this.multiplyShader.use().int('source',0).float('value',a),this.gl.drawArrays(this.gl.TRIANGLES,0,6),this.nodeBack.end(),this.swap()},d.prototype.blur=function(){return this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.heatmap.quad),this.gl.vertexAttribPointer(0,4,this.gl.FLOAT,!1,0,0),this.nodeFront.bind(0),this.nodeBack.use(),this.blurShader.use().int('source',0).vec2('viewport',this.width,this.height),this.gl.drawArrays(this.gl.TRIANGLES,0,6),this.nodeBack.end(),this.swap()},d.prototype.swap=function(){var a;return a=this.nodeFront,this.nodeFront=this.nodeBack,this.nodeBack=a},d.prototype.addVertex=function(b,c,d,e,a){return this.vertexBufferData[this.bufferIndex++]=b,this.vertexBufferData[this.bufferIndex++]=c,this.vertexBufferData[this.bufferIndex++]=d,this.vertexBufferData[this.bufferIndex++]=e,this.vertexBufferData[this.bufferIndex++]=a,this.vertexBufferData[this.bufferIndex++]=a,this.vertexBufferData[this.bufferIndex++]=a,this.vertexBufferData[this.bufferIndex++]=a},d.prototype.addPoint=function(d,b,e,c){var a;return e==null&&(e=50),c==null&&(c=.2),this.pointCount>=this.maxPointCount-1&&this.update(),b=this.height-b,a=e/2,this.addVertex(d,b,-a,-a,c),this.addVertex(d,b,+a,-a,c),this.addVertex(d,b,-a,+a,c),this.addVertex(d,b,-a,+a,c),this.addVertex(d,b,+a,-a,c),this.addVertex(d,b,+a,+a,c),this.pointCount+=1},d}(),k=function(){function e(o){var r,l,q,n,e,h,k,i,p,g,f,m;f=o!=null?o:{},this.canvas=f.canvas,this.width=f.width,this.height=f.height,k=f.intensityToAlpha,e=f.gradientTexture,l=f.alphaRange,this.canvas||(this.canvas=document.createElement('canvas'));try{if(this.gl=this.canvas.getContext('experimental-webgl',{depth:!1,antialias:!1}),this.gl===null&&(this.gl=this.canvas.getContext('webgl',{depth:!1,antialias:!1}),this.gl===null))throw'WebGL not supported'}catch(a){throw'WebGL not supported'}window.WebGLDebugUtils!=null&&(console.log('debugging mode'),this.gl=WebGLDebugUtils.makeDebugContext(this.gl,function(a,b,c){throw WebGLDebugUtils.glEnumToString(a)+' was caused by call to: '+b})),this.gl.enableVertexAttribArray(0),this.gl.blendFunc(this.gl.ONE,this.gl.ONE),e?(g=this.gradientTexture=new d(this.gl,{channels:'rgba'}).bind(0).setSize(2,2).nearest().clampToEdge(),typeof e==='string'?(h=new Image,h.onload=function(){return g.bind().upload(h)},h.src=e):e.width>0&&e.height>0?g.upload(e):e.onload=function(){return g.upload(e)},n='uniform sampler2D gradientTexture;\nvec3 getColor(float intensity){\n return texture2D(gradientTexture, vec2(intensity, 0.0)).rgb;\n}'):(g=null,n='vec3 getColor(float intensity){\n vec3 blue = vec3(0.0, 0.0, 1.0);\n vec3 cyan = vec3(0.0, 1.0, 1.0);\n vec3 green = vec3(0.0, 1.0, 0.0);\n vec3 yellow = vec3(1.0, 1.0, 0.0);\n vec3 red = vec3(1.0, 0.0, 0.0);\n\n vec3 color = (\n fade(-0.25, 0.25, intensity)*blue +\n fade(0.0, 0.5, intensity)*cyan +\n fade(0.25, 0.75, intensity)*green +\n fade(0.5, 1.0, intensity)*yellow +\n smoothstep(0.75, 1.0, intensity)*red\n );\n return color;\n}'),k==null&&(k=!0),k?(m=l!=null?l:[0,1],q=m[0],r=m[1],i='vec4 alphaFun(vec3 color, float intensity){\n float alpha = smoothstep('+q.toFixed(8)+', '+r.toFixed(8)+', intensity);\n return vec4(color*alpha, alpha);\n}'):i='vec4 alphaFun(vec3 color, float intensity){\n return vec4(color, 1.0);\n}',this.output=i,this.shader=new a(this.gl,{vertex:c,fragment:b+('float linstep(float low, float high, float value){\n return clamp((value-low)/(high-low), 0.0, 1.0);\n}\n\nfloat fade(float low, float high, float value){\n float mid = (low+high)*0.5;\n float range = (high-low)*0.5;\n float x = 1.0 - clamp(abs(mid-value)/range, 0.0, 1.0);\n return smoothstep(0.0, 1.0, x);\n}\n\n'+n+'\n'+i+'\n\nvoid main(){\n float intensity = smoothstep(0.0, 1.0, texture2D(source, texcoord).r);\n vec3 color = getColor(intensity);\n gl_FragColor = alphaFun(color, intensity);\n}')}),this.width==null&&(this.width=this.canvas.offsetWidth||2),this.height==null&&(this.height=this.canvas.offsetHeight||2),this.canvas.width=this.width,this.canvas.height=this.height,this.gl.viewport(0,0,this.width,this.height),this.quad=this.gl.createBuffer(),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.quad),p=new Float32Array([-1,-1,0,1,1,-1,0,1,-1,1,0,1,-1,1,0,1,1,-1,0,1,1,1,0,1]),this.gl.bufferData(this.gl.ARRAY_BUFFER,p,this.gl.STATIC_DRAW),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,null),this.heights=new j(this,this.gl,this.width,this.height)}return e.prototype.adjustSize=function(){var a,b;return b=this.canvas.offsetWidth||2,a=this.canvas.offsetHeight||2,this.width!==b||this.height!==a?(this.gl.viewport(0,0,b,a),this.canvas.width=b,this.canvas.height=a,this.width=b,this.height=a,this.heights.resize(this.width,this.height)):void 0},e.prototype.display=function(){return this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.quad),this.gl.vertexAttribPointer(0,4,this.gl.FLOAT,!1,0,0),this.heights.nodeFront.bind(0),this.gradientTexture&&this.gradientTexture.bind(1),this.shader.use().int('source',0).int('gradientTexture',1),this.gl.drawArrays(this.gl.TRIANGLES,0,6)},e.prototype.update=function(){return this.heights.update()},e.prototype.clear=function(){return this.heights.clear()},e.prototype.clamp=function(a,b){return a==null&&(a=0),b==null&&(b=1),this.heights.clamp(a,b)},e.prototype.multiply=function(a){return a==null&&(a=.95),this.heights.multiply(a)},e.prototype.blur=function(){return this.heights.blur()},e.prototype.addPoint=function(a,b,c,d){return this.heights.addPoint(a,b,c,d)},e.prototype.addPoints=function(d){var a,b,e,c;for(c=[],b=0,e=d.length;b<e;b++)a=d[b],c.push(this.addPoint(a.x,a.y,a.size,a.intensity));return c},e.prototype.updateOptions=function(e,f,g){e?(textureGradient=this.gradientTexture=new d(this.gl,{channels:'rgba'}).bind(0).setSize(2,2).nearest().clampToEdge(),typeof e==='string'?(image=new Image,image.onload=function(){return textureGradient.bind().upload(image)},image.src=e):e.width>0&&e.height>0?textureGradient.upload(e):e.onload=function(){return textureGradient.upload(e)},getColorFun='uniform sampler2D gradientTexture;\nvec3 getColor(float intensity){\n return texture2D(gradientTexture, vec2(intensity, 0.0)).rgb;\n}'):(textureGradient=null,getColorFun='vec3 getColor(float intensity){\n vec3 blue = vec3(0.0, 0.0, 1.0);\n vec3 cyan = vec3(0.0, 1.0, 1.0);\n vec3 green = vec3(0.0, 1.0, 0.0);\n vec3 yellow = vec3(1.0, 1.0, 0.0);\n vec3 red = vec3(1.0, 0.0, 0.0);\n\n vec3 color = (\n fade(-0.25, 0.25, intensity)*blue +\n fade(0.0, 0.5, intensity)*cyan +\n fade(0.25, 0.75, intensity)*green +\n fade(0.5, 1.0, intensity)*yellow +\n smoothstep(0.75, 1.0, intensity)*red\n );\n return color;\n}'),this.output='vec4 alphaFun(vec3 color, float intensity){\n float alpha = smoothstep('+f.toFixed(8)+', '+g.toFixed(8)+', intensity);\n return vec4(color*alpha, alpha);\n}',this.shader=new a(this.gl,{vertex:c,fragment:b+('float linstep(float low, float high, float value){\n return clamp((value-low)/(high-low), 0.0, 1.0);\n}\n\nfloat fade(float low, float high, float value){\n float mid = (low+high)*0.5;\n float range = (high-low)*0.5;\n float x = 1.0 - clamp(abs(mid-value)/range, 0.0, 1.0);\n return smoothstep(0.0, 1.0, x);\n}\n\n'+getColorFun+'\n'+this.output+'\n\nvoid main(){\n float intensity = smoothstep(0.0, 1.0, texture2D(source, texcoord).r);\n vec3 color = getColor(intensity);\n gl_FragColor = alphaFun(color, intensity);\n}')})},e}(),module.exports=k |
@@ -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=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),a&&this.kLeafLayer.beginDraw(),this.draw(),a&&this.kLeafLayer.endDraw()},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=d.getClientRect(),e=a.x+a.width/2,g=a.y+a.height/2,b=c.containerPointToLatLng(f.point(e,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 c(a){this.initialize(a)}var f=require('bcore/event'),b=require('./../core/utils'),g=require('./../render/leaflet_layer_konva'),e=require('konva'),d=require('./../leaflet'),h=require('lodash'),i=b.fireEvent,a=b.getValue;c.options={ptNPerLayer:2e3,lazyFresh:{transition:'opacity 0.4s'},blending:'lighter',lng:b.getLng,lat:b.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}},c=f.extend(c,{addTo:function(a){this._map=a,this.initCanvas(),this.initEventsMap(),this.initEventsShapes()},initialize:function(a){a=this.options=b.deepMerge(c.options,a),this.resetVariables()},resetVariables:function(){this.isable=!0},disable:function(){this.isable=!1,this.kLeafLayer.disable()},enable:function(){this.isable=!0,this.kLeafLayer.enable()},initCanvas:function(){var b=this._map,a=this.options,c=b.getSize(),d=new e.Stage({container:a.container,width:c.x,height:c.y}),f=this.kLeafLayer=new g(d,{transition:a.lazyFresh.transition,blending:a.blending,ptNPerLayer:a.ptNPerLayer});f.addTo(b)},data:function(c){this._data=c;var a=this.options,b=a.zIndex||a.child.zIndex;b&&(this._data=h.sortBy(c,b))},createShapeAttr:function(c,h){if(!this.isable)return;var b=this.options,f=this._map.getZoom(),i=a(b.lat,c),j=a(b.lng,c),k=a(b.id.bind(b),c,h),l=a(b.radius,c,f)||1,m=a(b.angle,c,f)||1,n=a(b.rotation,c,f),o=a(b.fill,c,f),p=a(b.stroke,c,f),q=a(b.strokeWidth,c,f),g=this._map.latLngToContainerPoint(d.latLng(i,j));return{data:c,Constructor:e.Wedge,index:h,id:k,attrs:{x:g.x,y:g.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),a&&this.kLeafLayer.beginDraw(),this.draw(),a&&this.kLeafLayer.endDraw()},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,e=g.target,f=e.__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(f),setTimeout(function(){var a=e.getClientRect(),f=a.x+a.width/2,g=a.y+a.height/2,b=c.containerPointToLatLng(d.point(f,g));c.openPopup(popupText,d.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){i(a,b,d)})})}}),module.exports=c |
@@ -1,1 +0,1 @@ | ||
function a(){}var b=require('./class'),c=Array.isArray||function(a){return Object.prototype.toString.call(a)==='[object Array]'?!0:!1};b.extend(a),module.exports=a,exports.EventEmitter=a;var d=100;a.prototype.setMaxListeners=function(a){this._events||(this._events={}),this._maxListeners=a},a.prototype.emit=function(){var f=arguments[0];if(f==='error'&&(!(this._events&&this._events.error)||c(this._events.error)&&!this._events.error.length))throw arguments[1]instanceof Error?arguments[1]:new Error('Uncaught, unspecified \'error\' event.');if(!this._events)return!1;var d=this._events[f];if(!d)return!1;if(!(typeof d=='function'))if(c(d)){var b=arguments.length,e=new Array(b-1);for(var a=1;a<b;a++)e[a-1]=arguments[a];var g=d.slice();for(var a=0,b=g.length;a<b;a++)g[a].apply(this,e);return!0}else return!1;switch(arguments.length){case 1:d.call(this);break;case 2:d.call(this,arguments[1]);break;case 3:d.call(this,arguments[1],arguments[2]);break;default:var b=arguments.length;var e=new Array(b-1);for(var a=1;a<b;a++)e[a-1]=arguments[a];d.apply(this,e)}return!0},a.prototype.addListener=function(a,b){if('function'!==typeof b)throw new Error('addListener only takes instances of Function');if(this._events||(this._events={}),this.emit('newListener',a,b),this._events[a]?c(this._events[a])?this._events[a].push(b):this._events[a]=[this._events[a],b]:this._events[a]=b,c(this._events[a])&&!this._events[a].warned){var e;this._maxListeners!==undefined?e=this._maxListeners:e=d,e&&e>0&&this._events[a].length>e&&(this._events[a].warned=!0,console.error('Possible mem-leak detected. event['+a+'] %d listeners added. '+'Use emitter.setMaxListeners() to increase limit.',this._events[a].length),console.trace())}return this},a.prototype.on=a.prototype.addListener,a.prototype.once=function(d,a){function b(){c.removeListener(d,b),a.apply(this,arguments)}if('function'!==typeof a)throw new Error('.once only takes instances of Function');var c=this;return b.listener=a,c.on(d,b),this},a.prototype.removeListener=function(e,d){if('function'!==typeof d)throw new Error('removeListener only takes instances of Function');if(!(this._events&&this._events[e]))return this;var a=this._events[e];if(c(a)){var f=-1;for(var b=0,g=a.length;b<g;b++)if(a[b]===d||a[b].listener&&a[b].listener===d){f=b;break}if(f<0)return this;a.splice(f,1),a.length==0&&delete this._events[e]}else(a===d||a.listener&&a.listener===d)&&delete this._events[e];return this},a.prototype.removeAllListeners=function(a){return arguments.length===0?(this._events={},this):(a&&this._events&&this._events[a]&&(this._events[a]=null),this)},a.prototype.listeners=function(a){return this._events||(this._events={}),this._events[a]||(this._events[a]=[]),c(this._events[a])||(this._events[a]=[this._events[a]]),this._events[a]} | ||
function a(){}var c=require('./class'),b=Array.isArray||function(a){return Object.prototype.toString.call(a)==='[object Array]'?!0:!1};c.extend(a),module.exports=a,exports.EventEmitter=a;var d=100;a.prototype.setMaxListeners=function(a){this._events||(this._events={}),this._maxListeners=a},a.prototype.emit=function(){var f=arguments[0];if(f==='error'&&(!(this._events&&this._events.error)||b(this._events.error)&&!this._events.error.length))throw arguments[1]instanceof Error?arguments[1]:new Error('Uncaught, unspecified \'error\' event.');if(!this._events)return!1;var d=this._events[f];if(!d)return!1;if(!(typeof d=='function'))if(b(d)){var c=arguments.length,e=new Array(c-1);for(var a=1;a<c;a++)e[a-1]=arguments[a];var g=d.slice();for(var a=0,c=g.length;a<c;a++)g[a].apply(this,e);return!0}else return!1;switch(arguments.length){case 1:d.call(this);break;case 2:d.call(this,arguments[1]);break;case 3:d.call(this,arguments[1],arguments[2]);break;default:var c=arguments.length;var e=new Array(c-1);for(var a=1;a<c;a++)e[a-1]=arguments[a];d.apply(this,e)}return!0},a.prototype.addListener=function(a,c){if('function'!==typeof c)throw new Error('addListener only takes instances of Function');if(this._events||(this._events={}),this.emit('newListener',a,c),this._events[a]?b(this._events[a])?this._events[a].push(c):this._events[a]=[this._events[a],c]:this._events[a]=c,b(this._events[a])&&!this._events[a].warned){var e;this._maxListeners!==undefined?e=this._maxListeners:e=d,e&&e>0&&this._events[a].length>e&&(this._events[a].warned=!0,console.error('Possible mem-leak detected. event['+a+'] %d listeners added. '+'Use emitter.setMaxListeners() to increase limit.',this._events[a].length),console.trace())}return this},a.prototype.on=a.prototype.addListener,a.prototype.once=function(d,a){function b(){c.removeListener(d,b),a.apply(this,arguments)}if('function'!==typeof a)throw new Error('.once only takes instances of Function');var c=this;return b.listener=a,c.on(d,b),this},a.prototype.removeListener=function(e,d){if('function'!==typeof d)throw new Error('removeListener only takes instances of Function');if(!(this._events&&this._events[e]))return this;var a=this._events[e];if(b(a)){var f=-1;for(var c=0,g=a.length;c<g;c++)if(a[c]===d||a[c].listener&&a[c].listener===d){f=c;break}if(f<0)return this;a.splice(f,1),a.length==0&&delete this._events[e]}else(a===d||a.listener&&a.listener===d)&&delete this._events[e];return this},a.prototype.removeAllListeners=function(a){return arguments.length===0?(this._events={},this):(a&&this._events&&this._events[a]&&(this._events[a]=null),this)},a.prototype.listeners=function(a){return this._events||(this._events={}),this._events[a]||(this._events[a]=[]),b(this._events[a])||(this._events[a]=[this._events[a]]),this._events[a]} |
@@ -1,1 +0,1 @@ | ||
'use strict';function a(a,b){this.initialize(a,b)}var b=require('./../libs/event'),c=require('./../core/utils'),d=require('jquery'),e=c.prevent,f=c.getPt;b.extend(a,{isLinking:!1,initialize:function(a,b){this.options=c.deepMerge({type:'data'},b),this.container=a,this.initDom(),this.initEvents()},initDom:function(){var b=this.options,a='node-'+b.type,c=this.nodeContainer=d(' <div class="node '+a+'">'+b.text+' <div class="dot-left '+a+'"></div> <div class="dot-right '+a+'"></div> </div>').appendTo(this.container);this.leftNode=c.find('.dot-left'),this.rightNode=c.find('.dot-right'),window.rightNode=this.rightNode},initEvents:function(){var a=!1,b=this,c=this.nodeContainer;c.on('mousedown touchstart',function(b){b.preventDefault(),a=!0,b.preventD}).on('mousemove touchmove',function(c){if(window.linkUIGlobal&&linkUIGlobal.trigger('node-over',b),c.preventDefault(),!a)return;window.linkUIGlobal&&linkUIGlobal.trigger('node-action',b)}).on('mouseup touchend',function(c){c.preventDefault(),a=!1,b.isLinking=!1}).on('mouseout touchleave',function(a){a.preventDefault(),window.linkUIGlobal&&linkUIGlobal.trigger('node-leave',this)})},getPosition:function(){var b=this.leftNode,c=b[0].getBoundingClientRect(),e=this.rightNode,d=e[0].getBoundingClientRect(),a=b.width()/2;return{left:{left:c.left+a,top:c.top+a},right:{left:d.left+a,top:d.top+a}}},getType:function(){return this.options.type}}),module.exports=a | ||
'use strict';function b(a,b){this.initialize(a,b)}var c=require('./../libs/event'),a=require('./../core/utils'),d=require('jquery'),e=a.prevent,f=a.getPt;c.extend(b,{isLinking:!1,initialize:function(b,c){this.options=a.deepMerge({type:'data'},c),this.container=b,this.initDom(),this.initEvents()},initDom:function(){var b=this.options,a='node-'+b.type,c=this.nodeContainer=d(' <div class="node '+a+'">'+b.text+' <div class="dot-left '+a+'"></div> <div class="dot-right '+a+'"></div> </div>').appendTo(this.container);this.leftNode=c.find('.dot-left'),this.rightNode=c.find('.dot-right'),window.rightNode=this.rightNode},initEvents:function(){var a=!1,b=this,c=this.nodeContainer;c.on('mousedown touchstart',function(b){b.preventDefault(),a=!0,b.preventD}).on('mousemove touchmove',function(c){if(window.linkUIGlobal&&linkUIGlobal.trigger('node-over',b),c.preventDefault(),!a)return;window.linkUIGlobal&&linkUIGlobal.trigger('node-action',b)}).on('mouseup touchend',function(c){c.preventDefault(),a=!1,b.isLinking=!1}).on('mouseout touchleave',function(a){a.preventDefault(),window.linkUIGlobal&&linkUIGlobal.trigger('node-leave',this)})},getPosition:function(){var b=this.leftNode,c=b[0].getBoundingClientRect(),e=this.rightNode,d=e[0].getBoundingClientRect(),a=b.width()/2;return{left:{left:c.left+a,top:c.top+a},right:{left:d.left+a,top:d.top+a}}},getType:function(){return this.options.type}}),module.exports=b |
@@ -1,1 +0,1 @@ | ||
'use strict';function a(a,b){this.initialize(a,b)}var b=require('./../libs/event'),c=require('./../core/utils'),d=require('jquery'),e=require('./node_base');e.extend(a,{options:{type:'data'}}),module.exports=a | ||
'use strict';function a(a,b){this.initialize(a,b)}var c=require('./../libs/event'),d=require('./../core/utils'),e=require('jquery'),b=require('./node_base');b.extend(a,{options:{type:'data'}}),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 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 | ||
'use strict';function o(a,b){return a.length<b?a:a.substring(0,b)}function h(a,b){this.initialize(a,b)}var k=require('./../libs/event'),a=require('./../core/utils'),n=a.prevent,d=a.getPt,b=require('jquery'),f=require('./parser'),c=require('./node'),j=require('./sub_node');require('./gui.css');var e=require('./link_ui_global'),l=require('./link'),m=require('./link_process'),i=require('./panel_link'),g=b('body');k.extend(h,{options:{},initialize:function(b,c){this.options=a.deepMerge(this.options,c),this.container=b||g,this.initDom(),this.parser=f(),this.linkProcess=new m,this.panelLink=new i(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=b(' <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,b=a.values,d=this.dataColumn,e=this.visualerContainer,i=new c(d,{type:'data',text:a.key,mainContainer:e});for(var f in b)g=b[f],new j(d,{type:'data',text:f+': '+o(g.toString(),7),mainContainer:e})},renderDataFormatedColumn:function(b){var d=this.formatedColumn,e=this.visualerContainer;for(var a in b){var f=b[a];new c(d,{type:'data-formated',text:a,mainContainer:e})}},renderShapeColumn:function(b){var d=this.visualerContainer,e=this.shapeColumn;for(var a in b){var f=b[a];new c(e,{type:'shape',text:a,mainContainer:d})}},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,g=!1;this.isLinking=!1;var f,i,j,c;window.linkUIGlobal&&e.on('node-action',function(b){a.isLinking||(a.isLinking=!0,j=b)}).on('node-over',function(b){a.isLinking&&(c=b)}).on('node-leave',function(a){c===a&&(c=null)});var h=this.visualerContainer;h.on('mousedown touchstart',function(c){c.target===b(this)[0]&&window.linkUIGlobal&&e.trigger('panel_com_tap'),i=a.ptS=d(c,h),g=!0,f=new l(a.svg,{x:i[0],y:i[1]}),a.initEventsLink(f)}).on('mousemove touchmove',function(c){if(!g)return;if(a.isLinking){a.emit('add-link'),a.isLinking=!0;var b=d(c,h);f.update(b[0],b[1])}}).on('mouseup touchend',function(b){g=!1,a.isLinking=!1,c?(a.emit('link-processing',{from:j,to:c,link:f}),f.end(c)):f.break(),j=null,c=null})}}),module.exports=h |
@@ -1,1 +0,1 @@ | ||
'use strict';function a(a,b){this.initialize(a,b)}var b=require('./../libs/event'),c=require('./../core/utils'),d=require('jquery');require('./lib/anim');var e=c.prevent,f=require('./utils'),g=d('body');require('./lib/animate.min.css');var h=function(a){return a.stopPropagation()};b.extend(a,{options:{isOut:!0},initialize:function(a,b){this.options=c.deepMerge(this.options,b),this.isOut=this.options.isOut,this.container=a||g,this.initDom(),this.inputs=['x'],this.initEvents()},initEvents:function(){var c=this,a=this.submitButton,b=this.errorsNode;this.on('function-done',function(){a.addClass('submit-button-active')}),this.textarea.on('input propertychang',function(){var e=f.createFunction({inputs:c.inputs,body:d(this).val()});typeof e==='function'?(a.removeClass('submit-button-error').addClass('submit-button-active'),b.text('')):(a.removeClass('submit-button-active').addClass('submit-button-error'),b.text(e))}),this.container.on('mousedown touchstart',h),this.textarea.on('mousedown touchstart',h),a.on('mousedown touchstart',h),this.initEventsGlobal()},initEventsGlobal:function(){window.linkUIGlobal&&linkUIGlobal.on('panel_com_tap',this.out.bind(this))},initDom:function(){var a=this.container;d(' <div class="link-panel-bg"></div> <div class="link-panel"> <div class="link-symbol margin"> <div class="from"> <div class="circle"></div> </div> <div class="link"><span>➣</span></div> <div class="to"> <div class="circle"></div> </div> </div> <textarea type="text" alt="text" placeholder="请在区域输入函数 如 return x*x;.." class="text-input margin" value="haha"/> <div class="submit-area margin"> <div class="errors"></div> <div class="submit-button transition">提交</div> </div> </div> ').appendTo(a),this.bg=a.find('.link-panel-bg'),this.panel=a.find('.link-panel'),this.submitButton=this.panel.find('.submit-button'),this.textarea=a.find('textarea'),this.errorsNode=a.find('.errors')},out:function(){if(this.isOut)return;this.bg.keyAnim('fadeOut',{time:.3}),this.panel.keyAnim('fadeOutLeft',{time:.3}),this.isOut=!0},in:function(){if(!this.isOut)return;this.bg.keyAnim('fadeIn',{time:.1}),this.panel.keyAnim('fadeInLeft',{time:.1}),this.isOut=!1},clear:function(){this.errorsNode.empty(),this.textarea.empty()}}),module.exports=a | ||
'use strict';function d(a,b){this.initialize(a,b)}var e=require('./../libs/event'),c=require('./../core/utils'),a=require('jquery');require('./lib/anim');var h=c.prevent,f=require('./utils'),g=a('body');require('./lib/animate.min.css');var b=function(a){return a.stopPropagation()};e.extend(d,{options:{isOut:!0},initialize:function(a,b){this.options=c.deepMerge(this.options,b),this.isOut=this.options.isOut,this.container=a||g,this.initDom(),this.inputs=['x'],this.initEvents()},initEvents:function(){var e=this,c=this.submitButton,d=this.errorsNode;this.on('function-done',function(){c.addClass('submit-button-active')}),this.textarea.on('input propertychang',function(){var b=f.createFunction({inputs:e.inputs,body:a(this).val()});typeof b==='function'?(c.removeClass('submit-button-error').addClass('submit-button-active'),d.text('')):(c.removeClass('submit-button-active').addClass('submit-button-error'),d.text(b))}),this.container.on('mousedown touchstart',b),this.textarea.on('mousedown touchstart',b),c.on('mousedown touchstart',b),this.initEventsGlobal()},initEventsGlobal:function(){window.linkUIGlobal&&linkUIGlobal.on('panel_com_tap',this.out.bind(this))},initDom:function(){var b=this.container;a(' <div class="link-panel-bg"></div> <div class="link-panel"> <div class="link-symbol margin"> <div class="from"> <div class="circle"></div> </div> <div class="link"><span>➣</span></div> <div class="to"> <div class="circle"></div> </div> </div> <textarea type="text" alt="text" placeholder="请在区域输入函数 如 return x*x;.." class="text-input margin" value="haha"/> <div class="submit-area margin"> <div class="errors"></div> <div class="submit-button transition">提交</div> </div> </div> ').appendTo(b),this.bg=b.find('.link-panel-bg'),this.panel=b.find('.link-panel'),this.submitButton=this.panel.find('.submit-button'),this.textarea=b.find('textarea'),this.errorsNode=b.find('.errors')},out:function(){if(this.isOut)return;this.bg.keyAnim('fadeOut',{time:.3}),this.panel.keyAnim('fadeOutLeft',{time:.3}),this.isOut=!0},in:function(){if(!this.isOut)return;this.bg.keyAnim('fadeIn',{time:.1}),this.panel.keyAnim('fadeInLeft',{time:.1}),this.isOut=!1},clear:function(){this.errorsNode.empty(),this.textarea.empty()}}),module.exports=d |
@@ -1,1 +0,1 @@ | ||
'use strict';function a(a){this.initialize(a)}function b(b){return new a(b)}var c=require('./../libs/event'),d=require('./../core/utils');c.extend(a,{options:{originalMethods:{addOneTimeEventListener:!0,fireEvent:!0,clearAllEventListeners:!0,removeEventListener:!0,hasEventListeners:!0,addEventListener:!0,constructor:!0,callInitHooks:!0,options:!0,fire:!0,once:!0,off:!0,on:!0}},initialize:function(a){d.deepMerge(this,a)},parse:function(a){if(!a)return;this.methodsUpdate={},this.methods={},this.funcsGet={};var e=this.options.originalMethods,f=a.options||a.__proto__.options;this.parseOptions(f);var g=a.emits;this.parseEmits(g);var c=a.__proto__;for(var b in c){var d=c[b];if(b in e)continue;typeof d!=='function'||this.parseMethod(b,d)}return{component:a,updates:this.methodsUpdate,methods:this.methods,data2format:this.funcsGet,shapes:this.methodsUpdate}},parseMethod:function(a,b){this.methods[a]=b,a.indexOf('update')!==-1&&a[0]!=='_'&&(this.methodsUpdate[a]=b)},parseOptions:function(c){var b,d=this.funcsGet;for(var a in c)b=c[a],typeof b==='function'&&a.indexOf('get')!==-1&&(d[a]=b)},parseEmits:function(a){this.emits=a}}),module.exports=b | ||
'use strict';function a(a){this.initialize(a)}function d(b){return new a(b)}var b=require('./../libs/event'),c=require('./../core/utils');b.extend(a,{options:{originalMethods:{addOneTimeEventListener:!0,fireEvent:!0,clearAllEventListeners:!0,removeEventListener:!0,hasEventListeners:!0,addEventListener:!0,constructor:!0,callInitHooks:!0,options:!0,fire:!0,once:!0,off:!0,on:!0}},initialize:function(a){c.deepMerge(this,a)},parse:function(a){if(!a)return;this.methodsUpdate={},this.methods={},this.funcsGet={};var e=this.options.originalMethods,f=a.options||a.__proto__.options;this.parseOptions(f);var g=a.emits;this.parseEmits(g);var c=a.__proto__;for(var b in c){var d=c[b];if(b in e)continue;typeof d!=='function'||this.parseMethod(b,d)}return{component:a,updates:this.methodsUpdate,methods:this.methods,data2format:this.funcsGet,shapes:this.methodsUpdate}},parseMethod:function(a,b){this.methods[a]=b,a.indexOf('update')!==-1&&a[0]!=='_'&&(this.methodsUpdate[a]=b)},parseOptions:function(c){var b,d=this.funcsGet;for(var a in c)b=c[a],typeof b==='function'&&a.indexOf('get')!==-1&&(d[a]=b)},parseEmits:function(a){this.emits=a}}),module.exports=d |
@@ -1,1 +0,1 @@ | ||
'use strict';function a(a,b){this.initialize(a,b)}var b=require('./../libs/event'),c=require('./../core/utils'),d=require('jquery'),e=require('./node_base');e.extend(a,{options:{type:'data'},initDom:function(){var b=this.options,a='node-'+b.type,c=this.nodeContainer=d(' <div class="sub-node '+a+'">'+b.text+' <div class="dot-left '+a+'"></div> <div class="dot-right '+a+'"></div> </div>').appendTo(this.container);this.leftNode=c.find('.dot-left'),this.rightNode=c.find('.dot-right'),window.rightNode=this.rightNode},initEvents:function(){}}),module.exports=a | ||
'use strict';function a(a,b){this.initialize(a,b)}var d=require('./../libs/event'),e=require('./../core/utils'),b=require('jquery'),c=require('./node_base');c.extend(a,{options:{type:'data'},initDom:function(){var c=this.options,a='node-'+c.type,d=this.nodeContainer=b(' <div class="sub-node '+a+'">'+c.text+' <div class="dot-left '+a+'"></div> <div class="dot-right '+a+'"></div> </div>').appendTo(this.container);this.leftNode=d.find('.dot-left'),this.rightNode=d.find('.dot-right'),window.rightNode=this.rightNode},initEvents:function(){}}),module.exports=a |
@@ -1,1 +0,1 @@ | ||
'use strict';function a(h){var i='<script type="text/javascript">',e=b(),g='window.'+e+' = function(',a='',d=h.inputs;for(var f in d)a+=d[f],f!=d.length-1&&(a+=',');var k='){'+h.body+'};',l='</script>',j=i+g+a+k+l;try{return c(j).appendTo(c('body')),window[e]}catch(a){return a.toString()}}function b(){return'func_'+new Date().getTime()+'_'+d++}var c=require('jquery'),d=0;module.exports={createFunction:a} | ||
'use strict';function c(h){var i='<script type="text/javascript">',e=d(),g='window.'+e+' = function(',b='',c=h.inputs;for(var f in c)b+=c[f],f!=c.length-1&&(b+=',');var k='){'+h.body+'};',l='</script>',j=i+g+b+k+l;try{return a(j).appendTo(a('body')),window[e]}catch(a){return a.toString()}}function d(){return'func_'+new Date().getTime()+'_'+b++}var a=require('jquery'),b=0;module.exports={createFunction:c} |
@@ -1,1 +0,1 @@ | ||
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 | ||
var a=require('jquery'),b=require('leaflet'),e=require('./../core/utils'),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(a,d){if(a=e.getContainer(a),!a)return console.log('map container错误');var c=a.getAttribute('id');c||(c='map-'+Math.floor(Math.random()*1e9),a.setAttribute('id',c)),d=b.setOptions(this,d),b.Map.prototype.initialize.call(this,c,d);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 |
@@ -5,3 +5,3 @@ { | ||
"description": "2d map visualization lib", | ||
"version": "0.1.22", | ||
"version": "0.1.23", | ||
"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))},updateOptions:function(a){a=this.options=c.deepMerge(this.options,a),this.updateStyle()},updateStyle:function(){var a=this.options,b='';a.sepia!=0&&(b+='sepia('+a.sepia+'%)'+' '),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.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 d=require('bcore/event'),c=require('bcore/utils'),b=require('leaflet'),e=require('jquery');b.dmap=b.dmap||{},a.options={hueRotate:0,saturate:100,contrast:100,brightness:100,grayscale:0,opacity:1,anim:0,blur:0,sepia:0,invert:0},a=d.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.sepia!=0&&(b+='sepia('+a.sepia+'%)'+' '),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.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()}}),b.dmap.Filter=a,b.dmap.filter=function(b,c){return new a(b,c)},module.exports=a |
@@ -1,1 +0,1 @@ | ||
function a(a,b){this._map=a,this.initialize(a,b)}var b=require('leaflet'),c=require('bcore/utils'),d=require('bcore/event'),e=require('jquery'),f=b.dmap=b.dmap||{},a=d.extend(a,{initialize:function(d,b){b=this.options=c.deepMerge(a.options,b),this.initEventsMap(d)},initEventsMap:function(d){function e(e){var c=this.getLatlng(e);a.search(c,function(f){var e=a.text(f),g=b.popup().setLatLng(c).setContent(e).openOn(d)})}var a=this.options,c=a.eventType;c==='auto'&&(c=b.Browser.touch?'touchstart':'dblclick'),b.DomEvent.on(d._container,c,e,this)},getLatlng:function(d){var c=b.Browser.touch?d.touches[0]:d,a=this._map,e=a.mouseEventToContainerPoint({clientX:c.clientX,clientY:c.clientY}),f=a.containerPointToLayerPoint(e);return a.layerPointToLatLng(f)}});a.options={eventType:'auto',search:function(a,b){var c='http://restapi.amap.com/v3/geocode/regeo?location='+a.lng+','+a.lat+'&key=767b3f050b17f8c713e3835b18f57ff9&callback=a';e.ajax({url:c,dataType:'jsonp',jsonpCallback:'a',success:function(a){if(!(a&&a.regeocode))return;a=a.regeocode;var c=a.formatted_address;a=a.addressComponent,a.formatted_address=c,b&&b(a)}})},text:function(a){return['province','city','district','township'].map(function(b){return a[b]}).filter(function(a){return a&&a.length}).join(' | ')}},f.GeoCodingSearch=a,f.geoCodingSearch=function(b,c){return new a(b,c)},module.exports=a | ||
function a(a,b){this._map=a,this.initialize(a,b)}var b=require('leaflet'),d=require('bcore/utils'),e=require('bcore/event'),f=require('jquery'),c=b.dmap=b.dmap||{},a=e.extend(a,{initialize:function(c,b){b=this.options=d.deepMerge(a.options,b),this.initEventsMap(c)},initEventsMap:function(d){function e(e){var c=this.getLatlng(e);a.search(c,function(f){var e=a.text(f),g=b.popup().setLatLng(c).setContent(e).openOn(d)})}var a=this.options,c=a.eventType;c==='auto'&&(c=b.Browser.touch?'touchstart':'dblclick'),b.DomEvent.on(d._container,c,e,this)},getLatlng:function(d){var c=b.Browser.touch?d.touches[0]:d,a=this._map,e=a.mouseEventToContainerPoint({clientX:c.clientX,clientY:c.clientY}),f=a.containerPointToLayerPoint(e);return a.layerPointToLatLng(f)}});a.options={eventType:'auto',search:function(a,b){var c='http://restapi.amap.com/v3/geocode/regeo?location='+a.lng+','+a.lat+'&key=767b3f050b17f8c713e3835b18f57ff9&callback=a';f.ajax({url:c,dataType:'jsonp',jsonpCallback:'a',success:function(a){if(!(a&&a.regeocode))return;a=a.regeocode;var c=a.formatted_address;a=a.addressComponent,a.formatted_address=c,b&&b(a)}})},text:function(a){return['province','city','district','township'].map(function(b){return a[b]}).filter(function(a){return a&&a.length}).join(' | ')}},c.GeoCodingSearch=a,c.geoCodingSearch=function(b,c){return new a(b,c)},module.exports=a |
@@ -1,1 +0,1 @@ | ||
'use strict';function a(c,b){this.container=g.getContainer(c),b=arguments[arguments.length-1],this.options=g.deepMerge(a.options,b)}function b(c,d){var b;for(var a=0;a<c.length;a++){if(b=c[a],!b.style)continue;d(b)}}function c(a,b){return b=b||10,typeof a==='number'&&(a=a.toString()),a.length>b?a.substring(0,b):a}function d(a,b,d,e,f){return a=c(a,f),b=c(b,e),'<div class="leaflet-popup-line" id="'+d+'"> <div class="leaflet-popup-name">'+b+': </div> <a href="#'+a+'" class="leaflet-popup-value">'+a+'</a> </div>'}function e(a,b,d,e,f){return a=c(a,f),b=c(b,e),'<div class="leaflet-popup-line" id="'+d+'"> <div class="leaflet-popup-name">'+b+': </div> <input placeholder="'+a+'" class="leaflet-popup-value" value="'+a+'"></input> </div>'}var f=require('./../leaflet'),g=require('bcore/utils'),h=require('bcore/event');require('./popup.css'),a.options={type:'list',colorValue:'#00ffe1',colorLine:'rgba(0,0,0,0.2)',colorKey:'#938c8c',background:'rgba(20,20,20,0.4)',limitName:8,limitValue:15},a=h.extend(a,{bindTo:function(a){},updateStyle:function(){var a=this.options,c=this.container,d=c.parentNode,e=d.nextSibling.getElementsByClassName('leaflet-popup-tip')[0];d.style.background=e.style.background=a.background,b(c.getElementsByClassName('leaflet-popup-line'),function(b){b.style.color=a.colorKey}),b(c.getElementsByClassName('leaflet-popup-name'),function(b){b.style.color=a.colorKey}),b(c.getElementsByClassName('leaflet-popup-value'),function(b){b.style.color=a.colorValue})},data:function(a){this._data=a},render:function(a){a&&this.data(a),this.draw(),this.updateStyle(),this.initEvents()},getIncludeDefault:function(b){var b,a=[];for(var c in b)a.push({key:c});return a},draw:function(){var a=this._data,c=this,d=this.options.include||this.getIncludeDefault(a),b='';d.forEach(function(f){var d=f.key,g=f.name||d,e=a[d];e&&(b+=c.getHTML(e,g,d))}),this.container.style.width='auto',this.container.innerHTML=b},getHTML:function(b,c,f){var a=this.options,g=this.options.type||'list';return g==='record'?d(b,c,f,a.limitName,a.limitValue):g==='input'?e(b,c,f,a.limitName,a.limitValue):d(b,c,f,a.limitName,a.limitValue)},initEvents:function(){var a=this.options.type||'list';if(a==='record')return this.initEventsLine();if(a==='input')return this.initEventsInput();if(a==='list')return this.initEventsLine();this.initEventsLine()},initEventsLine:function(){var c=this.container.getElementsByClassName('leaflet-popup-line'),a=this,d=['click'];d.forEach(function(d){b(c,function(b){b.addEventListener(d,function(){var c=b.getAttribute('id');a.emit(d,{id:c,data:a._data,layer:a})})})})},initEventsInput:function(){},updateOptions:function(a){this.options=g.deepMerge(this.options,a),this.updateStyle()}});var i=f.dmap=f.dmap||{};i.Popup=a,i.popup=function(b){return a(b)},module.exports=a | ||
'use strict';function a(c,b){this.container=d.getContainer(c),b=arguments[arguments.length-1],this.options=d.deepMerge(a.options,b)}function b(c,d){var b;for(var a=0;a<c.length;a++){if(b=c[a],!b.style)continue;d(b)}}function c(a,b){return b=b||10,typeof a==='number'&&(a=a.toString()),a.length>b?a.substring(0,b):a}function g(a,b,d,e,f){return a=c(a,f),b=c(b,e),'<div class="leaflet-popup-line" id="'+d+'"> <div class="leaflet-popup-name">'+b+': </div> <a href="#'+a+'" class="leaflet-popup-value">'+a+'</a> </div>'}function i(a,b,d,e,f){return a=c(a,f),b=c(b,e),'<div class="leaflet-popup-line" id="'+d+'"> <div class="leaflet-popup-name">'+b+': </div> <input placeholder="'+a+'" class="leaflet-popup-value" value="'+a+'"></input> </div>'}var e=require('./../leaflet'),d=require('bcore/utils'),h=require('bcore/event');require('./popup.css'),a.options={type:'list',colorValue:'#00ffe1',colorLine:'rgba(0,0,0,0.2)',colorKey:'#938c8c',background:'rgba(20,20,20,0.4)',limitName:8,limitValue:15},a=h.extend(a,{bindTo:function(a){},updateStyle:function(){var a=this.options,c=this.container,d=c.parentNode,e=d.nextSibling.getElementsByClassName('leaflet-popup-tip')[0];d.style.background=e.style.background=a.background,b(c.getElementsByClassName('leaflet-popup-line'),function(b){b.style.color=a.colorKey}),b(c.getElementsByClassName('leaflet-popup-name'),function(b){b.style.color=a.colorKey}),b(c.getElementsByClassName('leaflet-popup-value'),function(b){b.style.color=a.colorValue})},data:function(a){this._data=a},render:function(a){a&&this.data(a),this.draw(),this.updateStyle(),this.initEvents()},getIncludeDefault:function(b){var b,a=[];for(var c in b)a.push({key:c});return a},draw:function(){var a=this._data,c=this,d=this.options.include||this.getIncludeDefault(a),b='';d.forEach(function(f){var d=f.key,g=f.name||d,e=a[d];e&&(b+=c.getHTML(e,g,d))}),this.container.style.width='auto',this.container.innerHTML=b},getHTML:function(b,c,d){var a=this.options,e=this.options.type||'list';return e==='record'?g(b,c,d,a.limitName,a.limitValue):e==='input'?i(b,c,d,a.limitName,a.limitValue):g(b,c,d,a.limitName,a.limitValue)},initEvents:function(){var a=this.options.type||'list';if(a==='record')return this.initEventsLine();if(a==='input')return this.initEventsInput();if(a==='list')return this.initEventsLine();this.initEventsLine()},initEventsLine:function(){var c=this.container.getElementsByClassName('leaflet-popup-line'),a=this,d=['click'];d.forEach(function(d){b(c,function(b){b.addEventListener(d,function(){var c=b.getAttribute('id');a.emit(d,{id:c,data:a._data,layer:a})})})})},initEventsInput:function(){},updateOptions:function(a){this.options=d.deepMerge(this.options,a),this.updateStyle()}});var f=e.dmap=e.dmap||{};f.Popup=a,f.popup=function(b){return a(b)},module.exports=a |
@@ -1,1 +0,1 @@ | ||
function a(c,b){this.addTo(c),b=this.options=d.deepMerge(a.options,b)}function b(c){var b=new RegExp('[?&]'+c+'=([^&]+)','i'),a=window.location.href.match(b);return a==null||a.length<1?'':a[1]}var c=require('jquery'),d=require('bcore/utils'),e=require('leaflet');a.options={},a.prototype={addTo:function(a){this._map=a,this.get(),this.initEventsMap()},initEventsMap:function(){this._map.on('load',this.get.bind(this)).on('moveend',this.set.bind(this))},get:function(){var a=b('lat'),c=b('lng'),d=b('zoom');if(a&&c&&d){var e=this._map;setTimeout(function(){e.setView({lat:parseFloat(a,10),lng:parseFloat(c,10)},d,{animate:!1})})}},set:function(){var a=this._map,c=a.getZoom(),b=a.getCenter(),d='#&lat='+b.lat+'&lng='+b.lng+'&zoom='+c;window.location.href=window.location.origin+window.location.pathname+window.location.search+d}},e.dmap=e.dmap||{},e.dmap.urlHash=function(b,c){return new a(b,c)},module.exports=a | ||
function a(c,b){this.addTo(c),b=this.options=d.deepMerge(a.options,b)}function c(c){var b=new RegExp('[?&]'+c+'=([^&]+)','i'),a=window.location.href.match(b);return a==null||a.length<1?'':a[1]}var e=require('jquery'),d=require('bcore/utils'),b=require('leaflet');a.options={},a.prototype={addTo:function(a){this._map=a,this.get(),this.initEventsMap()},initEventsMap:function(){this._map.on('load',this.get.bind(this)).on('moveend',this.set.bind(this))},get:function(){var a=c('lat'),b=c('lng'),d=c('zoom');if(a&&b&&d){var e=this._map;setTimeout(function(){e.setView({lat:parseFloat(a,10),lng:parseFloat(b,10)},d,{animate:!1})})}},set:function(){var a=this._map,c=a.getZoom(),b=a.getCenter(),d='#&lat='+b.lat+'&lng='+b.lng+'&zoom='+c;window.location.href=window.location.origin+window.location.pathname+window.location.search+d}},b.dmap=b.dmap||{},b.dmap.urlHash=function(b,c){return new a(b,c)},module.exports=a |
@@ -1,1 +0,1 @@ | ||
var a=require('bcore/event'),b=require('bcore/utils'),c=require('./../leaflet'),d=require('konva');module.exports={initEditor:function(){var a=this.editorLayer=new d.Layer({'z-index':1e7});this.stage.add(a)},enableEditor:function(){var a=this.shapes;for(var b in a)a[b].setAttrs({draggable:!0});this.initEventEditor()},disableEditor:function(){var a=this.shapes;for(var b in a)a[b].setAttrs({draggable:!1});this.offEventEditor()},handlerDrag:function(d){this.disableMapEvents(),this.isDraging=!0;var b,c=this.editorLayer,a=d.target;a&&(b=a.getLayer(),this.shapeActive=a,a.__startLayer=b,a.moveTo(c),b.draw(),c.draw(),a.startDrag())},handlerDrop:function(d){this.isDraging=!1,setTimeout(this.enableMapEvents.bind(this));var c=this.editorLayer,a=d.target;if(a.__startLayer||(a=this.shapeActive),a){var b=a.__startLayer;if(!b)return console.log('drag-error');a.moveTo(b),delete a.__startLayer,this.emit('shape-dragged',{shape:a}),c.draw(),b.draw(),this.shapeActive=null}},handlerDragging:function(a){if(!this.isDraging)return;this._map.closePopup()},initEventEditor:function(){this.stage.on('mousedown.handlerDrag',this.handlerDrag.bind(this)).on('mouseup.handlerDrop',this.handlerDrop.bind(this)).on('dragmove.handlerDragging',this.handlerDragging.bind(this))},offEventEditor:function(){this.stage.off('mousedown.handlerDrag',this.handlerDrag.bind(this)).off('mouseup.handlerDrop',this.handlerDrop.bind(this)).off('dragmove.handlerDragging',this.handlerDragging.bind(this))}} | ||
var b=require('bcore/event'),c=require('bcore/utils'),d=require('./../leaflet'),a=require('konva');module.exports={initEditor:function(){var b=this.editorLayer=new a.Layer({'z-index':1e7});this.stage.add(b)},enableEditor:function(){var a=this.shapes;for(var b in a)a[b].setAttrs({draggable:!0});this.initEventEditor()},disableEditor:function(){var a=this.shapes;for(var b in a)a[b].setAttrs({draggable:!1});this.offEventEditor()},handlerDrag:function(d){this.disableMapEvents(),this.isDraging=!0;var b,c=this.editorLayer,a=d.target;a&&(b=a.getLayer(),this.shapeActive=a,a.__startLayer=b,a.moveTo(c),b.draw(),c.draw(),a.startDrag())},handlerDrop:function(d){this.isDraging=!1,setTimeout(this.enableMapEvents.bind(this));var c=this.editorLayer,a=d.target;if(a.__startLayer||(a=this.shapeActive),a){var b=a.__startLayer;if(!b)return console.log('drag-error');a.moveTo(b),delete a.__startLayer,this.emit('shape-dragged',{shape:a}),c.draw(),b.draw(),this.shapeActive=null}},handlerDragging:function(a){if(!this.isDraging)return;this._map.closePopup()},initEventEditor:function(){this.stage.on('mousedown.handlerDrag',this.handlerDrag.bind(this)).on('mouseup.handlerDrop',this.handlerDrop.bind(this)).on('dragmove.handlerDragging',this.handlerDragging.bind(this))},offEventEditor:function(){this.stage.off('mousedown.handlerDrag',this.handlerDrag.bind(this)).off('mouseup.handlerDrop',this.handlerDrop.bind(this)).off('dragmove.handlerDragging',this.handlerDragging.bind(this))}} |
@@ -1,1 +0,1 @@ | ||
function a(b,d){b.content.style.zIndex=1e3,this.options=c.deepMerge(a.options,d),this.stage=b}var b=require('bcore/event'),c=require('bcore/utils'),d=require('./../leaflet');a.options={transition:'opacity 0.4s',blending:'lighter',lazyFresh:!0,ptNPerLayer:1e3},a=b.extend(a,{beginDraw:function(){this.versionID=Math.random()},endDraw:function(){var a=this.shapes;for(var b in a){var c=a[b];c.__versionID!==this.versionID&&(c.destroy(),delete a[b])}this.lazyFresh()},clean:function(){var a=this.shapes;for(var b in a){var c=a[b];c.destroy(),delete a[b]}},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])},addTo:function(a){this._map=a,this.resetVariables(),this.initEventsMap()},resetOffset:function(){this.pOffset=this.offset},disable:function(){this.isable=!1,this.stage.content.style.display='none'},enable:function(){this.isable=!0,this.stage.content.style.display='block'},resetVariables:function(){this.isable=!0,this.shapes={},this.layers=[],this.offset={x:0,y:0},this.pOffset={x:0,y:0}},add:function(a){this.stage.add(a)},addOrSetShape:function(b){var h=b.Constructor,i=b.index,e=b.attrs,f=b.data,c=b.id,a,d=this.shapes;if(d[c])return a=d[c],a.__options=b,a.__versionID=this.versionID,a.__data=f,d[c].setAttrs(e);var a=new h(e),g=this.getOrAddLayer(i);g.getCanvas().getContext('2d').globalCompositeOperation=this.options.blending,g.add(a),d[c]=a,a.__options=b,a.__versionID=this.versionID,a.__data=f},getOrAddLayer:function(b){if(!this.isable)return;b=Math.floor(b/this.options.ptNPerLayer);var c=this.layers,a=c[b];return a?a:(a=new Konva.Layer,c[b]=a,this.stage.add(a),a.canvas._canvas.style.zIndex=1e3-b,a)},fresh:function(){this.layers.forEach(function(a){a.draw()})},lazyFresh:function(){if(!this.isable)return;this.lazyFreshDraw(0)},lazyFreshDraw:function(b){var c=this;b=b||0;var a=this.layers[b];if(!a)return window.requestAnimationFrame(this.lazyFreshDone.bind(this));a.draw(),this.resetPos(a.canvas._canvas,{x:c.offset.x-c.pOffset.x,y:c.offset.y-c.pOffset.y}),a.canvas._canvas.style.opacity=1,a.canvas._canvas.style.transition=this.options.lazyFresh.transition,b++,this.lazyFreshId=window.requestAnimationFrame(function(){this.lazyFreshDraw(b)}.bind(this))},lazyFreshDone:function(){this.resetPos(this.stage.content),this.layers.forEach(function(a){d.DomUtil.setPosition(a.canvas._canvas,{x:0,y:0})})},resetPos:function(b,a){if(a=a||d.DomUtil.getPosition(this._map.getPanes().mapPane),!a)return;d.DomUtil.setPosition(b,{x:-a.x,y:-a.y})},stopLazyFresh:function(){if(!this.lazyFreshId)return;window.cancelAnimationFrame(this.lazyFreshId),this.lazyFreshId=null},hideLayers:function(){this.layers.forEach(function(a){a.canvas._canvas.style.opacity=0})},updateOptions:function(a){this.options=c.deepMerge(this.options,a),this.updateBlending()},updateBlending:function(b){var a=this.options;this.layers.forEach(function(b){b.getCanvas().getContext('2d').globalCompositeOperation=a.blending})},initEventsMap:function(){var a=this,b=this._map;b.on('zoomstart',function(){a.hideLayers(),a.stopLazyFresh()}).on('movestart',function(){a.stopLazyFresh()}).on('moveend',function(){a.pOffset=a.offset,a.offset=d.DomUtil.getPosition(b.getPanes().mapPane)}).on('resize',function(){console.log('resize')})},onKonva:function(a,b){return this.stage.on(a,b),this},enableMapEvents:function(){var a=this.stage.content;d.DomEvent.off(a,'click',d.DomEvent._fakeStop),d.DomEvent.off(a,'mousedown',d.DomEvent.stopPropagation),d.DomEvent.off(a,'mousemove',d.DomEvent.stopPropagation),this._map.dragging.enable()},disableMapEvents:function(){var a=this.stage.content;d.DomEvent.on(a,'click',d.DomEvent._fakeStop),d.DomEvent.on(a,'mousedown',d.DomEvent.stopPropagation),d.DomEvent.on(a,'mousemove',d.DomEvent.stopPropagation),this._map.dragging.disable()},destroy:function(){this.stage.clearCache(),this.stage.clear()}}),a.prototype=c.merge(a.prototype,require('./leaflet_layer_konva.editor')),module.exports=a | ||
function b(a,d){a.content.style.zIndex=1e3,this.options=c.deepMerge(b.options,d),this.stage=a}var d=require('bcore/event'),c=require('bcore/utils'),a=require('./../leaflet');b.options={transition:'opacity 0.4s',blending:'lighter',lazyFresh:!0,ptNPerLayer:1e3},b=d.extend(b,{beginDraw:function(){this.versionID=Math.random()},endDraw:function(){var a=this.shapes;for(var b in a){var c=a[b];c.__versionID!==this.versionID&&(c.destroy(),delete a[b])}this.lazyFresh()},clean:function(){var a=this.shapes;for(var b in a){var c=a[b];c.destroy(),delete a[b]}},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])},addTo:function(a){this._map=a,this.resetVariables(),this.initEventsMap()},resetOffset:function(){this.pOffset=this.offset},disable:function(){this.isable=!1,this.stage.content.style.display='none'},enable:function(){this.isable=!0,this.stage.content.style.display='block'},resetVariables:function(){this.isable=!0,this.shapes={},this.layers=[],this.offset={x:0,y:0},this.pOffset={x:0,y:0}},add:function(a){this.stage.add(a)},addOrSetShape:function(b){var h=b.Constructor,i=b.index,e=b.attrs,f=b.data,c=b.id,a,d=this.shapes;if(d[c])return a=d[c],a.__options=b,a.__versionID=this.versionID,a.__data=f,d[c].setAttrs(e);var a=new h(e),g=this.getOrAddLayer(i);g.getCanvas().getContext('2d').globalCompositeOperation=this.options.blending,g.add(a),d[c]=a,a.__options=b,a.__versionID=this.versionID,a.__data=f},getOrAddLayer:function(b){if(!this.isable)return;b=Math.floor(b/this.options.ptNPerLayer);var c=this.layers,a=c[b];return a?a:(a=new Konva.Layer,c[b]=a,this.stage.add(a),a.canvas._canvas.style.zIndex=1e3-b,a)},fresh:function(){this.layers.forEach(function(a){a.draw()})},lazyFresh:function(){if(!this.isable)return;this.lazyFreshDraw(0)},lazyFreshDraw:function(b){var c=this;b=b||0;var a=this.layers[b];if(!a)return window.requestAnimationFrame(this.lazyFreshDone.bind(this));a.draw(),this.resetPos(a.canvas._canvas,{x:c.offset.x-c.pOffset.x,y:c.offset.y-c.pOffset.y}),a.canvas._canvas.style.opacity=1,a.canvas._canvas.style.transition=this.options.lazyFresh.transition,b++,this.lazyFreshId=window.requestAnimationFrame(function(){this.lazyFreshDraw(b)}.bind(this))},lazyFreshDone:function(){this.resetPos(this.stage.content),this.layers.forEach(function(b){a.DomUtil.setPosition(b.canvas._canvas,{x:0,y:0})})},resetPos:function(c,b){if(b=b||a.DomUtil.getPosition(this._map.getPanes().mapPane),!b)return;a.DomUtil.setPosition(c,{x:-b.x,y:-b.y})},stopLazyFresh:function(){if(!this.lazyFreshId)return;window.cancelAnimationFrame(this.lazyFreshId),this.lazyFreshId=null},hideLayers:function(){this.layers.forEach(function(a){a.canvas._canvas.style.opacity=0})},updateOptions:function(a){this.options=c.deepMerge(this.options,a),this.updateBlending()},updateBlending:function(b){var a=this.options;this.layers.forEach(function(b){b.getCanvas().getContext('2d').globalCompositeOperation=a.blending})},initEventsMap:function(){var b=this,c=this._map;c.on('zoomstart',function(){b.hideLayers(),b.stopLazyFresh()}).on('movestart',function(){b.stopLazyFresh()}).on('moveend',function(){b.pOffset=b.offset,b.offset=a.DomUtil.getPosition(c.getPanes().mapPane)}).on('resize',function(){console.log('resize')})},onKonva:function(a,b){return this.stage.on(a,b),this},enableMapEvents:function(){var b=this.stage.content;a.DomEvent.off(b,'click',a.DomEvent._fakeStop),a.DomEvent.off(b,'mousedown',a.DomEvent.stopPropagation),a.DomEvent.off(b,'mousemove',a.DomEvent.stopPropagation),this._map.dragging.enable()},disableMapEvents:function(){var b=this.stage.content;a.DomEvent.on(b,'click',a.DomEvent._fakeStop),a.DomEvent.on(b,'mousedown',a.DomEvent.stopPropagation),a.DomEvent.on(b,'mousemove',a.DomEvent.stopPropagation),this._map.dragging.disable()},destroy:function(){this.stage.clearCache(),this.stage.clear()}}),b.prototype=c.merge(b.prototype,require('./leaflet_layer_konva.editor')),module.exports=b |
@@ -1,1 +0,1 @@ | ||
function a(b,a){a=a||{},this.opacityFrom=1,this.opacityTo=1,this.inout='In',this.pow=1,this.setOptions(b),this.onColorChange=a.onchange,this.showName=a.showName,this.init()}var b=require('jquery'),c=require('dat-gui'),d=require('./../../core/utils'),e=d.Easings;delete e.__filename;var f=d.format,g=d.blending,h=[];for(var i in e){var j=e[i];h.push(i)}a.prototype.setOptions=function(a){if(!a)return console.log('必须传入配置');this.options=a,this.colorFrom=a.from||'rgba(100,0,255,0.6)',this.colorTo=a.to||'rgba(250,120,55,0.8)',this.easing=a.easing||'Linear',this.space=a.space||'rgb'},a.prototype.getEasing=function(){return this.easing+'.'+this.inout+'.'+this.pow},a.prototype.init=function(){this.addGui()},a.prototype.getColorFunc=function(){var b=this.getEasing(),c=this.blend=g(this.colorFrom,this.colorTo,this.blendingMode,b),a=this.options;a.from=f.setOpacity(this.colorFrom,this.opacityFrom),a.to=f.setOpacity(this.colorTo,this.opacityTo),a.easing=b,a.space=this.blendingMode,this.onColorChange(),this.toJSON()},a.prototype.onColorChange=function(a,b){console.log(a(.5),'请重写onColorChange方法',b)},a.prototype.toJSON=function(){var a=JSON.stringify(this.options);return console.log('颜色模块的配置'+a)},a.prototype.addGui=function(){var a=this.getColorFunc.bind(this),d=new c.gui.GUI,b=d.addFolder(this.showName);b.addColor(this,'colorFrom').onChange(a),b.add(this,'opacityFrom',0,1).onChange(a),b.addColor(this,'colorTo').onChange(a),b.add(this,'opacityTo',0,1).onChange(a),b.add(this,'pow',0,10).onChange(a),b.add(this,'easing').options(h).onChange(a),b.add(this,'inout').options(['In','Out','InOut']).onChange(a),b.add(this,'space').options(['rgb','hsl']).onChange(a)},module.exports=a | ||
function a(b,a){a=a||{},this.opacityFrom=1,this.opacityTo=1,this.inout='In',this.pow=1,this.setOptions(b),this.onColorChange=a.onchange,this.showName=a.showName,this.init()}var i=require('jquery'),g=require('dat-gui'),b=require('./../../core/utils'),c=b.Easings;delete c.__filename;var d=b.format,h=b.blending,e=[];for(var f in c){var j=c[f];e.push(f)}a.prototype.setOptions=function(a){if(!a)return console.log('必须传入配置');this.options=a,this.colorFrom=a.from||'rgba(100,0,255,0.6)',this.colorTo=a.to||'rgba(250,120,55,0.8)',this.easing=a.easing||'Linear',this.space=a.space||'rgb'},a.prototype.getEasing=function(){return this.easing+'.'+this.inout+'.'+this.pow},a.prototype.init=function(){this.addGui()},a.prototype.getColorFunc=function(){var b=this.getEasing(),c=this.blend=h(this.colorFrom,this.colorTo,this.blendingMode,b),a=this.options;a.from=d.setOpacity(this.colorFrom,this.opacityFrom),a.to=d.setOpacity(this.colorTo,this.opacityTo),a.easing=b,a.space=this.blendingMode,this.onColorChange(),this.toJSON()},a.prototype.onColorChange=function(a,b){console.log(a(.5),'请重写onColorChange方法',b)},a.prototype.toJSON=function(){var a=JSON.stringify(this.options);return console.log('颜色模块的配置'+a)},a.prototype.addGui=function(){var a=this.getColorFunc.bind(this),c=new g.gui.GUI,b=c.addFolder(this.showName);b.addColor(this,'colorFrom').onChange(a),b.add(this,'opacityFrom',0,1).onChange(a),b.addColor(this,'colorTo').onChange(a),b.add(this,'opacityTo',0,1).onChange(a),b.add(this,'pow',0,10).onChange(a),b.add(this,'easing').options(e).onChange(a),b.add(this,'inout').options(['In','Out','InOut']).onChange(a),b.add(this,'space').options(['rgb','hsl']).onChange(a)},module.exports=a |
@@ -1,1 +0,1 @@ | ||
var a=require('jquery'),b=require('leaflet'),c=b.model=require('@ali/map-data'),d=require('./core/utils');require('leaflet/dist/leaflet.css'),require('./index.css'),b.Utils=d.merge(b.Util,d);var e=b.dmap=b.dmap||{};require('./layer/areas'),require('./render/canvas'),require('./layer/tilelayer'),require('./layer/scatter_canvas'),require('./layer/scatter_markers'),require('./layer/scatter_marker'),require('./layer/iconFont'),require('./layer/flyingLineGradient'),require('./layer/flyingLineDash'),require('./layer/markercluster'),require('./layer/heatmap_grid'),require('./layer/trails_canvas'),require('./map/map');var f=require('./layer/geojson_canvas');module.exports=b | ||
var c=require('jquery'),a=require('leaflet'),d=a.model=require('@ali/map-data'),b=require('./core/utils');require('leaflet/dist/leaflet.css'),require('./index.css'),a.Utils=b.merge(a.Util,b);var e=a.dmap=a.dmap||{};require('./layer/areas'),require('./render/canvas'),require('./layer/tilelayer'),require('./layer/scatter_canvas'),require('./layer/scatter_markers'),require('./layer/scatter_marker'),require('./layer/iconFont'),require('./layer/flyingLineGradient'),require('./layer/flyingLineDash'),require('./layer/markercluster'),require('./layer/heatmap_grid'),require('./layer/trails_canvas'),require('./map/map');var f=require('./layer/geojson_canvas');module.exports=a |
@@ -1,1 +0,1 @@ | ||
function a(a,b){this.initialize(a,b)}var b=require('jquery'),c=require('bcore/event'),d=require('bcore/utils');require('./map_search.css'),a=c.extend(a,{options:{liMaxLength:5,id:function(a){return a.adcode},inputText:function(a){return a.name},liHtml:function(a){var b=a.adcode,c=a.parent?a.parent+' | ':'',d=c+a.name+'('+a.adcode+')';return'<a class="result"> <div class="content"><div id='+b+' class="li-title" > '+d+'</div></div> </a>'},defaultData:[],filter:function(a,b){return b.adcode.toString().indexOf(a)!==-1?!0:b.name.toString().indexOf(a)!==-1?!0:!1},input:{placeholder:'输入车牌号',style:{position:'absolute',left:'190px',top:'10%'}},result:{style:{background:'#fff',color:'#999'}}},setInputText:function(a){this.inputNode[0].value=a},initialize:function(a,c){this.container=b(a),this.options=d.deepMerge(this.options,c),this.searchMap={},this.initDom(),this.initEvents()},data:function(a){this._data=a;var b={},c=this.options.id;Array.isArray(a)&&(a.forEach(function(a){b[c(a)]=a}),this._data=b)},initDom:function(){var a=this.options.input,c=a.style,d=a.placeholder;this.searchNode=b(' <div class="ui search"> <div class="ui icon input"> <input class="prompt" type="text" placeholder="'+d+'"> </div> <div class="results"></div> </div> ').css(c).appendTo(this.container),this.searchNode.find('.results').css(this.options.result.style),this.searchNode.find('.prompt').css({color:c.color}),this.inputNode=this.searchNode.find('input'),this.resultsNode=this.searchNode.find('.results')},initEvents:function(){var a=this,c=this.inputNode,d=this.searchNode;c.on('mousedown touchstart',function(){var b=c[0].value;if(b===null||b===undefined||b==='')return a.emit('un-select'),a.cleanLis(),a.renderLis();a.emit('input-mousedown',{text:b})}).on('input',function(d){var b=c[0].value;b=b.toLowerCase(),a.renderLis(b)}).blur(function(a){d.delay(1e3).find('.results').addClass('results-hide')}).focus(function(a){d.find('.results').removeClass('results-hide')}),this.resultsNode.delegate('.result','touchstart mousedown',function(i){var f=b(this).find('.li-title'),d=f.attr('id'),h=f.text(),e=a._data[d],g=a.options.inputText(e);c[0].value=g,a.emit('select',{id:d,data:e}),a.emit('search-select',{d:e,id:d})})},renderLis:function(i){var b=this.options,e=b.liHtml,a=this.filterData(i);this.emit('pre-select',a),a||(this.cleanLis(),a=b.defaultData);var c='',f=b.liMaxLength,d=0;for(var g in a){var h=a[g];if(d++,d>f)break;c+=e(h)}this.resultsNode.html(c)},filterData:function(a){if(a===null||a===undefined)return!1;var b=this._data,c=[],e=this.options.filter;for(var f in b){var d=b[f];e(a,d)&&c.push(d)}return c},cleanLis:function(){this.resultsNode.empty()}}),module.exports=a | ||
function b(a,b){this.initialize(a,b)}var a=require('jquery'),c=require('bcore/event'),d=require('bcore/utils');require('./map_search.css'),b=c.extend(b,{options:{liMaxLength:5,id:function(a){return a.adcode},inputText:function(a){return a.name},liHtml:function(a){var b=a.adcode,c=a.parent?a.parent+' | ':'',d=c+a.name+'('+a.adcode+')';return'<a class="result"> <div class="content"><div id='+b+' class="li-title" > '+d+'</div></div> </a>'},defaultData:[],filter:function(a,b){return b.adcode.toString().indexOf(a)!==-1?!0:b.name.toString().indexOf(a)!==-1?!0:!1},input:{placeholder:'输入车牌号',style:{position:'absolute',left:'190px',top:'10%'}},result:{style:{background:'#fff',color:'#999'}}},setInputText:function(a){this.inputNode[0].value=a},initialize:function(b,c){this.container=a(b),this.options=d.deepMerge(this.options,c),this.searchMap={},this.initDom(),this.initEvents()},data:function(a){this._data=a;var b={},c=this.options.id;Array.isArray(a)&&(a.forEach(function(a){b[c(a)]=a}),this._data=b)},initDom:function(){var b=this.options.input,c=b.style,d=b.placeholder;this.searchNode=a(' <div class="ui search"> <div class="ui icon input"> <input class="prompt" type="text" placeholder="'+d+'"> </div> <div class="results"></div> </div> ').css(c).appendTo(this.container),this.searchNode.find('.results').css(this.options.result.style),this.searchNode.find('.prompt').css({color:c.color}),this.inputNode=this.searchNode.find('input'),this.resultsNode=this.searchNode.find('.results')},initEvents:function(){var b=this,c=this.inputNode,d=this.searchNode;c.on('mousedown touchstart',function(){var a=c[0].value;if(a===null||a===undefined||a==='')return b.emit('un-select'),b.cleanLis(),b.renderLis();b.emit('input-mousedown',{text:a})}).on('input',function(d){var a=c[0].value;a=a.toLowerCase(),b.renderLis(a)}).blur(function(a){d.delay(1e3).find('.results').addClass('results-hide')}).focus(function(a){d.find('.results').removeClass('results-hide')}),this.resultsNode.delegate('.result','touchstart mousedown',function(i){var f=a(this).find('.li-title'),d=f.attr('id'),h=f.text(),e=b._data[d],g=b.options.inputText(e);c[0].value=g,b.emit('select',{id:d,data:e}),b.emit('search-select',{d:e,id:d})})},renderLis:function(i){var b=this.options,e=b.liHtml,a=this.filterData(i);this.emit('pre-select',a),a||(this.cleanLis(),a=b.defaultData);var c='',f=b.liMaxLength,d=0;for(var g in a){var h=a[g];if(d++,d>f)break;c+=e(h)}this.resultsNode.html(c)},filterData:function(a){if(a===null||a===undefined)return!1;var b=this._data,c=[],e=this.options.filter;for(var f in b){var d=b[f];e(a,d)&&c.push(d)}return c},cleanLis:function(){this.resultsNode.empty()}}),module.exports=b |
@@ -1,1 +0,1 @@ | ||
function a(a){a=this.grid=a||{},this.type=a.type||'hex',this.rx=a.rx||30,this.ry=a.ry||20,this.init()}var b=require('jquery'),c=require('dat-gui'),d=require('./../../core/utils'),e=d.Easings;delete e.__filename;var f=d.format,g=d.blending,h=[];for(var i in e){var j=e[i];h.push(i)}a.prototype.init=function(){this.addGui()},a.prototype.onShapeChange=function(){console.log('onChange')},a.prototype.getEasing=function(){return this.easing+'.'+this.inout+'.'+this.pow},a.prototype.addGui=function(){var e=this,a=function(){e.onShapeChange()},b=new c.gui.GUI,d=this.grid;b.add(d,'ry',5,100).onChange(a),b.add(d,'rx',5,100).onChange(a),b.add(d,'type').options(['rect','hex']).onChange(a)},module.exports=a | ||
function a(a){a=this.grid=a||{},this.type=a.type||'hex',this.rx=a.rx||30,this.ry=a.ry||20,this.init()}var g=require('jquery'),e=require('dat-gui'),b=require('./../../core/utils'),c=b.Easings;delete c.__filename;var h=b.format,i=b.blending,f=[];for(var d in c){var j=c[d];f.push(d)}a.prototype.init=function(){this.addGui()},a.prototype.onShapeChange=function(){console.log('onChange')},a.prototype.getEasing=function(){return this.easing+'.'+this.inout+'.'+this.pow},a.prototype.addGui=function(){var d=this,a=function(){d.onShapeChange()},b=new e.gui.GUI,c=this.grid;b.add(c,'ry',5,100).onChange(a),b.add(c,'rx',5,100).onChange(a),b.add(c,'type').options(['rect','hex']).onChange(a)},module.exports=a |
@@ -1,1 +0,1 @@ | ||
function b(c,a){a=this.options=d.deepMerge(b.options,a),this.initialize(c,a)}var a=require('jquery'),c=require('leaflet'),d=require('./../core/utils'),e=require('bcore/event'),a=require('keyanim');require('./ui_animate.css'),require('./tile_selector.css');var f=require('dat-gui'),g=d.switchValue;b.options={style:{left:'5%',top:'5%'}},b=e.extend(b,{initialize:function(a,b){this.container=a,this.initDom()},initDom:function(){var c=this.options,d=this.container,b=this.button=a('<div class="tile-selector">瓦片层 <div class="tile-selector-sub-wrapper"> <div class="tile-selector-sub-panel tile-selector-hide"> <div class=main></div> <div class=detail></div> </div> <div> <div> ').css(c.style).appendTo(d);this.subPanelNode=b.find('.tile-selector-sub-panel'),this.detailNode=b.find('.detail'),this.initEvents()},initEvents:function(){this.button.on('touchstart mousedown',this.switch.bind(this)),this.subPanelNode.on('touchstart mousedown',function(a){a.stopPropagation()})},bindTo:function(a){this.tilelayer=a,this._data=a.tData,this._map=a._map,this.initEventMap()},render:function(d){d&&this.bindTo(d);var e=this.tilelayer.tileName,h=this.subPanelNode,b=this._data,c,f,g;for(var a in b){if(c=b[a],c.disable)continue;f=a===e,g=this.renderGrid(c,a,f),this.initEventsGrid(g)}this.initInitFilter()},renderGrid:function(d,e,f){var c=this.subPanelNode.find('.main'),b=a('<div class="grid" id="'+e+'">'+d.options.name+'</div>').appendTo(c);return f&&this.selectGrid(b),this.initEventGrid(b),b},initEventMap:function(){this._map.on('click',this.hide.bind(this))},initEventGrid:function(d){var b=this.tilelayer,c=this._data;d.on('touchstart mousedown',function(f){var d=a(this).attr('id'),e=c[d];return e?(console.log(d),b.update(d)):void 0})},initEventsGrid:function(a){a.on('click',function(){this.selectGrid(a)}.bind(this))},selectGrid:function(a){this.curGird&&this.curGird.removeClass('grid-selected'),this.curGird=a.addClass('grid-selected')},switch:function(){if(this.isShow)return this.hide();this.show()},hide:function(){if(!this.isShow)return;this.subPanelNode.keyAnim('toolsOutLeft',{time:.3}),this.isShow=!1},show:function(){if(this.isShow)return;this.subPanelNode.css('display','block').keyAnim('toolsInLeft',{time:.3}),this.isShow=!0},initInitFilter:function(){var j=this.tilelayer,b=j._filter;if(!b)return;var h=this.detailNode,l=b.options,e=new f.gui.GUI({width:h.width(),autoPlace:!1});h.append(a(e.domElement));var c=e.addFolder('滤镜');c.open();var g=e.addFolder('其他');g.open();var d=b.updateStyle.bind(b),i={saturate:c.add(b.options,'saturate',0,200).name('饱和度(%)').onChange(d),grayscale:c.add(b.options,'grayscale',0,100).name('灰度(%)').onChange(d),brightness:c.add(b.options,'brightness',0,200).name('亮度(%)').onChange(d),contrast:c.add(b.options,'contrast',0,200).name('对比(%)').onChange(d),opacity:c.add(b.options,'opacity',0,1).name('透明(0-1)').onChange(d),hueRotate:c.add(b.options,'hueRotate',0,360).name('色相(deg)').onChange(d),blur:c.add(b.options,'blur',0,20).name('模糊(px)').onChange(d),invert:c.add(b.options,'invert',0,100).name('反向(%)').onChange(d),sepia:c.add(b.options,'sepia',0,100).name('加色(%)').onChange(d),anim:g.add(b.options,'anim',0,3).name('缓动(秒)').onChange(d)},k={clear:!1};g.add(k,'clear').name('清除样式').onChange(function(c){c&&b.cleanStyle();for(var a in i)i[a].updateDisplay()})}}),module.exports=b | ||
function b(d,a){a=this.options=c.deepMerge(b.options,a),this.initialize(d,a)}var a=require('jquery'),f=require('leaflet'),c=require('./../core/utils'),d=require('bcore/event'),a=require('keyanim');require('./ui_animate.css'),require('./tile_selector.css');var e=require('dat-gui'),g=c.switchValue;b.options={style:{left:'5%',top:'5%'}},b=d.extend(b,{initialize:function(a,b){this.container=a,this.initDom()},initDom:function(){var c=this.options,d=this.container,b=this.button=a('<div class="tile-selector">瓦片层 <div class="tile-selector-sub-wrapper"> <div class="tile-selector-sub-panel tile-selector-hide"> <div class=main></div> <div class=detail></div> </div> <div> <div> ').css(c.style).appendTo(d);this.subPanelNode=b.find('.tile-selector-sub-panel'),this.detailNode=b.find('.detail'),this.initEvents()},initEvents:function(){this.button.on('touchstart mousedown',this.switch.bind(this)),this.subPanelNode.on('touchstart mousedown',function(a){a.stopPropagation()})},bindTo:function(a){this.tilelayer=a,this._data=a.tData,this._map=a._map,this.initEventMap()},render:function(d){d&&this.bindTo(d);var e=this.tilelayer.tileName,h=this.subPanelNode,b=this._data,c,f,g;for(var a in b){if(c=b[a],c.disable)continue;f=a===e,g=this.renderGrid(c,a,f),this.initEventsGrid(g)}this.initInitFilter()},renderGrid:function(d,e,f){var c=this.subPanelNode.find('.main'),b=a('<div class="grid" id="'+e+'">'+d.options.name+'</div>').appendTo(c);return f&&this.selectGrid(b),this.initEventGrid(b),b},initEventMap:function(){this._map.on('click',this.hide.bind(this))},initEventGrid:function(d){var b=this.tilelayer,c=this._data;d.on('touchstart mousedown',function(f){var d=a(this).attr('id'),e=c[d];return e?(console.log(d),b.update(d)):void 0})},initEventsGrid:function(a){a.on('click',function(){this.selectGrid(a)}.bind(this))},selectGrid:function(a){this.curGird&&this.curGird.removeClass('grid-selected'),this.curGird=a.addClass('grid-selected')},switch:function(){if(this.isShow)return this.hide();this.show()},hide:function(){if(!this.isShow)return;this.subPanelNode.keyAnim('toolsOutLeft',{time:.3}),this.isShow=!1},show:function(){if(this.isShow)return;this.subPanelNode.css('display','block').keyAnim('toolsInLeft',{time:.3}),this.isShow=!0},initInitFilter:function(){var j=this.tilelayer,b=j._filter;if(!b)return;var h=this.detailNode,l=b.options,f=new e.gui.GUI({width:h.width(),autoPlace:!1});h.append(a(f.domElement));var c=f.addFolder('滤镜');c.open();var g=f.addFolder('其他');g.open();var d=b.updateStyle.bind(b),i={saturate:c.add(b.options,'saturate',0,200).name('饱和度(%)').onChange(d),grayscale:c.add(b.options,'grayscale',0,100).name('灰度(%)').onChange(d),brightness:c.add(b.options,'brightness',0,200).name('亮度(%)').onChange(d),contrast:c.add(b.options,'contrast',0,200).name('对比(%)').onChange(d),opacity:c.add(b.options,'opacity',0,1).name('透明(0-1)').onChange(d),hueRotate:c.add(b.options,'hueRotate',0,360).name('色相(deg)').onChange(d),blur:c.add(b.options,'blur',0,20).name('模糊(px)').onChange(d),invert:c.add(b.options,'invert',0,100).name('反向(%)').onChange(d),sepia:c.add(b.options,'sepia',0,100).name('加色(%)').onChange(d),anim:g.add(b.options,'anim',0,3).name('缓动(秒)').onChange(d)},k={clear:!1};g.add(k,'clear').name('清除样式').onChange(function(c){c&&b.cleanStyle();for(var a in i)i[a].updateDisplay()})}}),module.exports=b |
@@ -1,1 +0,1 @@ | ||
function a(c,b){b=this.options=d.deepMerge(a.options,b),this.initialize(c,b),this.selected={}}var b=require('jquery'),c=require('leaflet'),d=require('./../core/utils'),e=require('bcore/event');require('keyanim'),require('./visual_selector.css'),a.options={style:{left:'30%',top:'10%'},grid:{height:'50px',lineHeight:'50px'},mode:'multiple',selects:[{name:'测试2',filter:function(a){return!0}},{name:'测试1',filter:function(a){return!0}}]},a=e.extend(a,{initialize:function(a,b){a&&(this.container=a,this.initDom())},linkTo:function(a){if(!a)return;this.visual=a;var b=a.options,c=this.groups=b.groups},addTo:function(a){this._map=a,this.container=b(a.getUIContainer()),this.initDom(),this.initEvents()},initDom:function(){var a=this.options,c=this.container,d=this.mainNode=b('<div class="visual-selector"><div>').css(a.style).appendTo(c)},render:function(){var e=this.options,a=this.groups,c;for(var b in a){c=a[b];var d=this.renderGrid(c,b);this.initEventsGrid(d)}},renderGrid:function(d,e){var a=this.options.grid||{},c=b('<div class="grid" id="'+e+'">'+d.name+'</div>').css(a).appendTo(this.mainNode);return c},initEventsGrid:function(b){var a=this,c=this.options;b.on('click',function(){var e=b.attr('id');if(c.mode==='single'){a.curGird&&a.curGird.removeClass('grid-selected'),a.curGird=b.addClass('grid-selected');var d=a.selected={};d[e]=!0}if(c.mode==='multiple'){var d=a.selected;b.hasClass('grid-selected')?(delete d[e],b.removeClass('grid-selected')):(d[e]=1,b.addClass('grid-selected'))}a.emit('select-change',e)})},initDomGrid:function(){},initEvents:function(){this.on('select-change',function(h){var f=this.options,c=f.mode,b=this.visual,d=this.groups,g=this.selected,a;if(c==='single'){var e=d[h];if(!e)return;a=e.filter,a&&b.updateFilter&&b.updateFilter(a)}else c==='multiple'&&(a=function(c){for(var a in g){var b=d[a];if(b.filter(c))return!0}return!1},b.updateFilter&&b.updateFilter(a));this.emit('filter-change',a)})},data:function(){}}),module.exports=a | ||
function a(d,b){b=this.options=c.deepMerge(a.options,b),this.initialize(d,b),this.selected={}}var b=require('jquery'),e=require('leaflet'),c=require('./../core/utils'),d=require('bcore/event');require('keyanim'),require('./visual_selector.css'),a.options={style:{left:'30%',top:'10%'},grid:{height:'50px',lineHeight:'50px'},mode:'multiple',selects:[{name:'测试2',filter:function(a){return!0}},{name:'测试1',filter:function(a){return!0}}]},a=d.extend(a,{initialize:function(a,b){a&&(this.container=a,this.initDom())},linkTo:function(a){if(!a)return;this.visual=a;var b=a.options,c=this.groups=b.groups},addTo:function(a){this._map=a,this.container=b(a.getUIContainer()),this.initDom(),this.initEvents()},initDom:function(){var a=this.options,c=this.container,d=this.mainNode=b('<div class="visual-selector"><div>').css(a.style).appendTo(c)},render:function(){var e=this.options,a=this.groups,c;for(var b in a){c=a[b];var d=this.renderGrid(c,b);this.initEventsGrid(d)}},renderGrid:function(d,e){var a=this.options.grid||{},c=b('<div class="grid" id="'+e+'">'+d.name+'</div>').css(a).appendTo(this.mainNode);return c},initEventsGrid:function(b){var a=this,c=this.options;b.on('click',function(){var e=b.attr('id');if(c.mode==='single'){a.curGird&&a.curGird.removeClass('grid-selected'),a.curGird=b.addClass('grid-selected');var d=a.selected={};d[e]=!0}if(c.mode==='multiple'){var d=a.selected;b.hasClass('grid-selected')?(delete d[e],b.removeClass('grid-selected')):(d[e]=1,b.addClass('grid-selected'))}a.emit('select-change',e)})},initDomGrid:function(){},initEvents:function(){this.on('select-change',function(h){var f=this.options,c=f.mode,b=this.visual,d=this.groups,g=this.selected,a;if(c==='single'){var e=d[h];if(!e)return;a=e.filter,a&&b.updateFilter&&b.updateFilter(a)}else c==='multiple'&&(a=function(c){for(var a in g){var b=d[a];if(b.filter(c))return!0}return!1},b.updateFilter&&b.updateFilter(a));this.emit('filter-change',a)})},data:function(){}}),module.exports=a |
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
405236