@arcgis/core 5.2.0-next.34 → 5.2.0-next.35

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 (61) hide show
  1. package/analysis/Viewshed.d.ts +0 -5
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/{4316b78fc36bfd893a90.js → 155940ef3d1888272d73.js} +1 -1
  4. package/assets/esri/core/workers/chunks/24aa98cb2021ddd789ce.js +1 -0
  5. package/assets/esri/core/workers/chunks/406c7723e8db470822bf.js +1 -0
  6. package/assets/esri/core/workers/chunks/{37dc6a8495f1f44e2d45.js → 6c746ac4bd2e57b8cb41.js} +1 -1
  7. package/assets/esri/core/workers/chunks/8a9b2efa0603e9fa4e8b.js +1 -0
  8. package/assets/esri/core/workers/chunks/{fe8032905992e6574714.js → 9fb0431b0628dcb53004.js} +54 -54
  9. package/assets/esri/core/workers/chunks/{87c7092282214f5b78b8.js → bbcb213d20693fcad5be.js} +12 -12
  10. package/assets/esri/core/workers/chunks/{414691f7758c78e2a704.js → cfbbfa5edffa57bd3a8e.js} +1 -1
  11. package/assets/esri/core/workers/chunks/d0217187aed8bb7038f4.js +1 -0
  12. package/assets/esri/core/workers/chunks/{b7d7bfcb089a3f1a38b6.js → dd785e595cd08b2d6284.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{0087ad36f7d38fc7fe11.js → ee446250a40e5d89bb5a.js} +44 -44
  14. package/assets/esri/core/workers/chunks/{42b1c526c4c9636a169d.js → f1f3fe9d2d96578f4f6b.js} +1 -1
  15. package/chunks/FocusAreaColor.glsl.js +1 -10
  16. package/chunks/RibbonLine.glsl.js +22 -22
  17. package/config.js +1 -1
  18. package/geometry/support/plane.js +1 -1
  19. package/geometry/support/triangle.js +1 -1
  20. package/kernel.js +1 -1
  21. package/layers/raster/datasets/pixelReader.js +1 -1
  22. package/layers/raster/functions/pixelUtils.js +1 -1
  23. package/package.json +1 -1
  24. package/popup/Features.d.ts +2 -2
  25. package/popup/Features.js +1 -1
  26. package/renderers/visualVariables/support/visualVariableUtils.js +1 -1
  27. package/support/revision.js +1 -1
  28. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  29. package/views/3d/analysis/Viewshed/ViewshedPlacementController.js +1 -1
  30. package/views/3d/analysis/Viewshed/ViewshedSubVisualization.js +1 -1
  31. package/views/3d/analysis/Viewshed/placementUtils.js +1 -1
  32. package/views/3d/analysis/Viewshed/types.d.ts +17 -0
  33. package/views/3d/analysis/ViewshedAnalysisView3D.d.ts +3 -14
  34. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
  35. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
  36. package/views/3d/analysis/VolumeMeasurementAnalysisView3D.js +1 -1
  37. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  38. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  39. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  40. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  41. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  42. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  43. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  44. package/views/3d/webgl/ManagedFBO.js +1 -1
  45. package/views/3d/webgl-engine/effects/focusArea/FocusAreaColor.glsl.js +1 -1
  46. package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorTechnique.js +1 -1
  47. package/views/3d/webgl-engine/effects/focusArea/FocusAreaVisualization.js +1 -1
  48. package/views/3d/webgl-engine/lib/Intersector.js +1 -1
  49. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBufferView.js +1 -1
  50. package/views/3d/webgl-engine/lib/intersectorUtils.js +1 -1
  51. package/views/3d/webgl-engine/lib/screenPolygonTriangleIntersections.js +1 -1
  52. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  53. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  54. package/views/3d/webgl-engine/shaders/RibbonLineLayouts.js +1 -1
  55. package/views/layers/ViewshedLayerView.d.ts +0 -10
  56. package/views/support/LayerViewManager.js +1 -1
  57. package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.js +1 -1
  58. package/assets/esri/core/workers/chunks/7a59d39010ed33b8fabb.js +0 -1
  59. package/assets/esri/core/workers/chunks/a0f7e37d385fc68b138d.js +0 -1
  60. package/assets/esri/core/workers/chunks/dfae4440afe0ca7c5b25.js +0 -1
  61. package/assets/esri/core/workers/chunks/fec9ce6ad634c904ffdf.js +0 -1
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__addDisposableResource as e,__disposeResources as t}from"tslib";import r from"../../../../core/Error.js";import{disposable as i}from"../../../../core/handleUtils.js";import{translate as s}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as a,create as o}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as n,scale as l}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as c,fromArray as h,clone as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as m}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromArray as d,create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectBuffer as u}from"../../../../geometry/projection/projectBuffer.js";import{create as g,fromSubBuffer as y,intersectsClippingArea as _}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as b,doubleArrayFrom as v}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as x}from"../../../../geometry/support/FloatArray.js";import{getCoordinateEquals as w}from"../../../../geometry/support/geometryUtils.js";import{needsElevationUpdates3D as S,evaluateElevationAlignmentAtPoint as P,SampleElevationInfo as D}from"./elevationAlignmentUtils.js";import{Graphics3DObject3DGraphicLayer as j}from"./Graphics3DObject3DGraphicLayer.js";import{maxPathLength as C,pathNumRoundJoinSubdivisions as V}from"./Graphics3DPathSymbolLayerConstants.js";import{Graphics3DSymbolLayer as A,nanFallbackColor as U}from"./Graphics3DSymbolLayer.js";import{isValidSize as z}from"./graphicUtils.js";import{ConvertOptions as E,initFastSymbolUpdatesState as R,updateFastSymbolUpdatesState as B,getSizeAttributeValue as G,getAttributeValue as L}from"../support/FastSymbolUpdates.js";import{SamplePosition as k}from"../../support/ElevationProvider.js";import{Object3D as O}from"../../webgl-engine/lib/Object3D.js";import{Path as I}from"../../webgl-engine/lib/Path.js";import{PathBuilder as F}from"../../webgl-engine/lib/PathBuilder.js";import{RoundCapBuilder as M,TriangulationCapBuilder as T,NoCapBuilder as q}from"../../webgl-engine/lib/PathCapBuilder.js";import{MiterExtruder as H}from"../../webgl-engine/lib/PathExtruder.js";import{PathGeometry as W,isPathGeometry as N}from"../../webgl-engine/lib/PathGeometry.js";import{FastUpdatePathGeometry as Z,StaticPathGeometry as J}from"../../webgl-engine/lib/PathGeometryData.js";import{computeMinimumRotationTangentFrame as $}from"../../webgl-engine/lib/pathGeometryUtils.js";import{quadProfiles as K,circleProfiles as Q}from"../../webgl-engine/lib/PathProfile.js";import{newPathVertex as X}from"../../webgl-engine/lib/PathVertex.js";import{DefaultMaterial as Y}from"../../webgl-engine/materials/DefaultMaterial.js";import{PathMaterial as ee}from"../../webgl-engine/materials/PathMaterial.js";const te=["polyline"];class re extends A{constructor(e,t,r,i){super(e,t,r,i,ne(t)),this._intrinsicSize=c(1,1),this._upVectorAlignment=1,this._stencilWidth=.1,this.ensureDrapedStatus(!1)}_validateGeometry(e,t,r){return!!super._validateGeometry(e,t,r)&&("polyline"===e.type&&(!e.paths.some(e=>e.length>C)||(this.logger.warn(`Geometry has a path longer than ${C} vertices and cannot be displayed by PathSymbol3DLayer`),!1)))}async doLoad(){const e=this.symbolLayer,t=null!=e.width?e.width:e.height,i=null!=e.height?e.height:t;this._vvConvertOptions=new E({supports:{size:!0,color:!0,rotation:!1,opacity:!0},modelSize:[1,1,1],symbolSize:[t,1,i],unitInMeters:this._context.renderCoordsHelper.unitInMeters,fallbackColor:this._getFallbackOpacityAndColor(U),fallbackSize:[t,1,i]});const s=this._context.renderer?.visualVariables;this._fastUpdates=s?.length?R(this._context.renderer,this._vvConvertOptions):null;const a=e.anchor||"center";this._upVectorAlignment="heading"===e.profileRotation?0:1;const o=e.profile||"circle";switch(o){default:case"circle":this._profile=Q[a];break;case"quad":this._profile=K[a]}switch(e.join){case"round":this._extruder=new H(0,V);break;default:case"bevel":this._extruder=new H(0,1);break;case"miter":this._extruder=new H(.8*Math.PI,1)}switch(this._cap){case"none":this._capBuilder=new q;break;case"butt":default:this._capBuilder=new T(this._profile,1);break;case"square":this._capBuilder=new T(this._profile,2);break;case"round":{const e="quad"===o;this._capBuilder=new M(this._profile,e);break}}const c=this._materialColor,p=this._getCombinedOpacityAndColor(c),m=d(p),f=p[3],u=this.needsDrivenTransparentPass,g=e.material?.emissive,y={diffuse:m,ambient:m,emissiveStrengthFromSymbol:("color"===g?.source?g?.strength:void 0)??0,emissiveSource:1,opacity:f,drivenOpacity:u,hasVertexColors:!1,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows,offsetTransparentBackfaces:!0};if(!this._drivenProperties.size&&(n(this._intrinsicSize,t,i),!z(this._intrinsicSize[0])||!z(this._intrinsicSize[1])))throw new r("graphics3dpathsymbollayer:invalid-size","Symbol sizes may not be negative values");let _;this._fastUpdates?.visualVariables.size||l(this._intrinsicSize,this._intrinsicSize,1/this._context.renderCoordsHelper.unitInMeters),this._fastUpdates?_=new ee({...y,...this._fastUpdates.materialParameters,size:h(this._intrinsicSize),upVectorAlignment:this._upVectorAlignment,profile:this._profile,pathCapType:this._capBuilder.type,cutoffAngle:this._extruder.cutoffAngle,numJoinSubdivisions:this._extruder.numBendSubdivisions},this._context):(y.hasVertexColors=this._drivenProperties.color||this._drivenProperties.opacity,y.normalType=1,_=new Y(y,this._context)),_.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),this._materials[0]=_,this._updateTransparentDepedentMaterialParameters()}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,te,this.symbolLayer.type))return null;const r=this.createElevationContextForGraphic(t);return this._createAs3DShape(e,r)}layerOpacityChanged(){const e=this._materialColor,t=this._getCombinedOpacity(e),r=this._materials[0];r&&(r.setParameters({opacity:t}),this._updateTransparentDepedentMaterialParameters())}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,S)}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return this._materials[0]?.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),!0}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return 0;if(!B(this._fastUpdates,t,this._vvConvertOptions))return 0;this._materials[0]?.setParameters(this._fastUpdates.materialParameters)}return 2}_getVertexData(r){let i=0;const s=r.paths,a=[],o=r.spatialReference,n=this._context.elevationProvider.spatialReference,l=this._context.renderCoordsHelper.spatialReference,c=w(r.hasZ),h=s.map(r=>{const i={stack:[],error:void 0,hasError:!1};try{const t=he;e(i,pe,!1);for(let e=1;e<r.length;++e)c(r[e],r[e-1])&&t.add(e);return 0===t.size?r:r.filter((e,r)=>!t.has(r))}catch(s){i.error=s,i.hasError=!0}finally{t(i)}});for(const e of h)i+=e.length;const p=b(3*i);let m,d=0;for(const e of h){a.push({offset:d,numVertices:e.length});for(const t of e)p[d++]=t[0],p[d++]=t[1],p[d++]=r.hasZ?t[2]:0}return null==n||o.equals(n)||u(p,o,0,p,n,0,i)?(null==n||n.equals(l)?m=v(p):(m=b(3*i),u(p,n,0,m,l,0,i)),{pathVertexDataInfos:a,vertexDataES:p,vertexDataRS:m}):null}_createAs3DShape(e,t){const{graphic:r,renderingInfo:i}=e,n=r.geometry,l=this._getVertexData(n);if(null==l)return this.logger.warn("PathSymbol3DLayer geometry failed to be created (failed to project geometry to view spatial reference)"),null;if(0===l.pathVertexDataInfos.length)return 0!==n.paths.length&&n.paths.some(e=>e.length>0)||this.logger.warn("PathSymbol3DLayer geometry failed to be created (no paths were defined)"),null;const c=new Array,h=n.spatialReference,d=g(),f=this._context.renderCoordsHelper,u=new k(l.vertexDataES),b=r.uid,v=x(l.vertexDataRS.length);for(const g of l.pathVertexDataInfos){const e=g.numVertices;if(e<2)continue;const r=g.offset;if(null!=this._context.clippingExtent&&(y(l.vertexDataES,r,e,d),!_(d,this._context.clippingExtent)))continue;const n=new Array,x=r+3*e;for(let i=r;i<x;i+=3){u.offset=i;const e=P(u,this._context.elevationProvider,t,f);m(le,l.vertexDataRS[i],l.vertexDataRS[i+1],l.vertexDataRS[i+2]),f.setAltitude(le,e),l.vertexDataRS[i]=le[0],l.vertexDataRS[i+1]=le[1],l.vertexDataRS[i+2]=le[2],n.push(X(this._upVectorAlignment))}const w=new I(n,l.vertexDataES,l.vertexDataRS,r,v);ie(w,this._upVectorAlignment,this._context.renderCoordsHelper);const S=new F(w,this._profile,this._extruder,this._capBuilder,this._upVectorAlignment);let D=null;if(this._fastUpdates){const{size:e,color:t,opacity:r}=this._fastUpdates.visualVariables,s=G(e,i.size),a=L(t,i.color),o=L(r,i.opacity);D=new Z(S,s,a,o)}else{const e=p(this._intrinsicSize);if(this._drivenProperties.size){const t=i.size?.output??["symbol-value","symbol-value","symbol-value"];e[0]*=se(t[0],"symbol-value"===t[2]?this.symbolLayer.height||0:t[2],this.symbolLayer.width||0),e[1]*=se(t[2],"symbol-value"===t[0]?this.symbolLayer.width||0:t[0],this.symbolLayer.height||0)}const t=new J(S);t.bake(e);const r=this._getDrivenColor(i);r&&t.bakeVertexColors(r),D=t}const j=D.createGeometryData(),C=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:b,layerViewUid:this._context.layerViewUid}),V=new W(this._materials[0],j,D,h,this._stencilWidth,C);V.transformation=s(o(),a,S.path.origin),c.push(V)}if(0===c.length)return null;const w=new O({geometries:c,layerViewUid:this._context.layerViewUid,graphicUid:b}),D=new j(this,w,null,(e,t,r,i,s)=>oe(e,t,i,s,this._upVectorAlignment),t,null);return D.alignedSampledElevation=0,D.needsElevationUpdates=S(t.mode),D}_getDrivenColor(e){return this._hasDrivenColorOrOpacity?this._getDrivenUInt8ColorWithNaNSupport(e,this._materialColor,!1):null}get _materialColor(){return this.symbolLayer.material?.color}_getFallbackOpacityAndColor(e){return this._materialColor?.toUnitRGBA()??e}get _cap(){return this.symbolLayer.cap||"butt"}_updateTransparentDepedentMaterialParameters(){const e=this._materials[0];e&&e.setParameters({cullFace:e.transparent||"none"===this._cap?0:2})}}function ie(e,t,r){const{origin:i,positions:s}=e;let a=e.offset;switch(t){default:case 0:for(const t of e.vertices)le[0]=s[a++]+i[0],le[1]=s[a++]+i[1],le[2]=s[a++]+i[2],r.worldUpAtPosition(le,le),t.setFrameFromUpVector(le);break;case 1:le[0]=s[a]+i[0],le[1]=s[a+1]+i[1],le[2]=s[a+2]+i[2],r.worldUpAtPosition(le,le),$(e,le)}}function se(e,t,r){switch(e){case"symbol-value":return r;case"proportional":return t;default:return e}}function ae(e,t,r,i){let s=0;const{origin:a,vertices:o,positions:n,positionsES:l}=e,c=e.offset+3*o.length;for(let h=e.offset;h<c;h+=3)m(le,l[h],l[h+1],l[h+2]),r(le,ce),s+=ce.sampledElevation,le[0]=n[h]+a[0],le[1]=n[h+1]+a[1],le[2]=n[h+2]+a[2],i.setAltitude(le,ce.z),n[h]=le[0]-a[0],n[h+1]=le[1]-a[1],n[h+2]=le[2]-a[2];return e.updatePathVertexInformation(),s/o.length}function oe(e,t,r,i,s){const a=e.stageObject,o=a.geometries;let n=0;for(const l of o){if(!N(l))continue;const e=l.path,o=e.builder.path;n+=ae(o,t,r,i),0!==s&&ie(o,s,i),e.onPathChanged(l),l.invalidateBoundingInfo(),a.geometryVertexAttributeUpdated(l,"position")}return n/o.length}function ne(e){return 1===(e.material?.color?.a??0)}const le=f(),ce=new D,he=new Set,pe=i({remove:()=>he.clear()});export{re as Graphics3DPathSymbolLayer};
2
+ import{__addDisposableResource as e,__disposeResources as t}from"tslib";import r from"../../../../core/Error.js";import{disposable as i}from"../../../../core/handleUtils.js";import{translate as s}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as a,create as o}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as n,scale as l}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as c,fromArray as h,clone as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as m}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromArray as d,create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectBuffer as f}from"../../../../geometry/projection/projectBuffer.js";import{create as g,fromSubBuffer as y,intersectsClippingArea as _}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as b,doubleArrayFrom as v}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as x}from"../../../../geometry/support/FloatArray.js";import{getCoordinateEquals as w}from"../../../../geometry/support/geometryUtils.js";import{isDrivenOpacityFallbackAlwaysOpaque as S}from"../../../../renderers/visualVariables/support/visualVariableUtils.js";import{needsElevationUpdates3D as P,evaluateElevationAlignmentAtPoint as D,SampleElevationInfo as j}from"./elevationAlignmentUtils.js";import{Graphics3DObject3DGraphicLayer as C}from"./Graphics3DObject3DGraphicLayer.js";import{maxPathLength as V,pathNumRoundJoinSubdivisions as A}from"./Graphics3DPathSymbolLayerConstants.js";import{Graphics3DSymbolLayer as U,nanFallbackColor as z}from"./Graphics3DSymbolLayer.js";import{isValidSize as E}from"./graphicUtils.js";import{ConvertOptions as R,initFastSymbolUpdatesState as B,updateFastSymbolUpdatesState as G,getSizeAttributeValue as L,getAttributeValue as k}from"../support/FastSymbolUpdates.js";import{SamplePosition as O}from"../../support/ElevationProvider.js";import{Object3D as I}from"../../webgl-engine/lib/Object3D.js";import{Path as F}from"../../webgl-engine/lib/Path.js";import{PathBuilder as M}from"../../webgl-engine/lib/PathBuilder.js";import{RoundCapBuilder as T,TriangulationCapBuilder as q,NoCapBuilder as H}from"../../webgl-engine/lib/PathCapBuilder.js";import{MiterExtruder as W}from"../../webgl-engine/lib/PathExtruder.js";import{PathGeometry as N,isPathGeometry as Z}from"../../webgl-engine/lib/PathGeometry.js";import{FastUpdatePathGeometry as J,StaticPathGeometry as $}from"../../webgl-engine/lib/PathGeometryData.js";import{computeMinimumRotationTangentFrame as K}from"../../webgl-engine/lib/pathGeometryUtils.js";import{quadProfiles as Q,circleProfiles as X}from"../../webgl-engine/lib/PathProfile.js";import{newPathVertex as Y}from"../../webgl-engine/lib/PathVertex.js";import{DefaultMaterial as ee}from"../../webgl-engine/materials/DefaultMaterial.js";import{PathMaterial as te}from"../../webgl-engine/materials/PathMaterial.js";const re=["polyline"];class ie extends U{constructor(e,t,r,i){super(e,t,r,i,S(t)),this._intrinsicSize=c(1,1),this._upVectorAlignment=1,this._stencilWidth=.1,this.ensureDrapedStatus(!1)}_validateGeometry(e,t,r){return!!super._validateGeometry(e,t,r)&&("polyline"===e.type&&(!e.paths.some(e=>e.length>V)||(this.logger.warn(`Geometry has a path longer than ${V} vertices and cannot be displayed by PathSymbol3DLayer`),!1)))}async doLoad(){const e=this.symbolLayer,t=null!=e.width?e.width:e.height,i=null!=e.height?e.height:t;this._vvConvertOptions=new R({supports:{size:!0,color:!0,rotation:!1,opacity:!0},modelSize:[1,1,1],symbolSize:[t,1,i],unitInMeters:this._context.renderCoordsHelper.unitInMeters,fallbackColor:this._getFallbackOpacityAndColor(z),fallbackSize:[t,1,i]});const s=this._context.renderer?.visualVariables;this._fastUpdates=s?.length?B(this._context.renderer,this._vvConvertOptions):null;const a=e.anchor||"center";this._upVectorAlignment="heading"===e.profileRotation?0:1;const o=e.profile||"circle";switch(o){default:case"circle":this._profile=X[a];break;case"quad":this._profile=Q[a]}switch(e.join){case"round":this._extruder=new W(0,A);break;default:case"bevel":this._extruder=new W(0,1);break;case"miter":this._extruder=new W(.8*Math.PI,1)}switch(this._cap){case"none":this._capBuilder=new H;break;case"butt":default:this._capBuilder=new q(this._profile,1);break;case"square":this._capBuilder=new q(this._profile,2);break;case"round":{const e="quad"===o;this._capBuilder=new T(this._profile,e);break}}const c=this._materialColor,p=this._getCombinedOpacityAndColor(c),m=d(p),u=p[3],f=this.needsDrivenTransparentPass,g=e.material?.emissive,y={diffuse:m,ambient:m,emissiveStrengthFromSymbol:("color"===g?.source?g?.strength:void 0)??0,emissiveSource:1,opacity:u,drivenOpacity:f,hasVertexColors:!1,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows,offsetTransparentBackfaces:!0};if(!this._drivenProperties.size&&(n(this._intrinsicSize,t,i),!E(this._intrinsicSize[0])||!E(this._intrinsicSize[1])))throw new r("graphics3dpathsymbollayer:invalid-size","Symbol sizes may not be negative values");let _;this._fastUpdates?.visualVariables.size||l(this._intrinsicSize,this._intrinsicSize,1/this._context.renderCoordsHelper.unitInMeters),this._fastUpdates?_=new te({...y,...this._fastUpdates.materialParameters,size:h(this._intrinsicSize),upVectorAlignment:this._upVectorAlignment,profile:this._profile,pathCapType:this._capBuilder.type,cutoffAngle:this._extruder.cutoffAngle,numJoinSubdivisions:this._extruder.numBendSubdivisions},this._context):(y.hasVertexColors=this._drivenProperties.color||this._drivenProperties.opacity,y.normalType=1,_=new ee(y,this._context)),_.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),this._materials[0]=_,this._updateTransparentDepedentMaterialParameters()}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,re,this.symbolLayer.type))return null;const r=this.createElevationContextForGraphic(t);return this._createAs3DShape(e,r)}layerOpacityChanged(){const e=this._materialColor,t=this._getCombinedOpacity(e),r=this._materials[0];r&&(r.setParameters({opacity:t}),this._updateTransparentDepedentMaterialParameters())}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,P)}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return this._materials[0]?.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),!0}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return 0;if(!G(this._fastUpdates,t,this._vvConvertOptions))return 0;this._materials[0]?.setParameters(this._fastUpdates.materialParameters)}return 2}_getVertexData(r){let i=0;const s=r.paths,a=[],o=r.spatialReference,n=this._context.elevationProvider.spatialReference,l=this._context.renderCoordsHelper.spatialReference,c=w(r.hasZ),h=s.map(r=>{const i={stack:[],error:void 0,hasError:!1};try{const t=he;e(i,pe,!1);for(let e=1;e<r.length;++e)c(r[e],r[e-1])&&t.add(e);return 0===t.size?r:r.filter((e,r)=>!t.has(r))}catch(s){i.error=s,i.hasError=!0}finally{t(i)}});for(const e of h)i+=e.length;const p=b(3*i);let m,d=0;for(const e of h){a.push({offset:d,numVertices:e.length});for(const t of e)p[d++]=t[0],p[d++]=t[1],p[d++]=r.hasZ?t[2]:0}return null==n||o.equals(n)||f(p,o,0,p,n,0,i)?(null==n||n.equals(l)?m=v(p):(m=b(3*i),f(p,n,0,m,l,0,i)),{pathVertexDataInfos:a,vertexDataES:p,vertexDataRS:m}):null}_createAs3DShape(e,t){const{graphic:r,renderingInfo:i}=e,n=r.geometry,l=this._getVertexData(n);if(null==l)return this.logger.warn("PathSymbol3DLayer geometry failed to be created (failed to project geometry to view spatial reference)"),null;if(0===l.pathVertexDataInfos.length)return 0!==n.paths.length&&n.paths.some(e=>e.length>0)||this.logger.warn("PathSymbol3DLayer geometry failed to be created (no paths were defined)"),null;const c=new Array,h=n.spatialReference,d=g(),u=this._context.renderCoordsHelper,f=new O(l.vertexDataES),b=r.uid,v=x(l.vertexDataRS.length);for(const g of l.pathVertexDataInfos){const e=g.numVertices;if(e<2)continue;const r=g.offset;if(null!=this._context.clippingExtent&&(y(l.vertexDataES,r,e,d),!_(d,this._context.clippingExtent)))continue;const n=new Array,x=r+3*e;for(let i=r;i<x;i+=3){f.offset=i;const e=D(f,this._context.elevationProvider,t,u);m(le,l.vertexDataRS[i],l.vertexDataRS[i+1],l.vertexDataRS[i+2]),u.setAltitude(le,e),l.vertexDataRS[i]=le[0],l.vertexDataRS[i+1]=le[1],l.vertexDataRS[i+2]=le[2],n.push(Y(this._upVectorAlignment))}const w=new F(n,l.vertexDataES,l.vertexDataRS,r,v);se(w,this._upVectorAlignment,this._context.renderCoordsHelper);const S=new M(w,this._profile,this._extruder,this._capBuilder,this._upVectorAlignment);let P=null;if(this._fastUpdates){const{size:e,color:t,opacity:r}=this._fastUpdates.visualVariables,s=L(e,i.size),a=k(t,i.color),o=k(r,i.opacity);P=new J(S,s,a,o)}else{const e=p(this._intrinsicSize);if(this._drivenProperties.size){const t=i.size?.output??["symbol-value","symbol-value","symbol-value"];e[0]*=ae(t[0],"symbol-value"===t[2]?this.symbolLayer.height||0:t[2],this.symbolLayer.width||0),e[1]*=ae(t[2],"symbol-value"===t[0]?this.symbolLayer.width||0:t[0],this.symbolLayer.height||0)}const t=new $(S);t.bake(e);const r=this._getDrivenColor(i);r&&t.bakeVertexColors(r),P=t}const j=P.createGeometryData(),C=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:b,layerViewUid:this._context.layerViewUid}),V=new N(this._materials[0],j,P,h,this._stencilWidth,C);V.transformation=s(o(),a,S.path.origin),c.push(V)}if(0===c.length)return null;const w=new I({geometries:c,layerViewUid:this._context.layerViewUid,graphicUid:b}),S=new C(this,w,null,(e,t,r,i,s)=>ne(e,t,i,s,this._upVectorAlignment),t,null);return S.alignedSampledElevation=0,S.needsElevationUpdates=P(t.mode),S}_getDrivenColor(e){return this._hasDrivenColorOrOpacity?this._getDrivenUInt8ColorWithNaNSupport(e,this._materialColor,!1):null}get _materialColor(){return this.symbolLayer.material?.color}_getFallbackOpacityAndColor(e){return this._materialColor?.toUnitRGBA()??e}get _cap(){return this.symbolLayer.cap||"butt"}_updateTransparentDepedentMaterialParameters(){const e=this._materials[0];e&&e.setParameters({cullFace:e.transparent||"none"===this._cap?0:2})}}function se(e,t,r){const{origin:i,positions:s}=e;let a=e.offset;switch(t){default:case 0:for(const t of e.vertices)le[0]=s[a++]+i[0],le[1]=s[a++]+i[1],le[2]=s[a++]+i[2],r.worldUpAtPosition(le,le),t.setFrameFromUpVector(le);break;case 1:le[0]=s[a]+i[0],le[1]=s[a+1]+i[1],le[2]=s[a+2]+i[2],r.worldUpAtPosition(le,le),K(e,le)}}function ae(e,t,r){switch(e){case"symbol-value":return r;case"proportional":return t;default:return e}}function oe(e,t,r,i){let s=0;const{origin:a,vertices:o,positions:n,positionsES:l}=e,c=e.offset+3*o.length;for(let h=e.offset;h<c;h+=3)m(le,l[h],l[h+1],l[h+2]),r(le,ce),s+=ce.sampledElevation,le[0]=n[h]+a[0],le[1]=n[h+1]+a[1],le[2]=n[h+2]+a[2],i.setAltitude(le,ce.z),n[h]=le[0]-a[0],n[h+1]=le[1]-a[1],n[h+2]=le[2]-a[2];return e.updatePathVertexInformation(),s/o.length}function ne(e,t,r,i,s){const a=e.stageObject,o=a.geometries;let n=0;for(const l of o){if(!Z(l))continue;const e=l.path,o=e.builder.path;n+=oe(o,t,r,i),0!==s&&se(o,s,i),e.onPathChanged(l),l.invalidateBoundingInfo(),a.geometryVertexAttributeUpdated(l,"position")}return n/o.length}const le=u(),ce=new j,he=new Set,pe=i({remove:()=>he.clear()});export{ie as Graphics3DPathSymbolLayer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import has from"../../../../core/has.js";import{pt2px as e}from"../../../../core/screenUtils.js";import{ZEROS as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromBuffer as r,intersectsClippingArea as i,empty as n,expandWithAABB as s,create as o}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as a,doubleSubArray as l}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as c}from"../../../../geometry/support/FloatArray.js";import{getContinuousIndexArray as p}from"../../../../geometry/support/Indices.js";import{elevationModeChangeUpdateType as u,needsElevationUpdates2D as h}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as d}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as m}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as _}from"./Graphics3DSymbolLayer.js";import{mixinColorAndOpacity as g}from"./graphicUtils.js";import{parseCapType as y,computeSymbolLayerIndex as f}from"./lineUtils.js";import{geometryAsPolygon as v,createColorGeometry as x,PolygonCreationDataBase as b}from"./polygonUtils.js";import{initFastSymbolUpdatesState as C,updateFastSymbolUpdatesState as S,getAttributeValue as P,ConvertOptions as D}from"../support/FastSymbolUpdates.js";import{createMaterial as O,uvElevationAligner as U}from"../support/patternUtils.js";import{writeMapSpaceUVCoordsPerConnectedPart as w,writeMapSpaceUVCoordsDraped as j}from"../support/uvUtils.js";import{createGeometry as I}from"../../support/engineContent/line.js";import{loadTessellationUtils as G,preloadedPolygonToRenderInfoElevationAligned as A,preloadedPolygonToRenderInfoDraped as E}from"../../support/renderInfoUtils/polygon.js";import{Object3D as R}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as V}from"../../webgl-engine/lib/RenderGeometry.js";import{isScreenSizePerspectiveEnabled as L}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{getStipplePatternForLinePattern as M}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 F=["polyline","polygon","extent"];class T extends _{static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,r,i){super(e,t,r,i,N(t)),this._needsUV=!1,this._materials=[]}async doLoad(){this._fastUpdates=C(this._context.renderer,this._vvConvertOptions),await G()}get _materialColor(){return this.symbolLayer.material?.color}get _emissiveStrength(){if(has("enable-feature:emissive-on-none-volumetrics")){const e=this.symbolLayer.material?.emissive;return("color"===e?.source?e?.strength:void 0)??0}return 0}_createMaterials(){if(this._materials.length>0)return;const t=this._materialColor,r=this._getCombinedOpacityAndColor(t);this._materials[0]=O(this.symbolLayer,{color:r,forceTransparentMode:this.needsDrivenTransparentPass,hasVertexColors:this._drivenProperties.color||this._drivenProperties.opacity,draped:this.draped,hasSlicePlane:this._context.slicePlaneEnabled,emissiveStrength:this._emissiveStrength,...this._fastUpdates?.materialParameters}),this._needsUV=this._materials[0]instanceof z;const i=this.symbolLayer.outline;if(q(i)){const t=M(i.pattern),r=y(i.pattern?i.patternCap||"butt":"square");this._materials[1]=new B({width:e(i.size),color:this._getOutlineColor(),polygonOffset:3,polygonOffsetIndex:f(this._renderPriority,this._renderPriorityStep),hasSlicePlane:this._context.slicePlaneEnabled,isClosed:!0,stipplePattern:t,cap:r,screenSizePerspective:this._outlineScreenSizePerspective},this.view.state.isGlobal)}}get _outlineScreenSizePerspective(){return!this.draped&&L(this._context.layer.screenSizePerspectiveEnabled)?this.view.screenSizePerspective.parameters:null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,F,this.symbolLayer.type))return null;const r=this._getDrivenUInt8Color(e.renderingInfo,this._materialColor,!1),i=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus("on-the-ground"===i.mode),this._createMaterials(),this.draped?this._createAsOverlay(e.renderingInfo,t,r):this._createAs3DShape(e.renderingInfo,t,r,i)}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return 0;if(!S(this._fastUpdates,t,this._vvConvertOptions))return 0;this._materials[0]?.setParameters(this._fastUpdates.materialParameters)}return 2}layerOpacityChanged(){if(null!=this._materials[0]){const e=this._materials[0].parameters.color,t=this._materialColor,r=this._getCombinedOpacity(t);this._materials[0].setParameters({color:[e[0],e[1],e[2],r],forceTransparentMode:this.needsDrivenTransparentPass})}if(null!=this._materials[1]){const 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,r){const i=this._elevationContext.mode,n=u(T.elevationModeChangeTypes,r,i);if(1!==n)return n;const s=h(i);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>s)}slicePlaneEnabledChanged(){if(this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[1]){const e={hasSlicePlane:this._context.slicePlaneEnabled};this._materials[1].setParameters(e)}return!0}physicalBasedRenderingChanged(){return!0}_containsRenderableGeometry(e){return e.polygonIndexCount>0||null!=this._materials[1]&&("vertex-data"===e.outline.output?e.outline.outlines.length>0:e.outlineIndexCount>0)}_createAs3DShape(e,t,r,i){const n=v(t.geometry);if(!n)return null;const s=A(n,this._context.elevationProvider,this._context.renderCoordsHelper,i,{projectIfNearlyVertical:!0,outlineOutput:"vertex-data",owner:this._context.layer});if(null==s)return null;const o=new W(s,r,this._context.layerViewUid,t.uid),u=o.renderData.vertexCount;if(this._needsUV){o.uvMapSpace=c(4*u,!0),o.textureElementIndices=new Array(u),o.boundingRect=a(o.renderData.polygonIndices.length/3*9);const e=w(o.uvMapSpace,o.boundingRect,o.textureElementIndices,o.renderData.positions,o.renderData.polygonIndices,this._context.renderCoordsHelper);o.boundingRect=l(o.boundingRect,0,9*e),o.boundingRectIndices=p(e)}if(o.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(o),this._createAs3DShapeFill(e,o),this._materials[1]&&this._createAs3DShapeOutline(o),this._logGeometryCreationWarnings(o.renderData,n.rings,"rings","FillSymbol3DLayer"),0===o.outGeometries.length)return null;const d=new R({geometries:o.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:t.uid}),_=new m(this,d,null,U,i);return _.alignedSampledElevation=o.renderData.sampledElevation,_.needsElevationUpdates=h(i.mode),_}_createAs3DShapeFill(e,t){const{mapPositions:n,positions:s,polygonIndices:o,polygonIndexCount:a}=t.renderData;if(0===a)return;if(null!=this._context.clippingExtent&&(r(n,H),!i(H,this._context.clippingExtent)))return;const l=this._fastUpdates?.visualVariables.color,c=x({material:this._materials[0],indices:o,mapPositions:n,attributeData:{position:s,color:l?null:t.color,colorFeature:l?P(l,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(c)}_createAs3DShapeOutline(e){if(null==this._materials[1])return;const{outline:t}=e.renderData;if("vertex-data"!==t.output)return;const{outlines:n}=t;if(null!=n&&0!==n.length)for(const{mapPositions:s,position:o}of n){if(null!=this._context.clippingExtent&&(r(s,H),!i(H,this._context.clippingExtent)))continue;const t=I(this._materials[1],{overlayInfo:null,removeDuplicateStartEnd:!0,mapPositions:s,attributeData:{position:o}},e.olidColor);e.outGeometries.push(t)}}_createAsOverlay(e,t,r){const i=v(t.geometry);if(null==i)return null;this._materials[0].renderPriority=this._renderPriority+this._renderPriorityStep/2,null!=this._materials[1]&&(this._materials[1].renderPriority=this._renderPriority);const s=E(i,{drapedSpatialReference:this._context.overlaySR,outlineOutput:"vertex-data",owner:this._context.layer});if(null==s)return null;const o=new k(s,r,this._context.layerViewUid,t.uid);return this._needsUV&&(o.uvMapSpace=c(4*o.renderData.vertexCount,!0),j(o.uvMapSpace,o.renderData.positions,this._context.overlaySR,this._context.graphicsCoreOwner.view.state.viewingMode)),o.outBoundingBox=n(),o.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(o),this._createAsOverlayFill(e,o),this._materials[1]&&this._createAsOverlayOutline(o),this._logGeometryCreationWarnings(o.renderData,i.rings,"rings","FillSymbol3DLayer"),new d(this,o.outGeometries,o.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayFill(e,t){const{positions:n,polygonIndices:o,polygonIndexCount:a}=t.renderData;if(0===a)return;const l=r(n,H);if(!i(l,this._context.clippingExtent))return;s(t.outBoundingBox,l);const c=this._fastUpdates?.visualVariables.color,p=x({material:this._materials[0],indices:o,attributeData:{position:n,color:c?null:t.color,colorFeature:c?P(c,e.color):null,uvMapSpace:this._needsUV?t.uvMapSpace:null,olidColor:t.olidColor}});t.outGeometries.push(new V(p,t))}_createAsOverlayOutline(e){if(null==this._materials[1])return;const{outline:t}=e.renderData;if("vertex-data"!==t.output)return;const{outlines:n}=t;for(const{position:o}of n){if(r(o,H),!i(H,this._context.clippingExtent))continue;s(e.outBoundingBox,H);const t=I(this._materials[1],{overlayInfo:{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper},removeDuplicateStartEnd:!0,attributeData:{position:o}},e.olidColor);e.outGeometries.push(new V(t,e))}}_getOutlineOpacity(){const e=this.symbolLayer?.outline?.color;return(this.draped?1:this._getLayerOpacity())*(null!=e?e.a:0)}_getOutlineColor(){const e=this.symbolLayer?.outline?.color,t=this._getOutlineOpacity();return g(e?.toUnitRGB(),t)}test(){return{...super.test(),createAsOverlay:(e,t,r)=>this._createAsOverlay(e,t,r),createAs3DShape:(e,t,r,i)=>this._createAs3DShape(e,t,r,i)}}get _vvConvertOptions(){return new D({supports:{size:!1,color:!0,rotation:!1,opacity:!1},fallbackColor:this._materialColor?.toUnitRGBA()??t})}}const H=o();class W extends b{constructor(e,t,r,i){super(e,r,i),this.color=t}}class k extends b{constructor(e,t,r,i){super(e,r,i),this.color=t}}function q(e){return null!=e?.size&&e.size>0&&null!=e.color&&(null==e.pattern||"style"!==e.pattern.type||"none"!==e.pattern.style)}function N(e){return 1===(e.material?.color?.a??0)}export{T as Graphics3DPolygonFillSymbolLayer};
2
+ import has from"../../../../core/has.js";import{pt2px as e}from"../../../../core/screenUtils.js";import{ZEROS as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromBuffer as r,intersectsClippingArea as i,empty as s,expandWithAABB as n,create as o}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as a,doubleSubArray as l}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as c}from"../../../../geometry/support/FloatArray.js";import{getContinuousIndexArray as p}from"../../../../geometry/support/Indices.js";import{isDrivenOpacityFallbackAlwaysOpaque as u}from"../../../../renderers/visualVariables/support/visualVariableUtils.js";import{elevationModeChangeUpdateType as h,needsElevationUpdates2D as d}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as m}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as _}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as g}from"./Graphics3DSymbolLayer.js";import{mixinColorAndOpacity as y}from"./graphicUtils.js";import{parseCapType as f,computeSymbolLayerIndex as v}from"./lineUtils.js";import{geometryAsPolygon as x,createColorGeometry as b,PolygonCreationDataBase as C}from"./polygonUtils.js";import{initFastSymbolUpdatesState as S,updateFastSymbolUpdatesState as P,getAttributeValue as D,ConvertOptions as O}from"../support/FastSymbolUpdates.js";import{createMaterial as U,uvElevationAligner as w}from"../support/patternUtils.js";import{writeMapSpaceUVCoordsPerConnectedPart as j,writeMapSpaceUVCoordsDraped as I}from"../support/uvUtils.js";import{createGeometry as G}from"../../support/engineContent/line.js";import{loadTessellationUtils as A,preloadedPolygonToRenderInfoElevationAligned as E,preloadedPolygonToRenderInfoDraped as R}from"../../support/renderInfoUtils/polygon.js";import{Object3D as V}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as L}from"../../webgl-engine/lib/RenderGeometry.js";import{isScreenSizePerspectiveEnabled as M}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{getStipplePatternForLinePattern as z}from"../../webgl-engine/materials/lineStippleUtils.js";import{PatternMaterial as B}from"../../webgl-engine/materials/PatternMaterial.js";import{RibbonLineMaterial as F}from"../../webgl-engine/materials/RibbonLineMaterial.js";const T=["polyline","polygon","extent"];class H extends g{static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,r,i){super(e,t,r,i,u(t)),this._needsUV=!1,this._materials=[]}async doLoad(){this._fastUpdates=S(this._context.renderer,this._vvConvertOptions),await A()}get _materialColor(){return this.symbolLayer.material?.color}get _emissiveStrength(){if(has("enable-feature:emissive-on-none-volumetrics")){const e=this.symbolLayer.material?.emissive;return("color"===e?.source?e?.strength:void 0)??0}return 0}_createMaterials(){if(this._materials.length>0)return;const t=this._materialColor,r=this._getCombinedOpacityAndColor(t);this._materials[0]=U(this.symbolLayer,{color:r,forceTransparentMode:this.needsDrivenTransparentPass,hasVertexColors:this._drivenProperties.color||this._drivenProperties.opacity,draped:this.draped,hasSlicePlane:this._context.slicePlaneEnabled,emissiveStrength:this._emissiveStrength,...this._fastUpdates?.materialParameters}),this._needsUV=this._materials[0]instanceof B;const i=this.symbolLayer.outline;if(N(i)){const t=z(i.pattern),r=f(i.pattern?i.patternCap||"butt":"square");this._materials[1]=new F({width:e(i.size),color:this._getOutlineColor(),polygonOffset:3,polygonOffsetIndex:v(this._renderPriority,this._renderPriorityStep),hasSlicePlane:this._context.slicePlaneEnabled,isClosed:!0,stipplePattern:t,cap:r,screenSizePerspective:this._outlineScreenSizePerspective},this.view.state.isGlobal)}}get _outlineScreenSizePerspective(){return!this.draped&&M(this._context.layer.screenSizePerspectiveEnabled)?this.view.screenSizePerspective.parameters:null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,T,this.symbolLayer.type))return null;const r=this._getDrivenUInt8Color(e.renderingInfo,this._materialColor,!1),i=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus("on-the-ground"===i.mode),this._createMaterials(),this.draped?this._createAsOverlay(e.renderingInfo,t,r):this._createAs3DShape(e.renderingInfo,t,r,i)}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return 0;if(!P(this._fastUpdates,t,this._vvConvertOptions))return 0;this._materials[0]?.setParameters(this._fastUpdates.materialParameters)}return 2}layerOpacityChanged(){if(null!=this._materials[0]){const e=this._materials[0].parameters.color,t=this._materialColor,r=this._getCombinedOpacity(t);this._materials[0].setParameters({color:[e[0],e[1],e[2],r],forceTransparentMode:this.needsDrivenTransparentPass})}if(null!=this._materials[1]){const 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,r){const i=this._elevationContext.mode,s=h(H.elevationModeChangeTypes,r,i);if(1!==s)return s;const n=d(i);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>n)}slicePlaneEnabledChanged(){if(this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[1]){const e={hasSlicePlane:this._context.slicePlaneEnabled};this._materials[1].setParameters(e)}return!0}physicalBasedRenderingChanged(){return!0}_containsRenderableGeometry(e){return e.polygonIndexCount>0||null!=this._materials[1]&&("vertex-data"===e.outline.output?e.outline.outlines.length>0:e.outlineIndexCount>0)}_createAs3DShape(e,t,r,i){const s=x(t.geometry);if(!s)return null;const n=E(s,this._context.elevationProvider,this._context.renderCoordsHelper,i,{projectIfNearlyVertical:!0,outlineOutput:"vertex-data",owner:this._context.layer});if(null==n)return null;const o=new k(n,r,this._context.layerViewUid,t.uid),u=o.renderData.vertexCount;if(this._needsUV){o.uvMapSpace=c(4*u,!0),o.textureElementIndices=new Array(u),o.boundingRect=a(o.renderData.polygonIndices.length/3*9);const e=j(o.uvMapSpace,o.boundingRect,o.textureElementIndices,o.renderData.positions,o.renderData.polygonIndices,this._context.renderCoordsHelper);o.boundingRect=l(o.boundingRect,0,9*e),o.boundingRectIndices=p(e)}if(o.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(o),this._createAs3DShapeFill(e,o),this._materials[1]&&this._createAs3DShapeOutline(o),this._logGeometryCreationWarnings(o.renderData,s.rings,"rings","FillSymbol3DLayer"),0===o.outGeometries.length)return null;const h=new V({geometries:o.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:t.uid}),m=new _(this,h,null,w,i);return m.alignedSampledElevation=o.renderData.sampledElevation,m.needsElevationUpdates=d(i.mode),m}_createAs3DShapeFill(e,t){const{mapPositions:s,positions:n,polygonIndices:o,polygonIndexCount:a}=t.renderData;if(0===a)return;if(null!=this._context.clippingExtent&&(r(s,W),!i(W,this._context.clippingExtent)))return;const l=this._fastUpdates?.visualVariables.color,c=b({material:this._materials[0],indices:o,mapPositions:s,attributeData:{position:n,color:l?null:t.color,colorFeature:l?D(l,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(c)}_createAs3DShapeOutline(e){if(null==this._materials[1])return;const{outline:t}=e.renderData;if("vertex-data"!==t.output)return;const{outlines:s}=t;if(null!=s&&0!==s.length)for(const{mapPositions:n,position:o}of s){if(null!=this._context.clippingExtent&&(r(n,W),!i(W,this._context.clippingExtent)))continue;const t=G(this._materials[1],{overlayInfo:null,removeDuplicateStartEnd:!0,mapPositions:n,attributeData:{position:o}},e.olidColor);e.outGeometries.push(t)}}_createAsOverlay(e,t,r){const i=x(t.geometry);if(null==i)return null;this._materials[0].renderPriority=this._renderPriority+this._renderPriorityStep/2,null!=this._materials[1]&&(this._materials[1].renderPriority=this._renderPriority);const n=R(i,{drapedSpatialReference:this._context.overlaySR,outlineOutput:"vertex-data",owner:this._context.layer});if(null==n)return null;const o=new q(n,r,this._context.layerViewUid,t.uid);return this._needsUV&&(o.uvMapSpace=c(4*o.renderData.vertexCount,!0),I(o.uvMapSpace,o.renderData.positions,this._context.overlaySR,this._context.graphicsCoreOwner.view.state.viewingMode)),o.outBoundingBox=s(),o.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(o),this._createAsOverlayFill(e,o),this._materials[1]&&this._createAsOverlayOutline(o),this._logGeometryCreationWarnings(o.renderData,i.rings,"rings","FillSymbol3DLayer"),new m(this,o.outGeometries,o.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayFill(e,t){const{positions:s,polygonIndices:o,polygonIndexCount:a}=t.renderData;if(0===a)return;const l=r(s,W);if(!i(l,this._context.clippingExtent))return;n(t.outBoundingBox,l);const c=this._fastUpdates?.visualVariables.color,p=b({material:this._materials[0],indices:o,attributeData:{position:s,color:c?null:t.color,colorFeature:c?D(c,e.color):null,uvMapSpace:this._needsUV?t.uvMapSpace:null,olidColor:t.olidColor}});t.outGeometries.push(new L(p,t))}_createAsOverlayOutline(e){if(null==this._materials[1])return;const{outline:t}=e.renderData;if("vertex-data"!==t.output)return;const{outlines:s}=t;for(const{position:o}of s){if(r(o,W),!i(W,this._context.clippingExtent))continue;n(e.outBoundingBox,W);const t=G(this._materials[1],{overlayInfo:{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper},removeDuplicateStartEnd:!0,attributeData:{position:o}},e.olidColor);e.outGeometries.push(new L(t,e))}}_getOutlineOpacity(){const e=this.symbolLayer?.outline?.color;return(this.draped?1:this._getLayerOpacity())*(null!=e?e.a:0)}_getOutlineColor(){const e=this.symbolLayer?.outline?.color,t=this._getOutlineOpacity();return y(e?.toUnitRGB(),t)}test(){return{...super.test(),createAsOverlay:(e,t,r)=>this._createAsOverlay(e,t,r),createAs3DShape:(e,t,r,i)=>this._createAs3DShape(e,t,r,i)}}get _vvConvertOptions(){return new O({supports:{size:!1,color:!0,rotation:!1,opacity:!1},fallbackColor:this._materialColor?.toUnitRGBA()??t})}}const W=o();class k extends C{constructor(e,t,r,i){super(e,r,i),this.color=t}}class q extends C{constructor(e,t,r,i){super(e,r,i),this.color=t}}function N(e){return null!=e?.size&&e.size>0&&null!=e.color&&(null==e.pattern||"style"!==e.pattern.type||"none"!==e.pattern.style)}export{H as Graphics3DPolygonFillSymbolLayer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../../core/PooledArray.js";import{castRenderScreenPointArray3 as t,createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{getMetersPerVerticalUnitForSR as n}from"../../../../core/units.js";import{add as i,normalize as s,dot as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as c,copy as a,negativeInfinity as d}from"../../../../geometry/support/aaBoundingRect.js";import{create as u}from"../../../../geometry/support/ray.js";import{sv3d as y}from"../../../../geometry/support/vectorStacks.js";import{getElevationOffsetInMeters as h}from"../../../../support/elevationInfoUtils.js";import{computeMapPointFromVec3d as p}from"../../support/hitTest.js";import{fromRenderAtEye as g,fromScreen as m}from"../../support/geometryUtils/ray.js";import{defaultTolerance as f,Intersector as _,defaultScreenPolygonTriangleProcessor as P}from"../../webgl-engine/lib/Intersector.js";import{RayIntersectionQuery as w}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{isValidIntersectorResult as R}from"../../webgl-engine/lib/IntersectorResult.js";import{SliceScreenPolygonTriangleProcessor as I,sliceFilterPredicate as b}from"../../webgl-engine/lib/intersectorUtils.js";import{prepareScreenPolygonIntersectionQuery as v}from"../../webgl-engine/lib/screenPolygonIntersectionUtils.js";import{TaskPriority as U}from"../../../support/Scheduler.js";class j{constructor(t,r,n){this.viewingMode=t,this._forEachLayer=r,this._view=n,this._externalIntersectionHandlers=new e,this._tolerance=f,this._tmpRay=u(),this._tmpRegion=c(),this._validateHUDIntersector=new _(this.viewingMode),this._validateHUDIntersector.options.hud=!1,this._screenPolygonIntersectionTask=this._view.resourceController.scheduler.registerTask(U.SCREEN_POLYGON_INTERSECTION)}destroy(){this._screenPolygonIntersectionTask.remove(),this._externalIntersectionHandlers.prune()}intersectScreen(e,t,r){return this.intersectRay(this._getPickRay(e,this._tmpRay),x(this.viewingMode),t,r)}intersectScreenFreePointFallback(e,t,r){return this.intersectRayFreePointFallback(this._getPickRay(e,this._tmpRay),t,r)}intersectRayFreePointFallback(e,t,r){return this.intersectRay(e,x(this.viewingMode),t,r)||this._intersectRayFreePointLocal(e,t)}intersectRay(e,t,r,n){return t.options.selectionMode=!1,t.options.store=0,this.computeIntersection(e,t,!1,n),!!t.results.min&&t.results.min.getIntersectionPoint(r)}getCenterRayWithSubpixelOffset(e,t,r=.5,n=.5){return e.getRenderCenter(E,r,n),E[0]+=.0466,E[1]-=.0123,g(e,E,t)}intersectIntersectorScreen(e,t,r){this.computeIntersection(this._getPickRay(e,this._tmpRay),t,!1,r)}async intersectIntersectorScreenPolygon(e,t,r){t.polygonResults.init();const n=this._view.state.camera,i=await v(n,e);null!=i&&await this._screenPolygonIntersectionTask.scheduleGenerator(()=>this._intersectIntersectorScreenPolygon(n,t,i,r))}*_intersectIntersectorScreenPolygon(e,t,r,n){const i=new F(n,this._forEachLayer);t.options.selectOpaqueTerrainOnly=!n||!("include"in n||"exclude"in n),t.camera=e,t.point=null,t.screenPolygonTriangleProcessor=P,yield*t.intersectScreenPolygon(i.layers,r);const s=this._view.slice.plane,o=s?b(s):null,l=s?new I(s):null;t.screenPolygonTriangleProcessor=l??P,yield*t.intersectScreenPolygon(i.sliceableLayers,r),t.screenPolygonTriangleProcessor=P,yield*this._intersectPolygonHandlersGenerator(t,i,r,o,l),t.polygonResults.sortResults()}intersectToolIntersectorScreen(e,t,r){const n=this._getPickRay(e,this._tmpRay);this.intersectToolIntersectorRay(n,t,r)}intersectToolIntersectorRay(e,t,r){t.options.selectionMode=!0,this.computeIntersection(e,t,!1,r);const n=t.results.min;!!this._view.basemapTerrain&&this._view.basemapTerrain.opaque||R(n)&&7!==n.intersector||(t.options.selectionMode=!1,this.computeIntersection(e,t,!1,r))}setTolerance(e=f){this._tolerance=e}addIntersectionHandler(e){this._externalIntersectionHandlers.push(e),this._externalIntersectionHandlers.sort((e,t)=>7===e.type?1:7===t.type?-1:0)}removeIntersectionHandler(e){null!=this._externalIntersectionHandlers.removeUnordered(e)&&this._externalIntersectionHandlers.sort((e,t)=>7===e.type?1:7===t.type?-1:0)}_getPickRay(e,t){const r=this._view.state.camera;return m(r,e,t)}_intersectRayFreePointLocal(e,t){return 2!==this.viewingMode||null==e||i(t,e.origin,s(y.get(),e.direction)),!1}intersectElevationFromScreen(e,t,r=0,n=null){return this._intersectElevation(this._getPickRay(e,this._tmpRay),t,r,n)}_intersectElevation(e,r,i=0,l=null){if(null==e)return null;const c=this._view,{renderCoordsHelper:a}=c,d=n(c.spatialReference),u=null!=r?r.mode:"absolute-height",g=h(r)/d,m=("on-the-ground"!==u?g+i:0)*d/a.unitInMeters,{camera:f}=c.state;if("absolute-height"===u){const t=a?.getAltitude(f.eye),r=o(s(S,e.direction),a.worldUpAtPosition(f.eye,k));if(t<m&&r<0||t>=m&&r>0)return null;if(a.intersectInfiniteManifold(e,m,S)){const e=p(c,S);return e.z??=0,e.z-=g,e}return null}const P=f.projectToRenderScreen(e.origin,t(y.get())),w=new F(null,this._forEachLayer),R=c.slice.plane,I=R?b(R):null,v=new _(this.viewingMode);v.options.store=0,v.options.verticalOffset=m,v.options.normalRequired=!1;const U=this._createRayIntersectionQuery(e,P,!1);v.reset(U.beginPoint,U.endPoint,f),v.point=P;let j=null;if(l&&"type"in l&&"graphics"===l.type){const e=c.allLayerViews.find(e=>e.layer===l)?.uid;j=e?t=>t.layerViewUid===e:null}else l&&(j=e=>e.graphicUid!==l.uid);switch(u){case"relative-to-scene":{const e=e=>(!j||j(e))&&!!e.lastValidElevationBB;v.intersect(w.layers,U.screenPoint,this._tolerance,null,e),this._intersectRayHandlers(v,w,U,I,!1,e=>2===e.type||7===e.type||8===e.type,!1);break}case"on-the-ground":case"relative-to-ground":this._intersectRayHandlers(v,w,U,I,!1,e=>e.isGround,!1)}if(v.results.min.getIntersectionPoint(S)){const e=p(c,S);return e.z=i,e}return null}computeIntersection(e,r,n,i){if(null==e)return;const s=this._view.state.camera,o=s.projectToRenderScreen(e.origin,t(y.get())),l=new F(i,this._forEachLayer);r.options.selectOpaqueTerrainOnly=!i||!("include"in i||"exclude"in i);const c=this._createRayIntersectionQuery(e,o,n);r.reset(c.beginPoint,c.endPoint,s),r.intersect(l.layers,c.screenPoint,this._tolerance);const a=this._view.slice.plane,d=a?b(a):null;r.intersect(l.sliceableLayers,c.screenPoint,this._tolerance,d);const u=i&&(i.requiresGroundFeedback||i.enableDraped);this._intersectRayHandlers(r,l,c,d,!!u);const h=y.get(),p=this._view,g=p.basemapTerrain;if(i&&i.enableDraped&&null!=g.spatialReference&&r.results.ground.getIntersectionPoint(h)){const e=p.overlayManager.renderer,t=p.renderCoordsHelper.spatialReference,n=y.get();p.renderCoordsHelper.fromRenderCoords(h,n,g.spatialReference),n[2]=p.elevationProvider?.getElevation(h[0],h[1],h[2],t,"ground")??0,e.intersectRay(r,n,r.results.ground,e=>l.filterRenderGeometry(e))}r.sortResults(),this._processHUDResults(r)}_processHUDResults(e){const t=e.results.hud;a(this._tmpRegion,d);const r=new Array,n=this._tmpRegion,i=e=>{r.push(new L(e))};e.sortResults(t.all),null!=t.min.distance&&i(t.min);for(const c of t.all)t.min.target.object!==c.target.object&&t.max.target.object!==c.target.object&&i(c);if(null!=t.max.distance&&t.max.target.object!==t.min.target.object&&i(t.max),!r.length)return;n[0]===n[2]&&(n[2]+=1),n[1]===n[3]&&(n[3]+=1);let s=!0;const o=null==e.results.max.distance;let l=0;for(const c of r)s&&(e.results.min.copy(c.result),s=!1),o&&e.results.max.copy(c.result),2===e.options.store&&e.results.all.splice(l++,0,c.result)}_createRayIntersectionQuery(e,t,r){return new w(e.origin,i(l(),e.origin,e.direction),t,r)}_intersectRayHandlers(e,t,r,n,i,s=()=>!0,o=!0){const{options:l}=e,c=l.isFiltered,a=l.filteredLayerViewUids;for(const{handler:d,filterPredicate:u,isFiltered:y,filteredLayerViewUids:h}of this._getFilteredIntersectionHandlers(t,n,null,s,o))(!y||d.isGround&&i)&&(l.isFiltered=y,l.filteredLayerViewUids=h,d.intersectRay(e,u,e.rayBegin,e.rayEnd,r.screenPoint,r.isVerticalRay));l.isFiltered=c,l.filteredLayerViewUids=a}*_intersectPolygonHandlersGenerator(e,t,r,n,i,s=()=>!0,o=!0){const{options:l}=e,c=l.isFiltered,a=l.filteredLayerViewUids,d=e.screenPolygonTriangleProcessor;for(const{handler:u,screenPolygonTriangleProcessor:y,isFiltered:h,filteredLayerViewUids:p}of this._getFilteredIntersectionHandlers(t,n,i,s,o))h||null==u.intersectScreenPolygon||(l.isFiltered=h,l.filteredLayerViewUids=p,e.screenPolygonTriangleProcessor=y??P,yield*u.intersectScreenPolygon(e,r));l.isFiltered=c,l.filteredLayerViewUids=a,e.screenPolygonTriangleProcessor=d}*_getFilteredIntersectionHandlers(e,t,r,n=()=>!0,i=!0){for(const s of this._externalIntersectionHandlers){if(!n(s))continue;let o=!1;const l=[];if(i){const t=s.layerViewUid,r=s.sublayerId,n=Array.isArray(t),i=n?t:[t];let c=!1;for(const s of i)e.filterLayerViewUid(s,r)?c=!0:n&&l.push(s);o=!c}yield new T(s,s.slicePlaneEnabled?t:null,s.slicePlaneEnabled?r:null,o,l)}}}class L{constructor(e){this.result=e,this.screenPoint=r()}}class T{constructor(e,t,r,n,i){this.handler=e,this.filterPredicate=t,this.screenPolygonTriangleProcessor=r,this.isFiltered=n,this.filteredLayerViewUids=i}}let H;function x(e){return H&&H.viewingMode===e||(H=new _(e)),H}class F{constructor(e,t){this.layers=new Array,this.sliceableLayers=new Array,this.include=e?.include,this.exclude=e?.exclude,t(e=>{e.pickable&&this.filterLayerViewUid(e.apiLayerViewUid)&&(e.sliceable?this.sliceableLayers:this.layers).push(e)})}filterLayerViewUid(e,t){const{include:r,exclude:n}=this;if(null==e)return null==r&&null==n;const i=r instanceof Map?r.get(e)??!1:r?.has(e),s=n instanceof Map?n.get(e)??!1:n?.has(e);return(null==i||("boolean"==typeof i?i:null!=t&&i.has(t)))&&(null==s||!("boolean"==typeof s?s:null!=t&&s.has(t)))}filterRenderGeometry(e){return this.filterLayerViewUid(e.layerViewUid)}}function V(e){return"object"==typeof e&&null!=e&&"intersectRay"in e}const S=l(),k=l(),E=r();export{j as SceneIntersectionHelper,V as isIntersectionHandler};
2
+ import e from"../../../../core/PooledArray.js";import{castRenderScreenPointArray3 as t,createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{getMetersPerVerticalUnitForSR as i}from"../../../../core/units.js";import{add as n,normalize as s,dot as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as c,copy as a,negativeInfinity as d}from"../../../../geometry/support/aaBoundingRect.js";import{create as u}from"../../../../geometry/support/ray.js";import{sv3d as y}from"../../../../geometry/support/vectorStacks.js";import{getElevationOffsetInMeters as h}from"../../../../support/elevationInfoUtils.js";import{computeMapPointFromVec3d as p}from"../../support/hitTest.js";import{fromRenderAtEye as g,fromScreen as m}from"../../support/geometryUtils/ray.js";import{defaultTolerance as f,Intersector as _,defaultScreenPolygonPrimitiveProcessor as P}from"../../webgl-engine/lib/Intersector.js";import{RayIntersectionQuery as w}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{isValidIntersectorResult as R}from"../../webgl-engine/lib/IntersectorResult.js";import{SliceScreenPolygonPrimitiveProcessor as v,sliceFilterPredicate as I}from"../../webgl-engine/lib/intersectorUtils.js";import{prepareScreenPolygonIntersectionQuery as b}from"../../webgl-engine/lib/screenPolygonIntersectionUtils.js";import{TaskPriority as U}from"../../../support/Scheduler.js";class j{constructor(t,r,i){this.viewingMode=t,this._forEachLayer=r,this._view=i,this._externalIntersectionHandlers=new e,this._tolerance=f,this._tmpRay=u(),this._tmpRegion=c(),this._validateHUDIntersector=new _(this.viewingMode),this._validateHUDIntersector.options.hud=!1,this._screenPolygonIntersectionTask=this._view.resourceController.scheduler.registerTask(U.SCREEN_POLYGON_INTERSECTION)}destroy(){this._screenPolygonIntersectionTask.remove(),this._externalIntersectionHandlers.prune()}intersectScreen(e,t,r){return this.intersectRay(this._getPickRay(e,this._tmpRay),F(this.viewingMode),t,r)}intersectScreenFreePointFallback(e,t,r){return this.intersectRayFreePointFallback(this._getPickRay(e,this._tmpRay),t,r)}intersectRayFreePointFallback(e,t,r){return this.intersectRay(e,F(this.viewingMode),t,r)||this._intersectRayFreePointLocal(e,t)}intersectRay(e,t,r,i){return t.options.selectionMode=!1,t.options.store=0,this.computeIntersection(e,t,!1,i),!!t.results.min&&t.results.min.getIntersectionPoint(r)}getCenterRayWithSubpixelOffset(e,t,r=.5,i=.5){return e.getRenderCenter(E,r,i),E[0]+=.0466,E[1]-=.0123,g(e,E,t)}intersectIntersectorScreen(e,t,r){this.computeIntersection(this._getPickRay(e,this._tmpRay),t,!1,r)}async intersectIntersectorScreenPolygon(e,t,r){t.polygonResults.init();const i=this._view.state.camera,n=await b(i,e);null!=n&&await this._screenPolygonIntersectionTask.scheduleGenerator(()=>this._intersectIntersectorScreenPolygon(i,t,n,r))}*_intersectIntersectorScreenPolygon(e,t,r,i){const n=new V(i,this._forEachLayer);t.options.selectOpaqueTerrainOnly=!i||!("include"in i||"exclude"in i),t.camera=e,t.point=null,t.screenPolygonPrimitiveProcessor=P,yield*t.intersectScreenPolygon(n.layers,r);const s=this._view.slice.plane,o=s?I(s):null,l=s?new v(s):null;t.screenPolygonPrimitiveProcessor=l??P,yield*t.intersectScreenPolygon(n.sliceableLayers,r),t.screenPolygonPrimitiveProcessor=P,yield*this._intersectPolygonHandlersGenerator(t,n,r,o,l),t.polygonResults.sortResults()}intersectToolIntersectorScreen(e,t,r){const i=this._getPickRay(e,this._tmpRay);this.intersectToolIntersectorRay(i,t,r)}intersectToolIntersectorRay(e,t,r){t.options.selectionMode=!0,this.computeIntersection(e,t,!1,r);const i=t.results.min;!!this._view.basemapTerrain&&this._view.basemapTerrain.opaque||R(i)&&7!==i.intersector||(t.options.selectionMode=!1,this.computeIntersection(e,t,!1,r))}setTolerance(e=f){this._tolerance=e}addIntersectionHandler(e){this._externalIntersectionHandlers.push(e),this._externalIntersectionHandlers.sort((e,t)=>7===e.type?1:7===t.type?-1:0)}removeIntersectionHandler(e){null!=this._externalIntersectionHandlers.removeUnordered(e)&&this._externalIntersectionHandlers.sort((e,t)=>7===e.type?1:7===t.type?-1:0)}_getPickRay(e,t){const r=this._view.state.camera;return m(r,e,t)}_intersectRayFreePointLocal(e,t){return 2!==this.viewingMode||null==e||n(t,e.origin,s(y.get(),e.direction)),!1}intersectElevationFromScreen(e,t,r=0,i=null){return this._intersectElevation(this._getPickRay(e,this._tmpRay),t,r,i)}_intersectElevation(e,r,n=0,l=null){if(null==e)return null;const c=this._view,{renderCoordsHelper:a}=c,d=i(c.spatialReference),u=null!=r?r.mode:"absolute-height",g=h(r)/d,m=("on-the-ground"!==u?g+n:0)*d/a.unitInMeters,{camera:f}=c.state;if("absolute-height"===u){const t=a?.getAltitude(f.eye),r=o(s(T,e.direction),a.worldUpAtPosition(f.eye,k));if(t<m&&r<0||t>=m&&r>0)return null;if(a.intersectInfiniteManifold(e,m,T)){const e=p(c,T);return e.z??=0,e.z-=g,e}return null}const P=f.projectToRenderScreen(e.origin,t(y.get())),w=new V(null,this._forEachLayer),R=c.slice.plane,v=R?I(R):null,b=new _(this.viewingMode);b.options.store=0,b.options.verticalOffset=m,b.options.normalRequired=!1;const U=this._createRayIntersectionQuery(e,P,!1);b.reset(U.beginPoint,U.endPoint,f),b.point=P;let j=null;if(l&&"type"in l&&"graphics"===l.type){const e=c.allLayerViews.find(e=>e.layer===l)?.uid;j=e?t=>t.layerViewUid===e:null}else l&&(j=e=>e.graphicUid!==l.uid);switch(u){case"relative-to-scene":{const e=e=>(!j||j(e))&&!!e.lastValidElevationBB;b.intersect(w.layers,U.screenPoint,this._tolerance,null,e),this._intersectRayHandlers(b,w,U,v,!1,e=>2===e.type||7===e.type||8===e.type,!1);break}case"on-the-ground":case"relative-to-ground":this._intersectRayHandlers(b,w,U,v,!1,e=>e.isGround,!1)}if(b.results.min.getIntersectionPoint(T)){const e=p(c,T);return e.z=n,e}return null}computeIntersection(e,r,i,n){if(null==e)return;const s=this._view.state.camera,o=s.projectToRenderScreen(e.origin,t(y.get())),l=new V(n,this._forEachLayer);r.options.selectOpaqueTerrainOnly=!n||!("include"in n||"exclude"in n);const c=this._createRayIntersectionQuery(e,o,i);r.reset(c.beginPoint,c.endPoint,s),r.intersect(l.layers,c.screenPoint,this._tolerance);const a=this._view.slice.plane,d=a?I(a):null;r.intersect(l.sliceableLayers,c.screenPoint,this._tolerance,d);const u=n&&(n.requiresGroundFeedback||n.enableDraped);this._intersectRayHandlers(r,l,c,d,!!u);const h=y.get(),p=this._view,g=p.basemapTerrain;if(n&&n.enableDraped&&null!=g.spatialReference&&r.results.ground.getIntersectionPoint(h)){const e=p.overlayManager.renderer,t=p.renderCoordsHelper.spatialReference,i=y.get();p.renderCoordsHelper.fromRenderCoords(h,i,g.spatialReference),i[2]=p.elevationProvider?.getElevation(h[0],h[1],h[2],t,"ground")??0,e.intersectRay(r,i,r.results.ground,e=>l.filterRenderGeometry(e))}r.sortResults(),this._processHUDResults(r)}_processHUDResults(e){const t=e.results.hud;a(this._tmpRegion,d);const r=new Array,i=this._tmpRegion,n=e=>{r.push(new L(e))};e.sortResults(t.all),null!=t.min.distance&&n(t.min);for(const c of t.all)t.min.target.object!==c.target.object&&t.max.target.object!==c.target.object&&n(c);if(null!=t.max.distance&&t.max.target.object!==t.min.target.object&&n(t.max),!r.length)return;i[0]===i[2]&&(i[2]+=1),i[1]===i[3]&&(i[3]+=1);let s=!0;const o=null==e.results.max.distance;let l=0;for(const c of r)s&&(e.results.min.copy(c.result),s=!1),o&&e.results.max.copy(c.result),2===e.options.store&&e.results.all.splice(l++,0,c.result)}_createRayIntersectionQuery(e,t,r){return new w(e.origin,n(l(),e.origin,e.direction),t,r)}_intersectRayHandlers(e,t,r,i,n,s=()=>!0,o=!0){const{options:l}=e,c=l.isFiltered,a=l.filteredLayerViewUids;for(const{handler:d,filterPredicate:u,isFiltered:y,filteredLayerViewUids:h}of this._getFilteredIntersectionHandlers(t,i,null,s,o))(!y||d.isGround&&n)&&(l.isFiltered=y,l.filteredLayerViewUids=h,d.intersectRay(e,u,e.rayBegin,e.rayEnd,r.screenPoint,r.isVerticalRay));l.isFiltered=c,l.filteredLayerViewUids=a}*_intersectPolygonHandlersGenerator(e,t,r,i,n,s=()=>!0,o=!0){const{options:l}=e,c=l.isFiltered,a=l.filteredLayerViewUids,d=e.screenPolygonPrimitiveProcessor;for(const{handler:u,screenPolygonPrimitiveProcessor:y,isFiltered:h,filteredLayerViewUids:p}of this._getFilteredIntersectionHandlers(t,i,n,s,o))h||null==u.intersectScreenPolygon||(l.isFiltered=h,l.filteredLayerViewUids=p,e.screenPolygonPrimitiveProcessor=y??P,yield*u.intersectScreenPolygon(e,r));l.isFiltered=c,l.filteredLayerViewUids=a,e.screenPolygonPrimitiveProcessor=d}*_getFilteredIntersectionHandlers(e,t,r,i=()=>!0,n=!0){for(const s of this._externalIntersectionHandlers){if(!i(s))continue;let o=!1;const l=[];if(n){const t=s.layerViewUid,r=s.sublayerId,i=Array.isArray(t),n=i?t:[t];let c=!1;for(const s of n)e.filterLayerViewUid(s,r)?c=!0:i&&l.push(s);o=!c}yield new H(s,s.slicePlaneEnabled?t:null,s.slicePlaneEnabled?r:null,o,l)}}}class L{constructor(e){this.result=e,this.screenPoint=r()}}class H{constructor(e,t,r,i,n){this.handler=e,this.filterPredicate=t,this.screenPolygonPrimitiveProcessor=r,this.isFiltered=i,this.filteredLayerViewUids=n}}let x;function F(e){return x&&x.viewingMode===e||(x=new _(e)),x}class V{constructor(e,t){this.layers=new Array,this.sliceableLayers=new Array,this.include=e?.include,this.exclude=e?.exclude,t(e=>{e.pickable&&this.filterLayerViewUid(e.apiLayerViewUid)&&(e.sliceable?this.sliceableLayers:this.layers).push(e)})}filterLayerViewUid(e,t){const{include:r,exclude:i}=this;if(null==e)return null==r&&null==i;const n=r instanceof Map?r.get(e)??!1:r?.has(e),s=i instanceof Map?i.get(e)??!1:i?.has(e);return(null==n||("boolean"==typeof n?n:null!=t&&n.has(t)))&&(null==s||!("boolean"==typeof s?s:null!=t&&s.has(t)))}filterRenderGeometry(e){return this.filterLayerViewUid(e.layerViewUid)}}function S(e){return"object"==typeof e&&null!=e&&"intersectRay"in e}const T=l(),k=l(),E=r();export{j as SceneIntersectionHelper,S as isIntersectionHandler};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{someMap as e}from"../../../core/MapUtils.js";import{releaseMaybe as o}from"../../../core/maybe.js";import{subclass as s}from"../../../core/accessorSupport/decorators.js";import{RenderNodeOutput as h}from"../webgl.js";import{isManagedDepthTexture as r}from"./ManagedDepthTexture.js";import i from"./ManagedFBOResource.js";import{ColorAttachment0 as a,DepthStencilAttachment as c}from"../../webgl/enums.js";let l=class extends i{constructor(t,e,o,s,r,i){super(t,i),this.fbo=o,this.type=0,this._colors=new Map,this._name=h.COMPOSITE,this.acquireColor=null,this.acquireDepth=null,this._name=e,this.acquireColor=s,this.acquireDepth=r}dispose(){this.fbo?.dispose()}get usedMemory(){return this.fbo?.usedMemory||0}get name(){return this._name}setName(t){this._name=t}getTexture(t=a){return t===c?this.fbo?.depthStencilTexture:this.fbo?.getColorTexture(t)}get depthTexture(){return this.getTexture(c)}getAttachment(t=a){return t===c?this._depth:this._colors.get(t)}obtainAttachment(t){const e=this.getAttachment(t);return e?.retain(),this.detachColor(t),e}hasAttachment(t){return e(this._colors,e=>e.name===t)}attachDepth(t){return t?.retain(),this.detachDepth(),t&&this.fbo?.attachDepthStencil(t.attachment),this._depth=t,this}detachDepth(){this.fbo?.detachDepthStencilTexture(),this.fbo?.detachDepthStencilBuffer(),this._depth=o(this._depth)}obtainDepthTexture(){const t=this._depth;return r(t)?(this.fbo?.detachDepthStencilTexture(),this._depth=null,t):null}attachColor(t,e){return t.retain(),this.detachColor(e),this.fbo?.attachColorTexture(t.attachment,e),this._colors.set(e,t),this}detachColor(t){this.fbo?.detachColorTexture(t),this._colors.get(t)?.release(),this._colors.delete(t)}detachAllColors(){const t=Array.from(this._colors.keys());this._detachColors(t)}detachAll(){this.detachAllColors(),this.detachDepth()}detachAllColorsBut0(){const t=Array.from(this._colors.keys());t.shift(),this._detachColors(t)}_detachColors(t){this.fbo.detachColorTextures(...t),t.forEach(t=>{this._colors.get(t)?.release(),this._colors.delete(t)})}detachAllButColor0(){this.detachAllColorsBut0(),this.detachDepth()}moveAttachments(t){t._colors.forEach((t,e)=>{this._colors.has(e)||this.attachColor(t,e)}),this.attachDepth(t.getAttachment(c))}};l=t([s("esri.views.3d.webgl.ManagedFBO")],l);const n=l;export{n as default};
2
+ import{__decorate as t}from"tslib";import{someMap as e}from"../../../core/MapUtils.js";import{releaseMaybe as o}from"../../../core/maybe.js";import{subclass as s}from"../../../core/accessorSupport/decorators.js";import{RenderNodeOutput as h}from"../webgl.js";import{isManagedDepthTexture as r}from"./ManagedDepthTexture.js";import i from"./ManagedFBOResource.js";import{ColorAttachment0 as a,DepthStencilAttachment as c}from"../../webgl/enums.js";let l=class extends i{constructor(t,e,o,s,r,i){super(t,i),this.fbo=o,this.type=0,this._colors=new Map,this._name=h.COMPOSITE,this.acquireColor=null,this.acquireDepth=null,this._name=e,this.acquireColor=s,this.acquireDepth=r}dispose(){this.fbo?.dispose()}get usedMemory(){return this.fbo?.usedMemory||0}get name(){return this._name}setName(t){this._name=t}getTexture(t=a){return t===c?this.fbo?.depthStencilTexture:this.fbo?.getColorTexture(t)}get depthTexture(){return this.getTexture(c)}getAttachment(t=a){return t===c?this._depth:this._colors.get(t)}obtainAttachment(t){const e=this.getAttachment(t);return e?.retain(),this.detachColor(t),e}hasAttachment(t){return e(this._colors,e=>e.name===t)}attachDepth(t){return t?.retain(),this.detachDepth(),t&&this.fbo?.attachDepthStencil(t.attachment),this._depth=t,this}detachDepth(){this.fbo?.detachDepthStencilTexture(),this.fbo?.detachDepthStencilBuffer(),this._depth=o(this._depth)}obtainDepthTexture(){const t=this._depth;return r(t)?(this.fbo?.detachDepthStencilTexture(),this._depth=null,t):null}attachColor(t,e){return t.retain(),this.detachColor(e),this.fbo?.attachColorTexture(t.attachment,e),this._colors.set(e,t),this}detachColor(t){this.fbo?.detachColorTexture(t),this._colors.get(t)?.release(),this._colors.delete(t)}detachAllColors(){const t=Array.from(this._colors.keys());this._detachColors(t)}detachAll(){this.detachAllColors(),this.detachDepth()}detachAllColorsBut0(){const t=Array.from(this._colors.keys());t.shift(),this._detachColors(t)}_detachColors(t){this.fbo.detachColorTextures(...t),t.forEach(t=>{this._colors.get(t)?.release(),this._colors.delete(t)})}detachAllButColor0(){this.detachAllColorsBut0(),this.detachDepth()}moveAttachments(t){return t._colors.forEach((t,e)=>{this._colors.has(e)||this.attachColor(t,e)}),this.attachDepth(t.getAttachment(c)),this}};l=t([s("esri.views.3d.webgl.ManagedFBO")],l);const n=l;export{n as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"../../../../../core/signal.js";import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/IntegerPassUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{F as FocusAreaColorPassParameters,b as build}from"../../../../../chunks/FocusAreaColor.glsl.js";
2
+ import"../../../../../core/signal.js";import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/IntegerPassUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{F as FocusAreaColorPassParameters,b as build}from"../../../../../chunks/FocusAreaColor.glsl.js";
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{subclass as r}from"../../../../../core/accessorSupport/decorators.js";import{ReloadableShader as o}from"../../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as s}from"../../core/shaderTechnique/ShaderTechnique.js";import{a as i}from"../../../../../chunks/FocusAreaColor.glsl.js";import{makePipelineState as t,defaultColorWrite as c}from"../../../../webgl/renderState.js";let a=class extends s{constructor(){super(...arguments),this.shader=new o(i,()=>import("./FocusAreaColor.glsl.js")),this.ignoreUnused=!0}initializePipeline(){return t({colorWrite:c})}};a=e([r("esri.views.3d.webgl-engine.effects.focusArea.FocusAreaColorTechnique")],a);export{a as FocusAreaColorTechnique};
2
+ import{__decorate as e}from"tslib";import{subclass as r}from"../../../../../core/accessorSupport/decorators.js";import{ReloadableShader as o}from"../../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as s}from"../../core/shaderTechnique/ShaderTechnique.js";import{a as i}from"../../../../../chunks/FocusAreaColor.glsl.js";import{makePipelineState as t,premultipliedAlpha as c,defaultColorWrite as a}from"../../../../webgl/renderState.js";let l=class extends s{constructor(){super(...arguments),this.shader=new o(i,()=>import("./FocusAreaColor.glsl.js")),this.ignoreUnused=!0}initializePipeline(){return t({colorWrite:a,blending:c})}};l=e([r("esri.views.3d.webgl-engine.effects.focusArea.FocusAreaColorTechnique")],l);export{l as FocusAreaColorTechnique};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{watch as t}from"../../../../../core/reactiveUtils.js";import{property as s,subclass as r}from"../../../../../core/accessorSupport/decorators.js";import{InternalRenderCategory as i}from"../../../webgl.js";import o from"../../../webgl/RenderNode.js";import{F as a}from"../../../../../chunks/FocusAreaColor.glsl.js";import{FocusAreaColorTechnique as n}from"./FocusAreaColorTechnique.js";let c=class extends o{constructor(e){super({...e,view:e.focusAreasView.view}),this.consumes={required:[i.FOCUSAREA_COLOR,i.FOCUSAREA]},this.produces=i.FOCUSAREA_COLOR,this._fadeDirection=0,this._passParameters=new a}fadeOut(e){this.removeAllHandles(),this._startTime=null,this._fadeDirection=1,this.addHandles(t(()=>this._passParameters.fadeFactor.value,t=>{0===t&&(this.removeAllHandles(),e())})),this.requestRender(2)}render(e){const t=this.input,s=this.techniques.getCompiled(n);if(!s)return this.requestRender(1),t;const r=this.focusAreasView.style,o=this.bindParameters,a=o.camera,c=a.fullViewport[2],d=a.fullViewport[3];this._startTime??=this.view.stage?.renderer.renderContext.time;const h=this.view.qualitySettings.fadeDuration,m=h>0?Math.min(h,this.view.stage?.renderer.renderContext.time-this._startTime)/h:1,l=e.find(({name:e})=>e===i.FOCUSAREA),f=this.fboCache.acquire(c,d,this.produces),p=this.renderingContext;return p.bindFramebuffer(f.fbo),this._passParameters.color=t.getTexture(),this._passParameters.focusArea=l.getTexture(),this._passParameters.effect=u[r],this._passParameters.fadeFactor.value=0===this._fadeDirection?m:1-m,p.bindTechnique(s,o,this._passParameters),p.screen.draw(),m<1&&this.requestRender(2),f.moveAttachments(t),f}};e([s()],c.prototype,"consumes",void 0),e([s()],c.prototype,"produces",void 0),e([s({constructOnly:!0})],c.prototype,"focusAreasView",void 0),c=e([r("esri.views.3d.webgl-engine.effects.focusArea.FocusAreaVisualization")],c);const u={bright:0,dark:1};export{c as FocusAreaVisualization,u as styleToEffect};
2
+ import{__decorate as e}from"tslib";import{watch as t}from"../../../../../core/reactiveUtils.js";import{property as r,subclass as s}from"../../../../../core/accessorSupport/decorators.js";import{ZEROS as i}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{InternalRenderCategory as o}from"../../../webgl.js";import a from"../../../webgl/RenderNode.js";import{F as n}from"../../../../../chunks/FocusAreaColor.glsl.js";import{FocusAreaColorTechnique as c}from"./FocusAreaColorTechnique.js";import{ColorAttachment0 as m}from"../../../../webgl/enums.js";let u=class extends a{constructor(e){super({...e,view:e.focusAreasView.view}),this.consumes={required:[o.FOCUSAREA_COLOR,o.FOCUSAREA]},this.produces=o.FOCUSAREA_COLOR,this._fadeDirection=0,this._passParameters=new n}fadeOut(e){this.removeAllHandles(),this._startTime=null,this._fadeDirection=1,this.addHandles(t(()=>this._passParameters.fadeFactor.value,t=>{0===t&&(this.removeAllHandles(),e())})),this.requestRender(2)}render(e){const t=this.input,r=this.techniques.getCompiled(c);if(!r)return this.requestRender(1),t;const s=this.focusAreasView.style,a=this.bindParameters;this._startTime??=this.view.stage?.renderer.renderContext.time;const n=this.view.qualitySettings.fadeDuration,u=n>0?Math.min(n,this.view.stage?.renderer.renderContext.time-this._startTime)/n:1,h=e.find(({name:e})=>e===o.FOCUSAREA),f=this.renderingContext,l="bright"===s;this._passParameters.color=l?t.getTexture():f.emptyTexture,this._passParameters.focusArea=h.getTexture(),this._passParameters.effect=d[s],this._passParameters.fadeFactor.value=0===this._fadeDirection?u:1-u;const p=a.camera,A=p.fullViewport[2],w=p.fullViewport[3],g=l?this.fboCache.acquire(A,w,this.produces).moveAttachments(t):t;return f.bindFramebuffer(g.fbo),l&&f.clearBuffer(0,i),f.bindTechnique(r,a,this._passParameters),f.setDrawBuffers([m]),f.screen.draw(),u<1&&this.requestRender(2),g}};e([r()],u.prototype,"consumes",void 0),e([r()],u.prototype,"produces",void 0),e([r({constructOnly:!0})],u.prototype,"focusAreasView",void 0),u=e([s("esri.views.3d.webgl-engine.effects.focusArea.FocusAreaVisualization")],u);const d={bright:0,dark:1};export{u as FocusAreaVisualization,d as styleToEffect};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{add as t,transformMat4 as e}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{intersectsSphere as i}from"../../../../geometry/support/frustum.js";import{create as r,fromPoints as n,copy as o}from"../../../../geometry/support/ray.js";import a from"../../webgl/RenderCamera.js";import{HUDTarget as l,HUDIntersectorResult as c}from"./HUDIntersectorResult.js";import{IntersectorOptions as h}from"./IntersectorInterfaces.js";import{IntersectorResult as f,compareOrderedIntersectionHits as m}from"./IntersectorResult.js";import{ObjectTarget as u}from"./ObjectTarget.js";import{PolygonIntersectionResults as d}from"./PolygonIntersectionResults.js";import{IntersectorTransform as y,getVerticalOffsetObject3D as g}from"./verticalOffsetUtils.js";const _=1e-5;class p{constructor(t){this.options=new h,this._results=new b,this.polygonResults=new d,this.transform=new y,this.camera=new a,this.screenPolygonTriangleProcessor=v,this.tolerance=_,this.verticalOffset=null,this._ray=r(),this._rayEnd=s(),this._rayBeginTransformed=s(),this._rayEndTransformed=s(),this.viewingMode=t??1}get results(){return this._results}get ray(){return this._ray}get rayBegin(){return this._ray.origin}get rayEnd(){return this._rayEnd}reset(t,e,s){this.resetWithRay(n(t,e,this._ray),s)}resetWithRay(e,s){this.camera=s,e!==this._ray&&o(e,this._ray),0!==this.options.verticalOffset?2===this.viewingMode?this._ray.origin[2]-=this.options.verticalOffset:this.verticalOffset=this.options.verticalOffset:this.verticalOffset=null,t(this._rayEnd,this._ray.origin,this._ray.direction),this._results.init(this._ray),this.polygonResults.init()}intersect(t=null,e,s,i,r){this.point=e,this.filterPredicate=i,this.tolerance=s??_;const n=g(this.verticalOffset);if(t&&t.length>0){const e=r?t=>{r(t)&&this.intersectObject(t)}:t=>{this.intersectObject(t)};for(const s of t){const t=s.getSpatialQueryAccelerator?.();null!=t?(null!=n?t.forEachAlongRayWithVerticalOffset(this._ray.origin,this._ray.direction,e,n):t.forEachAlongRay(this._ray.origin,this._ray.direction,e),this.options.selectionMode&&this.options.hud&&t.forEachDegenerateObject(e)):s.objects.forEach(t=>e(t))}}this.sortResults()}*intersectScreenPolygon(t=null,e){if(this.verticalOffset=null,t?.length)for(const s of t){const t=s.getSpatialQueryAccelerator?.();if(null!=t)for(const s of t.intersectingFrustumValues(e.broadPhaseFrustum,t=>t.visible))yield*this._intersectScreenPolygonObject(s,e);else for(const r of s.objects.values())r.visible&&i(e.broadPhaseFrustum,r.boundingVolumeWorldSpace.bounds)&&(yield*this._intersectScreenPolygonObject(r,e))}}*_intersectScreenPolygonObject(t,e){const s=t.geometries;if(!s)return;const i=t.effectiveTransformation;for(const r of s){if(!r.visible)continue;const{material:s,id:n}=r;if(!s.visible||!s.intersectScreenPolygon)continue;this.transform.setAndInvalidateLazyTransforms(i,r.transformation);const o=s.intersectScreenPolygon(r,this.transform.transform,this,e);null!=o&&this._handleObjectScreenPolygonIntersection(new u(t,n,o.primitiveIndex),o.distance,o.point),yield}}intersectObject(t){const s=t.geometries;if(!s)return;const i=t.effectiveTransformation,r=g(this.verticalOffset);for(const n of s){if(!n.visible)continue;const{material:s,id:o}=n;if(!s.visible)continue;this.transform.setAndInvalidateLazyTransforms(i,n.transformation),e(this._rayBeginTransformed,this.rayBegin,this.transform.inverse),e(this._rayEndTransformed,this.rayEnd,this.transform.inverse);const a=this.transform.transform;null!=r&&(r.objectTransform=this.transform),s.intersectRay(n,this.transform.transform,this,this._rayBeginTransformed,this._rayEndTransformed,(e,s,i,r)=>this.handleObjectIntersection({object:t,geometryId:o,primitiveIndex:i},e,s,a,r))}}handleObjectIntersection(t,e,s,i,r){if(e<0||null!=this.filterPredicate&&!this.filterPredicate(this._ray.origin,this._rayEnd,e))return;const n=r?this._results.hud:this._results;t=r?new l(t,r):t;const o=r?i=>i.set(1,t,e,s):r=>r.set(4,t,e,s,i);if((null==n.min.distance||e<n.min.distance)&&o(n.min),0!==this.options.store&&(null==n.max.distance||e>n.max.distance)&&o(n.max),2===this.options.store)if(r){const t=new c(this._ray);o(t),this._results.hud.all.push(t)}else{const t=new f(this._ray);o(t),this._results.all.push(t)}}_handleObjectScreenPolygonIntersection(t,e,s,i){e<0||(null==this.filterPredicate||null!=s&&this.filterPredicate(this.camera.eye,s,1))&&this.polygonResults.add(i?1:4,i?new l(t,i):t,e)}sortResults(t=this._results.all){t.sort(m)}}class b{constructor(){this.min=new f(r()),this.max=new f(r()),this.hud={min:new c(r()),max:new c(r()),all:new Array},this.ground=new f(r()),this.all=[]}init(t){this.min.init(t),this.max.init(t),this.ground.init(t),this.all.length=0,this.hud.min.init(t),this.hud.max.init(t),this.hud.all.length=0}}const v={*processTriangle(t,e){t.list=e,t.count=e.length,yield t}};export{p as Intersector,v as defaultScreenPolygonTriangleProcessor,_ as defaultTolerance};
2
+ import{add as t,transformMat4 as e,copy as s}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{intersectsSphere as r}from"../../../../geometry/support/frustum.js";import{create as n,fromPoints as o,copy as a}from"../../../../geometry/support/ray.js";import l from"../../webgl/RenderCamera.js";import{HUDTarget as c,HUDIntersectorResult as h}from"./HUDIntersectorResult.js";import{IntersectorOptions as f}from"./IntersectorInterfaces.js";import{IntersectorResult as m,compareOrderedIntersectionHits as u}from"./IntersectorResult.js";import{ObjectTarget as d}from"./ObjectTarget.js";import{PolygonIntersectionResults as y}from"./PolygonIntersectionResults.js";import{IntersectorTransform as g,getVerticalOffsetObject3D as _}from"./verticalOffsetUtils.js";const p=1e-5;class v{constructor(t){this.options=new f,this._results=new b,this.polygonResults=new y,this.transform=new g,this.camera=new l,this.screenPolygonPrimitiveProcessor=j,this.tolerance=p,this.verticalOffset=null,this._ray=n(),this._rayEnd=i(),this._rayBeginTransformed=i(),this._rayEndTransformed=i(),this.viewingMode=t??1}get results(){return this._results}get ray(){return this._ray}get rayBegin(){return this._ray.origin}get rayEnd(){return this._rayEnd}reset(t,e,s){this.resetWithRay(o(t,e,this._ray),s)}resetWithRay(e,s){this.camera=s,e!==this._ray&&a(e,this._ray),0!==this.options.verticalOffset?2===this.viewingMode?this._ray.origin[2]-=this.options.verticalOffset:this.verticalOffset=this.options.verticalOffset:this.verticalOffset=null,t(this._rayEnd,this._ray.origin,this._ray.direction),this._results.init(this._ray),this.polygonResults.init()}intersect(t=null,e,s,i,r){this.point=e,this.filterPredicate=i,this.tolerance=s??p;const n=_(this.verticalOffset);if(t&&t.length>0){const e=r?t=>{r(t)&&this.intersectObject(t)}:t=>{this.intersectObject(t)};for(const s of t){const t=s.getSpatialQueryAccelerator?.();null!=t?(null!=n?t.forEachAlongRayWithVerticalOffset(this._ray.origin,this._ray.direction,e,n):t.forEachAlongRay(this._ray.origin,this._ray.direction,e),this.options.selectionMode&&this.options.hud&&t.forEachDegenerateObject(e)):s.objects.forEach(t=>e(t))}}this.sortResults()}*intersectScreenPolygon(t=null,e){if(this.verticalOffset=null,t?.length)for(const s of t){const t=s.getSpatialQueryAccelerator?.();if(null!=t)for(const s of t.intersectingFrustumValues(e.broadPhaseFrustum,t=>t.visible))yield*this._intersectScreenPolygonObject(s,e);else for(const i of s.objects.values())i.visible&&r(e.broadPhaseFrustum,i.boundingVolumeWorldSpace.bounds)&&(yield*this._intersectScreenPolygonObject(i,e))}}*_intersectScreenPolygonObject(t,e){const s=t.geometries;if(!s)return;const i=t.effectiveTransformation;for(const r of s){if(!r.visible)continue;const{material:s,id:n}=r;if(!s.visible||!s.intersectScreenPolygon)continue;this.transform.setAndInvalidateLazyTransforms(i,r.transformation);const o=s.intersectScreenPolygon(r,this.transform.transform,this,e);o?.valid&&this._handleObjectScreenPolygonIntersection(new d(t,n,o.primitiveIndex),o.distance,o.point),yield}}intersectObject(t){const s=t.geometries;if(!s)return;const i=t.effectiveTransformation,r=_(this.verticalOffset);for(const n of s){if(!n.visible)continue;const{material:s,id:o}=n;if(!s.visible)continue;this.transform.setAndInvalidateLazyTransforms(i,n.transformation),e(this._rayBeginTransformed,this.rayBegin,this.transform.inverse),e(this._rayEndTransformed,this.rayEnd,this.transform.inverse);const a=this.transform.transform;null!=r&&(r.objectTransform=this.transform),s.intersectRay(n,this.transform.transform,this,this._rayBeginTransformed,this._rayEndTransformed,(e,s,i,r)=>this.handleObjectIntersection({object:t,geometryId:o,primitiveIndex:i},e,s,a,r))}}handleObjectIntersection(t,e,s,i,r){if(e<0||null!=this.filterPredicate&&!this.filterPredicate(this._ray.origin,this._rayEnd,e))return;const n=r?this._results.hud:this._results;t=r?new c(t,r):t;const o=r?i=>i.set(1,t,e,s):r=>r.set(4,t,e,s,i);if((null==n.min.distance||e<n.min.distance)&&o(n.min),0!==this.options.store&&(null==n.max.distance||e>n.max.distance)&&o(n.max),2===this.options.store)if(r){const t=new h(this._ray);o(t),this._results.hud.all.push(t)}else{const t=new m(this._ray);o(t),this._results.all.push(t)}}_handleObjectScreenPolygonIntersection(t,e,s,i){e<0||(null==this.filterPredicate||null!=s&&this.filterPredicate(this.camera.eye,s,1))&&this.polygonResults.add(i?1:4,i?new c(t,i):t,e)}sortResults(t=this._results.all){t.sort(u)}}class b{constructor(){this.min=new m(n()),this.max=new m(n()),this.hud={min:new h(n()),max:new h(n()),all:new Array},this.ground=new m(n()),this.all=[]}init(t){this.min.init(t),this.max.init(t),this.ground.init(t),this.all.length=0,this.hud.min.init(t),this.hud.max.init(t),this.hud.all.length=0}}const j={*processTriangle(t,e){t.list=e,t.count=e.length,yield t},*processLineSegment(t,e,i){s(t[0],e),s(t[1],i),yield t}};export{v as Intersector,j as defaultScreenPolygonPrimitiveProcessor,p as defaultTolerance};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- class e{constructor(e,t,r,s=0){this.layout=e,this.byteOffset=s,this._bufferViews=new Map,this.buffer="number"==typeof t?new ArrayBuffer(t*e.byteStride):t,this.texelElementBuffer=new r(this.buffer,s);const f=this._bufferViews;for(const[n,i]of this.layout.fields)f.set(n,new i.bufferViewConstructor(this.buffer,s+i.byteOffset,this.layout.byteStride))}get stride(){return this.layout.byteStride}get count(){return this.byteLength/this.stride}get byteLength(){return this.buffer.byteLength-this.byteOffset}getField(e,t){const r=this._bufferViews.get(e);return null!=r&&r.elementCount===t.ElementCount&&r.elementType===t.ElementType?r:null}get usedMemory(){return this.byteLength}}export{e as TextureBufferView};
2
+ class t{constructor(t,e,r,s=0){this.layout=t,this.byteOffset=s,this._bufferViews=new Map,this.buffer="number"==typeof e?new ArrayBuffer(e*t.byteStride):e,this.texelElementBuffer=new r(this.buffer,s);const f=this._bufferViews;for(const[i,n]of this.layout.fields)f.set(i,new n.bufferViewConstructor(this.buffer,s+n.byteOffset,this.layout.byteStride))}get stride(){return this.layout.byteStride}get count(){return this.byteLength/this.stride}get byteLength(){return this.buffer.byteLength-this.byteOffset}getField(t,e){const r=this._bufferViews.get(t);return null!=r&&r.elementCount===e.ElementCount&&r.elementType===e.ElementType?r:null}copyItem(t,e){const{buffer:r,layout:s,byteOffset:f}=this,i=new Uint8Array(r),n=s.byteStride,u=f+t*n,y=f+e*n;i.copyWithin(y,u,u+n)}get usedMemory(){return this.byteLength}}export{t as TextureBufferView};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{copy as t,lerp as i,squaredLength as s,dot as n}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{h as r}from"../../../../chunks/boundedPlane.js";import{clipPolygon as c,create as e,fromValues as l}from"../../../../geometry/support/plane.js";function a(t){return(s,n,o)=>!r(t,i(g,s,n,o))}class u{constructor(t,i){this.list=t,this.count=i}}class m{constructor(t){this._remainingA=p(),this._remainingB=p(),this._visible=p(),this._slicedAwayHalfspaces=f(t)}*processTriangle(i,s){let n=new u(this._remainingA,3),o=new u(this._remainingB,0);t(n.list[0],s[0]),t(n.list[1],s[1]),t(n.list[2],s[2]);const r=new u(this._visible,0);for(const t of this._slicedAwayHalfspaces){if(r.count=c(t,n.list,n.count,r.list,!1),r.count>=3&&(i.list=r.list,i.count=r.count,yield i),o.count=c(t,n.list,n.count,o.list,!0),o.count<3)return;[o,n]=[n,o]}}}function f(t){const i=[e(t.plane),e(),e(),e(),e()];return h(t.basis1,t.origin,i[1],i[2]),h(t.basis2,t.origin,i[3],i[4]),i}function h(t,i,o,r){const c=s(t),e=n(t,i);l(t[0],t[1],t[2],-e+c,o),l(-t[0],-t[1],-t[2],e+c,r)}function p(){return Array.from({length:12},()=>o())}const g=o();export{m as SliceScreenPolygonTriangleProcessor,a as sliceFilterPredicate};
2
+ import{copy as i,lerp as s,squaredLength as t,dot as n}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{h as o}from"../../../../chunks/boundedPlane.js";import{clipPolygon as l,clipLineSegment as r,create as c,fromValues as a}from"../../../../geometry/support/plane.js";function u(i){return(t,n,e)=>!o(i,s(b,t,n,e))}class h{constructor(i,s){this.list=i,this.count=s}}class m{constructor(i){this._remainingA=g(),this._remainingB=g(),this._visible=g(),this._lineRemainingA=p(),this._lineRemainingB=p(),this._lineVisible=p(),this._slicedAwayHalfspaces=f(i)}*processTriangle(s,t){let n=new h(this._remainingA,3),e=new h(this._remainingB,0);i(n.list[0],t[0]),i(n.list[1],t[1]),i(n.list[2],t[2]);const o=new h(this._visible,0);for(const i of this._slicedAwayHalfspaces){if(o.count=l(i,n.list,n.count,o.list,!1),o.count>=3&&(s.list=o.list,s.count=o.count,yield s),e.count=l(i,n.list,n.count,e.list,!0),e.count<3)return;[e,n]=[n,e]}}*processLineSegment(s,t,n){let e=this._lineRemainingA,o=this._lineRemainingB;i(e[0],t),i(e[1],n);for(const l of this._slicedAwayHalfspaces){if(r(l,e[0],e[1],this._lineVisible[0],this._lineVisible[1],!1)&&(i(s[0],this._lineVisible[0]),i(s[1],this._lineVisible[1]),yield s),!r(l,e[0],e[1],o[0],o[1],!0))return;[o,e]=[e,o]}}}function f(i){const s=[c(i.plane),c(),c(),c(),c()];return _(i.basis1,i.origin,s[1],s[2]),_(i.basis2,i.origin,s[3],s[4]),s}function _(i,s,e,o){const l=t(i),r=n(i,s);a(i[0],i[1],i[2],-r+l,e),a(-i[0],-i[1],-i[2],r+l,o)}function g(){return Array.from({length:12},()=>e())}function p(){return[e(),e()]}const b=e();export{m as SliceScreenPolygonPrimitiveProcessor,u as sliceFilterPredicate};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{createScreenPointArray as t}from"../../../../core/screenUtils.js";import{copy as e,set as n,transformMat4 as o,distance as r,squaredDistance as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{setMin as l,setMax as a,getMax as u,getMin as c,create as f}from"../../../../geometry/support/aaBoundingBox.js";import{clipPolygon as m}from"../../../../geometry/support/plane.js";import{normalFromValues as p,closestPointFromValues as d}from"../../../../geometry/support/triangle.js";import{boundingInfoSubdivisionThreshold as I}from"./intersectionConstants.js";import{projectAabbToScreenBounds as h,projectBoundingInfoToScreenBounds as g,screenPolygonIntersectsBounds as b,screenPolygonIntersectsTriangle as y}from"./screenPolygonOverlapUtils.js";class v{constructor(){this.distance=Number.POSITIVE_INFINITY,this.primitiveIndex=0,this.hasNormal=!1,this.point=s(),this.normal=s()}reset(){this.distance=Number.POSITIVE_INFINITY}update(t,n,o,r){this.distance=t,this.primitiveIndex=n,e(this.point,o),this.hasNormal=null!=r,null!=r&&e(this.normal,r)}updateIfCloserFromValues(t,e,n,o){t<this.distance&&this.update(t,e,n,o)}updateIfCloser(t){const{distance:e,primitiveIndex:n,point:o,normal:r}=t;this.updateIfCloserFromValues(e,n,o,t.hasNormal?r:null)}get valid(){return Number.isFinite(this.distance)}}function N(t,e,n,o,r){if(!t.visible||0!==t.type)return null;const i=new v;let s;if(t.boundingInfo)s=x(t.boundingInfo,e,n,o,r);else{const i=t.positionAttribute,l=t.primitivePositionIndices;s=j(e,n,o,0,l.length/3,l,i.data,i.stride,r,null,0)}for(const l of s)i.updateIfCloser(l);return i.valid?i:null}function T(t,e,n,o,r,i,s,l,a){const u=new v;for(const c of j(t,e,n,o,r,i,s,l,a,null,0))u.updateIfCloser(c);return u.valid?u:null}function*j(t,e,n,o,i,s,l,a,u,c=null,f=0){if(null==t.camera)return;const{camera:d,screenPolygonTriangleProcessor:I}=t;for(let h=o;h<i;++h){const t=(c?.[h]??h)+f,o=null==c?t:h,i=3*t;C(O[0],s,l,a,i+0,u,o,e),C(O[1],s,l,a,i+1,u,o,e),C(O[2],s,l,a,i+2,u,o,e);const g=Y;let b;B.reset();for(const{list:e,count:s}of I.processTriangle(M,O)){const o=m(d.frustum[4],e,s,S,!1);if(!(o<3)){for(let t=0;t<o;t++)d.projectToScreen(S[t],w[t]);F(n,w,o)&&(P(d.eye,S,o,E),null==b&&(b=p(Y,O[0],O[1],O[2])),B.updateIfCloserFromValues(r(d.eye,E),t,E,b?g:null))}}B.valid&&(yield B)}}function*x(t,e,n,o,r){const i=e.camera,s=null!=r?(l(V,t.bbMin),a(V,t.bbMax),r.applyToAabb(V),h(i,c(V,O[0]),u(V,O[1]),n)):g(i,t,n);if(null==s||!b(o,s.bounds))return;const{primitiveIndices:f,position:m}=t,p=f?f.length:m.indices.length/3;if(p>I){const i=t.getChildren();if(void 0!==i){for(const t of i)yield*x(t,e,n,o,r);return}}yield*j(e,n,o,0,p,m.indices,m.data,m.stride,r,f,0)}function C(t,e,r,i,s,l,a,u){const c=i*e[s],f=r[c+0],m=r[c+1],p=r[c+2];null!=l?l.applyToVertex(t,f,m,p,a):n(t,f,m,p),u&&o(t,t,u)}function F(t,e,n){for(let o=1;o<n-1;o++)if(y(t,e[0],e[o],e[o+1]))return!0;return!1}function P(t,n,o,r){let s=Number.POSITIVE_INFINITY;for(let l=1;l<o-1;l++){d(_,t,n[0],n[l],n[l+1]);const o=i(t,_);o<s&&(s=o,e(r,_))}}const V=f(),A=12,O=[s(),s(),s()],S=Array.from({length:A},()=>s()),w=Array.from({length:A},()=>t()),E=s(),Y=s(),_=s(),B=new v,M={list:[],count:0};export{v as Hit,j as forEachTriangleRangeScreenPolygonHit,N as intersectTriangleGeometryScreenPolygon,T as intersectTriangleRangeScreenPolygon};
2
+ import{createScreenPointArray as t}from"../../../../core/screenUtils.js";import{copy as e,set as n,transformMat4 as o,distance as r,squaredDistance as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{setMin as l,setMax as a,getMax as u,getMin as c,create as f}from"../../../../geometry/support/aaBoundingBox.js";import{clipPolygon as m}from"../../../../geometry/support/plane.js";import{normalFromValues as p,closestPointFromValues as d}from"../../../../geometry/support/triangle.js";import{boundingInfoSubdivisionThreshold as I}from"./intersectionConstants.js";import{projectAabbToScreenBounds as h,projectBoundingInfoToScreenBounds as g,screenPolygonIntersectsBounds as b,screenPolygonIntersectsTriangle as v}from"./screenPolygonOverlapUtils.js";class y{constructor(){this.distance=Number.POSITIVE_INFINITY,this.primitiveIndex=0,this.hasNormal=!1,this.point=s(),this.normal=s()}reset(){this.distance=Number.POSITIVE_INFINITY}update(t,n,o,r){this.distance=t,this.primitiveIndex=n,e(this.point,o),this.hasNormal=null!=r,null!=r&&e(this.normal,r)}updateIfCloserFromValues(t,e,n,o){t<this.distance&&this.update(t,e,n,o)}updateIfCloser(t){const{distance:e,primitiveIndex:n,point:o,normal:r}=t;this.updateIfCloserFromValues(e,n,o,t.hasNormal?r:null)}get valid(){return Number.isFinite(this.distance)}}function N(t,e,n,o,r){if(!t.visible||0!==t.type)return null;const i=new y;let s;if(t.boundingInfo)s=x(t.boundingInfo,e,n,o,r);else{const i=t.positionAttribute,l=t.primitivePositionIndices;s=j(e,n,o,0,l.length/3,l,i.data,i.stride,r,null,0)}for(const l of s)i.updateIfCloser(l);return i.valid?i:null}function T(t,e,n,o,r,i,s,l,a){const u=new y;for(const c of j(t,e,n,o,r,i,s,l,a,null,0))u.updateIfCloser(c);return u.valid?u:null}function*j(t,e,n,o,i,s,l,a,u,c=null,f=0){if(null==t.camera)return;const{camera:d,screenPolygonPrimitiveProcessor:I}=t;for(let h=o;h<i;++h){const t=(c?.[h]??h)+f,o=null==c?t:h,i=3*t;C(O[0],s,l,a,i+0,u,o,e),C(O[1],s,l,a,i+1,u,o,e),C(O[2],s,l,a,i+2,u,o,e);const g=Y;let b;B.reset();for(const{list:e,count:s}of I.processTriangle(M,O)){const o=m(d.frustum[4],e,s,S,!1);if(!(o<3)){for(let t=0;t<o;t++)d.projectToScreen(S[t],w[t]);P(n,w,o)&&(F(d.eye,S,o,E),null==b&&(b=p(Y,O[0],O[1],O[2])),B.updateIfCloserFromValues(r(d.eye,E),t,E,b?g:null))}}B.valid&&(yield B)}}function*x(t,e,n,o,r){const i=e.camera,s=null!=r?(l(V,t.bbMin),a(V,t.bbMax),r.applyToAabb(V),h(i,c(V,O[0]),u(V,O[1]),n)):g(i,t,n);if(null==s||!b(o,s.bounds))return;const{primitiveIndices:f,position:m}=t,p=f?f.length:m.indices.length/3;if(p>I){const i=t.getChildren();if(void 0!==i){for(const t of i)yield*x(t,e,n,o,r);return}}yield*j(e,n,o,0,p,m.indices,m.data,m.stride,r,f,0)}function C(t,e,r,i,s,l,a,u){const c=i*e[s],f=r[c+0],m=r[c+1],p=r[c+2];null!=l?l.applyToVertex(t,f,m,p,a):n(t,f,m,p),u&&o(t,t,u)}function P(t,e,n){for(let o=1;o<n-1;o++)if(v(t,e[0],e[o],e[o+1]))return!0;return!1}function F(t,n,o,r){let s=Number.POSITIVE_INFINITY;for(let l=1;l<o-1;l++){d(_,t,n[0],n[l],n[l+1]);const o=i(t,_);o<s&&(s=o,e(r,_))}}const V=f(),A=12,O=[s(),s(),s()],S=Array.from({length:A},()=>s()),w=Array.from({length:A},()=>t()),E=s(),Y=s(),_=s(),B=new y,M={list:[],count:0};export{y as Hit,j as forEachTriangleRangeScreenPolygonHit,N as intersectTriangleGeometryScreenPolygon,T as intersectTriangleRangeScreenPolygon};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{copy as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{set as i,subtract as s,dot as n,scale as a,add as c,copy as l,length as m,distance as u}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as p}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{distance2 as h,fromPoints as g,closestLineSegmentPoint as d,create as j}from"../../../../geometry/support/lineSegment.js";import{fromPoints as b,signedDistance as y,getNormal as x,create as L}from"../../../../geometry/support/plane.js";import{isColorHighlightOrOLID as S}from"../core/shaderLibrary/ShaderOutput.js";import v from"../lib/GLMaterial.js";import{Material as M,MaterialParameters as w}from"../lib/Material.js";import{isTranslationMatrix as C}from"../lib/Util.js";import{DefaultBufferWriter as R}from"./DefaultBufferWriter.js";import{PositionColorLayout as T,PositionLayout as _}from"./DefaultLayouts.js";import{NativeLineTechnique as A}from"../shaders/NativeLineTechnique.js";import{NativeLineTechniqueConfiguration as V}from"../shaders/NativeLineTechniqueConfiguration.js";import{alphaCutoff as N}from"../../../../webscene/support/AlphaCutoff.js";class U extends M{constructor(e){super(e,E),this._configuration=new V,this.produces=new Map([[2,e=>S(e)]])}updateConfiguration(e){super.updateConfiguration(e),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVertexColors=this.parameters.hasVertexColors,this._configuration.transparent=this.parameters.color[3]<1||this.parameters.width<1,this._configuration.hasOccludees=e.hasOccludees}get visible(){return this.parameters.color[3]>=N}intersectRay(t,r,f,p,j,L){const{options:S,camera:v,rayBegin:M,rayEnd:w}=f;if(!S.selectionMode||!t.visible||!v)return;if(!C(r))return void e.getLogger("esri.views.3d.webgl-engine.materials.NativeLineMaterial").error("intersection assumes a translation-only matrix");const R=t.attributes.get("position").data,T=H;o(T,f.point);const _=2;i(I[0],T[0]-_,T[1]+_,0),i(I[1],T[0]+_,T[1]+_,0),i(I[2],T[0]+_,T[1]-_,0),i(I[3],T[0]-_,T[1]-_,0);for(let e=0;e<4;e++)if(!v.unprojectFromRenderScreen(I[e],J[e]))return;b(v.eye,J[0],J[1],K),b(v.eye,J[1],J[2],Q),b(v.eye,J[2],J[3],Y),b(v.eye,J[3],J[0],Z);let A=Number.MAX_VALUE,V=0;for(let e=0;e<R.length-5;e+=3){if(q[0]=R[e]+r[12],q[1]=R[e+1]+r[13],q[2]=R[e+2]+r[14],B[0]=R[e+3]+r[12],B[1]=R[e+4]+r[13],B[2]=R[e+5]+r[14],y(K,q)<0&&y(K,B)<0||y(Q,q)<0&&y(Q,B)<0||y(Y,q)<0&&y(Y,B)<0||y(Z,q)<0&&y(Z,B)<0)continue;const t=v.projectToRenderScreen(q,W),o=v.projectToRenderScreen(B,X);if(null==t||null==o)continue;if(t[2]<0&&o[2]>0){s(D,q,B);const e=v.frustum,r=-y(e[4],q)/n(D,x(e[4]));if(a(D,D,r),c(q,q,D),!v.projectToRenderScreen(q,t))continue}else if(t[2]>0&&o[2]<0){s(D,B,q);const e=v.frustum,t=-y(e[4],B)/n(D,x(e[4]));if(a(D,D,t),c(B,B,D),!v.projectToRenderScreen(B,o))continue}else if(t[2]<0&&o[2]<0)continue;t[2]=0,o[2]=0;const i=h(g(t,o,F),T);i<A&&(A=i,l(G,q),l(z,B),V=e/3)}if(A<_*_){let e=Number.MAX_VALUE;if(d(g(G,z,F),g(M,w,k),O)){s(O,O,M);const t=m(O);a(O,O,1/t),e=t/u(M,w)}L(e,O,V)}}intersectScreenPolygon(){return null}intersectRayDraped(e,r,o,i,s){if(!r.options.selectionMode)return;const n=e.attributes.get("position").data,a=e.attributes.get("size"),c=a?a.data[0]:0,l=o[0],m=o[1],u=((c+1)/2+4)*e.screenToWorldRatio;let f=Number.MAX_VALUE,p=0;for(let h=0;h<n.length-5;h+=3){const e=n[h],r=n[h+1],o=l-e,i=m-r,s=n[h+3]-e,a=n[h+4]-r,c=t((s*o+a*i)/(s*s+a*a),0,1),u=s*c-o,g=a*c-i,d=u*u+g*g;d<f&&(f=d,p=h/3)}f<u*u&&i(s.distance,s.normal,p)}createGLMaterial(e){return new P(e)}createBufferWriter(){const e=this.parameters.hasVertexColors?T:_;return new R(e)}}class P extends v{beginSlot(e){return this.getTechnique(A,e)}}class E extends w{constructor(){super(...arguments),this.color=p,this.hasVertexColors=!1,this.hasSlicePlane=!1,this.width=1}}const q=f(),B=f(),D=f(),O=f(),W=r(),X=r(),G=f(),z=f(),F=j(),k=j(),H=f(),I=[r(),r(),r(),r()],J=[f(),f(),f(),f()],K=L(),Q=L(),Y=L(),Z=L();export{U as NativeLineMaterial,E as Parameters};
2
+ import e from"../../../../core/Logger.js";import{clamp as r}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as t,createScreenPointArray as o}from"../../../../core/screenUtils.js";import{copy as i}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{set as s,subtract as n,dot as a,scale as c,add as l,copy as m,length as u,distance as f}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as g}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{distance2 as h,fromPoints as d,closestLineSegmentPoint as j,projectPoint as b,create as y}from"../../../../geometry/support/lineSegment.js";import{fromPoints as v,signedDistance as x,getNormal as L,create as S}from"../../../../geometry/support/plane.js";import{isColorHighlightOrOLID as w}from"../core/shaderLibrary/ShaderOutput.js";import M from"../lib/GLMaterial.js";import{Material as T,MaterialParameters as P}from"../lib/Material.js";import{projectWorldLineSegmentToRenderScreen as C,screenPolygonIntersectsBufferedSegment as R}from"../lib/screenPolygonOverlapUtils.js";import{Hit as V}from"../lib/screenPolygonTriangleIntersections.js";import{isTranslationMatrix as _}from"../lib/Util.js";import{DefaultBufferWriter as A}from"./DefaultBufferWriter.js";import{PositionColorLayout as N,PositionLayout as U}from"./DefaultLayouts.js";import{NativeLineTechnique as E}from"../shaders/NativeLineTechnique.js";import{NativeLineTechniqueConfiguration as O}from"../shaders/NativeLineTechniqueConfiguration.js";import{alphaCutoff as q}from"../../../../webscene/support/AlphaCutoff.js";class B extends T{constructor(e){super(e,X),this._configuration=new O,this.produces=new Map([[2,e=>w(e)]])}updateConfiguration(e){super.updateConfiguration(e),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVertexColors=this.parameters.hasVertexColors,this._configuration.transparent=this.parameters.color[3]<1||this.parameters.width<1,this._configuration.hasOccludees=e.hasOccludees}get visible(){return this.parameters.color[3]>=q}intersectRay(r,t,o,p,g,b){const{options:y,camera:S,rayBegin:w,rayEnd:M}=o;if(!y.selectionMode||!r.visible||!S)return;if(!_(t))return void e.getLogger("esri.views.3d.webgl-engine.materials.NativeLineMaterial").error("intersection assumes a translation-only matrix");const T=r.attributes.get("position").data,P=Z;i(P,o.point);const C=ae*S.pixelRatio;s(re[0],P[0]-C,P[1]+C,0),s(re[1],P[0]+C,P[1]+C,0),s(re[2],P[0]+C,P[1]-C,0),s(re[3],P[0]-C,P[1]-C,0);for(let e=0;e<4;e++)if(!S.unprojectFromRenderScreen(re[e],te[e]))return;v(S.eye,te[0],te[1],oe),v(S.eye,te[1],te[2],ie),v(S.eye,te[2],te[3],se),v(S.eye,te[3],te[0],ne);let R=Number.MAX_VALUE,V=0;for(const e of W(F,G,T,t)){if(x(oe,F)<0&&x(oe,G)<0||x(ie,F)<0&&x(ie,G)<0||x(se,F)<0&&x(se,G)<0||x(ne,F)<0&&x(ne,G)<0)continue;const r=S.projectToRenderScreen(F,k),t=S.projectToRenderScreen(G,H);if(null==r||null==t)continue;if(r[2]<0&&t[2]>0){n(I,F,G);const e=S.frustum,t=-x(e[4],F)/a(I,L(e[4]));if(c(I,I,t),l(F,F,I),!S.projectToRenderScreen(F,r))continue}else if(r[2]>0&&t[2]<0){n(I,G,F);const e=S.frustum,r=-x(e[4],G)/a(I,L(e[4]));if(c(I,I,r),l(G,G,I),!S.projectToRenderScreen(G,t))continue}else if(r[2]<0&&t[2]<0)continue;r[2]=0,t[2]=0;const o=h(d(r,t,Q),P);o<R&&(R=o,m(J,F),m(K,G),V=e)}if(R<C*C){let e=Number.MAX_VALUE;if(j(d(J,K,Q),d(w,M,Y),z)){n(z,z,w);const r=u(z);c(z,z,1/r),e=r/f(w,M)}b(e,z,V)}}intersectScreenPolygon(r,t,o,i){const{options:s,camera:n,screenPolygonPrimitiveProcessor:a}=o;if(!s.selectionMode||!r.visible)return null;if(!_(t))return e.getLogger("esri.views.3d.webgl-engine.materials.NativeLineMaterial").error("intersection assumes a translation-only matrix"),null;const c=r.attributes.get("position").data,l=new V;for(const e of W(F,G,c,t))for(const[r,t]of a.processLineSegment(ce,F,G))C(n,r,t,k,H)&&(n.renderToScreen(k,$),n.renderToScreen(H,ee),R(i,$,ee,ae)&&(b(d(r,t,Y),n.eye,Z),l.updateIfCloserFromValues(f(n.eye,Z),e,Z,null)));return l}intersectRayDraped(e,t,o,i,s){if(!t.options.selectionMode)return;const n=e.attributes.get("position").data,a=e.attributes.get("size"),c=a?a.data[0]:0,l=o[0],m=o[1],u=((c+1)/2+4)*e.screenToWorldRatio;let f=Number.MAX_VALUE,p=0;for(let g=0;g<n.length-5;g+=3){const e=n[g],t=n[g+1],o=l-e,i=m-t,s=n[g+3]-e,a=n[g+4]-t,c=r((s*o+a*i)/(s*s+a*a),0,1),u=s*c-o,h=a*c-i,d=u*u+h*h;d<f&&(f=d,p=g/3)}f<u*u&&i(s.distance,s.normal,p)}createGLMaterial(e){return new D(e)}createBufferWriter(){const e=this.parameters.hasVertexColors?N:U;return new A(e)}}class D extends M{beginSlot(e){return this.getTechnique(E,e)}}function*W(e,r,t,o){for(let i=0;i<t.length-5;i+=3)e[0]=t[i]+o[12],e[1]=t[i+1]+o[13],e[2]=t[i+2]+o[14],r[0]=t[i+3]+o[12],r[1]=t[i+4]+o[13],r[2]=t[i+5]+o[14],yield i/3}class X extends P{constructor(){super(...arguments),this.color=g,this.hasVertexColors=!1,this.hasSlicePlane=!1,this.width=1}}const F=p(),G=p(),I=p(),z=p(),k=t(),H=t(),J=p(),K=p(),Q=y(),Y=y(),Z=p(),$=o(),ee=o(),re=[t(),t(),t(),t()],te=[p(),p(),p(),p()],oe=S(),ie=S(),se=S(),ne=S(),ae=2,ce=[p(),p()];export{B as NativeLineMaterial,X as Parameters};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{secondsFromMilliseconds as i,Seconds as s}from"../../../../core/time.js";import{copy as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{set as n,subtract as o,dot as l,scale as p,add as c,copy as h,length as m,distance as u,lerp as f,transformMat4 as d,normalize as g}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as S}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{ONES as _,create as v}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeFloat16Array as P}from"../../../../geometry/support/float16.js";import{fromPoints as y,distance2 as E,closestLineSegmentPoint as x,projectPointFraction as w,create as j}from"../../../../geometry/support/lineSegment.js";import{fromPoints as z,signedDistance as T,getNormal as A,create as L}from"../../../../geometry/support/plane.js";import{BufferViewUint32 as C,BufferViewVec3f as M}from"../../../../geometry/support/buffer/BufferView.js";import{isHighlightOrOLID as R,isColor as O,isDepth as V,isColorHighlightOLIDOrDepth as F,is2DGeometryOutput as B}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as U}from"../effects/geometry/olidUtils.js";import N from"../lib/GLMaterial.js";import{Material as k}from"../lib/Material.js";import{ScreenSizePerspectiveEvaluator as W}from"../lib/screenSizePerspectiveUtils.js";import{isTranslationMatrix as I,assert as D}from"../lib/Util.js";import{isImagePattern as Y}from"./lineStippleUtils.js";import{VisualVariablePassParameters as J}from"./VisualVariablePassParameters.js";import{writeDeltaF16Vector as q}from"./internal/bufferWriterUtils.js";import{r as X}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as G,getTextureBufferLayout as H}from"../shaders/RibbonLineLayouts.js";import{RibbonLineTechnique as K}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as Q}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as Z}from"../../../../webscene/support/AlphaCutoff.js";class $ extends k{constructor(e,t){super(e,te),this.produces=new Map([[2,e=>R(e)||O(e)&&8===this.parameters.renderOccluded],[3,e=>V(e)],[10,e=>F(e)&&8===this.parameters.renderOccluded],[11,e=>F(e)&&8===this.parameters.renderOccluded],[4,e=>O(e)&&this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[8,e=>O(e)&&!this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[18,e=>B(e)]]),this._configuration=new Q(t)}updateConfiguration(e){super.updateConfiguration(e);const t=18===e.slot,r=null!=this.parameters.stipplePattern&&null!=this.parameters.stippleTexture&&10!==e.output,i=r&&t&&this.parameters.isImagePattern();this._configuration.draped=t,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.stippleEnabled=r,this._configuration.stippleOffColorEnabled=r&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=r&&this.parameters.stipplePreferContinuous,this._configuration.numJoinSubdivisions=ne(this.parameters.join,r),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&ae(this.parameters.markerParameters),this._configuration.polygonOffsetIndex=this.parameters.polygonOffsetIndex,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.hasOccludees=e.hasOccludees,this._configuration.occluder=8===this.parameters.renderOccluded,this._configuration.wireframe=this.parameters.wireframe,this._configuration.animation=this.parameters.animation,this._configuration.emissionSource=this.emissions?1:0,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective&&!i,this._configuration.worldSizedImagePattern=i}get visible(){return this.parameters.color[3]>=Z||null!=this.parameters.stipplePattern&&(this.parameters.stippleOffColor?.[3]??0)>Z}get emissions(){return this.parameters.emissiveStrength>0?8!==this.parameters.renderOccluded?2:1:0}setParameters(e,t){e.animation=this.parameters.animation,super.setParameters(e,t)}intersectScreenPolygon(){return null}intersectRayDraped({attributes:e,screenToWorldRatio:r},i,s,a,n){if(!i.options.selectionMode)return;const o=e.get("size");let l=this.parameters.width;if(this.parameters.vvSize){const r=e.get("sizeFeatureAttribute").data[0];Number.isNaN(r)?l*=this.parameters.vvSize.fallback[0]:l*=t(this.parameters.vvSize.offset[0]+r*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else o&&(l*=o.data[0]);const p=s[0],c=s[1],h=(l/2+4)*r;let m=Number.MAX_VALUE,u=0;const f=e.get("position").data,d=se(this.parameters,e)?f.length-2:f.length-5;for(let g=0;g<d;g+=3){const e=f[g],r=f[g+1],i=(g+3)%f.length,s=p-e,a=c-r,n=f[i]-e,o=f[i+1]-r,l=t((n*s+o*a)/(n*n+o*o),0,1),h=n*l-s,d=o*l-a,b=h*h+d*d;b<m&&(m=b,u=g/3)}m<h*h&&a(n.distance,n.normal,u)}intersectRay(r,i,s,f,d,g){const{options:b,camera:S,rayBegin:_,rayEnd:v}=s;if(!b.selectionMode||!r.visible||!S)return;if(!I(i))return void e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const P=r.attributes,w=P.get("position").data;let j=this.parameters.width;if(this.parameters.vvSize){const e=P.get("sizeFeatureAttribute").data[0];Number.isNaN(e)||(j*=t(this.parameters.vvSize.offset[0]+e*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0]))}else P.has("size")&&(j*=P.get("size").data[0]);const L=de;a(L,s.point);const C=j*S.pixelRatio,M=4*S.pixelRatio,R=C/2+M;n(je[0],L[0]-R,L[1]+R,0),n(je[1],L[0]+R,L[1]+R,0),n(je[2],L[0]+R,L[1]-R,0),n(je[3],L[0]-R,L[1]-R,0);for(let e=0;e<4;e++)if(!S.unprojectFromRenderScreen(je[e],ze[e]))return;z(S.eye,ze[0],ze[1],Te),z(S.eye,ze[1],ze[2],Ae),z(S.eye,ze[2],ze[3],Le),z(S.eye,ze[3],ze[0],Ce);let O=Number.MAX_VALUE,V=0;const F=se(this.parameters,P)?w.length-2:w.length-5;for(let e=0;e<F;e+=3){le[0]=w[e]+i[12],le[1]=w[e+1]+i[13],le[2]=w[e+2]+i[14];const t=(e+3)%w.length;if(pe[0]=w[t]+i[12],pe[1]=w[t+1]+i[13],pe[2]=w[t+2]+i[14],T(Te,le)<0&&T(Te,pe)<0||T(Ae,le)<0&&T(Ae,pe)<0||T(Le,le)<0&&T(Le,pe)<0||T(Ce,le)<0&&T(Ce,pe)<0)continue;const r=S.projectToRenderScreen(le,ge),s=S.projectToRenderScreen(pe,be);if(null==r||null==s)continue;if(r[2]<0&&s[2]>0){o(ue,le,pe);const e=S.frustum,t=-T(e[4],le)/l(ue,A(e[4]));if(p(ue,ue,t),c(le,le,ue),!S.projectToRenderScreen(le,r))continue}else if(r[2]>0&&s[2]<0){o(ue,pe,le);const e=S.frustum,t=-T(e[4],pe)/l(ue,A(e[4]));if(p(ue,ue,t),c(pe,pe,ue),!S.projectToRenderScreen(pe,s))continue}else if(r[2]<0&&s[2]<0)continue;r[2]=0,s[2]=0;const a=y(r,s,ve),n=E(a,L);if(!(n>=O)){if(this.parameters.screenSizePerspective){const e=this.computeScreenSizePerspectiveWidth(a,le,pe,L,S,j,M);if(n>=e*e)continue}O=n,h(Se,le),h(_e,pe),V=e/3}}if(O<R*R){let e=Number.MAX_VALUE;if(x(y(Se,_e,ve),y(_,v,Pe),fe)){o(fe,fe,_);const t=m(fe);p(fe,fe,1/t),e=t/u(_,v)}g(e,fe,V)}}createBufferWriter(){return new re(G(this.parameters),H(this.parameters),this.parameters)}createGLMaterial(e){return new ee(e)}validateParameters(e){"miter"!==e.join&&(e.miterLimit=0),null!=e.markerParameters&&(e.markerScale=e.markerParameters.width/e.width)}update(e){return!!this.parameters.hasAnimation&&(this.setParameters({timeElapsed:i(e.time)},!1),0!==e.dt)}computeScreenSizePerspectiveWidth(e,t,r,i,s,a,n){const o=w(e,i);f(ce,t,r,o),d(he,ce,s.viewMatrix);const l=m(he),p=this.computeCameraAbsCosAngle(ce,s,this._configuration.spherical);oe.update(p,l,this.parameters.screenSizePerspective,this.parameters.screenSizePerspectiveMinPixelReferenceSize);return oe.apply(a)*s.pixelRatio/2+n}computeCameraAbsCosAngle(e,t,r){return r?g(fe,e):n(fe,0,0,1),o(me,e,t.eye),g(me,me),Math.abs(l(fe,me))}}class ee extends N{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures?.release(this._stipplePattern),this._stipplePattern=null}beginSlot(e){const{stipplePattern:t}=this._material.parameters;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.getTechnique(K,e)}}class te extends J{constructor(){super(...arguments),this._width=0,this.color=_,this.join="miter",this.cap=0,this.miterLimit=5,this.writeDepth=!0,this.polygonOffset=0,this.polygonOffsetIndex=0,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1,this.timeElapsed=s(0),this.animation=0,this.animationSpeed=1,this.trailLength=1,this.startTime=s(0),this.endTime=s(1/0),this.emissiveStrength=0}get width(){return this.isImagePattern()?this.stipplePattern.width:this._width}set width(e){this._width=e}get transparent(){return this.color[3]<1||this.hasAnimation||null!=this.stipplePattern&&(this.stippleOffColor?.[3]??0)<1}get hasAnimation(){return 0!==this.animation}isImagePattern(){return Y(this.stipplePattern)&&null!=this.stippleTexture}}class re{constructor(e,t,r){this.layout=e,this.textureBufferLayout=t,this._parameters=r,this.numJoinSubdivisions=ne(this._parameters.join,null!=this._parameters.stipplePattern)}_isClosed(e){return se(this._parameters,e)}allocate(e){return this.layout.createBuffer(e)}elementCountTextureBuffer(e){return e.get("position").data.length/3}elementCount(e){const t=2,r=e.get("position").indices.length/2+1,i=this._isClosed(e);let s=i?2:2*t;return s+=((i?r:r-1)-(i?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(e,t,r,i,s,a){const{buffer:o,offset:l}=s,{layout:p,textureBufferLayout:c}=this,m=r.get("position"),f=m.indices,g=m.data.length/3,b=g,_=r.get("distanceToStart")?.data;f&&f.length!==2*(g-1)&&console.warn("RibbonLineMaterial does not support indices");const v=o.getField("textureElementIndex",C);D(null!=v,"Missing texture buffer index field"),D(null!==a,"Expected texture buffer target"),D(null!==c,"Expected valid textureBufferLayout");const{textureBufferRange:y,offset:E}=a;D(null!=y,"Using a texture layout, but the texture range for this instance was not provided");const x=y.from;D(y.numElements===b,"Expected number of elements in TextureBuffer to equal number of points");const{buffer:w}=a,j=w.getField("position",M);D(null!==j,"Expected valid position field in texture buffer");const z=p.fields.has("sizeFeatureAttribute");let T=1,A=null;if(z){const e=r.get("sizeFeatureAttribute");1===e.data.length?T=e.data[0]:A=e.data}else T=r.get("size")?.data[0]??1;let L=[1,1,1,1],R=0,O=null;const V=p.fields.has("colorFeatureAttribute");if(V){const e=r.get("colorFeatureAttribute");1===e.data.length?R=e.data[0]:O=e.data}else L=r.get("color")?.data??L;const F=r.get("timeStamps")?.data,B=F&&p.fields.has("timeStamps"),N=p.fields.has("opacityFeatureAttribute");let k=0,W=null;if(N){const e=r.get("opacityFeatureAttribute");1===e.data.length?k=e.data[0]:W=e.data}const I=new Float32Array(o.buffer),Y=P(o.buffer),J=new Uint8Array(o.buffer),X=new Uint32Array(o.buffer),G=p.stride/4;let H=l*G;const K=H;let Q=0;const Z=_?(e,t,r)=>Q=_[r]:(e,t,r)=>Q+=u(e,t),$=I.BYTES_PER_ELEMENT/Y.BYTES_PER_ELEMENT,ee=4/$,te=U(),re=(e,t,r,s,a,n,o,l)=>{const p=o;X[H]=x+p,H++,j.setVec(E+p,t),q(e,t,Y,H*$),H+=ee,q(r,t,Y,H*$),H+=ee,I[H++]=l;let c=H*$;if(Y[c++]=a,Y[c++]=n,H=Math.ceil(c/$),V)I[H]=O?.[o]??R;else{const e=Math.min(4*o,L.length-4),t=4*H;J[t]=255*L[e],J[t+1]=255*L[e+1],J[t+2]=255*L[e+2],J[t+3]=255*L[e+3]}if(H++,I[H++]=A?.[o]??T,N&&(I[H++]=W?.[o]??k),te){let e=4*H;i?(J[e++]=i[0],J[e++]=i[1],J[e++]=i[2],J[e++]=i[3]):(J[e++]=0,J[e++]=0,J[e++]=0,J[e++]=0),H=Math.ceil(.25*e)}B&&(c=H*$,Y[c++]=s[0],Y[c++]=s[1],Y[c++]=s[2],Y[c++]=s[3],H=Math.ceil(c/$))};H+=G,n(Ee,m.data[0],m.data[1],m.data[2]),B&&S(we,F[0],F[1],F[2],F[3]),e&&d(Ee,Ee,e);const se=this._isClosed(r);if(se){const t=m.data.length-3;n(ye,m.data[t],m.data[t+1],m.data[t+2]),e&&d(ye,ye,e)}else n(xe,m.data[3],m.data[4],m.data[5]),e&&d(xe,xe,e),re(Ee,Ee,xe,we,1,-4,0,0),re(Ee,Ee,xe,we,1,4,0,0),h(ye,Ee),h(Ee,xe),B&&S(we,F[4],F[5],F[6],F[7]);const ae=se?0:1,ne=se?g:g-1;for(let u=ae;u<ne;u++){const t=(u+1)%g*3;n(xe,m.data[t],m.data[t+1],m.data[t+2]),e&&d(xe,xe,e),Z(ye,Ee,u),re(ye,Ee,xe,we,0,-1,u,Q),re(ye,Ee,xe,we,0,1,u,Q);const r=this.numJoinSubdivisions;for(let e=0;e<r;++e){const t=(e+1)/(r+1);re(ye,Ee,xe,we,t,-1,u,Q),re(ye,Ee,xe,we,t,1,u,Q)}if(re(ye,Ee,xe,we,1,-2,u,Q),re(ye,Ee,xe,we,1,2,u,Q),h(ye,Ee),h(Ee,xe),B){const e=(u+1)%g*4;S(we,F[e],F[e+1],F[e+2],F[e+3])}}se?(n(xe,m.data[3],m.data[4],m.data[5]),e&&d(xe,xe,e),Q=Z(ye,Ee,ne),re(ye,Ee,xe,we,0,-1,ae,Q),re(ye,Ee,xe,we,0,1,ae,Q)):(Q=Z(ye,Ee,ne),re(ye,Ee,Ee,we,0,-5,ne,Q),re(ye,Ee,Ee,we,0,5,ne,Q)),ie(I,K+G,I,K,G);H=ie(I,H-G,I,H,G),this._parameters.wireframe&&this._addWireframeVertices(o,K,H,G)}_addWireframeVertices(e,t,r,i){const s=new Uint8Array(e.buffer,r*Float32Array.BYTES_PER_ELEMENT),a=new Uint8Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,(r-t)*Float32Array.BYTES_PER_ELEMENT),n=i*Float32Array.BYTES_PER_ELEMENT;let o=0;const l=e=>o=ie(a,e,s,o,n);for(let p=0;p<=a.length-4*n;p+=2*n)l(p),l(p+2*n),l(p+1*n),l(p+2*n),l(p+1*n),l(p+3*n)}}function ie(e,t,r,i,s){for(let a=0;a<s;a++)r[i++]=e[t++];return i}function se(e,t){if(!e.isClosed)return!1;return t.get("position").indices.length>2}function ae(e){return 1===e.anchor&&e.hideOnShortSegments&&"begin-end"===e.placement&&e.worldSpace}function ne(e,t){const r=t?1:0;switch(e){case"miter":case"bevel":return r;case"round":return X+r}}const oe=new W,le=b(),pe=b(),ce=b(),he=b(),me=b(),ue=b(),fe=b(),de=b(),ge=r(),be=r(),Se=b(),_e=b(),ve=j(),Pe=j(),ye=b(),Ee=b(),xe=b(),we=v(),je=[r(),r(),r(),r()],ze=[b(),b(),b(),b()],Te=L(),Ae=L(),Le=L(),Ce=L();export{te as Parameters,$ as RibbonLineMaterial};
2
+ import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r,createScreenPointArray as i}from"../../../../core/screenUtils.js";import{secondsFromMilliseconds as s,Seconds as a}from"../../../../core/time.js";import{copy as n}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{set as o,subtract as l,dot as p,scale as c,add as m,copy as h,length as u,distance as f,lerp as d,transformMat4 as g,normalize as b}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as S}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as _}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{ONES as v,create as y}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeFloat16Array as P}from"../../../../geometry/support/float16.js";import{fromPoints as E,distance2 as x,closestLineSegmentPoint as w,projectPoint as z,projectPointFraction as j,create as T}from"../../../../geometry/support/lineSegment.js";import{fromPoints as L,signedDistance as A,getNormal as M,create as R}from"../../../../geometry/support/plane.js";import{BufferViewUint32 as C,BufferViewVec3f as O}from"../../../../geometry/support/buffer/BufferView.js";import{isHighlightOrOLID as V,isColor as F,isDepth as B,isColorHighlightOLIDOrDepth as U,is2DGeometryOutput as N}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as I}from"../effects/geometry/olidUtils.js";import k from"../lib/GLMaterial.js";import{Material as W}from"../lib/Material.js";import{projectWorldLineSegmentToRenderScreen as D,screenPolygonIntersectsBufferedSegment as Y}from"../lib/screenPolygonOverlapUtils.js";import{Hit as J}from"../lib/screenPolygonTriangleIntersections.js";import{ScreenSizePerspectiveEvaluator as q}from"../lib/screenSizePerspectiveUtils.js";import{isTranslationMatrix as X,assert as G}from"../lib/Util.js";import{isImagePattern as H}from"./lineStippleUtils.js";import{VisualVariablePassParameters as K}from"./VisualVariablePassParameters.js";import{r as Q}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as Z,getTextureBufferLayout as $}from"../shaders/RibbonLineLayouts.js";import{RibbonLineTechnique as ee}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as te}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as re}from"../../../../webscene/support/AlphaCutoff.js";class ie extends W{constructor(e,t){super(e,ae),this.produces=new Map([[2,e=>V(e)||F(e)&&8===this.parameters.renderOccluded],[3,e=>B(e)],[10,e=>U(e)&&8===this.parameters.renderOccluded],[11,e=>U(e)&&8===this.parameters.renderOccluded],[4,e=>F(e)&&this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[8,e=>F(e)&&!this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[18,e=>N(e)]]),this._configuration=new te(t)}updateConfiguration(e){super.updateConfiguration(e);const t=18===e.slot,r=null!=this.parameters.stipplePattern&&null!=this.parameters.stippleTexture&&10!==e.output,i=r&&t&&this.parameters.isImagePattern();this._configuration.draped=t,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.stippleEnabled=r,this._configuration.stippleOffColorEnabled=r&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=r&&this.parameters.stipplePreferContinuous,this._configuration.numJoinSubdivisions=ce(this.parameters.join,r),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&pe(this.parameters.markerParameters),this._configuration.polygonOffsetIndex=this.parameters.polygonOffsetIndex,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.hasOccludees=e.hasOccludees,this._configuration.occluder=8===this.parameters.renderOccluded,this._configuration.wireframe=this.parameters.wireframe,this._configuration.animation=this.parameters.animation,this._configuration.emissionSource=this.emissions?1:0,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective&&!i,this._configuration.worldSizedImagePattern=i}get visible(){return this.parameters.color[3]>=re||null!=this.parameters.stipplePattern&&(this.parameters.stippleOffColor?.[3]??0)>re}get emissions(){return this.parameters.emissiveStrength>0?8!==this.parameters.renderOccluded?2:1:0}setParameters(e,t){e.animation=this.parameters.animation,super.setParameters(e,t)}intersectRayDraped({attributes:e,screenToWorldRatio:r},i,s,a,n){if(!i.options.selectionMode)return;const o=e.get("size");let l=this.parameters.width;if(this.parameters.vvSize){const r=e.get("sizeFeatureAttribute").data[0];Number.isNaN(r)?l*=this.parameters.vvSize.fallback[0]:l*=t(this.parameters.vvSize.offset[0]+r*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else o&&(l*=o.data[0]);const p=s[0],c=s[1],m=(l/2+Ue)*r;let h=Number.MAX_VALUE,u=0;const f=e.get("position").data,d=le(this.parameters,e)?f.length-2:f.length-5;for(let g=0;g<d;g+=3){const e=f[g],r=f[g+1],i=(g+3)%f.length,s=p-e,a=c-r,n=f[i]-e,o=f[i+1]-r,l=t((n*s+o*a)/(n*n+o*o),0,1),m=n*l-s,d=o*l-a,b=m*m+d*d;b<h&&(h=b,u=g/3)}h<m*m&&a(n.distance,n.normal,u)}intersectRay(t,r,i,s,a,d){const{options:g,camera:b,rayBegin:S,rayEnd:_}=i;if(!g.selectionMode||!t.visible||!b)return;if(!X(r))return void e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const v=t.attributes,y=v.get("position").data,P=this._getLineSize(v),z=_e;n(z,i.point);const j=P*b.pixelRatio,T=Ue*b.pixelRatio,R=j/2+T;o(Re[0],z[0]-R,z[1]+R,0),o(Re[1],z[0]+R,z[1]+R,0),o(Re[2],z[0]+R,z[1]-R,0),o(Re[3],z[0]-R,z[1]-R,0);for(let e=0;e<4;e++)if(!b.unprojectFromRenderScreen(Re[e],Ce[e]))return;L(b.eye,Ce[0],Ce[1],Oe),L(b.eye,Ce[1],Ce[2],Ve),L(b.eye,Ce[2],Ce[3],Fe),L(b.eye,Ce[3],Ce[0],Be);let C=Number.MAX_VALUE,O=0;for(const e of this._forEachTransformedLineSegment(he,ue,y,r,le(this.parameters,v))){if(A(Oe,he)<0&&A(Oe,ue)<0||A(Ve,he)<0&&A(Ve,ue)<0||A(Fe,he)<0&&A(Fe,ue)<0||A(Be,he)<0&&A(Be,ue)<0)continue;const t=b.projectToRenderScreen(he,ve),r=b.projectToRenderScreen(ue,ye);if(null==t||null==r)continue;if(t[2]<0&&r[2]>0){l(be,he,ue);const e=b.frustum,r=-A(e[4],he)/p(be,M(e[4]));if(c(be,be,r),m(he,he,be),!b.projectToRenderScreen(he,t))continue}else if(t[2]>0&&r[2]<0){l(be,ue,he);const e=b.frustum,t=-A(e[4],ue)/p(be,M(e[4]));if(c(be,be,t),m(ue,ue,be),!b.projectToRenderScreen(ue,r))continue}else if(t[2]<0&&r[2]<0)continue;t[2]=0,r[2]=0;const i=E(t,r,ze),s=x(i,z);if(!(s>=C)){if(this.parameters.screenSizePerspective){const e=this.computeScreenSizePerspectiveWidth(i,he,ue,z,b,P,T);if(s>=e*e)continue}C=s,h(xe,he),h(we,ue),O=e}}if(C<R*R){let e=Number.MAX_VALUE;if(w(E(xe,we,ze),E(S,_,je),Se)){l(Se,Se,S);const t=u(Se);c(Se,Se,1/t),e=t/f(S,_)}d(e,Se,O)}}intersectScreenPolygon(t,r,i,s){const{options:a,camera:n,screenPolygonPrimitiveProcessor:o}=i;if(!a.selectionMode||!t.visible)return null;if(!X(r))return e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix"),null;const l=t.attributes,p=l.get("position").data,c=this._getLineSize(l),m=Ue,h=m*n.pixelRatio,u=new J;for(const e of this._forEachTransformedLineSegment(he,ue,p,r,le(this.parameters,l)))for(const[t,r]of o.processLineSegment(Ne,he,ue)){if(!D(n,t,r,ve,ye))continue;const i=E(ve,ye,ze);let a=c/2+m;this.parameters.screenSizePerspective&&(d(_e,ve,ye,.5),a=Math.max(a,this.computeScreenSizePerspectiveWidth(i,t,r,_e,n,c,h)/n.pixelRatio)),n.renderToScreen(ve,Pe),n.renderToScreen(ye,Ee),Y(s,Pe,Ee,a)&&(z(E(t,r,je),n.eye,fe),u.updateIfCloserFromValues(f(n.eye,fe),e,fe,null))}return u}createBufferWriter(){return new ne(Z(this.parameters),$(this.parameters),this.parameters)}createGLMaterial(e){return new se(e)}validateParameters(e){"miter"!==e.join&&(e.miterLimit=0),null!=e.markerParameters&&(e.markerScale=e.markerParameters.width/e.width)}update(e){return!!this.parameters.hasAnimation&&(this.setParameters({timeElapsed:s(e.time)},!1),0!==e.dt)}computeScreenSizePerspectiveWidth(e,t,r,i,s,a,n){const o=j(e,i);d(fe,t,r,o),g(de,fe,s.viewMatrix);const l=u(de),p=this.computeCameraAbsCosAngle(fe,s,this._configuration.spherical);me.update(p,l,this.parameters.screenSizePerspective,this.parameters.screenSizePerspectiveMinPixelReferenceSize);return me.apply(a)*s.pixelRatio/2+n}computeCameraAbsCosAngle(e,t,r){return r?b(Se,e):o(Se,0,0,1),l(ge,e,t.eye),b(ge,ge),Math.abs(p(Se,ge))}_getLineSize(e,r=!1){let i=this.parameters.width;if(this.parameters.vvSize){const s=e.get("sizeFeatureAttribute").data[0];Number.isNaN(s)?r&&(i*=this.parameters.vvSize.fallback[0]):i*=t(this.parameters.vvSize.offset[0]+s*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else e.has("size")&&(i*=e.get("size").data[0]);return i}*_forEachTransformedLineSegment(e,t,r,i,s){const a=s?r.length-2:r.length-5;for(let n=0;n<a;n+=3){e[0]=r[n]+i[12],e[1]=r[n+1]+i[13],e[2]=r[n+2]+i[14];const s=(n+3)%r.length;t[0]=r[s]+i[12],t[1]=r[s+1]+i[13],t[2]=r[s+2]+i[14],yield n/3}}}class se extends k{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures?.release(this._stipplePattern),this._stipplePattern=null}beginSlot(e){const{stipplePattern:t}=this._material.parameters;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.getTechnique(ee,e)}}class ae extends K{constructor(){super(...arguments),this._width=0,this.color=v,this.join="miter",this.cap=0,this.miterLimit=5,this.writeDepth=!0,this.polygonOffset=0,this.polygonOffsetIndex=0,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1,this.timeElapsed=a(0),this.animation=0,this.animationSpeed=1,this.trailLength=1,this.startTime=a(0),this.endTime=a(1/0),this.emissiveStrength=0}get width(){return this.isImagePattern()?this.stipplePattern.width:this._width}set width(e){this._width=e}get transparent(){return this.color[3]<1||this.hasAnimation||null!=this.stipplePattern&&(this.stippleOffColor?.[3]??0)<1}get hasAnimation(){return 0!==this.animation}isImagePattern(){return H(this.stipplePattern)&&null!=this.stippleTexture}}class ne{constructor(e,t,r){this.layout=e,this.textureBufferLayout=t,this._parameters=r,this.numJoinSubdivisions=ce(this._parameters.join,null!=this._parameters.stipplePattern)}_isClosed(e){return le(this._parameters,e)}allocate(e){return this.layout.createBuffer(e)}elementCountTextureBuffer(e){return e.get("position").data.length/3+2}elementCount(e){const t=2,r=e.get("position").indices.length/2+1,i=this._isClosed(e);let s=i?2:2*t;return s+=((i?r:r-1)-(i?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(e,t,r,i,s,a){const{buffer:n,offset:l}=s,{layout:p,textureBufferLayout:c}=this,m=r.get("position"),u=m.indices,d=m.data.length/3,b=d+2,S=r.get("distanceToStart")?.data;u&&u.length!==2*(d-1)&&console.warn("RibbonLineMaterial does not support indices");const v=n.getField("textureElementIndex",C);G(null!=v,"Missing texture buffer index field"),G(null!==a,"Expected texture buffer target"),G(null!==c,"Expected valid textureBufferLayout");const{textureBufferRange:y,offset:E}=a;G(null!=y,"Using a texture layout, but the texture range for this instance was not provided");const x=y.from;G(y.numElements===b,"Expected number of elements in TextureBuffer to equal number of points");const{buffer:w}=a,z=w.getField("position",O);G(null!==z,"Expected valid position field in texture buffer");const j=p.fields.has("sizeFeatureAttribute");let T=1,L=null;if(j){const e=r.get("sizeFeatureAttribute");1===e.data.length?T=e.data[0]:L=e.data}else T=r.get("size")?.data[0]??1;let A=[1,1,1,1],M=0,R=null;const V=p.fields.has("colorFeatureAttribute");if(V){const e=r.get("colorFeatureAttribute");1===e.data.length?M=e.data[0]:R=e.data}else A=r.get("color")?.data??A;const F=r.get("timeStamps")?.data,B=F&&p.fields.has("timeStamps"),U=p.fields.has("opacityFeatureAttribute");let N=0,k=null;if(U){const e=r.get("opacityFeatureAttribute");1===e.data.length?N=e.data[0]:k=e.data}const W=new Float32Array(n.buffer),D=P(n.buffer),Y=new Uint8Array(n.buffer),J=new Uint32Array(n.buffer),q=p.stride/4;let X=l*q;const H=X;let K=0;const Q=W.BYTES_PER_ELEMENT/D.BYTES_PER_ELEMENT,Z=I(),$=this._isClosed(r),ee=(t,r)=>{const i=3*r;o(t,m.data[i+0],m.data[i+1],m.data[i+2]),e&&g(t,t,e)};for(let o=0;o<d;++o)ee(Le,o),z.setVec(E+o+1,Le);$?(w.copyItem(E+b-2,E+0),w.copyItem(E+1,E+b-1)):(w.copyItem(E+1,E+0),w.copyItem(E+b-2,E+b-1));const te=(e,t,r,s,a,n,o,l)=>{const p=o+1;J[X]=x+p,X++,W[X++]=l;let c=X*Q;if(D[c++]=a,D[c++]=n,X=Math.ceil(c/Q),V)W[X]=R?.[o]??M;else{const e=Math.min(4*o,A.length-4),t=4*X;Y[t]=255*A[e],Y[t+1]=255*A[e+1],Y[t+2]=255*A[e+2],Y[t+3]=255*A[e+3]}if(X++,W[X++]=L?.[o]??T,U&&(W[X++]=k?.[o]??N),Z){let e=4*X;i?(Y[e++]=i[0],Y[e++]=i[1],Y[e++]=i[2],Y[e++]=i[3]):(Y[e++]=0,Y[e++]=0,Y[e++]=0,Y[e++]=0),X=Math.ceil(.25*e)}B&&(c=X*Q,D[c++]=s[0],D[c++]=s[1],D[c++]=s[2],D[c++]=s[3],X=Math.ceil(c/Q))},re=()=>{h(Te,Le),h(Le,Ae)},ie=e=>{if(B){const t=4*e;_(Me,F[t+0],F[t+1],F[t+2],F[t+3])}},se=(e,t,r)=>{null!=S?K=S[r]:K+=f(e,t)};X+=q,ee(Le,0),ie(0);let ae=0,ne=0;$?(ee(Te,d-1),ae=0,ne=d):(ee(Ae,1),te(Le,Le,Ae,Me,1,-4,0,0),te(Le,Le,Ae,Me,1,4,0,0),re(),ie(1),ae=1,ne=d-1);for(let o=ae;o<ne;o++){ee(Ae,(o+1)%d),se(Te,Le,o),te(Te,Le,Ae,Me,0,-1,o,K),te(Te,Le,Ae,Me,0,1,o,K);const e=this.numJoinSubdivisions;for(let t=0;t<e;++t){const r=(t+1)/(e+1);te(Te,Le,Ae,Me,r,-1,o,K),te(Te,Le,Ae,Me,r,1,o,K)}te(Te,Le,Ae,Me,1,-2,o,K),te(Te,Le,Ae,Me,1,2,o,K),re(),ie((o+1)%d)}se(Te,Le,ne),$?(ee(Ae,1),te(Te,Le,Ae,Me,0,-1,ae,K),te(Te,Le,Ae,Me,0,1,ae,K)):(te(Te,Le,Le,Me,0,-5,ne,K),te(Te,Le,Le,Me,0,5,ne,K)),oe(W,H+q,W,H,q);X=oe(W,X-q,W,X,q),this._parameters.wireframe&&this._addWireframeVertices(n,H,X,q)}_addWireframeVertices(e,t,r,i){const s=new Uint8Array(e.buffer,r*Float32Array.BYTES_PER_ELEMENT),a=new Uint8Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,(r-t)*Float32Array.BYTES_PER_ELEMENT),n=i*Float32Array.BYTES_PER_ELEMENT;let o=0;const l=e=>o=oe(a,e,s,o,n);for(let p=0;p<=a.length-4*n;p+=2*n)l(p),l(p+2*n),l(p+1*n),l(p+2*n),l(p+1*n),l(p+3*n)}}function oe(e,t,r,i,s){for(let a=0;a<s;a++)r[i++]=e[t++];return i}function le(e,t){if(!e.isClosed)return!1;return t.get("position").indices.length>2}function pe(e){return 1===e.anchor&&e.hideOnShortSegments&&"begin-end"===e.placement&&e.worldSpace}function ce(e,t){const r=t?1:0;switch(e){case"miter":case"bevel":return r;case"round":return Q+r}}const me=new q,he=S(),ue=S(),fe=S(),de=S(),ge=S(),be=S(),Se=S(),_e=S(),ve=r(),ye=r(),Pe=i(),Ee=i(),xe=S(),we=S(),ze=T(),je=T(),Te=S(),Le=S(),Ae=S(),Me=y(),Re=[r(),r(),r(),r()],Ce=[S(),S(),S(),S()],Oe=R(),Ve=R(),Fe=R(),Be=R(),Ue=4,Ne=[S(),S()];export{ae as Parameters,ie as RibbonLineMaterial};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{newLayout as e}from"../../support/buffer/InterleavedLayout.js";import{olidEnabled as t}from"../effects/geometry/olidUtils.js";import{TextureBackedBufferLayout as r}from"../lib/TextureBackedBuffer/TextureBackedBufferLayout.js";function o(r){const o=e().u32("textureElementIndex",{integer:!0}).vec4f16("previousDelta").vec4f16("nextDelta").f32("u0").vec2f16("lineParameters");return r.hasVVColor?o.f32("colorFeatureAttribute"):o.vec4u8("color",{glNormalized:!0}),r.hasVVSize?o.f32("sizeFeatureAttribute"):o.f32("size"),r.hasVVOpacity&&o.f32("opacityFeatureAttribute"),t()&&o.vec4u8("olidColor"),r.hasAnimation&&o.vec4f16("timeStamps"),o}const i=new r([{type:"vec3f32",name:"position"}]);function u(e){return i}export{i as baseTextureBufferLayout,o as getLayout,u as getTextureBufferLayout};
2
+ import{newLayout as e}from"../../support/buffer/InterleavedLayout.js";import{olidEnabled as t}from"../effects/geometry/olidUtils.js";import{TextureBackedBufferLayout as r}from"../lib/TextureBackedBuffer/TextureBackedBufferLayout.js";function o(r){const o=e().u32("textureElementIndex",{integer:!0}).f32("u0").vec2f16("lineParameters");return r.hasVVColor?o.f32("colorFeatureAttribute"):o.vec4u8("color",{glNormalized:!0}),r.hasVVSize?o.f32("sizeFeatureAttribute"):o.f32("size"),r.hasVVOpacity&&o.f32("opacityFeatureAttribute"),t()&&o.vec4u8("olidColor"),r.hasAnimation&&o.vec4f16("timeStamps"),o}const i=new r([{type:"vec3f32",name:"position"}]);function u(e){return i}export{i as baseTextureBufferLayout,o as getLayout,u as getTextureBufferLayout};
@@ -68,11 +68,6 @@ export default abstract class ViewshedLayerView extends LayerView {
68
68
  *
69
69
  * Calling this method sets [interactive](https://developers.arcgis.com/javascript/latest/references/core/views/layers/ViewshedLayerView/#interactive) to `true`.
70
70
  *
71
- * > [!WARNING]
72
- * >
73
- * > Note that when placing viewsheds interactively, the viewshed is created with a 1.5 meter vertical offset from the scene.
74
- * > _This behavior is subject to change in a future release._
75
- *
76
71
  * @param options - An object specifying additional options.
77
72
  * @returns A promise which resolves when creation is completed successfully or rejected if it is
78
73
  * canceled.
@@ -102,11 +97,6 @@ export default abstract class ViewshedLayerView extends LayerView {
102
97
  *
103
98
  * Calling this method sets [interactive](https://developers.arcgis.com/javascript/latest/references/core/views/layers/ViewshedLayerView/#interactive) to `true`.
104
99
  *
105
- * > [!WARNING]
106
- * >
107
- * > Note that when placing viewsheds interactively, the viewshed is created with a 1.5 meter vertical offset from the scene.
108
- * > _This behavior is subject to change in a future release._
109
- *
110
100
  * @param options - An object specifying additional options.
111
101
  * @returns A promise which
112
102
  * resolves when the operation is completed successfully or rejected if it is canceled.
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import r from"../../core/Accessor.js";import i from"../../core/Error.js";import t from"../../core/Logger.js";import{someMap as s}from"../../core/MapUtils.js";import{createAbortError as o,isAbortError as a}from"../../core/promiseUtils.js";import{on as n,watch as l,syncAndInitial as h}from"../../core/reactiveUtils.js";import{schedule as y}from"../../core/scheduling.js";import{property as c,subclass as p}from"../../core/accessorSupport/decorators.js";import{get as d}from"../../core/accessorSupport/get.js";import{UpdatingHandles as w}from"../../core/support/UpdatingHandles.js";import{destroyMap as f}from"../../support/collectionUtils.js";import{LayerLayerViewInfo as u}from"./LayerLayerViewInfo.js";function m(e){return null!=e&&"object"==typeof e&&"layerViews"in e}let g=class extends r{constructor(e){super(e),this._layerLayerViewInfoMap=new Map,this._recyclingInfoMap=new Map,this._watchUpdatingTracking=new w,this.supportsGround=!0,this._preloadLayerViewModules=()=>{const e=this.view.map?.allLayers;if(e)for(const r of e)!1!==this.layerViewFilter?.(r)&&this.layerViewImporter.hasLayerViewModule(r)&&this.layerViewImporter.importLayerView(r)},this._reschedule=()=>this.destroyed?Promise.reject():(null==this._workPromise&&(this._workPromise=Promise.withResolvers(),this._workPromise.promise.catch(()=>{})),this.removeHandles("reschedule"),this.addHandles(y(this._doWork),"reschedule"),this._workPromise.promise),this._doWork=()=>{if(this.destroyed)return;const{map:e}=this.view;if(!e)return void this.clear();if(this._map!==e&&(this.clear(),this._map=e),null==this._workPromise)return void this.notifyChange("updating");this.removeHandles("reschedule"),this.removeHandles("collection-change");const r=new Set,i=[],t=this.view.ready,s=e=>{if(null!=e)for(const o of e)if(o){if(!1===this.layerViewFilter?.(o))continue;r.add(o);const e=this._layerLayerViewInfoMap.get(o);e&&t?e.start():e||this._recyclingInfoMap.has(o)||i.push(o),"layers"in o&&o.layers&&s(o.layers)}};for(const a of this._rootCollectionNames)s(d(this,a));const o=new Array,n=e=>{const r=e.tryRecycle(i);r?(this._recyclingInfoMap.set(e.layer,e),this._watchUpdatingTracking.consumePromise(r),this.notifyChange("updating"),r.then(()=>{this._recyclingInfoMap.delete(e.layer),this._layerLayerViewInfoMap.set(e.layer,e),this._reschedule(),this.notifyChange("updating")}).catch(r=>{a(r)||(this._recyclingInfoMap.delete(e.layer),e.destroy(),this._reschedule(),this.notifyChange("updating"))})):o.push(e)};for(const a of this._layerLayerViewInfoMap.values())r.has(a.layer)||(this._layerLayerViewInfoMap.delete(a.layer),n(a));for(const a of this._recyclingInfoMap.values())r.has(a.layer)||(this._recyclingInfoMap.delete(a.layer),n(a));for(const a of i)this._createLayerView(a);this._refreshCollections(),o.forEach(e=>e.destroy());const l=[e?.ground?.layers,e?.basemap?.baseLayers,e?.basemap?.groundLayers,e?.basemap?.referenceLayers,e?.layers].filter(e=>!!e);r.forEach(e=>"layers"in e&&l.push(e.layers)),this.addHandles(l.map(e=>this._watchUpdatingTracking.addOnCollectionChange(()=>e,this._reschedule)),"collection-change"),this._workPromise.resolve(),this._workPromise=null},this._layersToLayerViews=new Map(e.layerviewMapping)}initialize(){this.addHandles([n(()=>this.view?.map?.allLayers,"change",this._preloadLayerViewModules,{onListenerAdd:this._preloadLayerViewModules}),l(()=>{const e=this.view,r=e?.map;return[r?.basemap,r?.ground,r?.layers,e?.ready]},()=>this._reschedule().catch(()=>{}),h)]),this._preloadLayerViewModules(),this._reschedule().catch(()=>{})}clearHandles(){this._watchUpdatingTracking.removeAll()}destroy(){this.clear(),f(this._recyclingInfoMap),f(this._layerLayerViewInfoMap),this._watchUpdatingTracking.destroy(),this._map=null,null!=this._workPromise&&(this._workPromise.reject(o()),this._workPromise=null)}get _rootCollectionNames(){return Array.from(this._layersToLayerViews.keys())}get updating(){return null!=this._workPromise||this._watchUpdatingTracking.updating||s(this._layerLayerViewInfoMap,e=>!e.done)||this._recyclingInfoMap.size>0}get updatingRemaining(){let e=0;for(const r of this._layerLayerViewInfoMap.values())r.done||++e;return e}clear(){this.destroyed||(this._clearCollections(),f(this._layerLayerViewInfoMap),f(this._recyclingInfoMap))}async whenLayerView(e){await this._reschedule();const r=this._layerLayerViewInfoMap.get(e)?.promise;if(!r){const r=this._recyclingInfoMap.get(e)?.promise;if(!r)throw new i("view:no-layerview-for-layer","No layerview has been found for the layer",{layer:e});return r}return r}isCreatingLayerViewsForLayer(e,r){this.commitProperty("updatingRemaining");const i=this._layerLayerViewInfoMap.get(e);if(!i?.done)return!0;const t=i.layerView;return!(!t||!r||t.parent===r)||!!(i.done&&t&&"layers"in e&&e.layers?.length)&&e.layers.some(e=>this.isCreatingLayerViewsForLayer(e,t))}isRecyclingLayerViewForLayer(e){return this._recyclingInfoMap.has(e)}_refreshCollections(){for(const[e,r]of this._layersToLayerViews)this._populateLayerViewsOwners(d(this,e),d(this,r),this.view);this.notifyChange("updating"),this.notifyChange("updatingRemaining")}_clearCollections(){for(const e of this._layersToLayerViews.values())d(this,e)?.removeAll()}_populateLayerViewsOwners(e,r,i){if(!e||!r)return void r?.removeAll();let t=0;for(const s of e){const e=this._layerLayerViewInfoMap.get(s);if(!e?.layerView)continue;const{layerView:o}=e;o.layer=s,o.parent=i,r.at(t)!==o&&r.splice(t,0,o),"layers"in s&&m(o)&&this._populateLayerViewsOwners(s.layers,o.layerViews,o),++t}t<r.length&&r.splice(t)}_createLayerView(e){e.load().catch(()=>{}),this.layerViewImporter.hasLayerViewModule(e)&&this.layerViewImporter.importLayerView(e);const r=new u(e,this.view,this.layerViewImporter);this._watchUpdatingTracking.consumePromise(r.promise),r.promise?.then(()=>this._refreshCollections(),r=>{r&&(a(r)||"cancelled:layerview-create"===r.name)||t.getLogger(this).error(`Failed to create layerview for layer title:'${e.title??"no title"}', id:'${e.id??"no id"}' of type '${e.type}'.`,{layer:e,error:r}),this.destroyed||this._refreshCollections()}),this._layerLayerViewInfoMap.set(e,r),this.view.ready&&r.start(),this.notifyChange("updating"),this.notifyChange("updatingRemaining")}};e([c()],g.prototype,"_workPromise",void 0),e([c({readOnly:!0})],g.prototype,"_watchUpdatingTracking",void 0),e([c({readOnly:!0})],g.prototype,"_layersToLayerViews",void 0),e([c({constructOnly:!0})],g.prototype,"layerviewMapping",void 0),e([c({readOnly:!0})],g.prototype,"_rootCollectionNames",null),e([c({constructOnly:!0})],g.prototype,"layerViewFilter",void 0),e([c()],g.prototype,"layerViewImporter",void 0),e([c()],g.prototype,"supportsGround",void 0),e([c({readOnly:!0})],g.prototype,"updating",null),e([c({readOnly:!0})],g.prototype,"updatingRemaining",null),e([c({constructOnly:!0})],g.prototype,"view",void 0),g=e([p("esri.views.support.LayerViewManager")],g);const _=g;export{_ as default};
2
+ import{__decorate as e}from"tslib";import r from"../../core/Accessor.js";import i from"../../core/Error.js";import t from"../../core/Logger.js";import{someMap as s}from"../../core/MapUtils.js";import{createAbortError as o,isAbortError as a}from"../../core/promiseUtils.js";import{on as n,watch as l,syncAndInitial as h}from"../../core/reactiveUtils.js";import{schedule as y}from"../../core/scheduling.js";import{property as c,subclass as p}from"../../core/accessorSupport/decorators.js";import{get as d}from"../../core/accessorSupport/get.js";import{UpdatingHandles as w}from"../../core/support/UpdatingHandles.js";import{destroyMap as f}from"../../support/collectionUtils.js";import{LayerLayerViewInfo as m}from"./LayerLayerViewInfo.js";function u(e){return null!=e&&"object"==typeof e&&"layerViews"in e}let g=class extends r{constructor(e){super(e),this._layerLayerViewInfoMap=new Map,this._recyclingInfoMap=new Map,this._watchUpdatingTracking=new w,this._preloadLayerViewModules=()=>{const e=this.view.map?.allLayers;if(e)for(const r of e)!1!==this.layerViewFilter?.(r)&&this.layerViewImporter.hasLayerViewModule(r)&&this.layerViewImporter.importLayerView(r)},this._reschedule=()=>this.destroyed?Promise.reject():(null==this._workPromise&&(this._workPromise=Promise.withResolvers(),this._workPromise.promise.catch(()=>{})),this.removeHandles("reschedule"),this.addHandles(y(this._doWork),"reschedule"),this._workPromise.promise),this._doWork=()=>{if(this.destroyed)return;const{map:e}=this.view;if(!e)return void this.clear();if(this._map!==e&&(this.clear(),this._map=e),null==this._workPromise)return void this.notifyChange("updating");this.removeHandles("reschedule"),this.removeHandles("collection-change");const r=new Set,i=[],t=this.view.ready,s=e=>{if(null!=e)for(const o of e)if(o){if(!1===this.layerViewFilter?.(o))continue;r.add(o);const e=this._layerLayerViewInfoMap.get(o);e&&t?e.start():e||this._recyclingInfoMap.has(o)||i.push(o),"layers"in o&&o.layers&&s(o.layers)}};for(const a of this._rootCollectionNames)s(d(this,a));const o=new Array,n=e=>{const r=e.tryRecycle(i);r?(this._recyclingInfoMap.set(e.layer,e),this._watchUpdatingTracking.consumePromise(r),this.notifyChange("updating"),r.then(()=>{this._recyclingInfoMap.delete(e.layer),this._layerLayerViewInfoMap.set(e.layer,e),this._reschedule(),this.notifyChange("updating")}).catch(r=>{a(r)||(this._recyclingInfoMap.delete(e.layer),e.destroy(),this._reschedule(),this.notifyChange("updating"))})):o.push(e)};for(const a of this._layerLayerViewInfoMap.values())r.has(a.layer)||(this._layerLayerViewInfoMap.delete(a.layer),n(a));for(const a of this._recyclingInfoMap.values())r.has(a.layer)||(this._recyclingInfoMap.delete(a.layer),n(a));for(const a of i)this._createLayerView(a);this._refreshCollections(),o.forEach(e=>e.destroy());const l=[e?.ground?.layers,e?.basemap?.baseLayers,e?.basemap?.groundLayers,e?.basemap?.referenceLayers,e?.layers].filter(e=>!!e);r.forEach(e=>"layers"in e&&l.push(e.layers)),this.addHandles(l.map(e=>this._watchUpdatingTracking.addOnCollectionChange(()=>e,this._reschedule)),"collection-change"),this._workPromise.resolve(),this._workPromise=null},this._layersToLayerViews=new Map(e.layerviewMapping)}initialize(){this.addHandles([n(()=>this.view?.map?.allLayers,"change",this._preloadLayerViewModules,{onListenerAdd:this._preloadLayerViewModules}),l(()=>{const e=this.view,r=e?.map;return[r?.basemap,r?.ground,r?.layers,e?.ready]},()=>this._reschedule().catch(()=>{}),h)]),this._preloadLayerViewModules(),this._reschedule().catch(()=>{})}clearHandles(){this._watchUpdatingTracking.removeAll()}destroy(){this.clear(),f(this._recyclingInfoMap),f(this._layerLayerViewInfoMap),this._watchUpdatingTracking.destroy(),this._map=null,null!=this._workPromise&&(this._workPromise.reject(o()),this._workPromise=null)}get _rootCollectionNames(){return Array.from(this._layersToLayerViews.keys())}get updating(){return null!=this._workPromise||this._watchUpdatingTracking.updating||s(this._layerLayerViewInfoMap,e=>!e.done)||this._recyclingInfoMap.size>0}get updatingRemaining(){let e=0;for(const r of this._layerLayerViewInfoMap.values())r.done||++e;return e}clear(){this.destroyed||(this._clearCollections(),f(this._layerLayerViewInfoMap),f(this._recyclingInfoMap))}async whenLayerView(e){await this._reschedule();const r=this._layerLayerViewInfoMap.get(e)?.promise;if(!r){const r=this._recyclingInfoMap.get(e)?.promise;if(!r)throw new i("view:no-layerview-for-layer","No layerview has been found for the layer",{layer:e});return r}return r}isCreatingLayerViewsForLayer(e,r){this.commitProperty("updatingRemaining");const i=this._layerLayerViewInfoMap.get(e);if(!i?.done)return!0;const t=i.layerView;return!(!t||!r||t.parent===r)||!!(i.done&&t&&"layers"in e&&e.layers?.length)&&e.layers.some(e=>this.isCreatingLayerViewsForLayer(e,t))}isRecyclingLayerViewForLayer(e){return this._recyclingInfoMap.has(e)}_refreshCollections(){for(const[e,r]of this._layersToLayerViews)this._populateLayerViewsOwners(d(this,e),d(this,r),this.view);this.notifyChange("updating"),this.notifyChange("updatingRemaining")}_clearCollections(){for(const e of this._layersToLayerViews.values())d(this,e)?.removeAll()}_populateLayerViewsOwners(e,r,i){if(!e||!r)return void r?.removeAll();let t=0;for(const s of e){const e=this._layerLayerViewInfoMap.get(s);if(!e?.layerView)continue;const{layerView:o}=e;o.layer=s,o.parent=i,r.at(t)!==o&&r.splice(t,0,o),"layers"in s&&u(o)&&this._populateLayerViewsOwners(s.layers,o.layerViews,o),++t}t<r.length&&r.splice(t)}_createLayerView(e){e.load().catch(()=>{}),this.layerViewImporter.hasLayerViewModule(e)&&this.layerViewImporter.importLayerView(e);const r=new m(e,this.view,this.layerViewImporter);this._watchUpdatingTracking.consumePromise(r.promise),r.promise?.then(()=>this._refreshCollections(),r=>{r&&(a(r)||"cancelled:layerview-create"===r.name)||t.getLogger(this).error(`Failed to create layerview for layer title:'${e.title??"no title"}', id:'${e.id??"no id"}' of type '${e.type}'.`,{layer:e,error:r}),this.destroyed||this._refreshCollections()}),this._layerLayerViewInfoMap.set(e,r),this.view.ready&&r.start(),this.notifyChange("updating"),this.notifyChange("updatingRemaining")}};e([c()],g.prototype,"_workPromise",void 0),e([c({readOnly:!0})],g.prototype,"_watchUpdatingTracking",void 0),e([c({readOnly:!0})],g.prototype,"_layersToLayerViews",void 0),e([c({constructOnly:!0})],g.prototype,"layerviewMapping",void 0),e([c({readOnly:!0})],g.prototype,"_rootCollectionNames",null),e([c({constructOnly:!0})],g.prototype,"layerViewFilter",void 0),e([c()],g.prototype,"layerViewImporter",void 0),e([c({readOnly:!0})],g.prototype,"updating",null),e([c({readOnly:!0})],g.prototype,"updatingRemaining",null),e([c({constructOnly:!0})],g.prototype,"view",void 0),g=e([p("esri.views.support.LayerViewManager")],g);const _=g;export{_ as default};