mirror of
https://gitee.com/ice-gl/icegl-three-vue-tres.git
synced 2025-04-05 06:22:43 +08:00
2 lines
1.7 KiB
JavaScript
2 lines
1.7 KiB
JavaScript
import"./@amap.9EMhYPgf1725721021019.js";var t=Math.PI/180,r=180/Math.PI;function n(t){var r=o(t[0]+1,t[2]);return[o(t[0],t[2]),a(t[1]+1,t[2]),r,a(t[1],t[2])]}function o(t,r){return t/Math.pow(2,r)*360-180}function a(t,n){var o=Math.PI-2*Math.PI*t/Math.pow(2,n);return r*Math.atan(.5*(Math.exp(o)-Math.exp(-o)))}function e(t,r,n){var o=c(t,r,n);return o[0]=Math.floor(o[0]),o[1]=Math.floor(o[1]),o}function i(t){return[[2*t[0],2*t[1],t[2]+1],[2*t[0]+1,2*t[1],t[2]+1],[2*t[0]+1,2*t[1]+1,t[2]+1],[2*t[0],2*t[1]+1,t[2]+1]]}function u(t){return[t[0]>>1,t[1]>>1,t[2]-1]}function f(t){return i(u(t))}function h(t,r){for(var n=0;n<t.length;n++)if(l(t[n],r))return!0;return!1}function l(t,r){return t[0]===r[0]&&t[1]===r[1]&&t[2]===r[2]}function c(r,n,o){var a=Math.sin(n*t),e=Math.pow(2,o),i=e*(r/360+.5);return(i%=e)<0&&(i+=e),[i,e*(.5-.25*Math.log((1+a)/(1-a))/Math.PI),o]}var v={tileToGeoJSON:function(t){var r=n(t);return{type:"Polygon",coordinates:[[[r[0],r[3]],[r[0],r[1]],[r[2],r[1]],[r[2],r[3]],[r[0],r[3]]]]}},tileToBBOX:n,getChildren:i,getParent:u,getSiblings:f,hasTile:h,hasSiblings:function(t,r){for(var n=f(t),o=0;o<n.length;o++)if(!h(r,n[o]))return!1;return!0},tilesEqual:l,tileToQuadkey:function(t){for(var r="",n=t[2];n>0;n--){var o=0,a=1<<n-1;0!=(t[0]&a)&&o++,0!=(t[1]&a)&&(o+=2),r+=o.toString()}return r},quadkeyToTile:function(t){for(var r=0,n=0,o=t.length,a=o;a>0;a--){var e=1<<a-1,i=+t[o-a];1===i&&(r|=e),2===i&&(n|=e),3===i&&(r|=e,n|=e)}return[r,n,o]},pointToTile:e,bboxToTile:function(t){var r=e(t[0],t[1],32),n=e(t[2],t[3],32),o=[r[0],r[1],n[0],n[1]],a=function(t){for(var r=28,n=0;n<r;n++){var o=1<<32-(n+1);if((t[0]&o)!=(t[2]&o)||(t[1]&o)!=(t[3]&o))return n}return r}(o);return 0===a?[0,0,0]:[o[0]>>>32-a,o[1]>>>32-a,a]},pointToTileFraction:c};export{v as t};
|