Files
td_official/public/sdk/Cesium/Workers/createGroundPolylineGeometry.js

26 lines
20 KiB
JavaScript
Raw Permalink Normal View History

2025-07-29 11:22:30 +08:00
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.98
*
* Copyright 2011-2022 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/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
define(["./Transforms-c9e418cb","./Matrix2-cf4c6e69","./defaultValue-50f7432c","./ComponentDatatype-9b23164a","./ArcType-24f44850","./arrayRemoveDuplicates-fd3a3f4e","./EllipsoidGeodesic-759beff8","./EllipsoidRhumbLine-0cc30625","./EncodedCartesian3-0b8c686b","./GeometryAttribute-b84ffce6","./IntersectionTests-d662a125","./Plane-b9f0711b","./WebMercatorProjection-019b6547","./combine-8462e002","./RuntimeError-48e1f06d","./WebGLConstants-58abc51a"],(function(e,t,a,n,i,r,s,o,l,c,u,C,d,h,p,f){"use strict";function g(n){n=a.defaultValue(n,a.defaultValue.EMPTY_OBJECT),a.defined(n.tileInfo)&&a.defined(n.tileInfo.spatialReference)&&a.defined(n.tileInfo.spatialReference.wkid)&&4490==n.tileInfo.spatialReference.wkid?(this._tileInfo=n.tileInfo,this._ellipsoid=a.defaultValue(n.ellipsoid,t.Ellipsoid.CGCS2000),this._rectangle=a.defaultValue(n.rectangle,t.Rectangle.fromDegrees(-180,-90,180,90)),this._numberOfLevelZeroTilesX=a.defaultValue(n.numberOfLevelZeroTilesX,4),this._numberOfLevelZeroTilesY=a.defaultValue(n.numberOfLevelZeroTilesY,2)):(this._ellipsoid=a.defaultValue(n.ellipsoid,t.Ellipsoid.WGS84),this._rectangle=a.defaultValue(n.rectangle,t.Rectangle.MAX_VALUE),this._numberOfLevelZeroTilesX=a.defaultValue(n.numberOfLevelZeroTilesX,2),this._numberOfLevelZeroTilesY=a.defaultValue(n.numberOfLevelZeroTilesY,1)),this._projection=new e.GeographicProjection(this._ellipsoid)}Object.defineProperties(g.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},rectangle:{get:function(){return this._rectangle}},projection:{get:function(){return this._projection}}}),g.prototype.getNumberOfXTilesAtLevel=function(e){if(a.defined(this._tileInfo)){var t=this._tileInfo.lods.filter((function(t){return t.level===e}))[0].resolution;return Math.round(n.CesiumMath.toDegrees(n.CesiumMath.TWO_PI)/(this._tileInfo.rows*t))}return this._numberOfLevelZeroTilesX<<e},g.prototype.getNumberOfYTilesAtLevel=function(e){if(a.defined(this._tileInfo)){var t=this._tileInfo.lods.filter((function(t){return t.level===e}))[0].resolution;return Math.round(n.CesiumMath.toDegrees(n.CesiumMath.TWO_PI/2)/(this._tileInfo.cols*t))}return this._numberOfLevelZeroTilesY<<e},g.prototype.rectangleToNativeRectangle=function(e,i){const r=n.CesiumMath.toDegrees(e.west),s=n.CesiumMath.toDegrees(e.south),o=n.CesiumMath.toDegrees(e.east),l=n.CesiumMath.toDegrees(e.north);return a.defined(i)?(i.west=r,i.south=s,i.east=o,i.north=l,i):new t.Rectangle(r,s,o,l)},g.prototype.tileXYToNativeRectangle=function(e,t,a,i){const r=this.tileXYToRectangle(e,t,a,i);return r.west=n.CesiumMath.toDegrees(r.west),r.south=n.CesiumMath.toDegrees(r.south),r.east=n.CesiumMath.toDegrees(r.east),r.north=n.CesiumMath.toDegrees(r.north),r},g.prototype.tileXYToRectangle=function(e,n,i,r){const s=this._rectangle,o=this.getNumberOfXTilesAtLevel(i),l=this.getNumberOfYTilesAtLevel(i),c=s.width/o,u=e*c+s.west,C=(e+1)*c+s.west,d=s.height/l,h=s.north-n*d,p=s.north-(n+1)*d;return a.defined(r)||(r=new t.Rectangle(u,p,C,h)),r.west=u,r.south=p,r.east=C,r.north=h,r},g.prototype.positionToTileXY=function(e,i,r){const s=this._rectangle;if(!t.Rectangle.contains(s,e))return;const o=this.getNumberOfXTilesAtLevel(i),l=this.getNumberOfYTilesAtLevel(i),c=s.width/o,u=s.height/l;let C=e.longitude;s.east<s.west&&(C+=n.CesiumMath.TWO_PI);let d=(C-s.west)/c|0;d>=o&&(d=o-1);let h=(s.north-e.latitude)/u|0;return h>=l&&(h=l-1),a.defined(r)?(r.x=d,r.y=h,r):new t.Cartesian2(d,h)};const m=new t.Cartesian3,w=new t.Cartesian3,y=new t.Cartographic,M=new t.Cartesian3,T=new t.Cartesian3,_=new e.BoundingSphere,E=new g,O=[new t.Cartographic,new t.Cartographic,new t.Cartographic,new t.Cartographic],b=new t.Cartesian2,I={};function P(e){t.Cartographic.fromRadians(e.east,e.north,0,O[0]),t.Cartographic.fromRadians(e.west,e.north,0,O[1]),t.Cartographic.fromRadians(e.east,e.south,0,O[2]),t.Cartographic.fromRadians(e.west,e.south,0,O[3]);let a=0,n=0,i=0,r=0;const s=I._terrainHeightsMaxLevel;let o;for(o=0;o<=s;++o){let e=!1;for(let t=0;t<4;++t){const a=O[t];if(E.positionToTileXY(a,o,b),0===t)i=b.x,r=b.y;else if(i!==b.x||r!==b.y){e=!0;break}}if(e)break;a=i,n