@arcgis/core 5.2.0-next.140 → 5.2.0-next.141
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.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/25e6013e2c095629b236.js +1 -0
- package/assets/esri/core/workers/chunks/{5e90c1b49f2b7e21d05a.js → 55766692b578e60dd70e.js} +22 -22
- package/chunks/RibbonLine.glsl.js +9 -11
- package/config.js +1 -1
- package/kernel.js +1 -1
- package/layers/ParquetLayer.d.ts +7 -1
- package/layers/ParquetLayer.js +1 -1
- package/package.json +2 -2
- package/views/2d/analysis/AreaMeasurement/AreaMeasurementTool.js +1 -1
- package/views/2d/analysis/AreaMeasurementAnalysisView2D.d.ts +2 -0
- package/views/2d/analysis/AreaMeasurementAnalysisView2D.js +1 -1
- package/views/2d/analysis/DistanceMeasurement/DistanceMeasurementTool.js +1 -1
- package/views/2d/analysis/DistanceMeasurementAnalysisView2D.d.ts +2 -0
- package/views/2d/analysis/DistanceMeasurementAnalysisView2D.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/LineShader.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightItemManipulatedObject3D.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightPlacementController.js +1 -1
- package/views/3d/analysis/LineOfSight/lineOfSightPlacementUtils.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedPlacementController.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedPlacementPointPlugin.js +1 -1
- package/views/3d/analysis/Viewshed/placementUtils.js +1 -1
- package/views/3d/interactive/SnappingVisualizer3D.js +1 -1
- package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
- package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +3 -3
- package/views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js +23 -9
- package/views/draw/support/PluginContext.js +1 -1
- package/views/draw/support/managers/TooltipManager.js +1 -1
- package/views/interactive/snapping/SnappingVisualizer.js +1 -1
- package/views/interactive/tooltip/infos/DynamicTooltipInfo.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/Directions.js +1 -1
- package/assets/esri/core/workers/chunks/1f3148cebee1961249a4.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{watch as e}from"../../../../core/reactiveUtils.js";import{castScreenPointArray as t,createScreenPointArray as n}from"../../../../core/screenUtils.js";import{normalize as r,subtract as i,scale as a,set as o,add as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{exactEquals as l,copy as u,normalize as d,subtract as f,add as p}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as m,fromValues as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{exactEquals as g,copy as _}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as v}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeDehydratedPoint as y}from"../../../../layers/graphics/dehydratedPoint.js";import{EngineVisualElement as b}from"./EngineVisualElement.js";import{drapedZ as x}from"../../terrain/DrapedZ.js";import{createPolylineGeometry as S}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderGeometry as C}from"../../webgl-engine/lib/RenderGeometry.js";import{RibbonLineMaterial as w}from"../../webgl-engine/materials/RibbonLineMaterial.js";class T extends b{constructor(e){super(e),this._location=m(),this._direction=h(1,0,0),this._width=1,this._offset=1,this._length=18,this._color=v(1,0,1,1),this._renderOccluded=4,this.applyProperties(e)}createObject3DResourceFactory(e){return{view:e,createResources:e=>this._createObject3DResources(e),destroyResources:O,recreateGeometry:(e,t)=>this._recreateObject3DGeometry(e,t),cameraChanged:()=>this._updateGeometry(),forEachMaterial:(e,t)=>t(e.material)}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:k,recreateGeometry:e=>this._recreateDrapedGeometry(e),forEachMaterial:(e,t)=>t(e.material)}}get location(){return this._location}set location(e){l(this._location,e)||(u(this._location,e),this._updateGeometry())}get direction(){return this._direction}set direction(e){l(this._direction,e)||(u(this._direction,e),this._updateGeometry())}setDirectionFromPoints(e,t){d(this._direction,f(this._direction,t,e)),this._updateGeometry()}get width(){return this._width}set width(e){e!==this._width&&(this._width=e,this._updateMaterial())}get offset(){return this._offset}set offset(e){e!==this._offset&&(this._offset=e,this._updateGeometry())}get length(){return this._length}set length(e){e!==this._length&&(this._length=e,this._updateGeometry())}get color(){return this._color}set color(e){g(e,this._color)||(_(this._color,e),this._updateMaterial())}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateMaterial())}get isDecoration(){return this._isDecoration}set isDecoration(e){this._isDecoration=e,this._updateMaterial()}_createObject3DResources(e){let t=new w(this.materialParameters,this.view.state.isGlobal),n=[];return this._createObject3DGeometry(t,e,n),{material:t,geometries:n}}_recreateObject3DGeometry(e,t){e.geometries.length=0,this._createObject3DGeometry(e.material,t,e.geometries)}_createObject3DGeometry(e,t,n){let[r,i]=E(e);t.addGeometry(r),t.addGeometry(i),n.push(r),n.push(i),this._updateVerticesObject3D(t)}_createDrapedResources(){let t=new w(this.materialParameters,this.view.state.isGlobal),n=e(()=>this.view.state.contentPixelRatio,()=>this.drapedResources.recreateGeometry());return{material:t,geometries:this._createDrapedGeometry(t),pixelRatioHandle:n}}_recreateDrapedGeometry(e){e.geometries=this._createDrapedGeometry(e.material)}_createDrapedGeometry(e){let t=E(e);return this._updateVerticesDraped(t),t.map(e=>new C(e))}_updateMaterial(){let{materialParameters:e}=this;this.object3dResources.resources?.material.setParameters(e),this.drapedResources.resources?.material.setParameters(e)}get materialParameters(){return{width:this._width,color:this._color,renderOccluded:this._renderOccluded,isDecoration:this.isDecoration}}_updateGeometry(){if(this.isDraped)this.drapedResources.recreateGeometry();else{let e=this.object3dResources.object;e&&this._updateVerticesObject3D(e)}}_updateVerticesObject3D(e){let t=this.view.state.camera;t.projectToScreen(this.location,P),p(A,this.location,this.direction),t.projectToScreen(A,F),r(F,i(F,F,P)),this._updateVertexAttributesObject3D(t,e,0,P,F,1),this._updateVertexAttributesObject3D(t,e,1,P,F,-1)}_updateVertexAttributesObject3D(e,n,r,i,a,o){let s=n.geometries[r],c=s.getMutableAttribute(`position`)?.data;if(!c)return;let{start:l,end:u}=D(a,i,o,this.offset,this.width,this.length);e.unprojectFromScreen(t(l),A),c[0]=A[0],c[1]=A[1],c[2]=A[2],e.unprojectFromScreen(t(u),A),c[3]=A[0],c[4]=A[1],c[5]=A[2],n.geometryVertexAttributeUpdated(s,`position`)}_updateVerticesDraped(e){let{view:{overlayManager:t,state:{contentPixelRatio:n}}}=this,{location:r,width:i,length:a,offset:o}=this,s=I;s.spatialReference=t.spatialReference,s.x=r[0],s.y=r[1];let c=this.view.overlayPixelSizeInMapUnits(s)*n,l=i*c,u=a*c,d=o*c;this._updateVertexAttributesDraped(e[0],l,u,d,-1),this._updateVertexAttributesDraped(e[1],l,u,d,1)}_updateVertexAttributesDraped(e,t,n,r,i){let a=e.getMutableAttribute(`position`)?.data;if(!a)return;let{location:o,direction:s}=this,{start:c,end:l}=D(s,o,i,r,t,n);a[0]=c[0],a[1]=c[1],a[2]=x,a[3]=l[0],a[4]=l[1],a[5]=x,e.invalidateBoundingInfo()}}function E(e){return[S(e,[m(),m()]),S(e,[m(),m()])]}function D(e,t,n,r,i,c){let l=a(j,o(j,e[1]*n,e[0]*-n),r+i/2),u=s(M,s(M,s(M,t,a(M,e,c/2)),l),l);return{start:u,end:s(N,u,a(N,e,-c))}}function O(e){e.geometries.length=0}function k(e){e.pixelRatioHandle.remove(),e.geometries=[]}const A=m(),j=c(),M=c(),N=c(),P=n(),F=n(),I=y(0,0,void 0,null);export{T as ParallelLineVisualElement};
|
|
2
|
+
import{watch as e}from"../../../../core/reactiveUtils.js";import{castScreenPointArray as t,createScreenPointArray as n}from"../../../../core/screenUtils.js";import{normalize as r,subtract as i,scale as a,set as o,add as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{exactEquals as l,copy as u,normalize as d,subtract as f,add as p}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as m,fromValues as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{exactEquals as g,copy as _}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as v}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeDehydratedPoint as y}from"../../../../layers/graphics/dehydratedPoint.js";import{EngineVisualElement as b}from"./EngineVisualElement.js";import{drapedZ as x}from"../../terrain/DrapedZ.js";import{createPolylineGeometry as S}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderGeometry as C}from"../../webgl-engine/lib/RenderGeometry.js";import{RibbonLineMaterial as w}from"../../webgl-engine/materials/RibbonLineMaterial.js";class T extends b{constructor(e){super(e),this._location=m(),this._direction=h(1,0,0),this._width=1,this._offset=1,this._length=18,this._color=v(1,0,1,1),this._renderOccluded=4,this._transparentRenderOrder=0,this.applyProperties(e)}createObject3DResourceFactory(e){return{view:e,createResources:e=>this._createObject3DResources(e),destroyResources:O,recreateGeometry:(e,t)=>this._recreateObject3DGeometry(e,t),cameraChanged:()=>this._updateGeometry(),forEachMaterial:(e,t)=>t(e.material)}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:k,recreateGeometry:e=>this._recreateDrapedGeometry(e),forEachMaterial:(e,t)=>t(e.material)}}get location(){return this._location}set location(e){l(this._location,e)||(u(this._location,e),this._updateGeometry())}get direction(){return this._direction}set direction(e){l(this._direction,e)||(u(this._direction,e),this._updateGeometry())}setDirectionFromPoints(e,t){d(this._direction,f(this._direction,t,e)),this._updateGeometry()}get width(){return this._width}set width(e){e!==this._width&&(this._width=e,this._updateMaterial())}get offset(){return this._offset}set offset(e){e!==this._offset&&(this._offset=e,this._updateGeometry())}get length(){return this._length}set length(e){e!==this._length&&(this._length=e,this._updateGeometry())}get color(){return this._color}set color(e){g(e,this._color)||(_(this._color,e),this._updateMaterial())}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateMaterial())}get transparentRenderOrder(){return this._transparentRenderOrder}set transparentRenderOrder(e){e!==this._transparentRenderOrder&&(this._transparentRenderOrder=e,this._updateMaterial())}get isDecoration(){return this._isDecoration}set isDecoration(e){this._isDecoration=e,this._updateMaterial()}_createObject3DResources(e){let t=new w(this.materialParameters,this.view.state.isGlobal),n=[];return this._createObject3DGeometry(t,e,n),{material:t,geometries:n}}_recreateObject3DGeometry(e,t){e.geometries.length=0,this._createObject3DGeometry(e.material,t,e.geometries)}_createObject3DGeometry(e,t,n){let[r,i]=E(e);t.addGeometry(r),t.addGeometry(i),n.push(r),n.push(i),this._updateVerticesObject3D(t)}_createDrapedResources(){let t=new w(this.materialParameters,this.view.state.isGlobal),n=e(()=>this.view.state.contentPixelRatio,()=>this.drapedResources.recreateGeometry());return{material:t,geometries:this._createDrapedGeometry(t),pixelRatioHandle:n}}_recreateDrapedGeometry(e){e.geometries=this._createDrapedGeometry(e.material)}_createDrapedGeometry(e){let t=E(e);return this._updateVerticesDraped(t),t.map(e=>new C(e))}_updateMaterial(){let{materialParameters:e}=this;this.object3dResources.resources?.material.setParameters(e),this.drapedResources.resources?.material.setParameters(e)}get materialParameters(){return{width:this._width,color:this._color,renderOccluded:this._renderOccluded,testsTransparentRenderOrder:this._transparentRenderOrder,isDecoration:this.isDecoration}}_updateGeometry(){if(this.isDraped)this.drapedResources.recreateGeometry();else{let e=this.object3dResources.object;e&&this._updateVerticesObject3D(e)}}_updateVerticesObject3D(e){let t=this.view.state.camera;t.projectToScreen(this.location,P),p(A,this.location,this.direction),t.projectToScreen(A,F),r(F,i(F,F,P)),this._updateVertexAttributesObject3D(t,e,0,P,F,1),this._updateVertexAttributesObject3D(t,e,1,P,F,-1)}_updateVertexAttributesObject3D(e,n,r,i,a,o){let s=n.geometries[r],c=s.getMutableAttribute(`position`)?.data;if(!c)return;let{start:l,end:u}=D(a,i,o,this.offset,this.width,this.length);e.unprojectFromScreen(t(l),A),c[0]=A[0],c[1]=A[1],c[2]=A[2],e.unprojectFromScreen(t(u),A),c[3]=A[0],c[4]=A[1],c[5]=A[2],n.geometryVertexAttributeUpdated(s,`position`)}_updateVerticesDraped(e){let{view:{overlayManager:t,state:{contentPixelRatio:n}}}=this,{location:r,width:i,length:a,offset:o}=this,s=I;s.spatialReference=t.spatialReference,s.x=r[0],s.y=r[1];let c=this.view.overlayPixelSizeInMapUnits(s)*n,l=i*c,u=a*c,d=o*c;this._updateVertexAttributesDraped(e[0],l,u,d,-1),this._updateVertexAttributesDraped(e[1],l,u,d,1)}_updateVertexAttributesDraped(e,t,n,r,i){let a=e.getMutableAttribute(`position`)?.data;if(!a)return;let{location:o,direction:s}=this,{start:c,end:l}=D(s,o,i,r,t,n);a[0]=c[0],a[1]=c[1],a[2]=x,a[3]=l[0],a[4]=l[1],a[5]=x,e.invalidateBoundingInfo()}}function E(e){return[S(e,[m(),m()]),S(e,[m(),m()])]}function D(e,t,n,r,i,c){let l=a(j,o(j,e[1]*n,e[0]*-n),r+i/2),u=s(M,s(M,s(M,t,a(M,e,c/2)),l),l);return{start:u,end:s(N,u,a(N,e,-c))}}function O(e){e.geometries.length=0}function k(e){e.pixelRatioHandle.remove(),e.geometries=[]}const A=m(),j=c(),M=c(),N=c(),P=n(),F=n(),I=y(0,0,void 0,null);export{T as ParallelLineVisualElement};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{watch as e}from"../../../../core/reactiveUtils.js";import{fromTranslation as t,scale as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{distance as i,normalize as a,subtract as o,copy as s,exactEquals as c,add as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as u,ZEROS as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{copy as f}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as p}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{sv3d as m}from"../../../../geometry/support/vectorStacks.js";import{makeDehydratedPoint as h}from"../../../../layers/graphics/dehydratedPoint.js";import{EngineVisualElement as g}from"./EngineVisualElement.js";import{drapedZ as _}from"../../terrain/DrapedZ.js";import{Attribute as v}from"../../webgl-engine/lib/Attribute.js";import{Geometry as y}from"../../webgl-engine/lib/Geometry.js";import{createPolylineGeometry as b}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderGeometry as x}from"../../webgl-engine/lib/RenderGeometry.js";import{ColorMaterial as S}from"../../webgl-engine/materials/ColorMaterial.js";import{RibbonLineMaterial as C}from"../../webgl-engine/materials/RibbonLineMaterial.js";class w extends g{constructor(e){super(e),this._maxSize=0,this._position=u(),this._up=u(),this._right=u(),this._renderOccluded=4,this._color=p(1,0,0,1),this._outlineColor=p(0,0,0,1),this._outlineSize=0,this._size=32,this._outlineRenderOccluded=16,this.applyProperties(e)}createObject3DResourceFactory(e){return{view:e,createResources:e=>this._createObject3DResources(e),destroyResources:()=>{},cameraChanged:()=>this._updateTransformObject3D(),forEachMaterial:(e,t)=>{t(e.outlineMaterial),t(e.quadMaterial)}}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:T,forEachMaterial:(e,t)=>{t(e.outlineMaterial),t(e.quadMaterial)}}}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateQuadMaterial())}get transparentRenderOrder(){return this._transparentRenderOrder}set transparentRenderOrder(e){this._transparentRenderOrder=e,this._updateQuadMaterial()}get isDecoration(){return this._isDecoration}set isDecoration(e){this._isDecoration=e,this._updateOutlineMaterial(),this._updateQuadMaterial()}get color(){return this._color}set color(e){f(this._color,e),this._updateQuadMaterial()}get outlineColor(){return this._outlineColor}set outlineColor(e){f(this._outlineColor,e),this._updateOutlineMaterial()}get outlineSize(){return this._outlineSize}set outlineSize(e){let t=this._outlineSize===0!=(e===0);this._outlineSize=e,t?this.recreateGeometry():this._updateOutlineMaterial()}get size(){return this._size}set size(e){e!==this._size&&(this._size=e,this._updateTransform())}get outlineRenderOccluded(){return this._outlineRenderOccluded}set outlineRenderOccluded(e){this._outlineRenderOccluded=e,this._updateOutlineMaterial()}set geometry({previous:e,center:t,next:n}){this._maxSize=Math.min(i(t,e),i(t,n))/3,a(this._up,o(this._up,e,t)),a(this._right,o(this._right,n,t)),s(this._position,t),this.recreateGeometry()}_createObject3DResources(e){let t=new S(this._quadMaterialParameters),n=this._outlineSize===0?void 0:new C(this._outlineMaterialParameters,this.view.state.isGlobal);return this._createObject3DGeometries(e,t,n),{quadMaterial:t,outlineMaterial:n}}_createObject3DGeometries(e,t,n){if(c(this._up,d)&&c(this._right,d))return;let r=this._createGeometries(t,n);for(let t of r)e.addGeometry(t);this._updateTransformObject3D(e)}_createDrapedResources(){let t=new S(this._quadMaterialParameters),n=this._outlineSize===0?void 0:new C(this._outlineMaterialParameters,this.view.state.isGlobal),r=this._createGeometries(t,n).map(e=>new x(e));return this._setTransformDraped(r),{quadMaterial:t,outlineMaterial:n,geometries:r,pixelRatioHandle:e(()=>this.view.state.contentPixelRatio,()=>this.drapedResources.recreateGeometry())}}_createGeometries(e,t){let{up:n,right:r,corner:i}=this._getVertices(),a=E(n,r,i,e);return t?[a,b(t,[n,i,r])]:[a]}_getVertices(){let e=this._up,t=this._right,n=l(m.get(),e,t);return this.isDraped&&(e=s(m.get(),e),t=s(m.get(),t),e[2]=0,t[2]=0,n[2]=0),{up:e,right:t,corner:n}}_updateTransform(){this.isDraped?this.drapedResources.recreateGeometry():this._updateTransformObject3D()}_updateTransformObject3D(e=this.object3dResources.object){if(!e)return;let r=this.view.state.camera,i=this._size*r.computeScreenPixelSizeAt(this._position),a=Math.min(this._maxSize,i);t(D,this._position),n(D,D,[a,a,a]),e.transformation=D}_setTransformDraped(e){if(e.length===0)return;let{view:{overlayManager:r,state:{contentPixelRatio:i}}}=this,{_position:a,_size:o}=this,c=s(m.get(),a);c[2]=_;let l=O;l.spatialReference=r.spatialReference,l.x=c[0],l.y=c[1];let u=o*(this.view.overlayPixelSizeInMapUnits(l)*i),d=Math.min(this._maxSize,u);t(D,c),n(D,D,[d,d,1]);for(let t of e)t.transformation=D}get _quadMaterialParameters(){return{color:this._color,forceTransparentMode:!0,writeDepth:!1,polygonOffset:1,renderOccluded:this._renderOccluded,isDecoration:this.isDecoration,testsTransparentRenderOrder:this._transparentRenderOrder}}_updateQuadMaterial(){this.object3dResources.resources?.quadMaterial.setParameters(this._quadMaterialParameters),this.drapedResources.resources?.quadMaterial.setParameters(this._quadMaterialParameters)}get _outlineMaterialParameters(){return{color:this._outlineColor,width:this._outlineSize,renderOccluded:this._outlineRenderOccluded,isDecoration:this.isDecoration}}_updateOutlineMaterial(){this.object3dResources.resources?.outlineMaterial?.setParameters(this._outlineMaterialParameters),this.drapedResources.resources?.outlineMaterial?.setParameters(this._outlineMaterialParameters)}}function T(e){e.pixelRatioHandle.remove(),e.geometries=[]}function E(e,t,n,r){return new y(r,[[`position`,new v([0,0,0,...t,...e,...n],[0,1,2,1,2,3],3,!0)]])}const D=r(),O=h(0,0,void 0,null);export{w as RightAngleQuadVisualElement};
|
|
2
|
+
import{watch as e}from"../../../../core/reactiveUtils.js";import{fromTranslation as t,scale as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{distance as i,normalize as a,subtract as o,copy as s,exactEquals as c,add as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as u,ZEROS as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{copy as f}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as p}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{sv3d as m}from"../../../../geometry/support/vectorStacks.js";import{makeDehydratedPoint as h}from"../../../../layers/graphics/dehydratedPoint.js";import{EngineVisualElement as g}from"./EngineVisualElement.js";import{drapedZ as _}from"../../terrain/DrapedZ.js";import{Attribute as v}from"../../webgl-engine/lib/Attribute.js";import{Geometry as y}from"../../webgl-engine/lib/Geometry.js";import{createPolylineGeometry as b}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderGeometry as x}from"../../webgl-engine/lib/RenderGeometry.js";import{ColorMaterial as S}from"../../webgl-engine/materials/ColorMaterial.js";import{RibbonLineMaterial as C}from"../../webgl-engine/materials/RibbonLineMaterial.js";class w extends g{constructor(e){super(e),this._maxSize=0,this._position=u(),this._up=u(),this._right=u(),this._renderOccluded=4,this._color=p(1,0,0,1),this._outlineColor=p(0,0,0,1),this._outlineSize=0,this._size=32,this._outlineRenderOccluded=16,this.applyProperties(e)}createObject3DResourceFactory(e){return{view:e,createResources:e=>this._createObject3DResources(e),destroyResources:()=>{},cameraChanged:()=>this._updateTransformObject3D(),forEachMaterial:(e,t)=>{t(e.outlineMaterial),t(e.quadMaterial)}}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:T,forEachMaterial:(e,t)=>{t(e.outlineMaterial),t(e.quadMaterial)}}}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateQuadMaterial())}get transparentRenderOrder(){return this._transparentRenderOrder}set transparentRenderOrder(e){this._transparentRenderOrder=e,this._updateOutlineMaterial(),this._updateQuadMaterial()}get isDecoration(){return this._isDecoration}set isDecoration(e){this._isDecoration=e,this._updateOutlineMaterial(),this._updateQuadMaterial()}get color(){return this._color}set color(e){f(this._color,e),this._updateQuadMaterial()}get outlineColor(){return this._outlineColor}set outlineColor(e){f(this._outlineColor,e),this._updateOutlineMaterial()}get outlineSize(){return this._outlineSize}set outlineSize(e){let t=this._outlineSize===0!=(e===0);this._outlineSize=e,t?this.recreateGeometry():this._updateOutlineMaterial()}get size(){return this._size}set size(e){e!==this._size&&(this._size=e,this._updateTransform())}get outlineRenderOccluded(){return this._outlineRenderOccluded}set outlineRenderOccluded(e){this._outlineRenderOccluded=e,this._updateOutlineMaterial()}set geometry({previous:e,center:t,next:n}){this._maxSize=Math.min(i(t,e),i(t,n))/3,a(this._up,o(this._up,e,t)),a(this._right,o(this._right,n,t)),s(this._position,t),this.recreateGeometry()}_createObject3DResources(e){let t=new S(this._quadMaterialParameters),n=this._outlineSize===0?void 0:new C(this._outlineMaterialParameters,this.view.state.isGlobal);return this._createObject3DGeometries(e,t,n),{quadMaterial:t,outlineMaterial:n}}_createObject3DGeometries(e,t,n){if(c(this._up,d)&&c(this._right,d))return;let r=this._createGeometries(t,n);for(let t of r)e.addGeometry(t);this._updateTransformObject3D(e)}_createDrapedResources(){let t=new S(this._quadMaterialParameters),n=this._outlineSize===0?void 0:new C(this._outlineMaterialParameters,this.view.state.isGlobal),r=this._createGeometries(t,n).map(e=>new x(e));return this._setTransformDraped(r),{quadMaterial:t,outlineMaterial:n,geometries:r,pixelRatioHandle:e(()=>this.view.state.contentPixelRatio,()=>this.drapedResources.recreateGeometry())}}_createGeometries(e,t){let{up:n,right:r,corner:i}=this._getVertices(),a=E(n,r,i,e);return t?[a,b(t,[n,i,r])]:[a]}_getVertices(){let e=this._up,t=this._right,n=l(m.get(),e,t);return this.isDraped&&(e=s(m.get(),e),t=s(m.get(),t),e[2]=0,t[2]=0,n[2]=0),{up:e,right:t,corner:n}}_updateTransform(){this.isDraped?this.drapedResources.recreateGeometry():this._updateTransformObject3D()}_updateTransformObject3D(e=this.object3dResources.object){if(!e)return;let r=this.view.state.camera,i=this._size*r.computeScreenPixelSizeAt(this._position),a=Math.min(this._maxSize,i);t(D,this._position),n(D,D,[a,a,a]),e.transformation=D}_setTransformDraped(e){if(e.length===0)return;let{view:{overlayManager:r,state:{contentPixelRatio:i}}}=this,{_position:a,_size:o}=this,c=s(m.get(),a);c[2]=_;let l=O;l.spatialReference=r.spatialReference,l.x=c[0],l.y=c[1];let u=o*(this.view.overlayPixelSizeInMapUnits(l)*i),d=Math.min(this._maxSize,u);t(D,c),n(D,D,[d,d,1]);for(let t of e)t.transformation=D}get _quadMaterialParameters(){return{color:this._color,forceTransparentMode:!0,writeDepth:!1,polygonOffset:1,renderOccluded:this._renderOccluded,isDecoration:this.isDecoration,testsTransparentRenderOrder:this._transparentRenderOrder}}_updateQuadMaterial(){this.object3dResources.resources?.quadMaterial.setParameters(this._quadMaterialParameters),this.drapedResources.resources?.quadMaterial.setParameters(this._quadMaterialParameters)}get _outlineMaterialParameters(){return{color:this._outlineColor,width:this._outlineSize,renderOccluded:this._outlineRenderOccluded,testsTransparentRenderOrder:this._transparentRenderOrder,isDecoration:this.isDecoration}}_updateOutlineMaterial(){this.object3dResources.resources?.outlineMaterial?.setParameters(this._outlineMaterialParameters),this.drapedResources.resources?.outlineMaterial?.setParameters(this._outlineMaterialParameters)}}function T(e){e.pixelRatioHandle.remove(),e.geometries=[]}function E(e,t,n,r){return new y(r,[[`position`,new v([0,0,0,...t,...e,...n],[0,1,2,1,2,3],3,!0)]])}const D=r(),O=h(0,0,void 0,null);export{w as RightAngleQuadVisualElement};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import"../../../core/has.js";import t from"../../../core/Logger.js";import{abortMaybe as n,removeMaybe as r,destroyMaybe as i}from"../../../core/maybe.js";import{throwIfAborted as a}from"../../../core/promiseUtils.js";import{watch as o,whenOnce as s,initial as c}from"../../../core/reactiveUtils.js";import{isUint32Array as l}from"../../../core/typedArrayUtil.js";import{unitFromRESTJSON as u,convertUnit as d}from"../../../core/units.js";import{property as f,subclass as p}from"../../../core/accessorSupport/decorators.js";import{fromValues as m}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{getReferenceEllipsoid as h}from"../../../geometry/ellipsoidUtils.js";import g from"../../../geometry/HeightModelInfo.js";import{create as _}from"../../../geometry/support/aaBoundingBox.js";import{isCompatible as v}from"../../../geometry/support/heightModelInfoUtils.js";import{isPlateCarree as y,isWebMercator as b,equals as x,isGeographic as S}from"../../../geometry/support/spatialReferenceUtils.js";import C from"../../../geometry/support/WKIDUnitConversion.js";import{validateEntity3D as w,makeCacheKey as T,getHeightModelInfoFromVCS as E}from"../../../layers/support/tiles3DUtils.js";import{getElevationOffsetInMeters as D}from"../../../support/elevationInfoUtils.js";import{getMetersPerUnit as O}from"../../../symbols/support/unitConversionUtils.js";import{GaussianSplatLayerViewPerformanceInfo as k}from"./GaussianSplatLayerViewPerformanceInfo.js";import{LayerView3D as A}from"./LayerView3D.js";import{addLayerViewToWasm as j,getLyr3DWasm as M,removeLayerViewFromWasm as N}from"./Lyr3DWasm.js";import{LayerElevationProvider as P}from"./i3s/LayerElevationProvider.js";import{ElevationRange as F}from"../support/ElevationRange.js";import{projectToBoundingBox as I}from"../support/extentUtils.js";import{Obb as L}from"../support/orientedBoundingBox.js";import{splatPageSizeInU32 as R,gaussiansPerPage as z,packedGaussianSizeInU32 as B,splatAtlasTextureWidth as V}from"../support/gaussianSplatting/GaussianSplatAtlasPages.js";import{GaussianSplatDataStore as H}from"../support/gaussianSplatting/GaussianSplatDataStore.js";import{GaussianSplatFadeHelper as U}from"../support/gaussianSplatting/GaussianSplatFadeHelper.js";import{GaussianSplatIntersectionHandler as W}from"../support/gaussianSplatting/GaussianSplatIntersectionHandler.js";import{GaussianTile as G}from"../support/gaussianSplatting/GaussianTile.js";import{GaussianSplatDepthRenderer as K}from"../webgl-engine/lib/GaussianSplatDepthRenderer.js";import{GaussianSplatRenderer as q}from"../webgl-engine/lib/GaussianSplatRenderer.js";import{GaussianSplatShadows as J}from"../webgl-engine/lib/GaussianSplatShadows.js";import Y from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as X,isInEffectiveScaleRange as Z}from"../../support/layerViewUtils.js";import{TaskPriority as ee}from"../../support/Scheduler.js";var Q;const te=()=>t.getLogger(`esri.views.3d.layers.GaussianSplatLayerView3D`),ne=(()=>{let e=new Int16Array(256);e[0]=-255;for(let t=1;t<e.length;t++)e[t]=Math.round(16*Math.log(t/255));return e})();let $=class extends A(Y){static{Q=this}static{this.createRenderableBatchSize=64}static{this.uploadBatchPageCount=16}constructor(e){super(e),this.type=`gaussian-splat-3d`,this.ignoresMemoryFactor=!1,this._tileHandles=new Map,this._pageBuffer=new Uint32Array(R*Q.uploadBatchPageCount),this._tmpTilesWithChangedVisibility=[],this._renderablesBeingCreated=new Set,this._currentLyr3dVisibilityChange=0,this._tileFadeInsAwaitingInitialSort=new Map,this._tileFadeOutsAwaitingInitialSort=new Map,this._fadeDurationPerVisibilityChange=new Map,this._tmpSortedTileHandles=new Set,this._createRenderableAbortController=new AbortController,this.skipHeightModelInfoValidation=!0,this._initializationController=null,this._wasmLayerId=-1,this._metersPerVCSUnit=1,this._usedTileMemory=0,this._cacheTileMemory=0,this._useEsriCrs=!1,this.fullExtentInLocalViewSpatialReference=null,this._suspendedHandle=null,this._conversionBuffer=new ArrayBuffer(4),this._u32View=new Uint32Array(this._conversionBuffer),this._f32View=new Float32Array(this._conversionBuffer);let t=e.view.resourceController;this._memCache=t.memoryController.newCache(`GaussianSplat-${this.uid}`,e=>this._deleteTile(e)),this._frameTask=t.scheduler.registerTask(ee.GAUSSIAN_SPLAT_TEXTURE_ATLAS)}get _clippingBox(){if(!this.view?.clippingArea)return null;let e=_();return I(this.view.clippingArea,e,this.view.renderSpatialReference)?e:null}get clippingBox(){return this._renderer?.clippingBox??null}initialize(){let{view:e}=this;this.addHandles([o(()=>e.qualitySettings.fadeDuration,e=>{this.data&&(this.fadeHelper.onFadeDurationChanged(e),this.updateFadingTexture())})]),this.addResolvingPromise(this._initializeAsync(e))}async _initializeAsync(e){this._initializationController=new AbortController;let{signal:t}=this._initializationController;if(await s(()=>e?.defaultsFromMap.heightModelInfoReady,t),a(t),!this._canProjectWithoutEngine())throw X(`layer`,this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);this._wasmLayerId=await j(this,t),a(t),this._renderer=new q({view:e,layerView:this}),this.data=new H(this._renderer,(e,t)=>this._onSortComplete(e,t),()=>this._freeInvisibleTiles()),this._shadows=new J({view:e,layerView:this}),this.fadeHelper=new U(this),this._prepassDepthRenderer=new K({view:e,layerView:this});let n=new W(this);this._intersectionHandler=n,e.sceneIntersectionHelper.addIntersectionHandler(n),this._elevationProvider=new P({view:e,layerElevationSource:this,intersectionHandler:n}),e.elevationProvider.register(2,this._elevationProvider),this.addHandles([o(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),o(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChanged(e),c)]),this._suspendedHandle=o(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),c),this.addHandles([o(()=>this._clippingBox,e=>{this._renderer&&(this._renderer.clippingBox=e)},c),o(()=>this.maximumGaussianCount,e=>this._wasm?.setMaximumGaussianSplatCount(Math.min(e,this.data.textureAtlas.maximumSupportedVisibleGaussians)),c)]),this._initializationController=null}get wasmLayerId(){return this._wasmLayerId}get metersPerVCSUnit(){return this._metersPerVCSUnit}get tileHandles(){return this._tileHandles}updateFadingTexture(){this.data.fadingTexture.updateTexture(this.data.textureAtlas.pageAllocator.pageCount)}get _wasm(){return M(this.view)}get usedMemory(){return this._usedTileMemory+(this.data?.usedMemory??0)}get cachedMemory(){return this._cacheTileMemory}get unloadedMemory(){return 0}get useEsriCrs(){return this._useEsriCrs}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return D(this.layer.elevationInfo)}get elevationRange(){let e=this.fullExtent;return e?.zmin&&e?.zmax?new F(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get fullExtent(){return this.layer.fullExtent}get visibleAtCurrentScale(){return Z(this.layer.effectiveScaleRange,this.view.scale)}isUpdating(){let e=this._wasm;return this._wasmLayerId<0||e==null?!1:e.isUpdating(this._wasmLayerId)||this.data.updating||this.fadeHelper.updating}updatingFlagChanged(){this.notifyChange(`updating`)}async createRenderable(e){if(this.destroyed||this.destroying)throw Error(`IntegratedMesh3DTilesLayerView3D: createRenderable called after destroy`);let{entity3d:t}=e;if(!w(t))throw Error(`entity3D not valid`);let n=t.desc.geometry.prims[t.validPrimitiveIndices[0]].atrbs[0],r=t.assets[n.assetId];if(!r)throw Error(`entity3D not valid`);let i=r.count;if(i===0)return te().warnOnce(`encountered tile with zero Gaussians`),()=>({memUsageBytes:0,numGaussians:0});let a=null;if(r.dataType===`U32`&&l(r.data))a=r.data;else throw Error(`unexpected GaussianSplat Entity3D asset.data format`);let o=this.extractHeader(a),s=2.048,c=o.tileOrigin.x*s,u=o.tileOrigin.y*s,d=o.tileOrigin.z*s,f=t.desc,p=f.obb.quaternion,g=new L(f.obb.center,f.obb.halfSize,m(...p)),_=this.view.state.isGlobal,v=_?h(this.view.spatialReference).radius:0,y={handle:e.handle,bufferView:a,totalGaussians:i,packedHeader:o.packedHeader,tileOrigin:{x:c,y:u,z:d},invPosScale:o.invPosScale,obb:g,origin:{x:g.centerX,y:g.centerY,z:g.centerZ},isGlobal:_,ellipsoidRadius:v};this._renderablesBeingCreated.add(e.handle);let b;try{b=await this._frameTask.scheduleGenerator(e=>this._createRenderableTask(y,e),this._createRenderableAbortController.signal)}catch(t){throw this._renderablesBeingCreated.delete(e.handle),t}return this._renderablesBeingCreated.delete(e.handle),()=>b}*_createRenderableTask(e,t){let{handle:n,bufferView:r,totalGaussians:i,packedHeader:a,tileOrigin:o,invPosScale:s,obb:c,origin:l,isGlobal:u,ellipsoidRadius:d}=e,f=o.x,p=o.y,m=o.z,h=l.x,g=l.y,_=l.z,v=new Float32Array(i*3),y=new Uint32Array(i),b=new Uint32Array(i),x=[],S=Math.ceil(i/z),C=1/0,w=-1/0,T=1/0,E=-1/0,D=0,O=-1,k=0,A=0;for(let e=0;e<i;e++){let n=e*B,i=r[n],a=r[n+1],o=r[n+2],c=r[n+3],l=a&16383,d=a>>>14&16383,x=a>>>28&15|(o&1023)<<4,S=c>>>24,j=ne[S],M=(o>>>10&255)+j,N=(o>>>18&255)+j,P=(o>>>26&63|(c&3)<<6)+j,F=M>0?M:0,I=N>0?N:0,L=P>0?P:0,R=F|I<<8|L<<16,z=Math.max(F,I,L),V=l*s+f,H=d*s+p,U=x*s+m;if(v[D]=V-h,v[D+1]=H-g,v[D+2]=U-_,u){let e=V*V+H*H+U*U;T=Math.min(T,e),E=Math.max(E,e)}else C=Math.min(C,U),w=Math.max(w,U);y[e]=i,b[e]=R,z>O&&(O=z),S>k&&(k=S),D+=3,A++,A===Q.createRenderableBatchSize&&(A=0,t.madeProgress()&&(t=yield))}A>0&&t.madeProgress()&&(t=yield),u&&(C=Math.sqrt(T)-d,w=Math.sqrt(E)-d);let j=this._extractGaussianSplatMbsRadiusSquared(O),{fullExtent:M}=this.layer;M?.hasZ&&M.zmax&&M.zmin&&(C=Math.max(C,M.zmin),w=Math.min(w,M.zmax));let N=new F(C,w),P=this.data.textureAtlas,I=this.data.headerTexture;try{for(let e=0;e<S;e+=Q.uploadBatchPageCount){let n=Math.min(S,e+Q.uploadBatchPageCount);for(let t=e;t<n;t++){let e=P.allocatePage();if(e===null&&(this._freeInvisibleTiles(),e=P.allocatePage()),e===null)throw Error(`ran out of gaussian splat memory`);x.push(e)}for(let t=e;t<n;){let e=x[t],o=t+1;for(;o<n&&x[o]===x[o-1]+1;)o++;let s=o-t,c=i-t*z,l=Math.min(c,s*z),u=t*R,d=l*B;this._pageBuffer.set(r.subarray(u,u+d));let f=e*z,p=f%V,m=Math.floor(f/V);P.update(p,m,this._pageBuffer,s),I.update(e,a,s),t=o}t.madeProgress()&&(t=yield)}}catch(e){throw P.freePages(x),e}let L=new G(n,c,x,v,y,b,i,j,k/255,N);return this._tileHandles.set(n,L),this._cacheTileMemory+=L.usedMemory,this._memCache.put(`${L.handle}`,L),{memUsageBytes:L.usedMemory,numGaussians:i}}_extractGaussianSplatMbsRadiusSquared(e){return Math.exp(e/8-20)*9}freeRenderable(e){this._tileFadeInsAwaitingInitialSort.delete(e),this._tileFadeOutsAwaitingInitialSort.delete(e);let t=this.data?.textureAtlas,n=!1,r=this._tileHandles.get(e);r&&(r.lifecycleState===0?this._cacheTileMemory-=r.usedMemory:(n=!0,this.fadeHelper.onTileDiscarded(r),this._usedTileMemory-=r.usedMemory,this._intersectionHandler.removeTile(r)),t&&r.pageIds.forEach(e=>t.freePage(e)),this.freeObject(r),this._tileHandles.delete(e)),n&&this.updateGaussians()}freeObject(e){this._memCache.pop(`${e.handle}`)}notifyTileObbsChanged(e){this._elevationProvider&&this._elevationProvider.notifyObjectsChangedFunctional(e.length,t=>{for(let{obb:n}of e)if(!t(n))break})}setRenderableVisibility(e,t,n){let r=this._currentLyr3dVisibilityChange+1,i=this.fadeHelper.updateFadeDuration();this._fadeDurationPerVisibilityChange.set(r,i);let a=!1;for(let o=0;o<n;o++){let n=this._tileHandles.get(e[o]);if(!n)continue;let s=t[o]?this._prepareTileFadeIn(n,r,i):this._prepareTileFadeOut(n,r);a||=s}a?(this._currentLyr3dVisibilityChange=r,this.updateGaussians()):this._fadeDurationPerVisibilityChange.delete(r)}_prepareTileFadeIn(e,t,n){let r=this._tileFadeOutsAwaitingInitialSort.delete(e.handle);return e.lifecycleState===2?(this.fadeHelper.fadeTile(e,0,n),!1):this._tileFadeInsAwaitingInitialSort.get(e.handle)===t?r:(e.lifecycleState===0&&this._popTileFromCache(e),e.lifecycleState=1,this._tileFadeInsAwaitingInitialSort.set(e.handle,t),!0)}_prepareTileFadeOut(e,t){let n=this._tileFadeInsAwaitingInitialSort.delete(e.handle);return n&&e.lifecycleState===1&&(this.moveTileToCache(e),e.lifecycleState=0),e.lifecycleState===2?this._tileFadeOutsAwaitingInitialSort.get(e.handle)===t?n:(this._tileFadeOutsAwaitingInitialSort.set(e.handle,t),!0):n}_onSortComplete(e,t){let n=this._tmpTilesWithChangedVisibility;n.length=0;let r=this._tmpSortedTileHandles;r.clear();for(let t=0;t<e.length;t++){let n=e[t];r.add(n.handle)}this._triggerFadeIns(t,r,n);let i=this._triggerFadeOuts(t,n);r.clear(),n.length>0&&this.notifyTileObbsChanged(n),i&&this.updateGaussians(),this._cleanupVisibilityChangeFadeDurations(t)}_triggerFadeIns(e,t,n){for(let[r,i]of this._tileFadeInsAwaitingInitialSort){if(i>e||!t.has(r))continue;let a=this._tileHandles.get(r);if(!a){this._tileFadeInsAwaitingInitialSort.delete(r);continue}let o=this._getFadeDurationForPendingVisibilityChange(i),s=a.lifecycleState===0;a.lifecycleState!==2&&(a.lifecycleState=2,s&&this._popTileFromCache(a),n.push(a)),this.fadeHelper.fadeTile(a,0,o),this._tileFadeInsAwaitingInitialSort.delete(r)}}_triggerFadeOuts(e,t){let n=!1;for(let[r,i]of this._tileFadeOutsAwaitingInitialSort){if(i>e)continue;let a=this._tileHandles.get(r);if(a){let e=a.lifecycleState===2,r=this._getFadeDurationForPendingVisibilityChange(i);this.fadeHelper.fadeTile(a,1,r),e&&a.lifecycleState===0&&(t.push(a),n=!0)}this._tileFadeOutsAwaitingInitialSort.delete(r)}return n}_getFadeDurationForPendingVisibilityChange(e){return this._fadeDurationPerVisibilityChange.get(e)??this.fadeHelper.baseFadeDuration}_cleanupVisibilityChangeFadeDurations(e){if(this._fadeDurationPerVisibilityChange.size!==0)for(let t of this._fadeDurationPerVisibilityChange.keys())t<=e&&this._fadeDurationPerVisibilityChange.delete(t)}_popTileFromCache(e){this._usedTileMemory+=e.usedMemory,this._cacheTileMemory-=e.usedMemory,this._intersectionHandler.addTile(e),this._memCache.pop(T(e.handle))}moveTileToCache(e){this._usedTileMemory-=e.usedMemory,this._cacheTileMemory+=e.usedMemory,this._intersectionHandler.removeTile(e),this._memCache.put(T(e.handle),e)}destroy(){this._initializationController=n(this._initializationController),this._createRenderableAbortController.abort(),N(this),this._suspendedHandle&&=r(this._suspendedHandle),this._intersectionHandler&&=(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),null),this._elevationProvider&&this.view.elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(this._tileHandles.size,e=>{for(let{obb:t}of this._tileHandles.values())if(!e(t))break}),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._frameTask.remove(),this._shadows=i(this._shadows),this._prepassDepthRenderer=i(this._prepassDepthRenderer),this._renderer=i(this._renderer),this._memCache.destroy(),this.data=i(this.data)}_canProjectWithoutEngine(){if(this.view.state.viewingMode===1||y(this.view.renderSpatialReference)||b(this.view.renderSpatialReference))return!0;if(this.layer.esriCrsSpatialReference&&x(this.layer.esriCrsSpatialReference,this.view.renderSpatialReference)){if(this.layer.esriCrsSpatialReference.vcsWkid===115700)return!1;let e=E(this.layer.esriCrsSpatialReference);if(!e){let t=this.layer.esriCrsSpatialReference,n=S(t),r=`meters`;!n&&t.wkid&&t.wkid!==-1&&(r=u(C.units[C[t.wkid]])),r&&(e=new g({heightModel:`gravity-related-height`,heightUnit:r}))}let t=this.view.heightModelInfo;return this._useEsriCrs=v(e,t,!1)===0,this._useEsriCrs&&(e&&(this._metersPerVCSUnit=d(1,e.heightUnit,`meters`)),this.fullExtentInLocalViewSpatialReference=this.layer.esriCrsFullExtent),this._useEsriCrs}return!1}_elevationInfoChanged(e){if(!e?.offset)this._wasm?.setLayerOffset(this,0);else if(!this._useEsriCrs)this._wasm?.setLayerOffset(this,D(e));else{let t=O(e?.unit)/this._metersPerVCSUnit,n=e?.offset??0;this._wasm?.setLayerOffset(this,n*t)}}_slicePlaneEnabledChanged(e){this._renderer&&(this._renderer.slicePlaneEnabled=e),this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e)}updateGaussians(){let e=[];for(let t of this._tileHandles.values())t.lifecycleState!==0&&e.push(t);this.data.updateGaussianVisibility(e,this._currentLyr3dVisibilityChange),this.notifyChange(`updating`)}get maximumGaussianCount(){return this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians*this.view.quality}set maximumGaussianCount(e){this._set(`maximumGaussianCount`,e)}_freeInvisibleTiles(){for(let e of this._tileHandles.values())e.lifecycleState===0&&!this._renderablesBeingCreated.has(e.handle)&&this._deleteTile(e)}extractHeader(e){let t=e.length-4,n=this.reinterpretU32AsFloat(e[t]),r=this.reinterpretU32AsFloat(e[t+1]),i=this.reinterpretU32AsFloat(e[t+2]),a=1/(1<<(e[t+3]&255));return{packedHeader:e.subarray(t,t+4),tileOrigin:{x:n,y:r,z:i},invPosScale:a}}_deleteTile(e){this._renderablesBeingCreated.has(e.handle)||this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}reinterpretU32AsFloat(e){return this._u32View[0]=e,this._f32View[0]}get performanceInfo(){let e=0,t=0;this._tileHandles.forEach(n=>{n.lifecycleState===0?t++:e++});let n=this.data?.textureAtlasMemory??0,r=this.data?.headerTextureMemory??0,i=this.data?.orderTextureMemory??0,a=this.data?.fadingTextureMemory??0,o=this.data?.sortBufferMemory??0;return new k(this.usedMemory,e,this._usedTileMemory,t,this._cacheTileMemory,n,r,i,a,o)}get test(){}};e([f()],$.prototype,`layer`,void 0),e([f({readOnly:!0})],$.prototype,`_clippingBox`,null),e([f()],$.prototype,`elevationOffset`,null),e([f({readOnly:!0})],$.prototype,`visibleAtCurrentScale`,null),e([f()],$.prototype,`fullExtentInLocalViewSpatialReference`,void 0),e([f()],$.prototype,`maximumGaussianCount`,null),$=Q=e([p(`esri.views.3d.layers.GaussianSplatLayerView3D`)],$);const re=$;export{re as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import"../../../core/has.js";import t from"../../../core/Logger.js";import{abortMaybe as n,removeMaybe as r,destroyMaybe as i}from"../../../core/maybe.js";import{throwIfAborted as a}from"../../../core/promiseUtils.js";import{watch as o,whenOnce as s,initial as c}from"../../../core/reactiveUtils.js";import{Milliseconds as l}from"../../../core/time.js";import{isUint32Array as u}from"../../../core/typedArrayUtil.js";import{unitFromRESTJSON as d,convertUnit as f}from"../../../core/units.js";import{property as p,subclass as m}from"../../../core/accessorSupport/decorators.js";import{fromValues as h}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{getReferenceEllipsoid as g}from"../../../geometry/ellipsoidUtils.js";import _ from"../../../geometry/HeightModelInfo.js";import{create as v}from"../../../geometry/support/aaBoundingBox.js";import{isCompatible as y}from"../../../geometry/support/heightModelInfoUtils.js";import{isPlateCarree as b,isWebMercator as x,equals as S,isGeographic as C}from"../../../geometry/support/spatialReferenceUtils.js";import w from"../../../geometry/support/WKIDUnitConversion.js";import{validateEntity3D as T,makeCacheKey as E,getHeightModelInfoFromVCS as D}from"../../../layers/support/tiles3DUtils.js";import{getElevationOffsetInMeters as O}from"../../../support/elevationInfoUtils.js";import{getMetersPerUnit as k}from"../../../symbols/support/unitConversionUtils.js";import{GaussianSplatLayerViewPerformanceInfo as A}from"./GaussianSplatLayerViewPerformanceInfo.js";import{LayerView3D as j}from"./LayerView3D.js";import{addLayerViewToWasm as M,getLyr3DWasm as N,removeLayerViewFromWasm as P}from"./Lyr3DWasm.js";import{LayerElevationProvider as F}from"./i3s/LayerElevationProvider.js";import{ElevationRange as I}from"../support/ElevationRange.js";import{projectToBoundingBox as L}from"../support/extentUtils.js";import{Obb as R}from"../support/orientedBoundingBox.js";import{splatPageSizeInU32 as z,gaussiansPerPage as B,packedGaussianSizeInU32 as V,splatAtlasTextureWidth as H}from"../support/gaussianSplatting/GaussianSplatAtlasPages.js";import{GaussianSplatDataStore as U}from"../support/gaussianSplatting/GaussianSplatDataStore.js";import{GaussianSplatFadeHelper as W}from"../support/gaussianSplatting/GaussianSplatFadeHelper.js";import{GaussianSplatIntersectionHandler as G}from"../support/gaussianSplatting/GaussianSplatIntersectionHandler.js";import{GaussianTile as K}from"../support/gaussianSplatting/GaussianTile.js";import{GaussianSplatDepthRenderer as q}from"../webgl-engine/lib/GaussianSplatDepthRenderer.js";import{GaussianSplatRenderer as J}from"../webgl-engine/lib/GaussianSplatRenderer.js";import{GaussianSplatShadows as Y}from"../webgl-engine/lib/GaussianSplatShadows.js";import X from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as Z,isInEffectiveScaleRange as ee}from"../../support/layerViewUtils.js";import{TaskPriority as te}from"../../support/Scheduler.js";var Q;const ne=()=>t.getLogger(`esri.views.3d.layers.GaussianSplatLayerView3D`),re=(()=>{let e=new Int16Array(256);e[0]=-255;for(let t=1;t<e.length;t++)e[t]=Math.round(16*Math.log(t/255));return e})();let $=class extends j(X){static{Q=this}static{this.createRenderableBatchSize=64}static{this.uploadBatchPageCount=16}constructor(e){super(e),this.type=`gaussian-splat-3d`,this.ignoresMemoryFactor=!1,this._tileHandles=new Map,this._pageBuffer=new Uint32Array(z*Q.uploadBatchPageCount),this._tmpTilesWithChangedVisibility=[],this._renderablesBeingCreated=new Set,this._currentLyr3dVisibilityChange=0,this._tileFadeInsAwaitingInitialSort=new Set,this._pendingTileFadeOuts=new Map,this._pendingFadeDuration=l(0),this._createRenderableAbortController=new AbortController,this.skipHeightModelInfoValidation=!0,this._initializationController=null,this._wasmLayerId=-1,this._metersPerVCSUnit=1,this._usedTileMemory=0,this._cacheTileMemory=0,this._useEsriCrs=!1,this.fullExtentInLocalViewSpatialReference=null,this._suspendedHandle=null,this._conversionBuffer=new ArrayBuffer(4),this._u32View=new Uint32Array(this._conversionBuffer),this._f32View=new Float32Array(this._conversionBuffer);let t=e.view.resourceController;this._memCache=t.memoryController.newCache(`GaussianSplat-${this.uid}`,e=>this._deleteTile(e)),this._frameTask=t.scheduler.registerTask(te.GAUSSIAN_SPLAT_TEXTURE_ATLAS)}get _clippingBox(){if(!this.view?.clippingArea)return null;let e=v();return L(this.view.clippingArea,e,this.view.renderSpatialReference)?e:null}get clippingBox(){return this._renderer?.clippingBox??null}initialize(){let{view:e}=this;this.addHandles([o(()=>e.qualitySettings.fadeDuration,e=>{this.data&&(this.fadeHelper.onFadeDurationChanged(e),this.updateFadingTexture())})]),this.addResolvingPromise(this._initializeAsync(e))}async _initializeAsync(e){this._initializationController=new AbortController;let{signal:t}=this._initializationController;if(await s(()=>e?.defaultsFromMap.heightModelInfoReady,t),a(t),!this._canProjectWithoutEngine())throw Z(`layer`,this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);this._wasmLayerId=await M(this,t),a(t),this._renderer=new J({view:e,layerView:this}),this.data=new U(this._renderer,(e,t)=>this._onSortComplete(e,t),()=>this._freeInvisibleTiles()),this._shadows=new Y({view:e,layerView:this}),this.fadeHelper=new W(this),this._prepassDepthRenderer=new q({view:e,layerView:this});let n=new G(this);this._intersectionHandler=n,e.sceneIntersectionHelper.addIntersectionHandler(n),this._elevationProvider=new F({view:e,layerElevationSource:this,intersectionHandler:n}),e.elevationProvider.register(2,this._elevationProvider),this.addHandles([o(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),o(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChanged(e),c)]),this._suspendedHandle=o(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),c),this.addHandles([o(()=>this._clippingBox,e=>{this._renderer&&(this._renderer.clippingBox=e)},c),o(()=>this.maximumGaussianCount,e=>this._wasm?.setMaximumGaussianSplatCount(Math.min(e,this.data.textureAtlas.maximumSupportedVisibleGaussians)),c)]),this._initializationController=null}get wasmLayerId(){return this._wasmLayerId}get metersPerVCSUnit(){return this._metersPerVCSUnit}get tileHandles(){return this._tileHandles}updateFadingTexture(){this.data.fadingTexture.updateTexture(this.data.textureAtlas.pageAllocator.pageCount)}get _wasm(){return N(this.view)}get usedMemory(){return this._usedTileMemory+(this.data?.usedMemory??0)}get cachedMemory(){return this._cacheTileMemory}get unloadedMemory(){return 0}get useEsriCrs(){return this._useEsriCrs}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return O(this.layer.elevationInfo)}get elevationRange(){let e=this.fullExtent;return e?.zmin&&e?.zmax?new I(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get fullExtent(){return this.layer.fullExtent}get visibleAtCurrentScale(){return ee(this.layer.effectiveScaleRange,this.view.scale)}isUpdating(){let e=this._wasm;return this._wasmLayerId<0||e==null?!1:e.isUpdating(this._wasmLayerId)||this.data.updating||this.fadeHelper.updating}updatingFlagChanged(){this.notifyChange(`updating`)}async createRenderable(e){if(this.destroyed||this.destroying)throw Error(`IntegratedMesh3DTilesLayerView3D: createRenderable called after destroy`);let{entity3d:t}=e;if(!T(t))throw Error(`entity3D not valid`);let n=t.desc.geometry.prims[t.validPrimitiveIndices[0]].atrbs[0],r=t.assets[n.assetId];if(!r)throw Error(`entity3D not valid`);let i=r.count;if(i===0)return ne().warnOnce(`encountered tile with zero Gaussians`),()=>({memUsageBytes:0,numGaussians:0});let a=null;if(r.dataType===`U32`&&u(r.data))a=r.data;else throw Error(`unexpected GaussianSplat Entity3D asset.data format`);let o=this.extractHeader(a),s=2.048,c=o.tileOrigin.x*s,l=o.tileOrigin.y*s,d=o.tileOrigin.z*s,f=t.desc,p=f.obb.quaternion,m=new R(f.obb.center,f.obb.halfSize,h(...p)),_=this.view.state.isGlobal,v=_?g(this.view.spatialReference).radius:0,y={handle:e.handle,bufferView:a,totalGaussians:i,packedHeader:o.packedHeader,tileOrigin:{x:c,y:l,z:d},invPosScale:o.invPosScale,obb:m,origin:{x:m.centerX,y:m.centerY,z:m.centerZ},isGlobal:_,ellipsoidRadius:v};this._renderablesBeingCreated.add(e.handle);let b;try{b=await this._frameTask.scheduleGenerator(e=>this._createRenderableTask(y,e),this._createRenderableAbortController.signal)}catch(t){throw this._renderablesBeingCreated.delete(e.handle),t}return this._renderablesBeingCreated.delete(e.handle),()=>b}*_createRenderableTask(e,t){let{handle:n,bufferView:r,totalGaussians:i,packedHeader:a,tileOrigin:o,invPosScale:s,obb:c,origin:l,isGlobal:u,ellipsoidRadius:d}=e,f=o.x,p=o.y,m=o.z,h=l.x,g=l.y,_=l.z,v=new Float32Array(i*3),y=new Uint32Array(i),b=new Uint32Array(i),x=[],S=Math.ceil(i/B),C=1/0,w=-1/0,T=1/0,E=-1/0,D=0,O=-1,k=0,A=0;for(let e=0;e<i;e++){let n=e*V,i=r[n],a=r[n+1],o=r[n+2],c=r[n+3],l=a&16383,d=a>>>14&16383,x=a>>>28&15|(o&1023)<<4,S=c>>>24,j=re[S],M=(o>>>10&255)+j,N=(o>>>18&255)+j,P=(o>>>26&63|(c&3)<<6)+j,F=M>0?M:0,I=N>0?N:0,L=P>0?P:0,R=F|I<<8|L<<16,z=Math.max(F,I,L),B=l*s+f,H=d*s+p,U=x*s+m;if(v[D]=B-h,v[D+1]=H-g,v[D+2]=U-_,u){let e=B*B+H*H+U*U;T=Math.min(T,e),E=Math.max(E,e)}else C=Math.min(C,U),w=Math.max(w,U);y[e]=i,b[e]=R,z>O&&(O=z),S>k&&(k=S),D+=3,A++,A===Q.createRenderableBatchSize&&(A=0,t.madeProgress()&&(t=yield))}A>0&&t.madeProgress()&&(t=yield),u&&(C=Math.sqrt(T)-d,w=Math.sqrt(E)-d);let j=this._extractGaussianSplatMbsRadiusSquared(O),{fullExtent:M}=this.layer;M?.hasZ&&M.zmax&&M.zmin&&(C=Math.max(C,M.zmin),w=Math.min(w,M.zmax));let N=new I(C,w),P=this.data.textureAtlas,F=this.data.headerTexture;try{for(let e=0;e<S;e+=Q.uploadBatchPageCount){let n=Math.min(S,e+Q.uploadBatchPageCount);for(let t=e;t<n;t++){let e=P.allocatePage();if(e===null&&(this._freeInvisibleTiles(),e=P.allocatePage()),e===null)throw Error(`ran out of gaussian splat memory`);x.push(e)}for(let t=e;t<n;){let e=x[t],o=t+1;for(;o<n&&x[o]===x[o-1]+1;)o++;let s=o-t,c=i-t*B,l=Math.min(c,s*B),u=t*z,d=l*V;this._pageBuffer.set(r.subarray(u,u+d));let f=e*B,p=f%H,m=Math.floor(f/H);P.update(p,m,this._pageBuffer,s),F.update(e,a,s),t=o}t.madeProgress()&&(t=yield)}}catch(e){throw P.freePages(x),e}let L=new K(n,c,x,v,y,b,i,j,k/255,N);return this._tileHandles.set(n,L),this._cacheTileMemory+=L.usedMemory,this._memCache.put(`${L.handle}`,L),{memUsageBytes:L.usedMemory,numGaussians:i}}_extractGaussianSplatMbsRadiusSquared(e){return Math.exp(e/8-20)*9}freeRenderable(e){this._tileFadeInsAwaitingInitialSort.delete(e),this._pendingTileFadeOuts.delete(e);let t=this.data?.textureAtlas,n=!1,r=this._tileHandles.get(e);if(r){let i=!1;for(let t of this._pendingTileFadeOuts.values())t.incomingTileHandles.has(e)&&(t.visibilityChange=this._currentLyr3dVisibilityChange+1,i=!0);i&&(this._currentLyr3dVisibilityChange++,n=!0),r.lifecycleState===0?this._cacheTileMemory-=r.usedMemory:(n=!0,this.fadeHelper.onTileDiscarded(r),this._usedTileMemory-=r.usedMemory,this._intersectionHandler.removeTile(r)),t&&r.pageIds.forEach(e=>t.freePage(e)),this.freeObject(r),this._tileHandles.delete(e)}n&&this.updateGaussians()}freeObject(e){this._memCache.pop(`${e.handle}`)}notifyTileObbsChanged(e){this._elevationProvider&&this._elevationProvider.notifyObjectsChangedFunctional(e.length,t=>{for(let{obb:n}of e)if(!t(n))break})}setRenderableVisibility(e,t,n){let r=this.fadeHelper.updateFadeDuration(),i=new ie(this._currentLyr3dVisibilityChange+1),a=new Set,o=!1;for(let s=0;s<n;s++){let n=this._tileHandles.get(e[s]);if(!n)continue;let c=t[s]?this._prepareTileFadeIn(n,r):this._prepareTileFadeOut(n,i);t[s]&&i.incomingTileHandles.add(n.handle),c&&a.add(n.handle),o||=c}if(o){if(this._currentLyr3dVisibilityChange++,this._pendingFadeDuration=r,this._updatePendingTileHandoffs(a,i),i.incomingTileHandles.size===0)for(let e of this._tileFadeInsAwaitingInitialSort)i.incomingTileHandles.add(e);this.updateGaussians()}}_updatePendingTileHandoffs(e,t){for(let n of new Set(this._pendingTileFadeOuts.values())){if(n===t)continue;let r=!1;for(let i of e)n.incomingTileHandles.has(i)&&(r=!0,t.incomingTileHandles.size>0&&n.incomingTileHandles.delete(i));if(r){n.visibilityChange=t.visibilityChange;for(let e of t.incomingTileHandles)n.incomingTileHandles.add(e)}}}_prepareTileFadeIn(e,t){let n=this._pendingTileFadeOuts.delete(e.handle);return e.lifecycleState===2?(this.fadeHelper.fadeTile(e,0,t),!1):this._tileFadeInsAwaitingInitialSort.has(e.handle)?n:(e.lifecycleState===0&&this._popTileFromCache(e),e.lifecycleState=1,this._tileFadeInsAwaitingInitialSort.add(e.handle),!0)}_prepareTileFadeOut(e,t){let n=this._tileFadeInsAwaitingInitialSort.delete(e.handle);return n&&e.lifecycleState===1&&(this.moveTileToCache(e),e.lifecycleState=0),e.lifecycleState===2?this._pendingTileFadeOuts.has(e.handle)?n:(this._pendingTileFadeOuts.set(e.handle,t),!0):n}_onSortComplete(e,t){let n=this._tmpTilesWithChangedVisibility;n.length=0,this._triggerFadeIns(e,n);let r=this._triggerFadeOuts(t,n);n.length>0&&this.notifyTileObbsChanged(n),r&&this.updateGaussians()}_triggerFadeIns(e,t){for(let n of e)this._tileHandles.get(n.handle)===n&&this._tileFadeInsAwaitingInitialSort.delete(n.handle)&&(n.lifecycleState=2,t.push(n),this.fadeHelper.fadeTile(n,0,this._pendingFadeDuration))}_triggerFadeOuts(e,t){let n=!1;for(let t of this._pendingTileFadeOuts.values())if(e>=t.visibilityChange){n=!0;break}if(!n)return!1;let r=this._pendingFadeDuration,i=this._pendingFadeDuration;for(let e of this._tileHandles.values()){let{fadeDirection:t,fadeDuration:n,fadeProgress:a}=e;if(t!==0||n==null||a==null)continue;let o=n*(1-a);r=l(Math.max(r,o)),i=l(Math.max(i,n))}let a=!1;for(let[n,o]of this._pendingTileFadeOuts){if(e<o.visibilityChange)continue;this._pendingTileFadeOuts.delete(n);let s=this._tileHandles.get(n);if(s){let e=s.lifecycleState===2,n=s.opacityModifier===1?r:i;this.fadeHelper.fadeTile(s,1,n),e&&s.lifecycleState===0&&(t.push(s),a=!0)}}return a}_popTileFromCache(e){this._usedTileMemory+=e.usedMemory,this._cacheTileMemory-=e.usedMemory,this._intersectionHandler.addTile(e),this._memCache.pop(E(e.handle))}moveTileToCache(e){this._usedTileMemory-=e.usedMemory,this._cacheTileMemory+=e.usedMemory,this._intersectionHandler.removeTile(e),this._memCache.put(E(e.handle),e)}destroy(){this._initializationController=n(this._initializationController),this._createRenderableAbortController.abort(),P(this),this._suspendedHandle&&=r(this._suspendedHandle),this._intersectionHandler&&=(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),null),this._elevationProvider&&this.view.elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(this._tileHandles.size,e=>{for(let{obb:t}of this._tileHandles.values())if(!e(t))break}),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._frameTask.remove(),this._shadows=i(this._shadows),this._prepassDepthRenderer=i(this._prepassDepthRenderer),this._renderer=i(this._renderer),this._memCache.destroy(),this.data=i(this.data)}_canProjectWithoutEngine(){if(this.view.state.viewingMode===1||b(this.view.renderSpatialReference)||x(this.view.renderSpatialReference))return!0;if(this.layer.esriCrsSpatialReference&&S(this.layer.esriCrsSpatialReference,this.view.renderSpatialReference)){if(this.layer.esriCrsSpatialReference.vcsWkid===115700)return!1;let e=D(this.layer.esriCrsSpatialReference);if(!e){let t=this.layer.esriCrsSpatialReference,n=C(t),r=`meters`;!n&&t.wkid&&t.wkid!==-1&&(r=d(w.units[w[t.wkid]])),r&&(e=new _({heightModel:`gravity-related-height`,heightUnit:r}))}let t=this.view.heightModelInfo;return this._useEsriCrs=y(e,t,!1)===0,this._useEsriCrs&&(e&&(this._metersPerVCSUnit=f(1,e.heightUnit,`meters`)),this.fullExtentInLocalViewSpatialReference=this.layer.esriCrsFullExtent),this._useEsriCrs}return!1}_elevationInfoChanged(e){if(!e?.offset)this._wasm?.setLayerOffset(this,0);else if(!this._useEsriCrs)this._wasm?.setLayerOffset(this,O(e));else{let t=k(e?.unit)/this._metersPerVCSUnit,n=e?.offset??0;this._wasm?.setLayerOffset(this,n*t)}}_slicePlaneEnabledChanged(e){this._renderer&&(this._renderer.slicePlaneEnabled=e),this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e)}updateGaussians(){let e=[];for(let t of this._tileHandles.values())t.lifecycleState!==0&&e.push(t);this.data.updateGaussianVisibility(e,this._currentLyr3dVisibilityChange),this.notifyChange(`updating`)}get maximumGaussianCount(){return this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians*this.view.quality}set maximumGaussianCount(e){this._set(`maximumGaussianCount`,e)}_freeInvisibleTiles(){for(let e of this._tileHandles.values())e.lifecycleState===0&&!this._renderablesBeingCreated.has(e.handle)&&this._deleteTile(e)}extractHeader(e){let t=e.length-4,n=this.reinterpretU32AsFloat(e[t]),r=this.reinterpretU32AsFloat(e[t+1]),i=this.reinterpretU32AsFloat(e[t+2]),a=1/(1<<(e[t+3]&255));return{packedHeader:e.subarray(t,t+4),tileOrigin:{x:n,y:r,z:i},invPosScale:a}}_deleteTile(e){this._renderablesBeingCreated.has(e.handle)||this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}reinterpretU32AsFloat(e){return this._u32View[0]=e,this._f32View[0]}get performanceInfo(){let e=0,t=0;this._tileHandles.forEach(n=>{n.lifecycleState===0?t++:e++});let n=this.data?.textureAtlasMemory??0,r=this.data?.headerTextureMemory??0,i=this.data?.orderTextureMemory??0,a=this.data?.fadingTextureMemory??0,o=this.data?.sortBufferMemory??0;return new A(this.usedMemory,e,this._usedTileMemory,t,this._cacheTileMemory,n,r,i,a,o)}get test(){}};e([p()],$.prototype,`layer`,void 0),e([p({readOnly:!0})],$.prototype,`_clippingBox`,null),e([p()],$.prototype,`elevationOffset`,null),e([p({readOnly:!0})],$.prototype,`visibleAtCurrentScale`,null),e([p()],$.prototype,`fullExtentInLocalViewSpatialReference`,void 0),e([p()],$.prototype,`maximumGaussianCount`,null),$=Q=e([m(`esri.views.3d.layers.GaussianSplatLayerView3D`)],$);class ie{constructor(e){this.visibilityChange=e,this.incomingTileHandles=new Set}}const ae=$;export{ae as default};
|
|
@@ -11,11 +11,11 @@ import{EvaluateAmbientLighting as e}from"./EvaluateAmbientLighting.glsl.js";impo
|
|
|
11
11
|
`),p.uniforms.add(i).code.add(d`vec3 evaluateAdditionalLighting(float ambientOcclusion, vec3 vPosWorld) {
|
|
12
12
|
float additionalAmbientScale = additionalDirectedAmbientLight(vPosWorld);
|
|
13
13
|
return (1.0 - ambientOcclusion) * additionalAmbientScale * ambientBoostFactor * lightingGlobalFactor * mainLightIntensity;
|
|
14
|
-
}`);let w=S?`globalIlluminationOcclusion`:`ssao`,T=S?`factorDirect`:`0.0`,E=S?`factorAmbient`:`1.0`;switch(p.constants.add(`mainLightIrradianceScale`,`float`,S?.75:1),p.constants.add(`ambientIrradianceScale`,`float`,S?1.5:1),S&&(p.uniforms.add(new u(`factorDirect`,e=>e.globalIlluminationDirectFactor),new u(`factorAmbient`,e=>e.globalIlluminationAmbientFactor)),p.constants.add(`globalIlluminationEmissionCompressionWeight`,`float`,.75),p.code.add(d`vec3 evaluateGlobalIlluminationOcclusion() {
|
|
15
|
-
return min(
|
|
14
|
+
}`);let w=S?`globalIlluminationOcclusion`:`ssao`,T=S?`factorDirect`:`0.0`,E=S?`factorAmbient`:`1.0`;switch(p.constants.add(`mainLightIrradianceScale`,`float`,S?.75:1),p.constants.add(`ambientIrradianceScale`,`float`,S?1.5:1),S&&(p.uniforms.add(new u(`factorDirect`,e=>e.globalIlluminationDirectFactor),new u(`factorAmbient`,e=>e.globalIlluminationAmbientFactor)),p.constants.add(`globalIlluminationOcclusionBoost`,`float`,1.2),p.constants.add(`globalIlluminationEmissionBoost`,`float`,2.25),p.constants.add(`globalIlluminationEmissionCompressionWeight`,`float`,.75),p.code.add(d`vec3 evaluateGlobalIlluminationOcclusion() {
|
|
15
|
+
return min(globalIlluminationOcclusionBoost * readGlobalIlluminationOcclusion(), 1.0);
|
|
16
16
|
}
|
|
17
17
|
vec3 evaluateGlobalIlluminationEmission(vec3 albedoLinear) {
|
|
18
|
-
vec3 emission =
|
|
18
|
+
vec3 emission = globalIlluminationEmissionBoost * (0.75 * albedoLinear + 0.25) * readGlobalIlluminationEmission().rgb;
|
|
19
19
|
vec3 compressedEmission = emission / (emission + 1.0);
|
|
20
20
|
return mix(emission, compressedEmission, globalIlluminationEmissionCompressionWeight);
|
|
21
21
|
}`)),y){case 0:case 4:case 3:p.include(a),p.code.add(d`
|
|
@@ -4,7 +4,7 @@ void discardByStippleAlpha(float stippleAlpha, float threshold) {}
|
|
|
4
4
|
vec4 blendStipple(vec4 color, float stippleAlpha) { return color; }`);return}let p=!(d.draped&&d.stipplePreferContinuous),{vertex:g,fragment:_}=u;d.draped||(n(g,d),g.uniforms.add(new a(`worldToScreenPerDistanceRatio`,({camera:e})=>1/e.screenPixelSizePerDistance)).code.add(s`float computeWorldToScreenRatio(vec3 segmentCenter) {
|
|
5
5
|
float segmentDistanceToCamera = length(segmentCenter - cameraPosition);
|
|
6
6
|
return worldToScreenPerDistanceRatio / segmentDistanceToCamera;
|
|
7
|
-
}`)),u.varyings.add(`vStippleDistance`,`float`),u.varyings.add(`
|
|
7
|
+
}`)),u.varyings.add(`vStippleDistance`,`float`),u.varyings.add(`vStippleLimitsAndCaps`,`vec4`),u.varyings.add(`vStipplePatternStretch`,`float`),g.code.add(s`
|
|
8
8
|
float discretizeStippleDistanceToScreenRatio(float stippleDistanceToScreenRatio) {
|
|
9
9
|
float step = ${s.float(h)};
|
|
10
10
|
|
|
@@ -35,9 +35,10 @@ return worldToScreenPerDistanceRatio / segmentDistanceToCamera;
|
|
|
35
35
|
}
|
|
36
36
|
return vec2(startPseudoScreen, startPseudoScreen + segmentLengthPseudoScreen);
|
|
37
37
|
}
|
|
38
|
-
`),_.uniforms.add(new l(`stipplePatternTexture`,e=>e.stippleTexture),new o(`stipplePatternPixelSizeInv`,e=>1/m(e))),d.stippleOffColorEnabled&&_.uniforms.add(new i(`stippleOffColor`,e=>f(e.stippleOffColor))),u.include(t);let v=d.worldSized&&d.imagePattern,{usePerspectiveCorrectStipple:y}=d
|
|
39
|
-
vec2 aaCorrectedLimits =
|
|
40
|
-
isClamped =
|
|
38
|
+
`),_.uniforms.add(new l(`stipplePatternTexture`,e=>e.stippleTexture),new o(`stipplePatternPixelSizeInv`,e=>1/m(e))),d.stippleOffColorEnabled&&_.uniforms.add(new i(`stippleOffColor`,e=>f(e.stippleOffColor))),u.include(t);let v=d.worldSized&&d.imagePattern,{usePerspectiveCorrectStipple:y}=d;y&&u.varyings.add(`vStipplePerspective`,`vec4`),v?(u.varyings.add(`vStippleV`,`float`),u.fragment.include(e),_.code.add(s`vec4 getStippleColor(out bool isClamped) {
|
|
39
|
+
vec2 aaCorrectedLimits = vStippleLimitsAndCaps.xy + vec2(1.0, -1.0) / gl_FragCoord.w;
|
|
40
|
+
isClamped = (vStippleLimitsAndCaps.z <= 0.0 && vStippleDistance < aaCorrectedLimits.x) ||
|
|
41
|
+
(vStippleLimitsAndCaps.w <= 0.0 && vStippleDistance > aaCorrectedLimits.y);
|
|
41
42
|
float u = vStippleDistance * stipplePatternPixelSizeInv;
|
|
42
43
|
float v = vStippleV == -1.0 ? 0.5 : vStippleV;
|
|
43
44
|
return texture(stipplePatternTexture, vec2(u, v));
|
|
@@ -61,7 +62,21 @@ float opacity = mixExternalOpacity(color.a, 1.0, stippleColor.a, mixMode);
|
|
|
61
62
|
return vec4(col, opacity);
|
|
62
63
|
}`)):_.code.add(s`
|
|
63
64
|
float getStippleSDF(out bool isClamped) {
|
|
64
|
-
|
|
65
|
+
${c(d.worldSized,s`
|
|
66
|
+
float unclampedStippleDistance = noPerspectiveRead(vStippleDistance);
|
|
67
|
+
float stippleDistancePerPixel = length(vec2(dFdx(unclampedStippleDistance), dFdy(unclampedStippleDistance)));
|
|
68
|
+
`,s`float stippleDistancePerPixel = 1.0;`)}
|
|
69
|
+
|
|
70
|
+
bool clampStart = vStippleLimitsAndCaps.z <= 0.0;
|
|
71
|
+
bool clampEnd = vStippleLimitsAndCaps.w <= 0.0;
|
|
72
|
+
float stippleDistance = vStippleDistance;
|
|
73
|
+
if (clampStart) {
|
|
74
|
+
stippleDistance = max(stippleDistance, vStippleLimitsAndCaps.x);
|
|
75
|
+
}
|
|
76
|
+
if (clampEnd) {
|
|
77
|
+
stippleDistance = min(stippleDistance, vStippleLimitsAndCaps.y);
|
|
78
|
+
}
|
|
79
|
+
stippleDistance = noPerspectiveRead(stippleDistance);
|
|
65
80
|
float lineSizeInv = noPerspectiveRead(vLineSizeInv);
|
|
66
81
|
|
|
67
82
|
${c(y,s`
|
|
@@ -75,10 +90,9 @@ return vec4(col, opacity);
|
|
|
75
90
|
stippleDistance = mix(stipplePerspective.x, stipplePerspective.y, perspectiveFactor);
|
|
76
91
|
`)}
|
|
77
92
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
`:s`isClamped = false;`}
|
|
93
|
+
vec2 aaCorrectedLimits = vStippleLimitsAndCaps.xy + vec2(1.0, -1.0) * stippleDistancePerPixel / gl_FragCoord.w;
|
|
94
|
+
isClamped = (clampStart && vStippleDistance < aaCorrectedLimits.x) ||
|
|
95
|
+
(clampEnd && vStippleDistance > aaCorrectedLimits.y);
|
|
82
96
|
|
|
83
97
|
float u = stippleDistance * stipplePatternPixelSizeInv * lineSizeInv;
|
|
84
98
|
u = fract(u);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import n from"../../../core/Error.js";import{makeHandle as r}from"../../../core/handleUtils.js";import{createScalar as i,createLength as a,toUnit as o}from"../../../core/quantity.js";import{generateUUID as s}from"../../../core/uuid.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{isWebMercator as u,isGeographic as d}from"../../../geometry/support/spatialReferenceUtils.js";import{
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import n from"../../../core/Error.js";import{makeHandle as r}from"../../../core/handleUtils.js";import{createScalar as i,createLength as a,toUnit as o}from"../../../core/quantity.js";import{generateUUID as s}from"../../../core/uuid.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{isWebMercator as u,isGeographic as d}from"../../../geometry/support/spatialReferenceUtils.js";import{getEffectiveElevationMode as f}from"../../../support/elevationInfoUtils.js";import{createViewAlignedCoordinateSystem as p}from"./surfaceCoordinateSystems.js";import{knownFieldDisplayOrders as m}from"./types.js";import{createGeographicCoordinate as h}from"../../interactive/tooltip/fields/parsingAndFormattingUtils.js";import{elevationFromPoint as g}from"../../support/euclideanLengthMeasurementUtils.js";const _={x:m.Coordinates+10,y:m.Coordinates+11,elevation:m.Coordinates+12};let v=class extends t{constructor(e){super(e)}normalizeCtorArgs(e){let{drawTool:t,plugin:n,...r}=e;return{_drawTool:t,_plugin:n,...r}}get positionOfLastUserInput(){return this._drawTool.positionOfLastUserInput}get elevationConstraint(){return this._drawTool.tooltipManager?.elevationConstraint}getSession(e){return this._drawTool.editSessionManager.getSession(e)}readBooleanSetting(e){let t=this._plugin.configuration?.uniqueId;if(t)return this._drawTool.readPluginSettingValue(t,e)}createInteractiveHandle(e,t){let r=this._drawTool.interactiveHandleManager,a=this._drawTool.tooltipManager,o=this._plugin,c=this.session,l=this._drawTool.coordinateHelper;if(!r||!a)throw new n(`draw-tool:interactive-handle-missing-dependencies`,`Attempted to set up an interactive handle without required dependencies.`);let p=e.name??s(),m=e.defaultCaptureMode??`capture-always`,g=r.registerHandle(o,{...e,name:p,editSession:c,defaultCaptureMode:m,captureMode:m});if(this._drawTool.addPromise(r.setupManipulatorForHandle(g,this._drawTool.lastScreenPosition,this._drawTool.movementCommandContext)),!t?.disableDefaultXYFields){let e=l.spatialReference;if(u(e)||d(e)?(a.createMeasuredField(o,{id:Symbol(`tooltip-long-${p}`),preset:`longitude`,getMeasurementInput:()=>g.outputMapPosition,measure:async e=>h(e?.longitude),fieldProperties:{displayOrder:_.x},fieldFilters:{appliesToHandlesWithName:p}}),a.createMeasuredField(o,{id:Symbol(`tooltip-lat-${p}`),preset:`latitude`,getMeasurementInput:()=>g.outputMapPosition,measure:async e=>h(e?.latitude),fieldProperties:{displayOrder:_.y},fieldFilters:{appliesToHandlesWithName:p}})):(a.createMeasuredField(o,{id:Symbol(`tooltip-x-${p}`),preset:`x`,getMeasurementInput:()=>g.outputMapPosition,measure:async e=>e?i(e.x):null,fieldProperties:{displayOrder:_.x},fieldFilters:{appliesToHandlesWithName:p}}),a.createMeasuredField(o,{id:Symbol(`tooltip-y-${p}`),preset:`y`,getMeasurementInput:()=>g.outputMapPosition,measure:async e=>e?i(e.y):null,fieldProperties:{displayOrder:_.y},fieldFilters:{appliesToHandlesWithName:p}})),this._drawTool.hasZ&&g.role===`primary`){let e=a.createMeasuredField(o,{id:Symbol(`tooltip-z-${p}`),preset:`elevation`,getMeasurementInput:()=>g.outputMapPosition,measure:async(e,t)=>this.measureElevation(e,t.inputUnitInfos.verticalLength.unit),fieldProperties:{displayOrder:_.elevation},fieldFilters:{appliesToHandlesWithName:p}}).field,{view:t,hasZ:n,elevationInfo:r}=this._drawTool;t.type===`3d`&&f(n,r)!==`absolute-height`&&!e.locked&&e.lock(this.measureElevation(null))}}return g}removeInteractiveHandle(e){let t=e;this._drawTool.interactiveHandleManager?.unregisterHandle(this._plugin,t)}createConstraint(e,t){this._drawTool.interactiveHandleManager?.registerCustomConstraint(this._plugin,e,t)}removeConstraint(e){this._drawTool.interactiveHandleManager?.unregisterCustomConstraint(this._plugin,e)}createCustomField(e){if(!this._drawTool.tooltipManager)throw new n(`draw-tool:tooltip-manager-missing`,`Attempted to create a field without access to a tooltip manager.`);return this._drawTool.tooltipManager.createCustomField(this._plugin,e)}createMeasuredField(e){if(!this._drawTool.tooltipManager)throw new n(`draw-tool:tooltip-manager-missing`,`Attempted to create a field without access to a tooltip manager.`);return this._drawTool.tooltipManager.createMeasuredField(this._plugin,e)}requestComplete(){this._drawTool.complete(this._plugin)}requestCancel(e){this._drawTool.lifecycleManager.cancel(this._plugin)}requestBeginDownstreamPlugin(e,t){this._drawTool.lifecycleManager.begin([e],this._plugin,t?.cancelExisting)}async measureLength(e,t,n,r){let{_drawTool:i,_plugin:a}=this;if(n!==`tooltip`||i.tooltipManager?.effectiveEnabled)return await i.measurementManager.measureLength(a,t,e,r)}async measureArea(e,t,n,r){let{_drawTool:i,_plugin:a}=this;if(n!==`tooltip`||i.tooltipManager?.effectiveEnabled)return await i.measurementManager.measureArea(a,t,e,r)}async measureDistance(e,t,n,r){let{_drawTool:i,_plugin:a}=this;if(n!==`tooltip`||i.tooltipManager?.effectiveEnabled)return await i.measurementManager.measureDistance(a,t,e,r)}measureElevation(e,t){let n=this._drawTool,r=g(e);if(!r){let e=n.surfaceManager?.metersPerVerticalUnit;e&&(r=a(n.defaultZ*e,`meters`))}return t&&r&&r.unit!==t?o(r,t):r}getGlobalState(){return this._drawTool.globalStateManager.getGlobalState()}setGlobalState(e,t){this._drawTool.globalStateManager.setGlobalState(this._plugin,e,t)}addOrUpdateGraphic(e,t){let{_plugin:n,_drawTool:i}=this,a=i.renderer;a?.addOrUpdateGraphic(e,t),n.hasHandles(e)||n.addHandles(r(()=>a?.removeGraphic(e)),e)}addOrUpdateVisual(e,t){let n=this._plugin,i=this._drawTool.renderer;i?.addOrUpdateVisual(e,t),n.hasHandles(e)||n.addHandles(r(()=>i?.removeVisual(e)),e)}removeGraphic(e){this._plugin.removeHandles(e)}removeVisual(e){this._plugin.removeHandles(e)}getViewInformation(){return this._drawTool.view}getViewAlignedSurfaceCoordinateSystem(e){let{view:t,coordinateHelper:n}=this._drawTool;return!t||!n?null:p(t,n.pointToVector(e))}};e([c()],v.prototype,`_plugin`,void 0),e([c()],v.prototype,`_drawTool`,void 0),e([c({nonNullable:!0})],v.prototype,`session`,void 0),e([c()],v.prototype,`positionOfLastUserInput`,null),e([c()],v.prototype,`elevationConstraint`,null),v=e([l(`esri.views.draw.support.PluginContext`)],v);export{v as PluginContext};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{createTask as n}from"../../../../core/asyncUtils.js";import r from"../../../../core/Error.js";import{getOrCreateMapValue as i}from"../../../../core/MapUtils.js";import{destroyMaybe as a}from"../../../../core/maybe.js";import o from"../../../../core/ReactiveMap.js";import{watch as s,syncAndInitial as c,initial as l}from"../../../../core/reactiveUtils.js";import{property as u}from"../../../../core/accessorSupport/decorators.js";import{subclass as d}from"../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as f}from"../../../../core/support/UpdatingHandles.js";import{isLoaded as p,load as m}from"../../../../geometry/coordinateFormatter.js";import{absoluteHeightElevationInfo as h}from"../../../../support/elevationInfoUtils.js";import{ManagedTooltipField as g}from"../ManagedTooltipField.js";import{getConstraintContext as _}from"../../../interactive/sketch/constraintUtils.js";import{makeTooltip as v}from"../../../interactive/tooltip/tooltipCommonUtils.js";import{makeScalarField as y,makeOrientationField as b,makeAreaField as x,makeLengthField as S,makeRadiusField as C,makeTotalLengthField as w,makeSizeField as T,makeScaleField as E,makeYField as D,makeXField as O,makeLongitudeField as k,makeLatitudeField as A,makeElevationField as j,makeDistanceField as M,makeDirectionField as N}from"../../../interactive/tooltip/fields/fields.js";import{TooltipField as P}from"../../../interactive/tooltip/fields/TooltipField.js";import{DynamicTooltipInfo as F,isKnownConstraintField as
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{createTask as n}from"../../../../core/asyncUtils.js";import r from"../../../../core/Error.js";import{getOrCreateMapValue as i}from"../../../../core/MapUtils.js";import{destroyMaybe as a}from"../../../../core/maybe.js";import o from"../../../../core/ReactiveMap.js";import{watch as s,syncAndInitial as c,initial as l}from"../../../../core/reactiveUtils.js";import{property as u}from"../../../../core/accessorSupport/decorators.js";import{subclass as d}from"../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as f}from"../../../../core/support/UpdatingHandles.js";import{isLoaded as p,load as m}from"../../../../geometry/coordinateFormatter.js";import{absoluteHeightElevationInfo as h}from"../../../../support/elevationInfoUtils.js";import{ManagedTooltipField as g}from"../ManagedTooltipField.js";import{getConstraintContext as _}from"../../../interactive/sketch/constraintUtils.js";import{makeTooltip as v}from"../../../interactive/tooltip/tooltipCommonUtils.js";import{makeScalarField as y,makeOrientationField as b,makeAreaField as x,makeLengthField as S,makeRadiusField as C,makeTotalLengthField as w,makeSizeField as T,makeScaleField as E,makeYField as D,makeXField as O,makeLongitudeField as k,makeLatitudeField as A,makeElevationField as j,makeDistanceField as M,makeDirectionField as N}from"../../../interactive/tooltip/fields/fields.js";import{TooltipField as P}from"../../../interactive/tooltip/fields/TooltipField.js";import{DynamicTooltipInfo as F,filterFieldsForHandle as I,isKnownConstraintField as L}from"../../../interactive/tooltip/infos/DynamicTooltipInfo.js";let R=class extends t{constructor(e){super(e),this._pluginTooltipFieldRegistry=new o,this._updatingHandles=new f,this._coordinateFormatterLoadTask=null,this._constraintSnapshot=null,this.constraintsEnabled=!0,this.keepTooltipAliveEvenWhenTooltipsAreNotEnabled=!1,this.enabled=!0}initialize(){this.addHandles([s(()=>[this.effectiveEnabled,this.context?.view,this.context?.toolOptions],([e,t,n])=>{let{context:r}=this;e&&t&&n?(this._tooltipInfo??=new F({toolOptions:n,getAllFields:()=>this.allFields,getActiveHandle:()=>this.effectiveActiveHandle,getHelpMessageKey:()=>this.context?.getHelpMessageKey(),viewType:t.type}),this._tooltip||this._setupTooltip(r)):(this._tooltip=a(this._tooltip),this._tooltipInfo=a(this._tooltipInfo),this.inputModeHandle=null)},c)])}destroy(){this._tooltip=a(this._tooltip),this._tooltipInfo=a(this._tooltipInfo)}get context(){return this.getDependencies?.()}get focusedHandle(){return this.context?.getActiveHandle?.()}get allHandles(){return this.context?.getAllHandles?.()}get effectiveActiveHandle(){return this._tooltip?.isInInputMode?this.inputModeHandle:this.focusedHandle}get updating(){return this._updatingHandles.updating}get tooltip(){return this._tooltip}get tooltipInfo(){return this._tooltipInfo}get elevationConstraint(){return I(this.allFields,this.focusedHandle).map(({field:e})=>e).filter(L).find(e=>e.name===`elevation`)?.committed}get allFields(){return Array.from(this._pluginTooltipFieldRegistry.values()).flatMap(e=>Array.from(e.values()))}get effectiveEnabled(){return this.enabled&&(this.context?.toolOptions.tooltips.effectiveEnabled||this.keepTooltipAliveEvenWhenTooltipsAreNotEnabled)}getConstraints(e){let{tooltipInfo:t,context:n}=this,{view:r,editGeometryOperations:i,elevationInfo:a,toolOptions:o}=n??{},s=this.getLastScreenPosition?.();if(!s||!r||!t||!i||!o)return null;let{coordinateHelper:c,spatialReference:l}=i.data,u=r.toMap(s);if(!u)return null;let d=_(u,r,l,a??h,c.hasZ(),o.values.effectiveDirectionMode);return{...H(t.getConstraintFieldsForHandle(e)),context:d}}storeConstraintSnapshot(){let e=I(this.allFields,this.focusedHandle).map(({field:e})=>e).filter(e=>e.locked&&!e.unlockOnVertexPlacement).filter(L);if(!e.length){this._constraintSnapshot=null;return}this._constraintSnapshot=H(e)}unlockOnVertexPlacement(){this.tooltipInfo?.allFields.forEach(e=>{e.unlockOnVertexPlacement&&(e.committed=null)})}unregisterPluginFields(e){let t=this._pluginTooltipFieldRegistry.get(e);t?.forEach(e=>e.destroy()),t?.clear(),this._pluginTooltipFieldRegistry.delete(e)}createMeasuredField(e,{id:t,preset:n,getMeasurementInput:r,measure:i,fieldProperties:a,fieldFilters:o}){let c=this._getOrCreateField(e,t,n,a,o);return c.registerMeasurement(r,i,()=>this.tooltipInfo?.renderContext),c.addHandles(s(()=>this.tooltipInfo?.isEffectiveVisibleField(c.field),e=>c.enabled=!!e,l)),c}createCustomField(e,{id:t,preset:n,fieldProperties:r,fieldFilters:i}){return this._getOrCreateField(e,t,n,r,i)}_setupTooltip(e){let t=this._tooltip=v(()=>({view:e.view,options:e.toolOptions.tooltips,info:this.tooltipInfo}));t.addHandles([s(()=>this.focusedHandle,e=>{(e&&(!t.isInInputMode||this.inputModeHandle==null)||this.inputModeHandle&&!this.allHandles?.includes(this.inputModeHandle))&&(this.inputModeHandle=e)},c),s(()=>this.focusedHandle?.screenPosition,e=>{e?(t.position=e,t.hidden=!1):t.hidden=!0},c),t.on(`commit`,()=>{this.context?.notifyTooltipsChanged()})]),!this._coordinateFormatterLoadTask&&!p()&&(this._coordinateFormatterLoadTask=n(()=>m()),this.addHandles(this._coordinateFormatterLoadTask),this._updatingHandles.addPromise(this._coordinateFormatterLoadTask.promise))}_getOrCreateField(e,t,n,r,a){let s=i(this._pluginTooltipFieldRegistry,e,()=>new o);if(s.has(t))return s.get(t);let c=V(n,r),l=new g({field:c,displayGroup:r?.displayGroup,...a});s.set(t,l);let u=L(c)?this._constraintSnapshot?.[c.name]:void 0;return u&&c.lock(u),l}};e([u()],R.prototype,`_updatingHandles`,void 0),e([u()],R.prototype,`_tooltip`,void 0),e([u()],R.prototype,`_tooltipInfo`,void 0),e([u()],R.prototype,`_coordinateFormatterLoadTask`,void 0),e([u()],R.prototype,`_constraintSnapshot`,void 0),e([u()],R.prototype,`getDependencies`,void 0),e([u()],R.prototype,`getLastScreenPosition`,void 0),e([u()],R.prototype,`context`,null),e([u()],R.prototype,`inputModeHandle`,void 0),e([u()],R.prototype,`focusedHandle`,null),e([u()],R.prototype,`allHandles`,null),e([u()],R.prototype,`effectiveActiveHandle`,null),e([u()],R.prototype,`updating`,null),e([u()],R.prototype,`tooltip`,null),e([u()],R.prototype,`tooltipInfo`,null),e([u()],R.prototype,`constraintsEnabled`,void 0),e([u()],R.prototype,`elevationConstraint`,null),e([u()],R.prototype,`allFields`,null),e([u()],R.prototype,`keepTooltipAliveEvenWhenTooltipsAreNotEnabled`,void 0),e([u()],R.prototype,`enabled`,void 0),e([u()],R.prototype,`effectiveEnabled`,null),R=e([d(`esri.views.draw.support.managers.TooltipManager`)],R);function z(e){return e==null||!(`unit`in e)||!(`rotationType`in e)?null:e}function B(e){return e==null||`rotationType`in e?null:e}function V(e,t){let n=t?{...t}:{};switch(delete n.displayGroup,e){case`area`:return x({...n,name:`area`});case`direction`:return N({...n,name:`direction`});case`distance`:return M({...n,name:`distance`});case`elevation`:{let e=j({...n,name:`elevation`});return e.showAsZ=!0,e}case`latitude`:return A({...n,name:`y`});case`longitude`:return k({...n,name:`x`});case`x`:return O({...n,name:`x`});case`y`:return D({...n,name:`y`});case`orientation`:return b({...n,name:`orientation`});case`scale`:return E({...n,name:`scale`});case`size`:return T({...n,name:`size`});case`totalLength`:return w({...n,name:`totalLength`});case`radius`:return C({...n,name:`radius`});case`generic-length`:return S({...n,name:null});case`generic-area`:return x({...n,name:null});case`generic-angle`:return b({...n,name:null});case`generic-scalar`:return y({...n,name:null});default:if(!n)throw new r(`draw-tool:tooltips:invalid-field-config`,`Attempted to create a tooltip without a preset definition and without tooltip configuration.`);return new P(n)}}function H(e){let t={};for(let n of e)switch(n.name){case`direction`:t[n.name]=n.committed;break;case`distance`:case`elevation`:t[n.name]=n.committed;break;case`x`:t[n.name]=B(n.committed),t.longitude=z(n.committed);break;case`y`:t[n.name]=B(n.committed),t.latitude=z(n.committed)}return t}export{R as TooltipManager};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{handlesGroup as e}from"../../../core/handleUtils.js";import{CurveSnappingHint as t}from"./hints/CurveSnappingHint.js";import{IntersectionSnappingHint as n}from"./hints/IntersectionSnappingHint.js";import{LineSnappingHint as r}from"./hints/LineSnappingHint.js";import{ParallelSnappingHint as i}from"./hints/ParallelSnappingHint.js";import{PointSnappingHint as a}from"./hints/PointSnappingHint.js";import{RightAngleSnappingHint as o}from"./hints/RightAngleSnappingHint.js";class s{draw(s,l){let u=c(s),d=this.sortUniqueHints(u),f=[];for(let e
|
|
2
|
+
import{handlesGroup as e}from"../../../core/handleUtils.js";import{CurveSnappingHint as t}from"./hints/CurveSnappingHint.js";import{IntersectionSnappingHint as n}from"./hints/IntersectionSnappingHint.js";import{LineSnappingHint as r}from"./hints/LineSnappingHint.js";import{ParallelSnappingHint as i}from"./hints/ParallelSnappingHint.js";import{PointSnappingHint as a}from"./hints/PointSnappingHint.js";import{RightAngleSnappingHint as o}from"./hints/RightAngleSnappingHint.js";class s{draw(s,l){let u=c(s),d=this.sortUniqueHints(u),f=[];for(let e=0;e<d.length;++e){let s=d[e];s instanceof n&&f.push(this.visualizeIntersectionPoint(s,l,e)),s instanceof r&&f.push(this.visualizeLine(s,l,e)),s instanceof t&&f.push(this.visualizeCurve(s,l,e)),s instanceof i&&f.push(this.visualizeParallelSign(s,l,e)),s instanceof o&&f.push(this.visualizeRightAngleQuad(s,l,e)),s instanceof a&&f.push(this.visualizePoint(s,l,e))}return e(f)}sortUniqueHints(e){return e}}function c(e){let t=[];for(let n of e){let e=!0;for(let r of t)if(n.equals(r)){e=!1;break}e&&t.push(n)}return t}export{s as SnappingVisualizer};
|
|
@@ -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 n,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{SketchTooltipInfo as i}from"./SketchTooltipInfo.js";let a=class extends i{constructor(e){super(e),this.type=`dynamic`,this.renderContext=null,this.helpMessage=void 0,this._isVisibleField=e=>{if(!e.visible)return!1;let t=e.name;switch(t){case`x`:case`y`:return this.visibleElements.coordinates;default:return this.visibleElements[t]??!0}}}initialize(){this.addHandles(t(()=>this.getHelpMessageKey?.(),e=>this.helpMessage=e??void 0))}get availableFields(){return this.getAllFields?.()?.map(e=>e.field)??[]}get availableFieldsForCurrentHandle(){let e=this.getAllFields?.(),t=this.getActiveHandle?.();return l(e??[],t)}get allManagedFields(){let{availableFieldsForCurrentHandle:e}=this,t=this.getActiveHandle?.(),n=this._getXyMode(t);return(this._useCoordinateDisplay(t,n)?e.filter(e=>s(e.field)):this._useDirectionDistanceDisplay(t,n)?e.filter(e=>c(e.field)):e).filter(e=>this._isVisibleField(e.field)).sort((e,t)=>o(e.field,t.field))}get fieldsGroupedForDisplay(){let e=this.allManagedFields,t=new Map,n=[];for(let n of e){let e=n.displayGroup;t.has(e)||t.set(e,[]),t.get(e)?.push(n)}for(let[e,r]of t.entries())if(r.length!==2||!e)n.push(...r.map(e=>e.field));else{let e=r.toSorted((e,t)=>o(e.field,t.field));n.push({left:e[0].field,right:e[1].field})}return n}get xyMode(){return this._getXyMode(this.getActiveHandle?.())}get allFields(){return this.allManagedFields.map(e=>e.field)}getConstraintFieldsForHandle(e){let t=this.getAllFields?.(),n=this._getXyMode(e),r=l(t??[],e).map(e=>e.field).filter(u);return(this._useCoordinateDisplay(e,n)?r.filter(s):this._useDirectionDistanceDisplay(e,n)?r.filter(c):r).filter(this._isVisibleField)}getConstraintFieldByName(e,t){return this.getConstraintFieldsForHandle(e).find(e=>e.name===t)}isEffectiveVisibleField(e){let{allFields:t,renderContext:n}=this;return e.visible&&!!n&&t.includes(e)}_getXyMode(e){let t=this.toolOptions.tooltips.xyMode,n=e?.editSession?.endVertex?.leftSegment?.leftVertex&&e?.role===`primary`?`direction-distance`:`coordinates`;return t===`auto`?n:t}_useCoordinateDisplay(e,t){let{availableFields:n}=this;return(t===`coordinates`||e?.role===`secondary`)&&n.some(e=>e.name===`x`)&&n.some(e=>e.name===`y`)}_useDirectionDistanceDisplay(e,t){let{availableFields:n}=this;return t===`direction-distance`&&e?.role===`primary`&&n.some(e=>e.name===`distance`)&&n.some(e=>e.name===`direction`)}};e([n()],a.prototype,`type`,void 0),e([n()],a.prototype,`getAllFields`,void 0),e([n()],a.prototype,`getActiveHandle`,void 0),e([n()],a.prototype,`getHelpMessageKey`,void 0),e([n()],a.prototype,`availableFields`,null),e([n()],a.prototype,`availableFieldsForCurrentHandle`,null),e([n()],a.prototype,`allManagedFields`,null),e([n()],a.prototype,`fieldsGroupedForDisplay`,null),e([n()],a.prototype,`xyMode`,null),e([n()],a.prototype,`allFields`,null),e([n()],a.prototype,`renderContext`,void 0),e([n()],a.prototype,`helpMessage`,void 0),a=e([r(`esri.views.interactive.tooltip.infos.DynamicTooltipInfo`)],a);function o(e,t){return e.displayOrder-t.displayOrder}function s(e){return e.name!==`direction`&&e.name!==`distance`}function c(e){return e.name!==`x`&&e.name!==`y`}function l(e,t){let{name:n,role:r}=t??{};return e?.filter(e=>(e.appliesToHandlesWithName==null||e.appliesToHandlesWithName===n)&&(e.appliesToHandlesWithRole==null||e.appliesToHandlesWithRole===r))??[]}function u(e){switch(e.name){case`direction`:case`distance`:case`elevation`:case`x`:case`y`:return!0;default:return!1}}export{a as DynamicTooltipInfo,u as isKnownConstraintField};
|
|
2
|
+
import{__decorate as e}from"tslib";import{watch as t}from"../../../../core/reactiveUtils.js";import{property as n,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{SketchTooltipInfo as i}from"./SketchTooltipInfo.js";let a=class extends i{constructor(e){super(e),this.type=`dynamic`,this.renderContext=null,this.helpMessage=void 0,this._isVisibleField=e=>{if(!e.visible)return!1;let t=e.name;switch(t){case`x`:case`y`:return this.visibleElements.coordinates;default:return this.visibleElements[t]??!0}}}initialize(){this.addHandles(t(()=>this.getHelpMessageKey?.(),e=>this.helpMessage=e??void 0))}get availableFields(){return this.getAllFields?.()?.map(e=>e.field)??[]}get availableFieldsForCurrentHandle(){let e=this.getAllFields?.(),t=this.getActiveHandle?.();return l(e??[],t)}get allManagedFields(){let{availableFieldsForCurrentHandle:e}=this,t=this.getActiveHandle?.(),n=this._getXyMode(t);return(this._useCoordinateDisplay(t,n)?e.filter(e=>s(e.field)):this._useDirectionDistanceDisplay(t,n)?e.filter(e=>c(e.field)):e).filter(e=>this._isVisibleField(e.field)).sort((e,t)=>o(e.field,t.field))}get fieldsGroupedForDisplay(){let e=this.allManagedFields,t=new Map,n=[];for(let n of e){let e=n.displayGroup;t.has(e)||t.set(e,[]),t.get(e)?.push(n)}for(let[e,r]of t.entries())if(r.length!==2||!e)n.push(...r.map(e=>e.field));else{let e=r.toSorted((e,t)=>o(e.field,t.field));n.push({left:e[0].field,right:e[1].field})}return n}get xyMode(){return this._getXyMode(this.getActiveHandle?.())}get allFields(){return this.allManagedFields.map(e=>e.field)}getConstraintFieldsForHandle(e){let t=this.getAllFields?.(),n=this._getXyMode(e),r=l(t??[],e).map(e=>e.field).filter(u);return(this._useCoordinateDisplay(e,n)?r.filter(s):this._useDirectionDistanceDisplay(e,n)?r.filter(c):r).filter(this._isVisibleField)}getConstraintFieldByName(e,t){return this.getConstraintFieldsForHandle(e).find(e=>e.name===t)}isEffectiveVisibleField(e){let{allFields:t,renderContext:n}=this;return e.visible&&!!n&&t.includes(e)}_getXyMode(e){let t=this.toolOptions.tooltips.xyMode,n=e?.editSession?.endVertex?.leftSegment?.leftVertex&&e?.role===`primary`?`direction-distance`:`coordinates`;return t===`auto`?n:t}_useCoordinateDisplay(e,t){let{availableFields:n}=this;return(t===`coordinates`||e?.role===`secondary`)&&n.some(e=>e.name===`x`)&&n.some(e=>e.name===`y`)}_useDirectionDistanceDisplay(e,t){let{availableFields:n}=this;return t===`direction-distance`&&e?.role===`primary`&&n.some(e=>e.name===`distance`)&&n.some(e=>e.name===`direction`)}};e([n()],a.prototype,`type`,void 0),e([n()],a.prototype,`getAllFields`,void 0),e([n()],a.prototype,`getActiveHandle`,void 0),e([n()],a.prototype,`getHelpMessageKey`,void 0),e([n()],a.prototype,`availableFields`,null),e([n()],a.prototype,`availableFieldsForCurrentHandle`,null),e([n()],a.prototype,`allManagedFields`,null),e([n()],a.prototype,`fieldsGroupedForDisplay`,null),e([n()],a.prototype,`xyMode`,null),e([n()],a.prototype,`allFields`,null),e([n()],a.prototype,`renderContext`,void 0),e([n()],a.prototype,`helpMessage`,void 0),a=e([r(`esri.views.interactive.tooltip.infos.DynamicTooltipInfo`)],a);function o(e,t){return e.displayOrder-t.displayOrder}function s(e){return e.name!==`direction`&&e.name!==`distance`}function c(e){return e.name!==`x`&&e.name!==`y`}function l(e,t){let{name:n,role:r}=t??{};return e?.filter(e=>(e.appliesToHandlesWithName==null||e.appliesToHandlesWithName===n)&&(e.appliesToHandlesWithRole==null||e.appliesToHandlesWithRole===r))??[]}function u(e){switch(e.name){case`direction`:case`distance`:case`elevation`:case`x`:case`y`:return!0;default:return!1}}export{a as DynamicTooltipInfo,l as filterFieldsForHandle,u as isKnownConstraintField};
|