@arcgis/core 4.29.0 → 4.29.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/arcade/treeAnalysis.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{b43fde3e25d0c3b020b5.js → 039a872509872ce67ba4.js} +1 -1
- package/assets/esri/core/workers/chunks/{5243f9ff21e768c620c2.js → 23a5d750d93a7829174f.js} +1 -1
- package/assets/esri/core/workers/chunks/{47e6119be4a4a5ed640d.js → 2447a4d5886aeb0ff72a.js} +1 -1
- package/assets/esri/core/workers/chunks/{7f45a9e9bdbcffc2d6e0.js → 348bcc57b99a975902a8.js} +1 -1
- package/assets/esri/core/workers/chunks/{8c9fb2601488998013ba.js → 3523789a2948a4ab8cc8.js} +1 -1
- package/assets/esri/core/workers/chunks/{24649b410b757599a549.js → 48db6e0bbb1a9c043193.js} +1 -1
- package/assets/esri/core/workers/chunks/{752082be991f1cc8558f.js → 4984e2b79d862114d6a6.js} +1 -1
- package/assets/esri/core/workers/chunks/{8d9736fd15cdb54d9855.js → 5227f9eea6988aadad7f.js} +1 -1
- package/assets/esri/core/workers/chunks/60ab18c6a04d4b2f1d4c.js +1 -0
- package/assets/esri/core/workers/chunks/647515801d94180b8402.js +1 -0
- package/assets/esri/core/workers/chunks/6c3ae96ec90e9ed7dd50.js +1 -0
- package/assets/esri/core/workers/chunks/7427d03e693f32a81377.js +1 -0
- package/assets/esri/core/workers/chunks/7a8bba91769ee18cc39f.js +1 -0
- package/assets/esri/core/workers/chunks/7a98d2e026f63a581b1e.js +1 -0
- package/assets/esri/core/workers/chunks/8a9387483b19a5ec5b86.js +1 -0
- package/assets/esri/core/workers/chunks/{1a25ba411b89e050fbb7.js → a61f337802ae963d7f65.js} +1 -1
- package/assets/esri/core/workers/chunks/{d0c5318d7ef2e923aad0.js → a8ac511280f873960d46.js} +1 -1
- package/assets/esri/core/workers/chunks/b125ab84b7761e761734.js +1 -0
- package/assets/esri/core/workers/chunks/{b34d6e58b125fe111f91.js → b42a83db83851cb57d44.js} +1 -1
- package/assets/esri/core/workers/chunks/{1497dd943df7eede0704.js → b9c55ff1f21db198ce03.js} +1 -1
- package/assets/esri/core/workers/chunks/bb3322ddb89c0bd444f0.js +1 -0
- package/assets/esri/core/workers/chunks/becfdaeeb07f089d8be7.js +1 -0
- package/assets/esri/core/workers/chunks/{b26e39a399963c176d33.js → c527692694688a5b3b07.js} +2 -2
- package/assets/esri/core/workers/chunks/{210a93e0b96c5bff44a3.js → c556644bb0cf88770939.js} +1 -1
- package/assets/esri/core/workers/chunks/{a5e7b4acae17f88e2208.js → ce93027b6b81428ce9b0.js} +1 -1
- package/assets/esri/core/workers/chunks/{b8ece275abac93f3dccf.js → d14f16bfa6c12909929c.js} +1 -1
- package/assets/esri/core/workers/chunks/{1594f06a2d7d9439c62e.js → e2147c99cc5839654be1.js} +1 -1
- package/assets/esri/core/workers/chunks/{d33ed3a2a0d4b640bd4a.js → e4c7d8c69e4957c9d27c.js} +1 -1
- package/assets/esri/core/workers/chunks/{7709248f59520aee6f51.js → eceaa46f622f6fa31128.js} +1 -1
- package/assets/esri/core/workers/chunks/{2286db4c83ff1b6fb088.js → ef3e6209e6ac6a56960b.js} +1 -1
- package/assets/esri/core/workers/chunks/f59b5ea05caca8a1a398.js +1 -0
- package/chunks/Laserlines.glsl.js +3 -3
- package/chunks/Precipitation.glsl.js +1 -1
- package/chunks/SSAOBlur.glsl.js +2 -2
- package/chunks/boundedPlane.js +1 -1
- package/chunks/cameraUtilsSpherical.js +1 -1
- package/chunks/sphere.js +1 -1
- package/chunks/terrainUtilsPlanar.js +1 -1
- package/chunks/vec32.js +1 -1
- package/core/libs/gl-matrix-2/math/quat.js +1 -1
- package/core/libs/gl-matrix-2/math/vec3.js +1 -1
- package/core/libs/gl-matrix-2/vec3.js +1 -1
- package/geohash/geohashUtils.js +1 -1
- package/geometry/support/axisAngleDegrees.js +1 -1
- package/geometry/support/coordinateSystem.js +1 -1
- package/geometry/support/lineSegment.js +1 -1
- package/geometry/support/meshUtils/exporters/gltf/gltf.js +1 -1
- package/geometry/support/meshUtils/georeference.js +1 -1
- package/geometry/support/meshUtils/merge.js +1 -1
- package/geometry/support/meshUtils/rotate.js +1 -1
- package/geometry/support/meshUtils/scale.js +1 -1
- package/geometry/support/meshUtils/vertexSpaceConversion.js +5 -0
- package/geometry/support/meshVertexSpaceUtils.js +1 -1
- package/geometry/support/plane.js +1 -1
- package/geometry/support/ray.js +1 -1
- package/geometry/support/triangle.js +1 -1
- package/geometry/support/vector.js +1 -1
- package/interfaces.d.ts +20 -14
- package/kernel.js +1 -1
- package/layers/IntegratedMesh3DTilesLayer.js +1 -1
- package/layers/LinkChartLayer.js +1 -1
- package/layers/VoxelWasmPerSceneView.js +1 -1
- package/layers/graphics/data/StreamFeatureManager.js +1 -1
- package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
- package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
- package/layers/mixins/FeatureReductionLayer.js +1 -1
- package/layers/orientedImagery/core/coverageUtils.js +1 -1
- package/layers/orientedImagery/transformations/imageToGroundUtils.js +1 -1
- package/layers/orientedImagery/transformations/imageToWorld.js +1 -1
- package/layers/support/layerUtils.js +1 -1
- package/layers/video/VideoCameraSensorModel.js +1 -1
- package/layers/voxel/VoxelVolume.js +1 -1
- package/layers/voxel/voxelPlaneUtils.js +1 -1
- package/libs/linkchartlayout/LinkChartLayout.js +1 -1
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/cimAnalyzer.js +1 -1
- package/views/2d/arcade/callExpressionWithCursor.js +1 -1
- package/views/2d/engine/webgl/collisions/CollisionEngine.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/createTestMeshData.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriterInputEvaluator.js +1 -1
- package/views/2d/interactive/editingTools/TransformTool.js +1 -1
- package/views/2d/interactive/editingTools/manipulations/ScaleManipulation.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/features/Processor.js +1 -1
- package/views/2d/layers/features/aggregation/GeohashSpatialIndex.js +1 -1
- package/views/2d/layers/features/aggregation/GridSpatialIndex.js +1 -1
- package/views/2d/layers/features/processor/BinningStrategy.js +1 -1
- package/views/2d/layers/features/processor/ClusterStrategy.js +1 -1
- package/views/2d/layers/features/processor/FeatureUpdateStrategy.js +1 -1
- package/views/2d/layers/features/schema/processor/SimpleProcessorSchema.js +1 -1
- package/views/2d/layers/features/schema/processor/SubtypeProcessorSchema.js +1 -1
- package/views/2d/layers/features/sources/strategies/StreamLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/DrillDownTileSourceChunk.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/FeatureSnapshotSourceChunk.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/OverrideChunk.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/PagedTileSourceChunk.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/StreamSourceChunk.js +1 -1
- package/views/2d/layers/features/support/AttributeStore.js +1 -1
- package/views/2d/layers/features/support/GraphicsReader.js +1 -1
- package/views/2d/layers/features/support/Tile.js +1 -1
- package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
- package/views/2d/tiling/TileKey.js +1 -1
- package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
- package/views/3d/analysis/Dimension/lengthDimensionConstraintUtils.js +1 -1
- package/views/3d/analysis/Dimension/lengthDimensionManipulatorUtils.js +1 -1
- package/views/3d/analysis/Dimension/lengthDimensionUtils.js +1 -1
- package/views/3d/analysis/DirectLineMeasurement/DirectLineMeasurementController.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightIntersectionResult.js +1 -1
- package/views/3d/analysis/Slice/SliceTool.js +1 -1
- package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
- package/views/3d/analysis/support/measurementUtils.js +1 -1
- package/views/3d/animation/pointToPoint/Camera.js +1 -1
- package/views/3d/camera/constraintUtils/common.js +1 -1
- package/views/3d/camera/constraintUtils/distance.js +1 -1
- package/views/3d/camera/constraintUtils/tilt.js +1 -1
- package/views/3d/camera/intersectionUtils.js +1 -1
- package/views/3d/environment/ChapmanAtmosphere.js +1 -1
- package/views/3d/environment/EnvironmentRenderer.js +1 -1
- package/views/3d/environment/Fog.js +1 -1
- package/views/3d/environment/MarsAtmosphere.js +1 -1
- package/views/3d/environment/SceneViewEnvironmentManager.js +1 -1
- package/views/3d/interactive/SnappingVisualizer3D.js +1 -1
- package/views/3d/interactive/editingTools/dragEventPipeline3D.js +1 -1
- package/views/3d/interactive/editingTools/manipulations/MoveZManipulation.js +1 -1
- package/views/3d/interactive/editingTools/reshapeGraphic/ReshapeOperation.js +1 -1
- package/views/3d/interactive/editingTools/reshapeGraphic/edgeOffsetUtils.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/ExtentScale.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/extentUtils.js +1 -1
- package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/support/Segment.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/PointCloudLayerView3D.js +1 -1
- package/views/3d/layers/PointCloudWorker.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
- package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
- package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
- package/views/3d/layers/i3s/LoDUtil.js +1 -1
- package/views/3d/layers/i3s/PointRenderer.js +1 -1
- package/views/3d/layers/support/FeatureTileMeasurements3D.js +1 -1
- package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
- package/views/3d/layers/support/uvUtils.js +1 -1
- package/views/3d/state/Frustum.js +1 -1
- package/views/3d/state/NearFarHeuristic.js +1 -1
- package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
- package/views/3d/state/controllers/RotateController.js +1 -1
- package/views/3d/state/controllers/global/PinchAndPanController.js +1 -1
- package/views/3d/state/controllers/global/ZoomController.js +1 -1
- package/views/3d/state/controllers/global/ZoomStepController.js +1 -1
- package/views/3d/state/controllers/local/PinchAndPanController.js +1 -1
- package/views/3d/state/controllers/local/ZoomController.js +1 -1
- package/views/3d/state/controllers/local/ZoomStepController.js +1 -1
- package/views/3d/state/controllers/momentum/ZoomPlanarMomentumController.js +1 -1
- package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
- package/views/3d/state/utils/navigationUtils.js +1 -1
- package/views/3d/state/utils/viewUtils.js +1 -1
- package/views/3d/support/FrustumExtentIntersection.js +1 -1
- package/views/3d/support/cameraUtils.js +1 -1
- package/views/3d/support/cameraUtilsInternal.js +1 -1
- package/views/3d/support/intersectionUtils.js +1 -1
- package/views/3d/support/mathUtils.js +1 -1
- package/views/3d/support/orientedBoundingBox.js +1 -1
- package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
- package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
- package/views/3d/support/pointsOfInterest/Focus.js +1 -1
- package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
- package/views/3d/support/sunUtils.js +1 -1
- package/views/3d/support/viewpointUtils.js +1 -1
- package/views/3d/terrain/OverlayManager.js +1 -1
- package/views/3d/terrain/PatchRenderData.js +1 -1
- package/views/3d/terrain/SphericalPatch.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/Tile.js +1 -1
- package/views/3d/webgl-engine/collections/Component/DepthRange.js +1 -1
- package/views/3d/webgl-engine/collections/Component/IntersectionGeometry.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/core/util/TwoVectorPosition.js +1 -1
- package/views/3d/webgl-engine/effects/RenderNodes.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
- package/views/3d/webgl-engine/lib/BoundingInfo.js +1 -1
- package/views/3d/webgl-engine/lib/Camera.js +1 -1
- package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
- package/views/3d/webgl-engine/lib/Object3D.js +1 -1
- package/views/3d/webgl-engine/lib/Octree.js +1 -1
- package/views/3d/webgl-engine/lib/PathVertex.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/edgePreprocessing.js +1 -1
- package/views/3d/webgl-engine/lib/geometryDataUtils.js +1 -1
- package/views/3d/webgl-engine/lib/intersectorUtils.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/verticalOffsetUtils.js +1 -1
- package/views/3d/webgl-engine/lighting/SceneLighting.js +1 -1
- package/views/3d/webgl-engine/lighting/SphericalHarmonics.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/pbrUtils.js +1 -1
- package/views/SelectionManager.js +1 -1
- package/views/draw/support/createUtils.js +1 -1
- package/views/draw/support/surfaceCoordinateSystems.js +1 -1
- package/views/interactive/GraphicManipulator.js +1 -1
- package/views/interactive/SegmentLabels.js +1 -1
- package/views/interactive/coordinateHelper.js +1 -1
- package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
- package/views/interactive/editGeometry/support/editPlaneUtils.js +1 -1
- package/views/interactive/sketch/constraints.js +1 -1
- package/views/interactive/snapping/RightAngleSnapper.js +1 -1
- package/views/interactive/snapping/candidates/ParallelLineSnappingCandidate.js +1 -1
- package/views/interactive/snapping/candidates/RightAngleTriangleSnappingCandidate.js +1 -1
- package/views/interactive/snapping/featureSources/sceneLayerSource/SceneLayerSnappingSourceWorker.js +1 -1
- package/views/interactive/snapping/featureSources/sceneLayerSource/sceneLayerSnappingUtils.js +1 -1
- package/views/interactive/snapping/hints/IntersectionSnappingHint.js +1 -1
- package/views/interactive/snapping/hints/LineSnappingHint.js +1 -1
- package/views/interactive/snapping/hints/ParallelSnappingHint.js +1 -1
- package/views/interactive/snapping/hints/PointSnappingHint.js +1 -1
- package/views/interactive/snapping/hints/RightAngleSnappingHint.js +1 -1
- package/views/layers/FeatureLayerView.js +1 -1
- package/views/navigation/PanSphericalMomentumEstimator.js +1 -1
- package/views/support/angularMeasurementUtils.js +1 -1
- package/views/support/euclideanAreaMeasurementUtils.js +1 -1
- package/views/support/euclideanLengthMeasurementUtils.js +1 -1
- package/views/support/geometry3dUtils.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/ElevationProfile/support/geometryUtils.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/Grid/Grid.js +1 -1
- package/widgets/FeatureTable/support/ColumnTemplateBase.js +1 -1
- package/widgets/Features/FeaturesViewModel.js +1 -1
- package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
- package/widgets/PanoramicViewer/utils.js +1 -1
- package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
- package/widgets/support/Selector2D/SelectionOperation.js +1 -1
- package/widgets/support/Selector2D/selectorUtils.js +1 -1
- package/assets/esri/core/workers/chunks/0e83f3718a0b45652b5e.js +0 -1
- package/assets/esri/core/workers/chunks/1fa5c8af69a09a3730b3.js +0 -1
- package/assets/esri/core/workers/chunks/4736f79b5c94ce103d43.js +0 -1
- package/assets/esri/core/workers/chunks/65f7adaaf1f535310c11.js +0 -1
- package/assets/esri/core/workers/chunks/79c041b292648c5eaecc.js +0 -1
- package/assets/esri/core/workers/chunks/7c4c2c0beddabac672b6.js +0 -1
- package/assets/esri/core/workers/chunks/9307d485a9e5f9fa77d1.js +0 -1
- package/assets/esri/core/workers/chunks/9a758de08dfa57735879.js +0 -1
- package/assets/esri/core/workers/chunks/a4c3da057ec2a07bbbe8.js +0 -1
- package/assets/esri/core/workers/chunks/b252270b100351779f1f.js +0 -1
- package/assets/esri/core/workers/chunks/dc57aa9f2fc69e654559.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{ASendState as t,AProcessorStrategy as e}from"./AProcessorStrategy.js";import{FeatureTileUpdateMessage as s,FeatureTileAppendMessage as r}from"../sources/FeatureSourceMessage.js";import{OverrideChunk as n}from"../sources/strategies/chunks/OverrideChunk.js";class o extends t{}class a extends e{constructor(t,e){super(t,e),this.handledChunks=new Set,this.handledChunksForIdCreation=new Set,this.handledChunksForAttributeData=new Set}destroy(){super.destroy();for(const t of this._source.chunks())this._cleanupChunkIds(t)}invalidateAttributeData(){this.handledChunksForAttributeData.clear()}onSubscribe(t){super.onSubscribe(t),this._evalOptions=t.tile.
|
|
5
|
+
import{ASendState as t,AProcessorStrategy as e}from"./AProcessorStrategy.js";import{FeatureTileUpdateMessage as s,FeatureTileAppendMessage as r}from"../sources/FeatureSourceMessage.js";import{OverrideChunk as n}from"../sources/strategies/chunks/OverrideChunk.js";class o extends t{}class a extends e{constructor(t,e,s){super(t,e),this._timeZone=s,this.handledChunks=new Set,this.handledChunksForIdCreation=new Set,this.handledChunksForAttributeData=new Set}destroy(){super.destroy();for(const t of this._source.chunks())this._cleanupChunkIds(t)}invalidateAttributeData(){this.handledChunksForAttributeData.clear()}onSubscribe(t){super.onSubscribe(t),this._evalOptions=t.tile.createArcadeEvaluationOptions(this._timeZone)}createState(t){return new o(t)}get aggregateQueryEngine(){return null}displayMap(t,e,s){const r=new Map(t.map((t=>[e(t),t]))),n=[];for(const o of this._source.chunks()){const t=o.reader.getCursor();for(;t.next();){const e=t.getObjectId(),o=t.getDisplayId(),a=r.get(e);if(null!=a){const t=s(o,a,e);n.push(t),r.delete(e)}}}return n}getDisplayFeatures(t){const e=new Set(t),s=new Set,r=[];for(const n of this._source.chunks()){const t=n.reader.getCursor();for(;t.next();){const n=t.getObjectId(),o=t.getDisplayId();e.has(o)&&!s.has(n)&&(r.push({...t.readLegacyFeatureWorldSpace(),displayId:o}),s.add(n))}}return{features:r,aggregates:[]}}async*applyOverride(t){const e=[],r=t.reader.getCursor();for(;r.next();){const t=r.getObjectId();e.push(t);const s=this._attributeStore.createDisplayIdForObjectId(t);r.setDisplayId(s),this._attributeStore.setAttributeData(s,r,this._evalOptions)}const o=this.getDisplayIds(e),a=this.getDisplayIds(t.removed),i=new n;i.applyOverrides(t);for(const n of this._sendStates.values())yield new s(n.subscription,null,o,!1,i.queryInfo);for(const n of this._sendStates.values()){const t=i.getTileReader(n.subscription.tile);yield new s(n.subscription,t,a,!1,i.queryInfo)}for(const s of t.removed)this._attributeStore.releaseDisplayIdForObjectId(s)}async*updateChunks(){if(this._source.chunks().length){await this._updateAttributeData();for(const t of this._sendStates.values())yield*this._update(t)}}removeChunks(t){for(const e of t)this.handledChunks.delete(e.chunkId),this.handledChunksForAttributeData.delete(e.chunkId),this._cleanupChunkIds(e)}_cleanupChunkIds(t){if(this.handledChunksForIdCreation.has(t.chunkId)){const e=t.reader.getCursor();for(;e.next();){const t=e.getObjectId();this._attributeStore.releaseDisplayIdForObjectId(t)}this.handledChunksForIdCreation.delete(t.chunkId)}}async _updateAttributeData(){for(const t of this._source.chunks()){const{chunkId:e,reader:s}=t;if(!this.handledChunksForIdCreation.has(e)){this.handledChunksForIdCreation.add(e);const t=s.getCursor();for(;t.next();){const e=this._attributeStore.createDisplayIdForObjectId(t.getObjectId());t.setDisplayId(e)}}}for(const t of this._source.chunks())if(!this.handledChunksForAttributeData.has(t.chunkId)){this.handledChunksForAttributeData.add(t.chunkId);const e=t.reader.getCursor();for(;e.next();){const t=e.getDisplayId();this._attributeStore.setAttributeData(t,e,this._evalOptions)}}}*_update(t){const{subscription:e,handledChunks:s}=t;for(const n of this._source.chunks()){const{chunkId:o}=n;if(s.has(o))continue;s.add(o);const a=n.getTileReader(e.tile);a&&(yield new r(t.subscription,a,!1,n.end,n.queryInfo))}}}export{o as DefaultSendState,a as FeatureUpdateStrategy};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{pt2px as e}from"../../../../../../core/screenUtils.js";import r from"../../../../../../layers/support/OrderByInfo.js";import{createLabelMatcherSchema as t}from"./LabelMatcherSchema.js";import{createMatcherSchema as s}from"./MatcherSchema.js";import{createStorageSchema as i}from"./StorageSchema.js";import{createVisualVariableUniforms as n}from"./VisualVariablesSchema.js";async function l(e,r){const i=r.renderer,l=n(i);return{symbology:await s(e,i),labels:await t(e,r,l)}}async function a(e,r,t,s){const n=t.featureReduction;if(n)switch(n.type){case"binning":return u(n,e,r,t,s);case"cluster":return f(n,e,r,t,s)}const a=d(t.orderBy,t.renderer,t.objectIdField);return{storage:i(t.renderer,r.filters),mesh:{displayRefreshVersion:s,strategy:{type:"feature"},factory:await l(e,t),sortKey:a}}}function o(e,r){return e.fields.map((e=>({...e.toJSON(),type:c(e,r)})))}function c(e,r){const{onStatisticExpression:t,onStatisticField:s,statisticType:i}=e;switch(i){case"min":case"max":case"avg":case"avg_angle":case"sum":case"count":return"esriFieldTypeDouble";case"mode":{if(t){const{returnType:e}=t;return e?"string"===e?"esriFieldTypeString":"esriFieldTypeDouble":"esriFieldTypeString"}const e=r.find((e=>e.name===s));return e?e.type:"esriFieldTypeString"}}}async function u(e,r,l,a,c){const u=o(e,a.fields),f=e.renderer,d=await s(r,f),y=i(f,[null,null]),p=n(f),
|
|
5
|
+
import{pt2px as e}from"../../../../../../core/screenUtils.js";import r from"../../../../../../layers/support/OrderByInfo.js";import{createLabelMatcherSchema as t}from"./LabelMatcherSchema.js";import{createMatcherSchema as s}from"./MatcherSchema.js";import{createStorageSchema as i}from"./StorageSchema.js";import{createVisualVariableUniforms as n}from"./VisualVariablesSchema.js";async function l(e,r){const i=r.renderer,l=n(i);return{symbology:await s(e,i),labels:await t(e,r,l)}}async function a(e,r,t,s){const n=t.featureReduction;if(n)switch(n.type){case"binning":return u(n,e,r,t,s);case"cluster":return f(n,e,r,t,s)}const a=d(t.orderBy,t.renderer,t.objectIdField);return{storage:i(t.renderer,r.filters),mesh:{displayRefreshVersion:s,strategy:{type:"feature"},factory:await l(e,t),sortKey:a,timeZone:r.timeZone}}}function o(e,r){return e.fields.map((e=>({...e.toJSON(),type:c(e,r)})))}function c(e,r){const{onStatisticExpression:t,onStatisticField:s,statisticType:i}=e;switch(i){case"min":case"max":case"avg":case"avg_angle":case"sum":case"count":return"esriFieldTypeDouble";case"mode":{if(t){const{returnType:e}=t;return e?"string"===e?"esriFieldTypeString":"esriFieldTypeDouble":"esriFieldTypeString"}const e=r.find((e=>e.name===s));return e?e.type:"esriFieldTypeString"}}}async function u(e,r,l,a,c){const u=o(e,a.fields),f=e.renderer,d=await s(r,f),y=i(f,[null,null]),p=n(f),m=await t(r,{geometryType:"polygon",labelingInfo:e.labelingInfo,labelsVisible:e.labelsVisible},p);return{storage:y,mesh:{displayRefreshVersion:c,strategy:{type:"binning",fields:u,fixedBinLevel:e.fixedBinLevel,featureFilter:l.filters[0]},factory:{labels:m,symbology:d},sortKey:null,timeZone:l.timeZone}}}async function f(r,l,a,c,u){const f=o(r,c.fields),d={type:"cluster",feature:await s(l,r.effectiveFeatureRenderer),cluster:await s(l,r.effectiveClusterRenderer)},y=n(r.effectiveFeatureRenderer),p={type:"cluster",feature:await t(l,c,y),cluster:await t(l,{geometryType:"point",labelingInfo:r.labelingInfo,labelsVisible:r.labelsVisible},y)};return{storage:i(r.effectiveFeatureRenderer,[null,null]),mesh:{displayRefreshVersion:u,strategy:{type:"cluster",fields:f,featureFilter:a.filters[0],clusterRadius:e(r.clusterRadius/2)},factory:{labels:p,symbology:d},sortKey:null,timeZone:a.timeZone}}}function d(e,t,s){const i=null!=t&&"unique-value"===t.type&&t.orderByClassesEnabled;if("default"!==e||i||(e=[new r({field:s,order:"descending"})]),"default"!==e&&e.length){e.length;const r=e[0],t="ascending"===r.order?"asc":"desc";return r.field?{field:r.field,order:t}:r.valueExpression?{expression:r.valueExpression,order:t}:null}if(i){return{byRenderer:!0,order:"asc"}}return null}export{a as createSimpleProcessorSchema,o as getAggregateFields};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{createLabelMatcherSchema as e}from"./LabelMatcherSchema.js";import{createMatcherSchema as r}from"./MatcherSchema.js";import{createVVBindings as t}from"./StorageSchema.js";import{createVisualVariableUniforms as s}from"./VisualVariablesSchema.js";import{getWebGLCapabilities as a}from"../../../../../webgl/capabilities.js";async function i(e,{subtypeField:t,sublayers:s}){const a=await Promise.all(s.map((({renderer:t})=>r(e,t))));return{type:"subtype",subtypeField:t,renderers:s.reduce(((e,{subtypeCode:r},t)=>({...e,[r]:a[t]})),{})}}function
|
|
5
|
+
import{createLabelMatcherSchema as e}from"./LabelMatcherSchema.js";import{createMatcherSchema as r}from"./MatcherSchema.js";import{createVVBindings as t}from"./StorageSchema.js";import{createVisualVariableUniforms as s}from"./VisualVariablesSchema.js";import{getWebGLCapabilities as a}from"../../../../../webgl/capabilities.js";async function i(e,{subtypeField:t,sublayers:s}){const a=await Promise.all(s.map((({renderer:t})=>r(e,t))));return{type:"subtype",subtypeField:t,renderers:s.reduce(((e,{subtypeCode:r},t)=>({...e,[r]:a[t]})),{})}}function o(e,r){const s=a();return{type:"subtype",filters:e.filters,capabilities:{maxTextureSize:s.maxTextureSize},subtypeField:r.subtypeField,target:"feature",bindings:r.sublayers.reduce(((e,{renderer:r,subtypeCode:s})=>({...e,[s]:t(r)})),{})}}async function u(r,{subtypeField:t,sublayers:a}){const i=await Promise.all(a.map((t=>{const a=s(t.renderer),i={...t,geometryType:t.geometryType??null};return e(r,i,a)})));return{type:"subtype",subtypeField:t,renderers:a.reduce(((e,{subtypeCode:r},t)=>({...e,[r]:i[t]})),{})}}async function n(e,r,t,s){return{storage:o(r,t),mesh:{displayRefreshVersion:s,strategy:{type:"feature"},factory:{symbology:await i(e,t),labels:await u(e,t)},sortKey:null,timeZone:r.timeZone}}}export{n as createSubtypeProcessorSchema};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../../../core/Evented.js";import{handlesGroup as t}from"../../../../../../core/handleUtils.js";import"../../../../../../core/has.js";import{destroyMaybe as s}from"../../../../../../core/maybe.js";import{StreamFeatureManager as n}from"../../../../../../layers/graphics/data/StreamFeatureManager.js";import{createConnection as o}from"../../../../../../layers/graphics/sources/connections/createConnection.js";import{StreamConnectionState as i}from"../StreamConnectionState.js";import{StreamFeatureStore as r}from"../StreamFeatureStore.js";import{ALoadStrategy as a}from"./ALoadStrategy.js";import{StreamSourceChunk as c}from"./chunks/StreamSourceChunk.js";class h extends a{constructor(t,s,o,a,c){super(o),this._service=t,this._dataFilter=s,this._streamOptions=a,this._metadata=c,this._connectionState=new i,this.events=new e;const{objectIdField:h,timeInfo:m}=this._metadata,{purgeOptions:d}=s;this._stagingStore=new r(this._metadata,(e=>this.events.emit("features-updated",e))),this._manager=new n(this._stagingStore,h,m,d),this.connect()}destroy(){super.destroy(),this.disconnect()}get about(){return{willQueryAllFeatures:!1,willQueryFullResolutionGeometry:!1}}get connectionStatus(){return this._connectionState.connectionStatus}get errorString(){return this._connectionState?.errorString}async refresh(){this._manager.checkForUpdates()
|
|
5
|
+
import e from"../../../../../../core/Evented.js";import{handlesGroup as t}from"../../../../../../core/handleUtils.js";import"../../../../../../core/has.js";import{destroyMaybe as s}from"../../../../../../core/maybe.js";import{StreamFeatureManager as n}from"../../../../../../layers/graphics/data/StreamFeatureManager.js";import{createConnection as o}from"../../../../../../layers/graphics/sources/connections/createConnection.js";import{StreamConnectionState as i}from"../StreamConnectionState.js";import{StreamFeatureStore as r}from"../StreamFeatureStore.js";import{ALoadStrategy as a}from"./ALoadStrategy.js";import{StreamSourceChunk as c}from"./chunks/StreamSourceChunk.js";class h extends a{constructor(t,s,o,a,c){super(o),this._service=t,this._dataFilter=s,this._streamOptions=a,this._metadata=c,this._connectionState=new i,this._forceRefresh=!1,this.events=new e;const{objectIdField:h,timeInfo:m}=this._metadata,{purgeOptions:d}=s;this._stagingStore=new r(this._metadata,(e=>this.events.emit("features-updated",e))),this._manager=new n(this._stagingStore,h,m,d),this.connect()}destroy(){super.destroy(),this.disconnect()}get about(){return{willQueryAllFeatures:!1,willQueryFullResolutionGeometry:!1}}get connectionStatus(){return this._connectionState.connectionStatus}get errorString(){return this._connectionState?.errorString}async refresh(){const e=null!=this._chunk;this._manager.checkForUpdates()||!e||this._forceRefresh?(this._chunk&&this._store.remove(this._chunk),this._forceRefresh=!1,this._chunk=new c(this._stagingStore.reader),this._store.insert(this._chunk),this.events.emit("tick")):this.events.emit("tick")}async updateFields(e){throw new Error("Updating available fields not supported for StreamLayer")}async load(e){}unload(e){}disconnect(){this._connection=s(this._connection),this._connectionState.connection=null,this._handlesGroup?.remove()}connect(){if(null!=this._connection)return;const{geometryType:e,spatialReference:s}=this._metadata,{maxReconnectionAttempts:n,maxReconnectionInterval:i,geometryDefinition:r,definitionExpression:a,customParameters:c}=this._dataFilter;this._connection=o(this._service.source,s,this._streamOptions.outSR,e,a,r,n,i,c),this._handlesGroup=t([this._connection.on("data-received",(e=>this._onFeature(e))),this._connection.on("message-received",(e=>this._onWebSocketMessage(e)))]),this._connectionState.connection=this._connection}clear(){this._manager.checkForUpdates(),this._stagingStore.clear(),this._forceRefresh=!0}updateCustomParameters(e){this._connection?.updateCustomParameters(e)}sendMessageToSocket(e){this._connection?.sendMessageToSocket(e)}sendMessageToClient(e){this._connection?.sendMessageToClient(e)}_onWebSocketMessage(e){if("type"in e)switch(e.type){case"delete":if(e.objectIds)for(const t of e.objectIds)this._manager.removeById(t);if(e.trackIds)for(const t of e.trackIds)this._manager.removeByTrackId(t);break;case"clear":this.clear()}this.events.emit("message-received",e)}_onFeature(e){try{this._manager.add(e),this.events.emit("data-received",e)}catch(t){}}}export{h as StreamLoadStrategy};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{ASourceChunk as e}from"./ASourceChunk.js";class
|
|
5
|
+
import{ASourceChunk as e}from"./ASourceChunk.js";class i extends e{constructor(e,i,t,r,s,h){super(),this._reader=e,this._queryJSON=i,this._tile=t,this._sourceTile=r,this._sourceTileDepth=s,this._end=h,this.chunkId=`${this._tile.key.id}.${this._sourceTile?.key.id}${this._end?"e":""}`,this.normalizedChunkId=`${this._tile.key.normalizedId}.${this._sourceTile?.key.normalizedId}${this._end?"e":""}`}get queryInfo(){return{type:"drill-down-tile",chunkId:this.chunkId,tileId:this._tile.key.id,queryJSON:this._queryJSON,sourceTileDepth:this._sourceTileDepth,sourceTileId:this._sourceTile?.key.id,size:this.size(),end:this.end}}get first(){return 0===this._sourceTileDepth}get reader(){return this._reader}get end(){return this._end}get tile(){return this._tile}get isTiled(){return!0}getTileReader(e){return this._tile.key.id===e.key.id?this.reader:null}}export{i as DrillDownTileSourceChunk};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{ASourceChunk as e}from"./ASourceChunk.js";class t extends e{constructor(e,t,r,s){super(),this._reader=e,this._queryJSON=t,this._page=r,this._end=s,this.chunkId=`${this._page}${this.end?"e":""}
|
|
5
|
+
import{ASourceChunk as e}from"./ASourceChunk.js";class t extends e{constructor(e,t,r,s){super(),this._reader=e,this._queryJSON=t,this._page=r,this._end=s,this.chunkId=`${this._page}${this.end?"e":""}`,this.normalizedChunkId=this.chunkId}get reader(){return this._reader}get first(){return 0===this._page}get end(){return this._end}get queryInfo(){return{type:"snapshot",chunkId:this.chunkId,queryJSON:this._queryJSON,page:this._page,size:this.size(),end:this.end}}get isTiled(){return!1}getTileReader(e){const t=this.queryFeaturesInBounds(e.bounds);return t.setTransformForDisplay(e.transform),t}}export{t as FeatureSnapshotSourceChunk};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{ASourceChunk as e}from"./ASourceChunk.js";import{FeatureSetReaderJSON as r}from"../../../support/FeatureSetReaderJSON.js";class t extends e{constructor(){super(...arguments),this.chunkId="override",this.removed=new Set,this.overridenIds=new Set,this._features=[]}get reader(){return r.fromOptimizedFeatures(this._features,this._layerSchema??{fields:[]})}get queryInfo(){return{}}get first(){return!1}get end(){return!1}get isTiled(){return!1}applyOverrides(e){super.invalidate(),this._layerSchema||(this._layerSchema=e.reader.fullSchema());const{reader:r,removed:t}=e,s=[],d=new Set,o=r.getCursor(),i=new Set(t);for(this.overridenIds.clear();o.next();){const e=o.readOptimizedFeatureWorldSpace(),r=e.objectId;s.push(e),d.add(r),this.overridenIds.add(r),this.removed.delete(r)}for(const a of this._features){const e=a.objectId;i.has(e)||d.has(e)||(s.push(a),this.overridenIds.add(e))}this._features=s;for(const a of d.values())this.removed.delete(a);for(const a of t)this.removed.add(a),this.overridenIds.add(a)}getTileReader(e){if(!this._features.length)return null;const r=this.queryFeaturesInBounds(e.bounds);return r.setTransformForDisplay(e.transform),r}}export{t as OverrideChunk};
|
|
5
|
+
import{ASourceChunk as e}from"./ASourceChunk.js";import{FeatureSetReaderJSON as r}from"../../../support/FeatureSetReaderJSON.js";class t extends e{constructor(){super(...arguments),this.chunkId="override",this.normalizedChunkId="override",this.removed=new Set,this.overridenIds=new Set,this._features=[]}get reader(){return r.fromOptimizedFeatures(this._features,this._layerSchema??{fields:[]})}get queryInfo(){return{}}get first(){return!1}get end(){return!1}get isTiled(){return!1}applyOverrides(e){super.invalidate(),this._layerSchema||(this._layerSchema=e.reader.fullSchema());const{reader:r,removed:t}=e,s=[],d=new Set,o=r.getCursor(),i=new Set(t);for(this.overridenIds.clear();o.next();){const e=o.readOptimizedFeatureWorldSpace(),r=e.objectId;s.push(e),d.add(r),this.overridenIds.add(r),this.removed.delete(r)}for(const a of this._features){const e=a.objectId;i.has(e)||d.has(e)||(s.push(a),this.overridenIds.add(e))}this._features=s;for(const a of d.values())this.removed.delete(a);for(const a of t)this.removed.add(a),this.overridenIds.add(a)}getTileReader(e){if(!this._features.length)return null;const r=this.queryFeaturesInBounds(e.bounds);return r.setTransformForDisplay(e.transform),r}}export{t as OverrideChunk};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{ASourceChunk as e}from"./ASourceChunk.js";class t extends e{constructor(e,t,i,r,s){super(),this._reader=e,this._queryJSON=t,this._tile=i,this._page=r,this._end=s,this.chunkId=`${this._tile.key.id}.${this._page}${this.end?"e":""}`}get queryInfo(){return{type:"paged-tile",chunkId:this.chunkId,tileId:this._tile.key.id,queryJSON:this._queryJSON,page:this._page,size:this.size(),end:this.end}}get reader(){return this._reader}get first(){return 0===this._page}get end(){return this._end}get page(){return this._page}get tile(){return this._tile}get isTiled(){return!0}getTileReader(e){return this._tile.key.id===e.key.id?this.reader:null}}export{t as PagedTileSourceChunk};
|
|
5
|
+
import{ASourceChunk as e}from"./ASourceChunk.js";class t extends e{constructor(e,t,i,r,s){super(),this._reader=e,this._queryJSON=t,this._tile=i,this._page=r,this._end=s,this.chunkId=`${this._tile.key.id}.${this._page}${this.end?"e":""}`,this.normalizedChunkId=`${this._tile.key.normalizedId}.${this._page}${this.end?"e":""}`}get queryInfo(){return{type:"paged-tile",chunkId:this.chunkId,tileId:this._tile.key.id,queryJSON:this._queryJSON,page:this._page,size:this.size(),end:this.end}}get reader(){return this._reader}get first(){return 0===this._page}get end(){return this._end}get page(){return this._page}get tile(){return this._tile}get isTiled(){return!0}getTileReader(e){return this._tile.key.id===e.key.id?this.reader:null}}export{t as PagedTileSourceChunk};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{ASourceChunk as e}from"./ASourceChunk.js";class r extends e{constructor(e){super(),this._reader=e,this.chunkId="stream-chunk"}get reader(){return this._reader}get first(){return!0}get end(){return!0}get queryInfo(){return{type:"stream",chunkId:this.chunkId,size:this.size(),end:this.end}}get isTiled(){return!1}getTileReader(e){const r=this.queryFeaturesInBounds(e.bounds);return r.setTransformForDisplay(e.transform),r}}export{r as StreamSourceChunk};
|
|
5
|
+
import{ASourceChunk as e}from"./ASourceChunk.js";class r extends e{constructor(e){super(),this._reader=e,this.chunkId="stream-chunk",this.normalizedChunkId="stream-chunk"}get reader(){return this._reader}get first(){return!0}get end(){return!0}get queryInfo(){return{type:"stream",chunkId:this.chunkId,size:this.size(),end:this.end}}get isTiled(){return!1}getTileReader(e){const r=this.queryFeaturesInBounds(e.bounds);return r.setTransformForDisplay(e.transform),r}}export{r as StreamSourceChunk};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../../../../../core/Error.js";import has from"../../../../../core/has.js";import e from"../../../../../core/Logger.js";import{diff as i}from"../../../../../core/accessorSupport/diffUtils.js";import{highlightReasons as s}from"../../../engine/highlightReasons.js";import{attributeStoreInitialSize as r,AttributeDataType as n}from"../../../engine/webgl/definitions.js";import{getDisplayIdTexel as a}from"../../../engine/webgl/DisplayId.js";import{getPixelArrayCtor as o}from"../../../engine/webgl/Utils.js";import{nanMagicNumber as l}from"../../../engine/webgl/shaderGraph/techniques/shaders/constants.js";import{createDebugLogger as h,DEBUG_ATTR_UPDATES as c}from"../../../engine/webgl/util/debug.js";import{DisplayIdGenerator as d}from"./DisplayIdGenerator.js";import u from"./FeatureFilter.js";import{PixelType as p}from"../../../../webgl/enums.js";function g(t,e){if(!t||!e)return t;switch(e){case"radius":case"distance":return 2*t;case"diameter":case"width":return t;case"area":return Math.sqrt(t)}return t}const _=()=>e.getLogger("esri.views.layers.2d.features.support.AttributeStore"),f=h(c,_()),y={sharedArrayBuffer:has("esri-shared-array-buffer"),atomics:has("esri-atomics")};class m{constructor(t,e,i){this.size=0,this.texelSize=4,this.dirtyStart=0,this.dirtyEnd=0;const{pixelType:s,layout:r,textureOnly:n}=e;this.textureOnly=n||!1,this.pixelType=s,this.layout=r,this._resetRange(),this.size=t,this.isLocal=i,n||(this.data=this._initData(s,t))}get buffer(){return this.data?.buffer}unsetComponentAllTexels(t,e){const i=this.data;for(let s=0;s<this.size*this.size;s++)i[s*this.texelSize+t]&=~e;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponentAllTexels(t,e){const i=this.data;for(let s=0;s<this.size*this.size;s++)i[s*this.texelSize+t]|=255&e;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponent(t,e,i){const s=this.data;for(const r of i)s[r*this.texelSize+t]|=e,this.dirtyStart=Math.min(this.dirtyStart,r),this.dirtyEnd=Math.max(this.dirtyEnd,r)}setComponentTexel(t,e,i){this.data[i*this.texelSize+t]|=e,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)}unsetComponentTexel(t,e,i){this.data[i*this.texelSize+t]&=~e,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)}getData(t,e){const i=a(t);return this.data[i*this.texelSize+e]}setData(t,e,i){const s=a(t),r=1<<e;0!=(this.layout&r)?null!=this.data&&(this.data[s*this.texelSize+e]=i,this.dirtyStart=Math.min(this.dirtyStart,s),this.dirtyEnd=Math.max(this.dirtyEnd,s)):_().error("mapview-attributes-store","Tried to set a value for a texel's readonly component")}expand(t){if(this.size=t,!this.textureOnly){const e=this._initData(this.pixelType,t),i=this.data;e.set(i),this.data=e}}toMessage(){const t=this.dirtyStart,e=this.dirtyEnd,i=this.texelSize;if(t>e)return null;this._resetRange();const s=!this.isLocal,r=this.pixelType,n=this.layout,a=this.data;return{start:t,end:e,data:s&&a.slice(t*i,(e+1)*i)||null,pixelType:r,layout:n}}_initData(t,e){const i=ArrayBuffer,s=o(t),r=new s(new i(e*e*4*s.BYTES_PER_ELEMENT));for(let n=0;n<r.length;n+=4)r[n+1]=255;return r}_resetRange(){this.dirtyStart=2147483647,this.dirtyEnd=0}}class b{constructor(t){this._client=t,this._filters=[],this._blocks=new Array,this._attributeComputeInfo=null,this._abortController=new AbortController,this._size=r,this._idsToHighlight=new Map,this._referencesScale=!1,this._referencesGeometry=!1,this._initialized=!1,this.version=0,this._idGenerator=new d,this._epoch=1}destroy(){this._abortController.abort()}_initialize(){if(null!=this._blockDescriptors)return;const t=p.FLOAT;f(`Creating AttributeStore ${y.sharedArrayBuffer?"with":"without"} shared memory`),this._blockDescriptors=[{pixelType:p.UNSIGNED_BYTE,layout:1},{pixelType:p.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:p.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:t,layout:15},{pixelType:t,layout:15},{pixelType:t,layout:15},{pixelType:t,layout:15}],this._blocks=this._blockDescriptors.map((()=>null))}get referencesScale(){return this._referencesScale}get referencesGeometry(){return this._referencesGeometry}get _signal(){return this._abortController.signal}get hasHighlight(){return this._idsToHighlight.size>0}createDisplayIdForObjectId(t){return this._idGenerator.createIdForObjectId(t)}releaseDisplayIdForObjectId(t){return this._idGenerator.releaseIdForObjectId(t)}incrementDisplayIdGeneration(){this._idGenerator.incrementGeneration()}async update(t,e,s,r,n=0){const a=i(this._schema,t);if(this.version=n,a&&(has("esri-2d-update-debug")&&console.debug(`Version[${n}] AttributeStore.update`,{changed:a}),this._schema=t,this._attributeComputeInfo=null,this._initialize(),null!=t))if(s&&(this._filters=await Promise.all(t.filters.map((t=>t?u.create({geometryType:s.geometryType,hasM:!1,hasZ:!1,timeInfo:s.timeInfo,fieldsIndex:s.fieldsIndex,spatialReference:r??s.spatialReference,filterJSON:t}):null)))),"subtype"!==t.type)this._attributeComputeInfo={isSubtype:!1,map:new Map},await Promise.all(t.bindings.map((async t=>{const i=await this._bind(e,t);this._referencesGeometry=this._referencesGeometry||(i?.referencesGeometry()??!1),this._referencesScale=this._referencesScale||(i?.referencesScale()??!1)})));else{this._attributeComputeInfo={isSubtype:!0,subtypeField:t.subtypeField,map:new Map},this._referencesScale=!1,this._referencesGeometry=!1;for(const i in t.bindings){const s=t.bindings[i];await Promise.all(s.map((async t=>{const s=await this._bind(e,t,parseInt(i,10));this._referencesGeometry=this._referencesGeometry||(s?.referencesGeometry()??!1),this._referencesScale=this._referencesScale||(s?.referencesScale()??!1)})))}}}setHighlight(t){const
|
|
5
|
+
import t from"../../../../../core/Error.js";import has from"../../../../../core/has.js";import e from"../../../../../core/Logger.js";import{diff as i}from"../../../../../core/accessorSupport/diffUtils.js";import{highlightReasons as s}from"../../../engine/highlightReasons.js";import{attributeStoreInitialSize as r,AttributeDataType as n}from"../../../engine/webgl/definitions.js";import{getDisplayIdTexel as a}from"../../../engine/webgl/DisplayId.js";import{getPixelArrayCtor as o}from"../../../engine/webgl/Utils.js";import{nanMagicNumber as l}from"../../../engine/webgl/shaderGraph/techniques/shaders/constants.js";import{createDebugLogger as h,DEBUG_ATTR_UPDATES as c}from"../../../engine/webgl/util/debug.js";import{DisplayIdGenerator as d}from"./DisplayIdGenerator.js";import u from"./FeatureFilter.js";import{PixelType as p}from"../../../../webgl/enums.js";function g(t,e){if(!t||!e)return t;switch(e){case"radius":case"distance":return 2*t;case"diameter":case"width":return t;case"area":return Math.sqrt(t)}return t}const _=()=>e.getLogger("esri.views.layers.2d.features.support.AttributeStore"),f=h(c,_()),y={sharedArrayBuffer:has("esri-shared-array-buffer"),atomics:has("esri-atomics")};class m{constructor(t,e,i){this.size=0,this.texelSize=4,this.dirtyStart=0,this.dirtyEnd=0;const{pixelType:s,layout:r,textureOnly:n}=e;this.textureOnly=n||!1,this.pixelType=s,this.layout=r,this._resetRange(),this.size=t,this.isLocal=i,n||(this.data=this._initData(s,t))}get buffer(){return this.data?.buffer}unsetComponentAllTexels(t,e){const i=this.data;for(let s=0;s<this.size*this.size;s++)i[s*this.texelSize+t]&=~e;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponentAllTexels(t,e){const i=this.data;for(let s=0;s<this.size*this.size;s++)i[s*this.texelSize+t]|=255&e;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponent(t,e,i){const s=this.data;for(const r of i)s[r*this.texelSize+t]|=e,this.dirtyStart=Math.min(this.dirtyStart,r),this.dirtyEnd=Math.max(this.dirtyEnd,r)}setComponentTexel(t,e,i){this.data[i*this.texelSize+t]|=e,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)}unsetComponentTexel(t,e,i){this.data[i*this.texelSize+t]&=~e,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)}getData(t,e){const i=a(t);return this.data[i*this.texelSize+e]}setData(t,e,i){const s=a(t),r=1<<e;0!=(this.layout&r)?null!=this.data&&(this.data[s*this.texelSize+e]=i,this.dirtyStart=Math.min(this.dirtyStart,s),this.dirtyEnd=Math.max(this.dirtyEnd,s)):_().error("mapview-attributes-store","Tried to set a value for a texel's readonly component")}expand(t){if(this.size=t,!this.textureOnly){const e=this._initData(this.pixelType,t),i=this.data;e.set(i),this.data=e}}toMessage(){const t=this.dirtyStart,e=this.dirtyEnd,i=this.texelSize;if(t>e)return null;this._resetRange();const s=!this.isLocal,r=this.pixelType,n=this.layout,a=this.data;return{start:t,end:e,data:s&&a.slice(t*i,(e+1)*i)||null,pixelType:r,layout:n}}_initData(t,e){const i=ArrayBuffer,s=o(t),r=new s(new i(e*e*4*s.BYTES_PER_ELEMENT));for(let n=0;n<r.length;n+=4)r[n+1]=255;return r}_resetRange(){this.dirtyStart=2147483647,this.dirtyEnd=0}}class b{constructor(t){this._client=t,this._filters=[],this._blocks=new Array,this._attributeComputeInfo=null,this._abortController=new AbortController,this._size=r,this._idsToHighlight=new Map,this._referencesScale=!1,this._referencesGeometry=!1,this._initialized=!1,this.version=0,this._idGenerator=new d,this._epoch=1}destroy(){this._abortController.abort()}_initialize(){if(null!=this._blockDescriptors)return;const t=p.FLOAT;f(`Creating AttributeStore ${y.sharedArrayBuffer?"with":"without"} shared memory`),this._blockDescriptors=[{pixelType:p.UNSIGNED_BYTE,layout:1},{pixelType:p.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:p.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:t,layout:15},{pixelType:t,layout:15},{pixelType:t,layout:15},{pixelType:t,layout:15}],this._blocks=this._blockDescriptors.map((()=>null))}get referencesScale(){return this._referencesScale}get referencesGeometry(){return this._referencesGeometry}get _signal(){return this._abortController.signal}get hasHighlight(){return this._idsToHighlight.size>0}createDisplayIdForObjectId(t){return this._idGenerator.createIdForObjectId(t)}releaseDisplayIdForObjectId(t){return this._idGenerator.releaseIdForObjectId(t)}incrementDisplayIdGeneration(){this._idGenerator.incrementGeneration()}async update(t,e,s,r,n=0){const a=i(this._schema,t);if(this.version=n,a&&(has("esri-2d-update-debug")&&console.debug(`Version[${n}] AttributeStore.update`,{changed:a}),this._schema=t,this._attributeComputeInfo=null,this._initialize(),null!=t))if(s&&(this._filters=await Promise.all(t.filters.map((t=>t?u.create({geometryType:s.geometryType,hasM:!1,hasZ:!1,timeInfo:s.timeInfo,fieldsIndex:s.fieldsIndex,spatialReference:r??s.spatialReference,filterJSON:t}):null)))),"subtype"!==t.type)this._attributeComputeInfo={isSubtype:!1,map:new Map},await Promise.all(t.bindings.map((async t=>{const i=await this._bind(e,t);this._referencesGeometry=this._referencesGeometry||(i?.referencesGeometry()??!1),this._referencesScale=this._referencesScale||(i?.referencesScale()??!1)})));else{this._attributeComputeInfo={isSubtype:!0,subtypeField:t.subtypeField,map:new Map},this._referencesScale=!1,this._referencesGeometry=!1;for(const i in t.bindings){const s=t.bindings[i];await Promise.all(s.map((async t=>{const s=await this._bind(e,t,parseInt(i,10));this._referencesGeometry=this._referencesGeometry||(s?.referencesGeometry()??!1),this._referencesScale=this._referencesScale||(s?.referencesScale()??!1)})))}}}setHighlight(t,e){const i=this._getBlock(0);i.unsetComponentAllTexels(0,(1<<s.length)-1);for(const{displayId:s,highlightFlags:r}of t){if(null==s)continue;const t=a(s);i.setComponent(0,r,[t])}this._idsToHighlight.clear();for(const{objectId:s,highlightFlags:r}of t)this._idsToHighlight.set(s,r);for(const{objectId:s,highlightFlags:r}of e)this._idsToHighlight.set(s,r)}setData(t,e,i,s){const r=a(t);this._ensureSizeForTexel(r),this._getBlock(e).setData(t,i,s)}getData(t,e,i){return this._getBlock(e).getData(t,i)}getHighlightFlags(t){return this._idsToHighlight.get(t)||0}unsetAttributeData(t){const e=a(t);this._getBlock(0).setData(e,0,0)}setAttributeData(t,e,i){const s=a(t);this._ensureSizeForTexel(s),this._getBlock(0).setData(s,0,this.getFilterFlags(e));const r=this._attributeComputeInfo,o=1,h=4;let c=null;r&&(c=r.isSubtype?r.map.get(e.readAttribute(r.subtypeField)):r.map,c?.size&&c.forEach(((t,r)=>{const a=r*o%h,c=Math.floor(r*o/h),d=this._getBlock(c+n.VV);let u=t.field?.read(e,i);t.valueRepresentation&&(u=g(u,t.valueRepresentation));(null===u||isNaN(u)||u===1/0||u===-1/0)&&(u=l),d.setData(s,a,u)})))}get epoch(){return this._epoch}async sendUpdates(){const t=this._blocks.map((t=>null!=t?t.toMessage():null)),e=this._getInitArgs();has("esri-2d-log-updating")&&console.log("AttributeStore: _doSendUpdate.start"),await this._client.update({initArgs:e,blockData:t,version:this.version,sendUpdateEpoch:this._epoch},this._signal),this._epoch+=1,has("esri-2d-log-updating")&&console.log("AttributeStore: _doSendUpdate.end")}_ensureSizeForTexel(t){for(;t>=this._size*this._size;)if(this._expand())return}async _bind(t,e,i){const s=await t.createComputedField(e),{valueRepresentation:r}=e,n=this._attributeComputeInfo;if(n.isSubtype){const t=n.map.get(i)??new Map;t.set(e.binding,{field:s,valueRepresentation:r}),n.map.set(i,t)}else n.map.set(e.binding,{field:s,valueRepresentation:r});return s}_getInitArgs(){return this._initialized?null:(this._initialized=!0,this._getBlock(n.Animation),this._getBlock(n.GPGPU),{blockSize:this._size,blockDescriptors:this._blocks.map((t=>null!=t?{textureOnly:t.textureOnly,buffer:t.buffer,pixelType:t.pixelType}:null))})}_getBlock(t){const e=this._blocks[t];if(null!=e)return e;f(`Initializing AttributeBlock at index ${t}`);const i=new m(this._size,this._blockDescriptors[t],this._client.isLocal);return this._blocks[t]=i,this._initialized=!1,i}_expand(){if(this._size<this._schema.capabilities.maxTextureSize){const t=this._size<<=1;f("Expanding block size to",t,this._blocks);for(const e of this._blocks)e?.expand(t);return this._initialized=!1,this._size=t,0}return _().error(new t("mapview-limitations","Maximum number of onscreen features exceeded.")),-1}isVisible(t){return!!(this._getBlock(0).getData(t,0)&1<<s.length)}getFilterFlags(t){let e=0;for(let s=0;s<this._filters.length;s++){const i=!!(1<<s),r=this._filters[s];e|=(!i||null==r||r.check(t)?1:0)<<s}let i=0;if(this._idsToHighlight.size){const e=t.getObjectId();i=this.getHighlightFlags(e)}return e<<s.length|i}}export{b as AttributeStore,g as getVisualVariableSizeValueRepresentationRatio};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{ringsCentroid as t,polygonCentroid as e}from"../../../../../geometry/support/centroid.js";import{getJsonType as r}from"../../../../../geometry/support/jsonUtils.js";import{convertFromGeometry as s,quantizeOptimizedGeometry as i}from"../../../../../layers/graphics/featureConversionUtils.js";import o from"../../../../../layers/graphics/OptimizedGeometry.js";import{tileSize as n}from"../../../engine/webgl/definitions.js";import{FeatureSetReader as h}from"./FeatureSetReader.js";class c extends h{static from(t,e,r){return new c(t,e,r)}constructor(t,e,r){super(r),this._items=t,this._tile=e,this._index=-1,this._cachedGeometry=null;const s=e.lod;s.wrap&&(this._wrappingInfo={worldSizeX:s.worldSize[0]})}get _current(){return this._items[this._index]}getItem(){return this._current}getZOrder(){return this._current.zOrder}getMeshWriters(){return this._current.symbolResource?.symbolInfo.meshWriters??[]}field(t){return this.readAttribute(t)}get geometryType(){const t=r(this._current.geometry);return"esriGeometryPoint"===t?"esriGeometryMultipoint":t}getCursor(){return this.copy()}copy(){const t=new c(this._items,this._tile,this.metadata);return this.copyInto(t),t}copyInto(t){super.copyInto(t),t._cachedGeometry=this._cachedGeometry,t._index=this._index}get fields(){throw new Error("Fields reading not supported to graphics.")}get hasFeatures(){return!!this._items.length}get hasNext(){return this._index+1<this._items.length}get exceededTransferLimit(){throw new Error("InternalError: exceededTransferLimit not implemented for graphics.")}get hasZ(){return!1}get hasM(){return!1}getInTransform(){return this._tile.transform}getSize(){return this._items.length}getAttributeHash(){let t="";for(const e in this._current.attributes)t+=this._current.attributes[e];return t}getObjectId(){return this._items[this._index].objectId}getDisplayId(){return this._current.displayId}setDisplayId(t){throw new Error("InternalError: Setting displayId not supported for graphics.")}setIndex(t){this._index=t}getIndex(){return this._index}next(){for(this._cachedGeometry=null;++this._index<this._items.length&&!this._getExists(););return this._index<this._items.length}readGeometryArea(){throw new Error("InternalError: readGeometryArea not supported for graphics.")}_readGeometry(){if(!this._cachedGeometry){const t=s(this._current.projectedGeometry,this.hasZ,this.hasM);if(this._cachedGeometry=i(new o,t,this.hasZ,this.hasM,this.geometryType,this._tile.transform),!this._cachedGeometry)return null;this._wrapGeometry(this._cachedGeometry)}return this._cachedGeometry}_wrapGeometry(t){if(!this._wrappingInfo)return;const{worldSizeX:e}=this._wrappingInfo;if(t.isPoint)return 1===e?(t.coords.push(n,0),t.coords.push(2*-n,0),void t.lengths.push(3)):2===e?(t.coords.push(2*n,0),t.coords.push(4*-n,0),void t.lengths.push(3)):void this._wrapVertex(t.coords,0,2,e);if("esriGeometryMultipoint"!==this.geometryType);else{if(1===e){const e=t.coords.slice();e[0]-=512;const r=t.coords.slice();r[0]+=512,t.coords.push(...e,...r);const s=t.lengths[0];return void t.lengths.push(s,s)}this._wrapVertex(t.coords,0,2,e)}}_wrapVertex(t,e,r,s){const i=e*r,o=t[i];o<-n*(s-2)?t[i]=o+n*s:o>n*(s-1)&&(t[i]=o-n*s)}_readX(){const t=this._readGeometry();return null!=t?t.coords[0]:0}_readY(){const t=this._readGeometry();return null!=t?t.coords[1]:0}_readServerCentroid(){switch(this.geometryType){case"esriGeometryPolygon":{const t=e(this._current.projectedGeometry),r=new o([],t);return i(new o,r,this.hasZ,this.hasM,this.geometryType,this._tile.transform)}case"esriGeometryPolyline":{const e=this._current.projectedGeometry,r=t(e.paths,this.hasZ),s=new o([],r);return i(new o,s,this.hasZ,this.hasM,this.geometryType,this._tile.transform)}}return null}_readAttribute(t,e){const r=this._current.attributes[t];if(void 0!==r)return r;const s=t.toLowerCase();for(const i in this._current.attributes)if(i.toLowerCase()===s)return this._current.attributes[i]}_readAttributes(){return this._current.attributes}}export{c as GraphicsReader};
|
|
5
|
+
import{ringsCentroid as t,polygonCentroid as e}from"../../../../../geometry/support/centroid.js";import{getJsonType as r}from"../../../../../geometry/support/jsonUtils.js";import{convertFromGeometry as s,quantizeOptimizedGeometry as i}from"../../../../../layers/graphics/featureConversionUtils.js";import o from"../../../../../layers/graphics/OptimizedGeometry.js";import{tileSize as n}from"../../../engine/webgl/definitions.js";import{FeatureSetReader as h}from"./FeatureSetReader.js";class c extends h{static from(t,e,r){return new c(t,e,r)}constructor(t,e,r){super(r),this._items=t,this._tile=e,this._index=-1,this._cachedGeometry=null;const s=e.lod;s.wrap&&(this._wrappingInfo={worldSizeX:s.worldSize[0]})}get _current(){return this._items[this._index]}getItem(){return this._current}getZOrder(){return this._current.zOrder}getMeshWriters(){return this._current.symbolResource?.symbolInfo.meshWriters??[]}hasField(t){return null!=this._current.attributes[t]}field(t){return this.readAttribute(t)}get geometryType(){const t=r(this._current.geometry);return"esriGeometryPoint"===t?"esriGeometryMultipoint":t}getCursor(){return this.copy()}copy(){const t=new c(this._items,this._tile,this.metadata);return this.copyInto(t),t}copyInto(t){super.copyInto(t),t._cachedGeometry=this._cachedGeometry,t._index=this._index}get fields(){throw new Error("Fields reading not supported to graphics.")}get hasFeatures(){return!!this._items.length}get hasNext(){return this._index+1<this._items.length}get exceededTransferLimit(){throw new Error("InternalError: exceededTransferLimit not implemented for graphics.")}get hasZ(){return!1}get hasM(){return!1}getInTransform(){return this._tile.transform}getSize(){return this._items.length}getAttributeHash(){let t="";for(const e in this._current.attributes)t+=this._current.attributes[e];return t}getObjectId(){return this._items[this._index].objectId}getDisplayId(){return this._current.displayId}setDisplayId(t){throw new Error("InternalError: Setting displayId not supported for graphics.")}setIndex(t){this._index=t}getIndex(){return this._index}next(){for(this._cachedGeometry=null;++this._index<this._items.length&&!this._getExists(););return this._index<this._items.length}readGeometryArea(){throw new Error("InternalError: readGeometryArea not supported for graphics.")}_readGeometry(){if(!this._cachedGeometry){const t=s(this._current.projectedGeometry,this.hasZ,this.hasM);if(this._cachedGeometry=i(new o,t,this.hasZ,this.hasM,this.geometryType,this._tile.transform),!this._cachedGeometry)return null;this._wrapGeometry(this._cachedGeometry)}return this._cachedGeometry}_wrapGeometry(t){if(!this._wrappingInfo)return;const{worldSizeX:e}=this._wrappingInfo;if(t.isPoint)return 1===e?(t.coords.push(n,0),t.coords.push(2*-n,0),void t.lengths.push(3)):2===e?(t.coords.push(2*n,0),t.coords.push(4*-n,0),void t.lengths.push(3)):void this._wrapVertex(t.coords,0,2,e);if("esriGeometryMultipoint"!==this.geometryType);else{if(1===e){const e=t.coords.slice();e[0]-=512;const r=t.coords.slice();r[0]+=512,t.coords.push(...e,...r);const s=t.lengths[0];return void t.lengths.push(s,s)}this._wrapVertex(t.coords,0,2,e)}}_wrapVertex(t,e,r,s){const i=e*r,o=t[i];o<-n*(s-2)?t[i]=o+n*s:o>n*(s-1)&&(t[i]=o-n*s)}_readX(){const t=this._readGeometry();return null!=t?t.coords[0]:0}_readY(){const t=this._readGeometry();return null!=t?t.coords[1]:0}_readServerCentroid(){switch(this.geometryType){case"esriGeometryPolygon":{const t=e(this._current.projectedGeometry),r=new o([],t);return i(new o,r,this.hasZ,this.hasM,this.geometryType,this._tile.transform)}case"esriGeometryPolyline":{const e=this._current.projectedGeometry,r=t(e.paths,this.hasZ),s=new o([],r);return i(new o,s,this.hasZ,this.hasM,this.geometryType,this._tile.transform)}}return null}_readAttribute(t,e){const r=this._current.attributes[t];if(void 0!==r)return r;const s=t.toLowerCase();for(const i in this._current.attributes)if(i.toLowerCase()===s)return this._current.attributes[i]}_readAttributes(){return this._current.attributes}}export{c as GraphicsReader};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
5
|
+
import e from"../../../../../core/ArrayPool.js";import t from"../../../../../geometry/Extent.js";import{create as i}from"../../../../../geometry/support/aaBoundingRect.js";import s from"../../../../../rest/support/QuantizationParameters.js";import o from"../../../tiling/TileKey.js";class n{constructor(e,t){this.key=new o(0,0,0,0),this.bounds=i(),this.objectIds=new Set,this.key.set(t);const s=e.getLODInfoAt(this.key);this.tileInfoView=e,this.tileInfoView.getTileBounds(this.bounds,this.key,!0),this.resolution=s.resolution,this.scale=s.scale,this.level=s.level}get lod(){return this.tileInfoView.getLODInfoAt(this.key)}get id(){return this.key.id}get extent(){return t.fromBounds(this.bounds,this.tileInfoView.tileInfo.spatialReference)}get transform(){return{originPosition:"upperLeft",scale:[this.resolution,this.resolution],translate:[this.bounds[0],this.bounds[3]]}}createArcadeEvaluationOptions(e){return{$view:{scale:this.scale,timeZone:e}}}createChildTiles(){const t=this.key.getChildKeys(),i=e.acquire();for(let e=0;e<t.length;e++)i[e]=new n(this.tileInfoView,t[e]);return i}getQuantizationParameters(){return s.fromJSON({mode:"view",originPosition:"upperLeft",tolerance:this.resolution,extent:{xmin:this.bounds[0],ymin:this.bounds[1],xmax:this.bounds[2],ymax:this.bounds[3],spatialReference:this.tileInfoView.tileInfo.spatialReference}})}}export{n as Tile};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{isSome as r}from"../../../../core/arrayUtils.js";import has from"../../../../core/has.js";import{IdentifiableMixin as s}from"../../../../core/Identifiable.js";import{assertIsSome as i}from"../../../../core/maybe.js";import{ignoreAbortErrors as o,throwIfAborted as a}from"../../../../core/promiseUtils.js";import{watch as n}from"../../../../core/reactiveUtils.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as d}from"../../../../core/accessorSupport/decorators/subclass.js";import{create as c}from"../../../../geometry/support/aaBoundingRect.js";import{isPolyline as l,isPolygon as u,isExtent as p,getJsonType as m}from"../../../../geometry/support/jsonUtils.js";import g from"../../../../layers/support/FieldsIndex.js";import{symbolToCIM as f,CIMSymbolHelper as y}from"../../../../symbols/cim/CIMSymbolHelper.js";import{OverrideHelper as _}from"../../../../symbols/cim/OverrideHelper.js";import{errorPolylineSymbol2D as b,errorPolygonSymbol2D as w,errorPointSymbol2D as S}from"../../../../symbols/support/defaults.js";import{filterFlag0 as I}from"../../engine/webgl/definitions.js";import{FeatureTile as v}from"../../engine/webgl/FeatureTile.js";import{MeshData as T}from"../../engine/webgl/mesh/MeshData.js";import{ResourceProxy as R}from"../../engine/webgl/mesh/factories/ResourceProxy.js";import{createGraphicSymbolMeshSchemas as M}from"../../engine/webgl/shaderGraph/techniques/createGraphicSymbolMeshSchemas.js";import{createMeshWriter as j}from"../../engine/webgl/shaderGraph/techniques/mesh/createMeshWriter.js";import{castStrictInstanceId as x}from"../../engine/webgl/shaderGraph/techniques/mesh/instanceIdUtils.js";import{createStorageSchema as U}from"../features/schema/processor/StorageSchema.js";import{AttributeStore as C}from"../features/support/AttributeStore.js";import{ComputedAttributeStorage as q}from"../features/support/ComputedAttributeStorage.js";import{GraphicsMetadata as G}from"../features/support/FeatureMetadata.js";import{GraphicsReader as k}from"../features/support/GraphicsReader.js";import P from"./GraphicStore.js";import O from"../support/FeatureCommandQueue.js";import{UpdateTracking2D as F}from"../support/UpdateTracking2D.js";class V{static getOrCreate(e,t,r){let s=t.get(e.id);return s||(s=new V(e,r),t.set(e.id,s)),s}static fromItems(e,t,r){const s=new V(e,r);return s.addedOrModified.push(...t),s}constructor(e,t){this.tile=e,this.metadata=t,this.addedOrModified=[],this.removed=[]}get reader(){return this._reader||(this._reader=k.from(this.addedOrModified,this.tile,this.metadata)),this._reader}}let $=class extends(s(t)){constructor(e){super(e),this._attached=!1,this._tiles=new Map,this._controller=new AbortController,this._hashToSymbolInfo=new Map,this._lastCleanup=performance.now(),this._cleanupRequired=!0,this.lastUpdateId=-1,this.renderer=null,this._updateTracking=new F({debugName:"GraphicsView2D"}),this.updateRequested=!1,this.defaultPointSymbolEnabled=!0,this._commandQueue=new O({process:e=>{switch(e.type){case"processed-edit":throw new Error("InternalError: Unsupported command");case"update":return this._update()}}}),this.graphicUpdateHandler=this.graphicUpdateHandler.bind(this)}destroy(){this.container.destroy(),this.view=null,this.renderer=null,this._set("graphics",null),this._controller.abort(),this._graphicStore.clear(),this._attributeStore=null,this._hashToSymbolInfo.clear(),this._updateTracking.destroy(),this._commandQueue.destroy()}_initAttributeStore(){this._storage=new q({spatialReference:this.view.spatialReference,fields:new g}),this._attributeStore=new C({isLocal:!0,update:async e=>{has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView2D.AttributeStoreView.updateStart`,{message:e});const t=this.container.attributeView.requestUpdate(e);this.container.requestRender(),await t,has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView2D.AttributeStoreView.updateEnd`,{message:e})}});const e=U(null,[]);this._attributeStore.update(e,this._storage,null),this.container.checkHighlight=()=>this._attributeStore.hasHighlight}initialize(){this._initAttributeStore(),this._metadata=G.create(this.view.spatialReference),this._resourceProxy=new R({fetch:e=>Promise.all(e.map((e=>this.view.stage.textureManager.rasterizeItem(e)))),fetchDictionary:e=>{throw new Error("InternalError: Graphics do not support Dictionary requests")}}),this.addHandles([n((()=>this._effectiveRenderer),(()=>this.requestUpdate())),this.view.graphicsTileStore.on("update",this._onTileUpdate.bind(this)),this.container.on("attach",(()=>{this.addHandles([this.graphics.on("change",(()=>this._pushUpdate()))]),this._graphicStore=new P(this.view.spatialReference,this._cimResourceManager,this.view.featuresTilingScheme,this.view.state.scale,this._attributeStore),this._attached=!0,this.requestUpdate(),this._pushUpdate()}))]),this._updateTracking.addUpdateTracking("CommandQueue",this._commandQueue.updateTracking);const e=this.view.graphicsTileStore.tiles;this._onTileUpdate({added:e,removed:[]})}get _effectiveRenderer(){return"function"==typeof this.renderer?this.renderer():this.renderer}get _cimResourceManager(){return this.view.stage.textureManager.resourceManager}get updating(){const e=!this._attached||this._updateTracking.updating;return has("esri-2d-log-updating")&&console.log(`Updating GraphicsView2D: ${e}\n -> attaching ${!this._attached}\n -> updateTracking ${this._updateTracking.updating}`),e}hitTest(e){if(!this.view||this.view.suspended)return[];const{resolution:t,rotation:s}=this.view.state,i=this._graphicStore.hitTest(e.x,e.y,2,t,s),o=new Set(i),a=this.graphics.items.reduce(((e,t)=>(o.has(t.uid)&&e.set(t.uid,t),e)),new Map);return i.map((e=>a.get(e))).filter(r)}requestUpdate(){this.updateRequested||(this.updateRequested=!0,this.requestUpdateCallback()),this.notifyChange("updating")}processUpdate(e){this.updateRequested&&(this.updateRequested=!1,this.update(e))}viewChange(){this.requestUpdate()}setHighlight(e){const t=[];for(const{objectId:r,highlightFlags:s}of e){const e=this._graphicStore.getItem(r)?.displayId;t.push({objectId:r,highlightFlags:s,displayId:e})}this._attributeStore.setHighlight(t),this._pushUpdate()}graphicUpdateHandler(e){this._pushUpdate()}update(e){this.updateRequested=!1,this._attached&&this._graphicStore.updateLevel(e.state.resolution)}_pushUpdate(){o(this._commandQueue.push({type:"update"}))}async _update(){try{has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView._update start`);const e=await this._graphicStore.update(this.graphics,(e=>this._getSymbolForGraphic(e)),(e=>this._ensureSymbolResource(e)));if(!e.hasAnyUpdate())return void await this._attributeStore.sendUpdates();e.removed.length&&(this._cleanupRequired=!0),has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView updateMessage`,e);const t=this._createTileMessages(e);await this._fetchResources(t),this._write(t);for(const r of e.added)this._setFilterState(r);for(const r of e.updated)this._setFilterState(r);has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView sendUpdate`,e),await this._attributeStore.sendUpdates(),has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView sendUpdate.await`,e)}catch(e){}this._cleanupSharedResources()}_createTileMessages(e){const t=new Map;for(const r of e.added){const e=this.view.graphicsTileStore.getIntersectingTiles(r.bounds);for(const s of e){V.getOrCreate(s,t,this._metadata).addedOrModified.push(r)}}for(const r of e.updated){const e=this.view.graphicsTileStore.getIntersectingTiles(r.prevBounds),s=this.view.graphicsTileStore.getIntersectingTiles(r.bounds);for(const i of e){V.getOrCreate(i,t,this._metadata).removed.push(r.displayId)}for(const i of s){V.getOrCreate(i,t,this._metadata).addedOrModified.push(r)}}for(const r of e.removed){const e=this.view.graphicsTileStore.getIntersectingTiles(r.bounds);for(const s of e){V.getOrCreate(s,t,this._metadata).removed.push(r.displayId)}}return Array.from(t.values())}async _fetchResources(e){for(const{tile:t,reader:r}of e){has("esri-2d-update-debug")&&console.debug(`Id[${this.layerId}] Tile[${t.id}] GraphicsView fetchResources`,e);const s=r.getCursor();for(;s.next();)for(const e of s.getMeshWriters())e.enqueueRequest(this._resourceProxy,s,t.arcadeEvaluationOptions)}await this._resourceProxy.fetchEnqueuedResources()}_write(e){for(const t of e){has("esri-2d-update-debug")&&console.debug(`Id[${this.layerId}] Tile[${t.tile.id}] GraphicsView write`,t);const e=this._writeMeshes(t);let r=this._tiles.get(t.tile.key);r||(r=this._createFeatureTile(t.tile.key)),has("esri-2d-update-debug")&&console.debug(`Id[${this.layerId}] Tile[${t.tile.id}] GraphicsView onTileData`,t),this.container.onTileData(r,{type:"update",modify:e,remove:t.removed,end:!1,attributeEpoch:this._attributeStore.epoch}),this.container.requestRender()}}_writeMeshes(e){const t=new T(e.tile.id),r=e.reader.getCursor();for(;r.next();){t.entityStart(r.getDisplayId(),r.getZOrder());for(const s of r.getMeshWriters())s.write(t,this._resourceProxy,r,e.tile.arcadeEvaluationOptions,e.tile.level);t.entityEnd()}return{...t.serialize().message,tileId:e.tile.id}}_setFilterState(e){const t=e.displayId,r=this._attributeStore.getHighlightFlags(e.objectId);this._attributeStore.setData(t,0,0,r|(e.visible?I:0))}_getSymbolForGraphic(e){return null!=e.symbol?e.symbol:null!=this._effectiveRenderer?this._effectiveRenderer.getSymbol(e):this._getNullSymbol(e)}async _ensureSymbolResource(e){if(!e.symbol)return;const t=await this._getSymbolInfo(e.symbol);if(!t)return;const r=t.linearCIM.filter((e=>"text"===e.type));if(r.length>0){const s=await this._getTextResources(e,r);e.symbolResource={symbolInfo:t,textInfo:s}}else e.symbolResource={symbolInfo:t}}_getSymbolInfo(e){const t=e.hash();return this._hashToSymbolInfo.has(t)||this._hashToSymbolInfo.set(t,this._createSymbolInfo(t,e).catch((e=>null))),this._hashToSymbolInfo.get(t)}async _createSymbolInfo(e,t){const r=await this._convertToCIMSymbol(t),s=await this._createLinearCIM(r);if("text"===t.type)for(const i of s)"text"===i.type&&(i.lineWidth=t.lineWidth);return{hash:e,cimSymbol:r,linearCIM:s,meshWriters:await this._createMeshWriters(r,s)}}async _convertToCIMSymbol(e){const t=f(e);if("web-style"===t.type){return(await t.fetchCIMSymbol()).data}return t}async _createLinearCIM(e){return await Promise.all(y.fetchResources(e.symbol,this._cimResourceManager,[])),this.view.stage.cimAnalyzer.analyzeSymbolReference(e,!1)}async _createMeshWriters(e,t){a(this._controller.signal);const r=this.container.instanceStore,s=await M(e,t,r);return Promise.all(s.map((e=>j(this._storage,this._resourceProxy,e.meshWriterName,x(e.id),e.options,{tileInfo:this.view.featuresTilingScheme.tileInfo},e.optionalAttributes))))}_onTileUpdate(e){if(e.added&&e.added.length>0)for(const t of e.added)this._updateTracking.addPromise(this._addTile(t));if(e.removed&&e.removed.length>0)for(const t of e.removed)this._removeTile(t.key)}_createFeatureTile(e){const t=this.view.featuresTilingScheme.getTileBounds(c(),e),r=this.view.featuresTilingScheme.getTileResolution(e.level),s=new v(e,r,t[0],t[3]);return this._tiles.set(e,s),this.container.addChild(s),s}async _addTile(e){if(!this._attached)return;const t=this._graphicStore.queryItems(e);if(!t.length)return;const r=this._createFeatureTile(e.key),s=V.fromItems(e,t,this._metadata);await this._fetchResources([s]);const i=this._writeMeshes(s);r.onMessage({type:"append",append:i,clear:!1,end:!0,attributeEpoch:this._attributeStore.epoch})}_removeTile(e){if(!this._tiles.has(e))return;const t=this._tiles.get(e);this.container.removeChild(t),t.destroy(),this._tiles.delete(e)}_getNullSymbol(e){const t=e.geometry;return l(t)?b:u(t)||p(t)?w:this.defaultPointSymbolEnabled?S:null}async _getTextResources(e,t){const r=new Array,s=new Array;for(let i=0;i<t.length;i++){const o=t[i],{resource:a,overrides:n}=o.textRasterizationParam;if(n?.length>0){const t=_.resolveSymbolOverrides({type:"CIMSymbolReference",primitiveOverrides:n,symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,size:a.symbol.height,anchorPointUnits:"Relative",frame:{xmin:-5,ymin:-5,xmax:5,ymax:5},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{x:0,y:0},symbol:a.symbol,textString:a.textString}],scaleSymbolsProportionally:!0,respectFrame:!0}]}},e,this.view.spatialReference,null,m(e.projectedGeometry),null,null);t.then((e=>{const t=e.symbolLayers[0],{textString:r}=t.markerGraphics[0];s.push({type:"cim-rasterization-info",resource:{type:"text",textString:r||"",font:a.font}}),o.text=a.textString=r||""})),r.push(t)}else s.push({type:"cim-rasterization-info",resource:a})}r.length>0&&await Promise.all(r);const o=s.map((e=>this.view.stage.textureManager.rasterizeItem(e))),a=await Promise.all(o);i(a);const n=new Map;for(let i=0;i<t.length;i++){const e=t[i];n.set(e.textRasterizationParam.resource.symbol,{text:e.text,glyphMosaicItems:a[i]})}return n}_cleanupSharedResources(){if(!this._cleanupRequired)return;const e=performance.now();if(e-this._lastCleanup<5e3)return;this._cleanupRequired=!1,this._lastCleanup=e;const t=new Set;for(const s of this._graphicStore.items()){const e=s.symbolResource?.symbolInfo.hash;t.add(e)}const r=new Set(this._hashToSymbolInfo.keys());for(const s of r.values())t.has(s)||this._hashToSymbolInfo.delete(s)}};e([h()],$.prototype,"_effectiveRenderer",null),e([h({constructOnly:!0})],$.prototype,"layerId",void 0),e([h({constructOnly:!0})],$.prototype,"requestUpdateCallback",void 0),e([h()],$.prototype,"container",void 0),e([h({constructOnly:!0})],$.prototype,"graphics",void 0),e([h()],$.prototype,"renderer",void 0),e([h()],$.prototype,"_updateTracking",void 0),e([h()],$.prototype,"updating",null),e([h()],$.prototype,"view",void 0),e([h()],$.prototype,"updateRequested",void 0),e([h()],$.prototype,"defaultPointSymbolEnabled",void 0),$=e([d("esri.views.2d.layers.support.GraphicsView2D")],$);const A=$;export{A as default};
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{isSome as s}from"../../../../core/arrayUtils.js";import has from"../../../../core/has.js";import{IdentifiableMixin as r}from"../../../../core/Identifiable.js";import{assertIsSome as i}from"../../../../core/maybe.js";import{ignoreAbortErrors as o,throwIfAborted as a}from"../../../../core/promiseUtils.js";import{watch as n}from"../../../../core/reactiveUtils.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as d}from"../../../../core/accessorSupport/decorators/subclass.js";import{create as c}from"../../../../geometry/support/aaBoundingRect.js";import{isPolyline as l,isPolygon as p,isExtent as u,getJsonType as m}from"../../../../geometry/support/jsonUtils.js";import g from"../../../../layers/support/FieldsIndex.js";import{symbolToCIM as f,CIMSymbolHelper as y}from"../../../../symbols/cim/CIMSymbolHelper.js";import{OverrideHelper as _}from"../../../../symbols/cim/OverrideHelper.js";import{errorPolylineSymbol2D as b,errorPolygonSymbol2D as w,errorPointSymbol2D as S}from"../../../../symbols/support/defaults.js";import{filterFlag0 as v}from"../../engine/webgl/definitions.js";import{FeatureTile as I}from"../../engine/webgl/FeatureTile.js";import{MeshData as T}from"../../engine/webgl/mesh/MeshData.js";import{ResourceProxy as R}from"../../engine/webgl/mesh/factories/ResourceProxy.js";import{createGraphicSymbolMeshSchemas as M}from"../../engine/webgl/shaderGraph/techniques/createGraphicSymbolMeshSchemas.js";import{createMeshWriter as j}from"../../engine/webgl/shaderGraph/techniques/mesh/createMeshWriter.js";import{castStrictInstanceId as x}from"../../engine/webgl/shaderGraph/techniques/mesh/instanceIdUtils.js";import{createStorageSchema as U}from"../features/schema/processor/StorageSchema.js";import{AttributeStore as C}from"../features/support/AttributeStore.js";import{ComputedAttributeStorage as q}from"../features/support/ComputedAttributeStorage.js";import{GraphicsMetadata as G}from"../features/support/FeatureMetadata.js";import{GraphicsReader as k}from"../features/support/GraphicsReader.js";import P from"./GraphicStore.js";import O from"../support/FeatureCommandQueue.js";import{UpdateTracking2D as A}from"../support/UpdateTracking2D.js";class F{static getOrCreate(e,t,s){let r=t.get(e.id);return r||(r=new F(e,s),t.set(e.id,r)),r}static fromItems(e,t,s){const r=new F(e,s);return r.addedOrModified.push(...t),r}constructor(e,t){this.tile=e,this.metadata=t,this.addedOrModified=[],this.removed=[]}get reader(){return this._reader||(this._reader=k.from(this.addedOrModified,this.tile,this.metadata)),this._reader}}let V=class extends(r(t)){constructor(e){super(e),this._attached=!1,this._tiles=new Map,this._controller=new AbortController,this._hashToSymbolInfo=new Map,this._lastCleanup=performance.now(),this._cleanupRequired=!0,this.lastUpdateId=-1,this.renderer=null,this._updateTracking=new A({debugName:"GraphicsView2D"}),this.updateRequested=!1,this.defaultPointSymbolEnabled=!0,this._commandQueue=new O({process:e=>{switch(e.type){case"processed-edit":throw new Error("InternalError: Unsupported command");case"update":return this._update()}}}),this.graphicUpdateHandler=this.graphicUpdateHandler.bind(this)}destroy(){this.container.destroy(),this.view=null,this.renderer=null,this._set("graphics",null),this._controller.abort(),this._graphicStore.clear(),this._attributeStore=null,this._hashToSymbolInfo.clear(),this._updateTracking.destroy(),this._commandQueue.destroy()}_initAttributeStore(){this._storage=new q({spatialReference:this.view.spatialReference,fields:new g}),this._attributeStore=new C({isLocal:!0,update:async e=>{has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView2D.AttributeStoreView.updateStart`,{message:e});const t=this.container.attributeView.requestUpdate(e);this.container.requestRender(),await t,has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView2D.AttributeStoreView.updateEnd`,{message:e})}});const e=U(null,[]);this._attributeStore.update(e,this._storage,null),this.container.checkHighlight=()=>this._attributeStore.hasHighlight}initialize(){this._initAttributeStore(),this._metadata=G.create(this.view.spatialReference),this._resourceProxy=new R({fetch:e=>Promise.all(e.map((e=>this.view.stage.textureManager.rasterizeItem(e)))),fetchDictionary:e=>{throw new Error("InternalError: Graphics do not support Dictionary requests")}}),this.addHandles([n((()=>this._effectiveRenderer),(()=>this._pushUpdate())),this.view.graphicsTileStore.on("update",this._onTileUpdate.bind(this)),this.container.on("attach",(()=>{this.addHandles([this.graphics.on("change",(()=>this._pushUpdate()))]),this._graphicStore=new P(this.view.spatialReference,this._cimResourceManager,this.view.featuresTilingScheme,this.view.state.scale,this._attributeStore),this._attached=!0,this.requestUpdate(),this._pushUpdate()}))]),this._updateTracking.addUpdateTracking("CommandQueue",this._commandQueue.updateTracking);const e=this.view.graphicsTileStore.tiles;this._onTileUpdate({added:e,removed:[]})}get _effectiveRenderer(){return"function"==typeof this.renderer?this.renderer():this.renderer}get _cimResourceManager(){return this.view.stage.textureManager.resourceManager}get updating(){const e=!this._attached||this._updateTracking.updating;return has("esri-2d-log-updating")&&console.log(`Updating GraphicsView2D: ${e}\n -> attaching ${!this._attached}\n -> updateTracking ${this._updateTracking.updating}`),e}hitTest(e){if(!this.view||this.view.suspended)return[];const{resolution:t,rotation:r}=this.view.state,i=this._graphicStore.hitTest(e.x,e.y,2,t,r),o=new Set(i),a=this.graphics.items.reduce(((e,t)=>(o.has(t.uid)&&e.set(t.uid,t),e)),new Map);return i.map((e=>a.get(e))).filter(s)}requestUpdate(){this.updateRequested||(this.updateRequested=!0,this.requestUpdateCallback()),this.notifyChange("updating")}processUpdate(e){this.updateRequested&&(this.updateRequested=!1,this.update(e))}viewChange(){this.requestUpdate()}setHighlight(e){const t=[];for(const{objectId:s,highlightFlags:r}of e){const e=this._graphicStore.getItem(s)?.displayId;t.push({objectId:s,highlightFlags:r,displayId:e})}this._attributeStore.setHighlight(t,e),this._pushUpdate()}graphicUpdateHandler(e){this._pushUpdate()}update(e){this.updateRequested=!1,this._attached&&this._graphicStore.updateLevel(e.state.resolution)}_pushUpdate(){o(this._commandQueue.push({type:"update"}))}async _update(){try{has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView._update start`);const e=await this._graphicStore.update(this.graphics,(e=>this._getSymbolForGraphic(e)),(e=>this._ensureSymbolResource(e)));if(!e.hasAnyUpdate())return void await this._attributeStore.sendUpdates();e.removed.length&&(this._cleanupRequired=!0),has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView updateMessage`,e);const t=this._createTileMessages(e);await this._fetchResources(t),this._write(t);for(const s of e.added)this._setFilterState(s);for(const s of e.updated)this._setFilterState(s);has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView sendUpdate`,e),await this._attributeStore.sendUpdates(),has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView sendUpdate.await`,e)}catch(e){}this._cleanupSharedResources()}_createTileMessages(e){const t=new Map;for(const s of e.added){const e=this.view.graphicsTileStore.getIntersectingTiles(s.bounds);for(const r of e){F.getOrCreate(r,t,this._metadata).addedOrModified.push(s)}}for(const s of e.updated){const e=this.view.graphicsTileStore.getIntersectingTiles(s.prevBounds),r=this.view.graphicsTileStore.getIntersectingTiles(s.bounds);for(const i of e){F.getOrCreate(i,t,this._metadata).removed.push(s.displayId)}for(const i of r){F.getOrCreate(i,t,this._metadata).addedOrModified.push(s)}}for(const s of e.removed){const e=this.view.graphicsTileStore.getIntersectingTiles(s.bounds);for(const r of e){F.getOrCreate(r,t,this._metadata).removed.push(s.displayId)}}return Array.from(t.values())}async _fetchResources(e){for(const{tile:t,reader:s}of e){has("esri-2d-update-debug")&&console.debug(`Id[${this.layerId}] Tile[${t.id}] GraphicsView fetchResources`,e);const r=s.getCursor();for(;r.next();)for(const e of r.getMeshWriters())e.enqueueRequest(this._resourceProxy,r,t.createArcadeEvaluationOptions(this.view.timeZone))}await this._resourceProxy.fetchEnqueuedResources()}_write(e){for(const t of e){has("esri-2d-update-debug")&&console.debug(`Id[${this.layerId}] Tile[${t.tile.id}] GraphicsView write`,t);const e=this._writeMeshes(t);let s=this._tiles.get(t.tile.key);s||(s=this._createFeatureTile(t.tile.key)),has("esri-2d-update-debug")&&console.debug(`Id[${this.layerId}] Tile[${t.tile.id}] GraphicsView onTileData`,t),this.container.onTileData(s,{type:"update",modify:e,remove:t.removed,end:!1,attributeEpoch:this._attributeStore.epoch}),this.container.requestRender()}}_writeMeshes(e){const t=new T(e.tile.id),s=e.reader.getCursor();for(;s.next();){t.entityStart(s.getDisplayId(),s.getZOrder());for(const r of s.getMeshWriters())r.write(t,this._resourceProxy,s,e.tile.createArcadeEvaluationOptions(this.view.timeZone),e.tile.level);t.entityEnd()}return{...t.serialize().message,tileId:e.tile.id}}_setFilterState(e){const t=e.displayId,s=this._attributeStore.getHighlightFlags(e.objectId);this._attributeStore.setData(t,0,0,s|(e.visible?v:0))}_getSymbolForGraphic(e){return null!=e.symbol?e.symbol:null!=this._effectiveRenderer?this._effectiveRenderer.getSymbol(e):this._getNullSymbol(e)}async _ensureSymbolResource(e){if(!e.symbol)return;const t=await this._getSymbolInfo(e.symbol);if(!t)return;const s=t.linearCIM.filter((e=>"text"===e.type));if(s.length>0){const r=await this._getTextResources(e,s);e.symbolResource={symbolInfo:t,textInfo:r}}else e.symbolResource={symbolInfo:t}}_getSymbolInfo(e){const t=e.hash();return this._hashToSymbolInfo.has(t)||this._hashToSymbolInfo.set(t,this._createSymbolInfo(t,e).catch((e=>null))),this._hashToSymbolInfo.get(t)}async _createSymbolInfo(e,t){const s=await this._convertToCIMSymbol(t),r=await this._createLinearCIM(s);if("text"===t.type)for(const i of r)"text"===i.type&&(i.lineWidth=t.lineWidth);return{hash:e,cimSymbol:s,linearCIM:r,meshWriters:await this._createMeshWriters(s,r)}}async _convertToCIMSymbol(e){const t=f(e);if("web-style"===t.type){return(await t.fetchCIMSymbol()).data}return t}async _createLinearCIM(e){return await Promise.all(y.fetchResources(e.symbol,this._cimResourceManager,[])),this.view.stage.cimAnalyzer.analyzeSymbolReference(e,!1)}async _createMeshWriters(e,t){a(this._controller.signal);const s=this.container.instanceStore,r=await M(e,t,s);return Promise.all(r.map((e=>j(this._storage,this._resourceProxy,e.meshWriterName,x(e.id),e.options,{tileInfo:this.view.featuresTilingScheme.tileInfo},e.optionalAttributes))))}_onTileUpdate(e){if(e.added&&e.added.length>0)for(const t of e.added)this._updateTracking.addPromise(this._addTile(t));if(e.removed&&e.removed.length>0)for(const t of e.removed)this._removeTile(t.key)}_createFeatureTile(e){const t=this.view.featuresTilingScheme.getTileBounds(c(),e),s=this.view.featuresTilingScheme.getTileResolution(e.level),r=new I(e,s,t[0],t[3]);return this._tiles.set(e,r),this.container.addChild(r),r}async _addTile(e){if(!this._attached)return;const t=this._graphicStore.queryItems(e);if(!t.length)return;const s=this._createFeatureTile(e.key),r=F.fromItems(e,t,this._metadata);await this._fetchResources([r]);const i=this._writeMeshes(r);s.onMessage({type:"append",append:i,clear:!1,end:!0,attributeEpoch:this._attributeStore.epoch})}_removeTile(e){if(!this._tiles.has(e))return;const t=this._tiles.get(e);this.container.removeChild(t),t.destroy(),this._tiles.delete(e)}_getNullSymbol(e){const t=e.geometry;return l(t)?b:p(t)||u(t)?w:this.defaultPointSymbolEnabled?S:null}async _getTextResources(e,t){const s=new Array,r=new Array;for(let i=0;i<t.length;i++){const o=t[i],{resource:a,overrides:n}=o.textRasterizationParam;if(n?.length>0){const t=_.resolveSymbolOverrides({type:"CIMSymbolReference",primitiveOverrides:n,symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,size:a.symbol.height,anchorPointUnits:"Relative",frame:{xmin:-5,ymin:-5,xmax:5,ymax:5},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{x:0,y:0},symbol:a.symbol,textString:a.textString}],scaleSymbolsProportionally:!0,respectFrame:!0}]}},e,this.view.spatialReference,null,m(e.projectedGeometry),null,null);t.then((e=>{const t=e.symbolLayers[0],{textString:s}=t.markerGraphics[0];r.push({type:"cim-rasterization-info",resource:{type:"text",textString:s||"",font:a.font}}),o.text=a.textString=s||""})),s.push(t)}else r.push({type:"cim-rasterization-info",resource:a})}s.length>0&&await Promise.all(s);const o=r.map((e=>this.view.stage.textureManager.rasterizeItem(e))),a=await Promise.all(o);i(a);const n=new Map;for(let i=0;i<t.length;i++){const e=t[i];n.set(e.textRasterizationParam.resource.symbol,{text:e.text,glyphMosaicItems:a[i]})}return n}_cleanupSharedResources(){if(!this._cleanupRequired)return;const e=performance.now();if(e-this._lastCleanup<5e3)return;this._cleanupRequired=!1,this._lastCleanup=e;const t=new Set;for(const r of this._graphicStore.items()){const e=r.symbolResource?.symbolInfo.hash;t.add(e)}const s=new Set(this._hashToSymbolInfo.keys());for(const r of s.values())t.has(r)||this._hashToSymbolInfo.delete(r)}};e([h()],V.prototype,"_effectiveRenderer",null),e([h({constructOnly:!0})],V.prototype,"layerId",void 0),e([h({constructOnly:!0})],V.prototype,"requestUpdateCallback",void 0),e([h()],V.prototype,"container",void 0),e([h({constructOnly:!0})],V.prototype,"graphics",void 0),e([h()],V.prototype,"renderer",void 0),e([h()],V.prototype,"_updateTracking",void 0),e([h()],V.prototype,"updating",null),e([h()],V.prototype,"view",void 0),e([h()],V.prototype,"updateRequested",void 0),e([h()],V.prototype,"defaultPointSymbolEnabled",void 0),V=e([d("esri.views.2d.layers.support.GraphicsView2D")],V);const $=V;export{$ as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../../../core/ObjectPool.js";class
|
|
5
|
+
import t from"../../../core/ObjectPool.js";class e{static getId(t,e,l,o){return"object"==typeof t?`${t.level}/${t.row}/${t.col}/${t.world}`:`${t}/${e}/${l}/${o}`}constructor(t,e,l,o){this.set(t,e,l,o)}get key(){return this}get id(){return this.toString()}get normalizedId(){return`${this.level}/${this.row}/${this.col}`}set id(t){this.set(t)}get hash(){const t=4095&this.row,e=4095&this.col,l=63&this.level;return(3&this.world)<<30|e<<22|t<<8|l}acquire(t,e,l,o){this.set(t,e,l,o)}contains(t){const e=t.level-this.level;return e>=0&&this.row===t.row>>e&&this.col===t.col>>e&&this.world===t.world}containsChild(t){const e=t.level-this.level;return e>0&&this.row===t.row>>e&&this.col===t.col>>e&&this.world===t.world}equals(t){return this.level===t.level&&this.row===t.row&&this.col===t.col&&this.world===t.world}clone(){return new e(this)}release(){this.level=0,this.row=0,this.col=0,this.world=0}set(t,e,l,o){if(null==t)this.level=0,this.row=0,this.col=0,this.world=0;else if("object"==typeof t)this.level=t.level||0,this.row=t.row||0,this.col=t.col||0,this.world=t.world||0;else if("string"==typeof t){const[e,l,o,s]=t.split("/");this.level=parseFloat(e),this.row=parseFloat(l),this.col=parseFloat(o),this.world=parseFloat(s)}else this.level=+t,this.row=+e,this.col=+l,this.world=+o||0;return this}toString(){return`${this.level}/${this.row}/${this.col}/${this.world}`}getParentKey(){return this.level<=0?null:new e(this.level-1,this.row>>1,this.col>>1,this.world)}getNeighborId(t,e){return`${this.level}/${this.row+e}/${this.col+t}/${this.world}`}getChildKeys(){const t=this.level+1,l=this.row<<1,o=this.col<<1,s=this.world;return[new e(t,l,o,s),new e(t,l,o+1,s),new e(t,l+1,o,s),new e(t,l+1,o+1,s)]}compareRowMajor(t){return this.row<t.row?-1:this.row>t.row?1:this.col<t.col?-1:this.col>t.col?1:0}}e.pool=new t(e,null,null,25,50);export{e as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{deg2rad as e}from"../../../../../core/mathUtils.js";import{createLength as t,createArea as s}from"../../../../../core/quantityUtils.js";import{set as i,distance as o}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{p as n,c as h,b as a,E as d,f as l,j as g,h as p,g as c,n as m}from"../../../../../chunks/vec32.js";import{create as u}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as _}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as f}from"../../../../../geometry/ellipsoidUtils.js";import{canProjectWithoutEngine as C,canProjectToWGS84ComparableLonLat as S}from"../../../../../geometry/projection.js";import L from"../../../../../geometry/SpatialReference.js";import{getSphericalPCPF as P}from"../../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectDirection as j}from"../../../../../geometry/projection/projectDirection.js";import{projectPointToVector as R}from"../../../../../geometry/projection/projectPointToVector.js";import{projectPointToWGS84ComparableLonLat as M}from"../../../../../geometry/projection/projectPointToWGS84ComparableLonLat.js";import{projectVectorToVector as A}from"../../../../../geometry/projection/projectVectorToVector.js";import{Axis as v}from"../../../../../geometry/support/Axis.js";import{compactIndices as V}from"../../../../../geometry/support/Indices.js";import{segmentIntersects as W}from"../../../../../geometry/support/intersectsBase.js";import{d as I}from"../../../../../chunks/sphere.js";import{areaPoints2d as z}from"../../../../../geometry/support/triangle.js";import{MeasurementMode as w}from"../../interfaces.js";import{segmentLengthGeodesicVector as U,bestFitPlane as G,fitHemisphere as y,triangleAreaGeodesic as T,planePointDistance as x,boundingSphere as b,segmentLengthGeodesic as E,segmentLengthEuclidean as F}from"../../support/measurementUtils.js";import{getElevationAtPoint as N}from"../../../support/ElevationProvider.js";import{midpoint3d as q,makeOrthonormal as D,tangentFrame as k}from"../../../support/mathUtils.js";import{triangulate as B}from"../../../../support/euclideanAreaMeasurementUtils.js";class H{get numVertices(){return this._length}get hasStagedVertex(){return this._hasCursorPoint}constructor(e,t){this.validMeasurement=!1,this.positionsWorldCoords=[],this.positionsRenderCoords=[],this.positionsProjectedWorldCoords=[],this.positionsFittedRenderCoords=[],this.positionsGeographic=[],this.positionsSpherical=[],this.positionsStereographic=[],this.pathSegmentLengths=[],this.geodesicPathSegmentLengths=[],this.perimeterSegmentLengths=[],this.intersectingSegments=new Set,this.geodesicIntersectingSegments=new Set,this.triangleIndices=null,this.geodesicTriangleIndices=null,this.areaCentroidWorldCoords=u(),this.areaCentroidRenderCoords=u(),this.geodesicAreaCentroidRenderCoords=u(),this.area=null,this.geodesicArea=null,this.pathLength=null,this.geodesicPathLength=null,this.perimeterLength=null,this._length=0,this._centroidRenderCoords=u(),this._planeWorldCoords=_(),this._worldUp=u(),this._worldTangent=u(),this._frame=[u(),u(),u()],this._pathVersion=-1,this._hasCursorPoint=!1,this._mode=null,this._tempU=u(),this._tempV=u(),this._tempVec3=u(),this._tempSphere=I(),this._sceneView=e,this.unitNormalizer=t}update(e,t,s,i,o,r){const n=null!=t,h=this._pathVersion===e.version,a=this._hasCursorPoint===n,d=this._mode===o;return!(h&&!r&&a&&d&&e.isValidPolygon)&&(this._pathVersion=e.version,this._hasCursorPoint=n,this._updateCursorSegmentLength(e,t),this._update(e,t,s,i,o),!0)}_update(e,s,i,o,r){const n=this.unitNormalizer,h=this._sceneView.renderSpatialReference,a=this.unitNormalizer.spatialReference;let d=e.numVertices;const l=!(null==s||s.equals(e.lastPoint)||d>2&&s.equals(e.firstPoint));l&&(d+=1);const g=!e.polygonIsClosed&&d>2,p=e.polygonIsClosed||g;this._resize(d);const c=P(i.spatialReference),u=C(i.spatialReference,c)&&S(i.spatialReference),{positionsGeographic:_,positionsWorldCoords:f,positionsRenderCoords:L,positionsSpherical:j}=this,A=(e,t)=>{X(i.elevationProvider,e),R(e,f[t],a),R(e,L[t],h),u&&(M(e,_[t]),R(e,j[t],c),m(j[t],j[t]))};e.forEachVertexPosition(((e,t)=>A(e,t))),l&&A(s,d-1);const v=this._updatePathLengths(p);if(this.pathLength=this._length>1?t(n.normalizeDistance(v),"meters"):null,u){const e=this._updateGeodesicPathLengths(p,a);this.geodesicPathLength=this._length>1?t(e,"meters"):null}else this.geodesicPathLength=null;if(this._updateMode(r),!p)return this.area=null,this.geodesicArea=null,this.perimeterLength=null,this.triangleIndices=null,this.geodesicTriangleIndices=null,this.intersectingSegments.clear(),this.geodesicIntersectingSegments.clear(),void(this.validMeasurement=!1);this._updateAreaAndPerimeterLength(i,n,h,a,o),u&&this._updateGeodesicArea(i),this.validMeasurement=!0}getData(){return{validMeasurement:this.validMeasurement,numVertices:this.numVertices,hasStagedVertex:this.hasStagedVertex,positionsWorldCoords:this.positionsWorldCoords,positionsRenderCoords:this.positionsRenderCoords,positionsProjectedWorldCoords:this.positionsProjectedWorldCoords,positionsFittedRenderCoords:this.positionsFittedRenderCoords,positionsGeographic:this.positionsGeographic,positionsSpherical:this.positionsSpherical,positionsStereographic:this.positionsStereographic,pathSegmentLengths:this.pathSegmentLengths,geodesicPathSegmentLengths:this.geodesicPathSegmentLengths,perimeterSegmentLengths:this.perimeterSegmentLengths,intersectingSegments:this.intersectingSegments,geodesicIntersectingSegments:this.geodesicIntersectingSegments,triangleIndices:this.triangleIndices,geodesicTriangleIndices:this.geodesicTriangleIndices,areaCentroidWorldCoords:this.areaCentroidWorldCoords,areaCentroidRenderCoords:this.areaCentroidRenderCoords,geodesicAreaCentroidRenderCoords:this.geodesicAreaCentroidRenderCoords,fittingMode:this.fittingMode,area:this.area,geodesicArea:this.geodesicArea,pathLength:this.pathLength,geodesicPathLength:this.geodesicPathLength,perimeterLength:this.perimeterLength,unitNormalizer:this.unitNormalizer,actualMeasurementMode:this.actualMeasurementMode}}_resize(e){for(e<this._length&&(this.positionsWorldCoords.length=e,this.positionsRenderCoords.length=e,this.positionsProjectedWorldCoords.length=e,this.positionsFittedRenderCoords.length=e,this.positionsGeographic.length=e,this.positionsSpherical.length=e,this.positionsStereographic.length=e,this.pathSegmentLengths.length=e,this.geodesicPathSegmentLengths.length=e,this.perimeterSegmentLengths.length=e,this._length=e);this._length<e;)this.positionsWorldCoords.push(u()),this.positionsRenderCoords.push(u()),this.positionsProjectedWorldCoords.push(r()),this.positionsFittedRenderCoords.push(u()),this.positionsGeographic.push(u()),this.positionsSpherical.push(u()),this.positionsStereographic.push(r()),this.pathSegmentLengths.push(0),this.geodesicPathSegmentLengths.push(0),this.perimeterSegmentLengths.push(0),++this._length}_updatePathLengths(e){const t=this.positionsWorldCoords,s=this.pathSegmentLengths;let i=0;for(let o=0;o<this._length;++o){const r=s[o]=n(t[o],t[(o+1)%this._length]);(o<this._length-1||e)&&(i+=r)}return i}_updateGeodesicPathLengths(e,t){const s=this.positionsGeographic,i=this.geodesicPathSegmentLengths;let o=0;for(let r=0;r<this._length;++r){const n=i[r]=U(s[r],s[(r+1)%this._length],t??void 0);(r<this._length-1||e)&&(o+=n)}return o}_updateAreaAndPerimeterLength(e,o,r,n,m){const u=e.renderCoordsHelper,_=this.positionsWorldCoords,f=this.positionsRenderCoords,C=this.positionsProjectedWorldCoords,S=this.positionsFittedRenderCoords,L=this._planeWorldCoords,P=this._centroidRenderCoords;q(f,P),u.worldUpAtPosition(P,this._worldUp),u.worldBasisAtPosition(P,v.X,this._worldTangent),j(P,this._worldUp,r,this._worldUp,n),j(P,this._worldTangent,r,this._worldTangent,n),_.length>2&&G(_,L),this.fittingMode=this._selectFittingMode(L,_,this._worldUp,m);let R=0;if("horizontal"===this.fittingMode){let e=-1/0;f.forEach(((t,s)=>{const i=u.getAltitude(f[s]);i>e&&(e=i,R=s)}))}const M=_[R];let V=L,W=this._worldTangent;"horizontal"===this.fittingMode?V=this._worldUp:"vertical"===this.fittingMode&&(V=this._tempVec3,W=this._worldUp,D(L,this._worldUp,V)),h(this._frame[2],V),D(W,V,this._frame[0]),a(this._frame[1],this._frame[0],this._frame[2]),d(this._frame[1],this._frame[1]);const I=this._tempVec3,z=this._tempU,w=this._tempV;for(let t=0;t<this._length;++t){const e=C[t],s=S[t];l(I,_[t],M),i(e,g(this._frame[0],I),g(this._frame[1],I)),p(z,this._frame[0],e[0]),p(w,this._frame[1],e[1]),c(I,z,w),c(I,I,M),A(I,n,s,r)}this.perimeterLength=this._length>0?t(o.normalizeDistance(this._updatePerimeterLengths()),"meters"):null,q(S,this.areaCentroidRenderCoords),A(this.areaCentroidRenderCoords,r,this.areaCentroidWorldCoords,n),this._updateIntersectingSegments(),this.area=0===this.intersectingSegments.size?s(o.normalizeArea(this._computeArea()),"square-meters"):null}_updateGeodesicArea(e){const{renderCoordsHelper:t,spatialReference:o}=e,{positionsSpherical:r,positionsStereographic:n}=this,h=this._tempVec3,a=y(r,h);if(!a)return void(this.geodesicArea=null);const d=this._tempU,l=this._tempV;k(h,d,l);for(let s=0;s<this._length;++s){const e=g(r[s],d),t=g(r[s],l),o=g(r[s],h);i(n[s],e/o,t/o)}p(h,h,f(o).radius),t.toRenderCoords(h,P(o),this.geodesicAreaCentroidRenderCoords),this._updateGeodesicIntersectingSegments(),this.geodesicArea=a&&0===this.geodesicIntersectingSegments.size?s(this._computeGeodesicArea(),"square-meters"):null}_updatePerimeterLengths(){const e=this.positionsProjectedWorldCoords,t=this.perimeterSegmentLengths;let s=0;for(let i=0;i<this._length;++i){s+=t[i]=o(e[i],e[(i+1)%this._length])}return s}_updateIntersectingSegments(){const e=this.positionsProjectedWorldCoords,t=this.intersectingSegments;t.clear();for(let s=0;s<this._length;++s)for(let i=s+2;i<this._length;++i){if((i+1)%this._length===s)continue;const o=e[s],r=e[(s+1)%this._length],n=e[i],h=e[(i+1)%this._length];W(o,r,n,h)&&(t.add(s),t.add(i))}}_computeArea(){const e=this.positionsProjectedWorldCoords,t=this.triangleIndices=V(B(e));let s=0;for(let i=0;i<t.length;i+=3)s+=z(e[t[i]],e[t[i+1]],e[t[i+2]]);return s}_updateGeodesicIntersectingSegments(){const e=this.positionsStereographic,t=this.geodesicIntersectingSegments;t.clear();for(let s=0;s<this._length;++s)for(let i=s+2;i<this._length;++i){if((i+1)%this._length===s)continue;const o=e[s],r=e[(s+1)%this._length],n=e[i],h=e[(i+1)%this._length];W(o,r,n,h)&&(t.add(s),t.add(i))}}_computeGeodesicArea(){const e=this.positionsGeographic,t=this.positionsStereographic,s=this.geodesicTriangleIndices=V(B(t));let i=0;for(let o=0;o<s.length;o+=3)i+=T(e[s[o]],e[s[o+1]],e[s[o+2]],L.WGS84);return i}_selectFittingMode(t,s,i,o){const r=s.map((e=>Math.abs(x(t,e)))).reduce(((e,t)=>Math.max(e,t)),0);b(s,this._tempSphere);const n=r/(2*this._tempSphere[3]),h=n<o.maxRelativeErrorCoplanar,a=n<o.maxRelativeErrorAlmostCoplanar;let d="horizontal";if(h)d="oblique";else if(a){d=Math.abs(g(i,t))>Math.cos(e(o.verticalAngleThreshold))?"horizontal":"vertical"}return d}_updateCursorSegmentLength(e,s){const i=e.lastPoint;e.isValidPolygon||null==i||null==s?(this.geodesicStagedSegmentLength=null,this.stagedSegmentLength=null):(this.geodesicStagedSegmentLength=t(E(i,s),"meters"),this.stagedSegmentLength=t(this.unitNormalizer.normalizeDistance(F(i,s,this.unitNormalizer.spatialReference)),"meters"))}_updateMode(e){if(e===w.Auto){this.actualMeasurementMode="euclidean";let e=0;null!=this.geodesicPathLength&&(e+=this.geodesicPathLength.value),e>Z&&(this.actualMeasurementMode="geodesic")}else this.actualMeasurementMode=e===w.Euclidean?"euclidean":"geodesic";null==this.geodesicPathLength&&(this.actualMeasurementMode="euclidean"),this._mode=e}}function X(e,t){t.hasZ||(t.z=N(e,t,"ground")??0)}const Z=1e5;export{H as MeasurementDataManager};
|
|
5
|
+
import{deg2rad as e}from"../../../../../core/mathUtils.js";import{createLength as t,createArea as s}from"../../../../../core/quantityUtils.js";import{set as i,distance as o}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{q as n,c as h,b as a,F as d,f as l,k as g,h as p,g as c,n as m}from"../../../../../chunks/vec32.js";import{create as u}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as _}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as f}from"../../../../../geometry/ellipsoidUtils.js";import{canProjectWithoutEngine as C,canProjectToWGS84ComparableLonLat as S}from"../../../../../geometry/projection.js";import L from"../../../../../geometry/SpatialReference.js";import{getSphericalPCPF as P}from"../../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectDirection as j}from"../../../../../geometry/projection/projectDirection.js";import{projectPointToVector as R}from"../../../../../geometry/projection/projectPointToVector.js";import{projectPointToWGS84ComparableLonLat as M}from"../../../../../geometry/projection/projectPointToWGS84ComparableLonLat.js";import{projectVectorToVector as A}from"../../../../../geometry/projection/projectVectorToVector.js";import{Axis as v}from"../../../../../geometry/support/Axis.js";import{compactIndices as V}from"../../../../../geometry/support/Indices.js";import{segmentIntersects as W}from"../../../../../geometry/support/intersectsBase.js";import{d as I}from"../../../../../chunks/sphere.js";import{areaPoints2d as z}from"../../../../../geometry/support/triangle.js";import{MeasurementMode as w}from"../../interfaces.js";import{segmentLengthGeodesicVector as U,bestFitPlane as G,fitHemisphere as y,triangleAreaGeodesic as T,planePointDistance as x,boundingSphere as b,segmentLengthGeodesic as F,segmentLengthEuclidean as q}from"../../support/measurementUtils.js";import{getElevationAtPoint as E}from"../../../support/ElevationProvider.js";import{midpoint3d as N,makeOrthonormal as D,tangentFrame as k}from"../../../support/mathUtils.js";import{triangulate as B}from"../../../../support/euclideanAreaMeasurementUtils.js";class H{get numVertices(){return this._length}get hasStagedVertex(){return this._hasCursorPoint}constructor(e,t){this.validMeasurement=!1,this.positionsWorldCoords=[],this.positionsRenderCoords=[],this.positionsProjectedWorldCoords=[],this.positionsFittedRenderCoords=[],this.positionsGeographic=[],this.positionsSpherical=[],this.positionsStereographic=[],this.pathSegmentLengths=[],this.geodesicPathSegmentLengths=[],this.perimeterSegmentLengths=[],this.intersectingSegments=new Set,this.geodesicIntersectingSegments=new Set,this.triangleIndices=null,this.geodesicTriangleIndices=null,this.areaCentroidWorldCoords=u(),this.areaCentroidRenderCoords=u(),this.geodesicAreaCentroidRenderCoords=u(),this.area=null,this.geodesicArea=null,this.pathLength=null,this.geodesicPathLength=null,this.perimeterLength=null,this._length=0,this._centroidRenderCoords=u(),this._planeWorldCoords=_(),this._worldUp=u(),this._worldTangent=u(),this._frame=[u(),u(),u()],this._pathVersion=-1,this._hasCursorPoint=!1,this._mode=null,this._tempU=u(),this._tempV=u(),this._tempVec3=u(),this._tempSphere=I(),this._sceneView=e,this.unitNormalizer=t}update(e,t,s,i,o,r){const n=null!=t,h=this._pathVersion===e.version,a=this._hasCursorPoint===n,d=this._mode===o;return!(h&&!r&&a&&d&&e.isValidPolygon)&&(this._pathVersion=e.version,this._hasCursorPoint=n,this._updateCursorSegmentLength(e,t),this._update(e,t,s,i,o),!0)}_update(e,s,i,o,r){const n=this.unitNormalizer,h=this._sceneView.renderSpatialReference,a=this.unitNormalizer.spatialReference;let d=e.numVertices;const l=!(null==s||s.equals(e.lastPoint)||d>2&&s.equals(e.firstPoint));l&&(d+=1);const g=!e.polygonIsClosed&&d>2,p=e.polygonIsClosed||g;this._resize(d);const c=P(i.spatialReference),u=C(i.spatialReference,c)&&S(i.spatialReference),{positionsGeographic:_,positionsWorldCoords:f,positionsRenderCoords:L,positionsSpherical:j}=this,A=(e,t)=>{X(i.elevationProvider,e),R(e,f[t],a),R(e,L[t],h),u&&(M(e,_[t]),R(e,j[t],c),m(j[t],j[t]))};e.forEachVertexPosition(((e,t)=>A(e,t))),l&&A(s,d-1);const v=this._updatePathLengths(p);if(this.pathLength=this._length>1?t(n.normalizeDistance(v),"meters"):null,u){const e=this._updateGeodesicPathLengths(p,a);this.geodesicPathLength=this._length>1?t(e,"meters"):null}else this.geodesicPathLength=null;if(this._updateMode(r),!p)return this.area=null,this.geodesicArea=null,this.perimeterLength=null,this.triangleIndices=null,this.geodesicTriangleIndices=null,this.intersectingSegments.clear(),this.geodesicIntersectingSegments.clear(),void(this.validMeasurement=!1);this._updateAreaAndPerimeterLength(i,n,h,a,o),u&&this._updateGeodesicArea(i),this.validMeasurement=!0}getData(){return{validMeasurement:this.validMeasurement,numVertices:this.numVertices,hasStagedVertex:this.hasStagedVertex,positionsWorldCoords:this.positionsWorldCoords,positionsRenderCoords:this.positionsRenderCoords,positionsProjectedWorldCoords:this.positionsProjectedWorldCoords,positionsFittedRenderCoords:this.positionsFittedRenderCoords,positionsGeographic:this.positionsGeographic,positionsSpherical:this.positionsSpherical,positionsStereographic:this.positionsStereographic,pathSegmentLengths:this.pathSegmentLengths,geodesicPathSegmentLengths:this.geodesicPathSegmentLengths,perimeterSegmentLengths:this.perimeterSegmentLengths,intersectingSegments:this.intersectingSegments,geodesicIntersectingSegments:this.geodesicIntersectingSegments,triangleIndices:this.triangleIndices,geodesicTriangleIndices:this.geodesicTriangleIndices,areaCentroidWorldCoords:this.areaCentroidWorldCoords,areaCentroidRenderCoords:this.areaCentroidRenderCoords,geodesicAreaCentroidRenderCoords:this.geodesicAreaCentroidRenderCoords,fittingMode:this.fittingMode,area:this.area,geodesicArea:this.geodesicArea,pathLength:this.pathLength,geodesicPathLength:this.geodesicPathLength,perimeterLength:this.perimeterLength,unitNormalizer:this.unitNormalizer,actualMeasurementMode:this.actualMeasurementMode}}_resize(e){for(e<this._length&&(this.positionsWorldCoords.length=e,this.positionsRenderCoords.length=e,this.positionsProjectedWorldCoords.length=e,this.positionsFittedRenderCoords.length=e,this.positionsGeographic.length=e,this.positionsSpherical.length=e,this.positionsStereographic.length=e,this.pathSegmentLengths.length=e,this.geodesicPathSegmentLengths.length=e,this.perimeterSegmentLengths.length=e,this._length=e);this._length<e;)this.positionsWorldCoords.push(u()),this.positionsRenderCoords.push(u()),this.positionsProjectedWorldCoords.push(r()),this.positionsFittedRenderCoords.push(u()),this.positionsGeographic.push(u()),this.positionsSpherical.push(u()),this.positionsStereographic.push(r()),this.pathSegmentLengths.push(0),this.geodesicPathSegmentLengths.push(0),this.perimeterSegmentLengths.push(0),++this._length}_updatePathLengths(e){const t=this.positionsWorldCoords,s=this.pathSegmentLengths;let i=0;for(let o=0;o<this._length;++o){const r=s[o]=n(t[o],t[(o+1)%this._length]);(o<this._length-1||e)&&(i+=r)}return i}_updateGeodesicPathLengths(e,t){const s=this.positionsGeographic,i=this.geodesicPathSegmentLengths;let o=0;for(let r=0;r<this._length;++r){const n=i[r]=U(s[r],s[(r+1)%this._length],t??void 0);(r<this._length-1||e)&&(o+=n)}return o}_updateAreaAndPerimeterLength(e,o,r,n,m){const u=e.renderCoordsHelper,_=this.positionsWorldCoords,f=this.positionsRenderCoords,C=this.positionsProjectedWorldCoords,S=this.positionsFittedRenderCoords,L=this._planeWorldCoords,P=this._centroidRenderCoords;N(f,P),u.worldUpAtPosition(P,this._worldUp),u.worldBasisAtPosition(P,v.X,this._worldTangent),j(P,this._worldUp,r,this._worldUp,n),j(P,this._worldTangent,r,this._worldTangent,n),_.length>2&&G(_,L),this.fittingMode=this._selectFittingMode(L,_,this._worldUp,m);let R=0;if("horizontal"===this.fittingMode){let e=-1/0;f.forEach(((t,s)=>{const i=u.getAltitude(f[s]);i>e&&(e=i,R=s)}))}const M=_[R];let V=L,W=this._worldTangent;"horizontal"===this.fittingMode?V=this._worldUp:"vertical"===this.fittingMode&&(V=this._tempVec3,W=this._worldUp,D(L,this._worldUp,V)),h(this._frame[2],V),D(W,V,this._frame[0]),a(this._frame[1],this._frame[0],this._frame[2]),d(this._frame[1],this._frame[1]);const I=this._tempVec3,z=this._tempU,w=this._tempV;for(let t=0;t<this._length;++t){const e=C[t],s=S[t];l(I,_[t],M),i(e,g(this._frame[0],I),g(this._frame[1],I)),p(z,this._frame[0],e[0]),p(w,this._frame[1],e[1]),c(I,z,w),c(I,I,M),A(I,n,s,r)}this.perimeterLength=this._length>0?t(o.normalizeDistance(this._updatePerimeterLengths()),"meters"):null,N(S,this.areaCentroidRenderCoords),A(this.areaCentroidRenderCoords,r,this.areaCentroidWorldCoords,n),this._updateIntersectingSegments(),this.area=0===this.intersectingSegments.size?s(o.normalizeArea(this._computeArea()),"square-meters"):null}_updateGeodesicArea(e){const{renderCoordsHelper:t,spatialReference:o}=e,{positionsSpherical:r,positionsStereographic:n}=this,h=this._tempVec3,a=y(r,h);if(!a)return void(this.geodesicArea=null);const d=this._tempU,l=this._tempV;k(h,d,l);for(let s=0;s<this._length;++s){const e=g(r[s],d),t=g(r[s],l),o=g(r[s],h);i(n[s],e/o,t/o)}p(h,h,f(o).radius),t.toRenderCoords(h,P(o),this.geodesicAreaCentroidRenderCoords),this._updateGeodesicIntersectingSegments(),this.geodesicArea=a&&0===this.geodesicIntersectingSegments.size?s(this._computeGeodesicArea(),"square-meters"):null}_updatePerimeterLengths(){const e=this.positionsProjectedWorldCoords,t=this.perimeterSegmentLengths;let s=0;for(let i=0;i<this._length;++i){s+=t[i]=o(e[i],e[(i+1)%this._length])}return s}_updateIntersectingSegments(){const e=this.positionsProjectedWorldCoords,t=this.intersectingSegments;t.clear();for(let s=0;s<this._length;++s)for(let i=s+2;i<this._length;++i){if((i+1)%this._length===s)continue;const o=e[s],r=e[(s+1)%this._length],n=e[i],h=e[(i+1)%this._length];W(o,r,n,h)&&(t.add(s),t.add(i))}}_computeArea(){const e=this.positionsProjectedWorldCoords,t=this.triangleIndices=V(B(e));let s=0;for(let i=0;i<t.length;i+=3)s+=z(e[t[i]],e[t[i+1]],e[t[i+2]]);return s}_updateGeodesicIntersectingSegments(){const e=this.positionsStereographic,t=this.geodesicIntersectingSegments;t.clear();for(let s=0;s<this._length;++s)for(let i=s+2;i<this._length;++i){if((i+1)%this._length===s)continue;const o=e[s],r=e[(s+1)%this._length],n=e[i],h=e[(i+1)%this._length];W(o,r,n,h)&&(t.add(s),t.add(i))}}_computeGeodesicArea(){const e=this.positionsGeographic,t=this.positionsStereographic,s=this.geodesicTriangleIndices=V(B(t));let i=0;for(let o=0;o<s.length;o+=3)i+=T(e[s[o]],e[s[o+1]],e[s[o+2]],L.WGS84);return i}_selectFittingMode(t,s,i,o){const r=s.map((e=>Math.abs(x(t,e)))).reduce(((e,t)=>Math.max(e,t)),0);b(s,this._tempSphere);const n=r/(2*this._tempSphere[3]),h=n<o.maxRelativeErrorCoplanar,a=n<o.maxRelativeErrorAlmostCoplanar;let d="horizontal";if(h)d="oblique";else if(a){d=Math.abs(g(i,t))>Math.cos(e(o.verticalAngleThreshold))?"horizontal":"vertical"}return d}_updateCursorSegmentLength(e,s){const i=e.lastPoint;e.isValidPolygon||null==i||null==s?(this.geodesicStagedSegmentLength=null,this.stagedSegmentLength=null):(this.geodesicStagedSegmentLength=t(F(i,s),"meters"),this.stagedSegmentLength=t(this.unitNormalizer.normalizeDistance(q(i,s,this.unitNormalizer.spatialReference)),"meters"))}_updateMode(e){if(e===w.Auto){this.actualMeasurementMode="euclidean";let e=0;null!=this.geodesicPathLength&&(e+=this.geodesicPathLength.value),e>Z&&(this.actualMeasurementMode="geodesic")}else this.actualMeasurementMode=e===w.Euclidean?"euclidean":"geodesic";null==this.geodesicPathLength&&(this.actualMeasurementMode="euclidean"),this._mode=e}}function X(e,t){t.hasZ||(t.z=E(e,t,"ground")??0)}const Z=1e5;export{H as MeasurementDataManager};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../geometry.js";import{LengthDimensionMeasureType as e}from"../../../../analysis/dimensionUtils.js";import"../../../../core/has.js";import{
|
|
5
|
+
import"../../../../geometry.js";import{LengthDimensionMeasureType as e}from"../../../../analysis/dimensionUtils.js";import"../../../../core/has.js";import{j as t,h as n,k as i,f as o,p as r}from"../../../../chunks/vec32.js";import{sv3d as a}from"../../../../geometry/support/vectorStacks.js";import{automaticHeadingFromCamera as s}from"./lengthDimensionManipulatorUtils.js";import{isGeodesicDimension as l,directUp as c,directStartToEnd as d}from"./lengthDimensionUtils.js";import{constraintThresholdPx as m}from"./settings.js";import u from"../../../../geometry/Point.js";var p;function P(e,t){return{enabled:t.effectiveFeatureEnabled,elevationAlignedStartPoint:e.elevationAlignedStartPoint,elevationAlignedEndPoint:e.elevationAlignedEndPoint,geometry:e.geometry}}function f(e,s){if(l(e))return p.Direct;if(!e.enabled)return null;const{geometry:u}=e;if(null==u||t(u.directSegment.startRenderSpace,u.directSegment.endRenderSpace))return null;const{camera:P}=s.state,f=c(a.get(),u,s.renderCoordsHelper),g=d(a.get(),u),S=n(a.get(),f,i(g,f)),v=o(a.get(),g,S),y=r(v),A=r(S),{startRenderSpace:R,endRenderSpace:j}=u.directSegment,z=Math.max(P.computeScreenPixelSizeAt(R)*m,P.computeScreenPixelSizeAt(j)*m)**2;return y<z?p.Vertical:A<z?p.Horizontal:null}function g(e,t,{constraint:n,view:i}){const{unconstrainedGeometry:o}=e;if(null==o)return;const{renderCoordsHelper:r,spatialReference:a}=i,{startRenderSpace:s,endRenderSpace:l}=o.directSegment,c=r.fromRenderCoords(s,new u({spatialReference:a})),d=r.fromRenderCoords(l,new u({spatialReference:a}));let m;m="start"===t?{startPoint:c}:{endPoint:d},S(e,m,{constraint:n,elevationAlignedStartPoint:e.elevationAlignedStartPoint,elevationAlignedEndPoint:e.elevationAlignedEndPoint,unconstrainedGeometry:o,view:i})}function S(t,n,i){const{constraint:o,elevationAlignedStartPoint:r,elevationAlignedEndPoint:a,unconstrainedGeometry:l,view:c}=i,{dimension:d,previousConstraint:m,preConstraintProperties:u}=t;if(null==r||null==a)return;const P=()=>{"startPoint"in n?d.startPoint=n.startPoint:"endPoint"in n&&(d.endPoint=n.endPoint)};if(null==o)P(),null!=m&&null!=u&&(d.measureType=u.measureType,d.orientation=u.orientation);else switch(d.measureType=e.Direct,o){case p.Horizontal:if(o!==m&&(d.orientation=0),"startPoint"in n){const e=n.startPoint;null!=e&&(e.z=a.z),d.startPoint=e}else if("endPoint"in n){const e=n.endPoint;null!=e&&(e.z=r.z),d.endPoint=e}break;case p.Vertical:if(o!==m&&(d.orientation=s(l,c)),"startPoint"in n){const e=n.startPoint;null!=e&&(e.x=a.x,e.y=a.y),d.startPoint=e}else if("endPoint"in n){const e=n.endPoint;null!=e&&(e.x=r.x,e.y=r.y),d.endPoint=e}break;case p.Direct:o!==m&&null!=u&&(d.orientation=u.orientation),P()}t.previousConstraint=o,t.unconstrainedGeometry=l}!function(e){e[e.Horizontal=0]="Horizontal",e[e.Vertical=1]="Vertical",e[e.Direct=2]="Direct"}(p||(p={}));export{p as LengthDimensionConstraint,S as applyConstraint,f as computeConstraint,P as constraintDependencies,g as reapplyConstraint};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../Color.js";import"../../../../geometry.js";import{lengthDimensionMeasureType as t,LengthDimensionMeasureType as r}from"../../../../analysis/dimensionUtils.js";import{cyclicalDegrees as n}from"../../../../core/Cyclical.js";import{rad2deg as i}from"../../../../core/mathUtils.js";import{watch as o,initial as a}from"../../../../core/reactiveUtils.js";import{pt2px as s}from"../../../../core/screenUtils.js";import{identity as c,scale as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{h as d,c as u,f as p,b as f,j as g,i as h,l as v,s as y,y as w}from"../../../../chunks/vec32.js";import{create as S,ZEROS as j,fromValues as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as x}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromPositionAndNormal as H,create as M,signedDistance as P,getNormal as C}from"../../../../geometry/support/plane.js";import{sv3d as T}from"../../../../geometry/support/vectorStacks.js";import{clonePoint as O}from"../../../../layers/graphics/hydratedFeatures.js";import{isValidComputation as U,computeGeometryFromDimension as R,computationToGeometryDependencies as z,headingFromGeometry as A,computeOffsetForPoint as D,computeSegmentForMeasureType as _,computeOffsetAxis as F,directUp as L,directStartToEnd as k,dimensionStartToEnd as E}from"./lengthDimensionUtils.js";import{getTransparentAccentColor as I,pointRadius as G,lengthFraction as B,markerLineSizeFraction as N,orientationCalloutOffsetPx as V,orientationCalloutWidth as W,orientationDiscScale as q,orientationFocusMultiplier as J,orientationSnapThresholdDegrees as K,minLengthMeters as Q,linePaddingPx as X,focusedLinePaddingPx as Y}from"./settings.js";import{Manipulator3D as Z}from"../../interactive/Manipulator3D.js";import{createManipulatorMaterial as $,worldScaledManipulatorSettings as ee,calculateInputRotationTransform as te,calculateTranslateRotateFromBases as re,rotateManipulatorDefaults as ne}from"../../interactive/manipulatorUtils.js";import{RenderObject as ie}from"../../interactive/RenderObject.js";import{screenToMap3D as oe,screenToRenderPlane as ae,hideManipulatorWhileDragging as se}from"../../interactive/editingTools/dragEventPipeline3D.js";import{EuclideanSegment as ce}from"../../interactive/visualElements/support/Segment.js";import{markerSizePerLineWidth as le}from"../../support/engineContent/marker.js";import{Attribute as me}from"../../webgl-engine/lib/Attribute.js";import{Geometry as de}from"../../webgl-engine/lib/Geometry.js";import{createSphereGeometry as ue,createPolylineGeometry as pe}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as fe}from"../../webgl-engine/lib/Material.js";import{VertexAttribute as ge}from"../../webgl-engine/lib/VertexAttribute.js";import{ImageMaterial as he}from"../../webgl-engine/materials/ImageMaterial.js";import{RibbonLineMaterial as ve}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{createManipulatorDragEventPipeline as ye,resetProperties as we,EventPipeline as Se}from"../../../interactive/dragEventPipeline.js";import{ManipulatorStateCustomFlags as je,ManipulatorStateFlags as be}from"../../../interactive/interfaces.js";import xe from"../../../../geometry/Point.js";class He{constructor(e){this.start=e.start,this.end=e.end,this.offset=e.offset,this.heading=e.heading,this.rotation=e.rotation,this.direct=e.direct,this.horizontal=e.horizontal,this.vertical=e.vertical}manipulatorName(e){return Object.keys(this).find((t=>this.hasOwnProperty(t)&&e===this[t]))}values(){return[this.start,this.end,this.offset,this.heading,this.rotation,this.direct,this.horizontal,this.vertical]}forEachMeasureTypeManipulator(e){for(const r of t)e(this.manipulatorForMeasureType(r),r)}manipulatorForMeasureType(e){switch(e){case r.Direct:return this.direct;case r.Horizontal:return this.horizontal;case r.Vertical:return this.vertical}}}class Me extends Z{constructor(t,r){const n=$(e.toUnitRGBA(I(t.effectiveTheme))),i=[new ie(ue(n,1,32,32),tt)];super({view:t,renderObjects:i,metadata:r.metadata,available:!1,grabCursor:"crosshair",radius:G,collisionPriority:1}),this._themeHandle=o((()=>({color:e.toUnitRGBA(I(t.effectiveTheme))})),(e=>n.setParameters(e)))}destroy(){this._themeHandle.remove(),super.destroy()}}function Pe(e,t){const r=[b(-.5,0,0),b(.5,0,0)],n=pe(t.unfocusedMaterial,r.map((e=>d(S(),e,B)))),i=n.instantiate({material:t.focusedMaterial});return new Z({view:e,renderObjects:[new ie(n,be.Unfocused|be.Selected|tt),new ie(i,be.Focused|tt)],collisionType:{type:"line",paths:[r]},radius:$e(t.lineSizePt)/2,metadata:t.metadata,available:!1,...ee})}class Ce extends Z{constructor(t,{lineSizePt:r,material:n,metadata:i}){super({view:t,autoScaleRenderObjects:!1,collisionPriority:1,metadata:i}),this._options={calloutColor:x(),lineSizePt:r,material:n},this._themeHandle=o((()=>e.toUnitRGBA(I(t.effectiveTheme))),(e=>{this._options.calloutColor=e,et(this,Te({...this._options,metadata:this.metadata}))}),a)}update({lineSizePt:e,material:t}){this._options.lineSizePt=e,this._options.material=t,et(this,Te({...this._options,metadata:this.metadata}))}destroy(){this._themeHandle.remove(),super.destroy()}}function Te({calloutColor:e,lineSizePt:t,material:r,metadata:n}){return{calloutLength:.25*le*N*s(t)+V,calloutColor:e,calloutWidth:W,customStateMask:tt,discScale:q,focusMultiplier:J,material:r,metadata:n}}function Oe(e,t){const r=[b(-.5,0,0),b(.5,0,0)],n=pe(t.thinOffsetManipulatorMaterial,r),i=pe(t.unfocusedMaterial,r.map((e=>d(S(),e,B)))),o=i.instantiate({material:t.focusedMaterial});return new Z({view:e,renderObjects:[new ie(i,be.Unfocused|tt),new ie(o,be.Focused|tt),new ie(n,tt)],collisionType:{type:"line",paths:[r]},radius:$e(t.lineSizePt)/2,available:!1,metadata:t.metadata,...ee})}function Ue(e,{isStart:t,createSnappingPipelineStep:r,dimension:n,onUpdate:i,view:o}){const a=t?"startPoint":"endPoint",s=ye(e,((e,t,s,c)=>{const l=se(e),{snappingStep:m,cancelSnapping:d}=r(c);s=s.next(l).next(we(n,[a,"measureType","orientation"])).next(d),t.next(l).next(oe(o)).next(...m).next((e=>{const t=O(e.mapEnd,new xe);i("startPoint"===a?{startPoint:t}:{endPoint:t})}))}));return[s]}function Re(e,{computation:t,view:r}){return[ye(e,((e,n,i)=>{if(!U(t)||!e.selected)return;const{geometry:o,dimension:a}=t,s=se(e);n.next(s).next(ke(r,a,o.dimensionSegment,o.primaryOffsetAxis)),i.next(s).next(we(a,["offset"]))}))]}function ze(e,{computation:t,view:r}){return[ye(e,((e,n,i)=>{_e({cancel:i,computation:t,settingHeading:!0,steps:n,view:r})}))]}function Ae(e,{computation:t,view:r}){return[ye(e,((e,n,i)=>{_e({cancel:i,computation:t,settingHeading:!1,steps:n,view:r})})),e.events.on("immediate-click",(e=>{De(e,t,r)}))]}function De(e,t,r){const{dimension:i,geometry:o}=t;if(90===i.orientation||270===i.orientation)return i.orientation=0,void e.stopPropagation();if(null==o)return;const{renderCoordsHelper:a}=r,s=R({...z(t),orientation:90},a),c=R({...z(t),orientation:270},a);if(null==s||null==c)return;const l=A(s,a),m=A(c,a),d=Ee(o,r),u=n.shortestSignedDiff(d,l),p=n.shortestSignedDiff(d,m);i.orientation=Math.abs(u)<Math.abs(p)?90:270,e.stopPropagation()}function _e(e){const{cancel:t,computation:r,settingHeading:n,steps:o,view:a}=e;if(!U(r))return;const{renderCoordsHelper:s}=a,{dimension:c,geometry:l}=r,m=S(),d=Je(S(),l,l.directSegment,s),p=Ke(T.get(),{forHeading:n,geometry:l,renderCoordsHelper:s}),f=H(d,p,M()),g=n?c.orientation??A(l,a.renderCoordsHelper):c.orientation??0;o.next(ae(a,f)).next((e=>{"start"===e.action&&u(m,e.renderStart);const t=C(f),r=te(m,e.renderEnd,d,t);let o=g-i(r);n||(o=Fe(o)),c.orientation=o})),t.next(we(c,["orientation"]))}function Fe(e){const t=n.normalize(e)%90;return t<K?e-t:90-t<K?e+(90-t):e}function Le(e,{computation:t,manipulatorMeasureType:n,view:i}){let o=r.Direct,a=0,s=0;return[e.events.on("grab-changed",(r=>{if("start"!==r.action||!U(t))return;const{dimension:c,geometry:l}=t;o=c.measureType,a=c.offset,s=c.orientation;const m=u(T.get(),e.renderLocation);c.measureType=n,c.offset=D(m,n,l,i.renderCoordsHelper),c.orientation=0})),ye(e,((e,r,c)=>{if(!U(t))return;const{geometry:l,dimension:m}=t,{renderCoordsHelper:d}=i,u=_(ot,n,t,d),p=F(T.get(),{measureType:n,directSegment:l.directSegment,renderCoordsHelper:d}),f=se(e);r.next(f).next(ke(i,m,u,p)),c.next(f).next((e=>(m.measureType=o,m.offset=a,m.orientation=s,e)))}))]}function ke(e,t,r,n){const i=p(T.get(),r.endRenderSpace,r.startRenderSpace);f(i,i,n);const o=H(r.startRenderSpace,i,M()),a=H(r.startRenderSpace,n,M()),s=t.offset;let c,l=0;const m=new Se;return m.next(ae(e,o)).next((r=>{"start"===r.action&&(l=P(a,r.renderStart));const n=(P(a,r.renderEnd)-l)*e.renderCoordsHelper.unitInMeters;t.offset=s+n,c=r})),e=>(m.execute(e),c)}function Ee(e,t){const{directSegment:r}=e,{renderCoordsHelper:n}=t,i=L(T.get(),e,n),o=k(T.get(),e),a=f(T.get(),o,i),{viewForward:s}=t.state.camera;g(a,s)>0&&d(a,a,-1);const c=r.eval(.5,T.get());return n.headingAtPosition(c,a)}function Ie(e,t,r){const{dimensionSegment:n,primaryOffsetAxis:i}=t,o=E(rt,t),a=h(o,j)?c(it):re(o,i,j,it),s=Math.max(v(o),Q/r.unitInMeters);l(a,a,y(rt,s,s,s)),e.modelTransform=a,e.renderLocation=n.eval(.5,rt)}function Ge(e,t,r){Ne(e,t,r,{forHeading:!0})}function Be(e,t,r){Ne(e,t,r,{forHeading:!1})}function Ne(e,t,r,{forHeading:n}){const{dimension:i,geometry:o}=t,{primaryOffsetAxis:a}=o,s=d(Ve,a,i.offset>=0?1:-1),c=Ke(We,{forHeading:n,geometry:o,renderCoordsHelper:r});f(c,c,s);const l=re(s,c,j,it);e.modelTransform=l,e.renderLocation=Je(rt,o,o.dimensionSegment,r)}const Ve=S(),We=S();function qe(e,t,r,n){const{geometry:i}=t,o=_(ot,r,t,n),a=F(rt,{measureType:r,directSegment:i.directSegment,renderCoordsHelper:n}),s=w(nt,o.endRenderSpace,o.startRenderSpace),c=re(s,a,j,it),m=v(s);l(c,c,y(nt,m,m,m)),e.modelTransform=c,e.renderLocation=o.eval(.5,nt)}function Je(e,t,r,n){const{startRenderSpace:i,endRenderSpace:o}=r,a=Qe(t,n)?i:o;return u(e,a)}function Ke(e,{forHeading:t,geometry:r,renderCoordsHelper:n}){return t?L(e,r,n):E(e,r,{invert:!0})}function Qe(e,t){const r=k(Xe,e),n=L(Ye,e,t);return g(r,n)>0}const Xe=S(),Ye=S();function Ze(e){return s(e)+X}function $e(e){return s(e)+Y}function et(e,t){const r=t.material??new he({transparent:!0,writeDepth:!1,textureId:t.texture?.id,renderOccluded:fe.Opaque,isDecoration:!0}),n=t.focusMultiplier??ne.focusMultiplier,i=t.calloutLength??ne.calloutLength,o=ne.discRadius*(t.discScale??1),a=o*n,s=(e,t)=>{const r=[0,1,2,2,3,0];return new de(t,[[ge.POSITION,new me([i-e,-e,0,i+e,-e,0,i+e,e,0,i-e,e,0],r,3,!0)],[ge.UV0,new me([0,0,1,0,1,1,0,1],r,2,!0)]])},c=t.calloutWidth??ne.calloutWidth,l=new ve({width:c,color:t.calloutColor,renderOccluded:fe.OccludeAndTransparent,isDecoration:!0}),m=pe(l,[[0,0,0],[i-o,0,0]]),d=pe(l,[[0,0,0],[i-a,0,0]]),u=t.customStateMask??je.None;e.collisionType={type:"disc",direction:[0,0,1],offset:[i,0,0]},e.focusMultiplier=n,e.metadata=t.metadata,e.radius=o,e.renderObjects=[new ie(s(o,r),be.Unfocused|u),new ie(m,be.Unfocused|u),new ie(s(a,r),be.Focused|u),new ie(d,be.Focused|u)]}const tt=je.Custom1,rt=S(),nt=S(),it=m(),ot=new ce;export{tt as DidPointerMoveRecentlyFlag,He as LengthDimensionManipulators,Me as LengthDimensionPointManipulator,Ce as LineOfSightOrientationManipulator,Ee as automaticHeadingFromCamera,Oe as createMeasureTypeManipulator,Pe as createOffsetManipulator,$e as focusedOffsetWidth,ze as headingManipulatorHandles,Le as measureTypeManipulatorHandles,Re as offsetManipulatorHandles,Ue as pointManipulatorHandles,Ae as rotationManipulatorHandles,Fe as snapOrientationToNearestRightAngle,Ze as unfocusedOffsetWidth,Ge as updateHeadingManipulatorTransform,qe as updateMeasureTypeManipulatorTransform,Ie as updateOffsetManipulatorTransform,Be as updateRotationManipulatorTransform};
|
|
5
|
+
import e from"../../../../Color.js";import"../../../../geometry.js";import{lengthDimensionMeasureType as t,LengthDimensionMeasureType as r}from"../../../../analysis/dimensionUtils.js";import{cyclicalDegrees as n}from"../../../../core/Cyclical.js";import{rad2deg as i}from"../../../../core/mathUtils.js";import{watch as o,initial as a}from"../../../../core/reactiveUtils.js";import{pt2px as s}from"../../../../core/screenUtils.js";import{identity as c,scale as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{h as d,c as u,f as p,b as f,k as g,j as h,l as v,s as y,z as w}from"../../../../chunks/vec32.js";import{create as S,ZEROS as j,fromValues as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as x}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromPositionAndNormal as H,create as M,signedDistance as P,getNormal as C}from"../../../../geometry/support/plane.js";import{sv3d as T}from"../../../../geometry/support/vectorStacks.js";import{clonePoint as O}from"../../../../layers/graphics/hydratedFeatures.js";import{isValidComputation as U,computeGeometryFromDimension as R,computationToGeometryDependencies as z,headingFromGeometry as A,computeOffsetForPoint as D,computeSegmentForMeasureType as _,computeOffsetAxis as k,directUp as F,directStartToEnd as L,dimensionStartToEnd as E}from"./lengthDimensionUtils.js";import{getTransparentAccentColor as I,pointRadius as G,lengthFraction as B,markerLineSizeFraction as N,orientationCalloutOffsetPx as V,orientationCalloutWidth as W,orientationDiscScale as q,orientationFocusMultiplier as J,orientationSnapThresholdDegrees as K,minLengthMeters as Q,linePaddingPx as X,focusedLinePaddingPx as Y}from"./settings.js";import{Manipulator3D as Z}from"../../interactive/Manipulator3D.js";import{createManipulatorMaterial as $,worldScaledManipulatorSettings as ee,calculateInputRotationTransform as te,calculateTranslateRotateFromBases as re,rotateManipulatorDefaults as ne}from"../../interactive/manipulatorUtils.js";import{RenderObject as ie}from"../../interactive/RenderObject.js";import{screenToMap3D as oe,screenToRenderPlane as ae,hideManipulatorWhileDragging as se}from"../../interactive/editingTools/dragEventPipeline3D.js";import{EuclideanSegment as ce}from"../../interactive/visualElements/support/Segment.js";import{markerSizePerLineWidth as le}from"../../support/engineContent/marker.js";import{Attribute as me}from"../../webgl-engine/lib/Attribute.js";import{Geometry as de}from"../../webgl-engine/lib/Geometry.js";import{createSphereGeometry as ue,createPolylineGeometry as pe}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as fe}from"../../webgl-engine/lib/Material.js";import{VertexAttribute as ge}from"../../webgl-engine/lib/VertexAttribute.js";import{ImageMaterial as he}from"../../webgl-engine/materials/ImageMaterial.js";import{RibbonLineMaterial as ve}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{createManipulatorDragEventPipeline as ye,resetProperties as we,EventPipeline as Se}from"../../../interactive/dragEventPipeline.js";import{ManipulatorStateCustomFlags as je,ManipulatorStateFlags as be}from"../../../interactive/interfaces.js";import xe from"../../../../geometry/Point.js";class He{constructor(e){this.start=e.start,this.end=e.end,this.offset=e.offset,this.heading=e.heading,this.rotation=e.rotation,this.direct=e.direct,this.horizontal=e.horizontal,this.vertical=e.vertical}manipulatorName(e){return Object.keys(this).find((t=>this.hasOwnProperty(t)&&e===this[t]))}values(){return[this.start,this.end,this.offset,this.heading,this.rotation,this.direct,this.horizontal,this.vertical]}forEachMeasureTypeManipulator(e){for(const r of t)e(this.manipulatorForMeasureType(r),r)}manipulatorForMeasureType(e){switch(e){case r.Direct:return this.direct;case r.Horizontal:return this.horizontal;case r.Vertical:return this.vertical}}}class Me extends Z{constructor(t,r){const n=$(e.toUnitRGBA(I(t.effectiveTheme))),i=[new ie(ue(n,1,32,32),tt)];super({view:t,renderObjects:i,metadata:r.metadata,available:!1,grabCursor:"crosshair",radius:G,collisionPriority:1}),this._themeHandle=o((()=>({color:e.toUnitRGBA(I(t.effectiveTheme))})),(e=>n.setParameters(e)))}destroy(){this._themeHandle.remove(),super.destroy()}}function Pe(e,t){const r=[b(-.5,0,0),b(.5,0,0)],n=pe(t.unfocusedMaterial,r.map((e=>d(S(),e,B)))),i=n.instantiate({material:t.focusedMaterial});return new Z({view:e,renderObjects:[new ie(n,be.Unfocused|be.Selected|tt),new ie(i,be.Focused|tt)],collisionType:{type:"line",paths:[r]},radius:$e(t.lineSizePt)/2,metadata:t.metadata,available:!1,...ee})}class Ce extends Z{constructor(t,{lineSizePt:r,material:n,metadata:i}){super({view:t,autoScaleRenderObjects:!1,collisionPriority:1,metadata:i}),this._options={calloutColor:x(),lineSizePt:r,material:n},this._themeHandle=o((()=>e.toUnitRGBA(I(t.effectiveTheme))),(e=>{this._options.calloutColor=e,et(this,Te({...this._options,metadata:this.metadata}))}),a)}update({lineSizePt:e,material:t}){this._options.lineSizePt=e,this._options.material=t,et(this,Te({...this._options,metadata:this.metadata}))}destroy(){this._themeHandle.remove(),super.destroy()}}function Te({calloutColor:e,lineSizePt:t,material:r,metadata:n}){return{calloutLength:.25*le*N*s(t)+V,calloutColor:e,calloutWidth:W,customStateMask:tt,discScale:q,focusMultiplier:J,material:r,metadata:n}}function Oe(e,t){const r=[b(-.5,0,0),b(.5,0,0)],n=pe(t.thinOffsetManipulatorMaterial,r),i=pe(t.unfocusedMaterial,r.map((e=>d(S(),e,B)))),o=i.instantiate({material:t.focusedMaterial});return new Z({view:e,renderObjects:[new ie(i,be.Unfocused|tt),new ie(o,be.Focused|tt),new ie(n,tt)],collisionType:{type:"line",paths:[r]},radius:$e(t.lineSizePt)/2,available:!1,metadata:t.metadata,...ee})}function Ue(e,{isStart:t,createSnappingPipelineStep:r,dimension:n,onUpdate:i,view:o}){const a=t?"startPoint":"endPoint",s=ye(e,((e,t,s,c)=>{const l=se(e),{snappingStep:m,cancelSnapping:d}=r(c);s=s.next(l).next(we(n,[a,"measureType","orientation"])).next(d),t.next(l).next(oe(o)).next(...m).next((e=>{const t=O(e.mapEnd,new xe);i("startPoint"===a?{startPoint:t}:{endPoint:t})}))}));return[s]}function Re(e,{computation:t,view:r}){return[ye(e,((e,n,i)=>{if(!U(t)||!e.selected)return;const{geometry:o,dimension:a}=t,s=se(e);n.next(s).next(Le(r,a,o.dimensionSegment,o.primaryOffsetAxis)),i.next(s).next(we(a,["offset"]))}))]}function ze(e,{computation:t,view:r}){return[ye(e,((e,n,i)=>{_e({cancel:i,computation:t,settingHeading:!0,steps:n,view:r})}))]}function Ae(e,{computation:t,view:r}){return[ye(e,((e,n,i)=>{_e({cancel:i,computation:t,settingHeading:!1,steps:n,view:r})})),e.events.on("immediate-click",(e=>{De(e,t,r)}))]}function De(e,t,r){const{dimension:i,geometry:o}=t;if(90===i.orientation||270===i.orientation)return i.orientation=0,void e.stopPropagation();if(null==o)return;const{renderCoordsHelper:a}=r,s=R({...z(t),orientation:90},a),c=R({...z(t),orientation:270},a);if(null==s||null==c)return;const l=A(s,a),m=A(c,a),d=Ee(o,r),u=n.shortestSignedDiff(d,l),p=n.shortestSignedDiff(d,m);i.orientation=Math.abs(u)<Math.abs(p)?90:270,e.stopPropagation()}function _e(e){const{cancel:t,computation:r,settingHeading:n,steps:o,view:a}=e;if(!U(r))return;const{renderCoordsHelper:s}=a,{dimension:c,geometry:l}=r,m=S(),d=Je(S(),l,l.directSegment,s),p=Ke(T.get(),{forHeading:n,geometry:l,renderCoordsHelper:s}),f=H(d,p,M()),g=n?c.orientation??A(l,a.renderCoordsHelper):c.orientation??0;o.next(ae(a,f)).next((e=>{"start"===e.action&&u(m,e.renderStart);const t=C(f),r=te(m,e.renderEnd,d,t);let o=g-i(r);n||(o=ke(o)),c.orientation=o})),t.next(we(c,["orientation"]))}function ke(e){const t=n.normalize(e)%90;return t<K?e-t:90-t<K?e+(90-t):e}function Fe(e,{computation:t,manipulatorMeasureType:n,view:i}){let o=r.Direct,a=0,s=0;return[e.events.on("grab-changed",(r=>{if("start"!==r.action||!U(t))return;const{dimension:c,geometry:l}=t;o=c.measureType,a=c.offset,s=c.orientation;const m=u(T.get(),e.renderLocation);c.measureType=n,c.offset=D(m,n,l,i.renderCoordsHelper),c.orientation=0})),ye(e,((e,r,c)=>{if(!U(t))return;const{geometry:l,dimension:m}=t,{renderCoordsHelper:d}=i,u=_(ot,n,t,d),p=k(T.get(),{measureType:n,directSegment:l.directSegment,renderCoordsHelper:d}),f=se(e);r.next(f).next(Le(i,m,u,p)),c.next(f).next((e=>(m.measureType=o,m.offset=a,m.orientation=s,e)))}))]}function Le(e,t,r,n){const i=p(T.get(),r.endRenderSpace,r.startRenderSpace);f(i,i,n);const o=H(r.startRenderSpace,i,M()),a=H(r.startRenderSpace,n,M()),s=t.offset;let c,l=0;const m=new Se;return m.next(ae(e,o)).next((r=>{"start"===r.action&&(l=P(a,r.renderStart));const n=(P(a,r.renderEnd)-l)*e.renderCoordsHelper.unitInMeters;t.offset=s+n,c=r})),e=>(m.execute(e),c)}function Ee(e,t){const{directSegment:r}=e,{renderCoordsHelper:n}=t,i=F(T.get(),e,n),o=L(T.get(),e),a=f(T.get(),o,i),{viewForward:s}=t.state.camera;g(a,s)>0&&d(a,a,-1);const c=r.eval(.5,T.get());return n.headingAtPosition(c,a)}function Ie(e,t,r){const{dimensionSegment:n,primaryOffsetAxis:i}=t,o=E(rt,t),a=h(o,j)?c(it):re(o,i,j,it),s=Math.max(v(o),Q/r.unitInMeters);l(a,a,y(rt,s,s,s)),e.modelTransform=a,e.renderLocation=n.eval(.5,rt)}function Ge(e,t,r){Ne(e,t,r,{forHeading:!0})}function Be(e,t,r){Ne(e,t,r,{forHeading:!1})}function Ne(e,t,r,{forHeading:n}){const{dimension:i,geometry:o}=t,{primaryOffsetAxis:a}=o,s=d(Ve,a,i.offset>=0?1:-1),c=Ke(We,{forHeading:n,geometry:o,renderCoordsHelper:r});f(c,c,s);const l=re(s,c,j,it);e.modelTransform=l,e.renderLocation=Je(rt,o,o.dimensionSegment,r)}const Ve=S(),We=S();function qe(e,t,r,n){const{geometry:i}=t,o=_(ot,r,t,n),a=k(rt,{measureType:r,directSegment:i.directSegment,renderCoordsHelper:n}),s=w(nt,o.endRenderSpace,o.startRenderSpace),c=re(s,a,j,it),m=v(s);l(c,c,y(nt,m,m,m)),e.modelTransform=c,e.renderLocation=o.eval(.5,nt)}function Je(e,t,r,n){const{startRenderSpace:i,endRenderSpace:o}=r,a=Qe(t,n)?i:o;return u(e,a)}function Ke(e,{forHeading:t,geometry:r,renderCoordsHelper:n}){return t?F(e,r,n):E(e,r,{invert:!0})}function Qe(e,t){const r=L(Xe,e),n=F(Ye,e,t);return g(r,n)>0}const Xe=S(),Ye=S();function Ze(e){return s(e)+X}function $e(e){return s(e)+Y}function et(e,t){const r=t.material??new he({transparent:!0,writeDepth:!1,textureId:t.texture?.id,renderOccluded:fe.Opaque,isDecoration:!0}),n=t.focusMultiplier??ne.focusMultiplier,i=t.calloutLength??ne.calloutLength,o=ne.discRadius*(t.discScale??1),a=o*n,s=(e,t)=>{const r=[0,1,2,2,3,0];return new de(t,[[ge.POSITION,new me([i-e,-e,0,i+e,-e,0,i+e,e,0,i-e,e,0],r,3,!0)],[ge.UV0,new me([0,0,1,0,1,1,0,1],r,2,!0)]])},c=t.calloutWidth??ne.calloutWidth,l=new ve({width:c,color:t.calloutColor,renderOccluded:fe.OccludeAndTransparent,isDecoration:!0}),m=pe(l,[[0,0,0],[i-o,0,0]]),d=pe(l,[[0,0,0],[i-a,0,0]]),u=t.customStateMask??je.None;e.collisionType={type:"disc",direction:[0,0,1],offset:[i,0,0]},e.focusMultiplier=n,e.metadata=t.metadata,e.radius=o,e.renderObjects=[new ie(s(o,r),be.Unfocused|u),new ie(m,be.Unfocused|u),new ie(s(a,r),be.Focused|u),new ie(d,be.Focused|u)]}const tt=je.Custom1,rt=S(),nt=S(),it=m(),ot=new ce;export{tt as DidPointerMoveRecentlyFlag,He as LengthDimensionManipulators,Me as LengthDimensionPointManipulator,Ce as LineOfSightOrientationManipulator,Ee as automaticHeadingFromCamera,Oe as createMeasureTypeManipulator,Pe as createOffsetManipulator,$e as focusedOffsetWidth,ze as headingManipulatorHandles,Fe as measureTypeManipulatorHandles,Re as offsetManipulatorHandles,Ue as pointManipulatorHandles,Ae as rotationManipulatorHandles,ke as snapOrientationToNearestRightAngle,Ze as unfocusedOffsetWidth,Ge as updateHeadingManipulatorTransform,qe as updateMeasureTypeManipulatorTransform,Ie as updateOffsetManipulatorTransform,Be as updateRotationManipulatorTransform};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{LengthDimensionMeasureType as e}from"../../../../analysis/dimensionUtils.js";import{deg2rad as t}from"../../../../core/mathUtils.js";import{toUnit as n}from"../../../../core/quantityUtils.js";import{adaptiveVerticalLengthUnit as r,adaptiveLengthUnit as i}from"../../../../core/unitUtils.js";import{fromRotation as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{c as s,
|
|
5
|
+
import{LengthDimensionMeasureType as e}from"../../../../analysis/dimensionUtils.js";import{deg2rad as t}from"../../../../core/mathUtils.js";import{toUnit as n}from"../../../../core/quantityUtils.js";import{adaptiveVerticalLengthUnit as r,adaptiveLengthUnit as i}from"../../../../core/unitUtils.js";import{fromRotation as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{c as s,r as d,z as l,G as c,k as p,w as u,e as m,b as S,n as g,p as f}from"../../../../chunks/vec32.js";import{create as v,ZEROS as R}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Axis as A}from"../../../../geometry/support/Axis.js";import{sv3d as P}from"../../../../geometry/support/vectorStacks.js";import{makeDehydratedPoint as y}from"../../../../layers/graphics/dehydratedPoint.js";import{clonePoint as E}from"../../../../layers/graphics/hydratedFeatures.js";import{EuclideanSegment as j}from"../../interactive/visualElements/support/Segment.js";import{autoDistanceBetweenPoints2D as x}from"../../../support/automaticLengthMeasurementUtils.js";import{euclideanDirectDistance as h,euclideanDirectDistanceBetweenPoints as H}from"../../../support/euclideanLengthMeasurementUtils.js";import{geodesicDistanceThreshold as T}from"../../../support/geodesicMeasurementUtils.js";function w(t,o,a){if(null==t)return null;let s;if(o===e.Horizontal)s=x(t.elevationAlignedStartPoint,t.elevationAlignedEndPoint);else{const{startRenderSpace:e,endRenderSpace:n}=t.dimensionSegment;s=h(e,n,t.spatialReference)}if(null==s)return null;const d=o===e.Vertical?r(s.value,s.unit,a):i(s.value,s.unit,a);return n(s,d)}function z(e){const{elevationAlignedStartPoint:t,elevationAlignedEndPoint:n,dimension:{offset:r,measureType:i,orientation:o}}=e;return{elevationAlignedStartPoint:t,elevationAlignedEndPoint:n,offset:r,measureType:i,orientation:o}}function C({elevationAlignedStartPoint:t,elevationAlignedEndPoint:n,offset:r,measureType:i,orientation:o},a,d=null){if(null==t||null==n)return null;const l=V(d?.directSegment??new j,{elevationAlignedStartPoint:t,elevationAlignedEndPoint:n},a),c=d?.primaryOffsetAxis??v();B(c,{measureType:i,elevationAlignedStartPoint:t,elevationAlignedEndPoint:n,directSegment:l,orientation:o,renderCoordsHelper:a});const p=d?.dimensionSegment??new j;return G({elevationAlignedStartPoint:t,elevationAlignedEndPoint:n})&&i===e.Vertical?(s(p.startRenderSpace,l.startRenderSpace),s(p.endRenderSpace,l.endRenderSpace)):Y(p,{offsetAxis:c,offset:r,relativeToSegment:l,renderCoordsHelper:a}),{elevationAlignedStartPoint:t,elevationAlignedEndPoint:n,directSegment:l,dimensionSegment:p,primaryOffsetAxis:c,spatialReference:a.spatialReference}}function U(e,t,n,r){return t===b.Start?(s(e.startRenderSpace,n.startRenderSpace),s(e.endRenderSpace,r.startRenderSpace)):(s(e.startRenderSpace,n.endRenderSpace),s(e.endRenderSpace,r.endRenderSpace)),e}var b;function k(e,t,n,r){d(e.startRenderSpace,t.startRenderSpace,n,r),d(e.endRenderSpace,t.endRenderSpace,n,r)}function M(t,n,r,i){switch(n){case e.Direct:return V(t,r,i);case e.Horizontal:case e.Vertical:{const{elevationAlignedStartPoint:o,elevationAlignedEndPoint:a,dimension:s,geometry:d}=r;let l;if(s.measureType===e.Direct){l=D(d,i)===o.z>a.z,n===e.Horizontal&&(l=!l)}else l=!O(d);const[c,p]=l?[o,a]:[a,o],u=E(p,I);return n===e.Horizontal?u.z=c.z:(u.x=c.x,u.y=c.y),i.toRenderCoords(c,t.startRenderSpace),i.toRenderCoords(u,t.endRenderSpace),t}}}function V(e,t,n){return n.toRenderCoords(t.elevationAlignedStartPoint,e.startRenderSpace),n.toRenderCoords(t.elevationAlignedEndPoint,e.endRenderSpace),e}function D(e,t){const n=e.directSegment.eval(.5,P.get()),r=t.worldUpAtPosition(n,P.get()),i=e.dimensionSegment.eval(.5,P.get()),o=l(P.get(),i,n);return!c(o,R)&&p(o,r)>0}function O(e){const{startRenderSpace:t,endRenderSpace:n}=e.dimensionSegment,{startRenderSpace:r,endRenderSpace:i}=e.directSegment;return u(r,t)<u(i,n)}!function(e){e[e.Start=0]="Start",e[e.End=1]="End"}(b||(b={}));const I=y(0,0,0,null);function L(e,t,n,r){const{directSegment:i}=n,o=B(P.get(),{measureType:t,directSegment:i,renderCoordsHelper:r}),a=Y(q,{offsetAxis:o,offset:0,relativeToSegment:i,renderCoordsHelper:r}).eval(.5,P.get()),s=l(P.get(),e,a);return p(s,o)*r.unitInMeters}const q=new j;function B(n,r){const{measureType:i,elevationAlignedStartPoint:a,elevationAlignedEndPoint:d,directSegment:{startRenderSpace:u,endRenderSpace:f},directSegment:v,renderCoordsHelper:y}=r,E=v.eval(.5,P.get()),j=y.worldUpAtPosition(E,P.get()),x=y.worldBasisAtPosition(E,A.Y,P.get());switch(i){case e.Horizontal:s(n,j);break;case e.Vertical:p(u,j)<p(f,j)?l(n,f,u):l(n,u,f),S(n,n,j),S(n,n,j);break;case e.Direct:{const e=r.orientation??0;if(G({elevationAlignedStartPoint:a,elevationAlignedEndPoint:d}))o(F,-t(e),j),m(n,x,F);else{const r=l(P.get(),f,u),i=S(P.get(),r,j);S(i,i,r),o(F,t(e),r),m(n,i,F)}break}}return c(n,R)?s(n,x):g(n,n)}const F=a();function G({elevationAlignedStartPoint:e,elevationAlignedEndPoint:t}){return null!=e&&null!=t&&e.x===t.x&&e.y===t.y}function Y(e,t){const{offsetAxis:n,offset:r,relativeToSegment:{startRenderSpace:i,endRenderSpace:o},relativeToSegment:a,renderCoordsHelper:s}=t,l=r/s.unitInMeters,[c,p]=J(i,o,n,l);return d(e.startRenderSpace,a.startRenderSpace,n,c),d(e.endRenderSpace,a.endRenderSpace,n,p),e}function J(e,t,n,r=0){const i=p(t,n),o=p(e,n),a=Math.abs(i-o)+r;return i>o?[a,r]:[r,a]}function K(e,t,n){const r=t.directSegment.eval(.5,P.get());return n.worldUpAtPosition(r,e)}function N(e,t){const{startRenderSpace:n,endRenderSpace:r}=t.directSegment;return l(e,r,n)}function Q(e,t,n={invert:!1}){const{startRenderSpace:r,endRenderSpace:i}=t.dimensionSegment;return n.invert?l(e,r,i):l(e,i,r)}function W(e,t){const n=e.directSegment.eval(.5,P.get());return t.headingAtPosition(n,e.primaryOffsetAxis)}function X(e,t){return f(Q(Z,e))/t**2}const Z=v();function $(e){const{elevationAlignedStartPoint:t,elevationAlignedEndPoint:r}=e;if(null==t||null==r)return!1;const i=H(t,r);return null!=i&&n(i,"meters").value>T}function _(e){return null!=e.geometry}export{b as OffsetSegmentLocation,G as arePointsVerticallyAligned,z as computationToGeometryDependencies,C as computeGeometryFromDimension,w as computeLength,B as computeOffsetAxis,L as computeOffsetForPoint,M as computeSegmentForMeasureType,U as computeSpanningSegment,Q as dimensionStartToEnd,N as directStartToEnd,K as directUp,W as headingFromGeometry,$ as isGeodesicDimension,_ as isValidComputation,X as maxScreenLengthSquaredFromGeometry,k as offsetSegment};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import i from"../../../../core/Logger.js";import{createLength as o}from"../../../../core/quantityUtils.js";import{watch as r,syncAndInitial as s}from"../../../../core/reactiveUtils.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import i from"../../../../core/Logger.js";import{createLength as o}from"../../../../core/quantityUtils.js";import{watch as r,syncAndInitial as s}from"../../../../core/reactiveUtils.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{q as l}from"../../../../chunks/vec32.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{geodesicLength as m}from"../../../../geometry/geometryEngine.js";import p from"../../../../geometry/Polyline.js";import{canProjectWithoutEngine as u}from"../../../../geometry/projection.js";import d from"../../../../geometry/SpatialReference.js";import{getSphericalPCPF as h,SphericalECEFSpatialReference as f,WGS84ECEFSpatialReference as v}from"../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectPointToVector as j}from"../../../../geometry/projection/projectPointToVector.js";import{projectPointToWGS84ComparableLonLat as g}from"../../../../geometry/projection/projectPointToWGS84ComparableLonLat.js";import{isSupported as P,geodesicLengths as y,inverseGeodeticSolver as _,InverseGeodeticSolverResult as D}from"../../../../geometry/support/geodesicUtils.js";import{MeasurementMode as w}from"../interfaces.js";import{applyProjectionAndElevationAlignment as z,logFailedGeometryProjectionError as R}from"../support/projectionUtils.js";import{UnitNormalizer as A}from"../support/UnitNormalizer.js";import{geodesicDistanceThreshold as E}from"../../../support/geodesicMeasurementUtils.js";let b=class extends t{constructor(e){super(e),this._unitNormalizer=new A,this._tempStartPosition=c(),this._tempEndPosition=c(),this._tempCornerPosition=c()}initialize(){const e=this.view.spatialReference,t=h(e),i=t===f?v:t;this._sphericalPCPF=i;const o=u(e,i);this._unitNormalizer.spatialReference=o?i:e,this.addHandles([r((()=>({viewData:this.viewData,startPoint:this.analysis.startPoint})),(({viewData:e,startPoint:t})=>{e.elevationAlignedStartPoint=this._applyProjectionAndElevationAlignment(t)}),s),r((()=>({viewData:this.viewData,endPoint:this.analysis.endPoint})),(({viewData:e,endPoint:t})=>{e.elevationAlignedEndPoint=this._applyProjectionAndElevationAlignment(t)}),s),r((()=>({result:this._computedResult,viewData:this.viewData})),(({result:e,viewData:t})=>{t.result=e}),s)])}_applyProjectionAndElevationAlignment(e){if(null==e)return e;const{spatialReference:t,elevationProvider:o}=this.view,r=z(e,t,o);return r??(R(this.analysis,e.spatialReference,i.getLogger(this)),null)}get _computedResult(){const{elevationAlignedStartPoint:e,elevationAlignedEndPoint:t,measurementMode:i}=this.viewData;if(null==e||null==t)return null;const o=this._euclideanDistances(e,t),r=this._geodesicDistance(e,t);let s,n;switch(i){case w.Auto:n=null!=r?"geodesic":"euclidean",s=r??o.horizontal;break;case w.Geodesic:if(null==r)return null;n="geodesic",s=r;break;case w.Euclidean:n="euclidean",s=o.horizontal}return{mode:n,directDistance:o.direct,horizontalDistance:s,verticalDistance:o.vertical,distance:i===w.Euclidean||o.horizontal.value<=E?o.direct:r??o.horizontal}}_euclideanDistances(e,t){const i=e.clone();i.z=t.z;const r=this._tempStartPosition,s=this._tempEndPosition,n=this._tempCornerPosition,a=this.view.spatialReference,c=this._sphericalPCPF,m=u(a,c)?c:a;j(e,r,m),j(t,s,m),j(i,n,m);const p=l(r,s),d=l(n,s),h=Math.abs(t.z-e.z),f=e=>this._unitNormalizer.normalizeDistance(e),v=f(p),g=f(d),P=f(h);return{direct:o(v,"meters"),horizontal:o(g,"meters"),vertical:o(P,"meters")}}_geodesicDistance(e,t){const{spatialReference:i}=e,r=new p({spatialReference:i});r.addPath([e,t]);const s=i.isGeographic&&P(i)?y([r],"meters")[0]:i.isWebMercator?m(r,"meters"):null,n=null!=s?s:this._fallbackGeodesicDistance(e,t);return null!=n?o(n,"meters"):null}_fallbackGeodesicDistance(e,t){if(g(e,S)&&g(t,C)){const e=new D;return _(e,S,C,d.WGS84),e.distance}return null}};e([n()],b.prototype,"view",void 0),e([n()],b.prototype,"analysis",void 0),e([n()],b.prototype,"viewData",void 0),e([n()],b.prototype,"_computedResult",null),b=e([a("esri.views.3d.analysis.DirectLineMeasurement.DirectLineMeasurementController")],b);const S=c(),C=c();export{b as DirectLineMeasurementController};
|