@arcgis/core 5.2.0-next.41 → 5.2.0-next.43
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/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/20fefb9278501781de14.js +1 -0
- package/assets/esri/core/workers/chunks/399e23d777a043efa9f1.js +1 -0
- package/assets/esri/core/workers/chunks/{2b8909a488cf3b231eec.js → 4063ea53cba3dd897e53.js} +6 -12
- package/assets/esri/core/workers/chunks/5133083222588799493f.js +1 -0
- package/assets/esri/core/workers/chunks/{7ea65aa6d3e684e12082.js → 57a1e2b716b74f0124f7.js} +1 -1
- package/assets/esri/core/workers/chunks/{2e79fb1b8445b2091cdb.js → 60e8524d324fd14444d7.js} +1 -1
- package/assets/esri/core/workers/chunks/{b45a013039bbd2614525.js → 7684f0c771d312e05bb4.js} +7 -7
- package/assets/esri/core/workers/chunks/{90ace5f9b4af1beea6bf.js → 7b6b8d0673976c6c26de.js} +1 -1
- package/assets/esri/core/workers/chunks/81d55594cee124040565.js +1 -0
- package/assets/esri/core/workers/chunks/{82f4aa0533db009b11d8.js → 89682d9d4f606f82056b.js} +2 -2
- package/assets/esri/core/workers/chunks/9114a575b78a7ea18d0f.js +1 -0
- package/assets/esri/core/workers/chunks/{4056659d5c7698265129.js → 9de18cea5780319302cb.js} +1 -1
- package/assets/esri/core/workers/chunks/{f1d3cf674b6bea89e122.js → c0637d1c9337a6ba46b0.js} +1 -1
- package/assets/esri/core/workers/chunks/c1845682cc9a5aac8703.js +261 -0
- package/assets/esri/core/workers/chunks/ce2320e7b9c4ca96ff27.js +1 -0
- package/assets/esri/core/workers/chunks/{dd65c32ae55fcf1282fe.js → d45e30f15142b5861111.js} +1 -1
- package/assets/esri/core/workers/chunks/{c50e4e8c6188e64e7d45.js → d7775ed1402946e414ef.js} +1 -1
- package/assets/esri/core/workers/chunks/e2f45990d8459d14cb90.js +1 -0
- package/assets/esri/core/workers/chunks/{aa0fb77c62a2d4eb20a5.js → e6b5c015205d38abe037.js} +1 -1
- package/assets/esri/core/workers/chunks/f4eda59ec1e816ecc827.js +1 -0
- package/assets/esri/core/workers/chunks/f8f0de841be17cd05c8f.js +1 -0
- package/assets/esri/themes/base/_core.scss +0 -6
- 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/Component.glsl.js +2 -2
- package/chunks/CutFillMinMaxDepth.glsl.js +2 -0
- package/chunks/CutFillTargetDepth.glsl.js +1 -2
- package/chunks/CutFillTotalDepth.glsl.js +2 -0
- package/chunks/EdgeShader.glsl.js +9 -9
- package/chunks/GaussianSplat.glsl.js +1 -1
- package/chunks/Path.glsl.js +4 -4
- package/chunks/Terrain.glsl.js +2 -2
- package/chunks/cameraUtilsSpherical.js +1 -1
- package/config.js +1 -1
- package/editing/geometry/coordUtils.js +1 -1
- package/geohash/geohashUtils.js +1 -1
- package/geometry/support/aaBoundingRect.js +1 -1
- package/geometry/support/quantizationUtils.js +1 -1
- package/intl/date.js +1 -1
- package/kernel.js +1 -1
- package/layers/IntegratedMesh3DTilesLayer.js +1 -1
- package/layers/graphics/featureConversionUtils.js +1 -1
- package/layers/graphics/sources/support/sourceUtils.js +1 -1
- package/layers/raster/formats/Lerc.js +1 -1
- package/layers/support/fieldUtils.js +1 -1
- package/package.json +2 -2
- package/support/revision.js +1 -1
- package/third-party-notices.txt +156 -0
- package/views/2d/engine/vectorTiles/GeometryUtils.js +1 -1
- package/views/2d/engine/webgl/Painter.js +1 -1
- package/views/2d/engine/webgl/RenderingDevice.js +1 -1
- package/views/2d/engine/webgl/effects/FeatureEffect.js +1 -1
- package/views/2d/engine/webgl/effects/HighlightEffect.js +1 -1
- package/views/2d/engine/webgl/effects/highlight/HighlightGradient.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/segmentUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/TextureStatisticsTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AAnimatedShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedLineShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimationUniformInfo.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/blend/BlendTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/bloom/BloomTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/blur/BlurTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/opacity/OpacityTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/RasterHighlightTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/BaseRasterProcessorTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/BitBlitShader.js +2 -0
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/DebugOverlayShader.js +2 -0
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/HighlightShader.js +2 -0
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/WorldExtentStencilShader.js +2 -0
- package/views/2d/engine/webgl/shaderGraph/techniques/utility/BitBlitTechnique.js +2 -0
- package/views/2d/engine/webgl/shaderGraph/techniques/utility/DebugOverlayTechnique.js +2 -0
- package/views/2d/engine/webgl/shaderGraph/techniques/utility/HighlightTechnique.js +2 -0
- package/views/2d/engine/webgl/shaderGraph/techniques/utility/WorldExtentClipTechnique.js +2 -0
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/layers/features/sources/FeatureSourceQueryInfo.js +1 -1
- package/views/2d/layers/features/sources/strategies/FeatureDrillDownTileLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/FeatureHybridTileLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/FeaturePagedTileLoadStrategy.js +1 -1
- package/views/2d/layers/support/DebugOverlay.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightAggregateManipulatedObject3D.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightConfiguration.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightDrawToolRenderer.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightManipulators.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightReshapeTool3D.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightTool2.js +1 -1
- package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
- package/views/3d/layers/i3s/I3SNode.js +1 -1
- package/views/3d/layers/i3s/SphereCone.js +1 -1
- package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
- package/views/3d/support/cameraUtilsSpherical.js +1 -1
- package/views/3d/terrain/GeometryState.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/PatchGeometryFactory.js +1 -1
- package/views/3d/terrain/PatchRenderData.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/terrain/Tile.js +1 -1
- package/views/3d/terrain/TileAgent.js +1 -1
- package/views/3d/webgl/RenderCamera.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/Laserline.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/output/OutputDepth.glsl.js +4 -10
- package/views/3d/webgl-engine/core/shaderLibrary/util/emissionFilter.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/WeatherFader.js +1 -1
- package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
- package/views/3d/webgl-engine/effects/glow/Glow.js +1 -1
- package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
- package/views/3d/webgl-engine/lib/CutFillComputation.js +1 -1
- package/views/3d/webgl-engine/lib/GaussianSplatShadows.js +1 -1
- package/views/3d/webgl-engine/lib/IntersectorInterfaces.js +1 -1
- package/views/3d/webgl-engine/lib/PolygonIntersections2D.js +2 -0
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
- package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
- package/views/3d/webgl-engine/{shaders/sources/edgeRenderer → lib/edgeRendering}/AdjustProjectedPosition.glsl.js +1 -1
- package/views/3d/webgl-engine/{shaders/sources/edgeRenderer → lib/edgeRendering}/DiscardNonSilhouetteEdges.glsl.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeShader.glsl.js +1 -1
- package/views/3d/webgl-engine/{shaders/sources/edgeRenderer → lib/edgeRendering}/EdgeUtil.glsl.js +1 -1
- package/views/3d/webgl-engine/{shaders/sources/edgeRenderer → lib/edgeRendering}/LineAmplitude.glsl.js +1 -1
- package/views/3d/webgl-engine/{shaders/sources/edgeRenderer → lib/edgeRendering}/LineOffset.glsl.js +1 -1
- package/views/3d/webgl-engine/{shaders/sources/edgeRenderer → lib/edgeRendering}/UnpackAttributes.glsl.js +1 -1
- package/views/3d/webgl-engine/lib/screenPolygonTriangleIntersections.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/LineCalloutMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/TriangleMaterial.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/3d/webgl-engine/shaders/CutFillMinMaxDepth.glsl.js +2 -0
- package/views/3d/webgl-engine/shaders/CutFillMinMaxDepthTechnique.js +2 -0
- package/views/3d/webgl-engine/shaders/CutFillTargetDepth.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/{CutFillDepth.glsl.js → CutFillTotalDepth.glsl.js} +1 -1
- package/views/3d/webgl-engine/shaders/CutFillTotalDepthTechnique.js +2 -0
- package/views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js +1 -1
- package/views/GroundView.js +1 -1
- package/views/input/BrowserEventSource.js +1 -1
- package/views/input/InputManager.js +1 -1
- package/views/interactive/snapping/snappingUtils.js +1 -1
- package/views/support/LayerViewManager.js +1 -1
- package/views/support/euclideanLengthMeasurementUtils.js +1 -1
- package/views/webgl/VertexAttributeLayouts.js +1 -1
- package/widgets/BatchAttributeForm/batchAttributeFormUtils.js +1 -1
- package/widgets/BatchAttributeForm/expressions/ExpressionsManager.js +1 -1
- package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
- package/widgets/BatchAttributeForm/inputs/support/multipleChoiceInputUtils.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
- package/widgets/FeatureTable/Grid/EditorColumn.js +1 -1
- package/widgets/FeatureTable/Grid/GridViewModel.js +1 -1
- package/widgets/Legend/support/relationshipRampUtils.js +1 -1
- package/widgets/OrientedImageryViewer/utils.js +1 -1
- package/widgets/support/dateUtils.js +1 -1
- package/assets/esri/core/workers/chunks/002356e675769d20e5c0.js +0 -1
- package/assets/esri/core/workers/chunks/06e71d52773eb656a4bf.js +0 -261
- package/assets/esri/core/workers/chunks/18d874739ee9ffad7480.js +0 -1
- package/assets/esri/core/workers/chunks/352d144d7651da8a29c9.js +0 -1
- package/assets/esri/core/workers/chunks/4f2a61dfae6ca8ed1ec8.js +0 -1
- package/assets/esri/core/workers/chunks/551d0c5432f7a08dea77.js +0 -1
- package/assets/esri/core/workers/chunks/5923ebadd4f75be2c9cc.js +0 -1
- package/assets/esri/core/workers/chunks/c3fae4f4522604a9c17e.js +0 -1
- package/assets/esri/core/workers/chunks/ea8f224da4c5c95a3547.js +0 -1
- package/assets/esri/core/workers/chunks/f30578843f4faefd53b4.js +0 -1
- package/assets/esri/themes/base/_colorVariables.scss +0 -1
- package/assets/esri/themes/base/widgets/_DatePicker.scss +0 -170
- package/assets/esri/themes/base/widgets/_FeatureUtilityNetworkAssociationList.scss +0 -13
- package/assets/esri/themes/base/widgets/_TimePicker.scss +0 -15
- package/chunks/CutFillDepth.glsl.js +0 -2
- package/core/PLRUCache.js +0 -2
- package/views/2d/engine/webgl/BitBlitRenderer.js +0 -2
- package/views/2d/engine/webgl/WorldExtentClipRenderer.js +0 -2
- package/views/2d/engine/webgl/effects/highlight/HighlightRenderer.js +0 -2
- package/views/2d/engine/webgl/shaders/BitBlitPrograms.js +0 -2
- package/views/2d/engine/webgl/shaders/HighlightPrograms.js +0 -2
- package/views/2d/engine/webgl/shaders/StencilPrograms.js +0 -2
- package/views/3d/webgl-engine/shaders/CutFillDepthTechnique.js +0 -2
- package/views/3d/webgl-engine/shaders/CutFillDepthTechniqueConfiguration.js +0 -2
- package/views/support/euclideanAreaMeasurementUtils.js +0 -2
- package/widgets/ShadowCast/ShadowVisualizationType.js +0 -2
- /package/assets/esri/core/workers/chunks/{82f4aa0533db009b11d8.js.LICENSE.txt → 89682d9d4f606f82056b.js.LICENSE.txt} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import"../../../../core/has.js";import{destroyMaybe as i}from"../../../../core/maybe.js";import{watch as s,initial as r,syncAndInitial as o}from"../../../../core/reactiveUtils.js";import{property as n,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{create as a,fromValues as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as u,fromPoints as h}from"../../../../geometry/support/lineSegment.js";import{absoluteHeightElevationInfo as d,getConvertedElevation as p}from"../../../../support/elevationInfoUtils.js";import{LineOfSightInteractionVisuals as v}from"./LineOfSightInteractionVisuals.js";import{Settings as m}from"../../interactive/editingTools/settings.js";import{VerticesVisualElement as f}from"../../interactive/visualElements/VerticesVisualElement.js";let V=class extends t{constructor(e){super(e),this.elevationInfo=null,this.analysisVisible=!0,this._active=!1,this._rendererVisuals=new Map,this._observerRenderLocation=a(),this._targetRenderLocation=a(),this._laserLineSegment=u(),this._interactionVisuals=null,this._settings=new m({getTheme:()=>this.view.effectiveTheme})}initialize(){this._interactionVisuals=new v({view:this.view});const e=this._settings;this.addHandles([this._connectInteractionVisuals(),s(()=>({selectedColor:e.colors.selected.toUnitRGBA(),outlineColor:e.manipulators.vertex.outlineColor.toUnitRGBA()}),({selectedColor:e,outlineColor:t})=>{for(const{element:i}of this._rendererVisuals.values())i.color=e,i.outlineColor=t},r)])}destroy(){for(const e of this._rendererVisuals.keys())this.removeVisual(e);this._interactionVisuals=i(this._interactionVisuals)}activate(){this._active=!0,this._refreshVisuals(),this._refreshInteractionVisuals()}refresh(){this._refreshVisuals(),this._refreshInteractionVisuals()}deactivate(){this._active=!1;for(const{element:e}of this._rendererVisuals.values())e.attached=!1;this._interactionVisuals?.hide()}addOrUpdateGraphic(e,t){}addOrUpdateVisual(e,t){const i=this._rendererVisuals.get(e),s=C(t,i?.props);if(!_(s))return void this.removeVisual(e);if(i)return i.props=s,void this._applyVisual(i.element,s);const r=this._settings,o=r.manipulators.vertex,n=new f({view:this.view,isDecoration:!0,spatialReference:this.view.renderCoordsHelper.spatialReference,elevationInfo:d,size:o.size,outlineSize:o.outlineSize,renderOccluded:o.renderOccluded,color:r.colors.selected.toUnitRGBA(),outlineColor:o.outlineColor.toUnitRGBA()});this._rendererVisuals.set(e,{element:n,props:s}),this._applyVisual(n,s)}removeGraphic(e){}removeVisual(e){const t=this._rendererVisuals.get(e);t&&(t.element.destroy(),this._rendererVisuals.delete(e))}hitTestVisualDistance(e,t){return null}_connectInteractionVisuals(){return s(()=>({active:this._active,analysisVisible:this.analysisVisible,cursorTargetPosition:this.analysisViewData.cursorTarget?.position,observerPosition:this.analysis.observer?.position}),({active:e,analysisVisible:t,cursorTargetPosition:i,observerPosition:s})=>{const{_observerRenderLocation:r,_targetRenderLocation:o,_laserLineSegment:n}=this;e&&t&&null!=s&&null!=i&&this.view.renderCoordsHelper.toRenderCoords(s,r)&&this.view.renderCoordsHelper.toRenderCoords(i,o)?this._interactionVisuals?.update({target:o,lineVerticalPlaneSegment:h(r,o,n),visible:!0}):this._interactionVisuals?.hide()},o)}_refreshVisuals(){for(const{element:e,props:t}of this._rendererVisuals.values())this._applyVisual(e,t)}_refreshInteractionVisuals(){const{_observerRenderLocation:e,_targetRenderLocation:t,_laserLineSegment:i}=this,s=this.analysis.observer?.position,r=this.analysisViewData.cursorTarget?.position;this._active&&this.analysisVisible&&null!=s&&null!=r&&this.view.renderCoordsHelper.toRenderCoords(s,e)&&this.view.renderCoordsHelper.toRenderCoords(r,t)?this._interactionVisuals?.update({target:t,lineVerticalPlaneSegment:h(e,t,i),visible:!0}):this._interactionVisuals?.hide()}_applyVisual(e,t){const i=y(t.geometry);if(!i)return e.vertices=[],void(e.attached=!1);const s=w(this.view,i,this.elevationInfo);if(!s)return e.vertices=[],void(e.attached=!1);this._applyVisualStyle(e),e.vertices=[s],e.attached=this._active&&this.analysisVisible}_applyVisualStyle(e){const t=this._settings,i=t.manipulators.vertex;e.color=t.colors.selected.toUnitRGBA(),e.outlineColor=i.outlineColor.toUnitRGBA()}get test(){}};function _(e){return null!=y(e.geometry)&&("cursor"===e.role||"controlPoint"===e.role)}function y(e){if(!e)return null;switch(e.type){case"point":return e;case"multipoint":return g(e);default:return null}}function g(e){return 0===e.points.length?null:e.getPoint(e.points.length-1)}function w(e,t,i){const s=p(e,t,i??d,d),r=c(t.x,t.y,s??0);return e.renderCoordsHelper.toRenderCoords(r,t.spatialReference,r)?r:null}function C(e,t={geometry:null,role:"outputGeometry",state:"idle"}){return{...t,...e}}e([n({constructOnly:!0})],V.prototype,"analysis",void 0),e([n({constructOnly:!0})],V.prototype,"analysisViewData",void 0),e([n({constructOnly:!0})],V.prototype,"view",void 0),e([n()],V.prototype,"elevationInfo",void 0),e([n()],V.prototype,"analysisVisible",void 0),e([n()],V.prototype,"_active",void 0),V=e([l("esri.views.3d.analysis.LineOfSight.LineOfSightDrawToolRenderer")],V);export{V as LineOfSightDrawToolRenderer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{watch as e}from"../../../../core/reactiveUtils.js";import{getObserverRGBA as t,observerConfiguration as o,targetConfiguration as i}from"./LineOfSightConfiguration.js";import{Manipulator3D as
|
|
2
|
+
import{watch as e}from"../../../../core/reactiveUtils.js";import{getObserverRGBA as t,observerConfiguration as o,targetConfiguration as i,getInteractiveTargetRGBA as r}from"./LineOfSightConfiguration.js";import{Manipulator3D as s}from"../../interactive/Manipulator3D.js";import{createManipulatorMaterial as n}from"../../interactive/manipulatorUtils.js";import{RenderObject as m}from"../../interactive/RenderObject.js";import{disableDisplayOnGrab as a}from"../../interactive/editingTools/manipulatorUtils.js";import{createSphereGeometry as c}from"../../webgl-engine/lib/GeometryUtil.js";const l=128,f=256,d=512,u=1024,h=2048;class v extends s{constructor(i,r){const s=n(t(i.effectiveTheme)),l=c(s,o.size,32,32),f=new m(l);super({view:i,renderObjects:[f],metadata:r,elevationInfo:{mode:"absolute-height",offset:0}}),a(this),this.themeHandle=e(()=>({color:t(i.effectiveTheme)}),e=>{s.setParameters(e)})}destroy(){this.themeHandle.remove(),super.destroy()}}class p extends s{constructor(t,o){const{size:s,visibleColor:v,occludedColor:p,undefinedColor:j}=i,b=n(r(t.effectiveTheme)),w=[new m(c(b,s,32,32),u),g(s,v,h|l),g(s,p,h|f),g(s,j,h|d)];super({view:t,renderObjects:w,metadata:o,elevationInfo:{mode:"absolute-height",offset:0}}),a(this),this.themeHandle=e(()=>({color:r(t.effectiveTheme)}),e=>{b.setParameters(e)})}destroy(){this.themeHandle.remove(),super.destroy()}}const j={visible:h|l,occluded:h|f,undefined:h|d};function b(e){return e&~h|u}function g(e,t,o){return new m(c(n(t.toUnitRGBA()),e,32,32),o)}export{v as LineOfSightObserverManipulator,p as LineOfSightTargetManipulator,j as LineOfSightTargetManipulatorState,b as getInteractiveLineOfSightTargetManipulatorState};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../../../core/Evented.js";import{
|
|
2
|
+
import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../../../core/Evented.js";import{handlesGroup as i}from"../../../../core/handleUtils.js";import{destroyMaybe as n}from"../../../../core/maybe.js";import a from"../../../../core/ReactiveSet.js";import{watch as s,initial as o,when as r}from"../../../../core/reactiveUtils.js";import{property as l,subclass as c}from"../../../../core/accessorSupport/decorators.js";import{create as h,fromPoints as p}from"../../../../geometry/support/lineSegment.js";import{LineOfSightAggregateManipulatedObject3D as u}from"./LineOfSightAggregateManipulatedObject3D.js";import{LineOfSightInteractionVisuals as d}from"./LineOfSightInteractionVisuals.js";import{ReshapeTool3D as g}from"../../interactive/editingTools/reshape/ReshapeTool3D.js";import _ from"../../../interactive/sketch/SketchOptions.js";import{acquire as v}from"../../../interactive/snapping/SnappingManagerPool.js";const b=Symbol("line-of-sight-reshape-line-of-sight-manipulators"),M=Symbol("line-of-sight-reshape-tool-operations"),f=h();let m=class extends t{constructor(e){super(e),this.visible=!0,this.isParentToolInteracting=!1,this._selectedManipulators=new a,this._grabbedManipulator=null,this._interactionVisuals=null,this._snappingManagerResult=v(e.view),this._object=new u({analysis:e.analysis,analysisViewData:e.analysisViewData,intersector:e.intersector,view:e.view}),this._reshapeTool=new g({autoHideManipulators:!1,enableDeleteVertices:!0,enableEdgeOffset:!1,enableMidpoints:!1,enableMoveObject:!1,object:this._object,snapToScene:!0,sketchOptions:new _({tooltips:{enabled:!0}}),snappingManager:this._snappingManagerResult.snappingManager,view:e.view})}initialize(){this.view.tools.add(this._reshapeTool),this._interactionVisuals=new d({view:this.view}),this.addHandles([this._snappingManagerResult,this._connectReshapeEvents(),this._connectActiveState(),this._connectManipulators(),this._connectGrabbedManipulator(),this._connectObjectInteracting(),this._connectOperations()])}destroy(){this.stop(),this.removeHandles(b),this.view.tools.remove(this._reshapeTool),this._reshapeTool.destroy(),this._object.destroy(),this._interactionVisuals=n(this._interactionVisuals),this._selectedManipulators.clear()}get active(){return this._reshapeTool.active}get canRedo(){return this._reshapeTool.canRedo}get canUndo(){return this._reshapeTool.canUndo}get updating(){return this._reshapeTool.updating}get snappingManager(){return this.active?this._reshapeTool.snappingManager:null}get laserLineVisualElement(){return this._interactionVisuals?.laserLineVisualElement??null}activate(){this._reshapeTool.visible=this.visible,this.view.activeTool!==this._reshapeTool&&(this.view.activeTool=this._reshapeTool),this._reshapeTool.activate()}getTargetManipulator(e){return this._object.getTargetManipulator(e)}getObserverManipulator(){return this._object.observerManipulator}hasManipulatorAt(e,t){for(const i of this._object.lineOfSightManipulators)if(y(i,e,t))return!0;return!1}redo(){this._reshapeTool.redo()}clearSelection(){this._reshapeTool.clearSelection(),this._selectedManipulators.clear(),this._grabbedManipulator=null}get hasSelection(){return this._selectedManipulators.size>0}get _objectInteracting(){return this.analysisViewData.visible&&(this.isParentToolInteracting||this.hasSelection)}applySelection(e){const t="observer"===e.type?this._object.observerManipulator:this._object.getTargetManipulator(e.target);return null!=t&&this._reshapeTool.selectManipulator(t)}setEditableFlag(e,t){this._reshapeTool.setEditableFlag(e,t)}stop(){this.view.activeTool===this._reshapeTool&&(this.view.activeTool=null),this.snappingManager?.doneSnapping(),this.clearSelection()}undo(){this._reshapeTool.undo()}_connectReshapeEvents(){return i([this._reshapeTool.events.on("reshape",e=>{if(1===this._selectedManipulators.size){if("reshape-start"===e.type){const e=this._selectedManipulators.values().next().value;this._grabbedManipulator??=e}"reshape-stop"===e.type&&(this._grabbedManipulator=null)}}),this._reshapeTool.on("cancel",()=>this.clearSelection()),this._reshapeTool.events.on("before-vertex-remove",e=>{let t=this.analysis.targets.length;for(const i of e.vertices){if(0===i.componentIndex)return void e.preventDefault();if(t-=1,0===t)return void e.preventDefault()}})])}_connectActiveState(){return s(()=>this.active,e=>{e||this._reshapeTool.snappingManager?.doneSnapping()},o)}_connectManipulators(){return s(()=>this._object.lineOfSightManipulators,e=>{this.removeHandles(b),this._selectedManipulators.batch(()=>{this._selectedManipulators.clear();for(const t of e)t.selected&&this._selectedManipulators.add(t)}),this.addHandles(e.map(e=>this._connectManipulator(e)),b)},o)}_connectManipulator(e){return i([e.events.on("grab-changed",t=>{if("start"===t.action){this._selectedManipulators.add(e),this._grabbedManipulator??=e;const t=this.active,i=this.analysisViewData.visible,n=this._object.observerManipulator,a=this.visible,s=this._grabbedManipulator;if(s!==e)return;if(null==this._interactionVisuals||!t||!a||!i||null==n)return void this._hideLaserLine();this._interactionVisuals.update({target:s.renderLocation,lineVerticalPlaneSegment:s===n?null:p(n.renderLocation,s.renderLocation,f),visible:!0})}"end"===t.action&&(this._grabbedManipulator=null)}),e.events.on("select-changed",({action:t})=>{"select"===t?this._selectedManipulators.add(e):this._selectedManipulators.delete(e)}),e.events.on("location-update",()=>{const t=this.active,i=this.analysisViewData.visible,n=this._object.observerManipulator,a=this.visible,s=this._grabbedManipulator;s===e&&(null!=this._interactionVisuals&&t&&a&&i&&null!=n?this._interactionVisuals.update({target:s.renderLocation,lineVerticalPlaneSegment:s===n?null:p(n.renderLocation,s.renderLocation,f),visible:!0}):this._hideLaserLine())})])}_connectGrabbedManipulator(){return r(()=>null==this._grabbedManipulator,()=>{this._hideLaserLine()})}_connectObjectInteracting(){return s(()=>this._objectInteracting,e=>{this._object.interacting=e},o)}_connectOperations(){return s(()=>this._object.operations,e=>{this.removeHandles(M),null!=e&&this.addHandles([e.on("can-redo-change",()=>this.notifyChange("canRedo")),e.on("can-undo-change",()=>this.notifyChange("canUndo"))],M),this.notifyChange("canUndo"),this.notifyChange("canRedo")},o)}_hideLaserLine(){this._interactionVisuals?.hide()}};function y(e,t,i){return!0===e?.interactive&&e.consumesClicks&&null!=e.intersectionDistance(t,i)}e([l({constructOnly:!0})],m.prototype,"analysisViewData",void 0),e([l({constructOnly:!0})],m.prototype,"analysis",void 0),e([l({constructOnly:!0})],m.prototype,"intersector",void 0),e([l({constructOnly:!0})],m.prototype,"view",void 0),e([l()],m.prototype,"visible",void 0),e([l()],m.prototype,"isParentToolInteracting",void 0),e([l()],m.prototype,"_grabbedManipulator",void 0),e([l()],m.prototype,"active",null),e([l()],m.prototype,"canRedo",null),e([l()],m.prototype,"canUndo",null),e([l()],m.prototype,"updating",null),e([l()],m.prototype,"hasSelection",null),e([l()],m.prototype,"_objectInteracting",null),m=e([c("esri.views.3d.analysis.LineOfSight.LineOfSightReshapeTool3D")],m);export{m as LineOfSightReshapeTool3D};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import{makeHandle as e}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{watch as i,syncAndInitial as s}from"../../../../core/reactiveUtils.js";import{property as o,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{LineOfSightPlacementController as n}from"./LineOfSightPlacementController.js";import{LineOfSightRayIntersector as r}from"./LineOfSightRayIntersector.js";import{LineOfSightReshapeTool3D as l}from"./LineOfSightReshapeTool3D.js";import{ExclusiveOperationManager as h}from"../../../analysis/ExclusiveOperationManager.js";import{ViewEventPriorities as c}from"../../../input/InputManager.js";import{AnalysisToolBase as p}from"../../../interactive/AnalysisToolBase.js";import{deactivevateTool as v}from"../../../interactive/interactiveToolUtils.js";import{sketchKeys as d}from"../../../interactive/keybindings.js";const y={ready:"ready",creating:"creating",created:"created"};let _=class extends p{constructor(t){super(t),this._operationManager=new h,this._syncingActiveTool=!1,this.analysisViewData=null,this.removeIncompleteOnCancel=!1,this._reshapeIntersector=new r({view:t.view}),this._reshapeTool=new l({analysis:t.analysis,analysisViewData:t.analysisViewData,intersector:this._reshapeIntersector,view:t.view}),this._placementController=new n({...t,parent:this,shouldPreventVertexAdd:(t,e)=>this._reshapeTool.hasManipulatorAt(t,e)})}get active(){return this._reshapeTool.active||this._placementController.active}get canRedo(){return this._activeUndoRedoComponent?.canRedo??!1}get canUndo(){return this._activeUndoRedoComponent?.canUndo??!1}get state(){return this._placementController.active?y.creating:null!=this.analysis.observer?.position?y.created:y.ready}get cursor(){return this._placementController.active?"crosshair":null}get updating(){return this._reshapeTool.updating||this._placementController.updating}initialize(){this.addHandles([this.view.on("key-down",t=>this._onKeyDown(t),c.WIDGET),i(()=>({editable:this.editable,interactive:this.analysisViewData.interactive,placementActive:this._placementController.active,valid:this.analysis.valid,visible:this.visible}),()=>this._syncActiveTool(),s),i(()=>this.state===y.created,t=>{t?this.finishToolCreation():this._set("created",!1)},s),i(()=>this.analysisViewData.visible,t=>{this.visible=t},s),i(()=>{const{analysis:t}=this,{observer:e,targets:i}=t;return{observer:e,observerPosition:e?.position,observerElevationInfo:e?.elevationInfo,observerFeature:e?.feature,targets:i.toArray().map(t=>[t,t.position,t.elevationInfo,t.feature])}},()=>this._syncItemsFromAnalysis(),s),i(()=>this.editable,t=>{this.analysisViewData.editable=t},s)])}destroy(){this._operationManager.destroy(),this._reshapeTool.stop(),this._placementController.stop(),this._reshapeTool.destroy(),this._placementController.destroy(),this._reshapeIntersector.destroy()}place(t){return this.analysisViewData.interactive=!0,this._operationManager.start("place",async(t,o)=>{const a=this.analysis.clone();let n=!1,r=!1;const l=()=>{r||(r=!0,this.stop(),o.aborted||!this.analysis.valid||this.analysis.equals(a)?t.reject():t.resolve({}))};t.handles.push(e(()=>this.stop()),i(()=>this._placementController.active,t=>{t?n=!0:n&&l()},s)),this.continue()},t)}activate(){this.view.focus(),this.analysisViewData.interactive=!0,this._syncActiveTool(),this.analysis.valid||this._placementController.active||this.continue()}deactivate(){this.onDeactivate()}continue(){this.analysisViewData.interactive=!0,this._placementController.continue()}stop(){this._placementController.stop(),this._placementController.placementElevationInfo=null,this._syncActiveTool()}redo(){this._activeUndoRedoComponent?.redo()}undo(){this._activeUndoRedoComponent?.undo()}get testInfo(){}onEditableChange(){this.analysisViewData.editable=this.editable,this._reshapeTool.setEditableFlag(1,!0),this._reshapeTool.setEditableFlag(0,this.editable),this._syncActiveTool()}_hideReshapeTool(){this._reshapeTool.
|
|
2
|
+
import{__decorate as t}from"tslib";import{makeHandle as e}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{watch as i,syncAndInitial as s}from"../../../../core/reactiveUtils.js";import{property as o,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{LineOfSightPlacementController as n}from"./LineOfSightPlacementController.js";import{LineOfSightRayIntersector as r}from"./LineOfSightRayIntersector.js";import{LineOfSightReshapeTool3D as l}from"./LineOfSightReshapeTool3D.js";import{ExclusiveOperationManager as h}from"../../../analysis/ExclusiveOperationManager.js";import{ViewEventPriorities as c}from"../../../input/InputManager.js";import{AnalysisToolBase as p}from"../../../interactive/AnalysisToolBase.js";import{deactivevateTool as v}from"../../../interactive/interactiveToolUtils.js";import{sketchKeys as d}from"../../../interactive/keybindings.js";const y={ready:"ready",creating:"creating",created:"created"};let _=class extends p{constructor(t){super(t),this._operationManager=new h,this._syncingActiveTool=!1,this.analysisViewData=null,this.removeIncompleteOnCancel=!1,this._reshapeIntersector=new r({view:t.view}),this._reshapeTool=new l({analysis:t.analysis,analysisViewData:t.analysisViewData,intersector:this._reshapeIntersector,view:t.view}),this._placementController=new n({...t,parent:this,shouldPreventVertexAdd:(t,e)=>this._reshapeTool.hasManipulatorAt(t,e)})}get active(){return this._reshapeTool.active||this._placementController.active}get canRedo(){return this._activeUndoRedoComponent?.canRedo??!1}get canUndo(){return this._activeUndoRedoComponent?.canUndo??!1}get state(){return this._placementController.active?y.creating:null!=this.analysis.observer?.position?y.created:y.ready}get cursor(){return this._placementController.active?"crosshair":null}get updating(){return this._reshapeTool.updating||this._placementController.updating}initialize(){this.addHandles([this.view.on("key-down",t=>this._onKeyDown(t),c.WIDGET),i(()=>({editable:this.editable,interactive:this.analysisViewData.interactive,placementActive:this._placementController.active,valid:this.analysis.valid,visible:this.visible}),()=>this._syncActiveTool(),s),i(()=>this.state===y.created,t=>{t?this.finishToolCreation():this._set("created",!1)},s),i(()=>this.analysisViewData.visible,t=>{this.visible=t},s),i(()=>{const{analysis:t}=this,{observer:e,targets:i}=t;return{observer:e,observerPosition:e?.position,observerElevationInfo:e?.elevationInfo,observerFeature:e?.feature,targets:i.toArray().map(t=>[t,t.position,t.elevationInfo,t.feature])}},()=>this._syncItemsFromAnalysis(),s),i(()=>this.editable,t=>{this.analysisViewData.editable=t},s)])}destroy(){this._operationManager.destroy(),this._reshapeTool.stop(),this._placementController.stop(),this._reshapeTool.destroy(),this._placementController.destroy(),this._reshapeIntersector.destroy()}place(t){return this.analysisViewData.interactive=!0,this._operationManager.start("place",async(t,o)=>{const a=this.analysis.clone();let n=!1,r=!1;const l=()=>{r||(r=!0,this.stop(),o.aborted||!this.analysis.valid||this.analysis.equals(a)?t.reject():t.resolve({}))};t.handles.push(e(()=>this.stop()),i(()=>this._placementController.active,t=>{t?n=!0:n&&l()},s)),this.continue()},t)}activate(){this.view.focus(),this.analysisViewData.interactive=!0,this._syncActiveTool(),this.analysis.valid||this._placementController.active||this.continue()}deactivate(){this.onDeactivate()}continue(){this.analysisViewData.interactive=!0,this._placementController.continue()}stop(){this._placementController.stop(),this._placementController.placementElevationInfo=null,this._syncActiveTool()}redo(){this._activeUndoRedoComponent?.redo()}undo(){this._activeUndoRedoComponent?.undo()}get testInfo(){}onEditableChange(){this.analysisViewData.editable=this.editable,this._reshapeTool.setEditableFlag(1,!0),this._reshapeTool.setEditableFlag(0,this.editable),this._syncActiveTool()}_hideReshapeTool(){this._reshapeTool.stop(),this._reshapeTool.visible=!1}_onKeyDown(t){const e=t.key;e===d.undo&&this.canUndo?(t.stopPropagation(),this.undo()):e===d.redo&&this.canRedo?(t.stopPropagation(),this.redo()):e===d.cancel&&!this.active&&this._reshapeTool.hasSelection&&this._reshapeTool.clearSelection()}get _activeUndoRedoComponent(){return this.analysisViewData.interactive?this._placementController.active||!this._canActivateReshapeTool?this._placementController.active?this._placementController:null:this._reshapeTool:null}get _canActivateReshapeTool(){return this.visible&&this.editable&&this.analysis.valid&&null!=this.analysis.observer?.position}_syncActiveTool(){if(!this._syncingActiveTool){this._syncingActiveTool=!0;try{const t=this.analysisViewData.interactive,e=this._canActivateReshapeTool;if(this._placementController.visible=this.visible&&t,this._reshapeTool.isParentToolInteracting=t&&this._placementController.active,!t)return this._placementController.stop(),this._hideReshapeTool(),this.analysisViewData.cursorTarget=null,void v(this.view,this);if(this._placementController.active||!e)return this._hideReshapeTool(),void v(this.view,this);if(this._reshapeTool.visible=!0,this.analysisViewData.cursorTarget=null,!this._reshapeTool.active&&!this._reshapeTool.hasSelection){const t=this.analysis.targets.at(-1);null!=t&&this._reshapeTool.applySelection({type:"target",target:t})}v(this.view,this)}finally{this._syncingActiveTool=!1}}}_syncItemsFromAnalysis(){this._syncActiveTool()}};t([o({constructOnly:!0})],_.prototype,"view",void 0),t([o({constructOnly:!0})],_.prototype,"analysis",void 0),t([o({constructOnly:!0})],_.prototype,"analysisViewData",void 0),t([o()],_.prototype,"active",null),t([o()],_.prototype,"canRedo",null),t([o()],_.prototype,"canUndo",null),t([o()],_.prototype,"state",null),t([o()],_.prototype,"cursor",null),t([o()],_.prototype,"updating",null),t([o()],_.prototype,"removeIncompleteOnCancel",void 0),t([o()],_.prototype,"_canActivateReshapeTool",null),_=t([a("esri.views.3d.analysis.LineOfSight.LineOfSightTool2")],_);export{_ as LineOfSightTool2};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import i from"../../../../analysis/SlicePlane.js";import
|
|
2
|
+
import i from"../../../../analysis/SlicePlane.js";import e from"../../../../core/Logger.js";import{rad2deg as t,deg2rad as o}from"../../../../core/mathUtils.js";import{castRenderScreenPointArray3 as n}from"../../../../core/screenUtils.js";import{fromZRotation as r,scale as s,multiply as a,rotateZ as c,rotateX as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{length as d,set as g,add as u,scale as p,copy as m,subtract as f,dot as b,normalize as h,cross as j,squaredLength as w,negate as v}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{clone as P,create as U}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import R from"../../../../geometry/Point.js";import{tryProject as y}from"../../../../geometry/projectionUtils.js";import{c as M,r as S,n as T,u as A,f as C,i as k}from"../../../../chunks/boundedPlane.js";import{fromPositionAndNormal as L,fromVectorsAndPoint as x}from"../../../../geometry/support/plane.js";import{create as H}from"../../../../geometry/support/ray.js";import{angleAroundAxis as I}from"../../../../geometry/support/vector.js";import{sv3d as E,sm4d as F}from"../../../../geometry/support/vectorStacks.js";import{planeColor as W,getGridColor as z,getOutlineColor as B}from"./settings.js";import{resizeHandleEdgePaddingFrac as D,planeOutlineWidth as O,planeMinBasisScreenLen2 as V,initialPlaneHalfSizeViewProportion as $,shiftRestartOffsetDistance as q,smallAngleDotThreshold as G,verticalDotThreshold as J}from"./sliceToolConfig.js";import{applyProjectionAndElevationAlignment as K}from"../support/projectionUtils.js";import{calculateTranslateRotateFromBases as N}from"../../interactive/manipulatorUtils.js";import{LineVisualElement as Q}from"../../interactive/visualElements/LineVisualElement.js";import{SlicePlaneVisualElement as X}from"../../interactive/visualElements/SlicePlaneVisualElement.js";import{RenderCoordsHelper as Y}from"../../support/RenderCoordsHelper.js";import{fromRender as Z}from"../../support/geometryUtils/ray.js";function _(i,e,t,o,n,r,s,a){return ei(e,s.worldUpAtPosition(i,E.get()),n,r,a.basis1,a.basis2),p(a.basis1,a.basis1,t),p(a.basis2,a.basis2,o),m(a.origin,i),x(a.basis2,a.basis1,a.origin,a.plane),a}const ii=U();function ei(i,e,t,o,n,r){const s=b(i,e),a=E.get(),c=E.get();switch(0===o?Math.abs(s)>J?1:2:o){case 2:{const o=Math.abs(s)<=G?i:v(ii,t.viewUp);j(a,e,o),m(c,e);break}case 1:j(a,t.viewUp,e),j(c,e,a);break;case 3:{const o=Math.abs(s)<=G?e:t.viewUp;j(a,o,i),j(c,i,a);break}}const l=j(E.get(),a,c);b(l,t.viewForward)>0&&p(c,c,-1),h(n,a),h(r,c)}function ti(i,e,t){const o=e.worldUpAtPosition(i.origin,E.get()),n=i.basis1,r=Pi(i,o),s=Math.round(r/Ci)*Ci;return S(i,s-r,n,t)}function oi(i,e,t,o,n,r){const s=m(E.get(),n.origin);u(s,s,p(E.get(),n.basis1,i.direction[0]<0?1:-1)),u(s,s,p(E.get(),n.basis2,i.direction[1]<0?1:-1));const a=d(n.basis1),c=d(n.basis2),l=f(E.get(),t,s),g=f(E.get(),e,s);let h=0,j=0;if(hi(i)){const e=bi(n),t=bi(r);h=a-.5*i.direction[0]*b(n.basis1,g)/a,j=c-.5*i.direction[1]*b(n.basis2,g)/c;const o=t/e;h*=o,j*=o}const w=h+.5*i.direction[0]*b(n.basis1,l)/a,v=j+.5*i.direction[1]*b(n.basis2,l)/c,P=p(E.get(),n.basis1,w/a),U=p(E.get(),n.basis2,v/c);(w<=0||mi(r.origin,P,o)<=V)&&m(P,r.basis1),(v<=0||mi(r.origin,U,o)<=V)&&m(U,r.basis2);const R=m(E.get(),s);return u(R,R,p(E.get(),P,i.direction[0]<0?-1:1)),u(R,R,p(E.get(),U,i.direction[1]<0?-1:1)),C(R,P,U,r)}function ni(i,e){return $*Math.min(e.width,e.height)*e.computeRenderPixelSizeAt(i)}function ri(i,e,t,o){const n=j(E.get(),e,t);return j(n,n,e),L(i,n,o)}function si(i,e){return N(i.basis1,i.basis2,i.origin,e)}function ai(i,e,t,o){const n=e.worldUpAtPosition(i.origin,E.get()),r=E.get();switch(t){case 1:m(r,n);break;case 2:m(r,i.basis1)}return L(i.origin,r,o)}function ci(i,e,t,o){const r=pi(t,2),s=F.get();c(s,e,r.edge*Math.PI/2);const a=h(E.get(),r.basis);let l=p(E.get(),a,r.direction*o.computeScreenPixelSizeAt(r.position)*q);u(l,l,r.position);const d=o.projectToRenderScreen(l,n(E.get())),g=li(o,d);Z(o,d,Ai),h(Ai.direction,Ai.direction);const m=E.get();!g&&k(t,Ai,m)&&(l=m),s[12]=0,s[13]=0,s[14]=0,i.modelTransform=s,i.renderLocation=P(l),g?i.state|=Ti:i.state&=~Ti}function li(i,e){if(null==e)return!1;const[t,o,n,r]=i.viewport,s=Math.min(n,r)/16;let a=!0;return e[0]<t+s?(e[0]=t+s,a=!1):e[0]>t+n-s&&(e[0]=t+n-s,a=!1),e[1]<o+s?(e[1]=o+s,a=!1):e[1]>o+r-s&&(e[1]=o+r-s,a=!1),a}function di(i,e,t,o){const n=d(o.basis1),c=d(o.basis2),l=fi(o),m=bi(o),f=g(E.get(),0,0,0);u(f,p(E.get(),o.basis1,e.direction[0]),p(E.get(),o.basis2,e.direction[1])),u(f,o.origin,f);let b=0,h=1;if(hi(e))1===e.direction[0]&&-1===e.direction[1]?b=Ci:1===e.direction[0]&&1===e.direction[1]?b=Math.PI:-1===e.direction[0]&&1===e.direction[1]&&(b=3*Math.PI/2),h=m;else{const i=0!==e.direction[0]?1:2;b=1===i?Ci:0,h=(1===i?c:n)-l}const j=r(F.get(),b);s(j,j,g(E.get(),h,h,h)),a(j,t,j),j[12]=0,j[13]=0,j[14]=0,i.modelTransform=j,i.renderLocation=f}function gi(i,e,t,o){const n=o.worldUpAtPosition(t.origin,E.get()),s=pi(t,0),c=r(F.get(),s.edge*Math.PI/2);l(c,c,-Pi(t,n)),a(c,e,c),c[12]=0,c[13]=0,c[14]=0,i.modelTransform=c,i.renderLocation=s.position}function ui(i,e,t){const o=pi(t,1),n=r(F.get(),o.edge*Math.PI/2);l(n,n,Ci),a(n,e,n),n[12]=0,n[13]=0,n[14]=0,i.modelTransform=n,i.renderLocation=o.position}function pi(i,e){switch(e){case 0:return{basis:i.basis1,direction:1,position:u(E.get(),i.origin,i.basis1),edge:e};case 1:return{basis:i.basis2,direction:1,position:u(E.get(),i.origin,i.basis2),edge:e};case 2:return{basis:i.basis1,direction:-1,position:f(E.get(),i.origin,i.basis1),edge:e};case 3:return{basis:i.basis2,direction:-1,position:f(E.get(),i.origin,i.basis2),edge:e}}}function mi(i,e,t){const o=t.projectToRenderScreen(u(E.get(),i,e),n(E.get())),r=t.projectToRenderScreen(f(E.get(),i,e),n(E.get()));return o&&r?w(f(o,o,r)):0}function fi(i){const e=d(i.basis1),t=d(i.basis2);return D*Math.min(e,t)}function bi(i){return fi(i)}function hi(i){return 0!==i.direction[0]&&0!==i.direction[1]}function ji(i){const e=[[-1,-1,0],[1,-1,0],[1,1,0],[-1,1,0],[-1,-1,0]];return new Q({view:i,attached:!1,color:B(i.effectiveTheme),width:O,renderOccluded:4,geometry:[e],isDecoration:!0})}function wi(i){return new X({view:i,attached:!1,backgroundColor:W,gridColor:z(i.effectiveTheme),gridWidth:4,renderOccluded:4,isDecoration:!0})}function vi(e,o,n,r=new i){if(null==e)return null;const{renderCoordsHelper:s}=o,a=s.fromRenderCoords(e.origin,new R({spatialReference:o.spatialReference}));if(null==a)return null;const c=y(a,n);if(null==c)return null;r.position=c;const l=2*d(e.basis1),g=2*d(e.basis2),u=Y.renderUnitScaleFactor(o.spatialReference,n);r.width=l*u,r.height=g*u;const p=s.worldUpAtPosition(e.origin,E.get());return r.tilt=t(Pi(e,p)),r.heading=s.headingAtPosition(e.origin,e.basis1)-90,r}function Pi(i,e){return I(e,i.basis2,i.basis1)+Ci}function Ui(i,t,n,r,s,a,c=M()){return a.toRenderCoords(i,c.origin)?(a.worldBasisAtPosition(c.origin,0,c.basis1),a.worldBasisAtPosition(c.origin,1,c.basis2),x(c.basis2,c.basis1,c.origin,c.plane),S(c,-o(t),T(c),c),S(c,o(n),c.basis1,c),p(c.basis1,c.basis1,r/2),p(c.basis2,c.basis2,s/2),A(c),c):(e.getLogger("esri.views.3d.analysis.Slice.sliceToolUtils").error(`Failed to project slice plane position, projection from ${i.spatialReference.wkid} is not supported`),null)}function Ri(i,e){if(null==i?.position)return null;const t=K(i.position,e.spatialReference,e.elevationProvider);if(null==t)return null;const o=Y.renderUnitScaleFactor(i.position.spatialReference,e.spatialReference),n=i.width*o,r=i.height*o;return{position:t,heading:i.heading,tilt:i.tilt,renderWidth:n,renderHeight:r}}function yi(i,e,t,o=M()){const n=Ri(i,e);return null==n?null:Mi(n,e,t,o)}function Mi(i,e,t,o=M()){if(null==i)return null;const n=Ui(i.position,i.heading,i.tilt,i.renderWidth,i.renderHeight,e.renderCoordsHelper,o);return t.tiltEnabled||null==n||ti(n,e.renderCoordsHelper,n),n}const Si=16,Ti=32,Ai=H(),Ci=Math.PI/2,ki=16,Li=32;function xi(i){return null!=("building-scene-3d"===i.type?i:null)}export{Si as DidPointerMoveRecentlyFlag,Ti as IsShiftEdgeOnScreenFlag,si as calculateBoundedPlaneTranslateRotate,bi as calculateDiagonalResizeHandleScale,ni as calculatePlaneHalfSize,wi as createGridVisualElement,ji as createOutlineVisualElement,_ as createPlane,ai as createRotatePlane,ri as createShiftPlane,ti as forceHorizontalOrVertical,xi as isBuildingSceneLayerView3D,hi as isDiagonalResizeHandle,ei as normalToBases,vi as planeToShape,Ri as projectAndElevationAlignShape,Mi as projectedShapeToPlane,ki as resizeNormal,Li as resizeOutlineOnly,oi as resizePlane,yi as shapeToPlane,di as updateResizeHandle,gi as updateRotateHeadingHandle,ui as updateRotateTiltHandle,ci as updateShiftRestartHandle};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{Sphere as e}from"../../../../geometry/support/sphere.js";import{ElevationRange as s}from"../../support/ElevationRange.js";class i extends s{constructor(s,i){super(NaN,NaN),this.id=s,this.serviceMbsInIndexSR=i,this._serviceMbsInRenderSRElevationAdjusted=new e(0,0,0,-1),this._serviceMbsInRenderSR=new e(0,0,0,-1),this._mbsConeInRenderSR=null}get serviceMbsInRenderSRElevationAdjusted(){return this._serviceMbsInRenderSRElevationAdjusted}updateServiceMbsInRenderSRElevationAdjusted(e){return this._serviceMbsInRenderSRElevationAdjusted.copyFrom(e),this._serviceMbsInRenderSRElevationAdjusted}get serviceMbsInRenderSR(){return this._serviceMbsInRenderSR}updateServiceMbsInRenderSR(e){return this._serviceMbsInRenderSR.copyFrom(e),this._serviceMbsInRenderSR}get mbsConeInRenderSR(){return this._mbsConeInRenderSR}updateMbsConeInRenderSR(e){return this._mbsConeInRenderSR=e
|
|
2
|
+
import{Sphere as e}from"../../../../geometry/support/sphere.js";import{ElevationRange as s}from"../../support/ElevationRange.js";class i extends s{constructor(s,i){super(NaN,NaN),this.id=s,this.serviceMbsInIndexSR=i,this._serviceMbsInRenderSRElevationAdjusted=new e(0,0,0,-1),this._serviceMbsInRenderSR=new e(0,0,0,-1),this._mbsConeInRenderSR=null}get serviceMbsInRenderSRElevationAdjusted(){return this._serviceMbsInRenderSRElevationAdjusted}updateServiceMbsInRenderSRElevationAdjusted(e){return this._serviceMbsInRenderSRElevationAdjusted.copyFrom(e),this._serviceMbsInRenderSRElevationAdjusted}get serviceMbsInRenderSR(){return this._serviceMbsInRenderSR}updateServiceMbsInRenderSR(e){return this._serviceMbsInRenderSR.copyFrom(e),this._serviceMbsInRenderSR}get mbsConeInRenderSR(){return this._mbsConeInRenderSR}updateMbsConeInRenderSR(e){return this._mbsConeInRenderSR=e.clone(),this._mbsConeInRenderSR}invalidateServiceBVsInRenderSR(){this._serviceMbsInRenderSRElevationAdjusted.invalidate(),this._serviceMbsInRenderSR.invalidate(),this._mbsConeInRenderSR=null,this.serviceObbInRenderSR?.invalidate()}shareServiceBVsInRenderSRWith(e){this.serviceObbInRenderSR=e.serviceObbInRenderSR,this._serviceMbsInRenderSRElevationAdjusted=e._serviceMbsInRenderSRElevationAdjusted,this._serviceMbsInRenderSR=e._serviceMbsInRenderSR,this._mbsConeInRenderSR=e._mbsConeInRenderSR}}class t extends i{constructor(e,s,i,t,n,d,a,R,o,h){super(e,i),this.index=s,this.childCount=t,this.level=n,this.resources=d,this.version=a,this.lodMetric=R,this.maxError=o,this.numFeatures=h,this.failed=!1,this.cacheState=0,this.vertexCount=0,this.memory=0,this.childrenLoaded=0,this.hasModifications=!1,this.imModificationImpact=4,this.elevationAgnosticBoundingVolume=new r}invalidateServiceBVsInRenderSR(){super.invalidateServiceBVsInRenderSR(),this.elevationAgnosticBoundingVolume.invalidate()}}class n{constructor(e,s,i,t){this.nodeHasLOD=e,this.isChosen=s,this.lodLevel=i,this.version=t}}class r{constructor(){this._data=[0,0,0,r.invalidRadius]}static{this.invalidRadius=-2}invalidate(){this._data[3]=r.invalidRadius}get valid(){return this._data[3]!==r.invalidRadius}get radius(){return this._data[3]}getAxis(e){return e[0]=this._data[0],e[1]=this._data[1],e[2]=this._data[2],e}set(e,s){this._data[0]=e[0],this._data[1]=e[1],this._data[2]=e[2],this._data[3]=s}}export{r as ElevationAgnosticBoundingVolume,t as Node,i as NodeBoundingData,n as NodeTraversalState};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{normalize as e,length as t,dot as
|
|
2
|
+
import{normalize as e,length as t,dot as r,scale as a,distance as s}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";class h{constructor(e,t){if(this.lowerCenterHeight=e,this.upperCenterHeight=t,!(e<t))throw new Error(`Invalid elevated sphere: ${e}..${t}`)}}class c extends h{constructor(t,r,a){if(super(r,a),this.baseSphere=t,r<=0)throw new Error(`Invalid elevated sphere: ${r}..${a}`);this._radialAxis=e(i(),t.center)}clone(){return new c(this.baseSphere,this.lowerCenterHeight,this.upperCenterHeight)}calculateSurfaceDistanceFromPoint(e){const h=t(this.baseSphere.center),{upperCenterHeight:c}=this,n=this.baseSphere.radius;if(h<=n)return this._calculateCapSphereSurfaceDistance(e,c,n*c/h);const{lowerCenterHeight:l}=this,u=this._radialAxis,p=n*l/h,o=n*c/h,S=h**2-n**2,f=S/h,C=f*(l/h),g=f*(c/h),m=r(u,e);if(m<=C-p)return this._calculateCapSphereSurfaceDistance(e,l,p);if(m>=g)return this._calculateCapSphereSurfaceDistance(e,c,o);const d=Math.sqrt(S),w=n*d/h,x=a(i(),u,m),H=s(x,e),b=w*m/f;if(H<=b)return 0;const _=d*(c/h),D=d*(m/f);return D<=d*(l/h)?this._calculateCapSphereSurfaceDistance(e,l,p):D>=_?this._calculateCapSphereSurfaceDistance(e,c,o):(H-b)*f/d}_calculateCapSphereSurfaceDistance(e,t,r){const h=a(i(),this._radialAxis,t),c=s(h,e);return c<r?0:c-r}}class n extends h{constructor(e,t,r){super(t,r),this.baseSphere=e}clone(){return new n(this.baseSphere,this.lowerCenterHeight,this.upperCenterHeight)}calculateSurfaceDistanceFromPoint(e){const{center:t,radius:r}=this.baseSphere,a=e[2],s=(e[0]-t[0])**2+(e[1]-t[1])**2,{lowerCenterHeight:i,upperCenterHeight:h}=this;return a<=i?Math.max(0,Math.sqrt(s+(a-i)**2)-r):a>=h?Math.max(0,Math.sqrt(s+(a-h)**2)-r):Math.max(0,Math.sqrt(s)-r)}}export{h as SphereCone,c as SphereConeGlobal,n as SphereCylinderLocal};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import e from"../../../../core/PooledArray.js";import{castRenderScreenPointArray3 as t,createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{getMetersPerVerticalUnitForSR as i}from"../../../../core/units.js";import{add as n,normalize as s,dot as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as c,copy as a,negativeInfinity as d}from"../../../../geometry/support/aaBoundingRect.js";import{create as u}from"../../../../geometry/support/ray.js";import{sv3d as y}from"../../../../geometry/support/vectorStacks.js";import{getElevationOffsetInMeters as h}from"../../../../support/elevationInfoUtils.js";import{computeMapPointFromVec3d as p}from"../../support/hitTest.js";import{fromRenderAtEye as g,fromScreen as m}from"../../support/geometryUtils/ray.js";import{defaultTolerance as f,Intersector as P,defaultScreenPolygonPrimitiveProcessor as _}from"../../webgl-engine/lib/Intersector.js";import{RayIntersectionQuery as w}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{isValidIntersectorResult as R}from"../../webgl-engine/lib/IntersectorResult.js";import{SliceScreenPolygonPrimitiveProcessor as v,sliceFilterPredicate as b}from"../../webgl-engine/lib/intersectorUtils.js";import{prepareScreenPolygonIntersectionQuery as I}from"../../webgl-engine/lib/screenPolygonIntersectionUtils.js";import{TaskPriority as U}from"../../../support/Scheduler.js";class H{constructor(t,r,i){this.viewingMode=t,this._forEachLayer=r,this._view=i,this._externalIntersectionHandlers=new e,this._tolerance=f,this._tmpRay=u(),this._tmpRegion=c(),this._validateHUDIntersector=new P(this.viewingMode),this._validateHUDIntersector.options.hud=!1,this._screenPolygonIntersectionTask=this._view.resourceController.scheduler.registerTask(U.SCREEN_POLYGON_INTERSECTION)}destroy(){this._screenPolygonIntersectionTask.remove(),this._externalIntersectionHandlers.prune()}intersectScreen(e,t,r){return this.intersectRay(this._getPickRay(e,this._tmpRay),F(this.viewingMode),t,r)}intersectScreenFreePointFallback(e,t,r){return this.intersectRayFreePointFallback(this._getPickRay(e,this._tmpRay),t,r)}intersectRayFreePointFallback(e,t,r){return this.intersectRay(e,F(this.viewingMode),t,r)||this._intersectRayFreePointLocal(e,t)}intersectRay(e,t,r,i){return t.options.selectionMode=!1,t.options.store=0,this.computeIntersection(e,t,!1,i),!!t.results.min&&t.results.min.getIntersectionPoint(r)}getCenterRayWithSubpixelOffset(e,t,r=.5,i=.5){return e.getRenderCenter(E,r,i),E[0]+=.0466,E[1]-=.0123,g(e,E,t)}intersectIntersectorScreen(e,t,r){this.computeIntersection(this._getPickRay(e,this._tmpRay),t,!1,r)}async intersectIntersectorScreenPolygon(e,t,r){t.polygonResults.init();const i=this._view.state.camera,n=await I(i,e);null!=n&&await this._screenPolygonIntersectionTask.scheduleGenerator(()=>this._intersectIntersectorScreenPolygon(i,t,n,r))}*_intersectIntersectorScreenPolygon(e,t,r,i){const n=new S(i,this._forEachLayer);t.options.selectOpaqueTerrainOnly=!i||!("include"in i||"exclude"in i),t.camera=e,t.point=null,t.screenPolygonPrimitiveProcessor=_,yield*t.intersectScreenPolygon(n.layers,r);const s=this._view.slice.plane,o=s?new v(s):null;t.screenPolygonPrimitiveProcessor=o??_,yield*t.intersectScreenPolygon(n.sliceableLayers,r),t.screenPolygonPrimitiveProcessor=_,yield*this._intersectPolygonHandlersGenerator(t,n,r,null,o),yield*t.intersectHUDScreenPolygon(n.layers,r),t.screenPolygonPrimitiveProcessor=o??_,yield*t.intersectHUDScreenPolygon(n.sliceableLayers,r),t.polygonResults.sortResults()}intersectToolIntersectorScreen(e,t,r){const i=this._getPickRay(e,this._tmpRay);this.intersectToolIntersectorRay(i,t,r)}intersectToolIntersectorRay(e,t,r){t.options.selectionMode=!0,this.computeIntersection(e,t,!1,r);const i=t.results.min;!!this._view.basemapTerrain&&this._view.basemapTerrain.opaque||R(i)&&7!==i.intersector||(t.options.selectionMode=!1,this.computeIntersection(e,t,!1,r))}setTolerance(e=f){this._tolerance=e}addIntersectionHandler(e){this._externalIntersectionHandlers.push(e),this._externalIntersectionHandlers.sort((e,t)=>7===e.type?1:7===t.type?-1:0)}removeIntersectionHandler(e){null!=this._externalIntersectionHandlers.removeUnordered(e)&&this._externalIntersectionHandlers.sort((e,t)=>7===e.type?1:7===t.type?-1:0)}_getPickRay(e,t){const r=this._view.state.camera;return m(r,e,t)}_intersectRayFreePointLocal(e,t){return 2!==this.viewingMode||null==e||n(t,e.origin,s(y.get(),e.direction)),!1}intersectElevationFromScreen(e,t,r=0,i=null){return this._intersectElevation(this._getPickRay(e,this._tmpRay),t,r,i)}_intersectElevation(e,r,n=0,l=null){if(null==e)return null;const c=this._view,{renderCoordsHelper:a}=c,d=i(c.spatialReference),u=null!=r?r.mode:"absolute-height",g=h(r)/d,m=("on-the-ground"!==u?g+n:0)*d/a.unitInMeters,{camera:f}=c.state;if("absolute-height"===u){const t=a?.getAltitude(f.eye),r=o(s(T,e.direction),a.worldUpAtPosition(f.eye,k));if(t<m&&r<0||t>=m&&r>0)return null;if(a.intersectInfiniteManifold(e,m,T)){const e=p(c,T);return e.z??=0,e.z-=g,e}return null}const _=f.projectToRenderScreen(e.origin,t(y.get())),w=new S(null,this._forEachLayer),R=c.slice.plane,v=R?b(R):null,I=new P(this.viewingMode);I.options.store=0,I.options.verticalOffset=m,I.options.normalRequired=!1;const U=this._createRayIntersectionQuery(e,_,!1);I.reset(U.beginPoint,U.endPoint,f),I.point=_;let H=null;if(l&&"type"in l&&"graphics"===l.type){const e=c.allLayerViews.find(e=>e.layer===l)?.uid;H=e?t=>t.layerViewUid===e:null}else l&&(H=e=>e.graphicUid!==l.uid);switch(u){case"relative-to-scene":{const e=e=>(!H||H(e))&&!!e.lastValidElevationBB;I.intersect(w.layers,U.screenPoint,this._tolerance,null,e),this._intersectRayHandlers(I,w,U,v,!1,e=>2===e.type||7===e.type||8===e.type,!1);break}case"on-the-ground":case"relative-to-ground":this._intersectRayHandlers(I,w,U,v,!1,e=>e.isGround,!1)}if(I.results.min.getIntersectionPoint(T)){const e=p(c,T);return e.z=n,e}return null}computeIntersection(e,r,i,n){if(null==e)return;const s=this._view.state.camera,o=s.projectToRenderScreen(e.origin,t(y.get())),l=new S(n,this._forEachLayer);r.options.selectOpaqueTerrainOnly=!n||!("include"in n||"exclude"in n);const c=this._createRayIntersectionQuery(e,o,i);r.reset(c.beginPoint,c.endPoint,s),r.intersect(l.layers,c.screenPoint,this._tolerance);const a=this._view.slice.plane,d=a?b(a):null;r.intersect(l.sliceableLayers,c.screenPoint,this._tolerance,d);const u=n&&(n.requiresGroundFeedback||n.enableDraped);this._intersectRayHandlers(r,l,c,d,!!u);const h=y.get(),p=this._view,g=p.basemapTerrain;if(n&&n.enableDraped&&null!=g.spatialReference&&r.results.ground.getIntersectionPoint(h)){const e=p.overlayManager.renderer,t=p.renderCoordsHelper.spatialReference,i=y.get();p.renderCoordsHelper.fromRenderCoords(h,i,g.spatialReference),i[2]=p.elevationProvider?.getElevation(h[0],h[1],h[2],t,"ground")??0,e.intersectRay(r,i,r.results.ground,e=>l.filterRenderGeometry(e))}r.sortResults(),this._processHUDResults(r)}_processHUDResults(e){const t=e.results.hud;a(this._tmpRegion,d);const r=new Array,i=this._tmpRegion,n=e=>{r.push(new L(e))};e.sortResults(t.all),null!=t.min.distance&&n(t.min);for(const c of t.all)t.min.target.object!==c.target.object&&t.max.target.object!==c.target.object&&n(c);if(null!=t.max.distance&&t.max.target.object!==t.min.target.object&&n(t.max),!r.length)return;i[0]===i[2]&&(i[2]+=1),i[1]===i[3]&&(i[3]+=1);let s=!0;const o=null==e.results.max.distance;let l=0;for(const c of r)s&&(e.results.min.copy(c.result),s=!1),o&&e.results.max.copy(c.result),2===e.options.store&&e.results.all.splice(l++,0,c.result)}_createRayIntersectionQuery(e,t,r){return new w(e.origin,n(l(),e.origin,e.direction),t,r)}_intersectRayHandlers(e,t,r,i,n,s=()=>!0,o=!0){const{options:l}=e,c=l.isFiltered,a=l.filteredLayerViewUids;for(const{handler:d,filterPredicate:u,isFiltered:y,filteredLayerViewUids:h}of this._getFilteredIntersectionHandlers(t,i,null,s,o))(!y||d.isGround&&n)&&(l.isFiltered=y,l.filteredLayerViewUids=h,d.intersectRay(e,u,e.rayBegin,e.rayEnd,r.screenPoint,r.isVerticalRay));l.isFiltered=c,l.filteredLayerViewUids=a}*_intersectPolygonHandlersGenerator(e,t,r,i,n,s=()=>!0,o=!0){const{options:l}=e,c=l.isFiltered,a=l.filteredLayerViewUids,d=e.screenPolygonPrimitiveProcessor;for(const{handler:u,screenPolygonPrimitiveProcessor:y,isFiltered:h,filteredLayerViewUids:p}of this._getFilteredIntersectionHandlers(t,i,n,s,o))h||null==u.intersectScreenPolygon||(l.isFiltered=h,l.filteredLayerViewUids=p,e.screenPolygonPrimitiveProcessor=y??_,yield*u.intersectScreenPolygon(e,r));l.isFiltered=c,l.filteredLayerViewUids=a,e.screenPolygonPrimitiveProcessor=d}*_getFilteredIntersectionHandlers(e,t,r,i=()=>!0,n=!0){for(const s of this._externalIntersectionHandlers){if(!i(s))continue;let o=!1;const l=[];if(n){const t=s.layerViewUid,r=s.sublayerId,i=Array.isArray(t),n=i?t:[t];let c=!1;for(const s of n)e.filterLayerViewUid(s,r)?c=!0:i&&l.push(s);o=!c}yield new j(s,s.slicePlaneEnabled?t:null,s.slicePlaneEnabled?r:null,o,l)}}}class L{constructor(e){this.result=e,this.screenPoint=r()}}class j{constructor(e,t,r,i,n){this.handler=e,this.filterPredicate=t,this.screenPolygonPrimitiveProcessor=r,this.isFiltered=i,this.filteredLayerViewUids=n}}let x;function F(e){return x&&x.viewingMode===e||(x=new P(e)),x}class S{constructor(e,t){this.layers=new Array,this.sliceableLayers=new Array,this.include=e?.include,this.exclude=e?.exclude,t(e=>{e.pickable&&this.filterLayerViewUid(e.apiLayerViewUid)&&(e.sliceable?this.sliceableLayers:this.layers).push(e)})}filterLayerViewUid(e,t){const{include:r,exclude:i}=this;if(null==e)return null==r&&null==i;const n=r instanceof Map?r.get(e)??!1:r?.has(e),s=i instanceof Map?i.get(e)??!1:i?.has(e);return(null==n||("boolean"==typeof n?n:null!=t&&n.has(t)))&&(null==s||!("boolean"==typeof s?s:null!=t&&s.has(t)))}filterRenderGeometry(e){return this.filterLayerViewUid(e.layerViewUid)}}function V(e){return"object"==typeof e&&null!=e&&"intersectRay"in e}const T=l(),k=l(),E=r();export{H as SceneIntersectionHelper,V as isIntersectionHandler};
|
|
2
|
+
import{lerp as e}from"../../../../core/mathUtils.js";import t from"../../../../core/PooledArray.js";import{castRenderScreenPointArray3 as r,createRenderScreenPointArray3 as n,createScreenPointArray as i}from"../../../../core/screenUtils.js";import{getMetersPerVerticalUnitForSR as s}from"../../../../core/units.js";import{set as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as l}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{add as c,normalize as a,dot as u,distance as d}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as y}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as h,copy as p,negativeInfinity as m,expandWithNestedArray as g}from"../../../../geometry/support/aaBoundingRect.js";import{createSpatialReferenceCyclical as f}from"../../../../geometry/support/normalizeUtils.js";import{create as _}from"../../../../geometry/support/ray.js";import{sv3d as P}from"../../../../geometry/support/vectorStacks.js";import{getElevationOffsetInMeters as w}from"../../../../support/elevationInfoUtils.js";import{g as R}from"../../../../chunks/cameraUtilsSpherical.js";import{computeMapPointFromVec3d as v}from"../../support/hitTest.js";import{fromRenderAtEye as I,fromScreen as b}from"../../support/geometryUtils/ray.js";import{defaultTolerance as U,Intersector as j,defaultScreenPolygonPrimitiveProcessor as S}from"../../webgl-engine/lib/Intersector.js";import{RayIntersectionQuery as H,DrapedScreenPolygonIntersectionQuery as L}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{isValidIntersectorResult as x}from"../../webgl-engine/lib/IntersectorResult.js";import{SliceScreenPolygonPrimitiveProcessor as F,sliceFilterPredicate as T}from"../../webgl-engine/lib/intersectorUtils.js";import{prepareScreenPolygonIntersectionQuery as M}from"../../webgl-engine/lib/screenPolygonIntersectionUtils.js";import{TaskPriority as V}from"../../../support/Scheduler.js";class k{constructor(e,r,n){this.viewingMode=e,this._forEachLayer=r,this._view=n,this._externalIntersectionHandlers=new t,this._tolerance=U,this._tmpRay=_(),this._tmpRegion=h(),this._validateHUDIntersector=new j(this.viewingMode),this._validateHUDIntersector.options.hud=!1,this._screenPolygonIntersectionTask=this._view.resourceController.scheduler.registerTask(V.SCREEN_POLYGON_INTERSECTION)}destroy(){this._screenPolygonIntersectionTask.remove(),this._externalIntersectionHandlers.prune()}intersectScreen(e,t,r){return this.intersectRay(this._getPickRay(e,this._tmpRay),O(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,O(this.viewingMode),t,r)||this._intersectRayFreePointLocal(e,t)}intersectRay(e,t,r,n){return t.options.selectionMode=!1,t.options.store=0,this.computeIntersection(e,t,!1,n),!!t.results.min&&t.results.min.getIntersectionPoint(r)}getCenterRayWithSubpixelOffset(e,t,r=.5,n=.5){return e.getRenderCenter(B,r,n),B[0]+=.0466,B[1]-=.0123,I(e,B,t)}intersectIntersectorScreen(e,t,r){this.computeIntersection(this._getPickRay(e,this._tmpRay),t,!1,r)}async intersectIntersectorScreenPolygon(e,t,r){t.polygonResults.init();const n=this._view.state.camera,i=await M(n,e);null!=i&&await this._screenPolygonIntersectionTask.scheduleGenerator(()=>this._intersectIntersectorScreenPolygon(n,t,i,r))}*_intersectIntersectorScreenPolygon(e,t,r,n){const i=new C(n,this._forEachLayer);t.options.selectOpaqueTerrainOnly=!n||!("include"in n||"exclude"in n),t.camera=e,t.point=null,t.screenPolygonPrimitiveProcessor=S,yield*t.intersectScreenPolygon(i.layers,r);const s=this._view.slice.plane,o=s?new F(s):null;t.screenPolygonPrimitiveProcessor=o??S,yield*t.intersectScreenPolygon(i.sliceableLayers,r),t.screenPolygonPrimitiveProcessor=S,yield*this._intersectPolygonHandlersGenerator(t,i,r,null,o),yield*this._intersectDrapedScreenPolygon(t,i,r,n),yield*t.intersectHUDScreenPolygon(i.layers,r),t.screenPolygonPrimitiveProcessor=o??S,yield*t.intersectHUDScreenPolygon(i.sliceableLayers,r),t.polygonResults.sortResults()}intersectToolIntersectorScreen(e,t,r){const n=this._getPickRay(e,this._tmpRay);this.intersectToolIntersectorRay(n,t,r)}intersectToolIntersectorRay(e,t,r){t.options.selectionMode=!0,this.computeIntersection(e,t,!1,r);const n=t.results.min;!!this._view.basemapTerrain&&this._view.basemapTerrain.opaque||x(n)&&7!==n.intersector||(t.options.selectionMode=!1,this.computeIntersection(e,t,!1,r))}setTolerance(e=U){this._tolerance=e}addIntersectionHandler(e){this._externalIntersectionHandlers.push(e),this._externalIntersectionHandlers.sort((e,t)=>7===e.type?1:7===t.type?-1:0)}removeIntersectionHandler(e){null!=this._externalIntersectionHandlers.removeUnordered(e)&&this._externalIntersectionHandlers.sort((e,t)=>7===e.type?1:7===t.type?-1:0)}_getPickRay(e,t){const r=this._view.state.camera;return b(r,e,t)}_intersectRayFreePointLocal(e,t){return 2!==this.viewingMode||null==e||c(t,e.origin,a(P.get(),e.direction)),!1}intersectElevationFromScreen(e,t,r=0,n=null){return this._intersectElevation(this._getPickRay(e,this._tmpRay),t,r,n)}_intersectElevation(e,t,n=0,i=null){if(null==e)return null;const o=this._view,{renderCoordsHelper:l}=o,c=s(o.spatialReference),d=null!=t?t.mode:"absolute-height",y=w(t)/c,h=("on-the-ground"!==d?y+n:0)*c/l.unitInMeters,{camera:p}=o.state;if("absolute-height"===d){const t=l?.getAltitude(p.eye),r=u(a(N,e.direction),l.worldUpAtPosition(p.eye,q));if(t<h&&r<0||t>=h&&r>0)return null;if(l.intersectInfiniteManifold(e,h,N)){const e=v(o,N);return e.z??=0,e.z-=y,e}return null}const m=p.projectToRenderScreen(e.origin,r(P.get())),g=new C(null,this._forEachLayer),f=o.slice.plane,_=f?T(f):null,R=new j(this.viewingMode);R.options.store=0,R.options.verticalOffset=h,R.options.normalRequired=!1;const I=this._createRayIntersectionQuery(e,m,!1);R.reset(I.beginPoint,I.endPoint,p),R.point=m;let b=null;if(i&&"type"in i&&"graphics"===i.type){const e=o.allLayerViews.find(e=>e.layer===i)?.uid;b=e?t=>t.layerViewUid===e:null}else i&&(b=e=>e.graphicUid!==i.uid);switch(d){case"relative-to-scene":{const e=e=>(!b||b(e))&&!!e.lastValidElevationBB;R.intersect(g.layers,I.screenPoint,this._tolerance,null,e),this._intersectRayHandlers(R,g,I,_,!1,e=>2===e.type||7===e.type||8===e.type,!1);break}case"on-the-ground":case"relative-to-ground":this._intersectRayHandlers(R,g,I,_,!1,e=>e.isGround,!1)}if(R.results.min.getIntersectionPoint(N)){const e=v(o,N);return e.z=n,e}return null}computeIntersection(e,t,n,i){if(null==e)return;const s=this._view.state.camera,o=s.projectToRenderScreen(e.origin,r(P.get())),l=new C(i,this._forEachLayer);t.options.selectOpaqueTerrainOnly=!i||!("include"in i||"exclude"in i);const c=this._createRayIntersectionQuery(e,o,n);t.reset(c.beginPoint,c.endPoint,s),t.intersect(l.layers,c.screenPoint,this._tolerance);const a=this._view.slice.plane,u=a?T(a):null;t.intersect(l.sliceableLayers,c.screenPoint,this._tolerance,u);const d=i&&(i.requiresGroundFeedback||i.enableDraped);this._intersectRayHandlers(t,l,c,u,!!d);const y=P.get(),h=this._view,p=h.basemapTerrain;if(i&&i.enableDraped&&null!=p.spatialReference&&t.results.ground.getIntersectionPoint(y)){const e=h.overlayManager.renderer,r=h.renderCoordsHelper.spatialReference,n=P.get();h.renderCoordsHelper.fromRenderCoords(y,n,p.spatialReference),n[2]=h.elevationProvider?.getElevation(y[0],y[1],y[2],r,"ground")??0,e.intersectRay(t,n,t.results.ground,e=>l.filterRenderGeometry(e))}t.sortResults(),this._processHUDResults(t)}_processHUDResults(e){const t=e.results.hud;p(this._tmpRegion,m);const r=new Array,n=this._tmpRegion,i=e=>{r.push(new E(e))};e.sortResults(t.all),null!=t.min.distance&&i(t.min);for(const c of t.all)t.min.target.object!==c.target.object&&t.max.target.object!==c.target.object&&i(c);if(null!=t.max.distance&&t.max.target.object!==t.min.target.object&&i(t.max),!r.length)return;n[0]===n[2]&&(n[2]+=1),n[1]===n[3]&&(n[3]+=1);let s=!0;const o=null==e.results.max.distance;let l=0;for(const c of r)s&&(e.results.min.copy(c.result),s=!1),o&&e.results.max.copy(c.result),2===e.options.store&&e.results.all.splice(l++,0,c.result)}_createRayIntersectionQuery(e,t,r){return new H(e.origin,c(y(),e.origin,e.direction),t,r)}_intersectRayHandlers(e,t,r,n,i,s=()=>!0,o=!0){const{options:l}=e,c=l.isFiltered,a=l.filteredLayerViewUids;for(const{handler:u,filterPredicate:d,isFiltered:y,filteredLayerViewUids:h}of this._getFilteredIntersectionHandlers(t,n,null,s,o))(!y||u.isGround&&i)&&(l.isFiltered=y,l.filteredLayerViewUids=h,u.intersectRay(e,d,e.rayBegin,e.rayEnd,r.screenPoint,r.isVerticalRay));l.isFiltered=c,l.filteredLayerViewUids=a}*_intersectPolygonHandlersGenerator(e,t,r,n,i,s=()=>!0,o=!0){const{options:l}=e,c=l.isFiltered,a=l.filteredLayerViewUids,u=e.screenPolygonPrimitiveProcessor;for(const{handler:d,screenPolygonPrimitiveProcessor:y,isFiltered:h,filteredLayerViewUids:p}of this._getFilteredIntersectionHandlers(t,n,i,s,o))h||null==d.intersectScreenPolygon||(l.isFiltered=h,l.filteredLayerViewUids=p,e.screenPolygonPrimitiveProcessor=y??S,yield*d.intersectScreenPolygon(e,r));l.isFiltered=c,l.filteredLayerViewUids=a,e.screenPolygonPrimitiveProcessor=u}*_intersectDrapedScreenPolygon(e,t,r,n){const{basemapTerrain:i,overlayManager:s}=this._view,o=null!=i.spatialReference&&!s.renderer.isEmpty;if(!e.options.selectionMode||!n?.enableDraped||!o)return;const l=yield*this._createDrapedPolygonIntersectionQuery(r);null!=l&&(yield*this._view.overlayManager.renderer.intersectScreenPolygon(e,l,e=>t.filterRenderGeometry(e)))}*_createDrapedPolygonIntersectionQuery(t){const{state:{camera:{eye:r}},pointsOfInterest:n,basemapTerrain:i}=this._view,s=new Array,c=R(this._view,n.focus.renderLocation),a=f(i.spatialReference);let u=Number.POSITIVE_INFINITY,y=null;const p=N,_=q,P=e=>{if(!this._intersectDrapedScreenPolygonPoint(p,_,e))return!1;const t=null!=y&&a?y+a.shortestSignedDiff(y,p[0]):p[0];return y=t,s.push(l(t,p[1])),u=Math.min(u,d(r,_)),!0},{points:w}=t,{length:v}=w;for(let l=0;l<v;l++){const t=w[l],r=w[(l+1)%v];for(let n=0;n<c;n++){const i=n/c;if(!P(0===n?t:o(z,e(t[0],r[0],i),e(t[1],r[1],i))))return null;yield}}return Number.isFinite(u)?new L(s,g(h(m),s),u):null}_intersectDrapedScreenPolygonPoint(e,t,r){const n=this._getPickRay(r,this._tmpRay);if(null==n)return!1;const{renderCoordsHelper:i}=this._view;this._intersectGroundPoint(t,n,r)||i.intersectManifoldClosestSilhouette(n,0,t);const s=this._view.basemapTerrain;return!!i.fromRenderCoords(t,e,s.spatialReference)}_intersectGroundPoint(e,t,r){const n=this._view.state.camera,i=new C(null,this._forEachLayer),s=this._view.slice.plane,o=s?T(s):null,l=new j(this.viewingMode);Q[0]=r[0],Q[1]=r[1],Q[2]=0;const c=this._createRayIntersectionQuery(t,Q,!1);return l.options.selectionMode=!0,l.options.store=0,l.options.normalRequired=!1,l.options.selectOpaqueTerrainOnly=!1,l.reset(c.beginPoint,c.endPoint,n),this._intersectRayHandlers(l,i,c,o,!0,e=>e.isGround,!1),l.results.ground.getIntersectionPoint(e)}*_getFilteredIntersectionHandlers(e,t,r,n=()=>!0,i=!0){for(const s of this._externalIntersectionHandlers){if(!n(s))continue;let o=!1;const l=[];if(i){const t=s.layerViewUid,r=s.sublayerId,n=Array.isArray(t),i=n?t:[t];let c=!1;for(const s of i)e.filterLayerViewUid(s,r)?c=!0:n&&l.push(s);o=!c}yield new D(s,s.slicePlaneEnabled?t:null,s.slicePlaneEnabled?r:null,o,l)}}}class E{constructor(e){this.result=e,this.screenPoint=n()}}class D{constructor(e,t,r,n,i){this.handler=e,this.filterPredicate=t,this.screenPolygonPrimitiveProcessor=r,this.isFiltered=n,this.filteredLayerViewUids=i}}let G;function O(e){return G&&G.viewingMode===e||(G=new j(e)),G}class C{constructor(e,t){this.layers=new Array,this.sliceableLayers=new Array,this.include=e?.include,this.exclude=e?.exclude,t(e=>{e.pickable&&this.filterLayerViewUid(e.apiLayerViewUid)&&(e.sliceable?this.sliceableLayers:this.layers).push(e)})}filterLayerViewUid(e,t){const{include:r,exclude:n}=this;if(null==e)return null==r&&null==n;const i=r instanceof Map?r.get(e)??!1:r?.has(e),s=n instanceof Map?n.get(e)??!1:n?.has(e);return(null==i||("boolean"==typeof i?i:null!=t&&i.has(t)))&&(null==s||!("boolean"==typeof s?s:null!=t&&s.has(t)))}filterRenderGeometry(e){return this.filterLayerViewUid(e.layerViewUid)}}function A(e){return"object"==typeof e&&null!=e&&"intersectRay"in e}const N=y(),q=y(),Q=n(),z=i(),B=n();export{k as SceneIntersectionHelper,A as isIntersectionHandler};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import"../../../core/Cyclical.js";import"../../../core/mathUtils.js";import"../../../core/libs/gl-matrix-2/math/mat4.js";import"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import"../../../core/libs/gl-matrix-2/math/vec3.js";import"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import"../../../core/libs/gl-matrix-2/math/vec4.js";import"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import"../../../core/libs/gl-matrix-2/math/common.js";import"../../../geometry/ellipsoidUtils.js";import"../../../geometry/Extent.js";import"../../../geometry/Polygon.js";import"../../../geometry/SpatialReference.js";import"../../../geometry/support/coordsUtils.js";import"../../../geometry/support/lineSegment.js";import"../../../geometry/support/normalizeUtils.js";import"../../../geometry/support/plane.js";import"../../../geometry/support/ray.js";import"../../../geometry/support/sphere.js";import"../../../geometry/support/webMercatorUtils.js";import"../state/Frustum.js";import"../state/NearFarHeuristic.js";import"./cameraUtilsInternal.js";import"./earthUtils.js";import"./mathUtils.js";export{d as directionToHeadingTilt,e as eyeForCenterWithHeadingTilt,a as eyeTiltToLookAtTilt,h as headingTiltToDirectionUp,l as lookAtTiltToEyeTilt,t as toArea,b as toExtent}from"../../../chunks/cameraUtilsSpherical.js";
|
|
2
|
+
import"../../../core/Cyclical.js";import"../../../core/mathUtils.js";import"../../../core/libs/gl-matrix-2/math/mat4.js";import"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import"../../../core/libs/gl-matrix-2/math/vec3.js";import"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import"../../../core/libs/gl-matrix-2/math/vec4.js";import"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import"../../../core/libs/gl-matrix-2/math/common.js";import"../../../geometry/ellipsoidUtils.js";import"../../../geometry/Extent.js";import"../../../geometry/Polygon.js";import"../../../geometry/SpatialReference.js";import"../../../geometry/support/coordsUtils.js";import"../../../geometry/support/lineSegment.js";import"../../../geometry/support/normalizeUtils.js";import"../../../geometry/support/plane.js";import"../../../geometry/support/ray.js";import"../../../geometry/support/sphere.js";import"../../../geometry/support/webMercatorUtils.js";import"../state/Frustum.js";import"../state/NearFarHeuristic.js";import"./cameraUtilsInternal.js";import"./earthUtils.js";import"./mathUtils.js";export{d as directionToHeadingTilt,e as eyeForCenterWithHeadingTilt,a as eyeTiltToLookAtTilt,g as getCurvatureSamples,h as headingTiltToDirectionUp,l as lookAtTiltToEyeTilt,t as toArea,b as toExtent}from"../../../chunks/cameraUtilsSpherical.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
class l{constructor(){this.numVerticesPerSide=0,this.samplerData=null,this.samplerDataVersion=0,this.clippingArea=null,this.wireframe=!1,this.cornerPeerNeighbors=[null,null,null,null],this.cornerNeighborCornerTiles=[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],this.cornerNeighborCornerTileSamplerVersions=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],this.edgeResolutions=[-1,-1,-1,-1],this.edgePeerNeighbors=[null,null,null,null],this.edgePeerNeighborSamplerVersions=[-1,-1,-1,-1]}}export{l as GeometryState};
|
|
2
|
+
class l{constructor(){this.numVerticesPerSide=0,this.samplerData=null,this.samplerDataSourceLevels=null,this.samplerDataVersion=0,this.clippingArea=null,this.wireframe=!1,this.cornerPeerNeighbors=[null,null,null,null],this.cornerNeighborCornerTiles=[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],this.cornerNeighborCornerTileSamplerVersions=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],this.edgeResolutions=[-1,-1,-1,-1],this.edgePeerNeighbors=[null,null,null,null],this.edgePeerNeighborSamplerVersions=[-1,-1,-1,-1]}}export{l as GeometryState};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{unique as r}from"../../../core/arrayUtils.js";import{EventEmitter as t}from"../../../core/Evented.js";import"../../../core/has.js";import{someMap as s,everyMap as i}from"../../../core/MapUtils.js";import{disposeMaybe as n}from"../../../core/maybe.js";import o from"../../../core/PooledArray.js";import{watch as a,syncAndInitial as h,on as d,initial as l}from"../../../core/reactiveUtils.js";import{someSet as c}from"../../../core/SetUtils.js";import{property as u,subclass as p}from"../../../core/accessorSupport/decorators.js";import{ortho as _,fromTranslation as g}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{set as m}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{ones as y}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{debugFlags as f}from"../support/debugFlags.js";import{Overlay as R}from"./Overlay.js";import{OverlayRenderTargets as v}from"./OverlayRenderTargets.js";import w from"../webgl/RenderCamera.js";import{SyncRenderPlugin as x}from"../webgl-engine/effects/RenderPlugin.js";import{trackHighlightOptions as T,renderHighlightBuffer as b}from"../webgl-engine/effects/highlight/Highlight.js";import{GLMaterialRepository as S}from"../webgl-engine/lib/GLMaterialRepository.js";import{GridLocalOriginFactory as O}from"../webgl-engine/lib/GridLocalOriginFactory.js";import{RenderContext as D,defaultRenderOccludedMask as C}from"../webgl-engine/lib/RenderContext.js";import{ShadowMap as P}from"../webgl-engine/lib/ShadowMap.js";import{T as j}from"../../../chunks/Texture.glsl.js";import{TextureTechnique as E}from"../webgl-engine/lib/TextureTechnique.js";import{TextureTechniqueConfiguration as F}from"../webgl-engine/lib/TextureTechniqueConfiguration.js";import{AmbientLight as M}from"../webgl-engine/lighting/Lightsources.js";import{O as W}from"../../../chunks/OverlayCompositing.glsl.js";import{OverlayCompositingTechnique as V}from"../webgl-engine/shaders/OverlayCompositingTechnique.js";import{TaskPriority as q}from"../../support/Scheduler.js";import A from"../../webgl/Texture.js";import{TextureDescriptor as G}from"../../webgl/TextureDescriptor.js";let k=class extends x{constructor(e){super(e),this._overlays=null,this._renderTargets=null,this._overlayParameters=new W,this.hasHighlights=!1,this.renderOccludedFlags=1,this._hasWater=!1,this._renderers=new Map,this._sortedDrapeSourceRenderersDirty=!1,this._sortedRenderers=new o,this._passParameters=new j,this._screenToWorldRatio=1,this._localOriginFactory=null,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._camera=new w,this.events=new t,this.longitudeCyclical=null,this.produces=new Map([[18,e=>10!==e||this.hasHighlights],[19,()=>this._hasWater]]),this._hasTargetWithoutRasterImage=!1,this._hasDrapedFeatureSource=!1,this._hasDrapedRasterSource=!1,this._hasDrapedFlowSource=!1;const{state:r,stage:s}=e.parent.view,i=s.renderer.fboCache,n=s.renderView.renderingContext,a=s.renderView.techniques;this._renderContext=new D(n,new P(i,r.viewingMode),a)}initialize(){const e=this._view,r=e.stage.renderView.waterTextures;this.addHandles([a(()=>r.updating,()=>this.events.emit("content-changed"),h),a(()=>this._spatialReference,e=>this._localOriginFactory=new O(e),h),d(()=>e.allLayerViews,"after-changes",()=>this._sortedDrapeSourceRenderersDirty=!0),a(()=>T(e.state.highlights),()=>this._sortedDrapeSourceRenderersDirty=!0,l),a(()=>e.state.highlights,e=>{this._bindParameters.highlights=e},l),e.resourceController.scheduler.registerTask(q.OVERLAY_RENDERER,this)]);const t=this._camera;t.near=1,t.far=1e4,t.relativeElevation=null,this._bindParameters.slot=18,this._bindParameters.camera=t,this._bindParameters.updateLighting(new M(y()),0,0,0)}destroy(){this._renderers.forEach(e=>e.destroy()),this._renderers.clear(),this._passParameters.texture=n(this._passParameters.texture),this.disposeOverlays(),this._renderContext.destroy(),this._sortedRenderers.prune()}get _bindParameters(){return this._renderContext.bind}get _rctx(){return this._stage.renderView.renderingContext}get _view(){return this.parent.view}get _stage(){return this.parent.view.stage}get _spatialReference(){return this.parent.spatialReference}get _techniques(){return this._stage.renderView.techniques}get rctx(){return this._rctx}get materials(){return this._pluginContext.materials}get screenToWorldRatio(){return this._screenToWorldRatio}get localOriginFactory(){return this._localOriginFactory}set time(e){this._renderContext.time=e}get pluginContext(){return this._pluginContext}initializeRenderContext(e){const r=new S(this._view.stage.renderView.textures,this._techniques,()=>{this._onMaterialOrContentChanged(),this.events.emit("content-changed"),this.notifyChange("updating"),this.notifyChange("isEmpty")},()=>this.events.emit("content-changed"));this._pluginContext={...e,materials:r},this._techniques.precompile(V)}uninitializeRenderContext(){}acquireTechniques(){return[]}render(){}get updating(){return this._sortedDrapeSourceRenderersDirty||s(this._renderers,e=>e.updating||e.canCompact)}get hasOverlays(){return null!=this._overlays&&null!=this._renderTargets}getMaterialRenderer(e){for(const r of this._renderers.values()){const t=r.getMaterialRenderer(e);if(t)return t}return null}get layers(){return this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers(),r(this._sortedRenderers.map(e=>e.drapeSource.layer).filter(e=>!!e))}registerDrapeSource(e,r){const t=this._renderers.get(e);null!=t&&t.destroy(),this._renderers.set(e,r),this._sortedDrapeSourceRenderersDirty=!0,"fullOpacity"in e&&this.addHandles(a(()=>e.fullOpacity,()=>this.events.emit("content-changed")),e)}removeDrapeSourceRenderer(e){if(null==e)return;const r=this._renderers.get(e);null!=r&&(this._sortedDrapeSourceRenderersDirty=!0,this._renderers.delete(e),this.removeHandles(e),r.destroy())}computeValidity(){return this._renderTargets?.computeValidity()??0}releaseRenderTargets(e){this._renderTargets?.dispose(e)}get overlays(){return this._overlays??[]}ensureDrapeTargets(e){this._hasTargetWithoutRasterImage=!!this._overlays&&c(e,e=>1===e.drapeTargetType)}ensureDrapeSources(e){this._overlays?(this._hasDrapedFeatureSource=c(e,e=>1===e.drapeSourceType),this._hasDrapedRasterSource=c(e,e=>0===e.drapeSourceType),this._hasDrapedFlowSource=c(e,e=>2===e.drapeSourceType)):this._hasDrapedFeatureSource=this._hasDrapedRasterSource=this._hasDrapedFlowSource=!1}get _needsColorWithoutRasterImage(){return this._hasDrapedRasterSource&&this._hasDrapedFeatureSource&&this._hasTargetWithoutRasterImage}ensureOverlays(e,r,t=this._bindParameters.overlayStretch){null==this._overlays&&(this._renderTargets=new v(this._stage.renderer.fboCache),this._overlays=[new R,new R]),this.ensureDrapeTargets(e),this.ensureDrapeSources(r),this._bindParameters.overlayStretch=t}disposeOverlays(){this._overlays=null,this._renderTargets?.dispose(1),this._renderTargets=null,this.events.emit("textures-disposed")}_useOverlayColorInsteadOfColorNoRasterImage(e){return 1===e&&!this._needsColorWithoutRasterImage&&this._hasDrapedFeatureSource}getTexture(e){const r=this._useOverlayColorInsteadOfColorNoRasterImage(e);return this._renderTargets?.getTexture(r?0:e)}get readyToRun(){return this.updating}runTask(e){this._processDrapeSources(()=>!0,e)}_onMaterialOrContentChanged(){this.renderOccludedFlags=s(this._renderers,e=>e.hasOccluders)?H:1}_processDrapeSources(e,r){let t=!1;for(const[s,i]of this._renderers){if(r?.done)break;(s.destroyed||e(s))&&(i.commitChanges()&&(t=!0,r?.madeProgress()))}this._sortedDrapeSourceRenderersDirty&&(this._sortedDrapeSourceRenderersDirty=!1,t=!0,this._updateSortedDrapeSourceRenderers(),r?.madeProgress()),r&&this.compact(r),t&&(null!=this._overlays&&0===this._renderers.size&&this.disposeOverlays(),this.notifyChange("updating"),this.notifyChange("isEmpty"),this._onMaterialOrContentChanged(),this.hasHighlights=s(this._renderers,e=>e.hasHighlights),this.events.emit("content-changed"))}compact(e){let r=!1;for(const t of this._renderers.values()){if(e.done)break;r=t.compact(e)||r}return r&&this.notifyChange("updating"),r}hasHighlight(e){return s(this._renderers,r=>r.hasHighlight(e))}processSyncDrapeSources(){this._processDrapeSources(e=>1===e.updatePolicy)}get isEmpty(){return!f.OVERLAY_DRAW_DEBUG_TEXTURE&&i(this._renderers,e=>e.isEmpty)}get hasWater(){const e=s(this._renderers,({hasWater:e})=>e);return e!==this._hasWater&&(this._hasWater=e,this.events.emit("has-water")),this._hasWater}renders(e){if(f.OVERLAY_DRAW_DEBUG_TEXTURE&&4!==e&&2!==e)return!0;if(!this._overlays)return!1;const r=this._overlays[0];for(const i of this._overlays)i.setupGeometryViews(this.longitudeCyclical);if(!r.hasSomeSizedView())return!1;const t=this._setOutput(this._renderTargets?.targets.find(r=>r.content===e)?.output??0);++this._techniques.precompiling;const s=this._sortedRenderers.some(({renderer:e})=>e.precompile(this._renderContext));return--this._techniques.precompiling,this._setOutput(t),s}_setOutput(e){const r=this._bindParameters.output;return this._bindParameters.output=e,this._bindParameters.slot=4===e?19:18,r}get mode(){return this.isEmpty?0:this.hasWater&&this.renders(3)?2:this._renderTargets?.getTexture(0)?1:0}updateAnimation(e){let r=!1;return this._renderers.forEach(t=>r=t.updateAnimation(e)||r),r&&this.parent.requestRender(0),r}updateDrapeSourceOrder(){this._sortedDrapeSourceRenderersDirty=!0}precompileShaders(e){if(!this._overlays||!this._renderTargets)return!1;const r=this._bindParameters;r.alignPixelEnabled=e.alignPixelEnabled,++this._techniques.precompiling;for(const t of this._renderTargets.targets){if(1===t.content&&!this._needsColorWithoutRasterImage)continue;const{output:e}=t;this._setOutput(e),10===e&&(r.highlightMixTexture=r.highlights.length>1?this._rctx.emptyTexture:null);const s=this._renderContext.renderOccludedMask;4===t.content&&(this._renderContext.renderOccludedMask=H),this._sortedRenderers.forAll(({drapeSource:e,renderer:r})=>{1===t.content&&0===e.drapeSourceType||4===t.content&&r.hasOnlyOccluders||r.precompile(this._renderContext)}),this._renderContext.renderOccludedMask=s,r.highlightMixTexture=null}return--this._techniques.precompiling,!0}drawOverlays(e,r){if(!this._overlays||!this._renderTargets)return;for(const s of this._overlays)s.setupGeometryViews(this.longitudeCyclical);this._bindParameters.alignPixelEnabled=e.alignPixelEnabled;const t=this.allSourcesOccluders;for(const s of this._renderTargets.targets){if(!(0===s.content&&this._hasDrapedFlowSource)&&!s.handleRenderRequest(r)||1===s.content&&!this._needsColorWithoutRasterImage||4===s.content&&t)continue;const e=this._drawTarget(0,s),i=this._drawTarget(1,s);(e||i)&&s.fbo.generateMipMap()}}_drawTarget(e,r){const t=this._overlays[e],s=t.canvasGeometries;if(0===s.numViews)return!1;const i=this._view.state.contentPixelRatio;this._screenToWorldRatio=i*t.mapUnitsPerPixel/this._bindParameters.overlayStretch;const{output:n,content:o}=r;if(this.isEmpty||4===n&&!this.hasWater||!t.hasSomeSizedView())return!1;const{_rctx:a,_camera:h,_renderContext:d,_bindParameters:l}=this;if(h.pixelRatio=t.pixelRatio*i,this._setOutput(n),l.screenToWorldRatio=this._screenToWorldRatio,l.screenToPCSRatio=this._screenToWorldRatio*this.parent.worldToPCSRatio,4===o&&(d.renderOccludedMask=H),!this.renders(o))return d.renderOccludedMask=C,!1;const{resolution:c}=t,u=0===e,p=u?0:c;a.setViewport(p,0,c,c),this._bindTargetFBO(r),u&&(10===n?a.gl.clearBufferuiv(a.gl.COLOR,0,[0,0,0,0]):(a.setClearColor(0,0,0,0),a.clear(16384)));if(f.OVERLAY_DRAW_DEBUG_TEXTURE&&4!==o&&2!==o){this._techniques.precompile(E,L);const r=this._techniques.get(E,L);for(let i=0;i<s.numViews;i++)this._setViewParameters(s.extents[i],t),this._ensureDebugPatternResources(t.resolution,U[e]),a.bindTechnique(r,l,this._passParameters),a.screen.draw()}if(10===n){const{fboCache:t}=this._stage.renderer,s=this._resolution;this._bindTargetFBO(r),b(a,t,s,s,l,()=>this._renderAllGeometry(e,r),p)}else this._renderAllGeometry(e,r);return a.bindFramebuffer(null),d.renderOccludedMask=C,!0}get allSourcesOccluders(){return i(this._renderers,e=>e.hasOnlyOccluders)}_renderAllGeometry(e,r){const t=this._overlays[e],s=t.canvasGeometries;this._sortedRenderers.forAll(({drapeSource:i,renderer:n})=>{if(1===r.content&&0===i.drapeSourceType)return;const{fullOpacity:o}=i,a=null!=o&&o<1&&0===r.output&&this._bindTemporaryFBO();for(let e=0;e<s.numViews;e++)this._setViewParameters(s.extents[e],t),n.render(this._renderContext);if(a){this._bindTargetFBO(r),this._overlayParameters.texture=a.getTexture(),this._overlayParameters.opacity=o,this._overlayParameters.overlayIndex=e;const t=this._techniques.get(V);this._rctx.bindTechnique(t,this._bindParameters,this._overlayParameters),this._rctx.screen.draw(),a.release()}})}_bindTargetFBO(e){const r=this._resolution,t=2*r;e.fbo.ensureFramebuffer(t,r),e.fbo.bind(this._rctx)}_bindTemporaryFBO(){const e=this._resolution,r=2*e,t=this._stage.renderer.fboCache,s=t.acquire(r,e,"overlay tmp");return t.rctx.bindFramebuffer(s.fbo),t.rctx.clear(16384),s}get _resolution(){return this._overlays?.[0].resolution??0}notifyContentChanged(){this.events.emit("content-changed")}intersectRay(e,r,t,s){this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers();let i=0;for(const{renderer:n}of this._sortedRenderers)i=n.intersect?.(e,r,t,s,i)??i}_updateSortedDrapeSourceRenderers(){if(this._sortedRenderers.clear(),0===this._renderers.size)return;const e=this._view.map.allLayers.map(e=>e.uid),r=e.length;this._renderers.forEach((t,s)=>{const i=e.indexOf(s.layer?.uid),n=i>=0,o=s.renderGroup??(n?0:1),a=s.drapeSourcePriorityOffset??0,h=r*o+(n?i:0)+a;this._sortedRenderers.push(new I(s,t,h))}),this._sortedRenderers.sort((e,r)=>e.index-r.index)}_setViewParameters(e,r){const t=this._camera;t.viewport=[0,0,r.resolution,r.resolution],_(t.projectionMatrix,0,e[2]-e[0],0,e[3]-e[1],t.near,t.far),g(t.viewMatrix,[-e[0],-e[1],0])}_ensureDebugPatternResources(e,r){if(m(this._passParameters.color,r[0],r[1],r[2]),this._passParameters.texture)return;const t=new Uint8Array(e*e*4);let s=0;for(let n=0;n<e;n++)for(let r=0;r<e;r++){const i=Math.floor(r/10),o=Math.floor(n/10);i<2||o<2||10*i>e-20||10*o>e-20?(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=255):(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=1&i&&1&o?1&r^1&n?0:255:1&i^1&o?0:128)}const i=new G(e);i.samplingMode=9728,this._passParameters.texture=new A(this._rctx,i,t)}get test(){}};e([u()],k.prototype,"hasHighlights",void 0),e([u()],k.prototype,"renderOccludedFlags",void 0),e([u()],k.prototype,"_sortedDrapeSourceRenderersDirty",void 0),e([u({constructOnly:!0})],k.prototype,"parent",void 0),e([u({readOnly:!0})],k.prototype,"_techniques",null),e([u({type:Boolean,readOnly:!0})],k.prototype,"updating",null),e([u()],k.prototype,"isEmpty",null),k=e([p("esri.views.3d.terrain.OverlayRenderer")],k);class I{constructor(e,r,t){this.drapeSource=e,this.renderer=r,this.index=t}}const U=[[1,.5,.5],[.5,.5,1]],B=-2,H=4,L=new F;L.hasAlpha=!0;export{k as OverlayRenderer,B as drapedZ,H as overlayRenderOccludedFlag};
|
|
2
|
+
import{__decorate as e}from"tslib";import{unique as r}from"../../../core/arrayUtils.js";import{EventEmitter as t}from"../../../core/Evented.js";import"../../../core/has.js";import{someMap as s,everyMap as i}from"../../../core/MapUtils.js";import{disposeMaybe as n}from"../../../core/maybe.js";import o from"../../../core/PooledArray.js";import{watch as a,syncAndInitial as h,on as d,initial as l}from"../../../core/reactiveUtils.js";import{someSet as c}from"../../../core/SetUtils.js";import{property as u,subclass as p}from"../../../core/accessorSupport/decorators.js";import{ortho as _,fromTranslation as g}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{set as m}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{ones as y}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{debugFlags as f}from"../support/debugFlags.js";import{Overlay as R}from"./Overlay.js";import{OverlayRenderTargets as v}from"./OverlayRenderTargets.js";import w from"../webgl/RenderCamera.js";import{SyncRenderPlugin as x}from"../webgl-engine/effects/RenderPlugin.js";import{trackHighlightOptions as T,renderHighlightBuffer as S}from"../webgl-engine/effects/highlight/Highlight.js";import{GLMaterialRepository as b}from"../webgl-engine/lib/GLMaterialRepository.js";import{GridLocalOriginFactory as O}from"../webgl-engine/lib/GridLocalOriginFactory.js";import{RenderContext as D,defaultRenderOccludedMask as C}from"../webgl-engine/lib/RenderContext.js";import{ShadowMap as P}from"../webgl-engine/lib/ShadowMap.js";import{T as j}from"../../../chunks/Texture.glsl.js";import{TextureTechnique as E}from"../webgl-engine/lib/TextureTechnique.js";import{TextureTechniqueConfiguration as F}from"../webgl-engine/lib/TextureTechniqueConfiguration.js";import{AmbientLight as M}from"../webgl-engine/lighting/Lightsources.js";import{O as W}from"../../../chunks/OverlayCompositing.glsl.js";import{OverlayCompositingTechnique as V}from"../webgl-engine/shaders/OverlayCompositingTechnique.js";import{TaskPriority as q}from"../../support/Scheduler.js";import A from"../../webgl/Texture.js";import{TextureDescriptor as G}from"../../webgl/TextureDescriptor.js";let k=class extends x{constructor(e){super(e),this._overlays=null,this._renderTargets=null,this._overlayParameters=new W,this.hasHighlights=!1,this.renderOccludedFlags=1,this._hasWater=!1,this._renderers=new Map,this._sortedDrapeSourceRenderersDirty=!1,this._sortedRenderers=new o,this._passParameters=new j,this._screenToWorldRatio=1,this._localOriginFactory=null,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._camera=new w,this.events=new t,this.longitudeCyclical=null,this.produces=new Map([[18,e=>10!==e||this.hasHighlights],[19,()=>this._hasWater]]),this._hasTargetWithoutRasterImage=!1,this._hasDrapedFeatureSource=!1,this._hasDrapedRasterSource=!1,this._hasDrapedFlowSource=!1;const{state:r,stage:s}=e.parent.view,i=s.renderer.fboCache,n=s.renderView.renderingContext,a=s.renderView.techniques;this._renderContext=new D(n,new P(i,r.viewingMode),a)}initialize(){const e=this._view,r=e.stage.renderView.waterTextures;this.addHandles([a(()=>r.updating,()=>this.events.emit("content-changed"),h),a(()=>this._spatialReference,e=>this._localOriginFactory=new O(e),h),d(()=>e.allLayerViews,"after-changes",()=>this._sortedDrapeSourceRenderersDirty=!0),a(()=>T(e.state.highlights),()=>this._sortedDrapeSourceRenderersDirty=!0,l),a(()=>e.state.highlights,e=>{this._bindParameters.highlights=e},l),e.resourceController.scheduler.registerTask(q.OVERLAY_RENDERER,this)]);const t=this._camera;t.near=1,t.far=1e4,t.relativeElevation=null,this._bindParameters.slot=18,this._bindParameters.camera=t,this._bindParameters.updateLighting(new M(y()),0,0,0)}destroy(){this._renderers.forEach(e=>e.destroy()),this._renderers.clear(),this._passParameters.texture=n(this._passParameters.texture),this.disposeOverlays(),this._renderContext.destroy(),this._sortedRenderers.prune()}get _bindParameters(){return this._renderContext.bind}get _rctx(){return this._stage.renderView.renderingContext}get _view(){return this.parent.view}get _stage(){return this.parent.view.stage}get _spatialReference(){return this.parent.spatialReference}get _techniques(){return this._stage.renderView.techniques}get rctx(){return this._rctx}get materials(){return this._pluginContext.materials}get screenToWorldRatio(){return this._screenToWorldRatio}get localOriginFactory(){return this._localOriginFactory}set time(e){this._renderContext.time=e}get pluginContext(){return this._pluginContext}initializeRenderContext(e){const r=new b(this._view.stage.renderView.textures,this._techniques,()=>{this._onMaterialOrContentChanged(),this.events.emit("content-changed"),this.notifyChange("updating"),this.notifyChange("isEmpty")},()=>this.events.emit("content-changed"));this._pluginContext={...e,materials:r},this._techniques.precompile(V)}uninitializeRenderContext(){}acquireTechniques(){return[]}render(){}get updating(){return this._sortedDrapeSourceRenderersDirty||s(this._renderers,e=>e.updating||e.canCompact)}get hasOverlays(){return null!=this._overlays&&null!=this._renderTargets}getMaterialRenderer(e){for(const r of this._renderers.values()){const t=r.getMaterialRenderer(e);if(t)return t}return null}get layers(){return this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers(),r(this._sortedRenderers.map(e=>e.drapeSource.layer).filter(e=>!!e))}registerDrapeSource(e,r){const t=this._renderers.get(e);null!=t&&t.destroy(),this._renderers.set(e,r),this._sortedDrapeSourceRenderersDirty=!0,"fullOpacity"in e&&this.addHandles(a(()=>e.fullOpacity,()=>this.events.emit("content-changed")),e)}removeDrapeSourceRenderer(e){if(null==e)return;const r=this._renderers.get(e);null!=r&&(this._sortedDrapeSourceRenderersDirty=!0,this._renderers.delete(e),this.removeHandles(e),r.destroy())}computeValidity(){return this._renderTargets?.computeValidity()??0}releaseRenderTargets(e){this._renderTargets?.dispose(e)}get overlays(){return this._overlays??[]}ensureDrapeTargets(e){this._hasTargetWithoutRasterImage=!!this._overlays&&c(e,e=>1===e.drapeTargetType)}ensureDrapeSources(e){this._overlays?(this._hasDrapedFeatureSource=c(e,e=>1===e.drapeSourceType),this._hasDrapedRasterSource=c(e,e=>0===e.drapeSourceType),this._hasDrapedFlowSource=c(e,e=>2===e.drapeSourceType)):this._hasDrapedFeatureSource=this._hasDrapedRasterSource=this._hasDrapedFlowSource=!1}get _needsColorWithoutRasterImage(){return this._hasDrapedRasterSource&&this._hasDrapedFeatureSource&&this._hasTargetWithoutRasterImage}ensureOverlays(e,r,t=this._bindParameters.overlayStretch){null==this._overlays&&(this._renderTargets=new v(this._stage.renderer.fboCache),this._overlays=[new R,new R]),this.ensureDrapeTargets(e),this.ensureDrapeSources(r),this._bindParameters.overlayStretch=t}disposeOverlays(){this._overlays=null,this._renderTargets?.dispose(1),this._renderTargets=null,this.events.emit("textures-disposed")}_useOverlayColorInsteadOfColorNoRasterImage(e){return 1===e&&!this._needsColorWithoutRasterImage&&this._hasDrapedFeatureSource}getTexture(e){const r=this._useOverlayColorInsteadOfColorNoRasterImage(e);return this._renderTargets?.getTexture(r?0:e)}get readyToRun(){return this.updating}runTask(e){this._processDrapeSources(()=>!0,e)}_onMaterialOrContentChanged(){this.renderOccludedFlags=s(this._renderers,e=>e.hasOccluders)?H:1}_processDrapeSources(e,r){let t=!1;for(const[s,i]of this._renderers){if(r?.done)break;(s.destroyed||e(s))&&(i.commitChanges()&&(t=!0,r?.madeProgress()))}this._sortedDrapeSourceRenderersDirty&&(this._sortedDrapeSourceRenderersDirty=!1,t=!0,this._updateSortedDrapeSourceRenderers(),r?.madeProgress()),r&&this.compact(r),t&&(null!=this._overlays&&0===this._renderers.size&&this.disposeOverlays(),this.notifyChange("updating"),this.notifyChange("isEmpty"),this._onMaterialOrContentChanged(),this.hasHighlights=s(this._renderers,e=>e.hasHighlights),this.events.emit("content-changed"))}compact(e){let r=!1;for(const t of this._renderers.values()){if(e.done)break;r=t.compact(e)||r}return r&&this.notifyChange("updating"),r}hasHighlight(e){return s(this._renderers,r=>r.hasHighlight(e))}processSyncDrapeSources(){this._processDrapeSources(e=>1===e.updatePolicy)}get isEmpty(){return!f.OVERLAY_DRAW_DEBUG_TEXTURE&&i(this._renderers,e=>e.isEmpty)}get hasWater(){const e=s(this._renderers,({hasWater:e})=>e);return e!==this._hasWater&&(this._hasWater=e,this.events.emit("has-water")),this._hasWater}renders(e){if(f.OVERLAY_DRAW_DEBUG_TEXTURE&&4!==e&&2!==e)return!0;if(!this._overlays)return!1;const r=this._overlays[0];for(const i of this._overlays)i.setupGeometryViews(this.longitudeCyclical);if(!r.hasSomeSizedView())return!1;const t=this._setOutput(this._renderTargets?.targets.find(r=>r.content===e)?.output??0);++this._techniques.precompiling;const s=this._sortedRenderers.some(({renderer:e})=>e.precompile(this._renderContext));return--this._techniques.precompiling,this._setOutput(t),s}_setOutput(e){const r=this._bindParameters.output;return this._bindParameters.output=e,this._bindParameters.slot=4===e?19:18,r}get mode(){return this.isEmpty?0:this.hasWater&&this.renders(3)?2:this._renderTargets?.getTexture(0)?1:0}updateAnimation(e){let r=!1;return this._renderers.forEach(t=>r=t.updateAnimation(e)||r),r&&this.parent.requestRender(0),r}updateDrapeSourceOrder(){this._sortedDrapeSourceRenderersDirty=!0}precompileShaders(e){if(!this._overlays||!this._renderTargets)return!1;const r=this._bindParameters;r.alignPixelEnabled=e.alignPixelEnabled,++this._techniques.precompiling;for(const t of this._renderTargets.targets){if(1===t.content&&!this._needsColorWithoutRasterImage)continue;const{output:e}=t;this._setOutput(e),10===e&&(r.highlightMixTexture=r.highlights.length>1?this._rctx.emptyTexture:null);const s=this._renderContext.renderOccludedMask;4===t.content&&(this._renderContext.renderOccludedMask=H),this._sortedRenderers.forAll(({drapeSource:e,renderer:r})=>{1===t.content&&0===e.drapeSourceType||4===t.content&&r.hasOnlyOccluders||r.precompile(this._renderContext)}),this._renderContext.renderOccludedMask=s,r.highlightMixTexture=null}return--this._techniques.precompiling,!0}drawOverlays(e,r){if(!this._overlays||!this._renderTargets)return;for(const s of this._overlays)s.setupGeometryViews(this.longitudeCyclical);this._bindParameters.alignPixelEnabled=e.alignPixelEnabled;const t=this.allSourcesOccluders;for(const s of this._renderTargets.targets){if(!(0===s.content&&this._hasDrapedFlowSource)&&!s.handleRenderRequest(r)||1===s.content&&!this._needsColorWithoutRasterImage||4===s.content&&t)continue;const e=this._drawTarget(0,s),i=this._drawTarget(1,s);(e||i)&&s.fbo.generateMipMap()}}_drawTarget(e,r){const t=this._overlays[e],s=t.canvasGeometries;if(0===s.numViews)return!1;const i=this._view.state.contentPixelRatio;this._screenToWorldRatio=i*t.mapUnitsPerPixel/this._bindParameters.overlayStretch;const{output:n,content:o}=r;if(this.isEmpty||4===n&&!this.hasWater||!t.hasSomeSizedView())return!1;const{_rctx:a,_camera:h,_renderContext:d,_bindParameters:l}=this;if(h.pixelRatio=t.pixelRatio*i,this._setOutput(n),l.screenToWorldRatio=this._screenToWorldRatio,l.screenToPCSRatio=this._screenToWorldRatio*this.parent.worldToPCSRatio,4===o&&(d.renderOccludedMask=H),!this.renders(o))return d.renderOccludedMask=C,!1;const{resolution:c}=t,u=0===e,p=u?0:c;a.setViewport(p,0,c,c),this._bindTargetFBO(r),u&&(10===n?a.gl.clearBufferuiv(a.gl.COLOR,0,[0,0,0,0]):(a.setClearColor(0,0,0,0),a.clear(16384)));if(f.OVERLAY_DRAW_DEBUG_TEXTURE&&4!==o&&2!==o){this._techniques.precompile(E,L);const r=this._techniques.get(E,L);for(let i=0;i<s.numViews;i++)this._setViewParameters(s.extents[i],t),this._ensureDebugPatternResources(t.resolution,U[e]),a.bindTechnique(r,l,this._passParameters),a.screen.draw()}if(10===n){const{fboCache:t}=this._stage.renderer,s=this._resolution;this._bindTargetFBO(r),S(a,t,s,s,l,()=>this._renderAllGeometry(e,r),p)}else this._renderAllGeometry(e,r);return a.bindFramebuffer(null),d.renderOccludedMask=C,!0}get allSourcesOccluders(){return i(this._renderers,e=>e.hasOnlyOccluders)}_renderAllGeometry(e,r){const t=this._overlays[e],s=t.canvasGeometries;this._sortedRenderers.forAll(({drapeSource:i,renderer:n})=>{if(1===r.content&&0===i.drapeSourceType)return;const{fullOpacity:o}=i,a=null!=o&&o<1&&0===r.output&&this._bindTemporaryFBO();for(let e=0;e<s.numViews;e++)this._setViewParameters(s.extents[e],t),n.render(this._renderContext);if(a){this._bindTargetFBO(r),this._overlayParameters.texture=a.getTexture(),this._overlayParameters.opacity=o,this._overlayParameters.overlayIndex=e;const t=this._techniques.get(V);this._rctx.bindTechnique(t,this._bindParameters,this._overlayParameters),this._rctx.screen.draw(),a.release()}})}_bindTargetFBO(e){const r=this._resolution,t=2*r;e.fbo.ensureFramebuffer(t,r),e.fbo.bind(this._rctx)}_bindTemporaryFBO(){const e=this._resolution,r=2*e,t=this._stage.renderer.fboCache,s=t.acquire(r,e,"overlay tmp");return t.rctx.bindFramebuffer(s.fbo),t.rctx.clear(16384),s}get _resolution(){return this._overlays?.[0].resolution??0}notifyContentChanged(){this.events.emit("content-changed")}intersectRay(e,r,t,s){this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers();let i=0;for(const{renderer:n}of this._sortedRenderers)i=n.intersectRay?.(e,r,t,s,i)??i}*intersectScreenPolygon(e,r,t){this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers();let s=0;for(const{renderer:i}of this._sortedRenderers)s=yield*i.intersectScreenPolygon(e,r,t,s)}_updateSortedDrapeSourceRenderers(){if(this._sortedRenderers.clear(),0===this._renderers.size)return;const e=this._view.map.allLayers.map(e=>e.uid),r=e.length;this._renderers.forEach((t,s)=>{const i=e.indexOf(s.layer?.uid),n=i>=0,o=s.renderGroup??(n?0:1),a=s.drapeSourcePriorityOffset??0,h=r*o+(n?i:0)+a;this._sortedRenderers.push(new I(s,t,h))}),this._sortedRenderers.sort((e,r)=>e.index-r.index)}_setViewParameters(e,r){const t=this._camera;t.viewport=[0,0,r.resolution,r.resolution],_(t.projectionMatrix,0,e[2]-e[0],0,e[3]-e[1],t.near,t.far),g(t.viewMatrix,[-e[0],-e[1],0])}_ensureDebugPatternResources(e,r){if(m(this._passParameters.color,r[0],r[1],r[2]),this._passParameters.texture)return;const t=new Uint8Array(e*e*4);let s=0;for(let n=0;n<e;n++)for(let r=0;r<e;r++){const i=Math.floor(r/10),o=Math.floor(n/10);i<2||o<2||10*i>e-20||10*o>e-20?(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=255):(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=1&i&&1&o?1&r^1&n?0:255:1&i^1&o?0:128)}const i=new G(e);i.samplingMode=9728,this._passParameters.texture=new A(this._rctx,i,t)}get test(){}};e([u()],k.prototype,"hasHighlights",void 0),e([u()],k.prototype,"renderOccludedFlags",void 0),e([u()],k.prototype,"_sortedDrapeSourceRenderersDirty",void 0),e([u({constructOnly:!0})],k.prototype,"parent",void 0),e([u({readOnly:!0})],k.prototype,"_techniques",null),e([u({type:Boolean,readOnly:!0})],k.prototype,"updating",null),e([u()],k.prototype,"isEmpty",null),k=e([p("esri.views.3d.terrain.OverlayRenderer")],k);class I{constructor(e,r,t){this.drapeSource=e,this.renderer=r,this.index=t}}const U=[[1,.5,.5],[.5,.5,1]],B=-2,H=4,L=new F;L.hasAlpha=!0;export{k as OverlayRenderer,B as drapedZ,H as overlayRenderOccludedFlag};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{clamp as t,isPowerOfTwo as e}from"../../../core/mathUtils.js";import{maxUint16 as n}from"../../../core/typedArrayUtil.js";import{empty as o}from"../../../geometry/support/aaBoundingBox.js";import{fromValues as s}from"../../../geometry/support/aaBoundingRect.js";import{sampleElevation as r,sampleSingleElevation as i}from"./ElevationData.js";import{PatchGeometryLUT as a}from"./PatchGeometryLUT.js";import{zeroToFour as c,neighborTileIfLoadedOrSelf as l}from"./PatchRenderData.js";import{maxPatchTesselation as u,elevationNoDataValue as d}from"./TerrainConst.js";import{internalAssert as f,enableTerrainInternalChecks as m,neighborEdgeIndices as g,almostEquals as h}from"./terrainUtils.js";import{isCornerNeighbor as p}from"./Tile.js";import{compareTilesByLij as x}from"./tileUtils.js";import{compressNormal as M}from"../webgl-engine/lib/Normals.js";const y=65536;function S(t,e){const{tile:n,geometry:s,geometryState:r}=t,{extentInRadians:i,surface:a}=n,{isWebMercator:c,renderer:l}=a,{numVerticesPerSide:u,wireframe:d}=r,f=u-1,m=(u-2)**2,g=c&&(2===e||3===e),h=c&&(1===e||3===e),p=((g?1:0)+(h?1:0))*It*u,x=vt(r),M=m+p+4*x,y=l.tileGeometryCache.acquire(M);s.numVerticesPerSide=u,s.vertexAttributes=y,s.maxEdgeVertexCount=x;const{boundingBox:S}=s;o(S);const B=O(t);ct.update(f,i,B),v(t),s.poleVerticesStartIndex=m;const V=L(t,g,h);s.edgeVerticesStartIndex=m+p,_(t),C(t),J(s,V,d),t.intersectionData=null}function L(t,e,o){const{tile:s,localOrigin:r,geometry:i}=t,{extent:a,ellipsoid:c}=s,{boundingBox:l,numVerticesPerSide:u,vertexAttributes:d,poleVerticesStartIndex:f}=i,m=u-1,g=r[0],h=r[1],p=r[2],x=c.radius,y=a[1],S=a[3],L=[];let v=f;const B=(t,e)=>{const o=e*u;Lt(-g,-h,t*x-p,l),L.push(new it(1===t,o,1===t?0:2,v,It));const s=D(-1===t?y:S,x),r=t*Math.PI/2-s,i=.99*(1===t?1:-1),a=x+0,{position:c,uv0:f}=d,{typedBuffer:B,typedBufferStride:V}=d.normalCompressed;for(let u=1;u<=It;++u){const t=s+r*(u/It),e=Math.cos(t),o=Math.sin(t);for(let s=0;s<=m;s++){const t=s/m,r=ct.sinLonLUT[s],u=ct.cosLonLUT[s]*e,d=r*e,x=o,y=u*a-g,S=d*a-h,L=x*a-p;Lt(y,S,L,l),c.setValues(v,y,S,L),f.setValues(v,Math.round(t*n),Math.round(i*n)),M(B,v,u,d,x,V),++v}}};return e&&B(-1,0),o&&B(1,m),L}function v(t){const e=t.geometryState.samplerData,n=1===e?.length?e[0]:null;n?B(t,n):V(t)}function B(t,e){const{tile:n}=t;if(!n.intersectsClippingArea)return;const{geometry:o,geometryState:s,localOrigin:r}=t,{numVerticesPerSide:i}=s,a=i-2,c=i-1,{vertexAttributes:l,boundingBox:u}=o,{position:d,uv0:f}=l,{typedBuffer:m,typedBufferStride:g}=l.normalCompressed,{extent:h}=n,p=n.ellipsoid.radius,x=r[0],y=r[1],S=r[2],L=d.typedBuffer,v=d.typedBufferStride,B=f.typedBuffer,V=f.typedBufferStride;I(c,h,e);let T=0;const U=e.data.values;if(1<=a){const t=ut[1],e=ct.sinLatLUT[1],n=ct.cosLatLUT[1];for(let o=1;o<=a;o++){const s=ct.sinLonLUT[o],r=ct.cosLonLUT[o],i=p+b(o,1,U),a=i*r*n-x,c=i*s*n-y,l=i*e-S;Lt(a,c,l,u);const d=(o-1)*v;L[d]=a,L[d+1]=c,L[d+2]=l;const f=(o-1)*V;B[f]=ut[o],B[f+1]=t}}for(let I=1;I<=a;I++){const t=ct.sinLatLUT[I],e=ct.cosLatLUT[I],n=I+1,o=ut[n],s=ct.sinLatLUT[n],r=ct.cosLatLUT[n],i=ct.sinLonLUT[0],l=ct.cosLonLUT[0],d=p+b(0,I,U);let f=l*e*d-x,h=i*e*d-y,C=t*d-S;const A=T*v;let P=L[A],D=L[A+1],E=L[A+2];for(let w=1;w<=a;w++){const i=ct.sinLonLUT[w],l=ct.cosLonLUT[w];let d=0,A=0,O=0;if(w<a){const t=(T+1)*v;d=L[t],A=L[t+1],O=L[t+2]}else{const n=ct.sinLonLUT[c],o=ct.cosLonLUT[c],s=p+b(c,I,U);d=o*e*s-x,A=n*e*s-y,O=t*s-S}const R=f,N=h,j=C;f=P,h=D,C=E,P=d,D=A,E=O;const F=d-R,q=A-N,W=O-j;let k=0,z=0,G=0;if(I>1){const t=(T-a)*v;k=L[t],z=L[t+1],G=L[t+2]}else{const t=ct.sinLatLUT[0],e=ct.cosLatLUT[0],n=p+b(w,0,U);k=l*e*n-x,z=i*e*n-y,G=t*n-S}const H=p+b(w,n,U),J=l*r*H-x,K=i*r*H-y,Q=s*H-S;if(I<a){const t=T+a,e=t*v;L[e]=J,L[e+1]=K,L[e+2]=Q,Lt(J,K,Q,u);const n=t*V;B[n]=ut[w],B[n+1]=o}const X=k-J,Y=z-K,Z=G-Q;let $=l*e,_=i*e,tt=t;tt*tt<.999&&($=W*Y-q*Z,_=F*Z-W*X,tt=q*X-F*Y);const et=1/Math.sqrt($*$+_*_+tt*tt);M(m,T,$*et,_*et,tt*et,g),++T}}}function V(t){const{tile:e}=t;if(!e.intersectsClippingArea)return;const{geometry:o,geometryState:s,localOrigin:i}=t,{numVerticesPerSide:a,samplerData:c}=s,l=a-2,u=a-1,{vertexAttributes:d,boundingBox:f}=o,{position:m,uv0:g}=d,{typedBuffer:h,typedBufferStride:p}=d.normalCompressed,{extent:x}=e,y=x[0],S=x[2],L=x[1],v=x[3],B=e.ellipsoid.radius,V=i[0],I=i[1],b=i[2],T=m.typedBuffer,U=m.typedBufferStride,C=1/u;let A=0;if(1<=l){const t=C,e=L*(1-t)+v*t,o=ct.sinLatLUT[1],s=ct.cosLatLUT[1];for(let i=1;i<=l;i++){const a=i*C,l=y*(1-a)+S*a,u=ct.sinLonLUT[i],d=ct.cosLonLUT[i],m=B+r(l,e,c),h=m*d*s-V,p=m*u*s-I,x=m*o-b;Lt(h,p,x,f);const M=(i-1)*U;T[M]=h,T[M+1]=p,T[M+2]=x,g.setValues(i-1,Math.round(a*n),Math.round(t*n))}}for(let P=1;P<=l;P++){const t=P*C,e=L*(1-t)+v*t,o=ct.sinLatLUT[P],s=ct.cosLatLUT[P],i=P+1,a=i*C,d=L*(1-a)+v*a,m=ct.sinLatLUT[i],x=ct.cosLatLUT[i],D=ct.sinLonLUT[0],E=ct.cosLonLUT[0],w=B+r(y,e,c);let O=E*s*w-V,R=D*s*w-I,N=o*w-b;const j=A*U;let F=T[j],q=T[j+1],W=T[j+2];for(let v=1;v<=l;v++){const t=v*C,i=y*(1-t)+S*t,D=ct.sinLonLUT[v],E=ct.cosLonLUT[v];let w=0,j=0,k=0;if(v<l){const t=(A+1)*U;w=T[t],j=T[t+1],k=T[t+2]}else{const t=ct.sinLonLUT[u],n=ct.cosLonLUT[u],i=B+r(S,e,c);w=n*s*i-V,j=t*s*i-I,k=o*i-b}const z=O,G=R,H=N;O=F,R=q,N=W,F=w,q=j,W=k;const J=w-z,K=j-G,Q=k-H;let X=0,Y=0,Z=0;if(P>1){const t=(A-l)*U;X=T[t],Y=T[t+1],Z=T[t+2]}else{const t=ct.sinLatLUT[0],e=ct.cosLatLUT[0],n=B+r(i,L,c);X=E*e*n-V,Y=D*e*n-I,Z=t*n-b}const $=B+r(i,d,c),_=E*x*$-V,tt=D*x*$-I,et=m*$-b;if(P<l){const e=A+l,o=e*U;T[o]=_,T[o+1]=tt,T[o+2]=et,Lt(_,tt,et,f),g.setValues(e,Math.round(t*n),Math.round(a*n))}const nt=X-_,ot=Y-tt,st=Z-et;let rt=E*s,it=D*s,at=o;at*at<.999&&(rt=Q*ot-K*st,it=J*st-Q*nt,at=K*nt-J*ot);const lt=1/Math.sqrt(rt*rt+it*it+at*at);M(h,A,rt*lt,it*lt,at*lt,p),++A}}}function I(e,o,s){const r=o[0],i=o[2],a=o[1],c=o[3],l=1/e,{dx:u,dy:d,x0:f,y1:m,safeWidth:g}=s,h=s.data.width;for(let p=0;p<=e;p++){const e=p*l,o=t(u*(r*(1-e)+i*e-f),0,g),s=Math.floor(o);dt[p]=s,gt[p]=o-s;const x=t(d*(m-(a*(1-e)+c*e)),0,g),M=Math.floor(x);ft[p]=M*h,mt[p]=(M+1)*h,ht[p]=x-M,ut[p]=Math.round(e*n)}}function b(t,e,n){const o=dt[t],s=gt[t],r=ft[e],i=mt[e],a=ht[e],c=r+o,l=n[c],u=n[c+1],d=n[i+o],f=n[i+o+1];if(l+d+u+f>=lt)return 0;const m=l+(u-l)*s;return m+(d+(f-d)*s-m)*a}function T(t){t.tile.intersectsClippingArea&&(C(t),st(t),t.intersectionData=null)}function U(t){t.tile.intersectsClippingArea&&(tt(t),C(t),st(t),rt(t),t.intersectionData=null)}function C(t){t.tile.intersectsClippingArea&&(P(t),A(t))}function A(t){const{geometry:o,geometryState:s,tile:a,localOrigin:c}=t,{level:u,extent:d,extentInRadians:p,ellipsoid:y}=a,S=y.radius,L=p[0],v=p[2],B=p[1],V=p[3],{samplerData:I}=s,b=d[0],T=d[2],U=d[1],C=d[3],A=O(t),{boundingBox:P,vertexAttributes:D}=o,E=c[0],w=c[1],R=c[2],{position:N,uv0:j}=D,F=N.typedBuffer,q=N.typedBufferStride,W=j.typedBuffer,k=j.typedBufferStride,{typedBuffer:z,typedBufferStride:G}=D.normalCompressed,H=1===I?.length?I[0]:null,J=(t,e,n)=>H?i(t,e,H)??0:r(t,e,I)??0;for(let O=0;O<4;++O){const c=1===O||3===O,p=s.edgeResolutions[O];f(e(p));const y=p+1,D=l(a,s.edgePeerNeighbors[O]);if(Mt(a,D,O)){et(t,O,D);continue}const N=null!=D;f(!N||D.level===a.level),f(!N||x(a,D)<=0);const j=D?.renderData,K=j?.geometryState;if(m){const t=a.surface;if(!D&&t&&!t.updatingRootTiles){const e=g[O],n=a.findNeighborTile(e,t=>t.loaded||t.leaf||t.level===a.level);n?n.intersectsClippingArea&&(f(!n.loaded),f(!n.leaf),f(n.level===u)):f(null==t?.rootTiles||!a.shouldHaveNeighbor(e))}}const Q=1===O?d[2]:d[0],X=D?.extent,Y=X&&c?1===O?X[0]:X[2]:Q,Z=0===O?d[3]:d[1],$=1===O?1:0,_=0===O?1:0,tt=1===O?v:L,nt=0===O?V:B,ot=Math.sin(tt),st=Math.cos(tt),rt=Math.sin(nt),it=Math.cos(nt),at=K?.samplerData,ct=1===at?.length?at[0]:null,lt=(t,e,n)=>ct?i(n,e,ct)??0:r(n,e,at)??0,ut=N?(t,e,n)=>.5*(J(t,e)+lt(t,e,n)):J,dt=o.outerEdgesOffsetAndLength[2*O+0],ft=null!=H||null!=I&&I.some(t=>null!=t),mt=null!=ct||null!=at&&at.some(t=>null!=t),gt=ft||mt,ht=1/p,pt=n*ht,xt=$*n,yt=_*n,St=dt;f(!X||h(X[2]-X[0],d[2]-d[0]));(()=>{const t=1===O?-1:3===O?1:0,e=0===O?-1:2===O?1:0,n=(d[2]-d[0])*ht,o=t*n,s=e*n,a=c?t*((v-L)*ht):0,l=c?0:e*ht,u=_,f=c?tt+a:tt,m=c?Math.sin(f):ot,g=c?Math.cos(f):st,h=c?tt-a:tt,p=c?Math.sin(h):ot,x=c?Math.cos(h):st,B=c?nt:A(u+l),V=c?rt:Math.sin(B),D=c?it:Math.cos(B),j=c?nt:A(u-l),J=c?rt:Math.sin(j),K=c?it:Math.cos(j);let X=0,$=0,et=0;{const t=0*ht,e=c?Q:b*(1-t)+T*t,n=c?Y:e,o=c?U*(1-t)+C*t:Z,s=c?tt:L*(1-t)+v*t,r=c?ot:Math.sin(s),i=c?st:Math.cos(s),a=c?A(t):nt,l=c?Math.sin(a):rt,u=c?Math.cos(a):it,d=S+ut(e,o,n);X=i*u*d,$=r*u*d,et=l*d}let lt=0,dt=0,ft=0;{const t=1*ht,e=c?Q:b*(1-t)+T*t,n=c?Y:e,o=c?U*(1-t)+C*t:Z,s=c?tt:L*(1-t)+v*t,r=c?ot:Math.sin(s),i=c?st:Math.cos(s),a=c?A(t):nt,l=c?Math.sin(a):rt,u=c?Math.cos(a):it,d=S+ut(e,o,n);lt=i*u*d,dt=r*u*d,ft=l*d}for(let d=1;d<y-1;++d){let t=0,e=0,n=0;{const o=(d+1)*ht,s=c?Q:b*(1-o)+T*o,r=c?Y:s,i=c?U*(1-o)+C*o:Z,a=c?tt:L*(1-o)+v*o,l=c?ot:Math.sin(a),u=c?st:Math.cos(a),f=c?A(o):nt,m=c?Math.sin(f):rt,g=c?Math.cos(f):it,h=S+ut(s,i,r);t=u*g*h,e=l*g*h,n=m*h}const a=t,l=e,u=n,f=lt,h=dt,y=ft;lt=a,dt=l,ft=u;{const t=St+d,e=t*q,n=f-E,o=h-w,s=y-R;F[e]=n,F[e+1]=o,F[e+2]=s,Lt(n,o,s,P);const r=Math.round(d*pt),i=t*k;W[i]=c?xt:r,W[i+1]=c?r:yt}const B=X,j=$,_=et;X=f,$=h,et=y;const mt=f,Mt=h,vt=y,Bt=1/Math.sqrt(mt*mt+Mt*Mt+vt*vt),Vt=vt*Bt;let It=0,bt=0,Tt=0;if(gt&&Vt*Vt<.999){let t=0,e=0,n=0;{const o=0===O?-1:1;t=o*(a-B),e=o*(l-j),n=o*(u-_)}{const a=d*ht,l=c?Q:b*(1-a)+T*a,u=c?Y:l,f=c?U*(1-a)+C*a:Z,h=c?tt:L*(1-a)+v*a,M=c?ot:Math.sin(h),y=c?st:Math.cos(h),B=c?A(a):nt,P=c?Math.sin(B):rt,E=c?Math.cos(B):it;let w=mt,R=Mt,j=vt;if(N){const t=u-o,e=f-s,n=S+(ct?i(t,e,ct)??0:r(t,e,at)??0),a=c?E:K;w=(c?x:y)*a*n,R=(c?p:M)*a*n,j=(c?P:J)*n}{const a=l+o,u=f+s,d=S+(H?i(a,u,H)??0:r(a,u,I)??0),h=c?E:D,p=(c?g:y)*h*d,x=(c?m:M)*h*d,L=(c?P:V)*d;N||(w=2*mt-p,R=2*Mt-x,j=2*vt-L);const v=3===O?-1:1,B=v*(w-p),b=v*(R-x),T=v*(j-L);It=n*b-e*T,bt=t*T-n*B,Tt=e*B-t*b;const U=1/Math.sqrt(It*It+bt*bt+Tt*Tt);It*=U,bt*=U,Tt*=U}}}else It=mt*Bt,bt=Mt*Bt,Tt=vt*Bt;M(z,St+d,It,bt,Tt,G)}})()}}function P(t){nt(t)}function D(t,e){return Math.PI/2-2*Math.atan(Math.exp(-t/e))}function E(t,e,n,o){return D(t*(1-o)+e*o,n)}function w(t,e,n){return t*(1-n)+e*n}function O(t){const{tile:e}=t;if(e.surface.isWebMercator){const t=e.extent,n=e.ellipsoid.radius;return e=>E(t[1],t[3],n,e)}const n=e.extentInRadians;return t=>w(n[1],n[3],t)}function R(t){const{tile:e,geometryState:n,geometry:s}=t,{extent:r,surface:i}=e,{wireframe:a}=n,c=r[0],l=r[1],u=r[2]-c,d=r[3]-l,{numVerticesPerSide:f,clippingArea:m}=n,g=null!=m?Math.max(0,(m[0]-c)/u):0,h=null!=m?Math.max(0,(m[1]-l)/d):0,p=null!=m?Math.min(1,(m[2]-c)/u):1,x=null!=m?Math.min(1,(m[3]-l)/d):1,M=(f-2)**2,y=vt(n),S=M+4*y,L=i.renderer.tileGeometryCache.acquire(S),{boundingBox:v}=s;o(v),s.numVerticesPerSide=f,s.vertexAttributes=L,s.maxEdgeVertexCount=y,s.minu=g,s.minv=h,s.maxu=p,s.maxv=x,N(t),s.edgeVerticesStartIndex=M,_(t),q(t),J(s,[],a),t.intersectionData=null}function N(e){const o=e.tile;if(!o.intersectsClippingArea)return;const{geometry:s,geometryState:a,localOrigin:c}=e,{samplerData:l,clippingArea:u,numVerticesPerSide:d}=a,{surface:f,extent:m,ellipsoid:g}=o,{isWebMercatorOnPlateCarree:h}=f,p=null!=u?u:pt,x=m[0],y=m[1],S=m[2],L=m[3],v=Math.max(x,p[0]),B=Math.min(S,p[2]),V=Math.max(y,p[1]),I=Math.min(L,p[3]),b=g.radius,T=o.horizontalScale,U=d-1,C=d-2,{minu:A,minv:P,maxu:D,maxv:E,boundingBox:w,vertexAttributes:O}=s,{position:R,uv0:N}=O,{typedBuffer:j,typedBufferStride:F}=O.normalCompressed,q=c[0],W=c[1],k=c[2],z=R.typedBuffer,G=R.typedBufferStride;let H=0;const J=t(y,V,I),K=h?(Math.PI/2-2*Math.atan(Math.exp(-J/b)))*b:J*T,Q=1/U,X=t(y*(1-Q)+L*Q,V,I);let Y=K,Z=h?(Math.PI/2-2*Math.atan(Math.exp(-X/b)))*b:X*T;const $=1===l?.length?l[0]:null,_=$?(t,e)=>i(t,e,$)??0:(t,e)=>r(t,e,l)??0;for(let r=1;r<=C;r++){const e=r/U,o=t(y*(1-e)+L*e,V,I),s=t(e,P,E),i=Z,a=(r-1)/U,c=t(y*(1-a)+L*a,V,I),l=Y,u=(r+1)/U,d=t(y*(1-u)+L*u,V,I),f=h?(Math.PI/2-2*Math.atan(Math.exp(-d/b)))*b:d*T,m=t(u,P,E);Y=Z,Z=f;const g=t(x,v,B);let p=g*T,O=_(g,o);const R=1/U,J=t(R,A,D),K=t(x*(1-J)+S*J,v,B);let Q=J,X=K,$=K*T,tt=_(K,o);if(1===r){const e=$-q,o=Y-W,r=tt-k,i=0*G;z[i]=e,z[i+1]=o,z[i+2]=r,Lt(e,o,r,w);const a=t(R,A,D);N.setValues(H,Math.round(a*n),Math.round(s*n))}for(let h=1;h<=C;h++){const e=$,a=tt,u=(h+1)/U,g=t(u,A,D),y=t(x*(1-u)+S*u,v,B),L=X;X=y;{const t=H+1,e=t*G;if(1===r||h===C){const a=y*T,c=_(y,o);if(1===r&&h<C){const o=a-q,r=i-W,l=c-k;z[e]=o,z[e+1]=r,z[e+2]=l,Lt(o,r,l,w),N.setValues(t,Math.round(g*n),Math.round(s*n))}$=a,tt=c}else $=z[e]+q,tt=z[e+2]+k}const V=$,I=tt,b=p,P=O;p=e,O=a;const E=(H-C)*G,R=1===r?_(L,c):z[E+2]+k,J=_(L,d);if(r<C){const t=H+C,o=t*G,s=e-q,r=f-W,i=J-k;z[o]=s,z[o+1]=r,z[o+2]=i,Lt(s,r,i,w);const a=Q;Q=g,N.setValues(t,Math.round(a*n),Math.round(m*n))}{const t=V-b,e=l-f,n=e*(I-P),o=t*(R-J),s=-e*t,r=n*n+o*o+s*s;if(0===r)M(j,H,0,0,1,F);else{const t=1/Math.sqrt(r);M(j,H,n*t,o*t,s*t,F)}}++H}}}function j(t){t.tile.intersectsClippingArea&&(tt(t),q(t),st(t),rt(t),t.intersectionData=null)}function F(t){t.tile.intersectsClippingArea&&(q(t),st(t),t.intersectionData=null)}function q(t){t.tile.intersectsClippingArea&&(k(t),W(t))}function W(n){const{geometry:o,geometryState:s,localOrigin:a}=n,c=n.tile,{surface:u,extent:d}=c,{clippingArea:h,samplerData:p}=s,M=null!=h?h:pt,y=d[0],S=d[2],L=d[1],v=d[3],B=[v>M[3],S>M[2],L<M[1],y<M[0]],V=c.horizontalScale,I=H(u.isWebMercatorOnPlateCarree,c.ellipsoid.radius,V),{minu:b,minv:T,maxu:U,maxv:C,boundingBox:A}=o,P=Math.max(y,M[0]),D=Math.min(S,M[2]),E=Math.max(L,M[1]),w=Math.min(v,M[3]),O=a[0],R=a[1],N=a[2],j=1===p?.length?p[0]:void 0,F=j?(t,e)=>i(t,e,j)??0:(t,e)=>r(t,e,p)??0;for(let q=0;q<4;++q){const a=1===q||3===q,d=s.edgeResolutions[q];f(e(d));const h=d+1,M=B[q],j=l(c,s.edgePeerNeighbors[q]);if(!M&&Mt(c,j,q)){et(n,q,j);continue}const W=null!=j&&!M,k=j?.renderData,z=k?.geometryState;if(m&&(f(!W||j.level===c.level),f(!W||x(c,j)<=0),c&&!j&&!u.updatingRootTiles)){const t=g[q],e=c.findNeighborTile(t,t=>t.loaded||t.leaf||t.level===c.level);u.updatingRootTiles||(e?e.intersectsClippingArea&&(f(!e.loaded),f(!e.leaf),f(e.level===c.level)):f(null==u?.rootTiles||!c.shouldHaveNeighbor(t)))}const G=t(1===q?S:y,P,D),H=t(0===q?v:L,E,w),J=z?.samplerData,K=t(1===q?1:0,b,U),Q=t(0===q?1:0,T,C),X=1===J?.length?J[0]:null,Y=(t,e)=>X?i(t,e,X)??0:r(t,e,J)??0,Z=W?(t,e)=>.5*(Y(t,e)+F(t,e)):F,$=(S-y)/d,_=a?1===q?$:-$:0,tt=a?0:0===q?$:-$,nt=-_,ot=-tt;let st=0,rt=0,it=0;{const e=0/d,n=a?G:t(y*(1-e)+S*e,P,D),o=a?t(L*(1-e)+v*e,E,w):H,s=Z(n,o);st=n*V,rt=I(o),it=s}let at=0,ct=0,lt=0;{const e=1/d,n=a?G:t(y*(1-e)+S*e,P,D),o=a?t(L*(1-e)+v*e,E,w):H,s=Z(n,o);at=n*V,ct=I(o),lt=s}for(let e=1;e<h-1;++e){const n=e/d,s=at,i=ct,c=lt;{const r=a?K:t(n,b,U),l=a?t(n,T,C):Q,u=s-O,d=i-R,f=c-N;Lt(s,d,f,A),o.setEdgeVertexFromValuesRawPositionUV(q,e,u,d,f,r,l)}{const n=(e+1)/d,o=a?G:t(y*(1-n)+S*n,P,D),s=a?t(L*(1-n)+v*n,E,w):H,r=Z(o,s);at=o*V,ct=I(s),lt=r}const l=at,u=lt,f=st,m=rt,g=it;st=s,rt=i,it=c;let h=0,x=0,M=0;if(a){const e=ct-i,o=u-c,a=m-i,l=g-c,d=t(L*(1-n)+v*n,E,w),f=G+nt,y=f*V-s,S=r(f,d,p)-c,B=3===q?-1:1;if(h=B*(-a+e)*S,x=B*y*(-l+o),M=-B*y*(-a+e),W){const t=G+_,n=t*V-s;h=(-a+e)*(S-(r(t,d,J)-c)),x=(y-n)*(-l+o),M=-(y-n)*(-a+e)}}else{const e=l-s,o=u-c,a=f-s,d=g-c,m=t(y*(1-n)+S*n,P,D),L=H+ot,v=r(m,L,p)-c,B=I(L)-i,V=2===q?-1:1;if(h=V*B*(-d+o),x=V*(-a+e)*v,M=-V*B*(-a+e),W){const t=m,n=H+tt,s=I(n)-i;h=(-B+s)*(-d+o),x=(-a+e)*(-v+(r(t,n,J)-c)),M=-(-B+s)*(-a+e)}}const B=1/Math.sqrt(h*h+x*x+M*M);o.setEdgeNormalFromValues(q,e,h*B,x*B,M*B)}}}function k(t){nt(t)}function z(t,e){return(Math.PI/2-2*Math.atan(Math.exp(-t/e)))*e}function G(t,e){return t*e}function H(t,e,n){return t?t=>z(t,e):t=>G(t,n)}function J(t,e,n){const{numVerticesPerSide:o,vertexAttributes:s,maxEdgeVertexCount:r}=t,i=o-1,a=s.count,l=2*(o-3)*(o-3),u=4*(i+r-3),d=c.reduce((e,n)=>e+(i+t.getEdgeCount(n)-3),0),f=e.reduce((t,e)=>t+i*(2*(e.latitudeResolution-1)+1),0),m=3*(n?2:1),g=(l+u+f)*m,h=a>=y?new Uint32Array(g):new Uint16Array(g);for(let c=0;c<g;++c)h[c]=0;t.indices=h,t.indexCount=(l+d+f)*m,t.poleIndicesStartIndex=l*m,t.edgeIndicesStartIndex=(l+f)*m,n?(Y(t),Z(t,e),$(t)):(K(t),Q(t,e),X(t))}function K(t){const{numVerticesPerSide:e,indices:n,vertexAttributes:o}=t,{position:s}=o,{typedBuffer:r,typedBufferStride:i}=s,a=e-2,c=e-3,l=0,u=e-3;let d=0;for(let f=0;f<c;++f){const t=f*a;for(let e=l;e<u;++e){const o=t+e,s=o+1,c=s+a,l=c-1;Bt(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 Q(t,e){const{numVerticesPerSide:n,indices:o,poleIndicesStartIndex:s}=t,r=n-1;let i=s;for(const a of e){const e=a.isNorth?1:2,s=a.isNorth?2:1,c=a.isNorth?3:4,l=a.isNorth?4:3;let u=t.getEdgeVertexIndex(a.connectedOuterEdgeOffset,0),d=1;for(let t=0;t<a.latitudeResolution;++t){const f=0===t?a.rowOffset:u+n;for(let n=0;n<r;n++){const r=f+n;o[i]=u,o[i+e]=u+1,o[i+s]=r,t<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 X(t){const{indices:e,numVerticesPerSide:n,edgeIndicesStartIndex:o}=t,s=n-1,r=s-2;let i=o;for(let a=0;a<4;++a){const n=St[a];let o=0,c=0;const l=t.getEdgeCount(a),u=n.count;f(u===s-1);const d=1===a||2===a,m=d?1:2,g=d?2:1,h=t.getEdgeFirstVertexIndex(a),p=1,x=n.vertex0Index,M=n.stride;for(;o<l-1||c<u-1;){const t=x+c*M,n=h+o*p,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 y=f?n+p:t+M;e[i]=t,e[i+m]=n,e[i+g]=y,i+=3}}t.indexCount=i}function Y(t){const{indices:e,numVerticesPerSide:n,vertexAttributes:o}=t,{position:s}=o,{typedBuffer:r,typedBufferStride:i}=s,a=n-2;let c=0;for(let l=0;l<n-3;++l){const t=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=t+o,m=f+1,g=m+a;Bt(f,m,g,g-1,i,r)?(Vt(e,c,n,s,u),c+=6,Vt(e,c,u,d,n)):(Vt(e,c,n,s,d),c+=6,Vt(e,c,d,u,s)),c+=6}}}function Z(t,e){const{indices:n,numVerticesPerSide:o,poleIndicesStartIndex:s}=t,r=o-1;let i=s;for(const a of e){const e=a.connectedOuterEdgeOffset;let s=t.getEdgeVertexIndex(e,0),c=1;for(let t=0;t<a.latitudeResolution;++t){const e=0===t?a.rowOffset:s+o;for(let o=0;o<r;o++)Vt(n,i,s,s+1,e+o),i+=6,t<a.latitudeResolution-1&&(Vt(n,i,s+1,e+o+1,e+o),i+=6),s+=c;s=e,c=1}}}function $(t){const{indices:e,numVerticesPerSide:n,edgeIndicesStartIndex:o}=t,s=n-1,r=s-2;let i=o;for(let a=0;a<4;++a){const n=St[a];let o=0,c=0;const l=t.getEdgeCount(a),u=n.count;f(u===s-1);const d=1===a||2===a,m=d?1:3,g=d?3:1,h=t.getEdgeFirstVertexIndex(a),p=1,x=n.vertex0Index,M=n.stride;for(;o<l-1||c<u-1;){const t=x+c*M,n=h+o*p,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 y=f?n+p:t+M;e[i]=t,e[i+m]=n,e[i+m+1]=n,e[i+g]=y,e[i+g+1]=y,e[i+5]=t,i+=6}}t.indexCount=i}function _(t){const{geometry:e,geometryState:n}=t,{edgeResolutions:o}=n,{numVerticesPerSide:s,edgeVerticesStartIndex:r}=e,i=s-2;let a=r;for(let c=0;c<4;++c){{const t=0===c||2===c,e=(0===c?i-1:0)*i+(1===c?i-1:0),n=(t?0:1)*i+(t?1:0),o=St[c];o.vertex0Index=e,o.stride=n,o.count=i}{const t=o[c]+1;e.outerEdgesOffsetAndLength[2*c+0]=a,e.outerEdgesOffsetAndLength[2*c+1]=t,a+=t}}}function tt(t){_(t),t.geometryState.wireframe?$(t.geometry):X(t.geometry)}function et(o,s,r){const{geometryState:i,geometry:a,tile:c,localOrigin:l}=o,u=1===s||3===s,d=i.edgeResolutions[s];f(e(d));const m=d+1,{boundingBox:g,minu:h,minv:p,maxu:x,maxv:M,vertexAttributes:y}=a,S=t(1===s?1:0,h,x),L=t(0===s?1:0,p,M),v=r.renderData,B=v.geometryState,V=v.geometry,I=(s+2)%4,b=V.getEdgeCount(I),T=c.getNeighborEdgeStartVertexIndex(s,r)*d,U=d*2**(c.level-r.level);f(B.edgeResolutions[I]===U),f(b-1===U);const C=v.localOrigin[0]-l[0],A=v.localOrigin[1]-l[1],P=v.localOrigin[2]-l[2],D=a.getEdgeFirstVertexIndex(s),{position:E,uv0:w}=y,O=E.typedBuffer,R=E.typedBufferStride,N=y.normalCompressed,j=N.typedBuffer,F=N.typedBufferStride,q=V.vertexAttributes,W=V.getEdgeFirstVertexIndex(I),k=q.position.typedBuffer,z=q.position.typedBufferStride,G=q.normalCompressed.typedBuffer,H=q.normalCompressed.typedBufferStride;for(let e=1;e<m-1;++e){const o=D+e,s=W+(T+e),r=o*R,i=s*z,a=k[i]+C,c=k[i+1]+A,l=k[i+2]+P;O[r]=a,O[r+1]=c,O[r+2]=l,Lt(a,c,l,g);const f=o*F,m=s*H;j[f]=G[m],j[f+1]=G[m+1];const y=e/d,v=u?S:t(y,h,x),B=u?t(y,p,M):L;w.setValues(o,Math.round(v*n),Math.round(B*n))}}function nt(e){const{geometry:o,geometryState:s,localOrigin:i}=e,{clippingArea:a,samplerData:c}=s,{minu:l,minv:u,maxu:d,maxv:m,boundingBox:g,vertexAttributes:h}=o,p=e.tile,{surface:M,ellipsoid:y,extent:S,extentInRadians:L,horizontalScale:v}=p,B="local"===M.view?.viewingMode,V=y.radius;let I=0,b=0,T=0;const U=(t,e,n)=>{const o=L[0===e?1:3],s=L[0===t?0:2],r=Math.cos(o),i=Math.sin(o),a=Math.sin(s),c=Math.cos(s),l=V+n;I=c*r*l,b=a*r*l,T=i*l},C=B?(()=>{const e=a,n=null!=e&&(S[3]>e[3]||S[2]>e[2]||S[1]<e[1]||S[0]<e[0]),o=H(M.isWebMercatorOnPlateCarree,V,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),T=d}})():U;let A=0,P=0,D=0,E=0,w=0,R=0,N=0,j=0,F=0;const q=B&&M.isWebMercatorOnPlateCarree,W=(t,e,n,o,s)=>{let r=0,i=0,a=0;if(B){const t=e*v,s=q?(Math.PI/2-2*Math.atan(Math.exp(-n/V)))*V:n*v;r=t-I,i=s-b,a=o-T}else{const s=O(t),c=t.tile,l=c.extent,u=c.extentInRadians,d=(e-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),h=Math.cos(g),p=Math.sin(g),x=Math.sin(m),M=Math.cos(m),y=V+o;r=M*h*y-I,i=x*h*y-b,a=p*y-T}switch(s){case 0:N+=r,j+=i,F+=a;break;case 1:E-=r,w-=i,R-=a;break;case 2:N-=r,j-=i,F-=a;break;case 3:E+=r,w+=i,R+=a}},k=a??pt,z=S[0],G=S[2],J=S[1],K=S[3],Q=[K>k[3],G>k[2],J<k[1],z<k[0]],X=Math.max(z,k[0]),Y=Math.min(G,k[2]),Z=Math.max(J,k[1]),$=Math.min(K,k[3]),_=t=>Math.max(k[0],Math.min(k[2],t)),tt=t=>Math.max(k[1],Math.min(k[3],t)),et=t=>{const e=s.cornerNeighborCornerTiles;A=0,P=0,D=1,E=0,w=0,R=0,N=0,j=0,F=0;let n=1/0;for(let s=0;s<4;++s){const o=e[4*t+s];n=Math.min(n,o?.level??1/0)}for(let s=0;s<4;++s){const o=e[4*t+s];xt[s]=o?.level===n?o:null}let o=1,i=0;for(let s=0;s<4;++s){const t=xt[s];t&&(o=Math.max(o,t?.renderData.geometryState.numVerticesPerSide),i=t.extent[2]-t.extent[0])}const a=i,c=o;f(c>1);const l=a/c;for(let s=0;s<4;++s){const t=xt[(s+3)%4],e=xt[s%4];if(!t&&!e)continue;const n=0===s?1:1===s?2:2===s?3:0,o=0===s?2:1===s?3:2===s?0:1;if(t&&e){const i=at[s][0]*l,a=at[s][1]*l,c=t.extent,u=_(c[0===n||1===n?2:0]+i),d=tt(c[0===n||3===n?3:1]+a),f=e.extent,m=_(f[0===o||1===o?2:0]+i),g=tt(f[0===o||3===o?3:1]+a),h=t.renderData,p=e.renderData,x=r(u,d,h.geometryState.samplerData),M=r(m,g,p.geometryState.samplerData);W(h,u,d,.5*(x+M),s)}else{const i=t??e,a=t?n:o,c=i.extent,u=at[s],d=_(c[0===a||1===a?2:0]+u[0]*l),f=tt(c[0===a||3===a?3:1]+u[1]*l),m=i.renderData,g=r(d,f,m.geometryState.samplerData);W(m,d,f,g,s)}}if(!B){const t=Math.sqrt(I*I+b*b+T*T);A=I/t,P=b/t,D=T/t}if(B||D*D<.999){const t=Math.sqrt(E*E+w*w+R*R);E/=t,w/=t,R/=t;const e=Math.sqrt(N*N+j*j+F*F);N/=e,j/=e,F/=e,A=R*j-w*F,P=E*F-R*N,D=w*N-E*j;const n=1/Math.sqrt(A*A+P*P+D*D);A*=n,P*=n,D*=n}},nt=s.cornerNeighborCornerTiles;for(let O=0;O<4;++O){const e=O,a=(O+1)%4,M=0===O||1===O?1:0,y=0===O||3===O?1:0,S=t(M,l,d),L=t(y,u,m),v=o.getEdgeFirstVertexIndex(e),B=o.getEdgeCount(e),V=0===O||3===O?B-1:0,U=o.getEdgeFirstVertexIndex(a),E=o.getEdgeCount(a),w=0===O||1===O?E-1:0;let R=-1;for(let t=0;t<4;++t){const e=nt[4*O+t],n=nt[4*O+R];e&&(-1===R||x(n,e)>0)&&(R=t)}const N=R,j=nt[4*O+N];if(j!==p){const t=p.level-j.level,e=2**t,o=[j.lij[0]+t,j.lij[1]*e,j.lij[2]*e],r=[o[1]+e===p.lij[1],0===O&&(1===N||0===N&&j!==nt[4*O+3])||1===O&&(0===N||1===N&&j!==nt[4*O+2]),o[1]===p.lij[1]+1,2===O&&(3===N||2===N&&j!==nt[4*O+1])||3===O&&(2===N||3===N&&j!==nt[4*O+0])],a=r.reduce((t,e)=>t+(e?1:0),0);f(1===a||2===a);let c=-1,l=-1;const u=j.renderData;if(1===a){const t=r.findIndex(t=>t);f(0<=t&&t<=3),c=(t+2)%4;const e=s.edgeResolutions[t];l=p.getNeighborEdgeStartVertexIndex(t,j)*e+e*(0===t&&0===O||1===t&&0===O||2===t&&1===O||3===t&&3===O?1:0)}else{f(r[1]||r[3]),c=r[1]?3:1;const t=u.geometryState.edgeResolutions[c];l=0===O||3===O?0:t}const d=u.geometry;{const t=v+V,e=U+w,o=d.getEdgeFirstVertexIndex(c)+l,s=d.vertexAttributes,r=u.localOrigin,a=s.position,f=a.typedBuffer,m=o*a.typedBufferStride,p=f[m]+r[0]-i[0],x=f[m+1]+r[1]-i[1],M=f[m+2]+r[2]-i[2];Lt(p,x,M,g);const y=h.position,B=y.typedBuffer,I=t*y.typedBufferStride;B[I]=p,B[I+1]=x,B[I+2]=M;const b=e*y.typedBufferStride;B[b]=p,B[b+1]=x,B[b+2]=M;const T=h.uv0;T.setValues(t,Math.round(S*n),Math.round(L*n)),T.setValues(e,Math.round(S*n),Math.round(L*n));{const n=s.normalCompressed.typedBuffer,r=o*s.normalCompressed.typedBufferStride,i=h.normalCompressed,a=i.typedBuffer;{const e=t*i.typedBufferStride;a[e]=n[r],a[e+1]=n[r+1]}{const t=e*i.typedBufferStride;a[t]=n[r],a[t+1]=n[r+1]}}}}else{const n=Q[e],s=Q[a];let l;if(n||s){const e=t(z*(1-M)+G*M,X,Y),n=t(J*(1-y)+K*y,Z,$);l=r(e,n,c)}else l=ot(nt,O);C(M,y,l),et(O);const u=I-i[0],d=b-i[1],f=T-i[2];Lt(u,d,f,g),o.setEdgeVertexFromValuesRawPositionUVNormal(e,V,u,d,f,S,L,A,P,D),o.setEdgeVertexFromValuesRawPositionUVNormal(a,w,u,d,f,S,L,A,P,D)}}for(let t=0;t<4;++t)xt[t]=null}function ot(t,e){const n=4*e,o=c.reduce((e,o)=>Math.min(e,t[n+o]?.level??1/0),1/0);m&&(f(!t[n+0]||!t[n+2]||p(t[n+0],t[n+2],5)),f(!t[n+1]||!t[n+3]||p(t[n+1],t[n+3],7)));let s=0,i=0;for(let c=0;c<4;++c){const e=t[n+c];if(e?.level===o){const t=0===c||1===c,n=0===c||3===c,o=e.extent,a=o[t?0:2],l=o[n?1:3],u=e.renderData?.geometryState?.samplerData;i+=r(a,l,u),s++}}const a=s?i/s:0;return f(null!=a),a}function st(t){const{vao:e,geometry:n}=t,{vertexAttributes:o,edgeVerticesStartIndex:s}=n,r=o.position.typedBuffer;e.buffer()?.setSubData(r,s,s,r.length)}function rt(t){const{vao:e,geometry:n}=t,{indices:o,indexCount:s,edgeIndicesStartIndex:r}=n;e.indexBuffer.setSubData(o,r,r,s)}class it{constructor(t,e,n,o,s){this.isNorth=t,this.connectedRowOffset=e,this.connectedOuterEdgeOffset=n,this.rowOffset=o,this.latitudeResolution=s}}const at=[[0,1],[1,0],[0,-1],[-1,0]],ct=new a,lt=.5*d,ut=new Uint16Array(u+1),dt=new Int32Array(u+1),ft=new Int32Array(u+1),mt=new Int32Array(u+1),gt=new Float64Array(u+1),ht=new Float64Array(u+1),pt=s(-1/0,-1/0,1/0,1/0),xt=[null,null,null,null];function Mt(t,e,n){if(!e)return!1;const o=x(t,e);return o>0||0===o&&n>=2}class yt{constructor(){this.vertex0Index=0,this.stride=1,this.count=0}getVertexIndex(t){return f(0<=t&&t<this.count),this.vertex0Index+this.stride*t}}const St=[new yt,new yt,new yt,new yt];function Lt(t,e,n,o){t<o[0]?o[0]=t:t>o[3]&&(o[3]=t),e<o[1]?o[1]=e:e>o[4]&&(o[4]=e),n<o[2]?o[2]=n:n>o[5]&&(o[5]=n)}function vt(t){const{edgeResolutions:e,numVerticesPerSide:n}=t,o=1+Math.max(...e);return Math.max(n,o)}function Bt(t,e,n,o,s,r){const i=t*s,a=r[i],c=r[i+1],l=r[i+2],u=e*s,d=r[u],f=r[u+1],m=r[u+2],g=n*s,h=r[g],p=r[g+1],x=r[g+2],M=o*s,y=r[M],S=r[M+1],L=r[M+2];return(d-y)*(d-y)+(f-S)*(f-S)+(m-L)*(m-L)>(a-h)*(a-h)+(c-p)*(c-p)+(l-x)*(l-x)}function Vt(t,e,n,o,s){t[e]=n,t[e+1]=o,t[e+2]=o,t[e+3]=s,t[e+4]=s,t[e+5]=n}const It=6;export{R as createPlanarGlobePatch,S as createSphericalGlobePatch,j as updateEdgeElevationsAndResolutionsPlanar,U as updateEdgeElevationsAndResolutionsSpherical,F as updateEdgesAndCornersPlanar,T as updateEdgesAndCornersSpherical};
|
|
2
|
+
import{clamp as t,isPowerOfTwo as e}from"../../../core/mathUtils.js";import{maxUint16 as n}from"../../../core/typedArrayUtil.js";import{empty as o}from"../../../geometry/support/aaBoundingBox.js";import{fromValues as r}from"../../../geometry/support/aaBoundingRect.js";import{sampleElevation as s,sampleSingleElevation as i}from"./ElevationData.js";import{PatchGeometryLUT as a}from"./PatchGeometryLUT.js";import{zeroToFour as c,neighborTileIfLoadedOrSelf as l}from"./PatchRenderData.js";import{maxPatchTesselation as u,elevationNoDataValue as d}from"./TerrainConst.js";import{internalAssert as f,enableTerrainInternalChecks as m,neighborEdgeIndices as g,almostEquals as h}from"./terrainUtils.js";import{isCornerNeighbor as p}from"./Tile.js";import{compareTilesByLij as x}from"./tileUtils.js";import{compressNormal as M}from"../webgl-engine/lib/Normals.js";const y=65536;function S(t,e){const{tile:n,geometry:r,geometryState:s}=t,{extentInRadians:i,surface:a}=n,{isWebMercator:c,renderer:l}=a,{numVerticesPerSide:u,wireframe:d}=s,f=u-1,m=(u-2)**2,g=c&&(2===e||3===e),h=c&&(1===e||3===e),p=((g?1:0)+(h?1:0))*It*u,x=vt(s),M=m+p+4*x,y=l.tileGeometryCache.acquire(M);r.numVerticesPerSide=u,r.vertexAttributes=y,r.maxEdgeVertexCount=x;const{boundingBox:S}=r;o(S);const B=O(t);ct.update(f,i,B),v(t),r.poleVerticesStartIndex=m;const V=L(t,g,h);r.edgeVerticesStartIndex=m+p,_(t),C(t),J(r,V,d),t.intersectionData=null}function L(t,e,o){const{tile:r,localOrigin:s,geometry:i}=t,{extent:a,ellipsoid:c}=r,{boundingBox:l,numVerticesPerSide:u,vertexAttributes:d,poleVerticesStartIndex:f}=i,m=u-1,g=s[0],h=s[1],p=s[2],x=c.radius,y=a[1],S=a[3],L=[];let v=f;const B=(t,e)=>{const o=e*u;Lt(-g,-h,t*x-p,l),L.push(new it(1===t,o,1===t?0:2,v,It));const r=D(-1===t?y:S,x),s=t*Math.PI/2-r,i=.99*(1===t?1:-1),a=x+0,{position:c,uv0:f}=d,{typedBuffer:B,typedBufferStride:V}=d.normalCompressed;for(let u=1;u<=It;++u){const t=r+s*(u/It),e=Math.cos(t),o=Math.sin(t);for(let r=0;r<=m;r++){const t=r/m,s=ct.sinLonLUT[r],u=ct.cosLonLUT[r]*e,d=s*e,x=o,y=u*a-g,S=d*a-h,L=x*a-p;Lt(y,S,L,l),c.setValues(v,y,S,L),f.setValues(v,Math.round(t*n),Math.round(i*n)),M(B,v,u,d,x,V),++v}}};return e&&B(-1,0),o&&B(1,m),L}function v(t){const e=t.geometryState.samplerData,n=1===e?.length?e[0]:null;n?B(t,n):V(t)}function B(t,e){const{tile:n}=t;if(!n.intersectsClippingArea)return;const{geometry:o,geometryState:r,localOrigin:s}=t,{numVerticesPerSide:i}=r,a=i-2,c=i-1,{vertexAttributes:l,boundingBox:u}=o,{position:d,uv0:f}=l,{typedBuffer:m,typedBufferStride:g}=l.normalCompressed,{extent:h}=n,p=n.ellipsoid.radius,x=s[0],y=s[1],S=s[2],L=d.typedBuffer,v=d.typedBufferStride,B=f.typedBuffer,V=f.typedBufferStride;I(c,h,e);let T=0;const U=e.data.values;if(1<=a){const t=ut[1],e=ct.sinLatLUT[1],n=ct.cosLatLUT[1];for(let o=1;o<=a;o++){const r=ct.sinLonLUT[o],s=ct.cosLonLUT[o],i=p+b(o,1,U),a=i*s*n-x,c=i*r*n-y,l=i*e-S;Lt(a,c,l,u);const d=(o-1)*v;L[d]=a,L[d+1]=c,L[d+2]=l;const f=(o-1)*V;B[f]=ut[o],B[f+1]=t}}for(let I=1;I<=a;I++){const t=ct.sinLatLUT[I],e=ct.cosLatLUT[I],n=I+1,o=ut[n],r=ct.sinLatLUT[n],s=ct.cosLatLUT[n],i=ct.sinLonLUT[0],l=ct.cosLonLUT[0],d=p+b(0,I,U);let f=l*e*d-x,h=i*e*d-y,C=t*d-S;const A=T*v;let P=L[A],D=L[A+1],E=L[A+2];for(let w=1;w<=a;w++){const i=ct.sinLonLUT[w],l=ct.cosLonLUT[w];let d=0,A=0,O=0;if(w<a){const t=(T+1)*v;d=L[t],A=L[t+1],O=L[t+2]}else{const n=ct.sinLonLUT[c],o=ct.cosLonLUT[c],r=p+b(c,I,U);d=o*e*r-x,A=n*e*r-y,O=t*r-S}const R=f,N=h,j=C;f=P,h=D,C=E,P=d,D=A,E=O;const F=d-R,q=A-N,W=O-j;let k=0,z=0,G=0;if(I>1){const t=(T-a)*v;k=L[t],z=L[t+1],G=L[t+2]}else{const t=ct.sinLatLUT[0],e=ct.cosLatLUT[0],n=p+b(w,0,U);k=l*e*n-x,z=i*e*n-y,G=t*n-S}const H=p+b(w,n,U),J=l*s*H-x,K=i*s*H-y,Q=r*H-S;if(I<a){const t=T+a,e=t*v;L[e]=J,L[e+1]=K,L[e+2]=Q,Lt(J,K,Q,u);const n=t*V;B[n]=ut[w],B[n+1]=o}const X=k-J,Y=z-K,Z=G-Q;let $=l*e,_=i*e,tt=t;tt*tt<.999&&($=W*Y-q*Z,_=F*Z-W*X,tt=q*X-F*Y);const et=1/Math.sqrt($*$+_*_+tt*tt);M(m,T,$*et,_*et,tt*et,g),++T}}}function V(t){const{tile:e}=t;if(!e.intersectsClippingArea)return;const{geometry:o,geometryState:r,localOrigin:i}=t,{numVerticesPerSide:a,samplerData:c}=r,l=a-2,u=a-1,{vertexAttributes:d,boundingBox:f}=o,{position:m,uv0:g}=d,{typedBuffer:h,typedBufferStride:p}=d.normalCompressed,{extent:x}=e,y=x[0],S=x[2],L=x[1],v=x[3],B=e.ellipsoid.radius,V=i[0],I=i[1],b=i[2],T=m.typedBuffer,U=m.typedBufferStride,C=1/u;let A=0;if(1<=l){const t=C,e=L*(1-t)+v*t,o=ct.sinLatLUT[1],r=ct.cosLatLUT[1];for(let i=1;i<=l;i++){const a=i*C,l=y*(1-a)+S*a,u=ct.sinLonLUT[i],d=ct.cosLonLUT[i],m=B+s(l,e,c),h=m*d*r-V,p=m*u*r-I,x=m*o-b;Lt(h,p,x,f);const M=(i-1)*U;T[M]=h,T[M+1]=p,T[M+2]=x,g.setValues(i-1,Math.round(a*n),Math.round(t*n))}}for(let P=1;P<=l;P++){const t=P*C,e=L*(1-t)+v*t,o=ct.sinLatLUT[P],r=ct.cosLatLUT[P],i=P+1,a=i*C,d=L*(1-a)+v*a,m=ct.sinLatLUT[i],x=ct.cosLatLUT[i],D=ct.sinLonLUT[0],E=ct.cosLonLUT[0],w=B+s(y,e,c);let O=E*r*w-V,R=D*r*w-I,N=o*w-b;const j=A*U;let F=T[j],q=T[j+1],W=T[j+2];for(let v=1;v<=l;v++){const t=v*C,i=y*(1-t)+S*t,D=ct.sinLonLUT[v],E=ct.cosLonLUT[v];let w=0,j=0,k=0;if(v<l){const t=(A+1)*U;w=T[t],j=T[t+1],k=T[t+2]}else{const t=ct.sinLonLUT[u],n=ct.cosLonLUT[u],i=B+s(S,e,c);w=n*r*i-V,j=t*r*i-I,k=o*i-b}const z=O,G=R,H=N;O=F,R=q,N=W,F=w,q=j,W=k;const J=w-z,K=j-G,Q=k-H;let X=0,Y=0,Z=0;if(P>1){const t=(A-l)*U;X=T[t],Y=T[t+1],Z=T[t+2]}else{const t=ct.sinLatLUT[0],e=ct.cosLatLUT[0],n=B+s(i,L,c);X=E*e*n-V,Y=D*e*n-I,Z=t*n-b}const $=B+s(i,d,c),_=E*x*$-V,tt=D*x*$-I,et=m*$-b;if(P<l){const e=A+l,o=e*U;T[o]=_,T[o+1]=tt,T[o+2]=et,Lt(_,tt,et,f),g.setValues(e,Math.round(t*n),Math.round(a*n))}const nt=X-_,ot=Y-tt,rt=Z-et;let st=E*r,it=D*r,at=o;at*at<.999&&(st=Q*ot-K*rt,it=J*rt-Q*nt,at=K*nt-J*ot);const lt=1/Math.sqrt(st*st+it*it+at*at);M(h,A,st*lt,it*lt,at*lt,p),++A}}}function I(e,o,r){const s=o[0],i=o[2],a=o[1],c=o[3],l=1/e,{dx:u,dy:d,x0:f,y1:m,safeWidth:g}=r,h=r.data.width;for(let p=0;p<=e;p++){const e=p*l,o=t(u*(s*(1-e)+i*e-f),0,g),r=Math.floor(o);dt[p]=r,gt[p]=o-r;const x=t(d*(m-(a*(1-e)+c*e)),0,g),M=Math.floor(x);ft[p]=M*h,mt[p]=(M+1)*h,ht[p]=x-M,ut[p]=Math.round(e*n)}}function b(t,e,n){const o=dt[t],r=gt[t],s=ft[e],i=mt[e],a=ht[e],c=s+o,l=n[c],u=n[c+1],d=n[i+o],f=n[i+o+1];if(l+d+u+f>=lt)return 0;const m=l+(u-l)*r;return m+(d+(f-d)*r-m)*a}function T(t){t.tile.intersectsClippingArea&&(C(t),rt(t),t.intersectionData=null)}function U(t){t.tile.intersectsClippingArea&&(tt(t),C(t),rt(t),st(t),t.intersectionData=null)}function C(t){t.tile.intersectsClippingArea&&(P(t),A(t))}function A(t){const{geometry:o,geometryState:r,tile:a,localOrigin:c}=t,{level:u,extent:d,extentInRadians:p,ellipsoid:y}=a,S=y.radius,L=p[0],v=p[2],B=p[1],V=p[3],{samplerData:I}=r,b=d[0],T=d[2],U=d[1],C=d[3],A=O(t),{boundingBox:P,vertexAttributes:D}=o,E=c[0],w=c[1],R=c[2],{position:N,uv0:j}=D,F=N.typedBuffer,q=N.typedBufferStride,W=j.typedBuffer,k=j.typedBufferStride,{typedBuffer:z,typedBufferStride:G}=D.normalCompressed,H=1===I?.length?I[0]:null,J=(t,e,n)=>H?i(t,e,H)??0:s(t,e,I)??0;for(let O=0;O<4;++O){const c=1===O||3===O,p=r.edgeResolutions[O];f(e(p));const y=p+1,D=l(a,r.edgePeerNeighbors[O]);if(Mt(a,D,O)){if(et(t,O,D))continue}const N=null!=D;f(!N||D.level===a.level),f(!N||x(a,D)<=0);const j=D?.renderData,K=j?.geometryState;if(m){const t=a.surface;if(!D&&t&&!t.updatingRootTiles){const e=g[O],n=a.findNeighborTile(e,t=>t.loaded||t.leaf||t.level===a.level);n?n.intersectsClippingArea&&(f(!n.loaded),f(!n.leaf),f(n.level===u)):f(null==t?.rootTiles||!a.shouldHaveNeighbor(e))}}const Q=1===O?d[2]:d[0],X=D?.extent,Y=X&&c?1===O?X[0]:X[2]:Q,Z=0===O?d[3]:d[1],$=1===O?1:0,_=0===O?1:0,tt=1===O?v:L,nt=0===O?V:B,ot=Math.sin(tt),rt=Math.cos(tt),st=Math.sin(nt),it=Math.cos(nt),at=K?.samplerData,ct=1===at?.length?at[0]:null,lt=(t,e,n)=>ct?i(n,e,ct)??0:s(n,e,at)??0,ut=N?(t,e,n)=>.5*(J(t,e)+lt(t,e,n)):J,dt=o.outerEdgesOffsetAndLength[2*O+0],ft=null!=H||null!=I&&I.some(t=>null!=t),mt=null!=ct||null!=at&&at.some(t=>null!=t),gt=ft||mt,ht=1/p,pt=n*ht,xt=$*n,yt=_*n,St=dt;f(!X||h(X[2]-X[0],d[2]-d[0]));(()=>{const t=1===O?-1:3===O?1:0,e=0===O?-1:2===O?1:0,n=(d[2]-d[0])*ht,o=t*n,r=e*n,a=c?t*((v-L)*ht):0,l=c?0:e*ht,u=_,f=c?tt+a:tt,m=c?Math.sin(f):ot,g=c?Math.cos(f):rt,h=c?tt-a:tt,p=c?Math.sin(h):ot,x=c?Math.cos(h):rt,B=c?nt:A(u+l),V=c?st:Math.sin(B),D=c?it:Math.cos(B),j=c?nt:A(u-l),J=c?st:Math.sin(j),K=c?it:Math.cos(j);let X=0,$=0,et=0;{const t=0*ht,e=c?Q:b*(1-t)+T*t,n=c?Y:e,o=c?U*(1-t)+C*t:Z,r=c?tt:L*(1-t)+v*t,s=c?ot:Math.sin(r),i=c?rt:Math.cos(r),a=c?A(t):nt,l=c?Math.sin(a):st,u=c?Math.cos(a):it,d=S+ut(e,o,n);X=i*u*d,$=s*u*d,et=l*d}let lt=0,dt=0,ft=0;{const t=1*ht,e=c?Q:b*(1-t)+T*t,n=c?Y:e,o=c?U*(1-t)+C*t:Z,r=c?tt:L*(1-t)+v*t,s=c?ot:Math.sin(r),i=c?rt:Math.cos(r),a=c?A(t):nt,l=c?Math.sin(a):st,u=c?Math.cos(a):it,d=S+ut(e,o,n);lt=i*u*d,dt=s*u*d,ft=l*d}for(let d=1;d<y-1;++d){let t=0,e=0,n=0;{const o=(d+1)*ht,r=c?Q:b*(1-o)+T*o,s=c?Y:r,i=c?U*(1-o)+C*o:Z,a=c?tt:L*(1-o)+v*o,l=c?ot:Math.sin(a),u=c?rt:Math.cos(a),f=c?A(o):nt,m=c?Math.sin(f):st,g=c?Math.cos(f):it,h=S+ut(r,i,s);t=u*g*h,e=l*g*h,n=m*h}const a=t,l=e,u=n,f=lt,h=dt,y=ft;lt=a,dt=l,ft=u;{const t=St+d,e=t*q,n=f-E,o=h-w,r=y-R;F[e]=n,F[e+1]=o,F[e+2]=r,Lt(n,o,r,P);const s=Math.round(d*pt),i=t*k;W[i]=c?xt:s,W[i+1]=c?s:yt}const B=X,j=$,_=et;X=f,$=h,et=y;const mt=f,Mt=h,vt=y,Bt=1/Math.sqrt(mt*mt+Mt*Mt+vt*vt),Vt=vt*Bt;let It=0,bt=0,Tt=0;if(gt&&Vt*Vt<.999){let t=0,e=0,n=0;{const o=0===O?-1:1;t=o*(a-B),e=o*(l-j),n=o*(u-_)}{const a=d*ht,l=c?Q:b*(1-a)+T*a,u=c?Y:l,f=c?U*(1-a)+C*a:Z,h=c?tt:L*(1-a)+v*a,M=c?ot:Math.sin(h),y=c?rt:Math.cos(h),B=c?A(a):nt,P=c?Math.sin(B):st,E=c?Math.cos(B):it;let w=mt,R=Mt,j=vt;if(N){const t=u-o,e=f-r,n=S+(ct?i(t,e,ct)??0:s(t,e,at)??0),a=c?E:K;w=(c?x:y)*a*n,R=(c?p:M)*a*n,j=(c?P:J)*n}{const a=l+o,u=f+r,d=S+(H?i(a,u,H)??0:s(a,u,I)??0),h=c?E:D,p=(c?g:y)*h*d,x=(c?m:M)*h*d,L=(c?P:V)*d;N||(w=2*mt-p,R=2*Mt-x,j=2*vt-L);const v=3===O?-1:1,B=v*(w-p),b=v*(R-x),T=v*(j-L);It=n*b-e*T,bt=t*T-n*B,Tt=e*B-t*b;const U=1/Math.sqrt(It*It+bt*bt+Tt*Tt);It*=U,bt*=U,Tt*=U}}}else It=mt*Bt,bt=Mt*Bt,Tt=vt*Bt;M(z,St+d,It,bt,Tt,G)}})()}}function P(t){nt(t)}function D(t,e){return Math.PI/2-2*Math.atan(Math.exp(-t/e))}function E(t,e,n,o){return D(t*(1-o)+e*o,n)}function w(t,e,n){return t*(1-n)+e*n}function O(t){const{tile:e}=t;if(e.surface.isWebMercator){const t=e.extent,n=e.ellipsoid.radius;return e=>E(t[1],t[3],n,e)}const n=e.extentInRadians;return t=>w(n[1],n[3],t)}function R(t){const{tile:e,geometryState:n,geometry:r}=t,{extent:s,surface:i}=e,{wireframe:a}=n,c=s[0],l=s[1],u=s[2]-c,d=s[3]-l,{numVerticesPerSide:f,clippingArea:m}=n,g=null!=m?Math.max(0,(m[0]-c)/u):0,h=null!=m?Math.max(0,(m[1]-l)/d):0,p=null!=m?Math.min(1,(m[2]-c)/u):1,x=null!=m?Math.min(1,(m[3]-l)/d):1,M=(f-2)**2,y=vt(n),S=M+4*y,L=i.renderer.tileGeometryCache.acquire(S),{boundingBox:v}=r;o(v),r.numVerticesPerSide=f,r.vertexAttributes=L,r.maxEdgeVertexCount=y,r.minu=g,r.minv=h,r.maxu=p,r.maxv=x,N(t),r.edgeVerticesStartIndex=M,_(t),q(t),J(r,[],a),t.intersectionData=null}function N(e){const o=e.tile;if(!o.intersectsClippingArea)return;const{geometry:r,geometryState:a,localOrigin:c}=e,{samplerData:l,clippingArea:u,numVerticesPerSide:d}=a,{surface:f,extent:m,ellipsoid:g}=o,{isWebMercatorOnPlateCarree:h}=f,p=null!=u?u:pt,x=m[0],y=m[1],S=m[2],L=m[3],v=Math.max(x,p[0]),B=Math.min(S,p[2]),V=Math.max(y,p[1]),I=Math.min(L,p[3]),b=g.radius,T=o.horizontalScale,U=d-1,C=d-2,{minu:A,minv:P,maxu:D,maxv:E,boundingBox:w,vertexAttributes:O}=r,{position:R,uv0:N}=O,{typedBuffer:j,typedBufferStride:F}=O.normalCompressed,q=c[0],W=c[1],k=c[2],z=R.typedBuffer,G=R.typedBufferStride;let H=0;const J=t(y,V,I),K=h?(Math.PI/2-2*Math.atan(Math.exp(-J/b)))*b:J*T,Q=1/U,X=t(y*(1-Q)+L*Q,V,I);let Y=K,Z=h?(Math.PI/2-2*Math.atan(Math.exp(-X/b)))*b:X*T;const $=1===l?.length?l[0]:null,_=$?(t,e)=>i(t,e,$)??0:(t,e)=>s(t,e,l)??0;for(let s=1;s<=C;s++){const e=s/U,o=t(y*(1-e)+L*e,V,I),r=t(e,P,E),i=Z,a=(s-1)/U,c=t(y*(1-a)+L*a,V,I),l=Y,u=(s+1)/U,d=t(y*(1-u)+L*u,V,I),f=h?(Math.PI/2-2*Math.atan(Math.exp(-d/b)))*b:d*T,m=t(u,P,E);Y=Z,Z=f;const g=t(x,v,B);let p=g*T,O=_(g,o);const R=1/U,J=t(R,A,D),K=t(x*(1-J)+S*J,v,B);let Q=J,X=K,$=K*T,tt=_(K,o);if(1===s){const e=$-q,o=Y-W,s=tt-k,i=0*G;z[i]=e,z[i+1]=o,z[i+2]=s,Lt(e,o,s,w);const a=t(R,A,D);N.setValues(H,Math.round(a*n),Math.round(r*n))}for(let h=1;h<=C;h++){const e=$,a=tt,u=(h+1)/U,g=t(u,A,D),y=t(x*(1-u)+S*u,v,B),L=X;X=y;{const t=H+1,e=t*G;if(1===s||h===C){const a=y*T,c=_(y,o);if(1===s&&h<C){const o=a-q,s=i-W,l=c-k;z[e]=o,z[e+1]=s,z[e+2]=l,Lt(o,s,l,w),N.setValues(t,Math.round(g*n),Math.round(r*n))}$=a,tt=c}else $=z[e]+q,tt=z[e+2]+k}const V=$,I=tt,b=p,P=O;p=e,O=a;const E=(H-C)*G,R=1===s?_(L,c):z[E+2]+k,J=_(L,d);if(s<C){const t=H+C,o=t*G,r=e-q,s=f-W,i=J-k;z[o]=r,z[o+1]=s,z[o+2]=i,Lt(r,s,i,w);const a=Q;Q=g,N.setValues(t,Math.round(a*n),Math.round(m*n))}{const t=V-b,e=l-f,n=e*(I-P),o=t*(R-J),r=-e*t,s=n*n+o*o+r*r;if(0===s)M(j,H,0,0,1,F);else{const t=1/Math.sqrt(s);M(j,H,n*t,o*t,r*t,F)}}++H}}}function j(t){t.tile.intersectsClippingArea&&(tt(t),q(t),rt(t),st(t),t.intersectionData=null)}function F(t){t.tile.intersectsClippingArea&&(q(t),rt(t),t.intersectionData=null)}function q(t){t.tile.intersectsClippingArea&&(k(t),W(t))}function W(n){const{geometry:o,geometryState:r,localOrigin:a}=n,c=n.tile,{surface:u,extent:d}=c,{clippingArea:h,samplerData:p}=r,M=null!=h?h:pt,y=d[0],S=d[2],L=d[1],v=d[3],B=[v>M[3],S>M[2],L<M[1],y<M[0]],V=c.horizontalScale,I=H(u.isWebMercatorOnPlateCarree,c.ellipsoid.radius,V),{minu:b,minv:T,maxu:U,maxv:C,boundingBox:A}=o,P=Math.max(y,M[0]),D=Math.min(S,M[2]),E=Math.max(L,M[1]),w=Math.min(v,M[3]),O=a[0],R=a[1],N=a[2],j=1===p?.length?p[0]:void 0,F=j?(t,e)=>i(t,e,j)??0:(t,e)=>s(t,e,p)??0;for(let q=0;q<4;++q){const a=1===q||3===q,d=r.edgeResolutions[q];f(e(d));const h=d+1,M=B[q],j=l(c,r.edgePeerNeighbors[q]);if(!M&&Mt(c,j,q)){if(et(n,q,j))continue}const W=null!=j&&!M,k=j?.renderData,z=k?.geometryState;if(m&&(f(!W||j.level===c.level),f(!W||x(c,j)<=0),c&&!j&&!u.updatingRootTiles)){const t=g[q],e=c.findNeighborTile(t,t=>t.loaded||t.leaf||t.level===c.level);u.updatingRootTiles||(e?e.intersectsClippingArea&&(f(!e.loaded),f(!e.leaf),f(e.level===c.level)):f(null==u?.rootTiles||!c.shouldHaveNeighbor(t)))}const G=t(1===q?S:y,P,D),H=t(0===q?v:L,E,w),J=z?.samplerData,K=t(1===q?1:0,b,U),Q=t(0===q?1:0,T,C),X=1===J?.length?J[0]:null,Y=(t,e)=>X?i(t,e,X)??0:s(t,e,J)??0,Z=W?(t,e)=>.5*(Y(t,e)+F(t,e)):F,$=(S-y)/d,_=a?1===q?$:-$:0,tt=a?0:0===q?$:-$,nt=-_,ot=-tt;let rt=0,st=0,it=0;{const e=0/d,n=a?G:t(y*(1-e)+S*e,P,D),o=a?t(L*(1-e)+v*e,E,w):H,r=Z(n,o);rt=n*V,st=I(o),it=r}let at=0,ct=0,lt=0;{const e=1/d,n=a?G:t(y*(1-e)+S*e,P,D),o=a?t(L*(1-e)+v*e,E,w):H,r=Z(n,o);at=n*V,ct=I(o),lt=r}for(let e=1;e<h-1;++e){const n=e/d,r=at,i=ct,c=lt;{const s=a?K:t(n,b,U),l=a?t(n,T,C):Q,u=r-O,d=i-R,f=c-N;Lt(r,d,f,A),o.setEdgeVertexFromValuesRawPositionUV(q,e,u,d,f,s,l)}{const n=(e+1)/d,o=a?G:t(y*(1-n)+S*n,P,D),r=a?t(L*(1-n)+v*n,E,w):H,s=Z(o,r);at=o*V,ct=I(r),lt=s}const l=at,u=lt,f=rt,m=st,g=it;rt=r,st=i,it=c;let h=0,x=0,M=0;if(a){const e=ct-i,o=u-c,a=m-i,l=g-c,d=t(L*(1-n)+v*n,E,w),f=G+nt,y=f*V-r,S=s(f,d,p)-c,B=3===q?-1:1;if(h=B*(-a+e)*S,x=B*y*(-l+o),M=-B*y*(-a+e),W){const t=G+_,n=t*V-r;h=(-a+e)*(S-(s(t,d,J)-c)),x=(y-n)*(-l+o),M=-(y-n)*(-a+e)}}else{const e=l-r,o=u-c,a=f-r,d=g-c,m=t(y*(1-n)+S*n,P,D),L=H+ot,v=s(m,L,p)-c,B=I(L)-i,V=2===q?-1:1;if(h=V*B*(-d+o),x=V*(-a+e)*v,M=-V*B*(-a+e),W){const t=m,n=H+tt,r=I(n)-i;h=(-B+r)*(-d+o),x=(-a+e)*(-v+(s(t,n,J)-c)),M=-(-B+r)*(-a+e)}}const B=1/Math.sqrt(h*h+x*x+M*M);o.setEdgeNormalFromValues(q,e,h*B,x*B,M*B)}}}function k(t){nt(t)}function z(t,e){return(Math.PI/2-2*Math.atan(Math.exp(-t/e)))*e}function G(t,e){return t*e}function H(t,e,n){return t?t=>z(t,e):t=>G(t,n)}function J(t,e,n){const{numVerticesPerSide:o,vertexAttributes:r,maxEdgeVertexCount:s}=t,i=o-1,a=r.count,l=2*(o-3)*(o-3),u=4*(i+s-3),d=c.reduce((e,n)=>e+(i+t.getEdgeCount(n)-3),0),f=e.reduce((t,e)=>t+i*(2*(e.latitudeResolution-1)+1),0),m=3*(n?2:1),g=(l+u+f)*m,h=a>=y?new Uint32Array(g):new Uint16Array(g);for(let c=0;c<g;++c)h[c]=0;t.indices=h,t.indexCount=(l+d+f)*m,t.poleIndicesStartIndex=l*m,t.edgeIndicesStartIndex=(l+f)*m,n?(Y(t),Z(t,e),$(t)):(K(t),Q(t,e),X(t))}function K(t){const{numVerticesPerSide:e,indices:n,vertexAttributes:o}=t,{position:r}=o,{typedBuffer:s,typedBufferStride:i}=r,a=e-2,c=e-3,l=0,u=e-3;let d=0;for(let f=0;f<c;++f){const t=f*a;for(let e=l;e<u;++e){const o=t+e,r=o+1,c=r+a,l=c-1;Bt(o,r,c,l,i,s)?(n[d]=o,n[d+1]=r,n[d+2]=c,n[d+3]=c,n[d+4]=l,n[d+5]=o):(n[d]=o,n[d+1]=r,n[d+2]=l,n[d+3]=l,n[d+4]=r,n[d+5]=c),d+=6}}}function Q(t,e){const{numVerticesPerSide:n,indices:o,poleIndicesStartIndex:r}=t,s=n-1;let i=r;for(const a of e){const e=a.isNorth?1:2,r=a.isNorth?2:1,c=a.isNorth?3:4,l=a.isNorth?4:3;let u=t.getEdgeVertexIndex(a.connectedOuterEdgeOffset,0),d=1;for(let t=0;t<a.latitudeResolution;++t){const f=0===t?a.rowOffset:u+n;for(let n=0;n<s;n++){const s=f+n;o[i]=u,o[i+e]=u+1,o[i+r]=s,t<a.latitudeResolution-1?(o[i+c]=u+1,o[i+l]=s+1,o[i+5]=s,i+=6):i+=3,u+=d}u=f,d=1}}}function X(t){const{indices:e,numVerticesPerSide:n,edgeIndicesStartIndex:o}=t,r=n-1,s=r-2;let i=o;for(let a=0;a<4;++a){const n=St[a];let o=0,c=0;const l=t.getEdgeCount(a),u=n.count;f(u===r-1);const d=1===a||2===a,m=d?1:2,g=d?2:1,h=t.getEdgeFirstVertexIndex(a),p=1,x=n.vertex0Index,M=n.stride;for(;o<l-1||c<u-1;){const t=x+c*M,n=h+o*p,a=o<l-1,d=c<u-1,f=a&&(!d||(a?0+r*(o+.5)/(l-1):0)<=(d?1+s*(c+.5)/(u-1):0));f?++o:++c;const y=f?n+p:t+M;e[i]=t,e[i+m]=n,e[i+g]=y,i+=3}}t.indexCount=i}function Y(t){const{indices:e,numVerticesPerSide:n,vertexAttributes:o}=t,{position:r}=o,{typedBuffer:s,typedBufferStride:i}=r,a=n-2;let c=0;for(let l=0;l<n-3;++l){const t=l*a;for(let o=0;o<n-3;++o){const n=l*a+o,r=n+1,u=r+a,d=u-1,f=t+o,m=f+1,g=m+a;Bt(f,m,g,g-1,i,s)?(Vt(e,c,n,r,u),c+=6,Vt(e,c,u,d,n)):(Vt(e,c,n,r,d),c+=6,Vt(e,c,d,u,r)),c+=6}}}function Z(t,e){const{indices:n,numVerticesPerSide:o,poleIndicesStartIndex:r}=t,s=o-1;let i=r;for(const a of e){const e=a.connectedOuterEdgeOffset;let r=t.getEdgeVertexIndex(e,0),c=1;for(let t=0;t<a.latitudeResolution;++t){const e=0===t?a.rowOffset:r+o;for(let o=0;o<s;o++)Vt(n,i,r,r+1,e+o),i+=6,t<a.latitudeResolution-1&&(Vt(n,i,r+1,e+o+1,e+o),i+=6),r+=c;r=e,c=1}}}function $(t){const{indices:e,numVerticesPerSide:n,edgeIndicesStartIndex:o}=t,r=n-1,s=r-2;let i=o;for(let a=0;a<4;++a){const n=St[a];let o=0,c=0;const l=t.getEdgeCount(a),u=n.count;f(u===r-1);const d=1===a||2===a,m=d?1:3,g=d?3:1,h=t.getEdgeFirstVertexIndex(a),p=1,x=n.vertex0Index,M=n.stride;for(;o<l-1||c<u-1;){const t=x+c*M,n=h+o*p,a=o<l-1,d=c<u-1,f=a&&(!d||(a?0+r*(o+.5)/(l-1):0)<=(d?1+s*(c+.5)/(u-1):0));f?++o:++c;const y=f?n+p:t+M;e[i]=t,e[i+m]=n,e[i+m+1]=n,e[i+g]=y,e[i+g+1]=y,e[i+5]=t,i+=6}}t.indexCount=i}function _(t){const{geometry:e,geometryState:n}=t,{edgeResolutions:o}=n,{numVerticesPerSide:r,edgeVerticesStartIndex:s}=e,i=r-2;let a=s;for(let c=0;c<4;++c){{const t=0===c||2===c,e=(0===c?i-1:0)*i+(1===c?i-1:0),n=(t?0:1)*i+(t?1:0),o=St[c];o.vertex0Index=e,o.stride=n,o.count=i}{const t=o[c]+1;e.outerEdgesOffsetAndLength[2*c+0]=a,e.outerEdgesOffsetAndLength[2*c+1]=t,a+=t}}}function tt(t){_(t),t.geometryState.wireframe?$(t.geometry):X(t.geometry)}function et(o,r,s){const{geometryState:i,geometry:a,tile:c,localOrigin:l}=o,u=1===r||3===r,d=i.edgeResolutions[r];f(e(d));const m=d+1,{boundingBox:g,minu:h,minv:p,maxu:x,maxv:M,vertexAttributes:y}=a,S=t(1===r?1:0,h,x),L=t(0===r?1:0,p,M),v=s.renderData,B=v.geometryState;if(!B||!v.geometry.vertexAttributes)return!1;const V=v.geometry,I=(r+2)%4,b=V.getEdgeCount(I),T=c.getNeighborEdgeStartVertexIndex(r,s)*d,U=d*2**(c.level-s.level);f(B.edgeResolutions[I]===U),f(b-1===U);const C=v.localOrigin[0]-l[0],A=v.localOrigin[1]-l[1],P=v.localOrigin[2]-l[2],D=a.getEdgeFirstVertexIndex(r),{position:E,uv0:w}=y,O=E.typedBuffer,R=E.typedBufferStride,N=y.normalCompressed,j=N.typedBuffer,F=N.typedBufferStride,q=V.vertexAttributes,W=V.getEdgeFirstVertexIndex(I),k=q.position.typedBuffer,z=q.position.typedBufferStride,G=q.normalCompressed.typedBuffer,H=q.normalCompressed.typedBufferStride;for(let e=1;e<m-1;++e){const o=D+e,r=W+(T+e),s=o*R,i=r*z,a=k[i]+C,c=k[i+1]+A,l=k[i+2]+P;O[s]=a,O[s+1]=c,O[s+2]=l,Lt(a,c,l,g);const f=o*F,m=r*H;j[f]=G[m],j[f+1]=G[m+1];const y=e/d,v=u?S:t(y,h,x),B=u?t(y,p,M):L;w.setValues(o,Math.round(v*n),Math.round(B*n))}return!0}function nt(e){const{geometry:o,geometryState:r,localOrigin:i}=e,{clippingArea:a,samplerData:c}=r,{minu:l,minv:u,maxu:d,maxv:m,boundingBox:g,vertexAttributes:h}=o,p=e.tile,{surface:M,ellipsoid:y,extent:S,extentInRadians:L,horizontalScale:v}=p,B="local"===M.view?.viewingMode,V=y.radius;let I=0,b=0,T=0;const U=(t,e,n)=>{const o=L[0===e?1:3],r=L[0===t?0:2],s=Math.cos(o),i=Math.sin(o),a=Math.sin(r),c=Math.cos(r),l=V+n;I=c*s*l,b=a*s*l,T=i*l},C=B?(()=>{const e=a,n=null!=e&&(S[3]>e[3]||S[2]>e[2]||S[1]<e[1]||S[0]<e[0]),o=H(M.isWebMercatorOnPlateCarree,V,v);return(r,s,i)=>{const a=0===r?S[0]:S[2],c=0===s?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),T=d}})():U;let A=0,P=0,D=0,E=0,w=0,R=0,N=0,j=0,F=0;const q=B&&M.isWebMercatorOnPlateCarree,W=(t,e,n,o,r)=>{let s=0,i=0,a=0;if(B){const t=e*v,r=q?(Math.PI/2-2*Math.atan(Math.exp(-n/V)))*V:n*v;s=t-I,i=r-b,a=o-T}else{const r=O(t),c=t.tile,l=c.extent,u=c.extentInRadians,d=(e-l[0])/(l[2]-l[0]),f=(n-l[1])/(l[3]-l[1]),m=u[0]*(1-d)+u[2]*d,g=r(f),h=Math.cos(g),p=Math.sin(g),x=Math.sin(m),M=Math.cos(m),y=V+o;s=M*h*y-I,i=x*h*y-b,a=p*y-T}switch(r){case 0:N+=s,j+=i,F+=a;break;case 1:E-=s,w-=i,R-=a;break;case 2:N-=s,j-=i,F-=a;break;case 3:E+=s,w+=i,R+=a}},k=a??pt,z=S[0],G=S[2],J=S[1],K=S[3],Q=[K>k[3],G>k[2],J<k[1],z<k[0]],X=Math.max(z,k[0]),Y=Math.min(G,k[2]),Z=Math.max(J,k[1]),$=Math.min(K,k[3]),_=t=>Math.max(k[0],Math.min(k[2],t)),tt=t=>Math.max(k[1],Math.min(k[3],t)),et=t=>{const e=r.cornerNeighborCornerTiles;A=0,P=0,D=1,E=0,w=0,R=0,N=0,j=0,F=0;let n=1/0;for(let r=0;r<4;++r){const o=e[4*t+r];n=Math.min(n,o?.level??1/0)}for(let r=0;r<4;++r){const o=e[4*t+r];xt[r]=o?.level===n?o:null}let o=1,i=0;for(let r=0;r<4;++r){const t=xt[r];t&&(o=Math.max(o,t?.renderData.geometryState.numVerticesPerSide),i=t.extent[2]-t.extent[0])}const a=i,c=o;f(c>1);const l=a/c;for(let r=0;r<4;++r){const t=xt[(r+3)%4],e=xt[r%4];if(!t&&!e)continue;const n=0===r?1:1===r?2:2===r?3:0,o=0===r?2:1===r?3:2===r?0:1;if(t&&e){const i=at[r][0]*l,a=at[r][1]*l,c=t.extent,u=_(c[0===n||1===n?2:0]+i),d=tt(c[0===n||3===n?3:1]+a),f=e.extent,m=_(f[0===o||1===o?2:0]+i),g=tt(f[0===o||3===o?3:1]+a),h=t.renderData,p=e.renderData,x=s(u,d,h.geometryState.samplerData),M=s(m,g,p.geometryState.samplerData);W(h,u,d,.5*(x+M),r)}else{const i=t??e,a=t?n:o,c=i.extent,u=at[r],d=_(c[0===a||1===a?2:0]+u[0]*l),f=tt(c[0===a||3===a?3:1]+u[1]*l),m=i.renderData,g=s(d,f,m.geometryState.samplerData);W(m,d,f,g,r)}}if(!B){const t=Math.sqrt(I*I+b*b+T*T);A=I/t,P=b/t,D=T/t}if(B||D*D<.999){const t=Math.sqrt(E*E+w*w+R*R);E/=t,w/=t,R/=t;const e=Math.sqrt(N*N+j*j+F*F);N/=e,j/=e,F/=e,A=R*j-w*F,P=E*F-R*N,D=w*N-E*j;const n=1/Math.sqrt(A*A+P*P+D*D);A*=n,P*=n,D*=n}},nt=r.cornerNeighborCornerTiles;for(let O=0;O<4;++O){const e=O,a=(O+1)%4,M=0===O||1===O?1:0,y=0===O||3===O?1:0,S=t(M,l,d),L=t(y,u,m),v=o.getEdgeFirstVertexIndex(e),B=o.getEdgeCount(e),V=0===O||3===O?B-1:0,U=o.getEdgeFirstVertexIndex(a),E=o.getEdgeCount(a),w=0===O||1===O?E-1:0;let R=-1;for(let t=0;t<4;++t){const e=nt[4*O+t],n=nt[4*O+R];e&&(-1===R||x(n,e)>0)&&(R=t)}const N=R,j=nt[4*O+N];if(j!==p){const t=p.level-j.level,e=2**t,o=[j.lij[0]+t,j.lij[1]*e,j.lij[2]*e],s=[o[1]+e===p.lij[1],0===O&&(1===N||0===N&&j!==nt[4*O+3])||1===O&&(0===N||1===N&&j!==nt[4*O+2]),o[1]===p.lij[1]+1,2===O&&(3===N||2===N&&j!==nt[4*O+1])||3===O&&(2===N||3===N&&j!==nt[4*O+0])],a=s.reduce((t,e)=>t+(e?1:0),0);f(1===a||2===a);let c=-1,l=-1;const u=j.renderData;if(1===a){const t=s.findIndex(t=>t);f(0<=t&&t<=3),c=(t+2)%4;const e=r.edgeResolutions[t];l=p.getNeighborEdgeStartVertexIndex(t,j)*e+e*(0===t&&0===O||1===t&&0===O||2===t&&1===O||3===t&&3===O?1:0)}else{f(s[1]||s[3]),c=s[1]?3:1;const t=u.geometryState.edgeResolutions[c];l=0===O||3===O?0:t}const d=u.geometry;{const t=v+V,e=U+w,o=d.getEdgeFirstVertexIndex(c)+l,r=d.vertexAttributes,s=u.localOrigin,a=r.position,f=a.typedBuffer,m=o*a.typedBufferStride,p=f[m]+s[0]-i[0],x=f[m+1]+s[1]-i[1],M=f[m+2]+s[2]-i[2];Lt(p,x,M,g);const y=h.position,B=y.typedBuffer,I=t*y.typedBufferStride;B[I]=p,B[I+1]=x,B[I+2]=M;const b=e*y.typedBufferStride;B[b]=p,B[b+1]=x,B[b+2]=M;const T=h.uv0;T.setValues(t,Math.round(S*n),Math.round(L*n)),T.setValues(e,Math.round(S*n),Math.round(L*n));{const n=r.normalCompressed.typedBuffer,s=o*r.normalCompressed.typedBufferStride,i=h.normalCompressed,a=i.typedBuffer;{const e=t*i.typedBufferStride;a[e]=n[s],a[e+1]=n[s+1]}{const t=e*i.typedBufferStride;a[t]=n[s],a[t+1]=n[s+1]}}}}else{const n=Q[e],r=Q[a];let l;if(n||r){const e=t(z*(1-M)+G*M,X,Y),n=t(J*(1-y)+K*y,Z,$);l=s(e,n,c)}else l=ot(nt,O);C(M,y,l),et(O);const u=I-i[0],d=b-i[1],f=T-i[2];Lt(u,d,f,g),o.setEdgeVertexFromValuesRawPositionUVNormal(e,V,u,d,f,S,L,A,P,D),o.setEdgeVertexFromValuesRawPositionUVNormal(a,w,u,d,f,S,L,A,P,D)}}for(let t=0;t<4;++t)xt[t]=null}function ot(t,e){const n=4*e,o=c.reduce((e,o)=>Math.min(e,t[n+o]?.level??1/0),1/0);m&&(f(!t[n+0]||!t[n+2]||p(t[n+0],t[n+2],5)),f(!t[n+1]||!t[n+3]||p(t[n+1],t[n+3],7)));let r=0,i=0;for(let c=0;c<4;++c){const e=t[n+c];if(e?.level===o){const t=0===c||1===c,n=0===c||3===c,o=e.extent,a=o[t?0:2],l=o[n?1:3],u=e.renderData?.geometryState?.samplerData;i+=s(a,l,u),r++}}const a=r?i/r:0;return f(null!=a),a}function rt(t){const{vao:e,geometry:n}=t,{vertexAttributes:o,edgeVerticesStartIndex:r}=n,s=o.position.typedBuffer;e.buffer()?.setSubData(s,r,r,s.length)}function st(t){const{vao:e,geometry:n}=t,{indices:o,indexCount:r,edgeIndicesStartIndex:s}=n;e.indexBuffer.setSubData(o,s,s,r)}class it{constructor(t,e,n,o,r){this.isNorth=t,this.connectedRowOffset=e,this.connectedOuterEdgeOffset=n,this.rowOffset=o,this.latitudeResolution=r}}const at=[[0,1],[1,0],[0,-1],[-1,0]],ct=new a,lt=.5*d,ut=new Uint16Array(u+1),dt=new Int32Array(u+1),ft=new Int32Array(u+1),mt=new Int32Array(u+1),gt=new Float64Array(u+1),ht=new Float64Array(u+1),pt=r(-1/0,-1/0,1/0,1/0),xt=[null,null,null,null];function Mt(t,e,n){if(!e)return!1;const o=x(t,e);return o>0||0===o&&n>=2}class yt{constructor(){this.vertex0Index=0,this.stride=1,this.count=0}getVertexIndex(t){return f(0<=t&&t<this.count),this.vertex0Index+this.stride*t}}const St=[new yt,new yt,new yt,new yt];function Lt(t,e,n,o){t<o[0]?o[0]=t:t>o[3]&&(o[3]=t),e<o[1]?o[1]=e:e>o[4]&&(o[4]=e),n<o[2]?o[2]=n:n>o[5]&&(o[5]=n)}function vt(t){const{edgeResolutions:e,numVerticesPerSide:n}=t,o=1+Math.max(...e);return Math.max(n,o)}function Bt(t,e,n,o,r,s){const i=t*r,a=s[i],c=s[i+1],l=s[i+2],u=e*r,d=s[u],f=s[u+1],m=s[u+2],g=n*r,h=s[g],p=s[g+1],x=s[g+2],M=o*r,y=s[M],S=s[M+1],L=s[M+2];return(d-y)*(d-y)+(f-S)*(f-S)+(m-L)*(m-L)>(a-h)*(a-h)+(c-p)*(c-p)+(l-x)*(l-x)}function Vt(t,e,n,o,r){t[e]=n,t[e+1]=o,t[e+2]=o,t[e+3]=r,t[e+4]=r,t[e+5]=n}const It=6;export{R as createPlanarGlobePatch,S as createSphericalGlobePatch,j as updateEdgeElevationsAndResolutionsPlanar,U as updateEdgeElevationsAndResolutionsSpherical,F as updateEdgesAndCornersPlanar,T as updateEdgesAndCornersSpherical};
|