@arcgis/core 4.33.0-next.20250319 → 4.33.0-next.20250321

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/1034155c525d2b7baaa1.js +1 -0
  3. package/assets/esri/core/workers/chunks/2b9ce6648823f6962f58.js +1 -0
  4. package/assets/esri/core/workers/chunks/{6a97bdd46715fc12e1b4.js → 9cfce9414b874878d761.js} +4 -4
  5. package/assets/esri/core/workers/chunks/b23d16745674486ddd6c.js +1 -0
  6. package/assets/esri/core/workers/chunks/bfbb118ae3b4a4ce1c74.js +319 -0
  7. package/assets/esri/themes/base/_mixins.scss +4 -0
  8. package/assets/esri/themes/dark/main.css +1 -1
  9. package/assets/esri/themes/light/main.css +1 -1
  10. package/assets/esri/themes/light/view.css +1 -1
  11. package/chunks/BloomBlur.glsl.js +7 -7
  12. package/chunks/BloomComposition.glsl.js +2 -2
  13. package/geometry/support/buffer/BufferView.js +1 -1
  14. package/interfaces.d.ts +8 -7
  15. package/layers/VoxelWasmPerSceneView.js +1 -1
  16. package/package.json +2 -2
  17. package/support/basemapUtils.js +1 -1
  18. package/support/revision.js +1 -1
  19. package/views/3d/environment/ChapmanAtmosphere.js +1 -1
  20. package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
  21. package/views/3d/layers/BuildingSceneLayerView3D.js +1 -1
  22. package/views/3d/layers/BuildingSublayerView3D.js +1 -1
  23. package/views/3d/layers/I3SMeshView3D.js +1 -1
  24. package/views/3d/layers/I3SMeshViewLabeler.js +1 -1
  25. package/views/3d/layers/MediaLayerView3D.js +1 -1
  26. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  27. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  28. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  29. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  30. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  31. package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
  32. package/views/3d/layers/graphics/Graphics3DGraphicsPipeline.js +1 -1
  33. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  34. package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
  35. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  36. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  37. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  38. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  39. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  40. package/views/3d/layers/graphics/Graphics3DSymbolCreationContext.js +1 -1
  41. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  42. package/views/3d/layers/graphics/GraphicsProcessor.js +1 -1
  43. package/views/3d/layers/graphics/Labeler.js +1 -1
  44. package/views/3d/layers/graphics/deconflictorDebug.js +1 -1
  45. package/views/3d/layers/graphics/pipeline/Feature3DPipeline.js +1 -1
  46. package/views/3d/layers/graphics/pipeline/rendering/DirectRenderer.js +1 -1
  47. package/views/3d/layers/graphics/pipeline/rendering/FeaturePipelineRenderManager.js +1 -1
  48. package/views/3d/layers/graphics/pipeline/rendering/LodRenderer.js +1 -1
  49. package/views/3d/layers/graphics/pointUtils.js +1 -1
  50. package/views/3d/layers/graphics/polygonUtils.js +1 -1
  51. package/views/3d/layers/i3s/I3SIntersectionHandler.js +1 -1
  52. package/views/3d/layers/i3s/Intersector.js +1 -1
  53. package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
  54. package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
  55. package/views/3d/layers/support/Tiles3DIntersectionHandler.js +1 -1
  56. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  57. package/views/3d/support/buffer/InterleavedLayout.js +1 -1
  58. package/views/3d/support/hitTest.js +1 -1
  59. package/views/3d/terrain/OverlayRenderTargets.js +1 -1
  60. package/views/3d/terrain/TerrainRenderer.js +1 -1
  61. package/views/3d/webgl/ManagedColorAttachment.js +1 -1
  62. package/views/3d/webgl/ManagedDepthAttachment.js +1 -1
  63. package/views/3d/webgl/ManagedFBO.js +1 -1
  64. package/views/3d/webgl/ManagedFBOAttachment.js +1 -1
  65. package/views/3d/webgl/{ManagedFBObject.js → ManagedFBOResource.js} +1 -1
  66. package/views/3d/webgl/formats.js +1 -1
  67. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  68. package/views/3d/webgl-engine/effects/bloom/BloomBlur.glsl.js +1 -1
  69. package/views/3d/webgl-engine/effects/bloom/BloomComposition.glsl.js +1 -1
  70. package/views/3d/webgl-engine/effects/bloom/BloomPresets.glsl.js +5 -0
  71. package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +1 -1
  72. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
  73. package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorNode.js +1 -1
  74. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
  75. package/views/3d/webgl-engine/effects/geometry/RenderOccludedRenderNode.js +1 -1
  76. package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
  77. package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
  78. package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
  79. package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
  80. package/views/3d/webgl-engine/lib/IntersectorInterfaces.js +1 -1
  81. package/views/3d/webgl-engine/lib/IntersectorTarget.js +1 -1
  82. package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
  83. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  84. package/views/3d/webgl-engine/lib/ObjectAndLayerIdRenderHelper.js +1 -1
  85. package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
  86. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  87. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  88. package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
  89. package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
  90. package/views/3d/webgl-engine/lib/WebGLLayer.js +1 -1
  91. package/views/3d/webgl-engine/lib/intersectorUtilsConversions.js +1 -1
  92. package/views/3d/webgl-engine/lib/lodRendering/Intersector.js +1 -1
  93. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  94. package/views/3d/webgl-engine/lib/lodRendering/LodResources.js +1 -1
  95. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  96. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  97. package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
  98. package/views/3d/webgl.js +1 -1
  99. package/views/SceneView.js +1 -1
  100. package/views/webgl/FramebufferObject.js +1 -1
  101. package/views/webgl/GLObjectType.js +1 -1
  102. package/views/webgl/Renderbuffer.js +1 -1
  103. package/widgets/Daylight.js +1 -1
  104. package/widgets/ElevationProfile/support/visualizationUtils.js +1 -1
  105. package/widgets/ShadowCast.js +1 -1
  106. package/widgets/support/globalCss.js +1 -1
  107. package/widgets/support/timeWidgetUtils.js +1 -1
  108. package/assets/esri/core/workers/chunks/534f3d7e4300b662191a.js +0 -1
  109. package/assets/esri/core/workers/chunks/657ae4a0461d45044b28.js +0 -1
  110. package/assets/esri/core/workers/chunks/8e20ec4e8e2cfc582fe7.js +0 -319
  111. package/assets/esri/core/workers/chunks/c528a2ca3b1b73df5a5d.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../Color.js";import"../../../../core/has.js";import t from"../../../../core/Error.js";import{translate as r}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as i,create as s}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as a,scale as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as n,fromArray as l,clone as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{F as h,i as m}from"../../../../chunks/vec32.js";import{clone as p,ZEROS as f,fromArray as d,create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ZEROS as b}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{projectBuffer as y}from"../../../../geometry/projection/projectBuffer.js";import{create as g,fromSubBuffer as _,intersectsClippingArea as v}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as x,doubleArrayFrom as w}from"../../../../geometry/support/DoubleArray.js";import{needsElevationUpdates3D as P,evaluateElevationAlignmentAtPoint as j,SampleElevationInfo as S}from"./elevationAlignmentUtils.js";import{Graphics3DObject3DGraphicLayer as C}from"./Graphics3DObject3DGraphicLayer.js";import{pathNumRoundJoinSubdivisions as D,pathNumRoundCapExtrusionSubdivisions as L}from"./Graphics3DPathSymbolLayerConstants.js";import{Graphics3DSymbolLayer as A}from"./Graphics3DSymbolLayer.js";import{isValidSize as V}from"./graphicUtils.js";import{ApplyRendererDiffResult as R}from"./interfaces.js";import{ConvertOptions as U,initFastSymbolUpdatesState as k,updateFastSymbolUpdatesState as E,getAttributeValue as z}from"../support/FastSymbolUpdates.js";import{SamplePosition as O}from"../../support/ElevationProvider.js";import{NormalType as I}from"../../webgl-engine/core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{CullFaceOptions as G}from"../../webgl-engine/lib/basicInterfaces.js";import{Object3D as B}from"../../webgl-engine/lib/Object3D.js";import{Path as F}from"../../webgl-engine/lib/Path.js";import{PathBuilder as M}from"../../webgl-engine/lib/PathBuilder.js";import{RoundCapBuilder as q,TriangulationCapBuilder as H,NoCapBuilder as N}from"../../webgl-engine/lib/PathCapBuilder.js";import{SimpleExtruder as W,MiterExtruder as T}from"../../webgl-engine/lib/PathExtruder.js";import{UpVectorAlignment as Z,PathGeometry as J,isPathGeometry as K}from"../../webgl-engine/lib/PathGeometry.js";import{FastUpdatePathGeometry as Q,StaticPathGeometry as X}from"../../webgl-engine/lib/PathGeometryData.js";import{computeMinimumRotationTangentFrame as Y}from"../../webgl-engine/lib/pathGeometryUtils.js";import{quadProfiles as $,circleProfiles as ee}from"../../webgl-engine/lib/PathProfile.js";import{newPathVertex as te}from"../../webgl-engine/lib/PathVertex.js";import{VertexAttribute as re}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as ie}from"../../webgl-engine/materials/DefaultMaterial.js";import{PathMaterial as se}from"../../webgl-engine/materials/PathMaterial.js";const ae=["polyline"];class oe extends A{constructor(e,t,r,i){super(e,t,r,i,me(t)),this._intrinsicSize=n(1,1),this._upVectorAlignment=Z.Path,this._stencilWidth=.1,this.ensureDrapedStatus(!1)}async doLoad(){const e=null!=this.symbolLayer.width?this.symbolLayer.width:this.symbolLayer.height,r=null!=this.symbolLayer.height?this.symbolLayer.height:e;this._vvConvertOptions=new U({supports:{size:!0,color:!0,rotation:!1,opacity:!0},modelSize:[1,1,1],symbolSize:[e,1,r],unitInMeters:this._context.renderCoordsHelper.unitInMeters,fallbackColor:this._getFallbackOpacityAndColor(),fallbackSize:[e,1,r]});const i=this._context.renderer?.visualVariables;this._fastUpdates=i?.length?k(this._context.renderer,this._vvConvertOptions):null;const s=this.symbolLayer.anchor||"center";this._upVectorAlignment="heading"===this.symbolLayer.profileRotation?Z.World:Z.Path;const n=this.symbolLayer.profile||"circle";switch(n){default:case"circle":this._profile=ee[s];break;case"quad":this._profile=$[s]}switch(this.symbolLayer.join){case"round":this._extruder=new T(0,D);break;case"bevel":this._extruder=new T(0,1);break;case"miter":this._extruder=new T(.8*Math.PI,1);break;default:this._extruder=new W}const c=this.symbolLayer.cap||"butt";switch(c){case"none":this._startCap=new N,this._endCap=new N;break;case"butt":default:this._startCap=new H(this._profile,0),this._endCap=new H(this._profile,0,!0);break;case"square":this._startCap=new H(this._profile,-.5),this._endCap=new H(this._profile,.5,!0);break;case"round":{const e="quad"===n;this._startCap=new q({profile:this._profile,flip:!1,breakNormals:e,subdivisions:L}),this._endCap=new q({profile:this._profile,flip:!0,breakNormals:e,subdivisions:L});break}}const m=this.symbolLayer?.material?.emissiveFactor,u=m?h(p(m)):f,b=this.symbolLayer?.material?.color,y=this._getCombinedOpacityAndColor(b),g=d(y),_={diffuse:g,ambient:g,emissiveFactor:u,opacity:y[3],drivenOpacity:this.needsDrivenTransparentPass,hasVertexColors:!1,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows,offsetTransparentBackfaces:!0};if(!this._drivenProperties.size&&(a(this._intrinsicSize,e,r),!V(this._intrinsicSize[0])||!V(this._intrinsicSize[1])))throw new t("graphics3dpathsymbollayer:invalid-size","Symbol sizes may not be negative values");let v;this._fastUpdates?.visualVariables.size||o(this._intrinsicSize,this._intrinsicSize,1/this._context.renderCoordsHelper.unitInMeters),this._fastUpdates?v=new se({..._,...this._fastUpdates.materialParameters,size:l(this._intrinsicSize)},this._context):(_.hasVertexColors=this._drivenProperties.color||this._drivenProperties.opacity,_.normalType=I.Compressed,v=new ie(_,this._context)),v.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,cullFace:v.transparent||"none"===c?G.None:G.Back}),this._materials[0]=v,this._context.stage.add(v)}destroy(){super.destroy(),this._context.stage.remove(this._materials[0]),this._materials.length=0}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,ae,this.symbolLayer.type))return null;const r=this.setGraphicElevationContext(t);return this._createAs3DShape(e,r)}layerOpacityChanged(){const e=this.symbolLayer?.material?.color,t=this._getCombinedOpacity(e);this._materials[0]?.setParameters({opacity:t})}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,P)}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return this._materials[0]?.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),!0}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return R.RecreateSymbol;if(!E(this._fastUpdates,t,this._vvConvertOptions))return R.RecreateSymbol;this._materials[0]?.setParameters(this._fastUpdates.materialParameters)}return R.FastUpdate}_getVertexData(e){let t=0;const r=e.paths,i=[],s=e.spatialReference,a=this._context.elevationProvider.spatialReference,o=this._context.renderCoordsHelper.spatialReference;for(const h of r)t+=h.length;const n=x(3*t);let l,c=0;for(const h of r){i.push({offset:c,numVertices:h.length});for(const t of h)n[c++]=t[0],n[c++]=t[1],n[c++]=e.hasZ?t[2]:0}return null==a||s.equals(a)||y(n,s,0,n,a,0,t)?(null==a||a.equals(o)?l=w(n):(l=x(3*t),y(n,a,0,l,o,0,t)),{pathVertexDataInfos:i,vertexDataES:n,vertexDataRS:l}):null}_createAs3DShape(e,t){const{graphic:a,renderingInfo:o}=e,n=a.geometry,l=this._getVertexData(n);if(null==l)return this.logger.warn("PathSymbol3DLayer geometry failed to be created (failed to project geometry to view spatial reference)"),null;if(0===l.pathVertexDataInfos.length)return 0!==n.paths.length&&n.paths.some((e=>e.length>0))||this.logger.warn("PathSymbol3DLayer geometry failed to be created (no paths were defined)"),null;const h=new Array,p=n.spatialReference,f=g(),d=this._context.renderCoordsHelper,u=new O(l.vertexDataES),b=a.uid;let y=0;for(const g of l.pathVertexDataInfos){const e=g.numVertices;if(e<2)continue;const n=g.offset;if(null!=this._context.clippingExtent&&(_(l.vertexDataES,n,e,f),!v(f,this._context.clippingExtent)))continue;const x=new Array,w=n+3*e;for(let r=n;r<w;r+=3){u.offset=r;const e=j(u,this._context.elevationProvider,t,d);m(pe,l.vertexDataRS[r],l.vertexDataRS[r+1],l.vertexDataRS[r+2]),d.setAltitude(pe,e),l.vertexDataRS[r]=pe[0],l.vertexDataRS[r+1]=pe[1],l.vertexDataRS[r+2]=pe[2],x.push(te(this._upVectorAlignment))}const P=new F(x,l.vertexDataES,l.vertexDataRS,n);ne(P,this._upVectorAlignment,this._context.renderCoordsHelper);const S=new M(P,this._profile,this._extruder,this._startCap,this._endCap);let C=null;if(this._fastUpdates){const e=this._fastUpdates.visualVariables,t=z(e.size?.field,a)??0,r=z(e.color?.field,a)??0,i=z(e.opacity?.field,a)??0;C=new Q(S,t,r,i)}else{const e=c(this._intrinsicSize);if(this._drivenProperties.size){const t=o.size??["symbol-value","symbol-value","symbol-value"];e[0]*=le(t[0],"symbol-value"===t[2]?this.symbolLayer.height||0:t[2],this.symbolLayer.width||0),e[1]*=le(t[2],"symbol-value"===t[0]?this.symbolLayer.width||0:t[0],this.symbolLayer.height||0)}let t;if(this._drivenProperties.color&&(t=o.color??this._getFallbackOpacityAndColor()),this._drivenProperties.opacity){const e=o.opacity??this._getFallbackOpacityAndColor()[3];t=t?[t[0],t[1],t[2],e]:[1,1,1,e]}const r=new X(S);r.bake(e),t&&r.bakeVertexColors(t),C=r}const D=C.createGeometryData(),L=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:b,layerUid:this._context.layer.uid}),A=new J(this._materials[0],D,C,p,this._stencilWidth,L);A.transformation=r(s(),i,S.path.origin),h.push(A),y+=S.usedMemory}if(0===h.length)return null;const x=new B({geometries:h,layerUid:this._context.layer.uid,graphicUid:b}),w=new C(this,x,h,null,null,((e,t,r,i,s)=>he(e,t,i,s,this._upVectorAlignment)),t,null,y);return w.alignedSampledElevation=0,w.needsElevationUpdates=P(t.mode),w}_getFallbackOpacityAndColor(){const t=this.symbolLayer?.material?.color;return e.toUnitRGBA(t)??b}}function ne(e,t,r){const{origin:i,positions:s}=e;let a=e.offset;switch(t){default:case Z.World:for(const t of e.vertices)pe[0]=s[a++]+i[0],pe[1]=s[a++]+i[1],pe[2]=s[a++]+i[2],r.worldUpAtPosition(pe,pe),t.setFrameFromUpVector(pe);break;case Z.Path:pe[0]=s[a]+i[0],pe[1]=s[a+1]+i[1],pe[2]=s[a+2]+i[2],r.worldUpAtPosition(pe,pe),Y(e,pe)}}function le(e,t,r){switch(e){case"symbol-value":return r;case"proportional":return t;default:return e}}function ce(e,t,r,i){let s=0;const{origin:a,vertices:o,positions:n,positionsES:l}=e,c=e.offset+3*o.length;for(let h=e.offset;h<c;h+=3)m(pe,l[h],l[h+1],l[h+2]),r(pe,fe),s+=fe.sampledElevation,pe[0]=n[h]+a[0],pe[1]=n[h+1]+a[1],pe[2]=n[h+2]+a[2],i.setAltitude(pe,fe.z),n[h]=pe[0]-a[0],n[h+1]=pe[1]-a[1],n[h+2]=pe[2]-a[2];return e.updatePathVertexInformation(),s/o.length}function he(e,t,r,i,s){const a=e.stageObject,o=a.geometries;let n=0;for(const l of o){if(!K(l))continue;const e=l.path,o=e.builder.path;n+=ce(o,t,r,i),s!==Z.World&&ne(o,s,i),e.onPathChanged(l),l.invalidateBoundingInfo(),a.geometryVertexAttributeUpdated(l,re.POSITION)}return n/o.length}function me(e){return 1===(e.material?.color?.a??1)}const pe=u(),fe=new S;export{oe as Graphics3DPathSymbolLayer};
