@doegis/core
Version:
DOE GIS API
3 lines (1 loc) • 8.67 kB
JavaScript
import{neverReached as e}from"../../../../core/compilerUtils.js";import{isNone as r,isSome as t}from"../../../../core/maybe.js";import{defaultPrimitive as a}from"../../../../symbols/support/ObjectSymbol3DLayerResource.js";import{PATH_NUM_ROUND_CAP_EXTRUSION_SUBDIVISIONS as s,PATH_NUM_CIRCLE_PROFILE_SUBDIVISIONS as i,PATH_NUM_ROUND_JOIN_SUBDIVISIONS as o}from"./Graphics3DPathSymbolLayerConstants.js";import{primitiveLodResources as u}from"./primitiveObjectSymbolUtils.js";import{hasEdges as b}from"../support/edgeUtils.js";import{VertexAttribute as y}from"../../webgl-engine/lib/VertexAttribute.js";import{geometriesFromLodLevelResources as P}from"../../webgl-engine/lib/lodRendering/LodResources.js";const d={primitivesPerFeature:0,primitivesPerCoordinate:0,drawCallsPerFeature:0,estimated:!0,memory:{bytesPerFeature:0,bytesPerCoordinate:0,bytesPerFeatureLabel:0,resourceBytes:0,draped:{bytesPerFeature:0,bytesPerFeatureLabel:0,bytesPerCoordinate:0}}};function m(e){if("web-style"===e.type)return d;return n(e.symbolLayers.toArray().map((r=>c(e,r))))}function n(e){let t=0,a=0,s=0,i=!1,o=0;const u={bytesPerFeature:0,bytesPerFeatureLabel:0,bytesPerCoordinate:0,resourceBytes:0,draped:{bytesPerFeature:0,bytesPerFeatureLabel:0,bytesPerCoordinate:0}};for(const b of e)r(b)||(t+=b.primitivesPerFeature,a+=b.primitivesPerCoordinate,s+=b.drawCallsPerFeature,u.bytesPerFeature+=b.memory.bytesPerFeature,u.bytesPerFeatureLabel+=b.memory.bytesPerFeatureLabel,u.bytesPerCoordinate+=b.memory.bytesPerCoordinate,u.resourceBytes+=b.memory.resourceBytes,u.draped.bytesPerFeature+=b.memory.bytesPerFeature,u.draped.bytesPerFeatureLabel+=b.memory.bytesPerFeatureLabel,u.draped.bytesPerCoordinate+=b.memory.bytesPerCoordinate,i=i||b.estimated,++o);return{primitivesPerFeature:t,primitivesPerCoordinate:a,drawCallsPerFeature:s,estimated:i,memory:u,numComplexities:o}}function l(e){const r=n(e);return r.numComplexities>0&&(r.primitivesPerFeature/=r.numComplexities,r.primitivesPerCoordinate/=r.numComplexities,r.drawCallsPerFeature/=r.numComplexities,r.memory.bytesPerFeature/=r.numComplexities,r.memory.bytesPerFeatureLabel/=r.numComplexities,r.memory.bytesPerCoordinate/=r.numComplexities,r.memory.resourceBytes/=r.numComplexities,r.memory.draped.bytesPerFeature/=r.numComplexities,r.memory.draped.bytesPerFeatureLabel/=r.numComplexities,r.memory.draped.bytesPerCoordinate/=r.numComplexities),r}const F={};function c(r,u){const y=p(r,u),P=b(u)?2:0;switch(u.type){case"extrude":return{primitivesPerFeature:-4,primitivesPerCoordinate:4,drawCallsPerFeature:P,estimated:!1,memory:y};case"fill":return"mesh-3d"===r.type?{primitivesPerFeature:0,primitivesPerCoordinate:0,drawCallsPerFeature:P,estimated:!1,memory:y}:t(u.outline)&&u.outline.size>0?{primitivesPerFeature:-4,primitivesPerCoordinate:3,drawCallsPerFeature:0,estimated:!1,memory:y}:{primitivesPerFeature:-2,primitivesPerCoordinate:1,drawCallsPerFeature:0,estimated:!1,memory:y};case"water":return{primitivesPerFeature:-2,primitivesPerCoordinate:1,drawCallsPerFeature:0,estimated:!1,memory:y};case"line":return{primitivesPerFeature:-2,primitivesPerCoordinate:2,drawCallsPerFeature:0,estimated:!1,memory:y};case"object":if(u.resource&&u.resource.href)return{primitivesPerFeature:16,primitivesPerCoordinate:0,drawCallsPerFeature:0,estimated:!0,memory:y};return{...C(u.resource&&u.resource.primitive||a),memory:y};case"path":{let r=0,t=0;switch(u.profile){case"circle":r=i;break;case"quad":r=4;break;default:return void e(u.profile)}switch(u.join??"simple"){case"round":t=o;break;case"miter":case"bevel":t=1;break;default:return}const a=2*r,b=r*t*2;let P=-2*b-a;switch(u.cap){case"none":break;case"butt":case"square":P+=2*(r-1);break;case"round":P+=2*(r*(s-1)*2+r);break;default:return}return{primitivesPerFeature:P,primitivesPerCoordinate:b+a,drawCallsPerFeature:0,estimated:!1,memory:y}}case"text":case"icon":return{primitivesPerFeature:2,primitivesPerCoordinate:0,drawCallsPerFeature:0,estimated:!1,memory:y};default:return}}function p(r,a){const s="point-3d"===r.type;switch(a.type){case"extrude":return a.edges&&a.edges.size>0?L.EXTRUDE_EDGES:L.EXTRUDE;case"fill":return t(a.outline)&&a.outline.size>0?L.FILL_OUTLINE:L.FILL;case"water":return L.FILL;case"line":return"round"===a.join?L.LINE_ROUND:L.LINE_MITER;case"path":switch(a.join){case"round":switch(a.profile){case"circle":return L.PATH_ROUND_CIRCLE;case"quad":return L.PATH_ROUND_QUAD;default:return void e(a.profile)}case"miter":case"bevel":switch(a.profile){case"circle":return L.PATH_MITER_CIRCLE;case"quad":return L.PATH_MITER_QUAD;default:return void e(a.profile)}default:return}case"object":return s?L.OBJECT_POINT:L.OBJECT_POLYGON;case"icon":case"text":return s?L.ICON_POINT:L.ICON_POLYGON;default:return}}function C(e){let r=F[e];if(r)return r;const t=u(e,null);return r={primitivesPerFeature:P(t.levels[0]).reduce(((e,r)=>e+r.indices.get(y.POSITION).length/3),0),primitivesPerCoordinate:0,drawCallsPerFeature:0,estimated:!1},F[e]=r,r}const L={ICON_POINT:{bytesPerFeature:3293.7707557538765,bytesPerFeatureLabel:1020.2764,bytesPerCoordinate:0,resourceBytes:0,draped:{bytesPerFeature:2213.51585392203,bytesPerFeatureLabel:1008.84664,bytesPerCoordinate:0}},ICON_POLYGON:{bytesPerFeature:4745.397589234022,bytesPerFeatureLabel:1006.5440666666666,bytesPerCoordinate:3.8971910718981526,resourceBytes:0,draped:{bytesPerFeature:3711.9299672493826,bytesPerFeatureLabel:991.1003999999999,bytesPerCoordinate:3.916858016273668}},OBJECT_POINT:{bytesPerFeature:1751.6405617660876,bytesPerFeatureLabel:1024.7827699999998,bytesPerCoordinate:0,resourceBytes:0,draped:{bytesPerFeature:1751.6405617660876,bytesPerFeatureLabel:1024.7827699999998,bytesPerCoordinate:0}},OBJECT_POLYGON:{bytesPerFeature:3265.877223973855,bytesPerFeatureLabel:1002.3207366666666,bytesPerCoordinate:4.003101524580855,resourceBytes:0,draped:{bytesPerFeature:3265.877223973855,bytesPerFeatureLabel:1002.3207366666666,bytesPerCoordinate:4.003101524580855}},LINE_MITER:{bytesPerFeature:5757.019675077085,bytesPerFeatureLabel:998.6150266666667,bytesPerCoordinate:24.456810187064043,resourceBytes:0,draped:{bytesPerFeature:4101.480288021862,bytesPerFeatureLabel:1007.7540599999999,bytesPerCoordinate:18.25629912730874}},LINE_ROUND:{bytesPerFeature:5770.95297166408,bytesPerFeatureLabel:1017.77396,bytesPerCoordinate:24.60919037084966,resourceBytes:0,draped:{bytesPerFeature:4089.5796612121826,bytesPerFeatureLabel:987.8320266666666,bytesPerCoordinate:18.43599029126731}},PATH_MITER_CIRCLE:{bytesPerFeature:36120.81813311945,bytesPerFeatureLabel:977.3815,bytesPerCoordinate:2713.2216607858863,resourceBytes:0,draped:{bytesPerFeature:36120.81813311945,bytesPerFeatureLabel:977.3815,bytesPerCoordinate:2713.2216607858863}},PATH_ROUND_CIRCLE:{bytesPerFeature:23268.96777866874,bytesPerFeatureLabel:985.2637,bytesPerCoordinate:5284.873051323177,resourceBytes:0,draped:{bytesPerFeature:23268.96777866874,bytesPerFeatureLabel:985.2637,bytesPerCoordinate:5284.873051323177}},PATH_MITER_QUAD:{bytesPerFeature:24548.629753007182,bytesPerFeatureLabel:964.6924,bytesPerCoordinate:2114.107276663994,resourceBytes:0,draped:{bytesPerFeature:24548.629753007182,bytesPerFeatureLabel:964.6924,bytesPerCoordinate:2114.107276663994}},PATH_ROUND_QUAD:{bytesPerFeature:34316.219663191616,bytesPerFeatureLabel:975.7985,bytesPerCoordinate:3331.3952550120293,resourceBytes:0,draped:{bytesPerFeature:34316.219663191616,bytesPerFeatureLabel:975.7985,bytesPerCoordinate:3331.3952550120293}},FILL:{bytesPerFeature:6141.501452970723,bytesPerFeatureLabel:1008.2056066666665,bytesPerCoordinate:9.669541106191478,resourceBytes:0,draped:{bytesPerFeature:4615.812654782311,bytesPerFeatureLabel:1004.2114200000001,bytesPerCoordinate:7.378043214430644}},FILL_OUTLINE:{bytesPerFeature:9038.575581319641,bytesPerFeatureLabel:1017.9996066666668,bytesPerCoordinate:14.96569682175086,resourceBytes:0,draped:{bytesPerFeature:6369.386021594582,bytesPerFeatureLabel:1008.9863733333334,bytesPerCoordinate:10.25287774000214}},EXTRUDE:{bytesPerFeature:20071.2337049912,bytesPerFeatureLabel:1019.49468,bytesPerCoordinate:49.39369614206849,resourceBytes:0,draped:{bytesPerFeature:20071.2337049912,bytesPerFeatureLabel:1019.49468,bytesPerCoordinate:49.39369614206849}},EXTRUDE_EDGES:{bytesPerFeature:22300.21739345088,bytesPerFeatureLabel:1017.4348466666665,bytesPerCoordinate:49.40242281963031,resourceBytes:0,draped:{bytesPerFeature:22300.21739345088,bytesPerFeatureLabel:1017.4348466666665,bytesPerCoordinate:49.40242281963031}}};export{l as averageSymbolComplexities,m as defaultSymbolComplexity,c as defaultSymbolLayerComplexity,p as defaultSymbolLayerMemoryComplexity,d as emptySymbolComplexity,L as memoryEstimators,n as totalSymbolComplexities};