UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

6 lines (5 loc) 7.05 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.32/esri/copyright.txt for details. */ import{neverReached as e}from"../../../../core/compilerUtils.js";import{defaultPrimitive as r}from"../../../../symbols/support/ObjectSymbol3DLayerResource.js";import{pathNumRoundCapExtrusionSubdivisions as t,pathNumCircleProfileSubdivisions as a,pathNumRoundJoinSubdivisions as s}from"./Graphics3DPathSymbolLayerConstants.js";import{primitiveLodResources as u}from"./primitiveObjectSymbolUtils.js";import{EstimatedSymbolComplexity as o,EstimatedAggregateSymbolComplexity as i,AggregateSymbolComplexity as b,SymbolComplexity as y,SymbolComplexityMemory as c}from"./SymbolComplexity.js";import{hasEdges as n}from"../support/edgeUtils.js";import{DefaultMaterial as l}from"../../webgl-engine/materials/DefaultMaterial.js";const P=new o({});function m(e){if("web-style"===e.type)return P;return F(e.symbolLayers.toArray().map((r=>L(e,r))))}function F(e){let r=0,t=0,a=0,s=!1,u=0;const o=new c;for(const i of e)null!=i&&(r+=i.verticesPerFeature,t+=i.verticesPerCoordinate,a+=i.drawCallsPerFeature,o.bytesPerFeature+=i.memory.bytesPerFeature,o.bytesPerFeatureLabel+=i.memory.bytesPerFeatureLabel,o.resourceBytes+=i.memory.resourceBytes,o.draped.bytesPerFeature+=i.memory.bytesPerFeature,o.draped.bytesPerFeatureLabel+=i.memory.bytesPerFeatureLabel,s=s||i.estimated,++u);return s?new i(u,{verticesPerFeature:r,verticesPerCoordinate:t,drawCallsPerFeature:a,memory:o}):new b(u,{verticesPerFeature:r,verticesPerCoordinate:t,drawCallsPerFeature:a,memory:o})}function d(e){const r=F(e);return r.numComplexities>0&&(r.verticesPerFeature/=r.numComplexities,r.verticesPerCoordinate/=r.numComplexities,r.drawCallsPerFeature/=r.numComplexities,r.memory.bytesPerFeature/=r.numComplexities,r.memory.bytesPerFeatureLabel/=r.numComplexities,r.memory.resourceBytes/=r.numComplexities,r.memory.draped.bytesPerFeature/=r.numComplexities,r.memory.draped.bytesPerFeatureLabel/=r.numComplexities),r}const p={};function L(u,i){const b=C(u,i),c=n(i)?2:0;switch(i.type){case"extrude":return new y({verticesPerFeature:-12,verticesPerCoordinate:12,drawCallsPerFeature:c,memory:b});case"fill":if("mesh-3d"===u.type)return new y({drawCallsPerFeature:c,memory:b});if(null!=i.outline&&i.outline.size>0)return new y({verticesPerFeature:-12,verticesPerCoordinate:9,memory:b});case"water":return new y({verticesPerFeature:-6,verticesPerCoordinate:3,memory:b});case"line":return new y({verticesPerFeature:-6,verticesPerCoordinate:6,memory:b});case"object":return i.resource?.href?new o({verticesPerFeature:100,memory:b}):{...f(i.resource?.primitive??r),memory:b};case"path":{let r=0,u=0;switch(i.profile){case"circle":r=a;break;case"quad":r=4;break;default:return void e(i.profile)}switch(i.join){case"round":u=s;break;case"miter":case"bevel":u=1;break;default:return}const o=2*r,c=r*u*2,n=c+o;let l=-2*c-o;switch(i.cap){case"none":break;case"butt":case"square":l+=2*(r-1);break;case"round":l+=2*(r*(t-1)*2+r);break;default:return}return new y({verticesPerFeature:l,verticesPerCoordinate:n,memory:b})}case"text":case"icon":return new y({verticesPerFeature:6,memory:b});default:return}}function C(r,t){const a="point-3d"===r.type;switch(t.type){case"extrude":return t.edges&&t.edges.size>0?E.EXTRUDE_EDGES:E.EXTRUDE;case"fill":return null!=t.outline&&t.outline.size>0?E.FILL_OUTLINE:E.FILL;case"water":return E.FILL;case"line":return"round"===t.join?E.LINE_ROUND:E.LINE_MITER;case"path":switch(t.join){case"round":switch(t.profile){case"circle":return E.PATH_ROUND_CIRCLE;case"quad":return E.PATH_ROUND_QUAD;default:return void e(t.profile)}case"miter":case"bevel":switch(t.profile){case"circle":return E.PATH_MITER_CIRCLE;case"quad":return E.PATH_MITER_QUAD;default:return void e(t.profile)}default:return}case"object":return a?E.OBJECT_POINT:E.OBJECT_POLYGON;case"icon":case"text":return a?E.ICON_POINT:E.ICON_POLYGON;default:return}}function f(e){const r=p[e];if(r)return r;const t=w(u(e,new l({},{spherical:!0,doublePrecisionRequiresObfuscation:!0})).levels);return p[e]=new y({verticesPerFeature:t}),p[e]}function w(e){return e.reduce(((e,r,t)=>e+r.numVertices*(1/10**t)),0)/e.reduce(((e,r,t)=>e+1/10**t),0)}const E={ICON_POINT:{bytesPerFeature:2346.460896195398,bytesPerFeatureLabel:3484.7516349999996,resourceBytes:0,draped:{bytesPerFeature:2007.3528529826217,bytesPerFeatureLabel:3522.702025}},ICON_POLYGON:{bytesPerFeature:3677.214053765355,bytesPerFeatureLabel:3502.5355950000003,resourceBytes:0,draped:{bytesPerFeature:3030.3700096053935,bytesPerFeatureLabel:3550.247175}},OBJECT_POINT:{bytesPerFeature:569.2092700798497,bytesPerFeatureLabel:3183.0256999999992,resourceBytes:0,draped:{bytesPerFeature:569.2092700798497,bytesPerFeatureLabel:3183.0256999999992}},OBJECT_POLYGON:{bytesPerFeature:1252.202280530861,bytesPerFeatureLabel:3125.853350000001,resourceBytes:0,draped:{bytesPerFeature:1252.202280530861,bytesPerFeatureLabel:3125.853350000001}},LINE_MITER:{bytesPerFeature:3252.89170349711,bytesPerFeatureLabel:3554.3931949999997,resourceBytes:0,draped:{bytesPerFeature:2843.5793737736867,bytesPerFeatureLabel:3538.2547083333334}},LINE_ROUND:{bytesPerFeature:3384.080501909172,bytesPerFeatureLabel:3522.6055950000004,resourceBytes:0,draped:{bytesPerFeature:2833.1897218657587,bytesPerFeatureLabel:3532.0680950000005}},PATH_MITER_CIRCLE:{bytesPerFeature:38490.63544346431,bytesPerFeatureLabel:3660.7835999999998,resourceBytes:0,draped:{bytesPerFeature:38490.63544346431,bytesPerFeatureLabel:3660.7835999999998}},PATH_ROUND_CIRCLE:{bytesPerFeature:42934.88589895749,bytesPerFeatureLabel:3729.49955,resourceBytes:0,draped:{bytesPerFeature:42934.88589895749,bytesPerFeatureLabel:3729.49955}},PATH_MITER_QUAD:{bytesPerFeature:25392.923576583788,bytesPerFeatureLabel:3647.05925,resourceBytes:0,draped:{bytesPerFeature:25392.923576583788,bytesPerFeatureLabel:3647.05925}},PATH_ROUND_QUAD:{bytesPerFeature:40448.297252606244,bytesPerFeatureLabel:3646.8303499999997,resourceBytes:0,draped:{bytesPerFeature:40448.297252606244,bytesPerFeatureLabel:3646.8303499999997}},FILL:{bytesPerFeature:3419.9079008788176,bytesPerFeatureLabel:3564.2132483333335,resourceBytes:0,draped:{bytesPerFeature:2910.096178654882,bytesPerFeatureLabel:3554.8655816666665}},FILL_OUTLINE:{bytesPerFeature:5018.088812445781,bytesPerFeatureLabel:3524.8219616666665,resourceBytes:0,draped:{bytesPerFeature:4278.49006198517,bytesPerFeatureLabel:3532.068368333334}},EXTRUDE:{bytesPerFeature:7963.8889768932695,bytesPerFeatureLabel:3628.5106350000005,resourceBytes:0,draped:{bytesPerFeature:7963.8889768932695,bytesPerFeatureLabel:3628.5106350000005}},EXTRUDE_EDGES:{bytesPerFeature:3111.7648563053044,bytesPerFeatureLabel:2658.4350683333337,resourceBytes:0,draped:{bytesPerFeature:3111.7648563053044,bytesPerFeatureLabel:2658.4350683333337}}};export{d as averageSymbolComplexities,m as defaultSymbolComplexity,L as defaultSymbolLayerComplexity,C as defaultSymbolLayerMemoryComplexity,P as emptySymbolComplexity,w as estimateNumVerticesForLods,F as totalSymbolComplexities};