5
+ import e from"../../../../Color.js";import"../../../../core/has.js";import t from"../../../../core/Error.js";import{translate as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as r,create as s}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as a,scale as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as n,fromArray as l,clone as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{F as h,i as m}from"../../../../chunks/vec32.js";import{clone as p,ZEROS as f,fromArray as d,create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ZEROS as b}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{projectBuffer as y}from"../../../../geometry/projection/projectBuffer.js";import{create as g,fromSubBuffer as _,intersectsClippingArea as v}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as w,doubleArrayFrom as x}from"../../../../geometry/support/DoubleArray.js";import{needsElevationUpdates3D as P,evaluateElevationAlignmentAtPoint as j,SampleElevationInfo as S}from"./elevationAlignmentUtils.js";import{Graphics3DObject3DGraphicLayer as C}from"./Graphics3DObject3DGraphicLayer.js";import{pathNumRoundJoinSubdivisions as D,pathNumRoundCapExtrusionSubdivisions as V}from"./Graphics3DPathSymbolLayerConstants.js";import{Graphics3DSymbolLayer as L}from"./Graphics3DSymbolLayer.js";import{isValidSize as A}from"./graphicUtils.js";import{ApplyRendererDiffResult as U}from"./interfaces.js";import{ConvertOptions as R,initFastSymbolUpdatesState as k,updateFastSymbolUpdatesState as E,getAttributeValue as z}from"../support/FastSymbolUpdates.js";import{SamplePosition as O}from"../../support/ElevationProvider.js";import{NormalType as I}from"../../webgl-engine/core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{CullFaceOptions as G}from"../../webgl-engine/lib/basicInterfaces.js";import{Object3D as B}from"../../webgl-engine/lib/Object3D.js";import{Path as F}from"../../webgl-engine/lib/Path.js";import{PathBuilder as M}from"../../webgl-engine/lib/PathBuilder.js";import{RoundCapBuilder as q,TriangulationCapBuilder as H,NoCapBuilder as N}from"../../webgl-engine/lib/PathCapBuilder.js";import{SimpleExtruder as W,MiterExtruder as T}from"../../webgl-engine/lib/PathExtruder.js";import{UpVectorAlignment as Z,PathGeometry as J,isPathGeometry as K}from"../../webgl-engine/lib/PathGeometry.js";import{FastUpdatePathGeometry as Q,StaticPathGeometry as X}from"../../webgl-engine/lib/PathGeometryData.js";import{computeMinimumRotationTangentFrame as Y}from"../../webgl-engine/lib/pathGeometryUtils.js";import{quadProfiles as $,circleProfiles as ee}from"../../webgl-engine/lib/PathProfile.js";import{newPathVertex as te}from"../../webgl-engine/lib/PathVertex.js";import{VertexAttribute as ie}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as re}from"../../webgl-engine/materials/DefaultMaterial.js";import{PathMaterial as se}from"../../webgl-engine/materials/PathMaterial.js";const ae=["polyline"];class oe extends L{constructor(e,t,i,r){super(e,t,i,r,me(t)),this._intrinsicSize=n(1,1),this._upVectorAlignment=Z.Path,this._stencilWidth=.1,this.ensureDrapedStatus(!1)}async doLoad(){const e=null!=this.symbolLayer.width?this.symbolLayer.width:this.symbolLayer.height,i=null!=this.symbolLayer.height?this.symbolLayer.height:e;this._vvConvertOptions=new R({supports:{size:!0,color:!0,rotation:!1,opacity:!0},modelSize:[1,1,1],symbolSize:[e,1,i],unitInMeters:this._context.renderCoordsHelper.unitInMeters,fallbackColor:this._getFallbackOpacityAndColor(),fallbackSize:[e,1,i]});const r=this._context.renderer?.visualVariables;this._fastUpdates=r?.length?k(this._context.renderer,this._vvConvertOptions):null;const s=this.symbolLayer.anchor||"center";this._upVectorAlignment="heading"===this.symbolLayer.profileRotation?Z.World:Z.Path;const n=this.symbolLayer.profile||"circle";switch(n){default:case"circle":this._profile=ee[s];break;case"quad":this._profile=$[s]}switch(this.symbolLayer.join){case"round":this._extruder=new T(0,D);break;case"bevel":this._extruder=new T(0,1);break;case"miter":this._extruder=new T(.8*Math.PI,1);break;default:this._extruder=new W}const c=this.symbolLayer.cap||"butt";switch(c){case"none":this._startCap=new N,this._endCap=new N;break;case"butt":default:this._startCap=new H(this._profile,0),this._endCap=new H(this._profile,0,!0);break;case"square":this._startCap=new H(this._profile,-.5),this._endCap=new H(this._profile,.5,!0);break;case"round":{const e="quad"===n;this._startCap=new q({profile:this._profile,flip:!1,breakNormals:e,subdivisions:V}),this._endCap=new q({profile:this._profile,flip:!0,breakNormals:e,subdivisions:V});break}}const m=this.symbolLayer?.material?.emissiveFactor,u=m?h(p(m)):f,b=this.symbolLayer?.material?.color,y=this._getCombinedOpacityAndColor(b),g=d(y),_={diffuse:g,ambient:g,emissiveFactor:u,opacity:y[3],drivenOpacity:this.needsDrivenTransparentPass,hasVertexColors:!1,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows,offsetTransparentBackfaces:!0};if(!this._drivenProperties.size&&(a(this._intrinsicSize,e,i),!A(this._intrinsicSize[0])||!A(this._intrinsicSize[1])))throw new t("graphics3dpathsymbollayer:invalid-size","Symbol sizes may not be negative values");let v;this._fastUpdates?.visualVariables.size||o(this._intrinsicSize,this._intrinsicSize,1/this._context.renderCoordsHelper.unitInMeters),this._fastUpdates?v=new se({..._,...this._fastUpdates.materialParameters,size:l(this._intrinsicSize)},this._context):(_.hasVertexColors=this._drivenProperties.color||this._drivenProperties.opacity,_.normalType=I.Compressed,v=new re(_,this._context)),v.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,cullFace:v.transparent||"none"===c?G.None:G.Back}),this._materials[0]=v,this._context.stage.add(v)}destroy(){super.destroy(),this._context.stage.remove(this._materials[0]),this._materials.length=0}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,ae,this.symbolLayer.type))return null;const i=this.setGraphicElevationContext(t);return this._createAs3DShape(e,i)}layerOpacityChanged(){const e=this.symbolLayer?.material?.color,t=this._getCombinedOpacity(e);this._materials[0]?.setParameters({opacity:t})}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,P)}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return this._materials[0]?.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),!0}applyRendererDiff(e,t){for(const i in e.diff){if("visualVariables"!==i)return U.RecreateSymbol;if(!E(this._fastUpdates,t,this._vvConvertOptions))return U.RecreateSymbol;this._materials[0]?.setParameters(this._fastUpdates.materialParameters)}return U.FastUpdate}_getVertexData(e){let t=0;const i=e.paths,r=[],s=e.spatialReference,a=this._context.elevationProvider.spatialReference,o=this._context.renderCoordsHelper.spatialReference;for(const h of i)t+=h.length;const n=w(3*t);let l,c=0;for(const h of i){r.push({offset:c,numVertices:h.length});for(const t of h)n[c++]=t[0],n[c++]=t[1],n[c++]=e.hasZ?t[2]:0}return null==a||s.equals(a)||y(n,s,0,n,a,0,t)?(null==a||a.equals(o)?l=x(n):(l=w(3*t),y(n,a,0,l,o,0,t)),{pathVertexDataInfos:r,vertexDataES:n,vertexDataRS:l}):null}_createAs3DShape(e,t){const{graphic:a,renderingInfo:o}=e,n=a.geometry,l=this._getVertexData(n);if(null==l)return this.logger.warn("PathSymbol3DLayer geometry failed to be created (failed to project geometry to view spatial reference)"),null;if(0===l.pathVertexDataInfos.length)return 0!==n.paths.length&&n.paths.some((e=>e.length>0))||this.logger.warn("PathSymbol3DLayer geometry failed to be created (no paths were defined)"),null;const h=new Array,p=n.spatialReference,f=g(),d=this._context.renderCoordsHelper,u=new O(l.vertexDataES),b=a.uid;let y=0;for(const g of l.pathVertexDataInfos){const e=g.numVertices;if(e<2)continue;const n=g.offset;if(null!=this._context.clippingExtent&&(_(l.vertexDataES,n,e,f),!v(f,this._context.clippingExtent)))continue;const w=new Array,x=n+3*e;for(let i=n;i<x;i+=3){u.offset=i;const e=j(u,this._context.elevationProvider,t,d);m(pe,l.vertexDataRS[i],l.vertexDataRS[i+1],l.vertexDataRS[i+2]),d.setAltitude(pe,e),l.vertexDataRS[i]=pe[0],l.vertexDataRS[i+1]=pe[1],l.vertexDataRS[i+2]=pe[2],w.push(te(this._upVectorAlignment))}const P=new F(w,l.vertexDataES,l.vertexDataRS,n);ne(P,this._upVectorAlignment,this._context.renderCoordsHelper);const S=new M(P,this._profile,this._extruder,this._startCap,this._endCap);let C=null;if(this._fastUpdates){const e=this._fastUpdates.visualVariables,t=z(e.size?.field,a)??0,i=z(e.color?.field,a)??0,r=z(e.opacity?.field,a)??0;C=new Q(S,t,i,r)}else{const e=c(this._intrinsicSize);if(this._drivenProperties.size){const t=o.size??["symbol-value","symbol-value","symbol-value"];e[0]*=le(t[0],"symbol-value"===t[2]?this.symbolLayer.height||0:t[2],this.symbolLayer.width||0),e[1]*=le(t[2],"symbol-value"===t[0]?this.symbolLayer.width||0:t[0],this.symbolLayer.height||0)}let t;if(this._drivenProperties.color&&(t=o.color??this._getFallbackOpacityAndColor()),this._drivenProperties.opacity){const e=o.opacity??this._getFallbackOpacityAndColor()[3];t=t?[t[0],t[1],t[2],e]:[1,1,1,e]}const i=new X(S);i.bake(e),t&&i.bakeVertexColors(t),C=i}const D=C.createGeometryData(),V=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:b,layerViewUid:this._context.layerViewUid}),L=new J(this._materials[0],D,C,p,this._stencilWidth,V);L.transformation=i(s(),r,S.path.origin),h.push(L),y+=S.usedMemory}if(0===h.length)return null;const w=new B({geometries:h,layerViewUid:this._context.layerViewUid,graphicUid:b}),x=new C(this,w,h,null,null,((e,t,i,r,s)=>he(e,t,r,s,this._upVectorAlignment)),t,null,y);return x.alignedSampledElevation=0,x.needsElevationUpdates=P(t.mode),x}_getFallbackOpacityAndColor(){const t=this.symbolLayer?.material?.color;return e.toUnitRGBA(t)??b}}function ne(e,t,i){const{origin:r,positions:s}=e;let a=e.offset;switch(t){default:case Z.World:for(const t of e.vertices)pe[0]=s[a++]+r[0],pe[1]=s[a++]+r[1],pe[2]=s[a++]+r[2],i.worldUpAtPosition(pe,pe),t.setFrameFromUpVector(pe);break;case Z.Path:pe[0]=s[a]+r[0],pe[1]=s[a+1]+r[1],pe[2]=s[a+2]+r[2],i.worldUpAtPosition(pe,pe),Y(e,pe)}}function le(e,t,i){switch(e){case"symbol-value":return i;case"proportional":return t;default:return e}}function ce(e,t,i,r){let s=0;const{origin:a,vertices:o,positions:n,positionsES:l}=e,c=e.offset+3*o.length;for(let h=e.offset;h<c;h+=3)m(pe,l[h],l[h+1],l[h+2]),i(pe,fe),s+=fe.sampledElevation,pe[0]=n[h]+a[0],pe[1]=n[h+1]+a[1],pe[2]=n[h+2]+a[2],r.setAltitude(pe,fe.z),n[h]=pe[0]-a[0],n[h+1]=pe[1]-a[1],n[h+2]=pe[2]-a[2];return e.updatePathVertexInformation(),s/o.length}function he(e,t,i,r,s){const a=e.stageObject,o=a.geometries;let n=0;for(const l of o){if(!K(l))continue;const e=l.path,o=e.builder.path;n+=ce(o,t,i,r),s!==Z.World&&ne(o,s,r),e.onPathChanged(l),l.invalidateBoundingInfo(),a.geometryVertexAttributeUpdated(l,ie.POSITION)}return n/o.length}function me(e){return 1===(e.material?.color?.a??1)}const pe=u(),fe=new S;export{oe as Graphics3DPathSymbolLayer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../Color.js";import{pt2px as t}from"../../../../core/screenUtils.js";import{e as i}from"../../../../chunks/earcut.js";import{ZEROS as r}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromBuffer as o,intersectsClippingArea as s,empty as n,expandWithAABB as a,create as l}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as c,doubleSubArray as p}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as h,floatSubArray as u}from"../../../../geometry/support/FloatArray.js";import{SymbolUpdateType as d,elevationModeChangeUpdateType as m,needsElevationUpdates2D as y}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as _}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as g}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as f}from"./Graphics3DSymbolLayer.js";import{mixinColorAndOpacity as b}from"./graphicUtils.js";import{ApplyRendererDiffResult as v}from"./interfaces.js";import{parseCapType as O}from"./lineUtils.js";import{geometryAsPolygon as x,createIndices3D as C,createColorGeometry as D,PolygonCreationDataBase as A}from"./polygonUtils.js";import{initFastSymbolUpdatesState as j,updateFastSymbolUpdatesState as S,getAttributeValue as P,ConvertOptions as U}from"../support/FastSymbolUpdates.js";import{createMaterial as E,uvElevationAligner as F}from"../support/patternUtils.js";import{createMapSpaceUVCoords as G,createMapSpaceUVCoordsDraped as L}from"../support/uvUtils.js";import{createGeometry as R}from"../../support/engineContent/line.js";import{geometryToRenderInfo as w,geometryToRenderInfoDraped as I}from"../../support/renderInfoUtils/polygon.js";import{Object3D as M}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as V}from"../../webgl-engine/lib/RenderGeometry.js";import{getStipplePatternForLinePattern as B}from"../../webgl-engine/materials/lineStippleUtils.js";import{PatternMaterial as T}from"../../webgl-engine/materials/PatternMaterial.js";import{RibbonLineMaterial as k}from"../../webgl-engine/materials/RibbonLineMaterial.js";const z=["polyline","polygon","extent"];class H extends f{static{this.elevationModeChangeTypes={definedChanged:d.RECREATE,staysOnTheGround:d.NONE,onTheGroundChanged:d.RECREATE}}constructor(e,t,i,r){super(e,t,i,r,Q(t)),this._needsUV=!1}async doLoad(){this._fastUpdates=j(this._context.renderer,this._vvConvertOptions)}_createMaterials(){if(this._materials.length>0)return;const e=this.symbolLayer?.material?.color,i=this._getCombinedOpacityAndColor(e);this._materials[J.Fill]=E(this.symbolLayer,{color:i,forceTransparentMode:this.needsDrivenTransparentPass,discardInvisibleFragments:!0,polygonOffset:!1,hasVertexColors:!0,draped:this.draped,hasSlicePlane:this._context.slicePlaneEnabled,...this._fastUpdates?.materialParameters}),this._needsUV=this._materials[J.Fill]instanceof T;const r=this.symbolLayer.outline;if(K(r)){const e=B(r.pattern);this._materials[J.Outline]=new k({width:t(r.size),color:this._getOutlineColor(),hasPolygonOffset:!0,hasSlicePlane:this._context.slicePlaneEnabled,isClosed:!0,stipplePattern:e,cap:O(r.patternCap||"butt")})}this._context.stage.addMany(this._materials)}destroy(){super.destroy(),this._context.stage.removeMany(this._materials),this._materials.length=0}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,z,this.symbolLayer.type))return null;const i=this._getVertexOpacityAndColor(e.renderingInfo,this._getFallbackOpacityAndColor(),255),r=this.setGraphicElevationContext(t);return this.ensureDrapedStatus("on-the-ground"===r.mode),this._createMaterials(),this.draped?this._createAsOverlay(t,i):this._createAs3DShape(t,i,r)}applyRendererDiff(e,t){for(const i in e.diff){if("visualVariables"!==i)return v.RecreateSymbol;if(!S(this._fastUpdates,t,this._vvConvertOptions))return v.RecreateSymbol;this._materials[J.Fill]?.setParameters(this._fastUpdates.materialParameters)}return v.FastUpdate}layerOpacityChanged(){if(null!=this._materials[J.Fill]){const e=this._materials[J.Fill].parameters.color,t=this.symbolLayer?.material?.color,i=this._getCombinedOpacity(t);this._materials[J.Fill].setParameters({color:[e[0],e[1],e[2],i],forceTransparentMode:this.needsDrivenTransparentPass})}if(null!=this._materials[J.Outline]){const e=this._materials[J.Outline].parameters.color;this._materials[J.Outline].setParameters({color:[e[0],e[1],e[2],this._getOutlineOpacity()]})}}layerElevationInfoChanged(e,t,i){const r=this._elevationContext.mode,o=m(H.elevationModeChangeTypes,i,r);if(o!==d.UPDATE)return o;const s=y(r);return this.updateGraphics3DGraphicElevationInfo(e,t,(()=>s))}slicePlaneEnabledChanged(){if(this._materials[J.Fill]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[J.Outline]){const e={hasSlicePlane:this._context.slicePlaneEnabled};this._materials[J.Outline].setParameters(e)}return!0}physicalBasedRenderingChanged(){return!0}_createAs3DShape(e,t,i){const r=x(e.geometry);if(!r)return null;const o=w(r,this._context.elevationProvider,this._context.renderCoordsHelper,i),s=new W(o,t,this._context.layer.uid,e.uid),n=s.renderData.position.length/3;if(this._needsUV&&(s.uvMapSpace=h(4*n,!0),s.boundingRect=c(9*n,!0),G(s.uvMapSpace,s.boundingRect,s.renderData.position,this._context.renderCoordsHelper)),s.objectAndLayerIdColor=this._context.stage.renderView?.getObjectAndLayerIdColor(s),this._createAs3DShapeFill(e,s),this._materials[J.Outline]&&this._createAs3DShapeOutline(s),this._logGeometryCreationWarnings(s.renderData,r.rings,"rings","FillSymbol3DLayer"),0===s.outGeometries.length)return null;const a=new M({geometries:s.outGeometries,castShadow:!1,layerUid:this._context.layer.uid,graphicUid:e.uid}),l=new g(this,a,s.outGeometries,null,null,F,i);return l.alignedSampledElevation=s.renderData.sampledElevation,l.needsElevationUpdates=y(i.mode),l}_createAs3DShapeFill(e,t){const i=t.renderData.polygons;for(const{position:r,mapPositions:n,holeIndices:a,index:l,count:c}of i){if(null!=this._context.clippingExtent&&(o(n,N),!s(N,this._context.clippingExtent)))continue;const i=C(n,a,this._context.elevationProvider.spatialReference);if(0===i.length)continue;const h=this._fastUpdates?.visualVariables.color,d=D({material:this._materials[J.Fill],indices:i,mapPositions:n,attributeData:{position:r,color:h?null:t.color,colorFeature:h?P(h.field,e):null,uvMapSpace:this._needsUV?u(t.uvMapSpace,4*l,4*c):null,boundingRect:this._needsUV?p(t.boundingRect,9*l,9*c):null,objectAndLayerIdColor:t.objectAndLayerIdColor}});t.outGeometries.push(d)}}_createAs3DShapeOutline(e){if(null==this._materials[J.Outline])return;const t=e.renderData.outlines;for(const{mapPositions:i,position:r}of t){if(null!=this._context.clippingExtent&&(o(i,N),!s(N,this._context.clippingExtent)))continue;const t=R(this._materials[J.Outline],{overlayInfo:null,removeDuplicateStartEnd:!0,mapPositions:i,attributeData:{position:r}},e.objectAndLayerIdColor);e.outGeometries.push(t)}}_createAsOverlay(e,t){const i=x(e.geometry);if(null==i)return null;this._materials[J.Fill].renderPriority=this._renderPriority+this._renderPriorityStep/2,null!=this._materials[J.Outline]&&(this._materials[J.Outline].renderPriority=this._renderPriority);const r=I(i,this._context.overlaySR),o=new q(r,t,this._context.layer.uid,e.uid),s=o.renderData.position.length/3;return this._needsUV&&(o.uvMapSpace=h(4*s,!0),L(o.uvMapSpace,o.renderData.position,this._context.overlaySR,this._context.graphicsCoreOwner.view.state.viewingMode)),o.outBoundingBox=n(),o.objectAndLayerIdColor=this._context.stage.renderView?.getObjectAndLayerIdColor(o),this._createAsOverlayFill(e,o),this._materials[J.Outline]&&this._createAsOverlayOutline(o),this._logGeometryCreationWarnings(o.renderData,i.rings,"rings","FillSymbol3DLayer"),0===o.outGeometries.length?null:new _(this,o.outGeometries,o.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayFill(e,t){const r=t.renderData.polygons;for(const{position:n,holeIndices:l,index:c,count:p}of r){const r=o(n,N);if(!s(r,this._context.clippingExtent))continue;const h=i(n,l,3);if(0===h.length)continue;a(t.outBoundingBox,r);const d=this._fastUpdates?.visualVariables.color,m=D({material:this._materials[J.Fill],indices:h,attributeData:{position:n,color:d?null:t.color,colorFeature:d?P(d.field,e):null,uvMapSpace:this._needsUV?u(t.uvMapSpace,4*c,4*p):null,objectAndLayerIdColor:t.objectAndLayerIdColor}});t.outGeometries.push(new V(m,t))}}_createAsOverlayOutline(e){if(null==this._materials[J.Outline])return;const t=e.renderData.outlines;for(let i=0;i<t.length;++i){const{position:r}=t[i];if(o(r,N),!s(N,this._context.clippingExtent))continue;a(e.outBoundingBox,N);const n=R(this._materials[J.Outline],{overlayInfo:{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper},removeDuplicateStartEnd:!0,attributeData:{position:r}},e.objectAndLayerIdColor);e.outGeometries.push(new V(n,e))}}_getOutlineOpacity(){const e=this.symbolLayer?.outline?.color;return(this.draped?1:this._getLayerOpacity())*(null!=e?e.a:0)}_getOutlineColor(){const t=this.symbolLayer?.outline?.color,i=this._getOutlineOpacity();return b(null!=t?e.toUnitRGB(t):null,i)}test(){return{...super.test(),createAsOverlay:(e,t)=>this._createAsOverlay(e,t),createAs3DShape:(e,t,i)=>this._createAs3DShape(e,t,i)}}_getFallbackOpacityAndColor(){const t=this.symbolLayer?.material?.color;return e.toUnitRGBA(t)??r}get _vvConvertOptions(){return new U({supports:{size:!1,color:!0,rotation:!1,opacity:!1},fallbackColor:this._getFallbackOpacityAndColor()})}}const N=l();class W extends A{constructor(e,t,i,r){super(e,i,r),this.color=t}}class q extends A{constructor(e,t,i,r){super(e,i,r),this.color=t}}var J;function K(e){return null!=e?.size&&e.size>0&&null!=e.color&&(null==e.pattern||"style"!==e.pattern.type||"none"!==e.pattern.style)}function Q(e){return 1===(e.material?.color?.a??1)}!function(e){e[e.Fill=0]="Fill",e[e.Outline=1]="Outline"}(J||(J={}));export{H as Graphics3DPolygonFillSymbolLayer};
5
+ import e from"../../../../Color.js";import{pt2px as t}from"../../../../core/screenUtils.js";import{e as i}from"../../../../chunks/earcut.js";import{ZEROS as r}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromBuffer as o,intersectsClippingArea as s,empty as n,expandWithAABB as a,create as l}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as c,doubleSubArray as p}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as h,floatSubArray as u}from"../../../../geometry/support/FloatArray.js";import{SymbolUpdateType as d,elevationModeChangeUpdateType as m,needsElevationUpdates2D as y}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as _}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as g}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as f}from"./Graphics3DSymbolLayer.js";import{mixinColorAndOpacity as b}from"./graphicUtils.js";import{ApplyRendererDiffResult as v}from"./interfaces.js";import{parseCapType as O}from"./lineUtils.js";import{geometryAsPolygon as x,createIndices3D as C,createColorGeometry as D,PolygonCreationDataBase as A}from"./polygonUtils.js";import{initFastSymbolUpdatesState as j,updateFastSymbolUpdatesState as S,getAttributeValue as P,ConvertOptions as U}from"../support/FastSymbolUpdates.js";import{createMaterial as E,uvElevationAligner as F}from"../support/patternUtils.js";import{createMapSpaceUVCoords as G,createMapSpaceUVCoordsDraped as L}from"../support/uvUtils.js";import{createGeometry as w}from"../../support/engineContent/line.js";import{geometryToRenderInfo as R,geometryToRenderInfoDraped as I}from"../../support/renderInfoUtils/polygon.js";import{Object3D as M}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as V}from"../../webgl-engine/lib/RenderGeometry.js";import{getStipplePatternForLinePattern as B}from"../../webgl-engine/materials/lineStippleUtils.js";import{PatternMaterial as T}from"../../webgl-engine/materials/PatternMaterial.js";import{RibbonLineMaterial as k}from"../../webgl-engine/materials/RibbonLineMaterial.js";const z=["polyline","polygon","extent"];class H extends f{static{this.elevationModeChangeTypes={definedChanged:d.RECREATE,staysOnTheGround:d.NONE,onTheGroundChanged:d.RECREATE}}constructor(e,t,i,r){super(e,t,i,r,Q(t)),this._needsUV=!1}async doLoad(){this._fastUpdates=j(this._context.renderer,this._vvConvertOptions)}_createMaterials(){if(this._materials.length>0)return;const e=this.symbolLayer?.material?.color,i=this._getCombinedOpacityAndColor(e);this._materials[J.Fill]=E(this.symbolLayer,{color:i,forceTransparentMode:this.needsDrivenTransparentPass,discardInvisibleFragments:!0,polygonOffset:!1,hasVertexColors:!0,draped:this.draped,hasSlicePlane:this._context.slicePlaneEnabled,...this._fastUpdates?.materialParameters}),this._needsUV=this._materials[J.Fill]instanceof T;const r=this.symbolLayer.outline;if(K(r)){const e=B(r.pattern);this._materials[J.Outline]=new k({width:t(r.size),color:this._getOutlineColor(),hasPolygonOffset:!0,hasSlicePlane:this._context.slicePlaneEnabled,isClosed:!0,stipplePattern:e,cap:O(r.patternCap||"butt")})}this._context.stage.addMany(this._materials)}destroy(){super.destroy(),this._context.stage.removeMany(this._materials),this._materials.length=0}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,z,this.symbolLayer.type))return null;const i=this._getVertexOpacityAndColor(e.renderingInfo,this._getFallbackOpacityAndColor(),255),r=this.setGraphicElevationContext(t);return this.ensureDrapedStatus("on-the-ground"===r.mode),this._createMaterials(),this.draped?this._createAsOverlay(t,i):this._createAs3DShape(t,i,r)}applyRendererDiff(e,t){for(const i in e.diff){if("visualVariables"!==i)return v.RecreateSymbol;if(!S(this._fastUpdates,t,this._vvConvertOptions))return v.RecreateSymbol;this._materials[J.Fill]?.setParameters(this._fastUpdates.materialParameters)}return v.FastUpdate}layerOpacityChanged(){if(null!=this._materials[J.Fill]){const e=this._materials[J.Fill].parameters.color,t=this.symbolLayer?.material?.color,i=this._getCombinedOpacity(t);this._materials[J.Fill].setParameters({color:[e[0],e[1],e[2],i],forceTransparentMode:this.needsDrivenTransparentPass})}if(null!=this._materials[J.Outline]){const e=this._materials[J.Outline].parameters.color;this._materials[J.Outline].setParameters({color:[e[0],e[1],e[2],this._getOutlineOpacity()]})}}layerElevationInfoChanged(e,t,i){const r=this._elevationContext.mode,o=m(H.elevationModeChangeTypes,i,r);if(o!==d.UPDATE)return o;const s=y(r);return this.updateGraphics3DGraphicElevationInfo(e,t,(()=>s))}slicePlaneEnabledChanged(){if(this._materials[J.Fill]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[J.Outline]){const e={hasSlicePlane:this._context.slicePlaneEnabled};this._materials[J.Outline].setParameters(e)}return!0}physicalBasedRenderingChanged(){return!0}_createAs3DShape(e,t,i){const r=x(e.geometry);if(!r)return null;const o=R(r,this._context.elevationProvider,this._context.renderCoordsHelper,i),s=new W(o,t,this._context.layerViewUid,e.uid),n=s.renderData.position.length/3;if(this._needsUV&&(s.uvMapSpace=h(4*n,!0),s.boundingRect=c(9*n,!0),G(s.uvMapSpace,s.boundingRect,s.renderData.position,this._context.renderCoordsHelper)),s.objectAndLayerIdColor=this._context.stage.renderView?.getObjectAndLayerIdColor(s),this._createAs3DShapeFill(e,s),this._materials[J.Outline]&&this._createAs3DShapeOutline(s),this._logGeometryCreationWarnings(s.renderData,r.rings,"rings","FillSymbol3DLayer"),0===s.outGeometries.length)return null;const a=new M({geometries:s.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:e.uid}),l=new g(this,a,s.outGeometries,null,null,F,i);return l.alignedSampledElevation=s.renderData.sampledElevation,l.needsElevationUpdates=y(i.mode),l}_createAs3DShapeFill(e,t){const i=t.renderData.polygons;for(const{position:r,mapPositions:n,holeIndices:a,index:l,count:c}of i){if(null!=this._context.clippingExtent&&(o(n,N),!s(N,this._context.clippingExtent)))continue;const i=C(n,a,this._context.elevationProvider.spatialReference);if(0===i.length)continue;const h=this._fastUpdates?.visualVariables.color,d=D({material:this._materials[J.Fill],indices:i,mapPositions:n,attributeData:{position:r,color:h?null:t.color,colorFeature:h?P(h.field,e):null,uvMapSpace:this._needsUV?u(t.uvMapSpace,4*l,4*c):null,boundingRect:this._needsUV?p(t.boundingRect,9*l,9*c):null,objectAndLayerIdColor:t.objectAndLayerIdColor}});t.outGeometries.push(d)}}_createAs3DShapeOutline(e){if(null==this._materials[J.Outline])return;const t=e.renderData.outlines;for(const{mapPositions:i,position:r}of t){if(null!=this._context.clippingExtent&&(o(i,N),!s(N,this._context.clippingExtent)))continue;const t=w(this._materials[J.Outline],{overlayInfo:null,removeDuplicateStartEnd:!0,mapPositions:i,attributeData:{position:r}},e.objectAndLayerIdColor);e.outGeometries.push(t)}}_createAsOverlay(e,t){const i=x(e.geometry);if(null==i)return null;this._materials[J.Fill].renderPriority=this._renderPriority+this._renderPriorityStep/2,null!=this._materials[J.Outline]&&(this._materials[J.Outline].renderPriority=this._renderPriority);const r=I(i,this._context.overlaySR),o=new q(r,t,this._context.layerViewUid,e.uid),s=o.renderData.position.length/3;return this._needsUV&&(o.uvMapSpace=h(4*s,!0),L(o.uvMapSpace,o.renderData.position,this._context.overlaySR,this._context.graphicsCoreOwner.view.state.viewingMode)),o.outBoundingBox=n(),o.objectAndLayerIdColor=this._context.stage.renderView?.getObjectAndLayerIdColor(o),this._createAsOverlayFill(e,o),this._materials[J.Outline]&&this._createAsOverlayOutline(o),this._logGeometryCreationWarnings(o.renderData,i.rings,"rings","FillSymbol3DLayer"),0===o.outGeometries.length?null:new _(this,o.outGeometries,o.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayFill(e,t){const r=t.renderData.polygons;for(const{position:n,holeIndices:l,index:c,count:p}of r){const r=o(n,N);if(!s(r,this._context.clippingExtent))continue;const h=i(n,l,3);if(0===h.length)continue;a(t.outBoundingBox,r);const d=this._fastUpdates?.visualVariables.color,m=D({material:this._materials[J.Fill],indices:h,attributeData:{position:n,color:d?null:t.color,colorFeature:d?P(d.field,e):null,uvMapSpace:this._needsUV?u(t.uvMapSpace,4*c,4*p):null,objectAndLayerIdColor:t.objectAndLayerIdColor}});t.outGeometries.push(new V(m,t))}}_createAsOverlayOutline(e){if(null==this._materials[J.Outline])return;const t=e.renderData.outlines;for(let i=0;i<t.length;++i){const{position:r}=t[i];if(o(r,N),!s(N,this._context.clippingExtent))continue;a(e.outBoundingBox,N);const n=w(this._materials[J.Outline],{overlayInfo:{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper},removeDuplicateStartEnd:!0,attributeData:{position:r}},e.objectAndLayerIdColor);e.outGeometries.push(new V(n,e))}}_getOutlineOpacity(){const e=this.symbolLayer?.outline?.color;return(this.draped?1:this._getLayerOpacity())*(null!=e?e.a:0)}_getOutlineColor(){const t=this.symbolLayer?.outline?.color,i=this._getOutlineOpacity();return b(null!=t?e.toUnitRGB(t):null,i)}test(){return{...super.test(),createAsOverlay:(e,t)=>this._createAsOverlay(e,t),createAs3DShape:(e,t,i)=>this._createAs3DShape(e,t,i)}}_getFallbackOpacityAndColor(){const t=this.symbolLayer?.material?.color;return e.toUnitRGBA(t)??r}get _vvConvertOptions(){return new U({supports:{size:!1,color:!0,rotation:!1,opacity:!1},fallbackColor:this._getFallbackOpacityAndColor()})}}const N=l();class W extends A{constructor(e,t,i,r){super(e,i,r),this.color=t}}class q extends A{constructor(e,t,i,r){super(e,i,r),this.color=t}}var J;function K(e){return null!=e?.size&&e.size>0&&null!=e.color&&(null==e.pattern||"style"!==e.pattern.type||"none"!==e.pattern.style)}function Q(e){return 1===(e.material?.color?.a??1)}!function(e){e[e.Fill=0]="Fill",e[e.Outline=1]="Outline"}(J||(J={}));export{H as Graphics3DPolygonFillSymbolLayer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{ViewingMode as e}from"../../../ViewingMode.js";class s{constructor(e,s){this.scheduler=e,this.schedule=s,this.sharedResources=null,this.streamDataRequester=null,this.elevationProvider=null,this.renderer=null,this.stage=null,this.clippingExtent=null,this.renderCoordsHelper=null,this.overlaySR=null,this.layer=null,this.drapeSourceRenderer=null,this.graphicsCoreOwner=null,this.localOriginFactory=null,this.featureExpressionInfoContext=null,this.screenSizePerspectiveEnabled=!0,this.slicePlaneEnabled=!1,this.physicalBasedRenderingEnabled=!1,this.skipHighSymbolLods=!1,this.isAsync=!1}get spherical(){return this.stage.view.state.viewingMode===e.Global}}class i{constructor(){this.renderPriority=0,this.renderPriorityStep=1,this.ignoreDrivers=!1}}export{s as Graphics3DSymbolCreationContext,i as Graphics3DSymbolLayerCreationContext};
5
+ import{ViewingMode as e}from"../../../ViewingMode.js";class s{constructor(e,s,i){this.scheduler=e,this.schedule=s,this.layerViewUid=i,this.sharedResources=null,this.streamDataRequester=null,this.elevationProvider=null,this.renderer=null,this.stage=null,this.clippingExtent=null,this.renderCoordsHelper=null,this.overlaySR=null,this.layer=null,this.drapeSourceRenderer=null,this.graphicsCoreOwner=null,this.localOriginFactory=null,this.featureExpressionInfoContext=null,this.screenSizePerspectiveEnabled=!0,this.slicePlaneEnabled=!1,this.physicalBasedRenderingEnabled=!1,this.skipHighSymbolLods=!1,this.isAsync=!1}get spherical(){return this.stage.view.state.viewingMode===e.Global}}class i{constructor(){this.renderPriority=0,this.renderPriorityStep=1,this.ignoreDrivers=!1}}export{s as Graphics3DSymbolCreationContext,i as Graphics3DSymbolLayerCreationContext};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../Color.js";import{getMetersPerUnitForSR as t}from"../../../../core/unitUtils.js";import{e as r}from"../../../../chunks/earcut.js";import{set as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as i,create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{b as s}from"../../../../chunks/vec42.js";import{toRadian as a}from"../../../../core/libs/gl-matrix-2/math/common.js";import{fromBuffer as l,intersectsClippingArea as c,empty as h,expandWithAABB as m,create as u}from"../../../../geometry/support/aaBoundingBox.js";import{empty as p,expandPointInPlace as d,create as g}from"../../../../geometry/support/aaBoundingRect.js";import{newDoubleArray as y,doubleSubArray as f}from"../../../../geometry/support/DoubleArray.js";import{perVertexElevationAligner as _}from"./ElevationAligners.js";import{SymbolUpdateType as x,elevationModeChangeUpdateType as v,needsElevationUpdates2D as b}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as C}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as D}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as j}from"./Graphics3DSymbolLayer.js";import{geometryAsPolygon as S,createWaterGeometry as w,PolygonCreationDataBase as G}from"./polygonUtils.js";import{geometryToRenderInfo as E,geometryToRenderInfoDraped as A}from"../../support/renderInfoUtils/polygon.js";import{Object3D as L}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as O}from"../../webgl-engine/lib/RenderGeometry.js";import{Parameters as P,WaterMaterial as T}from"../../webgl-engine/materials/WaterMaterial.js";import{wavePresets as R}from"../../webgl-engine/materials/internal/waterMaterialUtils.js";const I=["polyline","polygon","extent"];class B extends j{static{this.unitSizeOfTexture=100}static{this.elevationModeChangeTypes={definedChanged:x.RECREATE,staysOnTheGround:x.NONE,onTheGroundChanged:x.RECREATE}}constructor(e,t,r,o){super(e,t,r,o)}async doLoad(){}destroy(){super.destroy(),this._context.stage.remove(this._materials[0]),this._materials.length=0}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,I,this.symbolLayer.type))return null;const r=this.setGraphicElevationContext(t);return this.ensureDrapedStatus("on-the-ground"===r.mode),this.ensureMaterial(),this.draped?this._createAsOverlay(t):this._createAs3DShape(t,r,t.uid)}ensureMaterial(){if(this._materials[0])return;const t=new P,r=this.symbolLayer.color;null!=r&&(t.color=e.toUnitRGBA(r));const o=this._getCombinedOpacity(r,{hasIntrinsicColor:!0});t.color=[t.color[0],t.color[1],t.color[2],o],t.transparent=o<1||this.needsDrivenTransparentPass,t.waveDirection=null!=this.symbolLayer.waveDirection?U(this.symbolLayer.waveDirection):i(0,0);const n=this.symbolLayer.waveStrength+"-"+this.symbolLayer.waterbodySize,s=R[n];t.waveStrength=s.waveStrength,t.waveTextureRepeat=s.textureRepeat,t.waveVelocity=s.waveVelocity,t.flowStrength=s.perturbationStrength,t.hasSlicePlane=this._context.slicePlaneEnabled,t.draped=this.draped,this._materials[0]=new T(t,this._context),this._context.stage.add(this._materials[0])}layerOpacityChanged(){if(null==this._materials[0])return;const e=this._materials[0].parameters.color,t=this._getCombinedOpacity(this.symbolLayer.color,{hasIntrinsicColor:!0}),r=t<1||this.needsDrivenTransparentPass;this._materials[0].setParameters({color:[e[0],e[1],e[2],t],transparent:r})}layerElevationInfoChanged(e,t,r){const o=this._elevationContext.mode,i=v(B.elevationModeChangeTypes,r,o);if(i!==x.UPDATE)return i;const n=b(o);return this.updateGraphics3DGraphicElevationInfo(e,t,(()=>n))}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return!0}_createAs3DShape(e,t,r){const o=S(e.geometry);if(null==o)return null;const i=E(o,this._context.elevationProvider,this._context.renderCoordsHelper,t),n=i.position.length/3,s=y(2*n);M(s,i.mapPositions,n,this._context.elevationProvider.spatialReference);const a=new N(i,s,this._context.layer.uid,e.uid);if(a.objectAndLayerIdColor=this._context.stage.renderView?.getObjectAndLayerIdColor(a),this._create3DShapeGeometries(a),this._logGeometryCreationWarnings(a.renderData,o.rings,"rings","WaterSymbol3DLayer"),0===a.outGeometries.length)return null;const l=new L({geometries:a.outGeometries,castShadow:!1,layerUid:this._context.layer.uid,graphicUid:r}),c=new D(this,l,a.outGeometries,null,null,_,t);return c.alignedSampledElevation=a.renderData.sampledElevation,c.needsElevationUpdates=b(t.mode),c}_create3DShapeGeometries(e){const t=e.renderData.polygons,o=e.uvCoords;for(const{count:i,index:n,position:s,mapPositions:a,holeIndices:h}of t){if(null!=this._context.clippingExtent&&(l(a,k),!c(k,this._context.clippingExtent)))continue;const t=r(a,h,3);if(0===t.length)continue;const m=f(o,2*n,2*i),u=w({material:this._materials[0],indices:t,mapPositions:a,attributeData:{position:s,uv0:m}},e.objectAndLayerIdColor);e.outGeometries.push(u)}}_createAsOverlay(e){const t=S(e.geometry);if(null==t)return null;this._materials[0].renderPriority=this._renderPriority;const r=A(t,this._context.overlaySR),o=r.position.length/3,i=y(2*o);M(i,r.position,o,this._context.overlaySR);const n=new H(r,i,this._context.layer.uid,e.uid);return n.objectAndLayerIdColor=this._context.stage.renderView?.getObjectAndLayerIdColor(n),n.outBoundingBox=h(),this._createAsOverlayWater(n),this._logGeometryCreationWarnings(n.renderData,t.rings,"rings","WaterSymbol3DLayer"),0===n.outGeometries.length?null:new C(this,n.outGeometries,n.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayWater(e){const t=e.uvCoords,o=e.renderData.polygons;for(const{position:i,holeIndices:n,index:s,count:a}of o){if(l(i,k),!c(k,this._context.clippingExtent))continue;m(e.outBoundingBox,k);const o=r(i,n,3);if(0===o.length)continue;const h=f(t,2*s,2*a),u=w({material:this._materials[0],indices:o,attributeData:{position:i,uv0:h}},e.objectAndLayerIdColor);e.outGeometries.push(new O(u,e))}}test(){return{...super.test(),create3DShape:e=>this._createAs3DShape(e.graphic,e.elevationContext,e.graphicUid),ensureMaterial:()=>this.ensureMaterial()}}}function U(e){const t=n(),r=a(e);return t[0]=Math.sin(r),t[1]=Math.cos(r),t}function M(e,r,i,n){const a=t(n);p(z);for(let t=0;t<i;t++)o(V,r[3*t],r[3*t+1]),d(z,V);s(z,z,a);const l=z[0]%B.unitSizeOfTexture,c=z[1]%B.unitSizeOfTexture;W[0]=z[0]-l,W[1]=z[1]-c;for(let t=0;t<i;t++)e[2*t]=(r[3*t]*a-W[0])/B.unitSizeOfTexture,e[2*t+1]=(r[3*t+1]*a-W[1])/B.unitSizeOfTexture}const W=n(),z=g(),V=n(),k=u();class N extends G{constructor(e,t,r,o){super(e,r,o),this.uvCoords=t}}class H extends G{constructor(e,t,r,o){super(e,r,o),this.uvCoords=t}}export{B as Graphics3DWaterSymbolLayer,U as headingVectorFromAngle};
5
+ import e from"../../../../Color.js";import{getMetersPerUnitForSR as t}from"../../../../core/unitUtils.js";import{e as r}from"../../../../chunks/earcut.js";import{set as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as i,create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{b as s}from"../../../../chunks/vec42.js";import{toRadian as a}from"../../../../core/libs/gl-matrix-2/math/common.js";import{fromBuffer as l,intersectsClippingArea as c,empty as h,expandWithAABB as m,create as p}from"../../../../geometry/support/aaBoundingBox.js";import{empty as u,expandPointInPlace as d,create as g}from"../../../../geometry/support/aaBoundingRect.js";import{newDoubleArray as y,doubleSubArray as f}from"../../../../geometry/support/DoubleArray.js";import{perVertexElevationAligner as _}from"./ElevationAligners.js";import{SymbolUpdateType as x,elevationModeChangeUpdateType as v,needsElevationUpdates2D as b}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as w}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as C}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as D}from"./Graphics3DSymbolLayer.js";import{geometryAsPolygon as j,createWaterGeometry as S,PolygonCreationDataBase as G}from"./polygonUtils.js";import{geometryToRenderInfo as E,geometryToRenderInfoDraped as A}from"../../support/renderInfoUtils/polygon.js";import{Object3D as L}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as O}from"../../webgl-engine/lib/RenderGeometry.js";import{Parameters as P,WaterMaterial as T}from"../../webgl-engine/materials/WaterMaterial.js";import{wavePresets as R}from"../../webgl-engine/materials/internal/waterMaterialUtils.js";const U=["polyline","polygon","extent"];class I extends D{static{this.unitSizeOfTexture=100}static{this.elevationModeChangeTypes={definedChanged:x.RECREATE,staysOnTheGround:x.NONE,onTheGroundChanged:x.RECREATE}}constructor(e,t,r,o){super(e,t,r,o)}async doLoad(){}destroy(){super.destroy(),this._context.stage.remove(this._materials[0]),this._materials.length=0}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,U,this.symbolLayer.type))return null;const r=this.setGraphicElevationContext(t);return this.ensureDrapedStatus("on-the-ground"===r.mode),this.ensureMaterial(),this.draped?this._createAsOverlay(t):this._createAs3DShape(t,r,t.uid)}ensureMaterial(){if(this._materials[0])return;const t=new P,r=this.symbolLayer.color;null!=r&&(t.color=e.toUnitRGBA(r));const o=this._getCombinedOpacity(r,{hasIntrinsicColor:!0});t.color=[t.color[0],t.color[1],t.color[2],o],t.transparent=o<1||this.needsDrivenTransparentPass,t.waveDirection=null!=this.symbolLayer.waveDirection?B(this.symbolLayer.waveDirection):i(0,0);const n=this.symbolLayer.waveStrength+"-"+this.symbolLayer.waterbodySize,s=R[n];t.waveStrength=s.waveStrength,t.waveTextureRepeat=s.textureRepeat,t.waveVelocity=s.waveVelocity,t.flowStrength=s.perturbationStrength,t.hasSlicePlane=this._context.slicePlaneEnabled,t.draped=this.draped,this._materials[0]=new T(t,this._context),this._context.stage.add(this._materials[0])}layerOpacityChanged(){if(null==this._materials[0])return;const e=this._materials[0].parameters.color,t=this._getCombinedOpacity(this.symbolLayer.color,{hasIntrinsicColor:!0}),r=t<1||this.needsDrivenTransparentPass;this._materials[0].setParameters({color:[e[0],e[1],e[2],t],transparent:r})}layerElevationInfoChanged(e,t,r){const o=this._elevationContext.mode,i=v(I.elevationModeChangeTypes,r,o);if(i!==x.UPDATE)return i;const n=b(o);return this.updateGraphics3DGraphicElevationInfo(e,t,(()=>n))}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return!0}_createAs3DShape(e,t,r){const o=j(e.geometry);if(null==o)return null;const i=E(o,this._context.elevationProvider,this._context.renderCoordsHelper,t),n=i.position.length/3,s=y(2*n);M(s,i.mapPositions,n,this._context.elevationProvider.spatialReference);const a=new N(i,s,this._context.layerViewUid,e.uid);if(a.objectAndLayerIdColor=this._context.stage.renderView?.getObjectAndLayerIdColor(a),this._create3DShapeGeometries(a),this._logGeometryCreationWarnings(a.renderData,o.rings,"rings","WaterSymbol3DLayer"),0===a.outGeometries.length)return null;const l=new L({geometries:a.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:r}),c=new C(this,l,a.outGeometries,null,null,_,t);return c.alignedSampledElevation=a.renderData.sampledElevation,c.needsElevationUpdates=b(t.mode),c}_create3DShapeGeometries(e){const t=e.renderData.polygons,o=e.uvCoords;for(const{count:i,index:n,position:s,mapPositions:a,holeIndices:h}of t){if(null!=this._context.clippingExtent&&(l(a,k),!c(k,this._context.clippingExtent)))continue;const t=r(a,h,3);if(0===t.length)continue;const m=f(o,2*n,2*i),p=S({material:this._materials[0],indices:t,mapPositions:a,attributeData:{position:s,uv0:m}},e.objectAndLayerIdColor);e.outGeometries.push(p)}}_createAsOverlay(e){const t=j(e.geometry);if(null==t)return null;this._materials[0].renderPriority=this._renderPriority;const r=A(t,this._context.overlaySR),o=r.position.length/3,i=y(2*o);M(i,r.position,o,this._context.overlaySR);const n=new H(r,i,this._context.layerViewUid,e.uid);return n.objectAndLayerIdColor=this._context.stage.renderView?.getObjectAndLayerIdColor(n),n.outBoundingBox=h(),this._createAsOverlayWater(n),this._logGeometryCreationWarnings(n.renderData,t.rings,"rings","WaterSymbol3DLayer"),0===n.outGeometries.length?null:new w(this,n.outGeometries,n.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayWater(e){const t=e.uvCoords,o=e.renderData.polygons;for(const{position:i,holeIndices:n,index:s,count:a}of o){if(l(i,k),!c(k,this._context.clippingExtent))continue;m(e.outBoundingBox,k);const o=r(i,n,3);if(0===o.length)continue;const h=f(t,2*s,2*a),p=S({material:this._materials[0],indices:o,attributeData:{position:i,uv0:h}},e.objectAndLayerIdColor);e.outGeometries.push(new O(p,e))}}test(){return{...super.test(),create3DShape:e=>this._createAs3DShape(e.graphic,e.elevationContext,e.graphicUid),ensureMaterial:()=>this.ensureMaterial()}}}function B(e){const t=n(),r=a(e);return t[0]=Math.sin(r),t[1]=Math.cos(r),t}function M(e,r,i,n){const a=t(n);u(W);for(let t=0;t<i;t++)o(z,r[3*t],r[3*t+1]),d(W,z);s(W,W,a);const l=W[0]%I.unitSizeOfTexture,c=W[1]%I.unitSizeOfTexture;V[0]=W[0]-l,V[1]=W[1]-c;for(let t=0;t<i;t++)e[2*t]=(r[3*t]*a-V[0])/I.unitSizeOfTexture,e[2*t+1]=(r[3*t+1]*a-V[1])/I.unitSizeOfTexture}const V=n(),W=g(),z=n(),k=p();class N extends G{constructor(e,t,r,o){super(e,r,o),this.uvCoords=t}}class H extends G{constructor(e,t,r,o){super(e,r,o),this.uvCoords=t}}export{I as Graphics3DWaterSymbolLayer,B as headingVectorFromAngle};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as i}from"../../../../chunks/tslib.es6.js";import t from"../../../../Graphic.js";import e from"../../../../core/Accessor.js";import{makeHandle as r}from"../../../../core/handleUtils.js";import{destroyMaybe as s}from"../../../../core/maybe.js";import{isAbortError as n}from"../../../../core/promiseUtils.js";import{watch as o,sync as a,syncAndInitial as l}from"../../../../core/reactiveUtils.js";import{property as p}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import{diff as h}from"../../../../core/accessorSupport/diffUtils.js";import{UpdatingHandles as u}from"../../../../core/support/UpdatingHandles.js";import d from"../../../../layers/Layer.js";import{hydrateGraphic as y}from"../../../../layers/graphics/hydratedFeatures.js";import{getRenderingInfo as g,getRenderingInfoAsync as m}from"../../../../renderers/support/renderingInfoUtils.js";import f from"../../../../rest/support/Query.js";import{DrapeSourceType as b}from"../interfaces.js";import{suspendResumeExtentOptimism as C}from"./constants.js";import{Graphics3DCore as w}from"./Graphics3DCore.js";import{Graphics3DElevationAlignment as j}from"./Graphics3DElevationAlignment.js";import{Graphics3DFrustumVisibility as V}from"./Graphics3DFrustumVisibility.js";import{Graphics3DObjectStates as v}from"./Graphics3DObjectStates.js";import{Graphics3DScaleVisibility as G}from"./Graphics3DScaleVisibility.js";import{enlargeExtent as E}from"./graphicUtils.js";import{normalizeHighlightTargetExceptQuery as S}from"../support/highlightUtils.js";import{UpdatePolicy as _}from"../../webgl-engine/lib/UpdatePolicy.js";let x=class extends e{constructor(i){super(i),this.type="graphics-3d",this.graphicsCore=null,this.drapeSourceType=b.Features,this.scaleVisibilityEnabled=!1,this.frustumVisibilityEnabled=!1,this._suspendResumeExtent=null,this._updatingHandles=new u}initialize(){const{layer:i}=this,t="effectiveScaleRange"in i?i:null,e=this.scaleVisibilityEnabled&&null!=t,r=new w({owner:this,layer:this.owner.layer,preferredUpdatePolicy:_.SYNC,graphicSymbolSupported:!0,componentFactories:{elevationAlignment:(i,t)=>new j({graphicsCoreOwner:this,graphicsCore:i,queryGraphicUIDsInExtent:t,elevationProvider:this.view.elevationProvider}),scaleVisibility:e?(i,e)=>new G({graphicsCoreOwner:this,layer:t,queryGraphicUIDsInExtent:e,graphicsCore:i,basemapTerrain:this.owner.view.basemapTerrain}):null,objectStates:i=>new v(i)}});if(this._set("graphicsCore",r),this.frustumVisibilityEnabled&&this._set("frustumVisibility",new V({graphicsCoreOwner:this})),"fullOpacity"in this.owner){const i=this.owner;this._updatingHandles.add((()=>i.fullOpacity),(()=>this.graphicsCore.opacityChange()))}if("elevationInfo"in i){const t=i;this._updatingHandles.add((()=>t.elevationInfo),((i,t)=>{h(i,t)&&this._updatingHandles.addPromise(this.graphicsCore.elevationInfoChange())}))}this._set("initializePromise",this._initializeAsync()),this._updatingHandles.addPromise(this.initializePromise)}async _initializeAsync(){try{await this.graphicsCore.initializePromise}catch(i){if(n(i))return;throw i}this.destroyed||(this.addHandles(o((()=>this.view.clippingArea),(()=>this._updateClippingExtent()),a)),this._updateClippingExtent(),this._setupSuspendResumeExtent(),this.graphicsCore.startCreateGraphics())}destroy(){this._updatingHandles.destroy(),this._set("frustumVisibility",s(this.frustumVisibility)),this._set("graphicsCore",s(this.graphicsCore))}get layer(){return this.owner.layer}get view(){return this.owner.view}get scaleVisibility(){return this.graphicsCore?.scaleVisibility}get elevationAlignment(){return this.graphicsCore?.elevationAlignment}get scaleVisibilitySuspended(){return!(null==this.scaleVisibility||!this.scaleVisibility.suspended)}get frustumVisibilitySuspended(){return null!=this.frustumVisibility&&this.frustumVisibility.suspended}get suspended(){return this.owner.suspended??!1}get updating(){return!!(this.graphicsCore?.updating||null!=this.scaleVisibility&&this.scaleVisibility.updating||null!=this.frustumVisibility&&this.frustumVisibility.updating||this._updatingHandles.updating)}get graphics3DGraphics(){return this.graphicsCore?.graphics3DGraphics}get graphics3DGraphicsByObjectID(){return this.graphicsCore?.graphics3DGraphicsByObjectID}get loadedGraphics(){return this.owner.loadedGraphics}get fullOpacity(){return this.owner.fullOpacity??1}get slicePlaneEnabled(){return this.owner.slicePlaneEnabled}get updatePolicy(){return this.owner.updatePolicy}notifyGraphicGeometryChanged(i){this.graphicsCore.notifyGraphicGeometryChanged(i)}notifyGraphicVisibilityChanged(i){this.graphicsCore.notifyGraphicVisibilityChanged(i)}getRenderingInfo(i,t,e){const r=g(i,{renderer:t,arcade:e});if(r?.color){const i=r.color;i[0]=i[0]/255,i[1]=i[1]/255,i[2]=i[2]/255}return r}getRenderingInfoAsync(i,t,e,r){return m(i,{renderer:t,arcade:e,...r})}getHit(i){if(this.owner.loadedGraphics){const t=this.owner.loadedGraphics.find((t=>t.uid===i));if(t){const i=this.layer instanceof d?this.layer:null,e=y(t,i);return{type:"graphic",graphic:e,layer:e.layer}}}return null}async getHitAsync(i){return this.getHit(i)}whenGraphicBounds(i,t){return this.graphicsCore?this.graphicsCore.whenGraphicBounds(i,t):Promise.reject()}computeAttachmentOrigin(i,t){return this.graphicsCore?this.graphicsCore.computeAttachmentOrigin(i,t):null}getSymbolLayerSize(i,t){return this.graphicsCore?this.graphicsCore.getSymbolLayerSize(i,t):null}maskOccludee(i){const t=this.graphicsCore?.objectStates;if(!t)return r();const{set:e,handle:s}=t.acquireOccludeeSet(null);return t.setUid(e,i.uid),s}highlight(i,e){const r=this.graphicsCore?.objectStates;if(!r)return O;if(i instanceof f)return O;const s=S(i);if(0===s.length)return O;if(s[0]instanceof t){const i=s.map((i=>i.uid)),{set:t,handle:n}=r.acquireHighlightSet(e,null);return r.setUids(t,i),n}if("number"==typeof s[0]){const i=s,{set:t,handle:n}=r.acquireHighlightSet(e,null);return r.setObjectIds(t,i),n}return O}_setupSuspendResumeExtent(){const{scaleVisibility:i,frustumVisibility:t}=this;if(null==i&&null==t)return;const e=({computedExtent:e,extentPadding:r})=>{this._suspendResumeExtent=E(e,this._suspendResumeExtent,C,r),null!=i&&i.setExtent(this._suspendResumeExtent),null!=t&&t.setExtent(this._suspendResumeExtent)};this.addHandles(o((()=>({computedExtent:this.graphicsCore?.computedExtent,extentPadding:this.graphicsCore?.extentPadding})),(i=>e(i)),l))}_updateClippingExtent(){const i=this.view.clippingArea;this.graphicsCore.setClippingExtent(i,this.view.spatialReference)&&this.graphicsCore.recreateAllGraphics()}};i([p()],x.prototype,"type",void 0),i([p({constructOnly:!0})],x.prototype,"owner",void 0),i([p()],x.prototype,"layer",null),i([p()],x.prototype,"view",null),i([p({constructOnly:!0})],x.prototype,"graphicsCore",void 0),i([p()],x.prototype,"scaleVisibility",null),i([p({constructOnly:!0})],x.prototype,"frustumVisibility",void 0),i([p()],x.prototype,"elevationAlignment",null),i([p()],x.prototype,"scaleVisibilitySuspended",null),i([p({readOnly:!0})],x.prototype,"frustumVisibilitySuspended",null),i([p()],x.prototype,"suspended",null),i([p({readOnly:!0})],x.prototype,"updating",null),i([p()],x.prototype,"loadedGraphics",null),i([p()],x.prototype,"fullOpacity",null),i([p()],x.prototype,"slicePlaneEnabled",null),i([p()],x.prototype,"drapeSourceType",void 0),i([p()],x.prototype,"updatePolicy",null),i([p({constructOnly:!0})],x.prototype,"scaleVisibilityEnabled",void 0),i([p({constructOnly:!0})],x.prototype,"frustumVisibilityEnabled",void 0),i([p()],x.prototype,"initializePromise",void 0),x=i([c("esri.views.3d.layers.graphics.GraphicsProcessor")],x);const O=r();export{x as GraphicsProcessor};
5
+ import{_ as i}from"../../../../chunks/tslib.es6.js";import t from"../../../../Graphic.js";import e from"../../../../core/Accessor.js";import{makeHandle as r}from"../../../../core/handleUtils.js";import{destroyMaybe as s}from"../../../../core/maybe.js";import{isAbortError as n}from"../../../../core/promiseUtils.js";import{watch as o,sync as a,syncAndInitial as l}from"../../../../core/reactiveUtils.js";import{property as p}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import{diff as h}from"../../../../core/accessorSupport/diffUtils.js";import{UpdatingHandles as u}from"../../../../core/support/UpdatingHandles.js";import d from"../../../../layers/Layer.js";import{hydrateGraphic as y}from"../../../../layers/graphics/hydratedFeatures.js";import{getRenderingInfo as g,getRenderingInfoAsync as m}from"../../../../renderers/support/renderingInfoUtils.js";import f from"../../../../rest/support/Query.js";import{DrapeSourceType as b}from"../interfaces.js";import{suspendResumeExtentOptimism as C}from"./constants.js";import{Graphics3DCore as w}from"./Graphics3DCore.js";import{Graphics3DElevationAlignment as j}from"./Graphics3DElevationAlignment.js";import{Graphics3DFrustumVisibility as V}from"./Graphics3DFrustumVisibility.js";import{Graphics3DObjectStates as v}from"./Graphics3DObjectStates.js";import{Graphics3DScaleVisibility as G}from"./Graphics3DScaleVisibility.js";import{enlargeExtent as E}from"./graphicUtils.js";import{normalizeHighlightTargetExceptQuery as S}from"../support/highlightUtils.js";import{UpdatePolicy as _}from"../../webgl-engine/lib/UpdatePolicy.js";let x=class extends e{constructor(i){super(i),this.type="graphics-3d",this.graphicsCore=null,this.drapeSourceType=b.Features,this.scaleVisibilityEnabled=!1,this.frustumVisibilityEnabled=!1,this._suspendResumeExtent=null,this._updatingHandles=new u}initialize(){const{layer:i}=this,t="effectiveScaleRange"in i?i:null,e=this.scaleVisibilityEnabled&&null!=t,r=new w({owner:this,layer:this.owner.layer,preferredUpdatePolicy:_.SYNC,graphicSymbolSupported:!0,componentFactories:{elevationAlignment:(i,t)=>new j({graphicsCoreOwner:this,graphicsCore:i,queryGraphicUIDsInExtent:t,elevationProvider:this.view.elevationProvider}),scaleVisibility:e?(i,e)=>new G({graphicsCoreOwner:this,layer:t,queryGraphicUIDsInExtent:e,graphicsCore:i,basemapTerrain:this.owner.view.basemapTerrain}):null,objectStates:i=>new v(i)}});if(this._set("graphicsCore",r),this.frustumVisibilityEnabled&&this._set("frustumVisibility",new V({graphicsCoreOwner:this})),"fullOpacity"in this.owner){const i=this.owner;this._updatingHandles.add((()=>i.fullOpacity),(()=>this.graphicsCore.opacityChange()))}if("elevationInfo"in i){const t=i;this._updatingHandles.add((()=>t.elevationInfo),((i,t)=>{h(i,t)&&this._updatingHandles.addPromise(this.graphicsCore.elevationInfoChange())}))}this._set("initializePromise",this._initializeAsync()),this._updatingHandles.addPromise(this.initializePromise)}async _initializeAsync(){try{await this.graphicsCore.initializePromise}catch(i){if(n(i))return;throw i}this.destroyed||(this.addHandles(o((()=>this.view.clippingArea),(()=>this._updateClippingExtent()),a)),this._updateClippingExtent(),this._setupSuspendResumeExtent(),this.graphicsCore.startCreateGraphics())}destroy(){this._updatingHandles.destroy(),this._set("frustumVisibility",s(this.frustumVisibility)),this._set("graphicsCore",s(this.graphicsCore))}get layer(){return this.owner.layer}get layerViewUid(){return this.owner.uid}get view(){return this.owner.view}get scaleVisibility(){return this.graphicsCore?.scaleVisibility}get elevationAlignment(){return this.graphicsCore?.elevationAlignment}get scaleVisibilitySuspended(){return!(null==this.scaleVisibility||!this.scaleVisibility.suspended)}get frustumVisibilitySuspended(){return null!=this.frustumVisibility&&this.frustumVisibility.suspended}get suspended(){return this.owner.suspended??!1}get updating(){return!!(this.graphicsCore?.updating||null!=this.scaleVisibility&&this.scaleVisibility.updating||null!=this.frustumVisibility&&this.frustumVisibility.updating||this._updatingHandles.updating)}get graphics3DGraphics(){return this.graphicsCore?.graphics3DGraphics}get graphics3DGraphicsByObjectID(){return this.graphicsCore?.graphics3DGraphicsByObjectID}get loadedGraphics(){return this.owner.loadedGraphics}get fullOpacity(){return this.owner.fullOpacity??1}get slicePlaneEnabled(){return this.owner.slicePlaneEnabled}get updatePolicy(){return this.owner.updatePolicy}notifyGraphicGeometryChanged(i){this.graphicsCore.notifyGraphicGeometryChanged(i)}notifyGraphicVisibilityChanged(i){this.graphicsCore.notifyGraphicVisibilityChanged(i)}getRenderingInfo(i,t,e){const r=g(i,{renderer:t,arcade:e});if(r?.color){const i=r.color;i[0]=i[0]/255,i[1]=i[1]/255,i[2]=i[2]/255}return r}getRenderingInfoAsync(i,t,e,r){return m(i,{renderer:t,arcade:e,...r})}getHit(i){if(this.owner.loadedGraphics){const t=this.owner.loadedGraphics.find((t=>t.uid===i));if(t){const i=this.layer instanceof d?this.layer:null,e=y(t,i);return{type:"graphic",graphic:e,layer:e.layer}}}return null}async getHitAsync(i){return this.getHit(i)}whenGraphicBounds(i,t){return this.graphicsCore?this.graphicsCore.whenGraphicBounds(i,t):Promise.reject()}computeAttachmentOrigin(i,t){return this.graphicsCore?this.graphicsCore.computeAttachmentOrigin(i,t):null}getSymbolLayerSize(i,t){return this.graphicsCore?this.graphicsCore.getSymbolLayerSize(i,t):null}maskOccludee(i){const t=this.graphicsCore?.objectStates;if(!t)return r();const{set:e,handle:s}=t.acquireOccludeeSet(null);return t.setUid(e,i.uid),s}highlight(i,e){const r=this.graphicsCore?.objectStates;if(!r)return O;if(i instanceof f)return O;const s=S(i);if(0===s.length)return O;if(s[0]instanceof t){const i=s.map((i=>i.uid)),{set:t,handle:n}=r.acquireHighlightSet(e,null);return r.setUids(t,i),n}if("number"==typeof s[0]){const i=s,{set:t,handle:n}=r.acquireHighlightSet(e,null);return r.setObjectIds(t,i),n}return O}_setupSuspendResumeExtent(){const{scaleVisibility:i,frustumVisibility:t}=this;if(null==i&&null==t)return;const e=({computedExtent:e,extentPadding:r})=>{this._suspendResumeExtent=E(e,this._suspendResumeExtent,C,r),null!=i&&i.setExtent(this._suspendResumeExtent),null!=t&&t.setExtent(this._suspendResumeExtent)};this.addHandles(o((()=>({computedExtent:this.graphicsCore?.computedExtent,extentPadding:this.graphicsCore?.extentPadding})),(i=>e(i)),l))}_updateClippingExtent(){const i=this.view.clippingArea;this.graphicsCore.setClippingExtent(i,this.view.spatialReference)&&this.graphicsCore.recreateAllGraphics()}};i([p()],x.prototype,"type",void 0),i([p({constructOnly:!0})],x.prototype,"owner",void 0),i([p()],x.prototype,"layer",null),i([p()],x.prototype,"layerViewUid",null),i([p()],x.prototype,"view",null),i([p({constructOnly:!0})],x.prototype,"graphicsCore",void 0),i([p()],x.prototype,"scaleVisibility",null),i([p({constructOnly:!0})],x.prototype,"frustumVisibility",void 0),i([p()],x.prototype,"elevationAlignment",null),i([p()],x.prototype,"scaleVisibilitySuspended",null),i([p({readOnly:!0})],x.prototype,"frustumVisibilitySuspended",null),i([p()],x.prototype,"suspended",null),i([p({readOnly:!0})],x.prototype,"updating",null),i([p()],x.prototype,"loadedGraphics",null),i([p()],x.prototype,"fullOpacity",null),i([p()],x.prototype,"slicePlaneEnabled",null),i([p()],x.prototype,"drapeSourceType",void 0),i([p()],x.prototype,"updatePolicy",null),i([p({constructOnly:!0})],x.prototype,"scaleVisibilityEnabled",void 0),i([p({constructOnly:!0})],x.prototype,"frustumVisibilityEnabled",void 0),i([p()],x.prototype,"initializePromise",void 0),x=i([c("esri.views.3d.layers.graphics.GraphicsProcessor")],x);const O=r();export{x as GraphicsProcessor};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{forEach as s,result as i}from"../../../../core/asyncUtils.js";import"../../../../core/has.js";import l from"../../../../core/Logger.js";import{disposeMaybe as a,abortMaybe as r}from"../../../../core/maybe.js";import{throwIfAborted as o,isAbortError as n}from"../../../../core/promiseUtils.js";import{watch as c}from"../../../../core/reactiveUtils.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/RandomLCG.js";import{subclass as b}from"../../../../core/accessorSupport/decorators/subclass.js";import{fromValues as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{hydrateGraphic as u}from"../../../../layers/graphics/hydratedFeatures.js";import{createLabelFunction as d}from"../../../../layers/support/labelFormatUtils.js";import{hasCalloutSupport as y}from"../../../../symbols/callouts/calloutUtils.js";import{VisibilityGroup as g,VisibilityFlag as m}from"./enums.js";import{make as f}from"./Graphics3DCalloutSymbolLayerFactory.js";import{LineCalloutSymbolLayerRenderingInfo as C,LineCalloutCreationContext as x}from"./Graphics3DLineCalloutSymbolLayer.js";import{getGraphics3DSymbol as _}from"./graphicSymbolUtils.js";import{LabelInfo as L}from"./LabelInfo.js";import{LabelParameters as v}from"./LabelParameters.js";import{horizontalPlacementFromAnchor as G,verticalPlacementFromAnchor as D,textRenderAlignmentFromHorizontalPlacement as w}from"./placementUtils.js";import{MaterialCollection as A}from"../../webgl-engine/lib/MaterialCollection.js";import{TextRenderer as I}from"../../webgl-engine/lib/TextRenderer.js";import{TextRenderParameters as T}from"../../webgl-engine/lib/TextRenderParameters.js";import{TextTextureAtlas as S}from"../../webgl-engine/lib/TextTextureAtlas.js";import{VertexAttribute as R}from"../../webgl-engine/lib/VertexAttribute.js";import{WebGLLayer as P}from"../../webgl-engine/lib/WebGLLayer.js";import{TaskPriority as j}from"../../../support/Scheduler.js";import{Yield as E}from"../../../support/Yield.js";class O{constructor(e,t){this.labelingContext=e,this.graphics3DGraphic=t,this.hasGraphics3DResources=!1,this.visible=!1,this.textureAtlasHandles=[],this.textInitialized=!1,this.textRenderers=new Array,this.textLabelPlacements=new Array}}class V{constructor(e,t,s,i,l){this.labelClass=e,this.graphics3DSymbol=t,this.graphics3DCalloutSymbolLayer=s,this.textRenderParameters=i,this.labelFunction=l,this.calloutSymbolLayerIndex=0}}class z{constructor(e,t,s,i,l,a,r,o){this.layer=t,this.graphics3DCore=s,this.scaleVisibility=i,this.emptySymbolLabelSupported=l,this.elevationInfoOverride=a,this.disablePlacement=r,this.active=o,this.labelClassAbortController=new AbortController,this.labelClassContexts=new Array,this.graphics=new Map,this.labelsToInitialize=new Map,this.stageLayer=new P(e,{pickable:!0,disableOctree:!0},t.uid)}destroy(){this.stageLayer.destroy()}}let F=class extends t{constructor(e){super(e),this._dirty=!1,this._labels=new Map,this._labelingContexts=new Array}setup(){this.dispose(),this.addHandles([c((()=>this.view.state?.camera),(()=>this.setDirty())),c((()=>this.view.state?.rasterPixelRatio),(()=>this._resetAllLabels())),this.view.resourceController.scheduler.registerTask(j.LABELER,this)]),this._textTextureAtlas=new S({view:this.view}),this._hudMaterialCollection=new A(this.view.stage),this._calloutMaterialCollection=new A(this.view.stage)}dispose(){this.removeAllHandles(),this._textTextureAtlas=a(this._textTextureAtlas),this._hudMaterialCollection=a(this._hudMaterialCollection),this._calloutMaterialCollection=a(this._calloutMaterialCollection),this._labelingContexts.length=0,this._labels.clear()}destroy(){this.dispose(),W.graphic=null,W.renderingInfo=null,W.layer=null}_activateLabelingContext(e){e.graphics.forEach(((t,s)=>{const i=new O(e,t);this._labels.set(s,i),e.labelsToInitialize.set(s,i),t.setVisibilityFlag(g.LABEL,m.USER,!0)})),e.active=!0}_deactivateLabelingContext(e){e.graphics.forEach(((e,t)=>{e.setVisibilityFlag(g.LABEL,m.USER,!1),this.setLabelGraphicVisibility(e,!1),e.clearLabelGraphics(),this._labels.delete(t)})),e.active=!1}_addLabelTextureToAtlas(e){for(const t of e.graphics3DGraphic.labelLayers){if(!t._labelClass)continue;const s=e.textRenderers[t._labelIndex];s&&(e.textureAtlasHandles.push(this._textTextureAtlas.addText(s,(e=>M(t.stageObject,e)))),U(t.stageObject,s))}}_removeLabelTextureFromAtlas(e){e.textureAtlasHandles.forEach((e=>e.remove())),e.textureAtlasHandles.length=0}get running(){return this.view.ready&&(this._dirty||this.deconflictor.running)}runTask(e){return this._updateLabels(e),!this._dirty&&this.deconflictor.running&&this.deconflictor.runTask(e),E}_updateLabels(e){if(this._dirty){this._dirty=!1;for(const t of this._labelingContexts)if(t.active)if(H(t))this._dirty=!0;else if(k(t.labelClassContexts)){if(null===t.labelClassContexts){this._deactivateLabelingContext(t);continue}this._createLabelClassContext(t),this._dirty=!0}else for(const[s,i]of t.labelsToInitialize)if(this._ensureGraphics3DResources(i)&&(this._labels.set(s,i),this.deconflictor.setDirty(),e.madeProgress()),(i.visible&&i.textInitialized||!i.visible&&i.hasGraphics3DResources)&&(t.labelsToInitialize.delete(s),e.madeProgress()),e.done){this._dirty=!0;break}this._dirty||this.notifyChange("updating")}}async _createLabelClassContextAsync(e){const t=e.labelClassAbortController?.signal;e.layer.when&&await e.layer.when(),o(t),e.scaleVisibility?.updateScaleRangeActive();const a=e.graphics3DCore,r=a.layer,n=r.labelingInfo?.filter((e=>!!e.symbol));if(!n||0===n.length)return;let c=!1;await s(n,(async(s,r)=>{const n=s.symbol,h=_(a.getOrCreateGraphics3DSymbol(n));if(null==h)return void l.getLogger(this).error("Failed to create Graphics3DSymbol for label");await h.load(),o(t);let b=null;y(n)&&n.hasVisibleCallout()&&(b=f(n,a.symbolCreationContext),await b.load(),o(t));const p=await i(d(s,e.layer.fieldsIndex,this.view.spatialReference));if(o(t),!0===p.ok){const i=await this._createTextRenderParameters(h.symbol);o(t),e.labelClassContexts[r]=new V(s,h,b,i,p.value)}else l.getLogger(this).error(`Label expression failed to evaluate: ${p.error}`),c=!0})),o(t)}async _createLabelClassContext(e){return null==e.labelClassPromise&&(e.labelClassPromise=this._createLabelClassContextAsync(e).catch((t=>{if(n(t))throw t;e.labelClassContexts.length=0})).then((()=>{e.labelClassAbortController=null,this.notifyChange("updating")})).catch((()=>{})),this.notifyChange("updating")),e.labelClassPromise}async _createTextRenderParameters(e){const t=e.symbolLayers.at(0);return"text"!==t?.type?null:T.fromSymbol(t,this.view.state.rasterPixelRatio)}_destroyLabelClassContext(e){for(const s of e.labelClassContexts)--s.graphics3DSymbol.referenced;const t=e.labelClassAbortController;e.labelClassAbortController=new AbortController,r(t),e.labelClassContexts.length=0,e.labelClassPromise=null,this.notifyChange("updating")}_createTextSymbolGraphic(e,t,s,i,l,a){const r=new v(s,G(s.anchor),D(s.anchor),e.text,p(e.displayWidth,e.displayHeight));return W.graphic=t,W.layer=i,W.renderingInfo=null,l.createLabel(W,r,this._hudMaterialCollection,this._textTextureAtlas,(()=>a.placement?.elevationOffset??null))}_createLineCalloutGraphic(e,t,s,i,l){W.graphic=e,W.layer=l;const a=i.screenOffset[0];return W.renderingInfo=new C(null,t,i.translation,i.centerOffset,a,i.centerOffsetUnits,i.elevationOffset,this._calloutMaterialCollection),s.createGraphics3DGraphic(W)}_ensureGraphics3DResources(e){if(e.hasGraphics3DResources)return!1;const t=e.graphics3DGraphic;if(t.destroyed)return!1;this._ensureTextTextureResources(e);const s=e.labelingContext,i=s.labelClassContexts;if(k(i)||!s.emptySymbolLabelSupported&&0===t.layers.length)return!1;let l=!1;const a=t.graphic,r=s.layer,o=N(s.layer);for(let n=0;n<i.length;n++){const c=e.textRenderers[n],h=e.textLabelPlacements[n];if(null==c||null==h)continue;const b=i[n],p=b.graphics3DSymbol,u=B(p),d=p.symbolLayers[0];if(!d)continue;d.setElevationInfoOverride(s.elevationInfoOverride);const y=new L(t,u,b.labelClass),f=this._createTextSymbolGraphic(c,a,h,r,d,y);if(null==f)return!1;f._labelClass=b.labelClass,f._labelIndex=n,t.addLabelGraphic(f,s.stageLayer),t.deconflictionPriority=b.textRenderParameters?.definition.size??0,t.setVisibilityFlag(g.LABEL,m.USER,o),t.setVisibilityFlag(g.LABEL,m.SCALE_RANGE,!0),t.setVisibilityFlag(g.LABEL,m.DECONFLICTION,!1),l=!0;const C=b.graphics3DCalloutSymbolLayer;if(C&&h.hasLabelVerticalOffset){C.setElevationInfoOverride(s.elevationInfoOverride);const e=this._createLineCalloutGraphic(a,u,C,h,r);null!=e&&(b.calloutSymbolLayerIndex=t.labelLayers.length,t.addLabelGraphic(e,s.stageLayer))}break}return l&&s.scaleVisibility?.updateGraphicLabelScaleVisibility(t),e.hasGraphics3DResources=!0,!0}_destroyGraphics3DResources(e){const t=e.labelingContext.labelClassContexts;for(const s of e.graphics3DGraphic.labelLayers){if(null==s._labelClass)continue;const e=t[s._labelIndex].graphics3DSymbol.symbolLayers[0];e?.onRemoveGraphic(s)}e.graphics3DGraphic.deconflictionPriority=0,e.graphics3DGraphic.clearLabelGraphics(),e.hasGraphics3DResources=!1}_ensureTextTextureResources(e){if(e.textInitialized)return;const t=e.labelingContext,s=t.labelClassContexts;if(k(s))return;const i=e.graphics3DGraphic.graphic;for(let a=0;a<s.length;a++){const r=s[a];if(e.textRenderers[a]=null,e.textLabelPlacements[a]=null,null==r?.textRenderParameters)continue;const o=r.labelFunction;let n;if("arcade"===o.type)try{const e=o.needsHydrationToEvaluate()?u(i,t.layer):i;n=o.evaluate(e)}catch(l){n=null}else n=o.evaluate(i);if(null==n||""===n||/^\s+$/.test(n))continue;const c=r.graphics3DSymbol;if(!c.symbolLayers[0])continue;const h=e.graphics3DGraphic,b="label-3d"===c.symbol?.type?c.symbol:null,p=r.labelClass,d=t.disablePlacement,y=new L(h,b,p,d).placement;if(null==y)continue;const g=G(y.anchor),m=w(g);e.textRenderers[a]=new I(n,m,r.textRenderParameters,S.maxSize),e.textLabelPlacements[a]=y}e.textInitialized=!0}_destroyTextTextureResources(e){e.textInitialized=!1,e.textRenderers.length=0,e.textLabelPlacements.length=0}_addGraphic(e,t){const s=t.graphic.uid;if(e.graphics.set(s,t),e.active){const i=new O(e,t);this._labels.set(s,i),e.labelsToInitialize.set(s,i)}this.setDirty(),this.deconflictor.setDirty()}_updateGraphicGeometry(e,t){const s=t.graphic.uid,i=this._labels.get(s);if(!i)return!0;for(const l of i.graphics3DGraphic.labelLayers){if(null==l._labelClass)continue;if(!e.labelClassContexts[l._labelIndex].graphics3DSymbol.symbolLayers[0].updateGeometry(l,t.graphic.geometry))return!1}return this.setDirty(),this.deconflictor.setDirty(),!0}_removeGraphic(e,t){const s=t.graphic.uid,i=this._labels.get(s);e.graphics.delete(s),i&&(this._destroyGraphic(i,s),e.labelsToInitialize.delete(s),this.setDirty(),this.deconflictor.setDirty())}_destroyGraphic(e,t){this._labels.delete(t),e.textureAtlasHandles.length&&this._removeLabelTextureFromAtlas(e),this._destroyTextTextureResources(e),e.hasGraphics3DResources&&this._destroyGraphics3DResources(e)}async _labelingInfoChange(e,t){if(!t)return this._visibilityInfoChange(e),this._resetLabels(e),this._createLabelClassContext(e);for(const s of t){const t=e.graphics.get(s);t&&(this._removeGraphic(e,t),this._addGraphic(e,t))}}_globalPropertyChanged(e,t){for(const s of t.labelClassContexts){const i=new Map;t.graphics.forEach((e=>i.set(e.graphic.uid,e)));const l=e=>e.labelLayers[0];if(s.graphics3DSymbol.symbolLayers[0].globalPropertyChanged(e,i,l),s.graphics3DCalloutSymbolLayer){const t=e=>e.labelLayers[s.calloutSymbolLayerIndex];s.graphics3DCalloutSymbolLayer.globalPropertyChanged(e,i,t)}}}_visibilityInfoChange(e){const t=N(e.layer);t&&!e.active&&this._activateLabelingContext(e),!t&&e.active&&this._deactivateLabelingContext(e),this.setDirty()}_resetAllLabels(){for(const e of this._labelingContexts)this._resetLabels(e)}_resetLabels(e){e.graphics.forEach(((t,s)=>{const i=this._labels.get(s);i&&(this._destroyGraphic(i,s),i.visible=!1,e.labelsToInitialize.set(s,i))})),this._destroyLabelClassContext(e),this.setDirty(),this.deconflictor.setDirty()}_findLabelingContext(e){for(const t of this._labelingContexts)if(t.graphics3DCore===e)return t;return null}addGraphicsOwner(e,t,s){const i=s?.emptySymbolLabelSupported||!1,l=s?.elevationInfoOverride||null,a=s?.disablePlacement||null;if(this._findLabelingContext(e))return;const r=e.layer,o=new z(this.view.stage,r,e,t,i,l,a,N(r));return this._labelingContexts.push(o),this.setDirty(),{addGraphic:e=>this._addGraphic(o,e),removeGraphic:e=>this._removeGraphic(o,e),updateGraphicGeometry:e=>this._updateGraphicGeometry(o,e),layerLabelsEnabled:()=>N(o.layer),labelingInfoChange:e=>this._labelingInfoChange(o,e),elevationInfoChange:()=>this._globalPropertyChanged("elevationInfo",o),slicePlaneEnabledChange:()=>this._globalPropertyChanged("slicePlaneEnabled",o),visibilityInfoChange:()=>this._visibilityInfoChange(o),reset:()=>this._resetLabels(o),remove:()=>this._removeGraphicsOwner(e),setDirty:()=>this.setDirty()}}_removeGraphicsOwner(e){const t=this._findLabelingContext(e);if(!t)return;const s=this._labelingContexts.indexOf(t);this._labelingContexts.splice(s,1),t.graphics.forEach((e=>this._removeGraphic(t,e))),t.destroy(),this.setDirty()}setLabelGraphicVisibility(e,t){const s=e.graphic.uid,i=this._labels.get(s);i&&i.visible!==t&&(t&&!i.textureAtlasHandles.length?(this._addLabelTextureToAtlas(i),i.textInitialized||i.labelingContext.labelsToInitialize.set(s,i)):!t&&i.textureAtlasHandles.length&&this._removeLabelTextureFromAtlas(i),i.visible=t,this.setDirty())}setDirty(){!this._dirty&&this._labelingContexts.length>0&&(this._dirty=!0,this.notifyChange("updating"))}get updating(){return this._dirty||this._textTextureAtlas?.updating||this.deconflictor.updating||this._labelingContexts.some((e=>H(e)))}get updatingProgress(){if(!this.updating||!this._textTextureAtlas)return 1;const e=this._labelingContexts.length>0?this._labelingContexts.reduce(((e,t)=>e+(H(t)?0:1)),0)/this._labelingContexts.length:1;return(this._dirty?0:.3)+(this._textTextureAtlas.updating?0:.1)+.1*e+.5*this.deconflictor.updatingProgress}get test(){}};function U(e,t){e.geometries[0].setAttributeData(R.SIZE,[t.displayWidth,t.displayHeight]),e.geometryVertexAttributeUpdated(e.geometries[0],R.SIZE)}function M(e,t){e.geometries[0].setAttributeData(R.UVI,t),e.geometryVertexAttributeUpdated(e.geometries[0],R.UVI,!0)}function H(e){return!!e.labelClassPromise&&!!e.labelClassAbortController}function k(e){return!e||0===e.length}function B(e){return"label-3d"===e.symbol?.type?e.symbol:null}function N(e){return!0===e.labelsVisible&&!!e.labelingInfo?.some((e=>!!e.symbol))}e([h({constructOnly:!0})],F.prototype,"view",void 0),e([h({constructOnly:!0})],F.prototype,"deconflictor",void 0),e([h()],F.prototype,"_textTextureAtlas",void 0),e([h({type:Boolean,readOnly:!0})],F.prototype,"updating",null),F=e([b("esri.views.3d.layers.graphics.Labeler")],F);const W=new x(null,null,null);export{F as Labeler,N as areLabelsVisible};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{forEach as s,result as i}from"../../../../core/asyncUtils.js";import"../../../../core/has.js";import l from"../../../../core/Logger.js";import{disposeMaybe as r,abortMaybe as a}from"../../../../core/maybe.js";import{throwIfAborted as o,isAbortError as n}from"../../../../core/promiseUtils.js";import{watch as c}from"../../../../core/reactiveUtils.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/RandomLCG.js";import{subclass as b}from"../../../../core/accessorSupport/decorators/subclass.js";import{fromValues as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{hydrateGraphic as u}from"../../../../layers/graphics/hydratedFeatures.js";import{createLabelFunction as d}from"../../../../layers/support/labelFormatUtils.js";import{hasCalloutSupport as y}from"../../../../symbols/callouts/calloutUtils.js";import{VisibilityGroup as g,VisibilityFlag as m}from"./enums.js";import{make as f}from"./Graphics3DCalloutSymbolLayerFactory.js";import{LineCalloutSymbolLayerRenderingInfo as C,LineCalloutCreationContext as x}from"./Graphics3DLineCalloutSymbolLayer.js";import{getGraphics3DSymbol as _}from"./graphicSymbolUtils.js";import{LabelInfo as L}from"./LabelInfo.js";import{LabelParameters as v}from"./LabelParameters.js";import{horizontalPlacementFromAnchor as G,verticalPlacementFromAnchor as D,textRenderAlignmentFromHorizontalPlacement as w}from"./placementUtils.js";import{MaterialCollection as A}from"../../webgl-engine/lib/MaterialCollection.js";import{TextRenderer as I}from"../../webgl-engine/lib/TextRenderer.js";import{TextRenderParameters as T}from"../../webgl-engine/lib/TextRenderParameters.js";import{TextTextureAtlas as S}from"../../webgl-engine/lib/TextTextureAtlas.js";import{VertexAttribute as R}from"../../webgl-engine/lib/VertexAttribute.js";import{WebGLLayer as P}from"../../webgl-engine/lib/WebGLLayer.js";import{TaskPriority as j}from"../../../support/Scheduler.js";import{Yield as E}from"../../../support/Yield.js";class O{constructor(e,t){this.labelingContext=e,this.graphics3DGraphic=t,this.hasGraphics3DResources=!1,this.visible=!1,this.textureAtlasHandles=[],this.textInitialized=!1,this.textRenderers=new Array,this.textLabelPlacements=new Array}}class V{constructor(e,t,s,i,l){this.labelClass=e,this.graphics3DSymbol=t,this.graphics3DCalloutSymbolLayer=s,this.textRenderParameters=i,this.labelFunction=l,this.calloutSymbolLayerIndex=0}}class z{constructor(e,t,s,i,l,r,a,o){this.layer=t,this.graphics3DCore=s,this.scaleVisibility=i,this.emptySymbolLabelSupported=l,this.elevationInfoOverride=r,this.disablePlacement=a,this.active=o,this.labelClassAbortController=new AbortController,this.labelClassContexts=new Array,this.graphics=new Map,this.labelsToInitialize=new Map,this.stageLayer=new P(e,{pickable:!0,disableOctree:!0},s.owner.layerViewUid)}destroy(){this.stageLayer.destroy()}}let U=class extends t{constructor(e){super(e),this._dirty=!1,this._labels=new Map,this._labelingContexts=new Array}setup(){this.dispose(),this.addHandles([c((()=>this.view.state?.camera),(()=>this.setDirty())),c((()=>this.view.state?.rasterPixelRatio),(()=>this._resetAllLabels())),this.view.resourceController.scheduler.registerTask(j.LABELER,this)]),this._textTextureAtlas=new S({view:this.view}),this._hudMaterialCollection=new A(this.view.stage),this._calloutMaterialCollection=new A(this.view.stage)}dispose(){this.removeAllHandles(),this._textTextureAtlas=r(this._textTextureAtlas),this._hudMaterialCollection=r(this._hudMaterialCollection),this._calloutMaterialCollection=r(this._calloutMaterialCollection),this._labelingContexts.length=0,this._labels.clear()}destroy(){this.dispose(),W.graphic=null,W.renderingInfo=null,W.layer=null}_activateLabelingContext(e){e.graphics.forEach(((t,s)=>{const i=new O(e,t);this._labels.set(s,i),e.labelsToInitialize.set(s,i),t.setVisibilityFlag(g.LABEL,m.USER,!0)})),e.active=!0}_deactivateLabelingContext(e){e.graphics.forEach(((e,t)=>{e.setVisibilityFlag(g.LABEL,m.USER,!1),this.setLabelGraphicVisibility(e,!1),e.clearLabelGraphics(),this._labels.delete(t)})),e.active=!1}_addLabelTextureToAtlas(e){for(const t of e.graphics3DGraphic.labelLayers){if(!t._labelClass)continue;const s=e.textRenderers[t._labelIndex];s&&(e.textureAtlasHandles.push(this._textTextureAtlas.addText(s,(e=>M(t.stageObject,e)))),F(t.stageObject,s))}}_removeLabelTextureFromAtlas(e){e.textureAtlasHandles.forEach((e=>e.remove())),e.textureAtlasHandles.length=0}get running(){return this.view.ready&&(this._dirty||this.deconflictor.running)}runTask(e){return this._updateLabels(e),!this._dirty&&this.deconflictor.running&&this.deconflictor.runTask(e),E}_updateLabels(e){if(this._dirty){this._dirty=!1;for(const t of this._labelingContexts)if(t.active)if(H(t))this._dirty=!0;else if(k(t.labelClassContexts)){if(null===t.labelClassContexts){this._deactivateLabelingContext(t);continue}this._createLabelClassContext(t),this._dirty=!0}else for(const[s,i]of t.labelsToInitialize)if(this._ensureGraphics3DResources(i)&&(this._labels.set(s,i),this.deconflictor.setDirty(),e.madeProgress()),(i.visible&&i.textInitialized||!i.visible&&i.hasGraphics3DResources)&&(t.labelsToInitialize.delete(s),e.madeProgress()),e.done){this._dirty=!0;break}this._dirty||this.notifyChange("updating")}}async _createLabelClassContextAsync(e){const t=e.labelClassAbortController?.signal;e.layer.when&&await e.layer.when(),o(t),e.scaleVisibility?.updateScaleRangeActive();const r=e.graphics3DCore,a=r.layer,n=a.labelingInfo?.filter((e=>!!e.symbol));if(!n||0===n.length)return;let c=!1;await s(n,(async(s,a)=>{const n=s.symbol,h=_(r.getOrCreateGraphics3DSymbol(n));if(null==h)return void l.getLogger(this).error("Failed to create Graphics3DSymbol for label");await h.load(),o(t);let b=null;y(n)&&n.hasVisibleCallout()&&(b=f(n,r.symbolCreationContext),await b.load(),o(t));const p=await i(d(s,e.layer.fieldsIndex,this.view.spatialReference));if(o(t),!0===p.ok){const i=await this._createTextRenderParameters(h.symbol);o(t),e.labelClassContexts[a]=new V(s,h,b,i,p.value)}else l.getLogger(this).error(`Label expression failed to evaluate: ${p.error}`),c=!0})),o(t)}async _createLabelClassContext(e){return null==e.labelClassPromise&&(e.labelClassPromise=this._createLabelClassContextAsync(e).catch((t=>{if(n(t))throw t;e.labelClassContexts.length=0})).then((()=>{e.labelClassAbortController=null,this.notifyChange("updating")})).catch((()=>{})),this.notifyChange("updating")),e.labelClassPromise}async _createTextRenderParameters(e){const t=e.symbolLayers.at(0);return"text"!==t?.type?null:T.fromSymbol(t,this.view.state.rasterPixelRatio)}_destroyLabelClassContext(e){for(const s of e.labelClassContexts)--s.graphics3DSymbol.referenced;const t=e.labelClassAbortController;e.labelClassAbortController=new AbortController,a(t),e.labelClassContexts.length=0,e.labelClassPromise=null,this.notifyChange("updating")}_createTextSymbolGraphic(e,t,s,i,l,r){const a=new v(s,G(s.anchor),D(s.anchor),e.text,p(e.displayWidth,e.displayHeight));return W.graphic=t,W.layer=i,W.renderingInfo=null,l.createLabel(W,a,this._hudMaterialCollection,this._textTextureAtlas,(()=>r.placement?.elevationOffset??null))}_createLineCalloutGraphic(e,t,s,i,l){W.graphic=e,W.layer=l;const r=i.screenOffset[0];return W.renderingInfo=new C(null,t,i.translation,i.centerOffset,r,i.centerOffsetUnits,i.elevationOffset,this._calloutMaterialCollection),s.createGraphics3DGraphic(W)}_ensureGraphics3DResources(e){if(e.hasGraphics3DResources)return!1;const t=e.graphics3DGraphic;if(t.destroyed)return!1;this._ensureTextTextureResources(e);const s=e.labelingContext,i=s.labelClassContexts;if(k(i)||!s.emptySymbolLabelSupported&&0===t.layers.length)return!1;let l=!1;const r=t.graphic,a=s.layer,o=N(s.layer);for(let n=0;n<i.length;n++){const c=e.textRenderers[n],h=e.textLabelPlacements[n];if(null==c||null==h)continue;const b=i[n],p=b.graphics3DSymbol,u=B(p),d=p.symbolLayers[0];if(!d)continue;d.setElevationInfoOverride(s.elevationInfoOverride);const y=new L(t,u,b.labelClass),f=this._createTextSymbolGraphic(c,r,h,a,d,y);if(null==f)return!1;f._labelClass=b.labelClass,f._labelIndex=n,t.addLabelGraphic(f,s.stageLayer),t.deconflictionPriority=b.textRenderParameters?.definition.size??0,t.setVisibilityFlag(g.LABEL,m.USER,o),t.setVisibilityFlag(g.LABEL,m.SCALE_RANGE,!0),t.setVisibilityFlag(g.LABEL,m.DECONFLICTION,!1),l=!0;const C=b.graphics3DCalloutSymbolLayer;if(C&&h.hasLabelVerticalOffset){C.setElevationInfoOverride(s.elevationInfoOverride);const e=this._createLineCalloutGraphic(r,u,C,h,a);null!=e&&(b.calloutSymbolLayerIndex=t.labelLayers.length,t.addLabelGraphic(e,s.stageLayer))}break}return l&&s.scaleVisibility?.updateGraphicLabelScaleVisibility(t),e.hasGraphics3DResources=!0,!0}_destroyGraphics3DResources(e){const t=e.labelingContext.labelClassContexts;for(const s of e.graphics3DGraphic.labelLayers){if(null==s._labelClass)continue;const e=t[s._labelIndex].graphics3DSymbol.symbolLayers[0];e?.onRemoveGraphic(s)}e.graphics3DGraphic.deconflictionPriority=0,e.graphics3DGraphic.clearLabelGraphics(),e.hasGraphics3DResources=!1}_ensureTextTextureResources(e){if(e.textInitialized)return;const t=e.labelingContext,s=t.labelClassContexts;if(k(s))return;const i=e.graphics3DGraphic.graphic;for(let r=0;r<s.length;r++){const a=s[r];if(e.textRenderers[r]=null,e.textLabelPlacements[r]=null,null==a?.textRenderParameters)continue;const o=a.labelFunction;let n;if("arcade"===o.type)try{const e=o.needsHydrationToEvaluate()?u(i,t.layer):i;n=o.evaluate(e)}catch(l){n=null}else n=o.evaluate(i);if(null==n||""===n||/^\s+$/.test(n))continue;const c=a.graphics3DSymbol;if(!c.symbolLayers[0])continue;const h=e.graphics3DGraphic,b="label-3d"===c.symbol?.type?c.symbol:null,p=a.labelClass,d=t.disablePlacement,y=new L(h,b,p,d).placement;if(null==y)continue;const g=G(y.anchor),m=w(g);e.textRenderers[r]=new I(n,m,a.textRenderParameters,S.maxSize),e.textLabelPlacements[r]=y}e.textInitialized=!0}_destroyTextTextureResources(e){e.textInitialized=!1,e.textRenderers.length=0,e.textLabelPlacements.length=0}_addGraphic(e,t){const s=t.graphic.uid;if(e.graphics.set(s,t),e.active){const i=new O(e,t);this._labels.set(s,i),e.labelsToInitialize.set(s,i)}this.setDirty(),this.deconflictor.setDirty()}_updateGraphicGeometry(e,t){const s=t.graphic.uid,i=this._labels.get(s);if(!i)return!0;for(const l of i.graphics3DGraphic.labelLayers){if(null==l._labelClass)continue;if(!e.labelClassContexts[l._labelIndex].graphics3DSymbol.symbolLayers[0].updateGeometry(l,t.graphic.geometry))return!1}return this.setDirty(),this.deconflictor.setDirty(),!0}_removeGraphic(e,t){const s=t.graphic.uid,i=this._labels.get(s);e.graphics.delete(s),i&&(this._destroyGraphic(i,s),e.labelsToInitialize.delete(s),this.setDirty(),this.deconflictor.setDirty())}_destroyGraphic(e,t){this._labels.delete(t),e.textureAtlasHandles.length&&this._removeLabelTextureFromAtlas(e),this._destroyTextTextureResources(e),e.hasGraphics3DResources&&this._destroyGraphics3DResources(e)}async _labelingInfoChange(e,t){if(!t)return this._visibilityInfoChange(e),this._resetLabels(e),this._createLabelClassContext(e);for(const s of t){const t=e.graphics.get(s);t&&(this._removeGraphic(e,t),this._addGraphic(e,t))}}_globalPropertyChanged(e,t){for(const s of t.labelClassContexts){const i=new Map;t.graphics.forEach((e=>i.set(e.graphic.uid,e)));const l=e=>e.labelLayers[0];if(s.graphics3DSymbol.symbolLayers[0].globalPropertyChanged(e,i,l),s.graphics3DCalloutSymbolLayer){const t=e=>e.labelLayers[s.calloutSymbolLayerIndex];s.graphics3DCalloutSymbolLayer.globalPropertyChanged(e,i,t)}}}_visibilityInfoChange(e){const t=N(e.layer);t&&!e.active&&this._activateLabelingContext(e),!t&&e.active&&this._deactivateLabelingContext(e),this.setDirty()}_resetAllLabels(){for(const e of this._labelingContexts)this._resetLabels(e)}_resetLabels(e){e.graphics.forEach(((t,s)=>{const i=this._labels.get(s);i&&(this._destroyGraphic(i,s),i.visible=!1,e.labelsToInitialize.set(s,i))})),this._destroyLabelClassContext(e),this.setDirty(),this.deconflictor.setDirty()}_findLabelingContext(e){for(const t of this._labelingContexts)if(t.graphics3DCore===e)return t;return null}addGraphicsOwner(e,t,s){const i=s?.emptySymbolLabelSupported||!1,l=s?.elevationInfoOverride||null,r=s?.disablePlacement||null;if(this._findLabelingContext(e))return;const a=e.layer,o=new z(this.view.stage,a,e,t,i,l,r,N(a));return this._labelingContexts.push(o),this.setDirty(),{addGraphic:e=>this._addGraphic(o,e),removeGraphic:e=>this._removeGraphic(o,e),updateGraphicGeometry:e=>this._updateGraphicGeometry(o,e),layerLabelsEnabled:()=>N(o.layer),labelingInfoChange:e=>this._labelingInfoChange(o,e),elevationInfoChange:()=>this._globalPropertyChanged("elevationInfo",o),slicePlaneEnabledChange:()=>this._globalPropertyChanged("slicePlaneEnabled",o),visibilityInfoChange:()=>this._visibilityInfoChange(o),reset:()=>this._resetLabels(o),remove:()=>this._removeGraphicsOwner(e),setDirty:()=>this.setDirty()}}_removeGraphicsOwner(e){const t=this._findLabelingContext(e);if(!t)return;const s=this._labelingContexts.indexOf(t);this._labelingContexts.splice(s,1),t.graphics.forEach((e=>this._removeGraphic(t,e))),t.destroy(),this.setDirty()}setLabelGraphicVisibility(e,t){const s=e.graphic.uid,i=this._labels.get(s);i&&i.visible!==t&&(t&&!i.textureAtlasHandles.length?(this._addLabelTextureToAtlas(i),i.textInitialized||i.labelingContext.labelsToInitialize.set(s,i)):!t&&i.textureAtlasHandles.length&&this._removeLabelTextureFromAtlas(i),i.visible=t,this.setDirty())}setDirty(){!this._dirty&&this._labelingContexts.length>0&&(this._dirty=!0,this.notifyChange("updating"))}get updating(){return this._dirty||this._textTextureAtlas?.updating||this.deconflictor.updating||this._labelingContexts.some((e=>H(e)))}get updatingProgress(){if(!this.updating||!this._textTextureAtlas)return 1;const e=this._labelingContexts.length>0?this._labelingContexts.reduce(((e,t)=>e+(H(t)?0:1)),0)/this._labelingContexts.length:1;return(this._dirty?0:.3)+(this._textTextureAtlas.updating?0:.1)+.1*e+.5*this.deconflictor.updatingProgress}get test(){}};function F(e,t){e.geometries[0].setAttributeData(R.SIZE,[t.displayWidth,t.displayHeight]),e.geometryVertexAttributeUpdated(e.geometries[0],R.SIZE)}function M(e,t){e.geometries[0].setAttributeData(R.UVI,t),e.geometryVertexAttributeUpdated(e.geometries[0],R.UVI,!0)}function H(e){return!!e.labelClassPromise&&!!e.labelClassAbortController}function k(e){return!e||0===e.length}function B(e){return"label-3d"===e.symbol?.type?e.symbol:null}function N(e){return!0===e.labelsVisible&&!!e.labelingInfo?.some((e=>!!e.symbol))}e([h({constructOnly:!0})],U.prototype,"view",void 0),e([h({constructOnly:!0})],U.prototype,"deconflictor",void 0),e([h()],U.prototype,"_textTextureAtlas",void 0),e([h({type:Boolean,readOnly:!0})],U.prototype,"updating",null),U=e([b("esri.views.3d.layers.graphics.Labeler")],U);const W=new x(null,null,null);export{U as Labeler,N as areLabelsVisible};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{debugFlags as t}from"../../support/debugFlags.js";let e,n,i=!1,l=!1,o=!1,s=!1,a=null;function c(t,e){if(!l||!n)return;u();const i=n;let o=0;for(let n=0;n<t.accBinsNumX;n++)for(let e=0;e<t.accBinsNumY;e++){const l=t.accBins[n][t.accBinsNumY-1-e];o+=l.length;const s=n*t.accBinsSizeX,a=(n+1)*t.accBinsSizeX,c=e*t.accBinsSizeY,r=(e+1)*t.accBinsSizeY;i.fillText(l.length.toFixed(),s+5,c+15),h(s,a,c,r,"blue")}i.fillText("total totalShownLabels: "+o,70,40),i.fillText("total visible labels: "+e.size,70,50),i.fillText("total numTests: "+t.accNumTests,70,30)}function r(n){o=t.DECONFLICTOR_SHOW_VISIBLE,s=t.DECONFLICTOR_SHOW_INVISIBLE,i=o||s,l=t.DECONFLICTOR_SHOW_GRID,a=null,i||l?a=()=>p(n):e&&(e.parentElement.removeChild(e),e=null)}function u(){a&&(a(),a=null)}function p(t){null==e&&(e=document.createElement("canvas"),e.setAttribute("id","debugCanvas2d"),t.surface.parentElement.style.position="relative",t.surface.parentElement.appendChild(e));const{state:i}=t,{camera:l,pixelRatio:o}=i,{width:s,height:a}=l,c=s*o,r=a*o;e.setAttribute("width",`${c}px`),e.setAttribute("height",`${r}px`),e.setAttribute("style",`position:absolute;left:0px;top:0px;display:block;pointer-events:none;width:${s}px;height:${a}px`),n=e.getContext("2d"),n.clearRect(0,0,s,a),n.font="12px Arial"}function h(t,i,l,o,s){u();const a=e.height,c=n;c.beginPath(),c.lineWidth=1,c.strokeStyle=s,c.moveTo(t,a-l),c.lineTo(i,a-l),c.stroke(),c.lineTo(i,a-o),c.stroke(),c.lineTo(i,a-l),c.stroke(),c.lineTo(t,a-l),c.stroke(),c.lineTo(t,a-l),c.stroke(),c.closePath()}function f(t,e){i&&(e&&o||!e&&s)&&h(t.aabr[0],t.aabr[2],t.aabr[1],t.aabr[3],e?"green":"red")}export{c as drawAccelerationStruct,f as drawPoly,r as prepare};
5
+ import{debugFlags as e}from"../../support/debugFlags.js";let t,l,n=!1,i=!1,o=!1,s=!1,a=null;function r(e){const t=i?e():null;if(!t?.bins)return;c();const n=l;let o=0;for(let l=0;l<t.numX;l++)for(let e=0;e<t.numY;e++){const i=t.bins[l][t.numY-1-e];o+=i.length;const s=l*t.sizeX,a=(l+1)*t.sizeX,r=e*t.sizeY,u=(e+1)*t.sizeY;n.fillText(i.length.toFixed(),s+5,r+15),b(s,a,r,u,"blue")}n.fillText("total totalShownLabels: "+o,70,40),n.fillText("total visible labels: "+t.numVisible,70,50),n.fillText("total numTests: "+t.numTests,70,30)}function u(r){o=e.DECONFLICTOR_SHOW_VISIBLE,s=e.DECONFLICTOR_SHOW_INVISIBLE,n=o||s,i=e.DECONFLICTOR_SHOW_GRID,a=null,n||i?(l&&t&&l.clearRect(0,0,t.width,t.height),a=()=>h(r)):t&&(t.parentElement.removeChild(t),t=null)}function c(){a&&(a(),a=null)}function h(e){null==t&&(t=document.createElement("canvas"),t.setAttribute("id","debugCanvas2d"),e.surface.parentElement.style.position="relative",e.surface.parentElement.appendChild(t),t.style.position="absolute",t.style.width="100%",t.style.height="100%",t.style.display="block",t.style.pointerEvents="none",l=t.getContext("2d"),l.font="12px Arial");const{width:n,height:i}=e.state.camera;t.width=n,t.height=i}function b(e,n,i,o,s){c();const a=t.height,r=l;r.beginPath(),r.lineWidth=1,r.strokeStyle=s,r.moveTo(e,a-i),r.lineTo(n,a-i),r.stroke(),r.lineTo(n,a-o),r.stroke(),r.lineTo(e,a-o),r.stroke(),r.lineTo(e,a-i),r.stroke(),r.closePath()}function d(e,t){n&&(t&&o||!t&&s)&&b(e.aabr[0],e.aabr[2],e.aabr[1],e.aabr[3],t?"green":"red")}export{r as drawAccelerationStruct,d as drawPoly,u as prepare};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import r from"../../../../../core/Error.js";import{makeHandle as t}from"../../../../../core/handleUtils.js";import{destroyMaybe as o}from"../../../../../core/maybe.js";import n from"../../../../../core/Promise.js";import{on as i}from"../../../../../core/reactiveUtils.js";import{property as s}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators/subclass.js";import{FeatureLayerViewPerformanceInfo as u}from"../../FeatureLayerViewPerformanceInfo.js";import{Feature3DPipelineWorkerHandle as l}from"./Feature3DPipelineWorkerHandle.js";import{FeaturePipelineRenderManager as d}from"./rendering/FeaturePipelineRenderManager.js";import{emptyHighlightHandle as p}from"../../support/highlightUtils.js";import{LayerViewPerformanceInfo as m}from"../../support/LayerViewPerformanceInfo.js";import{UpdatePolicy as c}from"../../../webgl-engine/lib/UpdatePolicy.js";let y=class extends n{constructor(e){super(e),this._renderer=null,this.graphicsQuery={queryForSymbologySnapping:(e,t)=>{throw new r("unsupported-symbology-snapping")},executeQuery:async(e,r)=>await this._workerHandle.executeQuery(e,r),executeQueryForIds:async(e,r)=>await this._workerHandle.executeQueryForIds(e,r),executeQueryForCount:async(e,r)=>await this._workerHandle.executeQueryForCount(e,r),executeQueryForExtent:async(e,r)=>await this._workerHandle.executeQueryForExtent(e,r),executeQueryForLatestObservations:async(e,r)=>await this._workerHandle.executeQueryForLatestObservations(e,r)},this.maximumNumberOfFeatures=1e3}initialize(){if("point"!==this.layerView.layer.geometryType)throw new r("unsupported-geometry-type",`${this.layerView.layer.geometryType} is not supported`);this.addResolvingPromise(this.setup())}destroy(){this.removeAllHandles(),this._workerHandle.destroy(),o(this._renderer)}async setup(){const{layer:e,view:r}=this.layerView,{spatialReference:t,renderSpatialReference:o,resourceController:n,renderCoordsHelper:s,elevationProvider:a}=r,u=r.state.viewingMode;if(this._renderer=new d({view:r,layerUid:e.uid}),"feature"!==e.type)throw new Error("Only FeatureLayer is supported");const p=new l({schedule:e=>n.immediate.schedule(e),layer:e,viewSpatialReference:t,renderSpatialReference:o,viewingMode:u,renderer:this._renderer,elevationProvider:a,renderCoordsHelper:s});this._workerHandle=await p.when(),this.addHandles([this.layerView.view.featureTiles.addClient(),i((()=>this.layerView.view.featureTiles.tiles),"change",(e=>{this._workerHandle.onTileTreeChange(e)}),{onListenerAdd:e=>this._workerHandle.onTileTreeChange({added:e.toArray(),removed:[]}),onListenerRemove:e=>this._workerHandle.onTileTreeChange({added:[],removed:e.toArray()})}),r.elevationProvider.on("elevation-change",(e=>this._workerHandle.onElevationChange(e)))])}get legendEnabled(){return!1}get hasAllFeatures(){return!1}get hasAllFeaturesInView(){return!1}get hasFullGeometries(){return!1}get symbologySnappingSupported(){return!1}get scaleVisibilitySuspended(){return!1}get suspendInfo(){return{}}get updating(){return this._workerHandle.updating}get dataUpdating(){return!1}get updatePolicy(){return c.ASYNC}get maximumNumberOfFeaturesExceeded(){return!1}get updatingProgressValue(){return 1}get usedMemory(){return this._renderer?.usedMemory??0}get unloadedMemory(){return 0}get ignoresMemoryFactor(){return!0}get totalFeatures(){return this._renderer?.totalFeatures??0}get performanceInfo(){const e=this.totalFeatures;return new u(new m(this.usedMemory,e,e,this.maximumNumberOfFeatures,0,null),e,e,this.maximumNumberOfFeaturesExceeded,"tiles","n/a")}get suspendResumeExtentMode(){return"computed"}forEachGraphic(e){}findGraphic(e){return null}highlight(e){return p}maskOccludee(e){return t()}async whenGraphicBounds(e,r){return null}computeAttachmentOrigin(e,r){return null}elevationAlignPointsInFeatures(e,t){throw new r("unsupported-elevation-alignment")}async doRefresh(e){}setVisibility(e,r){}getMissingAttributesForFeature(e){return null}getHydratedGeometry(e){return null}};e([s()],y.prototype,"layerView",void 0),e([s()],y.prototype,"updating",null),e([s()],y.prototype,"totalFeatures",null),y=e([a("esri.views.3d.layers.graphics.pipeline.Feature3DPipeline")],y);export{y as Feature3DPipeline};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import r from"../../../../../core/Error.js";import{makeHandle as t}from"../../../../../core/handleUtils.js";import{destroyMaybe as o}from"../../../../../core/maybe.js";import i from"../../../../../core/Promise.js";import{on as n}from"../../../../../core/reactiveUtils.js";import{property as s}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators/subclass.js";import{FeatureLayerViewPerformanceInfo as u}from"../../FeatureLayerViewPerformanceInfo.js";import{Feature3DPipelineWorkerHandle as l}from"./Feature3DPipelineWorkerHandle.js";import{FeaturePipelineRenderManager as d}from"./rendering/FeaturePipelineRenderManager.js";import{emptyHighlightHandle as p}from"../../support/highlightUtils.js";import{LayerViewPerformanceInfo as m}from"../../support/LayerViewPerformanceInfo.js";import{UpdatePolicy as c}from"../../../webgl-engine/lib/UpdatePolicy.js";let y=class extends i{constructor(e){super(e),this._renderer=null,this.graphicsQuery={queryForSymbologySnapping:(e,t)=>{throw new r("unsupported-symbology-snapping")},executeQuery:async(e,r)=>await this._workerHandle.executeQuery(e,r),executeQueryForIds:async(e,r)=>await this._workerHandle.executeQueryForIds(e,r),executeQueryForCount:async(e,r)=>await this._workerHandle.executeQueryForCount(e,r),executeQueryForExtent:async(e,r)=>await this._workerHandle.executeQueryForExtent(e,r),executeQueryForLatestObservations:async(e,r)=>await this._workerHandle.executeQueryForLatestObservations(e,r)},this.maximumNumberOfFeatures=1e3}initialize(){if("point"!==this.layerView.layer.geometryType)throw new r("unsupported-geometry-type",`${this.layerView.layer.geometryType} is not supported`);this.addResolvingPromise(this.setup())}destroy(){this.removeAllHandles(),this._workerHandle.destroy(),o(this._renderer)}async setup(){const{layer:e,view:r,uid:t}=this.layerView,{spatialReference:o,renderSpatialReference:i,resourceController:s,renderCoordsHelper:a,elevationProvider:u}=r,p=r.state.viewingMode;if(this._renderer=new d({view:r,layerViewUid:t}),"feature"!==e.type)throw new Error("Only FeatureLayer is supported");const m=new l({schedule:e=>s.immediate.schedule(e),layer:e,viewSpatialReference:o,renderSpatialReference:i,viewingMode:p,renderer:this._renderer,elevationProvider:u,renderCoordsHelper:a});this._workerHandle=await m.when(),this.addHandles([this.layerView.view.featureTiles.addClient(),n((()=>this.layerView.view.featureTiles.tiles),"change",(e=>{this._workerHandle.onTileTreeChange(e)}),{onListenerAdd:e=>this._workerHandle.onTileTreeChange({added:e.toArray(),removed:[]}),onListenerRemove:e=>this._workerHandle.onTileTreeChange({added:[],removed:e.toArray()})}),r.elevationProvider.on("elevation-change",(e=>this._workerHandle.onElevationChange(e)))])}get legendEnabled(){return!1}get hasAllFeatures(){return!1}get hasAllFeaturesInView(){return!1}get hasFullGeometries(){return!1}get symbologySnappingSupported(){return!1}get scaleVisibilitySuspended(){return!1}get suspendInfo(){return{}}get updating(){return this._workerHandle.updating}get dataUpdating(){return!1}get updatePolicy(){return c.ASYNC}get maximumNumberOfFeaturesExceeded(){return!1}get updatingProgressValue(){return 1}get usedMemory(){return this._renderer?.usedMemory??0}get unloadedMemory(){return 0}get ignoresMemoryFactor(){return!0}get totalFeatures(){return this._renderer?.totalFeatures??0}get performanceInfo(){const e=this.totalFeatures;return new u(new m(this.usedMemory,e,e,this.maximumNumberOfFeatures,0,null),e,e,this.maximumNumberOfFeaturesExceeded,"tiles","n/a")}get suspendResumeExtentMode(){return"computed"}forEachGraphic(e){}findGraphic(e){return null}highlight(e){return p}maskOccludee(e){return t()}async whenGraphicBounds(e,r){return null}computeAttachmentOrigin(e,r){return null}elevationAlignPointsInFeatures(e,t){throw new r("unsupported-elevation-alignment")}async doRefresh(e){}setVisibility(e,r){}getMissingAttributesForFeature(e){return null}getHydratedGeometry(e){return null}};e([s()],y.prototype,"layerView",void 0),e([s()],y.prototype,"updating",null),e([s()],y.prototype,"totalFeatures",null),y=e([a("esri.views.3d.layers.graphics.pipeline.Feature3DPipeline")],y);export{y as Feature3DPipeline};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../../chunks/tslib.es6.js";import{nullUid as t}from"../../../../../../core/uid.js";import{property as r}from"../../../../../../core/accessorSupport/decorators/property.js";import"../../../../../../core/has.js";import"../../../../../../core/Logger.js";import"../../../../../../core/RandomLCG.js";import{subclass as i}from"../../../../../../core/accessorSupport/decorators/subclass.js";import{glLayout as s}from"../../../../support/buffer/glUtil.js";import{ShaderOutput as n}from"../../../../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SyncRenderPlugin as o}from"../../../../webgl-engine/effects/RenderPlugin.js";import{GLMaterials as a}from"../../../../webgl-engine/lib/GLMaterials.js";import{IntersectorType as l}from"../../../../webgl-engine/lib/IntersectorInterfaces.js";import{BoundingVolume as u}from"../../../../webgl-engine/lib/Object3D.js";import{RenderSlot as c}from"../../../../webgl-engine/lib/RenderSlot.js";import{DrawParameters as m}from"../../../../webgl-engine/materials/DrawParameters.js";import{HUDMaterial as d}from"../../../../webgl-engine/materials/HUDMaterial.js";let h=class extends o{constructor(e){super(e),this._glMaterials=null,this._produces=new Map,this._renderGeometries=new Map,this._vaoCache=null,this._drawParameters=new m,this._bufferWriter=null,this.slicePlaneEnabled=!1,this.isGround=!1,this.type=e.material instanceof d?l.HUD:l.OBJECT,this.layerUid=e.layerUid}get produces(){return this._produces}get numFeatures(){const e=6;let t=0;return this._renderGeometries.forEach((r=>t+=r.numElements/e)),t}get usedMemory(){let e=0;return this._renderGeometries.forEach((t=>{e+=t.vao.usedMemory})),e}intersect(e,r,i,s,n,o){const{material:a,_bufferWriter:l,layerUid:c}=this,m=this._renderGeometries;if(0!==m.size&&null!=l.intersect)for(const[d,h]of m){const{buffer:r,localOrigin:n,items:o}=h;l.intersect(r.data,a.parameters,n,e,i,s,((r,i,s,n,l,m)=>{const d=o.objectIds[s];o.visibilities[s]&&e.handleObjectIntersection({object:{id:t,graphicUid:d,layerUid:c,boundingVolumeWorldSpace:new u,geometries:[{material:a}]},geometryId:0,primIndex:s},r,i,n,null,l,m)}))}}initialize(){this._bufferWriter=this.material.createBufferWriter(),this.material.produces.forEach(((e,t)=>{this._produces.set(t,(t=>t!==n.Highlight&&t!==n.ShadowHighlight&&e(t)))}))}destroy(){this._glMaterials.dispose();const e=this._renderGeometries.keys();for(const t of e)this.removeRenderGeometryBuffer(t)}acquireTechniques(e){const t=this.material;if(!t.shouldRender(e))return null;const{output:r,bind:i}=e,s=t.produces.get(i.slot);if(!s?.(r))return null;if(r===n.Highlight||r===n.ShadowHighlight)return null;const o=this._glMaterials.load(e.rctx,i.slot,r);return o?.beginSlot(i)}render(e,t){const r=this._renderGeometries;if(0===r.size)return;const{bind:i}=e,s=i.slot===c.OCCLUDER_MATERIAL||i.slot===c.TRANSPARENT_OCCLUDER_MATERIAL?i.slot:null,n=e.rctx;n.runAppleAmdDriverHelper(),n.bindTechnique(t,i,this.material.parameters);const o=t.program;for(const[a,l]of r){const{vao:e,localOrigin:r,drawCalls:a}=l;this._drawParameters.origin=r,o.bindDraw(i,this.material.parameters,this._drawParameters),t.ensureAttributeLocations(e),n.bindVAO(e),n.setPipelineState(t.getPipeline(!1,s));for(const i of a)n.drawArrays(t.primitiveType,i.start,i.count)}}initializeRenderContext(e,t){this._glMaterials=new a(this.material,e.materials),this._vaoCache=e.renderContext.rctx.getVaoCache(this.material.vertexAttributeLocations,s(this._bufferWriter.vertexBufferLayout))}uninitializeRenderContext(){}addRenderGeometryBuffer(e,t,r,i){this.removeRenderGeometryBuffer(e);const{data:s,elementCount:n}=t,o=this._vaoCache.newVao(s.byteLength);o.vertexBuffers.get("geometry").setSubData(new Uint8Array(s),0,0,s.byteLength);const a={localOrigin:i,numElements:n,buffer:t,items:r,vao:o,drawCalls:this._produceDrawCalls(r)};this._renderGeometries.set(e,a)}updateRenderGeometryBuffer(e,t,r,i){const{data:s,elementCount:n}=t,o=this._renderGeometries.get(e);if(null==o)return;this._vaoCache.deleteVao(o.vao);const a=this._vaoCache.newVao(s.byteLength);a.vertexBuffers.get("geometry").setSubData(new Uint8Array(s),0,0,s.byteLength),o.localOrigin=i,o.numElements=n,o.buffer=t,o.items=r,o.vao=a,o.drawCalls=this._produceDrawCalls(r)}removeRenderGeometryBuffer(e){const t=this._renderGeometries.get(e);null!=t&&(this._vaoCache.deleteVao(t.vao),this._renderGeometries.delete(e))}updateVisibility(e,t){const r=this._renderGeometries.get(e);if(null==r)return;const{items:i}=r;if(i.visibilities.length!==t.length)throw new Error("Unexpected mismatch between old and new visibility flag buffer length.");i.visibilities=t,r.drawCalls=this._produceDrawCalls(i)}hasHighlight(){return!1}_produceDrawCalls(e){const{visibilities:t,ranges:r}=e,i=[];if(f(r)){if(0===r.numItems)return[];const e=r.numVertices;let s=null;for(let n=0;n<r.numItems;++n){t[n]?null==s?(s={start:n*e,count:e},i.push(s)):s.count+=e:s=null}}else{const e=r.counts,s=e.length;if(0===s)return[];let n=null,o=0;for(let r=0;r<s;++r){const s=t[r],a=e[r];s?null==n?(n={start:o,count:a},i.push(n)):n.count+=a:n=null,o+=a}}return i}};function f(e){return"numItems"in e}e([r({constructOnly:!0})],h.prototype,"material",void 0),h=e([i("esri.views.3d.layers.graphics.pipeline.rendering.DirectRenderer")],h);export{h as DirectRenderer};
5
+ import{_ as e}from"../../../../../../chunks/tslib.es6.js";import{nullUid as t}from"../../../../../../core/uid.js";import{property as r}from"../../../../../../core/accessorSupport/decorators/property.js";import"../../../../../../core/has.js";import"../../../../../../core/Logger.js";import"../../../../../../core/RandomLCG.js";import{subclass as i}from"../../../../../../core/accessorSupport/decorators/subclass.js";import{glLayout as s}from"../../../../support/buffer/glUtil.js";import{ShaderOutput as n}from"../../../../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SyncRenderPlugin as o}from"../../../../webgl-engine/effects/RenderPlugin.js";import{GLMaterials as a}from"../../../../webgl-engine/lib/GLMaterials.js";import{IntersectorType as l}from"../../../../webgl-engine/lib/IntersectorInterfaces.js";import{BoundingVolume as u}from"../../../../webgl-engine/lib/Object3D.js";import{RenderSlot as c}from"../../../../webgl-engine/lib/RenderSlot.js";import{DrawParameters as m}from"../../../../webgl-engine/materials/DrawParameters.js";import{HUDMaterial as d}from"../../../../webgl-engine/materials/HUDMaterial.js";let h=class extends o{constructor(e){super(e),this._glMaterials=null,this._produces=new Map,this._renderGeometries=new Map,this._vaoCache=null,this._drawParameters=new m,this._bufferWriter=null,this.slicePlaneEnabled=!1,this.isGround=!1,this.type=e.material instanceof d?l.HUD:l.OBJECT,this.layerViewUid=e.layerViewUid}get produces(){return this._produces}get numFeatures(){const e=6;let t=0;return this._renderGeometries.forEach((r=>t+=r.numElements/e)),t}get usedMemory(){let e=0;return this._renderGeometries.forEach((t=>{e+=t.vao.usedMemory})),e}intersect(e,r,i,s,n,o){const{material:a,_bufferWriter:l,layerViewUid:c}=this,m=this._renderGeometries;if(0!==m.size&&null!=l.intersect)for(const[d,h]of m){const{buffer:r,localOrigin:n,items:o}=h;l.intersect(r.data,a.parameters,n,e,i,s,((r,i,s,n,l,m)=>{const d=o.objectIds[s];o.visibilities[s]&&e.handleObjectIntersection({object:{id:t,graphicUid:d,layerViewUid:c,boundingVolumeWorldSpace:new u,geometries:[{material:a}]},geometryId:0,primIndex:s},r,i,n,null,l,m)}))}}initialize(){this._bufferWriter=this.material.createBufferWriter(),this.material.produces.forEach(((e,t)=>{this._produces.set(t,(t=>t!==n.Highlight&&t!==n.ShadowHighlight&&e(t)))}))}destroy(){this._glMaterials.dispose();const e=this._renderGeometries.keys();for(const t of e)this.removeRenderGeometryBuffer(t)}acquireTechniques(e){const t=this.material;if(!t.shouldRender(e))return null;const{output:r,bind:i}=e,s=t.produces.get(i.slot);if(!s?.(r))return null;if(r===n.Highlight||r===n.ShadowHighlight)return null;const o=this._glMaterials.load(e.rctx,i.slot,r);return o?.beginSlot(i)}render(e,t){const r=this._renderGeometries;if(0===r.size)return;const{bind:i}=e,s=i.slot===c.OCCLUDER_MATERIAL||i.slot===c.TRANSPARENT_OCCLUDER_MATERIAL?i.slot:null,n=e.rctx;n.runAppleAmdDriverHelper(),n.bindTechnique(t,i,this.material.parameters);const o=t.program;for(const[a,l]of r){const{vao:e,localOrigin:r,drawCalls:a}=l;this._drawParameters.origin=r,o.bindDraw(i,this.material.parameters,this._drawParameters),t.ensureAttributeLocations(e),n.bindVAO(e),n.setPipelineState(t.getPipeline(!1,s));for(const i of a)n.drawArrays(t.primitiveType,i.start,i.count)}}initializeRenderContext(e,t){this._glMaterials=new a(this.material,e.materials),this._vaoCache=e.renderContext.rctx.getVaoCache(this.material.vertexAttributeLocations,s(this._bufferWriter.vertexBufferLayout))}uninitializeRenderContext(){}addRenderGeometryBuffer(e,t,r,i){this.removeRenderGeometryBuffer(e);const{data:s,elementCount:n}=t,o=this._vaoCache.newVao(s.byteLength);o.vertexBuffers.get("geometry").setSubData(new Uint8Array(s),0,0,s.byteLength);const a={localOrigin:i,numElements:n,buffer:t,items:r,vao:o,drawCalls:this._produceDrawCalls(r)};this._renderGeometries.set(e,a)}updateRenderGeometryBuffer(e,t,r,i){const{data:s,elementCount:n}=t,o=this._renderGeometries.get(e);if(null==o)return;this._vaoCache.deleteVao(o.vao);const a=this._vaoCache.newVao(s.byteLength);a.vertexBuffers.get("geometry").setSubData(new Uint8Array(s),0,0,s.byteLength),o.localOrigin=i,o.numElements=n,o.buffer=t,o.items=r,o.vao=a,o.drawCalls=this._produceDrawCalls(r)}removeRenderGeometryBuffer(e){const t=this._renderGeometries.get(e);null!=t&&(this._vaoCache.deleteVao(t.vao),this._renderGeometries.delete(e))}updateVisibility(e,t){const r=this._renderGeometries.get(e);if(null==r)return;const{items:i}=r;if(i.visibilities.length!==t.length)throw new Error("Unexpected mismatch between old and new visibility flag buffer length.");i.visibilities=t,r.drawCalls=this._produceDrawCalls(i)}hasHighlight(){return!1}_produceDrawCalls(e){const{visibilities:t,ranges:r}=e,i=[];if(f(r)){if(0===r.numItems)return[];const e=r.numVertices;let s=null;for(let n=0;n<r.numItems;++n){t[n]?null==s?(s={start:n*e,count:e},i.push(s)):s.count+=e:s=null}}else{const e=r.counts,s=e.length;if(0===s)return[];let n=null,o=0;for(let r=0;r<s;++r){const s=t[r],a=e[r];s?null==n?(n={start:o,count:a},i.push(n)):n.count+=a:n=null,o+=a}}return i}};function f(e){return"numItems"in e}e([r({constructOnly:!0})],h.prototype,"material",void 0),h=e([i("esri.views.3d.layers.graphics.pipeline.rendering.DirectRenderer")],h);export{h as DirectRenderer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../../chunks/tslib.es6.js";import r from"../../../../../../core/Accessor.js";import"../../../../../../core/has.js";import{makeHandle as t}from"../../../../../../core/handleUtils.js";import{releaseMaybe as s}from"../../../../../../core/maybe.js";import{createAbortError as i}from"../../../../../../core/promiseUtils.js";import{property as o}from"../../../../../../core/accessorSupport/decorators/property.js";import"../../../../../../core/Logger.js";import"../../../../../../core/RandomLCG.js";import{subclass as n}from"../../../../../../core/accessorSupport/decorators/subclass.js";import{ONES as d}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as a}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ViewingMode as l}from"../../../../../ViewingMode.js";import{namedAnchorToHUDMaterialAnchorPos as c}from"../../placementUtils.js";import{DirectRenderer as u}from"./DirectRenderer.js";import{LodRenderer as m}from"./LodRenderer.js";import{defaultBoundingBox as f,createTexture as h,requiresHalfTexelOffset as p}from"../../../../support/engineContent/sdfPrimitives.js";import{CullFaceOptions as g}from"../../../../webgl-engine/lib/basicInterfaces.js";import{DefaultMaterial as w}from"../../../../webgl-engine/materials/DefaultMaterial.js";import{HUDMaterial as v}from"../../../../webgl-engine/materials/HUDMaterial.js";import{schematicMRRFactors as y}from"../../../../webgl-engine/materials/pbrUtils.js";let R=class extends r{constructor(e){super(),this.view=null,this.layerUid=null,this._materials=new Map,this._directRenderers=new Map,this._lodRenderers=new Map,this.totalFeatures=0,this.view=e.view,this.layerUid=e.layerUid}initialize(){}destroy(){this.removeAllHandles(),this._lodRenderers.forEach((e=>e.destroy()))}async createMaterial(e,r){const{view:i}=this,{sharedSymbolResources:o}=i;if(null==o)throw new Error("No shared symbol resources found!");const{textures:n}=o,d=i.state.viewingMode===l.Global;let a=null;switch(r){case"default":a=_(o,{physicalBasedRenderingEnabled:!0,slicePlaneEnabled:!1,castShadows:!0,isPrimitive:!0,screenSizePerspectiveEnabled:!0},d);break;case"hud":{const[e,r]=b(n,d);this.addHandles([t((()=>s(r)))]),a=e}break;default:throw new Error(`unable to create unknown material type ${r}`)}this._materials.set(e,a)}async createDirectRenderer(e){if(this._directRenderers.has(e))return;const r=this._materials.get(e);if(null==r)throw new Error(`material not found ${e}`);const{view:t}=this,s=new u({material:r,layerUid:this.layerUid});this._directRenderers.set(e,s),t.stage.addRenderPlugin(s),t.stage.renderView.renderer.updateHasFlags()}async createLoDRenderer(e,r,t){const s=new m({view:this.view,layerUid:this.layerUid}),o=e=>this._materials.get(e);if(await s.doLoad(r,o,t),t?.aborted)throw s.destroy(),i();this._lodRenderers.set(e,s)}async executeRenderCommands(e){for(const r of e)switch(r.id){case"add-direct-renderer-geometry-buffer":this._addDirectRendererGeometryBuffer(r);break;case"update-direct-renderer-geometry-buffer":this._updateDirectRendererGeometryBuffer(r);break;case"remove-direct-renderer-geometry-buffer":this._removeDirectRendererGeometryBuffer(r);break;case"add-lod-instances":this._addLodInstances(r);break;case"remove-lod-instances":this._removeLodInstances(r);break;case"update-lod-instance-data":this._updateLodInstanceData(r);break;case"update-visibility":this._updateVisibility(r)}e.length>0&&this._updateFeatureCount()}_updateFeatureCount(){let e=0;for(const r of this._directRenderers.values())e+=r.numFeatures;for(const r of this._lodRenderers.values())e+=r.numFeatures;this._set("totalFeatures",e)}get usedMemory(){let e=0;for(const r of this._directRenderers.values())e+=r.usedMemory;for(const r of this._lodRenderers.values())e+=r.usedMemory;return e}_addDirectRendererGeometryBuffer({groupId:e,rendererId:r,renderGeometryBuffer:t,renderGeometryBufferItems:s,localOrigin:i}){const o=this._directRenderers.get(r);null!=o?(o.addRenderGeometryBuffer(e,t,s,i),this.view.stage.renderView.requestRender()):console.error("no renderer assigned to provided material")}_updateDirectRendererGeometryBuffer({groupId:e,rendererId:r,renderGeometryBuffer:t,renderGeometryBufferItems:s,localOrigin:i}){const o=this._directRenderers.get(r);null!=o?(o.updateRenderGeometryBuffer(e,t,s,i),this.view.stage.renderView.requestRender()):console.error("no renderer assigned to provided material")}_removeDirectRendererGeometryBuffer({groupId:e,rendererId:r}){const t=this._directRenderers.get(r);null!=t?(t.removeRenderGeometryBuffer(e),this.view.stage.renderView.requestRender()):console.error("no renderer assigned to provided material")}_addLodInstances({rendererId:e,groupId:r,data:t}){const s=this._lodRenderers.get(e);if(null==s)throw new Error("no lod renderer assigned to provided lod renderer Id");s.addInstances(r,t),this.view.stage.renderView.requestRender()}_removeLodInstances({rendererId:e,groupId:r}){const t=this._lodRenderers.get(e);if(null==t)throw new Error("no lod renderer assigned to provided lod renderer Id");t.removeInstances(r),this.view.stage.renderView.requestRender()}_updateLodInstanceData({rendererId:e,groupId:r,globalTransforms:t}){const s=this._lodRenderers.get(e);if(null==s)throw new Error("No renderer found with the provided id");null!=t&&s.updateGlobalTransforms(r,t),this.view.stage.renderView.requestRender()}_updateVisibility({rendererId:e,groupId:r,visibility:t}){const s=this._directRenderers.get(e)??this._lodRenderers.get(e);if(null==s)throw new Error("No renderer found with the provided id");s.updateVisibility(r,t),this.view.stage.renderView.requestRender()}};function b(e,r){const t={anchorPosition:c.center,occlusionTest:!0,hasSlicePlane:!1,color:[1,0,0,1],outlineColor:[0,0,0,1],outlineSize:1,distanceFieldBoundingBox:f},s=null;if(null!=e){const r=e.fromData("circle-icon",(()=>h("circle")));t.textureId=r.texture.id,t.textureIsSignedDistanceField=!0,t.sampleSignedDistanceFieldTexelCenter=p("circle")}return[new v(t,r),s]}function _(e,r,t){const s={usePBR:r.physicalBasedRenderingEnabled,isSchematic:!0,mrrFactors:y,ambient:d,diffuse:d,hasSlicePlane:r.slicePlaneEnabled,castShadows:r.castShadows,offsetTransparentBackfaces:!r.isPrimitive};r.screenSizePerspectiveEnabled&&(s.screenSizePerspective=e.screenSizePerspectiveSettings),s.externalColor=a,s.isInstanced=!0;const i=new w(s,{spherical:t});return i.setParameters({cullFace:i.transparent?g.None:g.Back}),i}e([o({readOnly:!0})],R.prototype,"totalFeatures",void 0),R=e([n("esri.views.3d.layers.graphics.pipeline.rendering.FeaturePipelineRenderManager")],R);export{R as FeaturePipelineRenderManager,_ as createDefaultMaterial,b as createHudMaterial};
5
+ import{_ as e}from"../../../../../../chunks/tslib.es6.js";import r from"../../../../../../core/Accessor.js";import"../../../../../../core/has.js";import{makeHandle as t}from"../../../../../../core/handleUtils.js";import{releaseMaybe as s}from"../../../../../../core/maybe.js";import{createAbortError as i}from"../../../../../../core/promiseUtils.js";import{property as o}from"../../../../../../core/accessorSupport/decorators/property.js";import"../../../../../../core/Logger.js";import"../../../../../../core/RandomLCG.js";import{subclass as n}from"../../../../../../core/accessorSupport/decorators/subclass.js";import{ONES as d}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as a}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ViewingMode as l}from"../../../../../ViewingMode.js";import{namedAnchorToHUDMaterialAnchorPos as c}from"../../placementUtils.js";import{DirectRenderer as u}from"./DirectRenderer.js";import{LodRenderer as m}from"./LodRenderer.js";import{defaultBoundingBox as f,createTexture as h,requiresHalfTexelOffset as p}from"../../../../support/engineContent/sdfPrimitives.js";import{CullFaceOptions as w}from"../../../../webgl-engine/lib/basicInterfaces.js";import{DefaultMaterial as g}from"../../../../webgl-engine/materials/DefaultMaterial.js";import{HUDMaterial as v}from"../../../../webgl-engine/materials/HUDMaterial.js";import{schematicMRRFactors as y}from"../../../../webgl-engine/materials/pbrUtils.js";let R=class extends r{constructor(e){super(),this.view=null,this.layerViewUid=null,this._materials=new Map,this._directRenderers=new Map,this._lodRenderers=new Map,this.totalFeatures=0,this.view=e.view,this.layerViewUid=e.layerViewUid}initialize(){}destroy(){this.removeAllHandles(),this._lodRenderers.forEach((e=>e.destroy()))}async createMaterial(e,r){const{view:i}=this,{sharedSymbolResources:o}=i;if(null==o)throw new Error("No shared symbol resources found!");const{textures:n}=o,d=i.state.viewingMode===l.Global;let a=null;switch(r){case"default":a=_(o,{physicalBasedRenderingEnabled:!0,slicePlaneEnabled:!1,castShadows:!0,isPrimitive:!0,screenSizePerspectiveEnabled:!0},d);break;case"hud":{const[e,r]=b(n,d);this.addHandles([t((()=>s(r)))]),a=e}break;default:throw new Error(`unable to create unknown material type ${r}`)}this._materials.set(e,a)}async createDirectRenderer(e){if(this._directRenderers.has(e))return;const r=this._materials.get(e);if(null==r)throw new Error(`material not found ${e}`);const{view:t}=this,s=new u({material:r,layerViewUid:this.layerViewUid});this._directRenderers.set(e,s),t.stage.addRenderPlugin(s),t.stage.renderView.renderer.updateHasFlags()}async createLoDRenderer(e,r,t){const s=new m({view:this.view,layerViewUid:this.layerViewUid}),o=e=>this._materials.get(e);if(await s.doLoad(r,o,t),t?.aborted)throw s.destroy(),i();this._lodRenderers.set(e,s)}async executeRenderCommands(e){for(const r of e)switch(r.id){case"add-direct-renderer-geometry-buffer":this._addDirectRendererGeometryBuffer(r);break;case"update-direct-renderer-geometry-buffer":this._updateDirectRendererGeometryBuffer(r);break;case"remove-direct-renderer-geometry-buffer":this._removeDirectRendererGeometryBuffer(r);break;case"add-lod-instances":this._addLodInstances(r);break;case"remove-lod-instances":this._removeLodInstances(r);break;case"update-lod-instance-data":this._updateLodInstanceData(r);break;case"update-visibility":this._updateVisibility(r)}e.length>0&&this._updateFeatureCount()}_updateFeatureCount(){let e=0;for(const r of this._directRenderers.values())e+=r.numFeatures;for(const r of this._lodRenderers.values())e+=r.numFeatures;this._set("totalFeatures",e)}get usedMemory(){let e=0;for(const r of this._directRenderers.values())e+=r.usedMemory;for(const r of this._lodRenderers.values())e+=r.usedMemory;return e}_addDirectRendererGeometryBuffer({groupId:e,rendererId:r,renderGeometryBuffer:t,renderGeometryBufferItems:s,localOrigin:i}){const o=this._directRenderers.get(r);null!=o?(o.addRenderGeometryBuffer(e,t,s,i),this.view.stage.renderView.requestRender()):console.error("no renderer assigned to provided material")}_updateDirectRendererGeometryBuffer({groupId:e,rendererId:r,renderGeometryBuffer:t,renderGeometryBufferItems:s,localOrigin:i}){const o=this._directRenderers.get(r);null!=o?(o.updateRenderGeometryBuffer(e,t,s,i),this.view.stage.renderView.requestRender()):console.error("no renderer assigned to provided material")}_removeDirectRendererGeometryBuffer({groupId:e,rendererId:r}){const t=this._directRenderers.get(r);null!=t?(t.removeRenderGeometryBuffer(e),this.view.stage.renderView.requestRender()):console.error("no renderer assigned to provided material")}_addLodInstances({rendererId:e,groupId:r,data:t}){const s=this._lodRenderers.get(e);if(null==s)throw new Error("no lod renderer assigned to provided lod renderer Id");s.addInstances(r,t),this.view.stage.renderView.requestRender()}_removeLodInstances({rendererId:e,groupId:r}){const t=this._lodRenderers.get(e);if(null==t)throw new Error("no lod renderer assigned to provided lod renderer Id");t.removeInstances(r),this.view.stage.renderView.requestRender()}_updateLodInstanceData({rendererId:e,groupId:r,globalTransforms:t}){const s=this._lodRenderers.get(e);if(null==s)throw new Error("No renderer found with the provided id");null!=t&&s.updateGlobalTransforms(r,t),this.view.stage.renderView.requestRender()}_updateVisibility({rendererId:e,groupId:r,visibility:t}){const s=this._directRenderers.get(e)??this._lodRenderers.get(e);if(null==s)throw new Error("No renderer found with the provided id");s.updateVisibility(r,t),this.view.stage.renderView.requestRender()}};function b(e,r){const t={anchorPosition:c.center,occlusionTest:!0,hasSlicePlane:!1,color:[1,0,0,1],outlineColor:[0,0,0,1],outlineSize:1,distanceFieldBoundingBox:f},s=null;if(null!=e){const r=e.fromData("circle-icon",(()=>h("circle")));t.textureId=r.texture.id,t.textureIsSignedDistanceField=!0,t.sampleSignedDistanceFieldTexelCenter=p("circle")}return[new v(t,r),s]}function _(e,r,t){const s={usePBR:r.physicalBasedRenderingEnabled,isSchematic:!0,mrrFactors:y,ambient:d,diffuse:d,hasSlicePlane:r.slicePlaneEnabled,castShadows:r.castShadows,offsetTransparentBackfaces:!r.isPrimitive};r.screenSizePerspectiveEnabled&&(s.screenSizePerspective=e.screenSizePerspectiveSettings),s.externalColor=a,s.isInstanced=!0;const i=new g(s,{spherical:t});return i.setParameters({cullFace:i.transparent?w.None:w.Back}),i}e([o({readOnly:!0})],R.prototype,"totalFeatures",void 0),R=e([n("esri.views.3d.layers.graphics.pipeline.rendering.FeaturePipelineRenderManager")],R);export{R as FeaturePipelineRenderManager,_ as createDefaultMaterial,b as createHudMaterial};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../../chunks/tslib.es6.js";import has from"../../../../../../core/has.js";import{throwIfAborted as r}from"../../../../../../core/promiseUtils.js";import"../../../../../../core/Logger.js";import"../../../../../../core/RandomLCG.js";import"../../../../../../core/Error.js";import{subclass as s}from"../../../../../../core/accessorSupport/decorators/subclass.js";import{VertexAttribute as n}from"../../../../webgl-engine/lib/VertexAttribute.js";import{LodRenderer as t}from"../../../../webgl-engine/lib/lodRendering/LodRenderer.js";import{LodComponentRenderGeometry as o,LodComponentResources as i,LodLevelResources as a,LodResources as d}from"../../../../webgl-engine/lib/lodRendering/LodResources.js";let l=class{constructor(e){this._optionalFields=new Array,this._instanceGroupToIndices=new Map,this._instanceIndexToFeatureId=new Map,this._disposeResourceHandles=new Array,this._lodRendererResources=null,this._numFeatures=0,this.layerUid=e.layerUid,this.view=e.view,this.sharedResources=this.view.sharedSymbolResources,this.scheduler=this.view.resourceController.scheduler}get numFeatures(){return this._numFeatures}get usedMemory(){const e=this._lodRendererResources?.lodRenderer,r=e?.symbol;return(r?.computeUsedMemory()??0)+16*this._instanceIndexToFeatureId.size}destroy(){this._disposeResourceHandles.forEach((e=>e()))}async doLoad(e,s,t){has("enable-feature:objectAndLayerId-rendering")&&this._optionalFields.push(n.OLIDCOLOR);const o=c((e=>s(e)),e),i=this.view.stage,a=o.getMaterials();i.addMany(a),this._addDisposeResource((()=>i.removeMany(a)));const d=o.getTextures();i.addMany(d),this._addDisposeResource((()=>{d.forEach((e=>e.unload())),i.removeMany(d)})),await Promise.all(d.map((e=>this.view.stage.schedule((()=>e.load(i.renderView.renderingContext)),t)))),r(t);const l=await this._createLodRenderer(o,t);this._lodRendererResources={lodRenderer:l,materials:a,textures:d}}addInstances(e,r){const s=this._lodRendererResources;if(null==s)return;const n=s.lodRenderer;if(null==n)return;const{featureIds:t,localTransforms:o,globalTransforms:i,visibility:a}=r,d=new Array,l=n.instanceData,c=t.length,u=this._instanceIndexToFeatureId;for(let h=0;h<c;++h){const e=t[h],r=l.addInstance(),s=l.view,n=16*h;s.localTransform.copyFromTypedBuffer(r,o,n),s.globalTransform.copyFromTypedBuffer(r,i,n),l.updateModelTransform(r),l.setVisible(r,Boolean(a[h])),d.push(r),u.set(r,e)}this._instanceGroupToIndices.set(e,d),this._numFeatures+=c}removeInstances(e){const r=this._instanceGroupToIndices.get(e);if(null==r)return;const s=this._lodRendererResources;if(null==s)return;const n=s.lodRenderer.instanceData,t=this._instanceIndexToFeatureId;for(const o of r)n.removeInstance(o),t.delete(o);this._numFeatures-=r.length,this._instanceGroupToIndices.delete(e)}updateVisibility(e,r){const s=this._instanceGroupToIndices.get(e);if(null==s)return;const n=this._lodRendererResources;if(null==n)return;const t=s.length;if(t!==r.length)throw new Error("Unexpected mismatch instance count and visibility flag buffer length.");const o=n.lodRenderer.instanceData;for(let i=0;i<t;++i)o.setVisible(s[i],Boolean(r[i]))}updateGlobalTransforms(e,r){const s=this._instanceGroupToIndices.get(e);if(null==s)return;const n=this._lodRendererResources;if(null==n)return;const t=s.length;if(16*t!==r.length)throw new Error("Unexpected mismatch instance count and visibility flag buffer length.");const o=n.lodRenderer.instanceData,i=o.view;for(let a=0;a<t;++a){const e=s[a],n=16*a;i.globalTransform.copyFromTypedBuffer(e,r,n),o.updateModelTransform(e)}}_addDisposeResource(e){this._disposeResourceHandles.push(e)}async _createLodRenderer(e,r){const s=this.view.stage,n={layerUid:this.layerUid,graphicUid:e=>this._instanceIndexToFeatureId.get(e)??-1,notifyGraphicGeometryChanged:e=>1,notifyGraphicVisibilityChanged:e=>1},o=new t({symbol:e,optionalFields:this._optionalFields,metadata:n,shaderTransformation:null},this.scheduler);return o.slicePlaneEnabled=!1,this._addDisposeResource((()=>{s.removeRenderPlugin(o),o.destroy()})),await s.addRenderPlugin(o,r),o}};function c(e,r){const s=r.levels.map((r=>{const s=r.components.map((r=>{const s=e(r.materialId);if(!u(s))throw new Error("LodRenderer only supports DefaultMaterial");const n=new o(s,r.renderGeometryBuffer.data,r.renderGeometryBuffer.elementCount,r.boundingInfo);return new i(n)}));return new a(s,r.minScreenSpaceRadius)}));return new d(s)}function u(e){return null!=e&&"materialType"in e&&"default"===e.materialType}l=e([s("esri.views.3d.layers.graphics.pipeline.rendering.LodRenderer")],l);export{l as LodRenderer,u as isDefaultMaterial};
5
+ import{_ as e}from"../../../../../../chunks/tslib.es6.js";import has from"../../../../../../core/has.js";import{throwIfAborted as r}from"../../../../../../core/promiseUtils.js";import"../../../../../../core/Logger.js";import"../../../../../../core/RandomLCG.js";import"../../../../../../core/Error.js";import{subclass as s}from"../../../../../../core/accessorSupport/decorators/subclass.js";import{VertexAttribute as n}from"../../../../webgl-engine/lib/VertexAttribute.js";import{LodRenderer as t}from"../../../../webgl-engine/lib/lodRendering/LodRenderer.js";import{LodComponentRenderGeometry as o,LodComponentResources as i,LodLevelResources as a,LodResources as d}from"../../../../webgl-engine/lib/lodRendering/LodResources.js";let l=class{constructor(e){this._optionalFields=new Array,this._instanceGroupToIndices=new Map,this._instanceIndexToFeatureId=new Map,this._disposeResourceHandles=new Array,this._lodRendererResources=null,this._numFeatures=0,this.layerViewUid=e.layerViewUid,this.view=e.view,this.sharedResources=this.view.sharedSymbolResources,this.scheduler=this.view.resourceController.scheduler}get numFeatures(){return this._numFeatures}get usedMemory(){const e=this._lodRendererResources?.lodRenderer,r=e?.symbol;return(r?.computeUsedMemory()??0)+16*this._instanceIndexToFeatureId.size}destroy(){this._disposeResourceHandles.forEach((e=>e()))}async doLoad(e,s,t){has("enable-feature:objectAndLayerId-rendering")&&this._optionalFields.push(n.OLIDCOLOR);const o=c((e=>s(e)),e),i=this.view.stage,a=o.getMaterials();i.addMany(a),this._addDisposeResource((()=>i.removeMany(a)));const d=o.getTextures();i.addMany(d),this._addDisposeResource((()=>{d.forEach((e=>e.unload())),i.removeMany(d)})),await Promise.all(d.map((e=>this.view.stage.schedule((()=>e.load(i.renderView.renderingContext)),t)))),r(t);const l=await this._createLodRenderer(o,t);this._lodRendererResources={lodRenderer:l,materials:a,textures:d}}addInstances(e,r){const s=this._lodRendererResources;if(null==s)return;const n=s.lodRenderer;if(null==n)return;const{featureIds:t,localTransforms:o,globalTransforms:i,visibility:a}=r,d=new Array,l=n.instanceData,c=t.length,u=this._instanceIndexToFeatureId;for(let h=0;h<c;++h){const e=t[h],r=l.addInstance(),s=l.view,n=16*h;s.localTransform.copyFromTypedBuffer(r,o,n),s.globalTransform.copyFromTypedBuffer(r,i,n),l.updateModelTransform(r),l.setVisible(r,Boolean(a[h])),d.push(r),u.set(r,e)}this._instanceGroupToIndices.set(e,d),this._numFeatures+=c}removeInstances(e){const r=this._instanceGroupToIndices.get(e);if(null==r)return;const s=this._lodRendererResources;if(null==s)return;const n=s.lodRenderer.instanceData,t=this._instanceIndexToFeatureId;for(const o of r)n.removeInstance(o),t.delete(o);this._numFeatures-=r.length,this._instanceGroupToIndices.delete(e)}updateVisibility(e,r){const s=this._instanceGroupToIndices.get(e);if(null==s)return;const n=this._lodRendererResources;if(null==n)return;const t=s.length;if(t!==r.length)throw new Error("Unexpected mismatch instance count and visibility flag buffer length.");const o=n.lodRenderer.instanceData;for(let i=0;i<t;++i)o.setVisible(s[i],Boolean(r[i]))}updateGlobalTransforms(e,r){const s=this._instanceGroupToIndices.get(e);if(null==s)return;const n=this._lodRendererResources;if(null==n)return;const t=s.length;if(16*t!==r.length)throw new Error("Unexpected mismatch instance count and visibility flag buffer length.");const o=n.lodRenderer.instanceData,i=o.view;for(let a=0;a<t;++a){const e=s[a],n=16*a;i.globalTransform.copyFromTypedBuffer(e,r,n),o.updateModelTransform(e)}}_addDisposeResource(e){this._disposeResourceHandles.push(e)}async _createLodRenderer(e,r){const s=this.view.stage,n={layerViewUid:this.layerViewUid,graphicUid:e=>this._instanceIndexToFeatureId.get(e)??-1,notifyGraphicGeometryChanged:e=>1,notifyGraphicVisibilityChanged:e=>1},o=new t({symbol:e,optionalFields:this._optionalFields,metadata:n,shaderTransformation:null},this.scheduler);return o.slicePlaneEnabled=!1,this._addDisposeResource((()=>{s.removeRenderPlugin(o),o.destroy()})),await s.addRenderPlugin(o,r),o}};function c(e,r){const s=r.levels.map((r=>{const s=r.components.map((r=>{const s=e(r.materialId);if(!u(s))throw new Error("LodRenderer only supports DefaultMaterial");const n=new o(s,r.renderGeometryBuffer.data,r.renderGeometryBuffer.elementCount,r.boundingInfo);return new i(n)}));return new a(s,r.minScreenSpaceRadius)}));return new d(s)}function u(e){return null!=e&&"materialType"in e&&"default"===e.materialType}l=e([s("esri.views.3d.layers.graphics.pipeline.rendering.LodRenderer")],l);export{l as LodRenderer,u as isDefaultMaterial};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectPointToVector as r}from"../../../../geometry/projection/projectPointToVector.js";import{containsPoint as t}from"../../../../geometry/support/aaBoundingBox.js";import{getPointOnPath as n,getPathLength as o}from"../../../../geometry/support/coordsUtils.js";import{makeDehydratedPoint as i}from"../../../../layers/graphics/dehydratedPoint.js";import{applyElevationAlignmentForHUD as l}from"./elevationAlignmentUtils.js";import{computeCentroid as s}from"./graphicUtils.js";import{Object3D as c}from"../../webgl-engine/lib/Object3D.js";function a(e,r,t,n,o){if(u(e,r))return null;t.localOrigin=d(e,r);const i=new c({geometries:[t],castShadow:!1,layerUid:e.layer.uid,graphicUid:o,usesVerticalDistanceToGround:!0});return{object:i,sampledElevation:l(i,r,e.elevationProvider,e.renderCoordsHelper,n)}}function p(e,r,t,n){if(u(r,t))return null;return l(e,t,r.elevationProvider,r.renderCoordsHelper,n)}function u(e,n){const o=e.clippingExtent;return!!o&&(r(n,g,e.elevationProvider.spatialReference),!t(o,g))}function m(e,t,n){const o=e.elevationContext,l=n.spatialReference;r(t,g,l),o.centerPointInElevationSR=i(g[0],g[1],t.hasZ?g[2]:0,null!=l?l:null)}function f(e){switch(e.type){case"point":return e;case"polygon":case"extent":return s(e);case"polyline":{const r=e.paths[0];if(!r||0===r.length)return null;const t=n(r,o(r)/2);return i(t[0],t[1],t[2],e.spatialReference)}case"mesh":return e.extent.center}return null}function d(e,t){return r(t,g,e.renderCoordsHelper.spatialReference),e.localOriginFactory.getOrigin(g)}const g=e();export{a as createStageObject,m as extendPointGraphicElevationContext,d as getLocalOriginForPoint,f as placePointOnGeometry,p as updateStageObjectGeometry};
5
+ import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectPointToVector as r}from"../../../../geometry/projection/projectPointToVector.js";import{containsPoint as t}from"../../../../geometry/support/aaBoundingBox.js";import{getPointOnPath as n,getPathLength as o}from"../../../../geometry/support/coordsUtils.js";import{makeDehydratedPoint as i}from"../../../../layers/graphics/dehydratedPoint.js";import{applyElevationAlignmentForHUD as l}from"./elevationAlignmentUtils.js";import{computeCentroid as s}from"./graphicUtils.js";import{Object3D as c}from"../../webgl-engine/lib/Object3D.js";function a(e,r,t,n,o){if(u(e,r))return null;t.localOrigin=d(e,r);const i=new c({geometries:[t],castShadow:!1,layerViewUid:e.layerViewUid,graphicUid:o,usesVerticalDistanceToGround:!0});return{object:i,sampledElevation:l(i,r,e.elevationProvider,e.renderCoordsHelper,n)}}function p(e,r,t,n){if(u(r,t))return null;return l(e,t,r.elevationProvider,r.renderCoordsHelper,n)}function u(e,n){const o=e.clippingExtent;return!!o&&(r(n,g,e.elevationProvider.spatialReference),!t(o,g))}function m(e,t,n){const o=e.elevationContext,l=n.spatialReference;r(t,g,l),o.centerPointInElevationSR=i(g[0],g[1],t.hasZ?g[2]:0,null!=l?l:null)}function f(e){switch(e.type){case"point":return e;case"polygon":case"extent":return s(e);case"polyline":{const r=e.paths[0];if(!r||0===r.length)return null;const t=n(r,o(r)/2);return i(t[0],t[1],t[2],e.spatialReference)}case"mesh":return e.extent.center}return null}function d(e,t){return r(t,g,e.renderCoordsHelper.spatialReference),e.localOriginFactory.getOrigin(g)}const g=e();export{a as createStageObject,m as extendPointGraphicElevationContext,d as getLocalOriginForPoint,f as placePointOnGeometry,p as updateStageObjectGeometry};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{e as t}from"../../../../chunks/earcut.js";import e from"../../../../geometry/Extent.js";import r from"../../../../geometry/Polygon.js";import{Axis as i}from"../../../../geometry/support/Axis.js";import{getZeroIndexArray as o}from"../../../../geometry/support/Indices.js";import{leastSignificantAxis as n}from"../../../../geometry/support/polygonUtils.js";import{Attribute as a}from"../../webgl-engine/lib/Attribute.js";import{ContentObjectType as s}from"../../webgl-engine/lib/ContentObjectType.js";import{Geometry as u}from"../../webgl-engine/lib/Geometry.js";import{VertexAttribute as c}from"../../webgl-engine/lib/VertexAttribute.js";function p(e,r,o){const a=(r.length>0?r[0]:e.length/3)-1,s=n(e,a,o);if(s!==i.Z){e=e.slice();for(let t=0;t<e.length;t+=3)e[t+s]=e[t+2]}return t(e,r,3)}function l(t){const e=[[c.POSITION,new a(t.attributeData.position,t.indices,3,!0)]],r=o(t.indices.length);return null!=t.attributeData.colorFeature?e.push([c.COLORFEATUREATTRIBUTE,new a([t.attributeData.colorFeature],r,1,!0)]):t.attributeData.color&&e.push([c.COLOR,new a(t.attributeData.color,r,4,!0)]),t.attributeData.uvMapSpace&&e.push([c.UVMAPSPACE,new a(t.attributeData.uvMapSpace,t.indices,4,!0)]),t.attributeData.boundingRect&&e.push([c.BOUNDINGRECT,new a(t.attributeData.boundingRect,t.indices,9,!0)]),new u(t.material,e,t.mapPositions,s.Mesh,t.attributeData.objectAndLayerIdColor)}function m(t,e=null){const r=[[c.POSITION,new a(t.attributeData.position,t.indices,3,!0)],[c.UV0,new a(t.attributeData.uv0,t.indices,2,!0)]];return new u(t.material,r,t.mapPositions,s.Mesh,e)}function b(t){switch(t.type){case"extent":if(t instanceof e)return r.fromExtent(t);break;case"polygon":return t}return null}class g{constructor(t,e,r){this.renderData=t,this.layerUid=e,this.graphicUid=r,this.outGeometries=new Array}}export{g as PolygonCreationDataBase,l as createColorGeometry,p as createIndices3D,m as createWaterGeometry,b as geometryAsPolygon};
5
+ import{e as t}from"../../../../chunks/earcut.js";import e from"../../../../geometry/Extent.js";import r from"../../../../geometry/Polygon.js";import{Axis as i}from"../../../../geometry/support/Axis.js";import{getZeroIndexArray as o}from"../../../../geometry/support/Indices.js";import{leastSignificantAxis as n}from"../../../../geometry/support/polygonUtils.js";import{Attribute as a}from"../../webgl-engine/lib/Attribute.js";import{ContentObjectType as s}from"../../webgl-engine/lib/ContentObjectType.js";import{Geometry as u}from"../../webgl-engine/lib/Geometry.js";import{VertexAttribute as c}from"../../webgl-engine/lib/VertexAttribute.js";function p(e,r,o){const a=(r.length>0?r[0]:e.length/3)-1,s=n(e,a,o);if(s!==i.Z){e=e.slice();for(let t=0;t<e.length;t+=3)e[t+s]=e[t+2]}return t(e,r,3)}function l(t){const e=[[c.POSITION,new a(t.attributeData.position,t.indices,3,!0)]],r=o(t.indices.length);return null!=t.attributeData.colorFeature?e.push([c.COLORFEATUREATTRIBUTE,new a([t.attributeData.colorFeature],r,1,!0)]):t.attributeData.color&&e.push([c.COLOR,new a(t.attributeData.color,r,4,!0)]),t.attributeData.uvMapSpace&&e.push([c.UVMAPSPACE,new a(t.attributeData.uvMapSpace,t.indices,4,!0)]),t.attributeData.boundingRect&&e.push([c.BOUNDINGRECT,new a(t.attributeData.boundingRect,t.indices,9,!0)]),new u(t.material,e,t.mapPositions,s.Mesh,t.attributeData.objectAndLayerIdColor)}function m(t,e=null){const r=[[c.POSITION,new a(t.attributeData.position,t.indices,3,!0)],[c.UV0,new a(t.attributeData.uv0,t.indices,2,!0)]];return new u(t.material,r,t.mapPositions,s.Mesh,e)}function b(t){switch(t.type){case"extent":if(t instanceof e)return r.fromExtent(t);break;case"polygon":return t}return null}class g{constructor(t,e,r){this.renderData=t,this.layerViewUid=e,this.graphicUid=r,this.outGeometries=new Array}}export{g as PolygonCreationDataBase,l as createColorGeometry,p as createIndices3D,m as createWaterGeometry,b as geometryAsPolygon};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{ViewingMode as e}from"../../../ViewingMode.js";import{isValidMbs as t}from"./I3SUtil.js";import{I3sTarget as i}from"./Intersector.js";import{newIntersectorResult as r}from"../../webgl-engine/lib/Intersector.js";import{IntersectorType as s,StoreResults as n}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{MeshIntersectionOptions as l}from"../../webgl-engine/lib/RayIntersections.js";import{getVerticalOffsetI3S as o}from"../../webgl-engine/lib/verticalOffsetUtils.js";class c{constructor(e){this.type=s.I3S,this._needVerticalOffset=!1,this.layerUid=e.layerUid,this.sublayerUid=e.sublayerUid,this._collection=e.collection,this._traverseNodeHierarchy=e.traverseNodeHierarchy,this.slicePlaneEnabled=e.slicePlaneEnabled,this.isGround=e.isGround}updateElevationAlignState(t,i){this._needVerticalOffset=t&&i===e.Global}intersect(e,s,c,d,u,b=!1){const f=e.results,m=e.options.store===n.ALL,h=e.ray.direction,y=e.tolerance;let p=e=>e,R=e=>e;const g=o(e.verticalOffset??(this._needVerticalOffset?0:null));null!=e.verticalOffset&&null!=g&&(p=e=>g.applyToMbs(e),R=e=>g.applyToObb(e));const I=new l(b,e.options.normalRequired),v=(n,l)=>{if(0===n.childrenLoaded)return!1;const o=n.serviceObbInRenderSR?.isValid?n.serviceObbInRenderSR:null;return!(o&&!R(o).intersectRay(c,h,y))&&(!l||!o&&t(n.serviceMbsInRenderSR)&&!a(p(n.serviceMbsInRenderSR),c,h,y)||null!=n.geometryObbInRenderSR&&!R(n.geometryObbInRenderSR).intersectRay(c,h,y)||this._collection.intersect(l,c,d,y,g,I,((t,l,o,a)=>{if(l<0||null!=s&&!s(c,d,l))return;const u=e=>{const r=new i(this.layerUid,this.sublayerUid,n.index,t,a);e.set(this.type,r,l,o)};if(this.isGround&&(null==f.ground.dist||l<f.ground.dist)&&u(f.ground),!e.options.isFiltered&&((null==f.min.dist||l<f.min.dist)&&u(f.min),(null==f.max.dist||l>f.max.dist)&&u(f.max),m)){const t=r(e.ray);u(t),e.results.all.push(t)}})),!0)};this._traverseNodeHierarchy(v)}}function a(e,t,i,r=0){const s=e[3]+r,n=t[0]-e[0],l=t[1]-e[1],o=t[2]-e[2],c=i[0],a=i[1],d=i[2],u=c*n+a*l+d*o;return u*u-(c*c+a*a+d*d)*(n*n+l*l+o*o-s*s)>=0}export{c as I3SIntersectionHandler};
5
+ import{ViewingMode as e}from"../../../ViewingMode.js";import{isValidMbs as t}from"./I3SUtil.js";import{I3sTarget as i}from"./Intersector.js";import{newIntersectorResult as r}from"../../webgl-engine/lib/Intersector.js";import{IntersectorType as s,StoreResults as n}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{MeshIntersectionOptions as l}from"../../webgl-engine/lib/RayIntersections.js";import{getVerticalOffsetI3S as o}from"../../webgl-engine/lib/verticalOffsetUtils.js";class c{constructor(e){this.type=s.I3S,this._needVerticalOffset=!1,this.layerViewUid=e.layerViewUid,this.sublayerId=e.sublayerId,this._collection=e.collection,this._traverseNodeHierarchy=e.traverseNodeHierarchy,this.slicePlaneEnabled=e.slicePlaneEnabled,this.isGround=e.isGround}updateElevationAlignState(t,i){this._needVerticalOffset=t&&i===e.Global}intersect(e,s,c,d,u,b=!1){const f=e.results,m=e.options.store===n.ALL,h=e.ray.direction,y=e.tolerance;let p=e=>e,I=e=>e;const R=o(e.verticalOffset??(this._needVerticalOffset?0:null));null!=e.verticalOffset&&null!=R&&(p=e=>R.applyToMbs(e),I=e=>R.applyToObb(e));const g=new l(b,e.options.normalRequired),v=(n,l)=>{if(0===n.childrenLoaded)return!1;const o=n.serviceObbInRenderSR?.isValid?n.serviceObbInRenderSR:null;return!(o&&!I(o).intersectRay(c,h,y))&&(!l||!o&&t(n.serviceMbsInRenderSR)&&!a(p(n.serviceMbsInRenderSR),c,h,y)||null!=n.geometryObbInRenderSR&&!I(n.geometryObbInRenderSR).intersectRay(c,h,y)||this._collection.intersect(l,c,d,y,R,g,((t,l,o,a)=>{if(l<0||null!=s&&!s(c,d,l))return;const u=e=>{const r=new i(this.layerViewUid,this.sublayerId,n.index,t,a);e.set(this.type,r,l,o)};if(this.isGround&&(null==f.ground.dist||l<f.ground.dist)&&u(f.ground),!e.options.isFiltered&&((null==f.min.dist||l<f.min.dist)&&u(f.min),(null==f.max.dist||l>f.max.dist)&&u(f.max),m)){const t=r(e.ray);u(t),e.results.all.push(t)}})),!0)};this._traverseNodeHierarchy(v)}}function a(e,t,i,r=0){const s=e[3]+r,n=t[0]-e[0],l=t[1]-e[1],o=t[2]-e[2],c=i[0],a=i[1],d=i[2],u=c*n+a*l+d*o;return u*u-(c*c+a*a+d*d)*(n*n+l*l+o*o-s*s)>=0}export{c as I3SIntersectionHandler};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{IntersectorType as t}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{Graphic3DTarget as e,LayerTarget as r}from"../../webgl-engine/lib/IntersectorTarget.js";import{isValidIntersectorResult as n}from"../../webgl-engine/lib/intersectorUtils.js";class s extends e{constructor(t,e,r,n){super(e,r),this.point=t,this.createGraphic=n}}function i(e){return n(e)&&e.intersector===t.PCL&&!!e.target}class o extends r{constructor(t,e,r,n,s){super(t),this.layerUid=t,this.sublayerUid=e,this.nodeIndex=r,this.componentIndex=n,this.triangleNr=s}}class c extends e{constructor(t,e,r){super(e,null),this.point=t,this.createVoxelGraphic=r}}class l extends e{constructor(t,e){super(t,null),this.createTiles3DGraphic=e}}function a(e){return n(e)&&e.intersector===t.I3S&&!!e.target}function u(e){return n(e)&&e.intersector===t.VOXEL&&!!e.target}function p(e){return n(e)&&e.intersector===t.TILES3D&&!!e.target}export{o as I3sTarget,s as PclTarget,l as Tiles3DTarget,c as VoxelTarget,a as isI3sIntersectorResult,i as isPclIntersectorResult,p as isTiles3DIntersectorResult,u as isVoxelIntersectorResult};
5
+ import{IntersectorType as t}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{Graphic3DTarget as e,LayerTarget as r}from"../../webgl-engine/lib/IntersectorTarget.js";import{isValidIntersectorResult as n}from"../../webgl-engine/lib/intersectorUtils.js";class s extends e{constructor(t,e,r,n){super(e,r),this.point=t,this.createGraphic=n}}function i(e){return n(e)&&e.intersector===t.PCL&&!!e.target}class o extends r{constructor(t,e,r,n,s){super(t),this.layerViewUid=t,this.sublayerId=e,this.nodeIndex=r,this.componentIndex=n,this.triangleNr=s}}class c extends e{constructor(t,e,r){super(e,null),this.point=t,this.createVoxelGraphic=r}}class l extends e{constructor(t,e){super(t,null),this.createTiles3DGraphic=e}}function a(e){return n(e)&&e.intersector===t.I3S&&!!e.target}function u(e){return n(e)&&e.intersector===t.VOXEL&&!!e.target}function p(e){return n(e)&&e.intersector===t.TILES3D&&!!e.target}export{o as I3sTarget,s as PclTarget,l as Tiles3DTarget,c as VoxelTarget,a as isI3sIntersectorResult,i as isPclIntersectorResult,p as isTiles3DIntersectorResult,u as isVoxelIntersectorResult};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import{disposeMaybe as t}from"../../../../core/maybe.js";import s from"../../../../core/PooledArray.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{d as n,l as o,h as a,v as l,f as h,k as c}from"../../../../chunks/vec32.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as u}from"../../../../chunks/vec42.js";import{create as m,offset as p,contains as g,containsPoint as _,set as f,positiveInfinity as P,equals as b}from"../../../../geometry/support/aaBoundingBox.js";import{create as x}from"../../../../geometry/support/plane.js";import{fromPoints as S}from"../../../../geometry/support/ray.js";import{PclTarget as R}from"./Intersector.js";import{PointCloudHighlights as w}from"./PointCloudHighlights.js";import{isDepth as z,ShaderOutput as A,isColorOrColorEmission as j}from"../../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SyncRenderPlugin as y}from"../../webgl-engine/effects/RenderPlugin.js";import{Default3D as I}from"../../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{newIntersectorResult as v}from"../../webgl-engine/lib/Intersector.js";import{IntersectorType as E,StoreResults as L}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{RenderSlot as O}from"../../webgl-engine/lib/RenderSlot.js";import{VertexArrayObject as q}from"../../webgl-engine/lib/VertexArrayObject.js";import{VertexAttribute as T}from"../../webgl-engine/lib/VertexAttribute.js";import{P as M,g as N}from"../../../../chunks/PointRenderer.glsl.js";import{PointRendererTechnique as F}from"../../webgl-engine/shaders/PointRendererTechnique.js";import{PointRendererTechniqueConfiguration as H}from"../../webgl-engine/shaders/PointRendererTechniqueConfiguration.js";import{BufferObject as U}from"../../../webgl/BufferObject.js";import{DataType as B,PrimitiveType as C,Usage as W}from"../../../webgl/enums.js";import{VertexElementDescriptor as D}from"../../../webgl/VertexElementDescriptor.js";const V=new Map([["positions",[new D(T.POSITION,3,B.FLOAT,0,12)]],["colors",[new D(T.COLOR,3,B.UNSIGNED_BYTE,0,3,!0)]]]);let k=class extends y{constructor(e){super(e),this.type=E.PCL,this.isGround=!1,this._passParameters=new M,this._highlights=new w({forEachNode:e=>this.forEachNode(e),addHighlight:(e,t,s)=>this._addHighlight(e,t,s),removeHighlight:(e,t)=>this._removeHighlight(e,t)}),this.produces=new Map([[O.OPAQUE_MATERIAL,e=>!(z(e)||e===A.Highlight&&this._highlights.empty)],[O.OPAQUE_MATERIAL_WITHOUT_NORMALS,e=>z(e)]]),this.layerUid="",this._slicePlaneEnabled=!1,this._configuration=new H,this._nodes=new s}hasHighlight(e){return this._highlights.has(e)}initializeRenderContext(e){this._context=e,e.requestRender()}uninitializeRenderContext(){}intersect(e,t,s,i){const r=d(),f=d(),P=d(),b=d(),w=x(),z=e.camera.perScreenPixelRatio/2,A=e.camera.near;n(f,i,s);const j=1/o(f);a(f,f,j),l(P,f),u(w,f[0],f[1],f[2],-h(f,s));const y=new J,I=new J,E=new Array,O=m(),q=m(this._passParameters.clipBox);p(q,-s[0],-s[1],-s[2],q),this._nodes.forAll((o=>{const a=o.splatSize*this._passParameters.scaleFactor;let l=o.obb.minimumDistancePlane(w),d=o.obb.maximumDistancePlane(w);l-=Q(a,l+A,this._passParameters,z,o.isLeaf),d-=Q(a,d+A,this._passParameters,z,o.isLeaf);const u=d<0,m=null!=y.dist&&null!=I.dist&&y.dist<l*j&&I.dist>d*j;if(u||m)return;const x=G(a,d+A,this._passParameters,z,o.isLeaf);if(!o.obb.intersectRay(s,f,x))return;const S=x*x;o.obb.toAaBoundingBox(O),p(O,-s[0],-s[1],-s[2],O);const R=!g(q,O);n(b,o.origin,s);const v=o.coordinates.length/3;for(let n=0;n<v;n++){if(r[0]=b[0]+o.coordinates[3*n],r[1]=b[1]+o.coordinates[3*n+1],r[2]=b[2]+o.coordinates[3*n+2],R&&!_(q,r))continue;const l=h(r,f),d=c(r)-l*l;if(d>S)continue;let u=l+A;const m=Q(a,u,this._passParameters,z,o.isLeaf);if(l-m<0)continue;u-=m;const p=G(a,u,this._passParameters,z,o.isLeaf);if(d>p*p)continue;const g=(l-m)*j,x=e=>(e.point=Y(o,n,e.point),e.dist=g,e.normal=P,e.node=o,e.pointId=n,e.layerUid=this.layerUid,e);if((null==y.dist||g<y.dist)&&(null==t||t(s,i,g))&&x(y),e.options.store!==L.MIN&&(null==I.dist||g>I.dist)&&(null==t||t(s,i,g))&&x(I),e.options.store===L.ALL&&(null==t||t(s,i,g))){const e=new J;E.push(x(e))}}}));const T=e=>{const{layerUid:t,node:s,pointId:i}=e;return new R(e.point,t,i,(()=>this.createGraphic(s,i,e.point)))},M=(e,t)=>{const s=T(t);e.set(this.type,s,t.dist,t.normal)};if(K(y)){const t=e.results.min;(null==t.dist||y.dist<t.dist)&&M(t,y)}if(K(I)&&e.options.store!==L.MIN){const t=e.results.max;(null==t.dist||I.dist>t.dist)&&M(t,I)}if(e.options.store===L.ALL){const t=S(s,i);for(const s of E){const i=v(t);M(i,s),e.results.all.push(i)}}}acquireTechniques(e){return 0!==this._nodes.length&&(j(e.output)||z(e.output)&&e.bind.slot===O.OPAQUE_MATERIAL_WITHOUT_NORMALS||e.output===A.Highlight)?(this._nodes.forAll((t=>this._initNode(e,t))),this._configuration.drawScreenSize=this._passParameters.drawScreenSpace,this._configuration.useFixedSizes=this._passParameters.useFixedSizes,this._configuration.hasSlicePlane=this._slicePlaneEnabled,this._configuration.hasOccludees=e.bind.hasOccludees,this._configuration.clippingEnabled=this._clippingEnabled,this._configuration.output=e.output,this._context.techniques.get(F,this._configuration)):null}render(e,t){const{rctx:s,bind:i,output:r}=e,n=s.bindTechnique(t,i,this._passParameters),o=r===A.Highlight,a=i.highlight?.name??null;o&&!a||this._nodes.forAll((t=>{0===t.coordinates.length||o&&!t.highlightMap.has(a)||(n.bindDraw(i,this._passParameters,t),s.bindVAO(t.vao),o?this._renderHighlightFragments(e,t):s.drawArrays(C.POINTS,0,t.coordinates.length/3))}))}_renderHighlightFragments(e,t){const{highlightMap:s}=t,{rctx:i,bind:r}=e,{highlight:n}=r;if(!n)return;const o=n.name,a=s.get(o);if(!a||0===a.length)return;const{highlightOrderMap:l,highlightLevel:h}=r;if(null==h)return;for(const g of s.keys())if(g!==o){const e=l.get(g);if(void 0!==e&&e>h)return}let c=0,d=a[0].componentIndex,u=d+1;const m=()=>{for(;c<a.length&&a[c].id.highlightName!==o;)d=a[c].componentIndex,++c;u=d+1};m();const p=(e,t)=>{const s=t-e;s>0&&i.drawArrays(C.POINTS,e,s)};for(;c<a.length;){const e=a[c];if(e.id.highlightName!==o){p(d,u),++c,m();continue}const t=e.componentIndex;t!==u&&(p(d,u),d=t),u=t+1,++c}p(d,u)}set useFixedSizes(e){this._passParameters.useFixedSizes!==e&&(this._passParameters.useFixedSizes=e,this._requestRender())}get useFixedSizes(){return this._passParameters.useFixedSizes}set scaleFactor(e){this._passParameters.scaleFactor!==e&&(this._passParameters.scaleFactor=e,this._requestRender())}get scaleFactor(){return this._passParameters.scaleFactor}set minSizePx(e){this._passParameters.minSizePx!==e&&(this._passParameters.minSizePx=e,this._requestRender())}get minSizePx(){return this._passParameters.minSizePx}set useRealWorldSymbolSizes(e){this._passParameters.useRealWorldSymbolSizes!==e&&(this._passParameters.useRealWorldSymbolSizes=e,this._requestRender())}get useRealWorldSymbolSizes(){return this._passParameters.useRealWorldSymbolSizes}set size(e){this._passParameters.size!==e&&(this._passParameters.size=e,this._requestRender())}get size(){return this._passParameters.size}set sizePx(e){this._passParameters.sizePx!==e&&(this._passParameters.sizePx=e,this._requestRender())}get sizePx(){return this._passParameters.sizePx}set clippingBox(e){f(this._passParameters.clipBox,e||P)}get _clippingEnabled(){return!b(this._passParameters.clipBox,P,((e,t)=>e===t))}get slicePlaneEnabled(){return this._slicePlaneEnabled}set slicePlaneEnabled(e){this._slicePlaneEnabled!==e&&(this._slicePlaneEnabled=e,this._requestRender())}addNode(e){this._nodes.push(e),this._highlights.nodeAdded(e),this._requestRender()}removeNode(e){let s=null;return this._nodes.filterInPlace((i=>i.id!==e||(s=i,i.vao=t(i.vao),this._highlights.nodeRemoved(i),!1))),this._requestRender(),s}forEachNode(e){this._nodes.forAll(e)}removeAll(){this._nodes.forAll((e=>e.vao=t(e.vao))),this._highlights.removeAll(),this._nodes.clear(),this._requestRender()}highlight(e,t){return this._highlights.add(e,t)}_addHighlight(e,t,s){e.addHighlight(t,s),this._requestRender()}_removeHighlight(e,t){e.removeHighlight(t),this._requestRender()}_initNode(e,t){t.vao??=new q(e.rctx,I,V,new Map([["positions",U.createVertex(e.rctx,W.STATIC_DRAW,t.coordinates)],["colors",U.createVertex(e.rctx,W.STATIC_DRAW,t.rgb)]]))}_requestRender(){this._context&&this._context.requestRender()}};function G(e,t,s,i,r){if(s.drawScreenSpace)return s.fixedSize*t*i;const n=N(r)*t*i;return s.useFixedSizes?Math.min(s.fixedSize/2,n):s.screenMinSize>0?Math.min(Math.max(s.screenMinSize*t*i,e/2),n):Math.min(e/2,n)}function Q(e,t,s,i,r){return s.drawScreenSpace?0:G(e,t,s,i,r)}function Y(e,t,s){return null==s&&(s=d()),s[0]=e.origin[0]+e.coordinates[3*t],s[1]=e.origin[1]+e.coordinates[3*t+1],s[2]=e.origin[2]+e.coordinates[3*t+2],s}e([i({constructOnly:!0})],k.prototype,"createGraphic",void 0),k=e([r("esri.views.3d.layers.i3s.PointCloudRenderer")],k);class J{constructor(){this.node=null,this.pointId=null,this.point=null,this.dist=null,this.normal=null,this.layerUid=""}}function K(e){return null!=e.dist&&null!=e.point&&null!=e.pointId&&null!=e.node}export{k as PointCloudRenderer};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import{disposeMaybe as t}from"../../../../core/maybe.js";import s from"../../../../core/PooledArray.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{d as n,l as o,h as a,v as l,f as h,k as c}from"../../../../chunks/vec32.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as u}from"../../../../chunks/vec42.js";import{create as m,offset as p,contains as g,containsPoint as _,set as f,positiveInfinity as P,equals as b}from"../../../../geometry/support/aaBoundingBox.js";import{create as x}from"../../../../geometry/support/plane.js";import{fromPoints as S}from"../../../../geometry/support/ray.js";import{PclTarget as w}from"./Intersector.js";import{PointCloudHighlights as R}from"./PointCloudHighlights.js";import{isDepth as z,ShaderOutput as A,isColorOrColorEmission as j}from"../../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SyncRenderPlugin as y}from"../../webgl-engine/effects/RenderPlugin.js";import{Default3D as I}from"../../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{newIntersectorResult as v}from"../../webgl-engine/lib/Intersector.js";import{IntersectorType as E,StoreResults as L}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{RenderSlot as O}from"../../webgl-engine/lib/RenderSlot.js";import{VertexArrayObject as q}from"../../webgl-engine/lib/VertexArrayObject.js";import{VertexAttribute as T}from"../../webgl-engine/lib/VertexAttribute.js";import{P as M,g as N}from"../../../../chunks/PointRenderer.glsl.js";import{PointRendererTechnique as F}from"../../webgl-engine/shaders/PointRendererTechnique.js";import{PointRendererTechniqueConfiguration as H}from"../../webgl-engine/shaders/PointRendererTechniqueConfiguration.js";import{BufferObject as V}from"../../../webgl/BufferObject.js";import{DataType as U,PrimitiveType as B,Usage as C}from"../../../webgl/enums.js";import{VertexElementDescriptor as W}from"../../../webgl/VertexElementDescriptor.js";const D=new Map([["positions",[new W(T.POSITION,3,U.FLOAT,0,12)]],["colors",[new W(T.COLOR,3,U.UNSIGNED_BYTE,0,3,!0)]]]);let k=class extends y{constructor(e){super(e),this.type=E.PCL,this.isGround=!1,this._passParameters=new M,this._highlights=new R({forEachNode:e=>this.forEachNode(e),addHighlight:(e,t,s)=>this._addHighlight(e,t,s),removeHighlight:(e,t)=>this._removeHighlight(e,t)}),this.produces=new Map([[O.OPAQUE_MATERIAL,e=>!(z(e)||e===A.Highlight&&this._highlights.empty)],[O.OPAQUE_MATERIAL_WITHOUT_NORMALS,e=>z(e)]]),this.layerViewUid="",this._slicePlaneEnabled=!1,this._configuration=new H,this._nodes=new s}hasHighlight(e){return this._highlights.has(e)}initializeRenderContext(e){this._context=e,e.requestRender()}uninitializeRenderContext(){}intersect(e,t,s,i){const r=d(),f=d(),P=d(),b=d(),R=x(),z=e.camera.perScreenPixelRatio/2,A=e.camera.near;n(f,i,s);const j=1/o(f);a(f,f,j),l(P,f),u(R,f[0],f[1],f[2],-h(f,s));const y=new J,I=new J,E=new Array,O=m(),q=m(this._passParameters.clipBox);p(q,-s[0],-s[1],-s[2],q),this._nodes.forAll((o=>{const a=o.splatSize*this._passParameters.scaleFactor;let l=o.obb.minimumDistancePlane(R),d=o.obb.maximumDistancePlane(R);l-=Q(a,l+A,this._passParameters,z,o.isLeaf),d-=Q(a,d+A,this._passParameters,z,o.isLeaf);const u=d<0,m=null!=y.dist&&null!=I.dist&&y.dist<l*j&&I.dist>d*j;if(u||m)return;const x=G(a,d+A,this._passParameters,z,o.isLeaf);if(!o.obb.intersectRay(s,f,x))return;const S=x*x;o.obb.toAaBoundingBox(O),p(O,-s[0],-s[1],-s[2],O);const w=!g(q,O);n(b,o.origin,s);const v=o.coordinates.length/3;for(let n=0;n<v;n++){if(r[0]=b[0]+o.coordinates[3*n],r[1]=b[1]+o.coordinates[3*n+1],r[2]=b[2]+o.coordinates[3*n+2],w&&!_(q,r))continue;const l=h(r,f),d=c(r)-l*l;if(d>S)continue;let u=l+A;const m=Q(a,u,this._passParameters,z,o.isLeaf);if(l-m<0)continue;u-=m;const p=G(a,u,this._passParameters,z,o.isLeaf);if(d>p*p)continue;const g=(l-m)*j,x=e=>(e.point=Y(o,n,e.point),e.dist=g,e.normal=P,e.node=o,e.pointId=n,e.layerViewUid=this.layerViewUid,e);if((null==y.dist||g<y.dist)&&(null==t||t(s,i,g))&&x(y),e.options.store!==L.MIN&&(null==I.dist||g>I.dist)&&(null==t||t(s,i,g))&&x(I),e.options.store===L.ALL&&(null==t||t(s,i,g))){const e=new J;E.push(x(e))}}}));const T=e=>{const{layerViewUid:t,node:s,pointId:i}=e;return new w(e.point,t,i,(()=>this.createGraphic(s,i,e.point)))},M=(e,t)=>{const s=T(t);e.set(this.type,s,t.dist,t.normal)};if(K(y)){const t=e.results.min;(null==t.dist||y.dist<t.dist)&&M(t,y)}if(K(I)&&e.options.store!==L.MIN){const t=e.results.max;(null==t.dist||I.dist>t.dist)&&M(t,I)}if(e.options.store===L.ALL){const t=S(s,i);for(const s of E){const i=v(t);M(i,s),e.results.all.push(i)}}}acquireTechniques(e){return 0!==this._nodes.length&&(j(e.output)||z(e.output)&&e.bind.slot===O.OPAQUE_MATERIAL_WITHOUT_NORMALS||e.output===A.Highlight)?(this._nodes.forAll((t=>this._initNode(e,t))),this._configuration.drawScreenSize=this._passParameters.drawScreenSpace,this._configuration.useFixedSizes=this._passParameters.useFixedSizes,this._configuration.hasSlicePlane=this._slicePlaneEnabled,this._configuration.hasOccludees=e.bind.hasOccludees,this._configuration.clippingEnabled=this._clippingEnabled,this._configuration.output=e.output,this._context.techniques.get(F,this._configuration)):null}render(e,t){const{rctx:s,bind:i,output:r}=e,n=s.bindTechnique(t,i,this._passParameters),o=r===A.Highlight,a=i.highlight?.name??null;o&&!a||this._nodes.forAll((t=>{0===t.coordinates.length||o&&!t.highlightMap.has(a)||(n.bindDraw(i,this._passParameters,t),s.bindVAO(t.vao),o?this._renderHighlightFragments(e,t):s.drawArrays(B.POINTS,0,t.coordinates.length/3))}))}_renderHighlightFragments(e,t){const{highlightMap:s}=t,{rctx:i,bind:r}=e,{highlight:n}=r;if(!n)return;const o=n.name,a=s.get(o);if(!a||0===a.length)return;const{highlightOrderMap:l,highlightLevel:h}=r;if(null==h)return;for(const g of s.keys())if(g!==o){const e=l.get(g);if(void 0!==e&&e>h)return}let c=0,d=a[0].componentIndex,u=d+1;const m=()=>{for(;c<a.length&&a[c].id.highlightName!==o;)d=a[c].componentIndex,++c;u=d+1};m();const p=(e,t)=>{const s=t-e;s>0&&i.drawArrays(B.POINTS,e,s)};for(;c<a.length;){const e=a[c];if(e.id.highlightName!==o){p(d,u),++c,m();continue}const t=e.componentIndex;t!==u&&(p(d,u),d=t),u=t+1,++c}p(d,u)}set useFixedSizes(e){this._passParameters.useFixedSizes!==e&&(this._passParameters.useFixedSizes=e,this._requestRender())}get useFixedSizes(){return this._passParameters.useFixedSizes}set scaleFactor(e){this._passParameters.scaleFactor!==e&&(this._passParameters.scaleFactor=e,this._requestRender())}get scaleFactor(){return this._passParameters.scaleFactor}set minSizePx(e){this._passParameters.minSizePx!==e&&(this._passParameters.minSizePx=e,this._requestRender())}get minSizePx(){return this._passParameters.minSizePx}set useRealWorldSymbolSizes(e){this._passParameters.useRealWorldSymbolSizes!==e&&(this._passParameters.useRealWorldSymbolSizes=e,this._requestRender())}get useRealWorldSymbolSizes(){return this._passParameters.useRealWorldSymbolSizes}set size(e){this._passParameters.size!==e&&(this._passParameters.size=e,this._requestRender())}get size(){return this._passParameters.size}set sizePx(e){this._passParameters.sizePx!==e&&(this._passParameters.sizePx=e,this._requestRender())}get sizePx(){return this._passParameters.sizePx}set clippingBox(e){f(this._passParameters.clipBox,e||P)}get _clippingEnabled(){return!b(this._passParameters.clipBox,P,((e,t)=>e===t))}get slicePlaneEnabled(){return this._slicePlaneEnabled}set slicePlaneEnabled(e){this._slicePlaneEnabled!==e&&(this._slicePlaneEnabled=e,this._requestRender())}addNode(e){this._nodes.push(e),this._highlights.nodeAdded(e),this._requestRender()}removeNode(e){let s=null;return this._nodes.filterInPlace((i=>i.id!==e||(s=i,i.vao=t(i.vao),this._highlights.nodeRemoved(i),!1))),this._requestRender(),s}forEachNode(e){this._nodes.forAll(e)}removeAll(){this._nodes.forAll((e=>e.vao=t(e.vao))),this._highlights.removeAll(),this._nodes.clear(),this._requestRender()}highlight(e,t){return this._highlights.add(e,t)}_addHighlight(e,t,s){e.addHighlight(t,s),this._requestRender()}_removeHighlight(e,t){e.removeHighlight(t),this._requestRender()}_initNode(e,t){t.vao??=new q(e.rctx,I,D,new Map([["positions",V.createVertex(e.rctx,C.STATIC_DRAW,t.coordinates)],["colors",V.createVertex(e.rctx,C.STATIC_DRAW,t.rgb)]]))}_requestRender(){this._context&&this._context.requestRender()}};function G(e,t,s,i,r){if(s.drawScreenSpace)return s.fixedSize*t*i;const n=N(r)*t*i;return s.useFixedSizes?Math.min(s.fixedSize/2,n):s.screenMinSize>0?Math.min(Math.max(s.screenMinSize*t*i,e/2),n):Math.min(e/2,n)}function Q(e,t,s,i,r){return s.drawScreenSpace?0:G(e,t,s,i,r)}function Y(e,t,s){return null==s&&(s=d()),s[0]=e.origin[0]+e.coordinates[3*t],s[1]=e.origin[1]+e.coordinates[3*t+1],s[2]=e.origin[2]+e.coordinates[3*t+2],s}e([i({constructOnly:!0})],k.prototype,"createGraphic",void 0),k=e([r("esri.views.3d.layers.i3s.PointCloudRenderer")],k);class J{constructor(){this.node=null,this.pointId=null,this.point=null,this.dist=null,this.normal=null,this.layerViewUid=""}}function K(e){return null!=e.dist&&null!=e.point&&null!=e.pointId&&null!=e.node}export{k as PointCloudRenderer};