1 |
- define(["exports","./Transforms-98ffa11d","./ComponentDatatype-aaeec80f","./defaultValue-81eec7ed","./Check-741c5f3c","./Matrix2-e3fb4559","./GeometryAttribute-b025f9a8","./GeometryAttributes-32b29525","./GeometryPipeline-4b426993","./IndexDatatype-f1e3f799","./Matrix4-d34187af","./WebMercatorProjection-f5706bbf","./Cartesian3-7e9cc2ff"],(function(e,t,n,r,o,i,s,a,d,c,p,f,u){"use strict";function m(e,t,n){e=r.defaultValue(e,0),t=r.defaultValue(t,0),n=r.defaultValue(n,0),this.value=new Float32Array([e,t,n])}function l(e,t,n){let o=!n;const i=e.length;let s;if(!o&&i>1){const t=e[0].modelMatrix;for(s=1;s<i;++s)if(!p.Matrix4.equals(t,e[s].modelMatrix)){o=!0;break}}if(o)for(s=0;s<i;++s)r.defined(e[s].geometry)&&d.GeometryPipeline.transformToWorldCoordinates(e[s]);else p.Matrix4.multiplyTransformation(t,e[0].modelMatrix,t)}function h(e,t){const r=e.attributes,o=r.position,i=o.values.length/o.componentsPerAttribute;r.batchId=new s.GeometryAttribute({componentDatatype:n.ComponentDatatype.FLOAT,componentsPerAttribute:1,values:new Float32Array(i)});const a=r.batchId.values;for(let e=0;e<i;++e)a[e]=t}function g(e){const t=e.length;for(let n=0;n<t;++n){const t=e[n];r.defined(t.geometry)?h(t.geometry,n):r.defined(t.westHemisphereGeometry)&&r.defined(t.eastHemisphereGeometry)&&(h(t.westHemisphereGeometry,n),h(t.eastHemisphereGeometry,n))}}function y(e,t,n,o){let i,s,a;const d=o.length-1;if(d>=0){const e=o[d];i=e.offset+e.count,a=e.index,s=n[a].indices.length}else i=0,a=0,s=n[a].indices.length;const c=e.length;for(let d=0;d<c;++d){const c=e[d][t];if(!r.defined(c))continue;const p=c.indices.length;i+p>s&&(i=0,s=n[++a].indices.length),o.push({index:a,offset:i,count:p}),i+=p}}function b(e,t){const n=[];return y(e,"geometry",t,n),y(e,"westHemisphereGeometry",t,n),y(e,"eastHemisphereGeometry",t,n),n}Object.defineProperties(m.prototype,{componentDatatype:{get:function(){return n.ComponentDatatype.FLOAT}},componentsPerAttribute:{get:function(){return 3}},normalize:{get:function(){return!1}}}),m.fromCartesian3=function(e){return new m(e.x,e.y,e.z)},m.toValue=function(e,t){return r.defined(t)||(t=new Float32Array([e.x,e.y,e.z])),t[0]=e.x,t[1]=e.y,t[2]=e.z,t};const x={};function P(e,t){const n=e.attributes;for(const e in n)if(n.hasOwnProperty(e)){const o=n[e];r.defined(o)&&r.defined(o.values)&&t.push(o.values.buffer)}r.defined(e.indices)&&t.push(e.indices.buffer)}function G(e,t){const n=e.length,o=new Float64Array(1+19*n);let i=0;o[i++]=n;for(let t=0;t<n;t++){const n=e[t];if(p.Matrix4.pack(n.modelMatrix,o,i),i+=p.Matrix4.packedLength,r.defined(n.attributes)&&r.defined(n.attributes.offset)){const e=n.attributes.offset.value;o[i]=e[0],o[i+1]=e[1],o[i+2]=e[2]}i+=3}return t.push(o.buffer),o}function S(e){const n=e.length,o=1+(t.BoundingSphere.packedLength+1)*n,i=new Float32Array(o);let s=0;i[s++]=n;for(let o=0;o<n;++o){const n=e[o];r.defined(n)?(i[s++]=1,t.BoundingSphere.pack(e[o],i,s)):i[s++]=0,s+=t.BoundingSphere.packedLength}return i}function C(e){const n=new Array(e[0]);let r=0,o=1;for(;o<e.length;)1===e[o++]&&(n[r]=t.BoundingSphere.unpack(e,o)),++r,o+=t.BoundingSphere.packedLength;return n}x.combineGeometry=function(e){let o,i;const s=e.instances,a=s.length;let c,p,f=!1;a>0&&(o=function(e){const o=e.instances,i=e.projection,s=e.elementIndexUintSupported,a=e.scene3DOnly,c=e.vertexCacheOptimize,p=e.compressVertices,f=e.modelMatrix;var u=e.isfromGLP;let m,h,y=o.length;for(m=0;m<y;++m)if(r.defined(o[m].geometry)){o[m].geometry.primitiveType;break}if(l(o,f,a),!a)for(m=0;m<y;++m)r.defined(o[m].geometry)&&d.GeometryPipeline.splitLongitude(o[m]);if(g(o),c)for(m=0;m<y;++m){const e=o[m];r.defined(e.geometry)?(d.GeometryPipeline.reorderForPostVertexCache(e.geometry),d.GeometryPipeline.reorderForPreVertexCache(e.geometry)):r.defined(e.westHemisphereGeometry)&&r.defined(e.eastHemisphereGeometry)&&(d.GeometryPipeline.reorderForPostVertexCache(e.westHemisphereGeometry),d.GeometryPipeline.reorderForPreVertexCache(e.westHemisphereGeometry),d.GeometryPipeline.reorderForPostVertexCache(e.eastHemisphereGeometry),d.GeometryPipeline.reorderForPreVertexCache(e.eastHemisphereGeometry))}let b=d.GeometryPipeline.combineInstances(o);for(y=b.length,m=0;m<y;++m){h=b[m];const e=h.attributes;if(a){if(!u)for(const t in e)e.hasOwnProperty(t)&&e[t].componentDatatype===n.ComponentDatatype.DOUBLE&&d.GeometryPipeline.encodeAttribute(h,t,t+"3DHigh",t+"3DLow")}else for(const o in e)if(e.hasOwnProperty(o)&&e[o].componentDatatype===n.ComponentDatatype.DOUBLE){const e=o+"3D",n=o+"2D";d.GeometryPipeline.projectTo2D(h,o,e,n,i),r.defined(h.boundingSphere)&&"position"===o&&(h.boundingSphereCV=t.BoundingSphere.fromVertices(h.attributes.position2D.values)),d.GeometryPipeline.encodeAttribute(h,e,e+"High",e+"Low"),d.GeometryPipeline.encodeAttribute(h,n,n+"High",n+"Low")}p&&d.GeometryPipeline.compressVertices(h)}if(!s){let e=[];for(y=b.length,m=0;m<y;++m)h=b[m],e=e.concat(d.GeometryPipeline.fitToUnsignedShortIndices(h));b=e}return b}(e),o.length>0&&(i=d.GeometryPipeline.createAttributeLocations(o[0]),e.createPickOffsets&&(c=b(s,o))),r.defined(s[0].attributes)&&r.defined(s[0].attributes.offset)&&(p=new Array(a),f=!0));const u=new Array(a),m=new Array(a);var h=new Array(a);for(let e=0;e<a;++e){const n=s[e],o=n.geometry;r.defined(o)&&(u[e]=o.boundingSphere,m[e]=o.boundingSphereCV,h[e]=[o.MaxPoint,o.MinPoint],f&&(p[e]=n.geometry.offsetAttribute));const i=n.eastHemisphereGeometry,a=n.westHemisphereGeometry;r.defined(i)&&r.defined(a)&&(r.defined(i.boundingSphere)&&r.defined(a.boundingSphere)&&(u[e]=t.BoundingSphere.union(i.boundingSphere,a.boundingSphere)),r.defined(i.boundingSphereCV)&&r.defined(a.boundingSphereCV)&&(m[e]=t.BoundingSphere.union(i.boundingSphereCV,a.boundingSphereCV)))}return{geometries:o,modelMatrix:e.modelMatrix,attributeLocations:i,pickOffsets:c,offsetInstanceExtend:p,boundingSpheres:u,boundingSpheresCV:m,MaxMinArr:h}},x.combineGeometryNonCompressed=function(e){var n,o,i,s,a=e.instances,c=a.length,p=!1;c>0&&(n=function(e){var t=e.instances;e.projection,e.elementIndexUintSupported;var n=e.scene3DOnly,o=e.vertexCacheOptimize;e.compressVertices;var i,s=e.modelMatrix,a=t.length;for(i=0;i<a;++i)if(r.defined(t[i].geometry)){t[i].geometry.primitiveType;break}if(l(t,s,n),!n)for(i=0;i<a;++i)r.defined(t[i].geometry)&&d.GeometryPipeline.splitLongitude(t[i]);if(g(t),o)for(i=0;i<a;++i){var c=t[i];r.defined(c.geometry)?(d.GeometryPipeline.reorderForPostVertexCache(c.geometry),d.GeometryPipeline.reorderForPreVertexCache(c.geometry)):r.defined(c.westHemisphereGeometry)&&r.defined(c.eastHemisphereGeometry)&&(d.GeometryPipeline.reorderForPostVertexCache(c.westHemisphereGeometry),d.GeometryPipeline.reorderForPreVertexCache(c.westHemisphereGeometry),d.GeometryPipeline.reorderForPostVertexCache(c.eastHemisphereGeometry),d.GeometryPipeline.reorderForPreVertexCache(c.eastHemisphereGeometry))}return d.GeometryPipeline.combineInstances(t)}(e),n.length>0&&(o=d.GeometryPipeline.createAttributeLocations(n[0]),e.createPickOffsets&&(i=b(a,n))),r.defined(a[0].attributes)&&r.defined(a[0].attributes.offset)&&(s=new Array(c),p=!0));for(var f=new Array(c),u=new Array(c),m=new Array(c),h=0;h<c;++h){var y=a[h],x=y.geometry;r.defined(x)&&(f[h]=x.boundingSphere,u[h]=x.boundingSphereCV,m[h]=[x.MaxPoint,x.MinPoint],p&&(s[h]=y.geometry.offsetAttribute));var P=y.eastHemisphereGeometry,G=y.westHemisphereGeometry;r.defined(P)&&r.defined(G)&&(r.defined(P.boundingSphere)&&r.defined(G.boundingSphere)&&(f[h]=t.BoundingSphere.union(P.boundingSphere,G.boundingSphere)),r.defined(P.boundingSphereCV)&&r.defined(G.boundingSphereCV)&&(u[h]=t.BoundingSphere.union(P.boundingSphereCV,G.boundingSphereCV)))}return{geometries:n,modelMatrix:e.modelMatrix,attributeLocations:o,pickOffsets:i,offsetInstanceExtend:s,boundingSpheres:f,boundingSpheresCV:u,MaxMinArr:m}},x.packCreateGeometryResults=function(e,n){const o=new Float64Array(function(e){let n=1;const o=e.length;for(let i=0;i<o;i++){const o=e[i];if(++n,!r.defined(o))continue;const s=o.attributes;n+=8+(r.defined(o.MaxPoint)?6:0)+2*t.BoundingSphere.packedLength+(r.defined(o.indices)?o.indices.length:0);for(const e in s)s.hasOwnProperty(e)&&r.defined(s[e])&&(n+=5+s[e].values.length)}return n}(e)),i=[],s={},a=e.length;let d=0;o[d++]=a;for(let n=0;n<a;n++){const a=e[n],c=r.defined(a);if(o[d++]=c?1:0,!c)continue;o[d++]=a.primitiveType,o[d++]=a.geometryType,r.defined(a.MaxPoint)?(o[d++]=1,o[d++]=a.MaxPoint.x,o[d++]=a.MaxPoint.y,o[d++]=a.MaxPoint.z,o[d++]=a.MinPoint.x,o[d++]=a.MinPoint.y,o[d++]=a.MinPoint.z):o[d++]=0,o[d++]=r.defaultValue(a.offsetAttribute,-1);const p=r.defined(a.boundingSphere)?1:0;o[d++]=p,p&&t.BoundingSphere.pack(a.boundingSphere,o,d),d+=t.BoundingSphere.packedLength;const f=r.defined(a.boundingSphereCV)?1:0;o[d++]=f,f&&t.BoundingSphere.pack(a.boundingSphereCV,o,d),d+=t.BoundingSphere.packedLength;const u=a.attributes,m=[];for(const e in u)u.hasOwnProperty(e)&&r.defined(u[e])&&(m.push(e),r.defined(s[e])||(s[e]=i.length,i.push(e)));o[d++]=m.length;for(let e=0;e<m.length;e++){const t=m[e],n=u[t];o[d++]=s[t],o[d++]=n.componentDatatype,o[d++]=n.componentsPerAttribute,o[d++]=n.normalize?1:0,o[d++]=n.values.length,o.set(n.values,d),d+=n.values.length}const l=r.defined(a.indices)?a.indices.length:0;o[d++]=l,l>0&&(o.set(a.indices,d),d+=l)}return n.push(o.buffer),{stringTable:i,packedData:o}},x.unpackCreateGeometryResults=function(e){const r=e.stringTable,o=e.packedData;let i;const d=new Array(o[0]);let p=0,f=1;for(;f<o.length;){if(!(1===o[f++])){d[p++]=void 0;continue}const e=o[f++],g=o[f++];var m=o[f++],l=new u.Cartesian3,h=new u.Cartesian3;1===m&&(l.x=o[f++],l.y=o[f++],l.z=o[f++],h.x=o[f++],h.y=o[f++],h.z=o[f++]);let y,b,x=o[f++];-1===x&&(x=void 0);1===o[f++]&&(y=t.BoundingSphere.unpack(o,f)),f+=t.BoundingSphere.packedLength;let P,G,S;1===o[f++]&&(b=t.BoundingSphere.unpack(o,f)),f+=t.BoundingSphere.packedLength;const C=new a.GeometryAttributes,M=o[f++];for(i=0;i<M;i++){const e=r[o[f++]],t=o[f++];S=o[f++];const i=0!==o[f++];P=o[f++],G=n.ComponentDatatype.createTypedArray(t,P);for(let e=0;e<P;e++)G[e]=o[f++];C[e]=new s.GeometryAttribute({componentDatatype:t,componentsPerAttribute:S,normalize:i,values:G})}let k;if(P=o[f++],P>0){const e=G.length/S;for(k=c.IndexDatatype.createTypedArray(e,P),i=0;i<P;i++)k[i]=o[f++]}d[p++]=new s.Geometry({primitiveType:e,geometryType:g,boundingSphere:y,boundingSphereCV:b,indices:k,attributes:C,offsetAttribute:x,MaxPoint:l,MinPoint:h})}return d},x.packCombineGeometryParameters=function(e,n){const r=e.createGeometryResults,o=r.length;for(let e=0;e<o;e++)n.push(r[e].packedData.buffer);return{createGeometryResults:e.createGeometryResults,packedInstances:G(e.instances,n),ellipsoid:e.ellipsoid,isGeographic:e.projection instanceof t.GeographicProjection,elementIndexUintSupported:e.elementIndexUintSupported,scene3DOnly:e.scene3DOnly,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:e.modelMatrix,createPickOffsets:e.createPickOffsets,isfromGLP:void 0!==e.isfromGLP&&e.isfromGLP}},x.unpackCombineGeometryParameters=function(e){const n=function(e){const t=e,n=new Array(t[0]);let o=0,i=1;for(;i<t.length;){const e=p.Matrix4.unpack(t,i);let s;i+=p.Matrix4.packedLength,r.defined(t[i])&&(s={offset:new m(t[i],t[i+1],t[i+2])}),i+=3,n[o++]={modelMatrix:e,attributes:s}}return n}(e.packedInstances),o=e.createGeometryResults,s=o.length;let a=0;var d=e.isfromGLP;for(let e=0;e<s;e++){const t=x.unpackCreateGeometryResults(o[e]),r=t.length;for(let e=0;e<r;e++){const r=t[e];n[a].geometry=r,++a}}const c=i.Ellipsoid.clone(e.ellipsoid);return{instances:n,ellipsoid:c,projection:e.isGeographic?new t.GeographicProjection(c):new f.WebMercatorProjection(c),elementIndexUintSupported:e.elementIndexUintSupported,scene3DOnly:e.scene3DOnly,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:p.Matrix4.clone(e.modelMatrix),createPickOffsets:e.createPickOffsets,isfromGLP:d}},x.packCombineGeometryResults=function(e,t){r.defined(e.geometries)&&function(e,t){const n=e.length;for(let r=0;r<n;++r)P(e[r],t)}(e.geometries,t);const n=S(e.boundingSpheres),o=S(e.boundingSpheresCV);return t.push(n.buffer,o.buffer),{geometries:e.geometries,attributeLocations:e.attributeLocations,modelMatrix:e.modelMatrix,pickOffsets:e.pickOffsets,offsetInstanceExtend:e.offsetInstanceExtend,boundingSpheres:n,boundingSpheresCV:o,MaxMinArr:e.MaxMinArr}},x.unpackCombineGeometryResults=function(e){return{geometries:e.geometries,attributeLocations:e.attributeLocations,modelMatrix:e.modelMatrix,pickOffsets:e.pickOffsets,offsetInstanceExtend:e.offsetInstanceExtend,boundingSpheres:C(e.boundingSpheres),boundingSpheresCV:C(e.boundingSpheresCV),MaxMinArr:e.MaxMinArr}},e.PrimitivePipeline=x}));
|