51 lines
20 KiB
JavaScript
51 lines
20 KiB
JavaScript
|
/**
|
||
|
* Cesium - https://github.com/AnalyticalGraphicsInc/cesium
|
||
|
*
|
||
|
* Copyright 2011-2017 Cesium Contributors
|
||
|
*
|
||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
* you may not use this file except in compliance with the License.
|
||
|
* You may obtain a copy of the License at
|
||
|
*
|
||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
*
|
||
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
* See the License for the specific language governing permissions and
|
||
|
* limitations under the License.
|
||
|
*
|
||
|
* Columbus View (Pat. Pend.)
|
||
|
*
|
||
|
* Portions licensed separately.
|
||
|
* See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details.
|
||
|
*/
|
||
|
/*
|
||
|
Copyright (c) 2013 Gildas Lormeau. All rights reserved.
|
||
|
|
||
|
Redistribution and use in source and binary forms, with or without
|
||
|
modification, are permitted provided that the following conditions are met:
|
||
|
|
||
|
1. Redistributions of source code must retain the above copyright notice,
|
||
|
this list of conditions and the following disclaimer.
|
||
|
|
||
|
2. Redistributions in binary form must reproduce the above copyright
|
||
|
notice, this list of conditions and the following disclaimer in
|
||
|
the documentation and/or other materials provided with the distribution.
|
||
|
|
||
|
3. The names of the authors may not be used to endorse or promote products
|
||
|
derived from this software without specific prior written permission.
|
||
|
|
||
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
|
||
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||
|
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
|
||
|
INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||
|
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||
|
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||
|
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||
|
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||
|
*/
|
||
|
|
||
|
!function(e){function t(){function e(e){var t,n,i,r,_,o,d=a.dyn_tree,f=a.stat_desc.static_tree,l=a.stat_desc.extra_bits,s=a.stat_desc.extra_base,c=a.stat_desc.max_length,p=0;for(r=0;u>=r;r++)e.bl_count[r]=0;for(d[2*e.heap[e.heap_max]+1]=0,t=e.heap_max+1;h>t;t++)n=e.heap[t],r=d[2*d[2*n+1]+1]+1,r>c&&(r=c,p++),d[2*n+1]=r,n>a.max_code||(e.bl_count[r]++,_=0,n>=s&&(_=l[n-s]),o=d[2*n],e.opt_len+=o*(r+_),f&&(e.static_len+=o*(f[2*n+1]+_)));if(0!==p){do{for(r=c-1;0===e.bl_count[r];)r--;e.bl_count[r]--,e.bl_count[r+1]+=2,e.bl_count[c]--,p-=2}while(p>0);for(r=c;0!==r;r--)for(n=e.bl_count[r];0!==n;)i=e.heap[--t],i>a.max_code||(d[2*i+1]!=r&&(e.opt_len+=(r-d[2*i+1])*d[2*i],d[2*i+1]=r),n--)}}function t(e,t){var n=0;do n|=1&e,e>>>=1,n<<=1;while(--t>0);return n>>>1}function n(e,n,a){var i,r,_,o=[],d=0;for(i=1;u>=i;i++)o[i]=d=d+a[i-1]<<1;for(r=0;n>=r;r++)_=e[2*r+1],0!==_&&(e[2*r]=t(o[_]++,_))}var a=this;a.build_tree=function(t){var i,r,_,o=a.dyn_tree,u=a.stat_desc.static_tree,d=a.stat_desc.elems,f=-1;for(t.heap_len=0,t.heap_max=h,i=0;d>i;i++)0!==o[2*i]?(t.heap[++t.heap_len]=f=i,t.depth[i]=0):o[2*i+1]=0;for(;t.heap_len<2;)_=t.heap[++t.heap_len]=2>f?++f:0,o[2*_]=1,t.depth[_]=0,t.opt_len--,u&&(t.static_len-=u[2*_+1]);for(a.max_code=f,i=Math.floor(t.heap_len/2);i>=1;i--)t.pqdownheap(o,i);_=d;do i=t.heap[1],t.heap[1]=t.heap[t.heap_len--],t.pqdownheap(o,1),r=t.heap[1],t.heap[--t.heap_max]=i,t.heap[--t.heap_max]=r,o[2*_]=o[2*i]+o[2*r],t.depth[_]=Math.max(t.depth[i],t.depth[r])+1,o[2*i+1]=o[2*r+1]=_,t.heap[1]=_++,t.pqdownheap(o,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],e(t),n(o,a.max_code,t.bl_count)}}function n(e,t,n,a,i){var r=this;r.static_tree=e,r.extra_bits=t,r.extra_base=n,r.elems=a,r.max_length=i}function a(e,t,n,a,i){var r=this;r.good_length=e,r.max_lazy=t,r.nice_length=n,r.max_chain=a,r.func=i}function i(e,t,n,a){var i=e[2*t],r=e[2*n];return r>i||i==r&&a[t]<=a[n]}function r(){function e(){var e;for(De=2*Ee,Pe[Le-1]=0,e=0;Le-1>e;e++)Pe[e]=0;Te=J[Ve].max_lazy,Xe=J[Ve].good_length,Ye=J[Ve].nice_length,Re=J[Ve].max_chain,Ke=0,Fe=0,Oe=0,Ge=Qe=te-1,Je=0,Se=0}function a(){var e;for(e=0;c>e;e++)Ze[2*e]=0;for(e=0;d>e;e++)$e[2*e]=0;for(e=0;f>e;e++)et[2*e]=0;Ze[2*p]=1,tt.opt_len=tt.static_len=0,ot=dt=0}function r(){nt.dyn_tree=Ze,nt.stat_desc=n.static_l_desc,at.dyn_tree=$e,at.stat_desc=n.static_d_desc,it.dyn_tree=et,it.stat_desc=n.static_bl_desc,lt=0,st=0,ft=8,a()}function _(e,t){var n,a,i=-1,r=e[1],_=0,o=7,u=4;for(0===r&&(o=138,u=3),e[2*(t+1)+1]=65535,n=0;t>=n;n++)a=r,r=e[2*(n+1)+1],++_<o&&a==r||(u>_?et[2*a]+=_:0!==a?(a!=i&&et[2*a]++,et[2*v]++):10>=_?et[2*b]++:et[2*g]++,_=0,i=a,0===r?(o=138,u=3):a==r?(o=6,u=3):(o=7,u=4))}function o(){var e;for(_(Ze,nt.max_code),_($e,at.max_code),it.build_tree(tt),e=f-1;e>=3&&0===et[2*t.bl_order[e]+1];e--);return tt.opt_len+=3*(e+1)+5+5+4,e}function u(e){tt.pending_buf[tt.pending++]=e}function l(e){u(255&e),u(e>>>8&255)}function h(e){u(e>>8&255),u(255&e&255)}function x(e,t){var n,a=t;st>w-a?(n=e,lt|=n<<st&65535,l(lt),lt=n>>>w-st,st+=a-w):(lt|=e<<st&65535,st+=a)}function j(e,t){var n=2*e;x(65535&t[n],65535&t[n+1])}function ie(e,t){var n,a,i=-1,r=e[1],_=0,o=7,u=4;for(0===r&&(o=138,u=3),n=0;t>=n;n++)if(a=r,r=e[2*(n+1)+1],!(++_<o&&a==r)){if(u>_){do j(a,et);while(0!==--_)}else 0!==a?(a!=i&&(j(a,et),_--),j(v,et),x(_-3,2)):10>=_?(j(b,et),x(_-3,3)):(j(g,et),x(_-11,7));_=0,i=a,0===r?(o=138,u=3):a==r?(o=6,u=3):(o=7,u=4)}}function re(e,n,a){var i;for(x(e-257,5),x(n-1,5),x(a-4,4),i=0;a>i;i++)x(et[2*t.bl_order[i]+1],3);ie(Ze,e-1),ie($e,n-1)}function _e(){16==st?(l(lt),lt=0,st=0):st>=8&&(u(255<),lt>>>=8,st-=8)}function oe(){x($<<1,3),j(p,n.static_ltree),_e(),9>1+ft+10-st&&(x($<<1,3),j(p,n.static_ltree),_e()),ft=7}function ue(e,n){var a,i,r;if(tt.pending_buf[ut+2*ot]=e>>>8&255,tt.pending_buf[ut+2*ot+1]=255&e,tt.pending_buf[rt+ot]=255&n,ot++,0===e?Ze[2*n]++:(dt++,e--,Ze[2*(t._length_code[n]+s+1)]++,$e[2*t.d_code(e)]++),0===(8191&ot)&&Ve>2){for(a=8*ot,i=Ke-Fe,r=0;d>r;r++)a+=$e[2*r]*(5+t.extra_dbits[r]);if(a>>>=3,dt<Math.floor(ot/2)&&a<Math.floor(i/2))return!0}return ot==_t-1}function de(e,n){var a,i,r,_,o=0;if(0!==ot
|