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

dmap

Package Overview
Dependencies
Maintainers
4
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dmap - npm Package Compare versions

Comparing version 0.1.50 to 0.1.51

2

layer/addons/markers.js

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

'use strict';function b(c){c=this.options=a.deepMerge(b.options,c),this.markers={}}var a=require('./../../core/utils'),e=a.mercator,f=a.sphere,c=require('./marker'),g=require('lodash'),h=a.isNone,i=require('three'),a=require('bcore/utils'),d=require('bcore/event');b.options={isAble:!0,markerN:100,isDynamic:!0,texture:function(a){return a.text},fog:!0,ratio:1.1,marker:{depthTest:!0,scaleSize:15e5,quality:3,style:{offsetLeft:30,fontSize:55,color:'#0ff',background:'rgba(0,0,0,0)'}},lat:function(a){return a.latlngs.lat},lng:function(a){return a.latlngs.lng},width:function(a){return a.content.width||900},height:function(a){return a.content.height||300},id:function(a,b){return a.id||b}},b=d.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 b,a=this.markers;for(var c in a)b=a[c],b.remove();this._data=null,b=null,a=null},data:function(a){this._data=a},draw:function(){var h=this._data;if(!h)return;var m=this.projection,p=this._map,j=this.markers,f=this.getChildOptions(),a=this.options,g=a.ratio,u=a.texture,v=a.id,l=a.lat,q=a.lng,n=a.width,o=a.height,b,k,r,s,t,d,e;for(var i in h)b=h[i],k=v(b,i),r=u(b),s=l(b),t=q(b),e=m.project({lng:t,lat:s}),e.x=e.x*g,e.y=e.y*g,e.z=e.z*g,f.isVisible=a.isAble,f.type=b.type||'text',f.width=n(b)||900,f.height=o(b)||300,d=j[k],d||(d=new c(f),d.addTo(p),j[k]=d),d.updateOptions(f),d.updateTexture(r),d.updatePos(e,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();b.isVisible=c.isAble,this.each(function(a){a.updateOptions(b)}.bind(this))},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'),e=a.mercator,f=a.sphere,c=require('./marker'),g=require('lodash'),h=a.isNone,i=require('three'),a=require('bcore/utils'),d=require('bcore/event');b.options={isAble:!0,markerN:100,isDynamic:!0,texture:function(a){return a.text},fog:!0,ratio:1.1,marker:{depthTest:!0,scaleSize:15e5,quality:3,style:{offsetLeft:30,fontSize:55,color:'#0ff',background:'rgba(0,0,0,0)'}},lat:function(a){return a.latlngs.lat},lng:function(a){return a.latlngs.lng},width:function(a){return a.content.width||900},height:function(a){return a.content.height||300},id:function(a,b){return a.id||b}},b=d.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 b,a=this.markers;for(var c in a)b=a[c],b.remove();this._data=null,b=null,a=null},data:function(a){this._data=a},draw:function(){var h=this._data;if(!h)return;var m=this.projection,p=this._map,j=this.markers,f=this.getChildOptions(),a=this.options,g=a.ratio,u=a.texture,v=a.id,l=a.lat,q=a.lng,n=a.width,o=a.height,b,k,r,s,t,d,e;for(var i in h)b=h[i],k=v(b,i),r=u(b),s=l(b),t=q(b),e=m.project({lng:t,lat:s}),e.x=e.x*g,e.y=e.y*g,e.z=e.z*g,f.isVisible=a.isAble,f.type=b.type||'text',f.width=n(b)||900,f.height=o(b)||300,d=j[k],d||(d=new c(f),d.addTo(p),j[k]=d),d.updateOptions(f),d.updateTexture(r),d.updatePos(e,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(b){b&&(this.options=a.deepMerge(this.options,b)),this.draw();var c=this.getChildOptions();c.isVisible=b.isAble,this.each(function(a){a.updateOptions(c)}.bind(this))},render:function(a){a&&this.data(a),this.draw()}}),module.exports=b

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

'use strict';function c(a){this.updateOptions(a)}var b=require('./../core/utils'),a=require('./../three'),e=require('bcore/event'),f=b.mercator,g=b.sphere,d=require('lodash');c.options={maxHeight:5e6,ratio:1.01,size:1e5,color:65280,opacity:.1,value:function(a){return a.value},lat:b.getLat,lng:b.getLng,id:function(a,b){return a.id||b},blending:a.AdditiveBlending,faceColor:function(b){return new a.Color('rgb(0,150,250)')}},c=e.extend(c,{updateOptions:function(a){var a=this.options=b.deepMerge(this.options||c.options,a);this.update()},update:function(){if(!this.cubes)return;var b=this.options,e=b.size,f=b.maxHeight,c=new a.Color(b.color),g=b.opacity;d.forEach(this.cubes,function(b){var d=f*b.value,a=b.cube;a.material.color.setRGB(c.r,c.g,c.b),a.material.opacity=g,a.material.transparent=!0,a.scale.set(e,e,d)})},addTo:function(a){this.three3D=a.three3D;var b=this.projection=a.projection},_createGeometry:function(c,d){var b=this.options.ratio;return geometry=new a.BoxGeometry(1,1,1),geometry.vertices.forEach(function(a){a.z+=.5*b}),geometry},_createMaterial:function(){var b=this.options,f=b.color,c=b.opacity,d=b.blending,e=new a.MeshPhongMaterial({color:65280,opacity:c,transparent:!0,blending:d,side:a.DoubleSide});return e},render:function(a){a&&this.data(a),this.draw()},data:function(a){if(!a)return;var b=this._data=a;this.processing(a)},processing:function(f){var c=this.options.value,a=c(f[0]),b=a,e;d.forEach(f,function(d){e=c(d),a=Math.min(a,e),b=Math.max(b,e)}),this.range=[a,b]},draw:function(){var g=this,o=this._data,b=this.options,h=b.size,q=b.lat,s=b.lng,u=b.value,v=b.id,w=b.maxHeight,x=this._createMaterial(),c,i=this.range,p=i[1],m=i[0],r=p-m,e,t,j,k,l,f,y=this.three3D,z=this.cubes={},n=this.projection;d.forEach(o,function(b,o){j=q(b),k=s(b),l=v(b),e=u(b),e=(e-m)/r||1;var i=g._createGeometry(j,k);c=new a.Mesh(i,x);var d={lat:j,lng:k};c.lookAt(g.getTarget(d)),f=n.project(d),c.position.set(f.x,f.y,f.z),t=w*e,c.scale.set(h,h,t),y.add(c),z[l]={data:b,id:l,cube:c,value:e}})},getTarget:function(c){var b=this.projection;return b.type==='plane'||b.type==='mecator'?new a.Vector3(0,1,0):b.type==='sphere'?b.getNormal(c):void 0}}),module.exports=c
'use strict';function b(a){this.options=c.deepMerge(b.options,a)}var c=require('./../core/utils'),a=require('./../three'),e=require('bcore/event'),d=require('lodash'),f=c.randomWord;b.options={maxHeight:5e6,ratio:1.01,size:1e5,color:65280,opacity:.1,value:function(a){return a.value},lat:c.getLat,lng:c.getLng,id:function(a,b){return f(!1,4,10)},blending:a.AdditiveBlending},b=e.extend(b,{updateOptions:function(a){a&&(this.options=c.deepMerge(this.options||b.options,a)),this.update()},update:function(){if(!this.cubes)return;var b=this.options,e=b.size,f=b.maxHeight,c=new a.Color(b.color),g=b.opacity;d.forEach(this.cubes,function(b){var d=f*b.value,a=b.cube;a.material.color.setRGB(c.r,c.g,c.b),a.material.opacity=g,a.material.transparent=!0,a.scale.set(e,e,d)})},addTo:function(a){this.three3D=a.three3D,this.projection=a.projection},_createGeometry:function(){var c=this.options.ratio,b=new a.BoxGeometry(1,1,1);return b.vertices.forEach(function(a){a.z+=.5*c}),b},_createMaterial:function(){var c=this.options,d=new a.Color(c.color),e=c.opacity,f=c.blending,b=new a.MeshBasicMaterial({transparent:!0,blending:f,side:a.DoubleSide});return b.color.setRGB(d.r,d.g,d.b),b.opacity=e,b.needsUpdate=!0,b},render:function(a){a&&this.data(a),this.remove(),this.draw()},data:function(a){if(!a)return;this._data=a,this.processing(a)},processing:function(f){var c=this.options.value,a=c(f[0]),b=a,e;d.forEach(f,function(d){e=c(d),a=Math.min(a,e),b=Math.max(b,e)}),this.range=[a,b]},draw:function(){var p=this,t=this._data,b=this.options,g=b.size,v=b.lat,z=b.lng,A=b.value,k=b.id,l=b.maxHeight,m=this._createGeometry(),n=this._createMaterial(),o=this.three3D,r=this.cubes={},q=this.projection,h=this.range,s=h[1],i=h[0],u=s-i,e,w,x,y,j,f,c;d.forEach(t,function(b,h){x=v(b),y=z(b),j=k(b),e=A(b),e=(e-i)/u||1,c=new a.Mesh(m,n);var d={lat:x,lng:y};c.lookAt(p.getTarget(d)),f=q.project(d),c.position.set(f.x,f.y,f.z),w=l*e,c.scale.set(g,g,w),o.add(c),r[j]={data:b,id:j,cube:c,value:e}})},getTarget:function(c){var b=this.projection;return b.type==='plane'||b.type==='mecator'?new a.Vector3(0,1,0):b.type==='sphere'?b.getNormal(c):void 0},remove:function(){var a=this.cubes,b=this;d.forEach(a,function(c){var a=c.cube;b.three3D.remove(a),a&&a.dispose&&a.dispose(),a.material&&a.material.dispose(),a.geometry&&a.geometry.dispose(),c.cube=null,c.data=null,c.id=null,c.value=null})}}),module.exports=b

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

'use strict';function c(a){this.updateOptions(a)}var b=require('./../core/utils'),a=require('./../three'),e=require('bcore/event'),f=b.mercator,g=b.sphere,d=require('lodash');c.options={maxHeight:5e6,ratio:1.01,size:1e5,color:65280,opacity:.1,value:function(a){return a.value},lat:b.getLat,lng:b.getLng,id:function(a,b){return a.id||b},blending:a.AdditiveBlending,faceColor:function(b){return new a.Color('rgb(0,150,250)')}},c=e.extend(c,{updateOptions:function(a){var a=this.options=b.deepMerge(this.options||c.options,a);this.update()},update:function(){if(!this.cubes)return;var b=this.options,e=b.size,f=b.maxHeight,c=new a.Color(b.color),g=b.opacity;d.forEach(this.cubes,function(b){var d=f*b.value,a=b.cube;a.material.color.setRGB(c.r,c.g,c.b),a.material.opacity=g,a.material.transparent=!0,a.scale.set(e,e,d)})},addTo:function(a){this.three3D=a.three3D;var b=this.projection=a.projection},_createGeometry:function(){var c=this.options.ratio,b=new a.BoxGeometry(1,1,1);return b.vertices.forEach(function(a){a.z+=.5*c}),b},_createMaterial:function(){var b=this.options,f=b.color,c=b.opacity,d=b.blending,e=new a.MeshPhongMaterial({color:16777215,opacity:c,transparent:!0,blending:d,vertexColors:a.FaceColors,side:a.DoubleSide});return e},render:function(a){a&&this.data(a),this.draw()},data:function(a){if(!a)return;var b=this._data=a;this.processing(a)},processing:function(f){var c=this.options.value,a=c(f[0]),b=a,e;d.forEach(f,function(d){e=c(d),a=Math.min(a,e),b=Math.max(b,e)}),this.range=[a,b]},draw:function(){var q=this,n=this._data,c=this.options,l=c.size,o=c.lat,p=c.lng,s=c.value,u=c.id,y=c.maxHeight,f=this._createGeometry(),i=this._createMaterial(),b,j=new a.Geometry,g=this.range,r=g[1],k=g[0],t=r-k,e,v,w,x,m,h,A=this.three3D,B=this.cubes={},C=this.projection;d.forEach(n,function(d,A){w=o(d),x=p(d),m=u(d),e=s(d),e=(e-k)/t||1,b=new a.Mesh(f,i);var n={lat:w,lng:x};b.lookAt(q.getTarget(n)),h=C.project(n),b.position.set(h.x,h.y,h.z),v=y*e,b.scale.set(l,l,v);var r=c.faceColor(d,g),z=f.faces;z.forEach(function(a){a.color=r}),f.colorsNeedUpdate=!0,b.updateMatrix(),j.merge(b.geometry,b.matrix),B[m]={data:d,id:m,cube:b,value:e}});var z=this.mergedMesh=new a.Mesh(j,i);A.add(z)},getTarget:function(c){var b=this.projection;return b.type==='plane'||b.type==='mecator'?new a.Vector3(0,1,0):b.type==='sphere'?b.getNormal(c):void 0}}),module.exports=c
'use strict';function c(a){this.options=b.deepMerge(c.options,a)}var b=require('./../core/utils'),a=require('./../three'),e=require('bcore/event'),d=require('lodash');c.options={maxHeight:5e6,ratio:1.01,size:1e5,color:65280,opacity:.1,value:function(a){return a.value},lat:b.getLat,lng:b.getLng,id:function(a,c){return b.randomWord(!1,4,10)},blending:a.AdditiveBlending,faceColor:function(b){return new a.Color('rgb(0,150,250)')}},c=e.extend(c,{updateOptions:function(a){a&&(this.options=b.deepMerge(this.options,a)),this.update()},update:function(){if(!this.cubes)return;var b=this.options,e=b.size,f=b.maxHeight,c=new a.Color(b.color),g=b.opacity;d.forEach(this.cubes,function(b){var d=f*b.value,a=b.cube;a.material.color.setRGB(c.r,c.g,c.b),a.material.opacity=g,a.material.transparent=!0,a.scale.set(e,e,d)})},addTo:function(a){this.three3D=a.three3D;var b=this.projection=a.projection},_createGeometry:function(){var c=this.options.ratio,b=new a.BoxGeometry(1,1,1);return b.vertices.forEach(function(a){a.z+=.5*c}),b},_createMaterial:function(){var b=this.options,f=b.color,c=b.opacity,d=b.blending,e=new a.MeshPhongMaterial({color:16777215,opacity:c,transparent:!0,blending:d,vertexColors:a.FaceColors,side:a.DoubleSide});return e},render:function(a){a&&this.data(a),this.draw()},data:function(a){if(!a)return;var b=this._data=a;this.processing(a)},processing:function(f){var c=this.options.value,a=c(f[0]),b=a,e;d.forEach(f,function(d){e=c(d),a=Math.min(a,e),b=Math.max(b,e)}),this.range=[a,b]},draw:function(){var q=this,n=this._data,c=this.options,l=c.size,o=c.lat,p=c.lng,s=c.value,u=c.id,y=c.maxHeight,f=this._createGeometry(),i=this._createMaterial(),b,j=new a.Geometry,g=this.range,r=g[1],k=g[0],t=r-k,e,v,w,x,m,h,A=this.three3D,B=this.cubes={},C=this.projection;d.forEach(n,function(d,A){w=o(d),x=p(d),m=u(d),e=s(d),e=(e-k)/t||1,b=new a.Mesh(f,i);var n={lat:w,lng:x};b.lookAt(q.getTarget(n)),h=C.project(n),b.position.set(h.x,h.y,h.z),v=y*e,b.scale.set(l,l,v);var r=c.faceColor(d,g),z=f.faces;z.forEach(function(a){a.color=r}),f.colorsNeedUpdate=!0,b.updateMatrix(),j.merge(b.geometry,b.matrix),B[m]={data:d,id:m,cube:b,value:e}});var z=this.mergedMesh=new a.Mesh(j,i);A.add(z)},getTarget:function(c){var b=this.projection;return b.type==='plane'||b.type==='mecator'?new a.Vector3(0,1,0):b.type==='sphere'?b.getNormal(c):void 0},remove:function(){var a=this.cubes,b=this;d.forEach(a,function(c){var a=c.cube;b.three3D.remove(a),a&&a.dispose&&a.dispose(),a.material&&a.material.dispose(),a.geometry&&a.geometry.dispose(),c.cube=null,c.data=null,c.id=null,c.value=null})}}),module.exports=c

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

'use strict';function a(c){this.options=b.deepMerge(a.options,c)}var b=require('./../core/utils'),h=require('lodash'),i=b.isNone,d=require('./../render/particleMaterial3D'),e=require('./scatter.anim'),c=require('./../three'),f=b.getSprite,j=b.getRange,g=b.randomWord;a.options={blending:c.AdditiveBlending,ratio:1,lat:b.getLat,lng:b.getLng,id:function(a,b){return g(!1,4,10)},scatterN:1e3,maxPtSize:5,minPtSize:2,maxOpacity:1,color:'#0ff',sprite:{drawN:1.15,width:128,height:128,color:{from:'hsla(20,100%,75%,0.8)',to:'hsla(120,100%,50%,0.1)',easing:'Linear.None.1.7',space:'rgb'}},offset:{x:0,y:2e5,z:0},value:function(a){return a.value},size:function(c,a,d){var b=(c.value-a)/(d-a);return b*(this.maxPtSize-this.minPtSize)+this.minPtSize},anim:{easing:'Bounce.In',time:3e3}},a.prototype.addTo=function(a){this._map=a,this.three3D=a.three3D,this.initParticles(),this.initAnim(),this.projection=a.projection},a.prototype.data=function(g){var f={},e,j,a,d=this.options,h=d.value.bind(d),i=d.id.bind(d),b,c;for(var k in g)e=g[k],j=i(e),f[j]=e,a=h(e),(b===null||b===undefined)&&(b=a),(c===null||c===undefined)&&(c=a),b>a&&(b=a),c<a&&(c=a);this._data=f,this.range=[b,c]},a.prototype.addAttributes=function(f){var i=this.options,b=i.scatterN,g=new Float32Array(b),d=new Float32Array(b*4),e=new Float32Array(b*3),h=new Float32Array(b);for(var a=0;a<b;a++)g[a*1]=0,d[a*4+0]=1,d[a*4+1]=1,d[a*4+2]=1,d[a*4+3]=1,h[a*1]=1,e[a*3+0]=0,e[a*3+1]=0,e[a*3+2]=0;f.addAttribute('sizes',new c.BufferAttribute(g,1,1).setDynamic(!0)),f.addAttribute('colors',new c.BufferAttribute(d,4,1).setDynamic(!0)),f.addAttribute('scales',new c.BufferAttribute(h,1,1).setDynamic(!0)),f.addAttribute('position',new c.BufferAttribute(e,3,1).setDynamic(!0))},a.prototype.clean=function(f){var c=this.options,d=c.scatterN,e=this.particleGeometry.getAttribute('sizes').array,b=this.particleGeometry.getAttribute('position').array;for(var a=0;a<d;a++)e[a*1]=0,b[a*3+0]=0,b[a*3+1]=0,b[a*3+2]=0;f&&this.updateSize()},a.prototype.draw=function(){if(!this._data)return;var l=this._data;this.clean();var s=this.particles=this.particles||{},t=this.projection.project.bind(this.projection),z=this.material,y=this.particleGeometry.vertices,n=this.particleGeometry.getAttribute('sizes').array,f=this.particleGeometry.getAttribute('position').array,a=this.options,i=this.range,g=a.ratio,x=i[0],m=i[1],u=a.lng,o=a.lat,p=a.size.bind(a),q=a.id.bind(a),r=a.scatterN,c,d,j,k,w,e=a.offset,v,b=0;for(var h in l){if(c=l[h],v=q(c,h),j=o(c),k=u(c),!(j&&k))continue;if(d=t({lat:j,lng:k},e.x,e.y,e.z),!d)continue;w=p(c,x,m),b<r&&(n[b]=w,f[3*b+0]=d.x*g,f[3*b+1]=d.y*g,f[3*b+2]=d.z*g,s[v]={attributesIndex:b}),b++}this.updatePosition(),this.updateSize()},a.prototype.render=function(a){a&&this.data(a),this.draw()},a.prototype.initParticles=function(){var e=this.three3D,f=this.particleMaterial=new d(this.getMatOptions()),g=this.material=f.getMaterial(),a=this.particleGeometry=new c.BufferGeometry;this.addAttributes(a);var b=this.pointCloud=new c.Points(a,g);b.frustumCulled=!1,e.add(b),this.updateSize()},a.prototype.getMatOptions=function(){var a=this.options;return{sprite:f(a.sprite),scatterN:a.scatterN,maxPtSize:a.maxPtSize,maxOpacity:a.maxOpacity,reverseSpriteColor:a.reverseSpriteColor,blending:a.blending}},a.prototype.hide=function(){this.pointCloud.visible=!1},a.prototype.show=function(){this.pointCloud.visible=!0},a.prototype.updateOptions=function(a){this.options=b.deepMerge(this.options,a),this.particleMaterial.updateOptions(this.getMatOptions()),this.draw()},a.prototype.loop=function(){this.updateSize()},a.prototype.updateSize=function(){this.particleGeometry.getAttribute('sizes').needsUpdate=!0,this.material.needsUpdate=!0},a.prototype.updatePosition=function(){this.particleGeometry.verticesNeedUpdate=!0,this.particleGeometry.getAttribute('position').needsUpdate=!0},a.prototype.updateSprite=function(a){},a.prototype.remove=function(){this.three3D.remove(this.pointCloud),this.pointCloud&&this.pointCloud.dispose&&this.pointCloud.dispose(),this.particleGeometry&&this.particleGeometry.dispose(),this.material&&this.material.dispose(),this.pointCloud=null,this.particleGeometry=null,this.material=null},a.prototype=b.extend(a.prototype,e),module.exports=a
'use strict';function a(c){this.options=b.deepMerge(a.options,c),this.scale=0,this.reverseScale=0,this.scaleOffsetIndex=0}var b=require('./../core/utils'),g=require('lodash'),h=b.isNone,d=require('./../render/particleMaterial3D'),c=require('./../three'),e=b.getSprite,i=b.getRange,f=b.randomWord;a.options={blending:c.AdditiveBlending,ratio:1,lat:b.getLat,lng:b.getLng,id:function(a,b){return f(!1,4,10)},scatterN:1e3,maxPtSize:5,minPtSize:2,maxOpacity:1,color:'#0ff',scaleOffset:1,scaleSpeed:.03,sprite:{drawN:1.15,width:128,height:128,color:{from:'hsla(20,100%,75%,0.8)',to:'hsla(120,100%,50%,0.1)',easing:'Linear.None.1.7',space:'rgb'}},offset:{x:0,y:2e5,z:0},value:function(a){return a.value},size:function(c,a,d){var b=(c.value-a)/(d-a);return b*(this.maxPtSize-this.minPtSize)+this.minPtSize},anim:{easing:'Bounce.In',time:3e3}},a.prototype.addTo=function(a){this._map=a,this.three3D=a.three3D,this.initParticles(),this.projection=a.projection},a.prototype.data=function(g){var f={},e,j,a,d=this.options,h=d.value.bind(d),i=d.id.bind(d),b,c;for(var k in g)e=g[k],j=i(e),f[j]=e,a=h(e),(b===null||b===undefined)&&(b=a),(c===null||c===undefined)&&(c=a),b>a&&(b=a),c<a&&(c=a);this._data=f,this.range=[b,c]},a.prototype.clean=function(){var c=this.options,d=c.scatterN,e=this.particleGeometry.getAttribute('sizes').array,b=this.particleGeometry.getAttribute('position').array;for(var a=0;a<d;a++)e[a*1]=0,b[a*3+0]=0,b[a*3+1]=0,b[a*3+2]=0},a.prototype.update=function(){if(!this.particles)return;var d=this.options,a=d.scaleOffset,b=d.scaleSpeed;if(!(b&&a))return;this.scaleOffsetIndex<a?(this.scale+=b,this.scaleOffsetIndex+=b):a<=this.scaleOffsetIndex&&this.scaleOffsetIndex<2*a?(this.scale-=b,this.scaleOffsetIndex+=b):this.scaleOffsetIndex>2*a&&(this.scale=0,this.scaleOffsetIndex=0),this.reverseScale=a-this.scale;var e=this.particles,f=this.particleGeometry.getAttribute('scales').array;for(var g in e){var h=e[g],c=h.attributesIndex;c%2===0?f[c*1]=this.scale+1:f[c*1]=this.reverseScale+1}this.updateScale()},a.prototype.draw=function(){if(!this._data)return;var i=this._data;this.clean();var q=this.particles=this.particles||{},t=this.projection.project.bind(this.projection),z=this.material,y=this.particleGeometry.vertices,p=this.particleGeometry.getAttribute('sizes').array,f=this.particleGeometry.getAttribute('position').array,a=this.options,g=a.ratio,v=a.lng,w=a.lat,m=a.size.bind(a),u=a.id.bind(a),o=a.scatterN,e=a.offset,h=this.range,r=h[0],s=h[1],c,d,k,l,x,n,b=0;for(var j in i){if(c=i[j],n=u(c,j),k=w(c),l=v(c),!(k&&l))continue;if(d=t({lat:k,lng:l},e.x,e.y,e.z),!d)continue;x=m(c,r,s),b<o&&(p[b]=x,f[3*b+0]=d.x*g,f[3*b+1]=d.y*g,f[3*b+2]=d.z*g,q[n]={attributesIndex:b}),b++}this.updatePosition(),this.updateSize()},a.prototype.render=function(a){a&&this.data(a),this.draw()},a.prototype.initParticles=function(){var k=this.options,b=k.scatterN,e=this.particleGeometry=new c.BufferGeometry,i=new Float32Array(b),f=new Float32Array(b*4),g=new Float32Array(b*3),j=new Float32Array(b);for(var a=0;a<b;a++)i[a*1]=0,f[a*4+0]=1,f[a*4+1]=1,f[a*4+2]=1,f[a*4+3]=1,j[a*1]=1,g[a*3+0]=0,g[a*3+1]=0,g[a*3+2]=0;e.addAttribute('sizes',new c.BufferAttribute(i,1,1).setDynamic(!0)),e.addAttribute('colors',new c.BufferAttribute(f,4,1).setDynamic(!0)),e.addAttribute('scales',new c.BufferAttribute(j,1,1).setDynamic(!0)),e.addAttribute('position',new c.BufferAttribute(g,3,1).setDynamic(!0));var l=this.particleMaterial=new d(this.getMatOptions()),m=this.material=l.getMaterial(),h=this.pointCloud=new c.Points(e,m);h.frustumCulled=!1,this.three3D.add(h),this.updateSize()},a.prototype.getMatOptions=function(){var a=this.options;return{sprite:e(a.sprite),scatterN:a.scatterN,maxPtSize:a.maxPtSize,maxOpacity:a.maxOpacity,reverseSpriteColor:a.reverseSpriteColor,blending:a.blending}},a.prototype.hide=function(){this.pointCloud.visible=!1},a.prototype.show=function(){this.pointCloud.visible=!0},a.prototype.updateOptions=function(a){this.options=b.deepMerge(this.options,a),this.particleMaterial.updateOptions(this.getMatOptions()),this.draw()},a.prototype.loop=function(){this.updateSize()},a.prototype.updateScale=function(){this.particleGeometry.getAttribute('scales').needsUpdate=!0},a.prototype.updateSize=function(){this.particleGeometry.getAttribute('sizes').needsUpdate=!0,this.material.needsUpdate=!0},a.prototype.updatePosition=function(){this.particleGeometry.verticesNeedUpdate=!0,this.particleGeometry.getAttribute('position').needsUpdate=!0},a.prototype.updateSprite=function(a){},a.prototype.remove=function(){this.three3D.remove(this.pointCloud),this.pointCloud&&this.pointCloud.dispose&&this.pointCloud.dispose(),this.particleGeometry&&this.particleGeometry.dispose(),this.material&&this.material.dispose(),this.pointCloud=null,this.particleGeometry=null,this.material=null,this.particles=null,this._data=null},module.exports=a

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

function e(b){var a;Array.isArray(b)?a=[]:a={};for(var c in b)a[c]=b[c];return a}function f(b,c,d){for(var a in b)b[a]=(c[a]-b[a])*d+b[a]}function a(b,c){this.options=d.deepMerge(a.options,c),this.containner=d.getContainer(b),this.detect()}var c=require('three'),b=Math.PI,d=require('./../core/utils'),h=require('bcore/event'),g=d.getPt,i=d.requestAnimationFrame,j=d.cancelAnimationFrame;a.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}}},a=h.extend(a,{linkTo:function(a){this.camera=a,this.initialize(this.options)},initPlane:function(){this.plane=new c.Plane(new c.Vector3(0,1,0),0)},updateOptions:function(a){a&&(this.options=d.deepMerge(this.options,a))},initialize:function(a){this.initPlane(),this.initVariables(),this.initEvents(),this.loop()},initVariables:function(){var a=this.options;this.mouse={x:0,y:0},this.mouseOnDown=e(this.mouse),this.rotationTargetOnDown=e(a.rotation.target),this.lookAtTargetOnDown=e(a.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,e=g.rotation,b=e.value,i=e.target;e.autoRotateSpeed&&!this.isMouseDown&&(i.x+=e.autoRotateSpeed),Math.abs(i.x-b.x)+Math.abs(i.y-b.y)>e.limit&&(f(b,i,e.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&&(f(k,l,l.speed),this.emit('move',this));var j=g.lookAt,c=j.value,h=j.target;Math.abs(h.x-c.x)+Math.abs(h.y-c.y)+Math.abs(h.z-c.z)>j.limit&&f(c,h,j.speed);var o=a.value*Math.sin(b.x)*Math.cos(b.y)+c.x,p=a.value*Math.sin(b.y)+c.y,q=a.value*Math.cos(b.x)*Math.cos(b.y)+c.z,d=this.camera;d.near/a.value>1e-4&&(d.far=Math.max(a.value*1e4,1),d.near=a.value/1e3,d.updateProjectionMatrix()),d.position.set(o,p,q),d.lookAt(c)},resetCamera:function(){},mouseDown:function(b){this.isMouseDown=!0,this.options.lookAt.target=e(this.options.lookAt.value),this.options.lookAt.speed=this.options.lookAt.speedMouseDown;var a=g(b);this.mouseOnDown.x=a[0],this.mouseOnDown.y=a[1];var c=a[2];this.rotationTargetOnDown=e(this.options.rotation.target),this.lookAtTargetOnDown=e(this.options.lookAt.target),this.cameraClone=this.camera.clone(),this.downPoint=this.unproject(this.mouseOnDown.x,this.mouseOnDown.y);var d=this.options.interactive;b.preventDefault()}}),a.prototype.mouseMove=function(r){if(!this.isMouseDown)return;r.preventDefault();var d=this.options,w=this.camera,l=g(r),c=this.mouse,v=this.mouseOnDown;c.x=l[0],c.y=l[1];var u=d.distance.value/1e3,a=d.rotation.target,j=this.rotationTargetOnDown,t=d.rotation.value,k=this.options.interactive,h=k.mouseX,i=k.mouseY,m=d.lookAt.target,n=this.lookAtTargetOnDown,s=this.mouse.x-this.mouseOnDown.x,q=this.mouse.y-this.mouseOnDown.y;h.type==='rotatex'&&(a.x=j.x-s*h.phi),i.type==='rotatey'&&(a.y=j.y+q*i.phi,a.y=a.y>b/2?b/2:a.y,a.y=a.y<-b/2?-b/2:a.y);var f=this.downPoint,e=this.unproject(c.x,c.y);if(!(e&&f))return;var p=e.z-f.z,o=e.x-f.x;h.type==='panx'&&(m.x=n.x-o),i.type==='pany'&&(m.z=n.z-p)},a.prototype.mouseUp=function(a){a.preventDefault();var b=this.options;this.isMouseDown=!1;var c=this.containner;return this.options.lookAt.speed=this.options.lookAt.speedMouseUp,void this.options.isDetect},a.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))},a.prototype.unproject=function(h,i){var e=this.containner.offsetWidth,f=this.containner.offsetHeight,g=this.cameraClone,d=new c.Vector3;d.set(h/e*2-1,-(i/f)*2+1,.5);var a=new c.Raycaster;a.setFromCamera(d.clone(),g);var j=a.ray.direction,k=a.ray.origin,b=a.ray.intersectPlane(this.plane);return b?new c.Vector3(b.x,0,b.z):void 0},a.prototype.mouseWheel=function(a){a.preventDefault&&a.preventDefault(),a.stopPropagation&&a.stopPropagation();var b=0;if(a.wheelDelta!==undefined?b=a.wheelDelta:a.detail!==undefined&&(b=-a.detail),this.overRenderer){var c=1+(b>0?5:-5)*this.options.interactive.scroll.speed;c=Math.max(Math.min(c,1.5),0),this.zoom(c)}return!1},a.prototype.flyingTo=function(v,w,u,k){w=w||.75,u=u||0,k=k||0;var d,e;for(var r in v){var t=v[r],m=t.geometry;m.computeBoundingBox();var a=m.boundingBox;r===0&&(d=a.max.clone(),e=a.min.clone()),d.x<a.max.x&&(d.x=a.max.x),d.y<a.max.y&&(d.y=a.max.y),d.z<a.max.z&&(d.z=a.max.z),e.x>a.min.x&&(e.x=a.min.x),e.y>a.min.y&&(e.y=a.min.y),e.z>a.min.z&&(e.z=a.min.z)}var s=this.containner,A=s.width(),F=s.height(),f=d.x,g=d.y,p=d.z,j=e.x,i=e.y,l=e.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 c.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*b;this.lookAtTarget.x=-n+k,this.lookAtTarget.z=-o+k,this.lookAtTarget.y=0,this.rotation.x=b,this.rotation.y=b/2},a.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)},a.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},a.prototype.zoom=function(b){var a=this.options.distance;a.target=Math.max(Math.min(a.target*b,a.max),a.min)},module.exports=a
function e(b){var a;Array.isArray(b)?a=[]:a={};for(var c in b)a[c]=b[c];return a}function f(b,c,d){for(var a in b)b[a]=(c[a]-b[a])*d+b[a]}function a(b,c){this.options=d.deepMerge(a.options,c),this.containner=d.getContainer(b),this.detect()}var c=require('three'),b=Math.PI,d=require('./../core/utils'),h=require('bcore/event'),g=d.getPt,i=d.requestAnimationFrame,j=d.cancelAnimationFrame;a.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}}},a=h.extend(a,{linkTo:function(a){this.camera=a,this.initialize(this.options)},initPlane:function(){this.plane=new c.Plane(new c.Vector3(0,1,0),0)},updateOptions:function(a){a&&(this.options=d.deepMerge(this.options,a))},initialize:function(a){this.initPlane(),this.initVariables(),this.initEvents(),this.loop()},initVariables:function(){var a=this.options;this.mouse={x:0,y:0},this.mouseOnDown=e(this.mouse),this.rotationTargetOnDown=e(a.rotation.target),this.lookAtTargetOnDown=e(a.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,e=g.rotation,b=e.value,i=e.target;e.autoRotateSpeed&&!this.isMouseDown&&(i.x+=e.autoRotateSpeed),Math.abs(i.x-b.x)+Math.abs(i.y-b.y)>e.limit&&(f(b,i,e.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&&(f(k,l,l.speed),this.emit('move',this));var j=g.lookAt,c=j.value,h=j.target;Math.abs(h.x-c.x)+Math.abs(h.y-c.y)+Math.abs(h.z-c.z)>j.limit&&f(c,h,j.speed);var o=a.value*Math.sin(b.x)*Math.cos(b.y)+c.x,p=a.value*Math.sin(b.y)+c.y,q=a.value*Math.cos(b.x)*Math.cos(b.y)+c.z,d=this.camera;d.near/a.value>1e-4&&(d.far=Math.max(a.value*1e4,1),d.near=a.value/1e3,d.updateProjectionMatrix()),d.position.set(o,p,q),d.lookAt(c)},resetCamera:function(){},mouseDown:function(b){this.isMouseDown=!0,this.options.lookAt.target=e(this.options.lookAt.value),this.options.lookAt.speed=this.options.lookAt.speedMouseDown;var a=g(b);this.mouseOnDown.x=a[0],this.mouseOnDown.y=a[1];var c=a[2];this.rotationTargetOnDown=e(this.options.rotation.target),this.lookAtTargetOnDown=e(this.options.lookAt.target),this.cameraClone=this.camera.clone(),this.downPoint=this.unproject(this.mouseOnDown.x,this.mouseOnDown.y);var d=this.options.interactive;b.preventDefault()}}),a.prototype.mouseMove=function(r){if(!this.isMouseDown)return;r.preventDefault();var d=this.options,w=this.camera,l=g(r),c=this.mouse,v=this.mouseOnDown;c.x=l[0],c.y=l[1];var u=d.distance.value/1e3,a=d.rotation.target,j=this.rotationTargetOnDown,t=d.rotation.value,k=this.options.interactive,h=k.mouseX,i=k.mouseY,m=d.lookAt.target,n=this.lookAtTargetOnDown,s=this.mouse.x-this.mouseOnDown.x,q=this.mouse.y-this.mouseOnDown.y;h.type==='rotatex'&&(a.x=j.x-s*h.phi),i.type==='rotatey'&&(a.y=j.y+q*i.phi,a.y=a.y>b/2?b/2:a.y,a.y=a.y<-b/2?-b/2:a.y);var f=this.downPoint,e=this.unproject(c.x,c.y);if(!(e&&f))return;var p=e.z-f.z,o=e.x-f.x;h.type==='panx'&&(m.x=n.x-o),i.type==='pany'&&(m.z=n.z-p)},a.prototype.mouseUp=function(a){a.preventDefault();var b=this.options;this.isMouseDown=!1;var c=this.containner;return this.options.lookAt.speed=this.options.lookAt.speedMouseUp,void this.options.isDetect},a.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))},a.prototype.unproject=function(h,i){var e=this.containner.offsetWidth,f=this.containner.offsetHeight,g=this.cameraClone,d=new c.Vector3;d.set(h/e*2-1,-(i/f)*2+1,.5);var a=new c.Raycaster;a.setFromCamera(d.clone(),g);var j=a.ray.direction,k=a.ray.origin,b=a.ray.intersectPlane(this.plane);return b?new c.Vector3(b.x,0,b.z):void 0},a.prototype.mouseWheel=function(a){a.preventDefault&&a.preventDefault(),a.stopPropagation&&a.stopPropagation();var b=0;if(a.wheelDelta!==undefined?b=a.wheelDelta:a.detail!==undefined&&(b=-a.detail),this.overRenderer){var c=1+(b>0?5:-5)*this.options.interactive.scroll.speed;c=Math.max(Math.min(c,1.5),0),this.zoom(c)}return!1},a.prototype.flyingTo=function(v,w,u,k){w=w||.75,u=u||0,k=k||0;var d,e;for(var r in v){var t=v[r],m=t.geometry;m.computeBoundingBox();var a=m.boundingBox;r===0&&(d=a.max.clone(),e=a.min.clone()),d.x<a.max.x&&(d.x=a.max.x),d.y<a.max.y&&(d.y=a.max.y),d.z<a.max.z&&(d.z=a.max.z),e.x>a.min.x&&(e.x=a.min.x),e.y>a.min.y&&(e.y=a.min.y),e.z>a.min.z&&(e.z=a.min.z)}var s=this.containner,A=s.width(),F=s.height(),f=d.x,g=d.y,p=d.z,j=e.x,i=e.y,l=e.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 c.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*b;this.lookAtTarget.x=-n+k,this.lookAtTarget.z=-o+k,this.lookAtTarget.y=0,this.rotation.x=b,this.rotation.y=b/2},a.prototype.flying=function(b){var a=this.options;a.distance.target=b.distance||a.distance.target,a.lookAt.target=b.lookAt||a.lookAt.target,a.rotation.target=b.rotation||a.rotation.target,b.autoRotateSpeed&&(a.rotation.autoRotateSpeed=b.autoRotateSpeed)},a.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},a.prototype.zoom=function(b){var a=this.options.distance;a.target=Math.max(Math.min(a.target*b,a.max),a.min)},module.exports=a

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

