@arcgis/core 4.29.0 → 4.29.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/arcade/treeAnalysis.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{b43fde3e25d0c3b020b5.js → 039a872509872ce67ba4.js} +1 -1
- package/assets/esri/core/workers/chunks/{5243f9ff21e768c620c2.js → 23a5d750d93a7829174f.js} +1 -1
- package/assets/esri/core/workers/chunks/{47e6119be4a4a5ed640d.js → 2447a4d5886aeb0ff72a.js} +1 -1
- package/assets/esri/core/workers/chunks/{7f45a9e9bdbcffc2d6e0.js → 348bcc57b99a975902a8.js} +1 -1
- package/assets/esri/core/workers/chunks/{8c9fb2601488998013ba.js → 3523789a2948a4ab8cc8.js} +1 -1
- package/assets/esri/core/workers/chunks/{24649b410b757599a549.js → 48db6e0bbb1a9c043193.js} +1 -1
- package/assets/esri/core/workers/chunks/{752082be991f1cc8558f.js → 4984e2b79d862114d6a6.js} +1 -1
- package/assets/esri/core/workers/chunks/{8d9736fd15cdb54d9855.js → 5227f9eea6988aadad7f.js} +1 -1
- package/assets/esri/core/workers/chunks/60ab18c6a04d4b2f1d4c.js +1 -0
- package/assets/esri/core/workers/chunks/647515801d94180b8402.js +1 -0
- package/assets/esri/core/workers/chunks/6c3ae96ec90e9ed7dd50.js +1 -0
- package/assets/esri/core/workers/chunks/7427d03e693f32a81377.js +1 -0
- package/assets/esri/core/workers/chunks/7a8bba91769ee18cc39f.js +1 -0
- package/assets/esri/core/workers/chunks/7a98d2e026f63a581b1e.js +1 -0
- package/assets/esri/core/workers/chunks/8a9387483b19a5ec5b86.js +1 -0
- package/assets/esri/core/workers/chunks/{1a25ba411b89e050fbb7.js → a61f337802ae963d7f65.js} +1 -1
- package/assets/esri/core/workers/chunks/{d0c5318d7ef2e923aad0.js → a8ac511280f873960d46.js} +1 -1
- package/assets/esri/core/workers/chunks/b125ab84b7761e761734.js +1 -0
- package/assets/esri/core/workers/chunks/{b34d6e58b125fe111f91.js → b42a83db83851cb57d44.js} +1 -1
- package/assets/esri/core/workers/chunks/{1497dd943df7eede0704.js → b9c55ff1f21db198ce03.js} +1 -1
- package/assets/esri/core/workers/chunks/bb3322ddb89c0bd444f0.js +1 -0
- package/assets/esri/core/workers/chunks/becfdaeeb07f089d8be7.js +1 -0
- package/assets/esri/core/workers/chunks/{b26e39a399963c176d33.js → c527692694688a5b3b07.js} +2 -2
- package/assets/esri/core/workers/chunks/{210a93e0b96c5bff44a3.js → c556644bb0cf88770939.js} +1 -1
- package/assets/esri/core/workers/chunks/{a5e7b4acae17f88e2208.js → ce93027b6b81428ce9b0.js} +1 -1
- package/assets/esri/core/workers/chunks/{b8ece275abac93f3dccf.js → d14f16bfa6c12909929c.js} +1 -1
- package/assets/esri/core/workers/chunks/{1594f06a2d7d9439c62e.js → e2147c99cc5839654be1.js} +1 -1
- package/assets/esri/core/workers/chunks/{d33ed3a2a0d4b640bd4a.js → e4c7d8c69e4957c9d27c.js} +1 -1
- package/assets/esri/core/workers/chunks/{7709248f59520aee6f51.js → eceaa46f622f6fa31128.js} +1 -1
- package/assets/esri/core/workers/chunks/{2286db4c83ff1b6fb088.js → ef3e6209e6ac6a56960b.js} +1 -1
- package/assets/esri/core/workers/chunks/f59b5ea05caca8a1a398.js +1 -0
- package/chunks/Laserlines.glsl.js +3 -3
- package/chunks/Precipitation.glsl.js +1 -1
- package/chunks/SSAOBlur.glsl.js +2 -2
- package/chunks/boundedPlane.js +1 -1
- package/chunks/cameraUtilsSpherical.js +1 -1
- package/chunks/sphere.js +1 -1
- package/chunks/terrainUtilsPlanar.js +1 -1
- package/chunks/vec32.js +1 -1
- package/core/libs/gl-matrix-2/math/quat.js +1 -1
- package/core/libs/gl-matrix-2/math/vec3.js +1 -1
- package/core/libs/gl-matrix-2/vec3.js +1 -1
- package/geohash/geohashUtils.js +1 -1
- package/geometry/support/axisAngleDegrees.js +1 -1
- package/geometry/support/coordinateSystem.js +1 -1
- package/geometry/support/lineSegment.js +1 -1
- package/geometry/support/meshUtils/exporters/gltf/gltf.js +1 -1
- package/geometry/support/meshUtils/georeference.js +1 -1
- package/geometry/support/meshUtils/merge.js +1 -1
- package/geometry/support/meshUtils/rotate.js +1 -1
- package/geometry/support/meshUtils/scale.js +1 -1
- package/geometry/support/meshUtils/vertexSpaceConversion.js +5 -0
- package/geometry/support/meshVertexSpaceUtils.js +1 -1
- package/geometry/support/plane.js +1 -1
- package/geometry/support/ray.js +1 -1
- package/geometry/support/triangle.js +1 -1
- package/geometry/support/vector.js +1 -1
- package/interfaces.d.ts +20 -14
- package/kernel.js +1 -1
- package/layers/IntegratedMesh3DTilesLayer.js +1 -1
- package/layers/LinkChartLayer.js +1 -1
- package/layers/VoxelWasmPerSceneView.js +1 -1
- package/layers/graphics/data/StreamFeatureManager.js +1 -1
- package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
- package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
- package/layers/mixins/FeatureReductionLayer.js +1 -1
- package/layers/orientedImagery/core/coverageUtils.js +1 -1
- package/layers/orientedImagery/transformations/imageToGroundUtils.js +1 -1
- package/layers/orientedImagery/transformations/imageToWorld.js +1 -1
- package/layers/support/layerUtils.js +1 -1
- package/layers/video/VideoCameraSensorModel.js +1 -1
- package/layers/voxel/VoxelVolume.js +1 -1
- package/layers/voxel/voxelPlaneUtils.js +1 -1
- package/libs/linkchartlayout/LinkChartLayout.js +1 -1
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/cimAnalyzer.js +1 -1
- package/views/2d/arcade/callExpressionWithCursor.js +1 -1
- package/views/2d/engine/webgl/collisions/CollisionEngine.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/createTestMeshData.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriterInputEvaluator.js +1 -1
- package/views/2d/interactive/editingTools/TransformTool.js +1 -1
- package/views/2d/interactive/editingTools/manipulations/ScaleManipulation.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/features/Processor.js +1 -1
- package/views/2d/layers/features/aggregation/GeohashSpatialIndex.js +1 -1
- package/views/2d/layers/features/aggregation/GridSpatialIndex.js +1 -1
- package/views/2d/layers/features/processor/BinningStrategy.js +1 -1
- package/views/2d/layers/features/processor/ClusterStrategy.js +1 -1
- package/views/2d/layers/features/processor/FeatureUpdateStrategy.js +1 -1
- package/views/2d/layers/features/schema/processor/SimpleProcessorSchema.js +1 -1
- package/views/2d/layers/features/schema/processor/SubtypeProcessorSchema.js +1 -1
- package/views/2d/layers/features/sources/strategies/StreamLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/DrillDownTileSourceChunk.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/FeatureSnapshotSourceChunk.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/OverrideChunk.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/PagedTileSourceChunk.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/StreamSourceChunk.js +1 -1
- package/views/2d/layers/features/support/AttributeStore.js +1 -1
- package/views/2d/layers/features/support/GraphicsReader.js +1 -1
- package/views/2d/layers/features/support/Tile.js +1 -1
- package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
- package/views/2d/tiling/TileKey.js +1 -1
- package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
- package/views/3d/analysis/Dimension/lengthDimensionConstraintUtils.js +1 -1
- package/views/3d/analysis/Dimension/lengthDimensionManipulatorUtils.js +1 -1
- package/views/3d/analysis/Dimension/lengthDimensionUtils.js +1 -1
- package/views/3d/analysis/DirectLineMeasurement/DirectLineMeasurementController.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightIntersectionResult.js +1 -1
- package/views/3d/analysis/Slice/SliceTool.js +1 -1
- package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
- package/views/3d/analysis/support/measurementUtils.js +1 -1
- package/views/3d/animation/pointToPoint/Camera.js +1 -1
- package/views/3d/camera/constraintUtils/common.js +1 -1
- package/views/3d/camera/constraintUtils/distance.js +1 -1
- package/views/3d/camera/constraintUtils/tilt.js +1 -1
- package/views/3d/camera/intersectionUtils.js +1 -1
- package/views/3d/environment/ChapmanAtmosphere.js +1 -1
- package/views/3d/environment/EnvironmentRenderer.js +1 -1
- package/views/3d/environment/Fog.js +1 -1
- package/views/3d/environment/MarsAtmosphere.js +1 -1
- package/views/3d/environment/SceneViewEnvironmentManager.js +1 -1
- package/views/3d/interactive/SnappingVisualizer3D.js +1 -1
- package/views/3d/interactive/editingTools/dragEventPipeline3D.js +1 -1
- package/views/3d/interactive/editingTools/manipulations/MoveZManipulation.js +1 -1
- package/views/3d/interactive/editingTools/reshapeGraphic/ReshapeOperation.js +1 -1
- package/views/3d/interactive/editingTools/reshapeGraphic/edgeOffsetUtils.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/ExtentScale.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/extentUtils.js +1 -1
- package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/support/Segment.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/PointCloudLayerView3D.js +1 -1
- package/views/3d/layers/PointCloudWorker.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
- package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
- package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
- package/views/3d/layers/i3s/LoDUtil.js +1 -1
- package/views/3d/layers/i3s/PointRenderer.js +1 -1
- package/views/3d/layers/support/FeatureTileMeasurements3D.js +1 -1
- package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
- package/views/3d/layers/support/uvUtils.js +1 -1
- package/views/3d/state/Frustum.js +1 -1
- package/views/3d/state/NearFarHeuristic.js +1 -1
- package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
- package/views/3d/state/controllers/RotateController.js +1 -1
- package/views/3d/state/controllers/global/PinchAndPanController.js +1 -1
- package/views/3d/state/controllers/global/ZoomController.js +1 -1
- package/views/3d/state/controllers/global/ZoomStepController.js +1 -1
- package/views/3d/state/controllers/local/PinchAndPanController.js +1 -1
- package/views/3d/state/controllers/local/ZoomController.js +1 -1
- package/views/3d/state/controllers/local/ZoomStepController.js +1 -1
- package/views/3d/state/controllers/momentum/ZoomPlanarMomentumController.js +1 -1
- package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
- package/views/3d/state/utils/navigationUtils.js +1 -1
- package/views/3d/state/utils/viewUtils.js +1 -1
- package/views/3d/support/FrustumExtentIntersection.js +1 -1
- package/views/3d/support/cameraUtils.js +1 -1
- package/views/3d/support/cameraUtilsInternal.js +1 -1
- package/views/3d/support/intersectionUtils.js +1 -1
- package/views/3d/support/mathUtils.js +1 -1
- package/views/3d/support/orientedBoundingBox.js +1 -1
- package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
- package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
- package/views/3d/support/pointsOfInterest/Focus.js +1 -1
- package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
- package/views/3d/support/sunUtils.js +1 -1
- package/views/3d/support/viewpointUtils.js +1 -1
- package/views/3d/terrain/OverlayManager.js +1 -1
- package/views/3d/terrain/PatchRenderData.js +1 -1
- package/views/3d/terrain/SphericalPatch.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/Tile.js +1 -1
- package/views/3d/webgl-engine/collections/Component/DepthRange.js +1 -1
- package/views/3d/webgl-engine/collections/Component/IntersectionGeometry.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/core/util/TwoVectorPosition.js +1 -1
- package/views/3d/webgl-engine/effects/RenderNodes.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
- package/views/3d/webgl-engine/lib/BoundingInfo.js +1 -1
- package/views/3d/webgl-engine/lib/Camera.js +1 -1
- package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
- package/views/3d/webgl-engine/lib/Object3D.js +1 -1
- package/views/3d/webgl-engine/lib/Octree.js +1 -1
- package/views/3d/webgl-engine/lib/PathVertex.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/edgePreprocessing.js +1 -1
- package/views/3d/webgl-engine/lib/geometryDataUtils.js +1 -1
- package/views/3d/webgl-engine/lib/intersectorUtils.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/verticalOffsetUtils.js +1 -1
- package/views/3d/webgl-engine/lighting/SceneLighting.js +1 -1
- package/views/3d/webgl-engine/lighting/SphericalHarmonics.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/pbrUtils.js +1 -1
- package/views/SelectionManager.js +1 -1
- package/views/draw/support/createUtils.js +1 -1
- package/views/draw/support/surfaceCoordinateSystems.js +1 -1
- package/views/interactive/GraphicManipulator.js +1 -1
- package/views/interactive/SegmentLabels.js +1 -1
- package/views/interactive/coordinateHelper.js +1 -1
- package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
- package/views/interactive/editGeometry/support/editPlaneUtils.js +1 -1
- package/views/interactive/sketch/constraints.js +1 -1
- package/views/interactive/snapping/RightAngleSnapper.js +1 -1
- package/views/interactive/snapping/candidates/ParallelLineSnappingCandidate.js +1 -1
- package/views/interactive/snapping/candidates/RightAngleTriangleSnappingCandidate.js +1 -1
- package/views/interactive/snapping/featureSources/sceneLayerSource/SceneLayerSnappingSourceWorker.js +1 -1
- package/views/interactive/snapping/featureSources/sceneLayerSource/sceneLayerSnappingUtils.js +1 -1
- package/views/interactive/snapping/hints/IntersectionSnappingHint.js +1 -1
- package/views/interactive/snapping/hints/LineSnappingHint.js +1 -1
- package/views/interactive/snapping/hints/ParallelSnappingHint.js +1 -1
- package/views/interactive/snapping/hints/PointSnappingHint.js +1 -1
- package/views/interactive/snapping/hints/RightAngleSnappingHint.js +1 -1
- package/views/layers/FeatureLayerView.js +1 -1
- package/views/navigation/PanSphericalMomentumEstimator.js +1 -1
- package/views/support/angularMeasurementUtils.js +1 -1
- package/views/support/euclideanAreaMeasurementUtils.js +1 -1
- package/views/support/euclideanLengthMeasurementUtils.js +1 -1
- package/views/support/geometry3dUtils.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/ElevationProfile/support/geometryUtils.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/Grid/Grid.js +1 -1
- package/widgets/FeatureTable/support/ColumnTemplateBase.js +1 -1
- package/widgets/Features/FeaturesViewModel.js +1 -1
- package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
- package/widgets/PanoramicViewer/utils.js +1 -1
- package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
- package/widgets/support/Selector2D/SelectionOperation.js +1 -1
- package/widgets/support/Selector2D/selectorUtils.js +1 -1
- package/assets/esri/core/workers/chunks/0e83f3718a0b45652b5e.js +0 -1
- package/assets/esri/core/workers/chunks/1fa5c8af69a09a3730b3.js +0 -1
- package/assets/esri/core/workers/chunks/4736f79b5c94ce103d43.js +0 -1
- package/assets/esri/core/workers/chunks/65f7adaaf1f535310c11.js +0 -1
- package/assets/esri/core/workers/chunks/79c041b292648c5eaecc.js +0 -1
- package/assets/esri/core/workers/chunks/7c4c2c0beddabac672b6.js +0 -1
- package/assets/esri/core/workers/chunks/9307d485a9e5f9fa77d1.js +0 -1
- package/assets/esri/core/workers/chunks/9a758de08dfa57735879.js +0 -1
- package/assets/esri/core/workers/chunks/a4c3da057ec2a07bbbe8.js +0 -1
- package/assets/esri/core/workers/chunks/b252270b100351779f1f.js +0 -1
- package/assets/esri/core/workers/chunks/dc57aa9f2fc69e654559.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../Graphic.js";import s from"../request.js";import has from"../core/has.js";import r from"../core/Logger.js";import{isAbortError as i}from"../core/promiseUtils.js";import{watch as a,initial as n}from"../core/reactiveUtils.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import"../core/RandomLCG.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import{p as h}from"../chunks/vec32.js";import{create as d}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{renderSRFromViewSR as u}from"../geometry/support/coordinateSystem.js";import{PointIndex as _,PlaneIndex as c}from"../geometry/support/frustum.js";import{WasmCullMode as m,VoxelRequestType as g,UpdateFlags as p,ContainerType as f}from"../libs/vxl/enums.js";import{loadVoxelWASM as x}from"../libs/vxl/VxlModule.js";import{ViewingMode as y}from"../views/ViewingMode.js";import{VoxelTarget as v}from"../views/3d/layers/i3s/Intersector.js";import{Frustum as b}from"../views/3d/state/Frustum.js";import{RenderCoordsHelper as w}from"../views/3d/support/RenderCoordsHelper.js";import{SyncRenderPlugin as T}from"../views/3d/webgl-engine/effects/RenderPlugin.js";import{newIntersectorResult as R}from"../views/3d/webgl-engine/lib/Intersector.js";import{IntersectorType as L,StoreResults as E}from"../views/3d/webgl-engine/lib/IntersectorInterfaces.js";import{RenderFeature as V}from"../views/3d/webgl-engine/lib/RenderFeature.js";import{RenderSlot as C}from"../views/3d/webgl-engine/lib/RenderSlot.js";import{CompareFunction as F,Face as S,StencilOperation as P}from"../views/webgl/enums.js";var I;!function(e){e[e.Lifetime=1]="Lifetime",e[e.RequestResponse=2]="RequestResponse",e[e.Rendering=3]="Rendering",e[e.Error=4]="Error"}(I||(I={}));let U=class extends T{constructor(e){super(e),this._halfIntTexturesAvailable=!1,this._textureFloatLinearAvailable=!1,this._havePreparedWithAllLayers=!1,this._renderPluginContext=null,this._vxlPromise=null,this._vxl=null,this._pluginIsActive=!1,this._moreToLoad=!1,this._viewportWidth=-1,this._viewportHeight=-1,this._newLayers=[],this._layers=new Map,this._rctx=null,this._renderTargetToRestore=null,this._lastFrameWasStationary=!1,this._wasmMemBlockSizes=[512,1024,2048,4096,8192,16384,32768,65536],this._wasmMemBlocks=new Map,this._dbgFlags=new Set,this._captureFrustum=!1,this._frustum=null,this._frustumRenderableId=-1,this._renderCoordsHelper=null,this.produces=new Map([[C.VOXEL,()=>!!this._vxl&&"local"===this.view.viewingMode]]),this.type=L.VOXEL,this.slicePlaneEnabled=!0,this.isGround=!1,this.layerUid=[]}_dbg(e,t){this._dbgFlags.has(e)&&(e===I.Error?r.getLogger(this).error(t):r.getLogger(this).warn(t))}_removeRenderPlugin(){this._pluginIsActive&&this.view._stage&&(this._dbg(I.Lifetime,"--removeRenderPlugin--"),this.view._stage.removeRenderPlugin(this)),this._pluginIsActive=!1}initialize(){this._dbg(I.Lifetime,"--initialize--");for(const e of this._wasmMemBlockSizes)this._wasmMemBlocks.set(e,0);this.addHandles([a((()=>this.view.ready),(e=>{e&&"local"===this.view.viewingMode?(this._dbg(I.Lifetime,"view ready status changed to ready on a local view, calling addRenderPlugin"),this.view._stage.addRenderPlugin(this),this._pluginIsActive=!0):(this._dbg(I.Lifetime,"view ready status changed, not ready or not a local view!"),this._removeRenderPlugin())}),n),a((()=>this.view?.qualityProfile),(e=>{this._dbg(I.Rendering,"qualityProfile changed to "+e),this._vxl&&this._vxl.set_quality(this._toWasmQuality(e))}),n),a((()=>this.view?.timeExtent),(()=>{if(this._vxl){const e=this._getTimeArgs(this.view?.timeExtent);this._dbg(I.Rendering,"sceneView timeExtent changed to useTime="+e.useTime+" st="+e.startTime+" et="+e.endTime),this._vxl.set_scene_time_extent(e.startTime,e.endTime,e.useTime),this._renderPluginContext.requestRender()}}),n),a((()=>this.view?.stationary),(e=>{this._vxl&&e&&!this._lastFrameWasStationary&&this._renderPluginContext.requestRender()}))])}initializeRenderContext(e){this._dbg(I.Lifetime,"--initializeRenderContext--");const t=e.renderContext.rctx;this._renderPluginContext=e,this._rctx=e.renderContext.rctx,this._halfIntTexturesAvailable=!!this._rctx.capabilities.textureNorm16,this._textureFloatLinearAvailable=this._rctx.capabilities.textureFloatLinear,this._initializeWasm(t.gl)}uninitializeRenderContext(){this._renderPluginContext=null,this._rctx=null,this._dbg(I.Lifetime,"--uninitializeRenderContext--")}_restoreFramebuffer(){if(!this._renderTargetToRestore)return;const e=this._renderTargetToRestore.fbo;if(!!!this._rctx)return void this._dbg(I.Error,"no context in restoreFramebuffer!");this._rctx.bindFramebuffer(e,!0);const t=this._renderTargetToRestore.viewport;this._rctx.setViewport(t.x,t.y,t.width,t.height)}_bindPreviousDepthToSlot(e,t){const s=!!this._rctx,r=!!this._renderTargetToRestore;if(!s||!r)return 0;const i=this._renderTargetToRestore.fbo.depthStencilTexture;return i?(0===t?this._rctx.bindTexture(null,e,!0):this._rctx.bindTexture(i,e,!0),1):(this._dbg(I.Error,"no depth/stencil texture exists!"),0)}_modifyResourceCount(e,t,s){if(!this._rctx)return void this._dbg(I.Error,"modifyAllocation callback has no rendering context!");const r=e;1===s?this._rctx.instanceCounter.increment(r,t):this._rctx.instanceCounter.decrement(r,t)}_setBlendState(e,t,s,r){this._rctx?(this._rctx.setBlendingEnabled(1===e),this._rctx.setBlendFunction(t,s),this._rctx.setBlendEquation(r)):this._dbg(I.Error,"setBlendState callback has no rendering context!")}_setFrontFace(e){this._rctx?this._rctx.setFrontFace(e):this._dbg(I.Error,"setFrontFace callback has no rendering context!")}_setDepthStencilStateFunction(e,t,s){this._rctx?(this._rctx.setDepthFunction(s),this._rctx.setDepthTestEnabled(1===e),this._rctx.setDepthWriteEnabled(1===t),this._rctx.setStencilTestEnabled(!1),this._rctx.setStencilFunction(F.ALWAYS,0,255),this._rctx.setStencilOpSeparate(S.FRONT,P.KEEP,P.INCR,P.KEEP),this._rctx.setStencilOpSeparate(S.BACK,P.KEEP,P.DECR,P.KEEP)):this._dbg(I.Error,"setDepthStencilStateFunction callback has no rendering context!")}_setRasterizerState(e){if(this._rctx)switch(e){case m.None:this._rctx.setFaceCullingEnabled(!1);break;case m.Back:this._rctx.setCullFace(S.BACK),this._rctx.setFaceCullingEnabled(!0);break;case m.Front:this._rctx.setCullFace(S.FRONT),this._rctx.setFaceCullingEnabled(!0)}else this._dbg(I.Error,"setRasterizerState callback has no rendering context!")}_setViewport(e,t,s,r){this._rctx?this._rctx.setViewport(e,t,s,r):this._dbg(I.Error,"setViewport callback has no rendering context!")}_updateMemoryUsage(){this._layers.forEach(((e,t)=>{if(e.needMemoryUsageUpdate){const s=this._vxl.estimate_memory_usage(t);s>=0&&(e.needMemoryUsageUpdate=!1,e.layerView.setUsedMemory(s))}}))}_syncRequestsResponses(){this._layers.forEach(((e,t)=>{const r=[];e.responses.forEach(((s,i)=>{r.push(i),this._dbg(I.RequestResponse,"responding for requestID:"+i+" size:"+s.size),this._vxl.respond(t,i,s),s.requestType!==g.TreeIndex&&s.requestType!==g.Section||(e.needMemoryUsageUpdate=!0)}));const a=e.responses;for(const s of r)a.delete(s);const n=this._vxl.get_new_requests(t),o=e.abortController.signal;for(const l in n){e.outstandingRequestCount+=1,1===e.outstandingRequestCount&&e.layerView.updatingFlagChanged();const t=n[l],r={responseType:"array-buffer",signal:o,query:{...e.layerView.layer.customParameters,token:e.layerView.layer.apiKey}};this._dbg(I.RequestResponse,"making requestID:"+l+" url:"+t.url),s(t.url,r).then((s=>{e.outstandingRequestCount-=1,0===e.outstandingRequestCount&&e.layerView.updatingFlagChanged(),this._dbg(I.RequestResponse,"have response for requestID:"+l);let r=0;if(s.data.byteLength>0){r=this._vxl._malloc(s.data.byteLength);const e=new Uint8Array(this._vxl.HEAPU8.buffer,r,s.data.byteLength),t=new Uint8Array(s.data);for(let r=0;r<s.data.byteLength;++r)e[r]=t[r]}a.set(+l,{responseType:t.responseType,ptr:r,size:s.data.byteLength,success:!0,requestType:t.requestType})})).catch((s=>{e.outstandingRequestCount-=1,0===e.outstandingRequestCount&&e.layerView.updatingFlagChanged(),i(s)||(this._dbg(I.Error,`requestID:${l} failed, error=${s.toString()}`),a.set(+l,{responseType:t.responseType,ptr:0,size:0,success:!1,requestType:t.requestType}))}))}}))}updateWasmCamera(e){this._vxl.set_projection_matrix.apply(this._vxl,e.projectionMatrix),this._vxl.set_view_matrix.apply(this._vxl,e.viewMatrix),this._vxl.set_near_far(e.near,e.far)}isUpdating(e){if(!this._vxl&&this._vxlPromise)return!0;const t=this._layers.get(e);return!!t&&t.outstandingRequestCount>0}getLayerTimes(e){const t=[];return this._layers.forEach(((s,r)=>{if(s.layerView.wasmLayerId===e.wasmLayerId){const s=this._vxl.get_layer_epoch_times(r,e.layer.currentVariableId);for(let e=0;e<s.length;++e)t.push(s[e])}})),t}getCurrentLayerTimeIndex(e){let t=0;return this._layers.forEach(((s,r)=>{s.layerView.wasmLayerId===e.wasmLayerId&&(t=this._vxl.get_layer_current_time_id(r))})),t}setEnabled(e,t){this._layers.forEach(((s,r)=>{s.layerView.wasmLayerId===e.wasmLayerId&&(this._vxl.set_enabled(r,t),s.needMemoryUsageUpdate=!0,this._renderPluginContext.requestRender())}))}setIsInScaleRange(e,t){const s=this._layers.get(e.wasmLayerId);s&&t!==s.isInScaleRange&&(s.isInScaleRange=t,this._vxl.set_is_in_scale_range(e.wasmLayerId,t),s.needMemoryUsageUpdate=!t,this._renderPluginContext.requestRender())}setStaticSections(e,t){const s={mask:p.StaticSections,staticSections:t};return this._doMaskedUIUpdate(e,s,!0)}setCurrentVariable(e,t){const s={mask:p.CurrentVariable,currentVariable:t};return this._doMaskedUIUpdate(e,s,!0)}setRenderMode(e,t){const s={mask:p.RenderMode,renderMode:t};return this._doMaskedUIUpdate(e,s,!0)}setVerticalExaggerationAndOffset(e,t,s,r){const i={mask:p.ExaggerationAndOffset,volStyleDesc:{volumeId:t,verticalExaggeration:s,verticalOffset:r}};return this._doMaskedUIUpdate(e,i,!0)}setVariableStyles(e,t){const s={mask:p.VariableStyles,variableStyles:t};return this._doMaskedUIUpdate(e,s,!0)}setVolumeStyles(e,t){const s={mask:p.VolumeStyles,volumeStyles:t};return this._doMaskedUIUpdate(e,s,!0)}setEnableDynamicSections(e,t){const s={mask:p.ContainerVisibility,containerIsVisible:t,container:f.DynamicSections};return this._doMaskedUIUpdate(e,s,!0)}setEnableIsosurfaces(e,t){const s={mask:p.ContainerVisibility,containerIsVisible:t,container:f.Isosurfaces};return this._doMaskedUIUpdate(e,s,!0)}setEnableSections(e,t){const s={mask:p.ContainerVisibility,containerIsVisible:t,container:f.StaticSections};return this._doMaskedUIUpdate(e,s,!0)}setAnalysisSlice(e,t,s,r){const i={mask:p.AnalysisSlice,analysisSlice:{point:s,normal:r,enabled:t}};return this._doMaskedUIUpdate(e,i,!0)}_doMaskedUIUpdate(e,t,s){if(!this._vxl)return!1;let r=!1;return this._layers.forEach(((s,i)=>{if(s.layerView.wasmLayerId===e.wasmLayerId){const e={str:JSON.stringify(t),byteCount:0,ptr:0,isReusable:!1};this._allocateBlock(e)&&(r=1===this._vxl.handle_masked_ui_update(i,e.ptr,e.byteCount),e.isReusable||this._vxl._free(e.ptr))}})),r&&s&&this._renderPluginContext.requestRender(),r}_addTriangleToWasmBuffer(e,t,s,r,i){return e[3*t]=s[0],e[3*t+1]=s[1],e[3*t+2]=s[2],e[3*(t+=1)]=r[0],e[3*t+1]=r[1],e[3*t+2]=r[2],e[3*(t+=1)]=i[0],e[3*t+1]=i[1],e[3*t+2]=i[2],t+=1}_addNormalToWasmBuffer(e,t,s){return e[3*t]=s[0],e[3*t+1]=s[1],e[3*t+2]=s[2],t+=1}_doCaptureFrustum(){if(!this._vxl)return;const e=36,t=e/3,s=this._vxl._malloc(3*e*Float32Array.BYTES_PER_ELEMENT),r=new Float32Array(this._vxl.HEAPF32.buffer,s,3*e),i=this._vxl._malloc(3*t*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(this._vxl.HEAPF32.buffer,i,e),n=this._frustum.points[_.NEAR_BOTTOM_LEFT],o=this._frustum.points[_.NEAR_BOTTOM_RIGHT],l=this._frustum.points[_.NEAR_TOP_RIGHT],h=this._frustum.points[_.NEAR_TOP_LEFT],d=this._frustum.points[_.FAR_BOTTOM_LEFT],u=this._frustum.points[_.FAR_BOTTOM_RIGHT],m=this._frustum.points[_.FAR_TOP_RIGHT],g=this._frustum.points[_.FAR_TOP_LEFT];let p=0,f=0;const x=this._frustum.planes[c.NEAR];p=this._addTriangleToWasmBuffer(r,p,l,o,n),f=this._addNormalToWasmBuffer(a,f,x),p=this._addTriangleToWasmBuffer(r,p,n,h,l),f=this._addNormalToWasmBuffer(a,f,x);const y=this._frustum.planes[c.FAR];p=this._addTriangleToWasmBuffer(r,p,d,u,m),f=this._addNormalToWasmBuffer(a,f,y),p=this._addTriangleToWasmBuffer(r,p,m,g,d),f=this._addNormalToWasmBuffer(a,f,y);const v=this._frustum.planes[c.TOP];p=this._addTriangleToWasmBuffer(r,p,m,l,h),f=this._addNormalToWasmBuffer(a,f,v),p=this._addTriangleToWasmBuffer(r,p,h,g,m),f=this._addNormalToWasmBuffer(a,f,v);const b=this._frustum.planes[c.BOTTOM];p=this._addTriangleToWasmBuffer(r,p,n,o,u),f=this._addNormalToWasmBuffer(a,f,b),p=this._addTriangleToWasmBuffer(r,p,u,d,n),f=this._addNormalToWasmBuffer(a,f,b);const w=this._frustum.planes[c.LEFT];p=this._addTriangleToWasmBuffer(r,p,h,n,d),f=this._addNormalToWasmBuffer(a,f,w),p=this._addTriangleToWasmBuffer(r,p,d,g,h),f=this._addNormalToWasmBuffer(a,f,w);const T=this._frustum.planes[c.RIGHT];p=this._addTriangleToWasmBuffer(r,p,l,m,u),f=this._addNormalToWasmBuffer(a,f,T),p=this._addTriangleToWasmBuffer(r,p,u,o,l),f=this._addNormalToWasmBuffer(a,f,T),-1!==this._frustumRenderableId&&this._vxl.remove_generic_mesh(this._frustumRenderableId),this._frustumRenderableId=this._vxl.add_generic_mesh(s,3*e,i,e,255,0,0,64),this._vxl._free(s),this._vxl._free(i),this._captureFrustum=!1,this._renderPluginContext.requestRender()}captureFrustum(){null===this._renderCoordsHelper&&(this._renderCoordsHelper=w.create(y.Local,u(!1,this.view.spatialReference))),null===this._frustum&&(this._frustum=new b(this._renderCoordsHelper)),this._captureFrustum=!0,null!==this._renderPluginContext&&this._renderPluginContext.requestRender()}toggleFullVolumeExtentDraw(e){this._vxl&&this._layers.forEach(((t,s)=>{t.layerView.wasmLayerId===e.wasmLayerId&&(this._vxl.toggle_full_volume_extent_draw(s),this._renderPluginContext.requestRender())}))}addVoxelLayer(e){if(!this._vxl){const t={layerView:e,resolveCallback:null,rejectCallback:null},s=new Promise(((e,s)=>{t.resolveCallback=e,t.rejectCallback=s}));return this._newLayers.push(t),s}const t=this._addVoxelLayer(e);return t<0?Promise.reject(-1):Promise.resolve(t)}removeVoxelLayer(e){if(!this._vxl){const t=this._newLayers.findIndex((t=>e.uid===t.layerView.uid));t>=0&&(this._newLayers[t].resolveCallback(-1),this._newLayers.splice(t,1));const s=this._newLayers.length;return 0===s&&(this._dbg(I.Lifetime," no voxel layers left after removing a layer, removing RenderPlugin and destroying"),this.destroy()),s}let t=-1;this._layers.forEach(((s,r)=>{if(s.layerView.wasmLayerId===e.wasmLayerId){t=r,s.abortController.abort(),this._vxl.remove_layer(t);const i=this.layerUid.indexOf(e.layer.uid);-1!==i&&this.layerUid.splice(i,1)}})),t>=0&&this._layers.delete(t);const s=this._layers.size;return 0===s&&(this._dbg(I.Lifetime," no voxel layers left after removing a layer, removing RenderPlugin and destroying"),this.destroy()),s}_getBlockSize(e){for(const t of this._wasmMemBlockSizes)if(e<t)return t;return-1}_allocateBlock(e){e.byteCount=this._vxl.lengthBytesUTF8(e.str)+1;const t=this._getBlockSize(e.byteCount);return t<0?(e.isReusable=!1,e.ptr=this._vxl._malloc(e.byteCount)):(e.isReusable=!0,e.ptr=this._wasmMemBlocks.get(t),0===e.ptr&&(e.ptr=this._vxl._malloc(t),this._wasmMemBlocks.set(t,e.ptr))),0!==e.ptr&&(this._vxl.stringToUTF8(e.str,e.ptr,e.byteCount),!0)}_getTimeArgs(e){let t=-Number.MAX_VALUE,s=Number.MAX_VALUE,r=!1;return null!=e&&(e.isAllTime?r=!0:(null!=e.start&&(r=!0,t=e.start.getTime()/1e3),null!=e.end&&(r=!0,s=e.end.getTime()/1e3))),{startTime:t,endTime:s,useTime:r}}_addVoxelLayer(e){const t=e.layer;let s=-1;const i=t.getConfiguration();if(i.length<1)return-1;const a={str:i,byteCount:0,ptr:0,isReusable:!1};if(!this._allocateBlock(a))return-1;const n=this._getTimeArgs(this.view?.timeExtent),o=this.view.spatialReference.isWGS84&&t.spatialReference.isWGS84?111319.49079327357:1;if(s=this._vxl.add_layer(t.serviceRoot,a.ptr,a.byteCount,o,o,n.startTime,n.endTime,n.useTime,this._toWasmQuality(this.view.qualityProfile)),a.isReusable||this._vxl._free(a.ptr),s>=0){t.test?.constantUpscaling&&(this._setUpscalingLimits(0,.25,.25),this._setUpscalingLimits(1,.5,.5),this._setUpscalingLimits(2,.75,.75));const i=new AbortController;if(this._layers.set(s,{layerView:e,responses:new Map,outstandingRequestCount:0,abortController:i,needMemoryUsageUpdate:!1,isInScaleRange:!0}),this.layerUid.push(e.layer.uid),!this._halfIntTexturesAvailable||has("mac")){const t=[];let s="";for(const r of e.layer.variables)"Int16"!==r.renderingFormat.type&&"UInt16"!==r.renderingFormat.type||(t.push(r.name),r.id===e.layer.currentVariableId&&(s=r.name));""!==s&&r.getLogger(this).error("#addVoxelLayer_error()",e.layer,`The voxel layer '${e.layer.title}' cannot render the current variable '${s}' in this browser`),t.length>0&&r.getLogger(this).warn("#addVoxelLayer_warning()",e.layer,`The voxel layer '${e.layer.title}' cannot render the variables '${t.toString()}' in this browser`)}if(!this._textureFloatLinearAvailable){const t=[];let s="";for(const r of e.layer.variables)"Float32"===r.renderingFormat.type&&(t.push(r.name),r.id===e.layer.currentVariableId&&(s=r.name));""!==s&&r.getLogger(this).error("#addVoxelLayer_error()",e.layer,`The voxel layer '${e.layer.title}' cannot render the current variable '${s}' in this browser`),t.length>0&&r.getLogger(this).warn("#addVoxelLayer_warning()",e.layer,`The voxel layer '${e.layer.title}' cannot render the variables '${t.toString()}' in this browser`)}return has("esri-mobile")&&r.getLogger(this).warnOnce("Mobile support differs across devices. Voxel layer might not display as expected."),s}return-1}prepareRender(e){if(!this._vxl)return;const t=e.bindParameters.camera.viewForward,s=e.bindParameters.camera.eye;this._vxl.update_camera_pos_and_direction(s[0],s[1],s[2],t[0],t[1],t[2]);const r=this._vxl.cull();this._dbg(I.RequestResponse,"missingResourceCount="+r),this._moreToLoad=r>0,this._havePreparedWithAllLayers=0===this._newLayers.length,this._updateMemoryUsage()}renderNode(e){if(!this._vxl)return;for(const s of this._newLayers){const e=this._addVoxelLayer(s.layerView);-1===e?s.rejectCallback(-1):s.resolveCallback(e)}if(this._newLayers=[],0===this._layers.size)return void this._dbg(I.Error,"No voxel layers but RenderPlugin instance is being asked to render!");this._lastFrameWasStationary=this.view.stationary,this._syncRequestsResponses(),this._beforeDraw(),this._vxl.begin_color_frame(!this.view._stage.renderer.isFeatureEnabled(V.HighResolutionVoxel),e.bindParameters.lighting.mainLight.direction[0],e.bindParameters.lighting.mainLight.direction[1],e.bindParameters.lighting.mainLight.direction[2]);const t=this._renderTargetToRestore.viewport;t.width===this._viewportWidth&&t.height===this._viewportHeight||(this._viewportWidth=t.width,this._viewportHeight=t.height,this._vxl.set_viewport(t.width,t.height),this._layers.forEach((e=>{e.needMemoryUsageUpdate=!0}))),0===t.x&&0===t.y||this._dbg(I.Error,"Unsupported viewport parameters detected!"),this.updateWasmCamera(e.bindParameters.camera),this._captureFrustum&&(this._frustum.update(e.bindParameters.camera),this._doCaptureFrustum()),this._vxl.draw(),this._afterDraw(),(this._moreToLoad||!this._havePreparedWithAllLayers&&this._layers.size>0)&&this._renderPluginContext.requestRender()}destroy(){this._dbg(I.Lifetime,"--destroy--"),this._removeRenderPlugin(),this._vxl&&(this._layers.forEach((e=>{e.abortController.abort()})),this._wasmMemBlocks.forEach((e=>{0!==e&&this._vxl._free(e)})),this._vxl.uninitialize_voxel_wasm(),this._vxl=null)}_initializeWasm(e){return this._vxl?Promise.resolve():(this._vxlPromise||(this._vxlPromise=x(e).then((e=>{if(this._vxl=e,this._vxlPromise=null,this._newLayers.length<=0)return this._dbg(I.Lifetime," no voxel layers left after WASM downloaded, removing RenderPlugin and destroying"),void this.destroy();const t=this._getTimeArgs(this.view?.timeExtent),s=this._vxl.addFunction(this._restoreFramebuffer.bind(this),"v"),r=this._vxl.addFunction(this._setBlendState.bind(this),"viiii"),i=this._vxl.addFunction(this._setFrontFace.bind(this),"vi"),a=this._vxl.addFunction(this._setRasterizerState.bind(this),"vi"),n=this._vxl.addFunction(this._setDepthStencilStateFunction.bind(this),"viii"),o=this._vxl.addFunction(this._setViewport.bind(this),"viiii"),l=this._vxl.addFunction(this._bindPreviousDepthToSlot.bind(this),"iii"),h=this._vxl.addFunction(this._modifyResourceCount.bind(this),"viii"),d=this._halfIntTexturesAvailable&&!has("mac"),u=this._textureFloatLinearAvailable;this._vxl.initialize_voxel_wasm(s,r,i,a,n,o,l,h,t.startTime,t.endTime,t.useTime,d,u),this._renderPluginContext&&this._renderPluginContext.requestRender()})).catch((()=>{for(const e of this._newLayers)e.rejectCallback(-2);this._dbg(I.Error," WASM failed to download, removing RenderPlugin and destroying"),this.destroy()}))),this._vxlPromise)}pickDepth(e,t,s){if(!this._vxl||!this._rctx||0===this._layers.size)return null;const r=s.viewport[3]-t;if(e<0||e>s.viewport[2]||t<0||t>s.viewport[3])return this._dbg(I.Error,`[js] pickDepth: outOfRange, screenXY=[${e.toFixed(0)}, ${r.toFixed(0)}]]`),null;this._beforeDraw();const i=s.viewForward,a=s.eye;this._vxl.update_camera_pos_and_direction(a[0],a[1],a[2],i[0],i[1],i[2]),this.updateWasmCamera(s),this._vxl.begin_frame();const n=this._vxl.pick_depth(e,r);if(this._afterDraw(),n.success){return n.distanceToCamera}return null}pickObject(e,t,s,r){if(!this._vxl||!this._rctx||0===this._layers.size)return null;const i=Math.round(e),a=Math.round(t);if(i<0||i>s.viewport[2]||a<0||a>s.viewport[3])return this._dbg(I.Error,`[js] pickObject: outOfRange, screenXY=[${i}, ${a}], vp=[${s.viewport.toString()}]`),null;this._beforeDraw();const n=s.viewForward,o=s.eye;this._vxl.update_camera_pos_and_direction(o[0],o[1],o[2],n[0],n[1],n[2]),this.updateWasmCamera(s),this._vxl.begin_frame();let l=null;if(0===r.length)l=this._vxl.pick_object(i,a,0,0);else{const e={str:JSON.stringify({layerIds:r}),byteCount:0,ptr:0,isReusable:!1};this._allocateBlock(e)&&(l=this._vxl.pick_object(i,a,e.ptr,e.byteCount),e.isReusable||this._vxl._free(e.ptr))}return this._afterDraw(),l}_beforeDraw(){this._renderTargetToRestore={fbo:this._rctx.getBoundFramebufferObject(),viewport:this._rctx.getViewport()},this._rctx.setPolygonOffsetFillEnabled(!1),this._rctx.setScissorTestEnabled(!1),this._rctx.setColorMask(!0,!0,!0,!0)}_afterDraw(){this._renderTargetToRestore.fbo=null,this._rctx.externalTextureUnitUpdate(this._vxl.get_texture_units_bound_in_frame(),this._vxl.get_active_texture_unit()),this._rctx.externalVertexArrayObjectUpdate(),this._rctx.externalVertexBufferUpdate(),this._rctx.externalProgramUpdate()}intersect(e,t,s,r,i){if(!this._vxl||!this._rctx||0===this._layers.size||!e.options.selectionMode||e.options.isFiltered)return;if(null==i||i[0]<0||i[0]>e.camera.viewport[2]||i[1]<0||i[1]>e.camera.viewport[3])return this._dbg(I.Error,`[js] VoxelWasmPerScene.intersect: outOfRange, screenXY=[${i[0].toFixed(0)}, ${i[1].toFixed(0)}]`),null;const a=[];this._layers.forEach((t=>{e.options.filteredLayerUids.includes(t.layerView.layer.uid)&&a.push(t.layerView.wasmLayerId)}));const n=this.pickObject(i[0],i[1],e.camera,a);if(null==n||-1===n.layerId)return;const o=this._layers.get(n.layerId);if(o){const t=o.layerView.layer.uid,i=n.distanceToCamera/h(s,r),a=d();a[0]=n.worldX,a[1]=n.worldY,a[2]=n.worldZ;const l={};if(null!=n.continuousValue&&null!=n.continuousValueUnits?l["Voxel.ServiceValue"]=`${n.continuousValue.toLocaleString()} ${n.continuousValueUnits}`:null!=n.uniqueValueLabel&&null!=n.uniqueValue?l["Voxel.ServiceValue"]=`${n.uniqueValueLabel} (${n.uniqueValue})`:null!=n.uniqueValue&&(l["Voxel.ServiceValue"]=`${n.uniqueValue}`),l["Voxel.ServiceVariableLabel"]=n.variableLabel,l["Voxel.Position"]=n.voxelSpacePosition,null!=n.epochTime&&null!=n.nativeTime&&null!=n.nativeTimeUnits){const e=new Date(n.epochTime);l["Voxel.ServiceLocalTime"]=e.toString(),l["Voxel.ServiceNativeTime"]=`${n.nativeTime.toLocaleString()} ${n.nativeTimeUnits}`}null!=n.depth&&null!=n.depthUnits&&(l["Voxel.ServiceDepth"]=`${n.depth.toLocaleString()} ${n.depthUnits}`);const u=n.faceNormal;l["Voxel.WorldPosition"]=`[${a[0]}, ${a[1]}, ${a[2]}]`;const _=e=>{const s=new v(a,t,(()=>this._createVoxelGraphic(o.layerView.layer,l)));e.set(this.type,s,i,u)},c=e.results,m=e.options.store===E.ALL;if((null==c.min.dist||i<c.min.dist)&&_(c.min),(null==c.max.dist||i>c.max.dist)&&_(c.max),m){const t=R(e.ray);_(t),e.results.all.push(t)}}}_createVoxelGraphic(e,s){return new t({layer:e,sourceLayer:e,attributes:s})}_toWasmQuality(e){switch(e){case"low":return 0;case"medium":return 1;case"high":return 2}}_setUpscalingLimits(e,t,s){this._vxl&&this._vxl.set_upscaling_limits(e,t,s)}};e([o({constructOnly:!0})],U.prototype,"view",void 0),U=e([l("esri.layers.VoxelWasmPerSceneView")],U);const k=U;export{k as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../Graphic.js";import s from"../request.js";import has from"../core/has.js";import r from"../core/Logger.js";import{isAbortError as i}from"../core/promiseUtils.js";import{watch as a,initial as n}from"../core/reactiveUtils.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import"../core/RandomLCG.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import{q as h}from"../chunks/vec32.js";import{create as d}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{renderSRFromViewSR as u}from"../geometry/support/coordinateSystem.js";import{PointIndex as _,PlaneIndex as c}from"../geometry/support/frustum.js";import{WasmCullMode as m,VoxelRequestType as g,UpdateFlags as p,ContainerType as f}from"../libs/vxl/enums.js";import{loadVoxelWASM as x}from"../libs/vxl/VxlModule.js";import{ViewingMode as y}from"../views/ViewingMode.js";import{VoxelTarget as v}from"../views/3d/layers/i3s/Intersector.js";import{Frustum as b}from"../views/3d/state/Frustum.js";import{RenderCoordsHelper as w}from"../views/3d/support/RenderCoordsHelper.js";import{SyncRenderPlugin as T}from"../views/3d/webgl-engine/effects/RenderPlugin.js";import{newIntersectorResult as R}from"../views/3d/webgl-engine/lib/Intersector.js";import{IntersectorType as L,StoreResults as E}from"../views/3d/webgl-engine/lib/IntersectorInterfaces.js";import{RenderFeature as V}from"../views/3d/webgl-engine/lib/RenderFeature.js";import{RenderSlot as C}from"../views/3d/webgl-engine/lib/RenderSlot.js";import{CompareFunction as F,Face as S,StencilOperation as P}from"../views/webgl/enums.js";var I;!function(e){e[e.Lifetime=1]="Lifetime",e[e.RequestResponse=2]="RequestResponse",e[e.Rendering=3]="Rendering",e[e.Error=4]="Error"}(I||(I={}));let U=class extends T{constructor(e){super(e),this._halfIntTexturesAvailable=!1,this._textureFloatLinearAvailable=!1,this._havePreparedWithAllLayers=!1,this._renderPluginContext=null,this._vxlPromise=null,this._vxl=null,this._pluginIsActive=!1,this._moreToLoad=!1,this._viewportWidth=-1,this._viewportHeight=-1,this._newLayers=[],this._layers=new Map,this._rctx=null,this._renderTargetToRestore=null,this._lastFrameWasStationary=!1,this._wasmMemBlockSizes=[512,1024,2048,4096,8192,16384,32768,65536],this._wasmMemBlocks=new Map,this._dbgFlags=new Set,this._captureFrustum=!1,this._frustum=null,this._frustumRenderableId=-1,this._renderCoordsHelper=null,this.produces=new Map([[C.VOXEL,()=>!!this._vxl&&"local"===this.view.viewingMode]]),this.type=L.VOXEL,this.slicePlaneEnabled=!0,this.isGround=!1,this.layerUid=[]}_dbg(e,t){this._dbgFlags.has(e)&&(e===I.Error?r.getLogger(this).error(t):r.getLogger(this).warn(t))}_removeRenderPlugin(){this._pluginIsActive&&this.view._stage&&(this._dbg(I.Lifetime,"--removeRenderPlugin--"),this.view._stage.removeRenderPlugin(this)),this._pluginIsActive=!1}initialize(){this._dbg(I.Lifetime,"--initialize--");for(const e of this._wasmMemBlockSizes)this._wasmMemBlocks.set(e,0);this.addHandles([a((()=>this.view.ready),(e=>{e&&"local"===this.view.viewingMode?(this._dbg(I.Lifetime,"view ready status changed to ready on a local view, calling addRenderPlugin"),this.view._stage.addRenderPlugin(this),this._pluginIsActive=!0):(this._dbg(I.Lifetime,"view ready status changed, not ready or not a local view!"),this._removeRenderPlugin())}),n),a((()=>this.view?.qualityProfile),(e=>{this._dbg(I.Rendering,"qualityProfile changed to "+e),this._vxl&&this._vxl.set_quality(this._toWasmQuality(e))}),n),a((()=>this.view?.timeExtent),(()=>{if(this._vxl){const e=this._getTimeArgs(this.view?.timeExtent);this._dbg(I.Rendering,"sceneView timeExtent changed to useTime="+e.useTime+" st="+e.startTime+" et="+e.endTime),this._vxl.set_scene_time_extent(e.startTime,e.endTime,e.useTime),this._renderPluginContext.requestRender()}}),n),a((()=>this.view?.stationary),(e=>{this._vxl&&e&&!this._lastFrameWasStationary&&this._renderPluginContext.requestRender()}))])}initializeRenderContext(e){this._dbg(I.Lifetime,"--initializeRenderContext--");const t=e.renderContext.rctx;this._renderPluginContext=e,this._rctx=e.renderContext.rctx,this._halfIntTexturesAvailable=!!this._rctx.capabilities.textureNorm16,this._textureFloatLinearAvailable=this._rctx.capabilities.textureFloatLinear,this._initializeWasm(t.gl)}uninitializeRenderContext(){this._renderPluginContext=null,this._rctx=null,this._dbg(I.Lifetime,"--uninitializeRenderContext--")}_restoreFramebuffer(){if(!this._renderTargetToRestore)return;const e=this._renderTargetToRestore.fbo;if(!!!this._rctx)return void this._dbg(I.Error,"no context in restoreFramebuffer!");this._rctx.bindFramebuffer(e,!0);const t=this._renderTargetToRestore.viewport;this._rctx.setViewport(t.x,t.y,t.width,t.height)}_bindPreviousDepthToSlot(e,t){const s=!!this._rctx,r=!!this._renderTargetToRestore;if(!s||!r)return 0;const i=this._renderTargetToRestore.fbo.depthStencilTexture;return i?(0===t?this._rctx.bindTexture(null,e,!0):this._rctx.bindTexture(i,e,!0),1):(this._dbg(I.Error,"no depth/stencil texture exists!"),0)}_modifyResourceCount(e,t,s){if(!this._rctx)return void this._dbg(I.Error,"modifyAllocation callback has no rendering context!");const r=e;1===s?this._rctx.instanceCounter.increment(r,t):this._rctx.instanceCounter.decrement(r,t)}_setBlendState(e,t,s,r){this._rctx?(this._rctx.setBlendingEnabled(1===e),this._rctx.setBlendFunction(t,s),this._rctx.setBlendEquation(r)):this._dbg(I.Error,"setBlendState callback has no rendering context!")}_setFrontFace(e){this._rctx?this._rctx.setFrontFace(e):this._dbg(I.Error,"setFrontFace callback has no rendering context!")}_setDepthStencilStateFunction(e,t,s){this._rctx?(this._rctx.setDepthFunction(s),this._rctx.setDepthTestEnabled(1===e),this._rctx.setDepthWriteEnabled(1===t),this._rctx.setStencilTestEnabled(!1),this._rctx.setStencilFunction(F.ALWAYS,0,255),this._rctx.setStencilOpSeparate(S.FRONT,P.KEEP,P.INCR,P.KEEP),this._rctx.setStencilOpSeparate(S.BACK,P.KEEP,P.DECR,P.KEEP)):this._dbg(I.Error,"setDepthStencilStateFunction callback has no rendering context!")}_setRasterizerState(e){if(this._rctx)switch(e){case m.None:this._rctx.setFaceCullingEnabled(!1);break;case m.Back:this._rctx.setCullFace(S.BACK),this._rctx.setFaceCullingEnabled(!0);break;case m.Front:this._rctx.setCullFace(S.FRONT),this._rctx.setFaceCullingEnabled(!0)}else this._dbg(I.Error,"setRasterizerState callback has no rendering context!")}_setViewport(e,t,s,r){this._rctx?this._rctx.setViewport(e,t,s,r):this._dbg(I.Error,"setViewport callback has no rendering context!")}_updateMemoryUsage(){this._layers.forEach(((e,t)=>{if(e.needMemoryUsageUpdate){const s=this._vxl.estimate_memory_usage(t);s>=0&&(e.needMemoryUsageUpdate=!1,e.layerView.setUsedMemory(s))}}))}_syncRequestsResponses(){this._layers.forEach(((e,t)=>{const r=[];e.responses.forEach(((s,i)=>{r.push(i),this._dbg(I.RequestResponse,"responding for requestID:"+i+" size:"+s.size),this._vxl.respond(t,i,s),s.requestType!==g.TreeIndex&&s.requestType!==g.Section||(e.needMemoryUsageUpdate=!0)}));const a=e.responses;for(const s of r)a.delete(s);const n=this._vxl.get_new_requests(t),o=e.abortController.signal;for(const l in n){e.outstandingRequestCount+=1,1===e.outstandingRequestCount&&e.layerView.updatingFlagChanged();const t=n[l],r={responseType:"array-buffer",signal:o,query:{...e.layerView.layer.customParameters,token:e.layerView.layer.apiKey}};this._dbg(I.RequestResponse,"making requestID:"+l+" url:"+t.url),s(t.url,r).then((s=>{e.outstandingRequestCount-=1,0===e.outstandingRequestCount&&e.layerView.updatingFlagChanged(),this._dbg(I.RequestResponse,"have response for requestID:"+l);let r=0;if(s.data.byteLength>0){r=this._vxl._malloc(s.data.byteLength);const e=new Uint8Array(this._vxl.HEAPU8.buffer,r,s.data.byteLength),t=new Uint8Array(s.data);for(let r=0;r<s.data.byteLength;++r)e[r]=t[r]}a.set(+l,{responseType:t.responseType,ptr:r,size:s.data.byteLength,success:!0,requestType:t.requestType})})).catch((s=>{e.outstandingRequestCount-=1,0===e.outstandingRequestCount&&e.layerView.updatingFlagChanged(),i(s)||(this._dbg(I.Error,`requestID:${l} failed, error=${s.toString()}`),a.set(+l,{responseType:t.responseType,ptr:0,size:0,success:!1,requestType:t.requestType}))}))}}))}updateWasmCamera(e){this._vxl.set_projection_matrix.apply(this._vxl,e.projectionMatrix),this._vxl.set_view_matrix.apply(this._vxl,e.viewMatrix),this._vxl.set_near_far(e.near,e.far)}isUpdating(e){if(!this._vxl&&this._vxlPromise)return!0;const t=this._layers.get(e);return!!t&&t.outstandingRequestCount>0}getLayerTimes(e){const t=[];return this._layers.forEach(((s,r)=>{if(s.layerView.wasmLayerId===e.wasmLayerId){const s=this._vxl.get_layer_epoch_times(r,e.layer.currentVariableId);for(let e=0;e<s.length;++e)t.push(s[e])}})),t}getCurrentLayerTimeIndex(e){let t=0;return this._layers.forEach(((s,r)=>{s.layerView.wasmLayerId===e.wasmLayerId&&(t=this._vxl.get_layer_current_time_id(r))})),t}setEnabled(e,t){this._layers.forEach(((s,r)=>{s.layerView.wasmLayerId===e.wasmLayerId&&(this._vxl.set_enabled(r,t),s.needMemoryUsageUpdate=!0,this._renderPluginContext.requestRender())}))}setIsInScaleRange(e,t){const s=this._layers.get(e.wasmLayerId);s&&t!==s.isInScaleRange&&(s.isInScaleRange=t,this._vxl.set_is_in_scale_range(e.wasmLayerId,t),s.needMemoryUsageUpdate=!t,this._renderPluginContext.requestRender())}setStaticSections(e,t){const s={mask:p.StaticSections,staticSections:t};return this._doMaskedUIUpdate(e,s,!0)}setCurrentVariable(e,t){const s={mask:p.CurrentVariable,currentVariable:t};return this._doMaskedUIUpdate(e,s,!0)}setRenderMode(e,t){const s={mask:p.RenderMode,renderMode:t};return this._doMaskedUIUpdate(e,s,!0)}setVerticalExaggerationAndOffset(e,t,s,r){const i={mask:p.ExaggerationAndOffset,volStyleDesc:{volumeId:t,verticalExaggeration:s,verticalOffset:r}};return this._doMaskedUIUpdate(e,i,!0)}setVariableStyles(e,t){const s={mask:p.VariableStyles,variableStyles:t};return this._doMaskedUIUpdate(e,s,!0)}setVolumeStyles(e,t){const s={mask:p.VolumeStyles,volumeStyles:t};return this._doMaskedUIUpdate(e,s,!0)}setEnableDynamicSections(e,t){const s={mask:p.ContainerVisibility,containerIsVisible:t,container:f.DynamicSections};return this._doMaskedUIUpdate(e,s,!0)}setEnableIsosurfaces(e,t){const s={mask:p.ContainerVisibility,containerIsVisible:t,container:f.Isosurfaces};return this._doMaskedUIUpdate(e,s,!0)}setEnableSections(e,t){const s={mask:p.ContainerVisibility,containerIsVisible:t,container:f.StaticSections};return this._doMaskedUIUpdate(e,s,!0)}setAnalysisSlice(e,t,s,r){const i={mask:p.AnalysisSlice,analysisSlice:{point:s,normal:r,enabled:t}};return this._doMaskedUIUpdate(e,i,!0)}_doMaskedUIUpdate(e,t,s){if(!this._vxl)return!1;let r=!1;return this._layers.forEach(((s,i)=>{if(s.layerView.wasmLayerId===e.wasmLayerId){const e={str:JSON.stringify(t),byteCount:0,ptr:0,isReusable:!1};this._allocateBlock(e)&&(r=1===this._vxl.handle_masked_ui_update(i,e.ptr,e.byteCount),e.isReusable||this._vxl._free(e.ptr))}})),r&&s&&this._renderPluginContext.requestRender(),r}_addTriangleToWasmBuffer(e,t,s,r,i){return e[3*t]=s[0],e[3*t+1]=s[1],e[3*t+2]=s[2],e[3*(t+=1)]=r[0],e[3*t+1]=r[1],e[3*t+2]=r[2],e[3*(t+=1)]=i[0],e[3*t+1]=i[1],e[3*t+2]=i[2],t+=1}_addNormalToWasmBuffer(e,t,s){return e[3*t]=s[0],e[3*t+1]=s[1],e[3*t+2]=s[2],t+=1}_doCaptureFrustum(){if(!this._vxl)return;const e=36,t=e/3,s=this._vxl._malloc(3*e*Float32Array.BYTES_PER_ELEMENT),r=new Float32Array(this._vxl.HEAPF32.buffer,s,3*e),i=this._vxl._malloc(3*t*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(this._vxl.HEAPF32.buffer,i,e),n=this._frustum.points[_.NEAR_BOTTOM_LEFT],o=this._frustum.points[_.NEAR_BOTTOM_RIGHT],l=this._frustum.points[_.NEAR_TOP_RIGHT],h=this._frustum.points[_.NEAR_TOP_LEFT],d=this._frustum.points[_.FAR_BOTTOM_LEFT],u=this._frustum.points[_.FAR_BOTTOM_RIGHT],m=this._frustum.points[_.FAR_TOP_RIGHT],g=this._frustum.points[_.FAR_TOP_LEFT];let p=0,f=0;const x=this._frustum.planes[c.NEAR];p=this._addTriangleToWasmBuffer(r,p,l,o,n),f=this._addNormalToWasmBuffer(a,f,x),p=this._addTriangleToWasmBuffer(r,p,n,h,l),f=this._addNormalToWasmBuffer(a,f,x);const y=this._frustum.planes[c.FAR];p=this._addTriangleToWasmBuffer(r,p,d,u,m),f=this._addNormalToWasmBuffer(a,f,y),p=this._addTriangleToWasmBuffer(r,p,m,g,d),f=this._addNormalToWasmBuffer(a,f,y);const v=this._frustum.planes[c.TOP];p=this._addTriangleToWasmBuffer(r,p,m,l,h),f=this._addNormalToWasmBuffer(a,f,v),p=this._addTriangleToWasmBuffer(r,p,h,g,m),f=this._addNormalToWasmBuffer(a,f,v);const b=this._frustum.planes[c.BOTTOM];p=this._addTriangleToWasmBuffer(r,p,n,o,u),f=this._addNormalToWasmBuffer(a,f,b),p=this._addTriangleToWasmBuffer(r,p,u,d,n),f=this._addNormalToWasmBuffer(a,f,b);const w=this._frustum.planes[c.LEFT];p=this._addTriangleToWasmBuffer(r,p,h,n,d),f=this._addNormalToWasmBuffer(a,f,w),p=this._addTriangleToWasmBuffer(r,p,d,g,h),f=this._addNormalToWasmBuffer(a,f,w);const T=this._frustum.planes[c.RIGHT];p=this._addTriangleToWasmBuffer(r,p,l,m,u),f=this._addNormalToWasmBuffer(a,f,T),p=this._addTriangleToWasmBuffer(r,p,u,o,l),f=this._addNormalToWasmBuffer(a,f,T),-1!==this._frustumRenderableId&&this._vxl.remove_generic_mesh(this._frustumRenderableId),this._frustumRenderableId=this._vxl.add_generic_mesh(s,3*e,i,e,255,0,0,64),this._vxl._free(s),this._vxl._free(i),this._captureFrustum=!1,this._renderPluginContext.requestRender()}captureFrustum(){null===this._renderCoordsHelper&&(this._renderCoordsHelper=w.create(y.Local,u(!1,this.view.spatialReference))),null===this._frustum&&(this._frustum=new b(this._renderCoordsHelper)),this._captureFrustum=!0,null!==this._renderPluginContext&&this._renderPluginContext.requestRender()}toggleFullVolumeExtentDraw(e){this._vxl&&this._layers.forEach(((t,s)=>{t.layerView.wasmLayerId===e.wasmLayerId&&(this._vxl.toggle_full_volume_extent_draw(s),this._renderPluginContext.requestRender())}))}addVoxelLayer(e){if(!this._vxl){const t={layerView:e,resolveCallback:null,rejectCallback:null},s=new Promise(((e,s)=>{t.resolveCallback=e,t.rejectCallback=s}));return this._newLayers.push(t),s}const t=this._addVoxelLayer(e);return t<0?Promise.reject(-1):Promise.resolve(t)}removeVoxelLayer(e){if(!this._vxl){const t=this._newLayers.findIndex((t=>e.uid===t.layerView.uid));t>=0&&(this._newLayers[t].resolveCallback(-1),this._newLayers.splice(t,1));const s=this._newLayers.length;return 0===s&&(this._dbg(I.Lifetime," no voxel layers left after removing a layer, removing RenderPlugin and destroying"),this.destroy()),s}let t=-1;this._layers.forEach(((s,r)=>{if(s.layerView.wasmLayerId===e.wasmLayerId){t=r,s.abortController.abort(),this._vxl.remove_layer(t);const i=this.layerUid.indexOf(e.layer.uid);-1!==i&&this.layerUid.splice(i,1)}})),t>=0&&this._layers.delete(t);const s=this._layers.size;return 0===s&&(this._dbg(I.Lifetime," no voxel layers left after removing a layer, removing RenderPlugin and destroying"),this.destroy()),s}_getBlockSize(e){for(const t of this._wasmMemBlockSizes)if(e<t)return t;return-1}_allocateBlock(e){e.byteCount=this._vxl.lengthBytesUTF8(e.str)+1;const t=this._getBlockSize(e.byteCount);return t<0?(e.isReusable=!1,e.ptr=this._vxl._malloc(e.byteCount)):(e.isReusable=!0,e.ptr=this._wasmMemBlocks.get(t),0===e.ptr&&(e.ptr=this._vxl._malloc(t),this._wasmMemBlocks.set(t,e.ptr))),0!==e.ptr&&(this._vxl.stringToUTF8(e.str,e.ptr,e.byteCount),!0)}_getTimeArgs(e){let t=-Number.MAX_VALUE,s=Number.MAX_VALUE,r=!1;return null!=e&&(e.isAllTime?r=!0:(null!=e.start&&(r=!0,t=e.start.getTime()/1e3),null!=e.end&&(r=!0,s=e.end.getTime()/1e3))),{startTime:t,endTime:s,useTime:r}}_addVoxelLayer(e){const t=e.layer;let s=-1;const i=t.getConfiguration();if(i.length<1)return-1;const a={str:i,byteCount:0,ptr:0,isReusable:!1};if(!this._allocateBlock(a))return-1;const n=this._getTimeArgs(this.view?.timeExtent),o=this.view.spatialReference.isWGS84&&t.spatialReference.isWGS84?111319.49079327357:1;if(s=this._vxl.add_layer(t.serviceRoot,a.ptr,a.byteCount,o,o,n.startTime,n.endTime,n.useTime,this._toWasmQuality(this.view.qualityProfile)),a.isReusable||this._vxl._free(a.ptr),s>=0){t.test?.constantUpscaling&&(this._setUpscalingLimits(0,.25,.25),this._setUpscalingLimits(1,.5,.5),this._setUpscalingLimits(2,.75,.75));const i=new AbortController;if(this._layers.set(s,{layerView:e,responses:new Map,outstandingRequestCount:0,abortController:i,needMemoryUsageUpdate:!1,isInScaleRange:!0}),this.layerUid.push(e.layer.uid),!this._halfIntTexturesAvailable||has("mac")){const t=[];let s="";for(const r of e.layer.variables)"Int16"!==r.renderingFormat.type&&"UInt16"!==r.renderingFormat.type||(t.push(r.name),r.id===e.layer.currentVariableId&&(s=r.name));""!==s&&r.getLogger(this).error("#addVoxelLayer_error()",e.layer,`The voxel layer '${e.layer.title}' cannot render the current variable '${s}' in this browser`),t.length>0&&r.getLogger(this).warn("#addVoxelLayer_warning()",e.layer,`The voxel layer '${e.layer.title}' cannot render the variables '${t.toString()}' in this browser`)}if(!this._textureFloatLinearAvailable){const t=[];let s="";for(const r of e.layer.variables)"Float32"===r.renderingFormat.type&&(t.push(r.name),r.id===e.layer.currentVariableId&&(s=r.name));""!==s&&r.getLogger(this).error("#addVoxelLayer_error()",e.layer,`The voxel layer '${e.layer.title}' cannot render the current variable '${s}' in this browser`),t.length>0&&r.getLogger(this).warn("#addVoxelLayer_warning()",e.layer,`The voxel layer '${e.layer.title}' cannot render the variables '${t.toString()}' in this browser`)}return has("esri-mobile")&&r.getLogger(this).warnOnce("Mobile support differs across devices. Voxel layer might not display as expected."),s}return-1}prepareRender(e){if(!this._vxl)return;const t=e.bindParameters.camera.viewForward,s=e.bindParameters.camera.eye;this._vxl.update_camera_pos_and_direction(s[0],s[1],s[2],t[0],t[1],t[2]);const r=this._vxl.cull();this._dbg(I.RequestResponse,"missingResourceCount="+r),this._moreToLoad=r>0,this._havePreparedWithAllLayers=0===this._newLayers.length,this._updateMemoryUsage()}renderNode(e){if(!this._vxl)return;for(const s of this._newLayers){const e=this._addVoxelLayer(s.layerView);-1===e?s.rejectCallback(-1):s.resolveCallback(e)}if(this._newLayers=[],0===this._layers.size)return void this._dbg(I.Error,"No voxel layers but RenderPlugin instance is being asked to render!");this._lastFrameWasStationary=this.view.stationary,this._syncRequestsResponses(),this._beforeDraw(),this._vxl.begin_color_frame(!this.view._stage.renderer.isFeatureEnabled(V.HighResolutionVoxel),e.bindParameters.lighting.mainLight.direction[0],e.bindParameters.lighting.mainLight.direction[1],e.bindParameters.lighting.mainLight.direction[2]);const t=this._renderTargetToRestore.viewport;t.width===this._viewportWidth&&t.height===this._viewportHeight||(this._viewportWidth=t.width,this._viewportHeight=t.height,this._vxl.set_viewport(t.width,t.height),this._layers.forEach((e=>{e.needMemoryUsageUpdate=!0}))),0===t.x&&0===t.y||this._dbg(I.Error,"Unsupported viewport parameters detected!"),this.updateWasmCamera(e.bindParameters.camera),this._captureFrustum&&(this._frustum.update(e.bindParameters.camera),this._doCaptureFrustum()),this._vxl.draw(),this._afterDraw(),(this._moreToLoad||!this._havePreparedWithAllLayers&&this._layers.size>0)&&this._renderPluginContext.requestRender()}destroy(){this._dbg(I.Lifetime,"--destroy--"),this._removeRenderPlugin(),this._vxl&&(this._layers.forEach((e=>{e.abortController.abort()})),this._wasmMemBlocks.forEach((e=>{0!==e&&this._vxl._free(e)})),this._vxl.uninitialize_voxel_wasm(),this._vxl=null)}_initializeWasm(e){return this._vxl?Promise.resolve():(this._vxlPromise||(this._vxlPromise=x(e).then((e=>{if(this._vxl=e,this._vxlPromise=null,this._newLayers.length<=0)return this._dbg(I.Lifetime," no voxel layers left after WASM downloaded, removing RenderPlugin and destroying"),void this.destroy();const t=this._getTimeArgs(this.view?.timeExtent),s=this._vxl.addFunction(this._restoreFramebuffer.bind(this),"v"),r=this._vxl.addFunction(this._setBlendState.bind(this),"viiii"),i=this._vxl.addFunction(this._setFrontFace.bind(this),"vi"),a=this._vxl.addFunction(this._setRasterizerState.bind(this),"vi"),n=this._vxl.addFunction(this._setDepthStencilStateFunction.bind(this),"viii"),o=this._vxl.addFunction(this._setViewport.bind(this),"viiii"),l=this._vxl.addFunction(this._bindPreviousDepthToSlot.bind(this),"iii"),h=this._vxl.addFunction(this._modifyResourceCount.bind(this),"viii"),d=this._halfIntTexturesAvailable&&!has("mac"),u=this._textureFloatLinearAvailable;this._vxl.initialize_voxel_wasm(s,r,i,a,n,o,l,h,t.startTime,t.endTime,t.useTime,d,u),this._renderPluginContext&&this._renderPluginContext.requestRender()})).catch((()=>{for(const e of this._newLayers)e.rejectCallback(-2);this._dbg(I.Error," WASM failed to download, removing RenderPlugin and destroying"),this.destroy()}))),this._vxlPromise)}pickDepth(e,t,s){if(!this._vxl||!this._rctx||0===this._layers.size)return null;const r=s.viewport[3]-t;if(e<0||e>s.viewport[2]||t<0||t>s.viewport[3])return this._dbg(I.Error,`[js] pickDepth: outOfRange, screenXY=[${e.toFixed(0)}, ${r.toFixed(0)}]]`),null;this._beforeDraw();const i=s.viewForward,a=s.eye;this._vxl.update_camera_pos_and_direction(a[0],a[1],a[2],i[0],i[1],i[2]),this.updateWasmCamera(s),this._vxl.begin_frame();const n=this._vxl.pick_depth(e,r);if(this._afterDraw(),n.success){return n.distanceToCamera}return null}pickObject(e,t,s,r){if(!this._vxl||!this._rctx||0===this._layers.size)return null;const i=Math.round(e),a=Math.round(t);if(i<0||i>s.viewport[2]||a<0||a>s.viewport[3])return this._dbg(I.Error,`[js] pickObject: outOfRange, screenXY=[${i}, ${a}], vp=[${s.viewport.toString()}]`),null;this._beforeDraw();const n=s.viewForward,o=s.eye;this._vxl.update_camera_pos_and_direction(o[0],o[1],o[2],n[0],n[1],n[2]),this.updateWasmCamera(s),this._vxl.begin_frame();let l=null;if(0===r.length)l=this._vxl.pick_object(i,a,0,0);else{const e={str:JSON.stringify({layerIds:r}),byteCount:0,ptr:0,isReusable:!1};this._allocateBlock(e)&&(l=this._vxl.pick_object(i,a,e.ptr,e.byteCount),e.isReusable||this._vxl._free(e.ptr))}return this._afterDraw(),l}_beforeDraw(){this._renderTargetToRestore={fbo:this._rctx.getBoundFramebufferObject(),viewport:this._rctx.getViewport()},this._rctx.setPolygonOffsetFillEnabled(!1),this._rctx.setScissorTestEnabled(!1),this._rctx.setColorMask(!0,!0,!0,!0)}_afterDraw(){this._renderTargetToRestore.fbo=null,this._rctx.externalTextureUnitUpdate(this._vxl.get_texture_units_bound_in_frame(),this._vxl.get_active_texture_unit()),this._rctx.externalVertexArrayObjectUpdate(),this._rctx.externalVertexBufferUpdate(),this._rctx.externalProgramUpdate()}intersect(e,t,s,r,i){if(!this._vxl||!this._rctx||0===this._layers.size||!e.options.selectionMode||e.options.isFiltered)return;if(null==i||i[0]<0||i[0]>e.camera.viewport[2]||i[1]<0||i[1]>e.camera.viewport[3])return this._dbg(I.Error,`[js] VoxelWasmPerScene.intersect: outOfRange, screenXY=[${i[0].toFixed(0)}, ${i[1].toFixed(0)}]`),null;const a=[];this._layers.forEach((t=>{e.options.filteredLayerUids.includes(t.layerView.layer.uid)&&a.push(t.layerView.wasmLayerId)}));const n=this.pickObject(i[0],i[1],e.camera,a);if(null==n||-1===n.layerId)return;const o=this._layers.get(n.layerId);if(o){const t=o.layerView.layer.uid,i=n.distanceToCamera/h(s,r),a=d();a[0]=n.worldX,a[1]=n.worldY,a[2]=n.worldZ;const l={};if(null!=n.continuousValue&&null!=n.continuousValueUnits?l["Voxel.ServiceValue"]=`${n.continuousValue.toLocaleString()} ${n.continuousValueUnits}`:null!=n.uniqueValueLabel&&null!=n.uniqueValue?l["Voxel.ServiceValue"]=`${n.uniqueValueLabel} (${n.uniqueValue})`:null!=n.uniqueValue&&(l["Voxel.ServiceValue"]=`${n.uniqueValue}`),l["Voxel.ServiceVariableLabel"]=n.variableLabel,l["Voxel.Position"]=n.voxelSpacePosition,null!=n.epochTime&&null!=n.nativeTime&&null!=n.nativeTimeUnits){const e=new Date(n.epochTime);l["Voxel.ServiceLocalTime"]=e.toString(),l["Voxel.ServiceNativeTime"]=`${n.nativeTime.toLocaleString()} ${n.nativeTimeUnits}`}null!=n.depth&&null!=n.depthUnits&&(l["Voxel.ServiceDepth"]=`${n.depth.toLocaleString()} ${n.depthUnits}`);const u=n.faceNormal;l["Voxel.WorldPosition"]=`[${a[0]}, ${a[1]}, ${a[2]}]`;const _=e=>{const s=new v(a,t,(()=>this._createVoxelGraphic(o.layerView.layer,l)));e.set(this.type,s,i,u)},c=e.results,m=e.options.store===E.ALL;if((null==c.min.dist||i<c.min.dist)&&_(c.min),(null==c.max.dist||i>c.max.dist)&&_(c.max),m){const t=R(e.ray);_(t),e.results.all.push(t)}}}_createVoxelGraphic(e,s){return new t({layer:e,sourceLayer:e,attributes:s})}_toWasmQuality(e){switch(e){case"low":return 0;case"medium":return 1;case"high":return 2}}_setUpscalingLimits(e,t,s){this._vxl&&this._vxl.set_upscaling_limits(e,t,s)}};e([o({constructOnly:!0})],U.prototype,"view",void 0),U=e([l("esri.layers.VoxelWasmPerSceneView")],U);const k=U;export{k as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../../../core/CircularArray.js";import{clamp as e}from"../../../core/mathUtils.js";const s="__esri_stream_id__",i="__esri_timestamp__",r=1e3;class o{constructor(t,e,i,r,o=128){this._trackIdToObservations=new Map,this._idCounter=0,this._lastPurge=performance.now(),this._addOrUpdated=new Map,this._removed=[],this._maxAge=0,this._timeInfo=i,this._purgeOptions=r,this.store=t,this.objectIdField=e,this.purgeInterval=o,this._useGeneratedIds=this.objectIdField===s}removeById(t){this._removed.push(t)}removeByTrackId(t){const e=this._trackIdToObservations.get(t);if(e)for(const s of e.entries)this._removed.push(s)}add(s){if(this._useGeneratedIds){const t=this._nextId();s.attributes[this.objectIdField]=t,s.objectId=t}else s.objectId=s.attributes[this.objectIdField];const i=s.objectId;if(this._addOrUpdated.set(i,s),this._maxAge=Math.max(this._maxAge,s.attributes[this._timeInfo.startTimeField]),!this._timeInfo.trackIdField)return null==this._trackIdLessObservations&&(this._trackIdLessObservations=new t(1e5)),void this._trackIdLessObservations.enqueue(i);const o=s.attributes[this._timeInfo.trackIdField];if(!this._trackIdToObservations.has(o)){const s=null!=this._purgeOptions?.maxObservations?this._purgeOptions.maxObservations:r,i=e(s,0,r);this._trackIdToObservations.set(o,new t(i))}const d=this._trackIdToObservations.get(o),a=d?.enqueue(i);null!=a&&(this._addOrUpdated.has(a)?this._addOrUpdated.delete(a):this._removed.push(a))}checkForUpdates(){const t=this._getToAdd(),e=this._getToRemove(),s=performance.now();s-this._lastPurge>=this.purgeInterval&&(this._purge(s),this._lastPurge=s);const r=[];if(null!=e)for(const i of e){const t=this.store.removeById(i);null!=t&&r.push(t)}const o=[];if(null!=t){const r=new Set(e??[]);for(const e of t)r.has(e.objectId)||(e.attributes[i]=s,this.store.add(e),o.push(e))}(o.length
|
|
5
|
+
import t from"../../../core/CircularArray.js";import{clamp as e}from"../../../core/mathUtils.js";const s="__esri_stream_id__",i="__esri_timestamp__",r=1e3;class o{constructor(t,e,i,r,o=128){this._trackIdToObservations=new Map,this._idCounter=0,this._lastPurge=performance.now(),this._addOrUpdated=new Map,this._removed=[],this._maxAge=0,this._timeInfo=i,this._purgeOptions=r,this.store=t,this.objectIdField=e,this.purgeInterval=o,this._useGeneratedIds=this.objectIdField===s}removeById(t){this._removed.push(t)}removeByTrackId(t){const e=this._trackIdToObservations.get(t);if(e)for(const s of e.entries)this._removed.push(s)}add(s){if(this._useGeneratedIds){const t=this._nextId();s.attributes[this.objectIdField]=t,s.objectId=t}else s.objectId=s.attributes[this.objectIdField];const i=s.objectId;if(this._addOrUpdated.set(i,s),this._maxAge=Math.max(this._maxAge,s.attributes[this._timeInfo.startTimeField]),!this._timeInfo.trackIdField)return null==this._trackIdLessObservations&&(this._trackIdLessObservations=new t(1e5)),void this._trackIdLessObservations.enqueue(i);const o=s.attributes[this._timeInfo.trackIdField];if(!this._trackIdToObservations.has(o)){const s=null!=this._purgeOptions?.maxObservations?this._purgeOptions.maxObservations:r,i=e(s,0,r);this._trackIdToObservations.set(o,new t(i))}const d=this._trackIdToObservations.get(o),a=d?.enqueue(i);null!=a&&(this._addOrUpdated.has(a)?this._addOrUpdated.delete(a):this._removed.push(a))}checkForUpdates(){const t=this._getToAdd(),e=this._getToRemove(),s=performance.now();s-this._lastPurge>=this.purgeInterval&&(this._purge(s),this._lastPurge=s);const r=[];if(null!=e)for(const i of e){const t=this.store.removeById(i);null!=t&&r.push(t)}const o=[];if(null!=t){const r=new Set(e??[]);for(const e of t)r.has(e.objectId)||(e.attributes[i]=s,this.store.add(e),o.push(e))}return!(!o.length&&!r?.length)&&(this.store.update(o,r),!0)}_getToAdd(){if(!this._addOrUpdated.size)return null;const t=new Array(this._addOrUpdated.size);let e=0;return this._addOrUpdated.forEach((s=>t[e++]=s)),this._addOrUpdated.clear(),t}_getToRemove(){const t=this._removed;return this._removed.length?(this._removed=[],t):null}_nextId(){const t=this._idCounter;return this._idCounter=(this._idCounter+1)%4294967294+1,t}_purge(t){const e=this._purgeOptions;null!=e&&(this._purgeSomeByDisplayCount(e),this._purgeByAge(e),this._purgeByAgeReceived(t,e),this._purgeTracks())}_purgeSomeByDisplayCount(t){if(!t.displayCount)return;let e=this.store.size;if(e>t.displayCount){if(this._timeInfo.trackIdField)for(const s of this._trackIdToObservations.values())if(e>t.displayCount&&s.size){const t=s.dequeue();this._removed.push(t),e--}if(null!=this._trackIdLessObservations){let s=e-t.displayCount;for(;s-- >0;){const t=this._trackIdLessObservations.dequeue();null!=t&&this._removed.push(t)}}}}_purgeByAge(t){const e=this._timeInfo?.startTimeField;if(!t.age||!e)return;const s=60*t.age*1e3,i=this._maxAge-s;this.store.forEach((t=>{t.attributes[e]<i&&this._removed.push(t.objectId)}))}_purgeByAgeReceived(t,e){if(!e.ageReceived)return;const s=t-60*e.ageReceived*1e3;this.store.forEach((t=>{t.attributes[i]<s&&this._removed.push(t.objectId)}))}_purgeTracks(){this._trackIdToObservations.forEach(((t,e)=>{0===t.size&&this._trackIdToObservations.delete(e)}))}}export{o as StreamFeatureManager,s as defaultStreamIdField,i as esriTimestamp};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../core/Accessor.js";import i from"../../core/Error.js";import n from"../../core/Logger.js";import{getOrCreateMapValue as o}from"../../core/MapUtils.js";import{parseWhereClause as s}from"../../core/sql.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import{encodeGeohash as p}from"../../geohash/geohashUtils.js";import d from"../../geometry/Polygon.js";import{initializeProjection as m,project as l}from"../../geometry/projection.js";import{wgs84 as h}from"../../geometry/support/spatialReferenceUtils.js";import c from"./SessionMemoryStorage.js";import{extentToInBoundsRings as y}from"./supportUtils.js";import{executeQueryStreaming as u}from"../../rest/knowledgeGraphService.js";import f from"../../rest/knowledgeGraph/GraphQueryStreaming.js";import g from"../../rest/support/Query.js";import b from"../../geometry/Extent.js";const w="ESRI__ID",T="ESRI__ORIGIN_ID",D="ESRI__DESTINATION_ID",M="ESRI__LAYOUT_GEOMETRY",I=12;let k=class extends t{constructor(e){super(e),this._processingCacheUpdatesLookup=new Map,this.knowledgeGraph=null,this.inclusionModeDefinition={generateAllSublayers:!0,namedTypeDefinitions:new Map},this.entityTypeNames=new Set,this.relationshipTypeNames=new Set,this.geographicLookup=new Map,this.sublayerCaches=new Map,this.nodeConnectionsLookup=new Map,this.relationshipConnectionsLookup=new Map,this.memberIdTypeLookup=new Map;const t=new Map;e.knowledgeGraph.dataModel.entityTypes?.forEach((i=>{i.name&&(t.set(i.name,"entity"),this._processingCacheUpdatesLookup.set(i.name,[]),e.inclusionModeDefinition&&!e.inclusionModeDefinition?.generateAllSublayers||this.entityTypeNames.add(i.name),i.properties?.forEach((e=>{e.geometryType&&"esriGeometryNull"!==e.geometryType&&this.geographicLookup.set(i.name,{name:e.name??"",geometryType:e.geometryType})})))})),e.knowledgeGraph.dataModel.relationshipTypes?.forEach((i=>{i.name&&(t.set(i.name,"relationship"),this._processingCacheUpdatesLookup.set(i.name,[]),e.inclusionModeDefinition&&!e.inclusionModeDefinition?.generateAllSublayers||this.relationshipTypeNames.add(i.name),i.properties?.forEach((e=>{e.geometryType&&"esriGeometryNull"!==e.geometryType&&this.geographicLookup.set(i.name,{name:e.name??"",geometryType:e.geometryType})})))})),e.inclusionModeDefinition?.namedTypeDefinitions.forEach(((i,s)=>{if("entity"===t.get(s))this.entityTypeNames.add(s);else{if("relationship"!==t.get(s))return n.getLogger(this).warn(`A named type, ${s}, was in the inclusion list that wasn't in the data model and will be removed`),void e.inclusionModeDefinition?.namedTypeDefinitions.delete(s);this.relationshipTypeNames.add(s)}const a=new Map;i.members?.forEach((e=>{o(this.memberIdTypeLookup,e.id,(()=>new Set)).add(s);const t=this.getById(e.id);t&&a.set(e.id,t)})),this.sublayerCaches.set(s,a)}))}addToLayer(e){e.forEach((({typeName:e,id:t})=>{if(!this.inclusionModeDefinition)throw new i("knowledge-graph:layer-data-manager","You cannot add to a layer's exclusion list if it was not created with an exclusion list originally");if(this.inclusionModeDefinition.namedTypeDefinitions.has(e)){if(this.inclusionModeDefinition.namedTypeDefinitions.has(e)){const i=this.inclusionModeDefinition.namedTypeDefinitions.get(e);i.members||(i.members=new Map),i.members.set(t,{id:t}),o(this.memberIdTypeLookup,t,(()=>new Set)).add(e)}}else{const i=new Map;i.set(t,{id:t}),this.inclusionModeDefinition.namedTypeDefinitions.set(e,{useAllData:!1,members:i}),o(this.memberIdTypeLookup,t,(()=>new Set)).add(e)}}))}getById(e){return c.getInstance().readFromStoreById(e)}async getData(e,t,i){if(t.objectType.name&&this.inclusionModeDefinition?.namedTypeDefinitions&&this.inclusionModeDefinition.namedTypeDefinitions.size>0&&!this.inclusionModeDefinition.namedTypeDefinitions.has(t.objectType.name))return[];let n;if(n=e||new g({where:"1=1",outFields:["*"]}),"link-chart"===t.parentCompositeLayer.type){const e=t.parentCompositeLayer,i=this._processingCacheUpdatesLookup.get(t.objectType.name??""),o=n.outFields,s=n.geometry;let a="",r="";s&&s.extent&&(a=p(s.extent.ymin,s.extent.xmin,I),r=p(s.extent.ymax,s.extent.xmax,I)),o&&1===o.length&&o[0]===w&&"1=1"===n.where||await Promise.all(i??[]);const d=this.sublayerCaches.has(t.objectType.name??"")?Array.from(this.sublayerCaches.get(t.objectType.name)?.values()):[],m=[];return d.forEach((i=>{if(this.relationshipTypeNames.has(t.objectType.name)?i.geometry=e.relationshipLinkChartDiagramLookup.get(i.attributes[t.objectIdField]):i.geometry=e.entityLinkChartDiagramLookup.get(i.attributes[t.objectIdField]),i.attributes[M]=i.geometry,a&&r){const n=e.linkChartGeohashLookup.get(i.attributes[t.objectIdField]);n?n>=a&&n<=r&&m.push(i):m.push(i)}else m.push(i)})),m}return this.retrieveDataFromService(n,t,i)}async getConnectedRecordIds(e,t){const i=[];let o="";const s=[],a=new Map;if(e.forEach((e=>{if(this.memberIdTypeLookup.has(e))for(const t of this.memberIdTypeLookup.get(e)){if(!this.entityTypeNames.has(t))return;a.has(t)?a.get(t)?.push(e):a.set(t,[e])}})),t&&0!==t?.length){for(const e of t)o=o+e+"|";o=o.slice(0,-1)}return a.forEach(((e,a)=>{let r;r=t&&0!==t?.length?`MATCH (n:${a})-[r:${o}]-(m) WHERE id(n) IN $ids RETURN id(r), type(r), id(m), labels(m)[0]`:`MATCH (n:${a})-[r]-(m) WHERE id(n) IN $ids RETURN id(r), type(r), id(m), labels(m)[0]`;const p=new Promise((t=>{(async()=>{const t=(await u(this.knowledgeGraph,new f({openCypherQuery:r,bindParameters:{ids:e}}))).resultRowsStream.getReader();try{for(;;){const{done:e,value:n}=await t.read();if(e)break;for(let t=0;t<n.length;t++){const e=n[t];i.push({id:e[0],typeName:e[1]}),i.push({id:e[2],typeName:e[3]})}}}catch(o){if("AbortError"!==o.name)throw o;n.getLogger(this).info("Request aborted as expected")}})().then((()=>{t()}))}));s.push(p)})),this.refreshCacheContent(),await Promise.all(s),i}async refreshCacheContent(e,t,n,s=!0){const a=c.getInstance(),r=[],p=new Map,d=new Map;this.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&d.set(e.name,e)})),this.knowledgeGraph.dataModel.relationshipTypes?.forEach((e=>{e.name&&d.set(e.name,e)})),e||this.inclusionModeDefinition?e?e.forEach((e=>{if(this.memberIdTypeLookup.has(e))for(const t of this.memberIdTypeLookup.get(e))p.has(t)?p.get(t)?.push(e):p.set(t,[e])})):this.inclusionModeDefinition?.namedTypeDefinitions?.forEach(((e,t)=>{e.useAllData?p.set(t,null):e.members&&e.members.forEach((e=>{p.has(t)&&null!==p.get(t)?p.get(t)?.push(e.id):p.set(t,[e.id])}))})):(this.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&p.set(e.name,null)})),this.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&p.set(e.name,null)})));for(const[m,l]of p){const e=new Promise((e=>{const r=async()=>{const e=new Set,r=[];let p,h="",c=!1;if(t||d.get(m)?.properties?.forEach((t=>{t.name&&e.add(t.name)})),n&&this.geographicLookup.has(m)){const t=this.geographicLookup.get(m)?.name;t&&e.add(t)}if(this.entityTypeNames.has(m))h=`MATCH (n:${m}) ${l?"WHERE id(n) IN $ids ":""}return ID(n)`,e.forEach((e=>{h+=`, n.${e}`,r.push(e)}));else{if(!this.relationshipTypeNames.has(m))throw new i("knowledge-graph:layer-data-manager",`The graph type of ${m} could not be determined. Was this type set in the KG data model and inclusion definition?`);c=!0,h=`MATCH ()-[n:${m}]->() ${l?"WHERE id(n) IN $ids ":""}return ID(n), id(startNode(n)), id(endNode(n))`,e.forEach((e=>{h+=`, n.${e}`,r.push(e)}))}p=new f(l?{openCypherQuery:h,bindParameters:{ids:l}}:{openCypherQuery:h});const y=(await u(this.knowledgeGraph,p)).resultRowsStream.getReader();for(;;){const{done:e,value:t}=await y.read();if(e)break;const i=[];for(let s=0;s<t.length;s++){const e=t[s];let n=0,a=0;const p={properties:{}};for(p.id=e[n],n++,a++,c&&(p.originId=e[n],n++,a++,p.destinationId=e[n],n++,a++,o(this.nodeConnectionsLookup,p.originId,(()=>new Set)).add(p.id),o(this.nodeConnectionsLookup,p.destinationId,(()=>new Set)).add(p.id),o(this.relationshipConnectionsLookup,p.id,(()=>[p.originId,p.destinationId])));n<e.length;n++)p.properties[r[n-a]]=e[n];i.push(p)}const n=a.writeToStore(i,w,this.geographicLookup.get(m)?.name);this.sublayerCaches.has(m)||this.sublayerCaches.set(m,new Map),s&&!this.inclusionModeDefinition?.namedTypeDefinitions.has(m)&&this.inclusionModeDefinition?.namedTypeDefinitions.set(m,{useAllData:!1,members:new Map}),s&&!this.inclusionModeDefinition?.namedTypeDefinitions.get(m).members&&(this.inclusionModeDefinition.namedTypeDefinitions.get(m).members=new Map);const p=this.sublayerCaches.get(m);n.forEach((e=>{p?.set(e.attributes[w],e),s&&!this.inclusionModeDefinition?.namedTypeDefinitions.get(m).members.has(e.attributes[w])&&(this.inclusionModeDefinition?.namedTypeDefinitions.get(m).members.set(e.attributes[w],{id:e.attributes[w]}),o(this.memberIdTypeLookup,e.attributes[w],(()=>new Set)).add(m))}))}};r().then((()=>{e(null)}))}));r.push(e),this._processingCacheUpdatesLookup.get(m)?.push(e)}await Promise.all(r)}removeFromLayer(e){const t=new Set,i=new Set(e.map((e=>e.id)));for(const n of e)t.add(n.typeName),1===this.memberIdTypeLookup.get(n.id)?.size?this.memberIdTypeLookup.delete(n.id):this.memberIdTypeLookup.get(n.id)?.delete(n.typeName),this.inclusionModeDefinition?.namedTypeDefinitions.forEach(((e,t)=>{t===n.typeName&&e.members?.has(n.id)&&e.members.delete(n.id)}));t.forEach((e=>{this.sublayerCaches.get(e)?.forEach(((t,n)=>{i.has(n)&&this.sublayerCaches.get(e)?.delete(n)}))}))}async retrieveDataFromService(e,t,n){const o=c.getInstance(),a=new Set,r=[];let p,g="",T=[];const D="relationship"===t.graphType,M=this.inclusionModeDefinition?.namedTypeDefinitions?.get(t.objectType.name)?.useAllData,I=t.parentCompositeLayer.sublayerIdsCache.get(t.objectType.name);let k=!M&&I?Array.from(I).sort():null;if(this.inclusionModeDefinition?.namedTypeDefinitions?.get(t.objectType.name)?.useAllData)this.inclusionModeDefinition?.namedTypeDefinitions?.get(t.objectType.name)?.useAllData&&null!=e.objectIds&&(k=e.objectIds);else if(null!=e.objectIds&&k&&k.length>0){const t=e.objectIds;e.objectIds=k.filter((e=>t.includes(e)))}else if(null!=e.objectIds)k=e.objectIds;else{if(this.inclusionModeDefinition?.namedTypeDefinitions.has(t.objectType.name)&&(!this.inclusionModeDefinition.namedTypeDefinitions.get(t.objectType.name)?.members||this.inclusionModeDefinition.namedTypeDefinitions.get(t.objectType.name)?.members?.size<1))return e.objectIds=[],[];e.objectIds=k}if(null!=e.outFields){const i=e.outFields;i.includes("*")?t.fields.forEach((e=>{a.add(e.name)})):i.forEach((e=>{e!==w&&e!==t.geometryFieldName&&a.add(e)}))}if(null!=e.geometry){const n=e.geometry;let o;const c=t.parentCompositeLayer.dataManager.knowledgeGraph.serviceDefinition,u=c?.spatialReference,w=c?.serviceCapabilities?.geometryCapabilities;let T=w?.geometryMaxBoundingRectangleSizeX,M=w?.geometryMaxBoundingRectangleSizeY;if(n?.extent?.spatialReference&&!n.spatialReference?.isWGS84?(await m(n.extent.spatialReference,h),o=l(n.extent,h)):o=n.extent,T&&M&&u){if(4326!==u.wkid){const e=new b({spatialReference:u,xmax:T,ymax:M}),t=l(e,h);T=t.xmax,M=t.ymax}if(o.xmax-o.xmin>T)throw new i("knowledge-graph:layer-data-manager",`Extent x bounds should be within ${T}° latitude, limit exceeded`);if(o.ymax-o.ymin>M)throw new i("knowledge-graph:layer-data-manager",`Extent y bounds should be within ${M}° longitude, limit exceeded`)}if(null!=e.where&&"1=1"!==e.where){const i=await s(e.where.toUpperCase(),t.fieldsIndex);t.fields.forEach((e=>{i.fieldNames.includes(e.name)&&a.add(e.name)}))}g=D?`Match ()-[n:${t.objectType.name}]->() WHERE esri.graph.ST_Intersects($param_filter_geom, n.${t.geometryFieldName}) return ID(n), id(startNode(r)), id(endNode(r))`:`Match (n:${t.objectType.name}) WHERE esri.graph.ST_Intersects($param_filter_geom, n.${t.geometryFieldName}) return ID(n)`,t.geometryFieldName&&a.add(t.geometryFieldName),a.forEach((e=>{g+=`, n.${e}`,r.push(e)})),p=new f({openCypherQuery:g,bindParameters:{param_filter_geom:new d({rings:y(o)})}})}else{let i="";if(null!=e.where&&"1=1"!==e.where){const n=await s(e.where,t.fieldsIndex);t.fields.forEach((e=>{n.fieldNames.includes(e.name)&&a.add(e.name)}));const o=new Set(["column-reference","string","number","binary-expression"]),r=new Set(["=","<","<=","<>",">",">=","AND","OR","LIKE"]);let p=!1;const d=e=>{if("column-reference"===e.type)return`n.${e.column}`;if("string"===e.type)return`'${e.value}'`;if("number"===e.type)return`${e.value}`;if("binary-expression"===e.type&&o.has(e.left.type)&&o.has(e.right.type)&&r.has(e.operator))return`${d(e.left)} ${e.operator} ${d(e.right)}`;if("binary-expression"===e.type&&"LIKE"===e.operator){let t="";if("function"===e.left.type&&"column-reference"===e.left.args.value[0].type)t+=`lower(n.${e.left.args.value[0].column})`;else{if("column-reference"!==e.left.type)return p=!0,"";t+=`lower(n.${e.left.column})`}if(t+=" CONTAINS (","string"!==e.right.type)return p=!0,"";{let i=e.right.value;"%"===i.charAt(0)&&(i=i.slice(1)),"%"===i.charAt(i.length-1)&&(i=i.slice(0,-1)),t+=`'${i.toLowerCase()}')`}return t}return p=!0,""};i=d(n.parseTree),p&&(i="")}let n="";n=D?`Match ()-[n:${t.objectType.name}]->()`:`Match (n:${t.objectType.name})`;let o=!1;k&&(o=!0,n+=" WHERE ID(n) IN $ids"),i&&(n+=o?" AND":" WHERE",n+=` ${i}`),n+=" return ID(n)",D&&(n+=", id(startNode(n)), id(endNode(n))"),e.returnGeometry&&t.geometryFieldName&&a.add(t.geometryFieldName),a.forEach((e=>{n+=`, n.${e}`,r.push(e)})),p=new f(k?{openCypherQuery:n,bindParameters:{ids:k}}:{openCypherQuery:n})}const E=(await u(t.parentCompositeLayer.dataManager.knowledgeGraph,p,n)).resultRowsStream.getReader();for(;;){const{done:e,value:i}=await E.read();if(e)break;const n=[];for(let t=0;t<i.length;t++){const e=i[t];let o=0,s=0;const a={properties:{}};for(a.id=e[o],o++,s++,D&&(a.originId=e[o],o++,s++,a.destinationId=e[o],o++,s++);o<e.length;o++)a.properties[r[o-s]]=e[o];n.push(a)}T=T.concat(o.writeToStore(n,w,t.parentCompositeLayer.dataManager.geographicLookup.get(t.objectType.name)?.name))}return T}};e([a()],k.prototype,"knowledgeGraph",void 0),e([a()],k.prototype,"inclusionModeDefinition",void 0),e([a()],k.prototype,"entityTypeNames",void 0),e([a()],k.prototype,"relationshipTypeNames",void 0),e([a()],k.prototype,"geographicLookup",void 0),e([a()],k.prototype,"sublayerCaches",void 0),e([a()],k.prototype,"nodeConnectionsLookup",void 0),e([a()],k.prototype,"relationshipConnectionsLookup",void 0),e([a()],k.prototype,"memberIdTypeLookup",void 0),k=e([r("esri.rest.knowledgeGraph.knowledgeGraphLayer.KnowledgeGraphLayerDataManager")],k);export{k as KnowledgeGraphLayerDataManager,I as geohashEncodingPrecision,D as mockDestinationIdFieldName,M as mockLayoutGeometryFieldName,w as mockOidFieldName,T as mockOriginIdFieldName};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../core/Accessor.js";import i from"../../core/Error.js";import n from"../../core/Logger.js";import{getOrCreateMapValue as o}from"../../core/MapUtils.js";import{parseWhereClause as s}from"../../core/sql.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import{encodeGeohash as p}from"../../geohash/geohashUtils.js";import d from"../../geometry/Polygon.js";import{initializeProjection as m,project as l}from"../../geometry/projection.js";import{wgs84 as h}from"../../geometry/support/spatialReferenceUtils.js";import c from"./SessionMemoryStorage.js";import{extentToInBoundsRings as y}from"./supportUtils.js";import{executeQueryStreaming as u}from"../../rest/knowledgeGraphService.js";import f from"../../rest/knowledgeGraph/GraphQueryStreaming.js";import g from"../../rest/support/Query.js";import b from"../../geometry/Extent.js";const w="ESRI__ID",T="ESRI__ORIGIN_ID",D="ESRI__DESTINATION_ID",I="ESRI__LAYOUT_GEOMETRY",M="ESRI__AGGREGATION_COUNT",k=12;let E=class extends t{constructor(e){super(e),this._processingCacheUpdatesLookup=new Map,this.knowledgeGraph=null,this.inclusionModeDefinition={generateAllSublayers:!0,namedTypeDefinitions:new Map},this.entityTypeNames=new Set,this.relationshipTypeNames=new Set,this.geographicLookup=new Map,this.sublayerCaches=new Map,this.nodeConnectionsLookup=new Map,this.relationshipConnectionsLookup=new Map,this.memberIdTypeLookup=new Map;const t=new Map;e.knowledgeGraph.dataModel.entityTypes?.forEach((i=>{i.name&&(t.set(i.name,"entity"),this._processingCacheUpdatesLookup.set(i.name,[]),e.inclusionModeDefinition&&!e.inclusionModeDefinition?.generateAllSublayers||this.entityTypeNames.add(i.name),i.properties?.forEach((e=>{e.geometryType&&"esriGeometryNull"!==e.geometryType&&this.geographicLookup.set(i.name,{name:e.name??"",geometryType:e.geometryType})})))})),e.knowledgeGraph.dataModel.relationshipTypes?.forEach((i=>{i.name&&(t.set(i.name,"relationship"),this._processingCacheUpdatesLookup.set(i.name,[]),e.inclusionModeDefinition&&!e.inclusionModeDefinition?.generateAllSublayers||this.relationshipTypeNames.add(i.name),i.properties?.forEach((e=>{e.geometryType&&"esriGeometryNull"!==e.geometryType&&this.geographicLookup.set(i.name,{name:e.name??"",geometryType:e.geometryType})})))})),e.inclusionModeDefinition?.namedTypeDefinitions.forEach(((i,s)=>{if("entity"===t.get(s))this.entityTypeNames.add(s);else{if("relationship"!==t.get(s))return n.getLogger(this).warn(`A named type, ${s}, was in the inclusion list that wasn't in the data model and will be removed`),void e.inclusionModeDefinition?.namedTypeDefinitions.delete(s);this.relationshipTypeNames.add(s)}const a=new Map;i.members?.forEach((e=>{o(this.memberIdTypeLookup,e.id,(()=>new Set)).add(s);const t=this.getById(e.id);t&&a.set(e.id,t)})),this.sublayerCaches.set(s,a)}))}addToLayer(e){e.forEach((({typeName:e,id:t})=>{if(!this.inclusionModeDefinition)throw new i("knowledge-graph:layer-data-manager","You cannot add to a layer's exclusion list if it was not created with an exclusion list originally");if(this.inclusionModeDefinition.namedTypeDefinitions.has(e)){if(this.inclusionModeDefinition.namedTypeDefinitions.has(e)){const i=this.inclusionModeDefinition.namedTypeDefinitions.get(e);i.members||(i.members=new Map),i.members.set(t,{id:t}),o(this.memberIdTypeLookup,t,(()=>new Set)).add(e)}}else{const i=new Map;i.set(t,{id:t}),this.inclusionModeDefinition.namedTypeDefinitions.set(e,{useAllData:!1,members:i}),o(this.memberIdTypeLookup,t,(()=>new Set)).add(e)}}))}getById(e){return c.getInstance().readFromStoreById(e)}async getData(e,t,i){if(t.objectType.name&&this.inclusionModeDefinition?.namedTypeDefinitions&&this.inclusionModeDefinition.namedTypeDefinitions.size>0&&!this.inclusionModeDefinition.namedTypeDefinitions.has(t.objectType.name))return[];let n;if(n=e||new g({where:"1=1",outFields:["*"]}),"link-chart"===t.parentCompositeLayer.type){const e=t.parentCompositeLayer,i=this._processingCacheUpdatesLookup.get(t.objectType.name??""),o=n.outFields,s=n.geometry;let a="",r="";s&&s.extent&&(a=p(s.extent.ymin,s.extent.xmin,k),r=p(s.extent.ymax,s.extent.xmax,k)),o&&1===o.length&&o[0]===w&&"1=1"===n.where||await Promise.all(i??[]);const d=this.sublayerCaches.has(t.objectType.name??"")?Array.from(this.sublayerCaches.get(t.objectType.name)?.values()):[],m=[];return d.forEach((i=>{if(this.relationshipTypeNames.has(t.objectType.name)?i.geometry=e.relationshipLinkChartDiagramLookup.get(i.attributes[t.objectIdField]):i.geometry=e.entityLinkChartDiagramLookup.get(i.attributes[t.objectIdField]),i.attributes[I]=i.geometry,a&&r){const n=e.linkChartGeohashLookup.get(i.attributes[t.objectIdField]);n?n>=a&&n<=r&&m.push(i):m.push(i)}else m.push(i)})),m}return this.retrieveDataFromService(n,t,i)}async getConnectedRecordIds(e,t){const i=[];let o="";const s=[],a=new Map;if(e.forEach((e=>{if(this.memberIdTypeLookup.has(e))for(const t of this.memberIdTypeLookup.get(e)){if(!this.entityTypeNames.has(t))return;a.has(t)?a.get(t)?.push(e):a.set(t,[e])}})),t&&0!==t?.length){for(const e of t)o=o+e+"|";o=o.slice(0,-1)}return a.forEach(((e,a)=>{let r;r=t&&0!==t?.length?`MATCH (n:${a})-[r:${o}]-(m) WHERE id(n) IN $ids RETURN id(r), type(r), id(m), labels(m)[0]`:`MATCH (n:${a})-[r]-(m) WHERE id(n) IN $ids RETURN id(r), type(r), id(m), labels(m)[0]`;const p=new Promise((t=>{(async()=>{const t=(await u(this.knowledgeGraph,new f({openCypherQuery:r,bindParameters:{ids:e}}))).resultRowsStream.getReader();try{for(;;){const{done:e,value:n}=await t.read();if(e)break;for(let t=0;t<n.length;t++){const e=n[t];i.push({id:e[0],typeName:e[1]}),i.push({id:e[2],typeName:e[3]})}}}catch(o){if("AbortError"!==o.name)throw o;n.getLogger(this).info("Request aborted as expected")}})().then((()=>{t()}))}));s.push(p)})),this.refreshCacheContent(),await Promise.all(s),i}async refreshCacheContent(e,t,n,s=!0){const a=c.getInstance(),r=[],p=new Map,d=new Map;this.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&d.set(e.name,e)})),this.knowledgeGraph.dataModel.relationshipTypes?.forEach((e=>{e.name&&d.set(e.name,e)})),e||this.inclusionModeDefinition?e?e.forEach((e=>{if(this.memberIdTypeLookup.has(e))for(const t of this.memberIdTypeLookup.get(e))p.has(t)?p.get(t)?.push(e):p.set(t,[e])})):this.inclusionModeDefinition?.namedTypeDefinitions?.forEach(((e,t)=>{e.useAllData?p.set(t,null):e.members&&e.members.forEach((e=>{p.has(t)&&null!==p.get(t)?p.get(t)?.push(e.id):p.set(t,[e.id])}))})):(this.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&p.set(e.name,null)})),this.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&p.set(e.name,null)})));for(const[m,l]of p){const e=new Promise((e=>{const r=async()=>{const e=new Set,r=[];let p,h="",c=!1;if(t||d.get(m)?.properties?.forEach((t=>{t.name&&e.add(t.name)})),n&&this.geographicLookup.has(m)){const t=this.geographicLookup.get(m)?.name;t&&e.add(t)}if(this.entityTypeNames.has(m))h=`MATCH (n:${m}) ${l?"WHERE id(n) IN $ids ":""}return ID(n)`,e.forEach((e=>{h+=`, n.${e}`,r.push(e)}));else{if(!this.relationshipTypeNames.has(m))throw new i("knowledge-graph:layer-data-manager",`The graph type of ${m} could not be determined. Was this type set in the KG data model and inclusion definition?`);c=!0,h=`MATCH ()-[n:${m}]->() ${l?"WHERE id(n) IN $ids ":""}return ID(n), id(startNode(n)), id(endNode(n))`,e.forEach((e=>{h+=`, n.${e}`,r.push(e)}))}p=new f(l?{openCypherQuery:h,bindParameters:{ids:l}}:{openCypherQuery:h});const y=(await u(this.knowledgeGraph,p)).resultRowsStream.getReader();for(;;){const{done:e,value:t}=await y.read();if(e)break;const i=[];for(let s=0;s<t.length;s++){const e=t[s];let n=0,a=0;const p={properties:{}};for(p.id=e[n],n++,a++,c&&(p.originId=e[n],n++,a++,p.destinationId=e[n],n++,a++,o(this.nodeConnectionsLookup,p.originId,(()=>new Set)).add(p.id),o(this.nodeConnectionsLookup,p.destinationId,(()=>new Set)).add(p.id),o(this.relationshipConnectionsLookup,p.id,(()=>[p.originId,p.destinationId])));n<e.length;n++)p.properties[r[n-a]]=e[n];i.push(p)}const n=a.writeToStore(i,w,this.geographicLookup.get(m)?.name);this.sublayerCaches.has(m)||this.sublayerCaches.set(m,new Map),s&&!this.inclusionModeDefinition?.namedTypeDefinitions.has(m)&&this.inclusionModeDefinition?.namedTypeDefinitions.set(m,{useAllData:!1,members:new Map}),s&&!this.inclusionModeDefinition?.namedTypeDefinitions.get(m).members&&(this.inclusionModeDefinition.namedTypeDefinitions.get(m).members=new Map);const p=this.sublayerCaches.get(m);n.forEach((e=>{p?.set(e.attributes[w],e),s&&!this.inclusionModeDefinition?.namedTypeDefinitions.get(m).members.has(e.attributes[w])&&(this.inclusionModeDefinition?.namedTypeDefinitions.get(m).members.set(e.attributes[w],{id:e.attributes[w]}),o(this.memberIdTypeLookup,e.attributes[w],(()=>new Set)).add(m))}))}};r().then((()=>{e(null)}))}));r.push(e),this._processingCacheUpdatesLookup.get(m)?.push(e)}await Promise.all(r)}removeFromLayer(e){const t=new Set,i=new Set(e.map((e=>e.id)));for(const n of e)t.add(n.typeName),1===this.memberIdTypeLookup.get(n.id)?.size?this.memberIdTypeLookup.delete(n.id):this.memberIdTypeLookup.get(n.id)?.delete(n.typeName),this.inclusionModeDefinition?.namedTypeDefinitions.forEach(((e,t)=>{t===n.typeName&&e.members?.has(n.id)&&e.members.delete(n.id)}));t.forEach((e=>{this.sublayerCaches.get(e)?.forEach(((t,n)=>{i.has(n)&&this.sublayerCaches.get(e)?.delete(n)}))}))}async retrieveDataFromService(e,t,n){const o=c.getInstance(),a=new Set,r=[];let p,g="",T=[];const D="relationship"===t.graphType,I=this.inclusionModeDefinition?.namedTypeDefinitions?.get(t.objectType.name)?.useAllData,M=t.parentCompositeLayer.sublayerIdsCache.get(t.objectType.name);let k=!I&&M?Array.from(M).sort():null;if(this.inclusionModeDefinition?.namedTypeDefinitions?.get(t.objectType.name)?.useAllData)this.inclusionModeDefinition?.namedTypeDefinitions?.get(t.objectType.name)?.useAllData&&null!=e.objectIds&&(k=e.objectIds);else if(null!=e.objectIds&&k&&k.length>0){const t=e.objectIds;e.objectIds=k.filter((e=>t.includes(e)))}else if(null!=e.objectIds)k=e.objectIds;else{if(this.inclusionModeDefinition?.namedTypeDefinitions.has(t.objectType.name)&&(!this.inclusionModeDefinition.namedTypeDefinitions.get(t.objectType.name)?.members||this.inclusionModeDefinition.namedTypeDefinitions.get(t.objectType.name)?.members?.size<1))return e.objectIds=[],[];e.objectIds=k}if(null!=e.outFields){const i=e.outFields;i.includes("*")?t.fields.forEach((e=>{a.add(e.name)})):i.forEach((e=>{e!==w&&e!==t.geometryFieldName&&a.add(e)}))}if(null!=e.geometry){const n=e.geometry;let o;const c=t.parentCompositeLayer.dataManager.knowledgeGraph.serviceDefinition,u=c?.spatialReference,w=c?.serviceCapabilities?.geometryCapabilities;let T=w?.geometryMaxBoundingRectangleSizeX,I=w?.geometryMaxBoundingRectangleSizeY;if(n?.extent?.spatialReference&&!n.spatialReference?.isWGS84?(await m(n.extent.spatialReference,h),o=l(n.extent,h)):o=n.extent,T&&I&&u){if(4326!==u.wkid){const e=new b({spatialReference:u,xmax:T,ymax:I}),t=l(e,h);T=t.xmax,I=t.ymax}if(o.xmax-o.xmin>T)throw new i("knowledge-graph:layer-data-manager",`Extent x bounds should be within ${T}° latitude, limit exceeded`);if(o.ymax-o.ymin>I)throw new i("knowledge-graph:layer-data-manager",`Extent y bounds should be within ${I}° longitude, limit exceeded`)}if(null!=e.where&&"1=1"!==e.where){const i=await s(e.where.toUpperCase(),t.fieldsIndex);t.fields.forEach((e=>{i.fieldNames.includes(e.name)&&a.add(e.name)}))}g=D?`Match ()-[n:${t.objectType.name}]->() WHERE esri.graph.ST_Intersects($param_filter_geom, n.${t.geometryFieldName}) return ID(n), id(startNode(r)), id(endNode(r))`:`Match (n:${t.objectType.name}) WHERE esri.graph.ST_Intersects($param_filter_geom, n.${t.geometryFieldName}) return ID(n)`,t.geometryFieldName&&a.add(t.geometryFieldName),a.forEach((e=>{g+=`, n.${e}`,r.push(e)})),p=new f({openCypherQuery:g,bindParameters:{param_filter_geom:new d({rings:y(o)})}})}else{let i="";if(null!=e.where&&"1=1"!==e.where){const n=await s(e.where,t.fieldsIndex);t.fields.forEach((e=>{n.fieldNames.includes(e.name)&&a.add(e.name)}));const o=new Set(["column-reference","string","number","binary-expression"]),r=new Set(["=","<","<=","<>",">",">=","AND","OR","LIKE"]);let p=!1;const d=e=>{if("column-reference"===e.type)return`n.${e.column}`;if("string"===e.type)return`'${e.value}'`;if("number"===e.type)return`${e.value}`;if("binary-expression"===e.type&&o.has(e.left.type)&&o.has(e.right.type)&&r.has(e.operator))return`${d(e.left)} ${e.operator} ${d(e.right)}`;if("binary-expression"===e.type&&"LIKE"===e.operator){let t="";if("function"===e.left.type&&"column-reference"===e.left.args.value[0].type)t+=`lower(n.${e.left.args.value[0].column})`;else{if("column-reference"!==e.left.type)return p=!0,"";t+=`lower(n.${e.left.column})`}if(t+=" CONTAINS (","string"!==e.right.type)return p=!0,"";{let i=e.right.value;"%"===i.charAt(0)&&(i=i.slice(1)),"%"===i.charAt(i.length-1)&&(i=i.slice(0,-1)),t+=`'${i.toLowerCase()}')`}return t}return p=!0,""};i=d(n.parseTree),p&&(i="")}let n="";n=D?`Match ()-[n:${t.objectType.name}]->()`:`Match (n:${t.objectType.name})`;let o=!1;k&&(o=!0,n+=" WHERE ID(n) IN $ids"),i&&(n+=o?" AND":" WHERE",n+=` ${i}`),n+=" return ID(n)",D&&(n+=", id(startNode(n)), id(endNode(n))"),e.returnGeometry&&t.geometryFieldName&&a.add(t.geometryFieldName),a.forEach((e=>{n+=`, n.${e}`,r.push(e)})),p=new f(k?{openCypherQuery:n,bindParameters:{ids:k}}:{openCypherQuery:n})}const E=(await u(t.parentCompositeLayer.dataManager.knowledgeGraph,p,n)).resultRowsStream.getReader();for(;;){const{done:e,value:i}=await E.read();if(e)break;const n=[];for(let t=0;t<i.length;t++){const e=i[t];let o=0,s=0;const a={properties:{}};for(a.id=e[o],o++,s++,D&&(a.originId=e[o],o++,s++,a.destinationId=e[o],o++,s++);o<e.length;o++)a.properties[r[o-s]]=e[o];n.push(a)}T=T.concat(o.writeToStore(n,w,t.parentCompositeLayer.dataManager.geographicLookup.get(t.objectType.name)?.name))}return T}};e([a()],E.prototype,"knowledgeGraph",void 0),e([a()],E.prototype,"inclusionModeDefinition",void 0),e([a()],E.prototype,"entityTypeNames",void 0),e([a()],E.prototype,"relationshipTypeNames",void 0),e([a()],E.prototype,"geographicLookup",void 0),e([a()],E.prototype,"sublayerCaches",void 0),e([a()],E.prototype,"nodeConnectionsLookup",void 0),e([a()],E.prototype,"relationshipConnectionsLookup",void 0),e([a()],E.prototype,"memberIdTypeLookup",void 0),E=e([r("esri.rest.knowledgeGraph.knowledgeGraphLayer.KnowledgeGraphLayerDataManager")],E);export{E as KnowledgeGraphLayerDataManager,k as geohashEncodingPrecision,M as mockAggregationCountFieldName,D as mockDestinationIdFieldName,I as mockLayoutGeometryFieldName,w as mockOidFieldName,T as mockOriginIdFieldName};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../PopupTemplate.js";import"../../renderers/ClassBreaksRenderer.js";import"../../renderers/DictionaryRenderer.js";import"../../renderers/DotDensityRenderer.js";import"../../renderers/HeatmapRenderer.js";import"../../renderers/PieChartRenderer.js";import"../../renderers/Renderer.js";import"../../renderers/SimpleRenderer.js";import"../../renderers/UniqueValueRenderer.js";import{fromJSON as r}from"../../renderers/support/jsonUtils.js";import{rendererTypes as o}from"../../renderers/support/types.js";import"../../core/workers/workers.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{initializeProjection as a,project as n}from"../../geometry/projection.js";import{wgs84 as p}from"../../geometry/support/spatialReferenceUtils.js";import l from"../Layer.js";import y from"../graphics/data/FeatureStore.js";import{QueryEngine as m}from"../graphics/data/QueryEngine.js";import{createCapabilities as u,createDrawingInfo as d}from"../graphics/sources/support/clientSideDefaults.js";import{mockOidFieldName as h,mockLayoutGeometryFieldName as c}from"./KnowledgeGraphLayerDataManager.js";import{KnowledgeGraphSublayerBase as
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../PopupTemplate.js";import"../../renderers/ClassBreaksRenderer.js";import"../../renderers/DictionaryRenderer.js";import"../../renderers/DotDensityRenderer.js";import"../../renderers/HeatmapRenderer.js";import"../../renderers/PieChartRenderer.js";import"../../renderers/Renderer.js";import"../../renderers/SimpleRenderer.js";import"../../renderers/UniqueValueRenderer.js";import{fromJSON as r}from"../../renderers/support/jsonUtils.js";import{rendererTypes as o}from"../../renderers/support/types.js";import"../../core/workers/workers.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{initializeProjection as a,project as n}from"../../geometry/projection.js";import{wgs84 as p}from"../../geometry/support/spatialReferenceUtils.js";import l from"../Layer.js";import y from"../graphics/data/FeatureStore.js";import{QueryEngine as m}from"../graphics/data/QueryEngine.js";import{createCapabilities as u,createDrawingInfo as d}from"../graphics/sources/support/clientSideDefaults.js";import{mockOidFieldName as h,mockLayoutGeometryFieldName as c,mockAggregationCountFieldName as g}from"./KnowledgeGraphLayerDataManager.js";import{KnowledgeGraphSublayerBase as f}from"./KnowledgeGraphSublayerBase.js";import{BlendLayer as j}from"../mixins/BlendLayer.js";import{FeatureReductionLayer as b}from"../mixins/FeatureReductionLayer.js";import{RefreshableLayer as T}from"../mixins/RefreshableLayer.js";import{ScaleRangeLayer as w}from"../mixins/ScaleRangeLayer.js";import{popupEnabled as S}from"../support/commonProperties.js";import F from"../support/Field.js";import{fixRendererFields as x}from"../support/fieldUtils.js";import O from"../../rest/support/FeatureSet.js";import Q from"../../rest/support/Query.js";import{createPopupTemplate as L}from"../../support/popupUtils.js";import v from"../../core/workers/RemoteClient.js";import E from"../../geometry/Extent.js";import N from"../../geometry/Polygon.js";import C from"../../geometry/Polyline.js";import{featureGeometryTypeKebabDictionary as M}from"../../geometry/support/typeUtils.js";let I=class extends(b(f(j(w(T(l)))))){constructor(e){if(super(e),this.capabilities=u(!1,!1),this.definitionExpression="",this.displayField="",this.elevationInfo=null,this.geometryType=null,this.geometryFieldName=null,this.graphType=null,this.hasM=!1,this.hasZ=!1,this.labelsVisible=null,this.labelingInfo=null,this.objectIdField=h,this.objectType=null,this.parentCompositeLayer=null,this.popupEnabled=!0,this.popupTemplate=null,this.source={openPorts:()=>this.load().then((()=>{const e=new MessageChannel;return new v(e.port1,{channel:e,client:{queryFeatures:(e,t={})=>{const r=Q.fromJSON(e);return this.queryFeaturesJSON(r,t)}}}),[e.port2]}))},this.type="knowledge-graph-sublayer","link-chart"===e.parentCompositeLayer.type)"relationship"===e.graphType?this.geometryType="polyline":this.geometryType="point",this.geometryFieldName=c;else if(e.parentCompositeLayer.dataManager.geographicLookup.get(e.objectType.name)?.geometryType&&"esriGeometryNull"!==e.parentCompositeLayer.dataManager.geographicLookup.get(e.objectType.name)?.geometryType){const t=e.parentCompositeLayer.dataManager.geographicLookup.get(e.objectType.name);this.geometryFieldName=t?.name??null,this.geometryType=t?.geometryType?M.fromJSON(t.geometryType):null;const r=t?.name,o=r?e.objectType.properties?.[r]:null;o?(this.hasM=o.hasM??!1,this.hasZ=o.hasZ??!1):(this.hasM=!1,this.hasZ=!1)}else this.geometryType=null;e.objectType.properties?.forEach((e=>{let t=null,r=e.fieldType;"esriFieldTypeOID"===r&&(r="esriFieldTypeInteger"),this.fields.push(F.fromJSON({name:e.name,type:r,alias:e.alias,defaultValue:t,editable:e.editable,nullable:e.nullable}))})),this.fields.push(F.fromJSON({name:this.objectIdField,type:"esriFieldTypeString",alias:this.objectIdField,editable:!1})),this.fields.push(F.fromJSON({name:g,type:"esriFieldTypeInteger",alias:g,editable:!1})),this._set("fields",[...this.fields]),e.parentCompositeLayer.dataManager.knowledgeGraph.dataModel?.spatialReference&&(this.spatialReference=e.parentCompositeLayer.dataManager.knowledgeGraph.dataModel.spatialReference),"link-chart"===e.parentCompositeLayer.type?"relationship"===e.graphType?this.renderer=r(d(M.toJSON("polyline")).renderer):this.renderer=r(d(M.toJSON("point")).renderer):this.renderer=r(d(M.toJSON(this.geometryType)).renderer)}get defaultPopupTemplate(){return this.createPopupTemplate()}set renderer(e){x(e,this.fieldsIndex),this._set("renderer",e)}createPopupTemplate(e){return L(this,e)}createQuery(){return new Q({where:"1=1",outFields:["*"]})}getField(e){for(let t=0;t<this.fields.length;t++)if(this.fields[t].name===e)return this.fields[t];return null}getFieldDomain(e,t){return null}async queryFeatures(e,t){const{resolvedQuery:r,queryEngine:o}=await this._setupQueryObjects(e),s=O.fromJSON(await o.executeQuery(r.toJSON(),t?.signal));return s.features.forEach((e=>{e.sourceLayer=this})),s}async queryFeaturesJSON(e,t){const{resolvedQuery:r,queryEngine:o}=await this._setupQueryObjects(e);return await o.executeQuery(r.toJSON(),t?.signal)}async queryFeatureCount(e,t){const{resolvedQuery:r,queryEngine:o}=await this._setupQueryObjects(e);return o.executeQueryForCount(r.toJSON(),t?.signal)}async queryExtent(e={},t){const r={...e,returnGeometry:!0},{resolvedQuery:o,queryEngine:s}=await this._setupQueryObjects(r),i=await s.executeQueryForExtent(o.toJSON(),t?.signal);let a;return a=null!=i.extent?.xmin&&null!=i.extent?.xmax&&null!=i.extent?.ymin&&null!=i.extent?.ymax?new E(i.extent):new E,{count:i.count,extent:a}}async queryObjectIds(e,t){const r=Q.from(e);let o;if("link-chart"===this.parentCompositeLayer.type&&this._cachedQueryEngine)o=this._cachedQueryEngine;else{const e=await this.parentCompositeLayer.dataManager.getData(r,this,t);o=this.loadQueryEngine(e)}return o.executeQueryForIds(r.toJSON(),t?.signal)}loadQueryEngine(e){const t=new y({geometryType:M.toJSON(this.geometryType),hasM:this.hasM,hasZ:this.hasZ}),r=new m({fieldsIndex:this.fieldsIndex.toJSON(),geometryType:M.toJSON(this.geometryType),hasM:this.hasM,hasZ:this.hasZ,objectIdField:this.objectIdField,spatialReference:this.spatialReference.toJSON(),timeInfo:null,featureStore:t});return r.featureStore.addMany(e),r}async refreshCachedQueryEngine(){const e=await this.parentCompositeLayer.dataManager.getData(new Q({where:"1=1",outFields:[h]}),this);this._cachedQueryEngine=this.loadQueryEngine(e)}async _setupQueryObjects(e,t){const r=Q.from(e),o=r.geometry;let s;if(o&&!o.spatialReference?.isWGS84&&(await a(o.spatialReference,p),r.geometry=n(o instanceof N||o instanceof C?o:o.extent,p)),"link-chart"===this.parentCompositeLayer.type&&this._cachedQueryEngine)s=this._cachedQueryEngine;else{const e=await this.parentCompositeLayer.dataManager.getData(r,this,t);s=this.loadQueryEngine(e)}return{resolvedQuery:r,queryEngine:s}}};e([s()],I.prototype,"capabilities",void 0),e([s({readOnly:!0})],I.prototype,"defaultPopupTemplate",null),e([s()],I.prototype,"definitionExpression",void 0),e([s()],I.prototype,"displayField",void 0),e([s()],I.prototype,"elevationInfo",void 0),e([s()],I.prototype,"geometryType",void 0),e([s()],I.prototype,"geometryFieldName",void 0),e([s()],I.prototype,"graphType",void 0),e([s()],I.prototype,"hasM",void 0),e([s()],I.prototype,"hasZ",void 0),e([s()],I.prototype,"labelsVisible",void 0),e([s()],I.prototype,"labelingInfo",void 0),e([s()],I.prototype,"objectIdField",void 0),e([s()],I.prototype,"objectType",void 0),e([s()],I.prototype,"parentCompositeLayer",void 0),e([s(S)],I.prototype,"popupEnabled",void 0),e([s({type:t,json:{name:"popupInfo",write:!0}})],I.prototype,"popupTemplate",void 0),e([s({types:o,json:{write:{target:"layerDefinition.drawingInfo.renderer"}}})],I.prototype,"renderer",null),e([s()],I.prototype,"source",void 0),e([s({json:{read:!1}})],I.prototype,"type",void 0),I=e([i("esri.layers.knowledgeGraph.KnowledgeGraphSublayer")],I);const R=I;export{R as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import"../../renderers/ClassBreaksRenderer.js";import"../../renderers/DictionaryRenderer.js";import"../../renderers/DotDensityRenderer.js";import"../../renderers/HeatmapRenderer.js";import"../../renderers/PieChartRenderer.js";import"../../renderers/Renderer.js";import r from"../../renderers/SimpleRenderer.js";import"../../renderers/UniqueValueRenderer.js";import"../../renderers/support/jsonUtils.js";import"../../core/Logger.js";import{watch as s,sync as t}from"../../core/reactiveUtils.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";import o from"../support/AggregateField.js";import{featureReductionProperty as a}from"../support/featureReductionUtils.js";import u from"../../renderers/visualVariables/SizeVariable.js";import l from"../../renderers/visualVariables/support/SizeStop.js";import{createInferredClusterRenderer as d}from"../../views/2d/layers/support/clusterUtils.js";const c=c=>{let p=class extends c{constructor(...e){super(...e),this.addHandles(s((()=>this.renderer),(()=>{if(this.featureReduction){const e=this._normalizeFeatureReduction(this.featureReduction);this._set("featureReduction",e)}}),t))}set featureReduction(e){const r=this._normalizeFeatureReduction(e);this._set("featureReduction",r)}set renderer(e){}_withClusterVariable(e,r,s){const t=e.clone();if("visualVariables"in t){t.visualVariables||(t.visualVariables=[]);t.visualVariables.some((e=>"size"===e.type))||t.visualVariables.push(new u({field:"cluster_count",stops:[new l({value:1}),new l({useMinValue:!0,size:r}),new l({useMaxValue:!0,size:s})]}))}return t}_normalizeFeatureReduction(e){if("cluster"!==e?.type)return e;const s=e.clone(),t=[new o({name:"cluster_count",isAutoGenerated:!0,statisticType:"count"})],i=(s.fields??[]).filter((e=>!e.isAutoGenerated)),n=e.renderer&&!e.renderer.authoringInfo?.isAutoGenerated,{clusterMinSize:a,clusterMaxSize:u}=s;if(n){s.fields=[...t,...i];const e=this._withClusterVariable(s.renderer,a,u);return s.effectiveFeatureRenderer=e,s.effectiveClusterRenderer=e,s}if(e.symbol){if(s.fields=[...t,...i],s.renderer=null,!this.renderer)return s.effectiveFeatureRenderer=null,s.effectiveClusterRenderer=null,s;const n=d(t,this.renderer),o=this._withClusterVariable(n,a,u),l="visualVariables"in o&&o.visualVariables?o.visualVariables:[],c=new r({symbol:e.symbol,visualVariables:l});return s.effectiveFeatureRenderer=o,s.effectiveClusterRenderer=c,s}if(!this.renderer)return e;const l=d(t,this.renderer);s.fields=[...t,...i],s.renderer=l;const c=this._withClusterVariable(l,a,u);return s.effectiveFeatureRenderer=c,s.effectiveClusterRenderer=c,s}};return e([i(a)],p.prototype,"featureReduction",null),p=e([n("esri.layers.mixins.FeatureReductionLayer")],p),p};export{c as FeatureReductionLayer};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import"../../renderers/ClassBreaksRenderer.js";import"../../renderers/DictionaryRenderer.js";import"../../renderers/DotDensityRenderer.js";import"../../renderers/HeatmapRenderer.js";import"../../renderers/PieChartRenderer.js";import"../../renderers/Renderer.js";import r from"../../renderers/SimpleRenderer.js";import"../../renderers/UniqueValueRenderer.js";import"../../renderers/support/jsonUtils.js";import"../../core/Logger.js";import{watch as s,sync as t}from"../../core/reactiveUtils.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";import o from"../support/AggregateField.js";import{featureReductionProperty as a}from"../support/featureReductionUtils.js";import u from"../../renderers/visualVariables/SizeVariable.js";import l from"../../renderers/visualVariables/support/SizeStop.js";import{createInferredClusterRenderer as d}from"../../views/2d/layers/support/clusterUtils.js";const c=c=>{let p=class extends c{constructor(...e){super(...e),this.addHandles(s((()=>this.renderer),(()=>{if(this.featureReduction){const e=this._normalizeFeatureReduction(this.featureReduction);this._set("featureReduction",e)}}),t))}set featureReduction(e){const r=this._normalizeFeatureReduction(e);this._set("featureReduction",r)}set renderer(e){}_withClusterVariable(e,r,s){const t=e.clone();if("visualVariables"in t){t.visualVariables||(t.visualVariables=[]);t.visualVariables.some((e=>"size"===e.type))||t.visualVariables.push(new u({field:"cluster_count",stops:[new l({value:1}),new l({useMinValue:!0,size:r}),new l({useMaxValue:!0,size:s})]}))}return t}_normalizeFeatureReduction(e){if("cluster"!==e?.type)return e;const s=e.clone(),t=[new o({name:"cluster_count",isAutoGenerated:!0,statisticType:"count"})],i=(s.fields??[]).filter((e=>!e.isAutoGenerated)),n=e.renderer&&!e.renderer.authoringInfo?.isAutoGenerated,{clusterMinSize:a,clusterMaxSize:u}=s;if(n){s.fields=[...t,...i];const e=this._withClusterVariable(s.renderer,a,u);return s.effectiveFeatureRenderer=e,s.effectiveClusterRenderer=e,s}if(e.symbol){if(s.fields=[...t,...i],s.renderer=null,!this.renderer)return s.effectiveFeatureRenderer=null,s.effectiveClusterRenderer=null,s;const n=d(t,this.renderer),o=this._withClusterVariable(n,a,u),l="visualVariables"in o&&o.visualVariables?o.visualVariables:[],c=new r({symbol:e.symbol,visualVariables:l});return s.fields=[...t,...i],s.effectiveFeatureRenderer=o,s.effectiveClusterRenderer=c,s}if(!this.renderer)return e;const l=d(t,this.renderer);s.fields=[...t,...i],s.renderer=l;const c=this._withClusterVariable(l,a,u);return s.effectiveFeatureRenderer=c,s.effectiveClusterRenderer=c,s}};return e([i(a)],p.prototype,"featureReduction",null),p=e([n("esri.layers.mixins.FeatureReductionLayer")],p),p};export{c as FeatureReductionLayer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../geometry.js";import{zeros as e}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{
|
|
5
|
+
import"../../../geometry.js";import{zeros as e}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{z as t,g as a}from"../../../chunks/vec32.js";import r from"../../../geometry/Circle.js";import n from"../../../geometry/Mesh.js";import{earth as i}from"../../../geometry/support/Ellipsoid.js";import{MeshVertexAttributes as s}from"../../../geometry/support/MeshVertexAttributes.js";import{isWebMercator as c}from"../../../geometry/support/spatialReferenceUtils.js";import{calculateRotationMatrix as o,transformMat3 as f,scaleAndAddWithFactor as l,scaleWithFactor as h}from"../transformations/utils.js";import m from"../../../geometry/Polygon.js";import y from"../../../geometry/SpatialReference.js";const g=Math.PI/180;function p(s){const{attributes:y}=s,{horizontalFieldOfView:p,geometry:u,verticalFieldOfView:x}=y;let R,H=1,w=null;if(u&&c(u?.spatialReference)&&(H=1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*u.y/i.radius)))),y.isSpherical){if(R=new r({center:u,radius:y.farDistance*H}),y.nearDistance){const e=new r({center:u,radius:y.nearDistance*H});R.addRing(e.rings[0])}const e=R.center;e&&(e.z=y.cameraHeight,w=n.createSphere(e,{size:2*y.farDistance}),w.centerAt(e))}else{let r=y.cameraPitch,n=y.cameraRoll,i=150;const c=[];p>150&&(r=90,n=0,i=5);const D=Math.ceil(p/i);if(D%2==0)for(let e=0;e<D/2;e++)c.push(y.cameraHeading-p/D*(e+.5),y.cameraHeading+p/D*(e+.5));else{c.push(y.cameraHeading);for(let e=1;e<D/2;e++)c.push(y.cameraHeading-p/D*e,y.cameraHeading+p/D*e)}c.sort();let j=y.farDistance?y.farDistance*H:y.cameraHeight*H/Math.cos(r*g);y.cameraPitch+x/2>=90&&(j=(y.farDistance||20)*H),R=new m({spatialReference:u?.spatialReference});for(const m of c){const i=o("HPR",[m,r,n]);w=M(s,i);const c=f([0,0,-1],i),{x:P,y:z}=u,F=l([P,z,y.cameraHeight],c,j,H),O=2*Math.tan(x*g/2)*j,V=2*Math.tan(p/D*g/2)*j,b=f([0,1,0],i),v=f([1,0,0],i),q=h(b,O/2,H),A=h(v,V/2,H),C=t(e(),q,A),S=a(e(),q,A),I=[a(e(),F,C),a(e(),F,S),t(e(),F,C),t(e(),F,S)].map((e=>d(e,y.cameraHeight,u,H)));I.push(I[0]),R.addRing(I)}}return{polygon:R,frustum:w}}function u(e,t){return e.contains(t)}function x(e,t){return Math.sign(e)!==Math.sign(t)}function M(r,i,c){const o=r.attributes,m=o.geometry,p=m.spatialReference??r.spatialReference;m.spatialReference=p instanceof y?p:y.fromJSON(p);const u=H(m),x=o.nearDistance<0?0:o.nearDistance*u;let M=o.cameraHeight*u/Math.cos(o.cameraPitch*g),d=!0;o.cameraPitch+o.verticalFieldOfView/2>=90&&(M=(o.farDistance??20)*u,d=!1);const R=2*Math.tan(o.verticalFieldOfView*g/2)*x,w=2*Math.tan(o.horizontalFieldOfView*g/2)*x,D=2*Math.tan(o.verticalFieldOfView*g/2)*M,j=2*Math.tan(o.horizontalFieldOfView*g/2)*M;let P,z;c?(P=c,z=h(t(e(),P,[m.x,m.y,o.cameraHeight]),1/M,1/u)):(z=[0,0,-1],z=f(z,i),P=l([m.x,m.y,o.cameraHeight],z,M,u),d&&(P[2]=0));const F=l([m.x,m.y,o.cameraHeight],z,x,u);let O=[0,1,0];O=f(O,i);let V=[1,0,0];V=f(V,i);let b=[],v=[];x?(v=[{faces:[4,0,3,4,7,3]},{faces:[5,1,2,5,6,2]},{faces:[4,0,1,4,5,1]},{faces:[6,2,3,6,7,3]}],b=b.concat(a(e(),F,t(e(),h(O,R/2,u),h(V,w/2,u)))),b=b.concat(a(e(),F,a(e(),h(O,R/2,u),h(V,w/2,u)))),b=b.concat(t(e(),F,t(e(),h(O,R/2,u),h(V,w/2,u)))),b=b.concat(t(e(),F,a(e(),h(O,R/2,u),h(V,w/2,u))))):(b=[m.x,m.y,o.cameraHeight],v=[{faces:[0,1,2,0,2,3,0,3,4,0,4,1]}]),b=b.concat(a(e(),P,t(e(),h(O,D/2,u),h(V,j/2,u)))),b=b.concat(a(e(),P,a(e(),h(O,D/2,u),h(V,j/2,u)))),b=b.concat(t(e(),P,t(e(),h(O,D/2,u),h(V,j/2,u)))),b=b.concat(t(e(),P,a(e(),h(O,D/2,u),h(V,j/2,u))));const q=new s({position:Float64Array.from(b)});return new n({vertexAttributes:q,components:v,spatialReference:m.spatialReference})}function d(a,r,n,i){{const s=Math.sqrt((a[2]-r)**2+(Math.sqrt((a[0]-n.x)**2+(a[1]-n.y)**2)/i)**2)*i,c=h(t(e(),[a[0],a[1],a[2]],[n.x,n.y,r]),1/s,1/i),o=r/(r-a[2]),f={x:(1-o)*n.x+o*a[0],y:(1-o)*n.y+o*a[1],z:(1-o)*r+o*a[2]},l=Math.sqrt((f.z-r)**2+(Math.sqrt((f.x-n.x)**2+(f.y-n.y)**2)/i)**2)*i,m=h(t(e(),[f.x,f.y,f.z],[n.x,n.y,r]),1/l,1/i);return x(c[0],m[0])&&x(c[1],m[1])&&x(c[2],m[2])||a[2]>=0?[a[0],a[1],0]:[f.x,f.y,f.z]}}function R(e){const{spatialReference:t,x:a,y:r}=e.geometry,{cameraHeading:n,cameraPitch:i,farDistance:s,nearDistance:c}=e,o=H(e.geometry),f=new m({spatialReference:t}),l=Math.abs(1.44*s*o);let h=Math.abs(1.44*c*o);(i<20||null==n)&&(h=l);const y=[];return y[0]={x:a+l*Math.sin((n-45)*g),y:r+l*Math.cos((n-45)*g)},y[1]={x:a+l*Math.sin((n+45)*g),y:r+l*Math.cos((n+45)*g)},y[2]={x:a+h*Math.sin((n+135)*g),y:r+h*Math.cos((n+135)*g)},y[3]={x:a+h*Math.sin((n+225)*g),y:r+h*Math.cos((n+225)*g)},f.addRing([[y[0].x,y[0].y,0],[y[1].x,y[1].y,0],[y[2].x,y[2].y,0],[y[3].x,y[3].y,0],[y[0].x,y[0].y,0]]),f}function H(e){return e&&c(e?.spatialReference)?1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*e.y/i.radius))):1}function w(a,n){const i=1+n/100;if("esri.geometry.Circle"===a.declaredClass){const{radius:e,center:t}=a,n=new r({radius:e*i,center:t});return a.rings.length>1&&n.addRing(a.rings[1]),n}if("esri.geometry.Polygon"===a.declaredClass){const r=new m({spatialReference:a.spatialReference}),n=a.centroid;if(n){const s=[];for(let r=0;r<a.rings[0].length;r++){const c=Math.sqrt((n.x-a.rings[0][r][0])**2+(n.y-a.rings[0][r][1])**2),o=h(t(e(),[a.rings[0][r][0],a.rings[0][r][1],0],[n.x,n.y,0]),1/c,1),f=l([n.x,n.y,0],o,c*i,1);s.push({x:f[0],y:f[1]})}r.addRing([[s[0].x,s[0].y,0],[s[1].x,s[1].y,0],[s[2].x,s[2].y,0],[s[3].x,s[3].y,0],[s[0].x,s[0].y,0]])}return r}return a}export{u as checkIfPolygonContainsSelectedPoint,R as computePolygonForInspection,p as createCoveragePolygon,w as resizePolygon};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../geometry.js";import{deg2rad as e}from"../../../core/mathUtils.js";import{zeros as t,create as a}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{
|
|
5
|
+
import"../../../geometry.js";import{deg2rad as e}from"../../../core/mathUtils.js";import{zeros as t,create as a}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{z as r,g as i}from"../../../chunks/vec32.js";import n from"../../../geometry/Point.js";import{initializeProjection as s,project as o}from"../../../geometry/projection.js";import{fromPoints as c,fromValues as f}from"../../../geometry/support/ray.js";import{b as y,h as l}from"../../../chunks/sphere.js";import{geographicToWebMercator as x,webMercatorToGeographic as p}from"../../../geometry/support/webMercatorUtils.js";import{createCoveragePolygon as z}from"../core/coverageUtils.js";import m from"../core/ExposurePoint.js";import{transformPoints as u,updateElevation as h}from"./groundToImageUtils.js";import{getWebMercatorScalingFactor as w,convertPixelToHeadingPitch as R,convertHeadingPitchToSphereVertex as g,scaleAndAddWithFactor as b,ltpToGeographic as d,computeHFOVAndVFOV as P,projectiveTransform2 as M,scaleWithFactor as j,calculateRotationMatrix as O,transformMat3 as v,projectiveTransform as H,getPlaneLineIntersectionPoint as S}from"./utils.js";import{defaultImageSphereCenter as E}from"../../../widgets/PanoramicViewer/constants.js";import{isNumber as V}from"../../../widgets/support/dataUtils.js";import F from"../../../geometry/SpatialReference.js";import U from"../../../geometry/Polygon.js";function k(e,t){if(!e)return Promise.resolve([]);const a=t.feature;let r=a.attributes;return r instanceof m||(r=m.fromJSON(a),r&&(a.attributes=r)),D(e,t)}function D(e,t){const{attributes:a}=t.feature;if(a.isSpherical||360===a.horizontalFieldOfView){const{location:r,cameraOrientation:i,farDistance:n,cameraHeading:s,cameraHeight:o}=a;return G(e,r,n,[t.imageProperties.width,t.imageProperties.height],s,o,i)}return W(e,t)}async function G(e,t,r,i,s,o,p){let z=new n(t);const m=w(z);z.spatialReference.isGeographic&&z.spatialReference.isWGS84&&4!==p?.type&&(z=x(z));const u=new Array,[h,d,P]=z.toArray(),M=y([h,d,P??0],r/m),j=E.toArray();for(const y of e){let e,t;if(V(y.heading)&&V(y.pitch))e=y.heading,t=y.pitch;else{const a=R({x:y.x,y:y.y},i[0],i[1]);e=a.heading,t=a.pitch}e=(e+s)%360;const r=c([j[0],j[1],j[2]],g(e,t)),x=f([h,d,P??0],r.direction),p=a();l(M,x,p);const w=(z.z??0)-o;if(p[2]<w){const e=Math.abs((z.z-w)/-r.direction[2])*m;b([z.x,z.y,z.z],r.direction,e,m,p)}else p[2]=w;u.push(new n(p,z.spatialReference))}return u}async function W(e,t){const{feature:a}=t,{attributes:r}=a;let i=new n(r.location);if(4===r.cameraOrientation?.type){const e=r.cameraOrientation;i=new n(d(i,[e.latitude,e.longitude,e.ellipsoidRadius,e.squaredEccentricity]))}let c=!1;i.spatialReference.isWGS84&&(c=!0,i=x(i));const f=i.spatialReference.isWebMercator?1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*i.y/6378137))):1,y=A(t,i,f),l=4===r.cameraOrientation?.type?y.map((e=>p(new n(e)))):y,z=await u(l,t,!0),m=await Promise.all(z);m.forEach((e=>{e.z=1}));const w=P(r.horizontalFieldOfView,r.verticalFieldOfView,r.cameraRoll??0).vfov;return Promise.all(e.map((async e=>{e.z=1;let a,y=M(e,m,l);if(a=4===r.cameraOrientation?.type?(await u([p(new n({...y,spatialReference:i.spatialReference}))],t,!0))[0]:(await u([new n({...y,spatialReference:i.spatialReference})],t,!0))[0],!a)return null;let x,z=Math.abs(e.x-a.x)+Math.abs(e.y-a.y);if(z>1){const r=await N(e,a,m,l,i,y,t);y=r.point,z=r.error}if(r.elevationSource){await s(i.spatialReference,t.footprintExtent.spatialReference,null,t.options);let a=await I(t);if(a?.extent){let s=Z(a,i,y);if(!s)return null;const l={x:s.x,y:s.y,z:s.z,hasZ:!0,spatialReference:i.spatialReference},z=new n(l);if(s){const l=o(z,t.footprintExtent.spatialReference),m=h([l],t,!1);let R;R=m instanceof Promise?await m:m,z.z=s.z=R[0].z;const g=await u([4===r.cameraOrientation?.type?p(z):z],t);if(!g[0])return null;let b=Math.abs(e.x-g[0].x)+Math.abs(e.y-g[0].y);if(x=s.z,b>1){let l=0;const z=async m=>{if(b>1){const R=m.width/10,g=m.height/10;if(!m||R<1||g<1)return y=q(y,i,f,x,r.cameraPitch,w,c),y;const d=[{x:s.x-R,y:s.y-g,spatialReference:i.spatialReference},{x:s.x+R,y:s.y-g,spatialReference:i.spatialReference},{x:s.x+R,y:s.y+g,spatialReference:i.spatialReference},{x:s.x-R,y:s.y+g,spatialReference:i.spatialReference}].map((e=>new n(e))),P=await h(d,t,!1);if(a=new U({rings:[[[P[0].x,P[0].y,P[0].z],[P[1].x,P[1].y,P[1].z],[P[2].x,P[2].y,P[2].z],[P[3].x,P[3].y,P[3].z],[P[0].x,P[0].y,P[0].z]]],spatialReference:i.spatialReference}),s=Z(a,i,y),s){const m=o(new n({x:s.x,y:s.y,z:s.z,spatialReference:i.spatialReference}),t.footprintExtent.spatialReference),h=await u([4===r.cameraOrientation?.type?p(m):m],t);if(h[0])return b=Math.abs(e.x-h[0].x)+Math.abs(e.y-h[0].y),x=s.z,b<=1||8===l?q(y,i,f,x,r.cameraPitch,w,c):(l+=1,z(a.extent))}return q(y,i,f,i.z-r.cameraHeight,r.cameraPitch,w,c)}return q(y,i,f,i.z-r.cameraHeight,r.cameraPitch,w,c)};return z(a.extent)}return q(y,i,f,i.z-r.cameraHeight,r.cameraPitch,w,c)}return q(y,i,f,i.z-r.cameraHeight,r.cameraPitch,w,c)}}return q(y,i,f,i.z-r.cameraHeight,r.cameraPitch,w,c)})))}function q(e,a,i,s,o,c,f){const y=Math.sqrt((e.z-a.z)**2+(Math.sqrt((e.x-a.x)**2+(e.y-a.y)**2)/i)**2)*i,l=j(r(t(),[e.x,e.y,e.z],[a.x,a.y,a.z]),1/y,1/i);if(e.z<s||o+c/2<90){const t=Math.abs((a.z-s)/-l[2])*i,r=b([a.x,a.y,a.z],l,t,i);e={x:r[0],y:r[1],z:r[2]}}else e.z=s;return e.spatialReference=a.spatialReference,e=new n(e),f&&(e=p(e)),e}function A(a,s,o){const{feature:c}=a,{attributes:f}=c,y=2*Math.tan(e(f.verticalFieldOfView)/2)*f.farDistance*o,l=2*Math.tan(e(f.horizontalFieldOfView)/2)*f.farDistance*o,x=O("HPR",[f.cameraHeading,f.cameraPitch,f.cameraRoll??0]),p=v([0,0,-1],x),z=b([s.x,s.y,s.z],p,f.farDistance*o,o),m=v([0,1,0],x),u=v([1,0,0],x),h=j(m,y/2,o),w=j(u,l/2,o),R=r(t(),h,w),g=i(t(),h,w);return[i(t(),z,R),i(t(),z,g),r(t(),z,R),r(t(),z,g)].map((e=>{const[t,a,r]=e;return new n({x:t,y:a,z:r,spatialReference:s.spatialReference})}))}function I(e){const{feature:t}=e,{polygon:a}=z(e.feature);if(!a.extent)return Promise.resolve(null);const r=J(a.extent),i=t.attributes.location.spatialReference.isWGS84?new F({wkid:102100}):t.attributes.location.spatialReference;return h(r,e,!1).then((e=>{const t=e.map((e=>o(e,i)));return new U({hasZ:!0,rings:[t.map((e=>[e.x,e.y,e.z]))],spatialReference:i})}))}function J(e){const{xmin:t,xmax:a,ymin:r,ymax:i,spatialReference:s}=e;return[new n({x:t,y:i,spatialReference:s}),new n({x:a,y:i,spatialReference:s}),new n({x:a,y:r,spatialReference:s}),new n({x:t,y:r,spatialReference:s})]}async function N(e,t,a,r,i,s,o){const{feature:{attributes:c}}=o;let f=Math.abs(e.x-t.x)+Math.abs(e.y-t.y);if(f>1)for(let y=0;y<9;y++)if(f>1){let t,l={x:e.x-f,y:e.y-f,z:1},x={x:e.x+f,y:e.y-f,z:1},z={x:e.x+f,y:e.y+f,z:1},m={x:e.x-f,y:e.y+f,z:1};l=H(l,a[0],a[1],a[2],a[3],{x:r[0].x,y:r[0].y,z:r[0].z},{x:r[1].x,y:r[1].y,z:r[1].z},{x:r[2].x,y:r[2].y,z:r[2].z},{x:r[3].x,y:r[3].y,z:r[3].z}),x=H(x,a[0],a[1],a[2],a[3],{x:r[0].x,y:r[0].y,z:r[0].z},{x:r[1].x,y:r[1].y,z:r[1].z},{x:r[2].x,y:r[2].y,z:r[2].z},{x:r[3].x,y:r[3].y,z:r[3].z}),z=H(z,a[0],a[1],a[2],a[3],{x:r[0].x,y:r[0].y,z:r[0].z},{x:r[1].x,y:r[1].y,z:r[1].z},{x:r[2].x,y:r[2].y,z:r[2].z},{x:r[3].x,y:r[3].y,z:r[3].z}),m=H(m,a[0],a[1],a[2],a[3],{x:r[0].x,y:r[0].y,z:r[0].z},{x:r[1].x,y:r[1].y,z:r[1].z},{x:r[2].x,y:r[2].y,z:r[2].z},{x:r[3].x,y:r[3].y,z:r[3].z}),l.spatialReference=i.spatialReference,x.spatialReference=i.spatialReference,z.spatialReference=i.spatialReference,m.spatialReference=i.spatialReference,t=4===c.cameraOrientation?.type?await u([p(new n(l)),p(new n(x)),p(new n(z)),p(new n(m))],o,!0):await u([new n(l),new n(x),new n(z),new n(m)],o,!0);const h=await Promise.all(t);h.forEach((e=>{e.z=0}));const w=H(e,h[0],h[1],h[2],h[3],l,x,z,m);let R;if(R=4===c.cameraOrientation?.type?(await u([p(new n({x:w.x,y:w.y,z:w.z,spatialReference:i.spatialReference}))],o,!0))[0]:(await u([new n({x:w.x,y:w.y,z:w.z,spatialReference:i.spatialReference})],o,!0))[0],f=Math.abs(e.x-R.x)+Math.abs(e.y-R.y),f<=1||8===y){s=w;break}}return{error:f,point:s}}function Z(e,t,a){const r={x:e.rings[0][0][0],y:e.rings[0][0][1],z:e.rings[0][0][2]},i={x:e.rings[0][1][0],y:e.rings[0][1][1],z:e.rings[0][1][2]},n={x:e.rings[0][1][0],y:e.rings[0][1][1],z:e.rings[0][1][2]},s={x:e.rings[0][2][0],y:e.rings[0][2][1],z:e.rings[0][2][2]},o=(s.z-n.z)*(i.y-r.y)-(s.y-n.y)*(i.z-r.z),c=-((s.z-n.z)*(i.x-r.x)-(i.z-r.z)*(s.x-n.x)),f=(s.y-n.y)*(i.x-r.x)-(i.y-r.y)*(s.x-n.x),y=-(o*r.x+c*r.y+f*r.z);return S(t.toJSON(),a,o,c,f,y)}export{k as transformPoints};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../geometry.js";import{deg2rad as e}from"../../../core/mathUtils.js";import{memoize as t}from"../../../core/memoize.js";import{zeros as a}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{
|
|
5
|
+
import"../../../geometry.js";import{deg2rad as e}from"../../../core/mathUtils.js";import{memoize as t}from"../../../core/memoize.js";import{zeros as a}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{z as r,g as o}from"../../../chunks/vec32.js";import{webMercatorToGeographic as i,geographicToWebMercator as n}from"../../../geometry/support/webMercatorUtils.js";import c from"../core/cameraOrientationFactory.js";import{scaleWithFactor as s,scaleAndAddWithFactor as l,projectiveTransform2 as m,ltpToGeographic as f,computeHFOVAndVFOV as p,calculateRotationMatrix as y,transformMat3 as u}from"./utils.js";import{worldToImageWithLTPFlag as g,worldToImage as z,getScalingFactor as h}from"./worldToImage.js";import x from"../../../geometry/Point.js";function d(e,t){const a=Array.isArray(e)?e:[e],{effectiveVerticalFieldOfView:r,imageVertices:o,scalingFactor:i,shouldConvertToLatLong:n,worldFootprint:c,localTangentPlane:s,cameraLocation:l}=L(t),m=new Array;for(const f of a){const e=R(c,o,{...f,z:1},l,t,s);m.push(w(e,l,i,(l.z??0)-t.cameraHeight,t.cameraPitch,r,n))}return 1===m.length?m[0]:m}function w(e,t,o,n,c,m,f){let p=e.clone();const y=Math.sqrt((e.z-t.z)**2+(Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)/o)**2)*o,u=s(r(a(),[e.x,e.y,e.z],[t.x,t.y,t.z]),1/y,1/o);if(e.z<n||c+m/2<90){const a=Math.abs((t.z-n)/-u[2])*o,r=l([t.x,t.y,t.z],u,a,o);p=new x({x:r[0],y:r[1],z:r[2],spatialReference:e.spatialReference})}else p.z=n;return f&&(p=i(e)),p}function R(e,t,a,r,o,i){let n=null;const c=9;let s,l=0,f=e,p=t;for(;l<=c;){const e=F(a,p,f,{...o,cameraLocation:r},a);if(s=e.error,n=e.transformedPoint,s<=1||l===c)break;f=[{x:a.x-s,y:a.y-s,z:1},{x:a.x+s,y:a.y-s,z:1},{x:a.x+s,y:a.y+s,z:1},{x:a.x-s,y:a.y+s,z:1}].map((e=>new x({...m(e,t,f),spatialReference:r.spatialReference}))),p=g(i,f,o),l++}return n}function F(e,t,a,r,o){const{cameraLocation:i}=r,n=new x({...m(e,t,a),spatialReference:i.spatialReference});return{transformedPoint:n,error:O(o,z(n,r))}}function O(e,t){return Math.abs(e.x-t.x)+Math.abs(e.y-t.y)}function L(e){const t="string"==typeof e.cameraOrientation?c.getCameraOrientation(e.cameraOrientation):e.cameraOrientation,a=4===t?.type,r=e.cameraLocation.spatialReference.isWGS84&&a;let o=new x(e.cameraLocation);if(a){const e=t;o=new x(f(o,[e.latitude,e.longitude,e.ellipsoidRadius,e.squaredEccentricity]))}o.spatialReference.isGeographic&&(o=n(o));const i=h(o);o.z||(o.z=e.cameraHeight);const s=j({...e,scalingFactor:i});return{cameraOrientation:t,cameraLocation:o,imageVertices:g(a,s,e),localTangentPlane:a,effectiveVerticalFieldOfView:p(e.horizontalFieldOfView,e.verticalFieldOfView,e.cameraRoll??0).vfov,worldFootprint:s,scalingFactor:i,shouldConvertToLatLong:r}}const j=t((t=>{const{cameraLocation:i,scalingFactor:n}=t,c=2*Math.tan(e(t.verticalFieldOfView)/2)*t.farDistance*n,m=2*Math.tan(e(t.horizontalFieldOfView)/2)*t.farDistance*n,f=y("HPR",[t.cameraHeading,t.cameraPitch,t.cameraRoll??0]),p=u([0,0,-1],f),g=l([i.x,i.y,i.z],p,t.farDistance*n,n),z=u([0,1,0],f),h=u([1,0,0],f),d=s(z,c/2,n),w=s(h,m/2,n),R=r(a(),d,w),F=o(a(),d,w);return[o(a(),g,R),o(a(),g,F),r(a(),g,R),r(a(),g,F)].map((e=>{const[t,a,r]=e;return new x({x:t,y:a,z:r,spatialReference:i.spatialReference})}))}));export{d as imageToWorld};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{id as e}from"../../kernel.js";import t from"../../request.js";function n(e){return
|
|
5
|
+
import{id as e}from"../../kernel.js";import t from"../../request.js";function n(e){return f(e)||o(e)}function r(e){return null!=e&&"object"==typeof e&&"type"in e&&"feature"===e.type}function i(e){return null!=e&&"object"==typeof e&&"type"in e&&"graphics"===e.type}function u(e){return null!=e&&"object"==typeof e&&"type"in e&&"map-notes"===e.type&&"sublayers"in e}function s(e){return null!=e&&"object"==typeof e&&"type"in e&&"knowledge-graph"===e.type&&"layers"in e}function a(e){return null!=e&&"object"==typeof e&&"type"in e&&"link-chart"===e.type&&"layers"in e}function o(e){return"scene"===e?.type}function c(e){return null!=e&&"object"==typeof e&&"type"in e&&"subtype-group"===e.type&&"sublayers"in e}function l(e){return"subtype-sublayer"===e?.type}function f(e){const t=e?.type;return"imagery-tile"===t||"tile"===t||"open-street-map"===t||"vector-tile"===t||"web-tile"===t||"wmts"===t}function y(e){const t=e?.type;return"base-tile"===t||"tile"===t||"elevation"===t||"imagery-tile"===t||"base-elevation"===t||"open-street-map"===t||"wcs"===t||"web-tile"===t||"wmts"===t||"vector-tile"===t}function p(e){return null!=e&&"type"in e&&"group"===e.type}const g={Point:"SceneLayer","3DObject":"SceneLayer",IntegratedMesh:"IntegratedMeshLayer",PointCloud:"PointCloudLayer",Building:"BuildingSceneLayer"};function b(e){const t=e?.type;return"building-scene"===t||"integrated-mesh"===t||"point-cloud"===t||"scene"===t}function d(e){return"IntegratedMeshLayer"===e||"IntegratedMesh3DTilesLayer"===e}function m(e){return"integrated-mesh"===e||"integrated-mesh-3dtiles"===e}function h(e){return"voxel"===e?.type}function v(e){return"imagery-tile"===e?.type}function j(e){return null!=e?.parent&&"declaredClass"in e.parent&&"esri.Basemap"===e.parent.declaredClass&&e.parent.baseLayers.includes(e)}function w(e){return"feature"===e?.type&&!e.url&&"memory"===e.source?.type}function L(e){return("feature"===e?.type||"subtype-group"===e?.type)&&"feature-layer"===e.source?.type}function E(e){return"feature"===e?.type&&"feature-layer"===e.source?.type}function S(e){const t=/[:;]/,n=[];let r=!1;if(e&&(e.forEach(((e,i)=>{n.push([i,e]),!r&&t.test(e)&&(r=!0)})),n.length>0)){let e;if(r){const t={};n.forEach((e=>{t[e[0]]=e[1]})),e=JSON.stringify(t)}else{const t=[];n.forEach((e=>{t.push(e[0]+":"+e[1])})),e=t.join(";")}return e}return null}function C(e){if(!e)return;const t=[];return e.forEach(((e,n)=>{t.push('"'+n+'":'+JSON.stringify(e))})),t.length?"{"+t.join(",")+"}":void 0}function M(e){if(e.activeLayer){const t=e.activeLayer.tileMatrixSet;if(t)return t;const n=e.activeLayer.tileMatrixSets;if(n)return n}return null}async function x(n,r){const i=e?.findServerInfo(n);if(null!=i?.currentVersion)return i.owningSystemUrl||null;const u=n.toLowerCase().indexOf("/rest/services");if(-1===u)return null;const s=`${n.substring(0,u)}/rest/info`,a=null!=r?r.signal:null,{data:o}=await t(s,{query:{f:"json"},responseType:"json",signal:a});return o?.owningSystemUrl||null}function I(e){if(!("capabilities"in e))return!1;switch(e.type){case"catalog":case"csv":case"feature":case"geojson":case"imagery":case"knowledge-graph-sublayer":case"ogc-feature":case"oriented-imagery":case"scene":case"subtype-group":case"subtype-sublayer":case"wfs":return!0;default:return!1}}function k(e){return null!=e&&"object"==typeof e&&"isTable"in e&&!!e.isTable}function O(e){return I(e)?"effectiveCapabilities"in e?e.effectiveCapabilities:e.capabilities:null}function T(e){if(!("editingEnabled"in e))return!1;switch(e.type){case"csv":case"feature":case"geojson":case"oriented-imagery":case"scene":case"subtype-group":case"subtype-sublayer":return!0;default:return!1}}function B(e){return!!T(e)&&("effectiveEditingEnabled"in e?e.effectiveEditingEnabled:e.editingEnabled)}export{B as getEffectiveEditingEnabled,O as getEffectiveLayerCapabilities,x as getOwningPortalUrl,M as getTileMaxtrixSetFromActiveLayer,j as isBaseLayer,n as isBasemap3DSupportedLayer,f as isBasemapSupportedTiledLayer,w as isFeatureCollectionLayer,r as isFeatureLayer,E as isFeatureServiceLayer,i as isGraphicsLayer,p as isGroupLayer,v as isImageryTileLayer,m as isIntegratedMeshLayer,d as isIntegratedMeshOperationalLayer,s as isKnowledgeGraphLayer,L as isLayerWithFeatureLayerSource,a as isLinkChartLayer,u as isMapNotesLayer,o as isSceneLayer,b as isSceneServiceLayer,c as isSubtypeGroupLayer,l as isSubtypeSublayer,k as isTable,y as isTiledLayer,h as isVoxelLayer,g as sceneServiceLayerTypeToClassName,S as serializeLayerDefinitions,C as serializeTimeOptions};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Accessor.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import{fromValues as i,create as a}from"../../core/libs/gl-matrix-2/factories/mat3f64.js";import{fromValues as r,create as l}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{multiply as n,transpose as h}from"../../core/libs/gl-matrix-2/math/mat3.js";import{
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Accessor.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import{fromValues as i,create as a}from"../../core/libs/gl-matrix-2/factories/mat3f64.js";import{fromValues as r,create as l}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{multiply as n,transpose as h}from"../../core/libs/gl-matrix-2/math/mat3.js";import{k as m,r as g,f as u,t as c}from"../../chunks/vec32.js";import p from"../../geometry/Point.js";import d from"../../geometry/SpatialReference.js";import{WGS84ECEFSpatialReference as f}from"../../geometry/spatialReferenceEllipsoidUtils.js";import{projectBuffer as v}from"../../geometry/projection/projectBuffer.js";import{earth as _}from"../../geometry/support/Ellipsoid.js";import{videoMetadataEntryId as A}from"./videoUtils.js";const M=Math.PI/180;let V=class extends e{constructor(t){super(),this.averageElevation=0,this.imageHeight=0,this.imageWidth=0,this.metadataSupportsTransforms=!1,this.platformHeadingAngle=0,this.platformPitchAngle=0,this.platformRollAngle=0,this.sensorHeadingAngle=0,this.sensorAltitude=0,this.sensorHorizontalFieldOfView=0,this.sensorLatitude=0,this.sensorLongitude=0,this.sensorPitchAngle=0,this.sensorRollAngle=0,this.sensorVerticalFieldOfView=0,this.vttMetadata=new Map,this._createMat3FromValues=t=>{const e=t[0],o=t[1],s=t[2];return i(e[0],o[0],s[0],e[1],o[1],s[1],e[2],o[2],s[2])},this._multiplyMat3=(t,e)=>{const o=a();return n(o,t,e),o},this._transposeMat3=t=>{const e=a();return h(e,t),e},this._calculateCameraFovForward=()=>this._createMat3FromValues([[0,0,1],[Math.tan(.5*this.sensorHorizontalFieldOfView*M),0,0],[0,Math.tan(.5*this.sensorVerticalFieldOfView*M),0]]),this._calculateCameraFovReverse=()=>this._createMat3FromValues([[0,1/Math.tan(.5*this.sensorHorizontalFieldOfView*M),0],[0,0,1/Math.tan(.5*this.sensorVerticalFieldOfView*M)],[1,0,0]]),this._calculateCameraLook=()=>this._getRotationMatrixZYX(this.sensorHeadingAngle*M,this.sensorPitchAngle*M,this.sensorRollAngle*M),this._calculateImageDimensionsForward=()=>this._createMat3FromValues([[2/this.imageWidth,0,-1],[0,-2/this.imageHeight,-1],[0,0,1]]),this._calculateImageDimensionsReverse=()=>this._createMat3FromValues([[this.imageWidth/2,0,this.imageWidth/2],[0,-this.imageHeight/2,-this.imageHeight/2],[0,0,1]]),this._calculatePlatformPositionMatrix=()=>{const t=Math.sin(this.sensorLatitude*M),e=Math.cos(this.sensorLatitude*M),o=Math.sin(this.sensorLongitude*M),s=Math.cos(this.sensorLongitude*M);return this._createMat3FromValues([[-t*s,-o,-e*s],[-t*o,s,-e*o],[e,0,-t]])},this._calculatePlatformOrientation=()=>this._getRotationMatrixZYX(this.platformHeadingAngle*M,this.platformPitchAngle*M,this.platformRollAngle*M),this._extractValues=t=>{this.imageWidth=t.get(A.EsriVideoWidth)?.value,this.imageHeight=t.get(A.EsriVideoHeight)?.value;const e=t.get(A.SensorEllipsoidHeight)?.value;this.sensorAltitude=e??t.get(A.SensorTrueAltitude)?.value,this.sensorLatitude=t.get(A.SensorLatitude)?.value,this.sensorLongitude=t.get(A.SensorLongitude)?.value,this.sensorHeadingAngle=t.get(A.SensorAzimuthAngle)?.value,this.sensorPitchAngle=t.get(A.SensorElevationAngle)?.value,this.sensorRollAngle=t.get(A.SensorRollAngle)?.value,this.sensorHorizontalFieldOfView=t.get(A.SensorHorizontalFOV)?.value,this.sensorVerticalFieldOfView=t.get(A.SensorVerticalFOV)?.value,this.platformHeadingAngle=t.get(A.PlatformHeadingAngle)?.value,this.platformPitchAngle=t.get(A.PlatformPitchAngle)?.value,this.platformRollAngle=t.get(A.PlatformRollAngle)?.value,this.averageElevation=t.get(A.FrameCenterElevation)?.value||0},this._getRotationMatrixZYX=(t,e,o)=>{const s=Math.cos(t),i=Math.sin(t),a=Math.cos(e),r=Math.sin(e),l=Math.cos(o),n=Math.sin(o);return this._createMat3FromValues([[s*a,s*r*n-l*i,i*n+s*l*r],[a*i,s*l+i*r*n,l*i*r-s*n],[-r,a*n,a*l]])},this._initCameraSensor=()=>{const t=this._calculateCameraFovForward(),e=this._calculateCameraFovReverse(),o=this._calculateCameraLook(),s=this._calculateImageDimensionsForward(),i=this._calculateImageDimensionsReverse(),a=this._calculatePlatformPositionMatrix(),r=this._calculatePlatformOrientation(),l=this._multiplyMat3(this._multiplyMat3(a,r),o);this._imageToEarthTransform=this._multiplyMat3(this._multiplyMat3(l,t),s);const n=this._multiplyMat3(i,e);this._earthToImageTransform=this._multiplyMat3(n,this._transposeMat3(l)),this._platformPositionEcef=this._projectPointToECEF(this.sensorLongitude,this.sensorLatitude,this.sensorAltitude||this.averageElevation)},this._metadataSupportsTransforms=t=>{if(!t?.size)return!1;const e=t.get(A.EsriVideoWidth)?.value??0,o=t.get(A.EsriVideoHeight)?.value??0;if(e<=0||o<=0)return!1;const s=t.get(A.SensorEllipsoidHeight)?.value,i=t.get(A.SensorTrueAltitude)?.value,a=t.get(A.SensorLatitude)?.value,r=t.get(A.SensorLongitude)?.value;if(null==s&&null==i||null==a||null==r)return!1;const l=t.get(A.PlatformHeadingAngle)?.value,n=t.get(A.PlatformPitchAngle)?.value,h=t.get(A.PlatformRollAngle)?.value;if(null==l||null==n||null==h)return!1;const m=t.get(A.SensorHorizontalFOV)?.value,g=t.get(A.SensorVerticalFOV)?.value;if(null==m||null==g)return!1;const u=t.get(A.SensorAzimuthAngle)?.value,c=t.get(A.SensorElevationAngle)?.value,p=t.get(A.SensorRollAngle)?.value;return null!=u&&null!=c&&null!=p},this._projectPointToECEF=(t,e,o)=>{const s=[];return v([t,e,o],d.WGS84,0,s,f,0,1),new p({x:s[0],y:s[1],z:s[2],spatialReference:f})},this._projectImageVectorToEllipsoid=(t,e)=>{const o=_.semiMajorAxis+e,s=_.semiMinorAxis+e,i=s/o,a=o/s,{x:n,y:h,z:u}=this._platformPositionEcef,c=u??this.averageElevation,p=r(n,h,a*c),d=m(t,t),f=m(t,p),v=m(p,p)-o*o,A=(-f-Math.sqrt(f*f-d*v))/d;if(A<0)return[NaN,NaN,NaN];const M=l();return g(M,p,t,A),M[2]=M[2]*i,M};const e=t?.videoMetadata;this._set("metadataSupportsTransforms",this._metadataSupportsTransforms(e)),this.metadataSupportsTransforms&&(this._extractValues(e),this._initCameraSensor())}transformGeoToImage(t,e,o){const s=this._platformPositionEcef;if(!s)return[0,0];const{x:i,y:a,z:n}=s,h=r(i,a,n),m=this._projectPointToECEF(t,e,o||this.averageElevation),g=l(),p=r(m.x,m.y,m.z);u(g,p,h),c(g,g,this._earthToImageTransform);const d=g[0],f=g[1],v=g[2];let _=r(NaN,NaN,NaN);return isNaN(v)||(_=r(d/v,f/v,v/v)),[_[0],_[1]]}transformImageToGeo(t,e){const o=r(t,e,1),s=l();c(s,o,this._imageToEarthTransform);const i=this._projectImageVectorToEllipsoid(s,this.averageElevation);let a;if(!isNaN(i[0])){const t=[];v([i[0],i[1],i[2]],f,0,t,d.WGS84,0,1),a=new p({x:t[0],y:t[1],z:t[2],spatialReference:d.WGS84})}return a}};t([o()],V.prototype,"averageElevation",void 0),t([o()],V.prototype,"imageHeight",void 0),t([o()],V.prototype,"imageWidth",void 0),t([o({readOnly:!0})],V.prototype,"metadataSupportsTransforms",void 0),t([o()],V.prototype,"platformHeadingAngle",void 0),t([o()],V.prototype,"platformPitchAngle",void 0),t([o()],V.prototype,"platformRollAngle",void 0),t([o()],V.prototype,"sensorHeadingAngle",void 0),t([o()],V.prototype,"sensorAltitude",void 0),t([o()],V.prototype,"sensorHorizontalFieldOfView",void 0),t([o()],V.prototype,"sensorLatitude",void 0),t([o()],V.prototype,"sensorLongitude",void 0),t([o()],V.prototype,"sensorPitchAngle",void 0),t([o()],V.prototype,"sensorRollAngle",void 0),t([o()],V.prototype,"sensorVerticalFieldOfView",void 0),t([o()],V.prototype,"vttMetadata",void 0),V=t([s("esri.layers.video.VideoCameraSensorModel")],V);const y=V;export{y as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import{JSONSupport as i}from"../../core/JSONSupport.js";import s from"../../core/Logger.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as t}from"../../core/accessorSupport/decorators/subclass.js";import{f as n,
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import{JSONSupport as i}from"../../core/JSONSupport.js";import s from"../../core/Logger.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as t}from"../../core/accessorSupport/decorators/subclass.js";import{f as n,H as o,B as a,g as l}from"../../chunks/vec32.js";import{fromValues as p,fromArray as u}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import m from"../../geometry/Point.js";import c from"../../geometry/SpatialReference.js";import{equals as h}from"../../geometry/support/spatialReferenceUtils.js";import g from"./VoxelDimension.js";let d=class extends i{constructor(e){super(e),this.id=0,this.dimensions=null,this.spatialReference=c.WGS84}get zDimension(){if(!this.dimensions)return-1;if(!Array.isArray(this.dimensions))return-1;if(4!==this.dimensions.length)return-1;for(let e=2;e<4;++e)if(this.dimensions[e].size>0)return e;return-1}get isValid(){return!!this.dimensions&&(!!Array.isArray(this.dimensions)&&(4===this.dimensions.length&&(!(this.dimensions[0].size<1||this.dimensions[1].size<1)&&!(-1===this.zDimension||this.dimensions[this.zDimension].size<1))))}get originInLayerSpace3D(){if(!this.isValid||"xyt"===this.volumeType)return[0,0,0];const e=this.dimensions[0].getRange(),i=this.dimensions[1].getRange(),s=this.dimensions[2],r=s.isRegular?s.getRange():[0,s.size];return[e[0],i[0],r[0]]}get voxelSizeInLayerSpaceSigned(){if(!this.isValid||"xyt"===this.volumeType)return[0,0,0];const e=this.dimensions[0].getRange(),i=this.dimensions[1].getRange(),s=this.dimensions[2],r=s.isRegular?s.getRange():[0,s.size],t=[this.sizeInVoxels[0],this.sizeInVoxels[1],this.sizeInVoxels[2]];for(let n=0;n<3;++n)t[n]<2?t[n]=1:t[n]-=1;return s.isRegular&&!s.isPositiveUp&&(t[2]*=-1),[(e[1]-e[0])/t[0],(i[1]-i[0])/t[1],(r[1]-r[0])/t[2]]}get volumeType(){if(this.isValid){const e=this.dimensions[2].size>0,i=this.dimensions[3].size>0;if(!e&&i)return"xyt";if(e&&i)return"xyzt"}return"xyz"}get sizeInVoxels(){if(!this.isValid)return[0,0,0];const e=this.zDimension;return[this.dimensions[0].size,this.dimensions[1].size,this.dimensions[e].size]}computeVoxelSpaceLocation(e){if(!this.isValid)return[0,0,0];if("xyt"===this.volumeType)return s.getLogger(this).error("computeVoxelSpacePosition cannot be used with XYT volumes."),[0,0,0];if(!h(this.spatialReference,e.spatialReference))return s.getLogger(this).error("pos argument should have the same spatial reference as the VoxelLayer."),[0,0,0];const i=p(e.x,e.y,e.z??0);n(i,i,this.originInLayerSpace3D),o(i,i,this.voxelSizeInLayerSpaceSigned);const r=this.dimensions[this.zDimension];if(!r.isRegular&&Array.isArray(r.irregularSpacing?.values)&&r.irregularSpacing.values.length>1){const s=e.z??0,t=r.irregularSpacing.values,n=r.isPositiveUp?1:-1,o=t.reduce(((e,i)=>Math.abs(n*i-s)<Math.abs(n*e-s)?i:e));for(let e=0;e<t.length;++e)if(t[e]===o){i[2]=e;break}}return[i[0],i[1],i[2]]}computeLayerSpaceLocation(e){if(!this.isValid)return new m({x:0,y:0,spatialReference:this.spatialReference});const i=u(e);if(a(i,i,this.voxelSizeInLayerSpaceSigned),l(i,i,this.originInLayerSpace3D),"xyt"===this.volumeType)return new m({x:i[0],y:i[1],spatialReference:this.spatialReference});const s=this.dimensions[this.zDimension];return s.isRegular||Array.isArray(s.irregularSpacing?.values)&&(e[2]<0?i[2]=s.irregularSpacing.values[0]:e[2]<s.irregularSpacing.values.length?i[2]=s.irregularSpacing.values[e[2]]:i[2]=s.irregularSpacing.values[s.irregularSpacing.values.length-1],s.isPositiveUp||(i[2]*=-1)),new m({x:i[0],y:i[1],z:i[2],spatialReference:this.spatialReference})}};e([r({type:Number,json:{write:{enabled:!0,isRequired:!0}}})],d.prototype,"id",void 0),e([r({type:[g],json:{write:{enabled:!0,isRequired:!0}}})],d.prototype,"dimensions",void 0),e([r({type:c,json:{read:{enabled:!1}}})],d.prototype,"spatialReference",void 0),e([r({type:Number,json:{read:!1}})],d.prototype,"zDimension",null),e([r({type:[Boolean],json:{read:!1}})],d.prototype,"isValid",null),e([r({type:[Number],json:{read:!1}})],d.prototype,"originInLayerSpace3D",null),e([r({type:[Number],json:{read:!1}})],d.prototype,"voxelSizeInLayerSpaceSigned",null),e([r({type:["xyz","xyzt","xyt"],json:{read:{enabled:!1}}})],d.prototype,"volumeType",null),e([r({type:[Number],json:{read:!1}})],d.prototype,"sizeInVoxels",null),d=e([t("esri.layers.voxel.VoxelVolume")],d);const y=d;export{y as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{setAxisAngle as t,multiply as r}from"../../core/libs/gl-matrix-2/math/quat.js";import{create as o}from"../../core/libs/gl-matrix-2/factories/quatf64.js";import{create as a,fromValues as s}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{toDegree as m,toRadian as c}from"../../core/libs/gl-matrix-2/math/common.js";import{c as i,n,
|
|
5
|
+
import{setAxisAngle as t,multiply as r}from"../../core/libs/gl-matrix-2/math/quat.js";import{create as o}from"../../core/libs/gl-matrix-2/factories/quatf64.js";import{create as a,fromValues as s}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{toDegree as m,toRadian as c}from"../../core/libs/gl-matrix-2/math/common.js";import{c as i,n,u as e}from"../../chunks/vec32.js";const f=a(),l=o(),u=o(),p=o(),h=s(0,0,1),j=s(0,1,0),x=s(1,0,0);function b(r){i(f,r),n(f,f);const a=Math.atan2(f[1],f[0]),s=t(o(),h,-a);e(f,f,s);const c=-1*Math.atan2(f[2],f[0]);return[m(a)+270,m(c)+90]}function g(o,a){return t(u,h,c(o-270)),t(p,j,c(a-90)),r(l,u,p),i(f,x),e(f,f,l),n(f,f),[f[0],f[1],f[2]]}export{g as computeNormalFromOrientationTilt,b as computeOrientationTiltFromNormal};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{getAssetUrl as t}from"../../assets.js";let e,r=null;function a(){return!!r}function n(){return e||(e=import("../../chunks/lclayout.js").then((t=>t.l)).then((({default:e})=>e({locateFile:e=>t(`esri/libs/linkchartlayout/${e}`)}))).then((t=>{s(t)})),e)}function s(t){r=t}var u,o;function y(t,e,a,n,s,u){const o=a.length,y=s.length,i=Float64Array.BYTES_PER_ELEMENT,l=Uint32Array.BYTES_PER_ELEMENT,c=Uint8Array.BYTES_PER_ELEMENT,E=16,p=E-1+o*(c+2*i)+y*(2*l),f=r._malloc(p);try{const c=f+E-f%E,p=c+o*i,
|
|
5
|
+
import{getAssetUrl as t}from"../../assets.js";let e,r=null;function a(){return!!r}function n(){return e||(e=import("../../chunks/lclayout.js").then((t=>t.l)).then((({default:e})=>e({locateFile:e=>t(`esri/libs/linkchartlayout/${e}`)}))).then((t=>{s(t)})),e)}function s(t){r=t}var u,o;function y(t,e,a,n,s,u){const o=a.length,y=s.length,i=Float64Array.BYTES_PER_ELEMENT,l=Uint32Array.BYTES_PER_ELEMENT,c=Uint8Array.BYTES_PER_ELEMENT,E=16,p=E-1+o*(c+2*i)+y*(2*l),f=r._malloc(p);try{const c=f+E-f%E,p=c+o*i,A=p+o*i,b=A+y*l,P=b+y*l,L=()=>[r.HEAPF64.subarray(c>>3,(c>>3)+o),r.HEAPF64.subarray(p>>3,(p>>3)+o),r.HEAPU32.subarray(A>>2,(A>>2)+y),r.HEAPU32.subarray(b>>2,(b>>2)+y),r.HEAPU8.subarray(P,P+o)],[d,C,H,_,g]=L();d.set(a),C.set(n),H.set(s),_.set(u),g.set(e);let F=t(o,P,c,p,y,A,b),R=null;if(F){const t=r.getLayoutLinksTypes(),e=r.getLayoutLinksVerticesEndIndices(),a=r.getLayoutLinksVertices(),n=r.countLayoutLinksVertices();!y||t&&e?n&&!a?F=!1:R={types:new Uint8Array(r.HEAPU8.subarray(t,t+y)),vertexEndIndex:new Uint32Array(r.HEAPU32.subarray(e>>2,(e>>2)+y)),vertices:new Float64Array(r.HEAPF64.subarray(a>>3,(a>>3)+2*n))}:F=!1}const[h,U,m,B,T]=L();return a.set(h),n.set(U),s.set(m),u.set(B),e.set(T),{success:F,links:R}}finally{r._free(f),r.cleanupLayout()}}!function(t){t[t.None=0]="None",t[t.IsMovable=1]="IsMovable",t[t.IsGeographic=2]="IsGeographic",t[t.IsRoot=4]="IsRoot"}(u||(u={})),function(t){t[t.Regular=0]="Regular",t[t.Orthogonal=1]="Orthogonal",t[t.Curved=2]="Curved",t[t.Recursive=3]="Recursive"}(o||(o={}));const i=2,l=1,c=-1;var E,p,f,A,b,P,L,d;function C(t,e,a,n,s,u,o,y,i,l,c,E,p,f,A){const b=e.length,P=Float64Array.BYTES_PER_ELEMENT,L=Uint32Array.BYTES_PER_ELEMENT,d=16,C=d-1+t*(8*P)+b*(3*L),H=r._malloc(C);try{const C=H+d-H%d,_=C+t*P,g=_+t*P,F=g+t*P,R=F+t*P,h=R+t*P,U=h+t*P,m=U+t*P,B=m+t*P,T=B+b*L,v=T+b*L,N=()=>[r.HEAPF64.subarray(C>>3,(C>>3)+t),r.HEAPF64.subarray(_>>3,(_>>3)+t),r.HEAPF64.subarray(g>>3,(g>>3)+t),r.HEAPF64.subarray(F>>3,(F>>3)+t),r.HEAPF64.subarray(R>>3,(R>>3)+t),r.HEAPF64.subarray(h>>3,(h>>3)+t),r.HEAPF64.subarray(U>>3,(U>>3)+t),r.HEAPF64.subarray(m>>3,(m>>3)+t),r.HEAPU32.subarray(B>>2,(B>>2)+b),r.HEAPU32.subarray(T>>2,(T>>2)+b),r.HEAPU32.subarray(v>>2,(v>>2)+b)],[I,M,k,S,w,Y,z,G,x,D,V]=N();I.set(y),M.set(i),k.set(l),S.set(c),w.set(E),Y.set(p),z.set(f),G.set(A),x.set(e),D.set(a),V.set(n);const j=r.computeCentrality(t,b,B,T,v,s,u,o,C,_,g,F,R,h,U,m),[O,$,q,J,K,Q,W,X,Z,tt,et]=N();return y.set(O),i.set($),l.set(q),c.set(J),E.set(K),p.set(Q),f.set(W),A.set(X),e.set(Z),a.set(tt),n.set(et),j}finally{r._free(H)}}!function(t){function e(){return r.getMinIdealEdgeLength()}function a(t,e,a,n,s,u=i,o=l,E=c){return y(((t,e,a,n,s,y,i)=>r.applyForceDirectedLayout(t,e,a,n,s,y,i,u,o,E)),t,e,a,n,s)}t.getMinIdealEdgeLength=e,t.apply=a}(E||(E={})),function(t){function e(t,e,a,n,s,u=i,o=l,E=c){return y(((t,e,a,n,s,y,i)=>r.applyCommunityLayout(t,e,a,n,s,y,i,u,o,E)),t,e,a,n,s)}t.apply=e}(p||(p={})),function(t){function e(t,e,a,n,s){return y(r.applySimpleLayout,t,e,a,n,s)}t.apply=e}(f||(f={})),function(t){function e(t,e,a,n,s){return y(r.applyHierarchicalLayout,t,e,a,n,s)}t.apply=e}(A||(A={})),function(t){function e(t,e,a,n,s){return y(r.applyRadialTreeLayout,t,e,a,n,s)}t.apply=e}(b||(b={})),function(t){function e(t,e,a,n,s){return y(r.applySmartTreeLayout,t,e,a,n,s)}t.apply=e}(P||(P={})),function(t){t[t.Undirected=0]="Undirected",t[t.Directed=1]="Directed",t[t.Reversed=2]="Reversed"}(L||(L={})),function(t){t[t.ByCC_Raw=0]="ByCC_Raw",t[t.ByCC_NormalizeGlobally=1]="ByCC_NormalizeGlobally",t[t.ByCC_NormalizeByCC=2]="ByCC_NormalizeByCC"}(d||(d={}));export{d as CentralityMode,p as LCCommunityLayout,E as LCForceDirectedLayout,A as LCHierarchicalLayout,b as LCRadialTreeLayout,f as LCSimpleLayout,P as LCSmartTreeLayout,o as LinkType,u as NodeFlag,L as RelationshipInterpretation,r as _lclib,C as computeCentrality,i as defaultBudgetTheoreticalSeconds,l as defaultIdealEdgeLengthMultiplier,c as defaultRepulsionRadiusMultiplier,a as isLoaded,n as load};
|
package/package.json
CHANGED
package/support/revision.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const e="
|
|
5
|
+
const e="20240229",a="00ade7b36e0f44f31f2bdbcfaaa3c49de1a6ee4e";export{e as buildDate,a as commitHash};
|