@arcgis/core 4.33.0-next.20250318 → 4.33.0-next.20250320
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/0b7331613f91a3258352.js +1 -0
- package/assets/esri/core/workers/chunks/2219d970ece5676ca6ee.js +1 -0
- package/assets/esri/core/workers/chunks/3fc18638f8799b85001d.js +1 -0
- package/assets/esri/core/workers/chunks/630a9afdf0523c27ddb6.js +1 -0
- package/assets/esri/core/workers/chunks/657ae4a0461d45044b28.js +1 -0
- package/assets/esri/core/workers/chunks/8063e35dacf8f99471d8.js +1 -0
- package/assets/esri/core/workers/chunks/{e26e8feabf863350af20.js → 9e11307b4cc3b523d178.js} +66 -73
- package/assets/esri/core/workers/chunks/b23d16745674486ddd6c.js +1 -0
- package/assets/esri/core/workers/chunks/bfbb118ae3b4a4ce1c74.js +319 -0
- package/assets/esri/core/workers/chunks/c528a2ca3b1b73df5a5d.js +1 -0
- package/assets/esri/core/workers/chunks/d787474e78360c925fd9.js +1 -0
- package/assets/esri/core/workers/chunks/{7ded83eb64eff069b761.js → d8b903b4147b090576f2.js} +1 -1
- package/assets/esri/core/workers/chunks/e4290719c8afc2a4ee8c.js +1 -0
- package/assets/esri/core/workers/chunks/e5e1f8ac53c70427a60b.js +1 -0
- package/assets/esri/core/workers/chunks/fc9758006a7135c7d9c3.js +1 -0
- package/assets/esri/core/workers/chunks/fef46b841e8369b30227.js +1 -0
- package/assets/esri/libs/dxtEncoder/dxt_encoder.wasm +0 -0
- package/assets/esri/themes/base/widgets/_FeatureFormUtilityNetworkAssociationLayers.scss +20 -0
- 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/HUDMaterial.glsl.js +80 -75
- package/chunks/RibbonLine.glsl.js +37 -37
- package/chunks/ShadowHighlight.glsl.js +2 -2
- package/chunks/Terrain.glsl.js +33 -34
- package/copyright.txt +29 -0
- package/core/typedArrayUtil.js +1 -1
- package/geometry/support/HalfFloatArray.js +5 -0
- package/geometry/support/buffer/BufferView.js +1 -1
- package/geometry/support/buffer/types.js +1 -1
- package/interfaces.d.ts +8 -47
- package/layers/VoxelWasmPerSceneView.js +1 -1
- package/layers/support/rasterFunctions/pixelUtils.js +1 -1
- package/package.json +3 -2
- package/renderers/support/RasterSymbolizer.js +1 -1
- package/support/basemapUtils.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
- package/views/3d/environment/ChapmanAtmosphere.js +1 -1
- package/views/3d/interactive/visualElements/LineVisualElement.js +1 -1
- package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
- package/views/3d/layers/BuildingSceneLayerView3D.js +1 -1
- package/views/3d/layers/BuildingSublayerView3D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/I3SMeshViewLabeler.js +1 -1
- package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/MediaLayerView3D.js +1 -1
- package/views/3d/layers/PointCloudLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.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/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbolCreationContext.js +1 -1
- package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/GraphicsProcessor.js +1 -1
- package/views/3d/layers/graphics/Labeler.js +1 -1
- package/views/3d/layers/graphics/pipeline/Feature3DPipeline.js +1 -1
- package/views/3d/layers/graphics/pipeline/rendering/DirectRenderer.js +1 -1
- package/views/3d/layers/graphics/pipeline/rendering/FeaturePipelineRenderManager.js +1 -1
- package/views/3d/layers/graphics/pipeline/rendering/LodRenderer.js +1 -1
- package/views/3d/layers/graphics/pointUtils.js +1 -1
- package/views/3d/layers/graphics/polygonUtils.js +1 -1
- package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
- package/views/3d/layers/i3s/I3SIntersectionHandler.js +1 -1
- package/views/3d/layers/i3s/Intersector.js +1 -1
- package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
- package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
- package/views/3d/layers/support/Tiles3DIntersectionHandler.js +1 -1
- package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
- package/views/3d/support/buffer/InterleavedLayout.js +1 -1
- package/views/3d/support/buffer/glUtil.js +1 -1
- package/views/3d/support/hitTest.js +1 -1
- package/views/3d/terrain/OverlayRenderTargets.js +1 -1
- package/views/3d/terrain/PatchGeometry.js +1 -1
- package/views/3d/terrain/PatchGeometryFactory.js +1 -1
- package/views/3d/terrain/TerrainAttributes.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/webgl/ManagedColorAttachment.js +1 -1
- package/views/3d/webgl/ManagedDepthAttachment.js +1 -1
- package/views/3d/webgl/ManagedFBO.js +1 -1
- package/views/3d/webgl/ManagedFBOAttachment.js +1 -1
- package/views/3d/webgl/{ManagedFBObject.js → ManagedFBOResource.js} +1 -1
- package/views/3d/webgl/formats.js +1 -1
- package/views/3d/webgl-engine/core/FBOCache.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/ObjectAndLayerIdColor.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js +2 -9
- package/views/3d/webgl-engine/core/shaderLibrary/hud/HUD.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js +6 -6
- package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorNode.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
- package/views/3d/webgl-engine/effects/geometry/RenderOccludedRenderNode.js +1 -1
- package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/Highlight.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/AttributeArray.js +1 -1
- package/views/3d/webgl-engine/lib/DefaultVertexAttributeLocations.js +1 -1
- package/views/3d/webgl-engine/lib/DefaultVertexBufferLayouts.js +1 -1
- package/views/3d/webgl-engine/lib/Geometry.js +1 -1
- package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
- package/views/3d/webgl-engine/lib/IntersectorInterfaces.js +1 -1
- package/views/3d/webgl-engine/lib/IntersectorTarget.js +1 -1
- package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
- package/views/3d/webgl-engine/lib/Object3D.js +1 -1
- package/views/3d/webgl-engine/lib/ObjectAndLayerIdRenderHelper.js +1 -1
- package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
- package/views/3d/webgl-engine/lib/VertexAttribute.js +1 -1
- package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/WebGLLayer.js +1 -1
- package/views/3d/webgl-engine/lib/glUtil3D.js +1 -1
- package/views/3d/webgl-engine/lib/intersectorUtilsConversions.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/InstanceData.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/Intersector.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodResources.js +1 -1
- package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultLayouts.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
- package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/SlicePlaneMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
- package/views/3d/webgl-engine/shaders/HUDMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/PatternTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/Terrain.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/TerrainTechniqueConfiguration.js +1 -1
- package/views/3d/webgl.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/webgl/FramebufferObject.js +1 -1
- package/views/webgl/GLObjectType.js +1 -1
- package/views/webgl/Renderbuffer.js +1 -1
- package/widgets/Editor/AddAssociationWorkflow.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/UpdateWorkflow.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js +1 -1
- package/widgets/FeatureForm/UtilityNetworkAssociationAddAssociationViewModel.js +1 -1
- package/widgets/support/LabeledSwitch.js +1 -1
- package/widgets/support/Selector2D/selectorUtils.js +1 -1
- package/assets/esri/core/workers/chunks/048121d433aa9175348c.js +0 -1
- package/assets/esri/core/workers/chunks/0f4a2bdf5bb2f4303b7f.js +0 -1
- package/assets/esri/core/workers/chunks/147e412de9972da16a1d.js +0 -1
- package/assets/esri/core/workers/chunks/1545bd7d6ac7800c71b6.js +0 -1
- package/assets/esri/core/workers/chunks/2b21152c7e2d9c170ed7.js +0 -1
- package/assets/esri/core/workers/chunks/385dd6466fd967ce3ae9.js +0 -1
- package/assets/esri/core/workers/chunks/534f3d7e4300b662191a.js +0 -1
- package/assets/esri/core/workers/chunks/8d636075e5aa053940fc.js +0 -1
- package/assets/esri/core/workers/chunks/c43c273725b1a33712ec.js +0 -314
- package/assets/esri/core/workers/chunks/c8cd9a3175f516624842.js +0 -1
- package/assets/esri/core/workers/chunks/d630e64463687090db92.js +0 -1
- package/assets/esri/core/workers/chunks/dd6f18bbab50be139d20.js +0 -1
- package/assets/esri/core/workers/chunks/de6864e120243cf0bee8.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.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectPointToVector as r}from"../../../../geometry/projection/projectPointToVector.js";import{containsPoint as t}from"../../../../geometry/support/aaBoundingBox.js";import{getPointOnPath as n,getPathLength as o}from"../../../../geometry/support/coordsUtils.js";import{makeDehydratedPoint as i}from"../../../../layers/graphics/dehydratedPoint.js";import{applyElevationAlignmentForHUD as l}from"./elevationAlignmentUtils.js";import{computeCentroid as s}from"./graphicUtils.js";import{Object3D as c}from"../../webgl-engine/lib/Object3D.js";function a(e,r,t,n,o){if(u(e,r))return null;t.localOrigin=d(e,r);const i=new c({geometries:[t],castShadow:!1,
|
|
5
|
+
import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectPointToVector as r}from"../../../../geometry/projection/projectPointToVector.js";import{containsPoint as t}from"../../../../geometry/support/aaBoundingBox.js";import{getPointOnPath as n,getPathLength as o}from"../../../../geometry/support/coordsUtils.js";import{makeDehydratedPoint as i}from"../../../../layers/graphics/dehydratedPoint.js";import{applyElevationAlignmentForHUD as l}from"./elevationAlignmentUtils.js";import{computeCentroid as s}from"./graphicUtils.js";import{Object3D as c}from"../../webgl-engine/lib/Object3D.js";function a(e,r,t,n,o){if(u(e,r))return null;t.localOrigin=d(e,r);const i=new c({geometries:[t],castShadow:!1,layerViewUid:e.layerViewUid,graphicUid:o,usesVerticalDistanceToGround:!0});return{object:i,sampledElevation:l(i,r,e.elevationProvider,e.renderCoordsHelper,n)}}function p(e,r,t,n){if(u(r,t))return null;return l(e,t,r.elevationProvider,r.renderCoordsHelper,n)}function u(e,n){const o=e.clippingExtent;return!!o&&(r(n,g,e.elevationProvider.spatialReference),!t(o,g))}function m(e,t,n){const o=e.elevationContext,l=n.spatialReference;r(t,g,l),o.centerPointInElevationSR=i(g[0],g[1],t.hasZ?g[2]:0,null!=l?l:null)}function f(e){switch(e.type){case"point":return e;case"polygon":case"extent":return s(e);case"polyline":{const r=e.paths[0];if(!r||0===r.length)return null;const t=n(r,o(r)/2);return i(t[0],t[1],t[2],e.spatialReference)}case"mesh":return e.extent.center}return null}function d(e,t){return r(t,g,e.renderCoordsHelper.spatialReference),e.localOriginFactory.getOrigin(g)}const g=e();export{a as createStageObject,m as extendPointGraphicElevationContext,d as getLocalOriginForPoint,f as placePointOnGeometry,p as updateStageObjectGeometry};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{e as t}from"../../../../chunks/earcut.js";import e from"../../../../geometry/Extent.js";import r from"../../../../geometry/Polygon.js";import{Axis as i}from"../../../../geometry/support/Axis.js";import{getZeroIndexArray as o}from"../../../../geometry/support/Indices.js";import{leastSignificantAxis as n}from"../../../../geometry/support/polygonUtils.js";import{Attribute as a}from"../../webgl-engine/lib/Attribute.js";import{ContentObjectType as s}from"../../webgl-engine/lib/ContentObjectType.js";import{Geometry as u}from"../../webgl-engine/lib/Geometry.js";import{VertexAttribute as c}from"../../webgl-engine/lib/VertexAttribute.js";function p(e,r,o){const a=(r.length>0?r[0]:e.length/3)-1,s=n(e,a,o);if(s!==i.Z){e=e.slice();for(let t=0;t<e.length;t+=3)e[t+s]=e[t+2]}return t(e,r,3)}function l(t){const e=[[c.POSITION,new a(t.attributeData.position,t.indices,3,!0)]],r=o(t.indices.length);return null!=t.attributeData.colorFeature?e.push([c.COLORFEATUREATTRIBUTE,new a([t.attributeData.colorFeature],r,1,!0)]):t.attributeData.color&&e.push([c.COLOR,new a(t.attributeData.color,r,4,!0)]),t.attributeData.uvMapSpace&&e.push([c.UVMAPSPACE,new a(t.attributeData.uvMapSpace,t.indices,4,!0)]),t.attributeData.boundingRect&&e.push([c.BOUNDINGRECT,new a(t.attributeData.boundingRect,t.indices,9,!0)]),new u(t.material,e,t.mapPositions,s.Mesh,t.attributeData.objectAndLayerIdColor)}function m(t,e=null){const r=[[c.POSITION,new a(t.attributeData.position,t.indices,3,!0)],[c.UV0,new a(t.attributeData.uv0,t.indices,2,!0)]];return new u(t.material,r,t.mapPositions,s.Mesh,e)}function b(t){switch(t.type){case"extent":if(t instanceof e)return r.fromExtent(t);break;case"polygon":return t}return null}class g{constructor(t,e,r){this.renderData=t,this.
|
|
5
|
+
import{e as t}from"../../../../chunks/earcut.js";import e from"../../../../geometry/Extent.js";import r from"../../../../geometry/Polygon.js";import{Axis as i}from"../../../../geometry/support/Axis.js";import{getZeroIndexArray as o}from"../../../../geometry/support/Indices.js";import{leastSignificantAxis as n}from"../../../../geometry/support/polygonUtils.js";import{Attribute as a}from"../../webgl-engine/lib/Attribute.js";import{ContentObjectType as s}from"../../webgl-engine/lib/ContentObjectType.js";import{Geometry as u}from"../../webgl-engine/lib/Geometry.js";import{VertexAttribute as c}from"../../webgl-engine/lib/VertexAttribute.js";function p(e,r,o){const a=(r.length>0?r[0]:e.length/3)-1,s=n(e,a,o);if(s!==i.Z){e=e.slice();for(let t=0;t<e.length;t+=3)e[t+s]=e[t+2]}return t(e,r,3)}function l(t){const e=[[c.POSITION,new a(t.attributeData.position,t.indices,3,!0)]],r=o(t.indices.length);return null!=t.attributeData.colorFeature?e.push([c.COLORFEATUREATTRIBUTE,new a([t.attributeData.colorFeature],r,1,!0)]):t.attributeData.color&&e.push([c.COLOR,new a(t.attributeData.color,r,4,!0)]),t.attributeData.uvMapSpace&&e.push([c.UVMAPSPACE,new a(t.attributeData.uvMapSpace,t.indices,4,!0)]),t.attributeData.boundingRect&&e.push([c.BOUNDINGRECT,new a(t.attributeData.boundingRect,t.indices,9,!0)]),new u(t.material,e,t.mapPositions,s.Mesh,t.attributeData.objectAndLayerIdColor)}function m(t,e=null){const r=[[c.POSITION,new a(t.attributeData.position,t.indices,3,!0)],[c.UV0,new a(t.attributeData.uv0,t.indices,2,!0)]];return new u(t.material,r,t.mapPositions,s.Mesh,e)}function b(t){switch(t.type){case"extent":if(t instanceof e)return r.fromExtent(t);break;case"polygon":return t}return null}class g{constructor(t,e,r){this.renderData=t,this.layerViewUid=e,this.graphicUid=r,this.outGeometries=new Array}}export{g as PolygonCreationDataBase,l as createColorGeometry,p as createIndices3D,m as createWaterGeometry,b as geometryAsPolygon};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../core/Error.js";import{assertIsSome as t}from"../../../../core/maybe.js";import{MinPriority as r}from"../../../../core/MemCache.js";import{throwIfAborted as o}from"../../../../core/promiseUtils.js";import{generateUUID as n}from"../../../../core/uuid.js";import{normalFromMat4 as s}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{p as a}from"../../../../chunks/vec32.js";import{ONES as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectBoundingSphere as d}from"../../../../geometry/projection/projectBoundingSphere.js";import{isRelativeVertexSpace as
|
|
5
|
+
import e from"../../../../core/Error.js";import{assertIsSome as t}from"../../../../core/maybe.js";import{MinPriority as r}from"../../../../core/MemCache.js";import{throwIfAborted as o}from"../../../../core/promiseUtils.js";import{generateUUID as n}from"../../../../core/uuid.js";import{normalFromMat4 as s}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{p as a}from"../../../../chunks/vec32.js";import{ONES as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectBoundingSphere as d}from"../../../../geometry/projection/projectBoundingSphere.js";import{isRelativeVertexSpace as c}from"../../../../geometry/support/meshVertexSpaceUtils.js";import{l as u}from"../../../../chunks/sphere.js";import{CachedMeshData as m}from"./CachedMeshData.js";import{convertMeshMaterialToPBRMaterial as h}from"./I3SClientMaterialUtil.js";class f{constructor(e,t,r,o){this._uid=e,this._worker=o,this._id2Meta=new Map,this._oid2Meta=new Map,this._indexSR=t.indexSR,this._vertexSR=t.vertexSR,this._renderSR=t.renderSR,this._memCache=r.newCache(`sl-client-mesh-data-${this._uid}`)}get uid(){return this._uid}get worker(){return this._worker}get indexSR(){return this._indexSR}get renderSR(){return this._renderSR}createMeshNodeInfo(e,t){const r=`mesh${t}`,o=e.extent,n=o.spatialReference,s=this._indexSR,i=x(o,e.origin);d(i,n,i,s);return{type:"mesh",id:r,version:w(e),oid:t,mbs:i,componentNodeIds:[],unloadedMesh:e,nodeIndex:null,loadMeshPromise:null}}addMeshNode(t,r){if(null!=this.getMeshNodeIndex(r.oid))throw new e(`I3SClientNodeLoader: client side mesh for feature oid=${r.oid} already exists`);r.nodeIndex=t,this._id2Meta.set(r.id,r),this._oid2Meta.set(r.oid,r)}getMeshNodeIndex(e){const t=this._oid2Meta.get(e);return null==t||"mesh"!==t.type?null:t.nodeIndex}getMeshNodeInfo(e){const t=this._oid2Meta.values();for(const r of t)if("mesh"===r.type&&r.id===e)return r;return null}removeNode(e){const t=this._id2Meta.get(e);null!=t&&(this._id2Meta.delete(e),"mesh"===t.type&&this._oid2Meta.delete(t.oid))}async loadNodeJSON(t){const r=this._id2Meta.get(t);if(null==r)throw new e(`I3SClientNodeLoader::loadNodeJSON unable to find node ${t}`);switch(r.type){case"mesh":return this._loadMeshNodeJSON(r);case"mesh-component":return p(r);default:throw new e(`I3SClientNodeLoader::loadNodeJSON unable to handle node ${t}`)}}async _loadMeshNodeJSON(e){const t=e.id,r=(await this._getMeshData(e)).loadedMesh;if(null==r.components||0===r.components.length)return{id:t,version:null,mbs:e.mbs,obb:null,sharedResource:null,geometryData:null,attributeData:null,featureData:null,children:null};const o=[],n=r.components;for(let s=0;s<n.length;++s){const r=`${t}-component${s}`,n={type:"mesh-component",id:r,mbs:e.mbs,componentIndex:s,meshNodeInfo:e,textureData:new Map};this._id2Meta.set(n.id,n),e.componentNodeIds.push(r),o.push({id:n.id,href:null,mbs:n.mbs,obb:null})}return{id:t,version:null,mbs:e.mbs,obb:null,sharedResource:null,geometryData:null,attributeData:null,featureData:null,children:o}}updateNodeIndex(e,t,r){const o=this._id2Meta.get(e);o&&"mesh"===o.type&&(o.nodeIndex=r)}async loadNodeData(r,n){const s=this._id2Meta.get(r);if(null==s||"mesh-component"!==s.type)throw new e(`Failed to load client node data for node ${r} (unexpected node info)`);const i=s.meshNodeInfo,a=await this._getMeshData(i),l=a.loadedMesh,d=i.oid;if(null==l.components)throw new e(`Failed to load client node data for node ${r} (unexpected null reference)`);const c=l.components[s.componentIndex],{material:u,requiredTextures:m,textureData:f}=await h(c.material);if(null!=f)for(const e of f)null!=e&&s.textureData.set(e.id,e);const p={params:{material:u},type:"ArrayBufferView"},{vertexSpace:x,origin:M,transform:w}=l,S=[M.x,M.y,M.z??0];a.projectionPromise||(t(this._worker,"SceneLayerWorker is needed to project mesh"),a.projectionPromise=this._worker.project({positions:l.vertexAttributes.position,localMatrix:w?.localMatrix,vertexSpace:x.toJSON(),origin:S,inSpatialReference:l.spatialReference.toJSON(),outSpatialReference:this._vertexSR.toJSON()},n));const{projected:b,original:_,projectedOrigin:N}=await a.projectionPromise;l.vertexAttributes.position=_;const{transformed:v,original:D}=await y(c,a,this._worker,n);l.vertexAttributes.normal=D,o(n);const{geometryBuffer:R,geometryDescriptor:j}=g(b,c.faces,v,l.vertexAttributes.uv,l.vertexAttributes.color,d);return{geometryData:{featureDataPosition:N,featureIds:[],geometries:[p]},attributeDataInfo:{attributeData:{},loadedAttributes:[]},geometryBuffer:R,geometryDescriptor:j,requiredTextures:m,textureData:f,normalReferenceFrame:this._vertexSR.isGeographic?"east-north-up":"vertex-reference-frame"}}async loadAttributes(e,t,r){const o=e.numFeatures,n={};for(const{field:{name:s}}of t)n[s]=new Array(o);return n}async loadTextures(e,t,r){const o=e.id,n=this._id2Meta.get(o);if(null==n||"mesh-component"!==n.type)throw new Error(`Failed to load textures for node ${e.id} (unexpected node info)`);const s=[];for(const i of t)s.push(n.textureData.get(i.id)||null);return s}async _getMeshData(e){const t=e.version,o=this._memCache.get(t);if(null==o){if(null!=e.loadMeshPromise)return e.loadMeshPromise;const o=async(o,n)=>{const s=e.unloadedMesh.clone();try{await s.load()}catch(a){n(a)}const i=new m(s);this._memCache.put(t,i,r),e.loadMeshPromise=null,o(i)};return e.loadMeshPromise=new Promise(((e,t)=>o(e,t))),e.loadMeshPromise}return o}}async function p(e){return{id:e.id,version:e.meshNodeInfo.version,mbs:e.mbs,obb:null,sharedResource:null,geometryData:null,attributeData:null,featureData:null,children:null,isEmpty:!1}}function x(e,t){const{spatialReference:r}=e,o=[1,-1],n=[.5*e.width,.5*e.height,e.hasZ?.5*(e.zmax-e.zmin):0],s=r.isGeographic?r.metersPerUnit:1,i=e.center;let a=0;if(e.hasZ)for(let l=0;l<2;++l)for(let e=0;e<2;++e)for(let r=0;r<2;++r){const d=(i.x+o[l]*n[0]-t.x)*s,c=(i.y+o[e]*n[1]-t.y)*s,u=i.z+o[r]*n[2]-t.z;a=Math.max(d*d+c*c+u*u,a)}else for(let l=0;l<2;++l)for(let e=0;e<2;++e){const r=(i.x+o[l]*n[0]-t.x)*s,d=(i.y+o[e]*n[1]-t.y)*s;a=Math.max(r*r+d*d,a)}return u([t.x,t.y,t.z],Math.sqrt(a))}async function y(e,r,o,n){const{transform:d,vertexAttributes:c}=r.loadedMesh,u="source"===e.shading?c.normal:null;if(!(null!=u&&null!=d&&(0!==d.rotationAngle||!a(d.scale,l))))return{transformed:u,original:c.normal};if(!r.normalsTransformPromise){t(o,"SceneLayerWorker is needed to transform mesh normals");const e=i();s(e,d.localMatrix),r.normalsTransformPromise=o.transformNormals({normalMatrix:e,normals:u},n)}return r.normalsTransformPromise}function g(e,t,r,o,n,s){const i=1,a=(t?.length??0)/3,l=3*a;let d=0,c=0,u=!1,m=0,h=!1,f=0,p=!1,x=0,y=0,g=0;d+=S,d+=S,c=d,d+=3*l*b,null!=r&&(u=!0,m=d,d+=3*l*b),null!=o&&(h=!0,f=d,d+=2*l*b),null!=n&&(p=!0,x=d,d+=4*l*_),y=d,d+=i*N,g=d,d+=2*i*S;const w=new ArrayBuffer(d),v=new Uint8Array(w);M(v,0,l),M(v,S,i);const D=new Float32Array(w,c),R=null!=r?new Float32Array(w,m):null,j=null!=o?new Float32Array(w,f):null,I=null!=n?new Uint8Array(w,x):null;for(let M=0;M<a;++M){const s=3*M;for(let i=0;i<3;++i){const a=t[s+i],l=3*a,d=9*M+3*i;if(D[d]=e[l],D[d+1]=e[l+1],D[d+2]=e[l+2],R&&(R[d]=r[l],R[d+1]=r[l+1],R[d+2]=r[l+2]),j){const e=2*a,t=6*M+2*i;j[t]=o[e],j[t+1]=o[e+1]}if(I){const e=4*a,t=12*M+4*i;I[t]=n[e],I[t+1]=n[e+1],I[t+2]=n[e+2],I[t+3]=n[e+3]}}}M(v,y,s),M(v,y+S,s/2**32),M(v,g,0),M(v,g+S,a-1);return{geometryBuffer:w,geometryDescriptor:{isDraco:!1,isLegacy:!0,color:p,normal:u,uv0:h,uvRegion:!1,featureIndex:!0}}}function M(e,t,r){e[t]=255&r,e[t+1]=255&r>>8,e[t+2]=255&r>>16,e[t+3]=255&r>>24}function w(e){const t=e.metadata.displaySource?.source;if(null==t||!Array.isArray(t)||!t.length||t[0]instanceof File)return n();const r=t;let o="";for(const n of r)o+=n.makeHash();return o+JSON.stringify(e.transform?.toJSON()??"")+(c(e.vertexSpace)?JSON.stringify(e.vertexSpace.origin):"")+JSON.stringify(e.spatialReference)}const S=4,b=4,_=1,N=8;export{f as I3SClientNodeLoader,x as createSphereFromExtent,b as sizeOfFloat32,S as sizeOfInt32,N as sizeOfUInt64,_ as sizeOfUInt8,y as transformNormals};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{ViewingMode as e}from"../../../ViewingMode.js";import{isValidMbs as t}from"./I3SUtil.js";import{I3sTarget as i}from"./Intersector.js";import{newIntersectorResult as r}from"../../webgl-engine/lib/Intersector.js";import{IntersectorType as s,StoreResults as n}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{MeshIntersectionOptions as l}from"../../webgl-engine/lib/RayIntersections.js";import{getVerticalOffsetI3S as o}from"../../webgl-engine/lib/verticalOffsetUtils.js";class c{constructor(e){this.type=s.I3S,this._needVerticalOffset=!1,this.
|
|
5
|
+
import{ViewingMode as e}from"../../../ViewingMode.js";import{isValidMbs as t}from"./I3SUtil.js";import{I3sTarget as i}from"./Intersector.js";import{newIntersectorResult as r}from"../../webgl-engine/lib/Intersector.js";import{IntersectorType as s,StoreResults as n}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{MeshIntersectionOptions as l}from"../../webgl-engine/lib/RayIntersections.js";import{getVerticalOffsetI3S as o}from"../../webgl-engine/lib/verticalOffsetUtils.js";class c{constructor(e){this.type=s.I3S,this._needVerticalOffset=!1,this.layerViewUid=e.layerViewUid,this.sublayerId=e.sublayerId,this._collection=e.collection,this._traverseNodeHierarchy=e.traverseNodeHierarchy,this.slicePlaneEnabled=e.slicePlaneEnabled,this.isGround=e.isGround}updateElevationAlignState(t,i){this._needVerticalOffset=t&&i===e.Global}intersect(e,s,c,d,u,b=!1){const f=e.results,m=e.options.store===n.ALL,h=e.ray.direction,y=e.tolerance;let p=e=>e,I=e=>e;const R=o(e.verticalOffset??(this._needVerticalOffset?0:null));null!=e.verticalOffset&&null!=R&&(p=e=>R.applyToMbs(e),I=e=>R.applyToObb(e));const g=new l(b,e.options.normalRequired),v=(n,l)=>{if(0===n.childrenLoaded)return!1;const o=n.serviceObbInRenderSR?.isValid?n.serviceObbInRenderSR:null;return!(o&&!I(o).intersectRay(c,h,y))&&(!l||!o&&t(n.serviceMbsInRenderSR)&&!a(p(n.serviceMbsInRenderSR),c,h,y)||null!=n.geometryObbInRenderSR&&!I(n.geometryObbInRenderSR).intersectRay(c,h,y)||this._collection.intersect(l,c,d,y,R,g,((t,l,o,a)=>{if(l<0||null!=s&&!s(c,d,l))return;const u=e=>{const r=new i(this.layerViewUid,this.sublayerId,n.index,t,a);e.set(this.type,r,l,o)};if(this.isGround&&(null==f.ground.dist||l<f.ground.dist)&&u(f.ground),!e.options.isFiltered&&((null==f.min.dist||l<f.min.dist)&&u(f.min),(null==f.max.dist||l>f.max.dist)&&u(f.max),m)){const t=r(e.ray);u(t),e.results.all.push(t)}})),!0)};this._traverseNodeHierarchy(v)}}function a(e,t,i,r=0){const s=e[3]+r,n=t[0]-e[0],l=t[1]-e[1],o=t[2]-e[2],c=i[0],a=i[1],d=i[2],u=c*n+a*l+d*o;return u*u-(c*c+a*a+d*d)*(n*n+l*l+o*o-s*s)>=0}export{c as I3SIntersectionHandler};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{IntersectorType as t}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{Graphic3DTarget as e,LayerTarget as r}from"../../webgl-engine/lib/IntersectorTarget.js";import{isValidIntersectorResult as n}from"../../webgl-engine/lib/intersectorUtils.js";class s extends e{constructor(t,e,r,n){super(e,r),this.point=t,this.createGraphic=n}}function i(e){return n(e)&&e.intersector===t.PCL&&!!e.target}class o extends r{constructor(t,e,r,n,s){super(t),this.
|
|
5
|
+
import{IntersectorType as t}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{Graphic3DTarget as e,LayerTarget as r}from"../../webgl-engine/lib/IntersectorTarget.js";import{isValidIntersectorResult as n}from"../../webgl-engine/lib/intersectorUtils.js";class s extends e{constructor(t,e,r,n){super(e,r),this.point=t,this.createGraphic=n}}function i(e){return n(e)&&e.intersector===t.PCL&&!!e.target}class o extends r{constructor(t,e,r,n,s){super(t),this.layerViewUid=t,this.sublayerId=e,this.nodeIndex=r,this.componentIndex=n,this.triangleNr=s}}class c extends e{constructor(t,e,r){super(e,null),this.point=t,this.createVoxelGraphic=r}}class l extends e{constructor(t,e){super(t,null),this.createTiles3DGraphic=e}}function a(e){return n(e)&&e.intersector===t.I3S&&!!e.target}function u(e){return n(e)&&e.intersector===t.VOXEL&&!!e.target}function p(e){return n(e)&&e.intersector===t.TILES3D&&!!e.target}export{o as I3sTarget,s as PclTarget,l as Tiles3DTarget,c as VoxelTarget,a as isI3sIntersectorResult,i as isPclIntersectorResult,p as isTiles3DIntersectorResult,u as isVoxelIntersectorResult};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import{disposeMaybe as t}from"../../../../core/maybe.js";import s 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{d as n,l as o,h as a,v as l,f as h,k 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 x}from"../../../../geometry/support/plane.js";import{fromPoints as S}from"../../../../geometry/support/ray.js";import{PclTarget as
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import{disposeMaybe as t}from"../../../../core/maybe.js";import s 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{d as n,l as o,h as a,v as l,f as h,k 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 x}from"../../../../geometry/support/plane.js";import{fromPoints as S}from"../../../../geometry/support/ray.js";import{PclTarget as w}from"./Intersector.js";import{PointCloudHighlights as R}from"./PointCloudHighlights.js";import{isDepth as z,ShaderOutput as A,isColorOrColorEmission as j}from"../../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SyncRenderPlugin as y}from"../../webgl-engine/effects/RenderPlugin.js";import{Default3D as I}from"../../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{newIntersectorResult as v}from"../../webgl-engine/lib/Intersector.js";import{IntersectorType as E,StoreResults as L}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{RenderSlot as O}from"../../webgl-engine/lib/RenderSlot.js";import{VertexArrayObject as q}from"../../webgl-engine/lib/VertexArrayObject.js";import{VertexAttribute as T}from"../../webgl-engine/lib/VertexAttribute.js";import{P as M,g as N}from"../../../../chunks/PointRenderer.glsl.js";import{PointRendererTechnique as F}from"../../webgl-engine/shaders/PointRendererTechnique.js";import{PointRendererTechniqueConfiguration as H}from"../../webgl-engine/shaders/PointRendererTechniqueConfiguration.js";import{BufferObject as V}from"../../../webgl/BufferObject.js";import{DataType as U,PrimitiveType as B,Usage as C}from"../../../webgl/enums.js";import{VertexElementDescriptor as W}from"../../../webgl/VertexElementDescriptor.js";const D=new Map([["positions",[new W(T.POSITION,3,U.FLOAT,0,12)]],["colors",[new W(T.COLOR,3,U.UNSIGNED_BYTE,0,3,!0)]]]);let k=class extends y{constructor(e){super(e),this.type=E.PCL,this.isGround=!1,this._passParameters=new M,this._highlights=new R({forEachNode:e=>this.forEachNode(e),addHighlight:(e,t,s)=>this._addHighlight(e,t,s),removeHighlight:(e,t)=>this._removeHighlight(e,t)}),this.produces=new Map([[O.OPAQUE_MATERIAL,e=>!(z(e)||e===A.Highlight&&this._highlights.empty)],[O.OPAQUE_MATERIAL_WITHOUT_NORMALS,e=>z(e)]]),this.layerViewUid="",this._slicePlaneEnabled=!1,this._configuration=new H,this._nodes=new s}hasHighlight(e){return this._highlights.has(e)}initializeRenderContext(e){this._context=e,e.requestRender()}uninitializeRenderContext(){}intersect(e,t,s,i){const r=d(),f=d(),P=d(),b=d(),R=x(),z=e.camera.perScreenPixelRatio/2,A=e.camera.near;n(f,i,s);const j=1/o(f);a(f,f,j),l(P,f),u(R,f[0],f[1],f[2],-h(f,s));const y=new J,I=new J,E=new Array,O=m(),q=m(this._passParameters.clipBox);p(q,-s[0],-s[1],-s[2],q),this._nodes.forAll((o=>{const a=o.splatSize*this._passParameters.scaleFactor;let l=o.obb.minimumDistancePlane(R),d=o.obb.maximumDistancePlane(R);l-=Q(a,l+A,this._passParameters,z,o.isLeaf),d-=Q(a,d+A,this._passParameters,z,o.isLeaf);const u=d<0,m=null!=y.dist&&null!=I.dist&&y.dist<l*j&&I.dist>d*j;if(u||m)return;const x=G(a,d+A,this._passParameters,z,o.isLeaf);if(!o.obb.intersectRay(s,f,x))return;const S=x*x;o.obb.toAaBoundingBox(O),p(O,-s[0],-s[1],-s[2],O);const w=!g(q,O);n(b,o.origin,s);const v=o.coordinates.length/3;for(let n=0;n<v;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&&!_(q,r))continue;const l=h(r,f),d=c(r)-l*l;if(d>S)continue;let u=l+A;const m=Q(a,u,this._passParameters,z,o.isLeaf);if(l-m<0)continue;u-=m;const p=G(a,u,this._passParameters,z,o.isLeaf);if(d>p*p)continue;const g=(l-m)*j,x=e=>(e.point=Y(o,n,e.point),e.dist=g,e.normal=P,e.node=o,e.pointId=n,e.layerViewUid=this.layerViewUid,e);if((null==y.dist||g<y.dist)&&(null==t||t(s,i,g))&&x(y),e.options.store!==L.MIN&&(null==I.dist||g>I.dist)&&(null==t||t(s,i,g))&&x(I),e.options.store===L.ALL&&(null==t||t(s,i,g))){const e=new J;E.push(x(e))}}}));const T=e=>{const{layerViewUid:t,node:s,pointId:i}=e;return new w(e.point,t,i,(()=>this.createGraphic(s,i,e.point)))},M=(e,t)=>{const s=T(t);e.set(this.type,s,t.dist,t.normal)};if(K(y)){const t=e.results.min;(null==t.dist||y.dist<t.dist)&&M(t,y)}if(K(I)&&e.options.store!==L.MIN){const t=e.results.max;(null==t.dist||I.dist>t.dist)&&M(t,I)}if(e.options.store===L.ALL){const t=S(s,i);for(const s of E){const i=v(t);M(i,s),e.results.all.push(i)}}}acquireTechniques(e){return 0!==this._nodes.length&&(j(e.output)||z(e.output)&&e.bind.slot===O.OPAQUE_MATERIAL_WITHOUT_NORMALS||e.output===A.Highlight)?(this._nodes.forAll((t=>this._initNode(e,t))),this._configuration.drawScreenSize=this._passParameters.drawScreenSpace,this._configuration.useFixedSizes=this._passParameters.useFixedSizes,this._configuration.hasSlicePlane=this._slicePlaneEnabled,this._configuration.hasOccludees=e.bind.hasOccludees,this._configuration.clippingEnabled=this._clippingEnabled,this._configuration.output=e.output,this._context.techniques.get(F,this._configuration)):null}render(e,t){const{rctx:s,bind:i,output:r}=e,n=s.bindTechnique(t,i,this._passParameters),o=r===A.Highlight,a=i.highlight?.name??null;o&&!a||this._nodes.forAll((t=>{0===t.coordinates.length||o&&!t.highlightMap.has(a)||(n.bindDraw(i,this._passParameters,t),s.bindVAO(t.vao),o?this._renderHighlightFragments(e,t):s.drawArrays(B.POINTS,0,t.coordinates.length/3))}))}_renderHighlightFragments(e,t){const{highlightMap:s}=t,{rctx:i,bind:r}=e,{highlight:n}=r;if(!n)return;const o=n.name,a=s.get(o);if(!a||0===a.length)return;const{highlightOrderMap:l,highlightLevel:h}=r;if(null==h)return;for(const g of s.keys())if(g!==o){const e=l.get(g);if(void 0!==e&&e>h)return}let c=0,d=a[0].componentIndex,u=d+1;const m=()=>{for(;c<a.length&&a[c].id.highlightName!==o;)d=a[c].componentIndex,++c;u=d+1};m();const p=(e,t)=>{const s=t-e;s>0&&i.drawArrays(B.POINTS,e,s)};for(;c<a.length;){const e=a[c];if(e.id.highlightName!==o){p(d,u),++c,m();continue}const t=e.componentIndex;t!==u&&(p(d,u),d=t),u=t+1,++c}p(d,u)}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,t)=>e===t))}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 s=null;return this._nodes.filterInPlace((i=>i.id!==e||(s=i,i.vao=t(i.vao),this._highlights.nodeRemoved(i),!1))),this._requestRender(),s}forEachNode(e){this._nodes.forAll(e)}removeAll(){this._nodes.forAll((e=>e.vao=t(e.vao))),this._highlights.removeAll(),this._nodes.clear(),this._requestRender()}highlight(e,t){return this._highlights.add(e,t)}_addHighlight(e,t,s){e.addHighlight(t,s),this._requestRender()}_removeHighlight(e,t){e.removeHighlight(t),this._requestRender()}_initNode(e,t){t.vao??=new q(e.rctx,I,D,new Map([["positions",V.createVertex(e.rctx,C.STATIC_DRAW,t.coordinates)],["colors",V.createVertex(e.rctx,C.STATIC_DRAW,t.rgb)]]))}_requestRender(){this._context&&this._context.requestRender()}};function G(e,t,s,i,r){if(s.drawScreenSpace)return s.fixedSize*t*i;const n=N(r)*t*i;return s.useFixedSizes?Math.min(s.fixedSize/2,n):s.screenMinSize>0?Math.min(Math.max(s.screenMinSize*t*i,e/2),n):Math.min(e/2,n)}function Q(e,t,s,i,r){return s.drawScreenSpace?0:G(e,t,s,i,r)}function Y(e,t,s){return null==s&&(s=d()),s[0]=e.origin[0]+e.coordinates[3*t],s[1]=e.origin[1]+e.coordinates[3*t+1],s[2]=e.origin[2]+e.coordinates[3*t+2],s}e([i({constructOnly:!0})],k.prototype,"createGraphic",void 0),k=e([r("esri.views.3d.layers.i3s.PointCloudRenderer")],k);class J{constructor(){this.node=null,this.pointId=null,this.point=null,this.dist=null,this.normal=null,this.layerViewUid=""}}function K(e){return null!=e.dist&&null!=e.point&&null!=e.pointId&&null!=e.node}export{k as PointCloudRenderer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import{isSome as t}from"../../../../core/arrayUtils.js";import{makeHandle as r}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import i from"../../../../core/Logger.js";import{estimateAttributesMemory as a,estimateFixedArrayMemory as s,estimateNumberMemory as o}from"../../../../core/memoryEstimations.js";import 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{emptyHighlightHandle as x}from"./highlightUtils.js";import{drapedZ as I}from"../../terrain/OverlayRenderer.js";import{Attribute as M}from"../../webgl-engine/lib/Attribute.js";import{ContentObjectType as A}from"../../webgl-engine/lib/ContentObjectType.js";import{DrapedHeatmapRenderer as N}from"../../webgl-engine/lib/DrapedHeatmapRenderer.js";import{Geometry as O}from"../../webgl-engine/lib/Geometry.js";import{DirtyOperation as H,DirtyState as U}from"../../webgl-engine/lib/ModelDirtyTypes.js";import{RenderGeometry as L}from"../../webgl-engine/lib/RenderGeometry.js";import{UpdatePolicy as E}from"../../webgl-engine/lib/UpdatePolicy.js";import{VertexAttribute as D}from"../../webgl-engine/lib/VertexAttribute.js";import{HeatmapDensityMaterial as C}from"../../webgl-engine/materials/HeatmapDensityMaterial.js";import{scaleBoundsPredicate as B,isScaleRangeActive as W}from"../../../support/layerViewUtils.js";import{PixelType as Z,PixelFormat as $}from"../../../webgl/enums.js";import{loadHeatmapTextureConfiguration as q,fallBackHeatmapConfiguration as z}from"../../../webgl/heatmapTextureUtils.js";const Y=112;let k=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=Z.HALF_FLOAT,this._pixelFormat=$.RGBA,this._updatingHandles=new y}initialize(){let e;try{e=q(this._renderView.renderingContext,i.getLogger(this))}catch(u){this.addResolvingPromise(Promise.reject(u)),e=z}const{dataType:t,samplingMode:a,pixelFormat:s,internalFormat:o}=e;this._featureStore=new S({geometryType:"esriGeometryPoint",hasZ:this.hasZ,hasM:this.hasM}),this._dataType=t,this._pixelFormat=s;const n=t!==Z.FLOAT;this._drapeSourceRenderer=this.view.basemapTerrain.overlayManager.registerDrapeSource(this,N,{...this._rendererParameters,dataType:t,samplingMode:a,pixelFormat:s,internalFormat:o}),this._material=new C({usesHalfFloats:n}),this._materialWithField=new C({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&&i.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||i.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`)})),r((()=>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!B(r,e??0,t??0)}get usedMemory(){const e=this.usedMemoryPerFeature*this._featureStore.numFeatures,t=this._pixelFormat===$.RED?1:4,r=this._dataType===Z.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=a(e),r=6;return r*s([0,0,0],o)+r*s([0,0],o)+(this._heatmapRendererFieldIsNumeric?r*o:0)+t}get loadedFeatures(){return this._featureStore.numFeatures}get unprocessedMemoryEstimate(){return 0}get performanceInfo(){return new V(this._renderGeometries.size,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 W(t,r)}get _visibleFeatures(){return Array.from(this._renderGeometries.values()).reduce(((e,{visible:t})=>e+(t?1:0)),0)}async whenGraphicBounds(){return null}computeAttachmentOrigin(){return null}highlight(){return x}maskOccludee(){return r()}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,H.REMOVE),o.length>0&&this._drapeSourceRenderer.addGeometries(o,H.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]=I;const a=g(1),s=[[D.POSITION,new M(i,a,i.length)]],o=this._heatmapRendererFieldIsNumeric;null!=t&&s.push([D.FEATUREATTRIBUTE,new M([o?e.attributes[t]??0:0],a,1)]);const n=new L(new O(r,s,null,A.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>Y&&i.getLogger(this).warnOnce(`SceneView supports a maximum radius of ${Y} pt for HeatmapRenderer.`),Math.min(e,Y)}_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,U.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,U.VISIBILITY)}get test(){}};e([m()],k.prototype,"type",void 0),e([m({constructOnly:!0})],k.prototype,"owner",void 0),e([m()],k.prototype,"layer",null),e([m()],k.prototype,"featureStore",null),e([m()],k.prototype,"updating",null),e([m()],k.prototype,"updatingRemaining",null),e([m()],k.prototype,"suspendInfo",null),e([m()],k.prototype,"legendEnabled",null),e([m()],k.prototype,"filterVisibility",null),e([m()],k.prototype,"displayFeatureLimit",null),e([m()],k.prototype,"preferredUpdatePolicy",void 0),e([m()],k.prototype,"hasZ",null),e([m()],k.prototype,"hasM",null),e([m()],k.prototype,"dataExtent",void 0),e([m()],k.prototype,"view",null),e([m()],k.prototype,"fullOpacity",null),e([m()],k.prototype,"updatePolicy",null),e([m()],k.prototype,"drapeSourceType",void 0),e([m()],k.prototype,"scaleVisibilitySuspended",null),e([m()],k.prototype,"renderer",null),e([m()],k.prototype,"_featureStore",void 0),e([m()],k.prototype,"_filterVisibility",void 0),e([m()],k.prototype,"_overlayRenderer",null),e([m()],k.prototype,"_overlaySpatialReference",null),e([m()],k.prototype,"_rendererParameters",null),e([m()],k.prototype,"_materialParameters",null),e([m()],k.prototype,"_densityParameters",null),e([m()],k.prototype,"_radiusParameter",null),e([m()],k.prototype,"_resolutionForScaleParameter",null),e([m()],k.prototype,"_colorRampParameter",null),e([m()],k.prototype,"_pixelRatioParameter",null),e([m()],k.prototype,"_densityMapPixelRatio",null),e([m()],k.prototype,"_renderGeometries",void 0),e([m()],k.prototype,"_material",void 0),e([m()],k.prototype,"_materialWithField",void 0),e([m()],k.prototype,"_renderView",null),e([m()],k.prototype,"_featuresArePoints",null),e([m()],k.prototype,"_loadedPointGraphics",null),e([m()],k.prototype,"_heatmapRenderer",null),e([m()],k.prototype,"_heatmapRendererFieldName",null),e([m()],k.prototype,"_heatmapRendererField",null),e([m()],k.prototype,"_heatmapRendererFieldIsNumeric",null),e([m()],k.prototype,"_fieldTotal",void 0),e([m()],k.prototype,"_drapeSourceRenderer",void 0),e([m()],k.prototype,"_isScaleRangeActive",null),k=e([h("esri.views.3d.layers.support.HeatmapFeatureProcessor")],k);export{k as HeatmapFeatureProcessor,Y as maxRadiusPt};
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import{isSome as t}from"../../../../core/arrayUtils.js";import{makeHandle as r}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import i from"../../../../core/Logger.js";import{estimateAttributesMemory as a,estimateFixedArrayMemory as s,estimateNumberMemory as o}from"../../../../core/memoryEstimations.js";import 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 w from"../../../../layers/graphics/data/FeatureStore.js";import{isNumericField as S}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{emptyHighlightHandle as x}from"./highlightUtils.js";import{drapedZ as I}from"../../terrain/OverlayRenderer.js";import{Attribute as M}from"../../webgl-engine/lib/Attribute.js";import{ContentObjectType as A}from"../../webgl-engine/lib/ContentObjectType.js";import{DrapedHeatmapRenderer as N}from"../../webgl-engine/lib/DrapedHeatmapRenderer.js";import{Geometry as O}from"../../webgl-engine/lib/Geometry.js";import{DirtyOperation as U,DirtyState as H}from"../../webgl-engine/lib/ModelDirtyTypes.js";import{RenderGeometry as L}from"../../webgl-engine/lib/RenderGeometry.js";import{UpdatePolicy as E}from"../../webgl-engine/lib/UpdatePolicy.js";import{VertexAttribute as D}from"../../webgl-engine/lib/VertexAttribute.js";import{HeatmapDensityMaterial as C}from"../../webgl-engine/materials/HeatmapDensityMaterial.js";import{scaleBoundsPredicate as B,isScaleRangeActive as W}from"../../../support/layerViewUtils.js";import{PixelType as Z,PixelFormat as $}from"../../../webgl/enums.js";import{loadHeatmapTextureConfiguration as q,fallBackHeatmapConfiguration as z}from"../../../webgl/heatmapTextureUtils.js";const Y=112;let k=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=Z.HALF_FLOAT,this._pixelFormat=$.RGBA,this._updatingHandles=new y}initialize(){let e;try{e=q(this._renderView.renderingContext,i.getLogger(this))}catch(u){this.addResolvingPromise(Promise.reject(u)),e=z}const{dataType:t,samplingMode:a,pixelFormat:s,internalFormat:o}=e;this._featureStore=new w({geometryType:"esriGeometryPoint",hasZ:this.hasZ,hasM:this.hasM}),this._dataType=t,this._pixelFormat=s;const n=t!==Z.FLOAT;this._drapeSourceRenderer=this.view.basemapTerrain.overlayManager.registerDrapeSource(this,N,{...this._rendererParameters,dataType:t,samplingMode:a,pixelFormat:s,internalFormat:o}),this._material=new C({usesHalfFloats:n}),this._materialWithField=new C({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&&i.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||i.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`)})),r((()=>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!B(r,e??0,t??0)}get usedMemory(){const e=this.usedMemoryPerFeature*this._featureStore.numFeatures,t=this._pixelFormat===$.RED?1:4,r=this._dataType===Z.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=a(e),r=6;return r*s([0,0,0],o)+r*s([0,0],o)+(this._heatmapRendererFieldIsNumeric?r*o:0)+t}get loadedFeatures(){return this._featureStore.numFeatures}get unprocessedMemoryEstimate(){return 0}get performanceInfo(){return new V(this._renderGeometries.size,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&&S(e)}get _isScaleRangeActive(){const{layer:e}=this;if(!("effectiveScaleRange"in e))return!1;const{minScale:t,maxScale:r}=e.effectiveScaleRange;return W(t,r)}get _visibleFeatures(){return Array.from(this._renderGeometries.values()).reduce(((e,{visible:t})=>e+(t?1:0)),0)}async whenGraphicBounds(){return null}computeAttachmentOrigin(){return null}highlight(){return x}maskOccludee(){return r()}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,U.REMOVE),o.length>0&&this._drapeSourceRenderer.addGeometries(o,U.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]=I;const a=g(1),s=[[D.POSITION,new M(i,a,i.length)]],o=this._heatmapRendererFieldIsNumeric;null!=t&&s.push([D.FEATUREATTRIBUTE,new M([o?e.attributes[t]??0:0],a,1)]);const n=new L(new O(r,s,null,A.Point),{layerViewUid:this.owner.layerViewUid,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>Y&&i.getLogger(this).warnOnce(`SceneView supports a maximum radius of ${Y} pt for HeatmapRenderer.`),Math.min(e,Y)}_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()],k.prototype,"type",void 0),e([m({constructOnly:!0})],k.prototype,"owner",void 0),e([m()],k.prototype,"layer",null),e([m()],k.prototype,"featureStore",null),e([m()],k.prototype,"updating",null),e([m()],k.prototype,"updatingRemaining",null),e([m()],k.prototype,"suspendInfo",null),e([m()],k.prototype,"legendEnabled",null),e([m()],k.prototype,"filterVisibility",null),e([m()],k.prototype,"displayFeatureLimit",null),e([m()],k.prototype,"preferredUpdatePolicy",void 0),e([m()],k.prototype,"hasZ",null),e([m()],k.prototype,"hasM",null),e([m()],k.prototype,"dataExtent",void 0),e([m()],k.prototype,"view",null),e([m()],k.prototype,"fullOpacity",null),e([m()],k.prototype,"updatePolicy",null),e([m()],k.prototype,"drapeSourceType",void 0),e([m()],k.prototype,"scaleVisibilitySuspended",null),e([m()],k.prototype,"renderer",null),e([m()],k.prototype,"_featureStore",void 0),e([m()],k.prototype,"_filterVisibility",void 0),e([m()],k.prototype,"_overlayRenderer",null),e([m()],k.prototype,"_overlaySpatialReference",null),e([m()],k.prototype,"_rendererParameters",null),e([m()],k.prototype,"_materialParameters",null),e([m()],k.prototype,"_densityParameters",null),e([m()],k.prototype,"_radiusParameter",null),e([m()],k.prototype,"_resolutionForScaleParameter",null),e([m()],k.prototype,"_colorRampParameter",null),e([m()],k.prototype,"_pixelRatioParameter",null),e([m()],k.prototype,"_densityMapPixelRatio",null),e([m()],k.prototype,"_renderGeometries",void 0),e([m()],k.prototype,"_material",void 0),e([m()],k.prototype,"_materialWithField",void 0),e([m()],k.prototype,"_renderView",null),e([m()],k.prototype,"_featuresArePoints",null),e([m()],k.prototype,"_loadedPointGraphics",null),e([m()],k.prototype,"_heatmapRenderer",null),e([m()],k.prototype,"_heatmapRendererFieldName",null),e([m()],k.prototype,"_heatmapRendererField",null),e([m()],k.prototype,"_heatmapRendererFieldIsNumeric",null),e([m()],k.prototype,"_fieldTotal",void 0),e([m()],k.prototype,"_drapeSourceRenderer",void 0),e([m()],k.prototype,"_isScaleRangeActive",null),k=e([h("esri.views.3d.layers.support.HeatmapFeatureProcessor")],k);export{k as HeatmapFeatureProcessor,Y 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.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../Graphic.js";import{Tiles3DTarget as i}from"../i3s/Intersector.js";import{newIntersectorResult as t}from"../../webgl-engine/lib/Intersector.js";import{IntersectorType as r,StoreResults as s}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{MeshIntersectionOptions as n}from"../../webgl-engine/lib/RayIntersections.js";class
|
|
5
|
+
import e from"../../../../Graphic.js";import{Tiles3DTarget as i}from"../i3s/Intersector.js";import{newIntersectorResult as t}from"../../webgl-engine/lib/Intersector.js";import{IntersectorType as r,StoreResults as s}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{MeshIntersectionOptions as n}from"../../webgl-engine/lib/RayIntersections.js";class o{constructor(e){this.type=r.TILES3D,this.slicePlaneEnabled=!1,this.isGround=!0,this.layerView=e,this.layerViewUid=e.uid}intersect(e,r,o,l,a,c){const u=e.results,d=e.options.store===s.ALL;if(e.options.filteredLayerViewUids.includes(this.layerView.uid))return;const m=this.layerView.view.stage.renderView.componentObjectCollection,h=new n(c??!1,e.options.normalRequired);this.layerView.objects.forEach((s=>{s.visible&&s.intersectionGeometry&&m.intersect(s,o,l,e.tolerance,null,h,((s,n,a,c)=>{if(n>=0){if(null!=r&&!r(o,l,n))return;const s=e=>{const t=new i(this.layerView.layer.uid,(()=>this._createTiles3DGraphic(this.layerView.layer,{})));e.set(this.type,t,n,a)};if(this.isGround&&(null==u.ground.dist||n<u.ground.dist)&&s(u.ground),e.options.isFiltered)return;if((null==u.min.dist||n<u.min.dist)&&s(u.min),(null==u.max.dist||n>u.max.dist)&&s(u.max),d){const i=t(e.ray);s(i),e.results.all.push(i)}}}))}))}_createTiles3DGraphic(i,t){return new e({layer:i,sourceLayer:i,attributes:t})}}export{o as Tiles3DIntersectionHandler};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../core/PooledArray.js";import{castRenderScreenPointArray3 as t,createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{getMetersPerVerticalUnitForSR as i}from"../../../../core/unitUtils.js";import{g as n,n as s,f as o}from"../../../../chunks/vec32.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as a,copy as c,negativeInfinity as u,width as h,height as d,expandPointInPlace as p}from"../../../../geometry/support/aaBoundingRect.js";import{create as m}from"../../../../geometry/support/ray.js";import{sv3d as
|
|
5
|
+
import e from"../../../../core/PooledArray.js";import{castRenderScreenPointArray3 as t,createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{getMetersPerVerticalUnitForSR as i}from"../../../../core/unitUtils.js";import{g as n,n as s,f as o}from"../../../../chunks/vec32.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as a,copy as c,negativeInfinity as u,width as h,height as d,expandPointInPlace as p}from"../../../../geometry/support/aaBoundingRect.js";import{create as m}from"../../../../geometry/support/ray.js";import{sv3d as y}from"../../../../geometry/support/vectorStacks.js";import{getElevationOffsetInMeters as f}from"../../../../support/elevationInfoUtils.js";import{ViewingMode as g}from"../../../ViewingMode.js";import{computeMapPointFromVec3d as R}from"../../support/hitTest.js";import{fromRenderAtEye as _,fromScreen as w}from"../../support/geometryUtils/ray.js";import{defaultTolerance as v,newIntersector as I}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as b,IntersectorType as P}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{isValidIntersectorResult as j,sliceFilterPredicate as M}from"../../webgl-engine/lib/intersectorUtils.js";import{HUDMaterial as U}from"../../webgl-engine/materials/HUDMaterial.js";class x{constructor(t,r,i){this.viewingMode=t,this._forEachLayer=r,this._view=i,this._externalIntersectionHandlers=new e,this._tolerance=v,this._tmpRay=m(),this._tmpRegion=a(),this._validateHUDIntersector=I(this.viewingMode),this._validateHUDIntersector.options.hud=!1}intersectScreen(e,t,r){return this.intersectRay(this._getPickRay(e,this._tmpRay),A(this.viewingMode),t,r)}intersectScreenFreePointFallback(e,t,r){return this.intersectRayFreePointFallback(this._getPickRay(e,this._tmpRay),t,r)}intersectRayFreePointFallback(e,t,r){return this.intersectRay(e,A(this.viewingMode),t,r)||this._intersectRayFreePointLocal(e,t)}intersectRay(e,t,r,i){return t.options.selectionMode=!1,t.options.store=b.MIN,this.computeIntersection(e,t,i),!!t.results.min&&t.results.min.getIntersectionPoint(r)}getCenterRayWithSubpixelOffset(e,t,r=.5,i=.5){return e.getRenderCenter(D,r,i),D[0]+=.0466,D[1]-=.0123,_(e,D,t)}intersectIntersectorScreen(e,t,r){this.computeIntersection(this._getPickRay(e,this._tmpRay),t,r)}intersectToolIntersectorScreen(e,t,r){const i=this._getPickRay(e,this._tmpRay);this.intersectToolIntersectorRay(i,t,r)}intersectToolIntersectorRay(e,t,r){t.options.selectionMode=!0,this.computeIntersection(e,t,r);const i=t.results.min;!!this._view.basemapTerrain&&this._view.basemapTerrain.opaque||j(i)&&i.intersector!==P.TERRAIN||(t.options.selectionMode=!1,this.computeIntersection(e,t,r))}setTolerance(e=v){this._tolerance=e}addIntersectionHandler(e){this._externalIntersectionHandlers.push(e),this._externalIntersectionHandlers.sort(((e,t)=>e.type===P.TERRAIN?1:t.type===P.TERRAIN?-1:0))}removeIntersectionHandler(e){null!=this._externalIntersectionHandlers.removeUnordered(e)&&this._externalIntersectionHandlers.sort(((e,t)=>e.type===P.TERRAIN?1:t.type===P.TERRAIN?-1:0))}_getPickRay(e,t){const r=this._view.state.camera;return w(r,e,t)}_intersectRayFreePointLocal(e,t){return this.viewingMode!==g.Local||null==e||n(t,e.origin,s(y.get(),e.direction)),!1}intersectElevationFromScreen(e,t,r=0,i=null){return this._intersectElevation(this._getPickRay(e,this._tmpRay),t,r,i)}_intersectElevation(e,r,l=0,a=null){if(null==e)return null;const c=this._view,{renderCoordsHelper:u}=c,h=i(c.spatialReference),d=null!=r?r.mode:"absolute-height",p=f(r)/h,m=("on-the-ground"!==d?p+l:0)*h/u.unitInMeters,{camera:g}=c.state;if("absolute-height"===d){const t=u?.getAltitude(g.eye),r=o(s(F,e.direction),u.worldUpAtPosition(g.eye,S));if(t<m&&r<0||t>=m&&r>0)return null;if(u.intersectInfiniteManifold(e,m,F)){const e=R(c,F);return e.z??=0,e.z-=p,e}return null}const _=t(y.get());g.projectToRenderScreen(e.origin,_);const w=new k(null,this._forEachLayer),{slicePlane:v}=c,j=null!=v?M(v):null,U=I(this.viewingMode);U.options.store=b.MIN,U.options.verticalOffset=m,U.options.normalRequired=!1;const x=e.origin,T=n(y.get(),x,e.direction);U.reset(x,T,g),U.point=_;let E=null;if(a&&"type"in a&&"graphics"===a.type){const e=c.allLayerViews.find((e=>e.layer===a))?.uid;E=e?t=>t.layerViewUid===e:null}else a&&(E=e=>e.graphicUid!==a.uid);switch(d){case"relative-to-scene":{const e=e=>(!E||E(e))&&!!e.lastValidElevationBB;U.intersect(w.layers,_,this._tolerance,null,e),this._externalIntersectionHandlers.forAll((e=>{if(e.type===P.I3S||e.type===P.TERRAIN||e.type===P.TILES3D){const t=e.slicePlaneEnabled?j:null;e.intersect(U,t,U.rayBegin,U.rayEnd,_)}}));break}case"on-the-ground":case"relative-to-ground":this._externalIntersectionHandlers.forAll((e=>{if(e.isGround){const t=e.slicePlaneEnabled?j:null;e.intersect(U,t,U.rayBegin,U.rayEnd,_)}}))}if(U.results.min.getIntersectionPoint(F)){const e=R(c,F);return e.z=l,e}return null}computeIntersection(e,r,i,s){if(null==e)return;const o=this._view.state.camera,l=t(y.get());o.projectToRenderScreen(e.origin,l);const a=new k(i,this._forEachLayer);r.options.selectOpaqueTerrainOnly=!i||!("include"in i||"exclude"in i);const c=e.origin,u=n(y.get(),e.origin,e.direction);r.reset(c,u,o),r.intersect(a.layers,l,this._tolerance);const h=this._view.slicePlane,d=null!=h?M(h):null;r.intersect(a.sliceableLayers,l,this._tolerance,d);const p=i&&(i.requiresGroundFeedback||i.enableDraped);this._externalIntersectionHandlers.forAll((e=>{const t=e.layerViewUid,i=Array.isArray(t),n=i?t:[t];i&&(r.options.filteredLayerViewUids=[]);let o=!1;for(const s of n){!a.filterLayerViewUid(s)?i&&r.options.filteredLayerViewUids.push(s):o=!0}if(r.options.isFiltered=!o,e.isGround&&p||!r.options.isFiltered){const t=e.slicePlaneEnabled?d:null;e.intersect(r,t,c,u,l,s)}}));const m=y.get(),f=this._view.basemapTerrain;if(i&&i.enableDraped&&null!=f.spatialReference&&r.results.ground.getIntersectionPoint(m)){const e=f.overlayManager.renderer,t=this._view.renderCoordsHelper.spatialReference,i=y.get();this._view.renderCoordsHelper.fromRenderCoords(m,i,f.spatialReference),i[2]=this._view.elevationProvider?.getElevation(m[0],m[1],m[2],t,"ground")??0,e.intersect(r,i,r.results.ground,(e=>a.filterRenderGeometry(e)))}r.sortResults(),this._processHUDResults(r)}_processHUDResults(e){const t=e.results.hud;c(this._tmpRegion,u);const r=this._view.state.camera,i=[],n=this._tmpRegion,s=e=>{const t=new H(e),s=t.result.target.object.geometries.every((e=>e.material instanceof U&&e.material.parameters.occlusionTest));i.push({item:t,occlusionTest:s}),s&&(r.projectToRenderScreen(e.target.center,t.screenPoint),t.screenPoint[0]=Math.floor(t.screenPoint[0]),t.screenPoint[1]=Math.floor(t.screenPoint[1]),p(n,t.screenPoint))};e.sortResults(t.all),null!=t.min.dist&&s(t.min);for(const c of t.all)t.min.target.object!==c.target.object&&t.max.target.object!==c.target.object&&s(c);if(null!=t.max.dist&&t.max.target.object!==t.min.target.object&&s(t.max),!i.length)return;n[0]===n[2]&&(n[2]+=1),n[1]===n[3]&&(n[3]+=1);const o=r.fullWidth,l=r.fullHeight,a=Math.max(0,n[0]-T),m=Math.max(0,n[1]-T),y=Math.min(h(n)+2*T,o-a),f=Math.min(d(n)+2*T,l-m),g=y>0&&f>0?new Uint8Array(y*f*4):null;g&&this._view.stage.renderer.readHUDVisibility(a,m,y,f,g);let R=!0;const _=null==e.results.max.dist;let w=0;for(const{item:c,occlusionTest:u}of i){let t=!u;if(u&&g)for(const e of E){const r=4*(Math.min(c.screenPoint[0]+e[0],o)-n[0]+(Math.min(c.screenPoint[1]+e[1],l)-n[1])*y);if(r>=0&&r<g.length&&g[r]){t=!0;break}}t&&(R&&(e.results.min.copy(c.result),R=!1),_&&e.results.max.copy(c.result),e.options.store===b.ALL&&e.results.all.splice(w++,0,c.result))}}}const T=1,E=(()=>{const e=[],t=T;for(let r=-1;r<=t;r++)for(let i=-1;i<=t;i++)e.push([i+t,r+t]);return e})();class H{constructor(e){this.result=e,this.screenPoint=r()}}let L;function A(e){return L&&L.viewingMode===e||(L=I(e)),L}class k{constructor(e,t){this.layers=new Array,this.sliceableLayers=new Array,this.include=e?.include,this.exclude=e?.exclude,t((e=>{e.pickable&&this.filterLayerViewUid(e.apiLayerViewUid)&&(e.sliceable?this.sliceableLayers:this.layers).push(e)}))}filterLayerViewUid(e){const{include:t,exclude:r}=this;return null==e?null==t&&null==r:(null==t||t.has(e))&&(null==r||!r.has(e))}filterRenderGeometry(e){return this.filterLayerViewUid(e.layerViewUid)}}function V(e){return"object"==typeof e&&"intersect"in e}const F=l(),S=l(),D=r();export{x as SceneIntersectionHelper,V as isIntersectionHandler};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{
|
|
5
|
+
import{BufferViewVec2f16 as e,BufferViewVec2f as t,BufferViewVec2f64 as i,BufferViewVec3f as s,BufferViewVec3f64 as r,BufferViewVec4f as n,BufferViewVec4f64 as h,BufferViewMat3f as d,BufferViewMat3f64 as u,BufferViewMat4f as f,BufferViewMat4f64 as o,BufferViewVec4u8 as l,BufferViewFloat as p,BufferViewFloat64 as c,BufferViewUint8 as a,BufferViewUint16 as _,BufferViewInt8 as y,BufferViewVec2i8 as F,BufferViewVec2i16 as m,BufferViewVec2u8 as b,BufferViewVec4u16 as g,BufferViewUint32 as w,BufferViewVec3u8 as v,BufferViewVec2u16 as E,BufferViewVec3u16 as M,BufferViewVec2u32 as T,BufferViewVec3u32 as A,BufferViewVec4u32 as B,BufferViewVec3i8 as U,BufferViewVec4i8 as C,BufferViewInt16 as L,BufferViewVec3i16 as j,BufferViewVec4i16 as x,BufferViewInt32 as z,BufferViewVec2i32 as $,BufferViewVec3i32 as V,BufferViewVec4i32 as k}from"../../../../geometry/support/buffer/BufferView.js";import{elementTypeSize as q}from"../../../../geometry/support/buffer/types.js";import{assert as D}from"../../webgl-engine/lib/Util.js";class G{constructor(e,t){this.layout=e,this.buffer="number"==typeof t?new ArrayBuffer(t*e.stride):t;for(const i of e.fields.keys()){const t=e.fields.get(i);this[i]=new t.constructor(this.buffer,t.offset,this.stride)}}get stride(){return this.layout.stride}get count(){return this.buffer.byteLength/this.stride}get byteLength(){return this.buffer.byteLength}getField(e,t){const i=this[e];return i&&i.elementCount===t.ElementCount&&i.elementType===t.ElementType?i:null}slice(e,t){return new G(this.layout,this.buffer.slice(e*this.stride,t*this.stride))}copyFrom(e,t=0,i=0,s=e.count){const r=this.stride;if(r%4==0){const n=new Uint32Array(e.buffer,t*r,s*r/4);new Uint32Array(this.buffer,i*r,s*r/4).set(n)}else{const n=new Uint8Array(e.buffer,t*r,s*r);new Uint8Array(this.buffer,i*r,s*r).set(n)}return this}get cachedMemory(){return this.byteLength}dispose(){}}class H{constructor(e){this._stride=0,this._fields=new Map,e&&(this._stride=e.stride,e.fields.forEach((e=>this._fields.set(e[0],{...e[1],constructor:O(e[1].constructor)}))))}freeze(){return this}vec2f16(t,i){return this._appendField(t,e,i),this}vec2f(e,i){return this._appendField(e,t,i),this}vec2f64(e,t){return this._appendField(e,i,t),this}vec3f(e,t){return this._appendField(e,s,t),this}vec3f64(e,t){return this._appendField(e,r,t),this}vec4f(e,t){return this._appendField(e,n,t),this}vec4f64(e,t){return this._appendField(e,h,t),this}mat3f(e,t){return this._appendField(e,d,t),this}mat3f64(e,t){return this._appendField(e,u,t),this}mat4f(e,t){return this._appendField(e,f,t),this}mat4f64(e,t){return this._appendField(e,o,t),this}vec4u8(e,t){return this._appendField(e,l,t),this}f32(e,t){return this._appendField(e,p,t),this}f64(e,t){return this._appendField(e,c,t),this}u8(e,t){return this._appendField(e,a,t),this}u16(e,t){return this._appendField(e,_,t),this}i8(e,t){return this._appendField(e,y,t),this}vec2i8(e,t){return this._appendField(e,F,t),this}vec2i16(e,t){return this._appendField(e,m,t),this}vec2u8(e,t){return this._appendField(e,b,t),this}vec4u16(e,t){return this._appendField(e,g,t),this}u32(e,t){return this._appendField(e,w,t),this}_appendField(e,t,i){if(this._fields.has(e))return void D(!1,`${e} already added to vertex buffer layout`);const s=t.ElementCount*q(t.ElementType),r=this._stride;this._fields.set(e,{constructor:t,size:s,offset:r,optional:i}),this._alignFields()}_alignFields(){let e=0,t=1;this._fields.forEach((i=>{const s=q(i.constructor.ElementType);e=Math.floor((e+s-1)/s)*s,i.offset=e,e+=i.size,t=Math.max(t,s)})),e=Math.floor((e+t-1)/t)*t,this._stride=e}createBuffer(e){return new G(this,e)}createView(e){return new G(this,e)}clone(){const e=new H;return e._stride=this._stride,e._fields=new Map,this._fields.forEach(((t,i)=>e._fields.set(i,t))),e.BufferType=this.BufferType,e}get stride(){return this._stride}get fields(){return this._fields}}function I(){return new H}class J{constructor(e){this.fields=new Array,e.fields.forEach(((e,t)=>{const i={...e,constructor:N(e.constructor)};this.fields.push([t,i])})),this.stride=e.stride}}const K=[p,t,s,n,d,f,c,i,r,h,u,o,a,b,v,l,_,E,M,g,w,T,A,B,y,F,U,C,L,m,j,x,z,$,V,k];function N(e){return`${e.ElementType}_${e.ElementCount}`}function O(e){return P.get(e)}const P=new Map;K.forEach((e=>P.set(N(e),e)));export{G as InterleavedBuffer,H as InterleavedLayout,J as PackedLayout,I as newLayout};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{DataType as e}from"../../../webgl/enums.js";import{VertexElementDescriptor as r}from"../../../webgl/VertexElementDescriptor.js";function t(e,t=0){const n=e.stride;return Array.from(e.fields.keys()).map((s=>{const i=e.fields.get(s),
|
|
5
|
+
import{DataType as e}from"../../../webgl/enums.js";import{VertexElementDescriptor as r}from"../../../webgl/VertexElementDescriptor.js";function t(e,t=0){const n=e.stride;return Array.from(e.fields.keys()).map((s=>{const i=e.fields.get(s),f=i.constructor.ElementCount,u=o(i.constructor.ElementType),c=i.offset,m=i.optional?.glNormalized??!1;return new r(s,f,u,c,n,m,t)}))}function o(e){const r=n[e];if(r)return r;throw new Error("BufferType not supported in WebGL")}const n={u8:e.UNSIGNED_BYTE,u16:e.UNSIGNED_SHORT,u32:e.UNSIGNED_INT,i8:e.BYTE,i16:e.SHORT,i32:e.INT,f16:e.HALF_FLOAT,f32:e.FLOAT};export{t as glLayout};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../Graphic.js";import has from"../../../core/has.js";import{isIterable as n}from"../../../core/iteratorUtils.js";import{createScreenPointArray as
|
|
5
|
+
import e from"../../../Graphic.js";import has from"../../../core/has.js";import{isIterable as n}from"../../../core/iteratorUtils.js";import{createScreenPointArray as i,screenPointObjectToArray as t}from"../../../core/screenUtils.js";import{create as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import s from"../../../geometry/Point.js";import o from"../../../geometry/SpatialReference.js";import{projectVectorToVector as l}from"../../../geometry/projection/projectVectorToVector.js";import{fallbackObjectIDAttribute as c}from"../../../layers/LayerConstants.js";import{isIntegratedMeshLayer as a}from"../../../layers/support/layerUtils.js";import{debugFlags as u}from"./debugFlags.js";import{getElevationAtPoint as d}from"./ElevationProvider.js";import{newIntersector as p}from"../webgl-engine/lib/Intersector.js";import{StoreResults as m,IntersectorType as f}from"../webgl-engine/lib/IntersectorInterfaces.js";import{isValidIntersectorResult as g}from"../webgl-engine/lib/intersectorUtils.js";import{toOwner as h,toHit as y,toHitAsync as E}from"../webgl-engine/lib/intersectorUtilsConversions.js";import{terrainId as w}from"../webgl-engine/lib/verticalOffsetUtils.js";async function U(e,n,t,r){const s=t?C(e,t):r,o=i(n.x,n.y);s.requiresGroundFeedback=!0,s.enableDraped=!0;const l=p(e.state.viewingMode);l.options.selectionMode=!0,l.options.store=m.ALL,e.sceneIntersectionHelper.intersectIntersectorScreen(o,l,s);let c=[];c=has("feature-pipeline-3d-test")?await j(e,l.results.all,s.graphics):I(e,l.results.all,s.graphics);const d=l.results.ground,f=h(d,e),y=null!=f&&"type"in f&&a(f.type)?f:null,E={screenPoint:n,results:c,ground:{mapPoint:S(e,d),distance:g(d)?d.distanceInRenderSpace:0,layer:y}};return u.SCENEVIEW_HITTEST_RETURN_INTERSECTOR&&(E.intersector=l),E}function b(e,n,i,r){const s=i?C(e,i):r,o=!(!s.graphics?.include&&!s.graphics?.exclude),l=!(!s.mediaElements?.include&&!s.mediaElements?.exclude),c=t(n);s.enableDraped=s.include&&!s.include.has(w)||s.exclude?.has(w);const a=e.sceneIntersectionHelper,u=p(e.state.viewingMode);if(u.options.selectionMode=!0,u.options.store=o||l?m.ALL:m.MIN,u.options.excludeLabels=i?.excludeLabels??!1,a.intersectIntersectorScreen(c,u,s),o||l){for(const n of u.results.all){const i=y(n,e);if(null==i)return S(e,n);if(o&&("graphic"!==i.type||x(s.graphics,i.graphic)))return S(e,n);if(l&&("media"!==i.type||R(s.mediaElements,i.element)))return S(e,n)}return null}return S(e,u.results.min)}function I(e,n,i){const t=new Array;let r=null;for(let s=0;s<n.length;s++){const o=n[s],l=h(o,e);if(null!=l&&(l===e.map.ground||"type"in l&&a(l.type)))break;const c=y(o,e);if(null==c)continue;if("graphic"===c.type){if(null==r&&s!==n.length-1&&(r=new Set),null!=r){const e=L(c.graphic);if(r.has(e))continue;r.add(e)}if(!x(i,c.graphic))continue}const u=S(e,o),d=o.distanceInRenderSpace;if("media"===c.type){const e=c.element.toSource(u);t.push({...c,mapPoint:u,distance:d,sourcePoint:e})}else t.push({...c,mapPoint:u,distance:d})}return t}async function j(e,n,i){const t=new Array;let r=null;for(let s=0;s<n.length;s++){const o=n[s],l=h(o,e);if(null!=l&&(l===e.map.ground||"type"in l&&a(l.type)))break;const c=await E(o,e);if(null==c)continue;if("graphic"===c.type){if(null==r&&s!==n.length-1&&(r=new Set),null!=r){const e=L(c.graphic);if(r.has(e))continue;r.add(e)}if(!x(i,c.graphic))continue}const u=S(e,o),d=o.distanceInRenderSpace;if("media"===c.type){const e=c.element.toSource(u);t.push({...c,mapPoint:u,distance:d,sourcePoint:e})}else t.push({...c,mapPoint:u,distance:d})}return t}function S(e,n,i){return n.getIntersectionPoint(A)?(i=V(e,A,i),n.intersector===f.TERRAIN&&e.basemapTerrain&&(i.z=d(e.basemapTerrain,i)??0),i):null}function L(e){const n=e.sourceLayer,i=e.layer,t=n&&"objectIdField"in n?n:i&&"objectIdField"in i?i:n;if(t){const n=t.objectIdField??c,i=e.attributes?.[n];if(i)return`o-${t.id}-${i}`}return`u-${e.uid}`}function x(e,n){return R(e,L(n))}function R(e,n){return null==e||(null==e.include||e.include.has(n))&&(null==e.exclude||!e.exclude.has(n))}function V(e,n,i){let t=e.spatialReference||o.WGS84;return l(n,e.renderSpatialReference,A,t)?n=A:(t=o.WGS84,l(n,e.renderSpatialReference,A,t)&&(n=A)),i?(i.x=n[0],i.y=n[1],i.z=n[2],i.spatialReference=t):i=new s(n,t),i}function C(e,n){const i=v(e,n.include,F.INCLUDE),t=v(e,n.exclude,F.EXCLUDE);return{include:i.layerViewUids,exclude:t.layerViewUids,graphics:{include:i.graphicUids,exclude:t.graphicUids},mediaElements:{include:i.mediaElements,exclude:t.mediaElements}}}function v(i,t,r,s={layerViewUids:void 0,graphicUids:void 0,mediaElements:void 0}){if(!t)return s;if(t instanceof e)N(s,L(t)),r===F.INCLUDE&&(null!=i.graphicsView&&t.layer===i?D(s,i.graphicsView.uid):t.layer&&P(s,i,t.layer.uid));else if("layer"in t&&"element"in t)T(s,t.element),r===F.INCLUDE&&P(s,i,t.layer.uid);else if(n(t))for(const e of t)e===i.graphics&&null!=i.graphicsView?D(s,i.graphicsView.uid):e===i.map.ground?D(s,w):v(i,e,r,s);else"uid"in t&&P(s,i,t.uid);return s}function P(e,n,i){const t=n.allLayerViews.find((e=>e.layer.uid===i));t&&D(e,t.uid)}function D(e,n){e.layerViewUids||(e.layerViewUids=new Set),e.layerViewUids.add(n)}function N(e,n){e.graphicUids||(e.graphicUids=new Set),e.graphicUids.add(n)}function T(e,n){e.mediaElements||(e.mediaElements=new Set),e.mediaElements.add(n)}const A=r();var F;!function(e){e[e.INCLUDE=0]="INCLUDE",e[e.EXCLUDE=1]="EXCLUDE"}(F||(F={}));export{V as computeMapPointFromVec3d,C as externalToInternalIntersectOptions,L as getGraphicFilterUid,U as hitTest,S as intersectResultToMapPoint,b as toMap};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{OverlayContent as e}from"./OverlayContent.js";import{OverlayFramebufferObject as r}from"./OverlayFramebufferObject.js";import{ColorFormat as o}from"../webgl/formats.js";import{ShaderOutput as t}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{olidEnabled as l}from"../webgl-engine/effects/geometry/olidUtils.js";class s{constructor(e,t,l,s,i=o.
|
|
5
|
+
import{OverlayContent as e}from"./OverlayContent.js";import{OverlayFramebufferObject as r}from"./OverlayFramebufferObject.js";import{ColorFormat as o}from"../webgl/formats.js";import{ShaderOutput as t}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{olidEnabled as l}from"../webgl-engine/effects/geometry/olidUtils.js";class s{constructor(e,t,l,s,i=o.RGBA8_MIPMAP){this.output=l,this.content=s,this.fbo=new r(e,i,t)}get valid(){return this.fbo.valid}}class i{constructor(r){this.targets=[new s(r,"overlay color",t.Color,e.Color),new s(r,"overlay IM color",t.Color,e.ColorNoRasterImage),new s(r,"overlay highlight",t.Highlight,e.Highlight,o.RG8UI),new s(r,"overlay water",t.Normal,e.WaterNormal),new s(r,"overlay occluded",t.Color,e.Occluded)],l()&&this.targets.push(new s(r,"overlay olid",t.ObjectAndLayerIdColor,e.ObjectAndLayerIdColor,o.RGBA8))}getTexture(e){return this.targets[e]?.fbo.texture}dispose(){for(const e of this.targets)e.fbo.dispose()}computeValidity(){return this.targets.reduce(((e,r,o)=>r.valid?e|=1<<o:e),0)}}export{i as OverlayRenderTargets,s as RenderTargetDescriptor};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{releaseMaybe as t}from"../../../core/maybe.js";import{g as e}from"../../../chunks/vec32.js";import{empty as s}from"../../../geometry/support/aaBoundingBox.js";import{internalAssert as i}from"./terrainUtils.js";import{decompressNormal as r,compressNormal as n}from"../webgl-engine/lib/Normals.js";class
|
|
5
|
+
import{releaseMaybe as t}from"../../../core/maybe.js";import{g as e}from"../../../chunks/vec32.js";import{empty as s}from"../../../geometry/support/aaBoundingBox.js";import{internalAssert as i}from"./terrainUtils.js";import{decompressNormal as r,compressNormal as n}from"../webgl-engine/lib/Normals.js";class d{constructor(){this.indices=null,this.indexCount=0,this.edgeIndicesStartIndex=0,this.poleIndicesStartIndex=0,this.vertexAttributes=null,this.edgeVerticesStartIndex=0,this.poleVerticesStartIndex=0,this.maxEdgeVertexCount=0,this.boundingBox=s(),this.numVerticesPerSide=0,this.minu=0,this.minv=0,this.maxu=1,this.maxv=1,this.outerEdgesOffsetAndLength=[0,0,0,0,0,0,0,0]}release(){this.vertexAttributes=t(this.vertexAttributes),this.indices=null}reset(){this.indices=null,this.vertexAttributes=null,s(this.boundingBox),this.numVerticesPerSide=0}getEdgeFirstVertexIndex(t){return this.outerEdgesOffsetAndLength[2*t]}getEdgeCount(t){return this.outerEdgesOffsetAndLength[2*t+1]}getEdgeVertexIndex(t,e){return this.getEdgeAttributeIndex(t,e)}getEdgeVertexPosition(t,s,i,r){this._getEdgeVertexRaw(this.getEdgeAttributeIndex(t,r),s),e(s,s,i)}getEdgeNormal(t,e,s){const{typedBuffer:i,typedBufferStride:n}=this.vertexAttributes.normalCompressed;r(e,i,this.getEdgeAttributeIndex(t,s),n)}setEdgeNormalFromValues(t,e,s,i,r){this._setNormal(this.getEdgeAttributeIndex(t,e),s,i,r)}setEdgeVertexFromValuesRawPositionUV(t,e,s,i,r,n,d){const o=this.getEdgeAttributeIndex(t,e);this.vertexAttributes.position.setValues(o,s,i,r),this._setUV(o,n,d)}setEdgeVertexFromValuesRawPositionUVNormal(t,e,s,i,r,n,d,o,u,g){const h=this.getEdgeAttributeIndex(t,e);this.vertexAttributes.position.setValues(h,s,i,r),this._setUV(h,n,d),this._setNormal(h,o,u,g)}_getEdgeVertexRaw(t,e){this.vertexAttributes.position.getVec(t,e)}_setNormal(t,e,s,i){const{typedBuffer:r,typedBufferStride:d}=this.vertexAttributes.normalCompressed;n(r,t,e,s,i,d)}_setUV(t,e,s){this.vertexAttributes.uv0.setValues(t,e,s)}getEdgeAttributeIndex(t,e){return i(0<=e&&e<this.getEdgeCount(t)),this.getEdgeFirstVertexIndex(t)+e}}export{d as PatchGeometry};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/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.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};
|
|
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{PatchGeometryLUT as a}from"./PatchGeometryLUT.js";import{neighborTileIfLoadedOrSelf as c,zeroToFour as l}from"./PatchRenderData.js";import{internalAssert as u,enableTerrainInternalChecks as d,neighborEdgeIndices as f,almostEquals as m}from"./terrainUtils.js";import{isCornerNeighbor as g}from"./Tile.js";import{compareTilesByLij as p}from"./tileUtils.js";import{compressNormal as x}from"../webgl-engine/lib/Normals.js";const h=65536;function M(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))*ge*d,M=de(i),v=g+h+4*M,V=u.tileGeometryCache.acquire(v);s.numVerticesPerSide=d,s.vertexAttributes=V,s.maxEdgeVertexCount=M;const{boundingBox:B}=s;n(B);const b=E(e);se.update(m,a,b),y(e),s.poleVerticesStartIndex=g;const L=S(e,p,x);s.edgeVerticesStartIndex=g+h,Q(e),I(e),_(s,L,f),e.intersectionData=null}function S(e,t,n){const{tile:o,localOrigin:s,geometry:r}=e,{extent:i,ellipsoid:a}=o,{boundingBox:c,numVerticesPerSide:l,vertexAttributes:u,poleVerticesStartIndex:d}=r,f=l-1,m=s[0],g=s[1],p=s[2],h=a.radius,M=i[1],S=i[3],y=[];let v=d;const V=(e,t)=>{const n=t*l;ue(-m,-g,e*h-p,c),y.push(new ne(1===e,n,1===e?0:2,v,ge));const o=C(-1===e?M:S,h),s=e*Math.PI/2-o,r=.99*(1===e?1:-1),i=h+0,{position:a,uv0:d}=u,{typedBuffer:V,typedBufferStride:B}=u.normalCompressed;for(let l=1;l<=ge;++l){const e=o+s*(l/ge),t=Math.cos(e),n=Math.sin(e);for(let o=0;o<=f;o++){const e=o/f,s=se.sinLonLUT[o],l=se.cosLonLUT[o]*t,u=s*t,h=n,M=l*i-m,S=u*i-g,y=h*i-p;ue(M,S,y,c),a.setValues(v,M,S,y),d.setValues(v,e,r),x(V,v,l,u,h,B),++v}}};return t&&V(-1,0),n&&V(1,f),y}function y(e){const{tile:t}=e;if(!t.intersectsClippingArea)return;const{geometry:n,geometryState:o,localOrigin:r}=e,{numVerticesPerSide:i,samplerData:a}=o,c=i-2,l=i-1,{vertexAttributes:u,boundingBox:d}=n,{position:f,uv0:m}=u,{typedBuffer:g,typedBufferStride:p}=u.normalCompressed,{extent:h}=t,M=h[0],S=h[2],y=h[1],v=h[3],V=t.ellipsoid.radius,B=r[0],I=r[1],b=r[2],L=f.typedBuffer,C=f.typedBufferStride,A=1/l;let P=0;if(1<=c){const e=A,t=y*(1-e)+v*e,n=se.sinLatLUT[1],o=se.cosLatLUT[1];for(let r=1;r<=c;r++){const i=r*A,c=M*(1-i)+S*i,l=se.sinLonLUT[r],u=se.cosLonLUT[r],f=V+s(c,t,a),g=f*u*o-B,p=f*l*o-I,x=f*n-b;ue(g,p,x,d);const h=(r-1)*C;L[h]=g,L[h+1]=p,L[h+2]=x,m.setValues(r-1,i,e)}}for(let E=1;E<=c;E++){const e=E*A,t=y*(1-e)+v*e,n=se.sinLatLUT[E],o=se.cosLatLUT[E],r=E+1,i=r*A,u=y*(1-i)+v*i,f=se.sinLatLUT[r],h=se.cosLatLUT[r],O=se.sinLonLUT[0],T=se.cosLonLUT[0],D=V+s(M,t,a);let R=T*o*D-B,U=O*o*D-I,N=n*D-b;const w=P*C;let j=L[w],F=L[w+1],H=L[w+2];for(let v=1;v<=c;v++){const e=v*A,r=M*(1-e)+S*e,O=se.sinLonLUT[v],T=se.cosLonLUT[v];let D=0,w=0,q=0;if(v<c){const e=(P+1)*C;D=L[e],w=L[e+1],q=L[e+2]}else{const e=se.sinLonLUT[l],r=se.cosLonLUT[l],i=V+s(S,t,a);D=r*o*i-B,w=e*o*i-I,q=n*i-b}const _=R,W=U,k=N;R=j,U=F,N=H,j=D,F=w,H=q;const z=D-_,G=w-W,J=q-k;let K=0,Q=0,X=0;if(E>1){const e=(P-c)*C;K=L[e],Q=L[e+1],X=L[e+2]}else{const e=se.sinLatLUT[0],t=se.cosLatLUT[0],n=V+s(r,y,a);K=T*t*n-B,Q=O*t*n-I,X=e*n-b}const Y=V+s(r,u,a),Z=T*h*Y-B,$=O*h*Y-I,ee=f*Y-b;if(E<c){const t=P+c,n=t*C;L[n]=Z,L[n+1]=$,L[n+2]=ee,ue(Z,$,ee,d),m.setValues(t,e,i)}const te=K-Z,ne=Q-$,oe=X-ee;let re=T*o,ie=O*o,ae=n;ae*ae<.999&&(re=J*ne-G*oe,ie=z*oe-J*te,ae=G*te-z*ne);const ce=1/Math.sqrt(re*re+ie*ie+ae*ae);x(g,P,re*ce,ie*ce,ae*ce,p),++P}}}function v(e){e.tile.intersectsClippingArea&&(I(e),ee(e),e.intersectionData=null)}function V(e){e.tile.intersectsClippingArea&&(X(e),I(e),ee(e),te(e),e.intersectionData=null)}function B(e){e.tile.intersectsClippingArea&&(L(e),b(e,!0),ee(e),e.intersectionData=null)}function I(e){e.tile.intersectsClippingArea&&(L(e),b(e))}function b(t,n=!1){const{geometry:o,geometryState:r,tile:i,localOrigin:a}=t,{level:l,extent:g,extentInRadians:x,ellipsoid:h}=i,M=h.radius,S=x[0],y=x[2],v=x[1],V=x[3],{samplerData:B}=r,I=g[0],b=g[2],L=g[1],C=g[3],A=E(t),{boundingBox:P,vertexAttributes:O}=o,T=a[0],D=a[1],R=a[2],{position:U,uv0:N}=O,w=U.typedBuffer,j=U.typedBufferStride;for(let E=0;E<4;++E){const a=1===E||3===E,x=r.edgeResolutions[E];u(e(x));const h=x+1,O=c(i,r.edgePeerNeighbors[E]);if(ae(i,O,E)){Y(t,E,O);continue}const U=null!=O;u(!U||O.level===i.level),u(!U||p(i,O)<=0);const F=O?.renderData,H=F?.geometryState;if(d){const e=i.surface;if(!O&&e&&!e.updatingRootTiles){const t=f[E],n=i.findNeighborTile(t,(e=>e.loaded||e.leaf||e.level===i.level));n?n.intersectsClippingArea&&(u(!n.loaded),u(!n.leaf),u(n.level===l)):u(null==e?.rootTiles||!i.shouldHaveNeighbor(t))}}const q=1===E?g[2]:g[0],_=O?.extent,W=_&&a?1===E?_[0]:_[2]:q,k=0===E?g[3]:g[1],z=1===E?1:0,G=0===E?1:0,J=1===E?y:S,K=0===E?V:v,Q=Math.sin(J),X=Math.cos(J),Z=Math.sin(K),$=Math.cos(K),ee=H?.samplerData,te=U?(e,t,n)=>.5*(s(e,t,B)+s(n,t,ee)):(e,t,n)=>s(e,t,B),ne=o.outerEdgesOffsetAndLength[2*E+0],oe=n&&h>3?h-3:1,se=null!=B&&B.some((e=>null!=e)),re=null!=ee&&ee.some((e=>null!=e)),ie=se||re,ce=1/x,le=ne;u(!_||m(_[2]-_[0],g[2]-g[0]));(()=>{const e=1===E?-1:3===E?1:0,t=0===E?-1:2===E?1:0,n=(g[2]-g[0])*ce,r=e*n,i=t*n,c=a?e*((y-S)*ce):0,l=a?0:t*ce,u=G,d=a?J+c:J,f=a?Math.sin(d):Q,m=a?Math.cos(d):X,p=a?J-c:J,x=a?Math.sin(p):Q,v=a?Math.cos(p):X,V=a?K:A(u+l),O=a?Z:Math.sin(V),F=a?$:Math.cos(V),H=a?K:A(u-l),_=a?Z:Math.sin(H),Y=a?$:Math.cos(H);let ne=0,se=0,re=0;{const e=0*ce,t=a?q:I*(1-e)+b*e,n=a?W:t,o=a?L*(1-e)+C*e:k,s=a?J:S*(1-e)+y*e,r=a?Q:Math.sin(s),i=a?X:Math.cos(s),c=a?A(e):K,l=a?Math.sin(c):Z,u=a?Math.cos(c):$,d=M+te(t,o,n);ne=i*u*d,se=r*u*d,re=l*d}let ae=0,de=0,fe=0;{const e=1*ce,t=a?q:I*(1-e)+b*e,n=a?W:t,o=a?L*(1-e)+C*e:k,s=a?J:S*(1-e)+y*e,r=a?Q:Math.sin(s),i=a?X:Math.cos(s),c=a?A(e):K,l=a?Math.sin(c):Z,u=a?Math.cos(c):$,d=M+te(t,o,n);ae=i*u*d,de=r*u*d,fe=l*d}for(let g=1;g<h-1;g+=oe){let e=0,t=0,n=0;{const o=(g+1)*ce,s=a?q:I*(1-o)+b*o,r=a?W:s,i=a?L*(1-o)+C*o:k,c=a?J:S*(1-o)+y*o,l=a?Q:Math.sin(c),u=a?X:Math.cos(c),d=a?A(o):K,f=a?Math.sin(d):Z,m=a?Math.cos(d):$,p=M+te(s,i,r);e=u*m*p,t=l*m*p,n=f*p}const c=e,l=t,u=n,d=ae,p=de,h=fe;ae=c,de=l,fe=u;{const e=le+g,t=e*j,n=d-T,o=p-D,s=h-R;w[t]=n,w[t+1]=o,w[t+2]=s,ue(n,o,s,P);const r=g*ce,i=a?z:r,c=a?r:G;N.setValues(e,i,c)}const V=ne,H=se,oe=re;ne=d,se=p,re=h;const me=d,ge=p,pe=h,xe=1/Math.sqrt(me*me+ge*ge+pe*pe),he=pe*xe;let Me=0,Se=0,ye=0;if(ie&&he*he<.999){let e=0,t=0,n=0;{const o=0===E?-1:1;e=o*(c-V),t=o*(l-H),n=o*(u-oe)}{const o=g*ce,c=a?q:I*(1-o)+b*o,l=a?W:c,u=a?L*(1-o)+C*o:k,d=a?J:S*(1-o)+y*o,p=a?Q:Math.sin(d),h=a?X:Math.cos(d),V=a?A(o):K,P=a?Math.sin(V):Z,T=a?Math.cos(V):$;let D=me,R=ge,N=pe;if(U){const e=M+s(l-r,u-i,ee),t=a?T:Y;D=(a?v:h)*t*e,R=(a?x:p)*t*e,N=(a?P:_)*e}{const o=M+s(c+r,u+i,B),l=a?T:F,d=(a?m:h)*l*o,g=(a?f:p)*l*o,x=(a?P:O)*o;U||(D=2*me-d,R=2*ge-g,N=2*pe-x);const S=3===E?-1:1,y=S*(D-d),v=S*(R-g),V=S*(N-x);Me=n*v-t*V,Se=e*V-n*y,ye=t*y-e*v;const I=1/Math.sqrt(Me*Me+Se*Se+ye*ye);Me*=I,Se*=I,ye*=I}}}else Me=me*xe,Se=ge*xe,ye=pe*xe;o.setEdgeNormalFromValues(E,g,Me,Se,ye)}})()}}function L(e){Z(e)}function C(e,t){return Math.PI/2-2*Math.atan(Math.exp(-e/t))}function A(e,t,n,o){return C(e*(1-o)+t*o,n)}function P(e,t,n){return e*(1-n)+t*n}function E(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=>P(n[1],n[3],e)}function O(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=de(s),v=S+4*y,V=a.renderer.tileGeometryCache.acquire(v),{boundingBox:B}=r;n(B),r.numVerticesPerSide=m,r.vertexAttributes=V,r.maxEdgeVertexCount=y,r.minu=p,r.minv=x,r.maxu=h,r.maxv=M,T(e),r.edgeVerticesStartIndex=S,Q(e),N(e),_(r,[],c),e.intersectionData=null}function T(e){const n=e.tile;if(!n.intersectsClippingArea)return;const{geometry:o,geometryState:r,localOrigin:i}=e,{samplerData:a,clippingArea:c,numVerticesPerSide:l}=r,{surface:u,extent:d,ellipsoid:f}=n,{isWebMercatorOnPlateCarree:m}=u,g=null!=c?c:re,p=d[0],h=d[1],M=d[2],S=d[3],y=Math.max(p,g[0]),v=Math.min(M,g[2]),V=Math.max(h,g[1]),B=Math.min(S,g[3]),I=f.radius,b=n.horizontalScale,L=l-1,C=l-2,{minu:A,minv:P,maxu:E,maxv:O,boundingBox:T,vertexAttributes:D}=o,{position:R,uv0:U}=D,{typedBuffer:N,typedBufferStride:w}=D.normalCompressed,j=i[0],F=i[1],H=i[2],q=R.typedBuffer,_=R.typedBufferStride;let W=0;const k=t(h,V,B),z=m?(Math.PI/2-2*Math.atan(Math.exp(-k/I)))*I:k*b,G=1/L,J=t(h*(1-G)+S*G,V,B);let K=z,Q=m?(Math.PI/2-2*Math.atan(Math.exp(-J/I)))*I:J*b;for(let X=1;X<=C;X++){const e=X/L,n=t(h*(1-e)+S*e,V,B),o=t(e,P,O),r=Q,i=(X-1)/L,c=t(h*(1-i)+S*i,V,B),l=K,u=(X+1)/L,d=t(h*(1-u)+S*u,V,B),f=m?(Math.PI/2-2*Math.atan(Math.exp(-d/I)))*I:d*b,g=t(u,P,O);K=Q,Q=f;const D=t(p,y,v);let R=D*b,k=s(D,n,a);const z=1/L,G=t(z,A,E),J=t(p*(1-G)+M*G,y,v);let Y=G,Z=J,$=J*b,ee=s(J,n,a);if(1===X){const e=$-j,n=K-F,s=ee-H,r=0*_;q[r]=e,q[r+1]=n,q[r+2]=s,ue(e,n,s,T);const i=t(z,A,E);U.setValues(W,i,o)}for(let m=1;m<=C;m++){const e=$,i=ee,u=(m+1)/L,h=t(u,A,E),S=t(p*(1-u)+M*u,y,v),V=Z;Z=S;{const e=W+1,t=e*_;if(1===X||m===C){const i=S*b,c=s(S,n,a);if(1===X&&m<C){const n=i-j,s=r-F,a=c-H;q[t]=n,q[t+1]=s,q[t+2]=a,ue(n,s,a,T),U.setValues(e,h,o)}$=i,ee=c}else $=q[t]+j,ee=q[t+2]+H}const B=$,I=ee,P=R,O=k;R=e,k=i;const D=(W-C)*_,z=1===X?s(V,c,a):q[D+2]+H,G=s(V,d,a);if(X<C){const t=W+C,n=t*_,o=e-j,s=f-F,r=G-H;q[n]=o,q[n+1]=s,q[n+2]=r,ue(o,s,r,T);const i=Y;Y=h,U.setValues(t,i,g)}{const e=B-P,t=l-f,n=t*(I-O),o=e*(z-G),s=-t*e,r=n*n+o*o+s*s;if(0===r)x(N,W,0,0,1,w);else{const e=1/Math.sqrt(r);x(N,W,n*e,o*e,s*e,w)}}++W}}}function D(e,t){e.tile.intersectsClippingArea&&(j(e),w(e,!0),ee(e),e.intersectionData=null)}function R(e,t){e.tile.intersectsClippingArea&&(X(e),N(e),ee(e),te(e),e.intersectionData=null)}function U(e,t){e.tile.intersectsClippingArea&&(N(e),ee(e),e.intersectionData=null)}function N(e,t){e.tile.intersectsClippingArea&&(j(e),w(e,!1))}function w(n,o){const{geometry:r,geometryState:i,localOrigin:a}=n,l=n.tile,{surface:m,extent:g}=l,{clippingArea:x,samplerData:h}=i,M=null!=x?x:re,S=g[0],y=g[2],v=g[1],V=g[3],B=[V>M[3],y>M[2],v<M[1],S<M[0]],I=l.horizontalScale,b=q(m.isWebMercatorOnPlateCarree,l.ellipsoid.radius,I),{minu:L,minv:C,maxu:A,maxv:P,boundingBox:E}=r,O=Math.max(S,M[0]),T=Math.min(y,M[2]),D=Math.max(v,M[1]),R=Math.min(V,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];u(e(g));const x=g+1,M=B[j],F=c(l,i.edgePeerNeighbors[j]);if(!M&&ae(l,F,j)){Y(n,j,F);continue}const H=null!=F&&!M,q=F?.renderData,_=q?.geometryState;if(d&&(u(!H||F.level===l.level),u(!H||p(l,F)<=0),l&&!F&&!m.updatingRootTiles)){const e=f[j],t=l.findNeighborTile(e,(e=>e.loaded||e.leaf||e.level===l.level));m.updatingRootTiles||(t?t.intersectsClippingArea&&(u(!t.loaded),u(!t.leaf),u(t.level===l.level)):u(null==m?.rootTiles||!l.shouldHaveNeighbor(e)))}const W=t(1===j?y:S,O,T),k=t(0===j?V:v,D,R),z=_?.samplerData,G=o&&x>3?x-3:1,J=t(1===j?1:0,L,A),K=t(0===j?1:0,C,P),Q=H?(e,t)=>.5*(s(e,t,z)+s(e,t,h)):(e,t)=>s(e,t,h),X=(y-S)/g,Z=a?1===j?X:-X:0,$=a?0:0===j?X:-X,ee=-Z,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)+V*e,D,R):k,s=Q(n,o);ne=n*I,oe=b(o),se=s}let re=0,ie=0,ce=0;{const e=1/g,n=a?W:t(S*(1-e)+y*e,O,T),o=a?t(v*(1-e)+V*e,D,R):k,s=Q(n,o);re=n*I,ie=b(o),ce=s}for(let e=1;e<x-1;e+=G){const n=e/g,o=re,i=ie,c=ce;{const s=a?J:t(n,L,A),l=a?t(n,C,P):K,u=o-U,d=i-N,f=c-w;ue(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)+V*n,D,R):k,r=Q(o,s);re=o*I,ie=b(s),ce=r}const l=re,u=ce,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)+V*n,D,R),g=W+ee,S=g*I-o,y=s(g,d,h)-c,B=3===j?-1:1;if(p=B*(-a+e)*y,x=B*S*(-l+r),M=-B*S*(-a+e),H){const t=W+Z,n=t*I-o;p=(-a+e)*(y-(s(t,d,z)-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=k+te,V=s(g,v,h)-c,B=b(v)-i,I=2===j?-1:1;if(p=I*B*(-f+r),x=I*(-a+e)*V,M=-I*B*(-a+e),H){const t=g,n=k+$,o=b(n)-i;p=(-B+o)*(-f+r),x=(-a+e)*(-V+(s(t,n,z)-c)),M=-(-B+o)*(-a+e)}}const B=1/Math.sqrt(p*p+x*x+M*M);r.setEdgeNormalFromValues(j,e,p*B,x*B,M*B)}}}function j(e,t){Z(e)}function F(e,t){return(Math.PI/2-2*Math.atan(Math.exp(-e/t)))*t}function H(e,t){return e*t}function q(e,t,n){return e?e=>F(e,t):e=>H(e,n)}function _(e,t,n){const{numVerticesPerSide:o,vertexAttributes:s,maxEdgeVertexCount:r}=e,i=o-1,a=s.count,c=2*(o-3)*(o-3),u=4*(i+r-3),d=l.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+u+f)*m,p=a>=h?new Uint32Array(g):new Uint16Array(g);for(let l=0;l<g;++l)p[l]=0;e.indices=p,e.indexCount=(c+d+f)*m,e.poleIndicesStartIndex=c*m,e.edgeIndicesStartIndex=(c+f)*m,n?(G(e),J(e,t),K(e)):(W(e),k(e,t),z(e))}function W(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;fe(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=le[a];let o=0,c=0;const l=e.getEdgeCount(a),d=n.count;u(d===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<d-1;){const e=h+c*M,n=p+o*x,a=o<l-1,u=c<d-1,f=a&&(!u||(a?0+s*(o+.5)/(l-1):0)<=(u?1+r*(c+.5)/(d-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 G(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;fe(f,m,g,g-1,i,r)?(me(t,c,n,s,u),c+=6,me(t,c,u,d,n)):(me(t,c,n,s,d),c+=6,me(t,c,d,u,s)),c+=6}}}function J(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++)me(n,i,s,s+1,t+o),i+=6,e<a.latitudeResolution-1&&(me(n,i,s+1,t+o+1,t+o),i+=6),s+=c;s=t,c=1}}}function K(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=le[a];let o=0,c=0;const l=e.getEdgeCount(a),d=n.count;u(d===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<d-1;){const e=h+c*M,n=p+o*x,a=o<l-1,u=c<d-1,f=a&&(!u||(a?0+s*(o+.5)/(l-1):0)<=(u?1+r*(c+.5)/(d-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 Q(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=le[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 X(e){Q(e),e.geometryState.wireframe?K(e.geometry):z(e.geometry)}function Y(n,o,s){const{geometryState:r,geometry:i,tile:a,localOrigin:c}=n,l=1===o||3===o,d=r.edgeResolutions[o];u(e(d));const f=d+1,{boundingBox:m,minu:g,minv:p,maxu:x,maxv:h,vertexAttributes:M}=i,S=t(1===o?1:0,g,x),y=t(0===o?1:0,p,h),v=s.renderData,V=v.geometryState,B=v.geometry,I=(o+2)%4,b=B.getEdgeCount(I),L=a.getNeighborEdgeStartVertexIndex(o,s)*d,C=d*2**(a.level-s.level);u(V.edgeResolutions[I]===C),u(b-1===C);const A=v.localOrigin[0]-c[0],P=v.localOrigin[1]-c[1],E=v.localOrigin[2]-c[2],O=i.getEdgeFirstVertexIndex(o),{position:T,uv0:D}=M,R=T.typedBuffer,U=T.typedBufferStride,N=M.normalCompressed,w=N.typedBuffer,j=N.typedBufferStride,F=B.vertexAttributes,H=B.getEdgeFirstVertexIndex(I),q=F.position.typedBuffer,_=F.position.typedBufferStride,W=F.normalCompressed.typedBuffer,k=F.normalCompressed.typedBufferStride;for(let e=1;e<f-1;++e){const n=O+e,o=H+(L+e),s=n*U,r=o*_,i=q[r]+A,a=q[r+1]+P,c=q[r+2]+E;R[s]=i,R[s+1]=a,R[s+2]=c,ue(i,a,c,m);const u=n*j,f=o*k;w[u]=W[f],w[u+1]=W[f+1];const M=e/d,v=l?S:t(M,g,x),V=l?t(M,p,h):y;D.setValues(n,v,V)}}function Z(e){const{geometry:n,geometryState:o,localOrigin:r}=e,{clippingArea:i,samplerData:a}=o,{minu:c,minv:l,maxu:d,maxv:f,boundingBox:m,vertexAttributes:g}=n,x=e.tile,{surface:h,ellipsoid:M,extent:S,extentInRadians:y,horizontalScale:v}=x,V="local"===h.view?.viewingMode,B=M.radius;let I=0,b=0,L=0;const C=(e,t,n)=>{const o=y[0===t?1:3],s=y[0===e?0:2],r=Math.cos(o),i=Math.sin(o),a=Math.sin(s),c=Math.cos(s),l=B+n;I=c*r*l,b=a*r*l,L=i*l},A=V?(()=>{const e=i,n=null!=e&&(S[3]>e[3]||S[2]>e[2]||S[1]<e[1]||S[0]<e[0]),o=q(h.isWebMercatorOnPlateCarree,B,v);return(s,r,i)=>{const a=0===s?S[0]:S[2],c=0===r?S[1]:S[3],l=n?t(a,e[0],e[2]):a,u=n?t(c,e[1],e[3]):c,d=i;I=l*v,b=o(u),L=d}})():C;let P=0,O=0,T=0,D=0,R=0,U=0,N=0,w=0,j=0;const F=V&&h.isWebMercatorOnPlateCarree,H=(e,t,n,o,s)=>{let r=0,i=0,a=0;if(V){const e=t*v,s=F?(Math.PI/2-2*Math.atan(Math.exp(-n/B)))*B:n*v;r=e-I,i=s-b,a=o-L}else{const s=E(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=B+o;r=M*p*S-I,i=h*p*S-b,a=x*S-L}switch(s){case 0:N+=r,w+=i,j+=a;break;case 1:D-=r,R-=i,U-=a;break;case 2:N-=r,w-=i,j-=a;break;case 3:D+=r,R+=i,U+=a}},_=i??re,W=S[0],k=S[2],z=S[1],G=S[3],J=[G>_[3],k>_[2],z<_[1],W<_[0]],K=Math.max(W,_[0]),Q=Math.min(k,_[2]),X=Math.max(z,_[1]),Y=Math.min(G,_[3]),Z=e=>Math.max(_[0],Math.min(_[2],e)),ee=e=>Math.max(_[1],Math.min(_[3],e)),te=e=>{const t=o.cornerNeighborCornerTiles;P=0,O=0,T=1,D=0,R=0,U=0,N=0,w=0,j=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];ie[o]=s?.level===n?s:null}let r=1,i=0;for(let o=0;o<4;++o){const e=ie[o];e&&(r=Math.max(r,e?.renderData.geometryState.numVerticesPerSide),i=e.extent[2]-e.extent[0])}const a=i,c=r;u(c>1);const l=a/c;for(let o=0;o<4;++o){const e=ie[(o+3)%4],t=ie[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=oe[o][0]*l,a=oe[o][1]*l,c=e.extent,u=Z(c[0===n||1===n?2:0]+i),d=ee(c[0===n||3===n?3:1]+a),f=t.extent,m=Z(f[0===r||1===r?2:0]+i),g=ee(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);H(p,u,d,.5*(h+M),o)}else{const i=e??t,a=e?n:r,c=i.extent,u=oe[o],d=Z(c[0===a||1===a?2:0]+u[0]*l),f=ee(c[0===a||3===a?3:1]+u[1]*l),m=i.renderData,g=s(d,f,m.geometryState.samplerData);H(m,d,f,g,o)}}if(!V){const e=Math.sqrt(I*I+b*b+L*L);P=I/e,O=b/e,T=L/e}if(V||T*T<.999){const e=Math.sqrt(D*D+R*R+U*U);D/=e,R/=e,U/=e;const t=Math.sqrt(N*N+w*w+j*j);N/=t,w/=t,j/=t,P=U*w-R*j,O=D*j-U*N,T=R*N-D*w;const n=1/Math.sqrt(P*P+O*O+T*T);P*=n,O*=n,T*=n}},ne=o.cornerNeighborCornerTiles;for(let E=0;E<4;++E){const e=E,i=(E+1)%4,h=0===E||1===E?1:0,M=0===E||3===E?1:0,S=t(h,c,d),y=t(M,l,f),v=n.getEdgeFirstVertexIndex(e),V=n.getEdgeCount(e),B=0===E||3===E?V-1:0,C=n.getEdgeFirstVertexIndex(i),D=n.getEdgeCount(i),R=0===E||1===E?D-1:0;let U=-1;for(let t=0;t<4;++t){const e=ne[4*E+t],n=ne[4*E+U];e&&(-1===U||p(n,e)>0)&&(U=t)}const N=U,w=ne[4*E+N];if(w!==x){const e=x.level-w.level,t=2**e,n=[w.lij[0]+e,w.lij[1]*t,w.lij[2]*t],s=[n[1]+t===x.lij[1],0===E&&(1===N||0===N&&w!==ne[4*E+3])||1===E&&(0===N||1===N&&w!==ne[4*E+2]),n[1]===x.lij[1]+1,2===E&&(3===N||2===N&&w!==ne[4*E+1])||3===E&&(2===N||3===N&&w!==ne[4*E+0])],i=s.reduce(((e,t)=>e+(t?1:0)),0);u(1===i||2===i);let a=-1,c=-1;const l=w.renderData;if(1===i){const e=s.findIndex((e=>e));u(0<=e&&e<=3),a=(e+2)%4;const t=o.edgeResolutions[e];c=x.getNeighborEdgeStartVertexIndex(e,w)*t+t*(0===e&&0===E||1===e&&0===E||2===e&&1===E||3===e&&3===E?1:0)}else{u(s[1]||s[3]),a=s[1]?3:1;const e=l.geometryState.edgeResolutions[a];c=0===E||3===E?0:e}const d=l.geometry;{const e=v+B,t=C+R,n=d.getEdgeFirstVertexIndex(a)+c,o=d.vertexAttributes,s=l.localOrigin,i=o.position,u=i.typedBuffer,f=n*i.typedBufferStride,p=u[f]+s[0]-r[0],x=u[f+1]+s[1]-r[1],h=u[f+2]+s[2]-r[2];ue(p,x,h,m);const M=g.position,V=M.typedBuffer,I=e*M.typedBufferStride;V[I]=p,V[I+1]=x,V[I+2]=h;const b=t*M.typedBufferStride;V[b]=p,V[b+1]=x,V[b+2]=h;const L=g.uv0;L.setValues(e,S,y),L.setValues(t,S,y);{const s=o.normalCompressed.typedBuffer,r=n*o.normalCompressed.typedBufferStride,i=g.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=J[e],c=J[i];let l;if(o||c){const e=t(W*(1-h)+k*h,K,Q),n=t(z*(1-M)+G*M,X,Y);l=s(e,n,a)}else l=$(ne,E);A(h,M,l),te(E);const u=I-r[0],d=b-r[1],f=L-r[2];ue(u,d,f,m),n.setEdgeVertexFromValuesRawPositionUVNormal(e,B,u,d,f,S,y,P,O,T),n.setEdgeVertexFromValuesRawPositionUVNormal(i,R,u,d,f,S,y,P,O,T)}}for(let t=0;t<4;++t)ie[t]=null}function $(e,t){const n=4*t,o=l.reduce(((t,o)=>Math.min(t,e[n+o]?.level??1/0)),1/0);d&&(u(!e[n+0]||!e[n+2]||g(e[n+0],e[n+2],i.SOUTH_WEST)),u(!e[n+1]||!e[n+3]||g(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 u(null!=c),c}function ee(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 te(e){const{vao:t,geometry:n}=e,{indices:o,indexCount:s,edgeIndicesStartIndex:r}=n;t.indexBuffer.setSubData(o,r,r,s)}class ne{constructor(e,t,n,o,s){this.isNorth=e,this.connectedRowOffset=t,this.connectedOuterEdgeOffset=n,this.rowOffset=o,this.latitudeResolution=s}}const oe=[[0,1],[1,0],[0,-1],[-1,0]],se=new a,re=o(-1/0,-1/0,1/0,1/0),ie=[null,null,null,null];function ae(e,t,n){if(!t)return!1;const o=p(e,t);return o>0||0===o&&n>=2}class ce{constructor(){this.vertex0Index=0,this.stride=1,this.count=0}getVertexIndex(e){return u(0<=e&&e<this.count),this.vertex0Index+this.stride*e}}const le=[new ce,new ce,new ce,new ce];function ue(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 de(e){const{edgeResolutions:t,numVerticesPerSide:n}=e,o=1+Math.max(...t);return Math.max(n,o)}function fe(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 me(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 ge=6;export{O as createPlanarGlobePatch,M as createSphericalGlobePatch,B as updateCornerSpherical,D as updateCornersPlanar,R as updateEdgeElevationsAndResolutionsPlanar,V as updateEdgeElevationsAndResolutionsSpherical,U as updateEdgesAndCornersPlanar,v as updateEdgesAndCornersSpherical};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{newLayout as e}from"../support/buffer/InterleavedLayout.js";import{VertexAttribute as r}from"../webgl-engine/lib/VertexAttribute.js";const t=e().vec3f(r.POSITION).
|
|
5
|
+
import{newLayout as e}from"../support/buffer/InterleavedLayout.js";import{VertexAttribute as r}from"../webgl-engine/lib/VertexAttribute.js";const t=e().vec3f(r.POSITION).vec2f16(r.UV0).vec2i16(r.NORMALCOMPRESSED,{glNormalized:!0});export{t as terrainAttributesLayout};
|