function c(b){var a;Array.isArray(b)?a=[]:a={};for(var c in b)a[c]=b[c];return a}function a(c,d){c=this.container=b.getContainer(c),d=this.options=b.deepMerge(a.options,d),this.setProjection(),this.initialize(c,d),this.initEvents()}var f=require('three'),d=require('bcore/event'),b=require('bcore/utils'),k=require('./../render/three3d'),g=require('./interactions'),h=require('./projection/sphere'),i=require('./projection/mecator'),j=require('./projection/normal'),e=require('./projection/origin');a.options={projection:'plane',rotation:{x:-1.53407346410207,y:Math.PI/4},rotateSpeed:.1,autoRotateSpeed:0,distance:19378137,distanceSpeed:.3,center:null,moveSpeed:.2,globalAlpha:1,clearAlpha:1,angle:50,far:1e7,near:10,clearColor:0,background:'transparent',pointerEvents:'auto'},a=d.extend(a,{init3d:function(a){var d=this.options,b=this.three3D=new k(a,this.getThree3dOptions()),c=this.interaction=new g(a,this.getInteractionOptions());c.linkTo(b.camera)},getInteractionOptions:function(){var a=this.options,b=a.center;return a?b&&(b=this.processingCenter(a.center)):a=this.options,{rotation:{target:a.rotation,speed:a.rotateSpeed,autoRotateSpeed:a.autoRotateSpeed},distance:{target:a.distance,speed:a.distanceSpeed},center:{target:b},lookAt:{target:b,speed:a.moveSpeed}}},getThree3dOptions:function(){var a=this.options;return{alpha:a.globalAlpha,clearAlpha:a.clearAlpha,clearColor:a.clearColor,background:a.background,camera:{angle:a.angle,far:a.far,near:a.near},pointerEvents:a.pointerEvents}},initialize:function(b,c){var a=this.options.center||{lat:40,lng:100};if(!a)return console.log('必须有中心点');this.setCenter(a),this.init3d(b),this.addLight()},setProjection:function(){var b=this.options,a=b.projection;if(typeof a==='object')return;if(typeof a!=='string')return console.log('可能projection格式有误');this.projection={normal:j,sphere:h,plane:i,origin:e}[a]},setCenter:function(a){this.center=a,this.updatePosition(a)},setView:function(){},setRadius:function(){},getCenter:function(){},openDetect:function(){this.interaction.openDetect()},closeDetect:function(){this.interaction.closeDetect()},addLight:function(){},processingCenter:function(a){return a?a.x!==undefined&&a.y!==null?new f.Vector3(a.x,a.y,a.z):this.projection.project(a):null},updatePosition:function(a){var b=this.options,a=this.processingCenter(a);this.interaction&&this.interaction.flying({rotation:b.rotation,center:a,lookAt:a,distance:b.distance}),this.directionalLight&&this.directionalLight.position.set(a.x+1e3,5e3,a.z),this.directionalLight&&this.directionalLight.lookAt(a)},updateCamera:function(){var a=this.options;this.three3D.updateCamera({angle:a.angle,far:a.far,near:a.near})},updateOptions:function(a){typeof a==='object'&&(this.options=b.deepMerge(this.options,a)),a=this.options,this.interaction&&this.interaction.updateOptions(this.getInteractionOptions()),this.three3D.updateOptions(this.getThree3dOptions())},initEvents:function(){var a=this.interaction,b=this.options;a.on('zoom',function(){b.distance=a.options.distance.target}).on('rotate',function(){b.rotation=c(a.options.rotation.target)}).on('move',function(){b.center=c(a.options.lookAt.target),b.lookAt=c(a.options.lookAt.target)})}}),module.exports=a
function c(b){var a;Array.isArray(b)?a=[]:a={};for(var c in b)a[c]=b[c];return a}function a(c,d){c=this.container=b.getContainer(c),d=this.options=b.deepMerge(a.options,d),this.setProjection(),this.initialize(c,d),this.initEvents()}var g=require('three'),e=require('bcore/event'),b=require('bcore/utils'),f=require('./../render/three3d'),l=require('./interactions'),h=require('./projection/sphere'),i=require('./projection/mecator'),j=require('./projection/normal'),k=require('./projection/origin'),d=Math.PI/180;a.options={projection:'plane',rotation:{x:-1.53407346410207,y:Math.PI/4},rotateSpeed:.1,autoRotateSpeed:0,distance:19378137,distanceSpeed:.3,center:null,moveSpeed:.2,globalAlpha:1,clearAlpha:1,angle:50,far:1e7,near:10,clearColor:0,background:'transparent',pointerEvents:'auto'},a=e.extend(a,{init3d:function(a){var d=this.options,b=this.three3D=new f(a,this.getThree3dOptions()),c=this.interaction=new l(a,this.getInteractionOptions());c.linkTo(b.camera)},getInteractionOptions:function(){var a=this.options,b=a.center;return a?b&&(b=this.processingCenter(a.center)):a=this.options,{rotation:{target:a.rotation,speed:a.rotateSpeed,autoRotateSpeed:a.autoRotateSpeed},distance:{target:a.distance,speed:a.distanceSpeed},center:{target:b},lookAt:{target:b,speed:a.moveSpeed}}},getThree3dOptions:function(){var a=this.options;return{alpha:a.globalAlpha,clearAlpha:a.clearAlpha,clearColor:a.clearColor,background:a.background,camera:{angle:a.angle,far:a.far,near:a.near},pointerEvents:a.pointerEvents}},initialize:function(b,c){var a=this.options.center||{lat:40,lng:100};if(!a)return console.log('必须有中心点');this.setCenter(a),this.init3d(b)},setProjection:function(){var b=this.options,a=b.projection;if(typeof a==='object')return;if(typeof a!=='string')return console.log('可能projection格式有误');this.projection={normal:j,sphere:h,plane:i,origin:k}[a]},setCenter:function(a){this.center=a,this.updatePosition(a)},setView:function(){},setRadius:function(){},getCenter:function(){},openDetect:function(){this.interaction.openDetect()},closeDetect:function(){this.interaction.closeDetect()},processingCenter:function(a){return a?a.x!==undefined&&a.y!==null?new g.Vector3(a.x,a.y,a.z):this.projection.project(a):null},updatePosition:function(a){var b=this.options,a=this.processingCenter(a);this.interaction&&this.interaction.flying({rotation:b.rotation,center:a,lookAt:a,distance:b.distance})},sphereFlying:function(a){var b=this.options;if(b.projection!=='sphere')return console.log('目前只支持球形墨卡托');var c=(90+a.lng)*d,e=a.lat*d,f={x:c,y:e};this.interaction&&this.interaction.flying({rotation:f})},updateCamera:function(){var a=this.options;this.three3D.updateCamera({angle:a.angle,far:a.far,near:a.near})},updateOptions:function(a){typeof a==='object'&&(this.options=b.deepMerge(this.options,a)),a=this.options,this.interaction&&this.interaction.updateOptions(this.getInteractionOptions()),this.three3D.updateOptions(this.getThree3dOptions())},initEvents:function(){var a=this.interaction,b=this.options;a.on('zoom',function(){b.distance=a.options.distance.target}).on('rotate',function(){b.rotation=c(a.options.rotation.target)}).on('move',function(){b.center=c(a.options.lookAt.target),b.lookAt=c(a.options.lookAt.target)})}}),module.exports=a

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

"description": "3d map visualization lib",
"version": "0.1.50",
"version": "0.1.51",
"scripts": {

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc