Comparing version 0.1.30 to 0.1.31
@@ -1,1 +0,1 @@ | ||
'use strict';function a(c){this.datas=[],this.loopIndex=0,this.dataIndex=0,this.options=b.deepMerge(a.options,c)}var b=require('bcore/utils'),c=require('bcore/event');a.options={maxLength:2e3,updateInterval:1,updateStep:2},a=c.extend(a,{bindTo:function(a){this.visualizer=a,this.tryStart()},clean:function(){this.loopIndex=0,this.dataIndex=0,this.datas=[]},tryStart:function(){if(this.loopId||!this.visualizer)return;this.loop()},data:function(a){var b=this.datas,c;for(var d in a)c=a[d],b.push(c);this.resume()},stop:function(){this.isStop=!0},resume:function(){this.isStop=!1},check:function(){var b=this.options.maxLength,c,a=this.datas;if(a.length<b)return;c=a.length-b,a.splice(0,c);var d=a.length;this.dataIndex=(this.dataIndex-c+b)%d},loop:function(){var a=this.options.updateInterval;this.loopIndex%a===0&&this.update(),this.loopIndex++,this.loopId=window.requestAnimationFrame(this.loop.bind(this))},setUpdateSpeed:function(a){this.options.updateStep=a},update:function(){if(this.isStop)return;var d=this.options.updateStep,a=this.visualizer;if(!a)return;var f=this.options.maxLength,b=this.datas;if(!b.length)return;for(var c=0;c<d;c++){var e=b[this.dataIndex];a.data([e]),this.dataIndex=(this.dataIndex+1)%this.datas.length}this.check()},render:function(){}}),module.exports=a | ||
'use strict';function a(c){this.datas=[],this.loopIndex=0,this.dataIndex=0,this.options=b.deepMerge(a.options,c)}var b=require('bcore/utils'),c=require('bcore/event');a.options={maxLength:2e3,updateInterval:1,updateStep:2},a=c.extend(a,{bindTo:function(a){this.visualizer=a,this.tryStart()},clean:function(){this.loopIndex=0,this.dataIndex=0,this.datas=[]},tryStart:function(){if(this.loopId||!this.visualizer)return;this.loop()},data:function(a){var b=this.datas,c;for(var d in a)c=a[d],b.push(c);this.resume()},stop:function(){this.isStop=!0},resume:function(){this.isStop=!1},check:function(){var b=this.options.maxLength,c,a=this.datas;if(a.length<b)return;c=a.length-b,a.splice(0,c);var d=a.length;this.dataIndex=(this.dataIndex-c+b)%d},loop:function(){var a=this.options.updateInterval;this.loopIndex%a===0&&this.update(),this.loopIndex++,this.loopId=window.requestAnimationFrame(this.loop.bind(this))},setUpdateSpeed:function(a){this.options.updateStep=a},update:function(){if(this.isStop)return;var d=this.options.updateStep,a=this.visualizer;if(!a)return;var f=this.options.maxLength,b=this.datas;if(!b.length)return;if(this.delta=this.delta||0,this.delta+=d,this.delta>=1){console.log(this.delta);for(var c=0;c<this.delta;c++){var e=b[this.dataIndex];a.data([e]),this.dataIndex=(this.dataIndex+1)%this.datas.length,this.delta-=1}}this.check()},render:function(){}}),module.exports=a |
@@ -1,1 +0,1 @@ | ||
'use strict';function b(c){c.originalEvent&&(c=c.originalEvent);var d=c.target,e=d.offsetWidth,f=d.offsetHeight,g=d.offsetLeft,h=d.offsetTop,a,b;if(c.type.indexOf('mouse')!==-1)return a=c.x||c.pageX,b=c.y||c.pageY,[a-g,b-h,'mouse'];var i=window.event.touches[0];return a=i.pageX-g,b=i.pageY-h,a=a<e?a:e,a=a>0?a:1,b=b<f?b:f,b=b>0?b:1,[a,b,'touch']}function o(f,g,b,c,d,e){return c=c||0,d=d||0,e=e||0,b=b||6378137,new a.Vector3(f/180*z*b+c,d,-b*A(y((90+g)*z/360))+e)}function c(l,m,b,e,f,d){var g=1;e=e||0,f=f||0,d=d||0,b=b||1;var h=-l*z/180,c=m*z/180,k=b*q(h)*q(c)*g+e,i=b*r(h)*q(c)*g+d,j=b*r(c)+f;return new a.Vector3(k,j,i)}function d(j,l,k,b,c,a,d){c=c||0,a=a||0,d=d||0,b=b||1;var i=j-c,g=l-a,h=k-d,f=t(g/b),e=s(h,i);return{lat:f,lng:e}}function e(c,a,d){var e=a.x-c.x,f=a.y-c.y,g=a.z-c.z,i=d.x-a.x,h=d.y-a.y,b=d.z-a.z;return.5*u(w(f*b-g*h,2)+w(e*b-g*i,2)+w(e*h-f*b,2))}function f(f,h,i,j,k){var c=f.x-i,d=f.y-j,e=f.z-k,g=u(c*c+d*d+e*e),b=g<h?h/g:1;return new a.Vector3(i+c*b,j+d*b,k+e*b)}function g(d,z){var A=z.x0,q=z.y0,y=z.z0,t=z.radius,c={},H=d.faces,l=[],b=d.vertices;for(var r=H.length-1;r>=0;r--){var h=H[r],i=h.a,e=h.b,g=h.c,m=h.normal,o=h.color,n=h.materialIndex,G=b[i],F=b[e],E=b[g],p,j,k,C=x(i,e)+'_'+B(i,e);if(!c[C]){var w=new a.Vector3().addVectors(G,F).divideScalar(2);w=f(w,t,A,q,y),p=c[C]=b.length,b.push(w)}else p=c[C];var v=x(e,g)+'_'+B(e,g);if(!c[v]){var u=new a.Vector3().addVectors(F,E).divideScalar(2);u=f(u,A,q,y,t);var j=c[v]=b.length;b.push(u)}else j=c[v];var s=x(i,g)+'_'+B(i,g);if(!c[s]){var D=new a.Vector3().addVectors(E,G).divideScalar(2);D=f(D,A,q,y,t);var k=c[s]=b.length;b.push(D)}else k=c[s];var J=new a.Face3(i,p,k,m,o,n),K=new a.Face3(p,e,j,m,o,n),L=new a.Face3(k,j,g,m,o,n),I=new a.Face3(p,j,k,m,o,n);l.push(J),l.push(K),l.push(L),l.push(I)}return d.vertices=b,d.faces=l,d.computeFaceNormals(),d.computeVertexNormals(),console.log(d),d}function h(f,l){var b=[];for(var d in f){var e=l[d],h=e.bound;if(h)b.push(f[d]);else{var i=e.adj,c=new a.Vector3(0,0,0),g=0;for(var k in i){var j=f[k];c.add(j),g++}c.divideScalar(g),b.push(c)}}return b}function i(g){var p=g.faces,k=g.vertices,a={},c={},e;for(var j=0;j<p.length;j++){var n=p[j],b=n.a,d=n.b,f=n.c;a[b]||(a[b]={adj:{}}),e=a[b].adj,e[d]=1,e[f]=1,a[d]||(a[d]={adj:{}}),e=a[b].adj,e[b]=1,e[f]=1,a[f]||(a[f]={adj:{}}),e=a[b].adj,e[b]=1,e[d]=1;var l=x(b,d)+'_'+B(b,d),m=x(d,f)+'_'+B(d,f),i=x(f,b)+'_'+B(f,b);c[l]?delete c[l]:c[l]=1,c[m]?delete c[m]:c[m]=1,c[i]?delete c[i]:c[i]=1}for(var r in c){var q=r.split('_'),s=q[0],t=q[1];a[s].bound=1,a[t].bound=1}for(var o=0;o<15;o++)k=h(k,a);return g.vertices=k,g.computeFaceNormals(),g}function j(k,m,l){var e=new a.Geometry,g=e.vertices;for(var b=l-1;b>=0;b--){var d=k+r(1e3*b)*m,f=z*v(),c=z*2*v(),i=d*r(f)*q(c),h=d*r(c),j=d*q(f)*q(c);g.push(new a.Vector3(i,h,j))}return e}function k(){try{var a=document.createElement('canvas'),b=a.getContext('webgl')||a.getContext('experimental-webgl');if(!b)throw'您的浏览器不支持webgl'}catch(a){alert('您的浏览器不支持webgl')}}function l(a){return typeof a==='function'?a:a==='sphere'?Sphere.project:void 0}function m(a){return a===null||a===undefined}function n(d,a){a=m(a)?.9:a;var e=d.getContext('2d'),f=e.getImageData(0,0,d.width,d.height),b=f.data,h=b.length,g;for(var c=0;c<h/4;c++)g=c*4+3,b[g]=b[g]*a;e.putImageData(f,0,0)}var a=require('three'),p=require('aliyun-common-utils'),q=Math.cos,r=Math.sin,s=Math.atan2,t=Math.asin,u=Math.sqrt,v=Math.random,w=Math.pow,x=Math.min,y=Math.tan,z=Math.PI,A=Math.log,B=Math.max;k(),module.exports=p.extend(p,{genSphereParticles:j,getAreaTriangle3d:e,subdivideOnSphere:g,laplacian:i,getLatlngSphere:d,mercator:o,sphere:c,getPt:b,detect:k,darken:n}) | ||
'use strict';function b(c){c.originalEvent&&(c=c.originalEvent);var d=c.target,e=d.offsetWidth,f=d.offsetHeight,g=d.offsetLeft,h=d.offsetTop,a,b;if(c.type.indexOf('mouse')!==-1)return a=c.x||c.pageX,b=c.y||c.pageY,[a-g,b-h,'mouse'];var i=window.event.touches[0];return a=i.pageX-g,b=i.pageY-h,a=a<e?a:e,a=a>0?a:1,b=b<f?b:f,b=b>0?b:1,[a,b,'touch']}function o(e,f,a,b,c,d){return b=b||0,c=c||0,d=d||0,a=a||6378137,new p.Vector3(e/180*A*a+b,c,-a*B(z((90+f)*A/360))+d)}function c(k,l,a,d,e,c){var f=1;d=d||0,e=e||0,c=c||0,a=a||1;var g=-k*A/180,b=l*A/180,j=a*r(g)*r(b)*f+d,h=a*s(g)*r(b)*f+c,i=a*s(b)+e;return new p.Vector3(j,i,h)}function d(j,l,k,b,c,a,d){c=c||0,a=a||0,d=d||0,b=b||1;var i=j-c,g=l-a,h=k-d,f=u(g/b),e=t(h,i);return{lat:f,lng:e}}function e(c,a,d){var e=a.x-c.x,f=a.y-c.y,g=a.z-c.z,i=d.x-a.x,h=d.y-a.y,b=d.z-a.z;return.5*v(x(f*b-g*h,2)+x(e*b-g*i,2)+x(e*h-f*b,2))}function f(e,g,h,i,j){var b=e.x-h,c=e.y-i,d=e.z-j,f=v(b*b+c*c+d*d),a=f<g?g/f:1;return new p.Vector3(h+b*a,i+c*a,j+d*a)}function g(c,z){var A=z.x0,q=z.y0,x=z.z0,t=z.radius,b={},H=c.faces,k=[],a=c.vertices;for(var r=H.length-1;r>=0;r--){var g=H[r],h=g.a,d=g.b,e=g.c,l=g.normal,n=g.color,m=g.materialIndex,G=a[h],F=a[d],E=a[e],o,i,j,B=y(h,d)+'_'+C(h,d);if(!b[B]){var w=new p.Vector3().addVectors(G,F).divideScalar(2);w=f(w,t,A,q,x),o=b[B]=a.length,a.push(w)}else o=b[B];var v=y(d,e)+'_'+C(d,e);if(!b[v]){var u=new p.Vector3().addVectors(F,E).divideScalar(2);u=f(u,A,q,x,t);var i=b[v]=a.length;a.push(u)}else i=b[v];var s=y(h,e)+'_'+C(h,e);if(!b[s]){var D=new p.Vector3().addVectors(E,G).divideScalar(2);D=f(D,A,q,x,t);var j=b[s]=a.length;a.push(D)}else j=b[s];var J=new p.Face3(h,o,j,l,n,m),K=new p.Face3(o,d,i,l,n,m),L=new p.Face3(j,i,e,l,n,m),I=new p.Face3(o,i,j,l,n,m);k.push(J),k.push(K),k.push(L),k.push(I)}return c.vertices=a,c.faces=k,c.computeFaceNormals(),c.computeVertexNormals(),console.log(c),c}function h(e,k){var a=[];for(var c in e){var d=k[c],g=d.bound;if(g)a.push(e[c]);else{var h=d.adj,b=new p.Vector3(0,0,0),f=0;for(var j in h){var i=e[j];b.add(i),f++}b.divideScalar(f),a.push(b)}}return a}function i(g){var p=g.faces,k=g.vertices,a={},c={},e;for(var j=0;j<p.length;j++){var n=p[j],b=n.a,d=n.b,f=n.c;a[b]||(a[b]={adj:{}}),e=a[b].adj,e[d]=1,e[f]=1,a[d]||(a[d]={adj:{}}),e=a[b].adj,e[b]=1,e[f]=1,a[f]||(a[f]={adj:{}}),e=a[b].adj,e[b]=1,e[d]=1;var l=y(b,d)+'_'+C(b,d),m=y(d,f)+'_'+C(d,f),i=y(f,b)+'_'+C(f,b);c[l]?delete c[l]:c[l]=1,c[m]?delete c[m]:c[m]=1,c[i]?delete c[i]:c[i]=1}for(var r in c){var q=r.split('_'),s=q[0],t=q[1];a[s].bound=1,a[t].bound=1}for(var o=0;o<15;o++)k=h(k,a);return g.vertices=k,g.computeFaceNormals(),g}function j(j,l,k){var d=new p.Geometry,f=d.vertices;for(var a=k-1;a>=0;a--){var c=j+s(1e3*a)*l,e=A*w(),b=A*2*w(),h=c*s(e)*r(b),g=c*s(b),i=c*r(e)*r(b);f.push(new p.Vector3(h,g,i))}return d}function k(){try{var a=document.createElement('canvas'),b=a.getContext('webgl')||a.getContext('experimental-webgl');if(!b)throw'您的浏览器不支持webgl'}catch(a){alert('您的浏览器不支持webgl')}}function l(a){return typeof a==='function'?a:a==='sphere'?Sphere.project:void 0}function m(a){return a===null||a===undefined}function n(d,a){a=m(a)?.9:a;var e=d.getContext('2d'),f=e.getImageData(0,0,d.width,d.height),b=f.data,h=b.length,g;for(var c=0;c<h/4;c++)g=c*4+3,b[g]=b[g]*a;e.putImageData(f,0,0)}function a(a,c){typeof a==='String'&&(a=parseFloat(a));var b=c?Math.pow(10,c):1;return Math.floor(a*b)/b}var p=require('three'),q=require('aliyun-common-utils'),r=Math.cos,s=Math.sin,t=Math.atan2,u=Math.asin,v=Math.sqrt,w=Math.random,x=Math.pow,y=Math.min,z=Math.tan,A=Math.PI,B=Math.log,C=Math.max;k(),module.exports=q.extend(q,{genSphereParticles:j,getAreaTriangle3d:e,subdivideOnSphere:g,laplacian:i,getLatlngSphere:d,mercator:o,sphere:c,getPt:b,detect:k,darken:n,parseNumber:a}) |
@@ -1,1 +0,1 @@ | ||
!function(g,e,a,b,i,h,d,l,j,k,f){function m(){}function n(a,e){if(arguments.length===1)return d.fireModule(a);var b=d.fireModule(a);c.css(b,e,a)}function o(d,a,b){arguments.length===2&&typeof a==='function'?(b=a,a=null,c.use(d,b)):c.use(d,function(e){e=c.css(e,a,d),b&&b(e)})}function c(c,e,h){var f=!1;if(arguments.length===3){b[c]||(b[c]={exports:{},loaded:!1,fired:!1},f=!0,e.length&&a.debug&&console.info('Cube Info: Module \''+e+'\''+' should exist'));var g=b[c];g.fn=h,g.loaded=!0,f||d.load(e,c)}}a={base:'',remoteBase:{},remoteSeparator:':',charset:'utf-8',version:+new Date,debug:!1,entrances:{}},b={},i=document.querySelector('head'),h=!1,d={reBase:function(c){var b=c.indexOf(a.remoteSeparator);return b>0?a.remoteBase[c.substr(0,b)]+c.substr(b+1):''},fixUseModPath:function(d){var e=d.length,b;for(var c=0;c<e;c++)b=d[c],b.indexOf(a.remoteSeparator)===-1&&(b.indexOf('./')===0?d[c]=b.substr(1):b[0]!=='/'&&(d[c]='/'+b));return d},checkAllDownloaded:function(){var a=0;for(var c in b)b[c].loaded||a++;return a},load:function(c,e){typeof c==='string'&&(c=[c]),c.forEach(function(f){if(b[f])return;var c=document.createElement('script');c.type='text/javascript',c.async='true',c.charset=a.charset;var h=d.reBase(f),g=[h||a.base+f,'?m=1&',a.version].join('');a.debug&&(g+='&ref='+e),c.src=g,i.appendChild(c),b[f]={exports:{},loaded:!1,fired:!1}}),d.checkAllDownloaded()===0&&d.startAppAndCallback()},fireModule:function(c){var a=b[c];return a?(a.fired||(a.fired=!0,a.exports=a.fn.apply(g,[a,a.exports,n,o])),a.exports):console.error('Cube Error: Cannot find module \''+c+'\'')},startAppAndCallback:function(){if(h)return;h=!0;var c=a.entrances,e,f;for(e in c)f=e.split(','),f.forEach(function(f){var a=0;d.fireModule(f),c[e].forEach(function(d){var c=d(b[f].exports);c&&a++}),c[e].length===a&&delete c[e]});h=!1}},c.init=function(d){if(d.base&&d.base!=='/'&&(a.base=d.base.replace(/\/$/,'')),d.remoteBase)for(var e in d.remoteBase)a.remoteBase[e]=d.remoteBase[e].replace(/\/$/,'');return d.charset&&(a.charset=d.charset),d.version&&(a.version=d.version),d.debug&&(a.debug=d.debug,c.cache=b),this},c.use=function(b,c,e){if(!b)throw new Error('Cube.use(moduleName) moduleName is undefined!');return c=c||m,typeof b==='string'&&(b=[b]),e||(b=d.fixUseModPath(b)),d.load(b,'Cube.use'),a.entrances[b]||(a.entrances[b]=[]),a.entrances[b].push(function(a,d){return a=[],d=b.length,function(b){return a.push(b),a.length===d?(c.apply(g,a),!0):void 0}}()),d.checkAllDownloaded()===0&&d.startAppAndCallback(),this},c.register=function(a,c){return b[a]?console.error('Cube Error: Module \''+a+'\''+' already registered'):(b[a]={exports:c,fn:m,loaded:!0,fired:!0},this)},l=/([^};]+)(\{[^}]+\})/g,j={},c.css=function(b,c,e){if(!b)return;var d=e+'@'+c;if(j[d])return;j[d]=!0,c&&(b=b.replace(l,function(e,b,d){var a=b.split(',').map(function(a){return c+' '+a.trim()});return a.join(',')+d}));var a=document.createElement('style');return a.setAttribute('type','text/css'),a.setAttribute('mod',e),c&&a.setAttribute('ns',c),i.appendChild(a),a.innerHTML=b,b},e=e||'Cube',g[e]?console.error('Cube Error: window.'+e+' already in using, replace the last "null" param in cube.js'):g[e]=c,k=document.currentScript,k&&(f=k.dataset,f.base&&(c.init(f),c.use(f.main||'index.js',function(a){a.run&&a.run()})))}(window,null) | ||
!function(h,e,a,b,f,k,g,d,m,j,l,i){function n(){}function o(a,e){if(arguments.length===1)return d.fireModule(a);var b=d.fireModule(a);c.css(b,e,a)}function p(d,a,b){arguments.length===2&&typeof a==='function'?(b=a,a=null,c.use(d,b)):c.use(d,function(e){e=c.css(e,a,d),b&&b(e)})}function c(a,e,g){b[a]||(b[a]={exports:{},loaded:!1,fired:!1});var c=b[a];c.fn=g,c.loaded=!0,delete f[a],d.load(e,a)}a={base:'',remoteBase:{},remoteSeparator:':',charset:'utf-8',version:+new Date,debug:!1,entrances:{}},b={},f={},k=document.querySelector('head'),g=!1,d={reBase:function(c){var b=c.indexOf(a.remoteSeparator);return b>0?a.remoteBase[c.substr(0,b)]+c.substr(b+1):''},fixUseModPath:function(d){var e=d.length,b;for(var c=0;c<e;c++)b=d[c],b.indexOf(a.remoteSeparator)===-1&&(b.indexOf('./')===0?d[c]=b.substr(1):b[0]!=='/'&&(d[c]='/'+b));return d},checkAllDownloaded:function(){for(var a in f)if(f.hasOwnProperty(a))return!1;return!0},load:function(c,e){typeof c==='string'&&(c=[c]),c.forEach(function(g){if(b[g])return;var c=document.createElement('script');c.type='text/javascript',c.async='true',c.charset=a.charset;var i=d.reBase(g),h=[i||a.base+g,'?m=1&',a.version].join('');a.debug&&(h+='&ref='+e),c.src=h,k.appendChild(c),b[g]={exports:{},loaded:!1,fired:!1},f[g]=!0}),d.checkAllDownloaded()&&d.startAppAndCallback()},fireModule:function(c){var a=b[c];return a?(a.fired||(a.fired=!0,a.exports=a.fn.apply(h,[a,a.exports,o,p])),a.exports):console.error('Cube Error: Cannot find module \''+c+'\'')},startAppAndCallback:function(){if(g)return;g=!0;var c=a.entrances,e,f;for(e in c)c.hasOwnProperty(e)&&(f=e.split(','),f.forEach(function(f){var a=0;d.fireModule(f),c[e].forEach(function(d){var c=d(b[f].exports);c&&a++}),c[e].length===a&&delete c[e]}));g=!1}},c.toString=function(){return'Cube:v2.0.7'},c.init=function(b){if(b.base&&b.base!=='/'&&(a.base=b.base.replace(/\/$/,'')),b.remoteBase)for(var c in b.remoteBase)b.remoteBase.hasOwnProperty(c)&&(a.remoteBase[c]=b.remoteBase[c].replace(/\/$/,''));return b.charset&&(a.charset=b.charset),b.version&&(a.version=b.version),this},c.use=function(b,c,e){if(!b)throw new Error('Cube.use(moduleName) moduleName is undefined!');return c=c||n,typeof b==='string'&&(b=[b]),e||(b=d.fixUseModPath(b)),d.load(b,'Cube.use'),a.entrances[b]||(a.entrances[b]=[]),a.entrances[b].push(function(a,d){return a=[],d=b.length,function(b){return a.push(b),a.length===d?(c.apply(h,a),!0):void 0}}()),d.checkAllDownloaded()&&d.startAppAndCallback(),this},c.register=function(a,c){return b[a]?console.error('Cube Error: Module \''+a+'\''+' already registered'):(b[a]={exports:c,fn:n,loaded:!0,fired:!0},this)},m=/([^};]+)(\{[^}]+\})/g,j={},c.css=function(b,c,e){if(!b)return;var d=e+'@'+c;if(j[d])return;j[d]=!0,c&&(b=b.replace(m,function(e,b,d){var a=b.split(',').map(function(a){return c+' '+a.trim()});return a.join(',')+d}));var a=document.createElement('style');return a.setAttribute('type','text/css'),a.setAttribute('mod',e),c&&a.setAttribute('ns',c),k.appendChild(a),a.innerHTML=b,b},window.localStorage&&localStorage.cube==='debug'&&(a.debug=!0,c.info=function(){var d={},e={},a,c;for(a in b)b.hasOwnProperty(a)&&(c=b[a],c.loaded||(d[a]=c),c.fired||(e[a]=c));console.info('modules:',b),console.info('unloaded:',d),console.info('unfired:',e)}),e=e||'Cube',h[e]?console.error('Cube Error: window.'+e+' already in using, replace the last "null" param in cube.js'):h[e]=c,l=document.currentScript,l&&(i=l.dataset,i.base&&(c.init(i),c.use(i.main||'index.js',function(a){a.run&&a.run()})))}(window,null) |
@@ -1,1 +0,1 @@ | ||
'use strict';function a(a,b,c){return typeof a==='function'?a(b,c):a}function b(a){a=this.options=d.deepMerge(b.options,a)}var c=require('three'),d=require('bcore/utils'),e=require('bcore/event');b.options={width:200,height:100,style:{offsetLeft:30,fontSize:25,color:'#fff',background:'rgba(0,0,0,0.9)',opacity:function(){return 1}},scaleSize:1e6},b=e.extend(b,{addTo:function(a){if(!a)return;this._map=a,this.three3D=a.three3D,this.init()},init:function(){var a=this.options,b=this.canvas=document.createElement('canvas'),h=this.ctx=b.getContext('2d');b.width=a.width,b.height=a.height;var d=this.texture=new c.Texture(b);d.needsUpdate=!0;var e=a.scaleSize,g=this.material=new c.SpriteMaterial({useScreenCoordinates:!0,map:d,opacity:1,transparent:!0,depthTest:!0,fog:!1}),f=this.object=new c.Sprite(g);f.scale.set(e,e*a.height/a.width),this.three3D.add(f)},updatePos:function(a){this.position=a,this.object.position.set(a.x,a.y,a.z)},clear:function(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height)},updateText:function(g,k){var c=this.options,b=this.ctx;if(this.clear(),c.updateCtx)return c.updateCtx(b);var i=b.canvas.width,j=b.canvas.height,d=c.style;b.fillStyle=d.background,b.font=d.fontSize+'px Arial';var h=b.measureText(g);b.textBaseline='middle';var f=h.width,e=(i-f)/2;c.offsetLeft&&(e-=d.offsetLeft),b.fillRect(0,0,f+2*e,c.height),b.fillStyle=a(d.color),b.fillText(g,e,c.height/2,f),b.fill()},update:function(){this.updateOpacity()},updateOpacity:function(){var a=this._map.three3D.camera,b=a.position,c=b.distanceTo(this.position),d=this._map.projection.radius,e=this.options,f=e.style.opacity(c/d);this.material.opacity=f},remove:function(){this.three3D.remove(this.pointCloud)}}),module.exports=b | ||
'use strict';function a(a,b,c){return typeof a==='function'?a(b,c):a}function b(a){a=this.options=d.deepMerge(b.options,a)}var c=require('three'),d=require('bcore/utils'),e=require('bcore/event');b.options={width:200,height:100,style:{offsetLeft:30,fontSize:25,color:'#fff',background:'rgba(240,0,0,0.9)',opacity:function(){return 1}},scaleSize:1e6},b=e.extend(b,{addTo:function(a){if(!a)return;this._map=a,this.three3D=a.three3D,this.init()},init:function(){var a=this.options,b=this.canvas=document.createElement('canvas'),h=this.ctx=b.getContext('2d');b.width=a.width,b.height=a.height;var f=this.texture=new c.Texture(b),g=this.material=new c.SpriteMaterial({map:f,opacity:1,transparent:!0,depthTest:!0,fog:!1}),d=a.scaleSize,e=this.object=new c.Sprite(g);e.scale.set(d,d*a.height/a.width),this.three3D.add(e)},updatePos:function(a){this.position=a,this.object.position.set(a.x,a.y,a.z)},clear:function(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height)},updateTexture:function(i,o){var m=this,b=this.ctx,d=this.options,j=d.type,e=d.style;if(this.clear(),d.updateCtx)return d.updateCtx(b);var k=b.canvas.width,n=b.canvas.height;if(j==='text'){b.fillStyle=e.background,b.font=e.fontSize+'px Arial';var l=b.measureText(i);b.textBaseline='middle';var f=l.width,h=(k-f)/2;d.offsetLeft&&(h-=e.offsetLeft),b.fillRect(0,0,f+2*h,d.height),b.fillStyle=a(e.color),b.fillText(i,h,d.height/2,f),b.fill()}else if(j==='image'){if(typeof i!=='string'){console.log('need urls of images');return}var g=new c.ImageLoader;g.setCrossOrigin('*'),g.crossOrigin='*',g.load(i,function(a){b.drawImage(a,0,0),m.texture.needsUpdate=!0})}},update:function(){this.updateOpacity()},updateMaterial:function(){this.texture.needsUpdate=!0,this.material.needsUpdate=!0,this.material.map.needsUpdate=!0},updateOpacity:function(){var a=this._map.three3D.camera,b=a.position,c=b.distanceTo(this.position),d=this._map.projection.radius,e=this.options,f=e.style.opacity(c/d);this.material.opacity=f},remove:function(){this.three3D.remove(this.pointCloud)}}),module.exports=b |
@@ -1,1 +0,1 @@ | ||
'use strict';function b(c){c=this.options=a.deepMerge(b.options,c),this._markers=[]}var a=require('./../../core/utils'),c=a.mercator,d=a.sphere,e=require('./marker'),f=require('lodash'),g=a.isNone,h=require('three'),a=require('bcore/utils'),i=require('bcore/event');b.options={markerN:100,isDynamic:!0,text:function(a){return a.text},fog:!0,scale:1.1,marker:{quality:3,height:100,width:300,style:{offsetLeft:30,fontSize:55,color:'#0ff',background:'rgba(0,0,0,0.9)'}},lat:function(a){return a.lat},lng:function(a){return a.lng},id:function(a,b){return a.id||b}},b=i.extend(b,{addTo:function(a){if(!a)return;this._map=a,this.three3D=a.three3D,this.projection=a.projection},onUpdate:function(a){if(typeof a!=='function')return console.log('必须是函数');this._updateCtx=this._opt.updateCtx=a},remove:function(){var a=this._data;for(var b in a){var c=a[b];c.marker.remove(),delete a[b]}},data:function(a){this._data=a},draw:function(){var d=this._data;if(!d)return;var m=this.projection,k=this._map,b=this.options,g=b.scale,q=b.text,r=b.id,s=b.lat,l=b.lng,c,i,n,o,p,j,f,a;for(var h in d)c=d[h],i=r(c,h),n=q(c),o=s(c),p=l(c),a=m.project({lng:p,lat:o}),a.x=a.x*g,a.y=a.y*g,a.z=a.z*g,j=d[i],j?f=j.marker:(f=new e(b.marker),f.addTo(k),d[i]={marker:f}),f.updateText(n,c),f.updatePos(a,c)},update:function(){var a=this._data;for(var c in a){var d=a[c],b=d.marker;b&&b.update()}},render:function(a){a&&this.data(a),this.draw()}}),module.exports=b | ||
'use strict';function b(c){c=this.options=a.deepMerge(b.options,c),this.markers={}}var a=require('./../../core/utils'),c=a.mercator,d=a.sphere,e=require('./marker'),f=require('lodash'),g=a.isNone,h=require('three'),a=require('bcore/utils'),i=require('bcore/event');b.options={markerN:100,isDynamic:!0,text:function(a){return a.text},fog:!0,ratio:1.1,marker:{depthTest:!0,scaleSize:15e5,quality:3,height:100,width:300,style:{offsetLeft:30,fontSize:55,color:'#0ff',background:'rgba(0,0,0,0.9)'}},lat:function(a){return a.lat},lng:function(a){return a.lng},id:function(a,b){return a.id||b}},b=i.extend(b,{addTo:function(a){if(!a)return;this._map=a,this.three3D=a.three3D,this.projection=a.projection},onUpdate:function(a){if(typeof a!=='function')return console.log('必须是函数');this._updateCtx=this._opt.updateCtx=a},remove:function(){var a=this._data;for(var b in a){var c=a[b];c.marker.remove(),delete a[b]}},data:function(a){this._data=a},draw:function(){var g=this._data;if(!g)return;var o=this.projection,s=this._map,i=this.markers,n=this.getChildOptions(),d=this.options,f=d.ratio,t=d.text,k=d.id,l=d.lat,m=d.lng,b,j,p,q,r,c,a;for(var h in g)b=g[h],j=k(b,h),p=t(b),q=l(b),r=m(b),a=o.project({lng:r,lat:q}),a.x=a.x*f,a.y=a.y*f,a.z=a.z*f,c=i[j],c||(c=new e(n),c.addTo(s),i[j]=c),c.updateTexture(p,b),c.updatePos(a,b)},each:function(b){var c,a=this.markers;for(var d in a)c=a[d],b&&b(c)},update:function(){this.each(function(a){a&&a.update()})},getChildOptions:function(){var a=this.options;return a.marker},updateOptions:function(c){this.options=a.deepMerge(this.options,c),this.draw();var b=this.getChildOptions();this.each(function(a){a.updateOptions(b)}.bind(this))},render:function(a){a&&this.data(a),this.draw()}}),module.exports=b |
@@ -1,1 +0,1 @@ | ||
'use strict';function f(a,b){return typeof a==='function'?a(arguments[1],arguments[2],arguments[3],arguments[4]):a}function h(a,b,c){return typeof a==='function'?a(b,c):a}function c(a,b){return typeof a==='function'?a(b):a}function d(c,d){var b=c.faces,a=k.parse(d).arr;setTimeout(function(){var f;for(var d=0;d<b.length;d++){var f=b[d],h=Math.abs(Math.cos(d/10)),e=new g.Color('rgb('+a[0]+', '+Math.floor(a[1]+h*30)+', '+Math.floor(a[2]+50*h)+')');f.vertexColors.push(e,e,e)}c.colorsNeedUpdate=!0},10)}function e(a){this.options=b.deepMerge(e.options,a)}function a(a){return a===undefined?!1:!0}var g=require('three'),b=require('./../core/utils'),i=b.divideby,j=b.traver,a=b.isNone,k=b.format,l=require('./../map/projection/mecator'),m=b.getColorFunc,n=b.switchValue;e.options={geoid:function(b){if(b.id)return b.id;var a=b.properties;return a?a.id||a.adcode:void 0},lat:function(a){return a[1]},lng:function(a){return a[0]},value:function(a){return a&&a.value?a.value||0:a},id:function(a,b){return a.id||a.adcode||b},offset:function(){return{x:0,y:0,z:0}},ratio:1,shape:{fill:{transparent:!1,type:'flat',colorBack:2236962,hue:360,colorFront:'#07c',opacity:1},stroke:null}},e.prototype.addTo=function(a){this._map=a,this.projection=a.projection,this.three3D=a.three3D},e.prototype.render=function(a){a&&this.data(a),this.draw()},e.prototype.data=function(a){if(!a)return;this.processing(a)},e.prototype.processing=function(f){var c,d,b,k,g,i=this.options.value,j=this.options.id,h={};for(var e in f)g=f[e],k=j(g,e),b=i(f[e]),h[k]=g,d=a(d)?b:d,c=a(c)?b:c,b>d&&(d=b),b<c&&(c=b);this.vMax=d,this.vMin=c,this._data=h},e.prototype.draw=function(){var a=this._data,c=this.options.id,d=this.geo,g,e,f;for(var b in a)e=a[b],f=c(e,b),g=d[f];this.updateFill(),this.updateStroke()},e.prototype.geoJson=function(p){var e=this.options;if(!p)return console.log('没有geojson');var h=this.options.shape,n=this.projection,f=h.fill;if(f)var m=this.genFill(f);var g=h.stroke;if(g)var l=this.genStroke(g);var i=this.geo=this.geo||{},d,k,o,b,a,q=this.traverArray.bind(this);j(p,function(u,r,h){if(u!=='geometry')return!0;if(k=e.geoid(h),a=i[k]=i[k]||{},d=h.properties,b=r.coordinate||h.cp||d.cp||d.coordinate,b){a.cp=b;var s=b.lat||b[0],t=b.lng||b[1];a.cp3D=n.project({lng:t,lat:s},1)}var j=d.cName||d.name;j&&(a.cName=j),f&&(m(a),a.fillMesh=[]),g&&(l(a),a.strokeMesh=[]);var p;return e.offset?p=c(e.offset,d):p={x:0,y:0,z:0},o=r.coordinates,q(o,a,p),!1}),this.updateScale()},e.prototype.traverArray=function(a,c,d){for(var b in a)if(typeof a[b][0]!=='object'){this.pts2Mesh.bind(this)(a,c,d);break}else this.traverArray.bind(this)(a[b],c,d)},e.prototype.pts2Mesh=function(l,c,i){var j=this.projection,d=this.pts2MeshGeo(l,c);if(d){var h=this.three3D,e=d.fillGeometry,f=d.strokeGeometry;if(e){var b=c.material;if(!b)return;j.type==='sphere';var a;typeof b==='function'?a=b(e):typeof b==='object'&&(a=new g.Mesh(e,b)),a.position.set(i.x,i.y,i.z),h.add(a),c.fillMesh.push(a)}if(f){var k=c.strokeMaterial;f.computeLineDistances();var a;a=new g.Line(f,k),a.position.set(0,0,0),h.add(a),c.strokeMesh.push(a)}}},e.prototype.pts2MeshGeo=function(r,E){var A=this.projection,m=this.options,q=m.shape,C=q.stroke,D=q.fill,k=q.divide,s=new g.Shape,j=[],b,w,f,h,x,B=m.lat,z=m.lng,t=1e-5,u=1e-5,n,o;if(r.length<3)return console.log('less 3pts');for(var e=0;e<r.length;e++)n=B(r[e]),k&&(n=i(n,k)),o=z(r[e]),k&&(o=i(o,k)),b=A.project({lng:o,lat:n},m.ratio),w=l.project({lng:o,lat:n}),f=w.x,h=w.z,x=!a(f)&&!a(h),e===0&&x&&(s.moveTo(-h,-f),j.push(b),t=f,u=h),e!==0&&(t!==f||u!==h)&&x&&(s.lineTo(-h,-f),j.push(b),t=f,u=h);var p,d;if(j.length){var v,y;if(D){y=new g.ShapeGeometry(s),p=y.vertices;for(var c=0;c<p.length;c++)b=j[c],d=p[c],d&&b&&(d.x=b.x,d.z=b.z,d.y=b.y)}if(C){v=new g.Geometry,p=v.vertices;for(var c=0;c<j.length;c++)b=j[c],d=new g.Vector3,d.x=b.x,d.z=b.z,d.y=b.y,p.push(d)}return{strokeGeometry:v,fillGeometry:y}}return!1},e.prototype.hide=function(){var a;this.each(function(c){if(a=c.fillMesh,a)for(var b in a)a[b].visible=!1;if(a=c.strokeMesh,a)for(var b in a)a[b].visible=!1})},e.prototype.show=function(){var a;this.each(function(c){if(a=c.fillMesh,a)for(var b in a)a[b].visible=!0;if(a=c.strokeMesh,a)for(var b in a)a[b].visible=!0})},e.prototype.updateScale=function(){var a,b=this.options.ratio;this.each(function(d){if(a=d.fillMesh,a)for(var c in a)a[c].scale.set(b,b,b);if(a=d.strokeMesh,a)for(var c in a)a[c].scale.set(b,b,b)})},e.prototype.genFill=function(a){if(typeof a==='function')return a;var i=this.options,k=this.projection,c=a.opacity,e={transparent:i.shape.fill.transparent},l=f(a.colorBack,0),m=f(a.colorFront,0);c=h(a.opacity,0);var n=b.extend({color:l,side:g.BackSide,vertexColors:g.VertexColors,opacity:c},e),o=b.extend({wireframe:!1,opacity:c,color:m,side:g.FrontSide,vertexColors:g.VertexColors},e),j=(a?a.type:'none')||'none';return{triangle:function(a){a.material=function(a){k.type==='mecator'&&d(a,i.shape.fill.colorFront);var b=new g.MeshPhongMaterial({vertexColors:g.VertexColors}),c=new g.MeshPhongMaterial({vertexColors:g.VertexColors});return g.SceneUtils.createMultiMaterialObject(a,[b,c])}},none:function(a){return a},flat:function(c){var a=new g.MeshBasicMaterial(n),b=new g.MeshBasicMaterial(o);c.material=function(c){return g.SceneUtils.createMultiMaterialObject(c,[a,b])}}}[j]},e.prototype.update=function(){this.updateFill(),this.updateStroke()},e.prototype.updateFill=function(){var q=this.options,C=q.shape,B=q.value,b=C.fill;if(!b)return;var A=m(b.colorFront),z=m(b.colorBack),w=this.vMax,k=this.vMin,t=this._data,n=this.geo;for(var o in n){var p=n[o],r=p.fillMesh,c=t[o],a=B(c);a&&(a=(a-k)/(w-k));var y=A(a,c),u=z(a,c);for(var v in r){var j=r[v],x=j.children[0],s=j.children[1],i=x.material,f=s.material,l=h(b.opacity,c,p),e=new g.Color(u);i.color.setRGB(e.r,e.g,e.b),i.opacity=l;var d=new g.Color(y);f.color.setRGB(d.r,d.g,d.b),f.opacity=l}}},e.prototype.updateStroke=function(){var k=this.options.shape,b=k.stroke;if(!b)return;var r=b.color,e=this.geo,p=this._data;for(var h in e){var j=e[h],l=p[h],i=j.strokeMesh;for(var m in i){var o=i[m],c=o.material,q=f(r,l),d=new g.Color(q);c.color.setRGB(d.r,d.g,d.b);var a=b.opacity;(a===null||a===undefined)&&(a=1),c.opacity=a,c.linewidth=n(b.linewidth)}}},e.prototype.updateOptions=function(a){this.options=b.deepMerge(this.options,a),this.updateStroke(),this.updateFill(),this.updateScale()},e.prototype.each=function(d){var a=this.geo;for(var b in a){var c=a[b];d(c)}},e.prototype.genStroke=function(a){if(typeof a==='function')return a;var c=this.options.shape.stroke,h=a.type||'default',d=a.color||16777215,b=a.opacity,e=a.width||a.linewidth||.01,f=b?!0:!1;return{dash:function(a){a.strokeMaterial=new g.LineDashedMaterial({linewidth:e,color:d,dashSize:c.dashSize,gapSize:c.gapSize,transparent:f,opacity:b,linejoin:'round',linecap:'round'})},default:function(a){a.strokeMaterial=new g.LineBasicMaterial({linewidth:e,color:d,transparent:f,opacity:b,linejoin:'round',linecap:'round'})}}[h]},e.prototype.loop=function(){},e.prototype.geojson=e.prototype.geoJson,module.exports=e | ||
'use strict';function f(a,b){return typeof a==='function'?a(arguments[1],arguments[2],arguments[3],arguments[4]):a}function h(a,b,c){return typeof a==='function'?a(b,c):a}function c(a,b){return typeof a==='function'?a(b):a}function d(c,d){var b=c.faces,a=k.parse(d).arr;setTimeout(function(){var f;for(var d=0;d<b.length;d++){var f=b[d],h=Math.abs(Math.cos(d/10)),e=new g.Color('rgb('+a[0]+', '+Math.floor(a[1]+h*30)+', '+Math.floor(a[2]+50*h)+')');f.vertexColors.push(e,e,e)}c.colorsNeedUpdate=!0},10)}function e(a){this.options=b.deepMerge(e.options,a)}function a(a){return a===undefined?!1:!0}var g=require('three'),b=require('./../core/utils'),i=b.divideby,j=b.traver,a=b.isNone,k=b.format,l=require('./../map/projection/mecator'),m=b.getColorFunc,n=b.switchValue;e.options={geoid:function(b){if(b.id)return b.id;var a=b.properties;return a?a.id||a.adcode:void 0},lat:function(a){return a[1]},lng:function(a){return a[0]},value:function(a){return a&&a.value?a.value||0:a},id:function(a,b){return a.id||a.adcode||b},offset:function(){return{x:0,y:0,z:0}},ratio:1,shape:{fill:{transparent:!1,type:'flat',colorBack:2236962,hue:360,colorFront:'#07c',opacity:1},stroke:null}},e.prototype.addTo=function(a){this._map=a,this.projection=a.projection,this.three3D=a.three3D},e.prototype.render=function(a){a&&this.data(a),this.draw()},e.prototype.data=function(a){if(!a)return;this.processing(a)},e.prototype.processing=function(f){var c,d,b,k,g,i=this.options.value,j=this.options.id,h={};for(var e in f)g=f[e],k=j(g,e),b=i(f[e]),h[k]=g,d=a(d)?b:d,c=a(c)?b:c,b>d&&(d=b),b<c&&(c=b);this.vMax=d,this.vMin=c,this._data=h},e.prototype.draw=function(){var a=this._data,c=this.options.id,d=this.geo,g,e,f;for(var b in a)e=a[b],f=c(e,b),g=d[f];this.updateFill(),this.updateStroke()},e.prototype.geoJson=function(p){var e=this.options;if(!p)return console.log('没有geojson');var h=this.options.shape,n=this.projection,f=h.fill;if(f)var m=this.genFill(f);var g=h.stroke;if(g)var l=this.genStroke(g);var i=this.geo=this.geo||{},d,k,o,b,a,q=this.traverArray.bind(this);j(p,function(u,r,h){if(u!=='geometry')return!0;if(k=e.geoid(h),a=i[k]=i[k]||{},d=h.properties,b=r.coordinate||h.cp||d.cp||d.coordinate,b){a.cp=b;var s=b.lat||b[0],t=b.lng||b[1];a.cp3D=n.project({lng:t,lat:s},1)}var j=d.cName||d.name;j&&(a.cName=j),f&&(m(a),a.fillMesh=[]),g&&(l(a),a.strokeMesh=[]);var p;return e.offset?p=c(e.offset,d):p={x:0,y:0,z:0},o=r.coordinates,q(o,a,p),!1}),this.updateScale()},e.prototype.traverArray=function(a,c,d){for(var b in a)if(typeof a[b][0]!=='object'){this.pts2Mesh.bind(this)(a,c,d);break}else this.traverArray.bind(this)(a[b],c,d)},e.prototype.pts2Mesh=function(l,c,i){var j=this.projection,d=this.pts2MeshGeo(l,c);if(d){var h=this.three3D,e=d.fillGeometry,f=d.strokeGeometry;if(e){var b=c.material;if(!b)return;j.type==='sphere';var a;typeof b==='function'?a=b(e):typeof b==='object'&&(a=new g.Mesh(e,b)),a.position.set(i.x,i.y,i.z),h.add(a),c.fillMesh.push(a)}if(f){var k=c.strokeMaterial;f.computeLineDistances();var a;a=new g.Line(f,k),a.position.set(0,0,0),h.add(a),c.strokeMesh.push(a)}}},e.prototype.pts2MeshGeo=function(r,E){var A=this.projection,m=this.options,q=m.shape,C=q.stroke,D=q.fill,k=q.divide,s=new g.Shape,j=[],b,w,f,h,x,B=m.lat,z=m.lng,t=1e-5,u=1e-5,n,o;if(r.length<3)return console.log('less 3pts');for(var e=0;e<r.length;e++)n=B(r[e]),k&&(n=i(n,k)),o=z(r[e]),k&&(o=i(o,k)),b=A.project({lng:o,lat:n},m.ratio),w=l.project({lng:o,lat:n}),f=w.x,h=w.z,x=!a(f)&&!a(h),e===0&&x&&(s.moveTo(-h,-f),j.push(b),t=f,u=h),e!==0&&(t!==f||u!==h)&&x&&(s.lineTo(-h,-f),j.push(b),t=f,u=h);var p,d;if(j.length){var v,y;if(D){y=new g.ShapeGeometry(s),p=y.vertices;for(var c=0;c<p.length;c++)b=j[c],d=p[c],d&&b&&(d.x=b.x,d.z=b.z,d.y=b.y)}if(C){v=new g.Geometry,p=v.vertices;for(var c=0;c<j.length;c++)b=j[c],d=new g.Vector3,d.x=b.x,d.z=b.z,d.y=b.y,p.push(d)}return{strokeGeometry:v,fillGeometry:y}}return!1},e.prototype.hide=function(){var a;this.each(function(c){if(a=c.fillMesh,a)for(var b in a)a[b].visible=!1;if(a=c.strokeMesh,a)for(var b in a)a[b].visible=!1})},e.prototype.show=function(){var a;this.each(function(c){if(a=c.fillMesh,a)for(var b in a)a[b].visible=!0;if(a=c.strokeMesh,a)for(var b in a)a[b].visible=!0})},e.prototype.updateScale=function(){var a,b=this.options.ratio;this.each(function(d){if(a=d.fillMesh,a)for(var c in a)a[c].scale.set(b,b,b);if(a=d.strokeMesh,a)for(var c in a)a[c].scale.set(b,b,b)})},e.prototype.genFill=function(a){if(typeof a==='function')return a;var i=this.options,k=this.projection,c=a.opacity,e={transparent:i.shape.fill.transparent},l=f(a.colorBack,0),m=f(a.colorFront,0);c=h(a.opacity,0);var n=b.extend({color:l,side:g.BackSide,vertexColors:g.VertexColors,opacity:c},e),o=b.extend({wireframe:!1,opacity:c,color:m,side:g.FrontSide,vertexColors:g.VertexColors},e),j=(a?a.type:'none')||'none';return{triangle:function(a){a.material=function(a){k.type==='mecator'&&d(a,i.shape.fill.colorFront);var b=new g.MeshPhongMaterial({vertexColors:g.VertexColors}),c=new g.MeshPhongMaterial({vertexColors:g.VertexColors});return g.SceneUtils.createMultiMaterialObject(a,[b,c])}},none:function(a){return a},flat:function(c){var a=new g.MeshBasicMaterial(n),b=new g.MeshBasicMaterial(o);c.material=function(c){return g.SceneUtils.createMultiMaterialObject(c,[a,b])}}}[j]},e.prototype.update=function(){this.updateFill(),this.updateStroke()},e.prototype.updateFill=function(){var q=this.options,C=q.shape,B=q.value,b=C.fill;if(!b)return;var A=m(b.colorFront),z=m(b.colorBack),w=this.vMax,k=this.vMin,t=this._data||{},n=this.geo;for(var o in n){var p=n[o],r=p.fillMesh,c=t[o],a=B(c);a&&(a=(a-k)/(w-k));var y=A(a,c),u=z(a,c);for(var v in r){var j=r[v],x=j.children[0],s=j.children[1],i=x.material,f=s.material,l=h(b.opacity,c,p),e=new g.Color(u);i.color.setRGB(e.r,e.g,e.b),i.opacity=l;var d=new g.Color(y);f.color.setRGB(d.r,d.g,d.b),f.opacity=l}}},e.prototype.updateStroke=function(){var k=this.options.shape,b=k.stroke;if(!b)return;var r=b.color,e=this.geo,p=this._data;for(var h in e){var j=e[h],l=p[h],i=j.strokeMesh;for(var m in i){var o=i[m],c=o.material,q=f(r,l),d=new g.Color(q);c.color.setRGB(d.r,d.g,d.b);var a=b.opacity;(a===null||a===undefined)&&(a=1),c.opacity=a,c.linewidth=n(b.linewidth)}}},e.prototype.updateOptions=function(a){this.options=b.deepMerge(this.options,a),this.updateStroke(),this.updateFill(),this.updateScale()},e.prototype.each=function(d){var a=this.geo;for(var b in a){var c=a[b];d(c)}},e.prototype.genStroke=function(a){if(typeof a==='function')return a;var c=this.options.shape.stroke,h=a.type||'default',d=a.color||16777215,b=a.opacity,e=a.width||a.linewidth||.01,f=b?!0:!1;return{dash:function(a){a.strokeMaterial=new g.LineDashedMaterial({linewidth:e,color:d,dashSize:c.dashSize,gapSize:c.gapSize,transparent:f,opacity:b,linejoin:'round',linecap:'round'})},default:function(a){a.strokeMaterial=new g.LineBasicMaterial({linewidth:e,color:d,transparent:f,opacity:b,linejoin:'round',linecap:'round'})}}[h]},e.prototype.loop=function(){},e.prototype.geojson=e.prototype.geoJson,module.exports=e |
@@ -1,1 +0,1 @@ | ||
'use strict';function g(a){var b=a*a;return 3*b+2*b*a}function i(a){return a===undefined||a===null}function c(a){if(typeof a==='string'&&a.indexOf(',')!==-1){a=a.split(',');var b=a[0]||0,c=a[1]||0;return{lat:parseFloat(b,10),lng:parseFloat(c,10)}}return a}function d(a,b,c,d){return a+(b-a)*c}function e(d,e,a,b){b=b||1;var c=a*a;return a=3*c-2*c*a,a=Math.pow(a,b),d+(e-d)*a}function f(a){this.updateOptions(a);var b=this.id='flyingline_'+Math.floor(Math.random()*1e9);this.reset()}var a=require('./../core/utils'),h=require('bcore/event'),b=a.mercator,j=a.sphere,k=require('three'),a=require('./../core/utils'),l=a.requestAnimationFrame,m=a.cancelAnimationFrame,n=require('./cube_utils'),o={cube:n(),smooth:function(c){var g=this.options,a=this.ptFrom,b=this.ptTo,f=g.flying.indensty,h=e(a.x,b.x,c,f),i=d(a.y,b.y,c),j=e(a.z,b.z,c,f);return new k.Vector3(h,i,j)},flying:function(a){var b=this.options,c=b.flying,d=c.kHeight+(this.kHeightJitter||0),e=this.ptFrom,f=this.ptTo,g=this._getNormal(),h=(1-a)*a*d*this.distance,i=e.clone().lerp(f,a).add(g.multiplyScalar(h));return i}};f.options={ptN:10,range:.8,isUpdateWhenEndStart:!0,flying:{kHeight:2,kHeightJitter:.2,weight:2,style:{hue:.5,opacity:.2,color:function(a){var b=.5;return new k.Color().setHSL(b,1-a*.3,.3+Math.pow(a,8)*.6)}}},type:'flying',lifeSpeed:.002,delay:0,delayEnd:1,lifeMin:0,lifeMax:1,endType:'explodePts'},f=h.extend(f,{updateOptions:function(b){b=this.options=a.deepMerge(this.options||f.options,b),typeof b.lifeSpeed==='function'&&(b.lifeSpeed=b.lifeSpeed()),typeof b.delay==='function'&&(b.delay=b.delay());var c=b.type;this._getPt=(o[c]||o.flying).bind(this)},setLine:function(a,b){this.lineMerge=a,this.lineIndex=b},addTo:function(a){this._map=a;var c=this.three3D=a.three3D,b=this.projection=a.projection;this.setNormal(b)},checkStatus:function(){if(this.status==='end')return;var b=this.life,a=this.options,c=a.flying.range,d=a.delayEnd;return b<a.lifeMin?this.status='pre-living':b<=a.lifeMax?this.status='living':(b<=a.lifeMax+c?this.status='lifeend-start':this.status='lifeend-done',b>a.lifeMax+d?this.end():this.status)},setNormal:function(a){var b=a.type;if(b==='mecator'||b==='plane'||b==='origin'){var c=this._center=new k.Vector3(a.x0,a.y0,a.z0);this._getNormal=function(){return new k.Vector3(0,1,0)}}else if(b==='sphere'){var c=this._center=new k.Vector3(a.x0,a.y0,a.z0);this._getNormal=function(d){var a=d||this.ptFrom,b=this.ptTo;return a&&b?a.clone().lerp(b,.5).sub(c).normalize():void 0}}},data:function(b){if(!b)return;this._data=b;var d=c(b.to),a=c(b.from),e=b.cubeCenter,f=!a||!d||(!a.lat||!d.lat)&&(a.x===null||a.x===undefined),i=!e;if(i&&f)return this.end();if(!f){var g=this.ptFrom=this.projection.project(a),h=this.ptTo=this.projection.project(d);if(this.distance=g.distanceTo(h),!(g&&h))return this.end()}e&&(this.cubeCenter=e),this.reset(),this.emit('start')}}),f.prototype._getPt=function(a){},f.prototype.update=function(){if(!(this.lineMerge&&this._map))return;var b=this.options;this.life+=b.lifeSpeed;var c=b.endType,a=this.checkStatus();a==='pre-living'||a==='living'?this.updateLine():a==='lifeend-start'&&(b.isUpdateWhenEndStart&&this.updateLine(),this.pStatus==='living'&&this.emit('flying-end',{data:this._data,lineIndex:this.lineIndex})),this.pStatus=a},f.prototype.equalTo=function(a){return this.lineIndex===a.lineIndex},f.prototype.end=function(){this.status='end',this.emit('end');var b=this.options,c=b.ptN,d=this.lineMerge,e=this.lineIndex;for(var a=0;a<c;a++)d.setPt(e,a,0,0,0)};var p=0;f.prototype.resetLine=function(){var c=this.lineMerge,f=this.lineIndex,j=this._data;if(!c)return;var b=this.options.flying.style,h=b.color.bind(b),a=this.options.ptN;for(var d=0;d<a;d++)c.setPt(f,d,0,0,0);a=(a-1)*2;var g=[];for(var e=0;e<a;e++){var i=h(j,e/(a-1));g.push(i)}c.setColorArray(f,g,b.opacity)},f.prototype.updateLine=function(){var h=this.options,k=h.flying,b=k.range,g=h.ptN,i=this.lineMerge,j=this.lineIndex,a=this.life,e,f;for(var c=0;c<g;c++){var d=c/g;if(b>a)e=(1-d)*a;else if(a<1)e=a-d*b;else if(a>1&&a<1+b)e=1-(b-a+1)*d;else return;f=this._getPt(e),i.setPt(j,c,f.x,f.y,f.z)}},f.prototype.reset=function(){var a=this.options;this.status='ready',this.life=a.lifeMin-a.delay,this.targetList=null,this.kHeightJitter=a.flying.kHeight*a.flying.kHeightJitter*Math.random(),this.resetLine()},module.exports=f | ||
'use strict';function b(a){return a===undefined||a===null}function h(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}function c(a,b,c,d){return a+(b-a)*c}function d(d,e,a,b){b=b||1;var c=a*a;return a=3*c-2*c*a,a=Math.pow(a,b),d+(e-d)*a}function e(a){this.updateOptions(a);var b=this.id='flyingline_'+Math.floor(Math.random()*1e9);this.reset()}var f=require('./../core/utils'),g=require('bcore/event'),a=f.mercator,i=f.sphere,j=require('three'),k=f.requestAnimationFrame,l=f.cancelAnimationFrame,m=require('./cube_utils'),n={cube:m(),smooth:function(e){var g=this.options,a=this.ptFrom,b=this.ptTo,f=g.flying.indensty,h=d(a.x,b.x,e,f),i=c(a.y,b.y,e),k=d(a.z,b.z,e,f);return new j.Vector3(h,i,k)},flying:function(a){var b=this.options,c=b.flying,d=c.kHeight+(this.kHeightJitter||0),e=this.ptFrom,f=this.ptTo,g=this._getNormal(),h=(1-a)*a*d*this.distance,i=e.clone().lerp(f,a).add(g.multiplyScalar(h));return i}};e.options={ptN:10,range:.8,isUpdateWhenEndStart:!0,flying:{kHeight:2,kHeightJitter:.2,weight:2,style:{hue:.5,opacity:.2,color:function(a){var b=.5;return new j.Color().setHSL(b,1-a*.3,.3+Math.pow(a,8)*.6)}}},type:'flying',lifeSpeed:.002,delay:0,delayEnd:1,lifeMin:0,lifeMax:1,endType:'explodePts'},e=g.extend(e,{updateOptions:function(a){a=this.options=f.deepMerge(this.options||e.options,a),typeof a.lifeSpeed==='function'&&(a.lifeSpeed=a.lifeSpeed()),typeof a.delay==='function'&&(a.delay=a.delay());var b=a.type;this._getPt=(n[b]||n.flying).bind(this)},setLine:function(a,b){this.lineMerge=a,this.lineIndex=b},addTo:function(a){this._map=a;var c=this.three3D=a.three3D,b=this.projection=a.projection;this.setNormal(b)},checkStatus:function(){if(this.status==='end')return;var b=this.life,a=this.options,c=a.flying.range,d=a.delayEnd;return b<a.lifeMin?this.status='pre-living':b<=a.lifeMax?this.status='living':(b<=a.lifeMax+c?this.status='lifeend-start':this.status='lifeend-done',b>a.lifeMax+d?this.end():this.status)},setNormal:function(a){var b=a.type;if(b==='mecator'||b==='plane'||b==='origin'){var c=this._center=new j.Vector3(a.x0,a.y0,a.z0);this._getNormal=function(){return new j.Vector3(0,1,0)}}else if(b==='sphere'){var c=this._center=new j.Vector3(a.x0,a.y0,a.z0);this._getNormal=function(d){var a=d||this.ptFrom,b=this.ptTo;return a&&b?a.clone().lerp(b,.5).sub(c).normalize():void 0}}},data:function(b){if(!b)return;this._data=b;var c=h(b.to),a=h(b.from),d=b.cubeCenter,e=!a||!c||(!a.lat||!c.lat)&&(a.x===null||a.x===undefined),i=!d;if(i&&e)return this.end();if(!e){var f=this.ptFrom=this.projection.project(a),g=this.ptTo=this.projection.project(c);if(this.distance=f.distanceTo(g),!(f&&g))return this.end()}d&&(this.cubeCenter=d),this.reset(),this.emit('start')}}),e.prototype._getPt=function(a){},e.prototype.update=function(){if(!(this.lineMerge&&this._map))return;var b=this.options;this.life+=b.lifeSpeed;var c=b.endType,a=this.checkStatus();a==='pre-living'||a==='living'?this.updateLine():a==='lifeend-start'&&(b.isUpdateWhenEndStart&&this.updateLine(),this.pStatus==='living'&&this.emit('flying-end',{data:this._data,lineIndex:this.lineIndex})),this.pStatus=a},e.prototype.equalTo=function(a){return this.lineIndex===a.lineIndex},e.prototype.end=function(){this.status='end',this.emit('end');var b=this.options,c=b.ptN,d=this.lineMerge,e=this.lineIndex;for(var a=0;a<c;a++)d.setPt(e,a,0,0,0)};var o=0;e.prototype.resetLine=function(){var c=this.lineMerge,f=this.lineIndex,j=this._data;if(!c)return;var b=this.options.flying.style,h=b.color.bind(b),a=this.options.ptN;for(var d=0;d<a;d++)c.setPt(f,d,0,0,0);a=(a-1)*2;var g=[];for(var e=0;e<a;e++){var i=h(j,e/(a-1));g.push(i)}c.setColorArray(f,g,b.opacity)},e.prototype.updateLine=function(){var h=this.options,k=h.flying,b=k.range,g=h.ptN,i=this.lineMerge,j=this.lineIndex,a=this.life,e,f;for(var c=0;c<g;c++){var d=c/g;if(b>a)e=(1-d)*a;else if(a<1)e=a-d*b;else if(a>1&&a<1+b)e=1-(b-a+1)*d;else return;f=this._getPt(e),i.setPt(j,c,f.x,f.y,f.z)}},e.prototype.reset=function(){var a=this.options;this.status='ready',this.life=a.lifeMin-a.delay,this.targetList=null,this.kHeightJitter=a.flying.kHeight*a.flying.kHeightJitter*Math.random(),this.resetLine()},module.exports=e |
@@ -1,1 +0,1 @@ | ||
'use strict';function a(c){this.options=b.deepMerge(a.options,c)}var b=require('./../core/utils'),c=require('three'),d=b.requestAnimationFrame,e=b.cancelAnimationFrame,f=require('./../render/line_merge'),g=require('./../layer/flying_line'),h=b.getColorFunc,i=require('bcore/event');a.options={lineN:1e3,ptN:30,maxOpacity:1,weight:2,blending:c.AdditiveBlending,flying:{range:.2,kHeight:2,kHeightJitter:.2,style:{hue:.5,color:function(a){var b=this.hue;return a=1-a,new c.Color().setHSL(b,1-a*.3,.3+Math.pow(a,8)*.6)}}}},a=i.extend(a,{addTo:function(a){this._map=a;var b=this.three3D=a.three3D;this.initLines(),this.loop()}}),a.prototype.initLines=function(){var h=this._map,a=this.options,d=a.lineN,i=a.ptN,e=this.lineMerge=new f({lineN:d,ptN:i,weight:a.weight,maxOpacity:a.maxOpacity,material:{blending:a.blending}});e.addTo(h);var m=this.using=[],j=this.unusing=[],k=this.all=[],b,l=a;for(var c=0;c<d;c++)b=new g(l,!0),b.addTo(h),b.setLine(e,c),this.initEventLine(b),j.push(b),k.push(b)},a.prototype.data=function(d){var b,c,a=this.unusing,e=this.using;if(!(a&&a.length))return;for(var f in d)b=d[f],a.length&&b&&(c=a.pop(),c.data(b),e.push(c))},a.prototype.checkIfEnd=function(){var b=this.using,d=this.unusing,c;for(var a=b.length-1;a>=0;a--)c=b[a],c.life>=c.options.lifeMax&&(b.splice(a,1),d.push(c))},a.prototype.render=function(a){a&&this.data(a)},a.prototype.clean=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.all;for(var d in c)a[d]=c[d];this.unusing=a},a.prototype.updateOptions=function(a){a&&(a=this.options=b.deepMerge(this.options,a)),a=this.options;var c,d=this.using;for(var f in d)c=d[f],c.updateOptions(a);var e=this.unusing;for(var g in e)c=e[g],c.updateOptions(a);var h=this.lineMerge;h.updateOptions({weight:a.weight,maxOpacity:a.maxOpacity})},a.prototype.loop=function(){this.checkIfEnd(),this.update(),window.requestAnimationFrame(this.loop.bind(this))},a.prototype.update=function(){var a=this.using;if(!(a&&a.length))return;var b;for(var c in a)b=a[c],b.update();this.lineMerge.update()},a.prototype.updateSprite=function(){},a.prototype.initEventLine=function(b){var c=this.unusing,d=this.using,a=this;b.on('flying-end',function(b){a.emit('flying-end',b)})},module.exports=a | ||
'use strict';function a(c){this.options=b.deepMerge(a.options,c)}var b=require('./../core/utils'),c=require('three'),d=b.requestAnimationFrame,e=b.cancelAnimationFrame,f=require('./../render/line_merge'),g=require('./../layer/flying_line'),h=b.getColorFunc,i=require('bcore/event');a.options={lineN:1e3,ptN:30,maxOpacity:1,weight:2,blending:c.AdditiveBlending,flying:{range:.2,kHeight:2,kHeightJitter:.2,style:{hue:.5,color:function(a){var b=this.hue;return a=1-a,new c.Color().setHSL(b,1-a*.3,.3+Math.pow(a,8)*.6)}}}},a=i.extend(a,{addTo:function(a){this._map=a;var b=this.three3D=a.three3D;this.initLines(),this.loop()}}),a.prototype.initLines=function(){var h=this._map,a=this.options,d=a.lineN,i=a.ptN,e=this.lineMerge=new f({lineN:d,ptN:i,weight:a.weight,maxOpacity:a.maxOpacity,material:{blending:a.blending}});e.addTo(h);var m=this.using=[],j=this.unusing=[],k=this.all=[],b,l=a;for(var c=0;c<d;c++)b=new g(l,!0),b.addTo(h),b.setLine(e,c),this.initEventLine(b),j.push(b),k.push(b)},a.prototype.data=function(d){var b,c,a=this.unusing,e=this.using;if(!(a&&a.length))return;for(var f in d)b=d[f],a.length&&b&&(c=a.pop(),c.data(b),e.push(c))},a.prototype.checkIfEnd=function(){var c=this.using,d=this.unusing,a;for(var b=c.length-1;b>=0;b--)a=c[b],a.life>=a.options.lifeMax+a.options.range&&(c.splice(b,1),d.push(a))},a.prototype.render=function(a){a&&this.data(a)},a.prototype.clean=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.all;for(var d in c)a[d]=c[d];this.unusing=a},a.prototype.updateOptions=function(a){a&&(a=this.options=b.deepMerge(this.options,a)),a=this.options;var c,d=this.using;for(var f in d)c=d[f],c.updateOptions(a);var e=this.unusing;for(var g in e)c=e[g],c.updateOptions(a);var h=this.lineMerge;h.updateOptions({weight:a.weight,maxOpacity:a.maxOpacity})},a.prototype.loop=function(){this.checkIfEnd(),this.update(),window.requestAnimationFrame(this.loop.bind(this))},a.prototype.update=function(){var a=this.using;if(!(a&&a.length))return;var b;for(var c in a)b=a[c],b.update();this.lineMerge.update()},a.prototype.updateSprite=function(){},a.prototype.initEventLine=function(b){var c=this.unusing,d=this.using,a=this;b.on('flying-end',function(b){a.emit('flying-end',b)})},module.exports=a |
@@ -1,1 +0,1 @@ | ||
'use strict';function a(b){b=this.options=d.deepMerge(a.options,b),this.initialize(b)}var b=require('three'),c=require('bcore/event'),d=require('./../core/utils');a.options={globe:{intensity:2,maxOpacity:.8,ratio:.98,xN:40,yN:40,imgbase:'http://datavmap-public.oss-cn-hangzhou.aliyuncs.com/mapping/',material:{map:'1/earth.topo.bathy.200407.3x4096x2048.dark.jpg',specularMap:'1/earth_specularmap_flat_8192x4096.jpg',normalMap:'1/earth_normalmap_flat_8192x4096.jpg',bumpMap:'1/earth_bumpmap_flat_8192x4096aa.jpg',specular:'#0a121b',color:'#1a234d',emissive:'#203864',transparent:!0,opacity:1,normalScale:{x:1.5,y:1.5},bumpScale:1,shininess:1.5,combine:b.AddOperation,wireframeLinecap:'round',shading:b.SmoothShading}},intensity:4,maxOpacity:1},a=c.extend(a,{initialize:function(a){},addTo:function(b){if(!b)return;this.three3D=b.three3D;var a=this.projection=b.projection;if(a.type==='plane'||a.type==='mecator'||a.type==='origin')return;this.initGeo()},initGeo:function(m){var a=this.options.globe,e=this.three3D,l=this._map,i=this.projection,d=(i.radius||1)*a.ratio,h=new b.SphereBufferGeometry(d,a.xN,a.yN);this.genMaterialGlobe(function(f){var d=this.materialGlobe=f,c=this.globeMesh=new b.Mesh(h,d);c.scale.set(a.ratio,a.ratio,a.ratio),e.add(c)}.bind(this));var g=this.options.atmosphere;if(!g)return;var j=new b.SphereBufferGeometry(d,a.xN,a.yN),k=this.materialAtmosphere=this.genMaterialAtmosphere(),f=this.meshAtomesphere=new b.Mesh(j,k),c=g.ratio;f.scale.set(c,c,c),e.add(f)}}),a.prototype.genMaterialGlobe=function(h){function f(){if(d>=4){var c=new b.MeshPhongMaterial(a);h(c)}}var g=this.options,a=g.globe.material;if(typeof a==='function'){var i=a();return h(i)}a=JSON.parse(JSON.stringify(a));var c=new b.TextureLoader;c.setCrossOrigin('*'),c.crossOrigin='*';var d=0,e=g.globe.imgbase;c.load(e+a.map,function(b){a.map=b,d++,f()}),c.load(e+a.specularMap,function(b){a.specularMap=b,d++,f()}),c.load(e+a.normalMap,function(b){a.normalMap=b,d++,f()}),c.load(e+a.bumpMap,function(b){a.bumpMap=b,d++,f()})},a.prototype.genMaterialAtmosphere=function(){var a=this.options.atmosphere,c=a.maxOpacity,d=a.intensity,e='varying vec3 vNormal;void main() {vNormal = normalize( normalMatrix * normal );gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );}',f=this.genFragAtmosphere();return new b.ShaderMaterial({uniforms:{intensity:{type:'f',value:d},maxOpacity:{type:'f',value:c}},vertexShader:e,fragmentShader:f,side:b.BackSide,transparent:!1})},a.prototype.genFragAtmosphere=function(){var a=this.options.atmosphere.color;return a=new b.Color(a),'varying vec3 vNormal;uniform float intensity;uniform float maxOpacity;void main() {float k = pow( 0.51 - dot( vNormal, vec3(0, 0, 1.0 )), intensity );gl_FragColor = vec4( '+a.r+', '+a.g+', '+a.b+', maxOpacity ) * k;'+'}'},a.prototype.updateShader=function(){var d=this.options,c=d.globe.material,a=this.materialGlobe;a.normalScale=c.normalScale,a.color=new b.Color(c.color),a.specular=new b.Color(c.specular),a.emissive=new b.Color(c.emissive),a.needsUpdate=!0},a.prototype.updateOptions=function(b){b=this.options=d.deepMerge(this.options,b);var a=b.globe.ratio;this.globeMesh&&this.globeMesh.scale.set(a,a,a),this.updateShader(),this.updateAtmosphere()},a.prototype.updateAtmosphere=function(){var b=this.options.atmosphere;if(!b)return;var c=this.meshAtomesphere,a=b.ratio;c.scale.set(a,a,a),this.materialAtmosphere.fragmentShader=this.genFragAtmosphere(),this.materialAtmosphere.needsUpdate=!0},module.exports=a | ||
'use strict';function a(b){b=this.options=d.deepMerge(a.options,b),this.initialize(b)}var b=require('three'),c=require('bcore/event'),d=require('./../core/utils');a.options={globe:{intensity:2,maxOpacity:.8,ratio:.98,xN:40,yN:40,imgbase:'http://datavmap-public.oss-cn-hangzhou.aliyuncs.com/mapping/',material:{map:'1/earth.topo.bathy.200407.3x4096x2048.dark.jpg',specularMap:'1/earth_specularmap_flat_8192x4096.jpg',normalMap:'1/earth_normalmap_flat_8192x4096.jpg',bumpMap:'1/earth_bumpmap_flat_8192x4096aa.jpg',specular:'#0a121b',color:'#1a234d',emissive:'#203864',transparent:!0,opacity:1,normalScale:{x:1.5,y:1.5},bumpScale:1,shininess:1.5,combine:b.AddOperation,wireframeLinecap:'round',shading:b.SmoothShading}},intensity:4,maxOpacity:1},a=c.extend(a,{initialize:function(a){},addTo:function(b){if(!b)return;this.three3D=b.three3D;var a=this.projection=b.projection;if(a.type==='plane'||a.type==='mecator'||a.type==='origin')return;this.initGeo()},initGeo:function(m){var a=this.options.globe,e=this.three3D,l=this._map,i=this.projection,d=(i.radius||1)*a.ratio,h=new b.SphereBufferGeometry(d,a.xN,a.yN);this.genMaterialGlobe(function(f){var d=this.materialGlobe=f,c=this.globeMesh=new b.Mesh(h,d);c.scale.set(a.ratio,a.ratio,a.ratio),e.add(c)}.bind(this));var g=this.options.atmosphere;if(!g)return;var j=new b.SphereBufferGeometry(d,a.xN,a.yN),k=this.materialAtmosphere=this.genMaterialAtmosphere(),f=this.meshAtomesphere=new b.Mesh(j,k),c=g.ratio;f.scale.set(c,c,c),e.add(f)}}),a.prototype.genMaterialGlobe=function(h){function f(){if(d>=4){var c=new b.MeshPhongMaterial(a);h(c)}}var g=this.options,a=g.globe.material;if(typeof a==='function'){var i=a();return h(i)}a=JSON.parse(JSON.stringify(a));var c=new b.TextureLoader;c.setCrossOrigin('*'),c.crossOrigin='*';var d=0,e=g.globe.imgbase;c.load(e+a.map,function(b){a.map=b,d++,f()}),c.load(e+a.specularMap,function(b){a.specularMap=b,d++,f()}),c.load(e+a.normalMap,function(b){a.normalMap=b,d++,f()}),c.load(e+a.bumpMap,function(b){a.bumpMap=b,d++,f()})},a.prototype.show=function(){this.meshAtomesphere&&(this.meshAtomesphere.visible=!0),this.globeMesh&&(this.globeMesh.visible=!0)},a.prototype.hide=function(){this.meshAtomesphere&&(this.meshAtomesphere.visible=!1),this.globeMesh&&(this.globeMesh.visible=!1)},a.prototype.genMaterialAtmosphere=function(){var a=this.options.atmosphere,c=a.maxOpacity,d=a.intensity,e='varying vec3 vNormal;void main() {vNormal = normalize( normalMatrix * normal );gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );}',f=this.genFragAtmosphere();return new b.ShaderMaterial({uniforms:{intensity:{type:'f',value:d},maxOpacity:{type:'f',value:c}},vertexShader:e,fragmentShader:f,side:b.BackSide,transparent:!1})},a.prototype.genFragAtmosphere=function(){var a=this.options.atmosphere.color;a=new b.Color(a);var c=this.options.atmosphere.intensity;return'varying vec3 vNormal;uniform float intensity;uniform float maxOpacity;void main() {float k = pow( 0.51 - dot( vNormal, vec3(0, 0, 1.0 )), '+c.toFixed(1)+' );'+'gl_FragColor = vec4( '+a.r+', '+a.g+', '+a.b+', maxOpacity ) * k;'+'}'},a.prototype.updateShader=function(){var d=this.options,c=d.globe.material,a=this.materialGlobe;if(!a)return;a.normalScale=c.normalScale,a.color=new b.Color(c.color),a.specular=new b.Color(c.specular),a.emissive=new b.Color(c.emissive),a.needsUpdate=!0},a.prototype.updateOptions=function(b){b=this.options=d.deepMerge(this.options,b);var a=b.globe.ratio;this.globeMesh&&this.globeMesh.scale.set(a,a,a),this.updateShader(),this.updateAtmosphere()},a.prototype.updateAtmosphere=function(){var b=this.options.atmosphere;if(!b)return;var c=this.meshAtomesphere,a=b.ratio;c.scale.set(a,a,a),this.materialAtmosphere.fragmentShader=this.genFragAtmosphere(),this.materialAtmosphere.needsUpdate=!0},module.exports=a |
@@ -1,1 +0,1 @@ | ||
function a(b){this.options=c.deepMerge(a.options,b)}var b=require('three'),c=require('./../core/utils');a.options={ratio:100,matType:'nasa1'},a.prototype.addTo=function(a){this._map=a,this.radius=a.projection.radius*this.options.ratio,this.three3D=a.three3D,this.init()},a.prototype.init=function(){var a=this.options,c=this.three3D,d=a.matType,e=this.geo=new b.SphereGeometry(this.radius,60,60),f=this.material=this.genMaterial(d),g=this.mesh=new b.Mesh(e,f);c.add(g)},a.prototype.genMaterial=function(d){var a={side:b.BackSide};return d==='nasa1'?a=c.extend(a,{map:b.ImageUtils.loadTexture('./../mapping/sky/sky.jpg')}):a=c.extend(a,{color:d}),new b.MeshBasicMaterial(a)},a.prototype.updateOptions=function(){options=this.options;var a=new b.Color(options.matType);this.material.color.setRGB(a.r,a.g,a.b)},module.exports=a | ||
function a(b){this.options=c.deepMerge(a.options,b)}var b=require('three'),c=require('./../core/utils');a.options={ratio:10,matType:null,color:'#222',imgUrl:null},a.prototype.addTo=function(a){this._map=a,this.radius=a.projection.radius*this.options.ratio,this.three3D=a.three3D,this.init()},a.prototype.init=function(){var d=this.options,a=this.three3D,c=this.geo=new b.SphereGeometry(this.radius,60,60);this.genMaterial(function(d){this.material=d;var e=this.mesh=new b.Mesh(c,d);a.add(e)}.bind(this))},a.prototype.show=function(){this.mesh&&(this.mesh.visible=!0)},a.prototype.hide=function(){this.mesh&&(this.mesh.visible=!1)},a.prototype.genMaterial=function(f){var a=this.options,g=a.matType,h=a.color,c=a.imgUrl;g==='nasa1'&&(c='./../mapping/sky/sky.jpg');var d={color:h,side:b.BackSide};if(c){var e=new b.TextureLoader;e.setCrossOrigin('*'),e.crossOrigin='*',e.load(c,function(a){d.map=a,f(new b.MeshBasicMaterial(d))})}else f(new b.MeshBasicMaterial(d))},a.prototype.updateOptions=function(){options=this.options;var a=new b.Color(options.matType);this.material.color.setRGB(a.r,a.g,a.b)},module.exports=a |
@@ -1,1 +0,1 @@ | ||
function a(b){var a;Array.isArray(b)?a=[]:a={};for(var c in b)a[c]=b[c];return a}function b(b,c,d){for(var a in b)b[a]=(c[a]-b[a])*d+b[a]}function c(a,b){this.options=f.deepMerge(c.options,b),this.containner=f.getContainer(a),this.detect()}var d=require('three'),e=Math.PI,f=require('./../core/utils'),g=require('bcore/event'),h=f.getPt,i=f.requestAnimationFrame,j=f.cancelAnimationFrame;c.options={isDetect:!0,interactive:{mouseX:{type:'rotatex',phi:.005},mouseY:{type:'rotatey',phi:.005},scroll:{type:'distance',phi:.005,speed:.01}},distance:{value:100,target:1e3,speed:.3,max:2e8,min:1,limit:.01},center:{limit:.01,speed:2,value:{x:0,y:0,z:0},target:{x:0,y:0,z:0}},rotation:{limit:1e-4,speed:.1,value:{x:0,y:0},target:{x:9.801592653589791,y:.31579632679489666},autoRotateSpeed:0},lookAt:{limit:.01,speed:.6,speedMouseUp:.1,speedMouseDown:.6,value:{x:-500,y:400,z:0},target:{x:0,y:0,z:0}}},c=g.extend(c,{linkTo:function(a){this.camera=a,this.initialize(this.options)},initPlane:function(){this.plane=new d.Plane(new d.Vector3(0,1,0),0)},updateOptions:function(a){a&&(this.options=f.deepMerge(this.options,a))},initialize:function(a){this.initPlane(),this.initVariables(),this.initEvents(),this.loop()},initVariables:function(){var b=this.options;this.mouse={x:0,y:0},this.mouseOnDown=a(this.mouse),this.rotationTargetOnDown=a(b.rotation.target),this.lookAtTargetOnDown=a(b.lookAt.target),this.overRenderer=!1,this.changeBol=this.changingBol=this.changeBolOld=!1},initEvents:function(){var b=this,a=this.containner;a.addEventListener('mousewheel',this.mouseWheel.bind(this)),a.addEventListener('mousedown',this.mouseDown.bind(this)),a.addEventListener('touchstart',this.mouseDown.bind(this)),a.addEventListener('mousemove',this.mouseMove.bind(this)),a.addEventListener('touchmove',this.mouseMove.bind(this)),a.addEventListener('touchleave',this.mouseUp.bind(this)),a.addEventListener('touchup',this.mouseUp.bind(this)),a.addEventListener('mouseup',this.mouseUp.bind(this)),a.addEventListener('mouseover',function(){b.overRenderer=!0}),a.addEventListener('mouseout',function(){b.overRenderer=!1}),a.addEventListener('touchup',function(){b.overRenderer=!1})},loop:function(){this.update(),i(this.loop.bind(this))},update:function(){var g=this.options,s=this.containner,n=g.interactive,r=n.scroll,f=g.rotation,c=f.value,i=f.target;f.autoRotateSpeed&&!this.isMouseDown&&(i.x+=f.autoRotateSpeed),Math.abs(i.x-c.x)+Math.abs(i.y-c.y)>f.limit&&(b(c,i,f.speed),this.emit('rotate',this));var a=g.distance;Math.abs(a.target-a.value)>a.limit&&(a.value+=(a.target-a.value)*a.speed,this.emit('zoom',this));var m=g.center,k=m.value,l=m.target;Math.abs(l.x-k.x)+Math.abs(l.y-k.y)>k.limit&&(b(k,l,l.speed),this.emit('move',this));var j=g.lookAt,d=j.value,h=j.target;Math.abs(h.x-d.x)+Math.abs(h.y-d.y)+Math.abs(h.z-d.z)>j.limit&&b(d,h,j.speed);var o=a.value*Math.sin(c.x)*Math.cos(c.y)+d.x,p=a.value*Math.sin(c.y)+d.y,q=a.value*Math.cos(c.x)*Math.cos(c.y)+d.z,e=this.camera;e.near/a.value>1e-4&&(e.far=Math.max(a.value*1e4,1),e.near=a.value/1e3,e.updateProjectionMatrix()),e.position.set(o,p,q),e.lookAt(d)},resetCamera:function(){},mouseDown:function(c){this.isMouseDown=!0,this.options.lookAt.target=a(this.options.lookAt.value),this.options.lookAt.speed=this.options.lookAt.speedMouseDown;var b=h(c);this.mouseOnDown.x=b[0],this.mouseOnDown.y=b[1];var d=b[2];this.rotationTargetOnDown=a(this.options.rotation.target),this.lookAtTargetOnDown=a(this.options.lookAt.target),this.cameraClone=this.camera.clone(),this.downPoint=this.unproject(this.mouseOnDown.x,this.mouseOnDown.y);var e=this.options.interactive;c.preventDefault()}}),c.prototype.mouseMove=function(r){if(!this.isMouseDown)return;r.preventDefault();var c=this.options,w=this.camera,l=h(r),b=this.mouse,v=this.mouseOnDown;b.x=l[0],b.y=l[1];var u=c.distance.value/1e3,a=c.rotation.target,j=this.rotationTargetOnDown,t=c.rotation.value,k=this.options.interactive,g=k.mouseX,i=k.mouseY,m=c.lookAt.target,n=this.lookAtTargetOnDown,s=this.mouse.x-this.mouseOnDown.x,q=this.mouse.y-this.mouseOnDown.y;g.type==='rotatex'&&(a.x=j.x-s*g.phi),i.type==='rotatey'&&(a.y=j.y+q*i.phi,a.y=a.y>e/2?e/2:a.y,a.y=a.y<-e/2?-e/2:a.y);var f=this.downPoint,d=this.unproject(b.x,b.y);if(!(d&&f))return;var p=d.z-f.z,o=d.x-f.x;g.type==='panx'&&(m.x=n.x-o),i.type==='pany'&&(m.z=n.z-p)},c.prototype.mouseUp=function(b){b.preventDefault();var a=this.options;this.isMouseDown=!1;var c=this.containner;if(this.options.lookAt.speed=this.options.lookAt.speedMouseUp,!this.options.isDetect)return;console.log('\n'+JSON.stringify({center:a.lookAt.target,distance:a.distance.target,rotation:a.rotation.target}).replace(/\"/g,'\''))},c.prototype.detect=function(){var a=this.options.interactive;window.addEventListener('keydown',function(b){a.mouseX.type==='panx'?(a.mouseX.type='rotatex',a.mouseY.type='rotatey'):(a.mouseX.type='panx',a.mouseY.type='pany')})},c.prototype.unproject=function(h,i){var e=this.containner.offsetWidth,f=this.containner.offsetHeight,g=this.cameraClone,c=new d.Vector3;c.set(h/e*2-1,-(i/f)*2+1,.5);var a=new d.Raycaster;a.setFromCamera(c.clone(),g);var j=a.ray.direction,k=a.ray.origin,b=a.ray.intersectPlane(this.plane);return b?new d.Vector3(b.x,0,b.z):void 0},c.prototype.mouseWheel=function(b){if(b.preventDefault(),this.overRenderer){var a=1+b.wheelDeltaY*this.options.interactive.scroll.speed;a=Math.max(Math.min(a,1.5),0),this.zoom(a)}return!1},c.prototype.flyingTo=function(v,w,u,k){w=w||.75,u=u||0,k=k||0;var b,c;for(var r in v){var t=v[r],m=t.geometry;m.computeBoundingBox();var a=m.boundingBox;r===0&&(b=a.max.clone(),c=a.min.clone()),b.x<a.max.x&&(b.x=a.max.x),b.y<a.max.y&&(b.y=a.max.y),b.z<a.max.z&&(b.z=a.max.z),c.x>a.min.x&&(c.x=a.min.x),c.y>a.min.y&&(c.y=a.min.y),c.z>a.min.z&&(c.z=a.min.z)}var s=this.containner,A=s.width(),F=s.height(),f=b.x,g=b.y,p=b.z,j=c.x,i=c.y,l=c.z,q=Math.abs(f-j),h=Math.abs(g-i),o=(f+j)/2,n=(g+i)/2,x=(p+l)/2,B=f-j,C=g-i,D=p-l,E=new d.Vector3(n,x,o);h&&q/h>self.w/self.h&&(q=h*self.w/self.h);var y=this.getCamera(),z=y.fov/360*e;this.lookAtTarget.x=-n+k,this.lookAtTarget.z=-o+k,this.lookAtTarget.y=0,this.rotation.x=e,this.rotation.y=e/2},c.prototype.flying=function(a){var b=this.options;b.distance.target=a.distance,b.lookAt.target=a.lookAt,b.rotation.target=a.rotation,a.autoRotateSpeed&&(b.rotation.autoRotateSpeed=a.autoRotateSpeed)},c.prototype.flyingDirect=function(b){var a=this.options;a.distance.target=b.distance,a.lookAt.target=b.lookAt,a.rotation.target=b.rotation,a.distance.value=b.distance,a.lookAt.value=b.lookAt,a.rotation.value=b.rotation},c.prototype.zoom=function(b){var a=this.options.distance;a.target=Math.max(Math.min(a.target*b,a.max),a.min)},module.exports=c | ||
function a(b){var a;Array.isArray(b)?a=[]:a={};for(var c in b)a[c]=b[c];return a}function b(b,c,d){for(var a in b)b[a]=(c[a]-b[a])*d+b[a]}function c(a,b){this.options=f.deepMerge(c.options,b),this.containner=f.getContainer(a),this.detect()}var d=require('three'),e=Math.PI,f=require('./../core/utils'),g=require('bcore/event'),h=f.getPt,i=f.requestAnimationFrame,j=f.cancelAnimationFrame;c.options={isDetect:!0,interactive:{mouseX:{type:'rotatex',phi:.005},mouseY:{type:'rotatey',phi:.005},scroll:{type:'distance',phi:.005,speed:.01}},distance:{value:100,target:1e3,speed:.003,max:2e8,min:1,limit:.01},center:{limit:.01,speed:2,value:{x:0,y:0,z:0},target:{x:0,y:0,z:0}},rotation:{limit:1e-4,speed:.1,value:{x:0,y:0},target:{x:9.801592653589791,y:.31579632679489666},autoRotateSpeed:0},lookAt:{limit:.01,speed:.6,speedMouseUp:.1,speedMouseDown:.6,value:{x:-500,y:400,z:0},target:{x:0,y:0,z:0}}},c=g.extend(c,{linkTo:function(a){this.camera=a,this.initialize(this.options)},initPlane:function(){this.plane=new d.Plane(new d.Vector3(0,1,0),0)},updateOptions:function(a){a&&(this.options=f.deepMerge(this.options,a))},initialize:function(a){this.initPlane(),this.initVariables(),this.initEvents(),this.loop()},initVariables:function(){var b=this.options;this.mouse={x:0,y:0},this.mouseOnDown=a(this.mouse),this.rotationTargetOnDown=a(b.rotation.target),this.lookAtTargetOnDown=a(b.lookAt.target),this.overRenderer=!1,this.changeBol=this.changingBol=this.changeBolOld=!1},initEvents:function(){var b=this,a=this.containner;a.addEventListener('mousewheel',this.mouseWheel.bind(this)),a.addEventListener('mousedown',this.mouseDown.bind(this)),a.addEventListener('touchstart',this.mouseDown.bind(this)),a.addEventListener('mousemove',this.mouseMove.bind(this)),a.addEventListener('touchmove',this.mouseMove.bind(this)),a.addEventListener('touchleave',this.mouseUp.bind(this)),a.addEventListener('touchup',this.mouseUp.bind(this)),a.addEventListener('mouseup',this.mouseUp.bind(this)),a.addEventListener('mouseover',function(){b.overRenderer=!0}),a.addEventListener('mouseout',function(){b.overRenderer=!1}),a.addEventListener('touchup',function(){b.overRenderer=!1})},loop:function(){this.update(),i(this.loop.bind(this))},update:function(){var g=this.options,s=this.containner,n=g.interactive,r=n.scroll,f=g.rotation,c=f.value,i=f.target;f.autoRotateSpeed&&!this.isMouseDown&&(i.x+=f.autoRotateSpeed),Math.abs(i.x-c.x)+Math.abs(i.y-c.y)>f.limit&&(b(c,i,f.speed),this.emit('rotate',this));var a=g.distance;Math.abs(a.target-a.value)>a.limit&&(a.value+=(a.target-a.value)*a.speed,this.emit('zoom',this));var m=g.center,k=m.value,l=m.target;Math.abs(l.x-k.x)+Math.abs(l.y-k.y)>k.limit&&(b(k,l,l.speed),this.emit('move',this));var j=g.lookAt,d=j.value,h=j.target;Math.abs(h.x-d.x)+Math.abs(h.y-d.y)+Math.abs(h.z-d.z)>j.limit&&b(d,h,j.speed);var o=a.value*Math.sin(c.x)*Math.cos(c.y)+d.x,p=a.value*Math.sin(c.y)+d.y,q=a.value*Math.cos(c.x)*Math.cos(c.y)+d.z,e=this.camera;e.near/a.value>1e-4&&(e.far=Math.max(a.value*1e4,1),e.near=a.value/1e3,e.updateProjectionMatrix()),e.position.set(o,p,q),e.lookAt(d)},resetCamera:function(){},mouseDown:function(c){this.isMouseDown=!0,this.options.lookAt.target=a(this.options.lookAt.value),this.options.lookAt.speed=this.options.lookAt.speedMouseDown;var b=h(c);this.mouseOnDown.x=b[0],this.mouseOnDown.y=b[1];var d=b[2];this.rotationTargetOnDown=a(this.options.rotation.target),this.lookAtTargetOnDown=a(this.options.lookAt.target),this.cameraClone=this.camera.clone(),this.downPoint=this.unproject(this.mouseOnDown.x,this.mouseOnDown.y);var e=this.options.interactive;c.preventDefault()}}),c.prototype.mouseMove=function(r){if(!this.isMouseDown)return;r.preventDefault();var c=this.options,w=this.camera,l=h(r),b=this.mouse,v=this.mouseOnDown;b.x=l[0],b.y=l[1];var u=c.distance.value/1e3,a=c.rotation.target,j=this.rotationTargetOnDown,t=c.rotation.value,k=this.options.interactive,g=k.mouseX,i=k.mouseY,m=c.lookAt.target,n=this.lookAtTargetOnDown,s=this.mouse.x-this.mouseOnDown.x,q=this.mouse.y-this.mouseOnDown.y;g.type==='rotatex'&&(a.x=j.x-s*g.phi),i.type==='rotatey'&&(a.y=j.y+q*i.phi,a.y=a.y>e/2?e/2:a.y,a.y=a.y<-e/2?-e/2:a.y);var f=this.downPoint,d=this.unproject(b.x,b.y);if(!(d&&f))return;var p=d.z-f.z,o=d.x-f.x;g.type==='panx'&&(m.x=n.x-o),i.type==='pany'&&(m.z=n.z-p)},c.prototype.mouseUp=function(b){b.preventDefault();var a=this.options;this.isMouseDown=!1;var c=this.containner;if(this.options.lookAt.speed=this.options.lookAt.speedMouseUp,!this.options.isDetect)return;console.log('\n'+JSON.stringify({center:a.lookAt.target,distance:a.distance.target,rotation:a.rotation.target}).replace(/\"/g,'\''))},c.prototype.detect=function(){var a=this.options.interactive;window.addEventListener('keydown',function(c){var b=navigator.appname=='Netscape'?event.which:window.event.keyCode;b===32?a.mouseX.type==='panx'?(a.mouseX.type='rotatex',a.mouseY.type='rotatey'):(a.mouseX.type='panx',a.mouseY.type='pany'):b===90?this.mouseWheel({wheelDeltaY:1}):b===67?this.mouseWheel({wheelDeltaY:-1}):b===38||b===40}.bind(this))},c.prototype.unproject=function(h,i){var e=this.containner.offsetWidth,f=this.containner.offsetHeight,g=this.cameraClone,c=new d.Vector3;c.set(h/e*2-1,-(i/f)*2+1,.5);var a=new d.Raycaster;a.setFromCamera(c.clone(),g);var j=a.ray.direction,k=a.ray.origin,b=a.ray.intersectPlane(this.plane);return b?new d.Vector3(b.x,0,b.z):void 0},c.prototype.mouseWheel=function(b){if(b.preventDefault&&b.preventDefault(),this.overRenderer){var a=1+b.wheelDeltaY*this.options.interactive.scroll.speed;a=Math.max(Math.min(a,1.5),0),this.zoom(a)}return!1},c.prototype.flyingTo=function(v,w,u,k){w=w||.75,u=u||0,k=k||0;var b,c;for(var r in v){var t=v[r],m=t.geometry;m.computeBoundingBox();var a=m.boundingBox;r===0&&(b=a.max.clone(),c=a.min.clone()),b.x<a.max.x&&(b.x=a.max.x),b.y<a.max.y&&(b.y=a.max.y),b.z<a.max.z&&(b.z=a.max.z),c.x>a.min.x&&(c.x=a.min.x),c.y>a.min.y&&(c.y=a.min.y),c.z>a.min.z&&(c.z=a.min.z)}var s=this.containner,A=s.width(),F=s.height(),f=b.x,g=b.y,p=b.z,j=c.x,i=c.y,l=c.z,q=Math.abs(f-j),h=Math.abs(g-i),o=(f+j)/2,n=(g+i)/2,x=(p+l)/2,B=f-j,C=g-i,D=p-l,E=new d.Vector3(n,x,o);h&&q/h>self.w/self.h&&(q=h*self.w/self.h);var y=this.getCamera(),z=y.fov/360*e;this.lookAtTarget.x=-n+k,this.lookAtTarget.z=-o+k,this.lookAtTarget.y=0,this.rotation.x=e,this.rotation.y=e/2},c.prototype.flying=function(a){var b=this.options;b.distance.target=a.distance,b.lookAt.target=a.lookAt,b.rotation.target=a.rotation,a.autoRotateSpeed&&(b.rotation.autoRotateSpeed=a.autoRotateSpeed)},c.prototype.flyingDirect=function(b){var a=this.options;a.distance.target=b.distance,a.lookAt.target=b.lookAt,a.rotation.target=b.rotation,a.distance.value=b.distance,a.lookAt.value=b.lookAt,a.rotation.value=b.rotation},c.prototype.zoom=function(b){var a=this.options.distance;a.target=Math.max(Math.min(a.target*b,a.max),a.min)},module.exports=c |
@@ -1,1 +0,1 @@ | ||
var b=require('three'),i=Math.PI,c=Math.cos,e=Math.sin,f=Math.asin,g=Math.atan,h=Math.exp,a,j,k,l,m,n,o,p=i/180;module.exports={project:function(d,g){if(g=g||1,d.lat===null||d.lat===undefined)return;if(d.lng===null||d.lng===undefined)return;if(!d)return;a=d.lat,j=d.lng,n=-j*p,o=a*p;var f=this.radius*g;k=f*c(n)*c(o)+this.x0,m=f*e(n)*c(o)+this.z0,l=f*e(o)+this.y0;var h=new b.Vector3(k,l,m);return h},unProject:function(d){var b=d.x-this.x0,e=d.y-this.y0,c=d.z-this.z0,f=Math.sqrt(b*b+c*c),h=g(e/f),i=c/b,k=g(i);return a=h/p,j=-k/p,b<0&&(j-=180),{lat:a,lng:j}},getNormal:function(a){var d=a.lat,f=a.lng;return a.lat===null||a.lat===undefined?void 0:a.lng===null||a.lng===undefined?void 0:a?(d=a.lat,f=a.lng,n=-f*i/180,o=d*i/180,k=c(n)*c(o),m=e(n)*c(o),l=e(o),new b.Vector3(k,l,m)):void 0},radius:6378137,x0:0,y0:0,z0:0,type:'sphere'} | ||
var b=require('three'),i=Math.PI,c=Math.cos,e=Math.sin,f=Math.asin,g=Math.atan,h=Math.exp,a,j,k,l,m,n,o,p=i/180;module.exports={project:function(d,g){if(g=g||1,d.lat===null||d.lat===undefined)return;if(d.lng===null||d.lng===undefined)return;if(!d)return;a=d.lat,j=d.lng,n=-j*p,o=a*p;var f=this.radius*g;k=f*c(n)*c(o)+this.x0,m=f*e(n)*c(o)+this.z0,l=f*e(o)+this.y0;var h=new b.Vector3(k,l,m);return h},unProject:function(d){var b=d.x-this.x0,e=d.y-this.y0,c=d.z-this.z0,f=Math.sqrt(b*b+c*c),h=g(e/f),i=c/b,k=g(i);return a=h/p,j=-k/p,b<0&&(j-=180),{lat:a,lng:j}},getNormal:function(d,f){if(f=f||1,d.lat===null||d.lat===undefined)return;if(d.lng===null||d.lng===undefined)return;if(!d)return;a=d.lat,j=d.lng,n=-j*p,o=a*p,k=c(n)*c(o)+this.x0,m=e(n)*c(o)+this.z0,l=e(o)+this.y0;var g=new b.Vector3(k,l,m).normalize();return g},radius:6378137,x0:0,y0:0,z0:0,type:'sphere'} |
@@ -5,3 +5,3 @@ { | ||
"description": "3d map visualization lib", | ||
"version": "0.1.30", | ||
"version": "0.1.31", | ||
"scripts": { | ||
@@ -25,2 +25,3 @@ "test": "mocha -r jscoverage test" | ||
"ngeohash": "~0.6.0", | ||
"normalize.css": "^4.2.0", | ||
"three": "^0.73.0", | ||
@@ -27,0 +28,0 @@ "tween.js": "*" |
@@ -1,2 +0,2 @@ | ||
# dmap | ||
# dmap | ||
高性能、通用的 webgl地图组件库 | ||
@@ -119,3 +119,3 @@ | ||
### map的配置: | ||
### map的配置: | ||
@@ -122,0 +122,0 @@ | 名称 | 类型 |说明 | |
@@ -1,1 +0,1 @@ | ||
'use strict';function a(b){b=this.options=c.deepMerge(a.options,b),this.initShader()}var b=require('three'),c=require('./../core/utils');a.options={shapeType:'circle',r:8e4,offset:1e5,color:'#0ff',indensity:.1,background:'#000',maxOpacity:1,blending:b.AdditiveBlending},a.prototype={initShader:function(){var a=this.options,e='varying vec2 vUv;void main(){vUv = uv;vec3 pos = position;vec4 mvPosition = modelViewMatrix * vec4( pos, 1.0 );gl_Position = projectionMatrix * mvPosition;}',f=a.background,g=a.color,c=new b.Color(g),h=new b.Vector4(c.r,c.g,c.b,1),d=new b.Color(f),i=new b.Vector4(d.r,d.g,d.b,1),j={color:{type:'v4',value:h},background:{type:'v4',value:i},rx:{type:'f',value:a.rx||a.r},ry:{type:'f',value:a.ry||a.r},dx:{type:'f',value:a.offset+(a.rx||a.r)*2},dy:{type:'f',value:a.offset+(a.ry||a.r)*2},indensity:{type:'f',value:a.indensity}};this.material=new b.ShaderMaterial({uniforms:j,vertexShader:e,fragmentShader:this.getFragmentShader(),blending:a.blending,depthTest:!0,depthWrite:!1,alphaTest:1,transparent:!0,shading:b.SmoothShading})},getFragmentShader:function(){var a=this.options.shapeType,b;a==='circle'?b='ratio = (disX * disX + disY * disY) / (rx * rx + ry * ry);':a==='rect'?b='ratio = max(disX / rx , disY / ry);':a==='diamond'&&(b='ratio = (disX + disY ) / (rx + ry );');var c='uniform vec4 color;uniform vec4 background;uniform float dx;uniform float dy;uniform float rx;uniform float ry;uniform float indensity;varying vec2 vUv;void main() {float relativeX = mod(vUv.x, dx);float relativeY = mod(vUv.y, dy);float disX = abs(relativeX - dx * 0.5);float disY = abs(relativeY - dy * 0.5);float ratio;'+b+'ratio = pow(ratio, indensity);'+'gl_FragColor = ratio * background + (1.0 - ratio) * color;'+'}';return c},updateUniforms:function(){var f=this.material,c=f.uniforms,a=this.options,g=a.background,h=a.color,d=new b.Color(h),i=new b.Vector4(d.r,d.g,d.b,1),e=new b.Color(g),j=new b.Vector4(e.r,e.g,e.b,1);c.color.value=i,c.background.value=j,c.rx.value=a.rx||a.r,c.ry.value=a.ry||a.r,c.indensity.value=a.indensity,c.dx.value=a.offset+(a.rx||a.r)*2,c.dy.value=a.offset+(a.ry||a.r)*2},updateShader:function(){this.material.fragmentShader=this.getFragmentShader(),this.material.needsUpdate=!0},update:function(){this.updateShader(),this.updateUniforms()},updateOptions:function(a){a=this.options=c.deepMerge(this.options,a),this.updateUniforms()},getMaterial:function(){return this.material}},module.exports=a | ||
'use strict';function a(b){b=this.options=c.deepMerge(a.options,b),this.initShader()}var b=require('three'),c=require('./../core/utils');a.options={shapeType:'circle',r:8e4,offset:1e5,color:'#0ff',indensity:.1,background:'#000',maxOpacity:1,blending:b.AdditiveBlending},a.prototype={initShader:function(){var a=this.options,e='varying vec2 vUv;void main(){vUv = uv;vec3 pos = position;vec4 mvPosition = modelViewMatrix * vec4( pos, 1.0 );gl_Position = projectionMatrix * mvPosition;}',f=a.background,g=a.color,c=new b.Color(g),h=new b.Vector4(c.r,c.g,c.b,1),d=new b.Color(f),i=new b.Vector4(d.r,d.g,d.b,1),j={color:{type:'v4',value:h},background:{type:'v4',value:i},rx:{type:'f',value:a.rx||a.r},ry:{type:'f',value:a.ry||a.r},dx:{type:'f',value:a.offset+(a.rx||a.r)*2},dy:{type:'f',value:a.offset+(a.ry||a.r)*2},indensity:{type:'f',value:a.indensity}};this.material=new b.ShaderMaterial({uniforms:j,vertexShader:e,fragmentShader:this.getFragmentShader(),blending:a.blending,depthTest:!0,depthWrite:!1,alphaTest:1,transparent:!0,shading:b.SmoothShading})},getFragmentShader:function(){var a=this.options.shapeType,b;a==='circle'?b='ratio = (disX * disX + disY * disY) / (rx * rx + ry * ry);':a==='rect'?b='ratio = max(disX / rx , disY / ry);':a==='diamond'&&(b='ratio = (disX + disY ) / (rx + ry );');var c='uniform vec4 color;uniform vec4 background;uniform float dx;uniform float dy;uniform float rx;uniform float ry;uniform float indensity;varying vec2 vUv;void main() {float relativeX = mod(vUv.x, dx);float relativeY = mod(vUv.y, dy);float disX = abs(relativeX - dx * 0.5);float disY = abs(relativeY - dy * 0.5);float ratio;'+b+'ratio = pow(ratio, indensity);'+'gl_FragColor = ratio * background + (1.0 - ratio) * color;'+'}';return c},updateUniforms:function(){var f=this.material,c=f.uniforms,a=this.options,g=a.background,h=a.color,d=new b.Color(h),i=new b.Vector4(d.r,d.g,d.b,1),e=new b.Color(g),j=new b.Vector4(e.r,e.g,e.b,1);c.color.value=i,c.background.value=j,c.rx.value=a.rx||a.r,c.ry.value=a.ry||a.r,c.indensity.value=a.indensity,c.dx.value=a.offset+(a.rx||a.r)*2,c.dy.value=a.offset+(a.ry||a.r)*2},updateShader:function(){this.material.fragmentShader=this.getFragmentShader(),this.material.needsUpdate=!0},update:function(){this.updateShader(),this.updateUniforms()},updateOptions:function(a){a=this.options=c.deepMerge(this.options,a),this.updateUniforms()},getMaterial:function(){return this.material}},module.exports=a |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
213415
86
10
76
3
+ Addednormalize.css@^4.2.0
+ Addednormalize.css@4.2.0(transitive)