27 lines
44 KiB
JavaScript
27 lines
44 KiB
JavaScript
|
define(["exports","./Cartographic-3309dd0d","./Check-7b2a090c","./when-b60132fc","./Cartesian2-47311507","./Math-119be1a3","./PrimitiveType-a54dc62f","./Event-16a2dfbf","./RuntimeError-4a5c8994"],(function(e,t,r,n,a,i,s,o,u){"use strict";function c(e){this._ellipsoid=n.defaultValue(e,a.Ellipsoid.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis}Object.defineProperties(c.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),c.prototype.project=function(e,r){var a=this._semimajorAxis,i=e.longitude*a,s=e.latitude*a,o=e.height;return n.defined(r)?(r.x=i,r.y=s,r.z=o,r):new t.Cartesian3(i,s,o)},c.prototype.unproject=function(e,r){var a=this._oneOverSemimajorAxis,i=e.x*a,s=e.y*a,o=e.z;return n.defined(r)?(r.longitude=i,r.latitude=s,r.height=o,r):new t.Cartographic(i,s,o)};var d=Object.freeze({OUTSIDE:-1,INTERSECTING:0,INSIDE:1});function f(e,t){this.start=n.defaultValue(e,0),this.stop=n.defaultValue(t,0)}function l(e,r){this.center=t.Cartesian3.clone(n.defaultValue(e,t.Cartesian3.ZERO)),this.radius=n.defaultValue(r,0)}var p=new t.Cartesian3,h=new t.Cartesian3,m=new t.Cartesian3,y=new t.Cartesian3,v=new t.Cartesian3,C=new t.Cartesian3,g=new t.Cartesian3,q=new t.Cartesian3,w=new t.Cartesian3,b=new t.Cartesian3,R=new t.Cartesian3,x=new t.Cartesian3,A=4/3*i.CesiumMath.PI;l.fromPoints=function(e,r){if(n.defined(r)||(r=new l),!n.defined(e)||0===e.length)return r.center=t.Cartesian3.clone(t.Cartesian3.ZERO,r.center),r.radius=0,r;var a,i=t.Cartesian3.clone(e[0],g),s=t.Cartesian3.clone(i,p),o=t.Cartesian3.clone(i,h),u=t.Cartesian3.clone(i,m),c=t.Cartesian3.clone(i,y),d=t.Cartesian3.clone(i,v),f=t.Cartesian3.clone(i,C),A=e.length;for(a=1;a<A;a++){t.Cartesian3.clone(e[a],i);var O=i.x,E=i.y,S=i.z;O<s.x&&t.Cartesian3.clone(i,s),O>c.x&&t.Cartesian3.clone(i,c),E<o.y&&t.Cartesian3.clone(i,o),E>d.y&&t.Cartesian3.clone(i,d),S<u.z&&t.Cartesian3.clone(i,u),S>f.z&&t.Cartesian3.clone(i,f)}var _=t.Cartesian3.magnitudeSquared(t.Cartesian3.subtract(c,s,q)),I=t.Cartesian3.magnitudeSquared(t.Cartesian3.subtract(d,o,q)),T=t.Cartesian3.magnitudeSquared(t.Cartesian3.subtract(f,u,q)),P=s,k=c,U=_;I>U&&(U=I,P=o,k=d),T>U&&(U=T,P=u,k=f);var B=w;B.x=.5*(P.x+k.x),B.y=.5*(P.y+k.y),B.z=.5*(P.z+k.z);var z=t.Cartesian3.magnitudeSquared(t.Cartesian3.subtract(k,B,q)),D=Math.sqrt(z),V=b;V.x=s.x,V.y=o.y,V.z=u.z;var j=R;j.x=c.x,j.y=d.y,j.z=f.z;var L=t.Cartesian3.midpoint(V,j,x),M=0;for(a=0;a<A;a++){t.Cartesian3.clone(e[a],i);var K=t.Cartesian3.magnitude(t.Cartesian3.subtract(i,L,q));K>M&&(M=K);var N=t.Cartesian3.magnitudeSquared(t.Cartesian3.subtract(i,B,q));if(N>z){var F=Math.sqrt(N);z=(D=.5*(D+F))*D;var H=F-D;B.x=(D*B.x+H*i.x)/F,B.y=(D*B.y+H*i.y)/F,B.z=(D*B.z+H*i.z)/F}}return D<M?(t.Cartesian3.clone(B,r.center),r.radius=D):(t.Cartesian3.clone(L,r.center),r.radius=M),r};var O=new c,E=new t.Cartesian3,S=new t.Cartesian3,_=new t.Cartographic,I=new t.Cartographic;l.fromRectangle2D=function(e,t,r){return l.fromRectangleWithHeights2D(e,t,0,0,r)},l.fromRectangleWithHeights2D=function(e,r,i,s,o){if(n.defined(o)||(o=new l),!n.defined(e))return o.center=t.Cartesian3.clone(t.Cartesian3.ZERO,o.center),o.radius=0,o;r=n.defaultValue(r,O),a.Rectangle.southwest(e,_),_.height=i,a.Rectangle.northeast(e,I),I.height=s;var u=r.project(_,E),c=r.project(I,S),d=c.x-u.x,f=c.y-u.y,p=c.z-u.z;o.radius=.5*Math.sqrt(d*d+f*f+p*p);var h=o.center;return h.x=u.x+.5*d,h.y=u.y+.5*f,h.z=u.z+.5*p,o};var T=[];l.fromRectangle3D=function(e,r,i,s){if(r=n.defaultValue(r,a.Ellipsoid.WGS84),i=n.defaultValue(i,0),n.defined(s)||(s=new l),!n.defined(e))return s.center=t.Cartesian3.clone(t.Cartesian3.ZERO,s.center),s.radius=0,s;var o=a.Rectangle.subsample(e,r,i,T);return l.fromPoints(o,s)},l.fromVertices=function(e,r,a,i){if(n.defined(i)||(i=new l),!n.defined(e)||0===e.length)return i.center=t.Cartesian3.clone(t.Cartesian3.ZERO,i.center),i.radius=0,i;r=n.defaultValue(r,t.Cartesian3.ZERO),a=n.defaultValue(a,3);var s=g;s.x=e[0]+r.x,s.y=e[1]+r.y,s.z=e[2]+r.z;var o,u=t.Cartesian3.clone(s,p),c=t.Cartesian3.clone(s,h),d=t.Cartesian3.clone(s,m),f=t.Cartesian3.
|
||
|
/**
|
||
|
* @license
|
||
|
*
|
||
|
* Grauw URI utilities
|
||
|
*
|
||
|
* See: http://hg.grauw.nl/grauw-lib/file/tip/src/uri.js
|
||
|
*
|
||
|
* @author Laurens Holst (http://www.grauw.nl/)
|
||
|
*
|
||
|
* Copyright 2012 Laurens Holst
|
||
|
*
|
||
|
* 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.
|
||
|
*
|
||
|
*/
|
||
|
function Q(e){if(e instanceof Q)this.scheme=e.scheme,this.authority=e.authority,this.path=e.path,this.query=e.query,this.fragment=e.fragment;else if(e){var t=Z.exec(e);this.scheme=t[1],this.authority=t[2],this.path=t[3],this.query=t[4],this.fragment=t[5]}}l.projectTo2D=function(e,r,a){var i,s=(r=n.defaultValue(r,X)).ellipsoid,o=e.center,u=e.radius;i=t.Cartesian3.equals(o,t.Cartesian3.ZERO)?t.Cartesian3.clone(t.Cartesian3.UNIT_X,M):s.geodeticSurfaceNormal(o,M);var c=t.Cartesian3.cross(t.Cartesian3.UNIT_Z,i,K);t.Cartesian3.normalize(c,c);var d=t.Cartesian3.cross(i,c,N);t.Cartesian3.normalize(d,d),t.Cartesian3.multiplyByScalar(i,u,i),t.Cartesian3.multiplyByScalar(d,u,d),t.Cartesian3.multiplyByScalar(c,u,c);var f=t.Cartesian3.negate(d,H),p=t.Cartesian3.negate(c,F),h=J,m=h[0];t.Cartesian3.add(i,d,m),t.Cartesian3.add(m,c,m),m=h[1],t.Cartesian3.add(i,d,m),t.Cartesian3.add(m,p,m),m=h[2],t.Cartesian3.add(i,f,m),t.Cartesian3.add(m,p,m),m=h[3],t.Cartesian3.add(i,f,m),t.Cartesian3.add(m,c,m),t.Cartesian3.negate(i,i),m=h[4],t.Cartesian3.add(i,d,m),t.Cartesian3.add(m,c,m),m=h[5],t.Cartesian3.add(i,d,m),t.Cartesian3.add(m,p,m),m=h[6],t.Cartesian3.add(i,f,m),t.Cartesian3.add(m,p,m),m=h[7],t.Cartesian3.add(i,f,m),t.Cartesian3.add(m,c,m);for(var y=h.length,v=0;v<y;++v){var C=h[v];t.Cartesian3.add(o,C,C);var g=s.cartesianToCartographic(C,Y);r.project(g,C)}var q=(o=(a=l.fromPoints(h,a)).center).x,w=o.y,b=o.z;return o.x=b,o.y=q,o.z=w,a},l.isOccluded=function(e,t){return!t.isBoundingSphereVisible(e)},l.equals=function(e,r){return e===r||n.defined(e)&&n.defined(r)&&t.Cartesian3.equals(e.center,r.center)&&e.radius===r.radius},l.prototype.intersectPlane=function(e){return l.intersectPlane(this,e)},l.prototype.distanceSquaredTo=function(e){return l.distanceSquaredTo(this,e)},l.prototype.computePlaneDistances=function(e,t,r){return l.computePlaneDistances(this,e,t,r)},l.prototype.isOccluded=function(e){return l.isOccluded(this,e)},l.prototype.equals=function(e){return l.equals(this,e)},l.prototype.clone=function(e){return l.clone(this,e)},l.prototype.volume=function(){var e=this.radius;return A*e*e*e},Q.prototype.scheme=null,Q.prototype.authority=null,Q.prototype.path="",Q.prototype.query=null,Q.prototype.fragment=null;var Z=new RegExp("^(?:([^:/?#]+):)?(?://([^/?#]*))?([^?#]*)(?:\\?([^#]*))?(?:#(.*))?$");Q.prototype.getScheme=function(){return this.scheme},Q.prototype.getAuthority=function(){return this.authority},Q.prototype.getPath=function(){return this.path},Q.prototype.getQuery=function(){return this.query},Q.prototype.getFragment=function(){return this.fragment},Q.prototype.isAbsolute=function(){return!!this.scheme&&!this.fragment},Q.prototype.isSameDocumentAs=function(e){return e.scheme==this.scheme&&e.authority==this.authority&&e.path==this.path&&e.query==this.query},Q.prototype.equals=function(e){return this.isSameDocumentAs(e)&&e.fragment==this.fragment},Q.prototype.normalize=function(){this.removeDotSegments(),this.scheme&&(this.scheme=this.scheme.toLowerCase()),this.authority&&(this.authority=this.authority.replace(ee,re).replace(W,te)),this.path&&(this.path=this.path.replace(W,te)),this.query&&(this.query=this.query.replace(W,te)),this.fragment&&(this.fragment=this.fragment.replace(W,te))};var W=/%[0-9a-z]{2}/gi,$=/[a-zA-Z0-9\-\._~]/,ee=/(.*@)?([^@:]*)(:.*)?/;function te(e){var t=unescape(e);return $.test(t)?t:e.toUpperCase()}function re(e,t,r,n){return(t||"")+r.toLowerCase()+(n||"")}function ne(e,t){if(null===e||"object"!=typeof e)return e;t=n.defaultValue(t,!1);var r=new e.constructor;for(var a in e)if(e.hasOwnProperty(a)){var i=e[a];t&&(i=ne(i,t)),r[a]=i}return r}function ae(e,t,r){r=n.defaultValue(r,!1);var a,i,s,o={},u=n.defined(e),c=n.defined(t);if(u)for(a in e)e.hasOwnProperty(a)&&(i=e[a],c&&r&&"object"==typeof i&&t.hasOwnProperty(a)?(s=t[a],o[a]="object"==typeof s?ae(i,s,r):i):o[a]=i);if(c)for(a in t)t.hasOwnProperty(a)&&!o.hasOwnProperty(a)&&(s=t[a],o[a]=s);return o}function ie(e,t){var r;return"undefined"!=typeof document&&(r=document),ie._implementation(e,t,r)}Q.prototype.resolve=function(e){var t=new Q;return this.scheme
|