4 lines
26 KiB
JavaScript
4 lines
26 KiB
JavaScript
|
define(["./Cartesian2-47311507","./EllipsoidTangentPlane-edb321d3","./buildModuleUrl-4e1b81e7","./Cartographic-3309dd0d","./when-b60132fc","./Check-7b2a090c","./TerrainEncoding-c4158481","./Math-119be1a3","./PrimitiveType-a54dc62f","./OrientedBoundingBox-87d59c2a","./GeometryAttribute-3a88ba31","./WebMercatorProjection-01b1b5e7","./RuntimeError-4a5c8994","./createTaskProcessorWorker","./Cartesian4-3ca25aab","./IntersectionTests-7386ffbf","./Plane-7ae8294c","./Event-16a2dfbf","./AttributeCompression-90851096","./ComponentDatatype-c140a87d","./WebGLConstants-4ae0db90","./PolygonPipeline-660e1625","./earcut-2.2.1-20c8012f","./EllipsoidRhumbLine-ed1a6bf4","./FeatureDetection-c3b71206"],(function(e,t,a,i,r,n,s,l,o,f,u,c,d,h,m,g,p,w,x,y,k,b,I,v,U){"use strict";var T=Object.freeze({NONE:0,LERC:1}),M={};M.DEFAULT_STRUCTURE=Object.freeze({heightScale:1,heightOffset:0,elementsPerHeight:1,stride:1,elementMultiplier:256,isBigEndian:!1});var V=new i.Cartesian3,A=new o.Matrix4,B=new i.Cartesian3,D=new i.Cartesian3;M.computeVertices=function(n){var d,h,m,g,p=Math.cos,w=Math.sin,x=Math.sqrt,y=Math.atan,k=Math.exp,b=l.CesiumMath.PI_OVER_TWO,I=l.CesiumMath.toRadians,v=n.heightmap,U=n.width,T=n.height,S=n.skirtHeight,P=r.defaultValue(n.isGeographic,!0),E=r.defaultValue(n.ellipsoid,e.Ellipsoid.WGS84),C=1/E.maximumRadius,F=n.nativeRectangle,L=n.rectangle;r.defined(L)?(d=L.west,h=L.south,m=L.east,g=L.north):P?(d=I(F.west),h=I(F.south),m=I(F.east),g=I(F.north)):(d=F.west*C,h=b-2*y(k(-F.south*C)),m=F.east*C,g=b-2*y(k(-F.north*C)));var O=n.relativeToCenter,N=r.defined(O);O=N?O:i.Cartesian3.ZERO;var R=r.defaultValue(n.exaggeration,1),z=r.defaultValue(n.includeWebMercatorT,!1),_=r.defaultValue(n.structure,M.DEFAULT_STRUCTURE),H=r.defaultValue(_.heightScale,M.DEFAULT_STRUCTURE.heightScale),Y=r.defaultValue(_.heightOffset,M.DEFAULT_STRUCTURE.heightOffset),W=r.defaultValue(_.elementsPerHeight,M.DEFAULT_STRUCTURE.elementsPerHeight),X=r.defaultValue(_.stride,M.DEFAULT_STRUCTURE.stride),Z=r.defaultValue(_.elementMultiplier,M.DEFAULT_STRUCTURE.elementMultiplier),j=r.defaultValue(_.isBigEndian,M.DEFAULT_STRUCTURE.isBigEndian),G=e.Rectangle.computeWidth(F),q=e.Rectangle.computeHeight(F),Q=G/(U-1),J=q/(T-1);P||(G*=C,q*=C);var K,$,ee=E.radiiSquared,te=ee.x,ae=ee.y,ie=ee.z,re=65536,ne=-65536,se=u.Transforms.eastNorthUpToFixedFrame(O,E),le=o.Matrix4.inverseTransformation(se,A);z&&(K=c.WebMercatorProjection.geodeticLatitudeToMercatorAngle(h),$=1/(c.WebMercatorProjection.geodeticLatitudeToMercatorAngle(g)-K));var oe=B;oe.x=Number.POSITIVE_INFINITY,oe.y=Number.POSITIVE_INFINITY,oe.z=Number.POSITIVE_INFINITY;var fe=D;fe.x=Number.NEGATIVE_INFINITY,fe.y=Number.NEGATIVE_INFINITY,fe.z=Number.NEGATIVE_INFINITY;var ue=Number.POSITIVE_INFINITY,ce=U*T,de=ce+(S>0?2*U+2*T:0),he=new Array(de),me=new Array(de),ge=new Array(de),pe=z?new Array(de):[],we=0,xe=T,ye=0,ke=U;S>0&&(--we,++xe,--ye,++ke);for(var be=1e-5,Ie=we;Ie<xe;++Ie){var ve=Ie;ve<0&&(ve=0),ve>=T&&(ve=T-1);var Ue=F.north-J*ve,Te=((Ue=P?I(Ue):b-2*y(k(-Ue*C)))-h)/(g-h);Te=l.CesiumMath.clamp(Te,0,1);var Me=Ie===we,Ve=Ie===xe-1;S>0&&(Me?Ue+=be*q:Ve&&(Ue-=be*q));var Ae,Be=p(Ue),De=w(Ue),Se=ie*De;z&&(Ae=(c.WebMercatorProjection.geodeticLatitudeToMercatorAngle(Ue)-K)*$);for(var Pe=ye;Pe<ke;++Pe){var Ee=Pe;Ee<0&&(Ee=0),Ee>=U&&(Ee=U-1);var Ce,Fe,Le=ve*(U*X)+Ee*X;if(1===W)Ce=v[Le];else if(Ce=0,j)for(Fe=0;Fe<W;++Fe)Ce=Ce*Z+v[Le+Fe];else for(Fe=W-1;Fe>=0;--Fe)Ce=Ce*Z+v[Le+Fe];Ce=(Ce*H+Y)*R,ne=Math.max(ne,Ce),re=Math.min(re,Ce);var Oe=F.west+Q*Ee;P?Oe=I(Oe):Oe*=C;var Ne=(Oe-d)/(m-d);Ne=l.CesiumMath.clamp(Ne,0,1);var Re=ve*U+Ee;if(S>0){var ze=Pe===ye,_e=Pe===ke-1,He=Me||Ve||ze||_e;if((Me||Ve)&&(ze||_e))continue;He&&(Ce-=S,ze?(Re=ce+(T-ve-1),Oe-=be*G):Ve?Re=ce+T+(U-Ee-1):_e?(Re=ce+T+U+ve,Oe+=be*G):Me&&(Re=ce+T+U+T+Ee))}var Ye=Be*p(Oe),We=Be*w(Oe),Xe=te*Ye,Ze=ae*We,je=1/x(Xe*Ye+Ze*We+Se*De),Ge=Xe*je,qe=Ze*je,Qe=Se*je,Je=new i.Cartesian3;Je.x=Ge+Ye*Ce,Je.y=qe+We*Ce,Je.z=Qe+De*Ce,he[Re]=Je,me[Re]=Ce,ge[Re]=new e.Cartesian2(Ne,Te),z&&(pe[Re]=Ae),o.Matrix4.multiplyByPoint(le,Je,V),i.Cartesian3.minimumByComponent(V,oe,oe),i.Cartesian3.
|
||
|
/* Copyright 2015-2018 Esri. 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 @preserve */
|
||
|
var S={};!function(){var e,t,a,i,r,n,s,l,o,f,u,c,d,h,m,g,p=(e={defaultNoDataValue:-34027999387901484e22,decode:function(n,s){var l=(s=s||{}).encodedMaskData||null===s.encodedMaskData,o=r(n,s.inputOffset||0,l),f=null!==s.noDataValue?s.noDataValue:e.defaultNoDataValue,u=t(o,s.pixelType||Float32Array,s.encodedMaskData,f,s.returnMask),c={width:o.width,height:o.height,pixelData:u.resultPixels,minValue:u.minValue,maxValue:o.pixels.maxValue,noDataValue:f};return u.resultMask&&(c.maskData=u.resultMask),s.returnEncodedMask&&o.mask&&(c.encodedMaskData=o.mask.bitset?o.mask.bitset:null),s.returnFileInfo&&(c.fileInfo=a(o),s.computeUsedBitDepths&&(c.fileInfo.bitDepths=i(o))),c}},t=function(e,t,a,i,r){var s,l,o,f=0,u=e.pixels.numBlocksX,c=e.pixels.numBlocksY,d=Math.floor(e.width/u),h=Math.floor(e.height/c),m=2*e.maxZError,g=Number.MAX_VALUE;a=a||(e.mask?e.mask.bitset:null),l=new t(e.width*e.height),r&&a&&(o=new Uint8Array(e.width*e.height));for(var p,w,x=new Float32Array(d*h),y=0;y<=c;y++){var k=y!==c?h:e.height%c;if(0!==k)for(var b=0;b<=u;b++){var I=b!==u?d:e.width%u;if(0!==I){var v,U,T,M,V=y*e.width*h+b*d,A=e.width-I,B=e.pixels.blocks[f];if(B.encoding<2?(0===B.encoding?v=B.rawData:(n(B.stuffedData,B.bitsPerPixel,B.numValidPixels,B.offset,m,x,e.pixels.maxValue),v=x),U=0):T=2===B.encoding?0:B.offset,a)for(w=0;w<k;w++){for(7&V&&(M=a[V>>3],M<<=7&V),p=0;p<I;p++)7&V||(M=a[V>>3]),128&M?(o&&(o[V]=1),g=g>(s=B.encoding<2?v[U++]:T)?s:g,l[V++]=s):(o&&(o[V]=0),l[V++]=i),M<<=1;V+=A}else if(B.encoding<2)for(w=0;w<k;w++){for(p=0;p<I;p++)g=g>(s=v[U++])?s:g,l[V++]=s;V+=A}else for(g=g>T?T:g,w=0;w<k;w++){for(p=0;p<I;p++)l[V++]=T;V+=A}if(1===B.encoding&&U!==B.numValidPixels)throw"Block and Mask do not match";f++}}}return{resultPixels:l,resultMask:o,minValue:g}},a=function(e){return{fileIdentifierString:e.fileIdentifierString,fileVersion:e.fileVersion,imageType:e.imageType,height:e.height,width:e.width,maxZError:e.maxZError,eofOffset:e.eofOffset,mask:e.mask?{numBlocksX:e.mask.numBlocksX,numBlocksY:e.mask.numBlocksY,numBytes:e.mask.numBytes,maxValue:e.mask.maxValue}:null,pixels:{numBlocksX:e.pixels.numBlocksX,numBlocksY:e.pixels.numBlocksY,numBytes:e.pixels.numBytes,maxValue:e.pixels.maxValue,noDataValue:e.noDataValue}}},i=function(e){for(var t=e.pixels.numBlocksX*e.pixels.numBlocksY,a={},i=0;i<t;i++){var r=e.pixels.blocks[i];0===r.encoding?a.float32=!0:1===r.encoding?a[r.bitsPerPixel]=!0:a[0]=!0}return Object.keys(a)},r=function(e,t,a){var i={},r=new Uint8Array(e,t,10);if(i.fileIdentifierString=String.fromCharCode.apply(null,r),"CntZImage"!==i.fileIdentifierString.trim())throw"Unexpected file identifier string: "+i.fileIdentifierString;t+=10;var n=new DataView(e,t,24);if(i.fileVersion=n.getInt32(0,!0),i.imageType=n.getInt32(4,!0),i.height=n.getUint32(8,!0),i.width=n.getUint32(12,!0),i.maxZError=n.getFloat64(16,!0),t+=24,!a)if(n=new DataView(e,t,16),i.mask={},i.mask.numBlocksY=n.getUint32(0,!0),i.mask.numBlocksX=n.getUint32(4,!0),i.mask.numBytes=n.getUint32(8,!0),i.mask.maxValue=n.getFloat32(12,!0),t+=16,i.mask.numBytes>0){var s=new Uint8Array(Math.ceil(i.width*i.height/8)),l=(n=new DataView(e,t,i.mask.numBytes)).getInt16(0,!0),o=2,f=0;do{if(l>0)for(;l--;)s[f++]=n.getUint8(o++);else{var u=n.getUint8(o++);for(l=-l;l--;)s[f++]=u}l=n.getInt16(o,!0),o+=2}while(o<i.mask.numBytes);if(-32768!==l||f<s.length)throw"Unexpected end of mask RLE encoding";i.mask.bitset=s,t+=i.mask.numBytes}else 0==(i.mask.numBytes|i.mask.numBlocksY|i.mask.maxValue)&&(i.mask.bitset=new Uint8Array(Math.ceil(i.width*i.height/8)));n=new DataView(e,t,16),i.pixels={},i.pixels.numBlocksY=n.getUint32(0,!0),i.pixels.numBlocksX=n.getUint32(4,!0),i.pixels.numBytes=n.getUint32(8,!0),i.pixels.maxValue=n.getFloat32(12,!0),t+=16;var c=i.pixels.numBlocksX,d=i.pixels.numBlocksY,h=c+(i.width%c>0?1:0),m=d+(i.height%d>0?1:0);i.pixels.blocks=new Array(h*m);for(var g=0,p=0;p<m;p++)for(var w=0;w<h;w++){var x=0,y=e.byteLength-t;n=new DataView(e,t,Math.min(10,y));var k={};i.pixels.blocks[g++]=k;var b=n.getUint8(0);if(x++,k.encoding=63&b,k.encoding>3)throw"Invalid block encoding ("+k.encoding+")";if(2!==k.enco
|