@arcgis/core 4.29.0 → 4.29.1
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/58723274ef657fe212eb.js +1 -0
- 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/7a8bba91769ee18cc39f.js +1 -0
- package/assets/esri/core/workers/chunks/7a98d2e026f63a581b1e.js +1 -0
- package/assets/esri/core/workers/chunks/8c360923cd1850767d3e.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/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 +6 -6
- 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/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/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/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/layerAdapters/CatalogFootprintLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/InMemoryLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/KnowledgeGraphSublayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/OGCFeatureLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/OrientedImageryLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/StreamLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/SubtypeGroupLayerAdapter.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/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/FeatureMetadata.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/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/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{getMetersPerCartesianUnitForSR as t,convertUnit as n}from"../../../core/unitUtils.js";import{create as e}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{equals as r,multiply as o,invert as i,scale as a}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as l,create as s}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{
|
|
5
|
+
import{getMetersPerCartesianUnitForSR as t,convertUnit as n}from"../../../core/unitUtils.js";import{create as e}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{equals as r,multiply as o,invert as i,scale as a}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as l,create as s}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{j as c}from"../../../chunks/vec32.js";import{ZEROS as u}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{normalFromMat4 as f}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{canProjectWithoutEngine as p}from"../../projection.js";import{getSphericalPCPF as m}from"../../spatialReferenceEllipsoidUtils.js";import{computeTranslationToOriginAndRotation as g}from"../../projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as h}from"../../projection/projectBuffer.js";import{newDoubleArray as j,copyInto as x}from"../DoubleArray.js";import y from"../MeshTransform.js";import{isRelativeVertexSpace as A,vertexSpaceOriginToPoint as w,selectVertexSpace as R}from"../meshVertexSpaceUtils.js";import{a as F,t as b,b as v}from"../../../chunks/vec3.js";import{isGlobal as S,usesLocalTangentPlaneOnECEF as d}from"./geographicUtils.js";import{transformNormal as M,transformTangent as z,projectFromPCPF as U,projectNormalFromPCPF as T,projectTangentFromPCPF as k,projectToPCPF as q,projectNormalToPCPF as B,projectTangentToPCPF as D}from"./projection.js";function E(t,n,e){return S(n.spatialReference,e?.geographic)?I(t,n,!1,e):H(t,n,e)}function O(t,n=l){const{position:e,normal:r,tangent:o}=t;return{position:F(new Float64Array(e.length),e,n),normal:null!=r?M(r,new Float32Array(r.length),n):null,tangent:null!=o?z(o,new Float32Array(o.length),n):null}}function P(t,n,e,r){const{position:o,normal:i,tangent:a}=t;if(!A(n))return{position:o,normal:i,tangent:a};const l=w(n,r);return E(O(t,e?.localMatrix),l,{geographic:"local"===n.type})}function V(t,n,e){const r=R(n,e),o=n.spatialReference,i=A(r);if(!i)return{vertexAttributes:E(t,n,e),vertexSpace:r,transform:null};const{position:a,normal:l,tangent:s}=t,c=d(r,o);switch(r.type){case"georeferenced":return c?{vertexAttributes:I(t,n,i,e),vertexSpace:r,transform:null}:{vertexAttributes:{position:a,normal:l,tangent:s},vertexSpace:r,transform:new y};case"local":return{vertexAttributes:{position:a,normal:l,tangent:s},vertexSpace:r,transform:new y}}}function W(t,n,e){return S(n.spatialReference,e?.geographic)?Q(t,n,e):N(t,n,e)}function C(t,n,e,r,o){if(!A(n))return W(t,r,o);const{spatialReference:i}=r,a=P(t,n,e,i);return r.equals(w(n,i))?N(a,r,o):W(a,r,o)}function G({positions:t,transform:n,vertexSpace:e,inSpatialReference:i,outSpatialReference:a,outPositions:s,localMode:f}){const y=e.origin??u,A=null!=e.origin?n?.localMatrix??l:l;if("georeferenced"===e.type){const n=s??j(t.length);if(r(A,l)?x(n,t):F(n,t,A),!c(y,u)){const[t,e,r]=y;for(let o=0;o<n.length;o+=3)n[o]+=t,n[o+1]+=e,n[o+2]+=r}return h(n,i,0,n,a,0,n.length/3),n}let w=i;const R=m(i);w=a.isWebMercator&&f||!p(i,R)?w:R,g(i,y,tt,w),o(tt,tt,A);const b=s??j(t.length);return F(b,t,tt),h(b,w,0,b,a,0,b.length/3),b}function H(t,n,e){const r=new Float64Array(t.position.length),o=t.position,i=n.x,a=n.y,l=n.z??0,s=_(e?e.unit:null,n.spatialReference);for(let c=0;c<o.length;c+=3)r[c]=o[c]*s+i,r[c+1]=o[c+1]*s+a,r[c+2]=o[c+2]*s+l;return{position:r,normal:t.normal,tangent:t.tangent}}function I(t,n,e,r){const o=n.spatialReference,i=X(n,r,tt),a=new Float64Array(t.position.length),l=J(t.position,i,o,a),s=f(et,i),c=K(l,a,t.normal,s,o),u=L(l,a,t.tangent,s,o);if(e){const{x:t,y:e,z:r}=n;b(l,l,[-t,-e,-(r??0)])}return{position:l,normal:c,tangent:u}}function J(t,n,e,r){F(r,t,n);const o=new Float64Array(t.length);return U(r,o,e)}function K(t,n,e,r,o){if(null==e)return null;const i=new Float32Array(e.length);return v(i,e,r),T(i,t,n,o,i),i}function L(t,n,e,r,o){if(null==e)return null;const i=new Float32Array(e.length);v(i,e,r,4);for(let a=3;a<i.length;a+=4)i[a]=e[a];return k(i,t,n,o,i),i}function N(t,n,e){const r=new Float64Array(t.position.length),o=t.position,i=n.x,a=n.y,l=n.z??0,s=_(e?e.unit:null,n.spatialReference);for(let c=0;c<o.length;c+=3)r[c]=(o[c]-i)/s,r[c+1]=(o[c+1]-a)/s,r[c+2]=(o[c+2]-l)/s;return{position:r,normal:t.normal,tangent:t.tangent}}function Q(t,n,e){const r=n.spatialReference;X(n,e,tt);const o=i(nt,tt),a=new Float64Array(t.position.length),l=Y(t.position,r,o,a),s=f(et,o);return{position:l,normal:Z(t.normal,t.position,a,r,s),tangent:$(t.tangent,t.position,a,r,s)}}function X(t,n,e){g(t.spatialReference,[t.x,t.y,t.z??0],e,m(t.spatialReference));const r=_(n?n.unit:null,t.spatialReference);return a(e,e,[r,r,r]),e}function Y(t,n,e,r){const o=q(t,n,r),i=new Float64Array(o.length);return F(i,o,e),i}function Z(t,n,e,r,o){if(null==t)return null;const i=B(t,n,e,r,new Float32Array(t.length));return v(i,i,o),i}function $(t,n,e,r,o){if(null==t)return null;const i=D(t,n,e,r,new Float32Array(t.length));return v(i,i,o,4),i}function _(e,r){if(null==e)return 1;const o=t(r);return 1/n(o,"meters",e)}const tt=s(),nt=s(),et=e();export{O as applyTransform,E as georeference,P as georeferenceApplyTransform,V as georeferenceByTransform,I as georeferenceGlobal,_ as getUnitScale,G as project,W as ungeoreference,C as ungeoreferenceByTransform,Q as ungeoreferenceGlobal};
|
|
@@ -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 e from"../../../core/Logger.js";import{
|
|
5
|
+
import e from"../../../core/Logger.js";import{G as t,g as r,h as n}from"../../../chunks/vec32.js";import{create as o}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import s from"../MeshComponent.js";import i from"../MeshTransform.js";import{MeshVertexAttributes as l}from"../MeshVertexAttributes.js";import{vertexSpaceOriginToPoint as a}from"../meshVertexSpaceUtils.js";import{georeferenceApplyTransform as c,ungeoreference as f}from"./georeference.js";const u=()=>e.getLogger("esri.geometry.support.triangleMeshMerge");function p(e,t){if(0===e.length)return u().error("merge()","Must specify one more geometries to merge"),null;const r=e[0].spatialReference;for(const c of e){if(!c.spatialReference.equals(r))return u().error("merge()","Geometries must all be in the same spatial reference"),null;if(!c.loaded)return u().error("merge()","Geometries must all be loaded before merging"),null}const n=m(e);if(null==n)return null;const o=y(e),s=[],i={position:0,uv:0,normal:0,tangent:0,color:0},l=new Map,a=new Map;for(const c of e){const e=g(c,n);if(t&&t.reuseMaterials&&c.components)for(const t of c.components)t.material&&l.set(t.material,t.material);x(c,i,l,a,s),b("position",e,o,i,0),b("normal",e,o,i,0),b("tangent",e,o,i,0),b("uv",c.vertexAttributes,o,i,0),b("color",c.vertexAttributes,o,i,255)}return{vertexAttributes:o,components:s,vertexSpace:n.vertexSpace,transform:n.transform,spatialReference:r}}function m(e){let s=null,l=null,a=!0,c=!0,f=null;const p=o();let m=0;for(const n of e){const{vertexSpace:e,transform:o}=n;if(null==l){l=e;const t=l.origin;t&&(f=t)}if(l.type!==e.type)return u().error("merge()",`Inconsistent mesh vertex space for provided geometries. One was ${l.type} while another is ${e.type}. Unable to merge geometries.`),null;null==s||null!=o&&o.equals(s)||(a=!1),null!=o&&null==s&&(s=o);const i=e.origin;i&&(f&&!t(i,f)&&(c=!1),m++,r(p,p,i))}if(null==l)throw new Error;const g=l.clone();if(null==g.origin)return{transform:null,vertexSpace:g,rebake:!1};if(c&&a)return{transform:s?.clone(),vertexSpace:g,rebake:!1};const h=n(p,p,1/m);return g.origin=h,{transform:new i,vertexSpace:g,rebake:!0}}function g(e,t){if(!t.rebake)return e.vertexAttributes;const r=e.vertexSpace,n=t.vertexSpace;if(r.type!==n.type)throw new Error;const o=c(e.vertexAttributes,r,e.transform,e.spatialReference),s="local"===n.type;return f(o,a(n,e.spatialReference),{geographic:s})}function h(e,t){return t.normal>0&&!e.vertexAttributes.normal}function v(e,t,r){h(e,t)&&"source"===r.shading&&(r.shading="flat")}function x(e,t,r,n,o){if(e.components)for(const s of e.components){const i=s.cloneWithDeduplication(r,n),l=t.position/3;if(i.faces)for(let e=0;e<i.faces.length;e++)i.faces[e]+=l;else{i.faces=new Uint32Array(e.vertexAttributes.position.length/3);for(let e=0;e<i.faces.length;e++)i.faces[e]=e+l}v(e,t,i),o.push(i)}else if(e.vertexAttributes&&e.vertexAttributes.position){const r=e.vertexAttributes.position.length/3,n=new Uint32Array(r),i=t.position/3;for(let e=0;e<r;e++)n[e]=e+i;const l=new s({faces:n});v(e,t,l),o.push(l)}}function b(e,t,r,n,o){if(!t)return;const s=t.position;if(!s)return;const i=t[e],l=r[e];if(null==i){let t=n[e];const r=d[e];if(null!=l){for(let e=0;e<s.length;e+=3)for(let n=0;n<r;n++)l[t++]=o;n[e]=t}}else null!=l&&null!=i&&(A(i,0,l,n[e],i.length),n[e]+=i.length)}function A(e,t,r,n,o){for(let s=0;s<o;s++)r[n++]=e[t++];return r}function w(e){let t=!1,r=!1,n=!1,o=!1;for(const s of e){const e=s.vertexAttributes;if(e?.position&&(e.uv&&(t=!0),e.normal&&(r=!0),e.tangent&&(o=!0),e.color&&(n=!0),r&&t&&n&&o))break}return{normal:r,uv:t,color:n,tangent:o}}function y(e){let t=0,r=0,n=0,o=0,s=0;const i=w(e);for(const l of e){const e=l.vertexAttributes;e?.position&&(t+=e.position.length,i.uv&&(r+=e.position.length/d.position*d.uv),i.normal&&(n+=e.position.length/d.position*d.normal),i.color&&(o+=e.position.length/d.position*d.color),i.tangent&&(s+=e.position.length/d.position*d.tangent))}return new l({position:new Float64Array(t),uv:r?new Float32Array(r):null,normal:n?new Float32Array(n):null,tangent:s?new Float32Array(s):null,color:o?new Uint8Array(o):null})}const d={position:3,normal:3,tangent:4,uv:2,color:4};export{p as merge};
|
|
@@ -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 e from"../../../core/Logger.js";import{fromMat4 as t}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as r}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{fromRotation as
|
|
5
|
+
import e from"../../../core/Logger.js";import{fromMat4 as t}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as r}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{fromRotationTranslationScaleOrigin as o,multiply as i,getScaling as s,scale as a,getTranslation as n,fromRotation as l}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as c}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{setAxisAngle as m}from"../../../core/libs/gl-matrix-2/math/quat.js";import{create as f}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{s as p,i as g,t as u,e as j}from"../../../chunks/vec32.js";import{ONES as x,ZEROS as b,create as d}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import h from"../../Point.js";import{getSphericalPCPF as v}from"../../spatialReferenceEllipsoidUtils.js";import{computeTranslationToOriginAndRotation as A}from"../../projection/computeTranslationToOriginAndRotation.js";import{projectPointToVector as w}from"../../projection/projectPointToVector.js";import{create as R,angleRad as k,axis as y,fromMatrix as F}from"../axisAngleDegrees.js";import $ from"../MeshTransform.js";import{isMeshWithRelativeVertexSpace as P}from"../meshVertexSpaceUtils.js";import{usesLocalTangentPlaneOnECEFForOperations as S}from"./geographicUtils.js";import{projectToPCPF as T,projectNormalToPCPF as U,projectTangentToPCPF as q,projectFromPCPF as C,projectNormalFromPCPF as L,projectTangentFromPCPF as z}from"./projection.js";import{projectPointToVertexSpace as M}from"./vertexSpaceConversion.js";const V="esri.geometry.support.meshUtils.rotate";function D(e,t,r){if(!e.vertexAttributes?.position||0===t[3])return;const{spatialReference:o,vertexSpace:i}=e,s=r?.origin??e.anchor,a=r?.geographic,n=S(V,i,o,a);P(e)?E(e,t,s):n?O(e,t,s):B(e,t,s)}function E(t,r,l){t.transform??=new $;const{vertexSpace:c,transform:f,spatialReference:u}=t,[j,v,A]=c.origin,w=new h({x:j,y:v,z:A,spatialReference:u}),R=H;if(w.equals(l))p(R,0,0,0);else if(!M(R,l,t))return void e.getLogger(V).error(`Failed to project specified origin (wkid:${l.spatialReference.wkid}) to mesh (wkid:${u.wkid}) ${c.type} vertex space. Projection may be possible after calling projection.load().`);m(W,y(r),k(r));const P=o(I,W,b,x,R),{localMatrix:S}=f,T=i(I,P,S);f.scale=s(d(),T),a(T,T,g(H,f.scale)),f.rotation=F(T),f.translation=n(d(),T)}function O(e,r,o){const i=e.spatialReference,s=v(i),a=Q;w(o,a,s)||w(e.origin,a,s);const n=e.vertexAttributes.position,l=e.vertexAttributes.normal,c=e.vertexAttributes.tangent,m=new Float64Array(n.length),f=null!=l?new Float32Array(l.length):null,p=null!=c?new Float32Array(c.length):null;A(s,a,K,s),t(N,K);const g=J;u(y(J),y(r),N),g[3]=r[3],T(n,i,m),null!=l&&null!=f&&U(l,n,m,i,f),null!=c&&null!=p&&q(c,n,m,i,p),G(m,g,3,a),C(m,n,i),null!=l&&null!=f&&(G(f,g,3),L(f,n,m,i,l)),null!=c&&null!=p&&(G(p,g,4),z(p,n,m,i,c)),e.vertexAttributesChanged()}function B(t,r,o){const i=Q;if(!w(o,i,t.spatialReference)){const r=t.origin;i[0]=r.x,i[1]=r.y,i[2]=r.z,e.getLogger(V).error(`Failed to project specified origin (wkid:${o.spatialReference.wkid}) to mesh spatial reference (wkid:${t.spatialReference.wkid}). Projection may be possible after calling projection.load().`)}G(t.vertexAttributes.position,r,3,i),G(t.vertexAttributes.normal,r,3),G(t.vertexAttributes.tangent,r,4),t.vertexAttributesChanged()}function G(e,t,r,o=b){if(null!=e){l(K,k(t),y(t));for(let t=0;t<e.length;t+=r){for(let r=0;r<3;r++)H[r]=e[t+r]-o[r];j(H,H,K);for(let r=0;r<3;r++)e[t+r]=H[r]+o[r]}}}const H=d(),I=c(),J=R(),K=c(),N=r(),Q=d(),W=f();export{D as rotate};
|
|
@@ -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 e from"../../../core/Logger.js";import{
|
|
5
|
+
import e from"../../../core/Logger.js";import{fromRotationTranslationScaleOrigin as t,multiply as r,getScaling as o,scale as i,getTranslation as s}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as n}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{IDENTITY as a}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{s as l,i as c,h as f}from"../../../chunks/vec32.js";import{ZEROS as p,create as m}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import g from"../../Point.js";import{getSphericalPCPF as u}from"../../spatialReferenceEllipsoidUtils.js";import{projectPointToVector as j}from"../../projection/projectPointToVector.js";import{fromMatrix as x}from"../axisAngleDegrees.js";import d from"../MeshTransform.js";import{isMeshWithRelativeVertexSpace as h}from"../meshVertexSpaceUtils.js";import{usesLocalTangentPlaneOnECEFForOperations as b}from"./geographicUtils.js";import{projectToPCPF as v,projectNormalToPCPF as w,projectTangentToPCPF as A,projectFromPCPF as k,projectNormalFromPCPF as y,projectTangentFromPCPF as R}from"./projection.js";import{projectPointToVertexSpace as F}from"./vertexSpaceConversion.js";const $="esri.geometry.support.meshUtils.scale";function P(e,t,r){if(!e.vertexAttributes?.position)return;const{vertexSpace:o,spatialReference:i}=e,s=r?.origin??e.anchor,n=r?.geographic,a=b($,o,i,n);h(e)?S(e,t,s):a?U(e,t,s):C(e,t,s)}function S(n,f,u){n.transform??=new d;const{vertexSpace:j,transform:h,spatialReference:b}=n,[v,w,A]=j.origin,k=new g({x:v,y:w,z:A,spatialReference:b}),y=q;if(k.equals(u))l(y,0,0,0);else if(!F(y,u,n))return void e.getLogger($).error(`Failed to project specified origin (wkid:${u.spatialReference.wkid}) to mesh (wkid:${b.wkid}) ${j.type} vertex space. Projection may be possible after calling projection.load().`);const R=l(z,f,f,f),P=t(M,a,p,R,y),{localMatrix:S}=h,U=r(M,P,S);h.scale=o(m(),U),i(U,U,c(q,h.scale)),h.rotation=x(U),h.translation=s(m(),U)}function U(e,t,r){const o=e.spatialReference,i=u(o),s=T;j(r,s,i)||j(e.origin,s,i);const n=e.vertexAttributes.position,a=e.vertexAttributes.normal,l=e.vertexAttributes.tangent,c=new Float64Array(n.length),f=null!=a?new Float32Array(a.length):null,p=null!=l?new Float32Array(l.length):null;v(n,o,c),null!=a&&null!=f&&w(a,n,c,o,f),null!=l&&null!=p&&A(l,n,c,o,p),L(c,t,s),k(c,n,o),null!=a&&null!=f&&y(f,n,c,o,a),null!=l&&null!=p&&R(p,n,c,o,l),e.vertexAttributesChanged()}function C(t,r,o){const i=T;if(!j(o,i,t.spatialReference)){const r=t.origin;i[0]=r.x,i[1]=r.y,i[2]=r.z,e.getLogger($).error(`Failed to project specified origin (wkid:${o.spatialReference.wkid}) to mesh spatial reference (wkid:${t.spatialReference.wkid}). Projection may be possible after calling projection.load().`)}L(t.vertexAttributes.position,r,i),t.vertexAttributesChanged()}function L(e,t,r=p){if(e)for(let o=0;o<e.length;o+=3){for(let t=0;t<3;t++)q[t]=e[o+t]-r[t];f(q,q,t);for(let t=0;t<3;t++)e[o+t]=q[t]+r[t]}}const q=m(),z=m(),M=n(),T=m();export{P as scale};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{invert as r}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as o}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{f as t,e}from"../../../chunks/vec32.js";import{getSphericalPCPF as i}from"../../spatialReferenceEllipsoidUtils.js";import{computeTranslationToOriginAndRotation as n}from"../../projection/computeTranslationToOriginAndRotation.js";import{projectPointToVector as s}from"../../projection/projectPointToVector.js";function c(o,c,{vertexSpace:f,spatialReference:a}){if("georeferenced"===f.type){const r=o;if(!s(c,r,a))return!1;const{origin:e}=f;return t(o,r,e),!0}const p=i(a),l=o;if(!s(c,l,p))return!1;const{origin:j}=f,u=m;if(!n(a,j,u,p))return!1;const g=r(m,u);return null!=g&&(e(o,l,g),!0)}const m=o();export{c as projectPointToVertexSpace};
|
|
@@ -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{deprecated as e}from"../../core/deprecate.js";import r from"../../core/Logger.js";import n from"../Point.js";import o from"./MeshGeoreferencedVertexSpace.js";import i from"./MeshLocalVertexSpace.js";import{t}from"../../chunks/vec3.js";function c(){return r.getLogger("esri.geometry.Mesh")}function a(e){const{vertexSpace:r}=e;if(null!=r.origin)return e.clone();const{anchor:n}=e,i=n.clone(),c=new o({origin:[i.x,i.y,i.z]}),a=e.cloneWithVertexSpace(c),{position:s}=a.vertexAttributes;return a.vertexAttributes.position=t(new Float64Array(s.length),s,[-i.x,-i.y,-(i.z??0)]),a.vertexAttributesChanged(),a}function s(e,r){switch(e.type){case"georeferenced":return g(e)&&!r.isGeographic&&!r.isWebMercator;case"local":return r.isGeographic||r.isWebMercator}}function g(e){return null!=e.origin}function p(e,r){if(!g(e))return null;const[o,i,t]=e.origin;return new n({x:o,y:i,z:t,spatialReference:r})}function
|
|
5
|
+
import{deprecated as e}from"../../core/deprecate.js";import r from"../../core/Logger.js";import n from"../Point.js";import o from"./MeshGeoreferencedVertexSpace.js";import i from"./MeshLocalVertexSpace.js";import{t}from"../../chunks/vec3.js";function c(){return r.getLogger("esri.geometry.Mesh")}function a(e){const{vertexSpace:r}=e;if(null!=r.origin)return e.clone();const{anchor:n}=e,i=n.clone(),c=new o({origin:[i.x,i.y,i.z]}),a=e.cloneWithVertexSpace(c),{position:s}=a.vertexAttributes;return a.vertexAttributes.position=t(new Float64Array(s.length),s,[-i.x,-i.y,-(i.z??0)]),a.vertexAttributesChanged(),a}function s(e,r){switch(e.type){case"georeferenced":return g(e)&&!r.isGeographic&&!r.isWebMercator;case"local":return r.isGeographic||r.isWebMercator}}function g(e){return null!=e.origin}function p(e){return g(e.vertexSpace)}function u(e,r){if(!g(e))return null;const[o,i,t]=e.origin;return new n({x:o,y:i,z:t,spatialReference:r})}function f(r,n){const{x:t,y:a,z:s,spatialReference:g}=r,p=[t,a,s??0];if(void 0!==n?.geographic){if(e(c(),"option: geographic",{replacement:"use vertexSpace option instead",version:"4.29",warnOnce:!0}),!n?.vertexSpace)return n?.geographic?new i({origin:p}):new o({origin:p});c().warn("Deprecated geographic flag ignored since vertexSpace option is provided.")}if(!n?.vertexSpace)return g.isGeographic||g.isWebMercator?new i({origin:p}):new o({origin:p});switch(n.vertexSpace){case"local":return new i({origin:p});case"georeferenced":return new o({origin:p});case"georeferenced-absolute":return new o}}function l(e){return e.isGeographic||e.isWebMercator?"local":"georeferenced"}function h(e,r){return"local"===e?new i({origin:r}):new o({origin:r})}export{h as createVertexSpace,c as getMeshLogger,p as isMeshWithRelativeVertexSpace,g as isRelativeVertexSpace,l as preferredVertexSpaceTypeForSR,f as selectVertexSpace,s as shouldUpdateFast,a as toRelativeVertexSpace,u as vertexSpaceOriginToPoint};
|
|
@@ -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{clamp as t}from"../../core/mathUtils.js";import{c as n,
|
|
5
|
+
import{clamp as t}from"../../core/mathUtils.js";import{c as n,j as r,f as o,n as c,k as e,s as u,b as i,h as s,g as f}from"../../chunks/vec32.js";import{create as a}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{a as I,e as N}from"../../chunks/vec42.js";import{projectPointSignedLength as M}from"./vector.js";import{sv4d as m,sv3d as g}from"./vectorStacks.js";import{tangentFrame as h}from"../../views/3d/support/mathUtils.js";function E(t=Y){return[t[0],t[1],t[2],t[3]]}const l=I,p=N;function v(t=Y[0],n=Y[1],r=Y[2],o=Y[3]){return T(t,n,r,o,m.get())}function A(t,n){return T(n[0],n[1],n[2],n[3],t)}function F(t){return t}function T(t,n,r,o,c=E()){return c[0]=t,c[1]=n,c[2]=r,c[3]=o,c}function _(t,r,o){return n(o,t),o[3]=r,o}function j(t,n,r){const o=n[0]*n[0]+n[1]*n[1]+n[2]*n[2],c=Math.abs(o-1)>1e-5&&o>1e-12?1/Math.sqrt(o):1;return r[0]=n[0]*c,r[1]=n[1]*c,r[2]=n[2]*c,r[3]=-(r[0]*t[0]+r[1]*t[1]+r[2]*t[2]),r}function b(t,n,r,o=E()){const c=r[0]-n[0],e=r[1]-n[1],u=r[2]-n[2],i=t[0]-n[0],s=t[1]-n[1],f=t[2]-n[2],a=e*f-u*s,I=u*i-c*f,N=c*s-e*i,M=a*a+I*I+N*N,m=Math.abs(M-1)>1e-5&&M>1e-12?1/Math.sqrt(M):1;return o[0]=a*m,o[1]=I*m,o[2]=N*m,o[3]=-(o[0]*t[0]+o[1]*t[1]+o[2]*t[2]),o}function X(t,n,u,i=0,s=Math.floor(u*(1/3)),f=Math.floor(u*(2/3))){if(u<3)return!1;n(y,i);let a=s,I=!1;for(;a<u-1&&!I;)n(C,a),a++,I=!r(y,C);if(!I)return!1;for(a=Math.max(a,f),I=!1;a<u&&!I;)n(L,a),a++,o(P,y,C),c(P,P),o(x,C,L),c(x,x),I=!r(y,L)&&!r(C,L)&&Math.abs(e(P,x))<k;return I?(b(y,C,L,t),!0):(0!==i||1!==s||2!==f)&&X(t,n,u,0,1,2)}function d(t,n,r=!0){const o=n.length/3;return X(t,((t,r)=>u(t,n[3*r+0],n[3*r+1],n[3*r+2])),r?o-1:o)}const k=.99619469809,y=a(),C=a(),L=a(),P=a(),x=a();function O(t,n,r){return n!==t&&A(t,n),t[3]=-e(F(t),r),t}function q(t,n){return n[0]=-t[0],n[1]=-t[1],n[2]=-t[2],n[3]=-t[3],n}function U(t,n,r,o){return i(L,n,t),j(r,L,o)}function w(t,n,r,c){return W(t,n,o(g.get(),r,n),$,c)}function S(t,n,r){return null!=n&&W(t,n.origin,n.direction,tt,r)}function z(t,n,r){return W(t,n.origin,n.vector,Z.NONE,r)}function B(t,n,r){return W(t,n.origin,n.vector,Z.CLAMP,r)}function D(t,n){return V(t,n)>=0}function G(t,n){const r=e(F(t),n.ray.direction),o=-V(t,n.ray.origin);if(o<0&&r>=0)return!1;if(r>-1e-6&&r<1e-6)return o>0;if((o<0||r<0)&&!(o<0&&r<0))return!0;const c=o/r;return r>0?c<n.c1&&(n.c1=c):c>n.c0&&(n.c0=c),n.c0<=n.c1}function H(t,n){const r=e(F(t),n.ray.direction),o=-V(t,n.ray.origin);if(r>-1e-6&&r<1e-6)return o>0;const c=o/r;return r>0?c<n.c1&&(n.c1=c):c>n.c0&&(n.c0=c),n.c0<=n.c1}function J(t,n,r){const c=s(g.get(),F(t),-t[3]),e=Q(t,o(g.get(),n,c),g.get());return f(r,e,c),r}function K(t,n,r,c){const e=F(t),i=g.get(),s=g.get();h(e,i,s);const f=o(g.get(),r,n),a=M(i,f),I=M(s,f),N=M(e,f);return u(c,a,I,N)}function Q(t,n,r){const c=s(g.get(),F(t),e(F(t),n));return o(r,n,c),r}function R(t,n){return Math.abs(V(t,n))}function V(t,n){return e(F(t),n)+t[3]}function W(n,r,o,c,u){const i=e(F(n),o);if(0===i)return!1;let a=-(e(F(n),r)+n[3])/i;return c&Z.CLAMP&&(a=t(a,0,1)),!(!(c&Z.INFINITE_MIN)&&a<0||!(c&Z.INFINITE_MAX)&&a>1)&&(f(u,r,s(u,o,a)),!0)}const Y=[0,0,1,0];var Z;!function(t){t[t.NONE=0]="NONE",t[t.CLAMP=1]="CLAMP",t[t.INFINITE_MIN=4]="INFINITE_MIN",t[t.INFINITE_MAX=8]="INFINITE_MAX"}(Z||(Z={}));const $=Z.INFINITE_MIN|Z.INFINITE_MAX,tt=Z.INFINITE_MAX;export{G as clip,H as clipInfinite,A as copy,E as create,R as distance,p as equals,l as exactEquals,d as fromArray,X as fromManyPoints,_ as fromNormalAndOffset,b as fromPoints,j as fromPositionAndNormal,T as fromValues,U as fromVectorsAndPoint,F as getNormal,w as intersectLine,z as intersectLineSegment,B as intersectLineSegmentClamp,S as intersectRay,D as isPointInside,q as negate,J as projectPoint,K as projectPointLocal,Q as projectVector,O as setOffsetFromPoint,V as signedDistance,Y as up,v as wrap};
|
package/geometry/support/ray.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
|
-
import{equals as i}from"../../core/arrayUtils.js";import{ObjectStack as r}from"../../core/ObjectStack.js";import{c as n,f as o,b as t,n as c,
|
|
5
|
+
import{equals as i}from"../../core/arrayUtils.js";import{ObjectStack as r}from"../../core/ObjectStack.js";import{c as n,f as o,b as t,n as c,k as e,g as s,h as u}from"../../chunks/vec32.js";import{clone as a,create as f}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{sv3d as g}from"./vectorStacks.js";function d(i){return i?m(a(i.origin),a(i.direction)):m(f(),f())}function m(i,r){return{origin:i,direction:r}}function j(r,n){return i(r.origin,n.origin)&&i(r.direction,n.direction)}function p(i,r){const n=x.get();return n.origin=i,n.direction=r,n}function k(i,r=d()){return b(i.origin,i.direction,r)}function l(i,r,t=d()){return n(t.origin,i),o(t.direction,r,i),t}function b(i,r,o=d()){return n(o.origin,i),n(o.direction,r),o}function v(i,r){const n=t(g.get(),c(g.get(),i.direction),o(g.get(),r,i.origin));return e(n,n)}function h(i,r,n){const t=e(i.direction,o(n,r,i.origin));return s(n,i.origin,u(n,i.direction,t)),n}const x=new r((()=>d()));export{h as closestPoint,k as copy,d as create,v as distance2,j as equals,l as fromPoints,b as fromValues,p as wrap};
|
|
@@ -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{ObjectStack as t}from"../../core/ObjectStack.js";import{c as e,f as n,b as r,
|
|
5
|
+
import{ObjectStack as t}from"../../core/ObjectStack.js";import{c as e,f as n,b as r,k as o,h as c,g as s,l as p}from"../../chunks/vec32.js";import{clone as i,create as a}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as f,distance2 as u,fromValues as g}from"./lineSegment.js";import{sv3d as m}from"./vectorStacks.js";function j(t){return t?{p0:i(t.p0),p1:i(t.p1),p2:i(t.p2)}:{p0:a(),p1:a(),p2:a()}}function l(t,e,n){const r=x.get();return r.p0=t,r.p1=e,r.p2=n,r}function b(t,e=j()){return h(t.p0,t.p1,t.p2,e)}function h(t,n,r,o=j()){return e(o.p0,t),e(o.p1,n),e(o.p2,r),o}function k(t,e){const c=t.p0,s=t.p1,p=t.p2,i=n(m.get(),s,c),a=n(m.get(),p,s),f=n(m.get(),c,p),j=n(m.get(),e,c),l=n(m.get(),e,s),b=n(m.get(),e,p),h=r(i,i,f),k=o(r(m.get(),i,h),j),v=o(r(m.get(),a,h),l),S=o(r(m.get(),f,h),b);if(k>0&&v>0&&S>0){const t=o(h,j);return t*t/o(h,h)}const d=u(g(c,i,w.get()),e),x=u(g(s,a,w.get()),e),M=u(g(p,f,w.get()),e);return Math.min(d,x,M)}function v(t,e,n){const r=1e-5,{direction:o,origin:p}=e,{p0:i,p1:a,p2:f}=t,u=a[0]-i[0],g=a[1]-i[1],m=a[2]-i[2],j=f[0]-i[0],l=f[1]-i[1],b=f[2]-i[2],h=o[1]*b-l*o[2],k=o[2]*j-b*o[0],v=o[0]*l-j*o[1],S=u*h+g*k+m*v;if(S>-r&&S<r)return!1;const d=1/S,w=p[0]-i[0],x=p[1]-i[1],M=p[2]-i[2],O=d*(w*h+x*k+M*v);if(O<0||O>1)return!1;const V=x*m-g*M,q=M*u-m*w,y=w*g-u*x,z=d*(o[0]*V+o[1]*q+o[2]*y);if(z<0||O+z>1)return!1;if(n){c(n,o,d*(j*V+l*q+b*y)),s(n,p,n)}return!0}function S(t,e,n){const r=e[0]-t[0],o=e[1]-t[1],c=n[0]-t[0],s=n[1]-t[1];return.5*Math.abs(r*s-o*c)}function d(t,e,o){return n(M,e,t),n(O,o,t),.5*p(r(M,M,O))}const w=new t(f),x=new t((()=>j())),M=a(),O=a();export{S as areaPoints2d,d as areaPoints3d,b as copy,j as create,k as distance2,h as fromValues,v as intersectRay,l as wrap};
|
|
@@ -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{acosClamped as t}from"../../core/mathUtils.js";import{
|
|
5
|
+
import{acosClamped as t}from"../../core/mathUtils.js";import{k as r,h as n,l as o,n as s,b as c}from"../../chunks/vec32.js";import{create as i}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";function e(t,o,s){const c=r(t,o)/r(t,t);return n(s,t,c)}function a(t,n){return r(t,n)/o(t)}function f(n,s){const c=r(n,s)/(o(n)*o(s));return-t(c)}function u(n,o,i){s(m,n),s(h,o);const e=r(m,h),a=t(e),f=c(m,m,h);return r(f,i)<0?2*Math.PI-a:a}const m=i(),h=i();export{f as angle,u as angleAroundAxis,e as projectPoint,a as projectPointSignedLength};
|
package/interfaces.d.ts
CHANGED
|
@@ -14631,7 +14631,7 @@ declare namespace __esri {
|
|
|
14631
14631
|
modifications: SceneModifications;
|
|
14632
14632
|
readonly type: "integrated-mesh";
|
|
14633
14633
|
/**
|
|
14634
|
-
* The IntegratedMeshLayer is designed for visualizing accurate representations in a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html)
|
|
14634
|
+
* The IntegratedMeshLayer is designed for visualizing accurate representations of built and natural environments in a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html).
|
|
14635
14635
|
*
|
|
14636
14636
|
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-IntegratedMeshLayer.html)
|
|
14637
14637
|
*/
|
|
@@ -82305,19 +82305,19 @@ declare namespace __esri {
|
|
|
82305
82305
|
*
|
|
82306
82306
|
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-3d-webgl.html#fromRenderCoordinates)
|
|
82307
82307
|
*/
|
|
82308
|
-
fromRenderCoordinates(
|
|
82308
|
+
fromRenderCoordinates(__0: SceneView, srcCoordinates: number[] | Float32Array | Float64Array, srcStart: number, destCoordinates: number[] | Float32Array | Float64Array, destStart: number, destSpatialReference: SpatialReference, count: number): number[] | Float32Array | Float64Array;
|
|
82309
82309
|
/**
|
|
82310
82310
|
* Computes a 4x4 affine transformation matrix that constitutes a linear coordinate transformation from a local Cartesian coordinate system to the virtual world coordinate system.
|
|
82311
82311
|
*
|
|
82312
82312
|
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-3d-webgl.html#renderCoordinateTransformAt)
|
|
82313
82313
|
*/
|
|
82314
|
-
renderCoordinateTransformAt(
|
|
82314
|
+
renderCoordinateTransformAt(__0: SceneView, origin: number[] | Float32Array | Float64Array, srcSpatialReference?: SpatialReference, dest?: number[] | Float32Array): number[] | Float32Array;
|
|
82315
82315
|
/**
|
|
82316
82316
|
* Transforms positions from the given spatial reference to the internal rendering coordinate system.
|
|
82317
82317
|
*
|
|
82318
82318
|
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-3d-webgl.html#toRenderCoordinates)
|
|
82319
82319
|
*/
|
|
82320
|
-
toRenderCoordinates(
|
|
82320
|
+
toRenderCoordinates(__0: SceneView, srcCoordinates: number[] | Float32Array | Float64Array, srcStart: number, srcSpatialReference: SpatialReference, destCoordinates: number[] | Float32Array | Float64Array, destStart: number, count: number): number[] | Float32Array | Float64Array;
|
|
82321
82321
|
}
|
|
82322
82322
|
|
|
82323
82323
|
export const webgl: webgl;
|
|
@@ -83852,7 +83852,7 @@ declare namespace __esri {
|
|
|
83852
83852
|
*
|
|
83853
83853
|
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-interactive-sketch-SketchValueOptions.html#directionMode)
|
|
83854
83854
|
*/
|
|
83855
|
-
directionMode: "
|
|
83855
|
+
directionMode: "relative" | "absolute";
|
|
83856
83856
|
/**
|
|
83857
83857
|
* The `SketchValueOptions` allows users to configure how numerical values and constraints behave while sketching and editing.
|
|
83858
83858
|
*
|
|
@@ -83869,7 +83869,7 @@ declare namespace __esri {
|
|
|
83869
83869
|
*
|
|
83870
83870
|
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-interactive-sketch-SketchValueOptions.html#directionMode)
|
|
83871
83871
|
*/
|
|
83872
|
-
directionMode?: "
|
|
83872
|
+
directionMode?: "relative" | "absolute";
|
|
83873
83873
|
}
|
|
83874
83874
|
|
|
83875
83875
|
export class FeatureSnappingLayerSource extends Accessor {
|
package/kernel.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
|
-
import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";import{buildDate as s,commitHash as e}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const r="4.29";let t,i=r;i="4.29.
|
|
5
|
+
import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";import{buildDate as s,commitHash as e}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const r="4.29";let t,i=r;i="4.29.1";function n(o){t=o}function m(s){const e=t?.findCredential(s);return e?.token?o(s,"token",e.token):s}has("host-webworker");export{m as addTokenParameter,s as buildDate,i as fullVersion,t as id,e as revision,n as setId,r as version};
|
|
@@ -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"../request.js";import r from"../core/Error.js";import i from"../core/Logger.js";import{rad2deg as o}from"../core/mathUtils.js";import{MultiOriginJSONMixin as s}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as a}from"../core/promiseUtils.js";import{property as n}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import{f as l,g as p,e as c,c as f,
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../request.js";import r from"../core/Error.js";import i from"../core/Logger.js";import{rad2deg as o}from"../core/mathUtils.js";import{MultiOriginJSONMixin as s}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as a}from"../core/promiseUtils.js";import{property as n}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import{f as l,g as p,e as c,c as f,y,C as h,z as d}from"../chunks/vec32.js";import{fromValues as u,create as x}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{WGS84ECEFSpatialReferenceLike as g}from"../geometry/ellipsoidUtils.js";import v from"../geometry/Extent.js";import j from"../geometry/SpatialReference.js";import{projectBuffer as b}from"../geometry/projection/projectBuffer.js";import S from"./Layer.js";import{APIKeyMixin as w}from"./mixins/APIKeyMixin.js";import{ArcGISService as L}from"./mixins/ArcGISService.js";import{CustomParametersMixin as A}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as I}from"./mixins/OperationalLayer.js";import{PortalLayer as _}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as E}from"./mixins/ScaleRangeLayer.js";import{elevationInfo as M,url as R}from"./support/commonProperties.js";import{logInvalidElevationInfoWarning as N,elevationModeRequiredMessage as T,featureExpressionUnsupportedMessage as D}from"../support/elevationInfoUtils.js";let U=class extends(L(I(_(E(s(A(w(S)))))))){constructor(e){super(e),this.operationalLayerType="IntegratedMesh3DTilesLayer",this.spatialReference=new j({wkid:4326,vcsWkid:115700}),this.fullExtent=new v(-180,-90,180,90,this.spatialReference),this.url=null,this.type="integrated-mesh-3dtiles",this.path=null,this.minScale=0,this.maxScale=0}set elevationInfo(e){this._set("elevationInfo",e),this._validateElevationInfo()}_verifyArray(e,t){if(!Array.isArray(e)||e.length<t)return!1;for(const r of e)if("number"!=typeof r)return!1;return!0}_initFullExtent(e){const t=e.root?.boundingVolume;if(!t)return;if(t.box){const e=t?.box;if(e[3]>7972671&&e[7]>7972671&&e[11]>7945940)return}const r=e.root?.transform,i=x();if(t.region&&this._verifyArray(t.region,6)){const e=t.region,r=o(e[0]),i=o(e[1]),s=e[4],a=o(e[2]),n=o(e[3]),m=e[5];this.fullExtent=new v({xmin:r,ymin:i,zmin:s,xmax:a,ymax:n,zmax:m,spatialReference:this.spatialReference})}else if(t.sphere&&this._verifyArray(t.sphere,4)){const e=t.sphere,o=u(e[0],e[1],e[2]),s=e[3]/Math.sqrt(3),a=x();l(a,o,u(-s,-s,-s));const n=x();if(p(n,o,u(s,s,s)),r&&this._verifyArray(r,16)){const e=r;c(i,a,e),f(a,i),c(i,n,e),f(n,i)}b(a,g,0,a,j.WGS84,0,1),b(n,g,0,n,j.WGS84,0,1);const m=x(),d=x();y(m,a,n),h(d,a,n),this.fullExtent=new v({xmin:m[0],ymin:m[1],zmin:m[2],xmax:d[0],ymax:d[1],zmax:d[2],spatialReference:this.spatialReference})}else if(t.box&&this._verifyArray(t.box,12)){const e=t.box,i=u(e[0],e[1],e[2]),o=u(e[3],e[4],e[5]),s=u(e[6],e[7],e[8]),a=u(e[9],e[10],e[11]),n=[];for(let t=0;t<8;++t)n.push(x());if(p(n[0],i,o),p(n[0],n[0],s),p(n[0],n[0],a),d(n[1],i,o),p(n[1],n[1],s),p(n[1],n[1],a),p(n[2],i,o),d(n[2],n[2],s),p(n[2],n[2],a),d(n[3],i,o),d(n[3],n[3],s),p(n[3],n[3],a),p(n[4],i,o),p(n[4],n[4],s),d(n[4],n[4],a),d(n[5],i,o),p(n[5],n[5],s),d(n[5],n[5],a),p(n[6],i,o),d(n[6],n[6],s),d(n[6],n[6],a),d(n[7],i,o),d(n[7],n[7],s),d(n[7],n[7],a),r&&this._verifyArray(r,16)){const e=r;for(let t=0;t<8;++t)c(n[t],n[t],e)}const m=u(Number.MIN_VALUE,Number.MIN_VALUE,Number.MIN_VALUE),l=u(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE);for(let t=0;t<8;++t)b(n[t],g,0,n[t],j.WGS84,0,1),y(l,l,n[t]),h(m,m,n[t]);this.fullExtent=new v({xmin:l[0],ymin:l[1],zmin:l[2],xmax:m[0],ymax:m[1],zmax:m[2],spatialReference:this.spatialReference})}}async load(e){return this.addResolvingPromise(this._doLoad(e)),this}async _doLoad(e){const i=null!=e?e.signal:null;try{await this.loadFromPortal({supportedTypes:["3DTiles Service"],validateItem:e=>{if(e.typeKeywords?.includes("IntegratedMesh"))return!0;throw new r("portal:invalid-layer-item-type","Invalid layer item, expected '${expectedType}' ",{expectedType:"3DTiles Service containing IntegratedMesh"})}},e)}catch(o){a(o)}if(this.url){const e=t(this.url,{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:i}).then((e=>{this._initFullExtent(e.data)}),(e=>{a(e)}));await e}}async fetchAttributionData(){return this.load().then((()=>({})))}_validateElevationInfo(){const e=this.elevationInfo,t="Integrated mesh 3d tiles layers";N(i.getLogger(this),T(t,"absolute-height",e)),N(i.getLogger(this),D(t,e))}};e([n({type:["IntegratedMesh3DTilesLayer"]})],U.prototype,"operationalLayerType",void 0),e([n({type:j})],U.prototype,"spatialReference",void 0),e([n({type:v})],U.prototype,"fullExtent",void 0),e([n(M)],U.prototype,"elevationInfo",null),e([n({type:["show","hide"]})],U.prototype,"listMode",void 0),e([n(R)],U.prototype,"url",void 0),e([n({readOnly:!0})],U.prototype,"type",void 0),e([n({type:String,json:{origins:{"web-scene":{read:!0,write:!0},"portal-item":{read:!0,write:!0}},read:!1}})],U.prototype,"path",void 0),e([n({type:Number,json:{origins:{"web-scene":{name:"layerDefinition.minScale",write:()=>{},read:()=>{}},"portal-item":{name:"layerDefinition.minScale",write:()=>{},read:()=>{}}}}})],U.prototype,"minScale",void 0),e([n({type:Number,json:{origins:{"web-scene":{name:"layerDefinition.maxScale",write:()=>{},read:()=>{}},"portal-item":{name:"layerDefinition.maxScale",write:()=>{},read:()=>{}}}}})],U.prototype,"maxScale",void 0),U=e([m("esri.layers.IntegratedMesh3DTilesLayer")],U);const z=U;export{z as default};
|
package/layers/LinkChartLayer.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
|
-
import{_ as e}from"../chunks/tslib.es6.js";import"../geometry.js";import t from"../core/Collection.js";import a from"../core/Error.js";import i from"../core/Logger.js";import{throwIfAborted as o}from"../core/promiseUtils.js";import{property as n}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as s}from"../core/accessorSupport/decorators/subclass.js";import{encodeGeohash as r}from"../geohash/geohashUtils.js";import h from"./Layer.js";import{convertFromGeometry as l}from"./graphics/featureConversionUtils.js";import p from"./graphics/OptimizedGeometry.js";import{KnowledgeGraphLayerDataManager as c,mockOidFieldName as d,mockOriginIdFieldName as u,mockDestinationIdFieldName as y,mockLayoutGeometryFieldName as m,geohashEncodingPrecision as f}from"./knowledgeGraph/KnowledgeGraphLayerDataManager.js";import g from"./knowledgeGraph/KnowledgeGraphSublayer.js";import{getRelationshipEndNodeIds as k}from"./knowledgeGraph/supportUtils.js";import{BlendLayer as C}from"./mixins/BlendLayer.js";import{ScaleRangeLayer as L}from"./mixins/ScaleRangeLayer.js";import{LCSimpleLayout as M,LCSmartTreeLayout as b,LCRadialTreeLayout as w,LCHierarchicalLayout as D,LCCommunityLayout as x,LCForceDirectedLayout as T,NodeFlag as E,load as N}from"../libs/linkchartlayout/LinkChartLayout.js";import{fetchKnowledgeGraph as G}from"../rest/knowledgeGraphService.js";import R from"../rest/knowledgeGraph/EntityType.js";import I from"../rest/knowledgeGraph/RelationshipType.js";import _ from"../geometry/Extent.js";import A from"../geometry/Point.js";import v from"../geometry/Polyline.js";const S=(e,t,a)=>(e.has(t)||e.set(t,a()),e.get(t));let j=class extends(C(L(h))){constructor(e){if(super(e),this.dataPreloadedInLocalCache=!1,this.defaultLinkChartConfig=null,this._currentLinkChartConfig={layoutMode:"RADIAL_TREE",xScaleFactor:1,yScaleFactor:1},this._graphTypeLookup=new Map,this.dataManager=null,this.knowledgeGraph=null,this.layers=new t,this.entityLinkChartDiagramLookup=new Map,this.relationshipLinkChartDiagramLookup=new Map,this.linkChartExtent=new _({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7}),this.linkChartGeohashLookup=new Map,this.memberEntityTypes=null,this.memberRelationshipTypes=null,this.sublayerIdsCache=new Map,this.tables=new t,this.type="link-chart",this._originalInclusionList=e.inclusionModeDefinition,e.dataPreloadedInLocalCache&&!e.inclusionModeDefinition)throw new a("knowledge-graph:linkchart-layer-constructor","If creating a link chart composite layer and configured that data is already loaded in the cache, you must specify an inclusion list so the Composite Layer knows what records belong to it")}normalizeCtorArgs(e){return{url:e.url,title:e.title,dataPreloadedInLocalCache:e.dataPreloadedInLocalCache,defaultLinkChartConfig:e.defaultLinkChartConfig}}_initializeLayerProperties(e){if(!this.title&&this.url){const e=this.url.split("/");this.title=e[e.length-2]}const t=new Set;let o=[],n=[];if(e.inclusionModeDefinition&&(!e.inclusionModeDefinition.namedTypeDefinitions||e.inclusionModeDefinition.namedTypeDefinitions.size<1))throw new a("knowledge-graph:composite-layer-constructor","If an explicit inclusion definition is defined, at least one namedTypeDefinition must also be defined");e.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&this._graphTypeLookup.set(e.name,e)})),e.knowledgeGraph.dataModel.relationshipTypes?.forEach((e=>{e.name&&this._graphTypeLookup.set(e.name,e)})),e.inclusionModeDefinition?.generateAllSublayers?(o=e.knowledgeGraph.dataModel.entityTypes??[],n=e.knowledgeGraph.dataModel.relationshipTypes??[]):e.inclusionModeDefinition?.namedTypeDefinitions&&e.inclusionModeDefinition?.namedTypeDefinitions.size>0?e.inclusionModeDefinition?.namedTypeDefinitions.forEach(((a,s)=>{if(!this._graphTypeLookup.get(s))return i.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._graphTypeLookup.get(s)instanceof I||"strictOrigin"in this._graphTypeLookup.get(s)?t.has(s)||(t.add(s),n.push(this._graphTypeLookup.get(s))):this._graphTypeLookup.get(s)instanceof R||"properties"in this._graphTypeLookup.get(s)?t.has(s)||(t.add(s),o.push(this._graphTypeLookup.get(s))):(i.getLogger(this).warn(`A named type, ${s}, was in the inclusion list that wasn't properly modeled and will be removed`),e.inclusionModeDefinition?.namedTypeDefinitions.delete(s))})):(o=e.knowledgeGraph.dataModel.entityTypes??[],n=e.knowledgeGraph.dataModel.relationshipTypes??[]);const s=new c({knowledgeGraph:e.knowledgeGraph,inclusionModeDefinition:e.inclusionModeDefinition});this.knowledgeGraph=e.knowledgeGraph,this.memberEntityTypes=o,this.memberRelationshipTypes=n,this.dataManager=s}load(e){return this.addResolvingPromise(new Promise((t=>{G(this.url).then((a=>{if(this._initializeLayerProperties({knowledgeGraph:a,inclusionModeDefinition:this._originalInclusionList}),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.size||(this.dataManager.inclusionModeDefinition={generateAllSublayers:!1,namedTypeDefinitions:new Map},this.dataManager.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.set(e.name,{useAllData:!0})})),this.dataManager.knowledgeGraph.dataModel.relationshipTypes?.forEach((e=>{e.name&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.set(e.name,{useAllData:!0})}))),this.dataPreloadedInLocalCache)this.loadLayerAssumingLocalCache(),this.dataManager.inclusionModeDefinition&&(this.dataManager.inclusionModeDefinition.generateAllSublayers=!1),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach((e=>{e.useAllData=!1,e.members?.forEach((e=>{let t;t=e.linkChartLocation instanceof p?e.linkChartLocation:e.linkChartLocation?l(e.linkChartLocation):null,t&&2===t.coords.length&&0===t.lengths.length?(this.linkChartGeohashLookup.set(e.id,r(t.coords[1],t.coords[0],f)),this.entityLinkChartDiagramLookup.set(e.id,t)):(this.linkChartGeohashLookup.set(e.id,""),this.relationshipLinkChartDiagramLookup.set(e.id,t))})),this.addResolvingPromise(this._initializeDiagram().then((async()=>{this.layers.forEach((async e=>{await e.refreshCachedQueryEngine()})),this.tables.forEach((async e=>{await e.refreshCachedQueryEngine()}))})))}));else{const t="GEOGRAPHIC"===this.defaultLinkChartConfig?.layoutMode;this.addResolvingPromise(this.dataManager.refreshCacheContent(void 0,!1,t,!0).then((async()=>{o(e);const t=[],a=[];this.loadLayerAssumingLocalCache(),this.dataManager.inclusionModeDefinition&&(this.dataManager.inclusionModeDefinition.generateAllSublayers=!1,this.dataManager.inclusionModeDefinition.namedTypeDefinitions.forEach((e=>{e.useAllData=!1}))),await this._initializeDiagram(),this.layers.forEach((e=>{a.push(e.refreshCachedQueryEngine()),t.push(new Promise((t=>{e.on("layerview-create",(()=>{t(null)}))})))})),this.tables.forEach((e=>{a.push(e.refreshCachedQueryEngine())})),await Promise.all(a)})))}t(null)}))}))),Promise.resolve(this)}async addRecords(e,t){let a=[];t?.cascadeAddRelationshipEndNodes&&this.dataManager.knowledgeGraph.dataModel&&(a=await k(e,this.dataManager.knowledgeGraph));const i=e.concat(a).filter((e=>!this.sublayerIdsCache.get(e.typeName)?.has(e.id)));await this._handleNewRecords(i)}async removeRecords(e,{cascadeRemoveRelationships:t=!0,recalculateLayout:a=!1}={cascadeRemoveRelationships:!0,recalculateLayout:!1}){let i=[];for(const n of e)!1===this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(n.typeName)?.useAllData&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(n.typeName)?.members?.has(n.id)&&i.push(n);if(t){const e=new Set,t=[];for(const a of i)if(this.dataManager.nodeConnectionsLookup.has(a.id))for(const t of this.dataManager.nodeConnectionsLookup.get(a.id))e.add(t);for(const a of e)if(this.dataManager.memberIdTypeLookup.has(a))for(const e of this.dataManager.memberIdTypeLookup.get(a))this.dataManager.relationshipTypeNames.has(e)&&t.push({id:a,typeName:e});i=i.concat(t)}this.dataManager.removeFromLayer(i);for(const n of i)this.sublayerIdsCache.get(n.typeName)?.delete(n.id),this.dataManager.relationshipTypeNames.has(n.typeName)?this.relationshipLinkChartDiagramLookup.delete(n.id):this.entityLinkChartDiagramLookup.delete(n.id);a&&await this.calculateLinkChartLayout(this._currentLinkChartConfig.layoutMode,{xScaleFactor:this._currentLinkChartConfig.xScaleFactor,yScaleFactor:this._currentLinkChartConfig.xScaleFactor});const o=[];return this.layers.forEach((e=>{o.push(e.refreshCachedQueryEngine())})),await Promise.all(o),this._refreshNamedTypes(),i}async expand(e,t){const a=await this.dataManager.getConnectedRecordIds(e,t),i=a.filter((e=>!this.sublayerIdsCache.get(e.typeName)?.has(e.id)));return await this._handleNewRecords(a),{records:i}}loadLayerAssumingLocalCache(){this.memberRelationshipTypes.forEach((e=>{const t=new g({objectType:e,parentCompositeLayer:this,graphType:"relationship",title:e.name});t.geometryType?this.layers.push(t):this.tables.push(t),this.dataManager.sublayerCaches.has(e.name)||this.dataManager.sublayerCaches.set(e.name,new Map)})),this.memberEntityTypes.forEach((e=>{const t=new g({objectType:e,parentCompositeLayer:this,graphType:"entity",title:e.name});t.geometryType?this.layers.push(t):this.tables.push(t),this.dataManager.sublayerCaches.has(e.name)||this.dataManager.sublayerCaches.set(e.name,new Map)})),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach(((e,t)=>{const a=S(this.sublayerIdsCache,t,(()=>new Set));e.members?.forEach((e=>{if(a.add(e.id),e.linkChartLocation)if(e.linkChartLocation instanceof p)this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(e.id,e.linkChartLocation):this.entityLinkChartDiagramLookup.set(e.id,e.linkChartLocation),2===e.linkChartLocation.coords.length&&0===e.linkChartLocation.lengths.length?this.linkChartGeohashLookup.set(e.id,r(e.linkChartLocation.coords[1],e.linkChartLocation.coords[0],f)):this.linkChartGeohashLookup.set(e.id,"");else{const a=l(e.linkChartLocation);this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(e.id,e.linkChartLocation?a:null):this.entityLinkChartDiagramLookup.set(e.id,e.linkChartLocation?a:null),"x"in e.linkChartLocation&&"y"in e.linkChartLocation?this.linkChartGeohashLookup.set(e.id,r(e.linkChartLocation.x,e.linkChartLocation.y,f)):this.linkChartGeohashLookup.set(e.id,"")}}))}))}async calculateLinkChartLayout(e="RADIAL_TREE",t){const o=[],n=[];this.dataManager.sublayerCaches.forEach(((e,t)=>{this.dataManager.entityTypeNames.has(t)?e.forEach((e=>{o.push({typeName:t,feature:e})})):this.dataManager.relationshipTypeNames.has(t)&&e.forEach((e=>{n.push({typeName:t,feature:e})}))})),this.entityLinkChartDiagramLookup=new Map,this.relationshipLinkChartDiagramLookup=new Map;const s=new Map,h=new Map,p=new Map,c=new Map,g=new Uint8Array(o.length),k=new Float64Array(o.length),C=new Float64Array(o.length),L=new Uint32Array(n.length),G=new Uint32Array(n.length),R=[],I="FORCE_DIRECTED",S=t?.xScaleFactor??1,j=t?.yScaleFactor??1,P=new _({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7});let F,z="FORCE_DIRECTED",O=0,U=0;switch(z="GEOGRAPHIC"===e?I:e,z){case"FORCE_DIRECTED":F=T.apply;break;case"COMMUNITY":F=x.apply;break;case"HIERARCHICAL":F=D.apply;break;case"RADIAL_TREE":F=w.apply;break;case"SMART_TREE":F=b.apply;break;default:F=M.apply}o.forEach((({typeName:a,feature:i})=>{if(t?.lockedNodeLocations?.has(i.attributes[d])){"GEOGRAPHIC"===e&&this.dataManager.geographicLookup.has(a)?g[O]=E.IsGeographic:g[O]=E.None;const o=t.lockedNodeLocations.get(i.attributes[d]);k[O]=o.x,C[O]=o.y}else if("GEOGRAPHIC"===e&&this.dataManager.geographicLookup.has(a)){g[O]=E.IsGeographic;let e=null;const t=i.attributes[this.dataManager.geographicLookup.get(a).name],o=this.dataManager.geographicLookup.get(a)?.geometryType;switch(o){case"esriGeometryPoint":k[O]=t?.x,C[O]=t?.y;break;case"esriGeometryPolygon":e=t?.centroid,null!=e?.x&&null!=e?.y?(k[O]=e.x,C[O]=e.y):g[O]=E.IsMovable;break;case"esriGeometryPolyline":case"esriGeometryMultipoint":e=t?.extent?.center,null!=e?.x&&null!=e?.y?(k[O]=e.x,C[O]=e.y):g[O]=E.IsMovable;break;default:g[O]=E.IsMovable}(null==k[O]||null==C[O]||Number.isNaN(k[O])||Number.isNaN(C[O]))&&(g[O]=E.IsMovable,k[O]=0,C[O]=0)}else g[O]=E.IsMovable,k[O]=0,C[O]=0;c.set(i.attributes[d],O),R[O]={feature:i,typeName:a},O++}));let Q=!1;n.forEach((e=>{const t=c.get(e.feature.attributes[u]),a=c.get(e.feature.attributes[y]);void 0!==t&&void 0!==a?(L[U]=t,G[U]=a,U++):(Q=!0,this.relationshipLinkChartDiagramLookup.set(e.feature.attributes[u],null),this.linkChartGeohashLookup.set(e.feature.attributes[u],null))})),Q&&i.getLogger(this).warn("A relationship is a member of this layer that has either origin or destination entity nodes that are not members. The diagram geometry will be set to null"),await N();const{success:H}=F(g,k,C,L,G);if(!H)throw new a("knowledge-graph:layout-failed","Attempting to arrange the records in the specified layout failed");for(let a=0;a<R.length;a++){if(g[a]===E.IsMovable&&(k[a]=k[a]*S,C[a]=C[a]*j),C[a]>84.9999&&(C[a]=84.9999),C[a]<-84.9999&&(C[a]=-84.9999),k[a]>179.9999&&(k[a]=179.9999),k[a]<-179.9999&&(k[a]=-179.9999),R[a].feature.attributes[m]=new A(k[a],C[a]),s.has(R[a].typeName)){const e=s.get(R[a].typeName);e?.set(R[a].feature.attributes[d],R[a].feature)}else{const e=new Map;e.set(R[a].feature.attributes[d],R[a].feature),s.set(R[a].typeName,e)}p.set(R[a].feature.attributes[d],R[a].feature);const e=l(R[a].feature.attributes[m]);this.entityLinkChartDiagramLookup.set(R[a].feature.attributes[d],R[a].feature.attributes[m]?e:null),this.linkChartGeohashLookup.set(R[a].feature.attributes[d],r(R[a].feature.attributes[m].y,R[a].feature.attributes[m].x,f)),R[a].feature.attributes[m].x<P.xmin&&(P.xmin=R[a].feature.attributes[m].x),R[a].feature.attributes[m].x>P.xmax&&(P.xmax=R[a].feature.attributes[m].x),R[a].feature.attributes[m].y<P.ymin&&(P.ymin=R[a].feature.attributes[m].y),R[a].feature.attributes[m].y>P.ymax&&(P.ymax=R[a].feature.attributes[m].y)}return this.linkChartExtent.xmin=P.xmin,this.linkChartExtent.xmax=P.xmax,this.linkChartExtent.ymin=P.ymin,this.linkChartExtent.ymax=P.ymax,n.forEach((e=>{const t=R[c.get(e.feature.attributes[u])]?.feature.attributes[m],a=R[c.get(e.feature.attributes[y])]?.feature.attributes[m];if(!t||!a)return;const i=new v({paths:[[t.x,t.y],[a.x,a.y]]});if(e.feature.attributes[m]=i,h.has(e.typeName)){const t=h.get(e.typeName);t?.set(e.feature.attributes[d],e.feature)}else{const t=new Map;t.set(e.feature.attributes[d],e.feature),h.set(e.typeName,t)}p.set(e.feature.attributes[d],e.feature);const o=l(e.feature.attributes[m]);this.relationshipLinkChartDiagramLookup.set(e.feature.attributes[d],e.feature.attributes[m]?o:null),this.linkChartGeohashLookup.set(e.feature.attributes[d],"")})),this._currentLinkChartConfig={layoutMode:e,xScaleFactor:S,yScaleFactor:j},{nodes:s,links:h,idMap:p}}async applyNewLinkChartLayout(e="RADIAL_TREE",t){const a=[];await this.calculateLinkChartLayout(e,t),this.layers.forEach((e=>{a.push(e.refreshCachedQueryEngine())})),await Promise.all(a),this._refreshNamedTypes()}getCurrentNodeLocations(){const e=new Map;return this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach((t=>{t?.members?.forEach((t=>{const a=t.linkChartLocation;let i;const o=t.id;a&&(i="x"in a?{x:a.x,y:a.y}:{x:a.coords[0],y:a.coords[1]},e.set(o,new A({x:i.x,y:i.y})))}))})),e}async synchronizeInclusionListWithCache(){return new Promise((e=>{this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach(((e,t)=>{if(e.useAllData=!1,e.members&&e.members.size>0){if(!this.dataManager.sublayerCaches.get(t))return;const a=new Set(Array.from(this.dataManager.sublayerCaches.get(t).keys()));Array.from(e.members.keys()).filter((e=>!a.has(e))).forEach((t=>{e.members?.delete(t)}))}})),e()}))}async refreshLinkChartCache(e){await this.dataManager.refreshCacheContent(e);const t=[];this.layers.forEach((e=>{t.push(e.refreshCachedQueryEngine())})),await Promise.all(t),this._refreshNamedTypes()}async _handleNewRecords(e){const t=[];this.dataManager.addToLayer(e);for(const a of e)this.sublayerIdsCache.has(a.typeName)||(this.sublayerIdsCache.set(a.typeName,new Set),t.push(a.typeName)),this.sublayerIdsCache.get(a.typeName).add(a.id);for(const a of t)if(this._graphTypeLookup.has(a)){const e=this._graphTypeLookup.get(a),t="endPoints"in e?"relationship":"entity",i=new g({objectType:e,parentCompositeLayer:this,graphType:t,title:a});"entity"===t?this.dataManager.entityTypeNames.add(a):this.dataManager.relationshipTypeNames.add(a),i.geometryType?this.layers.push(i):this.tables.push(i),this.dataManager.sublayerCaches.set(a,new Map)}await this.dataManager.refreshCacheContent(e.map((e=>e.id))),await this.applyNewLinkChartLayout(this._currentLinkChartConfig.layoutMode,{xScaleFactor:this._currentLinkChartConfig.xScaleFactor,yScaleFactor:this._currentLinkChartConfig.xScaleFactor})}async _initializeDiagram(){this.defaultLinkChartConfig?this.defaultLinkChartConfig.doNotRecalculateLayout?(this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach(((e,t)=>{e?.members?.forEach((e=>{const a=e.linkChartLocation;let i;const o=e.id;if(!a)return;i="x"in a?{x:a.x,y:a.y}:{x:a.coords[0],y:a.coords[1]};const n=l(i);this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(o,n):this.entityLinkChartDiagramLookup.set(o,n),this.linkChartGeohashLookup.set(o,r(i.x,i.y,f)),this.linkChartExtent.xmin>i.x&&(this.linkChartExtent.xmin=i.x),this.linkChartExtent.xmax<i.x&&(this.linkChartExtent.xmax=i.x),this.linkChartExtent.ymin>i.y&&(this.linkChartExtent.ymin=i.y),this.linkChartExtent.ymax<i.y&&(this.linkChartExtent.ymax=i.y)}))})),this.memberRelationshipTypes.forEach((e=>{e.name&&this.dataManager.sublayerCaches.get(e.name)?.forEach((e=>{const t=this.relationshipLinkChartDiagramLookup.get(e.attributes[u]),a=this.relationshipLinkChartDiagramLookup.get(e.attributes[y]);if(t&&a){const i=l(new v({paths:[[t.coords[0],t.coords[1]],[a.coords[0],a.coords[1]]]}));this.relationshipLinkChartDiagramLookup.set(e.attributes[d],i)}else this.relationshipLinkChartDiagramLookup.set(e.attributes[d],null);this.linkChartGeohashLookup.set(e.attributes[d],"")}))}))):await this.calculateLinkChartLayout(this.defaultLinkChartConfig.layoutMode,{xScaleFactor:this.defaultLinkChartConfig.xScaleFactor,yScaleFactor:this.defaultLinkChartConfig.yScaleFactor,lockedNodeLocations:this.getCurrentNodeLocations()}):await this.calculateLinkChartLayout("RADIAL_TREE",{lockedNodeLocations:this.getCurrentNodeLocations()})}_refreshNamedTypes(){for(const e of this.layers)e.emit("refresh",{dataChanged:!0});for(const e of this.tables)e.emit("refresh",{dataChanged:!0})}};e([n()],j.prototype,"dataPreloadedInLocalCache",void 0),e([n()],j.prototype,"defaultLinkChartConfig",void 0),e([n()],j.prototype,"dataManager",void 0),e([n()],j.prototype,"knowledgeGraph",void 0),e([n()],j.prototype,"layers",void 0),e([n()],j.prototype,"entityLinkChartDiagramLookup",void 0),e([n()],j.prototype,"relationshipLinkChartDiagramLookup",void 0),e([n()],j.prototype,"linkChartExtent",void 0),e([n()],j.prototype,"linkChartGeohashLookup",void 0),e([n()],j.prototype,"memberEntityTypes",void 0),e([n()],j.prototype,"memberRelationshipTypes",void 0),e([n()],j.prototype,"sublayerIdsCache",void 0),e([n()],j.prototype,"tables",void 0),e([n({json:{read:!1}})],j.prototype,"type",void 0),j=e([s("esri.layers.LinkChartLayer")],j);const P=j;export{P as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import"../geometry.js";import t from"../core/Collection.js";import a from"../core/Error.js";import i from"../core/Logger.js";import{throwIfAborted as n}from"../core/promiseUtils.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as o}from"../core/accessorSupport/decorators/subclass.js";import{encodeGeohash as r}from"../geohash/geohashUtils.js";import h from"./Layer.js";import{convertFromGeometry as l}from"./graphics/featureConversionUtils.js";import p from"./graphics/OptimizedGeometry.js";import{KnowledgeGraphLayerDataManager as d,mockOidFieldName as c,mockOriginIdFieldName as u,mockDestinationIdFieldName as y,mockLayoutGeometryFieldName as m,mockAggregationCountFieldName as g,geohashEncodingPrecision as f}from"./knowledgeGraph/KnowledgeGraphLayerDataManager.js";import k from"./knowledgeGraph/KnowledgeGraphSublayer.js";import{getRelationshipEndNodeIds as L}from"./knowledgeGraph/supportUtils.js";import{BlendLayer as C}from"./mixins/BlendLayer.js";import{ScaleRangeLayer as M}from"./mixins/ScaleRangeLayer.js";import{LCSimpleLayout as w,LCSmartTreeLayout as b,LCRadialTreeLayout as D,LCHierarchicalLayout as x,LCCommunityLayout as T,LCForceDirectedLayout as E,NodeFlag as N,load as G,LinkType as R}from"../libs/linkchartlayout/LinkChartLayout.js";import{fetchKnowledgeGraph as I}from"../rest/knowledgeGraphService.js";import v from"../rest/knowledgeGraph/EntityType.js";import A from"../rest/knowledgeGraph/RelationshipType.js";import _ from"../geometry/Extent.js";import j from"../geometry/Point.js";import P from"../geometry/Polyline.js";const S=(e,t,a)=>(e.has(t)||e.set(t,a()),e.get(t));let z=class extends(C(M(h))){constructor(e){if(super(e),this.dataPreloadedInLocalCache=!1,this.defaultLinkChartConfig=null,this._currentLinkChartConfig={layoutMode:"RADIAL_TREE"},this._graphTypeLookup=new Map,this.dataManager=null,this.knowledgeGraph=null,this.layers=new t,this.entityLinkChartDiagramLookup=new Map,this.relationshipLinkChartDiagramLookup=new Map,this.linkChartExtent=new _({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7}),this.linkChartGeohashLookup=new Map,this.memberEntityTypes=null,this.memberRelationshipTypes=null,this.sublayerIdsCache=new Map,this.tables=new t,this.type="link-chart",this._originalInclusionList=e.inclusionModeDefinition,e.dataPreloadedInLocalCache&&!e.inclusionModeDefinition)throw new a("knowledge-graph:linkchart-layer-constructor","If creating a link chart composite layer and configured that data is already loaded in the cache, you must specify an inclusion list so the Composite Layer knows what records belong to it")}normalizeCtorArgs(e){return{url:e.url,title:e.title,dataPreloadedInLocalCache:e.dataPreloadedInLocalCache,defaultLinkChartConfig:e.defaultLinkChartConfig}}_initializeLayerProperties(e){if(!this.title&&this.url){const e=this.url.split("/");this.title=e[e.length-2]}const t=new Set;let n=[],s=[];if(e.inclusionModeDefinition&&(!e.inclusionModeDefinition.namedTypeDefinitions||e.inclusionModeDefinition.namedTypeDefinitions.size<1))throw new a("knowledge-graph:composite-layer-constructor","If an explicit inclusion definition is defined, at least one namedTypeDefinition must also be defined");e.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&this._graphTypeLookup.set(e.name,e)})),e.knowledgeGraph.dataModel.relationshipTypes?.forEach((e=>{e.name&&this._graphTypeLookup.set(e.name,e)})),e.inclusionModeDefinition?.generateAllSublayers?(n=e.knowledgeGraph.dataModel.entityTypes??[],s=e.knowledgeGraph.dataModel.relationshipTypes??[]):e.inclusionModeDefinition?.namedTypeDefinitions&&e.inclusionModeDefinition?.namedTypeDefinitions.size>0?e.inclusionModeDefinition?.namedTypeDefinitions.forEach(((a,o)=>{if(!this._graphTypeLookup.get(o))return i.getLogger(this).warn(`A named type, ${o}, was in the inclusion list that wasn't in the data model and will be removed`),void e.inclusionModeDefinition?.namedTypeDefinitions.delete(o);this._graphTypeLookup.get(o)instanceof A||"strictOrigin"in this._graphTypeLookup.get(o)?t.has(o)||(t.add(o),s.push(this._graphTypeLookup.get(o))):this._graphTypeLookup.get(o)instanceof v||"properties"in this._graphTypeLookup.get(o)?t.has(o)||(t.add(o),n.push(this._graphTypeLookup.get(o))):(i.getLogger(this).warn(`A named type, ${o}, was in the inclusion list that wasn't properly modeled and will be removed`),e.inclusionModeDefinition?.namedTypeDefinitions.delete(o))})):(n=e.knowledgeGraph.dataModel.entityTypes??[],s=e.knowledgeGraph.dataModel.relationshipTypes??[]);const o=new d({knowledgeGraph:e.knowledgeGraph,inclusionModeDefinition:e.inclusionModeDefinition});this.knowledgeGraph=e.knowledgeGraph,this.memberEntityTypes=n,this.memberRelationshipTypes=s,this.dataManager=o}load(e){return this.addResolvingPromise(new Promise((t=>{I(this.url).then((a=>{if(this._initializeLayerProperties({knowledgeGraph:a,inclusionModeDefinition:this._originalInclusionList}),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.size||(this.dataManager.inclusionModeDefinition={generateAllSublayers:!1,namedTypeDefinitions:new Map},this.dataManager.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.set(e.name,{useAllData:!0})})),this.dataManager.knowledgeGraph.dataModel.relationshipTypes?.forEach((e=>{e.name&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.set(e.name,{useAllData:!0})}))),this.dataPreloadedInLocalCache)this.loadLayerAssumingLocalCache(),this.dataManager.inclusionModeDefinition&&(this.dataManager.inclusionModeDefinition.generateAllSublayers=!1),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach((e=>{e.useAllData=!1,e.members?.forEach((e=>{let t;t=e.linkChartLocation instanceof p?e.linkChartLocation:e.linkChartLocation?l(e.linkChartLocation):null,t&&2===t.coords.length&&0===t.lengths.length?(this.linkChartGeohashLookup.set(e.id,r(t.coords[1],t.coords[0],f)),this.entityLinkChartDiagramLookup.set(e.id,t)):(this.linkChartGeohashLookup.set(e.id,""),this.relationshipLinkChartDiagramLookup.set(e.id,t))})),this.addResolvingPromise(this._initializeDiagram().then((async()=>{this.layers.forEach((async e=>{await e.refreshCachedQueryEngine()})),this.tables.forEach((async e=>{await e.refreshCachedQueryEngine()}))})))}));else{const t="GEOGRAPHIC"===this.defaultLinkChartConfig?.layoutMode;this.addResolvingPromise(this.dataManager.refreshCacheContent(void 0,!1,t,!0).then((async()=>{n(e);const t=[],a=[];this.loadLayerAssumingLocalCache(),this.dataManager.inclusionModeDefinition&&(this.dataManager.inclusionModeDefinition.generateAllSublayers=!1,this.dataManager.inclusionModeDefinition.namedTypeDefinitions.forEach((e=>{e.useAllData=!1}))),await this._initializeDiagram(),this.layers.forEach((e=>{a.push(e.refreshCachedQueryEngine()),t.push(new Promise((t=>{e.on("layerview-create",(()=>{t(null)}))})))})),this.tables.forEach((e=>{a.push(e.refreshCachedQueryEngine())})),await Promise.all(a)})))}t(null)}))}))),Promise.resolve(this)}async addRecords(e,t){let a=[];t?.cascadeAddRelationshipEndNodes&&this.dataManager.knowledgeGraph.dataModel&&(a=await L(e,this.dataManager.knowledgeGraph));const i=e.concat(a).filter((e=>!this.sublayerIdsCache.get(e.typeName)?.has(e.id)));await this._handleNewRecords(i)}async removeRecords(e,{cascadeRemoveRelationships:t=!0,recalculateLayout:a=!1}={cascadeRemoveRelationships:!0,recalculateLayout:!1}){let i=[];for(const s of e)!1===this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(s.typeName)?.useAllData&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(s.typeName)?.members?.has(s.id)&&i.push(s);if(t){const e=new Set,t=[];for(const a of i)if(this.dataManager.nodeConnectionsLookup.has(a.id))for(const t of this.dataManager.nodeConnectionsLookup.get(a.id))e.add(t);for(const a of e)if(this.dataManager.memberIdTypeLookup.has(a))for(const e of this.dataManager.memberIdTypeLookup.get(a))this.dataManager.relationshipTypeNames.has(e)&&t.push({id:a,typeName:e});i=i.concat(t)}this.dataManager.removeFromLayer(i);for(const s of i)this.sublayerIdsCache.get(s.typeName)?.delete(s.id),this.dataManager.relationshipTypeNames.has(s.typeName)?this.relationshipLinkChartDiagramLookup.delete(s.id):this.entityLinkChartDiagramLookup.delete(s.id);a&&await this.calculateLinkChartLayout(this._currentLinkChartConfig.layoutMode,{});const n=[];return this.layers.forEach((e=>{n.push(e.refreshCachedQueryEngine())})),await Promise.all(n),this._refreshNamedTypes(),i}async expand(e,t){const a=await this.dataManager.getConnectedRecordIds(e,t),i=a.filter((e=>!this.sublayerIdsCache.get(e.typeName)?.has(e.id)));return await this._handleNewRecords(a),{records:i}}loadLayerAssumingLocalCache(){this.memberRelationshipTypes.forEach((e=>{const t=new k({objectType:e,parentCompositeLayer:this,graphType:"relationship",title:e.name});t.geometryType?this.layers.push(t):this.tables.push(t),this.dataManager.sublayerCaches.has(e.name)||this.dataManager.sublayerCaches.set(e.name,new Map)})),this.memberEntityTypes.forEach((e=>{const t=new k({objectType:e,parentCompositeLayer:this,graphType:"entity",title:e.name});t.geometryType?this.layers.push(t):this.tables.push(t),this.dataManager.sublayerCaches.has(e.name)||this.dataManager.sublayerCaches.set(e.name,new Map)})),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach(((e,t)=>{const a=S(this.sublayerIdsCache,t,(()=>new Set));e.members?.forEach((e=>{if(a.add(e.id),e.linkChartLocation)if(e.linkChartLocation instanceof p)this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(e.id,e.linkChartLocation):this.entityLinkChartDiagramLookup.set(e.id,e.linkChartLocation),2===e.linkChartLocation.coords.length&&0===e.linkChartLocation.lengths.length?this.linkChartGeohashLookup.set(e.id,r(e.linkChartLocation.coords[1],e.linkChartLocation.coords[0],f)):this.linkChartGeohashLookup.set(e.id,"");else{const a=l(e.linkChartLocation);this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(e.id,e.linkChartLocation?a:null):this.entityLinkChartDiagramLookup.set(e.id,e.linkChartLocation?a:null),"x"in e.linkChartLocation&&"y"in e.linkChartLocation?this.linkChartGeohashLookup.set(e.id,r(e.linkChartLocation.x,e.linkChartLocation.y,f)):this.linkChartGeohashLookup.set(e.id,"")}}))}))}async calculateLinkChartLayout(e="RADIAL_TREE",t){const n=[],s=[],o=[];this.dataManager.sublayerCaches.forEach(((e,t)=>{this.dataManager.entityTypeNames.has(t)?e.forEach((e=>{n.push({typeName:t,feature:e})})):this.dataManager.relationshipTypeNames.has(t)&&e.forEach((e=>{s.push({typeName:t,feature:e})}))})),this.entityLinkChartDiagramLookup=new Map,this.relationshipLinkChartDiagramLookup=new Map;const h=new Map,p=new Map,d=new Map,k=new Map,L=new Uint8Array(n.length),C=new Float64Array(n.length),M=new Float64Array(n.length),I=new Uint32Array(s.length),v=new Uint32Array(s.length),A=[],S="FORCE_DIRECTED",z=new _({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7});let O,U="FORCE_DIRECTED",Q=0,F=0;switch(U="GEOGRAPHIC"===e?S:e,U){case"FORCE_DIRECTED":O=E.apply;break;case"COMMUNITY":O=T.apply;break;case"HIERARCHICAL":O=x.apply;break;case"RADIAL_TREE":O=D.apply;break;case"SMART_TREE":O=b.apply;break;default:O=w.apply}n.forEach((({typeName:a,feature:i})=>{if(t?.lockedNodeLocations?.has(i.attributes[c])){"GEOGRAPHIC"===e&&this.dataManager.geographicLookup.has(a)?L[Q]=N.IsGeographic:L[Q]=N.None;const n=t.lockedNodeLocations.get(i.attributes[c]);C[Q]=n.x,M[Q]=n.y}else if("GEOGRAPHIC"===e&&this.dataManager.geographicLookup.has(a)){L[Q]=N.IsGeographic;let e=null;const t=i.attributes[this.dataManager.geographicLookup.get(a).name],n=this.dataManager.geographicLookup.get(a)?.geometryType;switch(n){case"esriGeometryPoint":C[Q]=t?.x,M[Q]=t?.y;break;case"esriGeometryPolygon":e=t?.centroid,null!=e?.x&&null!=e?.y?(C[Q]=e.x,M[Q]=e.y):L[Q]=N.IsMovable;break;case"esriGeometryPolyline":case"esriGeometryMultipoint":e=t?.extent?.center,null!=e?.x&&null!=e?.y?(C[Q]=e.x,M[Q]=e.y):L[Q]=N.IsMovable;break;default:L[Q]=N.IsMovable}(null==C[Q]||null==M[Q]||Number.isNaN(C[Q])||Number.isNaN(M[Q]))&&(L[Q]=N.IsMovable,C[Q]=0,M[Q]=0)}else L[Q]=N.IsMovable,C[Q]=0,M[Q]=0;k.set(i.attributes[c],Q),A[Q]={feature:i,typeName:a},Q++}));let H=!1;const K=new Map;s.forEach((e=>{const t=e.feature.attributes[u],a=e.feature.attributes[y],i=k.get(t),n=k.get(a);if(void 0!==i&&void 0!==n){const s=t+"-"+a,r=K.get(s),h=r?.has(e.typeName);h||(I[F]=i,v[F]=n,void 0===r?K.set(s,new Map([[e.typeName,F]])):r.set(e.typeName,F),F++),o.push(e)}else H=!0,this.relationshipLinkChartDiagramLookup.set(t,null),this.linkChartGeohashLookup.set(t,null)})),H&&i.getLogger(this).warn("A relationship is a member of this layer that has either origin or destination entity nodes that are not members. The diagram geometry will be set to null"),await G();const{success:$,links:B}=O(L,C,M,I.subarray(0,F),v.subarray(0,F));if(!$)throw new a("knowledge-graph:layout-failed","Attempting to arrange the records in the specified layout failed");for(let a=0;a<A.length;a++){if(M[a]>84.9999?M[a]=84.9999:M[a]<-84.9999&&(M[a]=-84.9999),C[a]>179.9999?C[a]=179.9999:C[a]<-179.9999&&(C[a]=-179.9999),A[a].feature.attributes[m]=new j(C[a],M[a]),h.has(A[a].typeName)){const e=h.get(A[a].typeName);e?.set(A[a].feature.attributes[c],A[a].feature)}else{const e=new Map;e.set(A[a].feature.attributes[c],A[a].feature),h.set(A[a].typeName,e)}d.set(A[a].feature.attributes[c],A[a].feature);const e=l(A[a].feature.attributes[m]);this.entityLinkChartDiagramLookup.set(A[a].feature.attributes[c],A[a].feature.attributes[m]?e:null),this.linkChartGeohashLookup.set(A[a].feature.attributes[c],r(A[a].feature.attributes[m].y,A[a].feature.attributes[m].x,f)),A[a].feature.attributes[m].x<z.xmin&&(z.xmin=A[a].feature.attributes[m].x),A[a].feature.attributes[m].x>z.xmax&&(z.xmax=A[a].feature.attributes[m].x),A[a].feature.attributes[m].y<z.ymin&&(z.ymin=A[a].feature.attributes[m].y),A[a].feature.attributes[m].y>z.ymax&&(z.ymax=A[a].feature.attributes[m].y)}if(this.linkChartExtent.xmin=z.xmin,this.linkChartExtent.xmax=z.xmax,this.linkChartExtent.ymin=z.ymin,this.linkChartExtent.ymax=z.ymax,!B)throw new a("knowledge-graph:layout-failed","Attempting to retrieve link geometry from diagram engine failed");const W=new Map,Y=new Map,q=new Map,J=new Set;for(let a=0;a<o.length;a++){const e=[],t=o[a],n=t.feature.attributes[u],s=t.feature.attributes[y],r=n+"-"+s,h=K.get(r).get(t.typeName),g=0===h?0:B?.vertexEndIndex[h-1];if(!J.has(h)){if(J.add(h),B.types[h]===R.Recursive){const t=[B.vertices[2*g],B.vertices[2*g+1]],a=[B.vertices[2*(g+1)],B.vertices[2*(g+1)+1]],i=[.5*(t[0]+a[0]),.5*(t[1]+a[1])],n=[i[0]-t[0],i[1]-t[1]],s=[i[0]+n[1],i[1]-n[0]],o=[i[0]-n[1],i[1]+n[0]];e.push(t),e.push(s),e.push(a),e.push(o),e.push(t)}else{if(B.types[h]!==R.Regular){i.getLogger(this).warn("A relationship generated an unsupported link geometry type. It will not be rendered");continue}for(let t=g;t<B.vertexEndIndex[h];t++)e.push([B.vertices[2*t],B.vertices[2*t+1]])}const t=A[k.get(n)]?.feature.attributes[m],a=A[k.get(s)]?.feature.attributes[m];e[0][0]===t.x&&e[0][1]===t.y||(e[0]=[t.x,t.y]),e[e.length-1][0]===a.x&&e[e.length-1][1]===a.y||(e[e.length-1]=[a.x,a.y]);for(let i=1;i<e.length-1;i++)e[i][1]>85.5?e[i][1]=85.5:e[i][1]<-85.5&&(e[i][1]=-85.5),e[i][0]>179.9999?e[i][0]=179.9999:e[i][0]<-179.9999&&(e[i][0]=-179.9999);W.has(r)?W.get(r).push(e):W.set(r,[e])}const f=W.get(r);Y.has(r)||(Y.set(r,new Map),q.set(r,new Map));const L=Y.get(r),C=q.get(r);L.has(t.typeName)||(L.set(t.typeName,f.shift()),C.set(t.typeName,0));const M=L.get(t.typeName);C.set(t.typeName,C.get(t.typeName)+1);const w=new P({paths:M});if(t.feature.attributes[m]=w,p.has(t.typeName)){const e=p.get(t.typeName);e?.set(t.feature.attributes[c],t.feature)}else{const e=new Map;e.set(t.feature.attributes[c],t.feature),p.set(t.typeName,e)}d.set(t.feature.attributes[c],t.feature);const b=l(t.feature.attributes[m]);this.relationshipLinkChartDiagramLookup.set(t.feature.attributes[c],t.feature.attributes[m]?b:null),this.linkChartGeohashLookup.set(t.feature.attributes[c],"")}for(const a of o)a.feature.attributes[g]=q.get(a.feature.attributes[u]+"-"+a.feature.attributes[y])?.get(a.typeName)??null;return this._currentLinkChartConfig={layoutMode:e},{nodes:h,links:p,idMap:d}}async applyNewLinkChartLayout(e="RADIAL_TREE",t){const a=[];await this.calculateLinkChartLayout(e,t),this.layers.forEach((e=>{a.push(e.refreshCachedQueryEngine())})),await Promise.all(a),this._refreshNamedTypes()}getCurrentNodeLocations(){const e=new Map;return this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach((t=>{t?.members?.forEach((t=>{const a=t.linkChartLocation;let i;const n=t.id;a&&(i="x"in a?{x:a.x,y:a.y}:{x:a.coords[0],y:a.coords[1]},e.set(n,new j({x:i.x,y:i.y})))}))})),e}async synchronizeInclusionListWithCache(){return new Promise((e=>{this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach(((e,t)=>{if(e.useAllData=!1,e.members&&e.members.size>0){if(!this.dataManager.sublayerCaches.get(t))return;const a=new Set(Array.from(this.dataManager.sublayerCaches.get(t).keys()));Array.from(e.members.keys()).filter((e=>!a.has(e))).forEach((t=>{e.members?.delete(t)}))}})),e()}))}async refreshLinkChartCache(e){await this.dataManager.refreshCacheContent(e);const t=[];this.layers.forEach((e=>{t.push(e.refreshCachedQueryEngine())})),await Promise.all(t),this._refreshNamedTypes()}async _handleNewRecords(e){const t=[];this.dataManager.addToLayer(e);for(const a of e)this.sublayerIdsCache.has(a.typeName)||(this.sublayerIdsCache.set(a.typeName,new Set),t.push(a.typeName)),this.sublayerIdsCache.get(a.typeName).add(a.id);for(const a of t)if(this._graphTypeLookup.has(a)){const e=this._graphTypeLookup.get(a),t="endPoints"in e?"relationship":"entity",i=new k({objectType:e,parentCompositeLayer:this,graphType:t,title:a});"entity"===t?this.dataManager.entityTypeNames.add(a):this.dataManager.relationshipTypeNames.add(a),i.geometryType?this.layers.push(i):this.tables.push(i),this.dataManager.sublayerCaches.set(a,new Map)}await this.dataManager.refreshCacheContent(e.map((e=>e.id))),await this.applyNewLinkChartLayout(this._currentLinkChartConfig.layoutMode)}async _initializeDiagram(){this.defaultLinkChartConfig?this.defaultLinkChartConfig.doNotRecalculateLayout?(this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach(((e,t)=>{e?.members?.forEach((e=>{const a=e.linkChartLocation;let i;const n=e.id;if(!a)return;i="x"in a?{x:a.x,y:a.y}:{x:a.coords[0],y:a.coords[1]};const s=l(i);this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(n,s):this.entityLinkChartDiagramLookup.set(n,s),this.linkChartGeohashLookup.set(n,r(i.x,i.y,f)),this.linkChartExtent.xmin>i.x&&(this.linkChartExtent.xmin=i.x),this.linkChartExtent.xmax<i.x&&(this.linkChartExtent.xmax=i.x),this.linkChartExtent.ymin>i.y&&(this.linkChartExtent.ymin=i.y),this.linkChartExtent.ymax<i.y&&(this.linkChartExtent.ymax=i.y)}))})),this.memberRelationshipTypes.forEach((e=>{e.name&&this.dataManager.sublayerCaches.get(e.name)?.forEach((e=>{const t=this.relationshipLinkChartDiagramLookup.get(e.attributes[u]),a=this.relationshipLinkChartDiagramLookup.get(e.attributes[y]);if(t&&a){const i=l(new P({paths:[[t.coords[0],t.coords[1]],[a.coords[0],a.coords[1]]]}));this.relationshipLinkChartDiagramLookup.set(e.attributes[c],i)}else this.relationshipLinkChartDiagramLookup.set(e.attributes[c],null);this.linkChartGeohashLookup.set(e.attributes[c],"")}))}))):await this.calculateLinkChartLayout(this.defaultLinkChartConfig.layoutMode,{lockedNodeLocations:this.getCurrentNodeLocations()}):await this.calculateLinkChartLayout("RADIAL_TREE",{lockedNodeLocations:this.getCurrentNodeLocations()})}_refreshNamedTypes(){for(const e of this.layers)e.emit("refresh",{dataChanged:!0});for(const e of this.tables)e.emit("refresh",{dataChanged:!0})}};e([s()],z.prototype,"dataPreloadedInLocalCache",void 0),e([s()],z.prototype,"defaultLinkChartConfig",void 0),e([s()],z.prototype,"dataManager",void 0),e([s()],z.prototype,"knowledgeGraph",void 0),e([s()],z.prototype,"layers",void 0),e([s()],z.prototype,"entityLinkChartDiagramLookup",void 0),e([s()],z.prototype,"relationshipLinkChartDiagramLookup",void 0),e([s()],z.prototype,"linkChartExtent",void 0),e([s()],z.prototype,"linkChartGeohashLookup",void 0),e([s()],z.prototype,"memberEntityTypes",void 0),e([s()],z.prototype,"memberRelationshipTypes",void 0),e([s()],z.prototype,"sublayerIdsCache",void 0),e([s()],z.prototype,"tables",void 0),e([s({json:{read:!1}})],z.prototype,"type",void 0),z=e([o("esri.layers.LinkChartLayer")],z);const O=z;export{O 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 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};
|