@arcgis/core 5.0.0-next.36 → 5.0.0-next.37
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/WebLinkChart.js +1 -1
- package/analysis/ShadowCast/types.d.ts +2 -0
- package/applications/Components/analysisUtils.d.ts +1 -0
- package/applications/Components/analysisUtils.js +1 -1
- package/arcade/arcadeAsyncRuntime.js +1 -1
- package/arcade/arcadeCompiler.js +1 -1
- package/arcade/featureSetUtils.js +1 -1
- package/arcade/featureset/actions/Adapted.js +1 -1
- package/arcade/featureset/actions/AttributeFilter.js +1 -1
- package/arcade/featureset/actions/GroupBy.js +1 -1
- package/arcade/featureset/actions/SpatialFilter.js +1 -1
- package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
- package/arcade/featureset/sources/FeatureLayerMemory.js +1 -1
- package/arcade/featureset/sources/FeatureLayerOGC.js +1 -1
- package/arcade/featureset/sources/FeatureLayerRelated.js +1 -1
- package/arcade/featureset/support/FeatureSet.js +1 -1
- package/arcade/featureset/support/FeatureSetIterator.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/014dbe6fa93a277b08f7.js +1 -0
- package/assets/esri/core/workers/chunks/{51355866a0dcf41cfded.js → 0a5427127634738aa239.js} +1 -1
- package/assets/esri/core/workers/chunks/{c7c721de93bc8688e13c.js → 1d4ea8db272655c0608c.js} +1 -1
- package/assets/esri/core/workers/chunks/1d566539ff6fb6ac798c.js +1 -0
- package/assets/esri/core/workers/chunks/1de216d9850c39c1735d.js +1 -0
- package/assets/esri/core/workers/chunks/262232437d37a7460b11.js +1 -0
- package/assets/esri/core/workers/chunks/{1817cf11e85afca947d3.js → 328106e181e5957ceaa5.js} +1 -1
- package/assets/esri/core/workers/chunks/{d3db7244fac7398cc700.js → 4b6a44c6265c8959abd8.js} +1 -1
- package/assets/esri/core/workers/chunks/{f1ac1c8b1331ec79e898.js → 59ce992d3a5e7c32b9fb.js} +1 -1
- package/assets/esri/core/workers/chunks/{8a946cbc816f373c136b.js → 5e30acfda04f7fc2b676.js} +1 -1
- package/assets/esri/core/workers/chunks/6330d8767ba1d5329daa.js +1 -0
- package/assets/esri/core/workers/chunks/{3f03165487c1c2340fff.js → 690a40d2eef52bfc149f.js} +1 -1
- package/assets/esri/core/workers/chunks/{dd34d56caafa38d4b8e4.js → 7aa730e5ac7b268e3c98.js} +1 -1
- package/assets/esri/core/workers/chunks/{1fa55d4c4b092a98bdd7.js → b56c07c0b43cb1999070.js} +1 -1
- package/assets/esri/core/workers/chunks/{24a3c6f0154787968724.js → c5967133f3ba34a883f8.js} +1 -1
- package/assets/esri/core/workers/chunks/{bfb9cbe59d36d18f9157.js → cda5c95fd49b8901f7d4.js} +1 -1
- package/assets/esri/core/workers/chunks/{b451dc416eebd0931ef8.js → ce8fc1ca229d53a4b68d.js} +6 -6
- package/assets/esri/core/workers/chunks/{c9e7cc5d853908ab5b2f.js → ce99abfdcd71ff9e4e36.js} +1 -1
- package/assets/esri/core/workers/chunks/{726a797f5df7eeee0b3d.js → d786b17cc9062b1450ac.js} +1 -1
- package/assets/esri/core/workers/chunks/{2e76fbd3c874300fc4a7.js → de3da4d31a7529761565.js} +1 -1
- package/assets/esri/core/workers/chunks/{eb6218634a492667506a.js → e501d68a1464805c4b4e.js} +1 -1
- package/assets/esri/core/workers/chunks/{33431e8131f6017de2f9.js → e7f4d135ef9665de1468.js} +1 -1
- package/assets/esri/core/workers/chunks/{d8623f5f13a084e439c2.js → e9bc3c6482ba778c9349.js} +37 -37
- package/assets/esri/core/workers/chunks/{7420fa18ba12014b22ea.js → ee67c8a7c1f8b482cd99.js} +1 -1
- package/assets/esri/core/workers/chunks/{abb05a903440d97a6a74.js → f441fc74451330384fb0.js} +1 -1
- package/assets/esri/core/workers/chunks/f609b256df9eb3803464.js +1 -0
- package/assets/esri/core/workers/chunks/f97a7cb367634353177d.js +1 -0
- package/chunks/CloudsComposition.glsl.js +1 -1
- package/chunks/ComponentShader.glsl.js +2 -2
- package/chunks/DefaultMaterial.glsl.js +1 -1
- package/chunks/GaussianSplat.glsl.js +2 -2
- package/chunks/Laserlines.glsl.js +1 -1
- package/chunks/Path.glsl.js +1 -1
- package/chunks/RealisticTree.glsl.js +1 -1
- package/chunks/Terrain.glsl.js +34 -36
- package/chunks/WaterSurface.glsl.js +1 -1
- package/chunks/boundedPlane.js +1 -1
- package/chunks/cameraUtilsSpherical.js +1 -1
- package/chunks/vec32.js +1 -1
- package/config.js +1 -1
- package/core/has.js +1 -1
- package/core/iteratorUtils.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/geometry/support/lineSegment.js +1 -1
- package/geometry/support/meshUtils/merge.js +1 -1
- package/geometry/support/sphere.js +1 -1
- package/interfaces.d.ts +35 -5
- package/kernel.js +1 -1
- package/layers/Lyr3DWasmPerSceneView.js +1 -1
- package/layers/VoxelWasmPerSceneView.js +1 -1
- package/layers/knowledgeGraph/layerUtils.js +1 -1
- package/layers/orientedImagery/transformations/worldToImage.js +1 -1
- package/layers/support/csvUtils.js +1 -1
- package/layers/video/VideoController.js +1 -1
- package/layers/voxel/VoxelVolume.js +1 -1
- package/package.json +5 -5
- package/support/revision.js +1 -1
- package/views/2d/analysis/ElevationProfile/ElevationProfileLineVisualization2D.js +1 -1
- package/views/2d/interactive/SegmentLabels2D.js +1 -1
- package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
- package/views/3d/FocusAreasView.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/lengthDimensionUtils.js +1 -1
- package/views/3d/analysis/ElevationProfile/ElevationProfileLineVisualization3D.js +1 -1
- package/views/3d/analysis/ElevationProfile/ElevationProfileVisualization3D.js +1 -1
- package/views/3d/analysis/ElevationProfileAnalysisView3D.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/sliceToolUtils.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedScaleOrientManipulation.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedSubVisualization.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
- package/views/3d/animation/pointToPoint/Camera.js +1 -1
- package/views/3d/camera/constraintUtils/distance.js +1 -1
- package/views/3d/camera/constraintUtils/tilt.js +1 -1
- package/views/3d/environment/ChapmanAtmosphere.js +1 -1
- package/views/3d/environment/CloudsParameters.js +1 -1
- package/views/3d/environment/EnvironmentManager.js +1 -1
- package/views/3d/environment/MarsAtmosphere.js +1 -1
- package/views/3d/interactive/SegmentLabels3D.js +1 -1
- package/views/3d/interactive/editingTools/manipulations/MoveZManipulation.js +1 -1
- package/views/3d/interactive/editingTools/media/MediaElementManipulator3D.js +1 -1
- package/views/3d/interactive/editingTools/reshape/edgeOffsetUtils.js +1 -1
- package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
- package/views/3d/interactive/visualElements/MeasurementArrowVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
- package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
- package/views/3d/layers/GraphicsLayerView3D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/ImagerySubView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/RouteLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DGraphicsPipeline.js +1 -1
- package/views/3d/layers/graphics/Graphics3DScaleVisibility.js +1 -1
- package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
- package/views/3d/layers/graphics/pipeline/rendering/DirectRenderer.js +1 -1
- package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
- package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
- package/views/3d/layers/support/FeatureTileMeasurements3D.js +1 -1
- package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
- package/views/3d/state/Frustum.js +1 -1
- package/views/3d/state/ViewStateManager.js +1 -1
- package/views/3d/state/controllers/FovController.js +1 -1
- package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
- package/views/3d/state/controllers/momentum/ZoomPlanarMomentumController.js +1 -1
- package/views/3d/support/FrustumExtentIntersection.js +1 -1
- package/views/3d/support/cameraUtils.js +1 -1
- package/views/3d/support/intersectionUtils.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/viewpointUtils.js +1 -1
- package/views/3d/terrain/OverlayManager.js +1 -1
- package/views/3d/terrain/OverlayRenderer.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/terrain/TileCompositor.js +1 -1
- package/views/3d/webgl/RenderCamera.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechnique.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js +4 -7
- package/views/3d/webgl-engine/core/shaderLibrary/hud/HUD.glsl.js +6 -6
- package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateAmbientLighting.glsl.js +4 -4
- package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +19 -15
- package/views/3d/webgl-engine/core/shaderLibrary/shading/MainLighting.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/TerrainTexture.glsl.js +5 -5
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/TileBackground.glsl.js +14 -14
- package/views/3d/webgl-engine/core/shaderLibrary/util/BlendModes.glsl.js +16 -37
- package/views/3d/webgl-engine/effects/RenderPluginManager.js +1 -1
- package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
- package/views/3d/webgl-engine/effects/geometry/RenderOccludedRenderNode.js +1 -1
- package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
- package/views/3d/webgl-engine/effects/transparency/OITBlend.js +1 -1
- package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
- package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/Normals.js +1 -1
- package/views/3d/webgl-engine/lib/Object3D.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
- package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/Viewshed.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/triangleIntersectionUtils.js +1 -1
- package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/SlicePlaneMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/VaoRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/VaoWriter.js +1 -1
- package/views/3d/webgl-engine/shaders/ColorMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/GaussianSplat.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/GaussianSplatTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/ImageMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/LineMarkerTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/NativeLineTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js +9 -10
- package/views/3d/webgl-engine/shaders/PatternTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/SphereDepthInterpolate.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/Terrain.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/TerrainTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/TerrainTechniqueConfiguration.js +1 -1
- package/views/GroundView.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/analysis/ElevationProfile/elevationProfileVisualizationUtils.js +1 -1
- package/views/interactive/GraphicManipulator.js +1 -1
- package/views/interactive/coordinateHelper.js +1 -1
- package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
- package/views/interactive/sketch/constraints.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/LineSnappingHint.js +1 -1
- package/views/interactive/tooltip/tooltipCommonUtils.js +1 -1
- package/views/layers/LayerView.js +1 -1
- package/views/navigation/PanSphericalMomentumEstimator.js +1 -1
- package/views/support/LayerViewManager.js +1 -1
- package/views/support/euclideanAreaMeasurementUtils.js +1 -1
- package/views/support/euclideanLengthMeasurementUtils.js +1 -1
- package/views/support/geodesicLengthMeasurementUtils.js +1 -1
- package/views/support/geometry3dUtils.js +1 -1
- package/webmap/utils.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/11687718c8635eb7bf37.js +0 -1
- package/assets/esri/core/workers/chunks/15c1a48e8cd2a8882d85.js +0 -1
- package/assets/esri/core/workers/chunks/1b9e7d416c9f00e020bb.js +0 -1
- package/assets/esri/core/workers/chunks/5000a37fba27464d10ca.js +0 -1
- package/assets/esri/core/workers/chunks/b075d3714fab0591d67c.js +0 -1
- package/assets/esri/core/workers/chunks/d8975dd7b85b5d065ee4.js +0 -1
- package/assets/esri/core/workers/chunks/f43e1e1a1b2eb737e00c.js +0 -1
package/interfaces.d.ts
CHANGED
|
@@ -1645,8 +1645,13 @@ declare namespace __esri {
|
|
|
1645
1645
|
* {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-analysis-ShadowCast-types.html Read more...}
|
|
1646
1646
|
*/
|
|
1647
1647
|
namespace types {
|
|
1648
|
+
export type ShadowCastMode = "duration" | "discrete" | "threshold";
|
|
1649
|
+
export type ShadowCastDurationMode = "continuous" | "hourly";
|
|
1648
1650
|
}
|
|
1649
1651
|
|
|
1652
|
+
export type ShadowCastDurationMode = "continuous" | "hourly";
|
|
1653
|
+
export type ShadowCastMode = "duration" | "discrete" | "threshold";
|
|
1654
|
+
|
|
1650
1655
|
export class ShadowCastAnalysis extends Analysis {
|
|
1651
1656
|
/**
|
|
1652
1657
|
* Time (in milliseconds from midnight of the {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-analysis-ShadowCastAnalysis.html#date date}) when the shadow cast computation should stop.
|
|
@@ -2396,6 +2401,12 @@ declare namespace __esri {
|
|
|
2396
2401
|
* @param length The length to check.
|
|
2397
2402
|
*/
|
|
2398
2403
|
isAboveGeodesicDistanceThreshold(length: Length): boolean;
|
|
2404
|
+
/**
|
|
2405
|
+
* Note: reserved for internal use only, this is not part of the stable public API.
|
|
2406
|
+
*
|
|
2407
|
+
* Sets the elevation profile to a test configuration which removes timeouts, throtting, etc to make tests faster.
|
|
2408
|
+
*/
|
|
2409
|
+
setElevationProfileTestConfig(): WatchHandle;
|
|
2399
2410
|
}
|
|
2400
2411
|
|
|
2401
2412
|
export const analysisUtils: analysisUtils;
|
|
@@ -100093,9 +100104,6 @@ declare namespace __esri {
|
|
|
100093
100104
|
constructor();
|
|
100094
100105
|
}
|
|
100095
100106
|
|
|
100096
|
-
export type ShadowCastDurationMode = "continuous" | "hourly";
|
|
100097
|
-
export type ShadowCastMode = "duration" | "discrete" | "threshold";
|
|
100098
|
-
|
|
100099
100107
|
/**
|
|
100100
100108
|
* Types for the various interactive analyses.
|
|
100101
100109
|
*
|
|
@@ -109844,6 +109852,28 @@ declare namespace __esri {
|
|
|
109844
109852
|
* {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-WebLinkChart.html#removeRecords Read more...}
|
|
109845
109853
|
*/
|
|
109846
109854
|
removeRecords(records: IdTypePair[], options?: WebLinkChartRemoveRecordsOptions): Promise<IdTypePair[]>;
|
|
109855
|
+
/**
|
|
109856
|
+
* Creates a WebLinkChart from a Cypher query against a knowledge graph service.
|
|
109857
|
+
*
|
|
109858
|
+
* @param kg The knowledge graph service to query.
|
|
109859
|
+
* @param queryArguments The cypher query and parameters to execute against the knowledge graph service.
|
|
109860
|
+
* @param initializationLinkChartConfig Configuration options for initializing the link chart layer.
|
|
109861
|
+
* @param requestOptions Additional options for the request.
|
|
109862
|
+
*
|
|
109863
|
+
* {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-WebLinkChart.html#fromCypherQuery Read more...}
|
|
109864
|
+
*/
|
|
109865
|
+
static fromCypherQuery(kg: KnowledgeGraph, queryArguments: GraphQueryStreaming, initializationLinkChartConfig?: InitializationLinkChartConfig, requestOptions?: RequestOptions): Promise<WebLinkChart>;
|
|
109866
|
+
/**
|
|
109867
|
+
* Creates a WebLinkChart from an array of id-type pairs against a knowledge graph service.
|
|
109868
|
+
*
|
|
109869
|
+
* @param kg The knowledge graph service to query.
|
|
109870
|
+
* @param idTypePairs An array of objects with an id and named type for each record to include in the link chart.
|
|
109871
|
+
* @param initializationLinkChartConfig Configuration options for initializing the link chart layer.
|
|
109872
|
+
* @param requestOptions Additional options for the request.
|
|
109873
|
+
*
|
|
109874
|
+
* {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-WebLinkChart.html#fromIdTypePairs Read more...}
|
|
109875
|
+
*/
|
|
109876
|
+
static fromIdTypePairs(kg: KnowledgeGraph, idTypePairs: IdTypePair[], initializationLinkChartConfig?: InitializationLinkChartConfig, requestOptions?: RequestOptions): Promise<WebLinkChart>;
|
|
109847
109877
|
}
|
|
109848
109878
|
|
|
109849
109879
|
interface WebLinkChartProperties extends WebDocument2DProperties {
|
|
@@ -119329,7 +119359,7 @@ declare namespace __esri {
|
|
|
119329
119359
|
/**
|
|
119330
119360
|
* Returns the instance of `Edits` corresponding to the given feature.
|
|
119331
119361
|
*
|
|
119332
|
-
* @param feature Either of the two Graphics created by the workflow.
|
|
119362
|
+
* @param feature Either of the two {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html Graphics} created by the workflow.
|
|
119333
119363
|
*
|
|
119334
119364
|
* {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Editor-SplitFeatureWorkflowData.html#getEditsForFeature Read more...}
|
|
119335
119365
|
*/
|
|
@@ -119338,7 +119368,7 @@ declare namespace __esri {
|
|
|
119338
119368
|
* Identifies whether the given {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html Graphic} represents
|
|
119339
119369
|
* the feature to be updated or the feature to be created.
|
|
119340
119370
|
*
|
|
119341
|
-
* @param feature Either of the two Graphics created by the workflow.
|
|
119371
|
+
* @param feature Either of the two {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html Graphics} created by the workflow.
|
|
119342
119372
|
*
|
|
119343
119373
|
* {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Editor-SplitFeatureWorkflowData.html#getRoleForFeature Read more...}
|
|
119344
119374
|
*/
|
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/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="5.0";let s,r=e;function i(o){s=o}function t(e){const r=s?.findCredential(e);return r?.token?o(e,"token",r.token):e}r="5.0.0-next.
|
|
5
|
+
import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="5.0";let s,r=e;function i(o){s=o}function t(e){const r=s?.findCredential(e);return r?.token?o(e,"token",r.token):e}r="5.0.0-next.37",has("host-webworker")||globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),has("host-webworker");export{t as addTokenParameter,r as fullVersion,s as id,i as setId,e 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/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../request.js";import i from"../core/Accessor.js";import s from"../core/Logger.js";import{isAbortError as r}from"../core/promiseUtils.js";import{watch as a}from"../core/reactiveUtils.js";import{addFrameTask as n}from"../core/scheduling.js";import{property as o,subclass as l}from"../core/accessorSupport/decorators.js";import{clone as d}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{B as h}from"../chunks/vec32.js";import{canProjectWithoutEngine as _}from"../geometry/projectionUtils.js";import{projectBuffer as u}from"../geometry/projection/projectBuffer.js";import{containsXY as y}from"../geometry/support/aaBoundingRect.js";import{earth as c}from"../geometry/support/Ellipsoid.js";import{isGeographic as g}from"../geometry/support/spatialReferenceUtils.js";import m from"../geometry/support/WKIDUnitConversion.js";import{wasmFailedToInit as w,invalidLayerView as p}from"./ILyr3DWasmPerSceneView.js";import{Lyr3DWorkerHandle as f}from"./Lyr3DWorkerHandle.js";import{loadLyr3DMainWASM as b}from"../libs/lyr3d/Lyr3DModule.js";import{getElevationOffsetInMeters as v}from"../support/elevationInfoUtils.js";import{makeScheduleFunction as M}from"../views/3d/layers/support/makeScheduleFunction.js";const D=3857,L=32662,k=4326,R=5773,S=115700;let C=class extends i{constructor(e){super(e),this._lyr3DMainPromise=null,this._lyr3DMain=null,this._layers=new Map,this._viewSR=null,this._lyr3DBusyCount=0,this._updateCameraElevation=0,this._debugFlags=new Set,this._debugLevel=2,this._wasmNotLoaded="method requiring WASM was called when WASM isn't loaded",this._pulseTaskHandle=null,this._debugFlags.add(0),this._debugFlags.add(1),this._debugFlags.add(2)}_debugLog(e,t,i,r=!0){if(this._debugFlags.has(e)&&this._debugLevel>=t){const e=r?`[js] ${i}`:`${i}`;0===t||1===t?s.getLogger(this).error(e):2===t&&s.getLogger(this).warn(e),s.getLogger(this).info(e)}}initialize(){this._debugLevel>2&&(s.getLogger(this).level="info"),this._debugLog(0,3,"Lyr3DWasmPerSceneView.initialize()"),this.addHandles([this._createElevationUpdateHandle(),a(()=>this.view.state?.contentCamera,()=>this._updateWasmCamera())]),this._pulseTaskHandle=n({preRender:()=>this._pulseTask()})}destroy(){this._debugLog(0,3,"Lyr3DWasmPerSceneView.destroy()"),this._lyr3DMain&&(this._layers.forEach(e=>{e.abortController.abort()}),this._lyr3DMain.uninitialize_lyr3d_wasm(),this._lyr3DMain=null);const e=this._workerHandle;e&&e.destroyWasm().then(()=>{this._workerHandle?.destroy(),this._workerHandle=null}),this._pulseTaskHandle?.remove(),this._pulseTaskHandle=null}addLayerView(e){return this._lyr3DMain?this._addLayerView(e):(this._debugLog(0,1,"Lyr3DWasmPerSceneView.add3DTilesLayerView() called when WASM wasn't initialized"),{wasmLayerId:w})}removeLayerView(e){if(!this._lyr3DMain)return this._debugLog(0,1,this._wasmNotLoaded),0;this._doRemoveLayerView(e);const t=this._layers.size;return 0===t&&(this._debugLog(0,3,"Lyr3DWasmPerSceneView.remove3DTilesLayerView() no Lyr3D layers left after removing a layer, destroying"),this.destroy()),t}getValidLayerViewCount(){if(!this._lyr3DMain)return this._debugLog(0,1,this._wasmNotLoaded),0;let e=0;return this._layers.forEach(t=>{t.layerView.wasmLayerId>=0&&++e}),e}setEnabled(e,t){if(!this._lyr3DMain)return void this._debugLog(0,1,this._wasmNotLoaded);const i=this._layers.get(e.wasmLayerId);if(i){this._lyr3DMain.set_enabled(e.wasmLayerId,t),i.needMemoryUsageUpdate=!0;const s=this._isUpdating(i);i.needFrame=!0,s||i.layerView.updatingFlagChanged()}}setLayerOffset(e,t){if(!this._lyr3DMain)return void this._debugLog(0,1,this._wasmNotLoaded);this._layers.get(e.wasmLayerId)&&this._lyr3DMain.set_carto_offset_z(e.wasmLayerId,t)}getAttributionText(){if(!this._lyr3DMain)return this._debugLog(0,1,this._wasmNotLoaded),[];return this._lyr3DMain.get_current_attribution_text().split("|")}onRenderableEvicted(e,t,i){if(!this._lyr3DMain)return void this._debugLog(0,1,this._wasmNotLoaded);this._layers.get(e.wasmLayerId)&&this._lyr3DMain.on_renderable_evicted(e.wasmLayerId,t,i)}setMeshModifications(e,t,i){if(!this._lyr3DMain)return void this._debugLog(0,1,this._wasmNotLoaded);const s=this._layers.get(e.wasmLayerId);if(s){const r=this._lyr3DMain._malloc(8*t.length),a=new Float64Array(this._lyr3DMain.HEAPF64.buffer,r,t.length);for(let e=0;e<t.length;++e)a[e]=t[e];this._lyr3DMain.set_mesh_modification_polygons(e.wasmLayerId,r,t.length,i),this._lyr3DMain._free(r);const n=this._isUpdating(s);s.needFrame=!0,n||s.layerView.updatingFlagChanged()}}isUpdating(e){if(!this._lyr3DMain&&this._lyr3DMainPromise)return!0;const t=this._layers.get(e);return!!t&&(t.outstandingJobCount>0||t.outstandingRenderableCount>0||t.needFrame||this._lyr3DBusyCount>0)}initializeWasm(e,t){return this._lyr3DMain?Promise.resolve():this.view.renderSpatialReference?(this._debugLog(0,3,"Lyr3DWasmPerSceneView.initializeWasm()"),this._lyr3DMainPromise||(this._lyr3DMainPromise=b().then(i=>{this._lyr3DMain=i,this._lyr3DMainPromise=null;const s=this._lyr3DMain.addFunction(this._onNewJob.bind(this),"v"),r=this._lyr3DMain.addFunction(this._onNewRenderable.bind(this),"v"),a=this._lyr3DMain.addFunction(this._freeRenderables.bind(this),"viii"),n=this._lyr3DMain.addFunction(this._setRenderableVisibility.bind(this),"viiii"),o=this._lyr3DMain.addFunction(this._onWasmError.bind(this),"viiii");if(!this.view.renderSpatialReference)return void(this._lyr3DMain=null);this._viewSR=this.view.renderSpatialReference?.toJSON();const l="global"===this.view.viewingMode?5:3;if(5===l)this._viewSR.wkid=this._viewSR.latestWkid=k,this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=R;else if(this.view.renderSpatialReference?.isWebMercator)this._viewSR.wkid=this._viewSR.latestWkid=D,this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=R;else if(this.view.renderSpatialReference?.wkid===L)this._viewSR.wkid=this._viewSR.latestWkid=k,this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=R;else if(!this._viewSR.latestVcsWkid&&!this._viewSR.vcsWkid){const e=this.view.heightModelInfo?.heightModel,t=!e||"gravity-related-height"===e;this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=t?R:S}return this._lyr3DMain.initialize_lyr3d_wasm(o,s,r,a,n,e,t,l,this._cleanUpSR(this._makeSRWasmSerializable(this._viewSR)),Math.max(this._debugLevel,0))?(this._workerHandle=new f(M(this.view.resourceController)),this._workerHandle.promise?this._workerHandle.promise:void 0):(this._lyr3DMain=null,void this._debugLog(0,0,"Lyr3d Main WASM failed to initialize",!1))}).catch(e=>{this._debugLog(0,0,`Lyr3d WASM failed to download error = ${e}`,!1)})),this._lyr3DMainPromise):Promise.reject()}setLodPixelThreshold(e,t){this._lyr3DMain?.set_lod_pixel_threshold(t);const i=this._layers.get(e.wasmLayerId);i&&(i.needFrame=!0)}_pulseTask(){if(this._lyr3DMain){if(this._updateCameraElevation>0){let e=null;const t=this.view.state?.contentCamera;if(t&&this.view.renderSpatialReference){const{eye:i}=t,s=this.view.groundView.getElevation(i[0],i[1],i[2],this.view.renderSpatialReference);if(s){const t=h(i);e="global"===this.view.viewingMode?t-(c.radius+s):i[2]-s}}e?(this._lyr3DMain.set_camera_altitude(e),this._updateCameraElevation=0):(this._updateCameraElevation-=1,this._updateCameraElevation<=0&&(this._lyr3DMain.set_camera_altitude(0),this._updateCameraElevation=0))}let e=0,t=0;this._layers.forEach(i=>{e+=i.layerView.usedMemory,t+=i.layerView.cachedMemory}),e/=1048576,t/=1048576;const i=this.view.resourceController.memoryController,s=i.usedMemory*i.maxMemory-e;this._lyr3DBusyCount=this._lyr3DMain.frame_pulse(i.memoryFactor,e,t,s,i.maxMemory),this._layers.forEach(e=>{0===this._updateCameraElevation&&(e.needFrame=!1),e.layerView.updatingFlagChanged()})}}_isUpdating(e){return e.outstandingJobCount>0||e.outstandingRenderableCount>0||e.needFrame||this._lyr3DBusyCount>0}_incrementJobCount(e){const t=this._isUpdating(e);e.outstandingJobCount+=1,t||e.layerView.updatingFlagChanged()}_decrementJobCount(e){const t=this._isUpdating(e);e.outstandingJobCount-=1;t!==this._isUpdating(e)&&e.layerView.updatingFlagChanged()}_incrementRenderableCount(e){const t=this._isUpdating(e);e.outstandingRenderableCount+=1,t||e.layerView.updatingFlagChanged()}_decrementRenderableCount(e){const t=this._isUpdating(e);e.outstandingRenderableCount-=1;t!==this._isUpdating(e)&&e.layerView.updatingFlagChanged()}_onJobFailed(e,t,i){t.error.length&&this._debugLog(1,1,t.error,!1),this._lyr3DMain&&this._lyr3DMain.on_job_failed(i.jobId,i.desc),this._decrementJobCount(e)}_onJobSucceeded(e,t,i){if(this._lyr3DMain){if(e.layerView.destroyed)return void this._lyr3DMain.on_job_failed(i.jobId,i.desc);const s=t.data.byteLength,r=this._lyr3DMain._malloc(s);new Uint8Array(this._lyr3DMain.HEAPU8.buffer,r,s).set(t.data),this._lyr3DMain.on_job_completed(i.jobId,t.jobDescJson,r,s),this._lyr3DMain._free(r)}this._decrementJobCount(e)}_getRequestPromises(e,i,s,r){const a=[];for(const n of e){const e=new URL(n);if("integrated-mesh-3dtiles"===r.type){if(e.origin===s.origin&&e.pathname===s.pathname){if(r.rootTileset){a.push(Promise.resolve(r.rootTileset.slice()));continue}}else r.session&&e.searchParams.append("session",r.session)}a.push(t(e.toString(),i).then(e=>e.data))}return a}_getInitialPromise(e,t,i,s,a,n,o){const l=this._getRequestPromises(e.urls,t,i,s);return Promise.all(l).then(e=>(a.inputs=e,this._workerHandle.invoke(a,n))).then(e=>e).catch(t=>{let i=1;return r(t)?this._debugLog(1,2,`job ${e.jobId} was cancelled.`):o&&400===t.details?.httpStatus?(i=3,this._debugLog(1,2,"Session expired, trying to create new Session.")):this._debugLog(1,1,`job ${e.jobId} failed with error ${t}.`),{status:i,error:"",jobDescJson:"",data:new Uint8Array(0),missingInputUrls:[],inputs:[]}})}async _onNewJob(){const e=this._lyr3DMain.get_next_job(),t=this._layers.get(e.layerId);if(!t)return;this._incrementJobCount(t);const i=t.abortController.signal,s=t.layerView.layer,a="integrated-mesh-3dtiles"===s.type?s.key:null,n="integrated-mesh-3dtiles"===s.type?s.session:null,o={responseType:"array-buffer",signal:i,query:{...t.customParameters,token:t.apiKey,key:a}},l={id:e.jobId,inputs:[],jobDescJson:e.desc.slice(),isMissingResourceCase:!1},d=new URL(s.url),h=a=>{if(1===a.status)this._onJobFailed(t,a,e);else if(0===a.status)this._onJobSucceeded(t,a,e);else if(2===a.status){const n=this._getRequestPromises(a.missingInputUrls,o,d,s);Promise.all(n).then(e=>{l.jobDescJson=a.jobDescJson,a.originalInputs?l.inputs=a.originalInputs:l.inputs=[],l.isMissingResourceCase=!0;for(const t of e)l.inputs.push(t);return this._workerHandle.invoke(l,i)}).then(i=>{1===i.status?this._onJobFailed(t,i,e):0===i.status&&this._onJobSucceeded(t,i,e)}).catch(i=>{this._decrementJobCount(t),r(i)?this._debugLog(1,2,`job ${e.jobId} was cancelled.`):this._debugLog(1,1,`job ${e.jobId} failed with error2 ${i}.`),this._lyr3DMain&&this._lyr3DMain.on_job_failed(e.jobId,e.desc)})}};try{const t=await this._getInitialPromise(e,o,d,s,l,i,n);if(3===t.status&&"integrated-mesh-3dtiles"===s.type){n===s.session&&null!==s.session&&await s.requestRootAndSession(i);h(await this._getInitialPromise(e,o,d,s,l,i,s.session))}else h(t)}catch(_){_&&this._debugLog(1,1,_.toString(),!1),this._lyr3DMain&&this._lyr3DMain.on_job_failed(e.jobId,e.desc),this._decrementJobCount(t)}}_onNewRenderable(){const e=this._lyr3DMain.get_next_renderable(),{meshData:t}=e;if(t.data&&t.data.byteLength>0){const e=t.data.slice();t.data=e}const i=this._layers.get(e.layerId);i&&(this._incrementRenderableCount(i),i.layerView.createRenderable(e).then(t=>{this._lyr3DMain?.on_renderable_created(!0,e.layerId,e.handle,t.memUsageBytes),this._decrementRenderableCount(i)}).catch(t=>{r(t)||this._debugLog(2,1,`createRenderable failed with error ${t}.`),this._lyr3DMain?.on_renderable_created(!1,e.layerId,e.handle,0),this._decrementRenderableCount(i)}))}_freeRenderables(e,t,i){if(i<1)return;const s=this._layers.get(e);if(!s)return;const r=s.layerView,a=[],n=new Uint32Array(this._lyr3DMain.HEAPU32.buffer,t,i);for(let o=0;o<i;++o)a.push(n[o]);for(let o=0;o<i;++o)r.freeRenderable(a[o])}_setRenderableVisibility(e,t,i,s){if(s<1)return;const r=this._layers.get(e);if(!r)return;const a=r.layerView,n=[],o=[],l=new Uint32Array(this._lyr3DMain.HEAPU32.buffer,t,s),d=new Uint8Array(this._lyr3DMain.HEAPU8.buffer,i,s);for(let h=0;h<s;++h)n.push(l[h]),o.push(1===d[h]);a.setRenderableVisibility(n,o,s)}_onWasmError(e,t,i,s){this._lyr3DMain&&this._debugLog(i,s,this._lyr3DMain.UTF8ToString(e,t),!1)}_doRemoveLayerView(e){const t=this._layers.get(e.wasmLayerId);return!!t&&(t.abortController.abort(),this._lyr3DMain.remove_layer(e.wasmLayerId),this._layers.delete(e.wasmLayerId),!0)}_isGaussianSplatLayerView(e){return"gaussian-splat"===e.layer.type}_isGaussianSplatLayer(e){return"gaussian-splat"===e.type}_toWasmQuality(e){switch(e){case"low":return 1;case"medium":return 2;case"high":return 3}}_addLayerView(e){const t=e.layer;if(!t.url||!t.rootTilesetJSON)return{wasmLayerId:p};const i="integrated-mesh-3dtiles"===t.type?0:2,r=this._lyr3DMain.validate_root_tileset(JSON.stringify(t.rootTilesetJSON),i);if(0!==r.errorCode)return{wasmLayerId:p,check:r};const a=this._lyr3DMain.get_next_layer_id(),n=new AbortController;this._layers.set(a,{layerView:e,abortController:n,needMemoryUsageUpdate:!1,outstandingJobCount:0,outstandingRenderableCount:0,customParameters:t.customParameters,apiKey:t.apiKey,needFrame:!0});const o=v(t.elevationInfo),l=this._toWasmQuality(this.view?.qualityProfile),d=e=>s.getLogger(this).error("add-spatial-reference-error","Error when adding SR:",e);let h=!1;if(this._isGaussianSplatLayerView(e)&&this._isGaussianSplatLayer(t)){let i=t.spatialReference;if(e.useEsriCrs&&t.esriCrsSpatialReference){i=t.esriCrsSpatialReference;const s=g(i);let r=1,a=1;!s&&i.wkid&&-1!==i.wkid&&(r=m.values[m[i.wkid]],a=e.metersPerVCSUnit),this._workerHandle.addSpatialReferenceInfo(this._cleanUpSR(this._makeSRWasmSerializable(i)),s,r,a).catch(d)}h=this._lyr3DMain.add_gaussian_splat_layer(l,t.url,a,o)}else h=this._lyr3DMain.add_3dtiles_layer(l,t.url,a,o);return h?(this._updateWasmCamera(),e.updatingFlagChanged(),{wasmLayerId:a}):(this._layers.delete(a),{wasmLayerId:p})}_createElevationUpdateHandle(){const e=(e,t)=>{const i=this.view.state?.contentCamera;if(!i||!this._lyr3DMain)return;const s=d(i.eye);if(!_(this.view.renderSpatialReference,t))return;u(s,this.view.renderSpatialReference,0,s,t,0,1);y(e,s[0],s[1])&&(this._updateCameraElevation=5,this._layers.forEach(e=>{const t=this._isUpdating(e);e.needFrame=!0,t||e.layerView.updatingFlagChanged()}))};return this.view.groundView.on("elevation-change",({extent:t,spatialReference:i})=>e(t,i))}_updateWasmCamera(){const e=this.view.state?.contentCamera;if(!e||!this._lyr3DMain)return;const{eye:t,center:i,up:s,near:r,far:a,fovY:n}=e,o=[e.viewport[2],e.viewport[3]],l=e.width/e.height;this._lyr3DMain.set_camera_parameters({eye:t,center:i,up:s,near:r,far:a,fov:n,aspectRatio:l,viewport:o}),this._layers.forEach(e=>{const t=this._isUpdating(e);e.needFrame=!0,t||e.layerView.updatingFlagChanged()})}_makeSRWasmSerializable(e){return{wkid:e?.wkid??-1,latestWkid:e?.latestWkid??-1,vcsWkid:e?.vcsWkid??-1,latestVcsWkid:e?.latestVcsWkid??-1,wkt:e?.wkt??""}}_cleanUpSR(e){return-1===e?.wkid&&e.latestWkid&&-1!==e.latestWkid?e.wkid=e.latestWkid:-1===e?.latestWkid&&e.wkid&&-1!==e.wkid&&(e.latestWkid=e.wkid),-1===e?.vcsWkid&&e.latestVcsWkid&&-1!==e.latestVcsWkid?e.vcsWkid=e.latestVcsWkid:-1===e?.latestVcsWkid&&e.vcsWkid&&-1!==e.vcsWkid&&(e.latestVcsWkid=e.vcsWkid),e}};e([o({constructOnly:!0})],C.prototype,"view",void 0),C=e([l("esri.layers.Lyr3DWasmPerSceneView")],C);const W=C;export{W as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../request.js";import i from"../core/Accessor.js";import s from"../core/Logger.js";import{isAbortError as r}from"../core/promiseUtils.js";import{watch as a}from"../core/reactiveUtils.js";import{addFrameTask as n}from"../core/scheduling.js";import{property as o,subclass as l}from"../core/accessorSupport/decorators.js";import{isGeographic as d}from"../geometry/support/spatialReferenceUtils.js";import h from"../geometry/support/WKIDUnitConversion.js";import{wasmFailedToInit as _,invalidLayerView as y}from"./ILyr3DWasmPerSceneView.js";import{Lyr3DWorkerHandle as u}from"./Lyr3DWorkerHandle.js";import{loadLyr3DMainWASM as c}from"../libs/lyr3d/Lyr3DModule.js";import{getElevationOffsetInMeters as g}from"../support/elevationInfoUtils.js";import{makeScheduleFunction as m}from"../views/3d/layers/support/makeScheduleFunction.js";const w=3857,b=32662,p=4326,f=5773,v=115700;let D=class extends i{constructor(e){super(e),this._lyr3DMainPromise=null,this._lyr3DMain=null,this._layers=new Map,this._viewSR=null,this._lyr3DBusyCount=0,this._debugFlags=new Set,this._debugLevel=2,this._wasmNotLoaded="method requiring WASM was called when WASM isn't loaded",this._pulseTaskHandle=null,this._cameraElevationDirty=!0,this._debugFlags.add(0),this._debugFlags.add(1),this._debugFlags.add(2)}_debugLog(e,t,i,r=!0){if(this._debugFlags.has(e)&&this._debugLevel>=t){const e=r?`[js] ${i}`:`${i}`;0===t||1===t?s.getLogger(this).error(e):2===t&&s.getLogger(this).warn(e),s.getLogger(this).info(e)}}initialize(){this._debugLevel>2&&(s.getLogger(this).level="info"),this._debugLog(0,3,"Lyr3DWasmPerSceneView.initialize()"),this.addHandles([a(()=>this.view.state?.contentCamera,()=>this._updateWasmCamera()),a(()=>this.view.state?.contentCamera.relativeElevation,()=>{this._cameraElevationDirty=!0,this._markAllLayerViewsUpdating()})]),this._pulseTaskHandle=n({preRender:()=>this._pulseTask()})}destroy(){this._debugLog(0,3,"Lyr3DWasmPerSceneView.destroy()"),this._lyr3DMain&&(this._layers.forEach(e=>{e.abortController.abort()}),this._lyr3DMain.uninitialize_lyr3d_wasm(),this._lyr3DMain=null);const e=this._workerHandle;e&&e.destroyWasm().then(()=>{this._workerHandle?.destroy(),this._workerHandle=null}),this._pulseTaskHandle?.remove(),this._pulseTaskHandle=null}addLayerView(e){return this._lyr3DMain?this._addLayerView(e):(this._debugLog(0,1,"Lyr3DWasmPerSceneView.add3DTilesLayerView() called when WASM wasn't initialized"),{wasmLayerId:_})}removeLayerView(e){if(!this._lyr3DMain)return this._debugLog(0,1,this._wasmNotLoaded),0;this._doRemoveLayerView(e);const t=this._layers.size;return 0===t&&(this._debugLog(0,3,"Lyr3DWasmPerSceneView.remove3DTilesLayerView() no Lyr3D layers left after removing a layer, destroying"),this.destroy()),t}getValidLayerViewCount(){if(!this._lyr3DMain)return this._debugLog(0,1,this._wasmNotLoaded),0;let e=0;return this._layers.forEach(t=>{t.layerView.wasmLayerId>=0&&++e}),e}setEnabled(e,t){if(!this._lyr3DMain)return void this._debugLog(0,1,this._wasmNotLoaded);const i=this._layers.get(e.wasmLayerId);if(i){this._lyr3DMain.set_enabled(e.wasmLayerId,t),i.needMemoryUsageUpdate=!0;const s=this._isUpdating(i);i.needFrame=!0,s||i.layerView.updatingFlagChanged()}}setLayerOffset(e,t){if(!this._lyr3DMain)return void this._debugLog(0,1,this._wasmNotLoaded);this._layers.get(e.wasmLayerId)&&this._lyr3DMain.set_carto_offset_z(e.wasmLayerId,t)}getAttributionText(){if(!this._lyr3DMain)return this._debugLog(0,1,this._wasmNotLoaded),[];return this._lyr3DMain.get_current_attribution_text().split("|")}onRenderableEvicted(e,t,i){if(!this._lyr3DMain)return void this._debugLog(0,1,this._wasmNotLoaded);this._layers.get(e.wasmLayerId)&&this._lyr3DMain.on_renderable_evicted(e.wasmLayerId,t,i)}setMeshModifications(e,t,i){if(!this._lyr3DMain)return void this._debugLog(0,1,this._wasmNotLoaded);const s=this._layers.get(e.wasmLayerId);if(s){const r=this._lyr3DMain._malloc(8*t.length),a=new Float64Array(this._lyr3DMain.HEAPF64.buffer,r,t.length);for(let e=0;e<t.length;++e)a[e]=t[e];this._lyr3DMain.set_mesh_modification_polygons(e.wasmLayerId,r,t.length,i),this._lyr3DMain._free(r);const n=this._isUpdating(s);s.needFrame=!0,n||s.layerView.updatingFlagChanged()}}isUpdating(e){if(!this._lyr3DMain&&this._lyr3DMainPromise)return!0;const t=this._layers.get(e);return!!t&&(t.outstandingJobCount>0||t.outstandingRenderableCount>0||t.needFrame||this._lyr3DBusyCount>0)}initializeWasm(e,t){return this._lyr3DMain?Promise.resolve():this.view.renderSpatialReference?(this._debugLog(0,3,"Lyr3DWasmPerSceneView.initializeWasm()"),this._lyr3DMainPromise||(this._lyr3DMainPromise=c().then(i=>{this._lyr3DMain=i,this._lyr3DMainPromise=null;const s=this._lyr3DMain.addFunction(this._onNewJob.bind(this),"v"),r=this._lyr3DMain.addFunction(this._onNewRenderable.bind(this),"v"),a=this._lyr3DMain.addFunction(this._freeRenderables.bind(this),"viii"),n=this._lyr3DMain.addFunction(this._setRenderableVisibility.bind(this),"viiii"),o=this._lyr3DMain.addFunction(this._onWasmError.bind(this),"viiii");if(!this.view.renderSpatialReference)return void(this._lyr3DMain=null);this._viewSR=this.view.renderSpatialReference?.toJSON();const l="global"===this.view.viewingMode?5:3;if(5===l)this._viewSR.wkid=this._viewSR.latestWkid=p,this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=f;else if(this.view.renderSpatialReference?.isWebMercator)this._viewSR.wkid=this._viewSR.latestWkid=w,this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=f;else if(this.view.renderSpatialReference?.wkid===b)this._viewSR.wkid=this._viewSR.latestWkid=p,this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=f;else if(!this._viewSR.latestVcsWkid&&!this._viewSR.vcsWkid){const e=this.view.heightModelInfo?.heightModel,t=!e||"gravity-related-height"===e;this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=t?f:v}return this._lyr3DMain.initialize_lyr3d_wasm(o,s,r,a,n,e,t,l,this._cleanUpSR(this._makeSRWasmSerializable(this._viewSR)),Math.max(this._debugLevel,0))?(this._workerHandle=new u(m(this.view.resourceController)),this._workerHandle.promise?this._workerHandle.promise:void 0):(this._lyr3DMain=null,void this._debugLog(0,0,"Lyr3d Main WASM failed to initialize",!1))}).catch(e=>{this._debugLog(0,0,`Lyr3d WASM failed to download error = ${e}`,!1)})),this._lyr3DMainPromise):Promise.reject()}setLodPixelThreshold(e,t){this._lyr3DMain?.set_lod_pixel_threshold(t);const i=this._layers.get(e.wasmLayerId);i&&(i.needFrame=!0)}_pulseTask(){if(this._lyr3DMain){if(this._cameraElevationDirty){const e=this.view.state?.contentCamera.relativeElevation;this._lyr3DMain.set_camera_altitude(e)}let e=0,t=0;this._layers.forEach(i=>{e+=i.layerView.usedMemory,t+=i.layerView.cachedMemory}),e/=1048576,t/=1048576;const i=this.view.resourceController.memoryController,s=i.usedMemory*i.maxMemory-e;this._lyr3DBusyCount=this._lyr3DMain.frame_pulse(i.memoryFactor,e,t,s,i.maxMemory),this._layers.forEach(e=>{this._cameraElevationDirty||(e.needFrame=!1),e.layerView.updatingFlagChanged()}),this._cameraElevationDirty=!1}}_isUpdating(e){return e.outstandingJobCount>0||e.outstandingRenderableCount>0||e.needFrame||this._lyr3DBusyCount>0}_incrementJobCount(e){const t=this._isUpdating(e);e.outstandingJobCount+=1,t||e.layerView.updatingFlagChanged()}_decrementJobCount(e){const t=this._isUpdating(e);e.outstandingJobCount-=1;t!==this._isUpdating(e)&&e.layerView.updatingFlagChanged()}_incrementRenderableCount(e){const t=this._isUpdating(e);e.outstandingRenderableCount+=1,t||e.layerView.updatingFlagChanged()}_decrementRenderableCount(e){const t=this._isUpdating(e);e.outstandingRenderableCount-=1;t!==this._isUpdating(e)&&e.layerView.updatingFlagChanged()}_onJobFailed(e,t,i){t.error.length&&this._debugLog(1,1,t.error,!1),this._lyr3DMain&&this._lyr3DMain.on_job_failed(i.jobId,i.desc),this._decrementJobCount(e)}_onJobSucceeded(e,t,i){if(this._lyr3DMain){if(e.layerView.destroyed)return void this._lyr3DMain.on_job_failed(i.jobId,i.desc);const s=t.data.byteLength,r=this._lyr3DMain._malloc(s);new Uint8Array(this._lyr3DMain.HEAPU8.buffer,r,s).set(t.data),this._lyr3DMain.on_job_completed(i.jobId,t.jobDescJson,r,s),this._lyr3DMain._free(r)}this._decrementJobCount(e)}_getRequestPromises(e,i,s,r){const a=[];for(const n of e){const e=new URL(n);if("integrated-mesh-3dtiles"===r.type){if(e.origin===s.origin&&e.pathname===s.pathname){if(r.rootTileset){a.push(Promise.resolve(r.rootTileset.slice()));continue}}else r.session&&e.searchParams.append("session",r.session)}a.push(t(e.toString(),i).then(e=>e.data))}return a}_getInitialPromise(e,t,i,s,a,n,o){const l=this._getRequestPromises(e.urls,t,i,s);return Promise.all(l).then(e=>(a.inputs=e,this._workerHandle.invoke(a,n))).then(e=>e).catch(t=>{let i=1;return r(t)?this._debugLog(1,2,`job ${e.jobId} was cancelled.`):o&&400===t.details?.httpStatus?(i=3,this._debugLog(1,2,"Session expired, trying to create new Session.")):this._debugLog(1,1,`job ${e.jobId} failed with error ${t}.`),{status:i,error:"",jobDescJson:"",data:new Uint8Array(0),missingInputUrls:[],inputs:[]}})}async _onNewJob(){const e=this._lyr3DMain.get_next_job(),t=this._layers.get(e.layerId);if(!t)return;this._incrementJobCount(t);const i=t.abortController.signal,s=t.layerView.layer,a="integrated-mesh-3dtiles"===s.type?s.key:null,n="integrated-mesh-3dtiles"===s.type?s.session:null,o={responseType:"array-buffer",signal:i,query:{...t.customParameters,token:t.apiKey,key:a}},l={id:e.jobId,inputs:[],jobDescJson:e.desc.slice(),isMissingResourceCase:!1},d=new URL(s.url),h=a=>{if(1===a.status)this._onJobFailed(t,a,e);else if(0===a.status)this._onJobSucceeded(t,a,e);else if(2===a.status){const n=this._getRequestPromises(a.missingInputUrls,o,d,s);Promise.all(n).then(e=>{l.jobDescJson=a.jobDescJson,a.originalInputs?l.inputs=a.originalInputs:l.inputs=[],l.isMissingResourceCase=!0;for(const t of e)l.inputs.push(t);return this._workerHandle.invoke(l,i)}).then(i=>{1===i.status?this._onJobFailed(t,i,e):0===i.status&&this._onJobSucceeded(t,i,e)}).catch(i=>{this._decrementJobCount(t),r(i)?this._debugLog(1,2,`job ${e.jobId} was cancelled.`):this._debugLog(1,1,`job ${e.jobId} failed with error2 ${i}.`),this._lyr3DMain&&this._lyr3DMain.on_job_failed(e.jobId,e.desc)})}};try{const t=await this._getInitialPromise(e,o,d,s,l,i,n);if(3===t.status&&"integrated-mesh-3dtiles"===s.type){n===s.session&&null!==s.session&&await s.requestRootAndSession(i);h(await this._getInitialPromise(e,o,d,s,l,i,s.session))}else h(t)}catch(_){_&&this._debugLog(1,1,_.toString(),!1),this._lyr3DMain&&this._lyr3DMain.on_job_failed(e.jobId,e.desc),this._decrementJobCount(t)}}_onNewRenderable(){const e=this._lyr3DMain.get_next_renderable(),{meshData:t}=e;if(t.data&&t.data.byteLength>0){const e=t.data.slice();t.data=e}const i=this._layers.get(e.layerId);i&&(this._incrementRenderableCount(i),i.layerView.createRenderable(e).then(t=>{this._lyr3DMain?.on_renderable_created(!0,e.layerId,e.handle,t.memUsageBytes),this._decrementRenderableCount(i)}).catch(t=>{r(t)||this._debugLog(2,1,`createRenderable failed with error ${t}.`),this._lyr3DMain?.on_renderable_created(!1,e.layerId,e.handle,0),this._decrementRenderableCount(i)}))}_freeRenderables(e,t,i){if(i<1)return;const s=this._layers.get(e);if(!s)return;const r=s.layerView,a=[],n=new Uint32Array(this._lyr3DMain.HEAPU32.buffer,t,i);for(let o=0;o<i;++o)a.push(n[o]);for(let o=0;o<i;++o)r.freeRenderable(a[o])}_setRenderableVisibility(e,t,i,s){if(s<1)return;const r=this._layers.get(e);if(!r)return;const a=r.layerView,n=[],o=[],l=new Uint32Array(this._lyr3DMain.HEAPU32.buffer,t,s),d=new Uint8Array(this._lyr3DMain.HEAPU8.buffer,i,s);for(let h=0;h<s;++h)n.push(l[h]),o.push(1===d[h]);a.setRenderableVisibility(n,o,s)}_onWasmError(e,t,i,s){this._lyr3DMain&&this._debugLog(i,s,this._lyr3DMain.UTF8ToString(e,t),!1)}_doRemoveLayerView(e){const t=this._layers.get(e.wasmLayerId);return!!t&&(t.abortController.abort(),this._lyr3DMain.remove_layer(e.wasmLayerId),this._layers.delete(e.wasmLayerId),!0)}_isGaussianSplatLayerView(e){return"gaussian-splat"===e.layer.type}_isGaussianSplatLayer(e){return"gaussian-splat"===e.type}_toWasmQuality(e){switch(e){case"low":return 1;case"medium":return 2;case"high":return 3}}_addLayerView(e){const t=e.layer;if(!t.url||!t.rootTilesetJSON)return{wasmLayerId:y};const i="integrated-mesh-3dtiles"===t.type?0:2,r=this._lyr3DMain.validate_root_tileset(JSON.stringify(t.rootTilesetJSON),i);if(0!==r.errorCode)return{wasmLayerId:y,check:r};const a=this._lyr3DMain.get_next_layer_id(),n=new AbortController;this._layers.set(a,{layerView:e,abortController:n,needMemoryUsageUpdate:!1,outstandingJobCount:0,outstandingRenderableCount:0,customParameters:t.customParameters,apiKey:t.apiKey,needFrame:!0});const o=g(t.elevationInfo),l=this._toWasmQuality(this.view?.qualityProfile),_=e=>s.getLogger(this).error("add-spatial-reference-error","Error when adding SR:",e);let u=!1;if(this._isGaussianSplatLayerView(e)&&this._isGaussianSplatLayer(t)){let i=t.spatialReference;if(e.useEsriCrs&&t.esriCrsSpatialReference){i=t.esriCrsSpatialReference;const s=d(i);let r=1,a=1;!s&&i.wkid&&-1!==i.wkid&&(r=h.values[h[i.wkid]],a=e.metersPerVCSUnit),this._workerHandle.addSpatialReferenceInfo(this._cleanUpSR(this._makeSRWasmSerializable(i)),s,r,a).catch(_)}u=this._lyr3DMain.add_gaussian_splat_layer(l,t.url,a,o)}else u=this._lyr3DMain.add_3dtiles_layer(l,t.url,a,o);return u?(this._updateWasmCamera(),e.updatingFlagChanged(),{wasmLayerId:a}):(this._layers.delete(a),{wasmLayerId:y})}_updateWasmCamera(){const e=this.view.state?.contentCamera;if(!e||!this._lyr3DMain)return;const{eye:t,center:i,up:s,near:r,far:a,fovY:n}=e,o=[e.viewport[2],e.viewport[3]],l=e.width/e.height;this._lyr3DMain.set_camera_parameters({eye:t,center:i,up:s,near:r,far:a,fov:n,aspectRatio:l,viewport:o}),this._markAllLayerViewsUpdating()}_markAllLayerViewsUpdating(){this._layers.forEach(e=>{const t=this._isUpdating(e);e.needFrame=!0,t||e.layerView.updatingFlagChanged()})}_makeSRWasmSerializable(e){return{wkid:e?.wkid??-1,latestWkid:e?.latestWkid??-1,vcsWkid:e?.vcsWkid??-1,latestVcsWkid:e?.latestVcsWkid??-1,wkt:e?.wkt??""}}_cleanUpSR(e){return-1===e?.wkid&&e.latestWkid&&-1!==e.latestWkid?e.wkid=e.latestWkid:-1===e?.latestWkid&&e.wkid&&-1!==e.wkid&&(e.latestWkid=e.wkid),-1===e?.vcsWkid&&e.latestVcsWkid&&-1!==e.latestVcsWkid?e.vcsWkid=e.latestVcsWkid:-1===e?.latestVcsWkid&&e.vcsWkid&&-1!==e.vcsWkid&&(e.latestVcsWkid=e.vcsWkid),e}};e([o({constructOnly:!0})],D.prototype,"view",void 0),D=e([l("esri.layers.Lyr3DWasmPerSceneView")],D);const L=D;export{L 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/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../request.js";import has from"../core/has.js";import s from"../core/Logger.js";import{isAbortError as i}from"../core/promiseUtils.js";import{watch as r,initial as a}from"../core/reactiveUtils.js";import{convertTime as n}from"../core/timeUtils.js";import{property as l,subclass as o}from"../core/accessorSupport/decorators.js";import{D 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{loadVoxelWASM as _}from"../libs/vxl/VxlModule.js";import{VoxelGraphic as c}from"../views/3d/layers/VoxelGraphic.js";import{VoxelTarget as m}from"../views/3d/layers/i3s/Intersector.js";import{Frustum as g}from"../views/3d/state/Frustum.js";import{RenderCoordsHelper as f}from"../views/3d/support/RenderCoordsHelper.js";import{SyncRenderPlugin as p}from"../views/3d/webgl-engine/effects/RenderPlugin.js";import{IntersectorResult as y}from"../views/3d/webgl-engine/lib/IntersectorResult.js";let x=class extends p{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([[20,()=>!!this._vxl&&"local"===this.view.viewingMode]]),this.type=9,this.slicePlaneEnabled=!0,this.isGround=!1,this.layerViewUid=[]}_dbg(e,t){this._dbgFlags.has(e)&&(4===e?s.getLogger(this).error(t):s.getLogger(this).warn(t))}_removeRenderPlugin(){this._pluginIsActive&&this.view.stage&&(this._dbg(1,"--removeRenderPlugin--"),this.view.stage.removeRenderPlugin(this)),this._pluginIsActive=!1}initialize(){this._dbg(1,"--initialize--");for(const e of this._wasmMemBlockSizes)this._wasmMemBlocks.set(e,0);this.addHandles([r(()=>this.view.ready,e=>{e&&"local"===this.view.viewingMode?(this._dbg(1,"view ready status changed to ready on a local view, calling addRenderPlugin"),this.view.stage.addRenderPlugin(this),this._pluginIsActive=!0):(this._dbg(1,"view ready status changed, not ready or not a local view!"),this._removeRenderPlugin())},a),r(()=>this.view?.qualityProfile,e=>{this._dbg(3,"qualityProfile changed to "+e),this._vxl&&this._vxl.set_quality(this._toWasmQuality(e))},a),r(()=>this.view?.timeExtent,()=>{if(this._vxl){const e=this._getTimeArgs(this.view?.timeExtent);this._dbg(3,"sceneView timeExtent changed to useTime="+e.hasTime+" st="+e.startTime+" et="+e.endTime),this._vxl.set_scene_time_extent(e.startTime,e.endTime,e.hasTime),this._renderPluginContext.requestRender()}},a),r(()=>this.view?.stationary,e=>{this._vxl&&e&&!this._lastFrameWasStationary&&this._renderPluginContext.requestRender()})])}initializeRenderContext(e){this._dbg(1,"--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(1,"--uninitializeRenderContext--")}_restoreFramebuffer(){if(!this._renderTargetToRestore)return;const e=this._renderTargetToRestore.fbo;if(!!!this._rctx)return void this._dbg(4,"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,i=!!this._renderTargetToRestore;if(!s||!i)return 0;const r=this._renderTargetToRestore.fbo.depthStencilTexture;return r?(0===t?this._rctx.bindTexture(null,e,!0):this._rctx.bindTexture(r,e,!0),1):(this._dbg(4,"no depth/stencil texture exists!"),0)}_modifyResourceCount(e,t,s){if(!this._rctx)return void this._dbg(4,"modifyAllocation callback has no rendering context!");const i=e;1===s?this._rctx.instanceCounter.increment(i,t):this._rctx.instanceCounter.decrement(i,t)}_setBlendState(e,t,s,i){this._rctx?(this._rctx.setBlendingEnabled(1===e),this._rctx.setBlendFunction(t,s),this._rctx.setBlendEquation(i)):this._dbg(4,"setBlendState callback has no rendering context!")}_setFrontFace(e){this._rctx?this._rctx.setFrontFace(e):this._dbg(4,"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(519,0,255),this._rctx.setStencilOpSeparate(1028,7680,7682,7680),this._rctx.setStencilOpSeparate(1029,7680,7683,7680)):this._dbg(4,"setDepthStencilStateFunction callback has no rendering context!")}_setRasterizerState(e){if(this._rctx)switch(e){case 1:this._rctx.setFaceCullingEnabled(!1);break;case 3:this._rctx.setCullFace(1029),this._rctx.setFaceCullingEnabled(!0);break;case 2:this._rctx.setCullFace(1028),this._rctx.setFaceCullingEnabled(!0)}else this._dbg(4,"setRasterizerState callback has no rendering context!")}_setViewport(e,t,s,i){this._rctx?this._rctx.setViewport(e,t,s,i):this._dbg(4,"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,s)=>{const r=[];e.responses.forEach((t,i)=>{r.push(i),this._dbg(2,"responding for requestID:"+i+" size:"+t.size),this._vxl.respond(s,i,t),0!==t.requestType&&4!==t.requestType||(e.needMemoryUsageUpdate=!0)});const a=e.responses;for(const t of r)a.delete(t);const n=this._vxl.get_new_requests(s),l=e.abortController.signal;for(const o in n){e.outstandingRequestCount+=1,1===e.outstandingRequestCount&&e.layerView.updatingFlagChanged();const s=n[o],r={responseType:"array-buffer",signal:l,query:{...e.layerView.layer.customParameters,token:e.layerView.layer.apiKey}};this._dbg(2,"making requestID:"+o+" url:"+s.url),t(s.url,r).then(t=>{e.outstandingRequestCount-=1,0===e.outstandingRequestCount&&e.layerView.updatingFlagChanged(),this._dbg(2,"have response for requestID:"+o);let i=0;if(t.data.byteLength>0){i=this._vxl._malloc(t.data.byteLength);const e=new Uint8Array(this._vxl.HEAPU8.buffer,i,t.data.byteLength),s=new Uint8Array(t.data);for(let i=0;i<t.data.byteLength;++i)e[i]=s[i]}a.set(+o,{responseType:s.responseType,ptr:i,size:t.data.byteLength,success:!0,requestType:s.requestType})}).catch(t=>{e.outstandingRequestCount-=1,0===e.outstandingRequestCount&&e.layerView.updatingFlagChanged(),i(t)||(this._dbg(4,`requestID:${o} failed, error=${t.toString()}`),a.set(+o,{responseType:s.responseType,ptr:0,size:0,success:!1,requestType:s.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,i)=>{if(s.layerView.wasmLayerId===e.wasmLayerId){const s=this._vxl.get_layer_epoch_times(i,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,i)=>{s.layerView.wasmLayerId===e.wasmLayerId&&(t=this._vxl.get_layer_current_time_id(i))}),t}setEnabled(e,t){this._layers.forEach((s,i)=>{s.layerView.wasmLayerId===e.wasmLayerId&&(this._vxl.set_enabled(i,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:1,staticSections:t};return this._doMaskedUIUpdate(e,s,!0)}setCurrentVariable(e,t){const s={mask:1024,currentVariable:t};return this._doMaskedUIUpdate(e,s,!0)}setRenderMode(e,t){const s={mask:8192,renderMode:t};return this._doMaskedUIUpdate(e,s,!0)}setVerticalExaggerationAndOffset(e,t,s,i){const r={mask:256,volStyleDesc:{volumeId:t,verticalExaggeration:s,verticalOffset:i}};return this._doMaskedUIUpdate(e,r,!0)}setVariableStyles(e,t){const s={mask:32768,variableStyles:t};return this._doMaskedUIUpdate(e,s,!0)}setVolumeStyles(e,t){const s={mask:65536,volumeStyles:t};return this._doMaskedUIUpdate(e,s,!0)}setEnableDynamicSections(e,t){const s={mask:4096,containerIsVisible:t,container:1};return this._doMaskedUIUpdate(e,s,!0)}setEnableIsosurfaces(e,t){const s={mask:4096,containerIsVisible:t,container:0};return this._doMaskedUIUpdate(e,s,!0)}setEnableSections(e,t){const s={mask:4096,containerIsVisible:t,container:2};return this._doMaskedUIUpdate(e,s,!0)}setAnalysisSlice(e,t,s,i){const r={mask:131072,analysisSlice:{point:s,normal:i,enabled:t}};return this._doMaskedUIUpdate(e,r,!0)}updateLayerTimeProperties(e){if(!this._vxl)return;const t=this._layers.get(e.wasmLayerId);if(t){const s=t.layerView.layer;let i=0;s.timeOffset&&(i=n(s.timeOffset.value,s.timeOffset.unit,"seconds"));const r=this._getTimeArgs(s.timeExtent);this._vxl.set_layer_time_properties(e.wasmLayerId,r.startTime,r.endTime,r.hasTime,s.useViewTime,i),this._renderPluginContext.requestRender()}}_doMaskedUIUpdate(e,t,s){if(!this._vxl)return!1;let i=!1;return this._layers.forEach((s,r)=>{if(s.layerView.wasmLayerId===e.wasmLayerId){const e={str:JSON.stringify(t),byteCount:0,ptr:0,isReusable:!1};this._allocateBlock(e)&&(i=1===this._vxl.handle_masked_ui_update(r,e.ptr,e.byteCount),e.isReusable||this._vxl._free(e.ptr))}}),i&&s&&this._renderPluginContext.requestRender(),i}_addTriangleToWasmBuffer(e,t,s,i,r){return e[3*t]=s[0],e[3*t+1]=s[1],e[3*t+2]=s[2],e[3*(t+=1)]=i[0],e[3*t+1]=i[1],e[3*t+2]=i[2],e[3*(t+=1)]=r[0],e[3*t+1]=r[1],e[3*t+2]=r[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),i=new Float32Array(this._vxl.HEAPF32.buffer,s,3*e),r=this._vxl._malloc(3*t*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(this._vxl.HEAPF32.buffer,r,e),n=this._frustum.points[0],l=this._frustum.points[1],o=this._frustum.points[2],h=this._frustum.points[3],d=this._frustum.points[4],u=this._frustum.points[5],_=this._frustum.points[6],c=this._frustum.points[7];let m=0,g=0;const f=this._frustum.planes[4];m=this._addTriangleToWasmBuffer(i,m,o,l,n),g=this._addNormalToWasmBuffer(a,g,f),m=this._addTriangleToWasmBuffer(i,m,n,h,o),g=this._addNormalToWasmBuffer(a,g,f);const p=this._frustum.planes[5];m=this._addTriangleToWasmBuffer(i,m,d,u,_),g=this._addNormalToWasmBuffer(a,g,p),m=this._addTriangleToWasmBuffer(i,m,_,c,d),g=this._addNormalToWasmBuffer(a,g,p);const y=this._frustum.planes[3];m=this._addTriangleToWasmBuffer(i,m,_,o,h),g=this._addNormalToWasmBuffer(a,g,y),m=this._addTriangleToWasmBuffer(i,m,h,c,_),g=this._addNormalToWasmBuffer(a,g,y);const x=this._frustum.planes[2];m=this._addTriangleToWasmBuffer(i,m,n,l,u),g=this._addNormalToWasmBuffer(a,g,x),m=this._addTriangleToWasmBuffer(i,m,u,d,n),g=this._addNormalToWasmBuffer(a,g,x);const v=this._frustum.planes[0];m=this._addTriangleToWasmBuffer(i,m,h,n,d),g=this._addNormalToWasmBuffer(a,g,v),m=this._addTriangleToWasmBuffer(i,m,d,c,h),g=this._addNormalToWasmBuffer(a,g,v);const b=this._frustum.planes[1];m=this._addTriangleToWasmBuffer(i,m,o,_,u),g=this._addNormalToWasmBuffer(a,g,b),m=this._addTriangleToWasmBuffer(i,m,u,l,o),g=this._addNormalToWasmBuffer(a,g,b),-1!==this._frustumRenderableId&&this._vxl.remove_generic_mesh(this._frustumRenderableId),this._frustumRenderableId=this._vxl.add_generic_mesh(s,3*e,r,e,255,0,0,64),this._vxl._free(s),this._vxl._free(r),this._captureFrustum=!1,this._renderPluginContext.requestRender()}captureFrustum(){null===this._renderCoordsHelper&&(this._renderCoordsHelper=f.create(2,u(!1,this.view.spatialReference))),null===this._frustum&&(this._frustum=new g(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())})}dropQueryRenderTarget(){this._vxl&&this._vxl.drop_query_rt()}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(1," no voxel layers left after removing a layer, removing RenderPlugin and destroying"),this.destroy()),s}let t=-1;this._layers.forEach((s,i)=>{if(s.layerView.wasmLayerId===e.wasmLayerId){t=i,s.abortController.abort(),this._vxl.remove_layer(t);const r=this.layerViewUid.indexOf(e.uid);-1!==r&&this.layerViewUid.splice(r,1)}}),t>=0&&this._layers.delete(t);const s=this._layers.size;return 0===s&&(this._dbg(1," 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,i=!1;return null!=e&&(e.isAllTime?i=!0:(null!=e.start&&(i=!0,t=e.start.getTime()/1e3),null!=e.end&&(i=!0,s=e.end.getTime()/1e3))),{startTime:t,endTime:s,hasTime:i}}_addVoxelLayer(e){const t=e.layer;let i=-1;const r=t.getConfiguration();if(r.length<1)return-1;const a={str:r,byteCount:0,ptr:0,isReusable:!1};if(!this._allocateBlock(a))return-1;const l=this._getTimeArgs(t.timeExtent),o=this.view.spatialReference.isWGS84&&t.spatialReference.isWGS84?111319.49079327357:1;let h=0;if(t.timeOffset&&(h=n(t.timeOffset.value,t.timeOffset.unit,"seconds")),i=this._vxl.add_layer(t.serviceRoot,a.ptr,a.byteCount,o,o,l.startTime,l.endTime,l.hasTime,t.useViewTime,h,this._toWasmQuality(this.view.qualityProfile)),a.isReusable||this._vxl._free(a.ptr),i>=0){t.test?.constantUpscaling&&(this._setUpscalingLimits(0,.25,.25),this._setUpscalingLimits(1,.5,.5),this._setUpscalingLimits(2,.75,.75));const r=new AbortController;if(this._layers.set(i,{layerView:e,responses:new Map,outstandingRequestCount:0,abortController:r,needMemoryUsageUpdate:!1,isInScaleRange:!0}),this.layerViewUid.push(e.uid),!this._halfIntTexturesAvailable||has("mac")){const t=[];let i="";for(const s of e.layer.variables)"Int16"!==s.renderingFormat.type&&"UInt16"!==s.renderingFormat.type||(t.push(s.name),s.id===e.layer.currentVariableId&&(i=s.name));""!==i&&s.getLogger(this).error("#addVoxelLayer_error()",e.layer,`The voxel layer '${e.layer.title}' cannot render the current variable '${i}' in this browser`),t.length>0&&s.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 i="";for(const s of e.layer.variables)"Float32"===s.renderingFormat.type&&(t.push(s.name),s.id===e.layer.currentVariableId&&(i=s.name));""!==i&&s.getLogger(this).error("#addVoxelLayer_error()",e.layer,`The voxel layer '${e.layer.title}' cannot render the current variable '${i}' in this browser`),t.length>0&&s.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")&&s.getLogger(this).warnOnce("Mobile support differs across devices. Voxel layer might not display as expected."),i}return-1}prepareRender(e){if(!this._vxl)return;const t=e.bind.camera.viewForward,s=e.bind.camera.eye;this._vxl.update_camera_pos_and_direction(s[0],s[1],s[2],t[0],t[1],t[2]);const i=this._vxl.cull();this._dbg(2,"missingResourceCount="+i),this._moreToLoad=i>0,this._havePreparedWithAllLayers=0===this._newLayers.length,this._updateMemoryUsage()}acquireTechniques(){return[]}render(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(4,"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(2),e.bind.lighting.mainLight.direction[0],e.bind.lighting.mainLight.direction[1],e.bind.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(4,"Unsupported viewport parameters detected!"),this.updateWasmCamera(e.bind.camera),this._captureFrustum&&(this._frustum.update(e.bind.camera),this._doCaptureFrustum()),this._vxl.draw(),this._afterDraw(),(this._moreToLoad||!this._havePreparedWithAllLayers&&this._layers.size>0)&&this._renderPluginContext.requestRender()}destroy(){this._dbg(1,"--destroy--"),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._removeRenderPlugin(),this._vxl=null)}_initializeWasm(e){return this._vxl?Promise.resolve():(this._vxlPromise||(this._vxlPromise=_(e).then(t=>{if(t.specialHTMLTargets.jsAPI3DRenderingContext=e,this._vxl=t,this._vxlPromise=null,this._newLayers.length<=0)return this._dbg(1," no voxel layers left after WASM downloaded, removing RenderPlugin and destroying"),void this.destroy();const s=this._getTimeArgs(this.view?.timeExtent),i=this._vxl.addFunction(this._restoreFramebuffer.bind(this),"v"),r=this._vxl.addFunction(this._setBlendState.bind(this),"viiii"),a=this._vxl.addFunction(this._setFrontFace.bind(this),"vi"),n=this._vxl.addFunction(this._setRasterizerState.bind(this),"vi"),l=this._vxl.addFunction(this._setDepthStencilStateFunction.bind(this),"viii"),o=this._vxl.addFunction(this._setViewport.bind(this),"viiii"),h=this._vxl.addFunction(this._bindPreviousDepthToSlot.bind(this),"iii"),d=this._vxl.addFunction(this._modifyResourceCount.bind(this),"viii"),u=this._halfIntTexturesAvailable&&!has("mac"),_=this._textureFloatLinearAvailable;this._vxl.initialize_voxel_wasm(i,r,a,n,l,o,h,d,s.startTime,s.endTime,s.hasTime,u,_),this._renderPluginContext&&this._renderPluginContext.requestRender()}).catch(()=>{for(const e of this._newLayers)e.rejectCallback(-2);this._dbg(4," 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 i=s.viewport[3]-t;if(e<0||e>s.viewport[2]||t<0||t>s.viewport[3])return this._dbg(4,`[js] pickDepth: outOfRange, screenXY=[${e.toFixed(0)}, ${i.toFixed(0)}]]`),null;this._beforeDraw();const r=s.viewForward,a=s.eye;this._vxl.update_camera_pos_and_direction(a[0],a[1],a[2],r[0],r[1],r[2]),this.updateWasmCamera(s),this._vxl.begin_frame();const n=this._vxl.pick_depth(e,i);if(this._afterDraw(),n.success){return n.distanceToCamera}return null}pickObject(e,t,s,i){if(!this._vxl||!this._rctx||0===this._layers.size)return null;const r=Math.round(e),a=Math.round(t);if(r<0||r>s.viewport[2]||a<0||a>s.viewport[3])return this._dbg(4,`[js] pickObject: outOfRange, screenXY=[${r}, ${a}], vp=[${s.viewport.toString()}]`),null;this._beforeDraw();const n=s.viewForward,l=s.eye;this._vxl.update_camera_pos_and_direction(l[0],l[1],l[2],n[0],n[1],n[2]),this.updateWasmCamera(s),this._vxl.begin_frame();let o=null;if(0===i.length)o=this._vxl.pick_object(r,a,0,0);else{const e={str:JSON.stringify({layerIds:i}),byteCount:0,ptr:0,isReusable:!1};this._allocateBlock(e)&&(o=this._vxl.pick_object(r,a,e.ptr,e.byteCount),e.isReusable||this._vxl._free(e.ptr))}return this._afterDraw(),o}async getOtherFieldPopupValues(e,s){for(const i of e){const e=i.gpuResult;if(!e)continue;const r=this._layers.get(e.layerId);if(!r||!r.layerView.layer.url)continue;const a=r.layerView.layer,n={responseType:"array-buffer",signal:r.abortController.signal,query:{...r.layerView.layer.customParameters,token:r.layerView.layer.apiKey}},l=e.voxelSpacePosition,o=[Math.floor(l[0]/32),Math.floor(l[1]/32),Math.floor(l[2]/32)],h=[-4&o[0],-4&o[1],-4&o[2]];let d=0;if(e.epochTime){const t=this._vxl.get_layer_epoch_times(r.layerView.wasmLayerId,a.currentVariableId);for(let s=0;s<t.length;++s)if(t[s]===e.epochTime/1e3){d=s;break}}const u=[],_={varIds:[],ptrs:[],sizes:[]};for(const i of s){const e=a.variables.findIndex(e=>e.name===i);if(-1===e)continue;const s=a.variables.getItemAt(e)?.id;if(null==s)continue;const r=`${a.url}/variables/${s}/${d}/bundles/0/${h[0]}-${h[1]}-${h[2]}`;u.push(t(r,n).then(e=>e.data)),_.varIds.push(s)}const c=await Promise.allSettled(u),m=c.length;for(let t=0;t<m;++t){const e=c[t];if("fulfilled"===e.status){const t=e.value,s=this._vxl._malloc(t.byteLength);new Uint8Array(this._vxl.HEAPU8.buffer,s,t.byteLength).set(new Uint8Array(t)),_.ptrs.push(s),_.sizes.push(t.byteLength)}else _.varIds.splice(t,1)}const g=this._vxl.get_other_field_popup_values(e,_);for(let t=0;t<_.ptrs.length;++t)this._vxl._free(_.ptrs[t]);if(g.continuousValues)for(const t in g.continuousValues)i.attributes[t]=g.continuousValues[t];if(g.uniqueValues)for(const t in g.uniqueValues)i.attributes[t]=g.uniqueValues[t]}return e}_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,i,r){if(!this._vxl||!this._rctx||0===this._layers.size||!e.options.selectionMode||e.options.isFiltered||!e.camera)return;if(null==r||r[0]<0||r[0]>e.camera.viewport[2]||r[1]<0||r[1]>e.camera.viewport[3])return this._dbg(4,r?`[js] VoxelWasmPerScene.intersect: outOfRange, screenXY=[${r[0].toFixed(0)}, ${r[1].toFixed(0)}]`:"[js] VoxelWasmPerScene.intersect: outOfRange, screenXY=null"),null;const a=[];this._layers.forEach(t=>{e.options.filteredLayerViewUids.includes(t.layerView.uid)&&a.push(t.layerView.wasmLayerId)});const n=this.pickObject(r[0],r[1],e.camera,a);if(null==n||-1===n.layerId)return;const l=this._layers.get(n.layerId);if(l){const t=l.layerView.layer.uid,r=n.distanceToCamera/h(s,i),a=d();a[0]=n.worldX,a[1]=n.worldY,a[2]=n.worldZ;const o={},u=l.layerView.layer,_=u.variables.findIndex(e=>e.id===u.currentVariableId);if(_>=0){const e=u.variables.getItemAt(_);null!=e&&(null!=n.continuousValue?o[e.name]=n.continuousValue:null!=n.uniqueValueLabel&&null!=n.uniqueValue?o[e.name]=`${n.uniqueValueLabel} (${n.uniqueValue})`:null!=n.uniqueValue&&(o[e.name]=`${n.uniqueValue}`),e.description.length>0?o["Voxel.CurrentVariable"]=e.description:e.name?.length>0&&(o["Voxel.CurrentVariable"]=e.name))}if(o["Voxel.Position"]=`[${n.voxelSpacePosition.toString()}]`,null!=n.epochTime&&null!=n.nativeTime&&null!=n.nativeTimeUnits){const e=new Date(n.epochTime);o["Voxel.LocalTime"]=e,o["Voxel.SourceTime"]=`${n.nativeTime.toLocaleString()} ${n.nativeTimeUnits}`}null!=n.depth&&(o["Voxel.Depth"]=n.depth);const c=n.faceNormal;o["Voxel.WorldPosition"]=`[${a[0]}, ${a[1]}, ${a[2]}]`;const g=e=>{const s=new m(a,t,()=>this._createVoxelGraphic(l.layerView.layer,o,n));e.set(this.type,s,r,c)},f=e.results,p=2===e.options.store;if((null==f.min.distance||r<f.min.distance)&&g(f.min),(null==f.max.distance||r>f.max.distance)&&g(f.max),p){const t=new y(e.ray);g(t),e.results.all.push(t)}}}_createVoxelGraphic(e,t,s){return new c({layer:e,sourceLayer:e,origin:e.graphicOrigin,attributes:t,gpuResult: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)}hasHighlight(){return!1}};e([l({constructOnly:!0})],x.prototype,"view",void 0),x=e([o("esri.layers.VoxelWasmPerSceneView")],x);const v=x;export{v as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../request.js";import has from"../core/has.js";import s from"../core/Logger.js";import{isAbortError as i}from"../core/promiseUtils.js";import{watch as r,initial as a}from"../core/reactiveUtils.js";import{convertTime as n}from"../core/timeUtils.js";import{property as l,subclass as o}from"../core/accessorSupport/decorators.js";import{C 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{loadVoxelWASM as _}from"../libs/vxl/VxlModule.js";import{VoxelGraphic as c}from"../views/3d/layers/VoxelGraphic.js";import{VoxelTarget as m}from"../views/3d/layers/i3s/Intersector.js";import{Frustum as g}from"../views/3d/state/Frustum.js";import{RenderCoordsHelper as f}from"../views/3d/support/RenderCoordsHelper.js";import{SyncRenderPlugin as p}from"../views/3d/webgl-engine/effects/RenderPlugin.js";import{IntersectorResult as y}from"../views/3d/webgl-engine/lib/IntersectorResult.js";let x=class extends p{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([[21,()=>!!this._vxl&&"local"===this.view.viewingMode]]),this.type=9,this.slicePlaneEnabled=!0,this.isGround=!1,this.layerViewUid=[]}_dbg(e,t){this._dbgFlags.has(e)&&(4===e?s.getLogger(this).error(t):s.getLogger(this).warn(t))}_removeRenderPlugin(){this._pluginIsActive&&this.view.stage&&(this._dbg(1,"--removeRenderPlugin--"),this.view.stage.removeRenderPlugin(this)),this._pluginIsActive=!1}initialize(){this._dbg(1,"--initialize--");for(const e of this._wasmMemBlockSizes)this._wasmMemBlocks.set(e,0);this.addHandles([r(()=>this.view.ready,e=>{e&&"local"===this.view.viewingMode?(this._dbg(1,"view ready status changed to ready on a local view, calling addRenderPlugin"),this.view.stage.addRenderPlugin(this),this._pluginIsActive=!0):(this._dbg(1,"view ready status changed, not ready or not a local view!"),this._removeRenderPlugin())},a),r(()=>this.view?.qualityProfile,e=>{this._dbg(3,"qualityProfile changed to "+e),this._vxl&&this._vxl.set_quality(this._toWasmQuality(e))},a),r(()=>this.view?.timeExtent,()=>{if(this._vxl){const e=this._getTimeArgs(this.view?.timeExtent);this._dbg(3,"sceneView timeExtent changed to useTime="+e.hasTime+" st="+e.startTime+" et="+e.endTime),this._vxl.set_scene_time_extent(e.startTime,e.endTime,e.hasTime),this._renderPluginContext.requestRender()}},a),r(()=>this.view?.stationary,e=>{this._vxl&&e&&!this._lastFrameWasStationary&&this._renderPluginContext.requestRender()})])}initializeRenderContext(e){this._dbg(1,"--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(1,"--uninitializeRenderContext--")}_restoreFramebuffer(){if(!this._renderTargetToRestore)return;const e=this._renderTargetToRestore.fbo;if(!!!this._rctx)return void this._dbg(4,"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,i=!!this._renderTargetToRestore;if(!s||!i)return 0;const r=this._renderTargetToRestore.fbo.depthStencilTexture;return r?(0===t?this._rctx.bindTexture(null,e,!0):this._rctx.bindTexture(r,e,!0),1):(this._dbg(4,"no depth/stencil texture exists!"),0)}_modifyResourceCount(e,t,s){if(!this._rctx)return void this._dbg(4,"modifyAllocation callback has no rendering context!");const i=e;1===s?this._rctx.instanceCounter.increment(i,t):this._rctx.instanceCounter.decrement(i,t)}_setBlendState(e,t,s,i){this._rctx?(this._rctx.setBlendingEnabled(1===e),this._rctx.setBlendFunction(t,s),this._rctx.setBlendEquation(i)):this._dbg(4,"setBlendState callback has no rendering context!")}_setFrontFace(e){this._rctx?this._rctx.setFrontFace(e):this._dbg(4,"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(519,0,255),this._rctx.setStencilOpSeparate(1028,7680,7682,7680),this._rctx.setStencilOpSeparate(1029,7680,7683,7680)):this._dbg(4,"setDepthStencilStateFunction callback has no rendering context!")}_setRasterizerState(e){if(this._rctx)switch(e){case 1:this._rctx.setFaceCullingEnabled(!1);break;case 3:this._rctx.setCullFace(1029),this._rctx.setFaceCullingEnabled(!0);break;case 2:this._rctx.setCullFace(1028),this._rctx.setFaceCullingEnabled(!0)}else this._dbg(4,"setRasterizerState callback has no rendering context!")}_setViewport(e,t,s,i){this._rctx?this._rctx.setViewport(e,t,s,i):this._dbg(4,"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,s)=>{const r=[];e.responses.forEach((t,i)=>{r.push(i),this._dbg(2,"responding for requestID:"+i+" size:"+t.size),this._vxl.respond(s,i,t),0!==t.requestType&&4!==t.requestType||(e.needMemoryUsageUpdate=!0)});const a=e.responses;for(const t of r)a.delete(t);const n=this._vxl.get_new_requests(s),l=e.abortController.signal;for(const o in n){e.outstandingRequestCount+=1,1===e.outstandingRequestCount&&e.layerView.updatingFlagChanged();const s=n[o],r={responseType:"array-buffer",signal:l,query:{...e.layerView.layer.customParameters,token:e.layerView.layer.apiKey}};this._dbg(2,"making requestID:"+o+" url:"+s.url),t(s.url,r).then(t=>{e.outstandingRequestCount-=1,0===e.outstandingRequestCount&&e.layerView.updatingFlagChanged(),this._dbg(2,"have response for requestID:"+o);let i=0;if(t.data.byteLength>0){i=this._vxl._malloc(t.data.byteLength);const e=new Uint8Array(this._vxl.HEAPU8.buffer,i,t.data.byteLength),s=new Uint8Array(t.data);for(let i=0;i<t.data.byteLength;++i)e[i]=s[i]}a.set(+o,{responseType:s.responseType,ptr:i,size:t.data.byteLength,success:!0,requestType:s.requestType})}).catch(t=>{e.outstandingRequestCount-=1,0===e.outstandingRequestCount&&e.layerView.updatingFlagChanged(),i(t)||(this._dbg(4,`requestID:${o} failed, error=${t.toString()}`),a.set(+o,{responseType:s.responseType,ptr:0,size:0,success:!1,requestType:s.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,i)=>{if(s.layerView.wasmLayerId===e.wasmLayerId){const s=this._vxl.get_layer_epoch_times(i,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,i)=>{s.layerView.wasmLayerId===e.wasmLayerId&&(t=this._vxl.get_layer_current_time_id(i))}),t}setEnabled(e,t){this._layers.forEach((s,i)=>{s.layerView.wasmLayerId===e.wasmLayerId&&(this._vxl.set_enabled(i,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:1,staticSections:t};return this._doMaskedUIUpdate(e,s,!0)}setCurrentVariable(e,t){const s={mask:1024,currentVariable:t};return this._doMaskedUIUpdate(e,s,!0)}setRenderMode(e,t){const s={mask:8192,renderMode:t};return this._doMaskedUIUpdate(e,s,!0)}setVerticalExaggerationAndOffset(e,t,s,i){const r={mask:256,volStyleDesc:{volumeId:t,verticalExaggeration:s,verticalOffset:i}};return this._doMaskedUIUpdate(e,r,!0)}setVariableStyles(e,t){const s={mask:32768,variableStyles:t};return this._doMaskedUIUpdate(e,s,!0)}setVolumeStyles(e,t){const s={mask:65536,volumeStyles:t};return this._doMaskedUIUpdate(e,s,!0)}setEnableDynamicSections(e,t){const s={mask:4096,containerIsVisible:t,container:1};return this._doMaskedUIUpdate(e,s,!0)}setEnableIsosurfaces(e,t){const s={mask:4096,containerIsVisible:t,container:0};return this._doMaskedUIUpdate(e,s,!0)}setEnableSections(e,t){const s={mask:4096,containerIsVisible:t,container:2};return this._doMaskedUIUpdate(e,s,!0)}setAnalysisSlice(e,t,s,i){const r={mask:131072,analysisSlice:{point:s,normal:i,enabled:t}};return this._doMaskedUIUpdate(e,r,!0)}updateLayerTimeProperties(e){if(!this._vxl)return;const t=this._layers.get(e.wasmLayerId);if(t){const s=t.layerView.layer;let i=0;s.timeOffset&&(i=n(s.timeOffset.value,s.timeOffset.unit,"seconds"));const r=this._getTimeArgs(s.timeExtent);this._vxl.set_layer_time_properties(e.wasmLayerId,r.startTime,r.endTime,r.hasTime,s.useViewTime,i),this._renderPluginContext.requestRender()}}_doMaskedUIUpdate(e,t,s){if(!this._vxl)return!1;let i=!1;return this._layers.forEach((s,r)=>{if(s.layerView.wasmLayerId===e.wasmLayerId){const e={str:JSON.stringify(t),byteCount:0,ptr:0,isReusable:!1};this._allocateBlock(e)&&(i=1===this._vxl.handle_masked_ui_update(r,e.ptr,e.byteCount),e.isReusable||this._vxl._free(e.ptr))}}),i&&s&&this._renderPluginContext.requestRender(),i}_addTriangleToWasmBuffer(e,t,s,i,r){return e[3*t]=s[0],e[3*t+1]=s[1],e[3*t+2]=s[2],e[3*(t+=1)]=i[0],e[3*t+1]=i[1],e[3*t+2]=i[2],e[3*(t+=1)]=r[0],e[3*t+1]=r[1],e[3*t+2]=r[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),i=new Float32Array(this._vxl.HEAPF32.buffer,s,3*e),r=this._vxl._malloc(3*t*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(this._vxl.HEAPF32.buffer,r,e),n=this._frustum.points[0],l=this._frustum.points[1],o=this._frustum.points[2],h=this._frustum.points[3],d=this._frustum.points[4],u=this._frustum.points[5],_=this._frustum.points[6],c=this._frustum.points[7];let m=0,g=0;const f=this._frustum.planes[4];m=this._addTriangleToWasmBuffer(i,m,o,l,n),g=this._addNormalToWasmBuffer(a,g,f),m=this._addTriangleToWasmBuffer(i,m,n,h,o),g=this._addNormalToWasmBuffer(a,g,f);const p=this._frustum.planes[5];m=this._addTriangleToWasmBuffer(i,m,d,u,_),g=this._addNormalToWasmBuffer(a,g,p),m=this._addTriangleToWasmBuffer(i,m,_,c,d),g=this._addNormalToWasmBuffer(a,g,p);const y=this._frustum.planes[3];m=this._addTriangleToWasmBuffer(i,m,_,o,h),g=this._addNormalToWasmBuffer(a,g,y),m=this._addTriangleToWasmBuffer(i,m,h,c,_),g=this._addNormalToWasmBuffer(a,g,y);const x=this._frustum.planes[2];m=this._addTriangleToWasmBuffer(i,m,n,l,u),g=this._addNormalToWasmBuffer(a,g,x),m=this._addTriangleToWasmBuffer(i,m,u,d,n),g=this._addNormalToWasmBuffer(a,g,x);const v=this._frustum.planes[0];m=this._addTriangleToWasmBuffer(i,m,h,n,d),g=this._addNormalToWasmBuffer(a,g,v),m=this._addTriangleToWasmBuffer(i,m,d,c,h),g=this._addNormalToWasmBuffer(a,g,v);const b=this._frustum.planes[1];m=this._addTriangleToWasmBuffer(i,m,o,_,u),g=this._addNormalToWasmBuffer(a,g,b),m=this._addTriangleToWasmBuffer(i,m,u,l,o),g=this._addNormalToWasmBuffer(a,g,b),-1!==this._frustumRenderableId&&this._vxl.remove_generic_mesh(this._frustumRenderableId),this._frustumRenderableId=this._vxl.add_generic_mesh(s,3*e,r,e,255,0,0,64),this._vxl._free(s),this._vxl._free(r),this._captureFrustum=!1,this._renderPluginContext.requestRender()}captureFrustum(){null===this._renderCoordsHelper&&(this._renderCoordsHelper=f.create(2,u(!1,this.view.spatialReference))),null===this._frustum&&(this._frustum=new g(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())})}dropQueryRenderTarget(){this._vxl&&this._vxl.drop_query_rt()}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(1," no voxel layers left after removing a layer, removing RenderPlugin and destroying"),this.destroy()),s}let t=-1;this._layers.forEach((s,i)=>{if(s.layerView.wasmLayerId===e.wasmLayerId){t=i,s.abortController.abort(),this._vxl.remove_layer(t);const r=this.layerViewUid.indexOf(e.uid);-1!==r&&this.layerViewUid.splice(r,1)}}),t>=0&&this._layers.delete(t);const s=this._layers.size;return 0===s&&(this._dbg(1," 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,i=!1;return null!=e&&(e.isAllTime?i=!0:(null!=e.start&&(i=!0,t=e.start.getTime()/1e3),null!=e.end&&(i=!0,s=e.end.getTime()/1e3))),{startTime:t,endTime:s,hasTime:i}}_addVoxelLayer(e){const t=e.layer;let i=-1;const r=t.getConfiguration();if(r.length<1)return-1;const a={str:r,byteCount:0,ptr:0,isReusable:!1};if(!this._allocateBlock(a))return-1;const l=this._getTimeArgs(t.timeExtent),o=this.view.spatialReference.isWGS84&&t.spatialReference.isWGS84?111319.49079327357:1;let h=0;if(t.timeOffset&&(h=n(t.timeOffset.value,t.timeOffset.unit,"seconds")),i=this._vxl.add_layer(t.serviceRoot,a.ptr,a.byteCount,o,o,l.startTime,l.endTime,l.hasTime,t.useViewTime,h,this._toWasmQuality(this.view.qualityProfile)),a.isReusable||this._vxl._free(a.ptr),i>=0){t.test?.constantUpscaling&&(this._setUpscalingLimits(0,.25,.25),this._setUpscalingLimits(1,.5,.5),this._setUpscalingLimits(2,.75,.75));const r=new AbortController;if(this._layers.set(i,{layerView:e,responses:new Map,outstandingRequestCount:0,abortController:r,needMemoryUsageUpdate:!1,isInScaleRange:!0}),this.layerViewUid.push(e.uid),!this._halfIntTexturesAvailable||has("mac")){const t=[];let i="";for(const s of e.layer.variables)"Int16"!==s.renderingFormat.type&&"UInt16"!==s.renderingFormat.type||(t.push(s.name),s.id===e.layer.currentVariableId&&(i=s.name));""!==i&&s.getLogger(this).error("#addVoxelLayer_error()",e.layer,`The voxel layer '${e.layer.title}' cannot render the current variable '${i}' in this browser`),t.length>0&&s.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 i="";for(const s of e.layer.variables)"Float32"===s.renderingFormat.type&&(t.push(s.name),s.id===e.layer.currentVariableId&&(i=s.name));""!==i&&s.getLogger(this).error("#addVoxelLayer_error()",e.layer,`The voxel layer '${e.layer.title}' cannot render the current variable '${i}' in this browser`),t.length>0&&s.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")&&s.getLogger(this).warnOnce("Mobile support differs across devices. Voxel layer might not display as expected."),i}return-1}prepareRender(e){if(!this._vxl)return;const t=e.bind.camera.viewForward,s=e.bind.camera.eye;this._vxl.update_camera_pos_and_direction(s[0],s[1],s[2],t[0],t[1],t[2]);const i=this._vxl.cull();this._dbg(2,"missingResourceCount="+i),this._moreToLoad=i>0,this._havePreparedWithAllLayers=0===this._newLayers.length,this._updateMemoryUsage()}acquireTechniques(){return[]}render(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(4,"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(2),e.bind.lighting.mainLight.direction[0],e.bind.lighting.mainLight.direction[1],e.bind.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(4,"Unsupported viewport parameters detected!"),this.updateWasmCamera(e.bind.camera),this._captureFrustum&&(this._frustum.update(e.bind.camera),this._doCaptureFrustum()),this._vxl.draw(),this._afterDraw(),(this._moreToLoad||!this._havePreparedWithAllLayers&&this._layers.size>0)&&this._renderPluginContext.requestRender()}destroy(){this._dbg(1,"--destroy--"),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._removeRenderPlugin(),this._vxl=null)}_initializeWasm(e){return this._vxl?Promise.resolve():(this._vxlPromise||(this._vxlPromise=_(e).then(t=>{if(t.specialHTMLTargets.jsAPI3DRenderingContext=e,this._vxl=t,this._vxlPromise=null,this._newLayers.length<=0)return this._dbg(1," no voxel layers left after WASM downloaded, removing RenderPlugin and destroying"),void this.destroy();const s=this._getTimeArgs(this.view?.timeExtent),i=this._vxl.addFunction(this._restoreFramebuffer.bind(this),"v"),r=this._vxl.addFunction(this._setBlendState.bind(this),"viiii"),a=this._vxl.addFunction(this._setFrontFace.bind(this),"vi"),n=this._vxl.addFunction(this._setRasterizerState.bind(this),"vi"),l=this._vxl.addFunction(this._setDepthStencilStateFunction.bind(this),"viii"),o=this._vxl.addFunction(this._setViewport.bind(this),"viiii"),h=this._vxl.addFunction(this._bindPreviousDepthToSlot.bind(this),"iii"),d=this._vxl.addFunction(this._modifyResourceCount.bind(this),"viii"),u=this._halfIntTexturesAvailable&&!has("mac"),_=this._textureFloatLinearAvailable;this._vxl.initialize_voxel_wasm(i,r,a,n,l,o,h,d,s.startTime,s.endTime,s.hasTime,u,_),this._renderPluginContext&&this._renderPluginContext.requestRender()}).catch(()=>{for(const e of this._newLayers)e.rejectCallback(-2);this._dbg(4," 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 i=s.viewport[3]-t;if(e<0||e>s.viewport[2]||t<0||t>s.viewport[3])return this._dbg(4,`[js] pickDepth: outOfRange, screenXY=[${e.toFixed(0)}, ${i.toFixed(0)}]]`),null;this._beforeDraw();const r=s.viewForward,a=s.eye;this._vxl.update_camera_pos_and_direction(a[0],a[1],a[2],r[0],r[1],r[2]),this.updateWasmCamera(s),this._vxl.begin_frame();const n=this._vxl.pick_depth(e,i);if(this._afterDraw(),n.success){return n.distanceToCamera}return null}pickObject(e,t,s,i){if(!this._vxl||!this._rctx||0===this._layers.size)return null;const r=Math.round(e),a=Math.round(t);if(r<0||r>s.viewport[2]||a<0||a>s.viewport[3])return this._dbg(4,`[js] pickObject: outOfRange, screenXY=[${r}, ${a}], vp=[${s.viewport.toString()}]`),null;this._beforeDraw();const n=s.viewForward,l=s.eye;this._vxl.update_camera_pos_and_direction(l[0],l[1],l[2],n[0],n[1],n[2]),this.updateWasmCamera(s),this._vxl.begin_frame();let o=null;if(0===i.length)o=this._vxl.pick_object(r,a,0,0);else{const e={str:JSON.stringify({layerIds:i}),byteCount:0,ptr:0,isReusable:!1};this._allocateBlock(e)&&(o=this._vxl.pick_object(r,a,e.ptr,e.byteCount),e.isReusable||this._vxl._free(e.ptr))}return this._afterDraw(),o}async getOtherFieldPopupValues(e,s){for(const i of e){const e=i.gpuResult;if(!e)continue;const r=this._layers.get(e.layerId);if(!r||!r.layerView.layer.url)continue;const a=r.layerView.layer,n={responseType:"array-buffer",signal:r.abortController.signal,query:{...r.layerView.layer.customParameters,token:r.layerView.layer.apiKey}},l=e.voxelSpacePosition,o=[Math.floor(l[0]/32),Math.floor(l[1]/32),Math.floor(l[2]/32)],h=[-4&o[0],-4&o[1],-4&o[2]];let d=0;if(e.epochTime){const t=this._vxl.get_layer_epoch_times(r.layerView.wasmLayerId,a.currentVariableId);for(let s=0;s<t.length;++s)if(t[s]===e.epochTime/1e3){d=s;break}}const u=[],_={varIds:[],ptrs:[],sizes:[]};for(const i of s){const e=a.variables.findIndex(e=>e.name===i);if(-1===e)continue;const s=a.variables.getItemAt(e)?.id;if(null==s)continue;const r=`${a.url}/variables/${s}/${d}/bundles/0/${h[0]}-${h[1]}-${h[2]}`;u.push(t(r,n).then(e=>e.data)),_.varIds.push(s)}const c=await Promise.allSettled(u),m=c.length;for(let t=0;t<m;++t){const e=c[t];if("fulfilled"===e.status){const t=e.value,s=this._vxl._malloc(t.byteLength);new Uint8Array(this._vxl.HEAPU8.buffer,s,t.byteLength).set(new Uint8Array(t)),_.ptrs.push(s),_.sizes.push(t.byteLength)}else _.varIds.splice(t,1)}const g=this._vxl.get_other_field_popup_values(e,_);for(let t=0;t<_.ptrs.length;++t)this._vxl._free(_.ptrs[t]);if(g.continuousValues)for(const t in g.continuousValues)i.attributes[t]=g.continuousValues[t];if(g.uniqueValues)for(const t in g.uniqueValues)i.attributes[t]=g.uniqueValues[t]}return e}_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,i,r){if(!this._vxl||!this._rctx||0===this._layers.size||!e.options.selectionMode||e.options.isFiltered||!e.camera)return;if(null==r||r[0]<0||r[0]>e.camera.viewport[2]||r[1]<0||r[1]>e.camera.viewport[3])return this._dbg(4,r?`[js] VoxelWasmPerScene.intersect: outOfRange, screenXY=[${r[0].toFixed(0)}, ${r[1].toFixed(0)}]`:"[js] VoxelWasmPerScene.intersect: outOfRange, screenXY=null"),null;const a=[];this._layers.forEach(t=>{e.options.filteredLayerViewUids.includes(t.layerView.uid)&&a.push(t.layerView.wasmLayerId)});const n=this.pickObject(r[0],r[1],e.camera,a);if(null==n||-1===n.layerId)return;const l=this._layers.get(n.layerId);if(l){const t=l.layerView.layer.uid,r=n.distanceToCamera/h(s,i),a=d();a[0]=n.worldX,a[1]=n.worldY,a[2]=n.worldZ;const o={},u=l.layerView.layer,_=u.variables.findIndex(e=>e.id===u.currentVariableId);if(_>=0){const e=u.variables.getItemAt(_);null!=e&&(null!=n.continuousValue?o[e.name]=n.continuousValue:null!=n.uniqueValueLabel&&null!=n.uniqueValue?o[e.name]=`${n.uniqueValueLabel} (${n.uniqueValue})`:null!=n.uniqueValue&&(o[e.name]=`${n.uniqueValue}`),e.description.length>0?o["Voxel.CurrentVariable"]=e.description:e.name?.length>0&&(o["Voxel.CurrentVariable"]=e.name))}if(o["Voxel.Position"]=`[${n.voxelSpacePosition.toString()}]`,null!=n.epochTime&&null!=n.nativeTime&&null!=n.nativeTimeUnits){const e=new Date(n.epochTime);o["Voxel.LocalTime"]=e,o["Voxel.SourceTime"]=`${n.nativeTime.toLocaleString()} ${n.nativeTimeUnits}`}null!=n.depth&&(o["Voxel.Depth"]=n.depth);const c=n.faceNormal;o["Voxel.WorldPosition"]=`[${a[0]}, ${a[1]}, ${a[2]}]`;const g=e=>{const s=new m(a,t,()=>this._createVoxelGraphic(l.layerView.layer,o,n));e.set(this.type,s,r,c)},f=e.results,p=2===e.options.store;if((null==f.min.distance||r<f.min.distance)&&g(f.min),(null==f.max.distance||r>f.max.distance)&&g(f.max),p){const t=new y(e.ray);g(t),e.results.all.push(t)}}}_createVoxelGraphic(e,t,s){return new c({layer:e,sourceLayer:e,origin:e.graphicOrigin,attributes:t,gpuResult: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)}hasHighlight(){return!1}};e([l({constructOnly:!0})],x.prototype,"view",void 0),x=e([o("esri.layers.VoxelWasmPerSceneView")],x);const v=x;export{v 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/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../Color.js";import{getOrCreateMapValue as t}from"../../core/MapUtils.js";import{FieldElement as s}from"../../form/elements.js";import o from"../../form/FormTemplate.js";import{initializeProjection as r,project as a}from"../../geometry/projectionUtils.js";import n from"../../geometry/SpatialReference.js";import{normalizeCentralMeridian as p}from"../../geometry/support/normalizeUtils.js";import{queryBinsCapabilities as i,queryCapabilities as l}from"../graphics/data/QueryEngineCapabilities.js";import{systemOidFieldName as u}from"./constants.js";import c from"../support/FeatureTemplate.js";import d from"../support/LabelClass.js";import y from"../support/LabelExpressionInfo.js";import{isKnowledgeGraphSublayer as m}from"../support/layerUtils.js";import{fetchClientDataAtKeys as f}from"../../rest/knowledgeGraphService.js";import b from"../../rest/knowledgeGraph/Entity.js";import h from"../../rest/knowledgeGraph/GraphApplyEdits.js";import g from"../../rest/knowledgeGraph/Relationship.js";import{isGraphic as w}from"../../support/guards.js";import I from"../../symbols/CIMSymbol.js";import C from"../../symbols/TextSymbol.js";const j={initializeLayersFromClientData:async(e,t,s)=>{if(t||(t=[...e.layers,...e.tables].map(e=>e.graphTypeName)),0===t?.length)return;const o=new Map;for(const a of t)o.set(a,S(e,a));const r=await f(e.dataManager.knowledgeGraph,Array.from(o.values()),{requestOptions:{signal:s?.signal}});for(const a of[...e.layers,...e.tables]){const t=a.objectType.name;if(null==t)continue;const s=r.get(S(e,t));if(s){const e=JSON.parse(s);null===e||"object"!=typeof e||e.hasOwnProperty("showLabels")||(e.showLabels=!1),a.read(e,{origin:"service"})}}}},S=(e,t)=>"knowledge-graph"===e.type?`${t}/Map`:`${t}/LinkChart/LinkChartSubLayer`;async function L(e,t,s){return j.initializeLayersFromClientData(e,t,s)}const A=["#4a0932","#b31515","#18382e","#a64f1b","#102432","#8c213f","#ed9310","#2c6954","#144d59","#ffc730","#75351e","#454f4b","#78b1c2","#191921","#8f8f82","#9be0c0","#dbb658","#87b051","#11495c","#c43541","#9c5596","#44498b","#ad9d63","#86afb3","#5c98ca","#b0bfa2","#73241f","#b86b53","#d9d78c","#3e756d","#f260a1","#a0d17d","#c27c30","#eb82eb","#ffdf3c","#ffb259","#ab52b3","#3cccb4","#0095ba","#d92b30"],M="#8f8f82";function R(t){return t<0||t>=A.length?new e(M):new e(A[t])}function T(e){const t=e.toArray();return new I({data:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",enable:!0,style:"solid",width:.75,color:t},{type:"CIMVectorMarker",enable:!0,size:6,markerPlacement:{type:"CIMMarkerPlacementOnLine",angleToLine:!0,relativeTo:"LineMiddle"},frame:{xmin:-10,ymin:-5,xmax:0,ymax:5},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[-12,-3.47],[-12,3.6],[1.96,-.03],[-12,-3.47]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:t}]}}]}]}}})}function k(e){let t="ESRI__ID",s=4;for(const o of e)if(o.name){if("name"===o.name.toLowerCase()){t=o.name;break}o.name.toLowerCase().includes("name")?(t=o.name,s=2):"esriFieldTypeString"===o.fieldType&&s>3&&(t=o.name,s=3)}return t}function N(e,t,s){const o={color:[80,80,80],haloColor:[255,255,255],haloSize:.7,font:{size:10,weight:"normal"}},r=new d({labelExpressionInfo:new y({expression:"ESRI__ID"===s?`${t}`:`$feature.${s}`}),labelPlacement:"above-center",symbol:new C(o)}),a=new d({labelExpressionInfo:new y({expression:`'${t}' + IIf($feature.ESRI__AggregationCount>1, ' (' + $feature.ESRI__AggregationCount + ')', '')`}),labelPlacement:"center-along",labelPosition:"parallel",repeatLabel:!1,symbol:new C({...o,yoffset:"12px"})});return"entity"===e?[r]:[a]}function E(e,t,s){const o={color:[255,255,255],haloColor:[0,0,0],haloSize:.7,font:{size:10,weight:"bold"}},r="ESRI__ID"===s?`${e}`:`$feature.${s}`;return"point"===t?[new d({labelExpressionInfo:new y({expression:r}),labelPlacement:"above-center",symbol:new C(o)})]:"polyline"===t?[new d({labelExpressionInfo:new y({expression:r}),labelPlacement:"center-along",repeatLabel:!0,symbol:new C(o)})]:"polygon"===t?[new d({labelExpressionInfo:new y({expression:r}),labelPlacement:"always-horizontal",symbol:new C(o)})]:null}const x={capabilities:[],allowGeometryUpdates:!1,serviceCapabilities:{geometryCapabilities:{supportsZValues:!1,supportsMValues:!1}}};function F(e){const{capabilities:t,allowGeometryUpdates:s,serviceCapabilities:{geometryCapabilities:{supportsZValues:o,supportsMValues:r}}}=e?.serviceDefinition||x,a=e?.dataModel.arcgisManaged?t:t.filter(e=>"Query"===e),n=new Set(a);return{analytics:{supportsCacheHint:!1},attachment:null,data:{isVersioned:!1,isBranchVersioned:!1,supportsAttachment:!1,supportsM:r,supportsZ:o},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:n.has("Create"),supportsDelete:n.has("Delete"),supportsEditing:n.has("Editing"),supportsChangeTracking:!1,supportsQuery:n.has("Query"),supportsQueryBins:!1,supportsQueryPivot:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:n.has("Update"),supportsExceedsLimitStatistics:!1,supportsAsyncConvert3D:!1},query:l,queryRelated:{supportsCount:!1,supportsOrderBy:!1,supportsPagination:!1,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},queryAttributeBins:i,editing:{supportsGeometryUpdate:!!e?.dataModel.arcgisManaged&&s,supportsGlobalId:!1,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsUpdateWithoutM:!1,supportsUploadWithItemId:!1,supportsDeleteByAnonymous:!1,supportsDeleteByOthers:n.has("Delete"),supportsUpdateByAnonymous:!1,supportsUpdateByOthers:n.has("Update"),supportsAsyncApplyEdits:!1,zDefault:void 0}}}async function U(e,s){const o=new h,i=s.graphTypeName,l=s.graphType,c="knowledge-graph"===s.parentCompositeLayer.type?s.geometryFieldName:null,d=!!s.fieldsIndex.get(c)?.editable,y=e=>{const t={...e};for(const o of s.fields)o.editable||delete t[o.name];for(const s of Object.keys(e))s.includes("ESRI__")&&delete t[s];return t},f=async e=>{await r(e.spatialReference,n.WGS84);const t=a(e,n.WGS84);if("point"===t.type)return t.normalize();return(await p(t))[0]};for(const t of e.addFeatures??[]){const e=y(t.attributes);m(t.sourceLayer)&&t.sourceLayer.graphTypeName===i&&("entity"===l?(o.entityAdds||(o.entityAdds=[]),c&&t.geometry&&(e[c]=await f(t.geometry)),o.entityAdds.push(new b({properties:e,typeName:i}))):(o.relationshipAdds||(o.relationshipAdds=[]),o.relationshipAdds.push(new g({properties:e,typeName:i}))))}for(const t of e.updateFeatures??[]){const e=t.attributes[u],s=y(t.attributes);m(t.sourceLayer)&&t.sourceLayer.graphTypeName===i&&("entity"===l?(o.entityUpdates||(o.entityUpdates=[]),c&&d&&t.geometry&&(s[c]=await f(t.geometry)),o.entityUpdates.push(new b({id:e,properties:s,typeName:i}))):(o.relationshipUpdates||(o.relationshipUpdates=[]),o.relationshipUpdates.push(new g({id:e,properties:s,typeName:i}))))}const I=new Map;for(const r of e.deleteFeatures??[])if(w(r)){const e=r,s=t(I,e.sourceLayer.graphTypeName,()=>({typeName:e.sourceLayer.graphTypeName,ids:[]}));e.sourceLayer.graphTypeName===i&&s.ids.push(e.attributes[u])}else if(r.objectId&&"string"==typeof r.objectId){t(I,i,()=>({typeName:i,ids:[]})).ids.push(r.objectId)}for(const t of I.values())t.ids.length>0&&("entity"===l?(o.entityDeletes||(o.entityDeletes=[]),o.entityDeletes.push({typeName:t.typeName,ids:t.ids})):(o.relationshipDeletes||(o.relationshipDeletes=[]),o.relationshipDeletes.push({typeName:t.typeName,ids:t.ids})));return o}function D(e,t){const s={addFeatureResults:[],updateFeatureResults:[],deleteFeatureResults:[],addAttachmentResults:[],updateAttachmentResults:[],deleteAttachmentResults:[]};for(const o of e.editResults)if(o.typeName===t){for(const e of o.adds)s.addFeatureResults.push({objectId:e.id,globalId:e.id});for(const e of o.updates)s.updateFeatureResults.push({objectId:e.id,globalId:e.id});for(const e of o.deletes)s.deleteFeatureResults.push({objectId:e.id,globalId:e.id})}return s}function v(e){if(!e.objectType)return null;const t=[];for(const o of e.fields)!o.name.includes("ESRI__")&&o.editable&&"geometry"!==o.type&&t.push(new s({fieldName:o.name}));return new o({elements:t})}function G(e){if(!e.objectType)return null;let t=null;switch(e.geometryType){case"point":case"multipoint":t="point";break;case"polyline":t="line";break;case"polygon":t="polygon";break;default:t=null}return[new c({name:e.graphTypeName,drawingTool:t,prototype:{}})]}export{D as convertGraphEditsResultToFeatureEdits,U as convertLayerEditsToGraphEdits,F as createCapabilitiesFromKnowledgeGraph,G as createDefaultKGSLFeatureTemplates,v as createDefaultKGSLFormTemplate,M as fallbackKGSublayerSymbolHexColor,T as getDefaultLCRelationshipSublayerSymbol,k as getDisplayLabelProperty,R as getKGSublayerSymbolColor,N as getLinkChartDefaultLabelingInfo,E as getMapDefaultLabelingInfo,L as initializeLayersFromClientData,j as layerUtils};
|
|
5
|
+
import e from"../../Color.js";import t from"../../core/Error.js";import{getOrCreateMapValue as o}from"../../core/MapUtils.js";import{FieldElement as s}from"../../form/elements.js";import r from"../../form/FormTemplate.js";import{initializeProjection as a,project as n}from"../../geometry/projectionUtils.js";import i from"../../geometry/SpatialReference.js";import{normalizeCentralMeridian as p}from"../../geometry/support/normalizeUtils.js";import{queryBinsCapabilities as l,queryCapabilities as u}from"../graphics/data/QueryEngineCapabilities.js";import{systemOidFieldName as d}from"./constants.js";import c from"../support/FeatureTemplate.js";import y from"../support/LabelClass.js";import m from"../support/LabelExpressionInfo.js";import{isKnowledgeGraphSublayer as f}from"../support/layerUtils.js";import{executeQueryStreaming as b,fetchClientDataAtKeys as h}from"../../rest/knowledgeGraphService.js";import g from"../../rest/knowledgeGraph/Entity.js";import w from"../../rest/knowledgeGraph/GraphApplyEdits.js";import I from"../../rest/knowledgeGraph/Relationship.js";import{isGraphic as j}from"../../support/guards.js";import C from"../../symbols/CIMSymbol.js";import A from"../../symbols/TextSymbol.js";const T={initializeLayersFromClientData:async(e,t,o)=>{if(t||(t=[...e.layers,...e.tables].map(e=>e.graphTypeName)),0===t?.length)return;const s=new Map;for(const a of t)s.set(a,S(e,a));const r=await h(e.dataManager.knowledgeGraph,Array.from(s.values()),{requestOptions:{signal:o?.signal}});for(const a of[...e.layers,...e.tables]){const t=a.objectType.name;if(null==t)continue;const o=r.get(S(e,t));if(o){const e=JSON.parse(o);null===e||"object"!=typeof e||e.hasOwnProperty("showLabels")||(e.showLabels=!1),a.read(e,{origin:"service"})}}},getInclusionDefinitionFromCypherResults:async(e,t,o)=>{const s=V(e.dataModel),r=(await b(e,t,o)).resultRowsStream.getReader();for(;;){const{done:e,value:t}=await r.read();if(e)break;for(const o of t)for(const e of o){q(e,s)}}return s},getInclusionDefinitionFromIdTypePairs:(e,o)=>{const s=V(e.dataModel);for(const{id:r,typeName:a}of o){const e=s.namedTypeDefinitions.get(a);if(!e)throw new t("WebLinkChart:data-model-desync","The provided id-type pairs contained a named type not reflected in the provided knowledge graph data model.");e.members?.set(r,{id:r})}return s}},S=(e,t)=>"knowledge-graph"===e.type?`${t}/Map`:`${t}/LinkChart/LinkChartSubLayer`;async function L(e,t,o){return T.initializeLayersFromClientData(e,t,o)}async function M(e,t,o){return T.getInclusionDefinitionFromCypherResults(e,t,o)}function R(e,t){return T.getInclusionDefinitionFromIdTypePairs(e,t)}const D=["#4a0932","#b31515","#18382e","#a64f1b","#102432","#8c213f","#ed9310","#2c6954","#144d59","#ffc730","#75351e","#454f4b","#78b1c2","#191921","#8f8f82","#9be0c0","#dbb658","#87b051","#11495c","#c43541","#9c5596","#44498b","#ad9d63","#86afb3","#5c98ca","#b0bfa2","#73241f","#b86b53","#d9d78c","#3e756d","#f260a1","#a0d17d","#c27c30","#eb82eb","#ffdf3c","#ffb259","#ab52b3","#3cccb4","#0095ba","#d92b30"],k="#8f8f82";function N(t){return t<0||t>=D.length?new e(k):new e(D[t])}function F(e){const t=e.toArray();return new C({data:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",enable:!0,style:"solid",width:.75,color:t},{type:"CIMVectorMarker",enable:!0,size:6,markerPlacement:{type:"CIMMarkerPlacementOnLine",angleToLine:!0,relativeTo:"LineMiddle"},frame:{xmin:-10,ymin:-5,xmax:0,ymax:5},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[-12,-3.47],[-12,3.6],[1.96,-.03],[-12,-3.47]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:t}]}}]}]}}})}function E(e){let t="ESRI__ID",o=4;for(const s of e)if(s.name){if("name"===s.name.toLowerCase()){t=s.name;break}s.name.toLowerCase().includes("name")?(t=s.name,o=2):"esriFieldTypeString"===s.fieldType&&o>3&&(t=s.name,o=3)}return t}function v(e,t,o){const s={color:[80,80,80],haloColor:[255,255,255],haloSize:.7,font:{size:10,weight:"normal"}},r=new y({labelExpressionInfo:new m({expression:"ESRI__ID"===o?`${t}`:`$feature.${o}`}),labelPlacement:"above-center",symbol:new A(s)}),a=new y({labelExpressionInfo:new m({expression:`'${t}' + IIf($feature.ESRI__AggregationCount>1, ' (' + $feature.ESRI__AggregationCount + ')', '')`}),labelPlacement:"center-along",labelPosition:"parallel",repeatLabel:!1,symbol:new A({...s,yoffset:"12px"})});return"entity"===e?[r]:[a]}function x(e,t,o){const s={color:[255,255,255],haloColor:[0,0,0],haloSize:.7,font:{size:10,weight:"bold"}},r="ESRI__ID"===o?`${e}`:`$feature.${o}`;return"point"===t?[new y({labelExpressionInfo:new m({expression:r}),labelPlacement:"above-center",symbol:new A(s)})]:"polyline"===t?[new y({labelExpressionInfo:new m({expression:r}),labelPlacement:"center-along",repeatLabel:!0,symbol:new A(s)})]:"polygon"===t?[new y({labelExpressionInfo:new m({expression:r}),labelPlacement:"always-horizontal",symbol:new A(s)})]:null}const U={capabilities:[],allowGeometryUpdates:!1,serviceCapabilities:{geometryCapabilities:{supportsZValues:!1,supportsMValues:!1}}};function P(e){const{capabilities:t,allowGeometryUpdates:o,serviceCapabilities:{geometryCapabilities:{supportsZValues:s,supportsMValues:r}}}=e?.serviceDefinition||U,a=e?.dataModel.arcgisManaged?t:t.filter(e=>"Query"===e),n=new Set(a);return{analytics:{supportsCacheHint:!1},attachment:null,data:{isVersioned:!1,isBranchVersioned:!1,supportsAttachment:!1,supportsM:r,supportsZ:s},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:n.has("Create"),supportsDelete:n.has("Delete"),supportsEditing:n.has("Editing"),supportsChangeTracking:!1,supportsQuery:n.has("Query"),supportsQueryBins:!1,supportsQueryPivot:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:n.has("Update"),supportsExceedsLimitStatistics:!1,supportsAsyncConvert3D:!1},query:u,queryRelated:{supportsCount:!1,supportsOrderBy:!1,supportsPagination:!1,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},queryAttributeBins:l,editing:{supportsGeometryUpdate:!!e?.dataModel.arcgisManaged&&o,supportsGlobalId:!1,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsUpdateWithoutM:!1,supportsUploadWithItemId:!1,supportsDeleteByAnonymous:!1,supportsDeleteByOthers:n.has("Delete"),supportsUpdateByAnonymous:!1,supportsUpdateByOthers:n.has("Update"),supportsAsyncApplyEdits:!1,zDefault:void 0}}}async function G(e,t){const s=new w,r=t.graphTypeName,l=t.graphType,u="knowledge-graph"===t.parentCompositeLayer.type?t.geometryFieldName:null,c=!!t.fieldsIndex.get(u)?.editable,y=e=>{const o={...e};for(const s of t.fields)s.editable||delete o[s.name];for(const t of Object.keys(e))t.includes("ESRI__")&&delete o[t];return o},m=async e=>{await a(e.spatialReference,i.WGS84);const t=n(e,i.WGS84);if("point"===t.type)return t.normalize();return(await p(t))[0]};for(const o of e.addFeatures??[]){const e=y(o.attributes);f(o.sourceLayer)&&o.sourceLayer.graphTypeName===r&&("entity"===l?(s.entityAdds||(s.entityAdds=[]),u&&o.geometry&&(e[u]=await m(o.geometry)),s.entityAdds.push(new g({properties:e,typeName:r}))):(s.relationshipAdds||(s.relationshipAdds=[]),s.relationshipAdds.push(new I({properties:e,typeName:r}))))}for(const o of e.updateFeatures??[]){const e=o.attributes[d],t=y(o.attributes);f(o.sourceLayer)&&o.sourceLayer.graphTypeName===r&&("entity"===l?(s.entityUpdates||(s.entityUpdates=[]),u&&c&&o.geometry&&(t[u]=await m(o.geometry)),s.entityUpdates.push(new g({id:e,properties:t,typeName:r}))):(s.relationshipUpdates||(s.relationshipUpdates=[]),s.relationshipUpdates.push(new I({id:e,properties:t,typeName:r}))))}const b=new Map;for(const a of e.deleteFeatures??[])if(j(a)){const e=a,t=o(b,e.sourceLayer.graphTypeName,()=>({typeName:e.sourceLayer.graphTypeName,ids:[]}));e.sourceLayer.graphTypeName===r&&t.ids.push(e.attributes[d])}else if(a.objectId&&"string"==typeof a.objectId){o(b,r,()=>({typeName:r,ids:[]})).ids.push(a.objectId)}for(const o of b.values())o.ids.length>0&&("entity"===l?(s.entityDeletes||(s.entityDeletes=[]),s.entityDeletes.push({typeName:o.typeName,ids:o.ids})):(s.relationshipDeletes||(s.relationshipDeletes=[]),s.relationshipDeletes.push({typeName:o.typeName,ids:o.ids})));return s}function _(e,t){const o={addFeatureResults:[],updateFeatureResults:[],deleteFeatureResults:[],addAttachmentResults:[],updateAttachmentResults:[],deleteAttachmentResults:[]};for(const s of e.editResults)if(s.typeName===t){for(const e of s.adds)o.addFeatureResults.push({objectId:e.id,globalId:e.id});for(const e of s.updates)o.updateFeatureResults.push({objectId:e.id,globalId:e.id});for(const e of s.deletes)o.deleteFeatureResults.push({objectId:e.id,globalId:e.id})}return o}function z(e){if(!e.objectType)return null;const t=[];for(const o of e.fields)!o.name.includes("ESRI__")&&o.editable&&"geometry"!==o.type&&t.push(new s({fieldName:o.name}));return new r({elements:t})}function $(e){if(!e.objectType)return null;let t=null;switch(e.geometryType){case"point":case"multipoint":t="point";break;case"polyline":t="line";break;case"polygon":t="polygon";break;default:t=null}return[new c({name:e.graphTypeName,drawingTool:t,prototype:{}})]}function O(e){return!(!e||"object"!=typeof e||Array.isArray(e))&&("id"in e&&"typeName"in e)}function Q(e){return!(!e||"object"!=typeof e||Array.isArray(e))&&(e&&"path"in e&&Array.isArray(e.path))}function B(e){return!(!e||"object"!=typeof e||Array.isArray(e)||"id"in e)&&("properties"in e&&"object"==typeof e.properties)}function V(e){const t={namedTypeDefinitions:new Map,generateAllSublayers:!1},{entityTypes:o,relationshipTypes:s}=e,r=[...o,...s];for(const a of r)t.namedTypeDefinitions.set(a.name,{useAllData:!1,members:new Map});return t}function q(e,o){if(e&&"object"==typeof e)if(O(e)){const s=o.namedTypeDefinitions.get(e.typeName);if(!s)throw new t("WebLinkChart:data-model-desync","The query result contained a named type not reflected in the provided knowledge graph data model.");s.members.set(e.id,{id:e.id})}else if(Q(e))for(const t of e.path)q(t,o);else if(Array.isArray(e))for(const t of e)q(t,o);else if(B(e))for(const t of Object.values(e.properties??{}))q(t,o)}export{_ as convertGraphEditsResultToFeatureEdits,G as convertLayerEditsToGraphEdits,P as createCapabilitiesFromKnowledgeGraph,$ as createDefaultKGSLFeatureTemplates,z as createDefaultKGSLFormTemplate,q as extractGraphNamedObjectsFromQueryValueRecursive,k as fallbackKGSublayerSymbolHexColor,F as getDefaultLCRelationshipSublayerSymbol,E as getDisplayLabelProperty,V as getEmptyInclusionListFromDataModel,M as getInclusionDefinitionFromCypherResults,R as getInclusionDefinitionFromIdTypePairs,N as getKGSublayerSymbolColor,v as getLinkChartDefaultLabelingInfo,x as getMapDefaultLabelingInfo,L as initializeLayersFromClientData,O as isGraphNamedObject,B as isGraphObject,Q as isPathObject,T as layerUtils};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{rad2deg as t,deg2rad as a}from"../../../core/mathUtils.js";import{create as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{
|
|
5
|
+
import{rad2deg as t,deg2rad as a}from"../../../core/mathUtils.js";import{create as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{C as o,a as n}from"../../../chunks/vec32.js";import{webMercatorToGeographic as e}from"../../../geometry/support/webMercatorUtils.js";import{getWebMercatorScalingFactor as i,convertOrientationToPixelLocation as c,validatePointsToTransform as s,validateRotationMatrix as m}from"./utils.js";import{normalizeDegrees as f}from"../../../widgets/OrientedImageryViewer/components/imageNavigationUtils.js";function l(t,a){const{cameraLocation:r,pointsToTransform:o,scalingFactor:n}=h(t,a.cameraLocation,a.rotationMatrix),e=new Array;return p(o,e,{...a,cameraLocation:r,scalingFactor:n,...d(a)}),Array.isArray(t)?e:e[0]}function u(t,a,r){return l(t?a.map(t=>e(t)):a,r).map(t=>({...t,z:1}))}function p(t,a,o){const{affineTransformations:e,cameraLocation:i,focalLengthX:c,focalLengthY:s,principalOffsetPoint:m,radialDistortionCoefficients:f,rotationMatrix:l,scalingFactor:u,tangentialDistortionCoefficients:p}=o;for(const g of t){const t=r();n(t,g,i),t[0]=t[0]/u,t[1]=t[1]/u;const o=-c*((l[0]*t[0]+l[3]*t[1]+l[6]*t[2])/(l[2]*t[0]+l[5]*t[1]+l[8]*t[2])),h=-s*((l[1]*t[0]+l[4]*t[1]+l[7]*t[2])/(l[2]*t[0]+l[5]*t[1]+l[8]*t[2])),y=o*o+h*h;let L=0,A=0,d=0,w=0,T=0,b=0,M=0;f&&(L=f[0]??0,A=f[1]??0,d=f[2]??0),p&&(w=p[0],T=p[1]),m&&(b=m[0]??0,M=m[1]??0);const N=1+L*y+A*y*y+d*y*y*y;let j=o*N+w*(y+2*o**2)+2*T*o*h,F=h*N+T*(y+2*h**2)+2*w*o*h;j+=b,F+=M;const v=Number(e[0])+Number(e[1])*j+Number(e[2])*F,x=Number(e[3])+Number(e[4])*j+Number(e[5])*F;a.push({x:v,y:x})}}function g(a,r){const{cameraHeading:n,imageHeight:e,imageWidth:s}=r,{cameraLocation:m,pointsToTransform:l}=y(a,r.cameraLocation),u=new Array,p=i(m[1],r.cameraLocation.spatialReference);for(const i of l){const a=o([m[0],m[1],m[2]*p],[i[0],i[1],i[2]*p]),r=[(i[0]-m[0])/a,(i[1]-m[1])/a,(i[2]-m[2])*p/a],l=0!==r[0]&&0!==r[1]?f(t(Math.atan2(r[0],r[1]))-n):0,g=t(Math.acos(-r[2]));u.push(c(l,g,s,e))}return Array.isArray(a)?u:u[0]}function h(t,a,r){const o=Array.isArray(t)||"items"in t?t:[t];s(o,a),L(o,a),m(r);const n=i(a.y,a.spatialReference);return{pointsToTransform:o.map(t=>t.toArray()),scalingFactor:n,cameraLocation:a.toArray()}}function y(t,a){const r=Array.isArray(t)||"items"in t?t:[t];return s(r,a),L(r,a),{pointsToTransform:r.map(t=>t.toArray()),cameraLocation:a.toArray()}}function L(t,a){if(t.some(t=>!t.spatialReference.equals(a.spatialReference)))throw new Error("Input points and camera location must have the same spatial reference")}function A(t){return null!=t?.focalLength}function d(t){if(A(t))return{focalLengthX:t.focalLength,focalLengthY:t.focalLength};const{imageWidth:r,imageHeight:o,horizontalFieldOfView:n,verticalFieldOfView:e}=t;return{focalLengthX:r/(2*Math.tan(a(n)/2)),focalLengthY:o/(2*Math.tan(a(e)/2))}}export{l as worldToImage,g as worldToImagePanoramic,u as worldToImageWithLTPFlag};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../request.js";import{isSome as t}from"../../core/arrayUtils.js";import{isDateString as i}from"../../core/date.js";import r from"../../core/Error.js";import{
|
|
5
|
+
import e from"../../request.js";import{isSome as t}from"../../core/arrayUtils.js";import{isDateString as i}from"../../core/date.js";import r from"../../core/Error.js";import{cacheAsync as n,getYieldedValue as o}from"../../core/iteratorUtils.js";import{_parseInfo as l}from"../../core/number.js";import{urlToObject as s}from"../../core/urlUtils.js";import a from"./Field.js";import{normalizeFieldName as c,getFieldDefaultLength as f}from"./fieldUtils.js";import{inferLocationInfo as u}from"./locationUtils.js";async function d(t,i={}){const{customParameters:n,signal:o}=i,l=s(t),a=await e(l.path,{query:{...l.query,...n},responseType:"native",signal:o});if(!a.data.body)throw new r("csv-utils:empty-csv","CSV is empty");const[c]=await Promise.allSettled([m(a.data.body)]);if(await a.data.body.cancel(),"rejected"===c.status)throw c.reason;return{url:t,customParameters:n,...c.value}}async function m(e){const t=e.getReader(),i=n(w(t)),l=i(),s=o(await l.next())?.trim(),c=o(await l.next())?.trim();if(!s)throw new r("csv-utils:empty-csv","CSV is empty");const{delimiter:f,locationInfo:u}=N(s,c);if(!f)throw new r("csv-utils:invalid-delimiter","Unable to detect the delimiter from CSV",{firstLine:s,secondLine:c});const{names:d,aliases:m}=S(s,f),p=i();await p.next();const y=await j(p,f,d,m,u);return t.releaseLock(),e.cancel().catch(()=>{}),{delimiter:f,fields:y.map(e=>a.fromJSON(e)),latitudeField:u?.latitudeFieldName,longitudeField:u?.longitudeFieldName}}const p=/^\s*"([\S\s]*)"\s*$/,y=/""/g,g="\n",h=[","," ",";","|","\t"];async function*w(e){const t=/\r?\n/gm,i=new TextDecoder;let r="";for await(const n of F(e)){const e=`${r}${i.decode(n)}`.split(t).filter(Boolean);r=e.pop()||"",yield*e}}async function*F(e){let t=await e.read();for(;!t.done;)yield t.value,t=await e.read();e.releaseLock()}function N(e,t,i){e=e.trim(),t=t?.trim();const r=[],n=Array.from(new Set([i?.delimiter,...h])).filter(e=>null!=e);for(const l of n){const i=v(e,l).length,n=v(t,l).length??i;i>1&&r.push({weight:Math.min(i,n),delimiter:l})}const o=r.sort(({weight:e},{weight:t})=>t-e).map(({delimiter:e})=>e);for(const l of o){const t=S(e,l).names,r=u(t,i?.longitudeField,i?.latitudeField);if(r.longitudeFieldName&&r.latitudeFieldName)return{delimiter:l,locationInfo:r}}return{delimiter:o[0],locationInfo:null}}async function*b(e,t,i,r=()=>Object.create(null)){let n="",o="",l=0,s=r(),a=0;for await(const c of e){const e=T(c,i);for(const c of e)if(n+=o+c,o="",l+=I(c),l%2==0){if(l>0){const e=p.exec(n);if(!e)return s=r(),a=0,n="",void(l=0);s[t[a]]=U(e[1]).replaceAll(y,'"'),a++}else s[t[a]]=U(n),a++;n="",l=0}else o=i;0===l?(yield s,s=r(),a=0):o=g}}function T(e,t){return x(e,t)}function*x(e,t){let i=0;for(;i<=e.length;){const r=e.indexOf(t,i),n=e.slice(i,r>-1?r:void 0);i+=n.length+t.length,yield n}}function S(e,i){const r=v(e,i).filter(t),n=r.map(e=>c(e));for(let t=n.length-1;t>=0;t--)n[t]||(n.splice(t,1),r.splice(t,1));return{names:n,aliases:r}}function v(e,t){if(!e?.length)return[];const i=[];let r="",n="",o=0;const l=T(e,t);for(const s of l)if(r+=n+s,n="",o+=I(s),o%2==0){if(o>0){const e=p.exec(r);e&&i.push(e[1].replaceAll(y,'"'))}else i.push(r);r="",o=0}else n=t;return i}async function j(e,t,i,r,n){const o=[],l=[];for await(const s of b(e,i,t)){if(10===l.length)break;l.push(s)}for(let s=0;s<i.length;s++){const e=i[s],t=r[s];if(e===n?.longitudeFieldName||e===n?.latitudeFieldName)o.push({name:e,type:"esriFieldTypeDouble",alias:t});else{const i=D(l.map(t=>t[e]))??"esriFieldTypeString";o.push({name:e,type:i,alias:t,length:f(i)})}}return o}function D(e){if(!e.length)return"esriFieldTypeString";const t=/[^+\-.,0-9]/;return e.map(e=>{if(""!==e){if(!t.test(e)){let t=O(e);if(!isNaN(t))return/[.,]/.test(e)||!Number.isInteger(t)||t>214783647||t<-214783648?"esriFieldTypeDouble":"esriFieldTypeInteger";if(e.includes("E")){if(t=Number(e),!Number.isNaN(t))return"esriFieldTypeDouble";if(e.includes(",")&&(e=e.replace(",","."),t=Number(e),!Number.isNaN(t)))return"esriFieldTypeDouble"}}return i(e)?"esriFieldTypeDate":"esriFieldTypeString"}}).reduce((e,t)=>void 0===e?t:void 0===t?e:e===t?t:"esriFieldTypeString"===e||"esriFieldTypeString"===t?"esriFieldTypeString":"esriFieldTypeDouble"===e||"esriFieldTypeDouble"===t?"esriFieldTypeDouble":void 0)}const O=function(){const e=l(),t=new RegExp("^"+e.regexp+"$"),i=new RegExp("["+e.group+"\\s\\xa0]","g"),r=e.factor;return n=>{const o=t.exec(n);if(e.factor=r,!o)return NaN;let l=o[1];if(!o[1]){if(!o[2])return NaN;l=o[2],e.factor*=-1}return l=l.replace(i,"").replace(e.decimal,"."),+l*e.factor}}();function U(e){return JSON.parse(JSON.stringify(e))}function I(e){let t=0,i=0;for(i=e.indexOf('"',i);i>=0;)t++,i=e.indexOf('"',i+1);return t}export{d as getCSVLayerInfo};
|