@arcgis/core 5.2.0-next.161 → 5.2.0-next.162

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 (96) hide show
  1. package/arcgisGlobal.d.ts +1 -0
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/{0a5a9885ee6f5b5f99f0.js → 167b057ad50e6aef54de.js} +1 -1
  4. package/assets/esri/core/workers/chunks/17c6d66b47aa690df0d4.js +1 -0
  5. package/assets/esri/core/workers/chunks/{8480fe6b4372dbbfa7cc.js → 46c5371c7a627537098c.js} +10 -10
  6. package/assets/esri/core/workers/chunks/{60737732ce495bbdd0fc.js → 5f4feca26102088ea565.js} +1 -1
  7. package/assets/esri/core/workers/chunks/6da7229433105a69eb3f.js +1 -0
  8. package/assets/esri/core/workers/chunks/849879c8aed16315194c.js +1 -0
  9. package/assets/esri/core/workers/chunks/{9401cc22373566e1171e.js → 8a7b02037151767542f1.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{4ed76fb5f6096a089f5b.js → 8e4a7027d171fb60e51e.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{32b351b047ce1eb58146.js → 9ce8b9b80da146a5bbf5.js} +1 -1
  12. package/assets/esri/core/workers/chunks/a6f969851d4278865cc5.js +1 -0
  13. package/assets/esri/core/workers/chunks/{28b74bc77f7c13080074.js → be97a629e2ae4d13ceb3.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{d33360c4f85203edafff.js → bf4d913e523eae2fda28.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{172cfeb5f415e4662432.js → d7429b58c90e015263ad.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{612104dff305ff062dfa.js → dfc81e66196c402f39b4.js} +2 -2
  17. package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +2 -5
  18. package/assets/esri/themes/dark/main.css +1 -1
  19. package/assets/esri/themes/light/main.css +1 -1
  20. package/assets/esri/themes/light/view.css +1 -1
  21. package/chunks/DefaultMaterial.glsl.js +1 -1
  22. package/chunks/RealisticTree.glsl.js +1 -1
  23. package/chunks/RibbonLine.glsl.js +70 -64
  24. package/config.js +1 -1
  25. package/kernel.js +1 -1
  26. package/layers/FeatureLayer.d.ts +7 -5
  27. package/layers/FeatureLayer.js +1 -1
  28. package/layers/MapImageLayer.d.ts +9 -3
  29. package/layers/MapNotesLayer.d.ts +2 -2
  30. package/layers/SubtypeGroupLayer.d.ts +1 -1
  31. package/layers/SubtypeGroupLayer.js +1 -1
  32. package/layers/graphics/sources/FeatureLayerSource.js +1 -1
  33. package/layers/graphics/sources/support/QueryTask.js +1 -1
  34. package/layers/knowledgeGraph/KnowledgeGraphSublayer.d.ts +16 -16
  35. package/layers/mixins/ArcGISMapService.js +1 -1
  36. package/layers/ogc/ogcFeatureUtils.js +1 -1
  37. package/layers/support/Sublayer.d.ts +29 -15
  38. package/layers/support/Sublayer.js +1 -1
  39. package/package.json +2 -2
  40. package/rest/layerSources/DynamicDataLayer.d.ts +4 -2
  41. package/rest/layerSources/DynamicDataLayer.js +1 -1
  42. package/rest/layerSources/DynamicMapLayer.d.ts +1 -1
  43. package/rest/layerSources/DynamicWorkspaceLayer.d.ts +45 -0
  44. package/rest/layerSources/DynamicWorkspaceLayer.js +2 -0
  45. package/rest/layerSources/typeUtils.js +2 -0
  46. package/rest/query/operations/queryRelatedRecords.js +1 -1
  47. package/rest/query/operations/queryUtils.js +1 -1
  48. package/rest/support/Query.js +1 -1
  49. package/rest/support/RelationshipQuery.js +1 -1
  50. package/symbols/LineSymbol3D.d.ts +5 -3
  51. package/views/2d/analysis/ElevationProfileAnalysisView2D.d.ts +6 -0
  52. package/views/2d/analysis/ElevationProfileAnalysisView2D.js +1 -1
  53. package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
  54. package/views/2d/layers/features/layerAdapters/SubtypeGroupLayerAdapter.js +1 -1
  55. package/views/3d/analysis/Dimension/DimensionVisualization.js +1 -1
  56. package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
  57. package/views/3d/analysis/Dimension/lengthDimensionManipulatorUtils.js +1 -1
  58. package/views/3d/analysis/ElevationProfileAnalysisView3D.d.ts +6 -0
  59. package/views/3d/analysis/ElevationProfileAnalysisView3D.js +1 -1
  60. package/views/3d/analysis/LineOfSight/LineOfSightObserverPlugin.js +1 -1
  61. package/views/3d/analysis/LineOfSight/LineOfSightTargetPlugin.js +1 -1
  62. package/views/3d/analysis/Viewshed/ViewshedFieldOfViewManipulation.js +1 -1
  63. package/views/3d/analysis/Viewshed/ViewshedPlacementPointPlugin.js +1 -1
  64. package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
  65. package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
  66. package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
  67. package/views/3d/interactive/manipulators/ResizeManipulator.js +1 -1
  68. package/views/3d/interactive/manipulators/RotateManipulator.js +1 -1
  69. package/views/3d/interactive/manipulators/ShiftManipulator.js +1 -1
  70. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  71. package/views/3d/interactive/visualElements/LineVisualElement.js +1 -1
  72. package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
  73. package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
  74. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  75. package/views/3d/layers/FlowSubView3D.js +1 -1
  76. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  77. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  78. package/views/3d/support/elevationUpdateUtils.js +1 -1
  79. package/views/3d/terrain/TerrainData.js +1 -1
  80. package/views/3d/terrain/terrainUtils.js +1 -1
  81. package/views/3d/webgl-engine/collections/Component/Material/ComponentData.glsl.js +2 -2
  82. package/views/3d/webgl-engine/core/shaderLibrary/attributes/SymbolColor.glsl.js +3 -3
  83. package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialExternalColor.glsl.js +2 -2
  84. package/views/3d/webgl-engine/core/shaderLibrary/output/getEmissions.glsl.js +2 -2
  85. package/views/3d/webgl-engine/lib/GridLocalOriginFactory.js +1 -1
  86. package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
  87. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  88. package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
  89. package/views/BreakpointsOwner.d.ts +6 -0
  90. package/views/analysis/ElevationProfile/ElevationProfileTool.js +1 -1
  91. package/views/types.d.ts +3 -0
  92. package/views/webgl/ShaderBuilder.js +1 -1
  93. package/assets/esri/core/workers/chunks/3e3e076fa5e8d5d5f33f.js +0 -1
  94. package/assets/esri/core/workers/chunks/510502a4c9a2ba8d3f7b.js +0 -1
  95. package/assets/esri/core/workers/chunks/e8bf653376a607f00897.js +0 -1
  96. package/assets/esri/core/workers/chunks/f4a7aa3cdbc0c429c359.js +0 -1
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{copy as e,subtract as t,exactEquals as n,negate as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as i,fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{exactEquals as o,copy as s}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as c,clone as l}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromRay as u,getStart as d,getEnd as f,create as p}from"../../../../geometry/support/clipRay.js";import{intersectClipRay as m}from"../../../../geometry/support/frustumPlanes.js";import{fromPoints as h,pointAt as g,create as _}from"../../../../geometry/support/lineSegment.js";import{create as v,fromPoints as y}from"../../../../geometry/support/ray.js";import{EngineVisualElement as b}from"./EngineVisualElement.js";import{LaserlineVisualElement as x}from"./LaserlineVisualElement.js";import{drapedZ as S}from"../../terrain/DrapedZ.js";import{createPolylineGeometry as C}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderGeometry as w}from"../../webgl-engine/lib/RenderGeometry.js";import{RibbonLineMaterial as T}from"../../webgl-engine/materials/RibbonLineMaterial.js";class E extends b{constructor(e){super(e),this._ray=v(),this._isWorldDown=!1,this._start=i(),this._end=a(1,0,0),this._width=1,this._color=c(1,0,1,1),this._polygonOffset=!1,this._writeDepthEnabled=!0,this._innerWidth=0,this._innerColor=c(1,1,1,1),this._stipplePattern=null,this._stippleOffColor=null,this._stipplePreferContinuous=!0,this._falloff=0,this._extensionType=0,this._laserlineStyle=null,this._laserlineEnabled=!1,this._renderOccluded=4,this._transparentRenderOrder=0,this._fadedExtensions=N,this._laserline=new x({view:this.view,isDecoration:e.isDecoration}),this.applyProperties(e)}destroy(){this._laserline.destroy(),super.destroy()}createObject3DResourceFactory(e){return{view:e,createResources:e=>this._createObject3DResources(e),destroyResources:D,recreateGeometry:(e,t)=>this._recreateObject3DGeometry(e,t),cameraChanged:()=>this._updateGeometry(),forEachMaterial:(e,t)=>t(e.material)}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:D,recreateGeometry:e=>this._recreateDrapedGeometry(e),forEachMaterial:(e,t)=>t(e.material)}}updateVisibility(e){super.updateVisibility(e),this._laserline.visible=e}onAttachedChange(){this._laserline.attached=this._laserlineAttached}setStartEndFromWorldDownAtLocation(n){this._isWorldDown=!0,e(this._start,n),this.view.renderCoordsHelper.worldUpAtPosition(n,this._end),t(this._end,n,this._end),y(this._start,this._end,this._ray),this._updateGeometry()}get start(){return this._start}set start(t){this._isWorldDown=!1,n(this._start,t)||(e(this._start,t),y(this._start,this._end,this._ray),this._updateGeometry())}get end(){return this._end}set end(t){this._isWorldDown=!1,n(this._end,t)||(e(this._end,t),y(this._start,this._end,this._ray),this._updateGeometry())}get width(){return this._width}set width(e){e!==this._width&&(this._width=e,this._updateMaterial())}get color(){return this._color}set color(e){o(e,this._color)||(s(this._color,e),this._updateMaterial())}get polygonOffset(){return this._polygonOffset}set polygonOffset(e){e!==this._polygonOffset&&(this._polygonOffset=e,this._updateMaterial())}get writeDepthEnabled(){return this._writeDepthEnabled}set writeDepthEnabled(e){this._writeDepthEnabled!==e&&(this._writeDepthEnabled=e,this._updateMaterial())}get innerWidth(){return this._innerWidth}set innerWidth(e){e!==this._innerWidth&&(this._innerWidth=e,this._updateMaterial())}get innerColor(){return this._innerColor}set innerColor(e){o(e,this._innerColor)||(s(this._innerColor,e),this._updateMaterial())}get stipplePattern(){return this._stipplePattern}set stipplePattern(e){let t=e!=null!=(this._stipplePattern!=null);this._stipplePattern=e,t?this.recreate():this._updateMaterial()}get stippleOffColor(){return this._stippleOffColor}set stippleOffColor(e){(e==null||this._stippleOffColor==null||!o(e,this._stippleOffColor))&&(this._stippleOffColor=e==null?null:l(e),this._updateMaterial())}get stipplePreferContinuous(){return this._stipplePreferContinuous}set stipplePreferContinuous(e){e!==this._stipplePreferContinuous&&(this._stipplePreferContinuous=e,this._updateMaterial())}get falloff(){return this._falloff}set falloff(e){e!==this._falloff&&(this._falloff=e,this._updateMaterial())}get extensionType(){return this._extensionType}set extensionType(e){e!==this._extensionType&&(this._extensionType=e,this.recreateGeometry())}get _laserlineAttached(){return this._laserlineEnabled&&this._laserlineStyle!=null&&this.attached&&!this.isDraped}get laserlineStyle(){return this._laserlineStyle}set laserlineStyle(e){this._laserlineStyle=e,this._laserline.attached=this._laserlineAttached,e!=null&&(this._laserline.style=e)}get laserlineEnabled(){return this._laserlineEnabled}set laserlineEnabled(e){this._laserlineEnabled!==e&&(this._laserlineEnabled=e,this._laserline.attached=this._laserlineAttached)}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateMaterial())}get transparentRenderOrder(){return this._transparentRenderOrder}set transparentRenderOrder(e){e!==this._transparentRenderOrder&&(this._transparentRenderOrder=e,this._updateMaterial())}get _normalizedRenderOccluded(){return this.isDraped&&this._renderOccluded===8?4:this._renderOccluded}get fadedExtensions(){return this._fadedExtensions}set fadedExtensions(e){this._fadedExtensions=e??N,this.recreateGeometry()}_updateMaterial(){let{materialParameters:e}=this;this.object3dResources.resources?.material.setParameters(e),this.drapedResources.resources?.material.setParameters(e)}get materialParameters(){return{width:this._width,color:this._color,stippleOffColor:this._stippleOffColor,stipplePattern:this._stipplePattern,stipplePreferContinuous:this._stipplePreferContinuous,innerWidth:this._innerWidth,innerColor:this._innerColor,falloff:this._falloff,polygonOffset:this._polygonOffset?3:0,renderOccluded:this._normalizedRenderOccluded,testsTransparentRenderOrder:this._transparentRenderOrder,isDecoration:this.isDecoration,writeDepth:this._writeDepthEnabled}}_createObject3DResources(e){let t=new T(this.materialParameters,this.view.state.isGlobal),n=[];return this._createObject3DGeometry(t,e,n),{material:t,geometries:n}}_recreateObject3DGeometry(e,t){e.geometries.length=0,this._createObject3DGeometry(e.material,t,e.geometries)}_createObject3DGeometry(e,t,n){let r=this._createGeometry(e);n.push(r),t.addGeometry(r),this._updateVerticesObject3D(t)}_createDrapedResources(){let e=new T(this.materialParameters,this.view.state.isGlobal);return{material:e,geometries:[this._createDrapedGeometry(e)]}}_recreateDrapedGeometry(e){e.geometries=[this._createDrapedGeometry(e.material)]}_createDrapedGeometry(e){let t=this._createGeometry(e);return this._updateVerticesDraped(t),new w(t)}_createGeometry(e){let t=this.extensionType===3,n=t?[i(),i(),i(),i()]:[i(),i()];return C(e,n,null,t?[1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0]:null)}_updateGeometry(){if(this.isDraped)this.drapedResources.recreateGeometry();else{let e=this.object3dResources.object;e&&this._updateVerticesObject3D(e)}}_updateVerticesObject3D(e){let t=this._lineSegment;this._updateVertexAttributesObject3D(e,t),this._laserline.intersectsLine=t}_updateVerticesDraped(e){this._updateVertexAttributesDraped(e,this._lineSegment)}get _lineSegment(){return this._extensionType===3?this._updateLineSegmentFinite(j):this._updateLineSegmentInfinite(this._extensionType,j)}_updateLineSegmentFinite(e){return h(this._start,this._end,e)}_updateLineSegmentInfinite(e,t){let n=this.view.state.camera;switch(u(this._ray,O),e){case 0:O.c0=-Number.MAX_VALUE;break;case 1:case 2:{let e=this._ray.origin,t=this.view.elevationProvider.getElevation(e[0],e[1],e[2],this.view.renderCoordsHelper.spatialReference,`ground`)??0,n=this.view.renderCoordsHelper.getAltitude(e);this._isWorldDown&&n<t&&r(O.ray.direction,O.ray.direction),this._extensionType===2&&t!=null&&(O.c1=Math.abs(n-t));break}}if(!m(n.frustum,O))return this._updateLineSegmentFinite(t);let i=d(O,k),a=f(O,A);return h(i,a,t)}_updateVertexAttributesObject3D(e,t){let n=e.geometries[0].getMutableAttribute(`position`)?.data;if(!n)return;let r=0;for(let e of this._lineVertices(t))n[r++]=e[0],n[r++]=e[1],n[r++]=e[2];e.geometryVertexAttributeUpdated(e.geometries[0],`position`)}_updateVertexAttributesDraped(e,t){let n=e.getMutableAttribute(`position`)?.data;if(!n)return;let r=0;for(let e of this._lineVertices(t))n[r++]=e[0],n[r++]=e[1],n[r++]=S;e.invalidateBoundingInfo()}*_lineVertices(e){this.extensionType===3?(yield g(e,-this.fadedExtensions.start,k),yield g(e,0,k),yield g(e,1,k),yield g(e,1+this.fadedExtensions.end,k)):(yield g(e,0,k),yield g(e,1,k))}}function D(e){e.geometries=[]}const O=p(),k=i(),A=i(),j=_(),M=1/3,N={start:M,end:M};export{E as ExtendedLineVisualElement};
2
+ import{copy as e,subtract as t,exactEquals as n,negate as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as i,fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{exactEquals as o,copy as s}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as c,clone as l}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromRay as u,getStart as d,getEnd as f,create as p}from"../../../../geometry/support/clipRay.js";import{intersectClipRay as m}from"../../../../geometry/support/frustumPlanes.js";import{fromPoints as h,pointAt as g,create as _}from"../../../../geometry/support/lineSegment.js";import{create as v,fromPoints as y}from"../../../../geometry/support/ray.js";import{EngineVisualElement as b}from"./EngineVisualElement.js";import{LaserlineVisualElement as x}from"./LaserlineVisualElement.js";import{drapedZ as S}from"../../terrain/DrapedZ.js";import{createPolylineGeometry as C}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderGeometry as w}from"../../webgl-engine/lib/RenderGeometry.js";import{RibbonLineMaterial as T}from"../../webgl-engine/materials/RibbonLineMaterial.js";class E extends b{constructor(e){super(e),this._ray=v(),this._isWorldDown=!1,this._start=i(),this._end=a(1,0,0),this._width=1,this._color=c(1,0,1,1),this._polygonOffset=!1,this._writeDepthEnabled=!0,this._innerWidth=0,this._innerColor=c(1,1,1,1),this._stipplePattern=null,this._stippleOffColor=null,this._stipplePreferContinuous=!0,this._falloff=0,this._extensionType=0,this._laserlineStyle=null,this._laserlineEnabled=!1,this._renderOccluded=4,this._transparentRenderOrder=0,this._fadedExtensions=N,this._laserline=new x({view:this.view,isDecoration:e.isDecoration}),this.applyProperties(e)}destroy(){this._laserline.destroy(),super.destroy()}createObject3DResourceFactory(e){return{view:e,createResources:e=>this._createObject3DResources(e),destroyResources:D,recreateGeometry:(e,t)=>this._recreateObject3DGeometry(e,t),cameraChanged:()=>this._updateGeometry(),forEachMaterial:(e,t)=>t(e.material)}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:D,recreateGeometry:e=>this._recreateDrapedGeometry(e),forEachMaterial:(e,t)=>t(e.material)}}updateVisibility(e){super.updateVisibility(e),this._laserline.visible=e}onAttachedChange(){this._laserline.attached=this._laserlineAttached}setStartEndFromWorldDownAtLocation(n){this._isWorldDown=!0,e(this._start,n),this.view.renderCoordsHelper.worldUpAtPosition(n,this._end),t(this._end,n,this._end),y(this._start,this._end,this._ray),this._updateGeometry()}get start(){return this._start}set start(t){this._isWorldDown=!1,n(this._start,t)||(e(this._start,t),y(this._start,this._end,this._ray),this._updateGeometry())}get end(){return this._end}set end(t){this._isWorldDown=!1,n(this._end,t)||(e(this._end,t),y(this._start,this._end,this._ray),this._updateGeometry())}get width(){return this._width}set width(e){e!==this._width&&(this._width=e,this._updateMaterial())}get color(){return this._color}set color(e){o(e,this._color)||(s(this._color,e),this._updateMaterial())}get polygonOffset(){return this._polygonOffset}set polygonOffset(e){e!==this._polygonOffset&&(this._polygonOffset=e,this._updateMaterial())}get writeDepthEnabled(){return this._writeDepthEnabled}set writeDepthEnabled(e){this._writeDepthEnabled!==e&&(this._writeDepthEnabled=e,this._updateMaterial())}get innerWidth(){return this._innerWidth}set innerWidth(e){e!==this._innerWidth&&(this._innerWidth=e,this._updateMaterial())}get innerColor(){return this._innerColor}set innerColor(e){o(e,this._innerColor)||(s(this._innerColor,e),this._updateMaterial())}get stipplePattern(){return this._stipplePattern}set stipplePattern(e){let t=e!=null!=(this._stipplePattern!=null);this._stipplePattern=e,t?this.recreate():this._updateMaterial()}get stippleOffColor(){return this._stippleOffColor}set stippleOffColor(e){(e==null||this._stippleOffColor==null||!o(e,this._stippleOffColor))&&(this._stippleOffColor=e==null?null:l(e),this._updateMaterial())}get stipplePreferContinuous(){return this._stipplePreferContinuous}set stipplePreferContinuous(e){e!==this._stipplePreferContinuous&&(this._stipplePreferContinuous=e,this._updateMaterial())}get falloff(){return this._falloff}set falloff(e){e!==this._falloff&&(this._falloff=e,this._updateMaterial())}get extensionType(){return this._extensionType}set extensionType(e){e!==this._extensionType&&(this._extensionType=e,this.recreateGeometry())}get _laserlineAttached(){return this._laserlineEnabled&&this._laserlineStyle!=null&&this.attached&&!this.isDraped}get laserlineStyle(){return this._laserlineStyle}set laserlineStyle(e){this._laserlineStyle=e,this._laserline.attached=this._laserlineAttached,e!=null&&(this._laserline.style=e)}get laserlineEnabled(){return this._laserlineEnabled}set laserlineEnabled(e){this._laserlineEnabled!==e&&(this._laserlineEnabled=e,this._laserline.attached=this._laserlineAttached)}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateMaterial())}get transparentRenderOrder(){return this._transparentRenderOrder}set transparentRenderOrder(e){e!==this._transparentRenderOrder&&(this._transparentRenderOrder=e,this._updateMaterial())}get _normalizedRenderOccluded(){return this.isDraped&&this._renderOccluded===8?4:this._renderOccluded}get fadedExtensions(){return this._fadedExtensions}set fadedExtensions(e){this._fadedExtensions=e??N,this.recreateGeometry()}_updateMaterial(){let{materialParameters:e}=this;this.object3dResources.resources?.material.setParameters(e),this.drapedResources.resources?.material.setParameters(e)}get materialParameters(){return{width:this._width,color:this._color,stippleOffColor:this._stippleOffColor,stipplePattern:this._stipplePattern,stipplePreferContinuous:this._stipplePreferContinuous,innerWidth:this._innerWidth,innerColor:this._innerColor,falloff:this._falloff,polygonOffset:this._polygonOffset?3:0,renderOccluded:this._normalizedRenderOccluded,testsTransparentRenderOrder:this._transparentRenderOrder,isDecoration:this.isDecoration,writeDepth:this._writeDepthEnabled}}_createObject3DResources(e){let t=new T(this.materialParameters,this.view),n=[];return this._createObject3DGeometry(t,e,n),{material:t,geometries:n}}_recreateObject3DGeometry(e,t){e.geometries.length=0,this._createObject3DGeometry(e.material,t,e.geometries)}_createObject3DGeometry(e,t,n){let r=this._createGeometry(e);n.push(r),t.addGeometry(r),this._updateVerticesObject3D(t)}_createDrapedResources(){let e=new T(this.materialParameters,this.view);return{material:e,geometries:[this._createDrapedGeometry(e)]}}_recreateDrapedGeometry(e){e.geometries=[this._createDrapedGeometry(e.material)]}_createDrapedGeometry(e){let t=this._createGeometry(e);return this._updateVerticesDraped(t),new w(t)}_createGeometry(e){let t=this.extensionType===3,n=t?[i(),i(),i(),i()]:[i(),i()];return C(e,n,null,t?[1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0]:null)}_updateGeometry(){if(this.isDraped)this.drapedResources.recreateGeometry();else{let e=this.object3dResources.object;e&&this._updateVerticesObject3D(e)}}_updateVerticesObject3D(e){let t=this._lineSegment;this._updateVertexAttributesObject3D(e,t),this._laserline.intersectsLine=t}_updateVerticesDraped(e){this._updateVertexAttributesDraped(e,this._lineSegment)}get _lineSegment(){return this._extensionType===3?this._updateLineSegmentFinite(j):this._updateLineSegmentInfinite(this._extensionType,j)}_updateLineSegmentFinite(e){return h(this._start,this._end,e)}_updateLineSegmentInfinite(e,t){let n=this.view.state.camera;switch(u(this._ray,O),e){case 0:O.c0=-Number.MAX_VALUE;break;case 1:case 2:{let e=this._ray.origin,t=this.view.elevationProvider.getElevation(e[0],e[1],e[2],this.view.renderCoordsHelper.spatialReference,`ground`)??0,n=this.view.renderCoordsHelper.getAltitude(e);this._isWorldDown&&n<t&&r(O.ray.direction,O.ray.direction),this._extensionType===2&&t!=null&&(O.c1=Math.abs(n-t));break}}if(!m(n.frustum,O))return this._updateLineSegmentFinite(t);let i=d(O,k),a=f(O,A);return h(i,a,t)}_updateVertexAttributesObject3D(e,t){let n=e.geometries[0].getMutableAttribute(`position`)?.data;if(!n)return;let r=0;for(let e of this._lineVertices(t))n[r++]=e[0],n[r++]=e[1],n[r++]=e[2];e.geometryVertexAttributeUpdated(e.geometries[0],`position`)}_updateVertexAttributesDraped(e,t){let n=e.getMutableAttribute(`position`)?.data;if(!n)return;let r=0;for(let e of this._lineVertices(t))n[r++]=e[0],n[r++]=e[1],n[r++]=S;e.invalidateBoundingInfo()}*_lineVertices(e){this.extensionType===3?(yield g(e,-this.fadedExtensions.start,k),yield g(e,0,k),yield g(e,1,k),yield g(e,1+this.fadedExtensions.end,k)):(yield g(e,0,k),yield g(e,1,k))}}function D(e){e.geometries=[]}const O=p(),k=i(),A=i(),j=_(),M=1/3,N={start:M,end:M};export{E as ExtendedLineVisualElement};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{fromTranslation as e}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as n,transformMat4 as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as i,create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as o}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{Object3DVisualElement as s}from"./Object3DVisualElement.js";import{lineStripsToParameters as c,createGeometry as l}from"../../support/engineContent/line.js";import{isImagePattern as u}from"../../webgl-engine/materials/lineStippleUtils.js";import{RibbonLineMaterial as d}from"../../webgl-engine/materials/RibbonLineMaterial.js";class f extends s{constructor(e,t){super(e),this._hasExternalMaterial=!1,this._hasExternalMaterial=t!=null,this._material=t??new d({width:1,color:o(1,0,1,1),stipplePreferContinuous:!0,isClosed:!1,falloff:0,innerWidth:1,renderOccluded:4,isDecoration:!!e.isDecoration,writeDepth:!0},e.view.state.isGlobal),this.applyProperties(e)}setGeometryFromPoint(e,t=1e3){let n=a();this.view.renderCoordsHelper.toRenderCoords(e,n)&&this.setGeometryFromRenderSpacePoint(n,t)}setGeometryFromRenderSpacePoint(e,t=1e3){this.geometry=[[[e[0]-t,e[1],e[2]],[e[0]+t,e[1],e[2]]],[[e[0],e[1]-t,e[2]],[e[0],e[1]+t,e[2]]],[[e[0],e[1],e[2]-t],[e[0],e[1],e[2]+t]]]}setGeometryFromExtent(e){let t=this.view.spatialReference,r=a(),i=a(),o=[];n(r,e[0],e[1],100),this.view.renderCoordsHelper.toRenderCoords(r,t,i),o.push([i[0],i[1],i[2]]),n(r,e[2],e[1],100),this.view.renderCoordsHelper.toRenderCoords(r,t,i),o.push([i[0],i[1],i[2]]),n(r,e[2],e[3],100),this.view.renderCoordsHelper.toRenderCoords(r,t,i),o.push([i[0],i[1],i[2]]),n(r,e[0],e[3],100),this.view.renderCoordsHelper.toRenderCoords(r,t,i),o.push([i[0],i[1],i[2]]),n(r,e[0],e[1],100),this.view.renderCoordsHelper.toRenderCoords(r,t,i),o.push([i[0],i[1],i[2]]),n(r,e[0],e[1],100),this.view.renderCoordsHelper.toRenderCoords(r,t,i),o.push([i[0],i[1],i[2]]),this.geometry=[o]}setGeometryFromFrustum(e){let t=[];e.lines.forEach(e=>{t.push([e.origin[0],e.origin[1],e.origin[2]]),t.push([e.endpoint[0],e.endpoint[1],e.endpoint[2]])}),this.geometry=[t]}setGeometryFromBoundedPlane(e){let t=[],n=e.origin,r=e.basis1,i=e.basis2,o=.5,s=a(),c=a(),l=a(),u=a();s[0]=n[0]-r[0]*o-i[0]*o,s[1]=n[1]-r[1]*o-i[1]*o,s[2]=n[2]-r[2]*o-i[2]*o,c[0]=n[0]-r[0]*o+i[0]*o,c[1]=n[1]-r[1]*o+i[1]*o,c[2]=n[2]-r[2]*o+i[2]*o,l[0]=n[0]+r[0]*o+i[0]*o,l[1]=n[1]+r[1]*o+i[1]*o,l[2]=n[2]+r[2]*o+i[2]*o,u[0]=n[0]+r[0]*o-i[0]*o,u[1]=n[1]+r[1]*o-i[1]*o,u[2]=n[2]+r[2]*o-i[2]*o,t.push([s[0],s[1],s[2]]),t.push([c[0],c[1],c[2]]),t.push([l[0],l[1],l[2]]),t.push([u[0],u[1],u[2]]),t.push([s[0],s[1],s[2]]),this.geometry=[t]}setGeometryFromSegment(t){if(!t.visible){this.geometry=null;return}let n=t.endRenderSpace;this.transform=e(p,n);let{points:r}=t.createRenderGeometry(n,this.view.renderCoordsHelper);this.geometry=[r]}setGeometryFromSegments(t,n=i){this.transform=e(p,n),this.geometry=t.filter(({visible:e})=>e).map(e=>e.createRenderGeometry(n,this.view.renderCoordsHelper).points)}getTransformedGeometry(){return this._geometry==null?null:this._geometry.map(e=>e.map(e=>r(a(),e,this.transform)))}get renderOccluded(){return this._material.parameters.renderOccluded}set renderOccluded(e){this._material.setParameters({renderOccluded:e})}get transparentRenderOrder(){return this._material.parameters.testsTransparentRenderOrder}set transparentRenderOrder(e){this._material.setParameters({testsTransparentRenderOrder:e})}get geometry(){return this._geometry}set geometry(e){this._geometry=e,this.recreateGeometry()}get width(){return this._material.parameters.width}set width(e){this._material.setParameters({width:e})}get color(){return this._material.parameters.color}set color(e){let t=e[3]===1;this._material.setParameters({color:e,writeDepth:t})}get innerWidth(){return this._material.parameters.innerWidth}set innerWidth(e){this._material.setParameters({innerWidth:e})}get innerColor(){return this._material.parameters.innerColor}set innerColor(e){this._material.setParameters({innerColor:e})}get stipplePattern(){let{stipplePattern:e}=this._material.parameters;return u(e)?null:e}set stipplePattern(e){this._material!=null&&this._material.setParameters({stipplePattern:e})}get stippleOffColor(){return this._material.parameters.stippleOffColor}set stippleOffColor(e){this._material.setParameters({stippleOffColor:e})}get stipplePreferContinuous(){return this._material.parameters.stipplePreferContinuous}set stipplePreferContinuous(e){this._material.setParameters({stipplePreferContinuous:e})}get falloff(){return this._material.parameters.falloff}set falloff(e){this._material.setParameters({falloff:e})}get polygonOffset(){return this._material.parameters.polygonOffset}set polygonOffset(e){this._material.setParameters({polygonOffset:e})}createExternalResources(){}destroyExternalResources(){}createGeometries(e){for(let t of c(this.geometry)){let n=l(this._material,t);e.addGeometry(n)}}forEachMaterial(e){this._hasExternalMaterial||e(this._material)}}const p=t();export{f as LineVisualElement};
2
+ import{fromTranslation as e}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as n,transformMat4 as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as i,create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as o}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{Object3DVisualElement as s}from"./Object3DVisualElement.js";import{lineStripsToParameters as c,createGeometry as l}from"../../support/engineContent/line.js";import{isImagePattern as u}from"../../webgl-engine/materials/lineStippleUtils.js";import{RibbonLineMaterial as d}from"../../webgl-engine/materials/RibbonLineMaterial.js";class f extends s{constructor(e,t){super(e),this._hasExternalMaterial=!1,this._hasExternalMaterial=t!=null,this._material=t??new d({width:1,color:o(1,0,1,1),stipplePreferContinuous:!0,isClosed:!1,falloff:0,innerWidth:1,renderOccluded:4,isDecoration:!!e.isDecoration,writeDepth:!0},e.view),this.applyProperties(e)}setGeometryFromPoint(e,t=1e3){let n=a();this.view.renderCoordsHelper.toRenderCoords(e,n)&&this.setGeometryFromRenderSpacePoint(n,t)}setGeometryFromRenderSpacePoint(e,t=1e3){this.geometry=[[[e[0]-t,e[1],e[2]],[e[0]+t,e[1],e[2]]],[[e[0],e[1]-t,e[2]],[e[0],e[1]+t,e[2]]],[[e[0],e[1],e[2]-t],[e[0],e[1],e[2]+t]]]}setGeometryFromExtent(e){let t=this.view.spatialReference,r=a(),i=a(),o=[];n(r,e[0],e[1],100),this.view.renderCoordsHelper.toRenderCoords(r,t,i),o.push([i[0],i[1],i[2]]),n(r,e[2],e[1],100),this.view.renderCoordsHelper.toRenderCoords(r,t,i),o.push([i[0],i[1],i[2]]),n(r,e[2],e[3],100),this.view.renderCoordsHelper.toRenderCoords(r,t,i),o.push([i[0],i[1],i[2]]),n(r,e[0],e[3],100),this.view.renderCoordsHelper.toRenderCoords(r,t,i),o.push([i[0],i[1],i[2]]),n(r,e[0],e[1],100),this.view.renderCoordsHelper.toRenderCoords(r,t,i),o.push([i[0],i[1],i[2]]),n(r,e[0],e[1],100),this.view.renderCoordsHelper.toRenderCoords(r,t,i),o.push([i[0],i[1],i[2]]),this.geometry=[o]}setGeometryFromFrustum(e){let t=[];e.lines.forEach(e=>{t.push([e.origin[0],e.origin[1],e.origin[2]]),t.push([e.endpoint[0],e.endpoint[1],e.endpoint[2]])}),this.geometry=[t]}setGeometryFromBoundedPlane(e){let t=[],n=e.origin,r=e.basis1,i=e.basis2,o=.5,s=a(),c=a(),l=a(),u=a();s[0]=n[0]-r[0]*o-i[0]*o,s[1]=n[1]-r[1]*o-i[1]*o,s[2]=n[2]-r[2]*o-i[2]*o,c[0]=n[0]-r[0]*o+i[0]*o,c[1]=n[1]-r[1]*o+i[1]*o,c[2]=n[2]-r[2]*o+i[2]*o,l[0]=n[0]+r[0]*o+i[0]*o,l[1]=n[1]+r[1]*o+i[1]*o,l[2]=n[2]+r[2]*o+i[2]*o,u[0]=n[0]+r[0]*o-i[0]*o,u[1]=n[1]+r[1]*o-i[1]*o,u[2]=n[2]+r[2]*o-i[2]*o,t.push([s[0],s[1],s[2]]),t.push([c[0],c[1],c[2]]),t.push([l[0],l[1],l[2]]),t.push([u[0],u[1],u[2]]),t.push([s[0],s[1],s[2]]),this.geometry=[t]}setGeometryFromSegment(t){if(!t.visible){this.geometry=null;return}let n=t.endRenderSpace;this.transform=e(p,n);let{points:r}=t.createRenderGeometry(n,this.view.renderCoordsHelper);this.geometry=[r]}setGeometryFromSegments(t,n=i){this.transform=e(p,n),this.geometry=t.filter(({visible:e})=>e).map(e=>e.createRenderGeometry(n,this.view.renderCoordsHelper).points)}getTransformedGeometry(){return this._geometry==null?null:this._geometry.map(e=>e.map(e=>r(a(),e,this.transform)))}get renderOccluded(){return this._material.parameters.renderOccluded}set renderOccluded(e){this._material.setParameters({renderOccluded:e})}get transparentRenderOrder(){return this._material.parameters.testsTransparentRenderOrder}set transparentRenderOrder(e){this._material.setParameters({testsTransparentRenderOrder:e})}get geometry(){return this._geometry}set geometry(e){this._geometry=e,this.recreateGeometry()}get width(){return this._material.parameters.width}set width(e){this._material.setParameters({width:e})}get color(){return this._material.parameters.color}set color(e){let t=e[3]===1;this._material.setParameters({color:e,writeDepth:t})}get innerWidth(){return this._material.parameters.innerWidth}set innerWidth(e){this._material.setParameters({innerWidth:e})}get innerColor(){return this._material.parameters.innerColor}set innerColor(e){this._material.setParameters({innerColor:e})}get stipplePattern(){let{stipplePattern:e}=this._material.parameters;return u(e)?null:e}set stipplePattern(e){this._material!=null&&this._material.setParameters({stipplePattern:e})}get stippleOffColor(){return this._material.parameters.stippleOffColor}set stippleOffColor(e){this._material.setParameters({stippleOffColor:e})}get stipplePreferContinuous(){return this._material.parameters.stipplePreferContinuous}set stipplePreferContinuous(e){this._material.setParameters({stipplePreferContinuous:e})}get falloff(){return this._material.parameters.falloff}set falloff(e){this._material.setParameters({falloff:e})}get polygonOffset(){return this._material.parameters.polygonOffset}set polygonOffset(e){this._material.setParameters({polygonOffset:e})}createExternalResources(){}destroyExternalResources(){}createGeometries(e){for(let t of c(this.geometry)){let n=l(this._material,t);e.addGeometry(n)}}forEachMaterial(e){this._hasExternalMaterial||e(this._material)}}const p=t();export{f as LineVisualElement};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{EventEmitter as e}from"../../../../core/Evented.js";import{set as t,add as n,scale as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{exactEquals as a,copy as o}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as s,clone as c}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{projectBuffer as l}from"../../../../geometry/projection/projectBuffer.js";import{expandWithBuffer as u}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as d}from"../../../../geometry/support/DoubleArray.js";import{makeDehydratedPoint as f}from"../../../../layers/graphics/dehydratedPoint.js";import{getGeometryEffectiveElevationMode as p}from"../../../../support/elevationInfoUtils.js";import m from"../../../../symbols/support/ElevationInfo.js";import{EngineVisualElement as h}from"./EngineVisualElement.js";import{LaserlineVisualElement as g}from"./LaserlineVisualElement.js";import{ElevationContext as _}from"../../layers/graphics/ElevationContext.js";import{createGeometry as v}from"../../support/engineContent/line.js";import{geometryToRenderInfoDraped as y,geometryToRenderInfo as b}from"../../support/renderInfoUtils/line.js";import{RenderGeometry as x}from"../../webgl-engine/lib/RenderGeometry.js";import{RibbonLineMaterial as S}from"../../webgl-engine/materials/RibbonLineMaterial.js";class C extends h{constructor(t){super(t),this._attachmentOrigin=f(0,0,0,null),this._attachmentOriginDirty=!0,this.events=new e,this._geometry=null,this._width=1,this._color=s(1,0,1,1),this._innerWidth=0,this._innerColor=s(1,1,1,1),this._stipplePattern=null,this._stippleOffColor=null,this._falloff=0,this._elevationInfo=null,this._laserlineStyle=null,this._laserlineEnabled=!1,this._renderOccluded=8,this._attachmentOrigin.spatialReference=t.view.spatialReference,this._laserline=new g({view:t.view,isDecoration:t.isDecoration}),this.applyProperties(t),this.attached=t.attached??!0}destroy(){this._laserline.destroy(),super.destroy()}createObject3DResourceFactory(e){return{view:e,createResources:e=>this._createObject3DResources(e),destroyResources:w,recreateGeometry:(e,t)=>{e.geometries.length=0,this._recreateGeometry(t,e.material,e.geometries)},forEachMaterial:(e,t)=>t(e.material)}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:w,recreateGeometry:e=>{e.geometries=this._createRenderGeometriesDraped(e.material),this._attachmentOriginChanged()},forEachMaterial:(e,t)=>t(e.material)}}get _laserlineAttached(){return this.attached&&this.visible&&this._laserlineStyle!=null&&!this.isDraped&&this.laserlineEnabled}onAttachedChange(e){this._laserline.attached=this._laserlineAttached,e&&this._attachmentOriginChanged()}get isDecoration(){return this._isDecoration}set isDecoration(e){this._isDecoration=e,this._updateMaterial()}get geometry(){return this._geometry}set geometry(e){let t=this._isClosed;this._geometry=e,this.recreateGeometry(),t!==this._isClosed&&this._updateMaterial()}get width(){return this._width}set width(e){e!==this._width&&(this._width=e,this._updateMaterial())}get color(){return this._color}set color(e){a(e,this._color)||(o(this._color,e),this._updateMaterial())}get innerWidth(){return this._innerWidth}set innerWidth(e){e!==this._innerWidth&&(this._innerWidth=e,this._updateMaterial())}get innerColor(){return this._innerColor}set innerColor(e){a(e,this._innerColor)||(o(this._innerColor,e),this._updateMaterial())}get stipplePattern(){return this._stipplePattern}set stipplePattern(e){let t=e!=null!=(this._stipplePattern!=null);this._stipplePattern=e,t?this.recreate():this._updateMaterial()}get stippleOffColor(){return this._stippleOffColor}set stippleOffColor(e){(!e||!this._stippleOffColor||!a(e,this._stippleOffColor))&&(this._stippleOffColor=e?c(e):null,this._updateMaterial())}get falloff(){return this._falloff}set falloff(e){e!==this._falloff&&(this._falloff=e,this._updateMaterial())}get elevationInfo(){return this._elevationInfo}set elevationInfo(e){this._elevationInfo=e,this.recreateGeometry()}get laserlineStyle(){return this._laserlineStyle}set laserlineStyle(e){this._laserlineStyle=e,this._laserline.attached=this._laserlineAttached,e!=null&&(this._laserline.style=e)}get laserlineEnabled(){return this._laserlineEnabled}set laserlineEnabled(e){this._laserlineEnabled!==e&&(this._laserlineEnabled=e,this._laserline.attached=this._laserlineAttached)}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateMaterial())}get attachmentOrigin(){if(!this._attachmentOriginDirty)return this._attachmentOrigin;let e=this.object3dResources.resources?.geometries;if(!e||e.length===0)return null;t(E,0,0,0);let i=0;for(let t of e)t.computeAttachmentOrigin(T)&&(n(E,E,T),i++);return i===0?null:(r(E,E,1/i),this.view.renderCoordsHelper.fromRenderCoords(E,this._attachmentOrigin),this._attachmentOriginDirty=!1,this._attachmentOrigin)}_updateMaterial(){this.object3dResources.resources?.material.setParameters(this._materialParameters),this.drapedResources.resources?.material.setParameters(this._materialParameters)}get _isClosed(){return this.geometry!=null&&this.geometry.type===`polygon`}get _materialParameters(){return{width:this._width,color:this._color,stippleOffColor:this._stippleOffColor,stipplePattern:this._stipplePattern,stipplePreferContinuous:!1,isClosed:this._isClosed,falloff:this._falloff,innerColor:this._innerColor,innerWidth:this._innerWidth,join:`round`,polygonOffset:3,renderOccluded:this._normalizedRenderOccluded,isDecoration:this.isDecoration}}get _normalizedRenderOccluded(){return this.isDraped&&this._renderOccluded===8?4:this._renderOccluded}_recreateGeometry(e,t,n){this._createRenderGeometries(t,n);for(let t of n)e.addGeometry(t);this._attachmentOriginChanged()}_attachmentOriginChanged(){this._attachmentOriginDirty=!0,this.events.emit(`attachment-origin-changed`)}_createObject3DResources(e){let t=new S(this._materialParameters,this.view.state.isGlobal),n=[];return this._recreateGeometry(e,t,n),{material:t,geometries:n}}_createDrapedResources(){let e=new S(this._materialParameters,this.view.state.isGlobal);return{material:e,geometries:this._createRenderGeometriesDraped(e)}}_createRenderGeometriesDraped(e){let{geometry:t,view:n}=this,r=n.groundView.spatialReference;return t==null||r==null?[]:y(t,r).lines.map(({position:t})=>{let i={overlayInfo:{spatialReference:r,renderCoordsHelper:n.renderCoordsHelper},attributeData:{position:t},removeDuplicateStartEnd:this._isClosed};return new x(v(e,i))})}calculateMapBounds(e){if(this.object3dResources.resources==null)return!1;let t=this.view.renderCoordsHelper;for(let n of this.object3dResources.resources.geometries){let r=n.attributes.get(`position`),i=d(r.data.length);l(r.data,t.spatialReference,0,i,this.view.spatialReference,0),u(e,i)}return!0}_createRenderGeometries(e,t){let n=this.geometry;if(n==null)return;let r=b(n,this.view.elevationProvider,this.view.renderCoordsHelper,_.fromElevationInfo(this.elevationInfo??new m({mode:p(n,null)}))),i=[];for(let{position:n,mapPositions:a}of r.lines){let r={mapPositions:a,attributeData:{position:n},removeDuplicateStartEnd:this._isClosed};t.push(v(e,r)),i.push(n)}this._laserline.pathVerticalPlane=i}}function w(e){e.geometries=[]}const T=i(),E=i();export{C as OutlineVisualElement};
2
+ import{EventEmitter as e}from"../../../../core/Evented.js";import{set as t,add as n,scale as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{exactEquals as a,copy as o}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as s,clone as c}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{projectBuffer as l}from"../../../../geometry/projection/projectBuffer.js";import{expandWithBuffer as u}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as d}from"../../../../geometry/support/DoubleArray.js";import{makeDehydratedPoint as f}from"../../../../layers/graphics/dehydratedPoint.js";import{getGeometryEffectiveElevationMode as p}from"../../../../support/elevationInfoUtils.js";import m from"../../../../symbols/support/ElevationInfo.js";import{EngineVisualElement as h}from"./EngineVisualElement.js";import{LaserlineVisualElement as g}from"./LaserlineVisualElement.js";import{ElevationContext as _}from"../../layers/graphics/ElevationContext.js";import{createGeometry as v}from"../../support/engineContent/line.js";import{geometryToRenderInfoDraped as y,geometryToRenderInfo as b}from"../../support/renderInfoUtils/line.js";import{RenderGeometry as x}from"../../webgl-engine/lib/RenderGeometry.js";import{RibbonLineMaterial as S}from"../../webgl-engine/materials/RibbonLineMaterial.js";class C extends h{constructor(t){super(t),this._attachmentOrigin=f(0,0,0,null),this._attachmentOriginDirty=!0,this.events=new e,this._geometry=null,this._width=1,this._color=s(1,0,1,1),this._innerWidth=0,this._innerColor=s(1,1,1,1),this._stipplePattern=null,this._stippleOffColor=null,this._falloff=0,this._elevationInfo=null,this._laserlineStyle=null,this._laserlineEnabled=!1,this._renderOccluded=8,this._attachmentOrigin.spatialReference=t.view.spatialReference,this._laserline=new g({view:t.view,isDecoration:t.isDecoration}),this.applyProperties(t),this.attached=t.attached??!0}destroy(){this._laserline.destroy(),super.destroy()}createObject3DResourceFactory(e){return{view:e,createResources:e=>this._createObject3DResources(e),destroyResources:w,recreateGeometry:(e,t)=>{e.geometries.length=0,this._recreateGeometry(t,e.material,e.geometries)},forEachMaterial:(e,t)=>t(e.material)}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:w,recreateGeometry:e=>{e.geometries=this._createRenderGeometriesDraped(e.material),this._attachmentOriginChanged()},forEachMaterial:(e,t)=>t(e.material)}}get _laserlineAttached(){return this.attached&&this.visible&&this._laserlineStyle!=null&&!this.isDraped&&this.laserlineEnabled}onAttachedChange(e){this._laserline.attached=this._laserlineAttached,e&&this._attachmentOriginChanged()}get isDecoration(){return this._isDecoration}set isDecoration(e){this._isDecoration=e,this._updateMaterial()}get geometry(){return this._geometry}set geometry(e){let t=this._isClosed;this._geometry=e,this.recreateGeometry(),t!==this._isClosed&&this._updateMaterial()}get width(){return this._width}set width(e){e!==this._width&&(this._width=e,this._updateMaterial())}get color(){return this._color}set color(e){a(e,this._color)||(o(this._color,e),this._updateMaterial())}get innerWidth(){return this._innerWidth}set innerWidth(e){e!==this._innerWidth&&(this._innerWidth=e,this._updateMaterial())}get innerColor(){return this._innerColor}set innerColor(e){a(e,this._innerColor)||(o(this._innerColor,e),this._updateMaterial())}get stipplePattern(){return this._stipplePattern}set stipplePattern(e){let t=e!=null!=(this._stipplePattern!=null);this._stipplePattern=e,t?this.recreate():this._updateMaterial()}get stippleOffColor(){return this._stippleOffColor}set stippleOffColor(e){(!e||!this._stippleOffColor||!a(e,this._stippleOffColor))&&(this._stippleOffColor=e?c(e):null,this._updateMaterial())}get falloff(){return this._falloff}set falloff(e){e!==this._falloff&&(this._falloff=e,this._updateMaterial())}get elevationInfo(){return this._elevationInfo}set elevationInfo(e){this._elevationInfo=e,this.recreateGeometry()}get laserlineStyle(){return this._laserlineStyle}set laserlineStyle(e){this._laserlineStyle=e,this._laserline.attached=this._laserlineAttached,e!=null&&(this._laserline.style=e)}get laserlineEnabled(){return this._laserlineEnabled}set laserlineEnabled(e){this._laserlineEnabled!==e&&(this._laserlineEnabled=e,this._laserline.attached=this._laserlineAttached)}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateMaterial())}get attachmentOrigin(){if(!this._attachmentOriginDirty)return this._attachmentOrigin;let e=this.object3dResources.resources?.geometries;if(!e||e.length===0)return null;t(E,0,0,0);let i=0;for(let t of e)t.computeAttachmentOrigin(T)&&(n(E,E,T),i++);return i===0?null:(r(E,E,1/i),this.view.renderCoordsHelper.fromRenderCoords(E,this._attachmentOrigin),this._attachmentOriginDirty=!1,this._attachmentOrigin)}_updateMaterial(){this.object3dResources.resources?.material.setParameters(this._materialParameters),this.drapedResources.resources?.material.setParameters(this._materialParameters)}get _isClosed(){return this.geometry!=null&&this.geometry.type===`polygon`}get _materialParameters(){return{width:this._width,color:this._color,stippleOffColor:this._stippleOffColor,stipplePattern:this._stipplePattern,stipplePreferContinuous:!1,isClosed:this._isClosed,falloff:this._falloff,innerColor:this._innerColor,innerWidth:this._innerWidth,join:`round`,polygonOffset:3,renderOccluded:this._normalizedRenderOccluded,isDecoration:this.isDecoration}}get _normalizedRenderOccluded(){return this.isDraped&&this._renderOccluded===8?4:this._renderOccluded}_recreateGeometry(e,t,n){this._createRenderGeometries(t,n);for(let t of n)e.addGeometry(t);this._attachmentOriginChanged()}_attachmentOriginChanged(){this._attachmentOriginDirty=!0,this.events.emit(`attachment-origin-changed`)}_createObject3DResources(e){let t=new S(this._materialParameters,this.view),n=[];return this._recreateGeometry(e,t,n),{material:t,geometries:n}}_createDrapedResources(){let e=new S(this._materialParameters,this.view);return{material:e,geometries:this._createRenderGeometriesDraped(e)}}_createRenderGeometriesDraped(e){let{geometry:t,view:n}=this,r=n.groundView.spatialReference;return t==null||r==null?[]:y(t,r).lines.map(({position:t})=>{let i={overlayInfo:{spatialReference:r,renderCoordsHelper:n.renderCoordsHelper},attributeData:{position:t},removeDuplicateStartEnd:this._isClosed};return new x(v(e,i))})}calculateMapBounds(e){if(this.object3dResources.resources==null)return!1;let t=this.view.renderCoordsHelper;for(let n of this.object3dResources.resources.geometries){let r=n.attributes.get(`position`),i=d(r.data.length);l(r.data,t.spatialReference,0,i,this.view.spatialReference,0),u(e,i)}return!0}_createRenderGeometries(e,t){let n=this.geometry;if(n==null)return;let r=b(n,this.view.elevationProvider,this.view.renderCoordsHelper,_.fromElevationInfo(this.elevationInfo??new m({mode:p(n,null)}))),i=[];for(let{position:n,mapPositions:a}of r.lines){let r={mapPositions:a,attributeData:{position:n},removeDuplicateStartEnd:this._isClosed};t.push(v(e,r)),i.push(n)}this._laserline.pathVerticalPlane=i}}function w(e){e.geometries=[]}const T=i(),E=i();export{C as OutlineVisualElement};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{watch as e}from"../../../../core/reactiveUtils.js";import{castScreenPointArray as t,createScreenPointArray as n}from"../../../../core/screenUtils.js";import{normalize as r,subtract as i,scale as a,set as o,add as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{exactEquals as l,copy as u,normalize as d,subtract as f,add as p}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as m,fromValues as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{exactEquals as g,copy as _}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as v}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeDehydratedPoint as y}from"../../../../layers/graphics/dehydratedPoint.js";import{EngineVisualElement as b}from"./EngineVisualElement.js";import{drapedZ as x}from"../../terrain/DrapedZ.js";import{createPolylineGeometry as S}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderGeometry as C}from"../../webgl-engine/lib/RenderGeometry.js";import{RibbonLineMaterial as w}from"../../webgl-engine/materials/RibbonLineMaterial.js";class T extends b{constructor(e){super(e),this._location=m(),this._direction=h(1,0,0),this._width=1,this._offset=1,this._length=18,this._color=v(1,0,1,1),this._renderOccluded=4,this._transparentRenderOrder=0,this.applyProperties(e)}createObject3DResourceFactory(e){return{view:e,createResources:e=>this._createObject3DResources(e),destroyResources:O,recreateGeometry:(e,t)=>this._recreateObject3DGeometry(e,t),cameraChanged:()=>this._updateGeometry(),forEachMaterial:(e,t)=>t(e.material)}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:k,recreateGeometry:e=>this._recreateDrapedGeometry(e),forEachMaterial:(e,t)=>t(e.material)}}get location(){return this._location}set location(e){l(this._location,e)||(u(this._location,e),this._updateGeometry())}get direction(){return this._direction}set direction(e){l(this._direction,e)||(u(this._direction,e),this._updateGeometry())}setDirectionFromPoints(e,t){d(this._direction,f(this._direction,t,e)),this._updateGeometry()}get width(){return this._width}set width(e){e!==this._width&&(this._width=e,this._updateMaterial())}get offset(){return this._offset}set offset(e){e!==this._offset&&(this._offset=e,this._updateGeometry())}get length(){return this._length}set length(e){e!==this._length&&(this._length=e,this._updateGeometry())}get color(){return this._color}set color(e){g(e,this._color)||(_(this._color,e),this._updateMaterial())}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateMaterial())}get transparentRenderOrder(){return this._transparentRenderOrder}set transparentRenderOrder(e){e!==this._transparentRenderOrder&&(this._transparentRenderOrder=e,this._updateMaterial())}get isDecoration(){return this._isDecoration}set isDecoration(e){this._isDecoration=e,this._updateMaterial()}_createObject3DResources(e){let t=new w(this.materialParameters,this.view.state.isGlobal),n=[];return this._createObject3DGeometry(t,e,n),{material:t,geometries:n}}_recreateObject3DGeometry(e,t){e.geometries.length=0,this._createObject3DGeometry(e.material,t,e.geometries)}_createObject3DGeometry(e,t,n){let[r,i]=E(e);t.addGeometry(r),t.addGeometry(i),n.push(r),n.push(i),this._updateVerticesObject3D(t)}_createDrapedResources(){let t=new w(this.materialParameters,this.view.state.isGlobal),n=e(()=>this.view.state.contentPixelRatio,()=>this.drapedResources.recreateGeometry());return{material:t,geometries:this._createDrapedGeometry(t),pixelRatioHandle:n}}_recreateDrapedGeometry(e){e.geometries=this._createDrapedGeometry(e.material)}_createDrapedGeometry(e){let t=E(e);return this._updateVerticesDraped(t),t.map(e=>new C(e))}_updateMaterial(){let{materialParameters:e}=this;this.object3dResources.resources?.material.setParameters(e),this.drapedResources.resources?.material.setParameters(e)}get materialParameters(){return{width:this._width,color:this._color,renderOccluded:this._renderOccluded,testsTransparentRenderOrder:this._transparentRenderOrder,isDecoration:this.isDecoration}}_updateGeometry(){if(this.isDraped)this.drapedResources.recreateGeometry();else{let e=this.object3dResources.object;e&&this._updateVerticesObject3D(e)}}_updateVerticesObject3D(e){let t=this.view.state.camera;t.projectToScreen(this.location,P),p(A,this.location,this.direction),t.projectToScreen(A,F),r(F,i(F,F,P)),this._updateVertexAttributesObject3D(t,e,0,P,F,1),this._updateVertexAttributesObject3D(t,e,1,P,F,-1)}_updateVertexAttributesObject3D(e,n,r,i,a,o){let s=n.geometries[r],c=s.getMutableAttribute(`position`)?.data;if(!c)return;let{start:l,end:u}=D(a,i,o,this.offset,this.width,this.length);e.unprojectFromScreen(t(l),A),c[0]=A[0],c[1]=A[1],c[2]=A[2],e.unprojectFromScreen(t(u),A),c[3]=A[0],c[4]=A[1],c[5]=A[2],n.geometryVertexAttributeUpdated(s,`position`)}_updateVerticesDraped(e){let{view:{overlayManager:t,state:{contentPixelRatio:n}}}=this,{location:r,width:i,length:a,offset:o}=this,s=I;s.spatialReference=t.spatialReference,s.x=r[0],s.y=r[1];let c=this.view.overlayPixelSizeInMapUnits(s)*n,l=i*c,u=a*c,d=o*c;this._updateVertexAttributesDraped(e[0],l,u,d,-1),this._updateVertexAttributesDraped(e[1],l,u,d,1)}_updateVertexAttributesDraped(e,t,n,r,i){let a=e.getMutableAttribute(`position`)?.data;if(!a)return;let{location:o,direction:s}=this,{start:c,end:l}=D(s,o,i,r,t,n);a[0]=c[0],a[1]=c[1],a[2]=x,a[3]=l[0],a[4]=l[1],a[5]=x,e.invalidateBoundingInfo()}}function E(e){return[S(e,[m(),m()]),S(e,[m(),m()])]}function D(e,t,n,r,i,c){let l=a(j,o(j,e[1]*n,e[0]*-n),r+i/2),u=s(M,s(M,s(M,t,a(M,e,c/2)),l),l);return{start:u,end:s(N,u,a(N,e,-c))}}function O(e){e.geometries.length=0}function k(e){e.pixelRatioHandle.remove(),e.geometries=[]}const A=m(),j=c(),M=c(),N=c(),P=n(),F=n(),I=y(0,0,void 0,null);export{T as ParallelLineVisualElement};
2
+ import{watch as e}from"../../../../core/reactiveUtils.js";import{castScreenPointArray as t,createScreenPointArray as n}from"../../../../core/screenUtils.js";import{normalize as r,subtract as i,scale as a,set as o,add as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{exactEquals as l,copy as u,normalize as d,subtract as f,add as p}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as m,fromValues as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{exactEquals as g,copy as _}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as v}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeDehydratedPoint as y}from"../../../../layers/graphics/dehydratedPoint.js";import{EngineVisualElement as b}from"./EngineVisualElement.js";import{drapedZ as x}from"../../terrain/DrapedZ.js";import{createPolylineGeometry as S}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderGeometry as C}from"../../webgl-engine/lib/RenderGeometry.js";import{RibbonLineMaterial as w}from"../../webgl-engine/materials/RibbonLineMaterial.js";class T extends b{constructor(e){super(e),this._location=m(),this._direction=h(1,0,0),this._width=1,this._offset=1,this._length=18,this._color=v(1,0,1,1),this._renderOccluded=4,this._transparentRenderOrder=0,this.applyProperties(e)}createObject3DResourceFactory(e){return{view:e,createResources:e=>this._createObject3DResources(e),destroyResources:O,recreateGeometry:(e,t)=>this._recreateObject3DGeometry(e,t),cameraChanged:()=>this._updateGeometry(),forEachMaterial:(e,t)=>t(e.material)}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:k,recreateGeometry:e=>this._recreateDrapedGeometry(e),forEachMaterial:(e,t)=>t(e.material)}}get location(){return this._location}set location(e){l(this._location,e)||(u(this._location,e),this._updateGeometry())}get direction(){return this._direction}set direction(e){l(this._direction,e)||(u(this._direction,e),this._updateGeometry())}setDirectionFromPoints(e,t){d(this._direction,f(this._direction,t,e)),this._updateGeometry()}get width(){return this._width}set width(e){e!==this._width&&(this._width=e,this._updateMaterial())}get offset(){return this._offset}set offset(e){e!==this._offset&&(this._offset=e,this._updateGeometry())}get length(){return this._length}set length(e){e!==this._length&&(this._length=e,this._updateGeometry())}get color(){return this._color}set color(e){g(e,this._color)||(_(this._color,e),this._updateMaterial())}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateMaterial())}get transparentRenderOrder(){return this._transparentRenderOrder}set transparentRenderOrder(e){e!==this._transparentRenderOrder&&(this._transparentRenderOrder=e,this._updateMaterial())}get isDecoration(){return this._isDecoration}set isDecoration(e){this._isDecoration=e,this._updateMaterial()}_createObject3DResources(e){let t=new w(this.materialParameters,this.view),n=[];return this._createObject3DGeometry(t,e,n),{material:t,geometries:n}}_recreateObject3DGeometry(e,t){e.geometries.length=0,this._createObject3DGeometry(e.material,t,e.geometries)}_createObject3DGeometry(e,t,n){let[r,i]=E(e);t.addGeometry(r),t.addGeometry(i),n.push(r),n.push(i),this._updateVerticesObject3D(t)}_createDrapedResources(){let t=new w(this.materialParameters,this.view),n=e(()=>this.view.state.contentPixelRatio,()=>this.drapedResources.recreateGeometry());return{material:t,geometries:this._createDrapedGeometry(t),pixelRatioHandle:n}}_recreateDrapedGeometry(e){e.geometries=this._createDrapedGeometry(e.material)}_createDrapedGeometry(e){let t=E(e);return this._updateVerticesDraped(t),t.map(e=>new C(e))}_updateMaterial(){let{materialParameters:e}=this;this.object3dResources.resources?.material.setParameters(e),this.drapedResources.resources?.material.setParameters(e)}get materialParameters(){return{width:this._width,color:this._color,renderOccluded:this._renderOccluded,testsTransparentRenderOrder:this._transparentRenderOrder,isDecoration:this.isDecoration}}_updateGeometry(){if(this.isDraped)this.drapedResources.recreateGeometry();else{let e=this.object3dResources.object;e&&this._updateVerticesObject3D(e)}}_updateVerticesObject3D(e){let t=this.view.state.camera;t.projectToScreen(this.location,P),p(A,this.location,this.direction),t.projectToScreen(A,F),r(F,i(F,F,P)),this._updateVertexAttributesObject3D(t,e,0,P,F,1),this._updateVertexAttributesObject3D(t,e,1,P,F,-1)}_updateVertexAttributesObject3D(e,n,r,i,a,o){let s=n.geometries[r],c=s.getMutableAttribute(`position`)?.data;if(!c)return;let{start:l,end:u}=D(a,i,o,this.offset,this.width,this.length);e.unprojectFromScreen(t(l),A),c[0]=A[0],c[1]=A[1],c[2]=A[2],e.unprojectFromScreen(t(u),A),c[3]=A[0],c[4]=A[1],c[5]=A[2],n.geometryVertexAttributeUpdated(s,`position`)}_updateVerticesDraped(e){let{view:{overlayManager:t,state:{contentPixelRatio:n}}}=this,{location:r,width:i,length:a,offset:o}=this,s=I;s.spatialReference=t.spatialReference,s.x=r[0],s.y=r[1];let c=this.view.overlayPixelSizeInMapUnits(s)*n,l=i*c,u=a*c,d=o*c;this._updateVertexAttributesDraped(e[0],l,u,d,-1),this._updateVertexAttributesDraped(e[1],l,u,d,1)}_updateVertexAttributesDraped(e,t,n,r,i){let a=e.getMutableAttribute(`position`)?.data;if(!a)return;let{location:o,direction:s}=this,{start:c,end:l}=D(s,o,i,r,t,n);a[0]=c[0],a[1]=c[1],a[2]=x,a[3]=l[0],a[4]=l[1],a[5]=x,e.invalidateBoundingInfo()}}function E(e){return[S(e,[m(),m()]),S(e,[m(),m()])]}function D(e,t,n,r,i,c){let l=a(j,o(j,e[1]*n,e[0]*-n),r+i/2),u=s(M,s(M,s(M,t,a(M,e,c/2)),l),l);return{start:u,end:s(N,u,a(N,e,-c))}}function O(e){e.geometries.length=0}function k(e){e.pixelRatioHandle.remove(),e.geometries=[]}const A=m(),j=c(),M=c(),N=c(),P=n(),F=n(),I=y(0,0,void 0,null);export{T as ParallelLineVisualElement};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{watch as e}from"../../../../core/reactiveUtils.js";import{fromTranslation as t,scale as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{distance as i,normalize as a,subtract as o,copy as s,exactEquals as c,add as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as u,ZEROS as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{copy as f}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as p}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{sv3d as m}from"../../../../geometry/support/vectorStacks.js";import{makeDehydratedPoint as h}from"../../../../layers/graphics/dehydratedPoint.js";import{EngineVisualElement as g}from"./EngineVisualElement.js";import{drapedZ as _}from"../../terrain/DrapedZ.js";import{Attribute as v}from"../../webgl-engine/lib/Attribute.js";import{Geometry as y}from"../../webgl-engine/lib/Geometry.js";import{createPolylineGeometry as b}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderGeometry as x}from"../../webgl-engine/lib/RenderGeometry.js";import{ColorMaterial as S}from"../../webgl-engine/materials/ColorMaterial.js";import{RibbonLineMaterial as C}from"../../webgl-engine/materials/RibbonLineMaterial.js";class w extends g{constructor(e){super(e),this._maxSize=0,this._position=u(),this._up=u(),this._right=u(),this._renderOccluded=4,this._color=p(1,0,0,1),this._outlineColor=p(0,0,0,1),this._outlineSize=0,this._size=32,this._outlineRenderOccluded=16,this.applyProperties(e)}createObject3DResourceFactory(e){return{view:e,createResources:e=>this._createObject3DResources(e),destroyResources:()=>{},cameraChanged:()=>this._updateTransformObject3D(),forEachMaterial:(e,t)=>{t(e.outlineMaterial),t(e.quadMaterial)}}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:T,forEachMaterial:(e,t)=>{t(e.outlineMaterial),t(e.quadMaterial)}}}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateQuadMaterial())}get transparentRenderOrder(){return this._transparentRenderOrder}set transparentRenderOrder(e){this._transparentRenderOrder=e,this._updateOutlineMaterial(),this._updateQuadMaterial()}get isDecoration(){return this._isDecoration}set isDecoration(e){this._isDecoration=e,this._updateOutlineMaterial(),this._updateQuadMaterial()}get color(){return this._color}set color(e){f(this._color,e),this._updateQuadMaterial()}get outlineColor(){return this._outlineColor}set outlineColor(e){f(this._outlineColor,e),this._updateOutlineMaterial()}get outlineSize(){return this._outlineSize}set outlineSize(e){let t=this._outlineSize===0!=(e===0);this._outlineSize=e,t?this.recreateGeometry():this._updateOutlineMaterial()}get size(){return this._size}set size(e){e!==this._size&&(this._size=e,this._updateTransform())}get outlineRenderOccluded(){return this._outlineRenderOccluded}set outlineRenderOccluded(e){this._outlineRenderOccluded=e,this._updateOutlineMaterial()}set geometry({previous:e,center:t,next:n}){this._maxSize=Math.min(i(t,e),i(t,n))/3,a(this._up,o(this._up,e,t)),a(this._right,o(this._right,n,t)),s(this._position,t),this.recreateGeometry()}_createObject3DResources(e){let t=new S(this._quadMaterialParameters),n=this._outlineSize===0?void 0:new C(this._outlineMaterialParameters,this.view.state.isGlobal);return this._createObject3DGeometries(e,t,n),{quadMaterial:t,outlineMaterial:n}}_createObject3DGeometries(e,t,n){if(c(this._up,d)&&c(this._right,d))return;let r=this._createGeometries(t,n);for(let t of r)e.addGeometry(t);this._updateTransformObject3D(e)}_createDrapedResources(){let t=new S(this._quadMaterialParameters),n=this._outlineSize===0?void 0:new C(this._outlineMaterialParameters,this.view.state.isGlobal),r=this._createGeometries(t,n).map(e=>new x(e));return this._setTransformDraped(r),{quadMaterial:t,outlineMaterial:n,geometries:r,pixelRatioHandle:e(()=>this.view.state.contentPixelRatio,()=>this.drapedResources.recreateGeometry())}}_createGeometries(e,t){let{up:n,right:r,corner:i}=this._getVertices(),a=E(n,r,i,e);return t?[a,b(t,[n,i,r])]:[a]}_getVertices(){let e=this._up,t=this._right,n=l(m.get(),e,t);return this.isDraped&&(e=s(m.get(),e),t=s(m.get(),t),e[2]=0,t[2]=0,n[2]=0),{up:e,right:t,corner:n}}_updateTransform(){this.isDraped?this.drapedResources.recreateGeometry():this._updateTransformObject3D()}_updateTransformObject3D(e=this.object3dResources.object){if(!e)return;let r=this.view.state.camera,i=this._size*r.computeScreenPixelSizeAt(this._position),a=Math.min(this._maxSize,i);t(D,this._position),n(D,D,[a,a,a]),e.transformation=D}_setTransformDraped(e){if(e.length===0)return;let{view:{overlayManager:r,state:{contentPixelRatio:i}}}=this,{_position:a,_size:o}=this,c=s(m.get(),a);c[2]=_;let l=O;l.spatialReference=r.spatialReference,l.x=c[0],l.y=c[1];let u=o*(this.view.overlayPixelSizeInMapUnits(l)*i),d=Math.min(this._maxSize,u);t(D,c),n(D,D,[d,d,1]);for(let t of e)t.transformation=D}get _quadMaterialParameters(){return{color:this._color,forceTransparentMode:!0,writeDepth:!1,polygonOffset:1,renderOccluded:this._renderOccluded,isDecoration:this.isDecoration,testsTransparentRenderOrder:this._transparentRenderOrder}}_updateQuadMaterial(){this.object3dResources.resources?.quadMaterial.setParameters(this._quadMaterialParameters),this.drapedResources.resources?.quadMaterial.setParameters(this._quadMaterialParameters)}get _outlineMaterialParameters(){return{color:this._outlineColor,width:this._outlineSize,renderOccluded:this._outlineRenderOccluded,testsTransparentRenderOrder:this._transparentRenderOrder,isDecoration:this.isDecoration}}_updateOutlineMaterial(){this.object3dResources.resources?.outlineMaterial?.setParameters(this._outlineMaterialParameters),this.drapedResources.resources?.outlineMaterial?.setParameters(this._outlineMaterialParameters)}}function T(e){e.pixelRatioHandle.remove(),e.geometries=[]}function E(e,t,n,r){return new y(r,[[`position`,new v([0,0,0,...t,...e,...n],[0,1,2,1,2,3],3,!0)]])}const D=r(),O=h(0,0,void 0,null);export{w as RightAngleQuadVisualElement};
2
+ import{watch as e}from"../../../../core/reactiveUtils.js";import{fromTranslation as t,scale as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{distance as i,normalize as a,subtract as o,copy as s,exactEquals as c,add as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as u,ZEROS as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{copy as f}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as p}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{sv3d as m}from"../../../../geometry/support/vectorStacks.js";import{makeDehydratedPoint as h}from"../../../../layers/graphics/dehydratedPoint.js";import{EngineVisualElement as g}from"./EngineVisualElement.js";import{drapedZ as _}from"../../terrain/DrapedZ.js";import{Attribute as v}from"../../webgl-engine/lib/Attribute.js";import{Geometry as y}from"../../webgl-engine/lib/Geometry.js";import{createPolylineGeometry as b}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderGeometry as x}from"../../webgl-engine/lib/RenderGeometry.js";import{ColorMaterial as S}from"../../webgl-engine/materials/ColorMaterial.js";import{RibbonLineMaterial as C}from"../../webgl-engine/materials/RibbonLineMaterial.js";class w extends g{constructor(e){super(e),this._maxSize=0,this._position=u(),this._up=u(),this._right=u(),this._renderOccluded=4,this._color=p(1,0,0,1),this._outlineColor=p(0,0,0,1),this._outlineSize=0,this._size=32,this._outlineRenderOccluded=16,this.applyProperties(e)}createObject3DResourceFactory(e){return{view:e,createResources:e=>this._createObject3DResources(e),destroyResources:()=>{},cameraChanged:()=>this._updateTransformObject3D(),forEachMaterial:(e,t)=>{t(e.outlineMaterial),t(e.quadMaterial)}}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:T,forEachMaterial:(e,t)=>{t(e.outlineMaterial),t(e.quadMaterial)}}}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateQuadMaterial())}get transparentRenderOrder(){return this._transparentRenderOrder}set transparentRenderOrder(e){this._transparentRenderOrder=e,this._updateOutlineMaterial(),this._updateQuadMaterial()}get isDecoration(){return this._isDecoration}set isDecoration(e){this._isDecoration=e,this._updateOutlineMaterial(),this._updateQuadMaterial()}get color(){return this._color}set color(e){f(this._color,e),this._updateQuadMaterial()}get outlineColor(){return this._outlineColor}set outlineColor(e){f(this._outlineColor,e),this._updateOutlineMaterial()}get outlineSize(){return this._outlineSize}set outlineSize(e){let t=this._outlineSize===0!=(e===0);this._outlineSize=e,t?this.recreateGeometry():this._updateOutlineMaterial()}get size(){return this._size}set size(e){e!==this._size&&(this._size=e,this._updateTransform())}get outlineRenderOccluded(){return this._outlineRenderOccluded}set outlineRenderOccluded(e){this._outlineRenderOccluded=e,this._updateOutlineMaterial()}set geometry({previous:e,center:t,next:n}){this._maxSize=Math.min(i(t,e),i(t,n))/3,a(this._up,o(this._up,e,t)),a(this._right,o(this._right,n,t)),s(this._position,t),this.recreateGeometry()}_createObject3DResources(e){let t=new S(this._quadMaterialParameters),n=this._outlineSize===0?void 0:new C(this._outlineMaterialParameters,this.view);return this._createObject3DGeometries(e,t,n),{quadMaterial:t,outlineMaterial:n}}_createObject3DGeometries(e,t,n){if(c(this._up,d)&&c(this._right,d))return;let r=this._createGeometries(t,n);for(let t of r)e.addGeometry(t);this._updateTransformObject3D(e)}_createDrapedResources(){let t=new S(this._quadMaterialParameters),n=this._outlineSize===0?void 0:new C(this._outlineMaterialParameters,this.view),r=this._createGeometries(t,n).map(e=>new x(e));return this._setTransformDraped(r),{quadMaterial:t,outlineMaterial:n,geometries:r,pixelRatioHandle:e(()=>this.view.state.contentPixelRatio,()=>this.drapedResources.recreateGeometry())}}_createGeometries(e,t){let{up:n,right:r,corner:i}=this._getVertices(),a=E(n,r,i,e);return t?[a,b(t,[n,i,r])]:[a]}_getVertices(){let e=this._up,t=this._right,n=l(m.get(),e,t);return this.isDraped&&(e=s(m.get(),e),t=s(m.get(),t),e[2]=0,t[2]=0,n[2]=0),{up:e,right:t,corner:n}}_updateTransform(){this.isDraped?this.drapedResources.recreateGeometry():this._updateTransformObject3D()}_updateTransformObject3D(e=this.object3dResources.object){if(!e)return;let r=this.view.state.camera,i=this._size*r.computeScreenPixelSizeAt(this._position),a=Math.min(this._maxSize,i);t(D,this._position),n(D,D,[a,a,a]),e.transformation=D}_setTransformDraped(e){if(e.length===0)return;let{view:{overlayManager:r,state:{contentPixelRatio:i}}}=this,{_position:a,_size:o}=this,c=s(m.get(),a);c[2]=_;let l=O;l.spatialReference=r.spatialReference,l.x=c[0],l.y=c[1];let u=o*(this.view.overlayPixelSizeInMapUnits(l)*i),d=Math.min(this._maxSize,u);t(D,c),n(D,D,[d,d,1]);for(let t of e)t.transformation=D}get _quadMaterialParameters(){return{color:this._color,forceTransparentMode:!0,writeDepth:!1,polygonOffset:1,renderOccluded:this._renderOccluded,isDecoration:this.isDecoration,testsTransparentRenderOrder:this._transparentRenderOrder}}_updateQuadMaterial(){this.object3dResources.resources?.quadMaterial.setParameters(this._quadMaterialParameters),this.drapedResources.resources?.quadMaterial.setParameters(this._quadMaterialParameters)}get _outlineMaterialParameters(){return{color:this._outlineColor,width:this._outlineSize,renderOccluded:this._outlineRenderOccluded,testsTransparentRenderOrder:this._transparentRenderOrder,isDecoration:this.isDecoration}}_updateOutlineMaterial(){this.object3dResources.resources?.outlineMaterial?.setParameters(this._outlineMaterialParameters),this.drapedResources.resources?.outlineMaterial?.setParameters(this._outlineMaterialParameters)}}function T(e){e.pixelRatioHandle.remove(),e.geometries=[]}function E(e,t,n,r){return new y(r,[[`position`,new v([0,0,0,...t,...e,...n],[0,1,2,1,2,3],3,!0)]])}const D=r(),O=h(0,0,void 0,null);export{w as RightAngleQuadVisualElement};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{equals as t}from"../../../core/arrayUtils.js";import"../../../core/has.js";import{removeMaybe as n,abortMaybe as r}from"../../../core/maybe.js";import{debounce as i,throwIfAborted as a,ignoreAbortErrors as o}from"../../../core/promiseUtils.js";import{watch as s,sync as c,when as l,whenOnce as ee}from"../../../core/reactiveUtils.js";import{addFrameTask as u}from"../../../core/scheduling.js";import{signal as d}from"../../../core/signal.js";import{Seconds as f,secondsFromMilliseconds as te}from"../../../core/time.js";import{property as p,subclass as m}from"../../../core/accessorSupport/decorators.js";import{projectOrLoad as h}from"../../../geometry/projectionUtils.js";import ne from"../../../geometry/SpatialReference.js";import{toExtent as g,fromExtent as _,intersection as re,create as ie,intersects as v}from"../../../geometry/support/aaBoundingRect.js";import{isInEffectiveScaleRange as y}from"../../../geometry/support/scaleUtils.js";import{getInfo as b}from"../../../geometry/support/spatialReferenceUtils.js";import x from"../../../symbols/support/ElevationInfo.js";import S from"./SubView3D.js";import{getFeatureTileId as C}from"./support/FeatureTileDescriptor.js";import{makeScheduleFunction as w}from"./support/makeScheduleFunction.js";import{debugFlags as T}from"../support/debugFlags.js";import{tileFilterDistance as E,scaleThresholdForLoadingAllTiles as D,defaultTransitionDuration as O,transitionDurationFactor as k,seamlessTransitionEnabled as A,densityFactor as j,loadAllTilesDensityFactor as M,averageLoadingTimeSmoothingFactor as N,fadeOutTime as P,fadeInTime as F,minimumTracingResolution as I}from"../support/flow/constants.js";import{isFullExtent as L,wrappedWidth as ae,FlowQuery3D as R}from"../support/flow/FlowQuery3D.js";import{FlowWorkerHandle as z}from"../support/flow/FlowWorkerHandle.js";import{materialParametersFromRenderer as B,createStreamlineGeometry as V}from"../support/flow/geometryUtils.js";import{boundingRectOfTiles as H}from"../support/flow/loadUtils.js";import{StreamlineResources3DOverlay as U}from"../support/flow/StreamlineResources3DOverlay.js";import{StreamlineResources3DShape as W}from"../support/flow/StreamlineResources3DShape.js";import{webMercatorWorldExtent as G}from"../terrain/TerrainConst.js";import{descendantsAtLevel as K,tilesAreRelated as q}from"../terrain/tileUtils.js";import{isScreenSizePerspectiveEnabled as J}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{RibbonLineMaterial as oe}from"../webgl-engine/materials/RibbonLineMaterial.js";import{hasLayerBasedScaleVisibility as se}from"../../support/layerViewUtils.js";import{TaskPriority as ce}from"../../support/Scheduler.js";import{simulationSettingsEqual as le,getPositions as ue,getFlowSimulationSettings as Y}from"../../support/flow/utils.js";let X=class extends S{constructor(e){super(e),this.type=`flow`,this.renderedTiles=null,this.tilesIntersectDataBounds=!0,this.requireLoad=!1,this.workerHandle=null,this.frameTask=null,this._averageLoadingTime=f(0),this._abortController=null,this._loadingState=`ready-to-load`,this._tilesUpdateIsWaiting=!1,this._debugAllowAutoLoading=d(!0),this.emissiveStrength=0,this._materialParametersOverridde=null,this._suspendedOverride=null,this._simulationSettingsOverride=null,this._seamlessTransitionEnabledOverride=null,this._updateTask=null,this._debouncedTileUpdate=i(async e=>{let{allTiles:t}=this.surface,n=this._getTileFilterFunction(),{_dataBounds:r}=this,i=new Set,o=!1;function*s(e){for(let a=0;a<t.length;++a){let s=t.at(a),c=Z(r,s.extent);n(s)&&c&&(i.add(s),o=!0),e.madeProgress(),e.done&&(e=yield)}}await this.frameTask.scheduleGenerator(s,e.signal),a(e.signal),this.tilesIntersectDataBounds=t.length===0||this.loadAllTiles?!0:o,this.renderedTiles=i})}initialize(){let{surface:e,view:t}=this,{resourceController:n}=t;this.workerHandle=new z(w(n)),this.frameTask=n.scheduler.registerTask(ce.FLOW_GENERATOR),this._updateTask=u({update:()=>this._update()}),this.addHandles([s(()=>this._simulationSettings,()=>this.triggerLoad(),{sync:!0,equals:(e,t)=>e==null&&t==null||e!=null&&t!=null&&le(e,t)}),this.updatingHandles.add(()=>this.suspended,e=>{e?this._suspend():this._resume()},c),s(()=>{let{elevationInfo:e}=this;return[this._clippingArea,this.visible,this._draped,this.view.state.contentPixelRatio,this.view.viewingMode,e?.mode,e?.offset,e?.unit,this._effectiveDensity]},()=>this.triggerLoad(),c),l(()=>!this._animationsEnabled,()=>{let{_resources:e,_lastResources:t}=this;e!=null&&(e.startTime=Q),t!=null&&(t.startTime=Q)},c),s(()=>this._materialParameters,e=>{this._resources?.setMaterialParameters(e),this._lastResources?.setMaterialParameters(e)}),l(()=>e.allTilesCreated,()=>this._triggerTilesUpdate(),c),t.enableFeatureTiles(),s(()=>[this._dataBounds,this._featureTilesBounds,this.loadAllTiles],()=>this._triggerTilesUpdate()),s(()=>this._flowRenderer,(e,t)=>{let n=t?.visualVariables??[],r=e?.visualVariables??[];r.length===n.length&&r.every((e,t)=>e.type===n[t].type)||this.clear()}),l(()=>!t.featureTiles?.updating,()=>{this._triggerTilesUpdate()})]),this.suspended&&this._suspend(),this._triggerTilesUpdate()}destroy(){this._updateTask=n(this._updateTask),this.abort(),this.clear(),this.notifyChange(`updating`)}abort(){this._abortController=r(this._abortController),this._tilesUpdateIsWaiting=!1,this.requireLoad=!1}_ensureAbortController(){return this._abortController??=new AbortController,this._abortController}_resume(){this._updateTask.resume(),this._triggerTilesUpdate(),this.triggerLoad()}_suspend(){this._updateTask.pause(),this.abort(),this.clear()}get _animationsEnabled(){return this.view.state.animationsEnabled}get _clippingArea(){let e=h(this.view.clippingArea,this.surface.spatialReference).geometry;return e==null?null:_(e)}get _dataBounds(){let e=this._fullExtentSurfaceSpatialReference;return e==null?null:_(e)}get suspended(){return this._suspendedOverride==null?this.layerView.suspended||this.view.groundView.hasTerrainReplacement:this._suspendedOverride}get _fullExtentSurfaceSpatialReference(){return h(this.layer.fullExtent,this.surface.spatialReference).geometry}get _draped(){return this.elevationInfo.mode===`on-the-ground`}get extent(){if(this.loadAllTiles)return $(this._fullExtentSurfaceSpatialReference);let{spatialReference:e}=this.surface,t=this.renderedTiles;if(e==null||t==null)return null;let n=this.view.terrainLevel;if(n!=null){let e=new Set;t.forEach(t=>{Math.abs(n-t.level)<E&&e.add(t)}),t=e}let r=H(t,this.spatialReferenceInfo);return r==null?null:(re(r,this._clippingArea,r),$(g(r,e)))}get loadAllTiles(){return this.view.scale>(T.FLOW_GLOBAL_SCALE_THRESHOLD??D)}get isDataGlobal(){let{extent:e,spatialReferenceInfo:t}=this;return e!=null&&L(e.xmin,e.xmax,t)}get loadAllTilesLevel(){let{tilingScheme:e}=this.surface;return Math.min(Math.ceil(e.levelAtScale(T.FLOW_GLOBAL_SCALE_THRESHOLD??D)),e.getMaxLod())}get targetTiles(){let e=new Map;if(this.loadAllTiles){let{_dataBounds:t}=this;if(t==null)return e;let n=ie(),r=this.loadAllTilesLevel,i=this.surface.tilingScheme,a=i.rootTilesInExtent(t).values().flatMap(e=>K(e,r));for(let o of a){let[a,s,c]=o;i.getExtent(r,s,c,n),Z(t,n)&&e.set(C(r,s,c),o)}return e}let{renderedTiles:t}=this;for(let n of t??[])e.set(n.key,n.lij);return e}get _featureTilesBounds(){let e=this.view.featureTiles?.filterExtent,t=h(e,this.surface.spatialReference).geometry;return t==null?null:_(t)}get _flowRenderer(){let e=this.layer.renderer;return e?.type===`flow`?e:null}get _materialParameters(){return{...B(this._flowRenderer,this.layerView.fullOpacity,this.emissiveStrength),...this._materialParametersOverridde,hasSlicePlane:this.layerView.slicePlaneEnabled,screenSizePerspective:!this._draped&&`screenSizePerspectiveEnabled`in this.layer&&J(this.layer.screenSizePerspectiveEnabled)?this.view.screenSizePerspective.parameters:null}}get _opacity(){return this.layerView.fullOpacity}get _seamlessTransitionWaitingTime(){let{_averageLoadingTime:e}=this;return f(e===0?O:this._averageLoadingTime*k)}get _transitionEnabled(){return this.view.qualitySettings.flow.transitionEnabled}get _seamlessTransitionEnabled(){return this._transitionEnabled?this._seamlessTransitionEnabledOverride==null?A:this._seamlessTransitionEnabledOverride:!1}get _tracingResolution(){let{extent:e}=this;if(!e)return[0,0];let t=ae(e.xmin,e.xmax,this.spatialReferenceInfo?.valid)/(e.ymax-e.ymin),[n,r]=this.view.size,i,a;n<r?(i=n,a=n/t):(i=r*t,a=r);let o=I,s=this.view.qualitySettings.flow.maxTracingResolution,c=Math.max(1,o/Math.min(i,a)),l=c*Math.min(1,s/Math.max(i*c,a*c));return[Math.round(i*l),Math.round(a*l)]}get visible(){let e=this._flowRenderer?.color;return this.visibleAtCurrentScale&&this.layer.effectiveVisible&&this._opacity>0&&(e==null||e.a>0)}get _effectiveDensity(){let{_simulationSettings:e}=this;if(e==null)return 0;let t=e.density*this.view.quality;return e.lineSpacing/Math.sqrt(t)<e.lineCollisionWidth?(e.lineSpacing/e.lineCollisionWidth)**2:t}get elevationInfo(){return(`elevationInfo`in this.layer?this.layer.elevationInfo:void 0)??fe}startPositions(e){if(!this._seamlessTransitionEnabled)return[];let{_flowRenderer:t,_resources:n}=this;return t==null||n==null?[]:ue(n.streamlines,n.query,e,t.flowSpeed)}get needsMagnitude(){return this._flowRenderer?.hasVisualVariables()??!1}get spatialReferenceInfo(){return b(this.surface.spatialReference)}get loadingState(){return this._loadingState}get loadRequirementsMet(){return this.renderedTiles!=null&&(this.renderedTiles.size>0||this.loadAllTiles)&&this.extent!=null}hasWork(){return this.updatingHandles.updating||this.requireLoad||this._loadingState===`before-transition`}get updating(){return this._debugAllowAutoLoading.value&&this.visible&&!(this.destroyed||this.destroying)&&this.hasWork()}get visibleAtCurrentScale(){return!se()||y(this.layer.effectiveScaleRange,this.view.scale)}get _simulationSettings(){let{_flowRenderer:e,_simulationSettingsOverride:t}=this;if(e==null)return null;let n=Y(e);return n.segmentLength=n.lineCollisionWidth/2,n.onlyForwardTracing=!1,n.maxNumberOfStreamlines=this.view.qualitySettings.flow.maxTotalNumberOfStreamlines,n.density*=j,this.loadAllTiles&&this.isDataGlobal&&(n.density*=M),t!=null&&(n={...n,...t}),n}getSimulationSettings(e){let{_simulationSettings:t,spatialReferenceInfo:n}=this;if(t==null)return null;let r=this.view.viewingMode===`global`&&n!=null&&L(e.extent.xmin,e.extent.xmax,n);return{...t,wrapAround:r,density:this._effectiveDensity}}get surface(){return this.view.basemapTerrain}doRefresh(){}clear(){this._resources?.detach(),this._resources=null,this._lastResources?.detach(),this._lastResources=null,this.tilesIntersectDataBounds=!0,this._loadingState=`ready-to-load`}_update(){let e=this._time;this._lastResources?.hasFadedOut(e)&&this._lastResources.detach();let t=this._nextStateForTransition(e);if(!this.requireLoad||this.updatingHandles.updating||t!==`ready-to-load`||!this.loadRequirementsMet){this._loadingState=t,this.tilesIntersectDataBounds||(this.requireLoad=!1);return}this._loadingState=`loading`,this.updatingHandles.consumePromise(o((async()=>{let t=this._time,n=this._seamlessTransitionEnabled&&this._resources!=null?f(e+this._seamlessTransitionWaitingTime):e;await this._load(n);let r=f((this._time-t)/1e3);this._updateAverageLoadingTime(r)})())),this.requireLoad=!1}_updateAverageLoadingTime(e){let t=N;this._averageLoadingTime=f(t*e+(1-t)*this._averageLoadingTime)}triggerLoad(){if(!this.suspended&&this._debugAllowAutoLoading.value){if(!this.visible){this.clear();return}this.requireLoad=!0}}get _time(){return te(this.layerView.view.stage.renderer.renderContext.time)}async _load(e){let{extent:t,view:n}=this;if(!this.visible){this.clear();return}if(t==null){this._loadingState=`ready-to-load`;return}this._transitionEnabled||(this._lastResources?.detach(),this._lastResources=null,this._resources?.detach(),this._resources=null);let r=new R(t,this.layerView.timeExtent,this._tracingResolution,n.state.contentPixelRatio,e),i=this._ensureAbortController();try{let t=await this._loadStreamlines(r,i.signal);if(a(i.signal),t!=null){this._lastResources?.detach(),this._lastResources=this._resources,this._resources=t;let n=this._getStartTime(e);this._lastResources!=null&&(this._lastResources.endTime=n),this._resources.startTime=n,this._animationsEnabled||(this._lastResources?.detach(),this._lastResources=null),await t.attach(),this.suspended&&this.clear(),a(i.signal),this._loadingState=this._seamlessTransitionEnabled?`before-transition`:`transitioning`}else this._loadingState=`ready-to-load`}catch{this._loadingState=`ready-to-load`}}async _loadStreamlines(e,t){let n=await this.fetchDataAndGenerateStreamlines(e,t);if(n==null)return null;let{geometries:r,material:i}=await this._createGeometry(e,n,t);return this._draped?new U(e,n,i,r,this.layerView):new W(e,n,i,r,this.view)}async fetchDataAndGenerateStreamlines(e,t){return null}async _createGeometry(e,t,n){let r=new oe(this._materialParameters,this.view.state.isGlobal),i=[],{elevationInfo:o,_draped:s,view:c}=this;function*l(n){for(let a=0;a<t.length;++a)i.push(V(c,e,t[a],o,r,s)),n.madeProgress(),n.done&&(n=yield)}return await this.frameTask.scheduleGenerator(l,n),a(n),{geometries:i,material:r}}_triggerTilesUpdate(){if(this.suspended||this._tilesUpdateIsWaiting)return;this._tilesUpdateIsWaiting=!0;let e=this._ensureAbortController();this.updatingHandles.consumePromise(o((async()=>{try{await ee(()=>this.view.stationary),a(e.signal),await this._debouncedTileUpdate(e)}finally{this._tilesUpdateIsWaiting=!1}})()))}_getTileFilterFunction(){let{view:e,_featureTilesBounds:n,loadAllTiles:r}=this;if(r){let{loadAllTilesLevel:e}=this;return t=>t.level===e}let i=e=>e.rendered&&e.visible,{featureTiles:a}=e;if(!a)return i;let o=a.tiles.filter(e=>e.measures.visible);return e=>i(e)&&Z(n,e.extent)&&o.some(({lij:n})=>t(n,e.lij)||q(n,e.lij))}_nextStateForTransition(e){let{_resources:t}=this;if(this._flowRenderer==null||t==null||this._loadingState===`ready-to-load`||this._loadingState===`loading`)return this._loadingState;let n=t.startTime,r=n+P;return e<n?`before-transition`:e<r?`transitioning`:`ready-to-load`}_getStartTime(e){if(!this._animationsEnabled)return Q;let t=this._time;return f(t>e?t:e)}get usedMemory(){return(this._lastResources?.usedMemory??0)+(this._resources?.usedMemory??0)}get test(){}};e([p()],X.prototype,`type`,void 0),e([p()],X.prototype,`renderedTiles`,void 0),e([p()],X.prototype,`_resources`,void 0),e([p()],X.prototype,`_lastResources`,void 0),e([p()],X.prototype,`tilesIntersectDataBounds`,void 0),e([p()],X.prototype,`requireLoad`,void 0),e([p()],X.prototype,`_averageLoadingTime`,void 0),e([p()],X.prototype,`_loadingState`,void 0),e([p()],X.prototype,`emissiveStrength`,void 0),e([p()],X.prototype,`_animationsEnabled`,null),e([p()],X.prototype,`_clippingArea`,null),e([p()],X.prototype,`_dataBounds`,null),e([p()],X.prototype,`suspended`,null),e([p()],X.prototype,`_fullExtentSurfaceSpatialReference`,null),e([p()],X.prototype,`_draped`,null),e([p()],X.prototype,`extent`,null),e([p()],X.prototype,`loadAllTiles`,null),e([p()],X.prototype,`isDataGlobal`,null),e([p()],X.prototype,`loadAllTilesLevel`,null),e([p()],X.prototype,`targetTiles`,null),e([p()],X.prototype,`_featureTilesBounds`,null),e([p()],X.prototype,`_flowRenderer`,null),e([p()],X.prototype,`_materialParameters`,null),e([p()],X.prototype,`_opacity`,null),e([p()],X.prototype,`_seamlessTransitionWaitingTime`,null),e([p()],X.prototype,`_transitionEnabled`,null),e([p()],X.prototype,`_seamlessTransitionEnabled`,null),e([p()],X.prototype,`_tracingResolution`,null),e([p()],X.prototype,`visible`,null),e([p()],X.prototype,`_effectiveDensity`,null),e([p()],X.prototype,`elevationInfo`,null),e([p()],X.prototype,`needsMagnitude`,null),e([p()],X.prototype,`spatialReferenceInfo`,null),e([p()],X.prototype,`loadingState`,null),e([p()],X.prototype,`updating`,null),e([p()],X.prototype,`visibleAtCurrentScale`,null),e([p()],X.prototype,`_materialParametersOverridde`,void 0),e([p()],X.prototype,`_suspendedOverride`,void 0),e([p()],X.prototype,`_simulationSettingsOverride`,void 0),e([p()],X.prototype,`_seamlessTransitionEnabledOverride`,void 0),e([p()],X.prototype,`_simulationSettings`,null),e([p()],X.prototype,`surface`,null),X=e([m(`esri.views.3d.layers.FlowSubView3D`)],X);const de=X,fe=new x({mode:`on-the-ground`});function Z(e,t){return e==null||t==null||v(e,t)}const pe=g(G,ne.WebMercator),Q=f(-F);function $(e){return e!=null&&e.spatialReference.isWebMercator?e?.intersection(pe):e}export{de as default};
2
+ import{__decorate as e}from"tslib";import{equals as t}from"../../../core/arrayUtils.js";import"../../../core/has.js";import{removeMaybe as n,abortMaybe as r}from"../../../core/maybe.js";import{debounce as i,throwIfAborted as a,ignoreAbortErrors as o}from"../../../core/promiseUtils.js";import{watch as s,sync as c,when as l,whenOnce as ee}from"../../../core/reactiveUtils.js";import{addFrameTask as u}from"../../../core/scheduling.js";import{signal as d}from"../../../core/signal.js";import{Seconds as f,secondsFromMilliseconds as te}from"../../../core/time.js";import{property as p,subclass as m}from"../../../core/accessorSupport/decorators.js";import{projectOrLoad as h}from"../../../geometry/projectionUtils.js";import ne from"../../../geometry/SpatialReference.js";import{toExtent as g,fromExtent as _,intersection as re,create as ie,intersects as v}from"../../../geometry/support/aaBoundingRect.js";import{isInEffectiveScaleRange as y}from"../../../geometry/support/scaleUtils.js";import{getInfo as b}from"../../../geometry/support/spatialReferenceUtils.js";import x from"../../../symbols/support/ElevationInfo.js";import S from"./SubView3D.js";import{getFeatureTileId as C}from"./support/FeatureTileDescriptor.js";import{makeScheduleFunction as w}from"./support/makeScheduleFunction.js";import{debugFlags as T}from"../support/debugFlags.js";import{tileFilterDistance as E,scaleThresholdForLoadingAllTiles as D,defaultTransitionDuration as O,transitionDurationFactor as k,seamlessTransitionEnabled as A,densityFactor as j,loadAllTilesDensityFactor as M,averageLoadingTimeSmoothingFactor as N,fadeOutTime as P,fadeInTime as F,minimumTracingResolution as I}from"../support/flow/constants.js";import{isFullExtent as L,wrappedWidth as ae,FlowQuery3D as R}from"../support/flow/FlowQuery3D.js";import{FlowWorkerHandle as z}from"../support/flow/FlowWorkerHandle.js";import{materialParametersFromRenderer as B,createStreamlineGeometry as V}from"../support/flow/geometryUtils.js";import{boundingRectOfTiles as H}from"../support/flow/loadUtils.js";import{StreamlineResources3DOverlay as U}from"../support/flow/StreamlineResources3DOverlay.js";import{StreamlineResources3DShape as W}from"../support/flow/StreamlineResources3DShape.js";import{webMercatorWorldExtent as G}from"../terrain/TerrainConst.js";import{descendantsAtLevel as K,tilesAreRelated as q}from"../terrain/tileUtils.js";import{isScreenSizePerspectiveEnabled as J}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{RibbonLineMaterial as oe}from"../webgl-engine/materials/RibbonLineMaterial.js";import{hasLayerBasedScaleVisibility as se}from"../../support/layerViewUtils.js";import{TaskPriority as ce}from"../../support/Scheduler.js";import{simulationSettingsEqual as le,getPositions as ue,getFlowSimulationSettings as Y}from"../../support/flow/utils.js";let X=class extends S{constructor(e){super(e),this.type=`flow`,this.renderedTiles=null,this.tilesIntersectDataBounds=!0,this.requireLoad=!1,this.workerHandle=null,this.frameTask=null,this._averageLoadingTime=f(0),this._abortController=null,this._loadingState=`ready-to-load`,this._tilesUpdateIsWaiting=!1,this._debugAllowAutoLoading=d(!0),this.emissiveStrength=0,this._materialParametersOverridde=null,this._suspendedOverride=null,this._simulationSettingsOverride=null,this._seamlessTransitionEnabledOverride=null,this._updateTask=null,this._debouncedTileUpdate=i(async e=>{let{allTiles:t}=this.surface,n=this._getTileFilterFunction(),{_dataBounds:r}=this,i=new Set,o=!1;function*s(e){for(let a=0;a<t.length;++a){let s=t.at(a),c=Z(r,s.extent);n(s)&&c&&(i.add(s),o=!0),e.madeProgress(),e.done&&(e=yield)}}await this.frameTask.scheduleGenerator(s,e.signal),a(e.signal),this.tilesIntersectDataBounds=t.length===0||this.loadAllTiles?!0:o,this.renderedTiles=i})}initialize(){let{surface:e,view:t}=this,{resourceController:n}=t;this.workerHandle=new z(w(n)),this.frameTask=n.scheduler.registerTask(ce.FLOW_GENERATOR),this._updateTask=u({update:()=>this._update()}),this.addHandles([s(()=>this._simulationSettings,()=>this.triggerLoad(),{sync:!0,equals:(e,t)=>e==null&&t==null||e!=null&&t!=null&&le(e,t)}),this.updatingHandles.add(()=>this.suspended,e=>{e?this._suspend():this._resume()},c),s(()=>{let{elevationInfo:e}=this;return[this._clippingArea,this.visible,this._draped,this.view.state.contentPixelRatio,this.view.viewingMode,e?.mode,e?.offset,e?.unit,this._effectiveDensity]},()=>this.triggerLoad(),c),l(()=>!this._animationsEnabled,()=>{let{_resources:e,_lastResources:t}=this;e!=null&&(e.startTime=Q),t!=null&&(t.startTime=Q)},c),s(()=>this._materialParameters,e=>{this._resources?.setMaterialParameters(e),this._lastResources?.setMaterialParameters(e)}),l(()=>e.allTilesCreated,()=>this._triggerTilesUpdate(),c),t.enableFeatureTiles(),s(()=>[this._dataBounds,this._featureTilesBounds,this.loadAllTiles],()=>this._triggerTilesUpdate()),s(()=>this._flowRenderer,(e,t)=>{let n=t?.visualVariables??[],r=e?.visualVariables??[];r.length===n.length&&r.every((e,t)=>e.type===n[t].type)||this.clear()}),l(()=>!t.featureTiles?.updating,()=>{this._triggerTilesUpdate()})]),this.suspended&&this._suspend(),this._triggerTilesUpdate()}destroy(){this._updateTask=n(this._updateTask),this.abort(),this.clear(),this.notifyChange(`updating`)}abort(){this._abortController=r(this._abortController),this._tilesUpdateIsWaiting=!1,this.requireLoad=!1}_ensureAbortController(){return this._abortController??=new AbortController,this._abortController}_resume(){this._updateTask.resume(),this._triggerTilesUpdate(),this.triggerLoad()}_suspend(){this._updateTask.pause(),this.abort(),this.clear()}get _animationsEnabled(){return this.view.state.animationsEnabled}get _clippingArea(){let e=h(this.view.clippingArea,this.surface.spatialReference).geometry;return e==null?null:_(e)}get _dataBounds(){let e=this._fullExtentSurfaceSpatialReference;return e==null?null:_(e)}get suspended(){return this._suspendedOverride==null?this.layerView.suspended||this.view.groundView.hasTerrainReplacement:this._suspendedOverride}get _fullExtentSurfaceSpatialReference(){return h(this.layer.fullExtent,this.surface.spatialReference).geometry}get _draped(){return this.elevationInfo.mode===`on-the-ground`}get extent(){if(this.loadAllTiles)return $(this._fullExtentSurfaceSpatialReference);let{spatialReference:e}=this.surface,t=this.renderedTiles;if(e==null||t==null)return null;let n=this.view.terrainLevel;if(n!=null){let e=new Set;t.forEach(t=>{Math.abs(n-t.level)<E&&e.add(t)}),t=e}let r=H(t,this.spatialReferenceInfo);return r==null?null:(re(r,this._clippingArea,r),$(g(r,e)))}get loadAllTiles(){return this.view.scale>(T.FLOW_GLOBAL_SCALE_THRESHOLD??D)}get isDataGlobal(){let{extent:e,spatialReferenceInfo:t}=this;return e!=null&&L(e.xmin,e.xmax,t)}get loadAllTilesLevel(){let{tilingScheme:e}=this.surface;return Math.min(Math.ceil(e.levelAtScale(T.FLOW_GLOBAL_SCALE_THRESHOLD??D)),e.getMaxLod())}get targetTiles(){let e=new Map;if(this.loadAllTiles){let{_dataBounds:t}=this;if(t==null)return e;let n=ie(),r=this.loadAllTilesLevel,i=this.surface.tilingScheme,a=i.rootTilesInExtent(t).values().flatMap(e=>K(e,r));for(let o of a){let[a,s,c]=o;i.getExtent(r,s,c,n),Z(t,n)&&e.set(C(r,s,c),o)}return e}let{renderedTiles:t}=this;for(let n of t??[])e.set(n.key,n.lij);return e}get _featureTilesBounds(){let e=this.view.featureTiles?.filterExtent,t=h(e,this.surface.spatialReference).geometry;return t==null?null:_(t)}get _flowRenderer(){let e=this.layer.renderer;return e?.type===`flow`?e:null}get _materialParameters(){return{...B(this._flowRenderer,this.layerView.fullOpacity,this.emissiveStrength),...this._materialParametersOverridde,hasSlicePlane:this.layerView.slicePlaneEnabled,screenSizePerspective:!this._draped&&`screenSizePerspectiveEnabled`in this.layer&&J(this.layer.screenSizePerspectiveEnabled)?this.view.screenSizePerspective.parameters:null}}get _opacity(){return this.layerView.fullOpacity}get _seamlessTransitionWaitingTime(){let{_averageLoadingTime:e}=this;return f(e===0?O:this._averageLoadingTime*k)}get _transitionEnabled(){return this.view.qualitySettings.flow.transitionEnabled}get _seamlessTransitionEnabled(){return this._transitionEnabled?this._seamlessTransitionEnabledOverride==null?A:this._seamlessTransitionEnabledOverride:!1}get _tracingResolution(){let{extent:e}=this;if(!e)return[0,0];let t=ae(e.xmin,e.xmax,this.spatialReferenceInfo?.valid)/(e.ymax-e.ymin),[n,r]=this.view.size,i,a;n<r?(i=n,a=n/t):(i=r*t,a=r);let o=I,s=this.view.qualitySettings.flow.maxTracingResolution,c=Math.max(1,o/Math.min(i,a)),l=c*Math.min(1,s/Math.max(i*c,a*c));return[Math.round(i*l),Math.round(a*l)]}get visible(){let e=this._flowRenderer?.color;return this.visibleAtCurrentScale&&this.layer.effectiveVisible&&this._opacity>0&&(e==null||e.a>0)}get _effectiveDensity(){let{_simulationSettings:e}=this;if(e==null)return 0;let t=e.density*this.view.quality;return e.lineSpacing/Math.sqrt(t)<e.lineCollisionWidth?(e.lineSpacing/e.lineCollisionWidth)**2:t}get elevationInfo(){return(`elevationInfo`in this.layer?this.layer.elevationInfo:void 0)??fe}startPositions(e){if(!this._seamlessTransitionEnabled)return[];let{_flowRenderer:t,_resources:n}=this;return t==null||n==null?[]:ue(n.streamlines,n.query,e,t.flowSpeed)}get needsMagnitude(){return this._flowRenderer?.hasVisualVariables()??!1}get spatialReferenceInfo(){return b(this.surface.spatialReference)}get loadingState(){return this._loadingState}get loadRequirementsMet(){return this.renderedTiles!=null&&(this.renderedTiles.size>0||this.loadAllTiles)&&this.extent!=null}hasWork(){return this.updatingHandles.updating||this.requireLoad||this._loadingState===`before-transition`}get updating(){return this._debugAllowAutoLoading.value&&this.visible&&!(this.destroyed||this.destroying)&&this.hasWork()}get visibleAtCurrentScale(){return!se()||y(this.layer.effectiveScaleRange,this.view.scale)}get _simulationSettings(){let{_flowRenderer:e,_simulationSettingsOverride:t}=this;if(e==null)return null;let n=Y(e);return n.segmentLength=n.lineCollisionWidth/2,n.onlyForwardTracing=!1,n.maxNumberOfStreamlines=this.view.qualitySettings.flow.maxTotalNumberOfStreamlines,n.density*=j,this.loadAllTiles&&this.isDataGlobal&&(n.density*=M),t!=null&&(n={...n,...t}),n}getSimulationSettings(e){let{_simulationSettings:t,spatialReferenceInfo:n}=this;if(t==null)return null;let r=this.view.viewingMode===`global`&&n!=null&&L(e.extent.xmin,e.extent.xmax,n);return{...t,wrapAround:r,density:this._effectiveDensity}}get surface(){return this.view.basemapTerrain}doRefresh(){}clear(){this._resources?.detach(),this._resources=null,this._lastResources?.detach(),this._lastResources=null,this.tilesIntersectDataBounds=!0,this._loadingState=`ready-to-load`}_update(){let e=this._time;this._lastResources?.hasFadedOut(e)&&this._lastResources.detach();let t=this._nextStateForTransition(e);if(!this.requireLoad||this.updatingHandles.updating||t!==`ready-to-load`||!this.loadRequirementsMet){this._loadingState=t,this.tilesIntersectDataBounds||(this.requireLoad=!1);return}this._loadingState=`loading`,this.updatingHandles.consumePromise(o((async()=>{let t=this._time,n=this._seamlessTransitionEnabled&&this._resources!=null?f(e+this._seamlessTransitionWaitingTime):e;await this._load(n);let r=f((this._time-t)/1e3);this._updateAverageLoadingTime(r)})())),this.requireLoad=!1}_updateAverageLoadingTime(e){let t=N;this._averageLoadingTime=f(t*e+(1-t)*this._averageLoadingTime)}triggerLoad(){if(!this.suspended&&this._debugAllowAutoLoading.value){if(!this.visible){this.clear();return}this.requireLoad=!0}}get _time(){return te(this.layerView.view.stage.renderer.renderContext.time)}async _load(e){let{extent:t,view:n}=this;if(!this.visible){this.clear();return}if(t==null){this._loadingState=`ready-to-load`;return}this._transitionEnabled||(this._lastResources?.detach(),this._lastResources=null,this._resources?.detach(),this._resources=null);let r=new R(t,this.layerView.timeExtent,this._tracingResolution,n.state.contentPixelRatio,e),i=this._ensureAbortController();try{let t=await this._loadStreamlines(r,i.signal);if(a(i.signal),t!=null){this._lastResources?.detach(),this._lastResources=this._resources,this._resources=t;let n=this._getStartTime(e);this._lastResources!=null&&(this._lastResources.endTime=n),this._resources.startTime=n,this._animationsEnabled||(this._lastResources?.detach(),this._lastResources=null),await t.attach(),this.suspended&&this.clear(),a(i.signal),this._loadingState=this._seamlessTransitionEnabled?`before-transition`:`transitioning`}else this._loadingState=`ready-to-load`}catch{this._loadingState=`ready-to-load`}}async _loadStreamlines(e,t){let n=await this.fetchDataAndGenerateStreamlines(e,t);if(n==null)return null;let{geometries:r,material:i}=await this._createGeometry(e,n,t);return this._draped?new U(e,n,i,r,this.layerView):new W(e,n,i,r,this.view)}async fetchDataAndGenerateStreamlines(e,t){return null}async _createGeometry(e,t,n){let r=new oe(this._materialParameters,this.view),i=[],{elevationInfo:o,_draped:s,view:c}=this;function*l(n){for(let a=0;a<t.length;++a)i.push(V(c,e,t[a],o,r,s)),n.madeProgress(),n.done&&(n=yield)}return await this.frameTask.scheduleGenerator(l,n),a(n),{geometries:i,material:r}}_triggerTilesUpdate(){if(this.suspended||this._tilesUpdateIsWaiting)return;this._tilesUpdateIsWaiting=!0;let e=this._ensureAbortController();this.updatingHandles.consumePromise(o((async()=>{try{await ee(()=>this.view.stationary),a(e.signal),await this._debouncedTileUpdate(e)}finally{this._tilesUpdateIsWaiting=!1}})()))}_getTileFilterFunction(){let{view:e,_featureTilesBounds:n,loadAllTiles:r}=this;if(r){let{loadAllTilesLevel:e}=this;return t=>t.level===e}let i=e=>e.rendered&&e.visible,{featureTiles:a}=e;if(!a)return i;let o=a.tiles.filter(e=>e.measures.visible);return e=>i(e)&&Z(n,e.extent)&&o.some(({lij:n})=>t(n,e.lij)||q(n,e.lij))}_nextStateForTransition(e){let{_resources:t}=this;if(this._flowRenderer==null||t==null||this._loadingState===`ready-to-load`||this._loadingState===`loading`)return this._loadingState;let n=t.startTime,r=n+P;return e<n?`before-transition`:e<r?`transitioning`:`ready-to-load`}_getStartTime(e){if(!this._animationsEnabled)return Q;let t=this._time;return f(t>e?t:e)}get usedMemory(){return(this._lastResources?.usedMemory??0)+(this._resources?.usedMemory??0)}get test(){}};e([p()],X.prototype,`type`,void 0),e([p()],X.prototype,`renderedTiles`,void 0),e([p()],X.prototype,`_resources`,void 0),e([p()],X.prototype,`_lastResources`,void 0),e([p()],X.prototype,`tilesIntersectDataBounds`,void 0),e([p()],X.prototype,`requireLoad`,void 0),e([p()],X.prototype,`_averageLoadingTime`,void 0),e([p()],X.prototype,`_loadingState`,void 0),e([p()],X.prototype,`emissiveStrength`,void 0),e([p()],X.prototype,`_animationsEnabled`,null),e([p()],X.prototype,`_clippingArea`,null),e([p()],X.prototype,`_dataBounds`,null),e([p()],X.prototype,`suspended`,null),e([p()],X.prototype,`_fullExtentSurfaceSpatialReference`,null),e([p()],X.prototype,`_draped`,null),e([p()],X.prototype,`extent`,null),e([p()],X.prototype,`loadAllTiles`,null),e([p()],X.prototype,`isDataGlobal`,null),e([p()],X.prototype,`loadAllTilesLevel`,null),e([p()],X.prototype,`targetTiles`,null),e([p()],X.prototype,`_featureTilesBounds`,null),e([p()],X.prototype,`_flowRenderer`,null),e([p()],X.prototype,`_materialParameters`,null),e([p()],X.prototype,`_opacity`,null),e([p()],X.prototype,`_seamlessTransitionWaitingTime`,null),e([p()],X.prototype,`_transitionEnabled`,null),e([p()],X.prototype,`_seamlessTransitionEnabled`,null),e([p()],X.prototype,`_tracingResolution`,null),e([p()],X.prototype,`visible`,null),e([p()],X.prototype,`_effectiveDensity`,null),e([p()],X.prototype,`elevationInfo`,null),e([p()],X.prototype,`needsMagnitude`,null),e([p()],X.prototype,`spatialReferenceInfo`,null),e([p()],X.prototype,`loadingState`,null),e([p()],X.prototype,`updating`,null),e([p()],X.prototype,`visibleAtCurrentScale`,null),e([p()],X.prototype,`_materialParametersOverridde`,void 0),e([p()],X.prototype,`_suspendedOverride`,void 0),e([p()],X.prototype,`_simulationSettingsOverride`,void 0),e([p()],X.prototype,`_seamlessTransitionEnabledOverride`,void 0),e([p()],X.prototype,`_simulationSettings`,null),e([p()],X.prototype,`surface`,null),X=e([m(`esri.views.3d.layers.FlowSubView3D`)],X);const de=X,fe=new x({mode:`on-the-ground`});function Z(e,t){return e==null||t==null||v(e,t)}const pe=g(G,ne.WebMercator),Q=f(-F);function $(e){return e!=null&&e.spatialReference.isWebMercator?e?.intersection(pe):e}export{de as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../../core/Error.js";import has from"../../../../core/has.js";import{pt2px as t,px2pt as n}from"../../../../core/screenUtils.js";import{fromValues as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{copy as i}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{ZEROS as a,clone as o,ones as s}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as c,fromBuffer as l,intersectsClippingArea as u,empty as d,expandWithAABB as f,expandWithBuffer as p}from"../../../../geometry/support/aaBoundingBox.js";import{getDriverAxisSizeValueAny as m}from"../../../../renderers/support/renderingInfoUtils.js";import{getTransformationType as h}from"../../../../renderers/visualVariables/support/sizeVariableUtils.js";import{sharedGeometryElevationAligner as g}from"./ElevationAligners.js";import{elevationModeChangeUpdateType as _,needsElevationUpdates2D as v}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as y}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as b}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as x,nanFallbackColor as S}from"./Graphics3DSymbolLayer.js";import{parseCapType as C,computeSymbolLayerIndex as w,parseLineMarkerStyle as T}from"./lineUtils.js";import{initFastSymbolUpdatesState as E,updateFastSymbolUpdatesState as D,getAttributeValue as O,getSizeAttributeValue as k,ConvertOptions as A}from"../support/FastSymbolUpdates.js";import{debugFlags as j}from"../../support/debugFlags.js";import{createGeometry as M}from"../../support/engineContent/line.js";import{geometryToRenderInfo as N,geometryToRenderInfoDraped as P}from"../../support/renderInfoUtils/line.js";import{Object3D as F}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as I}from"../../webgl-engine/lib/RenderGeometry.js";import{LineMarkerMaterial as L}from"../../webgl-engine/materials/LineMarkerMaterial.js";import{getStipplePatternForLinePattern as R,patternHidesLine as z}from"../../webgl-engine/materials/lineStippleUtils.js";import{RibbonLineMaterial as B}from"../../webgl-engine/materials/RibbonLineMaterial.js";const V=[`polyline`],H=n(1);class U extends x{static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,n,r){super(e,t,n,r,K(t))}async doLoad(){if(this._fastUpdates=E(this._context.renderer,this._fastVisualVariableConvertOptions()),this._fastMarkerUpdates=E(this._context.renderer,this._fastVisualVariableConvertOptions(!0)),!this._drivenProperties.size&&(this.symbolLayer.size==null?H:this.symbolLayer.size)<0)throw new e(`graphics3dlinesymbollayer:invalid-size`,`Symbol sizes may not be negative values`)}_getMaterialParameters(e,t){let n=this._screenSizePerspective,r=!!has(`enable-feature:emissive-on-non-volumetric`)&&!this.draped,{symbolLayer:i}=this,{worldSized:a}=this.symbol,o={...this._getMaterialColorParameters(t),shadingEnabled:r,width:this._computeMaterialWidth(i.size,a),worldSized:a,polygonOffset:3,polygonOffsetIndex:w(this._renderPriority,this._renderPriorityStep),join:i.join||`miter`,cap:C(i.cap||`butt`),hasSlicePlane:this._context.slicePlaneEnabled,isClosed:e,stipplePattern:R(i.pattern??i.imagePattern),emissiveStrength:this._emissiveStrength,screenSizePerspective:n};if(t===2){if(this._fastMarkerUpdates?.visualVariables)return{...o,...this._fastMarkerUpdates.materialParameters}}else if(this._fastUpdates?.visualVariables)return{...o,...this._fastUpdates.materialParameters};return o}_getMaterialColorParameters(e){let t=e===2,n=this._getCombinedOpacityAndColor(t&&this._markerColor||this._materialColor);return this._patternHidesLine&&!t&&(n[3]=0),{color:n}}get _materialColor(){return this.symbolLayer.material?.color}get _emissiveStrength(){let e=this.symbolLayer.material?.emissive;return(e?.source===`color`?e?.strength:void 0)??0}get _markerColor(){return this.symbolLayer.marker?.color}get _lineMaterial(){return this._materials[0]??=new B(this._getMaterialParameters(!1,0),this.view.state.isGlobal),this._materials[0]}get _wireframeLineMaterial(){return this._materials[1]??=new B({...this._getMaterialParameters(!1,1),wireframe:!0},this.view.state.isGlobal),this._materials[1]}get _markerMaterial(){return this._materials[2]==null&&this.symbolLayer.marker!=null&&(this._materials[2]=new L({...this._getMaterialParameters(!1,2),placement:this.symbolLayer.marker.placement,markerPrimitive:T(this.symbolLayer.marker.style)},this.view.state.isGlobal)),this._materials[2]}_getDrivenSize(e){if(this._drivenProperties.size){let t=e.size;if(t==null)return this._getFallbackSize();let n=m(t.output);return this._getWorldOrScreenSize(n)}return 1}_getDrivenColor({color:e,opacity:t}){let n=s();return this._drivenProperties.color&&(i(n,e?.output??this._getFallbackOpacityAndColor(a)),t==null)||this._drivenProperties.opacity&&(e||this._materialColor)&&(n[3]=t?.output??this._getFallbackOpacity()),n}_getDrivenMarkerColor({color:e,opacity:t}){let n=s();return this._drivenProperties.color&&(i(n,e?.output??this._getFallbackMarkerOpacityAndColor(a)),t==null)||this._drivenProperties.opacity&&(e||this._markerColor||this._materialColor)&&(n[3]=t?.output??this._getFallbackMarkerOpacity()),n}createGraphics3DGraphic(e){let t=e.graphic;if(!this._validatePolylineContext(e))return null;this._warnIfVVRequiresWorldSized(e.renderingInfo);let n=this.createElevationContextForGraphic(t),r=n.mode===`on-the-ground`;return this.ensureDrapedStatus(r),this.draped?this._createAsOverlay(e):this._createAs3DShape(e,n,t.uid)}_validatePolylineContext(e){let t=e.graphic.geometry;return this._validateGeometry(t,V,this.symbolLayer.type)&&t.type===`polyline`}applyRendererDiff(e,t){for(let n in e.diff)switch(n){case`visualVariables`:{let e=this._fastUpdates;if(D(e,t,this._fastVisualVariableConvertOptions()))for(let t of this._materials)t instanceof B&&t.setParameters(e.materialParameters);else return 0;let n=this._fastMarkerUpdates;if(D(n,t,this._fastVisualVariableConvertOptions(!0)))for(let e of this._materials)e instanceof L&&e.setParameters(n.materialParameters);else return 0}break;default:return 0}return`visualVariables`in e.diff&&this._warnIfVVRequiresWorldSized(),2}_warnIfVVRequiresWorldSized(e){if(this.symbol.worldSized||this.ignoreDrivers)return;let t=this._getSizeVariable(e);t==null||t.useSymbolValue||t.target===`outline`||h(t)===`real-world-size`&&this.logger.warnOnce(`SizeVariable uses real-world units, but LineSymbol3D.worldSized is false. Set LineSymbol3D.worldSized to true to render real-world line widths.`)}_getSizeVariable(e){let t=this._fastUpdates?.visualVariables.size;if(t)return t.variables[0];let n=e?.size,r=n?.output.findIndex(e=>typeof e==`number`);return r==null?null:n?.variables[r]}prepareSymbolLayerPatch(e){if(e.diff.type!==`partial`)return;let t=e.diff.diff,n={};t.size?.type===`complete`&&(n.width=this._computeMaterialWidth(t.size.newValue,this.symbol.worldSized),delete t.size),t.cap?.type===`complete`&&(n.cap=C(t.cap.newValue??`butt`),delete t.cap);let r=this._prepareMarkerPatch(e,t);this._prepareMaterialPatch(e,t,r),e.symbolLayerStatePatches.push(()=>{for(let e of this._materials)e?.setParameters(n)})}layerOpacityChanged(){for(let e=0;e<3;e++)this._materials[e]?.setParameters(this._getMaterialColorParameters(e))}get _screenSizePerspective(){return!this.draped&&this._context.screenSizePerspectiveEnabled?this.view.screenSizePerspective.parameters:null}layerScreenSizePerspectiveChanged(){let e=this._screenSizePerspective;for(let t of this._materials)t?.setParameters({screenSizePerspective:e})}layerElevationInfoChanged(e,t,n){let r=this._elevationContext.mode,i=_(U.elevationModeChangeTypes,n,r);if(i!==1)return i;let a=v(r);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>a)}slicePlaneEnabledChanged(){let e={hasSlicePlane:this._context.slicePlaneEnabled};for(let t of this._materials)t?.setParameters(e);return!0}physicalBasedRenderingChanged(){return!0}_createAs3DShape(e,t,n){let r=e.graphic,i=W(r.geometry);if(i==null)return null;let a=[],o=c(),s=N(i,this._context.elevationProvider,this._context.renderCoordsHelper,t);this._logGeometryCreationWarnings(s,i.paths,`paths`,`LineSymbol3DLayer`);for(let t=0;t<s.lines.length;t++){let r=s.lines[t],c=r.position,d=r.mapPositions;if(this._context.clippingExtent!=null&&(l(d,o),!u(o,this._context.clippingExtent)))continue;let f=this._createGeometry(this._lineMaterial,e,c,d,i.type,1,n);if(a.push(f),j.LINE_WIREFRAMES&&a.push(f.instantiate({material:this._wireframeLineMaterial})),this._markerMaterial!=null){let t=f.instantiate({material:this._markerMaterial});t.attributes.has(`color`)&&t.setAttributeData(`color`,this._getDrivenMarkerColor(e.renderingInfo)),a.push(t)}}if(a.length===0)return null;let d=this._context.layerViewUid,f=new F({geometries:a,castShadow:!1,layerViewUid:d,graphicUid:n}),p=new b(this,f,null,g,t);return p.alignedSampledElevation=s.sampledElevation,p.needsElevationUpdates=v(t.mode),p}_createGeometry(e,t,n,r,i,a,o){let s=a===0?{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper}:null,c=i===`polygon`,l=this._fastUpdates?.visualVariables.color,u=this._fastUpdates?.visualVariables.size,d=this._fastUpdates?.visualVariables.opacity,f=this._context.layerViewUid,p=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:o,layerViewUid:f}),{renderingInfo:m}=t,h={position:n,size:u?null:this._getDrivenSize(m),color:l?null:this._getDrivenColor(m),sizeFeature:u?k(u,m.size):null,colorFeature:l?O(l,m.color):null,opacityFeature:d?O(d,m.opacity):null};return M(e,{overlayInfo:s,removeDuplicateStartEnd:c,mapPositions:r,attributeData:h},p)}_createAsOverlay(e){let t=e.graphic,{geometry:n}=t;this._lineMaterial.renderPriority=this._renderPriority;let r=j.LINE_WIREFRAMES?this._wireframeLineMaterial:null,i=this._markerMaterial;r!=null&&(r.renderPriority=this._renderPriority-.001),i!=null&&(i.renderPriority=this._renderPriority-.002);let a=[],o=c(),s=d(),m=P(n,this._context.overlaySR);this._logGeometryCreationWarnings(m,n.paths,`paths`,`LineSymbol3DLayer`);for(let c of m.lines){if(l(c.position,o),!u(o,this._context.clippingExtent))continue;f(s,o);let d=this._createGeometry(this._lineMaterial,e,c.position,void 0,n.type,0,t.uid),m=e=>{let n=this._context.layerViewUid,r=new I(e,{layerViewUid:n,graphicUid:t.uid});a.push(r)};if(i!=null){let t=d.instantiate({material:i});t.attributes.has(`color`)&&t.setAttributeData(`color`,this._getDrivenMarkerColor(e.renderingInfo)),m(t);let n=this.symbolLayer.marker.placement;(n===`begin`||n===`begin-end`)&&p(o,c.position,0,1),(n===`end`||n===`begin-end`)&&p(o,c.position,c.position.length-3,1)}m(d),j.LINE_WIREFRAMES&&m(d.instantiate({material:r}))}return new y(this,a,s,this._context.drapeSourceRenderer)}get _patternHidesLine(){return z(this.symbolLayer.pattern)}_computeMaterialWidth(e,n){return n?this._drivenProperties.size?1:e??1:(e??=H,this._drivenProperties.size?this._fastUpdates?.visualVariables.size?t(1):1:t(e))}_prepareMaterialPatch(e,t,n){let r=t.material;if(r==null){n.changed&&n.useMaterialColor&&G(this._getCombinedOpacityAndColor(this._materialColor),this._materials[2],e);return}if(r.type===`collection`)return;let i=r.type===`complete`?r.newValue?.color:r.diff.color?.type===`complete`?r.diff.color.newValue:null,a=this._getCombinedOpacityAndColor(i);n.useMaterialColor&&G(o(a),this._materials[2],e),this._patternHidesLine&&(a[3]=0),G(a,this._materials[0],e),delete t.material}_prepareMarkerPatch(e,t){let n=t.marker,r=this._markerMaterial;if(n==null||n.type!==`partial`||n.diff==null||n.diff.placement!=null||n.diff.style!=null&&n.diff.style.type!==`complete`||n.diff.color!=null&&n.diff.color.type!==`complete`||r==null)return{changed:!1,useMaterialColor:this._markerColor==null};let i=n.diff.color,a=i!=null,o=a?i.newValue:null,s=o==null&&this._markerColor==null;o&&G(this._getCombinedOpacityAndColor(o),r,e);let c=n.diff.style?.newValue;return c&&e.symbolLayerStatePatches.push(()=>r.setParameters({markerPrimitive:T(c)})),delete t.marker,{changed:a,useMaterialColor:s}}_fastVisualVariableConvertOptions(e=!1){let t=this._getFallbackSize(),{size:n}=this.symbolLayer;return new A({supports:{size:!0,color:!0,rotation:!1,opacity:!0},symbolSize:r(n,n,n),fallbackColor:e?this._getFallbackMarkerOpacityAndColor(S):this._getFallbackOpacityAndColor(S),fallbackSize:r(t,t,t)})}_getFallbackOpacityAndColor(e){return this._materialColor?.toUnitRGBA()??e}_getFallbackOpacity(){return this._materialColor?.a??0}_getFallbackMarkerOpacityAndColor(e){return this.symbolLayer.marker?.color?.toUnitRGBA()??this._getFallbackOpacityAndColor(e)}_getFallbackMarkerOpacity(){return this.symbolLayer.marker?.color?.a??this._getFallbackOpacity()}_getWorldOrScreenSize(e){return this.symbol.worldSized?e:t(e)}_getFallbackSize(){return this._getWorldOrScreenSize(this.symbolLayer.size)}}function W(e){return e.type===`polyline`?e:null}function G(e,t,n){t!=null&&n.symbolLayerStatePatches.push(()=>t.setParameters({color:e}))}function K(e){return(e.material?.color?.a??1)===1&&(e.marker?.color?.a??1)===1}export{U as Graphics3DLineSymbolLayer};
2
+ import e from"../../../../core/Error.js";import has from"../../../../core/has.js";import{pt2px as t,px2pt as n}from"../../../../core/screenUtils.js";import{fromValues as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{copy as i}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{ZEROS as a,clone as o,ones as s}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as c,fromBuffer as l,intersectsClippingArea as u,empty as d,expandWithAABB as f,expandWithBuffer as p}from"../../../../geometry/support/aaBoundingBox.js";import{getDriverAxisSizeValueAny as m}from"../../../../renderers/support/renderingInfoUtils.js";import{getTransformationType as h}from"../../../../renderers/visualVariables/support/sizeVariableUtils.js";import{sharedGeometryElevationAligner as g}from"./ElevationAligners.js";import{elevationModeChangeUpdateType as _,needsElevationUpdates2D as v}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as y}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as b}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as x,nanFallbackColor as S}from"./Graphics3DSymbolLayer.js";import{parseCapType as C,computeSymbolLayerIndex as w,parseLineMarkerStyle as T}from"./lineUtils.js";import{initFastSymbolUpdatesState as E,updateFastSymbolUpdatesState as D,getAttributeValue as O,getSizeAttributeValue as k,ConvertOptions as A}from"../support/FastSymbolUpdates.js";import{debugFlags as j}from"../../support/debugFlags.js";import{createGeometry as M}from"../../support/engineContent/line.js";import{geometryToRenderInfo as N,geometryToRenderInfoDraped as P}from"../../support/renderInfoUtils/line.js";import{Object3D as F}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as I}from"../../webgl-engine/lib/RenderGeometry.js";import{LineMarkerMaterial as L}from"../../webgl-engine/materials/LineMarkerMaterial.js";import{getStipplePatternForLinePattern as R,patternHidesLine as z}from"../../webgl-engine/materials/lineStippleUtils.js";import{RibbonLineMaterial as B}from"../../webgl-engine/materials/RibbonLineMaterial.js";const V=[`polyline`],H=n(1);class U extends x{static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,n,r){super(e,t,n,r,K(t))}async doLoad(){if(this._fastUpdates=E(this._context.renderer,this._fastVisualVariableConvertOptions()),this._fastMarkerUpdates=E(this._context.renderer,this._fastVisualVariableConvertOptions(!0)),!this._drivenProperties.size&&(this.symbolLayer.size==null?H:this.symbolLayer.size)<0)throw new e(`graphics3dlinesymbollayer:invalid-size`,`Symbol sizes may not be negative values`)}_getMaterialParameters(e,t){let n=this._screenSizePerspective,r=!!has(`enable-feature:emissive-on-non-volumetric`)&&!this.draped,{symbolLayer:i}=this,{worldSized:a}=this.symbol,o={...this._getMaterialColorParameters(t),shadingEnabled:r,width:this._computeMaterialWidth(i.size,a),worldSized:a,polygonOffset:3,polygonOffsetIndex:w(this._renderPriority,this._renderPriorityStep),join:i.join||`miter`,cap:C(i.cap||`butt`),hasSlicePlane:this._context.slicePlaneEnabled,isClosed:e,stipplePattern:R(i.pattern??i.imagePattern),emissiveStrength:this._emissiveStrength,screenSizePerspective:n};if(t===2){if(this._fastMarkerUpdates?.visualVariables)return{...o,...this._fastMarkerUpdates.materialParameters}}else if(this._fastUpdates?.visualVariables)return{...o,...this._fastUpdates.materialParameters};return o}_getMaterialColorParameters(e){let t=e===2,n=this._getCombinedOpacityAndColor(t&&this._markerColor||this._materialColor);return this._patternHidesLine&&!t&&(n[3]=0),{color:n}}get _materialColor(){return this.symbolLayer.material?.color}get _emissiveStrength(){let e=this.symbolLayer.material?.emissive;return(e?.source===`color`?e?.strength:void 0)??0}get _markerColor(){return this.symbolLayer.marker?.color}get _lineMaterial(){return this._materials[0]??=new B(this._getMaterialParameters(!1,0),this.view),this._materials[0]}get _wireframeLineMaterial(){return this._materials[1]??=new B({...this._getMaterialParameters(!1,1),wireframe:!0},this.view),this._materials[1]}get _markerMaterial(){return this._materials[2]==null&&this.symbolLayer.marker!=null&&(this._materials[2]=new L({...this._getMaterialParameters(!1,2),placement:this.symbolLayer.marker.placement,markerPrimitive:T(this.symbolLayer.marker.style)},this.view.state.isGlobal)),this._materials[2]}_getDrivenSize(e){if(this._drivenProperties.size){let t=e.size;if(t==null)return this._getFallbackSize();let n=m(t.output);return this._getWorldOrScreenSize(n)}return 1}_getDrivenColor({color:e,opacity:t}){let n=s();return this._drivenProperties.color&&(i(n,e?.output??this._getFallbackOpacityAndColor(a)),t==null)||this._drivenProperties.opacity&&(e||this._materialColor)&&(n[3]=t?.output??this._getFallbackOpacity()),n}_getDrivenMarkerColor({color:e,opacity:t}){let n=s();return this._drivenProperties.color&&(i(n,e?.output??this._getFallbackMarkerOpacityAndColor(a)),t==null)||this._drivenProperties.opacity&&(e||this._markerColor||this._materialColor)&&(n[3]=t?.output??this._getFallbackMarkerOpacity()),n}createGraphics3DGraphic(e){let t=e.graphic;if(!this._validatePolylineContext(e))return null;this._warnIfVVRequiresWorldSized(e.renderingInfo);let n=this.createElevationContextForGraphic(t),r=n.mode===`on-the-ground`;return this.ensureDrapedStatus(r),this.draped?this._createAsOverlay(e):this._createAs3DShape(e,n,t.uid)}_validatePolylineContext(e){let t=e.graphic.geometry;return this._validateGeometry(t,V,this.symbolLayer.type)&&t.type===`polyline`}applyRendererDiff(e,t){for(let n in e.diff)switch(n){case`visualVariables`:{let e=this._fastUpdates;if(D(e,t,this._fastVisualVariableConvertOptions()))for(let t of this._materials)t instanceof B&&t.setParameters(e.materialParameters);else return 0;let n=this._fastMarkerUpdates;if(D(n,t,this._fastVisualVariableConvertOptions(!0)))for(let e of this._materials)e instanceof L&&e.setParameters(n.materialParameters);else return 0}break;default:return 0}return`visualVariables`in e.diff&&this._warnIfVVRequiresWorldSized(),2}_warnIfVVRequiresWorldSized(e){if(this.symbol.worldSized||this.ignoreDrivers)return;let t=this._getSizeVariable(e);t==null||t.useSymbolValue||t.target===`outline`||h(t)===`real-world-size`&&this.logger.warnOnce(`SizeVariable uses real-world units, but LineSymbol3D.worldSized is false. Set LineSymbol3D.worldSized to true to render real-world line widths.`)}_getSizeVariable(e){let t=this._fastUpdates?.visualVariables.size;if(t)return t.variables[0];let n=e?.size,r=n?.output.findIndex(e=>typeof e==`number`);return r==null?null:n?.variables[r]}prepareSymbolLayerPatch(e){if(e.diff.type!==`partial`)return;let t=e.diff.diff,n={};t.size?.type===`complete`&&(n.width=this._computeMaterialWidth(t.size.newValue,this.symbol.worldSized),delete t.size),t.cap?.type===`complete`&&(n.cap=C(t.cap.newValue??`butt`),delete t.cap);let r=this._prepareMarkerPatch(e,t);this._prepareMaterialPatch(e,t,r),e.symbolLayerStatePatches.push(()=>{for(let e of this._materials)e?.setParameters(n)})}layerOpacityChanged(){for(let e=0;e<3;e++)this._materials[e]?.setParameters(this._getMaterialColorParameters(e))}get _screenSizePerspective(){return!this.draped&&this._context.screenSizePerspectiveEnabled?this.view.screenSizePerspective.parameters:null}layerScreenSizePerspectiveChanged(){let e=this._screenSizePerspective;for(let t of this._materials)t?.setParameters({screenSizePerspective:e})}layerElevationInfoChanged(e,t,n){let r=this._elevationContext.mode,i=_(U.elevationModeChangeTypes,n,r);if(i!==1)return i;let a=v(r);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>a)}slicePlaneEnabledChanged(){let e={hasSlicePlane:this._context.slicePlaneEnabled};for(let t of this._materials)t?.setParameters(e);return!0}physicalBasedRenderingChanged(){return!0}_createAs3DShape(e,t,n){let r=e.graphic,i=W(r.geometry);if(i==null)return null;let a=[],o=c(),s=N(i,this._context.elevationProvider,this._context.renderCoordsHelper,t);this._logGeometryCreationWarnings(s,i.paths,`paths`,`LineSymbol3DLayer`);for(let t=0;t<s.lines.length;t++){let r=s.lines[t],c=r.position,d=r.mapPositions;if(this._context.clippingExtent!=null&&(l(d,o),!u(o,this._context.clippingExtent)))continue;let f=this._createGeometry(this._lineMaterial,e,c,d,i.type,1,n);if(a.push(f),j.LINE_WIREFRAMES&&a.push(f.instantiate({material:this._wireframeLineMaterial})),this._markerMaterial!=null){let t=f.instantiate({material:this._markerMaterial});t.attributes.has(`color`)&&t.setAttributeData(`color`,this._getDrivenMarkerColor(e.renderingInfo)),a.push(t)}}if(a.length===0)return null;let d=this._context.layerViewUid,f=new F({geometries:a,castShadow:!1,layerViewUid:d,graphicUid:n}),p=new b(this,f,null,g,t);return p.alignedSampledElevation=s.sampledElevation,p.needsElevationUpdates=v(t.mode),p}_createGeometry(e,t,n,r,i,a,o){let s=a===0?{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper}:null,c=i===`polygon`,l=this._fastUpdates?.visualVariables.color,u=this._fastUpdates?.visualVariables.size,d=this._fastUpdates?.visualVariables.opacity,f=this._context.layerViewUid,p=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:o,layerViewUid:f}),{renderingInfo:m}=t,h={position:n,size:u?null:this._getDrivenSize(m),color:l?null:this._getDrivenColor(m),sizeFeature:u?k(u,m.size):null,colorFeature:l?O(l,m.color):null,opacityFeature:d?O(d,m.opacity):null};return M(e,{overlayInfo:s,removeDuplicateStartEnd:c,mapPositions:r,attributeData:h},p)}_createAsOverlay(e){let t=e.graphic,{geometry:n}=t;this._lineMaterial.renderPriority=this._renderPriority;let r=j.LINE_WIREFRAMES?this._wireframeLineMaterial:null,i=this._markerMaterial;r!=null&&(r.renderPriority=this._renderPriority-.001),i!=null&&(i.renderPriority=this._renderPriority-.002);let a=[],o=c(),s=d(),m=P(n,this._context.overlaySR);this._logGeometryCreationWarnings(m,n.paths,`paths`,`LineSymbol3DLayer`);for(let c of m.lines){if(l(c.position,o),!u(o,this._context.clippingExtent))continue;f(s,o);let d=this._createGeometry(this._lineMaterial,e,c.position,void 0,n.type,0,t.uid),m=e=>{let n=this._context.layerViewUid,r=new I(e,{layerViewUid:n,graphicUid:t.uid});a.push(r)};if(i!=null){let t=d.instantiate({material:i});t.attributes.has(`color`)&&t.setAttributeData(`color`,this._getDrivenMarkerColor(e.renderingInfo)),m(t);let n=this.symbolLayer.marker.placement;(n===`begin`||n===`begin-end`)&&p(o,c.position,0,1),(n===`end`||n===`begin-end`)&&p(o,c.position,c.position.length-3,1)}m(d),j.LINE_WIREFRAMES&&m(d.instantiate({material:r}))}return new y(this,a,s,this._context.drapeSourceRenderer)}get _patternHidesLine(){return z(this.symbolLayer.pattern)}_computeMaterialWidth(e,n){return n?this._drivenProperties.size?1:e??1:(e??=H,this._drivenProperties.size?this._fastUpdates?.visualVariables.size?t(1):1:t(e))}_prepareMaterialPatch(e,t,n){let r=t.material;if(r==null){n.changed&&n.useMaterialColor&&G(this._getCombinedOpacityAndColor(this._materialColor),this._materials[2],e);return}if(r.type===`collection`)return;let i=r.type===`complete`?r.newValue?.color:r.diff.color?.type===`complete`?r.diff.color.newValue:null,a=this._getCombinedOpacityAndColor(i);n.useMaterialColor&&G(o(a),this._materials[2],e),this._patternHidesLine&&(a[3]=0),G(a,this._materials[0],e),delete t.material}_prepareMarkerPatch(e,t){let n=t.marker,r=this._markerMaterial;if(n==null||n.type!==`partial`||n.diff==null||n.diff.placement!=null||n.diff.style!=null&&n.diff.style.type!==`complete`||n.diff.color!=null&&n.diff.color.type!==`complete`||r==null)return{changed:!1,useMaterialColor:this._markerColor==null};let i=n.diff.color,a=i!=null,o=a?i.newValue:null,s=o==null&&this._markerColor==null;o&&G(this._getCombinedOpacityAndColor(o),r,e);let c=n.diff.style?.newValue;return c&&e.symbolLayerStatePatches.push(()=>r.setParameters({markerPrimitive:T(c)})),delete t.marker,{changed:a,useMaterialColor:s}}_fastVisualVariableConvertOptions(e=!1){let t=this._getFallbackSize(),{size:n}=this.symbolLayer;return new A({supports:{size:!0,color:!0,rotation:!1,opacity:!0},symbolSize:r(n,n,n),fallbackColor:e?this._getFallbackMarkerOpacityAndColor(S):this._getFallbackOpacityAndColor(S),fallbackSize:r(t,t,t)})}_getFallbackOpacityAndColor(e){return this._materialColor?.toUnitRGBA()??e}_getFallbackOpacity(){return this._materialColor?.a??0}_getFallbackMarkerOpacityAndColor(e){return this.symbolLayer.marker?.color?.toUnitRGBA()??this._getFallbackOpacityAndColor(e)}_getFallbackMarkerOpacity(){return this.symbolLayer.marker?.color?.a??this._getFallbackOpacity()}_getWorldOrScreenSize(e){return this.symbol.worldSized?e:t(e)}_getFallbackSize(){return this._getWorldOrScreenSize(this.symbolLayer.size)}}function W(e){return e.type===`polyline`?e:null}function G(e,t,n){t!=null&&n.symbolLayerStatePatches.push(()=>t.setParameters({color:e}))}function K(e){return(e.material?.color?.a??1)===1&&(e.marker?.color?.a??1)===1}export{U as Graphics3DLineSymbolLayer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{pt2px as e}from"../../../../core/screenUtils.js";import{ZEROS as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromBuffer as n,intersectsClippingArea as r,empty as i,expandWithAABB as a,create as o}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as s,doubleSubArray as c}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as l}from"../../../../geometry/support/FloatArray.js";import{getContinuousIndexArray as u}from"../../../../geometry/support/Indices.js";import{isDrivenOpacityFallbackAlwaysOpaque as d}from"../../../../renderers/visualVariables/support/visualVariableUtils.js";import{elevationModeChangeUpdateType as f,needsElevationUpdates2D as p}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as m}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as h}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as g}from"./Graphics3DSymbolLayer.js";import{mixinColorAndOpacity as _}from"./graphicUtils.js";import{parseCapType as v,computeSymbolLayerIndex as y}from"./lineUtils.js";import{geometryAsPolygon as b,createColorGeometry as x,PolygonCreationDataBase as S}from"./polygonUtils.js";import{initFastSymbolUpdatesState as C,updateFastSymbolUpdatesState as w,getAttributeValue as T,ConvertOptions as E}from"../support/FastSymbolUpdates.js";import{createMaterial as D,uvElevationAligner as O}from"../support/patternUtils.js";import{writeMapSpaceUVCoordsPerConnectedPart as k,writeMapSpaceUVCoordsDraped as A}from"../support/uvUtils.js";import{createGeometry as j}from"../../support/engineContent/line.js";import{loadTessellationUtils as M,preloadedPolygonToRenderInfoElevationAligned as N,preloadedPolygonToRenderInfoDraped as P}from"../../support/renderInfoUtils/polygon.js";import{Object3D as F}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as I}from"../../webgl-engine/lib/RenderGeometry.js";import{isScreenSizePerspectiveEnabled as L}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{getStipplePatternForLinePattern as R}from"../../webgl-engine/materials/lineStippleUtils.js";import{PatternMaterial as z}from"../../webgl-engine/materials/PatternMaterial.js";import{RibbonLineMaterial as B}from"../../webgl-engine/materials/RibbonLineMaterial.js";const V=[`polyline`,`polygon`,`extent`];class H extends g{static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,n,r){super(e,t,n,r,d(t)),this._needsUV=!1,this._materials=[]}async doLoad(){this._fastUpdates=C(this._context.renderer,this._vvConvertOptions),await M()}get _materialColor(){return this.symbolLayer.material?.color}get _emissiveStrength(){let e=this.symbolLayer.material?.emissive;return(e?.source===`color`?e?.strength:void 0)??0}_createMaterials(){if(this._materials.length>0)return;let{_materialColor:t,draped:n}=this,r=this._getCombinedOpacityAndColor(t);this._materials[0]=D(this.symbolLayer,{color:r,forceTransparentMode:this.needsDrivenTransparentPass,hasVertexColors:this._drivenProperties.color||this._drivenProperties.opacity,draped:n,hasSlicePlane:this._context.slicePlaneEnabled,emissiveStrength:this._emissiveStrength,...this._fastUpdates?.materialParameters}),this._needsUV=this._materials[0]instanceof z;let i=this.symbolLayer.outline;if(K(i)){let t=R(i.pattern),n=v(i.pattern?i.patternCap||`butt`:`square`);this._materials[1]=new B({width:e(i.size),color:this._getOutlineColor(),polygonOffset:3,polygonOffsetIndex:y(this._renderPriority,this._renderPriorityStep),hasSlicePlane:this._context.slicePlaneEnabled,isClosed:!0,stipplePattern:t,cap:n,screenSizePerspective:this._outlineScreenSizePerspective},this.view.state.isGlobal)}}get _outlineScreenSizePerspective(){return!this.draped&&L(this._context.layer.screenSizePerspectiveEnabled)?this.view.screenSizePerspective.parameters:null}createGraphics3DGraphic(e){let t=e.graphic;if(!this._validateGeometry(t.geometry,V,this.symbolLayer.type))return null;let n=this._getDrivenUInt8Color(e.renderingInfo,this._materialColor,!1),r=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus(r.mode===`on-the-ground`),this._createMaterials(),this.draped?this._createAsOverlay(e.renderingInfo,t,n):this._createAs3DShape(e.renderingInfo,t,n,r)}applyRendererDiff(e,t){for(let n in e.diff)switch(n){case`visualVariables`:if(w(this._fastUpdates,t,this._vvConvertOptions))this._materials[0]?.setParameters(this._fastUpdates.materialParameters);else return 0;break;default:return 0}return 2}layerOpacityChanged(){if(this._materials[0]!=null){let e=this._materials[0].parameters.color,t=this._materialColor,n=this._getCombinedOpacity(t);this._materials[0].setParameters({color:[e[0],e[1],e[2],n],forceTransparentMode:this.needsDrivenTransparentPass})}if(this._materials[1]!=null){let e=this._materials[1].parameters.color;this._materials[1].setParameters({color:[e[0],e[1],e[2],this._getOutlineOpacity()]})}}layerScreenSizePerspectiveChanged(){this._materials[1]?.setParameters({screenSizePerspective:this._outlineScreenSizePerspective})}layerElevationInfoChanged(e,t,n){let r=this._elevationContext.mode,i=f(H.elevationModeChangeTypes,n,r);if(i!==1)return i;let a=p(r);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>a)}slicePlaneEnabledChanged(){if(this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[1]){let e={hasSlicePlane:this._context.slicePlaneEnabled};this._materials[1].setParameters(e)}return!0}physicalBasedRenderingChanged(){return!0}_containsRenderableGeometry(e){return e.polygonIndexCount>0?!0:this._materials[1]==null?!1:e.outline.output===`vertex-data`?e.outline.outlines.length>0:e.outlineIndexCount>0}_createAs3DShape(e,t,n,r){let i=b(t.geometry);if(!i)return null;let a=N(i,this._context.elevationProvider,this._context.renderCoordsHelper,r,{projectIfNearlyVertical:!0,outlineOutput:`vertex-data`,owner:this._context.layer});if(a==null)return null;let o=new W(a,n,this._context.layerViewUid,t.uid),d=o.renderData.vertexCount;if(this._needsUV){o.uvMapSpace=l(d*4,!0),o.textureElementIndices=Array(d),o.boundingRect=s(9*(o.renderData.polygonIndices.length/3));let e=k(o.uvMapSpace,o.boundingRect,o.textureElementIndices,o.renderData.positions,o.renderData.polygonIndices,this._context.renderCoordsHelper);o.boundingRect=c(o.boundingRect,0,9*e),o.boundingRectIndices=u(e)}if(o.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(o),this._createAs3DShapeFill(e,o),this._materials[1]&&this._createAs3DShapeOutline(o),this._logGeometryCreationWarnings(o.renderData,i.rings,`rings`,`FillSymbol3DLayer`),o.outGeometries.length===0)return null;let f=new F({geometries:o.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:t.uid}),m=new h(this,f,null,O,r);return m.alignedSampledElevation=o.renderData.sampledElevation,m.needsElevationUpdates=p(r.mode),m}_createAs3DShapeFill(e,t){let{mapPositions:i,positions:a,polygonIndices:o,polygonIndexCount:s}=t.renderData;if(s===0||this._context.clippingExtent!=null&&(n(i,U),!r(U,this._context.clippingExtent)))return;let c=this._fastUpdates?.visualVariables.color,l=x({material:this._materials[0],indices:o,mapPositions:i,attributeData:{position:a,color:c?null:t.color,colorFeature:c?T(c,e.color):null,uvMapSpace:this._needsUV?t.uvMapSpace:null,boundingRect:this._needsUV?t.boundingRect:null,textureElementIndices:this._needsUV?t.textureElementIndices:null,boundingRectIndices:this._needsUV?t.boundingRectIndices:null,olidColor:t.olidColor}});t.outGeometries.push(l)}_createAs3DShapeOutline(e){if(this._materials[1]==null)return;let{outline:t}=e.renderData;if(t.output!==`vertex-data`)return;let{outlines:i}=t;if(i!=null&&i.length!==0)for(let{mapPositions:t,position:a}of i){if(this._context.clippingExtent!=null&&(n(t,U),!r(U,this._context.clippingExtent)))continue;let i=j(this._materials[1],{overlayInfo:null,removeDuplicateStartEnd:!0,mapPositions:t,attributeData:{position:a}},e.olidColor);e.outGeometries.push(i)}}_createAsOverlay(e,t,n){let r=b(t.geometry);if(r==null)return null;this._materials[0].renderPriority=this._renderPriority+this._renderPriorityStep/2,this._materials[1]!=null&&(this._materials[1].renderPriority=this._renderPriority);let a=P(r,{drapedSpatialReference:this._context.overlaySR,outlineOutput:`vertex-data`,owner:this._context.layer});if(a==null)return null;let o=new G(a,n,this._context.layerViewUid,t.uid);return this._needsUV&&(o.uvMapSpace=l(o.renderData.vertexCount*4,!0),A(o.uvMapSpace,o.renderData.positions,this._context.overlaySR,this._context.graphicsCoreOwner.view.state.viewingMode)),o.outBoundingBox=i(),o.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(o),this._createAsOverlayFill(e,o),this._materials[1]&&this._createAsOverlayOutline(o),this._logGeometryCreationWarnings(o.renderData,r.rings,`rings`,`FillSymbol3DLayer`),new m(this,o.outGeometries,o.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayFill(e,t){let{positions:i,polygonIndices:o,polygonIndexCount:s}=t.renderData;if(s===0)return;let c=n(i,U);if(!r(c,this._context.clippingExtent))return;a(t.outBoundingBox,c);let l=this._fastUpdates?.visualVariables.color,u=x({material:this._materials[0],indices:o,attributeData:{position:i,color:l?null:t.color,colorFeature:l?T(l,e.color):null,uvMapSpace:this._needsUV?t.uvMapSpace:null,olidColor:t.olidColor}});t.outGeometries.push(new I(u,t))}_createAsOverlayOutline(e){if(this._materials[1]==null)return;let{outline:t}=e.renderData;if(t.output!==`vertex-data`)return;let{outlines:i}=t;for(let{position:t}of i){if(n(t,U),!r(U,this._context.clippingExtent))continue;a(e.outBoundingBox,U);let i=j(this._materials[1],{overlayInfo:{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper},removeDuplicateStartEnd:!0,attributeData:{position:t}},e.olidColor);e.outGeometries.push(new I(i,e))}}_getOutlineOpacity(){let e=this.symbolLayer?.outline?.color;return(this.draped?1:this._getLayerOpacity())*(e==null?0:e.a)}_getOutlineColor(){let e=this.symbolLayer?.outline?.color,t=this._getOutlineOpacity();return _(e?.toUnitRGB(),t)}test(){return{...super.test(),createAsOverlay:(e,t,n)=>this._createAsOverlay(e,t,n),createAs3DShape:(e,t,n,r)=>this._createAs3DShape(e,t,n,r)}}get _vvConvertOptions(){return new E({supports:{size:!1,color:!0,rotation:!1,opacity:!1},fallbackColor:this._materialColor?.toUnitRGBA()??t})}}const U=o();class W extends S{constructor(e,t,n,r){super(e,n,r),this.color=t}}class G extends S{constructor(e,t,n,r){super(e,n,r),this.color=t}}function K(e){return e?.size!=null&&e.size>0&&e.color!=null&&(e.pattern==null||e.pattern.type!==`style`||e.pattern.style!==`none`)}export{H as Graphics3DPolygonFillSymbolLayer};
2
+ import{pt2px as e}from"../../../../core/screenUtils.js";import{ZEROS as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromBuffer as n,intersectsClippingArea as r,empty as i,expandWithAABB as a,create as o}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as s,doubleSubArray as c}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as l}from"../../../../geometry/support/FloatArray.js";import{getContinuousIndexArray as u}from"../../../../geometry/support/Indices.js";import{isDrivenOpacityFallbackAlwaysOpaque as d}from"../../../../renderers/visualVariables/support/visualVariableUtils.js";import{elevationModeChangeUpdateType as f,needsElevationUpdates2D as p}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as m}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as h}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as g}from"./Graphics3DSymbolLayer.js";import{mixinColorAndOpacity as _}from"./graphicUtils.js";import{parseCapType as v,computeSymbolLayerIndex as y}from"./lineUtils.js";import{geometryAsPolygon as b,createColorGeometry as x,PolygonCreationDataBase as S}from"./polygonUtils.js";import{initFastSymbolUpdatesState as C,updateFastSymbolUpdatesState as w,getAttributeValue as T,ConvertOptions as E}from"../support/FastSymbolUpdates.js";import{createMaterial as D,uvElevationAligner as O}from"../support/patternUtils.js";import{writeMapSpaceUVCoordsPerConnectedPart as k,writeMapSpaceUVCoordsDraped as A}from"../support/uvUtils.js";import{createGeometry as j}from"../../support/engineContent/line.js";import{loadTessellationUtils as M,preloadedPolygonToRenderInfoElevationAligned as N,preloadedPolygonToRenderInfoDraped as P}from"../../support/renderInfoUtils/polygon.js";import{Object3D as F}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as I}from"../../webgl-engine/lib/RenderGeometry.js";import{isScreenSizePerspectiveEnabled as L}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{getStipplePatternForLinePattern as R}from"../../webgl-engine/materials/lineStippleUtils.js";import{PatternMaterial as z}from"../../webgl-engine/materials/PatternMaterial.js";import{RibbonLineMaterial as B}from"../../webgl-engine/materials/RibbonLineMaterial.js";const V=[`polyline`,`polygon`,`extent`];class H extends g{static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,n,r){super(e,t,n,r,d(t)),this._needsUV=!1,this._materials=[]}async doLoad(){this._fastUpdates=C(this._context.renderer,this._vvConvertOptions),await M()}get _materialColor(){return this.symbolLayer.material?.color}get _emissiveStrength(){let e=this.symbolLayer.material?.emissive;return(e?.source===`color`?e?.strength:void 0)??0}_createMaterials(){if(this._materials.length>0)return;let{_materialColor:t,draped:n}=this,r=this._getCombinedOpacityAndColor(t);this._materials[0]=D(this.symbolLayer,{color:r,forceTransparentMode:this.needsDrivenTransparentPass,hasVertexColors:this._drivenProperties.color||this._drivenProperties.opacity,draped:n,hasSlicePlane:this._context.slicePlaneEnabled,emissiveStrength:this._emissiveStrength,...this._fastUpdates?.materialParameters}),this._needsUV=this._materials[0]instanceof z;let i=this.symbolLayer.outline;if(K(i)){let t=R(i.pattern),n=v(i.pattern?i.patternCap||`butt`:`square`);this._materials[1]=new B({width:e(i.size),color:this._getOutlineColor(),polygonOffset:3,polygonOffsetIndex:y(this._renderPriority,this._renderPriorityStep),hasSlicePlane:this._context.slicePlaneEnabled,isClosed:!0,stipplePattern:t,cap:n,screenSizePerspective:this._outlineScreenSizePerspective},this.view)}}get _outlineScreenSizePerspective(){return!this.draped&&L(this._context.layer.screenSizePerspectiveEnabled)?this.view.screenSizePerspective.parameters:null}createGraphics3DGraphic(e){let t=e.graphic;if(!this._validateGeometry(t.geometry,V,this.symbolLayer.type))return null;let n=this._getDrivenUInt8Color(e.renderingInfo,this._materialColor,!1),r=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus(r.mode===`on-the-ground`),this._createMaterials(),this.draped?this._createAsOverlay(e.renderingInfo,t,n):this._createAs3DShape(e.renderingInfo,t,n,r)}applyRendererDiff(e,t){for(let n in e.diff)switch(n){case`visualVariables`:if(w(this._fastUpdates,t,this._vvConvertOptions))this._materials[0]?.setParameters(this._fastUpdates.materialParameters);else return 0;break;default:return 0}return 2}layerOpacityChanged(){if(this._materials[0]!=null){let e=this._materials[0].parameters.color,t=this._materialColor,n=this._getCombinedOpacity(t);this._materials[0].setParameters({color:[e[0],e[1],e[2],n],forceTransparentMode:this.needsDrivenTransparentPass})}if(this._materials[1]!=null){let e=this._materials[1].parameters.color;this._materials[1].setParameters({color:[e[0],e[1],e[2],this._getOutlineOpacity()]})}}layerScreenSizePerspectiveChanged(){this._materials[1]?.setParameters({screenSizePerspective:this._outlineScreenSizePerspective})}layerElevationInfoChanged(e,t,n){let r=this._elevationContext.mode,i=f(H.elevationModeChangeTypes,n,r);if(i!==1)return i;let a=p(r);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>a)}slicePlaneEnabledChanged(){if(this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[1]){let e={hasSlicePlane:this._context.slicePlaneEnabled};this._materials[1].setParameters(e)}return!0}physicalBasedRenderingChanged(){return!0}_containsRenderableGeometry(e){return e.polygonIndexCount>0?!0:this._materials[1]==null?!1:e.outline.output===`vertex-data`?e.outline.outlines.length>0:e.outlineIndexCount>0}_createAs3DShape(e,t,n,r){let i=b(t.geometry);if(!i)return null;let a=N(i,this._context.elevationProvider,this._context.renderCoordsHelper,r,{projectIfNearlyVertical:!0,outlineOutput:`vertex-data`,owner:this._context.layer});if(a==null)return null;let o=new W(a,n,this._context.layerViewUid,t.uid),d=o.renderData.vertexCount;if(this._needsUV){o.uvMapSpace=l(d*4,!0),o.textureElementIndices=Array(d),o.boundingRect=s(9*(o.renderData.polygonIndices.length/3));let e=k(o.uvMapSpace,o.boundingRect,o.textureElementIndices,o.renderData.positions,o.renderData.polygonIndices,this._context.renderCoordsHelper);o.boundingRect=c(o.boundingRect,0,9*e),o.boundingRectIndices=u(e)}if(o.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(o),this._createAs3DShapeFill(e,o),this._materials[1]&&this._createAs3DShapeOutline(o),this._logGeometryCreationWarnings(o.renderData,i.rings,`rings`,`FillSymbol3DLayer`),o.outGeometries.length===0)return null;let f=new F({geometries:o.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:t.uid}),m=new h(this,f,null,O,r);return m.alignedSampledElevation=o.renderData.sampledElevation,m.needsElevationUpdates=p(r.mode),m}_createAs3DShapeFill(e,t){let{mapPositions:i,positions:a,polygonIndices:o,polygonIndexCount:s}=t.renderData;if(s===0||this._context.clippingExtent!=null&&(n(i,U),!r(U,this._context.clippingExtent)))return;let c=this._fastUpdates?.visualVariables.color,l=x({material:this._materials[0],indices:o,mapPositions:i,attributeData:{position:a,color:c?null:t.color,colorFeature:c?T(c,e.color):null,uvMapSpace:this._needsUV?t.uvMapSpace:null,boundingRect:this._needsUV?t.boundingRect:null,textureElementIndices:this._needsUV?t.textureElementIndices:null,boundingRectIndices:this._needsUV?t.boundingRectIndices:null,olidColor:t.olidColor}});t.outGeometries.push(l)}_createAs3DShapeOutline(e){if(this._materials[1]==null)return;let{outline:t}=e.renderData;if(t.output!==`vertex-data`)return;let{outlines:i}=t;if(i!=null&&i.length!==0)for(let{mapPositions:t,position:a}of i){if(this._context.clippingExtent!=null&&(n(t,U),!r(U,this._context.clippingExtent)))continue;let i=j(this._materials[1],{overlayInfo:null,removeDuplicateStartEnd:!0,mapPositions:t,attributeData:{position:a}},e.olidColor);e.outGeometries.push(i)}}_createAsOverlay(e,t,n){let r=b(t.geometry);if(r==null)return null;this._materials[0].renderPriority=this._renderPriority+this._renderPriorityStep/2,this._materials[1]!=null&&(this._materials[1].renderPriority=this._renderPriority);let a=P(r,{drapedSpatialReference:this._context.overlaySR,outlineOutput:`vertex-data`,owner:this._context.layer});if(a==null)return null;let o=new G(a,n,this._context.layerViewUid,t.uid);return this._needsUV&&(o.uvMapSpace=l(o.renderData.vertexCount*4,!0),A(o.uvMapSpace,o.renderData.positions,this._context.overlaySR,this._context.graphicsCoreOwner.view.state.viewingMode)),o.outBoundingBox=i(),o.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(o),this._createAsOverlayFill(e,o),this._materials[1]&&this._createAsOverlayOutline(o),this._logGeometryCreationWarnings(o.renderData,r.rings,`rings`,`FillSymbol3DLayer`),new m(this,o.outGeometries,o.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayFill(e,t){let{positions:i,polygonIndices:o,polygonIndexCount:s}=t.renderData;if(s===0)return;let c=n(i,U);if(!r(c,this._context.clippingExtent))return;a(t.outBoundingBox,c);let l=this._fastUpdates?.visualVariables.color,u=x({material:this._materials[0],indices:o,attributeData:{position:i,color:l?null:t.color,colorFeature:l?T(l,e.color):null,uvMapSpace:this._needsUV?t.uvMapSpace:null,olidColor:t.olidColor}});t.outGeometries.push(new I(u,t))}_createAsOverlayOutline(e){if(this._materials[1]==null)return;let{outline:t}=e.renderData;if(t.output!==`vertex-data`)return;let{outlines:i}=t;for(let{position:t}of i){if(n(t,U),!r(U,this._context.clippingExtent))continue;a(e.outBoundingBox,U);let i=j(this._materials[1],{overlayInfo:{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper},removeDuplicateStartEnd:!0,attributeData:{position:t}},e.olidColor);e.outGeometries.push(new I(i,e))}}_getOutlineOpacity(){let e=this.symbolLayer?.outline?.color;return(this.draped?1:this._getLayerOpacity())*(e==null?0:e.a)}_getOutlineColor(){let e=this.symbolLayer?.outline?.color,t=this._getOutlineOpacity();return _(e?.toUnitRGB(),t)}test(){return{...super.test(),createAsOverlay:(e,t,n)=>this._createAsOverlay(e,t,n),createAs3DShape:(e,t,n,r)=>this._createAs3DShape(e,t,n,r)}}get _vvConvertOptions(){return new E({supports:{size:!1,color:!0,rotation:!1,opacity:!1},fallbackColor:this._materialColor?.toUnitRGBA()??t})}}const U=o();class W extends S{constructor(e,t,n,r){super(e,n,r),this.color=t}}class G extends S{constructor(e,t,n,r){super(e,n,r),this.color=t}}function K(e){return e?.size!=null&&e.size>0&&e.color!=null&&(e.pattern==null||e.pattern.type!==`style`||e.pattern.style!==`none`)}export{H as Graphics3DPolygonFillSymbolLayer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{handlesGroup as e}from"../../../core/handleUtils.js";import{watch as t,initial as n}from"../../../core/reactiveUtils.js";import r from"../../../geometry/Extent.js";import{projectOrLoad as i}from"../../../geometry/projectionUtils.js";import{projectBoundingRect as a}from"../../../geometry/projection/projectBoundingRect.js";import{intersects as o,fromExtent as s,empty as c}from"../../../geometry/support/aaBoundingRect.js";function l(c){let l=!1,p=(e,t,n)=>{if(l||u(e,n)||t==null)return;let m=i(t,c.view.spatialReference);if(m.pending!=null){l=!0,m.pending.finally(()=>{l=!1,p(e,t,n)});return}let h=m.geometry;if(h==null)return;let g=h.type===`point`?r.fromPoint(h):h.extent;g!=null&&a(e.extent,e.spatialReference,d,c.view.spatialReference)&&o(d,s(g,f))&&c.onElevationChanges()},m,h=t(()=>({elevationMode:c.elevationInfo?.mode,geometry:c.geometry}),({elevationMode:e,geometry:t})=>{m?.remove(),e!==`absolute-height`&&(m=c.view.elevationProvider.on(`elevation-change`,n=>p(n,t,e)))},n);return e([h,m])}function u({context:e},t){return t==null?!1:t===`absolute-height`||e===`scene`&&t!==`relative-to-scene`}const d=c(),f=c();export{l as createElevationUpdateHandle};
2
+ import{handlesGroup as e,refHandle as t}from"../../../core/handleUtils.js";import{watch as n,initial as r}from"../../../core/reactiveUtils.js";import i from"../../../geometry/Extent.js";import{projectOrLoad as a}from"../../../geometry/projectionUtils.js";import{projectBoundingRect as o}from"../../../geometry/projection/projectBoundingRect.js";import{intersects as s,fromExtent as c,empty as l}from"../../../geometry/support/aaBoundingRect.js";function u(l){let u=!1,m=(e,t,n)=>{if(u||d(e,n)||t==null)return;let r=a(t,l.view.spatialReference);if(r.pending!=null){u=!0,r.pending.finally(()=>{u=!1,m(e,t,n)});return}let h=r.geometry;if(h==null)return;let g=h.type===`point`?i.fromPoint(h):h.extent;g!=null&&o(e.extent,e.spatialReference,f,l.view.spatialReference)&&s(f,c(g,p))&&l.onElevationChanges()},h,g=n(()=>({elevationMode:l.elevationInfo?.mode,geometry:l.geometry()}),({elevationMode:e,geometry:t})=>{h?.remove(),e!==`absolute-height`&&(h=l.view.elevationProvider.on(`elevation-change`,n=>m(n,t,e)))},r);return e([g,t(()=>h)])}function d({context:e},t){return t==null?!1:t===`absolute-height`||e===`scene`&&t!==`relative-to-scene`}const f=l(),p=l();export{u as createElevationUpdateHandle};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- const e={type:`empty-tile`};function t(e){return e!=null&&`type`in e&&e.type===`vector-tile`}function n(e){return e!=null&&`type`in e&&e.type===`raster-tile`}function r(e){return e!=null&&`type`in e&&e.type===`tile-texture`}function i(e){return e==null||`type`in e&&e.type===`empty-tile`}function a(e){return e!=null&&`type`in e&&`bitmap`in e}export{e as emptyTile,a as isCreateBitmapResult,i as isEmptyTile,n as isRasterTile,r as isTileTexture,t as isVectorTile};
2
+ const e={type:`empty-tile`};function t(e){return e!=null&&`type`in e&&e.type===`vector-tile`}function n(e){return e!=null&&`type`in e&&e.type===`raster-tile`}function r(e){return e!=null&&`type`in e&&e.type===`tile-texture`}function i(e){return e!=null&&`type`in e&&e.type===`empty-tile`}function a(e){return e!=null&&`type`in e&&`bitmap`in e}export{e as emptyTile,a as isCreateBitmapResult,i as isEmptyTile,n as isRasterTile,r as isTileTexture,t as isVectorTile};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../core/Collection.js";import{isEarth as t}from"../../../geometry/ellipsoidUtils.js";import{isCGCS2000 as n}from"../../../geometry/support/spatialReferenceUtils.js";import{getTileMaxtrixSetFromActiveLayer as r}from"../../../layers/support/layerUtils.js";import{isRasterTile as i,isCreateBitmapResult as a,isTileTexture as o,isVectorTile as s}from"./TerrainData.js";import{t as c}from"../../../chunks/terrainUtilsPlanar.js";import{t as l}from"../../../chunks/terrainUtilsSpherical.js";const u={1:l,2:c};function d(e,t){e||console.warn(`Terrain: `+t)}let f=!1,p=!1;function m(e){p=e,f||=e}function h(e){f=e}function g(e,t){if(f&&!e){let e=Error().stack?.slice(5);throw console.warn(`Terrain internal: `+(t??``)+` at `+e),Error(`Assertion failed`+(t?`: `+t:``))}}function _(e){return e?.type===`imagery-tile`||e?.type===`wcs`}function v(e){return e?.type===`imagery-tile-3d`}function y(e){return e?.type===`tile-3d`}function b(e){return e?.type===`vector-tile-3d`}function x(e){return e?.type===`wmts-3d`}function S(e){return e?.type===`elevation-3d`}function C(e){return e?.type===`group`}function w(e){return e&&(y(e)||x(e)||v(e)||b(e))}function T(e){return e&&(y(e)||v(e)||b(e)||x(e))}function E(e){return T(e)||S(e)}function D(e){return i(e?.sourceLayerInfo?.data)}function O(e){return e?.sourceLayerInfo?.data!=null&&j(e.sourceLayerInfo)||!!e?.isVTLBackground}function k(e){return o(e?.sourceLayerInfo?.data)}function A(e){let t=e?.sourceLayerInfo?.data;return a(t)}function j(e){return s(e?.data)}function M(e){return e!=null&&`release`in e&&e.release(),null}function N(e,t,n,r,i){return u[r].checkIfTileInfoSupportedForViewSR(e,n,t,i)}function P(e,t,n){let r=null,i=null;if(e?.type===`wmts`){let a=F(e,t,n);r=a.tileInfo,i=a.fullExtent}else{i=_(e)?e.getCompatibleFullExtent(t):e.fullExtent;let a=n===2;r=_(e)?e.getCompatibleTileInfo(t,i,a):e?.type===`vector-tile`?a&&!I(t)||L.force512VTL?e.tileInfo:e.tileInfo.getCompatibleForVTL(256):e.tileInfo}let a=`tilemapCache`in e?e.tilemapCache?.effectiveMaxLOD:void 0;return r!=null&&i!=null&&N(r,i,t,n,a)==null?{tileInfo:r,fullExtent:i}:null}function F(t,n,i){let a=r(t);if(a!=null){if(e.isCollection(a)){let e=a.find(e=>N(e.tileInfo,e.fullExtent,n,i)==null);if(e)return{tileInfo:e.tileInfo,fullExtent:e.fullExtent}}else return{tileInfo:a.tileInfo,fullExtent:a.fullExtent}}return{tileInfo:null,fullExtent:null}}function I(e){return e.isWGS84||e.isWebMercator||n(e)||!t(e)}const L={force512VTL:!1};function R(e){return`[`+e[0]+`,`+e[1]+`,`+e[2]+`]`}function z(e){return`(`+e[0]+`,`+e[1]+`,`+e[2]+`)`}function B(e,t,n=Z){return Math.abs(e-t)<n}function V(e){return e===1?5:e===7?3:e===5?1:7}function H(e){return e===0?4:e===2?6:e===4?0:2}function U(e){return e===7||e===5}function W(e){return e===7||e===1}function G(e){return e===7||e===6||e===5}function K(e){return e===1||e===2||e===3}function q(e){return e===3||e===4||e===5}function J(e){return e===1||e===0||e===7}const Y=[0,2,4,6],X=[1,3,5,7],Z=1e-5;export{B as almostEquals,N as checkIfTileInfoSupportedForView,h as enableInternalTerrainChecks,f as enableTerrainInternalChecks,m as enableTerrainWaterproofChecks,p as enableWaterproofTests,Z as eps,F as getTileInfoAndExtentFromWMTSLayer,P as getTiledLayerInfo,g as internalAssert,w as isBlendableLayerView,K as isEast,S as isElevationLayerView,C as isGroupLayerView,A as isImageSourceRenderInfo,v as isImageryTileLayerView,D as isImageryTileRenderInfo,T as isMapTileLayerView,J as isNorth,W as isNorthCorner,_ as isProjectableRasterLayer,q as isSouth,E as isSurfaceLayerView,k as isTextureTileRenderInfo,y as isTileLayerView,b as isVectorTileLayerView,j as isVectorTilePerLayerInfo,O as isVectorTileRenderInfo,x as isWMTSLayerView,G as isWest,U as isWestCorner,R as lij2s,X as neighborCornerIndices,Y as neighborEdgeIndices,V as oppositeCorner,H as oppositeEdge,M as releaseTerrainData,L as test,z as v32s,I as vtlAssumes256PixelSizeAsDefault,d as weakAssert};
2
+ import e from"../../../core/Collection.js";import{isEarth as t}from"../../../geometry/ellipsoidUtils.js";import{isCGCS2000 as n}from"../../../geometry/support/spatialReferenceUtils.js";import{getTileMaxtrixSetFromActiveLayer as r}from"../../../layers/support/layerUtils.js";import{isRasterTile as i,isCreateBitmapResult as a,isTileTexture as o,isVectorTile as s}from"./TerrainData.js";import{t as c}from"../../../chunks/terrainUtilsPlanar.js";import{t as l}from"../../../chunks/terrainUtilsSpherical.js";const u={1:l,2:c};function d(e,t){e||console.warn(`Terrain: `+t)}let f=!1,p=!1;function m(e){p=e,f||=e}function h(e){f=e}function g(e,t){if(f&&!e){let e=Error().stack?.slice(5);throw console.warn(`Terrain internal: `+(t??``)+` at `+e),Error(`Assertion failed`+(t?`: `+t:``))}}function _(e){return e?.type===`imagery-tile`||e?.type===`wcs`}function v(e){return e?.type===`imagery-tile-3d`}function y(e){return e?.type===`tile-3d`}function b(e){return e?.type===`vector-tile-3d`}function x(e){return e?.type===`wmts-3d`}function S(e){return e?.type===`elevation-3d`}function C(e){return e?.type===`group`}function w(e){return e&&(y(e)||x(e)||v(e)||b(e))}function T(e){return e&&(y(e)||v(e)||b(e)||x(e))}function E(e){return T(e)||S(e)}function D(e){return i(e?.sourceLayerInfo?.data)}function O(e){return j(e?.sourceLayerInfo)||!!e?.isVTLBackground}function k(e){return o(e?.sourceLayerInfo?.data)}function A(e){let t=e?.sourceLayerInfo?.data;return a(t)}function j(e){return s(e?.data)}function M(e){return e!=null&&`release`in e&&e.release(),null}function N(e,t,n,r,i){return u[r].checkIfTileInfoSupportedForViewSR(e,n,t,i)}function P(e,t,n){let r=null,i=null;if(e?.type===`wmts`){let a=F(e,t,n);r=a.tileInfo,i=a.fullExtent}else{i=_(e)?e.getCompatibleFullExtent(t):e.fullExtent;let a=n===2;r=_(e)?e.getCompatibleTileInfo(t,i,a):e?.type===`vector-tile`?a&&!I(t)||L.force512VTL?e.tileInfo:e.tileInfo.getCompatibleForVTL(256):e.tileInfo}let a=`tilemapCache`in e?e.tilemapCache?.effectiveMaxLOD:void 0;return r!=null&&i!=null&&N(r,i,t,n,a)==null?{tileInfo:r,fullExtent:i}:null}function F(t,n,i){let a=r(t);if(a!=null){if(e.isCollection(a)){let e=a.find(e=>N(e.tileInfo,e.fullExtent,n,i)==null);if(e)return{tileInfo:e.tileInfo,fullExtent:e.fullExtent}}else return{tileInfo:a.tileInfo,fullExtent:a.fullExtent}}return{tileInfo:null,fullExtent:null}}function I(e){return e.isWGS84||e.isWebMercator||n(e)||!t(e)}const L={force512VTL:!1};function R(e){return`[`+e[0]+`,`+e[1]+`,`+e[2]+`]`}function z(e){return`(`+e[0]+`,`+e[1]+`,`+e[2]+`)`}function B(e,t,n=Z){return Math.abs(e-t)<n}function V(e){return e===1?5:e===7?3:e===5?1:7}function H(e){return e===0?4:e===2?6:e===4?0:2}function U(e){return e===7||e===5}function W(e){return e===7||e===1}function G(e){return e===7||e===6||e===5}function K(e){return e===1||e===2||e===3}function q(e){return e===3||e===4||e===5}function J(e){return e===1||e===0||e===7}const Y=[0,2,4,6],X=[1,3,5,7],Z=1e-5;export{B as almostEquals,N as checkIfTileInfoSupportedForView,h as enableInternalTerrainChecks,f as enableTerrainInternalChecks,m as enableTerrainWaterproofChecks,p as enableWaterproofTests,Z as eps,F as getTileInfoAndExtentFromWMTSLayer,P as getTiledLayerInfo,g as internalAssert,w as isBlendableLayerView,K as isEast,S as isElevationLayerView,C as isGroupLayerView,A as isImageSourceRenderInfo,v as isImageryTileLayerView,D as isImageryTileRenderInfo,T as isMapTileLayerView,J as isNorth,W as isNorthCorner,_ as isProjectableRasterLayer,q as isSouth,E as isSurfaceLayerView,k as isTextureTileRenderInfo,y as isTileLayerView,b as isVectorTileLayerView,j as isVectorTilePerLayerInfo,O as isVectorTileRenderInfo,x as isWMTSLayerView,G as isWest,U as isWestCorner,R as lij2s,X as neighborCornerIndices,Y as neighborEdgeIndices,V as oppositeCorner,H as oppositeEdge,M as releaseTerrainData,L as test,z as v32s,I as vtlAssumes256PixelSizeAsDefault,d as weakAssert};
@@ -1,12 +1,12 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{DecodeSymbolColor as t}from"./DecodeSymbolColor.glsl.js";import{TextureBackedBufferModule as n}from"../../../core/shaderLibrary/TextureBackedBuffer.glsl.js";import{EmissionsConfiguration as r,hasEmissiveStrengthFromUniform as i}from"../../../core/shaderLibrary/output/getEmissions.glsl.js";import{Float4DrawUniform as a}from"../../../core/shaderModules/Float4DrawUniform.js";import{FloatDrawUniform as o}from"../../../core/shaderModules/FloatDrawUniform.js";import{glsl as s,If as c}from"../../../core/shaderModules/glsl.js";import{IntegerDrawUniform as l}from"../../../core/shaderModules/IntegerDrawUniform.js";import{Texture2DUintDrawUniform as u}from"../../../core/shaderModules/Texture2DUintDrawUniform.js";import{parameter as d}from"../../../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{olidEnabled as f}from"../../../effects/geometry/olidUtils.js";import{componentDataLayout as p,componentDataOlidLayout as m}from"../../../materials/DefaultLayouts.js";import{floatBlendScale as h}from"../../../shaders/floatBlendScale.glsl.js";class g extends r{constructor(){super(...arguments),this.componentDataType=0}}e([d({count:2})],g.prototype,`componentDataType`,void 0);function _(e,t){switch(t.componentDataType){case 1:return S(e,t);case 0:case 2:return C(e,t);default:t.componentDataType}}const v=new u(`componentTextureBuffer`,e=>e.textureBackedBuffer?.texture),y=new n({layout:p,itemIndexExpression:`componentIndex`,bufferUniform:v}),b=new n({layout:m,itemIndexExpression:`componentIndex`,bufferUniform:v});function x(){return f()?b:y}function S(e,n){let{vertex:r,fragment:a}=e,{output:o,hasEmission:l}=n,u=o===11,d=x().createBuilder(e,n);e.attributes.add(`componentIndex`,`uint`),e.varyings.add(`vExternalColorMixMode`,`mediump float`),e.varyings.add(`vExternalColor`,`vec4`),u&&e.varyings.add(`vObjectAndLayerIdColor`,`vec4`);let f=l&&!i(n);f&&(e.varyings.add(`emissiveStrength`,`float`),e.varyings.add(`emissiveSource`,`int`)),e.include(t),r.include(h,n),r.code.add(s`
2
+ import{__decorate as e}from"tslib";import{DecodeSymbolColor as t}from"./DecodeSymbolColor.glsl.js";import{TextureBackedBufferModule as n}from"../../../core/shaderLibrary/TextureBackedBuffer.glsl.js";import{EmissionsConfiguration as r,hasEmissiveStrengthFromUniform as i}from"../../../core/shaderLibrary/output/getEmissions.glsl.js";import{Float4DrawUniform as a}from"../../../core/shaderModules/Float4DrawUniform.js";import{FloatDrawUniform as o}from"../../../core/shaderModules/FloatDrawUniform.js";import{glsl as s,If as c}from"../../../core/shaderModules/glsl.js";import{IntegerDrawUniform as l}from"../../../core/shaderModules/IntegerDrawUniform.js";import{Texture2DUintDrawUniform as u}from"../../../core/shaderModules/Texture2DUintDrawUniform.js";import{parameter as d}from"../../../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{olidEnabled as f}from"../../../effects/geometry/olidUtils.js";import{componentDataLayout as p,componentDataOlidLayout as m}from"../../../materials/DefaultLayouts.js";import{floatBlendScale as h}from"../../../shaders/floatBlendScale.glsl.js";class g extends r{constructor(){super(...arguments),this.componentDataType=0}}e([d({count:2})],g.prototype,`componentDataType`,void 0);function _(e,t){switch(t.componentDataType){case 1:return S(e,t);case 0:case 2:return C(e,t);default:t.componentDataType}}const v=new u(`componentTextureBuffer`,e=>e.textureBackedBuffer?.texture),y=new n({layout:p,itemIndexExpression:`componentIndex`,bufferUniform:v}),b=new n({layout:m,itemIndexExpression:`componentIndex`,bufferUniform:v});function x(){return f()?b:y}function S(e,n){let{vertex:r,fragment:a}=e,{output:o,hasEmission:l}=n,u=o===11,d=x().createBuilder(e,n);e.attributes.add(`componentIndex`,`uint`),e.varyings.add(`vExternalColorMixMode`,`mediump float`),e.varyings.add(`vExternalColor`,`vec4`),u&&e.varyings.add(`vObjectAndLayerIdColor`,`vec4`);let f=l&&!i(n);f&&(e.varyings.add(`emissiveStrength`,`float`),e.varyings.add(`emissiveSource`,`float`)),e.include(t),r.include(h,n),r.code.add(s`
3
3
  float readElevationOffset() {
4
4
  return ${d.getTextureAttribute(`elevationOffset`)};
5
5
  }
6
6
 
7
7
  void forwardEmissiveStrength() {
8
8
  ${c(f,s`emissiveStrength = clamp(${d.getTextureAttribute(`emissiveStrength`)}, 0.0, maxEmissiveStrength);
9
- emissiveSource = ${d.getTextureAttribute(`emissiveSourceMode`)} == 0u ? 0 : 1;`)}
9
+ emissiveSource = ${d.getTextureAttribute(`emissiveSourceMode`)} == 0u ? 0.0 : 1.0;`)}
10
10
  }
11
11
 
12
12
  void forwardObjectAndLayerIdColor() {
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{MaskedColorDefinition as e,CreateMaskedFromUInt8NaNColor as t,MultiplyMaskedColors as n}from"./MaskedColor.glsl.js";import{glsl as r}from"../../shaderModules/glsl.js";import{IntegerPassUniform as i}from"../../shaderModules/IntegerPassUniform.js";import{colorMixModes as a}from"../../../materials/internal/MaterialUtil.js";function o(o,s){o.varyings.add(`colorMixMode`,`int`),o.varyings.add(`opacityMixMode`,`int`),o.vertex.uniforms.add(new i(`symbolColorMixMode`,e=>a[e.colorMixMode])),s.hasSymbolColors?(o.vertex.include(e),o.vertex.include(t),o.vertex.include(n),o.attributes.add(`symbolColor`,`vec4`),o.vertex.code.add(r`
2
+ import{MaskedColorDefinition as e,CreateMaskedFromUInt8NaNColor as t,MultiplyMaskedColors as n}from"./MaskedColor.glsl.js";import{glsl as r}from"../../shaderModules/glsl.js";import{IntegerPassUniform as i}from"../../shaderModules/IntegerPassUniform.js";import{colorMixModes as a}from"../../../materials/internal/MaterialUtil.js";function o(o,s){o.varyings.add(`colorMixMode`,`float`),o.varyings.add(`opacityMixMode`,`float`),o.vertex.uniforms.add(new i(`symbolColorMixMode`,e=>a[e.colorMixMode])),s.hasSymbolColors?(o.vertex.include(e),o.vertex.include(t),o.vertex.include(n),o.attributes.add(`symbolColor`,`vec4`),o.vertex.code.add(r`
3
3
  MaskedColor applySymbolColor(MaskedColor color) {
4
4
  return multiplyMaskedColors(color, createMaskedFromUInt8NaNColor(${`symbolColor`}));
5
5
  }
@@ -7,7 +7,7 @@ import{MaskedColorDefinition as e,CreateMaskedFromUInt8NaNColor as t,MultiplyMas
7
7
  return color;
8
8
  }`),o.vertex.code.add(r`
9
9
  void forwardColorMixMode(bvec4 mask) {
10
- colorMixMode = mask.r ? ${r.int(a.ignore)} : symbolColorMixMode;
11
- opacityMixMode = mask.a ? ${r.int(a.ignore)} : symbolColorMixMode;
10
+ colorMixMode = float(mask.r ? ${r.int(a.ignore)} : symbolColorMixMode) + 0.5;
11
+ opacityMixMode = float(mask.a ? ${r.int(a.ignore)} : symbolColorMixMode) + 0.5;
12
12
  }
13
13
  `)}export{o as SymbolColor};
@@ -11,7 +11,7 @@ import{InstanceColor as e}from"../attributes/InstanceColor.glsl.js";import{Maske
11
11
  }
12
12
 
13
13
  bool shouldCullByOpacity() {
14
- return opacityMixMode != ${c.int(u.ignore)} && vExternalColor.a < alphaCutoff;
14
+ return int(opacityMixMode) != ${c.int(u.ignore)} && vExternalColor.a < alphaCutoff;
15
15
  }
16
16
  `),h.include(a),h.uniforms.add(new s(`opacity`,e=>e.opacity),new s(`layerOpacity`,e=>e.layerOpacity)),h.code.add(c`
17
17
  float getDefaultMaterialOpacity(float textureOpacity) {
@@ -19,7 +19,7 @@ import{InstanceColor as e}from"../attributes/InstanceColor.glsl.js";import{Maske
19
19
  ${l(p.hasVertexColors,`vColor.a * `)} opacity,
20
20
  textureOpacity,
21
21
  vExternalColor.a,
22
- opacityMixMode
22
+ int(opacityMixMode)
23
23
  );
24
24
  }
25
25
  `)}export{f as DefaultMaterialExternalColor};
@@ -1,7 +1,7 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
2
  import{__decorate as e}from"tslib";import{clamp as t}from"../../../../../../core/mathUtils.js";import{isColor as n}from"../ShaderOutput.js";import{ShaderOutputConfiguration as r}from"../ShaderOutputConfiguration.js";import{VertexTextureCoordinates as i}from"../attributes/VertexTextureCoordinates.glsl.js";import{Gamma as a}from"../shading/Gamma.glsl.js";import{Float3DrawUniform as o}from"../../shaderModules/Float3DrawUniform.js";import{Float3PassUniform as s}from"../../shaderModules/Float3PassUniform.js";import{FloatDrawUniform as c}from"../../shaderModules/FloatDrawUniform.js";import{FloatPassUniform as l}from"../../shaderModules/FloatPassUniform.js";import{glsl as u}from"../../shaderModules/glsl.js";import{Texture2DDrawUniform as d}from"../../shaderModules/Texture2DDrawUniform.js";import{Texture2DPassUniform as f}from"../../shaderModules/Texture2DPassUniform.js";import{parameter as p}from"../../shaderTechnique/ShaderTechniqueConfiguration.js";import{floatBlendReductionFactor as m}from"../../../shaders/floatBlendScale.glsl.js";const h=1;class g extends r{constructor(){super(...arguments),this.emissionSource=0}}e([p({count:8})],g.prototype,`emissionSource`,void 0),e([p()],g.prototype,`hasEmissiveTextureTransform`,void 0);function _(e,r){let{hasEmission:p,emissionSource:h,hasEmissiveTextureTransform:g,bindType:_}=r;if(!n(r.output)||!p)return;let y=e.fragment;if(y.include(a),h===0){y.code.add(`vec4 getEmissions(vec3 symbolColor) { return vec4(0.0);}`);return}let b=h===3||h===4||h===5;b&&(e.include(i,r),y.uniforms.add(_===1?new f(`texEmission`,e=>e.textureEmissive):new d(`texEmission`,e=>e.textureEmissive)));let x=h===2||b;if(x&&y.uniforms.add(_===1?new s(`emissiveBaseColor`,e=>e.emissiveBaseColor):new o(`emissiveBaseColor`,e=>e.emissiveBaseColor)),v(r)){let e=e=>t(e??0,0,m);y.uniforms.add(_===1?new l(`emissiveStrength`,t=>e(t.emissiveStrength)):new c(`emissiveStrength`,t=>e(t.emissiveStrength)))}let S=h===7,C=h===5,w=h===1||h===6||S;y.code.add(u`vec4 getEmissions(vec3 symbolColor) {
3
- vec4 emissions =`),x?C?y.code.add(`emissiveSource == 0 ? vec4(emissiveBaseColor, 1.0): vec4(linearizeGamma(symbolColor), 1.0)`):y.code.add(`vec4(emissiveBaseColor, 1.0)`):w?S?y.code.add(`emissiveSource == 0 ? vec4(0.0): vec4(linearizeGamma(symbolColor), 1.0)`):y.code.add(`vec4(linearizeGamma(symbolColor), 1.0)`):y.code.add(`vec4(0.0)`),y.code.add(`;`),b&&(C?y.code.add(u`
4
- if(emissiveSource == 0) {
3
+ vec4 emissions =`),x?C?y.code.add(`emissiveSource < 0.5 ? vec4(emissiveBaseColor, 1.0): vec4(linearizeGamma(symbolColor), 1.0)`):y.code.add(`vec4(emissiveBaseColor, 1.0)`):w?S?y.code.add(`emissiveSource < 0.5 ? vec4(0.0): vec4(linearizeGamma(symbolColor), 1.0)`):y.code.add(`vec4(linearizeGamma(symbolColor), 1.0)`):y.code.add(`vec4(0.0)`),y.code.add(`;`),b&&(C?y.code.add(u`
4
+ if(emissiveSource < 0.5) {
5
5
  vec4 emissiveFromTex = textureLookup(texEmission, ${g?`emissiveUV`:`vuv0`});
6
6
  emissions *= vec4(linearizeGamma(emissiveFromTex.rgb), emissiveFromTex.a);
7
7
  }
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"../../../../core/has.js";import{generateUID as e}from"../../../../core/uid.js";import{getMetersPerUnitForSR as t}from"../../../../core/units.js";import{subtract as n,distance as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{projectBuffer as o}from"../../../../geometry/projection/projectBuffer.js";import{Attribute as s}from"./Attribute.js";import{Geometry as c}from"./Geometry.js";import{fromValues as l}from"./LocalOriginFactory.js";import{Object3D as u}from"./Object3D.js";import{gridLocalOriginFactory as d}from"./testUtils.js";import{WebGLLayer as f}from"./WebGLLayer.js";import{RibbonLineMaterial as p}from"../materials/RibbonLineMaterial.js";class m{constructor(n){this._originSR=n,this._rootOriginId=`root/`+e(),this._origins=new Map,this._objects=new Map,this._gridSize=5e5,this._originSR?.isGeographic&&(this._gridSize/=t(this._originSR)),this._baselineDistance=this._gridSize*.5;let r=this._baselineDistance*g;this._baselineObjectSize=r/_}getOrigin(e){let t=this._origins.get(this._rootOriginId);if(t==null){let t=d.rootOrigin;if(t!=null)return this._origins.set(this._rootOriginId,l(t[0],t[1],t[2],this._rootOriginId)),this.getOrigin(e);let n=l(e[0],e[1],e[2],this._rootOriginId);return this._origins.set(this._rootOriginId,n),n}let r=this._gridSize,i=Math.round(e[0]/r),a=Math.round(e[1]/r),o=Math.round(e[2]/r),s=`${i}/${a}/${o}`,c=this._origins.get(s),u=r*.5;if(n(h,e,t.vec3),h[0]=Math.abs(h[0]),h[1]=Math.abs(h[1]),h[2]=Math.abs(h[2]),h[0]<u&&h[1]<u&&h[2]<u){if(c){let t=Math.max(...h);if(n(h,e,c.vec3),h[0]=Math.abs(h[0]),h[1]=Math.abs(h[1]),h[2]=Math.abs(h[2]),Math.max(...h)<t)return c}return t}return c||(c=l(i*r,a*r,o*r,s),this._origins.set(s,c)),c}needsOriginUpdate(e,t,n){let i=r(e.vec3,t),a=Math.max(1,n/this._baselineObjectSize);return i>this._baselineDistance*a}_drawOriginBox(e,t=a(1,1,0,1)){let n=window.view,r=n.stage,i=t.toString();if(!this._objects.has(i)){this._material=new p({width:2,color:t},!1);let e=new f(r,{pickable:!1}),n=new u({castShadow:!1});e.add(n),this._objects.set(i,n)}let l=this._objects.get(i),d=[0,1,5,4,0,2,1,7,6,2,0,1,3,7,5,4,6,2,0],m=d.length,h=Array(m*3),g=[],_=this._gridSize*.5;for(let t=0;t<m;t++)h[t*3]=e[0]+(d[t]&1?_:-_),h[t*3+1]=e[1]+(d[t]&2?_:-_),h[t*3+2]=e[2]+(d[t]&4?_:-_),t>0&&g.push(t-1,t);o(h,this._originSR,0,h,n.renderSpatialReference,0,m);let v=new c(this._material,[[`position`,new s(h,g,3,!0)]],null);l.addGeometry(v)}get test(){}}const h=i(),g=2**-23,_=.05;export{m as GridLocalOriginFactory};
2
+ import"../../../../core/has.js";import{generateUID as e}from"../../../../core/uid.js";import{getMetersPerUnitForSR as t}from"../../../../core/units.js";import{subtract as n,distance as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{projectBuffer as o}from"../../../../geometry/projection/projectBuffer.js";import{Attribute as s}from"./Attribute.js";import{Geometry as c}from"./Geometry.js";import{fromValues as l}from"./LocalOriginFactory.js";import{Object3D as u}from"./Object3D.js";import{gridLocalOriginFactory as d}from"./testUtils.js";import{WebGLLayer as f}from"./WebGLLayer.js";import{RibbonLineMaterial as p}from"../materials/RibbonLineMaterial.js";class m{constructor(n){this._originSR=n,this._rootOriginId=`root/`+e(),this._origins=new Map,this._objects=new Map,this._gridSize=5e5,this._originSR?.isGeographic&&(this._gridSize/=t(this._originSR)),this._baselineDistance=this._gridSize*.5;let r=this._baselineDistance*g;this._baselineObjectSize=r/_}getOrigin(e){let t=this._origins.get(this._rootOriginId);if(t==null){let t=d.rootOrigin;if(t!=null)return this._origins.set(this._rootOriginId,l(t[0],t[1],t[2],this._rootOriginId)),this.getOrigin(e);let n=l(e[0],e[1],e[2],this._rootOriginId);return this._origins.set(this._rootOriginId,n),n}let r=this._gridSize,i=Math.round(e[0]/r),a=Math.round(e[1]/r),o=Math.round(e[2]/r),s=`${i}/${a}/${o}`,c=this._origins.get(s),u=r*.5;if(n(h,e,t.vec3),h[0]=Math.abs(h[0]),h[1]=Math.abs(h[1]),h[2]=Math.abs(h[2]),h[0]<u&&h[1]<u&&h[2]<u){if(c){let t=Math.max(...h);if(n(h,e,c.vec3),h[0]=Math.abs(h[0]),h[1]=Math.abs(h[1]),h[2]=Math.abs(h[2]),Math.max(...h)<t)return c}return t}return c||(c=l(i*r,a*r,o*r,s),this._origins.set(s,c)),c}needsOriginUpdate(e,t,n){let i=r(e.vec3,t),a=Math.max(1,n/this._baselineObjectSize);return i>this._baselineDistance*a}_drawOriginBox(e,t=a(1,1,0,1)){let n=window.view,r=n.stage,i=t.toString();if(!this._objects.has(i)){this._material=new p({width:2,color:t},n);let e=new f(r,{pickable:!1}),a=new u({castShadow:!1});e.add(a),this._objects.set(i,a)}let l=this._objects.get(i),d=[0,1,5,4,0,2,1,7,6,2,0,1,3,7,5,4,6,2,0],m=d.length,h=Array(m*3),g=[],_=this._gridSize*.5;for(let t=0;t<m;t++)h[t*3]=e[0]+(d[t]&1?_:-_),h[t*3+1]=e[1]+(d[t]&2?_:-_),h[t*3+2]=e[2]+(d[t]&4?_:-_),t>0&&g.push(t-1,t);o(h,this._originSR,0,h,n.renderSpatialReference,0,m);let v=new c(this._material,[[`position`,new s(h,g,3,!0)]],null);l.addGeometry(v)}get test(){}}const h=i(),g=2**-23,_=.05;export{m as GridLocalOriginFactory};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import has from"../../../../core/has.js";import{disposeMaybe as e}from"../../../../core/maybe.js";import{ScreenSpaceGeometry as t}from"../effects/ScreenSpaceGeometry.js";import{createEmptyTexture as n}from"./glUtil3D.js";import{IndexBufferCache as r}from"../materials/renderers/IndexBufferCache.js";import{TextureBufferCache as i}from"../materials/renderers/TextureBufferCache.js";import{VaoCache as a}from"../materials/renderers/VaoCache.js";import{VboCache as o}from"../materials/renderers/VboCache.js";import{RenderingContext as s}from"../../../webgl/RenderingContext.js";class c extends s{constructor(e,r){super(e,r),this.emptyTexture=n(this),this._vaoCaches=new Map,this._vboCaches=new Map,this._indexBufferCache=null,this._textureBufferCaches=new Map,this.debugBoundTechnique=``,this._refCount=1,this._newCache=r.newCache,this._screen=new t(this)}configure(e){super.configure(e),this._newCache=e.newCache}destroy(){this._vaoCaches.forEach(e=>e.dispose()),this._vaoCaches.clear(),this._vboCaches.forEach(e=>e.dispose()),this._vboCaches.clear(),this._indexBufferCache=e(this._indexBufferCache),this._textureBufferCaches.forEach(e=>e.dispose()),this._textureBufferCaches.clear(),!(--this._refCount>0)&&this.dispose()}ref(){++this._refCount}get refCount(){return this._refCount}dispose(){this.emptyTexture.dispose(),this._screen.destroy(),this._screen=null,super.dispose(),this._vaoCaches.forEach(e=>e.dispose()),this._vaoCaches.clear(),this._vboCaches.forEach(e=>e.dispose()),this._vboCaches.clear(),this._indexBufferCache?.dispose(),this._indexBufferCache=null,this._textureBufferCaches.forEach(e=>e.dispose()),this._textureBufferCaches.clear()}get newCache(){return this._newCache}get screen(){return this._screen}getVaoCache(e){let t=JSON.stringify(e),n=this._vaoCaches.get(t);if(n)return n;let r=new a(this,e);return this._vaoCaches.set(t,r),r}getVboCache(e){let t=JSON.stringify(e),n=this._vboCaches.get(t);if(n)return n;let r=new o(this,e);return this._vboCaches.set(t,r),r}get indexBufferCache(){return this._indexBufferCache??=new r(this),this._indexBufferCache}getTextureBufferCache(e){let t=JSON.stringify(e),n=this._textureBufferCaches.get(t);if(n)return n;let r=new i(this,e);return this._textureBufferCaches.set(t,r),r}bindTechnique(e,t,n,r){return this.debugBoundTechnique=e.declaredClass,this.useProgram(e.program),this.setPipelineState(e.getPipeline(t,n)),e.program.bind(t),e.program.bindPass(t,n),r&&e.program.bindDraw(t,n,r),e.program}get isAssumedMetalDriver(){if(this._isAssumedMetalDriver==null&&(this._isAssumedMetalDriver=!!has(`ios`)||!!has(`safari`),!this._isAssumedMetalDriver&&has(`mac`)&&has(`chrome`))){let e=this.capabilities.rendererInfo?.getUnmaskedRenderer().toLowerCase(),t=e?.includes(`apple`)&&e?.includes(`angle`)&&e?.includes(`metal`);this._isAssumedMetalDriver=t??!0}return this._isAssumedMetalDriver}get test(){}}export{c as RenderingContext};
2
+ import has from"../../../../core/has.js";import{disposeMaybe as e}from"../../../../core/maybe.js";import{ScreenSpaceGeometry as t}from"../effects/ScreenSpaceGeometry.js";import{createEmptyTexture as n}from"./glUtil3D.js";import{IndexBufferCache as r}from"../materials/renderers/IndexBufferCache.js";import{TextureBufferCache as i}from"../materials/renderers/TextureBufferCache.js";import{VaoCache as a}from"../materials/renderers/VaoCache.js";import{VboCache as o}from"../materials/renderers/VboCache.js";import{RenderingContext as s}from"../../../webgl/RenderingContext.js";class c extends s{constructor(e,r){super(e,r),this.emptyTexture=n(this),this._vaoCaches=new Map,this._vboCaches=new Map,this._indexBufferCache=null,this._textureBufferCaches=new Map,this.debugBoundTechnique=``,this._refCount=1,this._newCache=r.newCache,this._screen=new t(this)}configure(e){super.configure(e),this._newCache=e.newCache,this._isAssumedMetalDriver=null}destroy(){this._vaoCaches.forEach(e=>e.dispose()),this._vaoCaches.clear(),this._vboCaches.forEach(e=>e.dispose()),this._vboCaches.clear(),this._indexBufferCache=e(this._indexBufferCache),this._textureBufferCaches.forEach(e=>e.dispose()),this._textureBufferCaches.clear(),!(--this._refCount>0)&&this.dispose()}ref(){++this._refCount}get refCount(){return this._refCount}dispose(){this.emptyTexture.dispose(),this._screen.destroy(),this._screen=null,super.dispose(),this._vaoCaches.forEach(e=>e.dispose()),this._vaoCaches.clear(),this._vboCaches.forEach(e=>e.dispose()),this._vboCaches.clear(),this._indexBufferCache?.dispose(),this._indexBufferCache=null,this._textureBufferCaches.forEach(e=>e.dispose()),this._textureBufferCaches.clear()}get newCache(){return this._newCache}get screen(){return this._screen}getVaoCache(e){let t=JSON.stringify(e),n=this._vaoCaches.get(t);if(n)return n;let r=new a(this,e);return this._vaoCaches.set(t,r),r}getVboCache(e){let t=JSON.stringify(e),n=this._vboCaches.get(t);if(n)return n;let r=new o(this,e);return this._vboCaches.set(t,r),r}get indexBufferCache(){return this._indexBufferCache??=new r(this),this._indexBufferCache}getTextureBufferCache(e){let t=JSON.stringify(e),n=this._textureBufferCaches.get(t);if(n)return n;let r=new i(this,e);return this._textureBufferCaches.set(t,r),r}bindTechnique(e,t,n,r){return this.debugBoundTechnique=e.declaredClass,this.useProgram(e.program),this.setPipelineState(e.getPipeline(t,n)),e.program.bind(t),e.program.bindPass(t,n),r&&e.program.bindDraw(t,n,r),e.program}get isAssumedMetalDriver(){if(this._isAssumedMetalDriver==null&&(this._isAssumedMetalDriver=!!has(`ios`)||!!has(`safari`),!this._isAssumedMetalDriver&&has(`mac`)&&has(`chrome`))){let e=this.capabilities.rendererInfo?.getUnmaskedRenderer().toLowerCase(),t=e?.includes(`angle`)&&e?.includes(`metal`);this._isAssumedMetalDriver=t??!0}return this._isAssumedMetalDriver}get test(){}}export{c as RenderingContext};