4x/irrigation-monitoring-platf.../public/Cesium/Workers/createGroundPolylineGeometr...

2 lines
18 KiB
JavaScript
Raw Permalink Normal View History

2024-12-26 19:24:07 +08:00
define(["./Transforms-d13cc04e","./Matrix2-9aa31791","./RuntimeError-346a3079","./when-4bbc8319","./ComponentDatatype-93750d1a","./ArcType-98ec98bf","./arrayRemoveDuplicates-18786327","./EllipsoidGeodesic-dd8f2afb","./EllipsoidRhumbLine-30c47ff4","./EncodedCartesian3-f286cedc","./GeometryAttribute-43536dc0","./IntersectionTests-96a04219","./Plane-318d6937","./WebMercatorProjection-58801a11","./combine-83860057","./WebGLConstants-1c8239cc"],(function(e,a,t,n,i,r,s,o,l,u,c,C,p,d,h,g){"use strict";function f(t){t=n.defaultValue(t,n.defaultValue.EMPTY_OBJECT),this._ellipsoid=n.defaultValue(t.ellipsoid,a.Ellipsoid.WGS84),this._rectangle=n.defaultValue(t.rectangle,a.Rectangle.MAX_VALUE),this._projection=new e.GeographicProjection(this._ellipsoid),this._numberOfLevelZeroTilesX=n.defaultValue(t.numberOfLevelZeroTilesX,2),this._numberOfLevelZeroTilesY=n.defaultValue(t.numberOfLevelZeroTilesY,1)}Object.defineProperties(f.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},rectangle:{get:function(){return this._rectangle}},projection:{get:function(){return this._projection}}}),f.prototype.getNumberOfXTilesAtLevel=function(e){return this._numberOfLevelZeroTilesX<<e},f.prototype.getNumberOfYTilesAtLevel=function(e){return this._numberOfLevelZeroTilesY<<e},f.prototype.rectangleToNativeRectangle=function(e,t){var r=i.CesiumMath.toDegrees(e.west),s=i.CesiumMath.toDegrees(e.south),o=i.CesiumMath.toDegrees(e.east),l=i.CesiumMath.toDegrees(e.north);return n.defined(t)?(t.west=r,t.south=s,t.east=o,t.north=l,t):new a.Rectangle(r,s,o,l)},f.prototype.tileXYToNativeRectangle=function(e,a,t,n){var r=this.tileXYToRectangle(e,a,t,n);return r.west=i.CesiumMath.toDegrees(r.west),r.south=i.CesiumMath.toDegrees(r.south),r.east=i.CesiumMath.toDegrees(r.east),r.north=i.CesiumMath.toDegrees(r.north),r},f.prototype.tileXYToRectangle=function(e,t,i,r){var s=this._rectangle,o=this.getNumberOfXTilesAtLevel(i),l=this.getNumberOfYTilesAtLevel(i),u=s.width/o,c=e*u+s.west,C=(e+1)*u+s.west,p=s.height/l,d=s.north-t*p,h=s.north-(t+1)*p;return n.defined(r)||(r=new a.Rectangle(c,h,C,d)),r.west=c,r.south=h,r.east=C,r.north=d,r},f.prototype.positionToTileXY=function(e,t,r){var s=this._rectangle;if(a.Rectangle.contains(s,e)){var o=this.getNumberOfXTilesAtLevel(t),l=this.getNumberOfYTilesAtLevel(t),u=s.width/o,c=s.height/l,C=e.longitude;s.east<s.west&&(C+=i.CesiumMath.TWO_PI);var p=(C-s.west)/u|0;p>=o&&(p=o-1);var d=(s.north-e.latitude)/c|0;return d>=l&&(d=l-1),n.defined(r)?(r.x=p,r.y=d,r):new a.Cartesian2(p,d)}};var m=new a.Cartesian3,w=new a.Cartesian3,v=new a.Cartographic,y=new a.Cartesian3,M=new a.Cartesian3,T=new e.BoundingSphere,E=new f,_=[new a.Cartographic,new a.Cartographic,new a.Cartographic,new a.Cartographic],O=new a.Cartesian2,P={};function b(e){a.Cartographic.fromRadians(e.east,e.north,0,_[0]),a.Cartographic.fromRadians(e.west,e.north,0,_[1]),a.Cartographic.fromRadians(e.east,e.south,0,_[2]),a.Cartographic.fromRadians(e.west,e.south,0,_[3]);var t,n=0,i=0,r=0,s=0,o=P._terrainHeightsMaxLevel;for(t=0;t<=o;++t){for(var l=!1,u=0;u<4;++u){var c=_[u];if(E.positionToTileXY(c,t,O),0===u)r=O.x,s=O.y;else if(r!==O.x||s!==O.y){l=!0;break}}if(l)break;n=r,i=s}if(0!==t)return{x:n,y:i,level:t>o?o:t-1}}P.initialize=function(){var a=P._initPromise;return n.defined(a)||(a=e.Resource.fetchJson(e.buildModuleUrl("Assets/approximateTerrainHeights.json")).then((function(e){P._terrainHeights=e})),P._initPromise=a),a},P.getMinimumMaximumHeights=function(e,t){t=n.defaultValue(t,a.Ellipsoid.WGS84);var i=b(e),r=P._defaultMinTerrainHeight,s=P._defaultMaxTerrainHeight;if(n.defined(i)){var o=i.level+"-"+i.x+"-"+i.y,l=P._terrainHeights[o];n.defined(l)&&(r=l[0],s=l[1]),t.cartographicToCartesian(a.Rectangle.northeast(e,v),m),t.cartographicToCartesian(a.Rectangle.southwest(e,v),w),a.Cartesian3.midpoint(w,m,y);var u=t.scaleToGeodeticSurface(y,M);if(n.defined(u)){var c=a.Cartesian3.distance(y,u);r=Math.min(r,-c)}else r=P._defaultMinTerrainHeight}return{minimumTerrainHeight:r=Math.max(P._defaultMinTerrainHeight,r),maximumTerrainHeight:s}},P.getBoundingSphere=function(t,i){i=n.defaultV