2 lines
6.3 KiB
JavaScript
2 lines
6.3 KiB
JavaScript
|
/* 2020-9-22 15:23:25 | 版权所有 军懋国兴 */
|
||
|
define(["./when-cbf8cd21","./Check-35e1a91d","./Math-69007a69","./Cartesian2-43e3a3be","./Transforms-2d1ac5ec","./RuntimeError-f4c64df1","./WebGLConstants-95ceb4e9","./ComponentDatatype-607c9a0c","./GeometryAttribute-2303bbfb","./GeometryAttributes-90846c5f","./AttributeCompression-ea810287","./GeometryPipeline-1ea64cde","./EncodedCartesian3-29a09d7b","./IndexDatatype-79bb407c","./IntersectionTests-459f6f08","./Plane-46b5436f","./VertexFormat-fe64931e","./GeometryInstance-6264cc0f","./arrayRemoveDuplicates-d96adeb6","./BoundingRectangle-943d30f6","./EllipsoidTangentPlane-b5927ee3","./OrientedBoundingBox-5e0b7a7c","./CoplanarPolygonGeometryLibrary-77345aa0","./ArcType-2b58731c","./EllipsoidRhumbLine-357c11e7","./PolygonPipeline-2ee85025","./PolygonGeometryLibrary-bcb33f68"],function(l,p,V,R,I,e,t,M,H,B,a,w,n,O,r,o,c,A,F,i,s,y,G,u,m,z,L){"use strict";var S=new R.Cartesian3,E=new i.BoundingRectangle,N=new R.Cartesian2,Q=new R.Cartesian2,k=new R.Cartesian3,T=new R.Cartesian3,D=new R.Cartesian3,_=new R.Cartesian3,j=new R.Cartesian3,U=new R.Cartesian3,Y=new I.Quaternion,q=new I.Matrix3,J=new I.Matrix3,W=new R.Cartesian3;function d(e){var t=(e=l.defaultValue(e,l.defaultValue.EMPTY_OBJECT)).polygonHierarchy;p.Check.defined("options.polygonHierarchy",t);var a=l.defaultValue(e.vertexFormat,c.VertexFormat.DEFAULT);this._vertexFormat=c.VertexFormat.clone(a),this._polygonHierarchy=t,this._stRotation=l.defaultValue(e.stRotation,0),this._ellipsoid=R.Ellipsoid.clone(l.defaultValue(e.ellipsoid,R.Ellipsoid.WGS84)),this._workerName="createCoplanarPolygonGeometry",this.packedLength=L.PolygonGeometryLibrary.computeHierarchyPackedLength(t)+c.VertexFormat.packedLength+R.Ellipsoid.packedLength+2}d.fromPositions=function(e){return e=l.defaultValue(e,l.defaultValue.EMPTY_OBJECT),p.Check.defined("options.positions",e.positions),new d({polygonHierarchy:{positions:e.positions},vertexFormat:e.vertexFormat,stRotation:e.stRotation,ellipsoid:e.ellipsoid})},d.pack=function(e,t,a){return p.Check.typeOf.object("value",e),p.Check.defined("array",t),a=l.defaultValue(a,0),a=L.PolygonGeometryLibrary.packPolygonHierarchy(e._polygonHierarchy,t,a),R.Ellipsoid.pack(e._ellipsoid,t,a),a+=R.Ellipsoid.packedLength,c.VertexFormat.pack(e._vertexFormat,t,a),a+=c.VertexFormat.packedLength,t[a++]=e._stRotation,t[a]=e.packedLength,t};var g=R.Ellipsoid.clone(R.Ellipsoid.UNIT_SPHERE),b=new c.VertexFormat,h={polygonHierarchy:{}};return d.unpack=function(e,t,a){p.Check.defined("array",e),t=l.defaultValue(t,0);var n=L.PolygonGeometryLibrary.unpackPolygonHierarchy(e,t);t=n.startingIndex,delete n.startingIndex;var r=R.Ellipsoid.unpack(e,t,g);t+=R.Ellipsoid.packedLength;var o=c.VertexFormat.unpack(e,t,b);t+=c.VertexFormat.packedLength;var i=e[t++],s=e[t];return l.defined(a)||(a=new d(h)),a._polygonHierarchy=n,a._ellipsoid=R.Ellipsoid.clone(r,a._ellipsoid),a._vertexFormat=c.VertexFormat.clone(o,a._vertexFormat),a._stRotation=i,a.packedLength=s,a},d.createGeometry=function(e){var t=e._vertexFormat,a=e._polygonHierarchy,n=e._stRotation,r=a.positions;if(!((r=F.arrayRemoveDuplicates(r,R.Cartesian3.equalsEpsilon,!0)).length<3)){var o=k,i=T,s=D,l=j,p=U;if(G.CoplanarPolygonGeometryLibrary.computeProjectTo2DArguments(r,_,l,p)){var c,o=R.Cartesian3.cross(l,p,o);o=R.Cartesian3.normalize(o,o),R.Cartesian3.equalsEpsilon(_,R.Cartesian3.ZERO,V.CesiumMath.EPSILON6)||(c=e._ellipsoid.geodeticSurfaceNormal(_,W),R.Cartesian3.dot(o,c)<0&&(o=R.Cartesian3.negate(o,o),l=R.Cartesian3.negate(l,l)));var y=G.CoplanarPolygonGeometryLibrary.createProjectPointsTo2DFunction(_,l,p),u=G.CoplanarPolygonGeometryLibrary.createProjectPointTo2DFunction(_,l,p);t.tangent&&(i=R.Cartesian3.clone(l,i)),t.bitangent&&(s=R.Cartesian3.clone(p,s));var m=L.PolygonGeometryLibrary.polygonsFromHierarchy(a,y,!1),d=m.hierarchy,g=m.polygons;if(0!==d.length){r=d[0].outerRing;for(var b=I.BoundingSphere.fromPoints(r),h=L.PolygonGeometryLibrary.computeBoundingRectangle(o,u,r,n,E),v=[],f=0;f<g.length;f++){var C=new A.GeometryInstance({geometry:function(e,t,a,n,r,o,i,s){var l=e.positions,p=z.PolygonPipeline.triangulate(e.positions2D,e.holes)
|