@arcgis/core 6.0.0-next.48 → 6.0.0-next.49
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/Ground.js +1 -1
- package/analysis/AreaMeasurementAnalysis.d.ts +12 -10
- package/analysis/AreaMeasurementAnalysis.js +1 -1
- package/applications/Components/formatUtils.d.ts +3 -2
- package/applications/MapViewer/templateUtils.d.ts +4 -1
- package/applications/SceneViewer/sceneViewerUtils.d.ts +12 -1
- package/applications/SceneViewer/sceneViewerUtils.js +1 -1
- package/arcade/featureset/actions/SpatialFilter.js +1 -1
- package/arcade/functions/featuresetgeom.js +1 -1
- package/arcade/functions/geomasync.js +1 -1
- package/arcade/geometry/operatorsWorker.js +1 -1
- package/arcade/geometry/operatorsWorkerConnection.js +1 -1
- package/arcgisGlobal.d.ts +4 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/063cc462524646cd45e8.js +1 -0
- package/assets/esri/core/workers/chunks/119c62e9c9c7440a6129.js +1 -0
- package/assets/esri/core/workers/chunks/14c04fde8d33b739b415.js +1 -0
- package/assets/esri/core/workers/chunks/27a91b52d1bee92b6f20.js +1 -0
- package/assets/esri/core/workers/chunks/31eb09e96f31bced71ad.js +1 -0
- package/assets/esri/core/workers/chunks/{056a815273653271bf75.js → 3236e18921955450fc0d.js} +5 -5
- package/assets/esri/core/workers/chunks/3ce7120056040af3bab1.js +1 -0
- package/assets/esri/core/workers/chunks/435dacf493aec07ff6e3.js +1 -0
- package/assets/esri/core/workers/chunks/4c26d6408ee7a3b9d163.js +1 -0
- package/assets/esri/core/workers/chunks/{73bf76a3a0418edb26a5.js → 506954fb374ea528d020.js} +1 -1
- package/assets/esri/core/workers/chunks/55db28616f810ca063b7.js +1 -0
- package/assets/esri/core/workers/chunks/59ae5bd0ee1bae7a9fb3.js +1 -0
- package/assets/esri/core/workers/chunks/630a36c4817f33f4cad2.js +1 -0
- package/assets/esri/core/workers/chunks/6779afc2d6ee46c301b5.js +1 -0
- package/assets/esri/core/workers/chunks/6a509ffb4852d694a097.js +1 -0
- package/assets/esri/core/workers/chunks/6d25a7071fceb707858a.js +1 -0
- package/assets/esri/core/workers/chunks/7a97eec9823941fd210f.js +29 -0
- package/assets/esri/core/workers/chunks/82bbf0c5e18fc1c795f4.js +1 -0
- package/assets/esri/core/workers/chunks/91019e9dff63107f8cb4.js +1 -0
- package/assets/esri/core/workers/chunks/{1345413ec0b4128849b1.js → 954f9854a9bf4a852b81.js} +1 -1
- package/assets/esri/core/workers/chunks/9846abf2d3991a15b2b5.js +1 -0
- package/assets/esri/core/workers/chunks/9f74b3f0f453bc957e3a.js +1 -0
- package/assets/esri/core/workers/chunks/a0e2a1c6f37454547193.js +1 -0
- package/assets/esri/core/workers/chunks/a1c45e8f5bba471b3905.js +1 -0
- package/assets/esri/core/workers/chunks/a2825285d46f8cd5d814.js +1 -0
- package/assets/esri/core/workers/chunks/{d4f6be8290ad0243e1b8.js → b511b5c68defefccde0b.js} +1 -1
- package/assets/esri/core/workers/chunks/bf81b3670b5323621e2d.js +1 -0
- package/assets/esri/core/workers/chunks/c4794d692934098988e7.js +1 -0
- package/assets/esri/core/workers/chunks/d0900a901197948bd7df.js +1 -0
- package/assets/esri/core/workers/chunks/d2ed93bbfa98395bbed7.js +1 -0
- package/assets/esri/core/workers/chunks/d486a8a61ff993f8202a.js +1 -0
- package/assets/esri/core/workers/chunks/e06036392a982dbf3ae3.js +1 -0
- package/assets/esri/core/workers/chunks/{773ba0909ccd3a034c31.js → ed1db6571b0c61fe4f91.js} +1 -1
- package/chunks/BlendWeights.glsl.js +4 -5
- package/chunks/Blur.glsl.js +10 -7
- package/chunks/BlurEmission.glsl.js +27 -7
- package/chunks/Clouds.glsl.js +2 -2
- package/chunks/Component.glsl.js +1 -1
- package/chunks/EdgeDetect.glsl.js +1 -1
- package/chunks/EdgeShader.glsl.js +1 -1
- package/chunks/EmissionComposite.glsl.js +2 -2
- package/chunks/Fog.glsl.js +4 -4
- package/chunks/GlobalIlluminationBlur.glsl.js +1 -1
- package/chunks/HighlightSharpApply.glsl.js +4 -1
- package/chunks/LineMarker.glsl.js +4 -4
- package/chunks/Magnifier.glsl.js +1 -1
- package/chunks/NoiseTextureAtlas.glsl.js +3 -3
- package/chunks/Pattern.glsl.js +35 -32
- package/chunks/{ChapmanAtmosphere.glsl.js → RealisticAtmosphere.glsl.js} +18 -9
- package/chunks/RealisticAtmosphereCompositing.glsl.js +35 -0
- package/chunks/SSAO.glsl.js +2 -2
- package/chunks/SimpleAtmosphere.glsl.js +1 -1
- package/config.js +1 -1
- package/core/accessorSupport/ObservableBase.js +1 -1
- package/core/accessorSupport/tracking/ObservationHandle.js +1 -1
- package/core/accessorSupport/tracking/SimpleObservable.js +1 -1
- package/core/accessorSupport/tracking/SimpleTrackingTarget.js +1 -1
- package/core/accessorSupport/tracking/TrackingTarget.js +1 -1
- package/core/quantity.js +1 -1
- package/core/timeUtils.js +1 -1
- package/geometry/coordinateConversion/CoordinateConversionModel.d.ts +258 -0
- package/geometry/coordinateConversion/CoordinateConversionModel.js +2 -0
- package/geometry/coordinateConversion/support/Conversion.d.ts +73 -0
- package/geometry/coordinateConversion/support/Conversion.js +2 -0
- package/geometry/coordinateConversion/support/Format.d.ts +131 -0
- package/geometry/coordinateConversion/support/Format.js +2 -0
- package/geometry/coordinateConversion/support/coordinateConversionUtils.js +2 -0
- package/geometry/coordinateConversion/support/formatUtils.js +2 -0
- package/geometry/coordinateConversion/types.d.ts +116 -0
- package/kernel.js +1 -1
- package/layers/IntegratedMesh3DTilesLayer.js +1 -1
- package/layers/IntegratedMeshLayer.js +1 -1
- package/layers/catalog/CatalogFootprintLayer.d.ts +2 -2
- package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
- package/layers/knowledgeGraph/cypherUtils.js +1 -1
- package/layers/mixins/FeatureLayerBase.d.ts +2 -2
- package/layers/raster/formats/Lzw.js +1 -1
- package/layers/raster/formats/TiffDecoder.js +1 -1
- package/layers/raster/formats/tiffParser.js +1 -1
- package/layers/raster/formats/tiffTag.js +1 -1
- package/layers/support/IntegratedMeshSemantics.js +2 -0
- package/layers/support/VideoElement.js +1 -1
- package/legend/ActiveLayerInfo.js +1 -1
- package/package.json +2 -2
- package/symbols/FillSymbol3DLayer.d.ts +1 -4
- package/time/daylightUtils.d.ts +29 -0
- package/time/daylightUtils.js +2 -0
- package/time/timeZoneUtils.js +1 -1
- package/time/types.d.ts +57 -1
- package/views/2d/analysis/AreaMeasurement/AreaMeasurementTool.js +1 -1
- package/views/2d/analysis/AreaMeasurementAnalysisView2D.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
- package/views/2d/layers/GeospatialPDFLayerView2D.js +1 -1
- package/views/2d/layers/MediaLayerView2D.js +1 -1
- package/views/2d/layers/TileLayerView2D.js +1 -1
- package/views/3d/GroundView3D.js +1 -1
- package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementVisualization.js +1 -1
- package/views/3d/analysis/AreaMeasurementAnalysisView3D.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
- package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementController.js +1 -1
- package/views/3d/interactive/Manipulator3D.js +1 -1
- package/views/3d/interactive/Manipulator3DBase.js +2 -0
- package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbol.js +1 -1
- package/views/3d/layers/graphics/Graphics3DWebStyleSymbol.js +1 -1
- package/views/3d/layers/graphics/SymbolComplexity.js +1 -1
- package/views/3d/layers/graphics/webStyleUtils.js +1 -1
- package/views/3d/layers/i3s/I3SIntersectionHandler.js +1 -1
- package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
- package/views/3d/layers/support/Tiles3DMeshIntersectionHandler.js +1 -1
- package/views/3d/layers/support/patternUtils.js +1 -1
- package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
- package/views/3d/support/GroundAndIMSurface.js +1 -1
- package/views/3d/support/engineContent/line.js +1 -1
- package/views/3d/support/hitTest.js +1 -1
- package/views/3d/support/pointsOfInterest/StableSurfaceCenter.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/PatchGeometryFactory.js +1 -1
- package/views/3d/terrain/PatchRenderDataWaterproofness.js +1 -1
- package/views/3d/terrain/SphericalPatch.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterialInitParameters.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterialRepository.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPass.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ScreenSpaceRayMarching.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/WaterColor.glsl.js +6 -4
- package/views/3d/webgl-engine/core/shaderLibrary/util/BlendModes.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js +10 -9
- package/views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatUnpacking.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/cameraUniforms.js +1 -1
- package/views/3d/webgl-engine/effects/WeatherFader.js +1 -1
- package/views/3d/webgl-engine/effects/atmosphere/ChapmanApproximation.glsl.js +3 -3
- package/views/3d/webgl-engine/effects/atmosphere/{ChapmanAtmosphere.glsl.js → RealisticAtmosphere.glsl.js} +1 -1
- package/views/3d/webgl-engine/effects/atmosphere/RealisticAtmosphere.js +2 -0
- package/views/3d/webgl-engine/effects/atmosphere/RealisticAtmosphereCompositing.glsl.js +2 -0
- package/views/3d/webgl-engine/effects/atmosphere/RealisticAtmosphereCompositingTechnique.js +2 -0
- package/views/3d/webgl-engine/effects/atmosphere/RealisticAtmosphereTechnique.js +2 -0
- package/views/3d/webgl-engine/effects/fog/Fog.js +1 -1
- package/views/3d/webgl-engine/effects/glow/BlurEmission.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/glow/applyEmissiveGlow.glsl.js +87 -41
- package/views/3d/webgl-engine/effects/precipitation/Precipitation.js +1 -1
- package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
- package/views/3d/webgl-engine/lib/EmissionComposite.glsl.js +1 -1
- package/views/3d/webgl-engine/lib/EmissionComposite.js +1 -1
- package/views/3d/webgl-engine/lib/ManagedTexture.js +1 -1
- package/views/3d/webgl-engine/lib/Octree.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
- package/views/3d/webgl-engine/lib/intersectorUtilsConversions.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/InstanceOctree.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/3d/webgl-engine/shaders/Pattern.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/PatternLayouts.js +1 -1
- package/views/3d/webgl-engine/shaders/PatternTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/PatternTechniqueConfiguration.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/VideoView.js +1 -1
- package/views/interactive/Tooltip.js +1 -1
- package/views/interactive/snapping/RightAngleTriangleSnapper.js +1 -1
- package/views/interactive/snapping/SnappingAlgorithm.js +1 -1
- package/views/interactive/tooltip/content/TooltipContent.js +1 -1
- package/widgets/CoordinateConversion/CoordinateConversionViewModel.d.ts +3 -0
- package/widgets/CoordinateConversion/CoordinateConversionViewModel.js +1 -1
- package/widgets/CoordinateConversion.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/022565ef98a702ab952f.js +0 -1
- package/assets/esri/core/workers/chunks/163e97987e1f75610009.js +0 -1
- package/assets/esri/core/workers/chunks/1d57b1445afec89a7941.js +0 -1
- package/assets/esri/core/workers/chunks/3654672d772d11484883.js +0 -1
- package/assets/esri/core/workers/chunks/3af0ff5a0b82872aac38.js +0 -1
- package/assets/esri/core/workers/chunks/3b9415dfd7546aeec261.js +0 -1
- package/assets/esri/core/workers/chunks/5109b48666138df14038.js +0 -1
- package/assets/esri/core/workers/chunks/6b73dfc9252b32f1eae2.js +0 -1
- package/assets/esri/core/workers/chunks/6e4698879e7d8fbc4d12.js +0 -1
- package/assets/esri/core/workers/chunks/71295afd21fc5bc5ddbc.js +0 -1
- package/assets/esri/core/workers/chunks/794a9f116c4700bb1210.js +0 -1
- package/assets/esri/core/workers/chunks/8e0ecc7f55dd8bf2cf16.js +0 -1
- package/assets/esri/core/workers/chunks/9dece842ada6278c33ef.js +0 -1
- package/assets/esri/core/workers/chunks/a12e29f2cb78fdaa0753.js +0 -1
- package/assets/esri/core/workers/chunks/b70af9fb974ef9836efd.js +0 -1
- package/assets/esri/core/workers/chunks/c0f2b6a10bcc766318f5.js +0 -1
- package/assets/esri/core/workers/chunks/c248db5e4d92cfb3c4d1.js +0 -1
- package/assets/esri/core/workers/chunks/ce02adb527389b90223d.js +0 -1
- package/assets/esri/core/workers/chunks/d8eea5ffe05c620fac9e.js +0 -1
- package/assets/esri/core/workers/chunks/d997d81d0965c05447d4.js +0 -1
- package/assets/esri/core/workers/chunks/e1645882f54818c4036a.js +0 -1
- package/assets/esri/core/workers/chunks/e44679a0d271c1efb60d.js +0 -1
- package/assets/esri/core/workers/chunks/f11f40017ec97a2a6b5f.js +0 -29
- package/assets/esri/core/workers/chunks/f7f5d8256e63d303cbcb.js +0 -1
- package/assets/esri/core/workers/chunks/f87d5450190896e61ff8.js +0 -1
- package/assets/esri/core/workers/chunks/fdee2255f49b43056e9d.js +0 -1
- package/assets/esri/core/workers/chunks/ff1e614fde01781360fa.js +0 -1
- package/chunks/AtmosphereCompositing.glsl.js +0 -25
- package/views/3d/analysis/ShadowCast/sunlightUtils.js +0 -2
- package/views/3d/webgl-engine/effects/atmosphere/ChapmanAtmosphere.js +0 -2
- package/views/3d/webgl-engine/effects/atmosphere/ChapmanAtmosphereTechnique.js +0 -2
- package/views/3d/webgl-engine/shaders/AtmosphereCompositing.glsl.js +0 -2
- package/views/3d/webgl-engine/shaders/AtmosphereCompositingTechnique.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import"../../../Graphic.js";import t from"../../../core/Collection.js";import n from"../../../core/Error.js";import"../../../core/has.js";import{some as r}from"../../../core/iteratorUtils.js";import i from"../../../core/Logger.js";import{getOrCreateMapValue as a}from"../../../core/MapUtils.js";import{isAbortError as o}from"../../../core/promiseUtils.js";import s from"../../../core/ReactiveMap.js";import{watch as c,syncAndInitial as l,on as u}from"../../../core/reactiveUtils.js";import{isScreenRect as d,isScreenPolygon as f}from"../../../core/screenUtils.js";import{property as p,subclass as m}from"../../../core/accessorSupport/decorators.js";import h from"../../../geometry/Extent.js";import{create as g}from"../../../geometry/support/aaBoundingRect.js";import{ringsContainsCoords as _}from"../../../geometry/support/contains.js";import{targetIntersectsPolygon as v,extentIntersectsPolygon as y}from"../../../geometry/support/intersectsBase.js";import{MediaElementView as b}from"../../../layers/support/MediaElementView.js";import"../../../renderers/SimpleRenderer.js";import"../../../symbols/SimpleFillSymbol.js";import"../engine/Stage.js";import"../../../Color.js";import"../../../core/libs/gl-matrix-2/factories/vec4f32.js";import"../../../geometry/Point.js";import"../../../chunks/pe.js";import"../../../core/units.js";import"../../../geometry/ellipsoidUtils.js";import"../../../geometry/support/spatialReferenceUtils.js";import"../../../core/RandomLCG.js";import"../../../core/Accessor.js";import"../engine/transitions/FadeTransition.js";import"../../webgl/BufferObject.js";import"../../webgl/FramebufferObject.js";import"../../webgl/Program.js";import"../../webgl/Renderbuffer.js";import"../../webgl/Texture.js";import"../../../core/memoryEstimations.js";import"../../webgl/enums.js";import"../../webgl/Util.js";import"../engine/webgl/meshing/definitions.js";import"../engine/webgl/shaderGraph/techniques/shaders/VideoScreenShader.js";import"../LabelManager.js";import"./graphics/GraphicsView2D.js";import"../../../layers/effects/EffectView.js";import"../engine/webgl/shaderGraph/techniques/clip/ClipTechnique.js";import"../engine/webgl/shaderGraph/techniques/shaders/TileInfo.js";import"../engine/webgl/AFeatureTile.js";import"../engine/webgl/DisplayEntity.js";import"../../../core/libs/gl-matrix-2/factories/vec2f32.js";import"../engine/webgl/number.js";import"../engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js";import"../engine/webgl/shaderGraph/techniques/shaders/TileDebugInfoShader.js";import"../engine/webgl/shaderGraph/techniques/shaders/TileStencilShader.js";import"../../webgl/UniformBufferLayout.js";import"../engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import"../../../core/libs/gl-matrix-2/factories/vec3f32.js";import"../../../geometry/support/normalizeUtils.js";import"./support/util.js";import"../navigation/MapViewNavigation.js";import"../../../request.js";import"../../../core/asyncUtils.js";import"../../../core/support/UpdatingHandles.js";import"../../../core/mathUtils.js";import"../../../core/urlUtils.js";import"../engine/webgl/shaderGraph/techniques/shaders/MagnifierShader.js";import"../../../geometry/Geometry.js";import"../../../geometry/Multipoint.js";import"../../../geometry/Polygon.js";import"../../../geometry/Polyline.js";import"../../../geometry/SpatialReference.js";import"../../../geometry/spatialReferenceEllipsoidUtils.js";import"../../../geometry/operators/support/GeographicTransformation.js";import"../../../geometry/projection/projectors.js";import"../engine/webgl/shaderGraph/techniques/shaders/GridShader.js";import"../../../geometry/support/geodesicConstants.js";import"../../../geometry/support/Ellipsoid.js";import"../tiling/TileInfoView.js";import"../tiling/TileKey.js";import x from"../tiling/TileQueue.js";import S from"../tiling/TileStrategy.js";import C from"../engine/webgl/Overlay.js";import w from"../engine/webgl/OverlayContainer.js";import{LayerView2D as T}from"./LayerView2D.js";import{getMapPointsFromScreen as E}from"../support/hitTestUtils.js";import D from"../../layers/MediaLayerView.js";import{TaskPriority as O}from"../../support/Scheduler.js";let k=class extends T(D){constructor(){super(...arguments),this._overlayContainer=null,this._fetchQueue=null,this._tileStrategy=null,this._elementReferences=new s,this._debugGraphicsView=null,this._interaction=null,this.elements=new t}initialize(){this.addHandles([c(()=>[this.interactive,this.suspended],async()=>{if(this.interactive&&!this._interaction){let{MediaLayerInteraction:e}=await this._updatingHandles.addPromise(import(`./support/MediaLayerInteraction.js`));if(this.destroyed)return;this._interaction=new e({view:this.view,layer:this.layer}),this.selectedElement!==this._interaction.selectedElement&&(this._interaction.selectedElement=this.selectedElement),this.interactionOptions!==this._interaction.options&&(this._interaction.options=this.interactionOptions)}this._interaction&&(this._interaction.enabled=!this.suspended&&this.interactive)},l),c(()=>this.interactionOptions,e=>{this._interaction&&(this._interaction.options=e)},l),c(()=>this.selectedElement,e=>{this._interaction&&(this._interaction.selectedElement=e)},l)])}isUpdating(){return this._interaction?.updating===!0||r(this._elementReferences.values(),({overlay:e})=>!e.isReady)}attach(){this.addAttachHandles([u(()=>this.layer.effectiveSource,`refresh`,()=>{let e=this.layer.effectiveSource;if(e)for(let{elementView:{element:t}}of this._elementReferences.values())e.hasElement(t)||this._removeElementReference(t);this._tileStrategy.refresh(e=>this._updateTile(e)),this.requestUpdate()}),u(()=>this.layer.effectiveSource,`change`,({element:e})=>this._elementUpdateHandler(e))]),this._overlayContainer=new w,this.container.addChild(this._overlayContainer),this._fetchQueue=new x({tileInfoView:this.view.featuresTilingScheme,concurrency:10,process:(e,t)=>this._queryElements(e,t),scheduler:this.scheduler,priority:O.MAPVIEW_FETCH_QUEUE}),this._tileStrategy=new S({cachePolicy:`purge`,resampling:!0,acquireTile:e=>this._acquireTile(e),releaseTile:e=>this._releaseTile(e),tileInfoView:this.view.featuresTilingScheme}),this.requestUpdate()}detach(){this.elements.removeAll(),this._tileStrategy.destroy(),this._fetchQueue.destroy(),this._overlayContainer.removeAllChildren(),this.container.removeAllChildren(),this._elementReferences.clear(),this._debugGraphicsView?.destroy()}supportsSpatialReference(e){return!0}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}update(e){this._tileStrategy.update(e),this._debugGraphicsView?.update(e)}async hitTest(e,t){let n=[],r=e.normalize(),i=[r.x,r.y],a=d(t),o=f(t),s=a||o;for(let{elementView:{normalizedCoords:r,element:a}}of this._elementReferences.values())if(s){let i=E(this.view,t).map(e=>[e.x,e.y]);r!=null&&v(i,r.rings)&&n.push({type:`media`,element:a,layer:this.layer,mapPoint:null,sourcePoint:a.toSource(e)})}else r!=null&&_(r.rings,i)&&n.push({type:`media`,element:a,layer:this.layer,mapPoint:e,sourcePoint:a.toSource(e)});return n.reverse()}canResume(){return this.layer.source!=null&&super.canResume()}async doRefresh(){this._fetchQueue.reset(),this._tileStrategy.refresh(e=>this._updateTile(e))}_acquireTile(e){let t=new N(e.clone());return this._updateTile(t),t}_updateTile(e){this._updatingHandles.consumePromise(this._fetchQueue.push(e.key).then(t=>{let[n,r]=e.setElements(t);this._referenceElements(e,n),this._dereferenceElements(e,r),this.requestUpdate()},e=>{o(e)||i.getLogger(this).error(e)}))}_releaseTile(e){this._fetchQueue.abort(e.key.id),e.elements&&this._dereferenceElements(e,e.elements),this.requestUpdate()}async _queryElements(e,t){let n=this.layer.effectiveSource;if(n==null)return[];this.view.featuresTilingScheme.getTileBounds(A,e,!0);let r=new h({xmin:A[0],ymin:A[1],xmax:A[2],ymax:A[3],spatialReference:this.view.spatialReference});return n.queryElements(r,t)}_referenceElements(e,t){if(this.layer.source!=null)for(let n of t)this._referenceElement(e,n)}_referenceElement(e,t){a(this._elementReferences,t.uid,()=>{let e=new b({element:t,spatialReference:this.view.spatialReference}),r=new C(e);return this._overlayContainer.addChild(r),this.elements.add(t),this._updatingHandles.consumePromise(t.load().catch(e=>{i.getLogger(`esri.views.2d.layers.MediaLayerView2D`).error(new n(`element-load-error`,`Element cannot be displayed`,{element:t,error:e}))})),{debugGraphic:null,elementView:e,overlay:r,tiles:new Set}}).tiles.add(e)}_dereferenceElements(e,t){for(let n of t)this._dereferenceElement(e,n)}_dereferenceElement(e,t){let n=this._elementReferences.get(t.uid);n&&(n.tiles.delete(e),n.tiles.size||this._removeElementReference(t))}_removeElementReference(e){let t=this._elementReferences.get(e.uid);t&&(this._overlayContainer.removeChild(t.overlay),t.overlay.destroy(),t.elementView.destroy(),this._elementReferences.delete(e.uid),this.elements.remove(e),this._debugGraphicsView?.graphics.remove(t.debugGraphic))}_elementUpdateHandler(e){if(!this.layer.effectiveSource?.hasElement(e))return;let t=this._elementReferences.get(e.uid);if(t){let n=t.elementView.normalizedCoords;if(n==null){this._removeElementReference(e);return}let r=[],i=[];for(let e of this._tileStrategy.tiles){let a=M(this.view.featuresTilingScheme,e,n);t.tiles.has(e)?a||i.push(e):a&&r.push(e)}for(let t of r)this._referenceElement(t,e);for(let t of i)this._dereferenceElement(t,e);t=this._elementReferences.get(e.uid),t?.debugGraphic&&(t.debugGraphic.geometry=t.elementView.normalizedCoords,this._debugGraphicsView.graphicUpdateHandler({graphic:t.debugGraphic,property:`geometry`}));return}let n=new b({element:e,spatialReference:this.view.spatialReference}).normalizedCoords;if(n!=null)for(let t of this._tileStrategy.tiles)M(this.view.featuresTilingScheme,t,n)&&this._referenceElement(t,e)}};e([p({readOnly:!0})],k.prototype,`elements`,void 0),k=e([m(`esri.views.2d.layers.MediaLayerView2D`)],k);const A=g(),j={xmin:0,ymin:0,xmax:0,ymax:0};function M(e,t,n){return e.getTileBounds(A,t.key,!0),j.xmin=A[0],j.ymin=A[1],j.xmax=A[2],j.ymax=A[3],y(j,n)}class N{constructor(e){this.key=e,this.elements=null,this.isReady=!1,this.visible=!0}setElements(e){let t=[],n=new Set(this.elements);this.elements=e;for(let r of e)n.has(r)?n.delete(r):t.push(r);return this.isReady=!0,[t,Array.from(n)]}destroy(){}}const P=k;export{P as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import"../../../Graphic.js";import t from"../../../core/Collection.js";import n from"../../../core/Error.js";import"../../../core/has.js";import{some as r}from"../../../core/iteratorUtils.js";import i from"../../../core/Logger.js";import{getOrCreateMapValue as a}from"../../../core/MapUtils.js";import{isAbortError as o}from"../../../core/promiseUtils.js";import s from"../../../core/ReactiveMap.js";import{watch as c,syncAndInitial as l,on as u}from"../../../core/reactiveUtils.js";import{isScreenRect as d,isScreenPolygon as f}from"../../../core/screenUtils.js";import{property as p,subclass as m}from"../../../core/accessorSupport/decorators.js";import h from"../../../geometry/Extent.js";import{create as g}from"../../../geometry/support/aaBoundingRect.js";import{ringsContainsCoords as _}from"../../../geometry/support/contains.js";import{targetIntersectsPolygon as v,extentIntersectsPolygon as y}from"../../../geometry/support/intersectsBase.js";import{MediaElementView as b}from"../../../layers/support/MediaElementView.js";import"../../../renderers/SimpleRenderer.js";import"../../../symbols/SimpleFillSymbol.js";import"../engine/Stage.js";import"../../../Color.js";import"../../../core/libs/gl-matrix-2/factories/vec4f32.js";import"../../../geometry/Point.js";import"../../../chunks/pe.js";import"../../../core/units.js";import"../../../geometry/ellipsoidUtils.js";import"../../../geometry/support/spatialReferenceUtils.js";import"../../../core/RandomLCG.js";import"../../../core/Accessor.js";import"../../../core/accessorSupport/ObservableBase.js";import"../engine/transitions/FadeTransition.js";import"../../webgl/BufferObject.js";import"../../webgl/FramebufferObject.js";import"../../webgl/Program.js";import"../../webgl/Renderbuffer.js";import"../../webgl/Texture.js";import"../../../core/memoryEstimations.js";import"../../webgl/enums.js";import"../../webgl/Util.js";import"../engine/webgl/meshing/definitions.js";import"../engine/webgl/shaderGraph/techniques/shaders/VideoScreenShader.js";import"../LabelManager.js";import"./graphics/GraphicsView2D.js";import"../../../layers/effects/EffectView.js";import"../engine/webgl/shaderGraph/techniques/clip/ClipTechnique.js";import"../engine/webgl/shaderGraph/techniques/shaders/TileInfo.js";import"../engine/webgl/AFeatureTile.js";import"../engine/webgl/DisplayEntity.js";import"../../../core/libs/gl-matrix-2/factories/vec2f32.js";import"../engine/webgl/number.js";import"../engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js";import"../engine/webgl/shaderGraph/techniques/shaders/TileDebugInfoShader.js";import"../engine/webgl/shaderGraph/techniques/shaders/TileStencilShader.js";import"../../webgl/UniformBufferLayout.js";import"../engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import"../../../core/libs/gl-matrix-2/factories/vec3f32.js";import"../../../geometry/support/normalizeUtils.js";import"./support/util.js";import"../navigation/MapViewNavigation.js";import"../../../request.js";import"../../../core/asyncUtils.js";import"../../../core/support/UpdatingHandles.js";import"../../../core/mathUtils.js";import"../../../core/urlUtils.js";import"../engine/webgl/shaderGraph/techniques/shaders/MagnifierShader.js";import"../../../geometry/Geometry.js";import"../../../geometry/Multipoint.js";import"../../../geometry/Polygon.js";import"../../../geometry/Polyline.js";import"../../../geometry/SpatialReference.js";import"../../../geometry/spatialReferenceEllipsoidUtils.js";import"../../../geometry/operators/support/GeographicTransformation.js";import"../../../geometry/projection/projectors.js";import"../engine/webgl/shaderGraph/techniques/shaders/GridShader.js";import"../../../geometry/support/geodesicConstants.js";import"../../../geometry/support/Ellipsoid.js";import"../tiling/TileInfoView.js";import"../tiling/TileKey.js";import x from"../tiling/TileQueue.js";import S from"../tiling/TileStrategy.js";import C from"../engine/webgl/Overlay.js";import w from"../engine/webgl/OverlayContainer.js";import{LayerView2D as T}from"./LayerView2D.js";import{getMapPointsFromScreen as E}from"../support/hitTestUtils.js";import D from"../../layers/MediaLayerView.js";import{TaskPriority as O}from"../../support/Scheduler.js";let k=class extends T(D){constructor(){super(...arguments),this._overlayContainer=null,this._fetchQueue=null,this._tileStrategy=null,this._elementReferences=new s,this._debugGraphicsView=null,this._interaction=null,this.elements=new t}initialize(){this.addHandles([c(()=>[this.interactive,this.suspended],async()=>{if(this.interactive&&!this._interaction){let{MediaLayerInteraction:e}=await this._updatingHandles.addPromise(import(`./support/MediaLayerInteraction.js`));if(this.destroyed)return;this._interaction=new e({view:this.view,layer:this.layer}),this.selectedElement!==this._interaction.selectedElement&&(this._interaction.selectedElement=this.selectedElement),this.interactionOptions!==this._interaction.options&&(this._interaction.options=this.interactionOptions)}this._interaction&&(this._interaction.enabled=!this.suspended&&this.interactive)},l),c(()=>this.interactionOptions,e=>{this._interaction&&(this._interaction.options=e)},l),c(()=>this.selectedElement,e=>{this._interaction&&(this._interaction.selectedElement=e)},l)])}isUpdating(){return this._interaction?.updating===!0||r(this._elementReferences.values(),({overlay:e})=>!e.isReady)}attach(){this.addAttachHandles([u(()=>this.layer.effectiveSource,`refresh`,()=>{let e=this.layer.effectiveSource;if(e)for(let{elementView:{element:t}}of this._elementReferences.values())e.hasElement(t)||this._removeElementReference(t);this._tileStrategy.refresh(e=>this._updateTile(e)),this.requestUpdate()}),u(()=>this.layer.effectiveSource,`change`,({element:e})=>this._elementUpdateHandler(e))]),this._overlayContainer=new w,this.container.addChild(this._overlayContainer),this._fetchQueue=new x({tileInfoView:this.view.featuresTilingScheme,concurrency:10,process:(e,t)=>this._queryElements(e,t),scheduler:this.scheduler,priority:O.MAPVIEW_FETCH_QUEUE}),this._tileStrategy=new S({cachePolicy:`purge`,resampling:!0,acquireTile:e=>this._acquireTile(e),releaseTile:e=>this._releaseTile(e),tileInfoView:this.view.featuresTilingScheme}),this.requestUpdate()}detach(){this.elements.removeAll(),this._tileStrategy.destroy(),this._fetchQueue.destroy(),this._overlayContainer.removeAllChildren(),this.container.removeAllChildren(),this._elementReferences.clear(),this._debugGraphicsView?.destroy()}supportsSpatialReference(e){return!0}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}update(e){this._tileStrategy.update(e),this._debugGraphicsView?.update(e)}async hitTest(e,t){let n=[],r=e.normalize(),i=[r.x,r.y],a=d(t),o=f(t),s=a||o;for(let{elementView:{normalizedCoords:r,element:a}}of this._elementReferences.values())if(s){let i=E(this.view,t).map(e=>[e.x,e.y]);r!=null&&v(i,r.rings)&&n.push({type:`media`,element:a,layer:this.layer,mapPoint:null,sourcePoint:a.toSource(e)})}else r!=null&&_(r.rings,i)&&n.push({type:`media`,element:a,layer:this.layer,mapPoint:e,sourcePoint:a.toSource(e)});return n.reverse()}canResume(){return this.layer.source!=null&&super.canResume()}async doRefresh(){this._fetchQueue.reset(),this._tileStrategy.refresh(e=>this._updateTile(e))}_acquireTile(e){let t=new N(e.clone());return this._updateTile(t),t}_updateTile(e){this._updatingHandles.consumePromise(this._fetchQueue.push(e.key).then(t=>{let[n,r]=e.setElements(t);this._referenceElements(e,n),this._dereferenceElements(e,r),this.requestUpdate()},e=>{o(e)||i.getLogger(this).error(e)}))}_releaseTile(e){this._fetchQueue.abort(e.key.id),e.elements&&this._dereferenceElements(e,e.elements),this.requestUpdate()}async _queryElements(e,t){let n=this.layer.effectiveSource;if(n==null)return[];this.view.featuresTilingScheme.getTileBounds(A,e,!0);let r=new h({xmin:A[0],ymin:A[1],xmax:A[2],ymax:A[3],spatialReference:this.view.spatialReference});return n.queryElements(r,t)}_referenceElements(e,t){if(this.layer.source!=null)for(let n of t)this._referenceElement(e,n)}_referenceElement(e,t){a(this._elementReferences,t.uid,()=>{let e=new b({element:t,spatialReference:this.view.spatialReference}),r=new C(e);return this._overlayContainer.addChild(r),this.elements.add(t),this._updatingHandles.consumePromise(t.load().catch(e=>{i.getLogger(`esri.views.2d.layers.MediaLayerView2D`).error(new n(`element-load-error`,`Element cannot be displayed`,{element:t,error:e}))})),{debugGraphic:null,elementView:e,overlay:r,tiles:new Set}}).tiles.add(e)}_dereferenceElements(e,t){for(let n of t)this._dereferenceElement(e,n)}_dereferenceElement(e,t){let n=this._elementReferences.get(t.uid);n&&(n.tiles.delete(e),n.tiles.size||this._removeElementReference(t))}_removeElementReference(e){let t=this._elementReferences.get(e.uid);t&&(this._overlayContainer.removeChild(t.overlay),t.overlay.destroy(),t.elementView.destroy(),this._elementReferences.delete(e.uid),this.elements.remove(e),this._debugGraphicsView?.graphics.remove(t.debugGraphic))}_elementUpdateHandler(e){if(!this.layer.effectiveSource?.hasElement(e))return;let t=this._elementReferences.get(e.uid);if(t){let n=t.elementView.normalizedCoords;if(n==null){this._removeElementReference(e);return}let r=[],i=[];for(let e of this._tileStrategy.tiles){let a=M(this.view.featuresTilingScheme,e,n);t.tiles.has(e)?a||i.push(e):a&&r.push(e)}for(let t of r)this._referenceElement(t,e);for(let t of i)this._dereferenceElement(t,e);t=this._elementReferences.get(e.uid),t?.debugGraphic&&(t.debugGraphic.geometry=t.elementView.normalizedCoords,this._debugGraphicsView.graphicUpdateHandler({graphic:t.debugGraphic,property:`geometry`}));return}let n=new b({element:e,spatialReference:this.view.spatialReference}).normalizedCoords;if(n!=null)for(let t of this._tileStrategy.tiles)M(this.view.featuresTilingScheme,t,n)&&this._referenceElement(t,e)}};e([p({readOnly:!0})],k.prototype,`elements`,void 0),k=e([m(`esri.views.2d.layers.MediaLayerView2D`)],k);const A=g(),j={xmin:0,ymin:0,xmax:0,ymax:0};function M(e,t,n){return e.getTileBounds(A,t.key,!0),j.xmin=A[0],j.ymin=A[1],j.xmax=A[2],j.ymax=A[3],y(j,n)}class N{constructor(e){this.key=e,this.elements=null,this.isReady=!1,this.visible=!0}setElements(e){let t=[],n=new Set(this.elements);this.elements=e;for(let r of e)n.has(r)?n.delete(r):t.push(r);return this.isReady=!0,[t,Array.from(n)]}destroy(){}}const P=k;export{P as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{makeHandle as t}from"../../../core/handleUtils.js";import n from"../../../core/Logger.js";import{isAbortError as r,waitTick as i}from"../../../core/promiseUtils.js";import{property as a,subclass as o}from"../../../core/accessorSupport/decorators.js";import{equals as s}from"../../../geometry/support/spatialReferenceUtils.js";import c from"../../../layers/support/FeatureFilter.js";import{GraphicsCollection as l}from"../../../support/GraphicsCollection.js";import"../engine/Stage.js";import"../../../Color.js";import"../../../core/libs/gl-matrix-2/factories/vec4f32.js";import"../../../geometry/Point.js";import"../../../chunks/pe.js";import"../../../core/has.js";import"../../../core/units.js";import"../../../geometry/ellipsoidUtils.js";import"../../../core/RandomLCG.js";import"../../../core/Accessor.js";import"../engine/transitions/FadeTransition.js";import"../../webgl/BufferObject.js";import"../../webgl/FramebufferObject.js";import"../../webgl/Program.js";import"../../webgl/Renderbuffer.js";import"../../webgl/Texture.js";import"../../../core/memoryEstimations.js";import"../../webgl/enums.js";import"../../webgl/Util.js";import"../engine/webgl/meshing/definitions.js";import"../engine/webgl/shaderGraph/techniques/shaders/VideoScreenShader.js";import"../LabelManager.js";import u from"./graphics/GraphicsView2D.js";import"../../../layers/effects/EffectView.js";import"../engine/webgl/shaderGraph/techniques/clip/ClipTechnique.js";import"../engine/webgl/shaderGraph/techniques/shaders/TileInfo.js";import"../engine/webgl/AFeatureTile.js";import"../engine/webgl/DisplayEntity.js";import"../../../geometry/Polygon.js";import"../../../core/libs/gl-matrix-2/factories/vec2f32.js";import"../engine/webgl/number.js";import"../engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js";import"../engine/webgl/shaderGraph/techniques/shaders/TileDebugInfoShader.js";import"../engine/webgl/shaderGraph/techniques/shaders/TileStencilShader.js";import"../../webgl/UniformBufferLayout.js";import"../engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import"../../../core/libs/gl-matrix-2/factories/vec3f32.js";import"../../../geometry/support/normalizeUtils.js";import"./support/util.js";import"../navigation/MapViewNavigation.js";import"../../../request.js";import"../../../core/asyncUtils.js";import"../../../core/accessorSupport/watch.js";import"../../../core/accessorSupport/tracking/SimpleTrackingTarget.js";import"../../../core/support/UpdatingHandles.js";import"../../../core/mathUtils.js";import"../../../core/urlUtils.js";import"../engine/webgl/shaderGraph/techniques/shaders/MagnifierShader.js";import"../../../geometry/Extent.js";import"../../../geometry/Geometry.js";import"../../../geometry/Multipoint.js";import"../../../geometry/Polyline.js";import"../../../geometry/SpatialReference.js";import"../../../geometry/spatialReferenceEllipsoidUtils.js";import"../../../geometry/operators/support/GeographicTransformation.js";import"../../../geometry/projection/projectors.js";import"../engine/webgl/shaderGraph/techniques/shaders/GridShader.js";import"../../../geometry/support/geodesicConstants.js";import"../../../geometry/support/Ellipsoid.js";import{BitmapTileLayerView2D as d}from"./BitmapTileLayerView2D.js";import{LayerView2D as f}from"./LayerView2D.js";import p from"./graphics/HighlightGraphicContainer.js";import{createBlankImage as m,resampleImage as h}from"./support/imageUtils.js";import g from"../tiling/TileInfoView.js";import _ from"../tiling/TileKey.js";import v from"../tiling/TileQueue.js";import y from"../tiling/TileStrategy.js";import b from"../../layers/LayerView.js";import{RefreshableLayerView as x}from"../../layers/RefreshableLayerView.js";import{getHighlightGraphics as S}from"../../layers/support/highlightUtils.js";import{isMapServiceLayerView as C,MapServiceLayerViewHelper as w}from"../../layers/support/MapServiceLayerViewHelper.js";import{createQueryGeometry as T}from"../../support/drapedUtils.js";import{getHighlightName as E}from"../../support/highlightOptionsUtils.js";import{TaskPriority as D}from"../../support/Scheduler.js";const O=[0,0];let k=class extends x(d(f(b))){constructor(){super(...arguments),this._fetchQueue=null,this._highlightGraphics=new l,this._highlightView=null,this._popupHighlightHelper=null,this._tileStrategy=null,this.layer=null}get resampling(){return!(`resampling`in this.layer)||this.layer.resampling!==!1}get tilemapCache(){return`tilemapCache`in this.layer?this.layer.tilemapCache:null}update(e){this._fetchQueue.pause(),this._fetchQueue.state=e.state,this._tileStrategy.update(e),this._fetchQueue.resume(),this._highlightView?.processUpdate(e)}attach(){let e=`tileServers`in this.layer?this.layer.tileServers:null,t=this.tilemapCache;if(this._tileInfoView=new g(this.layer.tileInfo,this.layer.fullExtent,t?.effectiveMinLOD,t?.effectiveMaxLOD),this._fetchQueue=new v({tileInfoView:this._tileInfoView,concurrency:e&&e.length*10||10,process:(e,t)=>this.fetchTile(e,t),scheduler:this.scheduler,priority:D.MAPVIEW_FETCH_QUEUE}),this._tileStrategy=new y({cachePolicy:`keep`,resampling:this.resampling,acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),tileInfoView:this._tileInfoView}),C(this,this.layer)){let e=this._highlightView=new u({view:this.view,graphics:this._highlightGraphics,requestUpdateCallback:()=>this.requestUpdate(),container:new p(this.view.featuresTilingScheme),defaultPointSymbolEnabled:!1});this.container.addChild(this._highlightView.container),this._popupHighlightHelper=new w({createFetchPopupFeaturesQueryGeometry:(e,t)=>T(e,t,this.view),highlightGraphics:this._highlightGraphics,highlightGraphicUpdated:({graphic:t,property:n})=>e.graphicUpdateHandler({graphic:t,property:n}),layerView:this,updatingHandles:this._updatingHandles})}this.requestUpdate(),this.addAttachHandles(this._updatingHandles.add(()=>this.resampling,()=>{this.doRefresh()})),super.attach()}detach(){super.detach(),this._tileStrategy.destroy(),this._fetchQueue.clear(),this.container.removeAllChildren(),this._popupHighlightHelper?.destroy(),this._highlightView?.destroy(),this._fetchQueue=this._tileStrategy=this._tileInfoView=this._popupHighlightHelper=null}async fetchPopupFeaturesAtTarget(e,t,n){return this._popupHighlightHelper?this._popupHighlightHelper.fetchPopupFeaturesAtTarget(t,n):[]}highlight(e,n){let r=S(e);if(r.length===0)return t();let i=E(n),a=this._addHighlightGraphics(r,i);return t(()=>!this.destroyed&&this._removeHighlightGraphics(r,a))}_onHighlightChange(){let e=this._getHighlightFilterGroups();this._highlightView?.setHighlightFilters(e)}_addHighlightGraphics(e,t){return this._highlightGraphics.addMany(e),this._addHighlightFilter(new c({objectIds:e.map(e=>e.uid)}),t)}_removeHighlightGraphics(e,t){this._highlightGraphics.removeMany(e),this._removeHighlight(t)}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}supportsSpatialReference(e){return s(this.layer.tileInfo?.spatialReference,e)}async doRefresh(){this.attached&&(this.suspended?(this._tileStrategy.clear(),this.requestUpdate()):(this._fetchQueue.reset(),this._tileStrategy.refresh(e=>this._updatingHandles.addPromise(this._enqueueTileFetch(e)))))}acquireTile(e){let t=this._bitmapView.createTile(e),n=t.bitmap;return[n.x,n.y]=this._tileInfoView.getTileCoords(O,t.key),n.resolution=this._tileInfoView.getTileResolution(t.key),[n.width,n.height]=this._tileInfoView.size,this._updatingHandles.consumePromise(this._enqueueTileFetch(t)),this._bitmapView.addChild(t),this.requestUpdate(),t}releaseTile(e){this._fetchQueue.abort(e.key.id),this._bitmapView.removeChild(e),e.once(`detach`,()=>e.destroy()),this.requestUpdate()}async fetchTile(e,t={}){return this.tilemapCache?this._fetchTileWithTilemapCache(e,t):this._fetchTileWithoutTilemapCache(e,t)}async _fetchTileWithoutTilemapCache(e,t={}){let{signal:n,resamplingLevel:i=0}=t;try{return await this._fetchImage(e,n)}catch(n){if(r(n))throw n;if(!this.resampling)return m(this._tileInfoView.size);if(i<3){let n=this._tileInfoView.getTileParentId(e.id);if(n){let r=new _(n),a=await this._fetchTileWithoutTilemapCache(r,{...t,resamplingLevel:i+1});return h(this._tileInfoView,a,r,e)}}return m(this._tileInfoView.size)}}async _fetchTileWithTilemapCache(e,t={}){let n=this.tilemapCache,{signal:a,resamplingLevel:o=0}=t,s=new _(0,0,0,0),c,l=null;try{if(l=await n.fetchAvailabilityUpsample(e.level,e.row,e.col,s,{signal:a}),!this.resampling&&s.level!==e.level)return await i(t),m(this._tileInfoView.size);c=await this._fetchImage(s,a)}catch(n){if(r(n))throw n;if(this.resampling&&l===`unknown`&&o<3){let n=this._tileInfoView.getTileParentId(e.id);if(n){s.set(n);try{c=await this._fetchTileWithTilemapCache(s,{...t,resamplingLevel:o+1})}catch{}}}}return c?this.resampling?h(this._tileInfoView,c,s,e):c:m(this._tileInfoView.size)}async _enqueueTileFetch(e){if(!this._fetchQueue.has(e.key.id)){try{let t=await this._fetchQueue.push(e.key);e.bitmap.source=t,e.bitmap.width=this._tileInfoView.size[0],e.bitmap.height=this._tileInfoView.size[1],e.once(`attach`,()=>this.requestUpdate()),e.once(`isReady`,()=>this.requestUpdate())}catch(e){r(e)||n.getLogger(this).error(e)}this.requestUpdate()}}async _fetchImage(e,t){return this.layer.fetchImageBitmapTile(e.level,e.row,e.col,{signal:t}).then(({bitmap:e})=>e)}};e([a()],k.prototype,`resampling`,null),e([a()],k.prototype,`tilemapCache`,null),k=e([o(`esri.views.2d.layers.TileLayerView2D`)],k);const A=k;export{A as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import{makeHandle as t}from"../../../core/handleUtils.js";import n from"../../../core/Logger.js";import{isAbortError as r,waitTick as i}from"../../../core/promiseUtils.js";import{property as a,subclass as o}from"../../../core/accessorSupport/decorators.js";import{equals as s}from"../../../geometry/support/spatialReferenceUtils.js";import c from"../../../layers/support/FeatureFilter.js";import{GraphicsCollection as l}from"../../../support/GraphicsCollection.js";import"../engine/Stage.js";import"../../../Color.js";import"../../../core/libs/gl-matrix-2/factories/vec4f32.js";import"../../../geometry/Point.js";import"../../../chunks/pe.js";import"../../../core/has.js";import"../../../core/units.js";import"../../../geometry/ellipsoidUtils.js";import"../../../core/RandomLCG.js";import"../../../core/Accessor.js";import"../../../core/accessorSupport/ObservableBase.js";import"../engine/transitions/FadeTransition.js";import"../../webgl/BufferObject.js";import"../../webgl/FramebufferObject.js";import"../../webgl/Program.js";import"../../webgl/Renderbuffer.js";import"../../webgl/Texture.js";import"../../../core/memoryEstimations.js";import"../../webgl/enums.js";import"../../webgl/Util.js";import"../engine/webgl/meshing/definitions.js";import"../engine/webgl/shaderGraph/techniques/shaders/VideoScreenShader.js";import"../LabelManager.js";import u from"./graphics/GraphicsView2D.js";import"../../../layers/effects/EffectView.js";import"../engine/webgl/shaderGraph/techniques/clip/ClipTechnique.js";import"../engine/webgl/shaderGraph/techniques/shaders/TileInfo.js";import"../engine/webgl/AFeatureTile.js";import"../engine/webgl/DisplayEntity.js";import"../../../geometry/Polygon.js";import"../../../core/libs/gl-matrix-2/factories/vec2f32.js";import"../engine/webgl/number.js";import"../engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js";import"../engine/webgl/shaderGraph/techniques/shaders/TileDebugInfoShader.js";import"../engine/webgl/shaderGraph/techniques/shaders/TileStencilShader.js";import"../../webgl/UniformBufferLayout.js";import"../engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import"../../../core/libs/gl-matrix-2/factories/vec3f32.js";import"../../../geometry/support/normalizeUtils.js";import"./support/util.js";import"../navigation/MapViewNavigation.js";import"../../../request.js";import"../../../core/asyncUtils.js";import"../../../core/accessorSupport/watch.js";import"../../../core/accessorSupport/tracking/SimpleTrackingTarget.js";import"../../../core/support/UpdatingHandles.js";import"../../../core/mathUtils.js";import"../../../core/urlUtils.js";import"../engine/webgl/shaderGraph/techniques/shaders/MagnifierShader.js";import"../../../geometry/Extent.js";import"../../../geometry/Geometry.js";import"../../../geometry/Multipoint.js";import"../../../geometry/Polyline.js";import"../../../geometry/SpatialReference.js";import"../../../geometry/spatialReferenceEllipsoidUtils.js";import"../../../geometry/operators/support/GeographicTransformation.js";import"../../../geometry/projection/projectors.js";import"../engine/webgl/shaderGraph/techniques/shaders/GridShader.js";import"../../../geometry/support/geodesicConstants.js";import"../../../geometry/support/Ellipsoid.js";import{BitmapTileLayerView2D as d}from"./BitmapTileLayerView2D.js";import{LayerView2D as f}from"./LayerView2D.js";import p from"./graphics/HighlightGraphicContainer.js";import{createBlankImage as m,resampleImage as h}from"./support/imageUtils.js";import g from"../tiling/TileInfoView.js";import _ from"../tiling/TileKey.js";import v from"../tiling/TileQueue.js";import y from"../tiling/TileStrategy.js";import b from"../../layers/LayerView.js";import{RefreshableLayerView as x}from"../../layers/RefreshableLayerView.js";import{getHighlightGraphics as S}from"../../layers/support/highlightUtils.js";import{isMapServiceLayerView as C,MapServiceLayerViewHelper as w}from"../../layers/support/MapServiceLayerViewHelper.js";import{createQueryGeometry as T}from"../../support/drapedUtils.js";import{getHighlightName as E}from"../../support/highlightOptionsUtils.js";import{TaskPriority as D}from"../../support/Scheduler.js";const O=[0,0];let k=class extends x(d(f(b))){constructor(){super(...arguments),this._fetchQueue=null,this._highlightGraphics=new l,this._highlightView=null,this._popupHighlightHelper=null,this._tileStrategy=null,this.layer=null}get resampling(){return!(`resampling`in this.layer)||this.layer.resampling!==!1}get tilemapCache(){return`tilemapCache`in this.layer?this.layer.tilemapCache:null}update(e){this._fetchQueue.pause(),this._fetchQueue.state=e.state,this._tileStrategy.update(e),this._fetchQueue.resume(),this._highlightView?.processUpdate(e)}attach(){let e=`tileServers`in this.layer?this.layer.tileServers:null,t=this.tilemapCache;if(this._tileInfoView=new g(this.layer.tileInfo,this.layer.fullExtent,t?.effectiveMinLOD,t?.effectiveMaxLOD),this._fetchQueue=new v({tileInfoView:this._tileInfoView,concurrency:e&&e.length*10||10,process:(e,t)=>this.fetchTile(e,t),scheduler:this.scheduler,priority:D.MAPVIEW_FETCH_QUEUE}),this._tileStrategy=new y({cachePolicy:`keep`,resampling:this.resampling,acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),tileInfoView:this._tileInfoView}),C(this,this.layer)){let e=this._highlightView=new u({view:this.view,graphics:this._highlightGraphics,requestUpdateCallback:()=>this.requestUpdate(),container:new p(this.view.featuresTilingScheme),defaultPointSymbolEnabled:!1});this.container.addChild(this._highlightView.container),this._popupHighlightHelper=new w({createFetchPopupFeaturesQueryGeometry:(e,t)=>T(e,t,this.view),highlightGraphics:this._highlightGraphics,highlightGraphicUpdated:({graphic:t,property:n})=>e.graphicUpdateHandler({graphic:t,property:n}),layerView:this,updatingHandles:this._updatingHandles})}this.requestUpdate(),this.addAttachHandles(this._updatingHandles.add(()=>this.resampling,()=>{this.doRefresh()})),super.attach()}detach(){super.detach(),this._tileStrategy.destroy(),this._fetchQueue.clear(),this.container.removeAllChildren(),this._popupHighlightHelper?.destroy(),this._highlightView?.destroy(),this._fetchQueue=this._tileStrategy=this._tileInfoView=this._popupHighlightHelper=null}async fetchPopupFeaturesAtTarget(e,t,n){return this._popupHighlightHelper?this._popupHighlightHelper.fetchPopupFeaturesAtTarget(t,n):[]}highlight(e,n){let r=S(e);if(r.length===0)return t();let i=E(n),a=this._addHighlightGraphics(r,i);return t(()=>!this.destroyed&&this._removeHighlightGraphics(r,a))}_onHighlightChange(){let e=this._getHighlightFilterGroups();this._highlightView?.setHighlightFilters(e)}_addHighlightGraphics(e,t){return this._highlightGraphics.addMany(e),this._addHighlightFilter(new c({objectIds:e.map(e=>e.uid)}),t)}_removeHighlightGraphics(e,t){this._highlightGraphics.removeMany(e),this._removeHighlight(t)}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}supportsSpatialReference(e){return s(this.layer.tileInfo?.spatialReference,e)}async doRefresh(){this.attached&&(this.suspended?(this._tileStrategy.clear(),this.requestUpdate()):(this._fetchQueue.reset(),this._tileStrategy.refresh(e=>this._updatingHandles.addPromise(this._enqueueTileFetch(e)))))}acquireTile(e){let t=this._bitmapView.createTile(e),n=t.bitmap;return[n.x,n.y]=this._tileInfoView.getTileCoords(O,t.key),n.resolution=this._tileInfoView.getTileResolution(t.key),[n.width,n.height]=this._tileInfoView.size,this._updatingHandles.consumePromise(this._enqueueTileFetch(t)),this._bitmapView.addChild(t),this.requestUpdate(),t}releaseTile(e){this._fetchQueue.abort(e.key.id),this._bitmapView.removeChild(e),e.once(`detach`,()=>e.destroy()),this.requestUpdate()}async fetchTile(e,t={}){return this.tilemapCache?this._fetchTileWithTilemapCache(e,t):this._fetchTileWithoutTilemapCache(e,t)}async _fetchTileWithoutTilemapCache(e,t={}){let{signal:n,resamplingLevel:i=0}=t;try{return await this._fetchImage(e,n)}catch(n){if(r(n))throw n;if(!this.resampling)return m(this._tileInfoView.size);if(i<3){let n=this._tileInfoView.getTileParentId(e.id);if(n){let r=new _(n),a=await this._fetchTileWithoutTilemapCache(r,{...t,resamplingLevel:i+1});return h(this._tileInfoView,a,r,e)}}return m(this._tileInfoView.size)}}async _fetchTileWithTilemapCache(e,t={}){let n=this.tilemapCache,{signal:a,resamplingLevel:o=0}=t,s=new _(0,0,0,0),c,l=null;try{if(l=await n.fetchAvailabilityUpsample(e.level,e.row,e.col,s,{signal:a}),!this.resampling&&s.level!==e.level)return await i(t),m(this._tileInfoView.size);c=await this._fetchImage(s,a)}catch(n){if(r(n))throw n;if(this.resampling&&l===`unknown`&&o<3){let n=this._tileInfoView.getTileParentId(e.id);if(n){s.set(n);try{c=await this._fetchTileWithTilemapCache(s,{...t,resamplingLevel:o+1})}catch{}}}}return c?this.resampling?h(this._tileInfoView,c,s,e):c:m(this._tileInfoView.size)}async _enqueueTileFetch(e){if(!this._fetchQueue.has(e.key.id)){try{let t=await this._fetchQueue.push(e.key);e.bitmap.source=t,e.bitmap.width=this._tileInfoView.size[0],e.bitmap.height=this._tileInfoView.size[1],e.once(`attach`,()=>this.requestUpdate()),e.once(`isReady`,()=>this.requestUpdate())}catch(e){r(e)||n.getLogger(this).error(e)}this.requestUpdate()}}async _fetchImage(e,t){return this.layer.fetchImageBitmapTile(e.level,e.row,e.col,{signal:t}).then(({bitmap:e})=>e)}};e([a()],k.prototype,`resampling`,null),e([a()],k.prototype,`tilemapCache`,null),k=e([o(`esri.views.2d.layers.TileLayerView2D`)],k);const A=k;export{A as default};
|
package/views/3d/GroundView3D.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{EventedMixin as t}from"../../core/Evented.js";import
|
|
2
|
+
import{__decorate as e}from"tslib";import{EventedMixin as t}from"../../core/Evented.js";import{when as n,watch as r,syncAndInitial as i}from"../../core/reactiveUtils.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import{create as s,equals as c,intersection as l,union as u}from"../../geometry/support/aaBoundingRect.js";import{IntegratedMeshSemantics as d}from"../../layers/support/IntegratedMeshSemantics.js";import f from"../GroundView.js";import{ElevationRange as p}from"./support/ElevationRange.js";import{toBoundingRect as m}from"./support/extentUtils.js";import{webMercatorWorldExtent as h,geographicWorldExtent as g}from"./terrain/TerrainConst.js";import{isIntegratedMeshLayerView as _}from"../support/layerViewUtils.js";const v=Symbol(`integrated-mesh-elevation-providers`);let y=class extends t(f){initialize(){super.initialize(),this.addHandles(n(()=>this._terrainSurface,e=>e.on(`elevation-change`,e=>this._elevationChange(e)))),r(()=>this._integratedMeshGroundLayerViews,()=>{this.removeHandles(v),this.addHandles(this._integratedMeshGroundLayerViews.map(({elevationProvider:e})=>e.on(`elevation-change`,e=>this._elevationChange(e))),v)},i),this.addHandles([r(()=>this.memoizedElevationQueryDependencies,()=>{this.emit(`elevation-query-change`)})])}get memoizedElevationQueryDependencies(){return(this.ground?.allLayers??[]).filter(e=>e.type===`elevation`||e.type===`integrated-mesh`||e.type===`integrated-mesh-3dtiles`&&e.replacesTerrain).map(e=>e.memoizedElevationQueryDependencies)}_elevationChange(e){this.emit(`elevation-change`,e)}get _integratedMeshGroundLayerViews(){return[...this.view?.basemapView?.groundLayerViews.filter(_).filter(e=>d.shouldRegisterGroundElevationProvider(!1,e.replacesTerrain))??[],...this.layerViews.filter(_).filter(e=>d.shouldRegisterGroundElevationProvider(!0,e.replacesTerrain))]}get _terrainSurface(){return this.view.basemapTerrain}get _usingTerrain(){return!this.hasTerrainReplacement&&(this._terrainSurface?.enabled??!1)}get spatialReference(){return this._terrainSurface?.spatialReference}get userClippingExtent(){let{spatialReference:e}=this,{clippingArea:t}=this.view;if(t==null||e==null)return null;let n=s(),r=m(t,n,e)?n:null,i=this._get(`userClippingExtent`);return c(r,i)?i:r}isUpdating(){return this._usingTerrain&&this._terrainSurface.updating||super.isUpdating()}getElevation(e,t,n,r){let i=this._usingTerrain?this._terrainSurface?.getElevation(e,t,n,r):null;return this._integratedMeshGroundLayerViews.reduce((i,a)=>{let o=a.elevationProvider.getElevation(e,t,n,r);return o==null?i:Math.max(o,i??o)},i)}getElevations(e,t,n){let r=this.view.groundSpatialReference;if(r==null)for(let e=0;e<t;++e)n(e,null);else for(let i=0;i<t;++i){let t=i*3;n(i,this.getElevation(e[t],e[t+1],e[t+2],r))}}intersect(e,t,n,r){this._usingTerrain&&this._terrainSurface.intersect(e,t,n,r),this._integratedMeshGroundLayerViews.forEach(i=>i.intersect(e,t,n,r))}getSphereElevationRange(e,t,n){let r=this._usingTerrain?this._terrainSurface?.getSphereElevationRange?.(e,t):null;return this._integratedMeshGroundLayerViews.reduce((n,r)=>{let i=r.elevationProvider.getSphereElevationRange?.(e,t);return i==null||(n??=new p,n.expandElevationRange(i)),n},r?new p(r.minElevation,r.maxElevation):null)}getRootElevationRange(){let e=this._usingTerrain?this._terrainSurface?.getRootElevationRange?.():null;return this._integratedMeshGroundLayerViews.reduce((e,t)=>{let n=t.elevationProvider.getRootElevationRange?.();return n==null||(e??=new p,e.expandElevationRange(n)),e},e?new p(e.minElevation,e.maxElevation):null)}get elevationQueryCache(){let e=this.view?.basemapTerrain;return e?.enabled?e.elevationQueryCache:null}get elevationQueryReady(){for(let e of this.ground?.allLayers??[])if(e.type===`integrated-mesh-3dtiles`&&e.replacesTerrain&&e.loadStatus!==`failed`&&e.queryElevationCallback==null)return!1;return!0}get groundExtent(){let{fullGroundExtent:e}=this;return e?this.userClippingExtent?l(e,this.userClippingExtent,s()):this.fullGroundExtent:null}get fullGroundExtent(){let e=this._usingTerrain?this._terrainSurface.fullGroundExtent:null;if(this._integratedMeshGroundLayerViews.length===0)return e;let t=this.view.spatialReference;if(!t.isWebMercator&&!t.isWGS84)return e;let n=x(t);return e?u(e,n,s()):n}get visibleElevationRange(){let e=this._usingTerrain?this._terrainSurface.visibleElevationRange:null,t=this._integratedMeshGroundLayerViews.reduce((e,t)=>e==null?new p(t.visibleElevationRange.minElevation,t.visibleElevationRange.maxElevation):(e.expandElevationRange(t.visibleElevationRange),e),e?new p(e.minElevation,e.maxElevation):null);return t&&!t.isEmpty?t:b}get opaque(){return this._usingTerrain&&this._terrainSurface.opaque||this._integratedMeshGroundLayerViews.some(({opaque:e})=>e)}get invisible(){return(!this._usingTerrain||this._terrainSurface.invisible)&&this._integratedMeshGroundLayerViews.every(({invisible:e})=>e)}get baseOpacity(){return this.ground?.opacity??1}get wireframe(){return this._usingTerrain?this._terrainSurface?.wireframe??!1:!1}get freeze(){return this._usingTerrain&&(this._terrainSurface?.freeze??!1)||this._integratedMeshGroundLayerViews.some(e=>e.type===`integrated-mesh-3dtiles`&&e.freeze)}set freeze(e){this._usingTerrain&&(this._terrainSurface.freeze=e),this._integratedMeshGroundLayerViews.forEach(t=>{t.type===`integrated-mesh-3dtiles`&&(t.freeze=e)})}get suspended(){return(!this._usingTerrain||super.suspended)&&this._integratedMeshGroundLayerViews.length>0&&this._integratedMeshGroundLayerViews.every(({suspended:e})=>e)}get ready(){return!this._usingTerrain&&this._integratedMeshGroundLayerViews.length===0?!1:(!this._usingTerrain||this._terrainSurface.ready)&&this._integratedMeshGroundLayerViews.every(({ready:e})=>e)}updateOverlayParameters(){this._terrainSurface?.updateOverlayParameters()}requestRender(e){this.view.stage.renderView?.requestRender(e)}};e([a()],y.prototype,`memoizedElevationQueryDependencies`,null),e([a({readOnly:!0})],y.prototype,`_integratedMeshGroundLayerViews`,null),e([a({readOnly:!0})],y.prototype,`_terrainSurface`,null),e([a({readOnly:!0})],y.prototype,`_usingTerrain`,null),e([a({readOnly:!0})],y.prototype,`spatialReference`,null),e([a({readOnly:!0})],y.prototype,`userClippingExtent`,null),e([a({readOnly:!0})],y.prototype,`elevationQueryCache`,null),e([a()],y.prototype,`elevationQueryReady`,null),e([a({readOnly:!0})],y.prototype,`groundExtent`,null),e([a({readOnly:!0})],y.prototype,`fullGroundExtent`,null),e([a({readOnly:!0})],y.prototype,`visibleElevationRange`,null),e([a({readOnly:!0})],y.prototype,`opaque`,null),e([a({readOnly:!0})],y.prototype,`invisible`,null),e([a({readOnly:!0})],y.prototype,`baseOpacity`,null),e([a({readOnly:!0})],y.prototype,`wireframe`,null),e([a()],y.prototype,`freeze`,null),e([a({readOnly:!0})],y.prototype,`suspended`,null),e([a({readOnly:!0})],y.prototype,`ready`,null),y=e([o(`esri.views.3d.GroundView3D`)],y);const b=new p(0,0);function x(e){return e.isWebMercator?h:g}export{y as GroundView3D};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{onLocaleChange as t,fetchMessageBundle as n}from"../../../../../intl.js";import r from"../../../../../core/Accessor.js";import{multiplyOpacityToUnitRGBA as i,getContrast as a,multiplyOpacity as o}from"../../../../../core/colorUtils.js";import"../../../../../core/has.js";import{nextHighestPowerOfTen as s,floatEqualUlp as c}from"../../../../../core/mathUtils.js";import{destroyMaybe as l}from"../../../../../core/maybe.js";import{toAdaptiveAreaUnit as u,adaptiveLengthUnitForArea as d}from"../../../../../core/quantity.js";import{formatDecimal as f}from"../../../../../core/quantityFormatUtils.js";import{watch as p,syncAndInitial as m,initial as h}from"../../../../../core/reactiveUtils.js";import{lengthUnitFromSpatialReference as g,convertUnit as _,adaptiveAreaUnit as v}from"../../../../../core/units.js";import{property as y,subclass as b}from"../../../../../core/accessorSupport/decorators.js";import{fromTranslation as x}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as S}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{subtract as C,squaredDistance as w}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as T}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{LabelVisualElement as E}from"../../../interactive/visualElements/LabelVisualElement.js";import{LineVisualElement as D}from"../../../interactive/visualElements/LineVisualElement.js";import{MeasurementAreaVisualElement as O}from"../../../interactive/visualElements/MeasurementAreaVisualElement.js";import{GeodesicSegment as k,EuclideanSegment as A}from"../../../interactive/visualElements/support/Segment.js";import{midpoint3d as j}from"../../../support/mathUtils.js";import{createStipplePatternSimple as M}from"../../../webgl-engine/materials/lineStippleUtils.js";let N=class extends r{get _parameters(){let{accentColor:e,textColor:t}=this.view.effectiveTheme,n=e.toUnitRGBA(),r=i(e,.5),s=i(a(e),.5),c=a(t,160);return{accentColor:n,transparentAccentColor:r,transparentContrastColor:s,textColor:t,textBackgroundColor:o(c,.6),textCalloutColor:o(c,.5),pathLineWidth:3,perimeterLineWidth:2,projectionLineWidth:2,projectionLineStippleSize:5,labelDistance:25}}get viewData(){return this._viewData}get visible(){return this.analysisViewData.visible}get _renderUnits(){let e=this.view.renderCoordsHelper.spatialReference;return g(e)??`meters`}get testData(){}constructor(e){super(e),this._path=null,this._perimeter=null,this._projectionLines=null,this._measurementArea=null,this._areaLabel=null,this._perimeterLabel=null,this._pathSegments=[],this._perimeterSegments=[],this._origin=T(),this._originTransform=S(),this.messages=null,this._viewData=new I,this.areaLabel=null,this.perimeterLabel=null,this.loadingMessages=!0}initialize(){let{analysisViewData:e,_parameters:n,view:r}=this;this._path=new D({view:r,attached:!0,width:n.pathLineWidth,polygonOffset:3,renderOccluded:4,transparentRenderOrder:1,isDecoration:!0}),this._perimeter=new D({view:r,attached:!0,width:n.perimeterLineWidth,polygonOffset:3,renderOccluded:4,transparentRenderOrder:2,isDecoration:!0}),this._projectionLines=new D({view:r,attached:!0,width:n.projectionLineWidth,stipplePattern:M(n.projectionLineStippleSize),polygonOffset:3,renderOccluded:4,transparentRenderOrder:3,isDecoration:!0}),this._measurementArea=new O({view:r,attached:!0,isDecoration:!0,renderOccluded:4,testsTransparentRenderOrder:5});let i={attached:!0,view:r,isDecoration:!0};this._areaLabel=new E({...i,fontSize:16,distance:0}),this._perimeterLabel=new E({...i,fontSize:12}),this.addHandles([p(()=>[e.mode,this.visible,e.unit,e.measurementData?.updateId,e.measurementData?.measurements!=null,L(e.measurementData?.measurements?.mode)],()=>this._update(),m),p(()=>e.measurementData?.measurements,e=>this._updateMeasurements(e)),p(()=>r.state?.camera,()=>this._updateLabels(),m),t(()=>this._updateMessageBundle()),p(()=>this._parameters,({accentColor:e,transparentAccentColor:t,transparentContrastColor:n,textColor:r,textBackgroundColor:i,textCalloutColor:a})=>{let{_path:o,_perimeter:s,_projectionLines:c,_measurementArea:l,_areaLabel:u,_perimeterLabel:d}=this;o.color=e,s.color=e,c.color=e,l.color1=t,l.color2=n,u.textColor=r,u.backgroundColor=i,u.calloutColor=a,d.textColor=r,d.backgroundColor=i,d.calloutColor=a},h)]),this._updateMessageBundle()}destroy(){this._measurementArea=l(this._measurementArea),this._path=l(this._path),this._perimeter=l(this._perimeter),this._areaLabel=l(this._areaLabel),this._perimeterLabel=l(this._perimeterLabel),this._projectionLines=l(this._projectionLines),this.set(`view`,null)}_update(){if(this.destroyed||!this.view.ready)return;let{analysisViewData:{measurementData:e},analysisViewData:t}=this;e!=null&&(this._updateViewData(e,t.path),this._updateOrigin(),this._updatePathSegments(),this._updatePerimeterSegments(),this._updateArea(),this._updateProjectionLines(),this._updateLabels())}_calculateCheckerSize(e){let t=R(e?.mode)?e?.geodesicArea:e?.area;if(t==null)return 1;let n=u(t,this.analysisViewData.unit),r=Math.sqrt(_(1,n.unit,`square-meters`));return _(s(Math.sqrt(n.value)/Math.sqrt(300))*r,`meters`,this._renderUnits)}_updateMeasurements(e){Object.assign(this.viewData,this._getMeasurementsViewData(e)),this._updateCheckerSize(),this._updateLabels()}_updateCheckerSize(){this._measurementArea.size=[this.viewData.checkerSize,this.viewData.checkerSize]}_updateViewData(e,t){let n=e.measurements,r=new I({validMeasurement:!!n,numVertices:e.numVertices,hasStagedVertex:e.hasStagedVertex,path:t,mode:n?.mode,vertexData:e.vertexData,perimeterLabelSegmentIndex:0,...this._getMeasurementsViewData(n)});this._viewData=r}_getMeasurementsViewData(e){let t=R(e?.mode),n=this._calculateCheckerSize(e);return{areaCentroid:t?e?.geodesicAreaCentroidRenderCoords:e?.areaCentroidRenderCoords,area:t?e?.geodesicArea:e?.area,perimeter:t?e?.geodesicPerimeter:e?.perimeter,checkerSize:n}}_updateOrigin(){let e=this.viewData;j(e.vertexData.positionsRender,this._origin),x(this._originTransform,this._origin),this._measurementArea.transform=this._originTransform,this._projectionLines.transform=this._originTransform}_createSegments(e,t){let n=this.viewData,r=this.view.renderCoordsHelper.spatialReference,i=L(n.mode),a=[],o=n.numVertices,s=n.validMeasurement?o:o-1;for(let l=0;l<s;++l){let s=n.vertexData[e][l],u=n.vertexData[e][(l+1)%o],d=!0;if(t){let e=n.vertexData.positionsRender[l],t=n.vertexData.positionsRender[(l+1)%o],r=!0;for(let n=0;n<3;++n)r&&=c(e[n],s[n])&&c(t[n],u[n]);r&&(d=!1)}let f=null;switch(i){case`geodesic`:f=new k(s,u,r,d);break;case`euclidean`:f=new A(s,u,d)}a.push(f)}return a}_updatePathSegments(){let{visible:e}=this,t=this._createSegments(`positionsRender`);this._path.setGeometryFromSegments(t,this._origin),this._path.visible=e,this._pathSegments=t}_updatePerimeterSegments(){let e=this.visible&&this.viewData.mode===`euclidean`&&!!this.viewData.path&&this.viewData.path.numVertices>2,t=this._createSegments(`positionsFittedRender`,!0);this._perimeter.setGeometryFromSegments(t,this._origin),this._perimeter.visible=e,this._perimeterSegments=t}_updateArea(){let e=this.viewData;switch(L(e.mode)){case`euclidean`:this._updateAreaEuclidean(e);break;case`geodesic`:this._updateAreaGeodesic()}}_updateAreaEuclidean(e){let t=this.visible;e.validMeasurement&&e.vertexData.triangleIndices?(this._measurementArea.geometry={uv:e.vertexData.triangleUvs,position:e.vertexData.trianglePositions,triangleIndices:e.vertexData.triangleIndices},this._updateCheckerSize(),this._measurementArea.visible=t):this._measurementArea.visible=!1}_updateAreaGeodesic(){this._measurementArea.visible=!1}_updateProjectionLines(){let e=this.viewData,t=this.visible,n=e.mode,r=e.numVertices;if(r>0&&e.validMeasurement&&n===`euclidean`){let n=[];for(let t=0;t<r;++t){let r=T();C(r,e.vertexData.positionsRender[t],this._origin);let i=T();C(i,e.vertexData.positionsFittedRender[t],this._origin),c(w(r,i),0)||n.push([r,i])}this._projectionLines.geometry=n,this._projectionLines.visible=t}else this._projectionLines.geometry=null,this._projectionLines.visible=!1}_updateLabels(){if(this.destroyed)return;let{viewData:e}=this,{area:t,path:n}=e;if(!n)return;let r=this.visible,i=this._areaLabel,a=this._perimeterLabel,o=e.validMeasurement;i.visible=!0,a.visible=!0;let s=!1,c=P(this.messages,t,this.analysisViewData.unit);if(c!=null&&e.areaCentroid&&r&&(i.geometry={type:`point`,point:e.areaCentroid},i.text=c,s=e.validMeasurement),this._set(`areaLabel`,c),r&&o){let t=R(e.mode),n=e.perimeter,r=F(this.messages,n,this.analysisViewData.unit);this._set(`perimeterLabel`,r),a.distance=this._parameters.labelDistance,a.anchor=`top`,a.text=r;let i=!0;for(let n=0;n<e.numVertices;++n){let r=(e.perimeterLabelSegmentIndex+n)%e.numVertices,o=t?this._pathSegments[r]:this._perimeterSegments[r];if(i=!0,a.geometry={type:`segment`,segment:o,sampleLocation:`center`},a.overlaps(this._areaLabel))i=!1;else break}a.visible=i}else a.visible=!1;i.visible=s}_updateMessageBundle(){this.loadingMessages=!0,n(`esri/core/t9n/Units`).then(e=>{this.messages=e,this.view&&this._update()}).finally(()=>{this.loadingMessages=!1})}};e([y()],N.prototype,`_parameters`,null),e([y()],N.prototype,`view`,void 0),e([y()],N.prototype,`messages`,void 0),e([y()],N.prototype,`analysis`,void 0),e([y()],N.prototype,`_viewData`,void 0),e([y()],N.prototype,`analysisViewData`,void 0),e([y({readOnly:!0})],N.prototype,`areaLabel`,void 0),e([y({readOnly:!0})],N.prototype,`perimeterLabel`,void 0),e([y()],N.prototype,`loadingMessages`,void 0),e([y()],N.prototype,`visible`,null),e([y()],N.prototype,`_renderUnits`,null),N=e([b(`esri.views.3d.analysis.AreaMeasurement.support.AreaMeasurementVisualization`)],N);function P(e,t,n){return e&&t&&f(e,t,v(t.value,t.unit,n))}function F(e,t,n){return e&&t&&f(e,t,d(t,n))}class I{constructor(e){this.validMeasurement=e?.validMeasurement??!1,this.numVertices=e?.numVertices??0,this.hasStagedVertex=e?.hasStagedVertex??!1,this.path=e?.path,this.vertexData=e?.vertexData??{positionsRender:[],positionsFittedWorldPlaneProjected:[],positionsFittedRender:[],triangleIndices:null,trianglePositions:[],triangleUvs:[]},this.mode=e?.mode,this.areaCentroid=e?.areaCentroid,this.perimeterLabelSegmentIndex=e?.perimeterLabelSegmentIndex??0,this.checkerSize=e?.checkerSize??1,this.area=e?.area,this.perimeter=e?.perimeter}}function L(e){switch(e){case`euclidean`:case void 0:case null:return`euclidean`;case`geodesic`:return`geodesic`}}function R(e){return L(e)===`geodesic`}export{N as AreaMeasurementVisualization,I as ViewData};
|
|
2
|
+
import{__decorate as e}from"tslib";import{onLocaleChange as t,fetchMessageBundle as n}from"../../../../../intl.js";import r from"../../../../../core/Accessor.js";import{multiplyOpacityToUnitRGBA as i,getContrast as a,multiplyOpacity as o}from"../../../../../core/colorUtils.js";import"../../../../../core/has.js";import{nextHighestPowerOfTen as s,floatEqualUlp as c}from"../../../../../core/mathUtils.js";import{destroyMaybe as l}from"../../../../../core/maybe.js";import{toAdaptiveAreaUnit as u}from"../../../../../core/quantity.js";import{formatDecimal as d}from"../../../../../core/quantityFormatUtils.js";import{watch as f,syncAndInitial as p,initial as m}from"../../../../../core/reactiveUtils.js";import{lengthUnitFromSpatialReference as h,convertUnit as g,adaptiveAreaUnit as _,adaptiveLengthUnit as v}from"../../../../../core/units.js";import{property as y,subclass as b}from"../../../../../core/accessorSupport/decorators.js";import{fromTranslation as x}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as S}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{subtract as C,squaredDistance as w}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as T}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{LabelVisualElement as E}from"../../../interactive/visualElements/LabelVisualElement.js";import{LineVisualElement as D}from"../../../interactive/visualElements/LineVisualElement.js";import{MeasurementAreaVisualElement as O}from"../../../interactive/visualElements/MeasurementAreaVisualElement.js";import{GeodesicSegment as k,EuclideanSegment as A}from"../../../interactive/visualElements/support/Segment.js";import{midpoint3d as j}from"../../../support/mathUtils.js";import{createStipplePatternSimple as M}from"../../../webgl-engine/materials/lineStippleUtils.js";let N=class extends r{get _parameters(){let{accentColor:e,textColor:t}=this.view.effectiveTheme,n=e.toUnitRGBA(),r=i(e,.5),s=i(a(e),.5),c=a(t,160);return{accentColor:n,transparentAccentColor:r,transparentContrastColor:s,textColor:t,textBackgroundColor:o(c,.6),textCalloutColor:o(c,.5),pathLineWidth:3,perimeterLineWidth:2,projectionLineWidth:2,projectionLineStippleSize:5,labelDistance:25}}get viewData(){return this._viewData}get visible(){return this.analysisViewData.visible}get _renderUnits(){let e=this.view.renderCoordsHelper.spatialReference;return h(e)??`meters`}get testData(){}constructor(e){super(e),this._path=null,this._perimeter=null,this._projectionLines=null,this._measurementArea=null,this._areaLabel=null,this._perimeterLabel=null,this._pathSegments=[],this._perimeterSegments=[],this._origin=T(),this._originTransform=S(),this.messages=null,this._viewData=new I,this.areaLabel=null,this.perimeterLabel=null,this.loadingMessages=!0}initialize(){let{analysisViewData:e,_parameters:n,view:r}=this;this._path=new D({view:r,attached:!0,width:n.pathLineWidth,polygonOffset:3,renderOccluded:4,transparentRenderOrder:1,isDecoration:!0}),this._perimeter=new D({view:r,attached:!0,width:n.perimeterLineWidth,polygonOffset:3,renderOccluded:4,transparentRenderOrder:2,isDecoration:!0}),this._projectionLines=new D({view:r,attached:!0,width:n.projectionLineWidth,stipplePattern:M(n.projectionLineStippleSize),polygonOffset:3,renderOccluded:4,transparentRenderOrder:3,isDecoration:!0}),this._measurementArea=new O({view:r,attached:!0,isDecoration:!0,renderOccluded:4,testsTransparentRenderOrder:5});let i={attached:!0,view:r,isDecoration:!0};this._areaLabel=new E({...i,fontSize:16,distance:0}),this._perimeterLabel=new E({...i,fontSize:12}),this.addHandles([f(()=>[e.mode,this.visible,e.unit,e.measurementData?.updateId,e.measurementData?.measurements!=null,L(e.measurementData?.measurements?.mode)],()=>this._update(),p),f(()=>e.measurementData?.measurements,e=>this._updateMeasurements(e)),f(()=>[r.state?.camera,e.perimeterUnit],()=>this._updateLabels(),p),t(()=>this._updateMessageBundle()),f(()=>this._parameters,({accentColor:e,transparentAccentColor:t,transparentContrastColor:n,textColor:r,textBackgroundColor:i,textCalloutColor:a})=>{let{_path:o,_perimeter:s,_projectionLines:c,_measurementArea:l,_areaLabel:u,_perimeterLabel:d}=this;o.color=e,s.color=e,c.color=e,l.color1=t,l.color2=n,u.textColor=r,u.backgroundColor=i,u.calloutColor=a,d.textColor=r,d.backgroundColor=i,d.calloutColor=a},m)]),this._updateMessageBundle()}destroy(){this._measurementArea=l(this._measurementArea),this._path=l(this._path),this._perimeter=l(this._perimeter),this._areaLabel=l(this._areaLabel),this._perimeterLabel=l(this._perimeterLabel),this._projectionLines=l(this._projectionLines),this.set(`view`,null)}_update(){if(this.destroyed||!this.view.ready)return;let{analysisViewData:{measurementData:e},analysisViewData:t}=this;e!=null&&(this._updateViewData(e,t.path),this._updateOrigin(),this._updatePathSegments(),this._updatePerimeterSegments(),this._updateArea(),this._updateProjectionLines(),this._updateLabels())}_calculateCheckerSize(e){let t=R(e?.mode)?e?.geodesicArea:e?.area;if(t==null)return 1;let n=u(t,this.analysisViewData.unit),r=Math.sqrt(g(1,n.unit,`square-meters`));return g(s(Math.sqrt(n.value)/Math.sqrt(300))*r,`meters`,this._renderUnits)}_updateMeasurements(e){Object.assign(this.viewData,this._getMeasurementsViewData(e)),this._updateCheckerSize(),this._updateLabels()}_updateCheckerSize(){this._measurementArea.size=[this.viewData.checkerSize,this.viewData.checkerSize]}_updateViewData(e,t){let n=e.measurements,r=new I({validMeasurement:!!n,numVertices:e.numVertices,hasStagedVertex:e.hasStagedVertex,path:t,mode:n?.mode,vertexData:e.vertexData,perimeterLabelSegmentIndex:0,...this._getMeasurementsViewData(n)});this._viewData=r}_getMeasurementsViewData(e){let t=R(e?.mode),n=this._calculateCheckerSize(e);return{areaCentroid:t?e?.geodesicAreaCentroidRenderCoords:e?.areaCentroidRenderCoords,area:t?e?.geodesicArea:e?.area,perimeter:t?e?.geodesicPerimeter:e?.perimeter,checkerSize:n}}_updateOrigin(){let e=this.viewData;j(e.vertexData.positionsRender,this._origin),x(this._originTransform,this._origin),this._measurementArea.transform=this._originTransform,this._projectionLines.transform=this._originTransform}_createSegments(e,t){let n=this.viewData,r=this.view.renderCoordsHelper.spatialReference,i=L(n.mode),a=[],o=n.numVertices,s=n.validMeasurement?o:o-1;for(let l=0;l<s;++l){let s=n.vertexData[e][l],u=n.vertexData[e][(l+1)%o],d=!0;if(t){let e=n.vertexData.positionsRender[l],t=n.vertexData.positionsRender[(l+1)%o],r=!0;for(let n=0;n<3;++n)r&&=c(e[n],s[n])&&c(t[n],u[n]);r&&(d=!1)}let f=null;switch(i){case`geodesic`:f=new k(s,u,r,d);break;case`euclidean`:f=new A(s,u,d)}a.push(f)}return a}_updatePathSegments(){let{visible:e}=this,t=this._createSegments(`positionsRender`);this._path.setGeometryFromSegments(t,this._origin),this._path.visible=e,this._pathSegments=t}_updatePerimeterSegments(){let e=this.visible&&this.viewData.mode===`euclidean`&&!!this.viewData.path&&this.viewData.path.numVertices>2,t=this._createSegments(`positionsFittedRender`,!0);this._perimeter.setGeometryFromSegments(t,this._origin),this._perimeter.visible=e,this._perimeterSegments=t}_updateArea(){let e=this.viewData;switch(L(e.mode)){case`euclidean`:this._updateAreaEuclidean(e);break;case`geodesic`:this._updateAreaGeodesic()}}_updateAreaEuclidean(e){let t=this.visible;e.validMeasurement&&e.vertexData.triangleIndices?(this._measurementArea.geometry={uv:e.vertexData.triangleUvs,position:e.vertexData.trianglePositions,triangleIndices:e.vertexData.triangleIndices},this._updateCheckerSize(),this._measurementArea.visible=t):this._measurementArea.visible=!1}_updateAreaGeodesic(){this._measurementArea.visible=!1}_updateProjectionLines(){let e=this.viewData,t=this.visible,n=e.mode,r=e.numVertices;if(r>0&&e.validMeasurement&&n===`euclidean`){let n=[];for(let t=0;t<r;++t){let r=T();C(r,e.vertexData.positionsRender[t],this._origin);let i=T();C(i,e.vertexData.positionsFittedRender[t],this._origin),c(w(r,i),0)||n.push([r,i])}this._projectionLines.geometry=n,this._projectionLines.visible=t}else this._projectionLines.geometry=null,this._projectionLines.visible=!1}_updateLabels(){if(this.destroyed)return;let{viewData:e}=this,{area:t,path:n}=e;if(!n)return;let r=this.visible,i=this._areaLabel,a=this._perimeterLabel,o=e.validMeasurement;i.visible=!0,a.visible=!0;let s=!1,c=P(this.messages,t,this.analysisViewData.unit);if(c!=null&&e.areaCentroid&&r&&(i.geometry={type:`point`,point:e.areaCentroid},i.text=c,s=e.validMeasurement),this._set(`areaLabel`,c),r&&o){let t=R(e.mode),n=e.perimeter,r=F(this.messages,n,this.analysisViewData.perimeterUnit);this._set(`perimeterLabel`,r),a.distance=this._parameters.labelDistance,a.anchor=`top`,a.text=r;let i=!0;for(let n=0;n<e.numVertices;++n){let r=(e.perimeterLabelSegmentIndex+n)%e.numVertices,o=t?this._pathSegments[r]:this._perimeterSegments[r];if(i=!0,a.geometry={type:`segment`,segment:o,sampleLocation:`center`},a.overlaps(this._areaLabel))i=!1;else break}a.visible=i}else a.visible=!1;i.visible=s}_updateMessageBundle(){this.loadingMessages=!0,n(`esri/core/t9n/Units`).then(e=>{this.messages=e,this.view&&this._update()}).finally(()=>{this.loadingMessages=!1})}};e([y()],N.prototype,`_parameters`,null),e([y()],N.prototype,`view`,void 0),e([y()],N.prototype,`messages`,void 0),e([y()],N.prototype,`analysis`,void 0),e([y()],N.prototype,`_viewData`,void 0),e([y()],N.prototype,`analysisViewData`,void 0),e([y({readOnly:!0})],N.prototype,`areaLabel`,void 0),e([y({readOnly:!0})],N.prototype,`perimeterLabel`,void 0),e([y()],N.prototype,`loadingMessages`,void 0),e([y()],N.prototype,`visible`,null),e([y()],N.prototype,`_renderUnits`,null),N=e([b(`esri.views.3d.analysis.AreaMeasurement.support.AreaMeasurementVisualization`)],N);function P(e,t,n){return e&&t&&d(e,t,_(t.value,t.unit,n))}function F(e,t,n){return e&&t&&d(e,t,v(t.value,t.unit,n))}class I{constructor(e){this.validMeasurement=e?.validMeasurement??!1,this.numVertices=e?.numVertices??0,this.hasStagedVertex=e?.hasStagedVertex??!1,this.path=e?.path,this.vertexData=e?.vertexData??{positionsRender:[],positionsFittedWorldPlaneProjected:[],positionsFittedRender:[],triangleIndices:null,trianglePositions:[],triangleUvs:[]},this.mode=e?.mode,this.areaCentroid=e?.areaCentroid,this.perimeterLabelSegmentIndex=e?.perimeterLabelSegmentIndex??0,this.checkerSize=e?.checkerSize??1,this.area=e?.area,this.perimeter=e?.perimeter}}function L(e){switch(e){case`euclidean`:case void 0:case null:return`euclidean`;case`geodesic`:return`geodesic`}}function R(e){return L(e)===`geodesic`}export{N as AreaMeasurementVisualization,I as ViewData};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import"../../../core/has.js";import{abortMaybe as t,destroyMaybe as n}from"../../../core/maybe.js";import{
|
|
2
|
+
import{__decorate as e}from"tslib";import"../../../core/has.js";import{abortMaybe as t,destroyMaybe as n}from"../../../core/maybe.js";import{toAdaptiveLengthUnit as r,toAdaptiveAreaUnit as i}from"../../../core/quantity.js";import{property as a,subclass as o}from"../../../core/accessorSupport/decorators.js";import{getDefaultUnitForView as s}from"../../../support/getDefaultUnitForView.js";import c from"./AnalysisView3D.js";import{AreaMeasurementController as l}from"./AreaMeasurement/support/AreaMeasurementController.js";import{AreaMeasurement3DPathHelper as u}from"./AreaMeasurement/support/AreaMeasurementPathHelper.js";import{AreaMeasurementVisualization as d}from"./AreaMeasurement/support/AreaMeasurementVisualization.js";import f from"../interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DTool.js";import{connectAnalysisViewToTool as p,removeAnalysisViewTool as m,startPlaceOperation as h}from"../../analysis/analysisViewUtils.js";let g=class extends c{constructor(e){super(e),this.type=`area-measurement-view-3d`,this.analysis=null,this.measurementData=null,this.lastDraggedVertex=null,this.stagedPoint=null,this.mode=0,this.tool=null,this.userOperation=null}initialize(){let{analysis:e,view:t}=this;this.path=new u({view:t,areaMeasurement:e}),this._analysisVisualization=new d({view:t,analysis:e,analysisViewData:this}),this._analysisController=new l({view:t,analysis:e,analysisViewData:this}),this.addHandles(p(this,f))}destroy(){m(this),this.userOperation=t(this.userOperation),this._analysisController=n(this._analysisController),this._analysisVisualization=n(this._analysisVisualization),this.path.destroy()}get visible(){return super.visible}set visible(e){super.visible=e}get interactive(){return super.interactive}set interactive(e){super.interactive=e}get updating(){return!!this._analysisVisualization?.loadingMessages||!!this._analysisController?.updating}get result(){let e=this.measurementData?.measurements;if(!e)return null;let{perimeterUnit:t,unit:n}=this,{mode:a}=e,o=a===`geodesic`,s=o?e.geodesicArea:e.area,c=o?e.geodesicPerimeter:e.perimeter;return{mode:a,area:s?i(s,n):null,perimeter:c?r(c,t):null}}get viewData(){return this._analysisVisualization.viewData}get areaLabel(){return this._analysisVisualization.areaLabel}get perimeterLabel(){return this._analysisVisualization.perimeterLabel}get validMeasurement(){return this.path.isValidPolygon}get unit(){return this.analysis.unit??this.view.options.displayUnits.area??s(this.view)}get perimeterUnit(){return this.analysis.perimeterUnit??this.view.options.displayUnits.length??s(this.view)}get testData(){}place(e){return h(this,{placementOptions:e})}};e([a()],g.prototype,`_analysisVisualization`,void 0),e([a()],g.prototype,`_analysisController`,void 0),e([a({readOnly:!0})],g.prototype,`type`,void 0),e([a({constructOnly:!0,nonNullable:!0})],g.prototype,`analysis`,void 0),e([a()],g.prototype,`updating`,null),e([a()],g.prototype,`result`,null),e([a()],g.prototype,`measurementData`,void 0),e([a()],g.prototype,`viewData`,null),e([a()],g.prototype,`areaLabel`,null),e([a()],g.prototype,`perimeterLabel`,null),e([a()],g.prototype,`validMeasurement`,null),e([a()],g.prototype,`path`,void 0),e([a()],g.prototype,`lastDraggedVertex`,void 0),e([a()],g.prototype,`stagedPoint`,void 0),e([a()],g.prototype,`mode`,void 0),e([a()],g.prototype,`unit`,null),e([a()],g.prototype,`perimeterUnit`,null),e([a()],g.prototype,`tool`,void 0),e([a()],g.prototype,`userOperation`,void 0),g=e([o(`esri.views.3d.analysis.AreaMeasurementAnalysisView3D`)],g);const _=g;export{_ as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/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{screenPointObjectToArray as n}from"../../../../core/screenUtils.js";import{property as r,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{copy as a,normalize as o,scaleAndAdd as s,scale as c,add as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as u,clone as d,create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import p from"../../../../geometry/Point.js";import{create as m,fromPoints as h,copy as g}from"../../../../geometry/support/ray.js";import{sv2d as _}from"../../../../geometry/support/vectorStacks.js";import{IntegratedMeshSemantics as v}from"../../../../layers/support/IntegratedMeshSemantics.js";import{LineOfSightIntersectionResult as y,lineOfSightIntersectionContextGaussianSplat as b,lineOfSightIntersectionContextGround as x,LineOfSightIntersectionContextGraphic as S}from"./LineOfSightIntersectionResult.js";import{isGaussianSplatIntersectorResult as C}from"../../layers/i3s/Intersector.js";import{fromScreen as w}from"../../support/geometryUtils/ray.js";import{isTerrainIntersectorResult as T,isIntegratedMeshIntersectorResult as E}from"../../terrain/Intersector.js";import{Intersector as D}from"../../webgl-engine/lib/Intersector.js";import{toGraphic as O}from"../../webgl-engine/lib/intersectorUtilsConversions.js";import{terrainId as k}from"../../webgl-engine/lib/verticalOffsetUtils.js";import{isIntegratedMeshLayerView as A}from"../../../support/layerViewUtils.js";let j=class extends t{constructor(e){super(e)}initialize(){this.intersector=new D(this.view.state.viewingMode),this.intersector.options.hud=!1,this.intersector.options.store=0}get _integratedMeshLayerViews(){return this.view.allLayerViews.items.filter(A)}get _terrainIntersectionOptionsLayerUids(){return new Set([k,...this._integratedMeshLayerViews.filter(e=>v.shouldIntersectAsGround(e.layer)).map(e=>e.uid)])}getScreenPointIntersection(e){let t=n(e,_.get()),r=w(this.view.state.camera,t,I);return this._getRayIntersection(r)}getMapPointIntersection(e){let t=u(e.x,e.y,e.z??0);if(!this.view.renderCoordsHelper.toRenderCoords(t,e.spatialReference,t))return null;let n=this.view.state.camera.eye;return h(n,t,I),this._getRayIntersection(I)}_getRayIntersection(e,t){let{view:n,intersector:r}=this;if(e==null||n.sceneIntersectionHelper==null)return null;r.options.store=0,n.sceneIntersectionHelper.intersectToolIntersectorRay(e,r,t);let i=r.results.min;if(i.target==null)return null;let a=f();if(!i.getIntersectionPoint(a)||t?.maxDistance!=null&&!i.withinDistance(t.maxDistance))return null;let o=n.renderCoordsHelper.fromRenderCoords(a,new p({spatialReference:n.spatialReference}));if(C(i))return new y({context:b,id:`${i.target.layerViewUid}`,mapPoint:o,renderPoint:a,normal:d(i.target.outwardDirection),ray:g(e)});let s=d(i.normal);if(T(i))return new y({context:x,id:i.target.lij.slice(),mapPoint:o,renderPoint:a,normal:s,ray:g(e)});if(E(n,i))return new y({context:x,id:`${i.target.layerViewUid}`,mapPoint:o,renderPoint:a,normal:s,ray:g(e)});let c=O(i,n);if(c!=null){let{layer:t}=c,n=c.getObjectId()??c.uid;return new y({context:new S(c),id:`${t?.uid}/${n}`,mapPoint:o,renderPoint:a,normal:s,ray:g(e)})}let l=`layerViewUid`in i.target?`${i.target.layerViewUid}`:``;return new y({context:null,id:l,mapPoint:o,renderPoint:a,normal:s,ray:g(e)})}updateFromGroundIntersection(e,t,n){let r=M,i=N,u=P;a(i,e),this.view.renderCoordsHelper.worldUpAtPosition(i,u),o(u,u);let f=this.view.groundView?.visibleElevationRange,p=f?Math.abs(f.maxElevation-f.minElevation):100,m=(t>=0?1:-1)*(p+Math.abs(t)),g=m*.001;s(r,i,u,m-g),s(i,i,u,g),h(r,i,I);let _=this._getRayIntersection(I,{include:this._terrainIntersectionOptionsLayerUids,maxDistance:m});if(_!=null){let e=F;return c(e,u,t),l(n,_.renderPoint,e),d(_.normal)}return a(n,e),null}};e([r()],j.prototype,`view`,void 0),e([r()],j.prototype,`intersector`,void 0),e([r()],j.prototype,`_integratedMeshLayerViews`,null),e([r()],j.prototype,`_terrainIntersectionOptionsLayerUids`,null),j=e([i(`esri.views.3d.analysis.LineOfSight.LineOfSightRayIntersector`)],j);const M=f(),N=f(),P=f(),F=f(),I=m();export{j as LineOfSightRayIntersector};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{isSome as t,equals as n}from"../../../core/arrayUtils.js";import{createTask as r}from"../../../core/asyncUtils.js";import i from"../../../core/Error.js";import"../../../core/has.js";import a from"../../../core/Logger.js";import{abortMaybe as o,destroyMaybe as s}from"../../../core/maybe.js";import{after as c,throwIfAborted as l,isPromiseLike as u}from"../../../core/promiseUtils.js";import{watch as d,syncAndInitial as f}from"../../../core/reactiveUtils.js";import{createScreenPointArray as p,createRenderScreenPointArray as m}from"../../../core/screenUtils.js";import{convertTime as h}from"../../../core/timeUtils.js";import{property as g,subclass as _}from"../../../core/accessorSupport/decorators.js";import{create as v}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as y}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{UpdatingHandles as b}from"../../../core/support/UpdatingHandles.js";import{projectAsync as x}from"../../../geometry/projectionUtils.js";import{containsExecute as S}from"../../../geometry/operators/containsOperator.js";import{equals as C}from"../../../geometry/support/boundedPlane.js";import{polygonToVolume as w}from"../focusAreaUtils.js";import T from"./AnalysisView3D.js";import{registerAnalysisView as E,hideOtherAnalysisViews as D}from"./ShadowCast/analysisViewRegister.js";import O from"./ShadowCast/ShadowCastError.js";import{ShadowCastTooltip as k}from"./ShadowCast/ShadowCastTooltip.js";import{getSunlightIntervals as A,getDateTimeUTC as j}from"./ShadowCast/sunlightUtils.js";import{ElevationContext as M}from"../layers/graphics/ElevationContext.js";import{longitudeToTimezone as N}from"../support/earthUtils.js";import{computeDirectionsOverTime as P}from"../support/sunUtils.js";import{maxColorRampSize as F}from"../webgl-engine/shaders/colorRampParameters.js";import{breadthFirstBinaryPartitioning as I}from"../../../widgets/support/traversalUtils.js";let L=class extends T{constructor(e){super(e),this.type=`shadow-cast-view-3d`,this.analysis=null,this._updatingHandles=new b,this._visibleOverride=null,this._stopPreviewingTask=null,this._updatedRecently=!1,this._tooltip=null,this._previousVolume=null}initialize(){this.addHandles([E(this.view,this),d(()=>({dependencies:this._previewDependencies,sceneUpdating:this._sceneUpdating}),()=>{o(this._stopPreviewingTask),this._updatedRecently=!0,this._stopPreviewingTask=r(async e=>{await c(W,e),l(e),this._updatedRecently=!1})},{sync:!0,initial:!0,equals:(e,t)=>H(e.dependencies,t.dependencies)&&(e.sceneUpdating===t.sceneUpdating||!e.sceneUpdating)}),d(()=>({renderer:this._renderer,visible:this.visible}),({renderer:e,visible:t},n)=>{t&&D(this.view,this),(t||n?.visible)&&e?.setParameters({shadowCast:{enabled:t}})},f),d(()=>({renderer:this._renderer,parameters:this._visualizationParameters,visible:this.visible}),({renderer:e,parameters:t,visible:n})=>{z(e,n,t)},f),d(()=>({renderer:this._renderer,lightDirections:this._lightDirections,lightDirectionsContext:this._lightDirectionsContext,visible:this.visible}),({renderer:e,lightDirections:t,lightDirectionsContext:n,visible:r})=>{z(e,r,{lightDirections:t,lightDirectionsContext:n})},f),d(()=>({renderer:this._renderer,previewing:this._previewing,visible:this.visible}),({renderer:e,previewing:t,visible:n})=>{z(e,n,{previewing:t})},{sync:!0,initial:!0,equals:()=>!1}),d(()=>({analysisVolume:this._analysisVolume,renderer:this._renderer,visible:this.visible}),({renderer:e,visible:t,analysisVolume:n})=>{z(e,t,{analysisVolume:n})},f)]),this.interactive=!0,this._tooltip=new k({getDuration:(e,t)=>this._getDurationAtScreen(e,t),getMode:()=>this.analysis.mode,getShowsSeparateZeroBucketInHourlyMode:()=>this._showsSeparateZeroBucketInHourlyMode,getTotalDuration:()=>this._totalDuration,getTotalDurationMode:()=>this.analysis.totalDurationOptions.mode,getVisualizeSunlight:()=>this.analysis.visualizeSunlight,isVisible:()=>this.interactive&&this.visible,view:this.view})}destroy(){this.visible&&z(this._renderer,!0,{enabled:!1}),this._tooltip=s(this._tooltip),this._stopPreviewingTask=o(this._stopPreviewingTask),this._updatingHandles=s(this._updatingHandles)}get interactive(){return super.interactive}set interactive(e){super.interactive=e}get updating(){return this._previewing||this._stopPreviewingTask!=null&&!this._stopPreviewingTask.finished||this._tooltip?.updating===!0||this._updatingHandles.updating}get visible(){let e=(this.parent?.visible&&!this.parent.suspended)??!0;return(this._visibleOverride??e)&&this.error==null}set visible(e){this._visibleOverride=e}get error(){let e=this._sunlightIntervals;switch(e.state){case`ready`:break;case`unavailable`:return new O(e.state,`The camera's geographic reference position is not available.`);default:return new O(e.state,`The selected date, time zone, or daylight calculation could not be resolved.`)}let{startTimeOfDay:t,endTimeOfDay:n}=this.analysis;if(!Number.isFinite(t)||!Number.isFinite(n)||t<0||n>h(1,`days`,`milliseconds`)||n<t)return new O(`invalid`,`The selected time range must be ordered and within the calendar day.`);let r=this._startDateTimeUTC.getTime(),i=this._endDateTimeUTC.getTime();if(!Number.isFinite(r)||!Number.isFinite(i)||i<r)return new O(`invalid`,`The selected time range could not be resolved to ordered UTC instants.`);let{intervals:a}=e;return a.length?a.some(e=>r>=e.start&&i<=e.end)?null:a.length>1?new O(`split-daylight`,`Daylight crosses midnight in the selected time zone and the selected time range includes nighttime.`):new O(`outside-daylight`,`The selected time range includes nighttime at the current camera location.`):new O(`no-daylight`,`No daylight is expected at the current camera location on the selected date.`)}get _sunlightIntervals(){let{date:e}=this.analysis,t=this._timeZone;return A({date:e,timeZone:t,utcOffset:t==null?this._effectiveUtcOffset:0,position:this._referencePosition})}get _previewing(){let e=this._updatedRecently,t=this._sceneUpdating;return e||t}get _sceneUpdating(){let{view:e}=this;if(e?.allLayerViews==null)return!0;let{stationary:t,navigating:n,interacting:r,graphicsView:i}=e,a=!t||n||r,o=this._shadowLayerViews.some(e=>e.updating),s=!i?.suspended&&!!i?.updating;return a||o||s}get _timeZone(){return this.analysis.timeZoneMode===`region`?this.view.timeZone:null}get _effectiveUtcOffset(){return this.analysis.utcOffset??this._utcOffsetAuto}get _utcOffsetAuto(){let e=this._referencePosition;return e==null?0:N(e[0],!1)}get _startDateTimeUTC(){return this._getDateTimeUTC(this.analysis.startTimeOfDay)}get _endDateTimeUTC(){return this._getDateTimeUTC(this.analysis.endTimeOfDay)}_getDateTimeUTC(e){let{date:t}=this.analysis,n=this._timeZone,r=j(t,e,n,n==null?this._effectiveUtcOffset:0);if(r==null)throw RangeError(`Invalid shadow cast date or time zone`);return r}get _referencePosition(){return this.view?.environmentView?.referencePositionGeographic}get _totalDurationInterval(){return this._totalDuration>0?Math.floor(this._totalDuration/(G-1)):G}get _interval(){let e=this._totalDurationInterval;switch(this.analysis.mode){case`min-duration`:return this._totalDuration>0?e:0;case`total-duration`:return e;case`discrete`:return this.analysis.discreteOptions.interval||e}}get _intervalContext(){let{mode:e,minDurationOptions:t}=this.analysis;return e===`min-duration`&&t.contextEnabled?t.contextOptions.interval||this._totalDurationInterval:-1}get _totalDurationSampleCount(){return this._lightDirections.length}get _totalDuration(){return this._endDateTimeUTC.getTime()-this._startDateTimeUTC.getTime()}get _lightDirections(){return this.error==null?this._calculateLightDirections(this._interval):[]}get _lightDirectionsContext(){return this.error==null?this._calculateLightDirections(this._intervalContext):[]}_calculateLightDirections(e){let{view:t}=this;if(e<=0)return[];let n=t.viewingMode===`global`?K:this._referencePosition;if(n==null)return[];let r=P(this._startDateTimeUTC,this._endDateTimeUTC,e,n,t.state.viewingMode,G),i=r.length;q.length=0;let a=I(0,i,q),o=Array(i);for(let e=0;e<i;++e)o[e]=r[a[e]];return o}get _analysisVolume(){let{geometry:e}=this.analysis;if(e==null)return this._previousVolume=null,null;try{let t=w(e,this.view,J);return t==null?(this._previousVolume=null,null):u(t)?(this._updatingHandles.consumePromise(t),this._previousVolume):(this._previousVolume=t,t)}catch(t){return a.getLogger(this).error(new i(`shadowcastanalysisview3d:projection-failed`,`Failed to project analysis area geometry to view spatial reference`,{geometry:e,error:t})),null}}get _visualizationParameters(){if(!this.visible)return null;switch(this.analysis.mode){case`min-duration`:return this._minDurationVisualizationParameters;case`total-duration`:return this._durationVisualizationParameters;case`discrete`:return this._discreteVisualizationParameters}}get _minDurationVisualizationParameters(){let{color:e,minDuration:t}=this.analysis.minDurationOptions,n=this._totalDuration;return{rendersSunlight:this.analysis.visualizeSunlight,visualization:2,thresholdColor:e.toUnitRGBA(),threshold:n>0?t/this._totalDuration:0,...this._minDurationContextVisualizationParameters}}get _minDurationContextVisualizationParameters(){let{minDurationOptions:e,visualizeSunlight:t}=this.analysis;if(!e.contextEnabled||t)return{};let{color:n,colorStops:r}=e.contextOptions,i=1/this._lightDirectionsContext.length;return{visualization:3,gradientColorRamp:this._getEffectiveShadowCastColorRamp(n,r,i)}}get _durationVisualizationParameters(){let{color:e,colorStops:t,mode:n}=this.analysis.totalDurationOptions,r=this._totalDuration,i=r>0&&n===`hourly`?U/r:0,a=this._getEffectiveShadowCastColorRamp(e,t,1/r);return i===0?{...this._discreteVisualizationParameters,gradientColorRamp:a}:{rendersSunlight:this.analysis.visualizeSunlight,bandedGradientColorRamp:a,visualization:1,bandSize:i}}get _showsSeparateZeroBucketInHourlyMode(){let{colorStops:e}=this.analysis.totalDurationOptions;return e==null||e.length===0||e.reduce((e,t)=>Math.min(e,t.value),1/0)<=0}get _discreteVisualizationParameters(){let{color:e,colorStops:t}=this.analysis.discreteOptions,n=1/this._lightDirections.length;return{rendersSunlight:this.analysis.visualizeSunlight,gradientColorRamp:this._getEffectiveShadowCastColorRamp(e,t,n),visualization:0}}get _shadowLayerViews(){return this.view.allLayerViews.items.filter(V)}get _previewDependencies(){if(this.error!=null)return null;let{view:e}=this,n=e.slice.plane,r=this._shadowLayerViews,i=r.map(e=>e.layer).filter(t),a=r.map(e=>e.suspended),o=i.map(e=>e.visible),s=i.map(e=>e.opacity),c=!!e.graphicsView?.suspended,l=i.filter(e=>`definitionExpression`in e).map(e=>e.definitionExpression),u=r.filter(e=>`filter`in e).map(e=>e.filter);return{slicePlane:n,startDateUTC:this._startDateTimeUTC,endDateUTC:this._endDateTimeUTC,layerViewSuspended:a,graphicsViewSuspended:c,layerVisibilities:o,layerOpacities:s,filters:u,definitionExpressions:l}}get _renderer(){return this.view?.stage?.renderer}get testData(){}async getDurationAtScreen(e){return this._getDurationAtScreen(e)}async _getDurationAtScreen(e,t){if(!await this._isScreenPointInAnalysisArea(e,t))return-1;let{_renderer:n,_totalDurationSampleCount:r}=this;if(n==null||r===0)return 0;let i=this.view.state.camera.screenToRender(p(e.x,e.y),m()),a=n.readAccumulatedShadow(i);return(this.analysis.visualizeSunlight?1-a:a)*this._totalDuration}async _isScreenPointInAnalysisArea(e,t){let{geometry:n}=this.analysis;if(!n)return!0;let r=await this.view.hitTest(e);l(t);let i=r.results.find(e=>e.mapPoint)?.mapPoint??r?.ground?.mapPoint;if(!i)return!1;let a=await x(i,n.spatialReference,{signal:t});return l(t),a!=null&&S(n,a)}_getEffectiveShadowCastColorRamp(e,t,n){if(t!=null){t.length>F&&a.getLogger(this).warnOnce(`ShadowCastAnalysis supports at most 8 color stops`);let e=t.map(e=>[e.value*n,e.color.toUnitRGBA()]);return e.sort(([e],[t])=>e-t),e}return B(e)}};e([g({readOnly:!0,type:[`shadow-cast-view-3d`]})],L.prototype,`type`,void 0),e([g({constructOnly:!0,nonNullable:!0})],L.prototype,`analysis`,void 0),e([g({readOnly:!0})],L.prototype,`updating`,null),e([g()],L.prototype,`visible`,null),e([g()],L.prototype,`error`,null),e([g()],L.prototype,`_visibleOverride`,void 0),e([g()],L.prototype,`_sunlightIntervals`,null),e([g()],L.prototype,`_stopPreviewingTask`,void 0),e([g()],L.prototype,`_updatedRecently`,void 0),e([g()],L.prototype,`_tooltip`,void 0),e([g()],L.prototype,`_sceneUpdating`,null),e([g()],L.prototype,`_timeZone`,null),e([g()],L.prototype,`_effectiveUtcOffset`,null),e([g()],L.prototype,`_utcOffsetAuto`,null),e([g()],L.prototype,`_startDateTimeUTC`,null),e([g()],L.prototype,`_endDateTimeUTC`,null),e([g()],L.prototype,`_referencePosition`,null),e([g()],L.prototype,`_interval`,null),e([g()],L.prototype,`_intervalContext`,null),e([g()],L.prototype,`_totalDurationSampleCount`,null),e([g()],L.prototype,`_totalDuration`,null),e([g()],L.prototype,`_lightDirections`,null),e([g()],L.prototype,`_lightDirectionsContext`,null),e([g()],L.prototype,`_analysisVolume`,null),e([g()],L.prototype,`_visualizationParameters`,null),e([g()],L.prototype,`_minDurationVisualizationParameters`,null),e([g()],L.prototype,`_minDurationContextVisualizationParameters`,null),e([g()],L.prototype,`_durationVisualizationParameters`,null),e([g()],L.prototype,`_showsSeparateZeroBucketInHourlyMode`,null),e([g()],L.prototype,`_discreteVisualizationParameters`,null),e([g()],L.prototype,`_shadowLayerViews`,null),e([g()],L.prototype,`_previewDependencies`,null),e([g()],L.prototype,`_renderer`,null),L=e([_(`esri.views.3d.analysis.ShadowCastAnalysisView3D`)],L);const R=L;function z(e,t,n){t&&n!=null&&e?.setParameters({shadowCast:n})}function B(e){let t=e.toUnitRGBA();return[[0,y(t[0],t[1],t[2],0)],[1,t]]}function V(e){if(e.suspended)return!1;switch(e.type){case`building-scene-3d`:case`csv-3d`:case`elevation-3d`:case`feature-3d`:case`gaussian-splat-3d`:case`geojson-3d`:case`integrated-mesh-3d`:case`integrated-mesh-3dtiles`:case`ogc-feature-3d`:case`route-3d`:case`scene-layer-3d`:case`scene-layer-graphics-3d`:case`stream-3d`:case`wms-3d`:case`catalog-footprint-3d`:return!0;case`base-dynamic-3d`:case`catalog-3d`:case`catalog-dynamic-group-3d`:case`dimension-3d`:case`imagery-3d`:case`imagery-tile-3d`:case`line-of-sight-3d`:case`map-image-3d`:case`point-cloud-3d`:case`tile-3d`:case`vector-tile-3d`:case`viewshed-3d`:case`voxel-3d`:case`wfs-3d`:case`wmts-3d`:case`media-3d`:case`group`:return!1;case`graphics-3d`:return e.layer.graphics.some(e=>{let{symbol:t}=e;return t==null||t.type!==`text`&&!(`symbolLayers`in t)||t.type!==`text`&&t.symbolLayers.some(e=>e.type!==`text`)});default:return!1}}function H(e,t){if(e===t||e==null&&t==null)return!0;if(e==null||t==null)return!1;let r=C(e.slicePlane,t.slicePlane),i=e.startDateUTC.valueOf()===t.startDateUTC.valueOf()&&e.endDateUTC.valueOf()===t.endDateUTC.valueOf(),a=n(e.layerViewSuspended,t.layerViewSuspended)&&e.graphicsViewSuspended===t.graphicsViewSuspended,o=n(e.layerVisibilities,t.layerVisibilities),s=n(e.layerOpacities,t.layerOpacities),c=n(e.filters,t.filters),l=n(e.definitionExpressions,t.definitionExpressions);return r&&i&&a&&o&&s&&c&&l}const U=h(1,`hours`,`milliseconds`),W=500,G=255,K=v(),q=[],J=new M;export{R as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import{isSome as t,equals as n}from"../../../core/arrayUtils.js";import{createTask as r}from"../../../core/asyncUtils.js";import i from"../../../core/Error.js";import"../../../core/has.js";import a from"../../../core/Logger.js";import{abortMaybe as o,destroyMaybe as s}from"../../../core/maybe.js";import{after as c,throwIfAborted as l,isPromiseLike as u}from"../../../core/promiseUtils.js";import{watch as d,syncAndInitial as f}from"../../../core/reactiveUtils.js";import{createScreenPointArray as p,createRenderScreenPointArray as m}from"../../../core/screenUtils.js";import{convertTime as h,getDateTimeUTC as g}from"../../../core/timeUtils.js";import{property as _,subclass as v}from"../../../core/accessorSupport/decorators.js";import{create as y}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as b}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{UpdatingHandles as x}from"../../../core/support/UpdatingHandles.js";import{projectAsync as S}from"../../../geometry/projectionUtils.js";import{containsExecute as C}from"../../../geometry/operators/containsOperator.js";import{equals as w}from"../../../geometry/support/boundedPlane.js";import{getSunlightIntervals as T}from"../../../time/daylightUtils.js";import{polygonToVolume as E}from"../focusAreaUtils.js";import D from"./AnalysisView3D.js";import{registerAnalysisView as O,hideOtherAnalysisViews as k}from"./ShadowCast/analysisViewRegister.js";import A from"./ShadowCast/ShadowCastError.js";import{ShadowCastTooltip as j}from"./ShadowCast/ShadowCastTooltip.js";import{ElevationContext as M}from"../layers/graphics/ElevationContext.js";import{longitudeToTimezone as N}from"../support/earthUtils.js";import{computeDirectionsOverTime as P}from"../support/sunUtils.js";import{maxColorRampSize as F}from"../webgl-engine/shaders/colorRampParameters.js";import{breadthFirstBinaryPartitioning as I}from"../../../widgets/support/traversalUtils.js";let L=class extends D{constructor(e){super(e),this.type=`shadow-cast-view-3d`,this.analysis=null,this._updatingHandles=new x,this._visibleOverride=null,this._stopPreviewingTask=null,this._updatedRecently=!1,this._tooltip=null,this._previousVolume=null}initialize(){this.addHandles([O(this.view,this),d(()=>({dependencies:this._previewDependencies,sceneUpdating:this._sceneUpdating}),()=>{o(this._stopPreviewingTask),this._updatedRecently=!0,this._stopPreviewingTask=r(async e=>{await c(W,e),l(e),this._updatedRecently=!1})},{sync:!0,initial:!0,equals:(e,t)=>H(e.dependencies,t.dependencies)&&(e.sceneUpdating===t.sceneUpdating||!e.sceneUpdating)}),d(()=>({renderer:this._renderer,visible:this.visible}),({renderer:e,visible:t},n)=>{t&&k(this.view,this),(t||n?.visible)&&e?.setParameters({shadowCast:{enabled:t}})},f),d(()=>({renderer:this._renderer,parameters:this._visualizationParameters,visible:this.visible}),({renderer:e,parameters:t,visible:n})=>{z(e,n,t)},f),d(()=>({renderer:this._renderer,lightDirections:this._lightDirections,lightDirectionsContext:this._lightDirectionsContext,visible:this.visible}),({renderer:e,lightDirections:t,lightDirectionsContext:n,visible:r})=>{z(e,r,{lightDirections:t,lightDirectionsContext:n})},f),d(()=>({renderer:this._renderer,previewing:this._previewing,visible:this.visible}),({renderer:e,previewing:t,visible:n})=>{z(e,n,{previewing:t})},{sync:!0,initial:!0,equals:()=>!1}),d(()=>({analysisVolume:this._analysisVolume,renderer:this._renderer,visible:this.visible}),({renderer:e,visible:t,analysisVolume:n})=>{z(e,t,{analysisVolume:n})},f)]),this.interactive=!0,this._tooltip=new j({getDuration:(e,t)=>this._getDurationAtScreen(e,t),getMode:()=>this.analysis.mode,getShowsSeparateZeroBucketInHourlyMode:()=>this._showsSeparateZeroBucketInHourlyMode,getTotalDuration:()=>this._totalDuration,getTotalDurationMode:()=>this.analysis.totalDurationOptions.mode,getVisualizeSunlight:()=>this.analysis.visualizeSunlight,isVisible:()=>this.interactive&&this.visible,view:this.view})}destroy(){this.visible&&z(this._renderer,!0,{enabled:!1}),this._tooltip=s(this._tooltip),this._stopPreviewingTask=o(this._stopPreviewingTask),this._updatingHandles=s(this._updatingHandles)}get interactive(){return super.interactive}set interactive(e){super.interactive=e}get updating(){return this._previewing||this._stopPreviewingTask!=null&&!this._stopPreviewingTask.finished||this._tooltip?.updating===!0||this._updatingHandles.updating}get visible(){let e=(this.parent?.visible&&!this.parent.suspended)??!0;return(this._visibleOverride??e)&&this.error==null}set visible(e){this._visibleOverride=e}get error(){let e=this._sunlightIntervals;switch(e.state){case`ready`:break;case`unavailable`:return new A(e.state,`The camera's geographic reference position is not available.`);default:return new A(e.state,`The selected date, time zone, or daylight calculation could not be resolved.`)}let{startTimeOfDay:t,endTimeOfDay:n}=this.analysis;if(!Number.isFinite(t)||!Number.isFinite(n)||t<0||n>h(1,`days`,`milliseconds`)||n<t)return new A(`invalid`,`The selected time range must be ordered and within the calendar day.`);let r=this._startDateTimeUTC.getTime(),i=this._endDateTimeUTC.getTime();if(!Number.isFinite(r)||!Number.isFinite(i)||i<r)return new A(`invalid`,`The selected time range could not be resolved to ordered UTC instants.`);let{intervals:a}=e;return a.length?a.some(e=>r>=e.start&&i<=e.end)?null:a.length>1?new A(`split-daylight`,`Daylight crosses midnight in the selected time zone and the selected time range includes nighttime.`):new A(`outside-daylight`,`The selected time range includes nighttime at the current camera location.`):new A(`no-daylight`,`No daylight is expected at the current camera location on the selected date.`)}get _sunlightIntervals(){let{date:e}=this.analysis,t=this._timeZone;return T({date:e,timeZone:t,utcOffset:t==null?this._effectiveUtcOffset:0,position:this._referencePosition})}get _previewing(){let e=this._updatedRecently,t=this._sceneUpdating;return e||t}get _sceneUpdating(){let{view:e}=this;if(e?.allLayerViews==null)return!0;let{stationary:t,navigating:n,interacting:r,graphicsView:i}=e,a=!t||n||r,o=this._shadowLayerViews.some(e=>e.updating),s=!i?.suspended&&!!i?.updating;return a||o||s}get _timeZone(){return this.analysis.timeZoneMode===`region`?this.view.timeZone:null}get _effectiveUtcOffset(){return this.analysis.utcOffset??this._utcOffsetAuto}get _utcOffsetAuto(){let e=this._referencePosition;return e==null?0:N(e[0],!1)}get _startDateTimeUTC(){return this._getDateTimeUTC(this.analysis.startTimeOfDay)}get _endDateTimeUTC(){return this._getDateTimeUTC(this.analysis.endTimeOfDay)}_getDateTimeUTC(e){let{date:t}=this.analysis,n=this._timeZone,r=g({date:t,millisecondsSinceMidnight:e,timeZone:n,utcOffset:n==null?this._effectiveUtcOffset:0});if(r==null)throw RangeError(`Invalid shadow cast date or time zone`);return r}get _referencePosition(){return this.view?.environmentView?.referencePositionGeographic}get _totalDurationInterval(){return this._totalDuration>0?Math.floor(this._totalDuration/(G-1)):G}get _interval(){let e=this._totalDurationInterval;switch(this.analysis.mode){case`min-duration`:return this._totalDuration>0?e:0;case`total-duration`:return e;case`discrete`:return this.analysis.discreteOptions.interval||e}}get _intervalContext(){let{mode:e,minDurationOptions:t}=this.analysis;return e===`min-duration`&&t.contextEnabled?t.contextOptions.interval||this._totalDurationInterval:-1}get _totalDurationSampleCount(){return this._lightDirections.length}get _totalDuration(){return this._endDateTimeUTC.getTime()-this._startDateTimeUTC.getTime()}get _lightDirections(){return this.error==null?this._calculateLightDirections(this._interval):[]}get _lightDirectionsContext(){return this.error==null?this._calculateLightDirections(this._intervalContext):[]}_calculateLightDirections(e){let{view:t}=this;if(e<=0)return[];let n=t.viewingMode===`global`?K:this._referencePosition;if(n==null)return[];let r=P(this._startDateTimeUTC,this._endDateTimeUTC,e,n,t.state.viewingMode,G),i=r.length;q.length=0;let a=I(0,i,q),o=Array(i);for(let e=0;e<i;++e)o[e]=r[a[e]];return o}get _analysisVolume(){let{geometry:e}=this.analysis;if(e==null)return this._previousVolume=null,null;try{let t=E(e,this.view,J);return t==null?(this._previousVolume=null,null):u(t)?(this._updatingHandles.consumePromise(t),this._previousVolume):(this._previousVolume=t,t)}catch(t){return a.getLogger(this).error(new i(`shadowcastanalysisview3d:projection-failed`,`Failed to project analysis area geometry to view spatial reference`,{geometry:e,error:t})),null}}get _visualizationParameters(){if(!this.visible)return null;switch(this.analysis.mode){case`min-duration`:return this._minDurationVisualizationParameters;case`total-duration`:return this._durationVisualizationParameters;case`discrete`:return this._discreteVisualizationParameters}}get _minDurationVisualizationParameters(){let{color:e,minDuration:t}=this.analysis.minDurationOptions,n=this._totalDuration;return{rendersSunlight:this.analysis.visualizeSunlight,visualization:2,thresholdColor:e.toUnitRGBA(),threshold:n>0?t/this._totalDuration:0,...this._minDurationContextVisualizationParameters}}get _minDurationContextVisualizationParameters(){let{minDurationOptions:e,visualizeSunlight:t}=this.analysis;if(!e.contextEnabled||t)return{};let{color:n,colorStops:r}=e.contextOptions,i=1/this._lightDirectionsContext.length;return{visualization:3,gradientColorRamp:this._getEffectiveShadowCastColorRamp(n,r,i)}}get _durationVisualizationParameters(){let{color:e,colorStops:t,mode:n}=this.analysis.totalDurationOptions,r=this._totalDuration,i=r>0&&n===`hourly`?U/r:0,a=this._getEffectiveShadowCastColorRamp(e,t,1/r);return i===0?{...this._discreteVisualizationParameters,gradientColorRamp:a}:{rendersSunlight:this.analysis.visualizeSunlight,bandedGradientColorRamp:a,visualization:1,bandSize:i}}get _showsSeparateZeroBucketInHourlyMode(){let{colorStops:e}=this.analysis.totalDurationOptions;return e==null||e.length===0||e.reduce((e,t)=>Math.min(e,t.value),1/0)<=0}get _discreteVisualizationParameters(){let{color:e,colorStops:t}=this.analysis.discreteOptions,n=1/this._lightDirections.length;return{rendersSunlight:this.analysis.visualizeSunlight,gradientColorRamp:this._getEffectiveShadowCastColorRamp(e,t,n),visualization:0}}get _shadowLayerViews(){return this.view.allLayerViews.items.filter(V)}get _previewDependencies(){if(this.error!=null)return null;let{view:e}=this,n=e.slice.plane,r=this._shadowLayerViews,i=r.map(e=>e.layer).filter(t),a=r.map(e=>e.suspended),o=i.map(e=>e.visible),s=i.map(e=>e.opacity),c=!!e.graphicsView?.suspended,l=i.filter(e=>`definitionExpression`in e).map(e=>e.definitionExpression),u=r.filter(e=>`filter`in e).map(e=>e.filter);return{slicePlane:n,startDateUTC:this._startDateTimeUTC,endDateUTC:this._endDateTimeUTC,layerViewSuspended:a,graphicsViewSuspended:c,layerVisibilities:o,layerOpacities:s,filters:u,definitionExpressions:l}}get _renderer(){return this.view?.stage?.renderer}get testData(){}async getDurationAtScreen(e){return this._getDurationAtScreen(e)}async _getDurationAtScreen(e,t){if(!await this._isScreenPointInAnalysisArea(e,t))return-1;let{_renderer:n,_totalDurationSampleCount:r}=this;if(n==null||r===0)return 0;let i=this.view.state.camera.screenToRender(p(e.x,e.y),m()),a=n.readAccumulatedShadow(i);return(this.analysis.visualizeSunlight?1-a:a)*this._totalDuration}async _isScreenPointInAnalysisArea(e,t){let{geometry:n}=this.analysis;if(!n)return!0;let r=await this.view.hitTest(e);l(t);let i=r.results.find(e=>e.mapPoint)?.mapPoint??r?.ground?.mapPoint;if(!i)return!1;let a=await S(i,n.spatialReference,{signal:t});return l(t),a!=null&&C(n,a)}_getEffectiveShadowCastColorRamp(e,t,n){if(t!=null){t.length>F&&a.getLogger(this).warnOnce(`ShadowCastAnalysis supports at most 8 color stops`);let e=t.map(e=>[e.value*n,e.color.toUnitRGBA()]);return e.sort(([e],[t])=>e-t),e}return B(e)}};e([_({readOnly:!0,type:[`shadow-cast-view-3d`]})],L.prototype,`type`,void 0),e([_({constructOnly:!0,nonNullable:!0})],L.prototype,`analysis`,void 0),e([_({readOnly:!0})],L.prototype,`updating`,null),e([_()],L.prototype,`visible`,null),e([_()],L.prototype,`error`,null),e([_()],L.prototype,`_visibleOverride`,void 0),e([_()],L.prototype,`_sunlightIntervals`,null),e([_()],L.prototype,`_stopPreviewingTask`,void 0),e([_()],L.prototype,`_updatedRecently`,void 0),e([_()],L.prototype,`_tooltip`,void 0),e([_()],L.prototype,`_sceneUpdating`,null),e([_()],L.prototype,`_timeZone`,null),e([_()],L.prototype,`_effectiveUtcOffset`,null),e([_()],L.prototype,`_utcOffsetAuto`,null),e([_()],L.prototype,`_startDateTimeUTC`,null),e([_()],L.prototype,`_endDateTimeUTC`,null),e([_()],L.prototype,`_referencePosition`,null),e([_()],L.prototype,`_interval`,null),e([_()],L.prototype,`_intervalContext`,null),e([_()],L.prototype,`_totalDurationSampleCount`,null),e([_()],L.prototype,`_totalDuration`,null),e([_()],L.prototype,`_lightDirections`,null),e([_()],L.prototype,`_lightDirectionsContext`,null),e([_()],L.prototype,`_analysisVolume`,null),e([_()],L.prototype,`_visualizationParameters`,null),e([_()],L.prototype,`_minDurationVisualizationParameters`,null),e([_()],L.prototype,`_minDurationContextVisualizationParameters`,null),e([_()],L.prototype,`_durationVisualizationParameters`,null),e([_()],L.prototype,`_showsSeparateZeroBucketInHourlyMode`,null),e([_()],L.prototype,`_discreteVisualizationParameters`,null),e([_()],L.prototype,`_shadowLayerViews`,null),e([_()],L.prototype,`_previewDependencies`,null),e([_()],L.prototype,`_renderer`,null),L=e([v(`esri.views.3d.analysis.ShadowCastAnalysisView3D`)],L);const R=L;function z(e,t,n){t&&n!=null&&e?.setParameters({shadowCast:n})}function B(e){let t=e.toUnitRGBA();return[[0,b(t[0],t[1],t[2],0)],[1,t]]}function V(e){if(e.suspended)return!1;switch(e.type){case`building-scene-3d`:case`csv-3d`:case`elevation-3d`:case`feature-3d`:case`gaussian-splat-3d`:case`geojson-3d`:case`integrated-mesh-3d`:case`integrated-mesh-3dtiles`:case`ogc-feature-3d`:case`route-3d`:case`scene-layer-3d`:case`scene-layer-graphics-3d`:case`stream-3d`:case`wms-3d`:case`catalog-footprint-3d`:return!0;case`base-dynamic-3d`:case`catalog-3d`:case`catalog-dynamic-group-3d`:case`dimension-3d`:case`imagery-3d`:case`imagery-tile-3d`:case`line-of-sight-3d`:case`map-image-3d`:case`point-cloud-3d`:case`tile-3d`:case`vector-tile-3d`:case`viewshed-3d`:case`voxel-3d`:case`wfs-3d`:case`wmts-3d`:case`media-3d`:case`group`:return!1;case`graphics-3d`:return e.layer.graphics.some(e=>{let{symbol:t}=e;return t==null||t.type!==`text`&&!(`symbolLayers`in t)||t.type!==`text`&&t.symbolLayers.some(e=>e.type!==`text`)});default:return!1}}function H(e,t){if(e===t||e==null&&t==null)return!0;if(e==null||t==null)return!1;let r=w(e.slicePlane,t.slicePlane),i=e.startDateUTC.valueOf()===t.startDateUTC.valueOf()&&e.endDateUTC.valueOf()===t.endDateUTC.valueOf(),a=n(e.layerViewSuspended,t.layerViewSuspended)&&e.graphicsViewSuspended===t.graphicsViewSuspended,o=n(e.layerVisibilities,t.layerVisibilities),s=n(e.layerOpacities,t.layerOpacities),c=n(e.filters,t.filters),l=n(e.definitionExpressions,t.definitionExpressions);return r&&i&&a&&o&&s&&c&&l}const U=h(1,`hours`,`milliseconds`),W=500,G=255,K=y(),q=[],J=new M;export{R as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{volumeMeasurementConfiguration as t}from"../../../../analysis/VolumeMeasurement/volumeMeasurementConfiguration.js";import n from"../../../../core/Accessor.js";import r from"../../../../core/Logger.js";import{debounce as i,isPromiseLike as a}from"../../../../core/promiseUtils.js";import{createVolume as o}from"../../../../core/quantity.js";import s from"../../../../core/ReactiveMap.js";import{whenOnce as c}from"../../../../core/reactiveUtils.js";import{property as l,subclass as u}from"../../../../core/accessorSupport/decorators.js";import{runUntracked as d}from"../../../../core/accessorSupport/tracking.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{setAxes as p}from"../../../../core/libs/gl-matrix-2/math/quat.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/quatf64.js";import{sqrDist as h}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as ee}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{scaleAndAdd as g,scale as te,set as ne,negate as re}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as _,fromValues as v,clone as y}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as b}from"../../../../core/support/UpdatingHandles.js";import x from"../../../../geometry/Multipoint.js";import{projectOrLoad as ie}from"../../../../geometry/projectionUtils.js";import{containsExecute as ae}from"../../../../geometry/operators/containsOperator.js";import{convexHullExecute as oe}from"../../../../geometry/operators/convexHullOperator.js";import{simplifyExecute as se}from"../../../../geometry/operators/simplifyOperator.js";import{unionExecuteMany as ce}from"../../../../geometry/operators/unionOperator.js";import{computeTranslationToOriginAndRotation as le}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{create as S,fromExtent as C}from"../../../../geometry/support/aaBoundingRect.js";import{vectorCoordinates as w}from"../../../../geometry/support/coordinateSystem.js";import{isClockwise as T}from"../../../../geometry/support/coordsUtils.js";import{newDoubleArray as E}from"../../../../geometry/support/DoubleArray.js";import{t as D}from"../../../../chunks/vec3.js";import O from"../../../../symbols/support/ElevationInfo.js";import{logFailedGeometryProjectionError as k}from"../support/projectionUtils.js";import{VolumeMeasurementCutFillComputation as A}from"./VolumeMeasurementCutFillComputation.js";import{VolumeMeasurementInsufficientDataError as j,VolumeMeasurementPerimeterTooLargeError as M,VolumeMeasurementUnsupportedCoordinateSystemError as N,VolumeMeasurementUnsupportedLayerTransparencyError as P}from"./volumeMeasurementErrors.js";import{VolumeMeasurementRawResult as F}from"./VolumeMeasurementRawResult.js";import I from"./VolumeMeasurementResult.js";import{ElevationContext as L}from"../../layers/graphics/ElevationContext.js";import{getElevationAtPoint as R}from"../../support/ElevationProvider.js";import{createElevationUpdateHandle as z}from"../../support/elevationUpdateUtils.js";import{Obb as B}from"../../support/orientedBoundingBox.js";import{polygonToRenderInfoElevationAligned as ue}from"../../support/renderInfoUtils/polygon.js";import{IteratorPreorder as V}from"../../terrain/tileUtils.js";import{CutFillComputation as H,TargetGeometryRenderInfo as U}from"../../webgl-engine/lib/CutFillComputation.js";import{GeometryWorkerHandle as de}from"../../../support/GeometryWorkerHandle.js";import{isIntegratedMeshLayerView as fe}from"../../../support/layerViewUtils.js";let W=class extends n{constructor(e){super(e),this._measurementWorkerHandle=new de,this.depthExtremaPositions=null,this.analysisObb=null,this._updatingHandles=new b,this._rawResult=null,this._sufficientDataCoverage=!0,this._tileIterator=new V,this._intersectingObbsByLayerView=new s,this._intersectingTiles=[],this._debouncedUpdate=i(async(e,t,n,r)=>{if(!this._computation.done)return;let{renderCoordsHelper:i}=this.view,a=new A({extent:t,localOrigin:n,renderCoordsHelper:i});this._computation.update(a,r),this._determineDataCoverage(a,e);let[o]=await Promise.allSettled([this._measurementWorkerHandle.areaHorizontal(e,{returnLength:!0}),c(()=>this._computation.done).then(()=>{this._updateDepthExtremaPositions(a,this._computation.result)})]);if(this.error){this._rawResult=null;return}let s=this._computation.result;this._updateResult(a,s,o.status===`fulfilled`?o.value:null)}),this._determineDataCoverage=(e,t)=>{let{frustum:n}=this._computation,{cameraDimensions:r}=e;t.extent&&n&&(this._intersectingObbsByLayerView.clear(),this._imLayerViewsAffectingMeasurement.forEach(e=>{this._findIntersectingObbs(e,n)}),this._intersectingObbsByLayerView.size>0?this._sufficientDataCoverage=this._sufficientIntegratedMeshCoverage(t,r):(this._findIntersectingTerrainTiles(t.extent),this._sufficientDataCoverage=this._sufficientTerrainCoverage(r)))}}initialize(){let e=this.view;this._computation=new H({view:e}),this.addHandles([z({view:e,geometry:()=>this._projectedGeometry,context:`ground`,onElevationChanges:()=>this.notifyChange(`elevationAlignedGeometry`)}),this._updatingHandles.add(()=>({localOrigin:this._localOrigin,targetGeometryRenderInfo:this._targetGeometryRenderInfo}),({localOrigin:e,targetGeometryRenderInfo:t})=>{let n=this._projectedGeometry,r=n?.extent;!n||!r||!e||!t?(this._rawResult=null,this.depthExtremaPositions=null,this.analysisObb=null,this._sufficientDataCoverage=!0):this._updatingHandles.consumePromise(this._debouncedUpdate(n,r,e,t))})])}destroy(){this._updatingHandles.destroy(),this._computation.destroy(),this._measurementWorkerHandle.destroy()}get _projectedGeometry(){let e=this.analysis.geometry;if(!e||!this.analysis.valid)return null;let t=se(e),n=ie(t,this.view.spatialReference);return n.pending?(this._updatingHandles.consumePromise(n.pending),null):(t&&!n.geometry&&k(this.analysis,e.spatialReference,r.getLogger(this)),n.geometry)}get _localOrigin(){let e=this._projectedGeometry?.extent;return e?v(e.center.x,e.center.y,0):null}get elevationAlignedGeometry(){let e=this._projectedGeometry;return e?d(()=>{let t=e.clone();return pe(this.view.elevationProvider,t),t}):null}get targetGeometry(){let{elevationAlignedGeometry:e}=this;if(!e)return null;let t=this.analysis.measureType,{effectiveTargetElevation:n}=this.viewData;if(t===`stockpile`||n==null)return e;let r=e.clone();return r.rings.forEach(e=>e.forEach(e=>e[2]=n)),r}get _targetGeometryRenderInfo(){let e=this.targetGeometry,t=this._localOrigin;if(!e||!t)return null;let{elevationProvider:n,renderCoordsHelper:r}=this.view,i=ue(e,n,r,L.fromElevationInfo(new O({mode:`absolute-height`})));if(a(i))return this._updatingHandles.consumePromise(i),null;if(i==null)return null;let{positions:o,polygonIndices:s,vertexCount:c}=i,l=E(c*3),u=f(),d=f();return le(e.spatialReference,t,u,r.spatialReference),d[12]=-u[12],d[13]=-u[13],d[14]=-u[14],D(l,o,d),new U(l,s)}get updating(){return this._computation.updating||this._updatingHandles.updating}get result(){let e=this._rawResult,{volume:t,area:n,length:r}=this.viewData.effectiveDisplayUnits;return e&&!this.error?new I({measureType:this.analysis.measureType,rawResult:e,volumeUnit:t,areaUnit:n,lengthUnit:r}):null}get error(){return this._unsupportedCoordinateSystemError??this._unsupportedLayerTransparencyError??this._perimeterTooLargeError??this._insufficientDataError}get _imLayerViewsAffectingMeasurement(){return this.view.allLayerViews.filter(e=>fe(e)).filter(e=>e.visible&&!e.suspended)}get _insufficientDataError(){return this._sufficientDataCoverage?null:new j}get _perimeterTooLargeError(){return this._perimeterTooLargeLocalError??this._perimeterTooLargeGlobalError}get _perimeterTooLargeLocalError(){let{spatialReference:e,state:{isLocal:n}}=this.view;if(!n||!e.isWebMercator)return null;let r=this._perimeterForError,{maxPerimeterLocalWebMercator:i}=t;return r!=null&&r>i?new M:null}get _perimeterTooLargeGlobalError(){if(!this.view.state.isGlobal)return null;let e=this._perimeterForError,{maxPerimeterGlobal:n}=t;return e!=null&&e>n?new M:null}get _unsupportedCoordinateSystemError(){return this.view.state.isLocal&&this.view.spatialReference.isGeographic?new N:null}get _unsupportedLayerTransparencyError(){let e=this.view.map.ground&&this.view.map.ground.opacity<1,t=this._intersectingObbsByLayerView.size>0;return this._intersectingObbsByLayerView.keys().some(e=>e.fullOpacity<1)||e&&!t?new P:null}get _perimeterForError(){let e=this._projectedGeometry;if(e==null)return null;let t=null;for(let n of e.rings){if(!T(n))continue;let e=he(ge(n));t=e?Math.max(t??0,e):t}return t==null?null:t*e.spatialReference.metersPerUnit}_updateResult(e,t,n){if(!t)return;let{unitInMeters:r}=this.view.renderCoordsHelper,{dimensions:{width:i,height:a},cameraNearFar:{near:s,far:c}}=e,l=i/t.width*(a/t.height),u=G(t.cut.totalDepth,s,c)*l,d=G(t.fill.totalDepth,s,c)*l,f=r**3;this._rawResult=new F({cutVolume:o(Math.abs(u*f),`cubic-meters`),fillVolume:o(d*f,`cubic-meters`),area:n?.area,perimeter:n?.length})}_updateDepthExtremaPositions(e,t){if(!t)return;let{dimensions:{width:n,height:r},cameraNearFar:{near:i,far:a},cameraPositionRenderSpace:o,northVector:s,eastVector:c,upVector:l}=e,u=e=>{let{depthExtremum:u,depthExtremumCoords:[d,f],totalDepth:p}=e,m=y(o);return p!==0&&(g(m,m,c,n*(d/t.width-.5)),g(m,m,s,r*(f/t.height-.5))),g(m,m,l,-G(u,i,a)),m},d={cut:u(t.cut),fill:u(t.fill)};this.depthExtremaPositions=d,this.analysisObb=me(e,d)}_findIntersectingObbs(e,t){let n=[];e.type===`integrated-mesh-3d`&&e.getVisibleNodes().forEach(r=>{e.isNodeLoaded(r.index)&&r.geometryObbInRenderSR?.intersectsFrustum(t)&&n.push(r.geometryObbInRenderSR)}),e.type===`integrated-mesh-3dtiles`&&e.forEachVisibleComponentObject(({obb:e})=>{e.intersectsFrustum(t)&&n.push(e)}),n.length>0&&this._intersectingObbsByLayerView.set(e,n)}_sufficientIntegratedMeshCoverage(e,t){let{renderCoordsHelper:n,spatialReference:r}=this.view,i=[],a=new x({spatialReference:r});if(this._intersectingObbsByLayerView.forEach(e=>{e.forEach(e=>{if(K(e.radius,t)&&(e.getCorners($),a.points.length=0,$.forEach(e=>{let t=n.fromRenderCoords(e,ve,r);t&&a.addPoint([t[0],t[1]])}),a.points.length)){let e=oe(a);e?.type===`polygon`&&i.push(e)}})}),!i.length)return!1;let o=ce(i);return!!o&&ae(o,e)}_findIntersectingTerrainTiles(e){let{basemapTerrain:t}=this.view;this._intersectingTiles.length=0,C(e,q);let n=this._tileIterator;n.reset(t.rootTiles);for(let e=n.next();e;e=n.next())e.intersectsExtent(q)?e.rendered&&this._intersectingTiles.push(e):n.skipSubtree()}_sufficientTerrainCoverage(e){let{basemapTerrain:{tilingScheme:t}}=this.view;if(!this._intersectingTiles.length)return!1;let n=256/t.pixelSize;return this._intersectingTiles.every(t=>K(t.radius*n,e))}};e([l()],W.prototype,`_projectedGeometry`,null),e([l()],W.prototype,`_localOrigin`,null),e([l()],W.prototype,`elevationAlignedGeometry`,null),e([l()],W.prototype,`targetGeometry`,null),e([l()],W.prototype,`_targetGeometryRenderInfo`,null),e([l({constructOnly:!0})],W.prototype,`analysis`,void 0),e([l({constructOnly:!0})],W.prototype,`viewData`,void 0),e([l({constructOnly:!0})],W.prototype,`view`,void 0),e([l()],W.prototype,`updating`,null),e([l()],W.prototype,`result`,null),e([l()],W.prototype,`depthExtremaPositions`,void 0),e([l()],W.prototype,`analysisObb`,void 0),e([l()],W.prototype,`error`,null),e([l()],W.prototype,`_imLayerViewsAffectingMeasurement`,null),e([l()],W.prototype,`_insufficientDataError`,null),e([l()],W.prototype,`_perimeterTooLargeError`,null),e([l()],W.prototype,`_perimeterTooLargeLocalError`,null),e([l()],W.prototype,`_perimeterTooLargeGlobalError`,null),e([l()],W.prototype,`_unsupportedCoordinateSystemError`,null),e([l()],W.prototype,`_unsupportedLayerTransparencyError`,null),e([l()],W.prototype,`_perimeterForError`,null),e([l()],W.prototype,`_computation`,void 0),e([l({readOnly:!0})],W.prototype,`_updatingHandles`,void 0),e([l()],W.prototype,`_rawResult`,void 0),e([l()],W.prototype,`_sufficientDataCoverage`,void 0),W=e([u(`esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementController`)],W);function pe(e,t){t.hasZ=!0,t.rings.forEach(t=>t.forEach(t=>t[2]=R(e,t,`ground`)??0))}function G(e,t,n){return e*(n-t)+t}function me(e,t){let{boundingRect:n,eastVector:r,northVector:i,upVector:a}=e;w(t.cut,r,i,a,J),w(t.fill,r,i,a,Y);let o=(n[0]+n[2])*.5,s=(n[1]+n[3])*.5,c=Math.min(J[2],Y[2]),l=Math.max(J[2],Y[2]),u=(c+l)*.5;return te(X,r,o),g(X,X,i,s),g(X,X,a,u),ne(Z,(n[2]-n[0])*.5,(n[3]-n[1])*.5,(l-c)*.5),re(Q,a),new B(X,Z,p(_e,Q,r,i))}function he(e){if(!e)return null;let t=null,n=null,r=0;for(let i of e)t||=[i[0],i[1]],n?r+=h(n,i):n=[0,0],n[0]=i[0],n[1]=i[1];return t&&n&&(r+=h(n,t)),Math.sqrt(r)}function*ge(e){let t=ee();for(let n=0;n<e.length;n++)t[0]=e[n][0],t[1]=e[n][1],yield t}const K=(e,t)=>e<(t.width+t.height)/2,q=S(),J=_(),Y=_(),X=_(),Z=_(),Q=_(),_e=m(),$=Array(8).fill(0).map(()=>_()),ve=_();export{W as VolumeMeasurementController};
|
|
2
|
+
import{__decorate as e}from"tslib";import{volumeMeasurementConfiguration as t}from"../../../../analysis/VolumeMeasurement/volumeMeasurementConfiguration.js";import n from"../../../../core/Accessor.js";import r from"../../../../core/Logger.js";import{debounce as i,isPromiseLike as a}from"../../../../core/promiseUtils.js";import{createVolume as o}from"../../../../core/quantity.js";import s from"../../../../core/ReactiveMap.js";import{whenOnce as c}from"../../../../core/reactiveUtils.js";import{property as l,subclass as u}from"../../../../core/accessorSupport/decorators.js";import{runUntracked as d}from"../../../../core/accessorSupport/tracking.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{setAxes as p}from"../../../../core/libs/gl-matrix-2/math/quat.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/quatf64.js";import{sqrDist as h}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as ee}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{scaleAndAdd as g,scale as te,set as ne,negate as re}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as _,fromValues as v,clone as y}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as b}from"../../../../core/support/UpdatingHandles.js";import x from"../../../../geometry/Multipoint.js";import{projectOrLoad as ie}from"../../../../geometry/projectionUtils.js";import{containsExecute as ae}from"../../../../geometry/operators/containsOperator.js";import{convexHullExecute as oe}from"../../../../geometry/operators/convexHullOperator.js";import{simplifyExecute as se}from"../../../../geometry/operators/simplifyOperator.js";import{unionExecuteMany as ce}from"../../../../geometry/operators/unionOperator.js";import{computeTranslationToOriginAndRotation as le}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{create as S,fromExtent as C}from"../../../../geometry/support/aaBoundingRect.js";import{vectorCoordinates as w}from"../../../../geometry/support/coordinateSystem.js";import{isClockwise as T}from"../../../../geometry/support/coordsUtils.js";import{newDoubleArray as E}from"../../../../geometry/support/DoubleArray.js";import{t as D}from"../../../../chunks/vec3.js";import{IntegratedMeshSemantics as O}from"../../../../layers/support/IntegratedMeshSemantics.js";import k from"../../../../symbols/support/ElevationInfo.js";import{logFailedGeometryProjectionError as A}from"../support/projectionUtils.js";import{VolumeMeasurementCutFillComputation as j}from"./VolumeMeasurementCutFillComputation.js";import{VolumeMeasurementInsufficientDataError as M,VolumeMeasurementPerimeterTooLargeError as N,VolumeMeasurementUnsupportedCoordinateSystemError as P,VolumeMeasurementUnsupportedLayerTransparencyError as F}from"./volumeMeasurementErrors.js";import{VolumeMeasurementRawResult as I}from"./VolumeMeasurementRawResult.js";import L from"./VolumeMeasurementResult.js";import{ElevationContext as R}from"../../layers/graphics/ElevationContext.js";import{getElevationAtPoint as z}from"../../support/ElevationProvider.js";import{createElevationUpdateHandle as B}from"../../support/elevationUpdateUtils.js";import{Obb as ue}from"../../support/orientedBoundingBox.js";import{polygonToRenderInfoElevationAligned as V}from"../../support/renderInfoUtils/polygon.js";import{IteratorPreorder as H}from"../../terrain/tileUtils.js";import{CutFillComputation as U,TargetGeometryRenderInfo as de}from"../../webgl-engine/lib/CutFillComputation.js";import{GeometryWorkerHandle as fe}from"../../../support/GeometryWorkerHandle.js";import{isIntegratedMeshLayerView as pe}from"../../../support/layerViewUtils.js";let W=class extends n{constructor(e){super(e),this._measurementWorkerHandle=new fe,this.depthExtremaPositions=null,this.analysisObb=null,this._updatingHandles=new b,this._rawResult=null,this._sufficientDataCoverage=!0,this._tileIterator=new H,this._intersectingObbsByLayerView=new s,this._intersectingTiles=[],this._debouncedUpdate=i(async(e,t,n,r)=>{if(!this._computation.done)return;let{renderCoordsHelper:i}=this.view,a=new j({extent:t,localOrigin:n,renderCoordsHelper:i});this._computation.update(a,r),this._determineDataCoverage(a,e);let[o]=await Promise.allSettled([this._measurementWorkerHandle.areaHorizontal(e,{returnLength:!0}),c(()=>this._computation.done).then(()=>{this._updateDepthExtremaPositions(a,this._computation.result)})]);if(this.error){this._rawResult=null;return}let s=this._computation.result;this._updateResult(a,s,o.status===`fulfilled`?o.value:null)}),this._determineDataCoverage=(e,t)=>{let{frustum:n}=this._computation,{cameraDimensions:r}=e;t.extent&&n&&(this._intersectingObbsByLayerView.clear(),this._imLayerViewsAffectingMeasurement.forEach(e=>{this._findIntersectingObbs(e,n)}),this._intersectingObbsByLayerView.size>0?this._sufficientDataCoverage=this._sufficientIntegratedMeshCoverage(t,r):(this._findIntersectingTerrainTiles(t.extent),this._sufficientDataCoverage=this._sufficientTerrainCoverage(r)))}}initialize(){let e=this.view;this._computation=new U({view:e}),this.addHandles([B({view:e,geometry:()=>this._projectedGeometry,context:O.shouldObserveSceneElevationForVolume()?void 0:`ground`,onElevationChanges:()=>this.notifyChange(`elevationAlignedGeometry`)}),this._updatingHandles.add(()=>({localOrigin:this._localOrigin,targetGeometryRenderInfo:this._targetGeometryRenderInfo}),({localOrigin:e,targetGeometryRenderInfo:t})=>{let n=this._projectedGeometry,r=n?.extent;!n||!r||!e||!t?(this._rawResult=null,this.depthExtremaPositions=null,this.analysisObb=null,this._sufficientDataCoverage=!0):this._updatingHandles.consumePromise(this._debouncedUpdate(n,r,e,t))})])}destroy(){this._updatingHandles.destroy(),this._computation.destroy(),this._measurementWorkerHandle.destroy()}get _projectedGeometry(){let e=this.analysis.geometry;if(!e||!this.analysis.valid)return null;let t=se(e),n=ie(t,this.view.spatialReference);return n.pending?(this._updatingHandles.consumePromise(n.pending),null):(t&&!n.geometry&&A(this.analysis,e.spatialReference,r.getLogger(this)),n.geometry)}get _localOrigin(){let e=this._projectedGeometry?.extent;return e?v(e.center.x,e.center.y,0):null}get elevationAlignedGeometry(){let e=this._projectedGeometry;return e?d(()=>{let t=e.clone();return me(this.view.elevationProvider,t),t}):null}get targetGeometry(){let{elevationAlignedGeometry:e}=this;if(!e)return null;let t=this.analysis.measureType,{effectiveTargetElevation:n}=this.viewData;if(t===`stockpile`||n==null)return e;let r=e.clone();return r.rings.forEach(e=>e.forEach(e=>e[2]=n)),r}get _targetGeometryRenderInfo(){let e=this.targetGeometry,t=this._localOrigin;if(!e||!t)return null;let{elevationProvider:n,renderCoordsHelper:r}=this.view,i=V(e,n,r,R.fromElevationInfo(new k({mode:`absolute-height`})));if(a(i))return this._updatingHandles.consumePromise(i),null;if(i==null)return null;let{positions:o,polygonIndices:s,vertexCount:c}=i,l=E(c*3),u=f(),d=f();return le(e.spatialReference,t,u,r.spatialReference),d[12]=-u[12],d[13]=-u[13],d[14]=-u[14],D(l,o,d),new de(l,s)}get updating(){return this._computation.updating||this._updatingHandles.updating}get result(){let e=this._rawResult,{volume:t,area:n,length:r}=this.viewData.effectiveDisplayUnits;return e&&!this.error?new L({measureType:this.analysis.measureType,rawResult:e,volumeUnit:t,areaUnit:n,lengthUnit:r}):null}get error(){return this._unsupportedCoordinateSystemError??this._unsupportedLayerTransparencyError??this._perimeterTooLargeError??this._insufficientDataError}get _imLayerViewsAffectingMeasurement(){return this.view.allLayerViews.filter(e=>pe(e)).filter(e=>e.visible&&!e.suspended)}get _insufficientDataError(){return this._sufficientDataCoverage?null:new M}get _perimeterTooLargeError(){return this._perimeterTooLargeLocalError??this._perimeterTooLargeGlobalError}get _perimeterTooLargeLocalError(){let{spatialReference:e,state:{isLocal:n}}=this.view;if(!n||!e.isWebMercator)return null;let r=this._perimeterForError,{maxPerimeterLocalWebMercator:i}=t;return r!=null&&r>i?new N:null}get _perimeterTooLargeGlobalError(){if(!this.view.state.isGlobal)return null;let e=this._perimeterForError,{maxPerimeterGlobal:n}=t;return e!=null&&e>n?new N:null}get _unsupportedCoordinateSystemError(){return this.view.state.isLocal&&this.view.spatialReference.isGeographic?new P:null}get _unsupportedLayerTransparencyError(){let e=this.view.map.ground&&this.view.map.ground.opacity<1,t=this._intersectingObbsByLayerView.size>0;return this._intersectingObbsByLayerView.keys().some(e=>e.fullOpacity<1)||e&&!t?new F:null}get _perimeterForError(){let e=this._projectedGeometry;if(e==null)return null;let t=null;for(let n of e.rings){if(!T(n))continue;let e=ge(_e(n));t=e?Math.max(t??0,e):t}return t==null?null:t*e.spatialReference.metersPerUnit}_updateResult(e,t,n){if(!t)return;let{unitInMeters:r}=this.view.renderCoordsHelper,{dimensions:{width:i,height:a},cameraNearFar:{near:s,far:c}}=e,l=i/t.width*(a/t.height),u=G(t.cut.totalDepth,s,c)*l,d=G(t.fill.totalDepth,s,c)*l,f=r**3;this._rawResult=new I({cutVolume:o(Math.abs(u*f),`cubic-meters`),fillVolume:o(d*f,`cubic-meters`),area:n?.area,perimeter:n?.length})}_updateDepthExtremaPositions(e,t){if(!t)return;let{dimensions:{width:n,height:r},cameraNearFar:{near:i,far:a},cameraPositionRenderSpace:o,northVector:s,eastVector:c,upVector:l}=e,u=e=>{let{depthExtremum:u,depthExtremumCoords:[d,f],totalDepth:p}=e,m=y(o);return p!==0&&(g(m,m,c,n*(d/t.width-.5)),g(m,m,s,r*(f/t.height-.5))),g(m,m,l,-G(u,i,a)),m},d={cut:u(t.cut),fill:u(t.fill)};this.depthExtremaPositions=d,this.analysisObb=he(e,d)}_findIntersectingObbs(e,t){let n=[];e.type===`integrated-mesh-3d`&&e.getVisibleNodes().forEach(r=>{e.isNodeLoaded(r.index)&&r.geometryObbInRenderSR?.intersectsFrustum(t)&&n.push(r.geometryObbInRenderSR)}),e.type===`integrated-mesh-3dtiles`&&e.forEachVisibleComponentObject(({obb:e})=>{e.intersectsFrustum(t)&&n.push(e)}),n.length>0&&this._intersectingObbsByLayerView.set(e,n)}_sufficientIntegratedMeshCoverage(e,t){let{renderCoordsHelper:n,spatialReference:r}=this.view,i=[],a=new x({spatialReference:r});if(this._intersectingObbsByLayerView.forEach(e=>{e.forEach(e=>{if(K(e.radius,t)&&(e.getCorners($),a.points.length=0,$.forEach(e=>{let t=n.fromRenderCoords(e,ye,r);t&&a.addPoint([t[0],t[1]])}),a.points.length)){let e=oe(a);e?.type===`polygon`&&i.push(e)}})}),!i.length)return!1;let o=ce(i);return!!o&&ae(o,e)}_findIntersectingTerrainTiles(e){let{basemapTerrain:t}=this.view;this._intersectingTiles.length=0,C(e,q);let n=this._tileIterator;n.reset(t.rootTiles);for(let e=n.next();e;e=n.next())e.intersectsExtent(q)?e.rendered&&this._intersectingTiles.push(e):n.skipSubtree()}_sufficientTerrainCoverage(e){let{basemapTerrain:{tilingScheme:t}}=this.view;if(!this._intersectingTiles.length)return!1;let n=256/t.pixelSize;return this._intersectingTiles.every(t=>K(t.radius*n,e))}};e([l()],W.prototype,`_projectedGeometry`,null),e([l()],W.prototype,`_localOrigin`,null),e([l()],W.prototype,`elevationAlignedGeometry`,null),e([l()],W.prototype,`targetGeometry`,null),e([l()],W.prototype,`_targetGeometryRenderInfo`,null),e([l({constructOnly:!0})],W.prototype,`analysis`,void 0),e([l({constructOnly:!0})],W.prototype,`viewData`,void 0),e([l({constructOnly:!0})],W.prototype,`view`,void 0),e([l()],W.prototype,`updating`,null),e([l()],W.prototype,`result`,null),e([l()],W.prototype,`depthExtremaPositions`,void 0),e([l()],W.prototype,`analysisObb`,void 0),e([l()],W.prototype,`error`,null),e([l()],W.prototype,`_imLayerViewsAffectingMeasurement`,null),e([l()],W.prototype,`_insufficientDataError`,null),e([l()],W.prototype,`_perimeterTooLargeError`,null),e([l()],W.prototype,`_perimeterTooLargeLocalError`,null),e([l()],W.prototype,`_perimeterTooLargeGlobalError`,null),e([l()],W.prototype,`_unsupportedCoordinateSystemError`,null),e([l()],W.prototype,`_unsupportedLayerTransparencyError`,null),e([l()],W.prototype,`_perimeterForError`,null),e([l()],W.prototype,`_computation`,void 0),e([l({readOnly:!0})],W.prototype,`_updatingHandles`,void 0),e([l()],W.prototype,`_rawResult`,void 0),e([l()],W.prototype,`_sufficientDataCoverage`,void 0),W=e([u(`esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementController`)],W);function me(e,t){t.hasZ=!0,t.rings.forEach(t=>t.forEach(t=>t[2]=z(e,t,`ground`)??0))}function G(e,t,n){return e*(n-t)+t}function he(e,t){let{boundingRect:n,eastVector:r,northVector:i,upVector:a}=e;w(t.cut,r,i,a,J),w(t.fill,r,i,a,Y);let o=(n[0]+n[2])*.5,s=(n[1]+n[3])*.5,c=Math.min(J[2],Y[2]),l=Math.max(J[2],Y[2]),u=(c+l)*.5;return te(X,r,o),g(X,X,i,s),g(X,X,a,u),ne(Z,(n[2]-n[0])*.5,(n[3]-n[1])*.5,(l-c)*.5),re(Q,a),new ue(X,Z,p(ve,Q,r,i))}function ge(e){if(!e)return null;let t=null,n=null,r=0;for(let i of e)t||=[i[0],i[1]],n?r+=h(n,i):n=[0,0],n[0]=i[0],n[1]=i[1];return t&&n&&(r+=h(n,t)),Math.sqrt(r)}function*_e(e){let t=ee();for(let n=0;n<e.length;n++)t[0]=e[n][0],t[1]=e[n][1],yield t}const K=(e,t)=>e<(t.width+t.height)/2,q=S(),J=_(),Y=_(),X=_(),Z=_(),Q=_(),ve=m(),$=Array(8).fill(0).map(()=>_()),ye=_();export{W as VolumeMeasurementController};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{EventEmitter as e}from"../../../core/Evented.js";import{makeHandle as t}from"../../../core/handleUtils.js";import"../../../core/has.js";import{deg2rad as n}from"../../../core/mathUtils.js";import{destroyMaybe as r}from"../../../core/maybe.js";import{createRenderScreenPointArray3 as i,createScreenPointArray as a,screenPointObjectToArray as o,castRenderScreenPointArray as s}from"../../../core/screenUtils.js";import{generateUID as c}from"../../../core/uid.js";import{fromMat4 as l}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as u}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{copy as d,exactEquals as f,getTranslation as p,set as m,multiply as h,identity as ee}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as g}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{squaredDistance as _}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{add as v,transformMat3 as y,transformMat4 as b,scale as x,copy as S,squaredDistance as te,exactEquals as C,set as w,subtract as ne}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as T,ZEROS as E}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as re}from"../../../geometry/ellipsoidUtils.js";import D from"../../../geometry/Point.js";import{canProjectWithoutEngine as O,projectPoint as ie}from"../../../geometry/projectionUtils.js";import{computeENUToPCPFLocalRotation as ae}from"../../../geometry/projection/localRotationUtils.js";import{sphericalPCPFtoLonLatElevation as oe}from"../../../geometry/projection/projectors.js";import{distance2 as se,fromPoints as k,closestRayDistance2 as ce,create as le}from"../../../geometry/support/lineSegment.js";import{fromPositionAndNormal as A,intersectRay as j,create as ue}from"../../../geometry/support/plane.js";import{create as de}from"../../../geometry/support/ray.js";import{sv3d as M}from"../../../geometry/support/vectorStacks.js";import{clonePoint as N}from"../../../layers/graphics/hydratedFeatures.js";import{hydratedSpatialReference as P}from"../../../layers/graphics/hydratedSpatialReference.js";import{getElevationOffset as F}from"../../../support/elevationInfoUtils.js";import{getElevationAtPoint as I}from"../support/ElevationProvider.js";import{containsElevationUpdatePoint as L}from"../support/elevationUpdateExtentUtils.js";import{fromScreen as R}from"../support/geometryUtils/ray.js";import{fromValues as z}from"../webgl-engine/lib/LocalOriginFactory.js";import{Object3D as B}from"../webgl-engine/lib/Object3D.js";import{WebGLLayer as V}from"../webgl-engine/lib/WebGLLayer.js";class fe{constructor(t){this.metadata=void 0,this._elevation={offset:0,override:null},this.collisionType={type:`point`},this.collisionPriority=0,this._renderObjects=[],this.autoScaleRenderObjects=!0,this.usePreciseLocalOrigin=!0,this._available=!0,this._noDisplayCount=0,this._radius=10,this._worldSized=!1,this.focusMultiplier=2,this.touchMultiplier=2.5,this.worldOriented=!1,this._modelTransform=g(),this._worldFrame=null,this._renderLocation=T(),this._renderLocationDirty=!0,this._location=new D({x:0,y:0,z:0}),this._elevationAlignedLocation=new D,this._elevationAlignedLocationDirty=!0,this.interactive=!0,this.selectable=!1,this.grabbable=!0,this.consumesClicks=!0,this.cursor=null,this.grabCursor=null,this._grabbing=!1,this.dragging=!1,this._hovering=!1,this._selected=!1,this._state=0,this._focused=!1,this.events=new e,this._screenLocation={screenPointArray:a(),renderScreenPointArray:i(),pixelSize:0},this._screenLocationDirty=!0,this._engineResourcesAddedToStage=!1,this._attached=!1,this._location.spatialReference=t.view.spatialReference,Object.assign(this,t)}destroy(){this._applyObjectTransform=_e,this._removeResourcesFromStage(),this._engineResources=null,this.view=null}get _stage(){return this.view?.stage}get elevationInfo(){return this._elevationInfo}set elevationInfo(e){this._elevationInfo=e,this._elevationAlignedLocationDirty=!0,this._renderLocationDirty=!0,this._updateEngineObject()}get renderObjects(){return this._renderObjects}set renderObjects(e){this._removeResourcesFromStage(),this._engineResources=null,this._renderObjects=e.slice(),this._updateEngineObject()}set available(e){e!==this._available&&(this._available=e,this._updateEngineObject())}get available(){return this._available}disableDisplay(){return this._noDisplayCount++,this._noDisplayCount===1&&this._updateEngineObject(),t(()=>{this._noDisplayCount--,this._noDisplayCount===0&&this._updateEngineObject()})}set radius(e){e!==this._radius&&(this._radius=e,this._updateEngineObject())}get radius(){return this._radius}set worldSized(e){e!==this._worldSized&&(this._worldSized=e,this._updateEngineObject())}get worldSized(){return this._worldSized}get modelTransform(){return this._modelTransform}set modelTransform(e){H(e)&&(this._screenLocationDirty=!0),d(this._modelTransform,e),this._updateEngineObject()}get renderLocation(){return this._renderLocationDirty&&(this._renderLocationDirty=!1,this.view.renderCoordsHelper.toRenderCoords(this.elevationAlignedLocation,this._renderLocation),this.worldOriented?(this._worldFrame||=g(),pe(this.view,this._renderLocation,this._worldFrame)):this._worldFrame&&=null),this._renderLocation}set renderLocation(e){this.view.renderCoordsHelper.fromRenderCoords(e,this._location),this.elevationAlignedLocation=this._location}get location(){return this._location}set location(e){N(e,this._location),this._notifyLocationChanged()}_notifyLocationChanged(){this._renderLocationDirty=!0,this._screenLocationDirty=!0,this._elevationAlignedLocationDirty=!0,this._updateEngineObject(),this.events.emit(`location-update`,{location:this._location})}get elevationAlignedLocation(){return this._elevationAlignedLocationDirty&&(this._evaluateElevationAlignment(),this._updateElevationAlignedLocation()),this._elevationAlignedLocation}set elevationAlignedLocation(e){N(e,this._location),this._evaluateElevationAlignment(),this._location.z-=this._elevation.offset,this._updateElevationAlignedLocation(),this._updateEngineObject(),this.events.emit(`location-update`,{location:this._location})}_updateElevationAlignedLocation(){let e=this._elevation.override==null?this.location.z||0:this._elevation.override;this._elevationAlignedLocation.x=this.location.x,this._elevationAlignedLocation.y=this.location.y,this._elevationAlignedLocation.z=e+this._elevation.offset,this._elevationAlignedLocation.spatialReference=P(this.location.spatialReference),this._renderLocationDirty=!0,this._screenLocationDirty=!0,this._elevationAlignedLocationDirty=!1}grabbableForEvent(){return!0}get grabbing(){return this._grabbing}set grabbing(e){e!==this._grabbing&&(this._grabbing=e,this._setFocused(this._hovering||this._grabbing),this._updateEngineObject())}get hovering(){return this._hovering}set hovering(e){e!==this._hovering&&(this._hovering=e,this._setFocused(this._hovering||this._grabbing),this._updateEngineObject())}get selected(){return this._selected}set selected(e){e!==this._selected&&(this._selected=e,this._updateEngineObject(),this.events.emit(`select-changed`,{action:e?`select`:`deselect`}))}get state(){return this._state}set state(e){e!==this._state&&(this._state=e,this._updateEngineObject())}updateStateEnabled(e,t){t?this.state|=e:this.state&=~e}_setFocused(e){e!==this._focused&&(this._focused=e,this.events.emit(`focus-changed`,{action:e===!0?`focus`:`unfocus`}))}get focused(){return this._focused}get screenLocation(){return this._ensureScreenLocation(),this._screenLocation}_ensureScreenLocation(){if(!this._screenLocationDirty)return;let e=this.view.state.camera;this._screenLocation.pixelSize=e.computeScreenPixelSizeAt(this.renderLocation),this._screenLocationDirty=!1;let t=H(this._modelTransform),n;if(t){let e=this._calculateModelTransformOffset(ge);n=v(e,e,this.renderLocation)}else n=this.renderLocation;e.projectToRenderScreen(n,this._screenLocation.renderScreenPointArray),e.renderToScreen(this._screenLocation.renderScreenPointArray,this._screenLocation.screenPointArray)}get applyObjectTransform(){return this._applyObjectTransform}set applyObjectTransform(e){this._applyObjectTransform=e,this._screenLocationDirty=!0,this._updateEngineObject()}get attached(){return this._attached}intersectionDistance(e,t){if(!this.available)return null;let n=this.view.state.camera,r=o(e,me),i=this._getCollisionRadius(t),a=this.collisionPriority*-1;switch(this.collisionType.type){case`point`:if(_(this.screenLocation.screenPointArray,r)<i*i)return this.screenLocation.renderScreenPointArray[2]+a;break;case`line`:{let e=this.collisionType.paths,t=this._getWorldToScreenObjectScale(),o=this._calculateObjectTransform(t,K),c=i*this.screenLocation.pixelSize,l=R(n,r,W);if(l==null)return null;for(let t of e){if(t.length===0)continue;let e=b(J,t[0],o);for(let r=1;r<t.length;r++){let i=b(Y,t[r],o),u=ce(k(e,i,U),l);if(u!=null&&u<c*c){let t=v(M.get(),e,i);x(t,t,.5);let r=s(M.get());if(n.projectToRenderScreen(t,r))return r[2]+a}S(e,i)}}break}case`disc`:{let e=this.collisionType.direction,t=this.collisionType.offset??E,o=this._getWorldToScreenObjectScale(),s=this._calculateObjectTransform(o,K),c=i*this.screenLocation.pixelSize,u=R(n,r,W);if(u==null)return null;let d=l(G,s),f=y(Z,e,d),p=b(Q,t,s);A(p,f,q);let m=X;if(j(q,u,m)&&te(m,p)<c*c)return this.screenLocation.renderScreenPointArray[2]+a;break}case`ribbon`:{let{paths:e,direction:t}=this.collisionType,o=this._getWorldToScreenObjectScale(),c=this._calculateObjectTransform(o,K),u=i*n.computeScreenPixelSizeAt(this.renderLocation),d=R(n,r,W);if(d==null)return null;let f=l(G,c),p=y(Z,t,f),m=this._calculateModelTransformPosition(Q);A(m,p,q);let h=X;if(!j(q,d,h))break;for(let t of e){if(t.length===0)continue;let e=b(J,t[0],c);for(let r=1;r<t.length;r++){let i=b(Y,t[r],c),o=se(k(e,i,U),h);if(o!=null&&o<u*u){let t=v(M.get(),e,i);x(t,t,.5);let r=s(M.get());if(n.projectToRenderScreen(t,r))return r[2]+a}S(e,i)}}break}default:this.collisionType}return null}attach(e={manipulator3D:{}}){let t=this._stage;if(!t)return;let n=e.manipulator3D;n.engineLayerId==null?(this._engineLayer=new V(t,{pickable:!1,updatePolicy:1}),n.engineLayerId=this._engineLayer.id):t?.getLayer&&(this._engineLayer=t.getLayer(n.engineLayerId)),n.engineLayerReferences=(n.engineLayerReferences||0)+1,this._attached=!0,this._updateEngineObject(),O(this._location.spatialReference,this.view.spatialReference)||(this.location=new D({x:0,y:0,z:0,spatialReference:this.view.spatialReference}))}detach(e={manipulator3D:{}}){let t=e.manipulator3D;t.engineLayerReferences--;let n=t.engineLayerReferences===0;this._removeResourcesFromStage(),n&&(t.engineLayerId=null,r(this._engineLayer)),this._engineResources=null,this._engineLayer=null,this._attached=!1}onViewChange(){this._screenLocationDirty=!0,this._updateEngineObject()}onElevationChange(e){ie(this.location,$,e.spatialReference)&&L(e.extent,$.x,$.y,e.spatialReference)&&this._notifyLocationChanged()}_evaluateElevationAlignment(){if(this.elevationInfo==null)return;let e=null,t=0,n=F(this.elevationInfo,this.location.spatialReference??this.view.elevationProvider.spatialReference);switch(this.elevationInfo.mode){case`on-the-ground`:e=I(this.view.elevationProvider,this.location,`ground`)??0;break;case`relative-to-ground`:t=(I(this.view.elevationProvider,this.location,`ground`)??0)+n;break;case`relative-to-scene`:t=(I(this.view.elevationProvider,this.location,`scene`)??0)+n;break;case`absolute-height`:t=n}(t!==this._elevation.offset||e!==this._elevation.override)&&(this._elevation.offset=t,this._elevation.override=e)}_updateEngineObject(){if(!this._attached)return;if(!this.available){this._removeResourcesFromStage();return}let e=this._getWorldToScreenObjectScale(),t=K;if(this.autoScaleRenderObjects===!0){let n=this._getFocusedSize(this._radius,this.focused)*e;this._calculateObjectTransform(n,t)}else this._calculateObjectTransform(e,t);let{objectsByState:n}=this._ensureEngineResources(),r=(this.focused?2:1)|(this.selected?8:4),i=this._noDisplayCount>0;for(let{stateMask:e,objects:a}of n){if(i){for(let e of a)e.visible=!1;continue}let n=!!(e&15),o=!!(e&65520),s=!n||(r&e)===(e&15),c=!o||(this.state&e)===(e&65520);if(s&&c)for(let e of a)e.visible=!0,this.usePreciseLocalOrigin?this._updateObjectTransformAndLocalOrigin(e,t):f(e.transformation,t)||(e.transformation=t);else for(let e of a)e.visible=!1}}_updateObjectTransformAndLocalOrigin(e,t){let n=p(Q,t);if(e.geometries.every(({localOrigin:e})=>e!=null&&C(e.vec3,n))&&f(e.transformation,t))return;let r=z(n[0],n[1],n[2],`manipulator-${c()}`);for(let t of e.geometries)t.localOrigin=r;e.transformation=t}_ensureEngineResources(){if(this._engineResources==null){let e=this._engineLayer,t=[],n=new Set;this.renderObjects.forEach(({geometry:{material:e}})=>{n.has(e)||(t.push(e),n.add(e))});let r=new Map;this._renderObjects.forEach(e=>{let t=new B({castShadow:!1,geometries:[e.geometry]}),n=r.get(e.stateMask)||[];n.push(t),r.set(e.stateMask,n)});let i=[];r.forEach((e,t)=>i.push({stateMask:t,objects:e})),this._engineResources={objectsByState:i,layer:e,materials:t}}return this._addResourcesToStage(),this._engineResources}_addResourcesToStage(){let e=this._stage;if(this._engineResourcesAddedToStage||this._engineResources==null||!e)return;let{objectsByState:t,layer:n}=this._engineResources;t.forEach(({objects:e})=>n.addMany(e)),this._engineResourcesAddedToStage=!0}_removeResourcesFromStage(){let e=this._stage;if(!this._engineResourcesAddedToStage||this._engineResources==null||!e)return;let{objectsByState:t,layer:n}=this._engineResources;t.forEach(({objects:e})=>n.removeMany(e)),this._engineResourcesAddedToStage=!1}_getCollisionRadius(e){return this._getFocusedSize(this.radius,!0)*(e===`touch`?this.touchMultiplier:1)}_getFocusedSize(e,t){return e*(t?this.focusMultiplier:1)}_getWorldToScreenObjectScale(){return this._worldSized?1:this.screenLocation.pixelSize}_calculateModelTransformPosition(e){let t=this._getWorldToScreenObjectScale(),n=this._calculateObjectTransform(t,he);return w(e,n[12],n[13],n[14])}_calculateModelTransformOffset(e){let t=this._calculateModelTransformPosition(e);return ne(e,t,this.renderLocation)}_calculateObjectTransform(e,t){return m(t,e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1),this._worldFrame&&h(t,t,this._worldFrame),h(t,t,this._modelTransform),t[12]+=this.renderLocation[0],t[13]+=this.renderLocation[1],t[14]+=this.renderLocation[2],t[15]=1,this._applyObjectTransform!=null&&this._applyObjectTransform(t),t}get test(){}}function H(e){return e[12]!==0||e[13]!==0||e[14]!==0}function pe(e,t,r){switch(e.viewingMode){case`local`:return ee(r),!0;case`global`:{let i=re(e.renderCoordsHelper.spatialReference);return oe(t,0,J,0,i.radius),ae(n(J[0]),n(J[1]),r),!0}}}const me=a(),U=le(),W=de(),G=u(),he=g(),K=g(),q=ue(),J=T(),Y=T(),X=T(),Z=T(),Q=T(),ge=T(),$=new D({x:0,y:0,z:0,spatialReference:null}),_e=()=>{};export{fe as Manipulator3D};
|
|
2
|
+
import{exactEquals as e,getTranslation as t}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{exactEquals as n}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Manipulator3DBase as i,createPreciseManipulatorOrigin as a}from"./Manipulator3DBase.js";import{Object3D as o}from"../webgl-engine/lib/Object3D.js";class s extends i{constructor(e){super(e.view),Object.assign(this,e)}createEngineObject(e){return new o({castShadow:!1,geometries:[e.geometry]})}updateEngineObjectTransform(t,n){this.usePreciseLocalOrigin?this._updateObjectTransformAndLocalOrigin(t,n):e(t.transformation,n)||(t.transformation=n)}_updateObjectTransformAndLocalOrigin(r,i){let o=t(c,i);if(r.geometries.every(({localOrigin:e})=>e!=null&&n(e.vec3,o))&&e(r.transformation,i))return;let s=a(o);for(let e of r.geometries)e.localOrigin=s;r.transformation=i}}const c=r();export{s as Manipulator3D};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
+
import{EventEmitter as e}from"../../../core/Evented.js";import{makeHandle as t}from"../../../core/handleUtils.js";import"../../../core/has.js";import{deg2rad as n}from"../../../core/mathUtils.js";import{destroyMaybe as r}from"../../../core/maybe.js";import{createRenderScreenPointArray3 as i,createScreenPointArray as a,screenPointObjectToArray as o,castRenderScreenPointArray as s}from"../../../core/screenUtils.js";import{generateUID as c}from"../../../core/uid.js";import{fromMat4 as l}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as u}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{copy as d,set as f,multiply as p,identity as m}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as h}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{squaredDistance as ee}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{add as g,transformMat3 as _,transformMat4 as v,scale as y,copy as b,squaredDistance as te,set as ne,subtract as x}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as S,ZEROS as re}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as ie}from"../../../geometry/ellipsoidUtils.js";import C from"../../../geometry/Point.js";import{canProjectWithoutEngine as ae,projectPoint as oe}from"../../../geometry/projectionUtils.js";import{computeENUToPCPFLocalRotation as w}from"../../../geometry/projection/localRotationUtils.js";import{sphericalPCPFtoLonLatElevation as T}from"../../../geometry/projection/projectors.js";import{distance2 as E,fromPoints as D,closestRayDistance2 as se,create as ce}from"../../../geometry/support/lineSegment.js";import{fromPositionAndNormal as O,intersectRay as k,create as le}from"../../../geometry/support/plane.js";import{create as ue}from"../../../geometry/support/ray.js";import{sv3d as A}from"../../../geometry/support/vectorStacks.js";import{clonePoint as j}from"../../../layers/graphics/hydratedFeatures.js";import{hydratedSpatialReference as M}from"../../../layers/graphics/hydratedSpatialReference.js";import{getElevationOffset as N}from"../../../support/elevationInfoUtils.js";import{getElevationAtPoint as P}from"../support/ElevationProvider.js";import{containsElevationUpdatePoint as F}from"../support/elevationUpdateExtentUtils.js";import{fromScreen as I}from"../support/geometryUtils/ray.js";import{fromValues as L}from"../webgl-engine/lib/LocalOriginFactory.js";import{WebGLLayer as R}from"../webgl-engine/lib/WebGLLayer.js";class z{constructor(t){this.view=t,this.metadata=void 0,this._elevation={offset:0,override:null},this.collisionType={type:`point`},this.collisionPriority=0,this._renderObjects=[],this.autoScaleRenderObjects=!0,this.usePreciseLocalOrigin=!0,this._available=!0,this._noDisplayCount=0,this._radius=10,this._worldSized=!1,this.focusMultiplier=2,this.touchMultiplier=2.5,this.worldOriented=!1,this._modelTransform=h(),this._worldFrame=null,this._renderLocation=S(),this._renderLocationDirty=!0,this._location=new C({x:0,y:0,z:0}),this._elevationAlignedLocation=new C,this._elevationAlignedLocationDirty=!0,this.interactive=!0,this.selectable=!1,this.grabbable=!0,this.consumesClicks=!0,this.cursor=null,this.grabCursor=null,this._grabbing=!1,this.dragging=!1,this._hovering=!1,this._selected=!1,this._state=0,this._focused=!1,this.events=new e,this._screenLocation={screenPointArray:a(),renderScreenPointArray:i(),pixelSize:0},this._screenLocationDirty=!0,this._engineResourcesAddedToStage=!1,this._attached=!1,this._location.spatialReference=t.spatialReference}destroy(){this._applyObjectTransform=me,this._removeResourcesFromStage(),this._engineResources=null,this.view=null}get _stage(){return this.view?.stage}get elevationInfo(){return this._elevationInfo}set elevationInfo(e){this._elevationInfo=e,this._elevationAlignedLocationDirty=!0,this._renderLocationDirty=!0,this._updateEngineObject()}get renderObjects(){return this._renderObjects}set renderObjects(e){this._removeResourcesFromStage(),this._engineResources=null,this._renderObjects=e.slice(),this._updateEngineObject()}set available(e){e!==this._available&&(this._available=e,this._updateEngineObject())}get available(){return this._available}disableDisplay(){return this._noDisplayCount++,this._noDisplayCount===1&&this._updateEngineObject(),t(()=>{this._noDisplayCount--,this._noDisplayCount===0&&this._updateEngineObject()})}set radius(e){e!==this._radius&&(this._radius=e,this._updateEngineObject())}get radius(){return this._radius}set worldSized(e){e!==this._worldSized&&(this._worldSized=e,this._updateEngineObject())}get worldSized(){return this._worldSized}get modelTransform(){return this._modelTransform}set modelTransform(e){B(e)&&(this._screenLocationDirty=!0),d(this._modelTransform,e),this._updateEngineObject()}get renderLocation(){return this._renderLocationDirty&&(this._renderLocationDirty=!1,this.view.renderCoordsHelper.toRenderCoords(this.elevationAlignedLocation,this._renderLocation),this.worldOriented?(this._worldFrame||=h(),V(this.view,this._renderLocation,this._worldFrame)):this._worldFrame&&=null),this._renderLocation}set renderLocation(e){this.view.renderCoordsHelper.fromRenderCoords(e,this._location),this.elevationAlignedLocation=this._location}get location(){return this._location}set location(e){j(e,this._location),this._notifyLocationChanged()}_notifyLocationChanged(){this._renderLocationDirty=!0,this._screenLocationDirty=!0,this._elevationAlignedLocationDirty=!0,this._updateEngineObject(),this.events.emit(`location-update`,{location:this._location})}get elevationAlignedLocation(){return this._elevationAlignedLocationDirty&&(this._evaluateElevationAlignment(),this._updateElevationAlignedLocation()),this._elevationAlignedLocation}set elevationAlignedLocation(e){j(e,this._location),this._evaluateElevationAlignment(),this._location.z-=this._elevation.offset,this._updateElevationAlignedLocation(),this._updateEngineObject(),this.events.emit(`location-update`,{location:this._location})}_updateElevationAlignedLocation(){let e=this._elevation.override==null?this.location.z||0:this._elevation.override;this._elevationAlignedLocation.x=this.location.x,this._elevationAlignedLocation.y=this.location.y,this._elevationAlignedLocation.z=e+this._elevation.offset,this._elevationAlignedLocation.spatialReference=M(this.location.spatialReference),this._renderLocationDirty=!0,this._screenLocationDirty=!0,this._elevationAlignedLocationDirty=!1}grabbableForEvent(){return!0}get grabbing(){return this._grabbing}set grabbing(e){e!==this._grabbing&&(this._grabbing=e,this._setFocused(this._hovering||this._grabbing),this._updateEngineObject())}get hovering(){return this._hovering}set hovering(e){e!==this._hovering&&(this._hovering=e,this._setFocused(this._hovering||this._grabbing),this._updateEngineObject())}get selected(){return this._selected}set selected(e){e!==this._selected&&(this._selected=e,this._updateEngineObject(),this.events.emit(`select-changed`,{action:e?`select`:`deselect`}))}get state(){return this._state}set state(e){e!==this._state&&(this._state=e,this._updateEngineObject())}updateStateEnabled(e,t){t?this.state|=e:this.state&=~e}_setFocused(e){e!==this._focused&&(this._focused=e,this.events.emit(`focus-changed`,{action:e===!0?`focus`:`unfocus`}))}get focused(){return this._focused}get screenLocation(){return this._ensureScreenLocation(),this._screenLocation}_ensureScreenLocation(){if(!this._screenLocationDirty)return;let e=this.view.state.camera;this._screenLocation.pixelSize=e.computeScreenPixelSizeAt(this.renderLocation),this._screenLocationDirty=!1;let t=B(this._modelTransform),n;if(t){let e=this._calculateModelTransformOffset(pe);n=g(e,e,this.renderLocation)}else n=this.renderLocation;e.projectToRenderScreen(n,this._screenLocation.renderScreenPointArray),e.renderToScreen(this._screenLocation.renderScreenPointArray,this._screenLocation.screenPointArray)}get applyObjectTransform(){return this._applyObjectTransform}set applyObjectTransform(e){this._applyObjectTransform=e,this._screenLocationDirty=!0,this._updateEngineObject()}get attached(){return this._attached}intersectionDistance(e,t){if(!this.available)return null;let n=this.view.state.camera,r=o(e,de),i=this._getCollisionRadius(t),a=this.collisionPriority*-1;switch(this.collisionType.type){case`point`:if(ee(this.screenLocation.screenPointArray,r)<i*i)return this.screenLocation.renderScreenPointArray[2]+a;break;case`line`:{let e=this.collisionType.paths,t=this._getWorldToScreenObjectScale(),o=this._calculateObjectTransform(t,K),c=i*this.screenLocation.pixelSize,l=I(n,r,W);if(l==null)return null;for(let t of e){if(t.length===0)continue;let e=v(J,t[0],o);for(let r=1;r<t.length;r++){let i=v(Y,t[r],o),u=se(D(e,i,U),l);if(u!=null&&u<c*c){let t=g(A.get(),e,i);y(t,t,.5);let r=s(A.get());if(n.projectToRenderScreen(t,r))return r[2]+a}b(e,i)}}break}case`disc`:{let e=this.collisionType.direction,t=this.collisionType.offset??re,o=this._getWorldToScreenObjectScale(),s=this._calculateObjectTransform(o,K),c=i*this.screenLocation.pixelSize,u=I(n,r,W);if(u==null)return null;let d=l(G,s),f=_(Z,e,d),p=v(Q,t,s);O(p,f,q);let m=X;if(k(q,u,m)&&te(m,p)<c*c)return this.screenLocation.renderScreenPointArray[2]+a;break}case`ribbon`:{let{paths:e,direction:t}=this.collisionType,o=this._getWorldToScreenObjectScale(),c=this._calculateObjectTransform(o,K),u=i*n.computeScreenPixelSizeAt(this.renderLocation),d=I(n,r,W);if(d==null)return null;let f=l(G,c),p=_(Z,t,f),m=this._calculateModelTransformPosition(Q);O(m,p,q);let h=X;if(!k(q,d,h))break;for(let t of e){if(t.length===0)continue;let e=v(J,t[0],c);for(let r=1;r<t.length;r++){let i=v(Y,t[r],c),o=E(D(e,i,U),h);if(o!=null&&o<u*u){let t=g(A.get(),e,i);y(t,t,.5);let r=s(A.get());if(n.projectToRenderScreen(t,r))return r[2]+a}b(e,i)}}break}default:this.collisionType}return null}attach(e={manipulator3D:{}}){let t=this._stage;if(!t)return;let n=e.manipulator3D;n.engineLayerId==null?(this._engineLayer=new R(t,{pickable:!1,updatePolicy:1}),n.engineLayerId=this._engineLayer.id):t?.getLayer&&(this._engineLayer=t.getLayer(n.engineLayerId)),n.engineLayerReferences=(n.engineLayerReferences||0)+1,this._attached=!0,this._updateEngineObject(),ae(this._location.spatialReference,this.view.spatialReference)||(this.location=new C({x:0,y:0,z:0,spatialReference:this.view.spatialReference}))}detach(e={manipulator3D:{}}){let t=e.manipulator3D;t.engineLayerReferences--;let n=t.engineLayerReferences===0;this._removeResourcesFromStage(),n&&(t.engineLayerId=null,r(this._engineLayer)),this._engineResources=null,this._engineLayer=null,this._attached=!1}onViewChange(){this._screenLocationDirty=!0,this._updateEngineObject()}onElevationChange(e){oe(this.location,$,e.spatialReference)&&F(e.extent,$.x,$.y,e.spatialReference)&&this._notifyLocationChanged()}_evaluateElevationAlignment(){if(this.elevationInfo==null)return;let e=null,t=0,n=N(this.elevationInfo,this.location.spatialReference??this.view.elevationProvider.spatialReference);switch(this.elevationInfo.mode){case`on-the-ground`:e=P(this.view.elevationProvider,this.location,`ground`)??0;break;case`relative-to-ground`:t=(P(this.view.elevationProvider,this.location,`ground`)??0)+n;break;case`relative-to-scene`:t=(P(this.view.elevationProvider,this.location,`scene`)??0)+n;break;case`absolute-height`:t=n}(t!==this._elevation.offset||e!==this._elevation.override)&&(this._elevation.offset=t,this._elevation.override=e)}_updateEngineObject(){if(!this._attached)return;if(!this.available){this._removeResourcesFromStage();return}let e=this._getWorldToScreenObjectScale(),t=K,n=this.autoScaleRenderObjects===!0?this._getFocusedSize(this._radius,this.focused):1;this._calculateObjectTransform(n*e,t);let{objectsByState:r}=this._ensureEngineResources(),i=(this.focused?2:1)|(this.selected?8:4),a=this._noDisplayCount>0;for(let{stateMask:e,objects:n}of r){if(a){for(let e of n)e.visible=!1;continue}let r=!!(e&15),o=!!(e&65520),s=!r||(i&e)===(e&15),c=!o||(this.state&e)===(e&65520);if(s&&c)for(let e of n)e.visible=!0,this.updateEngineObjectTransform(e,t);else for(let e of n)e.visible=!1}}_ensureEngineResources(){if(this._engineResources==null){let e=this._engineLayer,t=new Map;this._renderObjects.forEach(e=>{let n=this.createEngineObject(e),r=t.get(e.stateMask)||[];r.push(n),t.set(e.stateMask,r)});let n=[];t.forEach((e,t)=>n.push({stateMask:t,objects:e})),this._engineResources={objectsByState:n,layer:e}}return this._addResourcesToStage(),this._engineResources}_addResourcesToStage(){let e=this._stage;if(this._engineResourcesAddedToStage||this._engineResources==null||!e)return;let{objectsByState:t,layer:n}=this._engineResources;t.forEach(({objects:e})=>n.addMany(e)),this._engineResourcesAddedToStage=!0}_removeResourcesFromStage(){let e=this._stage;if(!this._engineResourcesAddedToStage||this._engineResources==null||!e)return;let{objectsByState:t,layer:n}=this._engineResources;t.forEach(({objects:e})=>n.removeMany(e)),this._engineResourcesAddedToStage=!1}_getCollisionRadius(e){return this._getFocusedSize(this.radius,!0)*(e===`touch`?this.touchMultiplier:1)}_getFocusedSize(e,t){return e*(t?this.focusMultiplier:1)}_getWorldToScreenObjectScale(){return this._worldSized?1:this.screenLocation.pixelSize}_calculateModelTransformPosition(e){let t=this._getWorldToScreenObjectScale(),n=this._calculateObjectTransform(t,fe);return ne(e,n[12],n[13],n[14])}_calculateModelTransformOffset(e){let t=this._calculateModelTransformPosition(e);return x(e,t,this.renderLocation)}_calculateObjectTransform(e,t){return f(t,e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1),this._worldFrame&&p(t,t,this._worldFrame),p(t,t,this._modelTransform),t[12]+=this.renderLocation[0],t[13]+=this.renderLocation[1],t[14]+=this.renderLocation[2],t[15]=1,this._applyObjectTransform?.(t),t}get test(){}}function B(e){return e[12]!==0||e[13]!==0||e[14]!==0}function V(e,t,r){switch(e.viewingMode){case`local`:return m(r),!0;case`global`:{let i=ie(e.renderCoordsHelper.spatialReference);return T(t,0,J,0,i.radius),w(n(J[0]),n(J[1]),r),!0}}}function H(e){return L(e[0],e[1],e[2],`manipulator-${c()}`)}const de=a(),U=ce(),W=ue(),G=u(),fe=h(),K=h(),q=le(),J=S(),Y=S(),X=S(),Z=S(),Q=S(),pe=S(),$=new C({x:0,y:0,z:0,spatialReference:null}),me=()=>{};export{z as Manipulator3DBase,H as createPreciseManipulatorOrigin};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{copy as e,subtract as t,exactEquals as n,negate as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as i,fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{exactEquals as o,copy as s}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as c,clone as l}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromRay as u,getStart as d,getEnd as f,create as p}from"../../../../geometry/support/clipRay.js";import{newDoubleArray as m}from"../../../../geometry/support/DoubleArray.js";import{intersectClipRay as h}from"../../../../geometry/support/frustumPlanes.js";import{fromPoints as g,pointAt as _,create as v}from"../../../../geometry/support/lineSegment.js";import{create as y,fromPoints as b}from"../../../../geometry/support/ray.js";import{EngineVisualElement as x}from"./EngineVisualElement.js";import{LaserlineVisualElement as S}from"./LaserlineVisualElement.js";import{selectLocalOrigin as C,createBufferGeometry as w,needsBufferGeometryOriginUpdate as T,updateBufferGeometry as E}from"../../support/engineContent/line.js";import{drapedZ as D}from"../../terrain/DrapedZ.js";import{BufferObject3D as O}from"../../webgl-engine/lib/BufferObject3D.js";import{RibbonLineMaterial as k}from"../../webgl-engine/materials/RibbonLineMaterial.js";class A extends x{constructor(e){super(e),this._ray=y(),this._isWorldDown=!1,this._start=i(),this._end=a(1,0,0),this._width=1,this._color=c(1,0,1,1),this._polygonOffset=!1,this._writeDepthEnabled=!0,this._innerWidth=0,this._innerColor=c(1,1,1,1),this._stipplePattern=null,this._stippleOffColor=null,this._stipplePreferContinuous=!0,this._falloff=0,this._extensionType=0,this._laserlineStyle=null,this._laserlineEnabled=!1,this._renderOccluded=4,this._transparentRenderOrder=0,this._fadedExtensions=B,this._laserline=new S({view:this.view,isDecoration:e.isDecoration}),this.applyProperties(e)}destroy(){this._laserline.destroy(),super.destroy()}createObject3DResourceFactory(e){return{view:e,createObject:()=>new O({geometries:[]}),createResources:e=>this._createObject3DResources(e),destroyResources:j,recreateGeometry:(e,t)=>this._recreateObject3DGeometry(e,t),cameraChanged:()=>this._updateGeometry(),forEachMaterial:(e,t)=>t(e.material)}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:j,recreateGeometry:e=>this._recreateDrapedGeometry(e),forEachMaterial:(e,t)=>t(e.material)}}updateVisibility(e){super.updateVisibility(e),this._laserline.visible=e}onAttachedChange(){this._laserline.attached=this._laserlineAttached}setStartEndFromWorldDownAtLocation(n){this._isWorldDown=!0,e(this._start,n),this.view.renderCoordsHelper.worldUpAtPosition(n,this._end),t(this._end,n,this._end),b(this._start,this._end,this._ray),this._updateGeometry()}get start(){return this._start}set start(t){this._isWorldDown=!1,n(this._start,t)||(e(this._start,t),b(this._start,this._end,this._ray),this._updateGeometry())}get end(){return this._end}set end(t){this._isWorldDown=!1,n(this._end,t)||(e(this._end,t),b(this._start,this._end,this._ray),this._updateGeometry())}get width(){return this._width}set width(e){e!==this._width&&(this._width=e,this._updateMaterial())}get color(){return this._color}set color(e){o(e,this._color)||(s(this._color,e),this._updateMaterial())}get polygonOffset(){return this._polygonOffset}set polygonOffset(e){e!==this._polygonOffset&&(this._polygonOffset=e,this._updateMaterial())}get writeDepthEnabled(){return this._writeDepthEnabled}set writeDepthEnabled(e){this._writeDepthEnabled!==e&&(this._writeDepthEnabled=e,this._updateMaterial())}get innerWidth(){return this._innerWidth}set innerWidth(e){e!==this._innerWidth&&(this._innerWidth=e,this._updateMaterial())}get innerColor(){return this._innerColor}set innerColor(e){o(e,this._innerColor)||(s(this._innerColor,e),this._updateMaterial())}get stipplePattern(){return this._stipplePattern}set stipplePattern(e){let t=e!=null!=(this._stipplePattern!=null);this._stipplePattern=e,t?this.recreate():this._updateMaterial()}get stippleOffColor(){return this._stippleOffColor}set stippleOffColor(e){e!=null&&this._stippleOffColor!=null&&o(e,this._stippleOffColor)||(this._stippleOffColor=e==null?null:l(e),this._updateMaterial())}get stipplePreferContinuous(){return this._stipplePreferContinuous}set stipplePreferContinuous(e){e!==this._stipplePreferContinuous&&(this._stipplePreferContinuous=e,this._updateMaterial())}get falloff(){return this._falloff}set falloff(e){e!==this._falloff&&(this._falloff=e,this._updateMaterial())}get extensionType(){return this._extensionType}set extensionType(e){e!==this._extensionType&&(this._extensionType=e,this.recreateGeometry())}get _laserlineAttached(){return this._laserlineEnabled&&this._laserlineStyle!=null&&this.attached&&!this.isDraped}get laserlineStyle(){return this._laserlineStyle}set laserlineStyle(e){this._laserlineStyle=e,this._laserline.attached=this._laserlineAttached,e!=null&&(this._laserline.style=e)}get laserlineEnabled(){return this._laserlineEnabled}set laserlineEnabled(e){this._laserlineEnabled!==e&&(this._laserlineEnabled=e,this._laserline.attached=this._laserlineAttached)}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateMaterial())}get transparentRenderOrder(){return this._transparentRenderOrder}set transparentRenderOrder(e){e!==this._transparentRenderOrder&&(this._transparentRenderOrder=e,this._updateMaterial())}get _normalizedRenderOccluded(){return this.isDraped&&this._renderOccluded===8?4:this._renderOccluded}get fadedExtensions(){return this._fadedExtensions}set fadedExtensions(e){this._fadedExtensions=e??B,this.recreateGeometry()}_updateMaterial(){let{materialParameters:e}=this;this.object3dResources.resources?.material.setParameters(e),this.drapedResources.resources?.material.setParameters(e)}get materialParameters(){return{width:this._width,color:this._color,stippleOffColor:this._stippleOffColor,stipplePattern:this._stipplePattern,stipplePreferContinuous:this._stipplePreferContinuous,innerWidth:this._innerWidth,innerColor:this._innerColor,falloff:this._falloff,polygonOffset:this._polygonOffset?3:0,renderOccluded:this._normalizedRenderOccluded,testsTransparentRenderOrder:this._transparentRenderOrder,isDecoration:this.isDecoration,writeDepth:this._writeDepthEnabled}}_createObject3DResources(e){let t=new k(this.materialParameters,this.view),n=[];return this._createObject3DGeometry(t,e,n),{material:t,geometries:n}}_recreateObject3DGeometry(e,t){e.geometries.length=0,this._createObject3DGeometry(e.material,t,e.geometries)}_createObject3DGeometry(e,t,n){let r=this._lineSegment,i=this.extensionType===3?I:F;this._computeLinePositions(i,r);let a=this._createGeometry(e,i,this.view.stage.localOriginFactory);n.push(a),t.addGeometry(a),this._laserline.intersectsLine=r}_createDrapedResources(){let e=new k(this.materialParameters,this.view);return{material:e,geometries:[this._createDrapedGeometry(e)]}}_recreateDrapedGeometry(e){e.geometries=[this._createDrapedGeometry(e.material)]}_createDrapedGeometry(e){let t=this.extensionType===3?I:F;return this._computeLinePositions(t,this._lineSegment,!0),this._createGeometry(e,t,this.view.overlayManager.renderer.localOriginFactory)}_createGeometry(e,t,n){let r=C(t,n);return w(e,{attributeData:{position:t,color:this.extensionType===3?R:null}},r)}_updateGeometry(){if(this.isDraped)this.drapedResources.recreateGeometry();else{let e=this.object3dResources.object;e&&this._updateVerticesObject3D(e)}}_updateVerticesObject3D(e){let t=this._lineSegment,n=this.extensionType===3?I:F;this._computeLinePositions(n,t);let r=e.geometries[0];T(r.localOrigin,this.view.stage.localOriginFactory,n)?this.object3dResources.recreateGeometry():(E(r,n,this.extensionType===3?R:null),e.geometryVertexAttributeUpdated(r,`position`),this._laserline.intersectsLine=t)}get _lineSegment(){return this._extensionType===3?this._updateLineSegmentFinite(L):this._updateLineSegmentInfinite(this._extensionType,L)}_updateLineSegmentFinite(e){return g(this._start,this._end,e)}_updateLineSegmentInfinite(e,t){let n=this.view.state.camera;switch(u(this._ray,M),e){case 0:M.c0=-Number.MAX_VALUE;break;case 1:case 2:{let e=this._ray.origin,t=this.view.elevationProvider.getElevation(e[0],e[1],e[2],this.view.renderCoordsHelper.spatialReference,`ground`)??0,n=this.view.renderCoordsHelper.getAltitude(e);this._isWorldDown&&n<t&&r(M.ray.direction,M.ray.direction),this._extensionType===2&&t!=null&&(M.c1=Math.abs(n-t));break}}if(!h(n.frustum,M))return this._updateLineSegmentFinite(t);let i=d(M,N),a=f(M,P);return g(i,a,t)}_computeLinePositions(e,t,n=!1){let r=0;for(let i of this._lineVertices(t))e[r++]=i[0],e[r++]=i[1],e[r++]=n?D:i[2]}*_lineVertices(e){this.extensionType===3?(yield _(e,-this.fadedExtensions.start,N),yield _(e,0,N),yield _(e,1,N),yield _(e,1+this.fadedExtensions.end,N)):(yield _(e,0,N),yield _(e,1,N))}}function j(e){e.geometries=[]}const M=p(),N=i(),P=i(),F=m(6),I=m(12),L=v(),R=[1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0],z=1/3,B={start:z,end:z};export{A as ExtendedLineVisualElement};
|
|
2
|
+
import{copy as e,subtract as t,exactEquals as n,negate as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as i,fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{exactEquals as o,copy as s}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as c,clone as l}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromRay as u,getStart as d,getEnd as f,create as p}from"../../../../geometry/support/clipRay.js";import{newDoubleArray as m}from"../../../../geometry/support/DoubleArray.js";import{intersectClipRay as h}from"../../../../geometry/support/frustumPlanes.js";import{fromPoints as g,pointAt as _,create as v}from"../../../../geometry/support/lineSegment.js";import{create as y,fromPoints as b}from"../../../../geometry/support/ray.js";import{EngineVisualElement as x}from"./EngineVisualElement.js";import{LaserlineVisualElement as S}from"./LaserlineVisualElement.js";import{selectLocalOrigin as C,createBufferGeometry as w,needsBufferGeometryOriginUpdate as T,updateBufferGeometry as E}from"../../support/engineContent/line.js";import{drapedZ as D}from"../../terrain/DrapedZ.js";import{BufferObject3D as O}from"../../webgl-engine/lib/BufferObject3D.js";import{RibbonLineMaterial as k}from"../../webgl-engine/materials/RibbonLineMaterial.js";class A extends x{constructor(e){super(e),this._ray=y(),this._isWorldDown=!1,this._start=i(),this._end=a(1,0,0),this._width=1,this._color=c(1,0,1,1),this._polygonOffset=!1,this._writeDepthEnabled=!0,this._innerWidth=0,this._innerColor=c(1,1,1,1),this._stipplePattern=null,this._stippleOffColor=null,this._stipplePreferContinuous=!0,this._falloff=0,this._extensionType=0,this._laserlineStyle=null,this._laserlineEnabled=!1,this._renderOccluded=4,this._transparentRenderOrder=0,this._fadedExtensions=B,this._laserline=new S({view:this.view,isDecoration:e.isDecoration}),this.applyProperties(e)}destroy(){this._laserline.destroy(),super.destroy()}createObject3DResourceFactory(e){return{view:e,createObject:()=>new O({geometries:[]}),createResources:e=>this._createObject3DResources(e),destroyResources:j,recreateGeometry:(e,t)=>this._recreateObject3DGeometry(e,t),cameraChanged:()=>this._updateGeometry(),forEachMaterial:(e,t)=>t(e.material)}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:j,recreateGeometry:e=>this._recreateDrapedGeometry(e),forEachMaterial:(e,t)=>t(e.material)}}updateVisibility(e){super.updateVisibility(e),this._laserline.visible=e}onAttachedChange(){this._laserline.attached=this._laserlineAttached}setStartEndFromWorldDownAtLocation(n){this._isWorldDown=!0,e(this._start,n),this.view.renderCoordsHelper.worldUpAtPosition(n,this._end),t(this._end,n,this._end),b(this._start,this._end,this._ray),this._updateGeometry()}get start(){return this._start}set start(t){this._isWorldDown=!1,n(this._start,t)||(e(this._start,t),b(this._start,this._end,this._ray),this._updateGeometry())}get end(){return this._end}set end(t){this._isWorldDown=!1,n(this._end,t)||(e(this._end,t),b(this._start,this._end,this._ray),this._updateGeometry())}get width(){return this._width}set width(e){e!==this._width&&(this._width=e,this._updateMaterial())}get color(){return this._color}set color(e){o(e,this._color)||(s(this._color,e),this._updateMaterial())}get polygonOffset(){return this._polygonOffset}set polygonOffset(e){e!==this._polygonOffset&&(this._polygonOffset=e,this._updateMaterial())}get writeDepthEnabled(){return this._writeDepthEnabled}set writeDepthEnabled(e){this._writeDepthEnabled!==e&&(this._writeDepthEnabled=e,this._updateMaterial())}get innerWidth(){return this._innerWidth}set innerWidth(e){e!==this._innerWidth&&(this._innerWidth=e,this._updateMaterial())}get innerColor(){return this._innerColor}set innerColor(e){o(e,this._innerColor)||(s(this._innerColor,e),this._updateMaterial())}get stipplePattern(){return this._stipplePattern}set stipplePattern(e){let t=e!=null!=(this._stipplePattern!=null);this._stipplePattern=e,t?this.recreate():this._updateMaterial()}get stippleOffColor(){return this._stippleOffColor}set stippleOffColor(e){e!=null&&this._stippleOffColor!=null&&o(e,this._stippleOffColor)||(this._stippleOffColor=e==null?null:l(e),this._updateMaterial())}get stipplePreferContinuous(){return this._stipplePreferContinuous}set stipplePreferContinuous(e){e!==this._stipplePreferContinuous&&(this._stipplePreferContinuous=e,this._updateMaterial())}get falloff(){return this._falloff}set falloff(e){e!==this._falloff&&(this._falloff=e,this._updateMaterial())}get extensionType(){return this._extensionType}set extensionType(e){e!==this._extensionType&&(this._extensionType=e,this.recreateGeometry())}get _laserlineAttached(){return this._laserlineEnabled&&this._laserlineStyle!=null&&this.attached&&!this.isDraped}get laserlineStyle(){return this._laserlineStyle}set laserlineStyle(e){this._laserlineStyle=e,this._laserline.attached=this._laserlineAttached,e!=null&&(this._laserline.style=e)}get laserlineEnabled(){return this._laserlineEnabled}set laserlineEnabled(e){this._laserlineEnabled!==e&&(this._laserlineEnabled=e,this._laserline.attached=this._laserlineAttached)}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateMaterial())}get transparentRenderOrder(){return this._transparentRenderOrder}set transparentRenderOrder(e){e!==this._transparentRenderOrder&&(this._transparentRenderOrder=e,this._updateMaterial())}get _normalizedRenderOccluded(){return this.isDraped&&this._renderOccluded===8?4:this._renderOccluded}get fadedExtensions(){return this._fadedExtensions}set fadedExtensions(e){this._fadedExtensions=e??B,this.recreateGeometry()}_updateMaterial(){let{materialParameters:e}=this;this.object3dResources.resources?.material.setParameters(e),this.drapedResources.resources?.material.setParameters(e)}get materialParameters(){return{width:this._width,color:this._color,stippleOffColor:this._stippleOffColor,stipplePattern:this._stipplePattern,stipplePreferContinuous:this._stipplePreferContinuous,innerWidth:this._innerWidth,innerColor:this._innerColor,falloff:this._falloff,polygonOffset:this._polygonOffset?3:0,renderOccluded:this._normalizedRenderOccluded,testsTransparentRenderOrder:this._transparentRenderOrder,isDecoration:this.isDecoration,writeDepth:this._writeDepthEnabled}}_createObject3DResources(e){let t=new k(this.materialParameters,this.view),n=[];return this._createObject3DGeometry(t,e,n),{material:t,geometries:n}}_recreateObject3DGeometry(e,t){e.geometries.length=0,this._createObject3DGeometry(e.material,t,e.geometries)}_createObject3DGeometry(e,t,n){let r=this._lineSegment,i=this.extensionType===3?I:F;this._computeLinePositions(i,r);let a=this._createGeometry(e,i,this.view.stage.localOriginFactory);n.push(a),t.addGeometry(a),this._laserline.intersectsLine=r}_createDrapedResources(){let e=new k(this.materialParameters,this.view);return{material:e,geometries:[this._createDrapedGeometry(e)]}}_recreateDrapedGeometry(e){e.geometries=[this._createDrapedGeometry(e.material)]}_createDrapedGeometry(e){let t=this.extensionType===3?I:F;return this._computeLinePositions(t,this._lineSegment,!0),this._createGeometry(e,t,this.view.overlayManager.renderer.localOriginFactory)}_createGeometry(e,t,n){let r=C(t,n);return w(e,{attributeData:{position:t,color:this.extensionType===3?R:null},removeDuplicateStartEnd:!1},r)}_updateGeometry(){if(this.isDraped)this.drapedResources.recreateGeometry();else{let e=this.object3dResources.object;e&&this._updateVerticesObject3D(e)}}_updateVerticesObject3D(e){let t=this._lineSegment,n=this.extensionType===3?I:F;this._computeLinePositions(n,t);let r=e.geometries[0];T(r.localOrigin,this.view.stage.localOriginFactory,n)?this.object3dResources.recreateGeometry():(E(r,n,this.extensionType===3?R:null),e.geometryVertexAttributeUpdated(r,`position`),this._laserline.intersectsLine=t)}get _lineSegment(){return this._extensionType===3?this._updateLineSegmentFinite(L):this._updateLineSegmentInfinite(this._extensionType,L)}_updateLineSegmentFinite(e){return g(this._start,this._end,e)}_updateLineSegmentInfinite(e,t){let n=this.view.state.camera;switch(u(this._ray,M),e){case 0:M.c0=-Number.MAX_VALUE;break;case 1:case 2:{let e=this._ray.origin,t=this.view.elevationProvider.getElevation(e[0],e[1],e[2],this.view.renderCoordsHelper.spatialReference,`ground`)??0,n=this.view.renderCoordsHelper.getAltitude(e);this._isWorldDown&&n<t&&r(M.ray.direction,M.ray.direction),this._extensionType===2&&t!=null&&(M.c1=Math.abs(n-t));break}}if(!h(n.frustum,M))return this._updateLineSegmentFinite(t);let i=d(M,N),a=f(M,P);return g(i,a,t)}_computeLinePositions(e,t,n=!1){let r=0;for(let i of this._lineVertices(t))e[r++]=i[0],e[r++]=i[1],e[r++]=n?D:i[2]}*_lineVertices(e){this.extensionType===3?(yield _(e,-this.fadedExtensions.start,N),yield _(e,0,N),yield _(e,1,N),yield _(e,1+this.fadedExtensions.end,N)):(yield _(e,0,N),yield _(e,1,N))}}function j(e){e.geometries=[]}const M=p(),N=i(),P=i(),F=m(6),I=m(12),L=v(),R=[1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0],z=1/3,B={start:z,end:z};export{A as ExtendedLineVisualElement};
|