@arcgis/core 4.34.0-next.74 → 4.34.0-next.75
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/PopupTemplate.js +1 -1
- package/applications/Components/QuantityFormatter.js +1 -1
- package/arcade/Pixel.js +5 -0
- package/arcade/featureSetUtils.js +1 -1
- package/arcade/featureset/actions/GroupBy.js +1 -1
- package/arcade/featureset/actions/OrderBy.js +1 -1
- package/arcade/functions/featuresetbase.js +1 -1
- package/arcade/functions/featuresetstring.js +1 -1
- package/arcade/functions/fieldStats.js +1 -1
- package/arcade/functions/geometry.js +1 -1
- package/arcade/functions/maths.js +1 -1
- package/arcade/functions/string.js +1 -1
- package/arcade/languageUtils.js +1 -1
- package/arcade.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/009556f323e58271bc7a.js +1 -0
- package/assets/esri/core/workers/chunks/{11acefc48c0354e675df.js → 0309d008e50e55c7ff1d.js} +1 -1
- package/assets/esri/core/workers/chunks/{dd447dfc50ee7f511b84.js → 19c1f1431c0b2f4525a2.js} +1 -1
- package/assets/esri/core/workers/chunks/{7219ceab0b6fae2e69b6.js → 280af3640f8e93c1024e.js} +2 -2
- package/assets/esri/core/workers/chunks/{5a476e6743902e35f81a.js.LICENSE.txt → 280af3640f8e93c1024e.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{e3ad0a390387c5847aca.js → 356c96fad88558be9054.js} +1 -1
- package/assets/esri/core/workers/chunks/{ada8e07ff12bc5d4a1d9.js → 37ff19a9c5c99bd4e7c7.js} +1 -1
- package/assets/esri/core/workers/chunks/{d12f373fcf5848ddcd8a.js → 3f523bc8551e712c9bd4.js} +1 -1
- package/assets/esri/core/workers/chunks/{5b7e5ec6aea1f7f9b005.js → 3fecfe4f8ca2a5fd7360.js} +1 -1
- package/assets/esri/core/workers/chunks/{78b33c6d73824085c6d1.js → 48449abe795cb7a831eb.js} +1 -1
- package/assets/esri/core/workers/chunks/541bffd61006d0e36166.js +1 -0
- package/assets/esri/core/workers/chunks/{f4e9640306f64b1af7a3.js → 65ec21d29e8563fdbc55.js} +1 -1
- package/assets/esri/core/workers/chunks/67d9cfe02613cb73ee37.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/{fb669a2e50ca7aacac25.js → 71fef0a33b7ed9456e47.js} +1 -1
- package/assets/esri/core/workers/chunks/7430c462c350fdd26349.js +1 -0
- package/assets/esri/core/workers/chunks/{ff3fe5c97a98c8cab4ac.js → 7a23b127f551bf13ef54.js} +2 -2
- package/assets/esri/core/workers/chunks/{ff3fe5c97a98c8cab4ac.js.LICENSE.txt → 7a23b127f551bf13ef54.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{9c00c2263e52ad51c2a2.js → 8e428b0f33ef4688415e.js} +1 -1
- package/assets/esri/core/workers/chunks/{d682dd49bb9ee7f48f93.js → 9304c3cdf732745577fd.js} +1 -1
- package/assets/esri/core/workers/chunks/93b2e0a300b2758a1ca4.js +1 -0
- package/assets/esri/core/workers/chunks/{8d642b34d40edfe02d8e.js → 9c64b78c5c9b35b31d98.js} +2 -2
- package/assets/esri/core/workers/chunks/{8d642b34d40edfe02d8e.js.LICENSE.txt → 9c64b78c5c9b35b31d98.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{6dc62c170e9583222df2.js → a25b75de1bca1dd21941.js} +1 -1
- package/assets/esri/core/workers/chunks/a6533bab3b2fbc1e2a47.js +1 -0
- package/assets/esri/core/workers/chunks/{5c53deb45bc142219c76.js → b15ff6c9ef2de8a49853.js} +2 -2
- package/assets/esri/core/workers/chunks/{5c53deb45bc142219c76.js.LICENSE.txt → b15ff6c9ef2de8a49853.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/bccecd678faff927ac76.js +1 -0
- package/assets/esri/core/workers/chunks/{ce1f4508487298ab57b6.js → bd2dc1282c49125ede89.js} +1 -1
- package/assets/esri/core/workers/chunks/{f542bdc994a5ea3aa9d1.js → c38360d912f256519e06.js} +1 -1
- package/assets/esri/core/workers/chunks/cd1869e183001266c4c1.js +2 -0
- package/assets/esri/core/workers/chunks/{626c18c1bbc50b3b16b2.js.LICENSE.txt → cd1869e183001266c4c1.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{90321feb56f3a84f6e58.js → d153b29c542c37ae1636.js} +2 -2
- package/assets/esri/core/workers/chunks/{90321feb56f3a84f6e58.js.LICENSE.txt → d153b29c542c37ae1636.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/d55c55d39a253630d228.js +1 -0
- package/assets/esri/core/workers/chunks/{49f7a5523462aebf90fc.js → d66cdb9bb494da19696b.js} +2 -2
- package/assets/esri/core/workers/chunks/{49f7a5523462aebf90fc.js.LICENSE.txt → d66cdb9bb494da19696b.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/ed773dab5965e42a2879.js +2 -0
- package/assets/esri/core/workers/chunks/{7219ceab0b6fae2e69b6.js.LICENSE.txt → ed773dab5965e42a2879.js.LICENSE.txt} +1 -1
- package/assets/esri/images/portal/xrexperience16.png +0 -0
- package/chunks/Fog.glsl.js +6 -6
- package/chunks/GlowComposition.glsl.js +31 -12
- package/chunks/LineMarker.glsl.js +37 -36
- package/chunks/RibbonLine.glsl.js +83 -83
- package/chunks/array.js +1 -1
- package/chunks/languageUtils.js +1 -1
- package/config.js +1 -1
- package/core/quantityFormatUtils.js +1 -1
- package/core/unitFormatUtils.js +1 -1
- package/core/unitUtils.js +1 -1
- package/form/FormTemplate.js +1 -1
- package/geometry/support/curves/circleUtils.js +1 -1
- package/geometry/support/curves/circularArcUtils.js +1 -1
- package/geometry/support/curves/closestPointOnCurve.js +1 -1
- package/geometry/support/curves/curveExtent.js +1 -1
- package/geometry/support/curves/lineUtils.js +5 -0
- package/interfaces.d.ts +270 -18
- package/kernel.js +1 -1
- package/layers/ImageryLayer.js +1 -1
- package/layers/ImageryTileLayer.js +1 -1
- package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
- package/layers/support/fieldUtils.js +1 -1
- package/package.json +2 -2
- package/portal/PortalItem.js +1 -1
- package/renderers/ClassBreaksRenderer.js +1 -1
- package/renderers/DictionaryRenderer.js +1 -1
- package/renderers/DotDensityRenderer.js +1 -1
- package/renderers/HeatmapRenderer.js +1 -1
- package/renderers/PieChartRenderer.js +1 -1
- package/renderers/UniqueValueRenderer.js +1 -1
- package/renderers/mixins/VisualVariablesMixin.js +1 -1
- package/support/arcadeUtils.js +1 -1
- package/support/loadArcade.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/CIMSymbol.js +1 -1
- package/symbols/support/FeatureExpressionInfo.js +1 -1
- package/views/2d/layers/LayerView2D.js +1 -1
- package/views/3d/analysis/Dimension/DimensionVisualization.js +1 -1
- package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
- package/views/3d/analysis/Dimension/lengthDimensionManipulatorUtils.js +1 -1
- package/views/3d/analysis/Slice/ResizeManipulator.js +1 -1
- package/views/3d/analysis/Slice/RotateManipulator.js +1 -1
- package/views/3d/analysis/Slice/ShiftManipulator.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedFieldOfViewManipulation.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementTool.js +1 -1
- package/views/3d/environment/Fog.js +1 -1
- package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/LineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/MarkerVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/OutlineVisualElement.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/FlowSubView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
- package/views/3d/layers/support/Tiles3DIntersectionHandler.js +1 -1
- package/views/3d/state/SurfaceCollisionConstraint.js +1 -1
- package/views/3d/state/ViewStateManager.js +1 -1
- package/views/3d/state/controllers/SurfaceCollisionCorrectionController.js +1 -1
- package/views/3d/support/flow/FlowSubViewExtent3D.js +1 -1
- package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
- package/views/3d/support/flow/FlowWorker.js +1 -1
- package/views/3d/support/flow/geometryUtils.js +1 -1
- package/views/3d/support/flow/loadUtils.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/RibbonVertexPosition.glsl.js +23 -13
- package/views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js +36 -23
- package/views/3d/webgl-engine/core/shaderLibrary/shading/MarkerSizing.glsl.js +11 -11
- package/views/3d/webgl-engine/core/shaderLibrary/util/NoPerspective.glsl.js +5 -0
- package/views/3d/webgl-engine/effects/glow/GlowComposition.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/glow/GlowPresets.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/glow/GlowRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/GridLocalOriginFactory.js +1 -1
- package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/3d/webgl-engine/shaders/LineMarker.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/LineMarkerTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
- package/views/GroundView.js +1 -1
- package/views/interactive/snapping/allLayerSnapping.js +1 -1
- package/views/layers/ImageryLayerView.js +1 -1
- package/views/support/LayerViewManager.js +1 -1
- package/widgets/Feature/support/arcadeFeatureUtils.js +1 -1
- package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
- package/assets/esri/core/workers/chunks/5a476e6743902e35f81a.js +0 -2
- package/assets/esri/core/workers/chunks/5a95688651d7e8b7101d.js +0 -1
- package/assets/esri/core/workers/chunks/626c18c1bbc50b3b16b2.js +0 -2
- package/assets/esri/core/workers/chunks/6da298da2ec09cced0b5.js +0 -1
- package/assets/esri/core/workers/chunks/8b1d2bbb2b2eb1830921.js +0 -1
- package/assets/esri/core/workers/chunks/a2f4b6d8da93f106852c.js +0 -1
- package/assets/esri/core/workers/chunks/d305ca524837c5dc81c8.js +0 -1
- package/assets/esri/core/workers/chunks/e6f2ac738df16fb5e13a.js +0 -1
- package/assets/esri/core/workers/chunks/e8d25d4ca9b335883f34.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{lerp as t,smoothstep as s}from"../../../core/mathUtils.js";import{watch as r,syncAndInitial as i}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{c as n,n as h,e as m,g as c,m as p,l}from"../../../chunks/vec32.js";import{fromValues as u,create as d}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as g}from"../../../geometry/ellipsoidUtils.js";import{InternalRenderCategory as _}from"../webgl.js";import{F as f}from"../../../chunks/Fog.glsl.js";import{FogTechnique as w}from"./FogTechnique.js";import{FogTechniqueConfiguration as P}from"./FogTechniqueConfiguration.js";import{heightLimit as b}from"./weather.js";import{TransparentEnvironment as y}from"../webgl-engine/effects/TransparentEnvironment.js";import{Blit as v}from"../webgl-engine/effects/blit/Blit.js";import{ColorAttachment1 as j,DepthStencilAttachment as F}from"../../webgl/enums.js";const E=.95,R=1;let T=class extends y{constructor(e){super(e),this.consumes={required:[_.TRANSPARENT_ENVIRONMENT]},this._configuration=new P,this.requireGeometryDepth=!0,this._newParameters=new q,this._oldParameters=new q,this._fadedParameters=new q,this._parameters=this._newParameters,this._passParameters=new f,this._blit=null;const t=g(e.view.spatialReference);this._planetRadius=t.radius,this._atmosphereRadius=t.radius+t.atmosphereHeight;const s=e.view.stage.renderView.techniques;s.precompile(w,this._configuration),this._configuration.hasEmissive=!this._configuration.hasEmissive,s.precompile(w,this._configuration),this._configuration.hasEmissive=!this._configuration.hasEmissive}toogle(){this.view.environment.atmosphereEnabled&&this.view.environment.weather?this._enable():this._disable()}initialize(){this.addHandles([r(()=>this.view.environment.atmosphereEnabled,()=>this.toogle(),i),r(()=>this.view.environment.weather,()=>this.toogle(),i),r(()=>this._updateFogParameters(),()=>{},i)]),this.addHandles(r(()=>this._fadeFactor,e=>this._fade(e),i))}get _fadeFactor(){return this.view.stage?.renderer.renderContext.bind.clouds.fadeFactor??1}_fade(e){const{_newParameters:t,_oldParameters:s}=this;e>=1?(this._parameters=t,this._oldParameters.copyFrom(this._newParameters)):e<=0?this._parameters=s:(this._fadedParameters.lerp(s,t,e),this._parameters=this._fadedParameters)}_updateFogParameters(){const e=this.view.environment.weather,s="foggy"===e.type||"snowy"===e.type||"rainy"===e.type;this._newParameters.strength="foggy"===e.type?t(3e-5,.005,e.fogStrength**3):"snowy"===e.type||"rainy"===e.type?t(4e-6,2e-4,(e.precipitation??0)**3):0,this._newParameters.amount=s?1:0,"foggy"!==e.type&&"snowy"!==e.type||n(this._newParameters.color,C),"rainy"===e.type&&n(this._newParameters.color,A),this._fadeFactor>=1&&this._oldParameters.copyFrom(this._newParameters),this.requestRender(1)}render(e){const t=e.find(({name:e})=>e===_.TRANSPARENT_ENVIRONMENT);if(0===this._parameters.amount)return t;if(this._update(),this._passParameters.amount<=0)return t;const s=t.getAttachment(j);this._configuration.hasEmissive=null!=s;const r=this.techniques.get(w,this._configuration);if(!r.compiled)return this.requestRender(1),t;const i=t.getAttachment(F),a=this.renderingContext,{fullWidth:o,fullHeight:n}=this.bindParameters.camera,h=o,m=n;let c=null;return s&&(c=this.fboCache.acquire(h,m,"glow horizontal",8),this._blit??=new v(this.techniques),this._blit.blitTexture(a,s?.attachment,c,this.bindParameters)),t.attachDepth(null),a.bindFramebuffer(t.fbo),s&&(this._passParameters.emission=c?.getTexture()),a.bindTechnique(r,this.bindParameters,this._passParameters),a.screen.draw(),t.attachDepth(i),c?.release(),t}_update(){const e=this.bindParameters.camera;h(N,e.eye);const t=Math.max(0,m(N,this.bindParameters.lighting.mainLight.direction)),r=this._parameters.color;c(x,r,.1),p(this._passParameters.color,x,r,t);const i=l(e.eye);this._passParameters.atmosphereC=i**2-this._atmosphereRadius**2,this._passParameters.amount=(1-s(E*b,R*b,Math.abs(i-this._planetRadius)))*this._parameters.amount,this._passParameters.strength=this._parameters.strength}};e([a()],T.prototype,"consumes",void 0),T=e([o("esri.views.3d.environment.Fog")],T);class q{constructor(){this.color=d(),this.strength=0,this.amount=0}copyFrom(e){this.amount=e.amount,this.strength=e.strength,n(this.color,e.color)}lerp(e,s,r){this.amount=t(e.amount,s.amount,r),this.strength=t(e.strength,s.strength,r),p(this.color,e.color,s.color,r)}}const N=d(),x=d(),A=u(.5,.5,.5),C=u(1.5,1.5,1.5);export{T as Fog,q as FogParameters};
|
|
5
|
+
import{__decorate as e}from"tslib";import{lerp as t,smoothstep as s}from"../../../core/mathUtils.js";import{watch as r,syncAndInitial as i}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{c as n,n as h,e as m,g as c,m as p,l}from"../../../chunks/vec32.js";import{fromValues as u,create as d}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as g}from"../../../geometry/ellipsoidUtils.js";import{InternalRenderCategory as _}from"../webgl.js";import{F as f}from"../../../chunks/Fog.glsl.js";import{FogTechnique as w}from"./FogTechnique.js";import{FogTechniqueConfiguration as P}from"./FogTechniqueConfiguration.js";import{heightLimit as b}from"./weather.js";import{TransparentEnvironment as y}from"../webgl-engine/effects/TransparentEnvironment.js";import{Blit as v}from"../webgl-engine/effects/blit/Blit.js";import{ColorAttachment1 as j,DepthStencilAttachment as F}from"../../webgl/enums.js";const E=.95,R=1;let T=class extends y{constructor(e){super(e),this.consumes={required:[_.TRANSPARENT_ENVIRONMENT]},this._configuration=new P,this.requireGeometryDepth=!0,this._newParameters=new q,this._oldParameters=new q,this._fadedParameters=new q,this._parameters=this._newParameters,this._passParameters=new f,this._blit=null;const t=g(e.view.spatialReference);this._planetRadius=t.radius,this._atmosphereRadius=t.radius+t.atmosphereHeight;const s=e.view.stage.renderView.techniques;s.precompile(w,this._configuration),this._configuration.hasEmissive=!this._configuration.hasEmissive,s.precompile(w,this._configuration),this._configuration.hasEmissive=!this._configuration.hasEmissive}toogle(){this.view.environment.atmosphereEnabled&&this.view.environment.weather?this._enable():this._disable()}initialize(){this.addHandles([r(()=>this.view.environment.atmosphereEnabled,()=>this.toogle(),i),r(()=>this.view.environment.weather,()=>this.toogle(),i),r(()=>this._updateFogParameters(),()=>{},i)]),this.addHandles(r(()=>this._fadeFactor,e=>this._fade(e),i))}get _fadeFactor(){return this.view.stage?.renderer.renderContext.bind.clouds.fadeFactor??1}_fade(e){const{_newParameters:t,_oldParameters:s}=this;e>=1?(this._parameters=t,this._oldParameters.copyFrom(this._newParameters)):e<=0?this._parameters=s:(this._fadedParameters.lerp(s,t,e),this._parameters=this._fadedParameters)}_updateFogParameters(){const e=this.view.environment.weather,s="foggy"===e.type||"snowy"===e.type||"rainy"===e.type;this._newParameters.strength="foggy"===e.type?t(3e-5,.005,e.fogStrength**3):"snowy"===e.type||"rainy"===e.type?t(4e-6,2e-4,(e.precipitation??0)**3):0,this._newParameters.amount=s?1:0,"foggy"!==e.type&&"snowy"!==e.type||n(this._newParameters.color,C),"rainy"===e.type&&n(this._newParameters.color,A),this._fadeFactor>=1&&this._oldParameters.copyFrom(this._newParameters),this.requestRender(1)}render(e){const t=e.find(({name:e})=>e===_.TRANSPARENT_ENVIRONMENT);if(0===this._parameters.amount)return t;if(this._update(),this._passParameters.amount<=0)return t;const s=t.getAttachment(j);this._configuration.hasEmissive=null!=s;const r=this.techniques.get(w,this._configuration);if(!r.compiled)return this.requestRender(1),t;const i=t.getAttachment(F),a=this.renderingContext,{fullWidth:o,fullHeight:n}=this.bindParameters.camera,h=o,m=n;let c=null;return s&&(c=this.fboCache.acquire(h,m,"glow horizontal",8),this._blit??=new v(this.techniques),this._blit.blitTexture(a,s?.attachment,c,this.bindParameters)),t.attachDepth(null),a.bindFramebuffer(t.fbo),s&&(this._passParameters.emission=c?.getTexture()),a.bindTechnique(r,this.bindParameters,this._passParameters),a.screen.draw(),t.attachDepth(i),c?.release(),t}_update(){const e=this.bindParameters.camera;h(N,e.eye);const t=Math.max(0,m(N,this.bindParameters.lighting.mainLight.direction)),r=this._parameters.color;c(x,r,.1),p(this._passParameters.color,x,r,t);const i=l(e.eye);this._passParameters.atmosphereC=i**2-this._atmosphereRadius**2,this._passParameters.amount=(1-s(E*b,R*b,Math.abs(i-this._planetRadius)))*this._parameters.amount,this._passParameters.strength=this._parameters.strength}get test(){return{parameters:this._passParameters}}};e([a()],T.prototype,"consumes",void 0),T=e([o("esri.views.3d.environment.Fog")],T);class q{constructor(){this.color=d(),this.strength=0,this.amount=0}copyFrom(e){this.amount=e.amount,this.strength=e.strength,n(this.color,e.color)}lerp(e,s,r){this.amount=t(e.amount,s.amount,r),this.strength=t(e.strength,s.strength,r),p(this.color,e.color,s.color,r)}}const N=d(),x=d(),A=u(.5,.5,.5),C=u(1.5,1.5,1.5);export{T as Fog,q as FogParameters};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../core/has.js";import{c as e,d as t,q as r,u as i}from"../../../../chunks/vec32.js";import{create as s,fromValues as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{a,d as o}from"../../../../chunks/vec42.js";import{fromValues as l,clone as h}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromRay as d,create as _,getStart as p,getEnd as c}from"../../../../geometry/support/clipRay.js";import{intersectClipRay as u}from"../../../../geometry/support/frustum.js";import{create as f,fromPoints as m,pointAt as y}from"../../../../geometry/support/lineSegment.js";import{create as g,fromPoints as b}from"../../../../geometry/support/ray.js";import{EngineVisualElement as D}from"./EngineVisualElement.js";import{LaserlineVisualElement as
|
|
5
|
+
import"../../../../core/has.js";import{c as e,d as t,q as r,u as i}from"../../../../chunks/vec32.js";import{create as s,fromValues as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{a,d as o}from"../../../../chunks/vec42.js";import{fromValues as l,clone as h}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromRay as d,create as _,getStart as p,getEnd as c}from"../../../../geometry/support/clipRay.js";import{intersectClipRay as u}from"../../../../geometry/support/frustum.js";import{create as f,fromPoints as m,pointAt as y}from"../../../../geometry/support/lineSegment.js";import{create as g,fromPoints as b}from"../../../../geometry/support/ray.js";import{EngineVisualElement as D}from"./EngineVisualElement.js";import{LaserlineVisualElement as w}from"./LaserlineVisualElement.js";import{drapedZ as O}from"../../terrain/OverlayRenderer.js";import{createPolylineGeometry as j}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderGeometry as C}from"../../webgl-engine/lib/RenderGeometry.js";import{RibbonLineMaterial as E}from"../../webgl-engine/materials/RibbonLineMaterial.js";class G extends D{constructor(e){super(e),this._ray=g(),this._isWorldDown=!1,this._start=s(),this._end=n(1,0,0),this._width=1,this._color=l(1,0,1,1),this._polygonOffset=!1,this._writeDepthEnabled=!0,this._innerWidth=0,this._innerColor=l(1,1,1,1),this._stipplePattern=null,this._stippleOffColor=null,this._stipplePreferContinuous=!0,this._falloff=0,this._extensionType=0,this._laserlineStyle=null,this._laserlineEnabled=!1,this._renderOccluded=4,this._fadedExtensions=A,this._laserline=new w({view:this.view,isDecoration:e.isDecoration}),this.applyProperties(e)}destroy(){this._laserline.destroy(),super.destroy()}createObject3DResourceFactory(e){return{view:e,createResources:e=>this._createObject3DResources(e),destroyResources:x,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:x,recreateGeometry:e=>this._recreateDrapedGeometry(e),forEachMaterial:(e,t)=>t(e.material)}}updateVisibility(e){super.updateVisibility(e),this._laserline.visible=e}onAttachedChange(){this._laserline.attached=this._laserlineAttached}setStartEndFromWorldDownAtLocation(r){this._isWorldDown=!0,e(this._start,r),this.view.renderCoordsHelper.worldUpAtPosition(r,this._end),t(this._end,r,this._end),b(this._start,this._end,this._ray),this._updateGeometry()}get start(){return this._start}set start(t){this._isWorldDown=!1,r(this._start,t)||(e(this._start,t),b(this._start,this._end,this._ray),this._updateGeometry())}get end(){return this._end}set end(t){this._isWorldDown=!1,r(this._end,t)||(e(this._end,t),b(this._start,this._end,this._ray),this._updateGeometry())}get width(){return this._width}set width(e){e!==this._width&&(this._width=e,this._updateMaterial())}get color(){return this._color}set color(e){a(e,this._color)||(o(this._color,e),this._updateMaterial())}get polygonOffset(){return this._polygonOffset}set polygonOffset(e){e!==this._polygonOffset&&(this._polygonOffset=e,this._updateMaterial())}get writeDepthEnabled(){return this._writeDepthEnabled}set writeDepthEnabled(e){this._writeDepthEnabled!==e&&(this._writeDepthEnabled=e,this._updateMaterial())}get innerWidth(){return this._innerWidth}set innerWidth(e){e!==this._innerWidth&&(this._innerWidth=e,this._updateMaterial())}get innerColor(){return this._innerColor}set innerColor(e){a(e,this._innerColor)||(o(this._innerColor,e),this._updateMaterial())}get stipplePattern(){return this._stipplePattern}set stipplePattern(e){const t=null!=e!=(null!=this._stipplePattern);this._stipplePattern=e,t?this.recreate():this._updateMaterial()}get stippleOffColor(){return this._stippleOffColor}set stippleOffColor(e){null!=e&&null!=this._stippleOffColor&&a(e,this._stippleOffColor)||(this._stippleOffColor=null!=e?h(e):null,this._updateMaterial())}get stipplePreferContinuous(){return this._stipplePreferContinuous}set stipplePreferContinuous(e){e!==this._stipplePreferContinuous&&(this._stipplePreferContinuous=e,this._updateMaterial())}get falloff(){return this._falloff}set falloff(e){e!==this._falloff&&(this._falloff=e,this._updateMaterial())}get extensionType(){return this._extensionType}set extensionType(e){e!==this._extensionType&&(this._extensionType=e,this.recreateGeometry())}get _laserlineAttached(){return this._laserlineEnabled&&null!=this._laserlineStyle&&this.attached&&!this.isDraped}get laserlineStyle(){return this._laserlineStyle}set laserlineStyle(e){this._laserlineStyle=e,this._laserline.attached=this._laserlineAttached,null!=e&&(this._laserline.style=e)}get laserlineEnabled(){return this._laserlineEnabled}set laserlineEnabled(e){this._laserlineEnabled!==e&&(this._laserlineEnabled=e,this._laserline.attached=this._laserlineAttached)}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateMaterial())}get _normalizedRenderOccluded(){return this.isDraped&&8===this._renderOccluded?4:this._renderOccluded}get fadedExtensions(){return this._fadedExtensions}set fadedExtensions(e){this._fadedExtensions=e??A,this.recreateGeometry()}_updateMaterial(){const{materialParameters:e}=this;this.object3dResources.resources?.material.setParameters(e),this.drapedResources.resources?.material.setParameters(e)}get materialParameters(){return{width:this._width,color:this._color,stippleOffColor:this._stippleOffColor,stipplePattern:this._stipplePattern,stipplePreferContinuous:this._stipplePreferContinuous,innerWidth:this._innerWidth,innerColor:this._innerColor,falloff:this._falloff,hasPolygonOffset:this._polygonOffset,renderOccluded:this._normalizedRenderOccluded,isDecoration:this.isDecoration,writeDepth:this._writeDepthEnabled}}_createObject3DResources(e){const t=new E(this.materialParameters,this.view.state.isGlobal),r=new Array;return this._createObject3DGeometry(t,e,r),{material:t,geometries:r}}_recreateObject3DGeometry(e,t){e.geometries.length=0,this._createObject3DGeometry(e.material,t,e.geometries)}_createObject3DGeometry(e,t,r){const i=this._createGeometry(e);r.push(i),t.addGeometry(i),this._updateVerticesObject3D(t)}_createDrapedResources(){const e=new E(this.materialParameters,this.view.state.isGlobal);return{material:e,geometries:[this._createDrapedGeometry(e)]}}_recreateDrapedGeometry(e){e.geometries=[this._createDrapedGeometry(e.material)]}_createDrapedGeometry(e){const t=this._createGeometry(e);return this._updateVerticesDraped(t),new C(t)}_createGeometry(e){const t=3===this.extensionType,r=t?[s(),s(),s(),s()]:[s(),s()];return j(e,r,null,t?[1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0]:null)}_updateGeometry(){if(this.isDraped)this.drapedResources.recreateGeometry();else{const e=this.object3dResources.object;e&&this._updateVerticesObject3D(e)}}_updateVerticesObject3D(e){const t=this._lineSegment;this._updateVertexAttributesObject3D(e,t),this._laserline.intersectsLine=t}_updateVerticesDraped(e){this._updateVertexAttributesDraped(e,this._lineSegment)}get _lineSegment(){return 3===this._extensionType?this._updateLineSegmentFinite(M):this._updateLineSegmentInfinite(this._extensionType,M)}_updateLineSegmentFinite(e){return m(this._start,this._end,e)}_updateLineSegmentInfinite(e,t){const r=this.view.state.camera;switch(d(this._ray,P),e){case 0:P.c0=-Number.MAX_VALUE;break;case 1:case 2:{const e=this._ray.origin,t=this.view.elevationProvider.getElevation(e[0],e[1],e[2],this.view.renderCoordsHelper.spatialReference,"ground")??0,r=this.view.renderCoordsHelper.getAltitude(e);this._isWorldDown&&r<t&&i(P.ray.direction,P.ray.direction),2===this._extensionType&&null!=t&&(P.c1=Math.abs(r-t));break}}if(!u(r.frustum,P))return this._updateLineSegmentFinite(t);const s=p(P,v),n=c(P,R);return m(s,n,t)}_updateVertexAttributesObject3D(e,t){const r=e.geometries[0].getMutableAttribute("position")?.data;if(!r)return;let i=0;for(const s of this._lineVertices(t))r[i++]=s[0],r[i++]=s[1],r[i++]=s[2];e.geometryVertexAttributeUpdated(e.geometries[0],"position")}_updateVertexAttributesDraped(e,t){const r=e.getMutableAttribute("position")?.data;if(!r)return;let i=0;for(const s of this._lineVertices(t))r[i++]=s[0],r[i++]=s[1],r[i++]=O;e.invalidateBoundingInfo()}*_lineVertices(e){3===this.extensionType?(yield y(e,-this.fadedExtensions.start,v),yield y(e,0,v),yield y(e,1,v),yield y(e,1+this.fadedExtensions.end,v)):(yield y(e,0,v),yield y(e,1,v))}}function x(e){e.geometries=[]}const P=_(),v=s(),R=s(),M=f(),V=1/3,A={start:V,end:V};export{G as ExtendedLineVisualElement};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{fromTranslation as e}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as r,t as s}from"../../../../chunks/vec32.js";import{create as o,ZEROS as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{Object3DVisualElement as n}from"./Object3DVisualElement.js";import{lineStripsToParameters as l,createGeometry as m}from"../../support/engineContent/line.js";import{RibbonLineMaterial as h}from"../../webgl-engine/materials/RibbonLineMaterial.js";class p extends n{constructor(e,t){super(e),this._hasExternalMaterial=!1,this._hasExternalMaterial=null!=t,this._material=t??new h({width:1,color:a(1,0,1,1),stipplePreferContinuous:!0,isClosed:!1,falloff:0,innerWidth:1,hasPolygonOffset:!1,renderOccluded:4,isDecoration:!!e.isDecoration,writeDepth:!0}),this.applyProperties(e)}setGeometryFromPoint(e,t=1e3){const r=o();this.view.renderCoordsHelper.toRenderCoords(e,r)&&this.setGeometryFromRenderSpacePoint(r,t)}setGeometryFromRenderSpacePoint(e,t=1e3){this.geometry=[[[e[0]-t,e[1],e[2]],[e[0]+t,e[1],e[2]]],[[e[0],e[1]-t,e[2]],[e[0],e[1]+t,e[2]]],[[e[0],e[1],e[2]-t],[e[0],e[1],e[2]+t]]]}setGeometryFromExtent(e){const t=this.view.spatialReference,s=o(),i=o(),a=100,n=[];r(s,e[0],e[1],a),this.view.renderCoordsHelper.toRenderCoords(s,t,i),n.push([i[0],i[1],i[2]]),r(s,e[2],e[1],a),this.view.renderCoordsHelper.toRenderCoords(s,t,i),n.push([i[0],i[1],i[2]]),r(s,e[2],e[3],a),this.view.renderCoordsHelper.toRenderCoords(s,t,i),n.push([i[0],i[1],i[2]]),r(s,e[0],e[3],a),this.view.renderCoordsHelper.toRenderCoords(s,t,i),n.push([i[0],i[1],i[2]]),r(s,e[0],e[1],a),this.view.renderCoordsHelper.toRenderCoords(s,t,i),n.push([i[0],i[1],i[2]]),r(s,e[0],e[1],a),this.view.renderCoordsHelper.toRenderCoords(s,t,i),n.push([i[0],i[1],i[2]]),this.geometry=[n]}setGeometryFromFrustum(e){const t=[];e.lines.forEach(e=>{t.push([e.origin[0],e.origin[1],e.origin[2]]),t.push([e.endpoint[0],e.endpoint[1],e.endpoint[2]])}),this.geometry=[t]}setGeometryFromBoundedPlane(e){const t=[],r=e.origin,s=e.basis1,i=e.basis2,a=.5,n=o(),l=o(),m=o(),h=o();n[0]=r[0]-s[0]*a-i[0]*a,n[1]=r[1]-s[1]*a-i[1]*a,n[2]=r[2]-s[2]*a-i[2]*a,l[0]=r[0]-s[0]*a+i[0]*a,l[1]=r[1]-s[1]*a+i[1]*a,l[2]=r[2]-s[2]*a+i[2]*a,m[0]=r[0]+s[0]*a+i[0]*a,m[1]=r[1]+s[1]*a+i[1]*a,m[2]=r[2]+s[2]*a+i[2]*a,h[0]=r[0]+s[0]*a-i[0]*a,h[1]=r[1]+s[1]*a-i[1]*a,h[2]=r[2]+s[2]*a-i[2]*a,t.push([n[0],n[1],n[2]]),t.push([l[0],l[1],l[2]]),t.push([m[0],m[1],m[2]]),t.push([h[0],h[1],h[2]]),t.push([n[0],n[1],n[2]]),this.geometry=[t]}setGeometryFromSegment(t){const r=t.endRenderSpace;this.transform=e(d,r);const{points:s}=t.createRenderGeometry(r,this.view.renderCoordsHelper);this.geometry=[s]}setGeometryFromSegments(t,r=i){this.transform=e(d,r),this.geometry=t.map(e=>e.createRenderGeometry(r,this.view.renderCoordsHelper).points)}getTransformedGeometry(){return null==this._geometry?null:this._geometry.map(e=>e.map(e=>s(o(),e,this.transform)))}get renderOccluded(){return this._material.parameters.renderOccluded}set renderOccluded(e){this._material.setParameters({renderOccluded:e})}get geometry(){return this._geometry}set geometry(e){this._geometry=e,this.recreateGeometry()}get width(){return this._material.parameters.width}set width(e){this._material.setParameters({width:e})}get color(){return this._material.parameters.color}set color(e){const t=1===e[3];this._material.setParameters({color:e,writeDepth:t})}get innerWidth(){return this._material.parameters.innerWidth}set innerWidth(e){this._material.setParameters({innerWidth:e})}get innerColor(){return this._material.parameters.innerColor}set innerColor(e){this._material.setParameters({innerColor:e})}get stipplePattern(){return this._material.parameters.stipplePattern}set stipplePattern(e){null!=this._material&&this._material.setParameters({stipplePattern:e})}get stippleOffColor(){return this._material.parameters.stippleOffColor}set stippleOffColor(e){this._material.setParameters({stippleOffColor:e})}get stipplePreferContinuous(){return this._material.parameters.stipplePreferContinuous}set stipplePreferContinuous(e){this._material.setParameters({stipplePreferContinuous:e})}get falloff(){return this._material.parameters.falloff}set falloff(e){this._material.setParameters({falloff:e})}get polygonOffset(){return this._material.parameters.hasPolygonOffset}set polygonOffset(e){this._material.setParameters({hasPolygonOffset:e})}createExternalResources(){}destroyExternalResources(){}createGeometries(e){for(const t of l(this.geometry)){const r=m(this._material,t);e.addGeometry(r)}}forEachMaterial(e){this._hasExternalMaterial||e(this._material)}}const d=t();export{p as LineVisualElement};
|
|
5
|
+
import{fromTranslation as e}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as r,t as s}from"../../../../chunks/vec32.js";import{create as o,ZEROS as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{Object3DVisualElement as n}from"./Object3DVisualElement.js";import{lineStripsToParameters as l,createGeometry as m}from"../../support/engineContent/line.js";import{RibbonLineMaterial as h}from"../../webgl-engine/materials/RibbonLineMaterial.js";class p extends n{constructor(e,t){super(e),this._hasExternalMaterial=!1,this._hasExternalMaterial=null!=t,this._material=t??new h({width:1,color:a(1,0,1,1),stipplePreferContinuous:!0,isClosed:!1,falloff:0,innerWidth:1,hasPolygonOffset:!1,renderOccluded:4,isDecoration:!!e.isDecoration,writeDepth:!0},e.view.state.isGlobal),this.applyProperties(e)}setGeometryFromPoint(e,t=1e3){const r=o();this.view.renderCoordsHelper.toRenderCoords(e,r)&&this.setGeometryFromRenderSpacePoint(r,t)}setGeometryFromRenderSpacePoint(e,t=1e3){this.geometry=[[[e[0]-t,e[1],e[2]],[e[0]+t,e[1],e[2]]],[[e[0],e[1]-t,e[2]],[e[0],e[1]+t,e[2]]],[[e[0],e[1],e[2]-t],[e[0],e[1],e[2]+t]]]}setGeometryFromExtent(e){const t=this.view.spatialReference,s=o(),i=o(),a=100,n=[];r(s,e[0],e[1],a),this.view.renderCoordsHelper.toRenderCoords(s,t,i),n.push([i[0],i[1],i[2]]),r(s,e[2],e[1],a),this.view.renderCoordsHelper.toRenderCoords(s,t,i),n.push([i[0],i[1],i[2]]),r(s,e[2],e[3],a),this.view.renderCoordsHelper.toRenderCoords(s,t,i),n.push([i[0],i[1],i[2]]),r(s,e[0],e[3],a),this.view.renderCoordsHelper.toRenderCoords(s,t,i),n.push([i[0],i[1],i[2]]),r(s,e[0],e[1],a),this.view.renderCoordsHelper.toRenderCoords(s,t,i),n.push([i[0],i[1],i[2]]),r(s,e[0],e[1],a),this.view.renderCoordsHelper.toRenderCoords(s,t,i),n.push([i[0],i[1],i[2]]),this.geometry=[n]}setGeometryFromFrustum(e){const t=[];e.lines.forEach(e=>{t.push([e.origin[0],e.origin[1],e.origin[2]]),t.push([e.endpoint[0],e.endpoint[1],e.endpoint[2]])}),this.geometry=[t]}setGeometryFromBoundedPlane(e){const t=[],r=e.origin,s=e.basis1,i=e.basis2,a=.5,n=o(),l=o(),m=o(),h=o();n[0]=r[0]-s[0]*a-i[0]*a,n[1]=r[1]-s[1]*a-i[1]*a,n[2]=r[2]-s[2]*a-i[2]*a,l[0]=r[0]-s[0]*a+i[0]*a,l[1]=r[1]-s[1]*a+i[1]*a,l[2]=r[2]-s[2]*a+i[2]*a,m[0]=r[0]+s[0]*a+i[0]*a,m[1]=r[1]+s[1]*a+i[1]*a,m[2]=r[2]+s[2]*a+i[2]*a,h[0]=r[0]+s[0]*a-i[0]*a,h[1]=r[1]+s[1]*a-i[1]*a,h[2]=r[2]+s[2]*a-i[2]*a,t.push([n[0],n[1],n[2]]),t.push([l[0],l[1],l[2]]),t.push([m[0],m[1],m[2]]),t.push([h[0],h[1],h[2]]),t.push([n[0],n[1],n[2]]),this.geometry=[t]}setGeometryFromSegment(t){const r=t.endRenderSpace;this.transform=e(d,r);const{points:s}=t.createRenderGeometry(r,this.view.renderCoordsHelper);this.geometry=[s]}setGeometryFromSegments(t,r=i){this.transform=e(d,r),this.geometry=t.map(e=>e.createRenderGeometry(r,this.view.renderCoordsHelper).points)}getTransformedGeometry(){return null==this._geometry?null:this._geometry.map(e=>e.map(e=>s(o(),e,this.transform)))}get renderOccluded(){return this._material.parameters.renderOccluded}set renderOccluded(e){this._material.setParameters({renderOccluded:e})}get geometry(){return this._geometry}set geometry(e){this._geometry=e,this.recreateGeometry()}get width(){return this._material.parameters.width}set width(e){this._material.setParameters({width:e})}get color(){return this._material.parameters.color}set color(e){const t=1===e[3];this._material.setParameters({color:e,writeDepth:t})}get innerWidth(){return this._material.parameters.innerWidth}set innerWidth(e){this._material.setParameters({innerWidth:e})}get innerColor(){return this._material.parameters.innerColor}set innerColor(e){this._material.setParameters({innerColor:e})}get stipplePattern(){return this._material.parameters.stipplePattern}set stipplePattern(e){null!=this._material&&this._material.setParameters({stipplePattern:e})}get stippleOffColor(){return this._material.parameters.stippleOffColor}set stippleOffColor(e){this._material.setParameters({stippleOffColor:e})}get stipplePreferContinuous(){return this._material.parameters.stipplePreferContinuous}set stipplePreferContinuous(e){this._material.setParameters({stipplePreferContinuous:e})}get falloff(){return this._material.parameters.falloff}set falloff(e){this._material.setParameters({falloff:e})}get polygonOffset(){return this._material.parameters.hasPolygonOffset}set polygonOffset(e){this._material.setParameters({hasPolygonOffset:e})}createExternalResources(){}destroyExternalResources(){}createGeometries(e){for(const t of l(this.geometry)){const r=m(this._material,t);e.addGeometry(r)}}forEachMaterial(e){this._hasExternalMaterial||e(this._material)}}const d=t();export{p as LineVisualElement};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{fromTranslation as e}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as r,clone as i}from"../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{Object3DVisualElement as a}from"./Object3DVisualElement.js";import{lineStripsToParameters as s,createGeometry as m}from"../../support/engineContent/line.js";import{LineMarkerMaterial as l}from"../../webgl-engine/materials/LineMarkerMaterial.js";class o extends a{constructor(e,t){super(e),this._hasExternalMaterial=!1,this._renderOccluded=4,this._width=1,this._color=r(1,0,1,1),this._placement="end",this._markerPrimitive="arrow",this._material=t,this._hasExternalMaterial=null!=t,this.applyProperties(e)}setGeometryFromSegment(t,r){const i=t.endRenderSpace;this.transform=e(h,i),this._normal=r;const{points:a}=t.createRenderGeometry(i,this.view.renderCoordsHelper);this.geometry=[a]}get renderOccluded(){return this._material?.parameters.renderOccluded??this._renderOccluded}set renderOccluded(e){this._renderOccluded=e,this._material?.setParameters({renderOccluded:e})}get geometry(){return this._geometry}set geometry(e){this._geometry=e,this.recreateGeometry()}get normal(){return this._normal}set normal(e){this._normal=e,this.recreateGeometry()}get width(){return this._material?.parameters.width??this._width}set width(e){this._width=e,this._material?.setParameters({width:e})}get color(){return this._material?.parameters.color??this._color}set color(e){this._color=i(e),this._material?.setParameters({color:this._color})}get placement(){return this._material?.parameters.placement??this._placement}set placement(e){this._placement=e,this._material?.setParameters({placement:this._placement})}get markerPrimitive(){return this._material?.parameters.markerPrimitive??this._markerPrimitive}set markerPrimitive(e){this._markerPrimitive=e,this._material?.setParameters({markerPrimitive:e})}createExternalResources(){this._hasExternalMaterial||(this._material=new l({width:this._width,color:this._color,placement:this._placement,renderOccluded:this._renderOccluded,markerPrimitive:this._markerPrimitive,isDecoration:this.isDecoration}))}destroyExternalResources(){this._hasExternalMaterial||(this._material=null)}createGeometries(e){for(const t of s(this.geometry,this.normal)){const r=m(this._material,t);e.addGeometry(r)}}forEachMaterial(e){this._hasExternalMaterial||e(this._material)}}const h=t();export{o as MarkerVisualElement};
|
|
5
|
+
import{fromTranslation as e}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as r,clone as i}from"../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{Object3DVisualElement as a}from"./Object3DVisualElement.js";import{lineStripsToParameters as s,createGeometry as m}from"../../support/engineContent/line.js";import{LineMarkerMaterial as l}from"../../webgl-engine/materials/LineMarkerMaterial.js";class o extends a{constructor(e,t){super(e),this._hasExternalMaterial=!1,this._renderOccluded=4,this._width=1,this._color=r(1,0,1,1),this._placement="end",this._markerPrimitive="arrow",this._material=t,this._hasExternalMaterial=null!=t,this.applyProperties(e)}setGeometryFromSegment(t,r){const i=t.endRenderSpace;this.transform=e(h,i),this._normal=r;const{points:a}=t.createRenderGeometry(i,this.view.renderCoordsHelper);this.geometry=[a]}get renderOccluded(){return this._material?.parameters.renderOccluded??this._renderOccluded}set renderOccluded(e){this._renderOccluded=e,this._material?.setParameters({renderOccluded:e})}get geometry(){return this._geometry}set geometry(e){this._geometry=e,this.recreateGeometry()}get normal(){return this._normal}set normal(e){this._normal=e,this.recreateGeometry()}get width(){return this._material?.parameters.width??this._width}set width(e){this._width=e,this._material?.setParameters({width:e})}get color(){return this._material?.parameters.color??this._color}set color(e){this._color=i(e),this._material?.setParameters({color:this._color})}get placement(){return this._material?.parameters.placement??this._placement}set placement(e){this._placement=e,this._material?.setParameters({placement:this._placement})}get markerPrimitive(){return this._material?.parameters.markerPrimitive??this._markerPrimitive}set markerPrimitive(e){this._markerPrimitive=e,this._material?.setParameters({markerPrimitive:e})}createExternalResources(){this._hasExternalMaterial||(this._material=new l({width:this._width,color:this._color,placement:this._placement,renderOccluded:this._renderOccluded,markerPrimitive:this._markerPrimitive,isDecoration:this.isDecoration},this.view.state.isGlobal))}destroyExternalResources(){this._hasExternalMaterial||(this._material=null)}createGeometries(e){for(const t of s(this.geometry,this.normal)){const r=m(this._material,t);e.addGeometry(r)}}forEachMaterial(e){this._hasExternalMaterial||e(this._material)}}const h=t();export{o as MarkerVisualElement};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{EventEmitter as e}from"../../../../core/Evented.js";import{i as t,f as r,g as i}from"../../../../chunks/vec32.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{a
|
|
5
|
+
import{EventEmitter as e}from"../../../../core/Evented.js";import{i as t,f as r,g as i}from"../../../../chunks/vec32.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{a,d as o}from"../../../../chunks/vec42.js";import{fromValues as n,clone as l}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{projectBuffer as h}from"../../../../geometry/projection/projectBuffer.js";import{expandWithBuffer as c}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as d}from"../../../../geometry/support/DoubleArray.js";import{makeDehydratedPoint as m}from"../../../../layers/graphics/dehydratedPoint.js";import{getGeometryEffectiveElevationMode as p}from"../../../../support/elevationInfoUtils.js";import u from"../../../../symbols/support/ElevationInfo.js";import{EngineVisualElement as _}from"./EngineVisualElement.js";import{LaserlineVisualElement as f}from"./LaserlineVisualElement.js";import{ElevationContext as g}from"../../layers/graphics/ElevationContext.js";import{createGeometry as y}from"../../support/engineContent/line.js";import{geometryToRenderInfoDraped as O,geometryToRenderInfo as C}from"../../support/renderInfoUtils/line.js";import{RenderGeometry as v}from"../../webgl-engine/lib/RenderGeometry.js";import{RibbonLineMaterial as w}from"../../webgl-engine/materials/RibbonLineMaterial.js";class R extends _{constructor(t){super(t),this._attachmentOrigin=m(0,0,0,null),this._attachmentOriginDirty=!0,this.events=new e,this._geometry=null,this._width=1,this._color=n(1,0,1,1),this._innerWidth=0,this._innerColor=n(1,1,1,1),this._stipplePattern=null,this._stippleOffColor=null,this._falloff=0,this._elevationInfo=null,this._laserlineStyle=null,this._laserlineEnabled=!1,this._renderOccluded=8,this._attachmentOrigin.spatialReference=t.view.spatialReference,this._laserline=new f({view:t.view,isDecoration:t.isDecoration}),this.applyProperties(t),this.attached=t.attached??!0}destroy(){this._laserline.destroy(),super.destroy()}createObject3DResourceFactory(e){return{view:e,createResources:e=>this._createObject3DResources(e),destroyResources:b,recreateGeometry:(e,t)=>{e.geometries.length=0,this._recreateGeometry(t,e.material,e.geometries)},forEachMaterial:(e,t)=>t(e.material)}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:b,recreateGeometry:e=>{e.geometries=this._createRenderGeometriesDraped(e.material),this._attachmentOriginChanged()},forEachMaterial:(e,t)=>t(e.material)}}get _laserlineAttached(){return this.attached&&this.visible&&null!=this._laserlineStyle&&!this.isDraped&&this.laserlineEnabled}onAttachedChange(e){this._laserline.attached=this._laserlineAttached,e&&this._attachmentOriginChanged()}get isDecoration(){return this._isDecoration}set isDecoration(e){this._isDecoration=e,this._updateMaterial()}get geometry(){return this._geometry}set geometry(e){const t=this._isClosed;this._geometry=e,this.recreateGeometry(),t!==this._isClosed&&this._updateMaterial()}get width(){return this._width}set width(e){e!==this._width&&(this._width=e,this._updateMaterial())}get color(){return this._color}set color(e){a(e,this._color)||(o(this._color,e),this._updateMaterial())}get innerWidth(){return this._innerWidth}set innerWidth(e){e!==this._innerWidth&&(this._innerWidth=e,this._updateMaterial())}get innerColor(){return this._innerColor}set innerColor(e){a(e,this._innerColor)||(o(this._innerColor,e),this._updateMaterial())}get stipplePattern(){return this._stipplePattern}set stipplePattern(e){const t=null!=e!=(null!=this._stipplePattern);this._stipplePattern=e,t?this.recreate():this._updateMaterial()}get stippleOffColor(){return this._stippleOffColor}set stippleOffColor(e){e&&this._stippleOffColor&&a(e,this._stippleOffColor)||(this._stippleOffColor=e?l(e):null,this._updateMaterial())}get falloff(){return this._falloff}set falloff(e){e!==this._falloff&&(this._falloff=e,this._updateMaterial())}get elevationInfo(){return this._elevationInfo}set elevationInfo(e){this._elevationInfo=e,this.recreateGeometry()}get laserlineStyle(){return this._laserlineStyle}set laserlineStyle(e){this._laserlineStyle=e,this._laserline.attached=this._laserlineAttached,null!=e&&(this._laserline.style=e)}get laserlineEnabled(){return this._laserlineEnabled}set laserlineEnabled(e){this._laserlineEnabled!==e&&(this._laserlineEnabled=e,this._laserline.attached=this._laserlineAttached)}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateMaterial())}get attachmentOrigin(){if(!this._attachmentOriginDirty)return this._attachmentOrigin;const e=this.object3dResources.resources?.geometries;if(!e||0===e.length)return null;t(D,0,0,0);let s=0;for(const t of e)t.computeAttachmentOrigin(j)&&(r(D,D,j),s++);return 0===s?null:(i(D,D,1/s),this.view.renderCoordsHelper.fromRenderCoords(D,this._attachmentOrigin),this._attachmentOriginDirty=!1,this._attachmentOrigin)}_updateMaterial(){this.object3dResources.resources?.material.setParameters(this._materialParameters),this.drapedResources.resources?.material.setParameters(this._materialParameters)}get _isClosed(){return null!=this.geometry&&"polygon"===this.geometry.type}get _materialParameters(){return{width:this._width,color:this._color,stippleOffColor:this._stippleOffColor,stipplePattern:this._stipplePattern,stipplePreferContinuous:!1,isClosed:this._isClosed,falloff:this._falloff,innerColor:this._innerColor,innerWidth:this._innerWidth,join:"round",hasPolygonOffset:!0,renderOccluded:this._normalizedRenderOccluded,isDecoration:this.isDecoration}}get _normalizedRenderOccluded(){return this.isDraped&&8===this._renderOccluded?4:this._renderOccluded}_recreateGeometry(e,t,r){this._createRenderGeometries(t,r);for(const i of r)e.addGeometry(i);this._attachmentOriginChanged()}_attachmentOriginChanged(){this._attachmentOriginDirty=!0,this.events.emit("attachment-origin-changed")}_createObject3DResources(e){const t=new w(this._materialParameters,this.view.state.isGlobal),r=new Array;return this._recreateGeometry(e,t,r),{material:t,geometries:r}}_createDrapedResources(){const e=new w(this._materialParameters,this.view.state.isGlobal);return{material:e,geometries:this._createRenderGeometriesDraped(e)}}_createRenderGeometriesDraped(e){const{geometry:t,view:r}=this,i=r.basemapTerrain.spatialReference;if(null==t||null==i)return[];return O(t,i).lines.map(({position:t})=>{const s={overlayInfo:{spatialReference:i,renderCoordsHelper:r.renderCoordsHelper},attributeData:{position:t},removeDuplicateStartEnd:this._isClosed};return new v(y(e,s))})}calculateMapBounds(e){if(null==this.object3dResources.resources)return!1;const t=this.view.renderCoordsHelper;for(const r of this.object3dResources.resources.geometries){const i=r.attributes.get("position"),s=d(i.data.length);h(i.data,t.spatialReference,0,s,this.view.spatialReference,0),c(e,s)}return!0}_createRenderGeometries(e,t){const r=this.geometry;if(null==r)return;const i=C(r,this.view.elevationProvider,this.view.renderCoordsHelper,g.fromElevationInfo(this.elevationInfo??new u({mode:p(r,null)}))),s=new Array;for(const{position:a,mapPositions:o}of i.lines){const r={mapPositions:o,attributeData:{position:a},removeDuplicateStartEnd:this._isClosed};t.push(y(e,r)),s.push(a)}this._laserline.pathVerticalPlane=s}}function b(e){e.geometries=[]}const j=s(),D=s();export{R as OutlineVisualElement};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{watch as e}from"../../../../core/reactiveUtils.js";import{createScreenPointArray as t,castScreenPointArray as r}from"../../../../core/screenUtils.js";import{normalize as i,subtract as s,scale as o,set as a,add as c}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{q as d,c as h,n as l,d as m,f as u}from"../../../../chunks/vec32.js";import{create as p,fromValues as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{a as f,d as g}from"../../../../chunks/vec42.js";import{fromValues as b}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeDehydratedPoint as y}from"../../../../layers/graphics/dehydratedPoint.js";import{EngineVisualElement as j}from"./EngineVisualElement.js";import{drapedZ as D}from"../../terrain/OverlayRenderer.js";import{createPolylineGeometry as G}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderGeometry as
|
|
5
|
+
import{watch as e}from"../../../../core/reactiveUtils.js";import{createScreenPointArray as t,castScreenPointArray as r}from"../../../../core/screenUtils.js";import{normalize as i,subtract as s,scale as o,set as a,add as c}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{q as d,c as h,n as l,d as m,f as u}from"../../../../chunks/vec32.js";import{create as p,fromValues as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{a as f,d as g}from"../../../../chunks/vec42.js";import{fromValues as b}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeDehydratedPoint as y}from"../../../../layers/graphics/dehydratedPoint.js";import{EngineVisualElement as j}from"./EngineVisualElement.js";import{drapedZ as D}from"../../terrain/OverlayRenderer.js";import{createPolylineGeometry as G}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderGeometry as w}from"../../webgl-engine/lib/RenderGeometry.js";import{RibbonLineMaterial as R}from"../../webgl-engine/materials/RibbonLineMaterial.js";class O extends j{constructor(e){super(e),this._location=p(),this._direction=_(1,0,0),this._width=1,this._offset=1,this._length=18,this._color=b(1,0,1,1),this._renderOccluded=4,this.applyProperties(e)}createObject3DResourceFactory(e){return{view:e,createResources:e=>this._createObject3DResources(e),destroyResources:V,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:M,recreateGeometry:e=>this._recreateDrapedGeometry(e),forEachMaterial:(e,t)=>t(e.material)}}get location(){return this._location}set location(e){d(this._location,e)||(h(this._location,e),this._updateGeometry())}get direction(){return this._direction}set direction(e){d(this._direction,e)||(h(this._direction,e),this._updateGeometry())}setDirectionFromPoints(e,t){l(this._direction,m(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){f(e,this._color)||(g(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){const t=new R(this.materialParameters,this.view.state.isGlobal),r=new Array;return this._createObject3DGeometry(t,e,r),{material:t,geometries:r}}_recreateObject3DGeometry(e,t){e.geometries.length=0,this._createObject3DGeometry(e.material,t,e.geometries)}_createObject3DGeometry(e,t,r){const[i,s]=v(e);t.addGeometry(i),t.addGeometry(s),r.push(i),r.push(s),this._updateVerticesObject3D(t)}_createDrapedResources(){const t=new R(this.materialParameters,this.view.state.isGlobal),r=e(()=>this.view.state.contentPixelRatio,()=>this.drapedResources.recreateGeometry());return{material:t,geometries:this._createDrapedGeometry(t),pixelRatioHandle:r}}_recreateDrapedGeometry(e){e.geometries=this._createDrapedGeometry(e.material)}_createDrapedGeometry(e){const t=v(e);return this._updateVerticesDraped(t),t.map(e=>new w(e))}_updateMaterial(){const{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{const e=this.object3dResources.object;e&&this._updateVerticesObject3D(e)}}_updateVerticesObject3D(e){const t=this.view.state.camera;t.projectToScreen(this.location,U),u(P,this.location,this.direction),t.projectToScreen(P,E),i(E,s(E,E,U)),this._updateVertexAttributesObject3D(t,e,0,U,E,1),this._updateVertexAttributesObject3D(t,e,1,U,E,-1)}_updateVertexAttributesObject3D(e,t,i,s,o,a){const c=t.geometries[i],n=c.getMutableAttribute("position")?.data;if(!n)return;const{start:d,end:h}=x(o,s,a,this.offset,this.width,this.length);e.unprojectFromScreen(r(d),P),n[0]=P[0],n[1]=P[1],n[2]=P[2],e.unprojectFromScreen(r(h),P),n[3]=P[0],n[4]=P[1],n[5]=P[2],t.geometryVertexAttributeUpdated(c,"position")}_updateVerticesDraped(e){const{view:{basemapTerrain:{overlayManager:t},state:{contentPixelRatio:r}}}=this,{location:i,width:s,length:o,offset:a}=this,c=T;c.spatialReference=t.renderer.spatialReference,c.x=i[0],c.y=i[1];const n=this.view.overlayPixelSizeInMapUnits(c)*r,d=s*n,h=o*n,l=a*n;this._updateVertexAttributesDraped(e[0],d,h,l,-1),this._updateVertexAttributesDraped(e[1],d,h,l,1)}_updateVertexAttributesDraped(e,t,r,i,s){const o=e.getMutableAttribute("position")?.data;if(!o)return;const{location:a,direction:c}=this,{start:n,end:d}=x(c,a,s,i,t,r);o[0]=n[0],o[1]=n[1],o[2]=D,o[3]=d[0],o[4]=d[1],o[5]=D,e.invalidateBoundingInfo()}}function v(e){return[G(e,[p(),p()]),G(e,[p(),p()])]}function x(e,t,r,i,s,n){const d=o(A,a(A,e[1]*r,e[0]*-r),i+s/2),h=c(F,c(F,c(F,t,o(F,e,n/2)),d),d);return{start:h,end:c(S,h,o(S,e,-n))}}function V(e){e.geometries.length=0}function M(e){e.pixelRatioHandle.remove(),e.geometries=[]}const P=p(),A=n(),F=n(),S=n(),U=t(),E=t(),T=y(0,0,void 0,null);export{O as ParallelLineVisualElement};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{watch as e}from"../../../../core/reactiveUtils.js";import{fromTranslation as t,scale as r}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{j as s,n as a,d as o,c as n,q as c,f as l}from"../../../../chunks/vec32.js";import{create as u,ZEROS as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{d}from"../../../../chunks/vec42.js";import{fromValues as m}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{sv3d as _}from"../../../../geometry/support/vectorStacks.js";import{makeDehydratedPoint as p}from"../../../../layers/graphics/dehydratedPoint.js";import{EngineVisualElement as f}from"./EngineVisualElement.js";import{drapedZ as g}from"../../terrain/OverlayRenderer.js";import{Attribute as M}from"../../webgl-engine/lib/Attribute.js";import{Geometry as
|
|
5
|
+
import{watch as e}from"../../../../core/reactiveUtils.js";import{fromTranslation as t,scale as r}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{j as s,n as a,d as o,c as n,q as c,f as l}from"../../../../chunks/vec32.js";import{create as u,ZEROS as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{d}from"../../../../chunks/vec42.js";import{fromValues as m}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{sv3d as _}from"../../../../geometry/support/vectorStacks.js";import{makeDehydratedPoint as p}from"../../../../layers/graphics/dehydratedPoint.js";import{EngineVisualElement as f}from"./EngineVisualElement.js";import{drapedZ as g}from"../../terrain/OverlayRenderer.js";import{Attribute as M}from"../../webgl-engine/lib/Attribute.js";import{Geometry as b}from"../../webgl-engine/lib/Geometry.js";import{createPolylineGeometry as R}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderGeometry as j}from"../../webgl-engine/lib/RenderGeometry.js";import{ColorMaterial as O}from"../../webgl-engine/materials/ColorMaterial.js";import{RibbonLineMaterial as D}from"../../webgl-engine/materials/RibbonLineMaterial.js";class w extends f{constructor(e){super(e),this._maxSize=0,this._position=u(),this._up=u(),this._right=u(),this._renderOccluded=4,this._color=m(1,0,0,1),this._outlineColor=m(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:z,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 isDecoration(){return this._isDecoration}set isDecoration(e){this._isDecoration=e,this._updateOutlineMaterial(),this._updateQuadMaterial()}get color(){return this._color}set color(e){d(this._color,e),this._updateQuadMaterial()}get outlineColor(){return this._outlineColor}set outlineColor(e){d(this._outlineColor,e),this._updateOutlineMaterial()}get outlineSize(){return this._outlineSize}set outlineSize(e){const t=0===this._outlineSize!=(0===e);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:r}){this._maxSize=Math.min(s(t,e),s(t,r))/3,a(this._up,o(this._up,e,t)),a(this._right,o(this._right,r,t)),n(this._position,t),this.recreateGeometry()}_createObject3DResources(e){const t=new O(this._quadMaterialParameters),r=0===this._outlineSize?void 0:new D(this._outlineMaterialParameters,this.view.state.isGlobal);return this._createObject3DGeometries(e,t,r),{quadMaterial:t,outlineMaterial:r}}_createObject3DGeometries(e,t,r){if(c(this._up,h)&&c(this._right,h))return;const i=this._createGeometries(t,r);for(const s of i)e.addGeometry(s);this._updateTransformObject3D(e)}_createDrapedResources(){const t=new O(this._quadMaterialParameters),r=0===this._outlineSize?void 0:new D(this._outlineMaterialParameters,this.view.state.isGlobal),i=this._createGeometries(t,r).map(e=>new j(e));this._setTransformDraped(i);return{quadMaterial:t,outlineMaterial:r,geometries:i,pixelRatioHandle:e(()=>this.view.state.contentPixelRatio,()=>this.drapedResources.recreateGeometry())}}_createGeometries(e,t){const{up:r,right:i,corner:s}=this._getVertices(),a=v(r,i,s,e);if(!t)return[a];return[a,R(t,[r,s,i])]}_getVertices(){let e=this._up,t=this._right;const r=l(_.get(),e,t);return this.isDraped&&(e=n(_.get(),e),t=n(_.get(),t),e[2]=0,t[2]=0,r[2]=0),{up:e,right:t,corner:r}}_updateTransform(){this.isDraped?this.drapedResources.recreateGeometry():this._updateTransformObject3D()}_updateTransformObject3D(e=this.object3dResources.object){if(!e)return;const i=this.view.state.camera,s=this._size*i.computeScreenPixelSizeAt(this._position),a=Math.min(this._maxSize,s);t(y,this._position),r(y,y,[a,a,a]),e.transformation=y}_setTransformDraped(e){if(0===e.length)return;const{view:{basemapTerrain:{overlayManager:i},state:{contentPixelRatio:s}}}=this,{_position:a,_size:o}=this,c=n(_.get(),a);c[2]=g;const l=P;l.spatialReference=i.renderer.spatialReference,l.x=c[0],l.y=c[1];const u=o*(this.view.overlayPixelSizeInMapUnits(l)*s),h=Math.min(this._maxSize,u);t(y,c),r(y,y,[h,h,1]);for(const t of e)t.transformation=y}get _quadMaterialParameters(){return{color:this._color,forceTransparentMode:!0,writeDepth:!1,polygonOffset:!0,renderOccluded:this._renderOccluded,isDecoration:this.isDecoration}}_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 z(e){e.pixelRatioHandle.remove(),e.geometries=[]}function v(e,t,r,i){return new b(i,[["position",new M([0,0,0,...t,...e,...r],[0,1,2,1,2,3],3,!0)]])}const y=i(),P=p(0,0,void 0,null);export{w as RightAngleQuadVisualElement};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{equals as t}from"../../../core/arrayUtils.js";import"../../../core/has.js";import{abortMaybe as r}from"../../../core/maybe.js";import{debounce as i,throwIfAborted as s,ignoreAbortErrors as o}from"../../../core/promiseUtils.js";import{watch as l,when as n,sync as a}from"../../../core/reactiveUtils.js";import{property as u}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";import{projectOrLoad as d}from"../../../geometry/projectionUtils.js";import{fromExtent as h,intersection as c,toExtent as m,intersects as f}from"../../../geometry/support/aaBoundingRect.js";import g from"../../../symbols/support/ElevationInfo.js";import{simulationSettingsEqual as _,getFlowSimulationSettings as y}from"../../2d/engine/flow/utils.js";import w from"./SubView3D.js";import{makeScheduleFunction as v}from"./support/makeScheduleFunction.js";import{FlowWorkerHandle as b}from"../support/flow/FlowWorkerHandle.js";import{materialParametersFromRenderer as S,createStreamlineGeometry as T}from"../support/flow/geometryUtils.js";import{boundingRectOfTiles as j}from"../support/flow/loadUtils.js";import{StreamlineResources3DOverlay as R}from"../support/flow/StreamlineResources3DOverlay.js";import{StreamlineResources3DShape as
|
|
5
|
+
import{__decorate as e}from"tslib";import{equals as t}from"../../../core/arrayUtils.js";import"../../../core/has.js";import{abortMaybe as r}from"../../../core/maybe.js";import{debounce as i,throwIfAborted as s,ignoreAbortErrors as o}from"../../../core/promiseUtils.js";import{watch as l,when as n,sync as a}from"../../../core/reactiveUtils.js";import{property as u}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";import{projectOrLoad as d}from"../../../geometry/projectionUtils.js";import{fromExtent as h,intersection as c,toExtent as m,intersects as f}from"../../../geometry/support/aaBoundingRect.js";import g from"../../../symbols/support/ElevationInfo.js";import{simulationSettingsEqual as _,getFlowSimulationSettings as y}from"../../2d/engine/flow/utils.js";import w from"./SubView3D.js";import{makeScheduleFunction as v}from"./support/makeScheduleFunction.js";import{FlowWorkerHandle as b}from"../support/flow/FlowWorkerHandle.js";import{materialParametersFromRenderer as S,createStreamlineGeometry as T}from"../support/flow/geometryUtils.js";import{boundingRectOfTiles as j}from"../support/flow/loadUtils.js";import{StreamlineResources3DOverlay as R}from"../support/flow/StreamlineResources3DOverlay.js";import{StreamlineResources3DShape as P}from"../support/flow/StreamlineResources3DShape.js";import U from"../support/flow/VisualQuery3D.js";import{tilesAreRelated as x}from"../terrain/tileUtils.js";import{isScreenSizePerspectiveEnabled as L}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{RibbonLineMaterial as A}from"../webgl-engine/materials/RibbonLineMaterial.js";import{TaskPriority as E}from"../../support/Scheduler.js";let M=class extends w{constructor(e){super(e),this.type="flow",this.renderedTiles=null,this._abortController=null,this._frameTask=null,this.workerHandle=null,this.emissiveStrength=0,this._overrideMaterialParameters=null,this._overrideSimulationSettings=null,this._debouncedLoad=i(async e=>{const{view:t}=this;if(!this._visible)return void this.clear();if(0===e.size)return;const r=this._computeExtent(e);if(null==r)return;const i=new U(r,this.layer.timeExtent,this._viewSizeWithEqualRatio(r),t.state.contentPixelRatio);null==this._abortController&&(this._abortController=new AbortController);const o=this._abortController,l=await this._load(i,o.signal);s(o.signal),this.clear(),this._visible&&null!=l&&(l.attach(),this._resources=l)}),this._debouncedTileUpdate=i(async()=>{const{allTiles:e}=this.surface,{featureTiles:r}=this.view,{_dataBounds:i,_featureTilesBounds:s}=this,o=e=>e.rendered&&e.visible&&C(i,e.extent);if(null==r)return void(this.renderedTiles=new Set(e.filter(e=>o(e))));const l=r.tiles.filter(e=>e.measures.visible),n=new Set;function*a(r){for(let i=0;i<e.length;++i){const a=e.at(i);if(!o(a))continue;if(!C(s,a.extent))continue;l.some(({lij:e})=>t(e,a.lij)||x(e,a.lij))&&n.add(a),r.madeProgress(),r.done&&(r=yield)}}await this._frameTask.scheduleGenerator(a),this.renderedTiles=n}),this._debugStopLoading=!1}initialize(){const{surface:e,view:t}=this,{resourceController:r}=t;this.workerHandle=new b(v(r)),this._frameTask=r.scheduler.registerTask(E.FLOW_GENERATOR),this.addHandles([l(()=>this.simulationSettings,()=>this.triggerLoad(),{sync:!0,equals:(e,t)=>null==e&&null==t||null!=e&&null!=t&&_(e,t)}),l(()=>{const{elevationInfo:e}=this;return[this._clippingArea,this._visible,this._draped,e?.mode,e?.offset,e?.unit]},()=>this.triggerLoad(),a),l(()=>this._materialParameters,e=>this._resources?.setMaterialParameters(e)),e.on("tiles-changed",()=>this._triggerTilesUpdate()),t.enableFeatureTiles(),l(()=>[this._dataBounds,this._featureTilesBounds],()=>this._triggerTilesUpdate()),n(()=>!t.featureTiles?.updating,()=>this._triggerTilesUpdate())]),this._triggerTilesUpdate()}destroy(){this.abort(),this.clear()}abort(){this._abortController=r(this._abortController)}get _clippingArea(){const e=d(this.view.clippingArea,this.surface.spatialReference).geometry;return null==e?null:h(e)}get _dataBounds(){const e=d(this.layer.fullExtent,this.surface.spatialReference).geometry;return null==e?null:h(e)}get _draped(){return"on-the-ground"===this.elevationInfo.mode}get _featureTilesBounds(){const e=this.view.featureTiles?.filterExtent,t=d(e,this.surface.spatialReference).geometry;return null==t?null:h(t)}get _flowRenderer(){const e=this.layer.renderer;return"flow"!==e?.type?null:e}get _materialParameters(){return{...S(this._flowRenderer,this.layerView.fullOpacity,this.emissiveStrength),...this._overrideMaterialParameters,screenSizePerspective:!this._draped&&L(this.layer.screenSizePerspectiveEnabled)?this.view.screenSizePerspective.parameters:null}}get _opacity(){return this.layerView.fullOpacity}get _visible(){const e=this._flowRenderer?.color;return this.layerView.visibleAtCurrentScale&&this.layer.effectiveVisible&&this._opacity>0&&(null==e||e.a>0)}get elevationInfo(){return this.layer.elevationInfo??z}get needsMagnitude(){return this._flowRenderer?.hasVisualVariables()??!1}get layer(){return this.layerView.layer}get simulationSettings(){const{_flowRenderer:e,_overrideSimulationSettings:t}=this;if(null==e)return null;let r=y(e);return r.segmentLength=r.lineCollisionWidth/2,r.onlyForwardTracing=!1,null!=t&&(r={...r,...t}),r}get surface(){return this.view.basemapTerrain}doRefresh(){return this.triggerLoad()}clear(){this._resources?.detach(),this._resources=null}async triggerLoad(){const{renderedTiles:e}=this;if(null==e||0===e.size||this._debugStopLoading)return;const t=this._debouncedLoad(e);return this.updatingHandles.addPromise(o(t))}async _load(e,t){const r=await this.fetchDataAndGenerateStreamlines(e,t);if(null==r||0===r.length)return null;const i=await this._createGeometry(e,r);return this._draped?new R(r,i,this.surface.overlayManager):new P(r,i,this.view.stage)}async fetchDataAndGenerateStreamlines(e,t){return null}async _createGeometry(e,t){const r=new A(this._materialParameters,this.view.state.isGlobal),i=new Array,{elevationInfo:s,_draped:o,needsMagnitude:l,view:n}=this;function*a(a){for(let u=0;u<t.length;++u)i.push(T(n,e,t[u],s,r,o,l)),a.madeProgress(),a.done&&(a=yield)}return await this._frameTask.scheduleGenerator(a),i}_computeExtent(e){const{spatialReference:t}=this.surface;if(null==t)return null;const r=j(e);return null==r?null:(c(r,this._clippingArea,r),m(r,t))}async _triggerTilesUpdate(){const e=this._debouncedTileUpdate();return this.updatingHandles.addPromise(o(e))}_viewSizeWithEqualRatio(e){const t=(e.xmax-e.xmin)/(e.ymax-e.ymin),[r,i]=this.view.size;return r<i?[r,Math.floor(r/t)]:[Math.floor(i*t),i]}get test(){}};e([u()],M.prototype,"type",void 0),e([u()],M.prototype,"renderedTiles",void 0),e([u()],M.prototype,"emissiveStrength",void 0),e([u()],M.prototype,"_clippingArea",null),e([u()],M.prototype,"_dataBounds",null),e([u()],M.prototype,"_draped",null),e([u()],M.prototype,"_featureTilesBounds",null),e([u()],M.prototype,"_flowRenderer",null),e([u()],M.prototype,"_materialParameters",null),e([u()],M.prototype,"_opacity",null),e([u()],M.prototype,"_visible",null),e([u()],M.prototype,"elevationInfo",null),e([u()],M.prototype,"needsMagnitude",null),e([u()],M.prototype,"layer",null),e([u()],M.prototype,"_overrideMaterialParameters",void 0),e([u()],M.prototype,"_overrideSimulationSettings",void 0),e([u()],M.prototype,"simulationSettings",null),e([u()],M.prototype,"surface",null),M=e([p("esri.views.3d.layers.FlowSubView3D")],M);const z=new g({mode:"on-the-ground"});function C(e,t){return null==e||null==t||f(e,t)}export{M as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import has from"../../../core/has.js";import t from"../../../core/Logger.js";import{destroyMaybe as i}from"../../../core/maybe.js";import{initial as s,watch as r,when as o}from"../../../core/reactiveUtils.js";import{schedule as a}from"../../../core/scheduling.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{fromMat4 as c,invert as d}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as m,IDENTITY as h}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as u}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as p}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{f,o as g}from"../../../chunks/vec32.js";import{fromArray as y,clone as b,create as _}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as w}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{SphericalECEFSpatialReferenceLike as v}from"../../../geometry/ellipsoidUtils.js";import{computeTranslationToOriginAndRotation as j}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as x}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as C}from"../../../geometry/projection/projectVectorToVector.js";import{create as M}from"../../../geometry/support/aaBoundingRect.js";import{BufferViewVec2f as T,BufferViewVec4f as O,BufferViewVec4u8 as U,BufferViewVec4u16 as P,BufferViewVec3f as H,BufferViewVec3u8 as E,BufferViewVec3u16 as S,BufferViewInt16 as F,BufferViewUint32 as R,BufferViewUint16 as A}from"../../../geometry/support/buffer/BufferView.js";import k from"../../../layers/support/SceneModification.js";import{getElevationOffsetInMeters as V}from"../../../support/elevationInfoUtils.js";import{toWasmModification as I}from"./I3SMeshWorkerHandle.js";import{LayerView3D as D}from"./LayerView3D.js";import{Lyr3DViewPerformanceInfo as L}from"./Lyr3DViewPerformanceInfo.js";import{addLayerViewToWasm as B,removeLayerViewFromWasm as G,getLyr3DWasm as z}from"./Lyr3DWasm.js";import{LayerElevationProvider as N}from"./i3s/LayerElevationProvider.js";import{primTypeConversion as W,alphaModeConversion as $,faceCullingConversion as J,wrapModeConversion as q,lyr3DTypeToByteSize as K}from"./support/lyr3dTypeConversions.js";import{Tiles3DIntersectionHandler as Q}from"./support/Tiles3DIntersectionHandler.js";import{ElevationRange as X}from"../support/ElevationRange.js";import{toBoundingRect as Y}from"../support/extentUtils.js";import{Obb as Z,compute as ee}from"../support/orientedBoundingBox.js";import{ObjectParameters as te}from"../webgl-engine/collections/Component/ObjectParameters.js";import{GeometryParameters as ie,createVertexBufferLayout as se}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as re}from"../webgl-engine/collections/Component/Transform.js";import{RenderTexture as oe}from"../webgl-engine/core/material/RenderTexture.js";import{getEllipsoidMode as ae}from"../webgl-engine/core/shaderLibrary/util/EllipsoidMode.js";import{Attribute as ne}from"../webgl-engine/lib/Attribute.js";import{compressAndTransformNormals as le}from"../webgl-engine/lib/Normals.js";import{Texture as ce}from"../webgl-engine/lib/Texture.js";import{writeAttribute as de,writeBufferVec2 as me}from"../webgl-engine/materials/internal/bufferWriterUtils.js";import he from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as ue,isInEffectiveScaleRange as pe}from"../../support/layerViewUtils.js";import{TextureCompressionTracker as fe}from"../../support/TextureCompressionTracker.js";import{alphaCutoff as ge}from"../../../webscene/support/AlphaCutoff.js";class ye{constructor(e,t,i,s,r,o){this.handle=e,this.componentObjects=t,this.textures=i,this.cpuMemoryUsage=s,this.vboMemoryUsage=r,this.textureMemoryUsage=o,this.isVisible=!1,this.usedMemory=this.textureMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage}}function be(e){return Math.round(e/1048.576)/1e3}let _e=class extends(D(he)){get hasModifications(){return this._modifications&&this._modifications.length>0}constructor(e){super(e),this.type="integrated-mesh-3dtiles",this._compressionTracker=new fe,this._modifications=new Array,this._visibleGeometryChangedSchedulerHandle=null,this._wasmLayerId=-1,this.ignoresMemoryFactor=!1,this._usedMemory=0,this._cacheMemory=0,this.drapeTargetType=1,this._applySSAO=!has("disable-feature:im-ssao"),this._shadeNormals=!!has("enable-feature:im-shading"),this._lyrHandleToObjects=new Map,this._visibleObjects=new Set,this._initialCullFace=new Map,this._suspendedHandle=null,this._dbgFlags=new Set,this._memCache=e.view.resourceController.memoryController.newCache(`IM3DTiles-${this.uid}`,e=>this._deletePerObjectData(e))}initialize(){this._dbgFlags.add(3),this._dbg(2,"Tiles3DLayerView3D initialize() called");const{view:e}=this;if(this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),s),!this._canProjectWithoutEngine())throw ue("layer",this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);const t=B(this).then(t=>{this._wasmLayerId=t,this._intersectionHandler=new Q(this),e.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(e)),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged(),s),this._updatingHandles.add(()=>this.fullOpacity,()=>this._opacityChange()),this._updatingHandles.add(()=>e.clippingArea,()=>this._clippingAreaChanged(),s),this._elevationProvider=new N({view:e,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),e.elevationProvider.register(1,this._elevationProvider),e.basemapTerrain.overlayManager.registerDrapeTarget(this),this.addHandles([r(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e))]),this._suspendedHandle=r(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),s)});this.addResolvingPromise(t),this._replacesTerrain&&this.addHandles(o(()=>this.view.map.ground.opacity,()=>{this._opacityChange()}))}get _replacesTerrain(){return this.layer.replacesTerrain&&!!this.view.map.basemap?.groundLayers.includes(this.layer)}get opacity(){return this.fullOpacity*(this._replacesTerrain?this.view.map.ground.opacity:1)}_opacityChange(){const{opacity:e}=this;this.forEachComponentObject(t=>{this._collection.getMaterial(t).objectOpacity=e})}destroy(){this._dbg(2,"Tiles3DLayerView3D destroy() called"),G(this),this._suspendedHandle&&(this._suspendedHandle.remove(),this._suspendedHandle=null),this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null),this._elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(e=>this.forEachComponentObject(t=>e(t.obb))),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this.view.basemapTerrain.overlayManager.unregisterDrapeTarget(this),this._lyrHandleToObjects.forEach(e=>this.freeObject(e)),this._lyrHandleToObjects.clear(),this._initialCullFace.clear(),this._visibleObjects.clear(),this._usedMemory=0,this._cacheMemory=0,this._memCache.destroy(),this._updatingHandles=i(this._updatingHandles),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle.remove(),this._visibleGeometryChangedSchedulerHandle=null)}_modificationsChanged(){const e=this.layer.spatialReference,t=I(this._layerClippingArea,this._modifications,e);this._wasm?.setMeshModifications(this,t,e.wkid)}_clippingAreaChanged(){const e=this.layer.spatialReference,t=M();this._layerClippingArea=Y(this.view.clippingArea,t,e)?t:null,this._modificationsChanged()}_visibleGeometryChanged(){this._visibleGeometryChangedSchedulerHandle??=a(()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null})}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),this.forEachComponentObject(t=>{const i=this._collection.getMaterial(t);i.commonMaterialParameters.hasSlicePlane=e,i.commonMaterialParameters.cullFace=e?0:this._initialCullFace.get(t)})}_elevationInfoChanged(e){this._wasm?.setLayerOffset(this,V(e))}get _wasm(){return z(this.view)}get wasmLayerId(){return this._wasmLayerId}get usedMemory(){return this._usedMemory}get unloadedMemory(){return 0}get cachedMemory(){return this._cacheMemory}get visibleAtCurrentScale(){return pe(this.layer.effectiveScaleRange,this.view.scale)}get performanceInfo(){let e=0,t=0,i=0,s=0,r=0,o=0;return this._lyrHandleToObjects.forEach(a=>{a.isVisible?(e+=a.textureMemoryUsage,t+=a.vboMemoryUsage,r++):(i+=a.textureMemoryUsage,s+=a.vboMemoryUsage,o++)}),new L(this.usedMemory,r,o,be(t),be(e),be(s),be(i))}_canProjectWithoutEngine(){if(2===this.view.state.viewingMode){const e=this.view.renderSpatialReference?.isWebMercator?3857:this.view.renderSpatialReference?.wkid??-1;if(3857!==e&&32662!==e)return!1}return!0}get _stage(){return this.view.stage}get _collection(){return this._stage.renderView.componentObjectCollection}get elevationOffset(){return V(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new X(e.zmin,e.zmax):null}getElevationRange(e){return null}get fullExtent(){return this.layer.fullExtent}forEachComponentObject(e){this._forEachObject(this._lyrHandleToObjects.values(),e)}forEachVisibleComponentObject(e){this._forEachObject(this._visibleObjects,e)}_forEachObject(e,t){for(const i of e)for(const e of i.componentObjects)t(e)}isUpdating(){const e=this._wasm;return!(this._wasmLayerId<0||null==e)&&(e.isUpdating(this._wasmLayerId)||this._compressionTracker.compressing)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){const t=e.meshData;if(null==t.data)throw new Error("meshData.data undefined");if(t.desc=JSON.parse(t.desc),null==t.desc)throw new Error("meshData.desc undefined");const i=y(t.desc.origin),s=new Array,r=this.view.basemapTerrain.spatialReference;let o,a;if("global"===this.view.viewingMode){const e=u();j(v,i,e,r),o=c(m(),e),a=d(m(),o)}else o=h,a=h;const n=b(i);let l=null;const M=_();if(t.desc.obb){const e=t.desc.obb.quaternion;l=new Z(t.desc.obb.center,t.desc.obb.halfSize,p(e[0],e[1],e[2],e[3]))}let O=0,U=0;const P={textureMemoryUsage:0},H=new Array,E=new Map;for(let c=0;c<t.desc.prims.length;c++){const e=t.desc.prims[c];this._dbg(2,JSON.stringify(e));if(null==W[e.ptype]||null==t.data){this._dbg(2,"[Unsupported Feature] Unsupported primitive mode ("+e.ptype+"). Skipping primitive.");continue}const d=t.desc?.materials&&null!=e.materialId?t.desc.materials[e.materialId]:null,m=null!=d?d.lightingModel:"Unlit",{positionView:u,positionAttr:p,normalsView:y,normalsAttr:b,colorAttr:v,texCoord0Attr:j,indicesView:S}=this.getBufferViews(e,t.data.buffer,o);if(null==p||null==u||null==S)continue;const F=new ie(null!=v,j?1:0,null!=y,this._shadeNormals||this._replacesTerrain,this._applySSAO),R=p.data.length/p.size,A=(e,t)=>!e||e.data.length/e.size===R||(this._dbg(3,`${t} !== numPos. Skipping primitive.`),!1);if(!A(j,"numTexcoord")||!A(v,"numColors")||!A(b,"normals"))continue;const k=se(F);if(null!=l?l=l.clone():(l=ee(p),f(M,l.center,i),l.center=M),o!==h)for(let t=0;t<u.count;t++)u.getVec(t,M),g(M,M,o),u.setVec(t,M);const V=k.createBuffer(p.data.length);if(de("position",p,null,null,V,0),null!=j){const e=V.getField("uv0",T);me(j,e,0)}null!=v&&de("color",v,null,null,V,0),null!=b&&de("normalCompressed",b,null,null,V,0);const I=new Uint32Array([0,S.typedBuffer.length]),D={vertices:{data:V.buffer,count:V.byteLength/k.stride,layoutParameters:F},positionData:{positions:u.typedBuffer,indices:S.typedBuffer},indices:S.typedBuffer,componentOffsets:I};O+=u.count+S.count;const L=this.view.renderSpatialReference,B=_(),G=[1,1,1];x(n,L,G,r)||this._dbg(3,"Unsupported coordinate system for IM overlay"),C(n,L,B,r);const z=this._collection.createObject(new te(w(B[0],B[1],G[0],G[1]),new re(n,a),l,D));d&&this._collection.updateMaterial(z,e=>{e.baseColor=d.baseColorFactor,e.usePBR="Pbr"===m,e.hasParametersFromSource=!1,e.baseColorTexture=this._getTexture(d.baseColorTex,t,E,P),e.usePBR&&(e.mrrFactors=[d.metallicFactor,d.roughnessFactor,0],e.emissiveBaseColor=d.emissiveFactor??[0,0,0],e.metallicRoughnessTexture=this._getTexture(d.metalTex,t,E,P),e.emissionTexture=this._getTexture(d.emissiveTex,t,E,P),e.occlusionTexture=this._getTexture(d.occlusionTex,t,E,P),e.normalTexture=this._getTexture(d.normalTex,t,E,P)),e.objectOpacity=0,e.alphaDiscardMode=2;const i=[];e.baseColorTexture&&i.push(e.baseColorTexture.loadPromise),e.usePBR&&(e.metallicRoughnessTexture&&i.push(e.metallicRoughnessTexture.loadPromise),e.emissionTexture&&i.push(e.emissionTexture.loadPromise),e.occlusionTexture&&i.push(e.occlusionTexture.loadPromise),e.normalTexture&&i.push(e.normalTexture.loadPromise));const r=Promise.all(i);s.push(r),r.then(()=>{e.alphaDiscardMode=$[d.alphaMode],e.objectOpacity=this.opacity,P.textureMemoryUsage+=e.baseColorTexture?.glTexture?.usedMemory??0,e.usePBR&&(P.textureMemoryUsage+=(e.metallicRoughnessTexture?.glTexture?.usedMemory??0)+(e.emissionTexture?.glTexture?.usedMemory??0)+(e.occlusionTexture?.glTexture?.usedMemory??0)+(e.normalTexture?.glTexture?.usedMemory??0))}),e.commonMaterialParameters.doubleSided=d.isDoubleSided,e.commonMaterialParameters.cullFace=d.faceCulling?J[d.faceCulling]:2,this._initialCullFace.set(z,e.commonMaterialParameters.cullFace),e.commonMaterialParameters.hasSlicePlane=this.slicePlaneEnabled,e.componentParameters.castShadows=0,e.textureAlphaCutoff=d.alphaCutoff??ge,e.alphaDiscardMode=$[d.alphaMode],e.isIntegratedMesh=!0,e.sphereDepthInterpolate=this.layer.replacesTerrain,e.polygonOffsetEnabled=!1,e.hasOccludees=!1,e.ellipsoidMode=ae(this.view.spatialReference)}),H.push(z),U+=this._collection.getObjectGPUMemoryUsage(z)}await Promise.all(s);const S=new Array;E.forEach(e=>{S.push(e)});const F=new ye(e.handle,H,S,O,U,P.textureMemoryUsage);return this._memCache.put(`${F.handle}`,F),this._lyrHandleToObjects.set(e.handle,F),this._cacheMemory+=F.usedMemory,{memUsageBytes:F.usedMemory}}freeRenderable(e){const t=this._lyrHandleToObjects.get(e);t&&(t.isVisible?(this._visibleObjects.delete(t),this._usedMemory-=t.usedMemory):this._cacheMemory-=t.usedMemory,this.freeObject(t),this._lyrHandleToObjects.delete(e))}freeObject(e){this._memCache.pop(`${e.handle}`),e.textures.forEach(e=>{this._stage.removeTexture(e)}),e.componentObjects.forEach(e=>{this._collection.destroyObject(e),this._initialCullFace.delete(e)})}setRenderableVisibility(e,t,i){for(let s=0;s<i;++s){const i=t[s];if(!i)continue;const r=e[s],o=this._lyrHandleToObjects.get(r);if(o){if(o.isVisible)continue;this._visibleGeometryChanged(),o.isVisible=!0,this._visibleObjects.add(o),this._usedMemory+=o.usedMemory,this._cacheMemory-=o.usedMemory,o.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,i),this._elevationProvider.notifyObjectChanged(this._collection.getComponentObb(e))}),this._memCache.pop(`${r}`)}}for(let s=0;s<i;++s){const i=e[s],r=t[s];if(r)continue;const o=this._lyrHandleToObjects.get(i);if(o){if(!o.isVisible)continue;this._visibleGeometryChanged(),o.isVisible=!1,this._visibleObjects.delete(o),this._usedMemory-=o.usedMemory,this._cacheMemory+=o.usedMemory,o.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,r),this._elevationProvider.notifyObjectChanged(this._collection.getComponentObb(e))}),this._memCache.put(`${i}`,o)}}}_getTexture(e,t,i,s){let r=null;if(e&&t.desc?.images&&t.data?.buffer){const o=t.desc.images[e?.imageId];if(r=i.get(o),!r&&o){const a=this._stage.renderView.renderingContext.parameters.maxMaxAnisotropy,n=!!o.mipCount||a>1,l=q[e.wrapMode??"None"];let c=o.alpha?4:3;const d=new Uint8Array(t.data.buffer,o.data.byteOffset,o.data.byteCount);let m=null,h=null,u=null;switch(o.format){case"Raw":"R8"===o.pixelFormat?(m=d,c=1,h=""):"Rgb8"===o.pixelFormat?(m=d,c=3,h=""):"Rgba8"===o.pixelFormat&&(m=d,c=4,h="");break;case"Dxt1":m=d,c=3,h="image/vnd-ms.dds";break;case"Dxt5":m=d,c=4,h="image/vnd-ms.dds";break;case"Basis":m=d,c=3,h="image/ktx2";break;case"Png":h="image/png",u=document.createElement("img");break;case"Jpeg":h="image/jpeg",u=document.createElement("img");break;case"Etc2":h="image/ktx",u=document.createElement("img");break;case"Astc":this._dbg(3,"Astc texture not supported");break;case"Pvrtc":this._dbg(3,"Pvrtc texture not supported")}if(u&&h){const e=new Blob([d],{type:h});u.src=URL.createObjectURL(e),m=u}if(m&&null!=h){const e=has("enable-feature:esri-compress-IM-textures")?{compressionTracker:this._compressionTracker,compressionCallback:e=>{e&&e>0&&(s.textureMemoryUsage-=e)}}:void 0;r=new ce(m,{mipmap:n,maxAnisotropy:a,encoding:h,wrap:l,components:c,compressionOptions:e,noUnpackFlip:!0,width:o.mip0Width,height:o.mip0Height}),this._stage.addTexture(r),i.set(o,r)}}}return r?new oe(this.view.stage.renderView.textures,r.id):null}getBufferViews(e,t,i){let s,r,o,a,n,l,c,d=null;for(let h=0;h<e.atrbs.length;h++){const c=e.atrbs[h],u=c.view,p=void 0,f=u.byteOffset+u.byteCount,g=u.byteCount/K[u.type],y=[...Array(g).keys()].map(e=>e);try{switch(c.sem){case"Position":3!==u.ncomp||"F32"!==u.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Position ("+u+")"):(s=new H(t,u.byteOffset,p,f),r=new ne(s.typedBuffer,y,3));break;case"Normal":if(3!==u.ncomp||"F32"!==u.type)this._dbg(3,"[Unsupported Feature] Unsupported view for Normal ("+u+")");else{const e=new H(t,u.byteOffset,p,f),s=le(e.typedBuffer,i);n=new F(s.buffer),l=new ne(n.typedBuffer,y,2)}break;case"TexCoord":2!==u.ncomp||"F32"!==u.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Texcoord ("+u+")"):void 0===a&&(a=new ne(new T(t,u.byteOffset,p,f).typedBuffer,y,2));break;case"Color":4===u.ncomp?("F32"===u.type&&(d=new O(t,u.byteOffset,p,f)),"U8"===u.type&&(d=new U(t,u.byteOffset,p,f)),"U16"===u.type&&(d=new P(t,u.byteOffset,p,f))):3===u.ncomp&&("F32"===u.type&&(d=new H(t,u.byteOffset,p,f)),"U8"===u.type&&(d=new E(t,u.byteOffset,p,f)),"U16"===u.type&&(d=new S(t,u.byteOffset,p,f))),null==d?this._dbg(2,"[Unsupported Feature] Unsupported view for Color ("+u+")"):o=new ne(d.typedBuffer,y,u.ncomp);break;case"FeatureIndex":break;default:this._dbg(2,"[Unsupported Feature] Unsupported semantic ("+c.sem+"). Skipping vertex attribute.")}}catch(m){this._dbg(2,"Error Creating buffer ("+m+"). Skipping vertex attribute.")}}if(e.index){const i=e.index.view,s=void 0,r=i.byteOffset+i.byteCount;switch(e.index.view.type){case"U16":c=new A(t,i.byteOffset,s,r);break;case"U32":c=new R(t,i.byteOffset,s,r);break;default:this._dbg(3,"[Unsupported Feature] index type not supported ("+i.type+").")}}if(null==c&&null!=s){const e=s.count;if(e<65535){const t=new Uint16Array(e);c=new A(t.buffer)}else{const t=new Uint32Array(e);c=new R(t.buffer)}for(let t=0;t<e;t++)c.set(t,t)}return{positionView:s,positionAttr:r,colorAttr:o,texCoord0Attr:a,indicesView:c,normalsView:n,normalsAttr:l}}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>this._modifications=e.toArray(),s),"modifications")}_deletePerObjectData(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}_dbg(e,i){this._dbgFlags.has(e)&&(3===e?t.getLogger(this).error(i):t.getLogger(this).warn(i))}};e([n({type:[k]})],_e.prototype,"_modifications",void 0),e([n()],_e.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([n()],_e.prototype,"layer",void 0),e([n({readOnly:!0})],_e.prototype,"visibleAtCurrentScale",null),e([n()],_e.prototype,"elevationOffset",null),_e=e([l("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],_e);const we=_e;export{we as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import has from"../../../core/has.js";import t from"../../../core/Logger.js";import{destroyMaybe as i}from"../../../core/maybe.js";import{initial as s,watch as r,when as o}from"../../../core/reactiveUtils.js";import{schedule as a}from"../../../core/scheduling.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{fromMat4 as c,invert as d}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as m,IDENTITY as h}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as u}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as p}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{f,o as g}from"../../../chunks/vec32.js";import{fromArray as y,clone as b,create as _}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as w}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{SphericalECEFSpatialReferenceLike as v}from"../../../geometry/ellipsoidUtils.js";import{computeTranslationToOriginAndRotation as j}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as x}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as C}from"../../../geometry/projection/projectVectorToVector.js";import{create as M}from"../../../geometry/support/aaBoundingRect.js";import{BufferViewVec2f as T,BufferViewVec4f as O,BufferViewVec4u8 as U,BufferViewVec4u16 as P,BufferViewVec3f as H,BufferViewVec3u8 as E,BufferViewVec3u16 as S,BufferViewInt16 as F,BufferViewUint32 as R,BufferViewUint16 as A}from"../../../geometry/support/buffer/BufferView.js";import k from"../../../layers/support/SceneModification.js";import{getElevationOffsetInMeters as V}from"../../../support/elevationInfoUtils.js";import{toWasmModification as I}from"./I3SMeshWorkerHandle.js";import{LayerView3D as D}from"./LayerView3D.js";import{Lyr3DViewPerformanceInfo as L}from"./Lyr3DViewPerformanceInfo.js";import{addLayerViewToWasm as B,removeLayerViewFromWasm as G,getLyr3DWasm as z}from"./Lyr3DWasm.js";import{LayerElevationProvider as N}from"./i3s/LayerElevationProvider.js";import{primTypeConversion as W,alphaModeConversion as $,faceCullingConversion as J,wrapModeConversion as q,lyr3DTypeToByteSize as K}from"./support/lyr3dTypeConversions.js";import{Tiles3DIntersectionHandler as Q}from"./support/Tiles3DIntersectionHandler.js";import{ElevationRange as X}from"../support/ElevationRange.js";import{toBoundingRect as Y}from"../support/extentUtils.js";import{Obb as Z,compute as ee}from"../support/orientedBoundingBox.js";import{ObjectParameters as te}from"../webgl-engine/collections/Component/ObjectParameters.js";import{GeometryParameters as ie,createVertexBufferLayout as se}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as re}from"../webgl-engine/collections/Component/Transform.js";import{RenderTexture as oe}from"../webgl-engine/core/material/RenderTexture.js";import{getEllipsoidMode as ae}from"../webgl-engine/core/shaderLibrary/util/EllipsoidMode.js";import{Attribute as ne}from"../webgl-engine/lib/Attribute.js";import{compressAndTransformNormals as le}from"../webgl-engine/lib/Normals.js";import{Texture as ce}from"../webgl-engine/lib/Texture.js";import{writeAttribute as de,writeBufferVec2 as me}from"../webgl-engine/materials/internal/bufferWriterUtils.js";import he from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as ue,isInEffectiveScaleRange as pe}from"../../support/layerViewUtils.js";import{TextureCompressionTracker as fe}from"../../support/TextureCompressionTracker.js";import{alphaCutoff as ge}from"../../../webscene/support/AlphaCutoff.js";class ye{constructor(e,t,i,s,r,o){this.handle=e,this.componentObjects=t,this.textures=i,this.cpuMemoryUsage=s,this.vboMemoryUsage=r,this.textureMemoryUsage=o,this.isVisible=!1,this.usedMemory=this.textureMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage}}function be(e){return Math.round(e/1048.576)/1e3}let _e=class extends(D(he)){get hasModifications(){return this._modifications&&this._modifications.length>0}constructor(e){super(e),this.type="integrated-mesh-3dtiles",this._compressionTracker=new fe,this._modifications=new Array,this._visibleGeometryChangedSchedulerHandle=null,this._wasmLayerId=-1,this.ignoresMemoryFactor=!1,this._usedMemory=0,this._cacheMemory=0,this.drapeTargetType=1,this._applySSAO=!has("disable-feature:im-ssao"),this._shadeNormals=!!has("enable-feature:im-shading"),this._lyrHandleToObjects=new Map,this._visibleObjects=new Set,this._initialCullFace=new Map,this._suspendedHandle=null,this._dbgFlags=new Set,this._memCache=e.view.resourceController.memoryController.newCache(`IM3DTiles-${this.uid}`,e=>this._deletePerObjectData(e))}initialize(){this._dbgFlags.add(3),this._dbg(2,"Tiles3DLayerView3D initialize() called");const{view:e}=this;if(this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),s),!this._canProjectWithoutEngine())throw ue("layer",this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);const t=B(this).then(t=>{this._wasmLayerId=t,this._intersectionHandler=new Q(this),e.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(e)),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged(),s),this._updatingHandles.add(()=>this.fullOpacity,()=>this._opacityChange()),this._updatingHandles.add(()=>e.clippingArea,()=>this._clippingAreaChanged(),s),this._elevationProvider=new N({view:e,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),e.elevationProvider.register(1,this._elevationProvider),e.basemapTerrain.overlayManager.registerDrapeTarget(this),this.addHandles([r(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e))]),this._suspendedHandle=r(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),s)});this.addResolvingPromise(t),this._replacesTerrain&&this.addHandles(o(()=>this.view.map.ground.opacity,()=>{this._opacityChange()}))}get _replacesTerrain(){return this.layer.replacesTerrain&&!!this.view.map.basemap?.groundLayers.includes(this.layer)}get opacity(){return this.fullOpacity*(this._replacesTerrain?this.view.map.ground.opacity:1)}_opacityChange(){const{opacity:e}=this;this.forEachComponentObject(t=>{this._collection.getMaterial(t).objectOpacity=e})}destroy(){this._dbg(2,"Tiles3DLayerView3D destroy() called"),G(this),this._suspendedHandle&&(this._suspendedHandle.remove(),this._suspendedHandle=null),this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null),this._elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(e=>this.forEachComponentObject(t=>e(t.obb))),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this.view.basemapTerrain.overlayManager.unregisterDrapeTarget(this),this._lyrHandleToObjects.forEach(e=>this.freeObject(e)),this._lyrHandleToObjects.clear(),this._initialCullFace.clear(),this._visibleObjects.clear(),this._usedMemory=0,this._cacheMemory=0,this._memCache.destroy(),this._updatingHandles=i(this._updatingHandles),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle.remove(),this._visibleGeometryChangedSchedulerHandle=null)}_modificationsChanged(){const e=this.layer.spatialReference,t=I(this._layerClippingArea,this._modifications,e);this._wasm?.setMeshModifications(this,t,e.wkid)}_clippingAreaChanged(){const e=this.layer.spatialReference,t=M();this._layerClippingArea=Y(this.view.clippingArea,t,e)?t:null,this._modificationsChanged()}_visibleGeometryChanged(){this._visibleGeometryChangedSchedulerHandle??=a(()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null})}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),this.forEachComponentObject(t=>{const i=this._collection.getMaterial(t);i.commonMaterialParameters.hasSlicePlane=e,i.commonMaterialParameters.cullFace=e?0:this._initialCullFace.get(t)})}_elevationInfoChanged(e){this._wasm?.setLayerOffset(this,V(e))}get _wasm(){return z(this.view)}get wasmLayerId(){return this._wasmLayerId}get usedMemory(){return this._usedMemory}get unloadedMemory(){return 0}get cachedMemory(){return this._cacheMemory}get visibleAtCurrentScale(){return pe(this.layer.effectiveScaleRange,this.view.scale)}get performanceInfo(){let e=0,t=0,i=0,s=0,r=0,o=0;return this._lyrHandleToObjects.forEach(a=>{a.isVisible?(e+=a.textureMemoryUsage,t+=a.vboMemoryUsage,r++):(i+=a.textureMemoryUsage,s+=a.vboMemoryUsage,o++)}),new L(this.usedMemory,r,o,be(t),be(e),be(s),be(i))}_canProjectWithoutEngine(){if(2===this.view.state.viewingMode){const e=this.view.renderSpatialReference?.isWebMercator?3857:this.view.renderSpatialReference?.wkid??-1;if(3857!==e&&32662!==e)return!1}return!0}get _stage(){return this.view.stage}get _collection(){return this._stage.renderView.componentObjectCollection}get elevationOffset(){return V(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new X(e.zmin,e.zmax):null}getElevationRange(e){return null}get fullExtent(){return this.layer.fullExtent}forEachComponentObject(e){this._forEachObject(this._lyrHandleToObjects.values(),e)}forEachVisibleComponentObject(e){this._forEachObject(this._visibleObjects,e)}_forEachObject(e,t){for(const i of e)for(const e of i.componentObjects)t(e)}isUpdating(){const e=this._wasm;return!(this._wasmLayerId<0||null==e)&&(e.isUpdating(this._wasmLayerId)||this._compressionTracker.compressing)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){const t=e.meshData;if(null==t.data)throw new Error("meshData.data undefined");if(t.desc=JSON.parse(t.desc),null==t.desc)throw new Error("meshData.desc undefined");const i=y(t.desc.origin),s=new Array,r=this.view.basemapTerrain.spatialReference;let o,a;if("global"===this.view.viewingMode){const e=u();j(v,i,e,r),o=c(m(),e),a=d(m(),o)}else o=h,a=h;const n=b(i);let l=null;const M=_();if(t.desc.obb){const e=t.desc.obb.quaternion;l=new Z(t.desc.obb.center,t.desc.obb.halfSize,p(e[0],e[1],e[2],e[3]))}let O=0,U=0;const P={textureMemoryUsage:0},H=new Array,E=new Map;for(let c=0;c<t.desc.prims.length;c++){const e=t.desc.prims[c];this._dbg(2,JSON.stringify(e));if(null==W[e.ptype]||null==t.data){this._dbg(2,"[Unsupported Feature] Unsupported primitive mode ("+e.ptype+"). Skipping primitive.");continue}const d=t.desc?.materials&&null!=e.materialId?t.desc.materials[e.materialId]:null,m=null!=d?d.lightingModel:"Unlit",{positionView:u,positionAttr:p,normalsView:y,normalsAttr:b,colorAttr:v,texCoord0Attr:j,indicesView:S}=this.getBufferViews(e,t.data.buffer,o);if(null==p||null==u||null==S)continue;const F=new ie(null!=v,j?1:0,null!=y,this._shadeNormals||this._replacesTerrain,this._applySSAO),R=p.data.length/p.size,A=(e,t)=>!e||e.data.length/e.size===R||(this._dbg(3,`${t} !== numPos. Skipping primitive.`),!1);if(!A(j,"numTexcoord")||!A(v,"numColors")||!A(b,"normals"))continue;const k=se(F);if(null!=l?l=l.clone():(l=ee(p),f(M,l.center,i),l.center=M),o!==h)for(let t=0;t<u.count;t++)u.getVec(t,M),g(M,M,o),u.setVec(t,M);const V=k.createBuffer(p.data.length);if(de("position",p,null,null,V,0),null!=j){const e=V.getField("uv0",T);me(j,e,0)}null!=v&&de("color",v,null,null,V,0),null!=b&&de("normalCompressed",b,null,null,V,0);const I=new Uint32Array([0,S.typedBuffer.length]),D={vertices:{data:V.buffer,count:V.byteLength/k.stride,layoutParameters:F},positionData:{positions:u.typedBuffer,indices:S.typedBuffer},indices:S.typedBuffer,componentOffsets:I};O+=u.count+S.count;const L=this.view.renderSpatialReference,B=_(),G=[1,1,1];x(n,L,G,r)||this._dbg(3,"Unsupported coordinate system for IM overlay"),C(n,L,B,r);const z=this._collection.createObject(new te(w(B[0],B[1],G[0],G[1]),new re(n,a),l,D));d&&this._collection.updateMaterial(z,e=>{e.baseColor=d.baseColorFactor,e.usePBR="Pbr"===m,e.hasParametersFromSource=!1,e.baseColorTexture=this._getTexture(d.baseColorTex,t,E,P),e.usePBR&&(e.mrrFactors=[d.metallicFactor,d.roughnessFactor,0],e.emissiveBaseColor=d.emissiveFactor??[0,0,0],e.metallicRoughnessTexture=this._getTexture(d.metalTex,t,E,P),e.emissionTexture=this._getTexture(d.emissiveTex,t,E,P),e.occlusionTexture=this._getTexture(d.occlusionTex,t,E,P),e.normalTexture=this._getTexture(d.normalTex,t,E,P)),e.objectOpacity=0,e.alphaDiscardMode=2;const i=[];e.baseColorTexture&&i.push(e.baseColorTexture.loadPromise),e.usePBR&&(e.metallicRoughnessTexture&&i.push(e.metallicRoughnessTexture.loadPromise),e.emissionTexture&&i.push(e.emissionTexture.loadPromise),e.occlusionTexture&&i.push(e.occlusionTexture.loadPromise),e.normalTexture&&i.push(e.normalTexture.loadPromise));const r=Promise.all(i);s.push(r),r.then(()=>{e.alphaDiscardMode=$[d.alphaMode],e.objectOpacity=this.opacity,P.textureMemoryUsage+=e.baseColorTexture?.glTexture?.usedMemory??0,e.usePBR&&(P.textureMemoryUsage+=(e.metallicRoughnessTexture?.glTexture?.usedMemory??0)+(e.emissionTexture?.glTexture?.usedMemory??0)+(e.occlusionTexture?.glTexture?.usedMemory??0)+(e.normalTexture?.glTexture?.usedMemory??0))}),e.commonMaterialParameters.doubleSided=d.isDoubleSided,e.commonMaterialParameters.cullFace=d.faceCulling?J[d.faceCulling]:2,this._initialCullFace.set(z,e.commonMaterialParameters.cullFace),e.commonMaterialParameters.hasSlicePlane=this.slicePlaneEnabled,e.componentParameters.castShadows=0,e.textureAlphaCutoff=d.alphaCutoff??ge,e.alphaDiscardMode=$[d.alphaMode],e.isIntegratedMesh=!0,e.sphereDepthInterpolate=this.layer.replacesTerrain,e.polygonOffsetEnabled=!1,e.hasOccludees=!1,e.ellipsoidMode=ae(this.view.spatialReference)}),H.push(z),U+=this._collection.getObjectGPUMemoryUsage(z)}await Promise.all(s);const S=new Array;E.forEach(e=>{S.push(e)});const F=new ye(e.handle,H,S,O,U,P.textureMemoryUsage);return this._memCache.put(`${F.handle}`,F),this._lyrHandleToObjects.set(e.handle,F),this._cacheMemory+=F.usedMemory,{memUsageBytes:F.usedMemory}}freeRenderable(e){const t=this._lyrHandleToObjects.get(e);t&&(t.isVisible?(this._visibleObjects.delete(t),this._usedMemory-=t.usedMemory):this._cacheMemory-=t.usedMemory,this.freeObject(t),this._lyrHandleToObjects.delete(e))}freeObject(e){this._memCache.pop(`${e.handle}`),e.textures.forEach(e=>this._stage.removeTexture(e)),e.componentObjects.forEach(e=>{this._collection.destroyObject(e),this._initialCullFace.delete(e)})}setRenderableVisibility(e,t,i){for(let s=0;s<i;++s){const i=t[s];if(!i)continue;const r=e[s],o=this._lyrHandleToObjects.get(r);if(o){if(o.isVisible)continue;this._visibleGeometryChanged(),o.isVisible=!0,this._visibleObjects.add(o),this._usedMemory+=o.usedMemory,this._cacheMemory-=o.usedMemory,o.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,i),this._elevationProvider.notifyObjectChanged(this._collection.getComponentObb(e))}),this._memCache.pop(`${r}`)}}for(let s=0;s<i;++s){const i=e[s],r=t[s];if(r)continue;const o=this._lyrHandleToObjects.get(i);if(o){if(!o.isVisible)continue;this._visibleGeometryChanged(),o.isVisible=!1,this._visibleObjects.delete(o),this._usedMemory-=o.usedMemory,this._cacheMemory+=o.usedMemory,o.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,r),this._elevationProvider.notifyObjectChanged(this._collection.getComponentObb(e))}),this._memCache.put(`${i}`,o)}}}_getTexture(e,t,i,s){let r=null;if(e&&t.desc?.images&&t.data?.buffer){const o=t.desc.images[e?.imageId];if(r=i.get(o),!r&&o){const a=this._stage.renderView.renderingContext.parameters.maxMaxAnisotropy,n=!!o.mipCount||a>1,l=q[e.wrapMode??"None"];let c=o.alpha?4:3;const d=new Uint8Array(t.data.buffer,o.data.byteOffset,o.data.byteCount);let m=null,h=null,u=null;switch(o.format){case"Raw":"R8"===o.pixelFormat?(m=d,c=1,h=""):"Rgb8"===o.pixelFormat?(m=d,c=3,h=""):"Rgba8"===o.pixelFormat&&(m=d,c=4,h="");break;case"Dxt1":m=d,c=3,h="image/vnd-ms.dds";break;case"Dxt5":m=d,c=4,h="image/vnd-ms.dds";break;case"Basis":m=d,c=3,h="image/ktx2";break;case"Png":h="image/png",u=document.createElement("img");break;case"Jpeg":h="image/jpeg",u=document.createElement("img");break;case"Etc2":h="image/ktx",u=document.createElement("img");break;case"Astc":this._dbg(3,"Astc texture not supported");break;case"Pvrtc":this._dbg(3,"Pvrtc texture not supported")}if(u&&h){const e=new Blob([d],{type:h});u.src=URL.createObjectURL(e),m=u}if(m&&null!=h){const e=has("enable-feature:esri-compress-IM-textures")?{compressionTracker:this._compressionTracker,compressionCallback:e=>{e&&e>0&&(s.textureMemoryUsage-=e)}}:void 0;r=new ce(m,{mipmap:n,maxAnisotropy:a,encoding:h,wrap:l,components:c,compressionOptions:e,noUnpackFlip:!0,width:o.mip0Width,height:o.mip0Height}),this._stage.addTexture(r),i.set(o,r)}}}return r?new oe(this.view.stage.renderView.textures,r.id):null}getBufferViews(e,t,i){let s,r,o,a,n,l,c,d=null;for(let h=0;h<e.atrbs.length;h++){const c=e.atrbs[h],u=c.view,p=void 0,f=u.byteOffset+u.byteCount,g=u.byteCount/K[u.type],y=[...Array(g).keys()].map(e=>e);try{switch(c.sem){case"Position":3!==u.ncomp||"F32"!==u.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Position ("+u+")"):(s=new H(t,u.byteOffset,p,f),r=new ne(s.typedBuffer,y,3));break;case"Normal":if(3!==u.ncomp||"F32"!==u.type)this._dbg(3,"[Unsupported Feature] Unsupported view for Normal ("+u+")");else{const e=new H(t,u.byteOffset,p,f),s=le(e.typedBuffer,i);n=new F(s.buffer),l=new ne(n.typedBuffer,y,2)}break;case"TexCoord":2!==u.ncomp||"F32"!==u.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Texcoord ("+u+")"):void 0===a&&(a=new ne(new T(t,u.byteOffset,p,f).typedBuffer,y,2));break;case"Color":4===u.ncomp?("F32"===u.type&&(d=new O(t,u.byteOffset,p,f)),"U8"===u.type&&(d=new U(t,u.byteOffset,p,f)),"U16"===u.type&&(d=new P(t,u.byteOffset,p,f))):3===u.ncomp&&("F32"===u.type&&(d=new H(t,u.byteOffset,p,f)),"U8"===u.type&&(d=new E(t,u.byteOffset,p,f)),"U16"===u.type&&(d=new S(t,u.byteOffset,p,f))),null==d?this._dbg(2,"[Unsupported Feature] Unsupported view for Color ("+u+")"):o=new ne(d.typedBuffer,y,u.ncomp);break;case"FeatureIndex":break;default:this._dbg(2,"[Unsupported Feature] Unsupported semantic ("+c.sem+"). Skipping vertex attribute.")}}catch(m){this._dbg(2,"Error Creating buffer ("+m+"). Skipping vertex attribute.")}}if(e.index){const i=e.index.view,s=void 0,r=i.byteOffset+i.byteCount;switch(e.index.view.type){case"U16":c=new A(t,i.byteOffset,s,r);break;case"U32":c=new R(t,i.byteOffset,s,r);break;default:this._dbg(3,"[Unsupported Feature] index type not supported ("+i.type+").")}}if(null==c&&null!=s){const e=s.count;if(e<65535){const t=new Uint16Array(e);c=new A(t.buffer)}else{const t=new Uint32Array(e);c=new R(t.buffer)}for(let t=0;t<e;t++)c.set(t,t)}return{positionView:s,positionAttr:r,colorAttr:o,texCoord0Attr:a,indicesView:c,normalsView:n,normalsAttr:l}}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>this._modifications=e.toArray(),s),"modifications")}_deletePerObjectData(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}_dbg(e,i){this._dbgFlags.has(e)&&(3===e?t.getLogger(this).error(i):t.getLogger(this).warn(i))}};e([n({type:[k]})],_e.prototype,"_modifications",void 0),e([n()],_e.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([n()],_e.prototype,"layer",void 0),e([n({readOnly:!0})],_e.prototype,"visibleAtCurrentScale",null),e([n()],_e.prototype,"elevationOffset",null),_e=e([l("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],_e);const we=_e;export{we as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../Color.js";import t from"../../../../core/Error.js";import{px2pt as r,pt2px as i}from"../../../../core/screenUtils.js";import{fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{d as s}from"../../../../chunks/vec42.js";import{ZEROS as o,ones as l,clone as n}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import c from"../../../../geometry/Extent.js";import p from"../../../../geometry/Polygon.js";import{create as h,fromBuffer as m,intersectsClippingArea as y,empty as u,expandWithAABB as d,expandWithBuffer as _}from"../../../../geometry/support/aaBoundingBox.js";import{getDriverAxisSizeValueAny as g}from"../../../../renderers/support/renderingInfoUtils.js";import{sharedGeometryElevationAligner as f}from"./ElevationAligners.js";import{elevationModeChangeUpdateType as b,needsElevationUpdates2D as C}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as v}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as M}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as k,nanFallbackColor as P}from"./Graphics3DSymbolLayer.js";import{parseCapType as w,parseLineMarkerStyle as L}from"./lineUtils.js";import{initFastSymbolUpdatesState as S,updateFastSymbolUpdatesState as x,getAttributeValue as U,ConvertOptions as j}from"../support/FastSymbolUpdates.js";import{debugFlags as V}from"../../support/debugFlags.js";import{createGeometry as O}from"../../support/engineContent/line.js";import{geometryToRenderInfo as A,geometryToRenderInfoDraped as E}from"../../support/renderInfoUtils/line.js";import{Object3D as z}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as D}from"../../webgl-engine/lib/RenderGeometry.js";import{LineMarkerMaterial as F}from"../../webgl-engine/materials/LineMarkerMaterial.js";import{getStipplePatternForLinePattern as G}from"../../webgl-engine/materials/lineStippleUtils.js";import{RibbonLineMaterial as R}from"../../webgl-engine/materials/RibbonLineMaterial.js";const I=["polyline","polygon","extent"];class W extends k{static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,r,i){super(e,t,r,i,T(t))}async doLoad(){this._fastUpdates=S(this._context.renderer,this._fastVisualVariableConvertOptions());const e=!0;if(this._fastMarkerUpdates=S(this._context.renderer,this._fastVisualVariableConvertOptions(e)),!this._drivenProperties.size){if((null!=this.symbolLayer.size?this.symbolLayer.size:r(1))<0)throw new t("graphics3dlinesymbollayer:invalid-size","Symbol sizes may not be negative values")}}_getMaterialParameters(e,t){const r={...this._getMaterialColorParameters(t),width:this._computeMaterialWidth(this.symbolLayer?.size),hasPolygonOffset:!0,join:this.symbolLayer.join||"miter",cap:w(this.symbolLayer.cap||"butt"),hasSlicePlane:this._context.slicePlaneEnabled,isClosed:e,stipplePattern:G(this.symbolLayer.pattern),emissiveStrength:this._emissiveStrength??0};return 4===t&&this._fastMarkerUpdates?.visualVariables?{...r,...this._fastMarkerUpdates.materialParameters}:this._fastUpdates?.visualVariables?{...r,...this._fastUpdates.materialParameters}:r}_getMaterialColorParameters(e){const t=4===e,r=this._getCombinedOpacityAndColor(t&&this._markerColor||this._materialColor);return this._patternHidesLine&&!t&&(r[3]=0),{color:r}}get _materialColor(){return this.symbolLayer.material?.color}get _emissiveStrength(){return this.symbolLayer.material?.emissive?.strength}get _markerColor(){return this.symbolLayer.marker?.color}get _lineMaterial(){return null==this._materials[0]&&(this._materials[0]=new R(this._getMaterialParameters(!1,0))),this._materials[0]}get _ringMaterial(){return null==this._materials[1]&&(this._materials[1]=new R(this._getMaterialParameters(!0,1))),this._materials[1]}get _wireframeLineMaterial(){return null==this._materials[2]&&(this._materials[2]=new R({...this._getMaterialParameters(!1,2),wireframe:!0})),this._materials[2]}get _wireframeRingMaterial(){return null==this._materials[3]&&(this._materials[3]=new R({...this._getMaterialParameters(!0,3),wireframe:!0})),this._materials[3]}get _markerMaterial(){return null==this._materials[4]&&null!=this.symbolLayer.marker&&(this._materials[4]=new F({...this._getMaterialParameters(!1,4),placement:this.symbolLayer.marker.placement,markerPrimitive:L(this.symbolLayer.marker.style)})),this._materials[4]}_getDrivenSize(e){if(this._drivenProperties.size){const t=e.size;return null!=t?i(g(t)):this._getFallbackSize()}return 1}_getDrivenColor({color:e,opacity:t}){const r=l();return this._drivenProperties.color&&(s(r,e??this._getFallbackOpacityAndColor(o)),null==t)||this._drivenProperties.opacity&&(e||this._materialColor)&&(r[3]=t??this._getFallbackOpacity()),r}_getDrivenMarkerColor({color:e,opacity:t}){const r=l();return this._drivenProperties.color&&(s(r,e??this._getFallbackMarkerOpacityAndColor(o)),null==t)||this._drivenProperties.opacity&&(e||this._markerColor||this._materialColor)&&(r[3]=t??this._getFallbackMarkerOpacity()),r}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,I,this.symbolLayer.type))return null;const r=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus("on-the-ground"===r.mode),this.draped?this._createAsOverlay(e):this._createAs3DShape(e,r,t.uid)}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return 0;{const e=this._fastUpdates;if(!x(e,t,this._fastVisualVariableConvertOptions()))return 0;for(const t of this._materials)t instanceof R&&t.setParameters(e.materialParameters);const r=this._fastMarkerUpdates,i=!0;if(!x(r,t,this._fastVisualVariableConvertOptions(i)))return 0;for(const t of this._materials)t instanceof F&&t.setParameters(r.materialParameters)}}return 2}prepareSymbolLayerPatch(e){if("partial"!==e.diff.type)return;const t=e.diff.diff,r={};"complete"===t.size?.type&&(r.width=this._computeMaterialWidth(t.size.newValue),delete t.size),"complete"===t.cap?.type&&(r.cap=w(t.cap.newValue??"butt"),delete t.cap);const i=this._prepareMarkerPatch(e,t);this._prepareMaterialPatch(e,t,i),e.symbolLayerStatePatches.push(()=>{for(const e of this._materials)e?.setParameters(r)})}layerOpacityChanged(){for(let e=0;e<5;e++){const t=this._materials[e];t&&t.setParameters(this._getMaterialColorParameters(e))}}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,a=b(W.elevationModeChangeTypes,r,i);if(1!==a)return a;const s=C(i);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>s)}slicePlaneEnabledChanged(){const e={hasSlicePlane:this._context.slicePlaneEnabled};for(const t of this._materials)t?.setParameters(e);return!0}physicalBasedRenderingChanged(){return!0}_createAs3DShape(e,t,r){const i=H(e.graphic.geometry),a="polygon"===i.type?i.rings:i.paths,s=new Array,o=h(),l=A(i,this._context.elevationProvider,this._context.renderCoordsHelper,t),n="polygon"===i.type?"rings":"paths";this._logGeometryCreationWarnings(l,a,n,"LineSymbol3DLayer");for(let h=0;h<l.lines.length;h++){const t=l.lines[h],a=t.position,n=t.mapPositions;if(null!=this._context.clippingExtent&&(m(n,o),!y(o,this._context.clippingExtent)))continue;const c=this._createGeometry("polygon"===i.type?this._ringMaterial:this._lineMaterial,e,a,n,i.type,1,r);if(s.push(c),V.LINE_WIREFRAMES&&s.push(c.instantiate({material:"polygon"===i.type?this._wireframeRingMaterial:this._wireframeLineMaterial})),null!=this._markerMaterial){const t=c.instantiate({material:this._markerMaterial});t.attributes.has("color")&&t.setAttributeData("color",this._getDrivenMarkerColor(e.renderingInfo)),s.push(t)}}if(0===s.length)return null;const c=this._context.layerViewUid,p=new z({geometries:s,castShadow:!1,layerViewUid:c,graphicUid:r}),u=new M(this,p,null,f,t);return u.alignedSampledElevation=l.sampledElevation,u.needsElevationUpdates=C(t.mode),u}_createGeometry(e,t,r,i,a,s,o){const l=0===s?{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper}:null,n="polygon"===a,c=this._fastUpdates?.visualVariables.color,p=this._fastUpdates?.visualVariables.size,h=this._fastUpdates?.visualVariables.opacity,m=this._context.layerViewUid,y=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:o,layerViewUid:m}),u={position:r,size:p?null:this._getDrivenSize(t.renderingInfo),color:c?null:this._getDrivenColor(t.renderingInfo),sizeFeature:p?U(p.field,t.graphic):null,colorFeature:c?U(c.field,t.graphic):null,opacityFeature:h?U(h.field,t.graphic):null};return O(e,{overlayInfo:l,removeDuplicateStartEnd:n,mapPositions:i,attributeData:u},y)}_createAsOverlay(e){const t=e.graphic,r=H(t.geometry),i="polygon"===r.type?r.rings:r.paths,a="polygon"===r.type?this._ringMaterial:this._lineMaterial;a.renderPriority=this._renderPriority;const s=V.LINE_WIREFRAMES?"polygon"===r.type?this._wireframeRingMaterial:this._wireframeLineMaterial:null,o=this._markerMaterial;null!=s&&(s.renderPriority=this._renderPriority-.001),null!=o&&(o.renderPriority=this._renderPriority-.002);const l=new Array,n=h(),c=u(),p=E(r,this._context.overlaySR),g="polygon"===r.type?"rings":"paths";this._logGeometryCreationWarnings(p,i,g,"LineSymbol3DLayer");for(const h of p.lines){if(m(h.position,n),!y(n,this._context.clippingExtent))continue;d(c,n);const i=this._createGeometry(a,e,h.position,void 0,r.type,0,t.uid),p=e=>{const r=this._context.layerViewUid,i=new D(e,{layerViewUid:r,graphicUid:t.uid});l.push(i)};if(null!=o){const t=i.instantiate({material:o});t.attributes.has("color")&&t.setAttributeData("color",this._getDrivenMarkerColor(e.renderingInfo)),p(t);const r=this.symbolLayer.marker.placement;"begin"!==r&&"begin-end"!==r||_(n,h.position,0,1),"end"!==r&&"begin-end"!==r||_(n,h.position,h.position.length-3,1)}p(i),V.LINE_WIREFRAMES&&p(i.instantiate({material:s}))}return new v(this,l,c,this._context.drapeSourceRenderer)}get _patternHidesLine(){const e=this.symbolLayer.pattern;return null!=e&&"style"===e.type&&"none"===e.style}_computeMaterialWidth(e){return e=e??r(1),this._drivenProperties.size?this._fastUpdates?.visualVariables.size?i(1):1:i(e)}_prepareMaterialPatch(e,t,r){const i=t.material;if(null==i)return void(r.changed&&r.useMaterialColor&&B(this._getCombinedOpacityAndColor(this._materialColor),this._materials[4],e));if("collection"===i.type)return;const a="complete"===i.type?i.newValue?.color:"complete"===i.diff.color?.type?i.diff.color.newValue:null,s=this._getCombinedOpacityAndColor(a);r.useMaterialColor&&B(n(s),this._materials[4],e),this._patternHidesLine&&(s[3]=0),B(s,this._materials[0],e),delete t.material}_prepareMarkerPatch(e,t){const r=t.marker,i=this._markerMaterial;if(null==r||"partial"!==r.type||null==r.diff||null!=r.diff.placement||null!=r.diff.style&&"complete"!==r.diff.style.type||null!=r.diff.color&&"complete"!==r.diff.color.type||null==i)return{changed:!1,useMaterialColor:null==this._markerColor};const a=r.diff.color,s=null!=a,o=s?a.newValue:null,l=null==o&&null==this._markerColor;o&&B(this._getCombinedOpacityAndColor(o),i,e);const n=r.diff.style?.newValue;return n&&e.symbolLayerStatePatches.push(()=>i.setParameters({markerPrimitive:L(n)})),delete t.marker,{changed:s,useMaterialColor:l}}_fastVisualVariableConvertOptions(e=!1){const t=this._getFallbackSize();return new j({supports:{size:!0,color:!0,rotation:!1,opacity:!0},fallbackColor:e?this._getFallbackMarkerOpacityAndColor(P):this._getFallbackOpacityAndColor(P),fallbackSize:a(t,t,t)})}_getFallbackOpacityAndColor(t){return e.toUnitRGBA(this._materialColor)??t}_getFallbackOpacity(){return this._materialColor?.a??0}_getFallbackMarkerOpacityAndColor(t){const r=this.symbolLayer?.marker?.color;return e.toUnitRGBA(r)??this._getFallbackOpacityAndColor(t)}_getFallbackMarkerOpacity(){return this.symbolLayer?.marker?.color?.a??this._getFallbackOpacity()}_getFallbackSize(){const e=this.symbolLayer?.size;return null!=e?i(e):1}}function H(e){switch(e.type){case"extent":if(e instanceof c)return p.fromExtent(e);break;case"polygon":case"polyline":return e}return null}function B(e,t,r){null!=t&&r.symbolLayerStatePatches.push(()=>t.setParameters({color:e}))}function T(e){const t=e.material?.color,r=e.marker?.color??t;return 1===(t?.a??0)&&1===(r?.a??0)}export{W as Graphics3DLineSymbolLayer};
|
|
5
|
+
import e from"../../../../Color.js";import t from"../../../../core/Error.js";import{px2pt as r,pt2px as i}from"../../../../core/screenUtils.js";import{fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{d as s}from"../../../../chunks/vec42.js";import{ZEROS as o,ones as l,clone as n}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import c from"../../../../geometry/Extent.js";import h from"../../../../geometry/Polygon.js";import{create as p,fromBuffer as m,intersectsClippingArea as y,empty as u,expandWithAABB as _,expandWithBuffer as d}from"../../../../geometry/support/aaBoundingBox.js";import{getDriverAxisSizeValueAny as f}from"../../../../renderers/support/renderingInfoUtils.js";import{sharedGeometryElevationAligner as g}from"./ElevationAligners.js";import{elevationModeChangeUpdateType as b,needsElevationUpdates2D as v}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as C}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as P}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as M,nanFallbackColor as k}from"./Graphics3DSymbolLayer.js";import{parseCapType as w,parseLineMarkerStyle as L}from"./lineUtils.js";import{initFastSymbolUpdatesState as S,updateFastSymbolUpdatesState as x,getAttributeValue as z,ConvertOptions as U}from"../support/FastSymbolUpdates.js";import{debugFlags as j}from"../../support/debugFlags.js";import{createGeometry as V}from"../../support/engineContent/line.js";import{geometryToRenderInfo as O,geometryToRenderInfoDraped as E}from"../../support/renderInfoUtils/line.js";import{Object3D as A}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as G}from"../../webgl-engine/lib/RenderGeometry.js";import{LineMarkerMaterial as D}from"../../webgl-engine/materials/LineMarkerMaterial.js";import{getStipplePatternForLinePattern as F}from"../../webgl-engine/materials/lineStippleUtils.js";import{RibbonLineMaterial as R}from"../../webgl-engine/materials/RibbonLineMaterial.js";const I=["polyline","polygon","extent"];class W extends M{static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,r,i){super(e,t,r,i,T(t))}async doLoad(){this._fastUpdates=S(this._context.renderer,this._fastVisualVariableConvertOptions());const e=!0;if(this._fastMarkerUpdates=S(this._context.renderer,this._fastVisualVariableConvertOptions(e)),!this._drivenProperties.size){if((null!=this.symbolLayer.size?this.symbolLayer.size:r(1))<0)throw new t("graphics3dlinesymbollayer:invalid-size","Symbol sizes may not be negative values")}}_getMaterialParameters(e,t){const r=this._context.screenSizePerspectiveEnabled?this.view.screenSizePerspective.parameters:null,i={...this._getMaterialColorParameters(t),width:this._computeMaterialWidth(this.symbolLayer?.size),hasPolygonOffset:!0,join:this.symbolLayer.join||"miter",cap:w(this.symbolLayer.cap||"butt"),hasSlicePlane:this._context.slicePlaneEnabled,isClosed:e,stipplePattern:F(this.symbolLayer.pattern),emissiveStrength:this._emissiveStrength??0,screenSizePerspective:r};return 4===t&&this._fastMarkerUpdates?.visualVariables?{...i,...this._fastMarkerUpdates.materialParameters}:this._fastUpdates?.visualVariables?{...i,...this._fastUpdates.materialParameters}:i}_getMaterialColorParameters(e){const t=4===e,r=this._getCombinedOpacityAndColor(t&&this._markerColor||this._materialColor);return this._patternHidesLine&&!t&&(r[3]=0),{color:r}}get _materialColor(){return this.symbolLayer.material?.color}get _emissiveStrength(){return this.symbolLayer.material?.emissive?.strength}get _markerColor(){return this.symbolLayer.marker?.color}get _lineMaterial(){return null==this._materials[0]&&(this._materials[0]=new R(this._getMaterialParameters(!1,0),this.view.state.isGlobal)),this._materials[0]}get _ringMaterial(){return null==this._materials[1]&&(this._materials[1]=new R(this._getMaterialParameters(!0,1),this.view.state.isGlobal)),this._materials[1]}get _wireframeLineMaterial(){return null==this._materials[2]&&(this._materials[2]=new R({...this._getMaterialParameters(!1,2),wireframe:!0},this.view.state.isGlobal)),this._materials[2]}get _wireframeRingMaterial(){return null==this._materials[3]&&(this._materials[3]=new R({...this._getMaterialParameters(!0,3),wireframe:!0},this.view.state.isGlobal)),this._materials[3]}get _markerMaterial(){return null==this._materials[4]&&null!=this.symbolLayer.marker&&(this._materials[4]=new D({...this._getMaterialParameters(!1,4),placement:this.symbolLayer.marker.placement,markerPrimitive:L(this.symbolLayer.marker.style)},this.view.state.isGlobal)),this._materials[4]}_getDrivenSize(e){if(this._drivenProperties.size){const t=e.size;return null!=t?i(f(t)):this._getFallbackSize()}return 1}_getDrivenColor({color:e,opacity:t}){const r=l();return this._drivenProperties.color&&(s(r,e??this._getFallbackOpacityAndColor(o)),null==t)||this._drivenProperties.opacity&&(e||this._materialColor)&&(r[3]=t??this._getFallbackOpacity()),r}_getDrivenMarkerColor({color:e,opacity:t}){const r=l();return this._drivenProperties.color&&(s(r,e??this._getFallbackMarkerOpacityAndColor(o)),null==t)||this._drivenProperties.opacity&&(e||this._markerColor||this._materialColor)&&(r[3]=t??this._getFallbackMarkerOpacity()),r}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,I,this.symbolLayer.type))return null;const r=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus("on-the-ground"===r.mode),this.draped?this._createAsOverlay(e):this._createAs3DShape(e,r,t.uid)}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return 0;{const e=this._fastUpdates;if(!x(e,t,this._fastVisualVariableConvertOptions()))return 0;for(const t of this._materials)t instanceof R&&t.setParameters(e.materialParameters);const r=this._fastMarkerUpdates,i=!0;if(!x(r,t,this._fastVisualVariableConvertOptions(i)))return 0;for(const t of this._materials)t instanceof D&&t.setParameters(r.materialParameters)}}return 2}prepareSymbolLayerPatch(e){if("partial"!==e.diff.type)return;const t=e.diff.diff,r={};"complete"===t.size?.type&&(r.width=this._computeMaterialWidth(t.size.newValue),delete t.size),"complete"===t.cap?.type&&(r.cap=w(t.cap.newValue??"butt"),delete t.cap);const i=this._prepareMarkerPatch(e,t);this._prepareMaterialPatch(e,t,i),e.symbolLayerStatePatches.push(()=>{for(const e of this._materials)e?.setParameters(r)})}layerOpacityChanged(){for(let e=0;e<5;e++)this._materials[e]?.setParameters(this._getMaterialColorParameters(e))}layerScreenSizePerspectiveChanged(){const e=this._context.screenSizePerspectiveEnabled?this.view.screenSizePerspective.parameters:null;for(const t of this._materials)t?.setParameters({screenSizePerspective:e})}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,a=b(W.elevationModeChangeTypes,r,i);if(1!==a)return a;const s=v(i);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>s)}slicePlaneEnabledChanged(){const e={hasSlicePlane:this._context.slicePlaneEnabled};for(const t of this._materials)t?.setParameters(e);return!0}physicalBasedRenderingChanged(){return!0}_createAs3DShape(e,t,r){const i=H(e.graphic.geometry),a="polygon"===i.type?i.rings:i.paths,s=new Array,o=p(),l=O(i,this._context.elevationProvider,this._context.renderCoordsHelper,t),n="polygon"===i.type?"rings":"paths";this._logGeometryCreationWarnings(l,a,n,"LineSymbol3DLayer");for(let p=0;p<l.lines.length;p++){const t=l.lines[p],a=t.position,n=t.mapPositions;if(null!=this._context.clippingExtent&&(m(n,o),!y(o,this._context.clippingExtent)))continue;const c=this._createGeometry("polygon"===i.type?this._ringMaterial:this._lineMaterial,e,a,n,i.type,1,r);if(s.push(c),j.LINE_WIREFRAMES&&s.push(c.instantiate({material:"polygon"===i.type?this._wireframeRingMaterial:this._wireframeLineMaterial})),null!=this._markerMaterial){const t=c.instantiate({material:this._markerMaterial});t.attributes.has("color")&&t.setAttributeData("color",this._getDrivenMarkerColor(e.renderingInfo)),s.push(t)}}if(0===s.length)return null;const c=this._context.layerViewUid,h=new A({geometries:s,castShadow:!1,layerViewUid:c,graphicUid:r}),u=new P(this,h,null,g,t);return u.alignedSampledElevation=l.sampledElevation,u.needsElevationUpdates=v(t.mode),u}_createGeometry(e,t,r,i,a,s,o){const l=0===s?{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper}:null,n="polygon"===a,c=this._fastUpdates?.visualVariables.color,h=this._fastUpdates?.visualVariables.size,p=this._fastUpdates?.visualVariables.opacity,m=this._context.layerViewUid,y=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:o,layerViewUid:m}),u={position:r,size:h?null:this._getDrivenSize(t.renderingInfo),color:c?null:this._getDrivenColor(t.renderingInfo),sizeFeature:h?z(h.field,t.graphic):null,colorFeature:c?z(c.field,t.graphic):null,opacityFeature:p?z(p.field,t.graphic):null};return V(e,{overlayInfo:l,removeDuplicateStartEnd:n,mapPositions:i,attributeData:u},y)}_createAsOverlay(e){const t=e.graphic,r=H(t.geometry),i="polygon"===r.type?r.rings:r.paths,a="polygon"===r.type?this._ringMaterial:this._lineMaterial;a.renderPriority=this._renderPriority;const s=j.LINE_WIREFRAMES?"polygon"===r.type?this._wireframeRingMaterial:this._wireframeLineMaterial:null,o=this._markerMaterial;null!=s&&(s.renderPriority=this._renderPriority-.001),null!=o&&(o.renderPriority=this._renderPriority-.002);const l=new Array,n=p(),c=u(),h=E(r,this._context.overlaySR),f="polygon"===r.type?"rings":"paths";this._logGeometryCreationWarnings(h,i,f,"LineSymbol3DLayer");for(const p of h.lines){if(m(p.position,n),!y(n,this._context.clippingExtent))continue;_(c,n);const i=this._createGeometry(a,e,p.position,void 0,r.type,0,t.uid),h=e=>{const r=this._context.layerViewUid,i=new G(e,{layerViewUid:r,graphicUid:t.uid});l.push(i)};if(null!=o){const t=i.instantiate({material:o});t.attributes.has("color")&&t.setAttributeData("color",this._getDrivenMarkerColor(e.renderingInfo)),h(t);const r=this.symbolLayer.marker.placement;"begin"!==r&&"begin-end"!==r||d(n,p.position,0,1),"end"!==r&&"begin-end"!==r||d(n,p.position,p.position.length-3,1)}h(i),j.LINE_WIREFRAMES&&h(i.instantiate({material:s}))}return new C(this,l,c,this._context.drapeSourceRenderer)}get _patternHidesLine(){const e=this.symbolLayer.pattern;return null!=e&&"style"===e.type&&"none"===e.style}_computeMaterialWidth(e){return e=e??r(1),this._drivenProperties.size?this._fastUpdates?.visualVariables.size?i(1):1:i(e)}_prepareMaterialPatch(e,t,r){const i=t.material;if(null==i)return void(r.changed&&r.useMaterialColor&&B(this._getCombinedOpacityAndColor(this._materialColor),this._materials[4],e));if("collection"===i.type)return;const a="complete"===i.type?i.newValue?.color:"complete"===i.diff.color?.type?i.diff.color.newValue:null,s=this._getCombinedOpacityAndColor(a);r.useMaterialColor&&B(n(s),this._materials[4],e),this._patternHidesLine&&(s[3]=0),B(s,this._materials[0],e),delete t.material}_prepareMarkerPatch(e,t){const r=t.marker,i=this._markerMaterial;if(null==r||"partial"!==r.type||null==r.diff||null!=r.diff.placement||null!=r.diff.style&&"complete"!==r.diff.style.type||null!=r.diff.color&&"complete"!==r.diff.color.type||null==i)return{changed:!1,useMaterialColor:null==this._markerColor};const a=r.diff.color,s=null!=a,o=s?a.newValue:null,l=null==o&&null==this._markerColor;o&&B(this._getCombinedOpacityAndColor(o),i,e);const n=r.diff.style?.newValue;return n&&e.symbolLayerStatePatches.push(()=>i.setParameters({markerPrimitive:L(n)})),delete t.marker,{changed:s,useMaterialColor:l}}_fastVisualVariableConvertOptions(e=!1){const t=this._getFallbackSize();return new U({supports:{size:!0,color:!0,rotation:!1,opacity:!0},fallbackColor:e?this._getFallbackMarkerOpacityAndColor(k):this._getFallbackOpacityAndColor(k),fallbackSize:a(t,t,t)})}_getFallbackOpacityAndColor(t){return e.toUnitRGBA(this._materialColor)??t}_getFallbackOpacity(){return this._materialColor?.a??0}_getFallbackMarkerOpacityAndColor(t){const r=this.symbolLayer?.marker?.color;return e.toUnitRGBA(r)??this._getFallbackOpacityAndColor(t)}_getFallbackMarkerOpacity(){return this.symbolLayer?.marker?.color?.a??this._getFallbackOpacity()}_getFallbackSize(){const e=this.symbolLayer?.size;return null!=e?i(e):1}}function H(e){switch(e.type){case"extent":if(e instanceof c)return h.fromExtent(e);break;case"polygon":case"polyline":return e}return null}function B(e,t,r){null!=t&&r.symbolLayerStatePatches.push(()=>t.setParameters({color:e}))}function T(e){const t=e.material?.color,r=e.marker?.color??t;return 1===(t?.a??0)&&1===(r?.a??0)}export{W as Graphics3DLineSymbolLayer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../Color.js";import{pt2px as t}from"../../../../core/screenUtils.js";import{e as
|
|
5
|
+
import e from"../../../../Color.js";import{pt2px as t}from"../../../../core/screenUtils.js";import{e as i}from"../../../../chunks/earcut.js";import{ZEROS as r}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromBuffer as s,create as o,intersectsClippingArea as n,empty as a,expandWithAABB as l}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as c,doubleSubArray as p}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as h,floatSubArray as u}from"../../../../geometry/support/FloatArray.js";import{elevationModeChangeUpdateType as d,needsElevationUpdates2D as m}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as _}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as g}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as y}from"./Graphics3DSymbolLayer.js";import{mixinColorAndOpacity as f}from"./graphicUtils.js";import{parseCapType as v}from"./lineUtils.js";import{geometryAsPolygon as b,createIndices3D as x,createColorGeometry as C,PolygonCreationDataBase as S}from"./polygonUtils.js";import{initFastSymbolUpdatesState as P,updateFastSymbolUpdatesState as D,getAttributeValue as O,ConvertOptions as U}from"../support/FastSymbolUpdates.js";import{createMaterial as j,uvElevationAligner as w}from"../support/patternUtils.js";import{createMapSpaceUVCoords as G,createMapSpaceUVCoordsDraped as A}from"../support/uvUtils.js";import{createGeometry as E}from"../../support/engineContent/line.js";import{geometryToRenderInfo as M,geometryToRenderInfoDraped as V}from"../../support/renderInfoUtils/polygon.js";import{Object3D as L}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as R}from"../../webgl-engine/lib/RenderGeometry.js";import{isScreenSizePerspectiveEnabled as z}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{getStipplePatternForLinePattern as B}from"../../webgl-engine/materials/lineStippleUtils.js";import{PatternMaterial as F}from"../../webgl-engine/materials/PatternMaterial.js";import{RibbonLineMaterial as I}from"../../webgl-engine/materials/RibbonLineMaterial.js";const T=["polyline","polygon","extent"];class H extends y{static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,i,r){super(e,t,i,r,K(t)),this._needsUV=!1,this._materials=[]}async doLoad(){this._fastUpdates=P(this._context.renderer,this._vvConvertOptions)}get _materialColor(){return this.symbolLayer.material?.color}_createMaterials(){if(this._materials.length>0)return;const e=this._materialColor,i=this._getCombinedOpacityAndColor(e);this._materials[0]=j(this.symbolLayer,{color:i,forceTransparentMode:this.needsDrivenTransparentPass,discardInvisibleFragments:!0,polygonOffset:!1,hasVertexColors:!0,draped:this.draped,hasSlicePlane:this._context.slicePlaneEnabled,...this._fastUpdates?.materialParameters}),this._needsUV=this._materials[0]instanceof F;const r=this.symbolLayer.outline;if(J(r)){const e=B(r.pattern);this._materials[1]=new I({width:t(r.size),color:this._getOutlineColor(),hasPolygonOffset:!0,hasSlicePlane:this._context.slicePlaneEnabled,isClosed:!0,stipplePattern:e,cap:v(r.patternCap||"butt"),screenSizePerspective:this._outlineScreenSizePerspective},this.view.state.isGlobal)}}get _outlineScreenSizePerspective(){return!this.draped&&z(this._context.layer.screenSizePerspectiveEnabled)?this.view.screenSizePerspective.parameters:null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,T,this.symbolLayer.type))return null;const i=this._getDrivenUInt8Color(e.renderingInfo,this._materialColor,!1),r=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus("on-the-ground"===r.mode),this._createMaterials(),this.draped?this._createAsOverlay(t,i):this._createAs3DShape(t,i,r)}applyRendererDiff(e,t){for(const i in e.diff){if("visualVariables"!==i)return 0;if(!D(this._fastUpdates,t,this._vvConvertOptions))return 0;this._materials[0]?.setParameters(this._fastUpdates.materialParameters)}return 2}layerOpacityChanged(){if(null!=this._materials[0]){const e=this._materials[0].parameters.color,t=this._materialColor,i=this._getCombinedOpacity(t);this._materials[0].setParameters({color:[e[0],e[1],e[2],i],forceTransparentMode:this.needsDrivenTransparentPass})}if(null!=this._materials[1]){const e=this._materials[1].parameters.color;this._materials[1].setParameters({color:[e[0],e[1],e[2],this._getOutlineOpacity()]})}}layerScreenSizePerspectiveChanged(){this._materials[1]?.setParameters({screenSizePerspective:this._outlineScreenSizePerspective})}layerElevationInfoChanged(e,t,i){const r=this._elevationContext.mode,s=d(H.elevationModeChangeTypes,i,r);if(1!==s)return s;const o=m(r);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>o)}slicePlaneEnabledChanged(){if(this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[1]){const e={hasSlicePlane:this._context.slicePlaneEnabled};this._materials[1].setParameters(e)}return!0}physicalBasedRenderingChanged(){return!0}_createAs3DShape(e,t,i){const r=b(e.geometry);if(!r)return null;const s=M(r,this._context.elevationProvider,this._context.renderCoordsHelper,i),o=new W(s,t,this._context.layerViewUid,e.uid),n=o.renderData.position.length/3;if(this._needsUV&&(o.uvMapSpace=h(4*n,!0),o.boundingRect=c(9*n),G(o.uvMapSpace,o.boundingRect,o.renderData.position,this._context.renderCoordsHelper)),o.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(o),this._createAs3DShapeFill(e,o),this._materials[1]&&this._createAs3DShapeOutline(o),this._logGeometryCreationWarnings(o.renderData,r.rings,"rings","FillSymbol3DLayer"),0===o.outGeometries.length)return null;const a=new L({geometries:o.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:e.uid}),l=new g(this,a,null,w,i);return l.alignedSampledElevation=o.renderData.sampledElevation,l.needsElevationUpdates=m(i.mode),l}_createAs3DShapeFill(e,t){const i=t.renderData.polygons;for(const{position:r,mapPositions:o,holeIndices:a,index:l,count:c}of i){if(null!=this._context.clippingExtent&&(s(o,k),!n(k,this._context.clippingExtent)))continue;const i=x(o,a,this._context.elevationProvider.spatialReference);if(0===i.length)continue;const h=this._fastUpdates?.visualVariables.color,d=C({material:this._materials[0],indices:i,mapPositions:o,attributeData:{position:r,color:h?null:t.color,colorFeature:h?O(h.field,e):null,uvMapSpace:this._needsUV?u(t.uvMapSpace,4*l,4*c):null,boundingRect:this._needsUV?p(t.boundingRect,9*l,9*c):null,olidColor:t.olidColor}});t.outGeometries.push(d)}}_createAs3DShapeOutline(e){if(null==this._materials[1])return;const t=e.renderData.outlines;for(const{mapPositions:i,position:r}of t){if(null!=this._context.clippingExtent&&(s(i,k),!n(k,this._context.clippingExtent)))continue;const t=E(this._materials[1],{overlayInfo:null,removeDuplicateStartEnd:!0,mapPositions:i,attributeData:{position:r}},e.olidColor);e.outGeometries.push(t)}}_createAsOverlay(e,t){const i=b(e.geometry);if(null==i)return null;this._materials[0].renderPriority=this._renderPriority+this._renderPriorityStep/2,null!=this._materials[1]&&(this._materials[1].renderPriority=this._renderPriority);const r=V(i,this._context.overlaySR),s=new q(r,t,this._context.layerViewUid,e.uid),o=s.renderData.position.length/3;return this._needsUV&&(s.uvMapSpace=h(4*o,!0),A(s.uvMapSpace,s.renderData.position,this._context.overlaySR,this._context.graphicsCoreOwner.view.state.viewingMode)),s.outBoundingBox=a(),s.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(s),this._createAsOverlayFill(e,s),this._materials[1]&&this._createAsOverlayOutline(s),this._logGeometryCreationWarnings(s.renderData,i.rings,"rings","FillSymbol3DLayer"),0===s.outGeometries.length?null:new _(this,s.outGeometries,s.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayFill(e,t){const r=t.renderData.polygons;for(const{position:o,holeIndices:a,index:c,count:p}of r){const r=s(o,k);if(!n(r,this._context.clippingExtent))continue;const h=i(o,a,3);if(0===h.length)continue;l(t.outBoundingBox,r);const d=this._fastUpdates?.visualVariables.color,m=C({material:this._materials[0],indices:h,attributeData:{position:o,color:d?null:t.color,colorFeature:d?O(d.field,e):null,uvMapSpace:this._needsUV?u(t.uvMapSpace,4*c,4*p):null,olidColor:t.olidColor}});t.outGeometries.push(new R(m,t))}}_createAsOverlayOutline(e){if(null==this._materials[1])return;const t=e.renderData.outlines;for(let i=0;i<t.length;++i){const{position:r}=t[i];if(s(r,k),!n(k,this._context.clippingExtent))continue;l(e.outBoundingBox,k);const o=E(this._materials[1],{overlayInfo:{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper},removeDuplicateStartEnd:!0,attributeData:{position:r}},e.olidColor);e.outGeometries.push(new R(o,e))}}_getOutlineOpacity(){const e=this.symbolLayer?.outline?.color;return(this.draped?1:this._getLayerOpacity())*(null!=e?e.a:0)}_getOutlineColor(){const t=this.symbolLayer?.outline?.color,i=this._getOutlineOpacity();return f(null!=t?e.toUnitRGB(t):null,i)}test(){return{...super.test(),createAsOverlay:(e,t)=>this._createAsOverlay(e,t),createAs3DShape:(e,t,i)=>this._createAs3DShape(e,t,i)}}get _vvConvertOptions(){return new U({supports:{size:!1,color:!0,rotation:!1,opacity:!1},fallbackColor:e.toUnitRGBA(this._materialColor)??r})}}const k=o();class W extends S{constructor(e,t,i,r){super(e,i,r),this.color=t}}class q extends S{constructor(e,t,i,r){super(e,i,r),this.color=t}}function J(e){return null!=e?.size&&e.size>0&&null!=e.color&&(null==e.pattern||"style"!==e.pattern.type||"none"!==e.pattern.style)}function K(e){return 1===(e.material?.color?.a??0)}export{H as Graphics3DPolygonFillSymbolLayer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Tiles3DTarget as i}from"../i3s/Intersector.js";import{IntersectorResult as t}from"../../webgl-engine/lib/IntersectorResult.js";import{MeshIntersectionOptions as
|
|
5
|
+
import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Tiles3DTarget as i}from"../i3s/Intersector.js";import{IntersectorResult as t}from"../../webgl-engine/lib/IntersectorResult.js";import{MeshIntersectionOptions as s,computeInvDir as n,intersectAabbInvDir as r}from"../../webgl-engine/lib/RayIntersections.js";class o{constructor(e){this.type=8,this.slicePlaneEnabled=!1,this.isGround=!0,this.layerView=e,this.layerViewUid=e.uid}intersect(e,o,a,c,d,u){if(e.options.filteredLayerViewUids.includes(this.layerView.uid))return;const m=e.results,p=2===e.options.store,w=this.layerView.view.stage.renderView.componentObjectCollection,f=new s(u,e.options.normalRequired),h=n(a,c,l),y=(s,n,r)=>{if(n>=0){if(null!=o&&!o(a,c,n))return;const s=e=>{const t=new i(this.layerView.layer.uid);e.set(this.type,t,n,r)};if(this.isGround&&(null==m.ground.distance||n<m.ground.distance)&&s(m.ground),e.options.isFiltered)return;if((null==m.min.distance||n<m.min.distance)&&s(m.min),(null==m.max.distance||n>m.max.distance)&&s(m.max),p){const i=new t(e.ray);s(i),e.results.all.push(i)}}};this.layerView.forEachVisibleComponentObject(i=>{r(i.aabbInWorldCoordinates,a,h,0)&&w.intersect(i,a,c,e.tolerance,null,f,y)})}}const l=e();export{o as Tiles3DIntersectionHandler};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{eyeWithinExtent as s}from"../camera/intersectionUtils.js";import{applySurfaceCollisionConstraint as
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{eyeWithinExtent as s}from"../camera/intersectionUtils.js";import{applySurfaceCollisionConstraint as i}from"../camera/constraintUtils/surfaceCollision.js";let a=class extends t{constructor(e){super(e)}initialize(){this.addHandles(this.view.elevationProvider.on("elevation-change",e=>this._handleElevationChangeEvent(e)))}_handleElevationChangeEvent(e){if(this.view.state.cameraController||"ground"!==e.context)return;const t=this.view.state.camera;null!=e.spatialReference&&s(this.view,t,e.extent,e.spatialReference)&&this._applyToCurrentCamera()}_applyToCurrentCamera(){this.view.state.updateCamera(e=>i(this.view,e,1))}};e([r({constructOnly:!0})],a.prototype,"view",void 0),a=e([o("esri.views.3d.state.SurfaceCollisionConstraint")],a);export{a as SurfaceCollisionConstraint};
|