@arcgis/core 4.31.0-next.20240708 → 4.31.0-next.20240710
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{0975e54c50383375cc09.js → 14cf7411e8318a1bccb9.js} +1 -1
- package/assets/esri/core/workers/chunks/{71852b8437ec66b9ef06.js → 2123ab24163a532ebc8d.js} +1 -1
- package/assets/esri/core/workers/chunks/{c91b3800cf3891bf2d59.js → 252ff37bf5e12dae0b18.js} +1 -1
- package/assets/esri/core/workers/chunks/2799007b5f3f4a2e364c.js +51 -0
- package/assets/esri/core/workers/chunks/{ff5e6d823d512f87a527.js → 2dddb8a989b9c96572fe.js} +1 -1
- package/assets/esri/core/workers/chunks/34b5bab6239c7277f854.js +1 -0
- package/assets/esri/core/workers/chunks/543f9db420c99d429637.js +1 -0
- package/assets/esri/core/workers/chunks/{5089a12084a8a8fb93d8.js → 61e5179fb49866241128.js} +1 -1
- package/assets/esri/core/workers/chunks/632e3ba2b8a881df29a0.js +1 -0
- package/assets/esri/core/workers/chunks/63eb1cc923bb8dcb3cb3.js +1 -0
- package/assets/esri/core/workers/chunks/{380e2654bc7e07163df0.js → 725a0eae5248a933db05.js} +1 -1
- package/assets/esri/core/workers/chunks/{1cc4a89c96a36d6b3d52.js → 7767559d56d16b644655.js} +1 -1
- package/assets/esri/core/workers/chunks/7baf288a07401f9e972d.js +1 -0
- package/assets/esri/core/workers/chunks/{43e83f4d827f59ff556a.js → 8087288f00dfdcc479b9.js} +1 -1
- package/assets/esri/core/workers/chunks/{a5fbe1c95e49093e5af4.js → 8cce4b218568638e6e64.js} +1 -1
- package/assets/esri/core/workers/chunks/{c7e2a97cb7bcd153bcef.js → 8e326def543268f8a08e.js} +1 -1
- package/assets/esri/core/workers/chunks/92cb45b18e151db007dc.js +1 -0
- package/assets/esri/core/workers/chunks/b2e8cc76381077b78d4c.js +1 -0
- package/assets/esri/core/workers/chunks/b6a8132708afcd988fa9.js +1 -0
- package/assets/esri/core/workers/chunks/{b4d850e82a8ae902d684.js → c44cc686774ff53c0a94.js} +1 -1
- package/assets/esri/core/workers/chunks/c52701477405c1fb2072.js +1 -0
- package/assets/esri/core/workers/chunks/{9ed11b9202013ca001ee.js → cfc2a1858a8bbb284979.js} +2 -2
- package/assets/esri/core/workers/chunks/{9ed11b9202013ca001ee.js.LICENSE.txt → cfc2a1858a8bbb284979.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/d9863289c69d2550cd49.js +1 -0
- package/assets/esri/core/workers/chunks/e1f4df3a5b0b31521b3c.js +1 -0
- package/assets/esri/core/workers/chunks/ee72a006e25e94a4cd4a.js +1039 -0
- package/assets/esri/core/workers/chunks/{61505947371cebab9cbe.js → fdebfe55cd097714ec11.js} +1 -1
- package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +13 -18
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/AtmosphereCompositing.glsl.js +6 -9
- package/chunks/BlendLayers.glsl.js +1 -7
- package/chunks/BlendWeights.glsl.js +81 -86
- package/chunks/Blur.glsl.js +1 -3
- package/chunks/ChapmanAtmosphere.glsl.js +3 -8
- package/chunks/CheckerBoard.glsl.js +3 -9
- package/chunks/Clouds.glsl.js +21 -10
- package/chunks/CloudsComposition.glsl.js +3 -7
- package/chunks/ColorMaterial.glsl.js +3 -9
- package/chunks/ComponentShader.glsl.js +41 -75
- package/chunks/Compositing.glsl.js +5 -7
- package/chunks/DefaultMaterial.glsl.js +68 -73
- package/chunks/EdgeDetect.glsl.js +29 -39
- package/chunks/EdgeShader.glsl.js +37 -60
- package/chunks/Fog.glsl.js +4 -9
- package/chunks/HUDCompositing.glsl.js +1 -3
- package/chunks/HUDMaterial.glsl.js +11 -20
- package/chunks/Heatmap.glsl.js +3 -11
- package/chunks/HeatmapDensity.glsl.js +12 -15
- package/chunks/HighlightApply.glsl.js +130 -174
- package/chunks/HighlightDownsample.glsl.js +29 -32
- package/chunks/ImageMaterial.glsl.js +11 -21
- package/chunks/LaserlinePath.glsl.js +6 -10
- package/chunks/Laserlines.glsl.js +8 -20
- package/chunks/LineCallout.glsl.js +91 -108
- package/chunks/LineMarker.glsl.js +62 -53
- package/chunks/Magnifier.glsl.js +4 -9
- package/chunks/MeasurementArrow.glsl.js +9 -15
- package/chunks/NativeLine.glsl.js +8 -12
- package/chunks/NoiseTextureAtlas.glsl.js +89 -86
- package/chunks/OITCompositing.glsl.js +8 -12
- package/chunks/OverlayCompositing.glsl.js +2 -4
- package/chunks/Path.glsl.js +31 -55
- package/chunks/Pattern.glsl.js +16 -20
- package/chunks/PointRenderer.glsl.js +39 -48
- package/chunks/Precipitation.glsl.js +22 -39
- package/chunks/RasterColorizer.glsl.js +25 -33
- package/chunks/RealisticTree.glsl.js +53 -65
- package/chunks/RibbonLine.glsl.js +31 -36
- package/chunks/SSAO.glsl.js +7 -10
- package/chunks/SSAOBlur.glsl.js +10 -14
- package/chunks/ShadedColorMaterial.glsl.js +12 -15
- package/chunks/ShadowCastAccumulate.glsl.js +6 -8
- package/chunks/ShadowCastVisualize.glsl.js +12 -18
- package/chunks/ShadowHighlight.glsl.js +49 -51
- package/chunks/SimpleAtmosphere.glsl.js +4 -13
- package/chunks/SlicePlaneMaterial.glsl.js +3 -7
- package/chunks/Stars.glsl.js +3 -7
- package/chunks/Terrain.glsl.js +20 -61
- package/chunks/TextureOnly.glsl.js +2 -4
- package/chunks/Viewshed.glsl.js +20 -38
- package/chunks/WaterSurface.glsl.js +34 -60
- package/core/accessorSupport/tracking.js +1 -1
- package/core/workers/registry.js +1 -1
- package/geometry/Circle.js +1 -1
- package/geometry/Polygon.js +1 -1
- package/geometry/Polyline.js +1 -1
- package/geometry/support/geodesicUtils.js +1 -1
- package/interfaces.d.ts +34 -4
- package/layers/WCSLayer.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/orientedImagery/transformations/imageToGroundUtils.js +1 -1
- package/layers/support/SubtypeSublayer.js +1 -1
- package/layers/support/rasterDatasets/WCSRaster.js +1 -1
- package/layers/support/rasterDatasets/multidimensionalUtils.js +1 -1
- package/layers/support/rasterDatasets/wcsCoverageParser.js +1 -1
- package/package.json +3 -3
- package/support/revision.js +1 -1
- package/views/2d/engine/flow/styles/Imagery.js +1 -1
- package/views/2d/engine/flow/styles/Particles.js +1 -1
- package/views/2d/engine/flow/styles/Streamlines.js +1 -1
- package/views/2d/engine/imagery/RasterVFDisplayObject.js +1 -1
- package/views/2d/engine/vectorTiles/RenderBucket.js +1 -1
- package/views/2d/engine/vectorTiles/shaders/VTLMaterial.js +1 -1
- package/views/2d/engine/webgl/BitBlitRenderer.js +1 -1
- package/views/2d/engine/webgl/DefaultVertexAttributeLayouts.js +1 -1
- package/views/2d/engine/webgl/Mesh2D.js +1 -1
- package/views/2d/engine/webgl/Overlay.js +1 -1
- package/views/2d/engine/webgl/OverlayMultipoint.js +1 -1
- package/views/2d/engine/webgl/Utils.js +1 -1
- package/views/2d/engine/webgl/VertexStream.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLBrushStencil.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLBrushTileDebugInfo.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLBrushVTLBackground.js +1 -1
- package/views/2d/engine/webgl/cpuMapped/MappedMesh.js +1 -1
- package/views/2d/engine/webgl/effects/highlight/HighlightRenderer.js +1 -1
- package/views/2d/engine/webgl/mesh/MeshData.js +1 -1
- package/views/2d/engine/webgl/meshing/Mesh.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/ShaderBuilder2D.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/FeatureInstanceStore.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/heatmap/HeatmapTechnique.js +1 -1
- package/views/2d/layers/graphics/GraphicBoundsRenderer.js +1 -1
- package/views/2d/layers/support/DebugOverlay.js +1 -1
- package/views/2d/magnifier/MagnifierView2D.js +1 -1
- package/views/3d/environment/ChapmanAtmosphere.js +1 -1
- package/views/3d/environment/EnvironmentRenderer.js +1 -1
- package/views/3d/environment/LocalAtmosphere.js +1 -1
- package/views/3d/environment/MarsAtmosphere.js +1 -1
- package/views/3d/environment/Precipitation.js +1 -1
- package/views/3d/environment/Stars.js +1 -1
- package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
- package/views/3d/interactive/editingTools/reshape/ReshapeTool3D.js +1 -1
- package/views/3d/interactive/editingTools/reshape/edgeOffsetUtils.js +1 -1
- package/views/3d/interactive/editingTools/reshape/reshapeTooltipUtils.js +1 -1
- package/views/3d/interactive/editingTools/transform/extentTransform/extentUtils.js +1 -1
- package/views/3d/layers/FeatureLayerViewBase3D.js +1 -1
- package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/StreamLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
- package/views/3d/layers/graphics/Graphics3DGraphicsPipeline.js +1 -1
- package/views/3d/layers/graphics/pipeline/Feature3DPipeline.js +5 -0
- package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorker.js +5 -0
- package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorkerHandle.js +5 -0
- package/views/3d/layers/graphics/pipeline/PBFPointFeaturesView.js +5 -0
- package/views/3d/layers/graphics/pipeline/TestSymbol.js +5 -0
- package/views/3d/layers/graphics/pipeline/Tile.js +5 -0
- package/views/3d/layers/graphics/pipeline/Tile3DFetcher.js +5 -0
- package/views/3d/layers/graphics/pipeline/Tile3DProcessor.js +5 -0
- package/views/3d/layers/i3s/PointRenderer.js +1 -1
- package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
- package/views/3d/layers/support/projectExtentUtils.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/PatchGeometryFactory.js +1 -1
- package/views/3d/terrain/PatchRenderData.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TileCompositor.js +1 -1
- package/views/3d/webgl/ManagedFBObject.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
- package/views/3d/webgl-engine/core/FBOCache.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPass.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js +3 -5
- package/views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js +3 -3
- package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +29 -59
- package/views/3d/webgl-engine/core/shaderLibrary/hud/HUDOcclusionPass.glsl.js +6 -12
- package/views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js +11 -11
- package/views/3d/webgl-engine/core/shaderLibrary/shading/MarkerSizing.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/MultipassTerrainTest.glsl.js +4 -7
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ScreenSpaceReflections.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/TextureTransformUV.glsl.js +6 -6
- package/views/3d/webgl-engine/core/shaderLibrary/shading/Water.glsl.js +4 -4
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/TileComposite.glsl.js +2 -4
- package/views/3d/webgl-engine/core/shaderLibrary/util/LocalFromScreenSpace.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderModules/ShaderBuilder.js +1 -1
- package/views/3d/webgl-engine/effects/RenderNodes.js +1 -1
- package/views/3d/webgl-engine/effects/ScreenSpaceGeometry.js +1 -1
- package/views/3d/webgl-engine/effects/blit/Blit.js +1 -1
- package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
- package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
- package/views/3d/webgl-engine/effects/laserlines/LaserlinePathData.js +1 -1
- package/views/3d/webgl-engine/effects/laserlines/LaserlinePathTechnique.js +1 -1
- package/views/3d/webgl-engine/effects/magnifier/MagnifierRenderNode.js +1 -1
- package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
- package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
- package/views/3d/webgl-engine/lib/DrapedHeatmapRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
- package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
- package/views/3d/webgl-engine/lib/glUtil3D.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodComponentData.js +1 -1
- package/views/3d/webgl-engine/materials/DrawParameters.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/VaoCache.js +1 -1
- package/views/3d/webgl-engine/shaders/Heatmap.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/HighlightApply.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/OITCompositing.glsl.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/draw/support/Box.js +1 -1
- package/views/interactive/tooltip/Tooltip.js +1 -1
- package/views/interactive/tooltip/fields/fields.js +1 -1
- package/views/webgl/RenderingContext.js +1 -1
- package/views/webgl/Util.js +1 -1
- package/views/webgl/VertexArrayObject.js +1 -1
- package/views/webgl/enums.js +1 -1
- package/views/webgl/heatmapTextureUtils.js +1 -1
- package/views/webgl/testDoublePrecisionArithmetic.js +1 -1
- package/views/webgl/testFloatBufferBlend.js +1 -1
- package/views/webgl/testSVGPremultipliedAlpha.js +1 -1
- package/widgets/ElevationProfile/ElevationProfileController.js +1 -1
- package/widgets/Feature/FeatureRelationship/FeatureRelationshipViewModel.js +1 -1
- package/widgets/Feature/support/relatedFeatureUtils.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/OrientedImageryViewer/constants.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
- package/widgets/UtilityNetworkTrace.js +1 -1
- package/widgets/support/TimezonePicker.js +1 -1
- package/assets/esri/core/workers/chunks/0cb2eb96ffb1dbed00eb.js +0 -1
- package/assets/esri/core/workers/chunks/0d6ed27fc9948f4ea061.js +0 -1
- package/assets/esri/core/workers/chunks/225b947ba4b2fcfd5630.js +0 -1
- package/assets/esri/core/workers/chunks/7c7c3068da3bf7467685.js +0 -1
- package/assets/esri/core/workers/chunks/812e18c65aa6e398c338.js +0 -1
- package/assets/esri/core/workers/chunks/85e5cdd723f68dec8c25.js +0 -1
- package/assets/esri/core/workers/chunks/a7e2ca5ede46395f0787.js +0 -1
- package/assets/esri/core/workers/chunks/aed0db145187d9eb52f2.js +0 -51
- package/assets/esri/core/workers/chunks/cf9a32a03b3d3b66effb.js +0 -1
- package/assets/esri/core/workers/chunks/d85c51abde781660b1f5.js +0 -1
- package/assets/esri/core/workers/chunks/e840e54455eb500b501d.js +0 -1098
- package/assets/esri/core/workers/chunks/fec53ce15ae52f8cb802.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.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../Graphic.js";import{XXH as i}from"../../../../arcade/functions/hash.js";import r from"../../../../core/Accessor.js";import{neverReached as s}from"../../../../core/compilerUtils.js";import{makeHandle as n}from"../../../../core/handleUtils.js";import{destroyMaybe as a}from"../../../../core/maybe.js";import{logOnError as o}from"../../../../core/promiseUtils.js";import{watch as l,initial as p,when as d}from"../../../../core/reactiveUtils.js";import{property as u}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as h}from"../../../../core/accessorSupport/decorators/subclass.js";import{diff as c}from"../../../../core/accessorSupport/diffUtils.js";import{UpdatingHandles as g}from"../../../../core/support/UpdatingHandles.js";import{canProject as y,project as m}from"../../../../geometry/support/webMercatorUtils.js";import{matchRandomRotationExpression as f}from"../../../../renderers/support/randomRotationExpression.js";import{getRenderingInfo as b,getRenderingInfoAsync as C}from"../../../../renderers/support/renderingInfoUtils.js";import E from"../../../../rest/support/Query.js";import{DrapeSourceType as x}from"../interfaces.js";import{suspendResumeExtentOptimism as w}from"./constants.js";import{DisplayFeatureLimit as v}from"./DisplayFeatureLimit.js";import{Graphics3DCore as V}from"./Graphics3DCore.js";import{Graphics3DElevationAlignment as R}from"./Graphics3DElevationAlignment.js";import{Graphics3DFrustumVisibility as j}from"./Graphics3DFrustumVisibility.js";import{Graphics3DObjectStates as O}from"./Graphics3DObjectStates.js";import{Graphics3DScaleVisibility as _}from"./Graphics3DScaleVisibility.js";import{enlargeExtent as S}from"./graphicUtils.js";import{attributeLookup as G}from"../support/attributeUtils.js";import{FeatureVisibilityFilter as I}from"../support/FeatureVisibilityFilter.js";import{Object3DState as A}from"../../webgl-engine/lib/basicInterfaces.js";import{UpdatePolicy as U}from"../../webgl-engine/lib/UpdatePolicy.js";let P=class extends r{constructor(e){super(e),this.type="graphics-3d",this._randomRotationRenderers=null,this._updatingHandles=new g,this.elevationFeatureExpressionEnabled=!1,this.scaleVisibilityEnabled=!1,this.filterVisibilityEnabled=!1,this.frustumVisibilityEnabled=!1,this.elevationAlignmentEnabled=!1,this.timeExtentEnabled=!1,this.setUidToIdOnAdd=!0,this.dataExtent=null,this.drapeSourceType=x.Features,this.preferredUpdatePolicy=U.ASYNC,this._suspendResumeExtent=null}initialize(){const e=this.owner,t=(this.filterVisibilityEnabled||this.timeExtentEnabled)&&"multipatch"!==e.layer.geometryType,i=new V({owner:this,layer:this.layer,preferredUpdatePolicy:this.preferredUpdatePolicy,elevationFeatureExpressionEnabled:this.elevationFeatureExpressionEnabled,graphicSymbolSupported:!1,hasZ:e.hasZ,hasM:e.hasM,setUidToIdOnAdd:this.setUidToIdOnAdd,componentFactories:{deconflictor:t=>e.view.deconflictor.addGraphicsOwner(t),labeler:(t,i)=>e.view.labeler.addGraphicsOwner(t,i),elevationAlignment:this.elevationAlignmentEnabled?(t,i)=>new R({graphicsCoreOwner:this,graphicsCore:t,queryGraphicUIDsInExtent:i,elevationProvider:e.view.elevationProvider}):null,scaleVisibility:this.scaleVisibilityEnabled?(t,i)=>new _({graphicsCoreOwner:this,layer:this.layer,queryGraphicUIDsInExtent:i,graphicsCore:t,basemapTerrain:e.view.basemapTerrain}):null,filterVisibility:t?t=>new I({context:{...t,configuration:e}}):null,objectStates:e=>new O(e)}});this._set("graphicsCore",i),this.frustumVisibilityEnabled&&this._set("frustumVisibility",new j({graphicsCoreOwner:this})),this.elevationAlignment&&this._updatingHandles.add((()=>this.layer.elevationInfo),((e,t)=>{c(e,t)&&this._updatingHandles.addPromise(this.graphicsCore.elevationInfoChange())})),this._updatingHandles.add((()=>this.layer.labelsVisible),(()=>this.graphicsCore.updateVisibilityInfo())),this._updatingHandles.add((()=>this.layer.labelingInfo),((e,t)=>{c(e,t)&&this.graphicsCore.updateLabelingInfo()})),this._updatingHandles.add((()=>this.preferredUpdatePolicy),(e=>this.graphicsCore.preferredUpdatePolicy=e)),this._set("initializePromise",this._initializeAsync()),this._updatingHandles.addPromise(this.initializePromise)}async _initializeAsync(){await o(this.graphicsCore.initializePromise);const e=this.owner;this._updatingHandles.add((()=>this.renderer),(e=>this._updatingHandles.addPromise(this.graphicsCore.rendererChange(e)))),this._updatingHandles.add((()=>e.fullOpacity),(()=>this.graphicsCore.opacityChange())),this._setupSuspendResumeExtent(),this.updateClippingExtent&&(this._updatingHandles.add((()=>e.view.clippingArea),(()=>this._updateClippingExtent())),this._updateClippingExtent()),this.graphicsCore.startCreateGraphics(),this.graphicsCore.labelsEnabled&&await o(this.graphicsCore.updateLabelingInfo())}destroy(){this._updatingHandles.destroy(),this._set("frustumVisibility",a(this.frustumVisibility)),this._set("graphicsCore",a(this.graphicsCore)),this._set("owner",null)}get layer(){return this.owner.layer}get dataUpdating(){return this.graphicsCore?.dataUpdating??!1}get renderer(){const{renderer:e,objectIdField:t}=this.layer;if(!e||!t||"heatmap"===e.type||!e.visualVariables)return e;const i=e.visualVariables.findIndex((e=>"rotation"===e.type&&null!=e.valueExpression&&f(e.valueExpression)===t&&(null==e.axis||"heading"===e.axis)&&"geographic"===e.rotationType));if(i<0)return e;const r=e.clone();return r.visualVariables?(r.visualVariables.splice(i,1),this._randomRotationRenderers||(this._randomRotationRenderers=new WeakMap),this._randomRotationRenderers.set(r,t),r):e}get scaleVisibility(){return this.graphicsCore?.scaleVisibility}get filterVisibility(){return this.graphicsCore?.filterVisibility}get elevationAlignment(){return this.graphicsCore?.elevationAlignment}get suspendResumeExtentMode(){return this.owner.suspendResumeExtentMode??"computed"}get scaleVisibilitySuspended(){return null!=this.scaleVisibility&&this.scaleVisibility.suspended}get suspended(){return this.owner.suspended}get legendEnabled(){return null==this.frustumVisibility||!this.frustumVisibility.suspended}get suspendInfo(){const e={};return this.scaleVisibilitySuspended&&(e.outsideScaleRange=!0),null!=this.frustumVisibility&&this.frustumVisibility.suspended&&(e.outsideOfView=!0),e}get updating(){return!!(this.graphicsCore?.updating||this.frustumVisibility?.updating||this._updatingHandles.updating)}get updatingRemaining(){return this.graphicsCore?.updatingRemaining??0}get featureStore(){return this.graphicsCore?.featureStore}get view(){return this.owner.view}get loadedGraphics(){return this.owner.loadedGraphics}get fullOpacity(){return this.owner?.fullOpacity}get filter(){return"filter"in this.owner?this.owner.filter:null}get slicePlaneEnabled(){return this.owner.slicePlaneEnabled}get updatePolicy(){return this.owner.updatePolicy}get featureSpatialReference(){return"featureSpatialReference"in this.owner?this.owner.featureSpatialReference:this.owner.view.spatialReference}get graphics3DGraphics(){return this.graphicsCore?.graphics3DGraphics}get graphics3DGraphicsByObjectID(){return this.graphicsCore?.graphics3DGraphicsByObjectID}get symbolUpdateType(){return this.graphicsCore?.symbolUpdateType}get displayFeatureLimit(){const e=this.view.quality,t=this.graphicsCore?.displayFeatureLimit;if(1===e)return t;const i=Math.ceil(t.maximumNumberOfFeatures*e);return new v(t.maximumTotalNumberOfVertices,i,t.averageSymbolComplexity)}get usedMemory(){return this.graphicsCore?.usedMemory??0}get loadedFeatures(){return this.graphicsCore?.numberOfGraphics??0}get usedMemoryPerFeature(){return this.graphicsCore?.usedMemoryPerGraphic??0}get unprocessedMemoryEstimate(){return this.graphicsCore?.unprocessedMemoryEstimate??0}get performanceInfo(){return this.graphicsCore.performanceInfo}maskOccludee(e){const t=this.graphicsCore?.objectStates;if(!t)return n();const{set:i,handle:r}=t.acquireSet(A.MaskOccludee,null);return t.setUid(i,e.uid),r}highlight(e,i){const r=this.graphicsCore?.objectStates;if(!r)return n();if(e instanceof E){const{set:t,handle:s}=r.acquireSet(A.Highlight,i);return this.owner.queryObjectIds(e).then((e=>r.setObjectIds(t,e))),s}if("number"==typeof e||"string"==typeof e)return this.highlight([e],i);if(e instanceof t)return this.highlight([e],i);if("toArray"in e&&(e=e.toArray()),Array.isArray(e)&&e.length>0){if(e[0]instanceof t){const t=e;if(null==G(this.layer.fieldsIndex,t[0].attributes,i)){const e=t.map((e=>e.uid)),{set:i,handle:s}=r.acquireSet(A.Highlight,null);return r.setUids(i,e),s}e=t.map((e=>G(this.layer.fieldsIndex,e.attributes,i)))}if(Array.isArray(e)&&("number"==typeof e[0]||"string"==typeof e[0])){const t=e,{set:s,handle:n}=r.acquireSet(A.Highlight,i);return r.setObjectIds(s,t),n}}return n()}resetObjectStates(){this.graphicsCore?.objectStates?.reset()}whenGraphicBounds(e,t){return this.graphicsCore?.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){return this.graphicsCore?.computeAttachmentOrigin(e,t)}notifyGraphicGeometryChanged(e){this.graphicsCore.notifyGraphicGeometryChanged(e)}notifyGraphicVisibilityChanged(e){this.graphicsCore.notifyGraphicVisibilityChanged(e)}getRenderingInfo(e,t,r){const s=b(e,{renderer:t,arcade:r});if(s?.color){const e=s.color;e[0]=e[0]/255,e[1]=e[1]/255,e[2]=e[2]/255}if(null!=s&&null!=t&&this._randomRotationRenderers?.has(t)){const r=this._randomRotationRenderers.get(t),n=e.attributes[r],a=new i(0);a.updateFloatArray([n]),a.updateUint8Array([173]),s.heading=8.381e-8*a.digest()}return s}getRenderingInfoAsync(e,t,i,r){return C(e,{renderer:t,arcade:i,...r})}getSymbolLayerSize(e,t){return this.graphicsCore?.getSymbolLayerSize(e,t)}setObjectIdVisibility(e,t){this.graphicsCore?.setObjectIdVisibility(e,t)}refreshFilter(){null!=this.filterVisibility&&this.filterVisibility.reapply()}getGraphics3DGraphicByObjectId(e){return this.graphicsCore?.getGraphics3DGraphicByObjectId(e)}_updateClippingExtent(){const e=this.owner.view.clippingArea;this.graphicsCore.setClippingExtent(e,this.owner.view.spatialReference)&&(this.updateClippingExtent(e)||this.graphicsCore.recreateAllGraphics())}_setupSuspendResumeExtent(){(this.frustumVisibility||this.scaleVisibility)&&this.addHandles(l((()=>this.suspendResumeExtentMode),(()=>{switch(this.removeHandles(H),this.suspendResumeExtentMode){case"computed":this.addHandles([l((()=>this.graphicsCore.computedExtent),(e=>this._updateSuspendResumeExtent(e)),p),l((()=>this.graphicsCore.extentPadding),(()=>this._updateSuspendResumeExtent(this.graphicsCore.computedExtent)))],H);break;case"data":this.addHandles([d((()=>this.dataExtent),(e=>this._updateSuspendResumeExtent(e)),p),l((()=>this.graphicsCore.extentPadding),(()=>this._updateSuspendResumeExtent(this.dataExtent)))],H);break;default:s(this.suspendResumeExtentMode)}}),p))}_updateSuspendResumeExtent(e){e?this._suspendResumeExtentChanged(this._extentToSuspendResumeRect(e,this._suspendResumeExtent)):this._suspendResumeExtentChanged(null)}_extentToSuspendResumeRect(e,t){const i=this.owner.view.spatialReference;if(!e.spatialReference.equals(i)){if(!y(e,i))return;e=m(e,i)}return S(e,t,w,this.graphicsCore.extentPadding)}_suspendResumeExtentChanged(e){null!=this.frustumVisibility&&this.frustumVisibility.setExtent(e),null!=this.scaleVisibility&&this.scaleVisibility.setExtent(e)}};e([u()],P.prototype,"type",void 0),e([u({constructOnly:!0})],P.prototype,"owner",void 0),e([u()],P.prototype,"layer",null),e([u({readOnly:!0})],P.prototype,"dataUpdating",null),e([u()],P.prototype,"renderer",null),e([u({constructOnly:!0})],P.prototype,"updateClippingExtent",void 0),e([u({constructOnly:!0})],P.prototype,"elevationFeatureExpressionEnabled",void 0),e([u({constructOnly:!0})],P.prototype,"graphicsCore",void 0),e([u({constructOnly:!0})],P.prototype,"scaleVisibilityEnabled",void 0),e([u({constructOnly:!0})],P.prototype,"filterVisibilityEnabled",void 0),e([u({constructOnly:!0})],P.prototype,"frustumVisibilityEnabled",void 0),e([u({constructOnly:!0})],P.prototype,"elevationAlignmentEnabled",void 0),e([u({constructOnly:!0})],P.prototype,"timeExtentEnabled",void 0),e([u({constructOnly:!0})],P.prototype,"setUidToIdOnAdd",void 0),e([u()],P.prototype,"scaleVisibility",null),e([u()],P.prototype,"filterVisibility",null),e([u()],P.prototype,"elevationAlignment",null),e([u({constructOnly:!0})],P.prototype,"frustumVisibility",void 0),e([u()],P.prototype,"initializePromise",void 0),e([u()],P.prototype,"suspendResumeExtentMode",null),e([u()],P.prototype,"dataExtent",void 0),e([u()],P.prototype,"scaleVisibilitySuspended",null),e([u()],P.prototype,"suspended",null),e([u()],P.prototype,"legendEnabled",null),e([u()],P.prototype,"suspendInfo",null),e([u()],P.prototype,"updating",null),e([u()],P.prototype,"updatingRemaining",null),e([u()],P.prototype,"featureStore",null),e([u()],P.prototype,"view",null),e([u()],P.prototype,"loadedGraphics",null),e([u()],P.prototype,"fullOpacity",null),e([u()],P.prototype,"filter",null),e([u()],P.prototype,"slicePlaneEnabled",null),e([u()],P.prototype,"drapeSourceType",void 0),e([u()],P.prototype,"updatePolicy",null),e([u()],P.prototype,"preferredUpdatePolicy",void 0),e([u({readOnly:!0})],P.prototype,"displayFeatureLimit",null),P=e([h("esri.views.3d.layers.graphics.Graphics3DFeatureProcessor")],P);const H="suspendResumeExtentMode";export{P as Graphics3DFeatureProcessor};
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../Graphic.js";import{XXH as i}from"../../../../arcade/functions/hash.js";import{neverReached as r}from"../../../../core/compilerUtils.js";import{makeHandle as s}from"../../../../core/handleUtils.js";import{destroyMaybe as n}from"../../../../core/maybe.js";import{EsriPromise as a}from"../../../../core/Promise.js";import{logOnError as o}from"../../../../core/promiseUtils.js";import{watch as l,initial as p,when as d}from"../../../../core/reactiveUtils.js";import{property as u}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as h}from"../../../../core/accessorSupport/decorators/subclass.js";import{diff as c}from"../../../../core/accessorSupport/diffUtils.js";import{UpdatingHandles as g}from"../../../../core/support/UpdatingHandles.js";import{canProject as y,project as m}from"../../../../geometry/support/webMercatorUtils.js";import{matchRandomRotationExpression as f}from"../../../../renderers/support/randomRotationExpression.js";import{getRenderingInfo as b,getRenderingInfoAsync as C}from"../../../../renderers/support/renderingInfoUtils.js";import E from"../../../../rest/support/Query.js";import{DrapeSourceType as x}from"../interfaces.js";import{suspendResumeExtentOptimism as w}from"./constants.js";import{DisplayFeatureLimit as v}from"./DisplayFeatureLimit.js";import{Graphics3DCore as V}from"./Graphics3DCore.js";import{Graphics3DElevationAlignment as R}from"./Graphics3DElevationAlignment.js";import{Graphics3DFrustumVisibility as j}from"./Graphics3DFrustumVisibility.js";import{Graphics3DObjectStates as O}from"./Graphics3DObjectStates.js";import{Graphics3DScaleVisibility as S}from"./Graphics3DScaleVisibility.js";import{enlargeExtent as _}from"./graphicUtils.js";import{attributeLookup as G}from"../support/attributeUtils.js";import{FeatureVisibilityFilter as I}from"../support/FeatureVisibilityFilter.js";import{Object3DState as U}from"../../webgl-engine/lib/basicInterfaces.js";import{UpdatePolicy as A}from"../../webgl-engine/lib/UpdatePolicy.js";let P=class extends a{constructor(e){super(e),this.type="graphics-3d",this._randomRotationRenderers=null,this._updatingHandles=new g,this.elevationFeatureExpressionEnabled=!1,this.scaleVisibilityEnabled=!1,this.filterVisibilityEnabled=!1,this.frustumVisibilityEnabled=!1,this.elevationAlignmentEnabled=!1,this.timeExtentEnabled=!1,this.setUidToIdOnAdd=!0,this.dataExtent=null,this.drapeSourceType=x.Features,this.preferredUpdatePolicy=A.ASYNC,this._suspendResumeExtent=null}initialize(){const e=this.owner,t=(this.filterVisibilityEnabled||this.timeExtentEnabled)&&"multipatch"!==e.layer.geometryType,i=new V({owner:this,layer:this.layer,preferredUpdatePolicy:this.preferredUpdatePolicy,elevationFeatureExpressionEnabled:this.elevationFeatureExpressionEnabled,graphicSymbolSupported:!1,hasZ:e.hasZ,hasM:e.hasM,setUidToIdOnAdd:this.setUidToIdOnAdd,componentFactories:{deconflictor:t=>e.view.deconflictor.addGraphicsOwner(t),labeler:(t,i)=>e.view.labeler.addGraphicsOwner(t,i),elevationAlignment:this.elevationAlignmentEnabled?(t,i)=>new R({graphicsCoreOwner:this,graphicsCore:t,queryGraphicUIDsInExtent:i,elevationProvider:e.view.elevationProvider}):null,scaleVisibility:this.scaleVisibilityEnabled?(t,i)=>new S({graphicsCoreOwner:this,layer:this.layer,queryGraphicUIDsInExtent:i,graphicsCore:t,basemapTerrain:e.view.basemapTerrain}):null,filterVisibility:t?t=>new I({context:{...t,configuration:e}}):null,objectStates:e=>new O(e)}});this._set("graphicsCore",i),this.frustumVisibilityEnabled&&this._set("frustumVisibility",new j({graphicsCoreOwner:this})),this.elevationAlignment&&this._updatingHandles.add((()=>this.layer.elevationInfo),((e,t)=>{c(e,t)&&this._updatingHandles.addPromise(this.graphicsCore.elevationInfoChange())})),this._updatingHandles.add((()=>this.layer.labelsVisible),(()=>this.graphicsCore.updateVisibilityInfo())),this._updatingHandles.add((()=>this.layer.labelingInfo),((e,t)=>{c(e,t)&&this.graphicsCore.updateLabelingInfo()})),this._updatingHandles.add((()=>this.preferredUpdatePolicy),(e=>this.graphicsCore.preferredUpdatePolicy=e)),this.addResolvingPromise(this._initializeAsync())}async _initializeAsync(){await o(this.graphicsCore.initializePromise);const e=this.owner;this._updatingHandles.add((()=>this.renderer),(e=>this._updatingHandles.addPromise(this.graphicsCore.rendererChange(e)))),this._updatingHandles.add((()=>e.fullOpacity),(()=>this.graphicsCore.opacityChange())),this._setupSuspendResumeExtent(),this.updateClippingExtent&&(this._updatingHandles.add((()=>e.view.clippingArea),(()=>this._updateClippingExtent())),this._updateClippingExtent()),this.graphicsCore.startCreateGraphics(),this.graphicsCore.labelsEnabled&&await o(this.graphicsCore.updateLabelingInfo())}destroy(){this._updatingHandles.destroy(),this._set("frustumVisibility",n(this.frustumVisibility)),this._set("graphicsCore",n(this.graphicsCore)),this._set("owner",null)}get layer(){return this.owner.layer}get dataUpdating(){return this.graphicsCore?.dataUpdating??!1}get renderer(){const{renderer:e,objectIdField:t}=this.layer;if(!e||!t||"heatmap"===e.type||!e.visualVariables)return e;const i=e.visualVariables.findIndex((e=>"rotation"===e.type&&null!=e.valueExpression&&f(e.valueExpression)===t&&(null==e.axis||"heading"===e.axis)&&"geographic"===e.rotationType));if(i<0)return e;const r=e.clone();return r.visualVariables?(r.visualVariables.splice(i,1),this._randomRotationRenderers||(this._randomRotationRenderers=new WeakMap),this._randomRotationRenderers.set(r,t),r):e}get scaleVisibility(){return this.graphicsCore?.scaleVisibility}get filterVisibility(){return this.graphicsCore?.filterVisibility}get elevationAlignment(){return this.graphicsCore?.elevationAlignment}get suspendResumeExtentMode(){return this.owner.suspendResumeExtentMode??"computed"}get scaleVisibilitySuspended(){return null!=this.scaleVisibility&&this.scaleVisibility.suspended}get suspended(){return this.owner.suspended}get legendEnabled(){return null==this.frustumVisibility||!this.frustumVisibility.suspended}get suspendInfo(){const e={};return this.scaleVisibilitySuspended&&(e.outsideScaleRange=!0),null!=this.frustumVisibility&&this.frustumVisibility.suspended&&(e.outsideOfView=!0),e}get updating(){return!!(this.graphicsCore?.updating||this.frustumVisibility?.updating||this._updatingHandles.updating)}get updatingRemaining(){return this.graphicsCore?.updatingRemaining??0}get featureStore(){return this.graphicsCore?.featureStore}get view(){return this.owner.view}get loadedGraphics(){return this.owner.loadedGraphics}get fullOpacity(){return this.owner?.fullOpacity}get filter(){return"filter"in this.owner?this.owner.filter:null}get slicePlaneEnabled(){return this.owner.slicePlaneEnabled}get updatePolicy(){return this.owner.updatePolicy}get featureSpatialReference(){return"featureSpatialReference"in this.owner?this.owner.featureSpatialReference:this.owner.view.spatialReference}get graphics3DGraphics(){return this.graphicsCore?.graphics3DGraphics}get graphics3DGraphicsByObjectID(){return this.graphicsCore?.graphics3DGraphicsByObjectID}get symbolUpdateType(){return this.graphicsCore?.symbolUpdateType}get displayFeatureLimit(){const e=this.view.quality,t=this.graphicsCore?.displayFeatureLimit;if(1===e)return t;const i=Math.ceil(t.maximumNumberOfFeatures*e);return new v(t.maximumTotalNumberOfVertices,i,t.averageSymbolComplexity)}get usedMemory(){return this.graphicsCore?.usedMemory??0}get loadedFeatures(){return this.graphicsCore?.numberOfGraphics??0}get usedMemoryPerFeature(){return this.graphicsCore?.usedMemoryPerGraphic??0}get unprocessedMemoryEstimate(){return this.graphicsCore?.unprocessedMemoryEstimate??0}get performanceInfo(){return this.graphicsCore.performanceInfo}maskOccludee(e){const t=this.graphicsCore?.objectStates;if(!t)return s();const{set:i,handle:r}=t.acquireSet(U.MaskOccludee,null);return t.setUid(i,e.uid),r}highlight(e,i){const r=this.graphicsCore?.objectStates;if(!r)return s();if(e instanceof E){const{set:t,handle:s}=r.acquireSet(U.Highlight,i);return this.owner.queryObjectIds(e).then((e=>r.setObjectIds(t,e))),s}if("number"==typeof e||"string"==typeof e)return this.highlight([e],i);if(e instanceof t)return this.highlight([e],i);if("toArray"in e&&(e=e.toArray()),Array.isArray(e)&&e.length>0){if(e[0]instanceof t){const t=e;if(null==G(this.layer.fieldsIndex,t[0].attributes,i)){const e=t.map((e=>e.uid)),{set:i,handle:s}=r.acquireSet(U.Highlight,null);return r.setUids(i,e),s}e=t.map((e=>G(this.layer.fieldsIndex,e.attributes,i)))}if(Array.isArray(e)&&("number"==typeof e[0]||"string"==typeof e[0])){const t=e,{set:s,handle:n}=r.acquireSet(U.Highlight,i);return r.setObjectIds(s,t),n}}return s()}resetObjectStates(){this.graphicsCore?.objectStates?.reset()}whenGraphicBounds(e,t){return this.graphicsCore?.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){return this.graphicsCore?.computeAttachmentOrigin(e,t)}notifyGraphicGeometryChanged(e){this.graphicsCore.notifyGraphicGeometryChanged(e)}notifyGraphicVisibilityChanged(e){this.graphicsCore.notifyGraphicVisibilityChanged(e)}getRenderingInfo(e,t,r){const s=b(e,{renderer:t,arcade:r});if(s?.color){const e=s.color;e[0]=e[0]/255,e[1]=e[1]/255,e[2]=e[2]/255}if(null!=s&&null!=t&&this._randomRotationRenderers?.has(t)){const r=this._randomRotationRenderers.get(t),n=e.attributes[r],a=new i(0);a.updateFloatArray([n]),a.updateUint8Array([173]),s.heading=8.381e-8*a.digest()}return s}getRenderingInfoAsync(e,t,i,r){return C(e,{renderer:t,arcade:i,...r})}getSymbolLayerSize(e,t){return this.graphicsCore?.getSymbolLayerSize(e,t)}setObjectIdVisibility(e,t){this.graphicsCore?.setObjectIdVisibility(e,t)}refreshFilter(){null!=this.filterVisibility&&this.filterVisibility.reapply()}getGraphics3DGraphicByObjectId(e){return this.graphicsCore?.getGraphics3DGraphicByObjectId(e)}_updateClippingExtent(){const e=this.owner.view.clippingArea;this.graphicsCore.setClippingExtent(e,this.owner.view.spatialReference)&&(this.updateClippingExtent(e)||this.graphicsCore.recreateAllGraphics())}_setupSuspendResumeExtent(){(this.frustumVisibility||this.scaleVisibility)&&this.addHandles(l((()=>this.suspendResumeExtentMode),(()=>{switch(this.removeHandles(F),this.suspendResumeExtentMode){case"computed":this.addHandles([l((()=>this.graphicsCore.computedExtent),(e=>this._updateSuspendResumeExtent(e)),p),l((()=>this.graphicsCore.extentPadding),(()=>this._updateSuspendResumeExtent(this.graphicsCore.computedExtent)))],F);break;case"data":this.addHandles([d((()=>this.dataExtent),(e=>this._updateSuspendResumeExtent(e)),p),l((()=>this.graphicsCore.extentPadding),(()=>this._updateSuspendResumeExtent(this.dataExtent)))],F);break;default:r(this.suspendResumeExtentMode)}}),p))}_updateSuspendResumeExtent(e){e?this._suspendResumeExtentChanged(this._extentToSuspendResumeRect(e,this._suspendResumeExtent)):this._suspendResumeExtentChanged(null)}_extentToSuspendResumeRect(e,t){const i=this.owner.view.spatialReference;if(!e.spatialReference.equals(i)){if(!y(e,i))return;e=m(e,i)}return _(e,t,w,this.graphicsCore.extentPadding)}_suspendResumeExtentChanged(e){null!=this.frustumVisibility&&this.frustumVisibility.setExtent(e),null!=this.scaleVisibility&&this.scaleVisibility.setExtent(e)}};e([u()],P.prototype,"type",void 0),e([u({constructOnly:!0})],P.prototype,"owner",void 0),e([u()],P.prototype,"layer",null),e([u({readOnly:!0})],P.prototype,"dataUpdating",null),e([u()],P.prototype,"renderer",null),e([u({constructOnly:!0})],P.prototype,"updateClippingExtent",void 0),e([u({constructOnly:!0})],P.prototype,"elevationFeatureExpressionEnabled",void 0),e([u({constructOnly:!0})],P.prototype,"graphicsCore",void 0),e([u({constructOnly:!0})],P.prototype,"scaleVisibilityEnabled",void 0),e([u({constructOnly:!0})],P.prototype,"filterVisibilityEnabled",void 0),e([u({constructOnly:!0})],P.prototype,"frustumVisibilityEnabled",void 0),e([u({constructOnly:!0})],P.prototype,"elevationAlignmentEnabled",void 0),e([u({constructOnly:!0})],P.prototype,"timeExtentEnabled",void 0),e([u({constructOnly:!0})],P.prototype,"setUidToIdOnAdd",void 0),e([u()],P.prototype,"scaleVisibility",null),e([u()],P.prototype,"filterVisibility",null),e([u()],P.prototype,"elevationAlignment",null),e([u({constructOnly:!0})],P.prototype,"frustumVisibility",void 0),e([u()],P.prototype,"suspendResumeExtentMode",null),e([u()],P.prototype,"dataExtent",void 0),e([u()],P.prototype,"scaleVisibilitySuspended",null),e([u()],P.prototype,"suspended",null),e([u()],P.prototype,"legendEnabled",null),e([u()],P.prototype,"suspendInfo",null),e([u()],P.prototype,"updating",null),e([u()],P.prototype,"updatingRemaining",null),e([u()],P.prototype,"featureStore",null),e([u()],P.prototype,"view",null),e([u()],P.prototype,"loadedGraphics",null),e([u()],P.prototype,"fullOpacity",null),e([u()],P.prototype,"filter",null),e([u()],P.prototype,"slicePlaneEnabled",null),e([u()],P.prototype,"drapeSourceType",void 0),e([u()],P.prototype,"updatePolicy",null),e([u()],P.prototype,"preferredUpdatePolicy",void 0),e([u({readOnly:!0})],P.prototype,"displayFeatureLimit",null),P=e([h("esri.views.3d.layers.graphics.Graphics3DFeatureProcessor")],P);const F="suspendResumeExtentMode";export{P as Graphics3DFeatureProcessor};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Error.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import{EsriPromise as i}from"../../../../core/Promise.js";import{initial as s,watch as o,sync as n,whenOnce as a}from"../../../../core/reactiveUtils.js";import{property as l}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as p}from"../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as h}from"../../../../core/support/UpdatingHandles.js";import{FeatureTileController3D as d}from"../../../../layers/graphics/controllers/FeatureTileController3D.js";import{symbolHasExtrudeSymbolLayer as c}from"../../../../symbols/support/utils.js";import{elevationAlignPointsInFeatures as u}from"./elevationAlignPointsInFeatures.js";import{Graphics3DFeatureProcessor as y}from"./Graphics3DFeatureProcessor.js";import{QueryEngine as g}from"./QueryEngine.js";import{queryForSymbologySnapping as m}from"./queryForSymbologySnapping.js";import{HeatmapFeatureProcessor as f}from"../support/HeatmapFeatureProcessor.js";import{LayerViewPerformanceInfo as E}from"../support/LayerViewPerformanceInfo.js";import{UpdatePolicy as w}from"../../webgl-engine/lib/UpdatePolicy.js";import{TaskPriority as b}from"../../../support/Scheduler.js";let C=class extends i{constructor(e){super(e),this._dataUpdatingState=S.NONE,this.controller=null,this.updatingHandles=new h,this._controllerCreated=!1,this._pendingController=null}initialize(){this.addResolvingPromise(this._initializeController()),this.updatingHandles.add((()=>this.layer.renderer),(e=>this._recreateProcessor(e)),s),this.updatingHandles.add((()=>this.updatePolicy),(e=>this.processor.preferredUpdatePolicy=e));const e=()=>this.processor.featureStore;this.queryEngine=new g({context:{spatialReference:this.view.spatialReference,layer:this.layer,scheduler:this.view.resourceController.scheduler,get featureStore(){return e()},hasZ:this.hasZ,hasM:this.hasM},priority:b.FEATURE_QUERY_ENGINE})}destroy(){this.removeAllHandles(),this.updatingHandles.destroy(),this._destroyPendingController(),this.controller=r(this.controller),this.processor=r(this.processor),this.queryEngine=r(this.queryEngine),this.loadedGraphics=null}_destroyPendingController(){this._pendingController=r(this._pendingController)}get updating(){return this.updatingHandles.updating||!this._controllerCreated||this.controller?.updating||this.processor?.updating}get legendEnabled(){return this.processor.legendEnabled}get layer(){return this.layerView.layer}get view(){return this.layerView.view}get hasZ(){return this.layerView.hasZ}get hasM(){return this.layerView.hasM}get fullOpacity(){return this.layerView.fullOpacity}get suspended(){return this.layerView.suspended}get filter(){return"filter"in this.layerView?this.layerView.filter:null}get slicePlaneEnabled(){return this.layerView.slicePlaneEnabled}get featureSpatialReference(){return"featureSpatialReference"in this.layerView?this.layerView.featureSpatialReference:null}get graphics3DProcessor(){return"graphics-3d"===this.processor?.type?this.processor:null}get heatmapProcessor(){return"heatmap"===this.processor?.type?this.processor:null}get hasAllFeatures(){return!(!this.controller||!("hasAllFeatures"in this.controller))&&this.controller.hasAllFeatures}get hasAllFeaturesInView(){return!(!this.controller||!("hasAllFeaturesInView"in this.controller))&&this.controller.hasAllFeaturesInView}get hasFullGeometries(){return!(!this.controller||!("hasFullGeometries"in this.controller))&&this.controller.hasFullGeometries}get symbologySnappingSupported(){const e=this.layer?.renderer?.getSymbols();return e?.some(c)??!1}get updatePolicy(){return w.SYNC}get scaleVisibilitySuspended(){return this.processor?.scaleVisibilitySuspended}get timeExtent(){return"timeExtent"in this.layerView?this.layerView.timeExtent:null}get dataUpdating(){return this._dataUpdatingState!==S.NONE}get suspendInfo(){return this.processor?.suspendInfo??{}}forEachGraphic(e){this.loadedGraphics.forEach(e)}findGraphic(e){return this.loadedGraphics.find(e)}queryObjectIds(e,t){return this.layerView.queryObjectIds(e,t)}whenGraphicBounds(e,t){return this.processor?.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){return this.processor?.computeAttachmentOrigin(e,t)}async elevationAlignPointsInFeatures(e,r){const i=this.graphics3DProcessor;if(null==i)throw new t("featurelayerview3d:missing-processor","A Graphics3D processor is needed to resolve graphics elevation.");return u(this.view,this.layer,(e=>i.getGraphics3DGraphicByObjectId(e)),e,r)}async queryForSymbologySnapping(e,t){return this.symbologySnappingSupported?m(this.graphics3DProcessor,e,t):{candidates:[],sourceCandidateIndices:[]}}highlight(e){return this.processor.highlight(e,this.layer.objectIdField)}maskOccludee(e){return this.processor.maskOccludee(e)}async _initializeController(){const e=this.createController();this._pendingController=e,this._setupDataUpdating(e),await e.when(),this._setControllerWhenInitialized(e)}_setupDataUpdating(e){"dataUpdating"in e&&this.addHandles([o((()=>e.dataUpdating),(e=>{e&&this._dataUpdatingState===S.NONE?this._dataUpdatingState=S.CONTROLLER:e||this._dataUpdatingState!==S.CONTROLLER||(this._dataUpdatingState=S.NONE)}),n),o((()=>!!this.graphics3DProcessor?.dataUpdating),(t=>{t&&this._dataUpdatingState===S.CONTROLLER?this._dataUpdatingState=S.CORE:t||this._dataUpdatingState!==S.CORE||(this._dataUpdatingState=e.dataUpdating?S.CONTROLLER:S.NONE)}),n)])}async _setControllerWhenInitialized(e){try{await this.when()}catch(t){}this._controllerCreated=!0,this.isResolved()&&!this.destroyed?(await a((()=>this.view?.basemapTerrain?.ready)),this.beforeSetController(e),this._pendingController=null,this.controller=e,this.loadedGraphics=e.graphics):this._destroyPendingController()}_recreateProcessor(e){const t="heatmap"===e?.type,r="heatmap"===this.processor?.type,i=this.processor;if(i&&t===r)return;const s=t?new f({owner:this}):new y({owner:this,frustumVisibilityEnabled:!0,scaleVisibilityEnabled:!0,filterVisibilityEnabled:!0,timeExtentEnabled:!0,elevationAlignmentEnabled:!0,elevationFeatureExpressionEnabled:!0,preferredUpdatePolicy:this.updatePolicy,updateClippingExtent:e=>this._updateClippingExtent(e)});this.processor=s,i?.destroy(),this.queryEngine?.clear(),this.addResolvingPromise(s.
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Error.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import{EsriPromise as i}from"../../../../core/Promise.js";import{initial as s,watch as o,sync as n,whenOnce as a}from"../../../../core/reactiveUtils.js";import{property as l}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as p}from"../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as h}from"../../../../core/support/UpdatingHandles.js";import{FeatureTileController3D as d}from"../../../../layers/graphics/controllers/FeatureTileController3D.js";import{symbolHasExtrudeSymbolLayer as c}from"../../../../symbols/support/utils.js";import{elevationAlignPointsInFeatures as u}from"./elevationAlignPointsInFeatures.js";import{Graphics3DFeatureProcessor as y}from"./Graphics3DFeatureProcessor.js";import{QueryEngine as g}from"./QueryEngine.js";import{queryForSymbologySnapping as m}from"./queryForSymbologySnapping.js";import{HeatmapFeatureProcessor as f}from"../support/HeatmapFeatureProcessor.js";import{LayerViewPerformanceInfo as E}from"../support/LayerViewPerformanceInfo.js";import{UpdatePolicy as w}from"../../webgl-engine/lib/UpdatePolicy.js";import{TaskPriority as b}from"../../../support/Scheduler.js";let C=class extends i{constructor(e){super(e),this._dataUpdatingState=S.NONE,this.controller=null,this.updatingHandles=new h,this._controllerCreated=!1,this._pendingController=null}initialize(){this.addResolvingPromise(this._initializeController()),this.updatingHandles.add((()=>this.layer.renderer),(e=>this._recreateProcessor(e)),s),this.updatingHandles.add((()=>this.updatePolicy),(e=>this.processor.preferredUpdatePolicy=e));const e=()=>this.processor.featureStore;this.queryEngine=new g({context:{spatialReference:this.view.spatialReference,layer:this.layer,scheduler:this.view.resourceController.scheduler,get featureStore(){return e()},hasZ:this.hasZ,hasM:this.hasM},priority:b.FEATURE_QUERY_ENGINE})}destroy(){this.removeAllHandles(),this.updatingHandles.destroy(),this._destroyPendingController(),this.controller=r(this.controller),this.processor=r(this.processor),this.queryEngine=r(this.queryEngine),this.loadedGraphics=null}_destroyPendingController(){this._pendingController=r(this._pendingController)}get updating(){return this.updatingHandles.updating||!this._controllerCreated||this.controller?.updating||this.processor?.updating}get legendEnabled(){return this.processor.legendEnabled}get layer(){return this.layerView.layer}get view(){return this.layerView.view}get hasZ(){return this.layerView.hasZ}get hasM(){return this.layerView.hasM}get fullOpacity(){return this.layerView.fullOpacity}get suspended(){return this.layerView.suspended}get filter(){return"filter"in this.layerView?this.layerView.filter:null}get slicePlaneEnabled(){return this.layerView.slicePlaneEnabled}get featureSpatialReference(){return"featureSpatialReference"in this.layerView?this.layerView.featureSpatialReference:null}get graphics3DProcessor(){return"graphics-3d"===this.processor?.type?this.processor:null}get heatmapProcessor(){return"heatmap"===this.processor?.type?this.processor:null}get hasAllFeatures(){return!(!this.controller||!("hasAllFeatures"in this.controller))&&this.controller.hasAllFeatures}get hasAllFeaturesInView(){return!(!this.controller||!("hasAllFeaturesInView"in this.controller))&&this.controller.hasAllFeaturesInView}get hasFullGeometries(){return!(!this.controller||!("hasFullGeometries"in this.controller))&&this.controller.hasFullGeometries}get symbologySnappingSupported(){const e=this.layer?.renderer?.getSymbols();return e?.some(c)??!1}get updatePolicy(){return w.SYNC}get scaleVisibilitySuspended(){return this.processor?.scaleVisibilitySuspended}get timeExtent(){return"timeExtent"in this.layerView?this.layerView.timeExtent:null}get dataUpdating(){return this._dataUpdatingState!==S.NONE}get suspendInfo(){return this.processor?.suspendInfo??{}}forEachGraphic(e){this.loadedGraphics.forEach(e)}findGraphic(e){return this.loadedGraphics.find(e)}queryObjectIds(e,t){return this.layerView.queryObjectIds(e,t)}whenGraphicBounds(e,t){return this.processor?.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){return this.processor?.computeAttachmentOrigin(e,t)}async elevationAlignPointsInFeatures(e,r){const i=this.graphics3DProcessor;if(null==i)throw new t("featurelayerview3d:missing-processor","A Graphics3D processor is needed to resolve graphics elevation.");return u(this.view,this.layer,(e=>i.getGraphics3DGraphicByObjectId(e)),e,r)}async queryForSymbologySnapping(e,t){return this.symbologySnappingSupported?m(this.graphics3DProcessor,e,t):{candidates:[],sourceCandidateIndices:[]}}highlight(e){return this.processor.highlight(e,this.layer.objectIdField)}maskOccludee(e){return this.processor.maskOccludee(e)}async _initializeController(){const e=this.createController();this._pendingController=e,this._setupDataUpdating(e),await e.when(),this._setControllerWhenInitialized(e)}_setupDataUpdating(e){"dataUpdating"in e&&this.addHandles([o((()=>e.dataUpdating),(e=>{e&&this._dataUpdatingState===S.NONE?this._dataUpdatingState=S.CONTROLLER:e||this._dataUpdatingState!==S.CONTROLLER||(this._dataUpdatingState=S.NONE)}),n),o((()=>!!this.graphics3DProcessor?.dataUpdating),(t=>{t&&this._dataUpdatingState===S.CONTROLLER?this._dataUpdatingState=S.CORE:t||this._dataUpdatingState!==S.CORE||(this._dataUpdatingState=e.dataUpdating?S.CONTROLLER:S.NONE)}),n)])}async _setControllerWhenInitialized(e){try{await this.when()}catch(t){}this._controllerCreated=!0,this.isResolved()&&!this.destroyed?(await a((()=>this.view?.basemapTerrain?.ready)),this.beforeSetController(e),this._pendingController=null,this.controller=e,this.loadedGraphics=e.graphics):this._destroyPendingController()}_recreateProcessor(e){const t="heatmap"===e?.type,r="heatmap"===this.processor?.type,i=this.processor;if(i&&t===r)return;const s=t?new f({owner:this}):new y({owner:this,frustumVisibilityEnabled:!0,scaleVisibilityEnabled:!0,filterVisibilityEnabled:!0,timeExtentEnabled:!0,elevationAlignmentEnabled:!0,elevationFeatureExpressionEnabled:!0,preferredUpdatePolicy:this.updatePolicy,updateClippingExtent:e=>this._updateClippingExtent(e)});this.processor=s,i?.destroy(),this.queryEngine?.clear(),this.addResolvingPromise(s.when())}_updateClippingExtent(e){if(this.clippingExtent=e,!this.controller)return!1;switch(this.controller.type){case"stream":return!1;case"feature-tile-3d":return this.controller.extent=e,!0}}get performanceInfo(){const e=this.controller instanceof d?this.controller:null;return new E(this.processor.usedMemory,this.loadedGraphics?.length,e?.serviceDataCount??-1,e?.maximumNumberOfFeatures??-1,0,this.processor.performanceInfo)}};var S;e([l()],C.prototype,"updating",null),e([l()],C.prototype,"legendEnabled",null),e([l()],C.prototype,"layerView",void 0),e([l()],C.prototype,"layer",null),e([l()],C.prototype,"view",null),e([l()],C.prototype,"hasZ",null),e([l()],C.prototype,"hasM",null),e([l()],C.prototype,"fullOpacity",null),e([l()],C.prototype,"suspended",null),e([l()],C.prototype,"filter",null),e([l()],C.prototype,"slicePlaneEnabled",null),e([l()],C.prototype,"featureSpatialReference",null),e([l()],C.prototype,"loadedGraphics",void 0),e([l()],C.prototype,"graphics3DProcessor",null),e([l()],C.prototype,"heatmapProcessor",null),e([l()],C.prototype,"hasAllFeatures",null),e([l()],C.prototype,"hasAllFeaturesInView",null),e([l()],C.prototype,"hasFullGeometries",null),e([l()],C.prototype,"symbologySnappingSupported",null),e([l()],C.prototype,"updatePolicy",null),e([l()],C.prototype,"queryEngine",void 0),e([l()],C.prototype,"scaleVisibilitySuspended",null),e([l()],C.prototype,"timeExtent",null),e([l()],C.prototype,"_dataUpdatingState",void 0),e([l({readOnly:!0})],C.prototype,"dataUpdating",null),e([l()],C.prototype,"controller",void 0),e([l()],C.prototype,"processor",void 0),e([l()],C.prototype,"updatingHandles",void 0),e([l()],C.prototype,"_controllerCreated",void 0),C=e([p("esri.views.3d.layers.graphics.Graphics3DGraphicsPipeline")],C),function(e){e[e.NONE=0]="NONE",e[e.CONTROLLER=1]="CONTROLLER",e[e.CORE=2]="CORE"}(S||(S={}));export{C as Graphics3DGraphicsPipeline};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import r from"../../../../../core/Error.js";import{destroyHandle as t,makeHandle as i}from"../../../../../core/handleUtils.js";import{EsriPromise as o}from"../../../../../core/Promise.js";import{on as s}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 n}from"../../../../../core/accessorSupport/decorators/subclass.js";import l from"../../../../../layers/graphics/data/FeatureStore.js";import{toJSONGeometryType as u}from"../../../../2d/layers/support/util.js";import{FeatureLayerViewPerformanceInfo as p}from"../../FeatureLayerViewPerformanceInfo.js";import{QueryEngine as m}from"../QueryEngine.js";import{Feature3DPipelineWorkerHandle as d}from"./Feature3DPipelineWorkerHandle.js";import{TestSymbol as y}from"./TestSymbol.js";import{LayerViewPerformanceInfo as c}from"../../support/LayerViewPerformanceInfo.js";import{UpdatePolicy as h}from"../../../webgl-engine/lib/UpdatePolicy.js";import{TaskPriority as g}from"../../../../support/Scheduler.js";let w=class extends o{constructor(e){super(e),this.maximumNumberOfFeatures=1e3}initialize(){const e=u(this.layerView.layer.geometryType);if("esriGeometryPoint"!==e)throw new r("unsupported-geometry-type",`${this.layerView.layer.geometryType} is not supported`);const i="hasZ"in this.layerView.layer&&this.layerView.layer.hasZ,o="hasM"in this.layerView.layer&&this.layerView.layer.hasM,a=new l({geometryType:e,hasZ:i,hasM:o});this.queryEngine=new m({context:{spatialReference:this.layerView.view.spatialReference,layer:this.layerView.layer,scheduler:this.layerView.view.resourceController.scheduler,featureStore:a,hasZ:i,hasM:o},priority:g.FEATURE_QUERY_ENGINE}),this.addResolvingPromise((async()=>{const{layer:e,view:r}=this.layerView,{spatialReference:i,renderSpatialReference:o,resourceController:a}=r,n=new y({view:r}),l=new d({schedule:e=>a.immediate.schedule(e),config:{url:this.layerView.layer.parsedUrl?.path??"",baseQuery:e.createQuery().toJSON(),spatialReference:i.toJSON(),renderSpatialReference:o.toJSON(),objectIdField:e.objectIdField,capabilities:e.capabilities},onAddTile:e=>n.addTile(e),onRemoveTiles:e=>n.removeTiles(e.tileIds)});this._workerHandle=await l.when(),this.addHandles([this.layerView.view.featureTiles.addClient(),s((()=>this.layerView.view.featureTiles.tiles),"change",(e=>{this._workerHandle.onTileTreeChange(e)}),{onListenerAdd:e=>this._workerHandle.onTileTreeChange({added:e.toArray(),removed:[]}),onListenerRemove:e=>this._workerHandle.onTileTreeChange({added:[],removed:e.toArray()})}),t(n)])})())}get legendEnabled(){return!1}get hasAllFeatures(){return!1}get hasAllFeaturesInView(){return!1}get hasFullGeometries(){return!1}get symbologySnappingSupported(){return!1}get scaleVisibilitySuspended(){return!1}get suspendInfo(){return{}}get updating(){return!1}get dataUpdating(){return!1}get updatePolicy(){return h.ASYNC}get maximumNumberOfFeaturesExceeded(){return!1}get updatingProgressValue(){return 1}get usedMemory(){return 100}get unloadedMemory(){return 0}get ignoresMemoryFactor(){return!0}get performanceInfo(){return new p(new c(this.usedMemory,0,0,this.maximumNumberOfFeatures,0,null),0,0,!0,"tiles","n/a")}get suspendResumeExtentMode(){return"computed"}forEachGraphic(e){}findGraphic(e){return null}highlight(e){return i()}maskOccludee(e){return i()}async whenGraphicBounds(e,r){return null}computeAttachmentOrigin(e,r){return null}elevationAlignPointsInFeatures(e,t){throw new r("unsupported-elevation-alignment")}queryForSymbologySnapping(e,t){throw new r("unsupported-symbology-snapping")}async doRefresh(e){}setVisibility(e,r){}getMissingAttributesForFeature(e){return null}getHydratedGeometry(e){return null}};e([a()],w.prototype,"layerView",void 0),w=e([n("esri.views.3d.layers.graphics.pipeline.Feature3DPipeline")],w);export{w as Feature3DPipeline};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import"../../../../../geometry.js";import s from"../../../../../core/Accessor.js";import{createTask as i}from"../../../../../core/asyncUtils.js";import{throwIfAborted as t}from"../../../../../core/promiseUtils.js";import"../../../../../core/Logger.js";import"../../../../../core/has.js";import"../../../../../core/RandomLCG.js";import"../../../../../core/Error.js";import{subclass as r}from"../../../../../core/accessorSupport/decorators/subclass.js";import o from"../../../../../rest/support/Query.js";import{Tile3DFetcher as n}from"./Tile3DFetcher.js";import{Tile3DProcessor as l}from"./Tile3DProcessor.js";import c from"../../../../../geometry/SpatialReference.js";let d=class extends s{constructor(){super(...arguments),this.remoteClient=null,this._pendingTiles=new Map,this._loadedTiles=new Map,this._processor=null,this._fetcher=null}destroy(){for(const e of this._pendingTiles.values())e.abort();this._pendingTiles.clear(),this._loadedTiles.clear()}setup({spatialReference:e,renderSpatialReference:s,baseQuery:i,url:t,objectIdField:r,capabilities:d}){const a=c.fromJSON(e);this._fetcher=new n(a,o.fromJSON(i),t,r,d),this._processor=new l(r,a,c.fromJSON(s))}async onTileTreeChange(e){const{added:s,removed:t}=e;for(const i of t){this._loadedTiles.delete(i);const e=this._pendingTiles.get(i);e?.abort(),this._pendingTiles.delete(i)}for(const r of s){const e=this._pendingTiles.get(r.id);e?.abort(),this._pendingTiles.set(r.id,i((e=>this._addTile(r,e))))}if(t.length>0){const e={tileIds:t};await this.remoteClient.invoke("onRemoveTiles",e)}}async _addTile(e,s){const i=await this._fetcher.fetch(e,s);t(s);const r=this._processor.process(i);if(null==r)return void this._pendingTiles.delete(e.id);const{coordinates:o,objectIds:n,indicesCoordinates:l,indicesShared:c}=r;await this.remoteClient.invoke("onAddTile",r,{signal:s,transferList:[o.buffer,n.buffer,l.buffer,c.buffer]}),this._pendingTiles.delete(e.id),this._loadedTiles.set(e.id,i)}};d=e([r("esri.views.3d.layers.graphics.pipeline.Feature3DPipelineWorker")],d);const a=d;export{a as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{EsriPromise as r}from"../../../../../core/Promise.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as t}from"../../../../../core/accessorSupport/decorators/subclass.js";import{WorkerHandle as s}from"../../../../../core/workers/WorkerHandle.js";let i=class extends r{constructor(e){super(e),this.schedule=null}initialize(){this._workerHandle=new n(this.schedule,this),this.addResolvingPromise((async()=>await this._workerHandle.invokeMethod("setup",this.config))())}async onTileTreeChange({added:e,removed:r}){if(0===e.length&&0===r.length)return;const o=e.map(c),t=r.map(d);return await this._workerHandle.invokeMethod("onTileTreeChange",{added:o,removed:t})}};e([o({constructOnly:!0})],i.prototype,"schedule",void 0),e([o({constructOnly:!0})],i.prototype,"config",void 0),e([o({constructOnly:!0})],i.prototype,"onAddTile",void 0),e([o({constructOnly:!0})],i.prototype,"onRemoveTiles",void 0),i=e([t("esri.views.3d.layers.graphics.pipeline.Feature3DPipelineWorkerHandle")],i);class n extends s{constructor(e,r){super("Feature3DPipelineWorker","setup",{},e,{strategy:"dedicated",client:r})}}function c({id:e,lij:r,extent:o}){return{id:e,lij:r,extent:o}}function d({id:e}){return e}export{i as Feature3DPipelineWorkerHandle};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import e from"../../../../../core/Error.js";import t from"../../../../../core/pbf.js";import{normalizeTransform as r}from"../../../../../geometry/support/quantizationUtils.js";import{parseField as n,parseTransform as s}from"../../../../../rest/query/operations/pbfFeatureServiceParser.js";class o{constructor(e){const r=new t(new Uint8Array(e),new DataView(e));this._index=i(r),this._reader=r}get featureCount(){return this._index.featureIndices.length}get exceededTransferLimit(){return this._index.exceededTransferLimit}fieldIndex(e){return this._index.fields.find((t=>t.name===e))?.index??-1}readAttribute(e,t){const{featureCount:r,_index:n}=this;if(e<0||e>=r)return;const s=n.fields.length;if(e<0||t>=s)return;const o=n.attributeIndices[e*s+t],i=this._reader;return i.move(o),f(i)}readAllCoordinates(e,t=0){const r=2,n=3,s=this._reader,{transform:o}=this._index,{scale:i,translate:a}=o,[c,u,f]=i,[g,d,p]=a;for(const l of this._index.featureIndices){s.move(l);const o=s.getLength(),i=s.pos()+o;for(;s.pos()<i&&s.next();)switch(s.tag()){case r:{const r=s.getLength(),o=s.pos()+r;for(;s.pos()<o&&s.next();)if(s.tag()===n)s.getUInt32(),e[t++]=g+c*s.getSInt64(),e[t++]=d+u*s.getSInt64(),e[t++]=p+f*s.getSInt64();else s.skip();break}default:s.skip()}}return t}}function i(e){const t=2;for(;e.next();){if(e.tag()===t)return a(e.getMessage());e.skip()}u()}function a(e){const t=1;for(;e.next();){if(e.tag()===t)return c(e.getMessage());e.skip()}u()}function c(e){const t=9,o=12,i=13,a=15,c=7,f=0,g=10,d=1;let p,l=!1,h=!1,x=0;const m=new Array,I=new Array,k=new Array;for(;e.next();)switch(e.tag()){case c:e.getEnum()!==f&&u();break;case t:l=e.getBool()??!1;break;case o:p=r(e.processMessage(s));break;case i:{const t=e.processMessage(n);t.index=x++,m.push(t);break}case a:{I.push(e.pos());const t=e.getUInt32(),r=e.pos()+t;for(;e.pos()<r&&e.next();)if(e.tag()===d)k.push(e.pos()),e.skip();else e.skip();break}case g:h=e.getBool()??!1;break;default:e.skip()}return null!=p&&h||u(),{transform:p,exceededTransferLimit:l,fields:m,featureIndices:I,attributeIndices:k}}function u(){const t=new e("pbf-parsing-failed","Error while parsing PBF",new Error);throw console.error(t),t}function f(e){const t=1,r=2,n=3,s=4,o=5,i=6,a=7,c=8,u=9,f=e.getLength(),g=e.pos()+f;for(;e.pos()<g&&e.next();)switch(e.tag()){case t:return e.getString();case r:return e.getFloat();case n:return e.getDouble();case s:return e.getSInt32();case o:return e.getUInt32();case i:return e.getInt64();case a:return e.getUInt64();case c:return e.getSInt64();case u:return e.getBool();default:return e.skip(),null}return null}export{o as PBFPointFeaturesView};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import r from"../../../../../core/Accessor.js";import{makeHandle as s}from"../../../../../core/handleUtils.js";import{throwIfNotAbortError as t}from"../../../../../core/promiseUtils.js";import{property as i}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as o}from"../../../../../core/accessorSupport/decorators/subclass.js";import{PromiseQueue as n}from"../../../../../layers/support/PromiseQueue.js";import{namedAnchorToHUDMaterialAnchorPos as l}from"../placementUtils.js";import{createTexture as a,requiresHalfTexelOffset as c,defaultSymbolSizeRatio as d}from"../../../support/engineContent/sdfPrimitives.js";import{Attribute as m}from"../../../webgl-engine/lib/Attribute.js";import{MaterialChangeSet as p}from"../../../webgl-engine/lib/ChangeSet.js";import{ContentObjectType as h}from"../../../webgl-engine/lib/ContentObjectType.js";import{Geometry as u}from"../../../webgl-engine/lib/Geometry.js";import{createPointGeometry as g}from"../../../webgl-engine/lib/GeometryUtil.js";import{LocalOrigin as w}from"../../../webgl-engine/lib/LocalOriginFactory.js";import{RenderGeometry as f}from"../../../webgl-engine/lib/RenderGeometry.js";import{VertexAttribute as _}from"../../../webgl-engine/lib/VertexAttribute.js";import{HUDMaterial as b}from"../../../webgl-engine/materials/HUDMaterial.js";import{MergedRenderer as y}from"../../../webgl-engine/materials/renderers/MergedRenderer.js";import{TaskPriority as j}from"../../../../support/Scheduler.js";const T=[d/2,d/2,1-d/2,1-d/2];let S=class extends r{constructor(e){super(e),this._tiles=new Map,this._pendingTiles=new Map,this._promiseQueue=new n,this._normal=new Float64Array([0,0,1]),this._color=new Float64Array([255,255,255,255]),this._size=new Float64Array([24,24]),this._centerOffsetAndDistance=new Float64Array([0,0,0,1]),this._uvs=new Float64Array([0,0])}initialize(){const{view:e}=this,{sharedSymbolResources:r}=e;if(null==r)throw new Error("No shared symbol resources found!");const{textures:t}=r,[i,o]=A(t);this._material=i;const n=new y({material:i});this._renderer=n;const l=new f(g(i,null,[0,0,0]));l.localOrigin=new w([0,0,0],"keep-alive");const a=new p;a.adds.push(l),e._stage.addRenderPlugin(n),n.modify(a),e._stage.renderView.renderer.updateHasFlags(),this.addHandles([e.resourceController.scheduler.registerTask(j.GRAPHICS_CORE,this._promiseQueue),s((()=>o.release()))])}destroy(){this._renderer.destroy(),this._tiles.clear();for(const e of this._pendingTiles.values())e.abort();this._pendingTiles.clear(),this._promiseQueue.destroy()}async removeTiles(e){const r=new p,{removes:s}=r;for(const t of e){const e=this._pendingTiles.get(t);null!=e&&(e.abort(),this._pendingTiles.delete(t));const r=this._tiles.get(t);if(null!=r){for(const e of r.renderGeometries)s.push(e);this._tiles.delete(t)}}await this._promiseQueue.push((()=>{this._renderer.modify(r),this.view._stage.renderView.requestRender()}),null)}async addTile({tileId:e,coordinates:r,indicesCoordinates:s,indicesShared:i,localOrigin:o}){this._pendingTiles.get(e)?.abort();const n=new p,{adds:l,removes:a}=n,c=this._tiles.get(e);if(null!=c){for(const e of c.renderGeometries)a.push(e);this._tiles.delete(e)}const d=this._material,g=[[_.POSITION,new m(r,s,3,!0)],[_.NORMAL,new m(this._normal,i,3,!0)],[_.UV0,new m(this._uvs,i,2,!0)],[_.COLOR,new m(this._color,i,4,!0)],[_.SIZE,new m(this._size,i,2,!0)],[_.CENTEROFFSETANDDISTANCE,new m(this._centerOffsetAndDistance,i,4,!0)]],b=new u(d,g,null,h.Point),y=new f(b);y.localOrigin=new w(o,e),l.push(y);const j=new AbortController;this._pendingTiles.set(e,j);try{await this._promiseQueue.push((()=>{this._renderer.modify(n),this._pendingTiles.delete(e),this._tiles.set(e,{renderGeometries:l}),this.view._stage.renderView.requestRender()}),j.signal)}catch(T){t(T)}}};function A(e){const r={anchorPosition:l.center,occlusionTest:!0,hasSlicePlane:!1},s=r,t=1;s.color=[1,0,0,1],s.outlineColor=[0,0,0,1],s.outlineSize=t;const i=e.fromData("circle-icon",(()=>a("circle")));return s.textureId=i.texture.id,s.textureIsSignedDistanceField=!0,s.sampleSignedDistanceFieldTexelCenter=c("circle"),s.distanceFieldBoundingBox=T,[new b(r),i]}e([i({constructOnly:!0})],S.prototype,"view",void 0),S=e([o("esri.views.3d.layers.graphics.pipeline.TestSymbol")],S);export{S as TestSymbol};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{throwIfAborted as e}from"../../../../../core/promiseUtils.js";import{toExtent as t}from"../../../../../geometry/support/aaBoundingRect.js";import{executeQueryPBFBuffer as r}from"../../../../../rest/query/operations/query.js";import{PBFPointFeaturesView as o}from"./PBFPointFeaturesView.js";import{Tile as s}from"./Tile.js";const i=8e3,a=4,n=4;class c{constructor(e,t,r,o,s){this.spatialReference=e,this.url=r,this.objectIdField=o,this.capabilities=s;const{supportsMaxRecordCountFactor:n,maxRecordCount:c}=this.capabilities.query,u=c??8e3,l=(n?a:null)??1,p=u*l;this._pageSize=Math.min(i,p);const m=t.clone();m.cacheHint=!0,m.resultType="tile",m.outSpatialReference=e,m.returnGeometry=!0,m.returnZ=!0,m.maxRecordCountFactor=l,m.num=u,m.outFields=[o],this._baseQuery=m}async fetch(r,o){const{spatialReference:i}=this,a=t(r.extent,i),c=this._baseQuery.clone();c.geometry=a;const u=new Array;let l=0,p=!1,m=1;for(;!p;){const t=[];for(let e=0;e<m;++e)t.push(this._fetchPage(c,l++,o));const r=await Promise.all(t);e(o);for(const e of r){const t=0!==e.featureCount;p||=!e.exceededTransferLimit||!t,t&&u.push(e)}m=Math.min(m+1,n)}return new s(r,u)}async _fetchPage(t,s,i){const a=t.clone();a.start=s*this._pageSize;const n=(await r(this.url,a,{signal:i})).data;return e(i),new o(n)}}export{c as Tile3DFetcher};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{create as e}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectBuffer as r}from"../../../../../geometry/projection/projectBuffer.js";import{projectVectorToVector as t}from"../../../../../geometry/projection/projectVectorToVector.js";import{center as o}from"../../../../../geometry/support/aaBoundingRect.js";class i{constructor(e,r,t){this.objectIdField=e,this.spatialReference=r,this.renderSpatialReference=t}process(i){const{pages:n}=i;if(0===n.length)return null;const c=n.reduce(((e,{featureCount:r})=>e+r),0);if(0===c)return null;const s=this.objectIdField,a=this.spatialReference,l=this.renderSpatialReference,d=new Float64Array(3*c),f=new Uint32Array(c);let p=0;for(const e of n){p=e.readAllCoordinates(d,p);const r=e.fieldIndex(s);if(r<0)throw new Error("Failed to find object id field");for(let t=0;t<c;++t)f[t]=e.readAttribute(t,r)}const j=new Float64Array(d.length);if(!r(d,a,0,j,l,0,c))throw new Error("Failed to project coordinates");const u=i.descriptor.extent,m=o(u),h=e();t([m[0],m[1],0],a,h,l);const g=new Uint32Array(c);for(let e=0;e<c;++e)g[e]=e;const w=new Uint32Array(c);for(let e=0;e<c;++e)w[e]=0;return{coordinates:j,indicesCoordinates:g,indicesShared:w,objectIds:f,tileId:i.descriptor.id,localOrigin:h}}}export{i as Tile3DProcessor};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import{disposeMaybe as s}from"../../../../core/maybe.js";import t from"../../../../core/PooledArray.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{f as n,l as o,j as a,k as l,m as h,q as c}from"../../../../chunks/vec32.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as u}from"../../../../chunks/vec42.js";import{create as m,offset as p,contains as g,containsPoint as _,set as f,positiveInfinity as P,equals as b}from"../../../../geometry/support/aaBoundingBox.js";import{create as S}from"../../../../geometry/support/plane.js";import{fromPoints as x}from"../../../../geometry/support/ray.js";import{PclTarget as
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import{disposeMaybe as s}from"../../../../core/maybe.js";import t from"../../../../core/PooledArray.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{f as n,l as o,j as a,k as l,m as h,q as c}from"../../../../chunks/vec32.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as u}from"../../../../chunks/vec42.js";import{create as m,offset as p,contains as g,containsPoint as _,set as f,positiveInfinity as P,equals as b}from"../../../../geometry/support/aaBoundingBox.js";import{create as S}from"../../../../geometry/support/plane.js";import{fromPoints as x}from"../../../../geometry/support/ray.js";import{PclTarget as w}from"./Intersector.js";import{PointHighlights as z}from"./PointHighlights.js";import{isDepth as R,ShaderOutput as A}from"../../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SyncPrepareRenderPlugin as j}from"../../webgl-engine/effects/RenderPlugin.js";import{Default3D as q}from"../../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{newIntersectorResult as y}from"../../webgl-engine/lib/Intersector.js";import{IntersectorType as O,StoreResults as E}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{RenderSlot as I}from"../../webgl-engine/lib/RenderSlot.js";import{VertexArrayObject as v}from"../../webgl-engine/lib/VertexArrayObject.js";import{VertexAttribute as F}from"../../webgl-engine/lib/VertexAttribute.js";import{P as L,a as N,g as C}from"../../../../chunks/PointRenderer.glsl.js";import{PointRendererTechnique as T}from"../../webgl-engine/shaders/PointRendererTechnique.js";import{PointRendererTechniqueConfiguration as H}from"../../webgl-engine/shaders/PointRendererTechniqueConfiguration.js";import{BufferObject as M}from"../../../webgl/BufferObject.js";import{DataType as B,PrimitiveType as D,Usage as U}from"../../../webgl/enums.js";import{VertexElementDescriptor as V}from"../../../webgl/VertexElementDescriptor.js";const W=new Map([["positions",[new V(F.POSITION,3,B.FLOAT,0,12)]],["colors",[new V(F.COLOR,3,B.UNSIGNED_BYTE,0,3,!0)]]]);let k=class extends j{constructor(e){super(e),this.type=O.PCL,this.isGround=!1,this._passParameters=new L,this._highlights=new z({forEachNode:e=>this.forEachNode(e),addHighlight:(e,s,t)=>this._addHighlight(e,s,t),removeHighlight:(e,s)=>this._removeHighlight(e,s)}),this.produces=new Map([[I.OPAQUE_MATERIAL,e=>!(R(e)||e===A.Highlight&&this._highlights.empty)],[I.OPAQUE_NO_SSAO_DEPTH,e=>R(e)]]),this.layerUid="",this._slicePlaneEnabled=!1,this._techniqueConfig=new H,this._nodes=new t}initializeRenderContext(e){this._context=e,e.requestRender()}uninitializeRenderContext(){}intersect(e,s,t,i){const r=d(),f=d(),P=d(),b=d(),z=S(),R=e.camera.perScreenPixelRatio/2,A=e.camera.near;n(f,i,t);const j=1/o(f);a(f,f,j),l(P,f),u(z,f[0],f[1],f[2],-h(f,t));const q=new ee,O=new ee,I=new Array,v=m(),F=m(this._passParameters.clipBox);p(F,-t[0],-t[1],-t[2],F),this._nodes.forAll((o=>{const a=o.splatSize*this._passParameters.scaleFactor;let l=o.obb.minimumDistancePlane(z),d=o.obb.maximumDistancePlane(z);l-=J(a,l+A,this._passParameters,R,o.isLeaf),d-=J(a,d+A,this._passParameters,R,o.isLeaf);const u=d<0,m=null!=q.dist&&null!=O.dist&&q.dist<l*j&&O.dist>d*j;if(u||m)return;const S=Y(a,d+A,this._passParameters,R,o.isLeaf);if(!o.obb.intersectRay(t,f,S))return;const x=S*S;o.obb.toAaBoundingBox(v),p(v,-t[0],-t[1],-t[2],v);const w=!g(F,v);n(b,o.origin,t);const y=o.coordinates.length/3;for(let n=0;n<y;n++){if(r[0]=b[0]+o.coordinates[3*n],r[1]=b[1]+o.coordinates[3*n+1],r[2]=b[2]+o.coordinates[3*n+2],w&&!_(F,r))continue;const l=h(r,f),d=c(r)-l*l;if(d>x)continue;let u=l+A;const m=J(a,u,this._passParameters,R,o.isLeaf);if(l-m<0)continue;u-=m;const p=Y(a,u,this._passParameters,R,o.isLeaf);if(d>p*p)continue;const g=(l-m)*j,S=e=>(e.point=K(o,n,e.point),e.dist=g,e.normal=P,e.node=o,e.pointId=n,e.layerUid=this.layerUid,e);if((null==q.dist||g<q.dist)&&(null==s||s(t,i,g))&&S(q),e.options.store!==E.MIN&&(null==O.dist||g>O.dist)&&(null==s||s(t,i,g))&&S(O),e.options.store===E.ALL&&(null==s||s(t,i,g))){const e=new ee;I.push(S(e))}}}));const L=e=>{const{layerUid:s,node:t,pointId:i}=e;return new w(e.point,s,i,(()=>this.createGraphic(t,i,e.point)))},N=(e,s)=>{const t=L(s);e.set(this.type,t,s.dist,s.normal)};if(se(q)){const s=e.results.min;(null==s.dist||q.dist<s.dist)&&N(s,q)}if(se(O)&&e.options.store!==E.MIN){const s=e.results.max;(null==s.dist||O.dist>s.dist)&&N(s,O)}if(e.options.store===E.ALL){const s=x(t,i);for(const t of I){const i=y(s);N(i,t),e.results.all.push(i)}}}prepareTechnique(e){return 0!==this._nodes.length&&(e.output===A.Color||R(e.output)&&e.bindParameters.slot===I.OPAQUE_NO_SSAO_DEPTH||e.output===A.Highlight)?(this._nodes.forAll((s=>{null==s.vao&&this._initNode(e,s)})),this._techniqueConfig.drawScreenSize=this._passParameters.drawScreenSpace,this._techniqueConfig.useFixedSizes=this._passParameters.useFixedSizes,this._techniqueConfig.hasSlicePlane=this._slicePlaneEnabled,this._techniqueConfig.hasOccludees=e.bindParameters.hasOccludees,this._techniqueConfig.clippingEnabled=this._clippingEnabled,this._techniqueConfig.output=e.output,this._context.techniques.releaseAndAcquire(T,this._techniqueConfig,this._technique)):null}renderNode(e,s){const t=e.rctx,i=t.bindTechnique(s,e.bindParameters,this._passParameters),r=e.output===A.Highlight;this._nodes.forAll((s=>{0!==s.coordinates.length&&(!r||s.highlights&&0===e.bindParameters.highlightLevel)&&(i.bindDraw(e.bindParameters,this._passParameters,s),t.bindVAO(s.vao),r?this._renderHighlightFragments(t,s):t.drawArrays(D.POINTS,0,s.coordinates.length/3))}))}_renderHighlightFragments(e,s){const t=s.highlights;if(null==t)return;let i=t[0].component,r=i+1;for(let o=1;o<t.length;o++){const s=t[o].component;if(s!==r){const t=r-i;t>0&&e.drawArrays(D.POINTS,i,t),i=s}r=s+1}const n=r-i;n>0&&e.drawArrays(D.POINTS,i,n)}set useFixedSizes(e){this._passParameters.useFixedSizes!==e&&(this._passParameters.useFixedSizes=e,this._requestRender())}get useFixedSizes(){return this._passParameters.useFixedSizes}set scaleFactor(e){this._passParameters.scaleFactor!==e&&(this._passParameters.scaleFactor=e,this._requestRender())}get scaleFactor(){return this._passParameters.scaleFactor}set minSizePx(e){this._passParameters.minSizePx!==e&&(this._passParameters.minSizePx=e,this._requestRender())}get minSizePx(){return this._passParameters.minSizePx}set useRealWorldSymbolSizes(e){this._passParameters.useRealWorldSymbolSizes!==e&&(this._passParameters.useRealWorldSymbolSizes=e,this._requestRender())}get useRealWorldSymbolSizes(){return this._passParameters.useRealWorldSymbolSizes}set size(e){this._passParameters.size!==e&&(this._passParameters.size=e,this._requestRender())}get size(){return this._passParameters.size}set sizePx(e){this._passParameters.sizePx!==e&&(this._passParameters.sizePx=e,this._requestRender())}get sizePx(){return this._passParameters.sizePx}set clippingBox(e){f(this._passParameters.clipBox,e||P)}get _clippingEnabled(){return!b(this._passParameters.clipBox,P,((e,s)=>e===s))}get slicePlaneEnabled(){return this._slicePlaneEnabled}set slicePlaneEnabled(e){this._slicePlaneEnabled!==e&&(this._slicePlaneEnabled=e,this._requestRender())}addNode(e){this._nodes.push(e),this._highlights.nodeAdded(e),this._requestRender()}removeNode(e){let t=null;return this._nodes.filterInPlace((i=>i.id!==e||(t=i,i.vao=s(i.vao),this._highlights.nodeRemoved(i),!1))),this._requestRender(),t}forEachNode(e){this._nodes.forAll(e)}removeAll(){this._nodes.forAll((e=>e.vao=s(e.vao))),this._highlights.removeAll(),this._nodes.clear(),this._requestRender()}highlight(e){return this._highlights.add(e)}_addHighlight(e,s,t){e.highlights=Z(e.highlights,s,t),this._requestRender()}_removeHighlight(e,s){e.highlights=$(e.highlights,s),this._requestRender()}_initNode(e,s){const t=e.rctx;s.vao=new v(t,q,W,new Map([["positions",M.createVertex(t,U.STATIC_DRAW,s.coordinates)],["colors",M.createVertex(t,U.STATIC_DRAW,s.rgb)]]))}_requestRender(){this._context&&this._context.requestRender()}};e([i({constructOnly:!0})],k.prototype,"createGraphic",void 0),k=e([r("esri.views.3d.layers.i3s.PointRenderer")],k);class G extends N{constructor(e,s,t,i,r,n,o,a,l=null,h=null){super(t,r,s),this.id=e,this.obb=i,this.coordinates=n,this.rgb=o,this.attributes=a,this.pointIdFilterMap=l,this.highlights=h}}function Q(e){return e.hasOwnProperty("splatSize")}function Y(e,s,t,i,r){if(t.drawScreenSpace)return t.fixedSize*s*i;const n=C(r)*s*i;return t.useFixedSizes?Math.min(t.fixedSize/2,n):t.screenMinSize>0?Math.min(Math.max(t.screenMinSize*s*i,e/2),n):Math.min(e/2,n)}function J(e,s,t,i,r){return t.drawScreenSpace?0:Y(e,s,t,i,r)}function K(e,s,t){return null==t&&(t=d()),t[0]=e.origin[0]+e.coordinates[3*s],t[1]=e.origin[1]+e.coordinates[3*s+1],t[2]=e.origin[2]+e.coordinates[3*s+2],t}function X(e){return null!=e.component?e.component:-1}function Z(e,s,t){null==e&&(e=[]);const i={component:s,id:t};e.push(i);const r=X(i);let n=e.length-1;for(;n>0&&r<X(e[n-1]);)[e[n-1],e[n]]=[e[n],e[n-1]],--n;return e}function $(e,s){if(null==e)return e;const t=e.filter((e=>e.id!==s));return 0===t.length?null:t}class ee{constructor(){this.node=null,this.pointId=null,this.point=null,this.dist=null,this.normal=null,this.layerUid=""}}function se(e){return null!=e.dist&&null!=e.point&&null!=e.pointId&&null!=e.node}export{k as PointRenderer,G as PointRendererNode,Q as isPointRendererNode};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{isSome as r}from"../../../../core/arrayUtils.js";import{estimateAttributesObjectSize as i,estimateFixedArraySize as a,estimateNumberByteSize as s}from"../../../../core/byteSizeEstimations.js";import{makeHandle as o}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import n from"../../../../core/Logger.js";import{initial as l,sync as p,watch as d}from"../../../../core/reactiveUtils.js";import{pt2px as u}from"../../../../core/screenUtils.js";import{property as m}from"../../../../core/accessorSupport/decorators/property.js";import{subclass as h}from"../../../../core/accessorSupport/decorators/subclass.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as y}from"../../../../core/support/UpdatingHandles.js";import{projectPointToVector as _}from"../../../../geometry/projection/projectPointToVector.js";import{getContinuousIndexArray as g}from"../../../../geometry/support/Indices.js";import{getResolutionForScale as f}from"../../../../geometry/support/scaleUtils.js";import{getObjectId as R}from"../../../../layers/graphics/dehydratedFeatures.js";import{convertFromPoint as F}from"../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as b}from"../../../../layers/graphics/OptimizedFeature.js";import v from"../../../../layers/graphics/OptimizedGeometry.js";import S from"../../../../layers/graphics/data/FeatureStore.js";import{isNumericField as w}from"../../../../layers/support/fieldUtils.js";import{generateGradient as P}from"../../../../renderers/support/heatmapUtils.js";import{DrapeSourceType as j}from"../interfaces.js";import{DisplayFeatureLimit as T}from"../graphics/DisplayFeatureLimit.js";import{GraphicsCorePerformanceInfo as V}from"../graphics/GraphicsCorePerformanceInfo.js";import{FeatureVisibilityFilter as G}from"./FeatureVisibilityFilter.js";import{drapedZ as x}from"../../terrain/OverlayRenderer.js";import{Attribute as I}from"../../webgl-engine/lib/Attribute.js";import{ContentObjectType as M}from"../../webgl-engine/lib/ContentObjectType.js";import{DrapedHeatmapRenderer as A}from"../../webgl-engine/lib/DrapedHeatmapRenderer.js";import{Geometry as N}from"../../webgl-engine/lib/Geometry.js";import{DirtyOperation as O,DirtyState as H}from"../../webgl-engine/lib/ModelDirtyTypes.js";import{RenderGeometry as U}from"../../webgl-engine/lib/RenderGeometry.js";import{UpdatePolicy as E}from"../../webgl-engine/lib/UpdatePolicy.js";import{VertexAttribute as L}from"../../webgl-engine/lib/VertexAttribute.js";import{HeatmapDensityMaterial as D}from"../../webgl-engine/materials/HeatmapDensityMaterial.js";import{scaleBoundsPredicate as C,isScaleRangeActive as B}from"../../../support/layerViewUtils.js";import{PixelType as W,PixelFormat as Z}from"../../../webgl/enums.js";import{loadHeatmapTextureConfiguration as z}from"../../../webgl/heatmapTextureUtils.js";const $=112;let q=class extends t{constructor(e){super(e),this.type="heatmap",this.preferredUpdatePolicy=E.ASYNC,this.dataExtent=null,this.drapeSourceType=j.Features,this._renderGeometries=new Map,this._fieldTotal=0,this._drapeSourceRenderer=null,this._dataType=W.HALF_FLOAT,this._pixelFormat=Z.RGBA,this._updatingHandles=new y,this.initializePromise=Promise.resolve()}initialize(){this._featureStore=new S({geometryType:"esriGeometryPoint",hasZ:this.hasZ,hasM:this.hasM});const{dataType:e,samplingMode:t,pixelFormat:r,internalFormat:i}=z(this._renderView.renderingContext,n.getLogger(this));this._dataType=e,this._pixelFormat=r;const a=e!==W.FLOAT;this._drapeSourceRenderer=this.view.basemapTerrain.overlayManager.registerDrapeSource(this,A,{...this._rendererParameters,dataType:e,samplingMode:t,pixelFormat:r,internalFormat:i}),this._material=new D({usesHalfFloats:a}),this._materialWithField=new D({usesHalfFloats:a,isAttributeDriven:!0}),this._filterVisibility=new G({context:{configuration:this.owner,featureStore:this.featureStore,getFeatureCount:()=>this._loadedPointGraphics.length,setAllFeaturesVisibility:e=>this._setAllFeaturesVisibility(e),clearFeaturesVisibility:()=>this._setAllFeaturesVisibility(!0),updateFeatureVisibilities:e=>this._updateFeatureVisibilities(e)}}),this._updatingHandles.addOnCollectionChange((()=>this._loadedPointGraphics),(e=>this._onLoadedFeaturesChange(e)),l),this._updatingHandles.addWhen((()=>this._materialParameters),(e=>this._forEachMaterial((t=>t.setParameters(e)))),l),this._updatingHandles.add((()=>this._rendererParameters),(e=>this._drapeSourceRenderer.set(e))),this._updatingHandles.add((()=>this._heatmapRendererField),(()=>{this._recreate()}),p),this._updatingHandles.add((()=>({fieldName:this._heatmapRendererFieldName,numeric:this._heatmapRendererFieldIsNumeric})),(({fieldName:e,numeric:t})=>{if(null!=e&&t){let t=0;this._featureStore.forEach((r=>t+=r.attributes[e]??0)),this._fieldTotal=t}else this._fieldTotal=this._featureStore.numFeatures}),l),this.addHandles([d((()=>({fieldName:this._heatmapRendererFieldName,field:this._heatmapRendererField})),(({fieldName:e,field:t})=>{e&&!t&&n.getLogger(this).warn(`Heatmap renderer field '${e}' for layer '${this.layer.title??this.layer.id}' not found`)})),d((()=>({field:this._heatmapRendererField,numeric:this._heatmapRendererFieldIsNumeric})),(({field:e,numeric:t})=>{null==e||t||n.getLogger(this).warn(`Heatmap renderer field '${e.name}' for layer '${this.layer.title??this.layer.id}' does not contain numeric values and cannot be used to drive the heatmap density`)})),o((()=>this.view.basemapTerrain.overlayManager.unregisterDrapeSource(this)))])}destroy(){this._renderGeometries.clear(),this._material=null,this._materialWithField=null,this._featureStore.clear(),this._featureStore=null,this._updatingHandles.destroy()}get layer(){return this.owner.layer}get featureStore(){return this._featureStore}get updating(){return this._updatingHandles.updating||this.filterVisibility.updating}get updatingRemaining(){return 0}get suspendInfo(){return{}}get legendEnabled(){return!0}get filterVisibility(){return this._filterVisibility}get displayFeatureLimit(){const e=this.owner?.view?.quality??1,t=this.owner?.view?.qualitySettings,r=t?Math.ceil(t.heatmap.maxTotalNumberOfFeatures*e):0;return new T(r*6,r)}get hasZ(){return"hasZ"in this.layer&&this.layer.hasZ}get hasM(){return"hasM"in this.layer&&this.layer.hasM}get view(){return this.owner.view}get fullOpacity(){return this.owner.fullOpacity}get updatePolicy(){return this.owner.updatePolicy}get scaleVisibilitySuspended(){if(!this._isScaleRangeActive)return!1;const{minScale:e,maxScale:t}=this.layer.effectiveScaleRange,{scale:r}=this.view;return!C(r,e??0,t??0)}get usedMemory(){const e=this.usedMemoryPerFeature*this._featureStore.numFeatures,t=this._pixelFormat===Z.RED?1:4,r=this._dataType===W.FLOAT?4:2,i=Math.ceil((this._overlayRenderer?.overlays[0]?.resolution??0)*this._densityMapPixelRatio)??0;return i*i*t*r+e}get usedMemoryPerFeature(){const e=this._loadedPointGraphics.find((()=>!0));if(null==e)return 0;const t=i(e),r=s(),o=6;return o*a([0,0,0],r)+o*a([0,0],r)+(this._heatmapRendererFieldIsNumeric?o*r:0)+t}get loadedFeatures(){return this._featureStore.numFeatures}get unprocessedMemoryEstimate(){return 0}get performanceInfo(){return new V(this._visibleFeatures,0,0)}get renderer(){return this._heatmapRenderer}get _overlayRenderer(){return this.view.basemapTerrain.overlayManager.renderer}get _overlaySpatialReference(){return this._overlayRenderer.spatialReference}get _rendererParameters(){return{...this._radiusParameter,...this._densityParameters,...this._colorRampParameter,...this._pixelRatioParameter}}get _materialParameters(){return{...this._radiusParameter,...this._resolutionForScaleParameter}}get _densityParameters(){const e=this._heatmapRenderer;if(null==e)return null;const{minDensity:t,maxDensity:r}=e;return{minDensity:t,maxDensity:r,fieldTotal:this._fieldTotal}}get _radiusParameter(){const e=this._heatmapRenderer;return e?{searchRadius:u(this._clampSearchRadius(e.radius))}:null}get _resolutionForScaleParameter(){const e=this._heatmapRenderer;if(!e)return null;const{referenceScale:t}=e;return{resolutionForScale:0===t?0:f(t,this.view.spatialReference)}}get _colorRampParameter(){const e=this._heatmapRenderer;return e?{colorRampData:P(e.colorStops)}:null}get _pixelRatioParameter(){return{pixelRatio:this._densityMapPixelRatio}}get _densityMapPixelRatio(){return this.owner?.view?.qualitySettings.heatmap.pixelRatio??1}get _renderView(){return this.view._stage.renderView}get _featuresArePoints(){return"point"===this.layer.geometryType}get _loadedPointGraphics(){return this.owner.loadedGraphics}get _heatmapRenderer(){const e=this.layer.renderer;return"heatmap"===e?.type?e:null}get _heatmapRendererFieldName(){return this._heatmapRenderer?.field}get _heatmapRendererField(){const e=this._heatmapRendererFieldName;return null!=e?this.layer.fieldsIndex.get(e):null}get _heatmapRendererFieldIsNumeric(){const e=this._heatmapRendererField;return null!=e&&w(e)}get _isScaleRangeActive(){const{layer:e}=this;if(!("effectiveScaleRange"in e))return!1;const{minScale:t,maxScale:r}=e.effectiveScaleRange;return B(t,r)}get _visibleFeatures(){let e=0;return this._renderGeometries.forEach((t=>{t.visible&&++e})),e}async whenGraphicBounds(){return null}computeAttachmentOrigin(){return null}highlight(){return o()}maskOccludee(){return o()}setObjectIdVisibility(){}refreshFilter(){this.filterVisibility.reapply()}_onLoadedFeaturesChange(e){if(!this._featuresArePoints)return;const{objectIdField:t}=this.layer;this._featureStore.removeManyById(e.removed.map((e=>R(e,t)))),this._featureStore.addMany(e.added.map((e=>{const{attributes:r,centroid:i,geometry:a}=e,s=new b(F(new v,a),r,i?F(new v,i):null,R(e,t));return s.displayId=e.uid,s})));const i=e.added,a=e.removed;this._fieldTotal+=this._computeFieldTotalChange(i,a);const s=a.map((({uid:e})=>{const t=this._renderGeometries.get(e);return this._renderGeometries.delete(e),t})).filter(r),o=i.map((e=>{const t=this._pointGraphicToRenderGeometry(e);return this._renderGeometries.set(e.uid,t),t}));s.length>0&&this._drapeSourceRenderer.removeGeometries(s,O.REMOVE),o.length>0&&this._drapeSourceRenderer.addGeometries(o,O.ADD),(o.length>0||s.length>0)&&(this.filterVisibility.reapply(),this._renderView.requestRender())}_recreate(){if(!this._loadedPointGraphics)return;const e=this._loadedPointGraphics.toArray();this._onLoadedFeaturesChange({added:e,removed:e})}_pointGraphicToRenderGeometry(e){const t=this._heatmapRendererFieldName,r=null!=t?this._materialWithField:this._material,i=c();_(e.geometry,i,this._overlaySpatialReference),i[2]=x;const a=g(1),s=[[L.POSITION,new I(i,a,i.length)]],o=this._heatmapRendererFieldIsNumeric;null!=t&&s.push([L.FEATUREATTRIBUTE,new I([o?e.attributes[t]??0:0],a,1)]);const n=new U(new N(r,s,null,M.Point),{layerUid:this.layer.uid,graphicUid:e.uid});return n.visible=this.filterVisibility.defaultVisibility,n}_forEachMaterial(e){e(this._material),e(this._materialWithField)}_computeFieldTotalChange(e,t){if(null==this._heatmapRendererFieldName||!this._heatmapRendererFieldIsNumeric)return e.length-t.length;const r=this._heatmapRendererFieldName,i=(e,t)=>e+(t.attributes[r]??0);return e.reduce(i,0)-t.reduce(i,0)}_clampSearchRadius(e){return e>$&&n.getLogger(this).warnOnce(`SceneView supports a maximum radius of ${$} pt for HeatmapRenderer.`),Math.min(e,$)}_updateFeatureVisibilities(e){const t=[];this._featureStore.forEach((({objectId:r,displayId:i})=>{const a=e(r),s=this._renderGeometries.get(i);s&&s.visible!==a&&(t.push(s),s.visible=a)})),this._drapeSourceRenderer.modifyGeometries(t,H.VISIBILITY)}_setAllFeaturesVisibility(e){const t=[];for(const r of this._renderGeometries.values())r.visible!==e&&(t.push(r),r.visible=e);this._drapeSourceRenderer.modifyGeometries(t,H.VISIBILITY)}get test(){}};e([m()],q.prototype,"type",void 0),e([m({constructOnly:!0})],q.prototype,"owner",void 0),e([m()],q.prototype,"layer",null),e([m()],q.prototype,"featureStore",null),e([m()],q.prototype,"updating",null),e([m()],q.prototype,"updatingRemaining",null),e([m()],q.prototype,"suspendInfo",null),e([m()],q.prototype,"legendEnabled",null),e([m()],q.prototype,"filterVisibility",null),e([m()],q.prototype,"displayFeatureLimit",null),e([m()],q.prototype,"preferredUpdatePolicy",void 0),e([m()],q.prototype,"hasZ",null),e([m()],q.prototype,"hasM",null),e([m()],q.prototype,"dataExtent",void 0),e([m()],q.prototype,"view",null),e([m()],q.prototype,"fullOpacity",null),e([m()],q.prototype,"updatePolicy",null),e([m()],q.prototype,"drapeSourceType",void 0),e([m()],q.prototype,"scaleVisibilitySuspended",null),e([m()],q.prototype,"renderer",null),e([m()],q.prototype,"_featureStore",void 0),e([m()],q.prototype,"_filterVisibility",void 0),e([m()],q.prototype,"_overlayRenderer",null),e([m()],q.prototype,"_overlaySpatialReference",null),e([m()],q.prototype,"_rendererParameters",null),e([m()],q.prototype,"_materialParameters",null),e([m()],q.prototype,"_densityParameters",null),e([m()],q.prototype,"_radiusParameter",null),e([m()],q.prototype,"_resolutionForScaleParameter",null),e([m()],q.prototype,"_colorRampParameter",null),e([m()],q.prototype,"_pixelRatioParameter",null),e([m()],q.prototype,"_densityMapPixelRatio",null),e([m()],q.prototype,"_renderGeometries",void 0),e([m()],q.prototype,"_material",void 0),e([m()],q.prototype,"_materialWithField",void 0),e([m()],q.prototype,"_renderView",null),e([m()],q.prototype,"_featuresArePoints",null),e([m()],q.prototype,"_loadedPointGraphics",null),e([m()],q.prototype,"_heatmapRenderer",null),e([m()],q.prototype,"_heatmapRendererFieldName",null),e([m()],q.prototype,"_heatmapRendererField",null),e([m()],q.prototype,"_heatmapRendererFieldIsNumeric",null),e([m()],q.prototype,"_fieldTotal",void 0),e([m()],q.prototype,"_drapeSourceRenderer",void 0),e([m()],q.prototype,"_isScaleRangeActive",null),q=e([h("esri.views.3d.layers.support.HeatmapFeatureProcessor")],q);export{q as HeatmapFeatureProcessor,$ as maxRadiusPt};
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import{isSome as t}from"../../../../core/arrayUtils.js";import{estimateAttributesObjectSize as r,estimateFixedArraySize as i,estimateNumberByteSize as a}from"../../../../core/byteSizeEstimations.js";import{makeHandle as s}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import o from"../../../../core/Logger.js";import{EsriPromise as n}from"../../../../core/Promise.js";import{initial as l,sync as p,watch as d}from"../../../../core/reactiveUtils.js";import{pt2px as u}from"../../../../core/screenUtils.js";import{property as m}from"../../../../core/accessorSupport/decorators/property.js";import{subclass as h}from"../../../../core/accessorSupport/decorators/subclass.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as y}from"../../../../core/support/UpdatingHandles.js";import{projectPointToVector as _}from"../../../../geometry/projection/projectPointToVector.js";import{getContinuousIndexArray as g}from"../../../../geometry/support/Indices.js";import{getResolutionForScale as f}from"../../../../geometry/support/scaleUtils.js";import{getObjectId as R}from"../../../../layers/graphics/dehydratedFeatures.js";import{convertFromPoint as F}from"../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as b}from"../../../../layers/graphics/OptimizedFeature.js";import v from"../../../../layers/graphics/OptimizedGeometry.js";import S from"../../../../layers/graphics/data/FeatureStore.js";import{isNumericField as w}from"../../../../layers/support/fieldUtils.js";import{generateGradient as P}from"../../../../renderers/support/heatmapUtils.js";import{DrapeSourceType as j}from"../interfaces.js";import{DisplayFeatureLimit as T}from"../graphics/DisplayFeatureLimit.js";import{GraphicsCorePerformanceInfo as V}from"../graphics/GraphicsCorePerformanceInfo.js";import{FeatureVisibilityFilter as G}from"./FeatureVisibilityFilter.js";import{drapedZ as x}from"../../terrain/OverlayRenderer.js";import{Attribute as I}from"../../webgl-engine/lib/Attribute.js";import{ContentObjectType as M}from"../../webgl-engine/lib/ContentObjectType.js";import{DrapedHeatmapRenderer as A}from"../../webgl-engine/lib/DrapedHeatmapRenderer.js";import{Geometry as N}from"../../webgl-engine/lib/Geometry.js";import{DirtyOperation as O,DirtyState as H}from"../../webgl-engine/lib/ModelDirtyTypes.js";import{RenderGeometry as U}from"../../webgl-engine/lib/RenderGeometry.js";import{UpdatePolicy as E}from"../../webgl-engine/lib/UpdatePolicy.js";import{VertexAttribute as L}from"../../webgl-engine/lib/VertexAttribute.js";import{HeatmapDensityMaterial as D}from"../../webgl-engine/materials/HeatmapDensityMaterial.js";import{scaleBoundsPredicate as C,isScaleRangeActive as B}from"../../../support/layerViewUtils.js";import{PixelType as W,PixelFormat as Z}from"../../../webgl/enums.js";import{loadHeatmapTextureConfiguration as $,fallBackHeatmapConfiguration as q}from"../../../webgl/heatmapTextureUtils.js";const z=112;let Y=class extends n{constructor(e){super(e),this.type="heatmap",this.preferredUpdatePolicy=E.ASYNC,this.dataExtent=null,this.drapeSourceType=j.Features,this._renderGeometries=new Map,this._fieldTotal=0,this._drapeSourceRenderer=null,this._dataType=W.HALF_FLOAT,this._pixelFormat=Z.RGBA,this._updatingHandles=new y}initialize(){let e;try{e=$(this._renderView.renderingContext,o.getLogger(this))}catch(u){this.addResolvingPromise(Promise.reject(u)),e=q}const{dataType:t,samplingMode:r,pixelFormat:i,internalFormat:a}=e;this._featureStore=new S({geometryType:"esriGeometryPoint",hasZ:this.hasZ,hasM:this.hasM}),this._dataType=t,this._pixelFormat=i;const n=t!==W.FLOAT;this._drapeSourceRenderer=this.view.basemapTerrain.overlayManager.registerDrapeSource(this,A,{...this._rendererParameters,dataType:t,samplingMode:r,pixelFormat:i,internalFormat:a}),this._material=new D({usesHalfFloats:n}),this._materialWithField=new D({usesHalfFloats:n,isAttributeDriven:!0}),this._filterVisibility=new G({context:{configuration:this.owner,featureStore:this.featureStore,getFeatureCount:()=>this._loadedPointGraphics.length,setAllFeaturesVisibility:e=>this._setAllFeaturesVisibility(e),clearFeaturesVisibility:()=>this._setAllFeaturesVisibility(!0),updateFeatureVisibilities:e=>this._updateFeatureVisibilities(e)}}),this._updatingHandles.addOnCollectionChange((()=>this._loadedPointGraphics),(e=>this._onLoadedFeaturesChange(e)),l),this._updatingHandles.addWhen((()=>this._materialParameters),(e=>this._forEachMaterial((t=>t.setParameters(e)))),l),this._updatingHandles.add((()=>this._rendererParameters),(e=>this._drapeSourceRenderer.set(e))),this._updatingHandles.add((()=>this._heatmapRendererField),(()=>{this._recreate()}),p),this._updatingHandles.add((()=>({fieldName:this._heatmapRendererFieldName,numeric:this._heatmapRendererFieldIsNumeric})),(({fieldName:e,numeric:t})=>{if(null!=e&&t){let t=0;this._featureStore.forEach((r=>t+=r.attributes[e]??0)),this._fieldTotal=t}else this._fieldTotal=this._featureStore.numFeatures}),l),this.addHandles([d((()=>({fieldName:this._heatmapRendererFieldName,field:this._heatmapRendererField})),(({fieldName:e,field:t})=>{e&&!t&&o.getLogger(this).warn(`Heatmap renderer field '${e}' for layer '${this.layer.title??this.layer.id}' not found`)})),d((()=>({field:this._heatmapRendererField,numeric:this._heatmapRendererFieldIsNumeric})),(({field:e,numeric:t})=>{null==e||t||o.getLogger(this).warn(`Heatmap renderer field '${e.name}' for layer '${this.layer.title??this.layer.id}' does not contain numeric values and cannot be used to drive the heatmap density`)})),s((()=>this.view.basemapTerrain.overlayManager.unregisterDrapeSource(this)))])}destroy(){this._renderGeometries.clear(),this._material=null,this._materialWithField=null,this._featureStore.clear(),this._featureStore=null,this._updatingHandles.destroy()}get layer(){return this.owner.layer}get featureStore(){return this._featureStore}get updating(){return this._updatingHandles.updating||this.filterVisibility.updating}get updatingRemaining(){return 0}get suspendInfo(){return{}}get legendEnabled(){return!0}get filterVisibility(){return this._filterVisibility}get displayFeatureLimit(){const e=this.owner?.view?.quality??1,t=this.owner?.view?.qualitySettings,r=t?Math.ceil(t.heatmap.maxTotalNumberOfFeatures*e):0;return new T(r*6,r)}get hasZ(){return"hasZ"in this.layer&&this.layer.hasZ}get hasM(){return"hasM"in this.layer&&this.layer.hasM}get view(){return this.owner.view}get fullOpacity(){return this.owner.fullOpacity}get updatePolicy(){return this.owner.updatePolicy}get scaleVisibilitySuspended(){if(!this._isScaleRangeActive)return!1;const{minScale:e,maxScale:t}=this.layer.effectiveScaleRange,{scale:r}=this.view;return!C(r,e??0,t??0)}get usedMemory(){const e=this.usedMemoryPerFeature*this._featureStore.numFeatures,t=this._pixelFormat===Z.RED?1:4,r=this._dataType===W.FLOAT?4:2,i=Math.ceil((this._overlayRenderer?.overlays[0]?.resolution??0)*this._densityMapPixelRatio)??0;return i*i*t*r+e}get usedMemoryPerFeature(){const e=this._loadedPointGraphics.find((()=>!0));if(null==e)return 0;const t=r(e),s=a(),o=6;return o*i([0,0,0],s)+o*i([0,0],s)+(this._heatmapRendererFieldIsNumeric?o*s:0)+t}get loadedFeatures(){return this._featureStore.numFeatures}get unprocessedMemoryEstimate(){return 0}get performanceInfo(){return new V(this._visibleFeatures,0,0)}get renderer(){return this._heatmapRenderer}get _overlayRenderer(){return this.view.basemapTerrain.overlayManager.renderer}get _overlaySpatialReference(){return this._overlayRenderer.spatialReference}get _rendererParameters(){return{...this._radiusParameter,...this._densityParameters,...this._colorRampParameter,...this._pixelRatioParameter}}get _materialParameters(){return{...this._radiusParameter,...this._resolutionForScaleParameter}}get _densityParameters(){const e=this._heatmapRenderer;if(null==e)return null;const{minDensity:t,maxDensity:r}=e;return{minDensity:t,maxDensity:r,fieldTotal:this._fieldTotal}}get _radiusParameter(){const e=this._heatmapRenderer;return e?{searchRadius:u(this._clampSearchRadius(e.radius))}:null}get _resolutionForScaleParameter(){const e=this._heatmapRenderer;if(!e)return null;const{referenceScale:t}=e;return{resolutionForScale:0===t?0:f(t,this.view.spatialReference)}}get _colorRampParameter(){const e=this._heatmapRenderer;return e?{colorRampData:P(e.colorStops)}:null}get _pixelRatioParameter(){return{pixelRatio:this._densityMapPixelRatio}}get _densityMapPixelRatio(){return this.owner?.view?.qualitySettings.heatmap.pixelRatio??1}get _renderView(){return this.view._stage.renderView}get _featuresArePoints(){return"point"===this.layer.geometryType}get _loadedPointGraphics(){return this.owner.loadedGraphics}get _heatmapRenderer(){const e=this.layer.renderer;return"heatmap"===e?.type?e:null}get _heatmapRendererFieldName(){return this._heatmapRenderer?.field}get _heatmapRendererField(){const e=this._heatmapRendererFieldName;return null!=e?this.layer.fieldsIndex.get(e):null}get _heatmapRendererFieldIsNumeric(){const e=this._heatmapRendererField;return null!=e&&w(e)}get _isScaleRangeActive(){const{layer:e}=this;if(!("effectiveScaleRange"in e))return!1;const{minScale:t,maxScale:r}=e.effectiveScaleRange;return B(t,r)}get _visibleFeatures(){let e=0;return this._renderGeometries.forEach((t=>{t.visible&&++e})),e}async whenGraphicBounds(){return null}computeAttachmentOrigin(){return null}highlight(){return s()}maskOccludee(){return s()}setObjectIdVisibility(){}refreshFilter(){this.filterVisibility.reapply()}_onLoadedFeaturesChange(e){if(!this._featuresArePoints)return;const{objectIdField:r}=this.layer;this._featureStore.removeManyById(e.removed.map((e=>R(e,r)))),this._featureStore.addMany(e.added.map((e=>{const{attributes:t,centroid:i,geometry:a}=e,s=new b(F(new v,a),t,i?F(new v,i):null,R(e,r));return s.displayId=e.uid,s})));const i=e.added,a=e.removed;this._fieldTotal+=this._computeFieldTotalChange(i,a);const s=a.map((({uid:e})=>{const t=this._renderGeometries.get(e);return this._renderGeometries.delete(e),t})).filter(t),o=i.map((e=>{const t=this._pointGraphicToRenderGeometry(e);return this._renderGeometries.set(e.uid,t),t}));s.length>0&&this._drapeSourceRenderer.removeGeometries(s,O.REMOVE),o.length>0&&this._drapeSourceRenderer.addGeometries(o,O.ADD),(o.length>0||s.length>0)&&(this.filterVisibility.reapply(),this._renderView.requestRender())}_recreate(){if(!this._loadedPointGraphics)return;const e=this._loadedPointGraphics.toArray();this._onLoadedFeaturesChange({added:e,removed:e})}_pointGraphicToRenderGeometry(e){const t=this._heatmapRendererFieldName,r=null!=t?this._materialWithField:this._material,i=c();_(e.geometry,i,this._overlaySpatialReference),i[2]=x;const a=g(1),s=[[L.POSITION,new I(i,a,i.length)]],o=this._heatmapRendererFieldIsNumeric;null!=t&&s.push([L.FEATUREATTRIBUTE,new I([o?e.attributes[t]??0:0],a,1)]);const n=new U(new N(r,s,null,M.Point),{layerUid:this.layer.uid,graphicUid:e.uid});return n.visible=this.filterVisibility.defaultVisibility,n}_forEachMaterial(e){e(this._material),e(this._materialWithField)}_computeFieldTotalChange(e,t){if(null==this._heatmapRendererFieldName||!this._heatmapRendererFieldIsNumeric)return e.length-t.length;const r=this._heatmapRendererFieldName,i=(e,t)=>e+(t.attributes[r]??0);return e.reduce(i,0)-t.reduce(i,0)}_clampSearchRadius(e){return e>z&&o.getLogger(this).warnOnce(`SceneView supports a maximum radius of ${z} pt for HeatmapRenderer.`),Math.min(e,z)}_updateFeatureVisibilities(e){const t=[];this._featureStore.forEach((({objectId:r,displayId:i})=>{const a=e(r),s=this._renderGeometries.get(i);s&&s.visible!==a&&(t.push(s),s.visible=a)})),this._drapeSourceRenderer.modifyGeometries(t,H.VISIBILITY)}_setAllFeaturesVisibility(e){const t=[];for(const r of this._renderGeometries.values())r.visible!==e&&(t.push(r),r.visible=e);this._drapeSourceRenderer.modifyGeometries(t,H.VISIBILITY)}get test(){}};e([m()],Y.prototype,"type",void 0),e([m({constructOnly:!0})],Y.prototype,"owner",void 0),e([m()],Y.prototype,"layer",null),e([m()],Y.prototype,"featureStore",null),e([m()],Y.prototype,"updating",null),e([m()],Y.prototype,"updatingRemaining",null),e([m()],Y.prototype,"suspendInfo",null),e([m()],Y.prototype,"legendEnabled",null),e([m()],Y.prototype,"filterVisibility",null),e([m()],Y.prototype,"displayFeatureLimit",null),e([m()],Y.prototype,"preferredUpdatePolicy",void 0),e([m()],Y.prototype,"hasZ",null),e([m()],Y.prototype,"hasM",null),e([m()],Y.prototype,"dataExtent",void 0),e([m()],Y.prototype,"view",null),e([m()],Y.prototype,"fullOpacity",null),e([m()],Y.prototype,"updatePolicy",null),e([m()],Y.prototype,"drapeSourceType",void 0),e([m()],Y.prototype,"scaleVisibilitySuspended",null),e([m()],Y.prototype,"renderer",null),e([m()],Y.prototype,"_featureStore",void 0),e([m()],Y.prototype,"_filterVisibility",void 0),e([m()],Y.prototype,"_overlayRenderer",null),e([m()],Y.prototype,"_overlaySpatialReference",null),e([m()],Y.prototype,"_rendererParameters",null),e([m()],Y.prototype,"_materialParameters",null),e([m()],Y.prototype,"_densityParameters",null),e([m()],Y.prototype,"_radiusParameter",null),e([m()],Y.prototype,"_resolutionForScaleParameter",null),e([m()],Y.prototype,"_colorRampParameter",null),e([m()],Y.prototype,"_pixelRatioParameter",null),e([m()],Y.prototype,"_densityMapPixelRatio",null),e([m()],Y.prototype,"_renderGeometries",void 0),e([m()],Y.prototype,"_material",void 0),e([m()],Y.prototype,"_materialWithField",void 0),e([m()],Y.prototype,"_renderView",null),e([m()],Y.prototype,"_featuresArePoints",null),e([m()],Y.prototype,"_loadedPointGraphics",null),e([m()],Y.prototype,"_heatmapRenderer",null),e([m()],Y.prototype,"_heatmapRendererFieldName",null),e([m()],Y.prototype,"_heatmapRendererField",null),e([m()],Y.prototype,"_heatmapRendererFieldIsNumeric",null),e([m()],Y.prototype,"_fieldTotal",void 0),e([m()],Y.prototype,"_drapeSourceRenderer",void 0),e([m()],Y.prototype,"_isScaleRangeActive",null),Y=e([h("esri.views.3d.layers.support.HeatmapFeatureProcessor")],Y);export{Y as HeatmapFeatureProcessor,z as maxRadiusPt};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{project as e}from"../../../../geometry/support/webMercatorUtils.js";import{projectGeometry as
|
|
5
|
+
import{project as e}from"../../../../geometry/support/webMercatorUtils.js";import{projectGeometry as t}from"../../../../portal/support/geometryServiceUtils.js";async function r(r){const l=r.view.spatialReference,n=r.layer.fullExtent,o=null!=n&&n.spatialReference;if(null==n||!o)return null;if(o.equals(l))return n.clone();const u=e(n,l);if(null!=u)return u;if(r.view.state.isLocal)try{const e=await t(n,l,r.layer.portalItem);return r.destroyed||null==e?null:e}catch{return null}return null}export{r as toViewIfLocal};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Evented.js";import"../../../core/has.js";import{someMap as t}from"../../../core/MapUtils.js";import{releaseMaybe as s,disposeMaybe as i,destroyMaybe as a}from"../../../core/maybe.js";import o from"../../../core/PooledArray.js";import{watch as n,syncAndInitial as h,on as d}from"../../../core/reactiveUtils.js";import{someSet as l}from"../../../core/SetUtils.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import{ortho as p,fromTranslation as m}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{s as _}from"../../../chunks/vec32.js";import{fromValues as g}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ViewingMode as y}from"../../ViewingMode.js";import{DrapeTargetType as f,DrapeSourceType as R,DrapedRenderGroup as T}from"../layers/interfaces.js";import{debugFlags as b}from"../support/debugFlags.js";import{OverlayIndex as w}from"./interfaces.js";import{Overlay as x}from"./Overlay.js";import{OverlayContent as v}from"./OverlayContent.js";import{OverlayRenderTargets as D}from"./OverlayRenderTargets.js";import S from"../webgl/RenderCamera.js";import{ShaderOutput as C}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{OverlayMode as P}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{T as O}from"../../../chunks/TextureOnly.glsl.js";import{ShaderTechniqueRepository as j}from"../webgl-engine/core/shaderTechnique/ShaderTechniqueRepository.js";import{SyncRenderPlugin as E}from"../webgl-engine/effects/RenderPlugin.js";import{GLMaterialRepository as W}from"../webgl-engine/lib/GLMaterialRepository.js";import{GridLocalOriginFactory as M}from"../webgl-engine/lib/GridLocalOriginFactory.js";import{RenderOccludedFlag as A}from"../webgl-engine/lib/Material.js";import{OverlayRenderContext as q,defaultRenderOccludedMask as I}from"../webgl-engine/lib/RenderContext.js";import{RenderSlot as F}from"../webgl-engine/lib/RenderSlot.js";import{ShadowMap as L}from"../webgl-engine/lib/ShadowMap.js";import{SortedRenderGeometryRenderer as V}from"../webgl-engine/lib/SortedRenderGeometryRenderer.js";import{TextureTechnique as N}from"../webgl-engine/lib/TextureTechnique.js";import{TextureTechniqueConfiguration as U}from"../webgl-engine/lib/TextureTechniqueConfiguration.js";import{TransparencyPassType as k}from"../webgl-engine/lib/TransparencyPassType.js";import{Update as H}from"../webgl-engine/lib/Update.js";import{UpdatePolicy as G}from"../webgl-engine/lib/UpdatePolicy.js";import{AmbientLight as B}from"../webgl-engine/lighting/Lightsources.js";import{O as z}from"../../../chunks/OverlayCompositing.glsl.js";import{OverlayCompositingTechnique as Y}from"../webgl-engine/shaders/OverlayCompositingTechnique.js";import{TaskPriority as X,noBudget as J}from"../../support/Scheduler.js";import{ClearBufferBit as K,TextureSamplingMode as Q}from"../../webgl/enums.js";import{Texture as Z}from"../../webgl/Texture.js";import{TextureDescriptor as $}from"../../webgl/TextureDescriptor.js";let ee=class extends E{constructor(e){super(e),this._overlays=null,this._renderTargets=null,this._overlayParameters=new z,this.hasHighlights=!1,this._hasWater=!1,this._renderers=new Map,this._sortedDrapeSourceRenderersDirty=!1,this._sortedRenderers=new o,this._passParameters=new O,this._materials=null,this._screenToWorldRatio=1,this._localOriginFactory=null,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._camera=new S,this.worldToPCSRatio=1,this.events=new r,this.longitudeCyclical=null,this.produces=new Map([[F.DRAPED_MATERIAL,e=>e!==C.Highlight||this.hasHighlights],[F.DRAPED_WATER,()=>this._hasWater]]),this._hasTargetWithoutRasterImage=!1,this._hasDrapedFeatureSource=!1,this._hasDrapedRasterSource=!1}initialize(){const e=this.view._stage.renderer.fboCache,r=this.view._stage.renderView,{waterTextures:t,stippleTextures:s,markerTextures:i}=r;this._techniques=new j({rctx:this._rctx,viewingMode:y.Local,stippleTextures:s,markerTextures:i,waterTextures:t}),this._renderContext=new q(this._rctx,new L(e,this.view.state.viewingMode),null),this.addHandles([n((()=>t.updating),(()=>this.events.emit("content-changed")),h),n((()=>this.spatialReference),(e=>this._localOriginFactory=new M(e)),h),d((()=>this.view.allLayerViews),"after-changes",(()=>this._sortedDrapeSourceRenderersDirty=!0))]),this._materials=new W(r.textures,this._techniques,(()=>{this.notifyChange("rendersOccludedDraped"),this.events.emit("content-changed"),this.notifyChange("updating"),this.notifyChange("isEmpty")}),(()=>this.events.emit("content-changed"))),this._bindParameters.slot=F.DRAPED_MATERIAL,this._bindParameters.mainDepth=null,this._camera.near=1,this._camera.far=1e4,this._camera.relativeElevation=null,this._bindParameters.camera=this._camera,this._bindParameters.transparencyPassType=k.NONE,this._bindParameters.updateLighting([new B(g(1,1,1))],0,0,H.Immediate),this.addHandles(this.view.resourceController.scheduler.registerTask(X.STAGE,this))}destroy(){this._renderers.forEach((e=>e.destroy())),this._renderers.clear(),this._debugTextureTechnique=s(this._debugTextureTechnique),this._passParameters.texture=i(this._passParameters.texture),this._techniques=a(this._techniques),this.disposeOverlays()}get _bindParameters(){return this._renderContext.bindParameters}get _rctx(){return this.view._stage.renderView.renderingContext}get rctx(){return this._rctx}get materials(){return this._materials}get screenToWorldRatio(){return this._screenToWorldRatio}get localOriginFactory(){return this._localOriginFactory}initializeRenderContext(e){this.pluginContext=e}uninitializeRenderContext(){}renderNode(){}get updating(){return this._sortedDrapeSourceRenderersDirty||t(this._renderers,(e=>e.updating))}get hasOverlays(){return null!=this._overlays&&null!=this._renderTargets}getMaterialRenderer(e){for(const r of this._renderers.values()){const t=r.getMaterialRenderer(e);if(t)return t}return null}get layers(){return this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers(),this._sortedRenderers.map((e=>e.drapeSource.layer)).filter((e=>!!e))}createGeometryDrapeSourceRenderer(e){return this.createDrapeSourceRenderer(e,V)}createDrapeSourceRenderer(e,r,t){const s=this._renderers.get(e);null!=s&&s.destroy();const i=new r({...t,rendererContext:this,drapeSource:e});return this._renderers.set(e,i),this._sortedDrapeSourceRenderersDirty=!0,"fullOpacity"in e&&this.addHandles(n((()=>e.fullOpacity),(()=>this.events.emit("content-changed"))),e),i}removeDrapeSourceRenderer(e){if(null==e)return;const r=this._renderers.get(e);null!=r&&(this._sortedDrapeSourceRenderersDirty=!0,this._renderers.delete(e),this.removeHandles(e),r.destroy())}computeValidity(){return this._renderTargets?.computeValidity()??0}releaseRenderTargets(){this._renderTargets?.dispose()}get overlays(){return this._overlays??[]}ensureDrapeTargets(e){this._hasTargetWithoutRasterImage=!!this._overlays&&l(e,(e=>e.drapeTargetType===f.WithoutRasterImage))}ensureDrapeSources(e){this._overlays?(this._hasDrapedFeatureSource=l(e,(e=>e.drapeSourceType===R.Features)),this._hasDrapedRasterSource=l(e,(e=>e.drapeSourceType===R.RasterImage))):this._hasDrapedFeatureSource=this._hasDrapedRasterSource=!1}get _needsColorWithoutRasterImage(){return this._hasDrapedRasterSource&&this._hasDrapedFeatureSource&&this._hasTargetWithoutRasterImage}ensureOverlays(e,r,t=this._bindParameters.overlayStretch){null==this._overlays&&(this._renderTargets=new D(this.view._stage.renderer.fboCache),this._overlays=[new x,new x]),this.ensureDrapeTargets(e),this.ensureDrapeSources(r),this._bindParameters.overlayStretch=t}disposeOverlays(){this._overlays=null,this._renderTargets=i(this._renderTargets),this.events.emit("textures-disposed")}getTexture(e){if(null!=e)return e===v.ColorNoRasterImage&&!this._needsColorWithoutRasterImage&&this._hasDrapedFeatureSource?this._renderTargets?.getTexture(v.Color):this._renderTargets?.getTexture(e)}get running(){return this.updating}runTask(e){this._processDrapeSources(e,(()=>!0))}_processDrapeSources(e,r){let s=!1;for(const[t,i]of this._renderers){if(e.done)break;(t.destroyed||r(t))&&(i.commitChanges()&&(s=!0,e.madeProgress()))}this._sortedDrapeSourceRenderersDirty&&(this._sortedDrapeSourceRenderersDirty=!1,s=!0,this._updateSortedDrapeSourceRenderers()),s&&(null!=this._overlays&&0===this._renderers.size&&this.disposeOverlays(),this.notifyChange("updating"),this.notifyChange("isEmpty"),this.events.emit("content-changed"),this.hasHighlights=t(this._renderers,(e=>e.hasHighlights)),this.notifyChange("rendersOccludedDraped"),this._updateHasWater())}processSyncDrapeSources(){this._processDrapeSources(J,(e=>e.updatePolicy===G.SYNC))}get isEmpty(){return!b.OVERLAY_DRAW_DEBUG_TEXTURE&&!t(this._renderers,(e=>!e.isEmpty))}get hasWater(){return this._hasWater}get rendersOccludedDraped(){const e=this._renderContext.renderOccludedMask;this._renderContext.renderOccludedMask=ie;const r=this._sortedRenderers.some((({renderer:e})=>e.shouldRender(this._renderContext)));return this._renderContext.renderOccludedMask=e,r}renders(e){return b.OVERLAY_DRAW_DEBUG_TEXTURE&&e!==v.Occluded||this._sortedRenderers.some((({renderer:e})=>e.shouldRender(this._renderContext)))}get mode(){return this.isEmpty?P.Disabled:this._renderTargets?.getTexture(v.WaterNormal)?P.EnabledWithWater:this._renderTargets?.getTexture(v.Color)?P.Enabled:P.Disabled}updateAnimation(e){let r=!1;return this._renderers.forEach((t=>r=t.updateAnimation(e)||r)),r}updateDrapeSourceOrder(){this._sortedDrapeSourceRenderersDirty=!0}drawOverlays(e){if(this._overlays&&this._renderTargets){for(const e of this._overlays)this.longitudeCyclical?e.setupGeometryViewsCyclical(this.longitudeCyclical):e.setupGeometryViewsDirect();for(const r of this._renderTargets.targets){if(r.content===v.ColorNoRasterImage&&!this._needsColorWithoutRasterImage)continue;const t=this._drawTarget(w.INNER,r,e),s=this._drawTarget(w.OUTER,r,e);(t||s)&&r.fbo.generateMipMap()}}}_drawTarget(e,r,t){const s=this._overlays[e],i=s.canvasGeometries;if(0===i.numViews)return!1;const{alignPixelEnabled:a,contentPixelRatio:o}=t;this._screenToWorldRatio=o*s.mapUnitsPerPixel/this._bindParameters.overlayStretch;const n=r.output;if(this.isEmpty||n===C.Highlight&&!this.hasHighlights||n===C.Normal&&!this.hasWater||!s.hasSomeSizedView())return!1;const h=this._rctx;if(this._camera.pixelRatio=s.pixelRatio*o,this._renderContext.output=n,this._bindParameters.alignPixelEnabled=a,this._bindParameters.screenToWorldRatio=this._screenToWorldRatio,this._bindParameters.screenToPCSRatio=this._screenToWorldRatio*this.worldToPCSRatio,this._bindParameters.slot=n===C.Normal?F.DRAPED_WATER:F.DRAPED_MATERIAL,r.content===v.Occluded&&(this._renderContext.renderOccludedMask=ie),!this.renders(r.content))return this._renderContext.renderOccludedMask=I,!1;const d=s.resolution;this._rctx.setViewport(e===w.INNER?0:d,0,d,d);const l=2*s.resolution,c=s.resolution,u=r.fbo;u.bind(h,l,c),e===w.INNER&&(h.setClearColor(0,0,0,0),h.clear(K.COLOR_BUFFER_BIT));if(b.OVERLAY_DRAW_DEBUG_TEXTURE&&r.content!==v.Occluded)for(let p=0;p<i.numViews;p++)this._setViewParameters(i.extents[p],s),this._ensureDebugPatternResources(s.resolution,te[e]),this._rctx.bindTechnique(this._debugTextureTechnique,this._renderContext.bindParameters,this._passParameters),this._rctx.screen.draw();return this._sortedRenderers.forAll((({drapeSource:t,renderer:a})=>{if(r.content===v.ColorNoRasterImage&&t.drapeSourceType===R.RasterImage)return;const{fullOpacity:o}=t,d=null!=o&&o<1&&n===C.Color?this.bindTemporaryFramebuffer(l,c):null;for(let e=0;e<i.numViews;e++)this._setViewParameters(i.extents[e],s),a.render(this._renderContext);if(d){u.bind(h,l,c),this._overlayParameters.texture=d.getTexture(),this._overlayParameters.opacity=o,this._overlayParameters.overlayIndex=e;const r=this.pluginContext.techniques.acquire(Y);this._rctx.bindTechnique(r,this._renderContext.bindParameters,this._overlayParameters),this._rctx.screen.draw(),r.release(),d.release()}})),h.bindFramebuffer(null),this._renderContext.renderOccludedMask=I,!0}bindTemporaryFramebuffer(e,r){const t=this.view._stage.renderer.fboCache,s=t.acquire(e,r,"overlay tmp");return t.rctx.unbindTexture(s.fbo?.colorTexture),t.rctx.bindFramebuffer(s.fbo),t.rctx.clear(K.COLOR_BUFFER_BIT),s}async reloadShaders(){await this._techniques.reloadAll()}notifyContentChanged(){this.events.emit("content-changed")}intersect(e,r,t,s){this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers();let i=0;for(const{renderer:a}of this._sortedRenderers)i=a.intersect?.(e,r,t,s,i)??i}_updateSortedDrapeSourceRenderers(){if(this._sortedRenderers.clear(),0===this._renderers.size)return;const e=this.view.map.allLayers,r=e.length;this._renderers.forEach(((t,s)=>{const i=e.indexOf(s.layer),a=i>=0,o=s.renderGroup??(a?T.MapLayer:T.ViewLayer),n=r*o+(a?i:0);this._sortedRenderers.push(new re(s,t,n))})),this._sortedRenderers.sort(((e,r)=>e.index-r.index))}_setViewParameters(e,r){const t=this._camera;t.viewport=[0,0,r.resolution,r.resolution],p(t.projectionMatrix,0,e[2]-e[0],0,e[3]-e[1],t.near,t.far),m(t.viewMatrix,[-e[0],-e[1],0])}_updateHasWater(){const e=t(this._renderers,(e=>e.hasWater));e!==this._hasWater&&(this._hasWater=e,this.events.emit("has-water",e))}_ensureDebugPatternResources(e,r){if(_(this._passParameters.color,r[0],r[1],r[2]),this._passParameters.texture)return;const t=new Uint8Array(e*e*4);let s=0;for(let o=0;o<e;o++)for(let r=0;r<e;r++){const i=Math.floor(r/10),a=Math.floor(o/10);i<2||a<2||10*i>e-20||10*a>e-20?(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=255):(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=1&i&&1&a?1&r^1&o?0:255:1&i^1&a?0:128)}const i=new $(e);i.samplingMode=Q.NEAREST,this._passParameters.texture=new Z(this._rctx,i,t);const a=new U;a.hasAlpha=!0,this._debugTextureTechnique=this._techniques.acquire(N,a)}get test(){}};e([c()],ee.prototype,"hasHighlights",void 0),e([c()],ee.prototype,"_sortedDrapeSourceRenderersDirty",void 0),e([c()],ee.prototype,"_techniques",void 0),e([c({constructOnly:!0})],ee.prototype,"view",void 0),e([c()],ee.prototype,"worldToPCSRatio",void 0),e([c()],ee.prototype,"spatialReference",void 0),e([c({type:Boolean,readOnly:!0})],ee.prototype,"updating",null),e([c()],ee.prototype,"isEmpty",null),e([c({readOnly:!0})],ee.prototype,"rendersOccludedDraped",null),ee=e([u("esri.views.3d.terrain.OverlayRenderer")],ee);class re{constructor(e,r,t){this.drapeSource=e,this.renderer=r,this.index=t}}const te=[[1,.5,.5],[.5,.5,1]],se=-2,ie=A.OccludeAndTransparent;export{ee as OverlayRenderer,se as drapedZ,ie as overlayRenderOccludedFlag};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Evented.js";import"../../../core/has.js";import{someMap as t}from"../../../core/MapUtils.js";import{releaseMaybe as s,disposeMaybe as i,destroyMaybe as a}from"../../../core/maybe.js";import o from"../../../core/PooledArray.js";import{watch as n,syncAndInitial as h,on as d}from"../../../core/reactiveUtils.js";import{someSet as l}from"../../../core/SetUtils.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import{ortho as p,fromTranslation as m}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{s as _}from"../../../chunks/vec32.js";import{fromValues as g}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ViewingMode as y}from"../../ViewingMode.js";import{DrapeTargetType as f,DrapeSourceType as R,DrapedRenderGroup as T}from"../layers/interfaces.js";import{debugFlags as b}from"../support/debugFlags.js";import{OverlayIndex as w}from"./interfaces.js";import{Overlay as x}from"./Overlay.js";import{OverlayContent as v}from"./OverlayContent.js";import{OverlayRenderTargets as D}from"./OverlayRenderTargets.js";import S from"../webgl/RenderCamera.js";import{ShaderOutput as C}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{OverlayMode as P}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{T as O}from"../../../chunks/TextureOnly.glsl.js";import{ShaderTechniqueRepository as j}from"../webgl-engine/core/shaderTechnique/ShaderTechniqueRepository.js";import{SyncRenderPlugin as E}from"../webgl-engine/effects/RenderPlugin.js";import{GLMaterialRepository as W}from"../webgl-engine/lib/GLMaterialRepository.js";import{GridLocalOriginFactory as M}from"../webgl-engine/lib/GridLocalOriginFactory.js";import{RenderOccludedFlag as A}from"../webgl-engine/lib/Material.js";import{OverlayRenderContext as q,defaultRenderOccludedMask as L}from"../webgl-engine/lib/RenderContext.js";import{RenderSlot as I}from"../webgl-engine/lib/RenderSlot.js";import{ShadowMap as V}from"../webgl-engine/lib/ShadowMap.js";import{SortedRenderGeometryRenderer as F}from"../webgl-engine/lib/SortedRenderGeometryRenderer.js";import{TextureTechnique as N}from"../webgl-engine/lib/TextureTechnique.js";import{TextureTechniqueConfiguration as k}from"../webgl-engine/lib/TextureTechniqueConfiguration.js";import{TransparencyPassType as H}from"../webgl-engine/lib/TransparencyPassType.js";import{Update as U}from"../webgl-engine/lib/Update.js";import{UpdatePolicy as G}from"../webgl-engine/lib/UpdatePolicy.js";import{AmbientLight as z}from"../webgl-engine/lighting/Lightsources.js";import{O as B}from"../../../chunks/OverlayCompositing.glsl.js";import{OverlayCompositingTechnique as Y}from"../webgl-engine/shaders/OverlayCompositingTechnique.js";import{TaskPriority as X,noBudget as J}from"../../support/Scheduler.js";import{FramebufferBit as K,TextureSamplingMode as Q}from"../../webgl/enums.js";import{Texture as Z}from"../../webgl/Texture.js";import{TextureDescriptor as $}from"../../webgl/TextureDescriptor.js";let ee=class extends E{constructor(e){super(e),this._overlays=null,this._renderTargets=null,this._overlayParameters=new B,this.hasHighlights=!1,this._hasWater=!1,this._renderers=new Map,this._sortedDrapeSourceRenderersDirty=!1,this._sortedRenderers=new o,this._passParameters=new O,this._materials=null,this._screenToWorldRatio=1,this._localOriginFactory=null,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._camera=new S,this.worldToPCSRatio=1,this.events=new r,this.longitudeCyclical=null,this.produces=new Map([[I.DRAPED_MATERIAL,e=>e!==C.Highlight||this.hasHighlights],[I.DRAPED_WATER,()=>this._hasWater]]),this._hasTargetWithoutRasterImage=!1,this._hasDrapedFeatureSource=!1,this._hasDrapedRasterSource=!1}initialize(){const e=this.view._stage.renderer.fboCache,r=this.view._stage.renderView,{waterTextures:t,stippleTextures:s,markerTextures:i}=r;this._techniques=new j({rctx:this._rctx,viewingMode:y.Local,stippleTextures:s,markerTextures:i,waterTextures:t}),this._renderContext=new q(this._rctx,new V(e,this.view.state.viewingMode),null),this.addHandles([n((()=>t.updating),(()=>this.events.emit("content-changed")),h),n((()=>this.spatialReference),(e=>this._localOriginFactory=new M(e)),h),d((()=>this.view.allLayerViews),"after-changes",(()=>this._sortedDrapeSourceRenderersDirty=!0))]),this._materials=new W(r.textures,this._techniques,(()=>{this.notifyChange("rendersOccludedDraped"),this.events.emit("content-changed"),this.notifyChange("updating"),this.notifyChange("isEmpty")}),(()=>this.events.emit("content-changed"))),this._bindParameters.slot=I.DRAPED_MATERIAL,this._bindParameters.mainDepth=null,this._camera.near=1,this._camera.far=1e4,this._camera.relativeElevation=null,this._bindParameters.camera=this._camera,this._bindParameters.transparencyPassType=H.NONE,this._bindParameters.updateLighting([new z(g(1,1,1))],0,0,U.Immediate),this.addHandles(this.view.resourceController.scheduler.registerTask(X.STAGE,this))}destroy(){this._renderers.forEach((e=>e.destroy())),this._renderers.clear(),this._debugTextureTechnique=s(this._debugTextureTechnique),this._passParameters.texture=i(this._passParameters.texture),this._techniques=a(this._techniques),this.disposeOverlays()}get _bindParameters(){return this._renderContext.bindParameters}get _rctx(){return this.view._stage.renderView.renderingContext}get rctx(){return this._rctx}get materials(){return this._materials}get screenToWorldRatio(){return this._screenToWorldRatio}get localOriginFactory(){return this._localOriginFactory}initializeRenderContext(e){this.pluginContext=e}uninitializeRenderContext(){}renderNode(){}get updating(){return this._sortedDrapeSourceRenderersDirty||t(this._renderers,(e=>e.updating))}get hasOverlays(){return null!=this._overlays&&null!=this._renderTargets}getMaterialRenderer(e){for(const r of this._renderers.values()){const t=r.getMaterialRenderer(e);if(t)return t}return null}get layers(){return this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers(),this._sortedRenderers.map((e=>e.drapeSource.layer)).filter((e=>!!e))}createGeometryDrapeSourceRenderer(e){return this.createDrapeSourceRenderer(e,F)}createDrapeSourceRenderer(e,r,t){const s=this._renderers.get(e);null!=s&&s.destroy();const i=new r({...t,rendererContext:this,drapeSource:e});return this._renderers.set(e,i),this._sortedDrapeSourceRenderersDirty=!0,"fullOpacity"in e&&this.addHandles(n((()=>e.fullOpacity),(()=>this.events.emit("content-changed"))),e),i}removeDrapeSourceRenderer(e){if(null==e)return;const r=this._renderers.get(e);null!=r&&(this._sortedDrapeSourceRenderersDirty=!0,this._renderers.delete(e),this.removeHandles(e),r.destroy())}computeValidity(){return this._renderTargets?.computeValidity()??0}releaseRenderTargets(){this._renderTargets?.dispose()}get overlays(){return this._overlays??[]}ensureDrapeTargets(e){this._hasTargetWithoutRasterImage=!!this._overlays&&l(e,(e=>e.drapeTargetType===f.WithoutRasterImage))}ensureDrapeSources(e){this._overlays?(this._hasDrapedFeatureSource=l(e,(e=>e.drapeSourceType===R.Features)),this._hasDrapedRasterSource=l(e,(e=>e.drapeSourceType===R.RasterImage))):this._hasDrapedFeatureSource=this._hasDrapedRasterSource=!1}get _needsColorWithoutRasterImage(){return this._hasDrapedRasterSource&&this._hasDrapedFeatureSource&&this._hasTargetWithoutRasterImage}ensureOverlays(e,r,t=this._bindParameters.overlayStretch){null==this._overlays&&(this._renderTargets=new D(this.view._stage.renderer.fboCache),this._overlays=[new x,new x]),this.ensureDrapeTargets(e),this.ensureDrapeSources(r),this._bindParameters.overlayStretch=t}disposeOverlays(){this._overlays=null,this._renderTargets=i(this._renderTargets),this.events.emit("textures-disposed")}getTexture(e){if(null!=e)return e===v.ColorNoRasterImage&&!this._needsColorWithoutRasterImage&&this._hasDrapedFeatureSource?this._renderTargets?.getTexture(v.Color):this._renderTargets?.getTexture(e)}get running(){return this.updating}runTask(e){this._processDrapeSources(e,(()=>!0))}_processDrapeSources(e,r){let s=!1;for(const[t,i]of this._renderers){if(e.done)break;(t.destroyed||r(t))&&(i.commitChanges()&&(s=!0,e.madeProgress()))}this._sortedDrapeSourceRenderersDirty&&(this._sortedDrapeSourceRenderersDirty=!1,s=!0,this._updateSortedDrapeSourceRenderers()),s&&(null!=this._overlays&&0===this._renderers.size&&this.disposeOverlays(),this.notifyChange("updating"),this.notifyChange("isEmpty"),this.events.emit("content-changed"),this.hasHighlights=t(this._renderers,(e=>e.hasHighlights)),this.notifyChange("rendersOccludedDraped"),this._updateHasWater())}processSyncDrapeSources(){this._processDrapeSources(J,(e=>e.updatePolicy===G.SYNC))}get isEmpty(){return!b.OVERLAY_DRAW_DEBUG_TEXTURE&&!t(this._renderers,(e=>!e.isEmpty))}get hasWater(){return this._hasWater}get rendersOccludedDraped(){const e=this._renderContext.renderOccludedMask;this._renderContext.renderOccludedMask=ie;const r=this._sortedRenderers.some((({renderer:e})=>e.shouldRender(this._renderContext)));return this._renderContext.renderOccludedMask=e,r}renders(e){return b.OVERLAY_DRAW_DEBUG_TEXTURE&&e!==v.Occluded||this._sortedRenderers.some((({renderer:e})=>e.shouldRender(this._renderContext)))}get mode(){return this.isEmpty?P.Disabled:this._renderTargets?.getTexture(v.WaterNormal)?P.EnabledWithWater:this._renderTargets?.getTexture(v.Color)?P.Enabled:P.Disabled}updateAnimation(e){let r=!1;return this._renderers.forEach((t=>r=t.updateAnimation(e)||r)),r}updateDrapeSourceOrder(){this._sortedDrapeSourceRenderersDirty=!0}drawOverlays(e){if(this._overlays&&this._renderTargets){for(const e of this._overlays)this.longitudeCyclical?e.setupGeometryViewsCyclical(this.longitudeCyclical):e.setupGeometryViewsDirect();for(const r of this._renderTargets.targets){if(r.content===v.ColorNoRasterImage&&!this._needsColorWithoutRasterImage)continue;const t=this._drawTarget(w.INNER,r,e),s=this._drawTarget(w.OUTER,r,e);(t||s)&&r.fbo.generateMipMap()}}}_drawTarget(e,r,t){const s=this._overlays[e],i=s.canvasGeometries;if(0===i.numViews)return!1;const{alignPixelEnabled:a,contentPixelRatio:o}=t;this._screenToWorldRatio=o*s.mapUnitsPerPixel/this._bindParameters.overlayStretch;const n=r.output;if(this.isEmpty||n===C.Highlight&&!this.hasHighlights||n===C.Normal&&!this.hasWater||!s.hasSomeSizedView())return!1;const h=this._rctx;if(this._camera.pixelRatio=s.pixelRatio*o,this._renderContext.output=n,this._bindParameters.alignPixelEnabled=a,this._bindParameters.screenToWorldRatio=this._screenToWorldRatio,this._bindParameters.screenToPCSRatio=this._screenToWorldRatio*this.worldToPCSRatio,this._bindParameters.slot=n===C.Normal?I.DRAPED_WATER:I.DRAPED_MATERIAL,r.content===v.Occluded&&(this._renderContext.renderOccludedMask=ie),!this.renders(r.content))return this._renderContext.renderOccludedMask=L,!1;const d=s.resolution;this._rctx.setViewport(e===w.INNER?0:d,0,d,d);const l=2*s.resolution,c=s.resolution,u=r.fbo;u.bind(h,l,c),e===w.INNER&&(h.setClearColor(0,0,0,0),h.clear(K.COLOR));if(b.OVERLAY_DRAW_DEBUG_TEXTURE&&r.content!==v.Occluded)for(let p=0;p<i.numViews;p++)this._setViewParameters(i.extents[p],s),this._ensureDebugPatternResources(s.resolution,te[e]),this._rctx.bindTechnique(this._debugTextureTechnique,this._renderContext.bindParameters,this._passParameters),this._rctx.screen.draw();return this._sortedRenderers.forAll((({drapeSource:t,renderer:a})=>{if(r.content===v.ColorNoRasterImage&&t.drapeSourceType===R.RasterImage)return;const{fullOpacity:o}=t,d=null!=o&&o<1&&n===C.Color?this.bindTemporaryFramebuffer(l,c):null;for(let e=0;e<i.numViews;e++)this._setViewParameters(i.extents[e],s),a.render(this._renderContext);if(d){u.bind(h,l,c),this._overlayParameters.texture=d.getTexture(),this._overlayParameters.opacity=o,this._overlayParameters.overlayIndex=e;const r=this.pluginContext.techniques.acquire(Y);this._rctx.bindTechnique(r,this._renderContext.bindParameters,this._overlayParameters),this._rctx.screen.draw(),r.release(),d.release()}})),h.bindFramebuffer(null),this._renderContext.renderOccludedMask=L,!0}bindTemporaryFramebuffer(e,r){const t=this.view._stage.renderer.fboCache,s=t.acquire(e,r,"overlay tmp");return t.rctx.unbindTexture(s.fbo?.colorTexture),t.rctx.bindFramebuffer(s.fbo),t.rctx.clear(K.COLOR),s}async reloadShaders(){await this._techniques.reloadAll()}notifyContentChanged(){this.events.emit("content-changed")}intersect(e,r,t,s){this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers();let i=0;for(const{renderer:a}of this._sortedRenderers)i=a.intersect?.(e,r,t,s,i)??i}_updateSortedDrapeSourceRenderers(){if(this._sortedRenderers.clear(),0===this._renderers.size)return;const e=this.view.map.allLayers,r=e.length;this._renderers.forEach(((t,s)=>{const i=e.indexOf(s.layer),a=i>=0,o=s.renderGroup??(a?T.MapLayer:T.ViewLayer),n=r*o+(a?i:0);this._sortedRenderers.push(new re(s,t,n))})),this._sortedRenderers.sort(((e,r)=>e.index-r.index))}_setViewParameters(e,r){const t=this._camera;t.viewport=[0,0,r.resolution,r.resolution],p(t.projectionMatrix,0,e[2]-e[0],0,e[3]-e[1],t.near,t.far),m(t.viewMatrix,[-e[0],-e[1],0])}_updateHasWater(){const e=t(this._renderers,(e=>e.hasWater));e!==this._hasWater&&(this._hasWater=e,this.events.emit("has-water",e))}_ensureDebugPatternResources(e,r){if(_(this._passParameters.color,r[0],r[1],r[2]),this._passParameters.texture)return;const t=new Uint8Array(e*e*4);let s=0;for(let o=0;o<e;o++)for(let r=0;r<e;r++){const i=Math.floor(r/10),a=Math.floor(o/10);i<2||a<2||10*i>e-20||10*a>e-20?(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=255):(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=1&i&&1&a?1&r^1&o?0:255:1&i^1&a?0:128)}const i=new $(e);i.samplingMode=Q.NEAREST,this._passParameters.texture=new Z(this._rctx,i,t);const a=new k;a.hasAlpha=!0,this._debugTextureTechnique=this._techniques.acquire(N,a)}get test(){}};e([c()],ee.prototype,"hasHighlights",void 0),e([c()],ee.prototype,"_sortedDrapeSourceRenderersDirty",void 0),e([c()],ee.prototype,"_techniques",void 0),e([c({constructOnly:!0})],ee.prototype,"view",void 0),e([c()],ee.prototype,"worldToPCSRatio",void 0),e([c()],ee.prototype,"spatialReference",void 0),e([c({type:Boolean,readOnly:!0})],ee.prototype,"updating",null),e([c()],ee.prototype,"isEmpty",null),e([c({readOnly:!0})],ee.prototype,"rendersOccludedDraped",null),ee=e([u("esri.views.3d.terrain.OverlayRenderer")],ee);class re{constructor(e,r,t){this.drapeSource=e,this.renderer=r,this.index=t}}const te=[[1,.5,.5],[.5,.5,1]],se=-2,ie=A.OccludeAndTransparent;export{ee as OverlayRenderer,se as drapedZ,ie as overlayRenderOccludedFlag};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{isPowerOfTwo as e,clamp as t}from"../../../core/mathUtils.js";import{empty as n}from"../../../geometry/support/aaBoundingBox.js";import{fromValues as o}from"../../../geometry/support/aaBoundingRect.js";import{sampleElevation as s}from"./ElevationData.js";import{PatchType as r}from"./interfaces.js";import{NeighborIndex as i}from"./NeighborIndex.js";import{encodeUVInBuffer as a}from"./PatchGeometry.js";import{PatchGeometryLUT as c}from"./PatchGeometryLUT.js";import{neighborTileIfLoadedOrSelf as l,zeroToFour as u}from"./PatchRenderData.js";import{internalAssert as d,enableTerrainInternalChecks as f,neighborEdgeIndices as m,almostEquals as g}from"./terrainUtils.js";import{isCornerNeighbor as p}from"./Tile.js";import{compareTilesByLij as x}from"./tileUtils.js";import{compressNormal as h}from"../webgl-engine/lib/Normals.js";const M=65536;function S(e,t){const{tile:o,geometry:s,geometryState:i}=e,{extentInRadians:a,surface:c}=o,{isWebMercator:l,renderer:u}=c,{numVerticesPerSide:d,wireframe:f}=i,m=d-1,g=(d-2)**2,p=l&&(t===r.HAS_SOUTH_POLE||t===r.HAS_BOTH_POLES),x=l&&(t===r.HAS_NORTH_POLE||t===r.HAS_BOTH_POLES),h=((p?1:0)+(x?1:0))*pe*d,M=fe(i),S=g+h+4*M,B=u.tileGeometryCache.acquire(S);s.numVerticesPerSide=d,s.vertexAttributes=B,s.maxEdgeVertexCount=M;const{boundingBox:I}=s;n(I);const V=O(e);re.update(m,a,V),v(e),s.poleVerticesStartIndex=g;const L=y(e,p,x);s.edgeVerticesStartIndex=g+h,X(e),b(e),W(s,L,f),e.intersectionData=null}function y(e,t,n){const{tile:o,localOrigin:s,geometry:r}=e,{extent:i,ellipsoid:c}=o,{boundingBox:l,numVerticesPerSide:u,vertexAttributes:d,poleVerticesStartIndex:f}=r,m=u-1,g=s[0],p=s[1],x=s[2],M=c.radius,S=i[1],y=i[3],v=[];let B=f;const I=(e,t)=>{const n=t*u;de(-g,-p,e*M-x,l),v.push(new oe(1===e,n,1===e?0:2,B,pe));const o=P(-1===e?S:y,M),s=e*Math.PI/2-o,r=.99*(1===e?1:-1),i=M+0,{position:c,uv0:f}=d,{typedBuffer:I,typedBufferStride:V}=d.normalCompressed;for(let u=1;u<=pe;++u){const e=o+s*(u/pe),t=Math.cos(e),n=Math.sin(e);for(let o=0;o<=m;o++){const e=o/m,s=re.sinLonLUT[o],u=re.cosLonLUT[o]*t,d=s*t,M=n,S=u*i-g,y=d*i-p,v=M*i-x;de(S,y,v,l),c.setValues(B,S,y,v),a(f,B,e,r),h(I,B,u,d,M,V),++B}}};return t&&I(-1,0),n&&I(1,m),v}function v(e){const{tile:t}=e;if(!t.intersectsClippingArea)return;const{geometry:n,geometryState:o,localOrigin:r}=e,{numVerticesPerSide:i,samplerData:c}=o,l=i-2,u=i-1,{vertexAttributes:d,boundingBox:f}=n,m=d.position,g=d.uv0,{typedBuffer:p,typedBufferStride:x}=d.normalCompressed,{extent:M}=t,S=M[0],y=M[2],v=M[1],B=M[3],I=t.ellipsoid.radius,V=r[0],b=r[1],L=r[2],C=m.typedBuffer,P=m.typedBufferStride,A=1/u;let E=0;if(1<=l){const e=A,t=v*(1-e)+B*e,n=re.sinLatLUT[1],o=re.cosLatLUT[1];for(let r=1;r<=l;r++){const i=r*A,l=S*(1-i)+y*i,u=re.sinLonLUT[r],d=re.cosLonLUT[r],m=I+s(l,t,c),p=m*d*o-V,x=m*u*o-b,h=m*n-L;de(p,x,h,f);const M=(r-1)*P;C[M]=p,C[M+1]=x,C[M+2]=h,a(g,r-1,i,e)}}for(let O=1;O<=l;O++){const e=O*A,t=v*(1-e)+B*e,n=re.sinLatLUT[O],o=re.cosLatLUT[O],r=O+1,i=r*A,d=v*(1-i)+B*i,m=re.sinLatLUT[r],M=re.cosLatLUT[r],T=re.sinLonLUT[0],D=re.cosLonLUT[0],R=I+s(S,t,c);let U=D*o*R-V,N=T*o*R-b,w=n*R-L;const j=E*P;let F=C[j],H=C[j+1],q=C[j+2];for(let B=1;B<=l;B++){const e=B*A,r=S*(1-e)+y*e,T=re.sinLonLUT[B],D=re.cosLonLUT[B];let R=0,j=0,_=0;if(B<l){const e=(E+1)*P;R=C[e],j=C[e+1],_=C[e+2]}else{const e=re.sinLonLUT[u],r=re.cosLonLUT[u],i=I+s(y,t,c);R=r*o*i-V,j=e*o*i-b,_=n*i-L}const W=U,G=N,k=w;U=F,N=H,w=q,F=R,H=j,q=_;const z=R-W,J=j-G,K=_-k;let Q=0,X=0,Y=0;if(O>1){const e=(E-l)*P;Q=C[e],X=C[e+1],Y=C[e+2]}else{const e=re.sinLatLUT[0],t=re.cosLatLUT[0],n=I+s(r,v,c);Q=D*t*n-V,X=T*t*n-b,Y=e*n-L}const Z=I+s(r,d,c),$=D*M*Z-V,ee=T*M*Z-b,te=m*Z-L;if(O<l){const t=E+l,n=t*P;C[n]=$,C[n+1]=ee,C[n+2]=te,de($,ee,te,f),a(g,t,e,i)}const ne=Q-$,oe=X-ee,se=Y-te;let ie=D*o,ae=T*o,ce=n;ce*ce<.999&&(ie=K*oe-J*se,ae=z*se-K*ne,ce=J*ne-z*oe);const le=1/Math.sqrt(ie*ie+ae*ae+ce*ce);h(p,E,ie*le,ae*le,ce*le,x),++E}}}function B(e){e.tile.intersectsClippingArea&&(b(e),te(e),e.intersectionData=null)}function I(e){e.tile.intersectsClippingArea&&(Y(e),b(e),te(e),ne(e),e.intersectionData=null)}function V(e){e.tile.intersectsClippingArea&&(C(e),L(e,!0),te(e),e.intersectionData=null)}function b(e){e.tile.intersectsClippingArea&&(C(e),L(e))}function L(t,n=!1){const{geometry:o,geometryState:r,tile:i,localOrigin:c}=t,{level:u,extent:p,extentInRadians:h,ellipsoid:M}=i,S=M.radius,y=h[0],v=h[2],B=h[1],I=h[3],{samplerData:V}=r,b=p[0],L=p[2],C=p[1],P=p[3],A=O(t),{boundingBox:E,vertexAttributes:T}=o,D=c[0],R=c[1],U=c[2],N=T.position,w=N.typedBuffer,j=N.typedBufferStride,F=T.uv0;for(let O=0;O<4;++O){const c=1===O||3===O,h=r.edgeResolutions[O];d(e(h));const M=h+1,T=l(i,r.edgePeerNeighbors[O]);if(ce(i,T,O)){Z(t,O,T);continue}const N=null!=T;d(!N||T.level===i.level),d(!N||x(i,T)<=0);const H=T?.renderData,q=H?.geometryState;if(f){const e=i.surface;if(!T&&e&&!e.updatingRootTiles){const t=m[O],n=i.findNeighborTile(t,(e=>e.loaded||e.leaf||e.level===i.level));n?n.intersectsClippingArea&&(d(!n.loaded),d(!n.leaf),d(n.level===u)):d(null==e?.rootTiles||!i.shouldHaveNeighbor(t))}}const _=1===O?p[2]:p[0],W=T?.extent,G=W&&c?1===O?W[0]:W[2]:_,k=0===O?p[3]:p[1],z=1===O?1:0,J=0===O?1:0,K=1===O?v:y,Q=0===O?I:B,X=Math.sin(K),Y=Math.cos(K),$=Math.sin(Q),ee=Math.cos(Q),te=q?.samplerData,ne=N?(e,t,n)=>.5*(s(e,t,V)+s(n,t,te)):(e,t,n)=>s(e,t,V),oe=o.outerEdgesOffsetAndLength[2*O+0],se=n&&M>3?M-3:1,re=null!=V&&V.some((e=>null!=e)),ie=null!=te&&te.some((e=>null!=e)),ae=re||ie,le=1/h,ue=oe;d(!W||g(W[2]-W[0],p[2]-p[0]));(()=>{const e=1===O?-1:3===O?1:0,t=0===O?-1:2===O?1:0,n=(p[2]-p[0])*le,r=e*n,i=t*n,l=c?e*((v-y)*le):0,u=c?0:t*le,d=J,f=c?K+l:K,m=c?Math.sin(f):X,g=c?Math.cos(f):Y,x=c?K-l:K,h=c?Math.sin(x):X,B=c?Math.cos(x):Y,I=c?Q:A(d+u),T=c?$:Math.sin(I),H=c?ee:Math.cos(I),q=c?Q:A(d-u),W=c?$:Math.sin(q),Z=c?ee:Math.cos(q);let oe=0,re=0,ie=0;{const e=0*le,t=c?_:b*(1-e)+L*e,n=c?G:t,o=c?C*(1-e)+P*e:k,s=c?K:y*(1-e)+v*e,r=c?X:Math.sin(s),i=c?Y:Math.cos(s),a=c?A(e):Q,l=c?Math.sin(a):$,u=c?Math.cos(a):ee,d=S+ne(t,o,n);oe=i*u*d,re=r*u*d,ie=l*d}let ce=0,fe=0,me=0;{const e=1*le,t=c?_:b*(1-e)+L*e,n=c?G:t,o=c?C*(1-e)+P*e:k,s=c?K:y*(1-e)+v*e,r=c?X:Math.sin(s),i=c?Y:Math.cos(s),a=c?A(e):Q,l=c?Math.sin(a):$,u=c?Math.cos(a):ee,d=S+ne(t,o,n);ce=i*u*d,fe=r*u*d,me=l*d}for(let p=1;p<M-1;p+=se){let e=0,t=0,n=0;{const o=(p+1)*le,s=c?_:b*(1-o)+L*o,r=c?G:s,i=c?C*(1-o)+P*o:k,a=c?K:y*(1-o)+v*o,l=c?X:Math.sin(a),u=c?Y:Math.cos(a),d=c?A(o):Q,f=c?Math.sin(d):$,m=c?Math.cos(d):ee,g=S+ne(s,i,r);e=u*m*g,t=l*m*g,n=f*g}const l=e,u=t,d=n,f=ce,x=fe,M=me;ce=l,fe=u,me=d;{const e=ue+p,t=e*j,n=f-D,o=x-R,s=M-U;w[t]=n,w[t+1]=o,w[t+2]=s,de(n,o,s,E);const r=p*le;a(F,e,c?z:r,c?r:J)}const I=oe,q=re,se=ie;oe=f,re=x,ie=M;const ge=f,pe=x,xe=M,he=1/Math.sqrt(ge*ge+pe*pe+xe*xe),Me=xe*he;let Se=0,ye=0,ve=0;if(ae&&Me*Me<.999){let e=0,t=0,n=0;{const o=0===O?-1:1;e=o*(l-I),t=o*(u-q),n=o*(d-se)}{const o=p*le,a=c?_:b*(1-o)+L*o,l=c?G:a,u=c?C*(1-o)+P*o:k,d=c?K:y*(1-o)+v*o,f=c?X:Math.sin(d),x=c?Y:Math.cos(d),M=c?A(o):Q,I=c?Math.sin(M):$,E=c?Math.cos(M):ee;let D=ge,R=pe,U=xe;if(N){const e=S+s(l-r,u-i,te),t=c?E:Z;D=(c?B:x)*t*e,R=(c?h:f)*t*e,U=(c?I:W)*e}{const o=S+s(a+r,u+i,V),l=c?E:H,d=(c?g:x)*l*o,p=(c?m:f)*l*o,h=(c?I:T)*o;N||(D=2*ge-d,R=2*pe-p,U=2*xe-h);const M=3===O?-1:1,y=M*(D-d),v=M*(R-p),B=M*(U-h);Se=n*v-t*B,ye=e*B-n*y,ve=t*y-e*v;const b=1/Math.sqrt(Se*Se+ye*ye+ve*ve);Se*=b,ye*=b,ve*=b}}}else Se=ge*he,ye=pe*he,ve=xe*he;o.setEdgeNormalFromValues(O,p,Se,ye,ve)}})()}}function C(e){$(e)}function P(e,t){return Math.PI/2-2*Math.atan(Math.exp(-e/t))}function A(e,t,n,o){return P(e*(1-o)+t*o,n)}function E(e,t,n){return e*(1-n)+t*n}function O(e){const{tile:t}=e;if(t.surface.isWebMercator){const e=t.extent,n=t.ellipsoid.radius;return t=>A(e[1],e[3],n,t)}const n=t.extentInRadians;return e=>E(n[1],n[3],e)}function T(e,t){const{tile:o,geometryState:s,geometry:r}=e,{extent:i,surface:a}=o,{wireframe:c}=s,l=i[0],u=i[1],d=i[2]-l,f=i[3]-u,{numVerticesPerSide:m,clippingArea:g}=s,p=null!=g?Math.max(0,(g[0]-l)/d):0,x=null!=g?Math.max(0,(g[1]-u)/f):0,h=null!=g?Math.min(1,(g[2]-l)/d):1,M=null!=g?Math.min(1,(g[3]-u)/f):1,S=(m-2)**2,y=fe(s),v=S+4*y,B=a.renderer.tileGeometryCache.acquire(v),{boundingBox:I}=r;n(I),r.numVerticesPerSide=m,r.vertexAttributes=B,r.maxEdgeVertexCount=y,r.minu=p,r.minv=x,r.maxu=h,r.maxv=M,D(e),r.edgeVerticesStartIndex=S,X(e),w(e),W(r,[],c),e.intersectionData=null}function D(e){const n=e.tile;if(!n.intersectsClippingArea)return;const{geometry:o,geometryState:r,localOrigin:i}=e,{samplerData:c,clippingArea:l,numVerticesPerSide:u}=r,{surface:d,extent:f,ellipsoid:m}=n,{isWebMercatorOnPlateCarree:g}=d,p=null!=l?l:ie,x=f[0],M=f[1],S=f[2],y=f[3],v=Math.max(x,p[0]),B=Math.min(S,p[2]),I=Math.max(M,p[1]),V=Math.min(y,p[3]),b=m.radius,L=n.horizontalScale,C=u-1,P=u-2,{minu:A,minv:E,maxu:O,maxv:T,boundingBox:D,vertexAttributes:R}=o,U=R.position,N=R.uv0,{typedBuffer:w,typedBufferStride:j}=R.normalCompressed,F=i[0],H=i[1],q=i[2],_=U.typedBuffer,W=U.typedBufferStride;let G=0;const k=t(M,I,V),z=g?(Math.PI/2-2*Math.atan(Math.exp(-k/b)))*b:k*L,J=1/C,K=t(M*(1-J)+y*J,I,V);let Q=z,X=g?(Math.PI/2-2*Math.atan(Math.exp(-K/b)))*b:K*L;for(let Y=1;Y<=P;Y++){const e=Y/C,n=t(M*(1-e)+y*e,I,V),o=t(e,E,T),r=X,i=(Y-1)/C,l=t(M*(1-i)+y*i,I,V),u=Q,d=(Y+1)/C,f=t(M*(1-d)+y*d,I,V),m=g?(Math.PI/2-2*Math.atan(Math.exp(-f/b)))*b:f*L,p=t(d,E,T);Q=X,X=m;const R=t(x,v,B);let U=R*L,k=s(R,n,c);const z=1/C,J=t(z,A,O),K=t(x*(1-J)+S*J,v,B);let Z=J,$=K,ee=K*L,te=s(K,n,c);if(1===Y){const e=ee-F,n=Q-H,s=te-q,r=0*W;_[r]=e,_[r+1]=n,_[r+2]=s,de(e,n,s,D);const i=t(z,A,O);a(N,G,i,o)}for(let g=1;g<=P;g++){const e=ee,i=te,d=(g+1)/C,M=t(d,A,O),y=t(x*(1-d)+S*d,v,B),I=$;$=y;{const e=G+1,t=e*W;if(1===Y||g===P){const i=y*L,l=s(y,n,c);if(1===Y&&g<P){const n=i-F,s=r-H,c=l-q;_[t]=n,_[t+1]=s,_[t+2]=c,de(n,s,c,D),a(N,e,M,o)}ee=i,te=l}else ee=_[t]+F,te=_[t+2]+q}const V=ee,b=te,E=U,T=k;U=e,k=i;const R=(G-P)*W,z=1===Y?s(I,l,c):_[R+2]+q,J=s(I,f,c);if(Y<P){const t=G+P,n=t*W,o=e-F,s=m-H,r=J-q;_[n]=o,_[n+1]=s,_[n+2]=r,de(o,s,r,D);const i=Z;Z=M,a(N,t,i,p)}{const e=V-E,t=u-m,n=t*(b-T),o=e*(z-J),s=-t*e,r=n*n+o*o+s*s;if(0===r)h(w,G,0,0,1,j);else{const e=1/Math.sqrt(r);h(w,G,n*e,o*e,s*e,j)}}++G}}}function R(e,t){e.tile.intersectsClippingArea&&(F(e),j(e,!0),te(e),e.intersectionData=null)}function U(e,t){e.tile.intersectsClippingArea&&(Y(e),w(e),te(e),ne(e),e.intersectionData=null)}function N(e,t){e.tile.intersectsClippingArea&&(w(e),te(e),e.intersectionData=null)}function w(e,t){e.tile.intersectsClippingArea&&(F(e),j(e,!1))}function j(n,o){const{geometry:r,geometryState:i,localOrigin:a}=n,c=n.tile,{surface:u,extent:g}=c,{clippingArea:p,samplerData:h}=i,M=null!=p?p:ie,S=g[0],y=g[2],v=g[1],B=g[3],I=[B>M[3],y>M[2],v<M[1],S<M[0]],V=c.horizontalScale,b=_(u.isWebMercatorOnPlateCarree,c.ellipsoid.radius,V),{minu:L,minv:C,maxu:P,maxv:A,boundingBox:E}=r,O=Math.max(S,M[0]),T=Math.min(y,M[2]),D=Math.max(v,M[1]),R=Math.min(B,M[3]),U=a[0],N=a[1],w=a[2];for(let j=0;j<4;++j){const a=1===j||3===j,g=i.edgeResolutions[j];d(e(g));const p=g+1,M=I[j],F=l(c,i.edgePeerNeighbors[j]);if(!M&&ce(c,F,j)){Z(n,j,F);continue}const H=null!=F&&!M,q=F?.renderData,_=q?.geometryState;if(f&&(d(!H||F.level===c.level),d(!H||x(c,F)<=0),c&&!F&&!u.updatingRootTiles)){const e=m[j],t=c.findNeighborTile(e,(e=>e.loaded||e.leaf||e.level===c.level));u.updatingRootTiles||(t?t.intersectsClippingArea&&(d(!t.loaded),d(!t.leaf),d(t.level===c.level)):d(null==u?.rootTiles||!c.shouldHaveNeighbor(e)))}const W=t(1===j?y:S,O,T),G=t(0===j?B:v,D,R),k=_?.samplerData,z=o&&p>3?p-3:1,J=t(1===j?1:0,L,P),K=t(0===j?1:0,C,A),Q=H?(e,t)=>.5*(s(e,t,k)+s(e,t,h)):(e,t)=>s(e,t,h),X=(y-S)/g,Y=a?1===j?X:-X:0,$=a?0:0===j?X:-X,ee=-Y,te=-$;let ne=0,oe=0,se=0;{const e=0/g,n=a?W:t(S*(1-e)+y*e,O,T),o=a?t(v*(1-e)+B*e,D,R):G,s=Q(n,o);ne=n*V,oe=b(o),se=s}let re=0,ie=0,ae=0;{const e=1/g,n=a?W:t(S*(1-e)+y*e,O,T),o=a?t(v*(1-e)+B*e,D,R):G,s=Q(n,o);re=n*V,ie=b(o),ae=s}for(let e=1;e<p-1;e+=z){const n=e/g,o=re,i=ie,c=ae;{const s=a?J:t(n,L,P),l=a?t(n,C,A):K,u=o-U,d=i-N,f=c-w;de(o,d,f,E),r.setEdgeVertexFromValuesRawPositionUV(j,e,u,d,f,s,l)}{const n=(e+1)/g,o=a?W:t(S*(1-n)+y*n,O,T),s=a?t(v*(1-n)+B*n,D,R):G,r=Q(o,s);re=o*V,ie=b(s),ae=r}const l=re,u=ae,d=ne,f=oe,m=se;ne=o,oe=i,se=c;let p=0,x=0,M=0;if(a){const e=ie-i,r=u-c,a=f-i,l=m-c,d=t(v*(1-n)+B*n,D,R),g=W+ee,S=g*V-o,y=s(g,d,h)-c,I=3===j?-1:1;if(p=I*(-a+e)*y,x=I*S*(-l+r),M=-I*S*(-a+e),H){const t=W+Y,n=t*V-o;p=(-a+e)*(y-(s(t,d,k)-c)),x=(S-n)*(-l+r),M=-(S-n)*(-a+e)}}else{const e=l-o,r=u-c,a=d-o,f=m-c,g=t(S*(1-n)+y*n,O,T),v=G+te,B=s(g,v,h)-c,I=b(v)-i,V=2===j?-1:1;if(p=V*I*(-f+r),x=V*(-a+e)*B,M=-V*I*(-a+e),H){const t=g,n=G+$,o=b(n)-i;p=(-I+o)*(-f+r),x=(-a+e)*(-B+(s(t,n,k)-c)),M=-(-I+o)*(-a+e)}}const I=1/Math.sqrt(p*p+x*x+M*M);r.setEdgeNormalFromValues(j,e,p*I,x*I,M*I)}}}function F(e,t){$(e)}function H(e,t){return(Math.PI/2-2*Math.atan(Math.exp(-e/t)))*t}function q(e,t){return e*t}function _(e,t,n){return e?e=>H(e,t):e=>q(e,n)}function W(e,t,n){const{numVerticesPerSide:o,vertexAttributes:s,maxEdgeVertexCount:r}=e,i=o-1,a=s.count,c=2*(o-3)*(o-3),l=4*(i+r-3),d=u.reduce(((t,n)=>t+(i+e.getEdgeCount(n)-3)),0),f=t.reduce(((e,t)=>e+i*(2*(t.latitudeResolution-1)+1)),0),m=3*(n?2:1),g=(c+l+f)*m,p=a>=M?new Uint32Array(g):new Uint16Array(g);for(let u=0;u<g;++u)p[u]=0;e.indices=p,e.indexCount=(c+d+f)*m,e.poleIndicesStartIndex=c*m,e.edgeIndicesStartIndex=(c+f)*m,n?(J(e),K(e,t),Q(e)):(G(e),k(e,t),z(e))}function G(e){const{numVerticesPerSide:t,indices:n,vertexAttributes:o}=e,{position:s}=o,{typedBuffer:r,typedBufferStride:i}=s,a=t-2,c=t-3,l=0,u=t-3;let d=0;for(let f=0;f<c;++f){const e=f*a;for(let t=l;t<u;++t){const o=e+t,s=o+1,c=s+a,l=c-1;me(o,s,c,l,i,r)?(n[d]=o,n[d+1]=s,n[d+2]=c,n[d+3]=c,n[d+4]=l,n[d+5]=o):(n[d]=o,n[d+1]=s,n[d+2]=l,n[d+3]=l,n[d+4]=s,n[d+5]=c),d+=6}}}function k(e,t){const{numVerticesPerSide:n,indices:o,poleIndicesStartIndex:s}=e,r=n-1;let i=s;for(const a of t){const t=a.isNorth?1:2,s=a.isNorth?2:1,c=a.isNorth?3:4,l=a.isNorth?4:3;let u=e.getEdgeVertexIndex(a.connectedOuterEdgeOffset,0),d=1;for(let e=0;e<a.latitudeResolution;++e){const f=0===e?a.rowOffset:u+n;for(let n=0;n<r;n++){const r=f+n;o[i]=u,o[i+t]=u+1,o[i+s]=r,e<a.latitudeResolution-1?(o[i+c]=u+1,o[i+l]=r+1,o[i+5]=r,i+=6):i+=3,u+=d}u=f,d=1}}}function z(e){const{indices:t,numVerticesPerSide:n,edgeIndicesStartIndex:o}=e,s=n-1,r=s-2;let i=o;for(let a=0;a<4;++a){const n=ue[a];let o=0,c=0;const l=e.getEdgeCount(a),u=n.count;d(u===s-1);const f=1===a||2===a,m=f?1:2,g=f?2:1,p=e.getEdgeFirstVertexIndex(a),x=1,h=n.vertex0Index,M=n.stride;for(;o<l-1||c<u-1;){const e=h+c*M,n=p+o*x,a=o<l-1,d=c<u-1,f=a&&(!d||(a?0+s*(o+.5)/(l-1):0)<=(d?1+r*(c+.5)/(u-1):0));f?++o:++c;const S=f?n+x:e+M;t[i]=e,t[i+m]=n,t[i+g]=S,i+=3}}e.indexCount=i}function J(e){const{indices:t,numVerticesPerSide:n,vertexAttributes:o}=e,{position:s}=o,{typedBuffer:r,typedBufferStride:i}=s,a=n-2;let c=0;for(let l=0;l<n-3;++l){const e=l*a;for(let o=0;o<n-3;++o){const n=l*a+o,s=n+1,u=s+a,d=u-1,f=e+o,m=f+1,g=m+a;me(f,m,g,g-1,i,r)?(ge(t,c,n,s,u),c+=6,ge(t,c,u,d,n)):(ge(t,c,n,s,d),c+=6,ge(t,c,d,u,s)),c+=6}}}function K(e,t){const{indices:n,numVerticesPerSide:o,poleIndicesStartIndex:s}=e,r=o-1;let i=s;for(const a of t){const t=a.connectedOuterEdgeOffset;let s=e.getEdgeVertexIndex(t,0),c=1;for(let e=0;e<a.latitudeResolution;++e){const t=0===e?a.rowOffset:s+o;for(let o=0;o<r;o++)ge(n,i,s,s+1,t+o),i+=6,e<a.latitudeResolution-1&&(ge(n,i,s+1,t+o+1,t+o),i+=6),s+=c;s=t,c=1}}}function Q(e){const{indices:t,numVerticesPerSide:n,edgeIndicesStartIndex:o}=e,s=n-1,r=s-2;let i=o;for(let a=0;a<4;++a){const n=ue[a];let o=0,c=0;const l=e.getEdgeCount(a),u=n.count;d(u===s-1);const f=1===a||2===a,m=f?1:3,g=f?3:1,p=e.getEdgeFirstVertexIndex(a),x=1,h=n.vertex0Index,M=n.stride;for(;o<l-1||c<u-1;){const e=h+c*M,n=p+o*x,a=o<l-1,d=c<u-1,f=a&&(!d||(a?0+s*(o+.5)/(l-1):0)<=(d?1+r*(c+.5)/(u-1):0));f?++o:++c;const S=f?n+x:e+M;t[i]=e,t[i+m]=n,t[i+m+1]=n,t[i+g]=S,t[i+g+1]=S,t[i+5]=e,i+=6}}e.indexCount=i}function X(e){const{geometry:t,geometryState:n}=e,{edgeResolutions:o}=n,{numVerticesPerSide:s,edgeVerticesStartIndex:r}=t,i=s-2;let a=r;for(let c=0;c<4;++c){{const e=0===c||2===c,t=(0===c?i-1:0)*i+(1===c?i-1:0),n=(e?0:1)*i+(e?1:0),o=ue[c];o.vertex0Index=t,o.stride=n,o.count=i}{const e=o[c]+1;t.outerEdgesOffsetAndLength[2*c+0]=a,t.outerEdgesOffsetAndLength[2*c+1]=e,a+=e}}}function Y(e){X(e),e.geometryState.wireframe?Q(e.geometry):z(e.geometry)}function Z(n,o,s){const{geometryState:r,geometry:i,tile:c,localOrigin:l}=n,u=1===o||3===o,f=r.edgeResolutions[o];d(e(f));const m=f+1,{boundingBox:g,minu:p,minv:x,maxu:h,maxv:M,vertexAttributes:S}=i,y=t(1===o?1:0,p,h),v=t(0===o?1:0,x,M),B=s.renderData,I=B.geometryState,V=B.geometry,b=(o+2)%4,L=V.getEdgeCount(b),C=c.getNeighborEdgeStartVertexIndex(o,s)*f,P=f*2**(c.level-s.level);d(I.edgeResolutions[b]===P),d(L-1===P);const A=B.localOrigin[0]-l[0],E=B.localOrigin[1]-l[1],O=B.localOrigin[2]-l[2],T=i.getEdgeFirstVertexIndex(o),D=S.position,R=D.typedBuffer,U=D.typedBufferStride,N=S.normalCompressed,w=N.typedBuffer,j=N.typedBufferStride,F=S.uv0,H=V.vertexAttributes,q=V.getEdgeFirstVertexIndex(b),_=H.position.typedBuffer,W=H.position.typedBufferStride,G=H.normalCompressed.typedBuffer,k=H.normalCompressed.typedBufferStride;for(let e=1;e<m-1;++e){const n=T+e,o=q+(C+e),s=n*U,r=o*W,i=_[r]+A,c=_[r+1]+E,l=_[r+2]+O;R[s]=i,R[s+1]=c,R[s+2]=l,de(i,c,l,g);const d=n*j,m=o*k;w[d]=G[m],w[d+1]=G[m+1];const S=e/f,B=u?y:t(S,p,h),I=u?t(S,x,M):v;a(F,n,B,I)}}function $(e){const{geometry:n,geometryState:o,localOrigin:r}=e,{clippingArea:i,samplerData:c}=o,{minu:l,minv:u,maxu:f,maxv:m,boundingBox:g,vertexAttributes:p}=n,h=e.tile,{surface:M,ellipsoid:S,extent:y,extentInRadians:v,horizontalScale:B}=h,I="local"===M.view?.viewingMode,V=S.radius;let b=0,L=0,C=0;const P=(e,t,n)=>{const o=v[0===t?1:3],s=v[0===e?0:2],r=Math.cos(o),i=Math.sin(o),a=Math.sin(s),c=Math.cos(s),l=V+n;b=c*r*l,L=a*r*l,C=i*l},A=I?(()=>{const e=i,n=null!=e&&(y[3]>e[3]||y[2]>e[2]||y[1]<e[1]||y[0]<e[0]),o=_(M.isWebMercatorOnPlateCarree,V,B);return(s,r,i)=>{const a=0===s?y[0]:y[2],c=0===r?y[1]:y[3],l=n?t(a,e[0],e[2]):a,u=n?t(c,e[1],e[3]):c,d=i;b=l*B,L=o(u),C=d}})():P;let E=0,T=0,D=0,R=0,U=0,N=0,w=0,j=0,F=0;const H=I&&M.isWebMercatorOnPlateCarree,q=(e,t,n,o,s)=>{let r=0,i=0,a=0;if(I){const e=t*B,s=H?(Math.PI/2-2*Math.atan(Math.exp(-n/V)))*V:n*B;r=e-b,i=s-L,a=o-C}else{const s=O(e),c=e.tile,l=c.extent,u=c.extentInRadians,d=(t-l[0])/(l[2]-l[0]),f=(n-l[1])/(l[3]-l[1]),m=u[0]*(1-d)+u[2]*d,g=s(f),p=Math.cos(g),x=Math.sin(g),h=Math.sin(m),M=Math.cos(m),S=V+o;r=M*p*S-b,i=h*p*S-L,a=x*S-C}switch(s){case 0:w+=r,j+=i,F+=a;break;case 1:R-=r,U-=i,N-=a;break;case 2:w-=r,j-=i,F-=a;break;case 3:R+=r,U+=i,N+=a}},W=i??ie,G=y[0],k=y[2],z=y[1],J=y[3],K=[J>W[3],k>W[2],z<W[1],G<W[0]],Q=Math.max(G,W[0]),X=Math.min(k,W[2]),Y=Math.max(z,W[1]),Z=Math.min(J,W[3]),$=e=>Math.max(W[0],Math.min(W[2],e)),te=e=>Math.max(W[1],Math.min(W[3],e)),ne=e=>{const t=o.cornerNeighborCornerTiles;E=0,T=0,D=1,R=0,U=0,N=0,w=0,j=0,F=0;let n=1/0;for(let o=0;o<4;++o){const s=t[4*e+o];n=Math.min(n,s?.level??1/0)}for(let o=0;o<4;++o){const s=t[4*e+o];ae[o]=s?.level===n?s:null}let r=1,i=0;for(let o=0;o<4;++o){const e=ae[o];e&&(r=Math.max(r,e?.renderData.geometryState.numVerticesPerSide),i=e.extent[2]-e.extent[0])}const a=i,c=r;d(c>1);const l=a/c;for(let o=0;o<4;++o){const e=ae[(o+3)%4],t=ae[o%4];if(!e&&!t)continue;const n=0===o?1:1===o?2:2===o?3:0,r=0===o?2:1===o?3:2===o?0:1;if(e&&t){const i=se[o][0]*l,a=se[o][1]*l,c=e.extent,u=$(c[0===n||1===n?2:0]+i),d=te(c[0===n||3===n?3:1]+a),f=t.extent,m=$(f[0===r||1===r?2:0]+i),g=te(f[0===r||3===r?3:1]+a),p=e.renderData,x=t.renderData,h=s(u,d,p.geometryState.samplerData),M=s(m,g,x.geometryState.samplerData);q(p,u,d,.5*(h+M),o)}else{const i=e??t,a=e?n:r,c=i.extent,u=se[o],d=$(c[0===a||1===a?2:0]+u[0]*l),f=te(c[0===a||3===a?3:1]+u[1]*l),m=i.renderData,g=s(d,f,m.geometryState.samplerData);q(m,d,f,g,o)}}if(!I){const e=Math.sqrt(b*b+L*L+C*C);E=b/e,T=L/e,D=C/e}if(I||D*D<.999){const e=Math.sqrt(R*R+U*U+N*N);R/=e,U/=e,N/=e;const t=Math.sqrt(w*w+j*j+F*F);w/=t,j/=t,F/=t,E=N*j-U*F,T=R*F-N*w,D=U*w-R*j;const n=1/Math.sqrt(E*E+T*T+D*D);E*=n,T*=n,D*=n}},oe=o.cornerNeighborCornerTiles;for(let O=0;O<4;++O){const e=O,i=(O+1)%4,M=0===O||1===O?1:0,S=0===O||3===O?1:0,y=t(M,l,f),v=t(S,u,m),B=n.getEdgeFirstVertexIndex(e),I=n.getEdgeCount(e),V=0===O||3===O?I-1:0,P=n.getEdgeFirstVertexIndex(i),R=n.getEdgeCount(i),U=0===O||1===O?R-1:0;let N=-1;for(let t=0;t<4;++t){const e=oe[4*O+t],n=oe[4*O+N];e&&(-1===N||x(n,e)>0)&&(N=t)}const w=N,j=oe[4*O+w];if(j!==h){const e=h.level-j.level,t=2**e,n=[j.lij[0]+e,j.lij[1]*t,j.lij[2]*t],s=[n[1]+t===h.lij[1],0===O&&(1===w||0===w&&j!==oe[4*O+3])||1===O&&(0===w||1===w&&j!==oe[4*O+2]),n[1]===h.lij[1]+1,2===O&&(3===w||2===w&&j!==oe[4*O+1])||3===O&&(2===w||3===w&&j!==oe[4*O+0])],i=s.reduce(((e,t)=>e+(t?1:0)),0);d(1===i||2===i);let c=-1,l=-1;const u=j.renderData;if(1===i){const e=s.findIndex((e=>e));d(0<=e&&e<=3),c=(e+2)%4;const t=o.edgeResolutions[e];l=h.getNeighborEdgeStartVertexIndex(e,j)*t+t*(0===e&&0===O||1===e&&0===O||2===e&&1===O||3===e&&3===O?1:0)}else{d(s[1]||s[3]),c=s[1]?3:1;const e=u.geometryState.edgeResolutions[c];l=0===O||3===O?0:e}const f=u.geometry;{const e=B+V,t=P+U,n=f.getEdgeFirstVertexIndex(c)+l,o=f.vertexAttributes,s=u.localOrigin;{const i=o.position,a=i.typedBuffer,c=n*i.typedBufferStride,l=a[c]+s[0]-r[0],u=a[c+1]+s[1]-r[1],d=a[c+2]+s[2]-r[2];de(l,u,d,g);const f=p.position,m=f.typedBuffer;{const t=e*f.typedBufferStride;m[t]=l,m[t+1]=u,m[t+2]=d}{const e=t*f.typedBufferStride;m[e]=l,m[e+1]=u,m[e+2]=d}}const i=p.uv0;a(i,e,y,v),a(i,t,y,v);{const s=o.normalCompressed.typedBuffer,r=n*o.normalCompressed.typedBufferStride,i=p.normalCompressed,a=i.typedBuffer;{const t=e*i.typedBufferStride;a[t]=s[r],a[t+1]=s[r+1]}{const e=t*i.typedBufferStride;a[e]=s[r],a[e+1]=s[r+1]}}}}else{const o=K[e],a=K[i];let l;if(o||a){const e=t(G*(1-M)+k*M,Q,X),n=t(z*(1-S)+J*S,Y,Z);l=s(e,n,c)}else l=ee(oe,O);A(M,S,l),ne(O);const u=b-r[0],d=L-r[1],f=C-r[2];de(u,d,f,g),n.setEdgeVertexFromValuesRawPositionUVNormal(e,V,u,d,f,y,v,E,T,D),n.setEdgeVertexFromValuesRawPositionUVNormal(i,U,u,d,f,y,v,E,T,D)}}for(let t=0;t<4;++t)ae[t]=null}function ee(e,t){const n=4*t,o=u.reduce(((t,o)=>Math.min(t,e[n+o]?.level??1/0)),1/0);f&&(d(!e[n+0]||!e[n+2]||p(e[n+0],e[n+2],i.SOUTH_WEST)),d(!e[n+1]||!e[n+3]||p(e[n+1],e[n+3],i.NORTH_WEST)));let r=0,a=0;for(let i=0;i<4;++i){const t=e[n+i];if(t&&t.level===o){const e=0===i||1===i,n=0===i||3===i,o=t.extent,c=o[e?0:2],l=o[n?1:3],u=t.renderData?.geometryState?.samplerData;a+=s(c,l,u),r++}}const c=r?a/r:0;return d(null!=c),c}function te(e){const{vao:t,geometry:n}=e,{vertexAttributes:o,edgeVerticesStartIndex:s}=n,r=o.position.typedBuffer;t.vertexBuffers.geometry.setSubData(r,s,s,r.length)}function ne(e){const{vao:t,geometry:n}=e,{indices:o,indexCount:s,edgeIndicesStartIndex:r}=n;t.indexBuffer.setSubData(o,r,r,s)}class oe{constructor(e,t,n,o,s){this.isNorth=e,this.connectedRowOffset=t,this.connectedOuterEdgeOffset=n,this.rowOffset=o,this.latitudeResolution=s}}const se=[[0,1],[1,0],[0,-1],[-1,0]],re=new c,ie=o(-1/0,-1/0,1/0,1/0),ae=[null,null,null,null];function ce(e,t,n){if(!t)return!1;const o=x(e,t);return o>0||0===o&&n>=2}class le{constructor(){this.vertex0Index=0,this.stride=1,this.count=0}getVertexIndex(e){return d(0<=e&&e<this.count),this.vertex0Index+this.stride*e}}const ue=[new le,new le,new le,new le];function de(e,t,n,o){e<o[0]?o[0]=e:e>o[3]&&(o[3]=e),t<o[1]?o[1]=t:t>o[4]&&(o[4]=t),n<o[2]?o[2]=n:n>o[5]&&(o[5]=n)}function fe(e){const{edgeResolutions:t,numVerticesPerSide:n}=e,o=1+Math.max(...t);return Math.max(n,o)}function me(e,t,n,o,s,r){const i=e*s,a=r[i],c=r[i+1],l=r[i+2],u=t*s,d=r[u],f=r[u+1],m=r[u+2],g=n*s,p=r[g],x=r[g+1],h=r[g+2],M=o*s,S=r[M],y=r[M+1],v=r[M+2];return(d-S)*(d-S)+(f-y)*(f-y)+(m-v)*(m-v)>(a-p)*(a-p)+(c-x)*(c-x)+(l-h)*(l-h)}function ge(e,t,n,o,s){e[t]=n,e[t+1]=o,e[t+2]=o,e[t+3]=s,e[t+4]=s,e[t+5]=n}const pe=6;export{T as createPlanarGlobePatch,S as createSphericalGlobePatch,V as updateCornerSpherical,R as updateCornersPlanar,U as updateEdgeElevationsAndResolutionsPlanar,I as updateEdgeElevationsAndResolutionsSpherical,N as updateEdgesAndCornersPlanar,B as updateEdgesAndCornersSpherical};
|
|
5
|
+
import{isPowerOfTwo as e,clamp as t}from"../../../core/mathUtils.js";import{empty as n}from"../../../geometry/support/aaBoundingBox.js";import{fromValues as o}from"../../../geometry/support/aaBoundingRect.js";import{sampleElevation as s}from"./ElevationData.js";import{PatchType as r}from"./interfaces.js";import{NeighborIndex as i}from"./NeighborIndex.js";import{encodeUVInBuffer as a}from"./PatchGeometry.js";import{PatchGeometryLUT as c}from"./PatchGeometryLUT.js";import{neighborTileIfLoadedOrSelf as l,zeroToFour as u}from"./PatchRenderData.js";import{internalAssert as d,enableTerrainInternalChecks as f,neighborEdgeIndices as m,almostEquals as g}from"./terrainUtils.js";import{isCornerNeighbor as p}from"./Tile.js";import{compareTilesByLij as x}from"./tileUtils.js";import{compressNormal as h}from"../webgl-engine/lib/Normals.js";const M=65536;function S(e,t){const{tile:o,geometry:s,geometryState:i}=e,{extentInRadians:a,surface:c}=o,{isWebMercator:l,renderer:u}=c,{numVerticesPerSide:d,wireframe:f}=i,m=d-1,g=(d-2)**2,p=l&&(t===r.HAS_SOUTH_POLE||t===r.HAS_BOTH_POLES),x=l&&(t===r.HAS_NORTH_POLE||t===r.HAS_BOTH_POLES),h=((p?1:0)+(x?1:0))*pe*d,M=fe(i),S=g+h+4*M,B=u.tileGeometryCache.acquire(S);s.numVerticesPerSide=d,s.vertexAttributes=B,s.maxEdgeVertexCount=M;const{boundingBox:I}=s;n(I);const V=O(e);re.update(m,a,V),v(e),s.poleVerticesStartIndex=g;const L=y(e,p,x);s.edgeVerticesStartIndex=g+h,X(e),b(e),W(s,L,f),e.intersectionData=null}function y(e,t,n){const{tile:o,localOrigin:s,geometry:r}=e,{extent:i,ellipsoid:c}=o,{boundingBox:l,numVerticesPerSide:u,vertexAttributes:d,poleVerticesStartIndex:f}=r,m=u-1,g=s[0],p=s[1],x=s[2],M=c.radius,S=i[1],y=i[3],v=[];let B=f;const I=(e,t)=>{const n=t*u;de(-g,-p,e*M-x,l),v.push(new oe(1===e,n,1===e?0:2,B,pe));const o=P(-1===e?S:y,M),s=e*Math.PI/2-o,r=.99*(1===e?1:-1),i=M+0,{position:c,uv0:f}=d,{typedBuffer:I,typedBufferStride:V}=d.normalCompressed;for(let u=1;u<=pe;++u){const e=o+s*(u/pe),t=Math.cos(e),n=Math.sin(e);for(let o=0;o<=m;o++){const e=o/m,s=re.sinLonLUT[o],u=re.cosLonLUT[o]*t,d=s*t,M=n,S=u*i-g,y=d*i-p,v=M*i-x;de(S,y,v,l),c.setValues(B,S,y,v),a(f,B,e,r),h(I,B,u,d,M,V),++B}}};return t&&I(-1,0),n&&I(1,m),v}function v(e){const{tile:t}=e;if(!t.intersectsClippingArea)return;const{geometry:n,geometryState:o,localOrigin:r}=e,{numVerticesPerSide:i,samplerData:c}=o,l=i-2,u=i-1,{vertexAttributes:d,boundingBox:f}=n,m=d.position,g=d.uv0,{typedBuffer:p,typedBufferStride:x}=d.normalCompressed,{extent:M}=t,S=M[0],y=M[2],v=M[1],B=M[3],I=t.ellipsoid.radius,V=r[0],b=r[1],L=r[2],C=m.typedBuffer,P=m.typedBufferStride,A=1/u;let E=0;if(1<=l){const e=A,t=v*(1-e)+B*e,n=re.sinLatLUT[1],o=re.cosLatLUT[1];for(let r=1;r<=l;r++){const i=r*A,l=S*(1-i)+y*i,u=re.sinLonLUT[r],d=re.cosLonLUT[r],m=I+s(l,t,c),p=m*d*o-V,x=m*u*o-b,h=m*n-L;de(p,x,h,f);const M=(r-1)*P;C[M]=p,C[M+1]=x,C[M+2]=h,a(g,r-1,i,e)}}for(let O=1;O<=l;O++){const e=O*A,t=v*(1-e)+B*e,n=re.sinLatLUT[O],o=re.cosLatLUT[O],r=O+1,i=r*A,d=v*(1-i)+B*i,m=re.sinLatLUT[r],M=re.cosLatLUT[r],T=re.sinLonLUT[0],D=re.cosLonLUT[0],R=I+s(S,t,c);let U=D*o*R-V,N=T*o*R-b,w=n*R-L;const j=E*P;let F=C[j],H=C[j+1],q=C[j+2];for(let B=1;B<=l;B++){const e=B*A,r=S*(1-e)+y*e,T=re.sinLonLUT[B],D=re.cosLonLUT[B];let R=0,j=0,_=0;if(B<l){const e=(E+1)*P;R=C[e],j=C[e+1],_=C[e+2]}else{const e=re.sinLonLUT[u],r=re.cosLonLUT[u],i=I+s(y,t,c);R=r*o*i-V,j=e*o*i-b,_=n*i-L}const W=U,G=N,k=w;U=F,N=H,w=q,F=R,H=j,q=_;const z=R-W,J=j-G,K=_-k;let Q=0,X=0,Y=0;if(O>1){const e=(E-l)*P;Q=C[e],X=C[e+1],Y=C[e+2]}else{const e=re.sinLatLUT[0],t=re.cosLatLUT[0],n=I+s(r,v,c);Q=D*t*n-V,X=T*t*n-b,Y=e*n-L}const Z=I+s(r,d,c),$=D*M*Z-V,ee=T*M*Z-b,te=m*Z-L;if(O<l){const t=E+l,n=t*P;C[n]=$,C[n+1]=ee,C[n+2]=te,de($,ee,te,f),a(g,t,e,i)}const ne=Q-$,oe=X-ee,se=Y-te;let ie=D*o,ae=T*o,ce=n;ce*ce<.999&&(ie=K*oe-J*se,ae=z*se-K*ne,ce=J*ne-z*oe);const le=1/Math.sqrt(ie*ie+ae*ae+ce*ce);h(p,E,ie*le,ae*le,ce*le,x),++E}}}function B(e){e.tile.intersectsClippingArea&&(b(e),te(e),e.intersectionData=null)}function I(e){e.tile.intersectsClippingArea&&(Y(e),b(e),te(e),ne(e),e.intersectionData=null)}function V(e){e.tile.intersectsClippingArea&&(C(e),L(e,!0),te(e),e.intersectionData=null)}function b(e){e.tile.intersectsClippingArea&&(C(e),L(e))}function L(t,n=!1){const{geometry:o,geometryState:r,tile:i,localOrigin:c}=t,{level:u,extent:p,extentInRadians:h,ellipsoid:M}=i,S=M.radius,y=h[0],v=h[2],B=h[1],I=h[3],{samplerData:V}=r,b=p[0],L=p[2],C=p[1],P=p[3],A=O(t),{boundingBox:E,vertexAttributes:T}=o,D=c[0],R=c[1],U=c[2],N=T.position,w=N.typedBuffer,j=N.typedBufferStride,F=T.uv0;for(let O=0;O<4;++O){const c=1===O||3===O,h=r.edgeResolutions[O];d(e(h));const M=h+1,T=l(i,r.edgePeerNeighbors[O]);if(ce(i,T,O)){Z(t,O,T);continue}const N=null!=T;d(!N||T.level===i.level),d(!N||x(i,T)<=0);const H=T?.renderData,q=H?.geometryState;if(f){const e=i.surface;if(!T&&e&&!e.updatingRootTiles){const t=m[O],n=i.findNeighborTile(t,(e=>e.loaded||e.leaf||e.level===i.level));n?n.intersectsClippingArea&&(d(!n.loaded),d(!n.leaf),d(n.level===u)):d(null==e?.rootTiles||!i.shouldHaveNeighbor(t))}}const _=1===O?p[2]:p[0],W=T?.extent,G=W&&c?1===O?W[0]:W[2]:_,k=0===O?p[3]:p[1],z=1===O?1:0,J=0===O?1:0,K=1===O?v:y,Q=0===O?I:B,X=Math.sin(K),Y=Math.cos(K),$=Math.sin(Q),ee=Math.cos(Q),te=q?.samplerData,ne=N?(e,t,n)=>.5*(s(e,t,V)+s(n,t,te)):(e,t,n)=>s(e,t,V),oe=o.outerEdgesOffsetAndLength[2*O+0],se=n&&M>3?M-3:1,re=null!=V&&V.some((e=>null!=e)),ie=null!=te&&te.some((e=>null!=e)),ae=re||ie,le=1/h,ue=oe;d(!W||g(W[2]-W[0],p[2]-p[0]));(()=>{const e=1===O?-1:3===O?1:0,t=0===O?-1:2===O?1:0,n=(p[2]-p[0])*le,r=e*n,i=t*n,l=c?e*((v-y)*le):0,u=c?0:t*le,d=J,f=c?K+l:K,m=c?Math.sin(f):X,g=c?Math.cos(f):Y,x=c?K-l:K,h=c?Math.sin(x):X,B=c?Math.cos(x):Y,I=c?Q:A(d+u),T=c?$:Math.sin(I),H=c?ee:Math.cos(I),q=c?Q:A(d-u),W=c?$:Math.sin(q),Z=c?ee:Math.cos(q);let oe=0,re=0,ie=0;{const e=0*le,t=c?_:b*(1-e)+L*e,n=c?G:t,o=c?C*(1-e)+P*e:k,s=c?K:y*(1-e)+v*e,r=c?X:Math.sin(s),i=c?Y:Math.cos(s),a=c?A(e):Q,l=c?Math.sin(a):$,u=c?Math.cos(a):ee,d=S+ne(t,o,n);oe=i*u*d,re=r*u*d,ie=l*d}let ce=0,fe=0,me=0;{const e=1*le,t=c?_:b*(1-e)+L*e,n=c?G:t,o=c?C*(1-e)+P*e:k,s=c?K:y*(1-e)+v*e,r=c?X:Math.sin(s),i=c?Y:Math.cos(s),a=c?A(e):Q,l=c?Math.sin(a):$,u=c?Math.cos(a):ee,d=S+ne(t,o,n);ce=i*u*d,fe=r*u*d,me=l*d}for(let p=1;p<M-1;p+=se){let e=0,t=0,n=0;{const o=(p+1)*le,s=c?_:b*(1-o)+L*o,r=c?G:s,i=c?C*(1-o)+P*o:k,a=c?K:y*(1-o)+v*o,l=c?X:Math.sin(a),u=c?Y:Math.cos(a),d=c?A(o):Q,f=c?Math.sin(d):$,m=c?Math.cos(d):ee,g=S+ne(s,i,r);e=u*m*g,t=l*m*g,n=f*g}const l=e,u=t,d=n,f=ce,x=fe,M=me;ce=l,fe=u,me=d;{const e=ue+p,t=e*j,n=f-D,o=x-R,s=M-U;w[t]=n,w[t+1]=o,w[t+2]=s,de(n,o,s,E);const r=p*le;a(F,e,c?z:r,c?r:J)}const I=oe,q=re,se=ie;oe=f,re=x,ie=M;const ge=f,pe=x,xe=M,he=1/Math.sqrt(ge*ge+pe*pe+xe*xe),Me=xe*he;let Se=0,ye=0,ve=0;if(ae&&Me*Me<.999){let e=0,t=0,n=0;{const o=0===O?-1:1;e=o*(l-I),t=o*(u-q),n=o*(d-se)}{const o=p*le,a=c?_:b*(1-o)+L*o,l=c?G:a,u=c?C*(1-o)+P*o:k,d=c?K:y*(1-o)+v*o,f=c?X:Math.sin(d),x=c?Y:Math.cos(d),M=c?A(o):Q,I=c?Math.sin(M):$,E=c?Math.cos(M):ee;let D=ge,R=pe,U=xe;if(N){const e=S+s(l-r,u-i,te),t=c?E:Z;D=(c?B:x)*t*e,R=(c?h:f)*t*e,U=(c?I:W)*e}{const o=S+s(a+r,u+i,V),l=c?E:H,d=(c?g:x)*l*o,p=(c?m:f)*l*o,h=(c?I:T)*o;N||(D=2*ge-d,R=2*pe-p,U=2*xe-h);const M=3===O?-1:1,y=M*(D-d),v=M*(R-p),B=M*(U-h);Se=n*v-t*B,ye=e*B-n*y,ve=t*y-e*v;const b=1/Math.sqrt(Se*Se+ye*ye+ve*ve);Se*=b,ye*=b,ve*=b}}}else Se=ge*he,ye=pe*he,ve=xe*he;o.setEdgeNormalFromValues(O,p,Se,ye,ve)}})()}}function C(e){$(e)}function P(e,t){return Math.PI/2-2*Math.atan(Math.exp(-e/t))}function A(e,t,n,o){return P(e*(1-o)+t*o,n)}function E(e,t,n){return e*(1-n)+t*n}function O(e){const{tile:t}=e;if(t.surface.isWebMercator){const e=t.extent,n=t.ellipsoid.radius;return t=>A(e[1],e[3],n,t)}const n=t.extentInRadians;return e=>E(n[1],n[3],e)}function T(e,t){const{tile:o,geometryState:s,geometry:r}=e,{extent:i,surface:a}=o,{wireframe:c}=s,l=i[0],u=i[1],d=i[2]-l,f=i[3]-u,{numVerticesPerSide:m,clippingArea:g}=s,p=null!=g?Math.max(0,(g[0]-l)/d):0,x=null!=g?Math.max(0,(g[1]-u)/f):0,h=null!=g?Math.min(1,(g[2]-l)/d):1,M=null!=g?Math.min(1,(g[3]-u)/f):1,S=(m-2)**2,y=fe(s),v=S+4*y,B=a.renderer.tileGeometryCache.acquire(v),{boundingBox:I}=r;n(I),r.numVerticesPerSide=m,r.vertexAttributes=B,r.maxEdgeVertexCount=y,r.minu=p,r.minv=x,r.maxu=h,r.maxv=M,D(e),r.edgeVerticesStartIndex=S,X(e),w(e),W(r,[],c),e.intersectionData=null}function D(e){const n=e.tile;if(!n.intersectsClippingArea)return;const{geometry:o,geometryState:r,localOrigin:i}=e,{samplerData:c,clippingArea:l,numVerticesPerSide:u}=r,{surface:d,extent:f,ellipsoid:m}=n,{isWebMercatorOnPlateCarree:g}=d,p=null!=l?l:ie,x=f[0],M=f[1],S=f[2],y=f[3],v=Math.max(x,p[0]),B=Math.min(S,p[2]),I=Math.max(M,p[1]),V=Math.min(y,p[3]),b=m.radius,L=n.horizontalScale,C=u-1,P=u-2,{minu:A,minv:E,maxu:O,maxv:T,boundingBox:D,vertexAttributes:R}=o,U=R.position,N=R.uv0,{typedBuffer:w,typedBufferStride:j}=R.normalCompressed,F=i[0],H=i[1],q=i[2],_=U.typedBuffer,W=U.typedBufferStride;let G=0;const k=t(M,I,V),z=g?(Math.PI/2-2*Math.atan(Math.exp(-k/b)))*b:k*L,J=1/C,K=t(M*(1-J)+y*J,I,V);let Q=z,X=g?(Math.PI/2-2*Math.atan(Math.exp(-K/b)))*b:K*L;for(let Y=1;Y<=P;Y++){const e=Y/C,n=t(M*(1-e)+y*e,I,V),o=t(e,E,T),r=X,i=(Y-1)/C,l=t(M*(1-i)+y*i,I,V),u=Q,d=(Y+1)/C,f=t(M*(1-d)+y*d,I,V),m=g?(Math.PI/2-2*Math.atan(Math.exp(-f/b)))*b:f*L,p=t(d,E,T);Q=X,X=m;const R=t(x,v,B);let U=R*L,k=s(R,n,c);const z=1/C,J=t(z,A,O),K=t(x*(1-J)+S*J,v,B);let Z=J,$=K,ee=K*L,te=s(K,n,c);if(1===Y){const e=ee-F,n=Q-H,s=te-q,r=0*W;_[r]=e,_[r+1]=n,_[r+2]=s,de(e,n,s,D);const i=t(z,A,O);a(N,G,i,o)}for(let g=1;g<=P;g++){const e=ee,i=te,d=(g+1)/C,M=t(d,A,O),y=t(x*(1-d)+S*d,v,B),I=$;$=y;{const e=G+1,t=e*W;if(1===Y||g===P){const i=y*L,l=s(y,n,c);if(1===Y&&g<P){const n=i-F,s=r-H,c=l-q;_[t]=n,_[t+1]=s,_[t+2]=c,de(n,s,c,D),a(N,e,M,o)}ee=i,te=l}else ee=_[t]+F,te=_[t+2]+q}const V=ee,b=te,E=U,T=k;U=e,k=i;const R=(G-P)*W,z=1===Y?s(I,l,c):_[R+2]+q,J=s(I,f,c);if(Y<P){const t=G+P,n=t*W,o=e-F,s=m-H,r=J-q;_[n]=o,_[n+1]=s,_[n+2]=r,de(o,s,r,D);const i=Z;Z=M,a(N,t,i,p)}{const e=V-E,t=u-m,n=t*(b-T),o=e*(z-J),s=-t*e,r=n*n+o*o+s*s;if(0===r)h(w,G,0,0,1,j);else{const e=1/Math.sqrt(r);h(w,G,n*e,o*e,s*e,j)}}++G}}}function R(e,t){e.tile.intersectsClippingArea&&(F(e),j(e,!0),te(e),e.intersectionData=null)}function U(e,t){e.tile.intersectsClippingArea&&(Y(e),w(e),te(e),ne(e),e.intersectionData=null)}function N(e,t){e.tile.intersectsClippingArea&&(w(e),te(e),e.intersectionData=null)}function w(e,t){e.tile.intersectsClippingArea&&(F(e),j(e,!1))}function j(n,o){const{geometry:r,geometryState:i,localOrigin:a}=n,c=n.tile,{surface:u,extent:g}=c,{clippingArea:p,samplerData:h}=i,M=null!=p?p:ie,S=g[0],y=g[2],v=g[1],B=g[3],I=[B>M[3],y>M[2],v<M[1],S<M[0]],V=c.horizontalScale,b=_(u.isWebMercatorOnPlateCarree,c.ellipsoid.radius,V),{minu:L,minv:C,maxu:P,maxv:A,boundingBox:E}=r,O=Math.max(S,M[0]),T=Math.min(y,M[2]),D=Math.max(v,M[1]),R=Math.min(B,M[3]),U=a[0],N=a[1],w=a[2];for(let j=0;j<4;++j){const a=1===j||3===j,g=i.edgeResolutions[j];d(e(g));const p=g+1,M=I[j],F=l(c,i.edgePeerNeighbors[j]);if(!M&&ce(c,F,j)){Z(n,j,F);continue}const H=null!=F&&!M,q=F?.renderData,_=q?.geometryState;if(f&&(d(!H||F.level===c.level),d(!H||x(c,F)<=0),c&&!F&&!u.updatingRootTiles)){const e=m[j],t=c.findNeighborTile(e,(e=>e.loaded||e.leaf||e.level===c.level));u.updatingRootTiles||(t?t.intersectsClippingArea&&(d(!t.loaded),d(!t.leaf),d(t.level===c.level)):d(null==u?.rootTiles||!c.shouldHaveNeighbor(e)))}const W=t(1===j?y:S,O,T),G=t(0===j?B:v,D,R),k=_?.samplerData,z=o&&p>3?p-3:1,J=t(1===j?1:0,L,P),K=t(0===j?1:0,C,A),Q=H?(e,t)=>.5*(s(e,t,k)+s(e,t,h)):(e,t)=>s(e,t,h),X=(y-S)/g,Y=a?1===j?X:-X:0,$=a?0:0===j?X:-X,ee=-Y,te=-$;let ne=0,oe=0,se=0;{const e=0/g,n=a?W:t(S*(1-e)+y*e,O,T),o=a?t(v*(1-e)+B*e,D,R):G,s=Q(n,o);ne=n*V,oe=b(o),se=s}let re=0,ie=0,ae=0;{const e=1/g,n=a?W:t(S*(1-e)+y*e,O,T),o=a?t(v*(1-e)+B*e,D,R):G,s=Q(n,o);re=n*V,ie=b(o),ae=s}for(let e=1;e<p-1;e+=z){const n=e/g,o=re,i=ie,c=ae;{const s=a?J:t(n,L,P),l=a?t(n,C,A):K,u=o-U,d=i-N,f=c-w;de(o,d,f,E),r.setEdgeVertexFromValuesRawPositionUV(j,e,u,d,f,s,l)}{const n=(e+1)/g,o=a?W:t(S*(1-n)+y*n,O,T),s=a?t(v*(1-n)+B*n,D,R):G,r=Q(o,s);re=o*V,ie=b(s),ae=r}const l=re,u=ae,d=ne,f=oe,m=se;ne=o,oe=i,se=c;let p=0,x=0,M=0;if(a){const e=ie-i,r=u-c,a=f-i,l=m-c,d=t(v*(1-n)+B*n,D,R),g=W+ee,S=g*V-o,y=s(g,d,h)-c,I=3===j?-1:1;if(p=I*(-a+e)*y,x=I*S*(-l+r),M=-I*S*(-a+e),H){const t=W+Y,n=t*V-o;p=(-a+e)*(y-(s(t,d,k)-c)),x=(S-n)*(-l+r),M=-(S-n)*(-a+e)}}else{const e=l-o,r=u-c,a=d-o,f=m-c,g=t(S*(1-n)+y*n,O,T),v=G+te,B=s(g,v,h)-c,I=b(v)-i,V=2===j?-1:1;if(p=V*I*(-f+r),x=V*(-a+e)*B,M=-V*I*(-a+e),H){const t=g,n=G+$,o=b(n)-i;p=(-I+o)*(-f+r),x=(-a+e)*(-B+(s(t,n,k)-c)),M=-(-I+o)*(-a+e)}}const I=1/Math.sqrt(p*p+x*x+M*M);r.setEdgeNormalFromValues(j,e,p*I,x*I,M*I)}}}function F(e,t){$(e)}function H(e,t){return(Math.PI/2-2*Math.atan(Math.exp(-e/t)))*t}function q(e,t){return e*t}function _(e,t,n){return e?e=>H(e,t):e=>q(e,n)}function W(e,t,n){const{numVerticesPerSide:o,vertexAttributes:s,maxEdgeVertexCount:r}=e,i=o-1,a=s.count,c=2*(o-3)*(o-3),l=4*(i+r-3),d=u.reduce(((t,n)=>t+(i+e.getEdgeCount(n)-3)),0),f=t.reduce(((e,t)=>e+i*(2*(t.latitudeResolution-1)+1)),0),m=3*(n?2:1),g=(c+l+f)*m,p=a>=M?new Uint32Array(g):new Uint16Array(g);for(let u=0;u<g;++u)p[u]=0;e.indices=p,e.indexCount=(c+d+f)*m,e.poleIndicesStartIndex=c*m,e.edgeIndicesStartIndex=(c+f)*m,n?(J(e),K(e,t),Q(e)):(G(e),k(e,t),z(e))}function G(e){const{numVerticesPerSide:t,indices:n,vertexAttributes:o}=e,{position:s}=o,{typedBuffer:r,typedBufferStride:i}=s,a=t-2,c=t-3,l=0,u=t-3;let d=0;for(let f=0;f<c;++f){const e=f*a;for(let t=l;t<u;++t){const o=e+t,s=o+1,c=s+a,l=c-1;me(o,s,c,l,i,r)?(n[d]=o,n[d+1]=s,n[d+2]=c,n[d+3]=c,n[d+4]=l,n[d+5]=o):(n[d]=o,n[d+1]=s,n[d+2]=l,n[d+3]=l,n[d+4]=s,n[d+5]=c),d+=6}}}function k(e,t){const{numVerticesPerSide:n,indices:o,poleIndicesStartIndex:s}=e,r=n-1;let i=s;for(const a of t){const t=a.isNorth?1:2,s=a.isNorth?2:1,c=a.isNorth?3:4,l=a.isNorth?4:3;let u=e.getEdgeVertexIndex(a.connectedOuterEdgeOffset,0),d=1;for(let e=0;e<a.latitudeResolution;++e){const f=0===e?a.rowOffset:u+n;for(let n=0;n<r;n++){const r=f+n;o[i]=u,o[i+t]=u+1,o[i+s]=r,e<a.latitudeResolution-1?(o[i+c]=u+1,o[i+l]=r+1,o[i+5]=r,i+=6):i+=3,u+=d}u=f,d=1}}}function z(e){const{indices:t,numVerticesPerSide:n,edgeIndicesStartIndex:o}=e,s=n-1,r=s-2;let i=o;for(let a=0;a<4;++a){const n=ue[a];let o=0,c=0;const l=e.getEdgeCount(a),u=n.count;d(u===s-1);const f=1===a||2===a,m=f?1:2,g=f?2:1,p=e.getEdgeFirstVertexIndex(a),x=1,h=n.vertex0Index,M=n.stride;for(;o<l-1||c<u-1;){const e=h+c*M,n=p+o*x,a=o<l-1,d=c<u-1,f=a&&(!d||(a?0+s*(o+.5)/(l-1):0)<=(d?1+r*(c+.5)/(u-1):0));f?++o:++c;const S=f?n+x:e+M;t[i]=e,t[i+m]=n,t[i+g]=S,i+=3}}e.indexCount=i}function J(e){const{indices:t,numVerticesPerSide:n,vertexAttributes:o}=e,{position:s}=o,{typedBuffer:r,typedBufferStride:i}=s,a=n-2;let c=0;for(let l=0;l<n-3;++l){const e=l*a;for(let o=0;o<n-3;++o){const n=l*a+o,s=n+1,u=s+a,d=u-1,f=e+o,m=f+1,g=m+a;me(f,m,g,g-1,i,r)?(ge(t,c,n,s,u),c+=6,ge(t,c,u,d,n)):(ge(t,c,n,s,d),c+=6,ge(t,c,d,u,s)),c+=6}}}function K(e,t){const{indices:n,numVerticesPerSide:o,poleIndicesStartIndex:s}=e,r=o-1;let i=s;for(const a of t){const t=a.connectedOuterEdgeOffset;let s=e.getEdgeVertexIndex(t,0),c=1;for(let e=0;e<a.latitudeResolution;++e){const t=0===e?a.rowOffset:s+o;for(let o=0;o<r;o++)ge(n,i,s,s+1,t+o),i+=6,e<a.latitudeResolution-1&&(ge(n,i,s+1,t+o+1,t+o),i+=6),s+=c;s=t,c=1}}}function Q(e){const{indices:t,numVerticesPerSide:n,edgeIndicesStartIndex:o}=e,s=n-1,r=s-2;let i=o;for(let a=0;a<4;++a){const n=ue[a];let o=0,c=0;const l=e.getEdgeCount(a),u=n.count;d(u===s-1);const f=1===a||2===a,m=f?1:3,g=f?3:1,p=e.getEdgeFirstVertexIndex(a),x=1,h=n.vertex0Index,M=n.stride;for(;o<l-1||c<u-1;){const e=h+c*M,n=p+o*x,a=o<l-1,d=c<u-1,f=a&&(!d||(a?0+s*(o+.5)/(l-1):0)<=(d?1+r*(c+.5)/(u-1):0));f?++o:++c;const S=f?n+x:e+M;t[i]=e,t[i+m]=n,t[i+m+1]=n,t[i+g]=S,t[i+g+1]=S,t[i+5]=e,i+=6}}e.indexCount=i}function X(e){const{geometry:t,geometryState:n}=e,{edgeResolutions:o}=n,{numVerticesPerSide:s,edgeVerticesStartIndex:r}=t,i=s-2;let a=r;for(let c=0;c<4;++c){{const e=0===c||2===c,t=(0===c?i-1:0)*i+(1===c?i-1:0),n=(e?0:1)*i+(e?1:0),o=ue[c];o.vertex0Index=t,o.stride=n,o.count=i}{const e=o[c]+1;t.outerEdgesOffsetAndLength[2*c+0]=a,t.outerEdgesOffsetAndLength[2*c+1]=e,a+=e}}}function Y(e){X(e),e.geometryState.wireframe?Q(e.geometry):z(e.geometry)}function Z(n,o,s){const{geometryState:r,geometry:i,tile:c,localOrigin:l}=n,u=1===o||3===o,f=r.edgeResolutions[o];d(e(f));const m=f+1,{boundingBox:g,minu:p,minv:x,maxu:h,maxv:M,vertexAttributes:S}=i,y=t(1===o?1:0,p,h),v=t(0===o?1:0,x,M),B=s.renderData,I=B.geometryState,V=B.geometry,b=(o+2)%4,L=V.getEdgeCount(b),C=c.getNeighborEdgeStartVertexIndex(o,s)*f,P=f*2**(c.level-s.level);d(I.edgeResolutions[b]===P),d(L-1===P);const A=B.localOrigin[0]-l[0],E=B.localOrigin[1]-l[1],O=B.localOrigin[2]-l[2],T=i.getEdgeFirstVertexIndex(o),D=S.position,R=D.typedBuffer,U=D.typedBufferStride,N=S.normalCompressed,w=N.typedBuffer,j=N.typedBufferStride,F=S.uv0,H=V.vertexAttributes,q=V.getEdgeFirstVertexIndex(b),_=H.position.typedBuffer,W=H.position.typedBufferStride,G=H.normalCompressed.typedBuffer,k=H.normalCompressed.typedBufferStride;for(let e=1;e<m-1;++e){const n=T+e,o=q+(C+e),s=n*U,r=o*W,i=_[r]+A,c=_[r+1]+E,l=_[r+2]+O;R[s]=i,R[s+1]=c,R[s+2]=l,de(i,c,l,g);const d=n*j,m=o*k;w[d]=G[m],w[d+1]=G[m+1];const S=e/f,B=u?y:t(S,p,h),I=u?t(S,x,M):v;a(F,n,B,I)}}function $(e){const{geometry:n,geometryState:o,localOrigin:r}=e,{clippingArea:i,samplerData:c}=o,{minu:l,minv:u,maxu:f,maxv:m,boundingBox:g,vertexAttributes:p}=n,h=e.tile,{surface:M,ellipsoid:S,extent:y,extentInRadians:v,horizontalScale:B}=h,I="local"===M.view?.viewingMode,V=S.radius;let b=0,L=0,C=0;const P=(e,t,n)=>{const o=v[0===t?1:3],s=v[0===e?0:2],r=Math.cos(o),i=Math.sin(o),a=Math.sin(s),c=Math.cos(s),l=V+n;b=c*r*l,L=a*r*l,C=i*l},A=I?(()=>{const e=i,n=null!=e&&(y[3]>e[3]||y[2]>e[2]||y[1]<e[1]||y[0]<e[0]),o=_(M.isWebMercatorOnPlateCarree,V,B);return(s,r,i)=>{const a=0===s?y[0]:y[2],c=0===r?y[1]:y[3],l=n?t(a,e[0],e[2]):a,u=n?t(c,e[1],e[3]):c,d=i;b=l*B,L=o(u),C=d}})():P;let E=0,T=0,D=0,R=0,U=0,N=0,w=0,j=0,F=0;const H=I&&M.isWebMercatorOnPlateCarree,q=(e,t,n,o,s)=>{let r=0,i=0,a=0;if(I){const e=t*B,s=H?(Math.PI/2-2*Math.atan(Math.exp(-n/V)))*V:n*B;r=e-b,i=s-L,a=o-C}else{const s=O(e),c=e.tile,l=c.extent,u=c.extentInRadians,d=(t-l[0])/(l[2]-l[0]),f=(n-l[1])/(l[3]-l[1]),m=u[0]*(1-d)+u[2]*d,g=s(f),p=Math.cos(g),x=Math.sin(g),h=Math.sin(m),M=Math.cos(m),S=V+o;r=M*p*S-b,i=h*p*S-L,a=x*S-C}switch(s){case 0:w+=r,j+=i,F+=a;break;case 1:R-=r,U-=i,N-=a;break;case 2:w-=r,j-=i,F-=a;break;case 3:R+=r,U+=i,N+=a}},W=i??ie,G=y[0],k=y[2],z=y[1],J=y[3],K=[J>W[3],k>W[2],z<W[1],G<W[0]],Q=Math.max(G,W[0]),X=Math.min(k,W[2]),Y=Math.max(z,W[1]),Z=Math.min(J,W[3]),$=e=>Math.max(W[0],Math.min(W[2],e)),te=e=>Math.max(W[1],Math.min(W[3],e)),ne=e=>{const t=o.cornerNeighborCornerTiles;E=0,T=0,D=1,R=0,U=0,N=0,w=0,j=0,F=0;let n=1/0;for(let o=0;o<4;++o){const s=t[4*e+o];n=Math.min(n,s?.level??1/0)}for(let o=0;o<4;++o){const s=t[4*e+o];ae[o]=s?.level===n?s:null}let r=1,i=0;for(let o=0;o<4;++o){const e=ae[o];e&&(r=Math.max(r,e?.renderData.geometryState.numVerticesPerSide),i=e.extent[2]-e.extent[0])}const a=i,c=r;d(c>1);const l=a/c;for(let o=0;o<4;++o){const e=ae[(o+3)%4],t=ae[o%4];if(!e&&!t)continue;const n=0===o?1:1===o?2:2===o?3:0,r=0===o?2:1===o?3:2===o?0:1;if(e&&t){const i=se[o][0]*l,a=se[o][1]*l,c=e.extent,u=$(c[0===n||1===n?2:0]+i),d=te(c[0===n||3===n?3:1]+a),f=t.extent,m=$(f[0===r||1===r?2:0]+i),g=te(f[0===r||3===r?3:1]+a),p=e.renderData,x=t.renderData,h=s(u,d,p.geometryState.samplerData),M=s(m,g,x.geometryState.samplerData);q(p,u,d,.5*(h+M),o)}else{const i=e??t,a=e?n:r,c=i.extent,u=se[o],d=$(c[0===a||1===a?2:0]+u[0]*l),f=te(c[0===a||3===a?3:1]+u[1]*l),m=i.renderData,g=s(d,f,m.geometryState.samplerData);q(m,d,f,g,o)}}if(!I){const e=Math.sqrt(b*b+L*L+C*C);E=b/e,T=L/e,D=C/e}if(I||D*D<.999){const e=Math.sqrt(R*R+U*U+N*N);R/=e,U/=e,N/=e;const t=Math.sqrt(w*w+j*j+F*F);w/=t,j/=t,F/=t,E=N*j-U*F,T=R*F-N*w,D=U*w-R*j;const n=1/Math.sqrt(E*E+T*T+D*D);E*=n,T*=n,D*=n}},oe=o.cornerNeighborCornerTiles;for(let O=0;O<4;++O){const e=O,i=(O+1)%4,M=0===O||1===O?1:0,S=0===O||3===O?1:0,y=t(M,l,f),v=t(S,u,m),B=n.getEdgeFirstVertexIndex(e),I=n.getEdgeCount(e),V=0===O||3===O?I-1:0,P=n.getEdgeFirstVertexIndex(i),R=n.getEdgeCount(i),U=0===O||1===O?R-1:0;let N=-1;for(let t=0;t<4;++t){const e=oe[4*O+t],n=oe[4*O+N];e&&(-1===N||x(n,e)>0)&&(N=t)}const w=N,j=oe[4*O+w];if(j!==h){const e=h.level-j.level,t=2**e,n=[j.lij[0]+e,j.lij[1]*t,j.lij[2]*t],s=[n[1]+t===h.lij[1],0===O&&(1===w||0===w&&j!==oe[4*O+3])||1===O&&(0===w||1===w&&j!==oe[4*O+2]),n[1]===h.lij[1]+1,2===O&&(3===w||2===w&&j!==oe[4*O+1])||3===O&&(2===w||3===w&&j!==oe[4*O+0])],i=s.reduce(((e,t)=>e+(t?1:0)),0);d(1===i||2===i);let c=-1,l=-1;const u=j.renderData;if(1===i){const e=s.findIndex((e=>e));d(0<=e&&e<=3),c=(e+2)%4;const t=o.edgeResolutions[e];l=h.getNeighborEdgeStartVertexIndex(e,j)*t+t*(0===e&&0===O||1===e&&0===O||2===e&&1===O||3===e&&3===O?1:0)}else{d(s[1]||s[3]),c=s[1]?3:1;const e=u.geometryState.edgeResolutions[c];l=0===O||3===O?0:e}const f=u.geometry;{const e=B+V,t=P+U,n=f.getEdgeFirstVertexIndex(c)+l,o=f.vertexAttributes,s=u.localOrigin;{const i=o.position,a=i.typedBuffer,c=n*i.typedBufferStride,l=a[c]+s[0]-r[0],u=a[c+1]+s[1]-r[1],d=a[c+2]+s[2]-r[2];de(l,u,d,g);const f=p.position,m=f.typedBuffer;{const t=e*f.typedBufferStride;m[t]=l,m[t+1]=u,m[t+2]=d}{const e=t*f.typedBufferStride;m[e]=l,m[e+1]=u,m[e+2]=d}}const i=p.uv0;a(i,e,y,v),a(i,t,y,v);{const s=o.normalCompressed.typedBuffer,r=n*o.normalCompressed.typedBufferStride,i=p.normalCompressed,a=i.typedBuffer;{const t=e*i.typedBufferStride;a[t]=s[r],a[t+1]=s[r+1]}{const e=t*i.typedBufferStride;a[e]=s[r],a[e+1]=s[r+1]}}}}else{const o=K[e],a=K[i];let l;if(o||a){const e=t(G*(1-M)+k*M,Q,X),n=t(z*(1-S)+J*S,Y,Z);l=s(e,n,c)}else l=ee(oe,O);A(M,S,l),ne(O);const u=b-r[0],d=L-r[1],f=C-r[2];de(u,d,f,g),n.setEdgeVertexFromValuesRawPositionUVNormal(e,V,u,d,f,y,v,E,T,D),n.setEdgeVertexFromValuesRawPositionUVNormal(i,U,u,d,f,y,v,E,T,D)}}for(let t=0;t<4;++t)ae[t]=null}function ee(e,t){const n=4*t,o=u.reduce(((t,o)=>Math.min(t,e[n+o]?.level??1/0)),1/0);f&&(d(!e[n+0]||!e[n+2]||p(e[n+0],e[n+2],i.SOUTH_WEST)),d(!e[n+1]||!e[n+3]||p(e[n+1],e[n+3],i.NORTH_WEST)));let r=0,a=0;for(let i=0;i<4;++i){const t=e[n+i];if(t&&t.level===o){const e=0===i||1===i,n=0===i||3===i,o=t.extent,c=o[e?0:2],l=o[n?1:3],u=t.renderData?.geometryState?.samplerData;a+=s(c,l,u),r++}}const c=r?a/r:0;return d(null!=c),c}function te(e){const{vao:t,geometry:n}=e,{vertexAttributes:o,edgeVerticesStartIndex:s}=n,r=o.position.typedBuffer;t.vertexBuffers.get("geometry").setSubData(r,s,s,r.length)}function ne(e){const{vao:t,geometry:n}=e,{indices:o,indexCount:s,edgeIndicesStartIndex:r}=n;t.indexBuffer.setSubData(o,r,r,s)}class oe{constructor(e,t,n,o,s){this.isNorth=e,this.connectedRowOffset=t,this.connectedOuterEdgeOffset=n,this.rowOffset=o,this.latitudeResolution=s}}const se=[[0,1],[1,0],[0,-1],[-1,0]],re=new c,ie=o(-1/0,-1/0,1/0,1/0),ae=[null,null,null,null];function ce(e,t,n){if(!t)return!1;const o=x(e,t);return o>0||0===o&&n>=2}class le{constructor(){this.vertex0Index=0,this.stride=1,this.count=0}getVertexIndex(e){return d(0<=e&&e<this.count),this.vertex0Index+this.stride*e}}const ue=[new le,new le,new le,new le];function de(e,t,n,o){e<o[0]?o[0]=e:e>o[3]&&(o[3]=e),t<o[1]?o[1]=t:t>o[4]&&(o[4]=t),n<o[2]?o[2]=n:n>o[5]&&(o[5]=n)}function fe(e){const{edgeResolutions:t,numVerticesPerSide:n}=e,o=1+Math.max(...t);return Math.max(n,o)}function me(e,t,n,o,s,r){const i=e*s,a=r[i],c=r[i+1],l=r[i+2],u=t*s,d=r[u],f=r[u+1],m=r[u+2],g=n*s,p=r[g],x=r[g+1],h=r[g+2],M=o*s,S=r[M],y=r[M+1],v=r[M+2];return(d-S)*(d-S)+(f-y)*(f-y)+(m-v)*(m-v)>(a-p)*(a-p)+(c-x)*(c-x)+(l-h)*(l-h)}function ge(e,t,n,o,s){e[t]=n,e[t+1]=o,e[t+2]=o,e[t+3]=s,e[t+4]=s,e[t+5]=n}const pe=6;export{T as createPlanarGlobePatch,S as createSphericalGlobePatch,V as updateCornerSpherical,R as updateCornersPlanar,U as updateEdgeElevationsAndResolutionsPlanar,I as updateEdgeElevationsAndResolutionsSpherical,N as updateEdgesAndCornersPlanar,B as updateEdgesAndCornersSpherical};
|